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