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
10 ; CHECK-NEXT: ldrex [[LOADED:r[0-9]+]], [r0]
11 ; CHECK-NEXT: cmp [[LOADED]], r1
12 ; 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: bne [[FAILBB:LBB[0-9]+_[0-9]+]]
19 ; CHECK-NEXT: str r3, [r0]
21 ; CHECK-NEXT: [[LDFAILBB]]:
23 ; CHECK-NEXT: [[FAILBB]]:
24 ; CHECK-NEXT: str r3, [r0]
27 store i32 %oldval, i32* %addr
32 define i1 @test_cmpxchg_weak_to_bool(i32, i32 *%addr, i32 %desired, i32 %new) {
33 ; CHECK-LABEL: test_cmpxchg_weak_to_bool:
35 %pair = cmpxchg weak i32* %addr, i32 %desired, i32 %new seq_cst monotonic
36 %success = extractvalue { i32, i1 } %pair, 1
40 ; CHECK-NEXT: ldrex [[LOADED:r[0-9]+]], [r1]
41 ; CHECK-NEXT: cmp [[LOADED]], r2
42 ; CHECK-NEXT: bne [[LDFAILBB:LBB[0-9]+_[0-9]+]]
44 ; CHECK-NEXT: strex [[SUCCESS:r[0-9]+]], r3, [r1]
45 ; CHECK-NEXT: mov r0, #0
46 ; CHECK-NEXT: cmp [[SUCCESS]], #0
49 ; CHECK-NEXT: mov r0, #1
51 ; CHECK-NEXT: [[LDFAILBB]]:
53 ; CHECK-NEXT: mov r0, #0