blob: 77936b7bef9b6497863fff5449fabb2225c6b24e [file] [log] [blame]
Akira Hatanakadc25f9f2011-11-29 23:08:41 +00001; RUN: llc -march=mips -mcpu=mips32r2 < %s | FileCheck %s
Simon Atanasyan1093afe22013-11-19 12:20:17 +00002; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips32r2 -mattr=+mips16 < %s | FileCheck %s -check-prefix=mips16
Zlatko Buljan4807f822016-05-04 12:02:12 +00003; RUN: llc -march=mips -mcpu=mips32r3 -mattr=+micromips < %s | FileCheck %s \
4; RUN: -check-prefix=MM32
5; RUN: llc -march=mips -mcpu=mips32r6 -mattr=+micromips < %s | FileCheck %s \
6; RUN: -check-prefix=MM32
Bruno Cardoso Lopesd47180e2010-12-09 17:32:30 +00007
Akira Hatanaka1fef2842011-09-30 19:18:24 +00008; CHECK: rotrv $2, $4
Reed Kotler97309af2013-10-08 17:32:33 +00009; mips16: .ent rot0
Zlatko Buljan4807f822016-05-04 12:02:12 +000010; MM32: li16 $2, 32
11; MM32: subu16 $2, $2, $5
12; MM32: rotrv $2, $4, $2
Bruno Cardoso Lopesd47180e2010-12-09 17:32:30 +000013define i32 @rot0(i32 %a, i32 %b) nounwind readnone {
14entry:
15 %shl = shl i32 %a, %b
16 %sub = sub i32 32, %b
17 %shr = lshr i32 %a, %sub
18 %or = or i32 %shr, %shl
19 ret i32 %or
20}
21
22; CHECK: rotr $2, $4, 22
Reed Kotler97309af2013-10-08 17:32:33 +000023; mips16: .ent rot1
Zlatko Buljan4807f822016-05-04 12:02:12 +000024; MM32: rotr $2, $4, 22
Bruno Cardoso Lopesd47180e2010-12-09 17:32:30 +000025define i32 @rot1(i32 %a) nounwind readnone {
26entry:
27 %shl = shl i32 %a, 10
28 %shr = lshr i32 %a, 22
29 %or = or i32 %shl, %shr
30 ret i32 %or
31}
32
33; CHECK: rotrv $2, $4, $5
Reed Kotler97309af2013-10-08 17:32:33 +000034; mips16: .ent rot2
Zlatko Buljan4807f822016-05-04 12:02:12 +000035; MM32: rotrv $2, $4, $5
Bruno Cardoso Lopesd47180e2010-12-09 17:32:30 +000036define i32 @rot2(i32 %a, i32 %b) nounwind readnone {
37entry:
38 %shr = lshr i32 %a, %b
39 %sub = sub i32 32, %b
40 %shl = shl i32 %a, %sub
41 %or = or i32 %shl, %shr
42 ret i32 %or
43}
44
45; CHECK: rotr $2, $4, 10
Reed Kotler97309af2013-10-08 17:32:33 +000046; mips16: .ent rot3
Zlatko Buljan4807f822016-05-04 12:02:12 +000047; MM32: rotr $2, $4, 10
Bruno Cardoso Lopesd47180e2010-12-09 17:32:30 +000048define i32 @rot3(i32 %a) nounwind readnone {
49entry:
50 %shr = lshr i32 %a, 10
51 %shl = shl i32 %a, 22
52 %or = or i32 %shr, %shl
53 ret i32 %or
54}
55