• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
3; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-BE \
4; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
5; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
6; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-LE \
7; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
8
9@glob = local_unnamed_addr global i32 0, align 4
10
11; Function Attrs: norecurse nounwind readnone
12define i64 @test_llequi(i32 zeroext %a, i32 zeroext %b) {
13; CHECK-LABEL: test_llequi:
14; CHECK:       # %bb.0: # %entry
15; CHECK-NEXT:    xor r3, r3, r4
16; CHECK-NEXT:    cntlzw r3, r3
17; CHECK-NEXT:    srwi r3, r3, 5
18; CHECK-NEXT:    blr
19; CHECK-BE-LABEL: test_llequi:
20; CHECK-BE:       # %bb.0: # %entry
21; CHECK-BE-NEXT:    xor r3, r3, r4
22; CHECK-BE-NEXT:    cntlzw r3, r3
23; CHECK-BE-NEXT:    srwi r3, r3, 5
24; CHECK-BE-NEXT:    blr
25;
26; CHECK-LE-LABEL: test_llequi:
27; CHECK-LE:       # %bb.0: # %entry
28; CHECK-LE-NEXT:    xor r3, r3, r4
29; CHECK-LE-NEXT:    cntlzw r3, r3
30; CHECK-LE-NEXT:    srwi r3, r3, 5
31; CHECK-LE-NEXT:    blr
32entry:
33  %cmp = icmp eq i32 %a, %b
34  %conv1 = zext i1 %cmp to i64
35  ret i64 %conv1
36}
37
38; Function Attrs: norecurse nounwind readnone
39define i64 @test_llequi_sext(i32 zeroext %a, i32 zeroext %b) {
40; CHECK-LABEL: test_llequi_sext:
41; CHECK:       # %bb.0: # %entry
42; CHECK-NEXT:    xor r3, r3, r4
43; CHECK-NEXT:    cntlzw r3, r3
44; CHECK-NEXT:    srwi r3, r3, 5
45; CHECK-NEXT:    neg r3, r3
46; CHECK-NEXT:    blr
47; CHECK-BE-LABEL: test_llequi_sext:
48; CHECK-BE:       # %bb.0: # %entry
49; CHECK-BE-NEXT:    xor r3, r3, r4
50; CHECK-BE-NEXT:    cntlzw r3, r3
51; CHECK-BE-NEXT:    srwi r3, r3, 5
52; CHECK-BE-NEXT:    neg r3, r3
53; CHECK-BE-NEXT:    blr
54;
55; CHECK-LE-LABEL: test_llequi_sext:
56; CHECK-LE:       # %bb.0: # %entry
57; CHECK-LE-NEXT:    xor r3, r3, r4
58; CHECK-LE-NEXT:    cntlzw r3, r3
59; CHECK-LE-NEXT:    srwi r3, r3, 5
60; CHECK-LE-NEXT:    neg r3, r3
61; CHECK-LE-NEXT:    blr
62entry:
63  %cmp = icmp eq i32 %a, %b
64  %conv1 = sext i1 %cmp to i64
65  ret i64 %conv1
66}
67
68; Function Attrs: norecurse nounwind readnone
69define i64 @test_llequi_z(i32 zeroext %a) {
70; CHECK-LABEL: test_llequi_z:
71; CHECK:       # %bb.0: # %entry
72; CHECK-NEXT:    cntlzw r3, r3
73; CHECK-NEXT:    srwi r3, r3, 5
74; CHECK-NEXT:    blr
75; CHECK-BE-LABEL: test_llequi_z:
76; CHECK-BE:       # %bb.0: # %entry
77; CHECK-BE-NEXT:    cntlzw r3, r3
78; CHECK-BE-NEXT:    srwi r3, r3, 5
79; CHECK-BE-NEXT:    blr
80;
81; CHECK-LE-LABEL: test_llequi_z:
82; CHECK-LE:       # %bb.0: # %entry
83; CHECK-LE-NEXT:    cntlzw r3, r3
84; CHECK-LE-NEXT:    srwi r3, r3, 5
85; CHECK-LE-NEXT:    blr
86entry:
87  %cmp = icmp eq i32 %a, 0
88  %conv1 = zext i1 %cmp to i64
89  ret i64 %conv1
90}
91
92; Function Attrs: norecurse nounwind readnone
93define i64 @test_llequi_sext_z(i32 zeroext %a) {
94; CHECK-LABEL: test_llequi_sext_z:
95; CHECK:       # %bb.0: # %entry
96; CHECK-NEXT:    cntlzw r3, r3
97; CHECK-NEXT:    srwi r3, r3, 5
98; CHECK-NEXT:    neg r3, r3
99; CHECK-NEXT:    blr
100; CHECK-BE-LABEL: test_llequi_sext_z:
101; CHECK-BE:       # %bb.0: # %entry
102; CHECK-BE-NEXT:    cntlzw r3, r3
103; CHECK-BE-NEXT:    srwi r3, r3, 5
104; CHECK-BE-NEXT:    neg r3, r3
105; CHECK-BE-NEXT:    blr
106;
107; CHECK-LE-LABEL: test_llequi_sext_z:
108; CHECK-LE:       # %bb.0: # %entry
109; CHECK-LE-NEXT:    cntlzw r3, r3
110; CHECK-LE-NEXT:    srwi r3, r3, 5
111; CHECK-LE-NEXT:    neg r3, r3
112; CHECK-LE-NEXT:    blr
113entry:
114  %cmp = icmp eq i32 %a, 0
115  %conv1 = sext i1 %cmp to i64
116  ret i64 %conv1
117}
118
119; Function Attrs: norecurse nounwind
120define void @test_llequi_store(i32 zeroext %a, i32 zeroext %b) {
121; CHECK-LABEL: test_llequi_store:
122; CHECK:       # %bb.0: # %entry
123; CHECK-NEXT:    xor r3, r3, r4
124; CHECK-NEXT:    addis r5, r2, glob@toc@ha
125; CHECK-NEXT:    cntlzw r3, r3
126; CHECK-NEXT:    srwi r3, r3, 5
127; CHECK-NEXT:    stw r3, glob@toc@l(r5)
128; CHECK-NEXT:    blr
129; CHECK-BE-LABEL: test_llequi_store:
130; CHECK-BE:       # %bb.0: # %entry
131; CHECK-BE-NEXT:    addis r5, r2, .LC0@toc@ha
132; CHECK-BE-NEXT:    xor r3, r3, r4
133; CHECK-BE-NEXT:    ld r4, .LC0@toc@l(r5)
134; CHECK-BE-NEXT:    cntlzw r3, r3
135; CHECK-BE-NEXT:    srwi r3, r3, 5
136; CHECK-BE-NEXT:    stw r3, 0(r4)
137; CHECK-BE-NEXT:    blr
138;
139; CHECK-LE-LABEL: test_llequi_store:
140; CHECK-LE:       # %bb.0: # %entry
141; CHECK-LE-NEXT:    xor r3, r3, r4
142; CHECK-LE-NEXT:    addis r5, r2, glob@toc@ha
143; CHECK-LE-NEXT:    cntlzw r3, r3
144; CHECK-LE-NEXT:    srwi r3, r3, 5
145; CHECK-LE-NEXT:    stw r3, glob@toc@l(r5)
146; CHECK-LE-NEXT:    blr
147entry:
148  %cmp = icmp eq i32 %a, %b
149  %conv = zext i1 %cmp to i32
150  store i32 %conv, i32* @glob, align 4
151  ret void
152}
153
154; Function Attrs: norecurse nounwind
155define void @test_llequi_sext_store(i32 zeroext %a, i32 zeroext %b) {
156; CHECK-LABEL: test_llequi_sext_store:
157; CHECK:       # %bb.0: # %entry
158; CHECK-NEXT:    xor r3, r3, r4
159; CHECK-NEXT:    addis r5, r2, glob@toc@ha
160; CHECK-NEXT:    cntlzw r3, r3
161; CHECK-NEXT:    srwi r3, r3, 5
162; CHECK-NEXT:    neg r3, r3
163; CHECK-NEXT:    stw r3, glob@toc@l(r5)
164; CHECK-NEXT:    blr
165; CHECK-BE-LABEL: test_llequi_sext_store:
166; CHECK-BE:       # %bb.0: # %entry
167; CHECK-BE-NEXT:    addis r5, r2, .LC0@toc@ha
168; CHECK-BE-NEXT:    xor r3, r3, r4
169; CHECK-BE-NEXT:    cntlzw r3, r3
170; CHECK-BE-NEXT:    ld r4, .LC0@toc@l(r5)
171; CHECK-BE-NEXT:    srwi r3, r3, 5
172; CHECK-BE-NEXT:    neg r3, r3
173; CHECK-BE-NEXT:    stw r3, 0(r4)
174; CHECK-BE-NEXT:    blr
175;
176; CHECK-LE-LABEL: test_llequi_sext_store:
177; CHECK-LE:       # %bb.0: # %entry
178; CHECK-LE-NEXT:    xor r3, r3, r4
179; CHECK-LE-NEXT:    addis r5, r2, glob@toc@ha
180; CHECK-LE-NEXT:    cntlzw r3, r3
181; CHECK-LE-NEXT:    srwi r3, r3, 5
182; CHECK-LE-NEXT:    neg r3, r3
183; CHECK-LE-NEXT:    stw r3, glob@toc@l(r5)
184; CHECK-LE-NEXT:    blr
185entry:
186  %cmp = icmp eq i32 %a, %b
187  %sub = sext i1 %cmp to i32
188  store i32 %sub, i32* @glob, align 4
189  ret void
190}
191
192; Function Attrs: norecurse nounwind
193define void @test_llequi_z_store(i32 zeroext %a) {
194; CHECK-LABEL: test_llequi_z_store:
195; CHECK:       # %bb.0: # %entry
196; CHECK-NEXT:    cntlzw r3, r3
197; CHECK-NEXT:    addis r4, r2, glob@toc@ha
198; CHECK-NEXT:    srwi r3, r3, 5
199; CHECK-NEXT:    stw r3, glob@toc@l(r4)
200; CHECK-NEXT:    blr
201; CHECK-BE-LABEL: test_llequi_z_store:
202; CHECK-BE:       # %bb.0: # %entry
203; CHECK-BE-NEXT:    addis r4, r2, .LC0@toc@ha
204; CHECK-BE-NEXT:    cntlzw r3, r3
205; CHECK-BE-NEXT:    ld r4, .LC0@toc@l(r4)
206; CHECK-BE-NEXT:    srwi r3, r3, 5
207; CHECK-BE-NEXT:    stw r3, 0(r4)
208; CHECK-BE-NEXT:    blr
209;
210; CHECK-LE-LABEL: test_llequi_z_store:
211; CHECK-LE:       # %bb.0: # %entry
212; CHECK-LE-NEXT:    cntlzw r3, r3
213; CHECK-LE-NEXT:    addis r4, r2, glob@toc@ha
214; CHECK-LE-NEXT:    srwi r3, r3, 5
215; CHECK-LE-NEXT:    stw r3, glob@toc@l(r4)
216; CHECK-LE-NEXT:    blr
217entry:
218  %cmp = icmp eq i32 %a, 0
219  %conv = zext i1 %cmp to i32
220  store i32 %conv, i32* @glob, align 4
221  ret void
222}
223
224; Function Attrs: norecurse nounwind
225define void @test_llequi_sext_z_store(i32 zeroext %a) {
226; CHECK-LABEL: test_llequi_sext_z_store:
227; CHECK:       # %bb.0: # %entry
228; CHECK-NEXT:    cntlzw r3, r3
229; CHECK-NEXT:    addis r4, r2, glob@toc@ha
230; CHECK-NEXT:    srwi r3, r3, 5
231; CHECK-NEXT:    neg r3, r3
232; CHECK-NEXT:    stw r3, glob@toc@l(r4)
233; CHECK-NEXT:    blr
234; CHECK-BE-LABEL: test_llequi_sext_z_store:
235; CHECK-BE:       # %bb.0: # %entry
236; CHECK-BE-NEXT:    addis r4, r2, .LC0@toc@ha
237; CHECK-BE-NEXT:    cntlzw r3, r3
238; CHECK-BE-NEXT:    ld r4, .LC0@toc@l(r4)
239; CHECK-BE-NEXT:    srwi r3, r3, 5
240; CHECK-BE-NEXT:    neg r3, r3
241; CHECK-BE-NEXT:    stw r3, 0(r4)
242; CHECK-BE-NEXT:    blr
243;
244; CHECK-LE-LABEL: test_llequi_sext_z_store:
245; CHECK-LE:       # %bb.0: # %entry
246; CHECK-LE-NEXT:    cntlzw r3, r3
247; CHECK-LE-NEXT:    addis r4, r2, glob@toc@ha
248; CHECK-LE-NEXT:    srwi r3, r3, 5
249; CHECK-LE-NEXT:    neg r3, r3
250; CHECK-LE-NEXT:    stw r3, glob@toc@l(r4)
251; CHECK-LE-NEXT:    blr
252entry:
253  %cmp = icmp eq i32 %a, 0
254  %sub = sext i1 %cmp to i32
255  store i32 %sub, i32* @glob, align 4
256  ret void
257}
258