Debian Codegraph @

src/cmd/compile/internal/ssa/rewriteS390X.go

raw
1 // Code generated from _gen/S390X.rules using 'go generate'; DO NOT EDIT.
2
3 package ssa
4
5 import "math"
6 import "cmd/compile/internal/types"
7 import "cmd/internal/obj/s390x"
8
9 func rewriteValueS390X(v *Value) bool {
10 switch v.Op {
11 case OpAdd16:
12 v.Op = OpS390XADDW
13 return true
14 case OpAdd32:
15 v.Op = OpS390XADDW
16 return true
17 case OpAdd32F:
18 return rewriteValueS390X_OpAdd32F(v)
19 case OpAdd64:
20 v.Op = OpS390XADD
21 return true
22 case OpAdd64F:
23 return rewriteValueS390X_OpAdd64F(v)
24 case OpAdd8:
25 v.Op = OpS390XADDW
26 return true
27 case OpAddPtr:
28 v.Op = OpS390XADD
29 return true
30 case OpAddr:
31 return rewriteValueS390X_OpAddr(v)
32 case OpAnd16:
33 v.Op = OpS390XANDW
34 return true
35 case OpAnd32:
36 v.Op = OpS390XANDW
37 return true
38 case OpAnd64:
39 v.Op = OpS390XAND
40 return true
41 case OpAnd8:
42 v.Op = OpS390XANDW
43 return true
44 case OpAndB:
45 v.Op = OpS390XANDW
46 return true
47 case OpAtomicAdd32:
48 return rewriteValueS390X_OpAtomicAdd32(v)
49 case OpAtomicAdd64:
50 return rewriteValueS390X_OpAtomicAdd64(v)
51 case OpAtomicAnd32:
52 v.Op = OpS390XLAN
53 return true
54 case OpAtomicAnd8:
55 return rewriteValueS390X_OpAtomicAnd8(v)
56 case OpAtomicCompareAndSwap32:
57 return rewriteValueS390X_OpAtomicCompareAndSwap32(v)
58 case OpAtomicCompareAndSwap64:
59 return rewriteValueS390X_OpAtomicCompareAndSwap64(v)
60 case OpAtomicExchange32:
61 return rewriteValueS390X_OpAtomicExchange32(v)
62 case OpAtomicExchange64:
63 return rewriteValueS390X_OpAtomicExchange64(v)
64 case OpAtomicLoad32:
65 return rewriteValueS390X_OpAtomicLoad32(v)
66 case OpAtomicLoad64:
67 return rewriteValueS390X_OpAtomicLoad64(v)
68 case OpAtomicLoad8:
69 return rewriteValueS390X_OpAtomicLoad8(v)
70 case OpAtomicLoadAcq32:
71 return rewriteValueS390X_OpAtomicLoadAcq32(v)
72 case OpAtomicLoadPtr:
73 return rewriteValueS390X_OpAtomicLoadPtr(v)
74 case OpAtomicOr32:
75 v.Op = OpS390XLAO
76 return true
77 case OpAtomicOr8:
78 return rewriteValueS390X_OpAtomicOr8(v)
79 case OpAtomicStore32:
80 return rewriteValueS390X_OpAtomicStore32(v)
81 case OpAtomicStore64:
82 return rewriteValueS390X_OpAtomicStore64(v)
83 case OpAtomicStore8:
84 return rewriteValueS390X_OpAtomicStore8(v)
85 case OpAtomicStorePtrNoWB:
86 return rewriteValueS390X_OpAtomicStorePtrNoWB(v)
87 case OpAtomicStoreRel32:
88 return rewriteValueS390X_OpAtomicStoreRel32(v)
89 case OpAvg64u:
90 return rewriteValueS390X_OpAvg64u(v)
91 case OpBitLen16:
92 return rewriteValueS390X_OpBitLen16(v)
93 case OpBitLen32:
94 return rewriteValueS390X_OpBitLen32(v)
95 case OpBitLen64:
96 return rewriteValueS390X_OpBitLen64(v)
97 case OpBitLen8:
98 return rewriteValueS390X_OpBitLen8(v)
99 case OpBswap16:
100 return rewriteValueS390X_OpBswap16(v)
101 case OpBswap32:
102 v.Op = OpS390XMOVWBR
103 return true
104 case OpBswap64:
105 v.Op = OpS390XMOVDBR
106 return true
107 case OpCeil:
108 return rewriteValueS390X_OpCeil(v)
109 case OpClosureCall:
110 v.Op = OpS390XCALLclosure
111 return true
112 case OpCom16:
113 v.Op = OpS390XNOTW
114 return true
115 case OpCom32:
116 v.Op = OpS390XNOTW
117 return true
118 case OpCom64:
119 v.Op = OpS390XNOT
120 return true
121 case OpCom8:
122 v.Op = OpS390XNOTW
123 return true
124 case OpConst16:
125 return rewriteValueS390X_OpConst16(v)
126 case OpConst32:
127 return rewriteValueS390X_OpConst32(v)
128 case OpConst32F:
129 v.Op = OpS390XFMOVSconst
130 return true
131 case OpConst64:
132 return rewriteValueS390X_OpConst64(v)
133 case OpConst64F:
134 v.Op = OpS390XFMOVDconst
135 return true
136 case OpConst8:
137 return rewriteValueS390X_OpConst8(v)
138 case OpConstBool:
139 return rewriteValueS390X_OpConstBool(v)
140 case OpConstNil:
141 return rewriteValueS390X_OpConstNil(v)
142 case OpCtz16:
143 return rewriteValueS390X_OpCtz16(v)
144 case OpCtz16NonZero:
145 v.Op = OpCtz64
146 return true
147 case OpCtz32:
148 return rewriteValueS390X_OpCtz32(v)
149 case OpCtz32NonZero:
150 v.Op = OpCtz64
151 return true
152 case OpCtz64:
153 return rewriteValueS390X_OpCtz64(v)
154 case OpCtz64NonZero:
155 v.Op = OpCtz64
156 return true
157 case OpCtz8:
158 return rewriteValueS390X_OpCtz8(v)
159 case OpCtz8NonZero:
160 v.Op = OpCtz64
161 return true
162 case OpCvt32Fto32:
163 v.Op = OpS390XCFEBRA
164 return true
165 case OpCvt32Fto32U:
166 v.Op = OpS390XCLFEBR
167 return true
168 case OpCvt32Fto64:
169 v.Op = OpS390XCGEBRA
170 return true
171 case OpCvt32Fto64F:
172 v.Op = OpS390XLDEBR
173 return true
174 case OpCvt32Fto64U:
175 v.Op = OpS390XCLGEBR
176 return true
177 case OpCvt32Uto32F:
178 v.Op = OpS390XCELFBR
179 return true
180 case OpCvt32Uto64F:
181 v.Op = OpS390XCDLFBR
182 return true
183 case OpCvt32to32F:
184 v.Op = OpS390XCEFBRA
185 return true
186 case OpCvt32to64F:
187 v.Op = OpS390XCDFBRA
188 return true
189 case OpCvt64Fto32:
190 v.Op = OpS390XCFDBRA
191 return true
192 case OpCvt64Fto32F:
193 v.Op = OpS390XLEDBR
194 return true
195 case OpCvt64Fto32U:
196 v.Op = OpS390XCLFDBR
197 return true
198 case OpCvt64Fto64:
199 v.Op = OpS390XCGDBRA
200 return true
201 case OpCvt64Fto64U:
202 v.Op = OpS390XCLGDBR
203 return true
204 case OpCvt64Uto32F:
205 v.Op = OpS390XCELGBR
206 return true
207 case OpCvt64Uto64F:
208 v.Op = OpS390XCDLGBR
209 return true
210 case OpCvt64to32F:
211 v.Op = OpS390XCEGBRA
212 return true
213 case OpCvt64to64F:
214 v.Op = OpS390XCDGBRA
215 return true
216 case OpCvtBoolToUint8:
217 v.Op = OpCopy
218 return true
219 case OpDiv16:
220 return rewriteValueS390X_OpDiv16(v)
221 case OpDiv16u:
222 return rewriteValueS390X_OpDiv16u(v)
223 case OpDiv32:
224 return rewriteValueS390X_OpDiv32(v)
225 case OpDiv32F:
226 v.Op = OpS390XFDIVS
227 return true
228 case OpDiv32u:
229 return rewriteValueS390X_OpDiv32u(v)
230 case OpDiv64:
231 return rewriteValueS390X_OpDiv64(v)
232 case OpDiv64F:
233 v.Op = OpS390XFDIV
234 return true
235 case OpDiv64u:
236 v.Op = OpS390XDIVDU
237 return true
238 case OpDiv8:
239 return rewriteValueS390X_OpDiv8(v)
240 case OpDiv8u:
241 return rewriteValueS390X_OpDiv8u(v)
242 case OpEq16:
243 return rewriteValueS390X_OpEq16(v)
244 case OpEq32:
245 return rewriteValueS390X_OpEq32(v)
246 case OpEq32F:
247 return rewriteValueS390X_OpEq32F(v)
248 case OpEq64:
249 return rewriteValueS390X_OpEq64(v)
250 case OpEq64F:
251 return rewriteValueS390X_OpEq64F(v)
252 case OpEq8:
253 return rewriteValueS390X_OpEq8(v)
254 case OpEqB:
255 return rewriteValueS390X_OpEqB(v)
256 case OpEqPtr:
257 return rewriteValueS390X_OpEqPtr(v)
258 case OpFMA:
259 return rewriteValueS390X_OpFMA(v)
260 case OpFloor:
261 return rewriteValueS390X_OpFloor(v)
262 case OpGetCallerPC:
263 v.Op = OpS390XLoweredGetCallerPC
264 return true
265 case OpGetCallerSP:
266 v.Op = OpS390XLoweredGetCallerSP
267 return true
268 case OpGetClosurePtr:
269 v.Op = OpS390XLoweredGetClosurePtr
270 return true
271 case OpGetG:
272 v.Op = OpS390XLoweredGetG
273 return true
274 case OpHmul32:
275 return rewriteValueS390X_OpHmul32(v)
276 case OpHmul32u:
277 return rewriteValueS390X_OpHmul32u(v)
278 case OpHmul64:
279 v.Op = OpS390XMULHD
280 return true
281 case OpHmul64u:
282 v.Op = OpS390XMULHDU
283 return true
284 case OpITab:
285 return rewriteValueS390X_OpITab(v)
286 case OpInterCall:
287 v.Op = OpS390XCALLinter
288 return true
289 case OpIsInBounds:
290 return rewriteValueS390X_OpIsInBounds(v)
291 case OpIsNonNil:
292 return rewriteValueS390X_OpIsNonNil(v)
293 case OpIsSliceInBounds:
294 return rewriteValueS390X_OpIsSliceInBounds(v)
295 case OpLeq16:
296 return rewriteValueS390X_OpLeq16(v)
297 case OpLeq16U:
298 return rewriteValueS390X_OpLeq16U(v)
299 case OpLeq32:
300 return rewriteValueS390X_OpLeq32(v)
301 case OpLeq32F:
302 return rewriteValueS390X_OpLeq32F(v)
303 case OpLeq32U:
304 return rewriteValueS390X_OpLeq32U(v)
305 case OpLeq64:
306 return rewriteValueS390X_OpLeq64(v)
307 case OpLeq64F:
308 return rewriteValueS390X_OpLeq64F(v)
309 case OpLeq64U:
310 return rewriteValueS390X_OpLeq64U(v)
311 case OpLeq8:
312 return rewriteValueS390X_OpLeq8(v)
313 case OpLeq8U:
314 return rewriteValueS390X_OpLeq8U(v)
315 case OpLess16:
316 return rewriteValueS390X_OpLess16(v)
317 case OpLess16U:
318 return rewriteValueS390X_OpLess16U(v)
319 case OpLess32:
320 return rewriteValueS390X_OpLess32(v)
321 case OpLess32F:
322 return rewriteValueS390X_OpLess32F(v)
323 case OpLess32U:
324 return rewriteValueS390X_OpLess32U(v)
325 case OpLess64:
326 return rewriteValueS390X_OpLess64(v)
327 case OpLess64F:
328 return rewriteValueS390X_OpLess64F(v)
329 case OpLess64U:
330 return rewriteValueS390X_OpLess64U(v)
331 case OpLess8:
332 return rewriteValueS390X_OpLess8(v)
333 case OpLess8U:
334 return rewriteValueS390X_OpLess8U(v)
335 case OpLoad:
336 return rewriteValueS390X_OpLoad(v)
337 case OpLocalAddr:
338 return rewriteValueS390X_OpLocalAddr(v)
339 case OpLsh16x16:
340 return rewriteValueS390X_OpLsh16x16(v)
341 case OpLsh16x32:
342 return rewriteValueS390X_OpLsh16x32(v)
343 case OpLsh16x64:
344 return rewriteValueS390X_OpLsh16x64(v)
345 case OpLsh16x8:
346 return rewriteValueS390X_OpLsh16x8(v)
347 case OpLsh32x16:
348 return rewriteValueS390X_OpLsh32x16(v)
349 case OpLsh32x32:
350 return rewriteValueS390X_OpLsh32x32(v)
351 case OpLsh32x64:
352 return rewriteValueS390X_OpLsh32x64(v)
353 case OpLsh32x8:
354 return rewriteValueS390X_OpLsh32x8(v)
355 case OpLsh64x16:
356 return rewriteValueS390X_OpLsh64x16(v)
357 case OpLsh64x32:
358 return rewriteValueS390X_OpLsh64x32(v)
359 case OpLsh64x64:
360 return rewriteValueS390X_OpLsh64x64(v)
361 case OpLsh64x8:
362 return rewriteValueS390X_OpLsh64x8(v)
363 case OpLsh8x16:
364 return rewriteValueS390X_OpLsh8x16(v)
365 case OpLsh8x32:
366 return rewriteValueS390X_OpLsh8x32(v)
367 case OpLsh8x64:
368 return rewriteValueS390X_OpLsh8x64(v)
369 case OpLsh8x8:
370 return rewriteValueS390X_OpLsh8x8(v)
371 case OpMax32F:
372 v.Op = OpS390XWFMAXSB
373 return true
374 case OpMax64F:
375 v.Op = OpS390XWFMAXDB
376 return true
377 case OpMin32F:
378 v.Op = OpS390XWFMINSB
379 return true
380 case OpMin64F:
381 v.Op = OpS390XWFMINDB
382 return true
383 case OpMod16:
384 return rewriteValueS390X_OpMod16(v)
385 case OpMod16u:
386 return rewriteValueS390X_OpMod16u(v)
387 case OpMod32:
388 return rewriteValueS390X_OpMod32(v)
389 case OpMod32u:
390 return rewriteValueS390X_OpMod32u(v)
391 case OpMod64:
392 return rewriteValueS390X_OpMod64(v)
393 case OpMod64u:
394 v.Op = OpS390XMODDU
395 return true
396 case OpMod8:
397 return rewriteValueS390X_OpMod8(v)
398 case OpMod8u:
399 return rewriteValueS390X_OpMod8u(v)
400 case OpMove:
401 return rewriteValueS390X_OpMove(v)
402 case OpMul16:
403 v.Op = OpS390XMULLW
404 return true
405 case OpMul32:
406 v.Op = OpS390XMULLW
407 return true
408 case OpMul32F:
409 v.Op = OpS390XFMULS
410 return true
411 case OpMul64:
412 v.Op = OpS390XMULLD
413 return true
414 case OpMul64F:
415 v.Op = OpS390XFMUL
416 return true
417 case OpMul64uhilo:
418 v.Op = OpS390XMLGR
419 return true
420 case OpMul8:
421 v.Op = OpS390XMULLW
422 return true
423 case OpNeg16:
424 v.Op = OpS390XNEGW
425 return true
426 case OpNeg32:
427 v.Op = OpS390XNEGW
428 return true
429 case OpNeg32F:
430 v.Op = OpS390XFNEGS
431 return true
432 case OpNeg64:
433 v.Op = OpS390XNEG
434 return true
435 case OpNeg64F:
436 v.Op = OpS390XFNEG
437 return true
438 case OpNeg8:
439 v.Op = OpS390XNEGW
440 return true
441 case OpNeq16:
442 return rewriteValueS390X_OpNeq16(v)
443 case OpNeq32:
444 return rewriteValueS390X_OpNeq32(v)
445 case OpNeq32F:
446 return rewriteValueS390X_OpNeq32F(v)
447 case OpNeq64:
448 return rewriteValueS390X_OpNeq64(v)
449 case OpNeq64F:
450 return rewriteValueS390X_OpNeq64F(v)
451 case OpNeq8:
452 return rewriteValueS390X_OpNeq8(v)
453 case OpNeqB:
454 return rewriteValueS390X_OpNeqB(v)
455 case OpNeqPtr:
456 return rewriteValueS390X_OpNeqPtr(v)
457 case OpNilCheck:
458 v.Op = OpS390XLoweredNilCheck
459 return true
460 case OpNot:
461 return rewriteValueS390X_OpNot(v)
462 case OpOffPtr:
463 return rewriteValueS390X_OpOffPtr(v)
464 case OpOr16:
465 v.Op = OpS390XORW
466 return true
467 case OpOr32:
468 v.Op = OpS390XORW
469 return true
470 case OpOr64:
471 v.Op = OpS390XOR
472 return true
473 case OpOr8:
474 v.Op = OpS390XORW
475 return true
476 case OpOrB:
477 v.Op = OpS390XORW
478 return true
479 case OpPanicBounds:
480 v.Op = OpS390XLoweredPanicBoundsRR
481 return true
482 case OpPopCount16:
483 return rewriteValueS390X_OpPopCount16(v)
484 case OpPopCount32:
485 return rewriteValueS390X_OpPopCount32(v)
486 case OpPopCount64:
487 return rewriteValueS390X_OpPopCount64(v)
488 case OpPopCount8:
489 return rewriteValueS390X_OpPopCount8(v)
490 case OpRotateLeft16:
491 return rewriteValueS390X_OpRotateLeft16(v)
492 case OpRotateLeft32:
493 v.Op = OpS390XRLL
494 return true
495 case OpRotateLeft64:
496 v.Op = OpS390XRLLG
497 return true
498 case OpRotateLeft8:
499 return rewriteValueS390X_OpRotateLeft8(v)
500 case OpRound:
501 return rewriteValueS390X_OpRound(v)
502 case OpRound32F:
503 v.Op = OpS390XLoweredRound32F
504 return true
505 case OpRound64F:
506 v.Op = OpS390XLoweredRound64F
507 return true
508 case OpRoundToEven:
509 return rewriteValueS390X_OpRoundToEven(v)
510 case OpRsh16Ux16:
511 return rewriteValueS390X_OpRsh16Ux16(v)
512 case OpRsh16Ux32:
513 return rewriteValueS390X_OpRsh16Ux32(v)
514 case OpRsh16Ux64:
515 return rewriteValueS390X_OpRsh16Ux64(v)
516 case OpRsh16Ux8:
517 return rewriteValueS390X_OpRsh16Ux8(v)
518 case OpRsh16x16:
519 return rewriteValueS390X_OpRsh16x16(v)
520 case OpRsh16x32:
521 return rewriteValueS390X_OpRsh16x32(v)
522 case OpRsh16x64:
523 return rewriteValueS390X_OpRsh16x64(v)
524 case OpRsh16x8:
525 return rewriteValueS390X_OpRsh16x8(v)
526 case OpRsh32Ux16:
527 return rewriteValueS390X_OpRsh32Ux16(v)
528 case OpRsh32Ux32:
529 return rewriteValueS390X_OpRsh32Ux32(v)
530 case OpRsh32Ux64:
531 return rewriteValueS390X_OpRsh32Ux64(v)
532 case OpRsh32Ux8:
533 return rewriteValueS390X_OpRsh32Ux8(v)
534 case OpRsh32x16:
535 return rewriteValueS390X_OpRsh32x16(v)
536 case OpRsh32x32:
537 return rewriteValueS390X_OpRsh32x32(v)
538 case OpRsh32x64:
539 return rewriteValueS390X_OpRsh32x64(v)
540 case OpRsh32x8:
541 return rewriteValueS390X_OpRsh32x8(v)
542 case OpRsh64Ux16:
543 return rewriteValueS390X_OpRsh64Ux16(v)
544 case OpRsh64Ux32:
545 return rewriteValueS390X_OpRsh64Ux32(v)
546 case OpRsh64Ux64:
547 return rewriteValueS390X_OpRsh64Ux64(v)
548 case OpRsh64Ux8:
549 return rewriteValueS390X_OpRsh64Ux8(v)
550 case OpRsh64x16:
551 return rewriteValueS390X_OpRsh64x16(v)
552 case OpRsh64x32:
553 return rewriteValueS390X_OpRsh64x32(v)
554 case OpRsh64x64:
555 return rewriteValueS390X_OpRsh64x64(v)
556 case OpRsh64x8:
557 return rewriteValueS390X_OpRsh64x8(v)
558 case OpRsh8Ux16:
559 return rewriteValueS390X_OpRsh8Ux16(v)
560 case OpRsh8Ux32:
561 return rewriteValueS390X_OpRsh8Ux32(v)
562 case OpRsh8Ux64:
563 return rewriteValueS390X_OpRsh8Ux64(v)
564 case OpRsh8Ux8:
565 return rewriteValueS390X_OpRsh8Ux8(v)
566 case OpRsh8x16:
567 return rewriteValueS390X_OpRsh8x16(v)
568 case OpRsh8x32:
569 return rewriteValueS390X_OpRsh8x32(v)
570 case OpRsh8x64:
571 return rewriteValueS390X_OpRsh8x64(v)
572 case OpRsh8x8:
573 return rewriteValueS390X_OpRsh8x8(v)
574 case OpS390XADD:
575 return rewriteValueS390X_OpS390XADD(v)
576 case OpS390XADDC:
577 return rewriteValueS390X_OpS390XADDC(v)
578 case OpS390XADDE:
579 return rewriteValueS390X_OpS390XADDE(v)
580 case OpS390XADDW:
581 return rewriteValueS390X_OpS390XADDW(v)
582 case OpS390XADDWconst:
583 return rewriteValueS390X_OpS390XADDWconst(v)
584 case OpS390XADDWload:
585 return rewriteValueS390X_OpS390XADDWload(v)
586 case OpS390XADDconst:
587 return rewriteValueS390X_OpS390XADDconst(v)
588 case OpS390XADDload:
589 return rewriteValueS390X_OpS390XADDload(v)
590 case OpS390XAND:
591 return rewriteValueS390X_OpS390XAND(v)
592 case OpS390XANDW:
593 return rewriteValueS390X_OpS390XANDW(v)
594 case OpS390XANDWconst:
595 return rewriteValueS390X_OpS390XANDWconst(v)
596 case OpS390XANDWload:
597 return rewriteValueS390X_OpS390XANDWload(v)
598 case OpS390XANDconst:
599 return rewriteValueS390X_OpS390XANDconst(v)
600 case OpS390XANDload:
601 return rewriteValueS390X_OpS390XANDload(v)
602 case OpS390XCMP:
603 return rewriteValueS390X_OpS390XCMP(v)
604 case OpS390XCMPU:
605 return rewriteValueS390X_OpS390XCMPU(v)
606 case OpS390XCMPUconst:
607 return rewriteValueS390X_OpS390XCMPUconst(v)
608 case OpS390XCMPW:
609 return rewriteValueS390X_OpS390XCMPW(v)
610 case OpS390XCMPWU:
611 return rewriteValueS390X_OpS390XCMPWU(v)
612 case OpS390XCMPWUconst:
613 return rewriteValueS390X_OpS390XCMPWUconst(v)
614 case OpS390XCMPWconst:
615 return rewriteValueS390X_OpS390XCMPWconst(v)
616 case OpS390XCMPconst:
617 return rewriteValueS390X_OpS390XCMPconst(v)
618 case OpS390XCPSDR:
619 return rewriteValueS390X_OpS390XCPSDR(v)
620 case OpS390XFCMP:
621 return rewriteValueS390X_OpS390XFCMP(v)
622 case OpS390XFCMPS:
623 return rewriteValueS390X_OpS390XFCMPS(v)
624 case OpS390XFMOVDload:
625 return rewriteValueS390X_OpS390XFMOVDload(v)
626 case OpS390XFMOVDstore:
627 return rewriteValueS390X_OpS390XFMOVDstore(v)
628 case OpS390XFMOVSload:
629 return rewriteValueS390X_OpS390XFMOVSload(v)
630 case OpS390XFMOVSstore:
631 return rewriteValueS390X_OpS390XFMOVSstore(v)
632 case OpS390XFNEG:
633 return rewriteValueS390X_OpS390XFNEG(v)
634 case OpS390XFNEGS:
635 return rewriteValueS390X_OpS390XFNEGS(v)
636 case OpS390XLDGR:
637 return rewriteValueS390X_OpS390XLDGR(v)
638 case OpS390XLEDBR:
639 return rewriteValueS390X_OpS390XLEDBR(v)
640 case OpS390XLGDR:
641 return rewriteValueS390X_OpS390XLGDR(v)
642 case OpS390XLOCGR:
643 return rewriteValueS390X_OpS390XLOCGR(v)
644 case OpS390XLTDBR:
645 return rewriteValueS390X_OpS390XLTDBR(v)
646 case OpS390XLTEBR:
647 return rewriteValueS390X_OpS390XLTEBR(v)
648 case OpS390XLoweredPanicBoundsCR:
649 return rewriteValueS390X_OpS390XLoweredPanicBoundsCR(v)
650 case OpS390XLoweredPanicBoundsRC:
651 return rewriteValueS390X_OpS390XLoweredPanicBoundsRC(v)
652 case OpS390XLoweredPanicBoundsRR:
653 return rewriteValueS390X_OpS390XLoweredPanicBoundsRR(v)
654 case OpS390XLoweredRound32F:
655 return rewriteValueS390X_OpS390XLoweredRound32F(v)
656 case OpS390XLoweredRound64F:
657 return rewriteValueS390X_OpS390XLoweredRound64F(v)
658 case OpS390XMOVBZload:
659 return rewriteValueS390X_OpS390XMOVBZload(v)
660 case OpS390XMOVBZreg:
661 return rewriteValueS390X_OpS390XMOVBZreg(v)
662 case OpS390XMOVBload:
663 return rewriteValueS390X_OpS390XMOVBload(v)
664 case OpS390XMOVBreg:
665 return rewriteValueS390X_OpS390XMOVBreg(v)
666 case OpS390XMOVBstore:
667 return rewriteValueS390X_OpS390XMOVBstore(v)
668 case OpS390XMOVBstoreconst:
669 return rewriteValueS390X_OpS390XMOVBstoreconst(v)
670 case OpS390XMOVDBR:
671 return rewriteValueS390X_OpS390XMOVDBR(v)
672 case OpS390XMOVDaddridx:
673 return rewriteValueS390X_OpS390XMOVDaddridx(v)
674 case OpS390XMOVDload:
675 return rewriteValueS390X_OpS390XMOVDload(v)
676 case OpS390XMOVDstore:
677 return rewriteValueS390X_OpS390XMOVDstore(v)
678 case OpS390XMOVDstoreconst:
679 return rewriteValueS390X_OpS390XMOVDstoreconst(v)
680 case OpS390XMOVDstoreidx:
681 return rewriteValueS390X_OpS390XMOVDstoreidx(v)
682 case OpS390XMOVHZload:
683 return rewriteValueS390X_OpS390XMOVHZload(v)
684 case OpS390XMOVHZreg:
685 return rewriteValueS390X_OpS390XMOVHZreg(v)
686 case OpS390XMOVHload:
687 return rewriteValueS390X_OpS390XMOVHload(v)
688 case OpS390XMOVHreg:
689 return rewriteValueS390X_OpS390XMOVHreg(v)
690 case OpS390XMOVHstore:
691 return rewriteValueS390X_OpS390XMOVHstore(v)
692 case OpS390XMOVHstoreconst:
693 return rewriteValueS390X_OpS390XMOVHstoreconst(v)
694 case OpS390XMOVHstoreidx:
695 return rewriteValueS390X_OpS390XMOVHstoreidx(v)
696 case OpS390XMOVWBR:
697 return rewriteValueS390X_OpS390XMOVWBR(v)
698 case OpS390XMOVWZload:
699 return rewriteValueS390X_OpS390XMOVWZload(v)
700 case OpS390XMOVWZreg:
701 return rewriteValueS390X_OpS390XMOVWZreg(v)
702 case OpS390XMOVWload:
703 return rewriteValueS390X_OpS390XMOVWload(v)
704 case OpS390XMOVWreg:
705 return rewriteValueS390X_OpS390XMOVWreg(v)
706 case OpS390XMOVWstore:
707 return rewriteValueS390X_OpS390XMOVWstore(v)
708 case OpS390XMOVWstoreconst:
709 return rewriteValueS390X_OpS390XMOVWstoreconst(v)
710 case OpS390XMOVWstoreidx:
711 return rewriteValueS390X_OpS390XMOVWstoreidx(v)
712 case OpS390XMULLD:
713 return rewriteValueS390X_OpS390XMULLD(v)
714 case OpS390XMULLDconst:
715 return rewriteValueS390X_OpS390XMULLDconst(v)
716 case OpS390XMULLDload:
717 return rewriteValueS390X_OpS390XMULLDload(v)
718 case OpS390XMULLW:
719 return rewriteValueS390X_OpS390XMULLW(v)
720 case OpS390XMULLWconst:
721 return rewriteValueS390X_OpS390XMULLWconst(v)
722 case OpS390XMULLWload:
723 return rewriteValueS390X_OpS390XMULLWload(v)
724 case OpS390XNEG:
725 return rewriteValueS390X_OpS390XNEG(v)
726 case OpS390XNEGW:
727 return rewriteValueS390X_OpS390XNEGW(v)
728 case OpS390XNOT:
729 return rewriteValueS390X_OpS390XNOT(v)
730 case OpS390XNOTW:
731 return rewriteValueS390X_OpS390XNOTW(v)
732 case OpS390XOR:
733 return rewriteValueS390X_OpS390XOR(v)
734 case OpS390XORW:
735 return rewriteValueS390X_OpS390XORW(v)
736 case OpS390XORWconst:
737 return rewriteValueS390X_OpS390XORWconst(v)
738 case OpS390XORWload:
739 return rewriteValueS390X_OpS390XORWload(v)
740 case OpS390XORconst:
741 return rewriteValueS390X_OpS390XORconst(v)
742 case OpS390XORload:
743 return rewriteValueS390X_OpS390XORload(v)
744 case OpS390XRISBGZ:
745 return rewriteValueS390X_OpS390XRISBGZ(v)
746 case OpS390XRLL:
747 return rewriteValueS390X_OpS390XRLL(v)
748 case OpS390XRLLG:
749 return rewriteValueS390X_OpS390XRLLG(v)
750 case OpS390XSLD:
751 return rewriteValueS390X_OpS390XSLD(v)
752 case OpS390XSLDconst:
753 return rewriteValueS390X_OpS390XSLDconst(v)
754 case OpS390XSLW:
755 return rewriteValueS390X_OpS390XSLW(v)
756 case OpS390XSLWconst:
757 return rewriteValueS390X_OpS390XSLWconst(v)
758 case OpS390XSRAD:
759 return rewriteValueS390X_OpS390XSRAD(v)
760 case OpS390XSRADconst:
761 return rewriteValueS390X_OpS390XSRADconst(v)
762 case OpS390XSRAW:
763 return rewriteValueS390X_OpS390XSRAW(v)
764 case OpS390XSRAWconst:
765 return rewriteValueS390X_OpS390XSRAWconst(v)
766 case OpS390XSRD:
767 return rewriteValueS390X_OpS390XSRD(v)
768 case OpS390XSRDconst:
769 return rewriteValueS390X_OpS390XSRDconst(v)
770 case OpS390XSRW:
771 return rewriteValueS390X_OpS390XSRW(v)
772 case OpS390XSRWconst:
773 return rewriteValueS390X_OpS390XSRWconst(v)
774 case OpS390XSTM2:
775 return rewriteValueS390X_OpS390XSTM2(v)
776 case OpS390XSTMG2:
777 return rewriteValueS390X_OpS390XSTMG2(v)
778 case OpS390XSUB:
779 return rewriteValueS390X_OpS390XSUB(v)
780 case OpS390XSUBE:
781 return rewriteValueS390X_OpS390XSUBE(v)
782 case OpS390XSUBW:
783 return rewriteValueS390X_OpS390XSUBW(v)
784 case OpS390XSUBWconst:
785 return rewriteValueS390X_OpS390XSUBWconst(v)
786 case OpS390XSUBWload:
787 return rewriteValueS390X_OpS390XSUBWload(v)
788 case OpS390XSUBconst:
789 return rewriteValueS390X_OpS390XSUBconst(v)
790 case OpS390XSUBload:
791 return rewriteValueS390X_OpS390XSUBload(v)
792 case OpS390XSumBytes2:
793 return rewriteValueS390X_OpS390XSumBytes2(v)
794 case OpS390XSumBytes4:
795 return rewriteValueS390X_OpS390XSumBytes4(v)
796 case OpS390XSumBytes8:
797 return rewriteValueS390X_OpS390XSumBytes8(v)
798 case OpS390XXOR:
799 return rewriteValueS390X_OpS390XXOR(v)
800 case OpS390XXORW:
801 return rewriteValueS390X_OpS390XXORW(v)
802 case OpS390XXORWconst:
803 return rewriteValueS390X_OpS390XXORWconst(v)
804 case OpS390XXORWload:
805 return rewriteValueS390X_OpS390XXORWload(v)
806 case OpS390XXORconst:
807 return rewriteValueS390X_OpS390XXORconst(v)
808 case OpS390XXORload:
809 return rewriteValueS390X_OpS390XXORload(v)
810 case OpSelect0:
811 return rewriteValueS390X_OpSelect0(v)
812 case OpSelect1:
813 return rewriteValueS390X_OpSelect1(v)
814 case OpSignExt16to32:
815 v.Op = OpS390XMOVHreg
816 return true
817 case OpSignExt16to64:
818 v.Op = OpS390XMOVHreg
819 return true
820 case OpSignExt32to64:
821 v.Op = OpS390XMOVWreg
822 return true
823 case OpSignExt8to16:
824 v.Op = OpS390XMOVBreg
825 return true
826 case OpSignExt8to32:
827 v.Op = OpS390XMOVBreg
828 return true
829 case OpSignExt8to64:
830 v.Op = OpS390XMOVBreg
831 return true
832 case OpSlicemask:
833 return rewriteValueS390X_OpSlicemask(v)
834 case OpSqrt:
835 v.Op = OpS390XFSQRT
836 return true
837 case OpSqrt32:
838 v.Op = OpS390XFSQRTS
839 return true
840 case OpStaticCall:
841 v.Op = OpS390XCALLstatic
842 return true
843 case OpStore:
844 return rewriteValueS390X_OpStore(v)
845 case OpSub16:
846 v.Op = OpS390XSUBW
847 return true
848 case OpSub32:
849 v.Op = OpS390XSUBW
850 return true
851 case OpSub32F:
852 return rewriteValueS390X_OpSub32F(v)
853 case OpSub64:
854 v.Op = OpS390XSUB
855 return true
856 case OpSub64F:
857 return rewriteValueS390X_OpSub64F(v)
858 case OpSub8:
859 v.Op = OpS390XSUBW
860 return true
861 case OpSubPtr:
862 v.Op = OpS390XSUB
863 return true
864 case OpTailCall:
865 v.Op = OpS390XCALLtail
866 return true
867 case OpTrunc:
868 return rewriteValueS390X_OpTrunc(v)
869 case OpTrunc16to8:
870 v.Op = OpCopy
871 return true
872 case OpTrunc32to16:
873 v.Op = OpCopy
874 return true
875 case OpTrunc32to8:
876 v.Op = OpCopy
877 return true
878 case OpTrunc64to16:
879 v.Op = OpCopy
880 return true
881 case OpTrunc64to32:
882 v.Op = OpCopy
883 return true
884 case OpTrunc64to8:
885 v.Op = OpCopy
886 return true
887 case OpWB:
888 v.Op = OpS390XLoweredWB
889 return true
890 case OpXor16:
891 v.Op = OpS390XXORW
892 return true
893 case OpXor32:
894 v.Op = OpS390XXORW
895 return true
896 case OpXor64:
897 v.Op = OpS390XXOR
898 return true
899 case OpXor8:
900 v.Op = OpS390XXORW
901 return true
902 case OpZero:
903 return rewriteValueS390X_OpZero(v)
904 case OpZeroExt16to32:
905 v.Op = OpS390XMOVHZreg
906 return true
907 case OpZeroExt16to64:
908 v.Op = OpS390XMOVHZreg
909 return true
910 case OpZeroExt32to64:
911 v.Op = OpS390XMOVWZreg
912 return true
913 case OpZeroExt8to16:
914 v.Op = OpS390XMOVBZreg
915 return true
916 case OpZeroExt8to32:
917 v.Op = OpS390XMOVBZreg
918 return true
919 case OpZeroExt8to64:
920 v.Op = OpS390XMOVBZreg
921 return true
922 }
923 return false
924 }
925 func rewriteValueS390X_OpAdd32F(v *Value) bool {
926 v_1 := v.Args[1]
927 v_0 := v.Args[0]
928 b := v.Block
929 typ := &b.Func.Config.Types
930 // match: (Add32F x y)
931 // result: (Select0 (FADDS x y))
932 for {
933 x := v_0
934 y := v_1
935 v.reset(OpSelect0)
936 v0 := b.NewValue0(v.Pos, OpS390XFADDS, types.NewTuple(typ.Float32, types.TypeFlags))
937 v0.AddArg2(x, y)
938 v.AddArg(v0)
939 return true
940 }
941 }
942 func rewriteValueS390X_OpAdd64F(v *Value) bool {
943 v_1 := v.Args[1]
944 v_0 := v.Args[0]
945 b := v.Block
946 typ := &b.Func.Config.Types
947 // match: (Add64F x y)
948 // result: (Select0 (FADD x y))
949 for {
950 x := v_0
951 y := v_1
952 v.reset(OpSelect0)
953 v0 := b.NewValue0(v.Pos, OpS390XFADD, types.NewTuple(typ.Float64, types.TypeFlags))
954 v0.AddArg2(x, y)
955 v.AddArg(v0)
956 return true
957 }
958 }
959 func rewriteValueS390X_OpAddr(v *Value) bool {
960 v_0 := v.Args[0]
961 // match: (Addr {sym} base)
962 // result: (MOVDaddr {sym} base)
963 for {
964 sym := auxToSym(v.Aux)
965 base := v_0
966 v.reset(OpS390XMOVDaddr)
967 v.Aux = symToAux(sym)
968 v.AddArg(base)
969 return true
970 }
971 }
972 func rewriteValueS390X_OpAtomicAdd32(v *Value) bool {
973 v_2 := v.Args[2]
974 v_1 := v.Args[1]
975 v_0 := v.Args[0]
976 b := v.Block
977 typ := &b.Func.Config.Types
978 // match: (AtomicAdd32 ptr val mem)
979 // result: (AddTupleFirst32 val (LAA ptr val mem))
980 for {
981 ptr := v_0
982 val := v_1
983 mem := v_2
984 v.reset(OpS390XAddTupleFirst32)
985 v0 := b.NewValue0(v.Pos, OpS390XLAA, types.NewTuple(typ.UInt32, types.TypeMem))
986 v0.AddArg3(ptr, val, mem)
987 v.AddArg2(val, v0)
988 return true
989 }
990 }
991 func rewriteValueS390X_OpAtomicAdd64(v *Value) bool {
992 v_2 := v.Args[2]
993 v_1 := v.Args[1]
994 v_0 := v.Args[0]
995 b := v.Block
996 typ := &b.Func.Config.Types
997 // match: (AtomicAdd64 ptr val mem)
998 // result: (AddTupleFirst64 val (LAAG ptr val mem))
999 for {
1000 ptr := v_0
1001 val := v_1
1002 mem := v_2
1003 v.reset(OpS390XAddTupleFirst64)
1004 v0 := b.NewValue0(v.Pos, OpS390XLAAG, types.NewTuple(typ.UInt64, types.TypeMem))
1005 v0.AddArg3(ptr, val, mem)
1006 v.AddArg2(val, v0)
1007 return true
1008 }
1009 }
1010 func rewriteValueS390X_OpAtomicAnd8(v *Value) bool {
1011 v_2 := v.Args[2]
1012 v_1 := v.Args[1]
1013 v_0 := v.Args[0]
1014 b := v.Block
1015 typ := &b.Func.Config.Types
1016 // match: (AtomicAnd8 ptr val mem)
1017 // result: (LANfloor ptr (RLL <typ.UInt32> (ORWconst <typ.UInt32> val [-1<<8]) (RXSBG <typ.UInt32> {s390x.NewRotateParams(59, 60, 3)} (MOVDconst [3<<3]) ptr)) mem)
1018 for {
1019 ptr := v_0
1020 val := v_1
1021 mem := v_2
1022 v.reset(OpS390XLANfloor)
1023 v0 := b.NewValue0(v.Pos, OpS390XRLL, typ.UInt32)
1024 v1 := b.NewValue0(v.Pos, OpS390XORWconst, typ.UInt32)
1025 v1.AuxInt = int32ToAuxInt(-1 << 8)
1026 v1.AddArg(val)
1027 v2 := b.NewValue0(v.Pos, OpS390XRXSBG, typ.UInt32)
1028 v2.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(59, 60, 3))
1029 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1030 v3.AuxInt = int64ToAuxInt(3 << 3)
1031 v2.AddArg2(v3, ptr)
1032 v0.AddArg2(v1, v2)
1033 v.AddArg3(ptr, v0, mem)
1034 return true
1035 }
1036 }
1037 func rewriteValueS390X_OpAtomicCompareAndSwap32(v *Value) bool {
1038 v_3 := v.Args[3]
1039 v_2 := v.Args[2]
1040 v_1 := v.Args[1]
1041 v_0 := v.Args[0]
1042 // match: (AtomicCompareAndSwap32 ptr old new_ mem)
1043 // result: (LoweredAtomicCas32 ptr old new_ mem)
1044 for {
1045 ptr := v_0
1046 old := v_1
1047 new_ := v_2
1048 mem := v_3
1049 v.reset(OpS390XLoweredAtomicCas32)
1050 v.AddArg4(ptr, old, new_, mem)
1051 return true
1052 }
1053 }
1054 func rewriteValueS390X_OpAtomicCompareAndSwap64(v *Value) bool {
1055 v_3 := v.Args[3]
1056 v_2 := v.Args[2]
1057 v_1 := v.Args[1]
1058 v_0 := v.Args[0]
1059 // match: (AtomicCompareAndSwap64 ptr old new_ mem)
1060 // result: (LoweredAtomicCas64 ptr old new_ mem)
1061 for {
1062 ptr := v_0
1063 old := v_1
1064 new_ := v_2
1065 mem := v_3
1066 v.reset(OpS390XLoweredAtomicCas64)
1067 v.AddArg4(ptr, old, new_, mem)
1068 return true
1069 }
1070 }
1071 func rewriteValueS390X_OpAtomicExchange32(v *Value) bool {
1072 v_2 := v.Args[2]
1073 v_1 := v.Args[1]
1074 v_0 := v.Args[0]
1075 // match: (AtomicExchange32 ptr val mem)
1076 // result: (LoweredAtomicExchange32 ptr val mem)
1077 for {
1078 ptr := v_0
1079 val := v_1
1080 mem := v_2
1081 v.reset(OpS390XLoweredAtomicExchange32)
1082 v.AddArg3(ptr, val, mem)
1083 return true
1084 }
1085 }
1086 func rewriteValueS390X_OpAtomicExchange64(v *Value) bool {
1087 v_2 := v.Args[2]
1088 v_1 := v.Args[1]
1089 v_0 := v.Args[0]
1090 // match: (AtomicExchange64 ptr val mem)
1091 // result: (LoweredAtomicExchange64 ptr val mem)
1092 for {
1093 ptr := v_0
1094 val := v_1
1095 mem := v_2
1096 v.reset(OpS390XLoweredAtomicExchange64)
1097 v.AddArg3(ptr, val, mem)
1098 return true
1099 }
1100 }
1101 func rewriteValueS390X_OpAtomicLoad32(v *Value) bool {
1102 v_1 := v.Args[1]
1103 v_0 := v.Args[0]
1104 // match: (AtomicLoad32 ptr mem)
1105 // result: (MOVWZatomicload ptr mem)
1106 for {
1107 ptr := v_0
1108 mem := v_1
1109 v.reset(OpS390XMOVWZatomicload)
1110 v.AddArg2(ptr, mem)
1111 return true
1112 }
1113 }
1114 func rewriteValueS390X_OpAtomicLoad64(v *Value) bool {
1115 v_1 := v.Args[1]
1116 v_0 := v.Args[0]
1117 // match: (AtomicLoad64 ptr mem)
1118 // result: (MOVDatomicload ptr mem)
1119 for {
1120 ptr := v_0
1121 mem := v_1
1122 v.reset(OpS390XMOVDatomicload)
1123 v.AddArg2(ptr, mem)
1124 return true
1125 }
1126 }
1127 func rewriteValueS390X_OpAtomicLoad8(v *Value) bool {
1128 v_1 := v.Args[1]
1129 v_0 := v.Args[0]
1130 // match: (AtomicLoad8 ptr mem)
1131 // result: (MOVBZatomicload ptr mem)
1132 for {
1133 ptr := v_0
1134 mem := v_1
1135 v.reset(OpS390XMOVBZatomicload)
1136 v.AddArg2(ptr, mem)
1137 return true
1138 }
1139 }
1140 func rewriteValueS390X_OpAtomicLoadAcq32(v *Value) bool {
1141 v_1 := v.Args[1]
1142 v_0 := v.Args[0]
1143 // match: (AtomicLoadAcq32 ptr mem)
1144 // result: (MOVWZatomicload ptr mem)
1145 for {
1146 ptr := v_0
1147 mem := v_1
1148 v.reset(OpS390XMOVWZatomicload)
1149 v.AddArg2(ptr, mem)
1150 return true
1151 }
1152 }
1153 func rewriteValueS390X_OpAtomicLoadPtr(v *Value) bool {
1154 v_1 := v.Args[1]
1155 v_0 := v.Args[0]
1156 // match: (AtomicLoadPtr ptr mem)
1157 // result: (MOVDatomicload ptr mem)
1158 for {
1159 ptr := v_0
1160 mem := v_1
1161 v.reset(OpS390XMOVDatomicload)
1162 v.AddArg2(ptr, mem)
1163 return true
1164 }
1165 }
1166 func rewriteValueS390X_OpAtomicOr8(v *Value) bool {
1167 v_2 := v.Args[2]
1168 v_1 := v.Args[1]
1169 v_0 := v.Args[0]
1170 b := v.Block
1171 typ := &b.Func.Config.Types
1172 // match: (AtomicOr8 ptr val mem)
1173 // result: (LAOfloor ptr (SLW <typ.UInt32> (MOVBZreg <typ.UInt32> val) (RXSBG <typ.UInt32> {s390x.NewRotateParams(59, 60, 3)} (MOVDconst [3<<3]) ptr)) mem)
1174 for {
1175 ptr := v_0
1176 val := v_1
1177 mem := v_2
1178 v.reset(OpS390XLAOfloor)
1179 v0 := b.NewValue0(v.Pos, OpS390XSLW, typ.UInt32)
1180 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt32)
1181 v1.AddArg(val)
1182 v2 := b.NewValue0(v.Pos, OpS390XRXSBG, typ.UInt32)
1183 v2.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(59, 60, 3))
1184 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1185 v3.AuxInt = int64ToAuxInt(3 << 3)
1186 v2.AddArg2(v3, ptr)
1187 v0.AddArg2(v1, v2)
1188 v.AddArg3(ptr, v0, mem)
1189 return true
1190 }
1191 }
1192 func rewriteValueS390X_OpAtomicStore32(v *Value) bool {
1193 v_2 := v.Args[2]
1194 v_1 := v.Args[1]
1195 v_0 := v.Args[0]
1196 b := v.Block
1197 // match: (AtomicStore32 ptr val mem)
1198 // result: (SYNC (MOVWatomicstore ptr val mem))
1199 for {
1200 ptr := v_0
1201 val := v_1
1202 mem := v_2
1203 v.reset(OpS390XSYNC)
1204 v0 := b.NewValue0(v.Pos, OpS390XMOVWatomicstore, types.TypeMem)
1205 v0.AddArg3(ptr, val, mem)
1206 v.AddArg(v0)
1207 return true
1208 }
1209 }
1210 func rewriteValueS390X_OpAtomicStore64(v *Value) bool {
1211 v_2 := v.Args[2]
1212 v_1 := v.Args[1]
1213 v_0 := v.Args[0]
1214 b := v.Block
1215 // match: (AtomicStore64 ptr val mem)
1216 // result: (SYNC (MOVDatomicstore ptr val mem))
1217 for {
1218 ptr := v_0
1219 val := v_1
1220 mem := v_2
1221 v.reset(OpS390XSYNC)
1222 v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem)
1223 v0.AddArg3(ptr, val, mem)
1224 v.AddArg(v0)
1225 return true
1226 }
1227 }
1228 func rewriteValueS390X_OpAtomicStore8(v *Value) bool {
1229 v_2 := v.Args[2]
1230 v_1 := v.Args[1]
1231 v_0 := v.Args[0]
1232 b := v.Block
1233 // match: (AtomicStore8 ptr val mem)
1234 // result: (SYNC (MOVBatomicstore ptr val mem))
1235 for {
1236 ptr := v_0
1237 val := v_1
1238 mem := v_2
1239 v.reset(OpS390XSYNC)
1240 v0 := b.NewValue0(v.Pos, OpS390XMOVBatomicstore, types.TypeMem)
1241 v0.AddArg3(ptr, val, mem)
1242 v.AddArg(v0)
1243 return true
1244 }
1245 }
1246 func rewriteValueS390X_OpAtomicStorePtrNoWB(v *Value) bool {
1247 v_2 := v.Args[2]
1248 v_1 := v.Args[1]
1249 v_0 := v.Args[0]
1250 b := v.Block
1251 // match: (AtomicStorePtrNoWB ptr val mem)
1252 // result: (SYNC (MOVDatomicstore ptr val mem))
1253 for {
1254 ptr := v_0
1255 val := v_1
1256 mem := v_2
1257 v.reset(OpS390XSYNC)
1258 v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem)
1259 v0.AddArg3(ptr, val, mem)
1260 v.AddArg(v0)
1261 return true
1262 }
1263 }
1264 func rewriteValueS390X_OpAtomicStoreRel32(v *Value) bool {
1265 v_2 := v.Args[2]
1266 v_1 := v.Args[1]
1267 v_0 := v.Args[0]
1268 // match: (AtomicStoreRel32 ptr val mem)
1269 // result: (MOVWatomicstore ptr val mem)
1270 for {
1271 ptr := v_0
1272 val := v_1
1273 mem := v_2
1274 v.reset(OpS390XMOVWatomicstore)
1275 v.AddArg3(ptr, val, mem)
1276 return true
1277 }
1278 }
1279 func rewriteValueS390X_OpAvg64u(v *Value) bool {
1280 v_1 := v.Args[1]
1281 v_0 := v.Args[0]
1282 b := v.Block
1283 // match: (Avg64u <t> x y)
1284 // result: (ADD (SRDconst <t> (SUB <t> x y) [1]) y)
1285 for {
1286 t := v.Type
1287 x := v_0
1288 y := v_1
1289 v.reset(OpS390XADD)
1290 v0 := b.NewValue0(v.Pos, OpS390XSRDconst, t)
1291 v0.AuxInt = uint8ToAuxInt(1)
1292 v1 := b.NewValue0(v.Pos, OpS390XSUB, t)
1293 v1.AddArg2(x, y)
1294 v0.AddArg(v1)
1295 v.AddArg2(v0, y)
1296 return true
1297 }
1298 }
1299 func rewriteValueS390X_OpBitLen16(v *Value) bool {
1300 v_0 := v.Args[0]
1301 b := v.Block
1302 typ := &b.Func.Config.Types
1303 // match: (BitLen16 x)
1304 // result: (BitLen64 (ZeroExt16to64 x))
1305 for {
1306 x := v_0
1307 v.reset(OpBitLen64)
1308 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
1309 v0.AddArg(x)
1310 v.AddArg(v0)
1311 return true
1312 }
1313 }
1314 func rewriteValueS390X_OpBitLen32(v *Value) bool {
1315 v_0 := v.Args[0]
1316 b := v.Block
1317 typ := &b.Func.Config.Types
1318 // match: (BitLen32 x)
1319 // result: (BitLen64 (ZeroExt32to64 x))
1320 for {
1321 x := v_0
1322 v.reset(OpBitLen64)
1323 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
1324 v0.AddArg(x)
1325 v.AddArg(v0)
1326 return true
1327 }
1328 }
1329 func rewriteValueS390X_OpBitLen64(v *Value) bool {
1330 v_0 := v.Args[0]
1331 b := v.Block
1332 typ := &b.Func.Config.Types
1333 // match: (BitLen64 x)
1334 // result: (SUB (MOVDconst [64]) (FLOGR x))
1335 for {
1336 x := v_0
1337 v.reset(OpS390XSUB)
1338 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1339 v0.AuxInt = int64ToAuxInt(64)
1340 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64)
1341 v1.AddArg(x)
1342 v.AddArg2(v0, v1)
1343 return true
1344 }
1345 }
1346 func rewriteValueS390X_OpBitLen8(v *Value) bool {
1347 v_0 := v.Args[0]
1348 b := v.Block
1349 typ := &b.Func.Config.Types
1350 // match: (BitLen8 x)
1351 // result: (BitLen64 (ZeroExt8to64 x))
1352 for {
1353 x := v_0
1354 v.reset(OpBitLen64)
1355 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
1356 v0.AddArg(x)
1357 v.AddArg(v0)
1358 return true
1359 }
1360 }
1361 func rewriteValueS390X_OpBswap16(v *Value) bool {
1362 v_0 := v.Args[0]
1363 b := v.Block
1364 typ := &b.Func.Config.Types
1365 // match: (Bswap16 x:(MOVHZload [off] {sym} ptr mem))
1366 // result: @x.Block (MOVHZreg (MOVHBRload [off] {sym} ptr mem))
1367 for {
1368 x := v_0
1369 if x.Op != OpS390XMOVHZload {
1370 break
1371 }
1372 off := auxIntToInt32(x.AuxInt)
1373 sym := auxToSym(x.Aux)
1374 mem := x.Args[1]
1375 ptr := x.Args[0]
1376 b = x.Block
1377 v0 := b.NewValue0(x.Pos, OpS390XMOVHZreg, typ.UInt64)
1378 v.copyOf(v0)
1379 v1 := b.NewValue0(x.Pos, OpS390XMOVHBRload, typ.UInt16)
1380 v1.AuxInt = int32ToAuxInt(off)
1381 v1.Aux = symToAux(sym)
1382 v1.AddArg2(ptr, mem)
1383 v0.AddArg(v1)
1384 return true
1385 }
1386 // match: (Bswap16 x:(MOVHZloadidx [off] {sym} ptr idx mem))
1387 // result: @x.Block (MOVHZreg (MOVHBRloadidx [off] {sym} ptr idx mem))
1388 for {
1389 x := v_0
1390 if x.Op != OpS390XMOVHZloadidx {
1391 break
1392 }
1393 off := auxIntToInt32(x.AuxInt)
1394 sym := auxToSym(x.Aux)
1395 mem := x.Args[2]
1396 ptr := x.Args[0]
1397 idx := x.Args[1]
1398 b = x.Block
1399 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
1400 v.copyOf(v0)
1401 v1 := b.NewValue0(v.Pos, OpS390XMOVHBRloadidx, typ.Int16)
1402 v1.AuxInt = int32ToAuxInt(off)
1403 v1.Aux = symToAux(sym)
1404 v1.AddArg3(ptr, idx, mem)
1405 v0.AddArg(v1)
1406 return true
1407 }
1408 return false
1409 }
1410 func rewriteValueS390X_OpCeil(v *Value) bool {
1411 v_0 := v.Args[0]
1412 // match: (Ceil x)
1413 // result: (FIDBR [6] x)
1414 for {
1415 x := v_0
1416 v.reset(OpS390XFIDBR)
1417 v.AuxInt = int8ToAuxInt(6)
1418 v.AddArg(x)
1419 return true
1420 }
1421 }
1422 func rewriteValueS390X_OpConst16(v *Value) bool {
1423 // match: (Const16 [val])
1424 // result: (MOVDconst [int64(val)])
1425 for {
1426 val := auxIntToInt16(v.AuxInt)
1427 v.reset(OpS390XMOVDconst)
1428 v.AuxInt = int64ToAuxInt(int64(val))
1429 return true
1430 }
1431 }
1432 func rewriteValueS390X_OpConst32(v *Value) bool {
1433 // match: (Const32 [val])
1434 // result: (MOVDconst [int64(val)])
1435 for {
1436 val := auxIntToInt32(v.AuxInt)
1437 v.reset(OpS390XMOVDconst)
1438 v.AuxInt = int64ToAuxInt(int64(val))
1439 return true
1440 }
1441 }
1442 func rewriteValueS390X_OpConst64(v *Value) bool {
1443 // match: (Const64 [val])
1444 // result: (MOVDconst [int64(val)])
1445 for {
1446 val := auxIntToInt64(v.AuxInt)
1447 v.reset(OpS390XMOVDconst)
1448 v.AuxInt = int64ToAuxInt(int64(val))
1449 return true
1450 }
1451 }
1452 func rewriteValueS390X_OpConst8(v *Value) bool {
1453 // match: (Const8 [val])
1454 // result: (MOVDconst [int64(val)])
1455 for {
1456 val := auxIntToInt8(v.AuxInt)
1457 v.reset(OpS390XMOVDconst)
1458 v.AuxInt = int64ToAuxInt(int64(val))
1459 return true
1460 }
1461 }
1462 func rewriteValueS390X_OpConstBool(v *Value) bool {
1463 // match: (ConstBool [t])
1464 // result: (MOVDconst [b2i(t)])
1465 for {
1466 t := auxIntToBool(v.AuxInt)
1467 v.reset(OpS390XMOVDconst)
1468 v.AuxInt = int64ToAuxInt(b2i(t))
1469 return true
1470 }
1471 }
1472 func rewriteValueS390X_OpConstNil(v *Value) bool {
1473 // match: (ConstNil)
1474 // result: (MOVDconst [0])
1475 for {
1476 v.reset(OpS390XMOVDconst)
1477 v.AuxInt = int64ToAuxInt(0)
1478 return true
1479 }
1480 }
1481 func rewriteValueS390X_OpCtz16(v *Value) bool {
1482 v_0 := v.Args[0]
1483 b := v.Block
1484 typ := &b.Func.Config.Types
1485 // match: (Ctz16 x)
1486 // result: (Ctz64 (Or64 <typ.UInt64> x (MOVDconst [1<<16])))
1487 for {
1488 x := v_0
1489 v.reset(OpCtz64)
1490 v0 := b.NewValue0(v.Pos, OpOr64, typ.UInt64)
1491 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1492 v1.AuxInt = int64ToAuxInt(1 << 16)
1493 v0.AddArg2(x, v1)
1494 v.AddArg(v0)
1495 return true
1496 }
1497 }
1498 func rewriteValueS390X_OpCtz32(v *Value) bool {
1499 v_0 := v.Args[0]
1500 b := v.Block
1501 typ := &b.Func.Config.Types
1502 // match: (Ctz32 <t> x)
1503 // result: (SUB (MOVDconst [64]) (FLOGR (MOVWZreg (ANDW <t> (SUBWconst <t> [1] x) (NOTW <t> x)))))
1504 for {
1505 t := v.Type
1506 x := v_0
1507 v.reset(OpS390XSUB)
1508 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1509 v0.AuxInt = int64ToAuxInt(64)
1510 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64)
1511 v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
1512 v3 := b.NewValue0(v.Pos, OpS390XANDW, t)
1513 v4 := b.NewValue0(v.Pos, OpS390XSUBWconst, t)
1514 v4.AuxInt = int32ToAuxInt(1)
1515 v4.AddArg(x)
1516 v5 := b.NewValue0(v.Pos, OpS390XNOTW, t)
1517 v5.AddArg(x)
1518 v3.AddArg2(v4, v5)
1519 v2.AddArg(v3)
1520 v1.AddArg(v2)
1521 v.AddArg2(v0, v1)
1522 return true
1523 }
1524 }
1525 func rewriteValueS390X_OpCtz64(v *Value) bool {
1526 v_0 := v.Args[0]
1527 b := v.Block
1528 typ := &b.Func.Config.Types
1529 // match: (Ctz64 <t> x)
1530 // result: (SUB (MOVDconst [64]) (FLOGR (AND <t> (SUBconst <t> [1] x) (NOT <t> x))))
1531 for {
1532 t := v.Type
1533 x := v_0
1534 v.reset(OpS390XSUB)
1535 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1536 v0.AuxInt = int64ToAuxInt(64)
1537 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64)
1538 v2 := b.NewValue0(v.Pos, OpS390XAND, t)
1539 v3 := b.NewValue0(v.Pos, OpS390XSUBconst, t)
1540 v3.AuxInt = int32ToAuxInt(1)
1541 v3.AddArg(x)
1542 v4 := b.NewValue0(v.Pos, OpS390XNOT, t)
1543 v4.AddArg(x)
1544 v2.AddArg2(v3, v4)
1545 v1.AddArg(v2)
1546 v.AddArg2(v0, v1)
1547 return true
1548 }
1549 }
1550 func rewriteValueS390X_OpCtz8(v *Value) bool {
1551 v_0 := v.Args[0]
1552 b := v.Block
1553 typ := &b.Func.Config.Types
1554 // match: (Ctz8 x)
1555 // result: (Ctz64 (Or64 <typ.UInt64> x (MOVDconst [1<<8])))
1556 for {
1557 x := v_0
1558 v.reset(OpCtz64)
1559 v0 := b.NewValue0(v.Pos, OpOr64, typ.UInt64)
1560 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1561 v1.AuxInt = int64ToAuxInt(1 << 8)
1562 v0.AddArg2(x, v1)
1563 v.AddArg(v0)
1564 return true
1565 }
1566 }
1567 func rewriteValueS390X_OpDiv16(v *Value) bool {
1568 v_1 := v.Args[1]
1569 v_0 := v.Args[0]
1570 b := v.Block
1571 typ := &b.Func.Config.Types
1572 // match: (Div16 x y)
1573 // result: (DIVW (MOVHreg x) (MOVHreg y))
1574 for {
1575 x := v_0
1576 y := v_1
1577 v.reset(OpS390XDIVW)
1578 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
1579 v0.AddArg(x)
1580 v1 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
1581 v1.AddArg(y)
1582 v.AddArg2(v0, v1)
1583 return true
1584 }
1585 }
1586 func rewriteValueS390X_OpDiv16u(v *Value) bool {
1587 v_1 := v.Args[1]
1588 v_0 := v.Args[0]
1589 b := v.Block
1590 typ := &b.Func.Config.Types
1591 // match: (Div16u x y)
1592 // result: (DIVWU (MOVHZreg x) (MOVHZreg y))
1593 for {
1594 x := v_0
1595 y := v_1
1596 v.reset(OpS390XDIVWU)
1597 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
1598 v0.AddArg(x)
1599 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
1600 v1.AddArg(y)
1601 v.AddArg2(v0, v1)
1602 return true
1603 }
1604 }
1605 func rewriteValueS390X_OpDiv32(v *Value) bool {
1606 v_1 := v.Args[1]
1607 v_0 := v.Args[0]
1608 b := v.Block
1609 typ := &b.Func.Config.Types
1610 // match: (Div32 x y)
1611 // result: (DIVW (MOVWreg x) y)
1612 for {
1613 x := v_0
1614 y := v_1
1615 v.reset(OpS390XDIVW)
1616 v0 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64)
1617 v0.AddArg(x)
1618 v.AddArg2(v0, y)
1619 return true
1620 }
1621 }
1622 func rewriteValueS390X_OpDiv32u(v *Value) bool {
1623 v_1 := v.Args[1]
1624 v_0 := v.Args[0]
1625 b := v.Block
1626 typ := &b.Func.Config.Types
1627 // match: (Div32u x y)
1628 // result: (DIVWU (MOVWZreg x) y)
1629 for {
1630 x := v_0
1631 y := v_1
1632 v.reset(OpS390XDIVWU)
1633 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
1634 v0.AddArg(x)
1635 v.AddArg2(v0, y)
1636 return true
1637 }
1638 }
1639 func rewriteValueS390X_OpDiv64(v *Value) bool {
1640 v_1 := v.Args[1]
1641 v_0 := v.Args[0]
1642 // match: (Div64 x y)
1643 // result: (DIVD x y)
1644 for {
1645 x := v_0
1646 y := v_1
1647 v.reset(OpS390XDIVD)
1648 v.AddArg2(x, y)
1649 return true
1650 }
1651 }
1652 func rewriteValueS390X_OpDiv8(v *Value) bool {
1653 v_1 := v.Args[1]
1654 v_0 := v.Args[0]
1655 b := v.Block
1656 typ := &b.Func.Config.Types
1657 // match: (Div8 x y)
1658 // result: (DIVW (MOVBreg x) (MOVBreg y))
1659 for {
1660 x := v_0
1661 y := v_1
1662 v.reset(OpS390XDIVW)
1663 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1664 v0.AddArg(x)
1665 v1 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1666 v1.AddArg(y)
1667 v.AddArg2(v0, v1)
1668 return true
1669 }
1670 }
1671 func rewriteValueS390X_OpDiv8u(v *Value) bool {
1672 v_1 := v.Args[1]
1673 v_0 := v.Args[0]
1674 b := v.Block
1675 typ := &b.Func.Config.Types
1676 // match: (Div8u x y)
1677 // result: (DIVWU (MOVBZreg x) (MOVBZreg y))
1678 for {
1679 x := v_0
1680 y := v_1
1681 v.reset(OpS390XDIVWU)
1682 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
1683 v0.AddArg(x)
1684 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
1685 v1.AddArg(y)
1686 v.AddArg2(v0, v1)
1687 return true
1688 }
1689 }
1690 func rewriteValueS390X_OpEq16(v *Value) bool {
1691 v_1 := v.Args[1]
1692 v_0 := v.Args[0]
1693 b := v.Block
1694 typ := &b.Func.Config.Types
1695 // match: (Eq16 x y)
1696 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y)))
1697 for {
1698 x := v_0
1699 y := v_1
1700 v.reset(OpS390XLOCGR)
1701 v.Aux = s390xCCMaskToAux(s390x.Equal)
1702 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1703 v0.AuxInt = int64ToAuxInt(0)
1704 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1705 v1.AuxInt = int64ToAuxInt(1)
1706 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
1707 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
1708 v3.AddArg(x)
1709 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
1710 v4.AddArg(y)
1711 v2.AddArg2(v3, v4)
1712 v.AddArg3(v0, v1, v2)
1713 return true
1714 }
1715 }
1716 func rewriteValueS390X_OpEq32(v *Value) bool {
1717 v_1 := v.Args[1]
1718 v_0 := v.Args[0]
1719 b := v.Block
1720 typ := &b.Func.Config.Types
1721 // match: (Eq32 x y)
1722 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y))
1723 for {
1724 x := v_0
1725 y := v_1
1726 v.reset(OpS390XLOCGR)
1727 v.Aux = s390xCCMaskToAux(s390x.Equal)
1728 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1729 v0.AuxInt = int64ToAuxInt(0)
1730 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1731 v1.AuxInt = int64ToAuxInt(1)
1732 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
1733 v2.AddArg2(x, y)
1734 v.AddArg3(v0, v1, v2)
1735 return true
1736 }
1737 }
1738 func rewriteValueS390X_OpEq32F(v *Value) bool {
1739 v_1 := v.Args[1]
1740 v_0 := v.Args[0]
1741 b := v.Block
1742 typ := &b.Func.Config.Types
1743 // match: (Eq32F x y)
1744 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y))
1745 for {
1746 x := v_0
1747 y := v_1
1748 v.reset(OpS390XLOCGR)
1749 v.Aux = s390xCCMaskToAux(s390x.Equal)
1750 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1751 v0.AuxInt = int64ToAuxInt(0)
1752 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1753 v1.AuxInt = int64ToAuxInt(1)
1754 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags)
1755 v2.AddArg2(x, y)
1756 v.AddArg3(v0, v1, v2)
1757 return true
1758 }
1759 }
1760 func rewriteValueS390X_OpEq64(v *Value) bool {
1761 v_1 := v.Args[1]
1762 v_0 := v.Args[0]
1763 b := v.Block
1764 typ := &b.Func.Config.Types
1765 // match: (Eq64 x y)
1766 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
1767 for {
1768 x := v_0
1769 y := v_1
1770 v.reset(OpS390XLOCGR)
1771 v.Aux = s390xCCMaskToAux(s390x.Equal)
1772 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1773 v0.AuxInt = int64ToAuxInt(0)
1774 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1775 v1.AuxInt = int64ToAuxInt(1)
1776 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
1777 v2.AddArg2(x, y)
1778 v.AddArg3(v0, v1, v2)
1779 return true
1780 }
1781 }
1782 func rewriteValueS390X_OpEq64F(v *Value) bool {
1783 v_1 := v.Args[1]
1784 v_0 := v.Args[0]
1785 b := v.Block
1786 typ := &b.Func.Config.Types
1787 // match: (Eq64F x y)
1788 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y))
1789 for {
1790 x := v_0
1791 y := v_1
1792 v.reset(OpS390XLOCGR)
1793 v.Aux = s390xCCMaskToAux(s390x.Equal)
1794 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1795 v0.AuxInt = int64ToAuxInt(0)
1796 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1797 v1.AuxInt = int64ToAuxInt(1)
1798 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags)
1799 v2.AddArg2(x, y)
1800 v.AddArg3(v0, v1, v2)
1801 return true
1802 }
1803 }
1804 func rewriteValueS390X_OpEq8(v *Value) bool {
1805 v_1 := v.Args[1]
1806 v_0 := v.Args[0]
1807 b := v.Block
1808 typ := &b.Func.Config.Types
1809 // match: (Eq8 x y)
1810 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
1811 for {
1812 x := v_0
1813 y := v_1
1814 v.reset(OpS390XLOCGR)
1815 v.Aux = s390xCCMaskToAux(s390x.Equal)
1816 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1817 v0.AuxInt = int64ToAuxInt(0)
1818 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1819 v1.AuxInt = int64ToAuxInt(1)
1820 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
1821 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1822 v3.AddArg(x)
1823 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1824 v4.AddArg(y)
1825 v2.AddArg2(v3, v4)
1826 v.AddArg3(v0, v1, v2)
1827 return true
1828 }
1829 }
1830 func rewriteValueS390X_OpEqB(v *Value) bool {
1831 v_1 := v.Args[1]
1832 v_0 := v.Args[0]
1833 b := v.Block
1834 typ := &b.Func.Config.Types
1835 // match: (EqB x y)
1836 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
1837 for {
1838 x := v_0
1839 y := v_1
1840 v.reset(OpS390XLOCGR)
1841 v.Aux = s390xCCMaskToAux(s390x.Equal)
1842 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1843 v0.AuxInt = int64ToAuxInt(0)
1844 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1845 v1.AuxInt = int64ToAuxInt(1)
1846 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
1847 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1848 v3.AddArg(x)
1849 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1850 v4.AddArg(y)
1851 v2.AddArg2(v3, v4)
1852 v.AddArg3(v0, v1, v2)
1853 return true
1854 }
1855 }
1856 func rewriteValueS390X_OpEqPtr(v *Value) bool {
1857 v_1 := v.Args[1]
1858 v_0 := v.Args[0]
1859 b := v.Block
1860 typ := &b.Func.Config.Types
1861 // match: (EqPtr x y)
1862 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
1863 for {
1864 x := v_0
1865 y := v_1
1866 v.reset(OpS390XLOCGR)
1867 v.Aux = s390xCCMaskToAux(s390x.Equal)
1868 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1869 v0.AuxInt = int64ToAuxInt(0)
1870 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1871 v1.AuxInt = int64ToAuxInt(1)
1872 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
1873 v2.AddArg2(x, y)
1874 v.AddArg3(v0, v1, v2)
1875 return true
1876 }
1877 }
1878 func rewriteValueS390X_OpFMA(v *Value) bool {
1879 v_2 := v.Args[2]
1880 v_1 := v.Args[1]
1881 v_0 := v.Args[0]
1882 // match: (FMA x y z)
1883 // result: (FMADD z x y)
1884 for {
1885 x := v_0
1886 y := v_1
1887 z := v_2
1888 v.reset(OpS390XFMADD)
1889 v.AddArg3(z, x, y)
1890 return true
1891 }
1892 }
1893 func rewriteValueS390X_OpFloor(v *Value) bool {
1894 v_0 := v.Args[0]
1895 // match: (Floor x)
1896 // result: (FIDBR [7] x)
1897 for {
1898 x := v_0
1899 v.reset(OpS390XFIDBR)
1900 v.AuxInt = int8ToAuxInt(7)
1901 v.AddArg(x)
1902 return true
1903 }
1904 }
1905 func rewriteValueS390X_OpHmul32(v *Value) bool {
1906 v_1 := v.Args[1]
1907 v_0 := v.Args[0]
1908 b := v.Block
1909 typ := &b.Func.Config.Types
1910 // match: (Hmul32 x y)
1911 // result: (SRDconst [32] (MULLD (MOVWreg x) (MOVWreg y)))
1912 for {
1913 x := v_0
1914 y := v_1
1915 v.reset(OpS390XSRDconst)
1916 v.AuxInt = uint8ToAuxInt(32)
1917 v0 := b.NewValue0(v.Pos, OpS390XMULLD, typ.Int64)
1918 v1 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64)
1919 v1.AddArg(x)
1920 v2 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64)
1921 v2.AddArg(y)
1922 v0.AddArg2(v1, v2)
1923 v.AddArg(v0)
1924 return true
1925 }
1926 }
1927 func rewriteValueS390X_OpHmul32u(v *Value) bool {
1928 v_1 := v.Args[1]
1929 v_0 := v.Args[0]
1930 b := v.Block
1931 typ := &b.Func.Config.Types
1932 // match: (Hmul32u x y)
1933 // result: (SRDconst [32] (MULLD (MOVWZreg x) (MOVWZreg y)))
1934 for {
1935 x := v_0
1936 y := v_1
1937 v.reset(OpS390XSRDconst)
1938 v.AuxInt = uint8ToAuxInt(32)
1939 v0 := b.NewValue0(v.Pos, OpS390XMULLD, typ.Int64)
1940 v1 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
1941 v1.AddArg(x)
1942 v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
1943 v2.AddArg(y)
1944 v0.AddArg2(v1, v2)
1945 v.AddArg(v0)
1946 return true
1947 }
1948 }
1949 func rewriteValueS390X_OpITab(v *Value) bool {
1950 v_0 := v.Args[0]
1951 // match: (ITab (Load ptr mem))
1952 // result: (MOVDload ptr mem)
1953 for {
1954 if v_0.Op != OpLoad {
1955 break
1956 }
1957 mem := v_0.Args[1]
1958 ptr := v_0.Args[0]
1959 v.reset(OpS390XMOVDload)
1960 v.AddArg2(ptr, mem)
1961 return true
1962 }
1963 return false
1964 }
1965 func rewriteValueS390X_OpIsInBounds(v *Value) bool {
1966 v_1 := v.Args[1]
1967 v_0 := v.Args[0]
1968 b := v.Block
1969 typ := &b.Func.Config.Types
1970 // match: (IsInBounds idx len)
1971 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPU idx len))
1972 for {
1973 idx := v_0
1974 len := v_1
1975 v.reset(OpS390XLOCGR)
1976 v.Aux = s390xCCMaskToAux(s390x.Less)
1977 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1978 v0.AuxInt = int64ToAuxInt(0)
1979 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1980 v1.AuxInt = int64ToAuxInt(1)
1981 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
1982 v2.AddArg2(idx, len)
1983 v.AddArg3(v0, v1, v2)
1984 return true
1985 }
1986 }
1987 func rewriteValueS390X_OpIsNonNil(v *Value) bool {
1988 v_0 := v.Args[0]
1989 b := v.Block
1990 typ := &b.Func.Config.Types
1991 // match: (IsNonNil p)
1992 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPconst p [0]))
1993 for {
1994 p := v_0
1995 v.reset(OpS390XLOCGR)
1996 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
1997 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1998 v0.AuxInt = int64ToAuxInt(0)
1999 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2000 v1.AuxInt = int64ToAuxInt(1)
2001 v2 := b.NewValue0(v.Pos, OpS390XCMPconst, types.TypeFlags)
2002 v2.AuxInt = int32ToAuxInt(0)
2003 v2.AddArg(p)
2004 v.AddArg3(v0, v1, v2)
2005 return true
2006 }
2007 }
2008 func rewriteValueS390X_OpIsSliceInBounds(v *Value) bool {
2009 v_1 := v.Args[1]
2010 v_0 := v.Args[0]
2011 b := v.Block
2012 typ := &b.Func.Config.Types
2013 // match: (IsSliceInBounds idx len)
2014 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPU idx len))
2015 for {
2016 idx := v_0
2017 len := v_1
2018 v.reset(OpS390XLOCGR)
2019 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2020 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2021 v0.AuxInt = int64ToAuxInt(0)
2022 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2023 v1.AuxInt = int64ToAuxInt(1)
2024 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
2025 v2.AddArg2(idx, len)
2026 v.AddArg3(v0, v1, v2)
2027 return true
2028 }
2029 }
2030 func rewriteValueS390X_OpLeq16(v *Value) bool {
2031 v_1 := v.Args[1]
2032 v_0 := v.Args[0]
2033 b := v.Block
2034 typ := &b.Func.Config.Types
2035 // match: (Leq16 x y)
2036 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y)))
2037 for {
2038 x := v_0
2039 y := v_1
2040 v.reset(OpS390XLOCGR)
2041 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2042 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2043 v0.AuxInt = int64ToAuxInt(0)
2044 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2045 v1.AuxInt = int64ToAuxInt(1)
2046 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2047 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
2048 v3.AddArg(x)
2049 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
2050 v4.AddArg(y)
2051 v2.AddArg2(v3, v4)
2052 v.AddArg3(v0, v1, v2)
2053 return true
2054 }
2055 }
2056 func rewriteValueS390X_OpLeq16U(v *Value) bool {
2057 v_1 := v.Args[1]
2058 v_0 := v.Args[0]
2059 b := v.Block
2060 typ := &b.Func.Config.Types
2061 // match: (Leq16U x y)
2062 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVHZreg x) (MOVHZreg y)))
2063 for {
2064 x := v_0
2065 y := v_1
2066 v.reset(OpS390XLOCGR)
2067 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2068 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2069 v0.AuxInt = int64ToAuxInt(0)
2070 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2071 v1.AuxInt = int64ToAuxInt(1)
2072 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2073 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2074 v3.AddArg(x)
2075 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2076 v4.AddArg(y)
2077 v2.AddArg2(v3, v4)
2078 v.AddArg3(v0, v1, v2)
2079 return true
2080 }
2081 }
2082 func rewriteValueS390X_OpLeq32(v *Value) bool {
2083 v_1 := v.Args[1]
2084 v_0 := v.Args[0]
2085 b := v.Block
2086 typ := &b.Func.Config.Types
2087 // match: (Leq32 x y)
2088 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y))
2089 for {
2090 x := v_0
2091 y := v_1
2092 v.reset(OpS390XLOCGR)
2093 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2094 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2095 v0.AuxInt = int64ToAuxInt(0)
2096 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2097 v1.AuxInt = int64ToAuxInt(1)
2098 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2099 v2.AddArg2(x, y)
2100 v.AddArg3(v0, v1, v2)
2101 return true
2102 }
2103 }
2104 func rewriteValueS390X_OpLeq32F(v *Value) bool {
2105 v_1 := v.Args[1]
2106 v_0 := v.Args[0]
2107 b := v.Block
2108 typ := &b.Func.Config.Types
2109 // match: (Leq32F x y)
2110 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y))
2111 for {
2112 x := v_0
2113 y := v_1
2114 v.reset(OpS390XLOCGR)
2115 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2116 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2117 v0.AuxInt = int64ToAuxInt(0)
2118 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2119 v1.AuxInt = int64ToAuxInt(1)
2120 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags)
2121 v2.AddArg2(x, y)
2122 v.AddArg3(v0, v1, v2)
2123 return true
2124 }
2125 }
2126 func rewriteValueS390X_OpLeq32U(v *Value) bool {
2127 v_1 := v.Args[1]
2128 v_0 := v.Args[0]
2129 b := v.Block
2130 typ := &b.Func.Config.Types
2131 // match: (Leq32U x y)
2132 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU x y))
2133 for {
2134 x := v_0
2135 y := v_1
2136 v.reset(OpS390XLOCGR)
2137 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2138 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2139 v0.AuxInt = int64ToAuxInt(0)
2140 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2141 v1.AuxInt = int64ToAuxInt(1)
2142 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2143 v2.AddArg2(x, y)
2144 v.AddArg3(v0, v1, v2)
2145 return true
2146 }
2147 }
2148 func rewriteValueS390X_OpLeq64(v *Value) bool {
2149 v_1 := v.Args[1]
2150 v_0 := v.Args[0]
2151 b := v.Block
2152 typ := &b.Func.Config.Types
2153 // match: (Leq64 x y)
2154 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
2155 for {
2156 x := v_0
2157 y := v_1
2158 v.reset(OpS390XLOCGR)
2159 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2160 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2161 v0.AuxInt = int64ToAuxInt(0)
2162 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2163 v1.AuxInt = int64ToAuxInt(1)
2164 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
2165 v2.AddArg2(x, y)
2166 v.AddArg3(v0, v1, v2)
2167 return true
2168 }
2169 }
2170 func rewriteValueS390X_OpLeq64F(v *Value) bool {
2171 v_1 := v.Args[1]
2172 v_0 := v.Args[0]
2173 b := v.Block
2174 typ := &b.Func.Config.Types
2175 // match: (Leq64F x y)
2176 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y))
2177 for {
2178 x := v_0
2179 y := v_1
2180 v.reset(OpS390XLOCGR)
2181 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2182 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2183 v0.AuxInt = int64ToAuxInt(0)
2184 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2185 v1.AuxInt = int64ToAuxInt(1)
2186 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags)
2187 v2.AddArg2(x, y)
2188 v.AddArg3(v0, v1, v2)
2189 return true
2190 }
2191 }
2192 func rewriteValueS390X_OpLeq64U(v *Value) bool {
2193 v_1 := v.Args[1]
2194 v_0 := v.Args[0]
2195 b := v.Block
2196 typ := &b.Func.Config.Types
2197 // match: (Leq64U x y)
2198 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPU x y))
2199 for {
2200 x := v_0
2201 y := v_1
2202 v.reset(OpS390XLOCGR)
2203 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2204 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2205 v0.AuxInt = int64ToAuxInt(0)
2206 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2207 v1.AuxInt = int64ToAuxInt(1)
2208 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
2209 v2.AddArg2(x, y)
2210 v.AddArg3(v0, v1, v2)
2211 return true
2212 }
2213 }
2214 func rewriteValueS390X_OpLeq8(v *Value) bool {
2215 v_1 := v.Args[1]
2216 v_0 := v.Args[0]
2217 b := v.Block
2218 typ := &b.Func.Config.Types
2219 // match: (Leq8 x y)
2220 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
2221 for {
2222 x := v_0
2223 y := v_1
2224 v.reset(OpS390XLOCGR)
2225 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2226 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2227 v0.AuxInt = int64ToAuxInt(0)
2228 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2229 v1.AuxInt = int64ToAuxInt(1)
2230 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2231 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
2232 v3.AddArg(x)
2233 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
2234 v4.AddArg(y)
2235 v2.AddArg2(v3, v4)
2236 v.AddArg3(v0, v1, v2)
2237 return true
2238 }
2239 }
2240 func rewriteValueS390X_OpLeq8U(v *Value) bool {
2241 v_1 := v.Args[1]
2242 v_0 := v.Args[0]
2243 b := v.Block
2244 typ := &b.Func.Config.Types
2245 // match: (Leq8U x y)
2246 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVBZreg x) (MOVBZreg y)))
2247 for {
2248 x := v_0
2249 y := v_1
2250 v.reset(OpS390XLOCGR)
2251 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2252 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2253 v0.AuxInt = int64ToAuxInt(0)
2254 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2255 v1.AuxInt = int64ToAuxInt(1)
2256 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2257 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2258 v3.AddArg(x)
2259 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2260 v4.AddArg(y)
2261 v2.AddArg2(v3, v4)
2262 v.AddArg3(v0, v1, v2)
2263 return true
2264 }
2265 }
2266 func rewriteValueS390X_OpLess16(v *Value) bool {
2267 v_1 := v.Args[1]
2268 v_0 := v.Args[0]
2269 b := v.Block
2270 typ := &b.Func.Config.Types
2271 // match: (Less16 x y)
2272 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y)))
2273 for {
2274 x := v_0
2275 y := v_1
2276 v.reset(OpS390XLOCGR)
2277 v.Aux = s390xCCMaskToAux(s390x.Less)
2278 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2279 v0.AuxInt = int64ToAuxInt(0)
2280 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2281 v1.AuxInt = int64ToAuxInt(1)
2282 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2283 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
2284 v3.AddArg(x)
2285 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
2286 v4.AddArg(y)
2287 v2.AddArg2(v3, v4)
2288 v.AddArg3(v0, v1, v2)
2289 return true
2290 }
2291 }
2292 func rewriteValueS390X_OpLess16U(v *Value) bool {
2293 v_1 := v.Args[1]
2294 v_0 := v.Args[0]
2295 b := v.Block
2296 typ := &b.Func.Config.Types
2297 // match: (Less16U x y)
2298 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVHZreg x) (MOVHZreg y)))
2299 for {
2300 x := v_0
2301 y := v_1
2302 v.reset(OpS390XLOCGR)
2303 v.Aux = s390xCCMaskToAux(s390x.Less)
2304 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2305 v0.AuxInt = int64ToAuxInt(0)
2306 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2307 v1.AuxInt = int64ToAuxInt(1)
2308 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2309 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2310 v3.AddArg(x)
2311 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2312 v4.AddArg(y)
2313 v2.AddArg2(v3, v4)
2314 v.AddArg3(v0, v1, v2)
2315 return true
2316 }
2317 }
2318 func rewriteValueS390X_OpLess32(v *Value) bool {
2319 v_1 := v.Args[1]
2320 v_0 := v.Args[0]
2321 b := v.Block
2322 typ := &b.Func.Config.Types
2323 // match: (Less32 x y)
2324 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y))
2325 for {
2326 x := v_0
2327 y := v_1
2328 v.reset(OpS390XLOCGR)
2329 v.Aux = s390xCCMaskToAux(s390x.Less)
2330 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2331 v0.AuxInt = int64ToAuxInt(0)
2332 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2333 v1.AuxInt = int64ToAuxInt(1)
2334 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2335 v2.AddArg2(x, y)
2336 v.AddArg3(v0, v1, v2)
2337 return true
2338 }
2339 }
2340 func rewriteValueS390X_OpLess32F(v *Value) bool {
2341 v_1 := v.Args[1]
2342 v_0 := v.Args[0]
2343 b := v.Block
2344 typ := &b.Func.Config.Types
2345 // match: (Less32F x y)
2346 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y))
2347 for {
2348 x := v_0
2349 y := v_1
2350 v.reset(OpS390XLOCGR)
2351 v.Aux = s390xCCMaskToAux(s390x.Less)
2352 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2353 v0.AuxInt = int64ToAuxInt(0)
2354 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2355 v1.AuxInt = int64ToAuxInt(1)
2356 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags)
2357 v2.AddArg2(x, y)
2358 v.AddArg3(v0, v1, v2)
2359 return true
2360 }
2361 }
2362 func rewriteValueS390X_OpLess32U(v *Value) bool {
2363 v_1 := v.Args[1]
2364 v_0 := v.Args[0]
2365 b := v.Block
2366 typ := &b.Func.Config.Types
2367 // match: (Less32U x y)
2368 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU x y))
2369 for {
2370 x := v_0
2371 y := v_1
2372 v.reset(OpS390XLOCGR)
2373 v.Aux = s390xCCMaskToAux(s390x.Less)
2374 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2375 v0.AuxInt = int64ToAuxInt(0)
2376 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2377 v1.AuxInt = int64ToAuxInt(1)
2378 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2379 v2.AddArg2(x, y)
2380 v.AddArg3(v0, v1, v2)
2381 return true
2382 }
2383 }
2384 func rewriteValueS390X_OpLess64(v *Value) bool {
2385 v_1 := v.Args[1]
2386 v_0 := v.Args[0]
2387 b := v.Block
2388 typ := &b.Func.Config.Types
2389 // match: (Less64 x y)
2390 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
2391 for {
2392 x := v_0
2393 y := v_1
2394 v.reset(OpS390XLOCGR)
2395 v.Aux = s390xCCMaskToAux(s390x.Less)
2396 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2397 v0.AuxInt = int64ToAuxInt(0)
2398 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2399 v1.AuxInt = int64ToAuxInt(1)
2400 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
2401 v2.AddArg2(x, y)
2402 v.AddArg3(v0, v1, v2)
2403 return true
2404 }
2405 }
2406 func rewriteValueS390X_OpLess64F(v *Value) bool {
2407 v_1 := v.Args[1]
2408 v_0 := v.Args[0]
2409 b := v.Block
2410 typ := &b.Func.Config.Types
2411 // match: (Less64F x y)
2412 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y))
2413 for {
2414 x := v_0
2415 y := v_1
2416 v.reset(OpS390XLOCGR)
2417 v.Aux = s390xCCMaskToAux(s390x.Less)
2418 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2419 v0.AuxInt = int64ToAuxInt(0)
2420 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2421 v1.AuxInt = int64ToAuxInt(1)
2422 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags)
2423 v2.AddArg2(x, y)
2424 v.AddArg3(v0, v1, v2)
2425 return true
2426 }
2427 }
2428 func rewriteValueS390X_OpLess64U(v *Value) bool {
2429 v_1 := v.Args[1]
2430 v_0 := v.Args[0]
2431 b := v.Block
2432 typ := &b.Func.Config.Types
2433 // match: (Less64U x y)
2434 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPU x y))
2435 for {
2436 x := v_0
2437 y := v_1
2438 v.reset(OpS390XLOCGR)
2439 v.Aux = s390xCCMaskToAux(s390x.Less)
2440 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2441 v0.AuxInt = int64ToAuxInt(0)
2442 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2443 v1.AuxInt = int64ToAuxInt(1)
2444 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
2445 v2.AddArg2(x, y)
2446 v.AddArg3(v0, v1, v2)
2447 return true
2448 }
2449 }
2450 func rewriteValueS390X_OpLess8(v *Value) bool {
2451 v_1 := v.Args[1]
2452 v_0 := v.Args[0]
2453 b := v.Block
2454 typ := &b.Func.Config.Types
2455 // match: (Less8 x y)
2456 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
2457 for {
2458 x := v_0
2459 y := v_1
2460 v.reset(OpS390XLOCGR)
2461 v.Aux = s390xCCMaskToAux(s390x.Less)
2462 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2463 v0.AuxInt = int64ToAuxInt(0)
2464 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2465 v1.AuxInt = int64ToAuxInt(1)
2466 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2467 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
2468 v3.AddArg(x)
2469 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
2470 v4.AddArg(y)
2471 v2.AddArg2(v3, v4)
2472 v.AddArg3(v0, v1, v2)
2473 return true
2474 }
2475 }
2476 func rewriteValueS390X_OpLess8U(v *Value) bool {
2477 v_1 := v.Args[1]
2478 v_0 := v.Args[0]
2479 b := v.Block
2480 typ := &b.Func.Config.Types
2481 // match: (Less8U x y)
2482 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVBZreg x) (MOVBZreg y)))
2483 for {
2484 x := v_0
2485 y := v_1
2486 v.reset(OpS390XLOCGR)
2487 v.Aux = s390xCCMaskToAux(s390x.Less)
2488 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2489 v0.AuxInt = int64ToAuxInt(0)
2490 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2491 v1.AuxInt = int64ToAuxInt(1)
2492 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2493 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2494 v3.AddArg(x)
2495 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2496 v4.AddArg(y)
2497 v2.AddArg2(v3, v4)
2498 v.AddArg3(v0, v1, v2)
2499 return true
2500 }
2501 }
2502 func rewriteValueS390X_OpLoad(v *Value) bool {
2503 v_1 := v.Args[1]
2504 v_0 := v.Args[0]
2505 // match: (Load <t> ptr mem)
2506 // cond: (is64BitInt(t) || isPtr(t))
2507 // result: (MOVDload ptr mem)
2508 for {
2509 t := v.Type
2510 ptr := v_0
2511 mem := v_1
2512 if !(is64BitInt(t) || isPtr(t)) {
2513 break
2514 }
2515 v.reset(OpS390XMOVDload)
2516 v.AddArg2(ptr, mem)
2517 return true
2518 }
2519 // match: (Load <t> ptr mem)
2520 // cond: is32BitInt(t) && t.IsSigned()
2521 // result: (MOVWload ptr mem)
2522 for {
2523 t := v.Type
2524 ptr := v_0
2525 mem := v_1
2526 if !(is32BitInt(t) && t.IsSigned()) {
2527 break
2528 }
2529 v.reset(OpS390XMOVWload)
2530 v.AddArg2(ptr, mem)
2531 return true
2532 }
2533 // match: (Load <t> ptr mem)
2534 // cond: is32BitInt(t) && !t.IsSigned()
2535 // result: (MOVWZload ptr mem)
2536 for {
2537 t := v.Type
2538 ptr := v_0
2539 mem := v_1
2540 if !(is32BitInt(t) && !t.IsSigned()) {
2541 break
2542 }
2543 v.reset(OpS390XMOVWZload)
2544 v.AddArg2(ptr, mem)
2545 return true
2546 }
2547 // match: (Load <t> ptr mem)
2548 // cond: is16BitInt(t) && t.IsSigned()
2549 // result: (MOVHload ptr mem)
2550 for {
2551 t := v.Type
2552 ptr := v_0
2553 mem := v_1
2554 if !(is16BitInt(t) && t.IsSigned()) {
2555 break
2556 }
2557 v.reset(OpS390XMOVHload)
2558 v.AddArg2(ptr, mem)
2559 return true
2560 }
2561 // match: (Load <t> ptr mem)
2562 // cond: is16BitInt(t) && !t.IsSigned()
2563 // result: (MOVHZload ptr mem)
2564 for {
2565 t := v.Type
2566 ptr := v_0
2567 mem := v_1
2568 if !(is16BitInt(t) && !t.IsSigned()) {
2569 break
2570 }
2571 v.reset(OpS390XMOVHZload)
2572 v.AddArg2(ptr, mem)
2573 return true
2574 }
2575 // match: (Load <t> ptr mem)
2576 // cond: is8BitInt(t) && t.IsSigned()
2577 // result: (MOVBload ptr mem)
2578 for {
2579 t := v.Type
2580 ptr := v_0
2581 mem := v_1
2582 if !(is8BitInt(t) && t.IsSigned()) {
2583 break
2584 }
2585 v.reset(OpS390XMOVBload)
2586 v.AddArg2(ptr, mem)
2587 return true
2588 }
2589 // match: (Load <t> ptr mem)
2590 // cond: (t.IsBoolean() || (is8BitInt(t) && !t.IsSigned()))
2591 // result: (MOVBZload ptr mem)
2592 for {
2593 t := v.Type
2594 ptr := v_0
2595 mem := v_1
2596 if !(t.IsBoolean() || (is8BitInt(t) && !t.IsSigned())) {
2597 break
2598 }
2599 v.reset(OpS390XMOVBZload)
2600 v.AddArg2(ptr, mem)
2601 return true
2602 }
2603 // match: (Load <t> ptr mem)
2604 // cond: is32BitFloat(t)
2605 // result: (FMOVSload ptr mem)
2606 for {
2607 t := v.Type
2608 ptr := v_0
2609 mem := v_1
2610 if !(is32BitFloat(t)) {
2611 break
2612 }
2613 v.reset(OpS390XFMOVSload)
2614 v.AddArg2(ptr, mem)
2615 return true
2616 }
2617 // match: (Load <t> ptr mem)
2618 // cond: is64BitFloat(t)
2619 // result: (FMOVDload ptr mem)
2620 for {
2621 t := v.Type
2622 ptr := v_0
2623 mem := v_1
2624 if !(is64BitFloat(t)) {
2625 break
2626 }
2627 v.reset(OpS390XFMOVDload)
2628 v.AddArg2(ptr, mem)
2629 return true
2630 }
2631 return false
2632 }
2633 func rewriteValueS390X_OpLocalAddr(v *Value) bool {
2634 v_1 := v.Args[1]
2635 v_0 := v.Args[0]
2636 b := v.Block
2637 typ := &b.Func.Config.Types
2638 // match: (LocalAddr <t> {sym} base mem)
2639 // cond: t.Elem().HasPointers()
2640 // result: (MOVDaddr {sym} (SPanchored base mem))
2641 for {
2642 t := v.Type
2643 sym := auxToSym(v.Aux)
2644 base := v_0
2645 mem := v_1
2646 if !(t.Elem().HasPointers()) {
2647 break
2648 }
2649 v.reset(OpS390XMOVDaddr)
2650 v.Aux = symToAux(sym)
2651 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr)
2652 v0.AddArg2(base, mem)
2653 v.AddArg(v0)
2654 return true
2655 }
2656 // match: (LocalAddr <t> {sym} base _)
2657 // cond: !t.Elem().HasPointers()
2658 // result: (MOVDaddr {sym} base)
2659 for {
2660 t := v.Type
2661 sym := auxToSym(v.Aux)
2662 base := v_0
2663 if !(!t.Elem().HasPointers()) {
2664 break
2665 }
2666 v.reset(OpS390XMOVDaddr)
2667 v.Aux = symToAux(sym)
2668 v.AddArg(base)
2669 return true
2670 }
2671 return false
2672 }
2673 func rewriteValueS390X_OpLsh16x16(v *Value) bool {
2674 v_1 := v.Args[1]
2675 v_0 := v.Args[0]
2676 b := v.Block
2677 typ := &b.Func.Config.Types
2678 // match: (Lsh16x16 x y)
2679 // cond: shiftIsBounded(v)
2680 // result: (SLW x y)
2681 for {
2682 x := v_0
2683 y := v_1
2684 if !(shiftIsBounded(v)) {
2685 break
2686 }
2687 v.reset(OpS390XSLW)
2688 v.AddArg2(x, y)
2689 return true
2690 }
2691 // match: (Lsh16x16 <t> x y)
2692 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
2693 for {
2694 t := v.Type
2695 x := v_0
2696 y := v_1
2697 v.reset(OpS390XLOCGR)
2698 v.Type = t
2699 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2700 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2701 v0.AddArg2(x, y)
2702 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2703 v1.AuxInt = int64ToAuxInt(0)
2704 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2705 v2.AuxInt = int32ToAuxInt(64)
2706 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2707 v3.AddArg(y)
2708 v2.AddArg(v3)
2709 v.AddArg3(v0, v1, v2)
2710 return true
2711 }
2712 }
2713 func rewriteValueS390X_OpLsh16x32(v *Value) bool {
2714 v_1 := v.Args[1]
2715 v_0 := v.Args[0]
2716 b := v.Block
2717 typ := &b.Func.Config.Types
2718 // match: (Lsh16x32 x y)
2719 // cond: shiftIsBounded(v)
2720 // result: (SLW x y)
2721 for {
2722 x := v_0
2723 y := v_1
2724 if !(shiftIsBounded(v)) {
2725 break
2726 }
2727 v.reset(OpS390XSLW)
2728 v.AddArg2(x, y)
2729 return true
2730 }
2731 // match: (Lsh16x32 <t> x y)
2732 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
2733 for {
2734 t := v.Type
2735 x := v_0
2736 y := v_1
2737 v.reset(OpS390XLOCGR)
2738 v.Type = t
2739 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2740 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2741 v0.AddArg2(x, y)
2742 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2743 v1.AuxInt = int64ToAuxInt(0)
2744 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2745 v2.AuxInt = int32ToAuxInt(64)
2746 v2.AddArg(y)
2747 v.AddArg3(v0, v1, v2)
2748 return true
2749 }
2750 }
2751 func rewriteValueS390X_OpLsh16x64(v *Value) bool {
2752 v_1 := v.Args[1]
2753 v_0 := v.Args[0]
2754 b := v.Block
2755 typ := &b.Func.Config.Types
2756 // match: (Lsh16x64 x y)
2757 // cond: shiftIsBounded(v)
2758 // result: (SLW x y)
2759 for {
2760 x := v_0
2761 y := v_1
2762 if !(shiftIsBounded(v)) {
2763 break
2764 }
2765 v.reset(OpS390XSLW)
2766 v.AddArg2(x, y)
2767 return true
2768 }
2769 // match: (Lsh16x64 <t> x y)
2770 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
2771 for {
2772 t := v.Type
2773 x := v_0
2774 y := v_1
2775 v.reset(OpS390XLOCGR)
2776 v.Type = t
2777 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2778 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2779 v0.AddArg2(x, y)
2780 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2781 v1.AuxInt = int64ToAuxInt(0)
2782 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
2783 v2.AuxInt = int32ToAuxInt(64)
2784 v2.AddArg(y)
2785 v.AddArg3(v0, v1, v2)
2786 return true
2787 }
2788 }
2789 func rewriteValueS390X_OpLsh16x8(v *Value) bool {
2790 v_1 := v.Args[1]
2791 v_0 := v.Args[0]
2792 b := v.Block
2793 typ := &b.Func.Config.Types
2794 // match: (Lsh16x8 x y)
2795 // cond: shiftIsBounded(v)
2796 // result: (SLW x y)
2797 for {
2798 x := v_0
2799 y := v_1
2800 if !(shiftIsBounded(v)) {
2801 break
2802 }
2803 v.reset(OpS390XSLW)
2804 v.AddArg2(x, y)
2805 return true
2806 }
2807 // match: (Lsh16x8 <t> x y)
2808 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
2809 for {
2810 t := v.Type
2811 x := v_0
2812 y := v_1
2813 v.reset(OpS390XLOCGR)
2814 v.Type = t
2815 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2816 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2817 v0.AddArg2(x, y)
2818 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2819 v1.AuxInt = int64ToAuxInt(0)
2820 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2821 v2.AuxInt = int32ToAuxInt(64)
2822 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2823 v3.AddArg(y)
2824 v2.AddArg(v3)
2825 v.AddArg3(v0, v1, v2)
2826 return true
2827 }
2828 }
2829 func rewriteValueS390X_OpLsh32x16(v *Value) bool {
2830 v_1 := v.Args[1]
2831 v_0 := v.Args[0]
2832 b := v.Block
2833 typ := &b.Func.Config.Types
2834 // match: (Lsh32x16 x y)
2835 // cond: shiftIsBounded(v)
2836 // result: (SLW x y)
2837 for {
2838 x := v_0
2839 y := v_1
2840 if !(shiftIsBounded(v)) {
2841 break
2842 }
2843 v.reset(OpS390XSLW)
2844 v.AddArg2(x, y)
2845 return true
2846 }
2847 // match: (Lsh32x16 <t> x y)
2848 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
2849 for {
2850 t := v.Type
2851 x := v_0
2852 y := v_1
2853 v.reset(OpS390XLOCGR)
2854 v.Type = t
2855 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2856 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2857 v0.AddArg2(x, y)
2858 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2859 v1.AuxInt = int64ToAuxInt(0)
2860 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2861 v2.AuxInt = int32ToAuxInt(64)
2862 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2863 v3.AddArg(y)
2864 v2.AddArg(v3)
2865 v.AddArg3(v0, v1, v2)
2866 return true
2867 }
2868 }
2869 func rewriteValueS390X_OpLsh32x32(v *Value) bool {
2870 v_1 := v.Args[1]
2871 v_0 := v.Args[0]
2872 b := v.Block
2873 typ := &b.Func.Config.Types
2874 // match: (Lsh32x32 x y)
2875 // cond: shiftIsBounded(v)
2876 // result: (SLW x y)
2877 for {
2878 x := v_0
2879 y := v_1
2880 if !(shiftIsBounded(v)) {
2881 break
2882 }
2883 v.reset(OpS390XSLW)
2884 v.AddArg2(x, y)
2885 return true
2886 }
2887 // match: (Lsh32x32 <t> x y)
2888 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
2889 for {
2890 t := v.Type
2891 x := v_0
2892 y := v_1
2893 v.reset(OpS390XLOCGR)
2894 v.Type = t
2895 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2896 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2897 v0.AddArg2(x, y)
2898 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2899 v1.AuxInt = int64ToAuxInt(0)
2900 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2901 v2.AuxInt = int32ToAuxInt(64)
2902 v2.AddArg(y)
2903 v.AddArg3(v0, v1, v2)
2904 return true
2905 }
2906 }
2907 func rewriteValueS390X_OpLsh32x64(v *Value) bool {
2908 v_1 := v.Args[1]
2909 v_0 := v.Args[0]
2910 b := v.Block
2911 typ := &b.Func.Config.Types
2912 // match: (Lsh32x64 x y)
2913 // cond: shiftIsBounded(v)
2914 // result: (SLW x y)
2915 for {
2916 x := v_0
2917 y := v_1
2918 if !(shiftIsBounded(v)) {
2919 break
2920 }
2921 v.reset(OpS390XSLW)
2922 v.AddArg2(x, y)
2923 return true
2924 }
2925 // match: (Lsh32x64 <t> x y)
2926 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
2927 for {
2928 t := v.Type
2929 x := v_0
2930 y := v_1
2931 v.reset(OpS390XLOCGR)
2932 v.Type = t
2933 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2934 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2935 v0.AddArg2(x, y)
2936 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2937 v1.AuxInt = int64ToAuxInt(0)
2938 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
2939 v2.AuxInt = int32ToAuxInt(64)
2940 v2.AddArg(y)
2941 v.AddArg3(v0, v1, v2)
2942 return true
2943 }
2944 }
2945 func rewriteValueS390X_OpLsh32x8(v *Value) bool {
2946 v_1 := v.Args[1]
2947 v_0 := v.Args[0]
2948 b := v.Block
2949 typ := &b.Func.Config.Types
2950 // match: (Lsh32x8 x y)
2951 // cond: shiftIsBounded(v)
2952 // result: (SLW x y)
2953 for {
2954 x := v_0
2955 y := v_1
2956 if !(shiftIsBounded(v)) {
2957 break
2958 }
2959 v.reset(OpS390XSLW)
2960 v.AddArg2(x, y)
2961 return true
2962 }
2963 // match: (Lsh32x8 <t> x y)
2964 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
2965 for {
2966 t := v.Type
2967 x := v_0
2968 y := v_1
2969 v.reset(OpS390XLOCGR)
2970 v.Type = t
2971 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2972 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2973 v0.AddArg2(x, y)
2974 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2975 v1.AuxInt = int64ToAuxInt(0)
2976 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2977 v2.AuxInt = int32ToAuxInt(64)
2978 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2979 v3.AddArg(y)
2980 v2.AddArg(v3)
2981 v.AddArg3(v0, v1, v2)
2982 return true
2983 }
2984 }
2985 func rewriteValueS390X_OpLsh64x16(v *Value) bool {
2986 v_1 := v.Args[1]
2987 v_0 := v.Args[0]
2988 b := v.Block
2989 typ := &b.Func.Config.Types
2990 // match: (Lsh64x16 x y)
2991 // cond: shiftIsBounded(v)
2992 // result: (SLD x y)
2993 for {
2994 x := v_0
2995 y := v_1
2996 if !(shiftIsBounded(v)) {
2997 break
2998 }
2999 v.reset(OpS390XSLD)
3000 v.AddArg2(x, y)
3001 return true
3002 }
3003 // match: (Lsh64x16 <t> x y)
3004 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
3005 for {
3006 t := v.Type
3007 x := v_0
3008 y := v_1
3009 v.reset(OpS390XLOCGR)
3010 v.Type = t
3011 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3012 v0 := b.NewValue0(v.Pos, OpS390XSLD, t)
3013 v0.AddArg2(x, y)
3014 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3015 v1.AuxInt = int64ToAuxInt(0)
3016 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3017 v2.AuxInt = int32ToAuxInt(64)
3018 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
3019 v3.AddArg(y)
3020 v2.AddArg(v3)
3021 v.AddArg3(v0, v1, v2)
3022 return true
3023 }
3024 }
3025 func rewriteValueS390X_OpLsh64x32(v *Value) bool {
3026 v_1 := v.Args[1]
3027 v_0 := v.Args[0]
3028 b := v.Block
3029 typ := &b.Func.Config.Types
3030 // match: (Lsh64x32 x y)
3031 // cond: shiftIsBounded(v)
3032 // result: (SLD x y)
3033 for {
3034 x := v_0
3035 y := v_1
3036 if !(shiftIsBounded(v)) {
3037 break
3038 }
3039 v.reset(OpS390XSLD)
3040 v.AddArg2(x, y)
3041 return true
3042 }
3043 // match: (Lsh64x32 <t> x y)
3044 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
3045 for {
3046 t := v.Type
3047 x := v_0
3048 y := v_1
3049 v.reset(OpS390XLOCGR)
3050 v.Type = t
3051 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3052 v0 := b.NewValue0(v.Pos, OpS390XSLD, t)
3053 v0.AddArg2(x, y)
3054 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3055 v1.AuxInt = int64ToAuxInt(0)
3056 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3057 v2.AuxInt = int32ToAuxInt(64)
3058 v2.AddArg(y)
3059 v.AddArg3(v0, v1, v2)
3060 return true
3061 }
3062 }
3063 func rewriteValueS390X_OpLsh64x64(v *Value) bool {
3064 v_1 := v.Args[1]
3065 v_0 := v.Args[0]
3066 b := v.Block
3067 typ := &b.Func.Config.Types
3068 // match: (Lsh64x64 x y)
3069 // cond: shiftIsBounded(v)
3070 // result: (SLD x y)
3071 for {
3072 x := v_0
3073 y := v_1
3074 if !(shiftIsBounded(v)) {
3075 break
3076 }
3077 v.reset(OpS390XSLD)
3078 v.AddArg2(x, y)
3079 return true
3080 }
3081 // match: (Lsh64x64 <t> x y)
3082 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
3083 for {
3084 t := v.Type
3085 x := v_0
3086 y := v_1
3087 v.reset(OpS390XLOCGR)
3088 v.Type = t
3089 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3090 v0 := b.NewValue0(v.Pos, OpS390XSLD, t)
3091 v0.AddArg2(x, y)
3092 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3093 v1.AuxInt = int64ToAuxInt(0)
3094 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
3095 v2.AuxInt = int32ToAuxInt(64)
3096 v2.AddArg(y)
3097 v.AddArg3(v0, v1, v2)
3098 return true
3099 }
3100 }
3101 func rewriteValueS390X_OpLsh64x8(v *Value) bool {
3102 v_1 := v.Args[1]
3103 v_0 := v.Args[0]
3104 b := v.Block
3105 typ := &b.Func.Config.Types
3106 // match: (Lsh64x8 x y)
3107 // cond: shiftIsBounded(v)
3108 // result: (SLD x y)
3109 for {
3110 x := v_0
3111 y := v_1
3112 if !(shiftIsBounded(v)) {
3113 break
3114 }
3115 v.reset(OpS390XSLD)
3116 v.AddArg2(x, y)
3117 return true
3118 }
3119 // match: (Lsh64x8 <t> x y)
3120 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
3121 for {
3122 t := v.Type
3123 x := v_0
3124 y := v_1
3125 v.reset(OpS390XLOCGR)
3126 v.Type = t
3127 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3128 v0 := b.NewValue0(v.Pos, OpS390XSLD, t)
3129 v0.AddArg2(x, y)
3130 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3131 v1.AuxInt = int64ToAuxInt(0)
3132 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3133 v2.AuxInt = int32ToAuxInt(64)
3134 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
3135 v3.AddArg(y)
3136 v2.AddArg(v3)
3137 v.AddArg3(v0, v1, v2)
3138 return true
3139 }
3140 }
3141 func rewriteValueS390X_OpLsh8x16(v *Value) bool {
3142 v_1 := v.Args[1]
3143 v_0 := v.Args[0]
3144 b := v.Block
3145 typ := &b.Func.Config.Types
3146 // match: (Lsh8x16 x y)
3147 // cond: shiftIsBounded(v)
3148 // result: (SLW x y)
3149 for {
3150 x := v_0
3151 y := v_1
3152 if !(shiftIsBounded(v)) {
3153 break
3154 }
3155 v.reset(OpS390XSLW)
3156 v.AddArg2(x, y)
3157 return true
3158 }
3159 // match: (Lsh8x16 <t> x y)
3160 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
3161 for {
3162 t := v.Type
3163 x := v_0
3164 y := v_1
3165 v.reset(OpS390XLOCGR)
3166 v.Type = t
3167 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3168 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
3169 v0.AddArg2(x, y)
3170 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3171 v1.AuxInt = int64ToAuxInt(0)
3172 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3173 v2.AuxInt = int32ToAuxInt(64)
3174 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
3175 v3.AddArg(y)
3176 v2.AddArg(v3)
3177 v.AddArg3(v0, v1, v2)
3178 return true
3179 }
3180 }
3181 func rewriteValueS390X_OpLsh8x32(v *Value) bool {
3182 v_1 := v.Args[1]
3183 v_0 := v.Args[0]
3184 b := v.Block
3185 typ := &b.Func.Config.Types
3186 // match: (Lsh8x32 x y)
3187 // cond: shiftIsBounded(v)
3188 // result: (SLW x y)
3189 for {
3190 x := v_0
3191 y := v_1
3192 if !(shiftIsBounded(v)) {
3193 break
3194 }
3195 v.reset(OpS390XSLW)
3196 v.AddArg2(x, y)
3197 return true
3198 }
3199 // match: (Lsh8x32 <t> x y)
3200 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
3201 for {
3202 t := v.Type
3203 x := v_0
3204 y := v_1
3205 v.reset(OpS390XLOCGR)
3206 v.Type = t
3207 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3208 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
3209 v0.AddArg2(x, y)
3210 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3211 v1.AuxInt = int64ToAuxInt(0)
3212 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3213 v2.AuxInt = int32ToAuxInt(64)
3214 v2.AddArg(y)
3215 v.AddArg3(v0, v1, v2)
3216 return true
3217 }
3218 }
3219 func rewriteValueS390X_OpLsh8x64(v *Value) bool {
3220 v_1 := v.Args[1]
3221 v_0 := v.Args[0]
3222 b := v.Block
3223 typ := &b.Func.Config.Types
3224 // match: (Lsh8x64 x y)
3225 // cond: shiftIsBounded(v)
3226 // result: (SLW x y)
3227 for {
3228 x := v_0
3229 y := v_1
3230 if !(shiftIsBounded(v)) {
3231 break
3232 }
3233 v.reset(OpS390XSLW)
3234 v.AddArg2(x, y)
3235 return true
3236 }
3237 // match: (Lsh8x64 <t> x y)
3238 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
3239 for {
3240 t := v.Type
3241 x := v_0
3242 y := v_1
3243 v.reset(OpS390XLOCGR)
3244 v.Type = t
3245 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3246 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
3247 v0.AddArg2(x, y)
3248 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3249 v1.AuxInt = int64ToAuxInt(0)
3250 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
3251 v2.AuxInt = int32ToAuxInt(64)
3252 v2.AddArg(y)
3253 v.AddArg3(v0, v1, v2)
3254 return true
3255 }
3256 }
3257 func rewriteValueS390X_OpLsh8x8(v *Value) bool {
3258 v_1 := v.Args[1]
3259 v_0 := v.Args[0]
3260 b := v.Block
3261 typ := &b.Func.Config.Types
3262 // match: (Lsh8x8 x y)
3263 // cond: shiftIsBounded(v)
3264 // result: (SLW x y)
3265 for {
3266 x := v_0
3267 y := v_1
3268 if !(shiftIsBounded(v)) {
3269 break
3270 }
3271 v.reset(OpS390XSLW)
3272 v.AddArg2(x, y)
3273 return true
3274 }
3275 // match: (Lsh8x8 <t> x y)
3276 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
3277 for {
3278 t := v.Type
3279 x := v_0
3280 y := v_1
3281 v.reset(OpS390XLOCGR)
3282 v.Type = t
3283 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3284 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
3285 v0.AddArg2(x, y)
3286 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3287 v1.AuxInt = int64ToAuxInt(0)
3288 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3289 v2.AuxInt = int32ToAuxInt(64)
3290 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
3291 v3.AddArg(y)
3292 v2.AddArg(v3)
3293 v.AddArg3(v0, v1, v2)
3294 return true
3295 }
3296 }
3297 func rewriteValueS390X_OpMod16(v *Value) bool {
3298 v_1 := v.Args[1]
3299 v_0 := v.Args[0]
3300 b := v.Block
3301 typ := &b.Func.Config.Types
3302 // match: (Mod16 x y)
3303 // result: (MODW (MOVHreg x) (MOVHreg y))
3304 for {
3305 x := v_0
3306 y := v_1
3307 v.reset(OpS390XMODW)
3308 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
3309 v0.AddArg(x)
3310 v1 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
3311 v1.AddArg(y)
3312 v.AddArg2(v0, v1)
3313 return true
3314 }
3315 }
3316 func rewriteValueS390X_OpMod16u(v *Value) bool {
3317 v_1 := v.Args[1]
3318 v_0 := v.Args[0]
3319 b := v.Block
3320 typ := &b.Func.Config.Types
3321 // match: (Mod16u x y)
3322 // result: (MODWU (MOVHZreg x) (MOVHZreg y))
3323 for {
3324 x := v_0
3325 y := v_1
3326 v.reset(OpS390XMODWU)
3327 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
3328 v0.AddArg(x)
3329 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
3330 v1.AddArg(y)
3331 v.AddArg2(v0, v1)
3332 return true
3333 }
3334 }
3335 func rewriteValueS390X_OpMod32(v *Value) bool {
3336 v_1 := v.Args[1]
3337 v_0 := v.Args[0]
3338 b := v.Block
3339 typ := &b.Func.Config.Types
3340 // match: (Mod32 x y)
3341 // result: (MODW (MOVWreg x) y)
3342 for {
3343 x := v_0
3344 y := v_1
3345 v.reset(OpS390XMODW)
3346 v0 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64)
3347 v0.AddArg(x)
3348 v.AddArg2(v0, y)
3349 return true
3350 }
3351 }
3352 func rewriteValueS390X_OpMod32u(v *Value) bool {
3353 v_1 := v.Args[1]
3354 v_0 := v.Args[0]
3355 b := v.Block
3356 typ := &b.Func.Config.Types
3357 // match: (Mod32u x y)
3358 // result: (MODWU (MOVWZreg x) y)
3359 for {
3360 x := v_0
3361 y := v_1
3362 v.reset(OpS390XMODWU)
3363 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
3364 v0.AddArg(x)
3365 v.AddArg2(v0, y)
3366 return true
3367 }
3368 }
3369 func rewriteValueS390X_OpMod64(v *Value) bool {
3370 v_1 := v.Args[1]
3371 v_0 := v.Args[0]
3372 // match: (Mod64 x y)
3373 // result: (MODD x y)
3374 for {
3375 x := v_0
3376 y := v_1
3377 v.reset(OpS390XMODD)
3378 v.AddArg2(x, y)
3379 return true
3380 }
3381 }
3382 func rewriteValueS390X_OpMod8(v *Value) bool {
3383 v_1 := v.Args[1]
3384 v_0 := v.Args[0]
3385 b := v.Block
3386 typ := &b.Func.Config.Types
3387 // match: (Mod8 x y)
3388 // result: (MODW (MOVBreg x) (MOVBreg y))
3389 for {
3390 x := v_0
3391 y := v_1
3392 v.reset(OpS390XMODW)
3393 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3394 v0.AddArg(x)
3395 v1 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3396 v1.AddArg(y)
3397 v.AddArg2(v0, v1)
3398 return true
3399 }
3400 }
3401 func rewriteValueS390X_OpMod8u(v *Value) bool {
3402 v_1 := v.Args[1]
3403 v_0 := v.Args[0]
3404 b := v.Block
3405 typ := &b.Func.Config.Types
3406 // match: (Mod8u x y)
3407 // result: (MODWU (MOVBZreg x) (MOVBZreg y))
3408 for {
3409 x := v_0
3410 y := v_1
3411 v.reset(OpS390XMODWU)
3412 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
3413 v0.AddArg(x)
3414 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
3415 v1.AddArg(y)
3416 v.AddArg2(v0, v1)
3417 return true
3418 }
3419 }
3420 func rewriteValueS390X_OpMove(v *Value) bool {
3421 v_2 := v.Args[2]
3422 v_1 := v.Args[1]
3423 v_0 := v.Args[0]
3424 b := v.Block
3425 typ := &b.Func.Config.Types
3426 // match: (Move [0] _ _ mem)
3427 // result: mem
3428 for {
3429 if auxIntToInt64(v.AuxInt) != 0 {
3430 break
3431 }
3432 mem := v_2
3433 v.copyOf(mem)
3434 return true
3435 }
3436 // match: (Move [1] dst src mem)
3437 // result: (MOVBstore dst (MOVBZload src mem) mem)
3438 for {
3439 if auxIntToInt64(v.AuxInt) != 1 {
3440 break
3441 }
3442 dst := v_0
3443 src := v_1
3444 mem := v_2
3445 v.reset(OpS390XMOVBstore)
3446 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8)
3447 v0.AddArg2(src, mem)
3448 v.AddArg3(dst, v0, mem)
3449 return true
3450 }
3451 // match: (Move [2] dst src mem)
3452 // result: (MOVHstore dst (MOVHZload src mem) mem)
3453 for {
3454 if auxIntToInt64(v.AuxInt) != 2 {
3455 break
3456 }
3457 dst := v_0
3458 src := v_1
3459 mem := v_2
3460 v.reset(OpS390XMOVHstore)
3461 v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
3462 v0.AddArg2(src, mem)
3463 v.AddArg3(dst, v0, mem)
3464 return true
3465 }
3466 // match: (Move [4] dst src mem)
3467 // result: (MOVWstore dst (MOVWZload src mem) mem)
3468 for {
3469 if auxIntToInt64(v.AuxInt) != 4 {
3470 break
3471 }
3472 dst := v_0
3473 src := v_1
3474 mem := v_2
3475 v.reset(OpS390XMOVWstore)
3476 v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
3477 v0.AddArg2(src, mem)
3478 v.AddArg3(dst, v0, mem)
3479 return true
3480 }
3481 // match: (Move [8] dst src mem)
3482 // result: (MOVDstore dst (MOVDload src mem) mem)
3483 for {
3484 if auxIntToInt64(v.AuxInt) != 8 {
3485 break
3486 }
3487 dst := v_0
3488 src := v_1
3489 mem := v_2
3490 v.reset(OpS390XMOVDstore)
3491 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3492 v0.AddArg2(src, mem)
3493 v.AddArg3(dst, v0, mem)
3494 return true
3495 }
3496 // match: (Move [16] dst src mem)
3497 // result: (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem))
3498 for {
3499 if auxIntToInt64(v.AuxInt) != 16 {
3500 break
3501 }
3502 dst := v_0
3503 src := v_1
3504 mem := v_2
3505 v.reset(OpS390XMOVDstore)
3506 v.AuxInt = int32ToAuxInt(8)
3507 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3508 v0.AuxInt = int32ToAuxInt(8)
3509 v0.AddArg2(src, mem)
3510 v1 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem)
3511 v2 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3512 v2.AddArg2(src, mem)
3513 v1.AddArg3(dst, v2, mem)
3514 v.AddArg3(dst, v0, v1)
3515 return true
3516 }
3517 // match: (Move [24] dst src mem)
3518 // result: (MOVDstore [16] dst (MOVDload [16] src mem) (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem)))
3519 for {
3520 if auxIntToInt64(v.AuxInt) != 24 {
3521 break
3522 }
3523 dst := v_0
3524 src := v_1
3525 mem := v_2
3526 v.reset(OpS390XMOVDstore)
3527 v.AuxInt = int32ToAuxInt(16)
3528 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3529 v0.AuxInt = int32ToAuxInt(16)
3530 v0.AddArg2(src, mem)
3531 v1 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem)
3532 v1.AuxInt = int32ToAuxInt(8)
3533 v2 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3534 v2.AuxInt = int32ToAuxInt(8)
3535 v2.AddArg2(src, mem)
3536 v3 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem)
3537 v4 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3538 v4.AddArg2(src, mem)
3539 v3.AddArg3(dst, v4, mem)
3540 v1.AddArg3(dst, v2, v3)
3541 v.AddArg3(dst, v0, v1)
3542 return true
3543 }
3544 // match: (Move [3] dst src mem)
3545 // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHZload src mem) mem))
3546 for {
3547 if auxIntToInt64(v.AuxInt) != 3 {
3548 break
3549 }
3550 dst := v_0
3551 src := v_1
3552 mem := v_2
3553 v.reset(OpS390XMOVBstore)
3554 v.AuxInt = int32ToAuxInt(2)
3555 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8)
3556 v0.AuxInt = int32ToAuxInt(2)
3557 v0.AddArg2(src, mem)
3558 v1 := b.NewValue0(v.Pos, OpS390XMOVHstore, types.TypeMem)
3559 v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
3560 v2.AddArg2(src, mem)
3561 v1.AddArg3(dst, v2, mem)
3562 v.AddArg3(dst, v0, v1)
3563 return true
3564 }
3565 // match: (Move [5] dst src mem)
3566 // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3567 for {
3568 if auxIntToInt64(v.AuxInt) != 5 {
3569 break
3570 }
3571 dst := v_0
3572 src := v_1
3573 mem := v_2
3574 v.reset(OpS390XMOVBstore)
3575 v.AuxInt = int32ToAuxInt(4)
3576 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8)
3577 v0.AuxInt = int32ToAuxInt(4)
3578 v0.AddArg2(src, mem)
3579 v1 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem)
3580 v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
3581 v2.AddArg2(src, mem)
3582 v1.AddArg3(dst, v2, mem)
3583 v.AddArg3(dst, v0, v1)
3584 return true
3585 }
3586 // match: (Move [6] dst src mem)
3587 // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3588 for {
3589 if auxIntToInt64(v.AuxInt) != 6 {
3590 break
3591 }
3592 dst := v_0
3593 src := v_1
3594 mem := v_2
3595 v.reset(OpS390XMOVHstore)
3596 v.AuxInt = int32ToAuxInt(4)
3597 v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
3598 v0.AuxInt = int32ToAuxInt(4)
3599 v0.AddArg2(src, mem)
3600 v1 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem)
3601 v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
3602 v2.AddArg2(src, mem)
3603 v1.AddArg3(dst, v2, mem)
3604 v.AddArg3(dst, v0, v1)
3605 return true
3606 }
3607 // match: (Move [7] dst src mem)
3608 // result: (MOVBstore [6] dst (MOVBZload [6] src mem) (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)))
3609 for {
3610 if auxIntToInt64(v.AuxInt) != 7 {
3611 break
3612 }
3613 dst := v_0
3614 src := v_1
3615 mem := v_2
3616 v.reset(OpS390XMOVBstore)
3617 v.AuxInt = int32ToAuxInt(6)
3618 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8)
3619 v0.AuxInt = int32ToAuxInt(6)
3620 v0.AddArg2(src, mem)
3621 v1 := b.NewValue0(v.Pos, OpS390XMOVHstore, types.TypeMem)
3622 v1.AuxInt = int32ToAuxInt(4)
3623 v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
3624 v2.AuxInt = int32ToAuxInt(4)
3625 v2.AddArg2(src, mem)
3626 v3 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem)
3627 v4 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
3628 v4.AddArg2(src, mem)
3629 v3.AddArg3(dst, v4, mem)
3630 v1.AddArg3(dst, v2, v3)
3631 v.AddArg3(dst, v0, v1)
3632 return true
3633 }
3634 // match: (Move [s] dst src mem)
3635 // cond: s > 0 && s <= 256 && logLargeCopy(v, s)
3636 // result: (MVC [makeValAndOff(int32(s), 0)] dst src mem)
3637 for {
3638 s := auxIntToInt64(v.AuxInt)
3639 dst := v_0
3640 src := v_1
3641 mem := v_2
3642 if !(s > 0 && s <= 256 && logLargeCopy(v, s)) {
3643 break
3644 }
3645 v.reset(OpS390XMVC)
3646 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s), 0))
3647 v.AddArg3(dst, src, mem)
3648 return true
3649 }
3650 // match: (Move [s] dst src mem)
3651 // cond: s > 256 && s <= 512 && logLargeCopy(v, s)
3652 // result: (MVC [makeValAndOff(int32(s)-256, 256)] dst src (MVC [makeValAndOff(256, 0)] dst src mem))
3653 for {
3654 s := auxIntToInt64(v.AuxInt)
3655 dst := v_0
3656 src := v_1
3657 mem := v_2
3658 if !(s > 256 && s <= 512 && logLargeCopy(v, s)) {
3659 break
3660 }
3661 v.reset(OpS390XMVC)
3662 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-256, 256))
3663 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3664 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0))
3665 v0.AddArg3(dst, src, mem)
3666 v.AddArg3(dst, src, v0)
3667 return true
3668 }
3669 // match: (Move [s] dst src mem)
3670 // cond: s > 512 && s <= 768 && logLargeCopy(v, s)
3671 // result: (MVC [makeValAndOff(int32(s)-512, 512)] dst src (MVC [makeValAndOff(256, 256)] dst src (MVC [makeValAndOff(256, 0)] dst src mem)))
3672 for {
3673 s := auxIntToInt64(v.AuxInt)
3674 dst := v_0
3675 src := v_1
3676 mem := v_2
3677 if !(s > 512 && s <= 768 && logLargeCopy(v, s)) {
3678 break
3679 }
3680 v.reset(OpS390XMVC)
3681 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-512, 512))
3682 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3683 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 256))
3684 v1 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3685 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0))
3686 v1.AddArg3(dst, src, mem)
3687 v0.AddArg3(dst, src, v1)
3688 v.AddArg3(dst, src, v0)
3689 return true
3690 }
3691 // match: (Move [s] dst src mem)
3692 // cond: s > 768 && s <= 1024 && logLargeCopy(v, s)
3693 // result: (MVC [makeValAndOff(int32(s)-768, 768)] dst src (MVC [makeValAndOff(256, 512)] dst src (MVC [makeValAndOff(256, 256)] dst src (MVC [makeValAndOff(256, 0)] dst src mem))))
3694 for {
3695 s := auxIntToInt64(v.AuxInt)
3696 dst := v_0
3697 src := v_1
3698 mem := v_2
3699 if !(s > 768 && s <= 1024 && logLargeCopy(v, s)) {
3700 break
3701 }
3702 v.reset(OpS390XMVC)
3703 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-768, 768))
3704 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3705 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 512))
3706 v1 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3707 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 256))
3708 v2 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3709 v2.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0))
3710 v2.AddArg3(dst, src, mem)
3711 v1.AddArg3(dst, src, v2)
3712 v0.AddArg3(dst, src, v1)
3713 v.AddArg3(dst, src, v0)
3714 return true
3715 }
3716 // match: (Move [s] dst src mem)
3717 // cond: s > 1024 && logLargeCopy(v, s)
3718 // result: (LoweredMove [s%256] dst src (ADD <src.Type> src (MOVDconst [(s/256)*256])) mem)
3719 for {
3720 s := auxIntToInt64(v.AuxInt)
3721 dst := v_0
3722 src := v_1
3723 mem := v_2
3724 if !(s > 1024 && logLargeCopy(v, s)) {
3725 break
3726 }
3727 v.reset(OpS390XLoweredMove)
3728 v.AuxInt = int64ToAuxInt(s % 256)
3729 v0 := b.NewValue0(v.Pos, OpS390XADD, src.Type)
3730 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3731 v1.AuxInt = int64ToAuxInt((s / 256) * 256)
3732 v0.AddArg2(src, v1)
3733 v.AddArg4(dst, src, v0, mem)
3734 return true
3735 }
3736 return false
3737 }
3738 func rewriteValueS390X_OpNeq16(v *Value) bool {
3739 v_1 := v.Args[1]
3740 v_0 := v.Args[0]
3741 b := v.Block
3742 typ := &b.Func.Config.Types
3743 // match: (Neq16 x y)
3744 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y)))
3745 for {
3746 x := v_0
3747 y := v_1
3748 v.reset(OpS390XLOCGR)
3749 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3750 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3751 v0.AuxInt = int64ToAuxInt(0)
3752 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3753 v1.AuxInt = int64ToAuxInt(1)
3754 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
3755 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
3756 v3.AddArg(x)
3757 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
3758 v4.AddArg(y)
3759 v2.AddArg2(v3, v4)
3760 v.AddArg3(v0, v1, v2)
3761 return true
3762 }
3763 }
3764 func rewriteValueS390X_OpNeq32(v *Value) bool {
3765 v_1 := v.Args[1]
3766 v_0 := v.Args[0]
3767 b := v.Block
3768 typ := &b.Func.Config.Types
3769 // match: (Neq32 x y)
3770 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y))
3771 for {
3772 x := v_0
3773 y := v_1
3774 v.reset(OpS390XLOCGR)
3775 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3776 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3777 v0.AuxInt = int64ToAuxInt(0)
3778 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3779 v1.AuxInt = int64ToAuxInt(1)
3780 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
3781 v2.AddArg2(x, y)
3782 v.AddArg3(v0, v1, v2)
3783 return true
3784 }
3785 }
3786 func rewriteValueS390X_OpNeq32F(v *Value) bool {
3787 v_1 := v.Args[1]
3788 v_0 := v.Args[0]
3789 b := v.Block
3790 typ := &b.Func.Config.Types
3791 // match: (Neq32F x y)
3792 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y))
3793 for {
3794 x := v_0
3795 y := v_1
3796 v.reset(OpS390XLOCGR)
3797 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3798 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3799 v0.AuxInt = int64ToAuxInt(0)
3800 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3801 v1.AuxInt = int64ToAuxInt(1)
3802 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags)
3803 v2.AddArg2(x, y)
3804 v.AddArg3(v0, v1, v2)
3805 return true
3806 }
3807 }
3808 func rewriteValueS390X_OpNeq64(v *Value) bool {
3809 v_1 := v.Args[1]
3810 v_0 := v.Args[0]
3811 b := v.Block
3812 typ := &b.Func.Config.Types
3813 // match: (Neq64 x y)
3814 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
3815 for {
3816 x := v_0
3817 y := v_1
3818 v.reset(OpS390XLOCGR)
3819 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3820 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3821 v0.AuxInt = int64ToAuxInt(0)
3822 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3823 v1.AuxInt = int64ToAuxInt(1)
3824 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
3825 v2.AddArg2(x, y)
3826 v.AddArg3(v0, v1, v2)
3827 return true
3828 }
3829 }
3830 func rewriteValueS390X_OpNeq64F(v *Value) bool {
3831 v_1 := v.Args[1]
3832 v_0 := v.Args[0]
3833 b := v.Block
3834 typ := &b.Func.Config.Types
3835 // match: (Neq64F x y)
3836 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y))
3837 for {
3838 x := v_0
3839 y := v_1
3840 v.reset(OpS390XLOCGR)
3841 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3842 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3843 v0.AuxInt = int64ToAuxInt(0)
3844 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3845 v1.AuxInt = int64ToAuxInt(1)
3846 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags)
3847 v2.AddArg2(x, y)
3848 v.AddArg3(v0, v1, v2)
3849 return true
3850 }
3851 }
3852 func rewriteValueS390X_OpNeq8(v *Value) bool {
3853 v_1 := v.Args[1]
3854 v_0 := v.Args[0]
3855 b := v.Block
3856 typ := &b.Func.Config.Types
3857 // match: (Neq8 x y)
3858 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
3859 for {
3860 x := v_0
3861 y := v_1
3862 v.reset(OpS390XLOCGR)
3863 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3864 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3865 v0.AuxInt = int64ToAuxInt(0)
3866 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3867 v1.AuxInt = int64ToAuxInt(1)
3868 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
3869 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3870 v3.AddArg(x)
3871 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3872 v4.AddArg(y)
3873 v2.AddArg2(v3, v4)
3874 v.AddArg3(v0, v1, v2)
3875 return true
3876 }
3877 }
3878 func rewriteValueS390X_OpNeqB(v *Value) bool {
3879 v_1 := v.Args[1]
3880 v_0 := v.Args[0]
3881 b := v.Block
3882 typ := &b.Func.Config.Types
3883 // match: (NeqB x y)
3884 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
3885 for {
3886 x := v_0
3887 y := v_1
3888 v.reset(OpS390XLOCGR)
3889 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3890 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3891 v0.AuxInt = int64ToAuxInt(0)
3892 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3893 v1.AuxInt = int64ToAuxInt(1)
3894 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
3895 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3896 v3.AddArg(x)
3897 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3898 v4.AddArg(y)
3899 v2.AddArg2(v3, v4)
3900 v.AddArg3(v0, v1, v2)
3901 return true
3902 }
3903 }
3904 func rewriteValueS390X_OpNeqPtr(v *Value) bool {
3905 v_1 := v.Args[1]
3906 v_0 := v.Args[0]
3907 b := v.Block
3908 typ := &b.Func.Config.Types
3909 // match: (NeqPtr x y)
3910 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
3911 for {
3912 x := v_0
3913 y := v_1
3914 v.reset(OpS390XLOCGR)
3915 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3916 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3917 v0.AuxInt = int64ToAuxInt(0)
3918 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3919 v1.AuxInt = int64ToAuxInt(1)
3920 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
3921 v2.AddArg2(x, y)
3922 v.AddArg3(v0, v1, v2)
3923 return true
3924 }
3925 }
3926 func rewriteValueS390X_OpNot(v *Value) bool {
3927 v_0 := v.Args[0]
3928 // match: (Not x)
3929 // result: (XORWconst [1] x)
3930 for {
3931 x := v_0
3932 v.reset(OpS390XXORWconst)
3933 v.AuxInt = int32ToAuxInt(1)
3934 v.AddArg(x)
3935 return true
3936 }
3937 }
3938 func rewriteValueS390X_OpOffPtr(v *Value) bool {
3939 v_0 := v.Args[0]
3940 b := v.Block
3941 typ := &b.Func.Config.Types
3942 // match: (OffPtr [off] ptr:(SP))
3943 // result: (MOVDaddr [int32(off)] ptr)
3944 for {
3945 off := auxIntToInt64(v.AuxInt)
3946 ptr := v_0
3947 if ptr.Op != OpSP {
3948 break
3949 }
3950 v.reset(OpS390XMOVDaddr)
3951 v.AuxInt = int32ToAuxInt(int32(off))
3952 v.AddArg(ptr)
3953 return true
3954 }
3955 // match: (OffPtr [off] ptr)
3956 // cond: is32Bit(off)
3957 // result: (ADDconst [int32(off)] ptr)
3958 for {
3959 off := auxIntToInt64(v.AuxInt)
3960 ptr := v_0
3961 if !(is32Bit(off)) {
3962 break
3963 }
3964 v.reset(OpS390XADDconst)
3965 v.AuxInt = int32ToAuxInt(int32(off))
3966 v.AddArg(ptr)
3967 return true
3968 }
3969 // match: (OffPtr [off] ptr)
3970 // result: (ADD (MOVDconst [off]) ptr)
3971 for {
3972 off := auxIntToInt64(v.AuxInt)
3973 ptr := v_0
3974 v.reset(OpS390XADD)
3975 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3976 v0.AuxInt = int64ToAuxInt(off)
3977 v.AddArg2(v0, ptr)
3978 return true
3979 }
3980 }
3981 func rewriteValueS390X_OpPopCount16(v *Value) bool {
3982 v_0 := v.Args[0]
3983 b := v.Block
3984 typ := &b.Func.Config.Types
3985 // match: (PopCount16 x)
3986 // result: (MOVBZreg (SumBytes2 (POPCNT <typ.UInt16> x)))
3987 for {
3988 x := v_0
3989 v.reset(OpS390XMOVBZreg)
3990 v0 := b.NewValue0(v.Pos, OpS390XSumBytes2, typ.UInt8)
3991 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt16)
3992 v1.AddArg(x)
3993 v0.AddArg(v1)
3994 v.AddArg(v0)
3995 return true
3996 }
3997 }
3998 func rewriteValueS390X_OpPopCount32(v *Value) bool {
3999 v_0 := v.Args[0]
4000 b := v.Block
4001 typ := &b.Func.Config.Types
4002 // match: (PopCount32 x)
4003 // result: (MOVBZreg (SumBytes4 (POPCNT <typ.UInt32> x)))
4004 for {
4005 x := v_0
4006 v.reset(OpS390XMOVBZreg)
4007 v0 := b.NewValue0(v.Pos, OpS390XSumBytes4, typ.UInt8)
4008 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt32)
4009 v1.AddArg(x)
4010 v0.AddArg(v1)
4011 v.AddArg(v0)
4012 return true
4013 }
4014 }
4015 func rewriteValueS390X_OpPopCount64(v *Value) bool {
4016 v_0 := v.Args[0]
4017 b := v.Block
4018 typ := &b.Func.Config.Types
4019 // match: (PopCount64 x)
4020 // result: (MOVBZreg (SumBytes8 (POPCNT <typ.UInt64> x)))
4021 for {
4022 x := v_0
4023 v.reset(OpS390XMOVBZreg)
4024 v0 := b.NewValue0(v.Pos, OpS390XSumBytes8, typ.UInt8)
4025 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt64)
4026 v1.AddArg(x)
4027 v0.AddArg(v1)
4028 v.AddArg(v0)
4029 return true
4030 }
4031 }
4032 func rewriteValueS390X_OpPopCount8(v *Value) bool {
4033 v_0 := v.Args[0]
4034 b := v.Block
4035 typ := &b.Func.Config.Types
4036 // match: (PopCount8 x)
4037 // result: (POPCNT (MOVBZreg x))
4038 for {
4039 x := v_0
4040 v.reset(OpS390XPOPCNT)
4041 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4042 v0.AddArg(x)
4043 v.AddArg(v0)
4044 return true
4045 }
4046 }
4047 func rewriteValueS390X_OpRotateLeft16(v *Value) bool {
4048 v_1 := v.Args[1]
4049 v_0 := v.Args[0]
4050 b := v.Block
4051 typ := &b.Func.Config.Types
4052 // match: (RotateLeft16 <t> x (MOVDconst [c]))
4053 // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15])))
4054 for {
4055 t := v.Type
4056 x := v_0
4057 if v_1.Op != OpS390XMOVDconst {
4058 break
4059 }
4060 c := auxIntToInt64(v_1.AuxInt)
4061 v.reset(OpOr16)
4062 v0 := b.NewValue0(v.Pos, OpLsh16x64, t)
4063 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4064 v1.AuxInt = int64ToAuxInt(c & 15)
4065 v0.AddArg2(x, v1)
4066 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t)
4067 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4068 v3.AuxInt = int64ToAuxInt(-c & 15)
4069 v2.AddArg2(x, v3)
4070 v.AddArg2(v0, v2)
4071 return true
4072 }
4073 return false
4074 }
4075 func rewriteValueS390X_OpRotateLeft8(v *Value) bool {
4076 v_1 := v.Args[1]
4077 v_0 := v.Args[0]
4078 b := v.Block
4079 typ := &b.Func.Config.Types
4080 // match: (RotateLeft8 <t> x (MOVDconst [c]))
4081 // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7])))
4082 for {
4083 t := v.Type
4084 x := v_0
4085 if v_1.Op != OpS390XMOVDconst {
4086 break
4087 }
4088 c := auxIntToInt64(v_1.AuxInt)
4089 v.reset(OpOr8)
4090 v0 := b.NewValue0(v.Pos, OpLsh8x64, t)
4091 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4092 v1.AuxInt = int64ToAuxInt(c & 7)
4093 v0.AddArg2(x, v1)
4094 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t)
4095 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4096 v3.AuxInt = int64ToAuxInt(-c & 7)
4097 v2.AddArg2(x, v3)
4098 v.AddArg2(v0, v2)
4099 return true
4100 }
4101 return false
4102 }
4103 func rewriteValueS390X_OpRound(v *Value) bool {
4104 v_0 := v.Args[0]
4105 // match: (Round x)
4106 // result: (FIDBR [1] x)
4107 for {
4108 x := v_0
4109 v.reset(OpS390XFIDBR)
4110 v.AuxInt = int8ToAuxInt(1)
4111 v.AddArg(x)
4112 return true
4113 }
4114 }
4115 func rewriteValueS390X_OpRoundToEven(v *Value) bool {
4116 v_0 := v.Args[0]
4117 // match: (RoundToEven x)
4118 // result: (FIDBR [4] x)
4119 for {
4120 x := v_0
4121 v.reset(OpS390XFIDBR)
4122 v.AuxInt = int8ToAuxInt(4)
4123 v.AddArg(x)
4124 return true
4125 }
4126 }
4127 func rewriteValueS390X_OpRsh16Ux16(v *Value) bool {
4128 v_1 := v.Args[1]
4129 v_0 := v.Args[0]
4130 b := v.Block
4131 typ := &b.Func.Config.Types
4132 // match: (Rsh16Ux16 x y)
4133 // cond: shiftIsBounded(v)
4134 // result: (SRW (MOVHZreg x) y)
4135 for {
4136 x := v_0
4137 y := v_1
4138 if !(shiftIsBounded(v)) {
4139 break
4140 }
4141 v.reset(OpS390XSRW)
4142 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4143 v0.AddArg(x)
4144 v.AddArg2(v0, y)
4145 return true
4146 }
4147 // match: (Rsh16Ux16 <t> x y)
4148 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
4149 for {
4150 t := v.Type
4151 x := v_0
4152 y := v_1
4153 v.reset(OpS390XLOCGR)
4154 v.Type = t
4155 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4156 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4157 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4158 v1.AddArg(x)
4159 v0.AddArg2(v1, y)
4160 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4161 v2.AuxInt = int64ToAuxInt(0)
4162 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4163 v3.AuxInt = int32ToAuxInt(64)
4164 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4165 v4.AddArg(y)
4166 v3.AddArg(v4)
4167 v.AddArg3(v0, v2, v3)
4168 return true
4169 }
4170 }
4171 func rewriteValueS390X_OpRsh16Ux32(v *Value) bool {
4172 v_1 := v.Args[1]
4173 v_0 := v.Args[0]
4174 b := v.Block
4175 typ := &b.Func.Config.Types
4176 // match: (Rsh16Ux32 x y)
4177 // cond: shiftIsBounded(v)
4178 // result: (SRW (MOVHZreg x) y)
4179 for {
4180 x := v_0
4181 y := v_1
4182 if !(shiftIsBounded(v)) {
4183 break
4184 }
4185 v.reset(OpS390XSRW)
4186 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4187 v0.AddArg(x)
4188 v.AddArg2(v0, y)
4189 return true
4190 }
4191 // match: (Rsh16Ux32 <t> x y)
4192 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [64]))
4193 for {
4194 t := v.Type
4195 x := v_0
4196 y := v_1
4197 v.reset(OpS390XLOCGR)
4198 v.Type = t
4199 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4200 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4201 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4202 v1.AddArg(x)
4203 v0.AddArg2(v1, y)
4204 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4205 v2.AuxInt = int64ToAuxInt(0)
4206 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4207 v3.AuxInt = int32ToAuxInt(64)
4208 v3.AddArg(y)
4209 v.AddArg3(v0, v2, v3)
4210 return true
4211 }
4212 }
4213 func rewriteValueS390X_OpRsh16Ux64(v *Value) bool {
4214 v_1 := v.Args[1]
4215 v_0 := v.Args[0]
4216 b := v.Block
4217 typ := &b.Func.Config.Types
4218 // match: (Rsh16Ux64 x y)
4219 // cond: shiftIsBounded(v)
4220 // result: (SRW (MOVHZreg x) y)
4221 for {
4222 x := v_0
4223 y := v_1
4224 if !(shiftIsBounded(v)) {
4225 break
4226 }
4227 v.reset(OpS390XSRW)
4228 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4229 v0.AddArg(x)
4230 v.AddArg2(v0, y)
4231 return true
4232 }
4233 // match: (Rsh16Ux64 <t> x y)
4234 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [64]))
4235 for {
4236 t := v.Type
4237 x := v_0
4238 y := v_1
4239 v.reset(OpS390XLOCGR)
4240 v.Type = t
4241 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4242 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4243 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4244 v1.AddArg(x)
4245 v0.AddArg2(v1, y)
4246 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4247 v2.AuxInt = int64ToAuxInt(0)
4248 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4249 v3.AuxInt = int32ToAuxInt(64)
4250 v3.AddArg(y)
4251 v.AddArg3(v0, v2, v3)
4252 return true
4253 }
4254 }
4255 func rewriteValueS390X_OpRsh16Ux8(v *Value) bool {
4256 v_1 := v.Args[1]
4257 v_0 := v.Args[0]
4258 b := v.Block
4259 typ := &b.Func.Config.Types
4260 // match: (Rsh16Ux8 x y)
4261 // cond: shiftIsBounded(v)
4262 // result: (SRW (MOVHZreg x) y)
4263 for {
4264 x := v_0
4265 y := v_1
4266 if !(shiftIsBounded(v)) {
4267 break
4268 }
4269 v.reset(OpS390XSRW)
4270 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4271 v0.AddArg(x)
4272 v.AddArg2(v0, y)
4273 return true
4274 }
4275 // match: (Rsh16Ux8 <t> x y)
4276 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
4277 for {
4278 t := v.Type
4279 x := v_0
4280 y := v_1
4281 v.reset(OpS390XLOCGR)
4282 v.Type = t
4283 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4284 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4285 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4286 v1.AddArg(x)
4287 v0.AddArg2(v1, y)
4288 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4289 v2.AuxInt = int64ToAuxInt(0)
4290 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4291 v3.AuxInt = int32ToAuxInt(64)
4292 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4293 v4.AddArg(y)
4294 v3.AddArg(v4)
4295 v.AddArg3(v0, v2, v3)
4296 return true
4297 }
4298 }
4299 func rewriteValueS390X_OpRsh16x16(v *Value) bool {
4300 v_1 := v.Args[1]
4301 v_0 := v.Args[0]
4302 b := v.Block
4303 typ := &b.Func.Config.Types
4304 // match: (Rsh16x16 x y)
4305 // cond: shiftIsBounded(v)
4306 // result: (SRAW (MOVHreg x) y)
4307 for {
4308 x := v_0
4309 y := v_1
4310 if !(shiftIsBounded(v)) {
4311 break
4312 }
4313 v.reset(OpS390XSRAW)
4314 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4315 v0.AddArg(x)
4316 v.AddArg2(v0, y)
4317 return true
4318 }
4319 // match: (Rsh16x16 x y)
4320 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64])))
4321 for {
4322 x := v_0
4323 y := v_1
4324 v.reset(OpS390XSRAW)
4325 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4326 v0.AddArg(x)
4327 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4328 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4329 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4330 v2.AuxInt = int64ToAuxInt(63)
4331 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4332 v3.AuxInt = int32ToAuxInt(64)
4333 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4334 v4.AddArg(y)
4335 v3.AddArg(v4)
4336 v1.AddArg3(y, v2, v3)
4337 v.AddArg2(v0, v1)
4338 return true
4339 }
4340 }
4341 func rewriteValueS390X_OpRsh16x32(v *Value) bool {
4342 v_1 := v.Args[1]
4343 v_0 := v.Args[0]
4344 b := v.Block
4345 typ := &b.Func.Config.Types
4346 // match: (Rsh16x32 x y)
4347 // cond: shiftIsBounded(v)
4348 // result: (SRAW (MOVHreg x) y)
4349 for {
4350 x := v_0
4351 y := v_1
4352 if !(shiftIsBounded(v)) {
4353 break
4354 }
4355 v.reset(OpS390XSRAW)
4356 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4357 v0.AddArg(x)
4358 v.AddArg2(v0, y)
4359 return true
4360 }
4361 // match: (Rsh16x32 x y)
4362 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64])))
4363 for {
4364 x := v_0
4365 y := v_1
4366 v.reset(OpS390XSRAW)
4367 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4368 v0.AddArg(x)
4369 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4370 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4371 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4372 v2.AuxInt = int64ToAuxInt(63)
4373 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4374 v3.AuxInt = int32ToAuxInt(64)
4375 v3.AddArg(y)
4376 v1.AddArg3(y, v2, v3)
4377 v.AddArg2(v0, v1)
4378 return true
4379 }
4380 }
4381 func rewriteValueS390X_OpRsh16x64(v *Value) bool {
4382 v_1 := v.Args[1]
4383 v_0 := v.Args[0]
4384 b := v.Block
4385 typ := &b.Func.Config.Types
4386 // match: (Rsh16x64 x y)
4387 // cond: shiftIsBounded(v)
4388 // result: (SRAW (MOVHreg x) y)
4389 for {
4390 x := v_0
4391 y := v_1
4392 if !(shiftIsBounded(v)) {
4393 break
4394 }
4395 v.reset(OpS390XSRAW)
4396 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4397 v0.AddArg(x)
4398 v.AddArg2(v0, y)
4399 return true
4400 }
4401 // match: (Rsh16x64 x y)
4402 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64])))
4403 for {
4404 x := v_0
4405 y := v_1
4406 v.reset(OpS390XSRAW)
4407 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4408 v0.AddArg(x)
4409 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4410 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4411 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4412 v2.AuxInt = int64ToAuxInt(63)
4413 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4414 v3.AuxInt = int32ToAuxInt(64)
4415 v3.AddArg(y)
4416 v1.AddArg3(y, v2, v3)
4417 v.AddArg2(v0, v1)
4418 return true
4419 }
4420 }
4421 func rewriteValueS390X_OpRsh16x8(v *Value) bool {
4422 v_1 := v.Args[1]
4423 v_0 := v.Args[0]
4424 b := v.Block
4425 typ := &b.Func.Config.Types
4426 // match: (Rsh16x8 x y)
4427 // cond: shiftIsBounded(v)
4428 // result: (SRAW (MOVHreg x) y)
4429 for {
4430 x := v_0
4431 y := v_1
4432 if !(shiftIsBounded(v)) {
4433 break
4434 }
4435 v.reset(OpS390XSRAW)
4436 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4437 v0.AddArg(x)
4438 v.AddArg2(v0, y)
4439 return true
4440 }
4441 // match: (Rsh16x8 x y)
4442 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64])))
4443 for {
4444 x := v_0
4445 y := v_1
4446 v.reset(OpS390XSRAW)
4447 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4448 v0.AddArg(x)
4449 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4450 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4451 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4452 v2.AuxInt = int64ToAuxInt(63)
4453 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4454 v3.AuxInt = int32ToAuxInt(64)
4455 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4456 v4.AddArg(y)
4457 v3.AddArg(v4)
4458 v1.AddArg3(y, v2, v3)
4459 v.AddArg2(v0, v1)
4460 return true
4461 }
4462 }
4463 func rewriteValueS390X_OpRsh32Ux16(v *Value) bool {
4464 v_1 := v.Args[1]
4465 v_0 := v.Args[0]
4466 b := v.Block
4467 typ := &b.Func.Config.Types
4468 // match: (Rsh32Ux16 x y)
4469 // cond: shiftIsBounded(v)
4470 // result: (SRW x y)
4471 for {
4472 x := v_0
4473 y := v_1
4474 if !(shiftIsBounded(v)) {
4475 break
4476 }
4477 v.reset(OpS390XSRW)
4478 v.AddArg2(x, y)
4479 return true
4480 }
4481 // match: (Rsh32Ux16 <t> x y)
4482 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
4483 for {
4484 t := v.Type
4485 x := v_0
4486 y := v_1
4487 v.reset(OpS390XLOCGR)
4488 v.Type = t
4489 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4490 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4491 v0.AddArg2(x, y)
4492 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4493 v1.AuxInt = int64ToAuxInt(0)
4494 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4495 v2.AuxInt = int32ToAuxInt(64)
4496 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4497 v3.AddArg(y)
4498 v2.AddArg(v3)
4499 v.AddArg3(v0, v1, v2)
4500 return true
4501 }
4502 }
4503 func rewriteValueS390X_OpRsh32Ux32(v *Value) bool {
4504 v_1 := v.Args[1]
4505 v_0 := v.Args[0]
4506 b := v.Block
4507 typ := &b.Func.Config.Types
4508 // match: (Rsh32Ux32 x y)
4509 // cond: shiftIsBounded(v)
4510 // result: (SRW x y)
4511 for {
4512 x := v_0
4513 y := v_1
4514 if !(shiftIsBounded(v)) {
4515 break
4516 }
4517 v.reset(OpS390XSRW)
4518 v.AddArg2(x, y)
4519 return true
4520 }
4521 // match: (Rsh32Ux32 <t> x y)
4522 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
4523 for {
4524 t := v.Type
4525 x := v_0
4526 y := v_1
4527 v.reset(OpS390XLOCGR)
4528 v.Type = t
4529 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4530 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4531 v0.AddArg2(x, y)
4532 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4533 v1.AuxInt = int64ToAuxInt(0)
4534 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4535 v2.AuxInt = int32ToAuxInt(64)
4536 v2.AddArg(y)
4537 v.AddArg3(v0, v1, v2)
4538 return true
4539 }
4540 }
4541 func rewriteValueS390X_OpRsh32Ux64(v *Value) bool {
4542 v_1 := v.Args[1]
4543 v_0 := v.Args[0]
4544 b := v.Block
4545 typ := &b.Func.Config.Types
4546 // match: (Rsh32Ux64 x y)
4547 // cond: shiftIsBounded(v)
4548 // result: (SRW x y)
4549 for {
4550 x := v_0
4551 y := v_1
4552 if !(shiftIsBounded(v)) {
4553 break
4554 }
4555 v.reset(OpS390XSRW)
4556 v.AddArg2(x, y)
4557 return true
4558 }
4559 // match: (Rsh32Ux64 <t> x y)
4560 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
4561 for {
4562 t := v.Type
4563 x := v_0
4564 y := v_1
4565 v.reset(OpS390XLOCGR)
4566 v.Type = t
4567 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4568 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4569 v0.AddArg2(x, y)
4570 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4571 v1.AuxInt = int64ToAuxInt(0)
4572 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4573 v2.AuxInt = int32ToAuxInt(64)
4574 v2.AddArg(y)
4575 v.AddArg3(v0, v1, v2)
4576 return true
4577 }
4578 }
4579 func rewriteValueS390X_OpRsh32Ux8(v *Value) bool {
4580 v_1 := v.Args[1]
4581 v_0 := v.Args[0]
4582 b := v.Block
4583 typ := &b.Func.Config.Types
4584 // match: (Rsh32Ux8 x y)
4585 // cond: shiftIsBounded(v)
4586 // result: (SRW x y)
4587 for {
4588 x := v_0
4589 y := v_1
4590 if !(shiftIsBounded(v)) {
4591 break
4592 }
4593 v.reset(OpS390XSRW)
4594 v.AddArg2(x, y)
4595 return true
4596 }
4597 // match: (Rsh32Ux8 <t> x y)
4598 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
4599 for {
4600 t := v.Type
4601 x := v_0
4602 y := v_1
4603 v.reset(OpS390XLOCGR)
4604 v.Type = t
4605 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4606 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4607 v0.AddArg2(x, y)
4608 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4609 v1.AuxInt = int64ToAuxInt(0)
4610 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4611 v2.AuxInt = int32ToAuxInt(64)
4612 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4613 v3.AddArg(y)
4614 v2.AddArg(v3)
4615 v.AddArg3(v0, v1, v2)
4616 return true
4617 }
4618 }
4619 func rewriteValueS390X_OpRsh32x16(v *Value) bool {
4620 v_1 := v.Args[1]
4621 v_0 := v.Args[0]
4622 b := v.Block
4623 typ := &b.Func.Config.Types
4624 // match: (Rsh32x16 x y)
4625 // cond: shiftIsBounded(v)
4626 // result: (SRAW x y)
4627 for {
4628 x := v_0
4629 y := v_1
4630 if !(shiftIsBounded(v)) {
4631 break
4632 }
4633 v.reset(OpS390XSRAW)
4634 v.AddArg2(x, y)
4635 return true
4636 }
4637 // match: (Rsh32x16 x y)
4638 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64])))
4639 for {
4640 x := v_0
4641 y := v_1
4642 v.reset(OpS390XSRAW)
4643 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4644 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4645 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4646 v1.AuxInt = int64ToAuxInt(63)
4647 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4648 v2.AuxInt = int32ToAuxInt(64)
4649 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4650 v3.AddArg(y)
4651 v2.AddArg(v3)
4652 v0.AddArg3(y, v1, v2)
4653 v.AddArg2(x, v0)
4654 return true
4655 }
4656 }
4657 func rewriteValueS390X_OpRsh32x32(v *Value) bool {
4658 v_1 := v.Args[1]
4659 v_0 := v.Args[0]
4660 b := v.Block
4661 // match: (Rsh32x32 x y)
4662 // cond: shiftIsBounded(v)
4663 // result: (SRAW x y)
4664 for {
4665 x := v_0
4666 y := v_1
4667 if !(shiftIsBounded(v)) {
4668 break
4669 }
4670 v.reset(OpS390XSRAW)
4671 v.AddArg2(x, y)
4672 return true
4673 }
4674 // match: (Rsh32x32 x y)
4675 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64])))
4676 for {
4677 x := v_0
4678 y := v_1
4679 v.reset(OpS390XSRAW)
4680 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4681 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4682 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4683 v1.AuxInt = int64ToAuxInt(63)
4684 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4685 v2.AuxInt = int32ToAuxInt(64)
4686 v2.AddArg(y)
4687 v0.AddArg3(y, v1, v2)
4688 v.AddArg2(x, v0)
4689 return true
4690 }
4691 }
4692 func rewriteValueS390X_OpRsh32x64(v *Value) bool {
4693 v_1 := v.Args[1]
4694 v_0 := v.Args[0]
4695 b := v.Block
4696 // match: (Rsh32x64 x y)
4697 // cond: shiftIsBounded(v)
4698 // result: (SRAW x y)
4699 for {
4700 x := v_0
4701 y := v_1
4702 if !(shiftIsBounded(v)) {
4703 break
4704 }
4705 v.reset(OpS390XSRAW)
4706 v.AddArg2(x, y)
4707 return true
4708 }
4709 // match: (Rsh32x64 x y)
4710 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64])))
4711 for {
4712 x := v_0
4713 y := v_1
4714 v.reset(OpS390XSRAW)
4715 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4716 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4717 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4718 v1.AuxInt = int64ToAuxInt(63)
4719 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4720 v2.AuxInt = int32ToAuxInt(64)
4721 v2.AddArg(y)
4722 v0.AddArg3(y, v1, v2)
4723 v.AddArg2(x, v0)
4724 return true
4725 }
4726 }
4727 func rewriteValueS390X_OpRsh32x8(v *Value) bool {
4728 v_1 := v.Args[1]
4729 v_0 := v.Args[0]
4730 b := v.Block
4731 typ := &b.Func.Config.Types
4732 // match: (Rsh32x8 x y)
4733 // cond: shiftIsBounded(v)
4734 // result: (SRAW x y)
4735 for {
4736 x := v_0
4737 y := v_1
4738 if !(shiftIsBounded(v)) {
4739 break
4740 }
4741 v.reset(OpS390XSRAW)
4742 v.AddArg2(x, y)
4743 return true
4744 }
4745 // match: (Rsh32x8 x y)
4746 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64])))
4747 for {
4748 x := v_0
4749 y := v_1
4750 v.reset(OpS390XSRAW)
4751 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4752 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4753 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4754 v1.AuxInt = int64ToAuxInt(63)
4755 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4756 v2.AuxInt = int32ToAuxInt(64)
4757 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4758 v3.AddArg(y)
4759 v2.AddArg(v3)
4760 v0.AddArg3(y, v1, v2)
4761 v.AddArg2(x, v0)
4762 return true
4763 }
4764 }
4765 func rewriteValueS390X_OpRsh64Ux16(v *Value) bool {
4766 v_1 := v.Args[1]
4767 v_0 := v.Args[0]
4768 b := v.Block
4769 typ := &b.Func.Config.Types
4770 // match: (Rsh64Ux16 x y)
4771 // cond: shiftIsBounded(v)
4772 // result: (SRD x y)
4773 for {
4774 x := v_0
4775 y := v_1
4776 if !(shiftIsBounded(v)) {
4777 break
4778 }
4779 v.reset(OpS390XSRD)
4780 v.AddArg2(x, y)
4781 return true
4782 }
4783 // match: (Rsh64Ux16 <t> x y)
4784 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
4785 for {
4786 t := v.Type
4787 x := v_0
4788 y := v_1
4789 v.reset(OpS390XLOCGR)
4790 v.Type = t
4791 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4792 v0 := b.NewValue0(v.Pos, OpS390XSRD, t)
4793 v0.AddArg2(x, y)
4794 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4795 v1.AuxInt = int64ToAuxInt(0)
4796 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4797 v2.AuxInt = int32ToAuxInt(64)
4798 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4799 v3.AddArg(y)
4800 v2.AddArg(v3)
4801 v.AddArg3(v0, v1, v2)
4802 return true
4803 }
4804 }
4805 func rewriteValueS390X_OpRsh64Ux32(v *Value) bool {
4806 v_1 := v.Args[1]
4807 v_0 := v.Args[0]
4808 b := v.Block
4809 typ := &b.Func.Config.Types
4810 // match: (Rsh64Ux32 x y)
4811 // cond: shiftIsBounded(v)
4812 // result: (SRD x y)
4813 for {
4814 x := v_0
4815 y := v_1
4816 if !(shiftIsBounded(v)) {
4817 break
4818 }
4819 v.reset(OpS390XSRD)
4820 v.AddArg2(x, y)
4821 return true
4822 }
4823 // match: (Rsh64Ux32 <t> x y)
4824 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
4825 for {
4826 t := v.Type
4827 x := v_0
4828 y := v_1
4829 v.reset(OpS390XLOCGR)
4830 v.Type = t
4831 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4832 v0 := b.NewValue0(v.Pos, OpS390XSRD, t)
4833 v0.AddArg2(x, y)
4834 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4835 v1.AuxInt = int64ToAuxInt(0)
4836 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4837 v2.AuxInt = int32ToAuxInt(64)
4838 v2.AddArg(y)
4839 v.AddArg3(v0, v1, v2)
4840 return true
4841 }
4842 }
4843 func rewriteValueS390X_OpRsh64Ux64(v *Value) bool {
4844 v_1 := v.Args[1]
4845 v_0 := v.Args[0]
4846 b := v.Block
4847 typ := &b.Func.Config.Types
4848 // match: (Rsh64Ux64 x y)
4849 // cond: shiftIsBounded(v)
4850 // result: (SRD x y)
4851 for {
4852 x := v_0
4853 y := v_1
4854 if !(shiftIsBounded(v)) {
4855 break
4856 }
4857 v.reset(OpS390XSRD)
4858 v.AddArg2(x, y)
4859 return true
4860 }
4861 // match: (Rsh64Ux64 <t> x y)
4862 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
4863 for {
4864 t := v.Type
4865 x := v_0
4866 y := v_1
4867 v.reset(OpS390XLOCGR)
4868 v.Type = t
4869 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4870 v0 := b.NewValue0(v.Pos, OpS390XSRD, t)
4871 v0.AddArg2(x, y)
4872 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4873 v1.AuxInt = int64ToAuxInt(0)
4874 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4875 v2.AuxInt = int32ToAuxInt(64)
4876 v2.AddArg(y)
4877 v.AddArg3(v0, v1, v2)
4878 return true
4879 }
4880 }
4881 func rewriteValueS390X_OpRsh64Ux8(v *Value) bool {
4882 v_1 := v.Args[1]
4883 v_0 := v.Args[0]
4884 b := v.Block
4885 typ := &b.Func.Config.Types
4886 // match: (Rsh64Ux8 x y)
4887 // cond: shiftIsBounded(v)
4888 // result: (SRD x y)
4889 for {
4890 x := v_0
4891 y := v_1
4892 if !(shiftIsBounded(v)) {
4893 break
4894 }
4895 v.reset(OpS390XSRD)
4896 v.AddArg2(x, y)
4897 return true
4898 }
4899 // match: (Rsh64Ux8 <t> x y)
4900 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
4901 for {
4902 t := v.Type
4903 x := v_0
4904 y := v_1
4905 v.reset(OpS390XLOCGR)
4906 v.Type = t
4907 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4908 v0 := b.NewValue0(v.Pos, OpS390XSRD, t)
4909 v0.AddArg2(x, y)
4910 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4911 v1.AuxInt = int64ToAuxInt(0)
4912 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4913 v2.AuxInt = int32ToAuxInt(64)
4914 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4915 v3.AddArg(y)
4916 v2.AddArg(v3)
4917 v.AddArg3(v0, v1, v2)
4918 return true
4919 }
4920 }
4921 func rewriteValueS390X_OpRsh64x16(v *Value) bool {
4922 v_1 := v.Args[1]
4923 v_0 := v.Args[0]
4924 b := v.Block
4925 typ := &b.Func.Config.Types
4926 // match: (Rsh64x16 x y)
4927 // cond: shiftIsBounded(v)
4928 // result: (SRAD x y)
4929 for {
4930 x := v_0
4931 y := v_1
4932 if !(shiftIsBounded(v)) {
4933 break
4934 }
4935 v.reset(OpS390XSRAD)
4936 v.AddArg2(x, y)
4937 return true
4938 }
4939 // match: (Rsh64x16 x y)
4940 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64])))
4941 for {
4942 x := v_0
4943 y := v_1
4944 v.reset(OpS390XSRAD)
4945 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4946 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4947 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4948 v1.AuxInt = int64ToAuxInt(63)
4949 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4950 v2.AuxInt = int32ToAuxInt(64)
4951 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4952 v3.AddArg(y)
4953 v2.AddArg(v3)
4954 v0.AddArg3(y, v1, v2)
4955 v.AddArg2(x, v0)
4956 return true
4957 }
4958 }
4959 func rewriteValueS390X_OpRsh64x32(v *Value) bool {
4960 v_1 := v.Args[1]
4961 v_0 := v.Args[0]
4962 b := v.Block
4963 // match: (Rsh64x32 x y)
4964 // cond: shiftIsBounded(v)
4965 // result: (SRAD x y)
4966 for {
4967 x := v_0
4968 y := v_1
4969 if !(shiftIsBounded(v)) {
4970 break
4971 }
4972 v.reset(OpS390XSRAD)
4973 v.AddArg2(x, y)
4974 return true
4975 }
4976 // match: (Rsh64x32 x y)
4977 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64])))
4978 for {
4979 x := v_0
4980 y := v_1
4981 v.reset(OpS390XSRAD)
4982 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4983 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4984 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4985 v1.AuxInt = int64ToAuxInt(63)
4986 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4987 v2.AuxInt = int32ToAuxInt(64)
4988 v2.AddArg(y)
4989 v0.AddArg3(y, v1, v2)
4990 v.AddArg2(x, v0)
4991 return true
4992 }
4993 }
4994 func rewriteValueS390X_OpRsh64x64(v *Value) bool {
4995 v_1 := v.Args[1]
4996 v_0 := v.Args[0]
4997 b := v.Block
4998 // match: (Rsh64x64 x y)
4999 // cond: shiftIsBounded(v)
5000 // result: (SRAD x y)
5001 for {
5002 x := v_0
5003 y := v_1
5004 if !(shiftIsBounded(v)) {
5005 break
5006 }
5007 v.reset(OpS390XSRAD)
5008 v.AddArg2(x, y)
5009 return true
5010 }
5011 // match: (Rsh64x64 x y)
5012 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64])))
5013 for {
5014 x := v_0
5015 y := v_1
5016 v.reset(OpS390XSRAD)
5017 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5018 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5019 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5020 v1.AuxInt = int64ToAuxInt(63)
5021 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
5022 v2.AuxInt = int32ToAuxInt(64)
5023 v2.AddArg(y)
5024 v0.AddArg3(y, v1, v2)
5025 v.AddArg2(x, v0)
5026 return true
5027 }
5028 }
5029 func rewriteValueS390X_OpRsh64x8(v *Value) bool {
5030 v_1 := v.Args[1]
5031 v_0 := v.Args[0]
5032 b := v.Block
5033 typ := &b.Func.Config.Types
5034 // match: (Rsh64x8 x y)
5035 // cond: shiftIsBounded(v)
5036 // result: (SRAD x y)
5037 for {
5038 x := v_0
5039 y := v_1
5040 if !(shiftIsBounded(v)) {
5041 break
5042 }
5043 v.reset(OpS390XSRAD)
5044 v.AddArg2(x, y)
5045 return true
5046 }
5047 // match: (Rsh64x8 x y)
5048 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64])))
5049 for {
5050 x := v_0
5051 y := v_1
5052 v.reset(OpS390XSRAD)
5053 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5054 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5055 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5056 v1.AuxInt = int64ToAuxInt(63)
5057 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5058 v2.AuxInt = int32ToAuxInt(64)
5059 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5060 v3.AddArg(y)
5061 v2.AddArg(v3)
5062 v0.AddArg3(y, v1, v2)
5063 v.AddArg2(x, v0)
5064 return true
5065 }
5066 }
5067 func rewriteValueS390X_OpRsh8Ux16(v *Value) bool {
5068 v_1 := v.Args[1]
5069 v_0 := v.Args[0]
5070 b := v.Block
5071 typ := &b.Func.Config.Types
5072 // match: (Rsh8Ux16 x y)
5073 // cond: shiftIsBounded(v)
5074 // result: (SRW (MOVBZreg x) y)
5075 for {
5076 x := v_0
5077 y := v_1
5078 if !(shiftIsBounded(v)) {
5079 break
5080 }
5081 v.reset(OpS390XSRW)
5082 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5083 v0.AddArg(x)
5084 v.AddArg2(v0, y)
5085 return true
5086 }
5087 // match: (Rsh8Ux16 <t> x y)
5088 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
5089 for {
5090 t := v.Type
5091 x := v_0
5092 y := v_1
5093 v.reset(OpS390XLOCGR)
5094 v.Type = t
5095 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5096 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
5097 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5098 v1.AddArg(x)
5099 v0.AddArg2(v1, y)
5100 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
5101 v2.AuxInt = int64ToAuxInt(0)
5102 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5103 v3.AuxInt = int32ToAuxInt(64)
5104 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
5105 v4.AddArg(y)
5106 v3.AddArg(v4)
5107 v.AddArg3(v0, v2, v3)
5108 return true
5109 }
5110 }
5111 func rewriteValueS390X_OpRsh8Ux32(v *Value) bool {
5112 v_1 := v.Args[1]
5113 v_0 := v.Args[0]
5114 b := v.Block
5115 typ := &b.Func.Config.Types
5116 // match: (Rsh8Ux32 x y)
5117 // cond: shiftIsBounded(v)
5118 // result: (SRW (MOVBZreg x) y)
5119 for {
5120 x := v_0
5121 y := v_1
5122 if !(shiftIsBounded(v)) {
5123 break
5124 }
5125 v.reset(OpS390XSRW)
5126 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5127 v0.AddArg(x)
5128 v.AddArg2(v0, y)
5129 return true
5130 }
5131 // match: (Rsh8Ux32 <t> x y)
5132 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [64]))
5133 for {
5134 t := v.Type
5135 x := v_0
5136 y := v_1
5137 v.reset(OpS390XLOCGR)
5138 v.Type = t
5139 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5140 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
5141 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5142 v1.AddArg(x)
5143 v0.AddArg2(v1, y)
5144 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
5145 v2.AuxInt = int64ToAuxInt(0)
5146 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5147 v3.AuxInt = int32ToAuxInt(64)
5148 v3.AddArg(y)
5149 v.AddArg3(v0, v2, v3)
5150 return true
5151 }
5152 }
5153 func rewriteValueS390X_OpRsh8Ux64(v *Value) bool {
5154 v_1 := v.Args[1]
5155 v_0 := v.Args[0]
5156 b := v.Block
5157 typ := &b.Func.Config.Types
5158 // match: (Rsh8Ux64 x y)
5159 // cond: shiftIsBounded(v)
5160 // result: (SRW (MOVBZreg x) y)
5161 for {
5162 x := v_0
5163 y := v_1
5164 if !(shiftIsBounded(v)) {
5165 break
5166 }
5167 v.reset(OpS390XSRW)
5168 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5169 v0.AddArg(x)
5170 v.AddArg2(v0, y)
5171 return true
5172 }
5173 // match: (Rsh8Ux64 <t> x y)
5174 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [64]))
5175 for {
5176 t := v.Type
5177 x := v_0
5178 y := v_1
5179 v.reset(OpS390XLOCGR)
5180 v.Type = t
5181 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5182 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
5183 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5184 v1.AddArg(x)
5185 v0.AddArg2(v1, y)
5186 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
5187 v2.AuxInt = int64ToAuxInt(0)
5188 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
5189 v3.AuxInt = int32ToAuxInt(64)
5190 v3.AddArg(y)
5191 v.AddArg3(v0, v2, v3)
5192 return true
5193 }
5194 }
5195 func rewriteValueS390X_OpRsh8Ux8(v *Value) bool {
5196 v_1 := v.Args[1]
5197 v_0 := v.Args[0]
5198 b := v.Block
5199 typ := &b.Func.Config.Types
5200 // match: (Rsh8Ux8 x y)
5201 // cond: shiftIsBounded(v)
5202 // result: (SRW (MOVBZreg x) y)
5203 for {
5204 x := v_0
5205 y := v_1
5206 if !(shiftIsBounded(v)) {
5207 break
5208 }
5209 v.reset(OpS390XSRW)
5210 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5211 v0.AddArg(x)
5212 v.AddArg2(v0, y)
5213 return true
5214 }
5215 // match: (Rsh8Ux8 <t> x y)
5216 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
5217 for {
5218 t := v.Type
5219 x := v_0
5220 y := v_1
5221 v.reset(OpS390XLOCGR)
5222 v.Type = t
5223 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5224 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
5225 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5226 v1.AddArg(x)
5227 v0.AddArg2(v1, y)
5228 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
5229 v2.AuxInt = int64ToAuxInt(0)
5230 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5231 v3.AuxInt = int32ToAuxInt(64)
5232 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5233 v4.AddArg(y)
5234 v3.AddArg(v4)
5235 v.AddArg3(v0, v2, v3)
5236 return true
5237 }
5238 }
5239 func rewriteValueS390X_OpRsh8x16(v *Value) bool {
5240 v_1 := v.Args[1]
5241 v_0 := v.Args[0]
5242 b := v.Block
5243 typ := &b.Func.Config.Types
5244 // match: (Rsh8x16 x y)
5245 // cond: shiftIsBounded(v)
5246 // result: (SRAW (MOVBreg x) y)
5247 for {
5248 x := v_0
5249 y := v_1
5250 if !(shiftIsBounded(v)) {
5251 break
5252 }
5253 v.reset(OpS390XSRAW)
5254 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5255 v0.AddArg(x)
5256 v.AddArg2(v0, y)
5257 return true
5258 }
5259 // match: (Rsh8x16 x y)
5260 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64])))
5261 for {
5262 x := v_0
5263 y := v_1
5264 v.reset(OpS390XSRAW)
5265 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5266 v0.AddArg(x)
5267 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5268 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5269 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5270 v2.AuxInt = int64ToAuxInt(63)
5271 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5272 v3.AuxInt = int32ToAuxInt(64)
5273 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
5274 v4.AddArg(y)
5275 v3.AddArg(v4)
5276 v1.AddArg3(y, v2, v3)
5277 v.AddArg2(v0, v1)
5278 return true
5279 }
5280 }
5281 func rewriteValueS390X_OpRsh8x32(v *Value) bool {
5282 v_1 := v.Args[1]
5283 v_0 := v.Args[0]
5284 b := v.Block
5285 typ := &b.Func.Config.Types
5286 // match: (Rsh8x32 x y)
5287 // cond: shiftIsBounded(v)
5288 // result: (SRAW (MOVBreg x) y)
5289 for {
5290 x := v_0
5291 y := v_1
5292 if !(shiftIsBounded(v)) {
5293 break
5294 }
5295 v.reset(OpS390XSRAW)
5296 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5297 v0.AddArg(x)
5298 v.AddArg2(v0, y)
5299 return true
5300 }
5301 // match: (Rsh8x32 x y)
5302 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64])))
5303 for {
5304 x := v_0
5305 y := v_1
5306 v.reset(OpS390XSRAW)
5307 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5308 v0.AddArg(x)
5309 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5310 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5311 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5312 v2.AuxInt = int64ToAuxInt(63)
5313 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5314 v3.AuxInt = int32ToAuxInt(64)
5315 v3.AddArg(y)
5316 v1.AddArg3(y, v2, v3)
5317 v.AddArg2(v0, v1)
5318 return true
5319 }
5320 }
5321 func rewriteValueS390X_OpRsh8x64(v *Value) bool {
5322 v_1 := v.Args[1]
5323 v_0 := v.Args[0]
5324 b := v.Block
5325 typ := &b.Func.Config.Types
5326 // match: (Rsh8x64 x y)
5327 // cond: shiftIsBounded(v)
5328 // result: (SRAW (MOVBreg x) y)
5329 for {
5330 x := v_0
5331 y := v_1
5332 if !(shiftIsBounded(v)) {
5333 break
5334 }
5335 v.reset(OpS390XSRAW)
5336 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5337 v0.AddArg(x)
5338 v.AddArg2(v0, y)
5339 return true
5340 }
5341 // match: (Rsh8x64 x y)
5342 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64])))
5343 for {
5344 x := v_0
5345 y := v_1
5346 v.reset(OpS390XSRAW)
5347 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5348 v0.AddArg(x)
5349 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5350 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5351 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5352 v2.AuxInt = int64ToAuxInt(63)
5353 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
5354 v3.AuxInt = int32ToAuxInt(64)
5355 v3.AddArg(y)
5356 v1.AddArg3(y, v2, v3)
5357 v.AddArg2(v0, v1)
5358 return true
5359 }
5360 }
5361 func rewriteValueS390X_OpRsh8x8(v *Value) bool {
5362 v_1 := v.Args[1]
5363 v_0 := v.Args[0]
5364 b := v.Block
5365 typ := &b.Func.Config.Types
5366 // match: (Rsh8x8 x y)
5367 // cond: shiftIsBounded(v)
5368 // result: (SRAW (MOVBreg x) y)
5369 for {
5370 x := v_0
5371 y := v_1
5372 if !(shiftIsBounded(v)) {
5373 break
5374 }
5375 v.reset(OpS390XSRAW)
5376 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5377 v0.AddArg(x)
5378 v.AddArg2(v0, y)
5379 return true
5380 }
5381 // match: (Rsh8x8 x y)
5382 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64])))
5383 for {
5384 x := v_0
5385 y := v_1
5386 v.reset(OpS390XSRAW)
5387 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5388 v0.AddArg(x)
5389 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5390 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5391 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5392 v2.AuxInt = int64ToAuxInt(63)
5393 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5394 v3.AuxInt = int32ToAuxInt(64)
5395 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5396 v4.AddArg(y)
5397 v3.AddArg(v4)
5398 v1.AddArg3(y, v2, v3)
5399 v.AddArg2(v0, v1)
5400 return true
5401 }
5402 }
5403 func rewriteValueS390X_OpS390XADD(v *Value) bool {
5404 v_1 := v.Args[1]
5405 v_0 := v.Args[0]
5406 // match: (ADD x (MOVDconst <t> [c]))
5407 // cond: is32Bit(c) && !t.IsPtr()
5408 // result: (ADDconst [int32(c)] x)
5409 for {
5410 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5411 x := v_0
5412 if v_1.Op != OpS390XMOVDconst {
5413 continue
5414 }
5415 t := v_1.Type
5416 c := auxIntToInt64(v_1.AuxInt)
5417 if !(is32Bit(c) && !t.IsPtr()) {
5418 continue
5419 }
5420 v.reset(OpS390XADDconst)
5421 v.AuxInt = int32ToAuxInt(int32(c))
5422 v.AddArg(x)
5423 return true
5424 }
5425 break
5426 }
5427 // match: (ADD idx (MOVDaddr [c] {s} ptr))
5428 // cond: ptr.Op != OpSB
5429 // result: (MOVDaddridx [c] {s} ptr idx)
5430 for {
5431 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5432 idx := v_0
5433 if v_1.Op != OpS390XMOVDaddr {
5434 continue
5435 }
5436 c := auxIntToInt32(v_1.AuxInt)
5437 s := auxToSym(v_1.Aux)
5438 ptr := v_1.Args[0]
5439 if !(ptr.Op != OpSB) {
5440 continue
5441 }
5442 v.reset(OpS390XMOVDaddridx)
5443 v.AuxInt = int32ToAuxInt(c)
5444 v.Aux = symToAux(s)
5445 v.AddArg2(ptr, idx)
5446 return true
5447 }
5448 break
5449 }
5450 // match: (ADD x (NEG y))
5451 // result: (SUB x y)
5452 for {
5453 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5454 x := v_0
5455 if v_1.Op != OpS390XNEG {
5456 continue
5457 }
5458 y := v_1.Args[0]
5459 v.reset(OpS390XSUB)
5460 v.AddArg2(x, y)
5461 return true
5462 }
5463 break
5464 }
5465 // match: (ADD <t> x g:(MOVDload [off] {sym} ptr mem))
5466 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
5467 // result: (ADDload <t> [off] {sym} x ptr mem)
5468 for {
5469 t := v.Type
5470 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5471 x := v_0
5472 g := v_1
5473 if g.Op != OpS390XMOVDload {
5474 continue
5475 }
5476 off := auxIntToInt32(g.AuxInt)
5477 sym := auxToSym(g.Aux)
5478 mem := g.Args[1]
5479 ptr := g.Args[0]
5480 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
5481 continue
5482 }
5483 v.reset(OpS390XADDload)
5484 v.Type = t
5485 v.AuxInt = int32ToAuxInt(off)
5486 v.Aux = symToAux(sym)
5487 v.AddArg3(x, ptr, mem)
5488 return true
5489 }
5490 break
5491 }
5492 return false
5493 }
5494 func rewriteValueS390X_OpS390XADDC(v *Value) bool {
5495 v_1 := v.Args[1]
5496 v_0 := v.Args[0]
5497 // match: (ADDC x (MOVDconst [c]))
5498 // cond: is16Bit(c)
5499 // result: (ADDCconst x [int16(c)])
5500 for {
5501 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5502 x := v_0
5503 if v_1.Op != OpS390XMOVDconst {
5504 continue
5505 }
5506 c := auxIntToInt64(v_1.AuxInt)
5507 if !(is16Bit(c)) {
5508 continue
5509 }
5510 v.reset(OpS390XADDCconst)
5511 v.AuxInt = int16ToAuxInt(int16(c))
5512 v.AddArg(x)
5513 return true
5514 }
5515 break
5516 }
5517 return false
5518 }
5519 func rewriteValueS390X_OpS390XADDE(v *Value) bool {
5520 v_2 := v.Args[2]
5521 v_1 := v.Args[1]
5522 v_0 := v.Args[0]
5523 // match: (ADDE x y (FlagEQ))
5524 // result: (ADDC x y)
5525 for {
5526 x := v_0
5527 y := v_1
5528 if v_2.Op != OpS390XFlagEQ {
5529 break
5530 }
5531 v.reset(OpS390XADDC)
5532 v.AddArg2(x, y)
5533 return true
5534 }
5535 // match: (ADDE x y (FlagLT))
5536 // result: (ADDC x y)
5537 for {
5538 x := v_0
5539 y := v_1
5540 if v_2.Op != OpS390XFlagLT {
5541 break
5542 }
5543 v.reset(OpS390XADDC)
5544 v.AddArg2(x, y)
5545 return true
5546 }
5547 // match: (ADDE x y (Select1 (ADDCconst [-1] (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) c)))))
5548 // result: (ADDE x y c)
5549 for {
5550 x := v_0
5551 y := v_1
5552 if v_2.Op != OpSelect1 {
5553 break
5554 }
5555 v_2_0 := v_2.Args[0]
5556 if v_2_0.Op != OpS390XADDCconst || auxIntToInt16(v_2_0.AuxInt) != -1 {
5557 break
5558 }
5559 v_2_0_0 := v_2_0.Args[0]
5560 if v_2_0_0.Op != OpSelect0 {
5561 break
5562 }
5563 v_2_0_0_0 := v_2_0_0.Args[0]
5564 if v_2_0_0_0.Op != OpS390XADDE {
5565 break
5566 }
5567 c := v_2_0_0_0.Args[2]
5568 v_2_0_0_0_0 := v_2_0_0_0.Args[0]
5569 if v_2_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0_0_0.AuxInt) != 0 {
5570 break
5571 }
5572 v_2_0_0_0_1 := v_2_0_0_0.Args[1]
5573 if v_2_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0_0_1.AuxInt) != 0 {
5574 break
5575 }
5576 v.reset(OpS390XADDE)
5577 v.AddArg3(x, y, c)
5578 return true
5579 }
5580 return false
5581 }
5582 func rewriteValueS390X_OpS390XADDW(v *Value) bool {
5583 v_1 := v.Args[1]
5584 v_0 := v.Args[0]
5585 // match: (ADDW x (MOVDconst [c]))
5586 // result: (ADDWconst [int32(c)] x)
5587 for {
5588 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5589 x := v_0
5590 if v_1.Op != OpS390XMOVDconst {
5591 continue
5592 }
5593 c := auxIntToInt64(v_1.AuxInt)
5594 v.reset(OpS390XADDWconst)
5595 v.AuxInt = int32ToAuxInt(int32(c))
5596 v.AddArg(x)
5597 return true
5598 }
5599 break
5600 }
5601 // match: (ADDW x (NEGW y))
5602 // result: (SUBW x y)
5603 for {
5604 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5605 x := v_0
5606 if v_1.Op != OpS390XNEGW {
5607 continue
5608 }
5609 y := v_1.Args[0]
5610 v.reset(OpS390XSUBW)
5611 v.AddArg2(x, y)
5612 return true
5613 }
5614 break
5615 }
5616 // match: (ADDW <t> x g:(MOVWload [off] {sym} ptr mem))
5617 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
5618 // result: (ADDWload <t> [off] {sym} x ptr mem)
5619 for {
5620 t := v.Type
5621 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5622 x := v_0
5623 g := v_1
5624 if g.Op != OpS390XMOVWload {
5625 continue
5626 }
5627 off := auxIntToInt32(g.AuxInt)
5628 sym := auxToSym(g.Aux)
5629 mem := g.Args[1]
5630 ptr := g.Args[0]
5631 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
5632 continue
5633 }
5634 v.reset(OpS390XADDWload)
5635 v.Type = t
5636 v.AuxInt = int32ToAuxInt(off)
5637 v.Aux = symToAux(sym)
5638 v.AddArg3(x, ptr, mem)
5639 return true
5640 }
5641 break
5642 }
5643 // match: (ADDW <t> x g:(MOVWZload [off] {sym} ptr mem))
5644 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
5645 // result: (ADDWload <t> [off] {sym} x ptr mem)
5646 for {
5647 t := v.Type
5648 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5649 x := v_0
5650 g := v_1
5651 if g.Op != OpS390XMOVWZload {
5652 continue
5653 }
5654 off := auxIntToInt32(g.AuxInt)
5655 sym := auxToSym(g.Aux)
5656 mem := g.Args[1]
5657 ptr := g.Args[0]
5658 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
5659 continue
5660 }
5661 v.reset(OpS390XADDWload)
5662 v.Type = t
5663 v.AuxInt = int32ToAuxInt(off)
5664 v.Aux = symToAux(sym)
5665 v.AddArg3(x, ptr, mem)
5666 return true
5667 }
5668 break
5669 }
5670 return false
5671 }
5672 func rewriteValueS390X_OpS390XADDWconst(v *Value) bool {
5673 v_0 := v.Args[0]
5674 // match: (ADDWconst [c] x)
5675 // cond: int32(c)==0
5676 // result: x
5677 for {
5678 c := auxIntToInt32(v.AuxInt)
5679 x := v_0
5680 if !(int32(c) == 0) {
5681 break
5682 }
5683 v.copyOf(x)
5684 return true
5685 }
5686 // match: (ADDWconst [c] (MOVDconst [d]))
5687 // result: (MOVDconst [int64(c)+d])
5688 for {
5689 c := auxIntToInt32(v.AuxInt)
5690 if v_0.Op != OpS390XMOVDconst {
5691 break
5692 }
5693 d := auxIntToInt64(v_0.AuxInt)
5694 v.reset(OpS390XMOVDconst)
5695 v.AuxInt = int64ToAuxInt(int64(c) + d)
5696 return true
5697 }
5698 // match: (ADDWconst [c] (ADDWconst [d] x))
5699 // result: (ADDWconst [int32(c+d)] x)
5700 for {
5701 c := auxIntToInt32(v.AuxInt)
5702 if v_0.Op != OpS390XADDWconst {
5703 break
5704 }
5705 d := auxIntToInt32(v_0.AuxInt)
5706 x := v_0.Args[0]
5707 v.reset(OpS390XADDWconst)
5708 v.AuxInt = int32ToAuxInt(int32(c + d))
5709 v.AddArg(x)
5710 return true
5711 }
5712 return false
5713 }
5714 func rewriteValueS390X_OpS390XADDWload(v *Value) bool {
5715 v_2 := v.Args[2]
5716 v_1 := v.Args[1]
5717 v_0 := v.Args[0]
5718 // match: (ADDWload [off1] {sym} x (ADDconst [off2] ptr) mem)
5719 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
5720 // result: (ADDWload [off1+off2] {sym} x ptr mem)
5721 for {
5722 off1 := auxIntToInt32(v.AuxInt)
5723 sym := auxToSym(v.Aux)
5724 x := v_0
5725 if v_1.Op != OpS390XADDconst {
5726 break
5727 }
5728 off2 := auxIntToInt32(v_1.AuxInt)
5729 ptr := v_1.Args[0]
5730 mem := v_2
5731 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
5732 break
5733 }
5734 v.reset(OpS390XADDWload)
5735 v.AuxInt = int32ToAuxInt(off1 + off2)
5736 v.Aux = symToAux(sym)
5737 v.AddArg3(x, ptr, mem)
5738 return true
5739 }
5740 // match: (ADDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
5741 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
5742 // result: (ADDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
5743 for {
5744 o1 := auxIntToInt32(v.AuxInt)
5745 s1 := auxToSym(v.Aux)
5746 x := v_0
5747 if v_1.Op != OpS390XMOVDaddr {
5748 break
5749 }
5750 o2 := auxIntToInt32(v_1.AuxInt)
5751 s2 := auxToSym(v_1.Aux)
5752 ptr := v_1.Args[0]
5753 mem := v_2
5754 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
5755 break
5756 }
5757 v.reset(OpS390XADDWload)
5758 v.AuxInt = int32ToAuxInt(o1 + o2)
5759 v.Aux = symToAux(mergeSym(s1, s2))
5760 v.AddArg3(x, ptr, mem)
5761 return true
5762 }
5763 return false
5764 }
5765 func rewriteValueS390X_OpS390XADDconst(v *Value) bool {
5766 v_0 := v.Args[0]
5767 // match: (ADDconst [c] (MOVDaddr [d] {s} x:(SB)))
5768 // cond: ((c+d)&1 == 0) && is32Bit(int64(c)+int64(d))
5769 // result: (MOVDaddr [c+d] {s} x)
5770 for {
5771 c := auxIntToInt32(v.AuxInt)
5772 if v_0.Op != OpS390XMOVDaddr {
5773 break
5774 }
5775 d := auxIntToInt32(v_0.AuxInt)
5776 s := auxToSym(v_0.Aux)
5777 x := v_0.Args[0]
5778 if x.Op != OpSB || !(((c+d)&1 == 0) && is32Bit(int64(c)+int64(d))) {
5779 break
5780 }
5781 v.reset(OpS390XMOVDaddr)
5782 v.AuxInt = int32ToAuxInt(c + d)
5783 v.Aux = symToAux(s)
5784 v.AddArg(x)
5785 return true
5786 }
5787 // match: (ADDconst [c] (MOVDaddr [d] {s} x))
5788 // cond: x.Op != OpSB && is20Bit(int64(c)+int64(d))
5789 // result: (MOVDaddr [c+d] {s} x)
5790 for {
5791 c := auxIntToInt32(v.AuxInt)
5792 if v_0.Op != OpS390XMOVDaddr {
5793 break
5794 }
5795 d := auxIntToInt32(v_0.AuxInt)
5796 s := auxToSym(v_0.Aux)
5797 x := v_0.Args[0]
5798 if !(x.Op != OpSB && is20Bit(int64(c)+int64(d))) {
5799 break
5800 }
5801 v.reset(OpS390XMOVDaddr)
5802 v.AuxInt = int32ToAuxInt(c + d)
5803 v.Aux = symToAux(s)
5804 v.AddArg(x)
5805 return true
5806 }
5807 // match: (ADDconst [c] (MOVDaddridx [d] {s} x y))
5808 // cond: is20Bit(int64(c)+int64(d))
5809 // result: (MOVDaddridx [c+d] {s} x y)
5810 for {
5811 c := auxIntToInt32(v.AuxInt)
5812 if v_0.Op != OpS390XMOVDaddridx {
5813 break
5814 }
5815 d := auxIntToInt32(v_0.AuxInt)
5816 s := auxToSym(v_0.Aux)
5817 y := v_0.Args[1]
5818 x := v_0.Args[0]
5819 if !(is20Bit(int64(c) + int64(d))) {
5820 break
5821 }
5822 v.reset(OpS390XMOVDaddridx)
5823 v.AuxInt = int32ToAuxInt(c + d)
5824 v.Aux = symToAux(s)
5825 v.AddArg2(x, y)
5826 return true
5827 }
5828 // match: (ADDconst [0] x)
5829 // result: x
5830 for {
5831 if auxIntToInt32(v.AuxInt) != 0 {
5832 break
5833 }
5834 x := v_0
5835 v.copyOf(x)
5836 return true
5837 }
5838 // match: (ADDconst [c] (MOVDconst [d]))
5839 // result: (MOVDconst [int64(c)+d])
5840 for {
5841 c := auxIntToInt32(v.AuxInt)
5842 if v_0.Op != OpS390XMOVDconst {
5843 break
5844 }
5845 d := auxIntToInt64(v_0.AuxInt)
5846 v.reset(OpS390XMOVDconst)
5847 v.AuxInt = int64ToAuxInt(int64(c) + d)
5848 return true
5849 }
5850 // match: (ADDconst [c] (ADDconst [d] x))
5851 // cond: is32Bit(int64(c)+int64(d))
5852 // result: (ADDconst [c+d] x)
5853 for {
5854 c := auxIntToInt32(v.AuxInt)
5855 if v_0.Op != OpS390XADDconst {
5856 break
5857 }
5858 d := auxIntToInt32(v_0.AuxInt)
5859 x := v_0.Args[0]
5860 if !(is32Bit(int64(c) + int64(d))) {
5861 break
5862 }
5863 v.reset(OpS390XADDconst)
5864 v.AuxInt = int32ToAuxInt(c + d)
5865 v.AddArg(x)
5866 return true
5867 }
5868 return false
5869 }
5870 func rewriteValueS390X_OpS390XADDload(v *Value) bool {
5871 v_2 := v.Args[2]
5872 v_1 := v.Args[1]
5873 v_0 := v.Args[0]
5874 b := v.Block
5875 // match: (ADDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
5876 // cond: isSamePtr(ptr1, ptr2)
5877 // result: (ADD x (LGDR <t> y))
5878 for {
5879 t := v.Type
5880 off := auxIntToInt32(v.AuxInt)
5881 sym := auxToSym(v.Aux)
5882 x := v_0
5883 ptr1 := v_1
5884 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
5885 break
5886 }
5887 y := v_2.Args[1]
5888 ptr2 := v_2.Args[0]
5889 if !(isSamePtr(ptr1, ptr2)) {
5890 break
5891 }
5892 v.reset(OpS390XADD)
5893 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
5894 v0.AddArg(y)
5895 v.AddArg2(x, v0)
5896 return true
5897 }
5898 // match: (ADDload [off1] {sym} x (ADDconst [off2] ptr) mem)
5899 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
5900 // result: (ADDload [off1+off2] {sym} x ptr mem)
5901 for {
5902 off1 := auxIntToInt32(v.AuxInt)
5903 sym := auxToSym(v.Aux)
5904 x := v_0
5905 if v_1.Op != OpS390XADDconst {
5906 break
5907 }
5908 off2 := auxIntToInt32(v_1.AuxInt)
5909 ptr := v_1.Args[0]
5910 mem := v_2
5911 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
5912 break
5913 }
5914 v.reset(OpS390XADDload)
5915 v.AuxInt = int32ToAuxInt(off1 + off2)
5916 v.Aux = symToAux(sym)
5917 v.AddArg3(x, ptr, mem)
5918 return true
5919 }
5920 // match: (ADDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
5921 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
5922 // result: (ADDload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
5923 for {
5924 o1 := auxIntToInt32(v.AuxInt)
5925 s1 := auxToSym(v.Aux)
5926 x := v_0
5927 if v_1.Op != OpS390XMOVDaddr {
5928 break
5929 }
5930 o2 := auxIntToInt32(v_1.AuxInt)
5931 s2 := auxToSym(v_1.Aux)
5932 ptr := v_1.Args[0]
5933 mem := v_2
5934 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
5935 break
5936 }
5937 v.reset(OpS390XADDload)
5938 v.AuxInt = int32ToAuxInt(o1 + o2)
5939 v.Aux = symToAux(mergeSym(s1, s2))
5940 v.AddArg3(x, ptr, mem)
5941 return true
5942 }
5943 return false
5944 }
5945 func rewriteValueS390X_OpS390XAND(v *Value) bool {
5946 v_1 := v.Args[1]
5947 v_0 := v.Args[0]
5948 b := v.Block
5949 typ := &b.Func.Config.Types
5950 // match: (AND x (MOVDconst [c]))
5951 // cond: s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)) != nil
5952 // result: (RISBGZ x {*s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c))})
5953 for {
5954 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5955 x := v_0
5956 if v_1.Op != OpS390XMOVDconst {
5957 continue
5958 }
5959 c := auxIntToInt64(v_1.AuxInt)
5960 if !(s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)) != nil) {
5961 continue
5962 }
5963 v.reset(OpS390XRISBGZ)
5964 v.Aux = s390xRotateParamsToAux(*s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)))
5965 v.AddArg(x)
5966 return true
5967 }
5968 break
5969 }
5970 // match: (AND x (MOVDconst [c]))
5971 // cond: is32Bit(c) && c < 0
5972 // result: (ANDconst [c] x)
5973 for {
5974 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5975 x := v_0
5976 if v_1.Op != OpS390XMOVDconst {
5977 continue
5978 }
5979 c := auxIntToInt64(v_1.AuxInt)
5980 if !(is32Bit(c) && c < 0) {
5981 continue
5982 }
5983 v.reset(OpS390XANDconst)
5984 v.AuxInt = int64ToAuxInt(c)
5985 v.AddArg(x)
5986 return true
5987 }
5988 break
5989 }
5990 // match: (AND x (MOVDconst [c]))
5991 // cond: is32Bit(c) && c >= 0
5992 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(c)] x))
5993 for {
5994 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5995 x := v_0
5996 if v_1.Op != OpS390XMOVDconst {
5997 continue
5998 }
5999 c := auxIntToInt64(v_1.AuxInt)
6000 if !(is32Bit(c) && c >= 0) {
6001 continue
6002 }
6003 v.reset(OpS390XMOVWZreg)
6004 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
6005 v0.AuxInt = int32ToAuxInt(int32(c))
6006 v0.AddArg(x)
6007 v.AddArg(v0)
6008 return true
6009 }
6010 break
6011 }
6012 // match: (AND (MOVDconst [c]) (MOVDconst [d]))
6013 // result: (MOVDconst [c&d])
6014 for {
6015 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6016 if v_0.Op != OpS390XMOVDconst {
6017 continue
6018 }
6019 c := auxIntToInt64(v_0.AuxInt)
6020 if v_1.Op != OpS390XMOVDconst {
6021 continue
6022 }
6023 d := auxIntToInt64(v_1.AuxInt)
6024 v.reset(OpS390XMOVDconst)
6025 v.AuxInt = int64ToAuxInt(c & d)
6026 return true
6027 }
6028 break
6029 }
6030 // match: (AND x x)
6031 // result: x
6032 for {
6033 x := v_0
6034 if x != v_1 {
6035 break
6036 }
6037 v.copyOf(x)
6038 return true
6039 }
6040 // match: (AND <t> x g:(MOVDload [off] {sym} ptr mem))
6041 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
6042 // result: (ANDload <t> [off] {sym} x ptr mem)
6043 for {
6044 t := v.Type
6045 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6046 x := v_0
6047 g := v_1
6048 if g.Op != OpS390XMOVDload {
6049 continue
6050 }
6051 off := auxIntToInt32(g.AuxInt)
6052 sym := auxToSym(g.Aux)
6053 mem := g.Args[1]
6054 ptr := g.Args[0]
6055 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
6056 continue
6057 }
6058 v.reset(OpS390XANDload)
6059 v.Type = t
6060 v.AuxInt = int32ToAuxInt(off)
6061 v.Aux = symToAux(sym)
6062 v.AddArg3(x, ptr, mem)
6063 return true
6064 }
6065 break
6066 }
6067 return false
6068 }
6069 func rewriteValueS390X_OpS390XANDW(v *Value) bool {
6070 v_1 := v.Args[1]
6071 v_0 := v.Args[0]
6072 // match: (ANDW x (MOVDconst [c]))
6073 // result: (ANDWconst [int32(c)] x)
6074 for {
6075 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6076 x := v_0
6077 if v_1.Op != OpS390XMOVDconst {
6078 continue
6079 }
6080 c := auxIntToInt64(v_1.AuxInt)
6081 v.reset(OpS390XANDWconst)
6082 v.AuxInt = int32ToAuxInt(int32(c))
6083 v.AddArg(x)
6084 return true
6085 }
6086 break
6087 }
6088 // match: (ANDW x x)
6089 // result: x
6090 for {
6091 x := v_0
6092 if x != v_1 {
6093 break
6094 }
6095 v.copyOf(x)
6096 return true
6097 }
6098 // match: (ANDW <t> x g:(MOVWload [off] {sym} ptr mem))
6099 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
6100 // result: (ANDWload <t> [off] {sym} x ptr mem)
6101 for {
6102 t := v.Type
6103 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6104 x := v_0
6105 g := v_1
6106 if g.Op != OpS390XMOVWload {
6107 continue
6108 }
6109 off := auxIntToInt32(g.AuxInt)
6110 sym := auxToSym(g.Aux)
6111 mem := g.Args[1]
6112 ptr := g.Args[0]
6113 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
6114 continue
6115 }
6116 v.reset(OpS390XANDWload)
6117 v.Type = t
6118 v.AuxInt = int32ToAuxInt(off)
6119 v.Aux = symToAux(sym)
6120 v.AddArg3(x, ptr, mem)
6121 return true
6122 }
6123 break
6124 }
6125 // match: (ANDW <t> x g:(MOVWZload [off] {sym} ptr mem))
6126 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
6127 // result: (ANDWload <t> [off] {sym} x ptr mem)
6128 for {
6129 t := v.Type
6130 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6131 x := v_0
6132 g := v_1
6133 if g.Op != OpS390XMOVWZload {
6134 continue
6135 }
6136 off := auxIntToInt32(g.AuxInt)
6137 sym := auxToSym(g.Aux)
6138 mem := g.Args[1]
6139 ptr := g.Args[0]
6140 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
6141 continue
6142 }
6143 v.reset(OpS390XANDWload)
6144 v.Type = t
6145 v.AuxInt = int32ToAuxInt(off)
6146 v.Aux = symToAux(sym)
6147 v.AddArg3(x, ptr, mem)
6148 return true
6149 }
6150 break
6151 }
6152 return false
6153 }
6154 func rewriteValueS390X_OpS390XANDWconst(v *Value) bool {
6155 v_0 := v.Args[0]
6156 // match: (ANDWconst [c] (ANDWconst [d] x))
6157 // result: (ANDWconst [c&d] x)
6158 for {
6159 c := auxIntToInt32(v.AuxInt)
6160 if v_0.Op != OpS390XANDWconst {
6161 break
6162 }
6163 d := auxIntToInt32(v_0.AuxInt)
6164 x := v_0.Args[0]
6165 v.reset(OpS390XANDWconst)
6166 v.AuxInt = int32ToAuxInt(c & d)
6167 v.AddArg(x)
6168 return true
6169 }
6170 // match: (ANDWconst [0x00ff] x)
6171 // result: (MOVBZreg x)
6172 for {
6173 if auxIntToInt32(v.AuxInt) != 0x00ff {
6174 break
6175 }
6176 x := v_0
6177 v.reset(OpS390XMOVBZreg)
6178 v.AddArg(x)
6179 return true
6180 }
6181 // match: (ANDWconst [0xffff] x)
6182 // result: (MOVHZreg x)
6183 for {
6184 if auxIntToInt32(v.AuxInt) != 0xffff {
6185 break
6186 }
6187 x := v_0
6188 v.reset(OpS390XMOVHZreg)
6189 v.AddArg(x)
6190 return true
6191 }
6192 // match: (ANDWconst [c] _)
6193 // cond: int32(c)==0
6194 // result: (MOVDconst [0])
6195 for {
6196 c := auxIntToInt32(v.AuxInt)
6197 if !(int32(c) == 0) {
6198 break
6199 }
6200 v.reset(OpS390XMOVDconst)
6201 v.AuxInt = int64ToAuxInt(0)
6202 return true
6203 }
6204 // match: (ANDWconst [c] x)
6205 // cond: int32(c)==-1
6206 // result: x
6207 for {
6208 c := auxIntToInt32(v.AuxInt)
6209 x := v_0
6210 if !(int32(c) == -1) {
6211 break
6212 }
6213 v.copyOf(x)
6214 return true
6215 }
6216 // match: (ANDWconst [c] (MOVDconst [d]))
6217 // result: (MOVDconst [int64(c)&d])
6218 for {
6219 c := auxIntToInt32(v.AuxInt)
6220 if v_0.Op != OpS390XMOVDconst {
6221 break
6222 }
6223 d := auxIntToInt64(v_0.AuxInt)
6224 v.reset(OpS390XMOVDconst)
6225 v.AuxInt = int64ToAuxInt(int64(c) & d)
6226 return true
6227 }
6228 return false
6229 }
6230 func rewriteValueS390X_OpS390XANDWload(v *Value) bool {
6231 v_2 := v.Args[2]
6232 v_1 := v.Args[1]
6233 v_0 := v.Args[0]
6234 // match: (ANDWload [off1] {sym} x (ADDconst [off2] ptr) mem)
6235 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
6236 // result: (ANDWload [off1+off2] {sym} x ptr mem)
6237 for {
6238 off1 := auxIntToInt32(v.AuxInt)
6239 sym := auxToSym(v.Aux)
6240 x := v_0
6241 if v_1.Op != OpS390XADDconst {
6242 break
6243 }
6244 off2 := auxIntToInt32(v_1.AuxInt)
6245 ptr := v_1.Args[0]
6246 mem := v_2
6247 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
6248 break
6249 }
6250 v.reset(OpS390XANDWload)
6251 v.AuxInt = int32ToAuxInt(off1 + off2)
6252 v.Aux = symToAux(sym)
6253 v.AddArg3(x, ptr, mem)
6254 return true
6255 }
6256 // match: (ANDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
6257 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
6258 // result: (ANDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
6259 for {
6260 o1 := auxIntToInt32(v.AuxInt)
6261 s1 := auxToSym(v.Aux)
6262 x := v_0
6263 if v_1.Op != OpS390XMOVDaddr {
6264 break
6265 }
6266 o2 := auxIntToInt32(v_1.AuxInt)
6267 s2 := auxToSym(v_1.Aux)
6268 ptr := v_1.Args[0]
6269 mem := v_2
6270 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
6271 break
6272 }
6273 v.reset(OpS390XANDWload)
6274 v.AuxInt = int32ToAuxInt(o1 + o2)
6275 v.Aux = symToAux(mergeSym(s1, s2))
6276 v.AddArg3(x, ptr, mem)
6277 return true
6278 }
6279 return false
6280 }
6281 func rewriteValueS390X_OpS390XANDconst(v *Value) bool {
6282 v_0 := v.Args[0]
6283 // match: (ANDconst [c] (ANDconst [d] x))
6284 // result: (ANDconst [c&d] x)
6285 for {
6286 c := auxIntToInt64(v.AuxInt)
6287 if v_0.Op != OpS390XANDconst {
6288 break
6289 }
6290 d := auxIntToInt64(v_0.AuxInt)
6291 x := v_0.Args[0]
6292 v.reset(OpS390XANDconst)
6293 v.AuxInt = int64ToAuxInt(c & d)
6294 v.AddArg(x)
6295 return true
6296 }
6297 // match: (ANDconst [0] _)
6298 // result: (MOVDconst [0])
6299 for {
6300 if auxIntToInt64(v.AuxInt) != 0 {
6301 break
6302 }
6303 v.reset(OpS390XMOVDconst)
6304 v.AuxInt = int64ToAuxInt(0)
6305 return true
6306 }
6307 // match: (ANDconst [-1] x)
6308 // result: x
6309 for {
6310 if auxIntToInt64(v.AuxInt) != -1 {
6311 break
6312 }
6313 x := v_0
6314 v.copyOf(x)
6315 return true
6316 }
6317 // match: (ANDconst [c] (MOVDconst [d]))
6318 // result: (MOVDconst [c&d])
6319 for {
6320 c := auxIntToInt64(v.AuxInt)
6321 if v_0.Op != OpS390XMOVDconst {
6322 break
6323 }
6324 d := auxIntToInt64(v_0.AuxInt)
6325 v.reset(OpS390XMOVDconst)
6326 v.AuxInt = int64ToAuxInt(c & d)
6327 return true
6328 }
6329 return false
6330 }
6331 func rewriteValueS390X_OpS390XANDload(v *Value) bool {
6332 v_2 := v.Args[2]
6333 v_1 := v.Args[1]
6334 v_0 := v.Args[0]
6335 b := v.Block
6336 // match: (ANDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
6337 // cond: isSamePtr(ptr1, ptr2)
6338 // result: (AND x (LGDR <t> y))
6339 for {
6340 t := v.Type
6341 off := auxIntToInt32(v.AuxInt)
6342 sym := auxToSym(v.Aux)
6343 x := v_0
6344 ptr1 := v_1
6345 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
6346 break
6347 }
6348 y := v_2.Args[1]
6349 ptr2 := v_2.Args[0]
6350 if !(isSamePtr(ptr1, ptr2)) {
6351 break
6352 }
6353 v.reset(OpS390XAND)
6354 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
6355 v0.AddArg(y)
6356 v.AddArg2(x, v0)
6357 return true
6358 }
6359 // match: (ANDload [off1] {sym} x (ADDconst [off2] ptr) mem)
6360 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
6361 // result: (ANDload [off1+off2] {sym} x ptr mem)
6362 for {
6363 off1 := auxIntToInt32(v.AuxInt)
6364 sym := auxToSym(v.Aux)
6365 x := v_0
6366 if v_1.Op != OpS390XADDconst {
6367 break
6368 }
6369 off2 := auxIntToInt32(v_1.AuxInt)
6370 ptr := v_1.Args[0]
6371 mem := v_2
6372 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
6373 break
6374 }
6375 v.reset(OpS390XANDload)
6376 v.AuxInt = int32ToAuxInt(off1 + off2)
6377 v.Aux = symToAux(sym)
6378 v.AddArg3(x, ptr, mem)
6379 return true
6380 }
6381 // match: (ANDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
6382 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
6383 // result: (ANDload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
6384 for {
6385 o1 := auxIntToInt32(v.AuxInt)
6386 s1 := auxToSym(v.Aux)
6387 x := v_0
6388 if v_1.Op != OpS390XMOVDaddr {
6389 break
6390 }
6391 o2 := auxIntToInt32(v_1.AuxInt)
6392 s2 := auxToSym(v_1.Aux)
6393 ptr := v_1.Args[0]
6394 mem := v_2
6395 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
6396 break
6397 }
6398 v.reset(OpS390XANDload)
6399 v.AuxInt = int32ToAuxInt(o1 + o2)
6400 v.Aux = symToAux(mergeSym(s1, s2))
6401 v.AddArg3(x, ptr, mem)
6402 return true
6403 }
6404 return false
6405 }
6406 func rewriteValueS390X_OpS390XCMP(v *Value) bool {
6407 v_1 := v.Args[1]
6408 v_0 := v.Args[0]
6409 b := v.Block
6410 // match: (CMP x (MOVDconst [c]))
6411 // cond: is32Bit(c)
6412 // result: (CMPconst x [int32(c)])
6413 for {
6414 x := v_0
6415 if v_1.Op != OpS390XMOVDconst {
6416 break
6417 }
6418 c := auxIntToInt64(v_1.AuxInt)
6419 if !(is32Bit(c)) {
6420 break
6421 }
6422 v.reset(OpS390XCMPconst)
6423 v.AuxInt = int32ToAuxInt(int32(c))
6424 v.AddArg(x)
6425 return true
6426 }
6427 // match: (CMP (MOVDconst [c]) x)
6428 // cond: is32Bit(c)
6429 // result: (InvertFlags (CMPconst x [int32(c)]))
6430 for {
6431 if v_0.Op != OpS390XMOVDconst {
6432 break
6433 }
6434 c := auxIntToInt64(v_0.AuxInt)
6435 x := v_1
6436 if !(is32Bit(c)) {
6437 break
6438 }
6439 v.reset(OpS390XInvertFlags)
6440 v0 := b.NewValue0(v.Pos, OpS390XCMPconst, types.TypeFlags)
6441 v0.AuxInt = int32ToAuxInt(int32(c))
6442 v0.AddArg(x)
6443 v.AddArg(v0)
6444 return true
6445 }
6446 // match: (CMP x y)
6447 // cond: canonLessThan(x,y)
6448 // result: (InvertFlags (CMP y x))
6449 for {
6450 x := v_0
6451 y := v_1
6452 if !(canonLessThan(x, y)) {
6453 break
6454 }
6455 v.reset(OpS390XInvertFlags)
6456 v0 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
6457 v0.AddArg2(y, x)
6458 v.AddArg(v0)
6459 return true
6460 }
6461 return false
6462 }
6463 func rewriteValueS390X_OpS390XCMPU(v *Value) bool {
6464 v_1 := v.Args[1]
6465 v_0 := v.Args[0]
6466 b := v.Block
6467 // match: (CMPU x (MOVDconst [c]))
6468 // cond: isU32Bit(c)
6469 // result: (CMPUconst x [int32(c)])
6470 for {
6471 x := v_0
6472 if v_1.Op != OpS390XMOVDconst {
6473 break
6474 }
6475 c := auxIntToInt64(v_1.AuxInt)
6476 if !(isU32Bit(c)) {
6477 break
6478 }
6479 v.reset(OpS390XCMPUconst)
6480 v.AuxInt = int32ToAuxInt(int32(c))
6481 v.AddArg(x)
6482 return true
6483 }
6484 // match: (CMPU (MOVDconst [c]) x)
6485 // cond: isU32Bit(c)
6486 // result: (InvertFlags (CMPUconst x [int32(c)]))
6487 for {
6488 if v_0.Op != OpS390XMOVDconst {
6489 break
6490 }
6491 c := auxIntToInt64(v_0.AuxInt)
6492 x := v_1
6493 if !(isU32Bit(c)) {
6494 break
6495 }
6496 v.reset(OpS390XInvertFlags)
6497 v0 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
6498 v0.AuxInt = int32ToAuxInt(int32(c))
6499 v0.AddArg(x)
6500 v.AddArg(v0)
6501 return true
6502 }
6503 // match: (CMPU x y)
6504 // cond: canonLessThan(x,y)
6505 // result: (InvertFlags (CMPU y x))
6506 for {
6507 x := v_0
6508 y := v_1
6509 if !(canonLessThan(x, y)) {
6510 break
6511 }
6512 v.reset(OpS390XInvertFlags)
6513 v0 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
6514 v0.AddArg2(y, x)
6515 v.AddArg(v0)
6516 return true
6517 }
6518 return false
6519 }
6520 func rewriteValueS390X_OpS390XCMPUconst(v *Value) bool {
6521 v_0 := v.Args[0]
6522 // match: (CMPUconst (MOVDconst [x]) [y])
6523 // cond: uint64(x)==uint64(y)
6524 // result: (FlagEQ)
6525 for {
6526 y := auxIntToInt32(v.AuxInt)
6527 if v_0.Op != OpS390XMOVDconst {
6528 break
6529 }
6530 x := auxIntToInt64(v_0.AuxInt)
6531 if !(uint64(x) == uint64(y)) {
6532 break
6533 }
6534 v.reset(OpS390XFlagEQ)
6535 return true
6536 }
6537 // match: (CMPUconst (MOVDconst [x]) [y])
6538 // cond: uint64(x)<uint64(y)
6539 // result: (FlagLT)
6540 for {
6541 y := auxIntToInt32(v.AuxInt)
6542 if v_0.Op != OpS390XMOVDconst {
6543 break
6544 }
6545 x := auxIntToInt64(v_0.AuxInt)
6546 if !(uint64(x) < uint64(y)) {
6547 break
6548 }
6549 v.reset(OpS390XFlagLT)
6550 return true
6551 }
6552 // match: (CMPUconst (MOVDconst [x]) [y])
6553 // cond: uint64(x)>uint64(y)
6554 // result: (FlagGT)
6555 for {
6556 y := auxIntToInt32(v.AuxInt)
6557 if v_0.Op != OpS390XMOVDconst {
6558 break
6559 }
6560 x := auxIntToInt64(v_0.AuxInt)
6561 if !(uint64(x) > uint64(y)) {
6562 break
6563 }
6564 v.reset(OpS390XFlagGT)
6565 return true
6566 }
6567 // match: (CMPUconst (SRDconst _ [c]) [n])
6568 // cond: c > 0 && c < 64 && (1<<uint(64-c)) <= uint64(n)
6569 // result: (FlagLT)
6570 for {
6571 n := auxIntToInt32(v.AuxInt)
6572 if v_0.Op != OpS390XSRDconst {
6573 break
6574 }
6575 c := auxIntToUint8(v_0.AuxInt)
6576 if !(c > 0 && c < 64 && (1<<uint(64-c)) <= uint64(n)) {
6577 break
6578 }
6579 v.reset(OpS390XFlagLT)
6580 return true
6581 }
6582 // match: (CMPUconst (RISBGZ x {r}) [c])
6583 // cond: r.OutMask() < uint64(uint32(c))
6584 // result: (FlagLT)
6585 for {
6586 c := auxIntToInt32(v.AuxInt)
6587 if v_0.Op != OpS390XRISBGZ {
6588 break
6589 }
6590 r := auxToS390xRotateParams(v_0.Aux)
6591 if !(r.OutMask() < uint64(uint32(c))) {
6592 break
6593 }
6594 v.reset(OpS390XFlagLT)
6595 return true
6596 }
6597 // match: (CMPUconst (MOVWZreg x) [c])
6598 // result: (CMPWUconst x [c])
6599 for {
6600 c := auxIntToInt32(v.AuxInt)
6601 if v_0.Op != OpS390XMOVWZreg {
6602 break
6603 }
6604 x := v_0.Args[0]
6605 v.reset(OpS390XCMPWUconst)
6606 v.AuxInt = int32ToAuxInt(c)
6607 v.AddArg(x)
6608 return true
6609 }
6610 // match: (CMPUconst x:(MOVHreg _) [c])
6611 // result: (CMPWUconst x [c])
6612 for {
6613 c := auxIntToInt32(v.AuxInt)
6614 x := v_0
6615 if x.Op != OpS390XMOVHreg {
6616 break
6617 }
6618 v.reset(OpS390XCMPWUconst)
6619 v.AuxInt = int32ToAuxInt(c)
6620 v.AddArg(x)
6621 return true
6622 }
6623 // match: (CMPUconst x:(MOVHZreg _) [c])
6624 // result: (CMPWUconst x [c])
6625 for {
6626 c := auxIntToInt32(v.AuxInt)
6627 x := v_0
6628 if x.Op != OpS390XMOVHZreg {
6629 break
6630 }
6631 v.reset(OpS390XCMPWUconst)
6632 v.AuxInt = int32ToAuxInt(c)
6633 v.AddArg(x)
6634 return true
6635 }
6636 // match: (CMPUconst x:(MOVBreg _) [c])
6637 // result: (CMPWUconst x [c])
6638 for {
6639 c := auxIntToInt32(v.AuxInt)
6640 x := v_0
6641 if x.Op != OpS390XMOVBreg {
6642 break
6643 }
6644 v.reset(OpS390XCMPWUconst)
6645 v.AuxInt = int32ToAuxInt(c)
6646 v.AddArg(x)
6647 return true
6648 }
6649 // match: (CMPUconst x:(MOVBZreg _) [c])
6650 // result: (CMPWUconst x [c])
6651 for {
6652 c := auxIntToInt32(v.AuxInt)
6653 x := v_0
6654 if x.Op != OpS390XMOVBZreg {
6655 break
6656 }
6657 v.reset(OpS390XCMPWUconst)
6658 v.AuxInt = int32ToAuxInt(c)
6659 v.AddArg(x)
6660 return true
6661 }
6662 // match: (CMPUconst (MOVWZreg x:(ANDWconst [m] _)) [c])
6663 // cond: int32(m) >= 0
6664 // result: (CMPWUconst x [c])
6665 for {
6666 c := auxIntToInt32(v.AuxInt)
6667 if v_0.Op != OpS390XMOVWZreg {
6668 break
6669 }
6670 x := v_0.Args[0]
6671 if x.Op != OpS390XANDWconst {
6672 break
6673 }
6674 m := auxIntToInt32(x.AuxInt)
6675 if !(int32(m) >= 0) {
6676 break
6677 }
6678 v.reset(OpS390XCMPWUconst)
6679 v.AuxInt = int32ToAuxInt(c)
6680 v.AddArg(x)
6681 return true
6682 }
6683 // match: (CMPUconst (MOVWreg x:(ANDWconst [m] _)) [c])
6684 // cond: int32(m) >= 0
6685 // result: (CMPWUconst x [c])
6686 for {
6687 c := auxIntToInt32(v.AuxInt)
6688 if v_0.Op != OpS390XMOVWreg {
6689 break
6690 }
6691 x := v_0.Args[0]
6692 if x.Op != OpS390XANDWconst {
6693 break
6694 }
6695 m := auxIntToInt32(x.AuxInt)
6696 if !(int32(m) >= 0) {
6697 break
6698 }
6699 v.reset(OpS390XCMPWUconst)
6700 v.AuxInt = int32ToAuxInt(c)
6701 v.AddArg(x)
6702 return true
6703 }
6704 return false
6705 }
6706 func rewriteValueS390X_OpS390XCMPW(v *Value) bool {
6707 v_1 := v.Args[1]
6708 v_0 := v.Args[0]
6709 b := v.Block
6710 // match: (CMPW x (MOVDconst [c]))
6711 // result: (CMPWconst x [int32(c)])
6712 for {
6713 x := v_0
6714 if v_1.Op != OpS390XMOVDconst {
6715 break
6716 }
6717 c := auxIntToInt64(v_1.AuxInt)
6718 v.reset(OpS390XCMPWconst)
6719 v.AuxInt = int32ToAuxInt(int32(c))
6720 v.AddArg(x)
6721 return true
6722 }
6723 // match: (CMPW (MOVDconst [c]) x)
6724 // result: (InvertFlags (CMPWconst x [int32(c)]))
6725 for {
6726 if v_0.Op != OpS390XMOVDconst {
6727 break
6728 }
6729 c := auxIntToInt64(v_0.AuxInt)
6730 x := v_1
6731 v.reset(OpS390XInvertFlags)
6732 v0 := b.NewValue0(v.Pos, OpS390XCMPWconst, types.TypeFlags)
6733 v0.AuxInt = int32ToAuxInt(int32(c))
6734 v0.AddArg(x)
6735 v.AddArg(v0)
6736 return true
6737 }
6738 // match: (CMPW x y)
6739 // cond: canonLessThan(x,y)
6740 // result: (InvertFlags (CMPW y x))
6741 for {
6742 x := v_0
6743 y := v_1
6744 if !(canonLessThan(x, y)) {
6745 break
6746 }
6747 v.reset(OpS390XInvertFlags)
6748 v0 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
6749 v0.AddArg2(y, x)
6750 v.AddArg(v0)
6751 return true
6752 }
6753 // match: (CMPW x (MOVWreg y))
6754 // result: (CMPW x y)
6755 for {
6756 x := v_0
6757 if v_1.Op != OpS390XMOVWreg {
6758 break
6759 }
6760 y := v_1.Args[0]
6761 v.reset(OpS390XCMPW)
6762 v.AddArg2(x, y)
6763 return true
6764 }
6765 // match: (CMPW x (MOVWZreg y))
6766 // result: (CMPW x y)
6767 for {
6768 x := v_0
6769 if v_1.Op != OpS390XMOVWZreg {
6770 break
6771 }
6772 y := v_1.Args[0]
6773 v.reset(OpS390XCMPW)
6774 v.AddArg2(x, y)
6775 return true
6776 }
6777 // match: (CMPW (MOVWreg x) y)
6778 // result: (CMPW x y)
6779 for {
6780 if v_0.Op != OpS390XMOVWreg {
6781 break
6782 }
6783 x := v_0.Args[0]
6784 y := v_1
6785 v.reset(OpS390XCMPW)
6786 v.AddArg2(x, y)
6787 return true
6788 }
6789 // match: (CMPW (MOVWZreg x) y)
6790 // result: (CMPW x y)
6791 for {
6792 if v_0.Op != OpS390XMOVWZreg {
6793 break
6794 }
6795 x := v_0.Args[0]
6796 y := v_1
6797 v.reset(OpS390XCMPW)
6798 v.AddArg2(x, y)
6799 return true
6800 }
6801 return false
6802 }
6803 func rewriteValueS390X_OpS390XCMPWU(v *Value) bool {
6804 v_1 := v.Args[1]
6805 v_0 := v.Args[0]
6806 b := v.Block
6807 // match: (CMPWU x (MOVDconst [c]))
6808 // result: (CMPWUconst x [int32(c)])
6809 for {
6810 x := v_0
6811 if v_1.Op != OpS390XMOVDconst {
6812 break
6813 }
6814 c := auxIntToInt64(v_1.AuxInt)
6815 v.reset(OpS390XCMPWUconst)
6816 v.AuxInt = int32ToAuxInt(int32(c))
6817 v.AddArg(x)
6818 return true
6819 }
6820 // match: (CMPWU (MOVDconst [c]) x)
6821 // result: (InvertFlags (CMPWUconst x [int32(c)]))
6822 for {
6823 if v_0.Op != OpS390XMOVDconst {
6824 break
6825 }
6826 c := auxIntToInt64(v_0.AuxInt)
6827 x := v_1
6828 v.reset(OpS390XInvertFlags)
6829 v0 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
6830 v0.AuxInt = int32ToAuxInt(int32(c))
6831 v0.AddArg(x)
6832 v.AddArg(v0)
6833 return true
6834 }
6835 // match: (CMPWU x y)
6836 // cond: canonLessThan(x,y)
6837 // result: (InvertFlags (CMPWU y x))
6838 for {
6839 x := v_0
6840 y := v_1
6841 if !(canonLessThan(x, y)) {
6842 break
6843 }
6844 v.reset(OpS390XInvertFlags)
6845 v0 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
6846 v0.AddArg2(y, x)
6847 v.AddArg(v0)
6848 return true
6849 }
6850 // match: (CMPWU x (MOVWreg y))
6851 // result: (CMPWU x y)
6852 for {
6853 x := v_0
6854 if v_1.Op != OpS390XMOVWreg {
6855 break
6856 }
6857 y := v_1.Args[0]
6858 v.reset(OpS390XCMPWU)
6859 v.AddArg2(x, y)
6860 return true
6861 }
6862 // match: (CMPWU x (MOVWZreg y))
6863 // result: (CMPWU x y)
6864 for {
6865 x := v_0
6866 if v_1.Op != OpS390XMOVWZreg {
6867 break
6868 }
6869 y := v_1.Args[0]
6870 v.reset(OpS390XCMPWU)
6871 v.AddArg2(x, y)
6872 return true
6873 }
6874 // match: (CMPWU (MOVWreg x) y)
6875 // result: (CMPWU x y)
6876 for {
6877 if v_0.Op != OpS390XMOVWreg {
6878 break
6879 }
6880 x := v_0.Args[0]
6881 y := v_1
6882 v.reset(OpS390XCMPWU)
6883 v.AddArg2(x, y)
6884 return true
6885 }
6886 // match: (CMPWU (MOVWZreg x) y)
6887 // result: (CMPWU x y)
6888 for {
6889 if v_0.Op != OpS390XMOVWZreg {
6890 break
6891 }
6892 x := v_0.Args[0]
6893 y := v_1
6894 v.reset(OpS390XCMPWU)
6895 v.AddArg2(x, y)
6896 return true
6897 }
6898 return false
6899 }
6900 func rewriteValueS390X_OpS390XCMPWUconst(v *Value) bool {
6901 v_0 := v.Args[0]
6902 // match: (CMPWUconst (MOVDconst [x]) [y])
6903 // cond: uint32(x)==uint32(y)
6904 // result: (FlagEQ)
6905 for {
6906 y := auxIntToInt32(v.AuxInt)
6907 if v_0.Op != OpS390XMOVDconst {
6908 break
6909 }
6910 x := auxIntToInt64(v_0.AuxInt)
6911 if !(uint32(x) == uint32(y)) {
6912 break
6913 }
6914 v.reset(OpS390XFlagEQ)
6915 return true
6916 }
6917 // match: (CMPWUconst (MOVDconst [x]) [y])
6918 // cond: uint32(x)<uint32(y)
6919 // result: (FlagLT)
6920 for {
6921 y := auxIntToInt32(v.AuxInt)
6922 if v_0.Op != OpS390XMOVDconst {
6923 break
6924 }
6925 x := auxIntToInt64(v_0.AuxInt)
6926 if !(uint32(x) < uint32(y)) {
6927 break
6928 }
6929 v.reset(OpS390XFlagLT)
6930 return true
6931 }
6932 // match: (CMPWUconst (MOVDconst [x]) [y])
6933 // cond: uint32(x)>uint32(y)
6934 // result: (FlagGT)
6935 for {
6936 y := auxIntToInt32(v.AuxInt)
6937 if v_0.Op != OpS390XMOVDconst {
6938 break
6939 }
6940 x := auxIntToInt64(v_0.AuxInt)
6941 if !(uint32(x) > uint32(y)) {
6942 break
6943 }
6944 v.reset(OpS390XFlagGT)
6945 return true
6946 }
6947 // match: (CMPWUconst (MOVBZreg _) [c])
6948 // cond: 0xff < c
6949 // result: (FlagLT)
6950 for {
6951 c := auxIntToInt32(v.AuxInt)
6952 if v_0.Op != OpS390XMOVBZreg || !(0xff < c) {
6953 break
6954 }
6955 v.reset(OpS390XFlagLT)
6956 return true
6957 }
6958 // match: (CMPWUconst (MOVHZreg _) [c])
6959 // cond: 0xffff < c
6960 // result: (FlagLT)
6961 for {
6962 c := auxIntToInt32(v.AuxInt)
6963 if v_0.Op != OpS390XMOVHZreg || !(0xffff < c) {
6964 break
6965 }
6966 v.reset(OpS390XFlagLT)
6967 return true
6968 }
6969 // match: (CMPWUconst (SRWconst _ [c]) [n])
6970 // cond: c > 0 && c < 32 && (1<<uint(32-c)) <= uint32(n)
6971 // result: (FlagLT)
6972 for {
6973 n := auxIntToInt32(v.AuxInt)
6974 if v_0.Op != OpS390XSRWconst {
6975 break
6976 }
6977 c := auxIntToUint8(v_0.AuxInt)
6978 if !(c > 0 && c < 32 && (1<<uint(32-c)) <= uint32(n)) {
6979 break
6980 }
6981 v.reset(OpS390XFlagLT)
6982 return true
6983 }
6984 // match: (CMPWUconst (ANDWconst _ [m]) [n])
6985 // cond: uint32(m) < uint32(n)
6986 // result: (FlagLT)
6987 for {
6988 n := auxIntToInt32(v.AuxInt)
6989 if v_0.Op != OpS390XANDWconst {
6990 break
6991 }
6992 m := auxIntToInt32(v_0.AuxInt)
6993 if !(uint32(m) < uint32(n)) {
6994 break
6995 }
6996 v.reset(OpS390XFlagLT)
6997 return true
6998 }
6999 // match: (CMPWUconst (MOVWreg x) [c])
7000 // result: (CMPWUconst x [c])
7001 for {
7002 c := auxIntToInt32(v.AuxInt)
7003 if v_0.Op != OpS390XMOVWreg {
7004 break
7005 }
7006 x := v_0.Args[0]
7007 v.reset(OpS390XCMPWUconst)
7008 v.AuxInt = int32ToAuxInt(c)
7009 v.AddArg(x)
7010 return true
7011 }
7012 // match: (CMPWUconst (MOVWZreg x) [c])
7013 // result: (CMPWUconst x [c])
7014 for {
7015 c := auxIntToInt32(v.AuxInt)
7016 if v_0.Op != OpS390XMOVWZreg {
7017 break
7018 }
7019 x := v_0.Args[0]
7020 v.reset(OpS390XCMPWUconst)
7021 v.AuxInt = int32ToAuxInt(c)
7022 v.AddArg(x)
7023 return true
7024 }
7025 return false
7026 }
7027 func rewriteValueS390X_OpS390XCMPWconst(v *Value) bool {
7028 v_0 := v.Args[0]
7029 // match: (CMPWconst (MOVDconst [x]) [y])
7030 // cond: int32(x)==int32(y)
7031 // result: (FlagEQ)
7032 for {
7033 y := auxIntToInt32(v.AuxInt)
7034 if v_0.Op != OpS390XMOVDconst {
7035 break
7036 }
7037 x := auxIntToInt64(v_0.AuxInt)
7038 if !(int32(x) == int32(y)) {
7039 break
7040 }
7041 v.reset(OpS390XFlagEQ)
7042 return true
7043 }
7044 // match: (CMPWconst (MOVDconst [x]) [y])
7045 // cond: int32(x)<int32(y)
7046 // result: (FlagLT)
7047 for {
7048 y := auxIntToInt32(v.AuxInt)
7049 if v_0.Op != OpS390XMOVDconst {
7050 break
7051 }
7052 x := auxIntToInt64(v_0.AuxInt)
7053 if !(int32(x) < int32(y)) {
7054 break
7055 }
7056 v.reset(OpS390XFlagLT)
7057 return true
7058 }
7059 // match: (CMPWconst (MOVDconst [x]) [y])
7060 // cond: int32(x)>int32(y)
7061 // result: (FlagGT)
7062 for {
7063 y := auxIntToInt32(v.AuxInt)
7064 if v_0.Op != OpS390XMOVDconst {
7065 break
7066 }
7067 x := auxIntToInt64(v_0.AuxInt)
7068 if !(int32(x) > int32(y)) {
7069 break
7070 }
7071 v.reset(OpS390XFlagGT)
7072 return true
7073 }
7074 // match: (CMPWconst (MOVBZreg _) [c])
7075 // cond: 0xff < c
7076 // result: (FlagLT)
7077 for {
7078 c := auxIntToInt32(v.AuxInt)
7079 if v_0.Op != OpS390XMOVBZreg || !(0xff < c) {
7080 break
7081 }
7082 v.reset(OpS390XFlagLT)
7083 return true
7084 }
7085 // match: (CMPWconst (MOVHZreg _) [c])
7086 // cond: 0xffff < c
7087 // result: (FlagLT)
7088 for {
7089 c := auxIntToInt32(v.AuxInt)
7090 if v_0.Op != OpS390XMOVHZreg || !(0xffff < c) {
7091 break
7092 }
7093 v.reset(OpS390XFlagLT)
7094 return true
7095 }
7096 // match: (CMPWconst (SRWconst _ [c]) [n])
7097 // cond: c > 0 && n < 0
7098 // result: (FlagGT)
7099 for {
7100 n := auxIntToInt32(v.AuxInt)
7101 if v_0.Op != OpS390XSRWconst {
7102 break
7103 }
7104 c := auxIntToUint8(v_0.AuxInt)
7105 if !(c > 0 && n < 0) {
7106 break
7107 }
7108 v.reset(OpS390XFlagGT)
7109 return true
7110 }
7111 // match: (CMPWconst (ANDWconst _ [m]) [n])
7112 // cond: int32(m) >= 0 && int32(m) < int32(n)
7113 // result: (FlagLT)
7114 for {
7115 n := auxIntToInt32(v.AuxInt)
7116 if v_0.Op != OpS390XANDWconst {
7117 break
7118 }
7119 m := auxIntToInt32(v_0.AuxInt)
7120 if !(int32(m) >= 0 && int32(m) < int32(n)) {
7121 break
7122 }
7123 v.reset(OpS390XFlagLT)
7124 return true
7125 }
7126 // match: (CMPWconst x:(SRWconst _ [c]) [n])
7127 // cond: c > 0 && n >= 0
7128 // result: (CMPWUconst x [n])
7129 for {
7130 n := auxIntToInt32(v.AuxInt)
7131 x := v_0
7132 if x.Op != OpS390XSRWconst {
7133 break
7134 }
7135 c := auxIntToUint8(x.AuxInt)
7136 if !(c > 0 && n >= 0) {
7137 break
7138 }
7139 v.reset(OpS390XCMPWUconst)
7140 v.AuxInt = int32ToAuxInt(n)
7141 v.AddArg(x)
7142 return true
7143 }
7144 // match: (CMPWconst (MOVWreg x) [c])
7145 // result: (CMPWconst x [c])
7146 for {
7147 c := auxIntToInt32(v.AuxInt)
7148 if v_0.Op != OpS390XMOVWreg {
7149 break
7150 }
7151 x := v_0.Args[0]
7152 v.reset(OpS390XCMPWconst)
7153 v.AuxInt = int32ToAuxInt(c)
7154 v.AddArg(x)
7155 return true
7156 }
7157 // match: (CMPWconst (MOVWZreg x) [c])
7158 // result: (CMPWconst x [c])
7159 for {
7160 c := auxIntToInt32(v.AuxInt)
7161 if v_0.Op != OpS390XMOVWZreg {
7162 break
7163 }
7164 x := v_0.Args[0]
7165 v.reset(OpS390XCMPWconst)
7166 v.AuxInt = int32ToAuxInt(c)
7167 v.AddArg(x)
7168 return true
7169 }
7170 return false
7171 }
7172 func rewriteValueS390X_OpS390XCMPconst(v *Value) bool {
7173 v_0 := v.Args[0]
7174 // match: (CMPconst (MOVDconst [x]) [y])
7175 // cond: x==int64(y)
7176 // result: (FlagEQ)
7177 for {
7178 y := auxIntToInt32(v.AuxInt)
7179 if v_0.Op != OpS390XMOVDconst {
7180 break
7181 }
7182 x := auxIntToInt64(v_0.AuxInt)
7183 if !(x == int64(y)) {
7184 break
7185 }
7186 v.reset(OpS390XFlagEQ)
7187 return true
7188 }
7189 // match: (CMPconst (MOVDconst [x]) [y])
7190 // cond: x<int64(y)
7191 // result: (FlagLT)
7192 for {
7193 y := auxIntToInt32(v.AuxInt)
7194 if v_0.Op != OpS390XMOVDconst {
7195 break
7196 }
7197 x := auxIntToInt64(v_0.AuxInt)
7198 if !(x < int64(y)) {
7199 break
7200 }
7201 v.reset(OpS390XFlagLT)
7202 return true
7203 }
7204 // match: (CMPconst (MOVDconst [x]) [y])
7205 // cond: x>int64(y)
7206 // result: (FlagGT)
7207 for {
7208 y := auxIntToInt32(v.AuxInt)
7209 if v_0.Op != OpS390XMOVDconst {
7210 break
7211 }
7212 x := auxIntToInt64(v_0.AuxInt)
7213 if !(x > int64(y)) {
7214 break
7215 }
7216 v.reset(OpS390XFlagGT)
7217 return true
7218 }
7219 // match: (CMPconst (SRDconst _ [c]) [n])
7220 // cond: c > 0 && n < 0
7221 // result: (FlagGT)
7222 for {
7223 n := auxIntToInt32(v.AuxInt)
7224 if v_0.Op != OpS390XSRDconst {
7225 break
7226 }
7227 c := auxIntToUint8(v_0.AuxInt)
7228 if !(c > 0 && n < 0) {
7229 break
7230 }
7231 v.reset(OpS390XFlagGT)
7232 return true
7233 }
7234 // match: (CMPconst (RISBGZ x {r}) [c])
7235 // cond: c > 0 && r.OutMask() < uint64(c)
7236 // result: (FlagLT)
7237 for {
7238 c := auxIntToInt32(v.AuxInt)
7239 if v_0.Op != OpS390XRISBGZ {
7240 break
7241 }
7242 r := auxToS390xRotateParams(v_0.Aux)
7243 if !(c > 0 && r.OutMask() < uint64(c)) {
7244 break
7245 }
7246 v.reset(OpS390XFlagLT)
7247 return true
7248 }
7249 // match: (CMPconst (MOVWreg x) [c])
7250 // result: (CMPWconst x [c])
7251 for {
7252 c := auxIntToInt32(v.AuxInt)
7253 if v_0.Op != OpS390XMOVWreg {
7254 break
7255 }
7256 x := v_0.Args[0]
7257 v.reset(OpS390XCMPWconst)
7258 v.AuxInt = int32ToAuxInt(c)
7259 v.AddArg(x)
7260 return true
7261 }
7262 // match: (CMPconst x:(MOVHreg _) [c])
7263 // result: (CMPWconst x [c])
7264 for {
7265 c := auxIntToInt32(v.AuxInt)
7266 x := v_0
7267 if x.Op != OpS390XMOVHreg {
7268 break
7269 }
7270 v.reset(OpS390XCMPWconst)
7271 v.AuxInt = int32ToAuxInt(c)
7272 v.AddArg(x)
7273 return true
7274 }
7275 // match: (CMPconst x:(MOVHZreg _) [c])
7276 // result: (CMPWconst x [c])
7277 for {
7278 c := auxIntToInt32(v.AuxInt)
7279 x := v_0
7280 if x.Op != OpS390XMOVHZreg {
7281 break
7282 }
7283 v.reset(OpS390XCMPWconst)
7284 v.AuxInt = int32ToAuxInt(c)
7285 v.AddArg(x)
7286 return true
7287 }
7288 // match: (CMPconst x:(MOVBreg _) [c])
7289 // result: (CMPWconst x [c])
7290 for {
7291 c := auxIntToInt32(v.AuxInt)
7292 x := v_0
7293 if x.Op != OpS390XMOVBreg {
7294 break
7295 }
7296 v.reset(OpS390XCMPWconst)
7297 v.AuxInt = int32ToAuxInt(c)
7298 v.AddArg(x)
7299 return true
7300 }
7301 // match: (CMPconst x:(MOVBZreg _) [c])
7302 // result: (CMPWconst x [c])
7303 for {
7304 c := auxIntToInt32(v.AuxInt)
7305 x := v_0
7306 if x.Op != OpS390XMOVBZreg {
7307 break
7308 }
7309 v.reset(OpS390XCMPWconst)
7310 v.AuxInt = int32ToAuxInt(c)
7311 v.AddArg(x)
7312 return true
7313 }
7314 // match: (CMPconst (MOVWZreg x:(ANDWconst [m] _)) [c])
7315 // cond: int32(m) >= 0 && c >= 0
7316 // result: (CMPWUconst x [c])
7317 for {
7318 c := auxIntToInt32(v.AuxInt)
7319 if v_0.Op != OpS390XMOVWZreg {
7320 break
7321 }
7322 x := v_0.Args[0]
7323 if x.Op != OpS390XANDWconst {
7324 break
7325 }
7326 m := auxIntToInt32(x.AuxInt)
7327 if !(int32(m) >= 0 && c >= 0) {
7328 break
7329 }
7330 v.reset(OpS390XCMPWUconst)
7331 v.AuxInt = int32ToAuxInt(c)
7332 v.AddArg(x)
7333 return true
7334 }
7335 // match: (CMPconst (MOVWreg x:(ANDWconst [m] _)) [c])
7336 // cond: int32(m) >= 0 && c >= 0
7337 // result: (CMPWUconst x [c])
7338 for {
7339 c := auxIntToInt32(v.AuxInt)
7340 if v_0.Op != OpS390XMOVWreg {
7341 break
7342 }
7343 x := v_0.Args[0]
7344 if x.Op != OpS390XANDWconst {
7345 break
7346 }
7347 m := auxIntToInt32(x.AuxInt)
7348 if !(int32(m) >= 0 && c >= 0) {
7349 break
7350 }
7351 v.reset(OpS390XCMPWUconst)
7352 v.AuxInt = int32ToAuxInt(c)
7353 v.AddArg(x)
7354 return true
7355 }
7356 // match: (CMPconst x:(SRDconst _ [c]) [n])
7357 // cond: c > 0 && n >= 0
7358 // result: (CMPUconst x [n])
7359 for {
7360 n := auxIntToInt32(v.AuxInt)
7361 x := v_0
7362 if x.Op != OpS390XSRDconst {
7363 break
7364 }
7365 c := auxIntToUint8(x.AuxInt)
7366 if !(c > 0 && n >= 0) {
7367 break
7368 }
7369 v.reset(OpS390XCMPUconst)
7370 v.AuxInt = int32ToAuxInt(n)
7371 v.AddArg(x)
7372 return true
7373 }
7374 return false
7375 }
7376 func rewriteValueS390X_OpS390XCPSDR(v *Value) bool {
7377 v_1 := v.Args[1]
7378 v_0 := v.Args[0]
7379 // match: (CPSDR y (FMOVDconst [c]))
7380 // cond: !math.Signbit(c)
7381 // result: (LPDFR y)
7382 for {
7383 y := v_0
7384 if v_1.Op != OpS390XFMOVDconst {
7385 break
7386 }
7387 c := auxIntToFloat64(v_1.AuxInt)
7388 if !(!math.Signbit(c)) {
7389 break
7390 }
7391 v.reset(OpS390XLPDFR)
7392 v.AddArg(y)
7393 return true
7394 }
7395 // match: (CPSDR y (FMOVDconst [c]))
7396 // cond: math.Signbit(c)
7397 // result: (LNDFR y)
7398 for {
7399 y := v_0
7400 if v_1.Op != OpS390XFMOVDconst {
7401 break
7402 }
7403 c := auxIntToFloat64(v_1.AuxInt)
7404 if !(math.Signbit(c)) {
7405 break
7406 }
7407 v.reset(OpS390XLNDFR)
7408 v.AddArg(y)
7409 return true
7410 }
7411 return false
7412 }
7413 func rewriteValueS390X_OpS390XFCMP(v *Value) bool {
7414 v_1 := v.Args[1]
7415 v_0 := v.Args[0]
7416 b := v.Block
7417 // match: (FCMP x (FMOVDconst [0.0]))
7418 // result: (LTDBR x)
7419 for {
7420 x := v_0
7421 if v_1.Op != OpS390XFMOVDconst || auxIntToFloat64(v_1.AuxInt) != 0.0 {
7422 break
7423 }
7424 v.reset(OpS390XLTDBR)
7425 v.AddArg(x)
7426 return true
7427 }
7428 // match: (FCMP (FMOVDconst [0.0]) x)
7429 // result: (InvertFlags (LTDBR <v.Type> x))
7430 for {
7431 if v_0.Op != OpS390XFMOVDconst || auxIntToFloat64(v_0.AuxInt) != 0.0 {
7432 break
7433 }
7434 x := v_1
7435 v.reset(OpS390XInvertFlags)
7436 v0 := b.NewValue0(v.Pos, OpS390XLTDBR, v.Type)
7437 v0.AddArg(x)
7438 v.AddArg(v0)
7439 return true
7440 }
7441 return false
7442 }
7443 func rewriteValueS390X_OpS390XFCMPS(v *Value) bool {
7444 v_1 := v.Args[1]
7445 v_0 := v.Args[0]
7446 b := v.Block
7447 // match: (FCMPS x (FMOVSconst [0.0]))
7448 // result: (LTEBR x)
7449 for {
7450 x := v_0
7451 if v_1.Op != OpS390XFMOVSconst || auxIntToFloat32(v_1.AuxInt) != 0.0 {
7452 break
7453 }
7454 v.reset(OpS390XLTEBR)
7455 v.AddArg(x)
7456 return true
7457 }
7458 // match: (FCMPS (FMOVSconst [0.0]) x)
7459 // result: (InvertFlags (LTEBR <v.Type> x))
7460 for {
7461 if v_0.Op != OpS390XFMOVSconst || auxIntToFloat32(v_0.AuxInt) != 0.0 {
7462 break
7463 }
7464 x := v_1
7465 v.reset(OpS390XInvertFlags)
7466 v0 := b.NewValue0(v.Pos, OpS390XLTEBR, v.Type)
7467 v0.AddArg(x)
7468 v.AddArg(v0)
7469 return true
7470 }
7471 return false
7472 }
7473 func rewriteValueS390X_OpS390XFMOVDload(v *Value) bool {
7474 v_1 := v.Args[1]
7475 v_0 := v.Args[0]
7476 // match: (FMOVDload [off] {sym} ptr1 (MOVDstore [off] {sym} ptr2 x _))
7477 // cond: isSamePtr(ptr1, ptr2)
7478 // result: (LDGR x)
7479 for {
7480 off := auxIntToInt32(v.AuxInt)
7481 sym := auxToSym(v.Aux)
7482 ptr1 := v_0
7483 if v_1.Op != OpS390XMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7484 break
7485 }
7486 x := v_1.Args[1]
7487 ptr2 := v_1.Args[0]
7488 if !(isSamePtr(ptr1, ptr2)) {
7489 break
7490 }
7491 v.reset(OpS390XLDGR)
7492 v.AddArg(x)
7493 return true
7494 }
7495 // match: (FMOVDload [off] {sym} ptr1 (FMOVDstore [off] {sym} ptr2 x _))
7496 // cond: isSamePtr(ptr1, ptr2)
7497 // result: x
7498 for {
7499 off := auxIntToInt32(v.AuxInt)
7500 sym := auxToSym(v.Aux)
7501 ptr1 := v_0
7502 if v_1.Op != OpS390XFMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7503 break
7504 }
7505 x := v_1.Args[1]
7506 ptr2 := v_1.Args[0]
7507 if !(isSamePtr(ptr1, ptr2)) {
7508 break
7509 }
7510 v.copyOf(x)
7511 return true
7512 }
7513 // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
7514 // cond: is20Bit(int64(off1)+int64(off2))
7515 // result: (FMOVDload [off1+off2] {sym} ptr mem)
7516 for {
7517 off1 := auxIntToInt32(v.AuxInt)
7518 sym := auxToSym(v.Aux)
7519 if v_0.Op != OpS390XADDconst {
7520 break
7521 }
7522 off2 := auxIntToInt32(v_0.AuxInt)
7523 ptr := v_0.Args[0]
7524 mem := v_1
7525 if !(is20Bit(int64(off1) + int64(off2))) {
7526 break
7527 }
7528 v.reset(OpS390XFMOVDload)
7529 v.AuxInt = int32ToAuxInt(off1 + off2)
7530 v.Aux = symToAux(sym)
7531 v.AddArg2(ptr, mem)
7532 return true
7533 }
7534 // match: (FMOVDload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem)
7535 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
7536 // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem)
7537 for {
7538 off1 := auxIntToInt32(v.AuxInt)
7539 sym1 := auxToSym(v.Aux)
7540 if v_0.Op != OpS390XMOVDaddr {
7541 break
7542 }
7543 off2 := auxIntToInt32(v_0.AuxInt)
7544 sym2 := auxToSym(v_0.Aux)
7545 base := v_0.Args[0]
7546 mem := v_1
7547 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
7548 break
7549 }
7550 v.reset(OpS390XFMOVDload)
7551 v.AuxInt = int32ToAuxInt(off1 + off2)
7552 v.Aux = symToAux(mergeSym(sym1, sym2))
7553 v.AddArg2(base, mem)
7554 return true
7555 }
7556 return false
7557 }
7558 func rewriteValueS390X_OpS390XFMOVDstore(v *Value) bool {
7559 v_2 := v.Args[2]
7560 v_1 := v.Args[1]
7561 v_0 := v.Args[0]
7562 // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
7563 // cond: is20Bit(int64(off1)+int64(off2))
7564 // result: (FMOVDstore [off1+off2] {sym} ptr val mem)
7565 for {
7566 off1 := auxIntToInt32(v.AuxInt)
7567 sym := auxToSym(v.Aux)
7568 if v_0.Op != OpS390XADDconst {
7569 break
7570 }
7571 off2 := auxIntToInt32(v_0.AuxInt)
7572 ptr := v_0.Args[0]
7573 val := v_1
7574 mem := v_2
7575 if !(is20Bit(int64(off1) + int64(off2))) {
7576 break
7577 }
7578 v.reset(OpS390XFMOVDstore)
7579 v.AuxInt = int32ToAuxInt(off1 + off2)
7580 v.Aux = symToAux(sym)
7581 v.AddArg3(ptr, val, mem)
7582 return true
7583 }
7584 // match: (FMOVDstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem)
7585 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
7586 // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
7587 for {
7588 off1 := auxIntToInt32(v.AuxInt)
7589 sym1 := auxToSym(v.Aux)
7590 if v_0.Op != OpS390XMOVDaddr {
7591 break
7592 }
7593 off2 := auxIntToInt32(v_0.AuxInt)
7594 sym2 := auxToSym(v_0.Aux)
7595 base := v_0.Args[0]
7596 val := v_1
7597 mem := v_2
7598 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
7599 break
7600 }
7601 v.reset(OpS390XFMOVDstore)
7602 v.AuxInt = int32ToAuxInt(off1 + off2)
7603 v.Aux = symToAux(mergeSym(sym1, sym2))
7604 v.AddArg3(base, val, mem)
7605 return true
7606 }
7607 return false
7608 }
7609 func rewriteValueS390X_OpS390XFMOVSload(v *Value) bool {
7610 v_1 := v.Args[1]
7611 v_0 := v.Args[0]
7612 // match: (FMOVSload [off] {sym} ptr1 (FMOVSstore [off] {sym} ptr2 x _))
7613 // cond: isSamePtr(ptr1, ptr2)
7614 // result: x
7615 for {
7616 off := auxIntToInt32(v.AuxInt)
7617 sym := auxToSym(v.Aux)
7618 ptr1 := v_0
7619 if v_1.Op != OpS390XFMOVSstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7620 break
7621 }
7622 x := v_1.Args[1]
7623 ptr2 := v_1.Args[0]
7624 if !(isSamePtr(ptr1, ptr2)) {
7625 break
7626 }
7627 v.copyOf(x)
7628 return true
7629 }
7630 // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem)
7631 // cond: is20Bit(int64(off1)+int64(off2))
7632 // result: (FMOVSload [off1+off2] {sym} ptr mem)
7633 for {
7634 off1 := auxIntToInt32(v.AuxInt)
7635 sym := auxToSym(v.Aux)
7636 if v_0.Op != OpS390XADDconst {
7637 break
7638 }
7639 off2 := auxIntToInt32(v_0.AuxInt)
7640 ptr := v_0.Args[0]
7641 mem := v_1
7642 if !(is20Bit(int64(off1) + int64(off2))) {
7643 break
7644 }
7645 v.reset(OpS390XFMOVSload)
7646 v.AuxInt = int32ToAuxInt(off1 + off2)
7647 v.Aux = symToAux(sym)
7648 v.AddArg2(ptr, mem)
7649 return true
7650 }
7651 // match: (FMOVSload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem)
7652 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
7653 // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} base mem)
7654 for {
7655 off1 := auxIntToInt32(v.AuxInt)
7656 sym1 := auxToSym(v.Aux)
7657 if v_0.Op != OpS390XMOVDaddr {
7658 break
7659 }
7660 off2 := auxIntToInt32(v_0.AuxInt)
7661 sym2 := auxToSym(v_0.Aux)
7662 base := v_0.Args[0]
7663 mem := v_1
7664 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
7665 break
7666 }
7667 v.reset(OpS390XFMOVSload)
7668 v.AuxInt = int32ToAuxInt(off1 + off2)
7669 v.Aux = symToAux(mergeSym(sym1, sym2))
7670 v.AddArg2(base, mem)
7671 return true
7672 }
7673 return false
7674 }
7675 func rewriteValueS390X_OpS390XFMOVSstore(v *Value) bool {
7676 v_2 := v.Args[2]
7677 v_1 := v.Args[1]
7678 v_0 := v.Args[0]
7679 // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem)
7680 // cond: is20Bit(int64(off1)+int64(off2))
7681 // result: (FMOVSstore [off1+off2] {sym} ptr val mem)
7682 for {
7683 off1 := auxIntToInt32(v.AuxInt)
7684 sym := auxToSym(v.Aux)
7685 if v_0.Op != OpS390XADDconst {
7686 break
7687 }
7688 off2 := auxIntToInt32(v_0.AuxInt)
7689 ptr := v_0.Args[0]
7690 val := v_1
7691 mem := v_2
7692 if !(is20Bit(int64(off1) + int64(off2))) {
7693 break
7694 }
7695 v.reset(OpS390XFMOVSstore)
7696 v.AuxInt = int32ToAuxInt(off1 + off2)
7697 v.Aux = symToAux(sym)
7698 v.AddArg3(ptr, val, mem)
7699 return true
7700 }
7701 // match: (FMOVSstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem)
7702 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
7703 // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
7704 for {
7705 off1 := auxIntToInt32(v.AuxInt)
7706 sym1 := auxToSym(v.Aux)
7707 if v_0.Op != OpS390XMOVDaddr {
7708 break
7709 }
7710 off2 := auxIntToInt32(v_0.AuxInt)
7711 sym2 := auxToSym(v_0.Aux)
7712 base := v_0.Args[0]
7713 val := v_1
7714 mem := v_2
7715 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
7716 break
7717 }
7718 v.reset(OpS390XFMOVSstore)
7719 v.AuxInt = int32ToAuxInt(off1 + off2)
7720 v.Aux = symToAux(mergeSym(sym1, sym2))
7721 v.AddArg3(base, val, mem)
7722 return true
7723 }
7724 return false
7725 }
7726 func rewriteValueS390X_OpS390XFNEG(v *Value) bool {
7727 v_0 := v.Args[0]
7728 // match: (FNEG (LPDFR x))
7729 // result: (LNDFR x)
7730 for {
7731 if v_0.Op != OpS390XLPDFR {
7732 break
7733 }
7734 x := v_0.Args[0]
7735 v.reset(OpS390XLNDFR)
7736 v.AddArg(x)
7737 return true
7738 }
7739 // match: (FNEG (LNDFR x))
7740 // result: (LPDFR x)
7741 for {
7742 if v_0.Op != OpS390XLNDFR {
7743 break
7744 }
7745 x := v_0.Args[0]
7746 v.reset(OpS390XLPDFR)
7747 v.AddArg(x)
7748 return true
7749 }
7750 return false
7751 }
7752 func rewriteValueS390X_OpS390XFNEGS(v *Value) bool {
7753 v_0 := v.Args[0]
7754 // match: (FNEGS (LPDFR x))
7755 // result: (LNDFR x)
7756 for {
7757 if v_0.Op != OpS390XLPDFR {
7758 break
7759 }
7760 x := v_0.Args[0]
7761 v.reset(OpS390XLNDFR)
7762 v.AddArg(x)
7763 return true
7764 }
7765 // match: (FNEGS (LNDFR x))
7766 // result: (LPDFR x)
7767 for {
7768 if v_0.Op != OpS390XLNDFR {
7769 break
7770 }
7771 x := v_0.Args[0]
7772 v.reset(OpS390XLPDFR)
7773 v.AddArg(x)
7774 return true
7775 }
7776 return false
7777 }
7778 func rewriteValueS390X_OpS390XLDGR(v *Value) bool {
7779 v_0 := v.Args[0]
7780 b := v.Block
7781 // match: (LDGR <t> (RISBGZ x {r}))
7782 // cond: r == s390x.NewRotateParams(1, 63, 0)
7783 // result: (LPDFR (LDGR <t> x))
7784 for {
7785 t := v.Type
7786 if v_0.Op != OpS390XRISBGZ {
7787 break
7788 }
7789 r := auxToS390xRotateParams(v_0.Aux)
7790 x := v_0.Args[0]
7791 if !(r == s390x.NewRotateParams(1, 63, 0)) {
7792 break
7793 }
7794 v.reset(OpS390XLPDFR)
7795 v0 := b.NewValue0(v.Pos, OpS390XLDGR, t)
7796 v0.AddArg(x)
7797 v.AddArg(v0)
7798 return true
7799 }
7800 // match: (LDGR <t> (OR (MOVDconst [-1<<63]) x))
7801 // result: (LNDFR (LDGR <t> x))
7802 for {
7803 t := v.Type
7804 if v_0.Op != OpS390XOR {
7805 break
7806 }
7807 _ = v_0.Args[1]
7808 v_0_0 := v_0.Args[0]
7809 v_0_1 := v_0.Args[1]
7810 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
7811 if v_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0.AuxInt) != -1<<63 {
7812 continue
7813 }
7814 x := v_0_1
7815 v.reset(OpS390XLNDFR)
7816 v0 := b.NewValue0(v.Pos, OpS390XLDGR, t)
7817 v0.AddArg(x)
7818 v.AddArg(v0)
7819 return true
7820 }
7821 break
7822 }
7823 // match: (LDGR <t> x:(ORload <t1> [off] {sym} (MOVDconst [-1<<63]) ptr mem))
7824 // cond: x.Uses == 1 && clobber(x)
7825 // result: @x.Block (LNDFR <t> (LDGR <t> (MOVDload <t1> [off] {sym} ptr mem)))
7826 for {
7827 t := v.Type
7828 x := v_0
7829 if x.Op != OpS390XORload {
7830 break
7831 }
7832 t1 := x.Type
7833 off := auxIntToInt32(x.AuxInt)
7834 sym := auxToSym(x.Aux)
7835 mem := x.Args[2]
7836 x_0 := x.Args[0]
7837 if x_0.Op != OpS390XMOVDconst || auxIntToInt64(x_0.AuxInt) != -1<<63 {
7838 break
7839 }
7840 ptr := x.Args[1]
7841 if !(x.Uses == 1 && clobber(x)) {
7842 break
7843 }
7844 b = x.Block
7845 v0 := b.NewValue0(x.Pos, OpS390XLNDFR, t)
7846 v.copyOf(v0)
7847 v1 := b.NewValue0(x.Pos, OpS390XLDGR, t)
7848 v2 := b.NewValue0(x.Pos, OpS390XMOVDload, t1)
7849 v2.AuxInt = int32ToAuxInt(off)
7850 v2.Aux = symToAux(sym)
7851 v2.AddArg2(ptr, mem)
7852 v1.AddArg(v2)
7853 v0.AddArg(v1)
7854 return true
7855 }
7856 // match: (LDGR (LGDR x))
7857 // result: x
7858 for {
7859 if v_0.Op != OpS390XLGDR {
7860 break
7861 }
7862 x := v_0.Args[0]
7863 v.copyOf(x)
7864 return true
7865 }
7866 return false
7867 }
7868 func rewriteValueS390X_OpS390XLEDBR(v *Value) bool {
7869 v_0 := v.Args[0]
7870 // match: (LEDBR (LPDFR (LDEBR x)))
7871 // result: (LPDFR x)
7872 for {
7873 if v_0.Op != OpS390XLPDFR {
7874 break
7875 }
7876 v_0_0 := v_0.Args[0]
7877 if v_0_0.Op != OpS390XLDEBR {
7878 break
7879 }
7880 x := v_0_0.Args[0]
7881 v.reset(OpS390XLPDFR)
7882 v.AddArg(x)
7883 return true
7884 }
7885 // match: (LEDBR (LNDFR (LDEBR x)))
7886 // result: (LNDFR x)
7887 for {
7888 if v_0.Op != OpS390XLNDFR {
7889 break
7890 }
7891 v_0_0 := v_0.Args[0]
7892 if v_0_0.Op != OpS390XLDEBR {
7893 break
7894 }
7895 x := v_0_0.Args[0]
7896 v.reset(OpS390XLNDFR)
7897 v.AddArg(x)
7898 return true
7899 }
7900 return false
7901 }
7902 func rewriteValueS390X_OpS390XLGDR(v *Value) bool {
7903 v_0 := v.Args[0]
7904 // match: (LGDR (LDGR x))
7905 // result: x
7906 for {
7907 if v_0.Op != OpS390XLDGR {
7908 break
7909 }
7910 x := v_0.Args[0]
7911 v.copyOf(x)
7912 return true
7913 }
7914 return false
7915 }
7916 func rewriteValueS390X_OpS390XLOCGR(v *Value) bool {
7917 v_2 := v.Args[2]
7918 v_1 := v.Args[1]
7919 v_0 := v.Args[0]
7920 // match: (LOCGR {c} x y (InvertFlags cmp))
7921 // result: (LOCGR {c.ReverseComparison()} x y cmp)
7922 for {
7923 c := auxToS390xCCMask(v.Aux)
7924 x := v_0
7925 y := v_1
7926 if v_2.Op != OpS390XInvertFlags {
7927 break
7928 }
7929 cmp := v_2.Args[0]
7930 v.reset(OpS390XLOCGR)
7931 v.Aux = s390xCCMaskToAux(c.ReverseComparison())
7932 v.AddArg3(x, y, cmp)
7933 return true
7934 }
7935 // match: (LOCGR {c} _ x (FlagEQ))
7936 // cond: c&s390x.Equal != 0
7937 // result: x
7938 for {
7939 c := auxToS390xCCMask(v.Aux)
7940 x := v_1
7941 if v_2.Op != OpS390XFlagEQ || !(c&s390x.Equal != 0) {
7942 break
7943 }
7944 v.copyOf(x)
7945 return true
7946 }
7947 // match: (LOCGR {c} _ x (FlagLT))
7948 // cond: c&s390x.Less != 0
7949 // result: x
7950 for {
7951 c := auxToS390xCCMask(v.Aux)
7952 x := v_1
7953 if v_2.Op != OpS390XFlagLT || !(c&s390x.Less != 0) {
7954 break
7955 }
7956 v.copyOf(x)
7957 return true
7958 }
7959 // match: (LOCGR {c} _ x (FlagGT))
7960 // cond: c&s390x.Greater != 0
7961 // result: x
7962 for {
7963 c := auxToS390xCCMask(v.Aux)
7964 x := v_1
7965 if v_2.Op != OpS390XFlagGT || !(c&s390x.Greater != 0) {
7966 break
7967 }
7968 v.copyOf(x)
7969 return true
7970 }
7971 // match: (LOCGR {c} _ x (FlagOV))
7972 // cond: c&s390x.Unordered != 0
7973 // result: x
7974 for {
7975 c := auxToS390xCCMask(v.Aux)
7976 x := v_1
7977 if v_2.Op != OpS390XFlagOV || !(c&s390x.Unordered != 0) {
7978 break
7979 }
7980 v.copyOf(x)
7981 return true
7982 }
7983 // match: (LOCGR {c} x _ (FlagEQ))
7984 // cond: c&s390x.Equal == 0
7985 // result: x
7986 for {
7987 c := auxToS390xCCMask(v.Aux)
7988 x := v_0
7989 if v_2.Op != OpS390XFlagEQ || !(c&s390x.Equal == 0) {
7990 break
7991 }
7992 v.copyOf(x)
7993 return true
7994 }
7995 // match: (LOCGR {c} x _ (FlagLT))
7996 // cond: c&s390x.Less == 0
7997 // result: x
7998 for {
7999 c := auxToS390xCCMask(v.Aux)
8000 x := v_0
8001 if v_2.Op != OpS390XFlagLT || !(c&s390x.Less == 0) {
8002 break
8003 }
8004 v.copyOf(x)
8005 return true
8006 }
8007 // match: (LOCGR {c} x _ (FlagGT))
8008 // cond: c&s390x.Greater == 0
8009 // result: x
8010 for {
8011 c := auxToS390xCCMask(v.Aux)
8012 x := v_0
8013 if v_2.Op != OpS390XFlagGT || !(c&s390x.Greater == 0) {
8014 break
8015 }
8016 v.copyOf(x)
8017 return true
8018 }
8019 // match: (LOCGR {c} x _ (FlagOV))
8020 // cond: c&s390x.Unordered == 0
8021 // result: x
8022 for {
8023 c := auxToS390xCCMask(v.Aux)
8024 x := v_0
8025 if v_2.Op != OpS390XFlagOV || !(c&s390x.Unordered == 0) {
8026 break
8027 }
8028 v.copyOf(x)
8029 return true
8030 }
8031 return false
8032 }
8033 func rewriteValueS390X_OpS390XLTDBR(v *Value) bool {
8034 v_0 := v.Args[0]
8035 b := v.Block
8036 // match: (LTDBR (Select0 x:(FADD _ _)))
8037 // cond: b == x.Block
8038 // result: (Select1 x)
8039 for {
8040 if v_0.Op != OpSelect0 {
8041 break
8042 }
8043 x := v_0.Args[0]
8044 if x.Op != OpS390XFADD || !(b == x.Block) {
8045 break
8046 }
8047 v.reset(OpSelect1)
8048 v.AddArg(x)
8049 return true
8050 }
8051 // match: (LTDBR (Select0 x:(FSUB _ _)))
8052 // cond: b == x.Block
8053 // result: (Select1 x)
8054 for {
8055 if v_0.Op != OpSelect0 {
8056 break
8057 }
8058 x := v_0.Args[0]
8059 if x.Op != OpS390XFSUB || !(b == x.Block) {
8060 break
8061 }
8062 v.reset(OpSelect1)
8063 v.AddArg(x)
8064 return true
8065 }
8066 return false
8067 }
8068 func rewriteValueS390X_OpS390XLTEBR(v *Value) bool {
8069 v_0 := v.Args[0]
8070 b := v.Block
8071 // match: (LTEBR (Select0 x:(FADDS _ _)))
8072 // cond: b == x.Block
8073 // result: (Select1 x)
8074 for {
8075 if v_0.Op != OpSelect0 {
8076 break
8077 }
8078 x := v_0.Args[0]
8079 if x.Op != OpS390XFADDS || !(b == x.Block) {
8080 break
8081 }
8082 v.reset(OpSelect1)
8083 v.AddArg(x)
8084 return true
8085 }
8086 // match: (LTEBR (Select0 x:(FSUBS _ _)))
8087 // cond: b == x.Block
8088 // result: (Select1 x)
8089 for {
8090 if v_0.Op != OpSelect0 {
8091 break
8092 }
8093 x := v_0.Args[0]
8094 if x.Op != OpS390XFSUBS || !(b == x.Block) {
8095 break
8096 }
8097 v.reset(OpSelect1)
8098 v.AddArg(x)
8099 return true
8100 }
8101 return false
8102 }
8103 func rewriteValueS390X_OpS390XLoweredPanicBoundsCR(v *Value) bool {
8104 v_1 := v.Args[1]
8105 v_0 := v.Args[0]
8106 // match: (LoweredPanicBoundsCR [kind] {p} (MOVDconst [c]) mem)
8107 // result: (LoweredPanicBoundsCC [kind] {PanicBoundsCC{Cx:p.C, Cy:c}} mem)
8108 for {
8109 kind := auxIntToInt64(v.AuxInt)
8110 p := auxToPanicBoundsC(v.Aux)
8111 if v_0.Op != OpS390XMOVDconst {
8112 break
8113 }
8114 c := auxIntToInt64(v_0.AuxInt)
8115 mem := v_1
8116 v.reset(OpS390XLoweredPanicBoundsCC)
8117 v.AuxInt = int64ToAuxInt(kind)
8118 v.Aux = panicBoundsCCToAux(PanicBoundsCC{Cx: p.C, Cy: c})
8119 v.AddArg(mem)
8120 return true
8121 }
8122 return false
8123 }
8124 func rewriteValueS390X_OpS390XLoweredPanicBoundsRC(v *Value) bool {
8125 v_1 := v.Args[1]
8126 v_0 := v.Args[0]
8127 // match: (LoweredPanicBoundsRC [kind] {p} (MOVDconst [c]) mem)
8128 // result: (LoweredPanicBoundsCC [kind] {PanicBoundsCC{Cx:c, Cy:p.C}} mem)
8129 for {
8130 kind := auxIntToInt64(v.AuxInt)
8131 p := auxToPanicBoundsC(v.Aux)
8132 if v_0.Op != OpS390XMOVDconst {
8133 break
8134 }
8135 c := auxIntToInt64(v_0.AuxInt)
8136 mem := v_1
8137 v.reset(OpS390XLoweredPanicBoundsCC)
8138 v.AuxInt = int64ToAuxInt(kind)
8139 v.Aux = panicBoundsCCToAux(PanicBoundsCC{Cx: c, Cy: p.C})
8140 v.AddArg(mem)
8141 return true
8142 }
8143 return false
8144 }
8145 func rewriteValueS390X_OpS390XLoweredPanicBoundsRR(v *Value) bool {
8146 v_2 := v.Args[2]
8147 v_1 := v.Args[1]
8148 v_0 := v.Args[0]
8149 // match: (LoweredPanicBoundsRR [kind] x (MOVDconst [c]) mem)
8150 // result: (LoweredPanicBoundsRC [kind] x {PanicBoundsC{C:c}} mem)
8151 for {
8152 kind := auxIntToInt64(v.AuxInt)
8153 x := v_0
8154 if v_1.Op != OpS390XMOVDconst {
8155 break
8156 }
8157 c := auxIntToInt64(v_1.AuxInt)
8158 mem := v_2
8159 v.reset(OpS390XLoweredPanicBoundsRC)
8160 v.AuxInt = int64ToAuxInt(kind)
8161 v.Aux = panicBoundsCToAux(PanicBoundsC{C: c})
8162 v.AddArg2(x, mem)
8163 return true
8164 }
8165 // match: (LoweredPanicBoundsRR [kind] (MOVDconst [c]) y mem)
8166 // result: (LoweredPanicBoundsCR [kind] {PanicBoundsC{C:c}} y mem)
8167 for {
8168 kind := auxIntToInt64(v.AuxInt)
8169 if v_0.Op != OpS390XMOVDconst {
8170 break
8171 }
8172 c := auxIntToInt64(v_0.AuxInt)
8173 y := v_1
8174 mem := v_2
8175 v.reset(OpS390XLoweredPanicBoundsCR)
8176 v.AuxInt = int64ToAuxInt(kind)
8177 v.Aux = panicBoundsCToAux(PanicBoundsC{C: c})
8178 v.AddArg2(y, mem)
8179 return true
8180 }
8181 return false
8182 }
8183 func rewriteValueS390X_OpS390XLoweredRound32F(v *Value) bool {
8184 v_0 := v.Args[0]
8185 // match: (LoweredRound32F x:(FMOVSconst))
8186 // result: x
8187 for {
8188 x := v_0
8189 if x.Op != OpS390XFMOVSconst {
8190 break
8191 }
8192 v.copyOf(x)
8193 return true
8194 }
8195 return false
8196 }
8197 func rewriteValueS390X_OpS390XLoweredRound64F(v *Value) bool {
8198 v_0 := v.Args[0]
8199 // match: (LoweredRound64F x:(FMOVDconst))
8200 // result: x
8201 for {
8202 x := v_0
8203 if x.Op != OpS390XFMOVDconst {
8204 break
8205 }
8206 v.copyOf(x)
8207 return true
8208 }
8209 return false
8210 }
8211 func rewriteValueS390X_OpS390XMOVBZload(v *Value) bool {
8212 v_1 := v.Args[1]
8213 v_0 := v.Args[0]
8214 // match: (MOVBZload [off] {sym} ptr1 (MOVBstore [off] {sym} ptr2 x _))
8215 // cond: isSamePtr(ptr1, ptr2)
8216 // result: (MOVBZreg x)
8217 for {
8218 off := auxIntToInt32(v.AuxInt)
8219 sym := auxToSym(v.Aux)
8220 ptr1 := v_0
8221 if v_1.Op != OpS390XMOVBstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
8222 break
8223 }
8224 x := v_1.Args[1]
8225 ptr2 := v_1.Args[0]
8226 if !(isSamePtr(ptr1, ptr2)) {
8227 break
8228 }
8229 v.reset(OpS390XMOVBZreg)
8230 v.AddArg(x)
8231 return true
8232 }
8233 // match: (MOVBZload [off1] {sym} (ADDconst [off2] ptr) mem)
8234 // cond: is20Bit(int64(off1)+int64(off2))
8235 // result: (MOVBZload [off1+off2] {sym} ptr mem)
8236 for {
8237 off1 := auxIntToInt32(v.AuxInt)
8238 sym := auxToSym(v.Aux)
8239 if v_0.Op != OpS390XADDconst {
8240 break
8241 }
8242 off2 := auxIntToInt32(v_0.AuxInt)
8243 ptr := v_0.Args[0]
8244 mem := v_1
8245 if !(is20Bit(int64(off1) + int64(off2))) {
8246 break
8247 }
8248 v.reset(OpS390XMOVBZload)
8249 v.AuxInt = int32ToAuxInt(off1 + off2)
8250 v.Aux = symToAux(sym)
8251 v.AddArg2(ptr, mem)
8252 return true
8253 }
8254 // match: (MOVBZload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem)
8255 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
8256 // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} base mem)
8257 for {
8258 off1 := auxIntToInt32(v.AuxInt)
8259 sym1 := auxToSym(v.Aux)
8260 if v_0.Op != OpS390XMOVDaddr {
8261 break
8262 }
8263 off2 := auxIntToInt32(v_0.AuxInt)
8264 sym2 := auxToSym(v_0.Aux)
8265 base := v_0.Args[0]
8266 mem := v_1
8267 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
8268 break
8269 }
8270 v.reset(OpS390XMOVBZload)
8271 v.AuxInt = int32ToAuxInt(off1 + off2)
8272 v.Aux = symToAux(mergeSym(sym1, sym2))
8273 v.AddArg2(base, mem)
8274 return true
8275 }
8276 return false
8277 }
8278 func rewriteValueS390X_OpS390XMOVBZreg(v *Value) bool {
8279 v_0 := v.Args[0]
8280 b := v.Block
8281 typ := &b.Func.Config.Types
8282 // match: (MOVBZreg e:(MOVBreg x))
8283 // cond: clobberIfDead(e)
8284 // result: (MOVBZreg x)
8285 for {
8286 e := v_0
8287 if e.Op != OpS390XMOVBreg {
8288 break
8289 }
8290 x := e.Args[0]
8291 if !(clobberIfDead(e)) {
8292 break
8293 }
8294 v.reset(OpS390XMOVBZreg)
8295 v.AddArg(x)
8296 return true
8297 }
8298 // match: (MOVBZreg e:(MOVHreg x))
8299 // cond: clobberIfDead(e)
8300 // result: (MOVBZreg x)
8301 for {
8302 e := v_0
8303 if e.Op != OpS390XMOVHreg {
8304 break
8305 }
8306 x := e.Args[0]
8307 if !(clobberIfDead(e)) {
8308 break
8309 }
8310 v.reset(OpS390XMOVBZreg)
8311 v.AddArg(x)
8312 return true
8313 }
8314 // match: (MOVBZreg e:(MOVWreg x))
8315 // cond: clobberIfDead(e)
8316 // result: (MOVBZreg x)
8317 for {
8318 e := v_0
8319 if e.Op != OpS390XMOVWreg {
8320 break
8321 }
8322 x := e.Args[0]
8323 if !(clobberIfDead(e)) {
8324 break
8325 }
8326 v.reset(OpS390XMOVBZreg)
8327 v.AddArg(x)
8328 return true
8329 }
8330 // match: (MOVBZreg e:(MOVBZreg x))
8331 // cond: clobberIfDead(e)
8332 // result: (MOVBZreg x)
8333 for {
8334 e := v_0
8335 if e.Op != OpS390XMOVBZreg {
8336 break
8337 }
8338 x := e.Args[0]
8339 if !(clobberIfDead(e)) {
8340 break
8341 }
8342 v.reset(OpS390XMOVBZreg)
8343 v.AddArg(x)
8344 return true
8345 }
8346 // match: (MOVBZreg e:(MOVHZreg x))
8347 // cond: clobberIfDead(e)
8348 // result: (MOVBZreg x)
8349 for {
8350 e := v_0
8351 if e.Op != OpS390XMOVHZreg {
8352 break
8353 }
8354 x := e.Args[0]
8355 if !(clobberIfDead(e)) {
8356 break
8357 }
8358 v.reset(OpS390XMOVBZreg)
8359 v.AddArg(x)
8360 return true
8361 }
8362 // match: (MOVBZreg e:(MOVWZreg x))
8363 // cond: clobberIfDead(e)
8364 // result: (MOVBZreg x)
8365 for {
8366 e := v_0
8367 if e.Op != OpS390XMOVWZreg {
8368 break
8369 }
8370 x := e.Args[0]
8371 if !(clobberIfDead(e)) {
8372 break
8373 }
8374 v.reset(OpS390XMOVBZreg)
8375 v.AddArg(x)
8376 return true
8377 }
8378 // match: (MOVBZreg x:(MOVBZload _ _))
8379 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
8380 // result: x
8381 for {
8382 x := v_0
8383 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
8384 break
8385 }
8386 v.copyOf(x)
8387 return true
8388 }
8389 // match: (MOVBZreg <t> x:(MOVBload [o] {s} p mem))
8390 // cond: x.Uses == 1 && clobber(x)
8391 // result: @x.Block (MOVBZload <t> [o] {s} p mem)
8392 for {
8393 t := v.Type
8394 x := v_0
8395 if x.Op != OpS390XMOVBload {
8396 break
8397 }
8398 o := auxIntToInt32(x.AuxInt)
8399 s := auxToSym(x.Aux)
8400 mem := x.Args[1]
8401 p := x.Args[0]
8402 if !(x.Uses == 1 && clobber(x)) {
8403 break
8404 }
8405 b = x.Block
8406 v0 := b.NewValue0(x.Pos, OpS390XMOVBZload, t)
8407 v.copyOf(v0)
8408 v0.AuxInt = int32ToAuxInt(o)
8409 v0.Aux = symToAux(s)
8410 v0.AddArg2(p, mem)
8411 return true
8412 }
8413 // match: (MOVBZreg x:(Arg <t>))
8414 // cond: !t.IsSigned() && t.Size() == 1
8415 // result: x
8416 for {
8417 x := v_0
8418 if x.Op != OpArg {
8419 break
8420 }
8421 t := x.Type
8422 if !(!t.IsSigned() && t.Size() == 1) {
8423 break
8424 }
8425 v.copyOf(x)
8426 return true
8427 }
8428 // match: (MOVBZreg (MOVDconst [c]))
8429 // result: (MOVDconst [int64( uint8(c))])
8430 for {
8431 if v_0.Op != OpS390XMOVDconst {
8432 break
8433 }
8434 c := auxIntToInt64(v_0.AuxInt)
8435 v.reset(OpS390XMOVDconst)
8436 v.AuxInt = int64ToAuxInt(int64(uint8(c)))
8437 return true
8438 }
8439 // match: (MOVBZreg x:(LOCGR (MOVDconst [c]) (MOVDconst [d]) _))
8440 // cond: int64(uint8(c)) == c && int64(uint8(d)) == d && (!x.Type.IsSigned() || x.Type.Size() > 1)
8441 // result: x
8442 for {
8443 x := v_0
8444 if x.Op != OpS390XLOCGR {
8445 break
8446 }
8447 _ = x.Args[1]
8448 x_0 := x.Args[0]
8449 if x_0.Op != OpS390XMOVDconst {
8450 break
8451 }
8452 c := auxIntToInt64(x_0.AuxInt)
8453 x_1 := x.Args[1]
8454 if x_1.Op != OpS390XMOVDconst {
8455 break
8456 }
8457 d := auxIntToInt64(x_1.AuxInt)
8458 if !(int64(uint8(c)) == c && int64(uint8(d)) == d && (!x.Type.IsSigned() || x.Type.Size() > 1)) {
8459 break
8460 }
8461 v.copyOf(x)
8462 return true
8463 }
8464 // match: (MOVBZreg (RISBGZ x {r}))
8465 // cond: r.OutMerge(0x000000ff) != nil
8466 // result: (RISBGZ x {*r.OutMerge(0x000000ff)})
8467 for {
8468 if v_0.Op != OpS390XRISBGZ {
8469 break
8470 }
8471 r := auxToS390xRotateParams(v_0.Aux)
8472 x := v_0.Args[0]
8473 if !(r.OutMerge(0x000000ff) != nil) {
8474 break
8475 }
8476 v.reset(OpS390XRISBGZ)
8477 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0x000000ff))
8478 v.AddArg(x)
8479 return true
8480 }
8481 // match: (MOVBZreg (ANDWconst [m] x))
8482 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x))
8483 for {
8484 if v_0.Op != OpS390XANDWconst {
8485 break
8486 }
8487 m := auxIntToInt32(v_0.AuxInt)
8488 x := v_0.Args[0]
8489 v.reset(OpS390XMOVWZreg)
8490 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
8491 v0.AuxInt = int32ToAuxInt(int32(uint8(m)))
8492 v0.AddArg(x)
8493 v.AddArg(v0)
8494 return true
8495 }
8496 return false
8497 }
8498 func rewriteValueS390X_OpS390XMOVBload(v *Value) bool {
8499 v_1 := v.Args[1]
8500 v_0 := v.Args[0]
8501 // match: (MOVBload [off] {sym} ptr1 (MOVBstore [off] {sym} ptr2 x _))
8502 // cond: isSamePtr(ptr1, ptr2)
8503 // result: (MOVBreg x)
8504 for {
8505 off := auxIntToInt32(v.AuxInt)
8506 sym := auxToSym(v.Aux)
8507 ptr1 := v_0
8508 if v_1.Op != OpS390XMOVBstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
8509 break
8510 }
8511 x := v_1.Args[1]
8512 ptr2 := v_1.Args[0]
8513 if !(isSamePtr(ptr1, ptr2)) {
8514 break
8515 }
8516 v.reset(OpS390XMOVBreg)
8517 v.AddArg(x)
8518 return true
8519 }
8520 // match: (MOVBload [off1] {sym} (ADDconst [off2] ptr) mem)
8521 // cond: is20Bit(int64(off1)+int64(off2))
8522 // result: (MOVBload [off1+off2] {sym} ptr mem)
8523 for {
8524 off1 := auxIntToInt32(v.AuxInt)
8525 sym := auxToSym(v.Aux)
8526 if v_0.Op != OpS390XADDconst {
8527 break
8528 }
8529 off2 := auxIntToInt32(v_0.AuxInt)
8530 ptr := v_0.Args[0]
8531 mem := v_1
8532 if !(is20Bit(int64(off1) + int64(off2))) {
8533 break
8534 }
8535 v.reset(OpS390XMOVBload)
8536 v.AuxInt = int32ToAuxInt(off1 + off2)
8537 v.Aux = symToAux(sym)
8538 v.AddArg2(ptr, mem)
8539 return true
8540 }
8541 // match: (MOVBload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem)
8542 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
8543 // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem)
8544 for {
8545 off1 := auxIntToInt32(v.AuxInt)
8546 sym1 := auxToSym(v.Aux)
8547 if v_0.Op != OpS390XMOVDaddr {
8548 break
8549 }
8550 off2 := auxIntToInt32(v_0.AuxInt)
8551 sym2 := auxToSym(v_0.Aux)
8552 base := v_0.Args[0]
8553 mem := v_1
8554 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
8555 break
8556 }
8557 v.reset(OpS390XMOVBload)
8558 v.AuxInt = int32ToAuxInt(off1 + off2)
8559 v.Aux = symToAux(mergeSym(sym1, sym2))
8560 v.AddArg2(base, mem)
8561 return true
8562 }
8563 return false
8564 }
8565 func rewriteValueS390X_OpS390XMOVBreg(v *Value) bool {
8566 v_0 := v.Args[0]
8567 b := v.Block
8568 typ := &b.Func.Config.Types
8569 // match: (MOVBreg e:(MOVBreg x))
8570 // cond: clobberIfDead(e)
8571 // result: (MOVBreg x)
8572 for {
8573 e := v_0
8574 if e.Op != OpS390XMOVBreg {
8575 break
8576 }
8577 x := e.Args[0]
8578 if !(clobberIfDead(e)) {
8579 break
8580 }
8581 v.reset(OpS390XMOVBreg)
8582 v.AddArg(x)
8583 return true
8584 }
8585 // match: (MOVBreg e:(MOVHreg x))
8586 // cond: clobberIfDead(e)
8587 // result: (MOVBreg x)
8588 for {
8589 e := v_0
8590 if e.Op != OpS390XMOVHreg {
8591 break
8592 }
8593 x := e.Args[0]
8594 if !(clobberIfDead(e)) {
8595 break
8596 }
8597 v.reset(OpS390XMOVBreg)
8598 v.AddArg(x)
8599 return true
8600 }
8601 // match: (MOVBreg e:(MOVWreg x))
8602 // cond: clobberIfDead(e)
8603 // result: (MOVBreg x)
8604 for {
8605 e := v_0
8606 if e.Op != OpS390XMOVWreg {
8607 break
8608 }
8609 x := e.Args[0]
8610 if !(clobberIfDead(e)) {
8611 break
8612 }
8613 v.reset(OpS390XMOVBreg)
8614 v.AddArg(x)
8615 return true
8616 }
8617 // match: (MOVBreg e:(MOVBZreg x))
8618 // cond: clobberIfDead(e)
8619 // result: (MOVBreg x)
8620 for {
8621 e := v_0
8622 if e.Op != OpS390XMOVBZreg {
8623 break
8624 }
8625 x := e.Args[0]
8626 if !(clobberIfDead(e)) {
8627 break
8628 }
8629 v.reset(OpS390XMOVBreg)
8630 v.AddArg(x)
8631 return true
8632 }
8633 // match: (MOVBreg e:(MOVHZreg x))
8634 // cond: clobberIfDead(e)
8635 // result: (MOVBreg x)
8636 for {
8637 e := v_0
8638 if e.Op != OpS390XMOVHZreg {
8639 break
8640 }
8641 x := e.Args[0]
8642 if !(clobberIfDead(e)) {
8643 break
8644 }
8645 v.reset(OpS390XMOVBreg)
8646 v.AddArg(x)
8647 return true
8648 }
8649 // match: (MOVBreg e:(MOVWZreg x))
8650 // cond: clobberIfDead(e)
8651 // result: (MOVBreg x)
8652 for {
8653 e := v_0
8654 if e.Op != OpS390XMOVWZreg {
8655 break
8656 }
8657 x := e.Args[0]
8658 if !(clobberIfDead(e)) {
8659 break
8660 }
8661 v.reset(OpS390XMOVBreg)
8662 v.AddArg(x)
8663 return true
8664 }
8665 // match: (MOVBreg x:(MOVBload _ _))
8666 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
8667 // result: x
8668 for {
8669 x := v_0
8670 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
8671 break
8672 }
8673 v.copyOf(x)
8674 return true
8675 }
8676 // match: (MOVBreg <t> x:(MOVBZload [o] {s} p mem))
8677 // cond: x.Uses == 1 && clobber(x)
8678 // result: @x.Block (MOVBload <t> [o] {s} p mem)
8679 for {
8680 t := v.Type
8681 x := v_0
8682 if x.Op != OpS390XMOVBZload {
8683 break
8684 }
8685 o := auxIntToInt32(x.AuxInt)
8686 s := auxToSym(x.Aux)
8687 mem := x.Args[1]
8688 p := x.Args[0]
8689 if !(x.Uses == 1 && clobber(x)) {
8690 break
8691 }
8692 b = x.Block
8693 v0 := b.NewValue0(x.Pos, OpS390XMOVBload, t)
8694 v.copyOf(v0)
8695 v0.AuxInt = int32ToAuxInt(o)
8696 v0.Aux = symToAux(s)
8697 v0.AddArg2(p, mem)
8698 return true
8699 }
8700 // match: (MOVBreg x:(Arg <t>))
8701 // cond: t.IsSigned() && t.Size() == 1
8702 // result: x
8703 for {
8704 x := v_0
8705 if x.Op != OpArg {
8706 break
8707 }
8708 t := x.Type
8709 if !(t.IsSigned() && t.Size() == 1) {
8710 break
8711 }
8712 v.copyOf(x)
8713 return true
8714 }
8715 // match: (MOVBreg (MOVDconst [c]))
8716 // result: (MOVDconst [int64( int8(c))])
8717 for {
8718 if v_0.Op != OpS390XMOVDconst {
8719 break
8720 }
8721 c := auxIntToInt64(v_0.AuxInt)
8722 v.reset(OpS390XMOVDconst)
8723 v.AuxInt = int64ToAuxInt(int64(int8(c)))
8724 return true
8725 }
8726 // match: (MOVBreg (ANDWconst [m] x))
8727 // cond: int8(m) >= 0
8728 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x))
8729 for {
8730 if v_0.Op != OpS390XANDWconst {
8731 break
8732 }
8733 m := auxIntToInt32(v_0.AuxInt)
8734 x := v_0.Args[0]
8735 if !(int8(m) >= 0) {
8736 break
8737 }
8738 v.reset(OpS390XMOVWZreg)
8739 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
8740 v0.AuxInt = int32ToAuxInt(int32(uint8(m)))
8741 v0.AddArg(x)
8742 v.AddArg(v0)
8743 return true
8744 }
8745 return false
8746 }
8747 func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool {
8748 v_2 := v.Args[2]
8749 v_1 := v.Args[1]
8750 v_0 := v.Args[0]
8751 // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem)
8752 // result: (MOVBstore [off] {sym} ptr x mem)
8753 for {
8754 off := auxIntToInt32(v.AuxInt)
8755 sym := auxToSym(v.Aux)
8756 ptr := v_0
8757 if v_1.Op != OpS390XMOVBreg {
8758 break
8759 }
8760 x := v_1.Args[0]
8761 mem := v_2
8762 v.reset(OpS390XMOVBstore)
8763 v.AuxInt = int32ToAuxInt(off)
8764 v.Aux = symToAux(sym)
8765 v.AddArg3(ptr, x, mem)
8766 return true
8767 }
8768 // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem)
8769 // result: (MOVBstore [off] {sym} ptr x mem)
8770 for {
8771 off := auxIntToInt32(v.AuxInt)
8772 sym := auxToSym(v.Aux)
8773 ptr := v_0
8774 if v_1.Op != OpS390XMOVBZreg {
8775 break
8776 }
8777 x := v_1.Args[0]
8778 mem := v_2
8779 v.reset(OpS390XMOVBstore)
8780 v.AuxInt = int32ToAuxInt(off)
8781 v.Aux = symToAux(sym)
8782 v.AddArg3(ptr, x, mem)
8783 return true
8784 }
8785 // match: (MOVBstore [off1] {sym} (ADDconst [off2] ptr) val mem)
8786 // cond: is20Bit(int64(off1)+int64(off2))
8787 // result: (MOVBstore [off1+off2] {sym} ptr val mem)
8788 for {
8789 off1 := auxIntToInt32(v.AuxInt)
8790 sym := auxToSym(v.Aux)
8791 if v_0.Op != OpS390XADDconst {
8792 break
8793 }
8794 off2 := auxIntToInt32(v_0.AuxInt)
8795 ptr := v_0.Args[0]
8796 val := v_1
8797 mem := v_2
8798 if !(is20Bit(int64(off1) + int64(off2))) {
8799 break
8800 }
8801 v.reset(OpS390XMOVBstore)
8802 v.AuxInt = int32ToAuxInt(off1 + off2)
8803 v.Aux = symToAux(sym)
8804 v.AddArg3(ptr, val, mem)
8805 return true
8806 }
8807 // match: (MOVBstore [off] {sym} ptr (MOVDconst [c]) mem)
8808 // cond: is20Bit(int64(off)) && ptr.Op != OpSB
8809 // result: (MOVBstoreconst [makeValAndOff(int32(int8(c)),off)] {sym} ptr mem)
8810 for {
8811 off := auxIntToInt32(v.AuxInt)
8812 sym := auxToSym(v.Aux)
8813 ptr := v_0
8814 if v_1.Op != OpS390XMOVDconst {
8815 break
8816 }
8817 c := auxIntToInt64(v_1.AuxInt)
8818 mem := v_2
8819 if !(is20Bit(int64(off)) && ptr.Op != OpSB) {
8820 break
8821 }
8822 v.reset(OpS390XMOVBstoreconst)
8823 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int8(c)), off))
8824 v.Aux = symToAux(sym)
8825 v.AddArg2(ptr, mem)
8826 return true
8827 }
8828 // match: (MOVBstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem)
8829 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
8830 // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
8831 for {
8832 off1 := auxIntToInt32(v.AuxInt)
8833 sym1 := auxToSym(v.Aux)
8834 if v_0.Op != OpS390XMOVDaddr {
8835 break
8836 }
8837 off2 := auxIntToInt32(v_0.AuxInt)
8838 sym2 := auxToSym(v_0.Aux)
8839 base := v_0.Args[0]
8840 val := v_1
8841 mem := v_2
8842 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
8843 break
8844 }
8845 v.reset(OpS390XMOVBstore)
8846 v.AuxInt = int32ToAuxInt(off1 + off2)
8847 v.Aux = symToAux(mergeSym(sym1, sym2))
8848 v.AddArg3(base, val, mem)
8849 return true
8850 }
8851 return false
8852 }
8853 func rewriteValueS390X_OpS390XMOVBstoreconst(v *Value) bool {
8854 v_1 := v.Args[1]
8855 v_0 := v.Args[0]
8856 // match: (MOVBstoreconst [sc] {s} (ADDconst [off] ptr) mem)
8857 // cond: is20Bit(sc.Off64()+int64(off))
8858 // result: (MOVBstoreconst [sc.addOffset32(off)] {s} ptr mem)
8859 for {
8860 sc := auxIntToValAndOff(v.AuxInt)
8861 s := auxToSym(v.Aux)
8862 if v_0.Op != OpS390XADDconst {
8863 break
8864 }
8865 off := auxIntToInt32(v_0.AuxInt)
8866 ptr := v_0.Args[0]
8867 mem := v_1
8868 if !(is20Bit(sc.Off64() + int64(off))) {
8869 break
8870 }
8871 v.reset(OpS390XMOVBstoreconst)
8872 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
8873 v.Aux = symToAux(s)
8874 v.AddArg2(ptr, mem)
8875 return true
8876 }
8877 // match: (MOVBstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem)
8878 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)
8879 // result: (MOVBstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
8880 for {
8881 sc := auxIntToValAndOff(v.AuxInt)
8882 sym1 := auxToSym(v.Aux)
8883 if v_0.Op != OpS390XMOVDaddr {
8884 break
8885 }
8886 off := auxIntToInt32(v_0.AuxInt)
8887 sym2 := auxToSym(v_0.Aux)
8888 ptr := v_0.Args[0]
8889 mem := v_1
8890 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) {
8891 break
8892 }
8893 v.reset(OpS390XMOVBstoreconst)
8894 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
8895 v.Aux = symToAux(mergeSym(sym1, sym2))
8896 v.AddArg2(ptr, mem)
8897 return true
8898 }
8899 return false
8900 }
8901 func rewriteValueS390X_OpS390XMOVDBR(v *Value) bool {
8902 v_0 := v.Args[0]
8903 b := v.Block
8904 typ := &b.Func.Config.Types
8905 // match: (MOVDBR x:(MOVDload [off] {sym} ptr mem))
8906 // cond: x.Uses == 1
8907 // result: @x.Block (MOVDBRload [off] {sym} ptr mem)
8908 for {
8909 x := v_0
8910 if x.Op != OpS390XMOVDload {
8911 break
8912 }
8913 off := auxIntToInt32(x.AuxInt)
8914 sym := auxToSym(x.Aux)
8915 mem := x.Args[1]
8916 ptr := x.Args[0]
8917 if !(x.Uses == 1) {
8918 break
8919 }
8920 b = x.Block
8921 v0 := b.NewValue0(x.Pos, OpS390XMOVDBRload, typ.UInt64)
8922 v.copyOf(v0)
8923 v0.AuxInt = int32ToAuxInt(off)
8924 v0.Aux = symToAux(sym)
8925 v0.AddArg2(ptr, mem)
8926 return true
8927 }
8928 // match: (MOVDBR x:(MOVDloadidx [off] {sym} ptr idx mem))
8929 // cond: x.Uses == 1
8930 // result: @x.Block (MOVDBRloadidx [off] {sym} ptr idx mem)
8931 for {
8932 x := v_0
8933 if x.Op != OpS390XMOVDloadidx {
8934 break
8935 }
8936 off := auxIntToInt32(x.AuxInt)
8937 sym := auxToSym(x.Aux)
8938 mem := x.Args[2]
8939 ptr := x.Args[0]
8940 idx := x.Args[1]
8941 if !(x.Uses == 1) {
8942 break
8943 }
8944 b = x.Block
8945 v0 := b.NewValue0(v.Pos, OpS390XMOVDBRloadidx, typ.Int64)
8946 v.copyOf(v0)
8947 v0.AuxInt = int32ToAuxInt(off)
8948 v0.Aux = symToAux(sym)
8949 v0.AddArg3(ptr, idx, mem)
8950 return true
8951 }
8952 return false
8953 }
8954 func rewriteValueS390X_OpS390XMOVDaddridx(v *Value) bool {
8955 v_1 := v.Args[1]
8956 v_0 := v.Args[0]
8957 // match: (MOVDaddridx [c] {s} (ADDconst [d] x) y)
8958 // cond: is20Bit(int64(c)+int64(d))
8959 // result: (MOVDaddridx [c+d] {s} x y)
8960 for {
8961 c := auxIntToInt32(v.AuxInt)
8962 s := auxToSym(v.Aux)
8963 if v_0.Op != OpS390XADDconst {
8964 break
8965 }
8966 d := auxIntToInt32(v_0.AuxInt)
8967 x := v_0.Args[0]
8968 y := v_1
8969 if !(is20Bit(int64(c) + int64(d))) {
8970 break
8971 }
8972 v.reset(OpS390XMOVDaddridx)
8973 v.AuxInt = int32ToAuxInt(c + d)
8974 v.Aux = symToAux(s)
8975 v.AddArg2(x, y)
8976 return true
8977 }
8978 // match: (MOVDaddridx [c] {s} x (ADDconst [d] y))
8979 // cond: is20Bit(int64(c)+int64(d))
8980 // result: (MOVDaddridx [c+d] {s} x y)
8981 for {
8982 c := auxIntToInt32(v.AuxInt)
8983 s := auxToSym(v.Aux)
8984 x := v_0
8985 if v_1.Op != OpS390XADDconst {
8986 break
8987 }
8988 d := auxIntToInt32(v_1.AuxInt)
8989 y := v_1.Args[0]
8990 if !(is20Bit(int64(c) + int64(d))) {
8991 break
8992 }
8993 v.reset(OpS390XMOVDaddridx)
8994 v.AuxInt = int32ToAuxInt(c + d)
8995 v.Aux = symToAux(s)
8996 v.AddArg2(x, y)
8997 return true
8998 }
8999 // match: (MOVDaddridx [off1] {sym1} (MOVDaddr [off2] {sym2} x) y)
9000 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
9001 // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y)
9002 for {
9003 off1 := auxIntToInt32(v.AuxInt)
9004 sym1 := auxToSym(v.Aux)
9005 if v_0.Op != OpS390XMOVDaddr {
9006 break
9007 }
9008 off2 := auxIntToInt32(v_0.AuxInt)
9009 sym2 := auxToSym(v_0.Aux)
9010 x := v_0.Args[0]
9011 y := v_1
9012 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
9013 break
9014 }
9015 v.reset(OpS390XMOVDaddridx)
9016 v.AuxInt = int32ToAuxInt(off1 + off2)
9017 v.Aux = symToAux(mergeSym(sym1, sym2))
9018 v.AddArg2(x, y)
9019 return true
9020 }
9021 // match: (MOVDaddridx [off1] {sym1} x (MOVDaddr [off2] {sym2} y))
9022 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB
9023 // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y)
9024 for {
9025 off1 := auxIntToInt32(v.AuxInt)
9026 sym1 := auxToSym(v.Aux)
9027 x := v_0
9028 if v_1.Op != OpS390XMOVDaddr {
9029 break
9030 }
9031 off2 := auxIntToInt32(v_1.AuxInt)
9032 sym2 := auxToSym(v_1.Aux)
9033 y := v_1.Args[0]
9034 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB) {
9035 break
9036 }
9037 v.reset(OpS390XMOVDaddridx)
9038 v.AuxInt = int32ToAuxInt(off1 + off2)
9039 v.Aux = symToAux(mergeSym(sym1, sym2))
9040 v.AddArg2(x, y)
9041 return true
9042 }
9043 return false
9044 }
9045 func rewriteValueS390X_OpS390XMOVDload(v *Value) bool {
9046 v_1 := v.Args[1]
9047 v_0 := v.Args[0]
9048 // match: (MOVDload [off] {sym} ptr1 (MOVDstore [off] {sym} ptr2 x _))
9049 // cond: isSamePtr(ptr1, ptr2)
9050 // result: x
9051 for {
9052 off := auxIntToInt32(v.AuxInt)
9053 sym := auxToSym(v.Aux)
9054 ptr1 := v_0
9055 if v_1.Op != OpS390XMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
9056 break
9057 }
9058 x := v_1.Args[1]
9059 ptr2 := v_1.Args[0]
9060 if !(isSamePtr(ptr1, ptr2)) {
9061 break
9062 }
9063 v.copyOf(x)
9064 return true
9065 }
9066 // match: (MOVDload [off] {sym} ptr1 (FMOVDstore [off] {sym} ptr2 x _))
9067 // cond: isSamePtr(ptr1, ptr2)
9068 // result: (LGDR x)
9069 for {
9070 off := auxIntToInt32(v.AuxInt)
9071 sym := auxToSym(v.Aux)
9072 ptr1 := v_0
9073 if v_1.Op != OpS390XFMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
9074 break
9075 }
9076 x := v_1.Args[1]
9077 ptr2 := v_1.Args[0]
9078 if !(isSamePtr(ptr1, ptr2)) {
9079 break
9080 }
9081 v.reset(OpS390XLGDR)
9082 v.AddArg(x)
9083 return true
9084 }
9085 // match: (MOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
9086 // cond: is20Bit(int64(off1)+int64(off2))
9087 // result: (MOVDload [off1+off2] {sym} ptr mem)
9088 for {
9089 off1 := auxIntToInt32(v.AuxInt)
9090 sym := auxToSym(v.Aux)
9091 if v_0.Op != OpS390XADDconst {
9092 break
9093 }
9094 off2 := auxIntToInt32(v_0.AuxInt)
9095 ptr := v_0.Args[0]
9096 mem := v_1
9097 if !(is20Bit(int64(off1) + int64(off2))) {
9098 break
9099 }
9100 v.reset(OpS390XMOVDload)
9101 v.AuxInt = int32ToAuxInt(off1 + off2)
9102 v.Aux = symToAux(sym)
9103 v.AddArg2(ptr, mem)
9104 return true
9105 }
9106 // match: (MOVDload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
9107 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))
9108 // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem)
9109 for {
9110 off1 := auxIntToInt32(v.AuxInt)
9111 sym1 := auxToSym(v.Aux)
9112 if v_0.Op != OpS390XMOVDaddr {
9113 break
9114 }
9115 t := v_0.Type
9116 off2 := auxIntToInt32(v_0.AuxInt)
9117 sym2 := auxToSym(v_0.Aux)
9118 base := v_0.Args[0]
9119 mem := v_1
9120 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) {
9121 break
9122 }
9123 v.reset(OpS390XMOVDload)
9124 v.AuxInt = int32ToAuxInt(off1 + off2)
9125 v.Aux = symToAux(mergeSym(sym1, sym2))
9126 v.AddArg2(base, mem)
9127 return true
9128 }
9129 return false
9130 }
9131 func rewriteValueS390X_OpS390XMOVDstore(v *Value) bool {
9132 v_2 := v.Args[2]
9133 v_1 := v.Args[1]
9134 v_0 := v.Args[0]
9135 // match: (MOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
9136 // cond: is20Bit(int64(off1)+int64(off2))
9137 // result: (MOVDstore [off1+off2] {sym} ptr val mem)
9138 for {
9139 off1 := auxIntToInt32(v.AuxInt)
9140 sym := auxToSym(v.Aux)
9141 if v_0.Op != OpS390XADDconst {
9142 break
9143 }
9144 off2 := auxIntToInt32(v_0.AuxInt)
9145 ptr := v_0.Args[0]
9146 val := v_1
9147 mem := v_2
9148 if !(is20Bit(int64(off1) + int64(off2))) {
9149 break
9150 }
9151 v.reset(OpS390XMOVDstore)
9152 v.AuxInt = int32ToAuxInt(off1 + off2)
9153 v.Aux = symToAux(sym)
9154 v.AddArg3(ptr, val, mem)
9155 return true
9156 }
9157 // match: (MOVDstore [off] {sym} ptr (MOVDconst [c]) mem)
9158 // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB
9159 // result: (MOVDstoreconst [makeValAndOff(int32(c),off)] {sym} ptr mem)
9160 for {
9161 off := auxIntToInt32(v.AuxInt)
9162 sym := auxToSym(v.Aux)
9163 ptr := v_0
9164 if v_1.Op != OpS390XMOVDconst {
9165 break
9166 }
9167 c := auxIntToInt64(v_1.AuxInt)
9168 mem := v_2
9169 if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) {
9170 break
9171 }
9172 v.reset(OpS390XMOVDstoreconst)
9173 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
9174 v.Aux = symToAux(sym)
9175 v.AddArg2(ptr, mem)
9176 return true
9177 }
9178 // match: (MOVDstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem)
9179 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))
9180 // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
9181 for {
9182 off1 := auxIntToInt32(v.AuxInt)
9183 sym1 := auxToSym(v.Aux)
9184 if v_0.Op != OpS390XMOVDaddr {
9185 break
9186 }
9187 t := v_0.Type
9188 off2 := auxIntToInt32(v_0.AuxInt)
9189 sym2 := auxToSym(v_0.Aux)
9190 base := v_0.Args[0]
9191 val := v_1
9192 mem := v_2
9193 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) {
9194 break
9195 }
9196 v.reset(OpS390XMOVDstore)
9197 v.AuxInt = int32ToAuxInt(off1 + off2)
9198 v.Aux = symToAux(mergeSym(sym1, sym2))
9199 v.AddArg3(base, val, mem)
9200 return true
9201 }
9202 // match: (MOVDstore [i] {s} p w1 x:(MOVDstore [i-8] {s} p w0 mem))
9203 // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)
9204 // result: (STMG2 [i-8] {s} p w0 w1 mem)
9205 for {
9206 i := auxIntToInt32(v.AuxInt)
9207 s := auxToSym(v.Aux)
9208 p := v_0
9209 w1 := v_1
9210 x := v_2
9211 if x.Op != OpS390XMOVDstore || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s {
9212 break
9213 }
9214 mem := x.Args[2]
9215 if p != x.Args[0] {
9216 break
9217 }
9218 w0 := x.Args[1]
9219 if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)) {
9220 break
9221 }
9222 v.reset(OpS390XSTMG2)
9223 v.AuxInt = int32ToAuxInt(i - 8)
9224 v.Aux = symToAux(s)
9225 v.AddArg4(p, w0, w1, mem)
9226 return true
9227 }
9228 // match: (MOVDstore [i] {s} p w2 x:(STMG2 [i-16] {s} p w0 w1 mem))
9229 // cond: x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)
9230 // result: (STMG3 [i-16] {s} p w0 w1 w2 mem)
9231 for {
9232 i := auxIntToInt32(v.AuxInt)
9233 s := auxToSym(v.Aux)
9234 p := v_0
9235 w2 := v_1
9236 x := v_2
9237 if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s {
9238 break
9239 }
9240 mem := x.Args[3]
9241 if p != x.Args[0] {
9242 break
9243 }
9244 w0 := x.Args[1]
9245 w1 := x.Args[2]
9246 if !(x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)) {
9247 break
9248 }
9249 v.reset(OpS390XSTMG3)
9250 v.AuxInt = int32ToAuxInt(i - 16)
9251 v.Aux = symToAux(s)
9252 v.AddArg5(p, w0, w1, w2, mem)
9253 return true
9254 }
9255 // match: (MOVDstore [i] {s} p w3 x:(STMG3 [i-24] {s} p w0 w1 w2 mem))
9256 // cond: x.Uses == 1 && is20Bit(int64(i)-24) && setPos(v, x.Pos) && clobber(x)
9257 // result: (STMG4 [i-24] {s} p w0 w1 w2 w3 mem)
9258 for {
9259 i := auxIntToInt32(v.AuxInt)
9260 s := auxToSym(v.Aux)
9261 p := v_0
9262 w3 := v_1
9263 x := v_2
9264 if x.Op != OpS390XSTMG3 || auxIntToInt32(x.AuxInt) != i-24 || auxToSym(x.Aux) != s {
9265 break
9266 }
9267 mem := x.Args[4]
9268 if p != x.Args[0] {
9269 break
9270 }
9271 w0 := x.Args[1]
9272 w1 := x.Args[2]
9273 w2 := x.Args[3]
9274 if !(x.Uses == 1 && is20Bit(int64(i)-24) && setPos(v, x.Pos) && clobber(x)) {
9275 break
9276 }
9277 v.reset(OpS390XSTMG4)
9278 v.AuxInt = int32ToAuxInt(i - 24)
9279 v.Aux = symToAux(s)
9280 v.AddArg6(p, w0, w1, w2, w3, mem)
9281 return true
9282 }
9283 // match: (MOVDstore [off] {sym} ptr r:(MOVDBR x) mem)
9284 // cond: r.Uses == 1
9285 // result: (MOVDBRstore [off] {sym} ptr x mem)
9286 for {
9287 off := auxIntToInt32(v.AuxInt)
9288 sym := auxToSym(v.Aux)
9289 ptr := v_0
9290 r := v_1
9291 if r.Op != OpS390XMOVDBR {
9292 break
9293 }
9294 x := r.Args[0]
9295 mem := v_2
9296 if !(r.Uses == 1) {
9297 break
9298 }
9299 v.reset(OpS390XMOVDBRstore)
9300 v.AuxInt = int32ToAuxInt(off)
9301 v.Aux = symToAux(sym)
9302 v.AddArg3(ptr, x, mem)
9303 return true
9304 }
9305 return false
9306 }
9307 func rewriteValueS390X_OpS390XMOVDstoreconst(v *Value) bool {
9308 v_1 := v.Args[1]
9309 v_0 := v.Args[0]
9310 // match: (MOVDstoreconst [sc] {s} (ADDconst [off] ptr) mem)
9311 // cond: isU12Bit(sc.Off64()+int64(off))
9312 // result: (MOVDstoreconst [sc.addOffset32(off)] {s} ptr mem)
9313 for {
9314 sc := auxIntToValAndOff(v.AuxInt)
9315 s := auxToSym(v.Aux)
9316 if v_0.Op != OpS390XADDconst {
9317 break
9318 }
9319 off := auxIntToInt32(v_0.AuxInt)
9320 ptr := v_0.Args[0]
9321 mem := v_1
9322 if !(isU12Bit(sc.Off64() + int64(off))) {
9323 break
9324 }
9325 v.reset(OpS390XMOVDstoreconst)
9326 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
9327 v.Aux = symToAux(s)
9328 v.AddArg2(ptr, mem)
9329 return true
9330 }
9331 // match: (MOVDstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem)
9332 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)
9333 // result: (MOVDstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
9334 for {
9335 sc := auxIntToValAndOff(v.AuxInt)
9336 sym1 := auxToSym(v.Aux)
9337 if v_0.Op != OpS390XMOVDaddr {
9338 break
9339 }
9340 off := auxIntToInt32(v_0.AuxInt)
9341 sym2 := auxToSym(v_0.Aux)
9342 ptr := v_0.Args[0]
9343 mem := v_1
9344 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) {
9345 break
9346 }
9347 v.reset(OpS390XMOVDstoreconst)
9348 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
9349 v.Aux = symToAux(mergeSym(sym1, sym2))
9350 v.AddArg2(ptr, mem)
9351 return true
9352 }
9353 return false
9354 }
9355 func rewriteValueS390X_OpS390XMOVDstoreidx(v *Value) bool {
9356 v_3 := v.Args[3]
9357 v_2 := v.Args[2]
9358 v_1 := v.Args[1]
9359 v_0 := v.Args[0]
9360 // match: (MOVDstoreidx [off] {sym} ptr idx r:(MOVDBR x) mem)
9361 // cond: r.Uses == 1
9362 // result: (MOVDBRstoreidx [off] {sym} ptr idx x mem)
9363 for {
9364 off := auxIntToInt32(v.AuxInt)
9365 sym := auxToSym(v.Aux)
9366 ptr := v_0
9367 idx := v_1
9368 r := v_2
9369 if r.Op != OpS390XMOVDBR {
9370 break
9371 }
9372 x := r.Args[0]
9373 mem := v_3
9374 if !(r.Uses == 1) {
9375 break
9376 }
9377 v.reset(OpS390XMOVDBRstoreidx)
9378 v.AuxInt = int32ToAuxInt(off)
9379 v.Aux = symToAux(sym)
9380 v.AddArg4(ptr, idx, x, mem)
9381 return true
9382 }
9383 return false
9384 }
9385 func rewriteValueS390X_OpS390XMOVHZload(v *Value) bool {
9386 v_1 := v.Args[1]
9387 v_0 := v.Args[0]
9388 // match: (MOVHZload [off] {sym} ptr1 (MOVHstore [off] {sym} ptr2 x _))
9389 // cond: isSamePtr(ptr1, ptr2)
9390 // result: (MOVHZreg x)
9391 for {
9392 off := auxIntToInt32(v.AuxInt)
9393 sym := auxToSym(v.Aux)
9394 ptr1 := v_0
9395 if v_1.Op != OpS390XMOVHstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
9396 break
9397 }
9398 x := v_1.Args[1]
9399 ptr2 := v_1.Args[0]
9400 if !(isSamePtr(ptr1, ptr2)) {
9401 break
9402 }
9403 v.reset(OpS390XMOVHZreg)
9404 v.AddArg(x)
9405 return true
9406 }
9407 // match: (MOVHZload [off1] {sym} (ADDconst [off2] ptr) mem)
9408 // cond: is20Bit(int64(off1)+int64(off2))
9409 // result: (MOVHZload [off1+off2] {sym} ptr mem)
9410 for {
9411 off1 := auxIntToInt32(v.AuxInt)
9412 sym := auxToSym(v.Aux)
9413 if v_0.Op != OpS390XADDconst {
9414 break
9415 }
9416 off2 := auxIntToInt32(v_0.AuxInt)
9417 ptr := v_0.Args[0]
9418 mem := v_1
9419 if !(is20Bit(int64(off1) + int64(off2))) {
9420 break
9421 }
9422 v.reset(OpS390XMOVHZload)
9423 v.AuxInt = int32ToAuxInt(off1 + off2)
9424 v.Aux = symToAux(sym)
9425 v.AddArg2(ptr, mem)
9426 return true
9427 }
9428 // match: (MOVHZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
9429 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))
9430 // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} base mem)
9431 for {
9432 off1 := auxIntToInt32(v.AuxInt)
9433 sym1 := auxToSym(v.Aux)
9434 if v_0.Op != OpS390XMOVDaddr {
9435 break
9436 }
9437 t := v_0.Type
9438 off2 := auxIntToInt32(v_0.AuxInt)
9439 sym2 := auxToSym(v_0.Aux)
9440 base := v_0.Args[0]
9441 mem := v_1
9442 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) {
9443 break
9444 }
9445 v.reset(OpS390XMOVHZload)
9446 v.AuxInt = int32ToAuxInt(off1 + off2)
9447 v.Aux = symToAux(mergeSym(sym1, sym2))
9448 v.AddArg2(base, mem)
9449 return true
9450 }
9451 return false
9452 }
9453 func rewriteValueS390X_OpS390XMOVHZreg(v *Value) bool {
9454 v_0 := v.Args[0]
9455 b := v.Block
9456 typ := &b.Func.Config.Types
9457 // match: (MOVHZreg e:(MOVBZreg x))
9458 // cond: clobberIfDead(e)
9459 // result: (MOVBZreg x)
9460 for {
9461 e := v_0
9462 if e.Op != OpS390XMOVBZreg {
9463 break
9464 }
9465 x := e.Args[0]
9466 if !(clobberIfDead(e)) {
9467 break
9468 }
9469 v.reset(OpS390XMOVBZreg)
9470 v.AddArg(x)
9471 return true
9472 }
9473 // match: (MOVHZreg e:(MOVHreg x))
9474 // cond: clobberIfDead(e)
9475 // result: (MOVHZreg x)
9476 for {
9477 e := v_0
9478 if e.Op != OpS390XMOVHreg {
9479 break
9480 }
9481 x := e.Args[0]
9482 if !(clobberIfDead(e)) {
9483 break
9484 }
9485 v.reset(OpS390XMOVHZreg)
9486 v.AddArg(x)
9487 return true
9488 }
9489 // match: (MOVHZreg e:(MOVWreg x))
9490 // cond: clobberIfDead(e)
9491 // result: (MOVHZreg x)
9492 for {
9493 e := v_0
9494 if e.Op != OpS390XMOVWreg {
9495 break
9496 }
9497 x := e.Args[0]
9498 if !(clobberIfDead(e)) {
9499 break
9500 }
9501 v.reset(OpS390XMOVHZreg)
9502 v.AddArg(x)
9503 return true
9504 }
9505 // match: (MOVHZreg e:(MOVHZreg x))
9506 // cond: clobberIfDead(e)
9507 // result: (MOVHZreg x)
9508 for {
9509 e := v_0
9510 if e.Op != OpS390XMOVHZreg {
9511 break
9512 }
9513 x := e.Args[0]
9514 if !(clobberIfDead(e)) {
9515 break
9516 }
9517 v.reset(OpS390XMOVHZreg)
9518 v.AddArg(x)
9519 return true
9520 }
9521 // match: (MOVHZreg e:(MOVWZreg x))
9522 // cond: clobberIfDead(e)
9523 // result: (MOVHZreg x)
9524 for {
9525 e := v_0
9526 if e.Op != OpS390XMOVWZreg {
9527 break
9528 }
9529 x := e.Args[0]
9530 if !(clobberIfDead(e)) {
9531 break
9532 }
9533 v.reset(OpS390XMOVHZreg)
9534 v.AddArg(x)
9535 return true
9536 }
9537 // match: (MOVHZreg x:(MOVBZload _ _))
9538 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
9539 // result: x
9540 for {
9541 x := v_0
9542 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
9543 break
9544 }
9545 v.copyOf(x)
9546 return true
9547 }
9548 // match: (MOVHZreg x:(MOVHZload _ _))
9549 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2)
9550 // result: x
9551 for {
9552 x := v_0
9553 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) {
9554 break
9555 }
9556 v.copyOf(x)
9557 return true
9558 }
9559 // match: (MOVHZreg <t> x:(MOVHload [o] {s} p mem))
9560 // cond: x.Uses == 1 && clobber(x)
9561 // result: @x.Block (MOVHZload <t> [o] {s} p mem)
9562 for {
9563 t := v.Type
9564 x := v_0
9565 if x.Op != OpS390XMOVHload {
9566 break
9567 }
9568 o := auxIntToInt32(x.AuxInt)
9569 s := auxToSym(x.Aux)
9570 mem := x.Args[1]
9571 p := x.Args[0]
9572 if !(x.Uses == 1 && clobber(x)) {
9573 break
9574 }
9575 b = x.Block
9576 v0 := b.NewValue0(x.Pos, OpS390XMOVHZload, t)
9577 v.copyOf(v0)
9578 v0.AuxInt = int32ToAuxInt(o)
9579 v0.Aux = symToAux(s)
9580 v0.AddArg2(p, mem)
9581 return true
9582 }
9583 // match: (MOVHZreg x:(Arg <t>))
9584 // cond: !t.IsSigned() && t.Size() <= 2
9585 // result: x
9586 for {
9587 x := v_0
9588 if x.Op != OpArg {
9589 break
9590 }
9591 t := x.Type
9592 if !(!t.IsSigned() && t.Size() <= 2) {
9593 break
9594 }
9595 v.copyOf(x)
9596 return true
9597 }
9598 // match: (MOVHZreg (MOVDconst [c]))
9599 // result: (MOVDconst [int64(uint16(c))])
9600 for {
9601 if v_0.Op != OpS390XMOVDconst {
9602 break
9603 }
9604 c := auxIntToInt64(v_0.AuxInt)
9605 v.reset(OpS390XMOVDconst)
9606 v.AuxInt = int64ToAuxInt(int64(uint16(c)))
9607 return true
9608 }
9609 // match: (MOVHZreg (RISBGZ x {r}))
9610 // cond: r.OutMerge(0x0000ffff) != nil
9611 // result: (RISBGZ x {*r.OutMerge(0x0000ffff)})
9612 for {
9613 if v_0.Op != OpS390XRISBGZ {
9614 break
9615 }
9616 r := auxToS390xRotateParams(v_0.Aux)
9617 x := v_0.Args[0]
9618 if !(r.OutMerge(0x0000ffff) != nil) {
9619 break
9620 }
9621 v.reset(OpS390XRISBGZ)
9622 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0x0000ffff))
9623 v.AddArg(x)
9624 return true
9625 }
9626 // match: (MOVHZreg (ANDWconst [m] x))
9627 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x))
9628 for {
9629 if v_0.Op != OpS390XANDWconst {
9630 break
9631 }
9632 m := auxIntToInt32(v_0.AuxInt)
9633 x := v_0.Args[0]
9634 v.reset(OpS390XMOVWZreg)
9635 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
9636 v0.AuxInt = int32ToAuxInt(int32(uint16(m)))
9637 v0.AddArg(x)
9638 v.AddArg(v0)
9639 return true
9640 }
9641 return false
9642 }
9643 func rewriteValueS390X_OpS390XMOVHload(v *Value) bool {
9644 v_1 := v.Args[1]
9645 v_0 := v.Args[0]
9646 // match: (MOVHload [off] {sym} ptr1 (MOVHstore [off] {sym} ptr2 x _))
9647 // cond: isSamePtr(ptr1, ptr2)
9648 // result: (MOVHreg x)
9649 for {
9650 off := auxIntToInt32(v.AuxInt)
9651 sym := auxToSym(v.Aux)
9652 ptr1 := v_0
9653 if v_1.Op != OpS390XMOVHstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
9654 break
9655 }
9656 x := v_1.Args[1]
9657 ptr2 := v_1.Args[0]
9658 if !(isSamePtr(ptr1, ptr2)) {
9659 break
9660 }
9661 v.reset(OpS390XMOVHreg)
9662 v.AddArg(x)
9663 return true
9664 }
9665 // match: (MOVHload [off1] {sym} (ADDconst [off2] ptr) mem)
9666 // cond: is20Bit(int64(off1)+int64(off2))
9667 // result: (MOVHload [off1+off2] {sym} ptr mem)
9668 for {
9669 off1 := auxIntToInt32(v.AuxInt)
9670 sym := auxToSym(v.Aux)
9671 if v_0.Op != OpS390XADDconst {
9672 break
9673 }
9674 off2 := auxIntToInt32(v_0.AuxInt)
9675 ptr := v_0.Args[0]
9676 mem := v_1
9677 if !(is20Bit(int64(off1) + int64(off2))) {
9678 break
9679 }
9680 v.reset(OpS390XMOVHload)
9681 v.AuxInt = int32ToAuxInt(off1 + off2)
9682 v.Aux = symToAux(sym)
9683 v.AddArg2(ptr, mem)
9684 return true
9685 }
9686 // match: (MOVHload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
9687 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))
9688 // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} base mem)
9689 for {
9690 off1 := auxIntToInt32(v.AuxInt)
9691 sym1 := auxToSym(v.Aux)
9692 if v_0.Op != OpS390XMOVDaddr {
9693 break
9694 }
9695 t := v_0.Type
9696 off2 := auxIntToInt32(v_0.AuxInt)
9697 sym2 := auxToSym(v_0.Aux)
9698 base := v_0.Args[0]
9699 mem := v_1
9700 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) {
9701 break
9702 }
9703 v.reset(OpS390XMOVHload)
9704 v.AuxInt = int32ToAuxInt(off1 + off2)
9705 v.Aux = symToAux(mergeSym(sym1, sym2))
9706 v.AddArg2(base, mem)
9707 return true
9708 }
9709 return false
9710 }
9711 func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool {
9712 v_0 := v.Args[0]
9713 b := v.Block
9714 typ := &b.Func.Config.Types
9715 // match: (MOVHreg e:(MOVBreg x))
9716 // cond: clobberIfDead(e)
9717 // result: (MOVBreg x)
9718 for {
9719 e := v_0
9720 if e.Op != OpS390XMOVBreg {
9721 break
9722 }
9723 x := e.Args[0]
9724 if !(clobberIfDead(e)) {
9725 break
9726 }
9727 v.reset(OpS390XMOVBreg)
9728 v.AddArg(x)
9729 return true
9730 }
9731 // match: (MOVHreg e:(MOVHreg x))
9732 // cond: clobberIfDead(e)
9733 // result: (MOVHreg x)
9734 for {
9735 e := v_0
9736 if e.Op != OpS390XMOVHreg {
9737 break
9738 }
9739 x := e.Args[0]
9740 if !(clobberIfDead(e)) {
9741 break
9742 }
9743 v.reset(OpS390XMOVHreg)
9744 v.AddArg(x)
9745 return true
9746 }
9747 // match: (MOVHreg e:(MOVWreg x))
9748 // cond: clobberIfDead(e)
9749 // result: (MOVHreg x)
9750 for {
9751 e := v_0
9752 if e.Op != OpS390XMOVWreg {
9753 break
9754 }
9755 x := e.Args[0]
9756 if !(clobberIfDead(e)) {
9757 break
9758 }
9759 v.reset(OpS390XMOVHreg)
9760 v.AddArg(x)
9761 return true
9762 }
9763 // match: (MOVHreg e:(MOVHZreg x))
9764 // cond: clobberIfDead(e)
9765 // result: (MOVHreg x)
9766 for {
9767 e := v_0
9768 if e.Op != OpS390XMOVHZreg {
9769 break
9770 }
9771 x := e.Args[0]
9772 if !(clobberIfDead(e)) {
9773 break
9774 }
9775 v.reset(OpS390XMOVHreg)
9776 v.AddArg(x)
9777 return true
9778 }
9779 // match: (MOVHreg e:(MOVWZreg x))
9780 // cond: clobberIfDead(e)
9781 // result: (MOVHreg x)
9782 for {
9783 e := v_0
9784 if e.Op != OpS390XMOVWZreg {
9785 break
9786 }
9787 x := e.Args[0]
9788 if !(clobberIfDead(e)) {
9789 break
9790 }
9791 v.reset(OpS390XMOVHreg)
9792 v.AddArg(x)
9793 return true
9794 }
9795 // match: (MOVHreg x:(MOVBload _ _))
9796 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
9797 // result: x
9798 for {
9799 x := v_0
9800 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
9801 break
9802 }
9803 v.copyOf(x)
9804 return true
9805 }
9806 // match: (MOVHreg x:(MOVHload _ _))
9807 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
9808 // result: x
9809 for {
9810 x := v_0
9811 if x.Op != OpS390XMOVHload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
9812 break
9813 }
9814 v.copyOf(x)
9815 return true
9816 }
9817 // match: (MOVHreg x:(MOVBZload _ _))
9818 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
9819 // result: x
9820 for {
9821 x := v_0
9822 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
9823 break
9824 }
9825 v.copyOf(x)
9826 return true
9827 }
9828 // match: (MOVHreg <t> x:(MOVHZload [o] {s} p mem))
9829 // cond: x.Uses == 1 && clobber(x)
9830 // result: @x.Block (MOVHload <t> [o] {s} p mem)
9831 for {
9832 t := v.Type
9833 x := v_0
9834 if x.Op != OpS390XMOVHZload {
9835 break
9836 }
9837 o := auxIntToInt32(x.AuxInt)
9838 s := auxToSym(x.Aux)
9839 mem := x.Args[1]
9840 p := x.Args[0]
9841 if !(x.Uses == 1 && clobber(x)) {
9842 break
9843 }
9844 b = x.Block
9845 v0 := b.NewValue0(x.Pos, OpS390XMOVHload, t)
9846 v.copyOf(v0)
9847 v0.AuxInt = int32ToAuxInt(o)
9848 v0.Aux = symToAux(s)
9849 v0.AddArg2(p, mem)
9850 return true
9851 }
9852 // match: (MOVHreg x:(Arg <t>))
9853 // cond: t.IsSigned() && t.Size() <= 2
9854 // result: x
9855 for {
9856 x := v_0
9857 if x.Op != OpArg {
9858 break
9859 }
9860 t := x.Type
9861 if !(t.IsSigned() && t.Size() <= 2) {
9862 break
9863 }
9864 v.copyOf(x)
9865 return true
9866 }
9867 // match: (MOVHreg (MOVDconst [c]))
9868 // result: (MOVDconst [int64(int16(c))])
9869 for {
9870 if v_0.Op != OpS390XMOVDconst {
9871 break
9872 }
9873 c := auxIntToInt64(v_0.AuxInt)
9874 v.reset(OpS390XMOVDconst)
9875 v.AuxInt = int64ToAuxInt(int64(int16(c)))
9876 return true
9877 }
9878 // match: (MOVHreg (ANDWconst [m] x))
9879 // cond: int16(m) >= 0
9880 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x))
9881 for {
9882 if v_0.Op != OpS390XANDWconst {
9883 break
9884 }
9885 m := auxIntToInt32(v_0.AuxInt)
9886 x := v_0.Args[0]
9887 if !(int16(m) >= 0) {
9888 break
9889 }
9890 v.reset(OpS390XMOVWZreg)
9891 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
9892 v0.AuxInt = int32ToAuxInt(int32(uint16(m)))
9893 v0.AddArg(x)
9894 v.AddArg(v0)
9895 return true
9896 }
9897 return false
9898 }
9899 func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool {
9900 v_2 := v.Args[2]
9901 v_1 := v.Args[1]
9902 v_0 := v.Args[0]
9903 // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem)
9904 // result: (MOVHstore [off] {sym} ptr x mem)
9905 for {
9906 off := auxIntToInt32(v.AuxInt)
9907 sym := auxToSym(v.Aux)
9908 ptr := v_0
9909 if v_1.Op != OpS390XMOVHreg {
9910 break
9911 }
9912 x := v_1.Args[0]
9913 mem := v_2
9914 v.reset(OpS390XMOVHstore)
9915 v.AuxInt = int32ToAuxInt(off)
9916 v.Aux = symToAux(sym)
9917 v.AddArg3(ptr, x, mem)
9918 return true
9919 }
9920 // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem)
9921 // result: (MOVHstore [off] {sym} ptr x mem)
9922 for {
9923 off := auxIntToInt32(v.AuxInt)
9924 sym := auxToSym(v.Aux)
9925 ptr := v_0
9926 if v_1.Op != OpS390XMOVHZreg {
9927 break
9928 }
9929 x := v_1.Args[0]
9930 mem := v_2
9931 v.reset(OpS390XMOVHstore)
9932 v.AuxInt = int32ToAuxInt(off)
9933 v.Aux = symToAux(sym)
9934 v.AddArg3(ptr, x, mem)
9935 return true
9936 }
9937 // match: (MOVHstore [off1] {sym} (ADDconst [off2] ptr) val mem)
9938 // cond: is20Bit(int64(off1)+int64(off2))
9939 // result: (MOVHstore [off1+off2] {sym} ptr val mem)
9940 for {
9941 off1 := auxIntToInt32(v.AuxInt)
9942 sym := auxToSym(v.Aux)
9943 if v_0.Op != OpS390XADDconst {
9944 break
9945 }
9946 off2 := auxIntToInt32(v_0.AuxInt)
9947 ptr := v_0.Args[0]
9948 val := v_1
9949 mem := v_2
9950 if !(is20Bit(int64(off1) + int64(off2))) {
9951 break
9952 }
9953 v.reset(OpS390XMOVHstore)
9954 v.AuxInt = int32ToAuxInt(off1 + off2)
9955 v.Aux = symToAux(sym)
9956 v.AddArg3(ptr, val, mem)
9957 return true
9958 }
9959 // match: (MOVHstore [off] {sym} ptr (MOVDconst [c]) mem)
9960 // cond: isU12Bit(int64(off)) && ptr.Op != OpSB
9961 // result: (MOVHstoreconst [makeValAndOff(int32(int16(c)),off)] {sym} ptr mem)
9962 for {
9963 off := auxIntToInt32(v.AuxInt)
9964 sym := auxToSym(v.Aux)
9965 ptr := v_0
9966 if v_1.Op != OpS390XMOVDconst {
9967 break
9968 }
9969 c := auxIntToInt64(v_1.AuxInt)
9970 mem := v_2
9971 if !(isU12Bit(int64(off)) && ptr.Op != OpSB) {
9972 break
9973 }
9974 v.reset(OpS390XMOVHstoreconst)
9975 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int16(c)), off))
9976 v.Aux = symToAux(sym)
9977 v.AddArg2(ptr, mem)
9978 return true
9979 }
9980 // match: (MOVHstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem)
9981 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))
9982 // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
9983 for {
9984 off1 := auxIntToInt32(v.AuxInt)
9985 sym1 := auxToSym(v.Aux)
9986 if v_0.Op != OpS390XMOVDaddr {
9987 break
9988 }
9989 t := v_0.Type
9990 off2 := auxIntToInt32(v_0.AuxInt)
9991 sym2 := auxToSym(v_0.Aux)
9992 base := v_0.Args[0]
9993 val := v_1
9994 mem := v_2
9995 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) {
9996 break
9997 }
9998 v.reset(OpS390XMOVHstore)
9999 v.AuxInt = int32ToAuxInt(off1 + off2)
10000 v.Aux = symToAux(mergeSym(sym1, sym2))
10001 v.AddArg3(base, val, mem)
10002 return true
10003 }
10004 // match: (MOVHstore [off] {sym} ptr (Bswap16 val) mem)
10005 // result: (MOVHBRstore [off] {sym} ptr val mem)
10006 for {
10007 off := auxIntToInt32(v.AuxInt)
10008 sym := auxToSym(v.Aux)
10009 ptr := v_0
10010 if v_1.Op != OpBswap16 {
10011 break
10012 }
10013 val := v_1.Args[0]
10014 mem := v_2
10015 v.reset(OpS390XMOVHBRstore)
10016 v.AuxInt = int32ToAuxInt(off)
10017 v.Aux = symToAux(sym)
10018 v.AddArg3(ptr, val, mem)
10019 return true
10020 }
10021 return false
10022 }
10023 func rewriteValueS390X_OpS390XMOVHstoreconst(v *Value) bool {
10024 v_1 := v.Args[1]
10025 v_0 := v.Args[0]
10026 // match: (MOVHstoreconst [sc] {s} (ADDconst [off] ptr) mem)
10027 // cond: isU12Bit(sc.Off64()+int64(off))
10028 // result: (MOVHstoreconst [sc.addOffset32(off)] {s} ptr mem)
10029 for {
10030 sc := auxIntToValAndOff(v.AuxInt)
10031 s := auxToSym(v.Aux)
10032 if v_0.Op != OpS390XADDconst {
10033 break
10034 }
10035 off := auxIntToInt32(v_0.AuxInt)
10036 ptr := v_0.Args[0]
10037 mem := v_1
10038 if !(isU12Bit(sc.Off64() + int64(off))) {
10039 break
10040 }
10041 v.reset(OpS390XMOVHstoreconst)
10042 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
10043 v.Aux = symToAux(s)
10044 v.AddArg2(ptr, mem)
10045 return true
10046 }
10047 // match: (MOVHstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem)
10048 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)
10049 // result: (MOVHstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
10050 for {
10051 sc := auxIntToValAndOff(v.AuxInt)
10052 sym1 := auxToSym(v.Aux)
10053 if v_0.Op != OpS390XMOVDaddr {
10054 break
10055 }
10056 off := auxIntToInt32(v_0.AuxInt)
10057 sym2 := auxToSym(v_0.Aux)
10058 ptr := v_0.Args[0]
10059 mem := v_1
10060 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) {
10061 break
10062 }
10063 v.reset(OpS390XMOVHstoreconst)
10064 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
10065 v.Aux = symToAux(mergeSym(sym1, sym2))
10066 v.AddArg2(ptr, mem)
10067 return true
10068 }
10069 return false
10070 }
10071 func rewriteValueS390X_OpS390XMOVHstoreidx(v *Value) bool {
10072 v_3 := v.Args[3]
10073 v_2 := v.Args[2]
10074 v_1 := v.Args[1]
10075 v_0 := v.Args[0]
10076 // match: (MOVHstoreidx [off] {sym} ptr idx (Bswap16 val) mem)
10077 // result: (MOVHBRstoreidx [off] {sym} ptr idx val mem)
10078 for {
10079 off := auxIntToInt32(v.AuxInt)
10080 sym := auxToSym(v.Aux)
10081 ptr := v_0
10082 idx := v_1
10083 if v_2.Op != OpBswap16 {
10084 break
10085 }
10086 val := v_2.Args[0]
10087 mem := v_3
10088 v.reset(OpS390XMOVHBRstoreidx)
10089 v.AuxInt = int32ToAuxInt(off)
10090 v.Aux = symToAux(sym)
10091 v.AddArg4(ptr, idx, val, mem)
10092 return true
10093 }
10094 return false
10095 }
10096 func rewriteValueS390X_OpS390XMOVWBR(v *Value) bool {
10097 v_0 := v.Args[0]
10098 b := v.Block
10099 typ := &b.Func.Config.Types
10100 // match: (MOVWBR x:(MOVWZload [off] {sym} ptr mem))
10101 // cond: x.Uses == 1
10102 // result: @x.Block (MOVWZreg (MOVWBRload [off] {sym} ptr mem))
10103 for {
10104 x := v_0
10105 if x.Op != OpS390XMOVWZload {
10106 break
10107 }
10108 off := auxIntToInt32(x.AuxInt)
10109 sym := auxToSym(x.Aux)
10110 mem := x.Args[1]
10111 ptr := x.Args[0]
10112 if !(x.Uses == 1) {
10113 break
10114 }
10115 b = x.Block
10116 v0 := b.NewValue0(x.Pos, OpS390XMOVWZreg, typ.UInt64)
10117 v.copyOf(v0)
10118 v1 := b.NewValue0(x.Pos, OpS390XMOVWBRload, typ.UInt32)
10119 v1.AuxInt = int32ToAuxInt(off)
10120 v1.Aux = symToAux(sym)
10121 v1.AddArg2(ptr, mem)
10122 v0.AddArg(v1)
10123 return true
10124 }
10125 // match: (MOVWBR x:(MOVWZloadidx [off] {sym} ptr idx mem))
10126 // cond: x.Uses == 1
10127 // result: @x.Block (MOVWZreg (MOVWBRloadidx [off] {sym} ptr idx mem))
10128 for {
10129 x := v_0
10130 if x.Op != OpS390XMOVWZloadidx {
10131 break
10132 }
10133 off := auxIntToInt32(x.AuxInt)
10134 sym := auxToSym(x.Aux)
10135 mem := x.Args[2]
10136 ptr := x.Args[0]
10137 idx := x.Args[1]
10138 if !(x.Uses == 1) {
10139 break
10140 }
10141 b = x.Block
10142 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
10143 v.copyOf(v0)
10144 v1 := b.NewValue0(v.Pos, OpS390XMOVWBRloadidx, typ.Int32)
10145 v1.AuxInt = int32ToAuxInt(off)
10146 v1.Aux = symToAux(sym)
10147 v1.AddArg3(ptr, idx, mem)
10148 v0.AddArg(v1)
10149 return true
10150 }
10151 return false
10152 }
10153 func rewriteValueS390X_OpS390XMOVWZload(v *Value) bool {
10154 v_1 := v.Args[1]
10155 v_0 := v.Args[0]
10156 // match: (MOVWZload [off] {sym} ptr1 (MOVWstore [off] {sym} ptr2 x _))
10157 // cond: isSamePtr(ptr1, ptr2)
10158 // result: (MOVWZreg x)
10159 for {
10160 off := auxIntToInt32(v.AuxInt)
10161 sym := auxToSym(v.Aux)
10162 ptr1 := v_0
10163 if v_1.Op != OpS390XMOVWstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
10164 break
10165 }
10166 x := v_1.Args[1]
10167 ptr2 := v_1.Args[0]
10168 if !(isSamePtr(ptr1, ptr2)) {
10169 break
10170 }
10171 v.reset(OpS390XMOVWZreg)
10172 v.AddArg(x)
10173 return true
10174 }
10175 // match: (MOVWZload [off1] {sym} (ADDconst [off2] ptr) mem)
10176 // cond: is20Bit(int64(off1)+int64(off2))
10177 // result: (MOVWZload [off1+off2] {sym} ptr mem)
10178 for {
10179 off1 := auxIntToInt32(v.AuxInt)
10180 sym := auxToSym(v.Aux)
10181 if v_0.Op != OpS390XADDconst {
10182 break
10183 }
10184 off2 := auxIntToInt32(v_0.AuxInt)
10185 ptr := v_0.Args[0]
10186 mem := v_1
10187 if !(is20Bit(int64(off1) + int64(off2))) {
10188 break
10189 }
10190 v.reset(OpS390XMOVWZload)
10191 v.AuxInt = int32ToAuxInt(off1 + off2)
10192 v.Aux = symToAux(sym)
10193 v.AddArg2(ptr, mem)
10194 return true
10195 }
10196 // match: (MOVWZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
10197 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))
10198 // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} base mem)
10199 for {
10200 off1 := auxIntToInt32(v.AuxInt)
10201 sym1 := auxToSym(v.Aux)
10202 if v_0.Op != OpS390XMOVDaddr {
10203 break
10204 }
10205 t := v_0.Type
10206 off2 := auxIntToInt32(v_0.AuxInt)
10207 sym2 := auxToSym(v_0.Aux)
10208 base := v_0.Args[0]
10209 mem := v_1
10210 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) {
10211 break
10212 }
10213 v.reset(OpS390XMOVWZload)
10214 v.AuxInt = int32ToAuxInt(off1 + off2)
10215 v.Aux = symToAux(mergeSym(sym1, sym2))
10216 v.AddArg2(base, mem)
10217 return true
10218 }
10219 return false
10220 }
10221 func rewriteValueS390X_OpS390XMOVWZreg(v *Value) bool {
10222 v_0 := v.Args[0]
10223 b := v.Block
10224 // match: (MOVWZreg e:(MOVBZreg x))
10225 // cond: clobberIfDead(e)
10226 // result: (MOVBZreg x)
10227 for {
10228 e := v_0
10229 if e.Op != OpS390XMOVBZreg {
10230 break
10231 }
10232 x := e.Args[0]
10233 if !(clobberIfDead(e)) {
10234 break
10235 }
10236 v.reset(OpS390XMOVBZreg)
10237 v.AddArg(x)
10238 return true
10239 }
10240 // match: (MOVWZreg e:(MOVHZreg x))
10241 // cond: clobberIfDead(e)
10242 // result: (MOVHZreg x)
10243 for {
10244 e := v_0
10245 if e.Op != OpS390XMOVHZreg {
10246 break
10247 }
10248 x := e.Args[0]
10249 if !(clobberIfDead(e)) {
10250 break
10251 }
10252 v.reset(OpS390XMOVHZreg)
10253 v.AddArg(x)
10254 return true
10255 }
10256 // match: (MOVWZreg e:(MOVWreg x))
10257 // cond: clobberIfDead(e)
10258 // result: (MOVWZreg x)
10259 for {
10260 e := v_0
10261 if e.Op != OpS390XMOVWreg {
10262 break
10263 }
10264 x := e.Args[0]
10265 if !(clobberIfDead(e)) {
10266 break
10267 }
10268 v.reset(OpS390XMOVWZreg)
10269 v.AddArg(x)
10270 return true
10271 }
10272 // match: (MOVWZreg e:(MOVWZreg x))
10273 // cond: clobberIfDead(e)
10274 // result: (MOVWZreg x)
10275 for {
10276 e := v_0
10277 if e.Op != OpS390XMOVWZreg {
10278 break
10279 }
10280 x := e.Args[0]
10281 if !(clobberIfDead(e)) {
10282 break
10283 }
10284 v.reset(OpS390XMOVWZreg)
10285 v.AddArg(x)
10286 return true
10287 }
10288 // match: (MOVWZreg x:(MOVBZload _ _))
10289 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
10290 // result: x
10291 for {
10292 x := v_0
10293 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
10294 break
10295 }
10296 v.copyOf(x)
10297 return true
10298 }
10299 // match: (MOVWZreg x:(MOVHZload _ _))
10300 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2)
10301 // result: x
10302 for {
10303 x := v_0
10304 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) {
10305 break
10306 }
10307 v.copyOf(x)
10308 return true
10309 }
10310 // match: (MOVWZreg x:(MOVWZload _ _))
10311 // cond: (!x.Type.IsSigned() || x.Type.Size() > 4)
10312 // result: x
10313 for {
10314 x := v_0
10315 if x.Op != OpS390XMOVWZload || !(!x.Type.IsSigned() || x.Type.Size() > 4) {
10316 break
10317 }
10318 v.copyOf(x)
10319 return true
10320 }
10321 // match: (MOVWZreg <t> x:(MOVWload [o] {s} p mem))
10322 // cond: x.Uses == 1 && clobber(x)
10323 // result: @x.Block (MOVWZload <t> [o] {s} p mem)
10324 for {
10325 t := v.Type
10326 x := v_0
10327 if x.Op != OpS390XMOVWload {
10328 break
10329 }
10330 o := auxIntToInt32(x.AuxInt)
10331 s := auxToSym(x.Aux)
10332 mem := x.Args[1]
10333 p := x.Args[0]
10334 if !(x.Uses == 1 && clobber(x)) {
10335 break
10336 }
10337 b = x.Block
10338 v0 := b.NewValue0(x.Pos, OpS390XMOVWZload, t)
10339 v.copyOf(v0)
10340 v0.AuxInt = int32ToAuxInt(o)
10341 v0.Aux = symToAux(s)
10342 v0.AddArg2(p, mem)
10343 return true
10344 }
10345 // match: (MOVWZreg x:(Arg <t>))
10346 // cond: !t.IsSigned() && t.Size() <= 4
10347 // result: x
10348 for {
10349 x := v_0
10350 if x.Op != OpArg {
10351 break
10352 }
10353 t := x.Type
10354 if !(!t.IsSigned() && t.Size() <= 4) {
10355 break
10356 }
10357 v.copyOf(x)
10358 return true
10359 }
10360 // match: (MOVWZreg (MOVDconst [c]))
10361 // result: (MOVDconst [int64(uint32(c))])
10362 for {
10363 if v_0.Op != OpS390XMOVDconst {
10364 break
10365 }
10366 c := auxIntToInt64(v_0.AuxInt)
10367 v.reset(OpS390XMOVDconst)
10368 v.AuxInt = int64ToAuxInt(int64(uint32(c)))
10369 return true
10370 }
10371 // match: (MOVWZreg (RISBGZ x {r}))
10372 // cond: r.OutMerge(0xffffffff) != nil
10373 // result: (RISBGZ x {*r.OutMerge(0xffffffff)})
10374 for {
10375 if v_0.Op != OpS390XRISBGZ {
10376 break
10377 }
10378 r := auxToS390xRotateParams(v_0.Aux)
10379 x := v_0.Args[0]
10380 if !(r.OutMerge(0xffffffff) != nil) {
10381 break
10382 }
10383 v.reset(OpS390XRISBGZ)
10384 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0xffffffff))
10385 v.AddArg(x)
10386 return true
10387 }
10388 return false
10389 }
10390 func rewriteValueS390X_OpS390XMOVWload(v *Value) bool {
10391 v_1 := v.Args[1]
10392 v_0 := v.Args[0]
10393 // match: (MOVWload [off] {sym} ptr1 (MOVWstore [off] {sym} ptr2 x _))
10394 // cond: isSamePtr(ptr1, ptr2)
10395 // result: (MOVWreg x)
10396 for {
10397 off := auxIntToInt32(v.AuxInt)
10398 sym := auxToSym(v.Aux)
10399 ptr1 := v_0
10400 if v_1.Op != OpS390XMOVWstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
10401 break
10402 }
10403 x := v_1.Args[1]
10404 ptr2 := v_1.Args[0]
10405 if !(isSamePtr(ptr1, ptr2)) {
10406 break
10407 }
10408 v.reset(OpS390XMOVWreg)
10409 v.AddArg(x)
10410 return true
10411 }
10412 // match: (MOVWload [off1] {sym} (ADDconst [off2] ptr) mem)
10413 // cond: is20Bit(int64(off1)+int64(off2))
10414 // result: (MOVWload [off1+off2] {sym} ptr mem)
10415 for {
10416 off1 := auxIntToInt32(v.AuxInt)
10417 sym := auxToSym(v.Aux)
10418 if v_0.Op != OpS390XADDconst {
10419 break
10420 }
10421 off2 := auxIntToInt32(v_0.AuxInt)
10422 ptr := v_0.Args[0]
10423 mem := v_1
10424 if !(is20Bit(int64(off1) + int64(off2))) {
10425 break
10426 }
10427 v.reset(OpS390XMOVWload)
10428 v.AuxInt = int32ToAuxInt(off1 + off2)
10429 v.Aux = symToAux(sym)
10430 v.AddArg2(ptr, mem)
10431 return true
10432 }
10433 // match: (MOVWload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
10434 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))
10435 // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem)
10436 for {
10437 off1 := auxIntToInt32(v.AuxInt)
10438 sym1 := auxToSym(v.Aux)
10439 if v_0.Op != OpS390XMOVDaddr {
10440 break
10441 }
10442 t := v_0.Type
10443 off2 := auxIntToInt32(v_0.AuxInt)
10444 sym2 := auxToSym(v_0.Aux)
10445 base := v_0.Args[0]
10446 mem := v_1
10447 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) {
10448 break
10449 }
10450 v.reset(OpS390XMOVWload)
10451 v.AuxInt = int32ToAuxInt(off1 + off2)
10452 v.Aux = symToAux(mergeSym(sym1, sym2))
10453 v.AddArg2(base, mem)
10454 return true
10455 }
10456 return false
10457 }
10458 func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool {
10459 v_0 := v.Args[0]
10460 b := v.Block
10461 // match: (MOVWreg e:(MOVBreg x))
10462 // cond: clobberIfDead(e)
10463 // result: (MOVBreg x)
10464 for {
10465 e := v_0
10466 if e.Op != OpS390XMOVBreg {
10467 break
10468 }
10469 x := e.Args[0]
10470 if !(clobberIfDead(e)) {
10471 break
10472 }
10473 v.reset(OpS390XMOVBreg)
10474 v.AddArg(x)
10475 return true
10476 }
10477 // match: (MOVWreg e:(MOVHreg x))
10478 // cond: clobberIfDead(e)
10479 // result: (MOVHreg x)
10480 for {
10481 e := v_0
10482 if e.Op != OpS390XMOVHreg {
10483 break
10484 }
10485 x := e.Args[0]
10486 if !(clobberIfDead(e)) {
10487 break
10488 }
10489 v.reset(OpS390XMOVHreg)
10490 v.AddArg(x)
10491 return true
10492 }
10493 // match: (MOVWreg e:(MOVWreg x))
10494 // cond: clobberIfDead(e)
10495 // result: (MOVWreg x)
10496 for {
10497 e := v_0
10498 if e.Op != OpS390XMOVWreg {
10499 break
10500 }
10501 x := e.Args[0]
10502 if !(clobberIfDead(e)) {
10503 break
10504 }
10505 v.reset(OpS390XMOVWreg)
10506 v.AddArg(x)
10507 return true
10508 }
10509 // match: (MOVWreg e:(MOVWZreg x))
10510 // cond: clobberIfDead(e)
10511 // result: (MOVWreg x)
10512 for {
10513 e := v_0
10514 if e.Op != OpS390XMOVWZreg {
10515 break
10516 }
10517 x := e.Args[0]
10518 if !(clobberIfDead(e)) {
10519 break
10520 }
10521 v.reset(OpS390XMOVWreg)
10522 v.AddArg(x)
10523 return true
10524 }
10525 // match: (MOVWreg x:(MOVBload _ _))
10526 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
10527 // result: x
10528 for {
10529 x := v_0
10530 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
10531 break
10532 }
10533 v.copyOf(x)
10534 return true
10535 }
10536 // match: (MOVWreg x:(MOVHload _ _))
10537 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
10538 // result: x
10539 for {
10540 x := v_0
10541 if x.Op != OpS390XMOVHload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
10542 break
10543 }
10544 v.copyOf(x)
10545 return true
10546 }
10547 // match: (MOVWreg x:(MOVWload _ _))
10548 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
10549 // result: x
10550 for {
10551 x := v_0
10552 if x.Op != OpS390XMOVWload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
10553 break
10554 }
10555 v.copyOf(x)
10556 return true
10557 }
10558 // match: (MOVWreg x:(MOVBZload _ _))
10559 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
10560 // result: x
10561 for {
10562 x := v_0
10563 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
10564 break
10565 }
10566 v.copyOf(x)
10567 return true
10568 }
10569 // match: (MOVWreg x:(MOVHZload _ _))
10570 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2)
10571 // result: x
10572 for {
10573 x := v_0
10574 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) {
10575 break
10576 }
10577 v.copyOf(x)
10578 return true
10579 }
10580 // match: (MOVWreg <t> x:(MOVWZload [o] {s} p mem))
10581 // cond: x.Uses == 1 && clobber(x)
10582 // result: @x.Block (MOVWload <t> [o] {s} p mem)
10583 for {
10584 t := v.Type
10585 x := v_0
10586 if x.Op != OpS390XMOVWZload {
10587 break
10588 }
10589 o := auxIntToInt32(x.AuxInt)
10590 s := auxToSym(x.Aux)
10591 mem := x.Args[1]
10592 p := x.Args[0]
10593 if !(x.Uses == 1 && clobber(x)) {
10594 break
10595 }
10596 b = x.Block
10597 v0 := b.NewValue0(x.Pos, OpS390XMOVWload, t)
10598 v.copyOf(v0)
10599 v0.AuxInt = int32ToAuxInt(o)
10600 v0.Aux = symToAux(s)
10601 v0.AddArg2(p, mem)
10602 return true
10603 }
10604 // match: (MOVWreg x:(Arg <t>))
10605 // cond: t.IsSigned() && t.Size() <= 4
10606 // result: x
10607 for {
10608 x := v_0
10609 if x.Op != OpArg {
10610 break
10611 }
10612 t := x.Type
10613 if !(t.IsSigned() && t.Size() <= 4) {
10614 break
10615 }
10616 v.copyOf(x)
10617 return true
10618 }
10619 // match: (MOVWreg (MOVDconst [c]))
10620 // result: (MOVDconst [int64(int32(c))])
10621 for {
10622 if v_0.Op != OpS390XMOVDconst {
10623 break
10624 }
10625 c := auxIntToInt64(v_0.AuxInt)
10626 v.reset(OpS390XMOVDconst)
10627 v.AuxInt = int64ToAuxInt(int64(int32(c)))
10628 return true
10629 }
10630 return false
10631 }
10632 func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool {
10633 v_2 := v.Args[2]
10634 v_1 := v.Args[1]
10635 v_0 := v.Args[0]
10636 // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem)
10637 // result: (MOVWstore [off] {sym} ptr x mem)
10638 for {
10639 off := auxIntToInt32(v.AuxInt)
10640 sym := auxToSym(v.Aux)
10641 ptr := v_0
10642 if v_1.Op != OpS390XMOVWreg {
10643 break
10644 }
10645 x := v_1.Args[0]
10646 mem := v_2
10647 v.reset(OpS390XMOVWstore)
10648 v.AuxInt = int32ToAuxInt(off)
10649 v.Aux = symToAux(sym)
10650 v.AddArg3(ptr, x, mem)
10651 return true
10652 }
10653 // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem)
10654 // result: (MOVWstore [off] {sym} ptr x mem)
10655 for {
10656 off := auxIntToInt32(v.AuxInt)
10657 sym := auxToSym(v.Aux)
10658 ptr := v_0
10659 if v_1.Op != OpS390XMOVWZreg {
10660 break
10661 }
10662 x := v_1.Args[0]
10663 mem := v_2
10664 v.reset(OpS390XMOVWstore)
10665 v.AuxInt = int32ToAuxInt(off)
10666 v.Aux = symToAux(sym)
10667 v.AddArg3(ptr, x, mem)
10668 return true
10669 }
10670 // match: (MOVWstore [off1] {sym} (ADDconst [off2] ptr) val mem)
10671 // cond: is20Bit(int64(off1)+int64(off2))
10672 // result: (MOVWstore [off1+off2] {sym} ptr val mem)
10673 for {
10674 off1 := auxIntToInt32(v.AuxInt)
10675 sym := auxToSym(v.Aux)
10676 if v_0.Op != OpS390XADDconst {
10677 break
10678 }
10679 off2 := auxIntToInt32(v_0.AuxInt)
10680 ptr := v_0.Args[0]
10681 val := v_1
10682 mem := v_2
10683 if !(is20Bit(int64(off1) + int64(off2))) {
10684 break
10685 }
10686 v.reset(OpS390XMOVWstore)
10687 v.AuxInt = int32ToAuxInt(off1 + off2)
10688 v.Aux = symToAux(sym)
10689 v.AddArg3(ptr, val, mem)
10690 return true
10691 }
10692 // match: (MOVWstore [off] {sym} ptr (MOVDconst [c]) mem)
10693 // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB
10694 // result: (MOVWstoreconst [makeValAndOff(int32(c),off)] {sym} ptr mem)
10695 for {
10696 off := auxIntToInt32(v.AuxInt)
10697 sym := auxToSym(v.Aux)
10698 ptr := v_0
10699 if v_1.Op != OpS390XMOVDconst {
10700 break
10701 }
10702 c := auxIntToInt64(v_1.AuxInt)
10703 mem := v_2
10704 if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) {
10705 break
10706 }
10707 v.reset(OpS390XMOVWstoreconst)
10708 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
10709 v.Aux = symToAux(sym)
10710 v.AddArg2(ptr, mem)
10711 return true
10712 }
10713 // match: (MOVWstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem)
10714 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))
10715 // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
10716 for {
10717 off1 := auxIntToInt32(v.AuxInt)
10718 sym1 := auxToSym(v.Aux)
10719 if v_0.Op != OpS390XMOVDaddr {
10720 break
10721 }
10722 t := v_0.Type
10723 off2 := auxIntToInt32(v_0.AuxInt)
10724 sym2 := auxToSym(v_0.Aux)
10725 base := v_0.Args[0]
10726 val := v_1
10727 mem := v_2
10728 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) {
10729 break
10730 }
10731 v.reset(OpS390XMOVWstore)
10732 v.AuxInt = int32ToAuxInt(off1 + off2)
10733 v.Aux = symToAux(mergeSym(sym1, sym2))
10734 v.AddArg3(base, val, mem)
10735 return true
10736 }
10737 // match: (MOVWstore [i] {s} p w1 x:(MOVWstore [i-4] {s} p w0 mem))
10738 // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && setPos(v, x.Pos) && clobber(x)
10739 // result: (STM2 [i-4] {s} p w0 w1 mem)
10740 for {
10741 i := auxIntToInt32(v.AuxInt)
10742 s := auxToSym(v.Aux)
10743 p := v_0
10744 w1 := v_1
10745 x := v_2
10746 if x.Op != OpS390XMOVWstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s {
10747 break
10748 }
10749 mem := x.Args[2]
10750 if p != x.Args[0] {
10751 break
10752 }
10753 w0 := x.Args[1]
10754 if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && setPos(v, x.Pos) && clobber(x)) {
10755 break
10756 }
10757 v.reset(OpS390XSTM2)
10758 v.AuxInt = int32ToAuxInt(i - 4)
10759 v.Aux = symToAux(s)
10760 v.AddArg4(p, w0, w1, mem)
10761 return true
10762 }
10763 // match: (MOVWstore [i] {s} p w2 x:(STM2 [i-8] {s} p w0 w1 mem))
10764 // cond: x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)
10765 // result: (STM3 [i-8] {s} p w0 w1 w2 mem)
10766 for {
10767 i := auxIntToInt32(v.AuxInt)
10768 s := auxToSym(v.Aux)
10769 p := v_0
10770 w2 := v_1
10771 x := v_2
10772 if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s {
10773 break
10774 }
10775 mem := x.Args[3]
10776 if p != x.Args[0] {
10777 break
10778 }
10779 w0 := x.Args[1]
10780 w1 := x.Args[2]
10781 if !(x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)) {
10782 break
10783 }
10784 v.reset(OpS390XSTM3)
10785 v.AuxInt = int32ToAuxInt(i - 8)
10786 v.Aux = symToAux(s)
10787 v.AddArg5(p, w0, w1, w2, mem)
10788 return true
10789 }
10790 // match: (MOVWstore [i] {s} p w3 x:(STM3 [i-12] {s} p w0 w1 w2 mem))
10791 // cond: x.Uses == 1 && is20Bit(int64(i)-12) && setPos(v, x.Pos) && clobber(x)
10792 // result: (STM4 [i-12] {s} p w0 w1 w2 w3 mem)
10793 for {
10794 i := auxIntToInt32(v.AuxInt)
10795 s := auxToSym(v.Aux)
10796 p := v_0
10797 w3 := v_1
10798 x := v_2
10799 if x.Op != OpS390XSTM3 || auxIntToInt32(x.AuxInt) != i-12 || auxToSym(x.Aux) != s {
10800 break
10801 }
10802 mem := x.Args[4]
10803 if p != x.Args[0] {
10804 break
10805 }
10806 w0 := x.Args[1]
10807 w1 := x.Args[2]
10808 w2 := x.Args[3]
10809 if !(x.Uses == 1 && is20Bit(int64(i)-12) && setPos(v, x.Pos) && clobber(x)) {
10810 break
10811 }
10812 v.reset(OpS390XSTM4)
10813 v.AuxInt = int32ToAuxInt(i - 12)
10814 v.Aux = symToAux(s)
10815 v.AddArg6(p, w0, w1, w2, w3, mem)
10816 return true
10817 }
10818 // match: (MOVWstore [off] {sym} ptr r:(MOVWBR x) mem)
10819 // cond: r.Uses == 1
10820 // result: (MOVWBRstore [off] {sym} ptr x mem)
10821 for {
10822 off := auxIntToInt32(v.AuxInt)
10823 sym := auxToSym(v.Aux)
10824 ptr := v_0
10825 r := v_1
10826 if r.Op != OpS390XMOVWBR {
10827 break
10828 }
10829 x := r.Args[0]
10830 mem := v_2
10831 if !(r.Uses == 1) {
10832 break
10833 }
10834 v.reset(OpS390XMOVWBRstore)
10835 v.AuxInt = int32ToAuxInt(off)
10836 v.Aux = symToAux(sym)
10837 v.AddArg3(ptr, x, mem)
10838 return true
10839 }
10840 return false
10841 }
10842 func rewriteValueS390X_OpS390XMOVWstoreconst(v *Value) bool {
10843 v_1 := v.Args[1]
10844 v_0 := v.Args[0]
10845 // match: (MOVWstoreconst [sc] {s} (ADDconst [off] ptr) mem)
10846 // cond: isU12Bit(sc.Off64()+int64(off))
10847 // result: (MOVWstoreconst [sc.addOffset32(off)] {s} ptr mem)
10848 for {
10849 sc := auxIntToValAndOff(v.AuxInt)
10850 s := auxToSym(v.Aux)
10851 if v_0.Op != OpS390XADDconst {
10852 break
10853 }
10854 off := auxIntToInt32(v_0.AuxInt)
10855 ptr := v_0.Args[0]
10856 mem := v_1
10857 if !(isU12Bit(sc.Off64() + int64(off))) {
10858 break
10859 }
10860 v.reset(OpS390XMOVWstoreconst)
10861 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
10862 v.Aux = symToAux(s)
10863 v.AddArg2(ptr, mem)
10864 return true
10865 }
10866 // match: (MOVWstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem)
10867 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)
10868 // result: (MOVWstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
10869 for {
10870 sc := auxIntToValAndOff(v.AuxInt)
10871 sym1 := auxToSym(v.Aux)
10872 if v_0.Op != OpS390XMOVDaddr {
10873 break
10874 }
10875 off := auxIntToInt32(v_0.AuxInt)
10876 sym2 := auxToSym(v_0.Aux)
10877 ptr := v_0.Args[0]
10878 mem := v_1
10879 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) {
10880 break
10881 }
10882 v.reset(OpS390XMOVWstoreconst)
10883 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
10884 v.Aux = symToAux(mergeSym(sym1, sym2))
10885 v.AddArg2(ptr, mem)
10886 return true
10887 }
10888 return false
10889 }
10890 func rewriteValueS390X_OpS390XMOVWstoreidx(v *Value) bool {
10891 v_3 := v.Args[3]
10892 v_2 := v.Args[2]
10893 v_1 := v.Args[1]
10894 v_0 := v.Args[0]
10895 // match: (MOVWstoreidx [off] {sym} ptr idx r:(MOVWBR x) mem)
10896 // cond: r.Uses == 1
10897 // result: (MOVWBRstoreidx [off] {sym} ptr idx x mem)
10898 for {
10899 off := auxIntToInt32(v.AuxInt)
10900 sym := auxToSym(v.Aux)
10901 ptr := v_0
10902 idx := v_1
10903 r := v_2
10904 if r.Op != OpS390XMOVWBR {
10905 break
10906 }
10907 x := r.Args[0]
10908 mem := v_3
10909 if !(r.Uses == 1) {
10910 break
10911 }
10912 v.reset(OpS390XMOVWBRstoreidx)
10913 v.AuxInt = int32ToAuxInt(off)
10914 v.Aux = symToAux(sym)
10915 v.AddArg4(ptr, idx, x, mem)
10916 return true
10917 }
10918 return false
10919 }
10920 func rewriteValueS390X_OpS390XMULLD(v *Value) bool {
10921 v_1 := v.Args[1]
10922 v_0 := v.Args[0]
10923 // match: (MULLD x (MOVDconst [c]))
10924 // cond: is32Bit(c)
10925 // result: (MULLDconst [int32(c)] x)
10926 for {
10927 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10928 x := v_0
10929 if v_1.Op != OpS390XMOVDconst {
10930 continue
10931 }
10932 c := auxIntToInt64(v_1.AuxInt)
10933 if !(is32Bit(c)) {
10934 continue
10935 }
10936 v.reset(OpS390XMULLDconst)
10937 v.AuxInt = int32ToAuxInt(int32(c))
10938 v.AddArg(x)
10939 return true
10940 }
10941 break
10942 }
10943 // match: (MULLD <t> x g:(MOVDload [off] {sym} ptr mem))
10944 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
10945 // result: (MULLDload <t> [off] {sym} x ptr mem)
10946 for {
10947 t := v.Type
10948 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10949 x := v_0
10950 g := v_1
10951 if g.Op != OpS390XMOVDload {
10952 continue
10953 }
10954 off := auxIntToInt32(g.AuxInt)
10955 sym := auxToSym(g.Aux)
10956 mem := g.Args[1]
10957 ptr := g.Args[0]
10958 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
10959 continue
10960 }
10961 v.reset(OpS390XMULLDload)
10962 v.Type = t
10963 v.AuxInt = int32ToAuxInt(off)
10964 v.Aux = symToAux(sym)
10965 v.AddArg3(x, ptr, mem)
10966 return true
10967 }
10968 break
10969 }
10970 return false
10971 }
10972 func rewriteValueS390X_OpS390XMULLDconst(v *Value) bool {
10973 v_0 := v.Args[0]
10974 b := v.Block
10975 // match: (MULLDconst <t> x [c])
10976 // cond: isPowerOfTwo(c&(c-1))
10977 // result: (ADD (SLDconst <t> x [uint8(log32(c&(c-1)))]) (SLDconst <t> x [uint8(log32(c&^(c-1)))]))
10978 for {
10979 t := v.Type
10980 c := auxIntToInt32(v.AuxInt)
10981 x := v_0
10982 if !(isPowerOfTwo(c & (c - 1))) {
10983 break
10984 }
10985 v.reset(OpS390XADD)
10986 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
10987 v0.AuxInt = uint8ToAuxInt(uint8(log32(c & (c - 1))))
10988 v0.AddArg(x)
10989 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
10990 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1))))
10991 v1.AddArg(x)
10992 v.AddArg2(v0, v1)
10993 return true
10994 }
10995 // match: (MULLDconst <t> x [c])
10996 // cond: isPowerOfTwo(c+(c&^(c-1)))
10997 // result: (SUB (SLDconst <t> x [uint8(log32(c+(c&^(c-1))))]) (SLDconst <t> x [uint8(log32(c&^(c-1)))]))
10998 for {
10999 t := v.Type
11000 c := auxIntToInt32(v.AuxInt)
11001 x := v_0
11002 if !(isPowerOfTwo(c + (c &^ (c - 1)))) {
11003 break
11004 }
11005 v.reset(OpS390XSUB)
11006 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
11007 v0.AuxInt = uint8ToAuxInt(uint8(log32(c + (c &^ (c - 1)))))
11008 v0.AddArg(x)
11009 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
11010 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1))))
11011 v1.AddArg(x)
11012 v.AddArg2(v0, v1)
11013 return true
11014 }
11015 // match: (MULLDconst <t> x [c])
11016 // cond: isPowerOfTwo(-c+(-c&^(-c-1)))
11017 // result: (SUB (SLDconst <t> x [uint8(log32(-c&^(-c-1)))]) (SLDconst <t> x [uint8(log32(-c+(-c&^(-c-1))))]))
11018 for {
11019 t := v.Type
11020 c := auxIntToInt32(v.AuxInt)
11021 x := v_0
11022 if !(isPowerOfTwo(-c + (-c &^ (-c - 1)))) {
11023 break
11024 }
11025 v.reset(OpS390XSUB)
11026 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
11027 v0.AuxInt = uint8ToAuxInt(uint8(log32(-c &^ (-c - 1))))
11028 v0.AddArg(x)
11029 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
11030 v1.AuxInt = uint8ToAuxInt(uint8(log32(-c + (-c &^ (-c - 1)))))
11031 v1.AddArg(x)
11032 v.AddArg2(v0, v1)
11033 return true
11034 }
11035 // match: (MULLDconst [c] (MOVDconst [d]))
11036 // result: (MOVDconst [int64(c)*d])
11037 for {
11038 c := auxIntToInt32(v.AuxInt)
11039 if v_0.Op != OpS390XMOVDconst {
11040 break
11041 }
11042 d := auxIntToInt64(v_0.AuxInt)
11043 v.reset(OpS390XMOVDconst)
11044 v.AuxInt = int64ToAuxInt(int64(c) * d)
11045 return true
11046 }
11047 return false
11048 }
11049 func rewriteValueS390X_OpS390XMULLDload(v *Value) bool {
11050 v_2 := v.Args[2]
11051 v_1 := v.Args[1]
11052 v_0 := v.Args[0]
11053 b := v.Block
11054 // match: (MULLDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
11055 // cond: isSamePtr(ptr1, ptr2)
11056 // result: (MULLD x (LGDR <t> y))
11057 for {
11058 t := v.Type
11059 off := auxIntToInt32(v.AuxInt)
11060 sym := auxToSym(v.Aux)
11061 x := v_0
11062 ptr1 := v_1
11063 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
11064 break
11065 }
11066 y := v_2.Args[1]
11067 ptr2 := v_2.Args[0]
11068 if !(isSamePtr(ptr1, ptr2)) {
11069 break
11070 }
11071 v.reset(OpS390XMULLD)
11072 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
11073 v0.AddArg(y)
11074 v.AddArg2(x, v0)
11075 return true
11076 }
11077 // match: (MULLDload [off1] {sym} x (ADDconst [off2] ptr) mem)
11078 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
11079 // result: (MULLDload [off1+off2] {sym} x ptr mem)
11080 for {
11081 off1 := auxIntToInt32(v.AuxInt)
11082 sym := auxToSym(v.Aux)
11083 x := v_0
11084 if v_1.Op != OpS390XADDconst {
11085 break
11086 }
11087 off2 := auxIntToInt32(v_1.AuxInt)
11088 ptr := v_1.Args[0]
11089 mem := v_2
11090 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
11091 break
11092 }
11093 v.reset(OpS390XMULLDload)
11094 v.AuxInt = int32ToAuxInt(off1 + off2)
11095 v.Aux = symToAux(sym)
11096 v.AddArg3(x, ptr, mem)
11097 return true
11098 }
11099 // match: (MULLDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
11100 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
11101 // result: (MULLDload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
11102 for {
11103 o1 := auxIntToInt32(v.AuxInt)
11104 s1 := auxToSym(v.Aux)
11105 x := v_0
11106 if v_1.Op != OpS390XMOVDaddr {
11107 break
11108 }
11109 o2 := auxIntToInt32(v_1.AuxInt)
11110 s2 := auxToSym(v_1.Aux)
11111 ptr := v_1.Args[0]
11112 mem := v_2
11113 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
11114 break
11115 }
11116 v.reset(OpS390XMULLDload)
11117 v.AuxInt = int32ToAuxInt(o1 + o2)
11118 v.Aux = symToAux(mergeSym(s1, s2))
11119 v.AddArg3(x, ptr, mem)
11120 return true
11121 }
11122 return false
11123 }
11124 func rewriteValueS390X_OpS390XMULLW(v *Value) bool {
11125 v_1 := v.Args[1]
11126 v_0 := v.Args[0]
11127 // match: (MULLW x (MOVDconst [c]))
11128 // result: (MULLWconst [int32(c)] x)
11129 for {
11130 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11131 x := v_0
11132 if v_1.Op != OpS390XMOVDconst {
11133 continue
11134 }
11135 c := auxIntToInt64(v_1.AuxInt)
11136 v.reset(OpS390XMULLWconst)
11137 v.AuxInt = int32ToAuxInt(int32(c))
11138 v.AddArg(x)
11139 return true
11140 }
11141 break
11142 }
11143 // match: (MULLW <t> x g:(MOVWload [off] {sym} ptr mem))
11144 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11145 // result: (MULLWload <t> [off] {sym} x ptr mem)
11146 for {
11147 t := v.Type
11148 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11149 x := v_0
11150 g := v_1
11151 if g.Op != OpS390XMOVWload {
11152 continue
11153 }
11154 off := auxIntToInt32(g.AuxInt)
11155 sym := auxToSym(g.Aux)
11156 mem := g.Args[1]
11157 ptr := g.Args[0]
11158 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11159 continue
11160 }
11161 v.reset(OpS390XMULLWload)
11162 v.Type = t
11163 v.AuxInt = int32ToAuxInt(off)
11164 v.Aux = symToAux(sym)
11165 v.AddArg3(x, ptr, mem)
11166 return true
11167 }
11168 break
11169 }
11170 // match: (MULLW <t> x g:(MOVWZload [off] {sym} ptr mem))
11171 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11172 // result: (MULLWload <t> [off] {sym} x ptr mem)
11173 for {
11174 t := v.Type
11175 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11176 x := v_0
11177 g := v_1
11178 if g.Op != OpS390XMOVWZload {
11179 continue
11180 }
11181 off := auxIntToInt32(g.AuxInt)
11182 sym := auxToSym(g.Aux)
11183 mem := g.Args[1]
11184 ptr := g.Args[0]
11185 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11186 continue
11187 }
11188 v.reset(OpS390XMULLWload)
11189 v.Type = t
11190 v.AuxInt = int32ToAuxInt(off)
11191 v.Aux = symToAux(sym)
11192 v.AddArg3(x, ptr, mem)
11193 return true
11194 }
11195 break
11196 }
11197 return false
11198 }
11199 func rewriteValueS390X_OpS390XMULLWconst(v *Value) bool {
11200 v_0 := v.Args[0]
11201 b := v.Block
11202 // match: (MULLWconst <t> x [c])
11203 // cond: isPowerOfTwo(c&(c-1))
11204 // result: (ADDW (SLWconst <t> x [uint8(log32(c&(c-1)))]) (SLWconst <t> x [uint8(log32(c&^(c-1)))]))
11205 for {
11206 t := v.Type
11207 c := auxIntToInt32(v.AuxInt)
11208 x := v_0
11209 if !(isPowerOfTwo(c & (c - 1))) {
11210 break
11211 }
11212 v.reset(OpS390XADDW)
11213 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11214 v0.AuxInt = uint8ToAuxInt(uint8(log32(c & (c - 1))))
11215 v0.AddArg(x)
11216 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11217 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1))))
11218 v1.AddArg(x)
11219 v.AddArg2(v0, v1)
11220 return true
11221 }
11222 // match: (MULLWconst <t> x [c])
11223 // cond: isPowerOfTwo(c+(c&^(c-1)))
11224 // result: (SUBW (SLWconst <t> x [uint8(log32(c+(c&^(c-1))))]) (SLWconst <t> x [uint8(log32(c&^(c-1)))]))
11225 for {
11226 t := v.Type
11227 c := auxIntToInt32(v.AuxInt)
11228 x := v_0
11229 if !(isPowerOfTwo(c + (c &^ (c - 1)))) {
11230 break
11231 }
11232 v.reset(OpS390XSUBW)
11233 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11234 v0.AuxInt = uint8ToAuxInt(uint8(log32(c + (c &^ (c - 1)))))
11235 v0.AddArg(x)
11236 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11237 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1))))
11238 v1.AddArg(x)
11239 v.AddArg2(v0, v1)
11240 return true
11241 }
11242 // match: (MULLWconst <t> x [c])
11243 // cond: isPowerOfTwo(-c+(-c&^(-c-1)))
11244 // result: (SUBW (SLWconst <t> x [uint8(log32(-c&^(-c-1)))]) (SLWconst <t> x [uint8(log32(-c+(-c&^(-c-1))))]))
11245 for {
11246 t := v.Type
11247 c := auxIntToInt32(v.AuxInt)
11248 x := v_0
11249 if !(isPowerOfTwo(-c + (-c &^ (-c - 1)))) {
11250 break
11251 }
11252 v.reset(OpS390XSUBW)
11253 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11254 v0.AuxInt = uint8ToAuxInt(uint8(log32(-c &^ (-c - 1))))
11255 v0.AddArg(x)
11256 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11257 v1.AuxInt = uint8ToAuxInt(uint8(log32(-c + (-c &^ (-c - 1)))))
11258 v1.AddArg(x)
11259 v.AddArg2(v0, v1)
11260 return true
11261 }
11262 // match: (MULLWconst [c] (MOVDconst [d]))
11263 // result: (MOVDconst [int64(c*int32(d))])
11264 for {
11265 c := auxIntToInt32(v.AuxInt)
11266 if v_0.Op != OpS390XMOVDconst {
11267 break
11268 }
11269 d := auxIntToInt64(v_0.AuxInt)
11270 v.reset(OpS390XMOVDconst)
11271 v.AuxInt = int64ToAuxInt(int64(c * int32(d)))
11272 return true
11273 }
11274 return false
11275 }
11276 func rewriteValueS390X_OpS390XMULLWload(v *Value) bool {
11277 v_2 := v.Args[2]
11278 v_1 := v.Args[1]
11279 v_0 := v.Args[0]
11280 // match: (MULLWload [off1] {sym} x (ADDconst [off2] ptr) mem)
11281 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
11282 // result: (MULLWload [off1+off2] {sym} x ptr mem)
11283 for {
11284 off1 := auxIntToInt32(v.AuxInt)
11285 sym := auxToSym(v.Aux)
11286 x := v_0
11287 if v_1.Op != OpS390XADDconst {
11288 break
11289 }
11290 off2 := auxIntToInt32(v_1.AuxInt)
11291 ptr := v_1.Args[0]
11292 mem := v_2
11293 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
11294 break
11295 }
11296 v.reset(OpS390XMULLWload)
11297 v.AuxInt = int32ToAuxInt(off1 + off2)
11298 v.Aux = symToAux(sym)
11299 v.AddArg3(x, ptr, mem)
11300 return true
11301 }
11302 // match: (MULLWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
11303 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
11304 // result: (MULLWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
11305 for {
11306 o1 := auxIntToInt32(v.AuxInt)
11307 s1 := auxToSym(v.Aux)
11308 x := v_0
11309 if v_1.Op != OpS390XMOVDaddr {
11310 break
11311 }
11312 o2 := auxIntToInt32(v_1.AuxInt)
11313 s2 := auxToSym(v_1.Aux)
11314 ptr := v_1.Args[0]
11315 mem := v_2
11316 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
11317 break
11318 }
11319 v.reset(OpS390XMULLWload)
11320 v.AuxInt = int32ToAuxInt(o1 + o2)
11321 v.Aux = symToAux(mergeSym(s1, s2))
11322 v.AddArg3(x, ptr, mem)
11323 return true
11324 }
11325 return false
11326 }
11327 func rewriteValueS390X_OpS390XNEG(v *Value) bool {
11328 v_0 := v.Args[0]
11329 // match: (NEG (MOVDconst [c]))
11330 // result: (MOVDconst [-c])
11331 for {
11332 if v_0.Op != OpS390XMOVDconst {
11333 break
11334 }
11335 c := auxIntToInt64(v_0.AuxInt)
11336 v.reset(OpS390XMOVDconst)
11337 v.AuxInt = int64ToAuxInt(-c)
11338 return true
11339 }
11340 // match: (NEG (NEG x))
11341 // result: x
11342 for {
11343 if v_0.Op != OpS390XNEG {
11344 break
11345 }
11346 x := v_0.Args[0]
11347 v.copyOf(x)
11348 return true
11349 }
11350 // match: (NEG (ADDconst [c] (NEG x)))
11351 // cond: c != -(1<<31)
11352 // result: (ADDconst [-c] x)
11353 for {
11354 if v_0.Op != OpS390XADDconst {
11355 break
11356 }
11357 c := auxIntToInt32(v_0.AuxInt)
11358 v_0_0 := v_0.Args[0]
11359 if v_0_0.Op != OpS390XNEG {
11360 break
11361 }
11362 x := v_0_0.Args[0]
11363 if !(c != -(1 << 31)) {
11364 break
11365 }
11366 v.reset(OpS390XADDconst)
11367 v.AuxInt = int32ToAuxInt(-c)
11368 v.AddArg(x)
11369 return true
11370 }
11371 return false
11372 }
11373 func rewriteValueS390X_OpS390XNEGW(v *Value) bool {
11374 v_0 := v.Args[0]
11375 // match: (NEGW (MOVDconst [c]))
11376 // result: (MOVDconst [int64(int32(-c))])
11377 for {
11378 if v_0.Op != OpS390XMOVDconst {
11379 break
11380 }
11381 c := auxIntToInt64(v_0.AuxInt)
11382 v.reset(OpS390XMOVDconst)
11383 v.AuxInt = int64ToAuxInt(int64(int32(-c)))
11384 return true
11385 }
11386 return false
11387 }
11388 func rewriteValueS390X_OpS390XNOT(v *Value) bool {
11389 v_0 := v.Args[0]
11390 b := v.Block
11391 typ := &b.Func.Config.Types
11392 // match: (NOT x)
11393 // result: (XOR (MOVDconst [-1]) x)
11394 for {
11395 x := v_0
11396 v.reset(OpS390XXOR)
11397 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
11398 v0.AuxInt = int64ToAuxInt(-1)
11399 v.AddArg2(v0, x)
11400 return true
11401 }
11402 }
11403 func rewriteValueS390X_OpS390XNOTW(v *Value) bool {
11404 v_0 := v.Args[0]
11405 // match: (NOTW x)
11406 // result: (XORWconst [-1] x)
11407 for {
11408 x := v_0
11409 v.reset(OpS390XXORWconst)
11410 v.AuxInt = int32ToAuxInt(-1)
11411 v.AddArg(x)
11412 return true
11413 }
11414 }
11415 func rewriteValueS390X_OpS390XOR(v *Value) bool {
11416 v_1 := v.Args[1]
11417 v_0 := v.Args[0]
11418 b := v.Block
11419 // match: (OR x (MOVDconst [c]))
11420 // cond: isU32Bit(c)
11421 // result: (ORconst [c] x)
11422 for {
11423 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11424 x := v_0
11425 if v_1.Op != OpS390XMOVDconst {
11426 continue
11427 }
11428 c := auxIntToInt64(v_1.AuxInt)
11429 if !(isU32Bit(c)) {
11430 continue
11431 }
11432 v.reset(OpS390XORconst)
11433 v.AuxInt = int64ToAuxInt(c)
11434 v.AddArg(x)
11435 return true
11436 }
11437 break
11438 }
11439 // match: (OR (MOVDconst [-1<<63]) (LGDR <t> x))
11440 // result: (LGDR <t> (LNDFR <x.Type> x))
11441 for {
11442 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11443 if v_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0.AuxInt) != -1<<63 || v_1.Op != OpS390XLGDR {
11444 continue
11445 }
11446 t := v_1.Type
11447 x := v_1.Args[0]
11448 v.reset(OpS390XLGDR)
11449 v.Type = t
11450 v0 := b.NewValue0(v.Pos, OpS390XLNDFR, x.Type)
11451 v0.AddArg(x)
11452 v.AddArg(v0)
11453 return true
11454 }
11455 break
11456 }
11457 // match: (OR (RISBGZ (LGDR x) {r}) (LGDR (LPDFR <t> y)))
11458 // cond: r == s390x.NewRotateParams(0, 0, 0)
11459 // result: (LGDR (CPSDR <t> y x))
11460 for {
11461 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11462 if v_0.Op != OpS390XRISBGZ {
11463 continue
11464 }
11465 r := auxToS390xRotateParams(v_0.Aux)
11466 v_0_0 := v_0.Args[0]
11467 if v_0_0.Op != OpS390XLGDR {
11468 continue
11469 }
11470 x := v_0_0.Args[0]
11471 if v_1.Op != OpS390XLGDR {
11472 continue
11473 }
11474 v_1_0 := v_1.Args[0]
11475 if v_1_0.Op != OpS390XLPDFR {
11476 continue
11477 }
11478 t := v_1_0.Type
11479 y := v_1_0.Args[0]
11480 if !(r == s390x.NewRotateParams(0, 0, 0)) {
11481 continue
11482 }
11483 v.reset(OpS390XLGDR)
11484 v0 := b.NewValue0(v.Pos, OpS390XCPSDR, t)
11485 v0.AddArg2(y, x)
11486 v.AddArg(v0)
11487 return true
11488 }
11489 break
11490 }
11491 // match: (OR (RISBGZ (LGDR x) {r}) (MOVDconst [c]))
11492 // cond: c >= 0 && r == s390x.NewRotateParams(0, 0, 0)
11493 // result: (LGDR (CPSDR <x.Type> (FMOVDconst <x.Type> [math.Float64frombits(uint64(c))]) x))
11494 for {
11495 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11496 if v_0.Op != OpS390XRISBGZ {
11497 continue
11498 }
11499 r := auxToS390xRotateParams(v_0.Aux)
11500 v_0_0 := v_0.Args[0]
11501 if v_0_0.Op != OpS390XLGDR {
11502 continue
11503 }
11504 x := v_0_0.Args[0]
11505 if v_1.Op != OpS390XMOVDconst {
11506 continue
11507 }
11508 c := auxIntToInt64(v_1.AuxInt)
11509 if !(c >= 0 && r == s390x.NewRotateParams(0, 0, 0)) {
11510 continue
11511 }
11512 v.reset(OpS390XLGDR)
11513 v0 := b.NewValue0(v.Pos, OpS390XCPSDR, x.Type)
11514 v1 := b.NewValue0(v.Pos, OpS390XFMOVDconst, x.Type)
11515 v1.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c)))
11516 v0.AddArg2(v1, x)
11517 v.AddArg(v0)
11518 return true
11519 }
11520 break
11521 }
11522 // match: (OR (MOVDconst [c]) (MOVDconst [d]))
11523 // result: (MOVDconst [c|d])
11524 for {
11525 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11526 if v_0.Op != OpS390XMOVDconst {
11527 continue
11528 }
11529 c := auxIntToInt64(v_0.AuxInt)
11530 if v_1.Op != OpS390XMOVDconst {
11531 continue
11532 }
11533 d := auxIntToInt64(v_1.AuxInt)
11534 v.reset(OpS390XMOVDconst)
11535 v.AuxInt = int64ToAuxInt(c | d)
11536 return true
11537 }
11538 break
11539 }
11540 // match: (OR x x)
11541 // result: x
11542 for {
11543 x := v_0
11544 if x != v_1 {
11545 break
11546 }
11547 v.copyOf(x)
11548 return true
11549 }
11550 // match: (OR <t> x g:(MOVDload [off] {sym} ptr mem))
11551 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11552 // result: (ORload <t> [off] {sym} x ptr mem)
11553 for {
11554 t := v.Type
11555 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11556 x := v_0
11557 g := v_1
11558 if g.Op != OpS390XMOVDload {
11559 continue
11560 }
11561 off := auxIntToInt32(g.AuxInt)
11562 sym := auxToSym(g.Aux)
11563 mem := g.Args[1]
11564 ptr := g.Args[0]
11565 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11566 continue
11567 }
11568 v.reset(OpS390XORload)
11569 v.Type = t
11570 v.AuxInt = int32ToAuxInt(off)
11571 v.Aux = symToAux(sym)
11572 v.AddArg3(x, ptr, mem)
11573 return true
11574 }
11575 break
11576 }
11577 return false
11578 }
11579 func rewriteValueS390X_OpS390XORW(v *Value) bool {
11580 v_1 := v.Args[1]
11581 v_0 := v.Args[0]
11582 // match: (ORW x (MOVDconst [c]))
11583 // result: (ORWconst [int32(c)] x)
11584 for {
11585 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11586 x := v_0
11587 if v_1.Op != OpS390XMOVDconst {
11588 continue
11589 }
11590 c := auxIntToInt64(v_1.AuxInt)
11591 v.reset(OpS390XORWconst)
11592 v.AuxInt = int32ToAuxInt(int32(c))
11593 v.AddArg(x)
11594 return true
11595 }
11596 break
11597 }
11598 // match: (ORW x x)
11599 // result: x
11600 for {
11601 x := v_0
11602 if x != v_1 {
11603 break
11604 }
11605 v.copyOf(x)
11606 return true
11607 }
11608 // match: (ORW <t> x g:(MOVWload [off] {sym} ptr mem))
11609 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11610 // result: (ORWload <t> [off] {sym} x ptr mem)
11611 for {
11612 t := v.Type
11613 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11614 x := v_0
11615 g := v_1
11616 if g.Op != OpS390XMOVWload {
11617 continue
11618 }
11619 off := auxIntToInt32(g.AuxInt)
11620 sym := auxToSym(g.Aux)
11621 mem := g.Args[1]
11622 ptr := g.Args[0]
11623 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11624 continue
11625 }
11626 v.reset(OpS390XORWload)
11627 v.Type = t
11628 v.AuxInt = int32ToAuxInt(off)
11629 v.Aux = symToAux(sym)
11630 v.AddArg3(x, ptr, mem)
11631 return true
11632 }
11633 break
11634 }
11635 // match: (ORW <t> x g:(MOVWZload [off] {sym} ptr mem))
11636 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11637 // result: (ORWload <t> [off] {sym} x ptr mem)
11638 for {
11639 t := v.Type
11640 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11641 x := v_0
11642 g := v_1
11643 if g.Op != OpS390XMOVWZload {
11644 continue
11645 }
11646 off := auxIntToInt32(g.AuxInt)
11647 sym := auxToSym(g.Aux)
11648 mem := g.Args[1]
11649 ptr := g.Args[0]
11650 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11651 continue
11652 }
11653 v.reset(OpS390XORWload)
11654 v.Type = t
11655 v.AuxInt = int32ToAuxInt(off)
11656 v.Aux = symToAux(sym)
11657 v.AddArg3(x, ptr, mem)
11658 return true
11659 }
11660 break
11661 }
11662 return false
11663 }
11664 func rewriteValueS390X_OpS390XORWconst(v *Value) bool {
11665 v_0 := v.Args[0]
11666 // match: (ORWconst [c] x)
11667 // cond: int32(c)==0
11668 // result: x
11669 for {
11670 c := auxIntToInt32(v.AuxInt)
11671 x := v_0
11672 if !(int32(c) == 0) {
11673 break
11674 }
11675 v.copyOf(x)
11676 return true
11677 }
11678 // match: (ORWconst [c] _)
11679 // cond: int32(c)==-1
11680 // result: (MOVDconst [-1])
11681 for {
11682 c := auxIntToInt32(v.AuxInt)
11683 if !(int32(c) == -1) {
11684 break
11685 }
11686 v.reset(OpS390XMOVDconst)
11687 v.AuxInt = int64ToAuxInt(-1)
11688 return true
11689 }
11690 // match: (ORWconst [c] (MOVDconst [d]))
11691 // result: (MOVDconst [int64(c)|d])
11692 for {
11693 c := auxIntToInt32(v.AuxInt)
11694 if v_0.Op != OpS390XMOVDconst {
11695 break
11696 }
11697 d := auxIntToInt64(v_0.AuxInt)
11698 v.reset(OpS390XMOVDconst)
11699 v.AuxInt = int64ToAuxInt(int64(c) | d)
11700 return true
11701 }
11702 return false
11703 }
11704 func rewriteValueS390X_OpS390XORWload(v *Value) bool {
11705 v_2 := v.Args[2]
11706 v_1 := v.Args[1]
11707 v_0 := v.Args[0]
11708 // match: (ORWload [off1] {sym} x (ADDconst [off2] ptr) mem)
11709 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
11710 // result: (ORWload [off1+off2] {sym} x ptr mem)
11711 for {
11712 off1 := auxIntToInt32(v.AuxInt)
11713 sym := auxToSym(v.Aux)
11714 x := v_0
11715 if v_1.Op != OpS390XADDconst {
11716 break
11717 }
11718 off2 := auxIntToInt32(v_1.AuxInt)
11719 ptr := v_1.Args[0]
11720 mem := v_2
11721 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
11722 break
11723 }
11724 v.reset(OpS390XORWload)
11725 v.AuxInt = int32ToAuxInt(off1 + off2)
11726 v.Aux = symToAux(sym)
11727 v.AddArg3(x, ptr, mem)
11728 return true
11729 }
11730 // match: (ORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
11731 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
11732 // result: (ORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
11733 for {
11734 o1 := auxIntToInt32(v.AuxInt)
11735 s1 := auxToSym(v.Aux)
11736 x := v_0
11737 if v_1.Op != OpS390XMOVDaddr {
11738 break
11739 }
11740 o2 := auxIntToInt32(v_1.AuxInt)
11741 s2 := auxToSym(v_1.Aux)
11742 ptr := v_1.Args[0]
11743 mem := v_2
11744 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
11745 break
11746 }
11747 v.reset(OpS390XORWload)
11748 v.AuxInt = int32ToAuxInt(o1 + o2)
11749 v.Aux = symToAux(mergeSym(s1, s2))
11750 v.AddArg3(x, ptr, mem)
11751 return true
11752 }
11753 return false
11754 }
11755 func rewriteValueS390X_OpS390XORconst(v *Value) bool {
11756 v_0 := v.Args[0]
11757 // match: (ORconst [0] x)
11758 // result: x
11759 for {
11760 if auxIntToInt64(v.AuxInt) != 0 {
11761 break
11762 }
11763 x := v_0
11764 v.copyOf(x)
11765 return true
11766 }
11767 // match: (ORconst [-1] _)
11768 // result: (MOVDconst [-1])
11769 for {
11770 if auxIntToInt64(v.AuxInt) != -1 {
11771 break
11772 }
11773 v.reset(OpS390XMOVDconst)
11774 v.AuxInt = int64ToAuxInt(-1)
11775 return true
11776 }
11777 // match: (ORconst [c] (MOVDconst [d]))
11778 // result: (MOVDconst [c|d])
11779 for {
11780 c := auxIntToInt64(v.AuxInt)
11781 if v_0.Op != OpS390XMOVDconst {
11782 break
11783 }
11784 d := auxIntToInt64(v_0.AuxInt)
11785 v.reset(OpS390XMOVDconst)
11786 v.AuxInt = int64ToAuxInt(c | d)
11787 return true
11788 }
11789 return false
11790 }
11791 func rewriteValueS390X_OpS390XORload(v *Value) bool {
11792 v_2 := v.Args[2]
11793 v_1 := v.Args[1]
11794 v_0 := v.Args[0]
11795 b := v.Block
11796 // match: (ORload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
11797 // cond: isSamePtr(ptr1, ptr2)
11798 // result: (OR x (LGDR <t> y))
11799 for {
11800 t := v.Type
11801 off := auxIntToInt32(v.AuxInt)
11802 sym := auxToSym(v.Aux)
11803 x := v_0
11804 ptr1 := v_1
11805 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
11806 break
11807 }
11808 y := v_2.Args[1]
11809 ptr2 := v_2.Args[0]
11810 if !(isSamePtr(ptr1, ptr2)) {
11811 break
11812 }
11813 v.reset(OpS390XOR)
11814 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
11815 v0.AddArg(y)
11816 v.AddArg2(x, v0)
11817 return true
11818 }
11819 // match: (ORload [off1] {sym} x (ADDconst [off2] ptr) mem)
11820 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
11821 // result: (ORload [off1+off2] {sym} x ptr mem)
11822 for {
11823 off1 := auxIntToInt32(v.AuxInt)
11824 sym := auxToSym(v.Aux)
11825 x := v_0
11826 if v_1.Op != OpS390XADDconst {
11827 break
11828 }
11829 off2 := auxIntToInt32(v_1.AuxInt)
11830 ptr := v_1.Args[0]
11831 mem := v_2
11832 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
11833 break
11834 }
11835 v.reset(OpS390XORload)
11836 v.AuxInt = int32ToAuxInt(off1 + off2)
11837 v.Aux = symToAux(sym)
11838 v.AddArg3(x, ptr, mem)
11839 return true
11840 }
11841 // match: (ORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
11842 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
11843 // result: (ORload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
11844 for {
11845 o1 := auxIntToInt32(v.AuxInt)
11846 s1 := auxToSym(v.Aux)
11847 x := v_0
11848 if v_1.Op != OpS390XMOVDaddr {
11849 break
11850 }
11851 o2 := auxIntToInt32(v_1.AuxInt)
11852 s2 := auxToSym(v_1.Aux)
11853 ptr := v_1.Args[0]
11854 mem := v_2
11855 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
11856 break
11857 }
11858 v.reset(OpS390XORload)
11859 v.AuxInt = int32ToAuxInt(o1 + o2)
11860 v.Aux = symToAux(mergeSym(s1, s2))
11861 v.AddArg3(x, ptr, mem)
11862 return true
11863 }
11864 return false
11865 }
11866 func rewriteValueS390X_OpS390XRISBGZ(v *Value) bool {
11867 v_0 := v.Args[0]
11868 b := v.Block
11869 // match: (RISBGZ (MOVWZreg x) {r})
11870 // cond: r.InMerge(0xffffffff) != nil
11871 // result: (RISBGZ x {*r.InMerge(0xffffffff)})
11872 for {
11873 r := auxToS390xRotateParams(v.Aux)
11874 if v_0.Op != OpS390XMOVWZreg {
11875 break
11876 }
11877 x := v_0.Args[0]
11878 if !(r.InMerge(0xffffffff) != nil) {
11879 break
11880 }
11881 v.reset(OpS390XRISBGZ)
11882 v.Aux = s390xRotateParamsToAux(*r.InMerge(0xffffffff))
11883 v.AddArg(x)
11884 return true
11885 }
11886 // match: (RISBGZ (MOVHZreg x) {r})
11887 // cond: r.InMerge(0x0000ffff) != nil
11888 // result: (RISBGZ x {*r.InMerge(0x0000ffff)})
11889 for {
11890 r := auxToS390xRotateParams(v.Aux)
11891 if v_0.Op != OpS390XMOVHZreg {
11892 break
11893 }
11894 x := v_0.Args[0]
11895 if !(r.InMerge(0x0000ffff) != nil) {
11896 break
11897 }
11898 v.reset(OpS390XRISBGZ)
11899 v.Aux = s390xRotateParamsToAux(*r.InMerge(0x0000ffff))
11900 v.AddArg(x)
11901 return true
11902 }
11903 // match: (RISBGZ (MOVBZreg x) {r})
11904 // cond: r.InMerge(0x000000ff) != nil
11905 // result: (RISBGZ x {*r.InMerge(0x000000ff)})
11906 for {
11907 r := auxToS390xRotateParams(v.Aux)
11908 if v_0.Op != OpS390XMOVBZreg {
11909 break
11910 }
11911 x := v_0.Args[0]
11912 if !(r.InMerge(0x000000ff) != nil) {
11913 break
11914 }
11915 v.reset(OpS390XRISBGZ)
11916 v.Aux = s390xRotateParamsToAux(*r.InMerge(0x000000ff))
11917 v.AddArg(x)
11918 return true
11919 }
11920 // match: (RISBGZ (SLDconst x [c]) {r})
11921 // cond: r.InMerge(^uint64(0)<<c) != nil
11922 // result: (RISBGZ x {(*r.InMerge(^uint64(0)<<c)).RotateLeft(c)})
11923 for {
11924 r := auxToS390xRotateParams(v.Aux)
11925 if v_0.Op != OpS390XSLDconst {
11926 break
11927 }
11928 c := auxIntToUint8(v_0.AuxInt)
11929 x := v_0.Args[0]
11930 if !(r.InMerge(^uint64(0)<<c) != nil) {
11931 break
11932 }
11933 v.reset(OpS390XRISBGZ)
11934 v.Aux = s390xRotateParamsToAux((*r.InMerge(^uint64(0) << c)).RotateLeft(c))
11935 v.AddArg(x)
11936 return true
11937 }
11938 // match: (RISBGZ (SRDconst x [c]) {r})
11939 // cond: r.InMerge(^uint64(0)>>c) != nil
11940 // result: (RISBGZ x {(*r.InMerge(^uint64(0)>>c)).RotateLeft(-c)})
11941 for {
11942 r := auxToS390xRotateParams(v.Aux)
11943 if v_0.Op != OpS390XSRDconst {
11944 break
11945 }
11946 c := auxIntToUint8(v_0.AuxInt)
11947 x := v_0.Args[0]
11948 if !(r.InMerge(^uint64(0)>>c) != nil) {
11949 break
11950 }
11951 v.reset(OpS390XRISBGZ)
11952 v.Aux = s390xRotateParamsToAux((*r.InMerge(^uint64(0) >> c)).RotateLeft(-c))
11953 v.AddArg(x)
11954 return true
11955 }
11956 // match: (RISBGZ (RISBGZ x {y}) {z})
11957 // cond: z.InMerge(y.OutMask()) != nil
11958 // result: (RISBGZ x {(*z.InMerge(y.OutMask())).RotateLeft(y.Amount)})
11959 for {
11960 z := auxToS390xRotateParams(v.Aux)
11961 if v_0.Op != OpS390XRISBGZ {
11962 break
11963 }
11964 y := auxToS390xRotateParams(v_0.Aux)
11965 x := v_0.Args[0]
11966 if !(z.InMerge(y.OutMask()) != nil) {
11967 break
11968 }
11969 v.reset(OpS390XRISBGZ)
11970 v.Aux = s390xRotateParamsToAux((*z.InMerge(y.OutMask())).RotateLeft(y.Amount))
11971 v.AddArg(x)
11972 return true
11973 }
11974 // match: (RISBGZ x {r})
11975 // cond: r.End == 63 && r.Start == -r.Amount&63
11976 // result: (SRDconst x [-r.Amount&63])
11977 for {
11978 r := auxToS390xRotateParams(v.Aux)
11979 x := v_0
11980 if !(r.End == 63 && r.Start == -r.Amount&63) {
11981 break
11982 }
11983 v.reset(OpS390XSRDconst)
11984 v.AuxInt = uint8ToAuxInt(-r.Amount & 63)
11985 v.AddArg(x)
11986 return true
11987 }
11988 // match: (RISBGZ x {r})
11989 // cond: r.Start == 0 && r.End == 63-r.Amount
11990 // result: (SLDconst x [r.Amount])
11991 for {
11992 r := auxToS390xRotateParams(v.Aux)
11993 x := v_0
11994 if !(r.Start == 0 && r.End == 63-r.Amount) {
11995 break
11996 }
11997 v.reset(OpS390XSLDconst)
11998 v.AuxInt = uint8ToAuxInt(r.Amount)
11999 v.AddArg(x)
12000 return true
12001 }
12002 // match: (RISBGZ (SRADconst x [c]) {r})
12003 // cond: r.Start == r.End && (r.Start+r.Amount)&63 <= c
12004 // result: (RISBGZ x {s390x.NewRotateParams(r.Start, r.Start, -r.Start&63)})
12005 for {
12006 r := auxToS390xRotateParams(v.Aux)
12007 if v_0.Op != OpS390XSRADconst {
12008 break
12009 }
12010 c := auxIntToUint8(v_0.AuxInt)
12011 x := v_0.Args[0]
12012 if !(r.Start == r.End && (r.Start+r.Amount)&63 <= c) {
12013 break
12014 }
12015 v.reset(OpS390XRISBGZ)
12016 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(r.Start, r.Start, -r.Start&63))
12017 v.AddArg(x)
12018 return true
12019 }
12020 // match: (RISBGZ x {r})
12021 // cond: r == s390x.NewRotateParams(56, 63, 0)
12022 // result: (MOVBZreg x)
12023 for {
12024 r := auxToS390xRotateParams(v.Aux)
12025 x := v_0
12026 if !(r == s390x.NewRotateParams(56, 63, 0)) {
12027 break
12028 }
12029 v.reset(OpS390XMOVBZreg)
12030 v.AddArg(x)
12031 return true
12032 }
12033 // match: (RISBGZ x {r})
12034 // cond: r == s390x.NewRotateParams(48, 63, 0)
12035 // result: (MOVHZreg x)
12036 for {
12037 r := auxToS390xRotateParams(v.Aux)
12038 x := v_0
12039 if !(r == s390x.NewRotateParams(48, 63, 0)) {
12040 break
12041 }
12042 v.reset(OpS390XMOVHZreg)
12043 v.AddArg(x)
12044 return true
12045 }
12046 // match: (RISBGZ x {r})
12047 // cond: r == s390x.NewRotateParams(32, 63, 0)
12048 // result: (MOVWZreg x)
12049 for {
12050 r := auxToS390xRotateParams(v.Aux)
12051 x := v_0
12052 if !(r == s390x.NewRotateParams(32, 63, 0)) {
12053 break
12054 }
12055 v.reset(OpS390XMOVWZreg)
12056 v.AddArg(x)
12057 return true
12058 }
12059 // match: (RISBGZ (LGDR <t> x) {r})
12060 // cond: r == s390x.NewRotateParams(1, 63, 0)
12061 // result: (LGDR <t> (LPDFR <x.Type> x))
12062 for {
12063 r := auxToS390xRotateParams(v.Aux)
12064 if v_0.Op != OpS390XLGDR {
12065 break
12066 }
12067 t := v_0.Type
12068 x := v_0.Args[0]
12069 if !(r == s390x.NewRotateParams(1, 63, 0)) {
12070 break
12071 }
12072 v.reset(OpS390XLGDR)
12073 v.Type = t
12074 v0 := b.NewValue0(v.Pos, OpS390XLPDFR, x.Type)
12075 v0.AddArg(x)
12076 v.AddArg(v0)
12077 return true
12078 }
12079 return false
12080 }
12081 func rewriteValueS390X_OpS390XRLL(v *Value) bool {
12082 v_1 := v.Args[1]
12083 v_0 := v.Args[0]
12084 // match: (RLL x (MOVDconst [c]))
12085 // result: (RLLconst x [uint8(c&31)])
12086 for {
12087 x := v_0
12088 if v_1.Op != OpS390XMOVDconst {
12089 break
12090 }
12091 c := auxIntToInt64(v_1.AuxInt)
12092 v.reset(OpS390XRLLconst)
12093 v.AuxInt = uint8ToAuxInt(uint8(c & 31))
12094 v.AddArg(x)
12095 return true
12096 }
12097 return false
12098 }
12099 func rewriteValueS390X_OpS390XRLLG(v *Value) bool {
12100 v_1 := v.Args[1]
12101 v_0 := v.Args[0]
12102 // match: (RLLG x (MOVDconst [c]))
12103 // result: (RISBGZ x {s390x.NewRotateParams(0, 63, uint8(c&63))})
12104 for {
12105 x := v_0
12106 if v_1.Op != OpS390XMOVDconst {
12107 break
12108 }
12109 c := auxIntToInt64(v_1.AuxInt)
12110 v.reset(OpS390XRISBGZ)
12111 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(0, 63, uint8(c&63)))
12112 v.AddArg(x)
12113 return true
12114 }
12115 return false
12116 }
12117 func rewriteValueS390X_OpS390XSLD(v *Value) bool {
12118 v_1 := v.Args[1]
12119 v_0 := v.Args[0]
12120 b := v.Block
12121 typ := &b.Func.Config.Types
12122 // match: (SLD x (MOVDconst [c]))
12123 // result: (SLDconst x [uint8(c&63)])
12124 for {
12125 x := v_0
12126 if v_1.Op != OpS390XMOVDconst {
12127 break
12128 }
12129 c := auxIntToInt64(v_1.AuxInt)
12130 v.reset(OpS390XSLDconst)
12131 v.AuxInt = uint8ToAuxInt(uint8(c & 63))
12132 v.AddArg(x)
12133 return true
12134 }
12135 // match: (SLD x (RISBGZ y {r}))
12136 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12137 // result: (SLD x y)
12138 for {
12139 x := v_0
12140 if v_1.Op != OpS390XRISBGZ {
12141 break
12142 }
12143 r := auxToS390xRotateParams(v_1.Aux)
12144 y := v_1.Args[0]
12145 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12146 break
12147 }
12148 v.reset(OpS390XSLD)
12149 v.AddArg2(x, y)
12150 return true
12151 }
12152 // match: (SLD x (AND (MOVDconst [c]) y))
12153 // result: (SLD x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12154 for {
12155 x := v_0
12156 if v_1.Op != OpS390XAND {
12157 break
12158 }
12159 _ = v_1.Args[1]
12160 v_1_0 := v_1.Args[0]
12161 v_1_1 := v_1.Args[1]
12162 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12163 if v_1_0.Op != OpS390XMOVDconst {
12164 continue
12165 }
12166 c := auxIntToInt64(v_1_0.AuxInt)
12167 y := v_1_1
12168 v.reset(OpS390XSLD)
12169 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12170 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12171 v0.AddArg(y)
12172 v.AddArg2(x, v0)
12173 return true
12174 }
12175 break
12176 }
12177 // match: (SLD x (ANDWconst [c] y))
12178 // cond: c&63 == 63
12179 // result: (SLD x y)
12180 for {
12181 x := v_0
12182 if v_1.Op != OpS390XANDWconst {
12183 break
12184 }
12185 c := auxIntToInt32(v_1.AuxInt)
12186 y := v_1.Args[0]
12187 if !(c&63 == 63) {
12188 break
12189 }
12190 v.reset(OpS390XSLD)
12191 v.AddArg2(x, y)
12192 return true
12193 }
12194 // match: (SLD x (MOVWreg y))
12195 // result: (SLD x y)
12196 for {
12197 x := v_0
12198 if v_1.Op != OpS390XMOVWreg {
12199 break
12200 }
12201 y := v_1.Args[0]
12202 v.reset(OpS390XSLD)
12203 v.AddArg2(x, y)
12204 return true
12205 }
12206 // match: (SLD x (MOVHreg y))
12207 // result: (SLD x y)
12208 for {
12209 x := v_0
12210 if v_1.Op != OpS390XMOVHreg {
12211 break
12212 }
12213 y := v_1.Args[0]
12214 v.reset(OpS390XSLD)
12215 v.AddArg2(x, y)
12216 return true
12217 }
12218 // match: (SLD x (MOVBreg y))
12219 // result: (SLD x y)
12220 for {
12221 x := v_0
12222 if v_1.Op != OpS390XMOVBreg {
12223 break
12224 }
12225 y := v_1.Args[0]
12226 v.reset(OpS390XSLD)
12227 v.AddArg2(x, y)
12228 return true
12229 }
12230 // match: (SLD x (MOVWZreg y))
12231 // result: (SLD x y)
12232 for {
12233 x := v_0
12234 if v_1.Op != OpS390XMOVWZreg {
12235 break
12236 }
12237 y := v_1.Args[0]
12238 v.reset(OpS390XSLD)
12239 v.AddArg2(x, y)
12240 return true
12241 }
12242 // match: (SLD x (MOVHZreg y))
12243 // result: (SLD x y)
12244 for {
12245 x := v_0
12246 if v_1.Op != OpS390XMOVHZreg {
12247 break
12248 }
12249 y := v_1.Args[0]
12250 v.reset(OpS390XSLD)
12251 v.AddArg2(x, y)
12252 return true
12253 }
12254 // match: (SLD x (MOVBZreg y))
12255 // result: (SLD x y)
12256 for {
12257 x := v_0
12258 if v_1.Op != OpS390XMOVBZreg {
12259 break
12260 }
12261 y := v_1.Args[0]
12262 v.reset(OpS390XSLD)
12263 v.AddArg2(x, y)
12264 return true
12265 }
12266 return false
12267 }
12268 func rewriteValueS390X_OpS390XSLDconst(v *Value) bool {
12269 v_0 := v.Args[0]
12270 // match: (SLDconst (SRDconst x [c]) [d])
12271 // result: (RISBGZ x {s390x.NewRotateParams(uint8(max(0, int8(c-d))), 63-d, uint8(int8(d-c)&63))})
12272 for {
12273 d := auxIntToUint8(v.AuxInt)
12274 if v_0.Op != OpS390XSRDconst {
12275 break
12276 }
12277 c := auxIntToUint8(v_0.AuxInt)
12278 x := v_0.Args[0]
12279 v.reset(OpS390XRISBGZ)
12280 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(uint8(max(0, int8(c-d))), 63-d, uint8(int8(d-c)&63)))
12281 v.AddArg(x)
12282 return true
12283 }
12284 // match: (SLDconst (RISBGZ x {r}) [c])
12285 // cond: s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask()) != nil
12286 // result: (RISBGZ x {(*s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask())).RotateLeft(r.Amount)})
12287 for {
12288 c := auxIntToUint8(v.AuxInt)
12289 if v_0.Op != OpS390XRISBGZ {
12290 break
12291 }
12292 r := auxToS390xRotateParams(v_0.Aux)
12293 x := v_0.Args[0]
12294 if !(s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask()) != nil) {
12295 break
12296 }
12297 v.reset(OpS390XRISBGZ)
12298 v.Aux = s390xRotateParamsToAux((*s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask())).RotateLeft(r.Amount))
12299 v.AddArg(x)
12300 return true
12301 }
12302 // match: (SLDconst x [0])
12303 // result: x
12304 for {
12305 if auxIntToUint8(v.AuxInt) != 0 {
12306 break
12307 }
12308 x := v_0
12309 v.copyOf(x)
12310 return true
12311 }
12312 return false
12313 }
12314 func rewriteValueS390X_OpS390XSLW(v *Value) bool {
12315 v_1 := v.Args[1]
12316 v_0 := v.Args[0]
12317 b := v.Block
12318 typ := &b.Func.Config.Types
12319 // match: (SLW x (MOVDconst [c]))
12320 // cond: c&32 == 0
12321 // result: (SLWconst x [uint8(c&31)])
12322 for {
12323 x := v_0
12324 if v_1.Op != OpS390XMOVDconst {
12325 break
12326 }
12327 c := auxIntToInt64(v_1.AuxInt)
12328 if !(c&32 == 0) {
12329 break
12330 }
12331 v.reset(OpS390XSLWconst)
12332 v.AuxInt = uint8ToAuxInt(uint8(c & 31))
12333 v.AddArg(x)
12334 return true
12335 }
12336 // match: (SLW _ (MOVDconst [c]))
12337 // cond: c&32 != 0
12338 // result: (MOVDconst [0])
12339 for {
12340 if v_1.Op != OpS390XMOVDconst {
12341 break
12342 }
12343 c := auxIntToInt64(v_1.AuxInt)
12344 if !(c&32 != 0) {
12345 break
12346 }
12347 v.reset(OpS390XMOVDconst)
12348 v.AuxInt = int64ToAuxInt(0)
12349 return true
12350 }
12351 // match: (SLW x (RISBGZ y {r}))
12352 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12353 // result: (SLW x y)
12354 for {
12355 x := v_0
12356 if v_1.Op != OpS390XRISBGZ {
12357 break
12358 }
12359 r := auxToS390xRotateParams(v_1.Aux)
12360 y := v_1.Args[0]
12361 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12362 break
12363 }
12364 v.reset(OpS390XSLW)
12365 v.AddArg2(x, y)
12366 return true
12367 }
12368 // match: (SLW x (AND (MOVDconst [c]) y))
12369 // result: (SLW x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12370 for {
12371 x := v_0
12372 if v_1.Op != OpS390XAND {
12373 break
12374 }
12375 _ = v_1.Args[1]
12376 v_1_0 := v_1.Args[0]
12377 v_1_1 := v_1.Args[1]
12378 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12379 if v_1_0.Op != OpS390XMOVDconst {
12380 continue
12381 }
12382 c := auxIntToInt64(v_1_0.AuxInt)
12383 y := v_1_1
12384 v.reset(OpS390XSLW)
12385 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12386 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12387 v0.AddArg(y)
12388 v.AddArg2(x, v0)
12389 return true
12390 }
12391 break
12392 }
12393 // match: (SLW x (ANDWconst [c] y))
12394 // cond: c&63 == 63
12395 // result: (SLW x y)
12396 for {
12397 x := v_0
12398 if v_1.Op != OpS390XANDWconst {
12399 break
12400 }
12401 c := auxIntToInt32(v_1.AuxInt)
12402 y := v_1.Args[0]
12403 if !(c&63 == 63) {
12404 break
12405 }
12406 v.reset(OpS390XSLW)
12407 v.AddArg2(x, y)
12408 return true
12409 }
12410 // match: (SLW x (MOVWreg y))
12411 // result: (SLW x y)
12412 for {
12413 x := v_0
12414 if v_1.Op != OpS390XMOVWreg {
12415 break
12416 }
12417 y := v_1.Args[0]
12418 v.reset(OpS390XSLW)
12419 v.AddArg2(x, y)
12420 return true
12421 }
12422 // match: (SLW x (MOVHreg y))
12423 // result: (SLW x y)
12424 for {
12425 x := v_0
12426 if v_1.Op != OpS390XMOVHreg {
12427 break
12428 }
12429 y := v_1.Args[0]
12430 v.reset(OpS390XSLW)
12431 v.AddArg2(x, y)
12432 return true
12433 }
12434 // match: (SLW x (MOVBreg y))
12435 // result: (SLW x y)
12436 for {
12437 x := v_0
12438 if v_1.Op != OpS390XMOVBreg {
12439 break
12440 }
12441 y := v_1.Args[0]
12442 v.reset(OpS390XSLW)
12443 v.AddArg2(x, y)
12444 return true
12445 }
12446 // match: (SLW x (MOVWZreg y))
12447 // result: (SLW x y)
12448 for {
12449 x := v_0
12450 if v_1.Op != OpS390XMOVWZreg {
12451 break
12452 }
12453 y := v_1.Args[0]
12454 v.reset(OpS390XSLW)
12455 v.AddArg2(x, y)
12456 return true
12457 }
12458 // match: (SLW x (MOVHZreg y))
12459 // result: (SLW x y)
12460 for {
12461 x := v_0
12462 if v_1.Op != OpS390XMOVHZreg {
12463 break
12464 }
12465 y := v_1.Args[0]
12466 v.reset(OpS390XSLW)
12467 v.AddArg2(x, y)
12468 return true
12469 }
12470 // match: (SLW x (MOVBZreg y))
12471 // result: (SLW x y)
12472 for {
12473 x := v_0
12474 if v_1.Op != OpS390XMOVBZreg {
12475 break
12476 }
12477 y := v_1.Args[0]
12478 v.reset(OpS390XSLW)
12479 v.AddArg2(x, y)
12480 return true
12481 }
12482 return false
12483 }
12484 func rewriteValueS390X_OpS390XSLWconst(v *Value) bool {
12485 v_0 := v.Args[0]
12486 // match: (SLWconst x [0])
12487 // result: x
12488 for {
12489 if auxIntToUint8(v.AuxInt) != 0 {
12490 break
12491 }
12492 x := v_0
12493 v.copyOf(x)
12494 return true
12495 }
12496 return false
12497 }
12498 func rewriteValueS390X_OpS390XSRAD(v *Value) bool {
12499 v_1 := v.Args[1]
12500 v_0 := v.Args[0]
12501 b := v.Block
12502 typ := &b.Func.Config.Types
12503 // match: (SRAD x (MOVDconst [c]))
12504 // result: (SRADconst x [uint8(c&63)])
12505 for {
12506 x := v_0
12507 if v_1.Op != OpS390XMOVDconst {
12508 break
12509 }
12510 c := auxIntToInt64(v_1.AuxInt)
12511 v.reset(OpS390XSRADconst)
12512 v.AuxInt = uint8ToAuxInt(uint8(c & 63))
12513 v.AddArg(x)
12514 return true
12515 }
12516 // match: (SRAD x (RISBGZ y {r}))
12517 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12518 // result: (SRAD x y)
12519 for {
12520 x := v_0
12521 if v_1.Op != OpS390XRISBGZ {
12522 break
12523 }
12524 r := auxToS390xRotateParams(v_1.Aux)
12525 y := v_1.Args[0]
12526 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12527 break
12528 }
12529 v.reset(OpS390XSRAD)
12530 v.AddArg2(x, y)
12531 return true
12532 }
12533 // match: (SRAD x (AND (MOVDconst [c]) y))
12534 // result: (SRAD x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12535 for {
12536 x := v_0
12537 if v_1.Op != OpS390XAND {
12538 break
12539 }
12540 _ = v_1.Args[1]
12541 v_1_0 := v_1.Args[0]
12542 v_1_1 := v_1.Args[1]
12543 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12544 if v_1_0.Op != OpS390XMOVDconst {
12545 continue
12546 }
12547 c := auxIntToInt64(v_1_0.AuxInt)
12548 y := v_1_1
12549 v.reset(OpS390XSRAD)
12550 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12551 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12552 v0.AddArg(y)
12553 v.AddArg2(x, v0)
12554 return true
12555 }
12556 break
12557 }
12558 // match: (SRAD x (ANDWconst [c] y))
12559 // cond: c&63 == 63
12560 // result: (SRAD x y)
12561 for {
12562 x := v_0
12563 if v_1.Op != OpS390XANDWconst {
12564 break
12565 }
12566 c := auxIntToInt32(v_1.AuxInt)
12567 y := v_1.Args[0]
12568 if !(c&63 == 63) {
12569 break
12570 }
12571 v.reset(OpS390XSRAD)
12572 v.AddArg2(x, y)
12573 return true
12574 }
12575 // match: (SRAD x (MOVWreg y))
12576 // result: (SRAD x y)
12577 for {
12578 x := v_0
12579 if v_1.Op != OpS390XMOVWreg {
12580 break
12581 }
12582 y := v_1.Args[0]
12583 v.reset(OpS390XSRAD)
12584 v.AddArg2(x, y)
12585 return true
12586 }
12587 // match: (SRAD x (MOVHreg y))
12588 // result: (SRAD x y)
12589 for {
12590 x := v_0
12591 if v_1.Op != OpS390XMOVHreg {
12592 break
12593 }
12594 y := v_1.Args[0]
12595 v.reset(OpS390XSRAD)
12596 v.AddArg2(x, y)
12597 return true
12598 }
12599 // match: (SRAD x (MOVBreg y))
12600 // result: (SRAD x y)
12601 for {
12602 x := v_0
12603 if v_1.Op != OpS390XMOVBreg {
12604 break
12605 }
12606 y := v_1.Args[0]
12607 v.reset(OpS390XSRAD)
12608 v.AddArg2(x, y)
12609 return true
12610 }
12611 // match: (SRAD x (MOVWZreg y))
12612 // result: (SRAD x y)
12613 for {
12614 x := v_0
12615 if v_1.Op != OpS390XMOVWZreg {
12616 break
12617 }
12618 y := v_1.Args[0]
12619 v.reset(OpS390XSRAD)
12620 v.AddArg2(x, y)
12621 return true
12622 }
12623 // match: (SRAD x (MOVHZreg y))
12624 // result: (SRAD x y)
12625 for {
12626 x := v_0
12627 if v_1.Op != OpS390XMOVHZreg {
12628 break
12629 }
12630 y := v_1.Args[0]
12631 v.reset(OpS390XSRAD)
12632 v.AddArg2(x, y)
12633 return true
12634 }
12635 // match: (SRAD x (MOVBZreg y))
12636 // result: (SRAD x y)
12637 for {
12638 x := v_0
12639 if v_1.Op != OpS390XMOVBZreg {
12640 break
12641 }
12642 y := v_1.Args[0]
12643 v.reset(OpS390XSRAD)
12644 v.AddArg2(x, y)
12645 return true
12646 }
12647 return false
12648 }
12649 func rewriteValueS390X_OpS390XSRADconst(v *Value) bool {
12650 v_0 := v.Args[0]
12651 // match: (SRADconst x [0])
12652 // result: x
12653 for {
12654 if auxIntToUint8(v.AuxInt) != 0 {
12655 break
12656 }
12657 x := v_0
12658 v.copyOf(x)
12659 return true
12660 }
12661 // match: (SRADconst [c] (MOVDconst [d]))
12662 // result: (MOVDconst [d>>uint64(c)])
12663 for {
12664 c := auxIntToUint8(v.AuxInt)
12665 if v_0.Op != OpS390XMOVDconst {
12666 break
12667 }
12668 d := auxIntToInt64(v_0.AuxInt)
12669 v.reset(OpS390XMOVDconst)
12670 v.AuxInt = int64ToAuxInt(d >> uint64(c))
12671 return true
12672 }
12673 return false
12674 }
12675 func rewriteValueS390X_OpS390XSRAW(v *Value) bool {
12676 v_1 := v.Args[1]
12677 v_0 := v.Args[0]
12678 b := v.Block
12679 typ := &b.Func.Config.Types
12680 // match: (SRAW x (MOVDconst [c]))
12681 // cond: c&32 == 0
12682 // result: (SRAWconst x [uint8(c&31)])
12683 for {
12684 x := v_0
12685 if v_1.Op != OpS390XMOVDconst {
12686 break
12687 }
12688 c := auxIntToInt64(v_1.AuxInt)
12689 if !(c&32 == 0) {
12690 break
12691 }
12692 v.reset(OpS390XSRAWconst)
12693 v.AuxInt = uint8ToAuxInt(uint8(c & 31))
12694 v.AddArg(x)
12695 return true
12696 }
12697 // match: (SRAW x (MOVDconst [c]))
12698 // cond: c&32 != 0
12699 // result: (SRAWconst x [31])
12700 for {
12701 x := v_0
12702 if v_1.Op != OpS390XMOVDconst {
12703 break
12704 }
12705 c := auxIntToInt64(v_1.AuxInt)
12706 if !(c&32 != 0) {
12707 break
12708 }
12709 v.reset(OpS390XSRAWconst)
12710 v.AuxInt = uint8ToAuxInt(31)
12711 v.AddArg(x)
12712 return true
12713 }
12714 // match: (SRAW x (RISBGZ y {r}))
12715 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12716 // result: (SRAW x y)
12717 for {
12718 x := v_0
12719 if v_1.Op != OpS390XRISBGZ {
12720 break
12721 }
12722 r := auxToS390xRotateParams(v_1.Aux)
12723 y := v_1.Args[0]
12724 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12725 break
12726 }
12727 v.reset(OpS390XSRAW)
12728 v.AddArg2(x, y)
12729 return true
12730 }
12731 // match: (SRAW x (AND (MOVDconst [c]) y))
12732 // result: (SRAW x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12733 for {
12734 x := v_0
12735 if v_1.Op != OpS390XAND {
12736 break
12737 }
12738 _ = v_1.Args[1]
12739 v_1_0 := v_1.Args[0]
12740 v_1_1 := v_1.Args[1]
12741 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12742 if v_1_0.Op != OpS390XMOVDconst {
12743 continue
12744 }
12745 c := auxIntToInt64(v_1_0.AuxInt)
12746 y := v_1_1
12747 v.reset(OpS390XSRAW)
12748 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12749 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12750 v0.AddArg(y)
12751 v.AddArg2(x, v0)
12752 return true
12753 }
12754 break
12755 }
12756 // match: (SRAW x (ANDWconst [c] y))
12757 // cond: c&63 == 63
12758 // result: (SRAW x y)
12759 for {
12760 x := v_0
12761 if v_1.Op != OpS390XANDWconst {
12762 break
12763 }
12764 c := auxIntToInt32(v_1.AuxInt)
12765 y := v_1.Args[0]
12766 if !(c&63 == 63) {
12767 break
12768 }
12769 v.reset(OpS390XSRAW)
12770 v.AddArg2(x, y)
12771 return true
12772 }
12773 // match: (SRAW x (MOVWreg y))
12774 // result: (SRAW x y)
12775 for {
12776 x := v_0
12777 if v_1.Op != OpS390XMOVWreg {
12778 break
12779 }
12780 y := v_1.Args[0]
12781 v.reset(OpS390XSRAW)
12782 v.AddArg2(x, y)
12783 return true
12784 }
12785 // match: (SRAW x (MOVHreg y))
12786 // result: (SRAW x y)
12787 for {
12788 x := v_0
12789 if v_1.Op != OpS390XMOVHreg {
12790 break
12791 }
12792 y := v_1.Args[0]
12793 v.reset(OpS390XSRAW)
12794 v.AddArg2(x, y)
12795 return true
12796 }
12797 // match: (SRAW x (MOVBreg y))
12798 // result: (SRAW x y)
12799 for {
12800 x := v_0
12801 if v_1.Op != OpS390XMOVBreg {
12802 break
12803 }
12804 y := v_1.Args[0]
12805 v.reset(OpS390XSRAW)
12806 v.AddArg2(x, y)
12807 return true
12808 }
12809 // match: (SRAW x (MOVWZreg y))
12810 // result: (SRAW x y)
12811 for {
12812 x := v_0
12813 if v_1.Op != OpS390XMOVWZreg {
12814 break
12815 }
12816 y := v_1.Args[0]
12817 v.reset(OpS390XSRAW)
12818 v.AddArg2(x, y)
12819 return true
12820 }
12821 // match: (SRAW x (MOVHZreg y))
12822 // result: (SRAW x y)
12823 for {
12824 x := v_0
12825 if v_1.Op != OpS390XMOVHZreg {
12826 break
12827 }
12828 y := v_1.Args[0]
12829 v.reset(OpS390XSRAW)
12830 v.AddArg2(x, y)
12831 return true
12832 }
12833 // match: (SRAW x (MOVBZreg y))
12834 // result: (SRAW x y)
12835 for {
12836 x := v_0
12837 if v_1.Op != OpS390XMOVBZreg {
12838 break
12839 }
12840 y := v_1.Args[0]
12841 v.reset(OpS390XSRAW)
12842 v.AddArg2(x, y)
12843 return true
12844 }
12845 return false
12846 }
12847 func rewriteValueS390X_OpS390XSRAWconst(v *Value) bool {
12848 v_0 := v.Args[0]
12849 // match: (SRAWconst x [0])
12850 // result: x
12851 for {
12852 if auxIntToUint8(v.AuxInt) != 0 {
12853 break
12854 }
12855 x := v_0
12856 v.copyOf(x)
12857 return true
12858 }
12859 // match: (SRAWconst [c] (MOVDconst [d]))
12860 // result: (MOVDconst [int64(int32(d))>>uint64(c)])
12861 for {
12862 c := auxIntToUint8(v.AuxInt)
12863 if v_0.Op != OpS390XMOVDconst {
12864 break
12865 }
12866 d := auxIntToInt64(v_0.AuxInt)
12867 v.reset(OpS390XMOVDconst)
12868 v.AuxInt = int64ToAuxInt(int64(int32(d)) >> uint64(c))
12869 return true
12870 }
12871 return false
12872 }
12873 func rewriteValueS390X_OpS390XSRD(v *Value) bool {
12874 v_1 := v.Args[1]
12875 v_0 := v.Args[0]
12876 b := v.Block
12877 typ := &b.Func.Config.Types
12878 // match: (SRD x (MOVDconst [c]))
12879 // result: (SRDconst x [uint8(c&63)])
12880 for {
12881 x := v_0
12882 if v_1.Op != OpS390XMOVDconst {
12883 break
12884 }
12885 c := auxIntToInt64(v_1.AuxInt)
12886 v.reset(OpS390XSRDconst)
12887 v.AuxInt = uint8ToAuxInt(uint8(c & 63))
12888 v.AddArg(x)
12889 return true
12890 }
12891 // match: (SRD x (RISBGZ y {r}))
12892 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12893 // result: (SRD x y)
12894 for {
12895 x := v_0
12896 if v_1.Op != OpS390XRISBGZ {
12897 break
12898 }
12899 r := auxToS390xRotateParams(v_1.Aux)
12900 y := v_1.Args[0]
12901 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12902 break
12903 }
12904 v.reset(OpS390XSRD)
12905 v.AddArg2(x, y)
12906 return true
12907 }
12908 // match: (SRD x (AND (MOVDconst [c]) y))
12909 // result: (SRD x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12910 for {
12911 x := v_0
12912 if v_1.Op != OpS390XAND {
12913 break
12914 }
12915 _ = v_1.Args[1]
12916 v_1_0 := v_1.Args[0]
12917 v_1_1 := v_1.Args[1]
12918 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12919 if v_1_0.Op != OpS390XMOVDconst {
12920 continue
12921 }
12922 c := auxIntToInt64(v_1_0.AuxInt)
12923 y := v_1_1
12924 v.reset(OpS390XSRD)
12925 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12926 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12927 v0.AddArg(y)
12928 v.AddArg2(x, v0)
12929 return true
12930 }
12931 break
12932 }
12933 // match: (SRD x (ANDWconst [c] y))
12934 // cond: c&63 == 63
12935 // result: (SRD x y)
12936 for {
12937 x := v_0
12938 if v_1.Op != OpS390XANDWconst {
12939 break
12940 }
12941 c := auxIntToInt32(v_1.AuxInt)
12942 y := v_1.Args[0]
12943 if !(c&63 == 63) {
12944 break
12945 }
12946 v.reset(OpS390XSRD)
12947 v.AddArg2(x, y)
12948 return true
12949 }
12950 // match: (SRD x (MOVWreg y))
12951 // result: (SRD x y)
12952 for {
12953 x := v_0
12954 if v_1.Op != OpS390XMOVWreg {
12955 break
12956 }
12957 y := v_1.Args[0]
12958 v.reset(OpS390XSRD)
12959 v.AddArg2(x, y)
12960 return true
12961 }
12962 // match: (SRD x (MOVHreg y))
12963 // result: (SRD x y)
12964 for {
12965 x := v_0
12966 if v_1.Op != OpS390XMOVHreg {
12967 break
12968 }
12969 y := v_1.Args[0]
12970 v.reset(OpS390XSRD)
12971 v.AddArg2(x, y)
12972 return true
12973 }
12974 // match: (SRD x (MOVBreg y))
12975 // result: (SRD x y)
12976 for {
12977 x := v_0
12978 if v_1.Op != OpS390XMOVBreg {
12979 break
12980 }
12981 y := v_1.Args[0]
12982 v.reset(OpS390XSRD)
12983 v.AddArg2(x, y)
12984 return true
12985 }
12986 // match: (SRD x (MOVWZreg y))
12987 // result: (SRD x y)
12988 for {
12989 x := v_0
12990 if v_1.Op != OpS390XMOVWZreg {
12991 break
12992 }
12993 y := v_1.Args[0]
12994 v.reset(OpS390XSRD)
12995 v.AddArg2(x, y)
12996 return true
12997 }
12998 // match: (SRD x (MOVHZreg y))
12999 // result: (SRD x y)
13000 for {
13001 x := v_0
13002 if v_1.Op != OpS390XMOVHZreg {
13003 break
13004 }
13005 y := v_1.Args[0]
13006 v.reset(OpS390XSRD)
13007 v.AddArg2(x, y)
13008 return true
13009 }
13010 // match: (SRD x (MOVBZreg y))
13011 // result: (SRD x y)
13012 for {
13013 x := v_0
13014 if v_1.Op != OpS390XMOVBZreg {
13015 break
13016 }
13017 y := v_1.Args[0]
13018 v.reset(OpS390XSRD)
13019 v.AddArg2(x, y)
13020 return true
13021 }
13022 return false
13023 }
13024 func rewriteValueS390X_OpS390XSRDconst(v *Value) bool {
13025 v_0 := v.Args[0]
13026 // match: (SRDconst (SLDconst x [c]) [d])
13027 // result: (RISBGZ x {s390x.NewRotateParams(d, uint8(min(63, int8(63-c+d))), uint8(int8(c-d)&63))})
13028 for {
13029 d := auxIntToUint8(v.AuxInt)
13030 if v_0.Op != OpS390XSLDconst {
13031 break
13032 }
13033 c := auxIntToUint8(v_0.AuxInt)
13034 x := v_0.Args[0]
13035 v.reset(OpS390XRISBGZ)
13036 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(d, uint8(min(63, int8(63-c+d))), uint8(int8(c-d)&63)))
13037 v.AddArg(x)
13038 return true
13039 }
13040 // match: (SRDconst (RISBGZ x {r}) [c])
13041 // cond: s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask()) != nil
13042 // result: (RISBGZ x {(*s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask())).RotateLeft(r.Amount)})
13043 for {
13044 c := auxIntToUint8(v.AuxInt)
13045 if v_0.Op != OpS390XRISBGZ {
13046 break
13047 }
13048 r := auxToS390xRotateParams(v_0.Aux)
13049 x := v_0.Args[0]
13050 if !(s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask()) != nil) {
13051 break
13052 }
13053 v.reset(OpS390XRISBGZ)
13054 v.Aux = s390xRotateParamsToAux((*s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask())).RotateLeft(r.Amount))
13055 v.AddArg(x)
13056 return true
13057 }
13058 // match: (SRDconst x [0])
13059 // result: x
13060 for {
13061 if auxIntToUint8(v.AuxInt) != 0 {
13062 break
13063 }
13064 x := v_0
13065 v.copyOf(x)
13066 return true
13067 }
13068 return false
13069 }
13070 func rewriteValueS390X_OpS390XSRW(v *Value) bool {
13071 v_1 := v.Args[1]
13072 v_0 := v.Args[0]
13073 b := v.Block
13074 typ := &b.Func.Config.Types
13075 // match: (SRW x (MOVDconst [c]))
13076 // cond: c&32 == 0
13077 // result: (SRWconst x [uint8(c&31)])
13078 for {
13079 x := v_0
13080 if v_1.Op != OpS390XMOVDconst {
13081 break
13082 }
13083 c := auxIntToInt64(v_1.AuxInt)
13084 if !(c&32 == 0) {
13085 break
13086 }
13087 v.reset(OpS390XSRWconst)
13088 v.AuxInt = uint8ToAuxInt(uint8(c & 31))
13089 v.AddArg(x)
13090 return true
13091 }
13092 // match: (SRW _ (MOVDconst [c]))
13093 // cond: c&32 != 0
13094 // result: (MOVDconst [0])
13095 for {
13096 if v_1.Op != OpS390XMOVDconst {
13097 break
13098 }
13099 c := auxIntToInt64(v_1.AuxInt)
13100 if !(c&32 != 0) {
13101 break
13102 }
13103 v.reset(OpS390XMOVDconst)
13104 v.AuxInt = int64ToAuxInt(0)
13105 return true
13106 }
13107 // match: (SRW x (RISBGZ y {r}))
13108 // cond: r.Amount == 0 && r.OutMask()&63 == 63
13109 // result: (SRW x y)
13110 for {
13111 x := v_0
13112 if v_1.Op != OpS390XRISBGZ {
13113 break
13114 }
13115 r := auxToS390xRotateParams(v_1.Aux)
13116 y := v_1.Args[0]
13117 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
13118 break
13119 }
13120 v.reset(OpS390XSRW)
13121 v.AddArg2(x, y)
13122 return true
13123 }
13124 // match: (SRW x (AND (MOVDconst [c]) y))
13125 // result: (SRW x (ANDWconst <typ.UInt32> [int32(c&63)] y))
13126 for {
13127 x := v_0
13128 if v_1.Op != OpS390XAND {
13129 break
13130 }
13131 _ = v_1.Args[1]
13132 v_1_0 := v_1.Args[0]
13133 v_1_1 := v_1.Args[1]
13134 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
13135 if v_1_0.Op != OpS390XMOVDconst {
13136 continue
13137 }
13138 c := auxIntToInt64(v_1_0.AuxInt)
13139 y := v_1_1
13140 v.reset(OpS390XSRW)
13141 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
13142 v0.AuxInt = int32ToAuxInt(int32(c & 63))
13143 v0.AddArg(y)
13144 v.AddArg2(x, v0)
13145 return true
13146 }
13147 break
13148 }
13149 // match: (SRW x (ANDWconst [c] y))
13150 // cond: c&63 == 63
13151 // result: (SRW x y)
13152 for {
13153 x := v_0
13154 if v_1.Op != OpS390XANDWconst {
13155 break
13156 }
13157 c := auxIntToInt32(v_1.AuxInt)
13158 y := v_1.Args[0]
13159 if !(c&63 == 63) {
13160 break
13161 }
13162 v.reset(OpS390XSRW)
13163 v.AddArg2(x, y)
13164 return true
13165 }
13166 // match: (SRW x (MOVWreg y))
13167 // result: (SRW x y)
13168 for {
13169 x := v_0
13170 if v_1.Op != OpS390XMOVWreg {
13171 break
13172 }
13173 y := v_1.Args[0]
13174 v.reset(OpS390XSRW)
13175 v.AddArg2(x, y)
13176 return true
13177 }
13178 // match: (SRW x (MOVHreg y))
13179 // result: (SRW x y)
13180 for {
13181 x := v_0
13182 if v_1.Op != OpS390XMOVHreg {
13183 break
13184 }
13185 y := v_1.Args[0]
13186 v.reset(OpS390XSRW)
13187 v.AddArg2(x, y)
13188 return true
13189 }
13190 // match: (SRW x (MOVBreg y))
13191 // result: (SRW x y)
13192 for {
13193 x := v_0
13194 if v_1.Op != OpS390XMOVBreg {
13195 break
13196 }
13197 y := v_1.Args[0]
13198 v.reset(OpS390XSRW)
13199 v.AddArg2(x, y)
13200 return true
13201 }
13202 // match: (SRW x (MOVWZreg y))
13203 // result: (SRW x y)
13204 for {
13205 x := v_0
13206 if v_1.Op != OpS390XMOVWZreg {
13207 break
13208 }
13209 y := v_1.Args[0]
13210 v.reset(OpS390XSRW)
13211 v.AddArg2(x, y)
13212 return true
13213 }
13214 // match: (SRW x (MOVHZreg y))
13215 // result: (SRW x y)
13216 for {
13217 x := v_0
13218 if v_1.Op != OpS390XMOVHZreg {
13219 break
13220 }
13221 y := v_1.Args[0]
13222 v.reset(OpS390XSRW)
13223 v.AddArg2(x, y)
13224 return true
13225 }
13226 // match: (SRW x (MOVBZreg y))
13227 // result: (SRW x y)
13228 for {
13229 x := v_0
13230 if v_1.Op != OpS390XMOVBZreg {
13231 break
13232 }
13233 y := v_1.Args[0]
13234 v.reset(OpS390XSRW)
13235 v.AddArg2(x, y)
13236 return true
13237 }
13238 return false
13239 }
13240 func rewriteValueS390X_OpS390XSRWconst(v *Value) bool {
13241 v_0 := v.Args[0]
13242 // match: (SRWconst x [0])
13243 // result: x
13244 for {
13245 if auxIntToUint8(v.AuxInt) != 0 {
13246 break
13247 }
13248 x := v_0
13249 v.copyOf(x)
13250 return true
13251 }
13252 return false
13253 }
13254 func rewriteValueS390X_OpS390XSTM2(v *Value) bool {
13255 v_3 := v.Args[3]
13256 v_2 := v.Args[2]
13257 v_1 := v.Args[1]
13258 v_0 := v.Args[0]
13259 // match: (STM2 [i] {s} p w2 w3 x:(STM2 [i-8] {s} p w0 w1 mem))
13260 // cond: x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)
13261 // result: (STM4 [i-8] {s} p w0 w1 w2 w3 mem)
13262 for {
13263 i := auxIntToInt32(v.AuxInt)
13264 s := auxToSym(v.Aux)
13265 p := v_0
13266 w2 := v_1
13267 w3 := v_2
13268 x := v_3
13269 if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s {
13270 break
13271 }
13272 mem := x.Args[3]
13273 if p != x.Args[0] {
13274 break
13275 }
13276 w0 := x.Args[1]
13277 w1 := x.Args[2]
13278 if !(x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)) {
13279 break
13280 }
13281 v.reset(OpS390XSTM4)
13282 v.AuxInt = int32ToAuxInt(i - 8)
13283 v.Aux = symToAux(s)
13284 v.AddArg6(p, w0, w1, w2, w3, mem)
13285 return true
13286 }
13287 // match: (STM2 [i] {s} p (SRDconst [32] x) x mem)
13288 // result: (MOVDstore [i] {s} p x mem)
13289 for {
13290 i := auxIntToInt32(v.AuxInt)
13291 s := auxToSym(v.Aux)
13292 p := v_0
13293 if v_1.Op != OpS390XSRDconst || auxIntToUint8(v_1.AuxInt) != 32 {
13294 break
13295 }
13296 x := v_1.Args[0]
13297 if x != v_2 {
13298 break
13299 }
13300 mem := v_3
13301 v.reset(OpS390XMOVDstore)
13302 v.AuxInt = int32ToAuxInt(i)
13303 v.Aux = symToAux(s)
13304 v.AddArg3(p, x, mem)
13305 return true
13306 }
13307 return false
13308 }
13309 func rewriteValueS390X_OpS390XSTMG2(v *Value) bool {
13310 v_3 := v.Args[3]
13311 v_2 := v.Args[2]
13312 v_1 := v.Args[1]
13313 v_0 := v.Args[0]
13314 // match: (STMG2 [i] {s} p w2 w3 x:(STMG2 [i-16] {s} p w0 w1 mem))
13315 // cond: x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)
13316 // result: (STMG4 [i-16] {s} p w0 w1 w2 w3 mem)
13317 for {
13318 i := auxIntToInt32(v.AuxInt)
13319 s := auxToSym(v.Aux)
13320 p := v_0
13321 w2 := v_1
13322 w3 := v_2
13323 x := v_3
13324 if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s {
13325 break
13326 }
13327 mem := x.Args[3]
13328 if p != x.Args[0] {
13329 break
13330 }
13331 w0 := x.Args[1]
13332 w1 := x.Args[2]
13333 if !(x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)) {
13334 break
13335 }
13336 v.reset(OpS390XSTMG4)
13337 v.AuxInt = int32ToAuxInt(i - 16)
13338 v.Aux = symToAux(s)
13339 v.AddArg6(p, w0, w1, w2, w3, mem)
13340 return true
13341 }
13342 return false
13343 }
13344 func rewriteValueS390X_OpS390XSUB(v *Value) bool {
13345 v_1 := v.Args[1]
13346 v_0 := v.Args[0]
13347 b := v.Block
13348 // match: (SUB x (MOVDconst [c]))
13349 // cond: is32Bit(c)
13350 // result: (SUBconst x [int32(c)])
13351 for {
13352 x := v_0
13353 if v_1.Op != OpS390XMOVDconst {
13354 break
13355 }
13356 c := auxIntToInt64(v_1.AuxInt)
13357 if !(is32Bit(c)) {
13358 break
13359 }
13360 v.reset(OpS390XSUBconst)
13361 v.AuxInt = int32ToAuxInt(int32(c))
13362 v.AddArg(x)
13363 return true
13364 }
13365 // match: (SUB (MOVDconst [c]) x)
13366 // cond: is32Bit(c)
13367 // result: (NEG (SUBconst <v.Type> x [int32(c)]))
13368 for {
13369 if v_0.Op != OpS390XMOVDconst {
13370 break
13371 }
13372 c := auxIntToInt64(v_0.AuxInt)
13373 x := v_1
13374 if !(is32Bit(c)) {
13375 break
13376 }
13377 v.reset(OpS390XNEG)
13378 v0 := b.NewValue0(v.Pos, OpS390XSUBconst, v.Type)
13379 v0.AuxInt = int32ToAuxInt(int32(c))
13380 v0.AddArg(x)
13381 v.AddArg(v0)
13382 return true
13383 }
13384 // match: (SUB x (NEG y))
13385 // result: (ADD x y)
13386 for {
13387 x := v_0
13388 if v_1.Op != OpS390XNEG {
13389 break
13390 }
13391 y := v_1.Args[0]
13392 v.reset(OpS390XADD)
13393 v.AddArg2(x, y)
13394 return true
13395 }
13396 // match: (SUB x x)
13397 // result: (MOVDconst [0])
13398 for {
13399 x := v_0
13400 if x != v_1 {
13401 break
13402 }
13403 v.reset(OpS390XMOVDconst)
13404 v.AuxInt = int64ToAuxInt(0)
13405 return true
13406 }
13407 // match: (SUB <t> x g:(MOVDload [off] {sym} ptr mem))
13408 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13409 // result: (SUBload <t> [off] {sym} x ptr mem)
13410 for {
13411 t := v.Type
13412 x := v_0
13413 g := v_1
13414 if g.Op != OpS390XMOVDload {
13415 break
13416 }
13417 off := auxIntToInt32(g.AuxInt)
13418 sym := auxToSym(g.Aux)
13419 mem := g.Args[1]
13420 ptr := g.Args[0]
13421 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13422 break
13423 }
13424 v.reset(OpS390XSUBload)
13425 v.Type = t
13426 v.AuxInt = int32ToAuxInt(off)
13427 v.Aux = symToAux(sym)
13428 v.AddArg3(x, ptr, mem)
13429 return true
13430 }
13431 return false
13432 }
13433 func rewriteValueS390X_OpS390XSUBE(v *Value) bool {
13434 v_2 := v.Args[2]
13435 v_1 := v.Args[1]
13436 v_0 := v.Args[0]
13437 // match: (SUBE x y (FlagGT))
13438 // result: (SUBC x y)
13439 for {
13440 x := v_0
13441 y := v_1
13442 if v_2.Op != OpS390XFlagGT {
13443 break
13444 }
13445 v.reset(OpS390XSUBC)
13446 v.AddArg2(x, y)
13447 return true
13448 }
13449 // match: (SUBE x y (FlagOV))
13450 // result: (SUBC x y)
13451 for {
13452 x := v_0
13453 y := v_1
13454 if v_2.Op != OpS390XFlagOV {
13455 break
13456 }
13457 v.reset(OpS390XSUBC)
13458 v.AddArg2(x, y)
13459 return true
13460 }
13461 // match: (SUBE x y (Select1 (SUBC (MOVDconst [0]) (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) c))))))
13462 // result: (SUBE x y c)
13463 for {
13464 x := v_0
13465 y := v_1
13466 if v_2.Op != OpSelect1 {
13467 break
13468 }
13469 v_2_0 := v_2.Args[0]
13470 if v_2_0.Op != OpS390XSUBC {
13471 break
13472 }
13473 _ = v_2_0.Args[1]
13474 v_2_0_0 := v_2_0.Args[0]
13475 if v_2_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
13476 break
13477 }
13478 v_2_0_1 := v_2_0.Args[1]
13479 if v_2_0_1.Op != OpS390XNEG {
13480 break
13481 }
13482 v_2_0_1_0 := v_2_0_1.Args[0]
13483 if v_2_0_1_0.Op != OpSelect0 {
13484 break
13485 }
13486 v_2_0_1_0_0 := v_2_0_1_0.Args[0]
13487 if v_2_0_1_0_0.Op != OpS390XSUBE {
13488 break
13489 }
13490 c := v_2_0_1_0_0.Args[2]
13491 v_2_0_1_0_0_0 := v_2_0_1_0_0.Args[0]
13492 if v_2_0_1_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_1_0_0_0.AuxInt) != 0 {
13493 break
13494 }
13495 v_2_0_1_0_0_1 := v_2_0_1_0_0.Args[1]
13496 if v_2_0_1_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_1_0_0_1.AuxInt) != 0 {
13497 break
13498 }
13499 v.reset(OpS390XSUBE)
13500 v.AddArg3(x, y, c)
13501 return true
13502 }
13503 return false
13504 }
13505 func rewriteValueS390X_OpS390XSUBW(v *Value) bool {
13506 v_1 := v.Args[1]
13507 v_0 := v.Args[0]
13508 b := v.Block
13509 // match: (SUBW x (MOVDconst [c]))
13510 // result: (SUBWconst x [int32(c)])
13511 for {
13512 x := v_0
13513 if v_1.Op != OpS390XMOVDconst {
13514 break
13515 }
13516 c := auxIntToInt64(v_1.AuxInt)
13517 v.reset(OpS390XSUBWconst)
13518 v.AuxInt = int32ToAuxInt(int32(c))
13519 v.AddArg(x)
13520 return true
13521 }
13522 // match: (SUBW (MOVDconst [c]) x)
13523 // result: (NEGW (SUBWconst <v.Type> x [int32(c)]))
13524 for {
13525 if v_0.Op != OpS390XMOVDconst {
13526 break
13527 }
13528 c := auxIntToInt64(v_0.AuxInt)
13529 x := v_1
13530 v.reset(OpS390XNEGW)
13531 v0 := b.NewValue0(v.Pos, OpS390XSUBWconst, v.Type)
13532 v0.AuxInt = int32ToAuxInt(int32(c))
13533 v0.AddArg(x)
13534 v.AddArg(v0)
13535 return true
13536 }
13537 // match: (SUBW x (NEGW y))
13538 // result: (ADDW x y)
13539 for {
13540 x := v_0
13541 if v_1.Op != OpS390XNEGW {
13542 break
13543 }
13544 y := v_1.Args[0]
13545 v.reset(OpS390XADDW)
13546 v.AddArg2(x, y)
13547 return true
13548 }
13549 // match: (SUBW x x)
13550 // result: (MOVDconst [0])
13551 for {
13552 x := v_0
13553 if x != v_1 {
13554 break
13555 }
13556 v.reset(OpS390XMOVDconst)
13557 v.AuxInt = int64ToAuxInt(0)
13558 return true
13559 }
13560 // match: (SUBW <t> x g:(MOVWload [off] {sym} ptr mem))
13561 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13562 // result: (SUBWload <t> [off] {sym} x ptr mem)
13563 for {
13564 t := v.Type
13565 x := v_0
13566 g := v_1
13567 if g.Op != OpS390XMOVWload {
13568 break
13569 }
13570 off := auxIntToInt32(g.AuxInt)
13571 sym := auxToSym(g.Aux)
13572 mem := g.Args[1]
13573 ptr := g.Args[0]
13574 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13575 break
13576 }
13577 v.reset(OpS390XSUBWload)
13578 v.Type = t
13579 v.AuxInt = int32ToAuxInt(off)
13580 v.Aux = symToAux(sym)
13581 v.AddArg3(x, ptr, mem)
13582 return true
13583 }
13584 // match: (SUBW <t> x g:(MOVWZload [off] {sym} ptr mem))
13585 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13586 // result: (SUBWload <t> [off] {sym} x ptr mem)
13587 for {
13588 t := v.Type
13589 x := v_0
13590 g := v_1
13591 if g.Op != OpS390XMOVWZload {
13592 break
13593 }
13594 off := auxIntToInt32(g.AuxInt)
13595 sym := auxToSym(g.Aux)
13596 mem := g.Args[1]
13597 ptr := g.Args[0]
13598 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13599 break
13600 }
13601 v.reset(OpS390XSUBWload)
13602 v.Type = t
13603 v.AuxInt = int32ToAuxInt(off)
13604 v.Aux = symToAux(sym)
13605 v.AddArg3(x, ptr, mem)
13606 return true
13607 }
13608 return false
13609 }
13610 func rewriteValueS390X_OpS390XSUBWconst(v *Value) bool {
13611 v_0 := v.Args[0]
13612 // match: (SUBWconst [c] x)
13613 // cond: int32(c) == 0
13614 // result: x
13615 for {
13616 c := auxIntToInt32(v.AuxInt)
13617 x := v_0
13618 if !(int32(c) == 0) {
13619 break
13620 }
13621 v.copyOf(x)
13622 return true
13623 }
13624 // match: (SUBWconst [c] x)
13625 // result: (ADDWconst [-int32(c)] x)
13626 for {
13627 c := auxIntToInt32(v.AuxInt)
13628 x := v_0
13629 v.reset(OpS390XADDWconst)
13630 v.AuxInt = int32ToAuxInt(-int32(c))
13631 v.AddArg(x)
13632 return true
13633 }
13634 }
13635 func rewriteValueS390X_OpS390XSUBWload(v *Value) bool {
13636 v_2 := v.Args[2]
13637 v_1 := v.Args[1]
13638 v_0 := v.Args[0]
13639 // match: (SUBWload [off1] {sym} x (ADDconst [off2] ptr) mem)
13640 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
13641 // result: (SUBWload [off1+off2] {sym} x ptr mem)
13642 for {
13643 off1 := auxIntToInt32(v.AuxInt)
13644 sym := auxToSym(v.Aux)
13645 x := v_0
13646 if v_1.Op != OpS390XADDconst {
13647 break
13648 }
13649 off2 := auxIntToInt32(v_1.AuxInt)
13650 ptr := v_1.Args[0]
13651 mem := v_2
13652 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
13653 break
13654 }
13655 v.reset(OpS390XSUBWload)
13656 v.AuxInt = int32ToAuxInt(off1 + off2)
13657 v.Aux = symToAux(sym)
13658 v.AddArg3(x, ptr, mem)
13659 return true
13660 }
13661 // match: (SUBWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
13662 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
13663 // result: (SUBWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
13664 for {
13665 o1 := auxIntToInt32(v.AuxInt)
13666 s1 := auxToSym(v.Aux)
13667 x := v_0
13668 if v_1.Op != OpS390XMOVDaddr {
13669 break
13670 }
13671 o2 := auxIntToInt32(v_1.AuxInt)
13672 s2 := auxToSym(v_1.Aux)
13673 ptr := v_1.Args[0]
13674 mem := v_2
13675 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
13676 break
13677 }
13678 v.reset(OpS390XSUBWload)
13679 v.AuxInt = int32ToAuxInt(o1 + o2)
13680 v.Aux = symToAux(mergeSym(s1, s2))
13681 v.AddArg3(x, ptr, mem)
13682 return true
13683 }
13684 return false
13685 }
13686 func rewriteValueS390X_OpS390XSUBconst(v *Value) bool {
13687 v_0 := v.Args[0]
13688 // match: (SUBconst [0] x)
13689 // result: x
13690 for {
13691 if auxIntToInt32(v.AuxInt) != 0 {
13692 break
13693 }
13694 x := v_0
13695 v.copyOf(x)
13696 return true
13697 }
13698 // match: (SUBconst [c] x)
13699 // cond: c != -(1<<31)
13700 // result: (ADDconst [-c] x)
13701 for {
13702 c := auxIntToInt32(v.AuxInt)
13703 x := v_0
13704 if !(c != -(1 << 31)) {
13705 break
13706 }
13707 v.reset(OpS390XADDconst)
13708 v.AuxInt = int32ToAuxInt(-c)
13709 v.AddArg(x)
13710 return true
13711 }
13712 // match: (SUBconst (MOVDconst [d]) [c])
13713 // result: (MOVDconst [d-int64(c)])
13714 for {
13715 c := auxIntToInt32(v.AuxInt)
13716 if v_0.Op != OpS390XMOVDconst {
13717 break
13718 }
13719 d := auxIntToInt64(v_0.AuxInt)
13720 v.reset(OpS390XMOVDconst)
13721 v.AuxInt = int64ToAuxInt(d - int64(c))
13722 return true
13723 }
13724 // match: (SUBconst (SUBconst x [d]) [c])
13725 // cond: is32Bit(-int64(c)-int64(d))
13726 // result: (ADDconst [-c-d] x)
13727 for {
13728 c := auxIntToInt32(v.AuxInt)
13729 if v_0.Op != OpS390XSUBconst {
13730 break
13731 }
13732 d := auxIntToInt32(v_0.AuxInt)
13733 x := v_0.Args[0]
13734 if !(is32Bit(-int64(c) - int64(d))) {
13735 break
13736 }
13737 v.reset(OpS390XADDconst)
13738 v.AuxInt = int32ToAuxInt(-c - d)
13739 v.AddArg(x)
13740 return true
13741 }
13742 return false
13743 }
13744 func rewriteValueS390X_OpS390XSUBload(v *Value) bool {
13745 v_2 := v.Args[2]
13746 v_1 := v.Args[1]
13747 v_0 := v.Args[0]
13748 b := v.Block
13749 // match: (SUBload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
13750 // cond: isSamePtr(ptr1, ptr2)
13751 // result: (SUB x (LGDR <t> y))
13752 for {
13753 t := v.Type
13754 off := auxIntToInt32(v.AuxInt)
13755 sym := auxToSym(v.Aux)
13756 x := v_0
13757 ptr1 := v_1
13758 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
13759 break
13760 }
13761 y := v_2.Args[1]
13762 ptr2 := v_2.Args[0]
13763 if !(isSamePtr(ptr1, ptr2)) {
13764 break
13765 }
13766 v.reset(OpS390XSUB)
13767 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
13768 v0.AddArg(y)
13769 v.AddArg2(x, v0)
13770 return true
13771 }
13772 // match: (SUBload [off1] {sym} x (ADDconst [off2] ptr) mem)
13773 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
13774 // result: (SUBload [off1+off2] {sym} x ptr mem)
13775 for {
13776 off1 := auxIntToInt32(v.AuxInt)
13777 sym := auxToSym(v.Aux)
13778 x := v_0
13779 if v_1.Op != OpS390XADDconst {
13780 break
13781 }
13782 off2 := auxIntToInt32(v_1.AuxInt)
13783 ptr := v_1.Args[0]
13784 mem := v_2
13785 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
13786 break
13787 }
13788 v.reset(OpS390XSUBload)
13789 v.AuxInt = int32ToAuxInt(off1 + off2)
13790 v.Aux = symToAux(sym)
13791 v.AddArg3(x, ptr, mem)
13792 return true
13793 }
13794 // match: (SUBload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
13795 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
13796 // result: (SUBload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
13797 for {
13798 o1 := auxIntToInt32(v.AuxInt)
13799 s1 := auxToSym(v.Aux)
13800 x := v_0
13801 if v_1.Op != OpS390XMOVDaddr {
13802 break
13803 }
13804 o2 := auxIntToInt32(v_1.AuxInt)
13805 s2 := auxToSym(v_1.Aux)
13806 ptr := v_1.Args[0]
13807 mem := v_2
13808 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
13809 break
13810 }
13811 v.reset(OpS390XSUBload)
13812 v.AuxInt = int32ToAuxInt(o1 + o2)
13813 v.Aux = symToAux(mergeSym(s1, s2))
13814 v.AddArg3(x, ptr, mem)
13815 return true
13816 }
13817 return false
13818 }
13819 func rewriteValueS390X_OpS390XSumBytes2(v *Value) bool {
13820 v_0 := v.Args[0]
13821 b := v.Block
13822 typ := &b.Func.Config.Types
13823 // match: (SumBytes2 x)
13824 // result: (ADDW (SRWconst <typ.UInt8> x [8]) x)
13825 for {
13826 x := v_0
13827 v.reset(OpS390XADDW)
13828 v0 := b.NewValue0(v.Pos, OpS390XSRWconst, typ.UInt8)
13829 v0.AuxInt = uint8ToAuxInt(8)
13830 v0.AddArg(x)
13831 v.AddArg2(v0, x)
13832 return true
13833 }
13834 }
13835 func rewriteValueS390X_OpS390XSumBytes4(v *Value) bool {
13836 v_0 := v.Args[0]
13837 b := v.Block
13838 typ := &b.Func.Config.Types
13839 // match: (SumBytes4 x)
13840 // result: (SumBytes2 (ADDW <typ.UInt16> (SRWconst <typ.UInt16> x [16]) x))
13841 for {
13842 x := v_0
13843 v.reset(OpS390XSumBytes2)
13844 v0 := b.NewValue0(v.Pos, OpS390XADDW, typ.UInt16)
13845 v1 := b.NewValue0(v.Pos, OpS390XSRWconst, typ.UInt16)
13846 v1.AuxInt = uint8ToAuxInt(16)
13847 v1.AddArg(x)
13848 v0.AddArg2(v1, x)
13849 v.AddArg(v0)
13850 return true
13851 }
13852 }
13853 func rewriteValueS390X_OpS390XSumBytes8(v *Value) bool {
13854 v_0 := v.Args[0]
13855 b := v.Block
13856 typ := &b.Func.Config.Types
13857 // match: (SumBytes8 x)
13858 // result: (SumBytes4 (ADDW <typ.UInt32> (SRDconst <typ.UInt32> x [32]) x))
13859 for {
13860 x := v_0
13861 v.reset(OpS390XSumBytes4)
13862 v0 := b.NewValue0(v.Pos, OpS390XADDW, typ.UInt32)
13863 v1 := b.NewValue0(v.Pos, OpS390XSRDconst, typ.UInt32)
13864 v1.AuxInt = uint8ToAuxInt(32)
13865 v1.AddArg(x)
13866 v0.AddArg2(v1, x)
13867 v.AddArg(v0)
13868 return true
13869 }
13870 }
13871 func rewriteValueS390X_OpS390XXOR(v *Value) bool {
13872 v_1 := v.Args[1]
13873 v_0 := v.Args[0]
13874 // match: (XOR x (MOVDconst [c]))
13875 // cond: isU32Bit(c)
13876 // result: (XORconst [c] x)
13877 for {
13878 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13879 x := v_0
13880 if v_1.Op != OpS390XMOVDconst {
13881 continue
13882 }
13883 c := auxIntToInt64(v_1.AuxInt)
13884 if !(isU32Bit(c)) {
13885 continue
13886 }
13887 v.reset(OpS390XXORconst)
13888 v.AuxInt = int64ToAuxInt(c)
13889 v.AddArg(x)
13890 return true
13891 }
13892 break
13893 }
13894 // match: (XOR (MOVDconst [c]) (MOVDconst [d]))
13895 // result: (MOVDconst [c^d])
13896 for {
13897 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13898 if v_0.Op != OpS390XMOVDconst {
13899 continue
13900 }
13901 c := auxIntToInt64(v_0.AuxInt)
13902 if v_1.Op != OpS390XMOVDconst {
13903 continue
13904 }
13905 d := auxIntToInt64(v_1.AuxInt)
13906 v.reset(OpS390XMOVDconst)
13907 v.AuxInt = int64ToAuxInt(c ^ d)
13908 return true
13909 }
13910 break
13911 }
13912 // match: (XOR x x)
13913 // result: (MOVDconst [0])
13914 for {
13915 x := v_0
13916 if x != v_1 {
13917 break
13918 }
13919 v.reset(OpS390XMOVDconst)
13920 v.AuxInt = int64ToAuxInt(0)
13921 return true
13922 }
13923 // match: (XOR <t> x g:(MOVDload [off] {sym} ptr mem))
13924 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13925 // result: (XORload <t> [off] {sym} x ptr mem)
13926 for {
13927 t := v.Type
13928 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13929 x := v_0
13930 g := v_1
13931 if g.Op != OpS390XMOVDload {
13932 continue
13933 }
13934 off := auxIntToInt32(g.AuxInt)
13935 sym := auxToSym(g.Aux)
13936 mem := g.Args[1]
13937 ptr := g.Args[0]
13938 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13939 continue
13940 }
13941 v.reset(OpS390XXORload)
13942 v.Type = t
13943 v.AuxInt = int32ToAuxInt(off)
13944 v.Aux = symToAux(sym)
13945 v.AddArg3(x, ptr, mem)
13946 return true
13947 }
13948 break
13949 }
13950 return false
13951 }
13952 func rewriteValueS390X_OpS390XXORW(v *Value) bool {
13953 v_1 := v.Args[1]
13954 v_0 := v.Args[0]
13955 // match: (XORW x (MOVDconst [c]))
13956 // result: (XORWconst [int32(c)] x)
13957 for {
13958 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13959 x := v_0
13960 if v_1.Op != OpS390XMOVDconst {
13961 continue
13962 }
13963 c := auxIntToInt64(v_1.AuxInt)
13964 v.reset(OpS390XXORWconst)
13965 v.AuxInt = int32ToAuxInt(int32(c))
13966 v.AddArg(x)
13967 return true
13968 }
13969 break
13970 }
13971 // match: (XORW x x)
13972 // result: (MOVDconst [0])
13973 for {
13974 x := v_0
13975 if x != v_1 {
13976 break
13977 }
13978 v.reset(OpS390XMOVDconst)
13979 v.AuxInt = int64ToAuxInt(0)
13980 return true
13981 }
13982 // match: (XORW <t> x g:(MOVWload [off] {sym} ptr mem))
13983 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13984 // result: (XORWload <t> [off] {sym} x ptr mem)
13985 for {
13986 t := v.Type
13987 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13988 x := v_0
13989 g := v_1
13990 if g.Op != OpS390XMOVWload {
13991 continue
13992 }
13993 off := auxIntToInt32(g.AuxInt)
13994 sym := auxToSym(g.Aux)
13995 mem := g.Args[1]
13996 ptr := g.Args[0]
13997 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13998 continue
13999 }
14000 v.reset(OpS390XXORWload)
14001 v.Type = t
14002 v.AuxInt = int32ToAuxInt(off)
14003 v.Aux = symToAux(sym)
14004 v.AddArg3(x, ptr, mem)
14005 return true
14006 }
14007 break
14008 }
14009 // match: (XORW <t> x g:(MOVWZload [off] {sym} ptr mem))
14010 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
14011 // result: (XORWload <t> [off] {sym} x ptr mem)
14012 for {
14013 t := v.Type
14014 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
14015 x := v_0
14016 g := v_1
14017 if g.Op != OpS390XMOVWZload {
14018 continue
14019 }
14020 off := auxIntToInt32(g.AuxInt)
14021 sym := auxToSym(g.Aux)
14022 mem := g.Args[1]
14023 ptr := g.Args[0]
14024 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
14025 continue
14026 }
14027 v.reset(OpS390XXORWload)
14028 v.Type = t
14029 v.AuxInt = int32ToAuxInt(off)
14030 v.Aux = symToAux(sym)
14031 v.AddArg3(x, ptr, mem)
14032 return true
14033 }
14034 break
14035 }
14036 return false
14037 }
14038 func rewriteValueS390X_OpS390XXORWconst(v *Value) bool {
14039 v_0 := v.Args[0]
14040 // match: (XORWconst [c] x)
14041 // cond: int32(c)==0
14042 // result: x
14043 for {
14044 c := auxIntToInt32(v.AuxInt)
14045 x := v_0
14046 if !(int32(c) == 0) {
14047 break
14048 }
14049 v.copyOf(x)
14050 return true
14051 }
14052 // match: (XORWconst [c] (MOVDconst [d]))
14053 // result: (MOVDconst [int64(c)^d])
14054 for {
14055 c := auxIntToInt32(v.AuxInt)
14056 if v_0.Op != OpS390XMOVDconst {
14057 break
14058 }
14059 d := auxIntToInt64(v_0.AuxInt)
14060 v.reset(OpS390XMOVDconst)
14061 v.AuxInt = int64ToAuxInt(int64(c) ^ d)
14062 return true
14063 }
14064 return false
14065 }
14066 func rewriteValueS390X_OpS390XXORWload(v *Value) bool {
14067 v_2 := v.Args[2]
14068 v_1 := v.Args[1]
14069 v_0 := v.Args[0]
14070 // match: (XORWload [off1] {sym} x (ADDconst [off2] ptr) mem)
14071 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
14072 // result: (XORWload [off1+off2] {sym} x ptr mem)
14073 for {
14074 off1 := auxIntToInt32(v.AuxInt)
14075 sym := auxToSym(v.Aux)
14076 x := v_0
14077 if v_1.Op != OpS390XADDconst {
14078 break
14079 }
14080 off2 := auxIntToInt32(v_1.AuxInt)
14081 ptr := v_1.Args[0]
14082 mem := v_2
14083 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
14084 break
14085 }
14086 v.reset(OpS390XXORWload)
14087 v.AuxInt = int32ToAuxInt(off1 + off2)
14088 v.Aux = symToAux(sym)
14089 v.AddArg3(x, ptr, mem)
14090 return true
14091 }
14092 // match: (XORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
14093 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
14094 // result: (XORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
14095 for {
14096 o1 := auxIntToInt32(v.AuxInt)
14097 s1 := auxToSym(v.Aux)
14098 x := v_0
14099 if v_1.Op != OpS390XMOVDaddr {
14100 break
14101 }
14102 o2 := auxIntToInt32(v_1.AuxInt)
14103 s2 := auxToSym(v_1.Aux)
14104 ptr := v_1.Args[0]
14105 mem := v_2
14106 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
14107 break
14108 }
14109 v.reset(OpS390XXORWload)
14110 v.AuxInt = int32ToAuxInt(o1 + o2)
14111 v.Aux = symToAux(mergeSym(s1, s2))
14112 v.AddArg3(x, ptr, mem)
14113 return true
14114 }
14115 return false
14116 }
14117 func rewriteValueS390X_OpS390XXORconst(v *Value) bool {
14118 v_0 := v.Args[0]
14119 // match: (XORconst [0] x)
14120 // result: x
14121 for {
14122 if auxIntToInt64(v.AuxInt) != 0 {
14123 break
14124 }
14125 x := v_0
14126 v.copyOf(x)
14127 return true
14128 }
14129 // match: (XORconst [c] (MOVDconst [d]))
14130 // result: (MOVDconst [c^d])
14131 for {
14132 c := auxIntToInt64(v.AuxInt)
14133 if v_0.Op != OpS390XMOVDconst {
14134 break
14135 }
14136 d := auxIntToInt64(v_0.AuxInt)
14137 v.reset(OpS390XMOVDconst)
14138 v.AuxInt = int64ToAuxInt(c ^ d)
14139 return true
14140 }
14141 return false
14142 }
14143 func rewriteValueS390X_OpS390XXORload(v *Value) bool {
14144 v_2 := v.Args[2]
14145 v_1 := v.Args[1]
14146 v_0 := v.Args[0]
14147 b := v.Block
14148 // match: (XORload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
14149 // cond: isSamePtr(ptr1, ptr2)
14150 // result: (XOR x (LGDR <t> y))
14151 for {
14152 t := v.Type
14153 off := auxIntToInt32(v.AuxInt)
14154 sym := auxToSym(v.Aux)
14155 x := v_0
14156 ptr1 := v_1
14157 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
14158 break
14159 }
14160 y := v_2.Args[1]
14161 ptr2 := v_2.Args[0]
14162 if !(isSamePtr(ptr1, ptr2)) {
14163 break
14164 }
14165 v.reset(OpS390XXOR)
14166 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
14167 v0.AddArg(y)
14168 v.AddArg2(x, v0)
14169 return true
14170 }
14171 // match: (XORload [off1] {sym} x (ADDconst [off2] ptr) mem)
14172 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
14173 // result: (XORload [off1+off2] {sym} x ptr mem)
14174 for {
14175 off1 := auxIntToInt32(v.AuxInt)
14176 sym := auxToSym(v.Aux)
14177 x := v_0
14178 if v_1.Op != OpS390XADDconst {
14179 break
14180 }
14181 off2 := auxIntToInt32(v_1.AuxInt)
14182 ptr := v_1.Args[0]
14183 mem := v_2
14184 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
14185 break
14186 }
14187 v.reset(OpS390XXORload)
14188 v.AuxInt = int32ToAuxInt(off1 + off2)
14189 v.Aux = symToAux(sym)
14190 v.AddArg3(x, ptr, mem)
14191 return true
14192 }
14193 // match: (XORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
14194 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
14195 // result: (XORload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
14196 for {
14197 o1 := auxIntToInt32(v.AuxInt)
14198 s1 := auxToSym(v.Aux)
14199 x := v_0
14200 if v_1.Op != OpS390XMOVDaddr {
14201 break
14202 }
14203 o2 := auxIntToInt32(v_1.AuxInt)
14204 s2 := auxToSym(v_1.Aux)
14205 ptr := v_1.Args[0]
14206 mem := v_2
14207 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
14208 break
14209 }
14210 v.reset(OpS390XXORload)
14211 v.AuxInt = int32ToAuxInt(o1 + o2)
14212 v.Aux = symToAux(mergeSym(s1, s2))
14213 v.AddArg3(x, ptr, mem)
14214 return true
14215 }
14216 return false
14217 }
14218 func rewriteValueS390X_OpSelect0(v *Value) bool {
14219 v_0 := v.Args[0]
14220 b := v.Block
14221 typ := &b.Func.Config.Types
14222 // match: (Select0 (Add64carry x y c))
14223 // result: (Select0 <typ.UInt64> (ADDE x y (Select1 <types.TypeFlags> (ADDCconst c [-1]))))
14224 for {
14225 if v_0.Op != OpAdd64carry {
14226 break
14227 }
14228 c := v_0.Args[2]
14229 x := v_0.Args[0]
14230 y := v_0.Args[1]
14231 v.reset(OpSelect0)
14232 v.Type = typ.UInt64
14233 v0 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags))
14234 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14235 v2 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags))
14236 v2.AuxInt = int16ToAuxInt(-1)
14237 v2.AddArg(c)
14238 v1.AddArg(v2)
14239 v0.AddArg3(x, y, v1)
14240 v.AddArg(v0)
14241 return true
14242 }
14243 // match: (Select0 (Sub64borrow x y c))
14244 // result: (Select0 <typ.UInt64> (SUBE x y (Select1 <types.TypeFlags> (SUBC (MOVDconst [0]) c))))
14245 for {
14246 if v_0.Op != OpSub64borrow {
14247 break
14248 }
14249 c := v_0.Args[2]
14250 x := v_0.Args[0]
14251 y := v_0.Args[1]
14252 v.reset(OpSelect0)
14253 v.Type = typ.UInt64
14254 v0 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags))
14255 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14256 v2 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags))
14257 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
14258 v3.AuxInt = int64ToAuxInt(0)
14259 v2.AddArg2(v3, c)
14260 v1.AddArg(v2)
14261 v0.AddArg3(x, y, v1)
14262 v.AddArg(v0)
14263 return true
14264 }
14265 // match: (Select0 <t> (AddTupleFirst32 val tuple))
14266 // result: (ADDW val (Select0 <t> tuple))
14267 for {
14268 t := v.Type
14269 if v_0.Op != OpS390XAddTupleFirst32 {
14270 break
14271 }
14272 tuple := v_0.Args[1]
14273 val := v_0.Args[0]
14274 v.reset(OpS390XADDW)
14275 v0 := b.NewValue0(v.Pos, OpSelect0, t)
14276 v0.AddArg(tuple)
14277 v.AddArg2(val, v0)
14278 return true
14279 }
14280 // match: (Select0 <t> (AddTupleFirst64 val tuple))
14281 // result: (ADD val (Select0 <t> tuple))
14282 for {
14283 t := v.Type
14284 if v_0.Op != OpS390XAddTupleFirst64 {
14285 break
14286 }
14287 tuple := v_0.Args[1]
14288 val := v_0.Args[0]
14289 v.reset(OpS390XADD)
14290 v0 := b.NewValue0(v.Pos, OpSelect0, t)
14291 v0.AddArg(tuple)
14292 v.AddArg2(val, v0)
14293 return true
14294 }
14295 // match: (Select0 (ADDCconst (MOVDconst [c]) [d]))
14296 // result: (MOVDconst [c+int64(d)])
14297 for {
14298 if v_0.Op != OpS390XADDCconst {
14299 break
14300 }
14301 d := auxIntToInt16(v_0.AuxInt)
14302 v_0_0 := v_0.Args[0]
14303 if v_0_0.Op != OpS390XMOVDconst {
14304 break
14305 }
14306 c := auxIntToInt64(v_0_0.AuxInt)
14307 v.reset(OpS390XMOVDconst)
14308 v.AuxInt = int64ToAuxInt(c + int64(d))
14309 return true
14310 }
14311 // match: (Select0 (SUBC (MOVDconst [c]) (MOVDconst [d])))
14312 // result: (MOVDconst [c-d])
14313 for {
14314 if v_0.Op != OpS390XSUBC {
14315 break
14316 }
14317 _ = v_0.Args[1]
14318 v_0_0 := v_0.Args[0]
14319 if v_0_0.Op != OpS390XMOVDconst {
14320 break
14321 }
14322 c := auxIntToInt64(v_0_0.AuxInt)
14323 v_0_1 := v_0.Args[1]
14324 if v_0_1.Op != OpS390XMOVDconst {
14325 break
14326 }
14327 d := auxIntToInt64(v_0_1.AuxInt)
14328 v.reset(OpS390XMOVDconst)
14329 v.AuxInt = int64ToAuxInt(c - d)
14330 return true
14331 }
14332 // match: (Select0 (FADD (FMUL y z) x))
14333 // cond: x.Block.Func.useFMA(v)
14334 // result: (FMADD x y z)
14335 for {
14336 if v_0.Op != OpS390XFADD {
14337 break
14338 }
14339 _ = v_0.Args[1]
14340 v_0_0 := v_0.Args[0]
14341 v_0_1 := v_0.Args[1]
14342 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
14343 if v_0_0.Op != OpS390XFMUL {
14344 continue
14345 }
14346 z := v_0_0.Args[1]
14347 y := v_0_0.Args[0]
14348 x := v_0_1
14349 if !(x.Block.Func.useFMA(v)) {
14350 continue
14351 }
14352 v.reset(OpS390XFMADD)
14353 v.AddArg3(x, y, z)
14354 return true
14355 }
14356 break
14357 }
14358 // match: (Select0 (FSUB (FMUL y z) x))
14359 // cond: x.Block.Func.useFMA(v)
14360 // result: (FMSUB x y z)
14361 for {
14362 if v_0.Op != OpS390XFSUB {
14363 break
14364 }
14365 x := v_0.Args[1]
14366 v_0_0 := v_0.Args[0]
14367 if v_0_0.Op != OpS390XFMUL {
14368 break
14369 }
14370 z := v_0_0.Args[1]
14371 y := v_0_0.Args[0]
14372 if !(x.Block.Func.useFMA(v)) {
14373 break
14374 }
14375 v.reset(OpS390XFMSUB)
14376 v.AddArg3(x, y, z)
14377 return true
14378 }
14379 // match: (Select0 (FADDS (FMULS y z) x))
14380 // cond: x.Block.Func.useFMA(v)
14381 // result: (FMADDS x y z)
14382 for {
14383 if v_0.Op != OpS390XFADDS {
14384 break
14385 }
14386 _ = v_0.Args[1]
14387 v_0_0 := v_0.Args[0]
14388 v_0_1 := v_0.Args[1]
14389 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
14390 if v_0_0.Op != OpS390XFMULS {
14391 continue
14392 }
14393 z := v_0_0.Args[1]
14394 y := v_0_0.Args[0]
14395 x := v_0_1
14396 if !(x.Block.Func.useFMA(v)) {
14397 continue
14398 }
14399 v.reset(OpS390XFMADDS)
14400 v.AddArg3(x, y, z)
14401 return true
14402 }
14403 break
14404 }
14405 // match: (Select0 (FSUBS (FMULS y z) x))
14406 // cond: x.Block.Func.useFMA(v)
14407 // result: (FMSUBS x y z)
14408 for {
14409 if v_0.Op != OpS390XFSUBS {
14410 break
14411 }
14412 x := v_0.Args[1]
14413 v_0_0 := v_0.Args[0]
14414 if v_0_0.Op != OpS390XFMULS {
14415 break
14416 }
14417 z := v_0_0.Args[1]
14418 y := v_0_0.Args[0]
14419 if !(x.Block.Func.useFMA(v)) {
14420 break
14421 }
14422 v.reset(OpS390XFMSUBS)
14423 v.AddArg3(x, y, z)
14424 return true
14425 }
14426 return false
14427 }
14428 func rewriteValueS390X_OpSelect1(v *Value) bool {
14429 v_0 := v.Args[0]
14430 b := v.Block
14431 typ := &b.Func.Config.Types
14432 // match: (Select1 (Add64carry x y c))
14433 // result: (Select0 <typ.UInt64> (ADDE (MOVDconst [0]) (MOVDconst [0]) (Select1 <types.TypeFlags> (ADDE x y (Select1 <types.TypeFlags> (ADDCconst c [-1]))))))
14434 for {
14435 if v_0.Op != OpAdd64carry {
14436 break
14437 }
14438 c := v_0.Args[2]
14439 x := v_0.Args[0]
14440 y := v_0.Args[1]
14441 v.reset(OpSelect0)
14442 v.Type = typ.UInt64
14443 v0 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags))
14444 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
14445 v1.AuxInt = int64ToAuxInt(0)
14446 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14447 v3 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags))
14448 v4 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14449 v5 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags))
14450 v5.AuxInt = int16ToAuxInt(-1)
14451 v5.AddArg(c)
14452 v4.AddArg(v5)
14453 v3.AddArg3(x, y, v4)
14454 v2.AddArg(v3)
14455 v0.AddArg3(v1, v1, v2)
14456 v.AddArg(v0)
14457 return true
14458 }
14459 // match: (Select1 (Sub64borrow x y c))
14460 // result: (NEG (Select0 <typ.UInt64> (SUBE (MOVDconst [0]) (MOVDconst [0]) (Select1 <types.TypeFlags> (SUBE x y (Select1 <types.TypeFlags> (SUBC (MOVDconst [0]) c)))))))
14461 for {
14462 if v_0.Op != OpSub64borrow {
14463 break
14464 }
14465 c := v_0.Args[2]
14466 x := v_0.Args[0]
14467 y := v_0.Args[1]
14468 v.reset(OpS390XNEG)
14469 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
14470 v1 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags))
14471 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
14472 v2.AuxInt = int64ToAuxInt(0)
14473 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14474 v4 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags))
14475 v5 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14476 v6 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags))
14477 v6.AddArg2(v2, c)
14478 v5.AddArg(v6)
14479 v4.AddArg3(x, y, v5)
14480 v3.AddArg(v4)
14481 v1.AddArg3(v2, v2, v3)
14482 v0.AddArg(v1)
14483 v.AddArg(v0)
14484 return true
14485 }
14486 // match: (Select1 (AddTupleFirst32 _ tuple))
14487 // result: (Select1 tuple)
14488 for {
14489 if v_0.Op != OpS390XAddTupleFirst32 {
14490 break
14491 }
14492 tuple := v_0.Args[1]
14493 v.reset(OpSelect1)
14494 v.AddArg(tuple)
14495 return true
14496 }
14497 // match: (Select1 (AddTupleFirst64 _ tuple))
14498 // result: (Select1 tuple)
14499 for {
14500 if v_0.Op != OpS390XAddTupleFirst64 {
14501 break
14502 }
14503 tuple := v_0.Args[1]
14504 v.reset(OpSelect1)
14505 v.AddArg(tuple)
14506 return true
14507 }
14508 // match: (Select1 (ADDCconst (MOVDconst [c]) [d]))
14509 // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0
14510 // result: (FlagEQ)
14511 for {
14512 if v_0.Op != OpS390XADDCconst {
14513 break
14514 }
14515 d := auxIntToInt16(v_0.AuxInt)
14516 v_0_0 := v_0.Args[0]
14517 if v_0_0.Op != OpS390XMOVDconst {
14518 break
14519 }
14520 c := auxIntToInt64(v_0_0.AuxInt)
14521 if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0) {
14522 break
14523 }
14524 v.reset(OpS390XFlagEQ)
14525 return true
14526 }
14527 // match: (Select1 (ADDCconst (MOVDconst [c]) [d]))
14528 // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0
14529 // result: (FlagLT)
14530 for {
14531 if v_0.Op != OpS390XADDCconst {
14532 break
14533 }
14534 d := auxIntToInt16(v_0.AuxInt)
14535 v_0_0 := v_0.Args[0]
14536 if v_0_0.Op != OpS390XMOVDconst {
14537 break
14538 }
14539 c := auxIntToInt64(v_0_0.AuxInt)
14540 if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0) {
14541 break
14542 }
14543 v.reset(OpS390XFlagLT)
14544 return true
14545 }
14546 // match: (Select1 (SUBC (MOVDconst [c]) (MOVDconst [d])))
14547 // cond: uint64(d) <= uint64(c) && c-d == 0
14548 // result: (FlagGT)
14549 for {
14550 if v_0.Op != OpS390XSUBC {
14551 break
14552 }
14553 _ = v_0.Args[1]
14554 v_0_0 := v_0.Args[0]
14555 if v_0_0.Op != OpS390XMOVDconst {
14556 break
14557 }
14558 c := auxIntToInt64(v_0_0.AuxInt)
14559 v_0_1 := v_0.Args[1]
14560 if v_0_1.Op != OpS390XMOVDconst {
14561 break
14562 }
14563 d := auxIntToInt64(v_0_1.AuxInt)
14564 if !(uint64(d) <= uint64(c) && c-d == 0) {
14565 break
14566 }
14567 v.reset(OpS390XFlagGT)
14568 return true
14569 }
14570 // match: (Select1 (SUBC (MOVDconst [c]) (MOVDconst [d])))
14571 // cond: uint64(d) <= uint64(c) && c-d != 0
14572 // result: (FlagOV)
14573 for {
14574 if v_0.Op != OpS390XSUBC {
14575 break
14576 }
14577 _ = v_0.Args[1]
14578 v_0_0 := v_0.Args[0]
14579 if v_0_0.Op != OpS390XMOVDconst {
14580 break
14581 }
14582 c := auxIntToInt64(v_0_0.AuxInt)
14583 v_0_1 := v_0.Args[1]
14584 if v_0_1.Op != OpS390XMOVDconst {
14585 break
14586 }
14587 d := auxIntToInt64(v_0_1.AuxInt)
14588 if !(uint64(d) <= uint64(c) && c-d != 0) {
14589 break
14590 }
14591 v.reset(OpS390XFlagOV)
14592 return true
14593 }
14594 return false
14595 }
14596 func rewriteValueS390X_OpSlicemask(v *Value) bool {
14597 v_0 := v.Args[0]
14598 b := v.Block
14599 // match: (Slicemask <t> x)
14600 // result: (SRADconst (NEG <t> x) [63])
14601 for {
14602 t := v.Type
14603 x := v_0
14604 v.reset(OpS390XSRADconst)
14605 v.AuxInt = uint8ToAuxInt(63)
14606 v0 := b.NewValue0(v.Pos, OpS390XNEG, t)
14607 v0.AddArg(x)
14608 v.AddArg(v0)
14609 return true
14610 }
14611 }
14612 func rewriteValueS390X_OpStore(v *Value) bool {
14613 v_2 := v.Args[2]
14614 v_1 := v.Args[1]
14615 v_0 := v.Args[0]
14616 // match: (Store {t} ptr val mem)
14617 // cond: t.Size() == 8 && t.IsFloat()
14618 // result: (FMOVDstore ptr val mem)
14619 for {
14620 t := auxToType(v.Aux)
14621 ptr := v_0
14622 val := v_1
14623 mem := v_2
14624 if !(t.Size() == 8 && t.IsFloat()) {
14625 break
14626 }
14627 v.reset(OpS390XFMOVDstore)
14628 v.AddArg3(ptr, val, mem)
14629 return true
14630 }
14631 // match: (Store {t} ptr val mem)
14632 // cond: t.Size() == 4 && t.IsFloat()
14633 // result: (FMOVSstore ptr val mem)
14634 for {
14635 t := auxToType(v.Aux)
14636 ptr := v_0
14637 val := v_1
14638 mem := v_2
14639 if !(t.Size() == 4 && t.IsFloat()) {
14640 break
14641 }
14642 v.reset(OpS390XFMOVSstore)
14643 v.AddArg3(ptr, val, mem)
14644 return true
14645 }
14646 // match: (Store {t} ptr val mem)
14647 // cond: t.Size() == 8 && !t.IsFloat()
14648 // result: (MOVDstore ptr val mem)
14649 for {
14650 t := auxToType(v.Aux)
14651 ptr := v_0
14652 val := v_1
14653 mem := v_2
14654 if !(t.Size() == 8 && !t.IsFloat()) {
14655 break
14656 }
14657 v.reset(OpS390XMOVDstore)
14658 v.AddArg3(ptr, val, mem)
14659 return true
14660 }
14661 // match: (Store {t} ptr val mem)
14662 // cond: t.Size() == 4 && !t.IsFloat()
14663 // result: (MOVWstore ptr val mem)
14664 for {
14665 t := auxToType(v.Aux)
14666 ptr := v_0
14667 val := v_1
14668 mem := v_2
14669 if !(t.Size() == 4 && !t.IsFloat()) {
14670 break
14671 }
14672 v.reset(OpS390XMOVWstore)
14673 v.AddArg3(ptr, val, mem)
14674 return true
14675 }
14676 // match: (Store {t} ptr val mem)
14677 // cond: t.Size() == 2
14678 // result: (MOVHstore ptr val mem)
14679 for {
14680 t := auxToType(v.Aux)
14681 ptr := v_0
14682 val := v_1
14683 mem := v_2
14684 if !(t.Size() == 2) {
14685 break
14686 }
14687 v.reset(OpS390XMOVHstore)
14688 v.AddArg3(ptr, val, mem)
14689 return true
14690 }
14691 // match: (Store {t} ptr val mem)
14692 // cond: t.Size() == 1
14693 // result: (MOVBstore ptr val mem)
14694 for {
14695 t := auxToType(v.Aux)
14696 ptr := v_0
14697 val := v_1
14698 mem := v_2
14699 if !(t.Size() == 1) {
14700 break
14701 }
14702 v.reset(OpS390XMOVBstore)
14703 v.AddArg3(ptr, val, mem)
14704 return true
14705 }
14706 return false
14707 }
14708 func rewriteValueS390X_OpSub32F(v *Value) bool {
14709 v_1 := v.Args[1]
14710 v_0 := v.Args[0]
14711 b := v.Block
14712 typ := &b.Func.Config.Types
14713 // match: (Sub32F x y)
14714 // result: (Select0 (FSUBS x y))
14715 for {
14716 x := v_0
14717 y := v_1
14718 v.reset(OpSelect0)
14719 v0 := b.NewValue0(v.Pos, OpS390XFSUBS, types.NewTuple(typ.Float32, types.TypeFlags))
14720 v0.AddArg2(x, y)
14721 v.AddArg(v0)
14722 return true
14723 }
14724 }
14725 func rewriteValueS390X_OpSub64F(v *Value) bool {
14726 v_1 := v.Args[1]
14727 v_0 := v.Args[0]
14728 b := v.Block
14729 typ := &b.Func.Config.Types
14730 // match: (Sub64F x y)
14731 // result: (Select0 (FSUB x y))
14732 for {
14733 x := v_0
14734 y := v_1
14735 v.reset(OpSelect0)
14736 v0 := b.NewValue0(v.Pos, OpS390XFSUB, types.NewTuple(typ.Float64, types.TypeFlags))
14737 v0.AddArg2(x, y)
14738 v.AddArg(v0)
14739 return true
14740 }
14741 }
14742 func rewriteValueS390X_OpTrunc(v *Value) bool {
14743 v_0 := v.Args[0]
14744 // match: (Trunc x)
14745 // result: (FIDBR [5] x)
14746 for {
14747 x := v_0
14748 v.reset(OpS390XFIDBR)
14749 v.AuxInt = int8ToAuxInt(5)
14750 v.AddArg(x)
14751 return true
14752 }
14753 }
14754 func rewriteValueS390X_OpZero(v *Value) bool {
14755 v_1 := v.Args[1]
14756 v_0 := v.Args[0]
14757 b := v.Block
14758 // match: (Zero [0] _ mem)
14759 // result: mem
14760 for {
14761 if auxIntToInt64(v.AuxInt) != 0 {
14762 break
14763 }
14764 mem := v_1
14765 v.copyOf(mem)
14766 return true
14767 }
14768 // match: (Zero [1] destptr mem)
14769 // result: (MOVBstoreconst [0] destptr mem)
14770 for {
14771 if auxIntToInt64(v.AuxInt) != 1 {
14772 break
14773 }
14774 destptr := v_0
14775 mem := v_1
14776 v.reset(OpS390XMOVBstoreconst)
14777 v.AuxInt = valAndOffToAuxInt(0)
14778 v.AddArg2(destptr, mem)
14779 return true
14780 }
14781 // match: (Zero [2] destptr mem)
14782 // result: (MOVHstoreconst [0] destptr mem)
14783 for {
14784 if auxIntToInt64(v.AuxInt) != 2 {
14785 break
14786 }
14787 destptr := v_0
14788 mem := v_1
14789 v.reset(OpS390XMOVHstoreconst)
14790 v.AuxInt = valAndOffToAuxInt(0)
14791 v.AddArg2(destptr, mem)
14792 return true
14793 }
14794 // match: (Zero [4] destptr mem)
14795 // result: (MOVWstoreconst [0] destptr mem)
14796 for {
14797 if auxIntToInt64(v.AuxInt) != 4 {
14798 break
14799 }
14800 destptr := v_0
14801 mem := v_1
14802 v.reset(OpS390XMOVWstoreconst)
14803 v.AuxInt = valAndOffToAuxInt(0)
14804 v.AddArg2(destptr, mem)
14805 return true
14806 }
14807 // match: (Zero [8] destptr mem)
14808 // result: (MOVDstoreconst [0] destptr mem)
14809 for {
14810 if auxIntToInt64(v.AuxInt) != 8 {
14811 break
14812 }
14813 destptr := v_0
14814 mem := v_1
14815 v.reset(OpS390XMOVDstoreconst)
14816 v.AuxInt = valAndOffToAuxInt(0)
14817 v.AddArg2(destptr, mem)
14818 return true
14819 }
14820 // match: (Zero [3] destptr mem)
14821 // result: (MOVBstoreconst [makeValAndOff(0,2)] destptr (MOVHstoreconst [0] destptr mem))
14822 for {
14823 if auxIntToInt64(v.AuxInt) != 3 {
14824 break
14825 }
14826 destptr := v_0
14827 mem := v_1
14828 v.reset(OpS390XMOVBstoreconst)
14829 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 2))
14830 v0 := b.NewValue0(v.Pos, OpS390XMOVHstoreconst, types.TypeMem)
14831 v0.AuxInt = valAndOffToAuxInt(0)
14832 v0.AddArg2(destptr, mem)
14833 v.AddArg2(destptr, v0)
14834 return true
14835 }
14836 // match: (Zero [5] destptr mem)
14837 // result: (MOVBstoreconst [makeValAndOff(0,4)] destptr (MOVWstoreconst [0] destptr mem))
14838 for {
14839 if auxIntToInt64(v.AuxInt) != 5 {
14840 break
14841 }
14842 destptr := v_0
14843 mem := v_1
14844 v.reset(OpS390XMOVBstoreconst)
14845 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
14846 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem)
14847 v0.AuxInt = valAndOffToAuxInt(0)
14848 v0.AddArg2(destptr, mem)
14849 v.AddArg2(destptr, v0)
14850 return true
14851 }
14852 // match: (Zero [6] destptr mem)
14853 // result: (MOVHstoreconst [makeValAndOff(0,4)] destptr (MOVWstoreconst [0] destptr mem))
14854 for {
14855 if auxIntToInt64(v.AuxInt) != 6 {
14856 break
14857 }
14858 destptr := v_0
14859 mem := v_1
14860 v.reset(OpS390XMOVHstoreconst)
14861 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
14862 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem)
14863 v0.AuxInt = valAndOffToAuxInt(0)
14864 v0.AddArg2(destptr, mem)
14865 v.AddArg2(destptr, v0)
14866 return true
14867 }
14868 // match: (Zero [7] destptr mem)
14869 // result: (MOVWstoreconst [makeValAndOff(0,3)] destptr (MOVWstoreconst [0] destptr mem))
14870 for {
14871 if auxIntToInt64(v.AuxInt) != 7 {
14872 break
14873 }
14874 destptr := v_0
14875 mem := v_1
14876 v.reset(OpS390XMOVWstoreconst)
14877 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 3))
14878 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem)
14879 v0.AuxInt = valAndOffToAuxInt(0)
14880 v0.AddArg2(destptr, mem)
14881 v.AddArg2(destptr, v0)
14882 return true
14883 }
14884 // match: (Zero [s] destptr mem)
14885 // cond: s > 0 && s <= 1024
14886 // result: (CLEAR [makeValAndOff(int32(s), 0)] destptr mem)
14887 for {
14888 s := auxIntToInt64(v.AuxInt)
14889 destptr := v_0
14890 mem := v_1
14891 if !(s > 0 && s <= 1024) {
14892 break
14893 }
14894 v.reset(OpS390XCLEAR)
14895 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s), 0))
14896 v.AddArg2(destptr, mem)
14897 return true
14898 }
14899 // match: (Zero [s] destptr mem)
14900 // cond: s > 1024
14901 // result: (LoweredZero [s%256] destptr (ADDconst <destptr.Type> destptr [(int32(s)/256)*256]) mem)
14902 for {
14903 s := auxIntToInt64(v.AuxInt)
14904 destptr := v_0
14905 mem := v_1
14906 if !(s > 1024) {
14907 break
14908 }
14909 v.reset(OpS390XLoweredZero)
14910 v.AuxInt = int64ToAuxInt(s % 256)
14911 v0 := b.NewValue0(v.Pos, OpS390XADDconst, destptr.Type)
14912 v0.AuxInt = int32ToAuxInt((int32(s) / 256) * 256)
14913 v0.AddArg(destptr)
14914 v.AddArg3(destptr, v0, mem)
14915 return true
14916 }
14917 return false
14918 }
14919 func rewriteBlockS390X(b *Block) bool {
14920 typ := &b.Func.Config.Types
14921 switch b.Kind {
14922 case BlockS390XBRC:
14923 // match: (BRC {c} x:(CMP _ _) yes no)
14924 // cond: c&s390x.Unordered != 0
14925 // result: (BRC {c&^s390x.Unordered} x yes no)
14926 for b.Controls[0].Op == OpS390XCMP {
14927 x := b.Controls[0]
14928 c := auxToS390xCCMask(b.Aux)
14929 if !(c&s390x.Unordered != 0) {
14930 break
14931 }
14932 b.resetWithControl(BlockS390XBRC, x)
14933 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14934 return true
14935 }
14936 // match: (BRC {c} x:(CMPW _ _) yes no)
14937 // cond: c&s390x.Unordered != 0
14938 // result: (BRC {c&^s390x.Unordered} x yes no)
14939 for b.Controls[0].Op == OpS390XCMPW {
14940 x := b.Controls[0]
14941 c := auxToS390xCCMask(b.Aux)
14942 if !(c&s390x.Unordered != 0) {
14943 break
14944 }
14945 b.resetWithControl(BlockS390XBRC, x)
14946 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14947 return true
14948 }
14949 // match: (BRC {c} x:(CMPU _ _) yes no)
14950 // cond: c&s390x.Unordered != 0
14951 // result: (BRC {c&^s390x.Unordered} x yes no)
14952 for b.Controls[0].Op == OpS390XCMPU {
14953 x := b.Controls[0]
14954 c := auxToS390xCCMask(b.Aux)
14955 if !(c&s390x.Unordered != 0) {
14956 break
14957 }
14958 b.resetWithControl(BlockS390XBRC, x)
14959 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14960 return true
14961 }
14962 // match: (BRC {c} x:(CMPWU _ _) yes no)
14963 // cond: c&s390x.Unordered != 0
14964 // result: (BRC {c&^s390x.Unordered} x yes no)
14965 for b.Controls[0].Op == OpS390XCMPWU {
14966 x := b.Controls[0]
14967 c := auxToS390xCCMask(b.Aux)
14968 if !(c&s390x.Unordered != 0) {
14969 break
14970 }
14971 b.resetWithControl(BlockS390XBRC, x)
14972 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14973 return true
14974 }
14975 // match: (BRC {c} x:(CMPconst _) yes no)
14976 // cond: c&s390x.Unordered != 0
14977 // result: (BRC {c&^s390x.Unordered} x yes no)
14978 for b.Controls[0].Op == OpS390XCMPconst {
14979 x := b.Controls[0]
14980 c := auxToS390xCCMask(b.Aux)
14981 if !(c&s390x.Unordered != 0) {
14982 break
14983 }
14984 b.resetWithControl(BlockS390XBRC, x)
14985 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14986 return true
14987 }
14988 // match: (BRC {c} x:(CMPWconst _) yes no)
14989 // cond: c&s390x.Unordered != 0
14990 // result: (BRC {c&^s390x.Unordered} x yes no)
14991 for b.Controls[0].Op == OpS390XCMPWconst {
14992 x := b.Controls[0]
14993 c := auxToS390xCCMask(b.Aux)
14994 if !(c&s390x.Unordered != 0) {
14995 break
14996 }
14997 b.resetWithControl(BlockS390XBRC, x)
14998 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14999 return true
15000 }
15001 // match: (BRC {c} x:(CMPUconst _) yes no)
15002 // cond: c&s390x.Unordered != 0
15003 // result: (BRC {c&^s390x.Unordered} x yes no)
15004 for b.Controls[0].Op == OpS390XCMPUconst {
15005 x := b.Controls[0]
15006 c := auxToS390xCCMask(b.Aux)
15007 if !(c&s390x.Unordered != 0) {
15008 break
15009 }
15010 b.resetWithControl(BlockS390XBRC, x)
15011 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15012 return true
15013 }
15014 // match: (BRC {c} x:(CMPWUconst _) yes no)
15015 // cond: c&s390x.Unordered != 0
15016 // result: (BRC {c&^s390x.Unordered} x yes no)
15017 for b.Controls[0].Op == OpS390XCMPWUconst {
15018 x := b.Controls[0]
15019 c := auxToS390xCCMask(b.Aux)
15020 if !(c&s390x.Unordered != 0) {
15021 break
15022 }
15023 b.resetWithControl(BlockS390XBRC, x)
15024 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15025 return true
15026 }
15027 // match: (BRC {c} (CMP x y) yes no)
15028 // result: (CGRJ {c&^s390x.Unordered} x y yes no)
15029 for b.Controls[0].Op == OpS390XCMP {
15030 v_0 := b.Controls[0]
15031 y := v_0.Args[1]
15032 x := v_0.Args[0]
15033 c := auxToS390xCCMask(b.Aux)
15034 b.resetWithControl2(BlockS390XCGRJ, x, y)
15035 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15036 return true
15037 }
15038 // match: (BRC {c} (CMPW x y) yes no)
15039 // result: (CRJ {c&^s390x.Unordered} x y yes no)
15040 for b.Controls[0].Op == OpS390XCMPW {
15041 v_0 := b.Controls[0]
15042 y := v_0.Args[1]
15043 x := v_0.Args[0]
15044 c := auxToS390xCCMask(b.Aux)
15045 b.resetWithControl2(BlockS390XCRJ, x, y)
15046 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15047 return true
15048 }
15049 // match: (BRC {c} (CMPU x y) yes no)
15050 // result: (CLGRJ {c&^s390x.Unordered} x y yes no)
15051 for b.Controls[0].Op == OpS390XCMPU {
15052 v_0 := b.Controls[0]
15053 y := v_0.Args[1]
15054 x := v_0.Args[0]
15055 c := auxToS390xCCMask(b.Aux)
15056 b.resetWithControl2(BlockS390XCLGRJ, x, y)
15057 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15058 return true
15059 }
15060 // match: (BRC {c} (CMPWU x y) yes no)
15061 // result: (CLRJ {c&^s390x.Unordered} x y yes no)
15062 for b.Controls[0].Op == OpS390XCMPWU {
15063 v_0 := b.Controls[0]
15064 y := v_0.Args[1]
15065 x := v_0.Args[0]
15066 c := auxToS390xCCMask(b.Aux)
15067 b.resetWithControl2(BlockS390XCLRJ, x, y)
15068 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15069 return true
15070 }
15071 // match: (BRC {c} (CMPconst x [y]) yes no)
15072 // cond: y == int32( int8(y))
15073 // result: (CGIJ {c&^s390x.Unordered} x [ int8(y)] yes no)
15074 for b.Controls[0].Op == OpS390XCMPconst {
15075 v_0 := b.Controls[0]
15076 y := auxIntToInt32(v_0.AuxInt)
15077 x := v_0.Args[0]
15078 c := auxToS390xCCMask(b.Aux)
15079 if !(y == int32(int8(y))) {
15080 break
15081 }
15082 b.resetWithControl(BlockS390XCGIJ, x)
15083 b.AuxInt = int8ToAuxInt(int8(y))
15084 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15085 return true
15086 }
15087 // match: (BRC {c} (CMPWconst x [y]) yes no)
15088 // cond: y == int32( int8(y))
15089 // result: (CIJ {c&^s390x.Unordered} x [ int8(y)] yes no)
15090 for b.Controls[0].Op == OpS390XCMPWconst {
15091 v_0 := b.Controls[0]
15092 y := auxIntToInt32(v_0.AuxInt)
15093 x := v_0.Args[0]
15094 c := auxToS390xCCMask(b.Aux)
15095 if !(y == int32(int8(y))) {
15096 break
15097 }
15098 b.resetWithControl(BlockS390XCIJ, x)
15099 b.AuxInt = int8ToAuxInt(int8(y))
15100 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15101 return true
15102 }
15103 // match: (BRC {c} (CMPUconst x [y]) yes no)
15104 // cond: y == int32(uint8(y))
15105 // result: (CLGIJ {c&^s390x.Unordered} x [uint8(y)] yes no)
15106 for b.Controls[0].Op == OpS390XCMPUconst {
15107 v_0 := b.Controls[0]
15108 y := auxIntToInt32(v_0.AuxInt)
15109 x := v_0.Args[0]
15110 c := auxToS390xCCMask(b.Aux)
15111 if !(y == int32(uint8(y))) {
15112 break
15113 }
15114 b.resetWithControl(BlockS390XCLGIJ, x)
15115 b.AuxInt = uint8ToAuxInt(uint8(y))
15116 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15117 return true
15118 }
15119 // match: (BRC {c} (CMPWUconst x [y]) yes no)
15120 // cond: y == int32(uint8(y))
15121 // result: (CLIJ {c&^s390x.Unordered} x [uint8(y)] yes no)
15122 for b.Controls[0].Op == OpS390XCMPWUconst {
15123 v_0 := b.Controls[0]
15124 y := auxIntToInt32(v_0.AuxInt)
15125 x := v_0.Args[0]
15126 c := auxToS390xCCMask(b.Aux)
15127 if !(y == int32(uint8(y))) {
15128 break
15129 }
15130 b.resetWithControl(BlockS390XCLIJ, x)
15131 b.AuxInt = uint8ToAuxInt(uint8(y))
15132 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15133 return true
15134 }
15135 // match: (BRC {s390x.Less} (CMPconst x [ 128]) yes no)
15136 // result: (CGIJ {s390x.LessOrEqual} x [ 127] yes no)
15137 for b.Controls[0].Op == OpS390XCMPconst {
15138 v_0 := b.Controls[0]
15139 if auxIntToInt32(v_0.AuxInt) != 128 {
15140 break
15141 }
15142 x := v_0.Args[0]
15143 if auxToS390xCCMask(b.Aux) != s390x.Less {
15144 break
15145 }
15146 b.resetWithControl(BlockS390XCGIJ, x)
15147 b.AuxInt = int8ToAuxInt(127)
15148 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
15149 return true
15150 }
15151 // match: (BRC {s390x.Less} (CMPWconst x [ 128]) yes no)
15152 // result: (CIJ {s390x.LessOrEqual} x [ 127] yes no)
15153 for b.Controls[0].Op == OpS390XCMPWconst {
15154 v_0 := b.Controls[0]
15155 if auxIntToInt32(v_0.AuxInt) != 128 {
15156 break
15157 }
15158 x := v_0.Args[0]
15159 if auxToS390xCCMask(b.Aux) != s390x.Less {
15160 break
15161 }
15162 b.resetWithControl(BlockS390XCIJ, x)
15163 b.AuxInt = int8ToAuxInt(127)
15164 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
15165 return true
15166 }
15167 // match: (BRC {s390x.LessOrEqual} (CMPconst x [-129]) yes no)
15168 // result: (CGIJ {s390x.Less} x [-128] yes no)
15169 for b.Controls[0].Op == OpS390XCMPconst {
15170 v_0 := b.Controls[0]
15171 if auxIntToInt32(v_0.AuxInt) != -129 {
15172 break
15173 }
15174 x := v_0.Args[0]
15175 if auxToS390xCCMask(b.Aux) != s390x.LessOrEqual {
15176 break
15177 }
15178 b.resetWithControl(BlockS390XCGIJ, x)
15179 b.AuxInt = int8ToAuxInt(-128)
15180 b.Aux = s390xCCMaskToAux(s390x.Less)
15181 return true
15182 }
15183 // match: (BRC {s390x.LessOrEqual} (CMPWconst x [-129]) yes no)
15184 // result: (CIJ {s390x.Less} x [-128] yes no)
15185 for b.Controls[0].Op == OpS390XCMPWconst {
15186 v_0 := b.Controls[0]
15187 if auxIntToInt32(v_0.AuxInt) != -129 {
15188 break
15189 }
15190 x := v_0.Args[0]
15191 if auxToS390xCCMask(b.Aux) != s390x.LessOrEqual {
15192 break
15193 }
15194 b.resetWithControl(BlockS390XCIJ, x)
15195 b.AuxInt = int8ToAuxInt(-128)
15196 b.Aux = s390xCCMaskToAux(s390x.Less)
15197 return true
15198 }
15199 // match: (BRC {s390x.Greater} (CMPconst x [-129]) yes no)
15200 // result: (CGIJ {s390x.GreaterOrEqual} x [-128] yes no)
15201 for b.Controls[0].Op == OpS390XCMPconst {
15202 v_0 := b.Controls[0]
15203 if auxIntToInt32(v_0.AuxInt) != -129 {
15204 break
15205 }
15206 x := v_0.Args[0]
15207 if auxToS390xCCMask(b.Aux) != s390x.Greater {
15208 break
15209 }
15210 b.resetWithControl(BlockS390XCGIJ, x)
15211 b.AuxInt = int8ToAuxInt(-128)
15212 b.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
15213 return true
15214 }
15215 // match: (BRC {s390x.Greater} (CMPWconst x [-129]) yes no)
15216 // result: (CIJ {s390x.GreaterOrEqual} x [-128] yes no)
15217 for b.Controls[0].Op == OpS390XCMPWconst {
15218 v_0 := b.Controls[0]
15219 if auxIntToInt32(v_0.AuxInt) != -129 {
15220 break
15221 }
15222 x := v_0.Args[0]
15223 if auxToS390xCCMask(b.Aux) != s390x.Greater {
15224 break
15225 }
15226 b.resetWithControl(BlockS390XCIJ, x)
15227 b.AuxInt = int8ToAuxInt(-128)
15228 b.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
15229 return true
15230 }
15231 // match: (BRC {s390x.GreaterOrEqual} (CMPconst x [ 128]) yes no)
15232 // result: (CGIJ {s390x.Greater} x [ 127] yes no)
15233 for b.Controls[0].Op == OpS390XCMPconst {
15234 v_0 := b.Controls[0]
15235 if auxIntToInt32(v_0.AuxInt) != 128 {
15236 break
15237 }
15238 x := v_0.Args[0]
15239 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
15240 break
15241 }
15242 b.resetWithControl(BlockS390XCGIJ, x)
15243 b.AuxInt = int8ToAuxInt(127)
15244 b.Aux = s390xCCMaskToAux(s390x.Greater)
15245 return true
15246 }
15247 // match: (BRC {s390x.GreaterOrEqual} (CMPWconst x [ 128]) yes no)
15248 // result: (CIJ {s390x.Greater} x [ 127] yes no)
15249 for b.Controls[0].Op == OpS390XCMPWconst {
15250 v_0 := b.Controls[0]
15251 if auxIntToInt32(v_0.AuxInt) != 128 {
15252 break
15253 }
15254 x := v_0.Args[0]
15255 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
15256 break
15257 }
15258 b.resetWithControl(BlockS390XCIJ, x)
15259 b.AuxInt = int8ToAuxInt(127)
15260 b.Aux = s390xCCMaskToAux(s390x.Greater)
15261 return true
15262 }
15263 // match: (BRC {s390x.Less} (CMPWUconst x [256]) yes no)
15264 // result: (CLIJ {s390x.LessOrEqual} x [255] yes no)
15265 for b.Controls[0].Op == OpS390XCMPWUconst {
15266 v_0 := b.Controls[0]
15267 if auxIntToInt32(v_0.AuxInt) != 256 {
15268 break
15269 }
15270 x := v_0.Args[0]
15271 if auxToS390xCCMask(b.Aux) != s390x.Less {
15272 break
15273 }
15274 b.resetWithControl(BlockS390XCLIJ, x)
15275 b.AuxInt = uint8ToAuxInt(255)
15276 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
15277 return true
15278 }
15279 // match: (BRC {s390x.Less} (CMPUconst x [256]) yes no)
15280 // result: (CLGIJ {s390x.LessOrEqual} x [255] yes no)
15281 for b.Controls[0].Op == OpS390XCMPUconst {
15282 v_0 := b.Controls[0]
15283 if auxIntToInt32(v_0.AuxInt) != 256 {
15284 break
15285 }
15286 x := v_0.Args[0]
15287 if auxToS390xCCMask(b.Aux) != s390x.Less {
15288 break
15289 }
15290 b.resetWithControl(BlockS390XCLGIJ, x)
15291 b.AuxInt = uint8ToAuxInt(255)
15292 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
15293 return true
15294 }
15295 // match: (BRC {s390x.GreaterOrEqual} (CMPWUconst x [256]) yes no)
15296 // result: (CLIJ {s390x.Greater} x [255] yes no)
15297 for b.Controls[0].Op == OpS390XCMPWUconst {
15298 v_0 := b.Controls[0]
15299 if auxIntToInt32(v_0.AuxInt) != 256 {
15300 break
15301 }
15302 x := v_0.Args[0]
15303 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
15304 break
15305 }
15306 b.resetWithControl(BlockS390XCLIJ, x)
15307 b.AuxInt = uint8ToAuxInt(255)
15308 b.Aux = s390xCCMaskToAux(s390x.Greater)
15309 return true
15310 }
15311 // match: (BRC {s390x.GreaterOrEqual} (CMPUconst x [256]) yes no)
15312 // result: (CLGIJ {s390x.Greater} x [255] yes no)
15313 for b.Controls[0].Op == OpS390XCMPUconst {
15314 v_0 := b.Controls[0]
15315 if auxIntToInt32(v_0.AuxInt) != 256 {
15316 break
15317 }
15318 x := v_0.Args[0]
15319 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
15320 break
15321 }
15322 b.resetWithControl(BlockS390XCLGIJ, x)
15323 b.AuxInt = uint8ToAuxInt(255)
15324 b.Aux = s390xCCMaskToAux(s390x.Greater)
15325 return true
15326 }
15327 // match: (BRC {c} (CMPconst x [y]) yes no)
15328 // cond: y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)
15329 // result: (CLGIJ {c} x [uint8(y)] yes no)
15330 for b.Controls[0].Op == OpS390XCMPconst {
15331 v_0 := b.Controls[0]
15332 y := auxIntToInt32(v_0.AuxInt)
15333 x := v_0.Args[0]
15334 c := auxToS390xCCMask(b.Aux)
15335 if !(y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) {
15336 break
15337 }
15338 b.resetWithControl(BlockS390XCLGIJ, x)
15339 b.AuxInt = uint8ToAuxInt(uint8(y))
15340 b.Aux = s390xCCMaskToAux(c)
15341 return true
15342 }
15343 // match: (BRC {c} (CMPWconst x [y]) yes no)
15344 // cond: y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)
15345 // result: (CLIJ {c} x [uint8(y)] yes no)
15346 for b.Controls[0].Op == OpS390XCMPWconst {
15347 v_0 := b.Controls[0]
15348 y := auxIntToInt32(v_0.AuxInt)
15349 x := v_0.Args[0]
15350 c := auxToS390xCCMask(b.Aux)
15351 if !(y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) {
15352 break
15353 }
15354 b.resetWithControl(BlockS390XCLIJ, x)
15355 b.AuxInt = uint8ToAuxInt(uint8(y))
15356 b.Aux = s390xCCMaskToAux(c)
15357 return true
15358 }
15359 // match: (BRC {c} (CMPUconst x [y]) yes no)
15360 // cond: y == int32( int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)
15361 // result: (CGIJ {c} x [ int8(y)] yes no)
15362 for b.Controls[0].Op == OpS390XCMPUconst {
15363 v_0 := b.Controls[0]
15364 y := auxIntToInt32(v_0.AuxInt)
15365 x := v_0.Args[0]
15366 c := auxToS390xCCMask(b.Aux)
15367 if !(y == int32(int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) {
15368 break
15369 }
15370 b.resetWithControl(BlockS390XCGIJ, x)
15371 b.AuxInt = int8ToAuxInt(int8(y))
15372 b.Aux = s390xCCMaskToAux(c)
15373 return true
15374 }
15375 // match: (BRC {c} (CMPWUconst x [y]) yes no)
15376 // cond: y == int32( int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)
15377 // result: (CIJ {c} x [ int8(y)] yes no)
15378 for b.Controls[0].Op == OpS390XCMPWUconst {
15379 v_0 := b.Controls[0]
15380 y := auxIntToInt32(v_0.AuxInt)
15381 x := v_0.Args[0]
15382 c := auxToS390xCCMask(b.Aux)
15383 if !(y == int32(int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) {
15384 break
15385 }
15386 b.resetWithControl(BlockS390XCIJ, x)
15387 b.AuxInt = int8ToAuxInt(int8(y))
15388 b.Aux = s390xCCMaskToAux(c)
15389 return true
15390 }
15391 // match: (BRC {c} (InvertFlags cmp) yes no)
15392 // result: (BRC {c.ReverseComparison()} cmp yes no)
15393 for b.Controls[0].Op == OpS390XInvertFlags {
15394 v_0 := b.Controls[0]
15395 cmp := v_0.Args[0]
15396 c := auxToS390xCCMask(b.Aux)
15397 b.resetWithControl(BlockS390XBRC, cmp)
15398 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
15399 return true
15400 }
15401 // match: (BRC {c} (FlagEQ) yes no)
15402 // cond: c&s390x.Equal != 0
15403 // result: (First yes no)
15404 for b.Controls[0].Op == OpS390XFlagEQ {
15405 c := auxToS390xCCMask(b.Aux)
15406 if !(c&s390x.Equal != 0) {
15407 break
15408 }
15409 b.Reset(BlockFirst)
15410 return true
15411 }
15412 // match: (BRC {c} (FlagLT) yes no)
15413 // cond: c&s390x.Less != 0
15414 // result: (First yes no)
15415 for b.Controls[0].Op == OpS390XFlagLT {
15416 c := auxToS390xCCMask(b.Aux)
15417 if !(c&s390x.Less != 0) {
15418 break
15419 }
15420 b.Reset(BlockFirst)
15421 return true
15422 }
15423 // match: (BRC {c} (FlagGT) yes no)
15424 // cond: c&s390x.Greater != 0
15425 // result: (First yes no)
15426 for b.Controls[0].Op == OpS390XFlagGT {
15427 c := auxToS390xCCMask(b.Aux)
15428 if !(c&s390x.Greater != 0) {
15429 break
15430 }
15431 b.Reset(BlockFirst)
15432 return true
15433 }
15434 // match: (BRC {c} (FlagOV) yes no)
15435 // cond: c&s390x.Unordered != 0
15436 // result: (First yes no)
15437 for b.Controls[0].Op == OpS390XFlagOV {
15438 c := auxToS390xCCMask(b.Aux)
15439 if !(c&s390x.Unordered != 0) {
15440 break
15441 }
15442 b.Reset(BlockFirst)
15443 return true
15444 }
15445 // match: (BRC {c} (FlagEQ) yes no)
15446 // cond: c&s390x.Equal == 0
15447 // result: (First no yes)
15448 for b.Controls[0].Op == OpS390XFlagEQ {
15449 c := auxToS390xCCMask(b.Aux)
15450 if !(c&s390x.Equal == 0) {
15451 break
15452 }
15453 b.Reset(BlockFirst)
15454 b.swapSuccessors()
15455 return true
15456 }
15457 // match: (BRC {c} (FlagLT) yes no)
15458 // cond: c&s390x.Less == 0
15459 // result: (First no yes)
15460 for b.Controls[0].Op == OpS390XFlagLT {
15461 c := auxToS390xCCMask(b.Aux)
15462 if !(c&s390x.Less == 0) {
15463 break
15464 }
15465 b.Reset(BlockFirst)
15466 b.swapSuccessors()
15467 return true
15468 }
15469 // match: (BRC {c} (FlagGT) yes no)
15470 // cond: c&s390x.Greater == 0
15471 // result: (First no yes)
15472 for b.Controls[0].Op == OpS390XFlagGT {
15473 c := auxToS390xCCMask(b.Aux)
15474 if !(c&s390x.Greater == 0) {
15475 break
15476 }
15477 b.Reset(BlockFirst)
15478 b.swapSuccessors()
15479 return true
15480 }
15481 // match: (BRC {c} (FlagOV) yes no)
15482 // cond: c&s390x.Unordered == 0
15483 // result: (First no yes)
15484 for b.Controls[0].Op == OpS390XFlagOV {
15485 c := auxToS390xCCMask(b.Aux)
15486 if !(c&s390x.Unordered == 0) {
15487 break
15488 }
15489 b.Reset(BlockFirst)
15490 b.swapSuccessors()
15491 return true
15492 }
15493 case BlockS390XCGIJ:
15494 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15495 // cond: c&s390x.Equal != 0 && int64(x) == int64(y)
15496 // result: (First yes no)
15497 for b.Controls[0].Op == OpS390XMOVDconst {
15498 v_0 := b.Controls[0]
15499 x := auxIntToInt64(v_0.AuxInt)
15500 y := auxIntToInt8(b.AuxInt)
15501 c := auxToS390xCCMask(b.Aux)
15502 if !(c&s390x.Equal != 0 && int64(x) == int64(y)) {
15503 break
15504 }
15505 b.Reset(BlockFirst)
15506 return true
15507 }
15508 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15509 // cond: c&s390x.Less != 0 && int64(x) < int64(y)
15510 // result: (First yes no)
15511 for b.Controls[0].Op == OpS390XMOVDconst {
15512 v_0 := b.Controls[0]
15513 x := auxIntToInt64(v_0.AuxInt)
15514 y := auxIntToInt8(b.AuxInt)
15515 c := auxToS390xCCMask(b.Aux)
15516 if !(c&s390x.Less != 0 && int64(x) < int64(y)) {
15517 break
15518 }
15519 b.Reset(BlockFirst)
15520 return true
15521 }
15522 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15523 // cond: c&s390x.Greater != 0 && int64(x) > int64(y)
15524 // result: (First yes no)
15525 for b.Controls[0].Op == OpS390XMOVDconst {
15526 v_0 := b.Controls[0]
15527 x := auxIntToInt64(v_0.AuxInt)
15528 y := auxIntToInt8(b.AuxInt)
15529 c := auxToS390xCCMask(b.Aux)
15530 if !(c&s390x.Greater != 0 && int64(x) > int64(y)) {
15531 break
15532 }
15533 b.Reset(BlockFirst)
15534 return true
15535 }
15536 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15537 // cond: c&s390x.Equal == 0 && int64(x) == int64(y)
15538 // result: (First no yes)
15539 for b.Controls[0].Op == OpS390XMOVDconst {
15540 v_0 := b.Controls[0]
15541 x := auxIntToInt64(v_0.AuxInt)
15542 y := auxIntToInt8(b.AuxInt)
15543 c := auxToS390xCCMask(b.Aux)
15544 if !(c&s390x.Equal == 0 && int64(x) == int64(y)) {
15545 break
15546 }
15547 b.Reset(BlockFirst)
15548 b.swapSuccessors()
15549 return true
15550 }
15551 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15552 // cond: c&s390x.Less == 0 && int64(x) < int64(y)
15553 // result: (First no yes)
15554 for b.Controls[0].Op == OpS390XMOVDconst {
15555 v_0 := b.Controls[0]
15556 x := auxIntToInt64(v_0.AuxInt)
15557 y := auxIntToInt8(b.AuxInt)
15558 c := auxToS390xCCMask(b.Aux)
15559 if !(c&s390x.Less == 0 && int64(x) < int64(y)) {
15560 break
15561 }
15562 b.Reset(BlockFirst)
15563 b.swapSuccessors()
15564 return true
15565 }
15566 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15567 // cond: c&s390x.Greater == 0 && int64(x) > int64(y)
15568 // result: (First no yes)
15569 for b.Controls[0].Op == OpS390XMOVDconst {
15570 v_0 := b.Controls[0]
15571 x := auxIntToInt64(v_0.AuxInt)
15572 y := auxIntToInt8(b.AuxInt)
15573 c := auxToS390xCCMask(b.Aux)
15574 if !(c&s390x.Greater == 0 && int64(x) > int64(y)) {
15575 break
15576 }
15577 b.Reset(BlockFirst)
15578 b.swapSuccessors()
15579 return true
15580 }
15581 // match: (CGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
15582 // result: (BRC {s390x.NoCarry} carry)
15583 for b.Controls[0].Op == OpSelect0 {
15584 v_0 := b.Controls[0]
15585 v_0_0 := v_0.Args[0]
15586 if v_0_0.Op != OpS390XADDE {
15587 break
15588 }
15589 carry := v_0_0.Args[2]
15590 v_0_0_0 := v_0_0.Args[0]
15591 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15592 break
15593 }
15594 v_0_0_1 := v_0_0.Args[1]
15595 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal {
15596 break
15597 }
15598 b.resetWithControl(BlockS390XBRC, carry)
15599 b.Aux = s390xCCMaskToAux(s390x.NoCarry)
15600 return true
15601 }
15602 // match: (CGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1])
15603 // result: (BRC {s390x.Carry} carry)
15604 for b.Controls[0].Op == OpSelect0 {
15605 v_0 := b.Controls[0]
15606 v_0_0 := v_0.Args[0]
15607 if v_0_0.Op != OpS390XADDE {
15608 break
15609 }
15610 carry := v_0_0.Args[2]
15611 v_0_0_0 := v_0_0.Args[0]
15612 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15613 break
15614 }
15615 v_0_0_1 := v_0_0.Args[1]
15616 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal {
15617 break
15618 }
15619 b.resetWithControl(BlockS390XBRC, carry)
15620 b.Aux = s390xCCMaskToAux(s390x.Carry)
15621 return true
15622 }
15623 // match: (CGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
15624 // result: (BRC {s390x.Carry} carry)
15625 for b.Controls[0].Op == OpSelect0 {
15626 v_0 := b.Controls[0]
15627 v_0_0 := v_0.Args[0]
15628 if v_0_0.Op != OpS390XADDE {
15629 break
15630 }
15631 carry := v_0_0.Args[2]
15632 v_0_0_0 := v_0_0.Args[0]
15633 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15634 break
15635 }
15636 v_0_0_1 := v_0_0.Args[1]
15637 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
15638 break
15639 }
15640 b.resetWithControl(BlockS390XBRC, carry)
15641 b.Aux = s390xCCMaskToAux(s390x.Carry)
15642 return true
15643 }
15644 // match: (CGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1])
15645 // result: (BRC {s390x.NoCarry} carry)
15646 for b.Controls[0].Op == OpSelect0 {
15647 v_0 := b.Controls[0]
15648 v_0_0 := v_0.Args[0]
15649 if v_0_0.Op != OpS390XADDE {
15650 break
15651 }
15652 carry := v_0_0.Args[2]
15653 v_0_0_0 := v_0_0.Args[0]
15654 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15655 break
15656 }
15657 v_0_0_1 := v_0_0.Args[1]
15658 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
15659 break
15660 }
15661 b.resetWithControl(BlockS390XBRC, carry)
15662 b.Aux = s390xCCMaskToAux(s390x.NoCarry)
15663 return true
15664 }
15665 // match: (CGIJ {s390x.Greater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
15666 // result: (BRC {s390x.Carry} carry)
15667 for b.Controls[0].Op == OpSelect0 {
15668 v_0 := b.Controls[0]
15669 v_0_0 := v_0.Args[0]
15670 if v_0_0.Op != OpS390XADDE {
15671 break
15672 }
15673 carry := v_0_0.Args[2]
15674 v_0_0_0 := v_0_0.Args[0]
15675 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15676 break
15677 }
15678 v_0_0_1 := v_0_0.Args[1]
15679 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater {
15680 break
15681 }
15682 b.resetWithControl(BlockS390XBRC, carry)
15683 b.Aux = s390xCCMaskToAux(s390x.Carry)
15684 return true
15685 }
15686 // match: (CGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
15687 // result: (BRC {s390x.NoBorrow} borrow)
15688 for b.Controls[0].Op == OpS390XNEG {
15689 v_0 := b.Controls[0]
15690 v_0_0 := v_0.Args[0]
15691 if v_0_0.Op != OpSelect0 {
15692 break
15693 }
15694 v_0_0_0 := v_0_0.Args[0]
15695 if v_0_0_0.Op != OpS390XSUBE {
15696 break
15697 }
15698 borrow := v_0_0_0.Args[2]
15699 v_0_0_0_0 := v_0_0_0.Args[0]
15700 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15701 break
15702 }
15703 v_0_0_0_1 := v_0_0_0.Args[1]
15704 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal {
15705 break
15706 }
15707 b.resetWithControl(BlockS390XBRC, borrow)
15708 b.Aux = s390xCCMaskToAux(s390x.NoBorrow)
15709 return true
15710 }
15711 // match: (CGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1])
15712 // result: (BRC {s390x.Borrow} borrow)
15713 for b.Controls[0].Op == OpS390XNEG {
15714 v_0 := b.Controls[0]
15715 v_0_0 := v_0.Args[0]
15716 if v_0_0.Op != OpSelect0 {
15717 break
15718 }
15719 v_0_0_0 := v_0_0.Args[0]
15720 if v_0_0_0.Op != OpS390XSUBE {
15721 break
15722 }
15723 borrow := v_0_0_0.Args[2]
15724 v_0_0_0_0 := v_0_0_0.Args[0]
15725 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15726 break
15727 }
15728 v_0_0_0_1 := v_0_0_0.Args[1]
15729 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal {
15730 break
15731 }
15732 b.resetWithControl(BlockS390XBRC, borrow)
15733 b.Aux = s390xCCMaskToAux(s390x.Borrow)
15734 return true
15735 }
15736 // match: (CGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
15737 // result: (BRC {s390x.Borrow} borrow)
15738 for b.Controls[0].Op == OpS390XNEG {
15739 v_0 := b.Controls[0]
15740 v_0_0 := v_0.Args[0]
15741 if v_0_0.Op != OpSelect0 {
15742 break
15743 }
15744 v_0_0_0 := v_0_0.Args[0]
15745 if v_0_0_0.Op != OpS390XSUBE {
15746 break
15747 }
15748 borrow := v_0_0_0.Args[2]
15749 v_0_0_0_0 := v_0_0_0.Args[0]
15750 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15751 break
15752 }
15753 v_0_0_0_1 := v_0_0_0.Args[1]
15754 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
15755 break
15756 }
15757 b.resetWithControl(BlockS390XBRC, borrow)
15758 b.Aux = s390xCCMaskToAux(s390x.Borrow)
15759 return true
15760 }
15761 // match: (CGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1])
15762 // result: (BRC {s390x.NoBorrow} borrow)
15763 for b.Controls[0].Op == OpS390XNEG {
15764 v_0 := b.Controls[0]
15765 v_0_0 := v_0.Args[0]
15766 if v_0_0.Op != OpSelect0 {
15767 break
15768 }
15769 v_0_0_0 := v_0_0.Args[0]
15770 if v_0_0_0.Op != OpS390XSUBE {
15771 break
15772 }
15773 borrow := v_0_0_0.Args[2]
15774 v_0_0_0_0 := v_0_0_0.Args[0]
15775 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15776 break
15777 }
15778 v_0_0_0_1 := v_0_0_0.Args[1]
15779 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
15780 break
15781 }
15782 b.resetWithControl(BlockS390XBRC, borrow)
15783 b.Aux = s390xCCMaskToAux(s390x.NoBorrow)
15784 return true
15785 }
15786 // match: (CGIJ {s390x.Greater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
15787 // result: (BRC {s390x.Borrow} borrow)
15788 for b.Controls[0].Op == OpS390XNEG {
15789 v_0 := b.Controls[0]
15790 v_0_0 := v_0.Args[0]
15791 if v_0_0.Op != OpSelect0 {
15792 break
15793 }
15794 v_0_0_0 := v_0_0.Args[0]
15795 if v_0_0_0.Op != OpS390XSUBE {
15796 break
15797 }
15798 borrow := v_0_0_0.Args[2]
15799 v_0_0_0_0 := v_0_0_0.Args[0]
15800 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15801 break
15802 }
15803 v_0_0_0_1 := v_0_0_0.Args[1]
15804 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater {
15805 break
15806 }
15807 b.resetWithControl(BlockS390XBRC, borrow)
15808 b.Aux = s390xCCMaskToAux(s390x.Borrow)
15809 return true
15810 }
15811 case BlockS390XCGRJ:
15812 // match: (CGRJ {c} x (MOVDconst [y]) yes no)
15813 // cond: is8Bit(y)
15814 // result: (CGIJ {c} x [ int8(y)] yes no)
15815 for b.Controls[1].Op == OpS390XMOVDconst {
15816 x := b.Controls[0]
15817 v_1 := b.Controls[1]
15818 y := auxIntToInt64(v_1.AuxInt)
15819 c := auxToS390xCCMask(b.Aux)
15820 if !(is8Bit(y)) {
15821 break
15822 }
15823 b.resetWithControl(BlockS390XCGIJ, x)
15824 b.AuxInt = int8ToAuxInt(int8(y))
15825 b.Aux = s390xCCMaskToAux(c)
15826 return true
15827 }
15828 // match: (CGRJ {c} (MOVDconst [x]) y yes no)
15829 // cond: is8Bit(x)
15830 // result: (CGIJ {c.ReverseComparison()} y [ int8(x)] yes no)
15831 for b.Controls[0].Op == OpS390XMOVDconst {
15832 v_0 := b.Controls[0]
15833 x := auxIntToInt64(v_0.AuxInt)
15834 y := b.Controls[1]
15835 c := auxToS390xCCMask(b.Aux)
15836 if !(is8Bit(x)) {
15837 break
15838 }
15839 b.resetWithControl(BlockS390XCGIJ, y)
15840 b.AuxInt = int8ToAuxInt(int8(x))
15841 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
15842 return true
15843 }
15844 // match: (CGRJ {c} x (MOVDconst [y]) yes no)
15845 // cond: !is8Bit(y) && is32Bit(y)
15846 // result: (BRC {c} (CMPconst x [int32(y)]) yes no)
15847 for b.Controls[1].Op == OpS390XMOVDconst {
15848 x := b.Controls[0]
15849 v_1 := b.Controls[1]
15850 y := auxIntToInt64(v_1.AuxInt)
15851 c := auxToS390xCCMask(b.Aux)
15852 if !(!is8Bit(y) && is32Bit(y)) {
15853 break
15854 }
15855 v0 := b.NewValue0(x.Pos, OpS390XCMPconst, types.TypeFlags)
15856 v0.AuxInt = int32ToAuxInt(int32(y))
15857 v0.AddArg(x)
15858 b.resetWithControl(BlockS390XBRC, v0)
15859 b.Aux = s390xCCMaskToAux(c)
15860 return true
15861 }
15862 // match: (CGRJ {c} (MOVDconst [x]) y yes no)
15863 // cond: !is8Bit(x) && is32Bit(x)
15864 // result: (BRC {c.ReverseComparison()} (CMPconst y [int32(x)]) yes no)
15865 for b.Controls[0].Op == OpS390XMOVDconst {
15866 v_0 := b.Controls[0]
15867 x := auxIntToInt64(v_0.AuxInt)
15868 y := b.Controls[1]
15869 c := auxToS390xCCMask(b.Aux)
15870 if !(!is8Bit(x) && is32Bit(x)) {
15871 break
15872 }
15873 v0 := b.NewValue0(v_0.Pos, OpS390XCMPconst, types.TypeFlags)
15874 v0.AuxInt = int32ToAuxInt(int32(x))
15875 v0.AddArg(y)
15876 b.resetWithControl(BlockS390XBRC, v0)
15877 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
15878 return true
15879 }
15880 // match: (CGRJ {c} x y yes no)
15881 // cond: x == y && c&s390x.Equal != 0
15882 // result: (First yes no)
15883 for {
15884 x := b.Controls[0]
15885 y := b.Controls[1]
15886 c := auxToS390xCCMask(b.Aux)
15887 if !(x == y && c&s390x.Equal != 0) {
15888 break
15889 }
15890 b.Reset(BlockFirst)
15891 return true
15892 }
15893 // match: (CGRJ {c} x y yes no)
15894 // cond: x == y && c&s390x.Equal == 0
15895 // result: (First no yes)
15896 for {
15897 x := b.Controls[0]
15898 y := b.Controls[1]
15899 c := auxToS390xCCMask(b.Aux)
15900 if !(x == y && c&s390x.Equal == 0) {
15901 break
15902 }
15903 b.Reset(BlockFirst)
15904 b.swapSuccessors()
15905 return true
15906 }
15907 case BlockS390XCIJ:
15908 // match: (CIJ {c} (MOVWreg x) [y] yes no)
15909 // result: (CIJ {c} x [y] yes no)
15910 for b.Controls[0].Op == OpS390XMOVWreg {
15911 v_0 := b.Controls[0]
15912 x := v_0.Args[0]
15913 y := auxIntToInt8(b.AuxInt)
15914 c := auxToS390xCCMask(b.Aux)
15915 b.resetWithControl(BlockS390XCIJ, x)
15916 b.AuxInt = int8ToAuxInt(y)
15917 b.Aux = s390xCCMaskToAux(c)
15918 return true
15919 }
15920 // match: (CIJ {c} (MOVWZreg x) [y] yes no)
15921 // result: (CIJ {c} x [y] yes no)
15922 for b.Controls[0].Op == OpS390XMOVWZreg {
15923 v_0 := b.Controls[0]
15924 x := v_0.Args[0]
15925 y := auxIntToInt8(b.AuxInt)
15926 c := auxToS390xCCMask(b.Aux)
15927 b.resetWithControl(BlockS390XCIJ, x)
15928 b.AuxInt = int8ToAuxInt(y)
15929 b.Aux = s390xCCMaskToAux(c)
15930 return true
15931 }
15932 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15933 // cond: c&s390x.Equal != 0 && int32(x) == int32(y)
15934 // result: (First yes no)
15935 for b.Controls[0].Op == OpS390XMOVDconst {
15936 v_0 := b.Controls[0]
15937 x := auxIntToInt64(v_0.AuxInt)
15938 y := auxIntToInt8(b.AuxInt)
15939 c := auxToS390xCCMask(b.Aux)
15940 if !(c&s390x.Equal != 0 && int32(x) == int32(y)) {
15941 break
15942 }
15943 b.Reset(BlockFirst)
15944 return true
15945 }
15946 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15947 // cond: c&s390x.Less != 0 && int32(x) < int32(y)
15948 // result: (First yes no)
15949 for b.Controls[0].Op == OpS390XMOVDconst {
15950 v_0 := b.Controls[0]
15951 x := auxIntToInt64(v_0.AuxInt)
15952 y := auxIntToInt8(b.AuxInt)
15953 c := auxToS390xCCMask(b.Aux)
15954 if !(c&s390x.Less != 0 && int32(x) < int32(y)) {
15955 break
15956 }
15957 b.Reset(BlockFirst)
15958 return true
15959 }
15960 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15961 // cond: c&s390x.Greater != 0 && int32(x) > int32(y)
15962 // result: (First yes no)
15963 for b.Controls[0].Op == OpS390XMOVDconst {
15964 v_0 := b.Controls[0]
15965 x := auxIntToInt64(v_0.AuxInt)
15966 y := auxIntToInt8(b.AuxInt)
15967 c := auxToS390xCCMask(b.Aux)
15968 if !(c&s390x.Greater != 0 && int32(x) > int32(y)) {
15969 break
15970 }
15971 b.Reset(BlockFirst)
15972 return true
15973 }
15974 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15975 // cond: c&s390x.Equal == 0 && int32(x) == int32(y)
15976 // result: (First no yes)
15977 for b.Controls[0].Op == OpS390XMOVDconst {
15978 v_0 := b.Controls[0]
15979 x := auxIntToInt64(v_0.AuxInt)
15980 y := auxIntToInt8(b.AuxInt)
15981 c := auxToS390xCCMask(b.Aux)
15982 if !(c&s390x.Equal == 0 && int32(x) == int32(y)) {
15983 break
15984 }
15985 b.Reset(BlockFirst)
15986 b.swapSuccessors()
15987 return true
15988 }
15989 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15990 // cond: c&s390x.Less == 0 && int32(x) < int32(y)
15991 // result: (First no yes)
15992 for b.Controls[0].Op == OpS390XMOVDconst {
15993 v_0 := b.Controls[0]
15994 x := auxIntToInt64(v_0.AuxInt)
15995 y := auxIntToInt8(b.AuxInt)
15996 c := auxToS390xCCMask(b.Aux)
15997 if !(c&s390x.Less == 0 && int32(x) < int32(y)) {
15998 break
15999 }
16000 b.Reset(BlockFirst)
16001 b.swapSuccessors()
16002 return true
16003 }
16004 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
16005 // cond: c&s390x.Greater == 0 && int32(x) > int32(y)
16006 // result: (First no yes)
16007 for b.Controls[0].Op == OpS390XMOVDconst {
16008 v_0 := b.Controls[0]
16009 x := auxIntToInt64(v_0.AuxInt)
16010 y := auxIntToInt8(b.AuxInt)
16011 c := auxToS390xCCMask(b.Aux)
16012 if !(c&s390x.Greater == 0 && int32(x) > int32(y)) {
16013 break
16014 }
16015 b.Reset(BlockFirst)
16016 b.swapSuccessors()
16017 return true
16018 }
16019 case BlockS390XCLGIJ:
16020 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16021 // cond: c&s390x.Equal != 0 && uint64(x) == uint64(y)
16022 // result: (First yes no)
16023 for b.Controls[0].Op == OpS390XMOVDconst {
16024 v_0 := b.Controls[0]
16025 x := auxIntToInt64(v_0.AuxInt)
16026 y := auxIntToUint8(b.AuxInt)
16027 c := auxToS390xCCMask(b.Aux)
16028 if !(c&s390x.Equal != 0 && uint64(x) == uint64(y)) {
16029 break
16030 }
16031 b.Reset(BlockFirst)
16032 return true
16033 }
16034 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16035 // cond: c&s390x.Less != 0 && uint64(x) < uint64(y)
16036 // result: (First yes no)
16037 for b.Controls[0].Op == OpS390XMOVDconst {
16038 v_0 := b.Controls[0]
16039 x := auxIntToInt64(v_0.AuxInt)
16040 y := auxIntToUint8(b.AuxInt)
16041 c := auxToS390xCCMask(b.Aux)
16042 if !(c&s390x.Less != 0 && uint64(x) < uint64(y)) {
16043 break
16044 }
16045 b.Reset(BlockFirst)
16046 return true
16047 }
16048 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16049 // cond: c&s390x.Greater != 0 && uint64(x) > uint64(y)
16050 // result: (First yes no)
16051 for b.Controls[0].Op == OpS390XMOVDconst {
16052 v_0 := b.Controls[0]
16053 x := auxIntToInt64(v_0.AuxInt)
16054 y := auxIntToUint8(b.AuxInt)
16055 c := auxToS390xCCMask(b.Aux)
16056 if !(c&s390x.Greater != 0 && uint64(x) > uint64(y)) {
16057 break
16058 }
16059 b.Reset(BlockFirst)
16060 return true
16061 }
16062 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16063 // cond: c&s390x.Equal == 0 && uint64(x) == uint64(y)
16064 // result: (First no yes)
16065 for b.Controls[0].Op == OpS390XMOVDconst {
16066 v_0 := b.Controls[0]
16067 x := auxIntToInt64(v_0.AuxInt)
16068 y := auxIntToUint8(b.AuxInt)
16069 c := auxToS390xCCMask(b.Aux)
16070 if !(c&s390x.Equal == 0 && uint64(x) == uint64(y)) {
16071 break
16072 }
16073 b.Reset(BlockFirst)
16074 b.swapSuccessors()
16075 return true
16076 }
16077 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16078 // cond: c&s390x.Less == 0 && uint64(x) < uint64(y)
16079 // result: (First no yes)
16080 for b.Controls[0].Op == OpS390XMOVDconst {
16081 v_0 := b.Controls[0]
16082 x := auxIntToInt64(v_0.AuxInt)
16083 y := auxIntToUint8(b.AuxInt)
16084 c := auxToS390xCCMask(b.Aux)
16085 if !(c&s390x.Less == 0 && uint64(x) < uint64(y)) {
16086 break
16087 }
16088 b.Reset(BlockFirst)
16089 b.swapSuccessors()
16090 return true
16091 }
16092 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16093 // cond: c&s390x.Greater == 0 && uint64(x) > uint64(y)
16094 // result: (First no yes)
16095 for b.Controls[0].Op == OpS390XMOVDconst {
16096 v_0 := b.Controls[0]
16097 x := auxIntToInt64(v_0.AuxInt)
16098 y := auxIntToUint8(b.AuxInt)
16099 c := auxToS390xCCMask(b.Aux)
16100 if !(c&s390x.Greater == 0 && uint64(x) > uint64(y)) {
16101 break
16102 }
16103 b.Reset(BlockFirst)
16104 b.swapSuccessors()
16105 return true
16106 }
16107 // match: (CLGIJ {s390x.GreaterOrEqual} _ [0] yes no)
16108 // result: (First yes no)
16109 for {
16110 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
16111 break
16112 }
16113 b.Reset(BlockFirst)
16114 return true
16115 }
16116 // match: (CLGIJ {s390x.Less} _ [0] yes no)
16117 // result: (First no yes)
16118 for {
16119 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Less {
16120 break
16121 }
16122 b.Reset(BlockFirst)
16123 b.swapSuccessors()
16124 return true
16125 }
16126 // match: (CLGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
16127 // result: (BRC {s390x.NoCarry} carry)
16128 for b.Controls[0].Op == OpSelect0 {
16129 v_0 := b.Controls[0]
16130 v_0_0 := v_0.Args[0]
16131 if v_0_0.Op != OpS390XADDE {
16132 break
16133 }
16134 carry := v_0_0.Args[2]
16135 v_0_0_0 := v_0_0.Args[0]
16136 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16137 break
16138 }
16139 v_0_0_1 := v_0_0.Args[1]
16140 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal {
16141 break
16142 }
16143 b.resetWithControl(BlockS390XBRC, carry)
16144 b.Aux = s390xCCMaskToAux(s390x.NoCarry)
16145 return true
16146 }
16147 // match: (CLGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1])
16148 // result: (BRC {s390x.Carry} carry)
16149 for b.Controls[0].Op == OpSelect0 {
16150 v_0 := b.Controls[0]
16151 v_0_0 := v_0.Args[0]
16152 if v_0_0.Op != OpS390XADDE {
16153 break
16154 }
16155 carry := v_0_0.Args[2]
16156 v_0_0_0 := v_0_0.Args[0]
16157 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16158 break
16159 }
16160 v_0_0_1 := v_0_0.Args[1]
16161 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal {
16162 break
16163 }
16164 b.resetWithControl(BlockS390XBRC, carry)
16165 b.Aux = s390xCCMaskToAux(s390x.Carry)
16166 return true
16167 }
16168 // match: (CLGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
16169 // result: (BRC {s390x.Carry} carry)
16170 for b.Controls[0].Op == OpSelect0 {
16171 v_0 := b.Controls[0]
16172 v_0_0 := v_0.Args[0]
16173 if v_0_0.Op != OpS390XADDE {
16174 break
16175 }
16176 carry := v_0_0.Args[2]
16177 v_0_0_0 := v_0_0.Args[0]
16178 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16179 break
16180 }
16181 v_0_0_1 := v_0_0.Args[1]
16182 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
16183 break
16184 }
16185 b.resetWithControl(BlockS390XBRC, carry)
16186 b.Aux = s390xCCMaskToAux(s390x.Carry)
16187 return true
16188 }
16189 // match: (CLGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1])
16190 // result: (BRC {s390x.NoCarry} carry)
16191 for b.Controls[0].Op == OpSelect0 {
16192 v_0 := b.Controls[0]
16193 v_0_0 := v_0.Args[0]
16194 if v_0_0.Op != OpS390XADDE {
16195 break
16196 }
16197 carry := v_0_0.Args[2]
16198 v_0_0_0 := v_0_0.Args[0]
16199 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16200 break
16201 }
16202 v_0_0_1 := v_0_0.Args[1]
16203 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
16204 break
16205 }
16206 b.resetWithControl(BlockS390XBRC, carry)
16207 b.Aux = s390xCCMaskToAux(s390x.NoCarry)
16208 return true
16209 }
16210 // match: (CLGIJ {s390x.Greater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
16211 // result: (BRC {s390x.Carry} carry)
16212 for b.Controls[0].Op == OpSelect0 {
16213 v_0 := b.Controls[0]
16214 v_0_0 := v_0.Args[0]
16215 if v_0_0.Op != OpS390XADDE {
16216 break
16217 }
16218 carry := v_0_0.Args[2]
16219 v_0_0_0 := v_0_0.Args[0]
16220 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16221 break
16222 }
16223 v_0_0_1 := v_0_0.Args[1]
16224 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater {
16225 break
16226 }
16227 b.resetWithControl(BlockS390XBRC, carry)
16228 b.Aux = s390xCCMaskToAux(s390x.Carry)
16229 return true
16230 }
16231 // match: (CLGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
16232 // result: (BRC {s390x.NoBorrow} borrow)
16233 for b.Controls[0].Op == OpS390XNEG {
16234 v_0 := b.Controls[0]
16235 v_0_0 := v_0.Args[0]
16236 if v_0_0.Op != OpSelect0 {
16237 break
16238 }
16239 v_0_0_0 := v_0_0.Args[0]
16240 if v_0_0_0.Op != OpS390XSUBE {
16241 break
16242 }
16243 borrow := v_0_0_0.Args[2]
16244 v_0_0_0_0 := v_0_0_0.Args[0]
16245 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16246 break
16247 }
16248 v_0_0_0_1 := v_0_0_0.Args[1]
16249 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal {
16250 break
16251 }
16252 b.resetWithControl(BlockS390XBRC, borrow)
16253 b.Aux = s390xCCMaskToAux(s390x.NoBorrow)
16254 return true
16255 }
16256 // match: (CLGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1])
16257 // result: (BRC {s390x.Borrow} borrow)
16258 for b.Controls[0].Op == OpS390XNEG {
16259 v_0 := b.Controls[0]
16260 v_0_0 := v_0.Args[0]
16261 if v_0_0.Op != OpSelect0 {
16262 break
16263 }
16264 v_0_0_0 := v_0_0.Args[0]
16265 if v_0_0_0.Op != OpS390XSUBE {
16266 break
16267 }
16268 borrow := v_0_0_0.Args[2]
16269 v_0_0_0_0 := v_0_0_0.Args[0]
16270 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16271 break
16272 }
16273 v_0_0_0_1 := v_0_0_0.Args[1]
16274 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal {
16275 break
16276 }
16277 b.resetWithControl(BlockS390XBRC, borrow)
16278 b.Aux = s390xCCMaskToAux(s390x.Borrow)
16279 return true
16280 }
16281 // match: (CLGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
16282 // result: (BRC {s390x.Borrow} borrow)
16283 for b.Controls[0].Op == OpS390XNEG {
16284 v_0 := b.Controls[0]
16285 v_0_0 := v_0.Args[0]
16286 if v_0_0.Op != OpSelect0 {
16287 break
16288 }
16289 v_0_0_0 := v_0_0.Args[0]
16290 if v_0_0_0.Op != OpS390XSUBE {
16291 break
16292 }
16293 borrow := v_0_0_0.Args[2]
16294 v_0_0_0_0 := v_0_0_0.Args[0]
16295 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16296 break
16297 }
16298 v_0_0_0_1 := v_0_0_0.Args[1]
16299 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
16300 break
16301 }
16302 b.resetWithControl(BlockS390XBRC, borrow)
16303 b.Aux = s390xCCMaskToAux(s390x.Borrow)
16304 return true
16305 }
16306 // match: (CLGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1])
16307 // result: (BRC {s390x.NoBorrow} borrow)
16308 for b.Controls[0].Op == OpS390XNEG {
16309 v_0 := b.Controls[0]
16310 v_0_0 := v_0.Args[0]
16311 if v_0_0.Op != OpSelect0 {
16312 break
16313 }
16314 v_0_0_0 := v_0_0.Args[0]
16315 if v_0_0_0.Op != OpS390XSUBE {
16316 break
16317 }
16318 borrow := v_0_0_0.Args[2]
16319 v_0_0_0_0 := v_0_0_0.Args[0]
16320 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16321 break
16322 }
16323 v_0_0_0_1 := v_0_0_0.Args[1]
16324 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
16325 break
16326 }
16327 b.resetWithControl(BlockS390XBRC, borrow)
16328 b.Aux = s390xCCMaskToAux(s390x.NoBorrow)
16329 return true
16330 }
16331 // match: (CLGIJ {s390x.Greater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
16332 // result: (BRC {s390x.Borrow} borrow)
16333 for b.Controls[0].Op == OpS390XNEG {
16334 v_0 := b.Controls[0]
16335 v_0_0 := v_0.Args[0]
16336 if v_0_0.Op != OpSelect0 {
16337 break
16338 }
16339 v_0_0_0 := v_0_0.Args[0]
16340 if v_0_0_0.Op != OpS390XSUBE {
16341 break
16342 }
16343 borrow := v_0_0_0.Args[2]
16344 v_0_0_0_0 := v_0_0_0.Args[0]
16345 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16346 break
16347 }
16348 v_0_0_0_1 := v_0_0_0.Args[1]
16349 if v_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater {
16350 break
16351 }
16352 b.resetWithControl(BlockS390XBRC, borrow)
16353 b.Aux = s390xCCMaskToAux(s390x.Borrow)
16354 return true
16355 }
16356 case BlockS390XCLGRJ:
16357 // match: (CLGRJ {c} x (MOVDconst [y]) yes no)
16358 // cond: isU8Bit(y)
16359 // result: (CLGIJ {c} x [uint8(y)] yes no)
16360 for b.Controls[1].Op == OpS390XMOVDconst {
16361 x := b.Controls[0]
16362 v_1 := b.Controls[1]
16363 y := auxIntToInt64(v_1.AuxInt)
16364 c := auxToS390xCCMask(b.Aux)
16365 if !(isU8Bit(y)) {
16366 break
16367 }
16368 b.resetWithControl(BlockS390XCLGIJ, x)
16369 b.AuxInt = uint8ToAuxInt(uint8(y))
16370 b.Aux = s390xCCMaskToAux(c)
16371 return true
16372 }
16373 // match: (CLGRJ {c} (MOVDconst [x]) y yes no)
16374 // cond: isU8Bit(x)
16375 // result: (CLGIJ {c.ReverseComparison()} y [uint8(x)] yes no)
16376 for b.Controls[0].Op == OpS390XMOVDconst {
16377 v_0 := b.Controls[0]
16378 x := auxIntToInt64(v_0.AuxInt)
16379 y := b.Controls[1]
16380 c := auxToS390xCCMask(b.Aux)
16381 if !(isU8Bit(x)) {
16382 break
16383 }
16384 b.resetWithControl(BlockS390XCLGIJ, y)
16385 b.AuxInt = uint8ToAuxInt(uint8(x))
16386 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16387 return true
16388 }
16389 // match: (CLGRJ {c} x (MOVDconst [y]) yes no)
16390 // cond: !isU8Bit(y) && isU32Bit(y)
16391 // result: (BRC {c} (CMPUconst x [int32(y)]) yes no)
16392 for b.Controls[1].Op == OpS390XMOVDconst {
16393 x := b.Controls[0]
16394 v_1 := b.Controls[1]
16395 y := auxIntToInt64(v_1.AuxInt)
16396 c := auxToS390xCCMask(b.Aux)
16397 if !(!isU8Bit(y) && isU32Bit(y)) {
16398 break
16399 }
16400 v0 := b.NewValue0(x.Pos, OpS390XCMPUconst, types.TypeFlags)
16401 v0.AuxInt = int32ToAuxInt(int32(y))
16402 v0.AddArg(x)
16403 b.resetWithControl(BlockS390XBRC, v0)
16404 b.Aux = s390xCCMaskToAux(c)
16405 return true
16406 }
16407 // match: (CLGRJ {c} (MOVDconst [x]) y yes no)
16408 // cond: !isU8Bit(x) && isU32Bit(x)
16409 // result: (BRC {c.ReverseComparison()} (CMPUconst y [int32(x)]) yes no)
16410 for b.Controls[0].Op == OpS390XMOVDconst {
16411 v_0 := b.Controls[0]
16412 x := auxIntToInt64(v_0.AuxInt)
16413 y := b.Controls[1]
16414 c := auxToS390xCCMask(b.Aux)
16415 if !(!isU8Bit(x) && isU32Bit(x)) {
16416 break
16417 }
16418 v0 := b.NewValue0(v_0.Pos, OpS390XCMPUconst, types.TypeFlags)
16419 v0.AuxInt = int32ToAuxInt(int32(x))
16420 v0.AddArg(y)
16421 b.resetWithControl(BlockS390XBRC, v0)
16422 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16423 return true
16424 }
16425 // match: (CLGRJ {c} x y yes no)
16426 // cond: x == y && c&s390x.Equal != 0
16427 // result: (First yes no)
16428 for {
16429 x := b.Controls[0]
16430 y := b.Controls[1]
16431 c := auxToS390xCCMask(b.Aux)
16432 if !(x == y && c&s390x.Equal != 0) {
16433 break
16434 }
16435 b.Reset(BlockFirst)
16436 return true
16437 }
16438 // match: (CLGRJ {c} x y yes no)
16439 // cond: x == y && c&s390x.Equal == 0
16440 // result: (First no yes)
16441 for {
16442 x := b.Controls[0]
16443 y := b.Controls[1]
16444 c := auxToS390xCCMask(b.Aux)
16445 if !(x == y && c&s390x.Equal == 0) {
16446 break
16447 }
16448 b.Reset(BlockFirst)
16449 b.swapSuccessors()
16450 return true
16451 }
16452 case BlockS390XCLIJ:
16453 // match: (CLIJ {s390x.LessOrGreater} (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp) [0] yes no)
16454 // cond: int32(x) != 0
16455 // result: (BRC {d} cmp yes no)
16456 for b.Controls[0].Op == OpS390XLOCGR {
16457 v_0 := b.Controls[0]
16458 d := auxToS390xCCMask(v_0.Aux)
16459 cmp := v_0.Args[2]
16460 v_0_0 := v_0.Args[0]
16461 if v_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0.AuxInt) != 0 {
16462 break
16463 }
16464 v_0_1 := v_0.Args[1]
16465 if v_0_1.Op != OpS390XMOVDconst {
16466 break
16467 }
16468 x := auxIntToInt64(v_0_1.AuxInt)
16469 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater || !(int32(x) != 0) {
16470 break
16471 }
16472 b.resetWithControl(BlockS390XBRC, cmp)
16473 b.Aux = s390xCCMaskToAux(d)
16474 return true
16475 }
16476 // match: (CLIJ {c} (MOVWreg x) [y] yes no)
16477 // result: (CLIJ {c} x [y] yes no)
16478 for b.Controls[0].Op == OpS390XMOVWreg {
16479 v_0 := b.Controls[0]
16480 x := v_0.Args[0]
16481 y := auxIntToUint8(b.AuxInt)
16482 c := auxToS390xCCMask(b.Aux)
16483 b.resetWithControl(BlockS390XCLIJ, x)
16484 b.AuxInt = uint8ToAuxInt(y)
16485 b.Aux = s390xCCMaskToAux(c)
16486 return true
16487 }
16488 // match: (CLIJ {c} (MOVWZreg x) [y] yes no)
16489 // result: (CLIJ {c} x [y] yes no)
16490 for b.Controls[0].Op == OpS390XMOVWZreg {
16491 v_0 := b.Controls[0]
16492 x := v_0.Args[0]
16493 y := auxIntToUint8(b.AuxInt)
16494 c := auxToS390xCCMask(b.Aux)
16495 b.resetWithControl(BlockS390XCLIJ, x)
16496 b.AuxInt = uint8ToAuxInt(y)
16497 b.Aux = s390xCCMaskToAux(c)
16498 return true
16499 }
16500 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16501 // cond: c&s390x.Equal != 0 && uint32(x) == uint32(y)
16502 // result: (First yes no)
16503 for b.Controls[0].Op == OpS390XMOVDconst {
16504 v_0 := b.Controls[0]
16505 x := auxIntToInt64(v_0.AuxInt)
16506 y := auxIntToUint8(b.AuxInt)
16507 c := auxToS390xCCMask(b.Aux)
16508 if !(c&s390x.Equal != 0 && uint32(x) == uint32(y)) {
16509 break
16510 }
16511 b.Reset(BlockFirst)
16512 return true
16513 }
16514 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16515 // cond: c&s390x.Less != 0 && uint32(x) < uint32(y)
16516 // result: (First yes no)
16517 for b.Controls[0].Op == OpS390XMOVDconst {
16518 v_0 := b.Controls[0]
16519 x := auxIntToInt64(v_0.AuxInt)
16520 y := auxIntToUint8(b.AuxInt)
16521 c := auxToS390xCCMask(b.Aux)
16522 if !(c&s390x.Less != 0 && uint32(x) < uint32(y)) {
16523 break
16524 }
16525 b.Reset(BlockFirst)
16526 return true
16527 }
16528 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16529 // cond: c&s390x.Greater != 0 && uint32(x) > uint32(y)
16530 // result: (First yes no)
16531 for b.Controls[0].Op == OpS390XMOVDconst {
16532 v_0 := b.Controls[0]
16533 x := auxIntToInt64(v_0.AuxInt)
16534 y := auxIntToUint8(b.AuxInt)
16535 c := auxToS390xCCMask(b.Aux)
16536 if !(c&s390x.Greater != 0 && uint32(x) > uint32(y)) {
16537 break
16538 }
16539 b.Reset(BlockFirst)
16540 return true
16541 }
16542 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16543 // cond: c&s390x.Equal == 0 && uint32(x) == uint32(y)
16544 // result: (First no yes)
16545 for b.Controls[0].Op == OpS390XMOVDconst {
16546 v_0 := b.Controls[0]
16547 x := auxIntToInt64(v_0.AuxInt)
16548 y := auxIntToUint8(b.AuxInt)
16549 c := auxToS390xCCMask(b.Aux)
16550 if !(c&s390x.Equal == 0 && uint32(x) == uint32(y)) {
16551 break
16552 }
16553 b.Reset(BlockFirst)
16554 b.swapSuccessors()
16555 return true
16556 }
16557 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16558 // cond: c&s390x.Less == 0 && uint32(x) < uint32(y)
16559 // result: (First no yes)
16560 for b.Controls[0].Op == OpS390XMOVDconst {
16561 v_0 := b.Controls[0]
16562 x := auxIntToInt64(v_0.AuxInt)
16563 y := auxIntToUint8(b.AuxInt)
16564 c := auxToS390xCCMask(b.Aux)
16565 if !(c&s390x.Less == 0 && uint32(x) < uint32(y)) {
16566 break
16567 }
16568 b.Reset(BlockFirst)
16569 b.swapSuccessors()
16570 return true
16571 }
16572 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16573 // cond: c&s390x.Greater == 0 && uint32(x) > uint32(y)
16574 // result: (First no yes)
16575 for b.Controls[0].Op == OpS390XMOVDconst {
16576 v_0 := b.Controls[0]
16577 x := auxIntToInt64(v_0.AuxInt)
16578 y := auxIntToUint8(b.AuxInt)
16579 c := auxToS390xCCMask(b.Aux)
16580 if !(c&s390x.Greater == 0 && uint32(x) > uint32(y)) {
16581 break
16582 }
16583 b.Reset(BlockFirst)
16584 b.swapSuccessors()
16585 return true
16586 }
16587 // match: (CLIJ {s390x.GreaterOrEqual} _ [0] yes no)
16588 // result: (First yes no)
16589 for {
16590 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
16591 break
16592 }
16593 b.Reset(BlockFirst)
16594 return true
16595 }
16596 // match: (CLIJ {s390x.Less} _ [0] yes no)
16597 // result: (First no yes)
16598 for {
16599 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Less {
16600 break
16601 }
16602 b.Reset(BlockFirst)
16603 b.swapSuccessors()
16604 return true
16605 }
16606 case BlockS390XCLRJ:
16607 // match: (CLRJ {c} x (MOVDconst [y]) yes no)
16608 // cond: isU8Bit(y)
16609 // result: (CLIJ {c} x [uint8(y)] yes no)
16610 for b.Controls[1].Op == OpS390XMOVDconst {
16611 x := b.Controls[0]
16612 v_1 := b.Controls[1]
16613 y := auxIntToInt64(v_1.AuxInt)
16614 c := auxToS390xCCMask(b.Aux)
16615 if !(isU8Bit(y)) {
16616 break
16617 }
16618 b.resetWithControl(BlockS390XCLIJ, x)
16619 b.AuxInt = uint8ToAuxInt(uint8(y))
16620 b.Aux = s390xCCMaskToAux(c)
16621 return true
16622 }
16623 // match: (CLRJ {c} (MOVDconst [x]) y yes no)
16624 // cond: isU8Bit(x)
16625 // result: (CLIJ {c.ReverseComparison()} y [uint8(x)] yes no)
16626 for b.Controls[0].Op == OpS390XMOVDconst {
16627 v_0 := b.Controls[0]
16628 x := auxIntToInt64(v_0.AuxInt)
16629 y := b.Controls[1]
16630 c := auxToS390xCCMask(b.Aux)
16631 if !(isU8Bit(x)) {
16632 break
16633 }
16634 b.resetWithControl(BlockS390XCLIJ, y)
16635 b.AuxInt = uint8ToAuxInt(uint8(x))
16636 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16637 return true
16638 }
16639 // match: (CLRJ {c} x (MOVDconst [y]) yes no)
16640 // cond: !isU8Bit(y) && isU32Bit(y)
16641 // result: (BRC {c} (CMPWUconst x [int32(y)]) yes no)
16642 for b.Controls[1].Op == OpS390XMOVDconst {
16643 x := b.Controls[0]
16644 v_1 := b.Controls[1]
16645 y := auxIntToInt64(v_1.AuxInt)
16646 c := auxToS390xCCMask(b.Aux)
16647 if !(!isU8Bit(y) && isU32Bit(y)) {
16648 break
16649 }
16650 v0 := b.NewValue0(x.Pos, OpS390XCMPWUconst, types.TypeFlags)
16651 v0.AuxInt = int32ToAuxInt(int32(y))
16652 v0.AddArg(x)
16653 b.resetWithControl(BlockS390XBRC, v0)
16654 b.Aux = s390xCCMaskToAux(c)
16655 return true
16656 }
16657 // match: (CLRJ {c} (MOVDconst [x]) y yes no)
16658 // cond: !isU8Bit(x) && isU32Bit(x)
16659 // result: (BRC {c.ReverseComparison()} (CMPWUconst y [int32(x)]) yes no)
16660 for b.Controls[0].Op == OpS390XMOVDconst {
16661 v_0 := b.Controls[0]
16662 x := auxIntToInt64(v_0.AuxInt)
16663 y := b.Controls[1]
16664 c := auxToS390xCCMask(b.Aux)
16665 if !(!isU8Bit(x) && isU32Bit(x)) {
16666 break
16667 }
16668 v0 := b.NewValue0(v_0.Pos, OpS390XCMPWUconst, types.TypeFlags)
16669 v0.AuxInt = int32ToAuxInt(int32(x))
16670 v0.AddArg(y)
16671 b.resetWithControl(BlockS390XBRC, v0)
16672 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16673 return true
16674 }
16675 // match: (CLRJ {c} x y yes no)
16676 // cond: x == y && c&s390x.Equal != 0
16677 // result: (First yes no)
16678 for {
16679 x := b.Controls[0]
16680 y := b.Controls[1]
16681 c := auxToS390xCCMask(b.Aux)
16682 if !(x == y && c&s390x.Equal != 0) {
16683 break
16684 }
16685 b.Reset(BlockFirst)
16686 return true
16687 }
16688 // match: (CLRJ {c} x y yes no)
16689 // cond: x == y && c&s390x.Equal == 0
16690 // result: (First no yes)
16691 for {
16692 x := b.Controls[0]
16693 y := b.Controls[1]
16694 c := auxToS390xCCMask(b.Aux)
16695 if !(x == y && c&s390x.Equal == 0) {
16696 break
16697 }
16698 b.Reset(BlockFirst)
16699 b.swapSuccessors()
16700 return true
16701 }
16702 case BlockS390XCRJ:
16703 // match: (CRJ {c} x (MOVDconst [y]) yes no)
16704 // cond: is8Bit(y)
16705 // result: (CIJ {c} x [ int8(y)] yes no)
16706 for b.Controls[1].Op == OpS390XMOVDconst {
16707 x := b.Controls[0]
16708 v_1 := b.Controls[1]
16709 y := auxIntToInt64(v_1.AuxInt)
16710 c := auxToS390xCCMask(b.Aux)
16711 if !(is8Bit(y)) {
16712 break
16713 }
16714 b.resetWithControl(BlockS390XCIJ, x)
16715 b.AuxInt = int8ToAuxInt(int8(y))
16716 b.Aux = s390xCCMaskToAux(c)
16717 return true
16718 }
16719 // match: (CRJ {c} (MOVDconst [x]) y yes no)
16720 // cond: is8Bit(x)
16721 // result: (CIJ {c.ReverseComparison()} y [ int8(x)] yes no)
16722 for b.Controls[0].Op == OpS390XMOVDconst {
16723 v_0 := b.Controls[0]
16724 x := auxIntToInt64(v_0.AuxInt)
16725 y := b.Controls[1]
16726 c := auxToS390xCCMask(b.Aux)
16727 if !(is8Bit(x)) {
16728 break
16729 }
16730 b.resetWithControl(BlockS390XCIJ, y)
16731 b.AuxInt = int8ToAuxInt(int8(x))
16732 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16733 return true
16734 }
16735 // match: (CRJ {c} x (MOVDconst [y]) yes no)
16736 // cond: !is8Bit(y) && is32Bit(y)
16737 // result: (BRC {c} (CMPWconst x [int32(y)]) yes no)
16738 for b.Controls[1].Op == OpS390XMOVDconst {
16739 x := b.Controls[0]
16740 v_1 := b.Controls[1]
16741 y := auxIntToInt64(v_1.AuxInt)
16742 c := auxToS390xCCMask(b.Aux)
16743 if !(!is8Bit(y) && is32Bit(y)) {
16744 break
16745 }
16746 v0 := b.NewValue0(x.Pos, OpS390XCMPWconst, types.TypeFlags)
16747 v0.AuxInt = int32ToAuxInt(int32(y))
16748 v0.AddArg(x)
16749 b.resetWithControl(BlockS390XBRC, v0)
16750 b.Aux = s390xCCMaskToAux(c)
16751 return true
16752 }
16753 // match: (CRJ {c} (MOVDconst [x]) y yes no)
16754 // cond: !is8Bit(x) && is32Bit(x)
16755 // result: (BRC {c.ReverseComparison()} (CMPWconst y [int32(x)]) yes no)
16756 for b.Controls[0].Op == OpS390XMOVDconst {
16757 v_0 := b.Controls[0]
16758 x := auxIntToInt64(v_0.AuxInt)
16759 y := b.Controls[1]
16760 c := auxToS390xCCMask(b.Aux)
16761 if !(!is8Bit(x) && is32Bit(x)) {
16762 break
16763 }
16764 v0 := b.NewValue0(v_0.Pos, OpS390XCMPWconst, types.TypeFlags)
16765 v0.AuxInt = int32ToAuxInt(int32(x))
16766 v0.AddArg(y)
16767 b.resetWithControl(BlockS390XBRC, v0)
16768 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16769 return true
16770 }
16771 // match: (CRJ {c} x y yes no)
16772 // cond: x == y && c&s390x.Equal != 0
16773 // result: (First yes no)
16774 for {
16775 x := b.Controls[0]
16776 y := b.Controls[1]
16777 c := auxToS390xCCMask(b.Aux)
16778 if !(x == y && c&s390x.Equal != 0) {
16779 break
16780 }
16781 b.Reset(BlockFirst)
16782 return true
16783 }
16784 // match: (CRJ {c} x y yes no)
16785 // cond: x == y && c&s390x.Equal == 0
16786 // result: (First no yes)
16787 for {
16788 x := b.Controls[0]
16789 y := b.Controls[1]
16790 c := auxToS390xCCMask(b.Aux)
16791 if !(x == y && c&s390x.Equal == 0) {
16792 break
16793 }
16794 b.Reset(BlockFirst)
16795 b.swapSuccessors()
16796 return true
16797 }
16798 case BlockIf:
16799 // match: (If cond yes no)
16800 // result: (CLIJ {s390x.LessOrGreater} (MOVBZreg <typ.Bool> cond) [0] yes no)
16801 for {
16802 cond := b.Controls[0]
16803 v0 := b.NewValue0(cond.Pos, OpS390XMOVBZreg, typ.Bool)
16804 v0.AddArg(cond)
16805 b.resetWithControl(BlockS390XCLIJ, v0)
16806 b.AuxInt = uint8ToAuxInt(0)
16807 b.Aux = s390xCCMaskToAux(s390x.LessOrGreater)
16808 return true
16809 }
16810 }
16811 return false
16812 }