| 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: %llvm2ice -O2 --verbose none %s | FileCheck %s | |
| 5 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck --check-prefix=OPTM1 %s | |
| 6 ; RUN: %llvm2ice -O2 --verbose none %s \ | 4 ; RUN: %llvm2ice -O2 --verbose none %s \ |
| 7 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 5 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 6 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
| 8 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 7 ; RUN: %llvm2ice -Om1 --verbose none %s \ |
| 9 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 8 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 9 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - \ |
| 10 ; RUN: | FileCheck --check-prefix=OPTM1 %s |
| 10 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 11 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 11 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 12 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 12 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 13 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
| 13 ; RUN: | FileCheck --check-prefix=DUMP %s | 14 ; RUN: | FileCheck --check-prefix=DUMP %s |
| 14 | 15 |
| 15 ; The first five functions test that vectors are moved from their | 16 ; The first five functions test that vectors are moved from their |
| 16 ; correct argument location to xmm0. | 17 ; correct argument location to xmm0. |
| 17 | 18 |
| 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) { | 19 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: | 20 entry: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 ; OPTM1-LABEL: test_returning_arg3: | 65 ; OPTM1-LABEL: test_returning_arg3: |
| 65 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3 | 66 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3 |
| 66 ; OPTM1: movups xmm0, xmmword ptr [[LOC]] | 67 ; OPTM1: movups xmm0, xmmword ptr [[LOC]] |
| 67 ; OPTM1: ret | 68 ; OPTM1: ret |
| 68 } | 69 } |
| 69 | 70 |
| 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) { | 71 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: | 72 entry: |
| 72 ret <4 x float> %arg4 | 73 ret <4 x float> %arg4 |
| 73 ; CHECK-LABEL: test_returning_arg4: | 74 ; CHECK-LABEL: test_returning_arg4: |
| 74 ; CHECK: movups xmm0, xmmword ptr [esp+4] | 75 ; CHECK: movups xmm0, xmmword ptr [esp + 4] |
| 75 ; CHECK: ret | 76 ; CHECK: ret |
| 76 | 77 |
| 77 ; OPTM1-LABEL: test_returning_arg4: | 78 ; OPTM1-LABEL: test_returning_arg4: |
| 78 ; OPTM1: movups xmm0, xmmword ptr {{.*}} | 79 ; OPTM1: movups xmm0, xmmword ptr {{.*}} |
| 79 ; OPTM1: ret | 80 ; OPTM1: ret |
| 80 } | 81 } |
| 81 | 82 |
| 82 ; The next five functions check that xmm arguments are handled | 83 ; The next five functions check that xmm arguments are handled |
| 83 ; correctly when interspersed with stack arguments in the argument | 84 ; correctly when interspersed with stack arguments in the argument |
| 84 ; list. | 85 ; list. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 ; OPTM1-LABEL: test_returning_interspersed_arg3: | 133 ; OPTM1-LABEL: test_returning_interspersed_arg3: |
| 133 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3 | 134 ; OPTM1: movups xmmword ptr [[LOC:.*]], xmm3 |
| 134 ; OPTM1: movups xmm0, xmmword ptr [[LOC]] | 135 ; OPTM1: movups xmm0, xmmword ptr [[LOC]] |
| 135 ; OPTM1: ret | 136 ; OPTM1: ret |
| 136 } | 137 } |
| 137 | 138 |
| 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) { | 139 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: | 140 entry: |
| 140 ret <4 x float> %arg4 | 141 ret <4 x float> %arg4 |
| 141 ; CHECK-LABEL: test_returning_interspersed_arg4: | 142 ; CHECK-LABEL: test_returning_interspersed_arg4: |
| 142 ; CHECK: movups xmm0, xmmword ptr [esp+52] | 143 ; CHECK: movups xmm0, xmmword ptr [esp + 52] |
| 143 ; CHECK: ret | 144 ; CHECK: ret |
| 144 | 145 |
| 145 ; OPTM1-LABEL: test_returning_interspersed_arg4: | 146 ; OPTM1-LABEL: test_returning_interspersed_arg4: |
| 146 ; OPTM1: movups xmm0, xmmword ptr {{.*}} | 147 ; OPTM1: movups xmm0, xmmword ptr {{.*}} |
| 147 ; OPTM1: ret | 148 ; OPTM1: ret |
| 148 } | 149 } |
| 149 | 150 |
| 150 ; Test that vectors are passed correctly as arguments to a function. | 151 ; Test that vectors are passed correctly as arguments to a function. |
| 151 | 152 |
| 152 declare void @VectorArgs(<4 x float>, <4 x float>, <4 x float>, <4 x float>, <4
x float>, <4 x float>) | 153 declare void @VectorArgs(<4 x float>, <4 x float>, <4 x float>, <4 x float>, <4
x float>, <4 x float>) |
| 153 | 154 |
| 154 declare void @killXmmRegisters() | 155 declare void @killXmmRegisters() |
| 155 | 156 |
| 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) { | 157 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: | 158 entry: |
| 158 ; Kills XMM registers so that no in-arg lowering code interferes | 159 ; Kills XMM registers so that no in-arg lowering code interferes |
| 159 ; with the test. | 160 ; with the test. |
| 160 call void @killXmmRegisters() | 161 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) | 162 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 | 163 ret void |
| 163 ; CHECK-LABEL: test_passing_vectors: | 164 ; CHECK-LABEL: test_passing_vectors: |
| 164 ; CHECK: sub esp, 32 | 165 ; CHECK: sub esp, 32 |
| 165 ; CHECK: movups [[ARG5:.*]], xmmword ptr [esp+64] | 166 ; CHECK: movups [[ARG5:.*]], xmmword ptr [esp + 64] |
| 166 ; CHECK: movups xmmword ptr [esp], [[ARG5]] | 167 ; CHECK: movups xmmword ptr [esp], [[ARG5]] |
| 167 ; CHECK: movups [[ARG6:.*]], xmmword ptr [esp+48] | 168 ; CHECK: movups [[ARG6:.*]], xmmword ptr [esp + 48] |
| 168 ; CHECK: movups xmmword ptr [esp+16], [[ARG6]] | 169 ; CHECK: movups xmmword ptr [esp + 16], [[ARG6]] |
| 169 ; CHECK: movups xmm0, xmmword ptr [esp+128] | 170 ; CHECK: movups xmm0, xmmword ptr [esp + 128] |
| 170 ; CHECK: movups xmm1, xmmword ptr [esp+112] | 171 ; CHECK: movups xmm1, xmmword ptr [esp + 112] |
| 171 ; CHECK: movups xmm2, xmmword ptr [esp+96] | 172 ; CHECK: movups xmm2, xmmword ptr [esp + 96] |
| 172 ; CHECK: movups xmm3, xmmword ptr [esp+80] | 173 ; CHECK: movups xmm3, xmmword ptr [esp + 80] |
| 173 ; CHECK: call VectorArgs | 174 ; CHECK: call -4 |
| 174 ; CHECK-NEXT: add esp, 32 | 175 ; CHECK-NEXT: add esp, 32 |
| 175 ; CHECK: ret | 176 ; CHECK: ret |
| 176 | 177 |
| 177 ; OPTM1-LABEL: test_passing_vectors: | 178 ; OPTM1-LABEL: test_passing_vectors: |
| 178 ; OPTM1: sub esp, 32 | 179 ; OPTM1: sub esp, 32 |
| 179 ; OPTM1: movups [[ARG5:.*]], xmmword ptr {{.*}} | 180 ; OPTM1: movups [[ARG5:.*]], xmmword ptr {{.*}} |
| 180 ; OPTM1: movups xmmword ptr [esp], [[ARG5]] | 181 ; OPTM1: movups xmmword ptr [esp], [[ARG5]] |
| 181 ; OPTM1: movups [[ARG6:.*]], xmmword ptr {{.*}} | 182 ; OPTM1: movups [[ARG6:.*]], xmmword ptr {{.*}} |
| 182 ; OPTM1: movups xmmword ptr [esp+16], [[ARG6]] | 183 ; OPTM1: movups xmmword ptr [esp + 16], [[ARG6]] |
| 183 ; OPTM1: movups xmm0, xmmword ptr {{.*}} | 184 ; OPTM1: movups xmm0, xmmword ptr {{.*}} |
| 184 ; OPTM1: movups xmm1, xmmword ptr {{.*}} | 185 ; OPTM1: movups xmm1, xmmword ptr {{.*}} |
| 185 ; OPTM1: movups xmm2, xmmword ptr {{.*}} | 186 ; OPTM1: movups xmm2, xmmword ptr {{.*}} |
| 186 ; OPTM1: movups xmm3, xmmword ptr {{.*}} | 187 ; OPTM1: movups xmm3, xmmword ptr {{.*}} |
| 187 ; OPTM1: call VectorArgs | 188 ; OPTM1: call -4 |
| 188 ; OPTM1-NEXT: add esp, 32 | 189 ; OPTM1-NEXT: add esp, 32 |
| 189 ; OPTM1: ret | 190 ; OPTM1: ret |
| 190 } | 191 } |
| 191 | 192 |
| 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 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 |
| 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 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 entry: |
| 196 ; Kills XMM registers so that no in-arg lowering code interferes | 197 ; Kills XMM registers so that no in-arg lowering code interferes |
| 197 ; with the test. | 198 ; with the test. |
| 198 call void @killXmmRegisters() | 199 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 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 ret void |
| 201 ; CHECK-LABEL: test_passing_vectors_interspersed: | 202 ; CHECK-LABEL: test_passing_vectors_interspersed: |
| 202 ; CHECK: sub esp, 80 | 203 ; CHECK: sub esp, 80 |
| 203 ; CHECK: movups [[ARG9:.*]], xmmword ptr [esp+112] | 204 ; CHECK: movups [[ARG9:.*]], xmmword ptr [esp + 112] |
| 204 ; CHECK: movups xmmword ptr [esp+32], [[ARG9]] | 205 ; CHECK: movups xmmword ptr [esp + 32], [[ARG9]] |
| 205 ; CHECK: movups [[ARG11:.*]], xmmword ptr [esp+96] | 206 ; CHECK: movups [[ARG11:.*]], xmmword ptr [esp + 96] |
| 206 ; CHECK: movups xmmword ptr [esp+64], [[ARG11]] | 207 ; CHECK: movups xmmword ptr [esp + 64], [[ARG11]] |
| 207 ; CHECK: movups xmm0, xmmword ptr [esp+176] | 208 ; CHECK: movups xmm0, xmmword ptr [esp + 176] |
| 208 ; CHECK: movups xmm1, xmmword ptr [esp+160] | 209 ; CHECK: movups xmm1, xmmword ptr [esp + 160] |
| 209 ; CHECK: movups xmm2, xmmword ptr [esp+144] | 210 ; CHECK: movups xmm2, xmmword ptr [esp + 144] |
| 210 ; CHECK: movups xmm3, xmmword ptr [esp+128] | 211 ; CHECK: movups xmm3, xmmword ptr [esp + 128] |
| 211 ; CHECK: call InterspersedVectorArgs | 212 ; CHECK: call -4 |
| 212 ; CHECK-NEXT: add esp, 80 | 213 ; CHECK-NEXT: add esp, 80 |
| 213 ; CHECK: ret | 214 ; CHECK: ret |
| 214 | 215 |
| 215 ; OPTM1-LABEL: test_passing_vectors_interspersed: | 216 ; OPTM1-LABEL: test_passing_vectors_interspersed: |
| 216 ; OPTM1: sub esp, 80 | 217 ; OPTM1: sub esp, 80 |
| 217 ; OPTM1: movups [[ARG9:.*]], xmmword ptr {{.*}} | 218 ; OPTM1: movups [[ARG9:.*]], xmmword ptr {{.*}} |
| 218 ; OPTM1: movups xmmword ptr [esp+32], [[ARG9]] | 219 ; OPTM1: movups xmmword ptr [esp + 32], [[ARG9]] |
| 219 ; OPTM1: movups [[ARG11:.*]], xmmword ptr {{.*}} | 220 ; OPTM1: movups [[ARG11:.*]], xmmword ptr {{.*}} |
| 220 ; OPTM1: movups xmmword ptr [esp+64], [[ARG11]] | 221 ; OPTM1: movups xmmword ptr [esp + 64], [[ARG11]] |
| 221 ; OPTM1: movups xmm0, xmmword ptr {{.*}} | 222 ; OPTM1: movups xmm0, xmmword ptr {{.*}} |
| 222 ; OPTM1: movups xmm1, xmmword ptr {{.*}} | 223 ; OPTM1: movups xmm1, xmmword ptr {{.*}} |
| 223 ; OPTM1: movups xmm2, xmmword ptr {{.*}} | 224 ; OPTM1: movups xmm2, xmmword ptr {{.*}} |
| 224 ; OPTM1: movups xmm3, xmmword ptr {{.*}} | 225 ; OPTM1: movups xmm3, xmmword ptr {{.*}} |
| 225 ; OPTM1: call InterspersedVectorArgs | 226 ; OPTM1: call -4 |
| 226 ; OPTM1-NEXT: add esp, 80 | 227 ; OPTM1-NEXT: add esp, 80 |
| 227 ; OPTM1: ret | 228 ; OPTM1: ret |
| 228 } | 229 } |
| 229 | 230 |
| 230 ; Test that a vector returned from a function is recognized to be in | 231 ; Test that a vector returned from a function is recognized to be in |
| 231 ; xmm0. | 232 ; xmm0. |
| 232 | 233 |
| 233 declare <4 x float> @VectorReturn(<4 x float> %arg0) | 234 declare <4 x float> @VectorReturn(<4 x float> %arg0) |
| 234 | 235 |
| 235 define void @test_receiving_vectors(<4 x float> %arg0) { | 236 define void @test_receiving_vectors(<4 x float> %arg0) { |
| 236 entry: | 237 entry: |
| 237 %result = call <4 x float> @VectorReturn(<4 x float> %arg0) | 238 %result = call <4 x float> @VectorReturn(<4 x float> %arg0) |
| 238 %result2 = call <4 x float> @VectorReturn(<4 x float> %result) | 239 %result2 = call <4 x float> @VectorReturn(<4 x float> %result) |
| 239 ret void | 240 ret void |
| 240 ; CHECK-LABEL: test_receiving_vectors: | 241 ; CHECK-LABEL: test_receiving_vectors: |
| 241 ; CHECK: call VectorReturn | 242 ; CHECK: call -4 |
| 242 ; CHECK-NOT: movups xmm0 | 243 ; CHECK-NOT: movups xmm0 |
| 243 ; CHECK: call VectorReturn | 244 ; CHECK: call -4 |
| 244 ; CHECK: ret | 245 ; CHECK: ret |
| 245 | 246 |
| 246 ; OPTM1-LABEL: test_receiving_vectors: | 247 ; OPTM1-LABEL: test_receiving_vectors: |
| 247 ; OPTM1: call VectorReturn | 248 ; OPTM1: call -4 |
| 248 ; OPTM1: movups {{.*}}, xmm0 | 249 ; OPTM1: movups {{.*}}, xmm0 |
| 249 ; OPTM1: movups xmm0, {{.*}} | 250 ; OPTM1: movups xmm0, {{.*}} |
| 250 ; OPTM1: call VectorReturn | 251 ; OPTM1: call -4 |
| 251 ; OPTM1: ret | 252 ; OPTM1: ret |
| 252 } | 253 } |
| 253 | 254 |
| 254 ; ERRORS-NOT: ICE translation error | 255 ; ERRORS-NOT: ICE translation error |
| 255 ; DUMP-NOT: SZ | 256 ; DUMP-NOT: SZ |
| OLD | NEW |