• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=thumb -mattr=+thumb2 | FileCheck %s
2
3
4; CHECK: f1:
5; CHECK: 	ror.w	r0, r0, #22
6define i32 @f1(i32 %a) {
7    %l8 = shl i32 %a, 10
8    %r8 = lshr i32 %a, 22
9    %tmp = or i32 %l8, %r8
10    ret i32 %tmp
11}
12
13; CHECK: f2:
14; CHECK-NOT: and
15; CHECK: ror
16define i32 @f2(i32 %v, i32 %nbits) {
17entry:
18  %and = and i32 %nbits, 31
19  %shr = lshr i32 %v, %and
20  %sub = sub i32 32, %and
21  %shl = shl i32 %v, %sub
22  %or = or i32 %shl, %shr
23  ret i32 %or
24}