1 // Code generated from _gen/ARM64.rules using 'go generate'; DO NOT EDIT.
5 import "cmd/compile/internal/types"
7 func rewriteValueARM64(v *Value) bool {
10 return rewriteValueARM64_OpARM64ADCSflags(v)
12 return rewriteValueARM64_OpARM64ADD(v)
13 case OpARM64ADDSflags:
14 return rewriteValueARM64_OpARM64ADDSflags(v)
16 return rewriteValueARM64_OpARM64ADDconst(v)
17 case OpARM64ADDshiftLL:
18 return rewriteValueARM64_OpARM64ADDshiftLL(v)
19 case OpARM64ADDshiftRA:
20 return rewriteValueARM64_OpARM64ADDshiftRA(v)
21 case OpARM64ADDshiftRL:
22 return rewriteValueARM64_OpARM64ADDshiftRL(v)
24 return rewriteValueARM64_OpARM64AND(v)
26 return rewriteValueARM64_OpARM64ANDconst(v)
27 case OpARM64ANDshiftLL:
28 return rewriteValueARM64_OpARM64ANDshiftLL(v)
29 case OpARM64ANDshiftRA:
30 return rewriteValueARM64_OpARM64ANDshiftRA(v)
31 case OpARM64ANDshiftRL:
32 return rewriteValueARM64_OpARM64ANDshiftRL(v)
33 case OpARM64ANDshiftRO:
34 return rewriteValueARM64_OpARM64ANDshiftRO(v)
36 return rewriteValueARM64_OpARM64BIC(v)
37 case OpARM64BICshiftLL:
38 return rewriteValueARM64_OpARM64BICshiftLL(v)
39 case OpARM64BICshiftRA:
40 return rewriteValueARM64_OpARM64BICshiftRA(v)
41 case OpARM64BICshiftRL:
42 return rewriteValueARM64_OpARM64BICshiftRL(v)
43 case OpARM64BICshiftRO:
44 return rewriteValueARM64_OpARM64BICshiftRO(v)
46 return rewriteValueARM64_OpARM64CMN(v)
48 return rewriteValueARM64_OpARM64CMNW(v)
49 case OpARM64CMNWconst:
50 return rewriteValueARM64_OpARM64CMNWconst(v)
52 return rewriteValueARM64_OpARM64CMNconst(v)
53 case OpARM64CMNshiftLL:
54 return rewriteValueARM64_OpARM64CMNshiftLL(v)
55 case OpARM64CMNshiftRA:
56 return rewriteValueARM64_OpARM64CMNshiftRA(v)
57 case OpARM64CMNshiftRL:
58 return rewriteValueARM64_OpARM64CMNshiftRL(v)
60 return rewriteValueARM64_OpARM64CMP(v)
62 return rewriteValueARM64_OpARM64CMPW(v)
63 case OpARM64CMPWconst:
64 return rewriteValueARM64_OpARM64CMPWconst(v)
66 return rewriteValueARM64_OpARM64CMPconst(v)
67 case OpARM64CMPshiftLL:
68 return rewriteValueARM64_OpARM64CMPshiftLL(v)
69 case OpARM64CMPshiftRA:
70 return rewriteValueARM64_OpARM64CMPshiftRA(v)
71 case OpARM64CMPshiftRL:
72 return rewriteValueARM64_OpARM64CMPshiftRL(v)
74 return rewriteValueARM64_OpARM64CSEL(v)
76 return rewriteValueARM64_OpARM64CSEL0(v)
78 return rewriteValueARM64_OpARM64CSETM(v)
80 return rewriteValueARM64_OpARM64CSINC(v)
82 return rewriteValueARM64_OpARM64CSINV(v)
84 return rewriteValueARM64_OpARM64CSNEG(v)
86 return rewriteValueARM64_OpARM64DIV(v)
88 return rewriteValueARM64_OpARM64DIVW(v)
90 return rewriteValueARM64_OpARM64EON(v)
91 case OpARM64EONshiftLL:
92 return rewriteValueARM64_OpARM64EONshiftLL(v)
93 case OpARM64EONshiftRA:
94 return rewriteValueARM64_OpARM64EONshiftRA(v)
95 case OpARM64EONshiftRL:
96 return rewriteValueARM64_OpARM64EONshiftRL(v)
97 case OpARM64EONshiftRO:
98 return rewriteValueARM64_OpARM64EONshiftRO(v)
100 return rewriteValueARM64_OpARM64Equal(v)
102 return rewriteValueARM64_OpARM64FADDD(v)
104 return rewriteValueARM64_OpARM64FADDS(v)
106 return rewriteValueARM64_OpARM64FCMPD(v)
108 return rewriteValueARM64_OpARM64FCMPS(v)
109 case OpARM64FMOVDfpgp:
110 return rewriteValueARM64_OpARM64FMOVDfpgp(v)
111 case OpARM64FMOVDgpfp:
112 return rewriteValueARM64_OpARM64FMOVDgpfp(v)
113 case OpARM64FMOVDload:
114 return rewriteValueARM64_OpARM64FMOVDload(v)
115 case OpARM64FMOVDloadidx:
116 return rewriteValueARM64_OpARM64FMOVDloadidx(v)
117 case OpARM64FMOVDloadidx8:
118 return rewriteValueARM64_OpARM64FMOVDloadidx8(v)
119 case OpARM64FMOVDstore:
120 return rewriteValueARM64_OpARM64FMOVDstore(v)
121 case OpARM64FMOVDstoreidx:
122 return rewriteValueARM64_OpARM64FMOVDstoreidx(v)
123 case OpARM64FMOVDstoreidx8:
124 return rewriteValueARM64_OpARM64FMOVDstoreidx8(v)
125 case OpARM64FMOVSload:
126 return rewriteValueARM64_OpARM64FMOVSload(v)
127 case OpARM64FMOVSloadidx:
128 return rewriteValueARM64_OpARM64FMOVSloadidx(v)
129 case OpARM64FMOVSloadidx4:
130 return rewriteValueARM64_OpARM64FMOVSloadidx4(v)
131 case OpARM64FMOVSstore:
132 return rewriteValueARM64_OpARM64FMOVSstore(v)
133 case OpARM64FMOVSstoreidx:
134 return rewriteValueARM64_OpARM64FMOVSstoreidx(v)
135 case OpARM64FMOVSstoreidx4:
136 return rewriteValueARM64_OpARM64FMOVSstoreidx4(v)
138 return rewriteValueARM64_OpARM64FMULD(v)
140 return rewriteValueARM64_OpARM64FMULS(v)
142 return rewriteValueARM64_OpARM64FNEGD(v)
144 return rewriteValueARM64_OpARM64FNEGS(v)
146 return rewriteValueARM64_OpARM64FNMULD(v)
148 return rewriteValueARM64_OpARM64FNMULS(v)
150 return rewriteValueARM64_OpARM64FSUBD(v)
152 return rewriteValueARM64_OpARM64FSUBS(v)
153 case OpARM64GreaterEqual:
154 return rewriteValueARM64_OpARM64GreaterEqual(v)
155 case OpARM64GreaterEqualF:
156 return rewriteValueARM64_OpARM64GreaterEqualF(v)
157 case OpARM64GreaterEqualU:
158 return rewriteValueARM64_OpARM64GreaterEqualU(v)
159 case OpARM64GreaterThan:
160 return rewriteValueARM64_OpARM64GreaterThan(v)
161 case OpARM64GreaterThanF:
162 return rewriteValueARM64_OpARM64GreaterThanF(v)
163 case OpARM64GreaterThanU:
164 return rewriteValueARM64_OpARM64GreaterThanU(v)
166 return rewriteValueARM64_OpARM64LDP(v)
167 case OpARM64LessEqual:
168 return rewriteValueARM64_OpARM64LessEqual(v)
169 case OpARM64LessEqualF:
170 return rewriteValueARM64_OpARM64LessEqualF(v)
171 case OpARM64LessEqualU:
172 return rewriteValueARM64_OpARM64LessEqualU(v)
173 case OpARM64LessThan:
174 return rewriteValueARM64_OpARM64LessThan(v)
175 case OpARM64LessThanF:
176 return rewriteValueARM64_OpARM64LessThanF(v)
177 case OpARM64LessThanU:
178 return rewriteValueARM64_OpARM64LessThanU(v)
180 return rewriteValueARM64_OpARM64MADD(v)
182 return rewriteValueARM64_OpARM64MADDW(v)
184 return rewriteValueARM64_OpARM64MNEG(v)
186 return rewriteValueARM64_OpARM64MNEGW(v)
188 return rewriteValueARM64_OpARM64MOD(v)
190 return rewriteValueARM64_OpARM64MODW(v)
191 case OpARM64MOVBUload:
192 return rewriteValueARM64_OpARM64MOVBUload(v)
193 case OpARM64MOVBUloadidx:
194 return rewriteValueARM64_OpARM64MOVBUloadidx(v)
195 case OpARM64MOVBUreg:
196 return rewriteValueARM64_OpARM64MOVBUreg(v)
197 case OpARM64MOVBload:
198 return rewriteValueARM64_OpARM64MOVBload(v)
199 case OpARM64MOVBloadidx:
200 return rewriteValueARM64_OpARM64MOVBloadidx(v)
202 return rewriteValueARM64_OpARM64MOVBreg(v)
203 case OpARM64MOVBstore:
204 return rewriteValueARM64_OpARM64MOVBstore(v)
205 case OpARM64MOVBstoreidx:
206 return rewriteValueARM64_OpARM64MOVBstoreidx(v)
207 case OpARM64MOVBstorezero:
208 return rewriteValueARM64_OpARM64MOVBstorezero(v)
209 case OpARM64MOVBstorezeroidx:
210 return rewriteValueARM64_OpARM64MOVBstorezeroidx(v)
211 case OpARM64MOVDload:
212 return rewriteValueARM64_OpARM64MOVDload(v)
213 case OpARM64MOVDloadidx:
214 return rewriteValueARM64_OpARM64MOVDloadidx(v)
215 case OpARM64MOVDloadidx8:
216 return rewriteValueARM64_OpARM64MOVDloadidx8(v)
218 return rewriteValueARM64_OpARM64MOVDnop(v)
220 return rewriteValueARM64_OpARM64MOVDreg(v)
221 case OpARM64MOVDstore:
222 return rewriteValueARM64_OpARM64MOVDstore(v)
223 case OpARM64MOVDstoreidx:
224 return rewriteValueARM64_OpARM64MOVDstoreidx(v)
225 case OpARM64MOVDstoreidx8:
226 return rewriteValueARM64_OpARM64MOVDstoreidx8(v)
227 case OpARM64MOVDstorezero:
228 return rewriteValueARM64_OpARM64MOVDstorezero(v)
229 case OpARM64MOVDstorezeroidx:
230 return rewriteValueARM64_OpARM64MOVDstorezeroidx(v)
231 case OpARM64MOVDstorezeroidx8:
232 return rewriteValueARM64_OpARM64MOVDstorezeroidx8(v)
233 case OpARM64MOVHUload:
234 return rewriteValueARM64_OpARM64MOVHUload(v)
235 case OpARM64MOVHUloadidx:
236 return rewriteValueARM64_OpARM64MOVHUloadidx(v)
237 case OpARM64MOVHUloadidx2:
238 return rewriteValueARM64_OpARM64MOVHUloadidx2(v)
239 case OpARM64MOVHUreg:
240 return rewriteValueARM64_OpARM64MOVHUreg(v)
241 case OpARM64MOVHload:
242 return rewriteValueARM64_OpARM64MOVHload(v)
243 case OpARM64MOVHloadidx:
244 return rewriteValueARM64_OpARM64MOVHloadidx(v)
245 case OpARM64MOVHloadidx2:
246 return rewriteValueARM64_OpARM64MOVHloadidx2(v)
248 return rewriteValueARM64_OpARM64MOVHreg(v)
249 case OpARM64MOVHstore:
250 return rewriteValueARM64_OpARM64MOVHstore(v)
251 case OpARM64MOVHstoreidx:
252 return rewriteValueARM64_OpARM64MOVHstoreidx(v)
253 case OpARM64MOVHstoreidx2:
254 return rewriteValueARM64_OpARM64MOVHstoreidx2(v)
255 case OpARM64MOVHstorezero:
256 return rewriteValueARM64_OpARM64MOVHstorezero(v)
257 case OpARM64MOVHstorezeroidx:
258 return rewriteValueARM64_OpARM64MOVHstorezeroidx(v)
259 case OpARM64MOVHstorezeroidx2:
260 return rewriteValueARM64_OpARM64MOVHstorezeroidx2(v)
261 case OpARM64MOVQstorezero:
262 return rewriteValueARM64_OpARM64MOVQstorezero(v)
263 case OpARM64MOVWUload:
264 return rewriteValueARM64_OpARM64MOVWUload(v)
265 case OpARM64MOVWUloadidx:
266 return rewriteValueARM64_OpARM64MOVWUloadidx(v)
267 case OpARM64MOVWUloadidx4:
268 return rewriteValueARM64_OpARM64MOVWUloadidx4(v)
269 case OpARM64MOVWUreg:
270 return rewriteValueARM64_OpARM64MOVWUreg(v)
271 case OpARM64MOVWload:
272 return rewriteValueARM64_OpARM64MOVWload(v)
273 case OpARM64MOVWloadidx:
274 return rewriteValueARM64_OpARM64MOVWloadidx(v)
275 case OpARM64MOVWloadidx4:
276 return rewriteValueARM64_OpARM64MOVWloadidx4(v)
278 return rewriteValueARM64_OpARM64MOVWreg(v)
279 case OpARM64MOVWstore:
280 return rewriteValueARM64_OpARM64MOVWstore(v)
281 case OpARM64MOVWstoreidx:
282 return rewriteValueARM64_OpARM64MOVWstoreidx(v)
283 case OpARM64MOVWstoreidx4:
284 return rewriteValueARM64_OpARM64MOVWstoreidx4(v)
285 case OpARM64MOVWstorezero:
286 return rewriteValueARM64_OpARM64MOVWstorezero(v)
287 case OpARM64MOVWstorezeroidx:
288 return rewriteValueARM64_OpARM64MOVWstorezeroidx(v)
289 case OpARM64MOVWstorezeroidx4:
290 return rewriteValueARM64_OpARM64MOVWstorezeroidx4(v)
292 return rewriteValueARM64_OpARM64MSUB(v)
294 return rewriteValueARM64_OpARM64MSUBW(v)
296 return rewriteValueARM64_OpARM64MUL(v)
298 return rewriteValueARM64_OpARM64MULW(v)
300 return rewriteValueARM64_OpARM64MVN(v)
301 case OpARM64MVNshiftLL:
302 return rewriteValueARM64_OpARM64MVNshiftLL(v)
303 case OpARM64MVNshiftRA:
304 return rewriteValueARM64_OpARM64MVNshiftRA(v)
305 case OpARM64MVNshiftRL:
306 return rewriteValueARM64_OpARM64MVNshiftRL(v)
307 case OpARM64MVNshiftRO:
308 return rewriteValueARM64_OpARM64MVNshiftRO(v)
310 return rewriteValueARM64_OpARM64NEG(v)
311 case OpARM64NEGshiftLL:
312 return rewriteValueARM64_OpARM64NEGshiftLL(v)
313 case OpARM64NEGshiftRA:
314 return rewriteValueARM64_OpARM64NEGshiftRA(v)
315 case OpARM64NEGshiftRL:
316 return rewriteValueARM64_OpARM64NEGshiftRL(v)
317 case OpARM64NotEqual:
318 return rewriteValueARM64_OpARM64NotEqual(v)
320 return rewriteValueARM64_OpARM64OR(v)
322 return rewriteValueARM64_OpARM64ORN(v)
323 case OpARM64ORNshiftLL:
324 return rewriteValueARM64_OpARM64ORNshiftLL(v)
325 case OpARM64ORNshiftRA:
326 return rewriteValueARM64_OpARM64ORNshiftRA(v)
327 case OpARM64ORNshiftRL:
328 return rewriteValueARM64_OpARM64ORNshiftRL(v)
329 case OpARM64ORNshiftRO:
330 return rewriteValueARM64_OpARM64ORNshiftRO(v)
332 return rewriteValueARM64_OpARM64ORconst(v)
333 case OpARM64ORshiftLL:
334 return rewriteValueARM64_OpARM64ORshiftLL(v)
335 case OpARM64ORshiftRA:
336 return rewriteValueARM64_OpARM64ORshiftRA(v)
337 case OpARM64ORshiftRL:
338 return rewriteValueARM64_OpARM64ORshiftRL(v)
339 case OpARM64ORshiftRO:
340 return rewriteValueARM64_OpARM64ORshiftRO(v)
342 return rewriteValueARM64_OpARM64REV(v)
344 return rewriteValueARM64_OpARM64REVW(v)
346 return rewriteValueARM64_OpARM64ROR(v)
348 return rewriteValueARM64_OpARM64RORW(v)
349 case OpARM64SBCSflags:
350 return rewriteValueARM64_OpARM64SBCSflags(v)
352 return rewriteValueARM64_OpARM64SLL(v)
353 case OpARM64SLLconst:
354 return rewriteValueARM64_OpARM64SLLconst(v)
356 return rewriteValueARM64_OpARM64SRA(v)
357 case OpARM64SRAconst:
358 return rewriteValueARM64_OpARM64SRAconst(v)
360 return rewriteValueARM64_OpARM64SRL(v)
361 case OpARM64SRLconst:
362 return rewriteValueARM64_OpARM64SRLconst(v)
364 return rewriteValueARM64_OpARM64STP(v)
366 return rewriteValueARM64_OpARM64SUB(v)
367 case OpARM64SUBconst:
368 return rewriteValueARM64_OpARM64SUBconst(v)
369 case OpARM64SUBshiftLL:
370 return rewriteValueARM64_OpARM64SUBshiftLL(v)
371 case OpARM64SUBshiftRA:
372 return rewriteValueARM64_OpARM64SUBshiftRA(v)
373 case OpARM64SUBshiftRL:
374 return rewriteValueARM64_OpARM64SUBshiftRL(v)
376 return rewriteValueARM64_OpARM64TST(v)
378 return rewriteValueARM64_OpARM64TSTW(v)
379 case OpARM64TSTWconst:
380 return rewriteValueARM64_OpARM64TSTWconst(v)
381 case OpARM64TSTconst:
382 return rewriteValueARM64_OpARM64TSTconst(v)
383 case OpARM64TSTshiftLL:
384 return rewriteValueARM64_OpARM64TSTshiftLL(v)
385 case OpARM64TSTshiftRA:
386 return rewriteValueARM64_OpARM64TSTshiftRA(v)
387 case OpARM64TSTshiftRL:
388 return rewriteValueARM64_OpARM64TSTshiftRL(v)
389 case OpARM64TSTshiftRO:
390 return rewriteValueARM64_OpARM64TSTshiftRO(v)
392 return rewriteValueARM64_OpARM64UBFIZ(v)
394 return rewriteValueARM64_OpARM64UBFX(v)
396 return rewriteValueARM64_OpARM64UDIV(v)
398 return rewriteValueARM64_OpARM64UDIVW(v)
400 return rewriteValueARM64_OpARM64UMOD(v)
402 return rewriteValueARM64_OpARM64UMODW(v)
404 return rewriteValueARM64_OpARM64XOR(v)
405 case OpARM64XORconst:
406 return rewriteValueARM64_OpARM64XORconst(v)
407 case OpARM64XORshiftLL:
408 return rewriteValueARM64_OpARM64XORshiftLL(v)
409 case OpARM64XORshiftRA:
410 return rewriteValueARM64_OpARM64XORshiftRA(v)
411 case OpARM64XORshiftRL:
412 return rewriteValueARM64_OpARM64XORshiftRL(v)
413 case OpARM64XORshiftRO:
414 return rewriteValueARM64_OpARM64XORshiftRO(v)
440 return rewriteValueARM64_OpAddr(v)
457 v.Op = OpARM64LoweredAtomicAdd32
459 case OpAtomicAdd32Variant:
460 v.Op = OpARM64LoweredAtomicAdd32Variant
463 v.Op = OpARM64LoweredAtomicAdd64
465 case OpAtomicAdd64Variant:
466 v.Op = OpARM64LoweredAtomicAdd64Variant
469 return rewriteValueARM64_OpAtomicAnd32(v)
470 case OpAtomicAnd32Variant:
471 return rewriteValueARM64_OpAtomicAnd32Variant(v)
473 return rewriteValueARM64_OpAtomicAnd8(v)
474 case OpAtomicAnd8Variant:
475 return rewriteValueARM64_OpAtomicAnd8Variant(v)
476 case OpAtomicCompareAndSwap32:
477 v.Op = OpARM64LoweredAtomicCas32
479 case OpAtomicCompareAndSwap32Variant:
480 v.Op = OpARM64LoweredAtomicCas32Variant
482 case OpAtomicCompareAndSwap64:
483 v.Op = OpARM64LoweredAtomicCas64
485 case OpAtomicCompareAndSwap64Variant:
486 v.Op = OpARM64LoweredAtomicCas64Variant
488 case OpAtomicExchange32:
489 v.Op = OpARM64LoweredAtomicExchange32
491 case OpAtomicExchange32Variant:
492 v.Op = OpARM64LoweredAtomicExchange32Variant
494 case OpAtomicExchange64:
495 v.Op = OpARM64LoweredAtomicExchange64
497 case OpAtomicExchange64Variant:
498 v.Op = OpARM64LoweredAtomicExchange64Variant
509 case OpAtomicLoadPtr:
513 return rewriteValueARM64_OpAtomicOr32(v)
514 case OpAtomicOr32Variant:
515 return rewriteValueARM64_OpAtomicOr32Variant(v)
517 return rewriteValueARM64_OpAtomicOr8(v)
518 case OpAtomicOr8Variant:
519 return rewriteValueARM64_OpAtomicOr8Variant(v)
520 case OpAtomicStore32:
523 case OpAtomicStore64:
529 case OpAtomicStorePtrNoWB:
533 return rewriteValueARM64_OpAvg64u(v)
535 return rewriteValueARM64_OpBitLen32(v)
537 return rewriteValueARM64_OpBitLen64(v)
539 return rewriteValueARM64_OpBitRev16(v)
547 return rewriteValueARM64_OpBitRev8(v)
558 v.Op = OpARM64FRINTPD
561 v.Op = OpARM64CALLclosure
576 return rewriteValueARM64_OpCondSelect(v)
578 return rewriteValueARM64_OpConst16(v)
580 return rewriteValueARM64_OpConst32(v)
582 return rewriteValueARM64_OpConst32F(v)
584 return rewriteValueARM64_OpConst64(v)
586 return rewriteValueARM64_OpConst64F(v)
588 return rewriteValueARM64_OpConst8(v)
590 return rewriteValueARM64_OpConstBool(v)
592 return rewriteValueARM64_OpConstNil(v)
594 return rewriteValueARM64_OpCtz16(v)
599 return rewriteValueARM64_OpCtz32(v)
604 return rewriteValueARM64_OpCtz64(v)
609 return rewriteValueARM64_OpCtz8(v)
614 v.Op = OpARM64FCVTZSSW
617 v.Op = OpARM64FCVTZUSW
620 v.Op = OpARM64FCVTZSS
626 v.Op = OpARM64FCVTZUS
629 v.Op = OpARM64UCVTFWS
632 v.Op = OpARM64UCVTFWD
635 v.Op = OpARM64SCVTFWS
638 v.Op = OpARM64SCVTFWD
641 v.Op = OpARM64FCVTZSDW
647 v.Op = OpARM64FCVTZUDW
650 v.Op = OpARM64FCVTZSD
653 v.Op = OpARM64FCVTZUD
667 case OpCvtBoolToUint8:
671 return rewriteValueARM64_OpDiv16(v)
673 return rewriteValueARM64_OpDiv16u(v)
675 return rewriteValueARM64_OpDiv32(v)
683 return rewriteValueARM64_OpDiv64(v)
691 return rewriteValueARM64_OpDiv8(v)
693 return rewriteValueARM64_OpDiv8u(v)
695 return rewriteValueARM64_OpEq16(v)
697 return rewriteValueARM64_OpEq32(v)
699 return rewriteValueARM64_OpEq32F(v)
701 return rewriteValueARM64_OpEq64(v)
703 return rewriteValueARM64_OpEq64F(v)
705 return rewriteValueARM64_OpEq8(v)
707 return rewriteValueARM64_OpEqB(v)
709 return rewriteValueARM64_OpEqPtr(v)
711 return rewriteValueARM64_OpFMA(v)
713 v.Op = OpARM64FRINTMD
716 v.Op = OpARM64LoweredGetCallerPC
719 v.Op = OpARM64LoweredGetCallerSP
721 case OpGetClosurePtr:
722 v.Op = OpARM64LoweredGetClosurePtr
725 return rewriteValueARM64_OpHmul32(v)
727 return rewriteValueARM64_OpHmul32u(v)
735 v.Op = OpARM64CALLinter
738 return rewriteValueARM64_OpIsInBounds(v)
740 return rewriteValueARM64_OpIsNonNil(v)
741 case OpIsSliceInBounds:
742 return rewriteValueARM64_OpIsSliceInBounds(v)
744 return rewriteValueARM64_OpLeq16(v)
746 return rewriteValueARM64_OpLeq16U(v)
748 return rewriteValueARM64_OpLeq32(v)
750 return rewriteValueARM64_OpLeq32F(v)
752 return rewriteValueARM64_OpLeq32U(v)
754 return rewriteValueARM64_OpLeq64(v)
756 return rewriteValueARM64_OpLeq64F(v)
758 return rewriteValueARM64_OpLeq64U(v)
760 return rewriteValueARM64_OpLeq8(v)
762 return rewriteValueARM64_OpLeq8U(v)
764 return rewriteValueARM64_OpLess16(v)
766 return rewriteValueARM64_OpLess16U(v)
768 return rewriteValueARM64_OpLess32(v)
770 return rewriteValueARM64_OpLess32F(v)
772 return rewriteValueARM64_OpLess32U(v)
774 return rewriteValueARM64_OpLess64(v)
776 return rewriteValueARM64_OpLess64F(v)
778 return rewriteValueARM64_OpLess64U(v)
780 return rewriteValueARM64_OpLess8(v)
782 return rewriteValueARM64_OpLess8U(v)
784 return rewriteValueARM64_OpLoad(v)
786 return rewriteValueARM64_OpLocalAddr(v)
788 return rewriteValueARM64_OpLsh16x16(v)
790 return rewriteValueARM64_OpLsh16x32(v)
792 return rewriteValueARM64_OpLsh16x64(v)
794 return rewriteValueARM64_OpLsh16x8(v)
796 return rewriteValueARM64_OpLsh32x16(v)
798 return rewriteValueARM64_OpLsh32x32(v)
800 return rewriteValueARM64_OpLsh32x64(v)
802 return rewriteValueARM64_OpLsh32x8(v)
804 return rewriteValueARM64_OpLsh64x16(v)
806 return rewriteValueARM64_OpLsh64x32(v)
808 return rewriteValueARM64_OpLsh64x64(v)
810 return rewriteValueARM64_OpLsh64x8(v)
812 return rewriteValueARM64_OpLsh8x16(v)
814 return rewriteValueARM64_OpLsh8x32(v)
816 return rewriteValueARM64_OpLsh8x64(v)
818 return rewriteValueARM64_OpLsh8x8(v)
832 return rewriteValueARM64_OpMod16(v)
834 return rewriteValueARM64_OpMod16u(v)
836 return rewriteValueARM64_OpMod32(v)
841 return rewriteValueARM64_OpMod64(v)
846 return rewriteValueARM64_OpMod8(v)
848 return rewriteValueARM64_OpMod8u(v)
850 return rewriteValueARM64_OpMove(v)
888 return rewriteValueARM64_OpNeq16(v)
890 return rewriteValueARM64_OpNeq32(v)
892 return rewriteValueARM64_OpNeq32F(v)
894 return rewriteValueARM64_OpNeq64(v)
896 return rewriteValueARM64_OpNeq64F(v)
898 return rewriteValueARM64_OpNeq8(v)
903 return rewriteValueARM64_OpNeqPtr(v)
905 v.Op = OpARM64LoweredNilCheck
908 return rewriteValueARM64_OpNot(v)
910 return rewriteValueARM64_OpOffPtr(v)
927 return rewriteValueARM64_OpPanicBounds(v)
929 return rewriteValueARM64_OpPopCount16(v)
931 return rewriteValueARM64_OpPopCount32(v)
933 return rewriteValueARM64_OpPopCount64(v)
934 case OpPrefetchCache:
935 return rewriteValueARM64_OpPrefetchCache(v)
936 case OpPrefetchCacheStreamed:
937 return rewriteValueARM64_OpPrefetchCacheStreamed(v)
939 return rewriteValueARM64_OpPubBarrier(v)
941 return rewriteValueARM64_OpRotateLeft16(v)
943 return rewriteValueARM64_OpRotateLeft32(v)
945 return rewriteValueARM64_OpRotateLeft64(v)
947 return rewriteValueARM64_OpRotateLeft8(v)
949 v.Op = OpARM64FRINTAD
952 v.Op = OpARM64LoweredRound32F
955 v.Op = OpARM64LoweredRound64F
958 v.Op = OpARM64FRINTND
961 return rewriteValueARM64_OpRsh16Ux16(v)
963 return rewriteValueARM64_OpRsh16Ux32(v)
965 return rewriteValueARM64_OpRsh16Ux64(v)
967 return rewriteValueARM64_OpRsh16Ux8(v)
969 return rewriteValueARM64_OpRsh16x16(v)
971 return rewriteValueARM64_OpRsh16x32(v)
973 return rewriteValueARM64_OpRsh16x64(v)
975 return rewriteValueARM64_OpRsh16x8(v)
977 return rewriteValueARM64_OpRsh32Ux16(v)
979 return rewriteValueARM64_OpRsh32Ux32(v)
981 return rewriteValueARM64_OpRsh32Ux64(v)
983 return rewriteValueARM64_OpRsh32Ux8(v)
985 return rewriteValueARM64_OpRsh32x16(v)
987 return rewriteValueARM64_OpRsh32x32(v)
989 return rewriteValueARM64_OpRsh32x64(v)
991 return rewriteValueARM64_OpRsh32x8(v)
993 return rewriteValueARM64_OpRsh64Ux16(v)
995 return rewriteValueARM64_OpRsh64Ux32(v)
997 return rewriteValueARM64_OpRsh64Ux64(v)
999 return rewriteValueARM64_OpRsh64Ux8(v)
1001 return rewriteValueARM64_OpRsh64x16(v)
1003 return rewriteValueARM64_OpRsh64x32(v)
1005 return rewriteValueARM64_OpRsh64x64(v)
1007 return rewriteValueARM64_OpRsh64x8(v)
1009 return rewriteValueARM64_OpRsh8Ux16(v)
1011 return rewriteValueARM64_OpRsh8Ux32(v)
1013 return rewriteValueARM64_OpRsh8Ux64(v)
1015 return rewriteValueARM64_OpRsh8Ux8(v)
1017 return rewriteValueARM64_OpRsh8x16(v)
1019 return rewriteValueARM64_OpRsh8x32(v)
1021 return rewriteValueARM64_OpRsh8x64(v)
1023 return rewriteValueARM64_OpRsh8x8(v)
1025 return rewriteValueARM64_OpSelect0(v)
1027 return rewriteValueARM64_OpSelect1(v)
1029 return rewriteValueARM64_OpSelectN(v)
1030 case OpSignExt16to32:
1031 v.Op = OpARM64MOVHreg
1033 case OpSignExt16to64:
1034 v.Op = OpARM64MOVHreg
1036 case OpSignExt32to64:
1037 v.Op = OpARM64MOVWreg
1039 case OpSignExt8to16:
1040 v.Op = OpARM64MOVBreg
1042 case OpSignExt8to32:
1043 v.Op = OpARM64MOVBreg
1045 case OpSignExt8to64:
1046 v.Op = OpARM64MOVBreg
1049 return rewriteValueARM64_OpSlicemask(v)
1051 v.Op = OpARM64FSQRTD
1054 v.Op = OpARM64FSQRTS
1057 v.Op = OpARM64CALLstatic
1060 return rewriteValueARM64_OpStore(v)
1083 v.Op = OpARM64CALLtail
1086 v.Op = OpARM64FRINTZD
1107 v.Op = OpARM64LoweredWB
1122 return rewriteValueARM64_OpZero(v)
1123 case OpZeroExt16to32:
1124 v.Op = OpARM64MOVHUreg
1126 case OpZeroExt16to64:
1127 v.Op = OpARM64MOVHUreg
1129 case OpZeroExt32to64:
1130 v.Op = OpARM64MOVWUreg
1132 case OpZeroExt8to16:
1133 v.Op = OpARM64MOVBUreg
1135 case OpZeroExt8to32:
1136 v.Op = OpARM64MOVBUreg
1138 case OpZeroExt8to64:
1139 v.Op = OpARM64MOVBUreg
1144 func rewriteValueARM64_OpARM64ADCSflags(v *Value) bool {
1149 typ := &b.Func.Config.Types
1150 // match: (ADCSflags x y (Select1 <types.TypeFlags> (ADDSconstflags [-1] (ADCzerocarry <typ.UInt64> c))))
1151 // result: (ADCSflags x y c)
1155 if v_2.Op != OpSelect1 || v_2.Type != types.TypeFlags {
1158 v_2_0 := v_2.Args[0]
1159 if v_2_0.Op != OpARM64ADDSconstflags || auxIntToInt64(v_2_0.AuxInt) != -1 {
1162 v_2_0_0 := v_2_0.Args[0]
1163 if v_2_0_0.Op != OpARM64ADCzerocarry || v_2_0_0.Type != typ.UInt64 {
1166 c := v_2_0_0.Args[0]
1167 v.reset(OpARM64ADCSflags)
1171 // match: (ADCSflags x y (Select1 <types.TypeFlags> (ADDSconstflags [-1] (MOVDconst [0]))))
1172 // result: (ADDSflags x y)
1176 if v_2.Op != OpSelect1 || v_2.Type != types.TypeFlags {
1179 v_2_0 := v_2.Args[0]
1180 if v_2_0.Op != OpARM64ADDSconstflags || auxIntToInt64(v_2_0.AuxInt) != -1 {
1183 v_2_0_0 := v_2_0.Args[0]
1184 if v_2_0_0.Op != OpARM64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
1187 v.reset(OpARM64ADDSflags)
1193 func rewriteValueARM64_OpARM64ADD(v *Value) bool {
1196 // match: (ADD x (MOVDconst <t> [c]))
1198 // result: (ADDconst [c] x)
1200 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1202 if v_1.Op != OpARM64MOVDconst {
1206 c := auxIntToInt64(v_1.AuxInt)
1210 v.reset(OpARM64ADDconst)
1211 v.AuxInt = int64ToAuxInt(c)
1217 // match: (ADD a l:(MUL x y))
1218 // cond: l.Uses==1 && clobber(l)
1219 // result: (MADD a x y)
1221 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1224 if l.Op != OpARM64MUL {
1229 if !(l.Uses == 1 && clobber(l)) {
1232 v.reset(OpARM64MADD)
1238 // match: (ADD a l:(MNEG x y))
1239 // cond: l.Uses==1 && clobber(l)
1240 // result: (MSUB a x y)
1242 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1245 if l.Op != OpARM64MNEG {
1250 if !(l.Uses == 1 && clobber(l)) {
1253 v.reset(OpARM64MSUB)
1259 // match: (ADD a l:(MULW x y))
1260 // cond: v.Type.Size() <= 4 && l.Uses==1 && clobber(l)
1261 // result: (MADDW a x y)
1263 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1266 if l.Op != OpARM64MULW {
1271 if !(v.Type.Size() <= 4 && l.Uses == 1 && clobber(l)) {
1274 v.reset(OpARM64MADDW)
1280 // match: (ADD a l:(MNEGW x y))
1281 // cond: v.Type.Size() <= 4 && l.Uses==1 && clobber(l)
1282 // result: (MSUBW a x y)
1284 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1287 if l.Op != OpARM64MNEGW {
1292 if !(v.Type.Size() <= 4 && l.Uses == 1 && clobber(l)) {
1295 v.reset(OpARM64MSUBW)
1301 // match: (ADD x (NEG y))
1302 // result: (SUB x y)
1304 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1306 if v_1.Op != OpARM64NEG {
1316 // match: (ADD x0 x1:(SLLconst [c] y))
1317 // cond: clobberIfDead(x1)
1318 // result: (ADDshiftLL x0 y [c])
1320 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1323 if x1.Op != OpARM64SLLconst {
1326 c := auxIntToInt64(x1.AuxInt)
1328 if !(clobberIfDead(x1)) {
1331 v.reset(OpARM64ADDshiftLL)
1332 v.AuxInt = int64ToAuxInt(c)
1338 // match: (ADD x0 x1:(SRLconst [c] y))
1339 // cond: clobberIfDead(x1)
1340 // result: (ADDshiftRL x0 y [c])
1342 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1345 if x1.Op != OpARM64SRLconst {
1348 c := auxIntToInt64(x1.AuxInt)
1350 if !(clobberIfDead(x1)) {
1353 v.reset(OpARM64ADDshiftRL)
1354 v.AuxInt = int64ToAuxInt(c)
1360 // match: (ADD x0 x1:(SRAconst [c] y))
1361 // cond: clobberIfDead(x1)
1362 // result: (ADDshiftRA x0 y [c])
1364 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1367 if x1.Op != OpARM64SRAconst {
1370 c := auxIntToInt64(x1.AuxInt)
1372 if !(clobberIfDead(x1)) {
1375 v.reset(OpARM64ADDshiftRA)
1376 v.AuxInt = int64ToAuxInt(c)
1384 func rewriteValueARM64_OpARM64ADDSflags(v *Value) bool {
1387 // match: (ADDSflags x (MOVDconst [c]))
1388 // result: (ADDSconstflags [c] x)
1390 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1392 if v_1.Op != OpARM64MOVDconst {
1395 c := auxIntToInt64(v_1.AuxInt)
1396 v.reset(OpARM64ADDSconstflags)
1397 v.AuxInt = int64ToAuxInt(c)
1405 func rewriteValueARM64_OpARM64ADDconst(v *Value) bool {
1407 // match: (ADDconst [off1] (MOVDaddr [off2] {sym} ptr))
1408 // cond: is32Bit(off1+int64(off2))
1409 // result: (MOVDaddr [int32(off1)+off2] {sym} ptr)
1411 off1 := auxIntToInt64(v.AuxInt)
1412 if v_0.Op != OpARM64MOVDaddr {
1415 off2 := auxIntToInt32(v_0.AuxInt)
1416 sym := auxToSym(v_0.Aux)
1418 if !(is32Bit(off1 + int64(off2))) {
1421 v.reset(OpARM64MOVDaddr)
1422 v.AuxInt = int32ToAuxInt(int32(off1) + off2)
1423 v.Aux = symToAux(sym)
1427 // match: (ADDconst [c] y)
1429 // result: (SUBconst [-c] y)
1431 c := auxIntToInt64(v.AuxInt)
1436 v.reset(OpARM64SUBconst)
1437 v.AuxInt = int64ToAuxInt(-c)
1441 // match: (ADDconst [0] x)
1444 if auxIntToInt64(v.AuxInt) != 0 {
1451 // match: (ADDconst [c] (MOVDconst [d]))
1452 // result: (MOVDconst [c+d])
1454 c := auxIntToInt64(v.AuxInt)
1455 if v_0.Op != OpARM64MOVDconst {
1458 d := auxIntToInt64(v_0.AuxInt)
1459 v.reset(OpARM64MOVDconst)
1460 v.AuxInt = int64ToAuxInt(c + d)
1463 // match: (ADDconst [c] (ADDconst [d] x))
1464 // result: (ADDconst [c+d] x)
1466 c := auxIntToInt64(v.AuxInt)
1467 if v_0.Op != OpARM64ADDconst {
1470 d := auxIntToInt64(v_0.AuxInt)
1472 v.reset(OpARM64ADDconst)
1473 v.AuxInt = int64ToAuxInt(c + d)
1477 // match: (ADDconst [c] (SUBconst [d] x))
1478 // result: (ADDconst [c-d] x)
1480 c := auxIntToInt64(v.AuxInt)
1481 if v_0.Op != OpARM64SUBconst {
1484 d := auxIntToInt64(v_0.AuxInt)
1486 v.reset(OpARM64ADDconst)
1487 v.AuxInt = int64ToAuxInt(c - d)
1493 func rewriteValueARM64_OpARM64ADDshiftLL(v *Value) bool {
1497 typ := &b.Func.Config.Types
1498 // match: (ADDshiftLL (MOVDconst [c]) x [d])
1499 // result: (ADDconst [c] (SLLconst <x.Type> x [d]))
1501 d := auxIntToInt64(v.AuxInt)
1502 if v_0.Op != OpARM64MOVDconst {
1505 c := auxIntToInt64(v_0.AuxInt)
1507 v.reset(OpARM64ADDconst)
1508 v.AuxInt = int64ToAuxInt(c)
1509 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
1510 v0.AuxInt = int64ToAuxInt(d)
1515 // match: (ADDshiftLL x (MOVDconst [c]) [d])
1516 // result: (ADDconst x [int64(uint64(c)<<uint64(d))])
1518 d := auxIntToInt64(v.AuxInt)
1520 if v_1.Op != OpARM64MOVDconst {
1523 c := auxIntToInt64(v_1.AuxInt)
1524 v.reset(OpARM64ADDconst)
1525 v.AuxInt = int64ToAuxInt(int64(uint64(c) << uint64(d)))
1529 // match: (ADDshiftLL <typ.UInt16> [8] (UBFX <typ.UInt16> [armBFAuxInt(8, 8)] x) x)
1530 // result: (REV16W x)
1532 if v.Type != typ.UInt16 || auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64UBFX || v_0.Type != typ.UInt16 || auxIntToArm64BitField(v_0.AuxInt) != armBFAuxInt(8, 8) {
1539 v.reset(OpARM64REV16W)
1543 // match: (ADDshiftLL [8] (UBFX [armBFAuxInt(8, 24)] (ANDconst [c1] x)) (ANDconst [c2] x))
1544 // cond: uint32(c1) == 0xff00ff00 && uint32(c2) == 0x00ff00ff
1545 // result: (REV16W x)
1547 if auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64UBFX || auxIntToArm64BitField(v_0.AuxInt) != armBFAuxInt(8, 24) {
1550 v_0_0 := v_0.Args[0]
1551 if v_0_0.Op != OpARM64ANDconst {
1554 c1 := auxIntToInt64(v_0_0.AuxInt)
1556 if v_1.Op != OpARM64ANDconst {
1559 c2 := auxIntToInt64(v_1.AuxInt)
1560 if x != v_1.Args[0] || !(uint32(c1) == 0xff00ff00 && uint32(c2) == 0x00ff00ff) {
1563 v.reset(OpARM64REV16W)
1567 // match: (ADDshiftLL [8] (SRLconst [8] (ANDconst [c1] x)) (ANDconst [c2] x))
1568 // cond: (uint64(c1) == 0xff00ff00ff00ff00 && uint64(c2) == 0x00ff00ff00ff00ff)
1569 // result: (REV16 x)
1571 if auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != 8 {
1574 v_0_0 := v_0.Args[0]
1575 if v_0_0.Op != OpARM64ANDconst {
1578 c1 := auxIntToInt64(v_0_0.AuxInt)
1580 if v_1.Op != OpARM64ANDconst {
1583 c2 := auxIntToInt64(v_1.AuxInt)
1584 if x != v_1.Args[0] || !(uint64(c1) == 0xff00ff00ff00ff00 && uint64(c2) == 0x00ff00ff00ff00ff) {
1587 v.reset(OpARM64REV16)
1591 // match: (ADDshiftLL [8] (SRLconst [8] (ANDconst [c1] x)) (ANDconst [c2] x))
1592 // cond: (uint64(c1) == 0xff00ff00 && uint64(c2) == 0x00ff00ff)
1593 // result: (REV16 (ANDconst <x.Type> [0xffffffff] x))
1595 if auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != 8 {
1598 v_0_0 := v_0.Args[0]
1599 if v_0_0.Op != OpARM64ANDconst {
1602 c1 := auxIntToInt64(v_0_0.AuxInt)
1604 if v_1.Op != OpARM64ANDconst {
1607 c2 := auxIntToInt64(v_1.AuxInt)
1608 if x != v_1.Args[0] || !(uint64(c1) == 0xff00ff00 && uint64(c2) == 0x00ff00ff) {
1611 v.reset(OpARM64REV16)
1612 v0 := b.NewValue0(v.Pos, OpARM64ANDconst, x.Type)
1613 v0.AuxInt = int64ToAuxInt(0xffffffff)
1618 // match: (ADDshiftLL [c] (SRLconst x [64-c]) x2)
1619 // result: (EXTRconst [64-c] x2 x)
1621 c := auxIntToInt64(v.AuxInt)
1622 if v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != 64-c {
1627 v.reset(OpARM64EXTRconst)
1628 v.AuxInt = int64ToAuxInt(64 - c)
1632 // match: (ADDshiftLL <t> [c] (UBFX [bfc] x) x2)
1633 // cond: c < 32 && t.Size() == 4 && bfc == armBFAuxInt(32-c, c)
1634 // result: (EXTRWconst [32-c] x2 x)
1637 c := auxIntToInt64(v.AuxInt)
1638 if v_0.Op != OpARM64UBFX {
1641 bfc := auxIntToArm64BitField(v_0.AuxInt)
1644 if !(c < 32 && t.Size() == 4 && bfc == armBFAuxInt(32-c, c)) {
1647 v.reset(OpARM64EXTRWconst)
1648 v.AuxInt = int64ToAuxInt(32 - c)
1654 func rewriteValueARM64_OpARM64ADDshiftRA(v *Value) bool {
1658 // match: (ADDshiftRA (MOVDconst [c]) x [d])
1659 // result: (ADDconst [c] (SRAconst <x.Type> x [d]))
1661 d := auxIntToInt64(v.AuxInt)
1662 if v_0.Op != OpARM64MOVDconst {
1665 c := auxIntToInt64(v_0.AuxInt)
1667 v.reset(OpARM64ADDconst)
1668 v.AuxInt = int64ToAuxInt(c)
1669 v0 := b.NewValue0(v.Pos, OpARM64SRAconst, x.Type)
1670 v0.AuxInt = int64ToAuxInt(d)
1675 // match: (ADDshiftRA x (MOVDconst [c]) [d])
1676 // result: (ADDconst x [c>>uint64(d)])
1678 d := auxIntToInt64(v.AuxInt)
1680 if v_1.Op != OpARM64MOVDconst {
1683 c := auxIntToInt64(v_1.AuxInt)
1684 v.reset(OpARM64ADDconst)
1685 v.AuxInt = int64ToAuxInt(c >> uint64(d))
1691 func rewriteValueARM64_OpARM64ADDshiftRL(v *Value) bool {
1695 // match: (ADDshiftRL (MOVDconst [c]) x [d])
1696 // result: (ADDconst [c] (SRLconst <x.Type> x [d]))
1698 d := auxIntToInt64(v.AuxInt)
1699 if v_0.Op != OpARM64MOVDconst {
1702 c := auxIntToInt64(v_0.AuxInt)
1704 v.reset(OpARM64ADDconst)
1705 v.AuxInt = int64ToAuxInt(c)
1706 v0 := b.NewValue0(v.Pos, OpARM64SRLconst, x.Type)
1707 v0.AuxInt = int64ToAuxInt(d)
1712 // match: (ADDshiftRL x (MOVDconst [c]) [d])
1713 // result: (ADDconst x [int64(uint64(c)>>uint64(d))])
1715 d := auxIntToInt64(v.AuxInt)
1717 if v_1.Op != OpARM64MOVDconst {
1720 c := auxIntToInt64(v_1.AuxInt)
1721 v.reset(OpARM64ADDconst)
1722 v.AuxInt = int64ToAuxInt(int64(uint64(c) >> uint64(d)))
1728 func rewriteValueARM64_OpARM64AND(v *Value) bool {
1731 // match: (AND x (MOVDconst [c]))
1732 // result: (ANDconst [c] x)
1734 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1736 if v_1.Op != OpARM64MOVDconst {
1739 c := auxIntToInt64(v_1.AuxInt)
1740 v.reset(OpARM64ANDconst)
1741 v.AuxInt = int64ToAuxInt(c)
1757 // match: (AND x (MVN y))
1758 // result: (BIC x y)
1760 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1762 if v_1.Op != OpARM64MVN {
1772 // match: (AND x0 x1:(SLLconst [c] y))
1773 // cond: clobberIfDead(x1)
1774 // result: (ANDshiftLL x0 y [c])
1776 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1779 if x1.Op != OpARM64SLLconst {
1782 c := auxIntToInt64(x1.AuxInt)
1784 if !(clobberIfDead(x1)) {
1787 v.reset(OpARM64ANDshiftLL)
1788 v.AuxInt = int64ToAuxInt(c)
1794 // match: (AND x0 x1:(SRLconst [c] y))
1795 // cond: clobberIfDead(x1)
1796 // result: (ANDshiftRL x0 y [c])
1798 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1801 if x1.Op != OpARM64SRLconst {
1804 c := auxIntToInt64(x1.AuxInt)
1806 if !(clobberIfDead(x1)) {
1809 v.reset(OpARM64ANDshiftRL)
1810 v.AuxInt = int64ToAuxInt(c)
1816 // match: (AND x0 x1:(SRAconst [c] y))
1817 // cond: clobberIfDead(x1)
1818 // result: (ANDshiftRA x0 y [c])
1820 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1823 if x1.Op != OpARM64SRAconst {
1826 c := auxIntToInt64(x1.AuxInt)
1828 if !(clobberIfDead(x1)) {
1831 v.reset(OpARM64ANDshiftRA)
1832 v.AuxInt = int64ToAuxInt(c)
1838 // match: (AND x0 x1:(RORconst [c] y))
1839 // cond: clobberIfDead(x1)
1840 // result: (ANDshiftRO x0 y [c])
1842 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1845 if x1.Op != OpARM64RORconst {
1848 c := auxIntToInt64(x1.AuxInt)
1850 if !(clobberIfDead(x1)) {
1853 v.reset(OpARM64ANDshiftRO)
1854 v.AuxInt = int64ToAuxInt(c)
1862 func rewriteValueARM64_OpARM64ANDconst(v *Value) bool {
1864 // match: (ANDconst [0] _)
1865 // result: (MOVDconst [0])
1867 if auxIntToInt64(v.AuxInt) != 0 {
1870 v.reset(OpARM64MOVDconst)
1871 v.AuxInt = int64ToAuxInt(0)
1874 // match: (ANDconst [-1] x)
1877 if auxIntToInt64(v.AuxInt) != -1 {
1884 // match: (ANDconst [c] (MOVDconst [d]))
1885 // result: (MOVDconst [c&d])
1887 c := auxIntToInt64(v.AuxInt)
1888 if v_0.Op != OpARM64MOVDconst {
1891 d := auxIntToInt64(v_0.AuxInt)
1892 v.reset(OpARM64MOVDconst)
1893 v.AuxInt = int64ToAuxInt(c & d)
1896 // match: (ANDconst [c] (ANDconst [d] x))
1897 // result: (ANDconst [c&d] x)
1899 c := auxIntToInt64(v.AuxInt)
1900 if v_0.Op != OpARM64ANDconst {
1903 d := auxIntToInt64(v_0.AuxInt)
1905 v.reset(OpARM64ANDconst)
1906 v.AuxInt = int64ToAuxInt(c & d)
1910 // match: (ANDconst [c] (MOVWUreg x))
1911 // result: (ANDconst [c&(1<<32-1)] x)
1913 c := auxIntToInt64(v.AuxInt)
1914 if v_0.Op != OpARM64MOVWUreg {
1918 v.reset(OpARM64ANDconst)
1919 v.AuxInt = int64ToAuxInt(c & (1<<32 - 1))
1923 // match: (ANDconst [c] (MOVHUreg x))
1924 // result: (ANDconst [c&(1<<16-1)] x)
1926 c := auxIntToInt64(v.AuxInt)
1927 if v_0.Op != OpARM64MOVHUreg {
1931 v.reset(OpARM64ANDconst)
1932 v.AuxInt = int64ToAuxInt(c & (1<<16 - 1))
1936 // match: (ANDconst [c] (MOVBUreg x))
1937 // result: (ANDconst [c&(1<<8-1)] x)
1939 c := auxIntToInt64(v.AuxInt)
1940 if v_0.Op != OpARM64MOVBUreg {
1944 v.reset(OpARM64ANDconst)
1945 v.AuxInt = int64ToAuxInt(c & (1<<8 - 1))
1949 // match: (ANDconst [ac] (SLLconst [sc] x))
1950 // cond: isARM64BFMask(sc, ac, sc)
1951 // result: (UBFIZ [armBFAuxInt(sc, arm64BFWidth(ac, sc))] x)
1953 ac := auxIntToInt64(v.AuxInt)
1954 if v_0.Op != OpARM64SLLconst {
1957 sc := auxIntToInt64(v_0.AuxInt)
1959 if !(isARM64BFMask(sc, ac, sc)) {
1962 v.reset(OpARM64UBFIZ)
1963 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(sc, arm64BFWidth(ac, sc)))
1967 // match: (ANDconst [ac] (SRLconst [sc] x))
1968 // cond: isARM64BFMask(sc, ac, 0)
1969 // result: (UBFX [armBFAuxInt(sc, arm64BFWidth(ac, 0))] x)
1971 ac := auxIntToInt64(v.AuxInt)
1972 if v_0.Op != OpARM64SRLconst {
1975 sc := auxIntToInt64(v_0.AuxInt)
1977 if !(isARM64BFMask(sc, ac, 0)) {
1980 v.reset(OpARM64UBFX)
1981 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(sc, arm64BFWidth(ac, 0)))
1985 // match: (ANDconst [c] (UBFX [bfc] x))
1986 // cond: isARM64BFMask(0, c, 0)
1987 // result: (UBFX [armBFAuxInt(bfc.getARM64BFlsb(), min(bfc.getARM64BFwidth(), arm64BFWidth(c, 0)))] x)
1989 c := auxIntToInt64(v.AuxInt)
1990 if v_0.Op != OpARM64UBFX {
1993 bfc := auxIntToArm64BitField(v_0.AuxInt)
1995 if !(isARM64BFMask(0, c, 0)) {
1998 v.reset(OpARM64UBFX)
1999 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(bfc.getARM64BFlsb(), min(bfc.getARM64BFwidth(), arm64BFWidth(c, 0))))
2005 func rewriteValueARM64_OpARM64ANDshiftLL(v *Value) bool {
2009 // match: (ANDshiftLL (MOVDconst [c]) x [d])
2010 // result: (ANDconst [c] (SLLconst <x.Type> x [d]))
2012 d := auxIntToInt64(v.AuxInt)
2013 if v_0.Op != OpARM64MOVDconst {
2016 c := auxIntToInt64(v_0.AuxInt)
2018 v.reset(OpARM64ANDconst)
2019 v.AuxInt = int64ToAuxInt(c)
2020 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
2021 v0.AuxInt = int64ToAuxInt(d)
2026 // match: (ANDshiftLL x (MOVDconst [c]) [d])
2027 // result: (ANDconst x [int64(uint64(c)<<uint64(d))])
2029 d := auxIntToInt64(v.AuxInt)
2031 if v_1.Op != OpARM64MOVDconst {
2034 c := auxIntToInt64(v_1.AuxInt)
2035 v.reset(OpARM64ANDconst)
2036 v.AuxInt = int64ToAuxInt(int64(uint64(c) << uint64(d)))
2040 // match: (ANDshiftLL y:(SLLconst x [c]) x [c])
2043 c := auxIntToInt64(v.AuxInt)
2045 if y.Op != OpARM64SLLconst || auxIntToInt64(y.AuxInt) != c {
2057 func rewriteValueARM64_OpARM64ANDshiftRA(v *Value) bool {
2061 // match: (ANDshiftRA (MOVDconst [c]) x [d])
2062 // result: (ANDconst [c] (SRAconst <x.Type> x [d]))
2064 d := auxIntToInt64(v.AuxInt)
2065 if v_0.Op != OpARM64MOVDconst {
2068 c := auxIntToInt64(v_0.AuxInt)
2070 v.reset(OpARM64ANDconst)
2071 v.AuxInt = int64ToAuxInt(c)
2072 v0 := b.NewValue0(v.Pos, OpARM64SRAconst, x.Type)
2073 v0.AuxInt = int64ToAuxInt(d)
2078 // match: (ANDshiftRA x (MOVDconst [c]) [d])
2079 // result: (ANDconst x [c>>uint64(d)])
2081 d := auxIntToInt64(v.AuxInt)
2083 if v_1.Op != OpARM64MOVDconst {
2086 c := auxIntToInt64(v_1.AuxInt)
2087 v.reset(OpARM64ANDconst)
2088 v.AuxInt = int64ToAuxInt(c >> uint64(d))
2092 // match: (ANDshiftRA y:(SRAconst x [c]) x [c])
2095 c := auxIntToInt64(v.AuxInt)
2097 if y.Op != OpARM64SRAconst || auxIntToInt64(y.AuxInt) != c {
2109 func rewriteValueARM64_OpARM64ANDshiftRL(v *Value) bool {
2113 // match: (ANDshiftRL (MOVDconst [c]) x [d])
2114 // result: (ANDconst [c] (SRLconst <x.Type> x [d]))
2116 d := auxIntToInt64(v.AuxInt)
2117 if v_0.Op != OpARM64MOVDconst {
2120 c := auxIntToInt64(v_0.AuxInt)
2122 v.reset(OpARM64ANDconst)
2123 v.AuxInt = int64ToAuxInt(c)
2124 v0 := b.NewValue0(v.Pos, OpARM64SRLconst, x.Type)
2125 v0.AuxInt = int64ToAuxInt(d)
2130 // match: (ANDshiftRL x (MOVDconst [c]) [d])
2131 // result: (ANDconst x [int64(uint64(c)>>uint64(d))])
2133 d := auxIntToInt64(v.AuxInt)
2135 if v_1.Op != OpARM64MOVDconst {
2138 c := auxIntToInt64(v_1.AuxInt)
2139 v.reset(OpARM64ANDconst)
2140 v.AuxInt = int64ToAuxInt(int64(uint64(c) >> uint64(d)))
2144 // match: (ANDshiftRL y:(SRLconst x [c]) x [c])
2147 c := auxIntToInt64(v.AuxInt)
2149 if y.Op != OpARM64SRLconst || auxIntToInt64(y.AuxInt) != c {
2161 func rewriteValueARM64_OpARM64ANDshiftRO(v *Value) bool {
2165 // match: (ANDshiftRO (MOVDconst [c]) x [d])
2166 // result: (ANDconst [c] (RORconst <x.Type> x [d]))
2168 d := auxIntToInt64(v.AuxInt)
2169 if v_0.Op != OpARM64MOVDconst {
2172 c := auxIntToInt64(v_0.AuxInt)
2174 v.reset(OpARM64ANDconst)
2175 v.AuxInt = int64ToAuxInt(c)
2176 v0 := b.NewValue0(v.Pos, OpARM64RORconst, x.Type)
2177 v0.AuxInt = int64ToAuxInt(d)
2182 // match: (ANDshiftRO x (MOVDconst [c]) [d])
2183 // result: (ANDconst x [rotateRight64(c, d)])
2185 d := auxIntToInt64(v.AuxInt)
2187 if v_1.Op != OpARM64MOVDconst {
2190 c := auxIntToInt64(v_1.AuxInt)
2191 v.reset(OpARM64ANDconst)
2192 v.AuxInt = int64ToAuxInt(rotateRight64(c, d))
2196 // match: (ANDshiftRO y:(RORconst x [c]) x [c])
2199 c := auxIntToInt64(v.AuxInt)
2201 if y.Op != OpARM64RORconst || auxIntToInt64(y.AuxInt) != c {
2213 func rewriteValueARM64_OpARM64BIC(v *Value) bool {
2216 // match: (BIC x (MOVDconst [c]))
2217 // result: (ANDconst [^c] x)
2220 if v_1.Op != OpARM64MOVDconst {
2223 c := auxIntToInt64(v_1.AuxInt)
2224 v.reset(OpARM64ANDconst)
2225 v.AuxInt = int64ToAuxInt(^c)
2230 // result: (MOVDconst [0])
2236 v.reset(OpARM64MOVDconst)
2237 v.AuxInt = int64ToAuxInt(0)
2240 // match: (BIC x0 x1:(SLLconst [c] y))
2241 // cond: clobberIfDead(x1)
2242 // result: (BICshiftLL x0 y [c])
2246 if x1.Op != OpARM64SLLconst {
2249 c := auxIntToInt64(x1.AuxInt)
2251 if !(clobberIfDead(x1)) {
2254 v.reset(OpARM64BICshiftLL)
2255 v.AuxInt = int64ToAuxInt(c)
2259 // match: (BIC x0 x1:(SRLconst [c] y))
2260 // cond: clobberIfDead(x1)
2261 // result: (BICshiftRL x0 y [c])
2265 if x1.Op != OpARM64SRLconst {
2268 c := auxIntToInt64(x1.AuxInt)
2270 if !(clobberIfDead(x1)) {
2273 v.reset(OpARM64BICshiftRL)
2274 v.AuxInt = int64ToAuxInt(c)
2278 // match: (BIC x0 x1:(SRAconst [c] y))
2279 // cond: clobberIfDead(x1)
2280 // result: (BICshiftRA x0 y [c])
2284 if x1.Op != OpARM64SRAconst {
2287 c := auxIntToInt64(x1.AuxInt)
2289 if !(clobberIfDead(x1)) {
2292 v.reset(OpARM64BICshiftRA)
2293 v.AuxInt = int64ToAuxInt(c)
2297 // match: (BIC x0 x1:(RORconst [c] y))
2298 // cond: clobberIfDead(x1)
2299 // result: (BICshiftRO x0 y [c])
2303 if x1.Op != OpARM64RORconst {
2306 c := auxIntToInt64(x1.AuxInt)
2308 if !(clobberIfDead(x1)) {
2311 v.reset(OpARM64BICshiftRO)
2312 v.AuxInt = int64ToAuxInt(c)
2318 func rewriteValueARM64_OpARM64BICshiftLL(v *Value) bool {
2321 // match: (BICshiftLL x (MOVDconst [c]) [d])
2322 // result: (ANDconst x [^int64(uint64(c)<<uint64(d))])
2324 d := auxIntToInt64(v.AuxInt)
2326 if v_1.Op != OpARM64MOVDconst {
2329 c := auxIntToInt64(v_1.AuxInt)
2330 v.reset(OpARM64ANDconst)
2331 v.AuxInt = int64ToAuxInt(^int64(uint64(c) << uint64(d)))
2335 // match: (BICshiftLL (SLLconst x [c]) x [c])
2336 // result: (MOVDconst [0])
2338 c := auxIntToInt64(v.AuxInt)
2339 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != c {
2346 v.reset(OpARM64MOVDconst)
2347 v.AuxInt = int64ToAuxInt(0)
2352 func rewriteValueARM64_OpARM64BICshiftRA(v *Value) bool {
2355 // match: (BICshiftRA x (MOVDconst [c]) [d])
2356 // result: (ANDconst x [^(c>>uint64(d))])
2358 d := auxIntToInt64(v.AuxInt)
2360 if v_1.Op != OpARM64MOVDconst {
2363 c := auxIntToInt64(v_1.AuxInt)
2364 v.reset(OpARM64ANDconst)
2365 v.AuxInt = int64ToAuxInt(^(c >> uint64(d)))
2369 // match: (BICshiftRA (SRAconst x [c]) x [c])
2370 // result: (MOVDconst [0])
2372 c := auxIntToInt64(v.AuxInt)
2373 if v_0.Op != OpARM64SRAconst || auxIntToInt64(v_0.AuxInt) != c {
2380 v.reset(OpARM64MOVDconst)
2381 v.AuxInt = int64ToAuxInt(0)
2386 func rewriteValueARM64_OpARM64BICshiftRL(v *Value) bool {
2389 // match: (BICshiftRL x (MOVDconst [c]) [d])
2390 // result: (ANDconst x [^int64(uint64(c)>>uint64(d))])
2392 d := auxIntToInt64(v.AuxInt)
2394 if v_1.Op != OpARM64MOVDconst {
2397 c := auxIntToInt64(v_1.AuxInt)
2398 v.reset(OpARM64ANDconst)
2399 v.AuxInt = int64ToAuxInt(^int64(uint64(c) >> uint64(d)))
2403 // match: (BICshiftRL (SRLconst x [c]) x [c])
2404 // result: (MOVDconst [0])
2406 c := auxIntToInt64(v.AuxInt)
2407 if v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != c {
2414 v.reset(OpARM64MOVDconst)
2415 v.AuxInt = int64ToAuxInt(0)
2420 func rewriteValueARM64_OpARM64BICshiftRO(v *Value) bool {
2423 // match: (BICshiftRO x (MOVDconst [c]) [d])
2424 // result: (ANDconst x [^rotateRight64(c, d)])
2426 d := auxIntToInt64(v.AuxInt)
2428 if v_1.Op != OpARM64MOVDconst {
2431 c := auxIntToInt64(v_1.AuxInt)
2432 v.reset(OpARM64ANDconst)
2433 v.AuxInt = int64ToAuxInt(^rotateRight64(c, d))
2437 // match: (BICshiftRO (RORconst x [c]) x [c])
2438 // result: (MOVDconst [0])
2440 c := auxIntToInt64(v.AuxInt)
2441 if v_0.Op != OpARM64RORconst || auxIntToInt64(v_0.AuxInt) != c {
2448 v.reset(OpARM64MOVDconst)
2449 v.AuxInt = int64ToAuxInt(0)
2454 func rewriteValueARM64_OpARM64CMN(v *Value) bool {
2457 // match: (CMN x (MOVDconst [c]))
2458 // result: (CMNconst [c] x)
2460 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
2462 if v_1.Op != OpARM64MOVDconst {
2465 c := auxIntToInt64(v_1.AuxInt)
2466 v.reset(OpARM64CMNconst)
2467 v.AuxInt = int64ToAuxInt(c)
2473 // match: (CMN x0 x1:(SLLconst [c] y))
2474 // cond: clobberIfDead(x1)
2475 // result: (CMNshiftLL x0 y [c])
2477 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
2480 if x1.Op != OpARM64SLLconst {
2483 c := auxIntToInt64(x1.AuxInt)
2485 if !(clobberIfDead(x1)) {
2488 v.reset(OpARM64CMNshiftLL)
2489 v.AuxInt = int64ToAuxInt(c)
2495 // match: (CMN x0 x1:(SRLconst [c] y))
2496 // cond: clobberIfDead(x1)
2497 // result: (CMNshiftRL x0 y [c])
2499 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
2502 if x1.Op != OpARM64SRLconst {
2505 c := auxIntToInt64(x1.AuxInt)
2507 if !(clobberIfDead(x1)) {
2510 v.reset(OpARM64CMNshiftRL)
2511 v.AuxInt = int64ToAuxInt(c)
2517 // match: (CMN x0 x1:(SRAconst [c] y))
2518 // cond: clobberIfDead(x1)
2519 // result: (CMNshiftRA x0 y [c])
2521 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
2524 if x1.Op != OpARM64SRAconst {
2527 c := auxIntToInt64(x1.AuxInt)
2529 if !(clobberIfDead(x1)) {
2532 v.reset(OpARM64CMNshiftRA)
2533 v.AuxInt = int64ToAuxInt(c)
2541 func rewriteValueARM64_OpARM64CMNW(v *Value) bool {
2544 // match: (CMNW x (MOVDconst [c]))
2545 // result: (CMNWconst [int32(c)] x)
2547 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
2549 if v_1.Op != OpARM64MOVDconst {
2552 c := auxIntToInt64(v_1.AuxInt)
2553 v.reset(OpARM64CMNWconst)
2554 v.AuxInt = int32ToAuxInt(int32(c))
2562 func rewriteValueARM64_OpARM64CMNWconst(v *Value) bool {
2564 // match: (CMNWconst [c] y)
2565 // cond: c < 0 && c != -1<<31
2566 // result: (CMPWconst [-c] y)
2568 c := auxIntToInt32(v.AuxInt)
2570 if !(c < 0 && c != -1<<31) {
2573 v.reset(OpARM64CMPWconst)
2574 v.AuxInt = int32ToAuxInt(-c)
2578 // match: (CMNWconst (MOVDconst [x]) [y])
2579 // result: (FlagConstant [addFlags32(int32(x),y)])
2581 y := auxIntToInt32(v.AuxInt)
2582 if v_0.Op != OpARM64MOVDconst {
2585 x := auxIntToInt64(v_0.AuxInt)
2586 v.reset(OpARM64FlagConstant)
2587 v.AuxInt = flagConstantToAuxInt(addFlags32(int32(x), y))
2592 func rewriteValueARM64_OpARM64CMNconst(v *Value) bool {
2594 // match: (CMNconst [c] y)
2595 // cond: c < 0 && c != -1<<63
2596 // result: (CMPconst [-c] y)
2598 c := auxIntToInt64(v.AuxInt)
2600 if !(c < 0 && c != -1<<63) {
2603 v.reset(OpARM64CMPconst)
2604 v.AuxInt = int64ToAuxInt(-c)
2608 // match: (CMNconst (MOVDconst [x]) [y])
2609 // result: (FlagConstant [addFlags64(x,y)])
2611 y := auxIntToInt64(v.AuxInt)
2612 if v_0.Op != OpARM64MOVDconst {
2615 x := auxIntToInt64(v_0.AuxInt)
2616 v.reset(OpARM64FlagConstant)
2617 v.AuxInt = flagConstantToAuxInt(addFlags64(x, y))
2622 func rewriteValueARM64_OpARM64CMNshiftLL(v *Value) bool {
2626 // match: (CMNshiftLL (MOVDconst [c]) x [d])
2627 // result: (CMNconst [c] (SLLconst <x.Type> x [d]))
2629 d := auxIntToInt64(v.AuxInt)
2630 if v_0.Op != OpARM64MOVDconst {
2633 c := auxIntToInt64(v_0.AuxInt)
2635 v.reset(OpARM64CMNconst)
2636 v.AuxInt = int64ToAuxInt(c)
2637 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
2638 v0.AuxInt = int64ToAuxInt(d)
2643 // match: (CMNshiftLL x (MOVDconst [c]) [d])
2644 // result: (CMNconst x [int64(uint64(c)<<uint64(d))])
2646 d := auxIntToInt64(v.AuxInt)
2648 if v_1.Op != OpARM64MOVDconst {
2651 c := auxIntToInt64(v_1.AuxInt)
2652 v.reset(OpARM64CMNconst)
2653 v.AuxInt = int64ToAuxInt(int64(uint64(c) << uint64(d)))
2659 func rewriteValueARM64_OpARM64CMNshiftRA(v *Value) bool {
2663 // match: (CMNshiftRA (MOVDconst [c]) x [d])
2664 // result: (CMNconst [c] (SRAconst <x.Type> x [d]))
2666 d := auxIntToInt64(v.AuxInt)
2667 if v_0.Op != OpARM64MOVDconst {
2670 c := auxIntToInt64(v_0.AuxInt)
2672 v.reset(OpARM64CMNconst)
2673 v.AuxInt = int64ToAuxInt(c)
2674 v0 := b.NewValue0(v.Pos, OpARM64SRAconst, x.Type)
2675 v0.AuxInt = int64ToAuxInt(d)
2680 // match: (CMNshiftRA x (MOVDconst [c]) [d])
2681 // result: (CMNconst x [c>>uint64(d)])
2683 d := auxIntToInt64(v.AuxInt)
2685 if v_1.Op != OpARM64MOVDconst {
2688 c := auxIntToInt64(v_1.AuxInt)
2689 v.reset(OpARM64CMNconst)
2690 v.AuxInt = int64ToAuxInt(c >> uint64(d))
2696 func rewriteValueARM64_OpARM64CMNshiftRL(v *Value) bool {
2700 // match: (CMNshiftRL (MOVDconst [c]) x [d])
2701 // result: (CMNconst [c] (SRLconst <x.Type> x [d]))
2703 d := auxIntToInt64(v.AuxInt)
2704 if v_0.Op != OpARM64MOVDconst {
2707 c := auxIntToInt64(v_0.AuxInt)
2709 v.reset(OpARM64CMNconst)
2710 v.AuxInt = int64ToAuxInt(c)
2711 v0 := b.NewValue0(v.Pos, OpARM64SRLconst, x.Type)
2712 v0.AuxInt = int64ToAuxInt(d)
2717 // match: (CMNshiftRL x (MOVDconst [c]) [d])
2718 // result: (CMNconst x [int64(uint64(c)>>uint64(d))])
2720 d := auxIntToInt64(v.AuxInt)
2722 if v_1.Op != OpARM64MOVDconst {
2725 c := auxIntToInt64(v_1.AuxInt)
2726 v.reset(OpARM64CMNconst)
2727 v.AuxInt = int64ToAuxInt(int64(uint64(c) >> uint64(d)))
2733 func rewriteValueARM64_OpARM64CMP(v *Value) bool {
2737 // match: (CMP x (MOVDconst [c]))
2738 // result: (CMPconst [c] x)
2741 if v_1.Op != OpARM64MOVDconst {
2744 c := auxIntToInt64(v_1.AuxInt)
2745 v.reset(OpARM64CMPconst)
2746 v.AuxInt = int64ToAuxInt(c)
2750 // match: (CMP (MOVDconst [c]) x)
2751 // result: (InvertFlags (CMPconst [c] x))
2753 if v_0.Op != OpARM64MOVDconst {
2756 c := auxIntToInt64(v_0.AuxInt)
2758 v.reset(OpARM64InvertFlags)
2759 v0 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
2760 v0.AuxInt = int64ToAuxInt(c)
2766 // cond: canonLessThan(x,y)
2767 // result: (InvertFlags (CMP y x))
2771 if !(canonLessThan(x, y)) {
2774 v.reset(OpARM64InvertFlags)
2775 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
2780 // match: (CMP x0 x1:(SLLconst [c] y))
2781 // cond: clobberIfDead(x1)
2782 // result: (CMPshiftLL x0 y [c])
2786 if x1.Op != OpARM64SLLconst {
2789 c := auxIntToInt64(x1.AuxInt)
2791 if !(clobberIfDead(x1)) {
2794 v.reset(OpARM64CMPshiftLL)
2795 v.AuxInt = int64ToAuxInt(c)
2799 // match: (CMP x0:(SLLconst [c] y) x1)
2800 // cond: clobberIfDead(x0)
2801 // result: (InvertFlags (CMPshiftLL x1 y [c]))
2804 if x0.Op != OpARM64SLLconst {
2807 c := auxIntToInt64(x0.AuxInt)
2810 if !(clobberIfDead(x0)) {
2813 v.reset(OpARM64InvertFlags)
2814 v0 := b.NewValue0(v.Pos, OpARM64CMPshiftLL, types.TypeFlags)
2815 v0.AuxInt = int64ToAuxInt(c)
2820 // match: (CMP x0 x1:(SRLconst [c] y))
2821 // cond: clobberIfDead(x1)
2822 // result: (CMPshiftRL x0 y [c])
2826 if x1.Op != OpARM64SRLconst {
2829 c := auxIntToInt64(x1.AuxInt)
2831 if !(clobberIfDead(x1)) {
2834 v.reset(OpARM64CMPshiftRL)
2835 v.AuxInt = int64ToAuxInt(c)
2839 // match: (CMP x0:(SRLconst [c] y) x1)
2840 // cond: clobberIfDead(x0)
2841 // result: (InvertFlags (CMPshiftRL x1 y [c]))
2844 if x0.Op != OpARM64SRLconst {
2847 c := auxIntToInt64(x0.AuxInt)
2850 if !(clobberIfDead(x0)) {
2853 v.reset(OpARM64InvertFlags)
2854 v0 := b.NewValue0(v.Pos, OpARM64CMPshiftRL, types.TypeFlags)
2855 v0.AuxInt = int64ToAuxInt(c)
2860 // match: (CMP x0 x1:(SRAconst [c] y))
2861 // cond: clobberIfDead(x1)
2862 // result: (CMPshiftRA x0 y [c])
2866 if x1.Op != OpARM64SRAconst {
2869 c := auxIntToInt64(x1.AuxInt)
2871 if !(clobberIfDead(x1)) {
2874 v.reset(OpARM64CMPshiftRA)
2875 v.AuxInt = int64ToAuxInt(c)
2879 // match: (CMP x0:(SRAconst [c] y) x1)
2880 // cond: clobberIfDead(x0)
2881 // result: (InvertFlags (CMPshiftRA x1 y [c]))
2884 if x0.Op != OpARM64SRAconst {
2887 c := auxIntToInt64(x0.AuxInt)
2890 if !(clobberIfDead(x0)) {
2893 v.reset(OpARM64InvertFlags)
2894 v0 := b.NewValue0(v.Pos, OpARM64CMPshiftRA, types.TypeFlags)
2895 v0.AuxInt = int64ToAuxInt(c)
2902 func rewriteValueARM64_OpARM64CMPW(v *Value) bool {
2906 // match: (CMPW x (MOVDconst [c]))
2907 // result: (CMPWconst [int32(c)] x)
2910 if v_1.Op != OpARM64MOVDconst {
2913 c := auxIntToInt64(v_1.AuxInt)
2914 v.reset(OpARM64CMPWconst)
2915 v.AuxInt = int32ToAuxInt(int32(c))
2919 // match: (CMPW (MOVDconst [c]) x)
2920 // result: (InvertFlags (CMPWconst [int32(c)] x))
2922 if v_0.Op != OpARM64MOVDconst {
2925 c := auxIntToInt64(v_0.AuxInt)
2927 v.reset(OpARM64InvertFlags)
2928 v0 := b.NewValue0(v.Pos, OpARM64CMPWconst, types.TypeFlags)
2929 v0.AuxInt = int32ToAuxInt(int32(c))
2934 // match: (CMPW x y)
2935 // cond: canonLessThan(x,y)
2936 // result: (InvertFlags (CMPW y x))
2940 if !(canonLessThan(x, y)) {
2943 v.reset(OpARM64InvertFlags)
2944 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
2951 func rewriteValueARM64_OpARM64CMPWconst(v *Value) bool {
2953 // match: (CMPWconst [c] y)
2954 // cond: c < 0 && c != -1<<31
2955 // result: (CMNWconst [-c] y)
2957 c := auxIntToInt32(v.AuxInt)
2959 if !(c < 0 && c != -1<<31) {
2962 v.reset(OpARM64CMNWconst)
2963 v.AuxInt = int32ToAuxInt(-c)
2967 // match: (CMPWconst (MOVDconst [x]) [y])
2968 // result: (FlagConstant [subFlags32(int32(x),y)])
2970 y := auxIntToInt32(v.AuxInt)
2971 if v_0.Op != OpARM64MOVDconst {
2974 x := auxIntToInt64(v_0.AuxInt)
2975 v.reset(OpARM64FlagConstant)
2976 v.AuxInt = flagConstantToAuxInt(subFlags32(int32(x), y))
2979 // match: (CMPWconst (MOVBUreg _) [c])
2981 // result: (FlagConstant [subFlags64(0,1)])
2983 c := auxIntToInt32(v.AuxInt)
2984 if v_0.Op != OpARM64MOVBUreg || !(0xff < c) {
2987 v.reset(OpARM64FlagConstant)
2988 v.AuxInt = flagConstantToAuxInt(subFlags64(0, 1))
2991 // match: (CMPWconst (MOVHUreg _) [c])
2993 // result: (FlagConstant [subFlags64(0,1)])
2995 c := auxIntToInt32(v.AuxInt)
2996 if v_0.Op != OpARM64MOVHUreg || !(0xffff < c) {
2999 v.reset(OpARM64FlagConstant)
3000 v.AuxInt = flagConstantToAuxInt(subFlags64(0, 1))
3005 func rewriteValueARM64_OpARM64CMPconst(v *Value) bool {
3007 // match: (CMPconst [c] y)
3008 // cond: c < 0 && c != -1<<63
3009 // result: (CMNconst [-c] y)
3011 c := auxIntToInt64(v.AuxInt)
3013 if !(c < 0 && c != -1<<63) {
3016 v.reset(OpARM64CMNconst)
3017 v.AuxInt = int64ToAuxInt(-c)
3021 // match: (CMPconst (MOVDconst [x]) [y])
3022 // result: (FlagConstant [subFlags64(x,y)])
3024 y := auxIntToInt64(v.AuxInt)
3025 if v_0.Op != OpARM64MOVDconst {
3028 x := auxIntToInt64(v_0.AuxInt)
3029 v.reset(OpARM64FlagConstant)
3030 v.AuxInt = flagConstantToAuxInt(subFlags64(x, y))
3033 // match: (CMPconst (MOVBUreg _) [c])
3035 // result: (FlagConstant [subFlags64(0,1)])
3037 c := auxIntToInt64(v.AuxInt)
3038 if v_0.Op != OpARM64MOVBUreg || !(0xff < c) {
3041 v.reset(OpARM64FlagConstant)
3042 v.AuxInt = flagConstantToAuxInt(subFlags64(0, 1))
3045 // match: (CMPconst (MOVHUreg _) [c])
3047 // result: (FlagConstant [subFlags64(0,1)])
3049 c := auxIntToInt64(v.AuxInt)
3050 if v_0.Op != OpARM64MOVHUreg || !(0xffff < c) {
3053 v.reset(OpARM64FlagConstant)
3054 v.AuxInt = flagConstantToAuxInt(subFlags64(0, 1))
3057 // match: (CMPconst (MOVWUreg _) [c])
3058 // cond: 0xffffffff < c
3059 // result: (FlagConstant [subFlags64(0,1)])
3061 c := auxIntToInt64(v.AuxInt)
3062 if v_0.Op != OpARM64MOVWUreg || !(0xffffffff < c) {
3065 v.reset(OpARM64FlagConstant)
3066 v.AuxInt = flagConstantToAuxInt(subFlags64(0, 1))
3069 // match: (CMPconst (ANDconst _ [m]) [n])
3070 // cond: 0 <= m && m < n
3071 // result: (FlagConstant [subFlags64(0,1)])
3073 n := auxIntToInt64(v.AuxInt)
3074 if v_0.Op != OpARM64ANDconst {
3077 m := auxIntToInt64(v_0.AuxInt)
3078 if !(0 <= m && m < n) {
3081 v.reset(OpARM64FlagConstant)
3082 v.AuxInt = flagConstantToAuxInt(subFlags64(0, 1))
3085 // match: (CMPconst (SRLconst _ [c]) [n])
3086 // cond: 0 <= n && 0 < c && c <= 63 && (1<<uint64(64-c)) <= uint64(n)
3087 // result: (FlagConstant [subFlags64(0,1)])
3089 n := auxIntToInt64(v.AuxInt)
3090 if v_0.Op != OpARM64SRLconst {
3093 c := auxIntToInt64(v_0.AuxInt)
3094 if !(0 <= n && 0 < c && c <= 63 && (1<<uint64(64-c)) <= uint64(n)) {
3097 v.reset(OpARM64FlagConstant)
3098 v.AuxInt = flagConstantToAuxInt(subFlags64(0, 1))
3103 func rewriteValueARM64_OpARM64CMPshiftLL(v *Value) bool {
3107 // match: (CMPshiftLL (MOVDconst [c]) x [d])
3108 // result: (InvertFlags (CMPconst [c] (SLLconst <x.Type> x [d])))
3110 d := auxIntToInt64(v.AuxInt)
3111 if v_0.Op != OpARM64MOVDconst {
3114 c := auxIntToInt64(v_0.AuxInt)
3116 v.reset(OpARM64InvertFlags)
3117 v0 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
3118 v0.AuxInt = int64ToAuxInt(c)
3119 v1 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
3120 v1.AuxInt = int64ToAuxInt(d)
3126 // match: (CMPshiftLL x (MOVDconst [c]) [d])
3127 // result: (CMPconst x [int64(uint64(c)<<uint64(d))])
3129 d := auxIntToInt64(v.AuxInt)
3131 if v_1.Op != OpARM64MOVDconst {
3134 c := auxIntToInt64(v_1.AuxInt)
3135 v.reset(OpARM64CMPconst)
3136 v.AuxInt = int64ToAuxInt(int64(uint64(c) << uint64(d)))
3142 func rewriteValueARM64_OpARM64CMPshiftRA(v *Value) bool {
3146 // match: (CMPshiftRA (MOVDconst [c]) x [d])
3147 // result: (InvertFlags (CMPconst [c] (SRAconst <x.Type> x [d])))
3149 d := auxIntToInt64(v.AuxInt)
3150 if v_0.Op != OpARM64MOVDconst {
3153 c := auxIntToInt64(v_0.AuxInt)
3155 v.reset(OpARM64InvertFlags)
3156 v0 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
3157 v0.AuxInt = int64ToAuxInt(c)
3158 v1 := b.NewValue0(v.Pos, OpARM64SRAconst, x.Type)
3159 v1.AuxInt = int64ToAuxInt(d)
3165 // match: (CMPshiftRA x (MOVDconst [c]) [d])
3166 // result: (CMPconst x [c>>uint64(d)])
3168 d := auxIntToInt64(v.AuxInt)
3170 if v_1.Op != OpARM64MOVDconst {
3173 c := auxIntToInt64(v_1.AuxInt)
3174 v.reset(OpARM64CMPconst)
3175 v.AuxInt = int64ToAuxInt(c >> uint64(d))
3181 func rewriteValueARM64_OpARM64CMPshiftRL(v *Value) bool {
3185 // match: (CMPshiftRL (MOVDconst [c]) x [d])
3186 // result: (InvertFlags (CMPconst [c] (SRLconst <x.Type> x [d])))
3188 d := auxIntToInt64(v.AuxInt)
3189 if v_0.Op != OpARM64MOVDconst {
3192 c := auxIntToInt64(v_0.AuxInt)
3194 v.reset(OpARM64InvertFlags)
3195 v0 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
3196 v0.AuxInt = int64ToAuxInt(c)
3197 v1 := b.NewValue0(v.Pos, OpARM64SRLconst, x.Type)
3198 v1.AuxInt = int64ToAuxInt(d)
3204 // match: (CMPshiftRL x (MOVDconst [c]) [d])
3205 // result: (CMPconst x [int64(uint64(c)>>uint64(d))])
3207 d := auxIntToInt64(v.AuxInt)
3209 if v_1.Op != OpARM64MOVDconst {
3212 c := auxIntToInt64(v_1.AuxInt)
3213 v.reset(OpARM64CMPconst)
3214 v.AuxInt = int64ToAuxInt(int64(uint64(c) >> uint64(d)))
3220 func rewriteValueARM64_OpARM64CSEL(v *Value) bool {
3224 // match: (CSEL [cc] (MOVDconst [-1]) (MOVDconst [0]) flag)
3225 // result: (CSETM [cc] flag)
3227 cc := auxIntToOp(v.AuxInt)
3228 if v_0.Op != OpARM64MOVDconst || auxIntToInt64(v_0.AuxInt) != -1 || v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
3232 v.reset(OpARM64CSETM)
3233 v.AuxInt = opToAuxInt(cc)
3237 // match: (CSEL [cc] (MOVDconst [0]) (MOVDconst [-1]) flag)
3238 // result: (CSETM [arm64Negate(cc)] flag)
3240 cc := auxIntToOp(v.AuxInt)
3241 if v_0.Op != OpARM64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0 || v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
3245 v.reset(OpARM64CSETM)
3246 v.AuxInt = opToAuxInt(arm64Negate(cc))
3250 // match: (CSEL [cc] x (MOVDconst [0]) flag)
3251 // result: (CSEL0 [cc] x flag)
3253 cc := auxIntToOp(v.AuxInt)
3255 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
3259 v.reset(OpARM64CSEL0)
3260 v.AuxInt = opToAuxInt(cc)
3264 // match: (CSEL [cc] (MOVDconst [0]) y flag)
3265 // result: (CSEL0 [arm64Negate(cc)] y flag)
3267 cc := auxIntToOp(v.AuxInt)
3268 if v_0.Op != OpARM64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0 {
3273 v.reset(OpARM64CSEL0)
3274 v.AuxInt = opToAuxInt(arm64Negate(cc))
3278 // match: (CSEL [cc] x (ADDconst [1] a) flag)
3279 // result: (CSINC [cc] x a flag)
3281 cc := auxIntToOp(v.AuxInt)
3283 if v_1.Op != OpARM64ADDconst || auxIntToInt64(v_1.AuxInt) != 1 {
3288 v.reset(OpARM64CSINC)
3289 v.AuxInt = opToAuxInt(cc)
3290 v.AddArg3(x, a, flag)
3293 // match: (CSEL [cc] (ADDconst [1] a) x flag)
3294 // result: (CSINC [arm64Negate(cc)] x a flag)
3296 cc := auxIntToOp(v.AuxInt)
3297 if v_0.Op != OpARM64ADDconst || auxIntToInt64(v_0.AuxInt) != 1 {
3303 v.reset(OpARM64CSINC)
3304 v.AuxInt = opToAuxInt(arm64Negate(cc))
3305 v.AddArg3(x, a, flag)
3308 // match: (CSEL [cc] x (MVN a) flag)
3309 // result: (CSINV [cc] x a flag)
3311 cc := auxIntToOp(v.AuxInt)
3313 if v_1.Op != OpARM64MVN {
3318 v.reset(OpARM64CSINV)
3319 v.AuxInt = opToAuxInt(cc)
3320 v.AddArg3(x, a, flag)
3323 // match: (CSEL [cc] (MVN a) x flag)
3324 // result: (CSINV [arm64Negate(cc)] x a flag)
3326 cc := auxIntToOp(v.AuxInt)
3327 if v_0.Op != OpARM64MVN {
3333 v.reset(OpARM64CSINV)
3334 v.AuxInt = opToAuxInt(arm64Negate(cc))
3335 v.AddArg3(x, a, flag)
3338 // match: (CSEL [cc] x (NEG a) flag)
3339 // result: (CSNEG [cc] x a flag)
3341 cc := auxIntToOp(v.AuxInt)
3343 if v_1.Op != OpARM64NEG {
3348 v.reset(OpARM64CSNEG)
3349 v.AuxInt = opToAuxInt(cc)
3350 v.AddArg3(x, a, flag)
3353 // match: (CSEL [cc] (NEG a) x flag)
3354 // result: (CSNEG [arm64Negate(cc)] x a flag)
3356 cc := auxIntToOp(v.AuxInt)
3357 if v_0.Op != OpARM64NEG {
3363 v.reset(OpARM64CSNEG)
3364 v.AuxInt = opToAuxInt(arm64Negate(cc))
3365 v.AddArg3(x, a, flag)
3368 // match: (CSEL [cc] x y (InvertFlags cmp))
3369 // result: (CSEL [arm64Invert(cc)] x y cmp)
3371 cc := auxIntToOp(v.AuxInt)
3374 if v_2.Op != OpARM64InvertFlags {
3378 v.reset(OpARM64CSEL)
3379 v.AuxInt = opToAuxInt(arm64Invert(cc))
3380 v.AddArg3(x, y, cmp)
3383 // match: (CSEL [cc] x _ flag)
3384 // cond: ccARM64Eval(cc, flag) > 0
3387 cc := auxIntToOp(v.AuxInt)
3390 if !(ccARM64Eval(cc, flag) > 0) {
3396 // match: (CSEL [cc] _ y flag)
3397 // cond: ccARM64Eval(cc, flag) < 0
3400 cc := auxIntToOp(v.AuxInt)
3403 if !(ccARM64Eval(cc, flag) < 0) {
3409 // match: (CSEL [cc] x y (CMPWconst [0] boolval))
3410 // cond: cc == OpARM64NotEqual && flagArg(boolval) != nil
3411 // result: (CSEL [boolval.Op] x y flagArg(boolval))
3413 cc := auxIntToOp(v.AuxInt)
3416 if v_2.Op != OpARM64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
3419 boolval := v_2.Args[0]
3420 if !(cc == OpARM64NotEqual && flagArg(boolval) != nil) {
3423 v.reset(OpARM64CSEL)
3424 v.AuxInt = opToAuxInt(boolval.Op)
3425 v.AddArg3(x, y, flagArg(boolval))
3428 // match: (CSEL [cc] x y (CMPWconst [0] boolval))
3429 // cond: cc == OpARM64Equal && flagArg(boolval) != nil
3430 // result: (CSEL [arm64Negate(boolval.Op)] x y flagArg(boolval))
3432 cc := auxIntToOp(v.AuxInt)
3435 if v_2.Op != OpARM64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
3438 boolval := v_2.Args[0]
3439 if !(cc == OpARM64Equal && flagArg(boolval) != nil) {
3442 v.reset(OpARM64CSEL)
3443 v.AuxInt = opToAuxInt(arm64Negate(boolval.Op))
3444 v.AddArg3(x, y, flagArg(boolval))
3449 func rewriteValueARM64_OpARM64CSEL0(v *Value) bool {
3452 // match: (CSEL0 [cc] x (InvertFlags cmp))
3453 // result: (CSEL0 [arm64Invert(cc)] x cmp)
3455 cc := auxIntToOp(v.AuxInt)
3457 if v_1.Op != OpARM64InvertFlags {
3461 v.reset(OpARM64CSEL0)
3462 v.AuxInt = opToAuxInt(arm64Invert(cc))
3466 // match: (CSEL0 [cc] x flag)
3467 // cond: ccARM64Eval(cc, flag) > 0
3470 cc := auxIntToOp(v.AuxInt)
3473 if !(ccARM64Eval(cc, flag) > 0) {
3479 // match: (CSEL0 [cc] _ flag)
3480 // cond: ccARM64Eval(cc, flag) < 0
3481 // result: (MOVDconst [0])
3483 cc := auxIntToOp(v.AuxInt)
3485 if !(ccARM64Eval(cc, flag) < 0) {
3488 v.reset(OpARM64MOVDconst)
3489 v.AuxInt = int64ToAuxInt(0)
3492 // match: (CSEL0 [cc] x (CMPWconst [0] boolval))
3493 // cond: cc == OpARM64NotEqual && flagArg(boolval) != nil
3494 // result: (CSEL0 [boolval.Op] x flagArg(boolval))
3496 cc := auxIntToOp(v.AuxInt)
3498 if v_1.Op != OpARM64CMPWconst || auxIntToInt32(v_1.AuxInt) != 0 {
3501 boolval := v_1.Args[0]
3502 if !(cc == OpARM64NotEqual && flagArg(boolval) != nil) {
3505 v.reset(OpARM64CSEL0)
3506 v.AuxInt = opToAuxInt(boolval.Op)
3507 v.AddArg2(x, flagArg(boolval))
3510 // match: (CSEL0 [cc] x (CMPWconst [0] boolval))
3511 // cond: cc == OpARM64Equal && flagArg(boolval) != nil
3512 // result: (CSEL0 [arm64Negate(boolval.Op)] x flagArg(boolval))
3514 cc := auxIntToOp(v.AuxInt)
3516 if v_1.Op != OpARM64CMPWconst || auxIntToInt32(v_1.AuxInt) != 0 {
3519 boolval := v_1.Args[0]
3520 if !(cc == OpARM64Equal && flagArg(boolval) != nil) {
3523 v.reset(OpARM64CSEL0)
3524 v.AuxInt = opToAuxInt(arm64Negate(boolval.Op))
3525 v.AddArg2(x, flagArg(boolval))
3530 func rewriteValueARM64_OpARM64CSETM(v *Value) bool {
3532 // match: (CSETM [cc] (InvertFlags cmp))
3533 // result: (CSETM [arm64Invert(cc)] cmp)
3535 cc := auxIntToOp(v.AuxInt)
3536 if v_0.Op != OpARM64InvertFlags {
3540 v.reset(OpARM64CSETM)
3541 v.AuxInt = opToAuxInt(arm64Invert(cc))
3545 // match: (CSETM [cc] flag)
3546 // cond: ccARM64Eval(cc, flag) > 0
3547 // result: (MOVDconst [-1])
3549 cc := auxIntToOp(v.AuxInt)
3551 if !(ccARM64Eval(cc, flag) > 0) {
3554 v.reset(OpARM64MOVDconst)
3555 v.AuxInt = int64ToAuxInt(-1)
3558 // match: (CSETM [cc] flag)
3559 // cond: ccARM64Eval(cc, flag) < 0
3560 // result: (MOVDconst [0])
3562 cc := auxIntToOp(v.AuxInt)
3564 if !(ccARM64Eval(cc, flag) < 0) {
3567 v.reset(OpARM64MOVDconst)
3568 v.AuxInt = int64ToAuxInt(0)
3573 func rewriteValueARM64_OpARM64CSINC(v *Value) bool {
3577 // match: (CSINC [cc] x y (InvertFlags cmp))
3578 // result: (CSINC [arm64Invert(cc)] x y cmp)
3580 cc := auxIntToOp(v.AuxInt)
3583 if v_2.Op != OpARM64InvertFlags {
3587 v.reset(OpARM64CSINC)
3588 v.AuxInt = opToAuxInt(arm64Invert(cc))
3589 v.AddArg3(x, y, cmp)
3592 // match: (CSINC [cc] x _ flag)
3593 // cond: ccARM64Eval(cc, flag) > 0
3596 cc := auxIntToOp(v.AuxInt)
3599 if !(ccARM64Eval(cc, flag) > 0) {
3605 // match: (CSINC [cc] _ y flag)
3606 // cond: ccARM64Eval(cc, flag) < 0
3607 // result: (ADDconst [1] y)
3609 cc := auxIntToOp(v.AuxInt)
3612 if !(ccARM64Eval(cc, flag) < 0) {
3615 v.reset(OpARM64ADDconst)
3616 v.AuxInt = int64ToAuxInt(1)
3622 func rewriteValueARM64_OpARM64CSINV(v *Value) bool {
3626 // match: (CSINV [cc] x y (InvertFlags cmp))
3627 // result: (CSINV [arm64Invert(cc)] x y cmp)
3629 cc := auxIntToOp(v.AuxInt)
3632 if v_2.Op != OpARM64InvertFlags {
3636 v.reset(OpARM64CSINV)
3637 v.AuxInt = opToAuxInt(arm64Invert(cc))
3638 v.AddArg3(x, y, cmp)
3641 // match: (CSINV [cc] x _ flag)
3642 // cond: ccARM64Eval(cc, flag) > 0
3645 cc := auxIntToOp(v.AuxInt)
3648 if !(ccARM64Eval(cc, flag) > 0) {
3654 // match: (CSINV [cc] _ y flag)
3655 // cond: ccARM64Eval(cc, flag) < 0
3658 cc := auxIntToOp(v.AuxInt)
3661 if !(ccARM64Eval(cc, flag) < 0) {
3670 func rewriteValueARM64_OpARM64CSNEG(v *Value) bool {
3674 // match: (CSNEG [cc] x y (InvertFlags cmp))
3675 // result: (CSNEG [arm64Invert(cc)] x y cmp)
3677 cc := auxIntToOp(v.AuxInt)
3680 if v_2.Op != OpARM64InvertFlags {
3684 v.reset(OpARM64CSNEG)
3685 v.AuxInt = opToAuxInt(arm64Invert(cc))
3686 v.AddArg3(x, y, cmp)
3689 // match: (CSNEG [cc] x _ flag)
3690 // cond: ccARM64Eval(cc, flag) > 0
3693 cc := auxIntToOp(v.AuxInt)
3696 if !(ccARM64Eval(cc, flag) > 0) {
3702 // match: (CSNEG [cc] _ y flag)
3703 // cond: ccARM64Eval(cc, flag) < 0
3706 cc := auxIntToOp(v.AuxInt)
3709 if !(ccARM64Eval(cc, flag) < 0) {
3718 func rewriteValueARM64_OpARM64DIV(v *Value) bool {
3721 // match: (DIV (MOVDconst [c]) (MOVDconst [d]))
3723 // result: (MOVDconst [c/d])
3725 if v_0.Op != OpARM64MOVDconst {
3728 c := auxIntToInt64(v_0.AuxInt)
3729 if v_1.Op != OpARM64MOVDconst {
3732 d := auxIntToInt64(v_1.AuxInt)
3736 v.reset(OpARM64MOVDconst)
3737 v.AuxInt = int64ToAuxInt(c / d)
3742 func rewriteValueARM64_OpARM64DIVW(v *Value) bool {
3745 // match: (DIVW (MOVDconst [c]) (MOVDconst [d]))
3747 // result: (MOVDconst [int64(uint32(int32(c)/int32(d)))])
3749 if v_0.Op != OpARM64MOVDconst {
3752 c := auxIntToInt64(v_0.AuxInt)
3753 if v_1.Op != OpARM64MOVDconst {
3756 d := auxIntToInt64(v_1.AuxInt)
3760 v.reset(OpARM64MOVDconst)
3761 v.AuxInt = int64ToAuxInt(int64(uint32(int32(c) / int32(d))))
3766 func rewriteValueARM64_OpARM64EON(v *Value) bool {
3769 // match: (EON x (MOVDconst [c]))
3770 // result: (XORconst [^c] x)
3773 if v_1.Op != OpARM64MOVDconst {
3776 c := auxIntToInt64(v_1.AuxInt)
3777 v.reset(OpARM64XORconst)
3778 v.AuxInt = int64ToAuxInt(^c)
3783 // result: (MOVDconst [-1])
3789 v.reset(OpARM64MOVDconst)
3790 v.AuxInt = int64ToAuxInt(-1)
3793 // match: (EON x0 x1:(SLLconst [c] y))
3794 // cond: clobberIfDead(x1)
3795 // result: (EONshiftLL x0 y [c])
3799 if x1.Op != OpARM64SLLconst {
3802 c := auxIntToInt64(x1.AuxInt)
3804 if !(clobberIfDead(x1)) {
3807 v.reset(OpARM64EONshiftLL)
3808 v.AuxInt = int64ToAuxInt(c)
3812 // match: (EON x0 x1:(SRLconst [c] y))
3813 // cond: clobberIfDead(x1)
3814 // result: (EONshiftRL x0 y [c])
3818 if x1.Op != OpARM64SRLconst {
3821 c := auxIntToInt64(x1.AuxInt)
3823 if !(clobberIfDead(x1)) {
3826 v.reset(OpARM64EONshiftRL)
3827 v.AuxInt = int64ToAuxInt(c)
3831 // match: (EON x0 x1:(SRAconst [c] y))
3832 // cond: clobberIfDead(x1)
3833 // result: (EONshiftRA x0 y [c])
3837 if x1.Op != OpARM64SRAconst {
3840 c := auxIntToInt64(x1.AuxInt)
3842 if !(clobberIfDead(x1)) {
3845 v.reset(OpARM64EONshiftRA)
3846 v.AuxInt = int64ToAuxInt(c)
3850 // match: (EON x0 x1:(RORconst [c] y))
3851 // cond: clobberIfDead(x1)
3852 // result: (EONshiftRO x0 y [c])
3856 if x1.Op != OpARM64RORconst {
3859 c := auxIntToInt64(x1.AuxInt)
3861 if !(clobberIfDead(x1)) {
3864 v.reset(OpARM64EONshiftRO)
3865 v.AuxInt = int64ToAuxInt(c)
3871 func rewriteValueARM64_OpARM64EONshiftLL(v *Value) bool {
3874 // match: (EONshiftLL x (MOVDconst [c]) [d])
3875 // result: (XORconst x [^int64(uint64(c)<<uint64(d))])
3877 d := auxIntToInt64(v.AuxInt)
3879 if v_1.Op != OpARM64MOVDconst {
3882 c := auxIntToInt64(v_1.AuxInt)
3883 v.reset(OpARM64XORconst)
3884 v.AuxInt = int64ToAuxInt(^int64(uint64(c) << uint64(d)))
3888 // match: (EONshiftLL (SLLconst x [c]) x [c])
3889 // result: (MOVDconst [-1])
3891 c := auxIntToInt64(v.AuxInt)
3892 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != c {
3899 v.reset(OpARM64MOVDconst)
3900 v.AuxInt = int64ToAuxInt(-1)
3905 func rewriteValueARM64_OpARM64EONshiftRA(v *Value) bool {
3908 // match: (EONshiftRA x (MOVDconst [c]) [d])
3909 // result: (XORconst x [^(c>>uint64(d))])
3911 d := auxIntToInt64(v.AuxInt)
3913 if v_1.Op != OpARM64MOVDconst {
3916 c := auxIntToInt64(v_1.AuxInt)
3917 v.reset(OpARM64XORconst)
3918 v.AuxInt = int64ToAuxInt(^(c >> uint64(d)))
3922 // match: (EONshiftRA (SRAconst x [c]) x [c])
3923 // result: (MOVDconst [-1])
3925 c := auxIntToInt64(v.AuxInt)
3926 if v_0.Op != OpARM64SRAconst || auxIntToInt64(v_0.AuxInt) != c {
3933 v.reset(OpARM64MOVDconst)
3934 v.AuxInt = int64ToAuxInt(-1)
3939 func rewriteValueARM64_OpARM64EONshiftRL(v *Value) bool {
3942 // match: (EONshiftRL x (MOVDconst [c]) [d])
3943 // result: (XORconst x [^int64(uint64(c)>>uint64(d))])
3945 d := auxIntToInt64(v.AuxInt)
3947 if v_1.Op != OpARM64MOVDconst {
3950 c := auxIntToInt64(v_1.AuxInt)
3951 v.reset(OpARM64XORconst)
3952 v.AuxInt = int64ToAuxInt(^int64(uint64(c) >> uint64(d)))
3956 // match: (EONshiftRL (SRLconst x [c]) x [c])
3957 // result: (MOVDconst [-1])
3959 c := auxIntToInt64(v.AuxInt)
3960 if v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != c {
3967 v.reset(OpARM64MOVDconst)
3968 v.AuxInt = int64ToAuxInt(-1)
3973 func rewriteValueARM64_OpARM64EONshiftRO(v *Value) bool {
3976 // match: (EONshiftRO x (MOVDconst [c]) [d])
3977 // result: (XORconst x [^rotateRight64(c, d)])
3979 d := auxIntToInt64(v.AuxInt)
3981 if v_1.Op != OpARM64MOVDconst {
3984 c := auxIntToInt64(v_1.AuxInt)
3985 v.reset(OpARM64XORconst)
3986 v.AuxInt = int64ToAuxInt(^rotateRight64(c, d))
3990 // match: (EONshiftRO (RORconst x [c]) x [c])
3991 // result: (MOVDconst [-1])
3993 c := auxIntToInt64(v.AuxInt)
3994 if v_0.Op != OpARM64RORconst || auxIntToInt64(v_0.AuxInt) != c {
4001 v.reset(OpARM64MOVDconst)
4002 v.AuxInt = int64ToAuxInt(-1)
4007 func rewriteValueARM64_OpARM64Equal(v *Value) bool {
4010 // match: (Equal (CMPconst [0] z:(AND x y)))
4011 // cond: z.Uses == 1
4012 // result: (Equal (TST x y))
4014 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
4018 if z.Op != OpARM64AND {
4026 v.reset(OpARM64Equal)
4027 v0 := b.NewValue0(v.Pos, OpARM64TST, types.TypeFlags)
4032 // match: (Equal (CMPWconst [0] x:(ANDconst [c] y)))
4033 // cond: x.Uses == 1
4034 // result: (Equal (TSTWconst [int32(c)] y))
4036 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
4040 if x.Op != OpARM64ANDconst {
4043 c := auxIntToInt64(x.AuxInt)
4048 v.reset(OpARM64Equal)
4049 v0 := b.NewValue0(v.Pos, OpARM64TSTWconst, types.TypeFlags)
4050 v0.AuxInt = int32ToAuxInt(int32(c))
4055 // match: (Equal (CMPWconst [0] z:(AND x y)))
4056 // cond: z.Uses == 1
4057 // result: (Equal (TSTW x y))
4059 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
4063 if z.Op != OpARM64AND {
4071 v.reset(OpARM64Equal)
4072 v0 := b.NewValue0(v.Pos, OpARM64TSTW, types.TypeFlags)
4077 // match: (Equal (CMPconst [0] x:(ANDconst [c] y)))
4078 // cond: x.Uses == 1
4079 // result: (Equal (TSTconst [c] y))
4081 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
4085 if x.Op != OpARM64ANDconst {
4088 c := auxIntToInt64(x.AuxInt)
4093 v.reset(OpARM64Equal)
4094 v0 := b.NewValue0(v.Pos, OpARM64TSTconst, types.TypeFlags)
4095 v0.AuxInt = int64ToAuxInt(c)
4100 // match: (Equal (CMP x z:(NEG y)))
4101 // cond: z.Uses == 1
4102 // result: (Equal (CMN x y))
4104 if v_0.Op != OpARM64CMP {
4110 if z.Op != OpARM64NEG {
4117 v.reset(OpARM64Equal)
4118 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
4123 // match: (Equal (CMPW x z:(NEG y)))
4124 // cond: z.Uses == 1
4125 // result: (Equal (CMNW x y))
4127 if v_0.Op != OpARM64CMPW {
4133 if z.Op != OpARM64NEG {
4140 v.reset(OpARM64Equal)
4141 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
4146 // match: (Equal (CMPconst [0] x:(ADDconst [c] y)))
4147 // cond: x.Uses == 1
4148 // result: (Equal (CMNconst [c] y))
4150 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
4154 if x.Op != OpARM64ADDconst {
4157 c := auxIntToInt64(x.AuxInt)
4162 v.reset(OpARM64Equal)
4163 v0 := b.NewValue0(v.Pos, OpARM64CMNconst, types.TypeFlags)
4164 v0.AuxInt = int64ToAuxInt(c)
4169 // match: (Equal (CMPWconst [0] x:(ADDconst [c] y)))
4170 // cond: x.Uses == 1
4171 // result: (Equal (CMNWconst [int32(c)] y))
4173 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
4177 if x.Op != OpARM64ADDconst {
4180 c := auxIntToInt64(x.AuxInt)
4185 v.reset(OpARM64Equal)
4186 v0 := b.NewValue0(v.Pos, OpARM64CMNWconst, types.TypeFlags)
4187 v0.AuxInt = int32ToAuxInt(int32(c))
4192 // match: (Equal (CMPconst [0] z:(ADD x y)))
4193 // cond: z.Uses == 1
4194 // result: (Equal (CMN x y))
4196 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
4200 if z.Op != OpARM64ADD {
4208 v.reset(OpARM64Equal)
4209 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
4214 // match: (Equal (CMPWconst [0] z:(ADD x y)))
4215 // cond: z.Uses == 1
4216 // result: (Equal (CMNW x y))
4218 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
4222 if z.Op != OpARM64ADD {
4230 v.reset(OpARM64Equal)
4231 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
4236 // match: (Equal (CMPconst [0] z:(MADD a x y)))
4237 // cond: z.Uses == 1
4238 // result: (Equal (CMN a (MUL <x.Type> x y)))
4240 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
4244 if z.Op != OpARM64MADD {
4253 v.reset(OpARM64Equal)
4254 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
4255 v1 := b.NewValue0(v.Pos, OpARM64MUL, x.Type)
4261 // match: (Equal (CMPconst [0] z:(MSUB a x y)))
4262 // cond: z.Uses == 1
4263 // result: (Equal (CMP a (MUL <x.Type> x y)))
4265 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
4269 if z.Op != OpARM64MSUB {
4278 v.reset(OpARM64Equal)
4279 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
4280 v1 := b.NewValue0(v.Pos, OpARM64MUL, x.Type)
4286 // match: (Equal (CMPWconst [0] z:(MADDW a x y)))
4287 // cond: z.Uses == 1
4288 // result: (Equal (CMNW a (MULW <x.Type> x y)))
4290 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
4294 if z.Op != OpARM64MADDW {
4303 v.reset(OpARM64Equal)
4304 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
4305 v1 := b.NewValue0(v.Pos, OpARM64MULW, x.Type)
4311 // match: (Equal (CMPWconst [0] z:(MSUBW a x y)))
4312 // cond: z.Uses == 1
4313 // result: (Equal (CMPW a (MULW <x.Type> x y)))
4315 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
4319 if z.Op != OpARM64MSUBW {
4328 v.reset(OpARM64Equal)
4329 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
4330 v1 := b.NewValue0(v.Pos, OpARM64MULW, x.Type)
4336 // match: (Equal (FlagConstant [fc]))
4337 // result: (MOVDconst [b2i(fc.eq())])
4339 if v_0.Op != OpARM64FlagConstant {
4342 fc := auxIntToFlagConstant(v_0.AuxInt)
4343 v.reset(OpARM64MOVDconst)
4344 v.AuxInt = int64ToAuxInt(b2i(fc.eq()))
4347 // match: (Equal (InvertFlags x))
4348 // result: (Equal x)
4350 if v_0.Op != OpARM64InvertFlags {
4354 v.reset(OpARM64Equal)
4360 func rewriteValueARM64_OpARM64FADDD(v *Value) bool {
4363 // match: (FADDD a (FMULD x y))
4364 // cond: a.Block.Func.useFMA(v)
4365 // result: (FMADDD a x y)
4367 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4369 if v_1.Op != OpARM64FMULD {
4374 if !(a.Block.Func.useFMA(v)) {
4377 v.reset(OpARM64FMADDD)
4383 // match: (FADDD a (FNMULD x y))
4384 // cond: a.Block.Func.useFMA(v)
4385 // result: (FMSUBD a x y)
4387 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4389 if v_1.Op != OpARM64FNMULD {
4394 if !(a.Block.Func.useFMA(v)) {
4397 v.reset(OpARM64FMSUBD)
4405 func rewriteValueARM64_OpARM64FADDS(v *Value) bool {
4408 // match: (FADDS a (FMULS x y))
4409 // cond: a.Block.Func.useFMA(v)
4410 // result: (FMADDS a x y)
4412 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4414 if v_1.Op != OpARM64FMULS {
4419 if !(a.Block.Func.useFMA(v)) {
4422 v.reset(OpARM64FMADDS)
4428 // match: (FADDS a (FNMULS x y))
4429 // cond: a.Block.Func.useFMA(v)
4430 // result: (FMSUBS a x y)
4432 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4434 if v_1.Op != OpARM64FNMULS {
4439 if !(a.Block.Func.useFMA(v)) {
4442 v.reset(OpARM64FMSUBS)
4450 func rewriteValueARM64_OpARM64FCMPD(v *Value) bool {
4454 // match: (FCMPD x (FMOVDconst [0]))
4455 // result: (FCMPD0 x)
4458 if v_1.Op != OpARM64FMOVDconst || auxIntToFloat64(v_1.AuxInt) != 0 {
4461 v.reset(OpARM64FCMPD0)
4465 // match: (FCMPD (FMOVDconst [0]) x)
4466 // result: (InvertFlags (FCMPD0 x))
4468 if v_0.Op != OpARM64FMOVDconst || auxIntToFloat64(v_0.AuxInt) != 0 {
4472 v.reset(OpARM64InvertFlags)
4473 v0 := b.NewValue0(v.Pos, OpARM64FCMPD0, types.TypeFlags)
4480 func rewriteValueARM64_OpARM64FCMPS(v *Value) bool {
4484 // match: (FCMPS x (FMOVSconst [0]))
4485 // result: (FCMPS0 x)
4488 if v_1.Op != OpARM64FMOVSconst || auxIntToFloat64(v_1.AuxInt) != 0 {
4491 v.reset(OpARM64FCMPS0)
4495 // match: (FCMPS (FMOVSconst [0]) x)
4496 // result: (InvertFlags (FCMPS0 x))
4498 if v_0.Op != OpARM64FMOVSconst || auxIntToFloat64(v_0.AuxInt) != 0 {
4502 v.reset(OpARM64InvertFlags)
4503 v0 := b.NewValue0(v.Pos, OpARM64FCMPS0, types.TypeFlags)
4510 func rewriteValueARM64_OpARM64FMOVDfpgp(v *Value) bool {
4513 // match: (FMOVDfpgp <t> (Arg [off] {sym}))
4514 // result: @b.Func.Entry (Arg <t> [off] {sym})
4517 if v_0.Op != OpArg {
4520 off := auxIntToInt32(v_0.AuxInt)
4521 sym := auxToSym(v_0.Aux)
4523 v0 := b.NewValue0(v.Pos, OpArg, t)
4525 v0.AuxInt = int32ToAuxInt(off)
4526 v0.Aux = symToAux(sym)
4531 func rewriteValueARM64_OpARM64FMOVDgpfp(v *Value) bool {
4534 // match: (FMOVDgpfp <t> (Arg [off] {sym}))
4535 // result: @b.Func.Entry (Arg <t> [off] {sym})
4538 if v_0.Op != OpArg {
4541 off := auxIntToInt32(v_0.AuxInt)
4542 sym := auxToSym(v_0.Aux)
4544 v0 := b.NewValue0(v.Pos, OpArg, t)
4546 v0.AuxInt = int32ToAuxInt(off)
4547 v0.Aux = symToAux(sym)
4552 func rewriteValueARM64_OpARM64FMOVDload(v *Value) bool {
4556 config := b.Func.Config
4557 // match: (FMOVDload [off] {sym} ptr (MOVDstore [off] {sym} ptr val _))
4558 // result: (FMOVDgpfp val)
4560 off := auxIntToInt32(v.AuxInt)
4561 sym := auxToSym(v.Aux)
4563 if v_1.Op != OpARM64MOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
4567 if ptr != v_1.Args[0] {
4570 v.reset(OpARM64FMOVDgpfp)
4574 // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
4575 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
4576 // result: (FMOVDload [off1+int32(off2)] {sym} ptr mem)
4578 off1 := auxIntToInt32(v.AuxInt)
4579 sym := auxToSym(v.Aux)
4580 if v_0.Op != OpARM64ADDconst {
4583 off2 := auxIntToInt64(v_0.AuxInt)
4586 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
4589 v.reset(OpARM64FMOVDload)
4590 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
4591 v.Aux = symToAux(sym)
4595 // match: (FMOVDload [off] {sym} (ADD ptr idx) mem)
4596 // cond: off == 0 && sym == nil
4597 // result: (FMOVDloadidx ptr idx mem)
4599 off := auxIntToInt32(v.AuxInt)
4600 sym := auxToSym(v.Aux)
4601 if v_0.Op != OpARM64ADD {
4607 if !(off == 0 && sym == nil) {
4610 v.reset(OpARM64FMOVDloadidx)
4611 v.AddArg3(ptr, idx, mem)
4614 // match: (FMOVDload [off] {sym} (ADDshiftLL [3] ptr idx) mem)
4615 // cond: off == 0 && sym == nil
4616 // result: (FMOVDloadidx8 ptr idx mem)
4618 off := auxIntToInt32(v.AuxInt)
4619 sym := auxToSym(v.Aux)
4620 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 3 {
4626 if !(off == 0 && sym == nil) {
4629 v.reset(OpARM64FMOVDloadidx8)
4630 v.AddArg3(ptr, idx, mem)
4633 // match: (FMOVDload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
4634 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
4635 // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
4637 off1 := auxIntToInt32(v.AuxInt)
4638 sym1 := auxToSym(v.Aux)
4639 if v_0.Op != OpARM64MOVDaddr {
4642 off2 := auxIntToInt32(v_0.AuxInt)
4643 sym2 := auxToSym(v_0.Aux)
4646 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
4649 v.reset(OpARM64FMOVDload)
4650 v.AuxInt = int32ToAuxInt(off1 + off2)
4651 v.Aux = symToAux(mergeSym(sym1, sym2))
4657 func rewriteValueARM64_OpARM64FMOVDloadidx(v *Value) bool {
4661 // match: (FMOVDloadidx ptr (MOVDconst [c]) mem)
4663 // result: (FMOVDload [int32(c)] ptr mem)
4666 if v_1.Op != OpARM64MOVDconst {
4669 c := auxIntToInt64(v_1.AuxInt)
4674 v.reset(OpARM64FMOVDload)
4675 v.AuxInt = int32ToAuxInt(int32(c))
4679 // match: (FMOVDloadidx (MOVDconst [c]) ptr mem)
4681 // result: (FMOVDload [int32(c)] ptr mem)
4683 if v_0.Op != OpARM64MOVDconst {
4686 c := auxIntToInt64(v_0.AuxInt)
4692 v.reset(OpARM64FMOVDload)
4693 v.AuxInt = int32ToAuxInt(int32(c))
4697 // match: (FMOVDloadidx ptr (SLLconst [3] idx) mem)
4698 // result: (FMOVDloadidx8 ptr idx mem)
4701 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 3 {
4706 v.reset(OpARM64FMOVDloadidx8)
4707 v.AddArg3(ptr, idx, mem)
4710 // match: (FMOVDloadidx (SLLconst [3] idx) ptr mem)
4711 // result: (FMOVDloadidx8 ptr idx mem)
4713 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 3 {
4719 v.reset(OpARM64FMOVDloadidx8)
4720 v.AddArg3(ptr, idx, mem)
4725 func rewriteValueARM64_OpARM64FMOVDloadidx8(v *Value) bool {
4729 // match: (FMOVDloadidx8 ptr (MOVDconst [c]) mem)
4730 // cond: is32Bit(c<<3)
4731 // result: (FMOVDload ptr [int32(c)<<3] mem)
4734 if v_1.Op != OpARM64MOVDconst {
4737 c := auxIntToInt64(v_1.AuxInt)
4739 if !(is32Bit(c << 3)) {
4742 v.reset(OpARM64FMOVDload)
4743 v.AuxInt = int32ToAuxInt(int32(c) << 3)
4749 func rewriteValueARM64_OpARM64FMOVDstore(v *Value) bool {
4754 config := b.Func.Config
4755 // match: (FMOVDstore [off] {sym} ptr (FMOVDgpfp val) mem)
4756 // result: (MOVDstore [off] {sym} ptr val mem)
4758 off := auxIntToInt32(v.AuxInt)
4759 sym := auxToSym(v.Aux)
4761 if v_1.Op != OpARM64FMOVDgpfp {
4766 v.reset(OpARM64MOVDstore)
4767 v.AuxInt = int32ToAuxInt(off)
4768 v.Aux = symToAux(sym)
4769 v.AddArg3(ptr, val, mem)
4772 // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
4773 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
4774 // result: (FMOVDstore [off1+int32(off2)] {sym} ptr val mem)
4776 off1 := auxIntToInt32(v.AuxInt)
4777 sym := auxToSym(v.Aux)
4778 if v_0.Op != OpARM64ADDconst {
4781 off2 := auxIntToInt64(v_0.AuxInt)
4785 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
4788 v.reset(OpARM64FMOVDstore)
4789 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
4790 v.Aux = symToAux(sym)
4791 v.AddArg3(ptr, val, mem)
4794 // match: (FMOVDstore [off] {sym} (ADD ptr idx) val mem)
4795 // cond: off == 0 && sym == nil
4796 // result: (FMOVDstoreidx ptr idx val mem)
4798 off := auxIntToInt32(v.AuxInt)
4799 sym := auxToSym(v.Aux)
4800 if v_0.Op != OpARM64ADD {
4807 if !(off == 0 && sym == nil) {
4810 v.reset(OpARM64FMOVDstoreidx)
4811 v.AddArg4(ptr, idx, val, mem)
4814 // match: (FMOVDstore [off] {sym} (ADDshiftLL [3] ptr idx) val mem)
4815 // cond: off == 0 && sym == nil
4816 // result: (FMOVDstoreidx8 ptr idx val mem)
4818 off := auxIntToInt32(v.AuxInt)
4819 sym := auxToSym(v.Aux)
4820 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 3 {
4827 if !(off == 0 && sym == nil) {
4830 v.reset(OpARM64FMOVDstoreidx8)
4831 v.AddArg4(ptr, idx, val, mem)
4834 // match: (FMOVDstore [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) val mem)
4835 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
4836 // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
4838 off1 := auxIntToInt32(v.AuxInt)
4839 sym1 := auxToSym(v.Aux)
4840 if v_0.Op != OpARM64MOVDaddr {
4843 off2 := auxIntToInt32(v_0.AuxInt)
4844 sym2 := auxToSym(v_0.Aux)
4848 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
4851 v.reset(OpARM64FMOVDstore)
4852 v.AuxInt = int32ToAuxInt(off1 + off2)
4853 v.Aux = symToAux(mergeSym(sym1, sym2))
4854 v.AddArg3(ptr, val, mem)
4859 func rewriteValueARM64_OpARM64FMOVDstoreidx(v *Value) bool {
4864 // match: (FMOVDstoreidx ptr (MOVDconst [c]) val mem)
4866 // result: (FMOVDstore [int32(c)] ptr val mem)
4869 if v_1.Op != OpARM64MOVDconst {
4872 c := auxIntToInt64(v_1.AuxInt)
4878 v.reset(OpARM64FMOVDstore)
4879 v.AuxInt = int32ToAuxInt(int32(c))
4880 v.AddArg3(ptr, val, mem)
4883 // match: (FMOVDstoreidx (MOVDconst [c]) idx val mem)
4885 // result: (FMOVDstore [int32(c)] idx val mem)
4887 if v_0.Op != OpARM64MOVDconst {
4890 c := auxIntToInt64(v_0.AuxInt)
4897 v.reset(OpARM64FMOVDstore)
4898 v.AuxInt = int32ToAuxInt(int32(c))
4899 v.AddArg3(idx, val, mem)
4902 // match: (FMOVDstoreidx ptr (SLLconst [3] idx) val mem)
4903 // result: (FMOVDstoreidx8 ptr idx val mem)
4906 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 3 {
4912 v.reset(OpARM64FMOVDstoreidx8)
4913 v.AddArg4(ptr, idx, val, mem)
4916 // match: (FMOVDstoreidx (SLLconst [3] idx) ptr val mem)
4917 // result: (FMOVDstoreidx8 ptr idx val mem)
4919 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 3 {
4926 v.reset(OpARM64FMOVDstoreidx8)
4927 v.AddArg4(ptr, idx, val, mem)
4932 func rewriteValueARM64_OpARM64FMOVDstoreidx8(v *Value) bool {
4937 // match: (FMOVDstoreidx8 ptr (MOVDconst [c]) val mem)
4938 // cond: is32Bit(c<<3)
4939 // result: (FMOVDstore [int32(c)<<3] ptr val mem)
4942 if v_1.Op != OpARM64MOVDconst {
4945 c := auxIntToInt64(v_1.AuxInt)
4948 if !(is32Bit(c << 3)) {
4951 v.reset(OpARM64FMOVDstore)
4952 v.AuxInt = int32ToAuxInt(int32(c) << 3)
4953 v.AddArg3(ptr, val, mem)
4958 func rewriteValueARM64_OpARM64FMOVSload(v *Value) bool {
4962 config := b.Func.Config
4963 // match: (FMOVSload [off] {sym} ptr (MOVWstore [off] {sym} ptr val _))
4964 // result: (FMOVSgpfp val)
4966 off := auxIntToInt32(v.AuxInt)
4967 sym := auxToSym(v.Aux)
4969 if v_1.Op != OpARM64MOVWstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
4973 if ptr != v_1.Args[0] {
4976 v.reset(OpARM64FMOVSgpfp)
4980 // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem)
4981 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
4982 // result: (FMOVSload [off1+int32(off2)] {sym} ptr mem)
4984 off1 := auxIntToInt32(v.AuxInt)
4985 sym := auxToSym(v.Aux)
4986 if v_0.Op != OpARM64ADDconst {
4989 off2 := auxIntToInt64(v_0.AuxInt)
4992 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
4995 v.reset(OpARM64FMOVSload)
4996 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
4997 v.Aux = symToAux(sym)
5001 // match: (FMOVSload [off] {sym} (ADD ptr idx) mem)
5002 // cond: off == 0 && sym == nil
5003 // result: (FMOVSloadidx ptr idx mem)
5005 off := auxIntToInt32(v.AuxInt)
5006 sym := auxToSym(v.Aux)
5007 if v_0.Op != OpARM64ADD {
5013 if !(off == 0 && sym == nil) {
5016 v.reset(OpARM64FMOVSloadidx)
5017 v.AddArg3(ptr, idx, mem)
5020 // match: (FMOVSload [off] {sym} (ADDshiftLL [2] ptr idx) mem)
5021 // cond: off == 0 && sym == nil
5022 // result: (FMOVSloadidx4 ptr idx mem)
5024 off := auxIntToInt32(v.AuxInt)
5025 sym := auxToSym(v.Aux)
5026 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 2 {
5032 if !(off == 0 && sym == nil) {
5035 v.reset(OpARM64FMOVSloadidx4)
5036 v.AddArg3(ptr, idx, mem)
5039 // match: (FMOVSload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
5040 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
5041 // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
5043 off1 := auxIntToInt32(v.AuxInt)
5044 sym1 := auxToSym(v.Aux)
5045 if v_0.Op != OpARM64MOVDaddr {
5048 off2 := auxIntToInt32(v_0.AuxInt)
5049 sym2 := auxToSym(v_0.Aux)
5052 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
5055 v.reset(OpARM64FMOVSload)
5056 v.AuxInt = int32ToAuxInt(off1 + off2)
5057 v.Aux = symToAux(mergeSym(sym1, sym2))
5063 func rewriteValueARM64_OpARM64FMOVSloadidx(v *Value) bool {
5067 // match: (FMOVSloadidx ptr (MOVDconst [c]) mem)
5069 // result: (FMOVSload [int32(c)] ptr mem)
5072 if v_1.Op != OpARM64MOVDconst {
5075 c := auxIntToInt64(v_1.AuxInt)
5080 v.reset(OpARM64FMOVSload)
5081 v.AuxInt = int32ToAuxInt(int32(c))
5085 // match: (FMOVSloadidx (MOVDconst [c]) ptr mem)
5087 // result: (FMOVSload [int32(c)] ptr mem)
5089 if v_0.Op != OpARM64MOVDconst {
5092 c := auxIntToInt64(v_0.AuxInt)
5098 v.reset(OpARM64FMOVSload)
5099 v.AuxInt = int32ToAuxInt(int32(c))
5103 // match: (FMOVSloadidx ptr (SLLconst [2] idx) mem)
5104 // result: (FMOVSloadidx4 ptr idx mem)
5107 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 2 {
5112 v.reset(OpARM64FMOVSloadidx4)
5113 v.AddArg3(ptr, idx, mem)
5116 // match: (FMOVSloadidx (SLLconst [2] idx) ptr mem)
5117 // result: (FMOVSloadidx4 ptr idx mem)
5119 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 2 {
5125 v.reset(OpARM64FMOVSloadidx4)
5126 v.AddArg3(ptr, idx, mem)
5131 func rewriteValueARM64_OpARM64FMOVSloadidx4(v *Value) bool {
5135 // match: (FMOVSloadidx4 ptr (MOVDconst [c]) mem)
5136 // cond: is32Bit(c<<2)
5137 // result: (FMOVSload ptr [int32(c)<<2] mem)
5140 if v_1.Op != OpARM64MOVDconst {
5143 c := auxIntToInt64(v_1.AuxInt)
5145 if !(is32Bit(c << 2)) {
5148 v.reset(OpARM64FMOVSload)
5149 v.AuxInt = int32ToAuxInt(int32(c) << 2)
5155 func rewriteValueARM64_OpARM64FMOVSstore(v *Value) bool {
5160 config := b.Func.Config
5161 // match: (FMOVSstore [off] {sym} ptr (FMOVSgpfp val) mem)
5162 // result: (MOVWstore [off] {sym} ptr val mem)
5164 off := auxIntToInt32(v.AuxInt)
5165 sym := auxToSym(v.Aux)
5167 if v_1.Op != OpARM64FMOVSgpfp {
5172 v.reset(OpARM64MOVWstore)
5173 v.AuxInt = int32ToAuxInt(off)
5174 v.Aux = symToAux(sym)
5175 v.AddArg3(ptr, val, mem)
5178 // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem)
5179 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
5180 // result: (FMOVSstore [off1+int32(off2)] {sym} ptr val mem)
5182 off1 := auxIntToInt32(v.AuxInt)
5183 sym := auxToSym(v.Aux)
5184 if v_0.Op != OpARM64ADDconst {
5187 off2 := auxIntToInt64(v_0.AuxInt)
5191 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
5194 v.reset(OpARM64FMOVSstore)
5195 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5196 v.Aux = symToAux(sym)
5197 v.AddArg3(ptr, val, mem)
5200 // match: (FMOVSstore [off] {sym} (ADD ptr idx) val mem)
5201 // cond: off == 0 && sym == nil
5202 // result: (FMOVSstoreidx ptr idx val mem)
5204 off := auxIntToInt32(v.AuxInt)
5205 sym := auxToSym(v.Aux)
5206 if v_0.Op != OpARM64ADD {
5213 if !(off == 0 && sym == nil) {
5216 v.reset(OpARM64FMOVSstoreidx)
5217 v.AddArg4(ptr, idx, val, mem)
5220 // match: (FMOVSstore [off] {sym} (ADDshiftLL [2] ptr idx) val mem)
5221 // cond: off == 0 && sym == nil
5222 // result: (FMOVSstoreidx4 ptr idx val mem)
5224 off := auxIntToInt32(v.AuxInt)
5225 sym := auxToSym(v.Aux)
5226 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 2 {
5233 if !(off == 0 && sym == nil) {
5236 v.reset(OpARM64FMOVSstoreidx4)
5237 v.AddArg4(ptr, idx, val, mem)
5240 // match: (FMOVSstore [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) val mem)
5241 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
5242 // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
5244 off1 := auxIntToInt32(v.AuxInt)
5245 sym1 := auxToSym(v.Aux)
5246 if v_0.Op != OpARM64MOVDaddr {
5249 off2 := auxIntToInt32(v_0.AuxInt)
5250 sym2 := auxToSym(v_0.Aux)
5254 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
5257 v.reset(OpARM64FMOVSstore)
5258 v.AuxInt = int32ToAuxInt(off1 + off2)
5259 v.Aux = symToAux(mergeSym(sym1, sym2))
5260 v.AddArg3(ptr, val, mem)
5265 func rewriteValueARM64_OpARM64FMOVSstoreidx(v *Value) bool {
5270 // match: (FMOVSstoreidx ptr (MOVDconst [c]) val mem)
5272 // result: (FMOVSstore [int32(c)] ptr val mem)
5275 if v_1.Op != OpARM64MOVDconst {
5278 c := auxIntToInt64(v_1.AuxInt)
5284 v.reset(OpARM64FMOVSstore)
5285 v.AuxInt = int32ToAuxInt(int32(c))
5286 v.AddArg3(ptr, val, mem)
5289 // match: (FMOVSstoreidx (MOVDconst [c]) idx val mem)
5291 // result: (FMOVSstore [int32(c)] idx val mem)
5293 if v_0.Op != OpARM64MOVDconst {
5296 c := auxIntToInt64(v_0.AuxInt)
5303 v.reset(OpARM64FMOVSstore)
5304 v.AuxInt = int32ToAuxInt(int32(c))
5305 v.AddArg3(idx, val, mem)
5308 // match: (FMOVSstoreidx ptr (SLLconst [2] idx) val mem)
5309 // result: (FMOVSstoreidx4 ptr idx val mem)
5312 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 2 {
5318 v.reset(OpARM64FMOVSstoreidx4)
5319 v.AddArg4(ptr, idx, val, mem)
5322 // match: (FMOVSstoreidx (SLLconst [2] idx) ptr val mem)
5323 // result: (FMOVSstoreidx4 ptr idx val mem)
5325 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 2 {
5332 v.reset(OpARM64FMOVSstoreidx4)
5333 v.AddArg4(ptr, idx, val, mem)
5338 func rewriteValueARM64_OpARM64FMOVSstoreidx4(v *Value) bool {
5343 // match: (FMOVSstoreidx4 ptr (MOVDconst [c]) val mem)
5344 // cond: is32Bit(c<<2)
5345 // result: (FMOVSstore [int32(c)<<2] ptr val mem)
5348 if v_1.Op != OpARM64MOVDconst {
5351 c := auxIntToInt64(v_1.AuxInt)
5354 if !(is32Bit(c << 2)) {
5357 v.reset(OpARM64FMOVSstore)
5358 v.AuxInt = int32ToAuxInt(int32(c) << 2)
5359 v.AddArg3(ptr, val, mem)
5364 func rewriteValueARM64_OpARM64FMULD(v *Value) bool {
5367 // match: (FMULD (FNEGD x) y)
5368 // result: (FNMULD x y)
5370 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5371 if v_0.Op != OpARM64FNEGD {
5376 v.reset(OpARM64FNMULD)
5384 func rewriteValueARM64_OpARM64FMULS(v *Value) bool {
5387 // match: (FMULS (FNEGS x) y)
5388 // result: (FNMULS x y)
5390 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5391 if v_0.Op != OpARM64FNEGS {
5396 v.reset(OpARM64FNMULS)
5404 func rewriteValueARM64_OpARM64FNEGD(v *Value) bool {
5406 // match: (FNEGD (FMULD x y))
5407 // result: (FNMULD x y)
5409 if v_0.Op != OpARM64FMULD {
5414 v.reset(OpARM64FNMULD)
5418 // match: (FNEGD (FNMULD x y))
5419 // result: (FMULD x y)
5421 if v_0.Op != OpARM64FNMULD {
5426 v.reset(OpARM64FMULD)
5432 func rewriteValueARM64_OpARM64FNEGS(v *Value) bool {
5434 // match: (FNEGS (FMULS x y))
5435 // result: (FNMULS x y)
5437 if v_0.Op != OpARM64FMULS {
5442 v.reset(OpARM64FNMULS)
5446 // match: (FNEGS (FNMULS x y))
5447 // result: (FMULS x y)
5449 if v_0.Op != OpARM64FNMULS {
5454 v.reset(OpARM64FMULS)
5460 func rewriteValueARM64_OpARM64FNMULD(v *Value) bool {
5463 // match: (FNMULD (FNEGD x) y)
5464 // result: (FMULD x y)
5466 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5467 if v_0.Op != OpARM64FNEGD {
5472 v.reset(OpARM64FMULD)
5480 func rewriteValueARM64_OpARM64FNMULS(v *Value) bool {
5483 // match: (FNMULS (FNEGS x) y)
5484 // result: (FMULS x y)
5486 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5487 if v_0.Op != OpARM64FNEGS {
5492 v.reset(OpARM64FMULS)
5500 func rewriteValueARM64_OpARM64FSUBD(v *Value) bool {
5503 // match: (FSUBD a (FMULD x y))
5504 // cond: a.Block.Func.useFMA(v)
5505 // result: (FMSUBD a x y)
5508 if v_1.Op != OpARM64FMULD {
5513 if !(a.Block.Func.useFMA(v)) {
5516 v.reset(OpARM64FMSUBD)
5520 // match: (FSUBD (FMULD x y) a)
5521 // cond: a.Block.Func.useFMA(v)
5522 // result: (FNMSUBD a x y)
5524 if v_0.Op != OpARM64FMULD {
5530 if !(a.Block.Func.useFMA(v)) {
5533 v.reset(OpARM64FNMSUBD)
5537 // match: (FSUBD a (FNMULD x y))
5538 // cond: a.Block.Func.useFMA(v)
5539 // result: (FMADDD a x y)
5542 if v_1.Op != OpARM64FNMULD {
5547 if !(a.Block.Func.useFMA(v)) {
5550 v.reset(OpARM64FMADDD)
5554 // match: (FSUBD (FNMULD x y) a)
5555 // cond: a.Block.Func.useFMA(v)
5556 // result: (FNMADDD a x y)
5558 if v_0.Op != OpARM64FNMULD {
5564 if !(a.Block.Func.useFMA(v)) {
5567 v.reset(OpARM64FNMADDD)
5573 func rewriteValueARM64_OpARM64FSUBS(v *Value) bool {
5576 // match: (FSUBS a (FMULS x y))
5577 // cond: a.Block.Func.useFMA(v)
5578 // result: (FMSUBS a x y)
5581 if v_1.Op != OpARM64FMULS {
5586 if !(a.Block.Func.useFMA(v)) {
5589 v.reset(OpARM64FMSUBS)
5593 // match: (FSUBS (FMULS x y) a)
5594 // cond: a.Block.Func.useFMA(v)
5595 // result: (FNMSUBS a x y)
5597 if v_0.Op != OpARM64FMULS {
5603 if !(a.Block.Func.useFMA(v)) {
5606 v.reset(OpARM64FNMSUBS)
5610 // match: (FSUBS a (FNMULS x y))
5611 // cond: a.Block.Func.useFMA(v)
5612 // result: (FMADDS a x y)
5615 if v_1.Op != OpARM64FNMULS {
5620 if !(a.Block.Func.useFMA(v)) {
5623 v.reset(OpARM64FMADDS)
5627 // match: (FSUBS (FNMULS x y) a)
5628 // cond: a.Block.Func.useFMA(v)
5629 // result: (FNMADDS a x y)
5631 if v_0.Op != OpARM64FNMULS {
5637 if !(a.Block.Func.useFMA(v)) {
5640 v.reset(OpARM64FNMADDS)
5646 func rewriteValueARM64_OpARM64GreaterEqual(v *Value) bool {
5649 // match: (GreaterEqual (CMPconst [0] z:(AND x y)))
5650 // cond: z.Uses == 1
5651 // result: (GreaterEqual (TST x y))
5653 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
5657 if z.Op != OpARM64AND {
5665 v.reset(OpARM64GreaterEqual)
5666 v0 := b.NewValue0(v.Pos, OpARM64TST, types.TypeFlags)
5671 // match: (GreaterEqual (CMPWconst [0] x:(ANDconst [c] y)))
5672 // cond: x.Uses == 1
5673 // result: (GreaterEqual (TSTWconst [int32(c)] y))
5675 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
5679 if x.Op != OpARM64ANDconst {
5682 c := auxIntToInt64(x.AuxInt)
5687 v.reset(OpARM64GreaterEqual)
5688 v0 := b.NewValue0(v.Pos, OpARM64TSTWconst, types.TypeFlags)
5689 v0.AuxInt = int32ToAuxInt(int32(c))
5694 // match: (GreaterEqual (CMPWconst [0] z:(AND x y)))
5695 // cond: z.Uses == 1
5696 // result: (GreaterEqual (TSTW x y))
5698 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
5702 if z.Op != OpARM64AND {
5710 v.reset(OpARM64GreaterEqual)
5711 v0 := b.NewValue0(v.Pos, OpARM64TSTW, types.TypeFlags)
5716 // match: (GreaterEqual (CMPconst [0] x:(ANDconst [c] y)))
5717 // cond: x.Uses == 1
5718 // result: (GreaterEqual (TSTconst [c] y))
5720 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
5724 if x.Op != OpARM64ANDconst {
5727 c := auxIntToInt64(x.AuxInt)
5732 v.reset(OpARM64GreaterEqual)
5733 v0 := b.NewValue0(v.Pos, OpARM64TSTconst, types.TypeFlags)
5734 v0.AuxInt = int64ToAuxInt(c)
5739 // match: (GreaterEqual (CMPconst [0] x:(ADDconst [c] y)))
5740 // cond: x.Uses == 1
5741 // result: (GreaterEqualNoov (CMNconst [c] y))
5743 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
5747 if x.Op != OpARM64ADDconst {
5750 c := auxIntToInt64(x.AuxInt)
5755 v.reset(OpARM64GreaterEqualNoov)
5756 v0 := b.NewValue0(v.Pos, OpARM64CMNconst, types.TypeFlags)
5757 v0.AuxInt = int64ToAuxInt(c)
5762 // match: (GreaterEqual (CMPWconst [0] x:(ADDconst [c] y)))
5763 // cond: x.Uses == 1
5764 // result: (GreaterEqualNoov (CMNWconst [int32(c)] y))
5766 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
5770 if x.Op != OpARM64ADDconst {
5773 c := auxIntToInt64(x.AuxInt)
5778 v.reset(OpARM64GreaterEqualNoov)
5779 v0 := b.NewValue0(v.Pos, OpARM64CMNWconst, types.TypeFlags)
5780 v0.AuxInt = int32ToAuxInt(int32(c))
5785 // match: (GreaterEqual (CMPconst [0] z:(ADD x y)))
5786 // cond: z.Uses == 1
5787 // result: (GreaterEqualNoov (CMN x y))
5789 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
5793 if z.Op != OpARM64ADD {
5801 v.reset(OpARM64GreaterEqualNoov)
5802 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
5807 // match: (GreaterEqual (CMPWconst [0] z:(ADD x y)))
5808 // cond: z.Uses == 1
5809 // result: (GreaterEqualNoov (CMNW x y))
5811 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
5815 if z.Op != OpARM64ADD {
5823 v.reset(OpARM64GreaterEqualNoov)
5824 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
5829 // match: (GreaterEqual (CMPconst [0] z:(MADD a x y)))
5830 // cond: z.Uses == 1
5831 // result: (GreaterEqualNoov (CMN a (MUL <x.Type> x y)))
5833 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
5837 if z.Op != OpARM64MADD {
5846 v.reset(OpARM64GreaterEqualNoov)
5847 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
5848 v1 := b.NewValue0(v.Pos, OpARM64MUL, x.Type)
5854 // match: (GreaterEqual (CMPconst [0] z:(MSUB a x y)))
5855 // cond: z.Uses == 1
5856 // result: (GreaterEqualNoov (CMP a (MUL <x.Type> x y)))
5858 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
5862 if z.Op != OpARM64MSUB {
5871 v.reset(OpARM64GreaterEqualNoov)
5872 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
5873 v1 := b.NewValue0(v.Pos, OpARM64MUL, x.Type)
5879 // match: (GreaterEqual (CMPWconst [0] z:(MADDW a x y)))
5880 // cond: z.Uses == 1
5881 // result: (GreaterEqualNoov (CMNW a (MULW <x.Type> x y)))
5883 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
5887 if z.Op != OpARM64MADDW {
5896 v.reset(OpARM64GreaterEqualNoov)
5897 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
5898 v1 := b.NewValue0(v.Pos, OpARM64MULW, x.Type)
5904 // match: (GreaterEqual (CMPWconst [0] z:(MSUBW a x y)))
5905 // cond: z.Uses == 1
5906 // result: (GreaterEqualNoov (CMPW a (MULW <x.Type> x y)))
5908 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
5912 if z.Op != OpARM64MSUBW {
5921 v.reset(OpARM64GreaterEqualNoov)
5922 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
5923 v1 := b.NewValue0(v.Pos, OpARM64MULW, x.Type)
5929 // match: (GreaterEqual (FlagConstant [fc]))
5930 // result: (MOVDconst [b2i(fc.ge())])
5932 if v_0.Op != OpARM64FlagConstant {
5935 fc := auxIntToFlagConstant(v_0.AuxInt)
5936 v.reset(OpARM64MOVDconst)
5937 v.AuxInt = int64ToAuxInt(b2i(fc.ge()))
5940 // match: (GreaterEqual (InvertFlags x))
5941 // result: (LessEqual x)
5943 if v_0.Op != OpARM64InvertFlags {
5947 v.reset(OpARM64LessEqual)
5953 func rewriteValueARM64_OpARM64GreaterEqualF(v *Value) bool {
5955 // match: (GreaterEqualF (InvertFlags x))
5956 // result: (LessEqualF x)
5958 if v_0.Op != OpARM64InvertFlags {
5962 v.reset(OpARM64LessEqualF)
5968 func rewriteValueARM64_OpARM64GreaterEqualU(v *Value) bool {
5970 // match: (GreaterEqualU (FlagConstant [fc]))
5971 // result: (MOVDconst [b2i(fc.uge())])
5973 if v_0.Op != OpARM64FlagConstant {
5976 fc := auxIntToFlagConstant(v_0.AuxInt)
5977 v.reset(OpARM64MOVDconst)
5978 v.AuxInt = int64ToAuxInt(b2i(fc.uge()))
5981 // match: (GreaterEqualU (InvertFlags x))
5982 // result: (LessEqualU x)
5984 if v_0.Op != OpARM64InvertFlags {
5988 v.reset(OpARM64LessEqualU)
5994 func rewriteValueARM64_OpARM64GreaterThan(v *Value) bool {
5997 // match: (GreaterThan (CMPconst [0] z:(AND x y)))
5998 // cond: z.Uses == 1
5999 // result: (GreaterThan (TST x y))
6001 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6005 if z.Op != OpARM64AND {
6013 v.reset(OpARM64GreaterThan)
6014 v0 := b.NewValue0(v.Pos, OpARM64TST, types.TypeFlags)
6019 // match: (GreaterThan (CMPWconst [0] x:(ANDconst [c] y)))
6020 // cond: x.Uses == 1
6021 // result: (GreaterThan (TSTWconst [int32(c)] y))
6023 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6027 if x.Op != OpARM64ANDconst {
6030 c := auxIntToInt64(x.AuxInt)
6035 v.reset(OpARM64GreaterThan)
6036 v0 := b.NewValue0(v.Pos, OpARM64TSTWconst, types.TypeFlags)
6037 v0.AuxInt = int32ToAuxInt(int32(c))
6042 // match: (GreaterThan (CMPWconst [0] z:(AND x y)))
6043 // cond: z.Uses == 1
6044 // result: (GreaterThan (TSTW x y))
6046 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6050 if z.Op != OpARM64AND {
6058 v.reset(OpARM64GreaterThan)
6059 v0 := b.NewValue0(v.Pos, OpARM64TSTW, types.TypeFlags)
6064 // match: (GreaterThan (CMPconst [0] x:(ANDconst [c] y)))
6065 // cond: x.Uses == 1
6066 // result: (GreaterThan (TSTconst [c] y))
6068 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6072 if x.Op != OpARM64ANDconst {
6075 c := auxIntToInt64(x.AuxInt)
6080 v.reset(OpARM64GreaterThan)
6081 v0 := b.NewValue0(v.Pos, OpARM64TSTconst, types.TypeFlags)
6082 v0.AuxInt = int64ToAuxInt(c)
6087 // match: (GreaterThan (FlagConstant [fc]))
6088 // result: (MOVDconst [b2i(fc.gt())])
6090 if v_0.Op != OpARM64FlagConstant {
6093 fc := auxIntToFlagConstant(v_0.AuxInt)
6094 v.reset(OpARM64MOVDconst)
6095 v.AuxInt = int64ToAuxInt(b2i(fc.gt()))
6098 // match: (GreaterThan (InvertFlags x))
6099 // result: (LessThan x)
6101 if v_0.Op != OpARM64InvertFlags {
6105 v.reset(OpARM64LessThan)
6111 func rewriteValueARM64_OpARM64GreaterThanF(v *Value) bool {
6113 // match: (GreaterThanF (InvertFlags x))
6114 // result: (LessThanF x)
6116 if v_0.Op != OpARM64InvertFlags {
6120 v.reset(OpARM64LessThanF)
6126 func rewriteValueARM64_OpARM64GreaterThanU(v *Value) bool {
6128 // match: (GreaterThanU (FlagConstant [fc]))
6129 // result: (MOVDconst [b2i(fc.ugt())])
6131 if v_0.Op != OpARM64FlagConstant {
6134 fc := auxIntToFlagConstant(v_0.AuxInt)
6135 v.reset(OpARM64MOVDconst)
6136 v.AuxInt = int64ToAuxInt(b2i(fc.ugt()))
6139 // match: (GreaterThanU (InvertFlags x))
6140 // result: (LessThanU x)
6142 if v_0.Op != OpARM64InvertFlags {
6146 v.reset(OpARM64LessThanU)
6152 func rewriteValueARM64_OpARM64LDP(v *Value) bool {
6156 config := b.Func.Config
6157 // match: (LDP [off1] {sym} (ADDconst [off2] ptr) mem)
6158 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
6159 // result: (LDP [off1+int32(off2)] {sym} ptr mem)
6161 off1 := auxIntToInt32(v.AuxInt)
6162 sym := auxToSym(v.Aux)
6163 if v_0.Op != OpARM64ADDconst {
6166 off2 := auxIntToInt64(v_0.AuxInt)
6169 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
6173 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
6174 v.Aux = symToAux(sym)
6178 // match: (LDP [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
6179 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
6180 // result: (LDP [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
6182 off1 := auxIntToInt32(v.AuxInt)
6183 sym1 := auxToSym(v.Aux)
6184 if v_0.Op != OpARM64MOVDaddr {
6187 off2 := auxIntToInt32(v_0.AuxInt)
6188 sym2 := auxToSym(v_0.Aux)
6191 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
6195 v.AuxInt = int32ToAuxInt(off1 + off2)
6196 v.Aux = symToAux(mergeSym(sym1, sym2))
6202 func rewriteValueARM64_OpARM64LessEqual(v *Value) bool {
6205 // match: (LessEqual (CMPconst [0] z:(AND x y)))
6206 // cond: z.Uses == 1
6207 // result: (LessEqual (TST x y))
6209 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6213 if z.Op != OpARM64AND {
6221 v.reset(OpARM64LessEqual)
6222 v0 := b.NewValue0(v.Pos, OpARM64TST, types.TypeFlags)
6227 // match: (LessEqual (CMPWconst [0] x:(ANDconst [c] y)))
6228 // cond: x.Uses == 1
6229 // result: (LessEqual (TSTWconst [int32(c)] y))
6231 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6235 if x.Op != OpARM64ANDconst {
6238 c := auxIntToInt64(x.AuxInt)
6243 v.reset(OpARM64LessEqual)
6244 v0 := b.NewValue0(v.Pos, OpARM64TSTWconst, types.TypeFlags)
6245 v0.AuxInt = int32ToAuxInt(int32(c))
6250 // match: (LessEqual (CMPWconst [0] z:(AND x y)))
6251 // cond: z.Uses == 1
6252 // result: (LessEqual (TSTW x y))
6254 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6258 if z.Op != OpARM64AND {
6266 v.reset(OpARM64LessEqual)
6267 v0 := b.NewValue0(v.Pos, OpARM64TSTW, types.TypeFlags)
6272 // match: (LessEqual (CMPconst [0] x:(ANDconst [c] y)))
6273 // cond: x.Uses == 1
6274 // result: (LessEqual (TSTconst [c] y))
6276 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6280 if x.Op != OpARM64ANDconst {
6283 c := auxIntToInt64(x.AuxInt)
6288 v.reset(OpARM64LessEqual)
6289 v0 := b.NewValue0(v.Pos, OpARM64TSTconst, types.TypeFlags)
6290 v0.AuxInt = int64ToAuxInt(c)
6295 // match: (LessEqual (FlagConstant [fc]))
6296 // result: (MOVDconst [b2i(fc.le())])
6298 if v_0.Op != OpARM64FlagConstant {
6301 fc := auxIntToFlagConstant(v_0.AuxInt)
6302 v.reset(OpARM64MOVDconst)
6303 v.AuxInt = int64ToAuxInt(b2i(fc.le()))
6306 // match: (LessEqual (InvertFlags x))
6307 // result: (GreaterEqual x)
6309 if v_0.Op != OpARM64InvertFlags {
6313 v.reset(OpARM64GreaterEqual)
6319 func rewriteValueARM64_OpARM64LessEqualF(v *Value) bool {
6321 // match: (LessEqualF (InvertFlags x))
6322 // result: (GreaterEqualF x)
6324 if v_0.Op != OpARM64InvertFlags {
6328 v.reset(OpARM64GreaterEqualF)
6334 func rewriteValueARM64_OpARM64LessEqualU(v *Value) bool {
6336 // match: (LessEqualU (FlagConstant [fc]))
6337 // result: (MOVDconst [b2i(fc.ule())])
6339 if v_0.Op != OpARM64FlagConstant {
6342 fc := auxIntToFlagConstant(v_0.AuxInt)
6343 v.reset(OpARM64MOVDconst)
6344 v.AuxInt = int64ToAuxInt(b2i(fc.ule()))
6347 // match: (LessEqualU (InvertFlags x))
6348 // result: (GreaterEqualU x)
6350 if v_0.Op != OpARM64InvertFlags {
6354 v.reset(OpARM64GreaterEqualU)
6360 func rewriteValueARM64_OpARM64LessThan(v *Value) bool {
6363 // match: (LessThan (CMPconst [0] z:(AND x y)))
6364 // cond: z.Uses == 1
6365 // result: (LessThan (TST x y))
6367 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6371 if z.Op != OpARM64AND {
6379 v.reset(OpARM64LessThan)
6380 v0 := b.NewValue0(v.Pos, OpARM64TST, types.TypeFlags)
6385 // match: (LessThan (CMPWconst [0] x:(ANDconst [c] y)))
6386 // cond: x.Uses == 1
6387 // result: (LessThan (TSTWconst [int32(c)] y))
6389 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6393 if x.Op != OpARM64ANDconst {
6396 c := auxIntToInt64(x.AuxInt)
6401 v.reset(OpARM64LessThan)
6402 v0 := b.NewValue0(v.Pos, OpARM64TSTWconst, types.TypeFlags)
6403 v0.AuxInt = int32ToAuxInt(int32(c))
6408 // match: (LessThan (CMPWconst [0] z:(AND x y)))
6409 // cond: z.Uses == 1
6410 // result: (LessThan (TSTW x y))
6412 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6416 if z.Op != OpARM64AND {
6424 v.reset(OpARM64LessThan)
6425 v0 := b.NewValue0(v.Pos, OpARM64TSTW, types.TypeFlags)
6430 // match: (LessThan (CMPconst [0] x:(ANDconst [c] y)))
6431 // cond: x.Uses == 1
6432 // result: (LessThan (TSTconst [c] y))
6434 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6438 if x.Op != OpARM64ANDconst {
6441 c := auxIntToInt64(x.AuxInt)
6446 v.reset(OpARM64LessThan)
6447 v0 := b.NewValue0(v.Pos, OpARM64TSTconst, types.TypeFlags)
6448 v0.AuxInt = int64ToAuxInt(c)
6453 // match: (LessThan (CMPconst [0] x:(ADDconst [c] y)))
6454 // cond: x.Uses == 1
6455 // result: (LessThanNoov (CMNconst [c] y))
6457 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6461 if x.Op != OpARM64ADDconst {
6464 c := auxIntToInt64(x.AuxInt)
6469 v.reset(OpARM64LessThanNoov)
6470 v0 := b.NewValue0(v.Pos, OpARM64CMNconst, types.TypeFlags)
6471 v0.AuxInt = int64ToAuxInt(c)
6476 // match: (LessThan (CMPWconst [0] x:(ADDconst [c] y)))
6477 // cond: x.Uses == 1
6478 // result: (LessThanNoov (CMNWconst [int32(c)] y))
6480 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6484 if x.Op != OpARM64ADDconst {
6487 c := auxIntToInt64(x.AuxInt)
6492 v.reset(OpARM64LessThanNoov)
6493 v0 := b.NewValue0(v.Pos, OpARM64CMNWconst, types.TypeFlags)
6494 v0.AuxInt = int32ToAuxInt(int32(c))
6499 // match: (LessThan (CMPconst [0] z:(ADD x y)))
6500 // cond: z.Uses == 1
6501 // result: (LessThanNoov (CMN x y))
6503 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6507 if z.Op != OpARM64ADD {
6515 v.reset(OpARM64LessThanNoov)
6516 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
6521 // match: (LessThan (CMPWconst [0] z:(ADD x y)))
6522 // cond: z.Uses == 1
6523 // result: (LessThanNoov (CMNW x y))
6525 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6529 if z.Op != OpARM64ADD {
6537 v.reset(OpARM64LessThanNoov)
6538 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
6543 // match: (LessThan (CMPconst [0] z:(MADD a x y)))
6544 // cond: z.Uses == 1
6545 // result: (LessThanNoov (CMN a (MUL <x.Type> x y)))
6547 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6551 if z.Op != OpARM64MADD {
6560 v.reset(OpARM64LessThanNoov)
6561 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
6562 v1 := b.NewValue0(v.Pos, OpARM64MUL, x.Type)
6568 // match: (LessThan (CMPconst [0] z:(MSUB a x y)))
6569 // cond: z.Uses == 1
6570 // result: (LessThanNoov (CMP a (MUL <x.Type> x y)))
6572 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
6576 if z.Op != OpARM64MSUB {
6585 v.reset(OpARM64LessThanNoov)
6586 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
6587 v1 := b.NewValue0(v.Pos, OpARM64MUL, x.Type)
6593 // match: (LessThan (CMPWconst [0] z:(MADDW a x y)))
6594 // cond: z.Uses == 1
6595 // result: (LessThanNoov (CMNW a (MULW <x.Type> x y)))
6597 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6601 if z.Op != OpARM64MADDW {
6610 v.reset(OpARM64LessThanNoov)
6611 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
6612 v1 := b.NewValue0(v.Pos, OpARM64MULW, x.Type)
6618 // match: (LessThan (CMPWconst [0] z:(MSUBW a x y)))
6619 // cond: z.Uses == 1
6620 // result: (LessThanNoov (CMPW a (MULW <x.Type> x y)))
6622 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
6626 if z.Op != OpARM64MSUBW {
6635 v.reset(OpARM64LessThanNoov)
6636 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
6637 v1 := b.NewValue0(v.Pos, OpARM64MULW, x.Type)
6643 // match: (LessThan (FlagConstant [fc]))
6644 // result: (MOVDconst [b2i(fc.lt())])
6646 if v_0.Op != OpARM64FlagConstant {
6649 fc := auxIntToFlagConstant(v_0.AuxInt)
6650 v.reset(OpARM64MOVDconst)
6651 v.AuxInt = int64ToAuxInt(b2i(fc.lt()))
6654 // match: (LessThan (InvertFlags x))
6655 // result: (GreaterThan x)
6657 if v_0.Op != OpARM64InvertFlags {
6661 v.reset(OpARM64GreaterThan)
6667 func rewriteValueARM64_OpARM64LessThanF(v *Value) bool {
6669 // match: (LessThanF (InvertFlags x))
6670 // result: (GreaterThanF x)
6672 if v_0.Op != OpARM64InvertFlags {
6676 v.reset(OpARM64GreaterThanF)
6682 func rewriteValueARM64_OpARM64LessThanU(v *Value) bool {
6684 // match: (LessThanU (FlagConstant [fc]))
6685 // result: (MOVDconst [b2i(fc.ult())])
6687 if v_0.Op != OpARM64FlagConstant {
6690 fc := auxIntToFlagConstant(v_0.AuxInt)
6691 v.reset(OpARM64MOVDconst)
6692 v.AuxInt = int64ToAuxInt(b2i(fc.ult()))
6695 // match: (LessThanU (InvertFlags x))
6696 // result: (GreaterThanU x)
6698 if v_0.Op != OpARM64InvertFlags {
6702 v.reset(OpARM64GreaterThanU)
6708 func rewriteValueARM64_OpARM64MADD(v *Value) bool {
6713 // match: (MADD a x (MOVDconst [-1]))
6714 // result: (SUB a x)
6718 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != -1 {
6725 // match: (MADD a _ (MOVDconst [0]))
6729 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
6735 // match: (MADD a x (MOVDconst [1]))
6736 // result: (ADD a x)
6740 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 1 {
6747 // match: (MADD a x (MOVDconst [c]))
6748 // cond: isPowerOfTwo64(c)
6749 // result: (ADDshiftLL a x [log64(c)])
6753 if v_2.Op != OpARM64MOVDconst {
6756 c := auxIntToInt64(v_2.AuxInt)
6757 if !(isPowerOfTwo64(c)) {
6760 v.reset(OpARM64ADDshiftLL)
6761 v.AuxInt = int64ToAuxInt(log64(c))
6765 // match: (MADD a x (MOVDconst [c]))
6766 // cond: isPowerOfTwo64(c-1) && c>=3
6767 // result: (ADD a (ADDshiftLL <x.Type> x x [log64(c-1)]))
6771 if v_2.Op != OpARM64MOVDconst {
6774 c := auxIntToInt64(v_2.AuxInt)
6775 if !(isPowerOfTwo64(c-1) && c >= 3) {
6779 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
6780 v0.AuxInt = int64ToAuxInt(log64(c - 1))
6785 // match: (MADD a x (MOVDconst [c]))
6786 // cond: isPowerOfTwo64(c+1) && c>=7
6787 // result: (SUB a (SUBshiftLL <x.Type> x x [log64(c+1)]))
6791 if v_2.Op != OpARM64MOVDconst {
6794 c := auxIntToInt64(v_2.AuxInt)
6795 if !(isPowerOfTwo64(c+1) && c >= 7) {
6799 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
6800 v0.AuxInt = int64ToAuxInt(log64(c + 1))
6805 // match: (MADD a x (MOVDconst [c]))
6806 // cond: c%3 == 0 && isPowerOfTwo64(c/3)
6807 // result: (SUBshiftLL a (SUBshiftLL <x.Type> x x [2]) [log64(c/3)])
6811 if v_2.Op != OpARM64MOVDconst {
6814 c := auxIntToInt64(v_2.AuxInt)
6815 if !(c%3 == 0 && isPowerOfTwo64(c/3)) {
6818 v.reset(OpARM64SUBshiftLL)
6819 v.AuxInt = int64ToAuxInt(log64(c / 3))
6820 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
6821 v0.AuxInt = int64ToAuxInt(2)
6826 // match: (MADD a x (MOVDconst [c]))
6827 // cond: c%5 == 0 && isPowerOfTwo64(c/5)
6828 // result: (ADDshiftLL a (ADDshiftLL <x.Type> x x [2]) [log64(c/5)])
6832 if v_2.Op != OpARM64MOVDconst {
6835 c := auxIntToInt64(v_2.AuxInt)
6836 if !(c%5 == 0 && isPowerOfTwo64(c/5)) {
6839 v.reset(OpARM64ADDshiftLL)
6840 v.AuxInt = int64ToAuxInt(log64(c / 5))
6841 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
6842 v0.AuxInt = int64ToAuxInt(2)
6847 // match: (MADD a x (MOVDconst [c]))
6848 // cond: c%7 == 0 && isPowerOfTwo64(c/7)
6849 // result: (SUBshiftLL a (SUBshiftLL <x.Type> x x [3]) [log64(c/7)])
6853 if v_2.Op != OpARM64MOVDconst {
6856 c := auxIntToInt64(v_2.AuxInt)
6857 if !(c%7 == 0 && isPowerOfTwo64(c/7)) {
6860 v.reset(OpARM64SUBshiftLL)
6861 v.AuxInt = int64ToAuxInt(log64(c / 7))
6862 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
6863 v0.AuxInt = int64ToAuxInt(3)
6868 // match: (MADD a x (MOVDconst [c]))
6869 // cond: c%9 == 0 && isPowerOfTwo64(c/9)
6870 // result: (ADDshiftLL a (ADDshiftLL <x.Type> x x [3]) [log64(c/9)])
6874 if v_2.Op != OpARM64MOVDconst {
6877 c := auxIntToInt64(v_2.AuxInt)
6878 if !(c%9 == 0 && isPowerOfTwo64(c/9)) {
6881 v.reset(OpARM64ADDshiftLL)
6882 v.AuxInt = int64ToAuxInt(log64(c / 9))
6883 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
6884 v0.AuxInt = int64ToAuxInt(3)
6889 // match: (MADD a (MOVDconst [-1]) x)
6890 // result: (SUB a x)
6893 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
6901 // match: (MADD a (MOVDconst [0]) _)
6905 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
6911 // match: (MADD a (MOVDconst [1]) x)
6912 // result: (ADD a x)
6915 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
6923 // match: (MADD a (MOVDconst [c]) x)
6924 // cond: isPowerOfTwo64(c)
6925 // result: (ADDshiftLL a x [log64(c)])
6928 if v_1.Op != OpARM64MOVDconst {
6931 c := auxIntToInt64(v_1.AuxInt)
6933 if !(isPowerOfTwo64(c)) {
6936 v.reset(OpARM64ADDshiftLL)
6937 v.AuxInt = int64ToAuxInt(log64(c))
6941 // match: (MADD a (MOVDconst [c]) x)
6942 // cond: isPowerOfTwo64(c-1) && c>=3
6943 // result: (ADD a (ADDshiftLL <x.Type> x x [log64(c-1)]))
6946 if v_1.Op != OpARM64MOVDconst {
6949 c := auxIntToInt64(v_1.AuxInt)
6951 if !(isPowerOfTwo64(c-1) && c >= 3) {
6955 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
6956 v0.AuxInt = int64ToAuxInt(log64(c - 1))
6961 // match: (MADD a (MOVDconst [c]) x)
6962 // cond: isPowerOfTwo64(c+1) && c>=7
6963 // result: (SUB a (SUBshiftLL <x.Type> x x [log64(c+1)]))
6966 if v_1.Op != OpARM64MOVDconst {
6969 c := auxIntToInt64(v_1.AuxInt)
6971 if !(isPowerOfTwo64(c+1) && c >= 7) {
6975 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
6976 v0.AuxInt = int64ToAuxInt(log64(c + 1))
6981 // match: (MADD a (MOVDconst [c]) x)
6982 // cond: c%3 == 0 && isPowerOfTwo64(c/3)
6983 // result: (SUBshiftLL a (SUBshiftLL <x.Type> x x [2]) [log64(c/3)])
6986 if v_1.Op != OpARM64MOVDconst {
6989 c := auxIntToInt64(v_1.AuxInt)
6991 if !(c%3 == 0 && isPowerOfTwo64(c/3)) {
6994 v.reset(OpARM64SUBshiftLL)
6995 v.AuxInt = int64ToAuxInt(log64(c / 3))
6996 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
6997 v0.AuxInt = int64ToAuxInt(2)
7002 // match: (MADD a (MOVDconst [c]) x)
7003 // cond: c%5 == 0 && isPowerOfTwo64(c/5)
7004 // result: (ADDshiftLL a (ADDshiftLL <x.Type> x x [2]) [log64(c/5)])
7007 if v_1.Op != OpARM64MOVDconst {
7010 c := auxIntToInt64(v_1.AuxInt)
7012 if !(c%5 == 0 && isPowerOfTwo64(c/5)) {
7015 v.reset(OpARM64ADDshiftLL)
7016 v.AuxInt = int64ToAuxInt(log64(c / 5))
7017 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7018 v0.AuxInt = int64ToAuxInt(2)
7023 // match: (MADD a (MOVDconst [c]) x)
7024 // cond: c%7 == 0 && isPowerOfTwo64(c/7)
7025 // result: (SUBshiftLL a (SUBshiftLL <x.Type> x x [3]) [log64(c/7)])
7028 if v_1.Op != OpARM64MOVDconst {
7031 c := auxIntToInt64(v_1.AuxInt)
7033 if !(c%7 == 0 && isPowerOfTwo64(c/7)) {
7036 v.reset(OpARM64SUBshiftLL)
7037 v.AuxInt = int64ToAuxInt(log64(c / 7))
7038 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7039 v0.AuxInt = int64ToAuxInt(3)
7044 // match: (MADD a (MOVDconst [c]) x)
7045 // cond: c%9 == 0 && isPowerOfTwo64(c/9)
7046 // result: (ADDshiftLL a (ADDshiftLL <x.Type> x x [3]) [log64(c/9)])
7049 if v_1.Op != OpARM64MOVDconst {
7052 c := auxIntToInt64(v_1.AuxInt)
7054 if !(c%9 == 0 && isPowerOfTwo64(c/9)) {
7057 v.reset(OpARM64ADDshiftLL)
7058 v.AuxInt = int64ToAuxInt(log64(c / 9))
7059 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7060 v0.AuxInt = int64ToAuxInt(3)
7065 // match: (MADD (MOVDconst [c]) x y)
7066 // result: (ADDconst [c] (MUL <x.Type> x y))
7068 if v_0.Op != OpARM64MOVDconst {
7071 c := auxIntToInt64(v_0.AuxInt)
7074 v.reset(OpARM64ADDconst)
7075 v.AuxInt = int64ToAuxInt(c)
7076 v0 := b.NewValue0(v.Pos, OpARM64MUL, x.Type)
7081 // match: (MADD a (MOVDconst [c]) (MOVDconst [d]))
7082 // result: (ADDconst [c*d] a)
7085 if v_1.Op != OpARM64MOVDconst {
7088 c := auxIntToInt64(v_1.AuxInt)
7089 if v_2.Op != OpARM64MOVDconst {
7092 d := auxIntToInt64(v_2.AuxInt)
7093 v.reset(OpARM64ADDconst)
7094 v.AuxInt = int64ToAuxInt(c * d)
7100 func rewriteValueARM64_OpARM64MADDW(v *Value) bool {
7105 // match: (MADDW a x (MOVDconst [c]))
7106 // cond: int32(c)==-1
7107 // result: (MOVWUreg (SUB <a.Type> a x))
7111 if v_2.Op != OpARM64MOVDconst {
7114 c := auxIntToInt64(v_2.AuxInt)
7115 if !(int32(c) == -1) {
7118 v.reset(OpARM64MOVWUreg)
7119 v0 := b.NewValue0(v.Pos, OpARM64SUB, a.Type)
7124 // match: (MADDW a _ (MOVDconst [c]))
7125 // cond: int32(c)==0
7126 // result: (MOVWUreg a)
7129 if v_2.Op != OpARM64MOVDconst {
7132 c := auxIntToInt64(v_2.AuxInt)
7133 if !(int32(c) == 0) {
7136 v.reset(OpARM64MOVWUreg)
7140 // match: (MADDW a x (MOVDconst [c]))
7141 // cond: int32(c)==1
7142 // result: (MOVWUreg (ADD <a.Type> a x))
7146 if v_2.Op != OpARM64MOVDconst {
7149 c := auxIntToInt64(v_2.AuxInt)
7150 if !(int32(c) == 1) {
7153 v.reset(OpARM64MOVWUreg)
7154 v0 := b.NewValue0(v.Pos, OpARM64ADD, a.Type)
7159 // match: (MADDW a x (MOVDconst [c]))
7160 // cond: isPowerOfTwo64(c)
7161 // result: (MOVWUreg (ADDshiftLL <a.Type> a x [log64(c)]))
7165 if v_2.Op != OpARM64MOVDconst {
7168 c := auxIntToInt64(v_2.AuxInt)
7169 if !(isPowerOfTwo64(c)) {
7172 v.reset(OpARM64MOVWUreg)
7173 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
7174 v0.AuxInt = int64ToAuxInt(log64(c))
7179 // match: (MADDW a x (MOVDconst [c]))
7180 // cond: isPowerOfTwo64(c-1) && int32(c)>=3
7181 // result: (MOVWUreg (ADD <a.Type> a (ADDshiftLL <x.Type> x x [log64(c-1)])))
7185 if v_2.Op != OpARM64MOVDconst {
7188 c := auxIntToInt64(v_2.AuxInt)
7189 if !(isPowerOfTwo64(c-1) && int32(c) >= 3) {
7192 v.reset(OpARM64MOVWUreg)
7193 v0 := b.NewValue0(v.Pos, OpARM64ADD, a.Type)
7194 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7195 v1.AuxInt = int64ToAuxInt(log64(c - 1))
7201 // match: (MADDW a x (MOVDconst [c]))
7202 // cond: isPowerOfTwo64(c+1) && int32(c)>=7
7203 // result: (MOVWUreg (SUB <a.Type> a (SUBshiftLL <x.Type> x x [log64(c+1)])))
7207 if v_2.Op != OpARM64MOVDconst {
7210 c := auxIntToInt64(v_2.AuxInt)
7211 if !(isPowerOfTwo64(c+1) && int32(c) >= 7) {
7214 v.reset(OpARM64MOVWUreg)
7215 v0 := b.NewValue0(v.Pos, OpARM64SUB, a.Type)
7216 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7217 v1.AuxInt = int64ToAuxInt(log64(c + 1))
7223 // match: (MADDW a x (MOVDconst [c]))
7224 // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)
7225 // result: (MOVWUreg (SUBshiftLL <a.Type> a (SUBshiftLL <x.Type> x x [2]) [log64(c/3)]))
7229 if v_2.Op != OpARM64MOVDconst {
7232 c := auxIntToInt64(v_2.AuxInt)
7233 if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) {
7236 v.reset(OpARM64MOVWUreg)
7237 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
7238 v0.AuxInt = int64ToAuxInt(log64(c / 3))
7239 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7240 v1.AuxInt = int64ToAuxInt(2)
7246 // match: (MADDW a x (MOVDconst [c]))
7247 // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)
7248 // result: (MOVWUreg (ADDshiftLL <a.Type> a (ADDshiftLL <x.Type> x x [2]) [log64(c/5)]))
7252 if v_2.Op != OpARM64MOVDconst {
7255 c := auxIntToInt64(v_2.AuxInt)
7256 if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) {
7259 v.reset(OpARM64MOVWUreg)
7260 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
7261 v0.AuxInt = int64ToAuxInt(log64(c / 5))
7262 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7263 v1.AuxInt = int64ToAuxInt(2)
7269 // match: (MADDW a x (MOVDconst [c]))
7270 // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)
7271 // result: (MOVWUreg (SUBshiftLL <a.Type> a (SUBshiftLL <x.Type> x x [3]) [log64(c/7)]))
7275 if v_2.Op != OpARM64MOVDconst {
7278 c := auxIntToInt64(v_2.AuxInt)
7279 if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) {
7282 v.reset(OpARM64MOVWUreg)
7283 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
7284 v0.AuxInt = int64ToAuxInt(log64(c / 7))
7285 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7286 v1.AuxInt = int64ToAuxInt(3)
7292 // match: (MADDW a x (MOVDconst [c]))
7293 // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)
7294 // result: (MOVWUreg (ADDshiftLL <a.Type> a (ADDshiftLL <x.Type> x x [3]) [log64(c/9)]))
7298 if v_2.Op != OpARM64MOVDconst {
7301 c := auxIntToInt64(v_2.AuxInt)
7302 if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) {
7305 v.reset(OpARM64MOVWUreg)
7306 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
7307 v0.AuxInt = int64ToAuxInt(log64(c / 9))
7308 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7309 v1.AuxInt = int64ToAuxInt(3)
7315 // match: (MADDW a (MOVDconst [c]) x)
7316 // cond: int32(c)==-1
7317 // result: (MOVWUreg (SUB <a.Type> a x))
7320 if v_1.Op != OpARM64MOVDconst {
7323 c := auxIntToInt64(v_1.AuxInt)
7325 if !(int32(c) == -1) {
7328 v.reset(OpARM64MOVWUreg)
7329 v0 := b.NewValue0(v.Pos, OpARM64SUB, a.Type)
7334 // match: (MADDW a (MOVDconst [c]) _)
7335 // cond: int32(c)==0
7336 // result: (MOVWUreg a)
7339 if v_1.Op != OpARM64MOVDconst {
7342 c := auxIntToInt64(v_1.AuxInt)
7343 if !(int32(c) == 0) {
7346 v.reset(OpARM64MOVWUreg)
7350 // match: (MADDW a (MOVDconst [c]) x)
7351 // cond: int32(c)==1
7352 // result: (MOVWUreg (ADD <a.Type> a x))
7355 if v_1.Op != OpARM64MOVDconst {
7358 c := auxIntToInt64(v_1.AuxInt)
7360 if !(int32(c) == 1) {
7363 v.reset(OpARM64MOVWUreg)
7364 v0 := b.NewValue0(v.Pos, OpARM64ADD, a.Type)
7369 // match: (MADDW a (MOVDconst [c]) x)
7370 // cond: isPowerOfTwo64(c)
7371 // result: (MOVWUreg (ADDshiftLL <a.Type> a x [log64(c)]))
7374 if v_1.Op != OpARM64MOVDconst {
7377 c := auxIntToInt64(v_1.AuxInt)
7379 if !(isPowerOfTwo64(c)) {
7382 v.reset(OpARM64MOVWUreg)
7383 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
7384 v0.AuxInt = int64ToAuxInt(log64(c))
7389 // match: (MADDW a (MOVDconst [c]) x)
7390 // cond: isPowerOfTwo64(c-1) && int32(c)>=3
7391 // result: (MOVWUreg (ADD <a.Type> a (ADDshiftLL <x.Type> x x [log64(c-1)])))
7394 if v_1.Op != OpARM64MOVDconst {
7397 c := auxIntToInt64(v_1.AuxInt)
7399 if !(isPowerOfTwo64(c-1) && int32(c) >= 3) {
7402 v.reset(OpARM64MOVWUreg)
7403 v0 := b.NewValue0(v.Pos, OpARM64ADD, a.Type)
7404 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7405 v1.AuxInt = int64ToAuxInt(log64(c - 1))
7411 // match: (MADDW a (MOVDconst [c]) x)
7412 // cond: isPowerOfTwo64(c+1) && int32(c)>=7
7413 // result: (MOVWUreg (SUB <a.Type> a (SUBshiftLL <x.Type> x x [log64(c+1)])))
7416 if v_1.Op != OpARM64MOVDconst {
7419 c := auxIntToInt64(v_1.AuxInt)
7421 if !(isPowerOfTwo64(c+1) && int32(c) >= 7) {
7424 v.reset(OpARM64MOVWUreg)
7425 v0 := b.NewValue0(v.Pos, OpARM64SUB, a.Type)
7426 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7427 v1.AuxInt = int64ToAuxInt(log64(c + 1))
7433 // match: (MADDW a (MOVDconst [c]) x)
7434 // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)
7435 // result: (MOVWUreg (SUBshiftLL <a.Type> a (SUBshiftLL <x.Type> x x [2]) [log64(c/3)]))
7438 if v_1.Op != OpARM64MOVDconst {
7441 c := auxIntToInt64(v_1.AuxInt)
7443 if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) {
7446 v.reset(OpARM64MOVWUreg)
7447 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
7448 v0.AuxInt = int64ToAuxInt(log64(c / 3))
7449 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7450 v1.AuxInt = int64ToAuxInt(2)
7456 // match: (MADDW a (MOVDconst [c]) x)
7457 // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)
7458 // result: (MOVWUreg (ADDshiftLL <a.Type> a (ADDshiftLL <x.Type> x x [2]) [log64(c/5)]))
7461 if v_1.Op != OpARM64MOVDconst {
7464 c := auxIntToInt64(v_1.AuxInt)
7466 if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) {
7469 v.reset(OpARM64MOVWUreg)
7470 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
7471 v0.AuxInt = int64ToAuxInt(log64(c / 5))
7472 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7473 v1.AuxInt = int64ToAuxInt(2)
7479 // match: (MADDW a (MOVDconst [c]) x)
7480 // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)
7481 // result: (MOVWUreg (SUBshiftLL <a.Type> a (SUBshiftLL <x.Type> x x [3]) [log64(c/7)]))
7484 if v_1.Op != OpARM64MOVDconst {
7487 c := auxIntToInt64(v_1.AuxInt)
7489 if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) {
7492 v.reset(OpARM64MOVWUreg)
7493 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
7494 v0.AuxInt = int64ToAuxInt(log64(c / 7))
7495 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7496 v1.AuxInt = int64ToAuxInt(3)
7502 // match: (MADDW a (MOVDconst [c]) x)
7503 // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)
7504 // result: (MOVWUreg (ADDshiftLL <a.Type> a (ADDshiftLL <x.Type> x x [3]) [log64(c/9)]))
7507 if v_1.Op != OpARM64MOVDconst {
7510 c := auxIntToInt64(v_1.AuxInt)
7512 if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) {
7515 v.reset(OpARM64MOVWUreg)
7516 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
7517 v0.AuxInt = int64ToAuxInt(log64(c / 9))
7518 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7519 v1.AuxInt = int64ToAuxInt(3)
7525 // match: (MADDW (MOVDconst [c]) x y)
7526 // result: (MOVWUreg (ADDconst <x.Type> [c] (MULW <x.Type> x y)))
7528 if v_0.Op != OpARM64MOVDconst {
7531 c := auxIntToInt64(v_0.AuxInt)
7534 v.reset(OpARM64MOVWUreg)
7535 v0 := b.NewValue0(v.Pos, OpARM64ADDconst, x.Type)
7536 v0.AuxInt = int64ToAuxInt(c)
7537 v1 := b.NewValue0(v.Pos, OpARM64MULW, x.Type)
7543 // match: (MADDW a (MOVDconst [c]) (MOVDconst [d]))
7544 // result: (MOVWUreg (ADDconst <a.Type> [c*d] a))
7547 if v_1.Op != OpARM64MOVDconst {
7550 c := auxIntToInt64(v_1.AuxInt)
7551 if v_2.Op != OpARM64MOVDconst {
7554 d := auxIntToInt64(v_2.AuxInt)
7555 v.reset(OpARM64MOVWUreg)
7556 v0 := b.NewValue0(v.Pos, OpARM64ADDconst, a.Type)
7557 v0.AuxInt = int64ToAuxInt(c * d)
7564 func rewriteValueARM64_OpARM64MNEG(v *Value) bool {
7568 // match: (MNEG x (MOVDconst [-1]))
7571 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7573 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
7581 // match: (MNEG _ (MOVDconst [0]))
7582 // result: (MOVDconst [0])
7584 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7585 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
7588 v.reset(OpARM64MOVDconst)
7589 v.AuxInt = int64ToAuxInt(0)
7594 // match: (MNEG x (MOVDconst [1]))
7597 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7599 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
7608 // match: (MNEG x (MOVDconst [c]))
7609 // cond: isPowerOfTwo64(c)
7610 // result: (NEG (SLLconst <x.Type> [log64(c)] x))
7612 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7614 if v_1.Op != OpARM64MOVDconst {
7617 c := auxIntToInt64(v_1.AuxInt)
7618 if !(isPowerOfTwo64(c)) {
7622 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
7623 v0.AuxInt = int64ToAuxInt(log64(c))
7630 // match: (MNEG x (MOVDconst [c]))
7631 // cond: isPowerOfTwo64(c-1) && c >= 3
7632 // result: (NEG (ADDshiftLL <x.Type> x x [log64(c-1)]))
7634 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7636 if v_1.Op != OpARM64MOVDconst {
7639 c := auxIntToInt64(v_1.AuxInt)
7640 if !(isPowerOfTwo64(c-1) && c >= 3) {
7644 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7645 v0.AuxInt = int64ToAuxInt(log64(c - 1))
7652 // match: (MNEG x (MOVDconst [c]))
7653 // cond: isPowerOfTwo64(c+1) && c >= 7
7654 // result: (NEG (ADDshiftLL <x.Type> (NEG <x.Type> x) x [log64(c+1)]))
7656 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7658 if v_1.Op != OpARM64MOVDconst {
7661 c := auxIntToInt64(v_1.AuxInt)
7662 if !(isPowerOfTwo64(c+1) && c >= 7) {
7666 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7667 v0.AuxInt = int64ToAuxInt(log64(c + 1))
7668 v1 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
7676 // match: (MNEG x (MOVDconst [c]))
7677 // cond: c%3 == 0 && isPowerOfTwo64(c/3)
7678 // result: (SLLconst <x.Type> [log64(c/3)] (SUBshiftLL <x.Type> x x [2]))
7680 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7682 if v_1.Op != OpARM64MOVDconst {
7685 c := auxIntToInt64(v_1.AuxInt)
7686 if !(c%3 == 0 && isPowerOfTwo64(c/3)) {
7689 v.reset(OpARM64SLLconst)
7691 v.AuxInt = int64ToAuxInt(log64(c / 3))
7692 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7693 v0.AuxInt = int64ToAuxInt(2)
7700 // match: (MNEG x (MOVDconst [c]))
7701 // cond: c%5 == 0 && isPowerOfTwo64(c/5)
7702 // result: (NEG (SLLconst <x.Type> [log64(c/5)] (ADDshiftLL <x.Type> x x [2])))
7704 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7706 if v_1.Op != OpARM64MOVDconst {
7709 c := auxIntToInt64(v_1.AuxInt)
7710 if !(c%5 == 0 && isPowerOfTwo64(c/5)) {
7714 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
7715 v0.AuxInt = int64ToAuxInt(log64(c / 5))
7716 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7717 v1.AuxInt = int64ToAuxInt(2)
7725 // match: (MNEG x (MOVDconst [c]))
7726 // cond: c%7 == 0 && isPowerOfTwo64(c/7)
7727 // result: (SLLconst <x.Type> [log64(c/7)] (SUBshiftLL <x.Type> x x [3]))
7729 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7731 if v_1.Op != OpARM64MOVDconst {
7734 c := auxIntToInt64(v_1.AuxInt)
7735 if !(c%7 == 0 && isPowerOfTwo64(c/7)) {
7738 v.reset(OpARM64SLLconst)
7740 v.AuxInt = int64ToAuxInt(log64(c / 7))
7741 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7742 v0.AuxInt = int64ToAuxInt(3)
7749 // match: (MNEG x (MOVDconst [c]))
7750 // cond: c%9 == 0 && isPowerOfTwo64(c/9)
7751 // result: (NEG (SLLconst <x.Type> [log64(c/9)] (ADDshiftLL <x.Type> x x [3])))
7753 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7755 if v_1.Op != OpARM64MOVDconst {
7758 c := auxIntToInt64(v_1.AuxInt)
7759 if !(c%9 == 0 && isPowerOfTwo64(c/9)) {
7763 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
7764 v0.AuxInt = int64ToAuxInt(log64(c / 9))
7765 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7766 v1.AuxInt = int64ToAuxInt(3)
7774 // match: (MNEG (MOVDconst [c]) (MOVDconst [d]))
7775 // result: (MOVDconst [-c*d])
7777 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7778 if v_0.Op != OpARM64MOVDconst {
7781 c := auxIntToInt64(v_0.AuxInt)
7782 if v_1.Op != OpARM64MOVDconst {
7785 d := auxIntToInt64(v_1.AuxInt)
7786 v.reset(OpARM64MOVDconst)
7787 v.AuxInt = int64ToAuxInt(-c * d)
7794 func rewriteValueARM64_OpARM64MNEGW(v *Value) bool {
7798 // match: (MNEGW x (MOVDconst [c]))
7799 // cond: int32(c)==-1
7800 // result: (MOVWUreg x)
7802 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7804 if v_1.Op != OpARM64MOVDconst {
7807 c := auxIntToInt64(v_1.AuxInt)
7808 if !(int32(c) == -1) {
7811 v.reset(OpARM64MOVWUreg)
7817 // match: (MNEGW _ (MOVDconst [c]))
7818 // cond: int32(c)==0
7819 // result: (MOVDconst [0])
7821 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7822 if v_1.Op != OpARM64MOVDconst {
7825 c := auxIntToInt64(v_1.AuxInt)
7826 if !(int32(c) == 0) {
7829 v.reset(OpARM64MOVDconst)
7830 v.AuxInt = int64ToAuxInt(0)
7835 // match: (MNEGW x (MOVDconst [c]))
7836 // cond: int32(c)==1
7837 // result: (MOVWUreg (NEG <x.Type> x))
7839 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7841 if v_1.Op != OpARM64MOVDconst {
7844 c := auxIntToInt64(v_1.AuxInt)
7845 if !(int32(c) == 1) {
7848 v.reset(OpARM64MOVWUreg)
7849 v0 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
7856 // match: (MNEGW x (MOVDconst [c]))
7857 // cond: isPowerOfTwo64(c)
7858 // result: (NEG (SLLconst <x.Type> [log64(c)] x))
7860 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7862 if v_1.Op != OpARM64MOVDconst {
7865 c := auxIntToInt64(v_1.AuxInt)
7866 if !(isPowerOfTwo64(c)) {
7870 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
7871 v0.AuxInt = int64ToAuxInt(log64(c))
7878 // match: (MNEGW x (MOVDconst [c]))
7879 // cond: isPowerOfTwo64(c-1) && int32(c) >= 3
7880 // result: (MOVWUreg (NEG <x.Type> (ADDshiftLL <x.Type> x x [log64(c-1)])))
7882 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7884 if v_1.Op != OpARM64MOVDconst {
7887 c := auxIntToInt64(v_1.AuxInt)
7888 if !(isPowerOfTwo64(c-1) && int32(c) >= 3) {
7891 v.reset(OpARM64MOVWUreg)
7892 v0 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
7893 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7894 v1.AuxInt = int64ToAuxInt(log64(c - 1))
7902 // match: (MNEGW x (MOVDconst [c]))
7903 // cond: isPowerOfTwo64(c+1) && int32(c) >= 7
7904 // result: (MOVWUreg (NEG <x.Type> (ADDshiftLL <x.Type> (NEG <x.Type> x) x [log64(c+1)])))
7906 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7908 if v_1.Op != OpARM64MOVDconst {
7911 c := auxIntToInt64(v_1.AuxInt)
7912 if !(isPowerOfTwo64(c+1) && int32(c) >= 7) {
7915 v.reset(OpARM64MOVWUreg)
7916 v0 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
7917 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7918 v1.AuxInt = int64ToAuxInt(log64(c + 1))
7919 v2 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
7928 // match: (MNEGW x (MOVDconst [c]))
7929 // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)
7930 // result: (MOVWUreg (SLLconst <x.Type> [log64(c/3)] (SUBshiftLL <x.Type> x x [2])))
7932 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7934 if v_1.Op != OpARM64MOVDconst {
7937 c := auxIntToInt64(v_1.AuxInt)
7938 if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) {
7941 v.reset(OpARM64MOVWUreg)
7942 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
7943 v0.AuxInt = int64ToAuxInt(log64(c / 3))
7944 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7945 v1.AuxInt = int64ToAuxInt(2)
7953 // match: (MNEGW x (MOVDconst [c]))
7954 // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)
7955 // result: (MOVWUreg (NEG <x.Type> (SLLconst <x.Type> [log64(c/5)] (ADDshiftLL <x.Type> x x [2]))))
7957 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7959 if v_1.Op != OpARM64MOVDconst {
7962 c := auxIntToInt64(v_1.AuxInt)
7963 if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) {
7966 v.reset(OpARM64MOVWUreg)
7967 v0 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
7968 v1 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
7969 v1.AuxInt = int64ToAuxInt(log64(c / 5))
7970 v2 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
7971 v2.AuxInt = int64ToAuxInt(2)
7980 // match: (MNEGW x (MOVDconst [c]))
7981 // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)
7982 // result: (MOVWUreg (SLLconst <x.Type> [log64(c/7)] (SUBshiftLL <x.Type> x x [3])))
7984 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
7986 if v_1.Op != OpARM64MOVDconst {
7989 c := auxIntToInt64(v_1.AuxInt)
7990 if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) {
7993 v.reset(OpARM64MOVWUreg)
7994 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
7995 v0.AuxInt = int64ToAuxInt(log64(c / 7))
7996 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
7997 v1.AuxInt = int64ToAuxInt(3)
8005 // match: (MNEGW x (MOVDconst [c]))
8006 // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)
8007 // result: (MOVWUreg (NEG <x.Type> (SLLconst <x.Type> [log64(c/9)] (ADDshiftLL <x.Type> x x [3]))))
8009 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8011 if v_1.Op != OpARM64MOVDconst {
8014 c := auxIntToInt64(v_1.AuxInt)
8015 if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) {
8018 v.reset(OpARM64MOVWUreg)
8019 v0 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
8020 v1 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
8021 v1.AuxInt = int64ToAuxInt(log64(c / 9))
8022 v2 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
8023 v2.AuxInt = int64ToAuxInt(3)
8032 // match: (MNEGW (MOVDconst [c]) (MOVDconst [d]))
8033 // result: (MOVDconst [int64(uint32(-c*d))])
8035 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8036 if v_0.Op != OpARM64MOVDconst {
8039 c := auxIntToInt64(v_0.AuxInt)
8040 if v_1.Op != OpARM64MOVDconst {
8043 d := auxIntToInt64(v_1.AuxInt)
8044 v.reset(OpARM64MOVDconst)
8045 v.AuxInt = int64ToAuxInt(int64(uint32(-c * d)))
8052 func rewriteValueARM64_OpARM64MOD(v *Value) bool {
8055 // match: (MOD (MOVDconst [c]) (MOVDconst [d]))
8057 // result: (MOVDconst [c%d])
8059 if v_0.Op != OpARM64MOVDconst {
8062 c := auxIntToInt64(v_0.AuxInt)
8063 if v_1.Op != OpARM64MOVDconst {
8066 d := auxIntToInt64(v_1.AuxInt)
8070 v.reset(OpARM64MOVDconst)
8071 v.AuxInt = int64ToAuxInt(c % d)
8076 func rewriteValueARM64_OpARM64MODW(v *Value) bool {
8079 // match: (MODW (MOVDconst [c]) (MOVDconst [d]))
8081 // result: (MOVDconst [int64(uint32(int32(c)%int32(d)))])
8083 if v_0.Op != OpARM64MOVDconst {
8086 c := auxIntToInt64(v_0.AuxInt)
8087 if v_1.Op != OpARM64MOVDconst {
8090 d := auxIntToInt64(v_1.AuxInt)
8094 v.reset(OpARM64MOVDconst)
8095 v.AuxInt = int64ToAuxInt(int64(uint32(int32(c) % int32(d))))
8100 func rewriteValueARM64_OpARM64MOVBUload(v *Value) bool {
8104 config := b.Func.Config
8105 // match: (MOVBUload [off1] {sym} (ADDconst [off2] ptr) mem)
8106 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
8107 // result: (MOVBUload [off1+int32(off2)] {sym} ptr mem)
8109 off1 := auxIntToInt32(v.AuxInt)
8110 sym := auxToSym(v.Aux)
8111 if v_0.Op != OpARM64ADDconst {
8114 off2 := auxIntToInt64(v_0.AuxInt)
8117 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
8120 v.reset(OpARM64MOVBUload)
8121 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8122 v.Aux = symToAux(sym)
8126 // match: (MOVBUload [off] {sym} (ADD ptr idx) mem)
8127 // cond: off == 0 && sym == nil
8128 // result: (MOVBUloadidx ptr idx mem)
8130 off := auxIntToInt32(v.AuxInt)
8131 sym := auxToSym(v.Aux)
8132 if v_0.Op != OpARM64ADD {
8138 if !(off == 0 && sym == nil) {
8141 v.reset(OpARM64MOVBUloadidx)
8142 v.AddArg3(ptr, idx, mem)
8145 // match: (MOVBUload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
8146 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
8147 // result: (MOVBUload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8149 off1 := auxIntToInt32(v.AuxInt)
8150 sym1 := auxToSym(v.Aux)
8151 if v_0.Op != OpARM64MOVDaddr {
8154 off2 := auxIntToInt32(v_0.AuxInt)
8155 sym2 := auxToSym(v_0.Aux)
8158 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
8161 v.reset(OpARM64MOVBUload)
8162 v.AuxInt = int32ToAuxInt(off1 + off2)
8163 v.Aux = symToAux(mergeSym(sym1, sym2))
8167 // match: (MOVBUload [off] {sym} ptr (MOVBstorezero [off2] {sym2} ptr2 _))
8168 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
8169 // result: (MOVDconst [0])
8171 off := auxIntToInt32(v.AuxInt)
8172 sym := auxToSym(v.Aux)
8174 if v_1.Op != OpARM64MOVBstorezero {
8177 off2 := auxIntToInt32(v_1.AuxInt)
8178 sym2 := auxToSym(v_1.Aux)
8180 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
8183 v.reset(OpARM64MOVDconst)
8184 v.AuxInt = int64ToAuxInt(0)
8187 // match: (MOVBUload [off] {sym} (SB) _)
8188 // cond: symIsRO(sym)
8189 // result: (MOVDconst [int64(read8(sym, int64(off)))])
8191 off := auxIntToInt32(v.AuxInt)
8192 sym := auxToSym(v.Aux)
8193 if v_0.Op != OpSB || !(symIsRO(sym)) {
8196 v.reset(OpARM64MOVDconst)
8197 v.AuxInt = int64ToAuxInt(int64(read8(sym, int64(off))))
8202 func rewriteValueARM64_OpARM64MOVBUloadidx(v *Value) bool {
8206 // match: (MOVBUloadidx ptr (MOVDconst [c]) mem)
8208 // result: (MOVBUload [int32(c)] ptr mem)
8211 if v_1.Op != OpARM64MOVDconst {
8214 c := auxIntToInt64(v_1.AuxInt)
8219 v.reset(OpARM64MOVBUload)
8220 v.AuxInt = int32ToAuxInt(int32(c))
8224 // match: (MOVBUloadidx (MOVDconst [c]) ptr mem)
8226 // result: (MOVBUload [int32(c)] ptr mem)
8228 if v_0.Op != OpARM64MOVDconst {
8231 c := auxIntToInt64(v_0.AuxInt)
8237 v.reset(OpARM64MOVBUload)
8238 v.AuxInt = int32ToAuxInt(int32(c))
8242 // match: (MOVBUloadidx ptr idx (MOVBstorezeroidx ptr2 idx2 _))
8243 // cond: (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2))
8244 // result: (MOVDconst [0])
8248 if v_2.Op != OpARM64MOVBstorezeroidx {
8253 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) {
8256 v.reset(OpARM64MOVDconst)
8257 v.AuxInt = int64ToAuxInt(0)
8262 func rewriteValueARM64_OpARM64MOVBUreg(v *Value) bool {
8264 // match: (MOVBUreg x:(MOVBUload _ _))
8265 // result: (MOVDreg x)
8268 if x.Op != OpARM64MOVBUload {
8271 v.reset(OpARM64MOVDreg)
8275 // match: (MOVBUreg x:(MOVBUloadidx _ _ _))
8276 // result: (MOVDreg x)
8279 if x.Op != OpARM64MOVBUloadidx {
8282 v.reset(OpARM64MOVDreg)
8286 // match: (MOVBUreg x:(MOVBUreg _))
8287 // result: (MOVDreg x)
8290 if x.Op != OpARM64MOVBUreg {
8293 v.reset(OpARM64MOVDreg)
8297 // match: (MOVBUreg (ANDconst [c] x))
8298 // result: (ANDconst [c&(1<<8-1)] x)
8300 if v_0.Op != OpARM64ANDconst {
8303 c := auxIntToInt64(v_0.AuxInt)
8305 v.reset(OpARM64ANDconst)
8306 v.AuxInt = int64ToAuxInt(c & (1<<8 - 1))
8310 // match: (MOVBUreg (MOVDconst [c]))
8311 // result: (MOVDconst [int64(uint8(c))])
8313 if v_0.Op != OpARM64MOVDconst {
8316 c := auxIntToInt64(v_0.AuxInt)
8317 v.reset(OpARM64MOVDconst)
8318 v.AuxInt = int64ToAuxInt(int64(uint8(c)))
8321 // match: (MOVBUreg x:(Equal _))
8322 // result: (MOVDreg x)
8325 if x.Op != OpARM64Equal {
8328 v.reset(OpARM64MOVDreg)
8332 // match: (MOVBUreg x:(NotEqual _))
8333 // result: (MOVDreg x)
8336 if x.Op != OpARM64NotEqual {
8339 v.reset(OpARM64MOVDreg)
8343 // match: (MOVBUreg x:(LessThan _))
8344 // result: (MOVDreg x)
8347 if x.Op != OpARM64LessThan {
8350 v.reset(OpARM64MOVDreg)
8354 // match: (MOVBUreg x:(LessThanU _))
8355 // result: (MOVDreg x)
8358 if x.Op != OpARM64LessThanU {
8361 v.reset(OpARM64MOVDreg)
8365 // match: (MOVBUreg x:(LessThanF _))
8366 // result: (MOVDreg x)
8369 if x.Op != OpARM64LessThanF {
8372 v.reset(OpARM64MOVDreg)
8376 // match: (MOVBUreg x:(LessEqual _))
8377 // result: (MOVDreg x)
8380 if x.Op != OpARM64LessEqual {
8383 v.reset(OpARM64MOVDreg)
8387 // match: (MOVBUreg x:(LessEqualU _))
8388 // result: (MOVDreg x)
8391 if x.Op != OpARM64LessEqualU {
8394 v.reset(OpARM64MOVDreg)
8398 // match: (MOVBUreg x:(LessEqualF _))
8399 // result: (MOVDreg x)
8402 if x.Op != OpARM64LessEqualF {
8405 v.reset(OpARM64MOVDreg)
8409 // match: (MOVBUreg x:(GreaterThan _))
8410 // result: (MOVDreg x)
8413 if x.Op != OpARM64GreaterThan {
8416 v.reset(OpARM64MOVDreg)
8420 // match: (MOVBUreg x:(GreaterThanU _))
8421 // result: (MOVDreg x)
8424 if x.Op != OpARM64GreaterThanU {
8427 v.reset(OpARM64MOVDreg)
8431 // match: (MOVBUreg x:(GreaterThanF _))
8432 // result: (MOVDreg x)
8435 if x.Op != OpARM64GreaterThanF {
8438 v.reset(OpARM64MOVDreg)
8442 // match: (MOVBUreg x:(GreaterEqual _))
8443 // result: (MOVDreg x)
8446 if x.Op != OpARM64GreaterEqual {
8449 v.reset(OpARM64MOVDreg)
8453 // match: (MOVBUreg x:(GreaterEqualU _))
8454 // result: (MOVDreg x)
8457 if x.Op != OpARM64GreaterEqualU {
8460 v.reset(OpARM64MOVDreg)
8464 // match: (MOVBUreg x:(GreaterEqualF _))
8465 // result: (MOVDreg x)
8468 if x.Op != OpARM64GreaterEqualF {
8471 v.reset(OpARM64MOVDreg)
8475 // match: (MOVBUreg x)
8476 // cond: v.Type.Size() <= 1
8480 if !(v.Type.Size() <= 1) {
8486 // match: (MOVBUreg (SLLconst [lc] x))
8488 // result: (MOVDconst [0])
8490 if v_0.Op != OpARM64SLLconst {
8493 lc := auxIntToInt64(v_0.AuxInt)
8497 v.reset(OpARM64MOVDconst)
8498 v.AuxInt = int64ToAuxInt(0)
8501 // match: (MOVBUreg (SLLconst [lc] x))
8503 // result: (UBFIZ [armBFAuxInt(lc, 8-lc)] x)
8505 if v_0.Op != OpARM64SLLconst {
8508 lc := auxIntToInt64(v_0.AuxInt)
8513 v.reset(OpARM64UBFIZ)
8514 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, 8-lc))
8518 // match: (MOVBUreg (SRLconst [rc] x))
8520 // result: (UBFX [armBFAuxInt(rc, 8)] x)
8522 if v_0.Op != OpARM64SRLconst {
8525 rc := auxIntToInt64(v_0.AuxInt)
8530 v.reset(OpARM64UBFX)
8531 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc, 8))
8535 // match: (MOVBUreg (UBFX [bfc] x))
8536 // cond: bfc.getARM64BFwidth() <= 8
8537 // result: (UBFX [bfc] x)
8539 if v_0.Op != OpARM64UBFX {
8542 bfc := auxIntToArm64BitField(v_0.AuxInt)
8544 if !(bfc.getARM64BFwidth() <= 8) {
8547 v.reset(OpARM64UBFX)
8548 v.AuxInt = arm64BitFieldToAuxInt(bfc)
8554 func rewriteValueARM64_OpARM64MOVBload(v *Value) bool {
8558 config := b.Func.Config
8559 // match: (MOVBload [off1] {sym} (ADDconst [off2] ptr) mem)
8560 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
8561 // result: (MOVBload [off1+int32(off2)] {sym} ptr mem)
8563 off1 := auxIntToInt32(v.AuxInt)
8564 sym := auxToSym(v.Aux)
8565 if v_0.Op != OpARM64ADDconst {
8568 off2 := auxIntToInt64(v_0.AuxInt)
8571 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
8574 v.reset(OpARM64MOVBload)
8575 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8576 v.Aux = symToAux(sym)
8580 // match: (MOVBload [off] {sym} (ADD ptr idx) mem)
8581 // cond: off == 0 && sym == nil
8582 // result: (MOVBloadidx ptr idx mem)
8584 off := auxIntToInt32(v.AuxInt)
8585 sym := auxToSym(v.Aux)
8586 if v_0.Op != OpARM64ADD {
8592 if !(off == 0 && sym == nil) {
8595 v.reset(OpARM64MOVBloadidx)
8596 v.AddArg3(ptr, idx, mem)
8599 // match: (MOVBload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
8600 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
8601 // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8603 off1 := auxIntToInt32(v.AuxInt)
8604 sym1 := auxToSym(v.Aux)
8605 if v_0.Op != OpARM64MOVDaddr {
8608 off2 := auxIntToInt32(v_0.AuxInt)
8609 sym2 := auxToSym(v_0.Aux)
8612 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
8615 v.reset(OpARM64MOVBload)
8616 v.AuxInt = int32ToAuxInt(off1 + off2)
8617 v.Aux = symToAux(mergeSym(sym1, sym2))
8621 // match: (MOVBload [off] {sym} ptr (MOVBstorezero [off2] {sym2} ptr2 _))
8622 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
8623 // result: (MOVDconst [0])
8625 off := auxIntToInt32(v.AuxInt)
8626 sym := auxToSym(v.Aux)
8628 if v_1.Op != OpARM64MOVBstorezero {
8631 off2 := auxIntToInt32(v_1.AuxInt)
8632 sym2 := auxToSym(v_1.Aux)
8634 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
8637 v.reset(OpARM64MOVDconst)
8638 v.AuxInt = int64ToAuxInt(0)
8643 func rewriteValueARM64_OpARM64MOVBloadidx(v *Value) bool {
8647 // match: (MOVBloadidx ptr (MOVDconst [c]) mem)
8649 // result: (MOVBload [int32(c)] ptr mem)
8652 if v_1.Op != OpARM64MOVDconst {
8655 c := auxIntToInt64(v_1.AuxInt)
8660 v.reset(OpARM64MOVBload)
8661 v.AuxInt = int32ToAuxInt(int32(c))
8665 // match: (MOVBloadidx (MOVDconst [c]) ptr mem)
8667 // result: (MOVBload [int32(c)] ptr mem)
8669 if v_0.Op != OpARM64MOVDconst {
8672 c := auxIntToInt64(v_0.AuxInt)
8678 v.reset(OpARM64MOVBload)
8679 v.AuxInt = int32ToAuxInt(int32(c))
8683 // match: (MOVBloadidx ptr idx (MOVBstorezeroidx ptr2 idx2 _))
8684 // cond: (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2))
8685 // result: (MOVDconst [0])
8689 if v_2.Op != OpARM64MOVBstorezeroidx {
8694 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) {
8697 v.reset(OpARM64MOVDconst)
8698 v.AuxInt = int64ToAuxInt(0)
8703 func rewriteValueARM64_OpARM64MOVBreg(v *Value) bool {
8705 // match: (MOVBreg x:(MOVBload _ _))
8706 // result: (MOVDreg x)
8709 if x.Op != OpARM64MOVBload {
8712 v.reset(OpARM64MOVDreg)
8716 // match: (MOVBreg x:(MOVBloadidx _ _ _))
8717 // result: (MOVDreg x)
8720 if x.Op != OpARM64MOVBloadidx {
8723 v.reset(OpARM64MOVDreg)
8727 // match: (MOVBreg x:(MOVBreg _))
8728 // result: (MOVDreg x)
8731 if x.Op != OpARM64MOVBreg {
8734 v.reset(OpARM64MOVDreg)
8738 // match: (MOVBreg (MOVDconst [c]))
8739 // result: (MOVDconst [int64(int8(c))])
8741 if v_0.Op != OpARM64MOVDconst {
8744 c := auxIntToInt64(v_0.AuxInt)
8745 v.reset(OpARM64MOVDconst)
8746 v.AuxInt = int64ToAuxInt(int64(int8(c)))
8749 // match: (MOVBreg x)
8750 // cond: v.Type.Size() <= 1
8754 if !(v.Type.Size() <= 1) {
8760 // match: (MOVBreg <t> (ANDconst x [c]))
8761 // cond: uint64(c) & uint64(0xffffffffffffff80) == 0
8762 // result: (ANDconst <t> x [c])
8765 if v_0.Op != OpARM64ANDconst {
8768 c := auxIntToInt64(v_0.AuxInt)
8770 if !(uint64(c)&uint64(0xffffffffffffff80) == 0) {
8773 v.reset(OpARM64ANDconst)
8775 v.AuxInt = int64ToAuxInt(c)
8779 // match: (MOVBreg (SLLconst [lc] x))
8781 // result: (SBFIZ [armBFAuxInt(lc, 8-lc)] x)
8783 if v_0.Op != OpARM64SLLconst {
8786 lc := auxIntToInt64(v_0.AuxInt)
8791 v.reset(OpARM64SBFIZ)
8792 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, 8-lc))
8796 // match: (MOVBreg (SBFX [bfc] x))
8797 // cond: bfc.getARM64BFwidth() <= 8
8798 // result: (SBFX [bfc] x)
8800 if v_0.Op != OpARM64SBFX {
8803 bfc := auxIntToArm64BitField(v_0.AuxInt)
8805 if !(bfc.getARM64BFwidth() <= 8) {
8808 v.reset(OpARM64SBFX)
8809 v.AuxInt = arm64BitFieldToAuxInt(bfc)
8815 func rewriteValueARM64_OpARM64MOVBstore(v *Value) bool {
8820 config := b.Func.Config
8821 // match: (MOVBstore [off1] {sym} (ADDconst [off2] ptr) val mem)
8822 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
8823 // result: (MOVBstore [off1+int32(off2)] {sym} ptr val mem)
8825 off1 := auxIntToInt32(v.AuxInt)
8826 sym := auxToSym(v.Aux)
8827 if v_0.Op != OpARM64ADDconst {
8830 off2 := auxIntToInt64(v_0.AuxInt)
8834 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
8837 v.reset(OpARM64MOVBstore)
8838 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8839 v.Aux = symToAux(sym)
8840 v.AddArg3(ptr, val, mem)
8843 // match: (MOVBstore [off] {sym} (ADD ptr idx) val mem)
8844 // cond: off == 0 && sym == nil
8845 // result: (MOVBstoreidx ptr idx val mem)
8847 off := auxIntToInt32(v.AuxInt)
8848 sym := auxToSym(v.Aux)
8849 if v_0.Op != OpARM64ADD {
8856 if !(off == 0 && sym == nil) {
8859 v.reset(OpARM64MOVBstoreidx)
8860 v.AddArg4(ptr, idx, val, mem)
8863 // match: (MOVBstore [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) val mem)
8864 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
8865 // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
8867 off1 := auxIntToInt32(v.AuxInt)
8868 sym1 := auxToSym(v.Aux)
8869 if v_0.Op != OpARM64MOVDaddr {
8872 off2 := auxIntToInt32(v_0.AuxInt)
8873 sym2 := auxToSym(v_0.Aux)
8877 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
8880 v.reset(OpARM64MOVBstore)
8881 v.AuxInt = int32ToAuxInt(off1 + off2)
8882 v.Aux = symToAux(mergeSym(sym1, sym2))
8883 v.AddArg3(ptr, val, mem)
8886 // match: (MOVBstore [off] {sym} ptr (MOVDconst [0]) mem)
8887 // result: (MOVBstorezero [off] {sym} ptr mem)
8889 off := auxIntToInt32(v.AuxInt)
8890 sym := auxToSym(v.Aux)
8892 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
8896 v.reset(OpARM64MOVBstorezero)
8897 v.AuxInt = int32ToAuxInt(off)
8898 v.Aux = symToAux(sym)
8902 // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem)
8903 // result: (MOVBstore [off] {sym} ptr x mem)
8905 off := auxIntToInt32(v.AuxInt)
8906 sym := auxToSym(v.Aux)
8908 if v_1.Op != OpARM64MOVBreg {
8913 v.reset(OpARM64MOVBstore)
8914 v.AuxInt = int32ToAuxInt(off)
8915 v.Aux = symToAux(sym)
8916 v.AddArg3(ptr, x, mem)
8919 // match: (MOVBstore [off] {sym} ptr (MOVBUreg x) mem)
8920 // result: (MOVBstore [off] {sym} ptr x mem)
8922 off := auxIntToInt32(v.AuxInt)
8923 sym := auxToSym(v.Aux)
8925 if v_1.Op != OpARM64MOVBUreg {
8930 v.reset(OpARM64MOVBstore)
8931 v.AuxInt = int32ToAuxInt(off)
8932 v.Aux = symToAux(sym)
8933 v.AddArg3(ptr, x, mem)
8936 // match: (MOVBstore [off] {sym} ptr (MOVHreg x) mem)
8937 // result: (MOVBstore [off] {sym} ptr x mem)
8939 off := auxIntToInt32(v.AuxInt)
8940 sym := auxToSym(v.Aux)
8942 if v_1.Op != OpARM64MOVHreg {
8947 v.reset(OpARM64MOVBstore)
8948 v.AuxInt = int32ToAuxInt(off)
8949 v.Aux = symToAux(sym)
8950 v.AddArg3(ptr, x, mem)
8953 // match: (MOVBstore [off] {sym} ptr (MOVHUreg x) mem)
8954 // result: (MOVBstore [off] {sym} ptr x mem)
8956 off := auxIntToInt32(v.AuxInt)
8957 sym := auxToSym(v.Aux)
8959 if v_1.Op != OpARM64MOVHUreg {
8964 v.reset(OpARM64MOVBstore)
8965 v.AuxInt = int32ToAuxInt(off)
8966 v.Aux = symToAux(sym)
8967 v.AddArg3(ptr, x, mem)
8970 // match: (MOVBstore [off] {sym} ptr (MOVWreg x) mem)
8971 // result: (MOVBstore [off] {sym} ptr x mem)
8973 off := auxIntToInt32(v.AuxInt)
8974 sym := auxToSym(v.Aux)
8976 if v_1.Op != OpARM64MOVWreg {
8981 v.reset(OpARM64MOVBstore)
8982 v.AuxInt = int32ToAuxInt(off)
8983 v.Aux = symToAux(sym)
8984 v.AddArg3(ptr, x, mem)
8987 // match: (MOVBstore [off] {sym} ptr (MOVWUreg x) mem)
8988 // result: (MOVBstore [off] {sym} ptr x mem)
8990 off := auxIntToInt32(v.AuxInt)
8991 sym := auxToSym(v.Aux)
8993 if v_1.Op != OpARM64MOVWUreg {
8998 v.reset(OpARM64MOVBstore)
8999 v.AuxInt = int32ToAuxInt(off)
9000 v.Aux = symToAux(sym)
9001 v.AddArg3(ptr, x, mem)
9006 func rewriteValueARM64_OpARM64MOVBstoreidx(v *Value) bool {
9011 // match: (MOVBstoreidx ptr (MOVDconst [c]) val mem)
9013 // result: (MOVBstore [int32(c)] ptr val mem)
9016 if v_1.Op != OpARM64MOVDconst {
9019 c := auxIntToInt64(v_1.AuxInt)
9025 v.reset(OpARM64MOVBstore)
9026 v.AuxInt = int32ToAuxInt(int32(c))
9027 v.AddArg3(ptr, val, mem)
9030 // match: (MOVBstoreidx (MOVDconst [c]) idx val mem)
9032 // result: (MOVBstore [int32(c)] idx val mem)
9034 if v_0.Op != OpARM64MOVDconst {
9037 c := auxIntToInt64(v_0.AuxInt)
9044 v.reset(OpARM64MOVBstore)
9045 v.AuxInt = int32ToAuxInt(int32(c))
9046 v.AddArg3(idx, val, mem)
9049 // match: (MOVBstoreidx ptr idx (MOVDconst [0]) mem)
9050 // result: (MOVBstorezeroidx ptr idx mem)
9054 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
9058 v.reset(OpARM64MOVBstorezeroidx)
9059 v.AddArg3(ptr, idx, mem)
9062 // match: (MOVBstoreidx ptr idx (MOVBreg x) mem)
9063 // result: (MOVBstoreidx ptr idx x mem)
9067 if v_2.Op != OpARM64MOVBreg {
9072 v.reset(OpARM64MOVBstoreidx)
9073 v.AddArg4(ptr, idx, x, mem)
9076 // match: (MOVBstoreidx ptr idx (MOVBUreg x) mem)
9077 // result: (MOVBstoreidx ptr idx x mem)
9081 if v_2.Op != OpARM64MOVBUreg {
9086 v.reset(OpARM64MOVBstoreidx)
9087 v.AddArg4(ptr, idx, x, mem)
9090 // match: (MOVBstoreidx ptr idx (MOVHreg x) mem)
9091 // result: (MOVBstoreidx ptr idx x mem)
9095 if v_2.Op != OpARM64MOVHreg {
9100 v.reset(OpARM64MOVBstoreidx)
9101 v.AddArg4(ptr, idx, x, mem)
9104 // match: (MOVBstoreidx ptr idx (MOVHUreg x) mem)
9105 // result: (MOVBstoreidx ptr idx x mem)
9109 if v_2.Op != OpARM64MOVHUreg {
9114 v.reset(OpARM64MOVBstoreidx)
9115 v.AddArg4(ptr, idx, x, mem)
9118 // match: (MOVBstoreidx ptr idx (MOVWreg x) mem)
9119 // result: (MOVBstoreidx ptr idx x mem)
9123 if v_2.Op != OpARM64MOVWreg {
9128 v.reset(OpARM64MOVBstoreidx)
9129 v.AddArg4(ptr, idx, x, mem)
9132 // match: (MOVBstoreidx ptr idx (MOVWUreg x) mem)
9133 // result: (MOVBstoreidx ptr idx x mem)
9137 if v_2.Op != OpARM64MOVWUreg {
9142 v.reset(OpARM64MOVBstoreidx)
9143 v.AddArg4(ptr, idx, x, mem)
9148 func rewriteValueARM64_OpARM64MOVBstorezero(v *Value) bool {
9152 config := b.Func.Config
9153 // match: (MOVBstorezero [off1] {sym} (ADDconst [off2] ptr) mem)
9154 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
9155 // result: (MOVBstorezero [off1+int32(off2)] {sym} ptr mem)
9157 off1 := auxIntToInt32(v.AuxInt)
9158 sym := auxToSym(v.Aux)
9159 if v_0.Op != OpARM64ADDconst {
9162 off2 := auxIntToInt64(v_0.AuxInt)
9165 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
9168 v.reset(OpARM64MOVBstorezero)
9169 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9170 v.Aux = symToAux(sym)
9174 // match: (MOVBstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
9175 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
9176 // result: (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
9178 off1 := auxIntToInt32(v.AuxInt)
9179 sym1 := auxToSym(v.Aux)
9180 if v_0.Op != OpARM64MOVDaddr {
9183 off2 := auxIntToInt32(v_0.AuxInt)
9184 sym2 := auxToSym(v_0.Aux)
9187 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
9190 v.reset(OpARM64MOVBstorezero)
9191 v.AuxInt = int32ToAuxInt(off1 + off2)
9192 v.Aux = symToAux(mergeSym(sym1, sym2))
9196 // match: (MOVBstorezero [off] {sym} (ADD ptr idx) mem)
9197 // cond: off == 0 && sym == nil
9198 // result: (MOVBstorezeroidx ptr idx mem)
9200 off := auxIntToInt32(v.AuxInt)
9201 sym := auxToSym(v.Aux)
9202 if v_0.Op != OpARM64ADD {
9208 if !(off == 0 && sym == nil) {
9211 v.reset(OpARM64MOVBstorezeroidx)
9212 v.AddArg3(ptr, idx, mem)
9217 func rewriteValueARM64_OpARM64MOVBstorezeroidx(v *Value) bool {
9221 // match: (MOVBstorezeroidx ptr (MOVDconst [c]) mem)
9223 // result: (MOVBstorezero [int32(c)] ptr mem)
9226 if v_1.Op != OpARM64MOVDconst {
9229 c := auxIntToInt64(v_1.AuxInt)
9234 v.reset(OpARM64MOVBstorezero)
9235 v.AuxInt = int32ToAuxInt(int32(c))
9239 // match: (MOVBstorezeroidx (MOVDconst [c]) idx mem)
9241 // result: (MOVBstorezero [int32(c)] idx mem)
9243 if v_0.Op != OpARM64MOVDconst {
9246 c := auxIntToInt64(v_0.AuxInt)
9252 v.reset(OpARM64MOVBstorezero)
9253 v.AuxInt = int32ToAuxInt(int32(c))
9259 func rewriteValueARM64_OpARM64MOVDload(v *Value) bool {
9263 config := b.Func.Config
9264 // match: (MOVDload [off] {sym} ptr (FMOVDstore [off] {sym} ptr val _))
9265 // result: (FMOVDfpgp val)
9267 off := auxIntToInt32(v.AuxInt)
9268 sym := auxToSym(v.Aux)
9270 if v_1.Op != OpARM64FMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
9274 if ptr != v_1.Args[0] {
9277 v.reset(OpARM64FMOVDfpgp)
9281 // match: (MOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
9282 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
9283 // result: (MOVDload [off1+int32(off2)] {sym} ptr mem)
9285 off1 := auxIntToInt32(v.AuxInt)
9286 sym := auxToSym(v.Aux)
9287 if v_0.Op != OpARM64ADDconst {
9290 off2 := auxIntToInt64(v_0.AuxInt)
9293 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
9296 v.reset(OpARM64MOVDload)
9297 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9298 v.Aux = symToAux(sym)
9302 // match: (MOVDload [off] {sym} (ADD ptr idx) mem)
9303 // cond: off == 0 && sym == nil
9304 // result: (MOVDloadidx ptr idx mem)
9306 off := auxIntToInt32(v.AuxInt)
9307 sym := auxToSym(v.Aux)
9308 if v_0.Op != OpARM64ADD {
9314 if !(off == 0 && sym == nil) {
9317 v.reset(OpARM64MOVDloadidx)
9318 v.AddArg3(ptr, idx, mem)
9321 // match: (MOVDload [off] {sym} (ADDshiftLL [3] ptr idx) mem)
9322 // cond: off == 0 && sym == nil
9323 // result: (MOVDloadidx8 ptr idx mem)
9325 off := auxIntToInt32(v.AuxInt)
9326 sym := auxToSym(v.Aux)
9327 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 3 {
9333 if !(off == 0 && sym == nil) {
9336 v.reset(OpARM64MOVDloadidx8)
9337 v.AddArg3(ptr, idx, mem)
9340 // match: (MOVDload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
9341 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
9342 // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
9344 off1 := auxIntToInt32(v.AuxInt)
9345 sym1 := auxToSym(v.Aux)
9346 if v_0.Op != OpARM64MOVDaddr {
9349 off2 := auxIntToInt32(v_0.AuxInt)
9350 sym2 := auxToSym(v_0.Aux)
9353 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
9356 v.reset(OpARM64MOVDload)
9357 v.AuxInt = int32ToAuxInt(off1 + off2)
9358 v.Aux = symToAux(mergeSym(sym1, sym2))
9362 // match: (MOVDload [off] {sym} ptr (MOVDstorezero [off2] {sym2} ptr2 _))
9363 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
9364 // result: (MOVDconst [0])
9366 off := auxIntToInt32(v.AuxInt)
9367 sym := auxToSym(v.Aux)
9369 if v_1.Op != OpARM64MOVDstorezero {
9372 off2 := auxIntToInt32(v_1.AuxInt)
9373 sym2 := auxToSym(v_1.Aux)
9375 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
9378 v.reset(OpARM64MOVDconst)
9379 v.AuxInt = int64ToAuxInt(0)
9382 // match: (MOVDload [off] {sym} (SB) _)
9383 // cond: symIsRO(sym)
9384 // result: (MOVDconst [int64(read64(sym, int64(off), config.ctxt.Arch.ByteOrder))])
9386 off := auxIntToInt32(v.AuxInt)
9387 sym := auxToSym(v.Aux)
9388 if v_0.Op != OpSB || !(symIsRO(sym)) {
9391 v.reset(OpARM64MOVDconst)
9392 v.AuxInt = int64ToAuxInt(int64(read64(sym, int64(off), config.ctxt.Arch.ByteOrder)))
9397 func rewriteValueARM64_OpARM64MOVDloadidx(v *Value) bool {
9401 // match: (MOVDloadidx ptr (MOVDconst [c]) mem)
9403 // result: (MOVDload [int32(c)] ptr mem)
9406 if v_1.Op != OpARM64MOVDconst {
9409 c := auxIntToInt64(v_1.AuxInt)
9414 v.reset(OpARM64MOVDload)
9415 v.AuxInt = int32ToAuxInt(int32(c))
9419 // match: (MOVDloadidx (MOVDconst [c]) ptr mem)
9421 // result: (MOVDload [int32(c)] ptr mem)
9423 if v_0.Op != OpARM64MOVDconst {
9426 c := auxIntToInt64(v_0.AuxInt)
9432 v.reset(OpARM64MOVDload)
9433 v.AuxInt = int32ToAuxInt(int32(c))
9437 // match: (MOVDloadidx ptr (SLLconst [3] idx) mem)
9438 // result: (MOVDloadidx8 ptr idx mem)
9441 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 3 {
9446 v.reset(OpARM64MOVDloadidx8)
9447 v.AddArg3(ptr, idx, mem)
9450 // match: (MOVDloadidx (SLLconst [3] idx) ptr mem)
9451 // result: (MOVDloadidx8 ptr idx mem)
9453 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 3 {
9459 v.reset(OpARM64MOVDloadidx8)
9460 v.AddArg3(ptr, idx, mem)
9463 // match: (MOVDloadidx ptr idx (MOVDstorezeroidx ptr2 idx2 _))
9464 // cond: (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2))
9465 // result: (MOVDconst [0])
9469 if v_2.Op != OpARM64MOVDstorezeroidx {
9474 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) {
9477 v.reset(OpARM64MOVDconst)
9478 v.AuxInt = int64ToAuxInt(0)
9483 func rewriteValueARM64_OpARM64MOVDloadidx8(v *Value) bool {
9487 // match: (MOVDloadidx8 ptr (MOVDconst [c]) mem)
9488 // cond: is32Bit(c<<3)
9489 // result: (MOVDload [int32(c)<<3] ptr mem)
9492 if v_1.Op != OpARM64MOVDconst {
9495 c := auxIntToInt64(v_1.AuxInt)
9497 if !(is32Bit(c << 3)) {
9500 v.reset(OpARM64MOVDload)
9501 v.AuxInt = int32ToAuxInt(int32(c) << 3)
9505 // match: (MOVDloadidx8 ptr idx (MOVDstorezeroidx8 ptr2 idx2 _))
9506 // cond: isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)
9507 // result: (MOVDconst [0])
9511 if v_2.Op != OpARM64MOVDstorezeroidx8 {
9516 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)) {
9519 v.reset(OpARM64MOVDconst)
9520 v.AuxInt = int64ToAuxInt(0)
9525 func rewriteValueARM64_OpARM64MOVDnop(v *Value) bool {
9527 // match: (MOVDnop (MOVDconst [c]))
9528 // result: (MOVDconst [c])
9530 if v_0.Op != OpARM64MOVDconst {
9533 c := auxIntToInt64(v_0.AuxInt)
9534 v.reset(OpARM64MOVDconst)
9535 v.AuxInt = int64ToAuxInt(c)
9540 func rewriteValueARM64_OpARM64MOVDreg(v *Value) bool {
9542 // match: (MOVDreg x)
9543 // cond: x.Uses == 1
9544 // result: (MOVDnop x)
9550 v.reset(OpARM64MOVDnop)
9554 // match: (MOVDreg (MOVDconst [c]))
9555 // result: (MOVDconst [c])
9557 if v_0.Op != OpARM64MOVDconst {
9560 c := auxIntToInt64(v_0.AuxInt)
9561 v.reset(OpARM64MOVDconst)
9562 v.AuxInt = int64ToAuxInt(c)
9567 func rewriteValueARM64_OpARM64MOVDstore(v *Value) bool {
9572 config := b.Func.Config
9573 // match: (MOVDstore [off] {sym} ptr (FMOVDfpgp val) mem)
9574 // result: (FMOVDstore [off] {sym} ptr val mem)
9576 off := auxIntToInt32(v.AuxInt)
9577 sym := auxToSym(v.Aux)
9579 if v_1.Op != OpARM64FMOVDfpgp {
9584 v.reset(OpARM64FMOVDstore)
9585 v.AuxInt = int32ToAuxInt(off)
9586 v.Aux = symToAux(sym)
9587 v.AddArg3(ptr, val, mem)
9590 // match: (MOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
9591 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
9592 // result: (MOVDstore [off1+int32(off2)] {sym} ptr val mem)
9594 off1 := auxIntToInt32(v.AuxInt)
9595 sym := auxToSym(v.Aux)
9596 if v_0.Op != OpARM64ADDconst {
9599 off2 := auxIntToInt64(v_0.AuxInt)
9603 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
9606 v.reset(OpARM64MOVDstore)
9607 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9608 v.Aux = symToAux(sym)
9609 v.AddArg3(ptr, val, mem)
9612 // match: (MOVDstore [off] {sym} (ADD ptr idx) val mem)
9613 // cond: off == 0 && sym == nil
9614 // result: (MOVDstoreidx ptr idx val mem)
9616 off := auxIntToInt32(v.AuxInt)
9617 sym := auxToSym(v.Aux)
9618 if v_0.Op != OpARM64ADD {
9625 if !(off == 0 && sym == nil) {
9628 v.reset(OpARM64MOVDstoreidx)
9629 v.AddArg4(ptr, idx, val, mem)
9632 // match: (MOVDstore [off] {sym} (ADDshiftLL [3] ptr idx) val mem)
9633 // cond: off == 0 && sym == nil
9634 // result: (MOVDstoreidx8 ptr idx val mem)
9636 off := auxIntToInt32(v.AuxInt)
9637 sym := auxToSym(v.Aux)
9638 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 3 {
9645 if !(off == 0 && sym == nil) {
9648 v.reset(OpARM64MOVDstoreidx8)
9649 v.AddArg4(ptr, idx, val, mem)
9652 // match: (MOVDstore [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) val mem)
9653 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
9654 // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
9656 off1 := auxIntToInt32(v.AuxInt)
9657 sym1 := auxToSym(v.Aux)
9658 if v_0.Op != OpARM64MOVDaddr {
9661 off2 := auxIntToInt32(v_0.AuxInt)
9662 sym2 := auxToSym(v_0.Aux)
9666 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
9669 v.reset(OpARM64MOVDstore)
9670 v.AuxInt = int32ToAuxInt(off1 + off2)
9671 v.Aux = symToAux(mergeSym(sym1, sym2))
9672 v.AddArg3(ptr, val, mem)
9675 // match: (MOVDstore [off] {sym} ptr (MOVDconst [0]) mem)
9676 // result: (MOVDstorezero [off] {sym} ptr mem)
9678 off := auxIntToInt32(v.AuxInt)
9679 sym := auxToSym(v.Aux)
9681 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
9685 v.reset(OpARM64MOVDstorezero)
9686 v.AuxInt = int32ToAuxInt(off)
9687 v.Aux = symToAux(sym)
9693 func rewriteValueARM64_OpARM64MOVDstoreidx(v *Value) bool {
9698 // match: (MOVDstoreidx ptr (MOVDconst [c]) val mem)
9700 // result: (MOVDstore [int32(c)] ptr val mem)
9703 if v_1.Op != OpARM64MOVDconst {
9706 c := auxIntToInt64(v_1.AuxInt)
9712 v.reset(OpARM64MOVDstore)
9713 v.AuxInt = int32ToAuxInt(int32(c))
9714 v.AddArg3(ptr, val, mem)
9717 // match: (MOVDstoreidx (MOVDconst [c]) idx val mem)
9719 // result: (MOVDstore [int32(c)] idx val mem)
9721 if v_0.Op != OpARM64MOVDconst {
9724 c := auxIntToInt64(v_0.AuxInt)
9731 v.reset(OpARM64MOVDstore)
9732 v.AuxInt = int32ToAuxInt(int32(c))
9733 v.AddArg3(idx, val, mem)
9736 // match: (MOVDstoreidx ptr (SLLconst [3] idx) val mem)
9737 // result: (MOVDstoreidx8 ptr idx val mem)
9740 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 3 {
9746 v.reset(OpARM64MOVDstoreidx8)
9747 v.AddArg4(ptr, idx, val, mem)
9750 // match: (MOVDstoreidx (SLLconst [3] idx) ptr val mem)
9751 // result: (MOVDstoreidx8 ptr idx val mem)
9753 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 3 {
9760 v.reset(OpARM64MOVDstoreidx8)
9761 v.AddArg4(ptr, idx, val, mem)
9764 // match: (MOVDstoreidx ptr idx (MOVDconst [0]) mem)
9765 // result: (MOVDstorezeroidx ptr idx mem)
9769 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
9773 v.reset(OpARM64MOVDstorezeroidx)
9774 v.AddArg3(ptr, idx, mem)
9779 func rewriteValueARM64_OpARM64MOVDstoreidx8(v *Value) bool {
9784 // match: (MOVDstoreidx8 ptr (MOVDconst [c]) val mem)
9785 // cond: is32Bit(c<<3)
9786 // result: (MOVDstore [int32(c)<<3] ptr val mem)
9789 if v_1.Op != OpARM64MOVDconst {
9792 c := auxIntToInt64(v_1.AuxInt)
9795 if !(is32Bit(c << 3)) {
9798 v.reset(OpARM64MOVDstore)
9799 v.AuxInt = int32ToAuxInt(int32(c) << 3)
9800 v.AddArg3(ptr, val, mem)
9803 // match: (MOVDstoreidx8 ptr idx (MOVDconst [0]) mem)
9804 // result: (MOVDstorezeroidx8 ptr idx mem)
9808 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
9812 v.reset(OpARM64MOVDstorezeroidx8)
9813 v.AddArg3(ptr, idx, mem)
9818 func rewriteValueARM64_OpARM64MOVDstorezero(v *Value) bool {
9822 config := b.Func.Config
9823 // match: (MOVDstorezero {s} [i] ptr x:(MOVDstorezero {s} [i+8] ptr mem))
9824 // cond: x.Uses == 1 && clobber(x)
9825 // result: (MOVQstorezero {s} [i] ptr mem)
9827 i := auxIntToInt32(v.AuxInt)
9828 s := auxToSym(v.Aux)
9831 if x.Op != OpARM64MOVDstorezero || auxIntToInt32(x.AuxInt) != i+8 || auxToSym(x.Aux) != s {
9835 if ptr != x.Args[0] || !(x.Uses == 1 && clobber(x)) {
9838 v.reset(OpARM64MOVQstorezero)
9839 v.AuxInt = int32ToAuxInt(i)
9844 // match: (MOVDstorezero {s} [i] ptr x:(MOVDstorezero {s} [i-8] ptr mem))
9845 // cond: x.Uses == 1 && clobber(x)
9846 // result: (MOVQstorezero {s} [i-8] ptr mem)
9848 i := auxIntToInt32(v.AuxInt)
9849 s := auxToSym(v.Aux)
9852 if x.Op != OpARM64MOVDstorezero || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s {
9856 if ptr != x.Args[0] || !(x.Uses == 1 && clobber(x)) {
9859 v.reset(OpARM64MOVQstorezero)
9860 v.AuxInt = int32ToAuxInt(i - 8)
9865 // match: (MOVDstorezero [off1] {sym} (ADDconst [off2] ptr) mem)
9866 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
9867 // result: (MOVDstorezero [off1+int32(off2)] {sym} ptr mem)
9869 off1 := auxIntToInt32(v.AuxInt)
9870 sym := auxToSym(v.Aux)
9871 if v_0.Op != OpARM64ADDconst {
9874 off2 := auxIntToInt64(v_0.AuxInt)
9877 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
9880 v.reset(OpARM64MOVDstorezero)
9881 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9882 v.Aux = symToAux(sym)
9886 // match: (MOVDstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
9887 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
9888 // result: (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
9890 off1 := auxIntToInt32(v.AuxInt)
9891 sym1 := auxToSym(v.Aux)
9892 if v_0.Op != OpARM64MOVDaddr {
9895 off2 := auxIntToInt32(v_0.AuxInt)
9896 sym2 := auxToSym(v_0.Aux)
9899 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
9902 v.reset(OpARM64MOVDstorezero)
9903 v.AuxInt = int32ToAuxInt(off1 + off2)
9904 v.Aux = symToAux(mergeSym(sym1, sym2))
9908 // match: (MOVDstorezero [off] {sym} (ADD ptr idx) mem)
9909 // cond: off == 0 && sym == nil
9910 // result: (MOVDstorezeroidx ptr idx mem)
9912 off := auxIntToInt32(v.AuxInt)
9913 sym := auxToSym(v.Aux)
9914 if v_0.Op != OpARM64ADD {
9920 if !(off == 0 && sym == nil) {
9923 v.reset(OpARM64MOVDstorezeroidx)
9924 v.AddArg3(ptr, idx, mem)
9927 // match: (MOVDstorezero [off] {sym} (ADDshiftLL [3] ptr idx) mem)
9928 // cond: off == 0 && sym == nil
9929 // result: (MOVDstorezeroidx8 ptr idx mem)
9931 off := auxIntToInt32(v.AuxInt)
9932 sym := auxToSym(v.Aux)
9933 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 3 {
9939 if !(off == 0 && sym == nil) {
9942 v.reset(OpARM64MOVDstorezeroidx8)
9943 v.AddArg3(ptr, idx, mem)
9948 func rewriteValueARM64_OpARM64MOVDstorezeroidx(v *Value) bool {
9952 // match: (MOVDstorezeroidx ptr (MOVDconst [c]) mem)
9954 // result: (MOVDstorezero [int32(c)] ptr mem)
9957 if v_1.Op != OpARM64MOVDconst {
9960 c := auxIntToInt64(v_1.AuxInt)
9965 v.reset(OpARM64MOVDstorezero)
9966 v.AuxInt = int32ToAuxInt(int32(c))
9970 // match: (MOVDstorezeroidx (MOVDconst [c]) idx mem)
9972 // result: (MOVDstorezero [int32(c)] idx mem)
9974 if v_0.Op != OpARM64MOVDconst {
9977 c := auxIntToInt64(v_0.AuxInt)
9983 v.reset(OpARM64MOVDstorezero)
9984 v.AuxInt = int32ToAuxInt(int32(c))
9988 // match: (MOVDstorezeroidx ptr (SLLconst [3] idx) mem)
9989 // result: (MOVDstorezeroidx8 ptr idx mem)
9992 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 3 {
9997 v.reset(OpARM64MOVDstorezeroidx8)
9998 v.AddArg3(ptr, idx, mem)
10001 // match: (MOVDstorezeroidx (SLLconst [3] idx) ptr mem)
10002 // result: (MOVDstorezeroidx8 ptr idx mem)
10004 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 3 {
10010 v.reset(OpARM64MOVDstorezeroidx8)
10011 v.AddArg3(ptr, idx, mem)
10016 func rewriteValueARM64_OpARM64MOVDstorezeroidx8(v *Value) bool {
10020 // match: (MOVDstorezeroidx8 ptr (MOVDconst [c]) mem)
10021 // cond: is32Bit(c<<3)
10022 // result: (MOVDstorezero [int32(c<<3)] ptr mem)
10025 if v_1.Op != OpARM64MOVDconst {
10028 c := auxIntToInt64(v_1.AuxInt)
10030 if !(is32Bit(c << 3)) {
10033 v.reset(OpARM64MOVDstorezero)
10034 v.AuxInt = int32ToAuxInt(int32(c << 3))
10035 v.AddArg2(ptr, mem)
10040 func rewriteValueARM64_OpARM64MOVHUload(v *Value) bool {
10044 config := b.Func.Config
10045 // match: (MOVHUload [off1] {sym} (ADDconst [off2] ptr) mem)
10046 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
10047 // result: (MOVHUload [off1+int32(off2)] {sym} ptr mem)
10049 off1 := auxIntToInt32(v.AuxInt)
10050 sym := auxToSym(v.Aux)
10051 if v_0.Op != OpARM64ADDconst {
10054 off2 := auxIntToInt64(v_0.AuxInt)
10057 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
10060 v.reset(OpARM64MOVHUload)
10061 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10062 v.Aux = symToAux(sym)
10063 v.AddArg2(ptr, mem)
10066 // match: (MOVHUload [off] {sym} (ADD ptr idx) mem)
10067 // cond: off == 0 && sym == nil
10068 // result: (MOVHUloadidx ptr idx mem)
10070 off := auxIntToInt32(v.AuxInt)
10071 sym := auxToSym(v.Aux)
10072 if v_0.Op != OpARM64ADD {
10078 if !(off == 0 && sym == nil) {
10081 v.reset(OpARM64MOVHUloadidx)
10082 v.AddArg3(ptr, idx, mem)
10085 // match: (MOVHUload [off] {sym} (ADDshiftLL [1] ptr idx) mem)
10086 // cond: off == 0 && sym == nil
10087 // result: (MOVHUloadidx2 ptr idx mem)
10089 off := auxIntToInt32(v.AuxInt)
10090 sym := auxToSym(v.Aux)
10091 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 1 {
10097 if !(off == 0 && sym == nil) {
10100 v.reset(OpARM64MOVHUloadidx2)
10101 v.AddArg3(ptr, idx, mem)
10104 // match: (MOVHUload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
10105 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
10106 // result: (MOVHUload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
10108 off1 := auxIntToInt32(v.AuxInt)
10109 sym1 := auxToSym(v.Aux)
10110 if v_0.Op != OpARM64MOVDaddr {
10113 off2 := auxIntToInt32(v_0.AuxInt)
10114 sym2 := auxToSym(v_0.Aux)
10117 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
10120 v.reset(OpARM64MOVHUload)
10121 v.AuxInt = int32ToAuxInt(off1 + off2)
10122 v.Aux = symToAux(mergeSym(sym1, sym2))
10123 v.AddArg2(ptr, mem)
10126 // match: (MOVHUload [off] {sym} ptr (MOVHstorezero [off2] {sym2} ptr2 _))
10127 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
10128 // result: (MOVDconst [0])
10130 off := auxIntToInt32(v.AuxInt)
10131 sym := auxToSym(v.Aux)
10133 if v_1.Op != OpARM64MOVHstorezero {
10136 off2 := auxIntToInt32(v_1.AuxInt)
10137 sym2 := auxToSym(v_1.Aux)
10138 ptr2 := v_1.Args[0]
10139 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
10142 v.reset(OpARM64MOVDconst)
10143 v.AuxInt = int64ToAuxInt(0)
10146 // match: (MOVHUload [off] {sym} (SB) _)
10147 // cond: symIsRO(sym)
10148 // result: (MOVDconst [int64(read16(sym, int64(off), config.ctxt.Arch.ByteOrder))])
10150 off := auxIntToInt32(v.AuxInt)
10151 sym := auxToSym(v.Aux)
10152 if v_0.Op != OpSB || !(symIsRO(sym)) {
10155 v.reset(OpARM64MOVDconst)
10156 v.AuxInt = int64ToAuxInt(int64(read16(sym, int64(off), config.ctxt.Arch.ByteOrder)))
10161 func rewriteValueARM64_OpARM64MOVHUloadidx(v *Value) bool {
10165 // match: (MOVHUloadidx ptr (MOVDconst [c]) mem)
10166 // cond: is32Bit(c)
10167 // result: (MOVHUload [int32(c)] ptr mem)
10170 if v_1.Op != OpARM64MOVDconst {
10173 c := auxIntToInt64(v_1.AuxInt)
10178 v.reset(OpARM64MOVHUload)
10179 v.AuxInt = int32ToAuxInt(int32(c))
10180 v.AddArg2(ptr, mem)
10183 // match: (MOVHUloadidx (MOVDconst [c]) ptr mem)
10184 // cond: is32Bit(c)
10185 // result: (MOVHUload [int32(c)] ptr mem)
10187 if v_0.Op != OpARM64MOVDconst {
10190 c := auxIntToInt64(v_0.AuxInt)
10196 v.reset(OpARM64MOVHUload)
10197 v.AuxInt = int32ToAuxInt(int32(c))
10198 v.AddArg2(ptr, mem)
10201 // match: (MOVHUloadidx ptr (SLLconst [1] idx) mem)
10202 // result: (MOVHUloadidx2 ptr idx mem)
10205 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 1 {
10210 v.reset(OpARM64MOVHUloadidx2)
10211 v.AddArg3(ptr, idx, mem)
10214 // match: (MOVHUloadidx ptr (ADD idx idx) mem)
10215 // result: (MOVHUloadidx2 ptr idx mem)
10218 if v_1.Op != OpARM64ADD {
10222 if idx != v_1.Args[0] {
10226 v.reset(OpARM64MOVHUloadidx2)
10227 v.AddArg3(ptr, idx, mem)
10230 // match: (MOVHUloadidx (ADD idx idx) ptr mem)
10231 // result: (MOVHUloadidx2 ptr idx mem)
10233 if v_0.Op != OpARM64ADD {
10237 if idx != v_0.Args[0] {
10242 v.reset(OpARM64MOVHUloadidx2)
10243 v.AddArg3(ptr, idx, mem)
10246 // match: (MOVHUloadidx ptr idx (MOVHstorezeroidx ptr2 idx2 _))
10247 // cond: (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2))
10248 // result: (MOVDconst [0])
10252 if v_2.Op != OpARM64MOVHstorezeroidx {
10255 idx2 := v_2.Args[1]
10256 ptr2 := v_2.Args[0]
10257 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) {
10260 v.reset(OpARM64MOVDconst)
10261 v.AuxInt = int64ToAuxInt(0)
10266 func rewriteValueARM64_OpARM64MOVHUloadidx2(v *Value) bool {
10270 // match: (MOVHUloadidx2 ptr (MOVDconst [c]) mem)
10271 // cond: is32Bit(c<<1)
10272 // result: (MOVHUload [int32(c)<<1] ptr mem)
10275 if v_1.Op != OpARM64MOVDconst {
10278 c := auxIntToInt64(v_1.AuxInt)
10280 if !(is32Bit(c << 1)) {
10283 v.reset(OpARM64MOVHUload)
10284 v.AuxInt = int32ToAuxInt(int32(c) << 1)
10285 v.AddArg2(ptr, mem)
10288 // match: (MOVHUloadidx2 ptr idx (MOVHstorezeroidx2 ptr2 idx2 _))
10289 // cond: isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)
10290 // result: (MOVDconst [0])
10294 if v_2.Op != OpARM64MOVHstorezeroidx2 {
10297 idx2 := v_2.Args[1]
10298 ptr2 := v_2.Args[0]
10299 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)) {
10302 v.reset(OpARM64MOVDconst)
10303 v.AuxInt = int64ToAuxInt(0)
10308 func rewriteValueARM64_OpARM64MOVHUreg(v *Value) bool {
10310 // match: (MOVHUreg x:(MOVBUload _ _))
10311 // result: (MOVDreg x)
10314 if x.Op != OpARM64MOVBUload {
10317 v.reset(OpARM64MOVDreg)
10321 // match: (MOVHUreg x:(MOVHUload _ _))
10322 // result: (MOVDreg x)
10325 if x.Op != OpARM64MOVHUload {
10328 v.reset(OpARM64MOVDreg)
10332 // match: (MOVHUreg x:(MOVBUloadidx _ _ _))
10333 // result: (MOVDreg x)
10336 if x.Op != OpARM64MOVBUloadidx {
10339 v.reset(OpARM64MOVDreg)
10343 // match: (MOVHUreg x:(MOVHUloadidx _ _ _))
10344 // result: (MOVDreg x)
10347 if x.Op != OpARM64MOVHUloadidx {
10350 v.reset(OpARM64MOVDreg)
10354 // match: (MOVHUreg x:(MOVHUloadidx2 _ _ _))
10355 // result: (MOVDreg x)
10358 if x.Op != OpARM64MOVHUloadidx2 {
10361 v.reset(OpARM64MOVDreg)
10365 // match: (MOVHUreg x:(MOVBUreg _))
10366 // result: (MOVDreg x)
10369 if x.Op != OpARM64MOVBUreg {
10372 v.reset(OpARM64MOVDreg)
10376 // match: (MOVHUreg x:(MOVHUreg _))
10377 // result: (MOVDreg x)
10380 if x.Op != OpARM64MOVHUreg {
10383 v.reset(OpARM64MOVDreg)
10387 // match: (MOVHUreg (ANDconst [c] x))
10388 // result: (ANDconst [c&(1<<16-1)] x)
10390 if v_0.Op != OpARM64ANDconst {
10393 c := auxIntToInt64(v_0.AuxInt)
10395 v.reset(OpARM64ANDconst)
10396 v.AuxInt = int64ToAuxInt(c & (1<<16 - 1))
10400 // match: (MOVHUreg (MOVDconst [c]))
10401 // result: (MOVDconst [int64(uint16(c))])
10403 if v_0.Op != OpARM64MOVDconst {
10406 c := auxIntToInt64(v_0.AuxInt)
10407 v.reset(OpARM64MOVDconst)
10408 v.AuxInt = int64ToAuxInt(int64(uint16(c)))
10411 // match: (MOVHUreg x)
10412 // cond: v.Type.Size() <= 2
10416 if !(v.Type.Size() <= 2) {
10422 // match: (MOVHUreg (SLLconst [lc] x))
10424 // result: (MOVDconst [0])
10426 if v_0.Op != OpARM64SLLconst {
10429 lc := auxIntToInt64(v_0.AuxInt)
10433 v.reset(OpARM64MOVDconst)
10434 v.AuxInt = int64ToAuxInt(0)
10437 // match: (MOVHUreg (SLLconst [lc] x))
10439 // result: (UBFIZ [armBFAuxInt(lc, 16-lc)] x)
10441 if v_0.Op != OpARM64SLLconst {
10444 lc := auxIntToInt64(v_0.AuxInt)
10449 v.reset(OpARM64UBFIZ)
10450 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, 16-lc))
10454 // match: (MOVHUreg (SRLconst [rc] x))
10456 // result: (UBFX [armBFAuxInt(rc, 16)] x)
10458 if v_0.Op != OpARM64SRLconst {
10461 rc := auxIntToInt64(v_0.AuxInt)
10466 v.reset(OpARM64UBFX)
10467 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc, 16))
10471 // match: (MOVHUreg (UBFX [bfc] x))
10472 // cond: bfc.getARM64BFwidth() <= 16
10473 // result: (UBFX [bfc] x)
10475 if v_0.Op != OpARM64UBFX {
10478 bfc := auxIntToArm64BitField(v_0.AuxInt)
10480 if !(bfc.getARM64BFwidth() <= 16) {
10483 v.reset(OpARM64UBFX)
10484 v.AuxInt = arm64BitFieldToAuxInt(bfc)
10490 func rewriteValueARM64_OpARM64MOVHload(v *Value) bool {
10494 config := b.Func.Config
10495 // match: (MOVHload [off1] {sym} (ADDconst [off2] ptr) mem)
10496 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
10497 // result: (MOVHload [off1+int32(off2)] {sym} ptr mem)
10499 off1 := auxIntToInt32(v.AuxInt)
10500 sym := auxToSym(v.Aux)
10501 if v_0.Op != OpARM64ADDconst {
10504 off2 := auxIntToInt64(v_0.AuxInt)
10507 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
10510 v.reset(OpARM64MOVHload)
10511 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10512 v.Aux = symToAux(sym)
10513 v.AddArg2(ptr, mem)
10516 // match: (MOVHload [off] {sym} (ADD ptr idx) mem)
10517 // cond: off == 0 && sym == nil
10518 // result: (MOVHloadidx ptr idx mem)
10520 off := auxIntToInt32(v.AuxInt)
10521 sym := auxToSym(v.Aux)
10522 if v_0.Op != OpARM64ADD {
10528 if !(off == 0 && sym == nil) {
10531 v.reset(OpARM64MOVHloadidx)
10532 v.AddArg3(ptr, idx, mem)
10535 // match: (MOVHload [off] {sym} (ADDshiftLL [1] ptr idx) mem)
10536 // cond: off == 0 && sym == nil
10537 // result: (MOVHloadidx2 ptr idx mem)
10539 off := auxIntToInt32(v.AuxInt)
10540 sym := auxToSym(v.Aux)
10541 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 1 {
10547 if !(off == 0 && sym == nil) {
10550 v.reset(OpARM64MOVHloadidx2)
10551 v.AddArg3(ptr, idx, mem)
10554 // match: (MOVHload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
10555 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
10556 // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
10558 off1 := auxIntToInt32(v.AuxInt)
10559 sym1 := auxToSym(v.Aux)
10560 if v_0.Op != OpARM64MOVDaddr {
10563 off2 := auxIntToInt32(v_0.AuxInt)
10564 sym2 := auxToSym(v_0.Aux)
10567 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
10570 v.reset(OpARM64MOVHload)
10571 v.AuxInt = int32ToAuxInt(off1 + off2)
10572 v.Aux = symToAux(mergeSym(sym1, sym2))
10573 v.AddArg2(ptr, mem)
10576 // match: (MOVHload [off] {sym} ptr (MOVHstorezero [off2] {sym2} ptr2 _))
10577 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
10578 // result: (MOVDconst [0])
10580 off := auxIntToInt32(v.AuxInt)
10581 sym := auxToSym(v.Aux)
10583 if v_1.Op != OpARM64MOVHstorezero {
10586 off2 := auxIntToInt32(v_1.AuxInt)
10587 sym2 := auxToSym(v_1.Aux)
10588 ptr2 := v_1.Args[0]
10589 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
10592 v.reset(OpARM64MOVDconst)
10593 v.AuxInt = int64ToAuxInt(0)
10598 func rewriteValueARM64_OpARM64MOVHloadidx(v *Value) bool {
10602 // match: (MOVHloadidx ptr (MOVDconst [c]) mem)
10603 // cond: is32Bit(c)
10604 // result: (MOVHload [int32(c)] ptr mem)
10607 if v_1.Op != OpARM64MOVDconst {
10610 c := auxIntToInt64(v_1.AuxInt)
10615 v.reset(OpARM64MOVHload)
10616 v.AuxInt = int32ToAuxInt(int32(c))
10617 v.AddArg2(ptr, mem)
10620 // match: (MOVHloadidx (MOVDconst [c]) ptr mem)
10621 // cond: is32Bit(c)
10622 // result: (MOVHload [int32(c)] ptr mem)
10624 if v_0.Op != OpARM64MOVDconst {
10627 c := auxIntToInt64(v_0.AuxInt)
10633 v.reset(OpARM64MOVHload)
10634 v.AuxInt = int32ToAuxInt(int32(c))
10635 v.AddArg2(ptr, mem)
10638 // match: (MOVHloadidx ptr (SLLconst [1] idx) mem)
10639 // result: (MOVHloadidx2 ptr idx mem)
10642 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 1 {
10647 v.reset(OpARM64MOVHloadidx2)
10648 v.AddArg3(ptr, idx, mem)
10651 // match: (MOVHloadidx ptr (ADD idx idx) mem)
10652 // result: (MOVHloadidx2 ptr idx mem)
10655 if v_1.Op != OpARM64ADD {
10659 if idx != v_1.Args[0] {
10663 v.reset(OpARM64MOVHloadidx2)
10664 v.AddArg3(ptr, idx, mem)
10667 // match: (MOVHloadidx (ADD idx idx) ptr mem)
10668 // result: (MOVHloadidx2 ptr idx mem)
10670 if v_0.Op != OpARM64ADD {
10674 if idx != v_0.Args[0] {
10679 v.reset(OpARM64MOVHloadidx2)
10680 v.AddArg3(ptr, idx, mem)
10683 // match: (MOVHloadidx ptr idx (MOVHstorezeroidx ptr2 idx2 _))
10684 // cond: (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2))
10685 // result: (MOVDconst [0])
10689 if v_2.Op != OpARM64MOVHstorezeroidx {
10692 idx2 := v_2.Args[1]
10693 ptr2 := v_2.Args[0]
10694 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) {
10697 v.reset(OpARM64MOVDconst)
10698 v.AuxInt = int64ToAuxInt(0)
10703 func rewriteValueARM64_OpARM64MOVHloadidx2(v *Value) bool {
10707 // match: (MOVHloadidx2 ptr (MOVDconst [c]) mem)
10708 // cond: is32Bit(c<<1)
10709 // result: (MOVHload [int32(c)<<1] ptr mem)
10712 if v_1.Op != OpARM64MOVDconst {
10715 c := auxIntToInt64(v_1.AuxInt)
10717 if !(is32Bit(c << 1)) {
10720 v.reset(OpARM64MOVHload)
10721 v.AuxInt = int32ToAuxInt(int32(c) << 1)
10722 v.AddArg2(ptr, mem)
10725 // match: (MOVHloadidx2 ptr idx (MOVHstorezeroidx2 ptr2 idx2 _))
10726 // cond: isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)
10727 // result: (MOVDconst [0])
10731 if v_2.Op != OpARM64MOVHstorezeroidx2 {
10734 idx2 := v_2.Args[1]
10735 ptr2 := v_2.Args[0]
10736 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)) {
10739 v.reset(OpARM64MOVDconst)
10740 v.AuxInt = int64ToAuxInt(0)
10745 func rewriteValueARM64_OpARM64MOVHreg(v *Value) bool {
10747 // match: (MOVHreg x:(MOVBload _ _))
10748 // result: (MOVDreg x)
10751 if x.Op != OpARM64MOVBload {
10754 v.reset(OpARM64MOVDreg)
10758 // match: (MOVHreg x:(MOVBUload _ _))
10759 // result: (MOVDreg x)
10762 if x.Op != OpARM64MOVBUload {
10765 v.reset(OpARM64MOVDreg)
10769 // match: (MOVHreg x:(MOVHload _ _))
10770 // result: (MOVDreg x)
10773 if x.Op != OpARM64MOVHload {
10776 v.reset(OpARM64MOVDreg)
10780 // match: (MOVHreg x:(MOVBloadidx _ _ _))
10781 // result: (MOVDreg x)
10784 if x.Op != OpARM64MOVBloadidx {
10787 v.reset(OpARM64MOVDreg)
10791 // match: (MOVHreg x:(MOVBUloadidx _ _ _))
10792 // result: (MOVDreg x)
10795 if x.Op != OpARM64MOVBUloadidx {
10798 v.reset(OpARM64MOVDreg)
10802 // match: (MOVHreg x:(MOVHloadidx _ _ _))
10803 // result: (MOVDreg x)
10806 if x.Op != OpARM64MOVHloadidx {
10809 v.reset(OpARM64MOVDreg)
10813 // match: (MOVHreg x:(MOVHloadidx2 _ _ _))
10814 // result: (MOVDreg x)
10817 if x.Op != OpARM64MOVHloadidx2 {
10820 v.reset(OpARM64MOVDreg)
10824 // match: (MOVHreg x:(MOVBreg _))
10825 // result: (MOVDreg x)
10828 if x.Op != OpARM64MOVBreg {
10831 v.reset(OpARM64MOVDreg)
10835 // match: (MOVHreg x:(MOVBUreg _))
10836 // result: (MOVDreg x)
10839 if x.Op != OpARM64MOVBUreg {
10842 v.reset(OpARM64MOVDreg)
10846 // match: (MOVHreg x:(MOVHreg _))
10847 // result: (MOVDreg x)
10850 if x.Op != OpARM64MOVHreg {
10853 v.reset(OpARM64MOVDreg)
10857 // match: (MOVHreg (MOVDconst [c]))
10858 // result: (MOVDconst [int64(int16(c))])
10860 if v_0.Op != OpARM64MOVDconst {
10863 c := auxIntToInt64(v_0.AuxInt)
10864 v.reset(OpARM64MOVDconst)
10865 v.AuxInt = int64ToAuxInt(int64(int16(c)))
10868 // match: (MOVHreg x)
10869 // cond: v.Type.Size() <= 2
10873 if !(v.Type.Size() <= 2) {
10879 // match: (MOVHreg <t> (ANDconst x [c]))
10880 // cond: uint64(c) & uint64(0xffffffffffff8000) == 0
10881 // result: (ANDconst <t> x [c])
10884 if v_0.Op != OpARM64ANDconst {
10887 c := auxIntToInt64(v_0.AuxInt)
10889 if !(uint64(c)&uint64(0xffffffffffff8000) == 0) {
10892 v.reset(OpARM64ANDconst)
10894 v.AuxInt = int64ToAuxInt(c)
10898 // match: (MOVHreg (SLLconst [lc] x))
10900 // result: (SBFIZ [armBFAuxInt(lc, 16-lc)] x)
10902 if v_0.Op != OpARM64SLLconst {
10905 lc := auxIntToInt64(v_0.AuxInt)
10910 v.reset(OpARM64SBFIZ)
10911 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, 16-lc))
10915 // match: (MOVHreg (SBFX [bfc] x))
10916 // cond: bfc.getARM64BFwidth() <= 16
10917 // result: (SBFX [bfc] x)
10919 if v_0.Op != OpARM64SBFX {
10922 bfc := auxIntToArm64BitField(v_0.AuxInt)
10924 if !(bfc.getARM64BFwidth() <= 16) {
10927 v.reset(OpARM64SBFX)
10928 v.AuxInt = arm64BitFieldToAuxInt(bfc)
10934 func rewriteValueARM64_OpARM64MOVHstore(v *Value) bool {
10939 config := b.Func.Config
10940 // match: (MOVHstore [off1] {sym} (ADDconst [off2] ptr) val mem)
10941 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
10942 // result: (MOVHstore [off1+int32(off2)] {sym} ptr val mem)
10944 off1 := auxIntToInt32(v.AuxInt)
10945 sym := auxToSym(v.Aux)
10946 if v_0.Op != OpARM64ADDconst {
10949 off2 := auxIntToInt64(v_0.AuxInt)
10953 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
10956 v.reset(OpARM64MOVHstore)
10957 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10958 v.Aux = symToAux(sym)
10959 v.AddArg3(ptr, val, mem)
10962 // match: (MOVHstore [off] {sym} (ADD ptr idx) val mem)
10963 // cond: off == 0 && sym == nil
10964 // result: (MOVHstoreidx ptr idx val mem)
10966 off := auxIntToInt32(v.AuxInt)
10967 sym := auxToSym(v.Aux)
10968 if v_0.Op != OpARM64ADD {
10975 if !(off == 0 && sym == nil) {
10978 v.reset(OpARM64MOVHstoreidx)
10979 v.AddArg4(ptr, idx, val, mem)
10982 // match: (MOVHstore [off] {sym} (ADDshiftLL [1] ptr idx) val mem)
10983 // cond: off == 0 && sym == nil
10984 // result: (MOVHstoreidx2 ptr idx val mem)
10986 off := auxIntToInt32(v.AuxInt)
10987 sym := auxToSym(v.Aux)
10988 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 1 {
10995 if !(off == 0 && sym == nil) {
10998 v.reset(OpARM64MOVHstoreidx2)
10999 v.AddArg4(ptr, idx, val, mem)
11002 // match: (MOVHstore [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) val mem)
11003 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
11004 // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
11006 off1 := auxIntToInt32(v.AuxInt)
11007 sym1 := auxToSym(v.Aux)
11008 if v_0.Op != OpARM64MOVDaddr {
11011 off2 := auxIntToInt32(v_0.AuxInt)
11012 sym2 := auxToSym(v_0.Aux)
11016 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
11019 v.reset(OpARM64MOVHstore)
11020 v.AuxInt = int32ToAuxInt(off1 + off2)
11021 v.Aux = symToAux(mergeSym(sym1, sym2))
11022 v.AddArg3(ptr, val, mem)
11025 // match: (MOVHstore [off] {sym} ptr (MOVDconst [0]) mem)
11026 // result: (MOVHstorezero [off] {sym} ptr mem)
11028 off := auxIntToInt32(v.AuxInt)
11029 sym := auxToSym(v.Aux)
11031 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
11035 v.reset(OpARM64MOVHstorezero)
11036 v.AuxInt = int32ToAuxInt(off)
11037 v.Aux = symToAux(sym)
11038 v.AddArg2(ptr, mem)
11041 // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem)
11042 // result: (MOVHstore [off] {sym} ptr x mem)
11044 off := auxIntToInt32(v.AuxInt)
11045 sym := auxToSym(v.Aux)
11047 if v_1.Op != OpARM64MOVHreg {
11052 v.reset(OpARM64MOVHstore)
11053 v.AuxInt = int32ToAuxInt(off)
11054 v.Aux = symToAux(sym)
11055 v.AddArg3(ptr, x, mem)
11058 // match: (MOVHstore [off] {sym} ptr (MOVHUreg x) mem)
11059 // result: (MOVHstore [off] {sym} ptr x mem)
11061 off := auxIntToInt32(v.AuxInt)
11062 sym := auxToSym(v.Aux)
11064 if v_1.Op != OpARM64MOVHUreg {
11069 v.reset(OpARM64MOVHstore)
11070 v.AuxInt = int32ToAuxInt(off)
11071 v.Aux = symToAux(sym)
11072 v.AddArg3(ptr, x, mem)
11075 // match: (MOVHstore [off] {sym} ptr (MOVWreg x) mem)
11076 // result: (MOVHstore [off] {sym} ptr x mem)
11078 off := auxIntToInt32(v.AuxInt)
11079 sym := auxToSym(v.Aux)
11081 if v_1.Op != OpARM64MOVWreg {
11086 v.reset(OpARM64MOVHstore)
11087 v.AuxInt = int32ToAuxInt(off)
11088 v.Aux = symToAux(sym)
11089 v.AddArg3(ptr, x, mem)
11092 // match: (MOVHstore [off] {sym} ptr (MOVWUreg x) mem)
11093 // result: (MOVHstore [off] {sym} ptr x mem)
11095 off := auxIntToInt32(v.AuxInt)
11096 sym := auxToSym(v.Aux)
11098 if v_1.Op != OpARM64MOVWUreg {
11103 v.reset(OpARM64MOVHstore)
11104 v.AuxInt = int32ToAuxInt(off)
11105 v.Aux = symToAux(sym)
11106 v.AddArg3(ptr, x, mem)
11111 func rewriteValueARM64_OpARM64MOVHstoreidx(v *Value) bool {
11116 // match: (MOVHstoreidx ptr (MOVDconst [c]) val mem)
11117 // cond: is32Bit(c)
11118 // result: (MOVHstore [int32(c)] ptr val mem)
11121 if v_1.Op != OpARM64MOVDconst {
11124 c := auxIntToInt64(v_1.AuxInt)
11130 v.reset(OpARM64MOVHstore)
11131 v.AuxInt = int32ToAuxInt(int32(c))
11132 v.AddArg3(ptr, val, mem)
11135 // match: (MOVHstoreidx (MOVDconst [c]) idx val mem)
11136 // cond: is32Bit(c)
11137 // result: (MOVHstore [int32(c)] idx val mem)
11139 if v_0.Op != OpARM64MOVDconst {
11142 c := auxIntToInt64(v_0.AuxInt)
11149 v.reset(OpARM64MOVHstore)
11150 v.AuxInt = int32ToAuxInt(int32(c))
11151 v.AddArg3(idx, val, mem)
11154 // match: (MOVHstoreidx ptr (SLLconst [1] idx) val mem)
11155 // result: (MOVHstoreidx2 ptr idx val mem)
11158 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 1 {
11164 v.reset(OpARM64MOVHstoreidx2)
11165 v.AddArg4(ptr, idx, val, mem)
11168 // match: (MOVHstoreidx ptr (ADD idx idx) val mem)
11169 // result: (MOVHstoreidx2 ptr idx val mem)
11172 if v_1.Op != OpARM64ADD {
11176 if idx != v_1.Args[0] {
11181 v.reset(OpARM64MOVHstoreidx2)
11182 v.AddArg4(ptr, idx, val, mem)
11185 // match: (MOVHstoreidx (SLLconst [1] idx) ptr val mem)
11186 // result: (MOVHstoreidx2 ptr idx val mem)
11188 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 1 {
11195 v.reset(OpARM64MOVHstoreidx2)
11196 v.AddArg4(ptr, idx, val, mem)
11199 // match: (MOVHstoreidx (ADD idx idx) ptr val mem)
11200 // result: (MOVHstoreidx2 ptr idx val mem)
11202 if v_0.Op != OpARM64ADD {
11206 if idx != v_0.Args[0] {
11212 v.reset(OpARM64MOVHstoreidx2)
11213 v.AddArg4(ptr, idx, val, mem)
11216 // match: (MOVHstoreidx ptr idx (MOVDconst [0]) mem)
11217 // result: (MOVHstorezeroidx ptr idx mem)
11221 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
11225 v.reset(OpARM64MOVHstorezeroidx)
11226 v.AddArg3(ptr, idx, mem)
11229 // match: (MOVHstoreidx ptr idx (MOVHreg x) mem)
11230 // result: (MOVHstoreidx ptr idx x mem)
11234 if v_2.Op != OpARM64MOVHreg {
11239 v.reset(OpARM64MOVHstoreidx)
11240 v.AddArg4(ptr, idx, x, mem)
11243 // match: (MOVHstoreidx ptr idx (MOVHUreg x) mem)
11244 // result: (MOVHstoreidx ptr idx x mem)
11248 if v_2.Op != OpARM64MOVHUreg {
11253 v.reset(OpARM64MOVHstoreidx)
11254 v.AddArg4(ptr, idx, x, mem)
11257 // match: (MOVHstoreidx ptr idx (MOVWreg x) mem)
11258 // result: (MOVHstoreidx ptr idx x mem)
11262 if v_2.Op != OpARM64MOVWreg {
11267 v.reset(OpARM64MOVHstoreidx)
11268 v.AddArg4(ptr, idx, x, mem)
11271 // match: (MOVHstoreidx ptr idx (MOVWUreg x) mem)
11272 // result: (MOVHstoreidx ptr idx x mem)
11276 if v_2.Op != OpARM64MOVWUreg {
11281 v.reset(OpARM64MOVHstoreidx)
11282 v.AddArg4(ptr, idx, x, mem)
11287 func rewriteValueARM64_OpARM64MOVHstoreidx2(v *Value) bool {
11292 // match: (MOVHstoreidx2 ptr (MOVDconst [c]) val mem)
11293 // cond: is32Bit(c<<1)
11294 // result: (MOVHstore [int32(c)<<1] ptr val mem)
11297 if v_1.Op != OpARM64MOVDconst {
11300 c := auxIntToInt64(v_1.AuxInt)
11303 if !(is32Bit(c << 1)) {
11306 v.reset(OpARM64MOVHstore)
11307 v.AuxInt = int32ToAuxInt(int32(c) << 1)
11308 v.AddArg3(ptr, val, mem)
11311 // match: (MOVHstoreidx2 ptr idx (MOVDconst [0]) mem)
11312 // result: (MOVHstorezeroidx2 ptr idx mem)
11316 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
11320 v.reset(OpARM64MOVHstorezeroidx2)
11321 v.AddArg3(ptr, idx, mem)
11324 // match: (MOVHstoreidx2 ptr idx (MOVHreg x) mem)
11325 // result: (MOVHstoreidx2 ptr idx x mem)
11329 if v_2.Op != OpARM64MOVHreg {
11334 v.reset(OpARM64MOVHstoreidx2)
11335 v.AddArg4(ptr, idx, x, mem)
11338 // match: (MOVHstoreidx2 ptr idx (MOVHUreg x) mem)
11339 // result: (MOVHstoreidx2 ptr idx x mem)
11343 if v_2.Op != OpARM64MOVHUreg {
11348 v.reset(OpARM64MOVHstoreidx2)
11349 v.AddArg4(ptr, idx, x, mem)
11352 // match: (MOVHstoreidx2 ptr idx (MOVWreg x) mem)
11353 // result: (MOVHstoreidx2 ptr idx x mem)
11357 if v_2.Op != OpARM64MOVWreg {
11362 v.reset(OpARM64MOVHstoreidx2)
11363 v.AddArg4(ptr, idx, x, mem)
11366 // match: (MOVHstoreidx2 ptr idx (MOVWUreg x) mem)
11367 // result: (MOVHstoreidx2 ptr idx x mem)
11371 if v_2.Op != OpARM64MOVWUreg {
11376 v.reset(OpARM64MOVHstoreidx2)
11377 v.AddArg4(ptr, idx, x, mem)
11382 func rewriteValueARM64_OpARM64MOVHstorezero(v *Value) bool {
11386 config := b.Func.Config
11387 // match: (MOVHstorezero [off1] {sym} (ADDconst [off2] ptr) mem)
11388 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
11389 // result: (MOVHstorezero [off1+int32(off2)] {sym} ptr mem)
11391 off1 := auxIntToInt32(v.AuxInt)
11392 sym := auxToSym(v.Aux)
11393 if v_0.Op != OpARM64ADDconst {
11396 off2 := auxIntToInt64(v_0.AuxInt)
11399 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
11402 v.reset(OpARM64MOVHstorezero)
11403 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
11404 v.Aux = symToAux(sym)
11405 v.AddArg2(ptr, mem)
11408 // match: (MOVHstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
11409 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
11410 // result: (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
11412 off1 := auxIntToInt32(v.AuxInt)
11413 sym1 := auxToSym(v.Aux)
11414 if v_0.Op != OpARM64MOVDaddr {
11417 off2 := auxIntToInt32(v_0.AuxInt)
11418 sym2 := auxToSym(v_0.Aux)
11421 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
11424 v.reset(OpARM64MOVHstorezero)
11425 v.AuxInt = int32ToAuxInt(off1 + off2)
11426 v.Aux = symToAux(mergeSym(sym1, sym2))
11427 v.AddArg2(ptr, mem)
11430 // match: (MOVHstorezero [off] {sym} (ADD ptr idx) mem)
11431 // cond: off == 0 && sym == nil
11432 // result: (MOVHstorezeroidx ptr idx mem)
11434 off := auxIntToInt32(v.AuxInt)
11435 sym := auxToSym(v.Aux)
11436 if v_0.Op != OpARM64ADD {
11442 if !(off == 0 && sym == nil) {
11445 v.reset(OpARM64MOVHstorezeroidx)
11446 v.AddArg3(ptr, idx, mem)
11449 // match: (MOVHstorezero [off] {sym} (ADDshiftLL [1] ptr idx) mem)
11450 // cond: off == 0 && sym == nil
11451 // result: (MOVHstorezeroidx2 ptr idx mem)
11453 off := auxIntToInt32(v.AuxInt)
11454 sym := auxToSym(v.Aux)
11455 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 1 {
11461 if !(off == 0 && sym == nil) {
11464 v.reset(OpARM64MOVHstorezeroidx2)
11465 v.AddArg3(ptr, idx, mem)
11470 func rewriteValueARM64_OpARM64MOVHstorezeroidx(v *Value) bool {
11474 // match: (MOVHstorezeroidx ptr (MOVDconst [c]) mem)
11475 // cond: is32Bit(c)
11476 // result: (MOVHstorezero [int32(c)] ptr mem)
11479 if v_1.Op != OpARM64MOVDconst {
11482 c := auxIntToInt64(v_1.AuxInt)
11487 v.reset(OpARM64MOVHstorezero)
11488 v.AuxInt = int32ToAuxInt(int32(c))
11489 v.AddArg2(ptr, mem)
11492 // match: (MOVHstorezeroidx (MOVDconst [c]) idx mem)
11493 // cond: is32Bit(c)
11494 // result: (MOVHstorezero [int32(c)] idx mem)
11496 if v_0.Op != OpARM64MOVDconst {
11499 c := auxIntToInt64(v_0.AuxInt)
11505 v.reset(OpARM64MOVHstorezero)
11506 v.AuxInt = int32ToAuxInt(int32(c))
11507 v.AddArg2(idx, mem)
11510 // match: (MOVHstorezeroidx ptr (SLLconst [1] idx) mem)
11511 // result: (MOVHstorezeroidx2 ptr idx mem)
11514 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 1 {
11519 v.reset(OpARM64MOVHstorezeroidx2)
11520 v.AddArg3(ptr, idx, mem)
11523 // match: (MOVHstorezeroidx ptr (ADD idx idx) mem)
11524 // result: (MOVHstorezeroidx2 ptr idx mem)
11527 if v_1.Op != OpARM64ADD {
11531 if idx != v_1.Args[0] {
11535 v.reset(OpARM64MOVHstorezeroidx2)
11536 v.AddArg3(ptr, idx, mem)
11539 // match: (MOVHstorezeroidx (SLLconst [1] idx) ptr mem)
11540 // result: (MOVHstorezeroidx2 ptr idx mem)
11542 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 1 {
11548 v.reset(OpARM64MOVHstorezeroidx2)
11549 v.AddArg3(ptr, idx, mem)
11552 // match: (MOVHstorezeroidx (ADD idx idx) ptr mem)
11553 // result: (MOVHstorezeroidx2 ptr idx mem)
11555 if v_0.Op != OpARM64ADD {
11559 if idx != v_0.Args[0] {
11564 v.reset(OpARM64MOVHstorezeroidx2)
11565 v.AddArg3(ptr, idx, mem)
11570 func rewriteValueARM64_OpARM64MOVHstorezeroidx2(v *Value) bool {
11574 // match: (MOVHstorezeroidx2 ptr (MOVDconst [c]) mem)
11575 // cond: is32Bit(c<<1)
11576 // result: (MOVHstorezero [int32(c<<1)] ptr mem)
11579 if v_1.Op != OpARM64MOVDconst {
11582 c := auxIntToInt64(v_1.AuxInt)
11584 if !(is32Bit(c << 1)) {
11587 v.reset(OpARM64MOVHstorezero)
11588 v.AuxInt = int32ToAuxInt(int32(c << 1))
11589 v.AddArg2(ptr, mem)
11594 func rewriteValueARM64_OpARM64MOVQstorezero(v *Value) bool {
11598 config := b.Func.Config
11599 // match: (MOVQstorezero [off1] {sym} (ADDconst [off2] ptr) mem)
11600 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
11601 // result: (MOVQstorezero [off1+int32(off2)] {sym} ptr mem)
11603 off1 := auxIntToInt32(v.AuxInt)
11604 sym := auxToSym(v.Aux)
11605 if v_0.Op != OpARM64ADDconst {
11608 off2 := auxIntToInt64(v_0.AuxInt)
11611 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
11614 v.reset(OpARM64MOVQstorezero)
11615 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
11616 v.Aux = symToAux(sym)
11617 v.AddArg2(ptr, mem)
11620 // match: (MOVQstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
11621 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
11622 // result: (MOVQstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
11624 off1 := auxIntToInt32(v.AuxInt)
11625 sym1 := auxToSym(v.Aux)
11626 if v_0.Op != OpARM64MOVDaddr {
11629 off2 := auxIntToInt32(v_0.AuxInt)
11630 sym2 := auxToSym(v_0.Aux)
11633 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
11636 v.reset(OpARM64MOVQstorezero)
11637 v.AuxInt = int32ToAuxInt(off1 + off2)
11638 v.Aux = symToAux(mergeSym(sym1, sym2))
11639 v.AddArg2(ptr, mem)
11644 func rewriteValueARM64_OpARM64MOVWUload(v *Value) bool {
11648 config := b.Func.Config
11649 // match: (MOVWUload [off] {sym} ptr (FMOVSstore [off] {sym} ptr val _))
11650 // result: (FMOVSfpgp val)
11652 off := auxIntToInt32(v.AuxInt)
11653 sym := auxToSym(v.Aux)
11655 if v_1.Op != OpARM64FMOVSstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
11659 if ptr != v_1.Args[0] {
11662 v.reset(OpARM64FMOVSfpgp)
11666 // match: (MOVWUload [off1] {sym} (ADDconst [off2] ptr) mem)
11667 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
11668 // result: (MOVWUload [off1+int32(off2)] {sym} ptr mem)
11670 off1 := auxIntToInt32(v.AuxInt)
11671 sym := auxToSym(v.Aux)
11672 if v_0.Op != OpARM64ADDconst {
11675 off2 := auxIntToInt64(v_0.AuxInt)
11678 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
11681 v.reset(OpARM64MOVWUload)
11682 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
11683 v.Aux = symToAux(sym)
11684 v.AddArg2(ptr, mem)
11687 // match: (MOVWUload [off] {sym} (ADD ptr idx) mem)
11688 // cond: off == 0 && sym == nil
11689 // result: (MOVWUloadidx ptr idx mem)
11691 off := auxIntToInt32(v.AuxInt)
11692 sym := auxToSym(v.Aux)
11693 if v_0.Op != OpARM64ADD {
11699 if !(off == 0 && sym == nil) {
11702 v.reset(OpARM64MOVWUloadidx)
11703 v.AddArg3(ptr, idx, mem)
11706 // match: (MOVWUload [off] {sym} (ADDshiftLL [2] ptr idx) mem)
11707 // cond: off == 0 && sym == nil
11708 // result: (MOVWUloadidx4 ptr idx mem)
11710 off := auxIntToInt32(v.AuxInt)
11711 sym := auxToSym(v.Aux)
11712 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 2 {
11718 if !(off == 0 && sym == nil) {
11721 v.reset(OpARM64MOVWUloadidx4)
11722 v.AddArg3(ptr, idx, mem)
11725 // match: (MOVWUload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
11726 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
11727 // result: (MOVWUload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
11729 off1 := auxIntToInt32(v.AuxInt)
11730 sym1 := auxToSym(v.Aux)
11731 if v_0.Op != OpARM64MOVDaddr {
11734 off2 := auxIntToInt32(v_0.AuxInt)
11735 sym2 := auxToSym(v_0.Aux)
11738 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
11741 v.reset(OpARM64MOVWUload)
11742 v.AuxInt = int32ToAuxInt(off1 + off2)
11743 v.Aux = symToAux(mergeSym(sym1, sym2))
11744 v.AddArg2(ptr, mem)
11747 // match: (MOVWUload [off] {sym} ptr (MOVWstorezero [off2] {sym2} ptr2 _))
11748 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
11749 // result: (MOVDconst [0])
11751 off := auxIntToInt32(v.AuxInt)
11752 sym := auxToSym(v.Aux)
11754 if v_1.Op != OpARM64MOVWstorezero {
11757 off2 := auxIntToInt32(v_1.AuxInt)
11758 sym2 := auxToSym(v_1.Aux)
11759 ptr2 := v_1.Args[0]
11760 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
11763 v.reset(OpARM64MOVDconst)
11764 v.AuxInt = int64ToAuxInt(0)
11767 // match: (MOVWUload [off] {sym} (SB) _)
11768 // cond: symIsRO(sym)
11769 // result: (MOVDconst [int64(read32(sym, int64(off), config.ctxt.Arch.ByteOrder))])
11771 off := auxIntToInt32(v.AuxInt)
11772 sym := auxToSym(v.Aux)
11773 if v_0.Op != OpSB || !(symIsRO(sym)) {
11776 v.reset(OpARM64MOVDconst)
11777 v.AuxInt = int64ToAuxInt(int64(read32(sym, int64(off), config.ctxt.Arch.ByteOrder)))
11782 func rewriteValueARM64_OpARM64MOVWUloadidx(v *Value) bool {
11786 // match: (MOVWUloadidx ptr (MOVDconst [c]) mem)
11787 // cond: is32Bit(c)
11788 // result: (MOVWUload [int32(c)] ptr mem)
11791 if v_1.Op != OpARM64MOVDconst {
11794 c := auxIntToInt64(v_1.AuxInt)
11799 v.reset(OpARM64MOVWUload)
11800 v.AuxInt = int32ToAuxInt(int32(c))
11801 v.AddArg2(ptr, mem)
11804 // match: (MOVWUloadidx (MOVDconst [c]) ptr mem)
11805 // cond: is32Bit(c)
11806 // result: (MOVWUload [int32(c)] ptr mem)
11808 if v_0.Op != OpARM64MOVDconst {
11811 c := auxIntToInt64(v_0.AuxInt)
11817 v.reset(OpARM64MOVWUload)
11818 v.AuxInt = int32ToAuxInt(int32(c))
11819 v.AddArg2(ptr, mem)
11822 // match: (MOVWUloadidx ptr (SLLconst [2] idx) mem)
11823 // result: (MOVWUloadidx4 ptr idx mem)
11826 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 2 {
11831 v.reset(OpARM64MOVWUloadidx4)
11832 v.AddArg3(ptr, idx, mem)
11835 // match: (MOVWUloadidx (SLLconst [2] idx) ptr mem)
11836 // result: (MOVWUloadidx4 ptr idx mem)
11838 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 2 {
11844 v.reset(OpARM64MOVWUloadidx4)
11845 v.AddArg3(ptr, idx, mem)
11848 // match: (MOVWUloadidx ptr idx (MOVWstorezeroidx ptr2 idx2 _))
11849 // cond: (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2))
11850 // result: (MOVDconst [0])
11854 if v_2.Op != OpARM64MOVWstorezeroidx {
11857 idx2 := v_2.Args[1]
11858 ptr2 := v_2.Args[0]
11859 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) {
11862 v.reset(OpARM64MOVDconst)
11863 v.AuxInt = int64ToAuxInt(0)
11868 func rewriteValueARM64_OpARM64MOVWUloadidx4(v *Value) bool {
11872 // match: (MOVWUloadidx4 ptr (MOVDconst [c]) mem)
11873 // cond: is32Bit(c<<2)
11874 // result: (MOVWUload [int32(c)<<2] ptr mem)
11877 if v_1.Op != OpARM64MOVDconst {
11880 c := auxIntToInt64(v_1.AuxInt)
11882 if !(is32Bit(c << 2)) {
11885 v.reset(OpARM64MOVWUload)
11886 v.AuxInt = int32ToAuxInt(int32(c) << 2)
11887 v.AddArg2(ptr, mem)
11890 // match: (MOVWUloadidx4 ptr idx (MOVWstorezeroidx4 ptr2 idx2 _))
11891 // cond: isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)
11892 // result: (MOVDconst [0])
11896 if v_2.Op != OpARM64MOVWstorezeroidx4 {
11899 idx2 := v_2.Args[1]
11900 ptr2 := v_2.Args[0]
11901 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)) {
11904 v.reset(OpARM64MOVDconst)
11905 v.AuxInt = int64ToAuxInt(0)
11910 func rewriteValueARM64_OpARM64MOVWUreg(v *Value) bool {
11912 // match: (MOVWUreg x:(MOVBUload _ _))
11913 // result: (MOVDreg x)
11916 if x.Op != OpARM64MOVBUload {
11919 v.reset(OpARM64MOVDreg)
11923 // match: (MOVWUreg x:(MOVHUload _ _))
11924 // result: (MOVDreg x)
11927 if x.Op != OpARM64MOVHUload {
11930 v.reset(OpARM64MOVDreg)
11934 // match: (MOVWUreg x:(MOVWUload _ _))
11935 // result: (MOVDreg x)
11938 if x.Op != OpARM64MOVWUload {
11941 v.reset(OpARM64MOVDreg)
11945 // match: (MOVWUreg x:(MOVBUloadidx _ _ _))
11946 // result: (MOVDreg x)
11949 if x.Op != OpARM64MOVBUloadidx {
11952 v.reset(OpARM64MOVDreg)
11956 // match: (MOVWUreg x:(MOVHUloadidx _ _ _))
11957 // result: (MOVDreg x)
11960 if x.Op != OpARM64MOVHUloadidx {
11963 v.reset(OpARM64MOVDreg)
11967 // match: (MOVWUreg x:(MOVWUloadidx _ _ _))
11968 // result: (MOVDreg x)
11971 if x.Op != OpARM64MOVWUloadidx {
11974 v.reset(OpARM64MOVDreg)
11978 // match: (MOVWUreg x:(MOVHUloadidx2 _ _ _))
11979 // result: (MOVDreg x)
11982 if x.Op != OpARM64MOVHUloadidx2 {
11985 v.reset(OpARM64MOVDreg)
11989 // match: (MOVWUreg x:(MOVWUloadidx4 _ _ _))
11990 // result: (MOVDreg x)
11993 if x.Op != OpARM64MOVWUloadidx4 {
11996 v.reset(OpARM64MOVDreg)
12000 // match: (MOVWUreg x:(MOVBUreg _))
12001 // result: (MOVDreg x)
12004 if x.Op != OpARM64MOVBUreg {
12007 v.reset(OpARM64MOVDreg)
12011 // match: (MOVWUreg x:(MOVHUreg _))
12012 // result: (MOVDreg x)
12015 if x.Op != OpARM64MOVHUreg {
12018 v.reset(OpARM64MOVDreg)
12022 // match: (MOVWUreg x:(MOVWUreg _))
12023 // result: (MOVDreg x)
12026 if x.Op != OpARM64MOVWUreg {
12029 v.reset(OpARM64MOVDreg)
12033 // match: (MOVWUreg (ANDconst [c] x))
12034 // result: (ANDconst [c&(1<<32-1)] x)
12036 if v_0.Op != OpARM64ANDconst {
12039 c := auxIntToInt64(v_0.AuxInt)
12041 v.reset(OpARM64ANDconst)
12042 v.AuxInt = int64ToAuxInt(c & (1<<32 - 1))
12046 // match: (MOVWUreg (MOVDconst [c]))
12047 // result: (MOVDconst [int64(uint32(c))])
12049 if v_0.Op != OpARM64MOVDconst {
12052 c := auxIntToInt64(v_0.AuxInt)
12053 v.reset(OpARM64MOVDconst)
12054 v.AuxInt = int64ToAuxInt(int64(uint32(c)))
12057 // match: (MOVWUreg x)
12058 // cond: v.Type.Size() <= 4
12062 if !(v.Type.Size() <= 4) {
12068 // match: (MOVWUreg x)
12069 // cond: zeroUpper32Bits(x, 3)
12073 if !(zeroUpper32Bits(x, 3)) {
12079 // match: (MOVWUreg (SLLconst [lc] x))
12081 // result: (MOVDconst [0])
12083 if v_0.Op != OpARM64SLLconst {
12086 lc := auxIntToInt64(v_0.AuxInt)
12090 v.reset(OpARM64MOVDconst)
12091 v.AuxInt = int64ToAuxInt(0)
12094 // match: (MOVWUreg (SLLconst [lc] x))
12096 // result: (UBFIZ [armBFAuxInt(lc, 32-lc)] x)
12098 if v_0.Op != OpARM64SLLconst {
12101 lc := auxIntToInt64(v_0.AuxInt)
12106 v.reset(OpARM64UBFIZ)
12107 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, 32-lc))
12111 // match: (MOVWUreg (SRLconst [rc] x))
12113 // result: (UBFX [armBFAuxInt(rc, 32)] x)
12115 if v_0.Op != OpARM64SRLconst {
12118 rc := auxIntToInt64(v_0.AuxInt)
12123 v.reset(OpARM64UBFX)
12124 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc, 32))
12128 // match: (MOVWUreg (UBFX [bfc] x))
12129 // cond: bfc.getARM64BFwidth() <= 32
12130 // result: (UBFX [bfc] x)
12132 if v_0.Op != OpARM64UBFX {
12135 bfc := auxIntToArm64BitField(v_0.AuxInt)
12137 if !(bfc.getARM64BFwidth() <= 32) {
12140 v.reset(OpARM64UBFX)
12141 v.AuxInt = arm64BitFieldToAuxInt(bfc)
12147 func rewriteValueARM64_OpARM64MOVWload(v *Value) bool {
12151 config := b.Func.Config
12152 // match: (MOVWload [off1] {sym} (ADDconst [off2] ptr) mem)
12153 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
12154 // result: (MOVWload [off1+int32(off2)] {sym} ptr mem)
12156 off1 := auxIntToInt32(v.AuxInt)
12157 sym := auxToSym(v.Aux)
12158 if v_0.Op != OpARM64ADDconst {
12161 off2 := auxIntToInt64(v_0.AuxInt)
12164 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
12167 v.reset(OpARM64MOVWload)
12168 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
12169 v.Aux = symToAux(sym)
12170 v.AddArg2(ptr, mem)
12173 // match: (MOVWload [off] {sym} (ADD ptr idx) mem)
12174 // cond: off == 0 && sym == nil
12175 // result: (MOVWloadidx ptr idx mem)
12177 off := auxIntToInt32(v.AuxInt)
12178 sym := auxToSym(v.Aux)
12179 if v_0.Op != OpARM64ADD {
12185 if !(off == 0 && sym == nil) {
12188 v.reset(OpARM64MOVWloadidx)
12189 v.AddArg3(ptr, idx, mem)
12192 // match: (MOVWload [off] {sym} (ADDshiftLL [2] ptr idx) mem)
12193 // cond: off == 0 && sym == nil
12194 // result: (MOVWloadidx4 ptr idx mem)
12196 off := auxIntToInt32(v.AuxInt)
12197 sym := auxToSym(v.Aux)
12198 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 2 {
12204 if !(off == 0 && sym == nil) {
12207 v.reset(OpARM64MOVWloadidx4)
12208 v.AddArg3(ptr, idx, mem)
12211 // match: (MOVWload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
12212 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
12213 // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
12215 off1 := auxIntToInt32(v.AuxInt)
12216 sym1 := auxToSym(v.Aux)
12217 if v_0.Op != OpARM64MOVDaddr {
12220 off2 := auxIntToInt32(v_0.AuxInt)
12221 sym2 := auxToSym(v_0.Aux)
12224 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
12227 v.reset(OpARM64MOVWload)
12228 v.AuxInt = int32ToAuxInt(off1 + off2)
12229 v.Aux = symToAux(mergeSym(sym1, sym2))
12230 v.AddArg2(ptr, mem)
12233 // match: (MOVWload [off] {sym} ptr (MOVWstorezero [off2] {sym2} ptr2 _))
12234 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
12235 // result: (MOVDconst [0])
12237 off := auxIntToInt32(v.AuxInt)
12238 sym := auxToSym(v.Aux)
12240 if v_1.Op != OpARM64MOVWstorezero {
12243 off2 := auxIntToInt32(v_1.AuxInt)
12244 sym2 := auxToSym(v_1.Aux)
12245 ptr2 := v_1.Args[0]
12246 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
12249 v.reset(OpARM64MOVDconst)
12250 v.AuxInt = int64ToAuxInt(0)
12255 func rewriteValueARM64_OpARM64MOVWloadidx(v *Value) bool {
12259 // match: (MOVWloadidx ptr (MOVDconst [c]) mem)
12260 // cond: is32Bit(c)
12261 // result: (MOVWload [int32(c)] ptr mem)
12264 if v_1.Op != OpARM64MOVDconst {
12267 c := auxIntToInt64(v_1.AuxInt)
12272 v.reset(OpARM64MOVWload)
12273 v.AuxInt = int32ToAuxInt(int32(c))
12274 v.AddArg2(ptr, mem)
12277 // match: (MOVWloadidx (MOVDconst [c]) ptr mem)
12278 // cond: is32Bit(c)
12279 // result: (MOVWload [int32(c)] ptr mem)
12281 if v_0.Op != OpARM64MOVDconst {
12284 c := auxIntToInt64(v_0.AuxInt)
12290 v.reset(OpARM64MOVWload)
12291 v.AuxInt = int32ToAuxInt(int32(c))
12292 v.AddArg2(ptr, mem)
12295 // match: (MOVWloadidx ptr (SLLconst [2] idx) mem)
12296 // result: (MOVWloadidx4 ptr idx mem)
12299 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 2 {
12304 v.reset(OpARM64MOVWloadidx4)
12305 v.AddArg3(ptr, idx, mem)
12308 // match: (MOVWloadidx (SLLconst [2] idx) ptr mem)
12309 // result: (MOVWloadidx4 ptr idx mem)
12311 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 2 {
12317 v.reset(OpARM64MOVWloadidx4)
12318 v.AddArg3(ptr, idx, mem)
12321 // match: (MOVWloadidx ptr idx (MOVWstorezeroidx ptr2 idx2 _))
12322 // cond: (isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2))
12323 // result: (MOVDconst [0])
12327 if v_2.Op != OpARM64MOVWstorezeroidx {
12330 idx2 := v_2.Args[1]
12331 ptr2 := v_2.Args[0]
12332 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2) || isSamePtr(ptr, idx2) && isSamePtr(idx, ptr2)) {
12335 v.reset(OpARM64MOVDconst)
12336 v.AuxInt = int64ToAuxInt(0)
12341 func rewriteValueARM64_OpARM64MOVWloadidx4(v *Value) bool {
12345 // match: (MOVWloadidx4 ptr (MOVDconst [c]) mem)
12346 // cond: is32Bit(c<<2)
12347 // result: (MOVWload [int32(c)<<2] ptr mem)
12350 if v_1.Op != OpARM64MOVDconst {
12353 c := auxIntToInt64(v_1.AuxInt)
12355 if !(is32Bit(c << 2)) {
12358 v.reset(OpARM64MOVWload)
12359 v.AuxInt = int32ToAuxInt(int32(c) << 2)
12360 v.AddArg2(ptr, mem)
12363 // match: (MOVWloadidx4 ptr idx (MOVWstorezeroidx4 ptr2 idx2 _))
12364 // cond: isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)
12365 // result: (MOVDconst [0])
12369 if v_2.Op != OpARM64MOVWstorezeroidx4 {
12372 idx2 := v_2.Args[1]
12373 ptr2 := v_2.Args[0]
12374 if !(isSamePtr(ptr, ptr2) && isSamePtr(idx, idx2)) {
12377 v.reset(OpARM64MOVDconst)
12378 v.AuxInt = int64ToAuxInt(0)
12383 func rewriteValueARM64_OpARM64MOVWreg(v *Value) bool {
12385 // match: (MOVWreg x:(MOVBload _ _))
12386 // result: (MOVDreg x)
12389 if x.Op != OpARM64MOVBload {
12392 v.reset(OpARM64MOVDreg)
12396 // match: (MOVWreg x:(MOVBUload _ _))
12397 // result: (MOVDreg x)
12400 if x.Op != OpARM64MOVBUload {
12403 v.reset(OpARM64MOVDreg)
12407 // match: (MOVWreg x:(MOVHload _ _))
12408 // result: (MOVDreg x)
12411 if x.Op != OpARM64MOVHload {
12414 v.reset(OpARM64MOVDreg)
12418 // match: (MOVWreg x:(MOVHUload _ _))
12419 // result: (MOVDreg x)
12422 if x.Op != OpARM64MOVHUload {
12425 v.reset(OpARM64MOVDreg)
12429 // match: (MOVWreg x:(MOVWload _ _))
12430 // result: (MOVDreg x)
12433 if x.Op != OpARM64MOVWload {
12436 v.reset(OpARM64MOVDreg)
12440 // match: (MOVWreg x:(MOVBloadidx _ _ _))
12441 // result: (MOVDreg x)
12444 if x.Op != OpARM64MOVBloadidx {
12447 v.reset(OpARM64MOVDreg)
12451 // match: (MOVWreg x:(MOVBUloadidx _ _ _))
12452 // result: (MOVDreg x)
12455 if x.Op != OpARM64MOVBUloadidx {
12458 v.reset(OpARM64MOVDreg)
12462 // match: (MOVWreg x:(MOVHloadidx _ _ _))
12463 // result: (MOVDreg x)
12466 if x.Op != OpARM64MOVHloadidx {
12469 v.reset(OpARM64MOVDreg)
12473 // match: (MOVWreg x:(MOVHUloadidx _ _ _))
12474 // result: (MOVDreg x)
12477 if x.Op != OpARM64MOVHUloadidx {
12480 v.reset(OpARM64MOVDreg)
12484 // match: (MOVWreg x:(MOVWloadidx _ _ _))
12485 // result: (MOVDreg x)
12488 if x.Op != OpARM64MOVWloadidx {
12491 v.reset(OpARM64MOVDreg)
12495 // match: (MOVWreg x:(MOVHloadidx2 _ _ _))
12496 // result: (MOVDreg x)
12499 if x.Op != OpARM64MOVHloadidx2 {
12502 v.reset(OpARM64MOVDreg)
12506 // match: (MOVWreg x:(MOVHUloadidx2 _ _ _))
12507 // result: (MOVDreg x)
12510 if x.Op != OpARM64MOVHUloadidx2 {
12513 v.reset(OpARM64MOVDreg)
12517 // match: (MOVWreg x:(MOVWloadidx4 _ _ _))
12518 // result: (MOVDreg x)
12521 if x.Op != OpARM64MOVWloadidx4 {
12524 v.reset(OpARM64MOVDreg)
12528 // match: (MOVWreg x:(MOVBreg _))
12529 // result: (MOVDreg x)
12532 if x.Op != OpARM64MOVBreg {
12535 v.reset(OpARM64MOVDreg)
12539 // match: (MOVWreg x:(MOVBUreg _))
12540 // result: (MOVDreg x)
12543 if x.Op != OpARM64MOVBUreg {
12546 v.reset(OpARM64MOVDreg)
12550 // match: (MOVWreg x:(MOVHreg _))
12551 // result: (MOVDreg x)
12554 if x.Op != OpARM64MOVHreg {
12557 v.reset(OpARM64MOVDreg)
12561 // match: (MOVWreg x:(MOVWreg _))
12562 // result: (MOVDreg x)
12565 if x.Op != OpARM64MOVWreg {
12568 v.reset(OpARM64MOVDreg)
12572 // match: (MOVWreg (MOVDconst [c]))
12573 // result: (MOVDconst [int64(int32(c))])
12575 if v_0.Op != OpARM64MOVDconst {
12578 c := auxIntToInt64(v_0.AuxInt)
12579 v.reset(OpARM64MOVDconst)
12580 v.AuxInt = int64ToAuxInt(int64(int32(c)))
12583 // match: (MOVWreg x)
12584 // cond: v.Type.Size() <= 4
12588 if !(v.Type.Size() <= 4) {
12594 // match: (MOVWreg <t> (ANDconst x [c]))
12595 // cond: uint64(c) & uint64(0xffffffff80000000) == 0
12596 // result: (ANDconst <t> x [c])
12599 if v_0.Op != OpARM64ANDconst {
12602 c := auxIntToInt64(v_0.AuxInt)
12604 if !(uint64(c)&uint64(0xffffffff80000000) == 0) {
12607 v.reset(OpARM64ANDconst)
12609 v.AuxInt = int64ToAuxInt(c)
12613 // match: (MOVWreg (SLLconst [lc] x))
12615 // result: (SBFIZ [armBFAuxInt(lc, 32-lc)] x)
12617 if v_0.Op != OpARM64SLLconst {
12620 lc := auxIntToInt64(v_0.AuxInt)
12625 v.reset(OpARM64SBFIZ)
12626 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, 32-lc))
12630 // match: (MOVWreg (SBFX [bfc] x))
12631 // cond: bfc.getARM64BFwidth() <= 32
12632 // result: (SBFX [bfc] x)
12634 if v_0.Op != OpARM64SBFX {
12637 bfc := auxIntToArm64BitField(v_0.AuxInt)
12639 if !(bfc.getARM64BFwidth() <= 32) {
12642 v.reset(OpARM64SBFX)
12643 v.AuxInt = arm64BitFieldToAuxInt(bfc)
12649 func rewriteValueARM64_OpARM64MOVWstore(v *Value) bool {
12654 config := b.Func.Config
12655 // match: (MOVWstore [off] {sym} ptr (FMOVSfpgp val) mem)
12656 // result: (FMOVSstore [off] {sym} ptr val mem)
12658 off := auxIntToInt32(v.AuxInt)
12659 sym := auxToSym(v.Aux)
12661 if v_1.Op != OpARM64FMOVSfpgp {
12666 v.reset(OpARM64FMOVSstore)
12667 v.AuxInt = int32ToAuxInt(off)
12668 v.Aux = symToAux(sym)
12669 v.AddArg3(ptr, val, mem)
12672 // match: (MOVWstore [off1] {sym} (ADDconst [off2] ptr) val mem)
12673 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
12674 // result: (MOVWstore [off1+int32(off2)] {sym} ptr val mem)
12676 off1 := auxIntToInt32(v.AuxInt)
12677 sym := auxToSym(v.Aux)
12678 if v_0.Op != OpARM64ADDconst {
12681 off2 := auxIntToInt64(v_0.AuxInt)
12685 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
12688 v.reset(OpARM64MOVWstore)
12689 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
12690 v.Aux = symToAux(sym)
12691 v.AddArg3(ptr, val, mem)
12694 // match: (MOVWstore [off] {sym} (ADD ptr idx) val mem)
12695 // cond: off == 0 && sym == nil
12696 // result: (MOVWstoreidx ptr idx val mem)
12698 off := auxIntToInt32(v.AuxInt)
12699 sym := auxToSym(v.Aux)
12700 if v_0.Op != OpARM64ADD {
12707 if !(off == 0 && sym == nil) {
12710 v.reset(OpARM64MOVWstoreidx)
12711 v.AddArg4(ptr, idx, val, mem)
12714 // match: (MOVWstore [off] {sym} (ADDshiftLL [2] ptr idx) val mem)
12715 // cond: off == 0 && sym == nil
12716 // result: (MOVWstoreidx4 ptr idx val mem)
12718 off := auxIntToInt32(v.AuxInt)
12719 sym := auxToSym(v.Aux)
12720 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 2 {
12727 if !(off == 0 && sym == nil) {
12730 v.reset(OpARM64MOVWstoreidx4)
12731 v.AddArg4(ptr, idx, val, mem)
12734 // match: (MOVWstore [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) val mem)
12735 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
12736 // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
12738 off1 := auxIntToInt32(v.AuxInt)
12739 sym1 := auxToSym(v.Aux)
12740 if v_0.Op != OpARM64MOVDaddr {
12743 off2 := auxIntToInt32(v_0.AuxInt)
12744 sym2 := auxToSym(v_0.Aux)
12748 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
12751 v.reset(OpARM64MOVWstore)
12752 v.AuxInt = int32ToAuxInt(off1 + off2)
12753 v.Aux = symToAux(mergeSym(sym1, sym2))
12754 v.AddArg3(ptr, val, mem)
12757 // match: (MOVWstore [off] {sym} ptr (MOVDconst [0]) mem)
12758 // result: (MOVWstorezero [off] {sym} ptr mem)
12760 off := auxIntToInt32(v.AuxInt)
12761 sym := auxToSym(v.Aux)
12763 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
12767 v.reset(OpARM64MOVWstorezero)
12768 v.AuxInt = int32ToAuxInt(off)
12769 v.Aux = symToAux(sym)
12770 v.AddArg2(ptr, mem)
12773 // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem)
12774 // result: (MOVWstore [off] {sym} ptr x mem)
12776 off := auxIntToInt32(v.AuxInt)
12777 sym := auxToSym(v.Aux)
12779 if v_1.Op != OpARM64MOVWreg {
12784 v.reset(OpARM64MOVWstore)
12785 v.AuxInt = int32ToAuxInt(off)
12786 v.Aux = symToAux(sym)
12787 v.AddArg3(ptr, x, mem)
12790 // match: (MOVWstore [off] {sym} ptr (MOVWUreg x) mem)
12791 // result: (MOVWstore [off] {sym} ptr x mem)
12793 off := auxIntToInt32(v.AuxInt)
12794 sym := auxToSym(v.Aux)
12796 if v_1.Op != OpARM64MOVWUreg {
12801 v.reset(OpARM64MOVWstore)
12802 v.AuxInt = int32ToAuxInt(off)
12803 v.Aux = symToAux(sym)
12804 v.AddArg3(ptr, x, mem)
12809 func rewriteValueARM64_OpARM64MOVWstoreidx(v *Value) bool {
12814 // match: (MOVWstoreidx ptr (MOVDconst [c]) val mem)
12815 // cond: is32Bit(c)
12816 // result: (MOVWstore [int32(c)] ptr val mem)
12819 if v_1.Op != OpARM64MOVDconst {
12822 c := auxIntToInt64(v_1.AuxInt)
12828 v.reset(OpARM64MOVWstore)
12829 v.AuxInt = int32ToAuxInt(int32(c))
12830 v.AddArg3(ptr, val, mem)
12833 // match: (MOVWstoreidx (MOVDconst [c]) idx val mem)
12834 // cond: is32Bit(c)
12835 // result: (MOVWstore [int32(c)] idx val mem)
12837 if v_0.Op != OpARM64MOVDconst {
12840 c := auxIntToInt64(v_0.AuxInt)
12847 v.reset(OpARM64MOVWstore)
12848 v.AuxInt = int32ToAuxInt(int32(c))
12849 v.AddArg3(idx, val, mem)
12852 // match: (MOVWstoreidx ptr (SLLconst [2] idx) val mem)
12853 // result: (MOVWstoreidx4 ptr idx val mem)
12856 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 2 {
12862 v.reset(OpARM64MOVWstoreidx4)
12863 v.AddArg4(ptr, idx, val, mem)
12866 // match: (MOVWstoreidx (SLLconst [2] idx) ptr val mem)
12867 // result: (MOVWstoreidx4 ptr idx val mem)
12869 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 2 {
12876 v.reset(OpARM64MOVWstoreidx4)
12877 v.AddArg4(ptr, idx, val, mem)
12880 // match: (MOVWstoreidx ptr idx (MOVDconst [0]) mem)
12881 // result: (MOVWstorezeroidx ptr idx mem)
12885 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
12889 v.reset(OpARM64MOVWstorezeroidx)
12890 v.AddArg3(ptr, idx, mem)
12893 // match: (MOVWstoreidx ptr idx (MOVWreg x) mem)
12894 // result: (MOVWstoreidx ptr idx x mem)
12898 if v_2.Op != OpARM64MOVWreg {
12903 v.reset(OpARM64MOVWstoreidx)
12904 v.AddArg4(ptr, idx, x, mem)
12907 // match: (MOVWstoreidx ptr idx (MOVWUreg x) mem)
12908 // result: (MOVWstoreidx ptr idx x mem)
12912 if v_2.Op != OpARM64MOVWUreg {
12917 v.reset(OpARM64MOVWstoreidx)
12918 v.AddArg4(ptr, idx, x, mem)
12923 func rewriteValueARM64_OpARM64MOVWstoreidx4(v *Value) bool {
12928 // match: (MOVWstoreidx4 ptr (MOVDconst [c]) val mem)
12929 // cond: is32Bit(c<<2)
12930 // result: (MOVWstore [int32(c)<<2] ptr val mem)
12933 if v_1.Op != OpARM64MOVDconst {
12936 c := auxIntToInt64(v_1.AuxInt)
12939 if !(is32Bit(c << 2)) {
12942 v.reset(OpARM64MOVWstore)
12943 v.AuxInt = int32ToAuxInt(int32(c) << 2)
12944 v.AddArg3(ptr, val, mem)
12947 // match: (MOVWstoreidx4 ptr idx (MOVDconst [0]) mem)
12948 // result: (MOVWstorezeroidx4 ptr idx mem)
12952 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
12956 v.reset(OpARM64MOVWstorezeroidx4)
12957 v.AddArg3(ptr, idx, mem)
12960 // match: (MOVWstoreidx4 ptr idx (MOVWreg x) mem)
12961 // result: (MOVWstoreidx4 ptr idx x mem)
12965 if v_2.Op != OpARM64MOVWreg {
12970 v.reset(OpARM64MOVWstoreidx4)
12971 v.AddArg4(ptr, idx, x, mem)
12974 // match: (MOVWstoreidx4 ptr idx (MOVWUreg x) mem)
12975 // result: (MOVWstoreidx4 ptr idx x mem)
12979 if v_2.Op != OpARM64MOVWUreg {
12984 v.reset(OpARM64MOVWstoreidx4)
12985 v.AddArg4(ptr, idx, x, mem)
12990 func rewriteValueARM64_OpARM64MOVWstorezero(v *Value) bool {
12994 config := b.Func.Config
12995 // match: (MOVWstorezero [off1] {sym} (ADDconst [off2] ptr) mem)
12996 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
12997 // result: (MOVWstorezero [off1+int32(off2)] {sym} ptr mem)
12999 off1 := auxIntToInt32(v.AuxInt)
13000 sym := auxToSym(v.Aux)
13001 if v_0.Op != OpARM64ADDconst {
13004 off2 := auxIntToInt64(v_0.AuxInt)
13007 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
13010 v.reset(OpARM64MOVWstorezero)
13011 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
13012 v.Aux = symToAux(sym)
13013 v.AddArg2(ptr, mem)
13016 // match: (MOVWstorezero [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
13017 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
13018 // result: (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
13020 off1 := auxIntToInt32(v.AuxInt)
13021 sym1 := auxToSym(v.Aux)
13022 if v_0.Op != OpARM64MOVDaddr {
13025 off2 := auxIntToInt32(v_0.AuxInt)
13026 sym2 := auxToSym(v_0.Aux)
13029 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
13032 v.reset(OpARM64MOVWstorezero)
13033 v.AuxInt = int32ToAuxInt(off1 + off2)
13034 v.Aux = symToAux(mergeSym(sym1, sym2))
13035 v.AddArg2(ptr, mem)
13038 // match: (MOVWstorezero [off] {sym} (ADD ptr idx) mem)
13039 // cond: off == 0 && sym == nil
13040 // result: (MOVWstorezeroidx ptr idx mem)
13042 off := auxIntToInt32(v.AuxInt)
13043 sym := auxToSym(v.Aux)
13044 if v_0.Op != OpARM64ADD {
13050 if !(off == 0 && sym == nil) {
13053 v.reset(OpARM64MOVWstorezeroidx)
13054 v.AddArg3(ptr, idx, mem)
13057 // match: (MOVWstorezero [off] {sym} (ADDshiftLL [2] ptr idx) mem)
13058 // cond: off == 0 && sym == nil
13059 // result: (MOVWstorezeroidx4 ptr idx mem)
13061 off := auxIntToInt32(v.AuxInt)
13062 sym := auxToSym(v.Aux)
13063 if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 2 {
13069 if !(off == 0 && sym == nil) {
13072 v.reset(OpARM64MOVWstorezeroidx4)
13073 v.AddArg3(ptr, idx, mem)
13078 func rewriteValueARM64_OpARM64MOVWstorezeroidx(v *Value) bool {
13082 // match: (MOVWstorezeroidx ptr (MOVDconst [c]) mem)
13083 // cond: is32Bit(c)
13084 // result: (MOVWstorezero [int32(c)] ptr mem)
13087 if v_1.Op != OpARM64MOVDconst {
13090 c := auxIntToInt64(v_1.AuxInt)
13095 v.reset(OpARM64MOVWstorezero)
13096 v.AuxInt = int32ToAuxInt(int32(c))
13097 v.AddArg2(ptr, mem)
13100 // match: (MOVWstorezeroidx (MOVDconst [c]) idx mem)
13101 // cond: is32Bit(c)
13102 // result: (MOVWstorezero [int32(c)] idx mem)
13104 if v_0.Op != OpARM64MOVDconst {
13107 c := auxIntToInt64(v_0.AuxInt)
13113 v.reset(OpARM64MOVWstorezero)
13114 v.AuxInt = int32ToAuxInt(int32(c))
13115 v.AddArg2(idx, mem)
13118 // match: (MOVWstorezeroidx ptr (SLLconst [2] idx) mem)
13119 // result: (MOVWstorezeroidx4 ptr idx mem)
13122 if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 2 {
13127 v.reset(OpARM64MOVWstorezeroidx4)
13128 v.AddArg3(ptr, idx, mem)
13131 // match: (MOVWstorezeroidx (SLLconst [2] idx) ptr mem)
13132 // result: (MOVWstorezeroidx4 ptr idx mem)
13134 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 2 {
13140 v.reset(OpARM64MOVWstorezeroidx4)
13141 v.AddArg3(ptr, idx, mem)
13146 func rewriteValueARM64_OpARM64MOVWstorezeroidx4(v *Value) bool {
13150 // match: (MOVWstorezeroidx4 ptr (MOVDconst [c]) mem)
13151 // cond: is32Bit(c<<2)
13152 // result: (MOVWstorezero [int32(c<<2)] ptr mem)
13155 if v_1.Op != OpARM64MOVDconst {
13158 c := auxIntToInt64(v_1.AuxInt)
13160 if !(is32Bit(c << 2)) {
13163 v.reset(OpARM64MOVWstorezero)
13164 v.AuxInt = int32ToAuxInt(int32(c << 2))
13165 v.AddArg2(ptr, mem)
13170 func rewriteValueARM64_OpARM64MSUB(v *Value) bool {
13175 // match: (MSUB a x (MOVDconst [-1]))
13176 // result: (ADD a x)
13180 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != -1 {
13183 v.reset(OpARM64ADD)
13187 // match: (MSUB a _ (MOVDconst [0]))
13191 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
13197 // match: (MSUB a x (MOVDconst [1]))
13198 // result: (SUB a x)
13202 if v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 1 {
13205 v.reset(OpARM64SUB)
13209 // match: (MSUB a x (MOVDconst [c]))
13210 // cond: isPowerOfTwo64(c)
13211 // result: (SUBshiftLL a x [log64(c)])
13215 if v_2.Op != OpARM64MOVDconst {
13218 c := auxIntToInt64(v_2.AuxInt)
13219 if !(isPowerOfTwo64(c)) {
13222 v.reset(OpARM64SUBshiftLL)
13223 v.AuxInt = int64ToAuxInt(log64(c))
13227 // match: (MSUB a x (MOVDconst [c]))
13228 // cond: isPowerOfTwo64(c-1) && c>=3
13229 // result: (SUB a (ADDshiftLL <x.Type> x x [log64(c-1)]))
13233 if v_2.Op != OpARM64MOVDconst {
13236 c := auxIntToInt64(v_2.AuxInt)
13237 if !(isPowerOfTwo64(c-1) && c >= 3) {
13240 v.reset(OpARM64SUB)
13241 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13242 v0.AuxInt = int64ToAuxInt(log64(c - 1))
13247 // match: (MSUB a x (MOVDconst [c]))
13248 // cond: isPowerOfTwo64(c+1) && c>=7
13249 // result: (ADD a (SUBshiftLL <x.Type> x x [log64(c+1)]))
13253 if v_2.Op != OpARM64MOVDconst {
13256 c := auxIntToInt64(v_2.AuxInt)
13257 if !(isPowerOfTwo64(c+1) && c >= 7) {
13260 v.reset(OpARM64ADD)
13261 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13262 v0.AuxInt = int64ToAuxInt(log64(c + 1))
13267 // match: (MSUB a x (MOVDconst [c]))
13268 // cond: c%3 == 0 && isPowerOfTwo64(c/3)
13269 // result: (ADDshiftLL a (SUBshiftLL <x.Type> x x [2]) [log64(c/3)])
13273 if v_2.Op != OpARM64MOVDconst {
13276 c := auxIntToInt64(v_2.AuxInt)
13277 if !(c%3 == 0 && isPowerOfTwo64(c/3)) {
13280 v.reset(OpARM64ADDshiftLL)
13281 v.AuxInt = int64ToAuxInt(log64(c / 3))
13282 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13283 v0.AuxInt = int64ToAuxInt(2)
13288 // match: (MSUB a x (MOVDconst [c]))
13289 // cond: c%5 == 0 && isPowerOfTwo64(c/5)
13290 // result: (SUBshiftLL a (ADDshiftLL <x.Type> x x [2]) [log64(c/5)])
13294 if v_2.Op != OpARM64MOVDconst {
13297 c := auxIntToInt64(v_2.AuxInt)
13298 if !(c%5 == 0 && isPowerOfTwo64(c/5)) {
13301 v.reset(OpARM64SUBshiftLL)
13302 v.AuxInt = int64ToAuxInt(log64(c / 5))
13303 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13304 v0.AuxInt = int64ToAuxInt(2)
13309 // match: (MSUB a x (MOVDconst [c]))
13310 // cond: c%7 == 0 && isPowerOfTwo64(c/7)
13311 // result: (ADDshiftLL a (SUBshiftLL <x.Type> x x [3]) [log64(c/7)])
13315 if v_2.Op != OpARM64MOVDconst {
13318 c := auxIntToInt64(v_2.AuxInt)
13319 if !(c%7 == 0 && isPowerOfTwo64(c/7)) {
13322 v.reset(OpARM64ADDshiftLL)
13323 v.AuxInt = int64ToAuxInt(log64(c / 7))
13324 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13325 v0.AuxInt = int64ToAuxInt(3)
13330 // match: (MSUB a x (MOVDconst [c]))
13331 // cond: c%9 == 0 && isPowerOfTwo64(c/9)
13332 // result: (SUBshiftLL a (ADDshiftLL <x.Type> x x [3]) [log64(c/9)])
13336 if v_2.Op != OpARM64MOVDconst {
13339 c := auxIntToInt64(v_2.AuxInt)
13340 if !(c%9 == 0 && isPowerOfTwo64(c/9)) {
13343 v.reset(OpARM64SUBshiftLL)
13344 v.AuxInt = int64ToAuxInt(log64(c / 9))
13345 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13346 v0.AuxInt = int64ToAuxInt(3)
13351 // match: (MSUB a (MOVDconst [-1]) x)
13352 // result: (ADD a x)
13355 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
13359 v.reset(OpARM64ADD)
13363 // match: (MSUB a (MOVDconst [0]) _)
13367 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
13373 // match: (MSUB a (MOVDconst [1]) x)
13374 // result: (SUB a x)
13377 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
13381 v.reset(OpARM64SUB)
13385 // match: (MSUB a (MOVDconst [c]) x)
13386 // cond: isPowerOfTwo64(c)
13387 // result: (SUBshiftLL a x [log64(c)])
13390 if v_1.Op != OpARM64MOVDconst {
13393 c := auxIntToInt64(v_1.AuxInt)
13395 if !(isPowerOfTwo64(c)) {
13398 v.reset(OpARM64SUBshiftLL)
13399 v.AuxInt = int64ToAuxInt(log64(c))
13403 // match: (MSUB a (MOVDconst [c]) x)
13404 // cond: isPowerOfTwo64(c-1) && c>=3
13405 // result: (SUB a (ADDshiftLL <x.Type> x x [log64(c-1)]))
13408 if v_1.Op != OpARM64MOVDconst {
13411 c := auxIntToInt64(v_1.AuxInt)
13413 if !(isPowerOfTwo64(c-1) && c >= 3) {
13416 v.reset(OpARM64SUB)
13417 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13418 v0.AuxInt = int64ToAuxInt(log64(c - 1))
13423 // match: (MSUB a (MOVDconst [c]) x)
13424 // cond: isPowerOfTwo64(c+1) && c>=7
13425 // result: (ADD a (SUBshiftLL <x.Type> x x [log64(c+1)]))
13428 if v_1.Op != OpARM64MOVDconst {
13431 c := auxIntToInt64(v_1.AuxInt)
13433 if !(isPowerOfTwo64(c+1) && c >= 7) {
13436 v.reset(OpARM64ADD)
13437 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13438 v0.AuxInt = int64ToAuxInt(log64(c + 1))
13443 // match: (MSUB a (MOVDconst [c]) x)
13444 // cond: c%3 == 0 && isPowerOfTwo64(c/3)
13445 // result: (ADDshiftLL a (SUBshiftLL <x.Type> x x [2]) [log64(c/3)])
13448 if v_1.Op != OpARM64MOVDconst {
13451 c := auxIntToInt64(v_1.AuxInt)
13453 if !(c%3 == 0 && isPowerOfTwo64(c/3)) {
13456 v.reset(OpARM64ADDshiftLL)
13457 v.AuxInt = int64ToAuxInt(log64(c / 3))
13458 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13459 v0.AuxInt = int64ToAuxInt(2)
13464 // match: (MSUB a (MOVDconst [c]) x)
13465 // cond: c%5 == 0 && isPowerOfTwo64(c/5)
13466 // result: (SUBshiftLL a (ADDshiftLL <x.Type> x x [2]) [log64(c/5)])
13469 if v_1.Op != OpARM64MOVDconst {
13472 c := auxIntToInt64(v_1.AuxInt)
13474 if !(c%5 == 0 && isPowerOfTwo64(c/5)) {
13477 v.reset(OpARM64SUBshiftLL)
13478 v.AuxInt = int64ToAuxInt(log64(c / 5))
13479 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13480 v0.AuxInt = int64ToAuxInt(2)
13485 // match: (MSUB a (MOVDconst [c]) x)
13486 // cond: c%7 == 0 && isPowerOfTwo64(c/7)
13487 // result: (ADDshiftLL a (SUBshiftLL <x.Type> x x [3]) [log64(c/7)])
13490 if v_1.Op != OpARM64MOVDconst {
13493 c := auxIntToInt64(v_1.AuxInt)
13495 if !(c%7 == 0 && isPowerOfTwo64(c/7)) {
13498 v.reset(OpARM64ADDshiftLL)
13499 v.AuxInt = int64ToAuxInt(log64(c / 7))
13500 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13501 v0.AuxInt = int64ToAuxInt(3)
13506 // match: (MSUB a (MOVDconst [c]) x)
13507 // cond: c%9 == 0 && isPowerOfTwo64(c/9)
13508 // result: (SUBshiftLL a (ADDshiftLL <x.Type> x x [3]) [log64(c/9)])
13511 if v_1.Op != OpARM64MOVDconst {
13514 c := auxIntToInt64(v_1.AuxInt)
13516 if !(c%9 == 0 && isPowerOfTwo64(c/9)) {
13519 v.reset(OpARM64SUBshiftLL)
13520 v.AuxInt = int64ToAuxInt(log64(c / 9))
13521 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13522 v0.AuxInt = int64ToAuxInt(3)
13527 // match: (MSUB (MOVDconst [c]) x y)
13528 // result: (ADDconst [c] (MNEG <x.Type> x y))
13530 if v_0.Op != OpARM64MOVDconst {
13533 c := auxIntToInt64(v_0.AuxInt)
13536 v.reset(OpARM64ADDconst)
13537 v.AuxInt = int64ToAuxInt(c)
13538 v0 := b.NewValue0(v.Pos, OpARM64MNEG, x.Type)
13543 // match: (MSUB a (MOVDconst [c]) (MOVDconst [d]))
13544 // result: (SUBconst [c*d] a)
13547 if v_1.Op != OpARM64MOVDconst {
13550 c := auxIntToInt64(v_1.AuxInt)
13551 if v_2.Op != OpARM64MOVDconst {
13554 d := auxIntToInt64(v_2.AuxInt)
13555 v.reset(OpARM64SUBconst)
13556 v.AuxInt = int64ToAuxInt(c * d)
13562 func rewriteValueARM64_OpARM64MSUBW(v *Value) bool {
13567 // match: (MSUBW a x (MOVDconst [c]))
13568 // cond: int32(c)==-1
13569 // result: (MOVWUreg (ADD <a.Type> a x))
13573 if v_2.Op != OpARM64MOVDconst {
13576 c := auxIntToInt64(v_2.AuxInt)
13577 if !(int32(c) == -1) {
13580 v.reset(OpARM64MOVWUreg)
13581 v0 := b.NewValue0(v.Pos, OpARM64ADD, a.Type)
13586 // match: (MSUBW a _ (MOVDconst [c]))
13587 // cond: int32(c)==0
13588 // result: (MOVWUreg a)
13591 if v_2.Op != OpARM64MOVDconst {
13594 c := auxIntToInt64(v_2.AuxInt)
13595 if !(int32(c) == 0) {
13598 v.reset(OpARM64MOVWUreg)
13602 // match: (MSUBW a x (MOVDconst [c]))
13603 // cond: int32(c)==1
13604 // result: (MOVWUreg (SUB <a.Type> a x))
13608 if v_2.Op != OpARM64MOVDconst {
13611 c := auxIntToInt64(v_2.AuxInt)
13612 if !(int32(c) == 1) {
13615 v.reset(OpARM64MOVWUreg)
13616 v0 := b.NewValue0(v.Pos, OpARM64SUB, a.Type)
13621 // match: (MSUBW a x (MOVDconst [c]))
13622 // cond: isPowerOfTwo64(c)
13623 // result: (MOVWUreg (SUBshiftLL <a.Type> a x [log64(c)]))
13627 if v_2.Op != OpARM64MOVDconst {
13630 c := auxIntToInt64(v_2.AuxInt)
13631 if !(isPowerOfTwo64(c)) {
13634 v.reset(OpARM64MOVWUreg)
13635 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
13636 v0.AuxInt = int64ToAuxInt(log64(c))
13641 // match: (MSUBW a x (MOVDconst [c]))
13642 // cond: isPowerOfTwo64(c-1) && int32(c)>=3
13643 // result: (MOVWUreg (SUB <a.Type> a (ADDshiftLL <x.Type> x x [log64(c-1)])))
13647 if v_2.Op != OpARM64MOVDconst {
13650 c := auxIntToInt64(v_2.AuxInt)
13651 if !(isPowerOfTwo64(c-1) && int32(c) >= 3) {
13654 v.reset(OpARM64MOVWUreg)
13655 v0 := b.NewValue0(v.Pos, OpARM64SUB, a.Type)
13656 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13657 v1.AuxInt = int64ToAuxInt(log64(c - 1))
13663 // match: (MSUBW a x (MOVDconst [c]))
13664 // cond: isPowerOfTwo64(c+1) && int32(c)>=7
13665 // result: (MOVWUreg (ADD <a.Type> a (SUBshiftLL <x.Type> x x [log64(c+1)])))
13669 if v_2.Op != OpARM64MOVDconst {
13672 c := auxIntToInt64(v_2.AuxInt)
13673 if !(isPowerOfTwo64(c+1) && int32(c) >= 7) {
13676 v.reset(OpARM64MOVWUreg)
13677 v0 := b.NewValue0(v.Pos, OpARM64ADD, a.Type)
13678 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13679 v1.AuxInt = int64ToAuxInt(log64(c + 1))
13685 // match: (MSUBW a x (MOVDconst [c]))
13686 // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)
13687 // result: (MOVWUreg (ADDshiftLL <a.Type> a (SUBshiftLL <x.Type> x x [2]) [log64(c/3)]))
13691 if v_2.Op != OpARM64MOVDconst {
13694 c := auxIntToInt64(v_2.AuxInt)
13695 if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) {
13698 v.reset(OpARM64MOVWUreg)
13699 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
13700 v0.AuxInt = int64ToAuxInt(log64(c / 3))
13701 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13702 v1.AuxInt = int64ToAuxInt(2)
13708 // match: (MSUBW a x (MOVDconst [c]))
13709 // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)
13710 // result: (MOVWUreg (SUBshiftLL <a.Type> a (ADDshiftLL <x.Type> x x [2]) [log64(c/5)]))
13714 if v_2.Op != OpARM64MOVDconst {
13717 c := auxIntToInt64(v_2.AuxInt)
13718 if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) {
13721 v.reset(OpARM64MOVWUreg)
13722 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
13723 v0.AuxInt = int64ToAuxInt(log64(c / 5))
13724 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13725 v1.AuxInt = int64ToAuxInt(2)
13731 // match: (MSUBW a x (MOVDconst [c]))
13732 // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)
13733 // result: (MOVWUreg (ADDshiftLL <a.Type> a (SUBshiftLL <x.Type> x x [3]) [log64(c/7)]))
13737 if v_2.Op != OpARM64MOVDconst {
13740 c := auxIntToInt64(v_2.AuxInt)
13741 if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) {
13744 v.reset(OpARM64MOVWUreg)
13745 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
13746 v0.AuxInt = int64ToAuxInt(log64(c / 7))
13747 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13748 v1.AuxInt = int64ToAuxInt(3)
13754 // match: (MSUBW a x (MOVDconst [c]))
13755 // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)
13756 // result: (MOVWUreg (SUBshiftLL <a.Type> a (ADDshiftLL <x.Type> x x [3]) [log64(c/9)]))
13760 if v_2.Op != OpARM64MOVDconst {
13763 c := auxIntToInt64(v_2.AuxInt)
13764 if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) {
13767 v.reset(OpARM64MOVWUreg)
13768 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
13769 v0.AuxInt = int64ToAuxInt(log64(c / 9))
13770 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13771 v1.AuxInt = int64ToAuxInt(3)
13777 // match: (MSUBW a (MOVDconst [c]) x)
13778 // cond: int32(c)==-1
13779 // result: (MOVWUreg (ADD <a.Type> a x))
13782 if v_1.Op != OpARM64MOVDconst {
13785 c := auxIntToInt64(v_1.AuxInt)
13787 if !(int32(c) == -1) {
13790 v.reset(OpARM64MOVWUreg)
13791 v0 := b.NewValue0(v.Pos, OpARM64ADD, a.Type)
13796 // match: (MSUBW a (MOVDconst [c]) _)
13797 // cond: int32(c)==0
13798 // result: (MOVWUreg a)
13801 if v_1.Op != OpARM64MOVDconst {
13804 c := auxIntToInt64(v_1.AuxInt)
13805 if !(int32(c) == 0) {
13808 v.reset(OpARM64MOVWUreg)
13812 // match: (MSUBW a (MOVDconst [c]) x)
13813 // cond: int32(c)==1
13814 // result: (MOVWUreg (SUB <a.Type> a x))
13817 if v_1.Op != OpARM64MOVDconst {
13820 c := auxIntToInt64(v_1.AuxInt)
13822 if !(int32(c) == 1) {
13825 v.reset(OpARM64MOVWUreg)
13826 v0 := b.NewValue0(v.Pos, OpARM64SUB, a.Type)
13831 // match: (MSUBW a (MOVDconst [c]) x)
13832 // cond: isPowerOfTwo64(c)
13833 // result: (MOVWUreg (SUBshiftLL <a.Type> a x [log64(c)]))
13836 if v_1.Op != OpARM64MOVDconst {
13839 c := auxIntToInt64(v_1.AuxInt)
13841 if !(isPowerOfTwo64(c)) {
13844 v.reset(OpARM64MOVWUreg)
13845 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
13846 v0.AuxInt = int64ToAuxInt(log64(c))
13851 // match: (MSUBW a (MOVDconst [c]) x)
13852 // cond: isPowerOfTwo64(c-1) && int32(c)>=3
13853 // result: (MOVWUreg (SUB <a.Type> a (ADDshiftLL <x.Type> x x [log64(c-1)])))
13856 if v_1.Op != OpARM64MOVDconst {
13859 c := auxIntToInt64(v_1.AuxInt)
13861 if !(isPowerOfTwo64(c-1) && int32(c) >= 3) {
13864 v.reset(OpARM64MOVWUreg)
13865 v0 := b.NewValue0(v.Pos, OpARM64SUB, a.Type)
13866 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13867 v1.AuxInt = int64ToAuxInt(log64(c - 1))
13873 // match: (MSUBW a (MOVDconst [c]) x)
13874 // cond: isPowerOfTwo64(c+1) && int32(c)>=7
13875 // result: (MOVWUreg (ADD <a.Type> a (SUBshiftLL <x.Type> x x [log64(c+1)])))
13878 if v_1.Op != OpARM64MOVDconst {
13881 c := auxIntToInt64(v_1.AuxInt)
13883 if !(isPowerOfTwo64(c+1) && int32(c) >= 7) {
13886 v.reset(OpARM64MOVWUreg)
13887 v0 := b.NewValue0(v.Pos, OpARM64ADD, a.Type)
13888 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13889 v1.AuxInt = int64ToAuxInt(log64(c + 1))
13895 // match: (MSUBW a (MOVDconst [c]) x)
13896 // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)
13897 // result: (MOVWUreg (ADDshiftLL <a.Type> a (SUBshiftLL <x.Type> x x [2]) [log64(c/3)]))
13900 if v_1.Op != OpARM64MOVDconst {
13903 c := auxIntToInt64(v_1.AuxInt)
13905 if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) {
13908 v.reset(OpARM64MOVWUreg)
13909 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
13910 v0.AuxInt = int64ToAuxInt(log64(c / 3))
13911 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13912 v1.AuxInt = int64ToAuxInt(2)
13918 // match: (MSUBW a (MOVDconst [c]) x)
13919 // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)
13920 // result: (MOVWUreg (SUBshiftLL <a.Type> a (ADDshiftLL <x.Type> x x [2]) [log64(c/5)]))
13923 if v_1.Op != OpARM64MOVDconst {
13926 c := auxIntToInt64(v_1.AuxInt)
13928 if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) {
13931 v.reset(OpARM64MOVWUreg)
13932 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
13933 v0.AuxInt = int64ToAuxInt(log64(c / 5))
13934 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13935 v1.AuxInt = int64ToAuxInt(2)
13941 // match: (MSUBW a (MOVDconst [c]) x)
13942 // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)
13943 // result: (MOVWUreg (ADDshiftLL <a.Type> a (SUBshiftLL <x.Type> x x [3]) [log64(c/7)]))
13946 if v_1.Op != OpARM64MOVDconst {
13949 c := auxIntToInt64(v_1.AuxInt)
13951 if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) {
13954 v.reset(OpARM64MOVWUreg)
13955 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, a.Type)
13956 v0.AuxInt = int64ToAuxInt(log64(c / 7))
13957 v1 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, x.Type)
13958 v1.AuxInt = int64ToAuxInt(3)
13964 // match: (MSUBW a (MOVDconst [c]) x)
13965 // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)
13966 // result: (MOVWUreg (SUBshiftLL <a.Type> a (ADDshiftLL <x.Type> x x [3]) [log64(c/9)]))
13969 if v_1.Op != OpARM64MOVDconst {
13972 c := auxIntToInt64(v_1.AuxInt)
13974 if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) {
13977 v.reset(OpARM64MOVWUreg)
13978 v0 := b.NewValue0(v.Pos, OpARM64SUBshiftLL, a.Type)
13979 v0.AuxInt = int64ToAuxInt(log64(c / 9))
13980 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
13981 v1.AuxInt = int64ToAuxInt(3)
13987 // match: (MSUBW (MOVDconst [c]) x y)
13988 // result: (MOVWUreg (ADDconst <x.Type> [c] (MNEGW <x.Type> x y)))
13990 if v_0.Op != OpARM64MOVDconst {
13993 c := auxIntToInt64(v_0.AuxInt)
13996 v.reset(OpARM64MOVWUreg)
13997 v0 := b.NewValue0(v.Pos, OpARM64ADDconst, x.Type)
13998 v0.AuxInt = int64ToAuxInt(c)
13999 v1 := b.NewValue0(v.Pos, OpARM64MNEGW, x.Type)
14005 // match: (MSUBW a (MOVDconst [c]) (MOVDconst [d]))
14006 // result: (MOVWUreg (SUBconst <a.Type> [c*d] a))
14009 if v_1.Op != OpARM64MOVDconst {
14012 c := auxIntToInt64(v_1.AuxInt)
14013 if v_2.Op != OpARM64MOVDconst {
14016 d := auxIntToInt64(v_2.AuxInt)
14017 v.reset(OpARM64MOVWUreg)
14018 v0 := b.NewValue0(v.Pos, OpARM64SUBconst, a.Type)
14019 v0.AuxInt = int64ToAuxInt(c * d)
14026 func rewriteValueARM64_OpARM64MUL(v *Value) bool {
14030 // match: (MUL (NEG x) y)
14031 // result: (MNEG x y)
14033 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14034 if v_0.Op != OpARM64NEG {
14039 v.reset(OpARM64MNEG)
14045 // match: (MUL x (MOVDconst [-1]))
14048 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14050 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
14053 v.reset(OpARM64NEG)
14059 // match: (MUL _ (MOVDconst [0]))
14060 // result: (MOVDconst [0])
14062 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14063 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
14066 v.reset(OpARM64MOVDconst)
14067 v.AuxInt = int64ToAuxInt(0)
14072 // match: (MUL x (MOVDconst [1]))
14075 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14077 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
14085 // match: (MUL x (MOVDconst [c]))
14086 // cond: isPowerOfTwo64(c)
14087 // result: (SLLconst [log64(c)] x)
14089 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14091 if v_1.Op != OpARM64MOVDconst {
14094 c := auxIntToInt64(v_1.AuxInt)
14095 if !(isPowerOfTwo64(c)) {
14098 v.reset(OpARM64SLLconst)
14099 v.AuxInt = int64ToAuxInt(log64(c))
14105 // match: (MUL x (MOVDconst [c]))
14106 // cond: isPowerOfTwo64(c-1) && c >= 3
14107 // result: (ADDshiftLL x x [log64(c-1)])
14109 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14111 if v_1.Op != OpARM64MOVDconst {
14114 c := auxIntToInt64(v_1.AuxInt)
14115 if !(isPowerOfTwo64(c-1) && c >= 3) {
14118 v.reset(OpARM64ADDshiftLL)
14119 v.AuxInt = int64ToAuxInt(log64(c - 1))
14125 // match: (MUL x (MOVDconst [c]))
14126 // cond: isPowerOfTwo64(c+1) && c >= 7
14127 // result: (ADDshiftLL (NEG <x.Type> x) x [log64(c+1)])
14129 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14131 if v_1.Op != OpARM64MOVDconst {
14134 c := auxIntToInt64(v_1.AuxInt)
14135 if !(isPowerOfTwo64(c+1) && c >= 7) {
14138 v.reset(OpARM64ADDshiftLL)
14139 v.AuxInt = int64ToAuxInt(log64(c + 1))
14140 v0 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
14147 // match: (MUL x (MOVDconst [c]))
14148 // cond: c%3 == 0 && isPowerOfTwo64(c/3)
14149 // result: (SLLconst [log64(c/3)] (ADDshiftLL <x.Type> x x [1]))
14151 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14153 if v_1.Op != OpARM64MOVDconst {
14156 c := auxIntToInt64(v_1.AuxInt)
14157 if !(c%3 == 0 && isPowerOfTwo64(c/3)) {
14160 v.reset(OpARM64SLLconst)
14161 v.AuxInt = int64ToAuxInt(log64(c / 3))
14162 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14163 v0.AuxInt = int64ToAuxInt(1)
14170 // match: (MUL x (MOVDconst [c]))
14171 // cond: c%5 == 0 && isPowerOfTwo64(c/5)
14172 // result: (SLLconst [log64(c/5)] (ADDshiftLL <x.Type> x x [2]))
14174 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14176 if v_1.Op != OpARM64MOVDconst {
14179 c := auxIntToInt64(v_1.AuxInt)
14180 if !(c%5 == 0 && isPowerOfTwo64(c/5)) {
14183 v.reset(OpARM64SLLconst)
14184 v.AuxInt = int64ToAuxInt(log64(c / 5))
14185 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14186 v0.AuxInt = int64ToAuxInt(2)
14193 // match: (MUL x (MOVDconst [c]))
14194 // cond: c%7 == 0 && isPowerOfTwo64(c/7)
14195 // result: (SLLconst [log64(c/7)] (ADDshiftLL <x.Type> (NEG <x.Type> x) x [3]))
14197 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14199 if v_1.Op != OpARM64MOVDconst {
14202 c := auxIntToInt64(v_1.AuxInt)
14203 if !(c%7 == 0 && isPowerOfTwo64(c/7)) {
14206 v.reset(OpARM64SLLconst)
14207 v.AuxInt = int64ToAuxInt(log64(c / 7))
14208 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14209 v0.AuxInt = int64ToAuxInt(3)
14210 v1 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
14218 // match: (MUL x (MOVDconst [c]))
14219 // cond: c%9 == 0 && isPowerOfTwo64(c/9)
14220 // result: (SLLconst [log64(c/9)] (ADDshiftLL <x.Type> x x [3]))
14222 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14224 if v_1.Op != OpARM64MOVDconst {
14227 c := auxIntToInt64(v_1.AuxInt)
14228 if !(c%9 == 0 && isPowerOfTwo64(c/9)) {
14231 v.reset(OpARM64SLLconst)
14232 v.AuxInt = int64ToAuxInt(log64(c / 9))
14233 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14234 v0.AuxInt = int64ToAuxInt(3)
14241 // match: (MUL (MOVDconst [c]) (MOVDconst [d]))
14242 // result: (MOVDconst [c*d])
14244 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14245 if v_0.Op != OpARM64MOVDconst {
14248 c := auxIntToInt64(v_0.AuxInt)
14249 if v_1.Op != OpARM64MOVDconst {
14252 d := auxIntToInt64(v_1.AuxInt)
14253 v.reset(OpARM64MOVDconst)
14254 v.AuxInt = int64ToAuxInt(c * d)
14261 func rewriteValueARM64_OpARM64MULW(v *Value) bool {
14265 // match: (MULW (NEG x) y)
14266 // result: (MNEGW x y)
14268 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14269 if v_0.Op != OpARM64NEG {
14274 v.reset(OpARM64MNEGW)
14280 // match: (MULW x (MOVDconst [c]))
14281 // cond: int32(c)==-1
14282 // result: (MOVWUreg (NEG <x.Type> x))
14284 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14286 if v_1.Op != OpARM64MOVDconst {
14289 c := auxIntToInt64(v_1.AuxInt)
14290 if !(int32(c) == -1) {
14293 v.reset(OpARM64MOVWUreg)
14294 v0 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
14301 // match: (MULW _ (MOVDconst [c]))
14302 // cond: int32(c)==0
14303 // result: (MOVDconst [0])
14305 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14306 if v_1.Op != OpARM64MOVDconst {
14309 c := auxIntToInt64(v_1.AuxInt)
14310 if !(int32(c) == 0) {
14313 v.reset(OpARM64MOVDconst)
14314 v.AuxInt = int64ToAuxInt(0)
14319 // match: (MULW x (MOVDconst [c]))
14320 // cond: int32(c)==1
14321 // result: (MOVWUreg x)
14323 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14325 if v_1.Op != OpARM64MOVDconst {
14328 c := auxIntToInt64(v_1.AuxInt)
14329 if !(int32(c) == 1) {
14332 v.reset(OpARM64MOVWUreg)
14338 // match: (MULW x (MOVDconst [c]))
14339 // cond: isPowerOfTwo64(c)
14340 // result: (MOVWUreg (SLLconst <x.Type> [log64(c)] x))
14342 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14344 if v_1.Op != OpARM64MOVDconst {
14347 c := auxIntToInt64(v_1.AuxInt)
14348 if !(isPowerOfTwo64(c)) {
14351 v.reset(OpARM64MOVWUreg)
14352 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
14353 v0.AuxInt = int64ToAuxInt(log64(c))
14360 // match: (MULW x (MOVDconst [c]))
14361 // cond: isPowerOfTwo64(c-1) && int32(c) >= 3
14362 // result: (MOVWUreg (ADDshiftLL <x.Type> x x [log64(c-1)]))
14364 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14366 if v_1.Op != OpARM64MOVDconst {
14369 c := auxIntToInt64(v_1.AuxInt)
14370 if !(isPowerOfTwo64(c-1) && int32(c) >= 3) {
14373 v.reset(OpARM64MOVWUreg)
14374 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14375 v0.AuxInt = int64ToAuxInt(log64(c - 1))
14382 // match: (MULW x (MOVDconst [c]))
14383 // cond: isPowerOfTwo64(c+1) && int32(c) >= 7
14384 // result: (MOVWUreg (ADDshiftLL <x.Type> (NEG <x.Type> x) x [log64(c+1)]))
14386 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14388 if v_1.Op != OpARM64MOVDconst {
14391 c := auxIntToInt64(v_1.AuxInt)
14392 if !(isPowerOfTwo64(c+1) && int32(c) >= 7) {
14395 v.reset(OpARM64MOVWUreg)
14396 v0 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14397 v0.AuxInt = int64ToAuxInt(log64(c + 1))
14398 v1 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
14406 // match: (MULW x (MOVDconst [c]))
14407 // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)
14408 // result: (MOVWUreg (SLLconst <x.Type> [log64(c/3)] (ADDshiftLL <x.Type> x x [1])))
14410 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14412 if v_1.Op != OpARM64MOVDconst {
14415 c := auxIntToInt64(v_1.AuxInt)
14416 if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) {
14419 v.reset(OpARM64MOVWUreg)
14420 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
14421 v0.AuxInt = int64ToAuxInt(log64(c / 3))
14422 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14423 v1.AuxInt = int64ToAuxInt(1)
14431 // match: (MULW x (MOVDconst [c]))
14432 // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)
14433 // result: (MOVWUreg (SLLconst <x.Type> [log64(c/5)] (ADDshiftLL <x.Type> x x [2])))
14435 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14437 if v_1.Op != OpARM64MOVDconst {
14440 c := auxIntToInt64(v_1.AuxInt)
14441 if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) {
14444 v.reset(OpARM64MOVWUreg)
14445 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
14446 v0.AuxInt = int64ToAuxInt(log64(c / 5))
14447 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14448 v1.AuxInt = int64ToAuxInt(2)
14456 // match: (MULW x (MOVDconst [c]))
14457 // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)
14458 // result: (MOVWUreg (SLLconst <x.Type> [log64(c/7)] (ADDshiftLL <x.Type> (NEG <x.Type> x) x [3])))
14460 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14462 if v_1.Op != OpARM64MOVDconst {
14465 c := auxIntToInt64(v_1.AuxInt)
14466 if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) {
14469 v.reset(OpARM64MOVWUreg)
14470 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
14471 v0.AuxInt = int64ToAuxInt(log64(c / 7))
14472 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14473 v1.AuxInt = int64ToAuxInt(3)
14474 v2 := b.NewValue0(v.Pos, OpARM64NEG, x.Type)
14483 // match: (MULW x (MOVDconst [c]))
14484 // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)
14485 // result: (MOVWUreg (SLLconst <x.Type> [log64(c/9)] (ADDshiftLL <x.Type> x x [3])))
14487 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14489 if v_1.Op != OpARM64MOVDconst {
14492 c := auxIntToInt64(v_1.AuxInt)
14493 if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) {
14496 v.reset(OpARM64MOVWUreg)
14497 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
14498 v0.AuxInt = int64ToAuxInt(log64(c / 9))
14499 v1 := b.NewValue0(v.Pos, OpARM64ADDshiftLL, x.Type)
14500 v1.AuxInt = int64ToAuxInt(3)
14508 // match: (MULW (MOVDconst [c]) (MOVDconst [d]))
14509 // result: (MOVDconst [int64(uint32(c*d))])
14511 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14512 if v_0.Op != OpARM64MOVDconst {
14515 c := auxIntToInt64(v_0.AuxInt)
14516 if v_1.Op != OpARM64MOVDconst {
14519 d := auxIntToInt64(v_1.AuxInt)
14520 v.reset(OpARM64MOVDconst)
14521 v.AuxInt = int64ToAuxInt(int64(uint32(c * d)))
14528 func rewriteValueARM64_OpARM64MVN(v *Value) bool {
14530 // match: (MVN (XOR x y))
14531 // result: (EON x y)
14533 if v_0.Op != OpARM64XOR {
14538 v.reset(OpARM64EON)
14542 // match: (MVN (MOVDconst [c]))
14543 // result: (MOVDconst [^c])
14545 if v_0.Op != OpARM64MOVDconst {
14548 c := auxIntToInt64(v_0.AuxInt)
14549 v.reset(OpARM64MOVDconst)
14550 v.AuxInt = int64ToAuxInt(^c)
14553 // match: (MVN x:(SLLconst [c] y))
14554 // cond: clobberIfDead(x)
14555 // result: (MVNshiftLL [c] y)
14558 if x.Op != OpARM64SLLconst {
14561 c := auxIntToInt64(x.AuxInt)
14563 if !(clobberIfDead(x)) {
14566 v.reset(OpARM64MVNshiftLL)
14567 v.AuxInt = int64ToAuxInt(c)
14571 // match: (MVN x:(SRLconst [c] y))
14572 // cond: clobberIfDead(x)
14573 // result: (MVNshiftRL [c] y)
14576 if x.Op != OpARM64SRLconst {
14579 c := auxIntToInt64(x.AuxInt)
14581 if !(clobberIfDead(x)) {
14584 v.reset(OpARM64MVNshiftRL)
14585 v.AuxInt = int64ToAuxInt(c)
14589 // match: (MVN x:(SRAconst [c] y))
14590 // cond: clobberIfDead(x)
14591 // result: (MVNshiftRA [c] y)
14594 if x.Op != OpARM64SRAconst {
14597 c := auxIntToInt64(x.AuxInt)
14599 if !(clobberIfDead(x)) {
14602 v.reset(OpARM64MVNshiftRA)
14603 v.AuxInt = int64ToAuxInt(c)
14607 // match: (MVN x:(RORconst [c] y))
14608 // cond: clobberIfDead(x)
14609 // result: (MVNshiftRO [c] y)
14612 if x.Op != OpARM64RORconst {
14615 c := auxIntToInt64(x.AuxInt)
14617 if !(clobberIfDead(x)) {
14620 v.reset(OpARM64MVNshiftRO)
14621 v.AuxInt = int64ToAuxInt(c)
14627 func rewriteValueARM64_OpARM64MVNshiftLL(v *Value) bool {
14629 // match: (MVNshiftLL (MOVDconst [c]) [d])
14630 // result: (MOVDconst [^int64(uint64(c)<<uint64(d))])
14632 d := auxIntToInt64(v.AuxInt)
14633 if v_0.Op != OpARM64MOVDconst {
14636 c := auxIntToInt64(v_0.AuxInt)
14637 v.reset(OpARM64MOVDconst)
14638 v.AuxInt = int64ToAuxInt(^int64(uint64(c) << uint64(d)))
14643 func rewriteValueARM64_OpARM64MVNshiftRA(v *Value) bool {
14645 // match: (MVNshiftRA (MOVDconst [c]) [d])
14646 // result: (MOVDconst [^(c>>uint64(d))])
14648 d := auxIntToInt64(v.AuxInt)
14649 if v_0.Op != OpARM64MOVDconst {
14652 c := auxIntToInt64(v_0.AuxInt)
14653 v.reset(OpARM64MOVDconst)
14654 v.AuxInt = int64ToAuxInt(^(c >> uint64(d)))
14659 func rewriteValueARM64_OpARM64MVNshiftRL(v *Value) bool {
14661 // match: (MVNshiftRL (MOVDconst [c]) [d])
14662 // result: (MOVDconst [^int64(uint64(c)>>uint64(d))])
14664 d := auxIntToInt64(v.AuxInt)
14665 if v_0.Op != OpARM64MOVDconst {
14668 c := auxIntToInt64(v_0.AuxInt)
14669 v.reset(OpARM64MOVDconst)
14670 v.AuxInt = int64ToAuxInt(^int64(uint64(c) >> uint64(d)))
14675 func rewriteValueARM64_OpARM64MVNshiftRO(v *Value) bool {
14677 // match: (MVNshiftRO (MOVDconst [c]) [d])
14678 // result: (MOVDconst [^rotateRight64(c, d)])
14680 d := auxIntToInt64(v.AuxInt)
14681 if v_0.Op != OpARM64MOVDconst {
14684 c := auxIntToInt64(v_0.AuxInt)
14685 v.reset(OpARM64MOVDconst)
14686 v.AuxInt = int64ToAuxInt(^rotateRight64(c, d))
14691 func rewriteValueARM64_OpARM64NEG(v *Value) bool {
14693 // match: (NEG (MUL x y))
14694 // result: (MNEG x y)
14696 if v_0.Op != OpARM64MUL {
14701 v.reset(OpARM64MNEG)
14705 // match: (NEG (MULW x y))
14706 // cond: v.Type.Size() <= 4
14707 // result: (MNEGW x y)
14709 if v_0.Op != OpARM64MULW {
14714 if !(v.Type.Size() <= 4) {
14717 v.reset(OpARM64MNEGW)
14721 // match: (NEG (NEG x))
14724 if v_0.Op != OpARM64NEG {
14731 // match: (NEG (MOVDconst [c]))
14732 // result: (MOVDconst [-c])
14734 if v_0.Op != OpARM64MOVDconst {
14737 c := auxIntToInt64(v_0.AuxInt)
14738 v.reset(OpARM64MOVDconst)
14739 v.AuxInt = int64ToAuxInt(-c)
14742 // match: (NEG x:(SLLconst [c] y))
14743 // cond: clobberIfDead(x)
14744 // result: (NEGshiftLL [c] y)
14747 if x.Op != OpARM64SLLconst {
14750 c := auxIntToInt64(x.AuxInt)
14752 if !(clobberIfDead(x)) {
14755 v.reset(OpARM64NEGshiftLL)
14756 v.AuxInt = int64ToAuxInt(c)
14760 // match: (NEG x:(SRLconst [c] y))
14761 // cond: clobberIfDead(x)
14762 // result: (NEGshiftRL [c] y)
14765 if x.Op != OpARM64SRLconst {
14768 c := auxIntToInt64(x.AuxInt)
14770 if !(clobberIfDead(x)) {
14773 v.reset(OpARM64NEGshiftRL)
14774 v.AuxInt = int64ToAuxInt(c)
14778 // match: (NEG x:(SRAconst [c] y))
14779 // cond: clobberIfDead(x)
14780 // result: (NEGshiftRA [c] y)
14783 if x.Op != OpARM64SRAconst {
14786 c := auxIntToInt64(x.AuxInt)
14788 if !(clobberIfDead(x)) {
14791 v.reset(OpARM64NEGshiftRA)
14792 v.AuxInt = int64ToAuxInt(c)
14798 func rewriteValueARM64_OpARM64NEGshiftLL(v *Value) bool {
14800 // match: (NEGshiftLL (MOVDconst [c]) [d])
14801 // result: (MOVDconst [-int64(uint64(c)<<uint64(d))])
14803 d := auxIntToInt64(v.AuxInt)
14804 if v_0.Op != OpARM64MOVDconst {
14807 c := auxIntToInt64(v_0.AuxInt)
14808 v.reset(OpARM64MOVDconst)
14809 v.AuxInt = int64ToAuxInt(-int64(uint64(c) << uint64(d)))
14814 func rewriteValueARM64_OpARM64NEGshiftRA(v *Value) bool {
14816 // match: (NEGshiftRA (MOVDconst [c]) [d])
14817 // result: (MOVDconst [-(c>>uint64(d))])
14819 d := auxIntToInt64(v.AuxInt)
14820 if v_0.Op != OpARM64MOVDconst {
14823 c := auxIntToInt64(v_0.AuxInt)
14824 v.reset(OpARM64MOVDconst)
14825 v.AuxInt = int64ToAuxInt(-(c >> uint64(d)))
14830 func rewriteValueARM64_OpARM64NEGshiftRL(v *Value) bool {
14832 // match: (NEGshiftRL (MOVDconst [c]) [d])
14833 // result: (MOVDconst [-int64(uint64(c)>>uint64(d))])
14835 d := auxIntToInt64(v.AuxInt)
14836 if v_0.Op != OpARM64MOVDconst {
14839 c := auxIntToInt64(v_0.AuxInt)
14840 v.reset(OpARM64MOVDconst)
14841 v.AuxInt = int64ToAuxInt(-int64(uint64(c) >> uint64(d)))
14846 func rewriteValueARM64_OpARM64NotEqual(v *Value) bool {
14849 // match: (NotEqual (CMPconst [0] z:(AND x y)))
14850 // cond: z.Uses == 1
14851 // result: (NotEqual (TST x y))
14853 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
14857 if z.Op != OpARM64AND {
14862 if !(z.Uses == 1) {
14865 v.reset(OpARM64NotEqual)
14866 v0 := b.NewValue0(v.Pos, OpARM64TST, types.TypeFlags)
14871 // match: (NotEqual (CMPWconst [0] x:(ANDconst [c] y)))
14872 // cond: x.Uses == 1
14873 // result: (NotEqual (TSTWconst [int32(c)] y))
14875 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
14879 if x.Op != OpARM64ANDconst {
14882 c := auxIntToInt64(x.AuxInt)
14884 if !(x.Uses == 1) {
14887 v.reset(OpARM64NotEqual)
14888 v0 := b.NewValue0(v.Pos, OpARM64TSTWconst, types.TypeFlags)
14889 v0.AuxInt = int32ToAuxInt(int32(c))
14894 // match: (NotEqual (CMPWconst [0] z:(AND x y)))
14895 // cond: z.Uses == 1
14896 // result: (NotEqual (TSTW x y))
14898 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
14902 if z.Op != OpARM64AND {
14907 if !(z.Uses == 1) {
14910 v.reset(OpARM64NotEqual)
14911 v0 := b.NewValue0(v.Pos, OpARM64TSTW, types.TypeFlags)
14916 // match: (NotEqual (CMPconst [0] x:(ANDconst [c] y)))
14917 // cond: x.Uses == 1
14918 // result: (NotEqual (TSTconst [c] y))
14920 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
14924 if x.Op != OpARM64ANDconst {
14927 c := auxIntToInt64(x.AuxInt)
14929 if !(x.Uses == 1) {
14932 v.reset(OpARM64NotEqual)
14933 v0 := b.NewValue0(v.Pos, OpARM64TSTconst, types.TypeFlags)
14934 v0.AuxInt = int64ToAuxInt(c)
14939 // match: (NotEqual (CMP x z:(NEG y)))
14940 // cond: z.Uses == 1
14941 // result: (NotEqual (CMN x y))
14943 if v_0.Op != OpARM64CMP {
14949 if z.Op != OpARM64NEG {
14953 if !(z.Uses == 1) {
14956 v.reset(OpARM64NotEqual)
14957 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
14962 // match: (NotEqual (CMPW x z:(NEG y)))
14963 // cond: z.Uses == 1
14964 // result: (NotEqual (CMNW x y))
14966 if v_0.Op != OpARM64CMPW {
14972 if z.Op != OpARM64NEG {
14976 if !(z.Uses == 1) {
14979 v.reset(OpARM64NotEqual)
14980 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
14985 // match: (NotEqual (CMPconst [0] x:(ADDconst [c] y)))
14986 // cond: x.Uses == 1
14987 // result: (NotEqual (CMNconst [c] y))
14989 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
14993 if x.Op != OpARM64ADDconst {
14996 c := auxIntToInt64(x.AuxInt)
14998 if !(x.Uses == 1) {
15001 v.reset(OpARM64NotEqual)
15002 v0 := b.NewValue0(v.Pos, OpARM64CMNconst, types.TypeFlags)
15003 v0.AuxInt = int64ToAuxInt(c)
15008 // match: (NotEqual (CMPWconst [0] x:(ADDconst [c] y)))
15009 // cond: x.Uses == 1
15010 // result: (NotEqual (CMNWconst [int32(c)] y))
15012 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
15016 if x.Op != OpARM64ADDconst {
15019 c := auxIntToInt64(x.AuxInt)
15021 if !(x.Uses == 1) {
15024 v.reset(OpARM64NotEqual)
15025 v0 := b.NewValue0(v.Pos, OpARM64CMNWconst, types.TypeFlags)
15026 v0.AuxInt = int32ToAuxInt(int32(c))
15031 // match: (NotEqual (CMPconst [0] z:(ADD x y)))
15032 // cond: z.Uses == 1
15033 // result: (NotEqual (CMN x y))
15035 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
15039 if z.Op != OpARM64ADD {
15044 if !(z.Uses == 1) {
15047 v.reset(OpARM64NotEqual)
15048 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
15053 // match: (NotEqual (CMPWconst [0] z:(ADD x y)))
15054 // cond: z.Uses == 1
15055 // result: (NotEqual (CMNW x y))
15057 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
15061 if z.Op != OpARM64ADD {
15066 if !(z.Uses == 1) {
15069 v.reset(OpARM64NotEqual)
15070 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
15075 // match: (NotEqual (CMPconst [0] z:(MADD a x y)))
15076 // cond: z.Uses == 1
15077 // result: (NotEqual (CMN a (MUL <x.Type> x y)))
15079 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
15083 if z.Op != OpARM64MADD {
15089 if !(z.Uses == 1) {
15092 v.reset(OpARM64NotEqual)
15093 v0 := b.NewValue0(v.Pos, OpARM64CMN, types.TypeFlags)
15094 v1 := b.NewValue0(v.Pos, OpARM64MUL, x.Type)
15100 // match: (NotEqual (CMPconst [0] z:(MSUB a x y)))
15101 // cond: z.Uses == 1
15102 // result: (NotEqual (CMP a (MUL <x.Type> x y)))
15104 if v_0.Op != OpARM64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
15108 if z.Op != OpARM64MSUB {
15114 if !(z.Uses == 1) {
15117 v.reset(OpARM64NotEqual)
15118 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
15119 v1 := b.NewValue0(v.Pos, OpARM64MUL, x.Type)
15125 // match: (NotEqual (CMPWconst [0] z:(MADDW a x y)))
15126 // cond: z.Uses == 1
15127 // result: (NotEqual (CMNW a (MULW <x.Type> x y)))
15129 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
15133 if z.Op != OpARM64MADDW {
15139 if !(z.Uses == 1) {
15142 v.reset(OpARM64NotEqual)
15143 v0 := b.NewValue0(v.Pos, OpARM64CMNW, types.TypeFlags)
15144 v1 := b.NewValue0(v.Pos, OpARM64MULW, x.Type)
15150 // match: (NotEqual (CMPWconst [0] z:(MSUBW a x y)))
15151 // cond: z.Uses == 1
15152 // result: (NotEqual (CMPW a (MULW <x.Type> x y)))
15154 if v_0.Op != OpARM64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
15158 if z.Op != OpARM64MSUBW {
15164 if !(z.Uses == 1) {
15167 v.reset(OpARM64NotEqual)
15168 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
15169 v1 := b.NewValue0(v.Pos, OpARM64MULW, x.Type)
15175 // match: (NotEqual (FlagConstant [fc]))
15176 // result: (MOVDconst [b2i(fc.ne())])
15178 if v_0.Op != OpARM64FlagConstant {
15181 fc := auxIntToFlagConstant(v_0.AuxInt)
15182 v.reset(OpARM64MOVDconst)
15183 v.AuxInt = int64ToAuxInt(b2i(fc.ne()))
15186 // match: (NotEqual (InvertFlags x))
15187 // result: (NotEqual x)
15189 if v_0.Op != OpARM64InvertFlags {
15193 v.reset(OpARM64NotEqual)
15199 func rewriteValueARM64_OpARM64OR(v *Value) bool {
15202 // match: (OR x (MOVDconst [c]))
15203 // result: (ORconst [c] x)
15205 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
15207 if v_1.Op != OpARM64MOVDconst {
15210 c := auxIntToInt64(v_1.AuxInt)
15211 v.reset(OpARM64ORconst)
15212 v.AuxInt = int64ToAuxInt(c)
15228 // match: (OR x (MVN y))
15229 // result: (ORN x y)
15231 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
15233 if v_1.Op != OpARM64MVN {
15237 v.reset(OpARM64ORN)
15243 // match: (OR x0 x1:(SLLconst [c] y))
15244 // cond: clobberIfDead(x1)
15245 // result: (ORshiftLL x0 y [c])
15247 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
15250 if x1.Op != OpARM64SLLconst {
15253 c := auxIntToInt64(x1.AuxInt)
15255 if !(clobberIfDead(x1)) {
15258 v.reset(OpARM64ORshiftLL)
15259 v.AuxInt = int64ToAuxInt(c)
15265 // match: (OR x0 x1:(SRLconst [c] y))
15266 // cond: clobberIfDead(x1)
15267 // result: (ORshiftRL x0 y [c])
15269 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
15272 if x1.Op != OpARM64SRLconst {
15275 c := auxIntToInt64(x1.AuxInt)
15277 if !(clobberIfDead(x1)) {
15280 v.reset(OpARM64ORshiftRL)
15281 v.AuxInt = int64ToAuxInt(c)
15287 // match: (OR x0 x1:(SRAconst [c] y))
15288 // cond: clobberIfDead(x1)
15289 // result: (ORshiftRA x0 y [c])
15291 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
15294 if x1.Op != OpARM64SRAconst {
15297 c := auxIntToInt64(x1.AuxInt)
15299 if !(clobberIfDead(x1)) {
15302 v.reset(OpARM64ORshiftRA)
15303 v.AuxInt = int64ToAuxInt(c)
15309 // match: (OR x0 x1:(RORconst [c] y))
15310 // cond: clobberIfDead(x1)
15311 // result: (ORshiftRO x0 y [c])
15313 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
15316 if x1.Op != OpARM64RORconst {
15319 c := auxIntToInt64(x1.AuxInt)
15321 if !(clobberIfDead(x1)) {
15324 v.reset(OpARM64ORshiftRO)
15325 v.AuxInt = int64ToAuxInt(c)
15331 // match: (OR (UBFIZ [bfc] x) (ANDconst [ac] y))
15332 // cond: ac == ^((1<<uint(bfc.getARM64BFwidth())-1) << uint(bfc.getARM64BFlsb()))
15333 // result: (BFI [bfc] y x)
15335 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
15336 if v_0.Op != OpARM64UBFIZ {
15339 bfc := auxIntToArm64BitField(v_0.AuxInt)
15341 if v_1.Op != OpARM64ANDconst {
15344 ac := auxIntToInt64(v_1.AuxInt)
15346 if !(ac == ^((1<<uint(bfc.getARM64BFwidth()) - 1) << uint(bfc.getARM64BFlsb()))) {
15349 v.reset(OpARM64BFI)
15350 v.AuxInt = arm64BitFieldToAuxInt(bfc)
15356 // match: (OR (UBFX [bfc] x) (ANDconst [ac] y))
15357 // cond: ac == ^(1<<uint(bfc.getARM64BFwidth())-1)
15358 // result: (BFXIL [bfc] y x)
15360 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
15361 if v_0.Op != OpARM64UBFX {
15364 bfc := auxIntToArm64BitField(v_0.AuxInt)
15366 if v_1.Op != OpARM64ANDconst {
15369 ac := auxIntToInt64(v_1.AuxInt)
15371 if !(ac == ^(1<<uint(bfc.getARM64BFwidth()) - 1)) {
15374 v.reset(OpARM64BFXIL)
15375 v.AuxInt = arm64BitFieldToAuxInt(bfc)
15383 func rewriteValueARM64_OpARM64ORN(v *Value) bool {
15386 // match: (ORN x (MOVDconst [c]))
15387 // result: (ORconst [^c] x)
15390 if v_1.Op != OpARM64MOVDconst {
15393 c := auxIntToInt64(v_1.AuxInt)
15394 v.reset(OpARM64ORconst)
15395 v.AuxInt = int64ToAuxInt(^c)
15399 // match: (ORN x x)
15400 // result: (MOVDconst [-1])
15406 v.reset(OpARM64MOVDconst)
15407 v.AuxInt = int64ToAuxInt(-1)
15410 // match: (ORN x0 x1:(SLLconst [c] y))
15411 // cond: clobberIfDead(x1)
15412 // result: (ORNshiftLL x0 y [c])
15416 if x1.Op != OpARM64SLLconst {
15419 c := auxIntToInt64(x1.AuxInt)
15421 if !(clobberIfDead(x1)) {
15424 v.reset(OpARM64ORNshiftLL)
15425 v.AuxInt = int64ToAuxInt(c)
15429 // match: (ORN x0 x1:(SRLconst [c] y))
15430 // cond: clobberIfDead(x1)
15431 // result: (ORNshiftRL x0 y [c])
15435 if x1.Op != OpARM64SRLconst {
15438 c := auxIntToInt64(x1.AuxInt)
15440 if !(clobberIfDead(x1)) {
15443 v.reset(OpARM64ORNshiftRL)
15444 v.AuxInt = int64ToAuxInt(c)
15448 // match: (ORN x0 x1:(SRAconst [c] y))
15449 // cond: clobberIfDead(x1)
15450 // result: (ORNshiftRA x0 y [c])
15454 if x1.Op != OpARM64SRAconst {
15457 c := auxIntToInt64(x1.AuxInt)
15459 if !(clobberIfDead(x1)) {
15462 v.reset(OpARM64ORNshiftRA)
15463 v.AuxInt = int64ToAuxInt(c)
15467 // match: (ORN x0 x1:(RORconst [c] y))
15468 // cond: clobberIfDead(x1)
15469 // result: (ORNshiftRO x0 y [c])
15473 if x1.Op != OpARM64RORconst {
15476 c := auxIntToInt64(x1.AuxInt)
15478 if !(clobberIfDead(x1)) {
15481 v.reset(OpARM64ORNshiftRO)
15482 v.AuxInt = int64ToAuxInt(c)
15488 func rewriteValueARM64_OpARM64ORNshiftLL(v *Value) bool {
15491 // match: (ORNshiftLL x (MOVDconst [c]) [d])
15492 // result: (ORconst x [^int64(uint64(c)<<uint64(d))])
15494 d := auxIntToInt64(v.AuxInt)
15496 if v_1.Op != OpARM64MOVDconst {
15499 c := auxIntToInt64(v_1.AuxInt)
15500 v.reset(OpARM64ORconst)
15501 v.AuxInt = int64ToAuxInt(^int64(uint64(c) << uint64(d)))
15505 // match: (ORNshiftLL (SLLconst x [c]) x [c])
15506 // result: (MOVDconst [-1])
15508 c := auxIntToInt64(v.AuxInt)
15509 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != c {
15516 v.reset(OpARM64MOVDconst)
15517 v.AuxInt = int64ToAuxInt(-1)
15522 func rewriteValueARM64_OpARM64ORNshiftRA(v *Value) bool {
15525 // match: (ORNshiftRA x (MOVDconst [c]) [d])
15526 // result: (ORconst x [^(c>>uint64(d))])
15528 d := auxIntToInt64(v.AuxInt)
15530 if v_1.Op != OpARM64MOVDconst {
15533 c := auxIntToInt64(v_1.AuxInt)
15534 v.reset(OpARM64ORconst)
15535 v.AuxInt = int64ToAuxInt(^(c >> uint64(d)))
15539 // match: (ORNshiftRA (SRAconst x [c]) x [c])
15540 // result: (MOVDconst [-1])
15542 c := auxIntToInt64(v.AuxInt)
15543 if v_0.Op != OpARM64SRAconst || auxIntToInt64(v_0.AuxInt) != c {
15550 v.reset(OpARM64MOVDconst)
15551 v.AuxInt = int64ToAuxInt(-1)
15556 func rewriteValueARM64_OpARM64ORNshiftRL(v *Value) bool {
15559 // match: (ORNshiftRL x (MOVDconst [c]) [d])
15560 // result: (ORconst x [^int64(uint64(c)>>uint64(d))])
15562 d := auxIntToInt64(v.AuxInt)
15564 if v_1.Op != OpARM64MOVDconst {
15567 c := auxIntToInt64(v_1.AuxInt)
15568 v.reset(OpARM64ORconst)
15569 v.AuxInt = int64ToAuxInt(^int64(uint64(c) >> uint64(d)))
15573 // match: (ORNshiftRL (SRLconst x [c]) x [c])
15574 // result: (MOVDconst [-1])
15576 c := auxIntToInt64(v.AuxInt)
15577 if v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != c {
15584 v.reset(OpARM64MOVDconst)
15585 v.AuxInt = int64ToAuxInt(-1)
15590 func rewriteValueARM64_OpARM64ORNshiftRO(v *Value) bool {
15593 // match: (ORNshiftRO x (MOVDconst [c]) [d])
15594 // result: (ORconst x [^rotateRight64(c, d)])
15596 d := auxIntToInt64(v.AuxInt)
15598 if v_1.Op != OpARM64MOVDconst {
15601 c := auxIntToInt64(v_1.AuxInt)
15602 v.reset(OpARM64ORconst)
15603 v.AuxInt = int64ToAuxInt(^rotateRight64(c, d))
15607 // match: (ORNshiftRO (RORconst x [c]) x [c])
15608 // result: (MOVDconst [-1])
15610 c := auxIntToInt64(v.AuxInt)
15611 if v_0.Op != OpARM64RORconst || auxIntToInt64(v_0.AuxInt) != c {
15618 v.reset(OpARM64MOVDconst)
15619 v.AuxInt = int64ToAuxInt(-1)
15624 func rewriteValueARM64_OpARM64ORconst(v *Value) bool {
15626 // match: (ORconst [0] x)
15629 if auxIntToInt64(v.AuxInt) != 0 {
15636 // match: (ORconst [-1] _)
15637 // result: (MOVDconst [-1])
15639 if auxIntToInt64(v.AuxInt) != -1 {
15642 v.reset(OpARM64MOVDconst)
15643 v.AuxInt = int64ToAuxInt(-1)
15646 // match: (ORconst [c] (MOVDconst [d]))
15647 // result: (MOVDconst [c|d])
15649 c := auxIntToInt64(v.AuxInt)
15650 if v_0.Op != OpARM64MOVDconst {
15653 d := auxIntToInt64(v_0.AuxInt)
15654 v.reset(OpARM64MOVDconst)
15655 v.AuxInt = int64ToAuxInt(c | d)
15658 // match: (ORconst [c] (ORconst [d] x))
15659 // result: (ORconst [c|d] x)
15661 c := auxIntToInt64(v.AuxInt)
15662 if v_0.Op != OpARM64ORconst {
15665 d := auxIntToInt64(v_0.AuxInt)
15667 v.reset(OpARM64ORconst)
15668 v.AuxInt = int64ToAuxInt(c | d)
15672 // match: (ORconst [c1] (ANDconst [c2] x))
15673 // cond: c2|c1 == ^0
15674 // result: (ORconst [c1] x)
15676 c1 := auxIntToInt64(v.AuxInt)
15677 if v_0.Op != OpARM64ANDconst {
15680 c2 := auxIntToInt64(v_0.AuxInt)
15682 if !(c2|c1 == ^0) {
15685 v.reset(OpARM64ORconst)
15686 v.AuxInt = int64ToAuxInt(c1)
15692 func rewriteValueARM64_OpARM64ORshiftLL(v *Value) bool {
15696 typ := &b.Func.Config.Types
15697 // match: (ORshiftLL (MOVDconst [c]) x [d])
15698 // result: (ORconst [c] (SLLconst <x.Type> x [d]))
15700 d := auxIntToInt64(v.AuxInt)
15701 if v_0.Op != OpARM64MOVDconst {
15704 c := auxIntToInt64(v_0.AuxInt)
15706 v.reset(OpARM64ORconst)
15707 v.AuxInt = int64ToAuxInt(c)
15708 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
15709 v0.AuxInt = int64ToAuxInt(d)
15714 // match: (ORshiftLL x (MOVDconst [c]) [d])
15715 // result: (ORconst x [int64(uint64(c)<<uint64(d))])
15717 d := auxIntToInt64(v.AuxInt)
15719 if v_1.Op != OpARM64MOVDconst {
15722 c := auxIntToInt64(v_1.AuxInt)
15723 v.reset(OpARM64ORconst)
15724 v.AuxInt = int64ToAuxInt(int64(uint64(c) << uint64(d)))
15728 // match: (ORshiftLL y:(SLLconst x [c]) x [c])
15731 c := auxIntToInt64(v.AuxInt)
15733 if y.Op != OpARM64SLLconst || auxIntToInt64(y.AuxInt) != c {
15743 // match: (ORshiftLL <typ.UInt16> [8] (UBFX <typ.UInt16> [armBFAuxInt(8, 8)] x) x)
15744 // result: (REV16W x)
15746 if v.Type != typ.UInt16 || auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64UBFX || v_0.Type != typ.UInt16 || auxIntToArm64BitField(v_0.AuxInt) != armBFAuxInt(8, 8) {
15753 v.reset(OpARM64REV16W)
15757 // match: (ORshiftLL [8] (UBFX [armBFAuxInt(8, 24)] (ANDconst [c1] x)) (ANDconst [c2] x))
15758 // cond: uint32(c1) == 0xff00ff00 && uint32(c2) == 0x00ff00ff
15759 // result: (REV16W x)
15761 if auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64UBFX || auxIntToArm64BitField(v_0.AuxInt) != armBFAuxInt(8, 24) {
15764 v_0_0 := v_0.Args[0]
15765 if v_0_0.Op != OpARM64ANDconst {
15768 c1 := auxIntToInt64(v_0_0.AuxInt)
15770 if v_1.Op != OpARM64ANDconst {
15773 c2 := auxIntToInt64(v_1.AuxInt)
15774 if x != v_1.Args[0] || !(uint32(c1) == 0xff00ff00 && uint32(c2) == 0x00ff00ff) {
15777 v.reset(OpARM64REV16W)
15781 // match: (ORshiftLL [8] (SRLconst [8] (ANDconst [c1] x)) (ANDconst [c2] x))
15782 // cond: (uint64(c1) == 0xff00ff00ff00ff00 && uint64(c2) == 0x00ff00ff00ff00ff)
15783 // result: (REV16 x)
15785 if auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != 8 {
15788 v_0_0 := v_0.Args[0]
15789 if v_0_0.Op != OpARM64ANDconst {
15792 c1 := auxIntToInt64(v_0_0.AuxInt)
15794 if v_1.Op != OpARM64ANDconst {
15797 c2 := auxIntToInt64(v_1.AuxInt)
15798 if x != v_1.Args[0] || !(uint64(c1) == 0xff00ff00ff00ff00 && uint64(c2) == 0x00ff00ff00ff00ff) {
15801 v.reset(OpARM64REV16)
15805 // match: (ORshiftLL [8] (SRLconst [8] (ANDconst [c1] x)) (ANDconst [c2] x))
15806 // cond: (uint64(c1) == 0xff00ff00 && uint64(c2) == 0x00ff00ff)
15807 // result: (REV16 (ANDconst <x.Type> [0xffffffff] x))
15809 if auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != 8 {
15812 v_0_0 := v_0.Args[0]
15813 if v_0_0.Op != OpARM64ANDconst {
15816 c1 := auxIntToInt64(v_0_0.AuxInt)
15818 if v_1.Op != OpARM64ANDconst {
15821 c2 := auxIntToInt64(v_1.AuxInt)
15822 if x != v_1.Args[0] || !(uint64(c1) == 0xff00ff00 && uint64(c2) == 0x00ff00ff) {
15825 v.reset(OpARM64REV16)
15826 v0 := b.NewValue0(v.Pos, OpARM64ANDconst, x.Type)
15827 v0.AuxInt = int64ToAuxInt(0xffffffff)
15832 // match: ( ORshiftLL [c] (SRLconst x [64-c]) x2)
15833 // result: (EXTRconst [64-c] x2 x)
15835 c := auxIntToInt64(v.AuxInt)
15836 if v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != 64-c {
15841 v.reset(OpARM64EXTRconst)
15842 v.AuxInt = int64ToAuxInt(64 - c)
15846 // match: ( ORshiftLL <t> [c] (UBFX [bfc] x) x2)
15847 // cond: c < 32 && t.Size() == 4 && bfc == armBFAuxInt(32-c, c)
15848 // result: (EXTRWconst [32-c] x2 x)
15851 c := auxIntToInt64(v.AuxInt)
15852 if v_0.Op != OpARM64UBFX {
15855 bfc := auxIntToArm64BitField(v_0.AuxInt)
15858 if !(c < 32 && t.Size() == 4 && bfc == armBFAuxInt(32-c, c)) {
15861 v.reset(OpARM64EXTRWconst)
15862 v.AuxInt = int64ToAuxInt(32 - c)
15866 // match: (ORshiftLL [sc] (UBFX [bfc] x) (SRLconst [sc] y))
15867 // cond: sc == bfc.getARM64BFwidth()
15868 // result: (BFXIL [bfc] y x)
15870 sc := auxIntToInt64(v.AuxInt)
15871 if v_0.Op != OpARM64UBFX {
15874 bfc := auxIntToArm64BitField(v_0.AuxInt)
15876 if v_1.Op != OpARM64SRLconst || auxIntToInt64(v_1.AuxInt) != sc {
15880 if !(sc == bfc.getARM64BFwidth()) {
15883 v.reset(OpARM64BFXIL)
15884 v.AuxInt = arm64BitFieldToAuxInt(bfc)
15890 func rewriteValueARM64_OpARM64ORshiftRA(v *Value) bool {
15894 // match: (ORshiftRA (MOVDconst [c]) x [d])
15895 // result: (ORconst [c] (SRAconst <x.Type> x [d]))
15897 d := auxIntToInt64(v.AuxInt)
15898 if v_0.Op != OpARM64MOVDconst {
15901 c := auxIntToInt64(v_0.AuxInt)
15903 v.reset(OpARM64ORconst)
15904 v.AuxInt = int64ToAuxInt(c)
15905 v0 := b.NewValue0(v.Pos, OpARM64SRAconst, x.Type)
15906 v0.AuxInt = int64ToAuxInt(d)
15911 // match: (ORshiftRA x (MOVDconst [c]) [d])
15912 // result: (ORconst x [c>>uint64(d)])
15914 d := auxIntToInt64(v.AuxInt)
15916 if v_1.Op != OpARM64MOVDconst {
15919 c := auxIntToInt64(v_1.AuxInt)
15920 v.reset(OpARM64ORconst)
15921 v.AuxInt = int64ToAuxInt(c >> uint64(d))
15925 // match: (ORshiftRA y:(SRAconst x [c]) x [c])
15928 c := auxIntToInt64(v.AuxInt)
15930 if y.Op != OpARM64SRAconst || auxIntToInt64(y.AuxInt) != c {
15942 func rewriteValueARM64_OpARM64ORshiftRL(v *Value) bool {
15946 // match: (ORshiftRL (MOVDconst [c]) x [d])
15947 // result: (ORconst [c] (SRLconst <x.Type> x [d]))
15949 d := auxIntToInt64(v.AuxInt)
15950 if v_0.Op != OpARM64MOVDconst {
15953 c := auxIntToInt64(v_0.AuxInt)
15955 v.reset(OpARM64ORconst)
15956 v.AuxInt = int64ToAuxInt(c)
15957 v0 := b.NewValue0(v.Pos, OpARM64SRLconst, x.Type)
15958 v0.AuxInt = int64ToAuxInt(d)
15963 // match: (ORshiftRL x (MOVDconst [c]) [d])
15964 // result: (ORconst x [int64(uint64(c)>>uint64(d))])
15966 d := auxIntToInt64(v.AuxInt)
15968 if v_1.Op != OpARM64MOVDconst {
15971 c := auxIntToInt64(v_1.AuxInt)
15972 v.reset(OpARM64ORconst)
15973 v.AuxInt = int64ToAuxInt(int64(uint64(c) >> uint64(d)))
15977 // match: (ORshiftRL y:(SRLconst x [c]) x [c])
15980 c := auxIntToInt64(v.AuxInt)
15982 if y.Op != OpARM64SRLconst || auxIntToInt64(y.AuxInt) != c {
15992 // match: (ORshiftRL [rc] (ANDconst [ac] x) (SLLconst [lc] y))
15993 // cond: lc > rc && ac == ^((1<<uint(64-lc)-1) << uint64(lc-rc))
15994 // result: (BFI [armBFAuxInt(lc-rc, 64-lc)] x y)
15996 rc := auxIntToInt64(v.AuxInt)
15997 if v_0.Op != OpARM64ANDconst {
16000 ac := auxIntToInt64(v_0.AuxInt)
16002 if v_1.Op != OpARM64SLLconst {
16005 lc := auxIntToInt64(v_1.AuxInt)
16007 if !(lc > rc && ac == ^((1<<uint(64-lc)-1)<<uint64(lc-rc))) {
16010 v.reset(OpARM64BFI)
16011 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc-rc, 64-lc))
16015 // match: (ORshiftRL [rc] (ANDconst [ac] y) (SLLconst [lc] x))
16016 // cond: lc < rc && ac == ^((1<<uint(64-rc)-1))
16017 // result: (BFXIL [armBFAuxInt(rc-lc, 64-rc)] y x)
16019 rc := auxIntToInt64(v.AuxInt)
16020 if v_0.Op != OpARM64ANDconst {
16023 ac := auxIntToInt64(v_0.AuxInt)
16025 if v_1.Op != OpARM64SLLconst {
16028 lc := auxIntToInt64(v_1.AuxInt)
16030 if !(lc < rc && ac == ^(1<<uint(64-rc)-1)) {
16033 v.reset(OpARM64BFXIL)
16034 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc-lc, 64-rc))
16040 func rewriteValueARM64_OpARM64ORshiftRO(v *Value) bool {
16044 // match: (ORshiftRO (MOVDconst [c]) x [d])
16045 // result: (ORconst [c] (RORconst <x.Type> x [d]))
16047 d := auxIntToInt64(v.AuxInt)
16048 if v_0.Op != OpARM64MOVDconst {
16051 c := auxIntToInt64(v_0.AuxInt)
16053 v.reset(OpARM64ORconst)
16054 v.AuxInt = int64ToAuxInt(c)
16055 v0 := b.NewValue0(v.Pos, OpARM64RORconst, x.Type)
16056 v0.AuxInt = int64ToAuxInt(d)
16061 // match: (ORshiftRO x (MOVDconst [c]) [d])
16062 // result: (ORconst x [rotateRight64(c, d)])
16064 d := auxIntToInt64(v.AuxInt)
16066 if v_1.Op != OpARM64MOVDconst {
16069 c := auxIntToInt64(v_1.AuxInt)
16070 v.reset(OpARM64ORconst)
16071 v.AuxInt = int64ToAuxInt(rotateRight64(c, d))
16075 // match: (ORshiftRO y:(RORconst x [c]) x [c])
16078 c := auxIntToInt64(v.AuxInt)
16080 if y.Op != OpARM64RORconst || auxIntToInt64(y.AuxInt) != c {
16092 func rewriteValueARM64_OpARM64REV(v *Value) bool {
16094 // match: (REV (REV p))
16097 if v_0.Op != OpARM64REV {
16106 func rewriteValueARM64_OpARM64REVW(v *Value) bool {
16108 // match: (REVW (REVW p))
16111 if v_0.Op != OpARM64REVW {
16120 func rewriteValueARM64_OpARM64ROR(v *Value) bool {
16123 // match: (ROR x (MOVDconst [c]))
16124 // result: (RORconst x [c&63])
16127 if v_1.Op != OpARM64MOVDconst {
16130 c := auxIntToInt64(v_1.AuxInt)
16131 v.reset(OpARM64RORconst)
16132 v.AuxInt = int64ToAuxInt(c & 63)
16138 func rewriteValueARM64_OpARM64RORW(v *Value) bool {
16141 // match: (RORW x (MOVDconst [c]))
16142 // result: (RORWconst x [c&31])
16145 if v_1.Op != OpARM64MOVDconst {
16148 c := auxIntToInt64(v_1.AuxInt)
16149 v.reset(OpARM64RORWconst)
16150 v.AuxInt = int64ToAuxInt(c & 31)
16156 func rewriteValueARM64_OpARM64SBCSflags(v *Value) bool {
16161 typ := &b.Func.Config.Types
16162 // match: (SBCSflags x y (Select1 <types.TypeFlags> (NEGSflags (NEG <typ.UInt64> (NGCzerocarry <typ.UInt64> bo)))))
16163 // result: (SBCSflags x y bo)
16167 if v_2.Op != OpSelect1 || v_2.Type != types.TypeFlags {
16170 v_2_0 := v_2.Args[0]
16171 if v_2_0.Op != OpARM64NEGSflags {
16174 v_2_0_0 := v_2_0.Args[0]
16175 if v_2_0_0.Op != OpARM64NEG || v_2_0_0.Type != typ.UInt64 {
16178 v_2_0_0_0 := v_2_0_0.Args[0]
16179 if v_2_0_0_0.Op != OpARM64NGCzerocarry || v_2_0_0_0.Type != typ.UInt64 {
16182 bo := v_2_0_0_0.Args[0]
16183 v.reset(OpARM64SBCSflags)
16184 v.AddArg3(x, y, bo)
16187 // match: (SBCSflags x y (Select1 <types.TypeFlags> (NEGSflags (MOVDconst [0]))))
16188 // result: (SUBSflags x y)
16192 if v_2.Op != OpSelect1 || v_2.Type != types.TypeFlags {
16195 v_2_0 := v_2.Args[0]
16196 if v_2_0.Op != OpARM64NEGSflags {
16199 v_2_0_0 := v_2_0.Args[0]
16200 if v_2_0_0.Op != OpARM64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
16203 v.reset(OpARM64SUBSflags)
16209 func rewriteValueARM64_OpARM64SLL(v *Value) bool {
16212 // match: (SLL x (MOVDconst [c]))
16213 // result: (SLLconst x [c&63])
16216 if v_1.Op != OpARM64MOVDconst {
16219 c := auxIntToInt64(v_1.AuxInt)
16220 v.reset(OpARM64SLLconst)
16221 v.AuxInt = int64ToAuxInt(c & 63)
16225 // match: (SLL x (ANDconst [63] y))
16226 // result: (SLL x y)
16229 if v_1.Op != OpARM64ANDconst || auxIntToInt64(v_1.AuxInt) != 63 {
16233 v.reset(OpARM64SLL)
16239 func rewriteValueARM64_OpARM64SLLconst(v *Value) bool {
16241 // match: (SLLconst [c] (MOVDconst [d]))
16242 // result: (MOVDconst [d<<uint64(c)])
16244 c := auxIntToInt64(v.AuxInt)
16245 if v_0.Op != OpARM64MOVDconst {
16248 d := auxIntToInt64(v_0.AuxInt)
16249 v.reset(OpARM64MOVDconst)
16250 v.AuxInt = int64ToAuxInt(d << uint64(c))
16253 // match: (SLLconst [c] (SRLconst [c] x))
16254 // cond: 0 < c && c < 64
16255 // result: (ANDconst [^(1<<uint(c)-1)] x)
16257 c := auxIntToInt64(v.AuxInt)
16258 if v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != c {
16262 if !(0 < c && c < 64) {
16265 v.reset(OpARM64ANDconst)
16266 v.AuxInt = int64ToAuxInt(^(1<<uint(c) - 1))
16270 // match: (SLLconst [lc] (MOVWreg x))
16271 // result: (SBFIZ [armBFAuxInt(lc, min(32, 64-lc))] x)
16273 lc := auxIntToInt64(v.AuxInt)
16274 if v_0.Op != OpARM64MOVWreg {
16278 v.reset(OpARM64SBFIZ)
16279 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, min(32, 64-lc)))
16283 // match: (SLLconst [lc] (MOVHreg x))
16284 // result: (SBFIZ [armBFAuxInt(lc, min(16, 64-lc))] x)
16286 lc := auxIntToInt64(v.AuxInt)
16287 if v_0.Op != OpARM64MOVHreg {
16291 v.reset(OpARM64SBFIZ)
16292 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, min(16, 64-lc)))
16296 // match: (SLLconst [lc] (MOVBreg x))
16297 // result: (SBFIZ [armBFAuxInt(lc, min(8, 64-lc))] x)
16299 lc := auxIntToInt64(v.AuxInt)
16300 if v_0.Op != OpARM64MOVBreg {
16304 v.reset(OpARM64SBFIZ)
16305 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, min(8, 64-lc)))
16309 // match: (SLLconst [lc] (MOVWUreg x))
16310 // result: (UBFIZ [armBFAuxInt(lc, min(32, 64-lc))] x)
16312 lc := auxIntToInt64(v.AuxInt)
16313 if v_0.Op != OpARM64MOVWUreg {
16317 v.reset(OpARM64UBFIZ)
16318 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, min(32, 64-lc)))
16322 // match: (SLLconst [lc] (MOVHUreg x))
16323 // result: (UBFIZ [armBFAuxInt(lc, min(16, 64-lc))] x)
16325 lc := auxIntToInt64(v.AuxInt)
16326 if v_0.Op != OpARM64MOVHUreg {
16330 v.reset(OpARM64UBFIZ)
16331 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, min(16, 64-lc)))
16335 // match: (SLLconst [lc] (MOVBUreg x))
16336 // result: (UBFIZ [armBFAuxInt(lc, min(8, 64-lc))] x)
16338 lc := auxIntToInt64(v.AuxInt)
16339 if v_0.Op != OpARM64MOVBUreg {
16343 v.reset(OpARM64UBFIZ)
16344 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc, min(8, 64-lc)))
16348 // match: (SLLconst [sc] (ANDconst [ac] x))
16349 // cond: isARM64BFMask(sc, ac, 0)
16350 // result: (UBFIZ [armBFAuxInt(sc, arm64BFWidth(ac, 0))] x)
16352 sc := auxIntToInt64(v.AuxInt)
16353 if v_0.Op != OpARM64ANDconst {
16356 ac := auxIntToInt64(v_0.AuxInt)
16358 if !(isARM64BFMask(sc, ac, 0)) {
16361 v.reset(OpARM64UBFIZ)
16362 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(sc, arm64BFWidth(ac, 0)))
16366 // match: (SLLconst [sc] (UBFIZ [bfc] x))
16367 // cond: sc+bfc.getARM64BFwidth()+bfc.getARM64BFlsb() < 64
16368 // result: (UBFIZ [armBFAuxInt(bfc.getARM64BFlsb()+sc, bfc.getARM64BFwidth())] x)
16370 sc := auxIntToInt64(v.AuxInt)
16371 if v_0.Op != OpARM64UBFIZ {
16374 bfc := auxIntToArm64BitField(v_0.AuxInt)
16376 if !(sc+bfc.getARM64BFwidth()+bfc.getARM64BFlsb() < 64) {
16379 v.reset(OpARM64UBFIZ)
16380 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(bfc.getARM64BFlsb()+sc, bfc.getARM64BFwidth()))
16386 func rewriteValueARM64_OpARM64SRA(v *Value) bool {
16389 // match: (SRA x (MOVDconst [c]))
16390 // result: (SRAconst x [c&63])
16393 if v_1.Op != OpARM64MOVDconst {
16396 c := auxIntToInt64(v_1.AuxInt)
16397 v.reset(OpARM64SRAconst)
16398 v.AuxInt = int64ToAuxInt(c & 63)
16402 // match: (SRA x (ANDconst [63] y))
16403 // result: (SRA x y)
16406 if v_1.Op != OpARM64ANDconst || auxIntToInt64(v_1.AuxInt) != 63 {
16410 v.reset(OpARM64SRA)
16416 func rewriteValueARM64_OpARM64SRAconst(v *Value) bool {
16418 // match: (SRAconst [c] (MOVDconst [d]))
16419 // result: (MOVDconst [d>>uint64(c)])
16421 c := auxIntToInt64(v.AuxInt)
16422 if v_0.Op != OpARM64MOVDconst {
16425 d := auxIntToInt64(v_0.AuxInt)
16426 v.reset(OpARM64MOVDconst)
16427 v.AuxInt = int64ToAuxInt(d >> uint64(c))
16430 // match: (SRAconst [rc] (SLLconst [lc] x))
16432 // result: (SBFIZ [armBFAuxInt(lc-rc, 64-lc)] x)
16434 rc := auxIntToInt64(v.AuxInt)
16435 if v_0.Op != OpARM64SLLconst {
16438 lc := auxIntToInt64(v_0.AuxInt)
16443 v.reset(OpARM64SBFIZ)
16444 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc-rc, 64-lc))
16448 // match: (SRAconst [rc] (SLLconst [lc] x))
16450 // result: (SBFX [armBFAuxInt(rc-lc, 64-rc)] x)
16452 rc := auxIntToInt64(v.AuxInt)
16453 if v_0.Op != OpARM64SLLconst {
16456 lc := auxIntToInt64(v_0.AuxInt)
16461 v.reset(OpARM64SBFX)
16462 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc-lc, 64-rc))
16466 // match: (SRAconst [rc] (MOVWreg x))
16468 // result: (SBFX [armBFAuxInt(rc, 32-rc)] x)
16470 rc := auxIntToInt64(v.AuxInt)
16471 if v_0.Op != OpARM64MOVWreg {
16478 v.reset(OpARM64SBFX)
16479 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc, 32-rc))
16483 // match: (SRAconst [rc] (MOVHreg x))
16485 // result: (SBFX [armBFAuxInt(rc, 16-rc)] x)
16487 rc := auxIntToInt64(v.AuxInt)
16488 if v_0.Op != OpARM64MOVHreg {
16495 v.reset(OpARM64SBFX)
16496 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc, 16-rc))
16500 // match: (SRAconst [rc] (MOVBreg x))
16502 // result: (SBFX [armBFAuxInt(rc, 8-rc)] x)
16504 rc := auxIntToInt64(v.AuxInt)
16505 if v_0.Op != OpARM64MOVBreg {
16512 v.reset(OpARM64SBFX)
16513 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc, 8-rc))
16517 // match: (SRAconst [sc] (SBFIZ [bfc] x))
16518 // cond: sc < bfc.getARM64BFlsb()
16519 // result: (SBFIZ [armBFAuxInt(bfc.getARM64BFlsb()-sc, bfc.getARM64BFwidth())] x)
16521 sc := auxIntToInt64(v.AuxInt)
16522 if v_0.Op != OpARM64SBFIZ {
16525 bfc := auxIntToArm64BitField(v_0.AuxInt)
16527 if !(sc < bfc.getARM64BFlsb()) {
16530 v.reset(OpARM64SBFIZ)
16531 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(bfc.getARM64BFlsb()-sc, bfc.getARM64BFwidth()))
16535 // match: (SRAconst [sc] (SBFIZ [bfc] x))
16536 // cond: sc >= bfc.getARM64BFlsb() && sc < bfc.getARM64BFlsb()+bfc.getARM64BFwidth()
16537 // result: (SBFX [armBFAuxInt(sc-bfc.getARM64BFlsb(), bfc.getARM64BFlsb()+bfc.getARM64BFwidth()-sc)] x)
16539 sc := auxIntToInt64(v.AuxInt)
16540 if v_0.Op != OpARM64SBFIZ {
16543 bfc := auxIntToArm64BitField(v_0.AuxInt)
16545 if !(sc >= bfc.getARM64BFlsb() && sc < bfc.getARM64BFlsb()+bfc.getARM64BFwidth()) {
16548 v.reset(OpARM64SBFX)
16549 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(sc-bfc.getARM64BFlsb(), bfc.getARM64BFlsb()+bfc.getARM64BFwidth()-sc))
16555 func rewriteValueARM64_OpARM64SRL(v *Value) bool {
16558 // match: (SRL x (MOVDconst [c]))
16559 // result: (SRLconst x [c&63])
16562 if v_1.Op != OpARM64MOVDconst {
16565 c := auxIntToInt64(v_1.AuxInt)
16566 v.reset(OpARM64SRLconst)
16567 v.AuxInt = int64ToAuxInt(c & 63)
16571 // match: (SRL x (ANDconst [63] y))
16572 // result: (SRL x y)
16575 if v_1.Op != OpARM64ANDconst || auxIntToInt64(v_1.AuxInt) != 63 {
16579 v.reset(OpARM64SRL)
16585 func rewriteValueARM64_OpARM64SRLconst(v *Value) bool {
16587 // match: (SRLconst [c] (MOVDconst [d]))
16588 // result: (MOVDconst [int64(uint64(d)>>uint64(c))])
16590 c := auxIntToInt64(v.AuxInt)
16591 if v_0.Op != OpARM64MOVDconst {
16594 d := auxIntToInt64(v_0.AuxInt)
16595 v.reset(OpARM64MOVDconst)
16596 v.AuxInt = int64ToAuxInt(int64(uint64(d) >> uint64(c)))
16599 // match: (SRLconst [c] (SLLconst [c] x))
16600 // cond: 0 < c && c < 64
16601 // result: (ANDconst [1<<uint(64-c)-1] x)
16603 c := auxIntToInt64(v.AuxInt)
16604 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != c {
16608 if !(0 < c && c < 64) {
16611 v.reset(OpARM64ANDconst)
16612 v.AuxInt = int64ToAuxInt(1<<uint(64-c) - 1)
16616 // match: (SRLconst [rc] (MOVWUreg x))
16618 // result: (MOVDconst [0])
16620 rc := auxIntToInt64(v.AuxInt)
16621 if v_0.Op != OpARM64MOVWUreg {
16627 v.reset(OpARM64MOVDconst)
16628 v.AuxInt = int64ToAuxInt(0)
16631 // match: (SRLconst [rc] (MOVHUreg x))
16633 // result: (MOVDconst [0])
16635 rc := auxIntToInt64(v.AuxInt)
16636 if v_0.Op != OpARM64MOVHUreg {
16642 v.reset(OpARM64MOVDconst)
16643 v.AuxInt = int64ToAuxInt(0)
16646 // match: (SRLconst [rc] (MOVBUreg x))
16648 // result: (MOVDconst [0])
16650 rc := auxIntToInt64(v.AuxInt)
16651 if v_0.Op != OpARM64MOVBUreg {
16657 v.reset(OpARM64MOVDconst)
16658 v.AuxInt = int64ToAuxInt(0)
16661 // match: (SRLconst [rc] (SLLconst [lc] x))
16663 // result: (UBFIZ [armBFAuxInt(lc-rc, 64-lc)] x)
16665 rc := auxIntToInt64(v.AuxInt)
16666 if v_0.Op != OpARM64SLLconst {
16669 lc := auxIntToInt64(v_0.AuxInt)
16674 v.reset(OpARM64UBFIZ)
16675 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(lc-rc, 64-lc))
16679 // match: (SRLconst [rc] (SLLconst [lc] x))
16681 // result: (UBFX [armBFAuxInt(rc-lc, 64-rc)] x)
16683 rc := auxIntToInt64(v.AuxInt)
16684 if v_0.Op != OpARM64SLLconst {
16687 lc := auxIntToInt64(v_0.AuxInt)
16692 v.reset(OpARM64UBFX)
16693 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc-lc, 64-rc))
16697 // match: (SRLconst [rc] (MOVWUreg x))
16699 // result: (UBFX [armBFAuxInt(rc, 32-rc)] x)
16701 rc := auxIntToInt64(v.AuxInt)
16702 if v_0.Op != OpARM64MOVWUreg {
16709 v.reset(OpARM64UBFX)
16710 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc, 32-rc))
16714 // match: (SRLconst [rc] (MOVHUreg x))
16716 // result: (UBFX [armBFAuxInt(rc, 16-rc)] x)
16718 rc := auxIntToInt64(v.AuxInt)
16719 if v_0.Op != OpARM64MOVHUreg {
16726 v.reset(OpARM64UBFX)
16727 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc, 16-rc))
16731 // match: (SRLconst [rc] (MOVBUreg x))
16733 // result: (UBFX [armBFAuxInt(rc, 8-rc)] x)
16735 rc := auxIntToInt64(v.AuxInt)
16736 if v_0.Op != OpARM64MOVBUreg {
16743 v.reset(OpARM64UBFX)
16744 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(rc, 8-rc))
16748 // match: (SRLconst [sc] (ANDconst [ac] x))
16749 // cond: isARM64BFMask(sc, ac, sc)
16750 // result: (UBFX [armBFAuxInt(sc, arm64BFWidth(ac, sc))] x)
16752 sc := auxIntToInt64(v.AuxInt)
16753 if v_0.Op != OpARM64ANDconst {
16756 ac := auxIntToInt64(v_0.AuxInt)
16758 if !(isARM64BFMask(sc, ac, sc)) {
16761 v.reset(OpARM64UBFX)
16762 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(sc, arm64BFWidth(ac, sc)))
16766 // match: (SRLconst [sc] (UBFX [bfc] x))
16767 // cond: sc < bfc.getARM64BFwidth()
16768 // result: (UBFX [armBFAuxInt(bfc.getARM64BFlsb()+sc, bfc.getARM64BFwidth()-sc)] x)
16770 sc := auxIntToInt64(v.AuxInt)
16771 if v_0.Op != OpARM64UBFX {
16774 bfc := auxIntToArm64BitField(v_0.AuxInt)
16776 if !(sc < bfc.getARM64BFwidth()) {
16779 v.reset(OpARM64UBFX)
16780 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(bfc.getARM64BFlsb()+sc, bfc.getARM64BFwidth()-sc))
16784 // match: (SRLconst [sc] (UBFIZ [bfc] x))
16785 // cond: sc == bfc.getARM64BFlsb()
16786 // result: (ANDconst [1<<uint(bfc.getARM64BFwidth())-1] x)
16788 sc := auxIntToInt64(v.AuxInt)
16789 if v_0.Op != OpARM64UBFIZ {
16792 bfc := auxIntToArm64BitField(v_0.AuxInt)
16794 if !(sc == bfc.getARM64BFlsb()) {
16797 v.reset(OpARM64ANDconst)
16798 v.AuxInt = int64ToAuxInt(1<<uint(bfc.getARM64BFwidth()) - 1)
16802 // match: (SRLconst [sc] (UBFIZ [bfc] x))
16803 // cond: sc < bfc.getARM64BFlsb()
16804 // result: (UBFIZ [armBFAuxInt(bfc.getARM64BFlsb()-sc, bfc.getARM64BFwidth())] x)
16806 sc := auxIntToInt64(v.AuxInt)
16807 if v_0.Op != OpARM64UBFIZ {
16810 bfc := auxIntToArm64BitField(v_0.AuxInt)
16812 if !(sc < bfc.getARM64BFlsb()) {
16815 v.reset(OpARM64UBFIZ)
16816 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(bfc.getARM64BFlsb()-sc, bfc.getARM64BFwidth()))
16820 // match: (SRLconst [sc] (UBFIZ [bfc] x))
16821 // cond: sc > bfc.getARM64BFlsb() && sc < bfc.getARM64BFlsb()+bfc.getARM64BFwidth()
16822 // result: (UBFX [armBFAuxInt(sc-bfc.getARM64BFlsb(), bfc.getARM64BFlsb()+bfc.getARM64BFwidth()-sc)] x)
16824 sc := auxIntToInt64(v.AuxInt)
16825 if v_0.Op != OpARM64UBFIZ {
16828 bfc := auxIntToArm64BitField(v_0.AuxInt)
16830 if !(sc > bfc.getARM64BFlsb() && sc < bfc.getARM64BFlsb()+bfc.getARM64BFwidth()) {
16833 v.reset(OpARM64UBFX)
16834 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(sc-bfc.getARM64BFlsb(), bfc.getARM64BFlsb()+bfc.getARM64BFwidth()-sc))
16840 func rewriteValueARM64_OpARM64STP(v *Value) bool {
16846 config := b.Func.Config
16847 // match: (STP [off1] {sym} (ADDconst [off2] ptr) val1 val2 mem)
16848 // cond: is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
16849 // result: (STP [off1+int32(off2)] {sym} ptr val1 val2 mem)
16851 off1 := auxIntToInt32(v.AuxInt)
16852 sym := auxToSym(v.Aux)
16853 if v_0.Op != OpARM64ADDconst {
16856 off2 := auxIntToInt64(v_0.AuxInt)
16861 if !(is32Bit(int64(off1)+off2) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
16864 v.reset(OpARM64STP)
16865 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
16866 v.Aux = symToAux(sym)
16867 v.AddArg4(ptr, val1, val2, mem)
16870 // match: (STP [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) val1 val2 mem)
16871 // cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)
16872 // result: (STP [off1+off2] {mergeSym(sym1,sym2)} ptr val1 val2 mem)
16874 off1 := auxIntToInt32(v.AuxInt)
16875 sym1 := auxToSym(v.Aux)
16876 if v_0.Op != OpARM64MOVDaddr {
16879 off2 := auxIntToInt32(v_0.AuxInt)
16880 sym2 := auxToSym(v_0.Aux)
16885 if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_dynlink)) {
16888 v.reset(OpARM64STP)
16889 v.AuxInt = int32ToAuxInt(off1 + off2)
16890 v.Aux = symToAux(mergeSym(sym1, sym2))
16891 v.AddArg4(ptr, val1, val2, mem)
16894 // match: (STP [off] {sym} ptr (MOVDconst [0]) (MOVDconst [0]) mem)
16895 // result: (MOVQstorezero [off] {sym} ptr mem)
16897 off := auxIntToInt32(v.AuxInt)
16898 sym := auxToSym(v.Aux)
16900 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 || v_2.Op != OpARM64MOVDconst || auxIntToInt64(v_2.AuxInt) != 0 {
16904 v.reset(OpARM64MOVQstorezero)
16905 v.AuxInt = int32ToAuxInt(off)
16906 v.Aux = symToAux(sym)
16907 v.AddArg2(ptr, mem)
16912 func rewriteValueARM64_OpARM64SUB(v *Value) bool {
16916 // match: (SUB x (MOVDconst [c]))
16917 // result: (SUBconst [c] x)
16920 if v_1.Op != OpARM64MOVDconst {
16923 c := auxIntToInt64(v_1.AuxInt)
16924 v.reset(OpARM64SUBconst)
16925 v.AuxInt = int64ToAuxInt(c)
16929 // match: (SUB a l:(MUL x y))
16930 // cond: l.Uses==1 && clobber(l)
16931 // result: (MSUB a x y)
16935 if l.Op != OpARM64MUL {
16940 if !(l.Uses == 1 && clobber(l)) {
16943 v.reset(OpARM64MSUB)
16947 // match: (SUB a l:(MNEG x y))
16948 // cond: l.Uses==1 && clobber(l)
16949 // result: (MADD a x y)
16953 if l.Op != OpARM64MNEG {
16958 if !(l.Uses == 1 && clobber(l)) {
16961 v.reset(OpARM64MADD)
16965 // match: (SUB a l:(MULW x y))
16966 // cond: v.Type.Size() <= 4 && l.Uses==1 && clobber(l)
16967 // result: (MSUBW a x y)
16971 if l.Op != OpARM64MULW {
16976 if !(v.Type.Size() <= 4 && l.Uses == 1 && clobber(l)) {
16979 v.reset(OpARM64MSUBW)
16983 // match: (SUB a l:(MNEGW x y))
16984 // cond: v.Type.Size() <= 4 && l.Uses==1 && clobber(l)
16985 // result: (MADDW a x y)
16989 if l.Op != OpARM64MNEGW {
16994 if !(v.Type.Size() <= 4 && l.Uses == 1 && clobber(l)) {
16997 v.reset(OpARM64MADDW)
17001 // match: (SUB x x)
17002 // result: (MOVDconst [0])
17008 v.reset(OpARM64MOVDconst)
17009 v.AuxInt = int64ToAuxInt(0)
17012 // match: (SUB x (SUB y z))
17013 // result: (SUB (ADD <v.Type> x z) y)
17016 if v_1.Op != OpARM64SUB {
17021 v.reset(OpARM64SUB)
17022 v0 := b.NewValue0(v.Pos, OpARM64ADD, v.Type)
17027 // match: (SUB (SUB x y) z)
17028 // result: (SUB x (ADD <y.Type> y z))
17030 if v_0.Op != OpARM64SUB {
17036 v.reset(OpARM64SUB)
17037 v0 := b.NewValue0(v.Pos, OpARM64ADD, y.Type)
17042 // match: (SUB x0 x1:(SLLconst [c] y))
17043 // cond: clobberIfDead(x1)
17044 // result: (SUBshiftLL x0 y [c])
17048 if x1.Op != OpARM64SLLconst {
17051 c := auxIntToInt64(x1.AuxInt)
17053 if !(clobberIfDead(x1)) {
17056 v.reset(OpARM64SUBshiftLL)
17057 v.AuxInt = int64ToAuxInt(c)
17061 // match: (SUB x0 x1:(SRLconst [c] y))
17062 // cond: clobberIfDead(x1)
17063 // result: (SUBshiftRL x0 y [c])
17067 if x1.Op != OpARM64SRLconst {
17070 c := auxIntToInt64(x1.AuxInt)
17072 if !(clobberIfDead(x1)) {
17075 v.reset(OpARM64SUBshiftRL)
17076 v.AuxInt = int64ToAuxInt(c)
17080 // match: (SUB x0 x1:(SRAconst [c] y))
17081 // cond: clobberIfDead(x1)
17082 // result: (SUBshiftRA x0 y [c])
17086 if x1.Op != OpARM64SRAconst {
17089 c := auxIntToInt64(x1.AuxInt)
17091 if !(clobberIfDead(x1)) {
17094 v.reset(OpARM64SUBshiftRA)
17095 v.AuxInt = int64ToAuxInt(c)
17101 func rewriteValueARM64_OpARM64SUBconst(v *Value) bool {
17103 // match: (SUBconst [0] x)
17106 if auxIntToInt64(v.AuxInt) != 0 {
17113 // match: (SUBconst [c] (MOVDconst [d]))
17114 // result: (MOVDconst [d-c])
17116 c := auxIntToInt64(v.AuxInt)
17117 if v_0.Op != OpARM64MOVDconst {
17120 d := auxIntToInt64(v_0.AuxInt)
17121 v.reset(OpARM64MOVDconst)
17122 v.AuxInt = int64ToAuxInt(d - c)
17125 // match: (SUBconst [c] (SUBconst [d] x))
17126 // result: (ADDconst [-c-d] x)
17128 c := auxIntToInt64(v.AuxInt)
17129 if v_0.Op != OpARM64SUBconst {
17132 d := auxIntToInt64(v_0.AuxInt)
17134 v.reset(OpARM64ADDconst)
17135 v.AuxInt = int64ToAuxInt(-c - d)
17139 // match: (SUBconst [c] (ADDconst [d] x))
17140 // result: (ADDconst [-c+d] x)
17142 c := auxIntToInt64(v.AuxInt)
17143 if v_0.Op != OpARM64ADDconst {
17146 d := auxIntToInt64(v_0.AuxInt)
17148 v.reset(OpARM64ADDconst)
17149 v.AuxInt = int64ToAuxInt(-c + d)
17155 func rewriteValueARM64_OpARM64SUBshiftLL(v *Value) bool {
17158 // match: (SUBshiftLL x (MOVDconst [c]) [d])
17159 // result: (SUBconst x [int64(uint64(c)<<uint64(d))])
17161 d := auxIntToInt64(v.AuxInt)
17163 if v_1.Op != OpARM64MOVDconst {
17166 c := auxIntToInt64(v_1.AuxInt)
17167 v.reset(OpARM64SUBconst)
17168 v.AuxInt = int64ToAuxInt(int64(uint64(c) << uint64(d)))
17172 // match: (SUBshiftLL (SLLconst x [c]) x [c])
17173 // result: (MOVDconst [0])
17175 c := auxIntToInt64(v.AuxInt)
17176 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != c {
17183 v.reset(OpARM64MOVDconst)
17184 v.AuxInt = int64ToAuxInt(0)
17189 func rewriteValueARM64_OpARM64SUBshiftRA(v *Value) bool {
17192 // match: (SUBshiftRA x (MOVDconst [c]) [d])
17193 // result: (SUBconst x [c>>uint64(d)])
17195 d := auxIntToInt64(v.AuxInt)
17197 if v_1.Op != OpARM64MOVDconst {
17200 c := auxIntToInt64(v_1.AuxInt)
17201 v.reset(OpARM64SUBconst)
17202 v.AuxInt = int64ToAuxInt(c >> uint64(d))
17206 // match: (SUBshiftRA (SRAconst x [c]) x [c])
17207 // result: (MOVDconst [0])
17209 c := auxIntToInt64(v.AuxInt)
17210 if v_0.Op != OpARM64SRAconst || auxIntToInt64(v_0.AuxInt) != c {
17217 v.reset(OpARM64MOVDconst)
17218 v.AuxInt = int64ToAuxInt(0)
17223 func rewriteValueARM64_OpARM64SUBshiftRL(v *Value) bool {
17226 // match: (SUBshiftRL x (MOVDconst [c]) [d])
17227 // result: (SUBconst x [int64(uint64(c)>>uint64(d))])
17229 d := auxIntToInt64(v.AuxInt)
17231 if v_1.Op != OpARM64MOVDconst {
17234 c := auxIntToInt64(v_1.AuxInt)
17235 v.reset(OpARM64SUBconst)
17236 v.AuxInt = int64ToAuxInt(int64(uint64(c) >> uint64(d)))
17240 // match: (SUBshiftRL (SRLconst x [c]) x [c])
17241 // result: (MOVDconst [0])
17243 c := auxIntToInt64(v.AuxInt)
17244 if v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != c {
17251 v.reset(OpARM64MOVDconst)
17252 v.AuxInt = int64ToAuxInt(0)
17257 func rewriteValueARM64_OpARM64TST(v *Value) bool {
17260 // match: (TST x (MOVDconst [c]))
17261 // result: (TSTconst [c] x)
17263 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
17265 if v_1.Op != OpARM64MOVDconst {
17268 c := auxIntToInt64(v_1.AuxInt)
17269 v.reset(OpARM64TSTconst)
17270 v.AuxInt = int64ToAuxInt(c)
17276 // match: (TST x0 x1:(SLLconst [c] y))
17277 // cond: clobberIfDead(x1)
17278 // result: (TSTshiftLL x0 y [c])
17280 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
17283 if x1.Op != OpARM64SLLconst {
17286 c := auxIntToInt64(x1.AuxInt)
17288 if !(clobberIfDead(x1)) {
17291 v.reset(OpARM64TSTshiftLL)
17292 v.AuxInt = int64ToAuxInt(c)
17298 // match: (TST x0 x1:(SRLconst [c] y))
17299 // cond: clobberIfDead(x1)
17300 // result: (TSTshiftRL x0 y [c])
17302 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
17305 if x1.Op != OpARM64SRLconst {
17308 c := auxIntToInt64(x1.AuxInt)
17310 if !(clobberIfDead(x1)) {
17313 v.reset(OpARM64TSTshiftRL)
17314 v.AuxInt = int64ToAuxInt(c)
17320 // match: (TST x0 x1:(SRAconst [c] y))
17321 // cond: clobberIfDead(x1)
17322 // result: (TSTshiftRA x0 y [c])
17324 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
17327 if x1.Op != OpARM64SRAconst {
17330 c := auxIntToInt64(x1.AuxInt)
17332 if !(clobberIfDead(x1)) {
17335 v.reset(OpARM64TSTshiftRA)
17336 v.AuxInt = int64ToAuxInt(c)
17342 // match: (TST x0 x1:(RORconst [c] y))
17343 // cond: clobberIfDead(x1)
17344 // result: (TSTshiftRO x0 y [c])
17346 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
17349 if x1.Op != OpARM64RORconst {
17352 c := auxIntToInt64(x1.AuxInt)
17354 if !(clobberIfDead(x1)) {
17357 v.reset(OpARM64TSTshiftRO)
17358 v.AuxInt = int64ToAuxInt(c)
17366 func rewriteValueARM64_OpARM64TSTW(v *Value) bool {
17369 // match: (TSTW x (MOVDconst [c]))
17370 // result: (TSTWconst [int32(c)] x)
17372 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
17374 if v_1.Op != OpARM64MOVDconst {
17377 c := auxIntToInt64(v_1.AuxInt)
17378 v.reset(OpARM64TSTWconst)
17379 v.AuxInt = int32ToAuxInt(int32(c))
17387 func rewriteValueARM64_OpARM64TSTWconst(v *Value) bool {
17389 // match: (TSTWconst (MOVDconst [x]) [y])
17390 // result: (FlagConstant [logicFlags32(int32(x)&y)])
17392 y := auxIntToInt32(v.AuxInt)
17393 if v_0.Op != OpARM64MOVDconst {
17396 x := auxIntToInt64(v_0.AuxInt)
17397 v.reset(OpARM64FlagConstant)
17398 v.AuxInt = flagConstantToAuxInt(logicFlags32(int32(x) & y))
17403 func rewriteValueARM64_OpARM64TSTconst(v *Value) bool {
17405 // match: (TSTconst (MOVDconst [x]) [y])
17406 // result: (FlagConstant [logicFlags64(x&y)])
17408 y := auxIntToInt64(v.AuxInt)
17409 if v_0.Op != OpARM64MOVDconst {
17412 x := auxIntToInt64(v_0.AuxInt)
17413 v.reset(OpARM64FlagConstant)
17414 v.AuxInt = flagConstantToAuxInt(logicFlags64(x & y))
17419 func rewriteValueARM64_OpARM64TSTshiftLL(v *Value) bool {
17423 // match: (TSTshiftLL (MOVDconst [c]) x [d])
17424 // result: (TSTconst [c] (SLLconst <x.Type> x [d]))
17426 d := auxIntToInt64(v.AuxInt)
17427 if v_0.Op != OpARM64MOVDconst {
17430 c := auxIntToInt64(v_0.AuxInt)
17432 v.reset(OpARM64TSTconst)
17433 v.AuxInt = int64ToAuxInt(c)
17434 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
17435 v0.AuxInt = int64ToAuxInt(d)
17440 // match: (TSTshiftLL x (MOVDconst [c]) [d])
17441 // result: (TSTconst x [int64(uint64(c)<<uint64(d))])
17443 d := auxIntToInt64(v.AuxInt)
17445 if v_1.Op != OpARM64MOVDconst {
17448 c := auxIntToInt64(v_1.AuxInt)
17449 v.reset(OpARM64TSTconst)
17450 v.AuxInt = int64ToAuxInt(int64(uint64(c) << uint64(d)))
17456 func rewriteValueARM64_OpARM64TSTshiftRA(v *Value) bool {
17460 // match: (TSTshiftRA (MOVDconst [c]) x [d])
17461 // result: (TSTconst [c] (SRAconst <x.Type> x [d]))
17463 d := auxIntToInt64(v.AuxInt)
17464 if v_0.Op != OpARM64MOVDconst {
17467 c := auxIntToInt64(v_0.AuxInt)
17469 v.reset(OpARM64TSTconst)
17470 v.AuxInt = int64ToAuxInt(c)
17471 v0 := b.NewValue0(v.Pos, OpARM64SRAconst, x.Type)
17472 v0.AuxInt = int64ToAuxInt(d)
17477 // match: (TSTshiftRA x (MOVDconst [c]) [d])
17478 // result: (TSTconst x [c>>uint64(d)])
17480 d := auxIntToInt64(v.AuxInt)
17482 if v_1.Op != OpARM64MOVDconst {
17485 c := auxIntToInt64(v_1.AuxInt)
17486 v.reset(OpARM64TSTconst)
17487 v.AuxInt = int64ToAuxInt(c >> uint64(d))
17493 func rewriteValueARM64_OpARM64TSTshiftRL(v *Value) bool {
17497 // match: (TSTshiftRL (MOVDconst [c]) x [d])
17498 // result: (TSTconst [c] (SRLconst <x.Type> x [d]))
17500 d := auxIntToInt64(v.AuxInt)
17501 if v_0.Op != OpARM64MOVDconst {
17504 c := auxIntToInt64(v_0.AuxInt)
17506 v.reset(OpARM64TSTconst)
17507 v.AuxInt = int64ToAuxInt(c)
17508 v0 := b.NewValue0(v.Pos, OpARM64SRLconst, x.Type)
17509 v0.AuxInt = int64ToAuxInt(d)
17514 // match: (TSTshiftRL x (MOVDconst [c]) [d])
17515 // result: (TSTconst x [int64(uint64(c)>>uint64(d))])
17517 d := auxIntToInt64(v.AuxInt)
17519 if v_1.Op != OpARM64MOVDconst {
17522 c := auxIntToInt64(v_1.AuxInt)
17523 v.reset(OpARM64TSTconst)
17524 v.AuxInt = int64ToAuxInt(int64(uint64(c) >> uint64(d)))
17530 func rewriteValueARM64_OpARM64TSTshiftRO(v *Value) bool {
17534 // match: (TSTshiftRO (MOVDconst [c]) x [d])
17535 // result: (TSTconst [c] (RORconst <x.Type> x [d]))
17537 d := auxIntToInt64(v.AuxInt)
17538 if v_0.Op != OpARM64MOVDconst {
17541 c := auxIntToInt64(v_0.AuxInt)
17543 v.reset(OpARM64TSTconst)
17544 v.AuxInt = int64ToAuxInt(c)
17545 v0 := b.NewValue0(v.Pos, OpARM64RORconst, x.Type)
17546 v0.AuxInt = int64ToAuxInt(d)
17551 // match: (TSTshiftRO x (MOVDconst [c]) [d])
17552 // result: (TSTconst x [rotateRight64(c, d)])
17554 d := auxIntToInt64(v.AuxInt)
17556 if v_1.Op != OpARM64MOVDconst {
17559 c := auxIntToInt64(v_1.AuxInt)
17560 v.reset(OpARM64TSTconst)
17561 v.AuxInt = int64ToAuxInt(rotateRight64(c, d))
17567 func rewriteValueARM64_OpARM64UBFIZ(v *Value) bool {
17569 // match: (UBFIZ [bfc] (SLLconst [sc] x))
17570 // cond: sc < bfc.getARM64BFwidth()
17571 // result: (UBFIZ [armBFAuxInt(bfc.getARM64BFlsb()+sc, bfc.getARM64BFwidth()-sc)] x)
17573 bfc := auxIntToArm64BitField(v.AuxInt)
17574 if v_0.Op != OpARM64SLLconst {
17577 sc := auxIntToInt64(v_0.AuxInt)
17579 if !(sc < bfc.getARM64BFwidth()) {
17582 v.reset(OpARM64UBFIZ)
17583 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(bfc.getARM64BFlsb()+sc, bfc.getARM64BFwidth()-sc))
17589 func rewriteValueARM64_OpARM64UBFX(v *Value) bool {
17591 // match: (UBFX [bfc] (ANDconst [c] x))
17592 // cond: isARM64BFMask(0, c, 0) && bfc.getARM64BFlsb() + bfc.getARM64BFwidth() <= arm64BFWidth(c, 0)
17593 // result: (UBFX [bfc] x)
17595 bfc := auxIntToArm64BitField(v.AuxInt)
17596 if v_0.Op != OpARM64ANDconst {
17599 c := auxIntToInt64(v_0.AuxInt)
17601 if !(isARM64BFMask(0, c, 0) && bfc.getARM64BFlsb()+bfc.getARM64BFwidth() <= arm64BFWidth(c, 0)) {
17604 v.reset(OpARM64UBFX)
17605 v.AuxInt = arm64BitFieldToAuxInt(bfc)
17609 // match: (UBFX [bfc] (SRLconst [sc] x))
17610 // cond: sc+bfc.getARM64BFwidth()+bfc.getARM64BFlsb() < 64
17611 // result: (UBFX [armBFAuxInt(bfc.getARM64BFlsb()+sc, bfc.getARM64BFwidth())] x)
17613 bfc := auxIntToArm64BitField(v.AuxInt)
17614 if v_0.Op != OpARM64SRLconst {
17617 sc := auxIntToInt64(v_0.AuxInt)
17619 if !(sc+bfc.getARM64BFwidth()+bfc.getARM64BFlsb() < 64) {
17622 v.reset(OpARM64UBFX)
17623 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(bfc.getARM64BFlsb()+sc, bfc.getARM64BFwidth()))
17627 // match: (UBFX [bfc] (SLLconst [sc] x))
17628 // cond: sc == bfc.getARM64BFlsb()
17629 // result: (ANDconst [1<<uint(bfc.getARM64BFwidth())-1] x)
17631 bfc := auxIntToArm64BitField(v.AuxInt)
17632 if v_0.Op != OpARM64SLLconst {
17635 sc := auxIntToInt64(v_0.AuxInt)
17637 if !(sc == bfc.getARM64BFlsb()) {
17640 v.reset(OpARM64ANDconst)
17641 v.AuxInt = int64ToAuxInt(1<<uint(bfc.getARM64BFwidth()) - 1)
17645 // match: (UBFX [bfc] (SLLconst [sc] x))
17646 // cond: sc < bfc.getARM64BFlsb()
17647 // result: (UBFX [armBFAuxInt(bfc.getARM64BFlsb()-sc, bfc.getARM64BFwidth())] x)
17649 bfc := auxIntToArm64BitField(v.AuxInt)
17650 if v_0.Op != OpARM64SLLconst {
17653 sc := auxIntToInt64(v_0.AuxInt)
17655 if !(sc < bfc.getARM64BFlsb()) {
17658 v.reset(OpARM64UBFX)
17659 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(bfc.getARM64BFlsb()-sc, bfc.getARM64BFwidth()))
17663 // match: (UBFX [bfc] (SLLconst [sc] x))
17664 // cond: sc > bfc.getARM64BFlsb() && sc < bfc.getARM64BFlsb()+bfc.getARM64BFwidth()
17665 // result: (UBFIZ [armBFAuxInt(sc-bfc.getARM64BFlsb(), bfc.getARM64BFlsb()+bfc.getARM64BFwidth()-sc)] x)
17667 bfc := auxIntToArm64BitField(v.AuxInt)
17668 if v_0.Op != OpARM64SLLconst {
17671 sc := auxIntToInt64(v_0.AuxInt)
17673 if !(sc > bfc.getARM64BFlsb() && sc < bfc.getARM64BFlsb()+bfc.getARM64BFwidth()) {
17676 v.reset(OpARM64UBFIZ)
17677 v.AuxInt = arm64BitFieldToAuxInt(armBFAuxInt(sc-bfc.getARM64BFlsb(), bfc.getARM64BFlsb()+bfc.getARM64BFwidth()-sc))
17683 func rewriteValueARM64_OpARM64UDIV(v *Value) bool {
17686 // match: (UDIV x (MOVDconst [1]))
17690 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
17696 // match: (UDIV x (MOVDconst [c]))
17697 // cond: isPowerOfTwo64(c)
17698 // result: (SRLconst [log64(c)] x)
17701 if v_1.Op != OpARM64MOVDconst {
17704 c := auxIntToInt64(v_1.AuxInt)
17705 if !(isPowerOfTwo64(c)) {
17708 v.reset(OpARM64SRLconst)
17709 v.AuxInt = int64ToAuxInt(log64(c))
17713 // match: (UDIV (MOVDconst [c]) (MOVDconst [d]))
17715 // result: (MOVDconst [int64(uint64(c)/uint64(d))])
17717 if v_0.Op != OpARM64MOVDconst {
17720 c := auxIntToInt64(v_0.AuxInt)
17721 if v_1.Op != OpARM64MOVDconst {
17724 d := auxIntToInt64(v_1.AuxInt)
17728 v.reset(OpARM64MOVDconst)
17729 v.AuxInt = int64ToAuxInt(int64(uint64(c) / uint64(d)))
17734 func rewriteValueARM64_OpARM64UDIVW(v *Value) bool {
17738 // match: (UDIVW x (MOVDconst [c]))
17739 // cond: uint32(c)==1
17740 // result: (MOVWUreg x)
17743 if v_1.Op != OpARM64MOVDconst {
17746 c := auxIntToInt64(v_1.AuxInt)
17747 if !(uint32(c) == 1) {
17750 v.reset(OpARM64MOVWUreg)
17754 // match: (UDIVW x (MOVDconst [c]))
17755 // cond: isPowerOfTwo64(c) && is32Bit(c)
17756 // result: (SRLconst [log64(c)] (MOVWUreg <v.Type> x))
17759 if v_1.Op != OpARM64MOVDconst {
17762 c := auxIntToInt64(v_1.AuxInt)
17763 if !(isPowerOfTwo64(c) && is32Bit(c)) {
17766 v.reset(OpARM64SRLconst)
17767 v.AuxInt = int64ToAuxInt(log64(c))
17768 v0 := b.NewValue0(v.Pos, OpARM64MOVWUreg, v.Type)
17773 // match: (UDIVW (MOVDconst [c]) (MOVDconst [d]))
17775 // result: (MOVDconst [int64(uint32(c)/uint32(d))])
17777 if v_0.Op != OpARM64MOVDconst {
17780 c := auxIntToInt64(v_0.AuxInt)
17781 if v_1.Op != OpARM64MOVDconst {
17784 d := auxIntToInt64(v_1.AuxInt)
17788 v.reset(OpARM64MOVDconst)
17789 v.AuxInt = int64ToAuxInt(int64(uint32(c) / uint32(d)))
17794 func rewriteValueARM64_OpARM64UMOD(v *Value) bool {
17798 typ := &b.Func.Config.Types
17799 // match: (UMOD <typ.UInt64> x y)
17800 // result: (MSUB <typ.UInt64> x y (UDIV <typ.UInt64> x y))
17802 if v.Type != typ.UInt64 {
17807 v.reset(OpARM64MSUB)
17808 v.Type = typ.UInt64
17809 v0 := b.NewValue0(v.Pos, OpARM64UDIV, typ.UInt64)
17811 v.AddArg3(x, y, v0)
17814 // match: (UMOD _ (MOVDconst [1]))
17815 // result: (MOVDconst [0])
17817 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
17820 v.reset(OpARM64MOVDconst)
17821 v.AuxInt = int64ToAuxInt(0)
17824 // match: (UMOD x (MOVDconst [c]))
17825 // cond: isPowerOfTwo64(c)
17826 // result: (ANDconst [c-1] x)
17829 if v_1.Op != OpARM64MOVDconst {
17832 c := auxIntToInt64(v_1.AuxInt)
17833 if !(isPowerOfTwo64(c)) {
17836 v.reset(OpARM64ANDconst)
17837 v.AuxInt = int64ToAuxInt(c - 1)
17841 // match: (UMOD (MOVDconst [c]) (MOVDconst [d]))
17843 // result: (MOVDconst [int64(uint64(c)%uint64(d))])
17845 if v_0.Op != OpARM64MOVDconst {
17848 c := auxIntToInt64(v_0.AuxInt)
17849 if v_1.Op != OpARM64MOVDconst {
17852 d := auxIntToInt64(v_1.AuxInt)
17856 v.reset(OpARM64MOVDconst)
17857 v.AuxInt = int64ToAuxInt(int64(uint64(c) % uint64(d)))
17862 func rewriteValueARM64_OpARM64UMODW(v *Value) bool {
17866 typ := &b.Func.Config.Types
17867 // match: (UMODW <typ.UInt32> x y)
17868 // result: (MSUBW <typ.UInt32> x y (UDIVW <typ.UInt32> x y))
17870 if v.Type != typ.UInt32 {
17875 v.reset(OpARM64MSUBW)
17876 v.Type = typ.UInt32
17877 v0 := b.NewValue0(v.Pos, OpARM64UDIVW, typ.UInt32)
17879 v.AddArg3(x, y, v0)
17882 // match: (UMODW _ (MOVDconst [c]))
17883 // cond: uint32(c)==1
17884 // result: (MOVDconst [0])
17886 if v_1.Op != OpARM64MOVDconst {
17889 c := auxIntToInt64(v_1.AuxInt)
17890 if !(uint32(c) == 1) {
17893 v.reset(OpARM64MOVDconst)
17894 v.AuxInt = int64ToAuxInt(0)
17897 // match: (UMODW x (MOVDconst [c]))
17898 // cond: isPowerOfTwo64(c) && is32Bit(c)
17899 // result: (ANDconst [c-1] x)
17902 if v_1.Op != OpARM64MOVDconst {
17905 c := auxIntToInt64(v_1.AuxInt)
17906 if !(isPowerOfTwo64(c) && is32Bit(c)) {
17909 v.reset(OpARM64ANDconst)
17910 v.AuxInt = int64ToAuxInt(c - 1)
17914 // match: (UMODW (MOVDconst [c]) (MOVDconst [d]))
17916 // result: (MOVDconst [int64(uint32(c)%uint32(d))])
17918 if v_0.Op != OpARM64MOVDconst {
17921 c := auxIntToInt64(v_0.AuxInt)
17922 if v_1.Op != OpARM64MOVDconst {
17925 d := auxIntToInt64(v_1.AuxInt)
17929 v.reset(OpARM64MOVDconst)
17930 v.AuxInt = int64ToAuxInt(int64(uint32(c) % uint32(d)))
17935 func rewriteValueARM64_OpARM64XOR(v *Value) bool {
17938 // match: (XOR x (MOVDconst [c]))
17939 // result: (XORconst [c] x)
17941 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
17943 if v_1.Op != OpARM64MOVDconst {
17946 c := auxIntToInt64(v_1.AuxInt)
17947 v.reset(OpARM64XORconst)
17948 v.AuxInt = int64ToAuxInt(c)
17954 // match: (XOR x x)
17955 // result: (MOVDconst [0])
17961 v.reset(OpARM64MOVDconst)
17962 v.AuxInt = int64ToAuxInt(0)
17965 // match: (XOR x (MVN y))
17966 // result: (EON x y)
17968 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
17970 if v_1.Op != OpARM64MVN {
17974 v.reset(OpARM64EON)
17980 // match: (XOR x0 x1:(SLLconst [c] y))
17981 // cond: clobberIfDead(x1)
17982 // result: (XORshiftLL x0 y [c])
17984 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
17987 if x1.Op != OpARM64SLLconst {
17990 c := auxIntToInt64(x1.AuxInt)
17992 if !(clobberIfDead(x1)) {
17995 v.reset(OpARM64XORshiftLL)
17996 v.AuxInt = int64ToAuxInt(c)
18002 // match: (XOR x0 x1:(SRLconst [c] y))
18003 // cond: clobberIfDead(x1)
18004 // result: (XORshiftRL x0 y [c])
18006 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
18009 if x1.Op != OpARM64SRLconst {
18012 c := auxIntToInt64(x1.AuxInt)
18014 if !(clobberIfDead(x1)) {
18017 v.reset(OpARM64XORshiftRL)
18018 v.AuxInt = int64ToAuxInt(c)
18024 // match: (XOR x0 x1:(SRAconst [c] y))
18025 // cond: clobberIfDead(x1)
18026 // result: (XORshiftRA x0 y [c])
18028 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
18031 if x1.Op != OpARM64SRAconst {
18034 c := auxIntToInt64(x1.AuxInt)
18036 if !(clobberIfDead(x1)) {
18039 v.reset(OpARM64XORshiftRA)
18040 v.AuxInt = int64ToAuxInt(c)
18046 // match: (XOR x0 x1:(RORconst [c] y))
18047 // cond: clobberIfDead(x1)
18048 // result: (XORshiftRO x0 y [c])
18050 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
18053 if x1.Op != OpARM64RORconst {
18056 c := auxIntToInt64(x1.AuxInt)
18058 if !(clobberIfDead(x1)) {
18061 v.reset(OpARM64XORshiftRO)
18062 v.AuxInt = int64ToAuxInt(c)
18070 func rewriteValueARM64_OpARM64XORconst(v *Value) bool {
18072 // match: (XORconst [0] x)
18075 if auxIntToInt64(v.AuxInt) != 0 {
18082 // match: (XORconst [-1] x)
18085 if auxIntToInt64(v.AuxInt) != -1 {
18089 v.reset(OpARM64MVN)
18093 // match: (XORconst [c] (MOVDconst [d]))
18094 // result: (MOVDconst [c^d])
18096 c := auxIntToInt64(v.AuxInt)
18097 if v_0.Op != OpARM64MOVDconst {
18100 d := auxIntToInt64(v_0.AuxInt)
18101 v.reset(OpARM64MOVDconst)
18102 v.AuxInt = int64ToAuxInt(c ^ d)
18105 // match: (XORconst [c] (XORconst [d] x))
18106 // result: (XORconst [c^d] x)
18108 c := auxIntToInt64(v.AuxInt)
18109 if v_0.Op != OpARM64XORconst {
18112 d := auxIntToInt64(v_0.AuxInt)
18114 v.reset(OpARM64XORconst)
18115 v.AuxInt = int64ToAuxInt(c ^ d)
18121 func rewriteValueARM64_OpARM64XORshiftLL(v *Value) bool {
18125 typ := &b.Func.Config.Types
18126 // match: (XORshiftLL (MOVDconst [c]) x [d])
18127 // result: (XORconst [c] (SLLconst <x.Type> x [d]))
18129 d := auxIntToInt64(v.AuxInt)
18130 if v_0.Op != OpARM64MOVDconst {
18133 c := auxIntToInt64(v_0.AuxInt)
18135 v.reset(OpARM64XORconst)
18136 v.AuxInt = int64ToAuxInt(c)
18137 v0 := b.NewValue0(v.Pos, OpARM64SLLconst, x.Type)
18138 v0.AuxInt = int64ToAuxInt(d)
18143 // match: (XORshiftLL x (MOVDconst [c]) [d])
18144 // result: (XORconst x [int64(uint64(c)<<uint64(d))])
18146 d := auxIntToInt64(v.AuxInt)
18148 if v_1.Op != OpARM64MOVDconst {
18151 c := auxIntToInt64(v_1.AuxInt)
18152 v.reset(OpARM64XORconst)
18153 v.AuxInt = int64ToAuxInt(int64(uint64(c) << uint64(d)))
18157 // match: (XORshiftLL (SLLconst x [c]) x [c])
18158 // result: (MOVDconst [0])
18160 c := auxIntToInt64(v.AuxInt)
18161 if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != c {
18168 v.reset(OpARM64MOVDconst)
18169 v.AuxInt = int64ToAuxInt(0)
18172 // match: (XORshiftLL <typ.UInt16> [8] (UBFX <typ.UInt16> [armBFAuxInt(8, 8)] x) x)
18173 // result: (REV16W x)
18175 if v.Type != typ.UInt16 || auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64UBFX || v_0.Type != typ.UInt16 || auxIntToArm64BitField(v_0.AuxInt) != armBFAuxInt(8, 8) {
18182 v.reset(OpARM64REV16W)
18186 // match: (XORshiftLL [8] (UBFX [armBFAuxInt(8, 24)] (ANDconst [c1] x)) (ANDconst [c2] x))
18187 // cond: uint32(c1) == 0xff00ff00 && uint32(c2) == 0x00ff00ff
18188 // result: (REV16W x)
18190 if auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64UBFX || auxIntToArm64BitField(v_0.AuxInt) != armBFAuxInt(8, 24) {
18193 v_0_0 := v_0.Args[0]
18194 if v_0_0.Op != OpARM64ANDconst {
18197 c1 := auxIntToInt64(v_0_0.AuxInt)
18199 if v_1.Op != OpARM64ANDconst {
18202 c2 := auxIntToInt64(v_1.AuxInt)
18203 if x != v_1.Args[0] || !(uint32(c1) == 0xff00ff00 && uint32(c2) == 0x00ff00ff) {
18206 v.reset(OpARM64REV16W)
18210 // match: (XORshiftLL [8] (SRLconst [8] (ANDconst [c1] x)) (ANDconst [c2] x))
18211 // cond: (uint64(c1) == 0xff00ff00ff00ff00 && uint64(c2) == 0x00ff00ff00ff00ff)
18212 // result: (REV16 x)
18214 if auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != 8 {
18217 v_0_0 := v_0.Args[0]
18218 if v_0_0.Op != OpARM64ANDconst {
18221 c1 := auxIntToInt64(v_0_0.AuxInt)
18223 if v_1.Op != OpARM64ANDconst {
18226 c2 := auxIntToInt64(v_1.AuxInt)
18227 if x != v_1.Args[0] || !(uint64(c1) == 0xff00ff00ff00ff00 && uint64(c2) == 0x00ff00ff00ff00ff) {
18230 v.reset(OpARM64REV16)
18234 // match: (XORshiftLL [8] (SRLconst [8] (ANDconst [c1] x)) (ANDconst [c2] x))
18235 // cond: (uint64(c1) == 0xff00ff00 && uint64(c2) == 0x00ff00ff)
18236 // result: (REV16 (ANDconst <x.Type> [0xffffffff] x))
18238 if auxIntToInt64(v.AuxInt) != 8 || v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != 8 {
18241 v_0_0 := v_0.Args[0]
18242 if v_0_0.Op != OpARM64ANDconst {
18245 c1 := auxIntToInt64(v_0_0.AuxInt)
18247 if v_1.Op != OpARM64ANDconst {
18250 c2 := auxIntToInt64(v_1.AuxInt)
18251 if x != v_1.Args[0] || !(uint64(c1) == 0xff00ff00 && uint64(c2) == 0x00ff00ff) {
18254 v.reset(OpARM64REV16)
18255 v0 := b.NewValue0(v.Pos, OpARM64ANDconst, x.Type)
18256 v0.AuxInt = int64ToAuxInt(0xffffffff)
18261 // match: (XORshiftLL [c] (SRLconst x [64-c]) x2)
18262 // result: (EXTRconst [64-c] x2 x)
18264 c := auxIntToInt64(v.AuxInt)
18265 if v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != 64-c {
18270 v.reset(OpARM64EXTRconst)
18271 v.AuxInt = int64ToAuxInt(64 - c)
18275 // match: (XORshiftLL <t> [c] (UBFX [bfc] x) x2)
18276 // cond: c < 32 && t.Size() == 4 && bfc == armBFAuxInt(32-c, c)
18277 // result: (EXTRWconst [32-c] x2 x)
18280 c := auxIntToInt64(v.AuxInt)
18281 if v_0.Op != OpARM64UBFX {
18284 bfc := auxIntToArm64BitField(v_0.AuxInt)
18287 if !(c < 32 && t.Size() == 4 && bfc == armBFAuxInt(32-c, c)) {
18290 v.reset(OpARM64EXTRWconst)
18291 v.AuxInt = int64ToAuxInt(32 - c)
18297 func rewriteValueARM64_OpARM64XORshiftRA(v *Value) bool {
18301 // match: (XORshiftRA (MOVDconst [c]) x [d])
18302 // result: (XORconst [c] (SRAconst <x.Type> x [d]))
18304 d := auxIntToInt64(v.AuxInt)
18305 if v_0.Op != OpARM64MOVDconst {
18308 c := auxIntToInt64(v_0.AuxInt)
18310 v.reset(OpARM64XORconst)
18311 v.AuxInt = int64ToAuxInt(c)
18312 v0 := b.NewValue0(v.Pos, OpARM64SRAconst, x.Type)
18313 v0.AuxInt = int64ToAuxInt(d)
18318 // match: (XORshiftRA x (MOVDconst [c]) [d])
18319 // result: (XORconst x [c>>uint64(d)])
18321 d := auxIntToInt64(v.AuxInt)
18323 if v_1.Op != OpARM64MOVDconst {
18326 c := auxIntToInt64(v_1.AuxInt)
18327 v.reset(OpARM64XORconst)
18328 v.AuxInt = int64ToAuxInt(c >> uint64(d))
18332 // match: (XORshiftRA (SRAconst x [c]) x [c])
18333 // result: (MOVDconst [0])
18335 c := auxIntToInt64(v.AuxInt)
18336 if v_0.Op != OpARM64SRAconst || auxIntToInt64(v_0.AuxInt) != c {
18343 v.reset(OpARM64MOVDconst)
18344 v.AuxInt = int64ToAuxInt(0)
18349 func rewriteValueARM64_OpARM64XORshiftRL(v *Value) bool {
18353 // match: (XORshiftRL (MOVDconst [c]) x [d])
18354 // result: (XORconst [c] (SRLconst <x.Type> x [d]))
18356 d := auxIntToInt64(v.AuxInt)
18357 if v_0.Op != OpARM64MOVDconst {
18360 c := auxIntToInt64(v_0.AuxInt)
18362 v.reset(OpARM64XORconst)
18363 v.AuxInt = int64ToAuxInt(c)
18364 v0 := b.NewValue0(v.Pos, OpARM64SRLconst, x.Type)
18365 v0.AuxInt = int64ToAuxInt(d)
18370 // match: (XORshiftRL x (MOVDconst [c]) [d])
18371 // result: (XORconst x [int64(uint64(c)>>uint64(d))])
18373 d := auxIntToInt64(v.AuxInt)
18375 if v_1.Op != OpARM64MOVDconst {
18378 c := auxIntToInt64(v_1.AuxInt)
18379 v.reset(OpARM64XORconst)
18380 v.AuxInt = int64ToAuxInt(int64(uint64(c) >> uint64(d)))
18384 // match: (XORshiftRL (SRLconst x [c]) x [c])
18385 // result: (MOVDconst [0])
18387 c := auxIntToInt64(v.AuxInt)
18388 if v_0.Op != OpARM64SRLconst || auxIntToInt64(v_0.AuxInt) != c {
18395 v.reset(OpARM64MOVDconst)
18396 v.AuxInt = int64ToAuxInt(0)
18401 func rewriteValueARM64_OpARM64XORshiftRO(v *Value) bool {
18405 // match: (XORshiftRO (MOVDconst [c]) x [d])
18406 // result: (XORconst [c] (RORconst <x.Type> x [d]))
18408 d := auxIntToInt64(v.AuxInt)
18409 if v_0.Op != OpARM64MOVDconst {
18412 c := auxIntToInt64(v_0.AuxInt)
18414 v.reset(OpARM64XORconst)
18415 v.AuxInt = int64ToAuxInt(c)
18416 v0 := b.NewValue0(v.Pos, OpARM64RORconst, x.Type)
18417 v0.AuxInt = int64ToAuxInt(d)
18422 // match: (XORshiftRO x (MOVDconst [c]) [d])
18423 // result: (XORconst x [rotateRight64(c, d)])
18425 d := auxIntToInt64(v.AuxInt)
18427 if v_1.Op != OpARM64MOVDconst {
18430 c := auxIntToInt64(v_1.AuxInt)
18431 v.reset(OpARM64XORconst)
18432 v.AuxInt = int64ToAuxInt(rotateRight64(c, d))
18436 // match: (XORshiftRO (RORconst x [c]) x [c])
18437 // result: (MOVDconst [0])
18439 c := auxIntToInt64(v.AuxInt)
18440 if v_0.Op != OpARM64RORconst || auxIntToInt64(v_0.AuxInt) != c {
18447 v.reset(OpARM64MOVDconst)
18448 v.AuxInt = int64ToAuxInt(0)
18453 func rewriteValueARM64_OpAddr(v *Value) bool {
18455 // match: (Addr {sym} base)
18456 // result: (MOVDaddr {sym} base)
18458 sym := auxToSym(v.Aux)
18460 v.reset(OpARM64MOVDaddr)
18461 v.Aux = symToAux(sym)
18466 func rewriteValueARM64_OpAtomicAnd32(v *Value) bool {
18471 typ := &b.Func.Config.Types
18472 // match: (AtomicAnd32 ptr val mem)
18473 // result: (Select1 (LoweredAtomicAnd32 ptr val mem))
18479 v0 := b.NewValue0(v.Pos, OpARM64LoweredAtomicAnd32, types.NewTuple(typ.UInt32, types.TypeMem))
18480 v0.AddArg3(ptr, val, mem)
18485 func rewriteValueARM64_OpAtomicAnd32Variant(v *Value) bool {
18490 typ := &b.Func.Config.Types
18491 // match: (AtomicAnd32Variant ptr val mem)
18492 // result: (Select1 (LoweredAtomicAnd32Variant ptr val mem))
18498 v0 := b.NewValue0(v.Pos, OpARM64LoweredAtomicAnd32Variant, types.NewTuple(typ.UInt32, types.TypeMem))
18499 v0.AddArg3(ptr, val, mem)
18504 func rewriteValueARM64_OpAtomicAnd8(v *Value) bool {
18509 typ := &b.Func.Config.Types
18510 // match: (AtomicAnd8 ptr val mem)
18511 // result: (Select1 (LoweredAtomicAnd8 ptr val mem))
18517 v0 := b.NewValue0(v.Pos, OpARM64LoweredAtomicAnd8, types.NewTuple(typ.UInt8, types.TypeMem))
18518 v0.AddArg3(ptr, val, mem)
18523 func rewriteValueARM64_OpAtomicAnd8Variant(v *Value) bool {
18528 typ := &b.Func.Config.Types
18529 // match: (AtomicAnd8Variant ptr val mem)
18530 // result: (Select1 (LoweredAtomicAnd8Variant ptr val mem))
18536 v0 := b.NewValue0(v.Pos, OpARM64LoweredAtomicAnd8Variant, types.NewTuple(typ.UInt8, types.TypeMem))
18537 v0.AddArg3(ptr, val, mem)
18542 func rewriteValueARM64_OpAtomicOr32(v *Value) bool {
18547 typ := &b.Func.Config.Types
18548 // match: (AtomicOr32 ptr val mem)
18549 // result: (Select1 (LoweredAtomicOr32 ptr val mem))
18555 v0 := b.NewValue0(v.Pos, OpARM64LoweredAtomicOr32, types.NewTuple(typ.UInt32, types.TypeMem))
18556 v0.AddArg3(ptr, val, mem)
18561 func rewriteValueARM64_OpAtomicOr32Variant(v *Value) bool {
18566 typ := &b.Func.Config.Types
18567 // match: (AtomicOr32Variant ptr val mem)
18568 // result: (Select1 (LoweredAtomicOr32Variant ptr val mem))
18574 v0 := b.NewValue0(v.Pos, OpARM64LoweredAtomicOr32Variant, types.NewTuple(typ.UInt32, types.TypeMem))
18575 v0.AddArg3(ptr, val, mem)
18580 func rewriteValueARM64_OpAtomicOr8(v *Value) bool {
18585 typ := &b.Func.Config.Types
18586 // match: (AtomicOr8 ptr val mem)
18587 // result: (Select1 (LoweredAtomicOr8 ptr val mem))
18593 v0 := b.NewValue0(v.Pos, OpARM64LoweredAtomicOr8, types.NewTuple(typ.UInt8, types.TypeMem))
18594 v0.AddArg3(ptr, val, mem)
18599 func rewriteValueARM64_OpAtomicOr8Variant(v *Value) bool {
18604 typ := &b.Func.Config.Types
18605 // match: (AtomicOr8Variant ptr val mem)
18606 // result: (Select1 (LoweredAtomicOr8Variant ptr val mem))
18612 v0 := b.NewValue0(v.Pos, OpARM64LoweredAtomicOr8Variant, types.NewTuple(typ.UInt8, types.TypeMem))
18613 v0.AddArg3(ptr, val, mem)
18618 func rewriteValueARM64_OpAvg64u(v *Value) bool {
18622 // match: (Avg64u <t> x y)
18623 // result: (ADD (SRLconst <t> (SUB <t> x y) [1]) y)
18628 v.reset(OpARM64ADD)
18629 v0 := b.NewValue0(v.Pos, OpARM64SRLconst, t)
18630 v0.AuxInt = int64ToAuxInt(1)
18631 v1 := b.NewValue0(v.Pos, OpARM64SUB, t)
18638 func rewriteValueARM64_OpBitLen32(v *Value) bool {
18641 typ := &b.Func.Config.Types
18642 // match: (BitLen32 x)
18643 // result: (SUB (MOVDconst [32]) (CLZW <typ.Int> x))
18646 v.reset(OpARM64SUB)
18647 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
18648 v0.AuxInt = int64ToAuxInt(32)
18649 v1 := b.NewValue0(v.Pos, OpARM64CLZW, typ.Int)
18655 func rewriteValueARM64_OpBitLen64(v *Value) bool {
18658 typ := &b.Func.Config.Types
18659 // match: (BitLen64 x)
18660 // result: (SUB (MOVDconst [64]) (CLZ <typ.Int> x))
18663 v.reset(OpARM64SUB)
18664 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
18665 v0.AuxInt = int64ToAuxInt(64)
18666 v1 := b.NewValue0(v.Pos, OpARM64CLZ, typ.Int)
18672 func rewriteValueARM64_OpBitRev16(v *Value) bool {
18675 typ := &b.Func.Config.Types
18676 // match: (BitRev16 x)
18677 // result: (SRLconst [48] (RBIT <typ.UInt64> x))
18680 v.reset(OpARM64SRLconst)
18681 v.AuxInt = int64ToAuxInt(48)
18682 v0 := b.NewValue0(v.Pos, OpARM64RBIT, typ.UInt64)
18688 func rewriteValueARM64_OpBitRev8(v *Value) bool {
18691 typ := &b.Func.Config.Types
18692 // match: (BitRev8 x)
18693 // result: (SRLconst [56] (RBIT <typ.UInt64> x))
18696 v.reset(OpARM64SRLconst)
18697 v.AuxInt = int64ToAuxInt(56)
18698 v0 := b.NewValue0(v.Pos, OpARM64RBIT, typ.UInt64)
18704 func rewriteValueARM64_OpCondSelect(v *Value) bool {
18709 // match: (CondSelect x y boolval)
18710 // cond: flagArg(boolval) != nil
18711 // result: (CSEL [boolval.Op] x y flagArg(boolval))
18716 if !(flagArg(boolval) != nil) {
18719 v.reset(OpARM64CSEL)
18720 v.AuxInt = opToAuxInt(boolval.Op)
18721 v.AddArg3(x, y, flagArg(boolval))
18724 // match: (CondSelect x y boolval)
18725 // cond: flagArg(boolval) == nil
18726 // result: (CSEL [OpARM64NotEqual] x y (TSTWconst [1] boolval))
18731 if !(flagArg(boolval) == nil) {
18734 v.reset(OpARM64CSEL)
18735 v.AuxInt = opToAuxInt(OpARM64NotEqual)
18736 v0 := b.NewValue0(v.Pos, OpARM64TSTWconst, types.TypeFlags)
18737 v0.AuxInt = int32ToAuxInt(1)
18739 v.AddArg3(x, y, v0)
18744 func rewriteValueARM64_OpConst16(v *Value) bool {
18745 // match: (Const16 [val])
18746 // result: (MOVDconst [int64(val)])
18748 val := auxIntToInt16(v.AuxInt)
18749 v.reset(OpARM64MOVDconst)
18750 v.AuxInt = int64ToAuxInt(int64(val))
18754 func rewriteValueARM64_OpConst32(v *Value) bool {
18755 // match: (Const32 [val])
18756 // result: (MOVDconst [int64(val)])
18758 val := auxIntToInt32(v.AuxInt)
18759 v.reset(OpARM64MOVDconst)
18760 v.AuxInt = int64ToAuxInt(int64(val))
18764 func rewriteValueARM64_OpConst32F(v *Value) bool {
18765 // match: (Const32F [val])
18766 // result: (FMOVSconst [float64(val)])
18768 val := auxIntToFloat32(v.AuxInt)
18769 v.reset(OpARM64FMOVSconst)
18770 v.AuxInt = float64ToAuxInt(float64(val))
18774 func rewriteValueARM64_OpConst64(v *Value) bool {
18775 // match: (Const64 [val])
18776 // result: (MOVDconst [int64(val)])
18778 val := auxIntToInt64(v.AuxInt)
18779 v.reset(OpARM64MOVDconst)
18780 v.AuxInt = int64ToAuxInt(int64(val))
18784 func rewriteValueARM64_OpConst64F(v *Value) bool {
18785 // match: (Const64F [val])
18786 // result: (FMOVDconst [float64(val)])
18788 val := auxIntToFloat64(v.AuxInt)
18789 v.reset(OpARM64FMOVDconst)
18790 v.AuxInt = float64ToAuxInt(float64(val))
18794 func rewriteValueARM64_OpConst8(v *Value) bool {
18795 // match: (Const8 [val])
18796 // result: (MOVDconst [int64(val)])
18798 val := auxIntToInt8(v.AuxInt)
18799 v.reset(OpARM64MOVDconst)
18800 v.AuxInt = int64ToAuxInt(int64(val))
18804 func rewriteValueARM64_OpConstBool(v *Value) bool {
18805 // match: (ConstBool [t])
18806 // result: (MOVDconst [b2i(t)])
18808 t := auxIntToBool(v.AuxInt)
18809 v.reset(OpARM64MOVDconst)
18810 v.AuxInt = int64ToAuxInt(b2i(t))
18814 func rewriteValueARM64_OpConstNil(v *Value) bool {
18815 // match: (ConstNil)
18816 // result: (MOVDconst [0])
18818 v.reset(OpARM64MOVDconst)
18819 v.AuxInt = int64ToAuxInt(0)
18823 func rewriteValueARM64_OpCtz16(v *Value) bool {
18826 typ := &b.Func.Config.Types
18827 // match: (Ctz16 <t> x)
18828 // result: (CLZW <t> (RBITW <typ.UInt32> (ORconst <typ.UInt32> [0x10000] x)))
18832 v.reset(OpARM64CLZW)
18834 v0 := b.NewValue0(v.Pos, OpARM64RBITW, typ.UInt32)
18835 v1 := b.NewValue0(v.Pos, OpARM64ORconst, typ.UInt32)
18836 v1.AuxInt = int64ToAuxInt(0x10000)
18843 func rewriteValueARM64_OpCtz32(v *Value) bool {
18846 // match: (Ctz32 <t> x)
18847 // result: (CLZW (RBITW <t> x))
18851 v.reset(OpARM64CLZW)
18852 v0 := b.NewValue0(v.Pos, OpARM64RBITW, t)
18858 func rewriteValueARM64_OpCtz64(v *Value) bool {
18861 // match: (Ctz64 <t> x)
18862 // result: (CLZ (RBIT <t> x))
18866 v.reset(OpARM64CLZ)
18867 v0 := b.NewValue0(v.Pos, OpARM64RBIT, t)
18873 func rewriteValueARM64_OpCtz8(v *Value) bool {
18876 typ := &b.Func.Config.Types
18877 // match: (Ctz8 <t> x)
18878 // result: (CLZW <t> (RBITW <typ.UInt32> (ORconst <typ.UInt32> [0x100] x)))
18882 v.reset(OpARM64CLZW)
18884 v0 := b.NewValue0(v.Pos, OpARM64RBITW, typ.UInt32)
18885 v1 := b.NewValue0(v.Pos, OpARM64ORconst, typ.UInt32)
18886 v1.AuxInt = int64ToAuxInt(0x100)
18893 func rewriteValueARM64_OpDiv16(v *Value) bool {
18897 typ := &b.Func.Config.Types
18898 // match: (Div16 [false] x y)
18899 // result: (DIVW (SignExt16to32 x) (SignExt16to32 y))
18901 if auxIntToBool(v.AuxInt) != false {
18906 v.reset(OpARM64DIVW)
18907 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
18909 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
18916 func rewriteValueARM64_OpDiv16u(v *Value) bool {
18920 typ := &b.Func.Config.Types
18921 // match: (Div16u x y)
18922 // result: (UDIVW (ZeroExt16to32 x) (ZeroExt16to32 y))
18926 v.reset(OpARM64UDIVW)
18927 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
18929 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
18935 func rewriteValueARM64_OpDiv32(v *Value) bool {
18938 // match: (Div32 [false] x y)
18939 // result: (DIVW x y)
18941 if auxIntToBool(v.AuxInt) != false {
18946 v.reset(OpARM64DIVW)
18952 func rewriteValueARM64_OpDiv64(v *Value) bool {
18955 // match: (Div64 [false] x y)
18956 // result: (DIV x y)
18958 if auxIntToBool(v.AuxInt) != false {
18963 v.reset(OpARM64DIV)
18969 func rewriteValueARM64_OpDiv8(v *Value) bool {
18973 typ := &b.Func.Config.Types
18974 // match: (Div8 x y)
18975 // result: (DIVW (SignExt8to32 x) (SignExt8to32 y))
18979 v.reset(OpARM64DIVW)
18980 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
18982 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
18988 func rewriteValueARM64_OpDiv8u(v *Value) bool {
18992 typ := &b.Func.Config.Types
18993 // match: (Div8u x y)
18994 // result: (UDIVW (ZeroExt8to32 x) (ZeroExt8to32 y))
18998 v.reset(OpARM64UDIVW)
18999 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
19001 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
19007 func rewriteValueARM64_OpEq16(v *Value) bool {
19011 typ := &b.Func.Config.Types
19012 // match: (Eq16 x y)
19013 // result: (Equal (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
19017 v.reset(OpARM64Equal)
19018 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19019 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
19021 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
19028 func rewriteValueARM64_OpEq32(v *Value) bool {
19032 // match: (Eq32 x y)
19033 // result: (Equal (CMPW x y))
19037 v.reset(OpARM64Equal)
19038 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19044 func rewriteValueARM64_OpEq32F(v *Value) bool {
19048 // match: (Eq32F x y)
19049 // result: (Equal (FCMPS x y))
19053 v.reset(OpARM64Equal)
19054 v0 := b.NewValue0(v.Pos, OpARM64FCMPS, types.TypeFlags)
19060 func rewriteValueARM64_OpEq64(v *Value) bool {
19064 // match: (Eq64 x y)
19065 // result: (Equal (CMP x y))
19069 v.reset(OpARM64Equal)
19070 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
19076 func rewriteValueARM64_OpEq64F(v *Value) bool {
19080 // match: (Eq64F x y)
19081 // result: (Equal (FCMPD x y))
19085 v.reset(OpARM64Equal)
19086 v0 := b.NewValue0(v.Pos, OpARM64FCMPD, types.TypeFlags)
19092 func rewriteValueARM64_OpEq8(v *Value) bool {
19096 typ := &b.Func.Config.Types
19097 // match: (Eq8 x y)
19098 // result: (Equal (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
19102 v.reset(OpARM64Equal)
19103 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19104 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
19106 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
19113 func rewriteValueARM64_OpEqB(v *Value) bool {
19117 typ := &b.Func.Config.Types
19118 // match: (EqB x y)
19119 // result: (XOR (MOVDconst [1]) (XOR <typ.Bool> x y))
19123 v.reset(OpARM64XOR)
19124 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
19125 v0.AuxInt = int64ToAuxInt(1)
19126 v1 := b.NewValue0(v.Pos, OpARM64XOR, typ.Bool)
19132 func rewriteValueARM64_OpEqPtr(v *Value) bool {
19136 // match: (EqPtr x y)
19137 // result: (Equal (CMP x y))
19141 v.reset(OpARM64Equal)
19142 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
19148 func rewriteValueARM64_OpFMA(v *Value) bool {
19152 // match: (FMA x y z)
19153 // result: (FMADDD z x y)
19158 v.reset(OpARM64FMADDD)
19163 func rewriteValueARM64_OpHmul32(v *Value) bool {
19167 typ := &b.Func.Config.Types
19168 // match: (Hmul32 x y)
19169 // result: (SRAconst (MULL <typ.Int64> x y) [32])
19173 v.reset(OpARM64SRAconst)
19174 v.AuxInt = int64ToAuxInt(32)
19175 v0 := b.NewValue0(v.Pos, OpARM64MULL, typ.Int64)
19181 func rewriteValueARM64_OpHmul32u(v *Value) bool {
19185 typ := &b.Func.Config.Types
19186 // match: (Hmul32u x y)
19187 // result: (SRAconst (UMULL <typ.UInt64> x y) [32])
19191 v.reset(OpARM64SRAconst)
19192 v.AuxInt = int64ToAuxInt(32)
19193 v0 := b.NewValue0(v.Pos, OpARM64UMULL, typ.UInt64)
19199 func rewriteValueARM64_OpIsInBounds(v *Value) bool {
19203 // match: (IsInBounds idx len)
19204 // result: (LessThanU (CMP idx len))
19208 v.reset(OpARM64LessThanU)
19209 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
19210 v0.AddArg2(idx, len)
19215 func rewriteValueARM64_OpIsNonNil(v *Value) bool {
19218 // match: (IsNonNil ptr)
19219 // result: (NotEqual (CMPconst [0] ptr))
19222 v.reset(OpARM64NotEqual)
19223 v0 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
19224 v0.AuxInt = int64ToAuxInt(0)
19230 func rewriteValueARM64_OpIsSliceInBounds(v *Value) bool {
19234 // match: (IsSliceInBounds idx len)
19235 // result: (LessEqualU (CMP idx len))
19239 v.reset(OpARM64LessEqualU)
19240 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
19241 v0.AddArg2(idx, len)
19246 func rewriteValueARM64_OpLeq16(v *Value) bool {
19250 typ := &b.Func.Config.Types
19251 // match: (Leq16 x y)
19252 // result: (LessEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
19256 v.reset(OpARM64LessEqual)
19257 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19258 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
19260 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
19267 func rewriteValueARM64_OpLeq16U(v *Value) bool {
19271 typ := &b.Func.Config.Types
19272 // match: (Leq16U x zero:(MOVDconst [0]))
19273 // result: (Eq16 x zero)
19277 if zero.Op != OpARM64MOVDconst || auxIntToInt64(zero.AuxInt) != 0 {
19284 // match: (Leq16U (MOVDconst [1]) x)
19285 // result: (Neq16 (MOVDconst [0]) x)
19287 if v_0.Op != OpARM64MOVDconst || auxIntToInt64(v_0.AuxInt) != 1 {
19292 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
19293 v0.AuxInt = int64ToAuxInt(0)
19297 // match: (Leq16U x y)
19298 // result: (LessEqualU (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
19302 v.reset(OpARM64LessEqualU)
19303 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19304 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
19306 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
19313 func rewriteValueARM64_OpLeq32(v *Value) bool {
19317 // match: (Leq32 x y)
19318 // result: (LessEqual (CMPW x y))
19322 v.reset(OpARM64LessEqual)
19323 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19329 func rewriteValueARM64_OpLeq32F(v *Value) bool {
19333 // match: (Leq32F x y)
19334 // result: (LessEqualF (FCMPS x y))
19338 v.reset(OpARM64LessEqualF)
19339 v0 := b.NewValue0(v.Pos, OpARM64FCMPS, types.TypeFlags)
19345 func rewriteValueARM64_OpLeq32U(v *Value) bool {
19349 typ := &b.Func.Config.Types
19350 // match: (Leq32U x zero:(MOVDconst [0]))
19351 // result: (Eq32 x zero)
19355 if zero.Op != OpARM64MOVDconst || auxIntToInt64(zero.AuxInt) != 0 {
19362 // match: (Leq32U (MOVDconst [1]) x)
19363 // result: (Neq32 (MOVDconst [0]) x)
19365 if v_0.Op != OpARM64MOVDconst || auxIntToInt64(v_0.AuxInt) != 1 {
19370 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
19371 v0.AuxInt = int64ToAuxInt(0)
19375 // match: (Leq32U x y)
19376 // result: (LessEqualU (CMPW x y))
19380 v.reset(OpARM64LessEqualU)
19381 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19387 func rewriteValueARM64_OpLeq64(v *Value) bool {
19391 // match: (Leq64 x y)
19392 // result: (LessEqual (CMP x y))
19396 v.reset(OpARM64LessEqual)
19397 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
19403 func rewriteValueARM64_OpLeq64F(v *Value) bool {
19407 // match: (Leq64F x y)
19408 // result: (LessEqualF (FCMPD x y))
19412 v.reset(OpARM64LessEqualF)
19413 v0 := b.NewValue0(v.Pos, OpARM64FCMPD, types.TypeFlags)
19419 func rewriteValueARM64_OpLeq64U(v *Value) bool {
19423 typ := &b.Func.Config.Types
19424 // match: (Leq64U x zero:(MOVDconst [0]))
19425 // result: (Eq64 x zero)
19429 if zero.Op != OpARM64MOVDconst || auxIntToInt64(zero.AuxInt) != 0 {
19436 // match: (Leq64U (MOVDconst [1]) x)
19437 // result: (Neq64 (MOVDconst [0]) x)
19439 if v_0.Op != OpARM64MOVDconst || auxIntToInt64(v_0.AuxInt) != 1 {
19444 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
19445 v0.AuxInt = int64ToAuxInt(0)
19449 // match: (Leq64U x y)
19450 // result: (LessEqualU (CMP x y))
19454 v.reset(OpARM64LessEqualU)
19455 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
19461 func rewriteValueARM64_OpLeq8(v *Value) bool {
19465 typ := &b.Func.Config.Types
19466 // match: (Leq8 x y)
19467 // result: (LessEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
19471 v.reset(OpARM64LessEqual)
19472 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19473 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
19475 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
19482 func rewriteValueARM64_OpLeq8U(v *Value) bool {
19486 typ := &b.Func.Config.Types
19487 // match: (Leq8U x zero:(MOVDconst [0]))
19488 // result: (Eq8 x zero)
19492 if zero.Op != OpARM64MOVDconst || auxIntToInt64(zero.AuxInt) != 0 {
19499 // match: (Leq8U (MOVDconst [1]) x)
19500 // result: (Neq8 (MOVDconst [0]) x)
19502 if v_0.Op != OpARM64MOVDconst || auxIntToInt64(v_0.AuxInt) != 1 {
19507 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
19508 v0.AuxInt = int64ToAuxInt(0)
19512 // match: (Leq8U x y)
19513 // result: (LessEqualU (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
19517 v.reset(OpARM64LessEqualU)
19518 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19519 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
19521 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
19528 func rewriteValueARM64_OpLess16(v *Value) bool {
19532 typ := &b.Func.Config.Types
19533 // match: (Less16 x y)
19534 // result: (LessThan (CMPW (SignExt16to32 x) (SignExt16to32 y)))
19538 v.reset(OpARM64LessThan)
19539 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19540 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
19542 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
19549 func rewriteValueARM64_OpLess16U(v *Value) bool {
19553 typ := &b.Func.Config.Types
19554 // match: (Less16U zero:(MOVDconst [0]) x)
19555 // result: (Neq16 zero x)
19558 if zero.Op != OpARM64MOVDconst || auxIntToInt64(zero.AuxInt) != 0 {
19566 // match: (Less16U x (MOVDconst [1]))
19567 // result: (Eq16 x (MOVDconst [0]))
19570 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
19574 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
19575 v0.AuxInt = int64ToAuxInt(0)
19579 // match: (Less16U x y)
19580 // result: (LessThanU (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
19584 v.reset(OpARM64LessThanU)
19585 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19586 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
19588 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
19595 func rewriteValueARM64_OpLess32(v *Value) bool {
19599 // match: (Less32 x y)
19600 // result: (LessThan (CMPW x y))
19604 v.reset(OpARM64LessThan)
19605 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19611 func rewriteValueARM64_OpLess32F(v *Value) bool {
19615 // match: (Less32F x y)
19616 // result: (LessThanF (FCMPS x y))
19620 v.reset(OpARM64LessThanF)
19621 v0 := b.NewValue0(v.Pos, OpARM64FCMPS, types.TypeFlags)
19627 func rewriteValueARM64_OpLess32U(v *Value) bool {
19631 typ := &b.Func.Config.Types
19632 // match: (Less32U zero:(MOVDconst [0]) x)
19633 // result: (Neq32 zero x)
19636 if zero.Op != OpARM64MOVDconst || auxIntToInt64(zero.AuxInt) != 0 {
19644 // match: (Less32U x (MOVDconst [1]))
19645 // result: (Eq32 x (MOVDconst [0]))
19648 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
19652 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
19653 v0.AuxInt = int64ToAuxInt(0)
19657 // match: (Less32U x y)
19658 // result: (LessThanU (CMPW x y))
19662 v.reset(OpARM64LessThanU)
19663 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19669 func rewriteValueARM64_OpLess64(v *Value) bool {
19673 // match: (Less64 x y)
19674 // result: (LessThan (CMP x y))
19678 v.reset(OpARM64LessThan)
19679 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
19685 func rewriteValueARM64_OpLess64F(v *Value) bool {
19689 // match: (Less64F x y)
19690 // result: (LessThanF (FCMPD x y))
19694 v.reset(OpARM64LessThanF)
19695 v0 := b.NewValue0(v.Pos, OpARM64FCMPD, types.TypeFlags)
19701 func rewriteValueARM64_OpLess64U(v *Value) bool {
19705 typ := &b.Func.Config.Types
19706 // match: (Less64U zero:(MOVDconst [0]) x)
19707 // result: (Neq64 zero x)
19710 if zero.Op != OpARM64MOVDconst || auxIntToInt64(zero.AuxInt) != 0 {
19718 // match: (Less64U x (MOVDconst [1]))
19719 // result: (Eq64 x (MOVDconst [0]))
19722 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
19726 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
19727 v0.AuxInt = int64ToAuxInt(0)
19731 // match: (Less64U x y)
19732 // result: (LessThanU (CMP x y))
19736 v.reset(OpARM64LessThanU)
19737 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
19743 func rewriteValueARM64_OpLess8(v *Value) bool {
19747 typ := &b.Func.Config.Types
19748 // match: (Less8 x y)
19749 // result: (LessThan (CMPW (SignExt8to32 x) (SignExt8to32 y)))
19753 v.reset(OpARM64LessThan)
19754 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19755 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
19757 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
19764 func rewriteValueARM64_OpLess8U(v *Value) bool {
19768 typ := &b.Func.Config.Types
19769 // match: (Less8U zero:(MOVDconst [0]) x)
19770 // result: (Neq8 zero x)
19773 if zero.Op != OpARM64MOVDconst || auxIntToInt64(zero.AuxInt) != 0 {
19781 // match: (Less8U x (MOVDconst [1]))
19782 // result: (Eq8 x (MOVDconst [0]))
19785 if v_1.Op != OpARM64MOVDconst || auxIntToInt64(v_1.AuxInt) != 1 {
19789 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
19790 v0.AuxInt = int64ToAuxInt(0)
19794 // match: (Less8U x y)
19795 // result: (LessThanU (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
19799 v.reset(OpARM64LessThanU)
19800 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
19801 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
19803 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
19810 func rewriteValueARM64_OpLoad(v *Value) bool {
19813 // match: (Load <t> ptr mem)
19814 // cond: t.IsBoolean()
19815 // result: (MOVBUload ptr mem)
19820 if !(t.IsBoolean()) {
19823 v.reset(OpARM64MOVBUload)
19824 v.AddArg2(ptr, mem)
19827 // match: (Load <t> ptr mem)
19828 // cond: (is8BitInt(t) && t.IsSigned())
19829 // result: (MOVBload ptr mem)
19834 if !(is8BitInt(t) && t.IsSigned()) {
19837 v.reset(OpARM64MOVBload)
19838 v.AddArg2(ptr, mem)
19841 // match: (Load <t> ptr mem)
19842 // cond: (is8BitInt(t) && !t.IsSigned())
19843 // result: (MOVBUload ptr mem)
19848 if !(is8BitInt(t) && !t.IsSigned()) {
19851 v.reset(OpARM64MOVBUload)
19852 v.AddArg2(ptr, mem)
19855 // match: (Load <t> ptr mem)
19856 // cond: (is16BitInt(t) && t.IsSigned())
19857 // result: (MOVHload ptr mem)
19862 if !(is16BitInt(t) && t.IsSigned()) {
19865 v.reset(OpARM64MOVHload)
19866 v.AddArg2(ptr, mem)
19869 // match: (Load <t> ptr mem)
19870 // cond: (is16BitInt(t) && !t.IsSigned())
19871 // result: (MOVHUload ptr mem)
19876 if !(is16BitInt(t) && !t.IsSigned()) {
19879 v.reset(OpARM64MOVHUload)
19880 v.AddArg2(ptr, mem)
19883 // match: (Load <t> ptr mem)
19884 // cond: (is32BitInt(t) && t.IsSigned())
19885 // result: (MOVWload ptr mem)
19890 if !(is32BitInt(t) && t.IsSigned()) {
19893 v.reset(OpARM64MOVWload)
19894 v.AddArg2(ptr, mem)
19897 // match: (Load <t> ptr mem)
19898 // cond: (is32BitInt(t) && !t.IsSigned())
19899 // result: (MOVWUload ptr mem)
19904 if !(is32BitInt(t) && !t.IsSigned()) {
19907 v.reset(OpARM64MOVWUload)
19908 v.AddArg2(ptr, mem)
19911 // match: (Load <t> ptr mem)
19912 // cond: (is64BitInt(t) || isPtr(t))
19913 // result: (MOVDload ptr mem)
19918 if !(is64BitInt(t) || isPtr(t)) {
19921 v.reset(OpARM64MOVDload)
19922 v.AddArg2(ptr, mem)
19925 // match: (Load <t> ptr mem)
19926 // cond: is32BitFloat(t)
19927 // result: (FMOVSload ptr mem)
19932 if !(is32BitFloat(t)) {
19935 v.reset(OpARM64FMOVSload)
19936 v.AddArg2(ptr, mem)
19939 // match: (Load <t> ptr mem)
19940 // cond: is64BitFloat(t)
19941 // result: (FMOVDload ptr mem)
19946 if !(is64BitFloat(t)) {
19949 v.reset(OpARM64FMOVDload)
19950 v.AddArg2(ptr, mem)
19955 func rewriteValueARM64_OpLocalAddr(v *Value) bool {
19959 typ := &b.Func.Config.Types
19960 // match: (LocalAddr <t> {sym} base mem)
19961 // cond: t.Elem().HasPointers()
19962 // result: (MOVDaddr {sym} (SPanchored base mem))
19965 sym := auxToSym(v.Aux)
19968 if !(t.Elem().HasPointers()) {
19971 v.reset(OpARM64MOVDaddr)
19972 v.Aux = symToAux(sym)
19973 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr)
19974 v0.AddArg2(base, mem)
19978 // match: (LocalAddr <t> {sym} base _)
19979 // cond: !t.Elem().HasPointers()
19980 // result: (MOVDaddr {sym} base)
19983 sym := auxToSym(v.Aux)
19985 if !(!t.Elem().HasPointers()) {
19988 v.reset(OpARM64MOVDaddr)
19989 v.Aux = symToAux(sym)
19995 func rewriteValueARM64_OpLsh16x16(v *Value) bool {
19999 typ := &b.Func.Config.Types
20000 // match: (Lsh16x16 <t> x y)
20001 // cond: shiftIsBounded(v)
20002 // result: (SLL <t> x y)
20007 if !(shiftIsBounded(v)) {
20010 v.reset(OpARM64SLL)
20015 // match: (Lsh16x16 <t> x y)
20016 // cond: !shiftIsBounded(v)
20017 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt16to64 y)))
20022 if !(!shiftIsBounded(v)) {
20025 v.reset(OpARM64CSEL)
20026 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20027 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20029 v1 := b.NewValue0(v.Pos, OpConst64, t)
20030 v1.AuxInt = int64ToAuxInt(0)
20031 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20032 v2.AuxInt = int64ToAuxInt(64)
20033 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
20036 v.AddArg3(v0, v1, v2)
20041 func rewriteValueARM64_OpLsh16x32(v *Value) bool {
20045 typ := &b.Func.Config.Types
20046 // match: (Lsh16x32 <t> x y)
20047 // cond: shiftIsBounded(v)
20048 // result: (SLL <t> x y)
20053 if !(shiftIsBounded(v)) {
20056 v.reset(OpARM64SLL)
20061 // match: (Lsh16x32 <t> x y)
20062 // cond: !shiftIsBounded(v)
20063 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt32to64 y)))
20068 if !(!shiftIsBounded(v)) {
20071 v.reset(OpARM64CSEL)
20072 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20073 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20075 v1 := b.NewValue0(v.Pos, OpConst64, t)
20076 v1.AuxInt = int64ToAuxInt(0)
20077 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20078 v2.AuxInt = int64ToAuxInt(64)
20079 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
20082 v.AddArg3(v0, v1, v2)
20087 func rewriteValueARM64_OpLsh16x64(v *Value) bool {
20091 // match: (Lsh16x64 <t> x y)
20092 // cond: shiftIsBounded(v)
20093 // result: (SLL <t> x y)
20098 if !(shiftIsBounded(v)) {
20101 v.reset(OpARM64SLL)
20106 // match: (Lsh16x64 <t> x y)
20107 // cond: !shiftIsBounded(v)
20108 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] y))
20113 if !(!shiftIsBounded(v)) {
20116 v.reset(OpARM64CSEL)
20117 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20118 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20120 v1 := b.NewValue0(v.Pos, OpConst64, t)
20121 v1.AuxInt = int64ToAuxInt(0)
20122 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20123 v2.AuxInt = int64ToAuxInt(64)
20125 v.AddArg3(v0, v1, v2)
20130 func rewriteValueARM64_OpLsh16x8(v *Value) bool {
20134 typ := &b.Func.Config.Types
20135 // match: (Lsh16x8 <t> x y)
20136 // cond: shiftIsBounded(v)
20137 // result: (SLL <t> x y)
20142 if !(shiftIsBounded(v)) {
20145 v.reset(OpARM64SLL)
20150 // match: (Lsh16x8 <t> x y)
20151 // cond: !shiftIsBounded(v)
20152 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt8to64 y)))
20157 if !(!shiftIsBounded(v)) {
20160 v.reset(OpARM64CSEL)
20161 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20162 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20164 v1 := b.NewValue0(v.Pos, OpConst64, t)
20165 v1.AuxInt = int64ToAuxInt(0)
20166 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20167 v2.AuxInt = int64ToAuxInt(64)
20168 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
20171 v.AddArg3(v0, v1, v2)
20176 func rewriteValueARM64_OpLsh32x16(v *Value) bool {
20180 typ := &b.Func.Config.Types
20181 // match: (Lsh32x16 <t> x y)
20182 // cond: shiftIsBounded(v)
20183 // result: (SLL <t> x y)
20188 if !(shiftIsBounded(v)) {
20191 v.reset(OpARM64SLL)
20196 // match: (Lsh32x16 <t> x y)
20197 // cond: !shiftIsBounded(v)
20198 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt16to64 y)))
20203 if !(!shiftIsBounded(v)) {
20206 v.reset(OpARM64CSEL)
20207 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20208 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20210 v1 := b.NewValue0(v.Pos, OpConst64, t)
20211 v1.AuxInt = int64ToAuxInt(0)
20212 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20213 v2.AuxInt = int64ToAuxInt(64)
20214 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
20217 v.AddArg3(v0, v1, v2)
20222 func rewriteValueARM64_OpLsh32x32(v *Value) bool {
20226 typ := &b.Func.Config.Types
20227 // match: (Lsh32x32 <t> x y)
20228 // cond: shiftIsBounded(v)
20229 // result: (SLL <t> x y)
20234 if !(shiftIsBounded(v)) {
20237 v.reset(OpARM64SLL)
20242 // match: (Lsh32x32 <t> x y)
20243 // cond: !shiftIsBounded(v)
20244 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt32to64 y)))
20249 if !(!shiftIsBounded(v)) {
20252 v.reset(OpARM64CSEL)
20253 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20254 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20256 v1 := b.NewValue0(v.Pos, OpConst64, t)
20257 v1.AuxInt = int64ToAuxInt(0)
20258 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20259 v2.AuxInt = int64ToAuxInt(64)
20260 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
20263 v.AddArg3(v0, v1, v2)
20268 func rewriteValueARM64_OpLsh32x64(v *Value) bool {
20272 // match: (Lsh32x64 <t> x y)
20273 // cond: shiftIsBounded(v)
20274 // result: (SLL <t> x y)
20279 if !(shiftIsBounded(v)) {
20282 v.reset(OpARM64SLL)
20287 // match: (Lsh32x64 <t> x y)
20288 // cond: !shiftIsBounded(v)
20289 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] y))
20294 if !(!shiftIsBounded(v)) {
20297 v.reset(OpARM64CSEL)
20298 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20299 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20301 v1 := b.NewValue0(v.Pos, OpConst64, t)
20302 v1.AuxInt = int64ToAuxInt(0)
20303 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20304 v2.AuxInt = int64ToAuxInt(64)
20306 v.AddArg3(v0, v1, v2)
20311 func rewriteValueARM64_OpLsh32x8(v *Value) bool {
20315 typ := &b.Func.Config.Types
20316 // match: (Lsh32x8 <t> x y)
20317 // cond: shiftIsBounded(v)
20318 // result: (SLL <t> x y)
20323 if !(shiftIsBounded(v)) {
20326 v.reset(OpARM64SLL)
20331 // match: (Lsh32x8 <t> x y)
20332 // cond: !shiftIsBounded(v)
20333 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt8to64 y)))
20338 if !(!shiftIsBounded(v)) {
20341 v.reset(OpARM64CSEL)
20342 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20343 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20345 v1 := b.NewValue0(v.Pos, OpConst64, t)
20346 v1.AuxInt = int64ToAuxInt(0)
20347 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20348 v2.AuxInt = int64ToAuxInt(64)
20349 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
20352 v.AddArg3(v0, v1, v2)
20357 func rewriteValueARM64_OpLsh64x16(v *Value) bool {
20361 typ := &b.Func.Config.Types
20362 // match: (Lsh64x16 <t> x y)
20363 // cond: shiftIsBounded(v)
20364 // result: (SLL <t> x y)
20369 if !(shiftIsBounded(v)) {
20372 v.reset(OpARM64SLL)
20377 // match: (Lsh64x16 <t> x y)
20378 // cond: !shiftIsBounded(v)
20379 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt16to64 y)))
20384 if !(!shiftIsBounded(v)) {
20387 v.reset(OpARM64CSEL)
20388 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20389 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20391 v1 := b.NewValue0(v.Pos, OpConst64, t)
20392 v1.AuxInt = int64ToAuxInt(0)
20393 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20394 v2.AuxInt = int64ToAuxInt(64)
20395 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
20398 v.AddArg3(v0, v1, v2)
20403 func rewriteValueARM64_OpLsh64x32(v *Value) bool {
20407 typ := &b.Func.Config.Types
20408 // match: (Lsh64x32 <t> x y)
20409 // cond: shiftIsBounded(v)
20410 // result: (SLL <t> x y)
20415 if !(shiftIsBounded(v)) {
20418 v.reset(OpARM64SLL)
20423 // match: (Lsh64x32 <t> x y)
20424 // cond: !shiftIsBounded(v)
20425 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt32to64 y)))
20430 if !(!shiftIsBounded(v)) {
20433 v.reset(OpARM64CSEL)
20434 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20435 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20437 v1 := b.NewValue0(v.Pos, OpConst64, t)
20438 v1.AuxInt = int64ToAuxInt(0)
20439 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20440 v2.AuxInt = int64ToAuxInt(64)
20441 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
20444 v.AddArg3(v0, v1, v2)
20449 func rewriteValueARM64_OpLsh64x64(v *Value) bool {
20453 // match: (Lsh64x64 <t> x y)
20454 // cond: shiftIsBounded(v)
20455 // result: (SLL <t> x y)
20460 if !(shiftIsBounded(v)) {
20463 v.reset(OpARM64SLL)
20468 // match: (Lsh64x64 <t> x y)
20469 // cond: !shiftIsBounded(v)
20470 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] y))
20475 if !(!shiftIsBounded(v)) {
20478 v.reset(OpARM64CSEL)
20479 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20480 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20482 v1 := b.NewValue0(v.Pos, OpConst64, t)
20483 v1.AuxInt = int64ToAuxInt(0)
20484 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20485 v2.AuxInt = int64ToAuxInt(64)
20487 v.AddArg3(v0, v1, v2)
20492 func rewriteValueARM64_OpLsh64x8(v *Value) bool {
20496 typ := &b.Func.Config.Types
20497 // match: (Lsh64x8 <t> x y)
20498 // cond: shiftIsBounded(v)
20499 // result: (SLL <t> x y)
20504 if !(shiftIsBounded(v)) {
20507 v.reset(OpARM64SLL)
20512 // match: (Lsh64x8 <t> x y)
20513 // cond: !shiftIsBounded(v)
20514 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt8to64 y)))
20519 if !(!shiftIsBounded(v)) {
20522 v.reset(OpARM64CSEL)
20523 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20524 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20526 v1 := b.NewValue0(v.Pos, OpConst64, t)
20527 v1.AuxInt = int64ToAuxInt(0)
20528 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20529 v2.AuxInt = int64ToAuxInt(64)
20530 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
20533 v.AddArg3(v0, v1, v2)
20538 func rewriteValueARM64_OpLsh8x16(v *Value) bool {
20542 typ := &b.Func.Config.Types
20543 // match: (Lsh8x16 <t> x y)
20544 // cond: shiftIsBounded(v)
20545 // result: (SLL <t> x y)
20550 if !(shiftIsBounded(v)) {
20553 v.reset(OpARM64SLL)
20558 // match: (Lsh8x16 <t> x y)
20559 // cond: !shiftIsBounded(v)
20560 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt16to64 y)))
20565 if !(!shiftIsBounded(v)) {
20568 v.reset(OpARM64CSEL)
20569 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20570 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20572 v1 := b.NewValue0(v.Pos, OpConst64, t)
20573 v1.AuxInt = int64ToAuxInt(0)
20574 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20575 v2.AuxInt = int64ToAuxInt(64)
20576 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
20579 v.AddArg3(v0, v1, v2)
20584 func rewriteValueARM64_OpLsh8x32(v *Value) bool {
20588 typ := &b.Func.Config.Types
20589 // match: (Lsh8x32 <t> x y)
20590 // cond: shiftIsBounded(v)
20591 // result: (SLL <t> x y)
20596 if !(shiftIsBounded(v)) {
20599 v.reset(OpARM64SLL)
20604 // match: (Lsh8x32 <t> x y)
20605 // cond: !shiftIsBounded(v)
20606 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt32to64 y)))
20611 if !(!shiftIsBounded(v)) {
20614 v.reset(OpARM64CSEL)
20615 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20616 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20618 v1 := b.NewValue0(v.Pos, OpConst64, t)
20619 v1.AuxInt = int64ToAuxInt(0)
20620 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20621 v2.AuxInt = int64ToAuxInt(64)
20622 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
20625 v.AddArg3(v0, v1, v2)
20630 func rewriteValueARM64_OpLsh8x64(v *Value) bool {
20634 // match: (Lsh8x64 <t> x y)
20635 // cond: shiftIsBounded(v)
20636 // result: (SLL <t> x y)
20641 if !(shiftIsBounded(v)) {
20644 v.reset(OpARM64SLL)
20649 // match: (Lsh8x64 <t> x y)
20650 // cond: !shiftIsBounded(v)
20651 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] y))
20656 if !(!shiftIsBounded(v)) {
20659 v.reset(OpARM64CSEL)
20660 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20661 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20663 v1 := b.NewValue0(v.Pos, OpConst64, t)
20664 v1.AuxInt = int64ToAuxInt(0)
20665 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20666 v2.AuxInt = int64ToAuxInt(64)
20668 v.AddArg3(v0, v1, v2)
20673 func rewriteValueARM64_OpLsh8x8(v *Value) bool {
20677 typ := &b.Func.Config.Types
20678 // match: (Lsh8x8 <t> x y)
20679 // cond: shiftIsBounded(v)
20680 // result: (SLL <t> x y)
20685 if !(shiftIsBounded(v)) {
20688 v.reset(OpARM64SLL)
20693 // match: (Lsh8x8 <t> x y)
20694 // cond: !shiftIsBounded(v)
20695 // result: (CSEL [OpARM64LessThanU] (SLL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt8to64 y)))
20700 if !(!shiftIsBounded(v)) {
20703 v.reset(OpARM64CSEL)
20704 v.AuxInt = opToAuxInt(OpARM64LessThanU)
20705 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
20707 v1 := b.NewValue0(v.Pos, OpConst64, t)
20708 v1.AuxInt = int64ToAuxInt(0)
20709 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
20710 v2.AuxInt = int64ToAuxInt(64)
20711 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
20714 v.AddArg3(v0, v1, v2)
20719 func rewriteValueARM64_OpMod16(v *Value) bool {
20723 typ := &b.Func.Config.Types
20724 // match: (Mod16 x y)
20725 // result: (MODW (SignExt16to32 x) (SignExt16to32 y))
20729 v.reset(OpARM64MODW)
20730 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
20732 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
20738 func rewriteValueARM64_OpMod16u(v *Value) bool {
20742 typ := &b.Func.Config.Types
20743 // match: (Mod16u x y)
20744 // result: (UMODW (ZeroExt16to32 x) (ZeroExt16to32 y))
20748 v.reset(OpARM64UMODW)
20749 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
20751 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
20757 func rewriteValueARM64_OpMod32(v *Value) bool {
20760 // match: (Mod32 x y)
20761 // result: (MODW x y)
20765 v.reset(OpARM64MODW)
20770 func rewriteValueARM64_OpMod64(v *Value) bool {
20773 // match: (Mod64 x y)
20774 // result: (MOD x y)
20778 v.reset(OpARM64MOD)
20783 func rewriteValueARM64_OpMod8(v *Value) bool {
20787 typ := &b.Func.Config.Types
20788 // match: (Mod8 x y)
20789 // result: (MODW (SignExt8to32 x) (SignExt8to32 y))
20793 v.reset(OpARM64MODW)
20794 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
20796 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
20802 func rewriteValueARM64_OpMod8u(v *Value) bool {
20806 typ := &b.Func.Config.Types
20807 // match: (Mod8u x y)
20808 // result: (UMODW (ZeroExt8to32 x) (ZeroExt8to32 y))
20812 v.reset(OpARM64UMODW)
20813 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
20815 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
20821 func rewriteValueARM64_OpMove(v *Value) bool {
20826 config := b.Func.Config
20827 typ := &b.Func.Config.Types
20828 // match: (Move [0] _ _ mem)
20831 if auxIntToInt64(v.AuxInt) != 0 {
20838 // match: (Move [1] dst src mem)
20839 // result: (MOVBstore dst (MOVBUload src mem) mem)
20841 if auxIntToInt64(v.AuxInt) != 1 {
20847 v.reset(OpARM64MOVBstore)
20848 v0 := b.NewValue0(v.Pos, OpARM64MOVBUload, typ.UInt8)
20849 v0.AddArg2(src, mem)
20850 v.AddArg3(dst, v0, mem)
20853 // match: (Move [2] dst src mem)
20854 // result: (MOVHstore dst (MOVHUload src mem) mem)
20856 if auxIntToInt64(v.AuxInt) != 2 {
20862 v.reset(OpARM64MOVHstore)
20863 v0 := b.NewValue0(v.Pos, OpARM64MOVHUload, typ.UInt16)
20864 v0.AddArg2(src, mem)
20865 v.AddArg3(dst, v0, mem)
20868 // match: (Move [3] dst src mem)
20869 // result: (MOVBstore [2] dst (MOVBUload [2] src mem) (MOVHstore dst (MOVHUload src mem) mem))
20871 if auxIntToInt64(v.AuxInt) != 3 {
20877 v.reset(OpARM64MOVBstore)
20878 v.AuxInt = int32ToAuxInt(2)
20879 v0 := b.NewValue0(v.Pos, OpARM64MOVBUload, typ.UInt8)
20880 v0.AuxInt = int32ToAuxInt(2)
20881 v0.AddArg2(src, mem)
20882 v1 := b.NewValue0(v.Pos, OpARM64MOVHstore, types.TypeMem)
20883 v2 := b.NewValue0(v.Pos, OpARM64MOVHUload, typ.UInt16)
20884 v2.AddArg2(src, mem)
20885 v1.AddArg3(dst, v2, mem)
20886 v.AddArg3(dst, v0, v1)
20889 // match: (Move [4] dst src mem)
20890 // result: (MOVWstore dst (MOVWUload src mem) mem)
20892 if auxIntToInt64(v.AuxInt) != 4 {
20898 v.reset(OpARM64MOVWstore)
20899 v0 := b.NewValue0(v.Pos, OpARM64MOVWUload, typ.UInt32)
20900 v0.AddArg2(src, mem)
20901 v.AddArg3(dst, v0, mem)
20904 // match: (Move [5] dst src mem)
20905 // result: (MOVBstore [4] dst (MOVBUload [4] src mem) (MOVWstore dst (MOVWUload src mem) mem))
20907 if auxIntToInt64(v.AuxInt) != 5 {
20913 v.reset(OpARM64MOVBstore)
20914 v.AuxInt = int32ToAuxInt(4)
20915 v0 := b.NewValue0(v.Pos, OpARM64MOVBUload, typ.UInt8)
20916 v0.AuxInt = int32ToAuxInt(4)
20917 v0.AddArg2(src, mem)
20918 v1 := b.NewValue0(v.Pos, OpARM64MOVWstore, types.TypeMem)
20919 v2 := b.NewValue0(v.Pos, OpARM64MOVWUload, typ.UInt32)
20920 v2.AddArg2(src, mem)
20921 v1.AddArg3(dst, v2, mem)
20922 v.AddArg3(dst, v0, v1)
20925 // match: (Move [6] dst src mem)
20926 // result: (MOVHstore [4] dst (MOVHUload [4] src mem) (MOVWstore dst (MOVWUload src mem) mem))
20928 if auxIntToInt64(v.AuxInt) != 6 {
20934 v.reset(OpARM64MOVHstore)
20935 v.AuxInt = int32ToAuxInt(4)
20936 v0 := b.NewValue0(v.Pos, OpARM64MOVHUload, typ.UInt16)
20937 v0.AuxInt = int32ToAuxInt(4)
20938 v0.AddArg2(src, mem)
20939 v1 := b.NewValue0(v.Pos, OpARM64MOVWstore, types.TypeMem)
20940 v2 := b.NewValue0(v.Pos, OpARM64MOVWUload, typ.UInt32)
20941 v2.AddArg2(src, mem)
20942 v1.AddArg3(dst, v2, mem)
20943 v.AddArg3(dst, v0, v1)
20946 // match: (Move [7] dst src mem)
20947 // result: (MOVWstore [3] dst (MOVWUload [3] src mem) (MOVWstore dst (MOVWUload src mem) mem))
20949 if auxIntToInt64(v.AuxInt) != 7 {
20955 v.reset(OpARM64MOVWstore)
20956 v.AuxInt = int32ToAuxInt(3)
20957 v0 := b.NewValue0(v.Pos, OpARM64MOVWUload, typ.UInt32)
20958 v0.AuxInt = int32ToAuxInt(3)
20959 v0.AddArg2(src, mem)
20960 v1 := b.NewValue0(v.Pos, OpARM64MOVWstore, types.TypeMem)
20961 v2 := b.NewValue0(v.Pos, OpARM64MOVWUload, typ.UInt32)
20962 v2.AddArg2(src, mem)
20963 v1.AddArg3(dst, v2, mem)
20964 v.AddArg3(dst, v0, v1)
20967 // match: (Move [8] dst src mem)
20968 // result: (MOVDstore dst (MOVDload src mem) mem)
20970 if auxIntToInt64(v.AuxInt) != 8 {
20976 v.reset(OpARM64MOVDstore)
20977 v0 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
20978 v0.AddArg2(src, mem)
20979 v.AddArg3(dst, v0, mem)
20982 // match: (Move [9] dst src mem)
20983 // result: (MOVBstore [8] dst (MOVBUload [8] src mem) (MOVDstore dst (MOVDload src mem) mem))
20985 if auxIntToInt64(v.AuxInt) != 9 {
20991 v.reset(OpARM64MOVBstore)
20992 v.AuxInt = int32ToAuxInt(8)
20993 v0 := b.NewValue0(v.Pos, OpARM64MOVBUload, typ.UInt8)
20994 v0.AuxInt = int32ToAuxInt(8)
20995 v0.AddArg2(src, mem)
20996 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
20997 v2 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
20998 v2.AddArg2(src, mem)
20999 v1.AddArg3(dst, v2, mem)
21000 v.AddArg3(dst, v0, v1)
21003 // match: (Move [10] dst src mem)
21004 // result: (MOVHstore [8] dst (MOVHUload [8] src mem) (MOVDstore dst (MOVDload src mem) mem))
21006 if auxIntToInt64(v.AuxInt) != 10 {
21012 v.reset(OpARM64MOVHstore)
21013 v.AuxInt = int32ToAuxInt(8)
21014 v0 := b.NewValue0(v.Pos, OpARM64MOVHUload, typ.UInt16)
21015 v0.AuxInt = int32ToAuxInt(8)
21016 v0.AddArg2(src, mem)
21017 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
21018 v2 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21019 v2.AddArg2(src, mem)
21020 v1.AddArg3(dst, v2, mem)
21021 v.AddArg3(dst, v0, v1)
21024 // match: (Move [11] dst src mem)
21025 // result: (MOVDstore [3] dst (MOVDload [3] src mem) (MOVDstore dst (MOVDload src mem) mem))
21027 if auxIntToInt64(v.AuxInt) != 11 {
21033 v.reset(OpARM64MOVDstore)
21034 v.AuxInt = int32ToAuxInt(3)
21035 v0 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21036 v0.AuxInt = int32ToAuxInt(3)
21037 v0.AddArg2(src, mem)
21038 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
21039 v2 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21040 v2.AddArg2(src, mem)
21041 v1.AddArg3(dst, v2, mem)
21042 v.AddArg3(dst, v0, v1)
21045 // match: (Move [12] dst src mem)
21046 // result: (MOVWstore [8] dst (MOVWUload [8] src mem) (MOVDstore dst (MOVDload src mem) mem))
21048 if auxIntToInt64(v.AuxInt) != 12 {
21054 v.reset(OpARM64MOVWstore)
21055 v.AuxInt = int32ToAuxInt(8)
21056 v0 := b.NewValue0(v.Pos, OpARM64MOVWUload, typ.UInt32)
21057 v0.AuxInt = int32ToAuxInt(8)
21058 v0.AddArg2(src, mem)
21059 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
21060 v2 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21061 v2.AddArg2(src, mem)
21062 v1.AddArg3(dst, v2, mem)
21063 v.AddArg3(dst, v0, v1)
21066 // match: (Move [13] dst src mem)
21067 // result: (MOVDstore [5] dst (MOVDload [5] src mem) (MOVDstore dst (MOVDload src mem) mem))
21069 if auxIntToInt64(v.AuxInt) != 13 {
21075 v.reset(OpARM64MOVDstore)
21076 v.AuxInt = int32ToAuxInt(5)
21077 v0 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21078 v0.AuxInt = int32ToAuxInt(5)
21079 v0.AddArg2(src, mem)
21080 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
21081 v2 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21082 v2.AddArg2(src, mem)
21083 v1.AddArg3(dst, v2, mem)
21084 v.AddArg3(dst, v0, v1)
21087 // match: (Move [14] dst src mem)
21088 // result: (MOVDstore [6] dst (MOVDload [6] src mem) (MOVDstore dst (MOVDload src mem) mem))
21090 if auxIntToInt64(v.AuxInt) != 14 {
21096 v.reset(OpARM64MOVDstore)
21097 v.AuxInt = int32ToAuxInt(6)
21098 v0 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21099 v0.AuxInt = int32ToAuxInt(6)
21100 v0.AddArg2(src, mem)
21101 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
21102 v2 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21103 v2.AddArg2(src, mem)
21104 v1.AddArg3(dst, v2, mem)
21105 v.AddArg3(dst, v0, v1)
21108 // match: (Move [15] dst src mem)
21109 // result: (MOVDstore [7] dst (MOVDload [7] src mem) (MOVDstore dst (MOVDload src mem) mem))
21111 if auxIntToInt64(v.AuxInt) != 15 {
21117 v.reset(OpARM64MOVDstore)
21118 v.AuxInt = int32ToAuxInt(7)
21119 v0 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21120 v0.AuxInt = int32ToAuxInt(7)
21121 v0.AddArg2(src, mem)
21122 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
21123 v2 := b.NewValue0(v.Pos, OpARM64MOVDload, typ.UInt64)
21124 v2.AddArg2(src, mem)
21125 v1.AddArg3(dst, v2, mem)
21126 v.AddArg3(dst, v0, v1)
21129 // match: (Move [16] dst src mem)
21130 // result: (STP dst (Select0 <typ.UInt64> (LDP src mem)) (Select1 <typ.UInt64> (LDP src mem)) mem)
21132 if auxIntToInt64(v.AuxInt) != 16 {
21138 v.reset(OpARM64STP)
21139 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21140 v1 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21141 v1.AddArg2(src, mem)
21143 v2 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21145 v.AddArg4(dst, v0, v2, mem)
21148 // match: (Move [32] dst src mem)
21149 // result: (STP [16] dst (Select0 <typ.UInt64> (LDP [16] src mem)) (Select1 <typ.UInt64> (LDP [16] src mem)) (STP dst (Select0 <typ.UInt64> (LDP src mem)) (Select1 <typ.UInt64> (LDP src mem)) mem))
21151 if auxIntToInt64(v.AuxInt) != 32 {
21157 v.reset(OpARM64STP)
21158 v.AuxInt = int32ToAuxInt(16)
21159 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21160 v1 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21161 v1.AuxInt = int32ToAuxInt(16)
21162 v1.AddArg2(src, mem)
21164 v2 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21166 v3 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
21167 v4 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21168 v5 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21169 v5.AddArg2(src, mem)
21171 v6 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21173 v3.AddArg4(dst, v4, v6, mem)
21174 v.AddArg4(dst, v0, v2, v3)
21177 // match: (Move [48] dst src mem)
21178 // result: (STP [32] dst (Select0 <typ.UInt64> (LDP [32] src mem)) (Select1 <typ.UInt64> (LDP [32] src mem)) (STP [16] dst (Select0 <typ.UInt64> (LDP [16] src mem)) (Select1 <typ.UInt64> (LDP [16] src mem)) (STP dst (Select0 <typ.UInt64> (LDP src mem)) (Select1 <typ.UInt64> (LDP src mem)) mem)))
21180 if auxIntToInt64(v.AuxInt) != 48 {
21186 v.reset(OpARM64STP)
21187 v.AuxInt = int32ToAuxInt(32)
21188 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21189 v1 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21190 v1.AuxInt = int32ToAuxInt(32)
21191 v1.AddArg2(src, mem)
21193 v2 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21195 v3 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
21196 v3.AuxInt = int32ToAuxInt(16)
21197 v4 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21198 v5 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21199 v5.AuxInt = int32ToAuxInt(16)
21200 v5.AddArg2(src, mem)
21202 v6 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21204 v7 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
21205 v8 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21206 v9 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21207 v9.AddArg2(src, mem)
21209 v10 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21211 v7.AddArg4(dst, v8, v10, mem)
21212 v3.AddArg4(dst, v4, v6, v7)
21213 v.AddArg4(dst, v0, v2, v3)
21216 // match: (Move [64] dst src mem)
21217 // result: (STP [48] dst (Select0 <typ.UInt64> (LDP [48] src mem)) (Select1 <typ.UInt64> (LDP [48] src mem)) (STP [32] dst (Select0 <typ.UInt64> (LDP [32] src mem)) (Select1 <typ.UInt64> (LDP [32] src mem)) (STP [16] dst (Select0 <typ.UInt64> (LDP [16] src mem)) (Select1 <typ.UInt64> (LDP [16] src mem)) (STP dst (Select0 <typ.UInt64> (LDP src mem)) (Select1 <typ.UInt64> (LDP src mem)) mem))))
21219 if auxIntToInt64(v.AuxInt) != 64 {
21225 v.reset(OpARM64STP)
21226 v.AuxInt = int32ToAuxInt(48)
21227 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21228 v1 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21229 v1.AuxInt = int32ToAuxInt(48)
21230 v1.AddArg2(src, mem)
21232 v2 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21234 v3 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
21235 v3.AuxInt = int32ToAuxInt(32)
21236 v4 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21237 v5 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21238 v5.AuxInt = int32ToAuxInt(32)
21239 v5.AddArg2(src, mem)
21241 v6 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21243 v7 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
21244 v7.AuxInt = int32ToAuxInt(16)
21245 v8 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21246 v9 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21247 v9.AuxInt = int32ToAuxInt(16)
21248 v9.AddArg2(src, mem)
21250 v10 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21252 v11 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
21253 v12 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
21254 v13 := b.NewValue0(v.Pos, OpARM64LDP, types.NewTuple(typ.UInt64, typ.UInt64))
21255 v13.AddArg2(src, mem)
21257 v14 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
21259 v11.AddArg4(dst, v12, v14, mem)
21260 v7.AddArg4(dst, v8, v10, v11)
21261 v3.AddArg4(dst, v4, v6, v7)
21262 v.AddArg4(dst, v0, v2, v3)
21265 // match: (Move [s] dst src mem)
21266 // cond: s%16 != 0 && s%16 <= 8 && s > 16
21267 // result: (Move [8] (OffPtr <dst.Type> dst [s-8]) (OffPtr <src.Type> src [s-8]) (Move [s-s%16] dst src mem))
21269 s := auxIntToInt64(v.AuxInt)
21273 if !(s%16 != 0 && s%16 <= 8 && s > 16) {
21277 v.AuxInt = int64ToAuxInt(8)
21278 v0 := b.NewValue0(v.Pos, OpOffPtr, dst.Type)
21279 v0.AuxInt = int64ToAuxInt(s - 8)
21281 v1 := b.NewValue0(v.Pos, OpOffPtr, src.Type)
21282 v1.AuxInt = int64ToAuxInt(s - 8)
21284 v2 := b.NewValue0(v.Pos, OpMove, types.TypeMem)
21285 v2.AuxInt = int64ToAuxInt(s - s%16)
21286 v2.AddArg3(dst, src, mem)
21287 v.AddArg3(v0, v1, v2)
21290 // match: (Move [s] dst src mem)
21291 // cond: s%16 != 0 && s%16 > 8 && s > 16
21292 // result: (Move [16] (OffPtr <dst.Type> dst [s-16]) (OffPtr <src.Type> src [s-16]) (Move [s-s%16] dst src mem))
21294 s := auxIntToInt64(v.AuxInt)
21298 if !(s%16 != 0 && s%16 > 8 && s > 16) {
21302 v.AuxInt = int64ToAuxInt(16)
21303 v0 := b.NewValue0(v.Pos, OpOffPtr, dst.Type)
21304 v0.AuxInt = int64ToAuxInt(s - 16)
21306 v1 := b.NewValue0(v.Pos, OpOffPtr, src.Type)
21307 v1.AuxInt = int64ToAuxInt(s - 16)
21309 v2 := b.NewValue0(v.Pos, OpMove, types.TypeMem)
21310 v2.AuxInt = int64ToAuxInt(s - s%16)
21311 v2.AddArg3(dst, src, mem)
21312 v.AddArg3(v0, v1, v2)
21315 // match: (Move [s] dst src mem)
21316 // cond: s > 64 && s <= 16*64 && s%16 == 0 && !config.noDuffDevice && logLargeCopy(v, s)
21317 // result: (DUFFCOPY [8 * (64 - s/16)] dst src mem)
21319 s := auxIntToInt64(v.AuxInt)
21323 if !(s > 64 && s <= 16*64 && s%16 == 0 && !config.noDuffDevice && logLargeCopy(v, s)) {
21326 v.reset(OpARM64DUFFCOPY)
21327 v.AuxInt = int64ToAuxInt(8 * (64 - s/16))
21328 v.AddArg3(dst, src, mem)
21331 // match: (Move [s] dst src mem)
21332 // cond: s%16 == 0 && (s > 16*64 || config.noDuffDevice) && logLargeCopy(v, s)
21333 // result: (LoweredMove dst src (ADDconst <src.Type> src [s-16]) mem)
21335 s := auxIntToInt64(v.AuxInt)
21339 if !(s%16 == 0 && (s > 16*64 || config.noDuffDevice) && logLargeCopy(v, s)) {
21342 v.reset(OpARM64LoweredMove)
21343 v0 := b.NewValue0(v.Pos, OpARM64ADDconst, src.Type)
21344 v0.AuxInt = int64ToAuxInt(s - 16)
21346 v.AddArg4(dst, src, v0, mem)
21351 func rewriteValueARM64_OpNeq16(v *Value) bool {
21355 typ := &b.Func.Config.Types
21356 // match: (Neq16 x y)
21357 // result: (NotEqual (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
21361 v.reset(OpARM64NotEqual)
21362 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
21363 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
21365 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
21372 func rewriteValueARM64_OpNeq32(v *Value) bool {
21376 // match: (Neq32 x y)
21377 // result: (NotEqual (CMPW x y))
21381 v.reset(OpARM64NotEqual)
21382 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
21388 func rewriteValueARM64_OpNeq32F(v *Value) bool {
21392 // match: (Neq32F x y)
21393 // result: (NotEqual (FCMPS x y))
21397 v.reset(OpARM64NotEqual)
21398 v0 := b.NewValue0(v.Pos, OpARM64FCMPS, types.TypeFlags)
21404 func rewriteValueARM64_OpNeq64(v *Value) bool {
21408 // match: (Neq64 x y)
21409 // result: (NotEqual (CMP x y))
21413 v.reset(OpARM64NotEqual)
21414 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
21420 func rewriteValueARM64_OpNeq64F(v *Value) bool {
21424 // match: (Neq64F x y)
21425 // result: (NotEqual (FCMPD x y))
21429 v.reset(OpARM64NotEqual)
21430 v0 := b.NewValue0(v.Pos, OpARM64FCMPD, types.TypeFlags)
21436 func rewriteValueARM64_OpNeq8(v *Value) bool {
21440 typ := &b.Func.Config.Types
21441 // match: (Neq8 x y)
21442 // result: (NotEqual (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
21446 v.reset(OpARM64NotEqual)
21447 v0 := b.NewValue0(v.Pos, OpARM64CMPW, types.TypeFlags)
21448 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
21450 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
21457 func rewriteValueARM64_OpNeqPtr(v *Value) bool {
21461 // match: (NeqPtr x y)
21462 // result: (NotEqual (CMP x y))
21466 v.reset(OpARM64NotEqual)
21467 v0 := b.NewValue0(v.Pos, OpARM64CMP, types.TypeFlags)
21473 func rewriteValueARM64_OpNot(v *Value) bool {
21476 typ := &b.Func.Config.Types
21478 // result: (XOR (MOVDconst [1]) x)
21481 v.reset(OpARM64XOR)
21482 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
21483 v0.AuxInt = int64ToAuxInt(1)
21488 func rewriteValueARM64_OpOffPtr(v *Value) bool {
21490 // match: (OffPtr [off] ptr:(SP))
21491 // cond: is32Bit(off)
21492 // result: (MOVDaddr [int32(off)] ptr)
21494 off := auxIntToInt64(v.AuxInt)
21496 if ptr.Op != OpSP || !(is32Bit(off)) {
21499 v.reset(OpARM64MOVDaddr)
21500 v.AuxInt = int32ToAuxInt(int32(off))
21504 // match: (OffPtr [off] ptr)
21505 // result: (ADDconst [off] ptr)
21507 off := auxIntToInt64(v.AuxInt)
21509 v.reset(OpARM64ADDconst)
21510 v.AuxInt = int64ToAuxInt(off)
21515 func rewriteValueARM64_OpPanicBounds(v *Value) bool {
21519 // match: (PanicBounds [kind] x y mem)
21520 // cond: boundsABI(kind) == 0
21521 // result: (LoweredPanicBoundsA [kind] x y mem)
21523 kind := auxIntToInt64(v.AuxInt)
21527 if !(boundsABI(kind) == 0) {
21530 v.reset(OpARM64LoweredPanicBoundsA)
21531 v.AuxInt = int64ToAuxInt(kind)
21532 v.AddArg3(x, y, mem)
21535 // match: (PanicBounds [kind] x y mem)
21536 // cond: boundsABI(kind) == 1
21537 // result: (LoweredPanicBoundsB [kind] x y mem)
21539 kind := auxIntToInt64(v.AuxInt)
21543 if !(boundsABI(kind) == 1) {
21546 v.reset(OpARM64LoweredPanicBoundsB)
21547 v.AuxInt = int64ToAuxInt(kind)
21548 v.AddArg3(x, y, mem)
21551 // match: (PanicBounds [kind] x y mem)
21552 // cond: boundsABI(kind) == 2
21553 // result: (LoweredPanicBoundsC [kind] x y mem)
21555 kind := auxIntToInt64(v.AuxInt)
21559 if !(boundsABI(kind) == 2) {
21562 v.reset(OpARM64LoweredPanicBoundsC)
21563 v.AuxInt = int64ToAuxInt(kind)
21564 v.AddArg3(x, y, mem)
21569 func rewriteValueARM64_OpPopCount16(v *Value) bool {
21572 typ := &b.Func.Config.Types
21573 // match: (PopCount16 <t> x)
21574 // result: (FMOVDfpgp <t> (VUADDLV <typ.Float64> (VCNT <typ.Float64> (FMOVDgpfp <typ.Float64> (ZeroExt16to64 x)))))
21578 v.reset(OpARM64FMOVDfpgp)
21580 v0 := b.NewValue0(v.Pos, OpARM64VUADDLV, typ.Float64)
21581 v1 := b.NewValue0(v.Pos, OpARM64VCNT, typ.Float64)
21582 v2 := b.NewValue0(v.Pos, OpARM64FMOVDgpfp, typ.Float64)
21583 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21592 func rewriteValueARM64_OpPopCount32(v *Value) bool {
21595 typ := &b.Func.Config.Types
21596 // match: (PopCount32 <t> x)
21597 // result: (FMOVDfpgp <t> (VUADDLV <typ.Float64> (VCNT <typ.Float64> (FMOVDgpfp <typ.Float64> (ZeroExt32to64 x)))))
21601 v.reset(OpARM64FMOVDfpgp)
21603 v0 := b.NewValue0(v.Pos, OpARM64VUADDLV, typ.Float64)
21604 v1 := b.NewValue0(v.Pos, OpARM64VCNT, typ.Float64)
21605 v2 := b.NewValue0(v.Pos, OpARM64FMOVDgpfp, typ.Float64)
21606 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
21615 func rewriteValueARM64_OpPopCount64(v *Value) bool {
21618 typ := &b.Func.Config.Types
21619 // match: (PopCount64 <t> x)
21620 // result: (FMOVDfpgp <t> (VUADDLV <typ.Float64> (VCNT <typ.Float64> (FMOVDgpfp <typ.Float64> x))))
21624 v.reset(OpARM64FMOVDfpgp)
21626 v0 := b.NewValue0(v.Pos, OpARM64VUADDLV, typ.Float64)
21627 v1 := b.NewValue0(v.Pos, OpARM64VCNT, typ.Float64)
21628 v2 := b.NewValue0(v.Pos, OpARM64FMOVDgpfp, typ.Float64)
21636 func rewriteValueARM64_OpPrefetchCache(v *Value) bool {
21639 // match: (PrefetchCache addr mem)
21640 // result: (PRFM [0] addr mem)
21644 v.reset(OpARM64PRFM)
21645 v.AuxInt = int64ToAuxInt(0)
21646 v.AddArg2(addr, mem)
21650 func rewriteValueARM64_OpPrefetchCacheStreamed(v *Value) bool {
21653 // match: (PrefetchCacheStreamed addr mem)
21654 // result: (PRFM [1] addr mem)
21658 v.reset(OpARM64PRFM)
21659 v.AuxInt = int64ToAuxInt(1)
21660 v.AddArg2(addr, mem)
21664 func rewriteValueARM64_OpPubBarrier(v *Value) bool {
21666 // match: (PubBarrier mem)
21667 // result: (DMB [0xe] mem)
21670 v.reset(OpARM64DMB)
21671 v.AuxInt = int64ToAuxInt(0xe)
21676 func rewriteValueARM64_OpRotateLeft16(v *Value) bool {
21680 typ := &b.Func.Config.Types
21681 // match: (RotateLeft16 <t> x (MOVDconst [c]))
21682 // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15])))
21686 if v_1.Op != OpARM64MOVDconst {
21689 c := auxIntToInt64(v_1.AuxInt)
21691 v0 := b.NewValue0(v.Pos, OpLsh16x64, t)
21692 v1 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
21693 v1.AuxInt = int64ToAuxInt(c & 15)
21695 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t)
21696 v3 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
21697 v3.AuxInt = int64ToAuxInt(-c & 15)
21702 // match: (RotateLeft16 <t> x y)
21703 // result: (RORW <t> (ORshiftLL <typ.UInt32> (ZeroExt16to32 x) (ZeroExt16to32 x) [16]) (NEG <typ.Int64> y))
21708 v.reset(OpARM64RORW)
21710 v0 := b.NewValue0(v.Pos, OpARM64ORshiftLL, typ.UInt32)
21711 v0.AuxInt = int64ToAuxInt(16)
21712 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
21715 v2 := b.NewValue0(v.Pos, OpARM64NEG, typ.Int64)
21721 func rewriteValueARM64_OpRotateLeft32(v *Value) bool {
21725 // match: (RotateLeft32 x y)
21726 // result: (RORW x (NEG <y.Type> y))
21730 v.reset(OpARM64RORW)
21731 v0 := b.NewValue0(v.Pos, OpARM64NEG, y.Type)
21737 func rewriteValueARM64_OpRotateLeft64(v *Value) bool {
21741 // match: (RotateLeft64 x y)
21742 // result: (ROR x (NEG <y.Type> y))
21746 v.reset(OpARM64ROR)
21747 v0 := b.NewValue0(v.Pos, OpARM64NEG, y.Type)
21753 func rewriteValueARM64_OpRotateLeft8(v *Value) bool {
21757 typ := &b.Func.Config.Types
21758 // match: (RotateLeft8 <t> x (MOVDconst [c]))
21759 // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7])))
21763 if v_1.Op != OpARM64MOVDconst {
21766 c := auxIntToInt64(v_1.AuxInt)
21768 v0 := b.NewValue0(v.Pos, OpLsh8x64, t)
21769 v1 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
21770 v1.AuxInt = int64ToAuxInt(c & 7)
21772 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t)
21773 v3 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
21774 v3.AuxInt = int64ToAuxInt(-c & 7)
21779 // match: (RotateLeft8 <t> x y)
21780 // result: (OR <t> (SLL <t> x (ANDconst <typ.Int64> [7] y)) (SRL <t> (ZeroExt8to64 x) (ANDconst <typ.Int64> [7] (NEG <typ.Int64> y))))
21787 v0 := b.NewValue0(v.Pos, OpARM64SLL, t)
21788 v1 := b.NewValue0(v.Pos, OpARM64ANDconst, typ.Int64)
21789 v1.AuxInt = int64ToAuxInt(7)
21792 v2 := b.NewValue0(v.Pos, OpARM64SRL, t)
21793 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
21795 v4 := b.NewValue0(v.Pos, OpARM64ANDconst, typ.Int64)
21796 v4.AuxInt = int64ToAuxInt(7)
21797 v5 := b.NewValue0(v.Pos, OpARM64NEG, typ.Int64)
21805 func rewriteValueARM64_OpRsh16Ux16(v *Value) bool {
21809 typ := &b.Func.Config.Types
21810 // match: (Rsh16Ux16 <t> x y)
21811 // cond: shiftIsBounded(v)
21812 // result: (SRL <t> (ZeroExt16to64 x) y)
21817 if !(shiftIsBounded(v)) {
21820 v.reset(OpARM64SRL)
21822 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21827 // match: (Rsh16Ux16 <t> x y)
21828 // cond: !shiftIsBounded(v)
21829 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt16to64 x) y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt16to64 y)))
21834 if !(!shiftIsBounded(v)) {
21837 v.reset(OpARM64CSEL)
21838 v.AuxInt = opToAuxInt(OpARM64LessThanU)
21839 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
21840 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21843 v2 := b.NewValue0(v.Pos, OpConst64, t)
21844 v2.AuxInt = int64ToAuxInt(0)
21845 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
21846 v3.AuxInt = int64ToAuxInt(64)
21847 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21850 v.AddArg3(v0, v2, v3)
21855 func rewriteValueARM64_OpRsh16Ux32(v *Value) bool {
21859 typ := &b.Func.Config.Types
21860 // match: (Rsh16Ux32 <t> x y)
21861 // cond: shiftIsBounded(v)
21862 // result: (SRL <t> (ZeroExt16to64 x) y)
21867 if !(shiftIsBounded(v)) {
21870 v.reset(OpARM64SRL)
21872 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21877 // match: (Rsh16Ux32 <t> x y)
21878 // cond: !shiftIsBounded(v)
21879 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt16to64 x) y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt32to64 y)))
21884 if !(!shiftIsBounded(v)) {
21887 v.reset(OpARM64CSEL)
21888 v.AuxInt = opToAuxInt(OpARM64LessThanU)
21889 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
21890 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21893 v2 := b.NewValue0(v.Pos, OpConst64, t)
21894 v2.AuxInt = int64ToAuxInt(0)
21895 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
21896 v3.AuxInt = int64ToAuxInt(64)
21897 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
21900 v.AddArg3(v0, v2, v3)
21905 func rewriteValueARM64_OpRsh16Ux64(v *Value) bool {
21909 typ := &b.Func.Config.Types
21910 // match: (Rsh16Ux64 <t> x y)
21911 // cond: shiftIsBounded(v)
21912 // result: (SRL <t> (ZeroExt16to64 x) y)
21917 if !(shiftIsBounded(v)) {
21920 v.reset(OpARM64SRL)
21922 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21927 // match: (Rsh16Ux64 <t> x y)
21928 // cond: !shiftIsBounded(v)
21929 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt16to64 x) y) (Const64 <t> [0]) (CMPconst [64] y))
21934 if !(!shiftIsBounded(v)) {
21937 v.reset(OpARM64CSEL)
21938 v.AuxInt = opToAuxInt(OpARM64LessThanU)
21939 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
21940 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21943 v2 := b.NewValue0(v.Pos, OpConst64, t)
21944 v2.AuxInt = int64ToAuxInt(0)
21945 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
21946 v3.AuxInt = int64ToAuxInt(64)
21948 v.AddArg3(v0, v2, v3)
21953 func rewriteValueARM64_OpRsh16Ux8(v *Value) bool {
21957 typ := &b.Func.Config.Types
21958 // match: (Rsh16Ux8 <t> x y)
21959 // cond: shiftIsBounded(v)
21960 // result: (SRL <t> (ZeroExt16to64 x) y)
21965 if !(shiftIsBounded(v)) {
21968 v.reset(OpARM64SRL)
21970 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21975 // match: (Rsh16Ux8 <t> x y)
21976 // cond: !shiftIsBounded(v)
21977 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt16to64 x) y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt8to64 y)))
21982 if !(!shiftIsBounded(v)) {
21985 v.reset(OpARM64CSEL)
21986 v.AuxInt = opToAuxInt(OpARM64LessThanU)
21987 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
21988 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
21991 v2 := b.NewValue0(v.Pos, OpConst64, t)
21992 v2.AuxInt = int64ToAuxInt(0)
21993 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
21994 v3.AuxInt = int64ToAuxInt(64)
21995 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
21998 v.AddArg3(v0, v2, v3)
22003 func rewriteValueARM64_OpRsh16x16(v *Value) bool {
22007 typ := &b.Func.Config.Types
22008 // match: (Rsh16x16 <t> x y)
22009 // cond: shiftIsBounded(v)
22010 // result: (SRA <t> (SignExt16to64 x) y)
22015 if !(shiftIsBounded(v)) {
22018 v.reset(OpARM64SRA)
22020 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
22025 // match: (Rsh16x16 x y)
22026 // cond: !shiftIsBounded(v)
22027 // result: (SRA (SignExt16to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt16to64 y))))
22031 if !(!shiftIsBounded(v)) {
22034 v.reset(OpARM64SRA)
22035 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
22037 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22038 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
22039 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
22040 v2.AuxInt = int64ToAuxInt(63)
22041 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22042 v3.AuxInt = int64ToAuxInt(64)
22043 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
22046 v1.AddArg3(y, v2, v3)
22052 func rewriteValueARM64_OpRsh16x32(v *Value) bool {
22056 typ := &b.Func.Config.Types
22057 // match: (Rsh16x32 <t> x y)
22058 // cond: shiftIsBounded(v)
22059 // result: (SRA <t> (SignExt16to64 x) y)
22064 if !(shiftIsBounded(v)) {
22067 v.reset(OpARM64SRA)
22069 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
22074 // match: (Rsh16x32 x y)
22075 // cond: !shiftIsBounded(v)
22076 // result: (SRA (SignExt16to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt32to64 y))))
22080 if !(!shiftIsBounded(v)) {
22083 v.reset(OpARM64SRA)
22084 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
22086 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22087 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
22088 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
22089 v2.AuxInt = int64ToAuxInt(63)
22090 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22091 v3.AuxInt = int64ToAuxInt(64)
22092 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22095 v1.AddArg3(y, v2, v3)
22101 func rewriteValueARM64_OpRsh16x64(v *Value) bool {
22105 typ := &b.Func.Config.Types
22106 // match: (Rsh16x64 <t> x y)
22107 // cond: shiftIsBounded(v)
22108 // result: (SRA <t> (SignExt16to64 x) y)
22113 if !(shiftIsBounded(v)) {
22116 v.reset(OpARM64SRA)
22118 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
22123 // match: (Rsh16x64 x y)
22124 // cond: !shiftIsBounded(v)
22125 // result: (SRA (SignExt16to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] y)))
22129 if !(!shiftIsBounded(v)) {
22132 v.reset(OpARM64SRA)
22133 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
22135 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22136 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
22137 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
22138 v2.AuxInt = int64ToAuxInt(63)
22139 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22140 v3.AuxInt = int64ToAuxInt(64)
22142 v1.AddArg3(y, v2, v3)
22148 func rewriteValueARM64_OpRsh16x8(v *Value) bool {
22152 typ := &b.Func.Config.Types
22153 // match: (Rsh16x8 <t> x y)
22154 // cond: shiftIsBounded(v)
22155 // result: (SRA <t> (SignExt16to64 x) y)
22160 if !(shiftIsBounded(v)) {
22163 v.reset(OpARM64SRA)
22165 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
22170 // match: (Rsh16x8 x y)
22171 // cond: !shiftIsBounded(v)
22172 // result: (SRA (SignExt16to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt8to64 y))))
22176 if !(!shiftIsBounded(v)) {
22179 v.reset(OpARM64SRA)
22180 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
22182 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22183 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
22184 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
22185 v2.AuxInt = int64ToAuxInt(63)
22186 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22187 v3.AuxInt = int64ToAuxInt(64)
22188 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
22191 v1.AddArg3(y, v2, v3)
22197 func rewriteValueARM64_OpRsh32Ux16(v *Value) bool {
22201 typ := &b.Func.Config.Types
22202 // match: (Rsh32Ux16 <t> x y)
22203 // cond: shiftIsBounded(v)
22204 // result: (SRL <t> (ZeroExt32to64 x) y)
22209 if !(shiftIsBounded(v)) {
22212 v.reset(OpARM64SRL)
22214 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22219 // match: (Rsh32Ux16 <t> x y)
22220 // cond: !shiftIsBounded(v)
22221 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt32to64 x) y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt16to64 y)))
22226 if !(!shiftIsBounded(v)) {
22229 v.reset(OpARM64CSEL)
22230 v.AuxInt = opToAuxInt(OpARM64LessThanU)
22231 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
22232 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22235 v2 := b.NewValue0(v.Pos, OpConst64, t)
22236 v2.AuxInt = int64ToAuxInt(0)
22237 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22238 v3.AuxInt = int64ToAuxInt(64)
22239 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
22242 v.AddArg3(v0, v2, v3)
22247 func rewriteValueARM64_OpRsh32Ux32(v *Value) bool {
22251 typ := &b.Func.Config.Types
22252 // match: (Rsh32Ux32 <t> x y)
22253 // cond: shiftIsBounded(v)
22254 // result: (SRL <t> (ZeroExt32to64 x) y)
22259 if !(shiftIsBounded(v)) {
22262 v.reset(OpARM64SRL)
22264 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22269 // match: (Rsh32Ux32 <t> x y)
22270 // cond: !shiftIsBounded(v)
22271 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt32to64 x) y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt32to64 y)))
22276 if !(!shiftIsBounded(v)) {
22279 v.reset(OpARM64CSEL)
22280 v.AuxInt = opToAuxInt(OpARM64LessThanU)
22281 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
22282 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22285 v2 := b.NewValue0(v.Pos, OpConst64, t)
22286 v2.AuxInt = int64ToAuxInt(0)
22287 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22288 v3.AuxInt = int64ToAuxInt(64)
22289 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22292 v.AddArg3(v0, v2, v3)
22297 func rewriteValueARM64_OpRsh32Ux64(v *Value) bool {
22301 typ := &b.Func.Config.Types
22302 // match: (Rsh32Ux64 <t> x y)
22303 // cond: shiftIsBounded(v)
22304 // result: (SRL <t> (ZeroExt32to64 x) y)
22309 if !(shiftIsBounded(v)) {
22312 v.reset(OpARM64SRL)
22314 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22319 // match: (Rsh32Ux64 <t> x y)
22320 // cond: !shiftIsBounded(v)
22321 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt32to64 x) y) (Const64 <t> [0]) (CMPconst [64] y))
22326 if !(!shiftIsBounded(v)) {
22329 v.reset(OpARM64CSEL)
22330 v.AuxInt = opToAuxInt(OpARM64LessThanU)
22331 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
22332 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22335 v2 := b.NewValue0(v.Pos, OpConst64, t)
22336 v2.AuxInt = int64ToAuxInt(0)
22337 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22338 v3.AuxInt = int64ToAuxInt(64)
22340 v.AddArg3(v0, v2, v3)
22345 func rewriteValueARM64_OpRsh32Ux8(v *Value) bool {
22349 typ := &b.Func.Config.Types
22350 // match: (Rsh32Ux8 <t> x y)
22351 // cond: shiftIsBounded(v)
22352 // result: (SRL <t> (ZeroExt32to64 x) y)
22357 if !(shiftIsBounded(v)) {
22360 v.reset(OpARM64SRL)
22362 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22367 // match: (Rsh32Ux8 <t> x y)
22368 // cond: !shiftIsBounded(v)
22369 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt32to64 x) y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt8to64 y)))
22374 if !(!shiftIsBounded(v)) {
22377 v.reset(OpARM64CSEL)
22378 v.AuxInt = opToAuxInt(OpARM64LessThanU)
22379 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
22380 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22383 v2 := b.NewValue0(v.Pos, OpConst64, t)
22384 v2.AuxInt = int64ToAuxInt(0)
22385 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22386 v3.AuxInt = int64ToAuxInt(64)
22387 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
22390 v.AddArg3(v0, v2, v3)
22395 func rewriteValueARM64_OpRsh32x16(v *Value) bool {
22399 typ := &b.Func.Config.Types
22400 // match: (Rsh32x16 <t> x y)
22401 // cond: shiftIsBounded(v)
22402 // result: (SRA <t> (SignExt32to64 x) y)
22407 if !(shiftIsBounded(v)) {
22410 v.reset(OpARM64SRA)
22412 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
22417 // match: (Rsh32x16 x y)
22418 // cond: !shiftIsBounded(v)
22419 // result: (SRA (SignExt32to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt16to64 y))))
22423 if !(!shiftIsBounded(v)) {
22426 v.reset(OpARM64SRA)
22427 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
22429 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22430 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
22431 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
22432 v2.AuxInt = int64ToAuxInt(63)
22433 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22434 v3.AuxInt = int64ToAuxInt(64)
22435 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
22438 v1.AddArg3(y, v2, v3)
22444 func rewriteValueARM64_OpRsh32x32(v *Value) bool {
22448 typ := &b.Func.Config.Types
22449 // match: (Rsh32x32 <t> x y)
22450 // cond: shiftIsBounded(v)
22451 // result: (SRA <t> (SignExt32to64 x) y)
22456 if !(shiftIsBounded(v)) {
22459 v.reset(OpARM64SRA)
22461 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
22466 // match: (Rsh32x32 x y)
22467 // cond: !shiftIsBounded(v)
22468 // result: (SRA (SignExt32to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt32to64 y))))
22472 if !(!shiftIsBounded(v)) {
22475 v.reset(OpARM64SRA)
22476 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
22478 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22479 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
22480 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
22481 v2.AuxInt = int64ToAuxInt(63)
22482 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22483 v3.AuxInt = int64ToAuxInt(64)
22484 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22487 v1.AddArg3(y, v2, v3)
22493 func rewriteValueARM64_OpRsh32x64(v *Value) bool {
22497 typ := &b.Func.Config.Types
22498 // match: (Rsh32x64 <t> x y)
22499 // cond: shiftIsBounded(v)
22500 // result: (SRA <t> (SignExt32to64 x) y)
22505 if !(shiftIsBounded(v)) {
22508 v.reset(OpARM64SRA)
22510 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
22515 // match: (Rsh32x64 x y)
22516 // cond: !shiftIsBounded(v)
22517 // result: (SRA (SignExt32to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] y)))
22521 if !(!shiftIsBounded(v)) {
22524 v.reset(OpARM64SRA)
22525 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
22527 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22528 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
22529 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
22530 v2.AuxInt = int64ToAuxInt(63)
22531 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22532 v3.AuxInt = int64ToAuxInt(64)
22534 v1.AddArg3(y, v2, v3)
22540 func rewriteValueARM64_OpRsh32x8(v *Value) bool {
22544 typ := &b.Func.Config.Types
22545 // match: (Rsh32x8 <t> x y)
22546 // cond: shiftIsBounded(v)
22547 // result: (SRA <t> (SignExt32to64 x) y)
22552 if !(shiftIsBounded(v)) {
22555 v.reset(OpARM64SRA)
22557 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
22562 // match: (Rsh32x8 x y)
22563 // cond: !shiftIsBounded(v)
22564 // result: (SRA (SignExt32to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt8to64 y))))
22568 if !(!shiftIsBounded(v)) {
22571 v.reset(OpARM64SRA)
22572 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
22574 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22575 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
22576 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
22577 v2.AuxInt = int64ToAuxInt(63)
22578 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22579 v3.AuxInt = int64ToAuxInt(64)
22580 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
22583 v1.AddArg3(y, v2, v3)
22589 func rewriteValueARM64_OpRsh64Ux16(v *Value) bool {
22593 typ := &b.Func.Config.Types
22594 // match: (Rsh64Ux16 <t> x y)
22595 // cond: shiftIsBounded(v)
22596 // result: (SRL <t> x y)
22601 if !(shiftIsBounded(v)) {
22604 v.reset(OpARM64SRL)
22609 // match: (Rsh64Ux16 <t> x y)
22610 // cond: !shiftIsBounded(v)
22611 // result: (CSEL [OpARM64LessThanU] (SRL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt16to64 y)))
22616 if !(!shiftIsBounded(v)) {
22619 v.reset(OpARM64CSEL)
22620 v.AuxInt = opToAuxInt(OpARM64LessThanU)
22621 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
22623 v1 := b.NewValue0(v.Pos, OpConst64, t)
22624 v1.AuxInt = int64ToAuxInt(0)
22625 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22626 v2.AuxInt = int64ToAuxInt(64)
22627 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
22630 v.AddArg3(v0, v1, v2)
22635 func rewriteValueARM64_OpRsh64Ux32(v *Value) bool {
22639 typ := &b.Func.Config.Types
22640 // match: (Rsh64Ux32 <t> x y)
22641 // cond: shiftIsBounded(v)
22642 // result: (SRL <t> x y)
22647 if !(shiftIsBounded(v)) {
22650 v.reset(OpARM64SRL)
22655 // match: (Rsh64Ux32 <t> x y)
22656 // cond: !shiftIsBounded(v)
22657 // result: (CSEL [OpARM64LessThanU] (SRL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt32to64 y)))
22662 if !(!shiftIsBounded(v)) {
22665 v.reset(OpARM64CSEL)
22666 v.AuxInt = opToAuxInt(OpARM64LessThanU)
22667 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
22669 v1 := b.NewValue0(v.Pos, OpConst64, t)
22670 v1.AuxInt = int64ToAuxInt(0)
22671 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22672 v2.AuxInt = int64ToAuxInt(64)
22673 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22676 v.AddArg3(v0, v1, v2)
22681 func rewriteValueARM64_OpRsh64Ux64(v *Value) bool {
22685 // match: (Rsh64Ux64 <t> x y)
22686 // cond: shiftIsBounded(v)
22687 // result: (SRL <t> x y)
22692 if !(shiftIsBounded(v)) {
22695 v.reset(OpARM64SRL)
22700 // match: (Rsh64Ux64 <t> x y)
22701 // cond: !shiftIsBounded(v)
22702 // result: (CSEL [OpARM64LessThanU] (SRL <t> x y) (Const64 <t> [0]) (CMPconst [64] y))
22707 if !(!shiftIsBounded(v)) {
22710 v.reset(OpARM64CSEL)
22711 v.AuxInt = opToAuxInt(OpARM64LessThanU)
22712 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
22714 v1 := b.NewValue0(v.Pos, OpConst64, t)
22715 v1.AuxInt = int64ToAuxInt(0)
22716 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22717 v2.AuxInt = int64ToAuxInt(64)
22719 v.AddArg3(v0, v1, v2)
22724 func rewriteValueARM64_OpRsh64Ux8(v *Value) bool {
22728 typ := &b.Func.Config.Types
22729 // match: (Rsh64Ux8 <t> x y)
22730 // cond: shiftIsBounded(v)
22731 // result: (SRL <t> x y)
22736 if !(shiftIsBounded(v)) {
22739 v.reset(OpARM64SRL)
22744 // match: (Rsh64Ux8 <t> x y)
22745 // cond: !shiftIsBounded(v)
22746 // result: (CSEL [OpARM64LessThanU] (SRL <t> x y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt8to64 y)))
22751 if !(!shiftIsBounded(v)) {
22754 v.reset(OpARM64CSEL)
22755 v.AuxInt = opToAuxInt(OpARM64LessThanU)
22756 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
22758 v1 := b.NewValue0(v.Pos, OpConst64, t)
22759 v1.AuxInt = int64ToAuxInt(0)
22760 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22761 v2.AuxInt = int64ToAuxInt(64)
22762 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
22765 v.AddArg3(v0, v1, v2)
22770 func rewriteValueARM64_OpRsh64x16(v *Value) bool {
22774 typ := &b.Func.Config.Types
22775 // match: (Rsh64x16 <t> x y)
22776 // cond: shiftIsBounded(v)
22777 // result: (SRA <t> x y)
22782 if !(shiftIsBounded(v)) {
22785 v.reset(OpARM64SRA)
22790 // match: (Rsh64x16 x y)
22791 // cond: !shiftIsBounded(v)
22792 // result: (SRA x (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt16to64 y))))
22796 if !(!shiftIsBounded(v)) {
22799 v.reset(OpARM64SRA)
22800 v0 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22801 v0.AuxInt = opToAuxInt(OpARM64LessThanU)
22802 v1 := b.NewValue0(v.Pos, OpConst64, y.Type)
22803 v1.AuxInt = int64ToAuxInt(63)
22804 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22805 v2.AuxInt = int64ToAuxInt(64)
22806 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
22809 v0.AddArg3(y, v1, v2)
22815 func rewriteValueARM64_OpRsh64x32(v *Value) bool {
22819 typ := &b.Func.Config.Types
22820 // match: (Rsh64x32 <t> x y)
22821 // cond: shiftIsBounded(v)
22822 // result: (SRA <t> x y)
22827 if !(shiftIsBounded(v)) {
22830 v.reset(OpARM64SRA)
22835 // match: (Rsh64x32 x y)
22836 // cond: !shiftIsBounded(v)
22837 // result: (SRA x (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt32to64 y))))
22841 if !(!shiftIsBounded(v)) {
22844 v.reset(OpARM64SRA)
22845 v0 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22846 v0.AuxInt = opToAuxInt(OpARM64LessThanU)
22847 v1 := b.NewValue0(v.Pos, OpConst64, y.Type)
22848 v1.AuxInt = int64ToAuxInt(63)
22849 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22850 v2.AuxInt = int64ToAuxInt(64)
22851 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
22854 v0.AddArg3(y, v1, v2)
22860 func rewriteValueARM64_OpRsh64x64(v *Value) bool {
22864 // match: (Rsh64x64 <t> x y)
22865 // cond: shiftIsBounded(v)
22866 // result: (SRA <t> x y)
22871 if !(shiftIsBounded(v)) {
22874 v.reset(OpARM64SRA)
22879 // match: (Rsh64x64 x y)
22880 // cond: !shiftIsBounded(v)
22881 // result: (SRA x (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] y)))
22885 if !(!shiftIsBounded(v)) {
22888 v.reset(OpARM64SRA)
22889 v0 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22890 v0.AuxInt = opToAuxInt(OpARM64LessThanU)
22891 v1 := b.NewValue0(v.Pos, OpConst64, y.Type)
22892 v1.AuxInt = int64ToAuxInt(63)
22893 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22894 v2.AuxInt = int64ToAuxInt(64)
22896 v0.AddArg3(y, v1, v2)
22902 func rewriteValueARM64_OpRsh64x8(v *Value) bool {
22906 typ := &b.Func.Config.Types
22907 // match: (Rsh64x8 <t> x y)
22908 // cond: shiftIsBounded(v)
22909 // result: (SRA <t> x y)
22914 if !(shiftIsBounded(v)) {
22917 v.reset(OpARM64SRA)
22922 // match: (Rsh64x8 x y)
22923 // cond: !shiftIsBounded(v)
22924 // result: (SRA x (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt8to64 y))))
22928 if !(!shiftIsBounded(v)) {
22931 v.reset(OpARM64SRA)
22932 v0 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
22933 v0.AuxInt = opToAuxInt(OpARM64LessThanU)
22934 v1 := b.NewValue0(v.Pos, OpConst64, y.Type)
22935 v1.AuxInt = int64ToAuxInt(63)
22936 v2 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22937 v2.AuxInt = int64ToAuxInt(64)
22938 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
22941 v0.AddArg3(y, v1, v2)
22947 func rewriteValueARM64_OpRsh8Ux16(v *Value) bool {
22951 typ := &b.Func.Config.Types
22952 // match: (Rsh8Ux16 <t> x y)
22953 // cond: shiftIsBounded(v)
22954 // result: (SRL <t> (ZeroExt8to64 x) y)
22959 if !(shiftIsBounded(v)) {
22962 v.reset(OpARM64SRL)
22964 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
22969 // match: (Rsh8Ux16 <t> x y)
22970 // cond: !shiftIsBounded(v)
22971 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt8to64 x) y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt16to64 y)))
22976 if !(!shiftIsBounded(v)) {
22979 v.reset(OpARM64CSEL)
22980 v.AuxInt = opToAuxInt(OpARM64LessThanU)
22981 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
22982 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
22985 v2 := b.NewValue0(v.Pos, OpConst64, t)
22986 v2.AuxInt = int64ToAuxInt(0)
22987 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
22988 v3.AuxInt = int64ToAuxInt(64)
22989 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
22992 v.AddArg3(v0, v2, v3)
22997 func rewriteValueARM64_OpRsh8Ux32(v *Value) bool {
23001 typ := &b.Func.Config.Types
23002 // match: (Rsh8Ux32 <t> x y)
23003 // cond: shiftIsBounded(v)
23004 // result: (SRL <t> (ZeroExt8to64 x) y)
23009 if !(shiftIsBounded(v)) {
23012 v.reset(OpARM64SRL)
23014 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
23019 // match: (Rsh8Ux32 <t> x y)
23020 // cond: !shiftIsBounded(v)
23021 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt8to64 x) y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt32to64 y)))
23026 if !(!shiftIsBounded(v)) {
23029 v.reset(OpARM64CSEL)
23030 v.AuxInt = opToAuxInt(OpARM64LessThanU)
23031 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
23032 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
23035 v2 := b.NewValue0(v.Pos, OpConst64, t)
23036 v2.AuxInt = int64ToAuxInt(0)
23037 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
23038 v3.AuxInt = int64ToAuxInt(64)
23039 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
23042 v.AddArg3(v0, v2, v3)
23047 func rewriteValueARM64_OpRsh8Ux64(v *Value) bool {
23051 typ := &b.Func.Config.Types
23052 // match: (Rsh8Ux64 <t> x y)
23053 // cond: shiftIsBounded(v)
23054 // result: (SRL <t> (ZeroExt8to64 x) y)
23059 if !(shiftIsBounded(v)) {
23062 v.reset(OpARM64SRL)
23064 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
23069 // match: (Rsh8Ux64 <t> x y)
23070 // cond: !shiftIsBounded(v)
23071 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt8to64 x) y) (Const64 <t> [0]) (CMPconst [64] y))
23076 if !(!shiftIsBounded(v)) {
23079 v.reset(OpARM64CSEL)
23080 v.AuxInt = opToAuxInt(OpARM64LessThanU)
23081 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
23082 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
23085 v2 := b.NewValue0(v.Pos, OpConst64, t)
23086 v2.AuxInt = int64ToAuxInt(0)
23087 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
23088 v3.AuxInt = int64ToAuxInt(64)
23090 v.AddArg3(v0, v2, v3)
23095 func rewriteValueARM64_OpRsh8Ux8(v *Value) bool {
23099 typ := &b.Func.Config.Types
23100 // match: (Rsh8Ux8 <t> x y)
23101 // cond: shiftIsBounded(v)
23102 // result: (SRL <t> (ZeroExt8to64 x) y)
23107 if !(shiftIsBounded(v)) {
23110 v.reset(OpARM64SRL)
23112 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
23117 // match: (Rsh8Ux8 <t> x y)
23118 // cond: !shiftIsBounded(v)
23119 // result: (CSEL [OpARM64LessThanU] (SRL <t> (ZeroExt8to64 x) y) (Const64 <t> [0]) (CMPconst [64] (ZeroExt8to64 y)))
23124 if !(!shiftIsBounded(v)) {
23127 v.reset(OpARM64CSEL)
23128 v.AuxInt = opToAuxInt(OpARM64LessThanU)
23129 v0 := b.NewValue0(v.Pos, OpARM64SRL, t)
23130 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
23133 v2 := b.NewValue0(v.Pos, OpConst64, t)
23134 v2.AuxInt = int64ToAuxInt(0)
23135 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
23136 v3.AuxInt = int64ToAuxInt(64)
23137 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
23140 v.AddArg3(v0, v2, v3)
23145 func rewriteValueARM64_OpRsh8x16(v *Value) bool {
23149 typ := &b.Func.Config.Types
23150 // match: (Rsh8x16 <t> x y)
23151 // cond: shiftIsBounded(v)
23152 // result: (SRA <t> (SignExt8to64 x) y)
23157 if !(shiftIsBounded(v)) {
23160 v.reset(OpARM64SRA)
23162 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
23167 // match: (Rsh8x16 x y)
23168 // cond: !shiftIsBounded(v)
23169 // result: (SRA (SignExt8to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt16to64 y))))
23173 if !(!shiftIsBounded(v)) {
23176 v.reset(OpARM64SRA)
23177 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
23179 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
23180 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
23181 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
23182 v2.AuxInt = int64ToAuxInt(63)
23183 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
23184 v3.AuxInt = int64ToAuxInt(64)
23185 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
23188 v1.AddArg3(y, v2, v3)
23194 func rewriteValueARM64_OpRsh8x32(v *Value) bool {
23198 typ := &b.Func.Config.Types
23199 // match: (Rsh8x32 <t> x y)
23200 // cond: shiftIsBounded(v)
23201 // result: (SRA <t> (SignExt8to64 x) y)
23206 if !(shiftIsBounded(v)) {
23209 v.reset(OpARM64SRA)
23211 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
23216 // match: (Rsh8x32 x y)
23217 // cond: !shiftIsBounded(v)
23218 // result: (SRA (SignExt8to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt32to64 y))))
23222 if !(!shiftIsBounded(v)) {
23225 v.reset(OpARM64SRA)
23226 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
23228 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
23229 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
23230 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
23231 v2.AuxInt = int64ToAuxInt(63)
23232 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
23233 v3.AuxInt = int64ToAuxInt(64)
23234 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
23237 v1.AddArg3(y, v2, v3)
23243 func rewriteValueARM64_OpRsh8x64(v *Value) bool {
23247 typ := &b.Func.Config.Types
23248 // match: (Rsh8x64 <t> x y)
23249 // cond: shiftIsBounded(v)
23250 // result: (SRA <t> (SignExt8to64 x) y)
23255 if !(shiftIsBounded(v)) {
23258 v.reset(OpARM64SRA)
23260 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
23265 // match: (Rsh8x64 x y)
23266 // cond: !shiftIsBounded(v)
23267 // result: (SRA (SignExt8to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] y)))
23271 if !(!shiftIsBounded(v)) {
23274 v.reset(OpARM64SRA)
23275 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
23277 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
23278 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
23279 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
23280 v2.AuxInt = int64ToAuxInt(63)
23281 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
23282 v3.AuxInt = int64ToAuxInt(64)
23284 v1.AddArg3(y, v2, v3)
23290 func rewriteValueARM64_OpRsh8x8(v *Value) bool {
23294 typ := &b.Func.Config.Types
23295 // match: (Rsh8x8 <t> x y)
23296 // cond: shiftIsBounded(v)
23297 // result: (SRA <t> (SignExt8to64 x) y)
23302 if !(shiftIsBounded(v)) {
23305 v.reset(OpARM64SRA)
23307 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
23312 // match: (Rsh8x8 x y)
23313 // cond: !shiftIsBounded(v)
23314 // result: (SRA (SignExt8to64 x) (CSEL [OpARM64LessThanU] <y.Type> y (Const64 <y.Type> [63]) (CMPconst [64] (ZeroExt8to64 y))))
23318 if !(!shiftIsBounded(v)) {
23321 v.reset(OpARM64SRA)
23322 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
23324 v1 := b.NewValue0(v.Pos, OpARM64CSEL, y.Type)
23325 v1.AuxInt = opToAuxInt(OpARM64LessThanU)
23326 v2 := b.NewValue0(v.Pos, OpConst64, y.Type)
23327 v2.AuxInt = int64ToAuxInt(63)
23328 v3 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
23329 v3.AuxInt = int64ToAuxInt(64)
23330 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
23333 v1.AddArg3(y, v2, v3)
23339 func rewriteValueARM64_OpSelect0(v *Value) bool {
23342 typ := &b.Func.Config.Types
23343 // match: (Select0 (Mul64uhilo x y))
23344 // result: (UMULH x y)
23346 if v_0.Op != OpMul64uhilo {
23351 v.reset(OpARM64UMULH)
23355 // match: (Select0 (Add64carry x y c))
23356 // result: (Select0 <typ.UInt64> (ADCSflags x y (Select1 <types.TypeFlags> (ADDSconstflags [-1] c))))
23358 if v_0.Op != OpAdd64carry {
23365 v.Type = typ.UInt64
23366 v0 := b.NewValue0(v.Pos, OpARM64ADCSflags, types.NewTuple(typ.UInt64, types.TypeFlags))
23367 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
23368 v2 := b.NewValue0(v.Pos, OpARM64ADDSconstflags, types.NewTuple(typ.UInt64, types.TypeFlags))
23369 v2.AuxInt = int64ToAuxInt(-1)
23372 v0.AddArg3(x, y, v1)
23376 // match: (Select0 (Sub64borrow x y bo))
23377 // result: (Select0 <typ.UInt64> (SBCSflags x y (Select1 <types.TypeFlags> (NEGSflags bo))))
23379 if v_0.Op != OpSub64borrow {
23386 v.Type = typ.UInt64
23387 v0 := b.NewValue0(v.Pos, OpARM64SBCSflags, types.NewTuple(typ.UInt64, types.TypeFlags))
23388 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
23389 v2 := b.NewValue0(v.Pos, OpARM64NEGSflags, types.NewTuple(typ.UInt64, types.TypeFlags))
23392 v0.AddArg3(x, y, v1)
23396 // match: (Select0 (Mul64uover x y))
23397 // result: (MUL x y)
23399 if v_0.Op != OpMul64uover {
23404 v.reset(OpARM64MUL)
23410 func rewriteValueARM64_OpSelect1(v *Value) bool {
23413 typ := &b.Func.Config.Types
23414 // match: (Select1 (Mul64uhilo x y))
23415 // result: (MUL x y)
23417 if v_0.Op != OpMul64uhilo {
23422 v.reset(OpARM64MUL)
23426 // match: (Select1 (Add64carry x y c))
23427 // result: (ADCzerocarry <typ.UInt64> (Select1 <types.TypeFlags> (ADCSflags x y (Select1 <types.TypeFlags> (ADDSconstflags [-1] c)))))
23429 if v_0.Op != OpAdd64carry {
23435 v.reset(OpARM64ADCzerocarry)
23436 v.Type = typ.UInt64
23437 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
23438 v1 := b.NewValue0(v.Pos, OpARM64ADCSflags, types.NewTuple(typ.UInt64, types.TypeFlags))
23439 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
23440 v3 := b.NewValue0(v.Pos, OpARM64ADDSconstflags, types.NewTuple(typ.UInt64, types.TypeFlags))
23441 v3.AuxInt = int64ToAuxInt(-1)
23444 v1.AddArg3(x, y, v2)
23449 // match: (Select1 (Sub64borrow x y bo))
23450 // result: (NEG <typ.UInt64> (NGCzerocarry <typ.UInt64> (Select1 <types.TypeFlags> (SBCSflags x y (Select1 <types.TypeFlags> (NEGSflags bo))))))
23452 if v_0.Op != OpSub64borrow {
23458 v.reset(OpARM64NEG)
23459 v.Type = typ.UInt64
23460 v0 := b.NewValue0(v.Pos, OpARM64NGCzerocarry, typ.UInt64)
23461 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
23462 v2 := b.NewValue0(v.Pos, OpARM64SBCSflags, types.NewTuple(typ.UInt64, types.TypeFlags))
23463 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
23464 v4 := b.NewValue0(v.Pos, OpARM64NEGSflags, types.NewTuple(typ.UInt64, types.TypeFlags))
23467 v2.AddArg3(x, y, v3)
23473 // match: (Select1 (Mul64uover x y))
23474 // result: (NotEqual (CMPconst (UMULH <typ.UInt64> x y) [0]))
23476 if v_0.Op != OpMul64uover {
23481 v.reset(OpARM64NotEqual)
23482 v0 := b.NewValue0(v.Pos, OpARM64CMPconst, types.TypeFlags)
23483 v0.AuxInt = int64ToAuxInt(0)
23484 v1 := b.NewValue0(v.Pos, OpARM64UMULH, typ.UInt64)
23492 func rewriteValueARM64_OpSelectN(v *Value) bool {
23495 config := b.Func.Config
23496 // match: (SelectN [0] call:(CALLstatic {sym} s1:(MOVDstore _ (MOVDconst [sz]) s2:(MOVDstore _ src s3:(MOVDstore {t} _ dst mem)))))
23497 // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1, s2, s3, call)
23498 // result: (Move [sz] dst src mem)
23500 if auxIntToInt64(v.AuxInt) != 0 {
23504 if call.Op != OpARM64CALLstatic || len(call.Args) != 1 {
23507 sym := auxToCall(call.Aux)
23509 if s1.Op != OpARM64MOVDstore {
23514 if s1_1.Op != OpARM64MOVDconst {
23517 sz := auxIntToInt64(s1_1.AuxInt)
23519 if s2.Op != OpARM64MOVDstore {
23525 if s3.Op != OpARM64MOVDstore {
23530 if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1, s2, s3, call)) {
23534 v.AuxInt = int64ToAuxInt(sz)
23535 v.AddArg3(dst, src, mem)
23538 // match: (SelectN [0] call:(CALLstatic {sym} dst src (MOVDconst [sz]) mem))
23539 // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)
23540 // result: (Move [sz] dst src mem)
23542 if auxIntToInt64(v.AuxInt) != 0 {
23546 if call.Op != OpARM64CALLstatic || len(call.Args) != 4 {
23549 sym := auxToCall(call.Aux)
23550 mem := call.Args[3]
23551 dst := call.Args[0]
23552 src := call.Args[1]
23553 call_2 := call.Args[2]
23554 if call_2.Op != OpARM64MOVDconst {
23557 sz := auxIntToInt64(call_2.AuxInt)
23558 if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)) {
23562 v.AuxInt = int64ToAuxInt(sz)
23563 v.AddArg3(dst, src, mem)
23568 func rewriteValueARM64_OpSlicemask(v *Value) bool {
23571 // match: (Slicemask <t> x)
23572 // result: (SRAconst (NEG <t> x) [63])
23576 v.reset(OpARM64SRAconst)
23577 v.AuxInt = int64ToAuxInt(63)
23578 v0 := b.NewValue0(v.Pos, OpARM64NEG, t)
23584 func rewriteValueARM64_OpStore(v *Value) bool {
23588 // match: (Store {t} ptr val mem)
23589 // cond: t.Size() == 1
23590 // result: (MOVBstore ptr val mem)
23592 t := auxToType(v.Aux)
23596 if !(t.Size() == 1) {
23599 v.reset(OpARM64MOVBstore)
23600 v.AddArg3(ptr, val, mem)
23603 // match: (Store {t} ptr val mem)
23604 // cond: t.Size() == 2
23605 // result: (MOVHstore ptr val mem)
23607 t := auxToType(v.Aux)
23611 if !(t.Size() == 2) {
23614 v.reset(OpARM64MOVHstore)
23615 v.AddArg3(ptr, val, mem)
23618 // match: (Store {t} ptr val mem)
23619 // cond: t.Size() == 4 && !t.IsFloat()
23620 // result: (MOVWstore ptr val mem)
23622 t := auxToType(v.Aux)
23626 if !(t.Size() == 4 && !t.IsFloat()) {
23629 v.reset(OpARM64MOVWstore)
23630 v.AddArg3(ptr, val, mem)
23633 // match: (Store {t} ptr val mem)
23634 // cond: t.Size() == 8 && !t.IsFloat()
23635 // result: (MOVDstore ptr val mem)
23637 t := auxToType(v.Aux)
23641 if !(t.Size() == 8 && !t.IsFloat()) {
23644 v.reset(OpARM64MOVDstore)
23645 v.AddArg3(ptr, val, mem)
23648 // match: (Store {t} ptr val mem)
23649 // cond: t.Size() == 4 && t.IsFloat()
23650 // result: (FMOVSstore ptr val mem)
23652 t := auxToType(v.Aux)
23656 if !(t.Size() == 4 && t.IsFloat()) {
23659 v.reset(OpARM64FMOVSstore)
23660 v.AddArg3(ptr, val, mem)
23663 // match: (Store {t} ptr val mem)
23664 // cond: t.Size() == 8 && t.IsFloat()
23665 // result: (FMOVDstore ptr val mem)
23667 t := auxToType(v.Aux)
23671 if !(t.Size() == 8 && t.IsFloat()) {
23674 v.reset(OpARM64FMOVDstore)
23675 v.AddArg3(ptr, val, mem)
23680 func rewriteValueARM64_OpZero(v *Value) bool {
23684 config := b.Func.Config
23685 typ := &b.Func.Config.Types
23686 // match: (Zero [0] _ mem)
23689 if auxIntToInt64(v.AuxInt) != 0 {
23696 // match: (Zero [1] ptr mem)
23697 // result: (MOVBstore ptr (MOVDconst [0]) mem)
23699 if auxIntToInt64(v.AuxInt) != 1 {
23704 v.reset(OpARM64MOVBstore)
23705 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23706 v0.AuxInt = int64ToAuxInt(0)
23707 v.AddArg3(ptr, v0, mem)
23710 // match: (Zero [2] ptr mem)
23711 // result: (MOVHstore ptr (MOVDconst [0]) mem)
23713 if auxIntToInt64(v.AuxInt) != 2 {
23718 v.reset(OpARM64MOVHstore)
23719 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23720 v0.AuxInt = int64ToAuxInt(0)
23721 v.AddArg3(ptr, v0, mem)
23724 // match: (Zero [4] ptr mem)
23725 // result: (MOVWstore ptr (MOVDconst [0]) mem)
23727 if auxIntToInt64(v.AuxInt) != 4 {
23732 v.reset(OpARM64MOVWstore)
23733 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23734 v0.AuxInt = int64ToAuxInt(0)
23735 v.AddArg3(ptr, v0, mem)
23738 // match: (Zero [3] ptr mem)
23739 // result: (MOVBstore [2] ptr (MOVDconst [0]) (MOVHstore ptr (MOVDconst [0]) mem))
23741 if auxIntToInt64(v.AuxInt) != 3 {
23746 v.reset(OpARM64MOVBstore)
23747 v.AuxInt = int32ToAuxInt(2)
23748 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23749 v0.AuxInt = int64ToAuxInt(0)
23750 v1 := b.NewValue0(v.Pos, OpARM64MOVHstore, types.TypeMem)
23751 v1.AddArg3(ptr, v0, mem)
23752 v.AddArg3(ptr, v0, v1)
23755 // match: (Zero [5] ptr mem)
23756 // result: (MOVBstore [4] ptr (MOVDconst [0]) (MOVWstore ptr (MOVDconst [0]) mem))
23758 if auxIntToInt64(v.AuxInt) != 5 {
23763 v.reset(OpARM64MOVBstore)
23764 v.AuxInt = int32ToAuxInt(4)
23765 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23766 v0.AuxInt = int64ToAuxInt(0)
23767 v1 := b.NewValue0(v.Pos, OpARM64MOVWstore, types.TypeMem)
23768 v1.AddArg3(ptr, v0, mem)
23769 v.AddArg3(ptr, v0, v1)
23772 // match: (Zero [6] ptr mem)
23773 // result: (MOVHstore [4] ptr (MOVDconst [0]) (MOVWstore ptr (MOVDconst [0]) mem))
23775 if auxIntToInt64(v.AuxInt) != 6 {
23780 v.reset(OpARM64MOVHstore)
23781 v.AuxInt = int32ToAuxInt(4)
23782 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23783 v0.AuxInt = int64ToAuxInt(0)
23784 v1 := b.NewValue0(v.Pos, OpARM64MOVWstore, types.TypeMem)
23785 v1.AddArg3(ptr, v0, mem)
23786 v.AddArg3(ptr, v0, v1)
23789 // match: (Zero [7] ptr mem)
23790 // result: (MOVWstore [3] ptr (MOVDconst [0]) (MOVWstore ptr (MOVDconst [0]) mem))
23792 if auxIntToInt64(v.AuxInt) != 7 {
23797 v.reset(OpARM64MOVWstore)
23798 v.AuxInt = int32ToAuxInt(3)
23799 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23800 v0.AuxInt = int64ToAuxInt(0)
23801 v1 := b.NewValue0(v.Pos, OpARM64MOVWstore, types.TypeMem)
23802 v1.AddArg3(ptr, v0, mem)
23803 v.AddArg3(ptr, v0, v1)
23806 // match: (Zero [8] ptr mem)
23807 // result: (MOVDstore ptr (MOVDconst [0]) mem)
23809 if auxIntToInt64(v.AuxInt) != 8 {
23814 v.reset(OpARM64MOVDstore)
23815 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23816 v0.AuxInt = int64ToAuxInt(0)
23817 v.AddArg3(ptr, v0, mem)
23820 // match: (Zero [9] ptr mem)
23821 // result: (MOVBstore [8] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem))
23823 if auxIntToInt64(v.AuxInt) != 9 {
23828 v.reset(OpARM64MOVBstore)
23829 v.AuxInt = int32ToAuxInt(8)
23830 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23831 v0.AuxInt = int64ToAuxInt(0)
23832 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
23833 v1.AddArg3(ptr, v0, mem)
23834 v.AddArg3(ptr, v0, v1)
23837 // match: (Zero [10] ptr mem)
23838 // result: (MOVHstore [8] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem))
23840 if auxIntToInt64(v.AuxInt) != 10 {
23845 v.reset(OpARM64MOVHstore)
23846 v.AuxInt = int32ToAuxInt(8)
23847 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23848 v0.AuxInt = int64ToAuxInt(0)
23849 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
23850 v1.AddArg3(ptr, v0, mem)
23851 v.AddArg3(ptr, v0, v1)
23854 // match: (Zero [11] ptr mem)
23855 // result: (MOVDstore [3] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem))
23857 if auxIntToInt64(v.AuxInt) != 11 {
23862 v.reset(OpARM64MOVDstore)
23863 v.AuxInt = int32ToAuxInt(3)
23864 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23865 v0.AuxInt = int64ToAuxInt(0)
23866 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
23867 v1.AddArg3(ptr, v0, mem)
23868 v.AddArg3(ptr, v0, v1)
23871 // match: (Zero [12] ptr mem)
23872 // result: (MOVWstore [8] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem))
23874 if auxIntToInt64(v.AuxInt) != 12 {
23879 v.reset(OpARM64MOVWstore)
23880 v.AuxInt = int32ToAuxInt(8)
23881 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23882 v0.AuxInt = int64ToAuxInt(0)
23883 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
23884 v1.AddArg3(ptr, v0, mem)
23885 v.AddArg3(ptr, v0, v1)
23888 // match: (Zero [13] ptr mem)
23889 // result: (MOVDstore [5] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem))
23891 if auxIntToInt64(v.AuxInt) != 13 {
23896 v.reset(OpARM64MOVDstore)
23897 v.AuxInt = int32ToAuxInt(5)
23898 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23899 v0.AuxInt = int64ToAuxInt(0)
23900 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
23901 v1.AddArg3(ptr, v0, mem)
23902 v.AddArg3(ptr, v0, v1)
23905 // match: (Zero [14] ptr mem)
23906 // result: (MOVDstore [6] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem))
23908 if auxIntToInt64(v.AuxInt) != 14 {
23913 v.reset(OpARM64MOVDstore)
23914 v.AuxInt = int32ToAuxInt(6)
23915 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23916 v0.AuxInt = int64ToAuxInt(0)
23917 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
23918 v1.AddArg3(ptr, v0, mem)
23919 v.AddArg3(ptr, v0, v1)
23922 // match: (Zero [15] ptr mem)
23923 // result: (MOVDstore [7] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem))
23925 if auxIntToInt64(v.AuxInt) != 15 {
23930 v.reset(OpARM64MOVDstore)
23931 v.AuxInt = int32ToAuxInt(7)
23932 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23933 v0.AuxInt = int64ToAuxInt(0)
23934 v1 := b.NewValue0(v.Pos, OpARM64MOVDstore, types.TypeMem)
23935 v1.AddArg3(ptr, v0, mem)
23936 v.AddArg3(ptr, v0, v1)
23939 // match: (Zero [16] ptr mem)
23940 // result: (STP [0] ptr (MOVDconst [0]) (MOVDconst [0]) mem)
23942 if auxIntToInt64(v.AuxInt) != 16 {
23947 v.reset(OpARM64STP)
23948 v.AuxInt = int32ToAuxInt(0)
23949 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23950 v0.AuxInt = int64ToAuxInt(0)
23951 v.AddArg4(ptr, v0, v0, mem)
23954 // match: (Zero [32] ptr mem)
23955 // result: (STP [16] ptr (MOVDconst [0]) (MOVDconst [0]) (STP [0] ptr (MOVDconst [0]) (MOVDconst [0]) mem))
23957 if auxIntToInt64(v.AuxInt) != 32 {
23962 v.reset(OpARM64STP)
23963 v.AuxInt = int32ToAuxInt(16)
23964 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23965 v0.AuxInt = int64ToAuxInt(0)
23966 v1 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
23967 v1.AuxInt = int32ToAuxInt(0)
23968 v1.AddArg4(ptr, v0, v0, mem)
23969 v.AddArg4(ptr, v0, v0, v1)
23972 // match: (Zero [48] ptr mem)
23973 // result: (STP [32] ptr (MOVDconst [0]) (MOVDconst [0]) (STP [16] ptr (MOVDconst [0]) (MOVDconst [0]) (STP [0] ptr (MOVDconst [0]) (MOVDconst [0]) mem)))
23975 if auxIntToInt64(v.AuxInt) != 48 {
23980 v.reset(OpARM64STP)
23981 v.AuxInt = int32ToAuxInt(32)
23982 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
23983 v0.AuxInt = int64ToAuxInt(0)
23984 v1 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
23985 v1.AuxInt = int32ToAuxInt(16)
23986 v2 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
23987 v2.AuxInt = int32ToAuxInt(0)
23988 v2.AddArg4(ptr, v0, v0, mem)
23989 v1.AddArg4(ptr, v0, v0, v2)
23990 v.AddArg4(ptr, v0, v0, v1)
23993 // match: (Zero [64] ptr mem)
23994 // result: (STP [48] ptr (MOVDconst [0]) (MOVDconst [0]) (STP [32] ptr (MOVDconst [0]) (MOVDconst [0]) (STP [16] ptr (MOVDconst [0]) (MOVDconst [0]) (STP [0] ptr (MOVDconst [0]) (MOVDconst [0]) mem))))
23996 if auxIntToInt64(v.AuxInt) != 64 {
24001 v.reset(OpARM64STP)
24002 v.AuxInt = int32ToAuxInt(48)
24003 v0 := b.NewValue0(v.Pos, OpARM64MOVDconst, typ.UInt64)
24004 v0.AuxInt = int64ToAuxInt(0)
24005 v1 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
24006 v1.AuxInt = int32ToAuxInt(32)
24007 v2 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
24008 v2.AuxInt = int32ToAuxInt(16)
24009 v3 := b.NewValue0(v.Pos, OpARM64STP, types.TypeMem)
24010 v3.AuxInt = int32ToAuxInt(0)
24011 v3.AddArg4(ptr, v0, v0, mem)
24012 v2.AddArg4(ptr, v0, v0, v3)
24013 v1.AddArg4(ptr, v0, v0, v2)
24014 v.AddArg4(ptr, v0, v0, v1)
24017 // match: (Zero [s] ptr mem)
24018 // cond: s%16 != 0 && s%16 <= 8 && s > 16
24019 // result: (Zero [8] (OffPtr <ptr.Type> ptr [s-8]) (Zero [s-s%16] ptr mem))
24021 s := auxIntToInt64(v.AuxInt)
24024 if !(s%16 != 0 && s%16 <= 8 && s > 16) {
24028 v.AuxInt = int64ToAuxInt(8)
24029 v0 := b.NewValue0(v.Pos, OpOffPtr, ptr.Type)
24030 v0.AuxInt = int64ToAuxInt(s - 8)
24032 v1 := b.NewValue0(v.Pos, OpZero, types.TypeMem)
24033 v1.AuxInt = int64ToAuxInt(s - s%16)
24034 v1.AddArg2(ptr, mem)
24038 // match: (Zero [s] ptr mem)
24039 // cond: s%16 != 0 && s%16 > 8 && s > 16
24040 // result: (Zero [16] (OffPtr <ptr.Type> ptr [s-16]) (Zero [s-s%16] ptr mem))
24042 s := auxIntToInt64(v.AuxInt)
24045 if !(s%16 != 0 && s%16 > 8 && s > 16) {
24049 v.AuxInt = int64ToAuxInt(16)
24050 v0 := b.NewValue0(v.Pos, OpOffPtr, ptr.Type)
24051 v0.AuxInt = int64ToAuxInt(s - 16)
24053 v1 := b.NewValue0(v.Pos, OpZero, types.TypeMem)
24054 v1.AuxInt = int64ToAuxInt(s - s%16)
24055 v1.AddArg2(ptr, mem)
24059 // match: (Zero [s] ptr mem)
24060 // cond: s%16 == 0 && s > 64 && s <= 16*64 && !config.noDuffDevice
24061 // result: (DUFFZERO [4 * (64 - s/16)] ptr mem)
24063 s := auxIntToInt64(v.AuxInt)
24066 if !(s%16 == 0 && s > 64 && s <= 16*64 && !config.noDuffDevice) {
24069 v.reset(OpARM64DUFFZERO)
24070 v.AuxInt = int64ToAuxInt(4 * (64 - s/16))
24071 v.AddArg2(ptr, mem)
24074 // match: (Zero [s] ptr mem)
24075 // cond: s%16 == 0 && (s > 16*64 || config.noDuffDevice)
24076 // result: (LoweredZero ptr (ADDconst <ptr.Type> [s-16] ptr) mem)
24078 s := auxIntToInt64(v.AuxInt)
24081 if !(s%16 == 0 && (s > 16*64 || config.noDuffDevice)) {
24084 v.reset(OpARM64LoweredZero)
24085 v0 := b.NewValue0(v.Pos, OpARM64ADDconst, ptr.Type)
24086 v0.AuxInt = int64ToAuxInt(s - 16)
24088 v.AddArg3(ptr, v0, mem)
24093 func rewriteBlockARM64(b *Block) bool {
24094 typ := &b.Func.Config.Types
24097 // match: (EQ (CMPconst [0] z:(AND x y)) yes no)
24098 // cond: z.Uses == 1
24099 // result: (EQ (TST x y) yes no)
24100 for b.Controls[0].Op == OpARM64CMPconst {
24101 v_0 := b.Controls[0]
24102 if auxIntToInt64(v_0.AuxInt) != 0 {
24106 if z.Op != OpARM64AND {
24112 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
24115 if !(z.Uses == 1) {
24118 v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags)
24120 b.resetWithControl(BlockARM64EQ, v0)
24125 // match: (EQ (CMPconst [0] x:(ANDconst [c] y)) yes no)
24126 // cond: x.Uses == 1
24127 // result: (EQ (TSTconst [c] y) yes no)
24128 for b.Controls[0].Op == OpARM64CMPconst {
24129 v_0 := b.Controls[0]
24130 if auxIntToInt64(v_0.AuxInt) != 0 {
24134 if x.Op != OpARM64ANDconst {
24137 c := auxIntToInt64(x.AuxInt)
24139 if !(x.Uses == 1) {
24142 v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags)
24143 v0.AuxInt = int64ToAuxInt(c)
24145 b.resetWithControl(BlockARM64EQ, v0)
24148 // match: (EQ (CMPWconst [0] z:(AND x y)) yes no)
24149 // cond: z.Uses == 1
24150 // result: (EQ (TSTW x y) yes no)
24151 for b.Controls[0].Op == OpARM64CMPWconst {
24152 v_0 := b.Controls[0]
24153 if auxIntToInt32(v_0.AuxInt) != 0 {
24157 if z.Op != OpARM64AND {
24163 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
24166 if !(z.Uses == 1) {
24169 v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags)
24171 b.resetWithControl(BlockARM64EQ, v0)
24176 // match: (EQ (CMPWconst [0] x:(ANDconst [c] y)) yes no)
24177 // cond: x.Uses == 1
24178 // result: (EQ (TSTWconst [int32(c)] y) yes no)
24179 for b.Controls[0].Op == OpARM64CMPWconst {
24180 v_0 := b.Controls[0]
24181 if auxIntToInt32(v_0.AuxInt) != 0 {
24185 if x.Op != OpARM64ANDconst {
24188 c := auxIntToInt64(x.AuxInt)
24190 if !(x.Uses == 1) {
24193 v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags)
24194 v0.AuxInt = int32ToAuxInt(int32(c))
24196 b.resetWithControl(BlockARM64EQ, v0)
24199 // match: (EQ (CMPconst [0] x:(ADDconst [c] y)) yes no)
24200 // cond: x.Uses == 1
24201 // result: (EQ (CMNconst [c] y) yes no)
24202 for b.Controls[0].Op == OpARM64CMPconst {
24203 v_0 := b.Controls[0]
24204 if auxIntToInt64(v_0.AuxInt) != 0 {
24208 if x.Op != OpARM64ADDconst {
24211 c := auxIntToInt64(x.AuxInt)
24213 if !(x.Uses == 1) {
24216 v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags)
24217 v0.AuxInt = int64ToAuxInt(c)
24219 b.resetWithControl(BlockARM64EQ, v0)
24222 // match: (EQ (CMPWconst [0] x:(ADDconst [c] y)) yes no)
24223 // cond: x.Uses == 1
24224 // result: (EQ (CMNWconst [int32(c)] y) yes no)
24225 for b.Controls[0].Op == OpARM64CMPWconst {
24226 v_0 := b.Controls[0]
24227 if auxIntToInt32(v_0.AuxInt) != 0 {
24231 if x.Op != OpARM64ADDconst {
24234 c := auxIntToInt64(x.AuxInt)
24236 if !(x.Uses == 1) {
24239 v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags)
24240 v0.AuxInt = int32ToAuxInt(int32(c))
24242 b.resetWithControl(BlockARM64EQ, v0)
24245 // match: (EQ (CMPconst [0] z:(ADD x y)) yes no)
24246 // cond: z.Uses == 1
24247 // result: (EQ (CMN x y) yes no)
24248 for b.Controls[0].Op == OpARM64CMPconst {
24249 v_0 := b.Controls[0]
24250 if auxIntToInt64(v_0.AuxInt) != 0 {
24254 if z.Op != OpARM64ADD {
24260 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
24263 if !(z.Uses == 1) {
24266 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
24268 b.resetWithControl(BlockARM64EQ, v0)
24273 // match: (EQ (CMPWconst [0] z:(ADD x y)) yes no)
24274 // cond: z.Uses == 1
24275 // result: (EQ (CMNW x y) yes no)
24276 for b.Controls[0].Op == OpARM64CMPWconst {
24277 v_0 := b.Controls[0]
24278 if auxIntToInt32(v_0.AuxInt) != 0 {
24282 if z.Op != OpARM64ADD {
24288 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
24291 if !(z.Uses == 1) {
24294 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
24296 b.resetWithControl(BlockARM64EQ, v0)
24301 // match: (EQ (CMP x z:(NEG y)) yes no)
24302 // cond: z.Uses == 1
24303 // result: (EQ (CMN x y) yes no)
24304 for b.Controls[0].Op == OpARM64CMP {
24305 v_0 := b.Controls[0]
24309 if z.Op != OpARM64NEG {
24313 if !(z.Uses == 1) {
24316 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
24318 b.resetWithControl(BlockARM64EQ, v0)
24321 // match: (EQ (CMPW x z:(NEG y)) yes no)
24322 // cond: z.Uses == 1
24323 // result: (EQ (CMNW x y) yes no)
24324 for b.Controls[0].Op == OpARM64CMPW {
24325 v_0 := b.Controls[0]
24329 if z.Op != OpARM64NEG {
24333 if !(z.Uses == 1) {
24336 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
24338 b.resetWithControl(BlockARM64EQ, v0)
24341 // match: (EQ (CMPconst [0] x) yes no)
24342 // result: (Z x yes no)
24343 for b.Controls[0].Op == OpARM64CMPconst {
24344 v_0 := b.Controls[0]
24345 if auxIntToInt64(v_0.AuxInt) != 0 {
24349 b.resetWithControl(BlockARM64Z, x)
24352 // match: (EQ (CMPWconst [0] x) yes no)
24353 // result: (ZW x yes no)
24354 for b.Controls[0].Op == OpARM64CMPWconst {
24355 v_0 := b.Controls[0]
24356 if auxIntToInt32(v_0.AuxInt) != 0 {
24360 b.resetWithControl(BlockARM64ZW, x)
24363 // match: (EQ (CMPconst [0] z:(MADD a x y)) yes no)
24365 // result: (EQ (CMN a (MUL <x.Type> x y)) yes no)
24366 for b.Controls[0].Op == OpARM64CMPconst {
24367 v_0 := b.Controls[0]
24368 if auxIntToInt64(v_0.AuxInt) != 0 {
24372 if z.Op != OpARM64MADD {
24378 if !(z.Uses == 1) {
24381 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
24382 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
24385 b.resetWithControl(BlockARM64EQ, v0)
24388 // match: (EQ (CMPconst [0] z:(MSUB a x y)) yes no)
24390 // result: (EQ (CMP a (MUL <x.Type> x y)) yes no)
24391 for b.Controls[0].Op == OpARM64CMPconst {
24392 v_0 := b.Controls[0]
24393 if auxIntToInt64(v_0.AuxInt) != 0 {
24397 if z.Op != OpARM64MSUB {
24403 if !(z.Uses == 1) {
24406 v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags)
24407 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
24410 b.resetWithControl(BlockARM64EQ, v0)
24413 // match: (EQ (CMPWconst [0] z:(MADDW a x y)) yes no)
24415 // result: (EQ (CMNW a (MULW <x.Type> x y)) yes no)
24416 for b.Controls[0].Op == OpARM64CMPWconst {
24417 v_0 := b.Controls[0]
24418 if auxIntToInt32(v_0.AuxInt) != 0 {
24422 if z.Op != OpARM64MADDW {
24428 if !(z.Uses == 1) {
24431 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
24432 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
24435 b.resetWithControl(BlockARM64EQ, v0)
24438 // match: (EQ (CMPWconst [0] z:(MSUBW a x y)) yes no)
24440 // result: (EQ (CMPW a (MULW <x.Type> x y)) yes no)
24441 for b.Controls[0].Op == OpARM64CMPWconst {
24442 v_0 := b.Controls[0]
24443 if auxIntToInt32(v_0.AuxInt) != 0 {
24447 if z.Op != OpARM64MSUBW {
24453 if !(z.Uses == 1) {
24456 v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags)
24457 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
24460 b.resetWithControl(BlockARM64EQ, v0)
24463 // match: (EQ (TSTconst [c] x) yes no)
24465 // result: (TBZ [int64(ntz64(c))] x yes no)
24466 for b.Controls[0].Op == OpARM64TSTconst {
24467 v_0 := b.Controls[0]
24468 c := auxIntToInt64(v_0.AuxInt)
24473 b.resetWithControl(BlockARM64TBZ, x)
24474 b.AuxInt = int64ToAuxInt(int64(ntz64(c)))
24477 // match: (EQ (TSTWconst [c] x) yes no)
24478 // cond: oneBit(int64(uint32(c)))
24479 // result: (TBZ [int64(ntz64(int64(uint32(c))))] x yes no)
24480 for b.Controls[0].Op == OpARM64TSTWconst {
24481 v_0 := b.Controls[0]
24482 c := auxIntToInt32(v_0.AuxInt)
24484 if !(oneBit(int64(uint32(c)))) {
24487 b.resetWithControl(BlockARM64TBZ, x)
24488 b.AuxInt = int64ToAuxInt(int64(ntz64(int64(uint32(c)))))
24491 // match: (EQ (FlagConstant [fc]) yes no)
24493 // result: (First yes no)
24494 for b.Controls[0].Op == OpARM64FlagConstant {
24495 v_0 := b.Controls[0]
24496 fc := auxIntToFlagConstant(v_0.AuxInt)
24500 b.Reset(BlockFirst)
24503 // match: (EQ (FlagConstant [fc]) yes no)
24505 // result: (First no yes)
24506 for b.Controls[0].Op == OpARM64FlagConstant {
24507 v_0 := b.Controls[0]
24508 fc := auxIntToFlagConstant(v_0.AuxInt)
24512 b.Reset(BlockFirst)
24516 // match: (EQ (InvertFlags cmp) yes no)
24517 // result: (EQ cmp yes no)
24518 for b.Controls[0].Op == OpARM64InvertFlags {
24519 v_0 := b.Controls[0]
24521 b.resetWithControl(BlockARM64EQ, cmp)
24524 case BlockARM64FGE:
24525 // match: (FGE (InvertFlags cmp) yes no)
24526 // result: (FLE cmp yes no)
24527 for b.Controls[0].Op == OpARM64InvertFlags {
24528 v_0 := b.Controls[0]
24530 b.resetWithControl(BlockARM64FLE, cmp)
24533 case BlockARM64FGT:
24534 // match: (FGT (InvertFlags cmp) yes no)
24535 // result: (FLT cmp yes no)
24536 for b.Controls[0].Op == OpARM64InvertFlags {
24537 v_0 := b.Controls[0]
24539 b.resetWithControl(BlockARM64FLT, cmp)
24542 case BlockARM64FLE:
24543 // match: (FLE (InvertFlags cmp) yes no)
24544 // result: (FGE cmp yes no)
24545 for b.Controls[0].Op == OpARM64InvertFlags {
24546 v_0 := b.Controls[0]
24548 b.resetWithControl(BlockARM64FGE, cmp)
24551 case BlockARM64FLT:
24552 // match: (FLT (InvertFlags cmp) yes no)
24553 // result: (FGT cmp yes no)
24554 for b.Controls[0].Op == OpARM64InvertFlags {
24555 v_0 := b.Controls[0]
24557 b.resetWithControl(BlockARM64FGT, cmp)
24561 // match: (GE (CMPconst [0] z:(AND x y)) yes no)
24562 // cond: z.Uses == 1
24563 // result: (GE (TST x y) yes no)
24564 for b.Controls[0].Op == OpARM64CMPconst {
24565 v_0 := b.Controls[0]
24566 if auxIntToInt64(v_0.AuxInt) != 0 {
24570 if z.Op != OpARM64AND {
24576 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
24579 if !(z.Uses == 1) {
24582 v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags)
24584 b.resetWithControl(BlockARM64GE, v0)
24589 // match: (GE (CMPconst [0] x:(ANDconst [c] y)) yes no)
24590 // cond: x.Uses == 1
24591 // result: (GE (TSTconst [c] y) yes no)
24592 for b.Controls[0].Op == OpARM64CMPconst {
24593 v_0 := b.Controls[0]
24594 if auxIntToInt64(v_0.AuxInt) != 0 {
24598 if x.Op != OpARM64ANDconst {
24601 c := auxIntToInt64(x.AuxInt)
24603 if !(x.Uses == 1) {
24606 v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags)
24607 v0.AuxInt = int64ToAuxInt(c)
24609 b.resetWithControl(BlockARM64GE, v0)
24612 // match: (GE (CMPWconst [0] z:(AND x y)) yes no)
24613 // cond: z.Uses == 1
24614 // result: (GE (TSTW x y) yes no)
24615 for b.Controls[0].Op == OpARM64CMPWconst {
24616 v_0 := b.Controls[0]
24617 if auxIntToInt32(v_0.AuxInt) != 0 {
24621 if z.Op != OpARM64AND {
24627 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
24630 if !(z.Uses == 1) {
24633 v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags)
24635 b.resetWithControl(BlockARM64GE, v0)
24640 // match: (GE (CMPWconst [0] x:(ANDconst [c] y)) yes no)
24641 // cond: x.Uses == 1
24642 // result: (GE (TSTWconst [int32(c)] y) yes no)
24643 for b.Controls[0].Op == OpARM64CMPWconst {
24644 v_0 := b.Controls[0]
24645 if auxIntToInt32(v_0.AuxInt) != 0 {
24649 if x.Op != OpARM64ANDconst {
24652 c := auxIntToInt64(x.AuxInt)
24654 if !(x.Uses == 1) {
24657 v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags)
24658 v0.AuxInt = int32ToAuxInt(int32(c))
24660 b.resetWithControl(BlockARM64GE, v0)
24663 // match: (GE (CMPconst [0] x:(ADDconst [c] y)) yes no)
24664 // cond: x.Uses == 1
24665 // result: (GEnoov (CMNconst [c] y) yes no)
24666 for b.Controls[0].Op == OpARM64CMPconst {
24667 v_0 := b.Controls[0]
24668 if auxIntToInt64(v_0.AuxInt) != 0 {
24672 if x.Op != OpARM64ADDconst {
24675 c := auxIntToInt64(x.AuxInt)
24677 if !(x.Uses == 1) {
24680 v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags)
24681 v0.AuxInt = int64ToAuxInt(c)
24683 b.resetWithControl(BlockARM64GEnoov, v0)
24686 // match: (GE (CMPWconst [0] x:(ADDconst [c] y)) yes no)
24687 // cond: x.Uses == 1
24688 // result: (GEnoov (CMNWconst [int32(c)] y) yes no)
24689 for b.Controls[0].Op == OpARM64CMPWconst {
24690 v_0 := b.Controls[0]
24691 if auxIntToInt32(v_0.AuxInt) != 0 {
24695 if x.Op != OpARM64ADDconst {
24698 c := auxIntToInt64(x.AuxInt)
24700 if !(x.Uses == 1) {
24703 v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags)
24704 v0.AuxInt = int32ToAuxInt(int32(c))
24706 b.resetWithControl(BlockARM64GEnoov, v0)
24709 // match: (GE (CMPconst [0] z:(ADD x y)) yes no)
24710 // cond: z.Uses == 1
24711 // result: (GEnoov (CMN x y) yes no)
24712 for b.Controls[0].Op == OpARM64CMPconst {
24713 v_0 := b.Controls[0]
24714 if auxIntToInt64(v_0.AuxInt) != 0 {
24718 if z.Op != OpARM64ADD {
24724 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
24727 if !(z.Uses == 1) {
24730 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
24732 b.resetWithControl(BlockARM64GEnoov, v0)
24737 // match: (GE (CMPWconst [0] z:(ADD x y)) yes no)
24738 // cond: z.Uses == 1
24739 // result: (GEnoov (CMNW x y) yes no)
24740 for b.Controls[0].Op == OpARM64CMPWconst {
24741 v_0 := b.Controls[0]
24742 if auxIntToInt32(v_0.AuxInt) != 0 {
24746 if z.Op != OpARM64ADD {
24752 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
24755 if !(z.Uses == 1) {
24758 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
24760 b.resetWithControl(BlockARM64GEnoov, v0)
24765 // match: (GE (CMPconst [0] z:(MADD a x y)) yes no)
24767 // result: (GEnoov (CMN a (MUL <x.Type> x y)) yes no)
24768 for b.Controls[0].Op == OpARM64CMPconst {
24769 v_0 := b.Controls[0]
24770 if auxIntToInt64(v_0.AuxInt) != 0 {
24774 if z.Op != OpARM64MADD {
24780 if !(z.Uses == 1) {
24783 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
24784 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
24787 b.resetWithControl(BlockARM64GEnoov, v0)
24790 // match: (GE (CMPconst [0] z:(MSUB a x y)) yes no)
24792 // result: (GEnoov (CMP a (MUL <x.Type> x y)) yes no)
24793 for b.Controls[0].Op == OpARM64CMPconst {
24794 v_0 := b.Controls[0]
24795 if auxIntToInt64(v_0.AuxInt) != 0 {
24799 if z.Op != OpARM64MSUB {
24805 if !(z.Uses == 1) {
24808 v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags)
24809 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
24812 b.resetWithControl(BlockARM64GEnoov, v0)
24815 // match: (GE (CMPWconst [0] z:(MADDW a x y)) yes no)
24817 // result: (GEnoov (CMNW a (MULW <x.Type> x y)) yes no)
24818 for b.Controls[0].Op == OpARM64CMPWconst {
24819 v_0 := b.Controls[0]
24820 if auxIntToInt32(v_0.AuxInt) != 0 {
24824 if z.Op != OpARM64MADDW {
24830 if !(z.Uses == 1) {
24833 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
24834 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
24837 b.resetWithControl(BlockARM64GEnoov, v0)
24840 // match: (GE (CMPWconst [0] z:(MSUBW a x y)) yes no)
24842 // result: (GEnoov (CMPW a (MULW <x.Type> x y)) yes no)
24843 for b.Controls[0].Op == OpARM64CMPWconst {
24844 v_0 := b.Controls[0]
24845 if auxIntToInt32(v_0.AuxInt) != 0 {
24849 if z.Op != OpARM64MSUBW {
24855 if !(z.Uses == 1) {
24858 v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags)
24859 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
24862 b.resetWithControl(BlockARM64GEnoov, v0)
24865 // match: (GE (CMPWconst [0] x) yes no)
24866 // result: (TBZ [31] x yes no)
24867 for b.Controls[0].Op == OpARM64CMPWconst {
24868 v_0 := b.Controls[0]
24869 if auxIntToInt32(v_0.AuxInt) != 0 {
24873 b.resetWithControl(BlockARM64TBZ, x)
24874 b.AuxInt = int64ToAuxInt(31)
24877 // match: (GE (CMPconst [0] x) yes no)
24878 // result: (TBZ [63] x yes no)
24879 for b.Controls[0].Op == OpARM64CMPconst {
24880 v_0 := b.Controls[0]
24881 if auxIntToInt64(v_0.AuxInt) != 0 {
24885 b.resetWithControl(BlockARM64TBZ, x)
24886 b.AuxInt = int64ToAuxInt(63)
24889 // match: (GE (FlagConstant [fc]) yes no)
24891 // result: (First yes no)
24892 for b.Controls[0].Op == OpARM64FlagConstant {
24893 v_0 := b.Controls[0]
24894 fc := auxIntToFlagConstant(v_0.AuxInt)
24898 b.Reset(BlockFirst)
24901 // match: (GE (FlagConstant [fc]) yes no)
24903 // result: (First no yes)
24904 for b.Controls[0].Op == OpARM64FlagConstant {
24905 v_0 := b.Controls[0]
24906 fc := auxIntToFlagConstant(v_0.AuxInt)
24910 b.Reset(BlockFirst)
24914 // match: (GE (InvertFlags cmp) yes no)
24915 // result: (LE cmp yes no)
24916 for b.Controls[0].Op == OpARM64InvertFlags {
24917 v_0 := b.Controls[0]
24919 b.resetWithControl(BlockARM64LE, cmp)
24922 case BlockARM64GEnoov:
24923 // match: (GEnoov (FlagConstant [fc]) yes no)
24924 // cond: fc.geNoov()
24925 // result: (First yes no)
24926 for b.Controls[0].Op == OpARM64FlagConstant {
24927 v_0 := b.Controls[0]
24928 fc := auxIntToFlagConstant(v_0.AuxInt)
24929 if !(fc.geNoov()) {
24932 b.Reset(BlockFirst)
24935 // match: (GEnoov (FlagConstant [fc]) yes no)
24936 // cond: !fc.geNoov()
24937 // result: (First no yes)
24938 for b.Controls[0].Op == OpARM64FlagConstant {
24939 v_0 := b.Controls[0]
24940 fc := auxIntToFlagConstant(v_0.AuxInt)
24941 if !(!fc.geNoov()) {
24944 b.Reset(BlockFirst)
24948 // match: (GEnoov (InvertFlags cmp) yes no)
24949 // result: (LEnoov cmp yes no)
24950 for b.Controls[0].Op == OpARM64InvertFlags {
24951 v_0 := b.Controls[0]
24953 b.resetWithControl(BlockARM64LEnoov, cmp)
24957 // match: (GT (CMPconst [0] z:(AND x y)) yes no)
24958 // cond: z.Uses == 1
24959 // result: (GT (TST x y) yes no)
24960 for b.Controls[0].Op == OpARM64CMPconst {
24961 v_0 := b.Controls[0]
24962 if auxIntToInt64(v_0.AuxInt) != 0 {
24966 if z.Op != OpARM64AND {
24972 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
24975 if !(z.Uses == 1) {
24978 v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags)
24980 b.resetWithControl(BlockARM64GT, v0)
24985 // match: (GT (CMPconst [0] x:(ANDconst [c] y)) yes no)
24986 // cond: x.Uses == 1
24987 // result: (GT (TSTconst [c] y) yes no)
24988 for b.Controls[0].Op == OpARM64CMPconst {
24989 v_0 := b.Controls[0]
24990 if auxIntToInt64(v_0.AuxInt) != 0 {
24994 if x.Op != OpARM64ANDconst {
24997 c := auxIntToInt64(x.AuxInt)
24999 if !(x.Uses == 1) {
25002 v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags)
25003 v0.AuxInt = int64ToAuxInt(c)
25005 b.resetWithControl(BlockARM64GT, v0)
25008 // match: (GT (CMPWconst [0] z:(AND x y)) yes no)
25009 // cond: z.Uses == 1
25010 // result: (GT (TSTW x y) yes no)
25011 for b.Controls[0].Op == OpARM64CMPWconst {
25012 v_0 := b.Controls[0]
25013 if auxIntToInt32(v_0.AuxInt) != 0 {
25017 if z.Op != OpARM64AND {
25023 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
25026 if !(z.Uses == 1) {
25029 v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags)
25031 b.resetWithControl(BlockARM64GT, v0)
25036 // match: (GT (CMPWconst [0] x:(ANDconst [c] y)) yes no)
25037 // cond: x.Uses == 1
25038 // result: (GT (TSTWconst [int32(c)] y) yes no)
25039 for b.Controls[0].Op == OpARM64CMPWconst {
25040 v_0 := b.Controls[0]
25041 if auxIntToInt32(v_0.AuxInt) != 0 {
25045 if x.Op != OpARM64ANDconst {
25048 c := auxIntToInt64(x.AuxInt)
25050 if !(x.Uses == 1) {
25053 v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags)
25054 v0.AuxInt = int32ToAuxInt(int32(c))
25056 b.resetWithControl(BlockARM64GT, v0)
25059 // match: (GT (CMPconst [0] x:(ADDconst [c] y)) yes no)
25060 // cond: x.Uses == 1
25061 // result: (GTnoov (CMNconst [c] y) yes no)
25062 for b.Controls[0].Op == OpARM64CMPconst {
25063 v_0 := b.Controls[0]
25064 if auxIntToInt64(v_0.AuxInt) != 0 {
25068 if x.Op != OpARM64ADDconst {
25071 c := auxIntToInt64(x.AuxInt)
25073 if !(x.Uses == 1) {
25076 v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags)
25077 v0.AuxInt = int64ToAuxInt(c)
25079 b.resetWithControl(BlockARM64GTnoov, v0)
25082 // match: (GT (CMPWconst [0] x:(ADDconst [c] y)) yes no)
25083 // cond: x.Uses == 1
25084 // result: (GTnoov (CMNWconst [int32(c)] y) yes no)
25085 for b.Controls[0].Op == OpARM64CMPWconst {
25086 v_0 := b.Controls[0]
25087 if auxIntToInt32(v_0.AuxInt) != 0 {
25091 if x.Op != OpARM64ADDconst {
25094 c := auxIntToInt64(x.AuxInt)
25096 if !(x.Uses == 1) {
25099 v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags)
25100 v0.AuxInt = int32ToAuxInt(int32(c))
25102 b.resetWithControl(BlockARM64GTnoov, v0)
25105 // match: (GT (CMPconst [0] z:(ADD x y)) yes no)
25106 // cond: z.Uses == 1
25107 // result: (GTnoov (CMN x y) yes no)
25108 for b.Controls[0].Op == OpARM64CMPconst {
25109 v_0 := b.Controls[0]
25110 if auxIntToInt64(v_0.AuxInt) != 0 {
25114 if z.Op != OpARM64ADD {
25120 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
25123 if !(z.Uses == 1) {
25126 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
25128 b.resetWithControl(BlockARM64GTnoov, v0)
25133 // match: (GT (CMPWconst [0] z:(ADD x y)) yes no)
25134 // cond: z.Uses == 1
25135 // result: (GTnoov (CMNW x y) yes no)
25136 for b.Controls[0].Op == OpARM64CMPWconst {
25137 v_0 := b.Controls[0]
25138 if auxIntToInt32(v_0.AuxInt) != 0 {
25142 if z.Op != OpARM64ADD {
25148 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
25151 if !(z.Uses == 1) {
25154 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
25156 b.resetWithControl(BlockARM64GTnoov, v0)
25161 // match: (GT (CMPconst [0] z:(MADD a x y)) yes no)
25163 // result: (GTnoov (CMN a (MUL <x.Type> x y)) yes no)
25164 for b.Controls[0].Op == OpARM64CMPconst {
25165 v_0 := b.Controls[0]
25166 if auxIntToInt64(v_0.AuxInt) != 0 {
25170 if z.Op != OpARM64MADD {
25176 if !(z.Uses == 1) {
25179 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
25180 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
25183 b.resetWithControl(BlockARM64GTnoov, v0)
25186 // match: (GT (CMPconst [0] z:(MSUB a x y)) yes no)
25188 // result: (GTnoov (CMP a (MUL <x.Type> x y)) yes no)
25189 for b.Controls[0].Op == OpARM64CMPconst {
25190 v_0 := b.Controls[0]
25191 if auxIntToInt64(v_0.AuxInt) != 0 {
25195 if z.Op != OpARM64MSUB {
25201 if !(z.Uses == 1) {
25204 v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags)
25205 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
25208 b.resetWithControl(BlockARM64GTnoov, v0)
25211 // match: (GT (CMPWconst [0] z:(MADDW a x y)) yes no)
25213 // result: (GTnoov (CMNW a (MULW <x.Type> x y)) yes no)
25214 for b.Controls[0].Op == OpARM64CMPWconst {
25215 v_0 := b.Controls[0]
25216 if auxIntToInt32(v_0.AuxInt) != 0 {
25220 if z.Op != OpARM64MADDW {
25226 if !(z.Uses == 1) {
25229 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
25230 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
25233 b.resetWithControl(BlockARM64GTnoov, v0)
25236 // match: (GT (CMPWconst [0] z:(MSUBW a x y)) yes no)
25238 // result: (GTnoov (CMPW a (MULW <x.Type> x y)) yes no)
25239 for b.Controls[0].Op == OpARM64CMPWconst {
25240 v_0 := b.Controls[0]
25241 if auxIntToInt32(v_0.AuxInt) != 0 {
25245 if z.Op != OpARM64MSUBW {
25251 if !(z.Uses == 1) {
25254 v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags)
25255 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
25258 b.resetWithControl(BlockARM64GTnoov, v0)
25261 // match: (GT (FlagConstant [fc]) yes no)
25263 // result: (First yes no)
25264 for b.Controls[0].Op == OpARM64FlagConstant {
25265 v_0 := b.Controls[0]
25266 fc := auxIntToFlagConstant(v_0.AuxInt)
25270 b.Reset(BlockFirst)
25273 // match: (GT (FlagConstant [fc]) yes no)
25275 // result: (First no yes)
25276 for b.Controls[0].Op == OpARM64FlagConstant {
25277 v_0 := b.Controls[0]
25278 fc := auxIntToFlagConstant(v_0.AuxInt)
25282 b.Reset(BlockFirst)
25286 // match: (GT (InvertFlags cmp) yes no)
25287 // result: (LT cmp yes no)
25288 for b.Controls[0].Op == OpARM64InvertFlags {
25289 v_0 := b.Controls[0]
25291 b.resetWithControl(BlockARM64LT, cmp)
25294 case BlockARM64GTnoov:
25295 // match: (GTnoov (FlagConstant [fc]) yes no)
25296 // cond: fc.gtNoov()
25297 // result: (First yes no)
25298 for b.Controls[0].Op == OpARM64FlagConstant {
25299 v_0 := b.Controls[0]
25300 fc := auxIntToFlagConstant(v_0.AuxInt)
25301 if !(fc.gtNoov()) {
25304 b.Reset(BlockFirst)
25307 // match: (GTnoov (FlagConstant [fc]) yes no)
25308 // cond: !fc.gtNoov()
25309 // result: (First no yes)
25310 for b.Controls[0].Op == OpARM64FlagConstant {
25311 v_0 := b.Controls[0]
25312 fc := auxIntToFlagConstant(v_0.AuxInt)
25313 if !(!fc.gtNoov()) {
25316 b.Reset(BlockFirst)
25320 // match: (GTnoov (InvertFlags cmp) yes no)
25321 // result: (LTnoov cmp yes no)
25322 for b.Controls[0].Op == OpARM64InvertFlags {
25323 v_0 := b.Controls[0]
25325 b.resetWithControl(BlockARM64LTnoov, cmp)
25329 // match: (If (Equal cc) yes no)
25330 // result: (EQ cc yes no)
25331 for b.Controls[0].Op == OpARM64Equal {
25332 v_0 := b.Controls[0]
25334 b.resetWithControl(BlockARM64EQ, cc)
25337 // match: (If (NotEqual cc) yes no)
25338 // result: (NE cc yes no)
25339 for b.Controls[0].Op == OpARM64NotEqual {
25340 v_0 := b.Controls[0]
25342 b.resetWithControl(BlockARM64NE, cc)
25345 // match: (If (LessThan cc) yes no)
25346 // result: (LT cc yes no)
25347 for b.Controls[0].Op == OpARM64LessThan {
25348 v_0 := b.Controls[0]
25350 b.resetWithControl(BlockARM64LT, cc)
25353 // match: (If (LessThanU cc) yes no)
25354 // result: (ULT cc yes no)
25355 for b.Controls[0].Op == OpARM64LessThanU {
25356 v_0 := b.Controls[0]
25358 b.resetWithControl(BlockARM64ULT, cc)
25361 // match: (If (LessEqual cc) yes no)
25362 // result: (LE cc yes no)
25363 for b.Controls[0].Op == OpARM64LessEqual {
25364 v_0 := b.Controls[0]
25366 b.resetWithControl(BlockARM64LE, cc)
25369 // match: (If (LessEqualU cc) yes no)
25370 // result: (ULE cc yes no)
25371 for b.Controls[0].Op == OpARM64LessEqualU {
25372 v_0 := b.Controls[0]
25374 b.resetWithControl(BlockARM64ULE, cc)
25377 // match: (If (GreaterThan cc) yes no)
25378 // result: (GT cc yes no)
25379 for b.Controls[0].Op == OpARM64GreaterThan {
25380 v_0 := b.Controls[0]
25382 b.resetWithControl(BlockARM64GT, cc)
25385 // match: (If (GreaterThanU cc) yes no)
25386 // result: (UGT cc yes no)
25387 for b.Controls[0].Op == OpARM64GreaterThanU {
25388 v_0 := b.Controls[0]
25390 b.resetWithControl(BlockARM64UGT, cc)
25393 // match: (If (GreaterEqual cc) yes no)
25394 // result: (GE cc yes no)
25395 for b.Controls[0].Op == OpARM64GreaterEqual {
25396 v_0 := b.Controls[0]
25398 b.resetWithControl(BlockARM64GE, cc)
25401 // match: (If (GreaterEqualU cc) yes no)
25402 // result: (UGE cc yes no)
25403 for b.Controls[0].Op == OpARM64GreaterEqualU {
25404 v_0 := b.Controls[0]
25406 b.resetWithControl(BlockARM64UGE, cc)
25409 // match: (If (LessThanF cc) yes no)
25410 // result: (FLT cc yes no)
25411 for b.Controls[0].Op == OpARM64LessThanF {
25412 v_0 := b.Controls[0]
25414 b.resetWithControl(BlockARM64FLT, cc)
25417 // match: (If (LessEqualF cc) yes no)
25418 // result: (FLE cc yes no)
25419 for b.Controls[0].Op == OpARM64LessEqualF {
25420 v_0 := b.Controls[0]
25422 b.resetWithControl(BlockARM64FLE, cc)
25425 // match: (If (GreaterThanF cc) yes no)
25426 // result: (FGT cc yes no)
25427 for b.Controls[0].Op == OpARM64GreaterThanF {
25428 v_0 := b.Controls[0]
25430 b.resetWithControl(BlockARM64FGT, cc)
25433 // match: (If (GreaterEqualF cc) yes no)
25434 // result: (FGE cc yes no)
25435 for b.Controls[0].Op == OpARM64GreaterEqualF {
25436 v_0 := b.Controls[0]
25438 b.resetWithControl(BlockARM64FGE, cc)
25441 // match: (If cond yes no)
25442 // result: (TBNZ [0] cond yes no)
25444 cond := b.Controls[0]
25445 b.resetWithControl(BlockARM64TBNZ, cond)
25446 b.AuxInt = int64ToAuxInt(0)
25449 case BlockJumpTable:
25450 // match: (JumpTable idx)
25451 // result: (JUMPTABLE {makeJumpTableSym(b)} idx (MOVDaddr <typ.Uintptr> {makeJumpTableSym(b)} (SB)))
25453 idx := b.Controls[0]
25454 v0 := b.NewValue0(b.Pos, OpARM64MOVDaddr, typ.Uintptr)
25455 v0.Aux = symToAux(makeJumpTableSym(b))
25456 v1 := b.NewValue0(b.Pos, OpSB, typ.Uintptr)
25458 b.resetWithControl2(BlockARM64JUMPTABLE, idx, v0)
25459 b.Aux = symToAux(makeJumpTableSym(b))
25463 // match: (LE (CMPconst [0] z:(AND x y)) yes no)
25464 // cond: z.Uses == 1
25465 // result: (LE (TST x y) yes no)
25466 for b.Controls[0].Op == OpARM64CMPconst {
25467 v_0 := b.Controls[0]
25468 if auxIntToInt64(v_0.AuxInt) != 0 {
25472 if z.Op != OpARM64AND {
25478 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
25481 if !(z.Uses == 1) {
25484 v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags)
25486 b.resetWithControl(BlockARM64LE, v0)
25491 // match: (LE (CMPconst [0] x:(ANDconst [c] y)) yes no)
25492 // cond: x.Uses == 1
25493 // result: (LE (TSTconst [c] y) yes no)
25494 for b.Controls[0].Op == OpARM64CMPconst {
25495 v_0 := b.Controls[0]
25496 if auxIntToInt64(v_0.AuxInt) != 0 {
25500 if x.Op != OpARM64ANDconst {
25503 c := auxIntToInt64(x.AuxInt)
25505 if !(x.Uses == 1) {
25508 v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags)
25509 v0.AuxInt = int64ToAuxInt(c)
25511 b.resetWithControl(BlockARM64LE, v0)
25514 // match: (LE (CMPWconst [0] z:(AND x y)) yes no)
25515 // cond: z.Uses == 1
25516 // result: (LE (TSTW x y) yes no)
25517 for b.Controls[0].Op == OpARM64CMPWconst {
25518 v_0 := b.Controls[0]
25519 if auxIntToInt32(v_0.AuxInt) != 0 {
25523 if z.Op != OpARM64AND {
25529 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
25532 if !(z.Uses == 1) {
25535 v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags)
25537 b.resetWithControl(BlockARM64LE, v0)
25542 // match: (LE (CMPWconst [0] x:(ANDconst [c] y)) yes no)
25543 // cond: x.Uses == 1
25544 // result: (LE (TSTWconst [int32(c)] y) yes no)
25545 for b.Controls[0].Op == OpARM64CMPWconst {
25546 v_0 := b.Controls[0]
25547 if auxIntToInt32(v_0.AuxInt) != 0 {
25551 if x.Op != OpARM64ANDconst {
25554 c := auxIntToInt64(x.AuxInt)
25556 if !(x.Uses == 1) {
25559 v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags)
25560 v0.AuxInt = int32ToAuxInt(int32(c))
25562 b.resetWithControl(BlockARM64LE, v0)
25565 // match: (LE (CMPconst [0] x:(ADDconst [c] y)) yes no)
25566 // cond: x.Uses == 1
25567 // result: (LEnoov (CMNconst [c] y) yes no)
25568 for b.Controls[0].Op == OpARM64CMPconst {
25569 v_0 := b.Controls[0]
25570 if auxIntToInt64(v_0.AuxInt) != 0 {
25574 if x.Op != OpARM64ADDconst {
25577 c := auxIntToInt64(x.AuxInt)
25579 if !(x.Uses == 1) {
25582 v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags)
25583 v0.AuxInt = int64ToAuxInt(c)
25585 b.resetWithControl(BlockARM64LEnoov, v0)
25588 // match: (LE (CMPWconst [0] x:(ADDconst [c] y)) yes no)
25589 // cond: x.Uses == 1
25590 // result: (LEnoov (CMNWconst [int32(c)] y) yes no)
25591 for b.Controls[0].Op == OpARM64CMPWconst {
25592 v_0 := b.Controls[0]
25593 if auxIntToInt32(v_0.AuxInt) != 0 {
25597 if x.Op != OpARM64ADDconst {
25600 c := auxIntToInt64(x.AuxInt)
25602 if !(x.Uses == 1) {
25605 v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags)
25606 v0.AuxInt = int32ToAuxInt(int32(c))
25608 b.resetWithControl(BlockARM64LEnoov, v0)
25611 // match: (LE (CMPconst [0] z:(ADD x y)) yes no)
25612 // cond: z.Uses == 1
25613 // result: (LEnoov (CMN x y) yes no)
25614 for b.Controls[0].Op == OpARM64CMPconst {
25615 v_0 := b.Controls[0]
25616 if auxIntToInt64(v_0.AuxInt) != 0 {
25620 if z.Op != OpARM64ADD {
25626 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
25629 if !(z.Uses == 1) {
25632 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
25634 b.resetWithControl(BlockARM64LEnoov, v0)
25639 // match: (LE (CMPWconst [0] z:(ADD x y)) yes no)
25640 // cond: z.Uses == 1
25641 // result: (LEnoov (CMNW x y) yes no)
25642 for b.Controls[0].Op == OpARM64CMPWconst {
25643 v_0 := b.Controls[0]
25644 if auxIntToInt32(v_0.AuxInt) != 0 {
25648 if z.Op != OpARM64ADD {
25654 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
25657 if !(z.Uses == 1) {
25660 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
25662 b.resetWithControl(BlockARM64LEnoov, v0)
25667 // match: (LE (CMPconst [0] z:(MADD a x y)) yes no)
25669 // result: (LEnoov (CMN a (MUL <x.Type> x y)) yes no)
25670 for b.Controls[0].Op == OpARM64CMPconst {
25671 v_0 := b.Controls[0]
25672 if auxIntToInt64(v_0.AuxInt) != 0 {
25676 if z.Op != OpARM64MADD {
25682 if !(z.Uses == 1) {
25685 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
25686 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
25689 b.resetWithControl(BlockARM64LEnoov, v0)
25692 // match: (LE (CMPconst [0] z:(MSUB a x y)) yes no)
25694 // result: (LEnoov (CMP a (MUL <x.Type> x y)) yes no)
25695 for b.Controls[0].Op == OpARM64CMPconst {
25696 v_0 := b.Controls[0]
25697 if auxIntToInt64(v_0.AuxInt) != 0 {
25701 if z.Op != OpARM64MSUB {
25707 if !(z.Uses == 1) {
25710 v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags)
25711 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
25714 b.resetWithControl(BlockARM64LEnoov, v0)
25717 // match: (LE (CMPWconst [0] z:(MADDW a x y)) yes no)
25719 // result: (LEnoov (CMNW a (MULW <x.Type> x y)) yes no)
25720 for b.Controls[0].Op == OpARM64CMPWconst {
25721 v_0 := b.Controls[0]
25722 if auxIntToInt32(v_0.AuxInt) != 0 {
25726 if z.Op != OpARM64MADDW {
25732 if !(z.Uses == 1) {
25735 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
25736 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
25739 b.resetWithControl(BlockARM64LEnoov, v0)
25742 // match: (LE (CMPWconst [0] z:(MSUBW a x y)) yes no)
25744 // result: (LEnoov (CMPW a (MULW <x.Type> x y)) yes no)
25745 for b.Controls[0].Op == OpARM64CMPWconst {
25746 v_0 := b.Controls[0]
25747 if auxIntToInt32(v_0.AuxInt) != 0 {
25751 if z.Op != OpARM64MSUBW {
25757 if !(z.Uses == 1) {
25760 v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags)
25761 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
25764 b.resetWithControl(BlockARM64LEnoov, v0)
25767 // match: (LE (FlagConstant [fc]) yes no)
25769 // result: (First yes no)
25770 for b.Controls[0].Op == OpARM64FlagConstant {
25771 v_0 := b.Controls[0]
25772 fc := auxIntToFlagConstant(v_0.AuxInt)
25776 b.Reset(BlockFirst)
25779 // match: (LE (FlagConstant [fc]) yes no)
25781 // result: (First no yes)
25782 for b.Controls[0].Op == OpARM64FlagConstant {
25783 v_0 := b.Controls[0]
25784 fc := auxIntToFlagConstant(v_0.AuxInt)
25788 b.Reset(BlockFirst)
25792 // match: (LE (InvertFlags cmp) yes no)
25793 // result: (GE cmp yes no)
25794 for b.Controls[0].Op == OpARM64InvertFlags {
25795 v_0 := b.Controls[0]
25797 b.resetWithControl(BlockARM64GE, cmp)
25800 case BlockARM64LEnoov:
25801 // match: (LEnoov (FlagConstant [fc]) yes no)
25802 // cond: fc.leNoov()
25803 // result: (First yes no)
25804 for b.Controls[0].Op == OpARM64FlagConstant {
25805 v_0 := b.Controls[0]
25806 fc := auxIntToFlagConstant(v_0.AuxInt)
25807 if !(fc.leNoov()) {
25810 b.Reset(BlockFirst)
25813 // match: (LEnoov (FlagConstant [fc]) yes no)
25814 // cond: !fc.leNoov()
25815 // result: (First no yes)
25816 for b.Controls[0].Op == OpARM64FlagConstant {
25817 v_0 := b.Controls[0]
25818 fc := auxIntToFlagConstant(v_0.AuxInt)
25819 if !(!fc.leNoov()) {
25822 b.Reset(BlockFirst)
25826 // match: (LEnoov (InvertFlags cmp) yes no)
25827 // result: (GEnoov cmp yes no)
25828 for b.Controls[0].Op == OpARM64InvertFlags {
25829 v_0 := b.Controls[0]
25831 b.resetWithControl(BlockARM64GEnoov, cmp)
25835 // match: (LT (CMPconst [0] z:(AND x y)) yes no)
25836 // cond: z.Uses == 1
25837 // result: (LT (TST x y) yes no)
25838 for b.Controls[0].Op == OpARM64CMPconst {
25839 v_0 := b.Controls[0]
25840 if auxIntToInt64(v_0.AuxInt) != 0 {
25844 if z.Op != OpARM64AND {
25850 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
25853 if !(z.Uses == 1) {
25856 v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags)
25858 b.resetWithControl(BlockARM64LT, v0)
25863 // match: (LT (CMPconst [0] x:(ANDconst [c] y)) yes no)
25864 // cond: x.Uses == 1
25865 // result: (LT (TSTconst [c] y) yes no)
25866 for b.Controls[0].Op == OpARM64CMPconst {
25867 v_0 := b.Controls[0]
25868 if auxIntToInt64(v_0.AuxInt) != 0 {
25872 if x.Op != OpARM64ANDconst {
25875 c := auxIntToInt64(x.AuxInt)
25877 if !(x.Uses == 1) {
25880 v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags)
25881 v0.AuxInt = int64ToAuxInt(c)
25883 b.resetWithControl(BlockARM64LT, v0)
25886 // match: (LT (CMPWconst [0] z:(AND x y)) yes no)
25887 // cond: z.Uses == 1
25888 // result: (LT (TSTW x y) yes no)
25889 for b.Controls[0].Op == OpARM64CMPWconst {
25890 v_0 := b.Controls[0]
25891 if auxIntToInt32(v_0.AuxInt) != 0 {
25895 if z.Op != OpARM64AND {
25901 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
25904 if !(z.Uses == 1) {
25907 v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags)
25909 b.resetWithControl(BlockARM64LT, v0)
25914 // match: (LT (CMPWconst [0] x:(ANDconst [c] y)) yes no)
25915 // cond: x.Uses == 1
25916 // result: (LT (TSTWconst [int32(c)] y) yes no)
25917 for b.Controls[0].Op == OpARM64CMPWconst {
25918 v_0 := b.Controls[0]
25919 if auxIntToInt32(v_0.AuxInt) != 0 {
25923 if x.Op != OpARM64ANDconst {
25926 c := auxIntToInt64(x.AuxInt)
25928 if !(x.Uses == 1) {
25931 v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags)
25932 v0.AuxInt = int32ToAuxInt(int32(c))
25934 b.resetWithControl(BlockARM64LT, v0)
25937 // match: (LT (CMPconst [0] x:(ADDconst [c] y)) yes no)
25938 // cond: x.Uses == 1
25939 // result: (LTnoov (CMNconst [c] y) yes no)
25940 for b.Controls[0].Op == OpARM64CMPconst {
25941 v_0 := b.Controls[0]
25942 if auxIntToInt64(v_0.AuxInt) != 0 {
25946 if x.Op != OpARM64ADDconst {
25949 c := auxIntToInt64(x.AuxInt)
25951 if !(x.Uses == 1) {
25954 v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags)
25955 v0.AuxInt = int64ToAuxInt(c)
25957 b.resetWithControl(BlockARM64LTnoov, v0)
25960 // match: (LT (CMPWconst [0] x:(ADDconst [c] y)) yes no)
25961 // cond: x.Uses == 1
25962 // result: (LTnoov (CMNWconst [int32(c)] y) yes no)
25963 for b.Controls[0].Op == OpARM64CMPWconst {
25964 v_0 := b.Controls[0]
25965 if auxIntToInt32(v_0.AuxInt) != 0 {
25969 if x.Op != OpARM64ADDconst {
25972 c := auxIntToInt64(x.AuxInt)
25974 if !(x.Uses == 1) {
25977 v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags)
25978 v0.AuxInt = int32ToAuxInt(int32(c))
25980 b.resetWithControl(BlockARM64LTnoov, v0)
25983 // match: (LT (CMPconst [0] z:(ADD x y)) yes no)
25984 // cond: z.Uses == 1
25985 // result: (LTnoov (CMN x y) yes no)
25986 for b.Controls[0].Op == OpARM64CMPconst {
25987 v_0 := b.Controls[0]
25988 if auxIntToInt64(v_0.AuxInt) != 0 {
25992 if z.Op != OpARM64ADD {
25998 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
26001 if !(z.Uses == 1) {
26004 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
26006 b.resetWithControl(BlockARM64LTnoov, v0)
26011 // match: (LT (CMPWconst [0] z:(ADD x y)) yes no)
26012 // cond: z.Uses == 1
26013 // result: (LTnoov (CMNW x y) yes no)
26014 for b.Controls[0].Op == OpARM64CMPWconst {
26015 v_0 := b.Controls[0]
26016 if auxIntToInt32(v_0.AuxInt) != 0 {
26020 if z.Op != OpARM64ADD {
26026 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
26029 if !(z.Uses == 1) {
26032 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
26034 b.resetWithControl(BlockARM64LTnoov, v0)
26039 // match: (LT (CMPconst [0] z:(MADD a x y)) yes no)
26041 // result: (LTnoov (CMN a (MUL <x.Type> x y)) yes no)
26042 for b.Controls[0].Op == OpARM64CMPconst {
26043 v_0 := b.Controls[0]
26044 if auxIntToInt64(v_0.AuxInt) != 0 {
26048 if z.Op != OpARM64MADD {
26054 if !(z.Uses == 1) {
26057 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
26058 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
26061 b.resetWithControl(BlockARM64LTnoov, v0)
26064 // match: (LT (CMPconst [0] z:(MSUB a x y)) yes no)
26066 // result: (LTnoov (CMP a (MUL <x.Type> x y)) yes no)
26067 for b.Controls[0].Op == OpARM64CMPconst {
26068 v_0 := b.Controls[0]
26069 if auxIntToInt64(v_0.AuxInt) != 0 {
26073 if z.Op != OpARM64MSUB {
26079 if !(z.Uses == 1) {
26082 v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags)
26083 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
26086 b.resetWithControl(BlockARM64LTnoov, v0)
26089 // match: (LT (CMPWconst [0] z:(MADDW a x y)) yes no)
26091 // result: (LTnoov (CMNW a (MULW <x.Type> x y)) yes no)
26092 for b.Controls[0].Op == OpARM64CMPWconst {
26093 v_0 := b.Controls[0]
26094 if auxIntToInt32(v_0.AuxInt) != 0 {
26098 if z.Op != OpARM64MADDW {
26104 if !(z.Uses == 1) {
26107 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
26108 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
26111 b.resetWithControl(BlockARM64LTnoov, v0)
26114 // match: (LT (CMPWconst [0] z:(MSUBW a x y)) yes no)
26116 // result: (LTnoov (CMPW a (MULW <x.Type> x y)) yes no)
26117 for b.Controls[0].Op == OpARM64CMPWconst {
26118 v_0 := b.Controls[0]
26119 if auxIntToInt32(v_0.AuxInt) != 0 {
26123 if z.Op != OpARM64MSUBW {
26129 if !(z.Uses == 1) {
26132 v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags)
26133 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
26136 b.resetWithControl(BlockARM64LTnoov, v0)
26139 // match: (LT (CMPWconst [0] x) yes no)
26140 // result: (TBNZ [31] x yes no)
26141 for b.Controls[0].Op == OpARM64CMPWconst {
26142 v_0 := b.Controls[0]
26143 if auxIntToInt32(v_0.AuxInt) != 0 {
26147 b.resetWithControl(BlockARM64TBNZ, x)
26148 b.AuxInt = int64ToAuxInt(31)
26151 // match: (LT (CMPconst [0] x) yes no)
26152 // result: (TBNZ [63] x yes no)
26153 for b.Controls[0].Op == OpARM64CMPconst {
26154 v_0 := b.Controls[0]
26155 if auxIntToInt64(v_0.AuxInt) != 0 {
26159 b.resetWithControl(BlockARM64TBNZ, x)
26160 b.AuxInt = int64ToAuxInt(63)
26163 // match: (LT (FlagConstant [fc]) yes no)
26165 // result: (First yes no)
26166 for b.Controls[0].Op == OpARM64FlagConstant {
26167 v_0 := b.Controls[0]
26168 fc := auxIntToFlagConstant(v_0.AuxInt)
26172 b.Reset(BlockFirst)
26175 // match: (LT (FlagConstant [fc]) yes no)
26177 // result: (First no yes)
26178 for b.Controls[0].Op == OpARM64FlagConstant {
26179 v_0 := b.Controls[0]
26180 fc := auxIntToFlagConstant(v_0.AuxInt)
26184 b.Reset(BlockFirst)
26188 // match: (LT (InvertFlags cmp) yes no)
26189 // result: (GT cmp yes no)
26190 for b.Controls[0].Op == OpARM64InvertFlags {
26191 v_0 := b.Controls[0]
26193 b.resetWithControl(BlockARM64GT, cmp)
26196 case BlockARM64LTnoov:
26197 // match: (LTnoov (FlagConstant [fc]) yes no)
26198 // cond: fc.ltNoov()
26199 // result: (First yes no)
26200 for b.Controls[0].Op == OpARM64FlagConstant {
26201 v_0 := b.Controls[0]
26202 fc := auxIntToFlagConstant(v_0.AuxInt)
26203 if !(fc.ltNoov()) {
26206 b.Reset(BlockFirst)
26209 // match: (LTnoov (FlagConstant [fc]) yes no)
26210 // cond: !fc.ltNoov()
26211 // result: (First no yes)
26212 for b.Controls[0].Op == OpARM64FlagConstant {
26213 v_0 := b.Controls[0]
26214 fc := auxIntToFlagConstant(v_0.AuxInt)
26215 if !(!fc.ltNoov()) {
26218 b.Reset(BlockFirst)
26222 // match: (LTnoov (InvertFlags cmp) yes no)
26223 // result: (GTnoov cmp yes no)
26224 for b.Controls[0].Op == OpARM64InvertFlags {
26225 v_0 := b.Controls[0]
26227 b.resetWithControl(BlockARM64GTnoov, cmp)
26231 // match: (NE (CMPconst [0] z:(AND x y)) yes no)
26232 // cond: z.Uses == 1
26233 // result: (NE (TST x y) yes no)
26234 for b.Controls[0].Op == OpARM64CMPconst {
26235 v_0 := b.Controls[0]
26236 if auxIntToInt64(v_0.AuxInt) != 0 {
26240 if z.Op != OpARM64AND {
26246 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
26249 if !(z.Uses == 1) {
26252 v0 := b.NewValue0(v_0.Pos, OpARM64TST, types.TypeFlags)
26254 b.resetWithControl(BlockARM64NE, v0)
26259 // match: (NE (CMPconst [0] x:(ANDconst [c] y)) yes no)
26260 // cond: x.Uses == 1
26261 // result: (NE (TSTconst [c] y) yes no)
26262 for b.Controls[0].Op == OpARM64CMPconst {
26263 v_0 := b.Controls[0]
26264 if auxIntToInt64(v_0.AuxInt) != 0 {
26268 if x.Op != OpARM64ANDconst {
26271 c := auxIntToInt64(x.AuxInt)
26273 if !(x.Uses == 1) {
26276 v0 := b.NewValue0(v_0.Pos, OpARM64TSTconst, types.TypeFlags)
26277 v0.AuxInt = int64ToAuxInt(c)
26279 b.resetWithControl(BlockARM64NE, v0)
26282 // match: (NE (CMPWconst [0] z:(AND x y)) yes no)
26283 // cond: z.Uses == 1
26284 // result: (NE (TSTW x y) yes no)
26285 for b.Controls[0].Op == OpARM64CMPWconst {
26286 v_0 := b.Controls[0]
26287 if auxIntToInt32(v_0.AuxInt) != 0 {
26291 if z.Op != OpARM64AND {
26297 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
26300 if !(z.Uses == 1) {
26303 v0 := b.NewValue0(v_0.Pos, OpARM64TSTW, types.TypeFlags)
26305 b.resetWithControl(BlockARM64NE, v0)
26310 // match: (NE (CMPWconst [0] x:(ANDconst [c] y)) yes no)
26311 // cond: x.Uses == 1
26312 // result: (NE (TSTWconst [int32(c)] y) yes no)
26313 for b.Controls[0].Op == OpARM64CMPWconst {
26314 v_0 := b.Controls[0]
26315 if auxIntToInt32(v_0.AuxInt) != 0 {
26319 if x.Op != OpARM64ANDconst {
26322 c := auxIntToInt64(x.AuxInt)
26324 if !(x.Uses == 1) {
26327 v0 := b.NewValue0(v_0.Pos, OpARM64TSTWconst, types.TypeFlags)
26328 v0.AuxInt = int32ToAuxInt(int32(c))
26330 b.resetWithControl(BlockARM64NE, v0)
26333 // match: (NE (CMPconst [0] x:(ADDconst [c] y)) yes no)
26334 // cond: x.Uses == 1
26335 // result: (NE (CMNconst [c] y) yes no)
26336 for b.Controls[0].Op == OpARM64CMPconst {
26337 v_0 := b.Controls[0]
26338 if auxIntToInt64(v_0.AuxInt) != 0 {
26342 if x.Op != OpARM64ADDconst {
26345 c := auxIntToInt64(x.AuxInt)
26347 if !(x.Uses == 1) {
26350 v0 := b.NewValue0(v_0.Pos, OpARM64CMNconst, types.TypeFlags)
26351 v0.AuxInt = int64ToAuxInt(c)
26353 b.resetWithControl(BlockARM64NE, v0)
26356 // match: (NE (CMPWconst [0] x:(ADDconst [c] y)) yes no)
26357 // cond: x.Uses == 1
26358 // result: (NE (CMNWconst [int32(c)] y) yes no)
26359 for b.Controls[0].Op == OpARM64CMPWconst {
26360 v_0 := b.Controls[0]
26361 if auxIntToInt32(v_0.AuxInt) != 0 {
26365 if x.Op != OpARM64ADDconst {
26368 c := auxIntToInt64(x.AuxInt)
26370 if !(x.Uses == 1) {
26373 v0 := b.NewValue0(v_0.Pos, OpARM64CMNWconst, types.TypeFlags)
26374 v0.AuxInt = int32ToAuxInt(int32(c))
26376 b.resetWithControl(BlockARM64NE, v0)
26379 // match: (NE (CMPconst [0] z:(ADD x y)) yes no)
26380 // cond: z.Uses == 1
26381 // result: (NE (CMN x y) yes no)
26382 for b.Controls[0].Op == OpARM64CMPconst {
26383 v_0 := b.Controls[0]
26384 if auxIntToInt64(v_0.AuxInt) != 0 {
26388 if z.Op != OpARM64ADD {
26394 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
26397 if !(z.Uses == 1) {
26400 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
26402 b.resetWithControl(BlockARM64NE, v0)
26407 // match: (NE (CMPWconst [0] z:(ADD x y)) yes no)
26408 // cond: z.Uses == 1
26409 // result: (NE (CMNW x y) yes no)
26410 for b.Controls[0].Op == OpARM64CMPWconst {
26411 v_0 := b.Controls[0]
26412 if auxIntToInt32(v_0.AuxInt) != 0 {
26416 if z.Op != OpARM64ADD {
26422 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
26425 if !(z.Uses == 1) {
26428 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
26430 b.resetWithControl(BlockARM64NE, v0)
26435 // match: (NE (CMP x z:(NEG y)) yes no)
26436 // cond: z.Uses == 1
26437 // result: (NE (CMN x y) yes no)
26438 for b.Controls[0].Op == OpARM64CMP {
26439 v_0 := b.Controls[0]
26443 if z.Op != OpARM64NEG {
26447 if !(z.Uses == 1) {
26450 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
26452 b.resetWithControl(BlockARM64NE, v0)
26455 // match: (NE (CMPW x z:(NEG y)) yes no)
26456 // cond: z.Uses == 1
26457 // result: (NE (CMNW x y) yes no)
26458 for b.Controls[0].Op == OpARM64CMPW {
26459 v_0 := b.Controls[0]
26463 if z.Op != OpARM64NEG {
26467 if !(z.Uses == 1) {
26470 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
26472 b.resetWithControl(BlockARM64NE, v0)
26475 // match: (NE (CMPconst [0] x) yes no)
26476 // result: (NZ x yes no)
26477 for b.Controls[0].Op == OpARM64CMPconst {
26478 v_0 := b.Controls[0]
26479 if auxIntToInt64(v_0.AuxInt) != 0 {
26483 b.resetWithControl(BlockARM64NZ, x)
26486 // match: (NE (CMPWconst [0] x) yes no)
26487 // result: (NZW x yes no)
26488 for b.Controls[0].Op == OpARM64CMPWconst {
26489 v_0 := b.Controls[0]
26490 if auxIntToInt32(v_0.AuxInt) != 0 {
26494 b.resetWithControl(BlockARM64NZW, x)
26497 // match: (NE (CMPconst [0] z:(MADD a x y)) yes no)
26499 // result: (NE (CMN a (MUL <x.Type> x y)) yes no)
26500 for b.Controls[0].Op == OpARM64CMPconst {
26501 v_0 := b.Controls[0]
26502 if auxIntToInt64(v_0.AuxInt) != 0 {
26506 if z.Op != OpARM64MADD {
26512 if !(z.Uses == 1) {
26515 v0 := b.NewValue0(v_0.Pos, OpARM64CMN, types.TypeFlags)
26516 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
26519 b.resetWithControl(BlockARM64NE, v0)
26522 // match: (NE (CMPconst [0] z:(MSUB a x y)) yes no)
26524 // result: (NE (CMP a (MUL <x.Type> x y)) yes no)
26525 for b.Controls[0].Op == OpARM64CMPconst {
26526 v_0 := b.Controls[0]
26527 if auxIntToInt64(v_0.AuxInt) != 0 {
26531 if z.Op != OpARM64MSUB {
26537 if !(z.Uses == 1) {
26540 v0 := b.NewValue0(v_0.Pos, OpARM64CMP, types.TypeFlags)
26541 v1 := b.NewValue0(v_0.Pos, OpARM64MUL, x.Type)
26544 b.resetWithControl(BlockARM64NE, v0)
26547 // match: (NE (CMPWconst [0] z:(MADDW a x y)) yes no)
26549 // result: (NE (CMNW a (MULW <x.Type> x y)) yes no)
26550 for b.Controls[0].Op == OpARM64CMPWconst {
26551 v_0 := b.Controls[0]
26552 if auxIntToInt32(v_0.AuxInt) != 0 {
26556 if z.Op != OpARM64MADDW {
26562 if !(z.Uses == 1) {
26565 v0 := b.NewValue0(v_0.Pos, OpARM64CMNW, types.TypeFlags)
26566 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
26569 b.resetWithControl(BlockARM64NE, v0)
26572 // match: (NE (CMPWconst [0] z:(MSUBW a x y)) yes no)
26574 // result: (NE (CMPW a (MULW <x.Type> x y)) yes no)
26575 for b.Controls[0].Op == OpARM64CMPWconst {
26576 v_0 := b.Controls[0]
26577 if auxIntToInt32(v_0.AuxInt) != 0 {
26581 if z.Op != OpARM64MSUBW {
26587 if !(z.Uses == 1) {
26590 v0 := b.NewValue0(v_0.Pos, OpARM64CMPW, types.TypeFlags)
26591 v1 := b.NewValue0(v_0.Pos, OpARM64MULW, x.Type)
26594 b.resetWithControl(BlockARM64NE, v0)
26597 // match: (NE (TSTconst [c] x) yes no)
26599 // result: (TBNZ [int64(ntz64(c))] x yes no)
26600 for b.Controls[0].Op == OpARM64TSTconst {
26601 v_0 := b.Controls[0]
26602 c := auxIntToInt64(v_0.AuxInt)
26607 b.resetWithControl(BlockARM64TBNZ, x)
26608 b.AuxInt = int64ToAuxInt(int64(ntz64(c)))
26611 // match: (NE (TSTWconst [c] x) yes no)
26612 // cond: oneBit(int64(uint32(c)))
26613 // result: (TBNZ [int64(ntz64(int64(uint32(c))))] x yes no)
26614 for b.Controls[0].Op == OpARM64TSTWconst {
26615 v_0 := b.Controls[0]
26616 c := auxIntToInt32(v_0.AuxInt)
26618 if !(oneBit(int64(uint32(c)))) {
26621 b.resetWithControl(BlockARM64TBNZ, x)
26622 b.AuxInt = int64ToAuxInt(int64(ntz64(int64(uint32(c)))))
26625 // match: (NE (FlagConstant [fc]) yes no)
26627 // result: (First yes no)
26628 for b.Controls[0].Op == OpARM64FlagConstant {
26629 v_0 := b.Controls[0]
26630 fc := auxIntToFlagConstant(v_0.AuxInt)
26634 b.Reset(BlockFirst)
26637 // match: (NE (FlagConstant [fc]) yes no)
26639 // result: (First no yes)
26640 for b.Controls[0].Op == OpARM64FlagConstant {
26641 v_0 := b.Controls[0]
26642 fc := auxIntToFlagConstant(v_0.AuxInt)
26646 b.Reset(BlockFirst)
26650 // match: (NE (InvertFlags cmp) yes no)
26651 // result: (NE cmp yes no)
26652 for b.Controls[0].Op == OpARM64InvertFlags {
26653 v_0 := b.Controls[0]
26655 b.resetWithControl(BlockARM64NE, cmp)
26659 // match: (NZ (Equal cc) yes no)
26660 // result: (EQ cc yes no)
26661 for b.Controls[0].Op == OpARM64Equal {
26662 v_0 := b.Controls[0]
26664 b.resetWithControl(BlockARM64EQ, cc)
26667 // match: (NZ (NotEqual cc) yes no)
26668 // result: (NE cc yes no)
26669 for b.Controls[0].Op == OpARM64NotEqual {
26670 v_0 := b.Controls[0]
26672 b.resetWithControl(BlockARM64NE, cc)
26675 // match: (NZ (LessThan cc) yes no)
26676 // result: (LT cc yes no)
26677 for b.Controls[0].Op == OpARM64LessThan {
26678 v_0 := b.Controls[0]
26680 b.resetWithControl(BlockARM64LT, cc)
26683 // match: (NZ (LessThanU cc) yes no)
26684 // result: (ULT cc yes no)
26685 for b.Controls[0].Op == OpARM64LessThanU {
26686 v_0 := b.Controls[0]
26688 b.resetWithControl(BlockARM64ULT, cc)
26691 // match: (NZ (LessEqual cc) yes no)
26692 // result: (LE cc yes no)
26693 for b.Controls[0].Op == OpARM64LessEqual {
26694 v_0 := b.Controls[0]
26696 b.resetWithControl(BlockARM64LE, cc)
26699 // match: (NZ (LessEqualU cc) yes no)
26700 // result: (ULE cc yes no)
26701 for b.Controls[0].Op == OpARM64LessEqualU {
26702 v_0 := b.Controls[0]
26704 b.resetWithControl(BlockARM64ULE, cc)
26707 // match: (NZ (GreaterThan cc) yes no)
26708 // result: (GT cc yes no)
26709 for b.Controls[0].Op == OpARM64GreaterThan {
26710 v_0 := b.Controls[0]
26712 b.resetWithControl(BlockARM64GT, cc)
26715 // match: (NZ (GreaterThanU cc) yes no)
26716 // result: (UGT cc yes no)
26717 for b.Controls[0].Op == OpARM64GreaterThanU {
26718 v_0 := b.Controls[0]
26720 b.resetWithControl(BlockARM64UGT, cc)
26723 // match: (NZ (GreaterEqual cc) yes no)
26724 // result: (GE cc yes no)
26725 for b.Controls[0].Op == OpARM64GreaterEqual {
26726 v_0 := b.Controls[0]
26728 b.resetWithControl(BlockARM64GE, cc)
26731 // match: (NZ (GreaterEqualU cc) yes no)
26732 // result: (UGE cc yes no)
26733 for b.Controls[0].Op == OpARM64GreaterEqualU {
26734 v_0 := b.Controls[0]
26736 b.resetWithControl(BlockARM64UGE, cc)
26739 // match: (NZ (LessThanF cc) yes no)
26740 // result: (FLT cc yes no)
26741 for b.Controls[0].Op == OpARM64LessThanF {
26742 v_0 := b.Controls[0]
26744 b.resetWithControl(BlockARM64FLT, cc)
26747 // match: (NZ (LessEqualF cc) yes no)
26748 // result: (FLE cc yes no)
26749 for b.Controls[0].Op == OpARM64LessEqualF {
26750 v_0 := b.Controls[0]
26752 b.resetWithControl(BlockARM64FLE, cc)
26755 // match: (NZ (GreaterThanF cc) yes no)
26756 // result: (FGT cc yes no)
26757 for b.Controls[0].Op == OpARM64GreaterThanF {
26758 v_0 := b.Controls[0]
26760 b.resetWithControl(BlockARM64FGT, cc)
26763 // match: (NZ (GreaterEqualF cc) yes no)
26764 // result: (FGE cc yes no)
26765 for b.Controls[0].Op == OpARM64GreaterEqualF {
26766 v_0 := b.Controls[0]
26768 b.resetWithControl(BlockARM64FGE, cc)
26771 // match: (NZ (ANDconst [c] x) yes no)
26773 // result: (TBNZ [int64(ntz64(c))] x yes no)
26774 for b.Controls[0].Op == OpARM64ANDconst {
26775 v_0 := b.Controls[0]
26776 c := auxIntToInt64(v_0.AuxInt)
26781 b.resetWithControl(BlockARM64TBNZ, x)
26782 b.AuxInt = int64ToAuxInt(int64(ntz64(c)))
26785 // match: (NZ (MOVDconst [0]) yes no)
26786 // result: (First no yes)
26787 for b.Controls[0].Op == OpARM64MOVDconst {
26788 v_0 := b.Controls[0]
26789 if auxIntToInt64(v_0.AuxInt) != 0 {
26792 b.Reset(BlockFirst)
26796 // match: (NZ (MOVDconst [c]) yes no)
26798 // result: (First yes no)
26799 for b.Controls[0].Op == OpARM64MOVDconst {
26800 v_0 := b.Controls[0]
26801 c := auxIntToInt64(v_0.AuxInt)
26805 b.Reset(BlockFirst)
26808 case BlockARM64NZW:
26809 // match: (NZW (ANDconst [c] x) yes no)
26810 // cond: oneBit(int64(uint32(c)))
26811 // result: (TBNZ [int64(ntz64(int64(uint32(c))))] x yes no)
26812 for b.Controls[0].Op == OpARM64ANDconst {
26813 v_0 := b.Controls[0]
26814 c := auxIntToInt64(v_0.AuxInt)
26816 if !(oneBit(int64(uint32(c)))) {
26819 b.resetWithControl(BlockARM64TBNZ, x)
26820 b.AuxInt = int64ToAuxInt(int64(ntz64(int64(uint32(c)))))
26823 // match: (NZW (MOVDconst [c]) yes no)
26824 // cond: int32(c) == 0
26825 // result: (First no yes)
26826 for b.Controls[0].Op == OpARM64MOVDconst {
26827 v_0 := b.Controls[0]
26828 c := auxIntToInt64(v_0.AuxInt)
26829 if !(int32(c) == 0) {
26832 b.Reset(BlockFirst)
26836 // match: (NZW (MOVDconst [c]) yes no)
26837 // cond: int32(c) != 0
26838 // result: (First yes no)
26839 for b.Controls[0].Op == OpARM64MOVDconst {
26840 v_0 := b.Controls[0]
26841 c := auxIntToInt64(v_0.AuxInt)
26842 if !(int32(c) != 0) {
26845 b.Reset(BlockFirst)
26848 case BlockARM64TBNZ:
26849 // match: (TBNZ [0] (Equal cc) yes no)
26850 // result: (EQ cc yes no)
26851 for b.Controls[0].Op == OpARM64Equal {
26852 v_0 := b.Controls[0]
26854 if auxIntToInt64(b.AuxInt) != 0 {
26857 b.resetWithControl(BlockARM64EQ, cc)
26860 // match: (TBNZ [0] (NotEqual cc) yes no)
26861 // result: (NE cc yes no)
26862 for b.Controls[0].Op == OpARM64NotEqual {
26863 v_0 := b.Controls[0]
26865 if auxIntToInt64(b.AuxInt) != 0 {
26868 b.resetWithControl(BlockARM64NE, cc)
26871 // match: (TBNZ [0] (LessThan cc) yes no)
26872 // result: (LT cc yes no)
26873 for b.Controls[0].Op == OpARM64LessThan {
26874 v_0 := b.Controls[0]
26876 if auxIntToInt64(b.AuxInt) != 0 {
26879 b.resetWithControl(BlockARM64LT, cc)
26882 // match: (TBNZ [0] (LessThanU cc) yes no)
26883 // result: (ULT cc yes no)
26884 for b.Controls[0].Op == OpARM64LessThanU {
26885 v_0 := b.Controls[0]
26887 if auxIntToInt64(b.AuxInt) != 0 {
26890 b.resetWithControl(BlockARM64ULT, cc)
26893 // match: (TBNZ [0] (LessEqual cc) yes no)
26894 // result: (LE cc yes no)
26895 for b.Controls[0].Op == OpARM64LessEqual {
26896 v_0 := b.Controls[0]
26898 if auxIntToInt64(b.AuxInt) != 0 {
26901 b.resetWithControl(BlockARM64LE, cc)
26904 // match: (TBNZ [0] (LessEqualU cc) yes no)
26905 // result: (ULE cc yes no)
26906 for b.Controls[0].Op == OpARM64LessEqualU {
26907 v_0 := b.Controls[0]
26909 if auxIntToInt64(b.AuxInt) != 0 {
26912 b.resetWithControl(BlockARM64ULE, cc)
26915 // match: (TBNZ [0] (GreaterThan cc) yes no)
26916 // result: (GT cc yes no)
26917 for b.Controls[0].Op == OpARM64GreaterThan {
26918 v_0 := b.Controls[0]
26920 if auxIntToInt64(b.AuxInt) != 0 {
26923 b.resetWithControl(BlockARM64GT, cc)
26926 // match: (TBNZ [0] (GreaterThanU cc) yes no)
26927 // result: (UGT cc yes no)
26928 for b.Controls[0].Op == OpARM64GreaterThanU {
26929 v_0 := b.Controls[0]
26931 if auxIntToInt64(b.AuxInt) != 0 {
26934 b.resetWithControl(BlockARM64UGT, cc)
26937 // match: (TBNZ [0] (GreaterEqual cc) yes no)
26938 // result: (GE cc yes no)
26939 for b.Controls[0].Op == OpARM64GreaterEqual {
26940 v_0 := b.Controls[0]
26942 if auxIntToInt64(b.AuxInt) != 0 {
26945 b.resetWithControl(BlockARM64GE, cc)
26948 // match: (TBNZ [0] (GreaterEqualU cc) yes no)
26949 // result: (UGE cc yes no)
26950 for b.Controls[0].Op == OpARM64GreaterEqualU {
26951 v_0 := b.Controls[0]
26953 if auxIntToInt64(b.AuxInt) != 0 {
26956 b.resetWithControl(BlockARM64UGE, cc)
26959 // match: (TBNZ [0] (LessThanF cc) yes no)
26960 // result: (FLT cc yes no)
26961 for b.Controls[0].Op == OpARM64LessThanF {
26962 v_0 := b.Controls[0]
26964 if auxIntToInt64(b.AuxInt) != 0 {
26967 b.resetWithControl(BlockARM64FLT, cc)
26970 // match: (TBNZ [0] (LessEqualF cc) yes no)
26971 // result: (FLE cc yes no)
26972 for b.Controls[0].Op == OpARM64LessEqualF {
26973 v_0 := b.Controls[0]
26975 if auxIntToInt64(b.AuxInt) != 0 {
26978 b.resetWithControl(BlockARM64FLE, cc)
26981 // match: (TBNZ [0] (GreaterThanF cc) yes no)
26982 // result: (FGT cc yes no)
26983 for b.Controls[0].Op == OpARM64GreaterThanF {
26984 v_0 := b.Controls[0]
26986 if auxIntToInt64(b.AuxInt) != 0 {
26989 b.resetWithControl(BlockARM64FGT, cc)
26992 // match: (TBNZ [0] (GreaterEqualF cc) yes no)
26993 // result: (FGE cc yes no)
26994 for b.Controls[0].Op == OpARM64GreaterEqualF {
26995 v_0 := b.Controls[0]
26997 if auxIntToInt64(b.AuxInt) != 0 {
27000 b.resetWithControl(BlockARM64FGE, cc)
27003 case BlockARM64UGE:
27004 // match: (UGE (FlagConstant [fc]) yes no)
27006 // result: (First yes no)
27007 for b.Controls[0].Op == OpARM64FlagConstant {
27008 v_0 := b.Controls[0]
27009 fc := auxIntToFlagConstant(v_0.AuxInt)
27013 b.Reset(BlockFirst)
27016 // match: (UGE (FlagConstant [fc]) yes no)
27018 // result: (First no yes)
27019 for b.Controls[0].Op == OpARM64FlagConstant {
27020 v_0 := b.Controls[0]
27021 fc := auxIntToFlagConstant(v_0.AuxInt)
27025 b.Reset(BlockFirst)
27029 // match: (UGE (InvertFlags cmp) yes no)
27030 // result: (ULE cmp yes no)
27031 for b.Controls[0].Op == OpARM64InvertFlags {
27032 v_0 := b.Controls[0]
27034 b.resetWithControl(BlockARM64ULE, cmp)
27037 case BlockARM64UGT:
27038 // match: (UGT (FlagConstant [fc]) yes no)
27040 // result: (First yes no)
27041 for b.Controls[0].Op == OpARM64FlagConstant {
27042 v_0 := b.Controls[0]
27043 fc := auxIntToFlagConstant(v_0.AuxInt)
27047 b.Reset(BlockFirst)
27050 // match: (UGT (FlagConstant [fc]) yes no)
27052 // result: (First no yes)
27053 for b.Controls[0].Op == OpARM64FlagConstant {
27054 v_0 := b.Controls[0]
27055 fc := auxIntToFlagConstant(v_0.AuxInt)
27059 b.Reset(BlockFirst)
27063 // match: (UGT (InvertFlags cmp) yes no)
27064 // result: (ULT cmp yes no)
27065 for b.Controls[0].Op == OpARM64InvertFlags {
27066 v_0 := b.Controls[0]
27068 b.resetWithControl(BlockARM64ULT, cmp)
27071 case BlockARM64ULE:
27072 // match: (ULE (FlagConstant [fc]) yes no)
27074 // result: (First yes no)
27075 for b.Controls[0].Op == OpARM64FlagConstant {
27076 v_0 := b.Controls[0]
27077 fc := auxIntToFlagConstant(v_0.AuxInt)
27081 b.Reset(BlockFirst)
27084 // match: (ULE (FlagConstant [fc]) yes no)
27086 // result: (First no yes)
27087 for b.Controls[0].Op == OpARM64FlagConstant {
27088 v_0 := b.Controls[0]
27089 fc := auxIntToFlagConstant(v_0.AuxInt)
27093 b.Reset(BlockFirst)
27097 // match: (ULE (InvertFlags cmp) yes no)
27098 // result: (UGE cmp yes no)
27099 for b.Controls[0].Op == OpARM64InvertFlags {
27100 v_0 := b.Controls[0]
27102 b.resetWithControl(BlockARM64UGE, cmp)
27105 case BlockARM64ULT:
27106 // match: (ULT (FlagConstant [fc]) yes no)
27108 // result: (First yes no)
27109 for b.Controls[0].Op == OpARM64FlagConstant {
27110 v_0 := b.Controls[0]
27111 fc := auxIntToFlagConstant(v_0.AuxInt)
27115 b.Reset(BlockFirst)
27118 // match: (ULT (FlagConstant [fc]) yes no)
27120 // result: (First no yes)
27121 for b.Controls[0].Op == OpARM64FlagConstant {
27122 v_0 := b.Controls[0]
27123 fc := auxIntToFlagConstant(v_0.AuxInt)
27127 b.Reset(BlockFirst)
27131 // match: (ULT (InvertFlags cmp) yes no)
27132 // result: (UGT cmp yes no)
27133 for b.Controls[0].Op == OpARM64InvertFlags {
27134 v_0 := b.Controls[0]
27136 b.resetWithControl(BlockARM64UGT, cmp)
27140 // match: (Z (ANDconst [c] x) yes no)
27142 // result: (TBZ [int64(ntz64(c))] x yes no)
27143 for b.Controls[0].Op == OpARM64ANDconst {
27144 v_0 := b.Controls[0]
27145 c := auxIntToInt64(v_0.AuxInt)
27150 b.resetWithControl(BlockARM64TBZ, x)
27151 b.AuxInt = int64ToAuxInt(int64(ntz64(c)))
27154 // match: (Z (MOVDconst [0]) yes no)
27155 // result: (First yes no)
27156 for b.Controls[0].Op == OpARM64MOVDconst {
27157 v_0 := b.Controls[0]
27158 if auxIntToInt64(v_0.AuxInt) != 0 {
27161 b.Reset(BlockFirst)
27164 // match: (Z (MOVDconst [c]) yes no)
27166 // result: (First no yes)
27167 for b.Controls[0].Op == OpARM64MOVDconst {
27168 v_0 := b.Controls[0]
27169 c := auxIntToInt64(v_0.AuxInt)
27173 b.Reset(BlockFirst)
27178 // match: (ZW (ANDconst [c] x) yes no)
27179 // cond: oneBit(int64(uint32(c)))
27180 // result: (TBZ [int64(ntz64(int64(uint32(c))))] x yes no)
27181 for b.Controls[0].Op == OpARM64ANDconst {
27182 v_0 := b.Controls[0]
27183 c := auxIntToInt64(v_0.AuxInt)
27185 if !(oneBit(int64(uint32(c)))) {
27188 b.resetWithControl(BlockARM64TBZ, x)
27189 b.AuxInt = int64ToAuxInt(int64(ntz64(int64(uint32(c)))))
27192 // match: (ZW (MOVDconst [c]) yes no)
27193 // cond: int32(c) == 0
27194 // result: (First yes no)
27195 for b.Controls[0].Op == OpARM64MOVDconst {
27196 v_0 := b.Controls[0]
27197 c := auxIntToInt64(v_0.AuxInt)
27198 if !(int32(c) == 0) {
27201 b.Reset(BlockFirst)
27204 // match: (ZW (MOVDconst [c]) yes no)
27205 // cond: int32(c) != 0
27206 // result: (First no yes)
27207 for b.Controls[0].Op == OpARM64MOVDconst {
27208 v_0 := b.Controls[0]
27209 c := auxIntToInt64(v_0.AuxInt)
27210 if !(int32(c) != 0) {
27213 b.Reset(BlockFirst)