1 ; RUN: llc < %s -mtriple=armv7-apple-ios -verify-machineinstrs | FileCheck %s
3 define void @test_cmpxchg_weak(ptr %addr, i32 %desired, i32 %new) {
4 ; CHECK-LABEL: test_cmpxchg_weak:
6 ; CHECK-NEXT: ldrex [[LOADED:r[0-9]+]], [r0]
7 ; CHECK-NEXT: cmp [[LOADED]], r1
8 ; CHECK-NEXT: bne [[LDFAILBB:LBB[0-9]+_[0-9]+]]
11 ; CHECK-NEXT: strex [[SUCCESS:r[0-9]+]], r2, [r0]
12 ; CHECK-NEXT: cmp [[SUCCESS]], #0
13 ; CHECK-NEXT: beq [[SUCCESSBB:LBB[0-9]+_[0-9]+]]
15 ; CHECK-NEXT: str r3, [r0]
17 ; CHECK-NEXT: [[LDFAILBB]]:
19 ; CHECK-NEXT: str r3, [r0]
21 ; CHECK-NEXT: [[SUCCESSBB]]:
23 ; CHECK-NEXT: str r3, [r0]
26 %pair = cmpxchg weak ptr %addr, i32 %desired, i32 %new seq_cst monotonic
27 %oldval = extractvalue { i32, i1 } %pair, 0
28 store i32 %oldval, ptr %addr
32 define i1 @test_cmpxchg_weak_to_bool(i32, ptr %addr, i32 %desired, i32 %new) {
33 ; CHECK-LABEL: test_cmpxchg_weak_to_bool:
35 ; CHECK-NEXT: ldrex [[LOADED:r[0-9]+]], [r1]
36 ; CHECK-NEXT: cmp [[LOADED]], r2
37 ; CHECK-NEXT: bne [[LDFAILBB:LBB[0-9]+_[0-9]+]]
40 ; CHECK-NEXT: mov r0, #0
41 ; CHECK-NEXT: strex [[SUCCESS:r[0-9]+]], r3, [r1]
42 ; CHECK-NEXT: cmp [[SUCCESS]], #0
45 ; CHECK-NEXT: mov r0, #1
48 ; CHECK-NEXT: [[LDFAILBB]]:
49 ; CHECK-NEXT: mov r0, #0
53 %pair = cmpxchg weak ptr %addr, i32 %desired, i32 %new seq_cst monotonic
54 %success = extractvalue { i32, i1 } %pair, 1