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: %p2i -i %s --filetype=obj --disassemble --args -O2 \ | 4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
5 ; RUN: | FileCheck %s | 5 ; RUN: | FileCheck %s |
6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ | 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
7 ; RUN: | FileCheck --check-prefix=O2 %s | 7 ; RUN: | FileCheck --check-prefix=O2 %s |
8 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ | 8 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
9 ; RUN: | FileCheck %s | 9 ; RUN: | FileCheck %s |
10 | 10 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 ret i64 %a | 258 ret i64 %a |
259 } | 259 } |
260 ; CHECK-LABEL: test_atomic_rmw_add_64_global | 260 ; CHECK-LABEL: test_atomic_rmw_add_64_global |
261 | 261 |
262 ; Test with some more register pressure. When we have an alloca, ebp is | 262 ; Test with some more register pressure. When we have an alloca, ebp is |
263 ; used to manage the stack frame, so it cannot be used as a register either. | 263 ; used to manage the stack frame, so it cannot be used as a register either. |
264 declare void @use_ptr(i32 %iptr) | 264 declare void @use_ptr(i32 %iptr) |
265 | 265 |
266 define i64 @test_atomic_rmw_add_64_alloca(i32 %iptr, i64 %v) { | 266 define i64 @test_atomic_rmw_add_64_alloca(i32 %iptr, i64 %v) { |
267 entry: | 267 entry: |
| 268 br label %eblock ; Disable alloca optimization |
| 269 eblock: |
268 %alloca_ptr = alloca i8, i32 16, align 16 | 270 %alloca_ptr = alloca i8, i32 16, align 16 |
269 %ptr = inttoptr i32 %iptr to i64* | 271 %ptr = inttoptr i32 %iptr to i64* |
270 %old = call i64 @llvm.nacl.atomic.rmw.i64(i32 1, i64* %ptr, i64 %v, i32 6) | 272 %old = call i64 @llvm.nacl.atomic.rmw.i64(i32 1, i64* %ptr, i64 %v, i32 6) |
271 store i8 0, i8* %alloca_ptr, align 1 | 273 store i8 0, i8* %alloca_ptr, align 1 |
272 store i8 1, i8* %alloca_ptr, align 1 | 274 store i8 1, i8* %alloca_ptr, align 1 |
273 store i8 2, i8* %alloca_ptr, align 1 | 275 store i8 2, i8* %alloca_ptr, align 1 |
274 store i8 3, i8* %alloca_ptr, align 1 | 276 store i8 3, i8* %alloca_ptr, align 1 |
275 %__5 = ptrtoint i8* %alloca_ptr to i32 | 277 %__5 = ptrtoint i8* %alloca_ptr to i32 |
276 call void @use_ptr(i32 %__5) | 278 call void @use_ptr(i32 %__5) |
277 ret i64 %old | 279 ret i64 %old |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 ; CHECK-DAG: mov ecx | 800 ; CHECK-DAG: mov ecx |
799 ; CHECK-DAG: mov ebx | 801 ; CHECK-DAG: mov ebx |
800 ; CHECK: lock cmpxchg8b QWORD PTR [e{{.[^x]}} | 802 ; CHECK: lock cmpxchg8b QWORD PTR [e{{.[^x]}} |
801 ; CHECK-DAG: mov {{.*}},edx | 803 ; CHECK-DAG: mov {{.*}},edx |
802 ; CHECK-DAG: mov {{.*}},eax | 804 ; CHECK-DAG: mov {{.*}},eax |
803 | 805 |
804 ; Test with some more register pressure. When we have an alloca, ebp is | 806 ; Test with some more register pressure. When we have an alloca, ebp is |
805 ; used to manage the stack frame, so it cannot be used as a register either. | 807 ; used to manage the stack frame, so it cannot be used as a register either. |
806 define i64 @test_atomic_cmpxchg_64_alloca(i32 %iptr, i64 %expected, i64 %desired
) { | 808 define i64 @test_atomic_cmpxchg_64_alloca(i32 %iptr, i64 %expected, i64 %desired
) { |
807 entry: | 809 entry: |
| 810 br label %eblock ; Disable alloca optimization |
| 811 eblock: |
808 %alloca_ptr = alloca i8, i32 16, align 16 | 812 %alloca_ptr = alloca i8, i32 16, align 16 |
809 %ptr = inttoptr i32 %iptr to i64* | 813 %ptr = inttoptr i32 %iptr to i64* |
810 %old = call i64 @llvm.nacl.atomic.cmpxchg.i64(i64* %ptr, i64 %expected, | 814 %old = call i64 @llvm.nacl.atomic.cmpxchg.i64(i64* %ptr, i64 %expected, |
811 i64 %desired, i32 6, i32 6) | 815 i64 %desired, i32 6, i32 6) |
812 store i8 0, i8* %alloca_ptr, align 1 | 816 store i8 0, i8* %alloca_ptr, align 1 |
813 store i8 1, i8* %alloca_ptr, align 1 | 817 store i8 1, i8* %alloca_ptr, align 1 |
814 store i8 2, i8* %alloca_ptr, align 1 | 818 store i8 2, i8* %alloca_ptr, align 1 |
815 store i8 3, i8* %alloca_ptr, align 1 | 819 store i8 3, i8* %alloca_ptr, align 1 |
816 %__6 = ptrtoint i8* %alloca_ptr to i32 | 820 %__6 = ptrtoint i8* %alloca_ptr to i32 |
817 call void @use_ptr(i32 %__6) | 821 call void @use_ptr(i32 %__6) |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 br i1 %cmp, label %done, label %body | 1016 br i1 %cmp, label %done, label %body |
1013 done: | 1017 done: |
1014 ret void | 1018 ret void |
1015 } | 1019 } |
1016 ; O2-LABEL: test_cmpxchg8b_regalloc | 1020 ; O2-LABEL: test_cmpxchg8b_regalloc |
1017 ;;; eax and some other register will be used in the cmpxchg instruction. | 1021 ;;; eax and some other register will be used in the cmpxchg instruction. |
1018 ; O2: lock cmpxchg8b QWORD PTR | 1022 ; O2: lock cmpxchg8b QWORD PTR |
1019 ;;; Make sure eax/ecx/edx/ebx aren't used again, e.g. as the induction variable. | 1023 ;;; Make sure eax/ecx/edx/ebx aren't used again, e.g. as the induction variable. |
1020 ; O2-NOT: {{eax|ecx|edx|ebx}} | 1024 ; O2-NOT: {{eax|ecx|edx|ebx}} |
1021 ; O2: pop ebx | 1025 ; O2: pop ebx |
OLD | NEW |