1 ; RUN: llc < %s -mtriple=armv7-apple-ios -verify-machineinstrs | FileCheck %s
3 define void @test_cmpxchg_weak(i32 *%addr, i32 %desired, i32 %new) {
4 ; CHECK-LABEL: test_cmpxchg_weak:
6 %pair = cmpxchg weak i32* %addr, i32 %desired, i32 %new seq_cst monotonic
7 %oldval = extractvalue { i32, i1 } %pair, 0
9 ; CHECK-NEXT: ldrex [[LOADED:r[0-9]+]], [r0]
10 ; CHECK-NEXT: cmp [[LOADED]], r1
11 ; CHECK-NEXT: bne [[LDFAILBB:LBB[0-9]+_[0-9]+]]
14 ; CHECK-NEXT: strex [[SUCCESS:r[0-9]+]], r2, [r0]
15 ; CHECK-NEXT: cmp [[SUCCESS]], #0
16 ; CHECK-NEXT: beq [[SUCCESSBB:LBB[0-9]+_[0-9]+]]
18 ; CHECK-NEXT: str r3, [r0]
20 ; CHECK-NEXT: [[LDFAILBB]]:
22 ; CHECK-NEXT: str r3, [r0]
24 ; CHECK-NEXT: [[SUCCESSBB]]:
26 ; CHECK-NEXT: str r3, [r0]
29 store i32 %oldval, i32* %addr
34 define i1 @test_cmpxchg_weak_to_bool(i32, i32 *%addr, i32 %desired, i32 %new) {
35 ; CHECK-LABEL: test_cmpxchg_weak_to_bool:
37 %pair = cmpxchg weak i32* %addr, i32 %desired, i32 %new seq_cst monotonic
38 %success = extractvalue { i32, i1 } %pair, 1
41 ; CHECK-NEXT: ldrex [[LOADED:r[0-9]+]], [r1]
42 ; CHECK-NEXT: cmp [[LOADED]], r2
43 ; CHECK-NEXT: bne [[LDFAILBB:LBB[0-9]+_[0-9]+]]
46 ; CHECK-NEXT: mov r0, #0
47 ; CHECK-NEXT: strex [[SUCCESS:r[0-9]+]], r3, [r1]
48 ; CHECK-NEXT: cmp [[SUCCESS]], #0
50 ; CHECK-NEXT: mov r0, #1
53 ; CHECK-NEXT: [[LDFAILBB]]:
54 ; CHECK-NEXT: mov r0, #0