| 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 --assemble --disassemble --args -O2 --verbose none \ | 3 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
| 4 ; RUN: | FileCheck --check-prefix=O2 %s | 4 ; RUN: | FileCheck --check-prefix=O2 %s |
| 5 ; RUN: %p2i -i %s --assemble --disassemble --args -Om1 --verbose none \ | 5 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
| 6 ; RUN: | FileCheck --check-prefix=OM1 %s | 6 ; RUN: | FileCheck --check-prefix=OM1 %s |
| 7 | 7 |
| 8 declare i32 @llvm.nacl.atomic.cmpxchg.i32(i32*, i32, i32, i32, i32) | 8 declare i32 @llvm.nacl.atomic.cmpxchg.i32(i32*, i32, i32, i32, i32) |
| 9 | 9 |
| 10 | 10 |
| 11 ; Test that a cmpxchg followed by icmp eq and branch can be optimized to | 11 ; Test that a cmpxchg followed by icmp eq and branch can be optimized to |
| 12 ; reuse the flags set by the cmpxchg instruction itself. | 12 ; reuse the flags set by the cmpxchg instruction itself. |
| 13 ; This is only expected to work w/ O2, based on lightweight liveness. | 13 ; This is only expected to work w/ O2, based on lightweight liveness. |
| 14 ; (Or if we had other means to detect the only use). | 14 ; (Or if we had other means to detect the only use). |
| 15 declare void @use_value(i32) | 15 declare void @use_value(i32) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 done: | 125 done: |
| 126 %r = zext i1 %success to i32 | 126 %r = zext i1 %success to i32 |
| 127 ret i32 %r | 127 ret i32 %r |
| 128 } | 128 } |
| 129 ; O2-LABEL: test_atomic_cmpxchg_no_opt2 | 129 ; O2-LABEL: test_atomic_cmpxchg_no_opt2 |
| 130 ; O2: lock cmpxchg DWORD PTR [e{{[^a].}}],e{{[^a]}} | 130 ; O2: lock cmpxchg DWORD PTR [e{{[^a].}}],e{{[^a]}} |
| 131 ; O2: mov {{.*}} | 131 ; O2: mov {{.*}} |
| 132 ; O2: cmp | 132 ; O2: cmp |
| 133 ; O2: je | 133 ; O2: je |
| OLD | NEW |