1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -relocation-model=pic -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 -relocation-model=pic -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 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
11 ; RUN: -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \
12 ; RUN: FileCheck %s --check-prefixes=CHECK-P10,CHECK-P10-LE
13 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
14 ; RUN: -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \
15 ; RUN: FileCheck %s --check-prefixes=CHECK-P10,CHECK-P10-BE
16 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
17 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \
18 ; RUN: FileCheck %s --check-prefixes=CHECK-P10-CMP,CHECK-P10-CMP-LE \
19 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd \
20 ; RUN: --implicit-check-not cmpl
21 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
22 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \
23 ; RUN: FileCheck %s --check-prefixes=CHECK-P10-CMP,CHECK-P10-CMP-BE \
24 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd \
25 ; RUN: --implicit-check-not cmpl
27 %struct.tree_common = type { i8, [3 x i8] }
28 declare signext i32 @fn2(...) local_unnamed_addr #1
30 ; Function Attrs: nounwind
31 define dso_local i32 @testCompare1(%struct.tree_common* nocapture readonly %arg1) nounwind {
32 ; BE-LABEL: testCompare1:
33 ; BE: # %bb.0: # %entry
35 ; BE-NEXT: std r0, 16(r1)
36 ; BE-NEXT: stdu r1, -112(r1)
37 ; BE-NEXT: addis r4, r2, testCompare1@toc@ha
38 ; BE-NEXT: lbz r3, 0(r3)
39 ; BE-NEXT: lbz r4, testCompare1@toc@l(r4)
40 ; BE-NEXT: clrlwi r3, r3, 31
41 ; BE-NEXT: clrlwi r4, r4, 31
42 ; BE-NEXT: clrldi r3, r3, 32
43 ; BE-NEXT: clrldi r4, r4, 32
44 ; BE-NEXT: sub r3, r4, r3
45 ; BE-NEXT: rldicl r3, r3, 1, 63
48 ; BE-NEXT: addi r1, r1, 112
49 ; BE-NEXT: ld r0, 16(r1)
53 ; LE-LABEL: testCompare1:
54 ; LE: # %bb.0: # %entry
56 ; LE-NEXT: std r0, 16(r1)
57 ; LE-NEXT: stdu r1, -32(r1)
58 ; LE-NEXT: addis r4, r2, testCompare1@toc@ha
59 ; LE-NEXT: lbz r3, 0(r3)
60 ; LE-NEXT: lbz r4, testCompare1@toc@l(r4)
61 ; LE-NEXT: clrlwi r3, r3, 31
62 ; LE-NEXT: clrlwi r4, r4, 31
63 ; LE-NEXT: clrldi r3, r3, 32
64 ; LE-NEXT: clrldi r4, r4, 32
65 ; LE-NEXT: sub r3, r4, r3
66 ; LE-NEXT: rldicl r3, r3, 1, 63
69 ; LE-NEXT: addi r1, r1, 32
70 ; LE-NEXT: ld r0, 16(r1)
74 ; CHECK-P10-LE-LABEL: testCompare1:
75 ; CHECK-P10-LE: .localentry testCompare1, 1
76 ; CHECK-P10-LE-NEXT: # %bb.0: # %entry
77 ; CHECK-P10-LE-NEXT: plbz r4, testCompare1@PCREL(0), 1
78 ; CHECK-P10-LE-NEXT: lbz r3, 0(r3)
79 ; CHECK-P10-LE-NEXT: clrlwi r3, r3, 31
80 ; CHECK-P10-LE-NEXT: clrlwi r4, r4, 31
81 ; CHECK-P10-LE-NEXT: cmplw r4, r3
82 ; CHECK-P10-LE-NEXT: setbc r3, lt
83 ; CHECK-P10-LE-NEXT: b fn2@notoc
84 ; CHECK-P10-LE-NEXT: #TC_RETURNd8 fn2@notoc 0
86 ; CHECK-P10-BE-LABEL: testCompare1:
87 ; CHECK-P10-BE: # %bb.0: # %entry
88 ; CHECK-P10-BE-NEXT: mflr r0
89 ; CHECK-P10-BE-NEXT: std r0, 16(r1)
90 ; CHECK-P10-BE-NEXT: stdu r1, -112(r1)
91 ; CHECK-P10-BE-NEXT: addis r4, r2, testCompare1@toc@ha
92 ; CHECK-P10-BE-NEXT: lbz r3, 0(r3)
93 ; CHECK-P10-BE-NEXT: lbz r4, testCompare1@toc@l(r4)
94 ; CHECK-P10-BE-NEXT: clrlwi r3, r3, 31
95 ; CHECK-P10-BE-NEXT: clrlwi r4, r4, 31
96 ; CHECK-P10-BE-NEXT: cmplw r4, r3
97 ; CHECK-P10-BE-NEXT: setbc r3, lt
98 ; CHECK-P10-BE-NEXT: bl fn2
99 ; CHECK-P10-BE-NEXT: nop
100 ; CHECK-P10-BE-NEXT: addi r1, r1, 112
101 ; CHECK-P10-BE-NEXT: ld r0, 16(r1)
102 ; CHECK-P10-BE-NEXT: mtlr r0
103 ; CHECK-P10-BE-NEXT: blr
105 ; CHECK-P10-CMP-LE-LABEL: testCompare1:
106 ; CHECK-P10-CMP-LE: # %bb.0: # %entry
107 ; CHECK-P10-CMP-LE-NEXT: mflr r0
108 ; CHECK-P10-CMP-LE-NEXT: std r0, 16(r1)
109 ; CHECK-P10-CMP-LE-NEXT: stdu r1, -112(r1)
110 ; CHECK-P10-CMP-LE-NEXT: addis r4, r2, testCompare1@toc@ha
111 ; CHECK-P10-CMP-LE-NEXT: lbz r3, 0(r3)
112 ; CHECK-P10-CMP-LE-NEXT: lbz r4, testCompare1@toc@l(r4)
113 ; CHECK-P10-CMP-LE-NEXT: clrlwi r3, r3, 31
114 ; CHECK-P10-CMP-LE-NEXT: clrlwi r4, r4, 31
115 ; CHECK-P10-CMP-LE-NEXT: clrldi r3, r3, 32
116 ; CHECK-P10-CMP-LE-NEXT: clrldi r4, r4, 32
117 ; CHECK-P10-CMP-LE-NEXT: sub r3, r4, r3
118 ; CHECK-P10-CMP-LE-NEXT: rldicl r3, r3, 1, 63
119 ; CHECK-P10-CMP-LE-NEXT: bl fn2
120 ; CHECK-P10-CMP-LE-NEXT: nop
121 ; CHECK-P10-CMP-LE-NEXT: addi r1, r1, 112
122 ; CHECK-P10-CMP-LE-NEXT: ld r0, 16(r1)
123 ; CHECK-P10-CMP-LE-NEXT: mtlr r0
124 ; CHECK-P10-CMP-LE-NEXT: blr
126 ; CHECK-P10-CMP-BE-LABEL: testCompare1:
127 ; CHECK-P10-CMP-BE: .localentry testCompare1, 1
128 ; CHECK-P10-CMP-BE-NEXT: # %bb.0: # %entry
129 ; CHECK-P10-CMP-BE-NEXT: plbz r4, testCompare1@PCREL(0), 1
130 ; CHECK-P10-CMP-BE-NEXT: lbz r3, 0(r3)
131 ; CHECK-P10-CMP-BE-NEXT: clrlwi r3, r3, 31
132 ; CHECK-P10-CMP-BE-NEXT: clrlwi r4, r4, 31
133 ; CHECK-P10-CMP-BE-NEXT: clrldi r3, r3, 32
134 ; CHECK-P10-CMP-BE-NEXT: clrldi r4, r4, 32
135 ; CHECK-P10-CMP-BE-NEXT: sub r3, r4, r3
136 ; CHECK-P10-CMP-BE-NEXT: rldicl r3, r3, 1, 63
137 ; CHECK-P10-CMP-BE-NEXT: b fn2@notoc
138 ; CHECK-P10-CMP-BE-NEXT: #TC_RETURNd8 fn2@notoc 0
140 %bf.load = load i8, i8* bitcast (i32 (%struct.tree_common*)* @testCompare1 to i8*), align 4
141 %bf.clear = and i8 %bf.load, 1
142 %0 = getelementptr inbounds %struct.tree_common, %struct.tree_common* %arg1, i64 0, i32 0
143 %bf.load1 = load i8, i8* %0, align 4
144 %bf.clear2 = and i8 %bf.load1, 1
145 %cmp = icmp ult i8 %bf.clear, %bf.clear2
146 %conv = zext i1 %cmp to i32
147 %call = tail call signext i32 bitcast (i32 (...)* @fn2 to i32 (i32)*)(i32 signext %conv) #2
151 ; Function Attrs: norecurse nounwind readnone
152 define dso_local signext i32 @testCompare2(i32 zeroext %a, i32 zeroext %b) {
153 ; CHECK-LABEL: testCompare2:
154 ; CHECK: # %bb.0: # %entry
155 ; CHECK-NEXT: clrlwi r3, r3, 31
156 ; CHECK-NEXT: clrlwi r4, r4, 31
157 ; CHECK-NEXT: clrldi r3, r3, 32
158 ; CHECK-NEXT: clrldi r4, r4, 32
159 ; CHECK-NEXT: sub r3, r3, r4
160 ; CHECK-NEXT: rldicl r3, r3, 1, 63
163 ; CHECK-P10-LABEL: testCompare2:
164 ; CHECK-P10: # %bb.0: # %entry
165 ; CHECK-P10-NEXT: clrlwi r3, r3, 31
166 ; CHECK-P10-NEXT: clrlwi r4, r4, 31
167 ; CHECK-P10-NEXT: cmplw r3, r4
168 ; CHECK-P10-NEXT: setbc r3, lt
169 ; CHECK-P10-NEXT: blr
171 ; CHECK-P10-CMP-LABEL: testCompare2:
172 ; CHECK-P10-CMP: # %bb.0: # %entry
173 ; CHECK-P10-CMP-NEXT: clrlwi r3, r3, 31
174 ; CHECK-P10-CMP-NEXT: clrlwi r4, r4, 31
175 ; CHECK-P10-CMP-NEXT: clrldi r3, r3, 32
176 ; CHECK-P10-CMP-NEXT: clrldi r4, r4, 32
177 ; CHECK-P10-CMP-NEXT: sub r3, r3, r4
178 ; CHECK-P10-CMP-NEXT: rldicl r3, r3, 1, 63
179 ; CHECK-P10-CMP-NEXT: blr
182 %and1 = and i32 %b, 1
183 %cmp = icmp ult i32 %and, %and1
184 %conv = zext i1 %cmp to i32