OLD | NEW |
1 ; This tests the optimization of atomic cmpxchg w/ following cmp + branches. | 1 ; This tests the optimization of atomic cmpxchg w/ following cmp + branches. |
2 | 2 |
3 ; RUN: %llvm2ice -O2 --verbose none %s \ | 3 ; RUN: %llvm2ice -O2 --verbose none %s \ |
4 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ | 4 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
5 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - \ | 5 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - \ |
6 ; RUN: | FileCheck --check-prefix=O2 %s | 6 ; RUN: | FileCheck --check-prefix=O2 %s |
7 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 7 ; RUN: %llvm2ice -Om1 --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=OM1 %s | 10 ; RUN: | FileCheck --check-prefix=OM1 %s |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 %old = call i32 @llvm.nacl.atomic.cmpxchg.i32(i32* %ptr, i32 0, | 92 %old = call i32 @llvm.nacl.atomic.cmpxchg.i32(i32* %ptr, i32 0, |
93 i32 %desired, i32 6, i32 6) | 93 i32 %desired, i32 6, i32 6) |
94 %success = icmp eq i32 %old, 0 | 94 %success = icmp eq i32 %old, 0 |
95 br i1 %success, label %done, label %loop | 95 br i1 %success, label %done, label %loop |
96 | 96 |
97 done: | 97 done: |
98 ret i32 %succeeded_first_try | 98 ret i32 %succeeded_first_try |
99 } | 99 } |
100 ; O2-LABEL: test_atomic_cmpxchg_loop_const | 100 ; O2-LABEL: test_atomic_cmpxchg_loop_const |
101 ; O2: lock | 101 ; O2: lock |
102 ; Should be using NEXT: see issue 3929 | 102 ; O2-NEXT: cmpxchg dword ptr [e{{[^a].}}], e{{[^a]}} |
103 ; O2: cmpxchg dword ptr [e{{[^a].}}], e{{[^a]}} | |
104 ; O2-NOT: cmp | 103 ; O2-NOT: cmp |
105 ; O2: jne | 104 ; O2: jne |
106 | 105 |
107 ; This is a case where the flags cannot be reused (compare is for some | 106 ; This is a case where the flags cannot be reused (compare is for some |
108 ; other condition). | 107 ; other condition). |
109 define i32 @test_atomic_cmpxchg_no_opt(i32 %iptr, i32 %expected, i32 %desired) { | 108 define i32 @test_atomic_cmpxchg_no_opt(i32 %iptr, i32 %expected, i32 %desired) { |
110 entry: | 109 entry: |
111 br label %loop | 110 br label %loop |
112 | 111 |
113 loop: | 112 loop: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 147 } |
149 ; O2-LABEL: test_atomic_cmpxchg_no_opt2 | 148 ; O2-LABEL: test_atomic_cmpxchg_no_opt2 |
150 ; O2: lock | 149 ; O2: lock |
151 ; O2-NEXT: cmpxchg dword ptr [e{{[^a].}}], e{{[^a]}} | 150 ; O2-NEXT: cmpxchg dword ptr [e{{[^a].}}], e{{[^a]}} |
152 ; O2: mov {{.*}} | 151 ; O2: mov {{.*}} |
153 ; O2: cmp | 152 ; O2: cmp |
154 ; O2: je | 153 ; O2: je |
155 | 154 |
156 ; ERRORS-NOT: ICE translation error | 155 ; ERRORS-NOT: ICE translation error |
157 ; DUMP-NOT: SZ | 156 ; DUMP-NOT: SZ |
OLD | NEW |