• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=thumb -mattr=+thumb2 | FileCheck %s
2
3define i8 @f1(i8 %a, i8* %v) {
4; CHECK: f1:
5; CHECK: strb r0, [r1]
6        store i8 %a, i8* %v
7        ret i8 %a
8}
9
10define i8 @f2(i8 %a, i8* %v) {
11; CHECK: f2:
12; CHECK: strb.w r0, [r1, #4092]
13        %tmp2 = getelementptr i8* %v, i32 4092
14        store i8 %a, i8* %tmp2
15        ret i8 %a
16}
17
18define i8 @f2a(i8 %a, i8* %v) {
19; CHECK: f2a:
20; CHECK: strb r0, [r1, #-128]
21        %tmp2 = getelementptr i8* %v, i32 -128
22        store i8 %a, i8* %tmp2
23        ret i8 %a
24}
25
26define i8 @f3(i8 %a, i8* %v) {
27; CHECK: f3:
28; CHECK: mov.w r2, #4096
29; CHECK: strb r0, [r1, r2]
30        %tmp2 = getelementptr i8* %v, i32 4096
31        store i8 %a, i8* %tmp2
32        ret i8 %a
33}
34
35define i8 @f4(i8 %a, i32 %base) {
36entry:
37; CHECK: f4:
38; CHECK: strb r0, [r1, #-128]
39        %tmp1 = sub i32 %base, 128
40        %tmp2 = inttoptr i32 %tmp1 to i8*
41        store i8 %a, i8* %tmp2
42        ret i8 %a
43}
44
45define i8 @f5(i8 %a, i32 %base, i32 %offset) {
46entry:
47; CHECK: f5:
48; CHECK: strb r0, [r1, r2]
49        %tmp1 = add i32 %base, %offset
50        %tmp2 = inttoptr i32 %tmp1 to i8*
51        store i8 %a, i8* %tmp2
52        ret i8 %a
53}
54
55define i8 @f6(i8 %a, i32 %base, i32 %offset) {
56entry:
57; CHECK: f6:
58; CHECK: strb.w r0, [r1, r2, lsl #2]
59        %tmp1 = shl i32 %offset, 2
60        %tmp2 = add i32 %base, %tmp1
61        %tmp3 = inttoptr i32 %tmp2 to i8*
62        store i8 %a, i8* %tmp3
63        ret i8 %a
64}
65
66define i8 @f7(i8 %a, i32 %base, i32 %offset) {
67entry:
68; CHECK: f7:
69; CHECK: lsrs r2, r2, #2
70; CHECK: strb r0, [r1, r2]
71        %tmp1 = lshr i32 %offset, 2
72        %tmp2 = add i32 %base, %tmp1
73        %tmp3 = inttoptr i32 %tmp2 to i8*
74        store i8 %a, i8* %tmp3
75        ret i8 %a
76}
77