| OLD | NEW |
| 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: %p2i -i %s --filetype=obj --disassemble --args -O2 \ | 4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
| 5 ; RUN: -allow-externally-defined-symbols | FileCheck %s | 5 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
| 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ | 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
| 7 ; RUN: -allow-externally-defined-symbols | FileCheck --check-prefix=OPTM1 %s | 7 ; RUN: -allow-externally-defined-symbols | FileCheck --check-prefix=OPTM1 %s |
| 8 | 8 |
| 9 ; The first five functions test that vectors are moved from their | 9 ; The first five functions test that vectors are moved from their |
| 10 ; correct argument location to xmm0. | 10 ; correct argument location to xmm0. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 <4 x float> %arg4, <4 x float> %arg5, <4 x float> %arg6, <4 x float> %arg7, | 183 <4 x float> %arg4, <4 x float> %arg5, <4 x float> %arg6, <4 x float> %arg7, |
| 184 <4 x float> %arg8, <4 x float> %arg9) { | 184 <4 x float> %arg8, <4 x float> %arg9) { |
| 185 entry: | 185 entry: |
| 186 ; Kills XMM registers so that no in-arg lowering code interferes | 186 ; Kills XMM registers so that no in-arg lowering code interferes |
| 187 ; with the test. | 187 ; with the test. |
| 188 call void @killXmmRegisters() | 188 call void @killXmmRegisters() |
| 189 call void @VectorArgs(<4 x float> %arg9, <4 x float> %arg8, <4 x float> %arg7, | 189 call void @VectorArgs(<4 x float> %arg9, <4 x float> %arg8, <4 x float> %arg7, |
| 190 <4 x float> %arg6, <4 x float> %arg5, <4 x float> %arg4) | 190 <4 x float> %arg6, <4 x float> %arg5, <4 x float> %arg4) |
| 191 ret void | 191 ret void |
| 192 ; CHECK-LABEL: test_passing_vectors | 192 ; CHECK-LABEL: test_passing_vectors |
| 193 ; CHECK: sub esp,0x20 | 193 ; CHECK-NEXT: sub esp,0x2c |
| 194 ; CHECK: movups [[ARG5:.*]],XMMWORD PTR [esp+0x40] | 194 ; CHECK: movups [[ARG5:.*]],XMMWORD PTR [esp+0x40] |
| 195 ; CHECK: movups XMMWORD PTR [esp],[[ARG5]] | 195 ; CHECK: movups XMMWORD PTR [esp],[[ARG5]] |
| 196 ; CHECK: movups [[ARG6:.*]],XMMWORD PTR [esp+0x30] | 196 ; CHECK: movups [[ARG6:.*]],XMMWORD PTR [esp+0x30] |
| 197 ; CHECK: movups XMMWORD PTR [esp+0x10],[[ARG6]] | 197 ; CHECK: movups XMMWORD PTR [esp+0x10],[[ARG6]] |
| 198 ; CHECK: movups xmm0,XMMWORD PTR [esp+0x80] | 198 ; CHECK: movups xmm0,XMMWORD PTR [esp+0x80] |
| 199 ; CHECK: movups xmm1,XMMWORD PTR [esp+0x70] | 199 ; CHECK: movups xmm1,XMMWORD PTR [esp+0x70] |
| 200 ; CHECK: movups xmm2,XMMWORD PTR [esp+0x60] | 200 ; CHECK: movups xmm2,XMMWORD PTR [esp+0x60] |
| 201 ; CHECK: movups xmm3,XMMWORD PTR [esp+0x50] | 201 ; CHECK: movups xmm3,XMMWORD PTR [esp+0x50] |
| 202 ; CHECK: call {{.*}} R_{{.*}} VectorArgs | 202 ; CHECK: call {{.*}} R_{{.*}} VectorArgs |
| 203 ; CHECK-NEXT: add esp,0x20 | 203 ; CHECK-NEXT: add esp,0x2c |
| 204 | 204 |
| 205 ; OPTM1-LABEL: test_passing_vectors | 205 ; OPTM1-LABEL: test_passing_vectors |
| 206 ; OPTM1: sub esp,0x20 | 206 ; OPTM1: sub esp,0x6c |
| 207 ; OPTM1: movups [[ARG5:.*]],XMMWORD PTR {{.*}} | 207 ; OPTM1: movups [[ARG5:.*]],XMMWORD PTR {{.*}} |
| 208 ; OPTM1: movups XMMWORD PTR [esp],[[ARG5]] | 208 ; OPTM1: movups XMMWORD PTR [esp],[[ARG5]] |
| 209 ; OPTM1: movups [[ARG6:.*]],XMMWORD PTR {{.*}} | 209 ; OPTM1: movups [[ARG6:.*]],XMMWORD PTR {{.*}} |
| 210 ; OPTM1: movups XMMWORD PTR [esp+0x10],[[ARG6]] | 210 ; OPTM1: movups XMMWORD PTR [esp+0x10],[[ARG6]] |
| 211 ; OPTM1: movups xmm0,XMMWORD PTR {{.*}} | 211 ; OPTM1: movups xmm0,XMMWORD PTR {{.*}} |
| 212 ; OPTM1: movups xmm1,XMMWORD PTR {{.*}} | 212 ; OPTM1: movups xmm1,XMMWORD PTR {{.*}} |
| 213 ; OPTM1: movups xmm2,XMMWORD PTR {{.*}} | 213 ; OPTM1: movups xmm2,XMMWORD PTR {{.*}} |
| 214 ; OPTM1: movups xmm3,XMMWORD PTR {{.*}} | 214 ; OPTM1: movups xmm3,XMMWORD PTR {{.*}} |
| 215 ; OPTM1: call {{.*}} R_{{.*}} VectorArgs | 215 ; OPTM1: call {{.*}} R_{{.*}} VectorArgs |
| 216 ; OPTM1-NEXT: add esp,0x20 | 216 ; OPTM1-NEXT: add esp,0x6c |
| 217 } | 217 } |
| 218 | 218 |
| 219 declare void @InterspersedVectorArgs( | 219 declare void @InterspersedVectorArgs( |
| 220 <4 x float>, i64, <4 x float>, i64, <4 x float>, float, <4 x float>, | 220 <4 x float>, i64, <4 x float>, i64, <4 x float>, float, <4 x float>, |
| 221 double, <4 x float>, i32, <4 x float>) | 221 double, <4 x float>, i32, <4 x float>) |
| 222 | 222 |
| 223 define internal void @test_passing_vectors_interspersed( | 223 define internal void @test_passing_vectors_interspersed( |
| 224 <4 x float> %arg0, <4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3, | 224 <4 x float> %arg0, <4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3, |
| 225 <4 x float> %arg4, <4 x float> %arg5, <4 x float> %arg6, <4 x float> %arg7, | 225 <4 x float> %arg4, <4 x float> %arg5, <4 x float> %arg6, <4 x float> %arg7, |
| 226 <4 x float> %arg8, <4 x float> %arg9) { | 226 <4 x float> %arg8, <4 x float> %arg9) { |
| 227 entry: | 227 entry: |
| 228 ; Kills XMM registers so that no in-arg lowering code interferes | 228 ; Kills XMM registers so that no in-arg lowering code interferes |
| 229 ; with the test. | 229 ; with the test. |
| 230 call void @killXmmRegisters() | 230 call void @killXmmRegisters() |
| 231 call void @InterspersedVectorArgs(<4 x float> %arg9, i64 0, <4 x float> %arg8, | 231 call void @InterspersedVectorArgs(<4 x float> %arg9, i64 0, <4 x float> %arg8, |
| 232 i64 1, <4 x float> %arg7, float 2.000000e+00
, | 232 i64 1, <4 x float> %arg7, float 2.000000e+00
, |
| 233 <4 x float> %arg6, double 3.000000e+00, | 233 <4 x float> %arg6, double 3.000000e+00, |
| 234 <4 x float> %arg5, i32 4, <4 x float> %arg4) | 234 <4 x float> %arg5, i32 4, <4 x float> %arg4) |
| 235 ret void | 235 ret void |
| 236 ; CHECK-LABEL: test_passing_vectors_interspersed | 236 ; CHECK-LABEL: test_passing_vectors_interspersed |
| 237 ; CHECK: sub esp,0x50 | 237 ; CHECK: sub esp,0x5c |
| 238 ; CHECK: movups [[ARG9:.*]],XMMWORD PTR [esp+0x70] | 238 ; CHECK: movups [[ARG9:.*]],XMMWORD PTR [esp+0x70] |
| 239 ; CHECK: movups XMMWORD PTR [esp+0x20],[[ARG9]] | 239 ; CHECK: movups XMMWORD PTR [esp+0x20],[[ARG9]] |
| 240 ; CHECK: movups [[ARG11:.*]],XMMWORD PTR [esp+0x60] | 240 ; CHECK: movups [[ARG11:.*]],XMMWORD PTR [esp+0x60] |
| 241 ; CHECK: movups XMMWORD PTR [esp+0x40],[[ARG11]] | 241 ; CHECK: movups XMMWORD PTR [esp+0x40],[[ARG11]] |
| 242 ; CHECK: movups xmm0,XMMWORD PTR [esp+0xb0] | 242 ; CHECK: movups xmm0,XMMWORD PTR [esp+0xb0] |
| 243 ; CHECK: movups xmm1,XMMWORD PTR [esp+0xa0] | 243 ; CHECK: movups xmm1,XMMWORD PTR [esp+0xa0] |
| 244 ; CHECK: movups xmm2,XMMWORD PTR [esp+0x90] | 244 ; CHECK: movups xmm2,XMMWORD PTR [esp+0x90] |
| 245 ; CHECK: movups xmm3,XMMWORD PTR [esp+0x80] | 245 ; CHECK: movups xmm3,XMMWORD PTR [esp+0x80] |
| 246 ; CHECK: call {{.*}} R_{{.*}} InterspersedVectorArgs | 246 ; CHECK: call {{.*}} R_{{.*}} InterspersedVectorArgs |
| 247 ; CHECK-NEXT: add esp,0x50 | 247 ; CHECK-NEXT: add esp,0x5c |
| 248 ; CHECK: ret | 248 ; CHECK: ret |
| 249 | 249 |
| 250 ; OPTM1-LABEL: test_passing_vectors_interspersed | 250 ; OPTM1-LABEL: test_passing_vectors_interspersed |
| 251 ; OPTM1: sub esp,0x50 | 251 ; OPTM1: sub esp,0x9c |
| 252 ; OPTM1: movups [[ARG9:.*]],XMMWORD PTR {{.*}} | 252 ; OPTM1: movups [[ARG9:.*]],XMMWORD PTR {{.*}} |
| 253 ; OPTM1: movups XMMWORD PTR [esp+0x20],[[ARG9]] | 253 ; OPTM1: movups XMMWORD PTR [esp+0x20],[[ARG9]] |
| 254 ; OPTM1: movups [[ARG11:.*]],XMMWORD PTR {{.*}} | 254 ; OPTM1: movups [[ARG11:.*]],XMMWORD PTR {{.*}} |
| 255 ; OPTM1: movups XMMWORD PTR [esp+0x40],[[ARG11]] | 255 ; OPTM1: movups XMMWORD PTR [esp+0x40],[[ARG11]] |
| 256 ; OPTM1: movups xmm0,XMMWORD PTR {{.*}} | 256 ; OPTM1: movups xmm0,XMMWORD PTR {{.*}} |
| 257 ; OPTM1: movups xmm1,XMMWORD PTR {{.*}} | 257 ; OPTM1: movups xmm1,XMMWORD PTR {{.*}} |
| 258 ; OPTM1: movups xmm2,XMMWORD PTR {{.*}} | 258 ; OPTM1: movups xmm2,XMMWORD PTR {{.*}} |
| 259 ; OPTM1: movups xmm3,XMMWORD PTR {{.*}} | 259 ; OPTM1: movups xmm3,XMMWORD PTR {{.*}} |
| 260 ; OPTM1: call {{.*}} R_{{.*}} InterspersedVectorArgs | 260 ; OPTM1: call {{.*}} R_{{.*}} InterspersedVectorArgs |
| 261 ; OPTM1-NEXT: add esp,0x50 | 261 ; OPTM1-NEXT: add esp,0x9c |
| 262 ; OPTM1: ret | 262 ; OPTM1: ret |
| 263 } | 263 } |
| 264 | 264 |
| 265 ; Test that a vector returned from a function is recognized to be in | 265 ; Test that a vector returned from a function is recognized to be in |
| 266 ; xmm0. | 266 ; xmm0. |
| 267 | 267 |
| 268 declare <4 x float> @VectorReturn(<4 x float> %arg0) | 268 declare <4 x float> @VectorReturn(<4 x float> %arg0) |
| 269 | 269 |
| 270 define internal void @test_receiving_vectors(<4 x float> %arg0) { | 270 define internal void @test_receiving_vectors(<4 x float> %arg0) { |
| 271 entry: | 271 entry: |
| 272 %result = call <4 x float> @VectorReturn(<4 x float> %arg0) | 272 %result = call <4 x float> @VectorReturn(<4 x float> %arg0) |
| 273 %result2 = call <4 x float> @VectorReturn(<4 x float> %result) | 273 %result2 = call <4 x float> @VectorReturn(<4 x float> %result) |
| 274 ret void | 274 ret void |
| 275 ; CHECK-LABEL: test_receiving_vectors | 275 ; CHECK-LABEL: test_receiving_vectors |
| 276 ; CHECK: call {{.*}} R_{{.*}} VectorReturn | 276 ; CHECK: call {{.*}} R_{{.*}} VectorReturn |
| 277 ; CHECK-NOT: movups xmm0 | 277 ; CHECK-NOT: movups xmm0 |
| 278 ; CHECK: call {{.*}} R_{{.*}} VectorReturn | 278 ; CHECK: call {{.*}} R_{{.*}} VectorReturn |
| 279 ; CHECK: ret | 279 ; CHECK: ret |
| 280 | 280 |
| 281 ; OPTM1-LABEL: test_receiving_vectors | 281 ; OPTM1-LABEL: test_receiving_vectors |
| 282 ; OPTM1: call {{.*}} R_{{.*}} VectorReturn | 282 ; OPTM1: call {{.*}} R_{{.*}} VectorReturn |
| 283 ; OPTM1: movups {{.*}},xmm0 | 283 ; OPTM1: movups {{.*}},xmm0 |
| 284 ; OPTM1: movups xmm0,{{.*}} | 284 ; OPTM1: movups xmm0,{{.*}} |
| 285 ; OPTM1: call {{.*}} R_{{.*}} VectorReturn | 285 ; OPTM1: call {{.*}} R_{{.*}} VectorReturn |
| 286 ; OPTM1: ret | 286 ; OPTM1: ret |
| 287 } | 287 } |
| OLD | NEW |