| 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 | FileCheck %s | 4 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
| 5 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s --check-prefix=CHECKO2 | 5 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s --check-prefix=CHECKO2 |
| 6 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s | 6 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s |
| 7 ; RUN: %llvm2ice -O2 --verbose none %s \ | 7 ; RUN: %llvm2ice -O2 --verbose none %s \ |
| 8 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj | 8 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
| 9 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 9 ; RUN: %llvm2ice -Om1 --verbose none %s \ |
| 10 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj | 10 ; RUN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 %ptr = inttoptr i32 %iptr to i64* | 81 %ptr = inttoptr i32 %iptr to i64* |
| 82 %r = call i64 @llvm.nacl.atomic.load.i64(i64* %ptr, i32 6) | 82 %r = call i64 @llvm.nacl.atomic.load.i64(i64* %ptr, i32 6) |
| 83 ret i64 %r | 83 ret i64 %r |
| 84 } | 84 } |
| 85 ; CHECK-LABEL: test_atomic_load_64 | 85 ; CHECK-LABEL: test_atomic_load_64 |
| 86 ; CHECK: movq x{{.*}}, qword | 86 ; CHECK: movq x{{.*}}, qword |
| 87 ; CHECK: movq qword {{.*}}, x{{.*}} | 87 ; CHECK: movq qword {{.*}}, x{{.*}} |
| 88 | 88 |
| 89 define i32 @test_atomic_load_32_with_arith(i32 %iptr) { | 89 define i32 @test_atomic_load_32_with_arith(i32 %iptr) { |
| 90 entry: | 90 entry: |
| 91 br label %next |
| 92 |
| 93 next: |
| 91 %ptr = inttoptr i32 %iptr to i32* | 94 %ptr = inttoptr i32 %iptr to i32* |
| 92 %r = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) | 95 %r = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) |
| 93 %r2 = add i32 %r, 32 | 96 %r2 = add i32 %r, 32 |
| 94 ret i32 %r2 | 97 ret i32 %r2 |
| 95 } | 98 } |
| 96 ; CHECK-LABEL: test_atomic_load_32_with_arith | 99 ; CHECK-LABEL: test_atomic_load_32_with_arith |
| 97 ; CHECK: mov {{.*}}, dword | 100 ; CHECK: mov {{.*}}, dword |
| 98 ; The next instruction may be a separate load or folded into an add. | 101 ; The next instruction may be a separate load or folded into an add. |
| 102 ; |
| 103 ; In O2 mode, we know that the load and add are going to be fused. |
| 104 ; CHECKO2-LABEL: test_atomic_load_32_with_arith |
| 105 ; CHECKO2: mov {{.*}}, dword |
| 106 ; CHECKO2: add {{.*}}, dword |
| 99 | 107 |
| 100 define i32 @test_atomic_load_32_ignored(i32 %iptr) { | 108 define i32 @test_atomic_load_32_ignored(i32 %iptr) { |
| 101 entry: | 109 entry: |
| 102 %ptr = inttoptr i32 %iptr to i32* | 110 %ptr = inttoptr i32 %iptr to i32* |
| 103 %ignored = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) | 111 %ignored = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) |
| 104 ret i32 0 | 112 ret i32 0 |
| 105 } | 113 } |
| 106 ; CHECK-LABEL: test_atomic_load_32_ignored | 114 ; CHECK-LABEL: test_atomic_load_32_ignored |
| 107 ; CHECK: mov {{.*}}, dword | 115 ; CHECK: mov {{.*}}, dword |
| 108 ; CHECK: mov {{.*}}, dword | 116 ; CHECK: mov {{.*}}, dword |
| 117 ; CHECKO2-LABEL: test_atomic_load_32_ignored |
| 118 ; CHECKO2: mov {{.*}}, dword |
| 119 ; CHECKO2: mov {{.*}}, dword |
| 109 | 120 |
| 110 define i64 @test_atomic_load_64_ignored(i32 %iptr) { | 121 define i64 @test_atomic_load_64_ignored(i32 %iptr) { |
| 111 entry: | 122 entry: |
| 112 %ptr = inttoptr i32 %iptr to i64* | 123 %ptr = inttoptr i32 %iptr to i64* |
| 113 %ignored = call i64 @llvm.nacl.atomic.load.i64(i64* %ptr, i32 6) | 124 %ignored = call i64 @llvm.nacl.atomic.load.i64(i64* %ptr, i32 6) |
| 114 ret i64 0 | 125 ret i64 0 |
| 115 } | 126 } |
| 116 ; CHECK-LABEL: test_atomic_load_64_ignored | 127 ; CHECK-LABEL: test_atomic_load_64_ignored |
| 117 ; CHECK: movq x{{.*}}, qword | 128 ; CHECK: movq x{{.*}}, qword |
| 118 ; CHECK: movq qword {{.*}}, x{{.*}} | 129 ; CHECK: movq qword {{.*}}, x{{.*}} |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 ret i32 %z | 896 ret i32 %z |
| 886 } | 897 } |
| 887 ; CHECK-LABEL: test_atomic_is_lock_free_can_dce | 898 ; CHECK-LABEL: test_atomic_is_lock_free_can_dce |
| 888 ; CHECK: mov {{.*}}, 1 | 899 ; CHECK: mov {{.*}}, 1 |
| 889 ; CHECK: ret | 900 ; CHECK: ret |
| 890 ; CHECK: add | 901 ; CHECK: add |
| 891 ; CHECK: ret | 902 ; CHECK: ret |
| 892 | 903 |
| 893 ; ERRORS-NOT: ICE translation error | 904 ; ERRORS-NOT: ICE translation error |
| 894 ; DUMP-NOT: SZ | 905 ; DUMP-NOT: SZ |
| OLD | NEW |