Chromium Code Reviews

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

Issue 444443002: Subzero: Align the stack at the point of function calls. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Comments round 3 Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « tests_lit/llvm2ice_tests/undef.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
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 ; NOTE: CHECK / OPTM1 lines containing the following strings may be
5 ; subject to change:
6 ;
7 ; * movups: The movups instruction may be changed to movaps when the
8 ; load / store operation is 16 byte aligned.
9 ;
10 ; * stack offsets: These may need to be changed if stack alignment
11 ; support is implemented.
12 ;
13 ; * stack adjustment operations
14
15 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s 4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
16 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s 5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s
17 ; RUN: %llvm2ice -O2 --verbose none %s \ 6 ; RUN: %llvm2ice -O2 --verbose none %s \
18 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj 7 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj
19 ; RUN: %llvm2ice -Om1 --verbose none %s \ 8 ; RUN: %llvm2ice -Om1 --verbose none %s \
20 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj 9 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj
21 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s 10 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
22 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s 11 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
23 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ 12 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
24 ; RUN: | FileCheck --check-prefix=DUMP %s 13 ; RUN: | FileCheck --check-prefix=DUMP %s
(...skipping 118 matching lines...)
143 ; OPTM1-LABEL: test_returning_interspersed_arg3: 132 ; OPTM1-LABEL: test_returning_interspersed_arg3:
144 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3 133 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3
145 ; OPTM1: movups xmm0, xmmword ptr [[LOC]] 134 ; OPTM1: movups xmm0, xmmword ptr [[LOC]]
146 ; OPTM1: ret 135 ; OPTM1: ret
147 } 136 }
148 137
149 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) { 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) {
150 entry: 139 entry:
151 ret <4 x float> %arg4 140 ret <4 x float> %arg4
152 ; CHECK-LABEL: test_returning_interspersed_arg4: 141 ; CHECK-LABEL: test_returning_interspersed_arg4:
153 ; CHECK: movups xmm0, xmmword ptr [esp+44] 142 ; CHECK: movups xmm0, xmmword ptr [esp+52]
154 ; CHECK: ret 143 ; CHECK: ret
155 144
156 ; OPTM1-LABEL: test_returning_interspersed_arg4: 145 ; OPTM1-LABEL: test_returning_interspersed_arg4:
157 ; OPTM1: movups xmm0, xmmword ptr {{.*}} 146 ; OPTM1: movups xmm0, xmmword ptr {{.*}}
158 ; OPTM1: ret 147 ; OPTM1: ret
159 } 148 }
160 149
161 ; Test that vectors are passed correctly as arguments to a function. 150 ; Test that vectors are passed correctly as arguments to a function.
162 151
163 declare void @VectorArgs(<4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>) 152 declare void @VectorArgs(<4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>)
164 153
165 declare void @killXmmRegisters() 154 declare void @killXmmRegisters()
166 155
167 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) { 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) {
168 entry: 157 entry:
169 ; Kills XMM registers so that no in-arg lowering code interferes 158 ; Kills XMM registers so that no in-arg lowering code interferes
170 ; with the test. 159 ; with the test.
171 call void @killXmmRegisters() 160 call void @killXmmRegisters()
172 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) 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)
173 ret void 162 ret void
174 ; CHECK-LABEL: test_passing_vectors: 163 ; CHECK-LABEL: test_passing_vectors:
175 ; CHECK: movups [[ARG6:.*]], xmmword ptr [esp+4] 164 ; CHECK: sub esp, 32
176 ; CHECK: sub esp, 16 165 ; CHECK: movups [[ARG5:.*]], xmmword ptr [esp+64]
177 ; CHECK-NEXT: movups xmmword ptr [esp], [[ARG6]] 166 ; CHECK: movups xmmword ptr [esp], [[ARG5]]
178 ; CHECK: movups [[ARG5:.*]], xmmword ptr [esp+36] 167 ; CHECK: movups [[ARG6:.*]], xmmword ptr [esp+48]
179 ; CHECK: sub esp, 16 168 ; CHECK: movups xmmword ptr [esp+16], [[ARG6]]
180 ; CHECK-NEXT: movups xmmword ptr [esp], [[ARG5]] 169 ; CHECK: movups xmm0, xmmword ptr [esp+128]
181 ; CHECK: movups xmm0, xmmword ptr [esp+116] 170 ; CHECK: movups xmm1, xmmword ptr [esp+112]
182 ; CHECK: movups xmm1, xmmword ptr [esp+100] 171 ; CHECK: movups xmm2, xmmword ptr [esp+96]
183 ; CHECK: movups xmm2, xmmword ptr [esp+84] 172 ; CHECK: movups xmm3, xmmword ptr [esp+80]
184 ; CHECK: movups xmm3, xmmword ptr [esp+68]
185 ; CHECK: call VectorArgs 173 ; CHECK: call VectorArgs
186 ; CHECK-NEXT: add esp, 32 174 ; CHECK-NEXT: add esp, 32
187 ; CHECK: ret 175 ; CHECK: ret
188 176
189 ; OPTM1-LABEL: test_passing_vectors: 177 ; OPTM1-LABEL: test_passing_vectors:
178 ; OPTM1: sub esp, 32
179 ; OPTM1: movups [[ARG5:.*]], xmmword ptr {{.*}}
180 ; OPTM1: movups xmmword ptr [esp], [[ARG5]]
190 ; OPTM1: movups [[ARG6:.*]], xmmword ptr {{.*}} 181 ; OPTM1: movups [[ARG6:.*]], xmmword ptr {{.*}}
191 ; OPTM1: sub esp, 16 182 ; OPTM1: movups xmmword ptr [esp+16], [[ARG6]]
192 ; OPTM1: movups xmmword ptr [esp], [[ARG6]]
193 ; OPTM1: movups [[ARG5:.*]], xmmword ptr {{.*}}
194 ; OPTM1: sub esp, 16
195 ; OPTM1-NEXT: movups xmmword ptr [esp], [[ARG5]]
196 ; OPTM1: movups xmm0, xmmword ptr {{.*}} 183 ; OPTM1: movups xmm0, xmmword ptr {{.*}}
197 ; OPTM1: movups xmm1, xmmword ptr {{.*}} 184 ; OPTM1: movups xmm1, xmmword ptr {{.*}}
198 ; OPTM1: movups xmm2, xmmword ptr {{.*}} 185 ; OPTM1: movups xmm2, xmmword ptr {{.*}}
199 ; OPTM1: movups xmm3, xmmword ptr {{.*}} 186 ; OPTM1: movups xmm3, xmmword ptr {{.*}}
200 ; OPTM1: call VectorArgs 187 ; OPTM1: call VectorArgs
201 ; OPTM1: add esp, 32 188 ; OPTM1-NEXT: add esp, 32
202 ; OPTM1: ret 189 ; OPTM1: ret
203 } 190 }
204 191
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>)
193
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) {
195 entry:
196 ; Kills XMM registers so that no in-arg lowering code interferes
197 ; with the test.
198 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)
200 ret void
201 ; CHECK-LABEL: test_passing_vectors_interspersed:
202 ; CHECK: sub esp, 80
203 ; CHECK: movups [[ARG9:.*]], xmmword ptr [esp+112]
204 ; CHECK: movups xmmword ptr [esp+32], [[ARG9]]
205 ; CHECK: movups [[ARG11:.*]], xmmword ptr [esp+96]
206 ; CHECK: movups xmmword ptr [esp+64], [[ARG11]]
207 ; CHECK: movups xmm0, xmmword ptr [esp+176]
208 ; CHECK: movups xmm1, xmmword ptr [esp+160]
209 ; CHECK: movups xmm2, xmmword ptr [esp+144]
210 ; CHECK: movups xmm3, xmmword ptr [esp+128]
211 ; CHECK: call InterspersedVectorArgs
212 ; CHECK-NEXT: add esp, 80
213 ; CHECK: ret
214
215 ; OPTM1-LABEL: test_passing_vectors_interspersed:
216 ; OPTM1: sub esp, 80
217 ; OPTM1: movups [[ARG9:.*]], xmmword ptr {{.*}}
218 ; OPTM1: movups xmmword ptr [esp+32], [[ARG9]]
219 ; OPTM1: movups [[ARG11:.*]], xmmword ptr {{.*}}
220 ; OPTM1: movups xmmword ptr [esp+64], [[ARG11]]
221 ; OPTM1: movups xmm0, xmmword ptr {{.*}}
222 ; OPTM1: movups xmm1, xmmword ptr {{.*}}
223 ; OPTM1: movups xmm2, xmmword ptr {{.*}}
224 ; OPTM1: movups xmm3, xmmword ptr {{.*}}
225 ; OPTM1: call InterspersedVectorArgs
226 ; OPTM1-NEXT: add esp, 80
227 ; OPTM1: ret
228 }
229
205 ; Test that a vector returned from a function is recognized to be in 230 ; Test that a vector returned from a function is recognized to be in
206 ; xmm0. 231 ; xmm0.
207 232
208 declare <4 x float> @VectorReturn(<4 x float> %arg0) 233 declare <4 x float> @VectorReturn(<4 x float> %arg0)
209 234
210 define void @test_receiving_vectors(<4 x float> %arg0) { 235 define void @test_receiving_vectors(<4 x float> %arg0) {
211 entry: 236 entry:
212 %result = call <4 x float> @VectorReturn(<4 x float> %arg0) 237 %result = call <4 x float> @VectorReturn(<4 x float> %arg0)
213 %result2 = call <4 x float> @VectorReturn(<4 x float> %result) 238 %result2 = call <4 x float> @VectorReturn(<4 x float> %result)
214 ret void 239 ret void
215 ; CHECK-LABEL: test_receiving_vectors: 240 ; CHECK-LABEL: test_receiving_vectors:
216 ; CHECK: call VectorReturn 241 ; CHECK: call VectorReturn
217 ; CHECK-NOT: movups xmm0 242 ; CHECK-NOT: movups xmm0
218 ; CHECK: call VectorReturn 243 ; CHECK: call VectorReturn
219 ; CHECK: ret 244 ; CHECK: ret
220 245
221 ; OPTM1-LABEL: test_receiving_vectors: 246 ; OPTM1-LABEL: test_receiving_vectors:
222 ; OPTM1: call VectorReturn 247 ; OPTM1: call VectorReturn
223 ; OPTM1: movups [[LOC:.*]], xmm0 248 ; OPTM1: movups {{.*}}, xmm0
224 ; OPTM1: movups xmm0, [[LOC]] 249 ; OPTM1: movups xmm0, {{.*}}
225 ; OPTM1: call VectorReturn 250 ; OPTM1: call VectorReturn
226 ; OPTM1: ret 251 ; OPTM1: ret
227 } 252 }
228 253
229 ; ERRORS-NOT: ICE translation error 254 ; ERRORS-NOT: ICE translation error
230 ; DUMP-NOT: SZ 255 ; DUMP-NOT: SZ
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/undef.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine