| 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: %p2i -i %s --args -O2 --verbose none \ | 3 ; RUN: %p2i -i %s --args -O2 --verbose none \ |
| 4 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 4 ; RUN: | llvm-mc -triple=i686-none-nacl -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: %p2i -i %s --args -Om1 --verbose none \ | 7 ; RUN: %p2i -i %s --args -Om1 --verbose none \ |
| 8 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 8 ; RUN: | llvm-mc -triple=i686-none-nacl -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 |
| 11 ; RUN: %p2i -i %s --args --verbose none | FileCheck --check-prefix=ERRORS %s | |
| 12 | 11 |
| 13 declare i32 @llvm.nacl.atomic.cmpxchg.i32(i32*, i32, i32, i32, i32) | 12 declare i32 @llvm.nacl.atomic.cmpxchg.i32(i32*, i32, i32, i32, i32) |
| 14 | 13 |
| 15 | 14 |
| 16 ; Test that a cmpxchg followed by icmp eq and branch can be optimized to | 15 ; Test that a cmpxchg followed by icmp eq and branch can be optimized to |
| 17 ; reuse the flags set by the cmpxchg instruction itself. | 16 ; reuse the flags set by the cmpxchg instruction itself. |
| 18 ; This is only expected to work w/ O2, based on lightweight liveness. | 17 ; This is only expected to work w/ O2, based on lightweight liveness. |
| 19 ; (Or if we had other means to detect the only use). | 18 ; (Or if we had other means to detect the only use). |
| 20 declare void @use_value(i32) | 19 declare void @use_value(i32) |
| 21 | 20 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 done: | 134 done: |
| 136 %r = zext i1 %success to i32 | 135 %r = zext i1 %success to i32 |
| 137 ret i32 %r | 136 ret i32 %r |
| 138 } | 137 } |
| 139 ; O2-LABEL: test_atomic_cmpxchg_no_opt2 | 138 ; O2-LABEL: test_atomic_cmpxchg_no_opt2 |
| 140 ; O2: lock | 139 ; O2: lock |
| 141 ; O2-NEXT: cmpxchg dword ptr [e{{[^a].}}], e{{[^a]}} | 140 ; O2-NEXT: cmpxchg dword ptr [e{{[^a].}}], e{{[^a]}} |
| 142 ; O2: mov {{.*}} | 141 ; O2: mov {{.*}} |
| 143 ; O2: cmp | 142 ; O2: cmp |
| 144 ; O2: je | 143 ; O2: je |
| 145 | |
| 146 ; ERRORS-NOT: ICE translation error | |
| OLD | NEW |