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-aix \
5 ; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-AIX
7 define dso_local zeroext i8 @test1(ptr noundef %addr, i8 noundef zeroext %newval) local_unnamed_addr #0 {
9 ; CHECK: # %bb.0: # %entry
10 ; CHECK-NEXT: stbcx. 4, 0, 3
11 ; CHECK-NEXT: bne 0, .LBB0_2
12 ; CHECK-NEXT: # %bb.1: # %if.then
14 ; CHECK-NEXT: stdu 1, -32(1)
15 ; CHECK-NEXT: std 0, 48(1)
16 ; CHECK-NEXT: .cfi_def_cfa_offset 32
17 ; CHECK-NEXT: .cfi_offset lr, 16
18 ; CHECK-NEXT: bl dummy
20 ; CHECK-NEXT: addi 1, 1, 32
21 ; CHECK-NEXT: ld 0, 16(1)
23 ; CHECK-NEXT: .LBB0_2: # %if.end
24 ; CHECK-NEXT: li 3, 55
27 ; CHECK-AIX-LABEL: test1:
28 ; CHECK-AIX: # %bb.0: # %entry
29 ; CHECK-AIX-NEXT: stbcx. 4, 0, 3
30 ; CHECK-AIX-NEXT: bne 0, L..BB0_2
31 ; CHECK-AIX-NEXT: # %bb.1: # %if.then
32 ; CHECK-AIX-NEXT: mflr 0
33 ; CHECK-AIX-NEXT: stdu 1, -112(1)
34 ; CHECK-AIX-NEXT: std 0, 128(1)
35 ; CHECK-AIX-NEXT: bl .dummy[PR]
37 ; CHECK-AIX-NEXT: addi 1, 1, 112
38 ; CHECK-AIX-NEXT: ld 0, 16(1)
39 ; CHECK-AIX-NEXT: mtlr 0
40 ; CHECK-AIX-NEXT: L..BB0_2: # %if.end
41 ; CHECK-AIX-NEXT: li 3, 55
44 %conv = zext i8 %newval to i32
45 %0 = tail call i32 @llvm.ppc.stbcx(ptr %addr, i32 %conv)
46 %tobool.not = icmp eq i32 %0, 0
47 br i1 %tobool.not, label %if.end, label %if.then
49 if.then: ; preds = %entry
50 tail call void @dummy() #3
53 if.end: ; preds = %if.then, %entry
57 define dso_local signext i16 @test2(ptr noundef %addr, i16 noundef signext %newval) local_unnamed_addr #0 {
59 ; CHECK: # %bb.0: # %entry
60 ; CHECK-NEXT: sthcx. 4, 0, 3
61 ; CHECK-NEXT: bne 0, .LBB1_2
62 ; CHECK-NEXT: # %bb.1: # %if.then
64 ; CHECK-NEXT: stdu 1, -32(1)
65 ; CHECK-NEXT: std 0, 48(1)
66 ; CHECK-NEXT: .cfi_def_cfa_offset 32
67 ; CHECK-NEXT: .cfi_offset lr, 16
68 ; CHECK-NEXT: bl dummy
70 ; CHECK-NEXT: addi 1, 1, 32
71 ; CHECK-NEXT: ld 0, 16(1)
73 ; CHECK-NEXT: .LBB1_2: # %if.end
74 ; CHECK-NEXT: li 3, 55
77 ; CHECK-AIX-LABEL: test2:
78 ; CHECK-AIX: # %bb.0: # %entry
79 ; CHECK-AIX-NEXT: sthcx. 4, 0, 3
80 ; CHECK-AIX-NEXT: bne 0, L..BB1_2
81 ; CHECK-AIX-NEXT: # %bb.1: # %if.then
82 ; CHECK-AIX-NEXT: mflr 0
83 ; CHECK-AIX-NEXT: stdu 1, -112(1)
84 ; CHECK-AIX-NEXT: std 0, 128(1)
85 ; CHECK-AIX-NEXT: bl .dummy[PR]
87 ; CHECK-AIX-NEXT: addi 1, 1, 112
88 ; CHECK-AIX-NEXT: ld 0, 16(1)
89 ; CHECK-AIX-NEXT: mtlr 0
90 ; CHECK-AIX-NEXT: L..BB1_2: # %if.end
91 ; CHECK-AIX-NEXT: li 3, 55
94 %0 = sext i16 %newval to i32
95 %1 = tail call i32 @llvm.ppc.sthcx(ptr %addr, i32 %0)
96 %tobool.not = icmp eq i32 %1, 0
97 br i1 %tobool.not, label %if.end, label %if.then
99 if.then: ; preds = %entry
100 tail call void @dummy() #3
103 if.end: ; preds = %if.then, %entry
107 define dso_local signext i32 @test3(ptr noundef %addr, i32 noundef signext %newval) local_unnamed_addr #0 {
108 ; CHECK-LABEL: test3:
109 ; CHECK: # %bb.0: # %entry
110 ; CHECK-NEXT: stwcx. 4, 0, 3
111 ; CHECK-NEXT: bne 0, .LBB2_2
112 ; CHECK-NEXT: # %bb.1: # %if.then
114 ; CHECK-NEXT: stdu 1, -32(1)
115 ; CHECK-NEXT: std 0, 48(1)
116 ; CHECK-NEXT: .cfi_def_cfa_offset 32
117 ; CHECK-NEXT: .cfi_offset lr, 16
118 ; CHECK-NEXT: bl dummy
120 ; CHECK-NEXT: addi 1, 1, 32
121 ; CHECK-NEXT: ld 0, 16(1)
123 ; CHECK-NEXT: .LBB2_2: # %if.end
124 ; CHECK-NEXT: li 3, 55
127 ; CHECK-AIX-LABEL: test3:
128 ; CHECK-AIX: # %bb.0: # %entry
129 ; CHECK-AIX-NEXT: stwcx. 4, 0, 3
130 ; CHECK-AIX-NEXT: bne 0, L..BB2_2
131 ; CHECK-AIX-NEXT: # %bb.1: # %if.then
132 ; CHECK-AIX-NEXT: mflr 0
133 ; CHECK-AIX-NEXT: stdu 1, -112(1)
134 ; CHECK-AIX-NEXT: std 0, 128(1)
135 ; CHECK-AIX-NEXT: bl .dummy[PR]
136 ; CHECK-AIX-NEXT: nop
137 ; CHECK-AIX-NEXT: addi 1, 1, 112
138 ; CHECK-AIX-NEXT: ld 0, 16(1)
139 ; CHECK-AIX-NEXT: mtlr 0
140 ; CHECK-AIX-NEXT: L..BB2_2: # %if.end
141 ; CHECK-AIX-NEXT: li 3, 55
142 ; CHECK-AIX-NEXT: blr
144 %0 = tail call i32 @llvm.ppc.stwcx(ptr %addr, i32 %newval)
145 %tobool.not = icmp eq i32 %0, 0
146 br i1 %tobool.not, label %if.end, label %if.then
148 if.then: ; preds = %entry
149 tail call void @dummy() #3
152 if.end: ; preds = %if.then, %entry
156 define dso_local i64 @test4(ptr noundef %addr, i64 noundef %newval) local_unnamed_addr #0 {
157 ; CHECK-LABEL: test4:
158 ; CHECK: # %bb.0: # %entry
159 ; CHECK-NEXT: stdcx. 4, 0, 3
160 ; CHECK-NEXT: bne 0, .LBB3_2
161 ; CHECK-NEXT: # %bb.1: # %if.then
163 ; CHECK-NEXT: stdu 1, -32(1)
164 ; CHECK-NEXT: std 0, 48(1)
165 ; CHECK-NEXT: .cfi_def_cfa_offset 32
166 ; CHECK-NEXT: .cfi_offset lr, 16
167 ; CHECK-NEXT: bl dummy
169 ; CHECK-NEXT: addi 1, 1, 32
170 ; CHECK-NEXT: ld 0, 16(1)
172 ; CHECK-NEXT: .LBB3_2: # %if.end
173 ; CHECK-NEXT: li 3, 55
176 ; CHECK-AIX-LABEL: test4:
177 ; CHECK-AIX: # %bb.0: # %entry
178 ; CHECK-AIX-NEXT: stdcx. 4, 0, 3
179 ; CHECK-AIX-NEXT: bne 0, L..BB3_2
180 ; CHECK-AIX-NEXT: # %bb.1: # %if.then
181 ; CHECK-AIX-NEXT: mflr 0
182 ; CHECK-AIX-NEXT: stdu 1, -112(1)
183 ; CHECK-AIX-NEXT: std 0, 128(1)
184 ; CHECK-AIX-NEXT: bl .dummy[PR]
185 ; CHECK-AIX-NEXT: nop
186 ; CHECK-AIX-NEXT: addi 1, 1, 112
187 ; CHECK-AIX-NEXT: ld 0, 16(1)
188 ; CHECK-AIX-NEXT: mtlr 0
189 ; CHECK-AIX-NEXT: L..BB3_2: # %if.end
190 ; CHECK-AIX-NEXT: li 3, 55
191 ; CHECK-AIX-NEXT: blr
193 %0 = tail call i32 @llvm.ppc.stdcx(ptr %addr, i64 %newval)
194 %tobool.not = icmp eq i32 %0, 0
195 br i1 %tobool.not, label %if.end, label %if.then
197 if.then: ; preds = %entry
198 tail call void @dummy() #3
201 if.end: ; preds = %if.then, %entry
205 declare i32 @llvm.ppc.stbcx(ptr, i32) #1
206 declare i32 @llvm.ppc.sthcx(ptr, i32) #1
207 declare i32 @llvm.ppc.stwcx(ptr, i32) #1
208 declare i32 @llvm.ppc.stdcx(ptr, i64) #1
209 declare void @dummy(...) local_unnamed_addr #2