• 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 \
4; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl \
5; RUN:  --check-prefixes=CHECK,BE
6; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
7; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
8; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl \
9; RUN:  --check-prefixes=CHECK,LE
10
11@glob = local_unnamed_addr global i64 0, align 8
12
13; Function Attrs: norecurse nounwind readnone
14define i64 @test_llleull(i64 %a, i64 %b) {
15; CHECK-LABEL: test_llleull:
16; CHECK:       # %bb.0: # %entry
17; CHECK-NEXT:    subc r4, r4, r3
18; CHECK-NEXT:    subfe r3, r3, r3
19; CHECK-NEXT:    addi r3, r3, 1
20; CHECK-NEXT:    blr
21entry:
22  %cmp = icmp ule i64 %a, %b
23  %conv1 = zext i1 %cmp to i64
24  ret i64 %conv1
25}
26
27; Function Attrs: norecurse nounwind readnone
28define i64 @test_llleull_sext(i64 %a, i64 %b) {
29; CHECK-LABEL: test_llleull_sext:
30; CHECK:       # %bb.0: # %entry
31; CHECK-NEXT:    subc r4, r4, r3
32; CHECK-NEXT:    subfe r3, r3, r3
33; CHECK-NEXT:    not r3, r3
34; CHECK-NEXT:    blr
35entry:
36  %cmp = icmp ule i64 %a, %b
37  %conv1 = sext i1 %cmp to i64
38  ret i64 %conv1
39}
40
41; Function Attrs: norecurse nounwind readnone
42define i64 @test_llleull_z(i64 %a) {
43; CHECK-LABEL: test_llleull_z:
44; CHECK:       # %bb.0: # %entry
45; CHECK-NEXT:    cntlzd r3, r3
46; CHECK-NEXT:    rldicl r3, r3, 58, 63
47; CHECK-NEXT:    blr
48entry:
49  %cmp = icmp ule i64 %a, 0
50  %conv1 = zext i1 %cmp to i64
51  ret i64 %conv1
52}
53
54; Function Attrs: norecurse nounwind readnone
55define i64 @test_llleull_sext_z(i64 %a) {
56; CHECK-LABEL: test_llleull_sext_z:
57; CHECK:       # %bb.0: # %entry
58; CHECK-NEXT:    addic r3, r3, -1
59; CHECK-NEXT:    subfe r3, r3, r3
60; CHECK-NEXT:    blr
61entry:
62  %cmp = icmp ule i64 %a, 0
63  %conv1 = sext i1 %cmp to i64
64  ret i64 %conv1
65}
66
67; Function Attrs: norecurse nounwind
68define void @test_llleull_store(i64 %a, i64 %b) {
69; BE-LABEL: test_llleull_store:
70; BE:       # %bb.0: # %entry
71; BE-NEXT:    addis r5, r2, .LC0@toc@ha
72; BE-NEXT:    subc r4, r4, r3
73; BE-NEXT:    ld r4, .LC0@toc@l(r5)
74; BE-NEXT:    subfe r3, r3, r3
75; BE-NEXT:    addi r3, r3, 1
76; BE-NEXT:    std r3, 0(r4)
77; BE-NEXT:    blr
78;
79; LE-LABEL: test_llleull_store:
80; LE:       # %bb.0: # %entry
81; LE-NEXT:    subc r4, r4, r3
82; LE-NEXT:    addis r5, r2, glob@toc@ha
83; LE-NEXT:    subfe r3, r3, r3
84; LE-NEXT:    addi r3, r3, 1
85; LE-NEXT:    std r3, glob@toc@l(r5)
86; LE-NEXT:    blr
87entry:
88  %cmp = icmp ule i64 %a, %b
89  %conv1 = zext i1 %cmp to i64
90  store i64 %conv1, i64* @glob
91  ret void
92}
93
94; Function Attrs: norecurse nounwind
95define void @test_llleull_sext_store(i64 %a, i64 %b) {
96; BE-LABEL: test_llleull_sext_store:
97; BE:       # %bb.0: # %entry
98; BE-NEXT:    addis r5, r2, .LC0@toc@ha
99; BE-NEXT:    subc r4, r4, r3
100; BE-NEXT:    ld r4, .LC0@toc@l(r5)
101; BE-NEXT:    subfe r3, r3, r3
102; BE-NEXT:    not r3, r3
103; BE-NEXT:    std r3, 0(r4)
104; BE-NEXT:    blr
105;
106; LE-LABEL: test_llleull_sext_store:
107; LE:       # %bb.0: # %entry
108; LE-NEXT:    subc r4, r4, r3
109; LE-NEXT:    addis r5, r2, glob@toc@ha
110; LE-NEXT:    subfe r3, r3, r3
111; LE-NEXT:    not r3, r3
112; LE-NEXT:    std r3, glob@toc@l(r5)
113; LE-NEXT:    blr
114entry:
115  %cmp = icmp ule i64 %a, %b
116  %conv1 = sext i1 %cmp to i64
117  store i64 %conv1, i64* @glob
118  ret void
119}
120
121; Function Attrs: norecurse nounwind
122define void @test_llleull_z_store(i64 %a) {
123; BE-LABEL: test_llleull_z_store:
124; BE:       # %bb.0: # %entry
125; BE-NEXT:    addis r4, r2, .LC0@toc@ha
126; BE-NEXT:    cntlzd r3, r3
127; BE-NEXT:    ld r4, .LC0@toc@l(r4)
128; BE-NEXT:    rldicl r3, r3, 58, 63
129; BE-NEXT:    std r3, 0(r4)
130; BE-NEXT:    blr
131;
132; LE-LABEL: test_llleull_z_store:
133; LE:       # %bb.0: # %entry
134; LE-NEXT:    cntlzd r3, r3
135; LE-NEXT:    addis r4, r2, glob@toc@ha
136; LE-NEXT:    rldicl r3, r3, 58, 63
137; LE-NEXT:    std r3, glob@toc@l(r4)
138; LE-NEXT:    blr
139entry:
140  %cmp = icmp ule i64 %a, 0
141  %conv1 = zext i1 %cmp to i64
142  store i64 %conv1, i64* @glob
143  ret void
144}
145
146; Function Attrs: norecurse nounwind
147define void @test_llleull_sext_z_store(i64 %a) {
148; BE-LABEL: test_llleull_sext_z_store:
149; BE:       # %bb.0: # %entry
150; BE-NEXT:    addis r4, r2, .LC0@toc@ha
151; BE-NEXT:    addic r3, r3, -1
152; BE-NEXT:    ld r4, .LC0@toc@l(r4)
153; BE-NEXT:    subfe r3, r3, r3
154; BE-NEXT:    std r3, 0(r4)
155; BE-NEXT:    blr
156;
157; LE-LABEL: test_llleull_sext_z_store:
158; LE:       # %bb.0: # %entry
159; LE-NEXT:    addic r3, r3, -1
160; LE-NEXT:    addis r4, r2, glob@toc@ha
161; LE-NEXT:    subfe r3, r3, r3
162; LE-NEXT:    std r3, glob@toc@l(r4)
163; LE-NEXT:    blr
164entry:
165  %cmp = icmp ule i64 %a, 0
166  %conv1 = sext i1 %cmp to i64
167  store i64 %conv1, i64* @glob
168  ret void
169}
170
171