| OLD | NEW |
| 1 ; This tests each of the supported NaCl atomic instructions for every | 1 ; This tests each of the supported NaCl atomic instructions for every |
| 2 ; size allowed. | 2 ; size allowed. |
| 3 | 3 |
| 4 ; RUN: %llvm2ice -O2 --verbose none %s \ | 4 ; RUN: %llvm2ice -O2 --verbose none %s \ |
| 5 ; 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 | 6 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
| 7 ; RUN: %llvm2ice -O2 --verbose none %s \ | 7 ; RUN: %llvm2ice -O2 --verbose none %s \ |
| 8 ; 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 - \ | 9 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - \ |
| 10 ; RUN: | FileCheck --check-prefix=CHECKO2 %s | 10 ; RUN: | FileCheck --check-prefix=CHECKO2 %s |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 %trunc = trunc i32 %v to i8 | 199 %trunc = trunc i32 %v to i8 |
| 200 %ptr = inttoptr i32 %iptr to i8* | 200 %ptr = inttoptr i32 %iptr to i8* |
| 201 ; "1" is an atomic add, and "6" is sequential consistency. | 201 ; "1" is an atomic add, and "6" is sequential consistency. |
| 202 %a = call i8 @llvm.nacl.atomic.rmw.i8(i32 1, i8* %ptr, i8 %trunc, i32 6) | 202 %a = call i8 @llvm.nacl.atomic.rmw.i8(i32 1, i8* %ptr, i8 %trunc, i32 6) |
| 203 %a_ext = zext i8 %a to i32 | 203 %a_ext = zext i8 %a to i32 |
| 204 ret i32 %a_ext | 204 ret i32 %a_ext |
| 205 } | 205 } |
| 206 ; CHECK-LABEL: test_atomic_rmw_add_8 | 206 ; CHECK-LABEL: test_atomic_rmw_add_8 |
| 207 ; CHECK: lock | 207 ; CHECK: lock |
| 208 ; CHECK-NEXT: xadd byte {{.*}}, [[REG:.*]] | 208 ; CHECK-NEXT: xadd byte {{.*}}, [[REG:.*]] |
| 209 ; CHECK: mov {{.*}}, [[REG]] | 209 ; CHECK: {{mov|movzx}} {{.*}}, [[REG]] |
| 210 | 210 |
| 211 define i32 @test_atomic_rmw_add_16(i32 %iptr, i32 %v) { | 211 define i32 @test_atomic_rmw_add_16(i32 %iptr, i32 %v) { |
| 212 entry: | 212 entry: |
| 213 %trunc = trunc i32 %v to i16 | 213 %trunc = trunc i32 %v to i16 |
| 214 %ptr = inttoptr i32 %iptr to i16* | 214 %ptr = inttoptr i32 %iptr to i16* |
| 215 %a = call i16 @llvm.nacl.atomic.rmw.i16(i32 1, i16* %ptr, i16 %trunc, i32 6) | 215 %a = call i16 @llvm.nacl.atomic.rmw.i16(i32 1, i16* %ptr, i16 %trunc, i32 6) |
| 216 %a_ext = zext i16 %a to i32 | 216 %a_ext = zext i16 %a to i32 |
| 217 ret i32 %a_ext | 217 ret i32 %a_ext |
| 218 } | 218 } |
| 219 ; CHECK-LABEL: test_atomic_rmw_add_16 | 219 ; CHECK-LABEL: test_atomic_rmw_add_16 |
| 220 ; CHECK: lock | 220 ; CHECK: lock |
| 221 ; CHECK-NEXT: xadd word {{.*}}, [[REG:.*]] | 221 ; CHECK-NEXT: xadd word {{.*}}, [[REG:.*]] |
| 222 ; CHECK: mov {{.*}}, [[REG]] | 222 ; CHECK: {{mov|movzx}} {{.*}}, [[REG]] |
| 223 | 223 |
| 224 define i32 @test_atomic_rmw_add_32(i32 %iptr, i32 %v) { | 224 define i32 @test_atomic_rmw_add_32(i32 %iptr, i32 %v) { |
| 225 entry: | 225 entry: |
| 226 %ptr = inttoptr i32 %iptr to i32* | 226 %ptr = inttoptr i32 %iptr to i32* |
| 227 %a = call i32 @llvm.nacl.atomic.rmw.i32(i32 1, i32* %ptr, i32 %v, i32 6) | 227 %a = call i32 @llvm.nacl.atomic.rmw.i32(i32 1, i32* %ptr, i32 %v, i32 6) |
| 228 ret i32 %a | 228 ret i32 %a |
| 229 } | 229 } |
| 230 ; CHECK-LABEL: test_atomic_rmw_add_32 | 230 ; CHECK-LABEL: test_atomic_rmw_add_32 |
| 231 ; CHECK: lock | 231 ; CHECK: lock |
| 232 ; CHECK-NEXT: xadd dword {{.*}}, [[REG:.*]] | 232 ; CHECK-NEXT: xadd dword {{.*}}, [[REG:.*]] |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 %trunc = trunc i32 %v to i8 | 341 %trunc = trunc i32 %v to i8 |
| 342 %ptr = inttoptr i32 %iptr to i8* | 342 %ptr = inttoptr i32 %iptr to i8* |
| 343 %a = call i8 @llvm.nacl.atomic.rmw.i8(i32 2, i8* %ptr, i8 %trunc, i32 6) | 343 %a = call i8 @llvm.nacl.atomic.rmw.i8(i32 2, i8* %ptr, i8 %trunc, i32 6) |
| 344 %a_ext = zext i8 %a to i32 | 344 %a_ext = zext i8 %a to i32 |
| 345 ret i32 %a_ext | 345 ret i32 %a_ext |
| 346 } | 346 } |
| 347 ; CHECK-LABEL: test_atomic_rmw_sub_8 | 347 ; CHECK-LABEL: test_atomic_rmw_sub_8 |
| 348 ; CHECK: neg [[REG:.*]] | 348 ; CHECK: neg [[REG:.*]] |
| 349 ; CHECK: lock | 349 ; CHECK: lock |
| 350 ; CHECK-NEXT: xadd byte {{.*}}, [[REG]] | 350 ; CHECK-NEXT: xadd byte {{.*}}, [[REG]] |
| 351 ; CHECK: mov {{.*}}, [[REG]] | 351 ; CHECK: {{mov|movzx}} {{.*}}, [[REG]] |
| 352 | 352 |
| 353 define i32 @test_atomic_rmw_sub_16(i32 %iptr, i32 %v) { | 353 define i32 @test_atomic_rmw_sub_16(i32 %iptr, i32 %v) { |
| 354 entry: | 354 entry: |
| 355 %trunc = trunc i32 %v to i16 | 355 %trunc = trunc i32 %v to i16 |
| 356 %ptr = inttoptr i32 %iptr to i16* | 356 %ptr = inttoptr i32 %iptr to i16* |
| 357 %a = call i16 @llvm.nacl.atomic.rmw.i16(i32 2, i16* %ptr, i16 %trunc, i32 6) | 357 %a = call i16 @llvm.nacl.atomic.rmw.i16(i32 2, i16* %ptr, i16 %trunc, i32 6) |
| 358 %a_ext = zext i16 %a to i32 | 358 %a_ext = zext i16 %a to i32 |
| 359 ret i32 %a_ext | 359 ret i32 %a_ext |
| 360 } | 360 } |
| 361 ; CHECK-LABEL: test_atomic_rmw_sub_16 | 361 ; CHECK-LABEL: test_atomic_rmw_sub_16 |
| 362 ; CHECK: neg [[REG:.*]] | 362 ; CHECK: neg [[REG:.*]] |
| 363 ; CHECK: lock | 363 ; CHECK: lock |
| 364 ; CHECK-NEXT: xadd word {{.*}}, [[REG]] | 364 ; CHECK-NEXT: xadd word {{.*}}, [[REG]] |
| 365 ; CHECK: mov {{.*}}, [[REG]] | 365 ; CHECK: {{mov|movzx}} {{.*}}, [[REG]] |
| 366 | 366 |
| 367 define i32 @test_atomic_rmw_sub_32(i32 %iptr, i32 %v) { | 367 define i32 @test_atomic_rmw_sub_32(i32 %iptr, i32 %v) { |
| 368 entry: | 368 entry: |
| 369 %ptr = inttoptr i32 %iptr to i32* | 369 %ptr = inttoptr i32 %iptr to i32* |
| 370 %a = call i32 @llvm.nacl.atomic.rmw.i32(i32 2, i32* %ptr, i32 %v, i32 6) | 370 %a = call i32 @llvm.nacl.atomic.rmw.i32(i32 2, i32* %ptr, i32 %v, i32 6) |
| 371 ret i32 %a | 371 ret i32 %a |
| 372 } | 372 } |
| 373 ; CHECK-LABEL: test_atomic_rmw_sub_32 | 373 ; CHECK-LABEL: test_atomic_rmw_sub_32 |
| 374 ; CHECK: neg [[REG:.*]] | 374 ; CHECK: neg [[REG:.*]] |
| 375 ; CHECK: lock | 375 ; CHECK: lock |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 ret i32 %z | 917 ret i32 %z |
| 918 } | 918 } |
| 919 ; CHECK-LABEL: test_atomic_is_lock_free_can_dce | 919 ; CHECK-LABEL: test_atomic_is_lock_free_can_dce |
| 920 ; CHECK: mov {{.*}}, 1 | 920 ; CHECK: mov {{.*}}, 1 |
| 921 ; CHECK: ret | 921 ; CHECK: ret |
| 922 ; CHECK: add | 922 ; CHECK: add |
| 923 ; CHECK: ret | 923 ; CHECK: ret |
| 924 | 924 |
| 925 ; ERRORS-NOT: ICE translation error | 925 ; ERRORS-NOT: ICE translation error |
| 926 ; DUMP-NOT: SZ | 926 ; DUMP-NOT: SZ |
| OLD | NEW |