Debian Codegraph @

llvm/test/CodeGen/PowerPC/licm-xxsplti.ll

raw
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ;; Test hoisting `xxspltib` out of the loop.
3
4 ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff --mcpu=pwr10 \
5 ; RUN: %s -o - 2>&1 | FileCheck --check-prefix=AIX64 %s
6
7 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff --mcpu=pwr10 \
8 ; RUN: %s -o - 2>&1 | FileCheck --check-prefix=AIX32 %s
9
10 ; RUN: llc -verify-machineinstrs -mtriple powerpc64le-unknown-linux-gnu --mcpu=pwr10 \
11 ; RUN: %s -o - 2>&1 | FileCheck --check-prefix=LINUX64LE %s
12
13 define void @_Z3fooPfS_Pi(ptr noalias nocapture noundef %_a, ptr noalias nocapture %In_a, ptr noalias nocapture %n) {
14 ; AIX64-LABEL: _Z3fooPfS_Pi:
15 ; AIX64: # %bb.0: # %entry
16 ; AIX64-NEXT: lwz 5, 0(5)
17 ; AIX64-NEXT: cmpwi 5, 1
18 ; AIX64-NEXT: bltlr 0
19 ; AIX64-NEXT: # %bb.1: # %for.body.preheader
20 ; AIX64-NEXT: li 6, 0
21 ; AIX64-NEXT: cmplwi 5, 1
22 ; AIX64-NEXT: beq 0, L..BB0_4
23 ; AIX64-NEXT: # %bb.2: # %for.body.preheader.new
24 ; AIX64-NEXT: rlwinm 6, 5, 0, 1, 30
25 ; AIX64-NEXT: xxspltib 0, 6
26 ; AIX64-NEXT: addi 9, 4, -8
27 ; AIX64-NEXT: addi 7, 3, -8
28 ; AIX64-NEXT: li 8, 8
29 ; AIX64-NEXT: li 10, 12
30 ; AIX64-NEXT: li 11, 4
31 ; AIX64-NEXT: addi 6, 6, -2
32 ; AIX64-NEXT: rldicl 6, 6, 63, 1
33 ; AIX64-NEXT: addi 6, 6, 1
34 ; AIX64-NEXT: mtctr 6
35 ; AIX64-NEXT: li 6, 0
36 ; AIX64-NEXT: .align 4
37 ; AIX64-NEXT: L..BB0_3: # %for.body
38 ; AIX64-NEXT: #
39 ; AIX64-NEXT: lxvwsx 1, 9, 8
40 ; AIX64-NEXT: addi 6, 6, 2
41 ; AIX64-NEXT: xxland 1, 1, 0
42 ; AIX64-NEXT: xscvspdpn 1, 1
43 ; AIX64-NEXT: stfsu 1, 8(7)
44 ; AIX64-NEXT: lxvwsx 1, 9, 10
45 ; AIX64-NEXT: addi 9, 9, 8
46 ; AIX64-NEXT: xxland 1, 1, 0
47 ; AIX64-NEXT: xxsldwi 1, 1, 1, 3
48 ; AIX64-NEXT: stfiwx 1, 7, 11
49 ; AIX64-NEXT: bdnz L..BB0_3
50 ; AIX64-NEXT: L..BB0_4: # %for.cond.cleanup.loopexit.unr-lcssa
51 ; AIX64-NEXT: andi. 5, 5, 1
52 ; AIX64-NEXT: bclr 4, 1, 0
53 ; AIX64-NEXT: # %bb.5: # %for.body.epil
54 ; AIX64-NEXT: sldi 5, 6, 2
55 ; AIX64-NEXT: xxspltib 1, 6
56 ; AIX64-NEXT: lxvwsx 0, 4, 5
57 ; AIX64-NEXT: xxland 0, 0, 1
58 ; AIX64-NEXT: xxsldwi 0, 0, 0, 3
59 ; AIX64-NEXT: stfiwx 0, 3, 5
60 ; AIX64-NEXT: blr
61 ;
62 ; AIX32-LABEL: _Z3fooPfS_Pi:
63 ; AIX32: # %bb.0: # %entry
64 ; AIX32-NEXT: lwz 5, 0(5)
65 ; AIX32-NEXT: cmpwi 5, 1
66 ; AIX32-NEXT: bltlr 0
67 ; AIX32-NEXT: # %bb.1: # %for.body.preheader
68 ; AIX32-NEXT: li 6, 0
69 ; AIX32-NEXT: beq 0, L..BB0_4
70 ; AIX32-NEXT: # %bb.2: # %for.body.preheader.new
71 ; AIX32-NEXT: xxspltib 0, 6
72 ; AIX32-NEXT: addi 12, 4, -8
73 ; AIX32-NEXT: addi 8, 3, -8
74 ; AIX32-NEXT: rlwinm 7, 5, 0, 1, 30
75 ; AIX32-NEXT: li 9, 8
76 ; AIX32-NEXT: li 10, 12
77 ; AIX32-NEXT: li 11, 0
78 ; AIX32-NEXT: .align 4
79 ; AIX32-NEXT: L..BB0_3: # %for.body
80 ; AIX32-NEXT: #
81 ; AIX32-NEXT: lxvwsx 1, 12, 9
82 ; AIX32-NEXT: addic 6, 6, 2
83 ; AIX32-NEXT: addze 11, 11
84 ; AIX32-NEXT: xor 0, 6, 7
85 ; AIX32-NEXT: or. 0, 0, 11
86 ; AIX32-NEXT: xxland 1, 1, 0
87 ; AIX32-NEXT: xscvspdpn 1, 1
88 ; AIX32-NEXT: stfsu 1, 8(8)
89 ; AIX32-NEXT: lxvwsx 1, 12, 10
90 ; AIX32-NEXT: addi 12, 12, 8
91 ; AIX32-NEXT: xxland 1, 1, 0
92 ; AIX32-NEXT: xscvspdpn 1, 1
93 ; AIX32-NEXT: stfs 1, 4(8)
94 ; AIX32-NEXT: bne 0, L..BB0_3
95 ; AIX32-NEXT: L..BB0_4: # %for.cond.cleanup.loopexit.unr-lcssa
96 ; AIX32-NEXT: andi. 5, 5, 1
97 ; AIX32-NEXT: bclr 4, 1, 0
98 ; AIX32-NEXT: # %bb.5: # %for.body.epil
99 ; AIX32-NEXT: slwi 5, 6, 2
100 ; AIX32-NEXT: xxspltib 1, 6
101 ; AIX32-NEXT: lxvwsx 0, 4, 5
102 ; AIX32-NEXT: xxland 0, 0, 1
103 ; AIX32-NEXT: xscvspdpn 0, 0
104 ; AIX32-NEXT: stfsx 0, 3, 5
105 ; AIX32-NEXT: blr
106 ;
107 ; LINUX64LE-LABEL: _Z3fooPfS_Pi:
108 ; LINUX64LE: # %bb.0: # %entry
109 ; LINUX64LE-NEXT: lwz 5, 0(5)
110 ; LINUX64LE-NEXT: cmpwi 5, 1
111 ; LINUX64LE-NEXT: bltlr 0
112 ; LINUX64LE-NEXT: # %bb.1: # %for.body.preheader
113 ; LINUX64LE-NEXT: li 6, 0
114 ; LINUX64LE-NEXT: cmplwi 5, 1
115 ; LINUX64LE-NEXT: beq 0, .LBB0_4
116 ; LINUX64LE-NEXT: # %bb.2: # %for.body.preheader.new
117 ; LINUX64LE-NEXT: rlwinm 6, 5, 0, 1, 30
118 ; LINUX64LE-NEXT: xxspltib 0, 6
119 ; LINUX64LE-NEXT: addi 8, 4, -8
120 ; LINUX64LE-NEXT: addi 7, 3, -8
121 ; LINUX64LE-NEXT: li 9, 8
122 ; LINUX64LE-NEXT: li 10, 12
123 ; LINUX64LE-NEXT: li 11, 4
124 ; LINUX64LE-NEXT: addi 6, 6, -2
125 ; LINUX64LE-NEXT: rldicl 6, 6, 63, 1
126 ; LINUX64LE-NEXT: addi 6, 6, 1
127 ; LINUX64LE-NEXT: mtctr 6
128 ; LINUX64LE-NEXT: li 6, 0
129 ; LINUX64LE-NEXT: .p2align 4
130 ; LINUX64LE-NEXT: .LBB0_3: # %for.body
131 ; LINUX64LE-NEXT: #
132 ; LINUX64LE-NEXT: lxvwsx 1, 8, 9
133 ; LINUX64LE-NEXT: addi 6, 6, 2
134 ; LINUX64LE-NEXT: xxland 1, 1, 0
135 ; LINUX64LE-NEXT: xxsldwi 1, 1, 1, 3
136 ; LINUX64LE-NEXT: xscvspdpn 1, 1
137 ; LINUX64LE-NEXT: stfsu 1, 8(7)
138 ; LINUX64LE-NEXT: lxvwsx 1, 8, 10
139 ; LINUX64LE-NEXT: addi 8, 8, 8
140 ; LINUX64LE-NEXT: xxland 1, 1, 0
141 ; LINUX64LE-NEXT: stxvrwx 1, 7, 11
142 ; LINUX64LE-NEXT: bdnz .LBB0_3
143 ; LINUX64LE-NEXT: .LBB0_4: # %for.cond.cleanup.loopexit.unr-lcssa
144 ; LINUX64LE-NEXT: andi. 5, 5, 1
145 ; LINUX64LE-NEXT: bclr 4, 1, 0
146 ; LINUX64LE-NEXT: # %bb.5: # %for.body.epil
147 ; LINUX64LE-NEXT: sldi 5, 6, 2
148 ; LINUX64LE-NEXT: xxspltib 1, 6
149 ; LINUX64LE-NEXT: lxvwsx 0, 4, 5
150 ; LINUX64LE-NEXT: xxland 0, 0, 1
151 ; LINUX64LE-NEXT: stxvrwx 0, 3, 5
152 ; LINUX64LE-NEXT: blr
153 entry:
154 %0 = load i32, ptr %n, align 4
155 %cmp9 = icmp sgt i32 %0, 0
156 br i1 %cmp9, label %for.body.preheader, label %for.cond.cleanup
157
158 for.body.preheader:
159 %wide.trip.count = zext nneg i32 %0 to i64
160 %xtraiter = and i64 %wide.trip.count, 1
161 %1 = icmp eq i32 %0, 1
162 br i1 %1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.preheader.new
163
164 for.body.preheader.new:
165 %unroll_iter = and i64 %wide.trip.count, 2147483646
166 br label %for.body
167
168 for.cond.cleanup.loopexit.unr-lcssa:
169 %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ]
170 %lcmp.mod.not = icmp eq i64 %xtraiter, 0
171 br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
172
173 for.body.epil:
174 %arrayidx.epil = getelementptr inbounds nuw float, ptr %In_a, i64 %indvars.iv.unr
175 %2 = load float, ptr %arrayidx.epil, align 4
176 %vecins.i.epil = insertelement <4 x float> poison, float %2, i64 0
177 %3 = bitcast <4 x float> %vecins.i.epil to <16 x i8>
178 %and1.i.epil = and <16 x i8> %3, <i8 6, i8 6, i8 6, i8 6, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison>
179 %4 = bitcast <16 x i8> %and1.i.epil to <4 x float>
180 %vecext.i.epil = extractelement <4 x float> %4, i64 0
181 %arrayidx5.epil = getelementptr inbounds nuw float, ptr %_a, i64 %indvars.iv.unr
182 store float %vecext.i.epil, ptr %arrayidx5.epil, align 4
183 br label %for.cond.cleanup
184
185 for.cond.cleanup:
186 ret void
187
188 for.body:
189 %indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ]
190 %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ]
191 %arrayidx = getelementptr inbounds nuw float, ptr %In_a, i64 %indvars.iv
192 %5 = load float, ptr %arrayidx, align 4
193 %vecins.i = insertelement <4 x float> poison, float %5, i64 0
194 %6 = bitcast <4 x float> %vecins.i to <16 x i8>
195 %and1.i = and <16 x i8> %6, <i8 6, i8 6, i8 6, i8 6, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison>
196 %7 = bitcast <16 x i8> %and1.i to <4 x float>
197 %vecext.i = extractelement <4 x float> %7, i64 0
198 %arrayidx5 = getelementptr inbounds nuw float, ptr %_a, i64 %indvars.iv
199 store float %vecext.i, ptr %arrayidx5, align 4
200 %indvars.iv.next = or disjoint i64 %indvars.iv, 1
201 %arrayidx.1 = getelementptr inbounds nuw float, ptr %In_a, i64 %indvars.iv.next
202 %8 = load float, ptr %arrayidx.1, align 4
203 %vecins.i.1 = insertelement <4 x float> poison, float %8, i64 0
204 %9 = bitcast <4 x float> %vecins.i.1 to <16 x i8>
205 %and1.i.1 = and <16 x i8> %9, <i8 6, i8 6, i8 6, i8 6, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison>
206 %10 = bitcast <16 x i8> %and1.i.1 to <4 x float>
207 %vecext.i.1 = extractelement <4 x float> %10, i64 0
208 %arrayidx5.1 = getelementptr inbounds nuw float, ptr %_a, i64 %indvars.iv.next
209 store float %vecext.i.1, ptr %arrayidx5.1, align 4
210 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
211 %niter.next.1 = add i64 %niter, 2
212 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
213 br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body
214 }