| OLD | NEW |
| 1 ; This tests the NaCl intrinsics not related to atomic operations. | 1 ; This tests the NaCl intrinsics not related to atomic operations. |
| 2 | 2 |
| 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 4 ; RUN: --target x8632 --sandbox -i %s --args -O2 \ | 4 ; RUN: --target x8632 --sandbox -i %s --args -O2 \ |
| 5 ; RUN: -allow-externally-defined-symbols \ | 5 ; RUN: -allow-externally-defined-symbols \ |
| 6 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 6 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
| 7 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 7 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 8 ; RUN: --target x8632 --sandbox -i %s --args -Om1 \ | 8 ; RUN: --target x8632 --sandbox -i %s --args -Om1 \ |
| 9 ; RUN: -allow-externally-defined-symbols \ | 9 ; RUN: -allow-externally-defined-symbols \ |
| 10 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 10 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 137 } |
| 138 ; CHECK-LABEL: test_setjmplongjmp | 138 ; CHECK-LABEL: test_setjmplongjmp |
| 139 ; CHECK: call {{.*}} R_{{.*}} setjmp | 139 ; CHECK: call {{.*}} R_{{.*}} setjmp |
| 140 ; CHECK: call {{.*}} R_{{.*}} longjmp | 140 ; CHECK: call {{.*}} R_{{.*}} longjmp |
| 141 ; CHECKO2REM-LABEL: test_setjmplongjmp | 141 ; CHECKO2REM-LABEL: test_setjmplongjmp |
| 142 ; CHECKO2REM: call {{.*}} R_{{.*}} setjmp | 142 ; CHECKO2REM: call {{.*}} R_{{.*}} setjmp |
| 143 ; CHECKO2REM: call {{.*}} R_{{.*}} longjmp | 143 ; CHECKO2REM: call {{.*}} R_{{.*}} longjmp |
| 144 ; ARM32-LABEL: test_setjmplongjmp | 144 ; ARM32-LABEL: test_setjmplongjmp |
| 145 ; ARM32: bl {{.*}} setjmp | 145 ; ARM32: bl {{.*}} setjmp |
| 146 ; ARM32: bl {{.*}} longjmp | 146 ; ARM32: bl {{.*}} longjmp |
| 147 ; MIPS32-LABEL: test_setjmplongjmp |
| 148 ; MIPS32: jal {{.*}} setjmp |
| 149 ; MIPS32: jal {{.*}} longjmp |
| 147 | 150 |
| 148 define internal i32 @test_setjmp_unused(i32 %iptr_env, i32 %i_other) { | 151 define internal i32 @test_setjmp_unused(i32 %iptr_env, i32 %i_other) { |
| 149 entry: | 152 entry: |
| 150 %env = inttoptr i32 %iptr_env to i8* | 153 %env = inttoptr i32 %iptr_env to i8* |
| 151 %i = call i32 @llvm.nacl.setjmp(i8* %env) | 154 %i = call i32 @llvm.nacl.setjmp(i8* %env) |
| 152 ret i32 %i_other | 155 ret i32 %i_other |
| 153 } | 156 } |
| 154 ; Don't consider setjmp side-effect free, so it's not eliminated if | 157 ; Don't consider setjmp side-effect free, so it's not eliminated if |
| 155 ; result unused. | 158 ; result unused. |
| 156 ; CHECKO2REM-LABEL: test_setjmp_unused | 159 ; CHECKO2REM-LABEL: test_setjmp_unused |
| 157 ; CHECKO2REM: call {{.*}} R_{{.*}} setjmp | 160 ; CHECKO2REM: call {{.*}} R_{{.*}} setjmp |
| 161 ; MIPS32-LABEL: test_setjmp_unused |
| 162 ; MIPS32: jal {{.*}} setjmp |
| 158 | 163 |
| 159 define internal float @test_sqrt_float(float %x, i32 %iptr) { | 164 define internal float @test_sqrt_float(float %x, i32 %iptr) { |
| 160 entry: | 165 entry: |
| 161 %r = call float @llvm.sqrt.f32(float %x) | 166 %r = call float @llvm.sqrt.f32(float %x) |
| 162 %r2 = call float @llvm.sqrt.f32(float %r) | 167 %r2 = call float @llvm.sqrt.f32(float %r) |
| 163 %r3 = call float @llvm.sqrt.f32(float -0.0) | 168 %r3 = call float @llvm.sqrt.f32(float -0.0) |
| 164 %r4 = fadd float %r2, %r3 | 169 %r4 = fadd float %r2, %r3 |
| 165 ret float %r4 | 170 ret float %r4 |
| 166 } | 171 } |
| 167 ; CHECK-LABEL: test_sqrt_float | 172 ; CHECK-LABEL: test_sqrt_float |
| 168 ; CHECK: sqrtss xmm{{.*}} | 173 ; CHECK: sqrtss xmm{{.*}} |
| 169 ; CHECK: sqrtss xmm{{.*}} | 174 ; CHECK: sqrtss xmm{{.*}} |
| 170 ; CHECK: sqrtss xmm{{.*}},DWORD PTR | 175 ; CHECK: sqrtss xmm{{.*}},DWORD PTR |
| 171 ; ARM32-LABEL: test_sqrt_float | 176 ; ARM32-LABEL: test_sqrt_float |
| 172 ; ARM32: vsqrt.f32 | 177 ; ARM32: vsqrt.f32 |
| 173 ; ARM32: vsqrt.f32 | 178 ; ARM32: vsqrt.f32 |
| 174 ; ARM32: vsqrt.f32 | 179 ; ARM32: vsqrt.f32 |
| 175 ; ARM32: vadd.f32 | 180 ; ARM32: vadd.f32 |
| 181 ; MIPS32-LABEL: test_sqrt_float |
| 182 ; MIPS32: sqrt.s |
| 183 ; MIPS32: sqrt.s |
| 184 ; MIPS32: sqrt.s |
| 185 ; MIPS32: add.s |
| 176 | 186 |
| 177 define internal float @test_sqrt_float_mergeable_load(float %x, i32 %iptr) { | 187 define internal float @test_sqrt_float_mergeable_load(float %x, i32 %iptr) { |
| 178 entry: | 188 entry: |
| 179 %__2 = inttoptr i32 %iptr to float* | 189 %__2 = inttoptr i32 %iptr to float* |
| 180 %y = load float, float* %__2, align 4 | 190 %y = load float, float* %__2, align 4 |
| 181 %r5 = call float @llvm.sqrt.f32(float %y) | 191 %r5 = call float @llvm.sqrt.f32(float %y) |
| 182 %r6 = fadd float %x, %r5 | 192 %r6 = fadd float %x, %r5 |
| 183 ret float %r6 | 193 ret float %r6 |
| 184 } | 194 } |
| 185 ; CHECK-LABEL: test_sqrt_float_mergeable_load | 195 ; CHECK-LABEL: test_sqrt_float_mergeable_load |
| (...skipping 15 matching lines...) Expand all Loading... |
| 201 } | 211 } |
| 202 ; CHECK-LABEL: test_sqrt_double | 212 ; CHECK-LABEL: test_sqrt_double |
| 203 ; CHECK: sqrtsd xmm{{.*}} | 213 ; CHECK: sqrtsd xmm{{.*}} |
| 204 ; CHECK: sqrtsd xmm{{.*}} | 214 ; CHECK: sqrtsd xmm{{.*}} |
| 205 ; CHECK: sqrtsd xmm{{.*}},QWORD PTR | 215 ; CHECK: sqrtsd xmm{{.*}},QWORD PTR |
| 206 ; ARM32-LABEL: test_sqrt_double | 216 ; ARM32-LABEL: test_sqrt_double |
| 207 ; ARM32: vsqrt.f64 | 217 ; ARM32: vsqrt.f64 |
| 208 ; ARM32: vsqrt.f64 | 218 ; ARM32: vsqrt.f64 |
| 209 ; ARM32: vsqrt.f64 | 219 ; ARM32: vsqrt.f64 |
| 210 ; ARM32: vadd.f64 | 220 ; ARM32: vadd.f64 |
| 221 ; MIPS32-LABEL: test_sqrt_double |
| 222 ; MIPS32: sqrt.d |
| 223 ; MIPS32: sqrt.d |
| 224 ; MIPS32: sqrt.d |
| 225 ; MIPS32: add.d |
| 211 | 226 |
| 212 define internal double @test_sqrt_double_mergeable_load(double %x, i32 %iptr) { | 227 define internal double @test_sqrt_double_mergeable_load(double %x, i32 %iptr) { |
| 213 entry: | 228 entry: |
| 214 %__2 = inttoptr i32 %iptr to double* | 229 %__2 = inttoptr i32 %iptr to double* |
| 215 %y = load double, double* %__2, align 8 | 230 %y = load double, double* %__2, align 8 |
| 216 %r5 = call double @llvm.sqrt.f64(double %y) | 231 %r5 = call double @llvm.sqrt.f64(double %y) |
| 217 %r6 = fadd double %x, %r5 | 232 %r6 = fadd double %x, %r5 |
| 218 ret double %r6 | 233 ret double %r6 |
| 219 } | 234 } |
| 220 ; CHECK-LABEL: test_sqrt_double_mergeable_load | 235 ; CHECK-LABEL: test_sqrt_double_mergeable_load |
| 221 ; CHECK: sqrtsd xmm{{.*}} | 236 ; CHECK: sqrtsd xmm{{.*}} |
| 222 ; ARM32-LABEL: test_sqrt_double_mergeable_load | 237 ; ARM32-LABEL: test_sqrt_double_mergeable_load |
| 223 ; ARM32: vldr d{{.*}} | 238 ; ARM32: vldr d{{.*}} |
| 224 ; ARM32: vsqrt.f64 | 239 ; ARM32: vsqrt.f64 |
| 225 | 240 |
| 226 define internal float @test_sqrt_ignored(float %x, double %y) { | 241 define internal float @test_sqrt_ignored(float %x, double %y) { |
| 227 entry: | 242 entry: |
| 228 %ignored1 = call float @llvm.sqrt.f32(float %x) | 243 %ignored1 = call float @llvm.sqrt.f32(float %x) |
| 229 %ignored2 = call double @llvm.sqrt.f64(double %y) | 244 %ignored2 = call double @llvm.sqrt.f64(double %y) |
| 230 ret float 0.0 | 245 ret float 0.0 |
| 231 } | 246 } |
| 232 ; CHECKO2REM-LABEL: test_sqrt_ignored | 247 ; CHECKO2REM-LABEL: test_sqrt_ignored |
| 233 ; CHECKO2REM-NOT: sqrtss | 248 ; CHECKO2REM-NOT: sqrtss |
| 234 ; CHECKO2REM-NOT: sqrtsd | 249 ; CHECKO2REM-NOT: sqrtsd |
| 250 ; MIPS32-LABEL: test_sqrt_ignored |
| 251 ; MIPS32: sqrt.s |
| 252 ; MIPS32: sqrt.d |
| 235 | 253 |
| 236 define internal float @test_fabs_float(float %x) { | 254 define internal float @test_fabs_float(float %x) { |
| 237 entry: | 255 entry: |
| 238 %r = call float @llvm.fabs.f32(float %x) | 256 %r = call float @llvm.fabs.f32(float %x) |
| 239 %r2 = call float @llvm.fabs.f32(float %r) | 257 %r2 = call float @llvm.fabs.f32(float %r) |
| 240 %r3 = call float @llvm.fabs.f32(float -0.0) | 258 %r3 = call float @llvm.fabs.f32(float -0.0) |
| 241 %r4 = fadd float %r2, %r3 | 259 %r4 = fadd float %r2, %r3 |
| 242 ret float %r4 | 260 ret float %r4 |
| 243 } | 261 } |
| 244 ;;; Specially check that the pand instruction doesn't try to operate on a 32-bit | 262 ;;; Specially check that the pand instruction doesn't try to operate on a 32-bit |
| 245 ;;; (f32) memory operand, and instead uses two xmm registers. | 263 ;;; (f32) memory operand, and instead uses two xmm registers. |
| 246 ; CHECK-LABEL: test_fabs_float | 264 ; CHECK-LABEL: test_fabs_float |
| 247 ; CHECK: pcmpeqd | 265 ; CHECK: pcmpeqd |
| 248 ; CHECK: psrld | 266 ; CHECK: psrld |
| 249 ; CHECK: pand {{.*}}xmm{{.*}}xmm | 267 ; CHECK: pand {{.*}}xmm{{.*}}xmm |
| 250 ; CHECK: pcmpeqd | 268 ; CHECK: pcmpeqd |
| 251 ; CHECK: psrld | 269 ; CHECK: psrld |
| 252 ; CHECK: pand {{.*}}xmm{{.*}}xmm | 270 ; CHECK: pand {{.*}}xmm{{.*}}xmm |
| 253 ; CHECK: pcmpeqd | 271 ; CHECK: pcmpeqd |
| 254 ; CHECK: psrld | 272 ; CHECK: psrld |
| 255 ; CHECK: pand {{.*}}xmm{{.*}}xmm | 273 ; CHECK: pand {{.*}}xmm{{.*}}xmm |
| 274 ; MIPS32-LABEL: test_fabs_float |
| 275 ; MIPS32: abs.s |
| 276 ; MIPS32: abs.s |
| 277 ; MIPS32: abs.s |
| 278 ; MIPS32: add.s |
| 256 | 279 |
| 257 define internal double @test_fabs_double(double %x) { | 280 define internal double @test_fabs_double(double %x) { |
| 258 entry: | 281 entry: |
| 259 %r = call double @llvm.fabs.f64(double %x) | 282 %r = call double @llvm.fabs.f64(double %x) |
| 260 %r2 = call double @llvm.fabs.f64(double %r) | 283 %r2 = call double @llvm.fabs.f64(double %r) |
| 261 %r3 = call double @llvm.fabs.f64(double -0.0) | 284 %r3 = call double @llvm.fabs.f64(double -0.0) |
| 262 %r4 = fadd double %r2, %r3 | 285 %r4 = fadd double %r2, %r3 |
| 263 ret double %r4 | 286 ret double %r4 |
| 264 } | 287 } |
| 265 ;;; Specially check that the pand instruction doesn't try to operate on a 64-bit | 288 ;;; Specially check that the pand instruction doesn't try to operate on a 64-bit |
| 266 ;;; (f64) memory operand, and instead uses two xmm registers. | 289 ;;; (f64) memory operand, and instead uses two xmm registers. |
| 267 ; CHECK-LABEL: test_fabs_double | 290 ; CHECK-LABEL: test_fabs_double |
| 268 ; CHECK: pcmpeqd | 291 ; CHECK: pcmpeqd |
| 269 ; CHECK: psrlq | 292 ; CHECK: psrlq |
| 270 ; CHECK: pand {{.*}}xmm{{.*}}xmm | 293 ; CHECK: pand {{.*}}xmm{{.*}}xmm |
| 271 ; CHECK: pcmpeqd | 294 ; CHECK: pcmpeqd |
| 272 ; CHECK: psrlq | 295 ; CHECK: psrlq |
| 273 ; CHECK: pand {{.*}}xmm{{.*}}xmm | 296 ; CHECK: pand {{.*}}xmm{{.*}}xmm |
| 274 ; CHECK: pcmpeqd | 297 ; CHECK: pcmpeqd |
| 275 ; CHECK: psrlq | 298 ; CHECK: psrlq |
| 276 ; CHECK: pand {{.*}}xmm{{.*}}xmm | 299 ; CHECK: pand {{.*}}xmm{{.*}}xmm |
| 300 ; MIPS32-LABEL: test_fabs_double |
| 301 ; MIPS32: abs.d |
| 302 ; MIPS32: abs.d |
| 303 ; MIPS32: abs.d |
| 304 ; MIPS32: add.d |
| 277 | 305 |
| 278 define internal <4 x float> @test_fabs_v4f32(<4 x float> %x) { | 306 define internal <4 x float> @test_fabs_v4f32(<4 x float> %x) { |
| 279 entry: | 307 entry: |
| 280 %r = call <4 x float> @llvm.fabs.v4f32(<4 x float> %x) | 308 %r = call <4 x float> @llvm.fabs.v4f32(<4 x float> %x) |
| 281 %r2 = call <4 x float> @llvm.fabs.v4f32(<4 x float> %r) | 309 %r2 = call <4 x float> @llvm.fabs.v4f32(<4 x float> %r) |
| 282 %r3 = call <4 x float> @llvm.fabs.v4f32(<4 x float> undef) | 310 %r3 = call <4 x float> @llvm.fabs.v4f32(<4 x float> undef) |
| 283 %r4 = fadd <4 x float> %r2, %r3 | 311 %r4 = fadd <4 x float> %r2, %r3 |
| 284 ret <4 x float> %r4 | 312 ret <4 x float> %r4 |
| 285 } | 313 } |
| 286 ; CHECK-LABEL: test_fabs_v4f32 | 314 ; CHECK-LABEL: test_fabs_v4f32 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 | 506 |
| 479 define internal i32 @test_popcount_32(i32 %x) { | 507 define internal i32 @test_popcount_32(i32 %x) { |
| 480 entry: | 508 entry: |
| 481 %r = call i32 @llvm.ctpop.i32(i32 %x) | 509 %r = call i32 @llvm.ctpop.i32(i32 %x) |
| 482 ret i32 %r | 510 ret i32 %r |
| 483 } | 511 } |
| 484 ; CHECK-LABEL: test_popcount_32 | 512 ; CHECK-LABEL: test_popcount_32 |
| 485 ; CHECK: call {{.*}} R_{{.*}} __popcountsi2 | 513 ; CHECK: call {{.*}} R_{{.*}} __popcountsi2 |
| 486 ; ARM32-LABEL: test_popcount_32 | 514 ; ARM32-LABEL: test_popcount_32 |
| 487 ; ARM32: bl {{.*}} __popcountsi2 | 515 ; ARM32: bl {{.*}} __popcountsi2 |
| 516 ; MIPS32-LABEL: test_popcount_32 |
| 517 ; MIPS32: jal {{.*}} __popcountsi2 |
| 488 | 518 |
| 489 define internal i64 @test_popcount_64(i64 %x) { | 519 define internal i64 @test_popcount_64(i64 %x) { |
| 490 entry: | 520 entry: |
| 491 %r = call i64 @llvm.ctpop.i64(i64 %x) | 521 %r = call i64 @llvm.ctpop.i64(i64 %x) |
| 492 ret i64 %r | 522 ret i64 %r |
| 493 } | 523 } |
| 494 ; CHECK-LABEL: test_popcount_64 | 524 ; CHECK-LABEL: test_popcount_64 |
| 495 ; CHECK: call {{.*}} R_{{.*}} __popcountdi2 | 525 ; CHECK: call {{.*}} R_{{.*}} __popcountdi2 |
| 496 ; __popcountdi2 only returns a 32-bit result, so clear the upper bits of | 526 ; __popcountdi2 only returns a 32-bit result, so clear the upper bits of |
| 497 ; the return value just in case. | 527 ; the return value just in case. |
| 498 ; CHECK: mov {{.*}},0x0 | 528 ; CHECK: mov {{.*}},0x0 |
| 499 ; ARM32-LABEL: test_popcount_64 | 529 ; ARM32-LABEL: test_popcount_64 |
| 500 ; ARM32: bl {{.*}} __popcountdi2 | 530 ; ARM32: bl {{.*}} __popcountdi2 |
| 501 ; ARM32: mov {{.*}}, #0 | 531 ; ARM32: mov {{.*}}, #0 |
| 532 ; MIPS32-LABEL: test_popcount_64 |
| 533 ; MIPS32: jal {{.*}} __popcountdi2 |
| 502 | 534 |
| 503 define internal i32 @test_popcount_64_ret_i32(i64 %x) { | 535 define internal i32 @test_popcount_64_ret_i32(i64 %x) { |
| 504 entry: | 536 entry: |
| 505 %r_i64 = call i64 @llvm.ctpop.i64(i64 %x) | 537 %r_i64 = call i64 @llvm.ctpop.i64(i64 %x) |
| 506 %r = trunc i64 %r_i64 to i32 | 538 %r = trunc i64 %r_i64 to i32 |
| 507 ret i32 %r | 539 ret i32 %r |
| 508 } | 540 } |
| 509 ; If there is a trunc, then the mov {{.*}}, 0 is dead and gets optimized out. | 541 ; If there is a trunc, then the mov {{.*}}, 0 is dead and gets optimized out. |
| 510 ; CHECKO2REM-LABEL: test_popcount_64_ret_i32 | 542 ; CHECKO2REM-LABEL: test_popcount_64_ret_i32 |
| 511 ; CHECKO2REM: call {{.*}} R_{{.*}} __popcountdi2 | 543 ; CHECKO2REM: call {{.*}} R_{{.*}} __popcountdi2 |
| 512 ; CHECKO2REM-NOT: mov {{.*}}, 0 | 544 ; CHECKO2REM-NOT: mov {{.*}}, 0 |
| 545 ; MIPS32-LABEL: test_popcount_64_ret_i32 |
| 546 ; MIPS32: jal {{.*}} __popcountdi2 |
| 547 ; MIPS32: sw v0,{{.*}} |
| 548 ; MIPS32: sw v1,{{.*}} |
| 549 ; MIPS32: lw v0,{{.*}} |
| 550 ; MIPS32: lw ra,{{.*}} |
| 513 | 551 |
| 514 define internal void @test_stacksave_noalloca() { | 552 define internal void @test_stacksave_noalloca() { |
| 515 entry: | 553 entry: |
| 516 %sp = call i8* @llvm.stacksave() | 554 %sp = call i8* @llvm.stacksave() |
| 517 call void @llvm.stackrestore(i8* %sp) | 555 call void @llvm.stackrestore(i8* %sp) |
| 518 ret void | 556 ret void |
| 519 } | 557 } |
| 520 ; CHECK-LABEL: test_stacksave_noalloca | 558 ; CHECK-LABEL: test_stacksave_noalloca |
| 521 ; CHECK: mov {{.*}},esp | 559 ; CHECK: mov {{.*}},esp |
| 522 ; CHECK: mov esp,{{.*}} | 560 ; CHECK: mov esp,{{.*}} |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 ; CHECK: lea {{.*}},[esp+0x10] | 598 ; CHECK: lea {{.*}},[esp+0x10] |
| 561 ; CHECK: lea {{.*}},[esp+0x10] | 599 ; CHECK: lea {{.*}},[esp+0x10] |
| 562 ; CHECK: call | 600 ; CHECK: call |
| 563 ; CHECK: mov esp,{{.*}} | 601 ; CHECK: mov esp,{{.*}} |
| 564 ; CHECK: mov esp,ebp | 602 ; CHECK: mov esp,ebp |
| 565 ; ARM32-LABEL: test_stacksave_multiple | 603 ; ARM32-LABEL: test_stacksave_multiple |
| 566 ; ARM32: mov {{.*}}, sp | 604 ; ARM32: mov {{.*}}, sp |
| 567 ; ARM32: mov {{.*}}, sp | 605 ; ARM32: mov {{.*}}, sp |
| 568 ; ARM32: mov {{.*}}, sp | 606 ; ARM32: mov {{.*}}, sp |
| 569 ; ARM32: mov sp, {{.*}} | 607 ; ARM32: mov sp, {{.*}} |
| OLD | NEW |