• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 %s -o - | FileCheck %s
2; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s -check-prefix=THUMB1
3
4; CHECK-LABEL: 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-LABEL: f2:
14; CHECK-NOT: and
15; CHECK: ror
16; THUMB1: f2
17; THUMB1: and
18define i32 @f2(i32 %v, i32 %nbits) {
19entry:
20  %and = and i32 %nbits, 31
21  %shr = lshr i32 %v, %and
22  %sub = sub i32 32, %and
23  %shl = shl i32 %v, %sub
24  %or = or i32 %shl, %shr
25  ret i32 %or
26}
27