1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
3 ; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK
4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
5 ; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK
6 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
7 ; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-AIX
9 ; Function Attrs: nounwind uwtable
10 define dso_local signext i32 @main() local_unnamed_addr {
12 ; CHECK: # %bb.0: # %entry
13 ; CHECK-NEXT: li 3, -1
15 ; CHECK-NEXT: std 3, -8(1)
16 ; CHECK-NEXT: addi 3, 1, -8
17 ; CHECK-NEXT: .p2align 5
18 ; CHECK-NEXT: .LBB0_1: # %do.body
21 ; CHECK-NEXT: ldarx 5, 0, 3
23 ; CHECK-NEXT: stdcx. 4, 0, 3
24 ; CHECK-NEXT: mfocrf 5, 128
25 ; CHECK-NEXT: srwi 5, 5, 28
26 ; CHECK-NEXT: cmplwi 5, 0
27 ; CHECK-NEXT: beq 0, .LBB0_1
28 ; CHECK-NEXT: # %bb.2: # %do.end
29 ; CHECK-NEXT: ld 3, -8(1)
30 ; CHECK-NEXT: li 4, 55
31 ; CHECK-NEXT: cmpldi 3, 0
32 ; CHECK-NEXT: li 3, 66
33 ; CHECK-NEXT: iseleq 3, 4, 3
36 ; CHECK-AIX-LABEL: main:
37 ; CHECK-AIX: # %bb.0: # %entry
38 ; CHECK-AIX-NEXT: li 3, -1
39 ; CHECK-AIX-NEXT: li 4, 0
40 ; CHECK-AIX-NEXT: std 3, -8(1)
41 ; CHECK-AIX-NEXT: addi 3, 1, -8
42 ; CHECK-AIX-NEXT: .align 5
43 ; CHECK-AIX-NEXT: L..BB0_1: # %do.body
45 ; CHECK-AIX-NEXT: #APP
46 ; CHECK-AIX-NEXT: ldarx 5, 0, 3
47 ; CHECK-AIX-NEXT: #NO_APP
48 ; CHECK-AIX-NEXT: stdcx. 4, 0, 3
49 ; CHECK-AIX-NEXT: mfocrf 5, 128
50 ; CHECK-AIX-NEXT: srwi 5, 5, 28
51 ; CHECK-AIX-NEXT: cmplwi 5, 0
52 ; CHECK-AIX-NEXT: beq 0, L..BB0_1
53 ; CHECK-AIX-NEXT: # %bb.2: # %do.end
54 ; CHECK-AIX-NEXT: ld 3, -8(1)
55 ; CHECK-AIX-NEXT: li 4, 55
56 ; CHECK-AIX-NEXT: cmpldi 3, 0
57 ; CHECK-AIX-NEXT: li 3, 66
58 ; CHECK-AIX-NEXT: iseleq 3, 4, 3
61 %x64 = alloca i64, align 8
62 %0 = bitcast i64* %x64 to i8*
63 call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0)
64 store i64 -1, i64* %x64, align 8
67 do.body: ; preds = %do.body, %entry
68 %1 = call i64 asm sideeffect "ldarx $0, ${1:y}", "=r,*Z,~{memory}"(i64* nonnull %x64)
69 %2 = call i32 @llvm.ppc.stdcx(i8* nonnull %0, i64 0)
70 %tobool.not = icmp eq i32 %2, 0
71 br i1 %tobool.not, label %do.body, label %do.end
73 do.end: ; preds = %do.body
74 %3 = load i64, i64* %x64, align 8
75 %cmp = icmp eq i64 %3, 0
76 %. = select i1 %cmp, i32 55, i32 66
77 call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0)
81 ; Function Attrs: argmemonly mustprogress nofree nosync nounwind willreturn
82 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
84 ; Function Attrs: nounwind writeonly
85 declare i32 @llvm.ppc.stdcx(i8*, i64)
87 ; Function Attrs: argmemonly mustprogress nofree nosync nounwind willreturn
88 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)