blob: 813bbdf18bbda71b19d0f54d0785eba7a801cfd3 [file] [log] [blame]
Akira Hatanakaed2a7d22011-11-29 23:08:41 +00001; RUN: llc -march=mips -mcpu=mips32r2 < %s | FileCheck %s
Reed Kotlerb359bda2013-10-08 17:32:33 +00002; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips32r2 -mattr=+mips16 -soft-float -mips16-hard-float < %s | FileCheck %s -check-prefix=mips16
Bruno Cardoso Lopes908b6dd2010-12-09 17:32:30 +00003
Akira Hatanaka5773fd52011-09-30 19:18:24 +00004; CHECK: rotrv $2, $4
Reed Kotlerb359bda2013-10-08 17:32:33 +00005; mips16: .ent rot0
Bruno Cardoso Lopes908b6dd2010-12-09 17:32:30 +00006define i32 @rot0(i32 %a, i32 %b) nounwind readnone {
7entry:
8 %shl = shl i32 %a, %b
9 %sub = sub i32 32, %b
10 %shr = lshr i32 %a, %sub
11 %or = or i32 %shr, %shl
12 ret i32 %or
13}
14
15; CHECK: rotr $2, $4, 22
Reed Kotlerb359bda2013-10-08 17:32:33 +000016; mips16: .ent rot1
Bruno Cardoso Lopes908b6dd2010-12-09 17:32:30 +000017define i32 @rot1(i32 %a) nounwind readnone {
18entry:
19 %shl = shl i32 %a, 10
20 %shr = lshr i32 %a, 22
21 %or = or i32 %shl, %shr
22 ret i32 %or
23}
24
25; CHECK: rotrv $2, $4, $5
Reed Kotlerb359bda2013-10-08 17:32:33 +000026; mips16: .ent rot2
Bruno Cardoso Lopes908b6dd2010-12-09 17:32:30 +000027define i32 @rot2(i32 %a, i32 %b) nounwind readnone {
28entry:
29 %shr = lshr i32 %a, %b
30 %sub = sub i32 32, %b
31 %shl = shl i32 %a, %sub
32 %or = or i32 %shl, %shr
33 ret i32 %or
34}
35
36; CHECK: rotr $2, $4, 10
Reed Kotlerb359bda2013-10-08 17:32:33 +000037; mips16: .ent rot3
Bruno Cardoso Lopes908b6dd2010-12-09 17:32:30 +000038define i32 @rot3(i32 %a) nounwind readnone {
39entry:
40 %shr = lshr i32 %a, 10
41 %shl = shl i32 %a, 22
42 %or = or i32 %shr, %shl
43 ret i32 %or
44}
45