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 OpMod16:
372 return rewriteValueS390X_OpMod16(v)
373 case OpMod16u:
374 return rewriteValueS390X_OpMod16u(v)
375 case OpMod32:
376 return rewriteValueS390X_OpMod32(v)
377 case OpMod32u:
378 return rewriteValueS390X_OpMod32u(v)
379 case OpMod64:
380 return rewriteValueS390X_OpMod64(v)
381 case OpMod64u:
382 v.Op = OpS390XMODDU
383 return true
384 case OpMod8:
385 return rewriteValueS390X_OpMod8(v)
386 case OpMod8u:
387 return rewriteValueS390X_OpMod8u(v)
388 case OpMove:
389 return rewriteValueS390X_OpMove(v)
390 case OpMul16:
391 v.Op = OpS390XMULLW
392 return true
393 case OpMul32:
394 v.Op = OpS390XMULLW
395 return true
396 case OpMul32F:
397 v.Op = OpS390XFMULS
398 return true
399 case OpMul64:
400 v.Op = OpS390XMULLD
401 return true
402 case OpMul64F:
403 v.Op = OpS390XFMUL
404 return true
405 case OpMul64uhilo:
406 v.Op = OpS390XMLGR
407 return true
408 case OpMul8:
409 v.Op = OpS390XMULLW
410 return true
411 case OpNeg16:
412 v.Op = OpS390XNEGW
413 return true
414 case OpNeg32:
415 v.Op = OpS390XNEGW
416 return true
417 case OpNeg32F:
418 v.Op = OpS390XFNEGS
419 return true
420 case OpNeg64:
421 v.Op = OpS390XNEG
422 return true
423 case OpNeg64F:
424 v.Op = OpS390XFNEG
425 return true
426 case OpNeg8:
427 v.Op = OpS390XNEGW
428 return true
429 case OpNeq16:
430 return rewriteValueS390X_OpNeq16(v)
431 case OpNeq32:
432 return rewriteValueS390X_OpNeq32(v)
433 case OpNeq32F:
434 return rewriteValueS390X_OpNeq32F(v)
435 case OpNeq64:
436 return rewriteValueS390X_OpNeq64(v)
437 case OpNeq64F:
438 return rewriteValueS390X_OpNeq64F(v)
439 case OpNeq8:
440 return rewriteValueS390X_OpNeq8(v)
441 case OpNeqB:
442 return rewriteValueS390X_OpNeqB(v)
443 case OpNeqPtr:
444 return rewriteValueS390X_OpNeqPtr(v)
445 case OpNilCheck:
446 v.Op = OpS390XLoweredNilCheck
447 return true
448 case OpNot:
449 return rewriteValueS390X_OpNot(v)
450 case OpOffPtr:
451 return rewriteValueS390X_OpOffPtr(v)
452 case OpOr16:
453 v.Op = OpS390XORW
454 return true
455 case OpOr32:
456 v.Op = OpS390XORW
457 return true
458 case OpOr64:
459 v.Op = OpS390XOR
460 return true
461 case OpOr8:
462 v.Op = OpS390XORW
463 return true
464 case OpOrB:
465 v.Op = OpS390XORW
466 return true
467 case OpPanicBounds:
468 return rewriteValueS390X_OpPanicBounds(v)
469 case OpPopCount16:
470 return rewriteValueS390X_OpPopCount16(v)
471 case OpPopCount32:
472 return rewriteValueS390X_OpPopCount32(v)
473 case OpPopCount64:
474 return rewriteValueS390X_OpPopCount64(v)
475 case OpPopCount8:
476 return rewriteValueS390X_OpPopCount8(v)
477 case OpRotateLeft16:
478 return rewriteValueS390X_OpRotateLeft16(v)
479 case OpRotateLeft32:
480 v.Op = OpS390XRLL
481 return true
482 case OpRotateLeft64:
483 v.Op = OpS390XRLLG
484 return true
485 case OpRotateLeft8:
486 return rewriteValueS390X_OpRotateLeft8(v)
487 case OpRound:
488 return rewriteValueS390X_OpRound(v)
489 case OpRound32F:
490 v.Op = OpS390XLoweredRound32F
491 return true
492 case OpRound64F:
493 v.Op = OpS390XLoweredRound64F
494 return true
495 case OpRoundToEven:
496 return rewriteValueS390X_OpRoundToEven(v)
497 case OpRsh16Ux16:
498 return rewriteValueS390X_OpRsh16Ux16(v)
499 case OpRsh16Ux32:
500 return rewriteValueS390X_OpRsh16Ux32(v)
501 case OpRsh16Ux64:
502 return rewriteValueS390X_OpRsh16Ux64(v)
503 case OpRsh16Ux8:
504 return rewriteValueS390X_OpRsh16Ux8(v)
505 case OpRsh16x16:
506 return rewriteValueS390X_OpRsh16x16(v)
507 case OpRsh16x32:
508 return rewriteValueS390X_OpRsh16x32(v)
509 case OpRsh16x64:
510 return rewriteValueS390X_OpRsh16x64(v)
511 case OpRsh16x8:
512 return rewriteValueS390X_OpRsh16x8(v)
513 case OpRsh32Ux16:
514 return rewriteValueS390X_OpRsh32Ux16(v)
515 case OpRsh32Ux32:
516 return rewriteValueS390X_OpRsh32Ux32(v)
517 case OpRsh32Ux64:
518 return rewriteValueS390X_OpRsh32Ux64(v)
519 case OpRsh32Ux8:
520 return rewriteValueS390X_OpRsh32Ux8(v)
521 case OpRsh32x16:
522 return rewriteValueS390X_OpRsh32x16(v)
523 case OpRsh32x32:
524 return rewriteValueS390X_OpRsh32x32(v)
525 case OpRsh32x64:
526 return rewriteValueS390X_OpRsh32x64(v)
527 case OpRsh32x8:
528 return rewriteValueS390X_OpRsh32x8(v)
529 case OpRsh64Ux16:
530 return rewriteValueS390X_OpRsh64Ux16(v)
531 case OpRsh64Ux32:
532 return rewriteValueS390X_OpRsh64Ux32(v)
533 case OpRsh64Ux64:
534 return rewriteValueS390X_OpRsh64Ux64(v)
535 case OpRsh64Ux8:
536 return rewriteValueS390X_OpRsh64Ux8(v)
537 case OpRsh64x16:
538 return rewriteValueS390X_OpRsh64x16(v)
539 case OpRsh64x32:
540 return rewriteValueS390X_OpRsh64x32(v)
541 case OpRsh64x64:
542 return rewriteValueS390X_OpRsh64x64(v)
543 case OpRsh64x8:
544 return rewriteValueS390X_OpRsh64x8(v)
545 case OpRsh8Ux16:
546 return rewriteValueS390X_OpRsh8Ux16(v)
547 case OpRsh8Ux32:
548 return rewriteValueS390X_OpRsh8Ux32(v)
549 case OpRsh8Ux64:
550 return rewriteValueS390X_OpRsh8Ux64(v)
551 case OpRsh8Ux8:
552 return rewriteValueS390X_OpRsh8Ux8(v)
553 case OpRsh8x16:
554 return rewriteValueS390X_OpRsh8x16(v)
555 case OpRsh8x32:
556 return rewriteValueS390X_OpRsh8x32(v)
557 case OpRsh8x64:
558 return rewriteValueS390X_OpRsh8x64(v)
559 case OpRsh8x8:
560 return rewriteValueS390X_OpRsh8x8(v)
561 case OpS390XADD:
562 return rewriteValueS390X_OpS390XADD(v)
563 case OpS390XADDC:
564 return rewriteValueS390X_OpS390XADDC(v)
565 case OpS390XADDE:
566 return rewriteValueS390X_OpS390XADDE(v)
567 case OpS390XADDW:
568 return rewriteValueS390X_OpS390XADDW(v)
569 case OpS390XADDWconst:
570 return rewriteValueS390X_OpS390XADDWconst(v)
571 case OpS390XADDWload:
572 return rewriteValueS390X_OpS390XADDWload(v)
573 case OpS390XADDconst:
574 return rewriteValueS390X_OpS390XADDconst(v)
575 case OpS390XADDload:
576 return rewriteValueS390X_OpS390XADDload(v)
577 case OpS390XAND:
578 return rewriteValueS390X_OpS390XAND(v)
579 case OpS390XANDW:
580 return rewriteValueS390X_OpS390XANDW(v)
581 case OpS390XANDWconst:
582 return rewriteValueS390X_OpS390XANDWconst(v)
583 case OpS390XANDWload:
584 return rewriteValueS390X_OpS390XANDWload(v)
585 case OpS390XANDconst:
586 return rewriteValueS390X_OpS390XANDconst(v)
587 case OpS390XANDload:
588 return rewriteValueS390X_OpS390XANDload(v)
589 case OpS390XCMP:
590 return rewriteValueS390X_OpS390XCMP(v)
591 case OpS390XCMPU:
592 return rewriteValueS390X_OpS390XCMPU(v)
593 case OpS390XCMPUconst:
594 return rewriteValueS390X_OpS390XCMPUconst(v)
595 case OpS390XCMPW:
596 return rewriteValueS390X_OpS390XCMPW(v)
597 case OpS390XCMPWU:
598 return rewriteValueS390X_OpS390XCMPWU(v)
599 case OpS390XCMPWUconst:
600 return rewriteValueS390X_OpS390XCMPWUconst(v)
601 case OpS390XCMPWconst:
602 return rewriteValueS390X_OpS390XCMPWconst(v)
603 case OpS390XCMPconst:
604 return rewriteValueS390X_OpS390XCMPconst(v)
605 case OpS390XCPSDR:
606 return rewriteValueS390X_OpS390XCPSDR(v)
607 case OpS390XFCMP:
608 return rewriteValueS390X_OpS390XFCMP(v)
609 case OpS390XFCMPS:
610 return rewriteValueS390X_OpS390XFCMPS(v)
611 case OpS390XFMOVDload:
612 return rewriteValueS390X_OpS390XFMOVDload(v)
613 case OpS390XFMOVDstore:
614 return rewriteValueS390X_OpS390XFMOVDstore(v)
615 case OpS390XFMOVSload:
616 return rewriteValueS390X_OpS390XFMOVSload(v)
617 case OpS390XFMOVSstore:
618 return rewriteValueS390X_OpS390XFMOVSstore(v)
619 case OpS390XFNEG:
620 return rewriteValueS390X_OpS390XFNEG(v)
621 case OpS390XFNEGS:
622 return rewriteValueS390X_OpS390XFNEGS(v)
623 case OpS390XLDGR:
624 return rewriteValueS390X_OpS390XLDGR(v)
625 case OpS390XLEDBR:
626 return rewriteValueS390X_OpS390XLEDBR(v)
627 case OpS390XLGDR:
628 return rewriteValueS390X_OpS390XLGDR(v)
629 case OpS390XLOCGR:
630 return rewriteValueS390X_OpS390XLOCGR(v)
631 case OpS390XLTDBR:
632 return rewriteValueS390X_OpS390XLTDBR(v)
633 case OpS390XLTEBR:
634 return rewriteValueS390X_OpS390XLTEBR(v)
635 case OpS390XLoweredRound32F:
636 return rewriteValueS390X_OpS390XLoweredRound32F(v)
637 case OpS390XLoweredRound64F:
638 return rewriteValueS390X_OpS390XLoweredRound64F(v)
639 case OpS390XMOVBZload:
640 return rewriteValueS390X_OpS390XMOVBZload(v)
641 case OpS390XMOVBZreg:
642 return rewriteValueS390X_OpS390XMOVBZreg(v)
643 case OpS390XMOVBload:
644 return rewriteValueS390X_OpS390XMOVBload(v)
645 case OpS390XMOVBreg:
646 return rewriteValueS390X_OpS390XMOVBreg(v)
647 case OpS390XMOVBstore:
648 return rewriteValueS390X_OpS390XMOVBstore(v)
649 case OpS390XMOVBstoreconst:
650 return rewriteValueS390X_OpS390XMOVBstoreconst(v)
651 case OpS390XMOVDBR:
652 return rewriteValueS390X_OpS390XMOVDBR(v)
653 case OpS390XMOVDaddridx:
654 return rewriteValueS390X_OpS390XMOVDaddridx(v)
655 case OpS390XMOVDload:
656 return rewriteValueS390X_OpS390XMOVDload(v)
657 case OpS390XMOVDstore:
658 return rewriteValueS390X_OpS390XMOVDstore(v)
659 case OpS390XMOVDstoreconst:
660 return rewriteValueS390X_OpS390XMOVDstoreconst(v)
661 case OpS390XMOVDstoreidx:
662 return rewriteValueS390X_OpS390XMOVDstoreidx(v)
663 case OpS390XMOVHZload:
664 return rewriteValueS390X_OpS390XMOVHZload(v)
665 case OpS390XMOVHZreg:
666 return rewriteValueS390X_OpS390XMOVHZreg(v)
667 case OpS390XMOVHload:
668 return rewriteValueS390X_OpS390XMOVHload(v)
669 case OpS390XMOVHreg:
670 return rewriteValueS390X_OpS390XMOVHreg(v)
671 case OpS390XMOVHstore:
672 return rewriteValueS390X_OpS390XMOVHstore(v)
673 case OpS390XMOVHstoreconst:
674 return rewriteValueS390X_OpS390XMOVHstoreconst(v)
675 case OpS390XMOVHstoreidx:
676 return rewriteValueS390X_OpS390XMOVHstoreidx(v)
677 case OpS390XMOVWBR:
678 return rewriteValueS390X_OpS390XMOVWBR(v)
679 case OpS390XMOVWZload:
680 return rewriteValueS390X_OpS390XMOVWZload(v)
681 case OpS390XMOVWZreg:
682 return rewriteValueS390X_OpS390XMOVWZreg(v)
683 case OpS390XMOVWload:
684 return rewriteValueS390X_OpS390XMOVWload(v)
685 case OpS390XMOVWreg:
686 return rewriteValueS390X_OpS390XMOVWreg(v)
687 case OpS390XMOVWstore:
688 return rewriteValueS390X_OpS390XMOVWstore(v)
689 case OpS390XMOVWstoreconst:
690 return rewriteValueS390X_OpS390XMOVWstoreconst(v)
691 case OpS390XMOVWstoreidx:
692 return rewriteValueS390X_OpS390XMOVWstoreidx(v)
693 case OpS390XMULLD:
694 return rewriteValueS390X_OpS390XMULLD(v)
695 case OpS390XMULLDconst:
696 return rewriteValueS390X_OpS390XMULLDconst(v)
697 case OpS390XMULLDload:
698 return rewriteValueS390X_OpS390XMULLDload(v)
699 case OpS390XMULLW:
700 return rewriteValueS390X_OpS390XMULLW(v)
701 case OpS390XMULLWconst:
702 return rewriteValueS390X_OpS390XMULLWconst(v)
703 case OpS390XMULLWload:
704 return rewriteValueS390X_OpS390XMULLWload(v)
705 case OpS390XNEG:
706 return rewriteValueS390X_OpS390XNEG(v)
707 case OpS390XNEGW:
708 return rewriteValueS390X_OpS390XNEGW(v)
709 case OpS390XNOT:
710 return rewriteValueS390X_OpS390XNOT(v)
711 case OpS390XNOTW:
712 return rewriteValueS390X_OpS390XNOTW(v)
713 case OpS390XOR:
714 return rewriteValueS390X_OpS390XOR(v)
715 case OpS390XORW:
716 return rewriteValueS390X_OpS390XORW(v)
717 case OpS390XORWconst:
718 return rewriteValueS390X_OpS390XORWconst(v)
719 case OpS390XORWload:
720 return rewriteValueS390X_OpS390XORWload(v)
721 case OpS390XORconst:
722 return rewriteValueS390X_OpS390XORconst(v)
723 case OpS390XORload:
724 return rewriteValueS390X_OpS390XORload(v)
725 case OpS390XRISBGZ:
726 return rewriteValueS390X_OpS390XRISBGZ(v)
727 case OpS390XRLL:
728 return rewriteValueS390X_OpS390XRLL(v)
729 case OpS390XRLLG:
730 return rewriteValueS390X_OpS390XRLLG(v)
731 case OpS390XSLD:
732 return rewriteValueS390X_OpS390XSLD(v)
733 case OpS390XSLDconst:
734 return rewriteValueS390X_OpS390XSLDconst(v)
735 case OpS390XSLW:
736 return rewriteValueS390X_OpS390XSLW(v)
737 case OpS390XSLWconst:
738 return rewriteValueS390X_OpS390XSLWconst(v)
739 case OpS390XSRAD:
740 return rewriteValueS390X_OpS390XSRAD(v)
741 case OpS390XSRADconst:
742 return rewriteValueS390X_OpS390XSRADconst(v)
743 case OpS390XSRAW:
744 return rewriteValueS390X_OpS390XSRAW(v)
745 case OpS390XSRAWconst:
746 return rewriteValueS390X_OpS390XSRAWconst(v)
747 case OpS390XSRD:
748 return rewriteValueS390X_OpS390XSRD(v)
749 case OpS390XSRDconst:
750 return rewriteValueS390X_OpS390XSRDconst(v)
751 case OpS390XSRW:
752 return rewriteValueS390X_OpS390XSRW(v)
753 case OpS390XSRWconst:
754 return rewriteValueS390X_OpS390XSRWconst(v)
755 case OpS390XSTM2:
756 return rewriteValueS390X_OpS390XSTM2(v)
757 case OpS390XSTMG2:
758 return rewriteValueS390X_OpS390XSTMG2(v)
759 case OpS390XSUB:
760 return rewriteValueS390X_OpS390XSUB(v)
761 case OpS390XSUBE:
762 return rewriteValueS390X_OpS390XSUBE(v)
763 case OpS390XSUBW:
764 return rewriteValueS390X_OpS390XSUBW(v)
765 case OpS390XSUBWconst:
766 return rewriteValueS390X_OpS390XSUBWconst(v)
767 case OpS390XSUBWload:
768 return rewriteValueS390X_OpS390XSUBWload(v)
769 case OpS390XSUBconst:
770 return rewriteValueS390X_OpS390XSUBconst(v)
771 case OpS390XSUBload:
772 return rewriteValueS390X_OpS390XSUBload(v)
773 case OpS390XSumBytes2:
774 return rewriteValueS390X_OpS390XSumBytes2(v)
775 case OpS390XSumBytes4:
776 return rewriteValueS390X_OpS390XSumBytes4(v)
777 case OpS390XSumBytes8:
778 return rewriteValueS390X_OpS390XSumBytes8(v)
779 case OpS390XXOR:
780 return rewriteValueS390X_OpS390XXOR(v)
781 case OpS390XXORW:
782 return rewriteValueS390X_OpS390XXORW(v)
783 case OpS390XXORWconst:
784 return rewriteValueS390X_OpS390XXORWconst(v)
785 case OpS390XXORWload:
786 return rewriteValueS390X_OpS390XXORWload(v)
787 case OpS390XXORconst:
788 return rewriteValueS390X_OpS390XXORconst(v)
789 case OpS390XXORload:
790 return rewriteValueS390X_OpS390XXORload(v)
791 case OpSelect0:
792 return rewriteValueS390X_OpSelect0(v)
793 case OpSelect1:
794 return rewriteValueS390X_OpSelect1(v)
795 case OpSignExt16to32:
796 v.Op = OpS390XMOVHreg
797 return true
798 case OpSignExt16to64:
799 v.Op = OpS390XMOVHreg
800 return true
801 case OpSignExt32to64:
802 v.Op = OpS390XMOVWreg
803 return true
804 case OpSignExt8to16:
805 v.Op = OpS390XMOVBreg
806 return true
807 case OpSignExt8to32:
808 v.Op = OpS390XMOVBreg
809 return true
810 case OpSignExt8to64:
811 v.Op = OpS390XMOVBreg
812 return true
813 case OpSlicemask:
814 return rewriteValueS390X_OpSlicemask(v)
815 case OpSqrt:
816 v.Op = OpS390XFSQRT
817 return true
818 case OpSqrt32:
819 v.Op = OpS390XFSQRTS
820 return true
821 case OpStaticCall:
822 v.Op = OpS390XCALLstatic
823 return true
824 case OpStore:
825 return rewriteValueS390X_OpStore(v)
826 case OpSub16:
827 v.Op = OpS390XSUBW
828 return true
829 case OpSub32:
830 v.Op = OpS390XSUBW
831 return true
832 case OpSub32F:
833 return rewriteValueS390X_OpSub32F(v)
834 case OpSub64:
835 v.Op = OpS390XSUB
836 return true
837 case OpSub64F:
838 return rewriteValueS390X_OpSub64F(v)
839 case OpSub8:
840 v.Op = OpS390XSUBW
841 return true
842 case OpSubPtr:
843 v.Op = OpS390XSUB
844 return true
845 case OpTailCall:
846 v.Op = OpS390XCALLtail
847 return true
848 case OpTrunc:
849 return rewriteValueS390X_OpTrunc(v)
850 case OpTrunc16to8:
851 v.Op = OpCopy
852 return true
853 case OpTrunc32to16:
854 v.Op = OpCopy
855 return true
856 case OpTrunc32to8:
857 v.Op = OpCopy
858 return true
859 case OpTrunc64to16:
860 v.Op = OpCopy
861 return true
862 case OpTrunc64to32:
863 v.Op = OpCopy
864 return true
865 case OpTrunc64to8:
866 v.Op = OpCopy
867 return true
868 case OpWB:
869 v.Op = OpS390XLoweredWB
870 return true
871 case OpXor16:
872 v.Op = OpS390XXORW
873 return true
874 case OpXor32:
875 v.Op = OpS390XXORW
876 return true
877 case OpXor64:
878 v.Op = OpS390XXOR
879 return true
880 case OpXor8:
881 v.Op = OpS390XXORW
882 return true
883 case OpZero:
884 return rewriteValueS390X_OpZero(v)
885 case OpZeroExt16to32:
886 v.Op = OpS390XMOVHZreg
887 return true
888 case OpZeroExt16to64:
889 v.Op = OpS390XMOVHZreg
890 return true
891 case OpZeroExt32to64:
892 v.Op = OpS390XMOVWZreg
893 return true
894 case OpZeroExt8to16:
895 v.Op = OpS390XMOVBZreg
896 return true
897 case OpZeroExt8to32:
898 v.Op = OpS390XMOVBZreg
899 return true
900 case OpZeroExt8to64:
901 v.Op = OpS390XMOVBZreg
902 return true
903 }
904 return false
905 }
906 func rewriteValueS390X_OpAdd32F(v *Value) bool {
907 v_1 := v.Args[1]
908 v_0 := v.Args[0]
909 b := v.Block
910 typ := &b.Func.Config.Types
911 // match: (Add32F x y)
912 // result: (Select0 (FADDS x y))
913 for {
914 x := v_0
915 y := v_1
916 v.reset(OpSelect0)
917 v0 := b.NewValue0(v.Pos, OpS390XFADDS, types.NewTuple(typ.Float32, types.TypeFlags))
918 v0.AddArg2(x, y)
919 v.AddArg(v0)
920 return true
921 }
922 }
923 func rewriteValueS390X_OpAdd64F(v *Value) bool {
924 v_1 := v.Args[1]
925 v_0 := v.Args[0]
926 b := v.Block
927 typ := &b.Func.Config.Types
928 // match: (Add64F x y)
929 // result: (Select0 (FADD x y))
930 for {
931 x := v_0
932 y := v_1
933 v.reset(OpSelect0)
934 v0 := b.NewValue0(v.Pos, OpS390XFADD, types.NewTuple(typ.Float64, types.TypeFlags))
935 v0.AddArg2(x, y)
936 v.AddArg(v0)
937 return true
938 }
939 }
940 func rewriteValueS390X_OpAddr(v *Value) bool {
941 v_0 := v.Args[0]
942 // match: (Addr {sym} base)
943 // result: (MOVDaddr {sym} base)
944 for {
945 sym := auxToSym(v.Aux)
946 base := v_0
947 v.reset(OpS390XMOVDaddr)
948 v.Aux = symToAux(sym)
949 v.AddArg(base)
950 return true
951 }
952 }
953 func rewriteValueS390X_OpAtomicAdd32(v *Value) bool {
954 v_2 := v.Args[2]
955 v_1 := v.Args[1]
956 v_0 := v.Args[0]
957 b := v.Block
958 typ := &b.Func.Config.Types
959 // match: (AtomicAdd32 ptr val mem)
960 // result: (AddTupleFirst32 val (LAA ptr val mem))
961 for {
962 ptr := v_0
963 val := v_1
964 mem := v_2
965 v.reset(OpS390XAddTupleFirst32)
966 v0 := b.NewValue0(v.Pos, OpS390XLAA, types.NewTuple(typ.UInt32, types.TypeMem))
967 v0.AddArg3(ptr, val, mem)
968 v.AddArg2(val, v0)
969 return true
970 }
971 }
972 func rewriteValueS390X_OpAtomicAdd64(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: (AtomicAdd64 ptr val mem)
979 // result: (AddTupleFirst64 val (LAAG ptr val mem))
980 for {
981 ptr := v_0
982 val := v_1
983 mem := v_2
984 v.reset(OpS390XAddTupleFirst64)
985 v0 := b.NewValue0(v.Pos, OpS390XLAAG, types.NewTuple(typ.UInt64, types.TypeMem))
986 v0.AddArg3(ptr, val, mem)
987 v.AddArg2(val, v0)
988 return true
989 }
990 }
991 func rewriteValueS390X_OpAtomicAnd8(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: (AtomicAnd8 ptr val mem)
998 // 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)
999 for {
1000 ptr := v_0
1001 val := v_1
1002 mem := v_2
1003 v.reset(OpS390XLANfloor)
1004 v0 := b.NewValue0(v.Pos, OpS390XRLL, typ.UInt32)
1005 v1 := b.NewValue0(v.Pos, OpS390XORWconst, typ.UInt32)
1006 v1.AuxInt = int32ToAuxInt(-1 << 8)
1007 v1.AddArg(val)
1008 v2 := b.NewValue0(v.Pos, OpS390XRXSBG, typ.UInt32)
1009 v2.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(59, 60, 3))
1010 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1011 v3.AuxInt = int64ToAuxInt(3 << 3)
1012 v2.AddArg2(v3, ptr)
1013 v0.AddArg2(v1, v2)
1014 v.AddArg3(ptr, v0, mem)
1015 return true
1016 }
1017 }
1018 func rewriteValueS390X_OpAtomicCompareAndSwap32(v *Value) bool {
1019 v_3 := v.Args[3]
1020 v_2 := v.Args[2]
1021 v_1 := v.Args[1]
1022 v_0 := v.Args[0]
1023 // match: (AtomicCompareAndSwap32 ptr old new_ mem)
1024 // result: (LoweredAtomicCas32 ptr old new_ mem)
1025 for {
1026 ptr := v_0
1027 old := v_1
1028 new_ := v_2
1029 mem := v_3
1030 v.reset(OpS390XLoweredAtomicCas32)
1031 v.AddArg4(ptr, old, new_, mem)
1032 return true
1033 }
1034 }
1035 func rewriteValueS390X_OpAtomicCompareAndSwap64(v *Value) bool {
1036 v_3 := v.Args[3]
1037 v_2 := v.Args[2]
1038 v_1 := v.Args[1]
1039 v_0 := v.Args[0]
1040 // match: (AtomicCompareAndSwap64 ptr old new_ mem)
1041 // result: (LoweredAtomicCas64 ptr old new_ mem)
1042 for {
1043 ptr := v_0
1044 old := v_1
1045 new_ := v_2
1046 mem := v_3
1047 v.reset(OpS390XLoweredAtomicCas64)
1048 v.AddArg4(ptr, old, new_, mem)
1049 return true
1050 }
1051 }
1052 func rewriteValueS390X_OpAtomicExchange32(v *Value) bool {
1053 v_2 := v.Args[2]
1054 v_1 := v.Args[1]
1055 v_0 := v.Args[0]
1056 // match: (AtomicExchange32 ptr val mem)
1057 // result: (LoweredAtomicExchange32 ptr val mem)
1058 for {
1059 ptr := v_0
1060 val := v_1
1061 mem := v_2
1062 v.reset(OpS390XLoweredAtomicExchange32)
1063 v.AddArg3(ptr, val, mem)
1064 return true
1065 }
1066 }
1067 func rewriteValueS390X_OpAtomicExchange64(v *Value) bool {
1068 v_2 := v.Args[2]
1069 v_1 := v.Args[1]
1070 v_0 := v.Args[0]
1071 // match: (AtomicExchange64 ptr val mem)
1072 // result: (LoweredAtomicExchange64 ptr val mem)
1073 for {
1074 ptr := v_0
1075 val := v_1
1076 mem := v_2
1077 v.reset(OpS390XLoweredAtomicExchange64)
1078 v.AddArg3(ptr, val, mem)
1079 return true
1080 }
1081 }
1082 func rewriteValueS390X_OpAtomicLoad32(v *Value) bool {
1083 v_1 := v.Args[1]
1084 v_0 := v.Args[0]
1085 // match: (AtomicLoad32 ptr mem)
1086 // result: (MOVWZatomicload ptr mem)
1087 for {
1088 ptr := v_0
1089 mem := v_1
1090 v.reset(OpS390XMOVWZatomicload)
1091 v.AddArg2(ptr, mem)
1092 return true
1093 }
1094 }
1095 func rewriteValueS390X_OpAtomicLoad64(v *Value) bool {
1096 v_1 := v.Args[1]
1097 v_0 := v.Args[0]
1098 // match: (AtomicLoad64 ptr mem)
1099 // result: (MOVDatomicload ptr mem)
1100 for {
1101 ptr := v_0
1102 mem := v_1
1103 v.reset(OpS390XMOVDatomicload)
1104 v.AddArg2(ptr, mem)
1105 return true
1106 }
1107 }
1108 func rewriteValueS390X_OpAtomicLoad8(v *Value) bool {
1109 v_1 := v.Args[1]
1110 v_0 := v.Args[0]
1111 // match: (AtomicLoad8 ptr mem)
1112 // result: (MOVBZatomicload ptr mem)
1113 for {
1114 ptr := v_0
1115 mem := v_1
1116 v.reset(OpS390XMOVBZatomicload)
1117 v.AddArg2(ptr, mem)
1118 return true
1119 }
1120 }
1121 func rewriteValueS390X_OpAtomicLoadAcq32(v *Value) bool {
1122 v_1 := v.Args[1]
1123 v_0 := v.Args[0]
1124 // match: (AtomicLoadAcq32 ptr mem)
1125 // result: (MOVWZatomicload ptr mem)
1126 for {
1127 ptr := v_0
1128 mem := v_1
1129 v.reset(OpS390XMOVWZatomicload)
1130 v.AddArg2(ptr, mem)
1131 return true
1132 }
1133 }
1134 func rewriteValueS390X_OpAtomicLoadPtr(v *Value) bool {
1135 v_1 := v.Args[1]
1136 v_0 := v.Args[0]
1137 // match: (AtomicLoadPtr ptr mem)
1138 // result: (MOVDatomicload ptr mem)
1139 for {
1140 ptr := v_0
1141 mem := v_1
1142 v.reset(OpS390XMOVDatomicload)
1143 v.AddArg2(ptr, mem)
1144 return true
1145 }
1146 }
1147 func rewriteValueS390X_OpAtomicOr8(v *Value) bool {
1148 v_2 := v.Args[2]
1149 v_1 := v.Args[1]
1150 v_0 := v.Args[0]
1151 b := v.Block
1152 typ := &b.Func.Config.Types
1153 // match: (AtomicOr8 ptr val mem)
1154 // result: (LAOfloor ptr (SLW <typ.UInt32> (MOVBZreg <typ.UInt32> val) (RXSBG <typ.UInt32> {s390x.NewRotateParams(59, 60, 3)} (MOVDconst [3<<3]) ptr)) mem)
1155 for {
1156 ptr := v_0
1157 val := v_1
1158 mem := v_2
1159 v.reset(OpS390XLAOfloor)
1160 v0 := b.NewValue0(v.Pos, OpS390XSLW, typ.UInt32)
1161 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt32)
1162 v1.AddArg(val)
1163 v2 := b.NewValue0(v.Pos, OpS390XRXSBG, typ.UInt32)
1164 v2.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(59, 60, 3))
1165 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1166 v3.AuxInt = int64ToAuxInt(3 << 3)
1167 v2.AddArg2(v3, ptr)
1168 v0.AddArg2(v1, v2)
1169 v.AddArg3(ptr, v0, mem)
1170 return true
1171 }
1172 }
1173 func rewriteValueS390X_OpAtomicStore32(v *Value) bool {
1174 v_2 := v.Args[2]
1175 v_1 := v.Args[1]
1176 v_0 := v.Args[0]
1177 b := v.Block
1178 // match: (AtomicStore32 ptr val mem)
1179 // result: (SYNC (MOVWatomicstore ptr val mem))
1180 for {
1181 ptr := v_0
1182 val := v_1
1183 mem := v_2
1184 v.reset(OpS390XSYNC)
1185 v0 := b.NewValue0(v.Pos, OpS390XMOVWatomicstore, types.TypeMem)
1186 v0.AddArg3(ptr, val, mem)
1187 v.AddArg(v0)
1188 return true
1189 }
1190 }
1191 func rewriteValueS390X_OpAtomicStore64(v *Value) bool {
1192 v_2 := v.Args[2]
1193 v_1 := v.Args[1]
1194 v_0 := v.Args[0]
1195 b := v.Block
1196 // match: (AtomicStore64 ptr val mem)
1197 // result: (SYNC (MOVDatomicstore ptr val mem))
1198 for {
1199 ptr := v_0
1200 val := v_1
1201 mem := v_2
1202 v.reset(OpS390XSYNC)
1203 v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem)
1204 v0.AddArg3(ptr, val, mem)
1205 v.AddArg(v0)
1206 return true
1207 }
1208 }
1209 func rewriteValueS390X_OpAtomicStore8(v *Value) bool {
1210 v_2 := v.Args[2]
1211 v_1 := v.Args[1]
1212 v_0 := v.Args[0]
1213 b := v.Block
1214 // match: (AtomicStore8 ptr val mem)
1215 // result: (SYNC (MOVBatomicstore ptr val mem))
1216 for {
1217 ptr := v_0
1218 val := v_1
1219 mem := v_2
1220 v.reset(OpS390XSYNC)
1221 v0 := b.NewValue0(v.Pos, OpS390XMOVBatomicstore, types.TypeMem)
1222 v0.AddArg3(ptr, val, mem)
1223 v.AddArg(v0)
1224 return true
1225 }
1226 }
1227 func rewriteValueS390X_OpAtomicStorePtrNoWB(v *Value) bool {
1228 v_2 := v.Args[2]
1229 v_1 := v.Args[1]
1230 v_0 := v.Args[0]
1231 b := v.Block
1232 // match: (AtomicStorePtrNoWB ptr val mem)
1233 // result: (SYNC (MOVDatomicstore ptr val mem))
1234 for {
1235 ptr := v_0
1236 val := v_1
1237 mem := v_2
1238 v.reset(OpS390XSYNC)
1239 v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem)
1240 v0.AddArg3(ptr, val, mem)
1241 v.AddArg(v0)
1242 return true
1243 }
1244 }
1245 func rewriteValueS390X_OpAtomicStoreRel32(v *Value) bool {
1246 v_2 := v.Args[2]
1247 v_1 := v.Args[1]
1248 v_0 := v.Args[0]
1249 // match: (AtomicStoreRel32 ptr val mem)
1250 // result: (MOVWatomicstore ptr val mem)
1251 for {
1252 ptr := v_0
1253 val := v_1
1254 mem := v_2
1255 v.reset(OpS390XMOVWatomicstore)
1256 v.AddArg3(ptr, val, mem)
1257 return true
1258 }
1259 }
1260 func rewriteValueS390X_OpAvg64u(v *Value) bool {
1261 v_1 := v.Args[1]
1262 v_0 := v.Args[0]
1263 b := v.Block
1264 // match: (Avg64u <t> x y)
1265 // result: (ADD (SRDconst <t> (SUB <t> x y) [1]) y)
1266 for {
1267 t := v.Type
1268 x := v_0
1269 y := v_1
1270 v.reset(OpS390XADD)
1271 v0 := b.NewValue0(v.Pos, OpS390XSRDconst, t)
1272 v0.AuxInt = uint8ToAuxInt(1)
1273 v1 := b.NewValue0(v.Pos, OpS390XSUB, t)
1274 v1.AddArg2(x, y)
1275 v0.AddArg(v1)
1276 v.AddArg2(v0, y)
1277 return true
1278 }
1279 }
1280 func rewriteValueS390X_OpBitLen16(v *Value) bool {
1281 v_0 := v.Args[0]
1282 b := v.Block
1283 typ := &b.Func.Config.Types
1284 // match: (BitLen16 x)
1285 // result: (BitLen64 (ZeroExt16to64 x))
1286 for {
1287 x := v_0
1288 v.reset(OpBitLen64)
1289 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
1290 v0.AddArg(x)
1291 v.AddArg(v0)
1292 return true
1293 }
1294 }
1295 func rewriteValueS390X_OpBitLen32(v *Value) bool {
1296 v_0 := v.Args[0]
1297 b := v.Block
1298 typ := &b.Func.Config.Types
1299 // match: (BitLen32 x)
1300 // result: (BitLen64 (ZeroExt32to64 x))
1301 for {
1302 x := v_0
1303 v.reset(OpBitLen64)
1304 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
1305 v0.AddArg(x)
1306 v.AddArg(v0)
1307 return true
1308 }
1309 }
1310 func rewriteValueS390X_OpBitLen64(v *Value) bool {
1311 v_0 := v.Args[0]
1312 b := v.Block
1313 typ := &b.Func.Config.Types
1314 // match: (BitLen64 x)
1315 // result: (SUB (MOVDconst [64]) (FLOGR x))
1316 for {
1317 x := v_0
1318 v.reset(OpS390XSUB)
1319 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1320 v0.AuxInt = int64ToAuxInt(64)
1321 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64)
1322 v1.AddArg(x)
1323 v.AddArg2(v0, v1)
1324 return true
1325 }
1326 }
1327 func rewriteValueS390X_OpBitLen8(v *Value) bool {
1328 v_0 := v.Args[0]
1329 b := v.Block
1330 typ := &b.Func.Config.Types
1331 // match: (BitLen8 x)
1332 // result: (BitLen64 (ZeroExt8to64 x))
1333 for {
1334 x := v_0
1335 v.reset(OpBitLen64)
1336 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
1337 v0.AddArg(x)
1338 v.AddArg(v0)
1339 return true
1340 }
1341 }
1342 func rewriteValueS390X_OpBswap16(v *Value) bool {
1343 v_0 := v.Args[0]
1344 b := v.Block
1345 typ := &b.Func.Config.Types
1346 // match: (Bswap16 x:(MOVHZload [off] {sym} ptr mem))
1347 // result: @x.Block (MOVHZreg (MOVHBRload [off] {sym} ptr mem))
1348 for {
1349 x := v_0
1350 if x.Op != OpS390XMOVHZload {
1351 break
1352 }
1353 off := auxIntToInt32(x.AuxInt)
1354 sym := auxToSym(x.Aux)
1355 mem := x.Args[1]
1356 ptr := x.Args[0]
1357 b = x.Block
1358 v0 := b.NewValue0(x.Pos, OpS390XMOVHZreg, typ.UInt64)
1359 v.copyOf(v0)
1360 v1 := b.NewValue0(x.Pos, OpS390XMOVHBRload, typ.UInt16)
1361 v1.AuxInt = int32ToAuxInt(off)
1362 v1.Aux = symToAux(sym)
1363 v1.AddArg2(ptr, mem)
1364 v0.AddArg(v1)
1365 return true
1366 }
1367 // match: (Bswap16 x:(MOVHZloadidx [off] {sym} ptr idx mem))
1368 // result: @x.Block (MOVHZreg (MOVHBRloadidx [off] {sym} ptr idx mem))
1369 for {
1370 x := v_0
1371 if x.Op != OpS390XMOVHZloadidx {
1372 break
1373 }
1374 off := auxIntToInt32(x.AuxInt)
1375 sym := auxToSym(x.Aux)
1376 mem := x.Args[2]
1377 ptr := x.Args[0]
1378 idx := x.Args[1]
1379 b = x.Block
1380 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
1381 v.copyOf(v0)
1382 v1 := b.NewValue0(v.Pos, OpS390XMOVHBRloadidx, typ.Int16)
1383 v1.AuxInt = int32ToAuxInt(off)
1384 v1.Aux = symToAux(sym)
1385 v1.AddArg3(ptr, idx, mem)
1386 v0.AddArg(v1)
1387 return true
1388 }
1389 return false
1390 }
1391 func rewriteValueS390X_OpCeil(v *Value) bool {
1392 v_0 := v.Args[0]
1393 // match: (Ceil x)
1394 // result: (FIDBR [6] x)
1395 for {
1396 x := v_0
1397 v.reset(OpS390XFIDBR)
1398 v.AuxInt = int8ToAuxInt(6)
1399 v.AddArg(x)
1400 return true
1401 }
1402 }
1403 func rewriteValueS390X_OpConst16(v *Value) bool {
1404 // match: (Const16 [val])
1405 // result: (MOVDconst [int64(val)])
1406 for {
1407 val := auxIntToInt16(v.AuxInt)
1408 v.reset(OpS390XMOVDconst)
1409 v.AuxInt = int64ToAuxInt(int64(val))
1410 return true
1411 }
1412 }
1413 func rewriteValueS390X_OpConst32(v *Value) bool {
1414 // match: (Const32 [val])
1415 // result: (MOVDconst [int64(val)])
1416 for {
1417 val := auxIntToInt32(v.AuxInt)
1418 v.reset(OpS390XMOVDconst)
1419 v.AuxInt = int64ToAuxInt(int64(val))
1420 return true
1421 }
1422 }
1423 func rewriteValueS390X_OpConst64(v *Value) bool {
1424 // match: (Const64 [val])
1425 // result: (MOVDconst [int64(val)])
1426 for {
1427 val := auxIntToInt64(v.AuxInt)
1428 v.reset(OpS390XMOVDconst)
1429 v.AuxInt = int64ToAuxInt(int64(val))
1430 return true
1431 }
1432 }
1433 func rewriteValueS390X_OpConst8(v *Value) bool {
1434 // match: (Const8 [val])
1435 // result: (MOVDconst [int64(val)])
1436 for {
1437 val := auxIntToInt8(v.AuxInt)
1438 v.reset(OpS390XMOVDconst)
1439 v.AuxInt = int64ToAuxInt(int64(val))
1440 return true
1441 }
1442 }
1443 func rewriteValueS390X_OpConstBool(v *Value) bool {
1444 // match: (ConstBool [t])
1445 // result: (MOVDconst [b2i(t)])
1446 for {
1447 t := auxIntToBool(v.AuxInt)
1448 v.reset(OpS390XMOVDconst)
1449 v.AuxInt = int64ToAuxInt(b2i(t))
1450 return true
1451 }
1452 }
1453 func rewriteValueS390X_OpConstNil(v *Value) bool {
1454 // match: (ConstNil)
1455 // result: (MOVDconst [0])
1456 for {
1457 v.reset(OpS390XMOVDconst)
1458 v.AuxInt = int64ToAuxInt(0)
1459 return true
1460 }
1461 }
1462 func rewriteValueS390X_OpCtz16(v *Value) bool {
1463 v_0 := v.Args[0]
1464 b := v.Block
1465 typ := &b.Func.Config.Types
1466 // match: (Ctz16 x)
1467 // result: (Ctz64 (Or64 <typ.UInt64> x (MOVDconst [1<<16])))
1468 for {
1469 x := v_0
1470 v.reset(OpCtz64)
1471 v0 := b.NewValue0(v.Pos, OpOr64, typ.UInt64)
1472 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1473 v1.AuxInt = int64ToAuxInt(1 << 16)
1474 v0.AddArg2(x, v1)
1475 v.AddArg(v0)
1476 return true
1477 }
1478 }
1479 func rewriteValueS390X_OpCtz32(v *Value) bool {
1480 v_0 := v.Args[0]
1481 b := v.Block
1482 typ := &b.Func.Config.Types
1483 // match: (Ctz32 <t> x)
1484 // result: (SUB (MOVDconst [64]) (FLOGR (MOVWZreg (ANDW <t> (SUBWconst <t> [1] x) (NOTW <t> x)))))
1485 for {
1486 t := v.Type
1487 x := v_0
1488 v.reset(OpS390XSUB)
1489 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1490 v0.AuxInt = int64ToAuxInt(64)
1491 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64)
1492 v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
1493 v3 := b.NewValue0(v.Pos, OpS390XANDW, t)
1494 v4 := b.NewValue0(v.Pos, OpS390XSUBWconst, t)
1495 v4.AuxInt = int32ToAuxInt(1)
1496 v4.AddArg(x)
1497 v5 := b.NewValue0(v.Pos, OpS390XNOTW, t)
1498 v5.AddArg(x)
1499 v3.AddArg2(v4, v5)
1500 v2.AddArg(v3)
1501 v1.AddArg(v2)
1502 v.AddArg2(v0, v1)
1503 return true
1504 }
1505 }
1506 func rewriteValueS390X_OpCtz64(v *Value) bool {
1507 v_0 := v.Args[0]
1508 b := v.Block
1509 typ := &b.Func.Config.Types
1510 // match: (Ctz64 <t> x)
1511 // result: (SUB (MOVDconst [64]) (FLOGR (AND <t> (SUBconst <t> [1] x) (NOT <t> x))))
1512 for {
1513 t := v.Type
1514 x := v_0
1515 v.reset(OpS390XSUB)
1516 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1517 v0.AuxInt = int64ToAuxInt(64)
1518 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64)
1519 v2 := b.NewValue0(v.Pos, OpS390XAND, t)
1520 v3 := b.NewValue0(v.Pos, OpS390XSUBconst, t)
1521 v3.AuxInt = int32ToAuxInt(1)
1522 v3.AddArg(x)
1523 v4 := b.NewValue0(v.Pos, OpS390XNOT, t)
1524 v4.AddArg(x)
1525 v2.AddArg2(v3, v4)
1526 v1.AddArg(v2)
1527 v.AddArg2(v0, v1)
1528 return true
1529 }
1530 }
1531 func rewriteValueS390X_OpCtz8(v *Value) bool {
1532 v_0 := v.Args[0]
1533 b := v.Block
1534 typ := &b.Func.Config.Types
1535 // match: (Ctz8 x)
1536 // result: (Ctz64 (Or64 <typ.UInt64> x (MOVDconst [1<<8])))
1537 for {
1538 x := v_0
1539 v.reset(OpCtz64)
1540 v0 := b.NewValue0(v.Pos, OpOr64, typ.UInt64)
1541 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1542 v1.AuxInt = int64ToAuxInt(1 << 8)
1543 v0.AddArg2(x, v1)
1544 v.AddArg(v0)
1545 return true
1546 }
1547 }
1548 func rewriteValueS390X_OpDiv16(v *Value) bool {
1549 v_1 := v.Args[1]
1550 v_0 := v.Args[0]
1551 b := v.Block
1552 typ := &b.Func.Config.Types
1553 // match: (Div16 x y)
1554 // result: (DIVW (MOVHreg x) (MOVHreg y))
1555 for {
1556 x := v_0
1557 y := v_1
1558 v.reset(OpS390XDIVW)
1559 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
1560 v0.AddArg(x)
1561 v1 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
1562 v1.AddArg(y)
1563 v.AddArg2(v0, v1)
1564 return true
1565 }
1566 }
1567 func rewriteValueS390X_OpDiv16u(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: (Div16u x y)
1573 // result: (DIVWU (MOVHZreg x) (MOVHZreg y))
1574 for {
1575 x := v_0
1576 y := v_1
1577 v.reset(OpS390XDIVWU)
1578 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
1579 v0.AddArg(x)
1580 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
1581 v1.AddArg(y)
1582 v.AddArg2(v0, v1)
1583 return true
1584 }
1585 }
1586 func rewriteValueS390X_OpDiv32(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: (Div32 x y)
1592 // result: (DIVW (MOVWreg x) y)
1593 for {
1594 x := v_0
1595 y := v_1
1596 v.reset(OpS390XDIVW)
1597 v0 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64)
1598 v0.AddArg(x)
1599 v.AddArg2(v0, y)
1600 return true
1601 }
1602 }
1603 func rewriteValueS390X_OpDiv32u(v *Value) bool {
1604 v_1 := v.Args[1]
1605 v_0 := v.Args[0]
1606 b := v.Block
1607 typ := &b.Func.Config.Types
1608 // match: (Div32u x y)
1609 // result: (DIVWU (MOVWZreg x) y)
1610 for {
1611 x := v_0
1612 y := v_1
1613 v.reset(OpS390XDIVWU)
1614 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
1615 v0.AddArg(x)
1616 v.AddArg2(v0, y)
1617 return true
1618 }
1619 }
1620 func rewriteValueS390X_OpDiv64(v *Value) bool {
1621 v_1 := v.Args[1]
1622 v_0 := v.Args[0]
1623 // match: (Div64 x y)
1624 // result: (DIVD x y)
1625 for {
1626 x := v_0
1627 y := v_1
1628 v.reset(OpS390XDIVD)
1629 v.AddArg2(x, y)
1630 return true
1631 }
1632 }
1633 func rewriteValueS390X_OpDiv8(v *Value) bool {
1634 v_1 := v.Args[1]
1635 v_0 := v.Args[0]
1636 b := v.Block
1637 typ := &b.Func.Config.Types
1638 // match: (Div8 x y)
1639 // result: (DIVW (MOVBreg x) (MOVBreg y))
1640 for {
1641 x := v_0
1642 y := v_1
1643 v.reset(OpS390XDIVW)
1644 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1645 v0.AddArg(x)
1646 v1 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1647 v1.AddArg(y)
1648 v.AddArg2(v0, v1)
1649 return true
1650 }
1651 }
1652 func rewriteValueS390X_OpDiv8u(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: (Div8u x y)
1658 // result: (DIVWU (MOVBZreg x) (MOVBZreg y))
1659 for {
1660 x := v_0
1661 y := v_1
1662 v.reset(OpS390XDIVWU)
1663 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
1664 v0.AddArg(x)
1665 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
1666 v1.AddArg(y)
1667 v.AddArg2(v0, v1)
1668 return true
1669 }
1670 }
1671 func rewriteValueS390X_OpEq16(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: (Eq16 x y)
1677 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y)))
1678 for {
1679 x := v_0
1680 y := v_1
1681 v.reset(OpS390XLOCGR)
1682 v.Aux = s390xCCMaskToAux(s390x.Equal)
1683 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1684 v0.AuxInt = int64ToAuxInt(0)
1685 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1686 v1.AuxInt = int64ToAuxInt(1)
1687 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
1688 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
1689 v3.AddArg(x)
1690 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
1691 v4.AddArg(y)
1692 v2.AddArg2(v3, v4)
1693 v.AddArg3(v0, v1, v2)
1694 return true
1695 }
1696 }
1697 func rewriteValueS390X_OpEq32(v *Value) bool {
1698 v_1 := v.Args[1]
1699 v_0 := v.Args[0]
1700 b := v.Block
1701 typ := &b.Func.Config.Types
1702 // match: (Eq32 x y)
1703 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y))
1704 for {
1705 x := v_0
1706 y := v_1
1707 v.reset(OpS390XLOCGR)
1708 v.Aux = s390xCCMaskToAux(s390x.Equal)
1709 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1710 v0.AuxInt = int64ToAuxInt(0)
1711 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1712 v1.AuxInt = int64ToAuxInt(1)
1713 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
1714 v2.AddArg2(x, y)
1715 v.AddArg3(v0, v1, v2)
1716 return true
1717 }
1718 }
1719 func rewriteValueS390X_OpEq32F(v *Value) bool {
1720 v_1 := v.Args[1]
1721 v_0 := v.Args[0]
1722 b := v.Block
1723 typ := &b.Func.Config.Types
1724 // match: (Eq32F x y)
1725 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y))
1726 for {
1727 x := v_0
1728 y := v_1
1729 v.reset(OpS390XLOCGR)
1730 v.Aux = s390xCCMaskToAux(s390x.Equal)
1731 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1732 v0.AuxInt = int64ToAuxInt(0)
1733 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1734 v1.AuxInt = int64ToAuxInt(1)
1735 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags)
1736 v2.AddArg2(x, y)
1737 v.AddArg3(v0, v1, v2)
1738 return true
1739 }
1740 }
1741 func rewriteValueS390X_OpEq64(v *Value) bool {
1742 v_1 := v.Args[1]
1743 v_0 := v.Args[0]
1744 b := v.Block
1745 typ := &b.Func.Config.Types
1746 // match: (Eq64 x y)
1747 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
1748 for {
1749 x := v_0
1750 y := v_1
1751 v.reset(OpS390XLOCGR)
1752 v.Aux = s390xCCMaskToAux(s390x.Equal)
1753 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1754 v0.AuxInt = int64ToAuxInt(0)
1755 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1756 v1.AuxInt = int64ToAuxInt(1)
1757 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
1758 v2.AddArg2(x, y)
1759 v.AddArg3(v0, v1, v2)
1760 return true
1761 }
1762 }
1763 func rewriteValueS390X_OpEq64F(v *Value) bool {
1764 v_1 := v.Args[1]
1765 v_0 := v.Args[0]
1766 b := v.Block
1767 typ := &b.Func.Config.Types
1768 // match: (Eq64F x y)
1769 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y))
1770 for {
1771 x := v_0
1772 y := v_1
1773 v.reset(OpS390XLOCGR)
1774 v.Aux = s390xCCMaskToAux(s390x.Equal)
1775 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1776 v0.AuxInt = int64ToAuxInt(0)
1777 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1778 v1.AuxInt = int64ToAuxInt(1)
1779 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags)
1780 v2.AddArg2(x, y)
1781 v.AddArg3(v0, v1, v2)
1782 return true
1783 }
1784 }
1785 func rewriteValueS390X_OpEq8(v *Value) bool {
1786 v_1 := v.Args[1]
1787 v_0 := v.Args[0]
1788 b := v.Block
1789 typ := &b.Func.Config.Types
1790 // match: (Eq8 x y)
1791 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
1792 for {
1793 x := v_0
1794 y := v_1
1795 v.reset(OpS390XLOCGR)
1796 v.Aux = s390xCCMaskToAux(s390x.Equal)
1797 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1798 v0.AuxInt = int64ToAuxInt(0)
1799 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1800 v1.AuxInt = int64ToAuxInt(1)
1801 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
1802 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1803 v3.AddArg(x)
1804 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1805 v4.AddArg(y)
1806 v2.AddArg2(v3, v4)
1807 v.AddArg3(v0, v1, v2)
1808 return true
1809 }
1810 }
1811 func rewriteValueS390X_OpEqB(v *Value) bool {
1812 v_1 := v.Args[1]
1813 v_0 := v.Args[0]
1814 b := v.Block
1815 typ := &b.Func.Config.Types
1816 // match: (EqB x y)
1817 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
1818 for {
1819 x := v_0
1820 y := v_1
1821 v.reset(OpS390XLOCGR)
1822 v.Aux = s390xCCMaskToAux(s390x.Equal)
1823 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1824 v0.AuxInt = int64ToAuxInt(0)
1825 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1826 v1.AuxInt = int64ToAuxInt(1)
1827 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
1828 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1829 v3.AddArg(x)
1830 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
1831 v4.AddArg(y)
1832 v2.AddArg2(v3, v4)
1833 v.AddArg3(v0, v1, v2)
1834 return true
1835 }
1836 }
1837 func rewriteValueS390X_OpEqPtr(v *Value) bool {
1838 v_1 := v.Args[1]
1839 v_0 := v.Args[0]
1840 b := v.Block
1841 typ := &b.Func.Config.Types
1842 // match: (EqPtr x y)
1843 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
1844 for {
1845 x := v_0
1846 y := v_1
1847 v.reset(OpS390XLOCGR)
1848 v.Aux = s390xCCMaskToAux(s390x.Equal)
1849 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1850 v0.AuxInt = int64ToAuxInt(0)
1851 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1852 v1.AuxInt = int64ToAuxInt(1)
1853 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
1854 v2.AddArg2(x, y)
1855 v.AddArg3(v0, v1, v2)
1856 return true
1857 }
1858 }
1859 func rewriteValueS390X_OpFMA(v *Value) bool {
1860 v_2 := v.Args[2]
1861 v_1 := v.Args[1]
1862 v_0 := v.Args[0]
1863 // match: (FMA x y z)
1864 // result: (FMADD z x y)
1865 for {
1866 x := v_0
1867 y := v_1
1868 z := v_2
1869 v.reset(OpS390XFMADD)
1870 v.AddArg3(z, x, y)
1871 return true
1872 }
1873 }
1874 func rewriteValueS390X_OpFloor(v *Value) bool {
1875 v_0 := v.Args[0]
1876 // match: (Floor x)
1877 // result: (FIDBR [7] x)
1878 for {
1879 x := v_0
1880 v.reset(OpS390XFIDBR)
1881 v.AuxInt = int8ToAuxInt(7)
1882 v.AddArg(x)
1883 return true
1884 }
1885 }
1886 func rewriteValueS390X_OpHmul32(v *Value) bool {
1887 v_1 := v.Args[1]
1888 v_0 := v.Args[0]
1889 b := v.Block
1890 typ := &b.Func.Config.Types
1891 // match: (Hmul32 x y)
1892 // result: (SRDconst [32] (MULLD (MOVWreg x) (MOVWreg y)))
1893 for {
1894 x := v_0
1895 y := v_1
1896 v.reset(OpS390XSRDconst)
1897 v.AuxInt = uint8ToAuxInt(32)
1898 v0 := b.NewValue0(v.Pos, OpS390XMULLD, typ.Int64)
1899 v1 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64)
1900 v1.AddArg(x)
1901 v2 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64)
1902 v2.AddArg(y)
1903 v0.AddArg2(v1, v2)
1904 v.AddArg(v0)
1905 return true
1906 }
1907 }
1908 func rewriteValueS390X_OpHmul32u(v *Value) bool {
1909 v_1 := v.Args[1]
1910 v_0 := v.Args[0]
1911 b := v.Block
1912 typ := &b.Func.Config.Types
1913 // match: (Hmul32u x y)
1914 // result: (SRDconst [32] (MULLD (MOVWZreg x) (MOVWZreg y)))
1915 for {
1916 x := v_0
1917 y := v_1
1918 v.reset(OpS390XSRDconst)
1919 v.AuxInt = uint8ToAuxInt(32)
1920 v0 := b.NewValue0(v.Pos, OpS390XMULLD, typ.Int64)
1921 v1 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
1922 v1.AddArg(x)
1923 v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
1924 v2.AddArg(y)
1925 v0.AddArg2(v1, v2)
1926 v.AddArg(v0)
1927 return true
1928 }
1929 }
1930 func rewriteValueS390X_OpITab(v *Value) bool {
1931 v_0 := v.Args[0]
1932 // match: (ITab (Load ptr mem))
1933 // result: (MOVDload ptr mem)
1934 for {
1935 if v_0.Op != OpLoad {
1936 break
1937 }
1938 mem := v_0.Args[1]
1939 ptr := v_0.Args[0]
1940 v.reset(OpS390XMOVDload)
1941 v.AddArg2(ptr, mem)
1942 return true
1943 }
1944 return false
1945 }
1946 func rewriteValueS390X_OpIsInBounds(v *Value) bool {
1947 v_1 := v.Args[1]
1948 v_0 := v.Args[0]
1949 b := v.Block
1950 typ := &b.Func.Config.Types
1951 // match: (IsInBounds idx len)
1952 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPU idx len))
1953 for {
1954 idx := v_0
1955 len := v_1
1956 v.reset(OpS390XLOCGR)
1957 v.Aux = s390xCCMaskToAux(s390x.Less)
1958 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1959 v0.AuxInt = int64ToAuxInt(0)
1960 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1961 v1.AuxInt = int64ToAuxInt(1)
1962 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
1963 v2.AddArg2(idx, len)
1964 v.AddArg3(v0, v1, v2)
1965 return true
1966 }
1967 }
1968 func rewriteValueS390X_OpIsNonNil(v *Value) bool {
1969 v_0 := v.Args[0]
1970 b := v.Block
1971 typ := &b.Func.Config.Types
1972 // match: (IsNonNil p)
1973 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPconst p [0]))
1974 for {
1975 p := v_0
1976 v.reset(OpS390XLOCGR)
1977 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
1978 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1979 v0.AuxInt = int64ToAuxInt(0)
1980 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
1981 v1.AuxInt = int64ToAuxInt(1)
1982 v2 := b.NewValue0(v.Pos, OpS390XCMPconst, types.TypeFlags)
1983 v2.AuxInt = int32ToAuxInt(0)
1984 v2.AddArg(p)
1985 v.AddArg3(v0, v1, v2)
1986 return true
1987 }
1988 }
1989 func rewriteValueS390X_OpIsSliceInBounds(v *Value) bool {
1990 v_1 := v.Args[1]
1991 v_0 := v.Args[0]
1992 b := v.Block
1993 typ := &b.Func.Config.Types
1994 // match: (IsSliceInBounds idx len)
1995 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPU idx len))
1996 for {
1997 idx := v_0
1998 len := v_1
1999 v.reset(OpS390XLOCGR)
2000 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2001 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2002 v0.AuxInt = int64ToAuxInt(0)
2003 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2004 v1.AuxInt = int64ToAuxInt(1)
2005 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
2006 v2.AddArg2(idx, len)
2007 v.AddArg3(v0, v1, v2)
2008 return true
2009 }
2010 }
2011 func rewriteValueS390X_OpLeq16(v *Value) bool {
2012 v_1 := v.Args[1]
2013 v_0 := v.Args[0]
2014 b := v.Block
2015 typ := &b.Func.Config.Types
2016 // match: (Leq16 x y)
2017 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y)))
2018 for {
2019 x := v_0
2020 y := v_1
2021 v.reset(OpS390XLOCGR)
2022 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2023 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2024 v0.AuxInt = int64ToAuxInt(0)
2025 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2026 v1.AuxInt = int64ToAuxInt(1)
2027 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2028 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
2029 v3.AddArg(x)
2030 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
2031 v4.AddArg(y)
2032 v2.AddArg2(v3, v4)
2033 v.AddArg3(v0, v1, v2)
2034 return true
2035 }
2036 }
2037 func rewriteValueS390X_OpLeq16U(v *Value) bool {
2038 v_1 := v.Args[1]
2039 v_0 := v.Args[0]
2040 b := v.Block
2041 typ := &b.Func.Config.Types
2042 // match: (Leq16U x y)
2043 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVHZreg x) (MOVHZreg y)))
2044 for {
2045 x := v_0
2046 y := v_1
2047 v.reset(OpS390XLOCGR)
2048 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2049 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2050 v0.AuxInt = int64ToAuxInt(0)
2051 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2052 v1.AuxInt = int64ToAuxInt(1)
2053 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2054 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2055 v3.AddArg(x)
2056 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2057 v4.AddArg(y)
2058 v2.AddArg2(v3, v4)
2059 v.AddArg3(v0, v1, v2)
2060 return true
2061 }
2062 }
2063 func rewriteValueS390X_OpLeq32(v *Value) bool {
2064 v_1 := v.Args[1]
2065 v_0 := v.Args[0]
2066 b := v.Block
2067 typ := &b.Func.Config.Types
2068 // match: (Leq32 x y)
2069 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y))
2070 for {
2071 x := v_0
2072 y := v_1
2073 v.reset(OpS390XLOCGR)
2074 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2075 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2076 v0.AuxInt = int64ToAuxInt(0)
2077 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2078 v1.AuxInt = int64ToAuxInt(1)
2079 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2080 v2.AddArg2(x, y)
2081 v.AddArg3(v0, v1, v2)
2082 return true
2083 }
2084 }
2085 func rewriteValueS390X_OpLeq32F(v *Value) bool {
2086 v_1 := v.Args[1]
2087 v_0 := v.Args[0]
2088 b := v.Block
2089 typ := &b.Func.Config.Types
2090 // match: (Leq32F x y)
2091 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y))
2092 for {
2093 x := v_0
2094 y := v_1
2095 v.reset(OpS390XLOCGR)
2096 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2097 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2098 v0.AuxInt = int64ToAuxInt(0)
2099 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2100 v1.AuxInt = int64ToAuxInt(1)
2101 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags)
2102 v2.AddArg2(x, y)
2103 v.AddArg3(v0, v1, v2)
2104 return true
2105 }
2106 }
2107 func rewriteValueS390X_OpLeq32U(v *Value) bool {
2108 v_1 := v.Args[1]
2109 v_0 := v.Args[0]
2110 b := v.Block
2111 typ := &b.Func.Config.Types
2112 // match: (Leq32U x y)
2113 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU x y))
2114 for {
2115 x := v_0
2116 y := v_1
2117 v.reset(OpS390XLOCGR)
2118 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2119 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2120 v0.AuxInt = int64ToAuxInt(0)
2121 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2122 v1.AuxInt = int64ToAuxInt(1)
2123 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2124 v2.AddArg2(x, y)
2125 v.AddArg3(v0, v1, v2)
2126 return true
2127 }
2128 }
2129 func rewriteValueS390X_OpLeq64(v *Value) bool {
2130 v_1 := v.Args[1]
2131 v_0 := v.Args[0]
2132 b := v.Block
2133 typ := &b.Func.Config.Types
2134 // match: (Leq64 x y)
2135 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
2136 for {
2137 x := v_0
2138 y := v_1
2139 v.reset(OpS390XLOCGR)
2140 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2141 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2142 v0.AuxInt = int64ToAuxInt(0)
2143 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2144 v1.AuxInt = int64ToAuxInt(1)
2145 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
2146 v2.AddArg2(x, y)
2147 v.AddArg3(v0, v1, v2)
2148 return true
2149 }
2150 }
2151 func rewriteValueS390X_OpLeq64F(v *Value) bool {
2152 v_1 := v.Args[1]
2153 v_0 := v.Args[0]
2154 b := v.Block
2155 typ := &b.Func.Config.Types
2156 // match: (Leq64F x y)
2157 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y))
2158 for {
2159 x := v_0
2160 y := v_1
2161 v.reset(OpS390XLOCGR)
2162 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2163 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2164 v0.AuxInt = int64ToAuxInt(0)
2165 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2166 v1.AuxInt = int64ToAuxInt(1)
2167 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags)
2168 v2.AddArg2(x, y)
2169 v.AddArg3(v0, v1, v2)
2170 return true
2171 }
2172 }
2173 func rewriteValueS390X_OpLeq64U(v *Value) bool {
2174 v_1 := v.Args[1]
2175 v_0 := v.Args[0]
2176 b := v.Block
2177 typ := &b.Func.Config.Types
2178 // match: (Leq64U x y)
2179 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPU x y))
2180 for {
2181 x := v_0
2182 y := v_1
2183 v.reset(OpS390XLOCGR)
2184 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2185 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2186 v0.AuxInt = int64ToAuxInt(0)
2187 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2188 v1.AuxInt = int64ToAuxInt(1)
2189 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
2190 v2.AddArg2(x, y)
2191 v.AddArg3(v0, v1, v2)
2192 return true
2193 }
2194 }
2195 func rewriteValueS390X_OpLeq8(v *Value) bool {
2196 v_1 := v.Args[1]
2197 v_0 := v.Args[0]
2198 b := v.Block
2199 typ := &b.Func.Config.Types
2200 // match: (Leq8 x y)
2201 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
2202 for {
2203 x := v_0
2204 y := v_1
2205 v.reset(OpS390XLOCGR)
2206 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2207 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2208 v0.AuxInt = int64ToAuxInt(0)
2209 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2210 v1.AuxInt = int64ToAuxInt(1)
2211 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2212 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
2213 v3.AddArg(x)
2214 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
2215 v4.AddArg(y)
2216 v2.AddArg2(v3, v4)
2217 v.AddArg3(v0, v1, v2)
2218 return true
2219 }
2220 }
2221 func rewriteValueS390X_OpLeq8U(v *Value) bool {
2222 v_1 := v.Args[1]
2223 v_0 := v.Args[0]
2224 b := v.Block
2225 typ := &b.Func.Config.Types
2226 // match: (Leq8U x y)
2227 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVBZreg x) (MOVBZreg y)))
2228 for {
2229 x := v_0
2230 y := v_1
2231 v.reset(OpS390XLOCGR)
2232 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
2233 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2234 v0.AuxInt = int64ToAuxInt(0)
2235 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2236 v1.AuxInt = int64ToAuxInt(1)
2237 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2238 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2239 v3.AddArg(x)
2240 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2241 v4.AddArg(y)
2242 v2.AddArg2(v3, v4)
2243 v.AddArg3(v0, v1, v2)
2244 return true
2245 }
2246 }
2247 func rewriteValueS390X_OpLess16(v *Value) bool {
2248 v_1 := v.Args[1]
2249 v_0 := v.Args[0]
2250 b := v.Block
2251 typ := &b.Func.Config.Types
2252 // match: (Less16 x y)
2253 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y)))
2254 for {
2255 x := v_0
2256 y := v_1
2257 v.reset(OpS390XLOCGR)
2258 v.Aux = s390xCCMaskToAux(s390x.Less)
2259 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2260 v0.AuxInt = int64ToAuxInt(0)
2261 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2262 v1.AuxInt = int64ToAuxInt(1)
2263 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2264 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
2265 v3.AddArg(x)
2266 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
2267 v4.AddArg(y)
2268 v2.AddArg2(v3, v4)
2269 v.AddArg3(v0, v1, v2)
2270 return true
2271 }
2272 }
2273 func rewriteValueS390X_OpLess16U(v *Value) bool {
2274 v_1 := v.Args[1]
2275 v_0 := v.Args[0]
2276 b := v.Block
2277 typ := &b.Func.Config.Types
2278 // match: (Less16U x y)
2279 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVHZreg x) (MOVHZreg y)))
2280 for {
2281 x := v_0
2282 y := v_1
2283 v.reset(OpS390XLOCGR)
2284 v.Aux = s390xCCMaskToAux(s390x.Less)
2285 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2286 v0.AuxInt = int64ToAuxInt(0)
2287 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2288 v1.AuxInt = int64ToAuxInt(1)
2289 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2290 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2291 v3.AddArg(x)
2292 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2293 v4.AddArg(y)
2294 v2.AddArg2(v3, v4)
2295 v.AddArg3(v0, v1, v2)
2296 return true
2297 }
2298 }
2299 func rewriteValueS390X_OpLess32(v *Value) bool {
2300 v_1 := v.Args[1]
2301 v_0 := v.Args[0]
2302 b := v.Block
2303 typ := &b.Func.Config.Types
2304 // match: (Less32 x y)
2305 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y))
2306 for {
2307 x := v_0
2308 y := v_1
2309 v.reset(OpS390XLOCGR)
2310 v.Aux = s390xCCMaskToAux(s390x.Less)
2311 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2312 v0.AuxInt = int64ToAuxInt(0)
2313 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2314 v1.AuxInt = int64ToAuxInt(1)
2315 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2316 v2.AddArg2(x, y)
2317 v.AddArg3(v0, v1, v2)
2318 return true
2319 }
2320 }
2321 func rewriteValueS390X_OpLess32F(v *Value) bool {
2322 v_1 := v.Args[1]
2323 v_0 := v.Args[0]
2324 b := v.Block
2325 typ := &b.Func.Config.Types
2326 // match: (Less32F x y)
2327 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y))
2328 for {
2329 x := v_0
2330 y := v_1
2331 v.reset(OpS390XLOCGR)
2332 v.Aux = s390xCCMaskToAux(s390x.Less)
2333 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2334 v0.AuxInt = int64ToAuxInt(0)
2335 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2336 v1.AuxInt = int64ToAuxInt(1)
2337 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags)
2338 v2.AddArg2(x, y)
2339 v.AddArg3(v0, v1, v2)
2340 return true
2341 }
2342 }
2343 func rewriteValueS390X_OpLess32U(v *Value) bool {
2344 v_1 := v.Args[1]
2345 v_0 := v.Args[0]
2346 b := v.Block
2347 typ := &b.Func.Config.Types
2348 // match: (Less32U x y)
2349 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU x y))
2350 for {
2351 x := v_0
2352 y := v_1
2353 v.reset(OpS390XLOCGR)
2354 v.Aux = s390xCCMaskToAux(s390x.Less)
2355 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2356 v0.AuxInt = int64ToAuxInt(0)
2357 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2358 v1.AuxInt = int64ToAuxInt(1)
2359 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2360 v2.AddArg2(x, y)
2361 v.AddArg3(v0, v1, v2)
2362 return true
2363 }
2364 }
2365 func rewriteValueS390X_OpLess64(v *Value) bool {
2366 v_1 := v.Args[1]
2367 v_0 := v.Args[0]
2368 b := v.Block
2369 typ := &b.Func.Config.Types
2370 // match: (Less64 x y)
2371 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
2372 for {
2373 x := v_0
2374 y := v_1
2375 v.reset(OpS390XLOCGR)
2376 v.Aux = s390xCCMaskToAux(s390x.Less)
2377 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2378 v0.AuxInt = int64ToAuxInt(0)
2379 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2380 v1.AuxInt = int64ToAuxInt(1)
2381 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
2382 v2.AddArg2(x, y)
2383 v.AddArg3(v0, v1, v2)
2384 return true
2385 }
2386 }
2387 func rewriteValueS390X_OpLess64F(v *Value) bool {
2388 v_1 := v.Args[1]
2389 v_0 := v.Args[0]
2390 b := v.Block
2391 typ := &b.Func.Config.Types
2392 // match: (Less64F x y)
2393 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y))
2394 for {
2395 x := v_0
2396 y := v_1
2397 v.reset(OpS390XLOCGR)
2398 v.Aux = s390xCCMaskToAux(s390x.Less)
2399 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2400 v0.AuxInt = int64ToAuxInt(0)
2401 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2402 v1.AuxInt = int64ToAuxInt(1)
2403 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags)
2404 v2.AddArg2(x, y)
2405 v.AddArg3(v0, v1, v2)
2406 return true
2407 }
2408 }
2409 func rewriteValueS390X_OpLess64U(v *Value) bool {
2410 v_1 := v.Args[1]
2411 v_0 := v.Args[0]
2412 b := v.Block
2413 typ := &b.Func.Config.Types
2414 // match: (Less64U x y)
2415 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPU x y))
2416 for {
2417 x := v_0
2418 y := v_1
2419 v.reset(OpS390XLOCGR)
2420 v.Aux = s390xCCMaskToAux(s390x.Less)
2421 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2422 v0.AuxInt = int64ToAuxInt(0)
2423 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2424 v1.AuxInt = int64ToAuxInt(1)
2425 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
2426 v2.AddArg2(x, y)
2427 v.AddArg3(v0, v1, v2)
2428 return true
2429 }
2430 }
2431 func rewriteValueS390X_OpLess8(v *Value) bool {
2432 v_1 := v.Args[1]
2433 v_0 := v.Args[0]
2434 b := v.Block
2435 typ := &b.Func.Config.Types
2436 // match: (Less8 x y)
2437 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
2438 for {
2439 x := v_0
2440 y := v_1
2441 v.reset(OpS390XLOCGR)
2442 v.Aux = s390xCCMaskToAux(s390x.Less)
2443 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2444 v0.AuxInt = int64ToAuxInt(0)
2445 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2446 v1.AuxInt = int64ToAuxInt(1)
2447 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
2448 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
2449 v3.AddArg(x)
2450 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
2451 v4.AddArg(y)
2452 v2.AddArg2(v3, v4)
2453 v.AddArg3(v0, v1, v2)
2454 return true
2455 }
2456 }
2457 func rewriteValueS390X_OpLess8U(v *Value) bool {
2458 v_1 := v.Args[1]
2459 v_0 := v.Args[0]
2460 b := v.Block
2461 typ := &b.Func.Config.Types
2462 // match: (Less8U x y)
2463 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVBZreg x) (MOVBZreg y)))
2464 for {
2465 x := v_0
2466 y := v_1
2467 v.reset(OpS390XLOCGR)
2468 v.Aux = s390xCCMaskToAux(s390x.Less)
2469 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2470 v0.AuxInt = int64ToAuxInt(0)
2471 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2472 v1.AuxInt = int64ToAuxInt(1)
2473 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
2474 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2475 v3.AddArg(x)
2476 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2477 v4.AddArg(y)
2478 v2.AddArg2(v3, v4)
2479 v.AddArg3(v0, v1, v2)
2480 return true
2481 }
2482 }
2483 func rewriteValueS390X_OpLoad(v *Value) bool {
2484 v_1 := v.Args[1]
2485 v_0 := v.Args[0]
2486 // match: (Load <t> ptr mem)
2487 // cond: (is64BitInt(t) || isPtr(t))
2488 // result: (MOVDload ptr mem)
2489 for {
2490 t := v.Type
2491 ptr := v_0
2492 mem := v_1
2493 if !(is64BitInt(t) || isPtr(t)) {
2494 break
2495 }
2496 v.reset(OpS390XMOVDload)
2497 v.AddArg2(ptr, mem)
2498 return true
2499 }
2500 // match: (Load <t> ptr mem)
2501 // cond: is32BitInt(t) && t.IsSigned()
2502 // result: (MOVWload ptr mem)
2503 for {
2504 t := v.Type
2505 ptr := v_0
2506 mem := v_1
2507 if !(is32BitInt(t) && t.IsSigned()) {
2508 break
2509 }
2510 v.reset(OpS390XMOVWload)
2511 v.AddArg2(ptr, mem)
2512 return true
2513 }
2514 // match: (Load <t> ptr mem)
2515 // cond: is32BitInt(t) && !t.IsSigned()
2516 // result: (MOVWZload ptr mem)
2517 for {
2518 t := v.Type
2519 ptr := v_0
2520 mem := v_1
2521 if !(is32BitInt(t) && !t.IsSigned()) {
2522 break
2523 }
2524 v.reset(OpS390XMOVWZload)
2525 v.AddArg2(ptr, mem)
2526 return true
2527 }
2528 // match: (Load <t> ptr mem)
2529 // cond: is16BitInt(t) && t.IsSigned()
2530 // result: (MOVHload ptr mem)
2531 for {
2532 t := v.Type
2533 ptr := v_0
2534 mem := v_1
2535 if !(is16BitInt(t) && t.IsSigned()) {
2536 break
2537 }
2538 v.reset(OpS390XMOVHload)
2539 v.AddArg2(ptr, mem)
2540 return true
2541 }
2542 // match: (Load <t> ptr mem)
2543 // cond: is16BitInt(t) && !t.IsSigned()
2544 // result: (MOVHZload ptr mem)
2545 for {
2546 t := v.Type
2547 ptr := v_0
2548 mem := v_1
2549 if !(is16BitInt(t) && !t.IsSigned()) {
2550 break
2551 }
2552 v.reset(OpS390XMOVHZload)
2553 v.AddArg2(ptr, mem)
2554 return true
2555 }
2556 // match: (Load <t> ptr mem)
2557 // cond: is8BitInt(t) && t.IsSigned()
2558 // result: (MOVBload ptr mem)
2559 for {
2560 t := v.Type
2561 ptr := v_0
2562 mem := v_1
2563 if !(is8BitInt(t) && t.IsSigned()) {
2564 break
2565 }
2566 v.reset(OpS390XMOVBload)
2567 v.AddArg2(ptr, mem)
2568 return true
2569 }
2570 // match: (Load <t> ptr mem)
2571 // cond: (t.IsBoolean() || (is8BitInt(t) && !t.IsSigned()))
2572 // result: (MOVBZload ptr mem)
2573 for {
2574 t := v.Type
2575 ptr := v_0
2576 mem := v_1
2577 if !(t.IsBoolean() || (is8BitInt(t) && !t.IsSigned())) {
2578 break
2579 }
2580 v.reset(OpS390XMOVBZload)
2581 v.AddArg2(ptr, mem)
2582 return true
2583 }
2584 // match: (Load <t> ptr mem)
2585 // cond: is32BitFloat(t)
2586 // result: (FMOVSload ptr mem)
2587 for {
2588 t := v.Type
2589 ptr := v_0
2590 mem := v_1
2591 if !(is32BitFloat(t)) {
2592 break
2593 }
2594 v.reset(OpS390XFMOVSload)
2595 v.AddArg2(ptr, mem)
2596 return true
2597 }
2598 // match: (Load <t> ptr mem)
2599 // cond: is64BitFloat(t)
2600 // result: (FMOVDload ptr mem)
2601 for {
2602 t := v.Type
2603 ptr := v_0
2604 mem := v_1
2605 if !(is64BitFloat(t)) {
2606 break
2607 }
2608 v.reset(OpS390XFMOVDload)
2609 v.AddArg2(ptr, mem)
2610 return true
2611 }
2612 return false
2613 }
2614 func rewriteValueS390X_OpLocalAddr(v *Value) bool {
2615 v_1 := v.Args[1]
2616 v_0 := v.Args[0]
2617 b := v.Block
2618 typ := &b.Func.Config.Types
2619 // match: (LocalAddr <t> {sym} base mem)
2620 // cond: t.Elem().HasPointers()
2621 // result: (MOVDaddr {sym} (SPanchored base mem))
2622 for {
2623 t := v.Type
2624 sym := auxToSym(v.Aux)
2625 base := v_0
2626 mem := v_1
2627 if !(t.Elem().HasPointers()) {
2628 break
2629 }
2630 v.reset(OpS390XMOVDaddr)
2631 v.Aux = symToAux(sym)
2632 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr)
2633 v0.AddArg2(base, mem)
2634 v.AddArg(v0)
2635 return true
2636 }
2637 // match: (LocalAddr <t> {sym} base _)
2638 // cond: !t.Elem().HasPointers()
2639 // result: (MOVDaddr {sym} base)
2640 for {
2641 t := v.Type
2642 sym := auxToSym(v.Aux)
2643 base := v_0
2644 if !(!t.Elem().HasPointers()) {
2645 break
2646 }
2647 v.reset(OpS390XMOVDaddr)
2648 v.Aux = symToAux(sym)
2649 v.AddArg(base)
2650 return true
2651 }
2652 return false
2653 }
2654 func rewriteValueS390X_OpLsh16x16(v *Value) bool {
2655 v_1 := v.Args[1]
2656 v_0 := v.Args[0]
2657 b := v.Block
2658 typ := &b.Func.Config.Types
2659 // match: (Lsh16x16 x y)
2660 // cond: shiftIsBounded(v)
2661 // result: (SLW x y)
2662 for {
2663 x := v_0
2664 y := v_1
2665 if !(shiftIsBounded(v)) {
2666 break
2667 }
2668 v.reset(OpS390XSLW)
2669 v.AddArg2(x, y)
2670 return true
2671 }
2672 // match: (Lsh16x16 <t> x y)
2673 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
2674 for {
2675 t := v.Type
2676 x := v_0
2677 y := v_1
2678 v.reset(OpS390XLOCGR)
2679 v.Type = t
2680 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2681 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2682 v0.AddArg2(x, y)
2683 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2684 v1.AuxInt = int64ToAuxInt(0)
2685 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2686 v2.AuxInt = int32ToAuxInt(64)
2687 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2688 v3.AddArg(y)
2689 v2.AddArg(v3)
2690 v.AddArg3(v0, v1, v2)
2691 return true
2692 }
2693 }
2694 func rewriteValueS390X_OpLsh16x32(v *Value) bool {
2695 v_1 := v.Args[1]
2696 v_0 := v.Args[0]
2697 b := v.Block
2698 typ := &b.Func.Config.Types
2699 // match: (Lsh16x32 x y)
2700 // cond: shiftIsBounded(v)
2701 // result: (SLW x y)
2702 for {
2703 x := v_0
2704 y := v_1
2705 if !(shiftIsBounded(v)) {
2706 break
2707 }
2708 v.reset(OpS390XSLW)
2709 v.AddArg2(x, y)
2710 return true
2711 }
2712 // match: (Lsh16x32 <t> x y)
2713 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
2714 for {
2715 t := v.Type
2716 x := v_0
2717 y := v_1
2718 v.reset(OpS390XLOCGR)
2719 v.Type = t
2720 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2721 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2722 v0.AddArg2(x, y)
2723 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2724 v1.AuxInt = int64ToAuxInt(0)
2725 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2726 v2.AuxInt = int32ToAuxInt(64)
2727 v2.AddArg(y)
2728 v.AddArg3(v0, v1, v2)
2729 return true
2730 }
2731 }
2732 func rewriteValueS390X_OpLsh16x64(v *Value) bool {
2733 v_1 := v.Args[1]
2734 v_0 := v.Args[0]
2735 b := v.Block
2736 typ := &b.Func.Config.Types
2737 // match: (Lsh16x64 x y)
2738 // cond: shiftIsBounded(v)
2739 // result: (SLW x y)
2740 for {
2741 x := v_0
2742 y := v_1
2743 if !(shiftIsBounded(v)) {
2744 break
2745 }
2746 v.reset(OpS390XSLW)
2747 v.AddArg2(x, y)
2748 return true
2749 }
2750 // match: (Lsh16x64 <t> x y)
2751 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
2752 for {
2753 t := v.Type
2754 x := v_0
2755 y := v_1
2756 v.reset(OpS390XLOCGR)
2757 v.Type = t
2758 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2759 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2760 v0.AddArg2(x, y)
2761 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2762 v1.AuxInt = int64ToAuxInt(0)
2763 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
2764 v2.AuxInt = int32ToAuxInt(64)
2765 v2.AddArg(y)
2766 v.AddArg3(v0, v1, v2)
2767 return true
2768 }
2769 }
2770 func rewriteValueS390X_OpLsh16x8(v *Value) bool {
2771 v_1 := v.Args[1]
2772 v_0 := v.Args[0]
2773 b := v.Block
2774 typ := &b.Func.Config.Types
2775 // match: (Lsh16x8 x y)
2776 // cond: shiftIsBounded(v)
2777 // result: (SLW x y)
2778 for {
2779 x := v_0
2780 y := v_1
2781 if !(shiftIsBounded(v)) {
2782 break
2783 }
2784 v.reset(OpS390XSLW)
2785 v.AddArg2(x, y)
2786 return true
2787 }
2788 // match: (Lsh16x8 <t> x y)
2789 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
2790 for {
2791 t := v.Type
2792 x := v_0
2793 y := v_1
2794 v.reset(OpS390XLOCGR)
2795 v.Type = t
2796 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2797 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2798 v0.AddArg2(x, y)
2799 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2800 v1.AuxInt = int64ToAuxInt(0)
2801 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2802 v2.AuxInt = int32ToAuxInt(64)
2803 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2804 v3.AddArg(y)
2805 v2.AddArg(v3)
2806 v.AddArg3(v0, v1, v2)
2807 return true
2808 }
2809 }
2810 func rewriteValueS390X_OpLsh32x16(v *Value) bool {
2811 v_1 := v.Args[1]
2812 v_0 := v.Args[0]
2813 b := v.Block
2814 typ := &b.Func.Config.Types
2815 // match: (Lsh32x16 x y)
2816 // cond: shiftIsBounded(v)
2817 // result: (SLW x y)
2818 for {
2819 x := v_0
2820 y := v_1
2821 if !(shiftIsBounded(v)) {
2822 break
2823 }
2824 v.reset(OpS390XSLW)
2825 v.AddArg2(x, y)
2826 return true
2827 }
2828 // match: (Lsh32x16 <t> x y)
2829 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
2830 for {
2831 t := v.Type
2832 x := v_0
2833 y := v_1
2834 v.reset(OpS390XLOCGR)
2835 v.Type = t
2836 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2837 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2838 v0.AddArg2(x, y)
2839 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2840 v1.AuxInt = int64ToAuxInt(0)
2841 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2842 v2.AuxInt = int32ToAuxInt(64)
2843 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
2844 v3.AddArg(y)
2845 v2.AddArg(v3)
2846 v.AddArg3(v0, v1, v2)
2847 return true
2848 }
2849 }
2850 func rewriteValueS390X_OpLsh32x32(v *Value) bool {
2851 v_1 := v.Args[1]
2852 v_0 := v.Args[0]
2853 b := v.Block
2854 typ := &b.Func.Config.Types
2855 // match: (Lsh32x32 x y)
2856 // cond: shiftIsBounded(v)
2857 // result: (SLW x y)
2858 for {
2859 x := v_0
2860 y := v_1
2861 if !(shiftIsBounded(v)) {
2862 break
2863 }
2864 v.reset(OpS390XSLW)
2865 v.AddArg2(x, y)
2866 return true
2867 }
2868 // match: (Lsh32x32 <t> x y)
2869 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
2870 for {
2871 t := v.Type
2872 x := v_0
2873 y := v_1
2874 v.reset(OpS390XLOCGR)
2875 v.Type = t
2876 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2877 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2878 v0.AddArg2(x, y)
2879 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2880 v1.AuxInt = int64ToAuxInt(0)
2881 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2882 v2.AuxInt = int32ToAuxInt(64)
2883 v2.AddArg(y)
2884 v.AddArg3(v0, v1, v2)
2885 return true
2886 }
2887 }
2888 func rewriteValueS390X_OpLsh32x64(v *Value) bool {
2889 v_1 := v.Args[1]
2890 v_0 := v.Args[0]
2891 b := v.Block
2892 typ := &b.Func.Config.Types
2893 // match: (Lsh32x64 x y)
2894 // cond: shiftIsBounded(v)
2895 // result: (SLW x y)
2896 for {
2897 x := v_0
2898 y := v_1
2899 if !(shiftIsBounded(v)) {
2900 break
2901 }
2902 v.reset(OpS390XSLW)
2903 v.AddArg2(x, y)
2904 return true
2905 }
2906 // match: (Lsh32x64 <t> x y)
2907 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
2908 for {
2909 t := v.Type
2910 x := v_0
2911 y := v_1
2912 v.reset(OpS390XLOCGR)
2913 v.Type = t
2914 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2915 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2916 v0.AddArg2(x, y)
2917 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2918 v1.AuxInt = int64ToAuxInt(0)
2919 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
2920 v2.AuxInt = int32ToAuxInt(64)
2921 v2.AddArg(y)
2922 v.AddArg3(v0, v1, v2)
2923 return true
2924 }
2925 }
2926 func rewriteValueS390X_OpLsh32x8(v *Value) bool {
2927 v_1 := v.Args[1]
2928 v_0 := v.Args[0]
2929 b := v.Block
2930 typ := &b.Func.Config.Types
2931 // match: (Lsh32x8 x y)
2932 // cond: shiftIsBounded(v)
2933 // result: (SLW x y)
2934 for {
2935 x := v_0
2936 y := v_1
2937 if !(shiftIsBounded(v)) {
2938 break
2939 }
2940 v.reset(OpS390XSLW)
2941 v.AddArg2(x, y)
2942 return true
2943 }
2944 // match: (Lsh32x8 <t> x y)
2945 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
2946 for {
2947 t := v.Type
2948 x := v_0
2949 y := v_1
2950 v.reset(OpS390XLOCGR)
2951 v.Type = t
2952 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2953 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
2954 v0.AddArg2(x, y)
2955 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2956 v1.AuxInt = int64ToAuxInt(0)
2957 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2958 v2.AuxInt = int32ToAuxInt(64)
2959 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
2960 v3.AddArg(y)
2961 v2.AddArg(v3)
2962 v.AddArg3(v0, v1, v2)
2963 return true
2964 }
2965 }
2966 func rewriteValueS390X_OpLsh64x16(v *Value) bool {
2967 v_1 := v.Args[1]
2968 v_0 := v.Args[0]
2969 b := v.Block
2970 typ := &b.Func.Config.Types
2971 // match: (Lsh64x16 x y)
2972 // cond: shiftIsBounded(v)
2973 // result: (SLD x y)
2974 for {
2975 x := v_0
2976 y := v_1
2977 if !(shiftIsBounded(v)) {
2978 break
2979 }
2980 v.reset(OpS390XSLD)
2981 v.AddArg2(x, y)
2982 return true
2983 }
2984 // match: (Lsh64x16 <t> x y)
2985 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
2986 for {
2987 t := v.Type
2988 x := v_0
2989 y := v_1
2990 v.reset(OpS390XLOCGR)
2991 v.Type = t
2992 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
2993 v0 := b.NewValue0(v.Pos, OpS390XSLD, t)
2994 v0.AddArg2(x, y)
2995 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
2996 v1.AuxInt = int64ToAuxInt(0)
2997 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
2998 v2.AuxInt = int32ToAuxInt(64)
2999 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
3000 v3.AddArg(y)
3001 v2.AddArg(v3)
3002 v.AddArg3(v0, v1, v2)
3003 return true
3004 }
3005 }
3006 func rewriteValueS390X_OpLsh64x32(v *Value) bool {
3007 v_1 := v.Args[1]
3008 v_0 := v.Args[0]
3009 b := v.Block
3010 typ := &b.Func.Config.Types
3011 // match: (Lsh64x32 x y)
3012 // cond: shiftIsBounded(v)
3013 // result: (SLD x y)
3014 for {
3015 x := v_0
3016 y := v_1
3017 if !(shiftIsBounded(v)) {
3018 break
3019 }
3020 v.reset(OpS390XSLD)
3021 v.AddArg2(x, y)
3022 return true
3023 }
3024 // match: (Lsh64x32 <t> x y)
3025 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
3026 for {
3027 t := v.Type
3028 x := v_0
3029 y := v_1
3030 v.reset(OpS390XLOCGR)
3031 v.Type = t
3032 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3033 v0 := b.NewValue0(v.Pos, OpS390XSLD, t)
3034 v0.AddArg2(x, y)
3035 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3036 v1.AuxInt = int64ToAuxInt(0)
3037 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3038 v2.AuxInt = int32ToAuxInt(64)
3039 v2.AddArg(y)
3040 v.AddArg3(v0, v1, v2)
3041 return true
3042 }
3043 }
3044 func rewriteValueS390X_OpLsh64x64(v *Value) bool {
3045 v_1 := v.Args[1]
3046 v_0 := v.Args[0]
3047 b := v.Block
3048 typ := &b.Func.Config.Types
3049 // match: (Lsh64x64 x y)
3050 // cond: shiftIsBounded(v)
3051 // result: (SLD x y)
3052 for {
3053 x := v_0
3054 y := v_1
3055 if !(shiftIsBounded(v)) {
3056 break
3057 }
3058 v.reset(OpS390XSLD)
3059 v.AddArg2(x, y)
3060 return true
3061 }
3062 // match: (Lsh64x64 <t> x y)
3063 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
3064 for {
3065 t := v.Type
3066 x := v_0
3067 y := v_1
3068 v.reset(OpS390XLOCGR)
3069 v.Type = t
3070 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3071 v0 := b.NewValue0(v.Pos, OpS390XSLD, t)
3072 v0.AddArg2(x, y)
3073 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3074 v1.AuxInt = int64ToAuxInt(0)
3075 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
3076 v2.AuxInt = int32ToAuxInt(64)
3077 v2.AddArg(y)
3078 v.AddArg3(v0, v1, v2)
3079 return true
3080 }
3081 }
3082 func rewriteValueS390X_OpLsh64x8(v *Value) bool {
3083 v_1 := v.Args[1]
3084 v_0 := v.Args[0]
3085 b := v.Block
3086 typ := &b.Func.Config.Types
3087 // match: (Lsh64x8 x y)
3088 // cond: shiftIsBounded(v)
3089 // result: (SLD x y)
3090 for {
3091 x := v_0
3092 y := v_1
3093 if !(shiftIsBounded(v)) {
3094 break
3095 }
3096 v.reset(OpS390XSLD)
3097 v.AddArg2(x, y)
3098 return true
3099 }
3100 // match: (Lsh64x8 <t> x y)
3101 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
3102 for {
3103 t := v.Type
3104 x := v_0
3105 y := v_1
3106 v.reset(OpS390XLOCGR)
3107 v.Type = t
3108 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3109 v0 := b.NewValue0(v.Pos, OpS390XSLD, t)
3110 v0.AddArg2(x, y)
3111 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3112 v1.AuxInt = int64ToAuxInt(0)
3113 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3114 v2.AuxInt = int32ToAuxInt(64)
3115 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
3116 v3.AddArg(y)
3117 v2.AddArg(v3)
3118 v.AddArg3(v0, v1, v2)
3119 return true
3120 }
3121 }
3122 func rewriteValueS390X_OpLsh8x16(v *Value) bool {
3123 v_1 := v.Args[1]
3124 v_0 := v.Args[0]
3125 b := v.Block
3126 typ := &b.Func.Config.Types
3127 // match: (Lsh8x16 x y)
3128 // cond: shiftIsBounded(v)
3129 // result: (SLW x y)
3130 for {
3131 x := v_0
3132 y := v_1
3133 if !(shiftIsBounded(v)) {
3134 break
3135 }
3136 v.reset(OpS390XSLW)
3137 v.AddArg2(x, y)
3138 return true
3139 }
3140 // match: (Lsh8x16 <t> x y)
3141 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
3142 for {
3143 t := v.Type
3144 x := v_0
3145 y := v_1
3146 v.reset(OpS390XLOCGR)
3147 v.Type = t
3148 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3149 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
3150 v0.AddArg2(x, y)
3151 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3152 v1.AuxInt = int64ToAuxInt(0)
3153 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3154 v2.AuxInt = int32ToAuxInt(64)
3155 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
3156 v3.AddArg(y)
3157 v2.AddArg(v3)
3158 v.AddArg3(v0, v1, v2)
3159 return true
3160 }
3161 }
3162 func rewriteValueS390X_OpLsh8x32(v *Value) bool {
3163 v_1 := v.Args[1]
3164 v_0 := v.Args[0]
3165 b := v.Block
3166 typ := &b.Func.Config.Types
3167 // match: (Lsh8x32 x y)
3168 // cond: shiftIsBounded(v)
3169 // result: (SLW x y)
3170 for {
3171 x := v_0
3172 y := v_1
3173 if !(shiftIsBounded(v)) {
3174 break
3175 }
3176 v.reset(OpS390XSLW)
3177 v.AddArg2(x, y)
3178 return true
3179 }
3180 // match: (Lsh8x32 <t> x y)
3181 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
3182 for {
3183 t := v.Type
3184 x := v_0
3185 y := v_1
3186 v.reset(OpS390XLOCGR)
3187 v.Type = t
3188 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3189 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
3190 v0.AddArg2(x, y)
3191 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3192 v1.AuxInt = int64ToAuxInt(0)
3193 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3194 v2.AuxInt = int32ToAuxInt(64)
3195 v2.AddArg(y)
3196 v.AddArg3(v0, v1, v2)
3197 return true
3198 }
3199 }
3200 func rewriteValueS390X_OpLsh8x64(v *Value) bool {
3201 v_1 := v.Args[1]
3202 v_0 := v.Args[0]
3203 b := v.Block
3204 typ := &b.Func.Config.Types
3205 // match: (Lsh8x64 x y)
3206 // cond: shiftIsBounded(v)
3207 // result: (SLW x y)
3208 for {
3209 x := v_0
3210 y := v_1
3211 if !(shiftIsBounded(v)) {
3212 break
3213 }
3214 v.reset(OpS390XSLW)
3215 v.AddArg2(x, y)
3216 return true
3217 }
3218 // match: (Lsh8x64 <t> x y)
3219 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
3220 for {
3221 t := v.Type
3222 x := v_0
3223 y := v_1
3224 v.reset(OpS390XLOCGR)
3225 v.Type = t
3226 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3227 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
3228 v0.AddArg2(x, y)
3229 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3230 v1.AuxInt = int64ToAuxInt(0)
3231 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
3232 v2.AuxInt = int32ToAuxInt(64)
3233 v2.AddArg(y)
3234 v.AddArg3(v0, v1, v2)
3235 return true
3236 }
3237 }
3238 func rewriteValueS390X_OpLsh8x8(v *Value) bool {
3239 v_1 := v.Args[1]
3240 v_0 := v.Args[0]
3241 b := v.Block
3242 typ := &b.Func.Config.Types
3243 // match: (Lsh8x8 x y)
3244 // cond: shiftIsBounded(v)
3245 // result: (SLW x y)
3246 for {
3247 x := v_0
3248 y := v_1
3249 if !(shiftIsBounded(v)) {
3250 break
3251 }
3252 v.reset(OpS390XSLW)
3253 v.AddArg2(x, y)
3254 return true
3255 }
3256 // match: (Lsh8x8 <t> x y)
3257 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
3258 for {
3259 t := v.Type
3260 x := v_0
3261 y := v_1
3262 v.reset(OpS390XLOCGR)
3263 v.Type = t
3264 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
3265 v0 := b.NewValue0(v.Pos, OpS390XSLW, t)
3266 v0.AddArg2(x, y)
3267 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3268 v1.AuxInt = int64ToAuxInt(0)
3269 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
3270 v2.AuxInt = int32ToAuxInt(64)
3271 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
3272 v3.AddArg(y)
3273 v2.AddArg(v3)
3274 v.AddArg3(v0, v1, v2)
3275 return true
3276 }
3277 }
3278 func rewriteValueS390X_OpMod16(v *Value) bool {
3279 v_1 := v.Args[1]
3280 v_0 := v.Args[0]
3281 b := v.Block
3282 typ := &b.Func.Config.Types
3283 // match: (Mod16 x y)
3284 // result: (MODW (MOVHreg x) (MOVHreg y))
3285 for {
3286 x := v_0
3287 y := v_1
3288 v.reset(OpS390XMODW)
3289 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
3290 v0.AddArg(x)
3291 v1 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
3292 v1.AddArg(y)
3293 v.AddArg2(v0, v1)
3294 return true
3295 }
3296 }
3297 func rewriteValueS390X_OpMod16u(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: (Mod16u x y)
3303 // result: (MODWU (MOVHZreg x) (MOVHZreg y))
3304 for {
3305 x := v_0
3306 y := v_1
3307 v.reset(OpS390XMODWU)
3308 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
3309 v0.AddArg(x)
3310 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
3311 v1.AddArg(y)
3312 v.AddArg2(v0, v1)
3313 return true
3314 }
3315 }
3316 func rewriteValueS390X_OpMod32(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: (Mod32 x y)
3322 // result: (MODW (MOVWreg x) y)
3323 for {
3324 x := v_0
3325 y := v_1
3326 v.reset(OpS390XMODW)
3327 v0 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64)
3328 v0.AddArg(x)
3329 v.AddArg2(v0, y)
3330 return true
3331 }
3332 }
3333 func rewriteValueS390X_OpMod32u(v *Value) bool {
3334 v_1 := v.Args[1]
3335 v_0 := v.Args[0]
3336 b := v.Block
3337 typ := &b.Func.Config.Types
3338 // match: (Mod32u x y)
3339 // result: (MODWU (MOVWZreg x) y)
3340 for {
3341 x := v_0
3342 y := v_1
3343 v.reset(OpS390XMODWU)
3344 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
3345 v0.AddArg(x)
3346 v.AddArg2(v0, y)
3347 return true
3348 }
3349 }
3350 func rewriteValueS390X_OpMod64(v *Value) bool {
3351 v_1 := v.Args[1]
3352 v_0 := v.Args[0]
3353 // match: (Mod64 x y)
3354 // result: (MODD x y)
3355 for {
3356 x := v_0
3357 y := v_1
3358 v.reset(OpS390XMODD)
3359 v.AddArg2(x, y)
3360 return true
3361 }
3362 }
3363 func rewriteValueS390X_OpMod8(v *Value) bool {
3364 v_1 := v.Args[1]
3365 v_0 := v.Args[0]
3366 b := v.Block
3367 typ := &b.Func.Config.Types
3368 // match: (Mod8 x y)
3369 // result: (MODW (MOVBreg x) (MOVBreg y))
3370 for {
3371 x := v_0
3372 y := v_1
3373 v.reset(OpS390XMODW)
3374 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3375 v0.AddArg(x)
3376 v1 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3377 v1.AddArg(y)
3378 v.AddArg2(v0, v1)
3379 return true
3380 }
3381 }
3382 func rewriteValueS390X_OpMod8u(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: (Mod8u x y)
3388 // result: (MODWU (MOVBZreg x) (MOVBZreg y))
3389 for {
3390 x := v_0
3391 y := v_1
3392 v.reset(OpS390XMODWU)
3393 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
3394 v0.AddArg(x)
3395 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
3396 v1.AddArg(y)
3397 v.AddArg2(v0, v1)
3398 return true
3399 }
3400 }
3401 func rewriteValueS390X_OpMove(v *Value) bool {
3402 v_2 := v.Args[2]
3403 v_1 := v.Args[1]
3404 v_0 := v.Args[0]
3405 b := v.Block
3406 typ := &b.Func.Config.Types
3407 // match: (Move [0] _ _ mem)
3408 // result: mem
3409 for {
3410 if auxIntToInt64(v.AuxInt) != 0 {
3411 break
3412 }
3413 mem := v_2
3414 v.copyOf(mem)
3415 return true
3416 }
3417 // match: (Move [1] dst src mem)
3418 // result: (MOVBstore dst (MOVBZload src mem) mem)
3419 for {
3420 if auxIntToInt64(v.AuxInt) != 1 {
3421 break
3422 }
3423 dst := v_0
3424 src := v_1
3425 mem := v_2
3426 v.reset(OpS390XMOVBstore)
3427 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8)
3428 v0.AddArg2(src, mem)
3429 v.AddArg3(dst, v0, mem)
3430 return true
3431 }
3432 // match: (Move [2] dst src mem)
3433 // result: (MOVHstore dst (MOVHZload src mem) mem)
3434 for {
3435 if auxIntToInt64(v.AuxInt) != 2 {
3436 break
3437 }
3438 dst := v_0
3439 src := v_1
3440 mem := v_2
3441 v.reset(OpS390XMOVHstore)
3442 v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
3443 v0.AddArg2(src, mem)
3444 v.AddArg3(dst, v0, mem)
3445 return true
3446 }
3447 // match: (Move [4] dst src mem)
3448 // result: (MOVWstore dst (MOVWZload src mem) mem)
3449 for {
3450 if auxIntToInt64(v.AuxInt) != 4 {
3451 break
3452 }
3453 dst := v_0
3454 src := v_1
3455 mem := v_2
3456 v.reset(OpS390XMOVWstore)
3457 v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
3458 v0.AddArg2(src, mem)
3459 v.AddArg3(dst, v0, mem)
3460 return true
3461 }
3462 // match: (Move [8] dst src mem)
3463 // result: (MOVDstore dst (MOVDload src mem) mem)
3464 for {
3465 if auxIntToInt64(v.AuxInt) != 8 {
3466 break
3467 }
3468 dst := v_0
3469 src := v_1
3470 mem := v_2
3471 v.reset(OpS390XMOVDstore)
3472 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3473 v0.AddArg2(src, mem)
3474 v.AddArg3(dst, v0, mem)
3475 return true
3476 }
3477 // match: (Move [16] dst src mem)
3478 // result: (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem))
3479 for {
3480 if auxIntToInt64(v.AuxInt) != 16 {
3481 break
3482 }
3483 dst := v_0
3484 src := v_1
3485 mem := v_2
3486 v.reset(OpS390XMOVDstore)
3487 v.AuxInt = int32ToAuxInt(8)
3488 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3489 v0.AuxInt = int32ToAuxInt(8)
3490 v0.AddArg2(src, mem)
3491 v1 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem)
3492 v2 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3493 v2.AddArg2(src, mem)
3494 v1.AddArg3(dst, v2, mem)
3495 v.AddArg3(dst, v0, v1)
3496 return true
3497 }
3498 // match: (Move [24] dst src mem)
3499 // result: (MOVDstore [16] dst (MOVDload [16] src mem) (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem)))
3500 for {
3501 if auxIntToInt64(v.AuxInt) != 24 {
3502 break
3503 }
3504 dst := v_0
3505 src := v_1
3506 mem := v_2
3507 v.reset(OpS390XMOVDstore)
3508 v.AuxInt = int32ToAuxInt(16)
3509 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3510 v0.AuxInt = int32ToAuxInt(16)
3511 v0.AddArg2(src, mem)
3512 v1 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem)
3513 v1.AuxInt = int32ToAuxInt(8)
3514 v2 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3515 v2.AuxInt = int32ToAuxInt(8)
3516 v2.AddArg2(src, mem)
3517 v3 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem)
3518 v4 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64)
3519 v4.AddArg2(src, mem)
3520 v3.AddArg3(dst, v4, mem)
3521 v1.AddArg3(dst, v2, v3)
3522 v.AddArg3(dst, v0, v1)
3523 return true
3524 }
3525 // match: (Move [3] dst src mem)
3526 // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHZload src mem) mem))
3527 for {
3528 if auxIntToInt64(v.AuxInt) != 3 {
3529 break
3530 }
3531 dst := v_0
3532 src := v_1
3533 mem := v_2
3534 v.reset(OpS390XMOVBstore)
3535 v.AuxInt = int32ToAuxInt(2)
3536 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8)
3537 v0.AuxInt = int32ToAuxInt(2)
3538 v0.AddArg2(src, mem)
3539 v1 := b.NewValue0(v.Pos, OpS390XMOVHstore, types.TypeMem)
3540 v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
3541 v2.AddArg2(src, mem)
3542 v1.AddArg3(dst, v2, mem)
3543 v.AddArg3(dst, v0, v1)
3544 return true
3545 }
3546 // match: (Move [5] dst src mem)
3547 // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3548 for {
3549 if auxIntToInt64(v.AuxInt) != 5 {
3550 break
3551 }
3552 dst := v_0
3553 src := v_1
3554 mem := v_2
3555 v.reset(OpS390XMOVBstore)
3556 v.AuxInt = int32ToAuxInt(4)
3557 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8)
3558 v0.AuxInt = int32ToAuxInt(4)
3559 v0.AddArg2(src, mem)
3560 v1 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem)
3561 v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
3562 v2.AddArg2(src, mem)
3563 v1.AddArg3(dst, v2, mem)
3564 v.AddArg3(dst, v0, v1)
3565 return true
3566 }
3567 // match: (Move [6] dst src mem)
3568 // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3569 for {
3570 if auxIntToInt64(v.AuxInt) != 6 {
3571 break
3572 }
3573 dst := v_0
3574 src := v_1
3575 mem := v_2
3576 v.reset(OpS390XMOVHstore)
3577 v.AuxInt = int32ToAuxInt(4)
3578 v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
3579 v0.AuxInt = int32ToAuxInt(4)
3580 v0.AddArg2(src, mem)
3581 v1 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem)
3582 v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
3583 v2.AddArg2(src, mem)
3584 v1.AddArg3(dst, v2, mem)
3585 v.AddArg3(dst, v0, v1)
3586 return true
3587 }
3588 // match: (Move [7] dst src mem)
3589 // result: (MOVBstore [6] dst (MOVBZload [6] src mem) (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)))
3590 for {
3591 if auxIntToInt64(v.AuxInt) != 7 {
3592 break
3593 }
3594 dst := v_0
3595 src := v_1
3596 mem := v_2
3597 v.reset(OpS390XMOVBstore)
3598 v.AuxInt = int32ToAuxInt(6)
3599 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8)
3600 v0.AuxInt = int32ToAuxInt(6)
3601 v0.AddArg2(src, mem)
3602 v1 := b.NewValue0(v.Pos, OpS390XMOVHstore, types.TypeMem)
3603 v1.AuxInt = int32ToAuxInt(4)
3604 v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16)
3605 v2.AuxInt = int32ToAuxInt(4)
3606 v2.AddArg2(src, mem)
3607 v3 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem)
3608 v4 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32)
3609 v4.AddArg2(src, mem)
3610 v3.AddArg3(dst, v4, mem)
3611 v1.AddArg3(dst, v2, v3)
3612 v.AddArg3(dst, v0, v1)
3613 return true
3614 }
3615 // match: (Move [s] dst src mem)
3616 // cond: s > 0 && s <= 256 && logLargeCopy(v, s)
3617 // result: (MVC [makeValAndOff(int32(s), 0)] dst src mem)
3618 for {
3619 s := auxIntToInt64(v.AuxInt)
3620 dst := v_0
3621 src := v_1
3622 mem := v_2
3623 if !(s > 0 && s <= 256 && logLargeCopy(v, s)) {
3624 break
3625 }
3626 v.reset(OpS390XMVC)
3627 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s), 0))
3628 v.AddArg3(dst, src, mem)
3629 return true
3630 }
3631 // match: (Move [s] dst src mem)
3632 // cond: s > 256 && s <= 512 && logLargeCopy(v, s)
3633 // result: (MVC [makeValAndOff(int32(s)-256, 256)] dst src (MVC [makeValAndOff(256, 0)] dst src mem))
3634 for {
3635 s := auxIntToInt64(v.AuxInt)
3636 dst := v_0
3637 src := v_1
3638 mem := v_2
3639 if !(s > 256 && s <= 512 && logLargeCopy(v, s)) {
3640 break
3641 }
3642 v.reset(OpS390XMVC)
3643 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-256, 256))
3644 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3645 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0))
3646 v0.AddArg3(dst, src, mem)
3647 v.AddArg3(dst, src, v0)
3648 return true
3649 }
3650 // match: (Move [s] dst src mem)
3651 // cond: s > 512 && s <= 768 && logLargeCopy(v, s)
3652 // result: (MVC [makeValAndOff(int32(s)-512, 512)] dst src (MVC [makeValAndOff(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 > 512 && s <= 768 && logLargeCopy(v, s)) {
3659 break
3660 }
3661 v.reset(OpS390XMVC)
3662 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-512, 512))
3663 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3664 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 256))
3665 v1 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3666 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0))
3667 v1.AddArg3(dst, src, mem)
3668 v0.AddArg3(dst, src, v1)
3669 v.AddArg3(dst, src, v0)
3670 return true
3671 }
3672 // match: (Move [s] dst src mem)
3673 // cond: s > 768 && s <= 1024 && logLargeCopy(v, s)
3674 // 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))))
3675 for {
3676 s := auxIntToInt64(v.AuxInt)
3677 dst := v_0
3678 src := v_1
3679 mem := v_2
3680 if !(s > 768 && s <= 1024 && logLargeCopy(v, s)) {
3681 break
3682 }
3683 v.reset(OpS390XMVC)
3684 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-768, 768))
3685 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3686 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 512))
3687 v1 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3688 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 256))
3689 v2 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem)
3690 v2.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0))
3691 v2.AddArg3(dst, src, mem)
3692 v1.AddArg3(dst, src, v2)
3693 v0.AddArg3(dst, src, v1)
3694 v.AddArg3(dst, src, v0)
3695 return true
3696 }
3697 // match: (Move [s] dst src mem)
3698 // cond: s > 1024 && logLargeCopy(v, s)
3699 // result: (LoweredMove [s%256] dst src (ADD <src.Type> src (MOVDconst [(s/256)*256])) mem)
3700 for {
3701 s := auxIntToInt64(v.AuxInt)
3702 dst := v_0
3703 src := v_1
3704 mem := v_2
3705 if !(s > 1024 && logLargeCopy(v, s)) {
3706 break
3707 }
3708 v.reset(OpS390XLoweredMove)
3709 v.AuxInt = int64ToAuxInt(s % 256)
3710 v0 := b.NewValue0(v.Pos, OpS390XADD, src.Type)
3711 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3712 v1.AuxInt = int64ToAuxInt((s / 256) * 256)
3713 v0.AddArg2(src, v1)
3714 v.AddArg4(dst, src, v0, mem)
3715 return true
3716 }
3717 return false
3718 }
3719 func rewriteValueS390X_OpNeq16(v *Value) bool {
3720 v_1 := v.Args[1]
3721 v_0 := v.Args[0]
3722 b := v.Block
3723 typ := &b.Func.Config.Types
3724 // match: (Neq16 x y)
3725 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y)))
3726 for {
3727 x := v_0
3728 y := v_1
3729 v.reset(OpS390XLOCGR)
3730 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3731 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3732 v0.AuxInt = int64ToAuxInt(0)
3733 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3734 v1.AuxInt = int64ToAuxInt(1)
3735 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
3736 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
3737 v3.AddArg(x)
3738 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
3739 v4.AddArg(y)
3740 v2.AddArg2(v3, v4)
3741 v.AddArg3(v0, v1, v2)
3742 return true
3743 }
3744 }
3745 func rewriteValueS390X_OpNeq32(v *Value) bool {
3746 v_1 := v.Args[1]
3747 v_0 := v.Args[0]
3748 b := v.Block
3749 typ := &b.Func.Config.Types
3750 // match: (Neq32 x y)
3751 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y))
3752 for {
3753 x := v_0
3754 y := v_1
3755 v.reset(OpS390XLOCGR)
3756 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3757 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3758 v0.AuxInt = int64ToAuxInt(0)
3759 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3760 v1.AuxInt = int64ToAuxInt(1)
3761 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
3762 v2.AddArg2(x, y)
3763 v.AddArg3(v0, v1, v2)
3764 return true
3765 }
3766 }
3767 func rewriteValueS390X_OpNeq32F(v *Value) bool {
3768 v_1 := v.Args[1]
3769 v_0 := v.Args[0]
3770 b := v.Block
3771 typ := &b.Func.Config.Types
3772 // match: (Neq32F x y)
3773 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y))
3774 for {
3775 x := v_0
3776 y := v_1
3777 v.reset(OpS390XLOCGR)
3778 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3779 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3780 v0.AuxInt = int64ToAuxInt(0)
3781 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3782 v1.AuxInt = int64ToAuxInt(1)
3783 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags)
3784 v2.AddArg2(x, y)
3785 v.AddArg3(v0, v1, v2)
3786 return true
3787 }
3788 }
3789 func rewriteValueS390X_OpNeq64(v *Value) bool {
3790 v_1 := v.Args[1]
3791 v_0 := v.Args[0]
3792 b := v.Block
3793 typ := &b.Func.Config.Types
3794 // match: (Neq64 x y)
3795 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
3796 for {
3797 x := v_0
3798 y := v_1
3799 v.reset(OpS390XLOCGR)
3800 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3801 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3802 v0.AuxInt = int64ToAuxInt(0)
3803 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3804 v1.AuxInt = int64ToAuxInt(1)
3805 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
3806 v2.AddArg2(x, y)
3807 v.AddArg3(v0, v1, v2)
3808 return true
3809 }
3810 }
3811 func rewriteValueS390X_OpNeq64F(v *Value) bool {
3812 v_1 := v.Args[1]
3813 v_0 := v.Args[0]
3814 b := v.Block
3815 typ := &b.Func.Config.Types
3816 // match: (Neq64F x y)
3817 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y))
3818 for {
3819 x := v_0
3820 y := v_1
3821 v.reset(OpS390XLOCGR)
3822 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3823 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3824 v0.AuxInt = int64ToAuxInt(0)
3825 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3826 v1.AuxInt = int64ToAuxInt(1)
3827 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags)
3828 v2.AddArg2(x, y)
3829 v.AddArg3(v0, v1, v2)
3830 return true
3831 }
3832 }
3833 func rewriteValueS390X_OpNeq8(v *Value) bool {
3834 v_1 := v.Args[1]
3835 v_0 := v.Args[0]
3836 b := v.Block
3837 typ := &b.Func.Config.Types
3838 // match: (Neq8 x y)
3839 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
3840 for {
3841 x := v_0
3842 y := v_1
3843 v.reset(OpS390XLOCGR)
3844 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3845 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3846 v0.AuxInt = int64ToAuxInt(0)
3847 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3848 v1.AuxInt = int64ToAuxInt(1)
3849 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
3850 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3851 v3.AddArg(x)
3852 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3853 v4.AddArg(y)
3854 v2.AddArg2(v3, v4)
3855 v.AddArg3(v0, v1, v2)
3856 return true
3857 }
3858 }
3859 func rewriteValueS390X_OpNeqB(v *Value) bool {
3860 v_1 := v.Args[1]
3861 v_0 := v.Args[0]
3862 b := v.Block
3863 typ := &b.Func.Config.Types
3864 // match: (NeqB x y)
3865 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y)))
3866 for {
3867 x := v_0
3868 y := v_1
3869 v.reset(OpS390XLOCGR)
3870 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3871 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3872 v0.AuxInt = int64ToAuxInt(0)
3873 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3874 v1.AuxInt = int64ToAuxInt(1)
3875 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
3876 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3877 v3.AddArg(x)
3878 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
3879 v4.AddArg(y)
3880 v2.AddArg2(v3, v4)
3881 v.AddArg3(v0, v1, v2)
3882 return true
3883 }
3884 }
3885 func rewriteValueS390X_OpNeqPtr(v *Value) bool {
3886 v_1 := v.Args[1]
3887 v_0 := v.Args[0]
3888 b := v.Block
3889 typ := &b.Func.Config.Types
3890 // match: (NeqPtr x y)
3891 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y))
3892 for {
3893 x := v_0
3894 y := v_1
3895 v.reset(OpS390XLOCGR)
3896 v.Aux = s390xCCMaskToAux(s390x.NotEqual)
3897 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3898 v0.AuxInt = int64ToAuxInt(0)
3899 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3900 v1.AuxInt = int64ToAuxInt(1)
3901 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
3902 v2.AddArg2(x, y)
3903 v.AddArg3(v0, v1, v2)
3904 return true
3905 }
3906 }
3907 func rewriteValueS390X_OpNot(v *Value) bool {
3908 v_0 := v.Args[0]
3909 // match: (Not x)
3910 // result: (XORWconst [1] x)
3911 for {
3912 x := v_0
3913 v.reset(OpS390XXORWconst)
3914 v.AuxInt = int32ToAuxInt(1)
3915 v.AddArg(x)
3916 return true
3917 }
3918 }
3919 func rewriteValueS390X_OpOffPtr(v *Value) bool {
3920 v_0 := v.Args[0]
3921 b := v.Block
3922 typ := &b.Func.Config.Types
3923 // match: (OffPtr [off] ptr:(SP))
3924 // result: (MOVDaddr [int32(off)] ptr)
3925 for {
3926 off := auxIntToInt64(v.AuxInt)
3927 ptr := v_0
3928 if ptr.Op != OpSP {
3929 break
3930 }
3931 v.reset(OpS390XMOVDaddr)
3932 v.AuxInt = int32ToAuxInt(int32(off))
3933 v.AddArg(ptr)
3934 return true
3935 }
3936 // match: (OffPtr [off] ptr)
3937 // cond: is32Bit(off)
3938 // result: (ADDconst [int32(off)] ptr)
3939 for {
3940 off := auxIntToInt64(v.AuxInt)
3941 ptr := v_0
3942 if !(is32Bit(off)) {
3943 break
3944 }
3945 v.reset(OpS390XADDconst)
3946 v.AuxInt = int32ToAuxInt(int32(off))
3947 v.AddArg(ptr)
3948 return true
3949 }
3950 // match: (OffPtr [off] ptr)
3951 // result: (ADD (MOVDconst [off]) ptr)
3952 for {
3953 off := auxIntToInt64(v.AuxInt)
3954 ptr := v_0
3955 v.reset(OpS390XADD)
3956 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
3957 v0.AuxInt = int64ToAuxInt(off)
3958 v.AddArg2(v0, ptr)
3959 return true
3960 }
3961 }
3962 func rewriteValueS390X_OpPanicBounds(v *Value) bool {
3963 v_2 := v.Args[2]
3964 v_1 := v.Args[1]
3965 v_0 := v.Args[0]
3966 // match: (PanicBounds [kind] x y mem)
3967 // cond: boundsABI(kind) == 0
3968 // result: (LoweredPanicBoundsA [kind] x y mem)
3969 for {
3970 kind := auxIntToInt64(v.AuxInt)
3971 x := v_0
3972 y := v_1
3973 mem := v_2
3974 if !(boundsABI(kind) == 0) {
3975 break
3976 }
3977 v.reset(OpS390XLoweredPanicBoundsA)
3978 v.AuxInt = int64ToAuxInt(kind)
3979 v.AddArg3(x, y, mem)
3980 return true
3981 }
3982 // match: (PanicBounds [kind] x y mem)
3983 // cond: boundsABI(kind) == 1
3984 // result: (LoweredPanicBoundsB [kind] x y mem)
3985 for {
3986 kind := auxIntToInt64(v.AuxInt)
3987 x := v_0
3988 y := v_1
3989 mem := v_2
3990 if !(boundsABI(kind) == 1) {
3991 break
3992 }
3993 v.reset(OpS390XLoweredPanicBoundsB)
3994 v.AuxInt = int64ToAuxInt(kind)
3995 v.AddArg3(x, y, mem)
3996 return true
3997 }
3998 // match: (PanicBounds [kind] x y mem)
3999 // cond: boundsABI(kind) == 2
4000 // result: (LoweredPanicBoundsC [kind] x y mem)
4001 for {
4002 kind := auxIntToInt64(v.AuxInt)
4003 x := v_0
4004 y := v_1
4005 mem := v_2
4006 if !(boundsABI(kind) == 2) {
4007 break
4008 }
4009 v.reset(OpS390XLoweredPanicBoundsC)
4010 v.AuxInt = int64ToAuxInt(kind)
4011 v.AddArg3(x, y, mem)
4012 return true
4013 }
4014 return false
4015 }
4016 func rewriteValueS390X_OpPopCount16(v *Value) bool {
4017 v_0 := v.Args[0]
4018 b := v.Block
4019 typ := &b.Func.Config.Types
4020 // match: (PopCount16 x)
4021 // result: (MOVBZreg (SumBytes2 (POPCNT <typ.UInt16> x)))
4022 for {
4023 x := v_0
4024 v.reset(OpS390XMOVBZreg)
4025 v0 := b.NewValue0(v.Pos, OpS390XSumBytes2, typ.UInt8)
4026 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt16)
4027 v1.AddArg(x)
4028 v0.AddArg(v1)
4029 v.AddArg(v0)
4030 return true
4031 }
4032 }
4033 func rewriteValueS390X_OpPopCount32(v *Value) bool {
4034 v_0 := v.Args[0]
4035 b := v.Block
4036 typ := &b.Func.Config.Types
4037 // match: (PopCount32 x)
4038 // result: (MOVBZreg (SumBytes4 (POPCNT <typ.UInt32> x)))
4039 for {
4040 x := v_0
4041 v.reset(OpS390XMOVBZreg)
4042 v0 := b.NewValue0(v.Pos, OpS390XSumBytes4, typ.UInt8)
4043 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt32)
4044 v1.AddArg(x)
4045 v0.AddArg(v1)
4046 v.AddArg(v0)
4047 return true
4048 }
4049 }
4050 func rewriteValueS390X_OpPopCount64(v *Value) bool {
4051 v_0 := v.Args[0]
4052 b := v.Block
4053 typ := &b.Func.Config.Types
4054 // match: (PopCount64 x)
4055 // result: (MOVBZreg (SumBytes8 (POPCNT <typ.UInt64> x)))
4056 for {
4057 x := v_0
4058 v.reset(OpS390XMOVBZreg)
4059 v0 := b.NewValue0(v.Pos, OpS390XSumBytes8, typ.UInt8)
4060 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt64)
4061 v1.AddArg(x)
4062 v0.AddArg(v1)
4063 v.AddArg(v0)
4064 return true
4065 }
4066 }
4067 func rewriteValueS390X_OpPopCount8(v *Value) bool {
4068 v_0 := v.Args[0]
4069 b := v.Block
4070 typ := &b.Func.Config.Types
4071 // match: (PopCount8 x)
4072 // result: (POPCNT (MOVBZreg x))
4073 for {
4074 x := v_0
4075 v.reset(OpS390XPOPCNT)
4076 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4077 v0.AddArg(x)
4078 v.AddArg(v0)
4079 return true
4080 }
4081 }
4082 func rewriteValueS390X_OpRotateLeft16(v *Value) bool {
4083 v_1 := v.Args[1]
4084 v_0 := v.Args[0]
4085 b := v.Block
4086 typ := &b.Func.Config.Types
4087 // match: (RotateLeft16 <t> x (MOVDconst [c]))
4088 // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15])))
4089 for {
4090 t := v.Type
4091 x := v_0
4092 if v_1.Op != OpS390XMOVDconst {
4093 break
4094 }
4095 c := auxIntToInt64(v_1.AuxInt)
4096 v.reset(OpOr16)
4097 v0 := b.NewValue0(v.Pos, OpLsh16x64, t)
4098 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4099 v1.AuxInt = int64ToAuxInt(c & 15)
4100 v0.AddArg2(x, v1)
4101 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t)
4102 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4103 v3.AuxInt = int64ToAuxInt(-c & 15)
4104 v2.AddArg2(x, v3)
4105 v.AddArg2(v0, v2)
4106 return true
4107 }
4108 return false
4109 }
4110 func rewriteValueS390X_OpRotateLeft8(v *Value) bool {
4111 v_1 := v.Args[1]
4112 v_0 := v.Args[0]
4113 b := v.Block
4114 typ := &b.Func.Config.Types
4115 // match: (RotateLeft8 <t> x (MOVDconst [c]))
4116 // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7])))
4117 for {
4118 t := v.Type
4119 x := v_0
4120 if v_1.Op != OpS390XMOVDconst {
4121 break
4122 }
4123 c := auxIntToInt64(v_1.AuxInt)
4124 v.reset(OpOr8)
4125 v0 := b.NewValue0(v.Pos, OpLsh8x64, t)
4126 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4127 v1.AuxInt = int64ToAuxInt(c & 7)
4128 v0.AddArg2(x, v1)
4129 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t)
4130 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4131 v3.AuxInt = int64ToAuxInt(-c & 7)
4132 v2.AddArg2(x, v3)
4133 v.AddArg2(v0, v2)
4134 return true
4135 }
4136 return false
4137 }
4138 func rewriteValueS390X_OpRound(v *Value) bool {
4139 v_0 := v.Args[0]
4140 // match: (Round x)
4141 // result: (FIDBR [1] x)
4142 for {
4143 x := v_0
4144 v.reset(OpS390XFIDBR)
4145 v.AuxInt = int8ToAuxInt(1)
4146 v.AddArg(x)
4147 return true
4148 }
4149 }
4150 func rewriteValueS390X_OpRoundToEven(v *Value) bool {
4151 v_0 := v.Args[0]
4152 // match: (RoundToEven x)
4153 // result: (FIDBR [4] x)
4154 for {
4155 x := v_0
4156 v.reset(OpS390XFIDBR)
4157 v.AuxInt = int8ToAuxInt(4)
4158 v.AddArg(x)
4159 return true
4160 }
4161 }
4162 func rewriteValueS390X_OpRsh16Ux16(v *Value) bool {
4163 v_1 := v.Args[1]
4164 v_0 := v.Args[0]
4165 b := v.Block
4166 typ := &b.Func.Config.Types
4167 // match: (Rsh16Ux16 x y)
4168 // cond: shiftIsBounded(v)
4169 // result: (SRW (MOVHZreg x) y)
4170 for {
4171 x := v_0
4172 y := v_1
4173 if !(shiftIsBounded(v)) {
4174 break
4175 }
4176 v.reset(OpS390XSRW)
4177 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4178 v0.AddArg(x)
4179 v.AddArg2(v0, y)
4180 return true
4181 }
4182 // match: (Rsh16Ux16 <t> x y)
4183 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
4184 for {
4185 t := v.Type
4186 x := v_0
4187 y := v_1
4188 v.reset(OpS390XLOCGR)
4189 v.Type = t
4190 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4191 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4192 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4193 v1.AddArg(x)
4194 v0.AddArg2(v1, y)
4195 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4196 v2.AuxInt = int64ToAuxInt(0)
4197 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4198 v3.AuxInt = int32ToAuxInt(64)
4199 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4200 v4.AddArg(y)
4201 v3.AddArg(v4)
4202 v.AddArg3(v0, v2, v3)
4203 return true
4204 }
4205 }
4206 func rewriteValueS390X_OpRsh16Ux32(v *Value) bool {
4207 v_1 := v.Args[1]
4208 v_0 := v.Args[0]
4209 b := v.Block
4210 typ := &b.Func.Config.Types
4211 // match: (Rsh16Ux32 x y)
4212 // cond: shiftIsBounded(v)
4213 // result: (SRW (MOVHZreg x) y)
4214 for {
4215 x := v_0
4216 y := v_1
4217 if !(shiftIsBounded(v)) {
4218 break
4219 }
4220 v.reset(OpS390XSRW)
4221 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4222 v0.AddArg(x)
4223 v.AddArg2(v0, y)
4224 return true
4225 }
4226 // match: (Rsh16Ux32 <t> x y)
4227 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [64]))
4228 for {
4229 t := v.Type
4230 x := v_0
4231 y := v_1
4232 v.reset(OpS390XLOCGR)
4233 v.Type = t
4234 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4235 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4236 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4237 v1.AddArg(x)
4238 v0.AddArg2(v1, y)
4239 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4240 v2.AuxInt = int64ToAuxInt(0)
4241 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4242 v3.AuxInt = int32ToAuxInt(64)
4243 v3.AddArg(y)
4244 v.AddArg3(v0, v2, v3)
4245 return true
4246 }
4247 }
4248 func rewriteValueS390X_OpRsh16Ux64(v *Value) bool {
4249 v_1 := v.Args[1]
4250 v_0 := v.Args[0]
4251 b := v.Block
4252 typ := &b.Func.Config.Types
4253 // match: (Rsh16Ux64 x y)
4254 // cond: shiftIsBounded(v)
4255 // result: (SRW (MOVHZreg x) y)
4256 for {
4257 x := v_0
4258 y := v_1
4259 if !(shiftIsBounded(v)) {
4260 break
4261 }
4262 v.reset(OpS390XSRW)
4263 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4264 v0.AddArg(x)
4265 v.AddArg2(v0, y)
4266 return true
4267 }
4268 // match: (Rsh16Ux64 <t> x y)
4269 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [64]))
4270 for {
4271 t := v.Type
4272 x := v_0
4273 y := v_1
4274 v.reset(OpS390XLOCGR)
4275 v.Type = t
4276 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4277 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4278 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4279 v1.AddArg(x)
4280 v0.AddArg2(v1, y)
4281 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4282 v2.AuxInt = int64ToAuxInt(0)
4283 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4284 v3.AuxInt = int32ToAuxInt(64)
4285 v3.AddArg(y)
4286 v.AddArg3(v0, v2, v3)
4287 return true
4288 }
4289 }
4290 func rewriteValueS390X_OpRsh16Ux8(v *Value) bool {
4291 v_1 := v.Args[1]
4292 v_0 := v.Args[0]
4293 b := v.Block
4294 typ := &b.Func.Config.Types
4295 // match: (Rsh16Ux8 x y)
4296 // cond: shiftIsBounded(v)
4297 // result: (SRW (MOVHZreg x) y)
4298 for {
4299 x := v_0
4300 y := v_1
4301 if !(shiftIsBounded(v)) {
4302 break
4303 }
4304 v.reset(OpS390XSRW)
4305 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4306 v0.AddArg(x)
4307 v.AddArg2(v0, y)
4308 return true
4309 }
4310 // match: (Rsh16Ux8 <t> x y)
4311 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
4312 for {
4313 t := v.Type
4314 x := v_0
4315 y := v_1
4316 v.reset(OpS390XLOCGR)
4317 v.Type = t
4318 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4319 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4320 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4321 v1.AddArg(x)
4322 v0.AddArg2(v1, y)
4323 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4324 v2.AuxInt = int64ToAuxInt(0)
4325 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4326 v3.AuxInt = int32ToAuxInt(64)
4327 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4328 v4.AddArg(y)
4329 v3.AddArg(v4)
4330 v.AddArg3(v0, v2, v3)
4331 return true
4332 }
4333 }
4334 func rewriteValueS390X_OpRsh16x16(v *Value) bool {
4335 v_1 := v.Args[1]
4336 v_0 := v.Args[0]
4337 b := v.Block
4338 typ := &b.Func.Config.Types
4339 // match: (Rsh16x16 x y)
4340 // cond: shiftIsBounded(v)
4341 // result: (SRAW (MOVHreg x) y)
4342 for {
4343 x := v_0
4344 y := v_1
4345 if !(shiftIsBounded(v)) {
4346 break
4347 }
4348 v.reset(OpS390XSRAW)
4349 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4350 v0.AddArg(x)
4351 v.AddArg2(v0, y)
4352 return true
4353 }
4354 // match: (Rsh16x16 x y)
4355 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64])))
4356 for {
4357 x := v_0
4358 y := v_1
4359 v.reset(OpS390XSRAW)
4360 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4361 v0.AddArg(x)
4362 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4363 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4364 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4365 v2.AuxInt = int64ToAuxInt(63)
4366 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4367 v3.AuxInt = int32ToAuxInt(64)
4368 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4369 v4.AddArg(y)
4370 v3.AddArg(v4)
4371 v1.AddArg3(y, v2, v3)
4372 v.AddArg2(v0, v1)
4373 return true
4374 }
4375 }
4376 func rewriteValueS390X_OpRsh16x32(v *Value) bool {
4377 v_1 := v.Args[1]
4378 v_0 := v.Args[0]
4379 b := v.Block
4380 typ := &b.Func.Config.Types
4381 // match: (Rsh16x32 x y)
4382 // cond: shiftIsBounded(v)
4383 // result: (SRAW (MOVHreg x) y)
4384 for {
4385 x := v_0
4386 y := v_1
4387 if !(shiftIsBounded(v)) {
4388 break
4389 }
4390 v.reset(OpS390XSRAW)
4391 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4392 v0.AddArg(x)
4393 v.AddArg2(v0, y)
4394 return true
4395 }
4396 // match: (Rsh16x32 x y)
4397 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64])))
4398 for {
4399 x := v_0
4400 y := v_1
4401 v.reset(OpS390XSRAW)
4402 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4403 v0.AddArg(x)
4404 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4405 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4406 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4407 v2.AuxInt = int64ToAuxInt(63)
4408 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4409 v3.AuxInt = int32ToAuxInt(64)
4410 v3.AddArg(y)
4411 v1.AddArg3(y, v2, v3)
4412 v.AddArg2(v0, v1)
4413 return true
4414 }
4415 }
4416 func rewriteValueS390X_OpRsh16x64(v *Value) bool {
4417 v_1 := v.Args[1]
4418 v_0 := v.Args[0]
4419 b := v.Block
4420 typ := &b.Func.Config.Types
4421 // match: (Rsh16x64 x y)
4422 // cond: shiftIsBounded(v)
4423 // result: (SRAW (MOVHreg x) y)
4424 for {
4425 x := v_0
4426 y := v_1
4427 if !(shiftIsBounded(v)) {
4428 break
4429 }
4430 v.reset(OpS390XSRAW)
4431 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4432 v0.AddArg(x)
4433 v.AddArg2(v0, y)
4434 return true
4435 }
4436 // match: (Rsh16x64 x y)
4437 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64])))
4438 for {
4439 x := v_0
4440 y := v_1
4441 v.reset(OpS390XSRAW)
4442 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4443 v0.AddArg(x)
4444 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4445 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4446 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4447 v2.AuxInt = int64ToAuxInt(63)
4448 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4449 v3.AuxInt = int32ToAuxInt(64)
4450 v3.AddArg(y)
4451 v1.AddArg3(y, v2, v3)
4452 v.AddArg2(v0, v1)
4453 return true
4454 }
4455 }
4456 func rewriteValueS390X_OpRsh16x8(v *Value) bool {
4457 v_1 := v.Args[1]
4458 v_0 := v.Args[0]
4459 b := v.Block
4460 typ := &b.Func.Config.Types
4461 // match: (Rsh16x8 x y)
4462 // cond: shiftIsBounded(v)
4463 // result: (SRAW (MOVHreg x) y)
4464 for {
4465 x := v_0
4466 y := v_1
4467 if !(shiftIsBounded(v)) {
4468 break
4469 }
4470 v.reset(OpS390XSRAW)
4471 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4472 v0.AddArg(x)
4473 v.AddArg2(v0, y)
4474 return true
4475 }
4476 // match: (Rsh16x8 x y)
4477 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64])))
4478 for {
4479 x := v_0
4480 y := v_1
4481 v.reset(OpS390XSRAW)
4482 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64)
4483 v0.AddArg(x)
4484 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4485 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4486 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4487 v2.AuxInt = int64ToAuxInt(63)
4488 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4489 v3.AuxInt = int32ToAuxInt(64)
4490 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4491 v4.AddArg(y)
4492 v3.AddArg(v4)
4493 v1.AddArg3(y, v2, v3)
4494 v.AddArg2(v0, v1)
4495 return true
4496 }
4497 }
4498 func rewriteValueS390X_OpRsh32Ux16(v *Value) bool {
4499 v_1 := v.Args[1]
4500 v_0 := v.Args[0]
4501 b := v.Block
4502 typ := &b.Func.Config.Types
4503 // match: (Rsh32Ux16 x y)
4504 // cond: shiftIsBounded(v)
4505 // result: (SRW x y)
4506 for {
4507 x := v_0
4508 y := v_1
4509 if !(shiftIsBounded(v)) {
4510 break
4511 }
4512 v.reset(OpS390XSRW)
4513 v.AddArg2(x, y)
4514 return true
4515 }
4516 // match: (Rsh32Ux16 <t> x y)
4517 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
4518 for {
4519 t := v.Type
4520 x := v_0
4521 y := v_1
4522 v.reset(OpS390XLOCGR)
4523 v.Type = t
4524 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4525 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4526 v0.AddArg2(x, y)
4527 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4528 v1.AuxInt = int64ToAuxInt(0)
4529 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4530 v2.AuxInt = int32ToAuxInt(64)
4531 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4532 v3.AddArg(y)
4533 v2.AddArg(v3)
4534 v.AddArg3(v0, v1, v2)
4535 return true
4536 }
4537 }
4538 func rewriteValueS390X_OpRsh32Ux32(v *Value) bool {
4539 v_1 := v.Args[1]
4540 v_0 := v.Args[0]
4541 b := v.Block
4542 typ := &b.Func.Config.Types
4543 // match: (Rsh32Ux32 x y)
4544 // cond: shiftIsBounded(v)
4545 // result: (SRW x y)
4546 for {
4547 x := v_0
4548 y := v_1
4549 if !(shiftIsBounded(v)) {
4550 break
4551 }
4552 v.reset(OpS390XSRW)
4553 v.AddArg2(x, y)
4554 return true
4555 }
4556 // match: (Rsh32Ux32 <t> x y)
4557 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
4558 for {
4559 t := v.Type
4560 x := v_0
4561 y := v_1
4562 v.reset(OpS390XLOCGR)
4563 v.Type = t
4564 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4565 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4566 v0.AddArg2(x, y)
4567 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4568 v1.AuxInt = int64ToAuxInt(0)
4569 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4570 v2.AuxInt = int32ToAuxInt(64)
4571 v2.AddArg(y)
4572 v.AddArg3(v0, v1, v2)
4573 return true
4574 }
4575 }
4576 func rewriteValueS390X_OpRsh32Ux64(v *Value) bool {
4577 v_1 := v.Args[1]
4578 v_0 := v.Args[0]
4579 b := v.Block
4580 typ := &b.Func.Config.Types
4581 // match: (Rsh32Ux64 x y)
4582 // cond: shiftIsBounded(v)
4583 // result: (SRW x y)
4584 for {
4585 x := v_0
4586 y := v_1
4587 if !(shiftIsBounded(v)) {
4588 break
4589 }
4590 v.reset(OpS390XSRW)
4591 v.AddArg2(x, y)
4592 return true
4593 }
4594 // match: (Rsh32Ux64 <t> x y)
4595 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
4596 for {
4597 t := v.Type
4598 x := v_0
4599 y := v_1
4600 v.reset(OpS390XLOCGR)
4601 v.Type = t
4602 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4603 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4604 v0.AddArg2(x, y)
4605 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4606 v1.AuxInt = int64ToAuxInt(0)
4607 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4608 v2.AuxInt = int32ToAuxInt(64)
4609 v2.AddArg(y)
4610 v.AddArg3(v0, v1, v2)
4611 return true
4612 }
4613 }
4614 func rewriteValueS390X_OpRsh32Ux8(v *Value) bool {
4615 v_1 := v.Args[1]
4616 v_0 := v.Args[0]
4617 b := v.Block
4618 typ := &b.Func.Config.Types
4619 // match: (Rsh32Ux8 x y)
4620 // cond: shiftIsBounded(v)
4621 // result: (SRW x y)
4622 for {
4623 x := v_0
4624 y := v_1
4625 if !(shiftIsBounded(v)) {
4626 break
4627 }
4628 v.reset(OpS390XSRW)
4629 v.AddArg2(x, y)
4630 return true
4631 }
4632 // match: (Rsh32Ux8 <t> x y)
4633 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
4634 for {
4635 t := v.Type
4636 x := v_0
4637 y := v_1
4638 v.reset(OpS390XLOCGR)
4639 v.Type = t
4640 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4641 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
4642 v0.AddArg2(x, y)
4643 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4644 v1.AuxInt = int64ToAuxInt(0)
4645 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4646 v2.AuxInt = int32ToAuxInt(64)
4647 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4648 v3.AddArg(y)
4649 v2.AddArg(v3)
4650 v.AddArg3(v0, v1, v2)
4651 return true
4652 }
4653 }
4654 func rewriteValueS390X_OpRsh32x16(v *Value) bool {
4655 v_1 := v.Args[1]
4656 v_0 := v.Args[0]
4657 b := v.Block
4658 typ := &b.Func.Config.Types
4659 // match: (Rsh32x16 x y)
4660 // cond: shiftIsBounded(v)
4661 // result: (SRAW x y)
4662 for {
4663 x := v_0
4664 y := v_1
4665 if !(shiftIsBounded(v)) {
4666 break
4667 }
4668 v.reset(OpS390XSRAW)
4669 v.AddArg2(x, y)
4670 return true
4671 }
4672 // match: (Rsh32x16 x y)
4673 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64])))
4674 for {
4675 x := v_0
4676 y := v_1
4677 v.reset(OpS390XSRAW)
4678 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4679 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4680 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4681 v1.AuxInt = int64ToAuxInt(63)
4682 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4683 v2.AuxInt = int32ToAuxInt(64)
4684 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4685 v3.AddArg(y)
4686 v2.AddArg(v3)
4687 v0.AddArg3(y, v1, v2)
4688 v.AddArg2(x, v0)
4689 return true
4690 }
4691 }
4692 func rewriteValueS390X_OpRsh32x32(v *Value) bool {
4693 v_1 := v.Args[1]
4694 v_0 := v.Args[0]
4695 b := v.Block
4696 // match: (Rsh32x32 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: (Rsh32x32 x y)
4710 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst 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, OpS390XCMPWUconst, 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_OpRsh32x64(v *Value) bool {
4728 v_1 := v.Args[1]
4729 v_0 := v.Args[0]
4730 b := v.Block
4731 // match: (Rsh32x64 x y)
4732 // cond: shiftIsBounded(v)
4733 // result: (SRAW x y)
4734 for {
4735 x := v_0
4736 y := v_1
4737 if !(shiftIsBounded(v)) {
4738 break
4739 }
4740 v.reset(OpS390XSRAW)
4741 v.AddArg2(x, y)
4742 return true
4743 }
4744 // match: (Rsh32x64 x y)
4745 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64])))
4746 for {
4747 x := v_0
4748 y := v_1
4749 v.reset(OpS390XSRAW)
4750 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4751 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4752 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4753 v1.AuxInt = int64ToAuxInt(63)
4754 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4755 v2.AuxInt = int32ToAuxInt(64)
4756 v2.AddArg(y)
4757 v0.AddArg3(y, v1, v2)
4758 v.AddArg2(x, v0)
4759 return true
4760 }
4761 }
4762 func rewriteValueS390X_OpRsh32x8(v *Value) bool {
4763 v_1 := v.Args[1]
4764 v_0 := v.Args[0]
4765 b := v.Block
4766 typ := &b.Func.Config.Types
4767 // match: (Rsh32x8 x y)
4768 // cond: shiftIsBounded(v)
4769 // result: (SRAW x y)
4770 for {
4771 x := v_0
4772 y := v_1
4773 if !(shiftIsBounded(v)) {
4774 break
4775 }
4776 v.reset(OpS390XSRAW)
4777 v.AddArg2(x, y)
4778 return true
4779 }
4780 // match: (Rsh32x8 x y)
4781 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64])))
4782 for {
4783 x := v_0
4784 y := v_1
4785 v.reset(OpS390XSRAW)
4786 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4787 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4788 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4789 v1.AuxInt = int64ToAuxInt(63)
4790 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4791 v2.AuxInt = int32ToAuxInt(64)
4792 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4793 v3.AddArg(y)
4794 v2.AddArg(v3)
4795 v0.AddArg3(y, v1, v2)
4796 v.AddArg2(x, v0)
4797 return true
4798 }
4799 }
4800 func rewriteValueS390X_OpRsh64Ux16(v *Value) bool {
4801 v_1 := v.Args[1]
4802 v_0 := v.Args[0]
4803 b := v.Block
4804 typ := &b.Func.Config.Types
4805 // match: (Rsh64Ux16 x y)
4806 // cond: shiftIsBounded(v)
4807 // result: (SRD x y)
4808 for {
4809 x := v_0
4810 y := v_1
4811 if !(shiftIsBounded(v)) {
4812 break
4813 }
4814 v.reset(OpS390XSRD)
4815 v.AddArg2(x, y)
4816 return true
4817 }
4818 // match: (Rsh64Ux16 <t> x y)
4819 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
4820 for {
4821 t := v.Type
4822 x := v_0
4823 y := v_1
4824 v.reset(OpS390XLOCGR)
4825 v.Type = t
4826 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4827 v0 := b.NewValue0(v.Pos, OpS390XSRD, t)
4828 v0.AddArg2(x, y)
4829 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4830 v1.AuxInt = int64ToAuxInt(0)
4831 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4832 v2.AuxInt = int32ToAuxInt(64)
4833 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4834 v3.AddArg(y)
4835 v2.AddArg(v3)
4836 v.AddArg3(v0, v1, v2)
4837 return true
4838 }
4839 }
4840 func rewriteValueS390X_OpRsh64Ux32(v *Value) bool {
4841 v_1 := v.Args[1]
4842 v_0 := v.Args[0]
4843 b := v.Block
4844 typ := &b.Func.Config.Types
4845 // match: (Rsh64Ux32 x y)
4846 // cond: shiftIsBounded(v)
4847 // result: (SRD x y)
4848 for {
4849 x := v_0
4850 y := v_1
4851 if !(shiftIsBounded(v)) {
4852 break
4853 }
4854 v.reset(OpS390XSRD)
4855 v.AddArg2(x, y)
4856 return true
4857 }
4858 // match: (Rsh64Ux32 <t> x y)
4859 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
4860 for {
4861 t := v.Type
4862 x := v_0
4863 y := v_1
4864 v.reset(OpS390XLOCGR)
4865 v.Type = t
4866 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4867 v0 := b.NewValue0(v.Pos, OpS390XSRD, t)
4868 v0.AddArg2(x, y)
4869 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4870 v1.AuxInt = int64ToAuxInt(0)
4871 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4872 v2.AuxInt = int32ToAuxInt(64)
4873 v2.AddArg(y)
4874 v.AddArg3(v0, v1, v2)
4875 return true
4876 }
4877 }
4878 func rewriteValueS390X_OpRsh64Ux64(v *Value) bool {
4879 v_1 := v.Args[1]
4880 v_0 := v.Args[0]
4881 b := v.Block
4882 typ := &b.Func.Config.Types
4883 // match: (Rsh64Ux64 x y)
4884 // cond: shiftIsBounded(v)
4885 // result: (SRD x y)
4886 for {
4887 x := v_0
4888 y := v_1
4889 if !(shiftIsBounded(v)) {
4890 break
4891 }
4892 v.reset(OpS390XSRD)
4893 v.AddArg2(x, y)
4894 return true
4895 }
4896 // match: (Rsh64Ux64 <t> x y)
4897 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
4898 for {
4899 t := v.Type
4900 x := v_0
4901 y := v_1
4902 v.reset(OpS390XLOCGR)
4903 v.Type = t
4904 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4905 v0 := b.NewValue0(v.Pos, OpS390XSRD, t)
4906 v0.AddArg2(x, y)
4907 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4908 v1.AuxInt = int64ToAuxInt(0)
4909 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
4910 v2.AuxInt = int32ToAuxInt(64)
4911 v2.AddArg(y)
4912 v.AddArg3(v0, v1, v2)
4913 return true
4914 }
4915 }
4916 func rewriteValueS390X_OpRsh64Ux8(v *Value) bool {
4917 v_1 := v.Args[1]
4918 v_0 := v.Args[0]
4919 b := v.Block
4920 typ := &b.Func.Config.Types
4921 // match: (Rsh64Ux8 x y)
4922 // cond: shiftIsBounded(v)
4923 // result: (SRD x y)
4924 for {
4925 x := v_0
4926 y := v_1
4927 if !(shiftIsBounded(v)) {
4928 break
4929 }
4930 v.reset(OpS390XSRD)
4931 v.AddArg2(x, y)
4932 return true
4933 }
4934 // match: (Rsh64Ux8 <t> x y)
4935 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
4936 for {
4937 t := v.Type
4938 x := v_0
4939 y := v_1
4940 v.reset(OpS390XLOCGR)
4941 v.Type = t
4942 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4943 v0 := b.NewValue0(v.Pos, OpS390XSRD, t)
4944 v0.AddArg2(x, y)
4945 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
4946 v1.AuxInt = int64ToAuxInt(0)
4947 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4948 v2.AuxInt = int32ToAuxInt(64)
4949 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
4950 v3.AddArg(y)
4951 v2.AddArg(v3)
4952 v.AddArg3(v0, v1, v2)
4953 return true
4954 }
4955 }
4956 func rewriteValueS390X_OpRsh64x16(v *Value) bool {
4957 v_1 := v.Args[1]
4958 v_0 := v.Args[0]
4959 b := v.Block
4960 typ := &b.Func.Config.Types
4961 // match: (Rsh64x16 x y)
4962 // cond: shiftIsBounded(v)
4963 // result: (SRAD x y)
4964 for {
4965 x := v_0
4966 y := v_1
4967 if !(shiftIsBounded(v)) {
4968 break
4969 }
4970 v.reset(OpS390XSRAD)
4971 v.AddArg2(x, y)
4972 return true
4973 }
4974 // match: (Rsh64x16 x y)
4975 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64])))
4976 for {
4977 x := v_0
4978 y := v_1
4979 v.reset(OpS390XSRAD)
4980 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
4981 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
4982 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
4983 v1.AuxInt = int64ToAuxInt(63)
4984 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
4985 v2.AuxInt = int32ToAuxInt(64)
4986 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
4987 v3.AddArg(y)
4988 v2.AddArg(v3)
4989 v0.AddArg3(y, v1, v2)
4990 v.AddArg2(x, v0)
4991 return true
4992 }
4993 }
4994 func rewriteValueS390X_OpRsh64x32(v *Value) bool {
4995 v_1 := v.Args[1]
4996 v_0 := v.Args[0]
4997 b := v.Block
4998 // match: (Rsh64x32 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: (Rsh64x32 x y)
5012 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst 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, OpS390XCMPWUconst, 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_OpRsh64x64(v *Value) bool {
5030 v_1 := v.Args[1]
5031 v_0 := v.Args[0]
5032 b := v.Block
5033 // match: (Rsh64x64 x y)
5034 // cond: shiftIsBounded(v)
5035 // result: (SRAD x y)
5036 for {
5037 x := v_0
5038 y := v_1
5039 if !(shiftIsBounded(v)) {
5040 break
5041 }
5042 v.reset(OpS390XSRAD)
5043 v.AddArg2(x, y)
5044 return true
5045 }
5046 // match: (Rsh64x64 x y)
5047 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64])))
5048 for {
5049 x := v_0
5050 y := v_1
5051 v.reset(OpS390XSRAD)
5052 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5053 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5054 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5055 v1.AuxInt = int64ToAuxInt(63)
5056 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
5057 v2.AuxInt = int32ToAuxInt(64)
5058 v2.AddArg(y)
5059 v0.AddArg3(y, v1, v2)
5060 v.AddArg2(x, v0)
5061 return true
5062 }
5063 }
5064 func rewriteValueS390X_OpRsh64x8(v *Value) bool {
5065 v_1 := v.Args[1]
5066 v_0 := v.Args[0]
5067 b := v.Block
5068 typ := &b.Func.Config.Types
5069 // match: (Rsh64x8 x y)
5070 // cond: shiftIsBounded(v)
5071 // result: (SRAD x y)
5072 for {
5073 x := v_0
5074 y := v_1
5075 if !(shiftIsBounded(v)) {
5076 break
5077 }
5078 v.reset(OpS390XSRAD)
5079 v.AddArg2(x, y)
5080 return true
5081 }
5082 // match: (Rsh64x8 x y)
5083 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64])))
5084 for {
5085 x := v_0
5086 y := v_1
5087 v.reset(OpS390XSRAD)
5088 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5089 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5090 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5091 v1.AuxInt = int64ToAuxInt(63)
5092 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5093 v2.AuxInt = int32ToAuxInt(64)
5094 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5095 v3.AddArg(y)
5096 v2.AddArg(v3)
5097 v0.AddArg3(y, v1, v2)
5098 v.AddArg2(x, v0)
5099 return true
5100 }
5101 }
5102 func rewriteValueS390X_OpRsh8Ux16(v *Value) bool {
5103 v_1 := v.Args[1]
5104 v_0 := v.Args[0]
5105 b := v.Block
5106 typ := &b.Func.Config.Types
5107 // match: (Rsh8Ux16 x y)
5108 // cond: shiftIsBounded(v)
5109 // result: (SRW (MOVBZreg x) y)
5110 for {
5111 x := v_0
5112 y := v_1
5113 if !(shiftIsBounded(v)) {
5114 break
5115 }
5116 v.reset(OpS390XSRW)
5117 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5118 v0.AddArg(x)
5119 v.AddArg2(v0, y)
5120 return true
5121 }
5122 // match: (Rsh8Ux16 <t> x y)
5123 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64]))
5124 for {
5125 t := v.Type
5126 x := v_0
5127 y := v_1
5128 v.reset(OpS390XLOCGR)
5129 v.Type = t
5130 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5131 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
5132 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5133 v1.AddArg(x)
5134 v0.AddArg2(v1, y)
5135 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
5136 v2.AuxInt = int64ToAuxInt(0)
5137 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5138 v3.AuxInt = int32ToAuxInt(64)
5139 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
5140 v4.AddArg(y)
5141 v3.AddArg(v4)
5142 v.AddArg3(v0, v2, v3)
5143 return true
5144 }
5145 }
5146 func rewriteValueS390X_OpRsh8Ux32(v *Value) bool {
5147 v_1 := v.Args[1]
5148 v_0 := v.Args[0]
5149 b := v.Block
5150 typ := &b.Func.Config.Types
5151 // match: (Rsh8Ux32 x y)
5152 // cond: shiftIsBounded(v)
5153 // result: (SRW (MOVBZreg x) y)
5154 for {
5155 x := v_0
5156 y := v_1
5157 if !(shiftIsBounded(v)) {
5158 break
5159 }
5160 v.reset(OpS390XSRW)
5161 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5162 v0.AddArg(x)
5163 v.AddArg2(v0, y)
5164 return true
5165 }
5166 // match: (Rsh8Ux32 <t> x y)
5167 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [64]))
5168 for {
5169 t := v.Type
5170 x := v_0
5171 y := v_1
5172 v.reset(OpS390XLOCGR)
5173 v.Type = t
5174 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5175 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
5176 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5177 v1.AddArg(x)
5178 v0.AddArg2(v1, y)
5179 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
5180 v2.AuxInt = int64ToAuxInt(0)
5181 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5182 v3.AuxInt = int32ToAuxInt(64)
5183 v3.AddArg(y)
5184 v.AddArg3(v0, v2, v3)
5185 return true
5186 }
5187 }
5188 func rewriteValueS390X_OpRsh8Ux64(v *Value) bool {
5189 v_1 := v.Args[1]
5190 v_0 := v.Args[0]
5191 b := v.Block
5192 typ := &b.Func.Config.Types
5193 // match: (Rsh8Ux64 x y)
5194 // cond: shiftIsBounded(v)
5195 // result: (SRW (MOVBZreg x) y)
5196 for {
5197 x := v_0
5198 y := v_1
5199 if !(shiftIsBounded(v)) {
5200 break
5201 }
5202 v.reset(OpS390XSRW)
5203 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5204 v0.AddArg(x)
5205 v.AddArg2(v0, y)
5206 return true
5207 }
5208 // match: (Rsh8Ux64 <t> x y)
5209 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [64]))
5210 for {
5211 t := v.Type
5212 x := v_0
5213 y := v_1
5214 v.reset(OpS390XLOCGR)
5215 v.Type = t
5216 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5217 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
5218 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5219 v1.AddArg(x)
5220 v0.AddArg2(v1, y)
5221 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
5222 v2.AuxInt = int64ToAuxInt(0)
5223 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
5224 v3.AuxInt = int32ToAuxInt(64)
5225 v3.AddArg(y)
5226 v.AddArg3(v0, v2, v3)
5227 return true
5228 }
5229 }
5230 func rewriteValueS390X_OpRsh8Ux8(v *Value) bool {
5231 v_1 := v.Args[1]
5232 v_0 := v.Args[0]
5233 b := v.Block
5234 typ := &b.Func.Config.Types
5235 // match: (Rsh8Ux8 x y)
5236 // cond: shiftIsBounded(v)
5237 // result: (SRW (MOVBZreg x) y)
5238 for {
5239 x := v_0
5240 y := v_1
5241 if !(shiftIsBounded(v)) {
5242 break
5243 }
5244 v.reset(OpS390XSRW)
5245 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5246 v0.AddArg(x)
5247 v.AddArg2(v0, y)
5248 return true
5249 }
5250 // match: (Rsh8Ux8 <t> x y)
5251 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64]))
5252 for {
5253 t := v.Type
5254 x := v_0
5255 y := v_1
5256 v.reset(OpS390XLOCGR)
5257 v.Type = t
5258 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5259 v0 := b.NewValue0(v.Pos, OpS390XSRW, t)
5260 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5261 v1.AddArg(x)
5262 v0.AddArg2(v1, y)
5263 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
5264 v2.AuxInt = int64ToAuxInt(0)
5265 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5266 v3.AuxInt = int32ToAuxInt(64)
5267 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5268 v4.AddArg(y)
5269 v3.AddArg(v4)
5270 v.AddArg3(v0, v2, v3)
5271 return true
5272 }
5273 }
5274 func rewriteValueS390X_OpRsh8x16(v *Value) bool {
5275 v_1 := v.Args[1]
5276 v_0 := v.Args[0]
5277 b := v.Block
5278 typ := &b.Func.Config.Types
5279 // match: (Rsh8x16 x y)
5280 // cond: shiftIsBounded(v)
5281 // result: (SRAW (MOVBreg x) y)
5282 for {
5283 x := v_0
5284 y := v_1
5285 if !(shiftIsBounded(v)) {
5286 break
5287 }
5288 v.reset(OpS390XSRAW)
5289 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5290 v0.AddArg(x)
5291 v.AddArg2(v0, y)
5292 return true
5293 }
5294 // match: (Rsh8x16 x y)
5295 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64])))
5296 for {
5297 x := v_0
5298 y := v_1
5299 v.reset(OpS390XSRAW)
5300 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5301 v0.AddArg(x)
5302 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5303 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5304 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5305 v2.AuxInt = int64ToAuxInt(63)
5306 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5307 v3.AuxInt = int32ToAuxInt(64)
5308 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64)
5309 v4.AddArg(y)
5310 v3.AddArg(v4)
5311 v1.AddArg3(y, v2, v3)
5312 v.AddArg2(v0, v1)
5313 return true
5314 }
5315 }
5316 func rewriteValueS390X_OpRsh8x32(v *Value) bool {
5317 v_1 := v.Args[1]
5318 v_0 := v.Args[0]
5319 b := v.Block
5320 typ := &b.Func.Config.Types
5321 // match: (Rsh8x32 x y)
5322 // cond: shiftIsBounded(v)
5323 // result: (SRAW (MOVBreg x) y)
5324 for {
5325 x := v_0
5326 y := v_1
5327 if !(shiftIsBounded(v)) {
5328 break
5329 }
5330 v.reset(OpS390XSRAW)
5331 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5332 v0.AddArg(x)
5333 v.AddArg2(v0, y)
5334 return true
5335 }
5336 // match: (Rsh8x32 x y)
5337 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64])))
5338 for {
5339 x := v_0
5340 y := v_1
5341 v.reset(OpS390XSRAW)
5342 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5343 v0.AddArg(x)
5344 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5345 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5346 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5347 v2.AuxInt = int64ToAuxInt(63)
5348 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5349 v3.AuxInt = int32ToAuxInt(64)
5350 v3.AddArg(y)
5351 v1.AddArg3(y, v2, v3)
5352 v.AddArg2(v0, v1)
5353 return true
5354 }
5355 }
5356 func rewriteValueS390X_OpRsh8x64(v *Value) bool {
5357 v_1 := v.Args[1]
5358 v_0 := v.Args[0]
5359 b := v.Block
5360 typ := &b.Func.Config.Types
5361 // match: (Rsh8x64 x y)
5362 // cond: shiftIsBounded(v)
5363 // result: (SRAW (MOVBreg x) y)
5364 for {
5365 x := v_0
5366 y := v_1
5367 if !(shiftIsBounded(v)) {
5368 break
5369 }
5370 v.reset(OpS390XSRAW)
5371 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5372 v0.AddArg(x)
5373 v.AddArg2(v0, y)
5374 return true
5375 }
5376 // match: (Rsh8x64 x y)
5377 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64])))
5378 for {
5379 x := v_0
5380 y := v_1
5381 v.reset(OpS390XSRAW)
5382 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5383 v0.AddArg(x)
5384 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5385 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5386 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5387 v2.AuxInt = int64ToAuxInt(63)
5388 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
5389 v3.AuxInt = int32ToAuxInt(64)
5390 v3.AddArg(y)
5391 v1.AddArg3(y, v2, v3)
5392 v.AddArg2(v0, v1)
5393 return true
5394 }
5395 }
5396 func rewriteValueS390X_OpRsh8x8(v *Value) bool {
5397 v_1 := v.Args[1]
5398 v_0 := v.Args[0]
5399 b := v.Block
5400 typ := &b.Func.Config.Types
5401 // match: (Rsh8x8 x y)
5402 // cond: shiftIsBounded(v)
5403 // result: (SRAW (MOVBreg x) y)
5404 for {
5405 x := v_0
5406 y := v_1
5407 if !(shiftIsBounded(v)) {
5408 break
5409 }
5410 v.reset(OpS390XSRAW)
5411 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5412 v0.AddArg(x)
5413 v.AddArg2(v0, y)
5414 return true
5415 }
5416 // match: (Rsh8x8 x y)
5417 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64])))
5418 for {
5419 x := v_0
5420 y := v_1
5421 v.reset(OpS390XSRAW)
5422 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64)
5423 v0.AddArg(x)
5424 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type)
5425 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
5426 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type)
5427 v2.AuxInt = int64ToAuxInt(63)
5428 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
5429 v3.AuxInt = int32ToAuxInt(64)
5430 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64)
5431 v4.AddArg(y)
5432 v3.AddArg(v4)
5433 v1.AddArg3(y, v2, v3)
5434 v.AddArg2(v0, v1)
5435 return true
5436 }
5437 }
5438 func rewriteValueS390X_OpS390XADD(v *Value) bool {
5439 v_1 := v.Args[1]
5440 v_0 := v.Args[0]
5441 // match: (ADD x (MOVDconst <t> [c]))
5442 // cond: is32Bit(c) && !t.IsPtr()
5443 // result: (ADDconst [int32(c)] x)
5444 for {
5445 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5446 x := v_0
5447 if v_1.Op != OpS390XMOVDconst {
5448 continue
5449 }
5450 t := v_1.Type
5451 c := auxIntToInt64(v_1.AuxInt)
5452 if !(is32Bit(c) && !t.IsPtr()) {
5453 continue
5454 }
5455 v.reset(OpS390XADDconst)
5456 v.AuxInt = int32ToAuxInt(int32(c))
5457 v.AddArg(x)
5458 return true
5459 }
5460 break
5461 }
5462 // match: (ADD idx (MOVDaddr [c] {s} ptr))
5463 // cond: ptr.Op != OpSB
5464 // result: (MOVDaddridx [c] {s} ptr idx)
5465 for {
5466 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5467 idx := v_0
5468 if v_1.Op != OpS390XMOVDaddr {
5469 continue
5470 }
5471 c := auxIntToInt32(v_1.AuxInt)
5472 s := auxToSym(v_1.Aux)
5473 ptr := v_1.Args[0]
5474 if !(ptr.Op != OpSB) {
5475 continue
5476 }
5477 v.reset(OpS390XMOVDaddridx)
5478 v.AuxInt = int32ToAuxInt(c)
5479 v.Aux = symToAux(s)
5480 v.AddArg2(ptr, idx)
5481 return true
5482 }
5483 break
5484 }
5485 // match: (ADD x (NEG y))
5486 // result: (SUB x y)
5487 for {
5488 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5489 x := v_0
5490 if v_1.Op != OpS390XNEG {
5491 continue
5492 }
5493 y := v_1.Args[0]
5494 v.reset(OpS390XSUB)
5495 v.AddArg2(x, y)
5496 return true
5497 }
5498 break
5499 }
5500 // match: (ADD <t> x g:(MOVDload [off] {sym} ptr mem))
5501 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
5502 // result: (ADDload <t> [off] {sym} x ptr mem)
5503 for {
5504 t := v.Type
5505 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5506 x := v_0
5507 g := v_1
5508 if g.Op != OpS390XMOVDload {
5509 continue
5510 }
5511 off := auxIntToInt32(g.AuxInt)
5512 sym := auxToSym(g.Aux)
5513 mem := g.Args[1]
5514 ptr := g.Args[0]
5515 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
5516 continue
5517 }
5518 v.reset(OpS390XADDload)
5519 v.Type = t
5520 v.AuxInt = int32ToAuxInt(off)
5521 v.Aux = symToAux(sym)
5522 v.AddArg3(x, ptr, mem)
5523 return true
5524 }
5525 break
5526 }
5527 return false
5528 }
5529 func rewriteValueS390X_OpS390XADDC(v *Value) bool {
5530 v_1 := v.Args[1]
5531 v_0 := v.Args[0]
5532 // match: (ADDC x (MOVDconst [c]))
5533 // cond: is16Bit(c)
5534 // result: (ADDCconst x [int16(c)])
5535 for {
5536 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5537 x := v_0
5538 if v_1.Op != OpS390XMOVDconst {
5539 continue
5540 }
5541 c := auxIntToInt64(v_1.AuxInt)
5542 if !(is16Bit(c)) {
5543 continue
5544 }
5545 v.reset(OpS390XADDCconst)
5546 v.AuxInt = int16ToAuxInt(int16(c))
5547 v.AddArg(x)
5548 return true
5549 }
5550 break
5551 }
5552 return false
5553 }
5554 func rewriteValueS390X_OpS390XADDE(v *Value) bool {
5555 v_2 := v.Args[2]
5556 v_1 := v.Args[1]
5557 v_0 := v.Args[0]
5558 // match: (ADDE x y (FlagEQ))
5559 // result: (ADDC x y)
5560 for {
5561 x := v_0
5562 y := v_1
5563 if v_2.Op != OpS390XFlagEQ {
5564 break
5565 }
5566 v.reset(OpS390XADDC)
5567 v.AddArg2(x, y)
5568 return true
5569 }
5570 // match: (ADDE x y (FlagLT))
5571 // result: (ADDC x y)
5572 for {
5573 x := v_0
5574 y := v_1
5575 if v_2.Op != OpS390XFlagLT {
5576 break
5577 }
5578 v.reset(OpS390XADDC)
5579 v.AddArg2(x, y)
5580 return true
5581 }
5582 // match: (ADDE x y (Select1 (ADDCconst [-1] (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) c)))))
5583 // result: (ADDE x y c)
5584 for {
5585 x := v_0
5586 y := v_1
5587 if v_2.Op != OpSelect1 {
5588 break
5589 }
5590 v_2_0 := v_2.Args[0]
5591 if v_2_0.Op != OpS390XADDCconst || auxIntToInt16(v_2_0.AuxInt) != -1 {
5592 break
5593 }
5594 v_2_0_0 := v_2_0.Args[0]
5595 if v_2_0_0.Op != OpSelect0 {
5596 break
5597 }
5598 v_2_0_0_0 := v_2_0_0.Args[0]
5599 if v_2_0_0_0.Op != OpS390XADDE {
5600 break
5601 }
5602 c := v_2_0_0_0.Args[2]
5603 v_2_0_0_0_0 := v_2_0_0_0.Args[0]
5604 if v_2_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0_0_0.AuxInt) != 0 {
5605 break
5606 }
5607 v_2_0_0_0_1 := v_2_0_0_0.Args[1]
5608 if v_2_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0_0_1.AuxInt) != 0 {
5609 break
5610 }
5611 v.reset(OpS390XADDE)
5612 v.AddArg3(x, y, c)
5613 return true
5614 }
5615 return false
5616 }
5617 func rewriteValueS390X_OpS390XADDW(v *Value) bool {
5618 v_1 := v.Args[1]
5619 v_0 := v.Args[0]
5620 // match: (ADDW x (MOVDconst [c]))
5621 // result: (ADDWconst [int32(c)] x)
5622 for {
5623 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5624 x := v_0
5625 if v_1.Op != OpS390XMOVDconst {
5626 continue
5627 }
5628 c := auxIntToInt64(v_1.AuxInt)
5629 v.reset(OpS390XADDWconst)
5630 v.AuxInt = int32ToAuxInt(int32(c))
5631 v.AddArg(x)
5632 return true
5633 }
5634 break
5635 }
5636 // match: (ADDW x (NEGW y))
5637 // result: (SUBW x y)
5638 for {
5639 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5640 x := v_0
5641 if v_1.Op != OpS390XNEGW {
5642 continue
5643 }
5644 y := v_1.Args[0]
5645 v.reset(OpS390XSUBW)
5646 v.AddArg2(x, y)
5647 return true
5648 }
5649 break
5650 }
5651 // match: (ADDW <t> x g:(MOVWload [off] {sym} ptr mem))
5652 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
5653 // result: (ADDWload <t> [off] {sym} x ptr mem)
5654 for {
5655 t := v.Type
5656 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5657 x := v_0
5658 g := v_1
5659 if g.Op != OpS390XMOVWload {
5660 continue
5661 }
5662 off := auxIntToInt32(g.AuxInt)
5663 sym := auxToSym(g.Aux)
5664 mem := g.Args[1]
5665 ptr := g.Args[0]
5666 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
5667 continue
5668 }
5669 v.reset(OpS390XADDWload)
5670 v.Type = t
5671 v.AuxInt = int32ToAuxInt(off)
5672 v.Aux = symToAux(sym)
5673 v.AddArg3(x, ptr, mem)
5674 return true
5675 }
5676 break
5677 }
5678 // match: (ADDW <t> x g:(MOVWZload [off] {sym} ptr mem))
5679 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
5680 // result: (ADDWload <t> [off] {sym} x ptr mem)
5681 for {
5682 t := v.Type
5683 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5684 x := v_0
5685 g := v_1
5686 if g.Op != OpS390XMOVWZload {
5687 continue
5688 }
5689 off := auxIntToInt32(g.AuxInt)
5690 sym := auxToSym(g.Aux)
5691 mem := g.Args[1]
5692 ptr := g.Args[0]
5693 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
5694 continue
5695 }
5696 v.reset(OpS390XADDWload)
5697 v.Type = t
5698 v.AuxInt = int32ToAuxInt(off)
5699 v.Aux = symToAux(sym)
5700 v.AddArg3(x, ptr, mem)
5701 return true
5702 }
5703 break
5704 }
5705 return false
5706 }
5707 func rewriteValueS390X_OpS390XADDWconst(v *Value) bool {
5708 v_0 := v.Args[0]
5709 // match: (ADDWconst [c] x)
5710 // cond: int32(c)==0
5711 // result: x
5712 for {
5713 c := auxIntToInt32(v.AuxInt)
5714 x := v_0
5715 if !(int32(c) == 0) {
5716 break
5717 }
5718 v.copyOf(x)
5719 return true
5720 }
5721 // match: (ADDWconst [c] (MOVDconst [d]))
5722 // result: (MOVDconst [int64(c)+d])
5723 for {
5724 c := auxIntToInt32(v.AuxInt)
5725 if v_0.Op != OpS390XMOVDconst {
5726 break
5727 }
5728 d := auxIntToInt64(v_0.AuxInt)
5729 v.reset(OpS390XMOVDconst)
5730 v.AuxInt = int64ToAuxInt(int64(c) + d)
5731 return true
5732 }
5733 // match: (ADDWconst [c] (ADDWconst [d] x))
5734 // result: (ADDWconst [int32(c+d)] x)
5735 for {
5736 c := auxIntToInt32(v.AuxInt)
5737 if v_0.Op != OpS390XADDWconst {
5738 break
5739 }
5740 d := auxIntToInt32(v_0.AuxInt)
5741 x := v_0.Args[0]
5742 v.reset(OpS390XADDWconst)
5743 v.AuxInt = int32ToAuxInt(int32(c + d))
5744 v.AddArg(x)
5745 return true
5746 }
5747 return false
5748 }
5749 func rewriteValueS390X_OpS390XADDWload(v *Value) bool {
5750 v_2 := v.Args[2]
5751 v_1 := v.Args[1]
5752 v_0 := v.Args[0]
5753 // match: (ADDWload [off1] {sym} x (ADDconst [off2] ptr) mem)
5754 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
5755 // result: (ADDWload [off1+off2] {sym} x ptr mem)
5756 for {
5757 off1 := auxIntToInt32(v.AuxInt)
5758 sym := auxToSym(v.Aux)
5759 x := v_0
5760 if v_1.Op != OpS390XADDconst {
5761 break
5762 }
5763 off2 := auxIntToInt32(v_1.AuxInt)
5764 ptr := v_1.Args[0]
5765 mem := v_2
5766 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
5767 break
5768 }
5769 v.reset(OpS390XADDWload)
5770 v.AuxInt = int32ToAuxInt(off1 + off2)
5771 v.Aux = symToAux(sym)
5772 v.AddArg3(x, ptr, mem)
5773 return true
5774 }
5775 // match: (ADDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
5776 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
5777 // result: (ADDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
5778 for {
5779 o1 := auxIntToInt32(v.AuxInt)
5780 s1 := auxToSym(v.Aux)
5781 x := v_0
5782 if v_1.Op != OpS390XMOVDaddr {
5783 break
5784 }
5785 o2 := auxIntToInt32(v_1.AuxInt)
5786 s2 := auxToSym(v_1.Aux)
5787 ptr := v_1.Args[0]
5788 mem := v_2
5789 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
5790 break
5791 }
5792 v.reset(OpS390XADDWload)
5793 v.AuxInt = int32ToAuxInt(o1 + o2)
5794 v.Aux = symToAux(mergeSym(s1, s2))
5795 v.AddArg3(x, ptr, mem)
5796 return true
5797 }
5798 return false
5799 }
5800 func rewriteValueS390X_OpS390XADDconst(v *Value) bool {
5801 v_0 := v.Args[0]
5802 // match: (ADDconst [c] (MOVDaddr [d] {s} x:(SB)))
5803 // cond: ((c+d)&1 == 0) && is32Bit(int64(c)+int64(d))
5804 // result: (MOVDaddr [c+d] {s} x)
5805 for {
5806 c := auxIntToInt32(v.AuxInt)
5807 if v_0.Op != OpS390XMOVDaddr {
5808 break
5809 }
5810 d := auxIntToInt32(v_0.AuxInt)
5811 s := auxToSym(v_0.Aux)
5812 x := v_0.Args[0]
5813 if x.Op != OpSB || !(((c+d)&1 == 0) && is32Bit(int64(c)+int64(d))) {
5814 break
5815 }
5816 v.reset(OpS390XMOVDaddr)
5817 v.AuxInt = int32ToAuxInt(c + d)
5818 v.Aux = symToAux(s)
5819 v.AddArg(x)
5820 return true
5821 }
5822 // match: (ADDconst [c] (MOVDaddr [d] {s} x))
5823 // cond: x.Op != OpSB && is20Bit(int64(c)+int64(d))
5824 // result: (MOVDaddr [c+d] {s} x)
5825 for {
5826 c := auxIntToInt32(v.AuxInt)
5827 if v_0.Op != OpS390XMOVDaddr {
5828 break
5829 }
5830 d := auxIntToInt32(v_0.AuxInt)
5831 s := auxToSym(v_0.Aux)
5832 x := v_0.Args[0]
5833 if !(x.Op != OpSB && is20Bit(int64(c)+int64(d))) {
5834 break
5835 }
5836 v.reset(OpS390XMOVDaddr)
5837 v.AuxInt = int32ToAuxInt(c + d)
5838 v.Aux = symToAux(s)
5839 v.AddArg(x)
5840 return true
5841 }
5842 // match: (ADDconst [c] (MOVDaddridx [d] {s} x y))
5843 // cond: is20Bit(int64(c)+int64(d))
5844 // result: (MOVDaddridx [c+d] {s} x y)
5845 for {
5846 c := auxIntToInt32(v.AuxInt)
5847 if v_0.Op != OpS390XMOVDaddridx {
5848 break
5849 }
5850 d := auxIntToInt32(v_0.AuxInt)
5851 s := auxToSym(v_0.Aux)
5852 y := v_0.Args[1]
5853 x := v_0.Args[0]
5854 if !(is20Bit(int64(c) + int64(d))) {
5855 break
5856 }
5857 v.reset(OpS390XMOVDaddridx)
5858 v.AuxInt = int32ToAuxInt(c + d)
5859 v.Aux = symToAux(s)
5860 v.AddArg2(x, y)
5861 return true
5862 }
5863 // match: (ADDconst [0] x)
5864 // result: x
5865 for {
5866 if auxIntToInt32(v.AuxInt) != 0 {
5867 break
5868 }
5869 x := v_0
5870 v.copyOf(x)
5871 return true
5872 }
5873 // match: (ADDconst [c] (MOVDconst [d]))
5874 // result: (MOVDconst [int64(c)+d])
5875 for {
5876 c := auxIntToInt32(v.AuxInt)
5877 if v_0.Op != OpS390XMOVDconst {
5878 break
5879 }
5880 d := auxIntToInt64(v_0.AuxInt)
5881 v.reset(OpS390XMOVDconst)
5882 v.AuxInt = int64ToAuxInt(int64(c) + d)
5883 return true
5884 }
5885 // match: (ADDconst [c] (ADDconst [d] x))
5886 // cond: is32Bit(int64(c)+int64(d))
5887 // result: (ADDconst [c+d] x)
5888 for {
5889 c := auxIntToInt32(v.AuxInt)
5890 if v_0.Op != OpS390XADDconst {
5891 break
5892 }
5893 d := auxIntToInt32(v_0.AuxInt)
5894 x := v_0.Args[0]
5895 if !(is32Bit(int64(c) + int64(d))) {
5896 break
5897 }
5898 v.reset(OpS390XADDconst)
5899 v.AuxInt = int32ToAuxInt(c + d)
5900 v.AddArg(x)
5901 return true
5902 }
5903 return false
5904 }
5905 func rewriteValueS390X_OpS390XADDload(v *Value) bool {
5906 v_2 := v.Args[2]
5907 v_1 := v.Args[1]
5908 v_0 := v.Args[0]
5909 b := v.Block
5910 // match: (ADDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
5911 // cond: isSamePtr(ptr1, ptr2)
5912 // result: (ADD x (LGDR <t> y))
5913 for {
5914 t := v.Type
5915 off := auxIntToInt32(v.AuxInt)
5916 sym := auxToSym(v.Aux)
5917 x := v_0
5918 ptr1 := v_1
5919 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
5920 break
5921 }
5922 y := v_2.Args[1]
5923 ptr2 := v_2.Args[0]
5924 if !(isSamePtr(ptr1, ptr2)) {
5925 break
5926 }
5927 v.reset(OpS390XADD)
5928 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
5929 v0.AddArg(y)
5930 v.AddArg2(x, v0)
5931 return true
5932 }
5933 // match: (ADDload [off1] {sym} x (ADDconst [off2] ptr) mem)
5934 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
5935 // result: (ADDload [off1+off2] {sym} x ptr mem)
5936 for {
5937 off1 := auxIntToInt32(v.AuxInt)
5938 sym := auxToSym(v.Aux)
5939 x := v_0
5940 if v_1.Op != OpS390XADDconst {
5941 break
5942 }
5943 off2 := auxIntToInt32(v_1.AuxInt)
5944 ptr := v_1.Args[0]
5945 mem := v_2
5946 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
5947 break
5948 }
5949 v.reset(OpS390XADDload)
5950 v.AuxInt = int32ToAuxInt(off1 + off2)
5951 v.Aux = symToAux(sym)
5952 v.AddArg3(x, ptr, mem)
5953 return true
5954 }
5955 // match: (ADDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
5956 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
5957 // result: (ADDload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
5958 for {
5959 o1 := auxIntToInt32(v.AuxInt)
5960 s1 := auxToSym(v.Aux)
5961 x := v_0
5962 if v_1.Op != OpS390XMOVDaddr {
5963 break
5964 }
5965 o2 := auxIntToInt32(v_1.AuxInt)
5966 s2 := auxToSym(v_1.Aux)
5967 ptr := v_1.Args[0]
5968 mem := v_2
5969 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
5970 break
5971 }
5972 v.reset(OpS390XADDload)
5973 v.AuxInt = int32ToAuxInt(o1 + o2)
5974 v.Aux = symToAux(mergeSym(s1, s2))
5975 v.AddArg3(x, ptr, mem)
5976 return true
5977 }
5978 return false
5979 }
5980 func rewriteValueS390X_OpS390XAND(v *Value) bool {
5981 v_1 := v.Args[1]
5982 v_0 := v.Args[0]
5983 b := v.Block
5984 typ := &b.Func.Config.Types
5985 // match: (AND x (MOVDconst [c]))
5986 // cond: s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)) != nil
5987 // result: (RISBGZ x {*s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c))})
5988 for {
5989 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5990 x := v_0
5991 if v_1.Op != OpS390XMOVDconst {
5992 continue
5993 }
5994 c := auxIntToInt64(v_1.AuxInt)
5995 if !(s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)) != nil) {
5996 continue
5997 }
5998 v.reset(OpS390XRISBGZ)
5999 v.Aux = s390xRotateParamsToAux(*s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)))
6000 v.AddArg(x)
6001 return true
6002 }
6003 break
6004 }
6005 // match: (AND x (MOVDconst [c]))
6006 // cond: is32Bit(c) && c < 0
6007 // result: (ANDconst [c] x)
6008 for {
6009 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6010 x := v_0
6011 if v_1.Op != OpS390XMOVDconst {
6012 continue
6013 }
6014 c := auxIntToInt64(v_1.AuxInt)
6015 if !(is32Bit(c) && c < 0) {
6016 continue
6017 }
6018 v.reset(OpS390XANDconst)
6019 v.AuxInt = int64ToAuxInt(c)
6020 v.AddArg(x)
6021 return true
6022 }
6023 break
6024 }
6025 // match: (AND x (MOVDconst [c]))
6026 // cond: is32Bit(c) && c >= 0
6027 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(c)] x))
6028 for {
6029 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6030 x := v_0
6031 if v_1.Op != OpS390XMOVDconst {
6032 continue
6033 }
6034 c := auxIntToInt64(v_1.AuxInt)
6035 if !(is32Bit(c) && c >= 0) {
6036 continue
6037 }
6038 v.reset(OpS390XMOVWZreg)
6039 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
6040 v0.AuxInt = int32ToAuxInt(int32(c))
6041 v0.AddArg(x)
6042 v.AddArg(v0)
6043 return true
6044 }
6045 break
6046 }
6047 // match: (AND (MOVDconst [c]) (MOVDconst [d]))
6048 // result: (MOVDconst [c&d])
6049 for {
6050 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6051 if v_0.Op != OpS390XMOVDconst {
6052 continue
6053 }
6054 c := auxIntToInt64(v_0.AuxInt)
6055 if v_1.Op != OpS390XMOVDconst {
6056 continue
6057 }
6058 d := auxIntToInt64(v_1.AuxInt)
6059 v.reset(OpS390XMOVDconst)
6060 v.AuxInt = int64ToAuxInt(c & d)
6061 return true
6062 }
6063 break
6064 }
6065 // match: (AND x x)
6066 // result: x
6067 for {
6068 x := v_0
6069 if x != v_1 {
6070 break
6071 }
6072 v.copyOf(x)
6073 return true
6074 }
6075 // match: (AND <t> x g:(MOVDload [off] {sym} ptr mem))
6076 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
6077 // result: (ANDload <t> [off] {sym} x ptr mem)
6078 for {
6079 t := v.Type
6080 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6081 x := v_0
6082 g := v_1
6083 if g.Op != OpS390XMOVDload {
6084 continue
6085 }
6086 off := auxIntToInt32(g.AuxInt)
6087 sym := auxToSym(g.Aux)
6088 mem := g.Args[1]
6089 ptr := g.Args[0]
6090 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
6091 continue
6092 }
6093 v.reset(OpS390XANDload)
6094 v.Type = t
6095 v.AuxInt = int32ToAuxInt(off)
6096 v.Aux = symToAux(sym)
6097 v.AddArg3(x, ptr, mem)
6098 return true
6099 }
6100 break
6101 }
6102 return false
6103 }
6104 func rewriteValueS390X_OpS390XANDW(v *Value) bool {
6105 v_1 := v.Args[1]
6106 v_0 := v.Args[0]
6107 // match: (ANDW x (MOVDconst [c]))
6108 // result: (ANDWconst [int32(c)] x)
6109 for {
6110 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6111 x := v_0
6112 if v_1.Op != OpS390XMOVDconst {
6113 continue
6114 }
6115 c := auxIntToInt64(v_1.AuxInt)
6116 v.reset(OpS390XANDWconst)
6117 v.AuxInt = int32ToAuxInt(int32(c))
6118 v.AddArg(x)
6119 return true
6120 }
6121 break
6122 }
6123 // match: (ANDW x x)
6124 // result: x
6125 for {
6126 x := v_0
6127 if x != v_1 {
6128 break
6129 }
6130 v.copyOf(x)
6131 return true
6132 }
6133 // match: (ANDW <t> x g:(MOVWload [off] {sym} ptr mem))
6134 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
6135 // result: (ANDWload <t> [off] {sym} x ptr mem)
6136 for {
6137 t := v.Type
6138 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6139 x := v_0
6140 g := v_1
6141 if g.Op != OpS390XMOVWload {
6142 continue
6143 }
6144 off := auxIntToInt32(g.AuxInt)
6145 sym := auxToSym(g.Aux)
6146 mem := g.Args[1]
6147 ptr := g.Args[0]
6148 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
6149 continue
6150 }
6151 v.reset(OpS390XANDWload)
6152 v.Type = t
6153 v.AuxInt = int32ToAuxInt(off)
6154 v.Aux = symToAux(sym)
6155 v.AddArg3(x, ptr, mem)
6156 return true
6157 }
6158 break
6159 }
6160 // match: (ANDW <t> x g:(MOVWZload [off] {sym} ptr mem))
6161 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
6162 // result: (ANDWload <t> [off] {sym} x ptr mem)
6163 for {
6164 t := v.Type
6165 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6166 x := v_0
6167 g := v_1
6168 if g.Op != OpS390XMOVWZload {
6169 continue
6170 }
6171 off := auxIntToInt32(g.AuxInt)
6172 sym := auxToSym(g.Aux)
6173 mem := g.Args[1]
6174 ptr := g.Args[0]
6175 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
6176 continue
6177 }
6178 v.reset(OpS390XANDWload)
6179 v.Type = t
6180 v.AuxInt = int32ToAuxInt(off)
6181 v.Aux = symToAux(sym)
6182 v.AddArg3(x, ptr, mem)
6183 return true
6184 }
6185 break
6186 }
6187 return false
6188 }
6189 func rewriteValueS390X_OpS390XANDWconst(v *Value) bool {
6190 v_0 := v.Args[0]
6191 // match: (ANDWconst [c] (ANDWconst [d] x))
6192 // result: (ANDWconst [c&d] x)
6193 for {
6194 c := auxIntToInt32(v.AuxInt)
6195 if v_0.Op != OpS390XANDWconst {
6196 break
6197 }
6198 d := auxIntToInt32(v_0.AuxInt)
6199 x := v_0.Args[0]
6200 v.reset(OpS390XANDWconst)
6201 v.AuxInt = int32ToAuxInt(c & d)
6202 v.AddArg(x)
6203 return true
6204 }
6205 // match: (ANDWconst [0x00ff] x)
6206 // result: (MOVBZreg x)
6207 for {
6208 if auxIntToInt32(v.AuxInt) != 0x00ff {
6209 break
6210 }
6211 x := v_0
6212 v.reset(OpS390XMOVBZreg)
6213 v.AddArg(x)
6214 return true
6215 }
6216 // match: (ANDWconst [0xffff] x)
6217 // result: (MOVHZreg x)
6218 for {
6219 if auxIntToInt32(v.AuxInt) != 0xffff {
6220 break
6221 }
6222 x := v_0
6223 v.reset(OpS390XMOVHZreg)
6224 v.AddArg(x)
6225 return true
6226 }
6227 // match: (ANDWconst [c] _)
6228 // cond: int32(c)==0
6229 // result: (MOVDconst [0])
6230 for {
6231 c := auxIntToInt32(v.AuxInt)
6232 if !(int32(c) == 0) {
6233 break
6234 }
6235 v.reset(OpS390XMOVDconst)
6236 v.AuxInt = int64ToAuxInt(0)
6237 return true
6238 }
6239 // match: (ANDWconst [c] x)
6240 // cond: int32(c)==-1
6241 // result: x
6242 for {
6243 c := auxIntToInt32(v.AuxInt)
6244 x := v_0
6245 if !(int32(c) == -1) {
6246 break
6247 }
6248 v.copyOf(x)
6249 return true
6250 }
6251 // match: (ANDWconst [c] (MOVDconst [d]))
6252 // result: (MOVDconst [int64(c)&d])
6253 for {
6254 c := auxIntToInt32(v.AuxInt)
6255 if v_0.Op != OpS390XMOVDconst {
6256 break
6257 }
6258 d := auxIntToInt64(v_0.AuxInt)
6259 v.reset(OpS390XMOVDconst)
6260 v.AuxInt = int64ToAuxInt(int64(c) & d)
6261 return true
6262 }
6263 return false
6264 }
6265 func rewriteValueS390X_OpS390XANDWload(v *Value) bool {
6266 v_2 := v.Args[2]
6267 v_1 := v.Args[1]
6268 v_0 := v.Args[0]
6269 // match: (ANDWload [off1] {sym} x (ADDconst [off2] ptr) mem)
6270 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
6271 // result: (ANDWload [off1+off2] {sym} x ptr mem)
6272 for {
6273 off1 := auxIntToInt32(v.AuxInt)
6274 sym := auxToSym(v.Aux)
6275 x := v_0
6276 if v_1.Op != OpS390XADDconst {
6277 break
6278 }
6279 off2 := auxIntToInt32(v_1.AuxInt)
6280 ptr := v_1.Args[0]
6281 mem := v_2
6282 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
6283 break
6284 }
6285 v.reset(OpS390XANDWload)
6286 v.AuxInt = int32ToAuxInt(off1 + off2)
6287 v.Aux = symToAux(sym)
6288 v.AddArg3(x, ptr, mem)
6289 return true
6290 }
6291 // match: (ANDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
6292 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
6293 // result: (ANDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
6294 for {
6295 o1 := auxIntToInt32(v.AuxInt)
6296 s1 := auxToSym(v.Aux)
6297 x := v_0
6298 if v_1.Op != OpS390XMOVDaddr {
6299 break
6300 }
6301 o2 := auxIntToInt32(v_1.AuxInt)
6302 s2 := auxToSym(v_1.Aux)
6303 ptr := v_1.Args[0]
6304 mem := v_2
6305 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
6306 break
6307 }
6308 v.reset(OpS390XANDWload)
6309 v.AuxInt = int32ToAuxInt(o1 + o2)
6310 v.Aux = symToAux(mergeSym(s1, s2))
6311 v.AddArg3(x, ptr, mem)
6312 return true
6313 }
6314 return false
6315 }
6316 func rewriteValueS390X_OpS390XANDconst(v *Value) bool {
6317 v_0 := v.Args[0]
6318 // match: (ANDconst [c] (ANDconst [d] x))
6319 // result: (ANDconst [c&d] x)
6320 for {
6321 c := auxIntToInt64(v.AuxInt)
6322 if v_0.Op != OpS390XANDconst {
6323 break
6324 }
6325 d := auxIntToInt64(v_0.AuxInt)
6326 x := v_0.Args[0]
6327 v.reset(OpS390XANDconst)
6328 v.AuxInt = int64ToAuxInt(c & d)
6329 v.AddArg(x)
6330 return true
6331 }
6332 // match: (ANDconst [0] _)
6333 // result: (MOVDconst [0])
6334 for {
6335 if auxIntToInt64(v.AuxInt) != 0 {
6336 break
6337 }
6338 v.reset(OpS390XMOVDconst)
6339 v.AuxInt = int64ToAuxInt(0)
6340 return true
6341 }
6342 // match: (ANDconst [-1] x)
6343 // result: x
6344 for {
6345 if auxIntToInt64(v.AuxInt) != -1 {
6346 break
6347 }
6348 x := v_0
6349 v.copyOf(x)
6350 return true
6351 }
6352 // match: (ANDconst [c] (MOVDconst [d]))
6353 // result: (MOVDconst [c&d])
6354 for {
6355 c := auxIntToInt64(v.AuxInt)
6356 if v_0.Op != OpS390XMOVDconst {
6357 break
6358 }
6359 d := auxIntToInt64(v_0.AuxInt)
6360 v.reset(OpS390XMOVDconst)
6361 v.AuxInt = int64ToAuxInt(c & d)
6362 return true
6363 }
6364 return false
6365 }
6366 func rewriteValueS390X_OpS390XANDload(v *Value) bool {
6367 v_2 := v.Args[2]
6368 v_1 := v.Args[1]
6369 v_0 := v.Args[0]
6370 b := v.Block
6371 // match: (ANDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
6372 // cond: isSamePtr(ptr1, ptr2)
6373 // result: (AND x (LGDR <t> y))
6374 for {
6375 t := v.Type
6376 off := auxIntToInt32(v.AuxInt)
6377 sym := auxToSym(v.Aux)
6378 x := v_0
6379 ptr1 := v_1
6380 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
6381 break
6382 }
6383 y := v_2.Args[1]
6384 ptr2 := v_2.Args[0]
6385 if !(isSamePtr(ptr1, ptr2)) {
6386 break
6387 }
6388 v.reset(OpS390XAND)
6389 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
6390 v0.AddArg(y)
6391 v.AddArg2(x, v0)
6392 return true
6393 }
6394 // match: (ANDload [off1] {sym} x (ADDconst [off2] ptr) mem)
6395 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
6396 // result: (ANDload [off1+off2] {sym} x ptr mem)
6397 for {
6398 off1 := auxIntToInt32(v.AuxInt)
6399 sym := auxToSym(v.Aux)
6400 x := v_0
6401 if v_1.Op != OpS390XADDconst {
6402 break
6403 }
6404 off2 := auxIntToInt32(v_1.AuxInt)
6405 ptr := v_1.Args[0]
6406 mem := v_2
6407 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
6408 break
6409 }
6410 v.reset(OpS390XANDload)
6411 v.AuxInt = int32ToAuxInt(off1 + off2)
6412 v.Aux = symToAux(sym)
6413 v.AddArg3(x, ptr, mem)
6414 return true
6415 }
6416 // match: (ANDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
6417 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
6418 // result: (ANDload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
6419 for {
6420 o1 := auxIntToInt32(v.AuxInt)
6421 s1 := auxToSym(v.Aux)
6422 x := v_0
6423 if v_1.Op != OpS390XMOVDaddr {
6424 break
6425 }
6426 o2 := auxIntToInt32(v_1.AuxInt)
6427 s2 := auxToSym(v_1.Aux)
6428 ptr := v_1.Args[0]
6429 mem := v_2
6430 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
6431 break
6432 }
6433 v.reset(OpS390XANDload)
6434 v.AuxInt = int32ToAuxInt(o1 + o2)
6435 v.Aux = symToAux(mergeSym(s1, s2))
6436 v.AddArg3(x, ptr, mem)
6437 return true
6438 }
6439 return false
6440 }
6441 func rewriteValueS390X_OpS390XCMP(v *Value) bool {
6442 v_1 := v.Args[1]
6443 v_0 := v.Args[0]
6444 b := v.Block
6445 // match: (CMP x (MOVDconst [c]))
6446 // cond: is32Bit(c)
6447 // result: (CMPconst x [int32(c)])
6448 for {
6449 x := v_0
6450 if v_1.Op != OpS390XMOVDconst {
6451 break
6452 }
6453 c := auxIntToInt64(v_1.AuxInt)
6454 if !(is32Bit(c)) {
6455 break
6456 }
6457 v.reset(OpS390XCMPconst)
6458 v.AuxInt = int32ToAuxInt(int32(c))
6459 v.AddArg(x)
6460 return true
6461 }
6462 // match: (CMP (MOVDconst [c]) x)
6463 // cond: is32Bit(c)
6464 // result: (InvertFlags (CMPconst x [int32(c)]))
6465 for {
6466 if v_0.Op != OpS390XMOVDconst {
6467 break
6468 }
6469 c := auxIntToInt64(v_0.AuxInt)
6470 x := v_1
6471 if !(is32Bit(c)) {
6472 break
6473 }
6474 v.reset(OpS390XInvertFlags)
6475 v0 := b.NewValue0(v.Pos, OpS390XCMPconst, types.TypeFlags)
6476 v0.AuxInt = int32ToAuxInt(int32(c))
6477 v0.AddArg(x)
6478 v.AddArg(v0)
6479 return true
6480 }
6481 // match: (CMP x y)
6482 // cond: canonLessThan(x,y)
6483 // result: (InvertFlags (CMP y x))
6484 for {
6485 x := v_0
6486 y := v_1
6487 if !(canonLessThan(x, y)) {
6488 break
6489 }
6490 v.reset(OpS390XInvertFlags)
6491 v0 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags)
6492 v0.AddArg2(y, x)
6493 v.AddArg(v0)
6494 return true
6495 }
6496 return false
6497 }
6498 func rewriteValueS390X_OpS390XCMPU(v *Value) bool {
6499 v_1 := v.Args[1]
6500 v_0 := v.Args[0]
6501 b := v.Block
6502 // match: (CMPU x (MOVDconst [c]))
6503 // cond: isU32Bit(c)
6504 // result: (CMPUconst x [int32(c)])
6505 for {
6506 x := v_0
6507 if v_1.Op != OpS390XMOVDconst {
6508 break
6509 }
6510 c := auxIntToInt64(v_1.AuxInt)
6511 if !(isU32Bit(c)) {
6512 break
6513 }
6514 v.reset(OpS390XCMPUconst)
6515 v.AuxInt = int32ToAuxInt(int32(c))
6516 v.AddArg(x)
6517 return true
6518 }
6519 // match: (CMPU (MOVDconst [c]) x)
6520 // cond: isU32Bit(c)
6521 // result: (InvertFlags (CMPUconst x [int32(c)]))
6522 for {
6523 if v_0.Op != OpS390XMOVDconst {
6524 break
6525 }
6526 c := auxIntToInt64(v_0.AuxInt)
6527 x := v_1
6528 if !(isU32Bit(c)) {
6529 break
6530 }
6531 v.reset(OpS390XInvertFlags)
6532 v0 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags)
6533 v0.AuxInt = int32ToAuxInt(int32(c))
6534 v0.AddArg(x)
6535 v.AddArg(v0)
6536 return true
6537 }
6538 // match: (CMPU x y)
6539 // cond: canonLessThan(x,y)
6540 // result: (InvertFlags (CMPU y x))
6541 for {
6542 x := v_0
6543 y := v_1
6544 if !(canonLessThan(x, y)) {
6545 break
6546 }
6547 v.reset(OpS390XInvertFlags)
6548 v0 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags)
6549 v0.AddArg2(y, x)
6550 v.AddArg(v0)
6551 return true
6552 }
6553 return false
6554 }
6555 func rewriteValueS390X_OpS390XCMPUconst(v *Value) bool {
6556 v_0 := v.Args[0]
6557 // match: (CMPUconst (MOVDconst [x]) [y])
6558 // cond: uint64(x)==uint64(y)
6559 // result: (FlagEQ)
6560 for {
6561 y := auxIntToInt32(v.AuxInt)
6562 if v_0.Op != OpS390XMOVDconst {
6563 break
6564 }
6565 x := auxIntToInt64(v_0.AuxInt)
6566 if !(uint64(x) == uint64(y)) {
6567 break
6568 }
6569 v.reset(OpS390XFlagEQ)
6570 return true
6571 }
6572 // match: (CMPUconst (MOVDconst [x]) [y])
6573 // cond: uint64(x)<uint64(y)
6574 // result: (FlagLT)
6575 for {
6576 y := auxIntToInt32(v.AuxInt)
6577 if v_0.Op != OpS390XMOVDconst {
6578 break
6579 }
6580 x := auxIntToInt64(v_0.AuxInt)
6581 if !(uint64(x) < uint64(y)) {
6582 break
6583 }
6584 v.reset(OpS390XFlagLT)
6585 return true
6586 }
6587 // match: (CMPUconst (MOVDconst [x]) [y])
6588 // cond: uint64(x)>uint64(y)
6589 // result: (FlagGT)
6590 for {
6591 y := auxIntToInt32(v.AuxInt)
6592 if v_0.Op != OpS390XMOVDconst {
6593 break
6594 }
6595 x := auxIntToInt64(v_0.AuxInt)
6596 if !(uint64(x) > uint64(y)) {
6597 break
6598 }
6599 v.reset(OpS390XFlagGT)
6600 return true
6601 }
6602 // match: (CMPUconst (SRDconst _ [c]) [n])
6603 // cond: c > 0 && c < 64 && (1<<uint(64-c)) <= uint64(n)
6604 // result: (FlagLT)
6605 for {
6606 n := auxIntToInt32(v.AuxInt)
6607 if v_0.Op != OpS390XSRDconst {
6608 break
6609 }
6610 c := auxIntToUint8(v_0.AuxInt)
6611 if !(c > 0 && c < 64 && (1<<uint(64-c)) <= uint64(n)) {
6612 break
6613 }
6614 v.reset(OpS390XFlagLT)
6615 return true
6616 }
6617 // match: (CMPUconst (RISBGZ x {r}) [c])
6618 // cond: r.OutMask() < uint64(uint32(c))
6619 // result: (FlagLT)
6620 for {
6621 c := auxIntToInt32(v.AuxInt)
6622 if v_0.Op != OpS390XRISBGZ {
6623 break
6624 }
6625 r := auxToS390xRotateParams(v_0.Aux)
6626 if !(r.OutMask() < uint64(uint32(c))) {
6627 break
6628 }
6629 v.reset(OpS390XFlagLT)
6630 return true
6631 }
6632 // match: (CMPUconst (MOVWZreg x) [c])
6633 // result: (CMPWUconst x [c])
6634 for {
6635 c := auxIntToInt32(v.AuxInt)
6636 if v_0.Op != OpS390XMOVWZreg {
6637 break
6638 }
6639 x := v_0.Args[0]
6640 v.reset(OpS390XCMPWUconst)
6641 v.AuxInt = int32ToAuxInt(c)
6642 v.AddArg(x)
6643 return true
6644 }
6645 // match: (CMPUconst x:(MOVHreg _) [c])
6646 // result: (CMPWUconst x [c])
6647 for {
6648 c := auxIntToInt32(v.AuxInt)
6649 x := v_0
6650 if x.Op != OpS390XMOVHreg {
6651 break
6652 }
6653 v.reset(OpS390XCMPWUconst)
6654 v.AuxInt = int32ToAuxInt(c)
6655 v.AddArg(x)
6656 return true
6657 }
6658 // match: (CMPUconst x:(MOVHZreg _) [c])
6659 // result: (CMPWUconst x [c])
6660 for {
6661 c := auxIntToInt32(v.AuxInt)
6662 x := v_0
6663 if x.Op != OpS390XMOVHZreg {
6664 break
6665 }
6666 v.reset(OpS390XCMPWUconst)
6667 v.AuxInt = int32ToAuxInt(c)
6668 v.AddArg(x)
6669 return true
6670 }
6671 // match: (CMPUconst x:(MOVBreg _) [c])
6672 // result: (CMPWUconst x [c])
6673 for {
6674 c := auxIntToInt32(v.AuxInt)
6675 x := v_0
6676 if x.Op != OpS390XMOVBreg {
6677 break
6678 }
6679 v.reset(OpS390XCMPWUconst)
6680 v.AuxInt = int32ToAuxInt(c)
6681 v.AddArg(x)
6682 return true
6683 }
6684 // match: (CMPUconst x:(MOVBZreg _) [c])
6685 // result: (CMPWUconst x [c])
6686 for {
6687 c := auxIntToInt32(v.AuxInt)
6688 x := v_0
6689 if x.Op != OpS390XMOVBZreg {
6690 break
6691 }
6692 v.reset(OpS390XCMPWUconst)
6693 v.AuxInt = int32ToAuxInt(c)
6694 v.AddArg(x)
6695 return true
6696 }
6697 // match: (CMPUconst (MOVWZreg x:(ANDWconst [m] _)) [c])
6698 // cond: int32(m) >= 0
6699 // result: (CMPWUconst x [c])
6700 for {
6701 c := auxIntToInt32(v.AuxInt)
6702 if v_0.Op != OpS390XMOVWZreg {
6703 break
6704 }
6705 x := v_0.Args[0]
6706 if x.Op != OpS390XANDWconst {
6707 break
6708 }
6709 m := auxIntToInt32(x.AuxInt)
6710 if !(int32(m) >= 0) {
6711 break
6712 }
6713 v.reset(OpS390XCMPWUconst)
6714 v.AuxInt = int32ToAuxInt(c)
6715 v.AddArg(x)
6716 return true
6717 }
6718 // match: (CMPUconst (MOVWreg x:(ANDWconst [m] _)) [c])
6719 // cond: int32(m) >= 0
6720 // result: (CMPWUconst x [c])
6721 for {
6722 c := auxIntToInt32(v.AuxInt)
6723 if v_0.Op != OpS390XMOVWreg {
6724 break
6725 }
6726 x := v_0.Args[0]
6727 if x.Op != OpS390XANDWconst {
6728 break
6729 }
6730 m := auxIntToInt32(x.AuxInt)
6731 if !(int32(m) >= 0) {
6732 break
6733 }
6734 v.reset(OpS390XCMPWUconst)
6735 v.AuxInt = int32ToAuxInt(c)
6736 v.AddArg(x)
6737 return true
6738 }
6739 return false
6740 }
6741 func rewriteValueS390X_OpS390XCMPW(v *Value) bool {
6742 v_1 := v.Args[1]
6743 v_0 := v.Args[0]
6744 b := v.Block
6745 // match: (CMPW x (MOVDconst [c]))
6746 // result: (CMPWconst x [int32(c)])
6747 for {
6748 x := v_0
6749 if v_1.Op != OpS390XMOVDconst {
6750 break
6751 }
6752 c := auxIntToInt64(v_1.AuxInt)
6753 v.reset(OpS390XCMPWconst)
6754 v.AuxInt = int32ToAuxInt(int32(c))
6755 v.AddArg(x)
6756 return true
6757 }
6758 // match: (CMPW (MOVDconst [c]) x)
6759 // result: (InvertFlags (CMPWconst x [int32(c)]))
6760 for {
6761 if v_0.Op != OpS390XMOVDconst {
6762 break
6763 }
6764 c := auxIntToInt64(v_0.AuxInt)
6765 x := v_1
6766 v.reset(OpS390XInvertFlags)
6767 v0 := b.NewValue0(v.Pos, OpS390XCMPWconst, types.TypeFlags)
6768 v0.AuxInt = int32ToAuxInt(int32(c))
6769 v0.AddArg(x)
6770 v.AddArg(v0)
6771 return true
6772 }
6773 // match: (CMPW x y)
6774 // cond: canonLessThan(x,y)
6775 // result: (InvertFlags (CMPW y x))
6776 for {
6777 x := v_0
6778 y := v_1
6779 if !(canonLessThan(x, y)) {
6780 break
6781 }
6782 v.reset(OpS390XInvertFlags)
6783 v0 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags)
6784 v0.AddArg2(y, x)
6785 v.AddArg(v0)
6786 return true
6787 }
6788 // match: (CMPW x (MOVWreg y))
6789 // result: (CMPW x y)
6790 for {
6791 x := v_0
6792 if v_1.Op != OpS390XMOVWreg {
6793 break
6794 }
6795 y := v_1.Args[0]
6796 v.reset(OpS390XCMPW)
6797 v.AddArg2(x, y)
6798 return true
6799 }
6800 // match: (CMPW x (MOVWZreg y))
6801 // result: (CMPW x y)
6802 for {
6803 x := v_0
6804 if v_1.Op != OpS390XMOVWZreg {
6805 break
6806 }
6807 y := v_1.Args[0]
6808 v.reset(OpS390XCMPW)
6809 v.AddArg2(x, y)
6810 return true
6811 }
6812 // match: (CMPW (MOVWreg x) y)
6813 // result: (CMPW x y)
6814 for {
6815 if v_0.Op != OpS390XMOVWreg {
6816 break
6817 }
6818 x := v_0.Args[0]
6819 y := v_1
6820 v.reset(OpS390XCMPW)
6821 v.AddArg2(x, y)
6822 return true
6823 }
6824 // match: (CMPW (MOVWZreg x) y)
6825 // result: (CMPW x y)
6826 for {
6827 if v_0.Op != OpS390XMOVWZreg {
6828 break
6829 }
6830 x := v_0.Args[0]
6831 y := v_1
6832 v.reset(OpS390XCMPW)
6833 v.AddArg2(x, y)
6834 return true
6835 }
6836 return false
6837 }
6838 func rewriteValueS390X_OpS390XCMPWU(v *Value) bool {
6839 v_1 := v.Args[1]
6840 v_0 := v.Args[0]
6841 b := v.Block
6842 // match: (CMPWU x (MOVDconst [c]))
6843 // result: (CMPWUconst x [int32(c)])
6844 for {
6845 x := v_0
6846 if v_1.Op != OpS390XMOVDconst {
6847 break
6848 }
6849 c := auxIntToInt64(v_1.AuxInt)
6850 v.reset(OpS390XCMPWUconst)
6851 v.AuxInt = int32ToAuxInt(int32(c))
6852 v.AddArg(x)
6853 return true
6854 }
6855 // match: (CMPWU (MOVDconst [c]) x)
6856 // result: (InvertFlags (CMPWUconst x [int32(c)]))
6857 for {
6858 if v_0.Op != OpS390XMOVDconst {
6859 break
6860 }
6861 c := auxIntToInt64(v_0.AuxInt)
6862 x := v_1
6863 v.reset(OpS390XInvertFlags)
6864 v0 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags)
6865 v0.AuxInt = int32ToAuxInt(int32(c))
6866 v0.AddArg(x)
6867 v.AddArg(v0)
6868 return true
6869 }
6870 // match: (CMPWU x y)
6871 // cond: canonLessThan(x,y)
6872 // result: (InvertFlags (CMPWU y x))
6873 for {
6874 x := v_0
6875 y := v_1
6876 if !(canonLessThan(x, y)) {
6877 break
6878 }
6879 v.reset(OpS390XInvertFlags)
6880 v0 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags)
6881 v0.AddArg2(y, x)
6882 v.AddArg(v0)
6883 return true
6884 }
6885 // match: (CMPWU x (MOVWreg y))
6886 // result: (CMPWU x y)
6887 for {
6888 x := v_0
6889 if v_1.Op != OpS390XMOVWreg {
6890 break
6891 }
6892 y := v_1.Args[0]
6893 v.reset(OpS390XCMPWU)
6894 v.AddArg2(x, y)
6895 return true
6896 }
6897 // match: (CMPWU x (MOVWZreg y))
6898 // result: (CMPWU x y)
6899 for {
6900 x := v_0
6901 if v_1.Op != OpS390XMOVWZreg {
6902 break
6903 }
6904 y := v_1.Args[0]
6905 v.reset(OpS390XCMPWU)
6906 v.AddArg2(x, y)
6907 return true
6908 }
6909 // match: (CMPWU (MOVWreg x) y)
6910 // result: (CMPWU x y)
6911 for {
6912 if v_0.Op != OpS390XMOVWreg {
6913 break
6914 }
6915 x := v_0.Args[0]
6916 y := v_1
6917 v.reset(OpS390XCMPWU)
6918 v.AddArg2(x, y)
6919 return true
6920 }
6921 // match: (CMPWU (MOVWZreg x) y)
6922 // result: (CMPWU x y)
6923 for {
6924 if v_0.Op != OpS390XMOVWZreg {
6925 break
6926 }
6927 x := v_0.Args[0]
6928 y := v_1
6929 v.reset(OpS390XCMPWU)
6930 v.AddArg2(x, y)
6931 return true
6932 }
6933 return false
6934 }
6935 func rewriteValueS390X_OpS390XCMPWUconst(v *Value) bool {
6936 v_0 := v.Args[0]
6937 // match: (CMPWUconst (MOVDconst [x]) [y])
6938 // cond: uint32(x)==uint32(y)
6939 // result: (FlagEQ)
6940 for {
6941 y := auxIntToInt32(v.AuxInt)
6942 if v_0.Op != OpS390XMOVDconst {
6943 break
6944 }
6945 x := auxIntToInt64(v_0.AuxInt)
6946 if !(uint32(x) == uint32(y)) {
6947 break
6948 }
6949 v.reset(OpS390XFlagEQ)
6950 return true
6951 }
6952 // match: (CMPWUconst (MOVDconst [x]) [y])
6953 // cond: uint32(x)<uint32(y)
6954 // result: (FlagLT)
6955 for {
6956 y := auxIntToInt32(v.AuxInt)
6957 if v_0.Op != OpS390XMOVDconst {
6958 break
6959 }
6960 x := auxIntToInt64(v_0.AuxInt)
6961 if !(uint32(x) < uint32(y)) {
6962 break
6963 }
6964 v.reset(OpS390XFlagLT)
6965 return true
6966 }
6967 // match: (CMPWUconst (MOVDconst [x]) [y])
6968 // cond: uint32(x)>uint32(y)
6969 // result: (FlagGT)
6970 for {
6971 y := auxIntToInt32(v.AuxInt)
6972 if v_0.Op != OpS390XMOVDconst {
6973 break
6974 }
6975 x := auxIntToInt64(v_0.AuxInt)
6976 if !(uint32(x) > uint32(y)) {
6977 break
6978 }
6979 v.reset(OpS390XFlagGT)
6980 return true
6981 }
6982 // match: (CMPWUconst (MOVBZreg _) [c])
6983 // cond: 0xff < c
6984 // result: (FlagLT)
6985 for {
6986 c := auxIntToInt32(v.AuxInt)
6987 if v_0.Op != OpS390XMOVBZreg || !(0xff < c) {
6988 break
6989 }
6990 v.reset(OpS390XFlagLT)
6991 return true
6992 }
6993 // match: (CMPWUconst (MOVHZreg _) [c])
6994 // cond: 0xffff < c
6995 // result: (FlagLT)
6996 for {
6997 c := auxIntToInt32(v.AuxInt)
6998 if v_0.Op != OpS390XMOVHZreg || !(0xffff < c) {
6999 break
7000 }
7001 v.reset(OpS390XFlagLT)
7002 return true
7003 }
7004 // match: (CMPWUconst (SRWconst _ [c]) [n])
7005 // cond: c > 0 && c < 32 && (1<<uint(32-c)) <= uint32(n)
7006 // result: (FlagLT)
7007 for {
7008 n := auxIntToInt32(v.AuxInt)
7009 if v_0.Op != OpS390XSRWconst {
7010 break
7011 }
7012 c := auxIntToUint8(v_0.AuxInt)
7013 if !(c > 0 && c < 32 && (1<<uint(32-c)) <= uint32(n)) {
7014 break
7015 }
7016 v.reset(OpS390XFlagLT)
7017 return true
7018 }
7019 // match: (CMPWUconst (ANDWconst _ [m]) [n])
7020 // cond: uint32(m) < uint32(n)
7021 // result: (FlagLT)
7022 for {
7023 n := auxIntToInt32(v.AuxInt)
7024 if v_0.Op != OpS390XANDWconst {
7025 break
7026 }
7027 m := auxIntToInt32(v_0.AuxInt)
7028 if !(uint32(m) < uint32(n)) {
7029 break
7030 }
7031 v.reset(OpS390XFlagLT)
7032 return true
7033 }
7034 // match: (CMPWUconst (MOVWreg x) [c])
7035 // result: (CMPWUconst x [c])
7036 for {
7037 c := auxIntToInt32(v.AuxInt)
7038 if v_0.Op != OpS390XMOVWreg {
7039 break
7040 }
7041 x := v_0.Args[0]
7042 v.reset(OpS390XCMPWUconst)
7043 v.AuxInt = int32ToAuxInt(c)
7044 v.AddArg(x)
7045 return true
7046 }
7047 // match: (CMPWUconst (MOVWZreg x) [c])
7048 // result: (CMPWUconst x [c])
7049 for {
7050 c := auxIntToInt32(v.AuxInt)
7051 if v_0.Op != OpS390XMOVWZreg {
7052 break
7053 }
7054 x := v_0.Args[0]
7055 v.reset(OpS390XCMPWUconst)
7056 v.AuxInt = int32ToAuxInt(c)
7057 v.AddArg(x)
7058 return true
7059 }
7060 return false
7061 }
7062 func rewriteValueS390X_OpS390XCMPWconst(v *Value) bool {
7063 v_0 := v.Args[0]
7064 // match: (CMPWconst (MOVDconst [x]) [y])
7065 // cond: int32(x)==int32(y)
7066 // result: (FlagEQ)
7067 for {
7068 y := auxIntToInt32(v.AuxInt)
7069 if v_0.Op != OpS390XMOVDconst {
7070 break
7071 }
7072 x := auxIntToInt64(v_0.AuxInt)
7073 if !(int32(x) == int32(y)) {
7074 break
7075 }
7076 v.reset(OpS390XFlagEQ)
7077 return true
7078 }
7079 // match: (CMPWconst (MOVDconst [x]) [y])
7080 // cond: int32(x)<int32(y)
7081 // result: (FlagLT)
7082 for {
7083 y := auxIntToInt32(v.AuxInt)
7084 if v_0.Op != OpS390XMOVDconst {
7085 break
7086 }
7087 x := auxIntToInt64(v_0.AuxInt)
7088 if !(int32(x) < int32(y)) {
7089 break
7090 }
7091 v.reset(OpS390XFlagLT)
7092 return true
7093 }
7094 // match: (CMPWconst (MOVDconst [x]) [y])
7095 // cond: int32(x)>int32(y)
7096 // result: (FlagGT)
7097 for {
7098 y := auxIntToInt32(v.AuxInt)
7099 if v_0.Op != OpS390XMOVDconst {
7100 break
7101 }
7102 x := auxIntToInt64(v_0.AuxInt)
7103 if !(int32(x) > int32(y)) {
7104 break
7105 }
7106 v.reset(OpS390XFlagGT)
7107 return true
7108 }
7109 // match: (CMPWconst (MOVBZreg _) [c])
7110 // cond: 0xff < c
7111 // result: (FlagLT)
7112 for {
7113 c := auxIntToInt32(v.AuxInt)
7114 if v_0.Op != OpS390XMOVBZreg || !(0xff < c) {
7115 break
7116 }
7117 v.reset(OpS390XFlagLT)
7118 return true
7119 }
7120 // match: (CMPWconst (MOVHZreg _) [c])
7121 // cond: 0xffff < c
7122 // result: (FlagLT)
7123 for {
7124 c := auxIntToInt32(v.AuxInt)
7125 if v_0.Op != OpS390XMOVHZreg || !(0xffff < c) {
7126 break
7127 }
7128 v.reset(OpS390XFlagLT)
7129 return true
7130 }
7131 // match: (CMPWconst (SRWconst _ [c]) [n])
7132 // cond: c > 0 && n < 0
7133 // result: (FlagGT)
7134 for {
7135 n := auxIntToInt32(v.AuxInt)
7136 if v_0.Op != OpS390XSRWconst {
7137 break
7138 }
7139 c := auxIntToUint8(v_0.AuxInt)
7140 if !(c > 0 && n < 0) {
7141 break
7142 }
7143 v.reset(OpS390XFlagGT)
7144 return true
7145 }
7146 // match: (CMPWconst (ANDWconst _ [m]) [n])
7147 // cond: int32(m) >= 0 && int32(m) < int32(n)
7148 // result: (FlagLT)
7149 for {
7150 n := auxIntToInt32(v.AuxInt)
7151 if v_0.Op != OpS390XANDWconst {
7152 break
7153 }
7154 m := auxIntToInt32(v_0.AuxInt)
7155 if !(int32(m) >= 0 && int32(m) < int32(n)) {
7156 break
7157 }
7158 v.reset(OpS390XFlagLT)
7159 return true
7160 }
7161 // match: (CMPWconst x:(SRWconst _ [c]) [n])
7162 // cond: c > 0 && n >= 0
7163 // result: (CMPWUconst x [n])
7164 for {
7165 n := auxIntToInt32(v.AuxInt)
7166 x := v_0
7167 if x.Op != OpS390XSRWconst {
7168 break
7169 }
7170 c := auxIntToUint8(x.AuxInt)
7171 if !(c > 0 && n >= 0) {
7172 break
7173 }
7174 v.reset(OpS390XCMPWUconst)
7175 v.AuxInt = int32ToAuxInt(n)
7176 v.AddArg(x)
7177 return true
7178 }
7179 // match: (CMPWconst (MOVWreg x) [c])
7180 // result: (CMPWconst x [c])
7181 for {
7182 c := auxIntToInt32(v.AuxInt)
7183 if v_0.Op != OpS390XMOVWreg {
7184 break
7185 }
7186 x := v_0.Args[0]
7187 v.reset(OpS390XCMPWconst)
7188 v.AuxInt = int32ToAuxInt(c)
7189 v.AddArg(x)
7190 return true
7191 }
7192 // match: (CMPWconst (MOVWZreg x) [c])
7193 // result: (CMPWconst x [c])
7194 for {
7195 c := auxIntToInt32(v.AuxInt)
7196 if v_0.Op != OpS390XMOVWZreg {
7197 break
7198 }
7199 x := v_0.Args[0]
7200 v.reset(OpS390XCMPWconst)
7201 v.AuxInt = int32ToAuxInt(c)
7202 v.AddArg(x)
7203 return true
7204 }
7205 return false
7206 }
7207 func rewriteValueS390X_OpS390XCMPconst(v *Value) bool {
7208 v_0 := v.Args[0]
7209 // match: (CMPconst (MOVDconst [x]) [y])
7210 // cond: x==int64(y)
7211 // result: (FlagEQ)
7212 for {
7213 y := auxIntToInt32(v.AuxInt)
7214 if v_0.Op != OpS390XMOVDconst {
7215 break
7216 }
7217 x := auxIntToInt64(v_0.AuxInt)
7218 if !(x == int64(y)) {
7219 break
7220 }
7221 v.reset(OpS390XFlagEQ)
7222 return true
7223 }
7224 // match: (CMPconst (MOVDconst [x]) [y])
7225 // cond: x<int64(y)
7226 // result: (FlagLT)
7227 for {
7228 y := auxIntToInt32(v.AuxInt)
7229 if v_0.Op != OpS390XMOVDconst {
7230 break
7231 }
7232 x := auxIntToInt64(v_0.AuxInt)
7233 if !(x < int64(y)) {
7234 break
7235 }
7236 v.reset(OpS390XFlagLT)
7237 return true
7238 }
7239 // match: (CMPconst (MOVDconst [x]) [y])
7240 // cond: x>int64(y)
7241 // result: (FlagGT)
7242 for {
7243 y := auxIntToInt32(v.AuxInt)
7244 if v_0.Op != OpS390XMOVDconst {
7245 break
7246 }
7247 x := auxIntToInt64(v_0.AuxInt)
7248 if !(x > int64(y)) {
7249 break
7250 }
7251 v.reset(OpS390XFlagGT)
7252 return true
7253 }
7254 // match: (CMPconst (SRDconst _ [c]) [n])
7255 // cond: c > 0 && n < 0
7256 // result: (FlagGT)
7257 for {
7258 n := auxIntToInt32(v.AuxInt)
7259 if v_0.Op != OpS390XSRDconst {
7260 break
7261 }
7262 c := auxIntToUint8(v_0.AuxInt)
7263 if !(c > 0 && n < 0) {
7264 break
7265 }
7266 v.reset(OpS390XFlagGT)
7267 return true
7268 }
7269 // match: (CMPconst (RISBGZ x {r}) [c])
7270 // cond: c > 0 && r.OutMask() < uint64(c)
7271 // result: (FlagLT)
7272 for {
7273 c := auxIntToInt32(v.AuxInt)
7274 if v_0.Op != OpS390XRISBGZ {
7275 break
7276 }
7277 r := auxToS390xRotateParams(v_0.Aux)
7278 if !(c > 0 && r.OutMask() < uint64(c)) {
7279 break
7280 }
7281 v.reset(OpS390XFlagLT)
7282 return true
7283 }
7284 // match: (CMPconst (MOVWreg x) [c])
7285 // result: (CMPWconst x [c])
7286 for {
7287 c := auxIntToInt32(v.AuxInt)
7288 if v_0.Op != OpS390XMOVWreg {
7289 break
7290 }
7291 x := v_0.Args[0]
7292 v.reset(OpS390XCMPWconst)
7293 v.AuxInt = int32ToAuxInt(c)
7294 v.AddArg(x)
7295 return true
7296 }
7297 // match: (CMPconst x:(MOVHreg _) [c])
7298 // result: (CMPWconst x [c])
7299 for {
7300 c := auxIntToInt32(v.AuxInt)
7301 x := v_0
7302 if x.Op != OpS390XMOVHreg {
7303 break
7304 }
7305 v.reset(OpS390XCMPWconst)
7306 v.AuxInt = int32ToAuxInt(c)
7307 v.AddArg(x)
7308 return true
7309 }
7310 // match: (CMPconst x:(MOVHZreg _) [c])
7311 // result: (CMPWconst x [c])
7312 for {
7313 c := auxIntToInt32(v.AuxInt)
7314 x := v_0
7315 if x.Op != OpS390XMOVHZreg {
7316 break
7317 }
7318 v.reset(OpS390XCMPWconst)
7319 v.AuxInt = int32ToAuxInt(c)
7320 v.AddArg(x)
7321 return true
7322 }
7323 // match: (CMPconst x:(MOVBreg _) [c])
7324 // result: (CMPWconst x [c])
7325 for {
7326 c := auxIntToInt32(v.AuxInt)
7327 x := v_0
7328 if x.Op != OpS390XMOVBreg {
7329 break
7330 }
7331 v.reset(OpS390XCMPWconst)
7332 v.AuxInt = int32ToAuxInt(c)
7333 v.AddArg(x)
7334 return true
7335 }
7336 // match: (CMPconst x:(MOVBZreg _) [c])
7337 // result: (CMPWconst x [c])
7338 for {
7339 c := auxIntToInt32(v.AuxInt)
7340 x := v_0
7341 if x.Op != OpS390XMOVBZreg {
7342 break
7343 }
7344 v.reset(OpS390XCMPWconst)
7345 v.AuxInt = int32ToAuxInt(c)
7346 v.AddArg(x)
7347 return true
7348 }
7349 // match: (CMPconst (MOVWZreg x:(ANDWconst [m] _)) [c])
7350 // cond: int32(m) >= 0 && c >= 0
7351 // result: (CMPWUconst x [c])
7352 for {
7353 c := auxIntToInt32(v.AuxInt)
7354 if v_0.Op != OpS390XMOVWZreg {
7355 break
7356 }
7357 x := v_0.Args[0]
7358 if x.Op != OpS390XANDWconst {
7359 break
7360 }
7361 m := auxIntToInt32(x.AuxInt)
7362 if !(int32(m) >= 0 && c >= 0) {
7363 break
7364 }
7365 v.reset(OpS390XCMPWUconst)
7366 v.AuxInt = int32ToAuxInt(c)
7367 v.AddArg(x)
7368 return true
7369 }
7370 // match: (CMPconst (MOVWreg x:(ANDWconst [m] _)) [c])
7371 // cond: int32(m) >= 0 && c >= 0
7372 // result: (CMPWUconst x [c])
7373 for {
7374 c := auxIntToInt32(v.AuxInt)
7375 if v_0.Op != OpS390XMOVWreg {
7376 break
7377 }
7378 x := v_0.Args[0]
7379 if x.Op != OpS390XANDWconst {
7380 break
7381 }
7382 m := auxIntToInt32(x.AuxInt)
7383 if !(int32(m) >= 0 && c >= 0) {
7384 break
7385 }
7386 v.reset(OpS390XCMPWUconst)
7387 v.AuxInt = int32ToAuxInt(c)
7388 v.AddArg(x)
7389 return true
7390 }
7391 // match: (CMPconst x:(SRDconst _ [c]) [n])
7392 // cond: c > 0 && n >= 0
7393 // result: (CMPUconst x [n])
7394 for {
7395 n := auxIntToInt32(v.AuxInt)
7396 x := v_0
7397 if x.Op != OpS390XSRDconst {
7398 break
7399 }
7400 c := auxIntToUint8(x.AuxInt)
7401 if !(c > 0 && n >= 0) {
7402 break
7403 }
7404 v.reset(OpS390XCMPUconst)
7405 v.AuxInt = int32ToAuxInt(n)
7406 v.AddArg(x)
7407 return true
7408 }
7409 return false
7410 }
7411 func rewriteValueS390X_OpS390XCPSDR(v *Value) bool {
7412 v_1 := v.Args[1]
7413 v_0 := v.Args[0]
7414 // match: (CPSDR y (FMOVDconst [c]))
7415 // cond: !math.Signbit(c)
7416 // result: (LPDFR y)
7417 for {
7418 y := v_0
7419 if v_1.Op != OpS390XFMOVDconst {
7420 break
7421 }
7422 c := auxIntToFloat64(v_1.AuxInt)
7423 if !(!math.Signbit(c)) {
7424 break
7425 }
7426 v.reset(OpS390XLPDFR)
7427 v.AddArg(y)
7428 return true
7429 }
7430 // match: (CPSDR y (FMOVDconst [c]))
7431 // cond: math.Signbit(c)
7432 // result: (LNDFR y)
7433 for {
7434 y := v_0
7435 if v_1.Op != OpS390XFMOVDconst {
7436 break
7437 }
7438 c := auxIntToFloat64(v_1.AuxInt)
7439 if !(math.Signbit(c)) {
7440 break
7441 }
7442 v.reset(OpS390XLNDFR)
7443 v.AddArg(y)
7444 return true
7445 }
7446 return false
7447 }
7448 func rewriteValueS390X_OpS390XFCMP(v *Value) bool {
7449 v_1 := v.Args[1]
7450 v_0 := v.Args[0]
7451 b := v.Block
7452 // match: (FCMP x (FMOVDconst [0.0]))
7453 // result: (LTDBR x)
7454 for {
7455 x := v_0
7456 if v_1.Op != OpS390XFMOVDconst || auxIntToFloat64(v_1.AuxInt) != 0.0 {
7457 break
7458 }
7459 v.reset(OpS390XLTDBR)
7460 v.AddArg(x)
7461 return true
7462 }
7463 // match: (FCMP (FMOVDconst [0.0]) x)
7464 // result: (InvertFlags (LTDBR <v.Type> x))
7465 for {
7466 if v_0.Op != OpS390XFMOVDconst || auxIntToFloat64(v_0.AuxInt) != 0.0 {
7467 break
7468 }
7469 x := v_1
7470 v.reset(OpS390XInvertFlags)
7471 v0 := b.NewValue0(v.Pos, OpS390XLTDBR, v.Type)
7472 v0.AddArg(x)
7473 v.AddArg(v0)
7474 return true
7475 }
7476 return false
7477 }
7478 func rewriteValueS390X_OpS390XFCMPS(v *Value) bool {
7479 v_1 := v.Args[1]
7480 v_0 := v.Args[0]
7481 b := v.Block
7482 // match: (FCMPS x (FMOVSconst [0.0]))
7483 // result: (LTEBR x)
7484 for {
7485 x := v_0
7486 if v_1.Op != OpS390XFMOVSconst || auxIntToFloat32(v_1.AuxInt) != 0.0 {
7487 break
7488 }
7489 v.reset(OpS390XLTEBR)
7490 v.AddArg(x)
7491 return true
7492 }
7493 // match: (FCMPS (FMOVSconst [0.0]) x)
7494 // result: (InvertFlags (LTEBR <v.Type> x))
7495 for {
7496 if v_0.Op != OpS390XFMOVSconst || auxIntToFloat32(v_0.AuxInt) != 0.0 {
7497 break
7498 }
7499 x := v_1
7500 v.reset(OpS390XInvertFlags)
7501 v0 := b.NewValue0(v.Pos, OpS390XLTEBR, v.Type)
7502 v0.AddArg(x)
7503 v.AddArg(v0)
7504 return true
7505 }
7506 return false
7507 }
7508 func rewriteValueS390X_OpS390XFMOVDload(v *Value) bool {
7509 v_1 := v.Args[1]
7510 v_0 := v.Args[0]
7511 // match: (FMOVDload [off] {sym} ptr1 (MOVDstore [off] {sym} ptr2 x _))
7512 // cond: isSamePtr(ptr1, ptr2)
7513 // result: (LDGR x)
7514 for {
7515 off := auxIntToInt32(v.AuxInt)
7516 sym := auxToSym(v.Aux)
7517 ptr1 := v_0
7518 if v_1.Op != OpS390XMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7519 break
7520 }
7521 x := v_1.Args[1]
7522 ptr2 := v_1.Args[0]
7523 if !(isSamePtr(ptr1, ptr2)) {
7524 break
7525 }
7526 v.reset(OpS390XLDGR)
7527 v.AddArg(x)
7528 return true
7529 }
7530 // match: (FMOVDload [off] {sym} ptr1 (FMOVDstore [off] {sym} ptr2 x _))
7531 // cond: isSamePtr(ptr1, ptr2)
7532 // result: x
7533 for {
7534 off := auxIntToInt32(v.AuxInt)
7535 sym := auxToSym(v.Aux)
7536 ptr1 := v_0
7537 if v_1.Op != OpS390XFMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7538 break
7539 }
7540 x := v_1.Args[1]
7541 ptr2 := v_1.Args[0]
7542 if !(isSamePtr(ptr1, ptr2)) {
7543 break
7544 }
7545 v.copyOf(x)
7546 return true
7547 }
7548 // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
7549 // cond: is20Bit(int64(off1)+int64(off2))
7550 // result: (FMOVDload [off1+off2] {sym} ptr mem)
7551 for {
7552 off1 := auxIntToInt32(v.AuxInt)
7553 sym := auxToSym(v.Aux)
7554 if v_0.Op != OpS390XADDconst {
7555 break
7556 }
7557 off2 := auxIntToInt32(v_0.AuxInt)
7558 ptr := v_0.Args[0]
7559 mem := v_1
7560 if !(is20Bit(int64(off1) + int64(off2))) {
7561 break
7562 }
7563 v.reset(OpS390XFMOVDload)
7564 v.AuxInt = int32ToAuxInt(off1 + off2)
7565 v.Aux = symToAux(sym)
7566 v.AddArg2(ptr, mem)
7567 return true
7568 }
7569 // match: (FMOVDload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem)
7570 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
7571 // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem)
7572 for {
7573 off1 := auxIntToInt32(v.AuxInt)
7574 sym1 := auxToSym(v.Aux)
7575 if v_0.Op != OpS390XMOVDaddr {
7576 break
7577 }
7578 off2 := auxIntToInt32(v_0.AuxInt)
7579 sym2 := auxToSym(v_0.Aux)
7580 base := v_0.Args[0]
7581 mem := v_1
7582 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
7583 break
7584 }
7585 v.reset(OpS390XFMOVDload)
7586 v.AuxInt = int32ToAuxInt(off1 + off2)
7587 v.Aux = symToAux(mergeSym(sym1, sym2))
7588 v.AddArg2(base, mem)
7589 return true
7590 }
7591 return false
7592 }
7593 func rewriteValueS390X_OpS390XFMOVDstore(v *Value) bool {
7594 v_2 := v.Args[2]
7595 v_1 := v.Args[1]
7596 v_0 := v.Args[0]
7597 // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
7598 // cond: is20Bit(int64(off1)+int64(off2))
7599 // result: (FMOVDstore [off1+off2] {sym} ptr val mem)
7600 for {
7601 off1 := auxIntToInt32(v.AuxInt)
7602 sym := auxToSym(v.Aux)
7603 if v_0.Op != OpS390XADDconst {
7604 break
7605 }
7606 off2 := auxIntToInt32(v_0.AuxInt)
7607 ptr := v_0.Args[0]
7608 val := v_1
7609 mem := v_2
7610 if !(is20Bit(int64(off1) + int64(off2))) {
7611 break
7612 }
7613 v.reset(OpS390XFMOVDstore)
7614 v.AuxInt = int32ToAuxInt(off1 + off2)
7615 v.Aux = symToAux(sym)
7616 v.AddArg3(ptr, val, mem)
7617 return true
7618 }
7619 // match: (FMOVDstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem)
7620 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
7621 // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
7622 for {
7623 off1 := auxIntToInt32(v.AuxInt)
7624 sym1 := auxToSym(v.Aux)
7625 if v_0.Op != OpS390XMOVDaddr {
7626 break
7627 }
7628 off2 := auxIntToInt32(v_0.AuxInt)
7629 sym2 := auxToSym(v_0.Aux)
7630 base := v_0.Args[0]
7631 val := v_1
7632 mem := v_2
7633 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
7634 break
7635 }
7636 v.reset(OpS390XFMOVDstore)
7637 v.AuxInt = int32ToAuxInt(off1 + off2)
7638 v.Aux = symToAux(mergeSym(sym1, sym2))
7639 v.AddArg3(base, val, mem)
7640 return true
7641 }
7642 return false
7643 }
7644 func rewriteValueS390X_OpS390XFMOVSload(v *Value) bool {
7645 v_1 := v.Args[1]
7646 v_0 := v.Args[0]
7647 // match: (FMOVSload [off] {sym} ptr1 (FMOVSstore [off] {sym} ptr2 x _))
7648 // cond: isSamePtr(ptr1, ptr2)
7649 // result: x
7650 for {
7651 off := auxIntToInt32(v.AuxInt)
7652 sym := auxToSym(v.Aux)
7653 ptr1 := v_0
7654 if v_1.Op != OpS390XFMOVSstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7655 break
7656 }
7657 x := v_1.Args[1]
7658 ptr2 := v_1.Args[0]
7659 if !(isSamePtr(ptr1, ptr2)) {
7660 break
7661 }
7662 v.copyOf(x)
7663 return true
7664 }
7665 // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem)
7666 // cond: is20Bit(int64(off1)+int64(off2))
7667 // result: (FMOVSload [off1+off2] {sym} ptr mem)
7668 for {
7669 off1 := auxIntToInt32(v.AuxInt)
7670 sym := auxToSym(v.Aux)
7671 if v_0.Op != OpS390XADDconst {
7672 break
7673 }
7674 off2 := auxIntToInt32(v_0.AuxInt)
7675 ptr := v_0.Args[0]
7676 mem := v_1
7677 if !(is20Bit(int64(off1) + int64(off2))) {
7678 break
7679 }
7680 v.reset(OpS390XFMOVSload)
7681 v.AuxInt = int32ToAuxInt(off1 + off2)
7682 v.Aux = symToAux(sym)
7683 v.AddArg2(ptr, mem)
7684 return true
7685 }
7686 // match: (FMOVSload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem)
7687 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
7688 // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} base mem)
7689 for {
7690 off1 := auxIntToInt32(v.AuxInt)
7691 sym1 := auxToSym(v.Aux)
7692 if v_0.Op != OpS390XMOVDaddr {
7693 break
7694 }
7695 off2 := auxIntToInt32(v_0.AuxInt)
7696 sym2 := auxToSym(v_0.Aux)
7697 base := v_0.Args[0]
7698 mem := v_1
7699 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
7700 break
7701 }
7702 v.reset(OpS390XFMOVSload)
7703 v.AuxInt = int32ToAuxInt(off1 + off2)
7704 v.Aux = symToAux(mergeSym(sym1, sym2))
7705 v.AddArg2(base, mem)
7706 return true
7707 }
7708 return false
7709 }
7710 func rewriteValueS390X_OpS390XFMOVSstore(v *Value) bool {
7711 v_2 := v.Args[2]
7712 v_1 := v.Args[1]
7713 v_0 := v.Args[0]
7714 // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem)
7715 // cond: is20Bit(int64(off1)+int64(off2))
7716 // result: (FMOVSstore [off1+off2] {sym} ptr val mem)
7717 for {
7718 off1 := auxIntToInt32(v.AuxInt)
7719 sym := auxToSym(v.Aux)
7720 if v_0.Op != OpS390XADDconst {
7721 break
7722 }
7723 off2 := auxIntToInt32(v_0.AuxInt)
7724 ptr := v_0.Args[0]
7725 val := v_1
7726 mem := v_2
7727 if !(is20Bit(int64(off1) + int64(off2))) {
7728 break
7729 }
7730 v.reset(OpS390XFMOVSstore)
7731 v.AuxInt = int32ToAuxInt(off1 + off2)
7732 v.Aux = symToAux(sym)
7733 v.AddArg3(ptr, val, mem)
7734 return true
7735 }
7736 // match: (FMOVSstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem)
7737 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
7738 // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
7739 for {
7740 off1 := auxIntToInt32(v.AuxInt)
7741 sym1 := auxToSym(v.Aux)
7742 if v_0.Op != OpS390XMOVDaddr {
7743 break
7744 }
7745 off2 := auxIntToInt32(v_0.AuxInt)
7746 sym2 := auxToSym(v_0.Aux)
7747 base := v_0.Args[0]
7748 val := v_1
7749 mem := v_2
7750 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
7751 break
7752 }
7753 v.reset(OpS390XFMOVSstore)
7754 v.AuxInt = int32ToAuxInt(off1 + off2)
7755 v.Aux = symToAux(mergeSym(sym1, sym2))
7756 v.AddArg3(base, val, mem)
7757 return true
7758 }
7759 return false
7760 }
7761 func rewriteValueS390X_OpS390XFNEG(v *Value) bool {
7762 v_0 := v.Args[0]
7763 // match: (FNEG (LPDFR x))
7764 // result: (LNDFR x)
7765 for {
7766 if v_0.Op != OpS390XLPDFR {
7767 break
7768 }
7769 x := v_0.Args[0]
7770 v.reset(OpS390XLNDFR)
7771 v.AddArg(x)
7772 return true
7773 }
7774 // match: (FNEG (LNDFR x))
7775 // result: (LPDFR x)
7776 for {
7777 if v_0.Op != OpS390XLNDFR {
7778 break
7779 }
7780 x := v_0.Args[0]
7781 v.reset(OpS390XLPDFR)
7782 v.AddArg(x)
7783 return true
7784 }
7785 return false
7786 }
7787 func rewriteValueS390X_OpS390XFNEGS(v *Value) bool {
7788 v_0 := v.Args[0]
7789 // match: (FNEGS (LPDFR x))
7790 // result: (LNDFR x)
7791 for {
7792 if v_0.Op != OpS390XLPDFR {
7793 break
7794 }
7795 x := v_0.Args[0]
7796 v.reset(OpS390XLNDFR)
7797 v.AddArg(x)
7798 return true
7799 }
7800 // match: (FNEGS (LNDFR x))
7801 // result: (LPDFR x)
7802 for {
7803 if v_0.Op != OpS390XLNDFR {
7804 break
7805 }
7806 x := v_0.Args[0]
7807 v.reset(OpS390XLPDFR)
7808 v.AddArg(x)
7809 return true
7810 }
7811 return false
7812 }
7813 func rewriteValueS390X_OpS390XLDGR(v *Value) bool {
7814 v_0 := v.Args[0]
7815 b := v.Block
7816 // match: (LDGR <t> (RISBGZ x {r}))
7817 // cond: r == s390x.NewRotateParams(1, 63, 0)
7818 // result: (LPDFR (LDGR <t> x))
7819 for {
7820 t := v.Type
7821 if v_0.Op != OpS390XRISBGZ {
7822 break
7823 }
7824 r := auxToS390xRotateParams(v_0.Aux)
7825 x := v_0.Args[0]
7826 if !(r == s390x.NewRotateParams(1, 63, 0)) {
7827 break
7828 }
7829 v.reset(OpS390XLPDFR)
7830 v0 := b.NewValue0(v.Pos, OpS390XLDGR, t)
7831 v0.AddArg(x)
7832 v.AddArg(v0)
7833 return true
7834 }
7835 // match: (LDGR <t> (OR (MOVDconst [-1<<63]) x))
7836 // result: (LNDFR (LDGR <t> x))
7837 for {
7838 t := v.Type
7839 if v_0.Op != OpS390XOR {
7840 break
7841 }
7842 _ = v_0.Args[1]
7843 v_0_0 := v_0.Args[0]
7844 v_0_1 := v_0.Args[1]
7845 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
7846 if v_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0.AuxInt) != -1<<63 {
7847 continue
7848 }
7849 x := v_0_1
7850 v.reset(OpS390XLNDFR)
7851 v0 := b.NewValue0(v.Pos, OpS390XLDGR, t)
7852 v0.AddArg(x)
7853 v.AddArg(v0)
7854 return true
7855 }
7856 break
7857 }
7858 // match: (LDGR <t> x:(ORload <t1> [off] {sym} (MOVDconst [-1<<63]) ptr mem))
7859 // cond: x.Uses == 1 && clobber(x)
7860 // result: @x.Block (LNDFR <t> (LDGR <t> (MOVDload <t1> [off] {sym} ptr mem)))
7861 for {
7862 t := v.Type
7863 x := v_0
7864 if x.Op != OpS390XORload {
7865 break
7866 }
7867 t1 := x.Type
7868 off := auxIntToInt32(x.AuxInt)
7869 sym := auxToSym(x.Aux)
7870 mem := x.Args[2]
7871 x_0 := x.Args[0]
7872 if x_0.Op != OpS390XMOVDconst || auxIntToInt64(x_0.AuxInt) != -1<<63 {
7873 break
7874 }
7875 ptr := x.Args[1]
7876 if !(x.Uses == 1 && clobber(x)) {
7877 break
7878 }
7879 b = x.Block
7880 v0 := b.NewValue0(x.Pos, OpS390XLNDFR, t)
7881 v.copyOf(v0)
7882 v1 := b.NewValue0(x.Pos, OpS390XLDGR, t)
7883 v2 := b.NewValue0(x.Pos, OpS390XMOVDload, t1)
7884 v2.AuxInt = int32ToAuxInt(off)
7885 v2.Aux = symToAux(sym)
7886 v2.AddArg2(ptr, mem)
7887 v1.AddArg(v2)
7888 v0.AddArg(v1)
7889 return true
7890 }
7891 // match: (LDGR (LGDR x))
7892 // result: x
7893 for {
7894 if v_0.Op != OpS390XLGDR {
7895 break
7896 }
7897 x := v_0.Args[0]
7898 v.copyOf(x)
7899 return true
7900 }
7901 return false
7902 }
7903 func rewriteValueS390X_OpS390XLEDBR(v *Value) bool {
7904 v_0 := v.Args[0]
7905 // match: (LEDBR (LPDFR (LDEBR x)))
7906 // result: (LPDFR x)
7907 for {
7908 if v_0.Op != OpS390XLPDFR {
7909 break
7910 }
7911 v_0_0 := v_0.Args[0]
7912 if v_0_0.Op != OpS390XLDEBR {
7913 break
7914 }
7915 x := v_0_0.Args[0]
7916 v.reset(OpS390XLPDFR)
7917 v.AddArg(x)
7918 return true
7919 }
7920 // match: (LEDBR (LNDFR (LDEBR x)))
7921 // result: (LNDFR x)
7922 for {
7923 if v_0.Op != OpS390XLNDFR {
7924 break
7925 }
7926 v_0_0 := v_0.Args[0]
7927 if v_0_0.Op != OpS390XLDEBR {
7928 break
7929 }
7930 x := v_0_0.Args[0]
7931 v.reset(OpS390XLNDFR)
7932 v.AddArg(x)
7933 return true
7934 }
7935 return false
7936 }
7937 func rewriteValueS390X_OpS390XLGDR(v *Value) bool {
7938 v_0 := v.Args[0]
7939 // match: (LGDR (LDGR x))
7940 // result: x
7941 for {
7942 if v_0.Op != OpS390XLDGR {
7943 break
7944 }
7945 x := v_0.Args[0]
7946 v.copyOf(x)
7947 return true
7948 }
7949 return false
7950 }
7951 func rewriteValueS390X_OpS390XLOCGR(v *Value) bool {
7952 v_2 := v.Args[2]
7953 v_1 := v.Args[1]
7954 v_0 := v.Args[0]
7955 // match: (LOCGR {c} x y (InvertFlags cmp))
7956 // result: (LOCGR {c.ReverseComparison()} x y cmp)
7957 for {
7958 c := auxToS390xCCMask(v.Aux)
7959 x := v_0
7960 y := v_1
7961 if v_2.Op != OpS390XInvertFlags {
7962 break
7963 }
7964 cmp := v_2.Args[0]
7965 v.reset(OpS390XLOCGR)
7966 v.Aux = s390xCCMaskToAux(c.ReverseComparison())
7967 v.AddArg3(x, y, cmp)
7968 return true
7969 }
7970 // match: (LOCGR {c} _ x (FlagEQ))
7971 // cond: c&s390x.Equal != 0
7972 // result: x
7973 for {
7974 c := auxToS390xCCMask(v.Aux)
7975 x := v_1
7976 if v_2.Op != OpS390XFlagEQ || !(c&s390x.Equal != 0) {
7977 break
7978 }
7979 v.copyOf(x)
7980 return true
7981 }
7982 // match: (LOCGR {c} _ x (FlagLT))
7983 // cond: c&s390x.Less != 0
7984 // result: x
7985 for {
7986 c := auxToS390xCCMask(v.Aux)
7987 x := v_1
7988 if v_2.Op != OpS390XFlagLT || !(c&s390x.Less != 0) {
7989 break
7990 }
7991 v.copyOf(x)
7992 return true
7993 }
7994 // match: (LOCGR {c} _ x (FlagGT))
7995 // cond: c&s390x.Greater != 0
7996 // result: x
7997 for {
7998 c := auxToS390xCCMask(v.Aux)
7999 x := v_1
8000 if v_2.Op != OpS390XFlagGT || !(c&s390x.Greater != 0) {
8001 break
8002 }
8003 v.copyOf(x)
8004 return true
8005 }
8006 // match: (LOCGR {c} _ x (FlagOV))
8007 // cond: c&s390x.Unordered != 0
8008 // result: x
8009 for {
8010 c := auxToS390xCCMask(v.Aux)
8011 x := v_1
8012 if v_2.Op != OpS390XFlagOV || !(c&s390x.Unordered != 0) {
8013 break
8014 }
8015 v.copyOf(x)
8016 return true
8017 }
8018 // match: (LOCGR {c} x _ (FlagEQ))
8019 // cond: c&s390x.Equal == 0
8020 // result: x
8021 for {
8022 c := auxToS390xCCMask(v.Aux)
8023 x := v_0
8024 if v_2.Op != OpS390XFlagEQ || !(c&s390x.Equal == 0) {
8025 break
8026 }
8027 v.copyOf(x)
8028 return true
8029 }
8030 // match: (LOCGR {c} x _ (FlagLT))
8031 // cond: c&s390x.Less == 0
8032 // result: x
8033 for {
8034 c := auxToS390xCCMask(v.Aux)
8035 x := v_0
8036 if v_2.Op != OpS390XFlagLT || !(c&s390x.Less == 0) {
8037 break
8038 }
8039 v.copyOf(x)
8040 return true
8041 }
8042 // match: (LOCGR {c} x _ (FlagGT))
8043 // cond: c&s390x.Greater == 0
8044 // result: x
8045 for {
8046 c := auxToS390xCCMask(v.Aux)
8047 x := v_0
8048 if v_2.Op != OpS390XFlagGT || !(c&s390x.Greater == 0) {
8049 break
8050 }
8051 v.copyOf(x)
8052 return true
8053 }
8054 // match: (LOCGR {c} x _ (FlagOV))
8055 // cond: c&s390x.Unordered == 0
8056 // result: x
8057 for {
8058 c := auxToS390xCCMask(v.Aux)
8059 x := v_0
8060 if v_2.Op != OpS390XFlagOV || !(c&s390x.Unordered == 0) {
8061 break
8062 }
8063 v.copyOf(x)
8064 return true
8065 }
8066 return false
8067 }
8068 func rewriteValueS390X_OpS390XLTDBR(v *Value) bool {
8069 v_0 := v.Args[0]
8070 b := v.Block
8071 // match: (LTDBR (Select0 x:(FADD _ _)))
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 != OpS390XFADD || !(b == x.Block) {
8080 break
8081 }
8082 v.reset(OpSelect1)
8083 v.AddArg(x)
8084 return true
8085 }
8086 // match: (LTDBR (Select0 x:(FSUB _ _)))
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 != OpS390XFSUB || !(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_OpS390XLTEBR(v *Value) bool {
8104 v_0 := v.Args[0]
8105 b := v.Block
8106 // match: (LTEBR (Select0 x:(FADDS _ _)))
8107 // cond: b == x.Block
8108 // result: (Select1 x)
8109 for {
8110 if v_0.Op != OpSelect0 {
8111 break
8112 }
8113 x := v_0.Args[0]
8114 if x.Op != OpS390XFADDS || !(b == x.Block) {
8115 break
8116 }
8117 v.reset(OpSelect1)
8118 v.AddArg(x)
8119 return true
8120 }
8121 // match: (LTEBR (Select0 x:(FSUBS _ _)))
8122 // cond: b == x.Block
8123 // result: (Select1 x)
8124 for {
8125 if v_0.Op != OpSelect0 {
8126 break
8127 }
8128 x := v_0.Args[0]
8129 if x.Op != OpS390XFSUBS || !(b == x.Block) {
8130 break
8131 }
8132 v.reset(OpSelect1)
8133 v.AddArg(x)
8134 return true
8135 }
8136 return false
8137 }
8138 func rewriteValueS390X_OpS390XLoweredRound32F(v *Value) bool {
8139 v_0 := v.Args[0]
8140 // match: (LoweredRound32F x:(FMOVSconst))
8141 // result: x
8142 for {
8143 x := v_0
8144 if x.Op != OpS390XFMOVSconst {
8145 break
8146 }
8147 v.copyOf(x)
8148 return true
8149 }
8150 return false
8151 }
8152 func rewriteValueS390X_OpS390XLoweredRound64F(v *Value) bool {
8153 v_0 := v.Args[0]
8154 // match: (LoweredRound64F x:(FMOVDconst))
8155 // result: x
8156 for {
8157 x := v_0
8158 if x.Op != OpS390XFMOVDconst {
8159 break
8160 }
8161 v.copyOf(x)
8162 return true
8163 }
8164 return false
8165 }
8166 func rewriteValueS390X_OpS390XMOVBZload(v *Value) bool {
8167 v_1 := v.Args[1]
8168 v_0 := v.Args[0]
8169 // match: (MOVBZload [off] {sym} ptr1 (MOVBstore [off] {sym} ptr2 x _))
8170 // cond: isSamePtr(ptr1, ptr2)
8171 // result: (MOVBZreg x)
8172 for {
8173 off := auxIntToInt32(v.AuxInt)
8174 sym := auxToSym(v.Aux)
8175 ptr1 := v_0
8176 if v_1.Op != OpS390XMOVBstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
8177 break
8178 }
8179 x := v_1.Args[1]
8180 ptr2 := v_1.Args[0]
8181 if !(isSamePtr(ptr1, ptr2)) {
8182 break
8183 }
8184 v.reset(OpS390XMOVBZreg)
8185 v.AddArg(x)
8186 return true
8187 }
8188 // match: (MOVBZload [off1] {sym} (ADDconst [off2] ptr) mem)
8189 // cond: is20Bit(int64(off1)+int64(off2))
8190 // result: (MOVBZload [off1+off2] {sym} ptr mem)
8191 for {
8192 off1 := auxIntToInt32(v.AuxInt)
8193 sym := auxToSym(v.Aux)
8194 if v_0.Op != OpS390XADDconst {
8195 break
8196 }
8197 off2 := auxIntToInt32(v_0.AuxInt)
8198 ptr := v_0.Args[0]
8199 mem := v_1
8200 if !(is20Bit(int64(off1) + int64(off2))) {
8201 break
8202 }
8203 v.reset(OpS390XMOVBZload)
8204 v.AuxInt = int32ToAuxInt(off1 + off2)
8205 v.Aux = symToAux(sym)
8206 v.AddArg2(ptr, mem)
8207 return true
8208 }
8209 // match: (MOVBZload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem)
8210 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
8211 // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} base mem)
8212 for {
8213 off1 := auxIntToInt32(v.AuxInt)
8214 sym1 := auxToSym(v.Aux)
8215 if v_0.Op != OpS390XMOVDaddr {
8216 break
8217 }
8218 off2 := auxIntToInt32(v_0.AuxInt)
8219 sym2 := auxToSym(v_0.Aux)
8220 base := v_0.Args[0]
8221 mem := v_1
8222 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
8223 break
8224 }
8225 v.reset(OpS390XMOVBZload)
8226 v.AuxInt = int32ToAuxInt(off1 + off2)
8227 v.Aux = symToAux(mergeSym(sym1, sym2))
8228 v.AddArg2(base, mem)
8229 return true
8230 }
8231 return false
8232 }
8233 func rewriteValueS390X_OpS390XMOVBZreg(v *Value) bool {
8234 v_0 := v.Args[0]
8235 b := v.Block
8236 typ := &b.Func.Config.Types
8237 // match: (MOVBZreg e:(MOVBreg x))
8238 // cond: clobberIfDead(e)
8239 // result: (MOVBZreg x)
8240 for {
8241 e := v_0
8242 if e.Op != OpS390XMOVBreg {
8243 break
8244 }
8245 x := e.Args[0]
8246 if !(clobberIfDead(e)) {
8247 break
8248 }
8249 v.reset(OpS390XMOVBZreg)
8250 v.AddArg(x)
8251 return true
8252 }
8253 // match: (MOVBZreg e:(MOVHreg x))
8254 // cond: clobberIfDead(e)
8255 // result: (MOVBZreg x)
8256 for {
8257 e := v_0
8258 if e.Op != OpS390XMOVHreg {
8259 break
8260 }
8261 x := e.Args[0]
8262 if !(clobberIfDead(e)) {
8263 break
8264 }
8265 v.reset(OpS390XMOVBZreg)
8266 v.AddArg(x)
8267 return true
8268 }
8269 // match: (MOVBZreg e:(MOVWreg x))
8270 // cond: clobberIfDead(e)
8271 // result: (MOVBZreg x)
8272 for {
8273 e := v_0
8274 if e.Op != OpS390XMOVWreg {
8275 break
8276 }
8277 x := e.Args[0]
8278 if !(clobberIfDead(e)) {
8279 break
8280 }
8281 v.reset(OpS390XMOVBZreg)
8282 v.AddArg(x)
8283 return true
8284 }
8285 // match: (MOVBZreg e:(MOVBZreg x))
8286 // cond: clobberIfDead(e)
8287 // result: (MOVBZreg x)
8288 for {
8289 e := v_0
8290 if e.Op != OpS390XMOVBZreg {
8291 break
8292 }
8293 x := e.Args[0]
8294 if !(clobberIfDead(e)) {
8295 break
8296 }
8297 v.reset(OpS390XMOVBZreg)
8298 v.AddArg(x)
8299 return true
8300 }
8301 // match: (MOVBZreg e:(MOVHZreg x))
8302 // cond: clobberIfDead(e)
8303 // result: (MOVBZreg x)
8304 for {
8305 e := v_0
8306 if e.Op != OpS390XMOVHZreg {
8307 break
8308 }
8309 x := e.Args[0]
8310 if !(clobberIfDead(e)) {
8311 break
8312 }
8313 v.reset(OpS390XMOVBZreg)
8314 v.AddArg(x)
8315 return true
8316 }
8317 // match: (MOVBZreg e:(MOVWZreg x))
8318 // cond: clobberIfDead(e)
8319 // result: (MOVBZreg x)
8320 for {
8321 e := v_0
8322 if e.Op != OpS390XMOVWZreg {
8323 break
8324 }
8325 x := e.Args[0]
8326 if !(clobberIfDead(e)) {
8327 break
8328 }
8329 v.reset(OpS390XMOVBZreg)
8330 v.AddArg(x)
8331 return true
8332 }
8333 // match: (MOVBZreg x:(MOVBZload _ _))
8334 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
8335 // result: x
8336 for {
8337 x := v_0
8338 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
8339 break
8340 }
8341 v.copyOf(x)
8342 return true
8343 }
8344 // match: (MOVBZreg <t> x:(MOVBload [o] {s} p mem))
8345 // cond: x.Uses == 1 && clobber(x)
8346 // result: @x.Block (MOVBZload <t> [o] {s} p mem)
8347 for {
8348 t := v.Type
8349 x := v_0
8350 if x.Op != OpS390XMOVBload {
8351 break
8352 }
8353 o := auxIntToInt32(x.AuxInt)
8354 s := auxToSym(x.Aux)
8355 mem := x.Args[1]
8356 p := x.Args[0]
8357 if !(x.Uses == 1 && clobber(x)) {
8358 break
8359 }
8360 b = x.Block
8361 v0 := b.NewValue0(x.Pos, OpS390XMOVBZload, t)
8362 v.copyOf(v0)
8363 v0.AuxInt = int32ToAuxInt(o)
8364 v0.Aux = symToAux(s)
8365 v0.AddArg2(p, mem)
8366 return true
8367 }
8368 // match: (MOVBZreg x:(Arg <t>))
8369 // cond: !t.IsSigned() && t.Size() == 1
8370 // result: x
8371 for {
8372 x := v_0
8373 if x.Op != OpArg {
8374 break
8375 }
8376 t := x.Type
8377 if !(!t.IsSigned() && t.Size() == 1) {
8378 break
8379 }
8380 v.copyOf(x)
8381 return true
8382 }
8383 // match: (MOVBZreg (MOVDconst [c]))
8384 // result: (MOVDconst [int64( uint8(c))])
8385 for {
8386 if v_0.Op != OpS390XMOVDconst {
8387 break
8388 }
8389 c := auxIntToInt64(v_0.AuxInt)
8390 v.reset(OpS390XMOVDconst)
8391 v.AuxInt = int64ToAuxInt(int64(uint8(c)))
8392 return true
8393 }
8394 // match: (MOVBZreg x:(LOCGR (MOVDconst [c]) (MOVDconst [d]) _))
8395 // cond: int64(uint8(c)) == c && int64(uint8(d)) == d && (!x.Type.IsSigned() || x.Type.Size() > 1)
8396 // result: x
8397 for {
8398 x := v_0
8399 if x.Op != OpS390XLOCGR {
8400 break
8401 }
8402 _ = x.Args[1]
8403 x_0 := x.Args[0]
8404 if x_0.Op != OpS390XMOVDconst {
8405 break
8406 }
8407 c := auxIntToInt64(x_0.AuxInt)
8408 x_1 := x.Args[1]
8409 if x_1.Op != OpS390XMOVDconst {
8410 break
8411 }
8412 d := auxIntToInt64(x_1.AuxInt)
8413 if !(int64(uint8(c)) == c && int64(uint8(d)) == d && (!x.Type.IsSigned() || x.Type.Size() > 1)) {
8414 break
8415 }
8416 v.copyOf(x)
8417 return true
8418 }
8419 // match: (MOVBZreg (RISBGZ x {r}))
8420 // cond: r.OutMerge(0x000000ff) != nil
8421 // result: (RISBGZ x {*r.OutMerge(0x000000ff)})
8422 for {
8423 if v_0.Op != OpS390XRISBGZ {
8424 break
8425 }
8426 r := auxToS390xRotateParams(v_0.Aux)
8427 x := v_0.Args[0]
8428 if !(r.OutMerge(0x000000ff) != nil) {
8429 break
8430 }
8431 v.reset(OpS390XRISBGZ)
8432 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0x000000ff))
8433 v.AddArg(x)
8434 return true
8435 }
8436 // match: (MOVBZreg (ANDWconst [m] x))
8437 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x))
8438 for {
8439 if v_0.Op != OpS390XANDWconst {
8440 break
8441 }
8442 m := auxIntToInt32(v_0.AuxInt)
8443 x := v_0.Args[0]
8444 v.reset(OpS390XMOVWZreg)
8445 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
8446 v0.AuxInt = int32ToAuxInt(int32(uint8(m)))
8447 v0.AddArg(x)
8448 v.AddArg(v0)
8449 return true
8450 }
8451 return false
8452 }
8453 func rewriteValueS390X_OpS390XMOVBload(v *Value) bool {
8454 v_1 := v.Args[1]
8455 v_0 := v.Args[0]
8456 // match: (MOVBload [off] {sym} ptr1 (MOVBstore [off] {sym} ptr2 x _))
8457 // cond: isSamePtr(ptr1, ptr2)
8458 // result: (MOVBreg x)
8459 for {
8460 off := auxIntToInt32(v.AuxInt)
8461 sym := auxToSym(v.Aux)
8462 ptr1 := v_0
8463 if v_1.Op != OpS390XMOVBstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
8464 break
8465 }
8466 x := v_1.Args[1]
8467 ptr2 := v_1.Args[0]
8468 if !(isSamePtr(ptr1, ptr2)) {
8469 break
8470 }
8471 v.reset(OpS390XMOVBreg)
8472 v.AddArg(x)
8473 return true
8474 }
8475 // match: (MOVBload [off1] {sym} (ADDconst [off2] ptr) mem)
8476 // cond: is20Bit(int64(off1)+int64(off2))
8477 // result: (MOVBload [off1+off2] {sym} ptr mem)
8478 for {
8479 off1 := auxIntToInt32(v.AuxInt)
8480 sym := auxToSym(v.Aux)
8481 if v_0.Op != OpS390XADDconst {
8482 break
8483 }
8484 off2 := auxIntToInt32(v_0.AuxInt)
8485 ptr := v_0.Args[0]
8486 mem := v_1
8487 if !(is20Bit(int64(off1) + int64(off2))) {
8488 break
8489 }
8490 v.reset(OpS390XMOVBload)
8491 v.AuxInt = int32ToAuxInt(off1 + off2)
8492 v.Aux = symToAux(sym)
8493 v.AddArg2(ptr, mem)
8494 return true
8495 }
8496 // match: (MOVBload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem)
8497 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
8498 // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem)
8499 for {
8500 off1 := auxIntToInt32(v.AuxInt)
8501 sym1 := auxToSym(v.Aux)
8502 if v_0.Op != OpS390XMOVDaddr {
8503 break
8504 }
8505 off2 := auxIntToInt32(v_0.AuxInt)
8506 sym2 := auxToSym(v_0.Aux)
8507 base := v_0.Args[0]
8508 mem := v_1
8509 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
8510 break
8511 }
8512 v.reset(OpS390XMOVBload)
8513 v.AuxInt = int32ToAuxInt(off1 + off2)
8514 v.Aux = symToAux(mergeSym(sym1, sym2))
8515 v.AddArg2(base, mem)
8516 return true
8517 }
8518 return false
8519 }
8520 func rewriteValueS390X_OpS390XMOVBreg(v *Value) bool {
8521 v_0 := v.Args[0]
8522 b := v.Block
8523 typ := &b.Func.Config.Types
8524 // match: (MOVBreg e:(MOVBreg x))
8525 // cond: clobberIfDead(e)
8526 // result: (MOVBreg x)
8527 for {
8528 e := v_0
8529 if e.Op != OpS390XMOVBreg {
8530 break
8531 }
8532 x := e.Args[0]
8533 if !(clobberIfDead(e)) {
8534 break
8535 }
8536 v.reset(OpS390XMOVBreg)
8537 v.AddArg(x)
8538 return true
8539 }
8540 // match: (MOVBreg e:(MOVHreg x))
8541 // cond: clobberIfDead(e)
8542 // result: (MOVBreg x)
8543 for {
8544 e := v_0
8545 if e.Op != OpS390XMOVHreg {
8546 break
8547 }
8548 x := e.Args[0]
8549 if !(clobberIfDead(e)) {
8550 break
8551 }
8552 v.reset(OpS390XMOVBreg)
8553 v.AddArg(x)
8554 return true
8555 }
8556 // match: (MOVBreg e:(MOVWreg x))
8557 // cond: clobberIfDead(e)
8558 // result: (MOVBreg x)
8559 for {
8560 e := v_0
8561 if e.Op != OpS390XMOVWreg {
8562 break
8563 }
8564 x := e.Args[0]
8565 if !(clobberIfDead(e)) {
8566 break
8567 }
8568 v.reset(OpS390XMOVBreg)
8569 v.AddArg(x)
8570 return true
8571 }
8572 // match: (MOVBreg e:(MOVBZreg x))
8573 // cond: clobberIfDead(e)
8574 // result: (MOVBreg x)
8575 for {
8576 e := v_0
8577 if e.Op != OpS390XMOVBZreg {
8578 break
8579 }
8580 x := e.Args[0]
8581 if !(clobberIfDead(e)) {
8582 break
8583 }
8584 v.reset(OpS390XMOVBreg)
8585 v.AddArg(x)
8586 return true
8587 }
8588 // match: (MOVBreg e:(MOVHZreg x))
8589 // cond: clobberIfDead(e)
8590 // result: (MOVBreg x)
8591 for {
8592 e := v_0
8593 if e.Op != OpS390XMOVHZreg {
8594 break
8595 }
8596 x := e.Args[0]
8597 if !(clobberIfDead(e)) {
8598 break
8599 }
8600 v.reset(OpS390XMOVBreg)
8601 v.AddArg(x)
8602 return true
8603 }
8604 // match: (MOVBreg e:(MOVWZreg x))
8605 // cond: clobberIfDead(e)
8606 // result: (MOVBreg x)
8607 for {
8608 e := v_0
8609 if e.Op != OpS390XMOVWZreg {
8610 break
8611 }
8612 x := e.Args[0]
8613 if !(clobberIfDead(e)) {
8614 break
8615 }
8616 v.reset(OpS390XMOVBreg)
8617 v.AddArg(x)
8618 return true
8619 }
8620 // match: (MOVBreg x:(MOVBload _ _))
8621 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
8622 // result: x
8623 for {
8624 x := v_0
8625 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
8626 break
8627 }
8628 v.copyOf(x)
8629 return true
8630 }
8631 // match: (MOVBreg <t> x:(MOVBZload [o] {s} p mem))
8632 // cond: x.Uses == 1 && clobber(x)
8633 // result: @x.Block (MOVBload <t> [o] {s} p mem)
8634 for {
8635 t := v.Type
8636 x := v_0
8637 if x.Op != OpS390XMOVBZload {
8638 break
8639 }
8640 o := auxIntToInt32(x.AuxInt)
8641 s := auxToSym(x.Aux)
8642 mem := x.Args[1]
8643 p := x.Args[0]
8644 if !(x.Uses == 1 && clobber(x)) {
8645 break
8646 }
8647 b = x.Block
8648 v0 := b.NewValue0(x.Pos, OpS390XMOVBload, t)
8649 v.copyOf(v0)
8650 v0.AuxInt = int32ToAuxInt(o)
8651 v0.Aux = symToAux(s)
8652 v0.AddArg2(p, mem)
8653 return true
8654 }
8655 // match: (MOVBreg x:(Arg <t>))
8656 // cond: t.IsSigned() && t.Size() == 1
8657 // result: x
8658 for {
8659 x := v_0
8660 if x.Op != OpArg {
8661 break
8662 }
8663 t := x.Type
8664 if !(t.IsSigned() && t.Size() == 1) {
8665 break
8666 }
8667 v.copyOf(x)
8668 return true
8669 }
8670 // match: (MOVBreg (MOVDconst [c]))
8671 // result: (MOVDconst [int64( int8(c))])
8672 for {
8673 if v_0.Op != OpS390XMOVDconst {
8674 break
8675 }
8676 c := auxIntToInt64(v_0.AuxInt)
8677 v.reset(OpS390XMOVDconst)
8678 v.AuxInt = int64ToAuxInt(int64(int8(c)))
8679 return true
8680 }
8681 // match: (MOVBreg (ANDWconst [m] x))
8682 // cond: int8(m) >= 0
8683 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x))
8684 for {
8685 if v_0.Op != OpS390XANDWconst {
8686 break
8687 }
8688 m := auxIntToInt32(v_0.AuxInt)
8689 x := v_0.Args[0]
8690 if !(int8(m) >= 0) {
8691 break
8692 }
8693 v.reset(OpS390XMOVWZreg)
8694 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
8695 v0.AuxInt = int32ToAuxInt(int32(uint8(m)))
8696 v0.AddArg(x)
8697 v.AddArg(v0)
8698 return true
8699 }
8700 return false
8701 }
8702 func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool {
8703 v_2 := v.Args[2]
8704 v_1 := v.Args[1]
8705 v_0 := v.Args[0]
8706 // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem)
8707 // result: (MOVBstore [off] {sym} ptr x mem)
8708 for {
8709 off := auxIntToInt32(v.AuxInt)
8710 sym := auxToSym(v.Aux)
8711 ptr := v_0
8712 if v_1.Op != OpS390XMOVBreg {
8713 break
8714 }
8715 x := v_1.Args[0]
8716 mem := v_2
8717 v.reset(OpS390XMOVBstore)
8718 v.AuxInt = int32ToAuxInt(off)
8719 v.Aux = symToAux(sym)
8720 v.AddArg3(ptr, x, mem)
8721 return true
8722 }
8723 // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem)
8724 // result: (MOVBstore [off] {sym} ptr x mem)
8725 for {
8726 off := auxIntToInt32(v.AuxInt)
8727 sym := auxToSym(v.Aux)
8728 ptr := v_0
8729 if v_1.Op != OpS390XMOVBZreg {
8730 break
8731 }
8732 x := v_1.Args[0]
8733 mem := v_2
8734 v.reset(OpS390XMOVBstore)
8735 v.AuxInt = int32ToAuxInt(off)
8736 v.Aux = symToAux(sym)
8737 v.AddArg3(ptr, x, mem)
8738 return true
8739 }
8740 // match: (MOVBstore [off1] {sym} (ADDconst [off2] ptr) val mem)
8741 // cond: is20Bit(int64(off1)+int64(off2))
8742 // result: (MOVBstore [off1+off2] {sym} ptr val mem)
8743 for {
8744 off1 := auxIntToInt32(v.AuxInt)
8745 sym := auxToSym(v.Aux)
8746 if v_0.Op != OpS390XADDconst {
8747 break
8748 }
8749 off2 := auxIntToInt32(v_0.AuxInt)
8750 ptr := v_0.Args[0]
8751 val := v_1
8752 mem := v_2
8753 if !(is20Bit(int64(off1) + int64(off2))) {
8754 break
8755 }
8756 v.reset(OpS390XMOVBstore)
8757 v.AuxInt = int32ToAuxInt(off1 + off2)
8758 v.Aux = symToAux(sym)
8759 v.AddArg3(ptr, val, mem)
8760 return true
8761 }
8762 // match: (MOVBstore [off] {sym} ptr (MOVDconst [c]) mem)
8763 // cond: is20Bit(int64(off)) && ptr.Op != OpSB
8764 // result: (MOVBstoreconst [makeValAndOff(int32(int8(c)),off)] {sym} ptr mem)
8765 for {
8766 off := auxIntToInt32(v.AuxInt)
8767 sym := auxToSym(v.Aux)
8768 ptr := v_0
8769 if v_1.Op != OpS390XMOVDconst {
8770 break
8771 }
8772 c := auxIntToInt64(v_1.AuxInt)
8773 mem := v_2
8774 if !(is20Bit(int64(off)) && ptr.Op != OpSB) {
8775 break
8776 }
8777 v.reset(OpS390XMOVBstoreconst)
8778 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int8(c)), off))
8779 v.Aux = symToAux(sym)
8780 v.AddArg2(ptr, mem)
8781 return true
8782 }
8783 // match: (MOVBstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem)
8784 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
8785 // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
8786 for {
8787 off1 := auxIntToInt32(v.AuxInt)
8788 sym1 := auxToSym(v.Aux)
8789 if v_0.Op != OpS390XMOVDaddr {
8790 break
8791 }
8792 off2 := auxIntToInt32(v_0.AuxInt)
8793 sym2 := auxToSym(v_0.Aux)
8794 base := v_0.Args[0]
8795 val := v_1
8796 mem := v_2
8797 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
8798 break
8799 }
8800 v.reset(OpS390XMOVBstore)
8801 v.AuxInt = int32ToAuxInt(off1 + off2)
8802 v.Aux = symToAux(mergeSym(sym1, sym2))
8803 v.AddArg3(base, val, mem)
8804 return true
8805 }
8806 return false
8807 }
8808 func rewriteValueS390X_OpS390XMOVBstoreconst(v *Value) bool {
8809 v_1 := v.Args[1]
8810 v_0 := v.Args[0]
8811 // match: (MOVBstoreconst [sc] {s} (ADDconst [off] ptr) mem)
8812 // cond: is20Bit(sc.Off64()+int64(off))
8813 // result: (MOVBstoreconst [sc.addOffset32(off)] {s} ptr mem)
8814 for {
8815 sc := auxIntToValAndOff(v.AuxInt)
8816 s := auxToSym(v.Aux)
8817 if v_0.Op != OpS390XADDconst {
8818 break
8819 }
8820 off := auxIntToInt32(v_0.AuxInt)
8821 ptr := v_0.Args[0]
8822 mem := v_1
8823 if !(is20Bit(sc.Off64() + int64(off))) {
8824 break
8825 }
8826 v.reset(OpS390XMOVBstoreconst)
8827 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
8828 v.Aux = symToAux(s)
8829 v.AddArg2(ptr, mem)
8830 return true
8831 }
8832 // match: (MOVBstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem)
8833 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)
8834 // result: (MOVBstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
8835 for {
8836 sc := auxIntToValAndOff(v.AuxInt)
8837 sym1 := auxToSym(v.Aux)
8838 if v_0.Op != OpS390XMOVDaddr {
8839 break
8840 }
8841 off := auxIntToInt32(v_0.AuxInt)
8842 sym2 := auxToSym(v_0.Aux)
8843 ptr := v_0.Args[0]
8844 mem := v_1
8845 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) {
8846 break
8847 }
8848 v.reset(OpS390XMOVBstoreconst)
8849 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
8850 v.Aux = symToAux(mergeSym(sym1, sym2))
8851 v.AddArg2(ptr, mem)
8852 return true
8853 }
8854 return false
8855 }
8856 func rewriteValueS390X_OpS390XMOVDBR(v *Value) bool {
8857 v_0 := v.Args[0]
8858 b := v.Block
8859 typ := &b.Func.Config.Types
8860 // match: (MOVDBR x:(MOVDload [off] {sym} ptr mem))
8861 // cond: x.Uses == 1
8862 // result: @x.Block (MOVDBRload [off] {sym} ptr mem)
8863 for {
8864 x := v_0
8865 if x.Op != OpS390XMOVDload {
8866 break
8867 }
8868 off := auxIntToInt32(x.AuxInt)
8869 sym := auxToSym(x.Aux)
8870 mem := x.Args[1]
8871 ptr := x.Args[0]
8872 if !(x.Uses == 1) {
8873 break
8874 }
8875 b = x.Block
8876 v0 := b.NewValue0(x.Pos, OpS390XMOVDBRload, typ.UInt64)
8877 v.copyOf(v0)
8878 v0.AuxInt = int32ToAuxInt(off)
8879 v0.Aux = symToAux(sym)
8880 v0.AddArg2(ptr, mem)
8881 return true
8882 }
8883 // match: (MOVDBR x:(MOVDloadidx [off] {sym} ptr idx mem))
8884 // cond: x.Uses == 1
8885 // result: @x.Block (MOVDBRloadidx [off] {sym} ptr idx mem)
8886 for {
8887 x := v_0
8888 if x.Op != OpS390XMOVDloadidx {
8889 break
8890 }
8891 off := auxIntToInt32(x.AuxInt)
8892 sym := auxToSym(x.Aux)
8893 mem := x.Args[2]
8894 ptr := x.Args[0]
8895 idx := x.Args[1]
8896 if !(x.Uses == 1) {
8897 break
8898 }
8899 b = x.Block
8900 v0 := b.NewValue0(v.Pos, OpS390XMOVDBRloadidx, typ.Int64)
8901 v.copyOf(v0)
8902 v0.AuxInt = int32ToAuxInt(off)
8903 v0.Aux = symToAux(sym)
8904 v0.AddArg3(ptr, idx, mem)
8905 return true
8906 }
8907 return false
8908 }
8909 func rewriteValueS390X_OpS390XMOVDaddridx(v *Value) bool {
8910 v_1 := v.Args[1]
8911 v_0 := v.Args[0]
8912 // match: (MOVDaddridx [c] {s} (ADDconst [d] x) y)
8913 // cond: is20Bit(int64(c)+int64(d))
8914 // result: (MOVDaddridx [c+d] {s} x y)
8915 for {
8916 c := auxIntToInt32(v.AuxInt)
8917 s := auxToSym(v.Aux)
8918 if v_0.Op != OpS390XADDconst {
8919 break
8920 }
8921 d := auxIntToInt32(v_0.AuxInt)
8922 x := v_0.Args[0]
8923 y := v_1
8924 if !(is20Bit(int64(c) + int64(d))) {
8925 break
8926 }
8927 v.reset(OpS390XMOVDaddridx)
8928 v.AuxInt = int32ToAuxInt(c + d)
8929 v.Aux = symToAux(s)
8930 v.AddArg2(x, y)
8931 return true
8932 }
8933 // match: (MOVDaddridx [c] {s} x (ADDconst [d] y))
8934 // cond: is20Bit(int64(c)+int64(d))
8935 // result: (MOVDaddridx [c+d] {s} x y)
8936 for {
8937 c := auxIntToInt32(v.AuxInt)
8938 s := auxToSym(v.Aux)
8939 x := v_0
8940 if v_1.Op != OpS390XADDconst {
8941 break
8942 }
8943 d := auxIntToInt32(v_1.AuxInt)
8944 y := v_1.Args[0]
8945 if !(is20Bit(int64(c) + int64(d))) {
8946 break
8947 }
8948 v.reset(OpS390XMOVDaddridx)
8949 v.AuxInt = int32ToAuxInt(c + d)
8950 v.Aux = symToAux(s)
8951 v.AddArg2(x, y)
8952 return true
8953 }
8954 // match: (MOVDaddridx [off1] {sym1} (MOVDaddr [off2] {sym2} x) y)
8955 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
8956 // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y)
8957 for {
8958 off1 := auxIntToInt32(v.AuxInt)
8959 sym1 := auxToSym(v.Aux)
8960 if v_0.Op != OpS390XMOVDaddr {
8961 break
8962 }
8963 off2 := auxIntToInt32(v_0.AuxInt)
8964 sym2 := auxToSym(v_0.Aux)
8965 x := v_0.Args[0]
8966 y := v_1
8967 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
8968 break
8969 }
8970 v.reset(OpS390XMOVDaddridx)
8971 v.AuxInt = int32ToAuxInt(off1 + off2)
8972 v.Aux = symToAux(mergeSym(sym1, sym2))
8973 v.AddArg2(x, y)
8974 return true
8975 }
8976 // match: (MOVDaddridx [off1] {sym1} x (MOVDaddr [off2] {sym2} y))
8977 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB
8978 // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y)
8979 for {
8980 off1 := auxIntToInt32(v.AuxInt)
8981 sym1 := auxToSym(v.Aux)
8982 x := v_0
8983 if v_1.Op != OpS390XMOVDaddr {
8984 break
8985 }
8986 off2 := auxIntToInt32(v_1.AuxInt)
8987 sym2 := auxToSym(v_1.Aux)
8988 y := v_1.Args[0]
8989 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB) {
8990 break
8991 }
8992 v.reset(OpS390XMOVDaddridx)
8993 v.AuxInt = int32ToAuxInt(off1 + off2)
8994 v.Aux = symToAux(mergeSym(sym1, sym2))
8995 v.AddArg2(x, y)
8996 return true
8997 }
8998 return false
8999 }
9000 func rewriteValueS390X_OpS390XMOVDload(v *Value) bool {
9001 v_1 := v.Args[1]
9002 v_0 := v.Args[0]
9003 // match: (MOVDload [off] {sym} ptr1 (MOVDstore [off] {sym} ptr2 x _))
9004 // cond: isSamePtr(ptr1, ptr2)
9005 // result: x
9006 for {
9007 off := auxIntToInt32(v.AuxInt)
9008 sym := auxToSym(v.Aux)
9009 ptr1 := v_0
9010 if v_1.Op != OpS390XMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
9011 break
9012 }
9013 x := v_1.Args[1]
9014 ptr2 := v_1.Args[0]
9015 if !(isSamePtr(ptr1, ptr2)) {
9016 break
9017 }
9018 v.copyOf(x)
9019 return true
9020 }
9021 // match: (MOVDload [off] {sym} ptr1 (FMOVDstore [off] {sym} ptr2 x _))
9022 // cond: isSamePtr(ptr1, ptr2)
9023 // result: (LGDR x)
9024 for {
9025 off := auxIntToInt32(v.AuxInt)
9026 sym := auxToSym(v.Aux)
9027 ptr1 := v_0
9028 if v_1.Op != OpS390XFMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
9029 break
9030 }
9031 x := v_1.Args[1]
9032 ptr2 := v_1.Args[0]
9033 if !(isSamePtr(ptr1, ptr2)) {
9034 break
9035 }
9036 v.reset(OpS390XLGDR)
9037 v.AddArg(x)
9038 return true
9039 }
9040 // match: (MOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
9041 // cond: is20Bit(int64(off1)+int64(off2))
9042 // result: (MOVDload [off1+off2] {sym} ptr mem)
9043 for {
9044 off1 := auxIntToInt32(v.AuxInt)
9045 sym := auxToSym(v.Aux)
9046 if v_0.Op != OpS390XADDconst {
9047 break
9048 }
9049 off2 := auxIntToInt32(v_0.AuxInt)
9050 ptr := v_0.Args[0]
9051 mem := v_1
9052 if !(is20Bit(int64(off1) + int64(off2))) {
9053 break
9054 }
9055 v.reset(OpS390XMOVDload)
9056 v.AuxInt = int32ToAuxInt(off1 + off2)
9057 v.Aux = symToAux(sym)
9058 v.AddArg2(ptr, mem)
9059 return true
9060 }
9061 // match: (MOVDload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
9062 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))
9063 // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem)
9064 for {
9065 off1 := auxIntToInt32(v.AuxInt)
9066 sym1 := auxToSym(v.Aux)
9067 if v_0.Op != OpS390XMOVDaddr {
9068 break
9069 }
9070 t := v_0.Type
9071 off2 := auxIntToInt32(v_0.AuxInt)
9072 sym2 := auxToSym(v_0.Aux)
9073 base := v_0.Args[0]
9074 mem := v_1
9075 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) {
9076 break
9077 }
9078 v.reset(OpS390XMOVDload)
9079 v.AuxInt = int32ToAuxInt(off1 + off2)
9080 v.Aux = symToAux(mergeSym(sym1, sym2))
9081 v.AddArg2(base, mem)
9082 return true
9083 }
9084 return false
9085 }
9086 func rewriteValueS390X_OpS390XMOVDstore(v *Value) bool {
9087 v_2 := v.Args[2]
9088 v_1 := v.Args[1]
9089 v_0 := v.Args[0]
9090 // match: (MOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
9091 // cond: is20Bit(int64(off1)+int64(off2))
9092 // result: (MOVDstore [off1+off2] {sym} ptr val mem)
9093 for {
9094 off1 := auxIntToInt32(v.AuxInt)
9095 sym := auxToSym(v.Aux)
9096 if v_0.Op != OpS390XADDconst {
9097 break
9098 }
9099 off2 := auxIntToInt32(v_0.AuxInt)
9100 ptr := v_0.Args[0]
9101 val := v_1
9102 mem := v_2
9103 if !(is20Bit(int64(off1) + int64(off2))) {
9104 break
9105 }
9106 v.reset(OpS390XMOVDstore)
9107 v.AuxInt = int32ToAuxInt(off1 + off2)
9108 v.Aux = symToAux(sym)
9109 v.AddArg3(ptr, val, mem)
9110 return true
9111 }
9112 // match: (MOVDstore [off] {sym} ptr (MOVDconst [c]) mem)
9113 // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB
9114 // result: (MOVDstoreconst [makeValAndOff(int32(c),off)] {sym} ptr mem)
9115 for {
9116 off := auxIntToInt32(v.AuxInt)
9117 sym := auxToSym(v.Aux)
9118 ptr := v_0
9119 if v_1.Op != OpS390XMOVDconst {
9120 break
9121 }
9122 c := auxIntToInt64(v_1.AuxInt)
9123 mem := v_2
9124 if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) {
9125 break
9126 }
9127 v.reset(OpS390XMOVDstoreconst)
9128 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
9129 v.Aux = symToAux(sym)
9130 v.AddArg2(ptr, mem)
9131 return true
9132 }
9133 // match: (MOVDstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem)
9134 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))
9135 // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
9136 for {
9137 off1 := auxIntToInt32(v.AuxInt)
9138 sym1 := auxToSym(v.Aux)
9139 if v_0.Op != OpS390XMOVDaddr {
9140 break
9141 }
9142 t := v_0.Type
9143 off2 := auxIntToInt32(v_0.AuxInt)
9144 sym2 := auxToSym(v_0.Aux)
9145 base := v_0.Args[0]
9146 val := v_1
9147 mem := v_2
9148 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) {
9149 break
9150 }
9151 v.reset(OpS390XMOVDstore)
9152 v.AuxInt = int32ToAuxInt(off1 + off2)
9153 v.Aux = symToAux(mergeSym(sym1, sym2))
9154 v.AddArg3(base, val, mem)
9155 return true
9156 }
9157 // match: (MOVDstore [i] {s} p w1 x:(MOVDstore [i-8] {s} p w0 mem))
9158 // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)
9159 // result: (STMG2 [i-8] {s} p w0 w1 mem)
9160 for {
9161 i := auxIntToInt32(v.AuxInt)
9162 s := auxToSym(v.Aux)
9163 p := v_0
9164 w1 := v_1
9165 x := v_2
9166 if x.Op != OpS390XMOVDstore || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s {
9167 break
9168 }
9169 mem := x.Args[2]
9170 if p != x.Args[0] {
9171 break
9172 }
9173 w0 := x.Args[1]
9174 if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)) {
9175 break
9176 }
9177 v.reset(OpS390XSTMG2)
9178 v.AuxInt = int32ToAuxInt(i - 8)
9179 v.Aux = symToAux(s)
9180 v.AddArg4(p, w0, w1, mem)
9181 return true
9182 }
9183 // match: (MOVDstore [i] {s} p w2 x:(STMG2 [i-16] {s} p w0 w1 mem))
9184 // cond: x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)
9185 // result: (STMG3 [i-16] {s} p w0 w1 w2 mem)
9186 for {
9187 i := auxIntToInt32(v.AuxInt)
9188 s := auxToSym(v.Aux)
9189 p := v_0
9190 w2 := v_1
9191 x := v_2
9192 if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s {
9193 break
9194 }
9195 mem := x.Args[3]
9196 if p != x.Args[0] {
9197 break
9198 }
9199 w0 := x.Args[1]
9200 w1 := x.Args[2]
9201 if !(x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)) {
9202 break
9203 }
9204 v.reset(OpS390XSTMG3)
9205 v.AuxInt = int32ToAuxInt(i - 16)
9206 v.Aux = symToAux(s)
9207 v.AddArg5(p, w0, w1, w2, mem)
9208 return true
9209 }
9210 // match: (MOVDstore [i] {s} p w3 x:(STMG3 [i-24] {s} p w0 w1 w2 mem))
9211 // cond: x.Uses == 1 && is20Bit(int64(i)-24) && setPos(v, x.Pos) && clobber(x)
9212 // result: (STMG4 [i-24] {s} p w0 w1 w2 w3 mem)
9213 for {
9214 i := auxIntToInt32(v.AuxInt)
9215 s := auxToSym(v.Aux)
9216 p := v_0
9217 w3 := v_1
9218 x := v_2
9219 if x.Op != OpS390XSTMG3 || auxIntToInt32(x.AuxInt) != i-24 || auxToSym(x.Aux) != s {
9220 break
9221 }
9222 mem := x.Args[4]
9223 if p != x.Args[0] {
9224 break
9225 }
9226 w0 := x.Args[1]
9227 w1 := x.Args[2]
9228 w2 := x.Args[3]
9229 if !(x.Uses == 1 && is20Bit(int64(i)-24) && setPos(v, x.Pos) && clobber(x)) {
9230 break
9231 }
9232 v.reset(OpS390XSTMG4)
9233 v.AuxInt = int32ToAuxInt(i - 24)
9234 v.Aux = symToAux(s)
9235 v.AddArg6(p, w0, w1, w2, w3, mem)
9236 return true
9237 }
9238 // match: (MOVDstore [off] {sym} ptr r:(MOVDBR x) mem)
9239 // cond: r.Uses == 1
9240 // result: (MOVDBRstore [off] {sym} ptr x mem)
9241 for {
9242 off := auxIntToInt32(v.AuxInt)
9243 sym := auxToSym(v.Aux)
9244 ptr := v_0
9245 r := v_1
9246 if r.Op != OpS390XMOVDBR {
9247 break
9248 }
9249 x := r.Args[0]
9250 mem := v_2
9251 if !(r.Uses == 1) {
9252 break
9253 }
9254 v.reset(OpS390XMOVDBRstore)
9255 v.AuxInt = int32ToAuxInt(off)
9256 v.Aux = symToAux(sym)
9257 v.AddArg3(ptr, x, mem)
9258 return true
9259 }
9260 return false
9261 }
9262 func rewriteValueS390X_OpS390XMOVDstoreconst(v *Value) bool {
9263 v_1 := v.Args[1]
9264 v_0 := v.Args[0]
9265 // match: (MOVDstoreconst [sc] {s} (ADDconst [off] ptr) mem)
9266 // cond: isU12Bit(sc.Off64()+int64(off))
9267 // result: (MOVDstoreconst [sc.addOffset32(off)] {s} ptr mem)
9268 for {
9269 sc := auxIntToValAndOff(v.AuxInt)
9270 s := auxToSym(v.Aux)
9271 if v_0.Op != OpS390XADDconst {
9272 break
9273 }
9274 off := auxIntToInt32(v_0.AuxInt)
9275 ptr := v_0.Args[0]
9276 mem := v_1
9277 if !(isU12Bit(sc.Off64() + int64(off))) {
9278 break
9279 }
9280 v.reset(OpS390XMOVDstoreconst)
9281 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
9282 v.Aux = symToAux(s)
9283 v.AddArg2(ptr, mem)
9284 return true
9285 }
9286 // match: (MOVDstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem)
9287 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)
9288 // result: (MOVDstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
9289 for {
9290 sc := auxIntToValAndOff(v.AuxInt)
9291 sym1 := auxToSym(v.Aux)
9292 if v_0.Op != OpS390XMOVDaddr {
9293 break
9294 }
9295 off := auxIntToInt32(v_0.AuxInt)
9296 sym2 := auxToSym(v_0.Aux)
9297 ptr := v_0.Args[0]
9298 mem := v_1
9299 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) {
9300 break
9301 }
9302 v.reset(OpS390XMOVDstoreconst)
9303 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
9304 v.Aux = symToAux(mergeSym(sym1, sym2))
9305 v.AddArg2(ptr, mem)
9306 return true
9307 }
9308 return false
9309 }
9310 func rewriteValueS390X_OpS390XMOVDstoreidx(v *Value) bool {
9311 v_3 := v.Args[3]
9312 v_2 := v.Args[2]
9313 v_1 := v.Args[1]
9314 v_0 := v.Args[0]
9315 // match: (MOVDstoreidx [off] {sym} ptr idx r:(MOVDBR x) mem)
9316 // cond: r.Uses == 1
9317 // result: (MOVDBRstoreidx [off] {sym} ptr idx x mem)
9318 for {
9319 off := auxIntToInt32(v.AuxInt)
9320 sym := auxToSym(v.Aux)
9321 ptr := v_0
9322 idx := v_1
9323 r := v_2
9324 if r.Op != OpS390XMOVDBR {
9325 break
9326 }
9327 x := r.Args[0]
9328 mem := v_3
9329 if !(r.Uses == 1) {
9330 break
9331 }
9332 v.reset(OpS390XMOVDBRstoreidx)
9333 v.AuxInt = int32ToAuxInt(off)
9334 v.Aux = symToAux(sym)
9335 v.AddArg4(ptr, idx, x, mem)
9336 return true
9337 }
9338 return false
9339 }
9340 func rewriteValueS390X_OpS390XMOVHZload(v *Value) bool {
9341 v_1 := v.Args[1]
9342 v_0 := v.Args[0]
9343 // match: (MOVHZload [off] {sym} ptr1 (MOVHstore [off] {sym} ptr2 x _))
9344 // cond: isSamePtr(ptr1, ptr2)
9345 // result: (MOVHZreg x)
9346 for {
9347 off := auxIntToInt32(v.AuxInt)
9348 sym := auxToSym(v.Aux)
9349 ptr1 := v_0
9350 if v_1.Op != OpS390XMOVHstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
9351 break
9352 }
9353 x := v_1.Args[1]
9354 ptr2 := v_1.Args[0]
9355 if !(isSamePtr(ptr1, ptr2)) {
9356 break
9357 }
9358 v.reset(OpS390XMOVHZreg)
9359 v.AddArg(x)
9360 return true
9361 }
9362 // match: (MOVHZload [off1] {sym} (ADDconst [off2] ptr) mem)
9363 // cond: is20Bit(int64(off1)+int64(off2))
9364 // result: (MOVHZload [off1+off2] {sym} ptr mem)
9365 for {
9366 off1 := auxIntToInt32(v.AuxInt)
9367 sym := auxToSym(v.Aux)
9368 if v_0.Op != OpS390XADDconst {
9369 break
9370 }
9371 off2 := auxIntToInt32(v_0.AuxInt)
9372 ptr := v_0.Args[0]
9373 mem := v_1
9374 if !(is20Bit(int64(off1) + int64(off2))) {
9375 break
9376 }
9377 v.reset(OpS390XMOVHZload)
9378 v.AuxInt = int32ToAuxInt(off1 + off2)
9379 v.Aux = symToAux(sym)
9380 v.AddArg2(ptr, mem)
9381 return true
9382 }
9383 // match: (MOVHZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
9384 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))
9385 // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} base mem)
9386 for {
9387 off1 := auxIntToInt32(v.AuxInt)
9388 sym1 := auxToSym(v.Aux)
9389 if v_0.Op != OpS390XMOVDaddr {
9390 break
9391 }
9392 t := v_0.Type
9393 off2 := auxIntToInt32(v_0.AuxInt)
9394 sym2 := auxToSym(v_0.Aux)
9395 base := v_0.Args[0]
9396 mem := v_1
9397 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) {
9398 break
9399 }
9400 v.reset(OpS390XMOVHZload)
9401 v.AuxInt = int32ToAuxInt(off1 + off2)
9402 v.Aux = symToAux(mergeSym(sym1, sym2))
9403 v.AddArg2(base, mem)
9404 return true
9405 }
9406 return false
9407 }
9408 func rewriteValueS390X_OpS390XMOVHZreg(v *Value) bool {
9409 v_0 := v.Args[0]
9410 b := v.Block
9411 typ := &b.Func.Config.Types
9412 // match: (MOVHZreg e:(MOVBZreg x))
9413 // cond: clobberIfDead(e)
9414 // result: (MOVBZreg x)
9415 for {
9416 e := v_0
9417 if e.Op != OpS390XMOVBZreg {
9418 break
9419 }
9420 x := e.Args[0]
9421 if !(clobberIfDead(e)) {
9422 break
9423 }
9424 v.reset(OpS390XMOVBZreg)
9425 v.AddArg(x)
9426 return true
9427 }
9428 // match: (MOVHZreg e:(MOVHreg x))
9429 // cond: clobberIfDead(e)
9430 // result: (MOVHZreg x)
9431 for {
9432 e := v_0
9433 if e.Op != OpS390XMOVHreg {
9434 break
9435 }
9436 x := e.Args[0]
9437 if !(clobberIfDead(e)) {
9438 break
9439 }
9440 v.reset(OpS390XMOVHZreg)
9441 v.AddArg(x)
9442 return true
9443 }
9444 // match: (MOVHZreg e:(MOVWreg x))
9445 // cond: clobberIfDead(e)
9446 // result: (MOVHZreg x)
9447 for {
9448 e := v_0
9449 if e.Op != OpS390XMOVWreg {
9450 break
9451 }
9452 x := e.Args[0]
9453 if !(clobberIfDead(e)) {
9454 break
9455 }
9456 v.reset(OpS390XMOVHZreg)
9457 v.AddArg(x)
9458 return true
9459 }
9460 // match: (MOVHZreg e:(MOVHZreg x))
9461 // cond: clobberIfDead(e)
9462 // result: (MOVHZreg x)
9463 for {
9464 e := v_0
9465 if e.Op != OpS390XMOVHZreg {
9466 break
9467 }
9468 x := e.Args[0]
9469 if !(clobberIfDead(e)) {
9470 break
9471 }
9472 v.reset(OpS390XMOVHZreg)
9473 v.AddArg(x)
9474 return true
9475 }
9476 // match: (MOVHZreg e:(MOVWZreg x))
9477 // cond: clobberIfDead(e)
9478 // result: (MOVHZreg x)
9479 for {
9480 e := v_0
9481 if e.Op != OpS390XMOVWZreg {
9482 break
9483 }
9484 x := e.Args[0]
9485 if !(clobberIfDead(e)) {
9486 break
9487 }
9488 v.reset(OpS390XMOVHZreg)
9489 v.AddArg(x)
9490 return true
9491 }
9492 // match: (MOVHZreg x:(MOVBZload _ _))
9493 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
9494 // result: x
9495 for {
9496 x := v_0
9497 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
9498 break
9499 }
9500 v.copyOf(x)
9501 return true
9502 }
9503 // match: (MOVHZreg x:(MOVHZload _ _))
9504 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2)
9505 // result: x
9506 for {
9507 x := v_0
9508 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) {
9509 break
9510 }
9511 v.copyOf(x)
9512 return true
9513 }
9514 // match: (MOVHZreg <t> x:(MOVHload [o] {s} p mem))
9515 // cond: x.Uses == 1 && clobber(x)
9516 // result: @x.Block (MOVHZload <t> [o] {s} p mem)
9517 for {
9518 t := v.Type
9519 x := v_0
9520 if x.Op != OpS390XMOVHload {
9521 break
9522 }
9523 o := auxIntToInt32(x.AuxInt)
9524 s := auxToSym(x.Aux)
9525 mem := x.Args[1]
9526 p := x.Args[0]
9527 if !(x.Uses == 1 && clobber(x)) {
9528 break
9529 }
9530 b = x.Block
9531 v0 := b.NewValue0(x.Pos, OpS390XMOVHZload, t)
9532 v.copyOf(v0)
9533 v0.AuxInt = int32ToAuxInt(o)
9534 v0.Aux = symToAux(s)
9535 v0.AddArg2(p, mem)
9536 return true
9537 }
9538 // match: (MOVHZreg x:(Arg <t>))
9539 // cond: !t.IsSigned() && t.Size() <= 2
9540 // result: x
9541 for {
9542 x := v_0
9543 if x.Op != OpArg {
9544 break
9545 }
9546 t := x.Type
9547 if !(!t.IsSigned() && t.Size() <= 2) {
9548 break
9549 }
9550 v.copyOf(x)
9551 return true
9552 }
9553 // match: (MOVHZreg (MOVDconst [c]))
9554 // result: (MOVDconst [int64(uint16(c))])
9555 for {
9556 if v_0.Op != OpS390XMOVDconst {
9557 break
9558 }
9559 c := auxIntToInt64(v_0.AuxInt)
9560 v.reset(OpS390XMOVDconst)
9561 v.AuxInt = int64ToAuxInt(int64(uint16(c)))
9562 return true
9563 }
9564 // match: (MOVHZreg (RISBGZ x {r}))
9565 // cond: r.OutMerge(0x0000ffff) != nil
9566 // result: (RISBGZ x {*r.OutMerge(0x0000ffff)})
9567 for {
9568 if v_0.Op != OpS390XRISBGZ {
9569 break
9570 }
9571 r := auxToS390xRotateParams(v_0.Aux)
9572 x := v_0.Args[0]
9573 if !(r.OutMerge(0x0000ffff) != nil) {
9574 break
9575 }
9576 v.reset(OpS390XRISBGZ)
9577 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0x0000ffff))
9578 v.AddArg(x)
9579 return true
9580 }
9581 // match: (MOVHZreg (ANDWconst [m] x))
9582 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x))
9583 for {
9584 if v_0.Op != OpS390XANDWconst {
9585 break
9586 }
9587 m := auxIntToInt32(v_0.AuxInt)
9588 x := v_0.Args[0]
9589 v.reset(OpS390XMOVWZreg)
9590 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
9591 v0.AuxInt = int32ToAuxInt(int32(uint16(m)))
9592 v0.AddArg(x)
9593 v.AddArg(v0)
9594 return true
9595 }
9596 return false
9597 }
9598 func rewriteValueS390X_OpS390XMOVHload(v *Value) bool {
9599 v_1 := v.Args[1]
9600 v_0 := v.Args[0]
9601 // match: (MOVHload [off] {sym} ptr1 (MOVHstore [off] {sym} ptr2 x _))
9602 // cond: isSamePtr(ptr1, ptr2)
9603 // result: (MOVHreg x)
9604 for {
9605 off := auxIntToInt32(v.AuxInt)
9606 sym := auxToSym(v.Aux)
9607 ptr1 := v_0
9608 if v_1.Op != OpS390XMOVHstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
9609 break
9610 }
9611 x := v_1.Args[1]
9612 ptr2 := v_1.Args[0]
9613 if !(isSamePtr(ptr1, ptr2)) {
9614 break
9615 }
9616 v.reset(OpS390XMOVHreg)
9617 v.AddArg(x)
9618 return true
9619 }
9620 // match: (MOVHload [off1] {sym} (ADDconst [off2] ptr) mem)
9621 // cond: is20Bit(int64(off1)+int64(off2))
9622 // result: (MOVHload [off1+off2] {sym} ptr mem)
9623 for {
9624 off1 := auxIntToInt32(v.AuxInt)
9625 sym := auxToSym(v.Aux)
9626 if v_0.Op != OpS390XADDconst {
9627 break
9628 }
9629 off2 := auxIntToInt32(v_0.AuxInt)
9630 ptr := v_0.Args[0]
9631 mem := v_1
9632 if !(is20Bit(int64(off1) + int64(off2))) {
9633 break
9634 }
9635 v.reset(OpS390XMOVHload)
9636 v.AuxInt = int32ToAuxInt(off1 + off2)
9637 v.Aux = symToAux(sym)
9638 v.AddArg2(ptr, mem)
9639 return true
9640 }
9641 // match: (MOVHload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
9642 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))
9643 // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} base mem)
9644 for {
9645 off1 := auxIntToInt32(v.AuxInt)
9646 sym1 := auxToSym(v.Aux)
9647 if v_0.Op != OpS390XMOVDaddr {
9648 break
9649 }
9650 t := v_0.Type
9651 off2 := auxIntToInt32(v_0.AuxInt)
9652 sym2 := auxToSym(v_0.Aux)
9653 base := v_0.Args[0]
9654 mem := v_1
9655 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) {
9656 break
9657 }
9658 v.reset(OpS390XMOVHload)
9659 v.AuxInt = int32ToAuxInt(off1 + off2)
9660 v.Aux = symToAux(mergeSym(sym1, sym2))
9661 v.AddArg2(base, mem)
9662 return true
9663 }
9664 return false
9665 }
9666 func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool {
9667 v_0 := v.Args[0]
9668 b := v.Block
9669 typ := &b.Func.Config.Types
9670 // match: (MOVHreg e:(MOVBreg x))
9671 // cond: clobberIfDead(e)
9672 // result: (MOVBreg x)
9673 for {
9674 e := v_0
9675 if e.Op != OpS390XMOVBreg {
9676 break
9677 }
9678 x := e.Args[0]
9679 if !(clobberIfDead(e)) {
9680 break
9681 }
9682 v.reset(OpS390XMOVBreg)
9683 v.AddArg(x)
9684 return true
9685 }
9686 // match: (MOVHreg e:(MOVHreg x))
9687 // cond: clobberIfDead(e)
9688 // result: (MOVHreg x)
9689 for {
9690 e := v_0
9691 if e.Op != OpS390XMOVHreg {
9692 break
9693 }
9694 x := e.Args[0]
9695 if !(clobberIfDead(e)) {
9696 break
9697 }
9698 v.reset(OpS390XMOVHreg)
9699 v.AddArg(x)
9700 return true
9701 }
9702 // match: (MOVHreg e:(MOVWreg x))
9703 // cond: clobberIfDead(e)
9704 // result: (MOVHreg x)
9705 for {
9706 e := v_0
9707 if e.Op != OpS390XMOVWreg {
9708 break
9709 }
9710 x := e.Args[0]
9711 if !(clobberIfDead(e)) {
9712 break
9713 }
9714 v.reset(OpS390XMOVHreg)
9715 v.AddArg(x)
9716 return true
9717 }
9718 // match: (MOVHreg e:(MOVHZreg x))
9719 // cond: clobberIfDead(e)
9720 // result: (MOVHreg x)
9721 for {
9722 e := v_0
9723 if e.Op != OpS390XMOVHZreg {
9724 break
9725 }
9726 x := e.Args[0]
9727 if !(clobberIfDead(e)) {
9728 break
9729 }
9730 v.reset(OpS390XMOVHreg)
9731 v.AddArg(x)
9732 return true
9733 }
9734 // match: (MOVHreg e:(MOVWZreg x))
9735 // cond: clobberIfDead(e)
9736 // result: (MOVHreg x)
9737 for {
9738 e := v_0
9739 if e.Op != OpS390XMOVWZreg {
9740 break
9741 }
9742 x := e.Args[0]
9743 if !(clobberIfDead(e)) {
9744 break
9745 }
9746 v.reset(OpS390XMOVHreg)
9747 v.AddArg(x)
9748 return true
9749 }
9750 // match: (MOVHreg x:(MOVBload _ _))
9751 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
9752 // result: x
9753 for {
9754 x := v_0
9755 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
9756 break
9757 }
9758 v.copyOf(x)
9759 return true
9760 }
9761 // match: (MOVHreg x:(MOVHload _ _))
9762 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
9763 // result: x
9764 for {
9765 x := v_0
9766 if x.Op != OpS390XMOVHload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
9767 break
9768 }
9769 v.copyOf(x)
9770 return true
9771 }
9772 // match: (MOVHreg x:(MOVBZload _ _))
9773 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
9774 // result: x
9775 for {
9776 x := v_0
9777 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
9778 break
9779 }
9780 v.copyOf(x)
9781 return true
9782 }
9783 // match: (MOVHreg <t> x:(MOVHZload [o] {s} p mem))
9784 // cond: x.Uses == 1 && clobber(x)
9785 // result: @x.Block (MOVHload <t> [o] {s} p mem)
9786 for {
9787 t := v.Type
9788 x := v_0
9789 if x.Op != OpS390XMOVHZload {
9790 break
9791 }
9792 o := auxIntToInt32(x.AuxInt)
9793 s := auxToSym(x.Aux)
9794 mem := x.Args[1]
9795 p := x.Args[0]
9796 if !(x.Uses == 1 && clobber(x)) {
9797 break
9798 }
9799 b = x.Block
9800 v0 := b.NewValue0(x.Pos, OpS390XMOVHload, t)
9801 v.copyOf(v0)
9802 v0.AuxInt = int32ToAuxInt(o)
9803 v0.Aux = symToAux(s)
9804 v0.AddArg2(p, mem)
9805 return true
9806 }
9807 // match: (MOVHreg x:(Arg <t>))
9808 // cond: t.IsSigned() && t.Size() <= 2
9809 // result: x
9810 for {
9811 x := v_0
9812 if x.Op != OpArg {
9813 break
9814 }
9815 t := x.Type
9816 if !(t.IsSigned() && t.Size() <= 2) {
9817 break
9818 }
9819 v.copyOf(x)
9820 return true
9821 }
9822 // match: (MOVHreg (MOVDconst [c]))
9823 // result: (MOVDconst [int64(int16(c))])
9824 for {
9825 if v_0.Op != OpS390XMOVDconst {
9826 break
9827 }
9828 c := auxIntToInt64(v_0.AuxInt)
9829 v.reset(OpS390XMOVDconst)
9830 v.AuxInt = int64ToAuxInt(int64(int16(c)))
9831 return true
9832 }
9833 // match: (MOVHreg (ANDWconst [m] x))
9834 // cond: int16(m) >= 0
9835 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x))
9836 for {
9837 if v_0.Op != OpS390XANDWconst {
9838 break
9839 }
9840 m := auxIntToInt32(v_0.AuxInt)
9841 x := v_0.Args[0]
9842 if !(int16(m) >= 0) {
9843 break
9844 }
9845 v.reset(OpS390XMOVWZreg)
9846 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
9847 v0.AuxInt = int32ToAuxInt(int32(uint16(m)))
9848 v0.AddArg(x)
9849 v.AddArg(v0)
9850 return true
9851 }
9852 return false
9853 }
9854 func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool {
9855 v_2 := v.Args[2]
9856 v_1 := v.Args[1]
9857 v_0 := v.Args[0]
9858 // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem)
9859 // result: (MOVHstore [off] {sym} ptr x mem)
9860 for {
9861 off := auxIntToInt32(v.AuxInt)
9862 sym := auxToSym(v.Aux)
9863 ptr := v_0
9864 if v_1.Op != OpS390XMOVHreg {
9865 break
9866 }
9867 x := v_1.Args[0]
9868 mem := v_2
9869 v.reset(OpS390XMOVHstore)
9870 v.AuxInt = int32ToAuxInt(off)
9871 v.Aux = symToAux(sym)
9872 v.AddArg3(ptr, x, mem)
9873 return true
9874 }
9875 // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem)
9876 // result: (MOVHstore [off] {sym} ptr x mem)
9877 for {
9878 off := auxIntToInt32(v.AuxInt)
9879 sym := auxToSym(v.Aux)
9880 ptr := v_0
9881 if v_1.Op != OpS390XMOVHZreg {
9882 break
9883 }
9884 x := v_1.Args[0]
9885 mem := v_2
9886 v.reset(OpS390XMOVHstore)
9887 v.AuxInt = int32ToAuxInt(off)
9888 v.Aux = symToAux(sym)
9889 v.AddArg3(ptr, x, mem)
9890 return true
9891 }
9892 // match: (MOVHstore [off1] {sym} (ADDconst [off2] ptr) val mem)
9893 // cond: is20Bit(int64(off1)+int64(off2))
9894 // result: (MOVHstore [off1+off2] {sym} ptr val mem)
9895 for {
9896 off1 := auxIntToInt32(v.AuxInt)
9897 sym := auxToSym(v.Aux)
9898 if v_0.Op != OpS390XADDconst {
9899 break
9900 }
9901 off2 := auxIntToInt32(v_0.AuxInt)
9902 ptr := v_0.Args[0]
9903 val := v_1
9904 mem := v_2
9905 if !(is20Bit(int64(off1) + int64(off2))) {
9906 break
9907 }
9908 v.reset(OpS390XMOVHstore)
9909 v.AuxInt = int32ToAuxInt(off1 + off2)
9910 v.Aux = symToAux(sym)
9911 v.AddArg3(ptr, val, mem)
9912 return true
9913 }
9914 // match: (MOVHstore [off] {sym} ptr (MOVDconst [c]) mem)
9915 // cond: isU12Bit(int64(off)) && ptr.Op != OpSB
9916 // result: (MOVHstoreconst [makeValAndOff(int32(int16(c)),off)] {sym} ptr mem)
9917 for {
9918 off := auxIntToInt32(v.AuxInt)
9919 sym := auxToSym(v.Aux)
9920 ptr := v_0
9921 if v_1.Op != OpS390XMOVDconst {
9922 break
9923 }
9924 c := auxIntToInt64(v_1.AuxInt)
9925 mem := v_2
9926 if !(isU12Bit(int64(off)) && ptr.Op != OpSB) {
9927 break
9928 }
9929 v.reset(OpS390XMOVHstoreconst)
9930 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int16(c)), off))
9931 v.Aux = symToAux(sym)
9932 v.AddArg2(ptr, mem)
9933 return true
9934 }
9935 // match: (MOVHstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem)
9936 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))
9937 // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
9938 for {
9939 off1 := auxIntToInt32(v.AuxInt)
9940 sym1 := auxToSym(v.Aux)
9941 if v_0.Op != OpS390XMOVDaddr {
9942 break
9943 }
9944 t := v_0.Type
9945 off2 := auxIntToInt32(v_0.AuxInt)
9946 sym2 := auxToSym(v_0.Aux)
9947 base := v_0.Args[0]
9948 val := v_1
9949 mem := v_2
9950 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) {
9951 break
9952 }
9953 v.reset(OpS390XMOVHstore)
9954 v.AuxInt = int32ToAuxInt(off1 + off2)
9955 v.Aux = symToAux(mergeSym(sym1, sym2))
9956 v.AddArg3(base, val, mem)
9957 return true
9958 }
9959 // match: (MOVHstore [off] {sym} ptr (Bswap16 val) mem)
9960 // result: (MOVHBRstore [off] {sym} ptr val mem)
9961 for {
9962 off := auxIntToInt32(v.AuxInt)
9963 sym := auxToSym(v.Aux)
9964 ptr := v_0
9965 if v_1.Op != OpBswap16 {
9966 break
9967 }
9968 val := v_1.Args[0]
9969 mem := v_2
9970 v.reset(OpS390XMOVHBRstore)
9971 v.AuxInt = int32ToAuxInt(off)
9972 v.Aux = symToAux(sym)
9973 v.AddArg3(ptr, val, mem)
9974 return true
9975 }
9976 return false
9977 }
9978 func rewriteValueS390X_OpS390XMOVHstoreconst(v *Value) bool {
9979 v_1 := v.Args[1]
9980 v_0 := v.Args[0]
9981 // match: (MOVHstoreconst [sc] {s} (ADDconst [off] ptr) mem)
9982 // cond: isU12Bit(sc.Off64()+int64(off))
9983 // result: (MOVHstoreconst [sc.addOffset32(off)] {s} ptr mem)
9984 for {
9985 sc := auxIntToValAndOff(v.AuxInt)
9986 s := auxToSym(v.Aux)
9987 if v_0.Op != OpS390XADDconst {
9988 break
9989 }
9990 off := auxIntToInt32(v_0.AuxInt)
9991 ptr := v_0.Args[0]
9992 mem := v_1
9993 if !(isU12Bit(sc.Off64() + int64(off))) {
9994 break
9995 }
9996 v.reset(OpS390XMOVHstoreconst)
9997 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
9998 v.Aux = symToAux(s)
9999 v.AddArg2(ptr, mem)
10000 return true
10001 }
10002 // match: (MOVHstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem)
10003 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)
10004 // result: (MOVHstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
10005 for {
10006 sc := auxIntToValAndOff(v.AuxInt)
10007 sym1 := auxToSym(v.Aux)
10008 if v_0.Op != OpS390XMOVDaddr {
10009 break
10010 }
10011 off := auxIntToInt32(v_0.AuxInt)
10012 sym2 := auxToSym(v_0.Aux)
10013 ptr := v_0.Args[0]
10014 mem := v_1
10015 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) {
10016 break
10017 }
10018 v.reset(OpS390XMOVHstoreconst)
10019 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
10020 v.Aux = symToAux(mergeSym(sym1, sym2))
10021 v.AddArg2(ptr, mem)
10022 return true
10023 }
10024 return false
10025 }
10026 func rewriteValueS390X_OpS390XMOVHstoreidx(v *Value) bool {
10027 v_3 := v.Args[3]
10028 v_2 := v.Args[2]
10029 v_1 := v.Args[1]
10030 v_0 := v.Args[0]
10031 // match: (MOVHstoreidx [off] {sym} ptr idx (Bswap16 val) mem)
10032 // result: (MOVHBRstoreidx [off] {sym} ptr idx val mem)
10033 for {
10034 off := auxIntToInt32(v.AuxInt)
10035 sym := auxToSym(v.Aux)
10036 ptr := v_0
10037 idx := v_1
10038 if v_2.Op != OpBswap16 {
10039 break
10040 }
10041 val := v_2.Args[0]
10042 mem := v_3
10043 v.reset(OpS390XMOVHBRstoreidx)
10044 v.AuxInt = int32ToAuxInt(off)
10045 v.Aux = symToAux(sym)
10046 v.AddArg4(ptr, idx, val, mem)
10047 return true
10048 }
10049 return false
10050 }
10051 func rewriteValueS390X_OpS390XMOVWBR(v *Value) bool {
10052 v_0 := v.Args[0]
10053 b := v.Block
10054 typ := &b.Func.Config.Types
10055 // match: (MOVWBR x:(MOVWZload [off] {sym} ptr mem))
10056 // cond: x.Uses == 1
10057 // result: @x.Block (MOVWZreg (MOVWBRload [off] {sym} ptr mem))
10058 for {
10059 x := v_0
10060 if x.Op != OpS390XMOVWZload {
10061 break
10062 }
10063 off := auxIntToInt32(x.AuxInt)
10064 sym := auxToSym(x.Aux)
10065 mem := x.Args[1]
10066 ptr := x.Args[0]
10067 if !(x.Uses == 1) {
10068 break
10069 }
10070 b = x.Block
10071 v0 := b.NewValue0(x.Pos, OpS390XMOVWZreg, typ.UInt64)
10072 v.copyOf(v0)
10073 v1 := b.NewValue0(x.Pos, OpS390XMOVWBRload, typ.UInt32)
10074 v1.AuxInt = int32ToAuxInt(off)
10075 v1.Aux = symToAux(sym)
10076 v1.AddArg2(ptr, mem)
10077 v0.AddArg(v1)
10078 return true
10079 }
10080 // match: (MOVWBR x:(MOVWZloadidx [off] {sym} ptr idx mem))
10081 // cond: x.Uses == 1
10082 // result: @x.Block (MOVWZreg (MOVWBRloadidx [off] {sym} ptr idx mem))
10083 for {
10084 x := v_0
10085 if x.Op != OpS390XMOVWZloadidx {
10086 break
10087 }
10088 off := auxIntToInt32(x.AuxInt)
10089 sym := auxToSym(x.Aux)
10090 mem := x.Args[2]
10091 ptr := x.Args[0]
10092 idx := x.Args[1]
10093 if !(x.Uses == 1) {
10094 break
10095 }
10096 b = x.Block
10097 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64)
10098 v.copyOf(v0)
10099 v1 := b.NewValue0(v.Pos, OpS390XMOVWBRloadidx, typ.Int32)
10100 v1.AuxInt = int32ToAuxInt(off)
10101 v1.Aux = symToAux(sym)
10102 v1.AddArg3(ptr, idx, mem)
10103 v0.AddArg(v1)
10104 return true
10105 }
10106 return false
10107 }
10108 func rewriteValueS390X_OpS390XMOVWZload(v *Value) bool {
10109 v_1 := v.Args[1]
10110 v_0 := v.Args[0]
10111 // match: (MOVWZload [off] {sym} ptr1 (MOVWstore [off] {sym} ptr2 x _))
10112 // cond: isSamePtr(ptr1, ptr2)
10113 // result: (MOVWZreg x)
10114 for {
10115 off := auxIntToInt32(v.AuxInt)
10116 sym := auxToSym(v.Aux)
10117 ptr1 := v_0
10118 if v_1.Op != OpS390XMOVWstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
10119 break
10120 }
10121 x := v_1.Args[1]
10122 ptr2 := v_1.Args[0]
10123 if !(isSamePtr(ptr1, ptr2)) {
10124 break
10125 }
10126 v.reset(OpS390XMOVWZreg)
10127 v.AddArg(x)
10128 return true
10129 }
10130 // match: (MOVWZload [off1] {sym} (ADDconst [off2] ptr) mem)
10131 // cond: is20Bit(int64(off1)+int64(off2))
10132 // result: (MOVWZload [off1+off2] {sym} ptr mem)
10133 for {
10134 off1 := auxIntToInt32(v.AuxInt)
10135 sym := auxToSym(v.Aux)
10136 if v_0.Op != OpS390XADDconst {
10137 break
10138 }
10139 off2 := auxIntToInt32(v_0.AuxInt)
10140 ptr := v_0.Args[0]
10141 mem := v_1
10142 if !(is20Bit(int64(off1) + int64(off2))) {
10143 break
10144 }
10145 v.reset(OpS390XMOVWZload)
10146 v.AuxInt = int32ToAuxInt(off1 + off2)
10147 v.Aux = symToAux(sym)
10148 v.AddArg2(ptr, mem)
10149 return true
10150 }
10151 // match: (MOVWZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
10152 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))
10153 // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} base mem)
10154 for {
10155 off1 := auxIntToInt32(v.AuxInt)
10156 sym1 := auxToSym(v.Aux)
10157 if v_0.Op != OpS390XMOVDaddr {
10158 break
10159 }
10160 t := v_0.Type
10161 off2 := auxIntToInt32(v_0.AuxInt)
10162 sym2 := auxToSym(v_0.Aux)
10163 base := v_0.Args[0]
10164 mem := v_1
10165 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) {
10166 break
10167 }
10168 v.reset(OpS390XMOVWZload)
10169 v.AuxInt = int32ToAuxInt(off1 + off2)
10170 v.Aux = symToAux(mergeSym(sym1, sym2))
10171 v.AddArg2(base, mem)
10172 return true
10173 }
10174 return false
10175 }
10176 func rewriteValueS390X_OpS390XMOVWZreg(v *Value) bool {
10177 v_0 := v.Args[0]
10178 b := v.Block
10179 // match: (MOVWZreg e:(MOVBZreg x))
10180 // cond: clobberIfDead(e)
10181 // result: (MOVBZreg x)
10182 for {
10183 e := v_0
10184 if e.Op != OpS390XMOVBZreg {
10185 break
10186 }
10187 x := e.Args[0]
10188 if !(clobberIfDead(e)) {
10189 break
10190 }
10191 v.reset(OpS390XMOVBZreg)
10192 v.AddArg(x)
10193 return true
10194 }
10195 // match: (MOVWZreg e:(MOVHZreg x))
10196 // cond: clobberIfDead(e)
10197 // result: (MOVHZreg x)
10198 for {
10199 e := v_0
10200 if e.Op != OpS390XMOVHZreg {
10201 break
10202 }
10203 x := e.Args[0]
10204 if !(clobberIfDead(e)) {
10205 break
10206 }
10207 v.reset(OpS390XMOVHZreg)
10208 v.AddArg(x)
10209 return true
10210 }
10211 // match: (MOVWZreg e:(MOVWreg x))
10212 // cond: clobberIfDead(e)
10213 // result: (MOVWZreg x)
10214 for {
10215 e := v_0
10216 if e.Op != OpS390XMOVWreg {
10217 break
10218 }
10219 x := e.Args[0]
10220 if !(clobberIfDead(e)) {
10221 break
10222 }
10223 v.reset(OpS390XMOVWZreg)
10224 v.AddArg(x)
10225 return true
10226 }
10227 // match: (MOVWZreg e:(MOVWZreg x))
10228 // cond: clobberIfDead(e)
10229 // result: (MOVWZreg x)
10230 for {
10231 e := v_0
10232 if e.Op != OpS390XMOVWZreg {
10233 break
10234 }
10235 x := e.Args[0]
10236 if !(clobberIfDead(e)) {
10237 break
10238 }
10239 v.reset(OpS390XMOVWZreg)
10240 v.AddArg(x)
10241 return true
10242 }
10243 // match: (MOVWZreg x:(MOVBZload _ _))
10244 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
10245 // result: x
10246 for {
10247 x := v_0
10248 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
10249 break
10250 }
10251 v.copyOf(x)
10252 return true
10253 }
10254 // match: (MOVWZreg x:(MOVHZload _ _))
10255 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2)
10256 // result: x
10257 for {
10258 x := v_0
10259 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) {
10260 break
10261 }
10262 v.copyOf(x)
10263 return true
10264 }
10265 // match: (MOVWZreg x:(MOVWZload _ _))
10266 // cond: (!x.Type.IsSigned() || x.Type.Size() > 4)
10267 // result: x
10268 for {
10269 x := v_0
10270 if x.Op != OpS390XMOVWZload || !(!x.Type.IsSigned() || x.Type.Size() > 4) {
10271 break
10272 }
10273 v.copyOf(x)
10274 return true
10275 }
10276 // match: (MOVWZreg <t> x:(MOVWload [o] {s} p mem))
10277 // cond: x.Uses == 1 && clobber(x)
10278 // result: @x.Block (MOVWZload <t> [o] {s} p mem)
10279 for {
10280 t := v.Type
10281 x := v_0
10282 if x.Op != OpS390XMOVWload {
10283 break
10284 }
10285 o := auxIntToInt32(x.AuxInt)
10286 s := auxToSym(x.Aux)
10287 mem := x.Args[1]
10288 p := x.Args[0]
10289 if !(x.Uses == 1 && clobber(x)) {
10290 break
10291 }
10292 b = x.Block
10293 v0 := b.NewValue0(x.Pos, OpS390XMOVWZload, t)
10294 v.copyOf(v0)
10295 v0.AuxInt = int32ToAuxInt(o)
10296 v0.Aux = symToAux(s)
10297 v0.AddArg2(p, mem)
10298 return true
10299 }
10300 // match: (MOVWZreg x:(Arg <t>))
10301 // cond: !t.IsSigned() && t.Size() <= 4
10302 // result: x
10303 for {
10304 x := v_0
10305 if x.Op != OpArg {
10306 break
10307 }
10308 t := x.Type
10309 if !(!t.IsSigned() && t.Size() <= 4) {
10310 break
10311 }
10312 v.copyOf(x)
10313 return true
10314 }
10315 // match: (MOVWZreg (MOVDconst [c]))
10316 // result: (MOVDconst [int64(uint32(c))])
10317 for {
10318 if v_0.Op != OpS390XMOVDconst {
10319 break
10320 }
10321 c := auxIntToInt64(v_0.AuxInt)
10322 v.reset(OpS390XMOVDconst)
10323 v.AuxInt = int64ToAuxInt(int64(uint32(c)))
10324 return true
10325 }
10326 // match: (MOVWZreg (RISBGZ x {r}))
10327 // cond: r.OutMerge(0xffffffff) != nil
10328 // result: (RISBGZ x {*r.OutMerge(0xffffffff)})
10329 for {
10330 if v_0.Op != OpS390XRISBGZ {
10331 break
10332 }
10333 r := auxToS390xRotateParams(v_0.Aux)
10334 x := v_0.Args[0]
10335 if !(r.OutMerge(0xffffffff) != nil) {
10336 break
10337 }
10338 v.reset(OpS390XRISBGZ)
10339 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0xffffffff))
10340 v.AddArg(x)
10341 return true
10342 }
10343 return false
10344 }
10345 func rewriteValueS390X_OpS390XMOVWload(v *Value) bool {
10346 v_1 := v.Args[1]
10347 v_0 := v.Args[0]
10348 // match: (MOVWload [off] {sym} ptr1 (MOVWstore [off] {sym} ptr2 x _))
10349 // cond: isSamePtr(ptr1, ptr2)
10350 // result: (MOVWreg x)
10351 for {
10352 off := auxIntToInt32(v.AuxInt)
10353 sym := auxToSym(v.Aux)
10354 ptr1 := v_0
10355 if v_1.Op != OpS390XMOVWstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
10356 break
10357 }
10358 x := v_1.Args[1]
10359 ptr2 := v_1.Args[0]
10360 if !(isSamePtr(ptr1, ptr2)) {
10361 break
10362 }
10363 v.reset(OpS390XMOVWreg)
10364 v.AddArg(x)
10365 return true
10366 }
10367 // match: (MOVWload [off1] {sym} (ADDconst [off2] ptr) mem)
10368 // cond: is20Bit(int64(off1)+int64(off2))
10369 // result: (MOVWload [off1+off2] {sym} ptr mem)
10370 for {
10371 off1 := auxIntToInt32(v.AuxInt)
10372 sym := auxToSym(v.Aux)
10373 if v_0.Op != OpS390XADDconst {
10374 break
10375 }
10376 off2 := auxIntToInt32(v_0.AuxInt)
10377 ptr := v_0.Args[0]
10378 mem := v_1
10379 if !(is20Bit(int64(off1) + int64(off2))) {
10380 break
10381 }
10382 v.reset(OpS390XMOVWload)
10383 v.AuxInt = int32ToAuxInt(off1 + off2)
10384 v.Aux = symToAux(sym)
10385 v.AddArg2(ptr, mem)
10386 return true
10387 }
10388 // match: (MOVWload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem)
10389 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))
10390 // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem)
10391 for {
10392 off1 := auxIntToInt32(v.AuxInt)
10393 sym1 := auxToSym(v.Aux)
10394 if v_0.Op != OpS390XMOVDaddr {
10395 break
10396 }
10397 t := v_0.Type
10398 off2 := auxIntToInt32(v_0.AuxInt)
10399 sym2 := auxToSym(v_0.Aux)
10400 base := v_0.Args[0]
10401 mem := v_1
10402 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) {
10403 break
10404 }
10405 v.reset(OpS390XMOVWload)
10406 v.AuxInt = int32ToAuxInt(off1 + off2)
10407 v.Aux = symToAux(mergeSym(sym1, sym2))
10408 v.AddArg2(base, mem)
10409 return true
10410 }
10411 return false
10412 }
10413 func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool {
10414 v_0 := v.Args[0]
10415 b := v.Block
10416 // match: (MOVWreg e:(MOVBreg x))
10417 // cond: clobberIfDead(e)
10418 // result: (MOVBreg x)
10419 for {
10420 e := v_0
10421 if e.Op != OpS390XMOVBreg {
10422 break
10423 }
10424 x := e.Args[0]
10425 if !(clobberIfDead(e)) {
10426 break
10427 }
10428 v.reset(OpS390XMOVBreg)
10429 v.AddArg(x)
10430 return true
10431 }
10432 // match: (MOVWreg e:(MOVHreg x))
10433 // cond: clobberIfDead(e)
10434 // result: (MOVHreg x)
10435 for {
10436 e := v_0
10437 if e.Op != OpS390XMOVHreg {
10438 break
10439 }
10440 x := e.Args[0]
10441 if !(clobberIfDead(e)) {
10442 break
10443 }
10444 v.reset(OpS390XMOVHreg)
10445 v.AddArg(x)
10446 return true
10447 }
10448 // match: (MOVWreg e:(MOVWreg x))
10449 // cond: clobberIfDead(e)
10450 // result: (MOVWreg x)
10451 for {
10452 e := v_0
10453 if e.Op != OpS390XMOVWreg {
10454 break
10455 }
10456 x := e.Args[0]
10457 if !(clobberIfDead(e)) {
10458 break
10459 }
10460 v.reset(OpS390XMOVWreg)
10461 v.AddArg(x)
10462 return true
10463 }
10464 // match: (MOVWreg e:(MOVWZreg x))
10465 // cond: clobberIfDead(e)
10466 // result: (MOVWreg x)
10467 for {
10468 e := v_0
10469 if e.Op != OpS390XMOVWZreg {
10470 break
10471 }
10472 x := e.Args[0]
10473 if !(clobberIfDead(e)) {
10474 break
10475 }
10476 v.reset(OpS390XMOVWreg)
10477 v.AddArg(x)
10478 return true
10479 }
10480 // match: (MOVWreg x:(MOVBload _ _))
10481 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
10482 // result: x
10483 for {
10484 x := v_0
10485 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
10486 break
10487 }
10488 v.copyOf(x)
10489 return true
10490 }
10491 // match: (MOVWreg x:(MOVHload _ _))
10492 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
10493 // result: x
10494 for {
10495 x := v_0
10496 if x.Op != OpS390XMOVHload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
10497 break
10498 }
10499 v.copyOf(x)
10500 return true
10501 }
10502 // match: (MOVWreg x:(MOVWload _ _))
10503 // cond: (x.Type.IsSigned() || x.Type.Size() == 8)
10504 // result: x
10505 for {
10506 x := v_0
10507 if x.Op != OpS390XMOVWload || !(x.Type.IsSigned() || x.Type.Size() == 8) {
10508 break
10509 }
10510 v.copyOf(x)
10511 return true
10512 }
10513 // match: (MOVWreg x:(MOVBZload _ _))
10514 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1)
10515 // result: x
10516 for {
10517 x := v_0
10518 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) {
10519 break
10520 }
10521 v.copyOf(x)
10522 return true
10523 }
10524 // match: (MOVWreg x:(MOVHZload _ _))
10525 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2)
10526 // result: x
10527 for {
10528 x := v_0
10529 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) {
10530 break
10531 }
10532 v.copyOf(x)
10533 return true
10534 }
10535 // match: (MOVWreg <t> x:(MOVWZload [o] {s} p mem))
10536 // cond: x.Uses == 1 && clobber(x)
10537 // result: @x.Block (MOVWload <t> [o] {s} p mem)
10538 for {
10539 t := v.Type
10540 x := v_0
10541 if x.Op != OpS390XMOVWZload {
10542 break
10543 }
10544 o := auxIntToInt32(x.AuxInt)
10545 s := auxToSym(x.Aux)
10546 mem := x.Args[1]
10547 p := x.Args[0]
10548 if !(x.Uses == 1 && clobber(x)) {
10549 break
10550 }
10551 b = x.Block
10552 v0 := b.NewValue0(x.Pos, OpS390XMOVWload, t)
10553 v.copyOf(v0)
10554 v0.AuxInt = int32ToAuxInt(o)
10555 v0.Aux = symToAux(s)
10556 v0.AddArg2(p, mem)
10557 return true
10558 }
10559 // match: (MOVWreg x:(Arg <t>))
10560 // cond: t.IsSigned() && t.Size() <= 4
10561 // result: x
10562 for {
10563 x := v_0
10564 if x.Op != OpArg {
10565 break
10566 }
10567 t := x.Type
10568 if !(t.IsSigned() && t.Size() <= 4) {
10569 break
10570 }
10571 v.copyOf(x)
10572 return true
10573 }
10574 // match: (MOVWreg (MOVDconst [c]))
10575 // result: (MOVDconst [int64(int32(c))])
10576 for {
10577 if v_0.Op != OpS390XMOVDconst {
10578 break
10579 }
10580 c := auxIntToInt64(v_0.AuxInt)
10581 v.reset(OpS390XMOVDconst)
10582 v.AuxInt = int64ToAuxInt(int64(int32(c)))
10583 return true
10584 }
10585 return false
10586 }
10587 func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool {
10588 v_2 := v.Args[2]
10589 v_1 := v.Args[1]
10590 v_0 := v.Args[0]
10591 // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem)
10592 // result: (MOVWstore [off] {sym} ptr x mem)
10593 for {
10594 off := auxIntToInt32(v.AuxInt)
10595 sym := auxToSym(v.Aux)
10596 ptr := v_0
10597 if v_1.Op != OpS390XMOVWreg {
10598 break
10599 }
10600 x := v_1.Args[0]
10601 mem := v_2
10602 v.reset(OpS390XMOVWstore)
10603 v.AuxInt = int32ToAuxInt(off)
10604 v.Aux = symToAux(sym)
10605 v.AddArg3(ptr, x, mem)
10606 return true
10607 }
10608 // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem)
10609 // result: (MOVWstore [off] {sym} ptr x mem)
10610 for {
10611 off := auxIntToInt32(v.AuxInt)
10612 sym := auxToSym(v.Aux)
10613 ptr := v_0
10614 if v_1.Op != OpS390XMOVWZreg {
10615 break
10616 }
10617 x := v_1.Args[0]
10618 mem := v_2
10619 v.reset(OpS390XMOVWstore)
10620 v.AuxInt = int32ToAuxInt(off)
10621 v.Aux = symToAux(sym)
10622 v.AddArg3(ptr, x, mem)
10623 return true
10624 }
10625 // match: (MOVWstore [off1] {sym} (ADDconst [off2] ptr) val mem)
10626 // cond: is20Bit(int64(off1)+int64(off2))
10627 // result: (MOVWstore [off1+off2] {sym} ptr val mem)
10628 for {
10629 off1 := auxIntToInt32(v.AuxInt)
10630 sym := auxToSym(v.Aux)
10631 if v_0.Op != OpS390XADDconst {
10632 break
10633 }
10634 off2 := auxIntToInt32(v_0.AuxInt)
10635 ptr := v_0.Args[0]
10636 val := v_1
10637 mem := v_2
10638 if !(is20Bit(int64(off1) + int64(off2))) {
10639 break
10640 }
10641 v.reset(OpS390XMOVWstore)
10642 v.AuxInt = int32ToAuxInt(off1 + off2)
10643 v.Aux = symToAux(sym)
10644 v.AddArg3(ptr, val, mem)
10645 return true
10646 }
10647 // match: (MOVWstore [off] {sym} ptr (MOVDconst [c]) mem)
10648 // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB
10649 // result: (MOVWstoreconst [makeValAndOff(int32(c),off)] {sym} ptr mem)
10650 for {
10651 off := auxIntToInt32(v.AuxInt)
10652 sym := auxToSym(v.Aux)
10653 ptr := v_0
10654 if v_1.Op != OpS390XMOVDconst {
10655 break
10656 }
10657 c := auxIntToInt64(v_1.AuxInt)
10658 mem := v_2
10659 if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) {
10660 break
10661 }
10662 v.reset(OpS390XMOVWstoreconst)
10663 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
10664 v.Aux = symToAux(sym)
10665 v.AddArg2(ptr, mem)
10666 return true
10667 }
10668 // match: (MOVWstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem)
10669 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))
10670 // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
10671 for {
10672 off1 := auxIntToInt32(v.AuxInt)
10673 sym1 := auxToSym(v.Aux)
10674 if v_0.Op != OpS390XMOVDaddr {
10675 break
10676 }
10677 t := v_0.Type
10678 off2 := auxIntToInt32(v_0.AuxInt)
10679 sym2 := auxToSym(v_0.Aux)
10680 base := v_0.Args[0]
10681 val := v_1
10682 mem := v_2
10683 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) {
10684 break
10685 }
10686 v.reset(OpS390XMOVWstore)
10687 v.AuxInt = int32ToAuxInt(off1 + off2)
10688 v.Aux = symToAux(mergeSym(sym1, sym2))
10689 v.AddArg3(base, val, mem)
10690 return true
10691 }
10692 // match: (MOVWstore [i] {s} p w1 x:(MOVWstore [i-4] {s} p w0 mem))
10693 // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && setPos(v, x.Pos) && clobber(x)
10694 // result: (STM2 [i-4] {s} p w0 w1 mem)
10695 for {
10696 i := auxIntToInt32(v.AuxInt)
10697 s := auxToSym(v.Aux)
10698 p := v_0
10699 w1 := v_1
10700 x := v_2
10701 if x.Op != OpS390XMOVWstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s {
10702 break
10703 }
10704 mem := x.Args[2]
10705 if p != x.Args[0] {
10706 break
10707 }
10708 w0 := x.Args[1]
10709 if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && setPos(v, x.Pos) && clobber(x)) {
10710 break
10711 }
10712 v.reset(OpS390XSTM2)
10713 v.AuxInt = int32ToAuxInt(i - 4)
10714 v.Aux = symToAux(s)
10715 v.AddArg4(p, w0, w1, mem)
10716 return true
10717 }
10718 // match: (MOVWstore [i] {s} p w2 x:(STM2 [i-8] {s} p w0 w1 mem))
10719 // cond: x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)
10720 // result: (STM3 [i-8] {s} p w0 w1 w2 mem)
10721 for {
10722 i := auxIntToInt32(v.AuxInt)
10723 s := auxToSym(v.Aux)
10724 p := v_0
10725 w2 := v_1
10726 x := v_2
10727 if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s {
10728 break
10729 }
10730 mem := x.Args[3]
10731 if p != x.Args[0] {
10732 break
10733 }
10734 w0 := x.Args[1]
10735 w1 := x.Args[2]
10736 if !(x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)) {
10737 break
10738 }
10739 v.reset(OpS390XSTM3)
10740 v.AuxInt = int32ToAuxInt(i - 8)
10741 v.Aux = symToAux(s)
10742 v.AddArg5(p, w0, w1, w2, mem)
10743 return true
10744 }
10745 // match: (MOVWstore [i] {s} p w3 x:(STM3 [i-12] {s} p w0 w1 w2 mem))
10746 // cond: x.Uses == 1 && is20Bit(int64(i)-12) && setPos(v, x.Pos) && clobber(x)
10747 // result: (STM4 [i-12] {s} p w0 w1 w2 w3 mem)
10748 for {
10749 i := auxIntToInt32(v.AuxInt)
10750 s := auxToSym(v.Aux)
10751 p := v_0
10752 w3 := v_1
10753 x := v_2
10754 if x.Op != OpS390XSTM3 || auxIntToInt32(x.AuxInt) != i-12 || auxToSym(x.Aux) != s {
10755 break
10756 }
10757 mem := x.Args[4]
10758 if p != x.Args[0] {
10759 break
10760 }
10761 w0 := x.Args[1]
10762 w1 := x.Args[2]
10763 w2 := x.Args[3]
10764 if !(x.Uses == 1 && is20Bit(int64(i)-12) && setPos(v, x.Pos) && clobber(x)) {
10765 break
10766 }
10767 v.reset(OpS390XSTM4)
10768 v.AuxInt = int32ToAuxInt(i - 12)
10769 v.Aux = symToAux(s)
10770 v.AddArg6(p, w0, w1, w2, w3, mem)
10771 return true
10772 }
10773 // match: (MOVWstore [off] {sym} ptr r:(MOVWBR x) mem)
10774 // cond: r.Uses == 1
10775 // result: (MOVWBRstore [off] {sym} ptr x mem)
10776 for {
10777 off := auxIntToInt32(v.AuxInt)
10778 sym := auxToSym(v.Aux)
10779 ptr := v_0
10780 r := v_1
10781 if r.Op != OpS390XMOVWBR {
10782 break
10783 }
10784 x := r.Args[0]
10785 mem := v_2
10786 if !(r.Uses == 1) {
10787 break
10788 }
10789 v.reset(OpS390XMOVWBRstore)
10790 v.AuxInt = int32ToAuxInt(off)
10791 v.Aux = symToAux(sym)
10792 v.AddArg3(ptr, x, mem)
10793 return true
10794 }
10795 return false
10796 }
10797 func rewriteValueS390X_OpS390XMOVWstoreconst(v *Value) bool {
10798 v_1 := v.Args[1]
10799 v_0 := v.Args[0]
10800 // match: (MOVWstoreconst [sc] {s} (ADDconst [off] ptr) mem)
10801 // cond: isU12Bit(sc.Off64()+int64(off))
10802 // result: (MOVWstoreconst [sc.addOffset32(off)] {s} ptr mem)
10803 for {
10804 sc := auxIntToValAndOff(v.AuxInt)
10805 s := auxToSym(v.Aux)
10806 if v_0.Op != OpS390XADDconst {
10807 break
10808 }
10809 off := auxIntToInt32(v_0.AuxInt)
10810 ptr := v_0.Args[0]
10811 mem := v_1
10812 if !(isU12Bit(sc.Off64() + int64(off))) {
10813 break
10814 }
10815 v.reset(OpS390XMOVWstoreconst)
10816 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
10817 v.Aux = symToAux(s)
10818 v.AddArg2(ptr, mem)
10819 return true
10820 }
10821 // match: (MOVWstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem)
10822 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)
10823 // result: (MOVWstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
10824 for {
10825 sc := auxIntToValAndOff(v.AuxInt)
10826 sym1 := auxToSym(v.Aux)
10827 if v_0.Op != OpS390XMOVDaddr {
10828 break
10829 }
10830 off := auxIntToInt32(v_0.AuxInt)
10831 sym2 := auxToSym(v_0.Aux)
10832 ptr := v_0.Args[0]
10833 mem := v_1
10834 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) {
10835 break
10836 }
10837 v.reset(OpS390XMOVWstoreconst)
10838 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
10839 v.Aux = symToAux(mergeSym(sym1, sym2))
10840 v.AddArg2(ptr, mem)
10841 return true
10842 }
10843 return false
10844 }
10845 func rewriteValueS390X_OpS390XMOVWstoreidx(v *Value) bool {
10846 v_3 := v.Args[3]
10847 v_2 := v.Args[2]
10848 v_1 := v.Args[1]
10849 v_0 := v.Args[0]
10850 // match: (MOVWstoreidx [off] {sym} ptr idx r:(MOVWBR x) mem)
10851 // cond: r.Uses == 1
10852 // result: (MOVWBRstoreidx [off] {sym} ptr idx x mem)
10853 for {
10854 off := auxIntToInt32(v.AuxInt)
10855 sym := auxToSym(v.Aux)
10856 ptr := v_0
10857 idx := v_1
10858 r := v_2
10859 if r.Op != OpS390XMOVWBR {
10860 break
10861 }
10862 x := r.Args[0]
10863 mem := v_3
10864 if !(r.Uses == 1) {
10865 break
10866 }
10867 v.reset(OpS390XMOVWBRstoreidx)
10868 v.AuxInt = int32ToAuxInt(off)
10869 v.Aux = symToAux(sym)
10870 v.AddArg4(ptr, idx, x, mem)
10871 return true
10872 }
10873 return false
10874 }
10875 func rewriteValueS390X_OpS390XMULLD(v *Value) bool {
10876 v_1 := v.Args[1]
10877 v_0 := v.Args[0]
10878 // match: (MULLD x (MOVDconst [c]))
10879 // cond: is32Bit(c)
10880 // result: (MULLDconst [int32(c)] x)
10881 for {
10882 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10883 x := v_0
10884 if v_1.Op != OpS390XMOVDconst {
10885 continue
10886 }
10887 c := auxIntToInt64(v_1.AuxInt)
10888 if !(is32Bit(c)) {
10889 continue
10890 }
10891 v.reset(OpS390XMULLDconst)
10892 v.AuxInt = int32ToAuxInt(int32(c))
10893 v.AddArg(x)
10894 return true
10895 }
10896 break
10897 }
10898 // match: (MULLD <t> x g:(MOVDload [off] {sym} ptr mem))
10899 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
10900 // result: (MULLDload <t> [off] {sym} x ptr mem)
10901 for {
10902 t := v.Type
10903 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10904 x := v_0
10905 g := v_1
10906 if g.Op != OpS390XMOVDload {
10907 continue
10908 }
10909 off := auxIntToInt32(g.AuxInt)
10910 sym := auxToSym(g.Aux)
10911 mem := g.Args[1]
10912 ptr := g.Args[0]
10913 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
10914 continue
10915 }
10916 v.reset(OpS390XMULLDload)
10917 v.Type = t
10918 v.AuxInt = int32ToAuxInt(off)
10919 v.Aux = symToAux(sym)
10920 v.AddArg3(x, ptr, mem)
10921 return true
10922 }
10923 break
10924 }
10925 return false
10926 }
10927 func rewriteValueS390X_OpS390XMULLDconst(v *Value) bool {
10928 v_0 := v.Args[0]
10929 b := v.Block
10930 // match: (MULLDconst <t> x [c])
10931 // cond: isPowerOfTwo(c&(c-1))
10932 // result: (ADD (SLDconst <t> x [uint8(log32(c&(c-1)))]) (SLDconst <t> x [uint8(log32(c&^(c-1)))]))
10933 for {
10934 t := v.Type
10935 c := auxIntToInt32(v.AuxInt)
10936 x := v_0
10937 if !(isPowerOfTwo(c & (c - 1))) {
10938 break
10939 }
10940 v.reset(OpS390XADD)
10941 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
10942 v0.AuxInt = uint8ToAuxInt(uint8(log32(c & (c - 1))))
10943 v0.AddArg(x)
10944 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
10945 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1))))
10946 v1.AddArg(x)
10947 v.AddArg2(v0, v1)
10948 return true
10949 }
10950 // match: (MULLDconst <t> x [c])
10951 // cond: isPowerOfTwo(c+(c&^(c-1)))
10952 // result: (SUB (SLDconst <t> x [uint8(log32(c+(c&^(c-1))))]) (SLDconst <t> x [uint8(log32(c&^(c-1)))]))
10953 for {
10954 t := v.Type
10955 c := auxIntToInt32(v.AuxInt)
10956 x := v_0
10957 if !(isPowerOfTwo(c + (c &^ (c - 1)))) {
10958 break
10959 }
10960 v.reset(OpS390XSUB)
10961 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
10962 v0.AuxInt = uint8ToAuxInt(uint8(log32(c + (c &^ (c - 1)))))
10963 v0.AddArg(x)
10964 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
10965 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1))))
10966 v1.AddArg(x)
10967 v.AddArg2(v0, v1)
10968 return true
10969 }
10970 // match: (MULLDconst <t> x [c])
10971 // cond: isPowerOfTwo(-c+(-c&^(-c-1)))
10972 // result: (SUB (SLDconst <t> x [uint8(log32(-c&^(-c-1)))]) (SLDconst <t> x [uint8(log32(-c+(-c&^(-c-1))))]))
10973 for {
10974 t := v.Type
10975 c := auxIntToInt32(v.AuxInt)
10976 x := v_0
10977 if !(isPowerOfTwo(-c + (-c &^ (-c - 1)))) {
10978 break
10979 }
10980 v.reset(OpS390XSUB)
10981 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
10982 v0.AuxInt = uint8ToAuxInt(uint8(log32(-c &^ (-c - 1))))
10983 v0.AddArg(x)
10984 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t)
10985 v1.AuxInt = uint8ToAuxInt(uint8(log32(-c + (-c &^ (-c - 1)))))
10986 v1.AddArg(x)
10987 v.AddArg2(v0, v1)
10988 return true
10989 }
10990 // match: (MULLDconst [c] (MOVDconst [d]))
10991 // result: (MOVDconst [int64(c)*d])
10992 for {
10993 c := auxIntToInt32(v.AuxInt)
10994 if v_0.Op != OpS390XMOVDconst {
10995 break
10996 }
10997 d := auxIntToInt64(v_0.AuxInt)
10998 v.reset(OpS390XMOVDconst)
10999 v.AuxInt = int64ToAuxInt(int64(c) * d)
11000 return true
11001 }
11002 return false
11003 }
11004 func rewriteValueS390X_OpS390XMULLDload(v *Value) bool {
11005 v_2 := v.Args[2]
11006 v_1 := v.Args[1]
11007 v_0 := v.Args[0]
11008 b := v.Block
11009 // match: (MULLDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
11010 // cond: isSamePtr(ptr1, ptr2)
11011 // result: (MULLD x (LGDR <t> y))
11012 for {
11013 t := v.Type
11014 off := auxIntToInt32(v.AuxInt)
11015 sym := auxToSym(v.Aux)
11016 x := v_0
11017 ptr1 := v_1
11018 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
11019 break
11020 }
11021 y := v_2.Args[1]
11022 ptr2 := v_2.Args[0]
11023 if !(isSamePtr(ptr1, ptr2)) {
11024 break
11025 }
11026 v.reset(OpS390XMULLD)
11027 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
11028 v0.AddArg(y)
11029 v.AddArg2(x, v0)
11030 return true
11031 }
11032 // match: (MULLDload [off1] {sym} x (ADDconst [off2] ptr) mem)
11033 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
11034 // result: (MULLDload [off1+off2] {sym} x ptr mem)
11035 for {
11036 off1 := auxIntToInt32(v.AuxInt)
11037 sym := auxToSym(v.Aux)
11038 x := v_0
11039 if v_1.Op != OpS390XADDconst {
11040 break
11041 }
11042 off2 := auxIntToInt32(v_1.AuxInt)
11043 ptr := v_1.Args[0]
11044 mem := v_2
11045 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
11046 break
11047 }
11048 v.reset(OpS390XMULLDload)
11049 v.AuxInt = int32ToAuxInt(off1 + off2)
11050 v.Aux = symToAux(sym)
11051 v.AddArg3(x, ptr, mem)
11052 return true
11053 }
11054 // match: (MULLDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
11055 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
11056 // result: (MULLDload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
11057 for {
11058 o1 := auxIntToInt32(v.AuxInt)
11059 s1 := auxToSym(v.Aux)
11060 x := v_0
11061 if v_1.Op != OpS390XMOVDaddr {
11062 break
11063 }
11064 o2 := auxIntToInt32(v_1.AuxInt)
11065 s2 := auxToSym(v_1.Aux)
11066 ptr := v_1.Args[0]
11067 mem := v_2
11068 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
11069 break
11070 }
11071 v.reset(OpS390XMULLDload)
11072 v.AuxInt = int32ToAuxInt(o1 + o2)
11073 v.Aux = symToAux(mergeSym(s1, s2))
11074 v.AddArg3(x, ptr, mem)
11075 return true
11076 }
11077 return false
11078 }
11079 func rewriteValueS390X_OpS390XMULLW(v *Value) bool {
11080 v_1 := v.Args[1]
11081 v_0 := v.Args[0]
11082 // match: (MULLW x (MOVDconst [c]))
11083 // result: (MULLWconst [int32(c)] x)
11084 for {
11085 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11086 x := v_0
11087 if v_1.Op != OpS390XMOVDconst {
11088 continue
11089 }
11090 c := auxIntToInt64(v_1.AuxInt)
11091 v.reset(OpS390XMULLWconst)
11092 v.AuxInt = int32ToAuxInt(int32(c))
11093 v.AddArg(x)
11094 return true
11095 }
11096 break
11097 }
11098 // match: (MULLW <t> x g:(MOVWload [off] {sym} ptr mem))
11099 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11100 // result: (MULLWload <t> [off] {sym} x ptr mem)
11101 for {
11102 t := v.Type
11103 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11104 x := v_0
11105 g := v_1
11106 if g.Op != OpS390XMOVWload {
11107 continue
11108 }
11109 off := auxIntToInt32(g.AuxInt)
11110 sym := auxToSym(g.Aux)
11111 mem := g.Args[1]
11112 ptr := g.Args[0]
11113 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11114 continue
11115 }
11116 v.reset(OpS390XMULLWload)
11117 v.Type = t
11118 v.AuxInt = int32ToAuxInt(off)
11119 v.Aux = symToAux(sym)
11120 v.AddArg3(x, ptr, mem)
11121 return true
11122 }
11123 break
11124 }
11125 // match: (MULLW <t> x g:(MOVWZload [off] {sym} ptr mem))
11126 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11127 // result: (MULLWload <t> [off] {sym} x ptr mem)
11128 for {
11129 t := v.Type
11130 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11131 x := v_0
11132 g := v_1
11133 if g.Op != OpS390XMOVWZload {
11134 continue
11135 }
11136 off := auxIntToInt32(g.AuxInt)
11137 sym := auxToSym(g.Aux)
11138 mem := g.Args[1]
11139 ptr := g.Args[0]
11140 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11141 continue
11142 }
11143 v.reset(OpS390XMULLWload)
11144 v.Type = t
11145 v.AuxInt = int32ToAuxInt(off)
11146 v.Aux = symToAux(sym)
11147 v.AddArg3(x, ptr, mem)
11148 return true
11149 }
11150 break
11151 }
11152 return false
11153 }
11154 func rewriteValueS390X_OpS390XMULLWconst(v *Value) bool {
11155 v_0 := v.Args[0]
11156 b := v.Block
11157 // match: (MULLWconst <t> x [c])
11158 // cond: isPowerOfTwo(c&(c-1))
11159 // result: (ADDW (SLWconst <t> x [uint8(log32(c&(c-1)))]) (SLWconst <t> x [uint8(log32(c&^(c-1)))]))
11160 for {
11161 t := v.Type
11162 c := auxIntToInt32(v.AuxInt)
11163 x := v_0
11164 if !(isPowerOfTwo(c & (c - 1))) {
11165 break
11166 }
11167 v.reset(OpS390XADDW)
11168 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11169 v0.AuxInt = uint8ToAuxInt(uint8(log32(c & (c - 1))))
11170 v0.AddArg(x)
11171 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11172 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1))))
11173 v1.AddArg(x)
11174 v.AddArg2(v0, v1)
11175 return true
11176 }
11177 // match: (MULLWconst <t> x [c])
11178 // cond: isPowerOfTwo(c+(c&^(c-1)))
11179 // result: (SUBW (SLWconst <t> x [uint8(log32(c+(c&^(c-1))))]) (SLWconst <t> x [uint8(log32(c&^(c-1)))]))
11180 for {
11181 t := v.Type
11182 c := auxIntToInt32(v.AuxInt)
11183 x := v_0
11184 if !(isPowerOfTwo(c + (c &^ (c - 1)))) {
11185 break
11186 }
11187 v.reset(OpS390XSUBW)
11188 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11189 v0.AuxInt = uint8ToAuxInt(uint8(log32(c + (c &^ (c - 1)))))
11190 v0.AddArg(x)
11191 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11192 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1))))
11193 v1.AddArg(x)
11194 v.AddArg2(v0, v1)
11195 return true
11196 }
11197 // match: (MULLWconst <t> x [c])
11198 // cond: isPowerOfTwo(-c+(-c&^(-c-1)))
11199 // result: (SUBW (SLWconst <t> x [uint8(log32(-c&^(-c-1)))]) (SLWconst <t> x [uint8(log32(-c+(-c&^(-c-1))))]))
11200 for {
11201 t := v.Type
11202 c := auxIntToInt32(v.AuxInt)
11203 x := v_0
11204 if !(isPowerOfTwo(-c + (-c &^ (-c - 1)))) {
11205 break
11206 }
11207 v.reset(OpS390XSUBW)
11208 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11209 v0.AuxInt = uint8ToAuxInt(uint8(log32(-c &^ (-c - 1))))
11210 v0.AddArg(x)
11211 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t)
11212 v1.AuxInt = uint8ToAuxInt(uint8(log32(-c + (-c &^ (-c - 1)))))
11213 v1.AddArg(x)
11214 v.AddArg2(v0, v1)
11215 return true
11216 }
11217 // match: (MULLWconst [c] (MOVDconst [d]))
11218 // result: (MOVDconst [int64(c*int32(d))])
11219 for {
11220 c := auxIntToInt32(v.AuxInt)
11221 if v_0.Op != OpS390XMOVDconst {
11222 break
11223 }
11224 d := auxIntToInt64(v_0.AuxInt)
11225 v.reset(OpS390XMOVDconst)
11226 v.AuxInt = int64ToAuxInt(int64(c * int32(d)))
11227 return true
11228 }
11229 return false
11230 }
11231 func rewriteValueS390X_OpS390XMULLWload(v *Value) bool {
11232 v_2 := v.Args[2]
11233 v_1 := v.Args[1]
11234 v_0 := v.Args[0]
11235 // match: (MULLWload [off1] {sym} x (ADDconst [off2] ptr) mem)
11236 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
11237 // result: (MULLWload [off1+off2] {sym} x ptr mem)
11238 for {
11239 off1 := auxIntToInt32(v.AuxInt)
11240 sym := auxToSym(v.Aux)
11241 x := v_0
11242 if v_1.Op != OpS390XADDconst {
11243 break
11244 }
11245 off2 := auxIntToInt32(v_1.AuxInt)
11246 ptr := v_1.Args[0]
11247 mem := v_2
11248 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
11249 break
11250 }
11251 v.reset(OpS390XMULLWload)
11252 v.AuxInt = int32ToAuxInt(off1 + off2)
11253 v.Aux = symToAux(sym)
11254 v.AddArg3(x, ptr, mem)
11255 return true
11256 }
11257 // match: (MULLWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
11258 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
11259 // result: (MULLWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
11260 for {
11261 o1 := auxIntToInt32(v.AuxInt)
11262 s1 := auxToSym(v.Aux)
11263 x := v_0
11264 if v_1.Op != OpS390XMOVDaddr {
11265 break
11266 }
11267 o2 := auxIntToInt32(v_1.AuxInt)
11268 s2 := auxToSym(v_1.Aux)
11269 ptr := v_1.Args[0]
11270 mem := v_2
11271 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
11272 break
11273 }
11274 v.reset(OpS390XMULLWload)
11275 v.AuxInt = int32ToAuxInt(o1 + o2)
11276 v.Aux = symToAux(mergeSym(s1, s2))
11277 v.AddArg3(x, ptr, mem)
11278 return true
11279 }
11280 return false
11281 }
11282 func rewriteValueS390X_OpS390XNEG(v *Value) bool {
11283 v_0 := v.Args[0]
11284 // match: (NEG (MOVDconst [c]))
11285 // result: (MOVDconst [-c])
11286 for {
11287 if v_0.Op != OpS390XMOVDconst {
11288 break
11289 }
11290 c := auxIntToInt64(v_0.AuxInt)
11291 v.reset(OpS390XMOVDconst)
11292 v.AuxInt = int64ToAuxInt(-c)
11293 return true
11294 }
11295 // match: (NEG (NEG x))
11296 // result: x
11297 for {
11298 if v_0.Op != OpS390XNEG {
11299 break
11300 }
11301 x := v_0.Args[0]
11302 v.copyOf(x)
11303 return true
11304 }
11305 // match: (NEG (ADDconst [c] (NEG x)))
11306 // cond: c != -(1<<31)
11307 // result: (ADDconst [-c] x)
11308 for {
11309 if v_0.Op != OpS390XADDconst {
11310 break
11311 }
11312 c := auxIntToInt32(v_0.AuxInt)
11313 v_0_0 := v_0.Args[0]
11314 if v_0_0.Op != OpS390XNEG {
11315 break
11316 }
11317 x := v_0_0.Args[0]
11318 if !(c != -(1 << 31)) {
11319 break
11320 }
11321 v.reset(OpS390XADDconst)
11322 v.AuxInt = int32ToAuxInt(-c)
11323 v.AddArg(x)
11324 return true
11325 }
11326 return false
11327 }
11328 func rewriteValueS390X_OpS390XNEGW(v *Value) bool {
11329 v_0 := v.Args[0]
11330 // match: (NEGW (MOVDconst [c]))
11331 // result: (MOVDconst [int64(int32(-c))])
11332 for {
11333 if v_0.Op != OpS390XMOVDconst {
11334 break
11335 }
11336 c := auxIntToInt64(v_0.AuxInt)
11337 v.reset(OpS390XMOVDconst)
11338 v.AuxInt = int64ToAuxInt(int64(int32(-c)))
11339 return true
11340 }
11341 return false
11342 }
11343 func rewriteValueS390X_OpS390XNOT(v *Value) bool {
11344 v_0 := v.Args[0]
11345 b := v.Block
11346 typ := &b.Func.Config.Types
11347 // match: (NOT x)
11348 // result: (XOR (MOVDconst [-1]) x)
11349 for {
11350 x := v_0
11351 v.reset(OpS390XXOR)
11352 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
11353 v0.AuxInt = int64ToAuxInt(-1)
11354 v.AddArg2(v0, x)
11355 return true
11356 }
11357 }
11358 func rewriteValueS390X_OpS390XNOTW(v *Value) bool {
11359 v_0 := v.Args[0]
11360 // match: (NOTW x)
11361 // result: (XORWconst [-1] x)
11362 for {
11363 x := v_0
11364 v.reset(OpS390XXORWconst)
11365 v.AuxInt = int32ToAuxInt(-1)
11366 v.AddArg(x)
11367 return true
11368 }
11369 }
11370 func rewriteValueS390X_OpS390XOR(v *Value) bool {
11371 v_1 := v.Args[1]
11372 v_0 := v.Args[0]
11373 b := v.Block
11374 // match: (OR x (MOVDconst [c]))
11375 // cond: isU32Bit(c)
11376 // result: (ORconst [c] x)
11377 for {
11378 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11379 x := v_0
11380 if v_1.Op != OpS390XMOVDconst {
11381 continue
11382 }
11383 c := auxIntToInt64(v_1.AuxInt)
11384 if !(isU32Bit(c)) {
11385 continue
11386 }
11387 v.reset(OpS390XORconst)
11388 v.AuxInt = int64ToAuxInt(c)
11389 v.AddArg(x)
11390 return true
11391 }
11392 break
11393 }
11394 // match: (OR (MOVDconst [-1<<63]) (LGDR <t> x))
11395 // result: (LGDR <t> (LNDFR <x.Type> x))
11396 for {
11397 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11398 if v_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0.AuxInt) != -1<<63 || v_1.Op != OpS390XLGDR {
11399 continue
11400 }
11401 t := v_1.Type
11402 x := v_1.Args[0]
11403 v.reset(OpS390XLGDR)
11404 v.Type = t
11405 v0 := b.NewValue0(v.Pos, OpS390XLNDFR, x.Type)
11406 v0.AddArg(x)
11407 v.AddArg(v0)
11408 return true
11409 }
11410 break
11411 }
11412 // match: (OR (RISBGZ (LGDR x) {r}) (LGDR (LPDFR <t> y)))
11413 // cond: r == s390x.NewRotateParams(0, 0, 0)
11414 // result: (LGDR (CPSDR <t> y x))
11415 for {
11416 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11417 if v_0.Op != OpS390XRISBGZ {
11418 continue
11419 }
11420 r := auxToS390xRotateParams(v_0.Aux)
11421 v_0_0 := v_0.Args[0]
11422 if v_0_0.Op != OpS390XLGDR {
11423 continue
11424 }
11425 x := v_0_0.Args[0]
11426 if v_1.Op != OpS390XLGDR {
11427 continue
11428 }
11429 v_1_0 := v_1.Args[0]
11430 if v_1_0.Op != OpS390XLPDFR {
11431 continue
11432 }
11433 t := v_1_0.Type
11434 y := v_1_0.Args[0]
11435 if !(r == s390x.NewRotateParams(0, 0, 0)) {
11436 continue
11437 }
11438 v.reset(OpS390XLGDR)
11439 v0 := b.NewValue0(v.Pos, OpS390XCPSDR, t)
11440 v0.AddArg2(y, x)
11441 v.AddArg(v0)
11442 return true
11443 }
11444 break
11445 }
11446 // match: (OR (RISBGZ (LGDR x) {r}) (MOVDconst [c]))
11447 // cond: c >= 0 && r == s390x.NewRotateParams(0, 0, 0)
11448 // result: (LGDR (CPSDR <x.Type> (FMOVDconst <x.Type> [math.Float64frombits(uint64(c))]) x))
11449 for {
11450 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11451 if v_0.Op != OpS390XRISBGZ {
11452 continue
11453 }
11454 r := auxToS390xRotateParams(v_0.Aux)
11455 v_0_0 := v_0.Args[0]
11456 if v_0_0.Op != OpS390XLGDR {
11457 continue
11458 }
11459 x := v_0_0.Args[0]
11460 if v_1.Op != OpS390XMOVDconst {
11461 continue
11462 }
11463 c := auxIntToInt64(v_1.AuxInt)
11464 if !(c >= 0 && r == s390x.NewRotateParams(0, 0, 0)) {
11465 continue
11466 }
11467 v.reset(OpS390XLGDR)
11468 v0 := b.NewValue0(v.Pos, OpS390XCPSDR, x.Type)
11469 v1 := b.NewValue0(v.Pos, OpS390XFMOVDconst, x.Type)
11470 v1.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c)))
11471 v0.AddArg2(v1, x)
11472 v.AddArg(v0)
11473 return true
11474 }
11475 break
11476 }
11477 // match: (OR (MOVDconst [c]) (MOVDconst [d]))
11478 // result: (MOVDconst [c|d])
11479 for {
11480 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11481 if v_0.Op != OpS390XMOVDconst {
11482 continue
11483 }
11484 c := auxIntToInt64(v_0.AuxInt)
11485 if v_1.Op != OpS390XMOVDconst {
11486 continue
11487 }
11488 d := auxIntToInt64(v_1.AuxInt)
11489 v.reset(OpS390XMOVDconst)
11490 v.AuxInt = int64ToAuxInt(c | d)
11491 return true
11492 }
11493 break
11494 }
11495 // match: (OR x x)
11496 // result: x
11497 for {
11498 x := v_0
11499 if x != v_1 {
11500 break
11501 }
11502 v.copyOf(x)
11503 return true
11504 }
11505 // match: (OR <t> x g:(MOVDload [off] {sym} ptr mem))
11506 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11507 // result: (ORload <t> [off] {sym} x ptr mem)
11508 for {
11509 t := v.Type
11510 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11511 x := v_0
11512 g := v_1
11513 if g.Op != OpS390XMOVDload {
11514 continue
11515 }
11516 off := auxIntToInt32(g.AuxInt)
11517 sym := auxToSym(g.Aux)
11518 mem := g.Args[1]
11519 ptr := g.Args[0]
11520 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11521 continue
11522 }
11523 v.reset(OpS390XORload)
11524 v.Type = t
11525 v.AuxInt = int32ToAuxInt(off)
11526 v.Aux = symToAux(sym)
11527 v.AddArg3(x, ptr, mem)
11528 return true
11529 }
11530 break
11531 }
11532 return false
11533 }
11534 func rewriteValueS390X_OpS390XORW(v *Value) bool {
11535 v_1 := v.Args[1]
11536 v_0 := v.Args[0]
11537 // match: (ORW x (MOVDconst [c]))
11538 // result: (ORWconst [int32(c)] x)
11539 for {
11540 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11541 x := v_0
11542 if v_1.Op != OpS390XMOVDconst {
11543 continue
11544 }
11545 c := auxIntToInt64(v_1.AuxInt)
11546 v.reset(OpS390XORWconst)
11547 v.AuxInt = int32ToAuxInt(int32(c))
11548 v.AddArg(x)
11549 return true
11550 }
11551 break
11552 }
11553 // match: (ORW x x)
11554 // result: x
11555 for {
11556 x := v_0
11557 if x != v_1 {
11558 break
11559 }
11560 v.copyOf(x)
11561 return true
11562 }
11563 // match: (ORW <t> x g:(MOVWload [off] {sym} ptr mem))
11564 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11565 // result: (ORWload <t> [off] {sym} x ptr mem)
11566 for {
11567 t := v.Type
11568 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11569 x := v_0
11570 g := v_1
11571 if g.Op != OpS390XMOVWload {
11572 continue
11573 }
11574 off := auxIntToInt32(g.AuxInt)
11575 sym := auxToSym(g.Aux)
11576 mem := g.Args[1]
11577 ptr := g.Args[0]
11578 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11579 continue
11580 }
11581 v.reset(OpS390XORWload)
11582 v.Type = t
11583 v.AuxInt = int32ToAuxInt(off)
11584 v.Aux = symToAux(sym)
11585 v.AddArg3(x, ptr, mem)
11586 return true
11587 }
11588 break
11589 }
11590 // match: (ORW <t> x g:(MOVWZload [off] {sym} ptr mem))
11591 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
11592 // result: (ORWload <t> [off] {sym} x ptr mem)
11593 for {
11594 t := v.Type
11595 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11596 x := v_0
11597 g := v_1
11598 if g.Op != OpS390XMOVWZload {
11599 continue
11600 }
11601 off := auxIntToInt32(g.AuxInt)
11602 sym := auxToSym(g.Aux)
11603 mem := g.Args[1]
11604 ptr := g.Args[0]
11605 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
11606 continue
11607 }
11608 v.reset(OpS390XORWload)
11609 v.Type = t
11610 v.AuxInt = int32ToAuxInt(off)
11611 v.Aux = symToAux(sym)
11612 v.AddArg3(x, ptr, mem)
11613 return true
11614 }
11615 break
11616 }
11617 return false
11618 }
11619 func rewriteValueS390X_OpS390XORWconst(v *Value) bool {
11620 v_0 := v.Args[0]
11621 // match: (ORWconst [c] x)
11622 // cond: int32(c)==0
11623 // result: x
11624 for {
11625 c := auxIntToInt32(v.AuxInt)
11626 x := v_0
11627 if !(int32(c) == 0) {
11628 break
11629 }
11630 v.copyOf(x)
11631 return true
11632 }
11633 // match: (ORWconst [c] _)
11634 // cond: int32(c)==-1
11635 // result: (MOVDconst [-1])
11636 for {
11637 c := auxIntToInt32(v.AuxInt)
11638 if !(int32(c) == -1) {
11639 break
11640 }
11641 v.reset(OpS390XMOVDconst)
11642 v.AuxInt = int64ToAuxInt(-1)
11643 return true
11644 }
11645 // match: (ORWconst [c] (MOVDconst [d]))
11646 // result: (MOVDconst [int64(c)|d])
11647 for {
11648 c := auxIntToInt32(v.AuxInt)
11649 if v_0.Op != OpS390XMOVDconst {
11650 break
11651 }
11652 d := auxIntToInt64(v_0.AuxInt)
11653 v.reset(OpS390XMOVDconst)
11654 v.AuxInt = int64ToAuxInt(int64(c) | d)
11655 return true
11656 }
11657 return false
11658 }
11659 func rewriteValueS390X_OpS390XORWload(v *Value) bool {
11660 v_2 := v.Args[2]
11661 v_1 := v.Args[1]
11662 v_0 := v.Args[0]
11663 // match: (ORWload [off1] {sym} x (ADDconst [off2] ptr) mem)
11664 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
11665 // result: (ORWload [off1+off2] {sym} x ptr mem)
11666 for {
11667 off1 := auxIntToInt32(v.AuxInt)
11668 sym := auxToSym(v.Aux)
11669 x := v_0
11670 if v_1.Op != OpS390XADDconst {
11671 break
11672 }
11673 off2 := auxIntToInt32(v_1.AuxInt)
11674 ptr := v_1.Args[0]
11675 mem := v_2
11676 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
11677 break
11678 }
11679 v.reset(OpS390XORWload)
11680 v.AuxInt = int32ToAuxInt(off1 + off2)
11681 v.Aux = symToAux(sym)
11682 v.AddArg3(x, ptr, mem)
11683 return true
11684 }
11685 // match: (ORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
11686 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
11687 // result: (ORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
11688 for {
11689 o1 := auxIntToInt32(v.AuxInt)
11690 s1 := auxToSym(v.Aux)
11691 x := v_0
11692 if v_1.Op != OpS390XMOVDaddr {
11693 break
11694 }
11695 o2 := auxIntToInt32(v_1.AuxInt)
11696 s2 := auxToSym(v_1.Aux)
11697 ptr := v_1.Args[0]
11698 mem := v_2
11699 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
11700 break
11701 }
11702 v.reset(OpS390XORWload)
11703 v.AuxInt = int32ToAuxInt(o1 + o2)
11704 v.Aux = symToAux(mergeSym(s1, s2))
11705 v.AddArg3(x, ptr, mem)
11706 return true
11707 }
11708 return false
11709 }
11710 func rewriteValueS390X_OpS390XORconst(v *Value) bool {
11711 v_0 := v.Args[0]
11712 // match: (ORconst [0] x)
11713 // result: x
11714 for {
11715 if auxIntToInt64(v.AuxInt) != 0 {
11716 break
11717 }
11718 x := v_0
11719 v.copyOf(x)
11720 return true
11721 }
11722 // match: (ORconst [-1] _)
11723 // result: (MOVDconst [-1])
11724 for {
11725 if auxIntToInt64(v.AuxInt) != -1 {
11726 break
11727 }
11728 v.reset(OpS390XMOVDconst)
11729 v.AuxInt = int64ToAuxInt(-1)
11730 return true
11731 }
11732 // match: (ORconst [c] (MOVDconst [d]))
11733 // result: (MOVDconst [c|d])
11734 for {
11735 c := auxIntToInt64(v.AuxInt)
11736 if v_0.Op != OpS390XMOVDconst {
11737 break
11738 }
11739 d := auxIntToInt64(v_0.AuxInt)
11740 v.reset(OpS390XMOVDconst)
11741 v.AuxInt = int64ToAuxInt(c | d)
11742 return true
11743 }
11744 return false
11745 }
11746 func rewriteValueS390X_OpS390XORload(v *Value) bool {
11747 v_2 := v.Args[2]
11748 v_1 := v.Args[1]
11749 v_0 := v.Args[0]
11750 b := v.Block
11751 // match: (ORload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
11752 // cond: isSamePtr(ptr1, ptr2)
11753 // result: (OR x (LGDR <t> y))
11754 for {
11755 t := v.Type
11756 off := auxIntToInt32(v.AuxInt)
11757 sym := auxToSym(v.Aux)
11758 x := v_0
11759 ptr1 := v_1
11760 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
11761 break
11762 }
11763 y := v_2.Args[1]
11764 ptr2 := v_2.Args[0]
11765 if !(isSamePtr(ptr1, ptr2)) {
11766 break
11767 }
11768 v.reset(OpS390XOR)
11769 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
11770 v0.AddArg(y)
11771 v.AddArg2(x, v0)
11772 return true
11773 }
11774 // match: (ORload [off1] {sym} x (ADDconst [off2] ptr) mem)
11775 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
11776 // result: (ORload [off1+off2] {sym} x ptr mem)
11777 for {
11778 off1 := auxIntToInt32(v.AuxInt)
11779 sym := auxToSym(v.Aux)
11780 x := v_0
11781 if v_1.Op != OpS390XADDconst {
11782 break
11783 }
11784 off2 := auxIntToInt32(v_1.AuxInt)
11785 ptr := v_1.Args[0]
11786 mem := v_2
11787 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
11788 break
11789 }
11790 v.reset(OpS390XORload)
11791 v.AuxInt = int32ToAuxInt(off1 + off2)
11792 v.Aux = symToAux(sym)
11793 v.AddArg3(x, ptr, mem)
11794 return true
11795 }
11796 // match: (ORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
11797 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
11798 // result: (ORload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
11799 for {
11800 o1 := auxIntToInt32(v.AuxInt)
11801 s1 := auxToSym(v.Aux)
11802 x := v_0
11803 if v_1.Op != OpS390XMOVDaddr {
11804 break
11805 }
11806 o2 := auxIntToInt32(v_1.AuxInt)
11807 s2 := auxToSym(v_1.Aux)
11808 ptr := v_1.Args[0]
11809 mem := v_2
11810 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
11811 break
11812 }
11813 v.reset(OpS390XORload)
11814 v.AuxInt = int32ToAuxInt(o1 + o2)
11815 v.Aux = symToAux(mergeSym(s1, s2))
11816 v.AddArg3(x, ptr, mem)
11817 return true
11818 }
11819 return false
11820 }
11821 func rewriteValueS390X_OpS390XRISBGZ(v *Value) bool {
11822 v_0 := v.Args[0]
11823 b := v.Block
11824 // match: (RISBGZ (MOVWZreg x) {r})
11825 // cond: r.InMerge(0xffffffff) != nil
11826 // result: (RISBGZ x {*r.InMerge(0xffffffff)})
11827 for {
11828 r := auxToS390xRotateParams(v.Aux)
11829 if v_0.Op != OpS390XMOVWZreg {
11830 break
11831 }
11832 x := v_0.Args[0]
11833 if !(r.InMerge(0xffffffff) != nil) {
11834 break
11835 }
11836 v.reset(OpS390XRISBGZ)
11837 v.Aux = s390xRotateParamsToAux(*r.InMerge(0xffffffff))
11838 v.AddArg(x)
11839 return true
11840 }
11841 // match: (RISBGZ (MOVHZreg x) {r})
11842 // cond: r.InMerge(0x0000ffff) != nil
11843 // result: (RISBGZ x {*r.InMerge(0x0000ffff)})
11844 for {
11845 r := auxToS390xRotateParams(v.Aux)
11846 if v_0.Op != OpS390XMOVHZreg {
11847 break
11848 }
11849 x := v_0.Args[0]
11850 if !(r.InMerge(0x0000ffff) != nil) {
11851 break
11852 }
11853 v.reset(OpS390XRISBGZ)
11854 v.Aux = s390xRotateParamsToAux(*r.InMerge(0x0000ffff))
11855 v.AddArg(x)
11856 return true
11857 }
11858 // match: (RISBGZ (MOVBZreg x) {r})
11859 // cond: r.InMerge(0x000000ff) != nil
11860 // result: (RISBGZ x {*r.InMerge(0x000000ff)})
11861 for {
11862 r := auxToS390xRotateParams(v.Aux)
11863 if v_0.Op != OpS390XMOVBZreg {
11864 break
11865 }
11866 x := v_0.Args[0]
11867 if !(r.InMerge(0x000000ff) != nil) {
11868 break
11869 }
11870 v.reset(OpS390XRISBGZ)
11871 v.Aux = s390xRotateParamsToAux(*r.InMerge(0x000000ff))
11872 v.AddArg(x)
11873 return true
11874 }
11875 // match: (RISBGZ (SLDconst x [c]) {r})
11876 // cond: r.InMerge(^uint64(0)<<c) != nil
11877 // result: (RISBGZ x {(*r.InMerge(^uint64(0)<<c)).RotateLeft(c)})
11878 for {
11879 r := auxToS390xRotateParams(v.Aux)
11880 if v_0.Op != OpS390XSLDconst {
11881 break
11882 }
11883 c := auxIntToUint8(v_0.AuxInt)
11884 x := v_0.Args[0]
11885 if !(r.InMerge(^uint64(0)<<c) != nil) {
11886 break
11887 }
11888 v.reset(OpS390XRISBGZ)
11889 v.Aux = s390xRotateParamsToAux((*r.InMerge(^uint64(0) << c)).RotateLeft(c))
11890 v.AddArg(x)
11891 return true
11892 }
11893 // match: (RISBGZ (SRDconst x [c]) {r})
11894 // cond: r.InMerge(^uint64(0)>>c) != nil
11895 // result: (RISBGZ x {(*r.InMerge(^uint64(0)>>c)).RotateLeft(-c)})
11896 for {
11897 r := auxToS390xRotateParams(v.Aux)
11898 if v_0.Op != OpS390XSRDconst {
11899 break
11900 }
11901 c := auxIntToUint8(v_0.AuxInt)
11902 x := v_0.Args[0]
11903 if !(r.InMerge(^uint64(0)>>c) != nil) {
11904 break
11905 }
11906 v.reset(OpS390XRISBGZ)
11907 v.Aux = s390xRotateParamsToAux((*r.InMerge(^uint64(0) >> c)).RotateLeft(-c))
11908 v.AddArg(x)
11909 return true
11910 }
11911 // match: (RISBGZ (RISBGZ x {y}) {z})
11912 // cond: z.InMerge(y.OutMask()) != nil
11913 // result: (RISBGZ x {(*z.InMerge(y.OutMask())).RotateLeft(y.Amount)})
11914 for {
11915 z := auxToS390xRotateParams(v.Aux)
11916 if v_0.Op != OpS390XRISBGZ {
11917 break
11918 }
11919 y := auxToS390xRotateParams(v_0.Aux)
11920 x := v_0.Args[0]
11921 if !(z.InMerge(y.OutMask()) != nil) {
11922 break
11923 }
11924 v.reset(OpS390XRISBGZ)
11925 v.Aux = s390xRotateParamsToAux((*z.InMerge(y.OutMask())).RotateLeft(y.Amount))
11926 v.AddArg(x)
11927 return true
11928 }
11929 // match: (RISBGZ x {r})
11930 // cond: r.End == 63 && r.Start == -r.Amount&63
11931 // result: (SRDconst x [-r.Amount&63])
11932 for {
11933 r := auxToS390xRotateParams(v.Aux)
11934 x := v_0
11935 if !(r.End == 63 && r.Start == -r.Amount&63) {
11936 break
11937 }
11938 v.reset(OpS390XSRDconst)
11939 v.AuxInt = uint8ToAuxInt(-r.Amount & 63)
11940 v.AddArg(x)
11941 return true
11942 }
11943 // match: (RISBGZ x {r})
11944 // cond: r.Start == 0 && r.End == 63-r.Amount
11945 // result: (SLDconst x [r.Amount])
11946 for {
11947 r := auxToS390xRotateParams(v.Aux)
11948 x := v_0
11949 if !(r.Start == 0 && r.End == 63-r.Amount) {
11950 break
11951 }
11952 v.reset(OpS390XSLDconst)
11953 v.AuxInt = uint8ToAuxInt(r.Amount)
11954 v.AddArg(x)
11955 return true
11956 }
11957 // match: (RISBGZ (SRADconst x [c]) {r})
11958 // cond: r.Start == r.End && (r.Start+r.Amount)&63 <= c
11959 // result: (RISBGZ x {s390x.NewRotateParams(r.Start, r.Start, -r.Start&63)})
11960 for {
11961 r := auxToS390xRotateParams(v.Aux)
11962 if v_0.Op != OpS390XSRADconst {
11963 break
11964 }
11965 c := auxIntToUint8(v_0.AuxInt)
11966 x := v_0.Args[0]
11967 if !(r.Start == r.End && (r.Start+r.Amount)&63 <= c) {
11968 break
11969 }
11970 v.reset(OpS390XRISBGZ)
11971 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(r.Start, r.Start, -r.Start&63))
11972 v.AddArg(x)
11973 return true
11974 }
11975 // match: (RISBGZ x {r})
11976 // cond: r == s390x.NewRotateParams(56, 63, 0)
11977 // result: (MOVBZreg x)
11978 for {
11979 r := auxToS390xRotateParams(v.Aux)
11980 x := v_0
11981 if !(r == s390x.NewRotateParams(56, 63, 0)) {
11982 break
11983 }
11984 v.reset(OpS390XMOVBZreg)
11985 v.AddArg(x)
11986 return true
11987 }
11988 // match: (RISBGZ x {r})
11989 // cond: r == s390x.NewRotateParams(48, 63, 0)
11990 // result: (MOVHZreg x)
11991 for {
11992 r := auxToS390xRotateParams(v.Aux)
11993 x := v_0
11994 if !(r == s390x.NewRotateParams(48, 63, 0)) {
11995 break
11996 }
11997 v.reset(OpS390XMOVHZreg)
11998 v.AddArg(x)
11999 return true
12000 }
12001 // match: (RISBGZ x {r})
12002 // cond: r == s390x.NewRotateParams(32, 63, 0)
12003 // result: (MOVWZreg x)
12004 for {
12005 r := auxToS390xRotateParams(v.Aux)
12006 x := v_0
12007 if !(r == s390x.NewRotateParams(32, 63, 0)) {
12008 break
12009 }
12010 v.reset(OpS390XMOVWZreg)
12011 v.AddArg(x)
12012 return true
12013 }
12014 // match: (RISBGZ (LGDR <t> x) {r})
12015 // cond: r == s390x.NewRotateParams(1, 63, 0)
12016 // result: (LGDR <t> (LPDFR <x.Type> x))
12017 for {
12018 r := auxToS390xRotateParams(v.Aux)
12019 if v_0.Op != OpS390XLGDR {
12020 break
12021 }
12022 t := v_0.Type
12023 x := v_0.Args[0]
12024 if !(r == s390x.NewRotateParams(1, 63, 0)) {
12025 break
12026 }
12027 v.reset(OpS390XLGDR)
12028 v.Type = t
12029 v0 := b.NewValue0(v.Pos, OpS390XLPDFR, x.Type)
12030 v0.AddArg(x)
12031 v.AddArg(v0)
12032 return true
12033 }
12034 return false
12035 }
12036 func rewriteValueS390X_OpS390XRLL(v *Value) bool {
12037 v_1 := v.Args[1]
12038 v_0 := v.Args[0]
12039 // match: (RLL x (MOVDconst [c]))
12040 // result: (RLLconst x [uint8(c&31)])
12041 for {
12042 x := v_0
12043 if v_1.Op != OpS390XMOVDconst {
12044 break
12045 }
12046 c := auxIntToInt64(v_1.AuxInt)
12047 v.reset(OpS390XRLLconst)
12048 v.AuxInt = uint8ToAuxInt(uint8(c & 31))
12049 v.AddArg(x)
12050 return true
12051 }
12052 return false
12053 }
12054 func rewriteValueS390X_OpS390XRLLG(v *Value) bool {
12055 v_1 := v.Args[1]
12056 v_0 := v.Args[0]
12057 // match: (RLLG x (MOVDconst [c]))
12058 // result: (RISBGZ x {s390x.NewRotateParams(0, 63, uint8(c&63))})
12059 for {
12060 x := v_0
12061 if v_1.Op != OpS390XMOVDconst {
12062 break
12063 }
12064 c := auxIntToInt64(v_1.AuxInt)
12065 v.reset(OpS390XRISBGZ)
12066 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(0, 63, uint8(c&63)))
12067 v.AddArg(x)
12068 return true
12069 }
12070 return false
12071 }
12072 func rewriteValueS390X_OpS390XSLD(v *Value) bool {
12073 v_1 := v.Args[1]
12074 v_0 := v.Args[0]
12075 b := v.Block
12076 typ := &b.Func.Config.Types
12077 // match: (SLD x (MOVDconst [c]))
12078 // result: (SLDconst x [uint8(c&63)])
12079 for {
12080 x := v_0
12081 if v_1.Op != OpS390XMOVDconst {
12082 break
12083 }
12084 c := auxIntToInt64(v_1.AuxInt)
12085 v.reset(OpS390XSLDconst)
12086 v.AuxInt = uint8ToAuxInt(uint8(c & 63))
12087 v.AddArg(x)
12088 return true
12089 }
12090 // match: (SLD x (RISBGZ y {r}))
12091 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12092 // result: (SLD x y)
12093 for {
12094 x := v_0
12095 if v_1.Op != OpS390XRISBGZ {
12096 break
12097 }
12098 r := auxToS390xRotateParams(v_1.Aux)
12099 y := v_1.Args[0]
12100 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12101 break
12102 }
12103 v.reset(OpS390XSLD)
12104 v.AddArg2(x, y)
12105 return true
12106 }
12107 // match: (SLD x (AND (MOVDconst [c]) y))
12108 // result: (SLD x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12109 for {
12110 x := v_0
12111 if v_1.Op != OpS390XAND {
12112 break
12113 }
12114 _ = v_1.Args[1]
12115 v_1_0 := v_1.Args[0]
12116 v_1_1 := v_1.Args[1]
12117 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12118 if v_1_0.Op != OpS390XMOVDconst {
12119 continue
12120 }
12121 c := auxIntToInt64(v_1_0.AuxInt)
12122 y := v_1_1
12123 v.reset(OpS390XSLD)
12124 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12125 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12126 v0.AddArg(y)
12127 v.AddArg2(x, v0)
12128 return true
12129 }
12130 break
12131 }
12132 // match: (SLD x (ANDWconst [c] y))
12133 // cond: c&63 == 63
12134 // result: (SLD x y)
12135 for {
12136 x := v_0
12137 if v_1.Op != OpS390XANDWconst {
12138 break
12139 }
12140 c := auxIntToInt32(v_1.AuxInt)
12141 y := v_1.Args[0]
12142 if !(c&63 == 63) {
12143 break
12144 }
12145 v.reset(OpS390XSLD)
12146 v.AddArg2(x, y)
12147 return true
12148 }
12149 // match: (SLD x (MOVWreg y))
12150 // result: (SLD x y)
12151 for {
12152 x := v_0
12153 if v_1.Op != OpS390XMOVWreg {
12154 break
12155 }
12156 y := v_1.Args[0]
12157 v.reset(OpS390XSLD)
12158 v.AddArg2(x, y)
12159 return true
12160 }
12161 // match: (SLD x (MOVHreg y))
12162 // result: (SLD x y)
12163 for {
12164 x := v_0
12165 if v_1.Op != OpS390XMOVHreg {
12166 break
12167 }
12168 y := v_1.Args[0]
12169 v.reset(OpS390XSLD)
12170 v.AddArg2(x, y)
12171 return true
12172 }
12173 // match: (SLD x (MOVBreg y))
12174 // result: (SLD x y)
12175 for {
12176 x := v_0
12177 if v_1.Op != OpS390XMOVBreg {
12178 break
12179 }
12180 y := v_1.Args[0]
12181 v.reset(OpS390XSLD)
12182 v.AddArg2(x, y)
12183 return true
12184 }
12185 // match: (SLD x (MOVWZreg y))
12186 // result: (SLD x y)
12187 for {
12188 x := v_0
12189 if v_1.Op != OpS390XMOVWZreg {
12190 break
12191 }
12192 y := v_1.Args[0]
12193 v.reset(OpS390XSLD)
12194 v.AddArg2(x, y)
12195 return true
12196 }
12197 // match: (SLD x (MOVHZreg y))
12198 // result: (SLD x y)
12199 for {
12200 x := v_0
12201 if v_1.Op != OpS390XMOVHZreg {
12202 break
12203 }
12204 y := v_1.Args[0]
12205 v.reset(OpS390XSLD)
12206 v.AddArg2(x, y)
12207 return true
12208 }
12209 // match: (SLD x (MOVBZreg y))
12210 // result: (SLD x y)
12211 for {
12212 x := v_0
12213 if v_1.Op != OpS390XMOVBZreg {
12214 break
12215 }
12216 y := v_1.Args[0]
12217 v.reset(OpS390XSLD)
12218 v.AddArg2(x, y)
12219 return true
12220 }
12221 return false
12222 }
12223 func rewriteValueS390X_OpS390XSLDconst(v *Value) bool {
12224 v_0 := v.Args[0]
12225 // match: (SLDconst (SRDconst x [c]) [d])
12226 // result: (RISBGZ x {s390x.NewRotateParams(uint8(max(0, int8(c-d))), 63-d, uint8(int8(d-c)&63))})
12227 for {
12228 d := auxIntToUint8(v.AuxInt)
12229 if v_0.Op != OpS390XSRDconst {
12230 break
12231 }
12232 c := auxIntToUint8(v_0.AuxInt)
12233 x := v_0.Args[0]
12234 v.reset(OpS390XRISBGZ)
12235 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(uint8(max(0, int8(c-d))), 63-d, uint8(int8(d-c)&63)))
12236 v.AddArg(x)
12237 return true
12238 }
12239 // match: (SLDconst (RISBGZ x {r}) [c])
12240 // cond: s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask()) != nil
12241 // result: (RISBGZ x {(*s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask())).RotateLeft(r.Amount)})
12242 for {
12243 c := auxIntToUint8(v.AuxInt)
12244 if v_0.Op != OpS390XRISBGZ {
12245 break
12246 }
12247 r := auxToS390xRotateParams(v_0.Aux)
12248 x := v_0.Args[0]
12249 if !(s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask()) != nil) {
12250 break
12251 }
12252 v.reset(OpS390XRISBGZ)
12253 v.Aux = s390xRotateParamsToAux((*s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask())).RotateLeft(r.Amount))
12254 v.AddArg(x)
12255 return true
12256 }
12257 // match: (SLDconst x [0])
12258 // result: x
12259 for {
12260 if auxIntToUint8(v.AuxInt) != 0 {
12261 break
12262 }
12263 x := v_0
12264 v.copyOf(x)
12265 return true
12266 }
12267 return false
12268 }
12269 func rewriteValueS390X_OpS390XSLW(v *Value) bool {
12270 v_1 := v.Args[1]
12271 v_0 := v.Args[0]
12272 b := v.Block
12273 typ := &b.Func.Config.Types
12274 // match: (SLW x (MOVDconst [c]))
12275 // cond: c&32 == 0
12276 // result: (SLWconst x [uint8(c&31)])
12277 for {
12278 x := v_0
12279 if v_1.Op != OpS390XMOVDconst {
12280 break
12281 }
12282 c := auxIntToInt64(v_1.AuxInt)
12283 if !(c&32 == 0) {
12284 break
12285 }
12286 v.reset(OpS390XSLWconst)
12287 v.AuxInt = uint8ToAuxInt(uint8(c & 31))
12288 v.AddArg(x)
12289 return true
12290 }
12291 // match: (SLW _ (MOVDconst [c]))
12292 // cond: c&32 != 0
12293 // result: (MOVDconst [0])
12294 for {
12295 if v_1.Op != OpS390XMOVDconst {
12296 break
12297 }
12298 c := auxIntToInt64(v_1.AuxInt)
12299 if !(c&32 != 0) {
12300 break
12301 }
12302 v.reset(OpS390XMOVDconst)
12303 v.AuxInt = int64ToAuxInt(0)
12304 return true
12305 }
12306 // match: (SLW x (RISBGZ y {r}))
12307 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12308 // result: (SLW x y)
12309 for {
12310 x := v_0
12311 if v_1.Op != OpS390XRISBGZ {
12312 break
12313 }
12314 r := auxToS390xRotateParams(v_1.Aux)
12315 y := v_1.Args[0]
12316 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12317 break
12318 }
12319 v.reset(OpS390XSLW)
12320 v.AddArg2(x, y)
12321 return true
12322 }
12323 // match: (SLW x (AND (MOVDconst [c]) y))
12324 // result: (SLW x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12325 for {
12326 x := v_0
12327 if v_1.Op != OpS390XAND {
12328 break
12329 }
12330 _ = v_1.Args[1]
12331 v_1_0 := v_1.Args[0]
12332 v_1_1 := v_1.Args[1]
12333 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12334 if v_1_0.Op != OpS390XMOVDconst {
12335 continue
12336 }
12337 c := auxIntToInt64(v_1_0.AuxInt)
12338 y := v_1_1
12339 v.reset(OpS390XSLW)
12340 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12341 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12342 v0.AddArg(y)
12343 v.AddArg2(x, v0)
12344 return true
12345 }
12346 break
12347 }
12348 // match: (SLW x (ANDWconst [c] y))
12349 // cond: c&63 == 63
12350 // result: (SLW x y)
12351 for {
12352 x := v_0
12353 if v_1.Op != OpS390XANDWconst {
12354 break
12355 }
12356 c := auxIntToInt32(v_1.AuxInt)
12357 y := v_1.Args[0]
12358 if !(c&63 == 63) {
12359 break
12360 }
12361 v.reset(OpS390XSLW)
12362 v.AddArg2(x, y)
12363 return true
12364 }
12365 // match: (SLW x (MOVWreg y))
12366 // result: (SLW x y)
12367 for {
12368 x := v_0
12369 if v_1.Op != OpS390XMOVWreg {
12370 break
12371 }
12372 y := v_1.Args[0]
12373 v.reset(OpS390XSLW)
12374 v.AddArg2(x, y)
12375 return true
12376 }
12377 // match: (SLW x (MOVHreg y))
12378 // result: (SLW x y)
12379 for {
12380 x := v_0
12381 if v_1.Op != OpS390XMOVHreg {
12382 break
12383 }
12384 y := v_1.Args[0]
12385 v.reset(OpS390XSLW)
12386 v.AddArg2(x, y)
12387 return true
12388 }
12389 // match: (SLW x (MOVBreg y))
12390 // result: (SLW x y)
12391 for {
12392 x := v_0
12393 if v_1.Op != OpS390XMOVBreg {
12394 break
12395 }
12396 y := v_1.Args[0]
12397 v.reset(OpS390XSLW)
12398 v.AddArg2(x, y)
12399 return true
12400 }
12401 // match: (SLW x (MOVWZreg y))
12402 // result: (SLW x y)
12403 for {
12404 x := v_0
12405 if v_1.Op != OpS390XMOVWZreg {
12406 break
12407 }
12408 y := v_1.Args[0]
12409 v.reset(OpS390XSLW)
12410 v.AddArg2(x, y)
12411 return true
12412 }
12413 // match: (SLW x (MOVHZreg y))
12414 // result: (SLW x y)
12415 for {
12416 x := v_0
12417 if v_1.Op != OpS390XMOVHZreg {
12418 break
12419 }
12420 y := v_1.Args[0]
12421 v.reset(OpS390XSLW)
12422 v.AddArg2(x, y)
12423 return true
12424 }
12425 // match: (SLW x (MOVBZreg y))
12426 // result: (SLW x y)
12427 for {
12428 x := v_0
12429 if v_1.Op != OpS390XMOVBZreg {
12430 break
12431 }
12432 y := v_1.Args[0]
12433 v.reset(OpS390XSLW)
12434 v.AddArg2(x, y)
12435 return true
12436 }
12437 return false
12438 }
12439 func rewriteValueS390X_OpS390XSLWconst(v *Value) bool {
12440 v_0 := v.Args[0]
12441 // match: (SLWconst x [0])
12442 // result: x
12443 for {
12444 if auxIntToUint8(v.AuxInt) != 0 {
12445 break
12446 }
12447 x := v_0
12448 v.copyOf(x)
12449 return true
12450 }
12451 return false
12452 }
12453 func rewriteValueS390X_OpS390XSRAD(v *Value) bool {
12454 v_1 := v.Args[1]
12455 v_0 := v.Args[0]
12456 b := v.Block
12457 typ := &b.Func.Config.Types
12458 // match: (SRAD x (MOVDconst [c]))
12459 // result: (SRADconst x [uint8(c&63)])
12460 for {
12461 x := v_0
12462 if v_1.Op != OpS390XMOVDconst {
12463 break
12464 }
12465 c := auxIntToInt64(v_1.AuxInt)
12466 v.reset(OpS390XSRADconst)
12467 v.AuxInt = uint8ToAuxInt(uint8(c & 63))
12468 v.AddArg(x)
12469 return true
12470 }
12471 // match: (SRAD x (RISBGZ y {r}))
12472 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12473 // result: (SRAD x y)
12474 for {
12475 x := v_0
12476 if v_1.Op != OpS390XRISBGZ {
12477 break
12478 }
12479 r := auxToS390xRotateParams(v_1.Aux)
12480 y := v_1.Args[0]
12481 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12482 break
12483 }
12484 v.reset(OpS390XSRAD)
12485 v.AddArg2(x, y)
12486 return true
12487 }
12488 // match: (SRAD x (AND (MOVDconst [c]) y))
12489 // result: (SRAD x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12490 for {
12491 x := v_0
12492 if v_1.Op != OpS390XAND {
12493 break
12494 }
12495 _ = v_1.Args[1]
12496 v_1_0 := v_1.Args[0]
12497 v_1_1 := v_1.Args[1]
12498 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12499 if v_1_0.Op != OpS390XMOVDconst {
12500 continue
12501 }
12502 c := auxIntToInt64(v_1_0.AuxInt)
12503 y := v_1_1
12504 v.reset(OpS390XSRAD)
12505 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12506 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12507 v0.AddArg(y)
12508 v.AddArg2(x, v0)
12509 return true
12510 }
12511 break
12512 }
12513 // match: (SRAD x (ANDWconst [c] y))
12514 // cond: c&63 == 63
12515 // result: (SRAD x y)
12516 for {
12517 x := v_0
12518 if v_1.Op != OpS390XANDWconst {
12519 break
12520 }
12521 c := auxIntToInt32(v_1.AuxInt)
12522 y := v_1.Args[0]
12523 if !(c&63 == 63) {
12524 break
12525 }
12526 v.reset(OpS390XSRAD)
12527 v.AddArg2(x, y)
12528 return true
12529 }
12530 // match: (SRAD x (MOVWreg y))
12531 // result: (SRAD x y)
12532 for {
12533 x := v_0
12534 if v_1.Op != OpS390XMOVWreg {
12535 break
12536 }
12537 y := v_1.Args[0]
12538 v.reset(OpS390XSRAD)
12539 v.AddArg2(x, y)
12540 return true
12541 }
12542 // match: (SRAD x (MOVHreg y))
12543 // result: (SRAD x y)
12544 for {
12545 x := v_0
12546 if v_1.Op != OpS390XMOVHreg {
12547 break
12548 }
12549 y := v_1.Args[0]
12550 v.reset(OpS390XSRAD)
12551 v.AddArg2(x, y)
12552 return true
12553 }
12554 // match: (SRAD x (MOVBreg y))
12555 // result: (SRAD x y)
12556 for {
12557 x := v_0
12558 if v_1.Op != OpS390XMOVBreg {
12559 break
12560 }
12561 y := v_1.Args[0]
12562 v.reset(OpS390XSRAD)
12563 v.AddArg2(x, y)
12564 return true
12565 }
12566 // match: (SRAD x (MOVWZreg y))
12567 // result: (SRAD x y)
12568 for {
12569 x := v_0
12570 if v_1.Op != OpS390XMOVWZreg {
12571 break
12572 }
12573 y := v_1.Args[0]
12574 v.reset(OpS390XSRAD)
12575 v.AddArg2(x, y)
12576 return true
12577 }
12578 // match: (SRAD x (MOVHZreg y))
12579 // result: (SRAD x y)
12580 for {
12581 x := v_0
12582 if v_1.Op != OpS390XMOVHZreg {
12583 break
12584 }
12585 y := v_1.Args[0]
12586 v.reset(OpS390XSRAD)
12587 v.AddArg2(x, y)
12588 return true
12589 }
12590 // match: (SRAD x (MOVBZreg y))
12591 // result: (SRAD x y)
12592 for {
12593 x := v_0
12594 if v_1.Op != OpS390XMOVBZreg {
12595 break
12596 }
12597 y := v_1.Args[0]
12598 v.reset(OpS390XSRAD)
12599 v.AddArg2(x, y)
12600 return true
12601 }
12602 return false
12603 }
12604 func rewriteValueS390X_OpS390XSRADconst(v *Value) bool {
12605 v_0 := v.Args[0]
12606 // match: (SRADconst x [0])
12607 // result: x
12608 for {
12609 if auxIntToUint8(v.AuxInt) != 0 {
12610 break
12611 }
12612 x := v_0
12613 v.copyOf(x)
12614 return true
12615 }
12616 // match: (SRADconst [c] (MOVDconst [d]))
12617 // result: (MOVDconst [d>>uint64(c)])
12618 for {
12619 c := auxIntToUint8(v.AuxInt)
12620 if v_0.Op != OpS390XMOVDconst {
12621 break
12622 }
12623 d := auxIntToInt64(v_0.AuxInt)
12624 v.reset(OpS390XMOVDconst)
12625 v.AuxInt = int64ToAuxInt(d >> uint64(c))
12626 return true
12627 }
12628 return false
12629 }
12630 func rewriteValueS390X_OpS390XSRAW(v *Value) bool {
12631 v_1 := v.Args[1]
12632 v_0 := v.Args[0]
12633 b := v.Block
12634 typ := &b.Func.Config.Types
12635 // match: (SRAW x (MOVDconst [c]))
12636 // cond: c&32 == 0
12637 // result: (SRAWconst x [uint8(c&31)])
12638 for {
12639 x := v_0
12640 if v_1.Op != OpS390XMOVDconst {
12641 break
12642 }
12643 c := auxIntToInt64(v_1.AuxInt)
12644 if !(c&32 == 0) {
12645 break
12646 }
12647 v.reset(OpS390XSRAWconst)
12648 v.AuxInt = uint8ToAuxInt(uint8(c & 31))
12649 v.AddArg(x)
12650 return true
12651 }
12652 // match: (SRAW x (MOVDconst [c]))
12653 // cond: c&32 != 0
12654 // result: (SRAWconst x [31])
12655 for {
12656 x := v_0
12657 if v_1.Op != OpS390XMOVDconst {
12658 break
12659 }
12660 c := auxIntToInt64(v_1.AuxInt)
12661 if !(c&32 != 0) {
12662 break
12663 }
12664 v.reset(OpS390XSRAWconst)
12665 v.AuxInt = uint8ToAuxInt(31)
12666 v.AddArg(x)
12667 return true
12668 }
12669 // match: (SRAW x (RISBGZ y {r}))
12670 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12671 // result: (SRAW x y)
12672 for {
12673 x := v_0
12674 if v_1.Op != OpS390XRISBGZ {
12675 break
12676 }
12677 r := auxToS390xRotateParams(v_1.Aux)
12678 y := v_1.Args[0]
12679 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12680 break
12681 }
12682 v.reset(OpS390XSRAW)
12683 v.AddArg2(x, y)
12684 return true
12685 }
12686 // match: (SRAW x (AND (MOVDconst [c]) y))
12687 // result: (SRAW x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12688 for {
12689 x := v_0
12690 if v_1.Op != OpS390XAND {
12691 break
12692 }
12693 _ = v_1.Args[1]
12694 v_1_0 := v_1.Args[0]
12695 v_1_1 := v_1.Args[1]
12696 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12697 if v_1_0.Op != OpS390XMOVDconst {
12698 continue
12699 }
12700 c := auxIntToInt64(v_1_0.AuxInt)
12701 y := v_1_1
12702 v.reset(OpS390XSRAW)
12703 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12704 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12705 v0.AddArg(y)
12706 v.AddArg2(x, v0)
12707 return true
12708 }
12709 break
12710 }
12711 // match: (SRAW x (ANDWconst [c] y))
12712 // cond: c&63 == 63
12713 // result: (SRAW x y)
12714 for {
12715 x := v_0
12716 if v_1.Op != OpS390XANDWconst {
12717 break
12718 }
12719 c := auxIntToInt32(v_1.AuxInt)
12720 y := v_1.Args[0]
12721 if !(c&63 == 63) {
12722 break
12723 }
12724 v.reset(OpS390XSRAW)
12725 v.AddArg2(x, y)
12726 return true
12727 }
12728 // match: (SRAW x (MOVWreg y))
12729 // result: (SRAW x y)
12730 for {
12731 x := v_0
12732 if v_1.Op != OpS390XMOVWreg {
12733 break
12734 }
12735 y := v_1.Args[0]
12736 v.reset(OpS390XSRAW)
12737 v.AddArg2(x, y)
12738 return true
12739 }
12740 // match: (SRAW x (MOVHreg y))
12741 // result: (SRAW x y)
12742 for {
12743 x := v_0
12744 if v_1.Op != OpS390XMOVHreg {
12745 break
12746 }
12747 y := v_1.Args[0]
12748 v.reset(OpS390XSRAW)
12749 v.AddArg2(x, y)
12750 return true
12751 }
12752 // match: (SRAW x (MOVBreg y))
12753 // result: (SRAW x y)
12754 for {
12755 x := v_0
12756 if v_1.Op != OpS390XMOVBreg {
12757 break
12758 }
12759 y := v_1.Args[0]
12760 v.reset(OpS390XSRAW)
12761 v.AddArg2(x, y)
12762 return true
12763 }
12764 // match: (SRAW x (MOVWZreg y))
12765 // result: (SRAW x y)
12766 for {
12767 x := v_0
12768 if v_1.Op != OpS390XMOVWZreg {
12769 break
12770 }
12771 y := v_1.Args[0]
12772 v.reset(OpS390XSRAW)
12773 v.AddArg2(x, y)
12774 return true
12775 }
12776 // match: (SRAW x (MOVHZreg y))
12777 // result: (SRAW x y)
12778 for {
12779 x := v_0
12780 if v_1.Op != OpS390XMOVHZreg {
12781 break
12782 }
12783 y := v_1.Args[0]
12784 v.reset(OpS390XSRAW)
12785 v.AddArg2(x, y)
12786 return true
12787 }
12788 // match: (SRAW x (MOVBZreg y))
12789 // result: (SRAW x y)
12790 for {
12791 x := v_0
12792 if v_1.Op != OpS390XMOVBZreg {
12793 break
12794 }
12795 y := v_1.Args[0]
12796 v.reset(OpS390XSRAW)
12797 v.AddArg2(x, y)
12798 return true
12799 }
12800 return false
12801 }
12802 func rewriteValueS390X_OpS390XSRAWconst(v *Value) bool {
12803 v_0 := v.Args[0]
12804 // match: (SRAWconst x [0])
12805 // result: x
12806 for {
12807 if auxIntToUint8(v.AuxInt) != 0 {
12808 break
12809 }
12810 x := v_0
12811 v.copyOf(x)
12812 return true
12813 }
12814 // match: (SRAWconst [c] (MOVDconst [d]))
12815 // result: (MOVDconst [int64(int32(d))>>uint64(c)])
12816 for {
12817 c := auxIntToUint8(v.AuxInt)
12818 if v_0.Op != OpS390XMOVDconst {
12819 break
12820 }
12821 d := auxIntToInt64(v_0.AuxInt)
12822 v.reset(OpS390XMOVDconst)
12823 v.AuxInt = int64ToAuxInt(int64(int32(d)) >> uint64(c))
12824 return true
12825 }
12826 return false
12827 }
12828 func rewriteValueS390X_OpS390XSRD(v *Value) bool {
12829 v_1 := v.Args[1]
12830 v_0 := v.Args[0]
12831 b := v.Block
12832 typ := &b.Func.Config.Types
12833 // match: (SRD x (MOVDconst [c]))
12834 // result: (SRDconst x [uint8(c&63)])
12835 for {
12836 x := v_0
12837 if v_1.Op != OpS390XMOVDconst {
12838 break
12839 }
12840 c := auxIntToInt64(v_1.AuxInt)
12841 v.reset(OpS390XSRDconst)
12842 v.AuxInt = uint8ToAuxInt(uint8(c & 63))
12843 v.AddArg(x)
12844 return true
12845 }
12846 // match: (SRD x (RISBGZ y {r}))
12847 // cond: r.Amount == 0 && r.OutMask()&63 == 63
12848 // result: (SRD x y)
12849 for {
12850 x := v_0
12851 if v_1.Op != OpS390XRISBGZ {
12852 break
12853 }
12854 r := auxToS390xRotateParams(v_1.Aux)
12855 y := v_1.Args[0]
12856 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
12857 break
12858 }
12859 v.reset(OpS390XSRD)
12860 v.AddArg2(x, y)
12861 return true
12862 }
12863 // match: (SRD x (AND (MOVDconst [c]) y))
12864 // result: (SRD x (ANDWconst <typ.UInt32> [int32(c&63)] y))
12865 for {
12866 x := v_0
12867 if v_1.Op != OpS390XAND {
12868 break
12869 }
12870 _ = v_1.Args[1]
12871 v_1_0 := v_1.Args[0]
12872 v_1_1 := v_1.Args[1]
12873 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
12874 if v_1_0.Op != OpS390XMOVDconst {
12875 continue
12876 }
12877 c := auxIntToInt64(v_1_0.AuxInt)
12878 y := v_1_1
12879 v.reset(OpS390XSRD)
12880 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
12881 v0.AuxInt = int32ToAuxInt(int32(c & 63))
12882 v0.AddArg(y)
12883 v.AddArg2(x, v0)
12884 return true
12885 }
12886 break
12887 }
12888 // match: (SRD x (ANDWconst [c] y))
12889 // cond: c&63 == 63
12890 // result: (SRD x y)
12891 for {
12892 x := v_0
12893 if v_1.Op != OpS390XANDWconst {
12894 break
12895 }
12896 c := auxIntToInt32(v_1.AuxInt)
12897 y := v_1.Args[0]
12898 if !(c&63 == 63) {
12899 break
12900 }
12901 v.reset(OpS390XSRD)
12902 v.AddArg2(x, y)
12903 return true
12904 }
12905 // match: (SRD x (MOVWreg y))
12906 // result: (SRD x y)
12907 for {
12908 x := v_0
12909 if v_1.Op != OpS390XMOVWreg {
12910 break
12911 }
12912 y := v_1.Args[0]
12913 v.reset(OpS390XSRD)
12914 v.AddArg2(x, y)
12915 return true
12916 }
12917 // match: (SRD x (MOVHreg y))
12918 // result: (SRD x y)
12919 for {
12920 x := v_0
12921 if v_1.Op != OpS390XMOVHreg {
12922 break
12923 }
12924 y := v_1.Args[0]
12925 v.reset(OpS390XSRD)
12926 v.AddArg2(x, y)
12927 return true
12928 }
12929 // match: (SRD x (MOVBreg y))
12930 // result: (SRD x y)
12931 for {
12932 x := v_0
12933 if v_1.Op != OpS390XMOVBreg {
12934 break
12935 }
12936 y := v_1.Args[0]
12937 v.reset(OpS390XSRD)
12938 v.AddArg2(x, y)
12939 return true
12940 }
12941 // match: (SRD x (MOVWZreg y))
12942 // result: (SRD x y)
12943 for {
12944 x := v_0
12945 if v_1.Op != OpS390XMOVWZreg {
12946 break
12947 }
12948 y := v_1.Args[0]
12949 v.reset(OpS390XSRD)
12950 v.AddArg2(x, y)
12951 return true
12952 }
12953 // match: (SRD x (MOVHZreg y))
12954 // result: (SRD x y)
12955 for {
12956 x := v_0
12957 if v_1.Op != OpS390XMOVHZreg {
12958 break
12959 }
12960 y := v_1.Args[0]
12961 v.reset(OpS390XSRD)
12962 v.AddArg2(x, y)
12963 return true
12964 }
12965 // match: (SRD x (MOVBZreg y))
12966 // result: (SRD x y)
12967 for {
12968 x := v_0
12969 if v_1.Op != OpS390XMOVBZreg {
12970 break
12971 }
12972 y := v_1.Args[0]
12973 v.reset(OpS390XSRD)
12974 v.AddArg2(x, y)
12975 return true
12976 }
12977 return false
12978 }
12979 func rewriteValueS390X_OpS390XSRDconst(v *Value) bool {
12980 v_0 := v.Args[0]
12981 // match: (SRDconst (SLDconst x [c]) [d])
12982 // result: (RISBGZ x {s390x.NewRotateParams(d, uint8(min(63, int8(63-c+d))), uint8(int8(c-d)&63))})
12983 for {
12984 d := auxIntToUint8(v.AuxInt)
12985 if v_0.Op != OpS390XSLDconst {
12986 break
12987 }
12988 c := auxIntToUint8(v_0.AuxInt)
12989 x := v_0.Args[0]
12990 v.reset(OpS390XRISBGZ)
12991 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(d, uint8(min(63, int8(63-c+d))), uint8(int8(c-d)&63)))
12992 v.AddArg(x)
12993 return true
12994 }
12995 // match: (SRDconst (RISBGZ x {r}) [c])
12996 // cond: s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask()) != nil
12997 // result: (RISBGZ x {(*s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask())).RotateLeft(r.Amount)})
12998 for {
12999 c := auxIntToUint8(v.AuxInt)
13000 if v_0.Op != OpS390XRISBGZ {
13001 break
13002 }
13003 r := auxToS390xRotateParams(v_0.Aux)
13004 x := v_0.Args[0]
13005 if !(s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask()) != nil) {
13006 break
13007 }
13008 v.reset(OpS390XRISBGZ)
13009 v.Aux = s390xRotateParamsToAux((*s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask())).RotateLeft(r.Amount))
13010 v.AddArg(x)
13011 return true
13012 }
13013 // match: (SRDconst x [0])
13014 // result: x
13015 for {
13016 if auxIntToUint8(v.AuxInt) != 0 {
13017 break
13018 }
13019 x := v_0
13020 v.copyOf(x)
13021 return true
13022 }
13023 return false
13024 }
13025 func rewriteValueS390X_OpS390XSRW(v *Value) bool {
13026 v_1 := v.Args[1]
13027 v_0 := v.Args[0]
13028 b := v.Block
13029 typ := &b.Func.Config.Types
13030 // match: (SRW x (MOVDconst [c]))
13031 // cond: c&32 == 0
13032 // result: (SRWconst x [uint8(c&31)])
13033 for {
13034 x := v_0
13035 if v_1.Op != OpS390XMOVDconst {
13036 break
13037 }
13038 c := auxIntToInt64(v_1.AuxInt)
13039 if !(c&32 == 0) {
13040 break
13041 }
13042 v.reset(OpS390XSRWconst)
13043 v.AuxInt = uint8ToAuxInt(uint8(c & 31))
13044 v.AddArg(x)
13045 return true
13046 }
13047 // match: (SRW _ (MOVDconst [c]))
13048 // cond: c&32 != 0
13049 // result: (MOVDconst [0])
13050 for {
13051 if v_1.Op != OpS390XMOVDconst {
13052 break
13053 }
13054 c := auxIntToInt64(v_1.AuxInt)
13055 if !(c&32 != 0) {
13056 break
13057 }
13058 v.reset(OpS390XMOVDconst)
13059 v.AuxInt = int64ToAuxInt(0)
13060 return true
13061 }
13062 // match: (SRW x (RISBGZ y {r}))
13063 // cond: r.Amount == 0 && r.OutMask()&63 == 63
13064 // result: (SRW x y)
13065 for {
13066 x := v_0
13067 if v_1.Op != OpS390XRISBGZ {
13068 break
13069 }
13070 r := auxToS390xRotateParams(v_1.Aux)
13071 y := v_1.Args[0]
13072 if !(r.Amount == 0 && r.OutMask()&63 == 63) {
13073 break
13074 }
13075 v.reset(OpS390XSRW)
13076 v.AddArg2(x, y)
13077 return true
13078 }
13079 // match: (SRW x (AND (MOVDconst [c]) y))
13080 // result: (SRW x (ANDWconst <typ.UInt32> [int32(c&63)] y))
13081 for {
13082 x := v_0
13083 if v_1.Op != OpS390XAND {
13084 break
13085 }
13086 _ = v_1.Args[1]
13087 v_1_0 := v_1.Args[0]
13088 v_1_1 := v_1.Args[1]
13089 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
13090 if v_1_0.Op != OpS390XMOVDconst {
13091 continue
13092 }
13093 c := auxIntToInt64(v_1_0.AuxInt)
13094 y := v_1_1
13095 v.reset(OpS390XSRW)
13096 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32)
13097 v0.AuxInt = int32ToAuxInt(int32(c & 63))
13098 v0.AddArg(y)
13099 v.AddArg2(x, v0)
13100 return true
13101 }
13102 break
13103 }
13104 // match: (SRW x (ANDWconst [c] y))
13105 // cond: c&63 == 63
13106 // result: (SRW x y)
13107 for {
13108 x := v_0
13109 if v_1.Op != OpS390XANDWconst {
13110 break
13111 }
13112 c := auxIntToInt32(v_1.AuxInt)
13113 y := v_1.Args[0]
13114 if !(c&63 == 63) {
13115 break
13116 }
13117 v.reset(OpS390XSRW)
13118 v.AddArg2(x, y)
13119 return true
13120 }
13121 // match: (SRW x (MOVWreg y))
13122 // result: (SRW x y)
13123 for {
13124 x := v_0
13125 if v_1.Op != OpS390XMOVWreg {
13126 break
13127 }
13128 y := v_1.Args[0]
13129 v.reset(OpS390XSRW)
13130 v.AddArg2(x, y)
13131 return true
13132 }
13133 // match: (SRW x (MOVHreg y))
13134 // result: (SRW x y)
13135 for {
13136 x := v_0
13137 if v_1.Op != OpS390XMOVHreg {
13138 break
13139 }
13140 y := v_1.Args[0]
13141 v.reset(OpS390XSRW)
13142 v.AddArg2(x, y)
13143 return true
13144 }
13145 // match: (SRW x (MOVBreg y))
13146 // result: (SRW x y)
13147 for {
13148 x := v_0
13149 if v_1.Op != OpS390XMOVBreg {
13150 break
13151 }
13152 y := v_1.Args[0]
13153 v.reset(OpS390XSRW)
13154 v.AddArg2(x, y)
13155 return true
13156 }
13157 // match: (SRW x (MOVWZreg y))
13158 // result: (SRW x y)
13159 for {
13160 x := v_0
13161 if v_1.Op != OpS390XMOVWZreg {
13162 break
13163 }
13164 y := v_1.Args[0]
13165 v.reset(OpS390XSRW)
13166 v.AddArg2(x, y)
13167 return true
13168 }
13169 // match: (SRW x (MOVHZreg y))
13170 // result: (SRW x y)
13171 for {
13172 x := v_0
13173 if v_1.Op != OpS390XMOVHZreg {
13174 break
13175 }
13176 y := v_1.Args[0]
13177 v.reset(OpS390XSRW)
13178 v.AddArg2(x, y)
13179 return true
13180 }
13181 // match: (SRW x (MOVBZreg y))
13182 // result: (SRW x y)
13183 for {
13184 x := v_0
13185 if v_1.Op != OpS390XMOVBZreg {
13186 break
13187 }
13188 y := v_1.Args[0]
13189 v.reset(OpS390XSRW)
13190 v.AddArg2(x, y)
13191 return true
13192 }
13193 return false
13194 }
13195 func rewriteValueS390X_OpS390XSRWconst(v *Value) bool {
13196 v_0 := v.Args[0]
13197 // match: (SRWconst x [0])
13198 // result: x
13199 for {
13200 if auxIntToUint8(v.AuxInt) != 0 {
13201 break
13202 }
13203 x := v_0
13204 v.copyOf(x)
13205 return true
13206 }
13207 return false
13208 }
13209 func rewriteValueS390X_OpS390XSTM2(v *Value) bool {
13210 v_3 := v.Args[3]
13211 v_2 := v.Args[2]
13212 v_1 := v.Args[1]
13213 v_0 := v.Args[0]
13214 // match: (STM2 [i] {s} p w2 w3 x:(STM2 [i-8] {s} p w0 w1 mem))
13215 // cond: x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)
13216 // result: (STM4 [i-8] {s} p w0 w1 w2 w3 mem)
13217 for {
13218 i := auxIntToInt32(v.AuxInt)
13219 s := auxToSym(v.Aux)
13220 p := v_0
13221 w2 := v_1
13222 w3 := v_2
13223 x := v_3
13224 if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s {
13225 break
13226 }
13227 mem := x.Args[3]
13228 if p != x.Args[0] {
13229 break
13230 }
13231 w0 := x.Args[1]
13232 w1 := x.Args[2]
13233 if !(x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)) {
13234 break
13235 }
13236 v.reset(OpS390XSTM4)
13237 v.AuxInt = int32ToAuxInt(i - 8)
13238 v.Aux = symToAux(s)
13239 v.AddArg6(p, w0, w1, w2, w3, mem)
13240 return true
13241 }
13242 // match: (STM2 [i] {s} p (SRDconst [32] x) x mem)
13243 // result: (MOVDstore [i] {s} p x mem)
13244 for {
13245 i := auxIntToInt32(v.AuxInt)
13246 s := auxToSym(v.Aux)
13247 p := v_0
13248 if v_1.Op != OpS390XSRDconst || auxIntToUint8(v_1.AuxInt) != 32 {
13249 break
13250 }
13251 x := v_1.Args[0]
13252 if x != v_2 {
13253 break
13254 }
13255 mem := v_3
13256 v.reset(OpS390XMOVDstore)
13257 v.AuxInt = int32ToAuxInt(i)
13258 v.Aux = symToAux(s)
13259 v.AddArg3(p, x, mem)
13260 return true
13261 }
13262 return false
13263 }
13264 func rewriteValueS390X_OpS390XSTMG2(v *Value) bool {
13265 v_3 := v.Args[3]
13266 v_2 := v.Args[2]
13267 v_1 := v.Args[1]
13268 v_0 := v.Args[0]
13269 // match: (STMG2 [i] {s} p w2 w3 x:(STMG2 [i-16] {s} p w0 w1 mem))
13270 // cond: x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)
13271 // result: (STMG4 [i-16] {s} p w0 w1 w2 w3 mem)
13272 for {
13273 i := auxIntToInt32(v.AuxInt)
13274 s := auxToSym(v.Aux)
13275 p := v_0
13276 w2 := v_1
13277 w3 := v_2
13278 x := v_3
13279 if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s {
13280 break
13281 }
13282 mem := x.Args[3]
13283 if p != x.Args[0] {
13284 break
13285 }
13286 w0 := x.Args[1]
13287 w1 := x.Args[2]
13288 if !(x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)) {
13289 break
13290 }
13291 v.reset(OpS390XSTMG4)
13292 v.AuxInt = int32ToAuxInt(i - 16)
13293 v.Aux = symToAux(s)
13294 v.AddArg6(p, w0, w1, w2, w3, mem)
13295 return true
13296 }
13297 return false
13298 }
13299 func rewriteValueS390X_OpS390XSUB(v *Value) bool {
13300 v_1 := v.Args[1]
13301 v_0 := v.Args[0]
13302 b := v.Block
13303 // match: (SUB x (MOVDconst [c]))
13304 // cond: is32Bit(c)
13305 // result: (SUBconst x [int32(c)])
13306 for {
13307 x := v_0
13308 if v_1.Op != OpS390XMOVDconst {
13309 break
13310 }
13311 c := auxIntToInt64(v_1.AuxInt)
13312 if !(is32Bit(c)) {
13313 break
13314 }
13315 v.reset(OpS390XSUBconst)
13316 v.AuxInt = int32ToAuxInt(int32(c))
13317 v.AddArg(x)
13318 return true
13319 }
13320 // match: (SUB (MOVDconst [c]) x)
13321 // cond: is32Bit(c)
13322 // result: (NEG (SUBconst <v.Type> x [int32(c)]))
13323 for {
13324 if v_0.Op != OpS390XMOVDconst {
13325 break
13326 }
13327 c := auxIntToInt64(v_0.AuxInt)
13328 x := v_1
13329 if !(is32Bit(c)) {
13330 break
13331 }
13332 v.reset(OpS390XNEG)
13333 v0 := b.NewValue0(v.Pos, OpS390XSUBconst, v.Type)
13334 v0.AuxInt = int32ToAuxInt(int32(c))
13335 v0.AddArg(x)
13336 v.AddArg(v0)
13337 return true
13338 }
13339 // match: (SUB x (NEG y))
13340 // result: (ADD x y)
13341 for {
13342 x := v_0
13343 if v_1.Op != OpS390XNEG {
13344 break
13345 }
13346 y := v_1.Args[0]
13347 v.reset(OpS390XADD)
13348 v.AddArg2(x, y)
13349 return true
13350 }
13351 // match: (SUB x x)
13352 // result: (MOVDconst [0])
13353 for {
13354 x := v_0
13355 if x != v_1 {
13356 break
13357 }
13358 v.reset(OpS390XMOVDconst)
13359 v.AuxInt = int64ToAuxInt(0)
13360 return true
13361 }
13362 // match: (SUB <t> x g:(MOVDload [off] {sym} ptr mem))
13363 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13364 // result: (SUBload <t> [off] {sym} x ptr mem)
13365 for {
13366 t := v.Type
13367 x := v_0
13368 g := v_1
13369 if g.Op != OpS390XMOVDload {
13370 break
13371 }
13372 off := auxIntToInt32(g.AuxInt)
13373 sym := auxToSym(g.Aux)
13374 mem := g.Args[1]
13375 ptr := g.Args[0]
13376 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13377 break
13378 }
13379 v.reset(OpS390XSUBload)
13380 v.Type = t
13381 v.AuxInt = int32ToAuxInt(off)
13382 v.Aux = symToAux(sym)
13383 v.AddArg3(x, ptr, mem)
13384 return true
13385 }
13386 return false
13387 }
13388 func rewriteValueS390X_OpS390XSUBE(v *Value) bool {
13389 v_2 := v.Args[2]
13390 v_1 := v.Args[1]
13391 v_0 := v.Args[0]
13392 // match: (SUBE x y (FlagGT))
13393 // result: (SUBC x y)
13394 for {
13395 x := v_0
13396 y := v_1
13397 if v_2.Op != OpS390XFlagGT {
13398 break
13399 }
13400 v.reset(OpS390XSUBC)
13401 v.AddArg2(x, y)
13402 return true
13403 }
13404 // match: (SUBE x y (FlagOV))
13405 // result: (SUBC x y)
13406 for {
13407 x := v_0
13408 y := v_1
13409 if v_2.Op != OpS390XFlagOV {
13410 break
13411 }
13412 v.reset(OpS390XSUBC)
13413 v.AddArg2(x, y)
13414 return true
13415 }
13416 // match: (SUBE x y (Select1 (SUBC (MOVDconst [0]) (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) c))))))
13417 // result: (SUBE x y c)
13418 for {
13419 x := v_0
13420 y := v_1
13421 if v_2.Op != OpSelect1 {
13422 break
13423 }
13424 v_2_0 := v_2.Args[0]
13425 if v_2_0.Op != OpS390XSUBC {
13426 break
13427 }
13428 _ = v_2_0.Args[1]
13429 v_2_0_0 := v_2_0.Args[0]
13430 if v_2_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
13431 break
13432 }
13433 v_2_0_1 := v_2_0.Args[1]
13434 if v_2_0_1.Op != OpS390XNEG {
13435 break
13436 }
13437 v_2_0_1_0 := v_2_0_1.Args[0]
13438 if v_2_0_1_0.Op != OpSelect0 {
13439 break
13440 }
13441 v_2_0_1_0_0 := v_2_0_1_0.Args[0]
13442 if v_2_0_1_0_0.Op != OpS390XSUBE {
13443 break
13444 }
13445 c := v_2_0_1_0_0.Args[2]
13446 v_2_0_1_0_0_0 := v_2_0_1_0_0.Args[0]
13447 if v_2_0_1_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_1_0_0_0.AuxInt) != 0 {
13448 break
13449 }
13450 v_2_0_1_0_0_1 := v_2_0_1_0_0.Args[1]
13451 if v_2_0_1_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_1_0_0_1.AuxInt) != 0 {
13452 break
13453 }
13454 v.reset(OpS390XSUBE)
13455 v.AddArg3(x, y, c)
13456 return true
13457 }
13458 return false
13459 }
13460 func rewriteValueS390X_OpS390XSUBW(v *Value) bool {
13461 v_1 := v.Args[1]
13462 v_0 := v.Args[0]
13463 b := v.Block
13464 // match: (SUBW x (MOVDconst [c]))
13465 // result: (SUBWconst x [int32(c)])
13466 for {
13467 x := v_0
13468 if v_1.Op != OpS390XMOVDconst {
13469 break
13470 }
13471 c := auxIntToInt64(v_1.AuxInt)
13472 v.reset(OpS390XSUBWconst)
13473 v.AuxInt = int32ToAuxInt(int32(c))
13474 v.AddArg(x)
13475 return true
13476 }
13477 // match: (SUBW (MOVDconst [c]) x)
13478 // result: (NEGW (SUBWconst <v.Type> x [int32(c)]))
13479 for {
13480 if v_0.Op != OpS390XMOVDconst {
13481 break
13482 }
13483 c := auxIntToInt64(v_0.AuxInt)
13484 x := v_1
13485 v.reset(OpS390XNEGW)
13486 v0 := b.NewValue0(v.Pos, OpS390XSUBWconst, v.Type)
13487 v0.AuxInt = int32ToAuxInt(int32(c))
13488 v0.AddArg(x)
13489 v.AddArg(v0)
13490 return true
13491 }
13492 // match: (SUBW x (NEGW y))
13493 // result: (ADDW x y)
13494 for {
13495 x := v_0
13496 if v_1.Op != OpS390XNEGW {
13497 break
13498 }
13499 y := v_1.Args[0]
13500 v.reset(OpS390XADDW)
13501 v.AddArg2(x, y)
13502 return true
13503 }
13504 // match: (SUBW x x)
13505 // result: (MOVDconst [0])
13506 for {
13507 x := v_0
13508 if x != v_1 {
13509 break
13510 }
13511 v.reset(OpS390XMOVDconst)
13512 v.AuxInt = int64ToAuxInt(0)
13513 return true
13514 }
13515 // match: (SUBW <t> x g:(MOVWload [off] {sym} ptr mem))
13516 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13517 // result: (SUBWload <t> [off] {sym} x ptr mem)
13518 for {
13519 t := v.Type
13520 x := v_0
13521 g := v_1
13522 if g.Op != OpS390XMOVWload {
13523 break
13524 }
13525 off := auxIntToInt32(g.AuxInt)
13526 sym := auxToSym(g.Aux)
13527 mem := g.Args[1]
13528 ptr := g.Args[0]
13529 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13530 break
13531 }
13532 v.reset(OpS390XSUBWload)
13533 v.Type = t
13534 v.AuxInt = int32ToAuxInt(off)
13535 v.Aux = symToAux(sym)
13536 v.AddArg3(x, ptr, mem)
13537 return true
13538 }
13539 // match: (SUBW <t> x g:(MOVWZload [off] {sym} ptr mem))
13540 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13541 // result: (SUBWload <t> [off] {sym} x ptr mem)
13542 for {
13543 t := v.Type
13544 x := v_0
13545 g := v_1
13546 if g.Op != OpS390XMOVWZload {
13547 break
13548 }
13549 off := auxIntToInt32(g.AuxInt)
13550 sym := auxToSym(g.Aux)
13551 mem := g.Args[1]
13552 ptr := g.Args[0]
13553 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13554 break
13555 }
13556 v.reset(OpS390XSUBWload)
13557 v.Type = t
13558 v.AuxInt = int32ToAuxInt(off)
13559 v.Aux = symToAux(sym)
13560 v.AddArg3(x, ptr, mem)
13561 return true
13562 }
13563 return false
13564 }
13565 func rewriteValueS390X_OpS390XSUBWconst(v *Value) bool {
13566 v_0 := v.Args[0]
13567 // match: (SUBWconst [c] x)
13568 // cond: int32(c) == 0
13569 // result: x
13570 for {
13571 c := auxIntToInt32(v.AuxInt)
13572 x := v_0
13573 if !(int32(c) == 0) {
13574 break
13575 }
13576 v.copyOf(x)
13577 return true
13578 }
13579 // match: (SUBWconst [c] x)
13580 // result: (ADDWconst [-int32(c)] x)
13581 for {
13582 c := auxIntToInt32(v.AuxInt)
13583 x := v_0
13584 v.reset(OpS390XADDWconst)
13585 v.AuxInt = int32ToAuxInt(-int32(c))
13586 v.AddArg(x)
13587 return true
13588 }
13589 }
13590 func rewriteValueS390X_OpS390XSUBWload(v *Value) bool {
13591 v_2 := v.Args[2]
13592 v_1 := v.Args[1]
13593 v_0 := v.Args[0]
13594 // match: (SUBWload [off1] {sym} x (ADDconst [off2] ptr) mem)
13595 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
13596 // result: (SUBWload [off1+off2] {sym} x ptr mem)
13597 for {
13598 off1 := auxIntToInt32(v.AuxInt)
13599 sym := auxToSym(v.Aux)
13600 x := v_0
13601 if v_1.Op != OpS390XADDconst {
13602 break
13603 }
13604 off2 := auxIntToInt32(v_1.AuxInt)
13605 ptr := v_1.Args[0]
13606 mem := v_2
13607 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
13608 break
13609 }
13610 v.reset(OpS390XSUBWload)
13611 v.AuxInt = int32ToAuxInt(off1 + off2)
13612 v.Aux = symToAux(sym)
13613 v.AddArg3(x, ptr, mem)
13614 return true
13615 }
13616 // match: (SUBWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
13617 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
13618 // result: (SUBWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
13619 for {
13620 o1 := auxIntToInt32(v.AuxInt)
13621 s1 := auxToSym(v.Aux)
13622 x := v_0
13623 if v_1.Op != OpS390XMOVDaddr {
13624 break
13625 }
13626 o2 := auxIntToInt32(v_1.AuxInt)
13627 s2 := auxToSym(v_1.Aux)
13628 ptr := v_1.Args[0]
13629 mem := v_2
13630 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
13631 break
13632 }
13633 v.reset(OpS390XSUBWload)
13634 v.AuxInt = int32ToAuxInt(o1 + o2)
13635 v.Aux = symToAux(mergeSym(s1, s2))
13636 v.AddArg3(x, ptr, mem)
13637 return true
13638 }
13639 return false
13640 }
13641 func rewriteValueS390X_OpS390XSUBconst(v *Value) bool {
13642 v_0 := v.Args[0]
13643 // match: (SUBconst [0] x)
13644 // result: x
13645 for {
13646 if auxIntToInt32(v.AuxInt) != 0 {
13647 break
13648 }
13649 x := v_0
13650 v.copyOf(x)
13651 return true
13652 }
13653 // match: (SUBconst [c] x)
13654 // cond: c != -(1<<31)
13655 // result: (ADDconst [-c] x)
13656 for {
13657 c := auxIntToInt32(v.AuxInt)
13658 x := v_0
13659 if !(c != -(1 << 31)) {
13660 break
13661 }
13662 v.reset(OpS390XADDconst)
13663 v.AuxInt = int32ToAuxInt(-c)
13664 v.AddArg(x)
13665 return true
13666 }
13667 // match: (SUBconst (MOVDconst [d]) [c])
13668 // result: (MOVDconst [d-int64(c)])
13669 for {
13670 c := auxIntToInt32(v.AuxInt)
13671 if v_0.Op != OpS390XMOVDconst {
13672 break
13673 }
13674 d := auxIntToInt64(v_0.AuxInt)
13675 v.reset(OpS390XMOVDconst)
13676 v.AuxInt = int64ToAuxInt(d - int64(c))
13677 return true
13678 }
13679 // match: (SUBconst (SUBconst x [d]) [c])
13680 // cond: is32Bit(-int64(c)-int64(d))
13681 // result: (ADDconst [-c-d] x)
13682 for {
13683 c := auxIntToInt32(v.AuxInt)
13684 if v_0.Op != OpS390XSUBconst {
13685 break
13686 }
13687 d := auxIntToInt32(v_0.AuxInt)
13688 x := v_0.Args[0]
13689 if !(is32Bit(-int64(c) - int64(d))) {
13690 break
13691 }
13692 v.reset(OpS390XADDconst)
13693 v.AuxInt = int32ToAuxInt(-c - d)
13694 v.AddArg(x)
13695 return true
13696 }
13697 return false
13698 }
13699 func rewriteValueS390X_OpS390XSUBload(v *Value) bool {
13700 v_2 := v.Args[2]
13701 v_1 := v.Args[1]
13702 v_0 := v.Args[0]
13703 b := v.Block
13704 // match: (SUBload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
13705 // cond: isSamePtr(ptr1, ptr2)
13706 // result: (SUB x (LGDR <t> y))
13707 for {
13708 t := v.Type
13709 off := auxIntToInt32(v.AuxInt)
13710 sym := auxToSym(v.Aux)
13711 x := v_0
13712 ptr1 := v_1
13713 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
13714 break
13715 }
13716 y := v_2.Args[1]
13717 ptr2 := v_2.Args[0]
13718 if !(isSamePtr(ptr1, ptr2)) {
13719 break
13720 }
13721 v.reset(OpS390XSUB)
13722 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
13723 v0.AddArg(y)
13724 v.AddArg2(x, v0)
13725 return true
13726 }
13727 // match: (SUBload [off1] {sym} x (ADDconst [off2] ptr) mem)
13728 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
13729 // result: (SUBload [off1+off2] {sym} x ptr mem)
13730 for {
13731 off1 := auxIntToInt32(v.AuxInt)
13732 sym := auxToSym(v.Aux)
13733 x := v_0
13734 if v_1.Op != OpS390XADDconst {
13735 break
13736 }
13737 off2 := auxIntToInt32(v_1.AuxInt)
13738 ptr := v_1.Args[0]
13739 mem := v_2
13740 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
13741 break
13742 }
13743 v.reset(OpS390XSUBload)
13744 v.AuxInt = int32ToAuxInt(off1 + off2)
13745 v.Aux = symToAux(sym)
13746 v.AddArg3(x, ptr, mem)
13747 return true
13748 }
13749 // match: (SUBload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
13750 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
13751 // result: (SUBload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
13752 for {
13753 o1 := auxIntToInt32(v.AuxInt)
13754 s1 := auxToSym(v.Aux)
13755 x := v_0
13756 if v_1.Op != OpS390XMOVDaddr {
13757 break
13758 }
13759 o2 := auxIntToInt32(v_1.AuxInt)
13760 s2 := auxToSym(v_1.Aux)
13761 ptr := v_1.Args[0]
13762 mem := v_2
13763 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
13764 break
13765 }
13766 v.reset(OpS390XSUBload)
13767 v.AuxInt = int32ToAuxInt(o1 + o2)
13768 v.Aux = symToAux(mergeSym(s1, s2))
13769 v.AddArg3(x, ptr, mem)
13770 return true
13771 }
13772 return false
13773 }
13774 func rewriteValueS390X_OpS390XSumBytes2(v *Value) bool {
13775 v_0 := v.Args[0]
13776 b := v.Block
13777 typ := &b.Func.Config.Types
13778 // match: (SumBytes2 x)
13779 // result: (ADDW (SRWconst <typ.UInt8> x [8]) x)
13780 for {
13781 x := v_0
13782 v.reset(OpS390XADDW)
13783 v0 := b.NewValue0(v.Pos, OpS390XSRWconst, typ.UInt8)
13784 v0.AuxInt = uint8ToAuxInt(8)
13785 v0.AddArg(x)
13786 v.AddArg2(v0, x)
13787 return true
13788 }
13789 }
13790 func rewriteValueS390X_OpS390XSumBytes4(v *Value) bool {
13791 v_0 := v.Args[0]
13792 b := v.Block
13793 typ := &b.Func.Config.Types
13794 // match: (SumBytes4 x)
13795 // result: (SumBytes2 (ADDW <typ.UInt16> (SRWconst <typ.UInt16> x [16]) x))
13796 for {
13797 x := v_0
13798 v.reset(OpS390XSumBytes2)
13799 v0 := b.NewValue0(v.Pos, OpS390XADDW, typ.UInt16)
13800 v1 := b.NewValue0(v.Pos, OpS390XSRWconst, typ.UInt16)
13801 v1.AuxInt = uint8ToAuxInt(16)
13802 v1.AddArg(x)
13803 v0.AddArg2(v1, x)
13804 v.AddArg(v0)
13805 return true
13806 }
13807 }
13808 func rewriteValueS390X_OpS390XSumBytes8(v *Value) bool {
13809 v_0 := v.Args[0]
13810 b := v.Block
13811 typ := &b.Func.Config.Types
13812 // match: (SumBytes8 x)
13813 // result: (SumBytes4 (ADDW <typ.UInt32> (SRDconst <typ.UInt32> x [32]) x))
13814 for {
13815 x := v_0
13816 v.reset(OpS390XSumBytes4)
13817 v0 := b.NewValue0(v.Pos, OpS390XADDW, typ.UInt32)
13818 v1 := b.NewValue0(v.Pos, OpS390XSRDconst, typ.UInt32)
13819 v1.AuxInt = uint8ToAuxInt(32)
13820 v1.AddArg(x)
13821 v0.AddArg2(v1, x)
13822 v.AddArg(v0)
13823 return true
13824 }
13825 }
13826 func rewriteValueS390X_OpS390XXOR(v *Value) bool {
13827 v_1 := v.Args[1]
13828 v_0 := v.Args[0]
13829 // match: (XOR x (MOVDconst [c]))
13830 // cond: isU32Bit(c)
13831 // result: (XORconst [c] x)
13832 for {
13833 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13834 x := v_0
13835 if v_1.Op != OpS390XMOVDconst {
13836 continue
13837 }
13838 c := auxIntToInt64(v_1.AuxInt)
13839 if !(isU32Bit(c)) {
13840 continue
13841 }
13842 v.reset(OpS390XXORconst)
13843 v.AuxInt = int64ToAuxInt(c)
13844 v.AddArg(x)
13845 return true
13846 }
13847 break
13848 }
13849 // match: (XOR (MOVDconst [c]) (MOVDconst [d]))
13850 // result: (MOVDconst [c^d])
13851 for {
13852 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13853 if v_0.Op != OpS390XMOVDconst {
13854 continue
13855 }
13856 c := auxIntToInt64(v_0.AuxInt)
13857 if v_1.Op != OpS390XMOVDconst {
13858 continue
13859 }
13860 d := auxIntToInt64(v_1.AuxInt)
13861 v.reset(OpS390XMOVDconst)
13862 v.AuxInt = int64ToAuxInt(c ^ d)
13863 return true
13864 }
13865 break
13866 }
13867 // match: (XOR x x)
13868 // result: (MOVDconst [0])
13869 for {
13870 x := v_0
13871 if x != v_1 {
13872 break
13873 }
13874 v.reset(OpS390XMOVDconst)
13875 v.AuxInt = int64ToAuxInt(0)
13876 return true
13877 }
13878 // match: (XOR <t> x g:(MOVDload [off] {sym} ptr mem))
13879 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13880 // result: (XORload <t> [off] {sym} x ptr mem)
13881 for {
13882 t := v.Type
13883 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13884 x := v_0
13885 g := v_1
13886 if g.Op != OpS390XMOVDload {
13887 continue
13888 }
13889 off := auxIntToInt32(g.AuxInt)
13890 sym := auxToSym(g.Aux)
13891 mem := g.Args[1]
13892 ptr := g.Args[0]
13893 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13894 continue
13895 }
13896 v.reset(OpS390XXORload)
13897 v.Type = t
13898 v.AuxInt = int32ToAuxInt(off)
13899 v.Aux = symToAux(sym)
13900 v.AddArg3(x, ptr, mem)
13901 return true
13902 }
13903 break
13904 }
13905 return false
13906 }
13907 func rewriteValueS390X_OpS390XXORW(v *Value) bool {
13908 v_1 := v.Args[1]
13909 v_0 := v.Args[0]
13910 // match: (XORW x (MOVDconst [c]))
13911 // result: (XORWconst [int32(c)] x)
13912 for {
13913 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13914 x := v_0
13915 if v_1.Op != OpS390XMOVDconst {
13916 continue
13917 }
13918 c := auxIntToInt64(v_1.AuxInt)
13919 v.reset(OpS390XXORWconst)
13920 v.AuxInt = int32ToAuxInt(int32(c))
13921 v.AddArg(x)
13922 return true
13923 }
13924 break
13925 }
13926 // match: (XORW x x)
13927 // result: (MOVDconst [0])
13928 for {
13929 x := v_0
13930 if x != v_1 {
13931 break
13932 }
13933 v.reset(OpS390XMOVDconst)
13934 v.AuxInt = int64ToAuxInt(0)
13935 return true
13936 }
13937 // match: (XORW <t> x g:(MOVWload [off] {sym} ptr mem))
13938 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13939 // result: (XORWload <t> [off] {sym} x ptr mem)
13940 for {
13941 t := v.Type
13942 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13943 x := v_0
13944 g := v_1
13945 if g.Op != OpS390XMOVWload {
13946 continue
13947 }
13948 off := auxIntToInt32(g.AuxInt)
13949 sym := auxToSym(g.Aux)
13950 mem := g.Args[1]
13951 ptr := g.Args[0]
13952 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13953 continue
13954 }
13955 v.reset(OpS390XXORWload)
13956 v.Type = t
13957 v.AuxInt = int32ToAuxInt(off)
13958 v.Aux = symToAux(sym)
13959 v.AddArg3(x, ptr, mem)
13960 return true
13961 }
13962 break
13963 }
13964 // match: (XORW <t> x g:(MOVWZload [off] {sym} ptr mem))
13965 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)
13966 // result: (XORWload <t> [off] {sym} x ptr mem)
13967 for {
13968 t := v.Type
13969 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13970 x := v_0
13971 g := v_1
13972 if g.Op != OpS390XMOVWZload {
13973 continue
13974 }
13975 off := auxIntToInt32(g.AuxInt)
13976 sym := auxToSym(g.Aux)
13977 mem := g.Args[1]
13978 ptr := g.Args[0]
13979 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) {
13980 continue
13981 }
13982 v.reset(OpS390XXORWload)
13983 v.Type = t
13984 v.AuxInt = int32ToAuxInt(off)
13985 v.Aux = symToAux(sym)
13986 v.AddArg3(x, ptr, mem)
13987 return true
13988 }
13989 break
13990 }
13991 return false
13992 }
13993 func rewriteValueS390X_OpS390XXORWconst(v *Value) bool {
13994 v_0 := v.Args[0]
13995 // match: (XORWconst [c] x)
13996 // cond: int32(c)==0
13997 // result: x
13998 for {
13999 c := auxIntToInt32(v.AuxInt)
14000 x := v_0
14001 if !(int32(c) == 0) {
14002 break
14003 }
14004 v.copyOf(x)
14005 return true
14006 }
14007 // match: (XORWconst [c] (MOVDconst [d]))
14008 // result: (MOVDconst [int64(c)^d])
14009 for {
14010 c := auxIntToInt32(v.AuxInt)
14011 if v_0.Op != OpS390XMOVDconst {
14012 break
14013 }
14014 d := auxIntToInt64(v_0.AuxInt)
14015 v.reset(OpS390XMOVDconst)
14016 v.AuxInt = int64ToAuxInt(int64(c) ^ d)
14017 return true
14018 }
14019 return false
14020 }
14021 func rewriteValueS390X_OpS390XXORWload(v *Value) bool {
14022 v_2 := v.Args[2]
14023 v_1 := v.Args[1]
14024 v_0 := v.Args[0]
14025 // match: (XORWload [off1] {sym} x (ADDconst [off2] ptr) mem)
14026 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
14027 // result: (XORWload [off1+off2] {sym} x ptr mem)
14028 for {
14029 off1 := auxIntToInt32(v.AuxInt)
14030 sym := auxToSym(v.Aux)
14031 x := v_0
14032 if v_1.Op != OpS390XADDconst {
14033 break
14034 }
14035 off2 := auxIntToInt32(v_1.AuxInt)
14036 ptr := v_1.Args[0]
14037 mem := v_2
14038 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
14039 break
14040 }
14041 v.reset(OpS390XXORWload)
14042 v.AuxInt = int32ToAuxInt(off1 + off2)
14043 v.Aux = symToAux(sym)
14044 v.AddArg3(x, ptr, mem)
14045 return true
14046 }
14047 // match: (XORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
14048 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
14049 // result: (XORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
14050 for {
14051 o1 := auxIntToInt32(v.AuxInt)
14052 s1 := auxToSym(v.Aux)
14053 x := v_0
14054 if v_1.Op != OpS390XMOVDaddr {
14055 break
14056 }
14057 o2 := auxIntToInt32(v_1.AuxInt)
14058 s2 := auxToSym(v_1.Aux)
14059 ptr := v_1.Args[0]
14060 mem := v_2
14061 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
14062 break
14063 }
14064 v.reset(OpS390XXORWload)
14065 v.AuxInt = int32ToAuxInt(o1 + o2)
14066 v.Aux = symToAux(mergeSym(s1, s2))
14067 v.AddArg3(x, ptr, mem)
14068 return true
14069 }
14070 return false
14071 }
14072 func rewriteValueS390X_OpS390XXORconst(v *Value) bool {
14073 v_0 := v.Args[0]
14074 // match: (XORconst [0] x)
14075 // result: x
14076 for {
14077 if auxIntToInt64(v.AuxInt) != 0 {
14078 break
14079 }
14080 x := v_0
14081 v.copyOf(x)
14082 return true
14083 }
14084 // match: (XORconst [c] (MOVDconst [d]))
14085 // result: (MOVDconst [c^d])
14086 for {
14087 c := auxIntToInt64(v.AuxInt)
14088 if v_0.Op != OpS390XMOVDconst {
14089 break
14090 }
14091 d := auxIntToInt64(v_0.AuxInt)
14092 v.reset(OpS390XMOVDconst)
14093 v.AuxInt = int64ToAuxInt(c ^ d)
14094 return true
14095 }
14096 return false
14097 }
14098 func rewriteValueS390X_OpS390XXORload(v *Value) bool {
14099 v_2 := v.Args[2]
14100 v_1 := v.Args[1]
14101 v_0 := v.Args[0]
14102 b := v.Block
14103 // match: (XORload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _))
14104 // cond: isSamePtr(ptr1, ptr2)
14105 // result: (XOR x (LGDR <t> y))
14106 for {
14107 t := v.Type
14108 off := auxIntToInt32(v.AuxInt)
14109 sym := auxToSym(v.Aux)
14110 x := v_0
14111 ptr1 := v_1
14112 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym {
14113 break
14114 }
14115 y := v_2.Args[1]
14116 ptr2 := v_2.Args[0]
14117 if !(isSamePtr(ptr1, ptr2)) {
14118 break
14119 }
14120 v.reset(OpS390XXOR)
14121 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t)
14122 v0.AddArg(y)
14123 v.AddArg2(x, v0)
14124 return true
14125 }
14126 // match: (XORload [off1] {sym} x (ADDconst [off2] ptr) mem)
14127 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))
14128 // result: (XORload [off1+off2] {sym} x ptr mem)
14129 for {
14130 off1 := auxIntToInt32(v.AuxInt)
14131 sym := auxToSym(v.Aux)
14132 x := v_0
14133 if v_1.Op != OpS390XADDconst {
14134 break
14135 }
14136 off2 := auxIntToInt32(v_1.AuxInt)
14137 ptr := v_1.Args[0]
14138 mem := v_2
14139 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) {
14140 break
14141 }
14142 v.reset(OpS390XXORload)
14143 v.AuxInt = int32ToAuxInt(off1 + off2)
14144 v.Aux = symToAux(sym)
14145 v.AddArg3(x, ptr, mem)
14146 return true
14147 }
14148 // match: (XORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem)
14149 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)
14150 // result: (XORload [o1+o2] {mergeSym(s1, s2)} x ptr mem)
14151 for {
14152 o1 := auxIntToInt32(v.AuxInt)
14153 s1 := auxToSym(v.Aux)
14154 x := v_0
14155 if v_1.Op != OpS390XMOVDaddr {
14156 break
14157 }
14158 o2 := auxIntToInt32(v_1.AuxInt)
14159 s2 := auxToSym(v_1.Aux)
14160 ptr := v_1.Args[0]
14161 mem := v_2
14162 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) {
14163 break
14164 }
14165 v.reset(OpS390XXORload)
14166 v.AuxInt = int32ToAuxInt(o1 + o2)
14167 v.Aux = symToAux(mergeSym(s1, s2))
14168 v.AddArg3(x, ptr, mem)
14169 return true
14170 }
14171 return false
14172 }
14173 func rewriteValueS390X_OpSelect0(v *Value) bool {
14174 v_0 := v.Args[0]
14175 b := v.Block
14176 typ := &b.Func.Config.Types
14177 // match: (Select0 (Add64carry x y c))
14178 // result: (Select0 <typ.UInt64> (ADDE x y (Select1 <types.TypeFlags> (ADDCconst c [-1]))))
14179 for {
14180 if v_0.Op != OpAdd64carry {
14181 break
14182 }
14183 c := v_0.Args[2]
14184 x := v_0.Args[0]
14185 y := v_0.Args[1]
14186 v.reset(OpSelect0)
14187 v.Type = typ.UInt64
14188 v0 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags))
14189 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14190 v2 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags))
14191 v2.AuxInt = int16ToAuxInt(-1)
14192 v2.AddArg(c)
14193 v1.AddArg(v2)
14194 v0.AddArg3(x, y, v1)
14195 v.AddArg(v0)
14196 return true
14197 }
14198 // match: (Select0 (Sub64borrow x y c))
14199 // result: (Select0 <typ.UInt64> (SUBE x y (Select1 <types.TypeFlags> (SUBC (MOVDconst [0]) c))))
14200 for {
14201 if v_0.Op != OpSub64borrow {
14202 break
14203 }
14204 c := v_0.Args[2]
14205 x := v_0.Args[0]
14206 y := v_0.Args[1]
14207 v.reset(OpSelect0)
14208 v.Type = typ.UInt64
14209 v0 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags))
14210 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14211 v2 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags))
14212 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
14213 v3.AuxInt = int64ToAuxInt(0)
14214 v2.AddArg2(v3, c)
14215 v1.AddArg(v2)
14216 v0.AddArg3(x, y, v1)
14217 v.AddArg(v0)
14218 return true
14219 }
14220 // match: (Select0 <t> (AddTupleFirst32 val tuple))
14221 // result: (ADDW val (Select0 <t> tuple))
14222 for {
14223 t := v.Type
14224 if v_0.Op != OpS390XAddTupleFirst32 {
14225 break
14226 }
14227 tuple := v_0.Args[1]
14228 val := v_0.Args[0]
14229 v.reset(OpS390XADDW)
14230 v0 := b.NewValue0(v.Pos, OpSelect0, t)
14231 v0.AddArg(tuple)
14232 v.AddArg2(val, v0)
14233 return true
14234 }
14235 // match: (Select0 <t> (AddTupleFirst64 val tuple))
14236 // result: (ADD val (Select0 <t> tuple))
14237 for {
14238 t := v.Type
14239 if v_0.Op != OpS390XAddTupleFirst64 {
14240 break
14241 }
14242 tuple := v_0.Args[1]
14243 val := v_0.Args[0]
14244 v.reset(OpS390XADD)
14245 v0 := b.NewValue0(v.Pos, OpSelect0, t)
14246 v0.AddArg(tuple)
14247 v.AddArg2(val, v0)
14248 return true
14249 }
14250 // match: (Select0 (ADDCconst (MOVDconst [c]) [d]))
14251 // result: (MOVDconst [c+int64(d)])
14252 for {
14253 if v_0.Op != OpS390XADDCconst {
14254 break
14255 }
14256 d := auxIntToInt16(v_0.AuxInt)
14257 v_0_0 := v_0.Args[0]
14258 if v_0_0.Op != OpS390XMOVDconst {
14259 break
14260 }
14261 c := auxIntToInt64(v_0_0.AuxInt)
14262 v.reset(OpS390XMOVDconst)
14263 v.AuxInt = int64ToAuxInt(c + int64(d))
14264 return true
14265 }
14266 // match: (Select0 (SUBC (MOVDconst [c]) (MOVDconst [d])))
14267 // result: (MOVDconst [c-d])
14268 for {
14269 if v_0.Op != OpS390XSUBC {
14270 break
14271 }
14272 _ = v_0.Args[1]
14273 v_0_0 := v_0.Args[0]
14274 if v_0_0.Op != OpS390XMOVDconst {
14275 break
14276 }
14277 c := auxIntToInt64(v_0_0.AuxInt)
14278 v_0_1 := v_0.Args[1]
14279 if v_0_1.Op != OpS390XMOVDconst {
14280 break
14281 }
14282 d := auxIntToInt64(v_0_1.AuxInt)
14283 v.reset(OpS390XMOVDconst)
14284 v.AuxInt = int64ToAuxInt(c - d)
14285 return true
14286 }
14287 // match: (Select0 (FADD (FMUL y z) x))
14288 // cond: x.Block.Func.useFMA(v)
14289 // result: (FMADD x y z)
14290 for {
14291 if v_0.Op != OpS390XFADD {
14292 break
14293 }
14294 _ = v_0.Args[1]
14295 v_0_0 := v_0.Args[0]
14296 v_0_1 := v_0.Args[1]
14297 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
14298 if v_0_0.Op != OpS390XFMUL {
14299 continue
14300 }
14301 z := v_0_0.Args[1]
14302 y := v_0_0.Args[0]
14303 x := v_0_1
14304 if !(x.Block.Func.useFMA(v)) {
14305 continue
14306 }
14307 v.reset(OpS390XFMADD)
14308 v.AddArg3(x, y, z)
14309 return true
14310 }
14311 break
14312 }
14313 // match: (Select0 (FSUB (FMUL y z) x))
14314 // cond: x.Block.Func.useFMA(v)
14315 // result: (FMSUB x y z)
14316 for {
14317 if v_0.Op != OpS390XFSUB {
14318 break
14319 }
14320 x := v_0.Args[1]
14321 v_0_0 := v_0.Args[0]
14322 if v_0_0.Op != OpS390XFMUL {
14323 break
14324 }
14325 z := v_0_0.Args[1]
14326 y := v_0_0.Args[0]
14327 if !(x.Block.Func.useFMA(v)) {
14328 break
14329 }
14330 v.reset(OpS390XFMSUB)
14331 v.AddArg3(x, y, z)
14332 return true
14333 }
14334 // match: (Select0 (FADDS (FMULS y z) x))
14335 // cond: x.Block.Func.useFMA(v)
14336 // result: (FMADDS x y z)
14337 for {
14338 if v_0.Op != OpS390XFADDS {
14339 break
14340 }
14341 _ = v_0.Args[1]
14342 v_0_0 := v_0.Args[0]
14343 v_0_1 := v_0.Args[1]
14344 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
14345 if v_0_0.Op != OpS390XFMULS {
14346 continue
14347 }
14348 z := v_0_0.Args[1]
14349 y := v_0_0.Args[0]
14350 x := v_0_1
14351 if !(x.Block.Func.useFMA(v)) {
14352 continue
14353 }
14354 v.reset(OpS390XFMADDS)
14355 v.AddArg3(x, y, z)
14356 return true
14357 }
14358 break
14359 }
14360 // match: (Select0 (FSUBS (FMULS y z) x))
14361 // cond: x.Block.Func.useFMA(v)
14362 // result: (FMSUBS x y z)
14363 for {
14364 if v_0.Op != OpS390XFSUBS {
14365 break
14366 }
14367 x := v_0.Args[1]
14368 v_0_0 := v_0.Args[0]
14369 if v_0_0.Op != OpS390XFMULS {
14370 break
14371 }
14372 z := v_0_0.Args[1]
14373 y := v_0_0.Args[0]
14374 if !(x.Block.Func.useFMA(v)) {
14375 break
14376 }
14377 v.reset(OpS390XFMSUBS)
14378 v.AddArg3(x, y, z)
14379 return true
14380 }
14381 return false
14382 }
14383 func rewriteValueS390X_OpSelect1(v *Value) bool {
14384 v_0 := v.Args[0]
14385 b := v.Block
14386 typ := &b.Func.Config.Types
14387 // match: (Select1 (Add64carry x y c))
14388 // result: (Select0 <typ.UInt64> (ADDE (MOVDconst [0]) (MOVDconst [0]) (Select1 <types.TypeFlags> (ADDE x y (Select1 <types.TypeFlags> (ADDCconst c [-1]))))))
14389 for {
14390 if v_0.Op != OpAdd64carry {
14391 break
14392 }
14393 c := v_0.Args[2]
14394 x := v_0.Args[0]
14395 y := v_0.Args[1]
14396 v.reset(OpSelect0)
14397 v.Type = typ.UInt64
14398 v0 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags))
14399 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
14400 v1.AuxInt = int64ToAuxInt(0)
14401 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14402 v3 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags))
14403 v4 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14404 v5 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags))
14405 v5.AuxInt = int16ToAuxInt(-1)
14406 v5.AddArg(c)
14407 v4.AddArg(v5)
14408 v3.AddArg3(x, y, v4)
14409 v2.AddArg(v3)
14410 v0.AddArg3(v1, v1, v2)
14411 v.AddArg(v0)
14412 return true
14413 }
14414 // match: (Select1 (Sub64borrow x y c))
14415 // result: (NEG (Select0 <typ.UInt64> (SUBE (MOVDconst [0]) (MOVDconst [0]) (Select1 <types.TypeFlags> (SUBE x y (Select1 <types.TypeFlags> (SUBC (MOVDconst [0]) c)))))))
14416 for {
14417 if v_0.Op != OpSub64borrow {
14418 break
14419 }
14420 c := v_0.Args[2]
14421 x := v_0.Args[0]
14422 y := v_0.Args[1]
14423 v.reset(OpS390XNEG)
14424 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
14425 v1 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags))
14426 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
14427 v2.AuxInt = int64ToAuxInt(0)
14428 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14429 v4 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags))
14430 v5 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14431 v6 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags))
14432 v6.AddArg2(v2, c)
14433 v5.AddArg(v6)
14434 v4.AddArg3(x, y, v5)
14435 v3.AddArg(v4)
14436 v1.AddArg3(v2, v2, v3)
14437 v0.AddArg(v1)
14438 v.AddArg(v0)
14439 return true
14440 }
14441 // match: (Select1 (AddTupleFirst32 _ tuple))
14442 // result: (Select1 tuple)
14443 for {
14444 if v_0.Op != OpS390XAddTupleFirst32 {
14445 break
14446 }
14447 tuple := v_0.Args[1]
14448 v.reset(OpSelect1)
14449 v.AddArg(tuple)
14450 return true
14451 }
14452 // match: (Select1 (AddTupleFirst64 _ tuple))
14453 // result: (Select1 tuple)
14454 for {
14455 if v_0.Op != OpS390XAddTupleFirst64 {
14456 break
14457 }
14458 tuple := v_0.Args[1]
14459 v.reset(OpSelect1)
14460 v.AddArg(tuple)
14461 return true
14462 }
14463 // match: (Select1 (ADDCconst (MOVDconst [c]) [d]))
14464 // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0
14465 // result: (FlagEQ)
14466 for {
14467 if v_0.Op != OpS390XADDCconst {
14468 break
14469 }
14470 d := auxIntToInt16(v_0.AuxInt)
14471 v_0_0 := v_0.Args[0]
14472 if v_0_0.Op != OpS390XMOVDconst {
14473 break
14474 }
14475 c := auxIntToInt64(v_0_0.AuxInt)
14476 if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0) {
14477 break
14478 }
14479 v.reset(OpS390XFlagEQ)
14480 return true
14481 }
14482 // match: (Select1 (ADDCconst (MOVDconst [c]) [d]))
14483 // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0
14484 // result: (FlagLT)
14485 for {
14486 if v_0.Op != OpS390XADDCconst {
14487 break
14488 }
14489 d := auxIntToInt16(v_0.AuxInt)
14490 v_0_0 := v_0.Args[0]
14491 if v_0_0.Op != OpS390XMOVDconst {
14492 break
14493 }
14494 c := auxIntToInt64(v_0_0.AuxInt)
14495 if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0) {
14496 break
14497 }
14498 v.reset(OpS390XFlagLT)
14499 return true
14500 }
14501 // match: (Select1 (SUBC (MOVDconst [c]) (MOVDconst [d])))
14502 // cond: uint64(d) <= uint64(c) && c-d == 0
14503 // result: (FlagGT)
14504 for {
14505 if v_0.Op != OpS390XSUBC {
14506 break
14507 }
14508 _ = v_0.Args[1]
14509 v_0_0 := v_0.Args[0]
14510 if v_0_0.Op != OpS390XMOVDconst {
14511 break
14512 }
14513 c := auxIntToInt64(v_0_0.AuxInt)
14514 v_0_1 := v_0.Args[1]
14515 if v_0_1.Op != OpS390XMOVDconst {
14516 break
14517 }
14518 d := auxIntToInt64(v_0_1.AuxInt)
14519 if !(uint64(d) <= uint64(c) && c-d == 0) {
14520 break
14521 }
14522 v.reset(OpS390XFlagGT)
14523 return true
14524 }
14525 // match: (Select1 (SUBC (MOVDconst [c]) (MOVDconst [d])))
14526 // cond: uint64(d) <= uint64(c) && c-d != 0
14527 // result: (FlagOV)
14528 for {
14529 if v_0.Op != OpS390XSUBC {
14530 break
14531 }
14532 _ = v_0.Args[1]
14533 v_0_0 := v_0.Args[0]
14534 if v_0_0.Op != OpS390XMOVDconst {
14535 break
14536 }
14537 c := auxIntToInt64(v_0_0.AuxInt)
14538 v_0_1 := v_0.Args[1]
14539 if v_0_1.Op != OpS390XMOVDconst {
14540 break
14541 }
14542 d := auxIntToInt64(v_0_1.AuxInt)
14543 if !(uint64(d) <= uint64(c) && c-d != 0) {
14544 break
14545 }
14546 v.reset(OpS390XFlagOV)
14547 return true
14548 }
14549 return false
14550 }
14551 func rewriteValueS390X_OpSlicemask(v *Value) bool {
14552 v_0 := v.Args[0]
14553 b := v.Block
14554 // match: (Slicemask <t> x)
14555 // result: (SRADconst (NEG <t> x) [63])
14556 for {
14557 t := v.Type
14558 x := v_0
14559 v.reset(OpS390XSRADconst)
14560 v.AuxInt = uint8ToAuxInt(63)
14561 v0 := b.NewValue0(v.Pos, OpS390XNEG, t)
14562 v0.AddArg(x)
14563 v.AddArg(v0)
14564 return true
14565 }
14566 }
14567 func rewriteValueS390X_OpStore(v *Value) bool {
14568 v_2 := v.Args[2]
14569 v_1 := v.Args[1]
14570 v_0 := v.Args[0]
14571 // match: (Store {t} ptr val mem)
14572 // cond: t.Size() == 8 && t.IsFloat()
14573 // result: (FMOVDstore ptr val mem)
14574 for {
14575 t := auxToType(v.Aux)
14576 ptr := v_0
14577 val := v_1
14578 mem := v_2
14579 if !(t.Size() == 8 && t.IsFloat()) {
14580 break
14581 }
14582 v.reset(OpS390XFMOVDstore)
14583 v.AddArg3(ptr, val, mem)
14584 return true
14585 }
14586 // match: (Store {t} ptr val mem)
14587 // cond: t.Size() == 4 && t.IsFloat()
14588 // result: (FMOVSstore ptr val mem)
14589 for {
14590 t := auxToType(v.Aux)
14591 ptr := v_0
14592 val := v_1
14593 mem := v_2
14594 if !(t.Size() == 4 && t.IsFloat()) {
14595 break
14596 }
14597 v.reset(OpS390XFMOVSstore)
14598 v.AddArg3(ptr, val, mem)
14599 return true
14600 }
14601 // match: (Store {t} ptr val mem)
14602 // cond: t.Size() == 8 && !t.IsFloat()
14603 // result: (MOVDstore ptr val mem)
14604 for {
14605 t := auxToType(v.Aux)
14606 ptr := v_0
14607 val := v_1
14608 mem := v_2
14609 if !(t.Size() == 8 && !t.IsFloat()) {
14610 break
14611 }
14612 v.reset(OpS390XMOVDstore)
14613 v.AddArg3(ptr, val, mem)
14614 return true
14615 }
14616 // match: (Store {t} ptr val mem)
14617 // cond: t.Size() == 4 && !t.IsFloat()
14618 // result: (MOVWstore 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() == 4 && !t.IsFloat()) {
14625 break
14626 }
14627 v.reset(OpS390XMOVWstore)
14628 v.AddArg3(ptr, val, mem)
14629 return true
14630 }
14631 // match: (Store {t} ptr val mem)
14632 // cond: t.Size() == 2
14633 // result: (MOVHstore 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() == 2) {
14640 break
14641 }
14642 v.reset(OpS390XMOVHstore)
14643 v.AddArg3(ptr, val, mem)
14644 return true
14645 }
14646 // match: (Store {t} ptr val mem)
14647 // cond: t.Size() == 1
14648 // result: (MOVBstore 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() == 1) {
14655 break
14656 }
14657 v.reset(OpS390XMOVBstore)
14658 v.AddArg3(ptr, val, mem)
14659 return true
14660 }
14661 return false
14662 }
14663 func rewriteValueS390X_OpSub32F(v *Value) bool {
14664 v_1 := v.Args[1]
14665 v_0 := v.Args[0]
14666 b := v.Block
14667 typ := &b.Func.Config.Types
14668 // match: (Sub32F x y)
14669 // result: (Select0 (FSUBS x y))
14670 for {
14671 x := v_0
14672 y := v_1
14673 v.reset(OpSelect0)
14674 v0 := b.NewValue0(v.Pos, OpS390XFSUBS, types.NewTuple(typ.Float32, types.TypeFlags))
14675 v0.AddArg2(x, y)
14676 v.AddArg(v0)
14677 return true
14678 }
14679 }
14680 func rewriteValueS390X_OpSub64F(v *Value) bool {
14681 v_1 := v.Args[1]
14682 v_0 := v.Args[0]
14683 b := v.Block
14684 typ := &b.Func.Config.Types
14685 // match: (Sub64F x y)
14686 // result: (Select0 (FSUB x y))
14687 for {
14688 x := v_0
14689 y := v_1
14690 v.reset(OpSelect0)
14691 v0 := b.NewValue0(v.Pos, OpS390XFSUB, types.NewTuple(typ.Float64, types.TypeFlags))
14692 v0.AddArg2(x, y)
14693 v.AddArg(v0)
14694 return true
14695 }
14696 }
14697 func rewriteValueS390X_OpTrunc(v *Value) bool {
14698 v_0 := v.Args[0]
14699 // match: (Trunc x)
14700 // result: (FIDBR [5] x)
14701 for {
14702 x := v_0
14703 v.reset(OpS390XFIDBR)
14704 v.AuxInt = int8ToAuxInt(5)
14705 v.AddArg(x)
14706 return true
14707 }
14708 }
14709 func rewriteValueS390X_OpZero(v *Value) bool {
14710 v_1 := v.Args[1]
14711 v_0 := v.Args[0]
14712 b := v.Block
14713 // match: (Zero [0] _ mem)
14714 // result: mem
14715 for {
14716 if auxIntToInt64(v.AuxInt) != 0 {
14717 break
14718 }
14719 mem := v_1
14720 v.copyOf(mem)
14721 return true
14722 }
14723 // match: (Zero [1] destptr mem)
14724 // result: (MOVBstoreconst [0] destptr mem)
14725 for {
14726 if auxIntToInt64(v.AuxInt) != 1 {
14727 break
14728 }
14729 destptr := v_0
14730 mem := v_1
14731 v.reset(OpS390XMOVBstoreconst)
14732 v.AuxInt = valAndOffToAuxInt(0)
14733 v.AddArg2(destptr, mem)
14734 return true
14735 }
14736 // match: (Zero [2] destptr mem)
14737 // result: (MOVHstoreconst [0] destptr mem)
14738 for {
14739 if auxIntToInt64(v.AuxInt) != 2 {
14740 break
14741 }
14742 destptr := v_0
14743 mem := v_1
14744 v.reset(OpS390XMOVHstoreconst)
14745 v.AuxInt = valAndOffToAuxInt(0)
14746 v.AddArg2(destptr, mem)
14747 return true
14748 }
14749 // match: (Zero [4] destptr mem)
14750 // result: (MOVWstoreconst [0] destptr mem)
14751 for {
14752 if auxIntToInt64(v.AuxInt) != 4 {
14753 break
14754 }
14755 destptr := v_0
14756 mem := v_1
14757 v.reset(OpS390XMOVWstoreconst)
14758 v.AuxInt = valAndOffToAuxInt(0)
14759 v.AddArg2(destptr, mem)
14760 return true
14761 }
14762 // match: (Zero [8] destptr mem)
14763 // result: (MOVDstoreconst [0] destptr mem)
14764 for {
14765 if auxIntToInt64(v.AuxInt) != 8 {
14766 break
14767 }
14768 destptr := v_0
14769 mem := v_1
14770 v.reset(OpS390XMOVDstoreconst)
14771 v.AuxInt = valAndOffToAuxInt(0)
14772 v.AddArg2(destptr, mem)
14773 return true
14774 }
14775 // match: (Zero [3] destptr mem)
14776 // result: (MOVBstoreconst [makeValAndOff(0,2)] destptr (MOVHstoreconst [0] destptr mem))
14777 for {
14778 if auxIntToInt64(v.AuxInt) != 3 {
14779 break
14780 }
14781 destptr := v_0
14782 mem := v_1
14783 v.reset(OpS390XMOVBstoreconst)
14784 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 2))
14785 v0 := b.NewValue0(v.Pos, OpS390XMOVHstoreconst, types.TypeMem)
14786 v0.AuxInt = valAndOffToAuxInt(0)
14787 v0.AddArg2(destptr, mem)
14788 v.AddArg2(destptr, v0)
14789 return true
14790 }
14791 // match: (Zero [5] destptr mem)
14792 // result: (MOVBstoreconst [makeValAndOff(0,4)] destptr (MOVWstoreconst [0] destptr mem))
14793 for {
14794 if auxIntToInt64(v.AuxInt) != 5 {
14795 break
14796 }
14797 destptr := v_0
14798 mem := v_1
14799 v.reset(OpS390XMOVBstoreconst)
14800 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
14801 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem)
14802 v0.AuxInt = valAndOffToAuxInt(0)
14803 v0.AddArg2(destptr, mem)
14804 v.AddArg2(destptr, v0)
14805 return true
14806 }
14807 // match: (Zero [6] destptr mem)
14808 // result: (MOVHstoreconst [makeValAndOff(0,4)] destptr (MOVWstoreconst [0] destptr mem))
14809 for {
14810 if auxIntToInt64(v.AuxInt) != 6 {
14811 break
14812 }
14813 destptr := v_0
14814 mem := v_1
14815 v.reset(OpS390XMOVHstoreconst)
14816 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
14817 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem)
14818 v0.AuxInt = valAndOffToAuxInt(0)
14819 v0.AddArg2(destptr, mem)
14820 v.AddArg2(destptr, v0)
14821 return true
14822 }
14823 // match: (Zero [7] destptr mem)
14824 // result: (MOVWstoreconst [makeValAndOff(0,3)] destptr (MOVWstoreconst [0] destptr mem))
14825 for {
14826 if auxIntToInt64(v.AuxInt) != 7 {
14827 break
14828 }
14829 destptr := v_0
14830 mem := v_1
14831 v.reset(OpS390XMOVWstoreconst)
14832 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 3))
14833 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem)
14834 v0.AuxInt = valAndOffToAuxInt(0)
14835 v0.AddArg2(destptr, mem)
14836 v.AddArg2(destptr, v0)
14837 return true
14838 }
14839 // match: (Zero [s] destptr mem)
14840 // cond: s > 0 && s <= 1024
14841 // result: (CLEAR [makeValAndOff(int32(s), 0)] destptr mem)
14842 for {
14843 s := auxIntToInt64(v.AuxInt)
14844 destptr := v_0
14845 mem := v_1
14846 if !(s > 0 && s <= 1024) {
14847 break
14848 }
14849 v.reset(OpS390XCLEAR)
14850 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s), 0))
14851 v.AddArg2(destptr, mem)
14852 return true
14853 }
14854 // match: (Zero [s] destptr mem)
14855 // cond: s > 1024
14856 // result: (LoweredZero [s%256] destptr (ADDconst <destptr.Type> destptr [(int32(s)/256)*256]) mem)
14857 for {
14858 s := auxIntToInt64(v.AuxInt)
14859 destptr := v_0
14860 mem := v_1
14861 if !(s > 1024) {
14862 break
14863 }
14864 v.reset(OpS390XLoweredZero)
14865 v.AuxInt = int64ToAuxInt(s % 256)
14866 v0 := b.NewValue0(v.Pos, OpS390XADDconst, destptr.Type)
14867 v0.AuxInt = int32ToAuxInt((int32(s) / 256) * 256)
14868 v0.AddArg(destptr)
14869 v.AddArg3(destptr, v0, mem)
14870 return true
14871 }
14872 return false
14873 }
14874 func rewriteBlockS390X(b *Block) bool {
14875 typ := &b.Func.Config.Types
14876 switch b.Kind {
14877 case BlockS390XBRC:
14878 // match: (BRC {c} x:(CMP _ _) yes no)
14879 // cond: c&s390x.Unordered != 0
14880 // result: (BRC {c&^s390x.Unordered} x yes no)
14881 for b.Controls[0].Op == OpS390XCMP {
14882 x := b.Controls[0]
14883 c := auxToS390xCCMask(b.Aux)
14884 if !(c&s390x.Unordered != 0) {
14885 break
14886 }
14887 b.resetWithControl(BlockS390XBRC, x)
14888 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14889 return true
14890 }
14891 // match: (BRC {c} x:(CMPW _ _) yes no)
14892 // cond: c&s390x.Unordered != 0
14893 // result: (BRC {c&^s390x.Unordered} x yes no)
14894 for b.Controls[0].Op == OpS390XCMPW {
14895 x := b.Controls[0]
14896 c := auxToS390xCCMask(b.Aux)
14897 if !(c&s390x.Unordered != 0) {
14898 break
14899 }
14900 b.resetWithControl(BlockS390XBRC, x)
14901 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14902 return true
14903 }
14904 // match: (BRC {c} x:(CMPU _ _) yes no)
14905 // cond: c&s390x.Unordered != 0
14906 // result: (BRC {c&^s390x.Unordered} x yes no)
14907 for b.Controls[0].Op == OpS390XCMPU {
14908 x := b.Controls[0]
14909 c := auxToS390xCCMask(b.Aux)
14910 if !(c&s390x.Unordered != 0) {
14911 break
14912 }
14913 b.resetWithControl(BlockS390XBRC, x)
14914 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14915 return true
14916 }
14917 // match: (BRC {c} x:(CMPWU _ _) yes no)
14918 // cond: c&s390x.Unordered != 0
14919 // result: (BRC {c&^s390x.Unordered} x yes no)
14920 for b.Controls[0].Op == OpS390XCMPWU {
14921 x := b.Controls[0]
14922 c := auxToS390xCCMask(b.Aux)
14923 if !(c&s390x.Unordered != 0) {
14924 break
14925 }
14926 b.resetWithControl(BlockS390XBRC, x)
14927 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14928 return true
14929 }
14930 // match: (BRC {c} x:(CMPconst _) yes no)
14931 // cond: c&s390x.Unordered != 0
14932 // result: (BRC {c&^s390x.Unordered} x yes no)
14933 for b.Controls[0].Op == OpS390XCMPconst {
14934 x := b.Controls[0]
14935 c := auxToS390xCCMask(b.Aux)
14936 if !(c&s390x.Unordered != 0) {
14937 break
14938 }
14939 b.resetWithControl(BlockS390XBRC, x)
14940 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14941 return true
14942 }
14943 // match: (BRC {c} x:(CMPWconst _) yes no)
14944 // cond: c&s390x.Unordered != 0
14945 // result: (BRC {c&^s390x.Unordered} x yes no)
14946 for b.Controls[0].Op == OpS390XCMPWconst {
14947 x := b.Controls[0]
14948 c := auxToS390xCCMask(b.Aux)
14949 if !(c&s390x.Unordered != 0) {
14950 break
14951 }
14952 b.resetWithControl(BlockS390XBRC, x)
14953 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14954 return true
14955 }
14956 // match: (BRC {c} x:(CMPUconst _) yes no)
14957 // cond: c&s390x.Unordered != 0
14958 // result: (BRC {c&^s390x.Unordered} x yes no)
14959 for b.Controls[0].Op == OpS390XCMPUconst {
14960 x := b.Controls[0]
14961 c := auxToS390xCCMask(b.Aux)
14962 if !(c&s390x.Unordered != 0) {
14963 break
14964 }
14965 b.resetWithControl(BlockS390XBRC, x)
14966 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14967 return true
14968 }
14969 // match: (BRC {c} x:(CMPWUconst _) yes no)
14970 // cond: c&s390x.Unordered != 0
14971 // result: (BRC {c&^s390x.Unordered} x yes no)
14972 for b.Controls[0].Op == OpS390XCMPWUconst {
14973 x := b.Controls[0]
14974 c := auxToS390xCCMask(b.Aux)
14975 if !(c&s390x.Unordered != 0) {
14976 break
14977 }
14978 b.resetWithControl(BlockS390XBRC, x)
14979 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14980 return true
14981 }
14982 // match: (BRC {c} (CMP x y) yes no)
14983 // result: (CGRJ {c&^s390x.Unordered} x y yes no)
14984 for b.Controls[0].Op == OpS390XCMP {
14985 v_0 := b.Controls[0]
14986 y := v_0.Args[1]
14987 x := v_0.Args[0]
14988 c := auxToS390xCCMask(b.Aux)
14989 b.resetWithControl2(BlockS390XCGRJ, x, y)
14990 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
14991 return true
14992 }
14993 // match: (BRC {c} (CMPW x y) yes no)
14994 // result: (CRJ {c&^s390x.Unordered} x y yes no)
14995 for b.Controls[0].Op == OpS390XCMPW {
14996 v_0 := b.Controls[0]
14997 y := v_0.Args[1]
14998 x := v_0.Args[0]
14999 c := auxToS390xCCMask(b.Aux)
15000 b.resetWithControl2(BlockS390XCRJ, x, y)
15001 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15002 return true
15003 }
15004 // match: (BRC {c} (CMPU x y) yes no)
15005 // result: (CLGRJ {c&^s390x.Unordered} x y yes no)
15006 for b.Controls[0].Op == OpS390XCMPU {
15007 v_0 := b.Controls[0]
15008 y := v_0.Args[1]
15009 x := v_0.Args[0]
15010 c := auxToS390xCCMask(b.Aux)
15011 b.resetWithControl2(BlockS390XCLGRJ, x, y)
15012 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15013 return true
15014 }
15015 // match: (BRC {c} (CMPWU x y) yes no)
15016 // result: (CLRJ {c&^s390x.Unordered} x y yes no)
15017 for b.Controls[0].Op == OpS390XCMPWU {
15018 v_0 := b.Controls[0]
15019 y := v_0.Args[1]
15020 x := v_0.Args[0]
15021 c := auxToS390xCCMask(b.Aux)
15022 b.resetWithControl2(BlockS390XCLRJ, x, y)
15023 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15024 return true
15025 }
15026 // match: (BRC {c} (CMPconst x [y]) yes no)
15027 // cond: y == int32( int8(y))
15028 // result: (CGIJ {c&^s390x.Unordered} x [ int8(y)] yes no)
15029 for b.Controls[0].Op == OpS390XCMPconst {
15030 v_0 := b.Controls[0]
15031 y := auxIntToInt32(v_0.AuxInt)
15032 x := v_0.Args[0]
15033 c := auxToS390xCCMask(b.Aux)
15034 if !(y == int32(int8(y))) {
15035 break
15036 }
15037 b.resetWithControl(BlockS390XCGIJ, x)
15038 b.AuxInt = int8ToAuxInt(int8(y))
15039 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15040 return true
15041 }
15042 // match: (BRC {c} (CMPWconst x [y]) yes no)
15043 // cond: y == int32( int8(y))
15044 // result: (CIJ {c&^s390x.Unordered} x [ int8(y)] yes no)
15045 for b.Controls[0].Op == OpS390XCMPWconst {
15046 v_0 := b.Controls[0]
15047 y := auxIntToInt32(v_0.AuxInt)
15048 x := v_0.Args[0]
15049 c := auxToS390xCCMask(b.Aux)
15050 if !(y == int32(int8(y))) {
15051 break
15052 }
15053 b.resetWithControl(BlockS390XCIJ, x)
15054 b.AuxInt = int8ToAuxInt(int8(y))
15055 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15056 return true
15057 }
15058 // match: (BRC {c} (CMPUconst x [y]) yes no)
15059 // cond: y == int32(uint8(y))
15060 // result: (CLGIJ {c&^s390x.Unordered} x [uint8(y)] yes no)
15061 for b.Controls[0].Op == OpS390XCMPUconst {
15062 v_0 := b.Controls[0]
15063 y := auxIntToInt32(v_0.AuxInt)
15064 x := v_0.Args[0]
15065 c := auxToS390xCCMask(b.Aux)
15066 if !(y == int32(uint8(y))) {
15067 break
15068 }
15069 b.resetWithControl(BlockS390XCLGIJ, x)
15070 b.AuxInt = uint8ToAuxInt(uint8(y))
15071 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15072 return true
15073 }
15074 // match: (BRC {c} (CMPWUconst x [y]) yes no)
15075 // cond: y == int32(uint8(y))
15076 // result: (CLIJ {c&^s390x.Unordered} x [uint8(y)] yes no)
15077 for b.Controls[0].Op == OpS390XCMPWUconst {
15078 v_0 := b.Controls[0]
15079 y := auxIntToInt32(v_0.AuxInt)
15080 x := v_0.Args[0]
15081 c := auxToS390xCCMask(b.Aux)
15082 if !(y == int32(uint8(y))) {
15083 break
15084 }
15085 b.resetWithControl(BlockS390XCLIJ, x)
15086 b.AuxInt = uint8ToAuxInt(uint8(y))
15087 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered)
15088 return true
15089 }
15090 // match: (BRC {s390x.Less} (CMPconst x [ 128]) yes no)
15091 // result: (CGIJ {s390x.LessOrEqual} x [ 127] yes no)
15092 for b.Controls[0].Op == OpS390XCMPconst {
15093 v_0 := b.Controls[0]
15094 if auxIntToInt32(v_0.AuxInt) != 128 {
15095 break
15096 }
15097 x := v_0.Args[0]
15098 if auxToS390xCCMask(b.Aux) != s390x.Less {
15099 break
15100 }
15101 b.resetWithControl(BlockS390XCGIJ, x)
15102 b.AuxInt = int8ToAuxInt(127)
15103 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
15104 return true
15105 }
15106 // match: (BRC {s390x.Less} (CMPWconst x [ 128]) yes no)
15107 // result: (CIJ {s390x.LessOrEqual} x [ 127] yes no)
15108 for b.Controls[0].Op == OpS390XCMPWconst {
15109 v_0 := b.Controls[0]
15110 if auxIntToInt32(v_0.AuxInt) != 128 {
15111 break
15112 }
15113 x := v_0.Args[0]
15114 if auxToS390xCCMask(b.Aux) != s390x.Less {
15115 break
15116 }
15117 b.resetWithControl(BlockS390XCIJ, x)
15118 b.AuxInt = int8ToAuxInt(127)
15119 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
15120 return true
15121 }
15122 // match: (BRC {s390x.LessOrEqual} (CMPconst x [-129]) yes no)
15123 // result: (CGIJ {s390x.Less} x [-128] yes no)
15124 for b.Controls[0].Op == OpS390XCMPconst {
15125 v_0 := b.Controls[0]
15126 if auxIntToInt32(v_0.AuxInt) != -129 {
15127 break
15128 }
15129 x := v_0.Args[0]
15130 if auxToS390xCCMask(b.Aux) != s390x.LessOrEqual {
15131 break
15132 }
15133 b.resetWithControl(BlockS390XCGIJ, x)
15134 b.AuxInt = int8ToAuxInt(-128)
15135 b.Aux = s390xCCMaskToAux(s390x.Less)
15136 return true
15137 }
15138 // match: (BRC {s390x.LessOrEqual} (CMPWconst x [-129]) yes no)
15139 // result: (CIJ {s390x.Less} x [-128] yes no)
15140 for b.Controls[0].Op == OpS390XCMPWconst {
15141 v_0 := b.Controls[0]
15142 if auxIntToInt32(v_0.AuxInt) != -129 {
15143 break
15144 }
15145 x := v_0.Args[0]
15146 if auxToS390xCCMask(b.Aux) != s390x.LessOrEqual {
15147 break
15148 }
15149 b.resetWithControl(BlockS390XCIJ, x)
15150 b.AuxInt = int8ToAuxInt(-128)
15151 b.Aux = s390xCCMaskToAux(s390x.Less)
15152 return true
15153 }
15154 // match: (BRC {s390x.Greater} (CMPconst x [-129]) yes no)
15155 // result: (CGIJ {s390x.GreaterOrEqual} x [-128] yes no)
15156 for b.Controls[0].Op == OpS390XCMPconst {
15157 v_0 := b.Controls[0]
15158 if auxIntToInt32(v_0.AuxInt) != -129 {
15159 break
15160 }
15161 x := v_0.Args[0]
15162 if auxToS390xCCMask(b.Aux) != s390x.Greater {
15163 break
15164 }
15165 b.resetWithControl(BlockS390XCGIJ, x)
15166 b.AuxInt = int8ToAuxInt(-128)
15167 b.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
15168 return true
15169 }
15170 // match: (BRC {s390x.Greater} (CMPWconst x [-129]) yes no)
15171 // result: (CIJ {s390x.GreaterOrEqual} x [-128] yes no)
15172 for b.Controls[0].Op == OpS390XCMPWconst {
15173 v_0 := b.Controls[0]
15174 if auxIntToInt32(v_0.AuxInt) != -129 {
15175 break
15176 }
15177 x := v_0.Args[0]
15178 if auxToS390xCCMask(b.Aux) != s390x.Greater {
15179 break
15180 }
15181 b.resetWithControl(BlockS390XCIJ, x)
15182 b.AuxInt = int8ToAuxInt(-128)
15183 b.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual)
15184 return true
15185 }
15186 // match: (BRC {s390x.GreaterOrEqual} (CMPconst x [ 128]) yes no)
15187 // result: (CGIJ {s390x.Greater} x [ 127] yes no)
15188 for b.Controls[0].Op == OpS390XCMPconst {
15189 v_0 := b.Controls[0]
15190 if auxIntToInt32(v_0.AuxInt) != 128 {
15191 break
15192 }
15193 x := v_0.Args[0]
15194 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
15195 break
15196 }
15197 b.resetWithControl(BlockS390XCGIJ, x)
15198 b.AuxInt = int8ToAuxInt(127)
15199 b.Aux = s390xCCMaskToAux(s390x.Greater)
15200 return true
15201 }
15202 // match: (BRC {s390x.GreaterOrEqual} (CMPWconst x [ 128]) yes no)
15203 // result: (CIJ {s390x.Greater} x [ 127] yes no)
15204 for b.Controls[0].Op == OpS390XCMPWconst {
15205 v_0 := b.Controls[0]
15206 if auxIntToInt32(v_0.AuxInt) != 128 {
15207 break
15208 }
15209 x := v_0.Args[0]
15210 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
15211 break
15212 }
15213 b.resetWithControl(BlockS390XCIJ, x)
15214 b.AuxInt = int8ToAuxInt(127)
15215 b.Aux = s390xCCMaskToAux(s390x.Greater)
15216 return true
15217 }
15218 // match: (BRC {s390x.Less} (CMPWUconst x [256]) yes no)
15219 // result: (CLIJ {s390x.LessOrEqual} x [255] yes no)
15220 for b.Controls[0].Op == OpS390XCMPWUconst {
15221 v_0 := b.Controls[0]
15222 if auxIntToInt32(v_0.AuxInt) != 256 {
15223 break
15224 }
15225 x := v_0.Args[0]
15226 if auxToS390xCCMask(b.Aux) != s390x.Less {
15227 break
15228 }
15229 b.resetWithControl(BlockS390XCLIJ, x)
15230 b.AuxInt = uint8ToAuxInt(255)
15231 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
15232 return true
15233 }
15234 // match: (BRC {s390x.Less} (CMPUconst x [256]) yes no)
15235 // result: (CLGIJ {s390x.LessOrEqual} x [255] yes no)
15236 for b.Controls[0].Op == OpS390XCMPUconst {
15237 v_0 := b.Controls[0]
15238 if auxIntToInt32(v_0.AuxInt) != 256 {
15239 break
15240 }
15241 x := v_0.Args[0]
15242 if auxToS390xCCMask(b.Aux) != s390x.Less {
15243 break
15244 }
15245 b.resetWithControl(BlockS390XCLGIJ, x)
15246 b.AuxInt = uint8ToAuxInt(255)
15247 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual)
15248 return true
15249 }
15250 // match: (BRC {s390x.GreaterOrEqual} (CMPWUconst x [256]) yes no)
15251 // result: (CLIJ {s390x.Greater} x [255] yes no)
15252 for b.Controls[0].Op == OpS390XCMPWUconst {
15253 v_0 := b.Controls[0]
15254 if auxIntToInt32(v_0.AuxInt) != 256 {
15255 break
15256 }
15257 x := v_0.Args[0]
15258 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
15259 break
15260 }
15261 b.resetWithControl(BlockS390XCLIJ, x)
15262 b.AuxInt = uint8ToAuxInt(255)
15263 b.Aux = s390xCCMaskToAux(s390x.Greater)
15264 return true
15265 }
15266 // match: (BRC {s390x.GreaterOrEqual} (CMPUconst x [256]) yes no)
15267 // result: (CLGIJ {s390x.Greater} x [255] yes no)
15268 for b.Controls[0].Op == OpS390XCMPUconst {
15269 v_0 := b.Controls[0]
15270 if auxIntToInt32(v_0.AuxInt) != 256 {
15271 break
15272 }
15273 x := v_0.Args[0]
15274 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
15275 break
15276 }
15277 b.resetWithControl(BlockS390XCLGIJ, x)
15278 b.AuxInt = uint8ToAuxInt(255)
15279 b.Aux = s390xCCMaskToAux(s390x.Greater)
15280 return true
15281 }
15282 // match: (BRC {c} (CMPconst x [y]) yes no)
15283 // cond: y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)
15284 // result: (CLGIJ {c} x [uint8(y)] yes no)
15285 for b.Controls[0].Op == OpS390XCMPconst {
15286 v_0 := b.Controls[0]
15287 y := auxIntToInt32(v_0.AuxInt)
15288 x := v_0.Args[0]
15289 c := auxToS390xCCMask(b.Aux)
15290 if !(y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) {
15291 break
15292 }
15293 b.resetWithControl(BlockS390XCLGIJ, x)
15294 b.AuxInt = uint8ToAuxInt(uint8(y))
15295 b.Aux = s390xCCMaskToAux(c)
15296 return true
15297 }
15298 // match: (BRC {c} (CMPWconst x [y]) yes no)
15299 // cond: y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)
15300 // result: (CLIJ {c} x [uint8(y)] yes no)
15301 for b.Controls[0].Op == OpS390XCMPWconst {
15302 v_0 := b.Controls[0]
15303 y := auxIntToInt32(v_0.AuxInt)
15304 x := v_0.Args[0]
15305 c := auxToS390xCCMask(b.Aux)
15306 if !(y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) {
15307 break
15308 }
15309 b.resetWithControl(BlockS390XCLIJ, x)
15310 b.AuxInt = uint8ToAuxInt(uint8(y))
15311 b.Aux = s390xCCMaskToAux(c)
15312 return true
15313 }
15314 // match: (BRC {c} (CMPUconst x [y]) yes no)
15315 // cond: y == int32( int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)
15316 // result: (CGIJ {c} x [ int8(y)] yes no)
15317 for b.Controls[0].Op == OpS390XCMPUconst {
15318 v_0 := b.Controls[0]
15319 y := auxIntToInt32(v_0.AuxInt)
15320 x := v_0.Args[0]
15321 c := auxToS390xCCMask(b.Aux)
15322 if !(y == int32(int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) {
15323 break
15324 }
15325 b.resetWithControl(BlockS390XCGIJ, x)
15326 b.AuxInt = int8ToAuxInt(int8(y))
15327 b.Aux = s390xCCMaskToAux(c)
15328 return true
15329 }
15330 // match: (BRC {c} (CMPWUconst x [y]) yes no)
15331 // cond: y == int32( int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)
15332 // result: (CIJ {c} x [ int8(y)] yes no)
15333 for b.Controls[0].Op == OpS390XCMPWUconst {
15334 v_0 := b.Controls[0]
15335 y := auxIntToInt32(v_0.AuxInt)
15336 x := v_0.Args[0]
15337 c := auxToS390xCCMask(b.Aux)
15338 if !(y == int32(int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) {
15339 break
15340 }
15341 b.resetWithControl(BlockS390XCIJ, x)
15342 b.AuxInt = int8ToAuxInt(int8(y))
15343 b.Aux = s390xCCMaskToAux(c)
15344 return true
15345 }
15346 // match: (BRC {c} (InvertFlags cmp) yes no)
15347 // result: (BRC {c.ReverseComparison()} cmp yes no)
15348 for b.Controls[0].Op == OpS390XInvertFlags {
15349 v_0 := b.Controls[0]
15350 cmp := v_0.Args[0]
15351 c := auxToS390xCCMask(b.Aux)
15352 b.resetWithControl(BlockS390XBRC, cmp)
15353 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
15354 return true
15355 }
15356 // match: (BRC {c} (FlagEQ) yes no)
15357 // cond: c&s390x.Equal != 0
15358 // result: (First yes no)
15359 for b.Controls[0].Op == OpS390XFlagEQ {
15360 c := auxToS390xCCMask(b.Aux)
15361 if !(c&s390x.Equal != 0) {
15362 break
15363 }
15364 b.Reset(BlockFirst)
15365 return true
15366 }
15367 // match: (BRC {c} (FlagLT) yes no)
15368 // cond: c&s390x.Less != 0
15369 // result: (First yes no)
15370 for b.Controls[0].Op == OpS390XFlagLT {
15371 c := auxToS390xCCMask(b.Aux)
15372 if !(c&s390x.Less != 0) {
15373 break
15374 }
15375 b.Reset(BlockFirst)
15376 return true
15377 }
15378 // match: (BRC {c} (FlagGT) yes no)
15379 // cond: c&s390x.Greater != 0
15380 // result: (First yes no)
15381 for b.Controls[0].Op == OpS390XFlagGT {
15382 c := auxToS390xCCMask(b.Aux)
15383 if !(c&s390x.Greater != 0) {
15384 break
15385 }
15386 b.Reset(BlockFirst)
15387 return true
15388 }
15389 // match: (BRC {c} (FlagOV) yes no)
15390 // cond: c&s390x.Unordered != 0
15391 // result: (First yes no)
15392 for b.Controls[0].Op == OpS390XFlagOV {
15393 c := auxToS390xCCMask(b.Aux)
15394 if !(c&s390x.Unordered != 0) {
15395 break
15396 }
15397 b.Reset(BlockFirst)
15398 return true
15399 }
15400 // match: (BRC {c} (FlagEQ) yes no)
15401 // cond: c&s390x.Equal == 0
15402 // result: (First no yes)
15403 for b.Controls[0].Op == OpS390XFlagEQ {
15404 c := auxToS390xCCMask(b.Aux)
15405 if !(c&s390x.Equal == 0) {
15406 break
15407 }
15408 b.Reset(BlockFirst)
15409 b.swapSuccessors()
15410 return true
15411 }
15412 // match: (BRC {c} (FlagLT) yes no)
15413 // cond: c&s390x.Less == 0
15414 // result: (First no yes)
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 b.swapSuccessors()
15422 return true
15423 }
15424 // match: (BRC {c} (FlagGT) yes no)
15425 // cond: c&s390x.Greater == 0
15426 // result: (First no yes)
15427 for b.Controls[0].Op == OpS390XFlagGT {
15428 c := auxToS390xCCMask(b.Aux)
15429 if !(c&s390x.Greater == 0) {
15430 break
15431 }
15432 b.Reset(BlockFirst)
15433 b.swapSuccessors()
15434 return true
15435 }
15436 // match: (BRC {c} (FlagOV) yes no)
15437 // cond: c&s390x.Unordered == 0
15438 // result: (First no yes)
15439 for b.Controls[0].Op == OpS390XFlagOV {
15440 c := auxToS390xCCMask(b.Aux)
15441 if !(c&s390x.Unordered == 0) {
15442 break
15443 }
15444 b.Reset(BlockFirst)
15445 b.swapSuccessors()
15446 return true
15447 }
15448 case BlockS390XCGIJ:
15449 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15450 // cond: c&s390x.Equal != 0 && int64(x) == int64(y)
15451 // result: (First yes no)
15452 for b.Controls[0].Op == OpS390XMOVDconst {
15453 v_0 := b.Controls[0]
15454 x := auxIntToInt64(v_0.AuxInt)
15455 y := auxIntToInt8(b.AuxInt)
15456 c := auxToS390xCCMask(b.Aux)
15457 if !(c&s390x.Equal != 0 && int64(x) == int64(y)) {
15458 break
15459 }
15460 b.Reset(BlockFirst)
15461 return true
15462 }
15463 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15464 // cond: c&s390x.Less != 0 && int64(x) < int64(y)
15465 // result: (First yes no)
15466 for b.Controls[0].Op == OpS390XMOVDconst {
15467 v_0 := b.Controls[0]
15468 x := auxIntToInt64(v_0.AuxInt)
15469 y := auxIntToInt8(b.AuxInt)
15470 c := auxToS390xCCMask(b.Aux)
15471 if !(c&s390x.Less != 0 && int64(x) < int64(y)) {
15472 break
15473 }
15474 b.Reset(BlockFirst)
15475 return true
15476 }
15477 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15478 // cond: c&s390x.Greater != 0 && int64(x) > int64(y)
15479 // result: (First yes no)
15480 for b.Controls[0].Op == OpS390XMOVDconst {
15481 v_0 := b.Controls[0]
15482 x := auxIntToInt64(v_0.AuxInt)
15483 y := auxIntToInt8(b.AuxInt)
15484 c := auxToS390xCCMask(b.Aux)
15485 if !(c&s390x.Greater != 0 && int64(x) > int64(y)) {
15486 break
15487 }
15488 b.Reset(BlockFirst)
15489 return true
15490 }
15491 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15492 // cond: c&s390x.Equal == 0 && int64(x) == int64(y)
15493 // result: (First no yes)
15494 for b.Controls[0].Op == OpS390XMOVDconst {
15495 v_0 := b.Controls[0]
15496 x := auxIntToInt64(v_0.AuxInt)
15497 y := auxIntToInt8(b.AuxInt)
15498 c := auxToS390xCCMask(b.Aux)
15499 if !(c&s390x.Equal == 0 && int64(x) == int64(y)) {
15500 break
15501 }
15502 b.Reset(BlockFirst)
15503 b.swapSuccessors()
15504 return true
15505 }
15506 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15507 // cond: c&s390x.Less == 0 && int64(x) < int64(y)
15508 // result: (First no yes)
15509 for b.Controls[0].Op == OpS390XMOVDconst {
15510 v_0 := b.Controls[0]
15511 x := auxIntToInt64(v_0.AuxInt)
15512 y := auxIntToInt8(b.AuxInt)
15513 c := auxToS390xCCMask(b.Aux)
15514 if !(c&s390x.Less == 0 && int64(x) < int64(y)) {
15515 break
15516 }
15517 b.Reset(BlockFirst)
15518 b.swapSuccessors()
15519 return true
15520 }
15521 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no)
15522 // cond: c&s390x.Greater == 0 && int64(x) > int64(y)
15523 // result: (First no yes)
15524 for b.Controls[0].Op == OpS390XMOVDconst {
15525 v_0 := b.Controls[0]
15526 x := auxIntToInt64(v_0.AuxInt)
15527 y := auxIntToInt8(b.AuxInt)
15528 c := auxToS390xCCMask(b.Aux)
15529 if !(c&s390x.Greater == 0 && int64(x) > int64(y)) {
15530 break
15531 }
15532 b.Reset(BlockFirst)
15533 b.swapSuccessors()
15534 return true
15535 }
15536 // match: (CGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
15537 // result: (BRC {s390x.NoCarry} carry)
15538 for b.Controls[0].Op == OpSelect0 {
15539 v_0 := b.Controls[0]
15540 v_0_0 := v_0.Args[0]
15541 if v_0_0.Op != OpS390XADDE {
15542 break
15543 }
15544 carry := v_0_0.Args[2]
15545 v_0_0_0 := v_0_0.Args[0]
15546 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15547 break
15548 }
15549 v_0_0_1 := v_0_0.Args[1]
15550 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal {
15551 break
15552 }
15553 b.resetWithControl(BlockS390XBRC, carry)
15554 b.Aux = s390xCCMaskToAux(s390x.NoCarry)
15555 return true
15556 }
15557 // match: (CGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1])
15558 // result: (BRC {s390x.Carry} carry)
15559 for b.Controls[0].Op == OpSelect0 {
15560 v_0 := b.Controls[0]
15561 v_0_0 := v_0.Args[0]
15562 if v_0_0.Op != OpS390XADDE {
15563 break
15564 }
15565 carry := v_0_0.Args[2]
15566 v_0_0_0 := v_0_0.Args[0]
15567 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15568 break
15569 }
15570 v_0_0_1 := v_0_0.Args[1]
15571 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal {
15572 break
15573 }
15574 b.resetWithControl(BlockS390XBRC, carry)
15575 b.Aux = s390xCCMaskToAux(s390x.Carry)
15576 return true
15577 }
15578 // match: (CGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
15579 // result: (BRC {s390x.Carry} carry)
15580 for b.Controls[0].Op == OpSelect0 {
15581 v_0 := b.Controls[0]
15582 v_0_0 := v_0.Args[0]
15583 if v_0_0.Op != OpS390XADDE {
15584 break
15585 }
15586 carry := v_0_0.Args[2]
15587 v_0_0_0 := v_0_0.Args[0]
15588 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15589 break
15590 }
15591 v_0_0_1 := v_0_0.Args[1]
15592 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
15593 break
15594 }
15595 b.resetWithControl(BlockS390XBRC, carry)
15596 b.Aux = s390xCCMaskToAux(s390x.Carry)
15597 return true
15598 }
15599 // match: (CGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1])
15600 // result: (BRC {s390x.NoCarry} carry)
15601 for b.Controls[0].Op == OpSelect0 {
15602 v_0 := b.Controls[0]
15603 v_0_0 := v_0.Args[0]
15604 if v_0_0.Op != OpS390XADDE {
15605 break
15606 }
15607 carry := v_0_0.Args[2]
15608 v_0_0_0 := v_0_0.Args[0]
15609 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15610 break
15611 }
15612 v_0_0_1 := v_0_0.Args[1]
15613 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
15614 break
15615 }
15616 b.resetWithControl(BlockS390XBRC, carry)
15617 b.Aux = s390xCCMaskToAux(s390x.NoCarry)
15618 return true
15619 }
15620 // match: (CGIJ {s390x.Greater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
15621 // result: (BRC {s390x.Carry} carry)
15622 for b.Controls[0].Op == OpSelect0 {
15623 v_0 := b.Controls[0]
15624 v_0_0 := v_0.Args[0]
15625 if v_0_0.Op != OpS390XADDE {
15626 break
15627 }
15628 carry := v_0_0.Args[2]
15629 v_0_0_0 := v_0_0.Args[0]
15630 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
15631 break
15632 }
15633 v_0_0_1 := v_0_0.Args[1]
15634 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater {
15635 break
15636 }
15637 b.resetWithControl(BlockS390XBRC, carry)
15638 b.Aux = s390xCCMaskToAux(s390x.Carry)
15639 return true
15640 }
15641 // match: (CGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
15642 // result: (BRC {s390x.NoBorrow} borrow)
15643 for b.Controls[0].Op == OpS390XNEG {
15644 v_0 := b.Controls[0]
15645 v_0_0 := v_0.Args[0]
15646 if v_0_0.Op != OpSelect0 {
15647 break
15648 }
15649 v_0_0_0 := v_0_0.Args[0]
15650 if v_0_0_0.Op != OpS390XSUBE {
15651 break
15652 }
15653 borrow := v_0_0_0.Args[2]
15654 v_0_0_0_0 := v_0_0_0.Args[0]
15655 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15656 break
15657 }
15658 v_0_0_0_1 := v_0_0_0.Args[1]
15659 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 {
15660 break
15661 }
15662 b.resetWithControl(BlockS390XBRC, borrow)
15663 b.Aux = s390xCCMaskToAux(s390x.NoBorrow)
15664 return true
15665 }
15666 // match: (CGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1])
15667 // result: (BRC {s390x.Borrow} borrow)
15668 for b.Controls[0].Op == OpS390XNEG {
15669 v_0 := b.Controls[0]
15670 v_0_0 := v_0.Args[0]
15671 if v_0_0.Op != OpSelect0 {
15672 break
15673 }
15674 v_0_0_0 := v_0_0.Args[0]
15675 if v_0_0_0.Op != OpS390XSUBE {
15676 break
15677 }
15678 borrow := v_0_0_0.Args[2]
15679 v_0_0_0_0 := v_0_0_0.Args[0]
15680 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15681 break
15682 }
15683 v_0_0_0_1 := v_0_0_0.Args[1]
15684 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 {
15685 break
15686 }
15687 b.resetWithControl(BlockS390XBRC, borrow)
15688 b.Aux = s390xCCMaskToAux(s390x.Borrow)
15689 return true
15690 }
15691 // match: (CGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
15692 // result: (BRC {s390x.Borrow} borrow)
15693 for b.Controls[0].Op == OpS390XNEG {
15694 v_0 := b.Controls[0]
15695 v_0_0 := v_0.Args[0]
15696 if v_0_0.Op != OpSelect0 {
15697 break
15698 }
15699 v_0_0_0 := v_0_0.Args[0]
15700 if v_0_0_0.Op != OpS390XSUBE {
15701 break
15702 }
15703 borrow := v_0_0_0.Args[2]
15704 v_0_0_0_0 := v_0_0_0.Args[0]
15705 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15706 break
15707 }
15708 v_0_0_0_1 := v_0_0_0.Args[1]
15709 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 {
15710 break
15711 }
15712 b.resetWithControl(BlockS390XBRC, borrow)
15713 b.Aux = s390xCCMaskToAux(s390x.Borrow)
15714 return true
15715 }
15716 // match: (CGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1])
15717 // result: (BRC {s390x.NoBorrow} borrow)
15718 for b.Controls[0].Op == OpS390XNEG {
15719 v_0 := b.Controls[0]
15720 v_0_0 := v_0.Args[0]
15721 if v_0_0.Op != OpSelect0 {
15722 break
15723 }
15724 v_0_0_0 := v_0_0.Args[0]
15725 if v_0_0_0.Op != OpS390XSUBE {
15726 break
15727 }
15728 borrow := v_0_0_0.Args[2]
15729 v_0_0_0_0 := v_0_0_0.Args[0]
15730 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15731 break
15732 }
15733 v_0_0_0_1 := v_0_0_0.Args[1]
15734 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 {
15735 break
15736 }
15737 b.resetWithControl(BlockS390XBRC, borrow)
15738 b.Aux = s390xCCMaskToAux(s390x.NoBorrow)
15739 return true
15740 }
15741 // match: (CGIJ {s390x.Greater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
15742 // result: (BRC {s390x.Borrow} borrow)
15743 for b.Controls[0].Op == OpS390XNEG {
15744 v_0 := b.Controls[0]
15745 v_0_0 := v_0.Args[0]
15746 if v_0_0.Op != OpSelect0 {
15747 break
15748 }
15749 v_0_0_0 := v_0_0.Args[0]
15750 if v_0_0_0.Op != OpS390XSUBE {
15751 break
15752 }
15753 borrow := v_0_0_0.Args[2]
15754 v_0_0_0_0 := v_0_0_0.Args[0]
15755 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
15756 break
15757 }
15758 v_0_0_0_1 := v_0_0_0.Args[1]
15759 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 {
15760 break
15761 }
15762 b.resetWithControl(BlockS390XBRC, borrow)
15763 b.Aux = s390xCCMaskToAux(s390x.Borrow)
15764 return true
15765 }
15766 case BlockS390XCGRJ:
15767 // match: (CGRJ {c} x (MOVDconst [y]) yes no)
15768 // cond: is8Bit(y)
15769 // result: (CGIJ {c} x [ int8(y)] yes no)
15770 for b.Controls[1].Op == OpS390XMOVDconst {
15771 x := b.Controls[0]
15772 v_1 := b.Controls[1]
15773 y := auxIntToInt64(v_1.AuxInt)
15774 c := auxToS390xCCMask(b.Aux)
15775 if !(is8Bit(y)) {
15776 break
15777 }
15778 b.resetWithControl(BlockS390XCGIJ, x)
15779 b.AuxInt = int8ToAuxInt(int8(y))
15780 b.Aux = s390xCCMaskToAux(c)
15781 return true
15782 }
15783 // match: (CGRJ {c} (MOVDconst [x]) y yes no)
15784 // cond: is8Bit(x)
15785 // result: (CGIJ {c.ReverseComparison()} y [ int8(x)] yes no)
15786 for b.Controls[0].Op == OpS390XMOVDconst {
15787 v_0 := b.Controls[0]
15788 x := auxIntToInt64(v_0.AuxInt)
15789 y := b.Controls[1]
15790 c := auxToS390xCCMask(b.Aux)
15791 if !(is8Bit(x)) {
15792 break
15793 }
15794 b.resetWithControl(BlockS390XCGIJ, y)
15795 b.AuxInt = int8ToAuxInt(int8(x))
15796 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
15797 return true
15798 }
15799 // match: (CGRJ {c} x (MOVDconst [y]) yes no)
15800 // cond: !is8Bit(y) && is32Bit(y)
15801 // result: (BRC {c} (CMPconst x [int32(y)]) yes no)
15802 for b.Controls[1].Op == OpS390XMOVDconst {
15803 x := b.Controls[0]
15804 v_1 := b.Controls[1]
15805 y := auxIntToInt64(v_1.AuxInt)
15806 c := auxToS390xCCMask(b.Aux)
15807 if !(!is8Bit(y) && is32Bit(y)) {
15808 break
15809 }
15810 v0 := b.NewValue0(x.Pos, OpS390XCMPconst, types.TypeFlags)
15811 v0.AuxInt = int32ToAuxInt(int32(y))
15812 v0.AddArg(x)
15813 b.resetWithControl(BlockS390XBRC, v0)
15814 b.Aux = s390xCCMaskToAux(c)
15815 return true
15816 }
15817 // match: (CGRJ {c} (MOVDconst [x]) y yes no)
15818 // cond: !is8Bit(x) && is32Bit(x)
15819 // result: (BRC {c.ReverseComparison()} (CMPconst y [int32(x)]) yes no)
15820 for b.Controls[0].Op == OpS390XMOVDconst {
15821 v_0 := b.Controls[0]
15822 x := auxIntToInt64(v_0.AuxInt)
15823 y := b.Controls[1]
15824 c := auxToS390xCCMask(b.Aux)
15825 if !(!is8Bit(x) && is32Bit(x)) {
15826 break
15827 }
15828 v0 := b.NewValue0(v_0.Pos, OpS390XCMPconst, types.TypeFlags)
15829 v0.AuxInt = int32ToAuxInt(int32(x))
15830 v0.AddArg(y)
15831 b.resetWithControl(BlockS390XBRC, v0)
15832 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
15833 return true
15834 }
15835 // match: (CGRJ {c} x y yes no)
15836 // cond: x == y && c&s390x.Equal != 0
15837 // result: (First yes no)
15838 for {
15839 x := b.Controls[0]
15840 y := b.Controls[1]
15841 c := auxToS390xCCMask(b.Aux)
15842 if !(x == y && c&s390x.Equal != 0) {
15843 break
15844 }
15845 b.Reset(BlockFirst)
15846 return true
15847 }
15848 // match: (CGRJ {c} x y yes no)
15849 // cond: x == y && c&s390x.Equal == 0
15850 // result: (First no yes)
15851 for {
15852 x := b.Controls[0]
15853 y := b.Controls[1]
15854 c := auxToS390xCCMask(b.Aux)
15855 if !(x == y && c&s390x.Equal == 0) {
15856 break
15857 }
15858 b.Reset(BlockFirst)
15859 b.swapSuccessors()
15860 return true
15861 }
15862 case BlockS390XCIJ:
15863 // match: (CIJ {c} (MOVWreg x) [y] yes no)
15864 // result: (CIJ {c} x [y] yes no)
15865 for b.Controls[0].Op == OpS390XMOVWreg {
15866 v_0 := b.Controls[0]
15867 x := v_0.Args[0]
15868 y := auxIntToInt8(b.AuxInt)
15869 c := auxToS390xCCMask(b.Aux)
15870 b.resetWithControl(BlockS390XCIJ, x)
15871 b.AuxInt = int8ToAuxInt(y)
15872 b.Aux = s390xCCMaskToAux(c)
15873 return true
15874 }
15875 // match: (CIJ {c} (MOVWZreg x) [y] yes no)
15876 // result: (CIJ {c} x [y] yes no)
15877 for b.Controls[0].Op == OpS390XMOVWZreg {
15878 v_0 := b.Controls[0]
15879 x := v_0.Args[0]
15880 y := auxIntToInt8(b.AuxInt)
15881 c := auxToS390xCCMask(b.Aux)
15882 b.resetWithControl(BlockS390XCIJ, x)
15883 b.AuxInt = int8ToAuxInt(y)
15884 b.Aux = s390xCCMaskToAux(c)
15885 return true
15886 }
15887 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15888 // cond: c&s390x.Equal != 0 && int32(x) == int32(y)
15889 // result: (First yes no)
15890 for b.Controls[0].Op == OpS390XMOVDconst {
15891 v_0 := b.Controls[0]
15892 x := auxIntToInt64(v_0.AuxInt)
15893 y := auxIntToInt8(b.AuxInt)
15894 c := auxToS390xCCMask(b.Aux)
15895 if !(c&s390x.Equal != 0 && int32(x) == int32(y)) {
15896 break
15897 }
15898 b.Reset(BlockFirst)
15899 return true
15900 }
15901 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15902 // cond: c&s390x.Less != 0 && int32(x) < int32(y)
15903 // result: (First yes no)
15904 for b.Controls[0].Op == OpS390XMOVDconst {
15905 v_0 := b.Controls[0]
15906 x := auxIntToInt64(v_0.AuxInt)
15907 y := auxIntToInt8(b.AuxInt)
15908 c := auxToS390xCCMask(b.Aux)
15909 if !(c&s390x.Less != 0 && int32(x) < int32(y)) {
15910 break
15911 }
15912 b.Reset(BlockFirst)
15913 return true
15914 }
15915 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15916 // cond: c&s390x.Greater != 0 && int32(x) > int32(y)
15917 // result: (First yes no)
15918 for b.Controls[0].Op == OpS390XMOVDconst {
15919 v_0 := b.Controls[0]
15920 x := auxIntToInt64(v_0.AuxInt)
15921 y := auxIntToInt8(b.AuxInt)
15922 c := auxToS390xCCMask(b.Aux)
15923 if !(c&s390x.Greater != 0 && int32(x) > int32(y)) {
15924 break
15925 }
15926 b.Reset(BlockFirst)
15927 return true
15928 }
15929 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15930 // cond: c&s390x.Equal == 0 && int32(x) == int32(y)
15931 // result: (First no yes)
15932 for b.Controls[0].Op == OpS390XMOVDconst {
15933 v_0 := b.Controls[0]
15934 x := auxIntToInt64(v_0.AuxInt)
15935 y := auxIntToInt8(b.AuxInt)
15936 c := auxToS390xCCMask(b.Aux)
15937 if !(c&s390x.Equal == 0 && int32(x) == int32(y)) {
15938 break
15939 }
15940 b.Reset(BlockFirst)
15941 b.swapSuccessors()
15942 return true
15943 }
15944 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15945 // cond: c&s390x.Less == 0 && int32(x) < int32(y)
15946 // result: (First no yes)
15947 for b.Controls[0].Op == OpS390XMOVDconst {
15948 v_0 := b.Controls[0]
15949 x := auxIntToInt64(v_0.AuxInt)
15950 y := auxIntToInt8(b.AuxInt)
15951 c := auxToS390xCCMask(b.Aux)
15952 if !(c&s390x.Less == 0 && int32(x) < int32(y)) {
15953 break
15954 }
15955 b.Reset(BlockFirst)
15956 b.swapSuccessors()
15957 return true
15958 }
15959 // match: (CIJ {c} (MOVDconst [x]) [y] yes no)
15960 // cond: c&s390x.Greater == 0 && int32(x) > int32(y)
15961 // result: (First no yes)
15962 for b.Controls[0].Op == OpS390XMOVDconst {
15963 v_0 := b.Controls[0]
15964 x := auxIntToInt64(v_0.AuxInt)
15965 y := auxIntToInt8(b.AuxInt)
15966 c := auxToS390xCCMask(b.Aux)
15967 if !(c&s390x.Greater == 0 && int32(x) > int32(y)) {
15968 break
15969 }
15970 b.Reset(BlockFirst)
15971 b.swapSuccessors()
15972 return true
15973 }
15974 case BlockS390XCLGIJ:
15975 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
15976 // cond: c&s390x.Equal != 0 && uint64(x) == uint64(y)
15977 // result: (First yes no)
15978 for b.Controls[0].Op == OpS390XMOVDconst {
15979 v_0 := b.Controls[0]
15980 x := auxIntToInt64(v_0.AuxInt)
15981 y := auxIntToUint8(b.AuxInt)
15982 c := auxToS390xCCMask(b.Aux)
15983 if !(c&s390x.Equal != 0 && uint64(x) == uint64(y)) {
15984 break
15985 }
15986 b.Reset(BlockFirst)
15987 return true
15988 }
15989 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
15990 // cond: c&s390x.Less != 0 && uint64(x) < uint64(y)
15991 // result: (First yes no)
15992 for b.Controls[0].Op == OpS390XMOVDconst {
15993 v_0 := b.Controls[0]
15994 x := auxIntToInt64(v_0.AuxInt)
15995 y := auxIntToUint8(b.AuxInt)
15996 c := auxToS390xCCMask(b.Aux)
15997 if !(c&s390x.Less != 0 && uint64(x) < uint64(y)) {
15998 break
15999 }
16000 b.Reset(BlockFirst)
16001 return true
16002 }
16003 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16004 // cond: c&s390x.Greater != 0 && uint64(x) > uint64(y)
16005 // result: (First yes no)
16006 for b.Controls[0].Op == OpS390XMOVDconst {
16007 v_0 := b.Controls[0]
16008 x := auxIntToInt64(v_0.AuxInt)
16009 y := auxIntToUint8(b.AuxInt)
16010 c := auxToS390xCCMask(b.Aux)
16011 if !(c&s390x.Greater != 0 && uint64(x) > uint64(y)) {
16012 break
16013 }
16014 b.Reset(BlockFirst)
16015 return true
16016 }
16017 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16018 // cond: c&s390x.Equal == 0 && uint64(x) == uint64(y)
16019 // result: (First no yes)
16020 for b.Controls[0].Op == OpS390XMOVDconst {
16021 v_0 := b.Controls[0]
16022 x := auxIntToInt64(v_0.AuxInt)
16023 y := auxIntToUint8(b.AuxInt)
16024 c := auxToS390xCCMask(b.Aux)
16025 if !(c&s390x.Equal == 0 && uint64(x) == uint64(y)) {
16026 break
16027 }
16028 b.Reset(BlockFirst)
16029 b.swapSuccessors()
16030 return true
16031 }
16032 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16033 // cond: c&s390x.Less == 0 && uint64(x) < uint64(y)
16034 // result: (First no yes)
16035 for b.Controls[0].Op == OpS390XMOVDconst {
16036 v_0 := b.Controls[0]
16037 x := auxIntToInt64(v_0.AuxInt)
16038 y := auxIntToUint8(b.AuxInt)
16039 c := auxToS390xCCMask(b.Aux)
16040 if !(c&s390x.Less == 0 && uint64(x) < uint64(y)) {
16041 break
16042 }
16043 b.Reset(BlockFirst)
16044 b.swapSuccessors()
16045 return true
16046 }
16047 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no)
16048 // cond: c&s390x.Greater == 0 && uint64(x) > uint64(y)
16049 // result: (First no yes)
16050 for b.Controls[0].Op == OpS390XMOVDconst {
16051 v_0 := b.Controls[0]
16052 x := auxIntToInt64(v_0.AuxInt)
16053 y := auxIntToUint8(b.AuxInt)
16054 c := auxToS390xCCMask(b.Aux)
16055 if !(c&s390x.Greater == 0 && uint64(x) > uint64(y)) {
16056 break
16057 }
16058 b.Reset(BlockFirst)
16059 b.swapSuccessors()
16060 return true
16061 }
16062 // match: (CLGIJ {s390x.GreaterOrEqual} _ [0] yes no)
16063 // result: (First yes no)
16064 for {
16065 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
16066 break
16067 }
16068 b.Reset(BlockFirst)
16069 return true
16070 }
16071 // match: (CLGIJ {s390x.Less} _ [0] yes no)
16072 // result: (First no yes)
16073 for {
16074 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Less {
16075 break
16076 }
16077 b.Reset(BlockFirst)
16078 b.swapSuccessors()
16079 return true
16080 }
16081 // match: (CLGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
16082 // result: (BRC {s390x.NoCarry} carry)
16083 for b.Controls[0].Op == OpSelect0 {
16084 v_0 := b.Controls[0]
16085 v_0_0 := v_0.Args[0]
16086 if v_0_0.Op != OpS390XADDE {
16087 break
16088 }
16089 carry := v_0_0.Args[2]
16090 v_0_0_0 := v_0_0.Args[0]
16091 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16092 break
16093 }
16094 v_0_0_1 := v_0_0.Args[1]
16095 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal {
16096 break
16097 }
16098 b.resetWithControl(BlockS390XBRC, carry)
16099 b.Aux = s390xCCMaskToAux(s390x.NoCarry)
16100 return true
16101 }
16102 // match: (CLGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1])
16103 // result: (BRC {s390x.Carry} carry)
16104 for b.Controls[0].Op == OpSelect0 {
16105 v_0 := b.Controls[0]
16106 v_0_0 := v_0.Args[0]
16107 if v_0_0.Op != OpS390XADDE {
16108 break
16109 }
16110 carry := v_0_0.Args[2]
16111 v_0_0_0 := v_0_0.Args[0]
16112 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16113 break
16114 }
16115 v_0_0_1 := v_0_0.Args[1]
16116 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal {
16117 break
16118 }
16119 b.resetWithControl(BlockS390XBRC, carry)
16120 b.Aux = s390xCCMaskToAux(s390x.Carry)
16121 return true
16122 }
16123 // match: (CLGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
16124 // result: (BRC {s390x.Carry} carry)
16125 for b.Controls[0].Op == OpSelect0 {
16126 v_0 := b.Controls[0]
16127 v_0_0 := v_0.Args[0]
16128 if v_0_0.Op != OpS390XADDE {
16129 break
16130 }
16131 carry := v_0_0.Args[2]
16132 v_0_0_0 := v_0_0.Args[0]
16133 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16134 break
16135 }
16136 v_0_0_1 := v_0_0.Args[1]
16137 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
16138 break
16139 }
16140 b.resetWithControl(BlockS390XBRC, carry)
16141 b.Aux = s390xCCMaskToAux(s390x.Carry)
16142 return true
16143 }
16144 // match: (CLGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1])
16145 // result: (BRC {s390x.NoCarry} carry)
16146 for b.Controls[0].Op == OpSelect0 {
16147 v_0 := b.Controls[0]
16148 v_0_0 := v_0.Args[0]
16149 if v_0_0.Op != OpS390XADDE {
16150 break
16151 }
16152 carry := v_0_0.Args[2]
16153 v_0_0_0 := v_0_0.Args[0]
16154 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16155 break
16156 }
16157 v_0_0_1 := v_0_0.Args[1]
16158 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater {
16159 break
16160 }
16161 b.resetWithControl(BlockS390XBRC, carry)
16162 b.Aux = s390xCCMaskToAux(s390x.NoCarry)
16163 return true
16164 }
16165 // match: (CLGIJ {s390x.Greater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0])
16166 // result: (BRC {s390x.Carry} carry)
16167 for b.Controls[0].Op == OpSelect0 {
16168 v_0 := b.Controls[0]
16169 v_0_0 := v_0.Args[0]
16170 if v_0_0.Op != OpS390XADDE {
16171 break
16172 }
16173 carry := v_0_0.Args[2]
16174 v_0_0_0 := v_0_0.Args[0]
16175 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 {
16176 break
16177 }
16178 v_0_0_1 := v_0_0.Args[1]
16179 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater {
16180 break
16181 }
16182 b.resetWithControl(BlockS390XBRC, carry)
16183 b.Aux = s390xCCMaskToAux(s390x.Carry)
16184 return true
16185 }
16186 // match: (CLGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
16187 // result: (BRC {s390x.NoBorrow} borrow)
16188 for b.Controls[0].Op == OpS390XNEG {
16189 v_0 := b.Controls[0]
16190 v_0_0 := v_0.Args[0]
16191 if v_0_0.Op != OpSelect0 {
16192 break
16193 }
16194 v_0_0_0 := v_0_0.Args[0]
16195 if v_0_0_0.Op != OpS390XSUBE {
16196 break
16197 }
16198 borrow := v_0_0_0.Args[2]
16199 v_0_0_0_0 := v_0_0_0.Args[0]
16200 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16201 break
16202 }
16203 v_0_0_0_1 := v_0_0_0.Args[1]
16204 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 {
16205 break
16206 }
16207 b.resetWithControl(BlockS390XBRC, borrow)
16208 b.Aux = s390xCCMaskToAux(s390x.NoBorrow)
16209 return true
16210 }
16211 // match: (CLGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1])
16212 // result: (BRC {s390x.Borrow} borrow)
16213 for b.Controls[0].Op == OpS390XNEG {
16214 v_0 := b.Controls[0]
16215 v_0_0 := v_0.Args[0]
16216 if v_0_0.Op != OpSelect0 {
16217 break
16218 }
16219 v_0_0_0 := v_0_0.Args[0]
16220 if v_0_0_0.Op != OpS390XSUBE {
16221 break
16222 }
16223 borrow := v_0_0_0.Args[2]
16224 v_0_0_0_0 := v_0_0_0.Args[0]
16225 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16226 break
16227 }
16228 v_0_0_0_1 := v_0_0_0.Args[1]
16229 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 {
16230 break
16231 }
16232 b.resetWithControl(BlockS390XBRC, borrow)
16233 b.Aux = s390xCCMaskToAux(s390x.Borrow)
16234 return true
16235 }
16236 // match: (CLGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
16237 // result: (BRC {s390x.Borrow} borrow)
16238 for b.Controls[0].Op == OpS390XNEG {
16239 v_0 := b.Controls[0]
16240 v_0_0 := v_0.Args[0]
16241 if v_0_0.Op != OpSelect0 {
16242 break
16243 }
16244 v_0_0_0 := v_0_0.Args[0]
16245 if v_0_0_0.Op != OpS390XSUBE {
16246 break
16247 }
16248 borrow := v_0_0_0.Args[2]
16249 v_0_0_0_0 := v_0_0_0.Args[0]
16250 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16251 break
16252 }
16253 v_0_0_0_1 := v_0_0_0.Args[1]
16254 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 {
16255 break
16256 }
16257 b.resetWithControl(BlockS390XBRC, borrow)
16258 b.Aux = s390xCCMaskToAux(s390x.Borrow)
16259 return true
16260 }
16261 // match: (CLGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1])
16262 // result: (BRC {s390x.NoBorrow} borrow)
16263 for b.Controls[0].Op == OpS390XNEG {
16264 v_0 := b.Controls[0]
16265 v_0_0 := v_0.Args[0]
16266 if v_0_0.Op != OpSelect0 {
16267 break
16268 }
16269 v_0_0_0 := v_0_0.Args[0]
16270 if v_0_0_0.Op != OpS390XSUBE {
16271 break
16272 }
16273 borrow := v_0_0_0.Args[2]
16274 v_0_0_0_0 := v_0_0_0.Args[0]
16275 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16276 break
16277 }
16278 v_0_0_0_1 := v_0_0_0.Args[1]
16279 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 {
16280 break
16281 }
16282 b.resetWithControl(BlockS390XBRC, borrow)
16283 b.Aux = s390xCCMaskToAux(s390x.NoBorrow)
16284 return true
16285 }
16286 // match: (CLGIJ {s390x.Greater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0])
16287 // result: (BRC {s390x.Borrow} borrow)
16288 for b.Controls[0].Op == OpS390XNEG {
16289 v_0 := b.Controls[0]
16290 v_0_0 := v_0.Args[0]
16291 if v_0_0.Op != OpSelect0 {
16292 break
16293 }
16294 v_0_0_0 := v_0_0.Args[0]
16295 if v_0_0_0.Op != OpS390XSUBE {
16296 break
16297 }
16298 borrow := v_0_0_0.Args[2]
16299 v_0_0_0_0 := v_0_0_0.Args[0]
16300 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 {
16301 break
16302 }
16303 v_0_0_0_1 := v_0_0_0.Args[1]
16304 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 {
16305 break
16306 }
16307 b.resetWithControl(BlockS390XBRC, borrow)
16308 b.Aux = s390xCCMaskToAux(s390x.Borrow)
16309 return true
16310 }
16311 case BlockS390XCLGRJ:
16312 // match: (CLGRJ {c} x (MOVDconst [y]) yes no)
16313 // cond: isU8Bit(y)
16314 // result: (CLGIJ {c} x [uint8(y)] yes no)
16315 for b.Controls[1].Op == OpS390XMOVDconst {
16316 x := b.Controls[0]
16317 v_1 := b.Controls[1]
16318 y := auxIntToInt64(v_1.AuxInt)
16319 c := auxToS390xCCMask(b.Aux)
16320 if !(isU8Bit(y)) {
16321 break
16322 }
16323 b.resetWithControl(BlockS390XCLGIJ, x)
16324 b.AuxInt = uint8ToAuxInt(uint8(y))
16325 b.Aux = s390xCCMaskToAux(c)
16326 return true
16327 }
16328 // match: (CLGRJ {c} (MOVDconst [x]) y yes no)
16329 // cond: isU8Bit(x)
16330 // result: (CLGIJ {c.ReverseComparison()} y [uint8(x)] yes no)
16331 for b.Controls[0].Op == OpS390XMOVDconst {
16332 v_0 := b.Controls[0]
16333 x := auxIntToInt64(v_0.AuxInt)
16334 y := b.Controls[1]
16335 c := auxToS390xCCMask(b.Aux)
16336 if !(isU8Bit(x)) {
16337 break
16338 }
16339 b.resetWithControl(BlockS390XCLGIJ, y)
16340 b.AuxInt = uint8ToAuxInt(uint8(x))
16341 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16342 return true
16343 }
16344 // match: (CLGRJ {c} x (MOVDconst [y]) yes no)
16345 // cond: !isU8Bit(y) && isU32Bit(y)
16346 // result: (BRC {c} (CMPUconst x [int32(y)]) yes no)
16347 for b.Controls[1].Op == OpS390XMOVDconst {
16348 x := b.Controls[0]
16349 v_1 := b.Controls[1]
16350 y := auxIntToInt64(v_1.AuxInt)
16351 c := auxToS390xCCMask(b.Aux)
16352 if !(!isU8Bit(y) && isU32Bit(y)) {
16353 break
16354 }
16355 v0 := b.NewValue0(x.Pos, OpS390XCMPUconst, types.TypeFlags)
16356 v0.AuxInt = int32ToAuxInt(int32(y))
16357 v0.AddArg(x)
16358 b.resetWithControl(BlockS390XBRC, v0)
16359 b.Aux = s390xCCMaskToAux(c)
16360 return true
16361 }
16362 // match: (CLGRJ {c} (MOVDconst [x]) y yes no)
16363 // cond: !isU8Bit(x) && isU32Bit(x)
16364 // result: (BRC {c.ReverseComparison()} (CMPUconst y [int32(x)]) yes no)
16365 for b.Controls[0].Op == OpS390XMOVDconst {
16366 v_0 := b.Controls[0]
16367 x := auxIntToInt64(v_0.AuxInt)
16368 y := b.Controls[1]
16369 c := auxToS390xCCMask(b.Aux)
16370 if !(!isU8Bit(x) && isU32Bit(x)) {
16371 break
16372 }
16373 v0 := b.NewValue0(v_0.Pos, OpS390XCMPUconst, types.TypeFlags)
16374 v0.AuxInt = int32ToAuxInt(int32(x))
16375 v0.AddArg(y)
16376 b.resetWithControl(BlockS390XBRC, v0)
16377 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16378 return true
16379 }
16380 // match: (CLGRJ {c} x y yes no)
16381 // cond: x == y && c&s390x.Equal != 0
16382 // result: (First yes no)
16383 for {
16384 x := b.Controls[0]
16385 y := b.Controls[1]
16386 c := auxToS390xCCMask(b.Aux)
16387 if !(x == y && c&s390x.Equal != 0) {
16388 break
16389 }
16390 b.Reset(BlockFirst)
16391 return true
16392 }
16393 // match: (CLGRJ {c} x y yes no)
16394 // cond: x == y && c&s390x.Equal == 0
16395 // result: (First no yes)
16396 for {
16397 x := b.Controls[0]
16398 y := b.Controls[1]
16399 c := auxToS390xCCMask(b.Aux)
16400 if !(x == y && c&s390x.Equal == 0) {
16401 break
16402 }
16403 b.Reset(BlockFirst)
16404 b.swapSuccessors()
16405 return true
16406 }
16407 case BlockS390XCLIJ:
16408 // match: (CLIJ {s390x.LessOrGreater} (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp) [0] yes no)
16409 // cond: int32(x) != 0
16410 // result: (BRC {d} cmp yes no)
16411 for b.Controls[0].Op == OpS390XLOCGR {
16412 v_0 := b.Controls[0]
16413 d := auxToS390xCCMask(v_0.Aux)
16414 cmp := v_0.Args[2]
16415 v_0_0 := v_0.Args[0]
16416 if v_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0.AuxInt) != 0 {
16417 break
16418 }
16419 v_0_1 := v_0.Args[1]
16420 if v_0_1.Op != OpS390XMOVDconst {
16421 break
16422 }
16423 x := auxIntToInt64(v_0_1.AuxInt)
16424 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater || !(int32(x) != 0) {
16425 break
16426 }
16427 b.resetWithControl(BlockS390XBRC, cmp)
16428 b.Aux = s390xCCMaskToAux(d)
16429 return true
16430 }
16431 // match: (CLIJ {c} (MOVWreg x) [y] yes no)
16432 // result: (CLIJ {c} x [y] yes no)
16433 for b.Controls[0].Op == OpS390XMOVWreg {
16434 v_0 := b.Controls[0]
16435 x := v_0.Args[0]
16436 y := auxIntToUint8(b.AuxInt)
16437 c := auxToS390xCCMask(b.Aux)
16438 b.resetWithControl(BlockS390XCLIJ, x)
16439 b.AuxInt = uint8ToAuxInt(y)
16440 b.Aux = s390xCCMaskToAux(c)
16441 return true
16442 }
16443 // match: (CLIJ {c} (MOVWZreg x) [y] yes no)
16444 // result: (CLIJ {c} x [y] yes no)
16445 for b.Controls[0].Op == OpS390XMOVWZreg {
16446 v_0 := b.Controls[0]
16447 x := v_0.Args[0]
16448 y := auxIntToUint8(b.AuxInt)
16449 c := auxToS390xCCMask(b.Aux)
16450 b.resetWithControl(BlockS390XCLIJ, x)
16451 b.AuxInt = uint8ToAuxInt(y)
16452 b.Aux = s390xCCMaskToAux(c)
16453 return true
16454 }
16455 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16456 // cond: c&s390x.Equal != 0 && uint32(x) == uint32(y)
16457 // result: (First yes no)
16458 for b.Controls[0].Op == OpS390XMOVDconst {
16459 v_0 := b.Controls[0]
16460 x := auxIntToInt64(v_0.AuxInt)
16461 y := auxIntToUint8(b.AuxInt)
16462 c := auxToS390xCCMask(b.Aux)
16463 if !(c&s390x.Equal != 0 && uint32(x) == uint32(y)) {
16464 break
16465 }
16466 b.Reset(BlockFirst)
16467 return true
16468 }
16469 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16470 // cond: c&s390x.Less != 0 && uint32(x) < uint32(y)
16471 // result: (First yes no)
16472 for b.Controls[0].Op == OpS390XMOVDconst {
16473 v_0 := b.Controls[0]
16474 x := auxIntToInt64(v_0.AuxInt)
16475 y := auxIntToUint8(b.AuxInt)
16476 c := auxToS390xCCMask(b.Aux)
16477 if !(c&s390x.Less != 0 && uint32(x) < uint32(y)) {
16478 break
16479 }
16480 b.Reset(BlockFirst)
16481 return true
16482 }
16483 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16484 // cond: c&s390x.Greater != 0 && uint32(x) > uint32(y)
16485 // result: (First yes no)
16486 for b.Controls[0].Op == OpS390XMOVDconst {
16487 v_0 := b.Controls[0]
16488 x := auxIntToInt64(v_0.AuxInt)
16489 y := auxIntToUint8(b.AuxInt)
16490 c := auxToS390xCCMask(b.Aux)
16491 if !(c&s390x.Greater != 0 && uint32(x) > uint32(y)) {
16492 break
16493 }
16494 b.Reset(BlockFirst)
16495 return true
16496 }
16497 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16498 // cond: c&s390x.Equal == 0 && uint32(x) == uint32(y)
16499 // result: (First no yes)
16500 for b.Controls[0].Op == OpS390XMOVDconst {
16501 v_0 := b.Controls[0]
16502 x := auxIntToInt64(v_0.AuxInt)
16503 y := auxIntToUint8(b.AuxInt)
16504 c := auxToS390xCCMask(b.Aux)
16505 if !(c&s390x.Equal == 0 && uint32(x) == uint32(y)) {
16506 break
16507 }
16508 b.Reset(BlockFirst)
16509 b.swapSuccessors()
16510 return true
16511 }
16512 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16513 // cond: c&s390x.Less == 0 && uint32(x) < uint32(y)
16514 // result: (First no yes)
16515 for b.Controls[0].Op == OpS390XMOVDconst {
16516 v_0 := b.Controls[0]
16517 x := auxIntToInt64(v_0.AuxInt)
16518 y := auxIntToUint8(b.AuxInt)
16519 c := auxToS390xCCMask(b.Aux)
16520 if !(c&s390x.Less == 0 && uint32(x) < uint32(y)) {
16521 break
16522 }
16523 b.Reset(BlockFirst)
16524 b.swapSuccessors()
16525 return true
16526 }
16527 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no)
16528 // cond: c&s390x.Greater == 0 && uint32(x) > uint32(y)
16529 // result: (First no yes)
16530 for b.Controls[0].Op == OpS390XMOVDconst {
16531 v_0 := b.Controls[0]
16532 x := auxIntToInt64(v_0.AuxInt)
16533 y := auxIntToUint8(b.AuxInt)
16534 c := auxToS390xCCMask(b.Aux)
16535 if !(c&s390x.Greater == 0 && uint32(x) > uint32(y)) {
16536 break
16537 }
16538 b.Reset(BlockFirst)
16539 b.swapSuccessors()
16540 return true
16541 }
16542 // match: (CLIJ {s390x.GreaterOrEqual} _ [0] yes no)
16543 // result: (First yes no)
16544 for {
16545 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual {
16546 break
16547 }
16548 b.Reset(BlockFirst)
16549 return true
16550 }
16551 // match: (CLIJ {s390x.Less} _ [0] yes no)
16552 // result: (First no yes)
16553 for {
16554 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Less {
16555 break
16556 }
16557 b.Reset(BlockFirst)
16558 b.swapSuccessors()
16559 return true
16560 }
16561 case BlockS390XCLRJ:
16562 // match: (CLRJ {c} x (MOVDconst [y]) yes no)
16563 // cond: isU8Bit(y)
16564 // result: (CLIJ {c} x [uint8(y)] yes no)
16565 for b.Controls[1].Op == OpS390XMOVDconst {
16566 x := b.Controls[0]
16567 v_1 := b.Controls[1]
16568 y := auxIntToInt64(v_1.AuxInt)
16569 c := auxToS390xCCMask(b.Aux)
16570 if !(isU8Bit(y)) {
16571 break
16572 }
16573 b.resetWithControl(BlockS390XCLIJ, x)
16574 b.AuxInt = uint8ToAuxInt(uint8(y))
16575 b.Aux = s390xCCMaskToAux(c)
16576 return true
16577 }
16578 // match: (CLRJ {c} (MOVDconst [x]) y yes no)
16579 // cond: isU8Bit(x)
16580 // result: (CLIJ {c.ReverseComparison()} y [uint8(x)] yes no)
16581 for b.Controls[0].Op == OpS390XMOVDconst {
16582 v_0 := b.Controls[0]
16583 x := auxIntToInt64(v_0.AuxInt)
16584 y := b.Controls[1]
16585 c := auxToS390xCCMask(b.Aux)
16586 if !(isU8Bit(x)) {
16587 break
16588 }
16589 b.resetWithControl(BlockS390XCLIJ, y)
16590 b.AuxInt = uint8ToAuxInt(uint8(x))
16591 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16592 return true
16593 }
16594 // match: (CLRJ {c} x (MOVDconst [y]) yes no)
16595 // cond: !isU8Bit(y) && isU32Bit(y)
16596 // result: (BRC {c} (CMPWUconst x [int32(y)]) yes no)
16597 for b.Controls[1].Op == OpS390XMOVDconst {
16598 x := b.Controls[0]
16599 v_1 := b.Controls[1]
16600 y := auxIntToInt64(v_1.AuxInt)
16601 c := auxToS390xCCMask(b.Aux)
16602 if !(!isU8Bit(y) && isU32Bit(y)) {
16603 break
16604 }
16605 v0 := b.NewValue0(x.Pos, OpS390XCMPWUconst, types.TypeFlags)
16606 v0.AuxInt = int32ToAuxInt(int32(y))
16607 v0.AddArg(x)
16608 b.resetWithControl(BlockS390XBRC, v0)
16609 b.Aux = s390xCCMaskToAux(c)
16610 return true
16611 }
16612 // match: (CLRJ {c} (MOVDconst [x]) y yes no)
16613 // cond: !isU8Bit(x) && isU32Bit(x)
16614 // result: (BRC {c.ReverseComparison()} (CMPWUconst y [int32(x)]) yes no)
16615 for b.Controls[0].Op == OpS390XMOVDconst {
16616 v_0 := b.Controls[0]
16617 x := auxIntToInt64(v_0.AuxInt)
16618 y := b.Controls[1]
16619 c := auxToS390xCCMask(b.Aux)
16620 if !(!isU8Bit(x) && isU32Bit(x)) {
16621 break
16622 }
16623 v0 := b.NewValue0(v_0.Pos, OpS390XCMPWUconst, types.TypeFlags)
16624 v0.AuxInt = int32ToAuxInt(int32(x))
16625 v0.AddArg(y)
16626 b.resetWithControl(BlockS390XBRC, v0)
16627 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16628 return true
16629 }
16630 // match: (CLRJ {c} x y yes no)
16631 // cond: x == y && c&s390x.Equal != 0
16632 // result: (First yes no)
16633 for {
16634 x := b.Controls[0]
16635 y := b.Controls[1]
16636 c := auxToS390xCCMask(b.Aux)
16637 if !(x == y && c&s390x.Equal != 0) {
16638 break
16639 }
16640 b.Reset(BlockFirst)
16641 return true
16642 }
16643 // match: (CLRJ {c} x y yes no)
16644 // cond: x == y && c&s390x.Equal == 0
16645 // result: (First no yes)
16646 for {
16647 x := b.Controls[0]
16648 y := b.Controls[1]
16649 c := auxToS390xCCMask(b.Aux)
16650 if !(x == y && c&s390x.Equal == 0) {
16651 break
16652 }
16653 b.Reset(BlockFirst)
16654 b.swapSuccessors()
16655 return true
16656 }
16657 case BlockS390XCRJ:
16658 // match: (CRJ {c} x (MOVDconst [y]) yes no)
16659 // cond: is8Bit(y)
16660 // result: (CIJ {c} x [ int8(y)] yes no)
16661 for b.Controls[1].Op == OpS390XMOVDconst {
16662 x := b.Controls[0]
16663 v_1 := b.Controls[1]
16664 y := auxIntToInt64(v_1.AuxInt)
16665 c := auxToS390xCCMask(b.Aux)
16666 if !(is8Bit(y)) {
16667 break
16668 }
16669 b.resetWithControl(BlockS390XCIJ, x)
16670 b.AuxInt = int8ToAuxInt(int8(y))
16671 b.Aux = s390xCCMaskToAux(c)
16672 return true
16673 }
16674 // match: (CRJ {c} (MOVDconst [x]) y yes no)
16675 // cond: is8Bit(x)
16676 // result: (CIJ {c.ReverseComparison()} y [ int8(x)] yes no)
16677 for b.Controls[0].Op == OpS390XMOVDconst {
16678 v_0 := b.Controls[0]
16679 x := auxIntToInt64(v_0.AuxInt)
16680 y := b.Controls[1]
16681 c := auxToS390xCCMask(b.Aux)
16682 if !(is8Bit(x)) {
16683 break
16684 }
16685 b.resetWithControl(BlockS390XCIJ, y)
16686 b.AuxInt = int8ToAuxInt(int8(x))
16687 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16688 return true
16689 }
16690 // match: (CRJ {c} x (MOVDconst [y]) yes no)
16691 // cond: !is8Bit(y) && is32Bit(y)
16692 // result: (BRC {c} (CMPWconst x [int32(y)]) yes no)
16693 for b.Controls[1].Op == OpS390XMOVDconst {
16694 x := b.Controls[0]
16695 v_1 := b.Controls[1]
16696 y := auxIntToInt64(v_1.AuxInt)
16697 c := auxToS390xCCMask(b.Aux)
16698 if !(!is8Bit(y) && is32Bit(y)) {
16699 break
16700 }
16701 v0 := b.NewValue0(x.Pos, OpS390XCMPWconst, types.TypeFlags)
16702 v0.AuxInt = int32ToAuxInt(int32(y))
16703 v0.AddArg(x)
16704 b.resetWithControl(BlockS390XBRC, v0)
16705 b.Aux = s390xCCMaskToAux(c)
16706 return true
16707 }
16708 // match: (CRJ {c} (MOVDconst [x]) y yes no)
16709 // cond: !is8Bit(x) && is32Bit(x)
16710 // result: (BRC {c.ReverseComparison()} (CMPWconst y [int32(x)]) yes no)
16711 for b.Controls[0].Op == OpS390XMOVDconst {
16712 v_0 := b.Controls[0]
16713 x := auxIntToInt64(v_0.AuxInt)
16714 y := b.Controls[1]
16715 c := auxToS390xCCMask(b.Aux)
16716 if !(!is8Bit(x) && is32Bit(x)) {
16717 break
16718 }
16719 v0 := b.NewValue0(v_0.Pos, OpS390XCMPWconst, types.TypeFlags)
16720 v0.AuxInt = int32ToAuxInt(int32(x))
16721 v0.AddArg(y)
16722 b.resetWithControl(BlockS390XBRC, v0)
16723 b.Aux = s390xCCMaskToAux(c.ReverseComparison())
16724 return true
16725 }
16726 // match: (CRJ {c} x y yes no)
16727 // cond: x == y && c&s390x.Equal != 0
16728 // result: (First yes no)
16729 for {
16730 x := b.Controls[0]
16731 y := b.Controls[1]
16732 c := auxToS390xCCMask(b.Aux)
16733 if !(x == y && c&s390x.Equal != 0) {
16734 break
16735 }
16736 b.Reset(BlockFirst)
16737 return true
16738 }
16739 // match: (CRJ {c} x y yes no)
16740 // cond: x == y && c&s390x.Equal == 0
16741 // result: (First no yes)
16742 for {
16743 x := b.Controls[0]
16744 y := b.Controls[1]
16745 c := auxToS390xCCMask(b.Aux)
16746 if !(x == y && c&s390x.Equal == 0) {
16747 break
16748 }
16749 b.Reset(BlockFirst)
16750 b.swapSuccessors()
16751 return true
16752 }
16753 case BlockIf:
16754 // match: (If cond yes no)
16755 // result: (CLIJ {s390x.LessOrGreater} (MOVBZreg <typ.Bool> cond) [0] yes no)
16756 for {
16757 cond := b.Controls[0]
16758 v0 := b.NewValue0(cond.Pos, OpS390XMOVBZreg, typ.Bool)
16759 v0.AddArg(cond)
16760 b.resetWithControl(BlockS390XCLIJ, v0)
16761 b.AuxInt = uint8ToAuxInt(0)
16762 b.Aux = s390xCCMaskToAux(s390x.LessOrGreater)
16763 return true
16764 }
16765 }
16766 return false
16767 }