1 ; RUN: llc -mcpu=pwr7 -verify-machineinstrs \
2 ; RUN: -mtriple=powerpc-unknown-aix < %s | FileCheck %s
4 ; RUN: llc -mcpu=pwr7 -verify-machineinstrs \
5 ; RUN: -mtriple=powerpc64-unknown-aix < %s | FileCheck %s
7 ; RUN: llc -mcpu=pwr7 -verify-machineinstrs -no-integrated-as \
8 ; RUN: -mtriple=powerpc64-unknown-aix < %s | FileCheck %s --check-prefix=NOIS
11 ; Function Attrs: noinline nounwind optnone uwtable
12 define dso_local signext i32 @NoBarrier_CompareAndSwap(i32* %ptr, i32 signext %old_value, i32 signext %new_value) #0 {
13 ; CHECK-LABEL: NoBarrier_CompareAndSwap:
15 ; CHECK-NEXT: L..tmp0:
16 ; CHECK-NEXT: lwarx 6, 0, 3
17 ; CHECK-NEXT: cmpw 4, 6
18 ; CHECK-NEXT: bne- 0, L..tmp1
19 ; CHECK-NEXT: stwcx. 5, 0, 3
20 ; CHECK-NEXT: bne- 0, L..tmp0
21 ; CHECK-NEXT: L..tmp1:
23 ; NOIS-LABEL: NoBarrier_CompareAndSwap:
25 ; NOIS-NEXT: 1: lwarx 6, 0, 3
26 ; NOIS-NEXT: cmpw 4, 6
28 ; NOIS-NEXT: stwcx. 5, 0, 3
33 %ptr.addr = alloca i32*, align 8 %old_value.addr = alloca i32, align 4
34 %new_value.addr = alloca i32, align 4
35 %result = alloca i32, align 4
36 store i32* %ptr, i32** %ptr.addr, align 8
37 store i32 %old_value, i32* %old_value.addr, align 4
38 store i32 %new_value, i32* %new_value.addr, align 4
39 %0 = load i32*, i32** %ptr.addr, align 8
40 %1 = load i32, i32* %old_value.addr, align 4
41 %2 = load i32, i32* %new_value.addr, align 4
42 %3 = call i32 asm sideeffect "1: lwarx $0, $4, $1 \0A\09 cmpw $2, $0 \0A\09 bne- 2f \0A\09 stwcx. $3, $4, $1 \0A\09 bne- 1b \0A\092: \0A\09", "=&b,b,b,b,i,~{cr0},~{ctr}"(i32* %0, i32 %1, i32 %2, i32 0)
43 store i32 %3, i32* %result, align 4
44 %4 = load i32, i32* %result, align 4