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

Side by Side Diff: tests_lit/llvm2ice_tests/vector-arg.ll

Issue 509233002: Convert lit tests to check disassembled assembly. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: add comment Created 6 years, 3 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
OLDNEW
1 ; This file checks that Subzero generates code in accordance with the 1 ; This file checks that Subzero generates code in accordance with the
2 ; calling convention for vectors. 2 ; calling convention for vectors.
3 3
4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s 4 ; TODO(jvoung): remove -ffunction-sections. Sadly... diassembling some
5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s 5 ; "ret" within a section are broken in llvm-objdump for LLVM 3.4, and 3.5.
6 ; RUN: %llvm2ice -O2 --verbose none %s \ 6 ; It was only fixed in 3.6.
7 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj 7
8 ; RUN: %llvm2ice -Om1 --verbose none %s \ 8 ; RUN: %llvm2ice -O2 --verbose none -ffunction-sections %s \
9 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj 9 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \
10 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s
11 ; RUN: %llvm2ice -Om1 --verbose none -ffunction-sections %s \
12 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \
13 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - \
14 ; RUN: | FileCheck --check-prefix=OPTM1 %s
10 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s 15 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
11 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s 16 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
12 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ 17 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
13 ; RUN: | FileCheck --check-prefix=DUMP %s 18 ; RUN: | FileCheck --check-prefix=DUMP %s
14 19
15 ; The first five functions test that vectors are moved from their 20 ; The first five functions test that vectors are moved from their
16 ; correct argument location to xmm0. 21 ; correct argument location to xmm0.
17 22
18 define <4 x float> @test_returning_arg0(<4 x float> %arg0, <4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3, <4 x float> %arg4, <4 x float> %arg5) { 23 define <4 x float> @test_returning_arg0(<4 x float> %arg0, <4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3, <4 x float> %arg4, <4 x float> %arg5) {
19 entry: 24 entry:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 ; OPTM1-LABEL: test_returning_arg3: 69 ; OPTM1-LABEL: test_returning_arg3:
65 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3 70 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3
66 ; OPTM1: movups xmm0, xmmword ptr [[LOC]] 71 ; OPTM1: movups xmm0, xmmword ptr [[LOC]]
67 ; OPTM1: ret 72 ; OPTM1: ret
68 } 73 }
69 74
70 define <4 x float> @test_returning_arg4(<4 x float> %arg0, <4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3, <4 x float> %arg4, <4 x float> %arg5) { 75 define <4 x float> @test_returning_arg4(<4 x float> %arg0, <4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3, <4 x float> %arg4, <4 x float> %arg5) {
71 entry: 76 entry:
72 ret <4 x float> %arg4 77 ret <4 x float> %arg4
73 ; CHECK-LABEL: test_returning_arg4: 78 ; CHECK-LABEL: test_returning_arg4:
74 ; CHECK: movups xmm0, xmmword ptr [esp+4] 79 ; CHECK: movups xmm0, xmmword ptr [esp + 4]
75 ; CHECK: ret 80 ; CHECK: ret
76 81
77 ; OPTM1-LABEL: test_returning_arg4: 82 ; OPTM1-LABEL: test_returning_arg4:
78 ; OPTM1: movups xmm0, xmmword ptr {{.*}} 83 ; OPTM1: movups xmm0, xmmword ptr {{.*}}
79 ; OPTM1: ret 84 ; OPTM1: ret
80 } 85 }
81 86
82 ; The next five functions check that xmm arguments are handled 87 ; The next five functions check that xmm arguments are handled
83 ; correctly when interspersed with stack arguments in the argument 88 ; correctly when interspersed with stack arguments in the argument
84 ; list. 89 ; list.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 ; OPTM1-LABEL: test_returning_interspersed_arg3: 137 ; OPTM1-LABEL: test_returning_interspersed_arg3:
133 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3 138 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3
134 ; OPTM1: movups xmm0, xmmword ptr [[LOC]] 139 ; OPTM1: movups xmm0, xmmword ptr [[LOC]]
135 ; OPTM1: ret 140 ; OPTM1: ret
136 } 141 }
137 142
138 define <4 x float> @test_returning_interspersed_arg4(i32 %i32arg0, double %doubl earg0, <4 x float> %arg0, <4 x float> %arg1, i32 %i32arg1, <4 x float> %arg2, do uble %doublearg1, <4 x float> %arg3, i32 %i32arg2, double %doublearg2, float %fl oatarg0, <4 x float> %arg4, <4 x float> %arg5, float %floatarg1) { 143 define <4 x float> @test_returning_interspersed_arg4(i32 %i32arg0, double %doubl earg0, <4 x float> %arg0, <4 x float> %arg1, i32 %i32arg1, <4 x float> %arg2, do uble %doublearg1, <4 x float> %arg3, i32 %i32arg2, double %doublearg2, float %fl oatarg0, <4 x float> %arg4, <4 x float> %arg5, float %floatarg1) {
139 entry: 144 entry:
140 ret <4 x float> %arg4 145 ret <4 x float> %arg4
141 ; CHECK-LABEL: test_returning_interspersed_arg4: 146 ; CHECK-LABEL: test_returning_interspersed_arg4:
142 ; CHECK: movups xmm0, xmmword ptr [esp+52] 147 ; CHECK: movups xmm0, xmmword ptr [esp + 52]
143 ; CHECK: ret 148 ; CHECK: ret
144 149
145 ; OPTM1-LABEL: test_returning_interspersed_arg4: 150 ; OPTM1-LABEL: test_returning_interspersed_arg4:
146 ; OPTM1: movups xmm0, xmmword ptr {{.*}} 151 ; OPTM1: movups xmm0, xmmword ptr {{.*}}
147 ; OPTM1: ret 152 ; OPTM1: ret
148 } 153 }
149 154
150 ; Test that vectors are passed correctly as arguments to a function. 155 ; Test that vectors are passed correctly as arguments to a function.
151 156
152 declare void @VectorArgs(<4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>) 157 declare void @VectorArgs(<4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>)
153 158
154 declare void @killXmmRegisters() 159 declare void @killXmmRegisters()
155 160
156 define void @test_passing_vectors(<4 x float> %arg0, <4 x float> %arg1, <4 x flo at> %arg2, <4 x float> %arg3, <4 x float> %arg4, <4 x float> %arg5, <4 x float> %arg6, <4 x float> %arg7, <4 x float> %arg8, <4 x float> %arg9) { 161 define void @test_passing_vectors(<4 x float> %arg0, <4 x float> %arg1, <4 x flo at> %arg2, <4 x float> %arg3, <4 x float> %arg4, <4 x float> %arg5, <4 x float> %arg6, <4 x float> %arg7, <4 x float> %arg8, <4 x float> %arg9) {
157 entry: 162 entry:
158 ; Kills XMM registers so that no in-arg lowering code interferes 163 ; Kills XMM registers so that no in-arg lowering code interferes
159 ; with the test. 164 ; with the test.
160 call void @killXmmRegisters() 165 call void @killXmmRegisters()
161 call void @VectorArgs(<4 x float> %arg9, <4 x float> %arg8, <4 x float> %arg7, <4 x float> %arg6, <4 x float> %arg5, <4 x float> %arg4) 166 call void @VectorArgs(<4 x float> %arg9, <4 x float> %arg8, <4 x float> %arg7, <4 x float> %arg6, <4 x float> %arg5, <4 x float> %arg4)
162 ret void 167 ret void
163 ; CHECK-LABEL: test_passing_vectors: 168 ; CHECK-LABEL: test_passing_vectors:
164 ; CHECK: sub esp, 32 169 ; CHECK: sub esp, 32
165 ; CHECK: movups [[ARG5:.*]], xmmword ptr [esp+64] 170 ; CHECK: movups [[ARG5:.*]], xmmword ptr [esp + 64]
166 ; CHECK: movups xmmword ptr [esp], [[ARG5]] 171 ; CHECK: movups xmmword ptr [esp], [[ARG5]]
167 ; CHECK: movups [[ARG6:.*]], xmmword ptr [esp+48] 172 ; CHECK: movups [[ARG6:.*]], xmmword ptr [esp + 48]
168 ; CHECK: movups xmmword ptr [esp+16], [[ARG6]] 173 ; CHECK: movups xmmword ptr [esp + 16], [[ARG6]]
169 ; CHECK: movups xmm0, xmmword ptr [esp+128] 174 ; CHECK: movups xmm0, xmmword ptr [esp + 128]
170 ; CHECK: movups xmm1, xmmword ptr [esp+112] 175 ; CHECK: movups xmm1, xmmword ptr [esp + 112]
171 ; CHECK: movups xmm2, xmmword ptr [esp+96] 176 ; CHECK: movups xmm2, xmmword ptr [esp + 96]
172 ; CHECK: movups xmm3, xmmword ptr [esp+80] 177 ; CHECK: movups xmm3, xmmword ptr [esp + 80]
173 ; CHECK: call VectorArgs 178 ; CHECK: call -4
174 ; CHECK-NEXT: add esp, 32 179 ; CHECK-NEXT: add esp, 32
175 ; CHECK: ret 180 ; CHECK: ret
176 181
177 ; OPTM1-LABEL: test_passing_vectors: 182 ; OPTM1-LABEL: test_passing_vectors:
178 ; OPTM1: sub esp, 32 183 ; OPTM1: sub esp, 32
179 ; OPTM1: movups [[ARG5:.*]], xmmword ptr {{.*}} 184 ; OPTM1: movups [[ARG5:.*]], xmmword ptr {{.*}}
180 ; OPTM1: movups xmmword ptr [esp], [[ARG5]] 185 ; OPTM1: movups xmmword ptr [esp], [[ARG5]]
181 ; OPTM1: movups [[ARG6:.*]], xmmword ptr {{.*}} 186 ; OPTM1: movups [[ARG6:.*]], xmmword ptr {{.*}}
182 ; OPTM1: movups xmmword ptr [esp+16], [[ARG6]] 187 ; OPTM1: movups xmmword ptr [esp + 16], [[ARG6]]
183 ; OPTM1: movups xmm0, xmmword ptr {{.*}} 188 ; OPTM1: movups xmm0, xmmword ptr {{.*}}
184 ; OPTM1: movups xmm1, xmmword ptr {{.*}} 189 ; OPTM1: movups xmm1, xmmword ptr {{.*}}
185 ; OPTM1: movups xmm2, xmmword ptr {{.*}} 190 ; OPTM1: movups xmm2, xmmword ptr {{.*}}
186 ; OPTM1: movups xmm3, xmmword ptr {{.*}} 191 ; OPTM1: movups xmm3, xmmword ptr {{.*}}
187 ; OPTM1: call VectorArgs 192 ; OPTM1: call -4
188 ; OPTM1-NEXT: add esp, 32 193 ; OPTM1-NEXT: add esp, 32
189 ; OPTM1: ret 194 ; OPTM1: ret
190 } 195 }
191 196
192 declare void @InterspersedVectorArgs(<4 x float>, i64, <4 x float>, i64, <4 x fl oat>, float, <4 x float>, double, <4 x float>, i32, <4 x float>) 197 declare void @InterspersedVectorArgs(<4 x float>, i64, <4 x float>, i64, <4 x fl oat>, float, <4 x float>, double, <4 x float>, i32, <4 x float>)
193 198
194 define void @test_passing_vectors_interspersed(<4 x float> %arg0, <4 x float> %a rg1, <4 x float> %arg2, <4 x float> %arg3, <4 x float> %arg4, <4 x float> %arg5, <4 x float> %arg6, <4 x float> %arg7, <4 x float> %arg8, <4 x float> %arg9) { 199 define void @test_passing_vectors_interspersed(<4 x float> %arg0, <4 x float> %a rg1, <4 x float> %arg2, <4 x float> %arg3, <4 x float> %arg4, <4 x float> %arg5, <4 x float> %arg6, <4 x float> %arg7, <4 x float> %arg8, <4 x float> %arg9) {
195 entry: 200 entry:
196 ; Kills XMM registers so that no in-arg lowering code interferes 201 ; Kills XMM registers so that no in-arg lowering code interferes
197 ; with the test. 202 ; with the test.
198 call void @killXmmRegisters() 203 call void @killXmmRegisters()
199 call void @InterspersedVectorArgs(<4 x float> %arg9, i64 0, <4 x float> %arg8, i64 1, <4 x float> %arg7, float 2.000000e+00, <4 x float> %arg6, double 3.00000 0e+00, <4 x float> %arg5, i32 4, <4 x float> %arg4) 204 call void @InterspersedVectorArgs(<4 x float> %arg9, i64 0, <4 x float> %arg8, i64 1, <4 x float> %arg7, float 2.000000e+00, <4 x float> %arg6, double 3.00000 0e+00, <4 x float> %arg5, i32 4, <4 x float> %arg4)
200 ret void 205 ret void
201 ; CHECK-LABEL: test_passing_vectors_interspersed: 206 ; CHECK-LABEL: test_passing_vectors_interspersed:
202 ; CHECK: sub esp, 80 207 ; CHECK: sub esp, 80
203 ; CHECK: movups [[ARG9:.*]], xmmword ptr [esp+112] 208 ; CHECK: movups [[ARG9:.*]], xmmword ptr [esp + 112]
204 ; CHECK: movups xmmword ptr [esp+32], [[ARG9]] 209 ; CHECK: movups xmmword ptr [esp + 32], [[ARG9]]
205 ; CHECK: movups [[ARG11:.*]], xmmword ptr [esp+96] 210 ; CHECK: movups [[ARG11:.*]], xmmword ptr [esp + 96]
206 ; CHECK: movups xmmword ptr [esp+64], [[ARG11]] 211 ; CHECK: movups xmmword ptr [esp + 64], [[ARG11]]
207 ; CHECK: movups xmm0, xmmword ptr [esp+176] 212 ; CHECK: movups xmm0, xmmword ptr [esp + 176]
208 ; CHECK: movups xmm1, xmmword ptr [esp+160] 213 ; CHECK: movups xmm1, xmmword ptr [esp + 160]
209 ; CHECK: movups xmm2, xmmword ptr [esp+144] 214 ; CHECK: movups xmm2, xmmword ptr [esp + 144]
210 ; CHECK: movups xmm3, xmmword ptr [esp+128] 215 ; CHECK: movups xmm3, xmmword ptr [esp + 128]
211 ; CHECK: call InterspersedVectorArgs 216 ; CHECK: call -4
212 ; CHECK-NEXT: add esp, 80 217 ; CHECK-NEXT: add esp, 80
213 ; CHECK: ret 218 ; CHECK: ret
214 219
215 ; OPTM1-LABEL: test_passing_vectors_interspersed: 220 ; OPTM1-LABEL: test_passing_vectors_interspersed:
216 ; OPTM1: sub esp, 80 221 ; OPTM1: sub esp, 80
217 ; OPTM1: movups [[ARG9:.*]], xmmword ptr {{.*}} 222 ; OPTM1: movups [[ARG9:.*]], xmmword ptr {{.*}}
218 ; OPTM1: movups xmmword ptr [esp+32], [[ARG9]] 223 ; OPTM1: movups xmmword ptr [esp + 32], [[ARG9]]
219 ; OPTM1: movups [[ARG11:.*]], xmmword ptr {{.*}} 224 ; OPTM1: movups [[ARG11:.*]], xmmword ptr {{.*}}
220 ; OPTM1: movups xmmword ptr [esp+64], [[ARG11]] 225 ; OPTM1: movups xmmword ptr [esp + 64], [[ARG11]]
221 ; OPTM1: movups xmm0, xmmword ptr {{.*}} 226 ; OPTM1: movups xmm0, xmmword ptr {{.*}}
222 ; OPTM1: movups xmm1, xmmword ptr {{.*}} 227 ; OPTM1: movups xmm1, xmmword ptr {{.*}}
223 ; OPTM1: movups xmm2, xmmword ptr {{.*}} 228 ; OPTM1: movups xmm2, xmmword ptr {{.*}}
224 ; OPTM1: movups xmm3, xmmword ptr {{.*}} 229 ; OPTM1: movups xmm3, xmmword ptr {{.*}}
225 ; OPTM1: call InterspersedVectorArgs 230 ; OPTM1: call -4
226 ; OPTM1-NEXT: add esp, 80 231 ; OPTM1-NEXT: add esp, 80
227 ; OPTM1: ret 232 ; OPTM1: ret
228 } 233 }
229 234
230 ; Test that a vector returned from a function is recognized to be in 235 ; Test that a vector returned from a function is recognized to be in
231 ; xmm0. 236 ; xmm0.
232 237
233 declare <4 x float> @VectorReturn(<4 x float> %arg0) 238 declare <4 x float> @VectorReturn(<4 x float> %arg0)
234 239
235 define void @test_receiving_vectors(<4 x float> %arg0) { 240 define void @test_receiving_vectors(<4 x float> %arg0) {
236 entry: 241 entry:
237 %result = call <4 x float> @VectorReturn(<4 x float> %arg0) 242 %result = call <4 x float> @VectorReturn(<4 x float> %arg0)
238 %result2 = call <4 x float> @VectorReturn(<4 x float> %result) 243 %result2 = call <4 x float> @VectorReturn(<4 x float> %result)
239 ret void 244 ret void
240 ; CHECK-LABEL: test_receiving_vectors: 245 ; CHECK-LABEL: test_receiving_vectors:
241 ; CHECK: call VectorReturn 246 ; CHECK: call -4
242 ; CHECK-NOT: movups xmm0 247 ; CHECK-NOT: movups xmm0
243 ; CHECK: call VectorReturn 248 ; CHECK: call -4
244 ; CHECK: ret 249 ; CHECK: ret
245 250
246 ; OPTM1-LABEL: test_receiving_vectors: 251 ; OPTM1-LABEL: test_receiving_vectors:
247 ; OPTM1: call VectorReturn 252 ; OPTM1: call -4
248 ; OPTM1: movups {{.*}}, xmm0 253 ; OPTM1: movups {{.*}}, xmm0
249 ; OPTM1: movups xmm0, {{.*}} 254 ; OPTM1: movups xmm0, {{.*}}
250 ; OPTM1: call VectorReturn 255 ; OPTM1: call -4
251 ; OPTM1: ret 256 ; OPTM1: ret
252 } 257 }
253 258
254 ; ERRORS-NOT: ICE translation error 259 ; ERRORS-NOT: ICE translation error
255 ; DUMP-NOT: SZ 260 ; DUMP-NOT: SZ
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698