Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: tests_lit/llvm2ice_tests/return_immediates.ll

Issue 1127963004: Subzero ARM: lowerArguments (GPR), basic legalize(), and lowerRet(i32, i64). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fix warnings, etc Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests_lit/llvm2ice_tests/int-arg.ll ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; Simple test that returns various immediates. For fixed-width instruction
2 ; sets, some immediates are more complicated than others.
3 ; For x86-32, it shouldn't be a problem.
4
5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s
6
7 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented)
8 ; once enough infrastructure is in. Also, switch to --filetype=obj
9 ; when possible.
10 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=asm --assemble \
11 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \
12 ; RUN: | %if --need=target_ARM32 --command FileCheck --check-prefix ARM32 %s
13
14 ; Test 8-bits of all ones rotated right by various amounts (even vs odd).
15 ; ARM has a shifter that allows encoding 8-bits rotated right by even amounts.
16 ; The first few "rotate right" test cases are expressed as shift-left.
17
18 define i32 @ret_8bits_shift_left0() {
19 ret i32 255
20 }
21 ; CHECK-LABEL: ret_8bits_shift_left0
22 ; CHECK-NEXT: mov eax,0xff
23 ; ARM32-LABEL: ret_8bits_shift_left0
24 ; ARM32-NEXT: mov r0, #255
25
26 define i32 @ret_8bits_shift_left1() {
27 ret i32 510
28 }
29 ; CHECK-LABEL: ret_8bits_shift_left1
30 ; CHECK-NEXT: mov eax,0x1fe
31 ; ARM32-LABEL: ret_8bits_shift_left1
32 ; ARM32-NEXT: movw r0, #510
33
34 define i32 @ret_8bits_shift_left2() {
35 ret i32 1020
36 }
37 ; CHECK-LABEL: ret_8bits_shift_left2
38 ; CHECK-NEXT: mov eax,0x3fc
39 ; ARM32-LABEL: ret_8bits_shift_left2
40 ; ARM32-NEXT: mov r0, #1020
41
42 define i32 @ret_8bits_shift_left4() {
43 ret i32 4080
44 }
45 ; CHECK-LABEL: ret_8bits_shift_left4
46 ; CHECK-NEXT: mov eax,0xff0
47 ; ARM32-LABEL: ret_8bits_shift_left4
48 ; ARM32-NEXT: mov r0, #4080
49
50 define i32 @ret_8bits_shift_left14() {
51 ret i32 4177920
52 }
53 ; CHECK-LABEL: ret_8bits_shift_left14
54 ; CHECK-NEXT: mov eax,0x3fc000
55 ; ARM32-LABEL: ret_8bits_shift_left14
56 ; ARM32-NEXT: mov r0, #4177920
57
58 define i32 @ret_8bits_shift_left15() {
59 ret i32 8355840
60 }
61 ; CHECK-LABEL: ret_8bits_shift_left15
62 ; CHECK-NEXT: mov eax,0x7f8000
63 ; ARM32-LABEL: ret_8bits_shift_left15
64 ; ARM32-NEXT: movw r0, #32768
65 ; ARM32-NEXT: movt r0, #127
66
67 ; Shift 8 bits left by 24 to the i32 limit. This is also ror by 8 bits.
68
69 define i32 @ret_8bits_shift_left24() {
70 ret i32 4278190080
71 }
72 ; CHECK-LABEL: ret_8bits_shift_left24
73 ; CHECK-NEXT: mov eax,0xff000000
74 ; ARM32-LABEL: ret_8bits_shift_left24
75 ; ARM32-NEXT: mov r0, #-16777216
76 ; ARM32-NEXT: bx lr
77
78 ; The next few cases wrap around and actually demonstrate the rotation.
79
80 define i32 @ret_8bits_ror7() {
81 ret i32 4261412865
82 }
83 ; CHECK-LABEL: ret_8bits_ror7
84 ; CHECK-NEXT: mov eax,0xfe000001
85 ; ARM32-LABEL: ret_8bits_ror7
86 ; ARM32-NEXT: movw r0, #1
87 ; ARM32-NEXT: movt r0, #65024
88
89 define i32 @ret_8bits_ror6() {
90 ret i32 4227858435
91 }
92 ; CHECK-LABEL: ret_8bits_ror6
93 ; CHECK-NEXT: mov eax,0xfc000003
94 ; ARM32-LABEL: ret_8bits_ror6
95 ; ARM32-NEXT: mov r0, #-67108861
96 ; ARM32-NEXT: bx lr
97
98 define i32 @ret_8bits_ror5() {
99 ret i32 4160749575
100 }
101 ; CHECK-LABEL: ret_8bits_ror5
102 ; CHECK-NEXT: mov eax,0xf8000007
103 ; ARM32-LABEL: ret_8bits_ror5
104 ; ARM32-NEXT: movw r0, #7
105 ; ARM32-NEXT: movt r0, #63488
106
107 define i32 @ret_8bits_ror4() {
108 ret i32 4026531855
109 }
110 ; CHECK-LABEL: ret_8bits_ror4
111 ; CHECK-NEXT: mov eax,0xf000000f
112 ; ARM32-LABEL: ret_8bits_ror4
113 ; ARM32-NEXT: mov r0, #-268435441
114 ; ARM32-NEXT: bx lr
115
116 define i32 @ret_8bits_ror3() {
117 ret i32 3758096415
118 }
119 ; CHECK-LABEL: ret_8bits_ror3
120 ; CHECK-NEXT: mov eax,0xe000001f
121 ; ARM32-LABEL: ret_8bits_ror3
122 ; ARM32-NEXT: movw r0, #31
123 ; ARM32-NEXT: movt r0, #57344
124
125 define i32 @ret_8bits_ror2() {
126 ret i32 3221225535
127 }
128 ; CHECK-LABEL: ret_8bits_ror2
129 ; CHECK-NEXT: mov eax,0xc000003f
130 ; ARM32-LABEL: ret_8bits_ror2
131 ; ARM32-NEXT: mov r0, #-1073741761
132 ; ARM32-NEXT: bx lr
133
134 define i32 @ret_8bits_ror1() {
135 ret i32 2147483775
136 }
137 ; CHECK-LABEL: ret_8bits_ror1
138 ; CHECK-NEXT: mov eax,0x8000007f
139 ; ARM32-LABEL: ret_8bits_ror1
140 ; ARM32-NEXT: movw r0, #127
141 ; ARM32-NEXT: movt r0, #32768
142
143 ; Some architectures can handle 16-bits at a time efficiently,
144 ; so also test those.
145
146 define i32 @ret_16bits_lower() {
147 ret i32 65535
148 }
149 ; CHECK-LABEL: ret_16bits_lower
150 ; CHECK-NEXT: mov eax,0xffff
151 ; ARM32-LABEL: ret_16bits_lower
152 ; ARM32-NEXT: movw r0, #65535
153 ; ARM32-NEXT: bx lr
154
155 define i32 @ret_17bits_lower() {
156 ret i32 131071
157 }
158 ; CHECK-LABEL: ret_17bits_lower
159 ; CHECK-NEXT: mov eax,0x1ffff
160 ; ARM32-LABEL: ret_17bits_lower
161 ; ARM32-NEXT: movw r0, #65535
162 ; ARM32-NEXT: movt r0, #1
163
164 define i32 @ret_16bits_upper() {
165 ret i32 4294901760
166 }
167 ; CHECK-LABEL: ret_16bits_upper
168 ; CHECK-NEXT: mov eax,0xffff0000
169 ; ARM32-LABEL: ret_16bits_upper
170 ; ARM32-NEXT: movw r0, #0
171 ; ARM32-NEXT: movt r0, #65535
172
173 ; Some 32-bit immediates can be inverted, and moved in a single instruction.
174
175 define i32 @ret_8bits_inverted_shift_left0() {
176 ret i32 4294967040
177 }
178 ; CHECK-LABEL: ret_8bits_inverted_shift_left0
179 ; CHECK-NEXT: mov eax,0xffffff00
180 ; ARM32-LABEL: ret_8bits_inverted_shift_left0
181 ; ARM32-NEXT: mvn r0, #255
182 ; ARM32-NEXT: bx lr
183
184 define i32 @ret_8bits_inverted_shift_left24() {
185 ret i32 16777215
186 }
187 ; CHECK-LABEL: ret_8bits_inverted_shift_left24
188 ; CHECK-NEXT: mov eax,0xffffff
189 ; ARM32-LABEL: ret_8bits_inverted_shift_left24
190 ; ARM32-NEXT: mvn r0, #-16777216
191 ; ARM32-NEXT: bx lr
192
193 define i32 @ret_8bits_inverted_ror2() {
194 ret i32 1073741760
195 }
196 ; CHECK-LABEL: ret_8bits_inverted_ror2
197 ; CHECK-NEXT: mov eax,0x3fffffc0
198 ; ARM32-LABEL: ret_8bits_inverted_ror2
199 ; ARM32-NEXT: mvn r0, #-1073741761
200 ; ARM32-NEXT: bx lr
201
202 define i32 @ret_8bits_inverted_ror6() {
203 ret i32 67108860
204 }
205 ; CHECK-LABEL: ret_8bits_inverted_ror6
206 ; CHECK-NEXT: mov eax,0x3fffffc
207 ; ARM32-LABEL: ret_8bits_inverted_ror6
208 ; ARM32-NEXT: mvn r0, #-67108861
209 ; ARM32-NEXT: bx lr
210
211 define i32 @ret_8bits_inverted_ror7() {
212 ret i32 33554430
213 }
214 ; CHECK-LABEL: ret_8bits_inverted_ror7
215 ; CHECK-NEXT: mov eax,0x1fffffe
216 ; ARM32-LABEL: ret_8bits_inverted_ror7
217 ; ARM32-NEXT: movw r0, #65534
218 ; ARM32-NEXT: movt r0, #511
219
220 ; 64-bit immediates.
221
222 define i64 @ret_64bits_shift_left0() {
223 ret i64 1095216660735
224 }
225 ; CHECK-LABEL: ret_64bits_shift_left0
226 ; CHECK-NEXT: mov eax,0xff
227 ; CHECK-NEXT: mov edx,0xff
228 ; ARM32-LABEL: ret_64bits_shift_left0
229 ; ARM32-NEXT: movw r0, #255
230 ; ARM32-NEXT: movw r1, #255
231
232 ; A relocatable constant is assumed to require 32-bits along with
233 ; relocation directives.
234
235 declare void @_start()
236
237 define i32 @ret_addr() {
238 %ptr = ptrtoint void ()* @_start to i32
239 ret i32 %ptr
240 }
241 ; CHECK-LABEL: ret_addr
242 ; CHECK-NEXT: mov eax,0x0 {{.*}} R_386_32 _start
243 ; ARM32-LABEL: ret_addr
244 ; ARM32-NEXT: movw r0, #0 {{.*}} R_ARM_MOVW_ABS_NC _start
245 ; ARM32-NEXT: movt r0, #0 {{.*}} R_ARM_MOVT_ABS _start
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/int-arg.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698