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 cmplw --implicit-check-not cmpld
20 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
21 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr10 < %s | \
22 ; RUN: FileCheck %s --check-prefixes=CHECK-P10-CMP,CHECK-P10-CMP-BE \
23 ; RUN: --implicit-check-not cmplw --implicit-check-not cmpld
25 %struct.tree_common = type { i8, [3 x i8] }
26 declare signext i32 @fn2(...) local_unnamed_addr #1
28 ; Function Attrs: nounwind
29 define dso_local i32 @testCompare1(ptr nocapture readonly %arg1) nounwind {
30 ; BE-LABEL: testCompare1:
31 ; BE: # %bb.0: # %entry
33 ; BE-NEXT: stdu r1, -112(r1)
34 ; BE-NEXT: std r0, 128(r1)
35 ; BE-NEXT: addis r4, r2, testCompare1@toc@ha
36 ; BE-NEXT: lbz r4, testCompare1@toc@l(r4)
37 ; BE-NEXT: lbz r3, 0(r3)
38 ; BE-NEXT: clrlwi r4, r4, 31
39 ; BE-NEXT: clrlwi r3, r3, 31
40 ; BE-NEXT: clrldi r4, r4, 32
41 ; BE-NEXT: clrldi r3, r3, 32
42 ; BE-NEXT: sub r3, r3, r4
43 ; BE-NEXT: rldicl r3, r3, 1, 63
46 ; BE-NEXT: addi r1, r1, 112
47 ; BE-NEXT: ld r0, 16(r1)
51 ; LE-LABEL: testCompare1:
52 ; LE: # %bb.0: # %entry
54 ; LE-NEXT: stdu r1, -32(r1)
55 ; LE-NEXT: std r0, 48(r1)
56 ; LE-NEXT: addis r4, r2, testCompare1@toc@ha
57 ; LE-NEXT: lbz r4, testCompare1@toc@l(r4)
58 ; LE-NEXT: lbz r3, 0(r3)
59 ; LE-NEXT: clrlwi r4, r4, 31
60 ; LE-NEXT: clrlwi r3, r3, 31
61 ; LE-NEXT: clrldi r4, r4, 32
62 ; LE-NEXT: clrldi r3, r3, 32
63 ; LE-NEXT: sub r3, r3, r4
64 ; LE-NEXT: rldicl r3, r3, 1, 63
67 ; LE-NEXT: addi r1, r1, 32
68 ; LE-NEXT: ld r0, 16(r1)
72 ; CHECK-P10-LE-LABEL: testCompare1:
73 ; CHECK-P10-LE: # %bb.0: # %entry
74 ; CHECK-P10-LE-NEXT: plbz r4, testCompare1@PCREL(0), 1
75 ; CHECK-P10-LE-NEXT: lbz r3, 0(r3)
76 ; CHECK-P10-LE-NEXT: clrlwi r4, r4, 31
77 ; CHECK-P10-LE-NEXT: clrlwi r3, r3, 31
78 ; CHECK-P10-LE-NEXT: cmplw r4, r3
79 ; CHECK-P10-LE-NEXT: setbc r3, gt
80 ; CHECK-P10-LE-NEXT: b fn2@notoc
81 ; CHECK-P10-LE-NEXT: #TC_RETURNd8 fn2@notoc 0
83 ; CHECK-P10-BE-LABEL: testCompare1:
84 ; CHECK-P10-BE: # %bb.0: # %entry
85 ; CHECK-P10-BE-NEXT: mflr r0
86 ; CHECK-P10-BE-NEXT: std r0, 16(r1)
87 ; CHECK-P10-BE-NEXT: stdu r1, -112(r1)
88 ; CHECK-P10-BE-NEXT: addis r4, r2, testCompare1@toc@ha
89 ; CHECK-P10-BE-NEXT: lbz r3, 0(r3)
90 ; CHECK-P10-BE-NEXT: lbz r4, testCompare1@toc@l(r4)
91 ; CHECK-P10-BE-NEXT: clrlwi r3, r3, 31
92 ; CHECK-P10-BE-NEXT: clrlwi r4, r4, 31
93 ; CHECK-P10-BE-NEXT: cmplw r4, r3
94 ; CHECK-P10-BE-NEXT: setbc r3, gt
95 ; CHECK-P10-BE-NEXT: bl fn2
96 ; CHECK-P10-BE-NEXT: nop
97 ; CHECK-P10-BE-NEXT: addi r1, r1, 112
98 ; CHECK-P10-BE-NEXT: ld r0, 16(r1)
99 ; CHECK-P10-BE-NEXT: mtlr r0
100 ; CHECK-P10-BE-NEXT: blr
102 ; CHECK-P10-CMP-LE-LABEL: testCompare1:
103 ; CHECK-P10-CMP-LE: # %bb.0: # %entry
104 ; CHECK-P10-CMP-LE-NEXT: mflr r0
105 ; CHECK-P10-CMP-LE-NEXT: std r0, 16(r1)
106 ; CHECK-P10-CMP-LE-NEXT: stdu r1, -112(r1)
107 ; CHECK-P10-CMP-LE-NEXT: addis r4, r2, testCompare1@toc@ha
108 ; CHECK-P10-CMP-LE-NEXT: lbz r3, 0(r3)
109 ; CHECK-P10-CMP-LE-NEXT: lbz r4, testCompare1@toc@l(r4)
110 ; CHECK-P10-CMP-LE-NEXT: clrlwi r3, r3, 31
111 ; CHECK-P10-CMP-LE-NEXT: clrlwi r4, r4, 31
112 ; CHECK-P10-CMP-LE-NEXT: clrldi r3, r3, 32
113 ; CHECK-P10-CMP-LE-NEXT: clrldi r4, r4, 32
114 ; CHECK-P10-CMP-LE-NEXT: sub r3, r3, r4
115 ; CHECK-P10-CMP-LE-NEXT: rldicl r3, r3, 1, 63
116 ; CHECK-P10-CMP-LE-NEXT: bl fn2
117 ; CHECK-P10-CMP-LE-NEXT: nop
118 ; CHECK-P10-CMP-LE-NEXT: addi r1, r1, 112
119 ; CHECK-P10-CMP-LE-NEXT: ld r0, 16(r1)
120 ; CHECK-P10-CMP-LE-NEXT: mtlr r0
121 ; CHECK-P10-CMP-LE-NEXT: blr
123 ; CHECK-P10-CMP-BE-LABEL: testCompare1:
124 ; CHECK-P10-CMP-BE: # %bb.0: # %entry
125 ; CHECK-P10-CMP-BE-NEXT: plbz r4, testCompare1@PCREL(0), 1
126 ; CHECK-P10-CMP-BE-NEXT: lbz r3, 0(r3)
127 ; CHECK-P10-CMP-BE-NEXT: clrlwi r4, r4, 31
128 ; CHECK-P10-CMP-BE-NEXT: clrlwi r3, r3, 31
129 ; CHECK-P10-CMP-BE-NEXT: clrldi r4, r4, 32
130 ; CHECK-P10-CMP-BE-NEXT: clrldi r3, r3, 32
131 ; CHECK-P10-CMP-BE-NEXT: sub r3, r3, r4
132 ; CHECK-P10-CMP-BE-NEXT: rldicl r3, r3, 1, 63
133 ; CHECK-P10-CMP-BE-NEXT: b fn2@notoc
134 ; CHECK-P10-CMP-BE-NEXT: #TC_RETURNd8 fn2@notoc 0
137 %bf.load = load i8, ptr @testCompare1, align 4
138 %bf.clear = and i8 %bf.load, 1
139 %bf.load1 = load i8, ptr %arg1, align 4
140 %bf.clear2 = and i8 %bf.load1, 1
141 %cmp = icmp ugt i8 %bf.clear, %bf.clear2
142 %conv = zext i1 %cmp to i32
143 %call = tail call signext i32 @fn2(i32 signext %conv) #2
147 ; Function Attrs: norecurse nounwind readnone
148 define dso_local signext i32 @testCompare2(i32 zeroext %a, i32 zeroext %b) {
149 ; CHECK-LABEL: testCompare2:
150 ; CHECK: # %bb.0: # %entry
151 ; CHECK-NEXT: clrlwi r3, r3, 31
152 ; CHECK-NEXT: clrlwi r4, r4, 31
153 ; CHECK-NEXT: clrldi r3, r3, 32
154 ; CHECK-NEXT: clrldi r4, r4, 32
155 ; CHECK-NEXT: sub r3, r4, r3
156 ; CHECK-NEXT: rldicl r3, r3, 1, 63
159 ; CHECK-P10-LABEL: testCompare2:
160 ; CHECK-P10: # %bb.0: # %entry
161 ; CHECK-P10-NEXT: clrlwi r3, r3, 31
162 ; CHECK-P10-NEXT: clrlwi r4, r4, 31
163 ; CHECK-P10-NEXT: cmplw r3, r4
164 ; CHECK-P10-NEXT: setbc r3, gt
165 ; CHECK-P10-NEXT: blr
167 ; CHECK-P10-CMP-LABEL: testCompare2:
168 ; CHECK-P10-CMP: # %bb.0: # %entry
169 ; CHECK-P10-CMP-NEXT: clrlwi r3, r3, 31
170 ; CHECK-P10-CMP-NEXT: clrlwi r4, r4, 31
171 ; CHECK-P10-CMP-NEXT: clrldi r3, r3, 32
172 ; CHECK-P10-CMP-NEXT: clrldi r4, r4, 32
173 ; CHECK-P10-CMP-NEXT: sub r3, r4, r3
174 ; CHECK-P10-CMP-NEXT: rldicl r3, r3, 1, 63
175 ; CHECK-P10-CMP-NEXT: blr
179 %and1 = and i32 %b, 1
180 %cmp = icmp ugt i32 %and, %and1
181 %conv = zext i1 %cmp to i32