github.com/bir3/gocompiler@v0.9.2202/src/cmd/compile/internal/ssa/rewriteS390X.go (about) 1 // Code generated from _gen/S390X.rules using 'go generate'; DO NOT EDIT. 2 3 package ssa 4 5 import "math" 6 import "github.com/bir3/gocompiler/src/cmd/compile/internal/types" 7 import "github.com/bir3/gocompiler/src/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 OpBitLen64: 92 return rewriteValueS390X_OpBitLen64(v) 93 case OpBswap16: 94 return rewriteValueS390X_OpBswap16(v) 95 case OpBswap32: 96 v.Op = OpS390XMOVWBR 97 return true 98 case OpBswap64: 99 v.Op = OpS390XMOVDBR 100 return true 101 case OpCeil: 102 return rewriteValueS390X_OpCeil(v) 103 case OpClosureCall: 104 v.Op = OpS390XCALLclosure 105 return true 106 case OpCom16: 107 v.Op = OpS390XNOTW 108 return true 109 case OpCom32: 110 v.Op = OpS390XNOTW 111 return true 112 case OpCom64: 113 v.Op = OpS390XNOT 114 return true 115 case OpCom8: 116 v.Op = OpS390XNOTW 117 return true 118 case OpConst16: 119 return rewriteValueS390X_OpConst16(v) 120 case OpConst32: 121 return rewriteValueS390X_OpConst32(v) 122 case OpConst32F: 123 v.Op = OpS390XFMOVSconst 124 return true 125 case OpConst64: 126 return rewriteValueS390X_OpConst64(v) 127 case OpConst64F: 128 v.Op = OpS390XFMOVDconst 129 return true 130 case OpConst8: 131 return rewriteValueS390X_OpConst8(v) 132 case OpConstBool: 133 return rewriteValueS390X_OpConstBool(v) 134 case OpConstNil: 135 return rewriteValueS390X_OpConstNil(v) 136 case OpCtz32: 137 return rewriteValueS390X_OpCtz32(v) 138 case OpCtz32NonZero: 139 v.Op = OpCtz32 140 return true 141 case OpCtz64: 142 return rewriteValueS390X_OpCtz64(v) 143 case OpCtz64NonZero: 144 v.Op = OpCtz64 145 return true 146 case OpCvt32Fto32: 147 v.Op = OpS390XCFEBRA 148 return true 149 case OpCvt32Fto32U: 150 v.Op = OpS390XCLFEBR 151 return true 152 case OpCvt32Fto64: 153 v.Op = OpS390XCGEBRA 154 return true 155 case OpCvt32Fto64F: 156 v.Op = OpS390XLDEBR 157 return true 158 case OpCvt32Fto64U: 159 v.Op = OpS390XCLGEBR 160 return true 161 case OpCvt32Uto32F: 162 v.Op = OpS390XCELFBR 163 return true 164 case OpCvt32Uto64F: 165 v.Op = OpS390XCDLFBR 166 return true 167 case OpCvt32to32F: 168 v.Op = OpS390XCEFBRA 169 return true 170 case OpCvt32to64F: 171 v.Op = OpS390XCDFBRA 172 return true 173 case OpCvt64Fto32: 174 v.Op = OpS390XCFDBRA 175 return true 176 case OpCvt64Fto32F: 177 v.Op = OpS390XLEDBR 178 return true 179 case OpCvt64Fto32U: 180 v.Op = OpS390XCLFDBR 181 return true 182 case OpCvt64Fto64: 183 v.Op = OpS390XCGDBRA 184 return true 185 case OpCvt64Fto64U: 186 v.Op = OpS390XCLGDBR 187 return true 188 case OpCvt64Uto32F: 189 v.Op = OpS390XCELGBR 190 return true 191 case OpCvt64Uto64F: 192 v.Op = OpS390XCDLGBR 193 return true 194 case OpCvt64to32F: 195 v.Op = OpS390XCEGBRA 196 return true 197 case OpCvt64to64F: 198 v.Op = OpS390XCDGBRA 199 return true 200 case OpCvtBoolToUint8: 201 v.Op = OpCopy 202 return true 203 case OpDiv16: 204 return rewriteValueS390X_OpDiv16(v) 205 case OpDiv16u: 206 return rewriteValueS390X_OpDiv16u(v) 207 case OpDiv32: 208 return rewriteValueS390X_OpDiv32(v) 209 case OpDiv32F: 210 v.Op = OpS390XFDIVS 211 return true 212 case OpDiv32u: 213 return rewriteValueS390X_OpDiv32u(v) 214 case OpDiv64: 215 return rewriteValueS390X_OpDiv64(v) 216 case OpDiv64F: 217 v.Op = OpS390XFDIV 218 return true 219 case OpDiv64u: 220 v.Op = OpS390XDIVDU 221 return true 222 case OpDiv8: 223 return rewriteValueS390X_OpDiv8(v) 224 case OpDiv8u: 225 return rewriteValueS390X_OpDiv8u(v) 226 case OpEq16: 227 return rewriteValueS390X_OpEq16(v) 228 case OpEq32: 229 return rewriteValueS390X_OpEq32(v) 230 case OpEq32F: 231 return rewriteValueS390X_OpEq32F(v) 232 case OpEq64: 233 return rewriteValueS390X_OpEq64(v) 234 case OpEq64F: 235 return rewriteValueS390X_OpEq64F(v) 236 case OpEq8: 237 return rewriteValueS390X_OpEq8(v) 238 case OpEqB: 239 return rewriteValueS390X_OpEqB(v) 240 case OpEqPtr: 241 return rewriteValueS390X_OpEqPtr(v) 242 case OpFMA: 243 return rewriteValueS390X_OpFMA(v) 244 case OpFloor: 245 return rewriteValueS390X_OpFloor(v) 246 case OpGetCallerPC: 247 v.Op = OpS390XLoweredGetCallerPC 248 return true 249 case OpGetCallerSP: 250 v.Op = OpS390XLoweredGetCallerSP 251 return true 252 case OpGetClosurePtr: 253 v.Op = OpS390XLoweredGetClosurePtr 254 return true 255 case OpGetG: 256 v.Op = OpS390XLoweredGetG 257 return true 258 case OpHmul32: 259 return rewriteValueS390X_OpHmul32(v) 260 case OpHmul32u: 261 return rewriteValueS390X_OpHmul32u(v) 262 case OpHmul64: 263 v.Op = OpS390XMULHD 264 return true 265 case OpHmul64u: 266 v.Op = OpS390XMULHDU 267 return true 268 case OpITab: 269 return rewriteValueS390X_OpITab(v) 270 case OpInterCall: 271 v.Op = OpS390XCALLinter 272 return true 273 case OpIsInBounds: 274 return rewriteValueS390X_OpIsInBounds(v) 275 case OpIsNonNil: 276 return rewriteValueS390X_OpIsNonNil(v) 277 case OpIsSliceInBounds: 278 return rewriteValueS390X_OpIsSliceInBounds(v) 279 case OpLeq16: 280 return rewriteValueS390X_OpLeq16(v) 281 case OpLeq16U: 282 return rewriteValueS390X_OpLeq16U(v) 283 case OpLeq32: 284 return rewriteValueS390X_OpLeq32(v) 285 case OpLeq32F: 286 return rewriteValueS390X_OpLeq32F(v) 287 case OpLeq32U: 288 return rewriteValueS390X_OpLeq32U(v) 289 case OpLeq64: 290 return rewriteValueS390X_OpLeq64(v) 291 case OpLeq64F: 292 return rewriteValueS390X_OpLeq64F(v) 293 case OpLeq64U: 294 return rewriteValueS390X_OpLeq64U(v) 295 case OpLeq8: 296 return rewriteValueS390X_OpLeq8(v) 297 case OpLeq8U: 298 return rewriteValueS390X_OpLeq8U(v) 299 case OpLess16: 300 return rewriteValueS390X_OpLess16(v) 301 case OpLess16U: 302 return rewriteValueS390X_OpLess16U(v) 303 case OpLess32: 304 return rewriteValueS390X_OpLess32(v) 305 case OpLess32F: 306 return rewriteValueS390X_OpLess32F(v) 307 case OpLess32U: 308 return rewriteValueS390X_OpLess32U(v) 309 case OpLess64: 310 return rewriteValueS390X_OpLess64(v) 311 case OpLess64F: 312 return rewriteValueS390X_OpLess64F(v) 313 case OpLess64U: 314 return rewriteValueS390X_OpLess64U(v) 315 case OpLess8: 316 return rewriteValueS390X_OpLess8(v) 317 case OpLess8U: 318 return rewriteValueS390X_OpLess8U(v) 319 case OpLoad: 320 return rewriteValueS390X_OpLoad(v) 321 case OpLocalAddr: 322 return rewriteValueS390X_OpLocalAddr(v) 323 case OpLsh16x16: 324 return rewriteValueS390X_OpLsh16x16(v) 325 case OpLsh16x32: 326 return rewriteValueS390X_OpLsh16x32(v) 327 case OpLsh16x64: 328 return rewriteValueS390X_OpLsh16x64(v) 329 case OpLsh16x8: 330 return rewriteValueS390X_OpLsh16x8(v) 331 case OpLsh32x16: 332 return rewriteValueS390X_OpLsh32x16(v) 333 case OpLsh32x32: 334 return rewriteValueS390X_OpLsh32x32(v) 335 case OpLsh32x64: 336 return rewriteValueS390X_OpLsh32x64(v) 337 case OpLsh32x8: 338 return rewriteValueS390X_OpLsh32x8(v) 339 case OpLsh64x16: 340 return rewriteValueS390X_OpLsh64x16(v) 341 case OpLsh64x32: 342 return rewriteValueS390X_OpLsh64x32(v) 343 case OpLsh64x64: 344 return rewriteValueS390X_OpLsh64x64(v) 345 case OpLsh64x8: 346 return rewriteValueS390X_OpLsh64x8(v) 347 case OpLsh8x16: 348 return rewriteValueS390X_OpLsh8x16(v) 349 case OpLsh8x32: 350 return rewriteValueS390X_OpLsh8x32(v) 351 case OpLsh8x64: 352 return rewriteValueS390X_OpLsh8x64(v) 353 case OpLsh8x8: 354 return rewriteValueS390X_OpLsh8x8(v) 355 case OpMod16: 356 return rewriteValueS390X_OpMod16(v) 357 case OpMod16u: 358 return rewriteValueS390X_OpMod16u(v) 359 case OpMod32: 360 return rewriteValueS390X_OpMod32(v) 361 case OpMod32u: 362 return rewriteValueS390X_OpMod32u(v) 363 case OpMod64: 364 return rewriteValueS390X_OpMod64(v) 365 case OpMod64u: 366 v.Op = OpS390XMODDU 367 return true 368 case OpMod8: 369 return rewriteValueS390X_OpMod8(v) 370 case OpMod8u: 371 return rewriteValueS390X_OpMod8u(v) 372 case OpMove: 373 return rewriteValueS390X_OpMove(v) 374 case OpMul16: 375 v.Op = OpS390XMULLW 376 return true 377 case OpMul32: 378 v.Op = OpS390XMULLW 379 return true 380 case OpMul32F: 381 v.Op = OpS390XFMULS 382 return true 383 case OpMul64: 384 v.Op = OpS390XMULLD 385 return true 386 case OpMul64F: 387 v.Op = OpS390XFMUL 388 return true 389 case OpMul64uhilo: 390 v.Op = OpS390XMLGR 391 return true 392 case OpMul8: 393 v.Op = OpS390XMULLW 394 return true 395 case OpNeg16: 396 v.Op = OpS390XNEGW 397 return true 398 case OpNeg32: 399 v.Op = OpS390XNEGW 400 return true 401 case OpNeg32F: 402 v.Op = OpS390XFNEGS 403 return true 404 case OpNeg64: 405 v.Op = OpS390XNEG 406 return true 407 case OpNeg64F: 408 v.Op = OpS390XFNEG 409 return true 410 case OpNeg8: 411 v.Op = OpS390XNEGW 412 return true 413 case OpNeq16: 414 return rewriteValueS390X_OpNeq16(v) 415 case OpNeq32: 416 return rewriteValueS390X_OpNeq32(v) 417 case OpNeq32F: 418 return rewriteValueS390X_OpNeq32F(v) 419 case OpNeq64: 420 return rewriteValueS390X_OpNeq64(v) 421 case OpNeq64F: 422 return rewriteValueS390X_OpNeq64F(v) 423 case OpNeq8: 424 return rewriteValueS390X_OpNeq8(v) 425 case OpNeqB: 426 return rewriteValueS390X_OpNeqB(v) 427 case OpNeqPtr: 428 return rewriteValueS390X_OpNeqPtr(v) 429 case OpNilCheck: 430 v.Op = OpS390XLoweredNilCheck 431 return true 432 case OpNot: 433 return rewriteValueS390X_OpNot(v) 434 case OpOffPtr: 435 return rewriteValueS390X_OpOffPtr(v) 436 case OpOr16: 437 v.Op = OpS390XORW 438 return true 439 case OpOr32: 440 v.Op = OpS390XORW 441 return true 442 case OpOr64: 443 v.Op = OpS390XOR 444 return true 445 case OpOr8: 446 v.Op = OpS390XORW 447 return true 448 case OpOrB: 449 v.Op = OpS390XORW 450 return true 451 case OpPanicBounds: 452 return rewriteValueS390X_OpPanicBounds(v) 453 case OpPopCount16: 454 return rewriteValueS390X_OpPopCount16(v) 455 case OpPopCount32: 456 return rewriteValueS390X_OpPopCount32(v) 457 case OpPopCount64: 458 return rewriteValueS390X_OpPopCount64(v) 459 case OpPopCount8: 460 return rewriteValueS390X_OpPopCount8(v) 461 case OpRotateLeft16: 462 return rewriteValueS390X_OpRotateLeft16(v) 463 case OpRotateLeft32: 464 v.Op = OpS390XRLL 465 return true 466 case OpRotateLeft64: 467 v.Op = OpS390XRLLG 468 return true 469 case OpRotateLeft8: 470 return rewriteValueS390X_OpRotateLeft8(v) 471 case OpRound: 472 return rewriteValueS390X_OpRound(v) 473 case OpRound32F: 474 v.Op = OpS390XLoweredRound32F 475 return true 476 case OpRound64F: 477 v.Op = OpS390XLoweredRound64F 478 return true 479 case OpRoundToEven: 480 return rewriteValueS390X_OpRoundToEven(v) 481 case OpRsh16Ux16: 482 return rewriteValueS390X_OpRsh16Ux16(v) 483 case OpRsh16Ux32: 484 return rewriteValueS390X_OpRsh16Ux32(v) 485 case OpRsh16Ux64: 486 return rewriteValueS390X_OpRsh16Ux64(v) 487 case OpRsh16Ux8: 488 return rewriteValueS390X_OpRsh16Ux8(v) 489 case OpRsh16x16: 490 return rewriteValueS390X_OpRsh16x16(v) 491 case OpRsh16x32: 492 return rewriteValueS390X_OpRsh16x32(v) 493 case OpRsh16x64: 494 return rewriteValueS390X_OpRsh16x64(v) 495 case OpRsh16x8: 496 return rewriteValueS390X_OpRsh16x8(v) 497 case OpRsh32Ux16: 498 return rewriteValueS390X_OpRsh32Ux16(v) 499 case OpRsh32Ux32: 500 return rewriteValueS390X_OpRsh32Ux32(v) 501 case OpRsh32Ux64: 502 return rewriteValueS390X_OpRsh32Ux64(v) 503 case OpRsh32Ux8: 504 return rewriteValueS390X_OpRsh32Ux8(v) 505 case OpRsh32x16: 506 return rewriteValueS390X_OpRsh32x16(v) 507 case OpRsh32x32: 508 return rewriteValueS390X_OpRsh32x32(v) 509 case OpRsh32x64: 510 return rewriteValueS390X_OpRsh32x64(v) 511 case OpRsh32x8: 512 return rewriteValueS390X_OpRsh32x8(v) 513 case OpRsh64Ux16: 514 return rewriteValueS390X_OpRsh64Ux16(v) 515 case OpRsh64Ux32: 516 return rewriteValueS390X_OpRsh64Ux32(v) 517 case OpRsh64Ux64: 518 return rewriteValueS390X_OpRsh64Ux64(v) 519 case OpRsh64Ux8: 520 return rewriteValueS390X_OpRsh64Ux8(v) 521 case OpRsh64x16: 522 return rewriteValueS390X_OpRsh64x16(v) 523 case OpRsh64x32: 524 return rewriteValueS390X_OpRsh64x32(v) 525 case OpRsh64x64: 526 return rewriteValueS390X_OpRsh64x64(v) 527 case OpRsh64x8: 528 return rewriteValueS390X_OpRsh64x8(v) 529 case OpRsh8Ux16: 530 return rewriteValueS390X_OpRsh8Ux16(v) 531 case OpRsh8Ux32: 532 return rewriteValueS390X_OpRsh8Ux32(v) 533 case OpRsh8Ux64: 534 return rewriteValueS390X_OpRsh8Ux64(v) 535 case OpRsh8Ux8: 536 return rewriteValueS390X_OpRsh8Ux8(v) 537 case OpRsh8x16: 538 return rewriteValueS390X_OpRsh8x16(v) 539 case OpRsh8x32: 540 return rewriteValueS390X_OpRsh8x32(v) 541 case OpRsh8x64: 542 return rewriteValueS390X_OpRsh8x64(v) 543 case OpRsh8x8: 544 return rewriteValueS390X_OpRsh8x8(v) 545 case OpS390XADD: 546 return rewriteValueS390X_OpS390XADD(v) 547 case OpS390XADDC: 548 return rewriteValueS390X_OpS390XADDC(v) 549 case OpS390XADDE: 550 return rewriteValueS390X_OpS390XADDE(v) 551 case OpS390XADDW: 552 return rewriteValueS390X_OpS390XADDW(v) 553 case OpS390XADDWconst: 554 return rewriteValueS390X_OpS390XADDWconst(v) 555 case OpS390XADDWload: 556 return rewriteValueS390X_OpS390XADDWload(v) 557 case OpS390XADDconst: 558 return rewriteValueS390X_OpS390XADDconst(v) 559 case OpS390XADDload: 560 return rewriteValueS390X_OpS390XADDload(v) 561 case OpS390XAND: 562 return rewriteValueS390X_OpS390XAND(v) 563 case OpS390XANDW: 564 return rewriteValueS390X_OpS390XANDW(v) 565 case OpS390XANDWconst: 566 return rewriteValueS390X_OpS390XANDWconst(v) 567 case OpS390XANDWload: 568 return rewriteValueS390X_OpS390XANDWload(v) 569 case OpS390XANDconst: 570 return rewriteValueS390X_OpS390XANDconst(v) 571 case OpS390XANDload: 572 return rewriteValueS390X_OpS390XANDload(v) 573 case OpS390XCMP: 574 return rewriteValueS390X_OpS390XCMP(v) 575 case OpS390XCMPU: 576 return rewriteValueS390X_OpS390XCMPU(v) 577 case OpS390XCMPUconst: 578 return rewriteValueS390X_OpS390XCMPUconst(v) 579 case OpS390XCMPW: 580 return rewriteValueS390X_OpS390XCMPW(v) 581 case OpS390XCMPWU: 582 return rewriteValueS390X_OpS390XCMPWU(v) 583 case OpS390XCMPWUconst: 584 return rewriteValueS390X_OpS390XCMPWUconst(v) 585 case OpS390XCMPWconst: 586 return rewriteValueS390X_OpS390XCMPWconst(v) 587 case OpS390XCMPconst: 588 return rewriteValueS390X_OpS390XCMPconst(v) 589 case OpS390XCPSDR: 590 return rewriteValueS390X_OpS390XCPSDR(v) 591 case OpS390XFCMP: 592 return rewriteValueS390X_OpS390XFCMP(v) 593 case OpS390XFCMPS: 594 return rewriteValueS390X_OpS390XFCMPS(v) 595 case OpS390XFMOVDload: 596 return rewriteValueS390X_OpS390XFMOVDload(v) 597 case OpS390XFMOVDstore: 598 return rewriteValueS390X_OpS390XFMOVDstore(v) 599 case OpS390XFMOVSload: 600 return rewriteValueS390X_OpS390XFMOVSload(v) 601 case OpS390XFMOVSstore: 602 return rewriteValueS390X_OpS390XFMOVSstore(v) 603 case OpS390XFNEG: 604 return rewriteValueS390X_OpS390XFNEG(v) 605 case OpS390XFNEGS: 606 return rewriteValueS390X_OpS390XFNEGS(v) 607 case OpS390XLDGR: 608 return rewriteValueS390X_OpS390XLDGR(v) 609 case OpS390XLEDBR: 610 return rewriteValueS390X_OpS390XLEDBR(v) 611 case OpS390XLGDR: 612 return rewriteValueS390X_OpS390XLGDR(v) 613 case OpS390XLOCGR: 614 return rewriteValueS390X_OpS390XLOCGR(v) 615 case OpS390XLTDBR: 616 return rewriteValueS390X_OpS390XLTDBR(v) 617 case OpS390XLTEBR: 618 return rewriteValueS390X_OpS390XLTEBR(v) 619 case OpS390XLoweredRound32F: 620 return rewriteValueS390X_OpS390XLoweredRound32F(v) 621 case OpS390XLoweredRound64F: 622 return rewriteValueS390X_OpS390XLoweredRound64F(v) 623 case OpS390XMOVBZload: 624 return rewriteValueS390X_OpS390XMOVBZload(v) 625 case OpS390XMOVBZreg: 626 return rewriteValueS390X_OpS390XMOVBZreg(v) 627 case OpS390XMOVBload: 628 return rewriteValueS390X_OpS390XMOVBload(v) 629 case OpS390XMOVBreg: 630 return rewriteValueS390X_OpS390XMOVBreg(v) 631 case OpS390XMOVBstore: 632 return rewriteValueS390X_OpS390XMOVBstore(v) 633 case OpS390XMOVBstoreconst: 634 return rewriteValueS390X_OpS390XMOVBstoreconst(v) 635 case OpS390XMOVDBR: 636 return rewriteValueS390X_OpS390XMOVDBR(v) 637 case OpS390XMOVDaddridx: 638 return rewriteValueS390X_OpS390XMOVDaddridx(v) 639 case OpS390XMOVDload: 640 return rewriteValueS390X_OpS390XMOVDload(v) 641 case OpS390XMOVDstore: 642 return rewriteValueS390X_OpS390XMOVDstore(v) 643 case OpS390XMOVDstoreconst: 644 return rewriteValueS390X_OpS390XMOVDstoreconst(v) 645 case OpS390XMOVDstoreidx: 646 return rewriteValueS390X_OpS390XMOVDstoreidx(v) 647 case OpS390XMOVHZload: 648 return rewriteValueS390X_OpS390XMOVHZload(v) 649 case OpS390XMOVHZreg: 650 return rewriteValueS390X_OpS390XMOVHZreg(v) 651 case OpS390XMOVHload: 652 return rewriteValueS390X_OpS390XMOVHload(v) 653 case OpS390XMOVHreg: 654 return rewriteValueS390X_OpS390XMOVHreg(v) 655 case OpS390XMOVHstore: 656 return rewriteValueS390X_OpS390XMOVHstore(v) 657 case OpS390XMOVHstoreconst: 658 return rewriteValueS390X_OpS390XMOVHstoreconst(v) 659 case OpS390XMOVHstoreidx: 660 return rewriteValueS390X_OpS390XMOVHstoreidx(v) 661 case OpS390XMOVWBR: 662 return rewriteValueS390X_OpS390XMOVWBR(v) 663 case OpS390XMOVWZload: 664 return rewriteValueS390X_OpS390XMOVWZload(v) 665 case OpS390XMOVWZreg: 666 return rewriteValueS390X_OpS390XMOVWZreg(v) 667 case OpS390XMOVWload: 668 return rewriteValueS390X_OpS390XMOVWload(v) 669 case OpS390XMOVWreg: 670 return rewriteValueS390X_OpS390XMOVWreg(v) 671 case OpS390XMOVWstore: 672 return rewriteValueS390X_OpS390XMOVWstore(v) 673 case OpS390XMOVWstoreconst: 674 return rewriteValueS390X_OpS390XMOVWstoreconst(v) 675 case OpS390XMOVWstoreidx: 676 return rewriteValueS390X_OpS390XMOVWstoreidx(v) 677 case OpS390XMULLD: 678 return rewriteValueS390X_OpS390XMULLD(v) 679 case OpS390XMULLDconst: 680 return rewriteValueS390X_OpS390XMULLDconst(v) 681 case OpS390XMULLDload: 682 return rewriteValueS390X_OpS390XMULLDload(v) 683 case OpS390XMULLW: 684 return rewriteValueS390X_OpS390XMULLW(v) 685 case OpS390XMULLWconst: 686 return rewriteValueS390X_OpS390XMULLWconst(v) 687 case OpS390XMULLWload: 688 return rewriteValueS390X_OpS390XMULLWload(v) 689 case OpS390XNEG: 690 return rewriteValueS390X_OpS390XNEG(v) 691 case OpS390XNEGW: 692 return rewriteValueS390X_OpS390XNEGW(v) 693 case OpS390XNOT: 694 return rewriteValueS390X_OpS390XNOT(v) 695 case OpS390XNOTW: 696 return rewriteValueS390X_OpS390XNOTW(v) 697 case OpS390XOR: 698 return rewriteValueS390X_OpS390XOR(v) 699 case OpS390XORW: 700 return rewriteValueS390X_OpS390XORW(v) 701 case OpS390XORWconst: 702 return rewriteValueS390X_OpS390XORWconst(v) 703 case OpS390XORWload: 704 return rewriteValueS390X_OpS390XORWload(v) 705 case OpS390XORconst: 706 return rewriteValueS390X_OpS390XORconst(v) 707 case OpS390XORload: 708 return rewriteValueS390X_OpS390XORload(v) 709 case OpS390XRISBGZ: 710 return rewriteValueS390X_OpS390XRISBGZ(v) 711 case OpS390XRLL: 712 return rewriteValueS390X_OpS390XRLL(v) 713 case OpS390XRLLG: 714 return rewriteValueS390X_OpS390XRLLG(v) 715 case OpS390XSLD: 716 return rewriteValueS390X_OpS390XSLD(v) 717 case OpS390XSLDconst: 718 return rewriteValueS390X_OpS390XSLDconst(v) 719 case OpS390XSLW: 720 return rewriteValueS390X_OpS390XSLW(v) 721 case OpS390XSLWconst: 722 return rewriteValueS390X_OpS390XSLWconst(v) 723 case OpS390XSRAD: 724 return rewriteValueS390X_OpS390XSRAD(v) 725 case OpS390XSRADconst: 726 return rewriteValueS390X_OpS390XSRADconst(v) 727 case OpS390XSRAW: 728 return rewriteValueS390X_OpS390XSRAW(v) 729 case OpS390XSRAWconst: 730 return rewriteValueS390X_OpS390XSRAWconst(v) 731 case OpS390XSRD: 732 return rewriteValueS390X_OpS390XSRD(v) 733 case OpS390XSRDconst: 734 return rewriteValueS390X_OpS390XSRDconst(v) 735 case OpS390XSRW: 736 return rewriteValueS390X_OpS390XSRW(v) 737 case OpS390XSRWconst: 738 return rewriteValueS390X_OpS390XSRWconst(v) 739 case OpS390XSTM2: 740 return rewriteValueS390X_OpS390XSTM2(v) 741 case OpS390XSTMG2: 742 return rewriteValueS390X_OpS390XSTMG2(v) 743 case OpS390XSUB: 744 return rewriteValueS390X_OpS390XSUB(v) 745 case OpS390XSUBE: 746 return rewriteValueS390X_OpS390XSUBE(v) 747 case OpS390XSUBW: 748 return rewriteValueS390X_OpS390XSUBW(v) 749 case OpS390XSUBWconst: 750 return rewriteValueS390X_OpS390XSUBWconst(v) 751 case OpS390XSUBWload: 752 return rewriteValueS390X_OpS390XSUBWload(v) 753 case OpS390XSUBconst: 754 return rewriteValueS390X_OpS390XSUBconst(v) 755 case OpS390XSUBload: 756 return rewriteValueS390X_OpS390XSUBload(v) 757 case OpS390XSumBytes2: 758 return rewriteValueS390X_OpS390XSumBytes2(v) 759 case OpS390XSumBytes4: 760 return rewriteValueS390X_OpS390XSumBytes4(v) 761 case OpS390XSumBytes8: 762 return rewriteValueS390X_OpS390XSumBytes8(v) 763 case OpS390XXOR: 764 return rewriteValueS390X_OpS390XXOR(v) 765 case OpS390XXORW: 766 return rewriteValueS390X_OpS390XXORW(v) 767 case OpS390XXORWconst: 768 return rewriteValueS390X_OpS390XXORWconst(v) 769 case OpS390XXORWload: 770 return rewriteValueS390X_OpS390XXORWload(v) 771 case OpS390XXORconst: 772 return rewriteValueS390X_OpS390XXORconst(v) 773 case OpS390XXORload: 774 return rewriteValueS390X_OpS390XXORload(v) 775 case OpSelect0: 776 return rewriteValueS390X_OpSelect0(v) 777 case OpSelect1: 778 return rewriteValueS390X_OpSelect1(v) 779 case OpSignExt16to32: 780 v.Op = OpS390XMOVHreg 781 return true 782 case OpSignExt16to64: 783 v.Op = OpS390XMOVHreg 784 return true 785 case OpSignExt32to64: 786 v.Op = OpS390XMOVWreg 787 return true 788 case OpSignExt8to16: 789 v.Op = OpS390XMOVBreg 790 return true 791 case OpSignExt8to32: 792 v.Op = OpS390XMOVBreg 793 return true 794 case OpSignExt8to64: 795 v.Op = OpS390XMOVBreg 796 return true 797 case OpSlicemask: 798 return rewriteValueS390X_OpSlicemask(v) 799 case OpSqrt: 800 v.Op = OpS390XFSQRT 801 return true 802 case OpSqrt32: 803 v.Op = OpS390XFSQRTS 804 return true 805 case OpStaticCall: 806 v.Op = OpS390XCALLstatic 807 return true 808 case OpStore: 809 return rewriteValueS390X_OpStore(v) 810 case OpSub16: 811 v.Op = OpS390XSUBW 812 return true 813 case OpSub32: 814 v.Op = OpS390XSUBW 815 return true 816 case OpSub32F: 817 return rewriteValueS390X_OpSub32F(v) 818 case OpSub64: 819 v.Op = OpS390XSUB 820 return true 821 case OpSub64F: 822 return rewriteValueS390X_OpSub64F(v) 823 case OpSub8: 824 v.Op = OpS390XSUBW 825 return true 826 case OpSubPtr: 827 v.Op = OpS390XSUB 828 return true 829 case OpTailCall: 830 v.Op = OpS390XCALLtail 831 return true 832 case OpTrunc: 833 return rewriteValueS390X_OpTrunc(v) 834 case OpTrunc16to8: 835 v.Op = OpCopy 836 return true 837 case OpTrunc32to16: 838 v.Op = OpCopy 839 return true 840 case OpTrunc32to8: 841 v.Op = OpCopy 842 return true 843 case OpTrunc64to16: 844 v.Op = OpCopy 845 return true 846 case OpTrunc64to32: 847 v.Op = OpCopy 848 return true 849 case OpTrunc64to8: 850 v.Op = OpCopy 851 return true 852 case OpWB: 853 v.Op = OpS390XLoweredWB 854 return true 855 case OpXor16: 856 v.Op = OpS390XXORW 857 return true 858 case OpXor32: 859 v.Op = OpS390XXORW 860 return true 861 case OpXor64: 862 v.Op = OpS390XXOR 863 return true 864 case OpXor8: 865 v.Op = OpS390XXORW 866 return true 867 case OpZero: 868 return rewriteValueS390X_OpZero(v) 869 case OpZeroExt16to32: 870 v.Op = OpS390XMOVHZreg 871 return true 872 case OpZeroExt16to64: 873 v.Op = OpS390XMOVHZreg 874 return true 875 case OpZeroExt32to64: 876 v.Op = OpS390XMOVWZreg 877 return true 878 case OpZeroExt8to16: 879 v.Op = OpS390XMOVBZreg 880 return true 881 case OpZeroExt8to32: 882 v.Op = OpS390XMOVBZreg 883 return true 884 case OpZeroExt8to64: 885 v.Op = OpS390XMOVBZreg 886 return true 887 } 888 return false 889 } 890 func rewriteValueS390X_OpAdd32F(v *Value) bool { 891 v_1 := v.Args[1] 892 v_0 := v.Args[0] 893 b := v.Block 894 typ := &b.Func.Config.Types 895 // match: (Add32F x y) 896 // result: (Select0 (FADDS x y)) 897 for { 898 x := v_0 899 y := v_1 900 v.reset(OpSelect0) 901 v0 := b.NewValue0(v.Pos, OpS390XFADDS, types.NewTuple(typ.Float32, types.TypeFlags)) 902 v0.AddArg2(x, y) 903 v.AddArg(v0) 904 return true 905 } 906 } 907 func rewriteValueS390X_OpAdd64F(v *Value) bool { 908 v_1 := v.Args[1] 909 v_0 := v.Args[0] 910 b := v.Block 911 typ := &b.Func.Config.Types 912 // match: (Add64F x y) 913 // result: (Select0 (FADD x y)) 914 for { 915 x := v_0 916 y := v_1 917 v.reset(OpSelect0) 918 v0 := b.NewValue0(v.Pos, OpS390XFADD, types.NewTuple(typ.Float64, types.TypeFlags)) 919 v0.AddArg2(x, y) 920 v.AddArg(v0) 921 return true 922 } 923 } 924 func rewriteValueS390X_OpAddr(v *Value) bool { 925 v_0 := v.Args[0] 926 // match: (Addr {sym} base) 927 // result: (MOVDaddr {sym} base) 928 for { 929 sym := auxToSym(v.Aux) 930 base := v_0 931 v.reset(OpS390XMOVDaddr) 932 v.Aux = symToAux(sym) 933 v.AddArg(base) 934 return true 935 } 936 } 937 func rewriteValueS390X_OpAtomicAdd32(v *Value) bool { 938 v_2 := v.Args[2] 939 v_1 := v.Args[1] 940 v_0 := v.Args[0] 941 b := v.Block 942 typ := &b.Func.Config.Types 943 // match: (AtomicAdd32 ptr val mem) 944 // result: (AddTupleFirst32 val (LAA ptr val mem)) 945 for { 946 ptr := v_0 947 val := v_1 948 mem := v_2 949 v.reset(OpS390XAddTupleFirst32) 950 v0 := b.NewValue0(v.Pos, OpS390XLAA, types.NewTuple(typ.UInt32, types.TypeMem)) 951 v0.AddArg3(ptr, val, mem) 952 v.AddArg2(val, v0) 953 return true 954 } 955 } 956 func rewriteValueS390X_OpAtomicAdd64(v *Value) bool { 957 v_2 := v.Args[2] 958 v_1 := v.Args[1] 959 v_0 := v.Args[0] 960 b := v.Block 961 typ := &b.Func.Config.Types 962 // match: (AtomicAdd64 ptr val mem) 963 // result: (AddTupleFirst64 val (LAAG ptr val mem)) 964 for { 965 ptr := v_0 966 val := v_1 967 mem := v_2 968 v.reset(OpS390XAddTupleFirst64) 969 v0 := b.NewValue0(v.Pos, OpS390XLAAG, types.NewTuple(typ.UInt64, types.TypeMem)) 970 v0.AddArg3(ptr, val, mem) 971 v.AddArg2(val, v0) 972 return true 973 } 974 } 975 func rewriteValueS390X_OpAtomicAnd8(v *Value) bool { 976 v_2 := v.Args[2] 977 v_1 := v.Args[1] 978 v_0 := v.Args[0] 979 b := v.Block 980 typ := &b.Func.Config.Types 981 // match: (AtomicAnd8 ptr val mem) 982 // 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) 983 for { 984 ptr := v_0 985 val := v_1 986 mem := v_2 987 v.reset(OpS390XLANfloor) 988 v0 := b.NewValue0(v.Pos, OpS390XRLL, typ.UInt32) 989 v1 := b.NewValue0(v.Pos, OpS390XORWconst, typ.UInt32) 990 v1.AuxInt = int32ToAuxInt(-1 << 8) 991 v1.AddArg(val) 992 v2 := b.NewValue0(v.Pos, OpS390XRXSBG, typ.UInt32) 993 v2.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(59, 60, 3)) 994 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 995 v3.AuxInt = int64ToAuxInt(3 << 3) 996 v2.AddArg2(v3, ptr) 997 v0.AddArg2(v1, v2) 998 v.AddArg3(ptr, v0, mem) 999 return true 1000 } 1001 } 1002 func rewriteValueS390X_OpAtomicCompareAndSwap32(v *Value) bool { 1003 v_3 := v.Args[3] 1004 v_2 := v.Args[2] 1005 v_1 := v.Args[1] 1006 v_0 := v.Args[0] 1007 // match: (AtomicCompareAndSwap32 ptr old new_ mem) 1008 // result: (LoweredAtomicCas32 ptr old new_ mem) 1009 for { 1010 ptr := v_0 1011 old := v_1 1012 new_ := v_2 1013 mem := v_3 1014 v.reset(OpS390XLoweredAtomicCas32) 1015 v.AddArg4(ptr, old, new_, mem) 1016 return true 1017 } 1018 } 1019 func rewriteValueS390X_OpAtomicCompareAndSwap64(v *Value) bool { 1020 v_3 := v.Args[3] 1021 v_2 := v.Args[2] 1022 v_1 := v.Args[1] 1023 v_0 := v.Args[0] 1024 // match: (AtomicCompareAndSwap64 ptr old new_ mem) 1025 // result: (LoweredAtomicCas64 ptr old new_ mem) 1026 for { 1027 ptr := v_0 1028 old := v_1 1029 new_ := v_2 1030 mem := v_3 1031 v.reset(OpS390XLoweredAtomicCas64) 1032 v.AddArg4(ptr, old, new_, mem) 1033 return true 1034 } 1035 } 1036 func rewriteValueS390X_OpAtomicExchange32(v *Value) bool { 1037 v_2 := v.Args[2] 1038 v_1 := v.Args[1] 1039 v_0 := v.Args[0] 1040 // match: (AtomicExchange32 ptr val mem) 1041 // result: (LoweredAtomicExchange32 ptr val mem) 1042 for { 1043 ptr := v_0 1044 val := v_1 1045 mem := v_2 1046 v.reset(OpS390XLoweredAtomicExchange32) 1047 v.AddArg3(ptr, val, mem) 1048 return true 1049 } 1050 } 1051 func rewriteValueS390X_OpAtomicExchange64(v *Value) bool { 1052 v_2 := v.Args[2] 1053 v_1 := v.Args[1] 1054 v_0 := v.Args[0] 1055 // match: (AtomicExchange64 ptr val mem) 1056 // result: (LoweredAtomicExchange64 ptr val mem) 1057 for { 1058 ptr := v_0 1059 val := v_1 1060 mem := v_2 1061 v.reset(OpS390XLoweredAtomicExchange64) 1062 v.AddArg3(ptr, val, mem) 1063 return true 1064 } 1065 } 1066 func rewriteValueS390X_OpAtomicLoad32(v *Value) bool { 1067 v_1 := v.Args[1] 1068 v_0 := v.Args[0] 1069 // match: (AtomicLoad32 ptr mem) 1070 // result: (MOVWZatomicload ptr mem) 1071 for { 1072 ptr := v_0 1073 mem := v_1 1074 v.reset(OpS390XMOVWZatomicload) 1075 v.AddArg2(ptr, mem) 1076 return true 1077 } 1078 } 1079 func rewriteValueS390X_OpAtomicLoad64(v *Value) bool { 1080 v_1 := v.Args[1] 1081 v_0 := v.Args[0] 1082 // match: (AtomicLoad64 ptr mem) 1083 // result: (MOVDatomicload ptr mem) 1084 for { 1085 ptr := v_0 1086 mem := v_1 1087 v.reset(OpS390XMOVDatomicload) 1088 v.AddArg2(ptr, mem) 1089 return true 1090 } 1091 } 1092 func rewriteValueS390X_OpAtomicLoad8(v *Value) bool { 1093 v_1 := v.Args[1] 1094 v_0 := v.Args[0] 1095 // match: (AtomicLoad8 ptr mem) 1096 // result: (MOVBZatomicload ptr mem) 1097 for { 1098 ptr := v_0 1099 mem := v_1 1100 v.reset(OpS390XMOVBZatomicload) 1101 v.AddArg2(ptr, mem) 1102 return true 1103 } 1104 } 1105 func rewriteValueS390X_OpAtomicLoadAcq32(v *Value) bool { 1106 v_1 := v.Args[1] 1107 v_0 := v.Args[0] 1108 // match: (AtomicLoadAcq32 ptr mem) 1109 // result: (MOVWZatomicload ptr mem) 1110 for { 1111 ptr := v_0 1112 mem := v_1 1113 v.reset(OpS390XMOVWZatomicload) 1114 v.AddArg2(ptr, mem) 1115 return true 1116 } 1117 } 1118 func rewriteValueS390X_OpAtomicLoadPtr(v *Value) bool { 1119 v_1 := v.Args[1] 1120 v_0 := v.Args[0] 1121 // match: (AtomicLoadPtr ptr mem) 1122 // result: (MOVDatomicload ptr mem) 1123 for { 1124 ptr := v_0 1125 mem := v_1 1126 v.reset(OpS390XMOVDatomicload) 1127 v.AddArg2(ptr, mem) 1128 return true 1129 } 1130 } 1131 func rewriteValueS390X_OpAtomicOr8(v *Value) bool { 1132 v_2 := v.Args[2] 1133 v_1 := v.Args[1] 1134 v_0 := v.Args[0] 1135 b := v.Block 1136 typ := &b.Func.Config.Types 1137 // match: (AtomicOr8 ptr val mem) 1138 // result: (LAOfloor ptr (SLW <typ.UInt32> (MOVBZreg <typ.UInt32> val) (RXSBG <typ.UInt32> {s390x.NewRotateParams(59, 60, 3)} (MOVDconst [3<<3]) ptr)) mem) 1139 for { 1140 ptr := v_0 1141 val := v_1 1142 mem := v_2 1143 v.reset(OpS390XLAOfloor) 1144 v0 := b.NewValue0(v.Pos, OpS390XSLW, typ.UInt32) 1145 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt32) 1146 v1.AddArg(val) 1147 v2 := b.NewValue0(v.Pos, OpS390XRXSBG, typ.UInt32) 1148 v2.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(59, 60, 3)) 1149 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1150 v3.AuxInt = int64ToAuxInt(3 << 3) 1151 v2.AddArg2(v3, ptr) 1152 v0.AddArg2(v1, v2) 1153 v.AddArg3(ptr, v0, mem) 1154 return true 1155 } 1156 } 1157 func rewriteValueS390X_OpAtomicStore32(v *Value) bool { 1158 v_2 := v.Args[2] 1159 v_1 := v.Args[1] 1160 v_0 := v.Args[0] 1161 b := v.Block 1162 // match: (AtomicStore32 ptr val mem) 1163 // result: (SYNC (MOVWatomicstore ptr val mem)) 1164 for { 1165 ptr := v_0 1166 val := v_1 1167 mem := v_2 1168 v.reset(OpS390XSYNC) 1169 v0 := b.NewValue0(v.Pos, OpS390XMOVWatomicstore, types.TypeMem) 1170 v0.AddArg3(ptr, val, mem) 1171 v.AddArg(v0) 1172 return true 1173 } 1174 } 1175 func rewriteValueS390X_OpAtomicStore64(v *Value) bool { 1176 v_2 := v.Args[2] 1177 v_1 := v.Args[1] 1178 v_0 := v.Args[0] 1179 b := v.Block 1180 // match: (AtomicStore64 ptr val mem) 1181 // result: (SYNC (MOVDatomicstore ptr val mem)) 1182 for { 1183 ptr := v_0 1184 val := v_1 1185 mem := v_2 1186 v.reset(OpS390XSYNC) 1187 v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem) 1188 v0.AddArg3(ptr, val, mem) 1189 v.AddArg(v0) 1190 return true 1191 } 1192 } 1193 func rewriteValueS390X_OpAtomicStore8(v *Value) bool { 1194 v_2 := v.Args[2] 1195 v_1 := v.Args[1] 1196 v_0 := v.Args[0] 1197 b := v.Block 1198 // match: (AtomicStore8 ptr val mem) 1199 // result: (SYNC (MOVBatomicstore ptr val mem)) 1200 for { 1201 ptr := v_0 1202 val := v_1 1203 mem := v_2 1204 v.reset(OpS390XSYNC) 1205 v0 := b.NewValue0(v.Pos, OpS390XMOVBatomicstore, types.TypeMem) 1206 v0.AddArg3(ptr, val, mem) 1207 v.AddArg(v0) 1208 return true 1209 } 1210 } 1211 func rewriteValueS390X_OpAtomicStorePtrNoWB(v *Value) bool { 1212 v_2 := v.Args[2] 1213 v_1 := v.Args[1] 1214 v_0 := v.Args[0] 1215 b := v.Block 1216 // match: (AtomicStorePtrNoWB ptr val mem) 1217 // result: (SYNC (MOVDatomicstore ptr val mem)) 1218 for { 1219 ptr := v_0 1220 val := v_1 1221 mem := v_2 1222 v.reset(OpS390XSYNC) 1223 v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem) 1224 v0.AddArg3(ptr, val, mem) 1225 v.AddArg(v0) 1226 return true 1227 } 1228 } 1229 func rewriteValueS390X_OpAtomicStoreRel32(v *Value) bool { 1230 v_2 := v.Args[2] 1231 v_1 := v.Args[1] 1232 v_0 := v.Args[0] 1233 // match: (AtomicStoreRel32 ptr val mem) 1234 // result: (MOVWatomicstore ptr val mem) 1235 for { 1236 ptr := v_0 1237 val := v_1 1238 mem := v_2 1239 v.reset(OpS390XMOVWatomicstore) 1240 v.AddArg3(ptr, val, mem) 1241 return true 1242 } 1243 } 1244 func rewriteValueS390X_OpAvg64u(v *Value) bool { 1245 v_1 := v.Args[1] 1246 v_0 := v.Args[0] 1247 b := v.Block 1248 // match: (Avg64u <t> x y) 1249 // result: (ADD (SRDconst <t> (SUB <t> x y) [1]) y) 1250 for { 1251 t := v.Type 1252 x := v_0 1253 y := v_1 1254 v.reset(OpS390XADD) 1255 v0 := b.NewValue0(v.Pos, OpS390XSRDconst, t) 1256 v0.AuxInt = uint8ToAuxInt(1) 1257 v1 := b.NewValue0(v.Pos, OpS390XSUB, t) 1258 v1.AddArg2(x, y) 1259 v0.AddArg(v1) 1260 v.AddArg2(v0, y) 1261 return true 1262 } 1263 } 1264 func rewriteValueS390X_OpBitLen64(v *Value) bool { 1265 v_0 := v.Args[0] 1266 b := v.Block 1267 typ := &b.Func.Config.Types 1268 // match: (BitLen64 x) 1269 // result: (SUB (MOVDconst [64]) (FLOGR x)) 1270 for { 1271 x := v_0 1272 v.reset(OpS390XSUB) 1273 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1274 v0.AuxInt = int64ToAuxInt(64) 1275 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64) 1276 v1.AddArg(x) 1277 v.AddArg2(v0, v1) 1278 return true 1279 } 1280 } 1281 func rewriteValueS390X_OpBswap16(v *Value) bool { 1282 v_0 := v.Args[0] 1283 b := v.Block 1284 typ := &b.Func.Config.Types 1285 // match: (Bswap16 x:(MOVHZload [off] {sym} ptr mem)) 1286 // result: @x.Block (MOVHZreg (MOVHBRload [off] {sym} ptr mem)) 1287 for { 1288 x := v_0 1289 if x.Op != OpS390XMOVHZload { 1290 break 1291 } 1292 off := auxIntToInt32(x.AuxInt) 1293 sym := auxToSym(x.Aux) 1294 mem := x.Args[1] 1295 ptr := x.Args[0] 1296 b = x.Block 1297 v0 := b.NewValue0(x.Pos, OpS390XMOVHZreg, typ.UInt64) 1298 v.copyOf(v0) 1299 v1 := b.NewValue0(x.Pos, OpS390XMOVHBRload, typ.UInt16) 1300 v1.AuxInt = int32ToAuxInt(off) 1301 v1.Aux = symToAux(sym) 1302 v1.AddArg2(ptr, mem) 1303 v0.AddArg(v1) 1304 return true 1305 } 1306 // match: (Bswap16 x:(MOVHZloadidx [off] {sym} ptr idx mem)) 1307 // result: @x.Block (MOVHZreg (MOVHBRloadidx [off] {sym} ptr idx mem)) 1308 for { 1309 x := v_0 1310 if x.Op != OpS390XMOVHZloadidx { 1311 break 1312 } 1313 off := auxIntToInt32(x.AuxInt) 1314 sym := auxToSym(x.Aux) 1315 mem := x.Args[2] 1316 ptr := x.Args[0] 1317 idx := x.Args[1] 1318 b = x.Block 1319 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 1320 v.copyOf(v0) 1321 v1 := b.NewValue0(v.Pos, OpS390XMOVHBRloadidx, typ.Int16) 1322 v1.AuxInt = int32ToAuxInt(off) 1323 v1.Aux = symToAux(sym) 1324 v1.AddArg3(ptr, idx, mem) 1325 v0.AddArg(v1) 1326 return true 1327 } 1328 return false 1329 } 1330 func rewriteValueS390X_OpCeil(v *Value) bool { 1331 v_0 := v.Args[0] 1332 // match: (Ceil x) 1333 // result: (FIDBR [6] x) 1334 for { 1335 x := v_0 1336 v.reset(OpS390XFIDBR) 1337 v.AuxInt = int8ToAuxInt(6) 1338 v.AddArg(x) 1339 return true 1340 } 1341 } 1342 func rewriteValueS390X_OpConst16(v *Value) bool { 1343 // match: (Const16 [val]) 1344 // result: (MOVDconst [int64(val)]) 1345 for { 1346 val := auxIntToInt16(v.AuxInt) 1347 v.reset(OpS390XMOVDconst) 1348 v.AuxInt = int64ToAuxInt(int64(val)) 1349 return true 1350 } 1351 } 1352 func rewriteValueS390X_OpConst32(v *Value) bool { 1353 // match: (Const32 [val]) 1354 // result: (MOVDconst [int64(val)]) 1355 for { 1356 val := auxIntToInt32(v.AuxInt) 1357 v.reset(OpS390XMOVDconst) 1358 v.AuxInt = int64ToAuxInt(int64(val)) 1359 return true 1360 } 1361 } 1362 func rewriteValueS390X_OpConst64(v *Value) bool { 1363 // match: (Const64 [val]) 1364 // result: (MOVDconst [int64(val)]) 1365 for { 1366 val := auxIntToInt64(v.AuxInt) 1367 v.reset(OpS390XMOVDconst) 1368 v.AuxInt = int64ToAuxInt(int64(val)) 1369 return true 1370 } 1371 } 1372 func rewriteValueS390X_OpConst8(v *Value) bool { 1373 // match: (Const8 [val]) 1374 // result: (MOVDconst [int64(val)]) 1375 for { 1376 val := auxIntToInt8(v.AuxInt) 1377 v.reset(OpS390XMOVDconst) 1378 v.AuxInt = int64ToAuxInt(int64(val)) 1379 return true 1380 } 1381 } 1382 func rewriteValueS390X_OpConstBool(v *Value) bool { 1383 // match: (ConstBool [t]) 1384 // result: (MOVDconst [b2i(t)]) 1385 for { 1386 t := auxIntToBool(v.AuxInt) 1387 v.reset(OpS390XMOVDconst) 1388 v.AuxInt = int64ToAuxInt(b2i(t)) 1389 return true 1390 } 1391 } 1392 func rewriteValueS390X_OpConstNil(v *Value) bool { 1393 // match: (ConstNil) 1394 // result: (MOVDconst [0]) 1395 for { 1396 v.reset(OpS390XMOVDconst) 1397 v.AuxInt = int64ToAuxInt(0) 1398 return true 1399 } 1400 } 1401 func rewriteValueS390X_OpCtz32(v *Value) bool { 1402 v_0 := v.Args[0] 1403 b := v.Block 1404 typ := &b.Func.Config.Types 1405 // match: (Ctz32 <t> x) 1406 // result: (SUB (MOVDconst [64]) (FLOGR (MOVWZreg (ANDW <t> (SUBWconst <t> [1] x) (NOTW <t> x))))) 1407 for { 1408 t := v.Type 1409 x := v_0 1410 v.reset(OpS390XSUB) 1411 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1412 v0.AuxInt = int64ToAuxInt(64) 1413 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64) 1414 v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 1415 v3 := b.NewValue0(v.Pos, OpS390XANDW, t) 1416 v4 := b.NewValue0(v.Pos, OpS390XSUBWconst, t) 1417 v4.AuxInt = int32ToAuxInt(1) 1418 v4.AddArg(x) 1419 v5 := b.NewValue0(v.Pos, OpS390XNOTW, t) 1420 v5.AddArg(x) 1421 v3.AddArg2(v4, v5) 1422 v2.AddArg(v3) 1423 v1.AddArg(v2) 1424 v.AddArg2(v0, v1) 1425 return true 1426 } 1427 } 1428 func rewriteValueS390X_OpCtz64(v *Value) bool { 1429 v_0 := v.Args[0] 1430 b := v.Block 1431 typ := &b.Func.Config.Types 1432 // match: (Ctz64 <t> x) 1433 // result: (SUB (MOVDconst [64]) (FLOGR (AND <t> (SUBconst <t> [1] x) (NOT <t> x)))) 1434 for { 1435 t := v.Type 1436 x := v_0 1437 v.reset(OpS390XSUB) 1438 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1439 v0.AuxInt = int64ToAuxInt(64) 1440 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64) 1441 v2 := b.NewValue0(v.Pos, OpS390XAND, t) 1442 v3 := b.NewValue0(v.Pos, OpS390XSUBconst, t) 1443 v3.AuxInt = int32ToAuxInt(1) 1444 v3.AddArg(x) 1445 v4 := b.NewValue0(v.Pos, OpS390XNOT, t) 1446 v4.AddArg(x) 1447 v2.AddArg2(v3, v4) 1448 v1.AddArg(v2) 1449 v.AddArg2(v0, v1) 1450 return true 1451 } 1452 } 1453 func rewriteValueS390X_OpDiv16(v *Value) bool { 1454 v_1 := v.Args[1] 1455 v_0 := v.Args[0] 1456 b := v.Block 1457 typ := &b.Func.Config.Types 1458 // match: (Div16 x y) 1459 // result: (DIVW (MOVHreg x) (MOVHreg y)) 1460 for { 1461 x := v_0 1462 y := v_1 1463 v.reset(OpS390XDIVW) 1464 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1465 v0.AddArg(x) 1466 v1 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1467 v1.AddArg(y) 1468 v.AddArg2(v0, v1) 1469 return true 1470 } 1471 } 1472 func rewriteValueS390X_OpDiv16u(v *Value) bool { 1473 v_1 := v.Args[1] 1474 v_0 := v.Args[0] 1475 b := v.Block 1476 typ := &b.Func.Config.Types 1477 // match: (Div16u x y) 1478 // result: (DIVWU (MOVHZreg x) (MOVHZreg y)) 1479 for { 1480 x := v_0 1481 y := v_1 1482 v.reset(OpS390XDIVWU) 1483 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 1484 v0.AddArg(x) 1485 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 1486 v1.AddArg(y) 1487 v.AddArg2(v0, v1) 1488 return true 1489 } 1490 } 1491 func rewriteValueS390X_OpDiv32(v *Value) bool { 1492 v_1 := v.Args[1] 1493 v_0 := v.Args[0] 1494 b := v.Block 1495 typ := &b.Func.Config.Types 1496 // match: (Div32 x y) 1497 // result: (DIVW (MOVWreg x) y) 1498 for { 1499 x := v_0 1500 y := v_1 1501 v.reset(OpS390XDIVW) 1502 v0 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64) 1503 v0.AddArg(x) 1504 v.AddArg2(v0, y) 1505 return true 1506 } 1507 } 1508 func rewriteValueS390X_OpDiv32u(v *Value) bool { 1509 v_1 := v.Args[1] 1510 v_0 := v.Args[0] 1511 b := v.Block 1512 typ := &b.Func.Config.Types 1513 // match: (Div32u x y) 1514 // result: (DIVWU (MOVWZreg x) y) 1515 for { 1516 x := v_0 1517 y := v_1 1518 v.reset(OpS390XDIVWU) 1519 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 1520 v0.AddArg(x) 1521 v.AddArg2(v0, y) 1522 return true 1523 } 1524 } 1525 func rewriteValueS390X_OpDiv64(v *Value) bool { 1526 v_1 := v.Args[1] 1527 v_0 := v.Args[0] 1528 // match: (Div64 x y) 1529 // result: (DIVD x y) 1530 for { 1531 x := v_0 1532 y := v_1 1533 v.reset(OpS390XDIVD) 1534 v.AddArg2(x, y) 1535 return true 1536 } 1537 } 1538 func rewriteValueS390X_OpDiv8(v *Value) bool { 1539 v_1 := v.Args[1] 1540 v_0 := v.Args[0] 1541 b := v.Block 1542 typ := &b.Func.Config.Types 1543 // match: (Div8 x y) 1544 // result: (DIVW (MOVBreg x) (MOVBreg y)) 1545 for { 1546 x := v_0 1547 y := v_1 1548 v.reset(OpS390XDIVW) 1549 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1550 v0.AddArg(x) 1551 v1 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1552 v1.AddArg(y) 1553 v.AddArg2(v0, v1) 1554 return true 1555 } 1556 } 1557 func rewriteValueS390X_OpDiv8u(v *Value) bool { 1558 v_1 := v.Args[1] 1559 v_0 := v.Args[0] 1560 b := v.Block 1561 typ := &b.Func.Config.Types 1562 // match: (Div8u x y) 1563 // result: (DIVWU (MOVBZreg x) (MOVBZreg y)) 1564 for { 1565 x := v_0 1566 y := v_1 1567 v.reset(OpS390XDIVWU) 1568 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 1569 v0.AddArg(x) 1570 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 1571 v1.AddArg(y) 1572 v.AddArg2(v0, v1) 1573 return true 1574 } 1575 } 1576 func rewriteValueS390X_OpEq16(v *Value) bool { 1577 v_1 := v.Args[1] 1578 v_0 := v.Args[0] 1579 b := v.Block 1580 typ := &b.Func.Config.Types 1581 // match: (Eq16 x y) 1582 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y))) 1583 for { 1584 x := v_0 1585 y := v_1 1586 v.reset(OpS390XLOCGR) 1587 v.Aux = s390xCCMaskToAux(s390x.Equal) 1588 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1589 v0.AuxInt = int64ToAuxInt(0) 1590 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1591 v1.AuxInt = int64ToAuxInt(1) 1592 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1593 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1594 v3.AddArg(x) 1595 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1596 v4.AddArg(y) 1597 v2.AddArg2(v3, v4) 1598 v.AddArg3(v0, v1, v2) 1599 return true 1600 } 1601 } 1602 func rewriteValueS390X_OpEq32(v *Value) bool { 1603 v_1 := v.Args[1] 1604 v_0 := v.Args[0] 1605 b := v.Block 1606 typ := &b.Func.Config.Types 1607 // match: (Eq32 x y) 1608 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y)) 1609 for { 1610 x := v_0 1611 y := v_1 1612 v.reset(OpS390XLOCGR) 1613 v.Aux = s390xCCMaskToAux(s390x.Equal) 1614 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1615 v0.AuxInt = int64ToAuxInt(0) 1616 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1617 v1.AuxInt = int64ToAuxInt(1) 1618 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1619 v2.AddArg2(x, y) 1620 v.AddArg3(v0, v1, v2) 1621 return true 1622 } 1623 } 1624 func rewriteValueS390X_OpEq32F(v *Value) bool { 1625 v_1 := v.Args[1] 1626 v_0 := v.Args[0] 1627 b := v.Block 1628 typ := &b.Func.Config.Types 1629 // match: (Eq32F x y) 1630 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y)) 1631 for { 1632 x := v_0 1633 y := v_1 1634 v.reset(OpS390XLOCGR) 1635 v.Aux = s390xCCMaskToAux(s390x.Equal) 1636 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1637 v0.AuxInt = int64ToAuxInt(0) 1638 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1639 v1.AuxInt = int64ToAuxInt(1) 1640 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags) 1641 v2.AddArg2(x, y) 1642 v.AddArg3(v0, v1, v2) 1643 return true 1644 } 1645 } 1646 func rewriteValueS390X_OpEq64(v *Value) bool { 1647 v_1 := v.Args[1] 1648 v_0 := v.Args[0] 1649 b := v.Block 1650 typ := &b.Func.Config.Types 1651 // match: (Eq64 x y) 1652 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 1653 for { 1654 x := v_0 1655 y := v_1 1656 v.reset(OpS390XLOCGR) 1657 v.Aux = s390xCCMaskToAux(s390x.Equal) 1658 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1659 v0.AuxInt = int64ToAuxInt(0) 1660 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1661 v1.AuxInt = int64ToAuxInt(1) 1662 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 1663 v2.AddArg2(x, y) 1664 v.AddArg3(v0, v1, v2) 1665 return true 1666 } 1667 } 1668 func rewriteValueS390X_OpEq64F(v *Value) bool { 1669 v_1 := v.Args[1] 1670 v_0 := v.Args[0] 1671 b := v.Block 1672 typ := &b.Func.Config.Types 1673 // match: (Eq64F x y) 1674 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y)) 1675 for { 1676 x := v_0 1677 y := v_1 1678 v.reset(OpS390XLOCGR) 1679 v.Aux = s390xCCMaskToAux(s390x.Equal) 1680 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1681 v0.AuxInt = int64ToAuxInt(0) 1682 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1683 v1.AuxInt = int64ToAuxInt(1) 1684 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags) 1685 v2.AddArg2(x, y) 1686 v.AddArg3(v0, v1, v2) 1687 return true 1688 } 1689 } 1690 func rewriteValueS390X_OpEq8(v *Value) bool { 1691 v_1 := v.Args[1] 1692 v_0 := v.Args[0] 1693 b := v.Block 1694 typ := &b.Func.Config.Types 1695 // match: (Eq8 x y) 1696 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 1697 for { 1698 x := v_0 1699 y := v_1 1700 v.reset(OpS390XLOCGR) 1701 v.Aux = s390xCCMaskToAux(s390x.Equal) 1702 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1703 v0.AuxInt = int64ToAuxInt(0) 1704 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1705 v1.AuxInt = int64ToAuxInt(1) 1706 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1707 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1708 v3.AddArg(x) 1709 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1710 v4.AddArg(y) 1711 v2.AddArg2(v3, v4) 1712 v.AddArg3(v0, v1, v2) 1713 return true 1714 } 1715 } 1716 func rewriteValueS390X_OpEqB(v *Value) bool { 1717 v_1 := v.Args[1] 1718 v_0 := v.Args[0] 1719 b := v.Block 1720 typ := &b.Func.Config.Types 1721 // match: (EqB x y) 1722 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 1723 for { 1724 x := v_0 1725 y := v_1 1726 v.reset(OpS390XLOCGR) 1727 v.Aux = s390xCCMaskToAux(s390x.Equal) 1728 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1729 v0.AuxInt = int64ToAuxInt(0) 1730 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1731 v1.AuxInt = int64ToAuxInt(1) 1732 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1733 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1734 v3.AddArg(x) 1735 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1736 v4.AddArg(y) 1737 v2.AddArg2(v3, v4) 1738 v.AddArg3(v0, v1, v2) 1739 return true 1740 } 1741 } 1742 func rewriteValueS390X_OpEqPtr(v *Value) bool { 1743 v_1 := v.Args[1] 1744 v_0 := v.Args[0] 1745 b := v.Block 1746 typ := &b.Func.Config.Types 1747 // match: (EqPtr x y) 1748 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 1749 for { 1750 x := v_0 1751 y := v_1 1752 v.reset(OpS390XLOCGR) 1753 v.Aux = s390xCCMaskToAux(s390x.Equal) 1754 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1755 v0.AuxInt = int64ToAuxInt(0) 1756 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1757 v1.AuxInt = int64ToAuxInt(1) 1758 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 1759 v2.AddArg2(x, y) 1760 v.AddArg3(v0, v1, v2) 1761 return true 1762 } 1763 } 1764 func rewriteValueS390X_OpFMA(v *Value) bool { 1765 v_2 := v.Args[2] 1766 v_1 := v.Args[1] 1767 v_0 := v.Args[0] 1768 // match: (FMA x y z) 1769 // result: (FMADD z x y) 1770 for { 1771 x := v_0 1772 y := v_1 1773 z := v_2 1774 v.reset(OpS390XFMADD) 1775 v.AddArg3(z, x, y) 1776 return true 1777 } 1778 } 1779 func rewriteValueS390X_OpFloor(v *Value) bool { 1780 v_0 := v.Args[0] 1781 // match: (Floor x) 1782 // result: (FIDBR [7] x) 1783 for { 1784 x := v_0 1785 v.reset(OpS390XFIDBR) 1786 v.AuxInt = int8ToAuxInt(7) 1787 v.AddArg(x) 1788 return true 1789 } 1790 } 1791 func rewriteValueS390X_OpHmul32(v *Value) bool { 1792 v_1 := v.Args[1] 1793 v_0 := v.Args[0] 1794 b := v.Block 1795 typ := &b.Func.Config.Types 1796 // match: (Hmul32 x y) 1797 // result: (SRDconst [32] (MULLD (MOVWreg x) (MOVWreg y))) 1798 for { 1799 x := v_0 1800 y := v_1 1801 v.reset(OpS390XSRDconst) 1802 v.AuxInt = uint8ToAuxInt(32) 1803 v0 := b.NewValue0(v.Pos, OpS390XMULLD, typ.Int64) 1804 v1 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64) 1805 v1.AddArg(x) 1806 v2 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64) 1807 v2.AddArg(y) 1808 v0.AddArg2(v1, v2) 1809 v.AddArg(v0) 1810 return true 1811 } 1812 } 1813 func rewriteValueS390X_OpHmul32u(v *Value) bool { 1814 v_1 := v.Args[1] 1815 v_0 := v.Args[0] 1816 b := v.Block 1817 typ := &b.Func.Config.Types 1818 // match: (Hmul32u x y) 1819 // result: (SRDconst [32] (MULLD (MOVWZreg x) (MOVWZreg y))) 1820 for { 1821 x := v_0 1822 y := v_1 1823 v.reset(OpS390XSRDconst) 1824 v.AuxInt = uint8ToAuxInt(32) 1825 v0 := b.NewValue0(v.Pos, OpS390XMULLD, typ.Int64) 1826 v1 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 1827 v1.AddArg(x) 1828 v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 1829 v2.AddArg(y) 1830 v0.AddArg2(v1, v2) 1831 v.AddArg(v0) 1832 return true 1833 } 1834 } 1835 func rewriteValueS390X_OpITab(v *Value) bool { 1836 v_0 := v.Args[0] 1837 // match: (ITab (Load ptr mem)) 1838 // result: (MOVDload ptr mem) 1839 for { 1840 if v_0.Op != OpLoad { 1841 break 1842 } 1843 mem := v_0.Args[1] 1844 ptr := v_0.Args[0] 1845 v.reset(OpS390XMOVDload) 1846 v.AddArg2(ptr, mem) 1847 return true 1848 } 1849 return false 1850 } 1851 func rewriteValueS390X_OpIsInBounds(v *Value) bool { 1852 v_1 := v.Args[1] 1853 v_0 := v.Args[0] 1854 b := v.Block 1855 typ := &b.Func.Config.Types 1856 // match: (IsInBounds idx len) 1857 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPU idx len)) 1858 for { 1859 idx := v_0 1860 len := v_1 1861 v.reset(OpS390XLOCGR) 1862 v.Aux = s390xCCMaskToAux(s390x.Less) 1863 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1864 v0.AuxInt = int64ToAuxInt(0) 1865 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1866 v1.AuxInt = int64ToAuxInt(1) 1867 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 1868 v2.AddArg2(idx, len) 1869 v.AddArg3(v0, v1, v2) 1870 return true 1871 } 1872 } 1873 func rewriteValueS390X_OpIsNonNil(v *Value) bool { 1874 v_0 := v.Args[0] 1875 b := v.Block 1876 typ := &b.Func.Config.Types 1877 // match: (IsNonNil p) 1878 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPconst p [0])) 1879 for { 1880 p := v_0 1881 v.reset(OpS390XLOCGR) 1882 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 1883 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1884 v0.AuxInt = int64ToAuxInt(0) 1885 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1886 v1.AuxInt = int64ToAuxInt(1) 1887 v2 := b.NewValue0(v.Pos, OpS390XCMPconst, types.TypeFlags) 1888 v2.AuxInt = int32ToAuxInt(0) 1889 v2.AddArg(p) 1890 v.AddArg3(v0, v1, v2) 1891 return true 1892 } 1893 } 1894 func rewriteValueS390X_OpIsSliceInBounds(v *Value) bool { 1895 v_1 := v.Args[1] 1896 v_0 := v.Args[0] 1897 b := v.Block 1898 typ := &b.Func.Config.Types 1899 // match: (IsSliceInBounds idx len) 1900 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPU idx len)) 1901 for { 1902 idx := v_0 1903 len := v_1 1904 v.reset(OpS390XLOCGR) 1905 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1906 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1907 v0.AuxInt = int64ToAuxInt(0) 1908 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1909 v1.AuxInt = int64ToAuxInt(1) 1910 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 1911 v2.AddArg2(idx, len) 1912 v.AddArg3(v0, v1, v2) 1913 return true 1914 } 1915 } 1916 func rewriteValueS390X_OpLeq16(v *Value) bool { 1917 v_1 := v.Args[1] 1918 v_0 := v.Args[0] 1919 b := v.Block 1920 typ := &b.Func.Config.Types 1921 // match: (Leq16 x y) 1922 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y))) 1923 for { 1924 x := v_0 1925 y := v_1 1926 v.reset(OpS390XLOCGR) 1927 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1928 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1929 v0.AuxInt = int64ToAuxInt(0) 1930 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1931 v1.AuxInt = int64ToAuxInt(1) 1932 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1933 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1934 v3.AddArg(x) 1935 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1936 v4.AddArg(y) 1937 v2.AddArg2(v3, v4) 1938 v.AddArg3(v0, v1, v2) 1939 return true 1940 } 1941 } 1942 func rewriteValueS390X_OpLeq16U(v *Value) bool { 1943 v_1 := v.Args[1] 1944 v_0 := v.Args[0] 1945 b := v.Block 1946 typ := &b.Func.Config.Types 1947 // match: (Leq16U x y) 1948 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVHZreg x) (MOVHZreg y))) 1949 for { 1950 x := v_0 1951 y := v_1 1952 v.reset(OpS390XLOCGR) 1953 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1954 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1955 v0.AuxInt = int64ToAuxInt(0) 1956 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1957 v1.AuxInt = int64ToAuxInt(1) 1958 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 1959 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 1960 v3.AddArg(x) 1961 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 1962 v4.AddArg(y) 1963 v2.AddArg2(v3, v4) 1964 v.AddArg3(v0, v1, v2) 1965 return true 1966 } 1967 } 1968 func rewriteValueS390X_OpLeq32(v *Value) bool { 1969 v_1 := v.Args[1] 1970 v_0 := v.Args[0] 1971 b := v.Block 1972 typ := &b.Func.Config.Types 1973 // match: (Leq32 x y) 1974 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y)) 1975 for { 1976 x := v_0 1977 y := v_1 1978 v.reset(OpS390XLOCGR) 1979 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1980 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1981 v0.AuxInt = int64ToAuxInt(0) 1982 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1983 v1.AuxInt = int64ToAuxInt(1) 1984 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1985 v2.AddArg2(x, y) 1986 v.AddArg3(v0, v1, v2) 1987 return true 1988 } 1989 } 1990 func rewriteValueS390X_OpLeq32F(v *Value) bool { 1991 v_1 := v.Args[1] 1992 v_0 := v.Args[0] 1993 b := v.Block 1994 typ := &b.Func.Config.Types 1995 // match: (Leq32F x y) 1996 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y)) 1997 for { 1998 x := v_0 1999 y := v_1 2000 v.reset(OpS390XLOCGR) 2001 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2002 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2003 v0.AuxInt = int64ToAuxInt(0) 2004 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2005 v1.AuxInt = int64ToAuxInt(1) 2006 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags) 2007 v2.AddArg2(x, y) 2008 v.AddArg3(v0, v1, v2) 2009 return true 2010 } 2011 } 2012 func rewriteValueS390X_OpLeq32U(v *Value) bool { 2013 v_1 := v.Args[1] 2014 v_0 := v.Args[0] 2015 b := v.Block 2016 typ := &b.Func.Config.Types 2017 // match: (Leq32U x y) 2018 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU x y)) 2019 for { 2020 x := v_0 2021 y := v_1 2022 v.reset(OpS390XLOCGR) 2023 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2024 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2025 v0.AuxInt = int64ToAuxInt(0) 2026 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2027 v1.AuxInt = int64ToAuxInt(1) 2028 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 2029 v2.AddArg2(x, y) 2030 v.AddArg3(v0, v1, v2) 2031 return true 2032 } 2033 } 2034 func rewriteValueS390X_OpLeq64(v *Value) bool { 2035 v_1 := v.Args[1] 2036 v_0 := v.Args[0] 2037 b := v.Block 2038 typ := &b.Func.Config.Types 2039 // match: (Leq64 x y) 2040 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 2041 for { 2042 x := v_0 2043 y := v_1 2044 v.reset(OpS390XLOCGR) 2045 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2046 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2047 v0.AuxInt = int64ToAuxInt(0) 2048 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2049 v1.AuxInt = int64ToAuxInt(1) 2050 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 2051 v2.AddArg2(x, y) 2052 v.AddArg3(v0, v1, v2) 2053 return true 2054 } 2055 } 2056 func rewriteValueS390X_OpLeq64F(v *Value) bool { 2057 v_1 := v.Args[1] 2058 v_0 := v.Args[0] 2059 b := v.Block 2060 typ := &b.Func.Config.Types 2061 // match: (Leq64F x y) 2062 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y)) 2063 for { 2064 x := v_0 2065 y := v_1 2066 v.reset(OpS390XLOCGR) 2067 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2068 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2069 v0.AuxInt = int64ToAuxInt(0) 2070 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2071 v1.AuxInt = int64ToAuxInt(1) 2072 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags) 2073 v2.AddArg2(x, y) 2074 v.AddArg3(v0, v1, v2) 2075 return true 2076 } 2077 } 2078 func rewriteValueS390X_OpLeq64U(v *Value) bool { 2079 v_1 := v.Args[1] 2080 v_0 := v.Args[0] 2081 b := v.Block 2082 typ := &b.Func.Config.Types 2083 // match: (Leq64U x y) 2084 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPU x y)) 2085 for { 2086 x := v_0 2087 y := v_1 2088 v.reset(OpS390XLOCGR) 2089 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2090 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2091 v0.AuxInt = int64ToAuxInt(0) 2092 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2093 v1.AuxInt = int64ToAuxInt(1) 2094 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 2095 v2.AddArg2(x, y) 2096 v.AddArg3(v0, v1, v2) 2097 return true 2098 } 2099 } 2100 func rewriteValueS390X_OpLeq8(v *Value) bool { 2101 v_1 := v.Args[1] 2102 v_0 := v.Args[0] 2103 b := v.Block 2104 typ := &b.Func.Config.Types 2105 // match: (Leq8 x y) 2106 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 2107 for { 2108 x := v_0 2109 y := v_1 2110 v.reset(OpS390XLOCGR) 2111 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2112 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2113 v0.AuxInt = int64ToAuxInt(0) 2114 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2115 v1.AuxInt = int64ToAuxInt(1) 2116 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 2117 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 2118 v3.AddArg(x) 2119 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 2120 v4.AddArg(y) 2121 v2.AddArg2(v3, v4) 2122 v.AddArg3(v0, v1, v2) 2123 return true 2124 } 2125 } 2126 func rewriteValueS390X_OpLeq8U(v *Value) bool { 2127 v_1 := v.Args[1] 2128 v_0 := v.Args[0] 2129 b := v.Block 2130 typ := &b.Func.Config.Types 2131 // match: (Leq8U x y) 2132 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVBZreg x) (MOVBZreg y))) 2133 for { 2134 x := v_0 2135 y := v_1 2136 v.reset(OpS390XLOCGR) 2137 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2138 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2139 v0.AuxInt = int64ToAuxInt(0) 2140 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2141 v1.AuxInt = int64ToAuxInt(1) 2142 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 2143 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2144 v3.AddArg(x) 2145 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2146 v4.AddArg(y) 2147 v2.AddArg2(v3, v4) 2148 v.AddArg3(v0, v1, v2) 2149 return true 2150 } 2151 } 2152 func rewriteValueS390X_OpLess16(v *Value) bool { 2153 v_1 := v.Args[1] 2154 v_0 := v.Args[0] 2155 b := v.Block 2156 typ := &b.Func.Config.Types 2157 // match: (Less16 x y) 2158 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y))) 2159 for { 2160 x := v_0 2161 y := v_1 2162 v.reset(OpS390XLOCGR) 2163 v.Aux = s390xCCMaskToAux(s390x.Less) 2164 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2165 v0.AuxInt = int64ToAuxInt(0) 2166 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2167 v1.AuxInt = int64ToAuxInt(1) 2168 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 2169 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 2170 v3.AddArg(x) 2171 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 2172 v4.AddArg(y) 2173 v2.AddArg2(v3, v4) 2174 v.AddArg3(v0, v1, v2) 2175 return true 2176 } 2177 } 2178 func rewriteValueS390X_OpLess16U(v *Value) bool { 2179 v_1 := v.Args[1] 2180 v_0 := v.Args[0] 2181 b := v.Block 2182 typ := &b.Func.Config.Types 2183 // match: (Less16U x y) 2184 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVHZreg x) (MOVHZreg y))) 2185 for { 2186 x := v_0 2187 y := v_1 2188 v.reset(OpS390XLOCGR) 2189 v.Aux = s390xCCMaskToAux(s390x.Less) 2190 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2191 v0.AuxInt = int64ToAuxInt(0) 2192 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2193 v1.AuxInt = int64ToAuxInt(1) 2194 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 2195 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2196 v3.AddArg(x) 2197 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2198 v4.AddArg(y) 2199 v2.AddArg2(v3, v4) 2200 v.AddArg3(v0, v1, v2) 2201 return true 2202 } 2203 } 2204 func rewriteValueS390X_OpLess32(v *Value) bool { 2205 v_1 := v.Args[1] 2206 v_0 := v.Args[0] 2207 b := v.Block 2208 typ := &b.Func.Config.Types 2209 // match: (Less32 x y) 2210 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y)) 2211 for { 2212 x := v_0 2213 y := v_1 2214 v.reset(OpS390XLOCGR) 2215 v.Aux = s390xCCMaskToAux(s390x.Less) 2216 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2217 v0.AuxInt = int64ToAuxInt(0) 2218 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2219 v1.AuxInt = int64ToAuxInt(1) 2220 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 2221 v2.AddArg2(x, y) 2222 v.AddArg3(v0, v1, v2) 2223 return true 2224 } 2225 } 2226 func rewriteValueS390X_OpLess32F(v *Value) bool { 2227 v_1 := v.Args[1] 2228 v_0 := v.Args[0] 2229 b := v.Block 2230 typ := &b.Func.Config.Types 2231 // match: (Less32F x y) 2232 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y)) 2233 for { 2234 x := v_0 2235 y := v_1 2236 v.reset(OpS390XLOCGR) 2237 v.Aux = s390xCCMaskToAux(s390x.Less) 2238 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2239 v0.AuxInt = int64ToAuxInt(0) 2240 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2241 v1.AuxInt = int64ToAuxInt(1) 2242 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags) 2243 v2.AddArg2(x, y) 2244 v.AddArg3(v0, v1, v2) 2245 return true 2246 } 2247 } 2248 func rewriteValueS390X_OpLess32U(v *Value) bool { 2249 v_1 := v.Args[1] 2250 v_0 := v.Args[0] 2251 b := v.Block 2252 typ := &b.Func.Config.Types 2253 // match: (Less32U x y) 2254 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU x y)) 2255 for { 2256 x := v_0 2257 y := v_1 2258 v.reset(OpS390XLOCGR) 2259 v.Aux = s390xCCMaskToAux(s390x.Less) 2260 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2261 v0.AuxInt = int64ToAuxInt(0) 2262 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2263 v1.AuxInt = int64ToAuxInt(1) 2264 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 2265 v2.AddArg2(x, y) 2266 v.AddArg3(v0, v1, v2) 2267 return true 2268 } 2269 } 2270 func rewriteValueS390X_OpLess64(v *Value) bool { 2271 v_1 := v.Args[1] 2272 v_0 := v.Args[0] 2273 b := v.Block 2274 typ := &b.Func.Config.Types 2275 // match: (Less64 x y) 2276 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 2277 for { 2278 x := v_0 2279 y := v_1 2280 v.reset(OpS390XLOCGR) 2281 v.Aux = s390xCCMaskToAux(s390x.Less) 2282 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2283 v0.AuxInt = int64ToAuxInt(0) 2284 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2285 v1.AuxInt = int64ToAuxInt(1) 2286 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 2287 v2.AddArg2(x, y) 2288 v.AddArg3(v0, v1, v2) 2289 return true 2290 } 2291 } 2292 func rewriteValueS390X_OpLess64F(v *Value) bool { 2293 v_1 := v.Args[1] 2294 v_0 := v.Args[0] 2295 b := v.Block 2296 typ := &b.Func.Config.Types 2297 // match: (Less64F x y) 2298 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y)) 2299 for { 2300 x := v_0 2301 y := v_1 2302 v.reset(OpS390XLOCGR) 2303 v.Aux = s390xCCMaskToAux(s390x.Less) 2304 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2305 v0.AuxInt = int64ToAuxInt(0) 2306 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2307 v1.AuxInt = int64ToAuxInt(1) 2308 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags) 2309 v2.AddArg2(x, y) 2310 v.AddArg3(v0, v1, v2) 2311 return true 2312 } 2313 } 2314 func rewriteValueS390X_OpLess64U(v *Value) bool { 2315 v_1 := v.Args[1] 2316 v_0 := v.Args[0] 2317 b := v.Block 2318 typ := &b.Func.Config.Types 2319 // match: (Less64U x y) 2320 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPU x y)) 2321 for { 2322 x := v_0 2323 y := v_1 2324 v.reset(OpS390XLOCGR) 2325 v.Aux = s390xCCMaskToAux(s390x.Less) 2326 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2327 v0.AuxInt = int64ToAuxInt(0) 2328 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2329 v1.AuxInt = int64ToAuxInt(1) 2330 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 2331 v2.AddArg2(x, y) 2332 v.AddArg3(v0, v1, v2) 2333 return true 2334 } 2335 } 2336 func rewriteValueS390X_OpLess8(v *Value) bool { 2337 v_1 := v.Args[1] 2338 v_0 := v.Args[0] 2339 b := v.Block 2340 typ := &b.Func.Config.Types 2341 // match: (Less8 x y) 2342 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 2343 for { 2344 x := v_0 2345 y := v_1 2346 v.reset(OpS390XLOCGR) 2347 v.Aux = s390xCCMaskToAux(s390x.Less) 2348 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2349 v0.AuxInt = int64ToAuxInt(0) 2350 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2351 v1.AuxInt = int64ToAuxInt(1) 2352 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 2353 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 2354 v3.AddArg(x) 2355 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 2356 v4.AddArg(y) 2357 v2.AddArg2(v3, v4) 2358 v.AddArg3(v0, v1, v2) 2359 return true 2360 } 2361 } 2362 func rewriteValueS390X_OpLess8U(v *Value) bool { 2363 v_1 := v.Args[1] 2364 v_0 := v.Args[0] 2365 b := v.Block 2366 typ := &b.Func.Config.Types 2367 // match: (Less8U x y) 2368 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVBZreg x) (MOVBZreg y))) 2369 for { 2370 x := v_0 2371 y := v_1 2372 v.reset(OpS390XLOCGR) 2373 v.Aux = s390xCCMaskToAux(s390x.Less) 2374 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2375 v0.AuxInt = int64ToAuxInt(0) 2376 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2377 v1.AuxInt = int64ToAuxInt(1) 2378 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 2379 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2380 v3.AddArg(x) 2381 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2382 v4.AddArg(y) 2383 v2.AddArg2(v3, v4) 2384 v.AddArg3(v0, v1, v2) 2385 return true 2386 } 2387 } 2388 func rewriteValueS390X_OpLoad(v *Value) bool { 2389 v_1 := v.Args[1] 2390 v_0 := v.Args[0] 2391 // match: (Load <t> ptr mem) 2392 // cond: (is64BitInt(t) || isPtr(t)) 2393 // result: (MOVDload ptr mem) 2394 for { 2395 t := v.Type 2396 ptr := v_0 2397 mem := v_1 2398 if !(is64BitInt(t) || isPtr(t)) { 2399 break 2400 } 2401 v.reset(OpS390XMOVDload) 2402 v.AddArg2(ptr, mem) 2403 return true 2404 } 2405 // match: (Load <t> ptr mem) 2406 // cond: is32BitInt(t) && t.IsSigned() 2407 // result: (MOVWload ptr mem) 2408 for { 2409 t := v.Type 2410 ptr := v_0 2411 mem := v_1 2412 if !(is32BitInt(t) && t.IsSigned()) { 2413 break 2414 } 2415 v.reset(OpS390XMOVWload) 2416 v.AddArg2(ptr, mem) 2417 return true 2418 } 2419 // match: (Load <t> ptr mem) 2420 // cond: is32BitInt(t) && !t.IsSigned() 2421 // result: (MOVWZload ptr mem) 2422 for { 2423 t := v.Type 2424 ptr := v_0 2425 mem := v_1 2426 if !(is32BitInt(t) && !t.IsSigned()) { 2427 break 2428 } 2429 v.reset(OpS390XMOVWZload) 2430 v.AddArg2(ptr, mem) 2431 return true 2432 } 2433 // match: (Load <t> ptr mem) 2434 // cond: is16BitInt(t) && t.IsSigned() 2435 // result: (MOVHload ptr mem) 2436 for { 2437 t := v.Type 2438 ptr := v_0 2439 mem := v_1 2440 if !(is16BitInt(t) && t.IsSigned()) { 2441 break 2442 } 2443 v.reset(OpS390XMOVHload) 2444 v.AddArg2(ptr, mem) 2445 return true 2446 } 2447 // match: (Load <t> ptr mem) 2448 // cond: is16BitInt(t) && !t.IsSigned() 2449 // result: (MOVHZload ptr mem) 2450 for { 2451 t := v.Type 2452 ptr := v_0 2453 mem := v_1 2454 if !(is16BitInt(t) && !t.IsSigned()) { 2455 break 2456 } 2457 v.reset(OpS390XMOVHZload) 2458 v.AddArg2(ptr, mem) 2459 return true 2460 } 2461 // match: (Load <t> ptr mem) 2462 // cond: is8BitInt(t) && t.IsSigned() 2463 // result: (MOVBload ptr mem) 2464 for { 2465 t := v.Type 2466 ptr := v_0 2467 mem := v_1 2468 if !(is8BitInt(t) && t.IsSigned()) { 2469 break 2470 } 2471 v.reset(OpS390XMOVBload) 2472 v.AddArg2(ptr, mem) 2473 return true 2474 } 2475 // match: (Load <t> ptr mem) 2476 // cond: (t.IsBoolean() || (is8BitInt(t) && !t.IsSigned())) 2477 // result: (MOVBZload ptr mem) 2478 for { 2479 t := v.Type 2480 ptr := v_0 2481 mem := v_1 2482 if !(t.IsBoolean() || (is8BitInt(t) && !t.IsSigned())) { 2483 break 2484 } 2485 v.reset(OpS390XMOVBZload) 2486 v.AddArg2(ptr, mem) 2487 return true 2488 } 2489 // match: (Load <t> ptr mem) 2490 // cond: is32BitFloat(t) 2491 // result: (FMOVSload ptr mem) 2492 for { 2493 t := v.Type 2494 ptr := v_0 2495 mem := v_1 2496 if !(is32BitFloat(t)) { 2497 break 2498 } 2499 v.reset(OpS390XFMOVSload) 2500 v.AddArg2(ptr, mem) 2501 return true 2502 } 2503 // match: (Load <t> ptr mem) 2504 // cond: is64BitFloat(t) 2505 // result: (FMOVDload ptr mem) 2506 for { 2507 t := v.Type 2508 ptr := v_0 2509 mem := v_1 2510 if !(is64BitFloat(t)) { 2511 break 2512 } 2513 v.reset(OpS390XFMOVDload) 2514 v.AddArg2(ptr, mem) 2515 return true 2516 } 2517 return false 2518 } 2519 func rewriteValueS390X_OpLocalAddr(v *Value) bool { 2520 v_1 := v.Args[1] 2521 v_0 := v.Args[0] 2522 b := v.Block 2523 typ := &b.Func.Config.Types 2524 // match: (LocalAddr <t> {sym} base mem) 2525 // cond: t.Elem().HasPointers() 2526 // result: (MOVDaddr {sym} (SPanchored base mem)) 2527 for { 2528 t := v.Type 2529 sym := auxToSym(v.Aux) 2530 base := v_0 2531 mem := v_1 2532 if !(t.Elem().HasPointers()) { 2533 break 2534 } 2535 v.reset(OpS390XMOVDaddr) 2536 v.Aux = symToAux(sym) 2537 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr) 2538 v0.AddArg2(base, mem) 2539 v.AddArg(v0) 2540 return true 2541 } 2542 // match: (LocalAddr <t> {sym} base _) 2543 // cond: !t.Elem().HasPointers() 2544 // result: (MOVDaddr {sym} base) 2545 for { 2546 t := v.Type 2547 sym := auxToSym(v.Aux) 2548 base := v_0 2549 if !(!t.Elem().HasPointers()) { 2550 break 2551 } 2552 v.reset(OpS390XMOVDaddr) 2553 v.Aux = symToAux(sym) 2554 v.AddArg(base) 2555 return true 2556 } 2557 return false 2558 } 2559 func rewriteValueS390X_OpLsh16x16(v *Value) bool { 2560 v_1 := v.Args[1] 2561 v_0 := v.Args[0] 2562 b := v.Block 2563 typ := &b.Func.Config.Types 2564 // match: (Lsh16x16 x y) 2565 // cond: shiftIsBounded(v) 2566 // result: (SLW x y) 2567 for { 2568 x := v_0 2569 y := v_1 2570 if !(shiftIsBounded(v)) { 2571 break 2572 } 2573 v.reset(OpS390XSLW) 2574 v.AddArg2(x, y) 2575 return true 2576 } 2577 // match: (Lsh16x16 <t> x y) 2578 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 2579 for { 2580 t := v.Type 2581 x := v_0 2582 y := v_1 2583 v.reset(OpS390XLOCGR) 2584 v.Type = t 2585 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2586 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2587 v0.AddArg2(x, y) 2588 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2589 v1.AuxInt = int64ToAuxInt(0) 2590 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2591 v2.AuxInt = int32ToAuxInt(64) 2592 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2593 v3.AddArg(y) 2594 v2.AddArg(v3) 2595 v.AddArg3(v0, v1, v2) 2596 return true 2597 } 2598 } 2599 func rewriteValueS390X_OpLsh16x32(v *Value) bool { 2600 v_1 := v.Args[1] 2601 v_0 := v.Args[0] 2602 b := v.Block 2603 typ := &b.Func.Config.Types 2604 // match: (Lsh16x32 x y) 2605 // cond: shiftIsBounded(v) 2606 // result: (SLW x y) 2607 for { 2608 x := v_0 2609 y := v_1 2610 if !(shiftIsBounded(v)) { 2611 break 2612 } 2613 v.reset(OpS390XSLW) 2614 v.AddArg2(x, y) 2615 return true 2616 } 2617 // match: (Lsh16x32 <t> x y) 2618 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 2619 for { 2620 t := v.Type 2621 x := v_0 2622 y := v_1 2623 v.reset(OpS390XLOCGR) 2624 v.Type = t 2625 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2626 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2627 v0.AddArg2(x, y) 2628 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2629 v1.AuxInt = int64ToAuxInt(0) 2630 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2631 v2.AuxInt = int32ToAuxInt(64) 2632 v2.AddArg(y) 2633 v.AddArg3(v0, v1, v2) 2634 return true 2635 } 2636 } 2637 func rewriteValueS390X_OpLsh16x64(v *Value) bool { 2638 v_1 := v.Args[1] 2639 v_0 := v.Args[0] 2640 b := v.Block 2641 typ := &b.Func.Config.Types 2642 // match: (Lsh16x64 x y) 2643 // cond: shiftIsBounded(v) 2644 // result: (SLW x y) 2645 for { 2646 x := v_0 2647 y := v_1 2648 if !(shiftIsBounded(v)) { 2649 break 2650 } 2651 v.reset(OpS390XSLW) 2652 v.AddArg2(x, y) 2653 return true 2654 } 2655 // match: (Lsh16x64 <t> x y) 2656 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 2657 for { 2658 t := v.Type 2659 x := v_0 2660 y := v_1 2661 v.reset(OpS390XLOCGR) 2662 v.Type = t 2663 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2664 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2665 v0.AddArg2(x, y) 2666 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2667 v1.AuxInt = int64ToAuxInt(0) 2668 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 2669 v2.AuxInt = int32ToAuxInt(64) 2670 v2.AddArg(y) 2671 v.AddArg3(v0, v1, v2) 2672 return true 2673 } 2674 } 2675 func rewriteValueS390X_OpLsh16x8(v *Value) bool { 2676 v_1 := v.Args[1] 2677 v_0 := v.Args[0] 2678 b := v.Block 2679 typ := &b.Func.Config.Types 2680 // match: (Lsh16x8 x y) 2681 // cond: shiftIsBounded(v) 2682 // result: (SLW x y) 2683 for { 2684 x := v_0 2685 y := v_1 2686 if !(shiftIsBounded(v)) { 2687 break 2688 } 2689 v.reset(OpS390XSLW) 2690 v.AddArg2(x, y) 2691 return true 2692 } 2693 // match: (Lsh16x8 <t> x y) 2694 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 2695 for { 2696 t := v.Type 2697 x := v_0 2698 y := v_1 2699 v.reset(OpS390XLOCGR) 2700 v.Type = t 2701 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2702 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2703 v0.AddArg2(x, y) 2704 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2705 v1.AuxInt = int64ToAuxInt(0) 2706 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2707 v2.AuxInt = int32ToAuxInt(64) 2708 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2709 v3.AddArg(y) 2710 v2.AddArg(v3) 2711 v.AddArg3(v0, v1, v2) 2712 return true 2713 } 2714 } 2715 func rewriteValueS390X_OpLsh32x16(v *Value) bool { 2716 v_1 := v.Args[1] 2717 v_0 := v.Args[0] 2718 b := v.Block 2719 typ := &b.Func.Config.Types 2720 // match: (Lsh32x16 x y) 2721 // cond: shiftIsBounded(v) 2722 // result: (SLW x y) 2723 for { 2724 x := v_0 2725 y := v_1 2726 if !(shiftIsBounded(v)) { 2727 break 2728 } 2729 v.reset(OpS390XSLW) 2730 v.AddArg2(x, y) 2731 return true 2732 } 2733 // match: (Lsh32x16 <t> x y) 2734 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 2735 for { 2736 t := v.Type 2737 x := v_0 2738 y := v_1 2739 v.reset(OpS390XLOCGR) 2740 v.Type = t 2741 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2742 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2743 v0.AddArg2(x, y) 2744 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2745 v1.AuxInt = int64ToAuxInt(0) 2746 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2747 v2.AuxInt = int32ToAuxInt(64) 2748 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2749 v3.AddArg(y) 2750 v2.AddArg(v3) 2751 v.AddArg3(v0, v1, v2) 2752 return true 2753 } 2754 } 2755 func rewriteValueS390X_OpLsh32x32(v *Value) bool { 2756 v_1 := v.Args[1] 2757 v_0 := v.Args[0] 2758 b := v.Block 2759 typ := &b.Func.Config.Types 2760 // match: (Lsh32x32 x y) 2761 // cond: shiftIsBounded(v) 2762 // result: (SLW x y) 2763 for { 2764 x := v_0 2765 y := v_1 2766 if !(shiftIsBounded(v)) { 2767 break 2768 } 2769 v.reset(OpS390XSLW) 2770 v.AddArg2(x, y) 2771 return true 2772 } 2773 // match: (Lsh32x32 <t> x y) 2774 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 2775 for { 2776 t := v.Type 2777 x := v_0 2778 y := v_1 2779 v.reset(OpS390XLOCGR) 2780 v.Type = t 2781 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2782 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2783 v0.AddArg2(x, y) 2784 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2785 v1.AuxInt = int64ToAuxInt(0) 2786 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2787 v2.AuxInt = int32ToAuxInt(64) 2788 v2.AddArg(y) 2789 v.AddArg3(v0, v1, v2) 2790 return true 2791 } 2792 } 2793 func rewriteValueS390X_OpLsh32x64(v *Value) bool { 2794 v_1 := v.Args[1] 2795 v_0 := v.Args[0] 2796 b := v.Block 2797 typ := &b.Func.Config.Types 2798 // match: (Lsh32x64 x y) 2799 // cond: shiftIsBounded(v) 2800 // result: (SLW x y) 2801 for { 2802 x := v_0 2803 y := v_1 2804 if !(shiftIsBounded(v)) { 2805 break 2806 } 2807 v.reset(OpS390XSLW) 2808 v.AddArg2(x, y) 2809 return true 2810 } 2811 // match: (Lsh32x64 <t> x y) 2812 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 2813 for { 2814 t := v.Type 2815 x := v_0 2816 y := v_1 2817 v.reset(OpS390XLOCGR) 2818 v.Type = t 2819 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2820 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2821 v0.AddArg2(x, y) 2822 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2823 v1.AuxInt = int64ToAuxInt(0) 2824 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 2825 v2.AuxInt = int32ToAuxInt(64) 2826 v2.AddArg(y) 2827 v.AddArg3(v0, v1, v2) 2828 return true 2829 } 2830 } 2831 func rewriteValueS390X_OpLsh32x8(v *Value) bool { 2832 v_1 := v.Args[1] 2833 v_0 := v.Args[0] 2834 b := v.Block 2835 typ := &b.Func.Config.Types 2836 // match: (Lsh32x8 x y) 2837 // cond: shiftIsBounded(v) 2838 // result: (SLW x y) 2839 for { 2840 x := v_0 2841 y := v_1 2842 if !(shiftIsBounded(v)) { 2843 break 2844 } 2845 v.reset(OpS390XSLW) 2846 v.AddArg2(x, y) 2847 return true 2848 } 2849 // match: (Lsh32x8 <t> x y) 2850 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 2851 for { 2852 t := v.Type 2853 x := v_0 2854 y := v_1 2855 v.reset(OpS390XLOCGR) 2856 v.Type = t 2857 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2858 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2859 v0.AddArg2(x, y) 2860 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2861 v1.AuxInt = int64ToAuxInt(0) 2862 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2863 v2.AuxInt = int32ToAuxInt(64) 2864 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2865 v3.AddArg(y) 2866 v2.AddArg(v3) 2867 v.AddArg3(v0, v1, v2) 2868 return true 2869 } 2870 } 2871 func rewriteValueS390X_OpLsh64x16(v *Value) bool { 2872 v_1 := v.Args[1] 2873 v_0 := v.Args[0] 2874 b := v.Block 2875 typ := &b.Func.Config.Types 2876 // match: (Lsh64x16 x y) 2877 // cond: shiftIsBounded(v) 2878 // result: (SLD x y) 2879 for { 2880 x := v_0 2881 y := v_1 2882 if !(shiftIsBounded(v)) { 2883 break 2884 } 2885 v.reset(OpS390XSLD) 2886 v.AddArg2(x, y) 2887 return true 2888 } 2889 // match: (Lsh64x16 <t> x y) 2890 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 2891 for { 2892 t := v.Type 2893 x := v_0 2894 y := v_1 2895 v.reset(OpS390XLOCGR) 2896 v.Type = t 2897 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2898 v0 := b.NewValue0(v.Pos, OpS390XSLD, t) 2899 v0.AddArg2(x, y) 2900 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2901 v1.AuxInt = int64ToAuxInt(0) 2902 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2903 v2.AuxInt = int32ToAuxInt(64) 2904 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2905 v3.AddArg(y) 2906 v2.AddArg(v3) 2907 v.AddArg3(v0, v1, v2) 2908 return true 2909 } 2910 } 2911 func rewriteValueS390X_OpLsh64x32(v *Value) bool { 2912 v_1 := v.Args[1] 2913 v_0 := v.Args[0] 2914 b := v.Block 2915 typ := &b.Func.Config.Types 2916 // match: (Lsh64x32 x y) 2917 // cond: shiftIsBounded(v) 2918 // result: (SLD x y) 2919 for { 2920 x := v_0 2921 y := v_1 2922 if !(shiftIsBounded(v)) { 2923 break 2924 } 2925 v.reset(OpS390XSLD) 2926 v.AddArg2(x, y) 2927 return true 2928 } 2929 // match: (Lsh64x32 <t> x y) 2930 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 2931 for { 2932 t := v.Type 2933 x := v_0 2934 y := v_1 2935 v.reset(OpS390XLOCGR) 2936 v.Type = t 2937 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2938 v0 := b.NewValue0(v.Pos, OpS390XSLD, t) 2939 v0.AddArg2(x, y) 2940 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2941 v1.AuxInt = int64ToAuxInt(0) 2942 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2943 v2.AuxInt = int32ToAuxInt(64) 2944 v2.AddArg(y) 2945 v.AddArg3(v0, v1, v2) 2946 return true 2947 } 2948 } 2949 func rewriteValueS390X_OpLsh64x64(v *Value) bool { 2950 v_1 := v.Args[1] 2951 v_0 := v.Args[0] 2952 b := v.Block 2953 typ := &b.Func.Config.Types 2954 // match: (Lsh64x64 x y) 2955 // cond: shiftIsBounded(v) 2956 // result: (SLD x y) 2957 for { 2958 x := v_0 2959 y := v_1 2960 if !(shiftIsBounded(v)) { 2961 break 2962 } 2963 v.reset(OpS390XSLD) 2964 v.AddArg2(x, y) 2965 return true 2966 } 2967 // match: (Lsh64x64 <t> x y) 2968 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 2969 for { 2970 t := v.Type 2971 x := v_0 2972 y := v_1 2973 v.reset(OpS390XLOCGR) 2974 v.Type = t 2975 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2976 v0 := b.NewValue0(v.Pos, OpS390XSLD, t) 2977 v0.AddArg2(x, y) 2978 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2979 v1.AuxInt = int64ToAuxInt(0) 2980 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 2981 v2.AuxInt = int32ToAuxInt(64) 2982 v2.AddArg(y) 2983 v.AddArg3(v0, v1, v2) 2984 return true 2985 } 2986 } 2987 func rewriteValueS390X_OpLsh64x8(v *Value) bool { 2988 v_1 := v.Args[1] 2989 v_0 := v.Args[0] 2990 b := v.Block 2991 typ := &b.Func.Config.Types 2992 // match: (Lsh64x8 x y) 2993 // cond: shiftIsBounded(v) 2994 // result: (SLD x y) 2995 for { 2996 x := v_0 2997 y := v_1 2998 if !(shiftIsBounded(v)) { 2999 break 3000 } 3001 v.reset(OpS390XSLD) 3002 v.AddArg2(x, y) 3003 return true 3004 } 3005 // match: (Lsh64x8 <t> x y) 3006 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 3007 for { 3008 t := v.Type 3009 x := v_0 3010 y := v_1 3011 v.reset(OpS390XLOCGR) 3012 v.Type = t 3013 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 3014 v0 := b.NewValue0(v.Pos, OpS390XSLD, t) 3015 v0.AddArg2(x, y) 3016 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3017 v1.AuxInt = int64ToAuxInt(0) 3018 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 3019 v2.AuxInt = int32ToAuxInt(64) 3020 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 3021 v3.AddArg(y) 3022 v2.AddArg(v3) 3023 v.AddArg3(v0, v1, v2) 3024 return true 3025 } 3026 } 3027 func rewriteValueS390X_OpLsh8x16(v *Value) bool { 3028 v_1 := v.Args[1] 3029 v_0 := v.Args[0] 3030 b := v.Block 3031 typ := &b.Func.Config.Types 3032 // match: (Lsh8x16 x y) 3033 // cond: shiftIsBounded(v) 3034 // result: (SLW x y) 3035 for { 3036 x := v_0 3037 y := v_1 3038 if !(shiftIsBounded(v)) { 3039 break 3040 } 3041 v.reset(OpS390XSLW) 3042 v.AddArg2(x, y) 3043 return true 3044 } 3045 // match: (Lsh8x16 <t> x y) 3046 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 3047 for { 3048 t := v.Type 3049 x := v_0 3050 y := v_1 3051 v.reset(OpS390XLOCGR) 3052 v.Type = t 3053 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 3054 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 3055 v0.AddArg2(x, y) 3056 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3057 v1.AuxInt = int64ToAuxInt(0) 3058 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 3059 v2.AuxInt = int32ToAuxInt(64) 3060 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 3061 v3.AddArg(y) 3062 v2.AddArg(v3) 3063 v.AddArg3(v0, v1, v2) 3064 return true 3065 } 3066 } 3067 func rewriteValueS390X_OpLsh8x32(v *Value) bool { 3068 v_1 := v.Args[1] 3069 v_0 := v.Args[0] 3070 b := v.Block 3071 typ := &b.Func.Config.Types 3072 // match: (Lsh8x32 x y) 3073 // cond: shiftIsBounded(v) 3074 // result: (SLW x y) 3075 for { 3076 x := v_0 3077 y := v_1 3078 if !(shiftIsBounded(v)) { 3079 break 3080 } 3081 v.reset(OpS390XSLW) 3082 v.AddArg2(x, y) 3083 return true 3084 } 3085 // match: (Lsh8x32 <t> x y) 3086 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 3087 for { 3088 t := v.Type 3089 x := v_0 3090 y := v_1 3091 v.reset(OpS390XLOCGR) 3092 v.Type = t 3093 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 3094 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 3095 v0.AddArg2(x, y) 3096 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3097 v1.AuxInt = int64ToAuxInt(0) 3098 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 3099 v2.AuxInt = int32ToAuxInt(64) 3100 v2.AddArg(y) 3101 v.AddArg3(v0, v1, v2) 3102 return true 3103 } 3104 } 3105 func rewriteValueS390X_OpLsh8x64(v *Value) bool { 3106 v_1 := v.Args[1] 3107 v_0 := v.Args[0] 3108 b := v.Block 3109 typ := &b.Func.Config.Types 3110 // match: (Lsh8x64 x y) 3111 // cond: shiftIsBounded(v) 3112 // result: (SLW x y) 3113 for { 3114 x := v_0 3115 y := v_1 3116 if !(shiftIsBounded(v)) { 3117 break 3118 } 3119 v.reset(OpS390XSLW) 3120 v.AddArg2(x, y) 3121 return true 3122 } 3123 // match: (Lsh8x64 <t> x y) 3124 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 3125 for { 3126 t := v.Type 3127 x := v_0 3128 y := v_1 3129 v.reset(OpS390XLOCGR) 3130 v.Type = t 3131 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 3132 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 3133 v0.AddArg2(x, y) 3134 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3135 v1.AuxInt = int64ToAuxInt(0) 3136 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 3137 v2.AuxInt = int32ToAuxInt(64) 3138 v2.AddArg(y) 3139 v.AddArg3(v0, v1, v2) 3140 return true 3141 } 3142 } 3143 func rewriteValueS390X_OpLsh8x8(v *Value) bool { 3144 v_1 := v.Args[1] 3145 v_0 := v.Args[0] 3146 b := v.Block 3147 typ := &b.Func.Config.Types 3148 // match: (Lsh8x8 x y) 3149 // cond: shiftIsBounded(v) 3150 // result: (SLW x y) 3151 for { 3152 x := v_0 3153 y := v_1 3154 if !(shiftIsBounded(v)) { 3155 break 3156 } 3157 v.reset(OpS390XSLW) 3158 v.AddArg2(x, y) 3159 return true 3160 } 3161 // match: (Lsh8x8 <t> x y) 3162 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 3163 for { 3164 t := v.Type 3165 x := v_0 3166 y := v_1 3167 v.reset(OpS390XLOCGR) 3168 v.Type = t 3169 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 3170 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 3171 v0.AddArg2(x, y) 3172 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3173 v1.AuxInt = int64ToAuxInt(0) 3174 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 3175 v2.AuxInt = int32ToAuxInt(64) 3176 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 3177 v3.AddArg(y) 3178 v2.AddArg(v3) 3179 v.AddArg3(v0, v1, v2) 3180 return true 3181 } 3182 } 3183 func rewriteValueS390X_OpMod16(v *Value) bool { 3184 v_1 := v.Args[1] 3185 v_0 := v.Args[0] 3186 b := v.Block 3187 typ := &b.Func.Config.Types 3188 // match: (Mod16 x y) 3189 // result: (MODW (MOVHreg x) (MOVHreg y)) 3190 for { 3191 x := v_0 3192 y := v_1 3193 v.reset(OpS390XMODW) 3194 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 3195 v0.AddArg(x) 3196 v1 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 3197 v1.AddArg(y) 3198 v.AddArg2(v0, v1) 3199 return true 3200 } 3201 } 3202 func rewriteValueS390X_OpMod16u(v *Value) bool { 3203 v_1 := v.Args[1] 3204 v_0 := v.Args[0] 3205 b := v.Block 3206 typ := &b.Func.Config.Types 3207 // match: (Mod16u x y) 3208 // result: (MODWU (MOVHZreg x) (MOVHZreg y)) 3209 for { 3210 x := v_0 3211 y := v_1 3212 v.reset(OpS390XMODWU) 3213 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 3214 v0.AddArg(x) 3215 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 3216 v1.AddArg(y) 3217 v.AddArg2(v0, v1) 3218 return true 3219 } 3220 } 3221 func rewriteValueS390X_OpMod32(v *Value) bool { 3222 v_1 := v.Args[1] 3223 v_0 := v.Args[0] 3224 b := v.Block 3225 typ := &b.Func.Config.Types 3226 // match: (Mod32 x y) 3227 // result: (MODW (MOVWreg x) y) 3228 for { 3229 x := v_0 3230 y := v_1 3231 v.reset(OpS390XMODW) 3232 v0 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64) 3233 v0.AddArg(x) 3234 v.AddArg2(v0, y) 3235 return true 3236 } 3237 } 3238 func rewriteValueS390X_OpMod32u(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: (Mod32u x y) 3244 // result: (MODWU (MOVWZreg x) y) 3245 for { 3246 x := v_0 3247 y := v_1 3248 v.reset(OpS390XMODWU) 3249 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 3250 v0.AddArg(x) 3251 v.AddArg2(v0, y) 3252 return true 3253 } 3254 } 3255 func rewriteValueS390X_OpMod64(v *Value) bool { 3256 v_1 := v.Args[1] 3257 v_0 := v.Args[0] 3258 // match: (Mod64 x y) 3259 // result: (MODD x y) 3260 for { 3261 x := v_0 3262 y := v_1 3263 v.reset(OpS390XMODD) 3264 v.AddArg2(x, y) 3265 return true 3266 } 3267 } 3268 func rewriteValueS390X_OpMod8(v *Value) bool { 3269 v_1 := v.Args[1] 3270 v_0 := v.Args[0] 3271 b := v.Block 3272 typ := &b.Func.Config.Types 3273 // match: (Mod8 x y) 3274 // result: (MODW (MOVBreg x) (MOVBreg y)) 3275 for { 3276 x := v_0 3277 y := v_1 3278 v.reset(OpS390XMODW) 3279 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3280 v0.AddArg(x) 3281 v1 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3282 v1.AddArg(y) 3283 v.AddArg2(v0, v1) 3284 return true 3285 } 3286 } 3287 func rewriteValueS390X_OpMod8u(v *Value) bool { 3288 v_1 := v.Args[1] 3289 v_0 := v.Args[0] 3290 b := v.Block 3291 typ := &b.Func.Config.Types 3292 // match: (Mod8u x y) 3293 // result: (MODWU (MOVBZreg x) (MOVBZreg y)) 3294 for { 3295 x := v_0 3296 y := v_1 3297 v.reset(OpS390XMODWU) 3298 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 3299 v0.AddArg(x) 3300 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 3301 v1.AddArg(y) 3302 v.AddArg2(v0, v1) 3303 return true 3304 } 3305 } 3306 func rewriteValueS390X_OpMove(v *Value) bool { 3307 v_2 := v.Args[2] 3308 v_1 := v.Args[1] 3309 v_0 := v.Args[0] 3310 b := v.Block 3311 typ := &b.Func.Config.Types 3312 // match: (Move [0] _ _ mem) 3313 // result: mem 3314 for { 3315 if auxIntToInt64(v.AuxInt) != 0 { 3316 break 3317 } 3318 mem := v_2 3319 v.copyOf(mem) 3320 return true 3321 } 3322 // match: (Move [1] dst src mem) 3323 // result: (MOVBstore dst (MOVBZload src mem) mem) 3324 for { 3325 if auxIntToInt64(v.AuxInt) != 1 { 3326 break 3327 } 3328 dst := v_0 3329 src := v_1 3330 mem := v_2 3331 v.reset(OpS390XMOVBstore) 3332 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8) 3333 v0.AddArg2(src, mem) 3334 v.AddArg3(dst, v0, mem) 3335 return true 3336 } 3337 // match: (Move [2] dst src mem) 3338 // result: (MOVHstore dst (MOVHZload src mem) mem) 3339 for { 3340 if auxIntToInt64(v.AuxInt) != 2 { 3341 break 3342 } 3343 dst := v_0 3344 src := v_1 3345 mem := v_2 3346 v.reset(OpS390XMOVHstore) 3347 v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16) 3348 v0.AddArg2(src, mem) 3349 v.AddArg3(dst, v0, mem) 3350 return true 3351 } 3352 // match: (Move [4] dst src mem) 3353 // result: (MOVWstore dst (MOVWZload src mem) mem) 3354 for { 3355 if auxIntToInt64(v.AuxInt) != 4 { 3356 break 3357 } 3358 dst := v_0 3359 src := v_1 3360 mem := v_2 3361 v.reset(OpS390XMOVWstore) 3362 v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32) 3363 v0.AddArg2(src, mem) 3364 v.AddArg3(dst, v0, mem) 3365 return true 3366 } 3367 // match: (Move [8] dst src mem) 3368 // result: (MOVDstore dst (MOVDload src mem) mem) 3369 for { 3370 if auxIntToInt64(v.AuxInt) != 8 { 3371 break 3372 } 3373 dst := v_0 3374 src := v_1 3375 mem := v_2 3376 v.reset(OpS390XMOVDstore) 3377 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3378 v0.AddArg2(src, mem) 3379 v.AddArg3(dst, v0, mem) 3380 return true 3381 } 3382 // match: (Move [16] dst src mem) 3383 // result: (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem)) 3384 for { 3385 if auxIntToInt64(v.AuxInt) != 16 { 3386 break 3387 } 3388 dst := v_0 3389 src := v_1 3390 mem := v_2 3391 v.reset(OpS390XMOVDstore) 3392 v.AuxInt = int32ToAuxInt(8) 3393 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3394 v0.AuxInt = int32ToAuxInt(8) 3395 v0.AddArg2(src, mem) 3396 v1 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem) 3397 v2 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3398 v2.AddArg2(src, mem) 3399 v1.AddArg3(dst, v2, mem) 3400 v.AddArg3(dst, v0, v1) 3401 return true 3402 } 3403 // match: (Move [24] dst src mem) 3404 // result: (MOVDstore [16] dst (MOVDload [16] src mem) (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem))) 3405 for { 3406 if auxIntToInt64(v.AuxInt) != 24 { 3407 break 3408 } 3409 dst := v_0 3410 src := v_1 3411 mem := v_2 3412 v.reset(OpS390XMOVDstore) 3413 v.AuxInt = int32ToAuxInt(16) 3414 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3415 v0.AuxInt = int32ToAuxInt(16) 3416 v0.AddArg2(src, mem) 3417 v1 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem) 3418 v1.AuxInt = int32ToAuxInt(8) 3419 v2 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3420 v2.AuxInt = int32ToAuxInt(8) 3421 v2.AddArg2(src, mem) 3422 v3 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem) 3423 v4 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3424 v4.AddArg2(src, mem) 3425 v3.AddArg3(dst, v4, mem) 3426 v1.AddArg3(dst, v2, v3) 3427 v.AddArg3(dst, v0, v1) 3428 return true 3429 } 3430 // match: (Move [3] dst src mem) 3431 // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHZload src mem) mem)) 3432 for { 3433 if auxIntToInt64(v.AuxInt) != 3 { 3434 break 3435 } 3436 dst := v_0 3437 src := v_1 3438 mem := v_2 3439 v.reset(OpS390XMOVBstore) 3440 v.AuxInt = int32ToAuxInt(2) 3441 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8) 3442 v0.AuxInt = int32ToAuxInt(2) 3443 v0.AddArg2(src, mem) 3444 v1 := b.NewValue0(v.Pos, OpS390XMOVHstore, types.TypeMem) 3445 v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16) 3446 v2.AddArg2(src, mem) 3447 v1.AddArg3(dst, v2, mem) 3448 v.AddArg3(dst, v0, v1) 3449 return true 3450 } 3451 // match: (Move [5] dst src mem) 3452 // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)) 3453 for { 3454 if auxIntToInt64(v.AuxInt) != 5 { 3455 break 3456 } 3457 dst := v_0 3458 src := v_1 3459 mem := v_2 3460 v.reset(OpS390XMOVBstore) 3461 v.AuxInt = int32ToAuxInt(4) 3462 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8) 3463 v0.AuxInt = int32ToAuxInt(4) 3464 v0.AddArg2(src, mem) 3465 v1 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem) 3466 v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32) 3467 v2.AddArg2(src, mem) 3468 v1.AddArg3(dst, v2, mem) 3469 v.AddArg3(dst, v0, v1) 3470 return true 3471 } 3472 // match: (Move [6] dst src mem) 3473 // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)) 3474 for { 3475 if auxIntToInt64(v.AuxInt) != 6 { 3476 break 3477 } 3478 dst := v_0 3479 src := v_1 3480 mem := v_2 3481 v.reset(OpS390XMOVHstore) 3482 v.AuxInt = int32ToAuxInt(4) 3483 v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16) 3484 v0.AuxInt = int32ToAuxInt(4) 3485 v0.AddArg2(src, mem) 3486 v1 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem) 3487 v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32) 3488 v2.AddArg2(src, mem) 3489 v1.AddArg3(dst, v2, mem) 3490 v.AddArg3(dst, v0, v1) 3491 return true 3492 } 3493 // match: (Move [7] dst src mem) 3494 // result: (MOVBstore [6] dst (MOVBZload [6] src mem) (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))) 3495 for { 3496 if auxIntToInt64(v.AuxInt) != 7 { 3497 break 3498 } 3499 dst := v_0 3500 src := v_1 3501 mem := v_2 3502 v.reset(OpS390XMOVBstore) 3503 v.AuxInt = int32ToAuxInt(6) 3504 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8) 3505 v0.AuxInt = int32ToAuxInt(6) 3506 v0.AddArg2(src, mem) 3507 v1 := b.NewValue0(v.Pos, OpS390XMOVHstore, types.TypeMem) 3508 v1.AuxInt = int32ToAuxInt(4) 3509 v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16) 3510 v2.AuxInt = int32ToAuxInt(4) 3511 v2.AddArg2(src, mem) 3512 v3 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem) 3513 v4 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32) 3514 v4.AddArg2(src, mem) 3515 v3.AddArg3(dst, v4, mem) 3516 v1.AddArg3(dst, v2, v3) 3517 v.AddArg3(dst, v0, v1) 3518 return true 3519 } 3520 // match: (Move [s] dst src mem) 3521 // cond: s > 0 && s <= 256 && logLargeCopy(v, s) 3522 // result: (MVC [makeValAndOff(int32(s), 0)] dst src mem) 3523 for { 3524 s := auxIntToInt64(v.AuxInt) 3525 dst := v_0 3526 src := v_1 3527 mem := v_2 3528 if !(s > 0 && s <= 256 && logLargeCopy(v, s)) { 3529 break 3530 } 3531 v.reset(OpS390XMVC) 3532 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s), 0)) 3533 v.AddArg3(dst, src, mem) 3534 return true 3535 } 3536 // match: (Move [s] dst src mem) 3537 // cond: s > 256 && s <= 512 && logLargeCopy(v, s) 3538 // result: (MVC [makeValAndOff(int32(s)-256, 256)] dst src (MVC [makeValAndOff(256, 0)] dst src mem)) 3539 for { 3540 s := auxIntToInt64(v.AuxInt) 3541 dst := v_0 3542 src := v_1 3543 mem := v_2 3544 if !(s > 256 && s <= 512 && logLargeCopy(v, s)) { 3545 break 3546 } 3547 v.reset(OpS390XMVC) 3548 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-256, 256)) 3549 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3550 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0)) 3551 v0.AddArg3(dst, src, mem) 3552 v.AddArg3(dst, src, v0) 3553 return true 3554 } 3555 // match: (Move [s] dst src mem) 3556 // cond: s > 512 && s <= 768 && logLargeCopy(v, s) 3557 // result: (MVC [makeValAndOff(int32(s)-512, 512)] dst src (MVC [makeValAndOff(256, 256)] dst src (MVC [makeValAndOff(256, 0)] dst src mem))) 3558 for { 3559 s := auxIntToInt64(v.AuxInt) 3560 dst := v_0 3561 src := v_1 3562 mem := v_2 3563 if !(s > 512 && s <= 768 && logLargeCopy(v, s)) { 3564 break 3565 } 3566 v.reset(OpS390XMVC) 3567 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-512, 512)) 3568 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3569 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 256)) 3570 v1 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3571 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0)) 3572 v1.AddArg3(dst, src, mem) 3573 v0.AddArg3(dst, src, v1) 3574 v.AddArg3(dst, src, v0) 3575 return true 3576 } 3577 // match: (Move [s] dst src mem) 3578 // cond: s > 768 && s <= 1024 && logLargeCopy(v, s) 3579 // 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)))) 3580 for { 3581 s := auxIntToInt64(v.AuxInt) 3582 dst := v_0 3583 src := v_1 3584 mem := v_2 3585 if !(s > 768 && s <= 1024 && logLargeCopy(v, s)) { 3586 break 3587 } 3588 v.reset(OpS390XMVC) 3589 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-768, 768)) 3590 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3591 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 512)) 3592 v1 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3593 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 256)) 3594 v2 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3595 v2.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0)) 3596 v2.AddArg3(dst, src, mem) 3597 v1.AddArg3(dst, src, v2) 3598 v0.AddArg3(dst, src, v1) 3599 v.AddArg3(dst, src, v0) 3600 return true 3601 } 3602 // match: (Move [s] dst src mem) 3603 // cond: s > 1024 && logLargeCopy(v, s) 3604 // result: (LoweredMove [s%256] dst src (ADD <src.Type> src (MOVDconst [(s/256)*256])) mem) 3605 for { 3606 s := auxIntToInt64(v.AuxInt) 3607 dst := v_0 3608 src := v_1 3609 mem := v_2 3610 if !(s > 1024 && logLargeCopy(v, s)) { 3611 break 3612 } 3613 v.reset(OpS390XLoweredMove) 3614 v.AuxInt = int64ToAuxInt(s % 256) 3615 v0 := b.NewValue0(v.Pos, OpS390XADD, src.Type) 3616 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3617 v1.AuxInt = int64ToAuxInt((s / 256) * 256) 3618 v0.AddArg2(src, v1) 3619 v.AddArg4(dst, src, v0, mem) 3620 return true 3621 } 3622 return false 3623 } 3624 func rewriteValueS390X_OpNeq16(v *Value) bool { 3625 v_1 := v.Args[1] 3626 v_0 := v.Args[0] 3627 b := v.Block 3628 typ := &b.Func.Config.Types 3629 // match: (Neq16 x y) 3630 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y))) 3631 for { 3632 x := v_0 3633 y := v_1 3634 v.reset(OpS390XLOCGR) 3635 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3636 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3637 v0.AuxInt = int64ToAuxInt(0) 3638 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3639 v1.AuxInt = int64ToAuxInt(1) 3640 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 3641 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 3642 v3.AddArg(x) 3643 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 3644 v4.AddArg(y) 3645 v2.AddArg2(v3, v4) 3646 v.AddArg3(v0, v1, v2) 3647 return true 3648 } 3649 } 3650 func rewriteValueS390X_OpNeq32(v *Value) bool { 3651 v_1 := v.Args[1] 3652 v_0 := v.Args[0] 3653 b := v.Block 3654 typ := &b.Func.Config.Types 3655 // match: (Neq32 x y) 3656 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y)) 3657 for { 3658 x := v_0 3659 y := v_1 3660 v.reset(OpS390XLOCGR) 3661 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3662 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3663 v0.AuxInt = int64ToAuxInt(0) 3664 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3665 v1.AuxInt = int64ToAuxInt(1) 3666 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 3667 v2.AddArg2(x, y) 3668 v.AddArg3(v0, v1, v2) 3669 return true 3670 } 3671 } 3672 func rewriteValueS390X_OpNeq32F(v *Value) bool { 3673 v_1 := v.Args[1] 3674 v_0 := v.Args[0] 3675 b := v.Block 3676 typ := &b.Func.Config.Types 3677 // match: (Neq32F x y) 3678 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y)) 3679 for { 3680 x := v_0 3681 y := v_1 3682 v.reset(OpS390XLOCGR) 3683 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3684 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3685 v0.AuxInt = int64ToAuxInt(0) 3686 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3687 v1.AuxInt = int64ToAuxInt(1) 3688 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags) 3689 v2.AddArg2(x, y) 3690 v.AddArg3(v0, v1, v2) 3691 return true 3692 } 3693 } 3694 func rewriteValueS390X_OpNeq64(v *Value) bool { 3695 v_1 := v.Args[1] 3696 v_0 := v.Args[0] 3697 b := v.Block 3698 typ := &b.Func.Config.Types 3699 // match: (Neq64 x y) 3700 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 3701 for { 3702 x := v_0 3703 y := v_1 3704 v.reset(OpS390XLOCGR) 3705 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3706 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3707 v0.AuxInt = int64ToAuxInt(0) 3708 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3709 v1.AuxInt = int64ToAuxInt(1) 3710 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 3711 v2.AddArg2(x, y) 3712 v.AddArg3(v0, v1, v2) 3713 return true 3714 } 3715 } 3716 func rewriteValueS390X_OpNeq64F(v *Value) bool { 3717 v_1 := v.Args[1] 3718 v_0 := v.Args[0] 3719 b := v.Block 3720 typ := &b.Func.Config.Types 3721 // match: (Neq64F x y) 3722 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y)) 3723 for { 3724 x := v_0 3725 y := v_1 3726 v.reset(OpS390XLOCGR) 3727 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3728 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3729 v0.AuxInt = int64ToAuxInt(0) 3730 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3731 v1.AuxInt = int64ToAuxInt(1) 3732 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags) 3733 v2.AddArg2(x, y) 3734 v.AddArg3(v0, v1, v2) 3735 return true 3736 } 3737 } 3738 func rewriteValueS390X_OpNeq8(v *Value) bool { 3739 v_1 := v.Args[1] 3740 v_0 := v.Args[0] 3741 b := v.Block 3742 typ := &b.Func.Config.Types 3743 // match: (Neq8 x y) 3744 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 3745 for { 3746 x := v_0 3747 y := v_1 3748 v.reset(OpS390XLOCGR) 3749 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3750 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3751 v0.AuxInt = int64ToAuxInt(0) 3752 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3753 v1.AuxInt = int64ToAuxInt(1) 3754 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 3755 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3756 v3.AddArg(x) 3757 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3758 v4.AddArg(y) 3759 v2.AddArg2(v3, v4) 3760 v.AddArg3(v0, v1, v2) 3761 return true 3762 } 3763 } 3764 func rewriteValueS390X_OpNeqB(v *Value) bool { 3765 v_1 := v.Args[1] 3766 v_0 := v.Args[0] 3767 b := v.Block 3768 typ := &b.Func.Config.Types 3769 // match: (NeqB x y) 3770 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 3771 for { 3772 x := v_0 3773 y := v_1 3774 v.reset(OpS390XLOCGR) 3775 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3776 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3777 v0.AuxInt = int64ToAuxInt(0) 3778 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3779 v1.AuxInt = int64ToAuxInt(1) 3780 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 3781 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3782 v3.AddArg(x) 3783 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3784 v4.AddArg(y) 3785 v2.AddArg2(v3, v4) 3786 v.AddArg3(v0, v1, v2) 3787 return true 3788 } 3789 } 3790 func rewriteValueS390X_OpNeqPtr(v *Value) bool { 3791 v_1 := v.Args[1] 3792 v_0 := v.Args[0] 3793 b := v.Block 3794 typ := &b.Func.Config.Types 3795 // match: (NeqPtr x y) 3796 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 3797 for { 3798 x := v_0 3799 y := v_1 3800 v.reset(OpS390XLOCGR) 3801 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3802 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3803 v0.AuxInt = int64ToAuxInt(0) 3804 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3805 v1.AuxInt = int64ToAuxInt(1) 3806 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 3807 v2.AddArg2(x, y) 3808 v.AddArg3(v0, v1, v2) 3809 return true 3810 } 3811 } 3812 func rewriteValueS390X_OpNot(v *Value) bool { 3813 v_0 := v.Args[0] 3814 // match: (Not x) 3815 // result: (XORWconst [1] x) 3816 for { 3817 x := v_0 3818 v.reset(OpS390XXORWconst) 3819 v.AuxInt = int32ToAuxInt(1) 3820 v.AddArg(x) 3821 return true 3822 } 3823 } 3824 func rewriteValueS390X_OpOffPtr(v *Value) bool { 3825 v_0 := v.Args[0] 3826 b := v.Block 3827 typ := &b.Func.Config.Types 3828 // match: (OffPtr [off] ptr:(SP)) 3829 // result: (MOVDaddr [int32(off)] ptr) 3830 for { 3831 off := auxIntToInt64(v.AuxInt) 3832 ptr := v_0 3833 if ptr.Op != OpSP { 3834 break 3835 } 3836 v.reset(OpS390XMOVDaddr) 3837 v.AuxInt = int32ToAuxInt(int32(off)) 3838 v.AddArg(ptr) 3839 return true 3840 } 3841 // match: (OffPtr [off] ptr) 3842 // cond: is32Bit(off) 3843 // result: (ADDconst [int32(off)] ptr) 3844 for { 3845 off := auxIntToInt64(v.AuxInt) 3846 ptr := v_0 3847 if !(is32Bit(off)) { 3848 break 3849 } 3850 v.reset(OpS390XADDconst) 3851 v.AuxInt = int32ToAuxInt(int32(off)) 3852 v.AddArg(ptr) 3853 return true 3854 } 3855 // match: (OffPtr [off] ptr) 3856 // result: (ADD (MOVDconst [off]) ptr) 3857 for { 3858 off := auxIntToInt64(v.AuxInt) 3859 ptr := v_0 3860 v.reset(OpS390XADD) 3861 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3862 v0.AuxInt = int64ToAuxInt(off) 3863 v.AddArg2(v0, ptr) 3864 return true 3865 } 3866 } 3867 func rewriteValueS390X_OpPanicBounds(v *Value) bool { 3868 v_2 := v.Args[2] 3869 v_1 := v.Args[1] 3870 v_0 := v.Args[0] 3871 // match: (PanicBounds [kind] x y mem) 3872 // cond: boundsABI(kind) == 0 3873 // result: (LoweredPanicBoundsA [kind] x y mem) 3874 for { 3875 kind := auxIntToInt64(v.AuxInt) 3876 x := v_0 3877 y := v_1 3878 mem := v_2 3879 if !(boundsABI(kind) == 0) { 3880 break 3881 } 3882 v.reset(OpS390XLoweredPanicBoundsA) 3883 v.AuxInt = int64ToAuxInt(kind) 3884 v.AddArg3(x, y, mem) 3885 return true 3886 } 3887 // match: (PanicBounds [kind] x y mem) 3888 // cond: boundsABI(kind) == 1 3889 // result: (LoweredPanicBoundsB [kind] x y mem) 3890 for { 3891 kind := auxIntToInt64(v.AuxInt) 3892 x := v_0 3893 y := v_1 3894 mem := v_2 3895 if !(boundsABI(kind) == 1) { 3896 break 3897 } 3898 v.reset(OpS390XLoweredPanicBoundsB) 3899 v.AuxInt = int64ToAuxInt(kind) 3900 v.AddArg3(x, y, mem) 3901 return true 3902 } 3903 // match: (PanicBounds [kind] x y mem) 3904 // cond: boundsABI(kind) == 2 3905 // result: (LoweredPanicBoundsC [kind] x y mem) 3906 for { 3907 kind := auxIntToInt64(v.AuxInt) 3908 x := v_0 3909 y := v_1 3910 mem := v_2 3911 if !(boundsABI(kind) == 2) { 3912 break 3913 } 3914 v.reset(OpS390XLoweredPanicBoundsC) 3915 v.AuxInt = int64ToAuxInt(kind) 3916 v.AddArg3(x, y, mem) 3917 return true 3918 } 3919 return false 3920 } 3921 func rewriteValueS390X_OpPopCount16(v *Value) bool { 3922 v_0 := v.Args[0] 3923 b := v.Block 3924 typ := &b.Func.Config.Types 3925 // match: (PopCount16 x) 3926 // result: (MOVBZreg (SumBytes2 (POPCNT <typ.UInt16> x))) 3927 for { 3928 x := v_0 3929 v.reset(OpS390XMOVBZreg) 3930 v0 := b.NewValue0(v.Pos, OpS390XSumBytes2, typ.UInt8) 3931 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt16) 3932 v1.AddArg(x) 3933 v0.AddArg(v1) 3934 v.AddArg(v0) 3935 return true 3936 } 3937 } 3938 func rewriteValueS390X_OpPopCount32(v *Value) bool { 3939 v_0 := v.Args[0] 3940 b := v.Block 3941 typ := &b.Func.Config.Types 3942 // match: (PopCount32 x) 3943 // result: (MOVBZreg (SumBytes4 (POPCNT <typ.UInt32> x))) 3944 for { 3945 x := v_0 3946 v.reset(OpS390XMOVBZreg) 3947 v0 := b.NewValue0(v.Pos, OpS390XSumBytes4, typ.UInt8) 3948 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt32) 3949 v1.AddArg(x) 3950 v0.AddArg(v1) 3951 v.AddArg(v0) 3952 return true 3953 } 3954 } 3955 func rewriteValueS390X_OpPopCount64(v *Value) bool { 3956 v_0 := v.Args[0] 3957 b := v.Block 3958 typ := &b.Func.Config.Types 3959 // match: (PopCount64 x) 3960 // result: (MOVBZreg (SumBytes8 (POPCNT <typ.UInt64> x))) 3961 for { 3962 x := v_0 3963 v.reset(OpS390XMOVBZreg) 3964 v0 := b.NewValue0(v.Pos, OpS390XSumBytes8, typ.UInt8) 3965 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt64) 3966 v1.AddArg(x) 3967 v0.AddArg(v1) 3968 v.AddArg(v0) 3969 return true 3970 } 3971 } 3972 func rewriteValueS390X_OpPopCount8(v *Value) bool { 3973 v_0 := v.Args[0] 3974 b := v.Block 3975 typ := &b.Func.Config.Types 3976 // match: (PopCount8 x) 3977 // result: (POPCNT (MOVBZreg x)) 3978 for { 3979 x := v_0 3980 v.reset(OpS390XPOPCNT) 3981 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 3982 v0.AddArg(x) 3983 v.AddArg(v0) 3984 return true 3985 } 3986 } 3987 func rewriteValueS390X_OpRotateLeft16(v *Value) bool { 3988 v_1 := v.Args[1] 3989 v_0 := v.Args[0] 3990 b := v.Block 3991 typ := &b.Func.Config.Types 3992 // match: (RotateLeft16 <t> x (MOVDconst [c])) 3993 // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15]))) 3994 for { 3995 t := v.Type 3996 x := v_0 3997 if v_1.Op != OpS390XMOVDconst { 3998 break 3999 } 4000 c := auxIntToInt64(v_1.AuxInt) 4001 v.reset(OpOr16) 4002 v0 := b.NewValue0(v.Pos, OpLsh16x64, t) 4003 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4004 v1.AuxInt = int64ToAuxInt(c & 15) 4005 v0.AddArg2(x, v1) 4006 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t) 4007 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4008 v3.AuxInt = int64ToAuxInt(-c & 15) 4009 v2.AddArg2(x, v3) 4010 v.AddArg2(v0, v2) 4011 return true 4012 } 4013 return false 4014 } 4015 func rewriteValueS390X_OpRotateLeft8(v *Value) bool { 4016 v_1 := v.Args[1] 4017 v_0 := v.Args[0] 4018 b := v.Block 4019 typ := &b.Func.Config.Types 4020 // match: (RotateLeft8 <t> x (MOVDconst [c])) 4021 // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7]))) 4022 for { 4023 t := v.Type 4024 x := v_0 4025 if v_1.Op != OpS390XMOVDconst { 4026 break 4027 } 4028 c := auxIntToInt64(v_1.AuxInt) 4029 v.reset(OpOr8) 4030 v0 := b.NewValue0(v.Pos, OpLsh8x64, t) 4031 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4032 v1.AuxInt = int64ToAuxInt(c & 7) 4033 v0.AddArg2(x, v1) 4034 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t) 4035 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4036 v3.AuxInt = int64ToAuxInt(-c & 7) 4037 v2.AddArg2(x, v3) 4038 v.AddArg2(v0, v2) 4039 return true 4040 } 4041 return false 4042 } 4043 func rewriteValueS390X_OpRound(v *Value) bool { 4044 v_0 := v.Args[0] 4045 // match: (Round x) 4046 // result: (FIDBR [1] x) 4047 for { 4048 x := v_0 4049 v.reset(OpS390XFIDBR) 4050 v.AuxInt = int8ToAuxInt(1) 4051 v.AddArg(x) 4052 return true 4053 } 4054 } 4055 func rewriteValueS390X_OpRoundToEven(v *Value) bool { 4056 v_0 := v.Args[0] 4057 // match: (RoundToEven x) 4058 // result: (FIDBR [4] x) 4059 for { 4060 x := v_0 4061 v.reset(OpS390XFIDBR) 4062 v.AuxInt = int8ToAuxInt(4) 4063 v.AddArg(x) 4064 return true 4065 } 4066 } 4067 func rewriteValueS390X_OpRsh16Ux16(v *Value) bool { 4068 v_1 := v.Args[1] 4069 v_0 := v.Args[0] 4070 b := v.Block 4071 typ := &b.Func.Config.Types 4072 // match: (Rsh16Ux16 x y) 4073 // cond: shiftIsBounded(v) 4074 // result: (SRW (MOVHZreg x) y) 4075 for { 4076 x := v_0 4077 y := v_1 4078 if !(shiftIsBounded(v)) { 4079 break 4080 } 4081 v.reset(OpS390XSRW) 4082 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4083 v0.AddArg(x) 4084 v.AddArg2(v0, y) 4085 return true 4086 } 4087 // match: (Rsh16Ux16 <t> x y) 4088 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 4089 for { 4090 t := v.Type 4091 x := v_0 4092 y := v_1 4093 v.reset(OpS390XLOCGR) 4094 v.Type = t 4095 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4096 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4097 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4098 v1.AddArg(x) 4099 v0.AddArg2(v1, y) 4100 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4101 v2.AuxInt = int64ToAuxInt(0) 4102 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4103 v3.AuxInt = int32ToAuxInt(64) 4104 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4105 v4.AddArg(y) 4106 v3.AddArg(v4) 4107 v.AddArg3(v0, v2, v3) 4108 return true 4109 } 4110 } 4111 func rewriteValueS390X_OpRsh16Ux32(v *Value) bool { 4112 v_1 := v.Args[1] 4113 v_0 := v.Args[0] 4114 b := v.Block 4115 typ := &b.Func.Config.Types 4116 // match: (Rsh16Ux32 x y) 4117 // cond: shiftIsBounded(v) 4118 // result: (SRW (MOVHZreg x) y) 4119 for { 4120 x := v_0 4121 y := v_1 4122 if !(shiftIsBounded(v)) { 4123 break 4124 } 4125 v.reset(OpS390XSRW) 4126 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4127 v0.AddArg(x) 4128 v.AddArg2(v0, y) 4129 return true 4130 } 4131 // match: (Rsh16Ux32 <t> x y) 4132 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [64])) 4133 for { 4134 t := v.Type 4135 x := v_0 4136 y := v_1 4137 v.reset(OpS390XLOCGR) 4138 v.Type = t 4139 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4140 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4141 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4142 v1.AddArg(x) 4143 v0.AddArg2(v1, y) 4144 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4145 v2.AuxInt = int64ToAuxInt(0) 4146 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4147 v3.AuxInt = int32ToAuxInt(64) 4148 v3.AddArg(y) 4149 v.AddArg3(v0, v2, v3) 4150 return true 4151 } 4152 } 4153 func rewriteValueS390X_OpRsh16Ux64(v *Value) bool { 4154 v_1 := v.Args[1] 4155 v_0 := v.Args[0] 4156 b := v.Block 4157 typ := &b.Func.Config.Types 4158 // match: (Rsh16Ux64 x y) 4159 // cond: shiftIsBounded(v) 4160 // result: (SRW (MOVHZreg x) y) 4161 for { 4162 x := v_0 4163 y := v_1 4164 if !(shiftIsBounded(v)) { 4165 break 4166 } 4167 v.reset(OpS390XSRW) 4168 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4169 v0.AddArg(x) 4170 v.AddArg2(v0, y) 4171 return true 4172 } 4173 // match: (Rsh16Ux64 <t> x y) 4174 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [64])) 4175 for { 4176 t := v.Type 4177 x := v_0 4178 y := v_1 4179 v.reset(OpS390XLOCGR) 4180 v.Type = t 4181 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4182 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4183 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4184 v1.AddArg(x) 4185 v0.AddArg2(v1, y) 4186 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4187 v2.AuxInt = int64ToAuxInt(0) 4188 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4189 v3.AuxInt = int32ToAuxInt(64) 4190 v3.AddArg(y) 4191 v.AddArg3(v0, v2, v3) 4192 return true 4193 } 4194 } 4195 func rewriteValueS390X_OpRsh16Ux8(v *Value) bool { 4196 v_1 := v.Args[1] 4197 v_0 := v.Args[0] 4198 b := v.Block 4199 typ := &b.Func.Config.Types 4200 // match: (Rsh16Ux8 x y) 4201 // cond: shiftIsBounded(v) 4202 // result: (SRW (MOVHZreg x) y) 4203 for { 4204 x := v_0 4205 y := v_1 4206 if !(shiftIsBounded(v)) { 4207 break 4208 } 4209 v.reset(OpS390XSRW) 4210 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4211 v0.AddArg(x) 4212 v.AddArg2(v0, y) 4213 return true 4214 } 4215 // match: (Rsh16Ux8 <t> x y) 4216 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 4217 for { 4218 t := v.Type 4219 x := v_0 4220 y := v_1 4221 v.reset(OpS390XLOCGR) 4222 v.Type = t 4223 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4224 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4225 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4226 v1.AddArg(x) 4227 v0.AddArg2(v1, y) 4228 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4229 v2.AuxInt = int64ToAuxInt(0) 4230 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4231 v3.AuxInt = int32ToAuxInt(64) 4232 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4233 v4.AddArg(y) 4234 v3.AddArg(v4) 4235 v.AddArg3(v0, v2, v3) 4236 return true 4237 } 4238 } 4239 func rewriteValueS390X_OpRsh16x16(v *Value) bool { 4240 v_1 := v.Args[1] 4241 v_0 := v.Args[0] 4242 b := v.Block 4243 typ := &b.Func.Config.Types 4244 // match: (Rsh16x16 x y) 4245 // cond: shiftIsBounded(v) 4246 // result: (SRAW (MOVHreg x) y) 4247 for { 4248 x := v_0 4249 y := v_1 4250 if !(shiftIsBounded(v)) { 4251 break 4252 } 4253 v.reset(OpS390XSRAW) 4254 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4255 v0.AddArg(x) 4256 v.AddArg2(v0, y) 4257 return true 4258 } 4259 // match: (Rsh16x16 x y) 4260 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64]))) 4261 for { 4262 x := v_0 4263 y := v_1 4264 v.reset(OpS390XSRAW) 4265 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4266 v0.AddArg(x) 4267 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4268 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4269 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4270 v2.AuxInt = int64ToAuxInt(63) 4271 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4272 v3.AuxInt = int32ToAuxInt(64) 4273 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4274 v4.AddArg(y) 4275 v3.AddArg(v4) 4276 v1.AddArg3(y, v2, v3) 4277 v.AddArg2(v0, v1) 4278 return true 4279 } 4280 } 4281 func rewriteValueS390X_OpRsh16x32(v *Value) bool { 4282 v_1 := v.Args[1] 4283 v_0 := v.Args[0] 4284 b := v.Block 4285 typ := &b.Func.Config.Types 4286 // match: (Rsh16x32 x y) 4287 // cond: shiftIsBounded(v) 4288 // result: (SRAW (MOVHreg x) y) 4289 for { 4290 x := v_0 4291 y := v_1 4292 if !(shiftIsBounded(v)) { 4293 break 4294 } 4295 v.reset(OpS390XSRAW) 4296 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4297 v0.AddArg(x) 4298 v.AddArg2(v0, y) 4299 return true 4300 } 4301 // match: (Rsh16x32 x y) 4302 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64]))) 4303 for { 4304 x := v_0 4305 y := v_1 4306 v.reset(OpS390XSRAW) 4307 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4308 v0.AddArg(x) 4309 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4310 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4311 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4312 v2.AuxInt = int64ToAuxInt(63) 4313 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4314 v3.AuxInt = int32ToAuxInt(64) 4315 v3.AddArg(y) 4316 v1.AddArg3(y, v2, v3) 4317 v.AddArg2(v0, v1) 4318 return true 4319 } 4320 } 4321 func rewriteValueS390X_OpRsh16x64(v *Value) bool { 4322 v_1 := v.Args[1] 4323 v_0 := v.Args[0] 4324 b := v.Block 4325 typ := &b.Func.Config.Types 4326 // match: (Rsh16x64 x y) 4327 // cond: shiftIsBounded(v) 4328 // result: (SRAW (MOVHreg x) y) 4329 for { 4330 x := v_0 4331 y := v_1 4332 if !(shiftIsBounded(v)) { 4333 break 4334 } 4335 v.reset(OpS390XSRAW) 4336 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4337 v0.AddArg(x) 4338 v.AddArg2(v0, y) 4339 return true 4340 } 4341 // match: (Rsh16x64 x y) 4342 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64]))) 4343 for { 4344 x := v_0 4345 y := v_1 4346 v.reset(OpS390XSRAW) 4347 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4348 v0.AddArg(x) 4349 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4350 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4351 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4352 v2.AuxInt = int64ToAuxInt(63) 4353 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4354 v3.AuxInt = int32ToAuxInt(64) 4355 v3.AddArg(y) 4356 v1.AddArg3(y, v2, v3) 4357 v.AddArg2(v0, v1) 4358 return true 4359 } 4360 } 4361 func rewriteValueS390X_OpRsh16x8(v *Value) bool { 4362 v_1 := v.Args[1] 4363 v_0 := v.Args[0] 4364 b := v.Block 4365 typ := &b.Func.Config.Types 4366 // match: (Rsh16x8 x y) 4367 // cond: shiftIsBounded(v) 4368 // result: (SRAW (MOVHreg x) y) 4369 for { 4370 x := v_0 4371 y := v_1 4372 if !(shiftIsBounded(v)) { 4373 break 4374 } 4375 v.reset(OpS390XSRAW) 4376 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4377 v0.AddArg(x) 4378 v.AddArg2(v0, y) 4379 return true 4380 } 4381 // match: (Rsh16x8 x y) 4382 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64]))) 4383 for { 4384 x := v_0 4385 y := v_1 4386 v.reset(OpS390XSRAW) 4387 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4388 v0.AddArg(x) 4389 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4390 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4391 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4392 v2.AuxInt = int64ToAuxInt(63) 4393 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4394 v3.AuxInt = int32ToAuxInt(64) 4395 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4396 v4.AddArg(y) 4397 v3.AddArg(v4) 4398 v1.AddArg3(y, v2, v3) 4399 v.AddArg2(v0, v1) 4400 return true 4401 } 4402 } 4403 func rewriteValueS390X_OpRsh32Ux16(v *Value) bool { 4404 v_1 := v.Args[1] 4405 v_0 := v.Args[0] 4406 b := v.Block 4407 typ := &b.Func.Config.Types 4408 // match: (Rsh32Ux16 x y) 4409 // cond: shiftIsBounded(v) 4410 // result: (SRW x y) 4411 for { 4412 x := v_0 4413 y := v_1 4414 if !(shiftIsBounded(v)) { 4415 break 4416 } 4417 v.reset(OpS390XSRW) 4418 v.AddArg2(x, y) 4419 return true 4420 } 4421 // match: (Rsh32Ux16 <t> x y) 4422 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 4423 for { 4424 t := v.Type 4425 x := v_0 4426 y := v_1 4427 v.reset(OpS390XLOCGR) 4428 v.Type = t 4429 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4430 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4431 v0.AddArg2(x, y) 4432 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4433 v1.AuxInt = int64ToAuxInt(0) 4434 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4435 v2.AuxInt = int32ToAuxInt(64) 4436 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4437 v3.AddArg(y) 4438 v2.AddArg(v3) 4439 v.AddArg3(v0, v1, v2) 4440 return true 4441 } 4442 } 4443 func rewriteValueS390X_OpRsh32Ux32(v *Value) bool { 4444 v_1 := v.Args[1] 4445 v_0 := v.Args[0] 4446 b := v.Block 4447 typ := &b.Func.Config.Types 4448 // match: (Rsh32Ux32 x y) 4449 // cond: shiftIsBounded(v) 4450 // result: (SRW x y) 4451 for { 4452 x := v_0 4453 y := v_1 4454 if !(shiftIsBounded(v)) { 4455 break 4456 } 4457 v.reset(OpS390XSRW) 4458 v.AddArg2(x, y) 4459 return true 4460 } 4461 // match: (Rsh32Ux32 <t> x y) 4462 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 4463 for { 4464 t := v.Type 4465 x := v_0 4466 y := v_1 4467 v.reset(OpS390XLOCGR) 4468 v.Type = t 4469 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4470 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4471 v0.AddArg2(x, y) 4472 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4473 v1.AuxInt = int64ToAuxInt(0) 4474 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4475 v2.AuxInt = int32ToAuxInt(64) 4476 v2.AddArg(y) 4477 v.AddArg3(v0, v1, v2) 4478 return true 4479 } 4480 } 4481 func rewriteValueS390X_OpRsh32Ux64(v *Value) bool { 4482 v_1 := v.Args[1] 4483 v_0 := v.Args[0] 4484 b := v.Block 4485 typ := &b.Func.Config.Types 4486 // match: (Rsh32Ux64 x y) 4487 // cond: shiftIsBounded(v) 4488 // result: (SRW x y) 4489 for { 4490 x := v_0 4491 y := v_1 4492 if !(shiftIsBounded(v)) { 4493 break 4494 } 4495 v.reset(OpS390XSRW) 4496 v.AddArg2(x, y) 4497 return true 4498 } 4499 // match: (Rsh32Ux64 <t> x y) 4500 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 4501 for { 4502 t := v.Type 4503 x := v_0 4504 y := v_1 4505 v.reset(OpS390XLOCGR) 4506 v.Type = t 4507 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4508 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4509 v0.AddArg2(x, y) 4510 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4511 v1.AuxInt = int64ToAuxInt(0) 4512 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4513 v2.AuxInt = int32ToAuxInt(64) 4514 v2.AddArg(y) 4515 v.AddArg3(v0, v1, v2) 4516 return true 4517 } 4518 } 4519 func rewriteValueS390X_OpRsh32Ux8(v *Value) bool { 4520 v_1 := v.Args[1] 4521 v_0 := v.Args[0] 4522 b := v.Block 4523 typ := &b.Func.Config.Types 4524 // match: (Rsh32Ux8 x y) 4525 // cond: shiftIsBounded(v) 4526 // result: (SRW x y) 4527 for { 4528 x := v_0 4529 y := v_1 4530 if !(shiftIsBounded(v)) { 4531 break 4532 } 4533 v.reset(OpS390XSRW) 4534 v.AddArg2(x, y) 4535 return true 4536 } 4537 // match: (Rsh32Ux8 <t> x y) 4538 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 4539 for { 4540 t := v.Type 4541 x := v_0 4542 y := v_1 4543 v.reset(OpS390XLOCGR) 4544 v.Type = t 4545 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4546 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4547 v0.AddArg2(x, y) 4548 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4549 v1.AuxInt = int64ToAuxInt(0) 4550 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4551 v2.AuxInt = int32ToAuxInt(64) 4552 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4553 v3.AddArg(y) 4554 v2.AddArg(v3) 4555 v.AddArg3(v0, v1, v2) 4556 return true 4557 } 4558 } 4559 func rewriteValueS390X_OpRsh32x16(v *Value) bool { 4560 v_1 := v.Args[1] 4561 v_0 := v.Args[0] 4562 b := v.Block 4563 typ := &b.Func.Config.Types 4564 // match: (Rsh32x16 x y) 4565 // cond: shiftIsBounded(v) 4566 // result: (SRAW x y) 4567 for { 4568 x := v_0 4569 y := v_1 4570 if !(shiftIsBounded(v)) { 4571 break 4572 } 4573 v.reset(OpS390XSRAW) 4574 v.AddArg2(x, y) 4575 return true 4576 } 4577 // match: (Rsh32x16 x y) 4578 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64]))) 4579 for { 4580 x := v_0 4581 y := v_1 4582 v.reset(OpS390XSRAW) 4583 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4584 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4585 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4586 v1.AuxInt = int64ToAuxInt(63) 4587 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4588 v2.AuxInt = int32ToAuxInt(64) 4589 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4590 v3.AddArg(y) 4591 v2.AddArg(v3) 4592 v0.AddArg3(y, v1, v2) 4593 v.AddArg2(x, v0) 4594 return true 4595 } 4596 } 4597 func rewriteValueS390X_OpRsh32x32(v *Value) bool { 4598 v_1 := v.Args[1] 4599 v_0 := v.Args[0] 4600 b := v.Block 4601 // match: (Rsh32x32 x y) 4602 // cond: shiftIsBounded(v) 4603 // result: (SRAW x y) 4604 for { 4605 x := v_0 4606 y := v_1 4607 if !(shiftIsBounded(v)) { 4608 break 4609 } 4610 v.reset(OpS390XSRAW) 4611 v.AddArg2(x, y) 4612 return true 4613 } 4614 // match: (Rsh32x32 x y) 4615 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64]))) 4616 for { 4617 x := v_0 4618 y := v_1 4619 v.reset(OpS390XSRAW) 4620 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4621 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4622 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4623 v1.AuxInt = int64ToAuxInt(63) 4624 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4625 v2.AuxInt = int32ToAuxInt(64) 4626 v2.AddArg(y) 4627 v0.AddArg3(y, v1, v2) 4628 v.AddArg2(x, v0) 4629 return true 4630 } 4631 } 4632 func rewriteValueS390X_OpRsh32x64(v *Value) bool { 4633 v_1 := v.Args[1] 4634 v_0 := v.Args[0] 4635 b := v.Block 4636 // match: (Rsh32x64 x y) 4637 // cond: shiftIsBounded(v) 4638 // result: (SRAW x y) 4639 for { 4640 x := v_0 4641 y := v_1 4642 if !(shiftIsBounded(v)) { 4643 break 4644 } 4645 v.reset(OpS390XSRAW) 4646 v.AddArg2(x, y) 4647 return true 4648 } 4649 // match: (Rsh32x64 x y) 4650 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64]))) 4651 for { 4652 x := v_0 4653 y := v_1 4654 v.reset(OpS390XSRAW) 4655 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4656 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4657 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4658 v1.AuxInt = int64ToAuxInt(63) 4659 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4660 v2.AuxInt = int32ToAuxInt(64) 4661 v2.AddArg(y) 4662 v0.AddArg3(y, v1, v2) 4663 v.AddArg2(x, v0) 4664 return true 4665 } 4666 } 4667 func rewriteValueS390X_OpRsh32x8(v *Value) bool { 4668 v_1 := v.Args[1] 4669 v_0 := v.Args[0] 4670 b := v.Block 4671 typ := &b.Func.Config.Types 4672 // match: (Rsh32x8 x y) 4673 // cond: shiftIsBounded(v) 4674 // result: (SRAW x y) 4675 for { 4676 x := v_0 4677 y := v_1 4678 if !(shiftIsBounded(v)) { 4679 break 4680 } 4681 v.reset(OpS390XSRAW) 4682 v.AddArg2(x, y) 4683 return true 4684 } 4685 // match: (Rsh32x8 x y) 4686 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64]))) 4687 for { 4688 x := v_0 4689 y := v_1 4690 v.reset(OpS390XSRAW) 4691 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4692 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4693 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4694 v1.AuxInt = int64ToAuxInt(63) 4695 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4696 v2.AuxInt = int32ToAuxInt(64) 4697 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4698 v3.AddArg(y) 4699 v2.AddArg(v3) 4700 v0.AddArg3(y, v1, v2) 4701 v.AddArg2(x, v0) 4702 return true 4703 } 4704 } 4705 func rewriteValueS390X_OpRsh64Ux16(v *Value) bool { 4706 v_1 := v.Args[1] 4707 v_0 := v.Args[0] 4708 b := v.Block 4709 typ := &b.Func.Config.Types 4710 // match: (Rsh64Ux16 x y) 4711 // cond: shiftIsBounded(v) 4712 // result: (SRD x y) 4713 for { 4714 x := v_0 4715 y := v_1 4716 if !(shiftIsBounded(v)) { 4717 break 4718 } 4719 v.reset(OpS390XSRD) 4720 v.AddArg2(x, y) 4721 return true 4722 } 4723 // match: (Rsh64Ux16 <t> x y) 4724 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 4725 for { 4726 t := v.Type 4727 x := v_0 4728 y := v_1 4729 v.reset(OpS390XLOCGR) 4730 v.Type = t 4731 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4732 v0 := b.NewValue0(v.Pos, OpS390XSRD, t) 4733 v0.AddArg2(x, y) 4734 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4735 v1.AuxInt = int64ToAuxInt(0) 4736 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4737 v2.AuxInt = int32ToAuxInt(64) 4738 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4739 v3.AddArg(y) 4740 v2.AddArg(v3) 4741 v.AddArg3(v0, v1, v2) 4742 return true 4743 } 4744 } 4745 func rewriteValueS390X_OpRsh64Ux32(v *Value) bool { 4746 v_1 := v.Args[1] 4747 v_0 := v.Args[0] 4748 b := v.Block 4749 typ := &b.Func.Config.Types 4750 // match: (Rsh64Ux32 x y) 4751 // cond: shiftIsBounded(v) 4752 // result: (SRD x y) 4753 for { 4754 x := v_0 4755 y := v_1 4756 if !(shiftIsBounded(v)) { 4757 break 4758 } 4759 v.reset(OpS390XSRD) 4760 v.AddArg2(x, y) 4761 return true 4762 } 4763 // match: (Rsh64Ux32 <t> x y) 4764 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 4765 for { 4766 t := v.Type 4767 x := v_0 4768 y := v_1 4769 v.reset(OpS390XLOCGR) 4770 v.Type = t 4771 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4772 v0 := b.NewValue0(v.Pos, OpS390XSRD, t) 4773 v0.AddArg2(x, y) 4774 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4775 v1.AuxInt = int64ToAuxInt(0) 4776 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4777 v2.AuxInt = int32ToAuxInt(64) 4778 v2.AddArg(y) 4779 v.AddArg3(v0, v1, v2) 4780 return true 4781 } 4782 } 4783 func rewriteValueS390X_OpRsh64Ux64(v *Value) bool { 4784 v_1 := v.Args[1] 4785 v_0 := v.Args[0] 4786 b := v.Block 4787 typ := &b.Func.Config.Types 4788 // match: (Rsh64Ux64 x y) 4789 // cond: shiftIsBounded(v) 4790 // result: (SRD x y) 4791 for { 4792 x := v_0 4793 y := v_1 4794 if !(shiftIsBounded(v)) { 4795 break 4796 } 4797 v.reset(OpS390XSRD) 4798 v.AddArg2(x, y) 4799 return true 4800 } 4801 // match: (Rsh64Ux64 <t> x y) 4802 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 4803 for { 4804 t := v.Type 4805 x := v_0 4806 y := v_1 4807 v.reset(OpS390XLOCGR) 4808 v.Type = t 4809 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4810 v0 := b.NewValue0(v.Pos, OpS390XSRD, t) 4811 v0.AddArg2(x, y) 4812 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4813 v1.AuxInt = int64ToAuxInt(0) 4814 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4815 v2.AuxInt = int32ToAuxInt(64) 4816 v2.AddArg(y) 4817 v.AddArg3(v0, v1, v2) 4818 return true 4819 } 4820 } 4821 func rewriteValueS390X_OpRsh64Ux8(v *Value) bool { 4822 v_1 := v.Args[1] 4823 v_0 := v.Args[0] 4824 b := v.Block 4825 typ := &b.Func.Config.Types 4826 // match: (Rsh64Ux8 x y) 4827 // cond: shiftIsBounded(v) 4828 // result: (SRD x y) 4829 for { 4830 x := v_0 4831 y := v_1 4832 if !(shiftIsBounded(v)) { 4833 break 4834 } 4835 v.reset(OpS390XSRD) 4836 v.AddArg2(x, y) 4837 return true 4838 } 4839 // match: (Rsh64Ux8 <t> x y) 4840 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 4841 for { 4842 t := v.Type 4843 x := v_0 4844 y := v_1 4845 v.reset(OpS390XLOCGR) 4846 v.Type = t 4847 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4848 v0 := b.NewValue0(v.Pos, OpS390XSRD, t) 4849 v0.AddArg2(x, y) 4850 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4851 v1.AuxInt = int64ToAuxInt(0) 4852 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4853 v2.AuxInt = int32ToAuxInt(64) 4854 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4855 v3.AddArg(y) 4856 v2.AddArg(v3) 4857 v.AddArg3(v0, v1, v2) 4858 return true 4859 } 4860 } 4861 func rewriteValueS390X_OpRsh64x16(v *Value) bool { 4862 v_1 := v.Args[1] 4863 v_0 := v.Args[0] 4864 b := v.Block 4865 typ := &b.Func.Config.Types 4866 // match: (Rsh64x16 x y) 4867 // cond: shiftIsBounded(v) 4868 // result: (SRAD x y) 4869 for { 4870 x := v_0 4871 y := v_1 4872 if !(shiftIsBounded(v)) { 4873 break 4874 } 4875 v.reset(OpS390XSRAD) 4876 v.AddArg2(x, y) 4877 return true 4878 } 4879 // match: (Rsh64x16 x y) 4880 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64]))) 4881 for { 4882 x := v_0 4883 y := v_1 4884 v.reset(OpS390XSRAD) 4885 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4886 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4887 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4888 v1.AuxInt = int64ToAuxInt(63) 4889 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4890 v2.AuxInt = int32ToAuxInt(64) 4891 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4892 v3.AddArg(y) 4893 v2.AddArg(v3) 4894 v0.AddArg3(y, v1, v2) 4895 v.AddArg2(x, v0) 4896 return true 4897 } 4898 } 4899 func rewriteValueS390X_OpRsh64x32(v *Value) bool { 4900 v_1 := v.Args[1] 4901 v_0 := v.Args[0] 4902 b := v.Block 4903 // match: (Rsh64x32 x y) 4904 // cond: shiftIsBounded(v) 4905 // result: (SRAD x y) 4906 for { 4907 x := v_0 4908 y := v_1 4909 if !(shiftIsBounded(v)) { 4910 break 4911 } 4912 v.reset(OpS390XSRAD) 4913 v.AddArg2(x, y) 4914 return true 4915 } 4916 // match: (Rsh64x32 x y) 4917 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64]))) 4918 for { 4919 x := v_0 4920 y := v_1 4921 v.reset(OpS390XSRAD) 4922 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4923 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4924 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4925 v1.AuxInt = int64ToAuxInt(63) 4926 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4927 v2.AuxInt = int32ToAuxInt(64) 4928 v2.AddArg(y) 4929 v0.AddArg3(y, v1, v2) 4930 v.AddArg2(x, v0) 4931 return true 4932 } 4933 } 4934 func rewriteValueS390X_OpRsh64x64(v *Value) bool { 4935 v_1 := v.Args[1] 4936 v_0 := v.Args[0] 4937 b := v.Block 4938 // match: (Rsh64x64 x y) 4939 // cond: shiftIsBounded(v) 4940 // result: (SRAD x y) 4941 for { 4942 x := v_0 4943 y := v_1 4944 if !(shiftIsBounded(v)) { 4945 break 4946 } 4947 v.reset(OpS390XSRAD) 4948 v.AddArg2(x, y) 4949 return true 4950 } 4951 // match: (Rsh64x64 x y) 4952 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64]))) 4953 for { 4954 x := v_0 4955 y := v_1 4956 v.reset(OpS390XSRAD) 4957 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4958 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4959 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4960 v1.AuxInt = int64ToAuxInt(63) 4961 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4962 v2.AuxInt = int32ToAuxInt(64) 4963 v2.AddArg(y) 4964 v0.AddArg3(y, v1, v2) 4965 v.AddArg2(x, v0) 4966 return true 4967 } 4968 } 4969 func rewriteValueS390X_OpRsh64x8(v *Value) bool { 4970 v_1 := v.Args[1] 4971 v_0 := v.Args[0] 4972 b := v.Block 4973 typ := &b.Func.Config.Types 4974 // match: (Rsh64x8 x y) 4975 // cond: shiftIsBounded(v) 4976 // result: (SRAD x y) 4977 for { 4978 x := v_0 4979 y := v_1 4980 if !(shiftIsBounded(v)) { 4981 break 4982 } 4983 v.reset(OpS390XSRAD) 4984 v.AddArg2(x, y) 4985 return true 4986 } 4987 // match: (Rsh64x8 x y) 4988 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64]))) 4989 for { 4990 x := v_0 4991 y := v_1 4992 v.reset(OpS390XSRAD) 4993 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4994 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4995 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4996 v1.AuxInt = int64ToAuxInt(63) 4997 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4998 v2.AuxInt = int32ToAuxInt(64) 4999 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5000 v3.AddArg(y) 5001 v2.AddArg(v3) 5002 v0.AddArg3(y, v1, v2) 5003 v.AddArg2(x, v0) 5004 return true 5005 } 5006 } 5007 func rewriteValueS390X_OpRsh8Ux16(v *Value) bool { 5008 v_1 := v.Args[1] 5009 v_0 := v.Args[0] 5010 b := v.Block 5011 typ := &b.Func.Config.Types 5012 // match: (Rsh8Ux16 x y) 5013 // cond: shiftIsBounded(v) 5014 // result: (SRW (MOVBZreg x) y) 5015 for { 5016 x := v_0 5017 y := v_1 5018 if !(shiftIsBounded(v)) { 5019 break 5020 } 5021 v.reset(OpS390XSRW) 5022 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5023 v0.AddArg(x) 5024 v.AddArg2(v0, y) 5025 return true 5026 } 5027 // match: (Rsh8Ux16 <t> x y) 5028 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 5029 for { 5030 t := v.Type 5031 x := v_0 5032 y := v_1 5033 v.reset(OpS390XLOCGR) 5034 v.Type = t 5035 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5036 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 5037 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5038 v1.AddArg(x) 5039 v0.AddArg2(v1, y) 5040 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 5041 v2.AuxInt = int64ToAuxInt(0) 5042 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5043 v3.AuxInt = int32ToAuxInt(64) 5044 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 5045 v4.AddArg(y) 5046 v3.AddArg(v4) 5047 v.AddArg3(v0, v2, v3) 5048 return true 5049 } 5050 } 5051 func rewriteValueS390X_OpRsh8Ux32(v *Value) bool { 5052 v_1 := v.Args[1] 5053 v_0 := v.Args[0] 5054 b := v.Block 5055 typ := &b.Func.Config.Types 5056 // match: (Rsh8Ux32 x y) 5057 // cond: shiftIsBounded(v) 5058 // result: (SRW (MOVBZreg x) y) 5059 for { 5060 x := v_0 5061 y := v_1 5062 if !(shiftIsBounded(v)) { 5063 break 5064 } 5065 v.reset(OpS390XSRW) 5066 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5067 v0.AddArg(x) 5068 v.AddArg2(v0, y) 5069 return true 5070 } 5071 // match: (Rsh8Ux32 <t> x y) 5072 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [64])) 5073 for { 5074 t := v.Type 5075 x := v_0 5076 y := v_1 5077 v.reset(OpS390XLOCGR) 5078 v.Type = t 5079 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5080 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 5081 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5082 v1.AddArg(x) 5083 v0.AddArg2(v1, y) 5084 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 5085 v2.AuxInt = int64ToAuxInt(0) 5086 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5087 v3.AuxInt = int32ToAuxInt(64) 5088 v3.AddArg(y) 5089 v.AddArg3(v0, v2, v3) 5090 return true 5091 } 5092 } 5093 func rewriteValueS390X_OpRsh8Ux64(v *Value) bool { 5094 v_1 := v.Args[1] 5095 v_0 := v.Args[0] 5096 b := v.Block 5097 typ := &b.Func.Config.Types 5098 // match: (Rsh8Ux64 x y) 5099 // cond: shiftIsBounded(v) 5100 // result: (SRW (MOVBZreg x) y) 5101 for { 5102 x := v_0 5103 y := v_1 5104 if !(shiftIsBounded(v)) { 5105 break 5106 } 5107 v.reset(OpS390XSRW) 5108 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5109 v0.AddArg(x) 5110 v.AddArg2(v0, y) 5111 return true 5112 } 5113 // match: (Rsh8Ux64 <t> x y) 5114 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [64])) 5115 for { 5116 t := v.Type 5117 x := v_0 5118 y := v_1 5119 v.reset(OpS390XLOCGR) 5120 v.Type = t 5121 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5122 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 5123 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5124 v1.AddArg(x) 5125 v0.AddArg2(v1, y) 5126 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 5127 v2.AuxInt = int64ToAuxInt(0) 5128 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 5129 v3.AuxInt = int32ToAuxInt(64) 5130 v3.AddArg(y) 5131 v.AddArg3(v0, v2, v3) 5132 return true 5133 } 5134 } 5135 func rewriteValueS390X_OpRsh8Ux8(v *Value) bool { 5136 v_1 := v.Args[1] 5137 v_0 := v.Args[0] 5138 b := v.Block 5139 typ := &b.Func.Config.Types 5140 // match: (Rsh8Ux8 x y) 5141 // cond: shiftIsBounded(v) 5142 // result: (SRW (MOVBZreg x) y) 5143 for { 5144 x := v_0 5145 y := v_1 5146 if !(shiftIsBounded(v)) { 5147 break 5148 } 5149 v.reset(OpS390XSRW) 5150 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5151 v0.AddArg(x) 5152 v.AddArg2(v0, y) 5153 return true 5154 } 5155 // match: (Rsh8Ux8 <t> x y) 5156 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 5157 for { 5158 t := v.Type 5159 x := v_0 5160 y := v_1 5161 v.reset(OpS390XLOCGR) 5162 v.Type = t 5163 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5164 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 5165 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5166 v1.AddArg(x) 5167 v0.AddArg2(v1, y) 5168 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 5169 v2.AuxInt = int64ToAuxInt(0) 5170 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5171 v3.AuxInt = int32ToAuxInt(64) 5172 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5173 v4.AddArg(y) 5174 v3.AddArg(v4) 5175 v.AddArg3(v0, v2, v3) 5176 return true 5177 } 5178 } 5179 func rewriteValueS390X_OpRsh8x16(v *Value) bool { 5180 v_1 := v.Args[1] 5181 v_0 := v.Args[0] 5182 b := v.Block 5183 typ := &b.Func.Config.Types 5184 // match: (Rsh8x16 x y) 5185 // cond: shiftIsBounded(v) 5186 // result: (SRAW (MOVBreg x) y) 5187 for { 5188 x := v_0 5189 y := v_1 5190 if !(shiftIsBounded(v)) { 5191 break 5192 } 5193 v.reset(OpS390XSRAW) 5194 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5195 v0.AddArg(x) 5196 v.AddArg2(v0, y) 5197 return true 5198 } 5199 // match: (Rsh8x16 x y) 5200 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64]))) 5201 for { 5202 x := v_0 5203 y := v_1 5204 v.reset(OpS390XSRAW) 5205 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5206 v0.AddArg(x) 5207 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 5208 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5209 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 5210 v2.AuxInt = int64ToAuxInt(63) 5211 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5212 v3.AuxInt = int32ToAuxInt(64) 5213 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 5214 v4.AddArg(y) 5215 v3.AddArg(v4) 5216 v1.AddArg3(y, v2, v3) 5217 v.AddArg2(v0, v1) 5218 return true 5219 } 5220 } 5221 func rewriteValueS390X_OpRsh8x32(v *Value) bool { 5222 v_1 := v.Args[1] 5223 v_0 := v.Args[0] 5224 b := v.Block 5225 typ := &b.Func.Config.Types 5226 // match: (Rsh8x32 x y) 5227 // cond: shiftIsBounded(v) 5228 // result: (SRAW (MOVBreg x) y) 5229 for { 5230 x := v_0 5231 y := v_1 5232 if !(shiftIsBounded(v)) { 5233 break 5234 } 5235 v.reset(OpS390XSRAW) 5236 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5237 v0.AddArg(x) 5238 v.AddArg2(v0, y) 5239 return true 5240 } 5241 // match: (Rsh8x32 x y) 5242 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64]))) 5243 for { 5244 x := v_0 5245 y := v_1 5246 v.reset(OpS390XSRAW) 5247 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5248 v0.AddArg(x) 5249 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 5250 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5251 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 5252 v2.AuxInt = int64ToAuxInt(63) 5253 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5254 v3.AuxInt = int32ToAuxInt(64) 5255 v3.AddArg(y) 5256 v1.AddArg3(y, v2, v3) 5257 v.AddArg2(v0, v1) 5258 return true 5259 } 5260 } 5261 func rewriteValueS390X_OpRsh8x64(v *Value) bool { 5262 v_1 := v.Args[1] 5263 v_0 := v.Args[0] 5264 b := v.Block 5265 typ := &b.Func.Config.Types 5266 // match: (Rsh8x64 x y) 5267 // cond: shiftIsBounded(v) 5268 // result: (SRAW (MOVBreg x) y) 5269 for { 5270 x := v_0 5271 y := v_1 5272 if !(shiftIsBounded(v)) { 5273 break 5274 } 5275 v.reset(OpS390XSRAW) 5276 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5277 v0.AddArg(x) 5278 v.AddArg2(v0, y) 5279 return true 5280 } 5281 // match: (Rsh8x64 x y) 5282 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64]))) 5283 for { 5284 x := v_0 5285 y := v_1 5286 v.reset(OpS390XSRAW) 5287 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5288 v0.AddArg(x) 5289 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 5290 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5291 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 5292 v2.AuxInt = int64ToAuxInt(63) 5293 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 5294 v3.AuxInt = int32ToAuxInt(64) 5295 v3.AddArg(y) 5296 v1.AddArg3(y, v2, v3) 5297 v.AddArg2(v0, v1) 5298 return true 5299 } 5300 } 5301 func rewriteValueS390X_OpRsh8x8(v *Value) bool { 5302 v_1 := v.Args[1] 5303 v_0 := v.Args[0] 5304 b := v.Block 5305 typ := &b.Func.Config.Types 5306 // match: (Rsh8x8 x y) 5307 // cond: shiftIsBounded(v) 5308 // result: (SRAW (MOVBreg x) y) 5309 for { 5310 x := v_0 5311 y := v_1 5312 if !(shiftIsBounded(v)) { 5313 break 5314 } 5315 v.reset(OpS390XSRAW) 5316 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5317 v0.AddArg(x) 5318 v.AddArg2(v0, y) 5319 return true 5320 } 5321 // match: (Rsh8x8 x y) 5322 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64]))) 5323 for { 5324 x := v_0 5325 y := v_1 5326 v.reset(OpS390XSRAW) 5327 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5328 v0.AddArg(x) 5329 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 5330 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5331 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 5332 v2.AuxInt = int64ToAuxInt(63) 5333 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5334 v3.AuxInt = int32ToAuxInt(64) 5335 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5336 v4.AddArg(y) 5337 v3.AddArg(v4) 5338 v1.AddArg3(y, v2, v3) 5339 v.AddArg2(v0, v1) 5340 return true 5341 } 5342 } 5343 func rewriteValueS390X_OpS390XADD(v *Value) bool { 5344 v_1 := v.Args[1] 5345 v_0 := v.Args[0] 5346 // match: (ADD x (MOVDconst <t> [c])) 5347 // cond: is32Bit(c) && !t.IsPtr() 5348 // result: (ADDconst [int32(c)] x) 5349 for { 5350 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5351 x := v_0 5352 if v_1.Op != OpS390XMOVDconst { 5353 continue 5354 } 5355 t := v_1.Type 5356 c := auxIntToInt64(v_1.AuxInt) 5357 if !(is32Bit(c) && !t.IsPtr()) { 5358 continue 5359 } 5360 v.reset(OpS390XADDconst) 5361 v.AuxInt = int32ToAuxInt(int32(c)) 5362 v.AddArg(x) 5363 return true 5364 } 5365 break 5366 } 5367 // match: (ADD idx (MOVDaddr [c] {s} ptr)) 5368 // cond: ptr.Op != OpSB 5369 // result: (MOVDaddridx [c] {s} ptr idx) 5370 for { 5371 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5372 idx := v_0 5373 if v_1.Op != OpS390XMOVDaddr { 5374 continue 5375 } 5376 c := auxIntToInt32(v_1.AuxInt) 5377 s := auxToSym(v_1.Aux) 5378 ptr := v_1.Args[0] 5379 if !(ptr.Op != OpSB) { 5380 continue 5381 } 5382 v.reset(OpS390XMOVDaddridx) 5383 v.AuxInt = int32ToAuxInt(c) 5384 v.Aux = symToAux(s) 5385 v.AddArg2(ptr, idx) 5386 return true 5387 } 5388 break 5389 } 5390 // match: (ADD x (NEG y)) 5391 // result: (SUB x y) 5392 for { 5393 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5394 x := v_0 5395 if v_1.Op != OpS390XNEG { 5396 continue 5397 } 5398 y := v_1.Args[0] 5399 v.reset(OpS390XSUB) 5400 v.AddArg2(x, y) 5401 return true 5402 } 5403 break 5404 } 5405 // match: (ADD <t> x g:(MOVDload [off] {sym} ptr mem)) 5406 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5407 // result: (ADDload <t> [off] {sym} x ptr mem) 5408 for { 5409 t := v.Type 5410 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5411 x := v_0 5412 g := v_1 5413 if g.Op != OpS390XMOVDload { 5414 continue 5415 } 5416 off := auxIntToInt32(g.AuxInt) 5417 sym := auxToSym(g.Aux) 5418 mem := g.Args[1] 5419 ptr := g.Args[0] 5420 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5421 continue 5422 } 5423 v.reset(OpS390XADDload) 5424 v.Type = t 5425 v.AuxInt = int32ToAuxInt(off) 5426 v.Aux = symToAux(sym) 5427 v.AddArg3(x, ptr, mem) 5428 return true 5429 } 5430 break 5431 } 5432 return false 5433 } 5434 func rewriteValueS390X_OpS390XADDC(v *Value) bool { 5435 v_1 := v.Args[1] 5436 v_0 := v.Args[0] 5437 // match: (ADDC x (MOVDconst [c])) 5438 // cond: is16Bit(c) 5439 // result: (ADDCconst x [int16(c)]) 5440 for { 5441 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5442 x := v_0 5443 if v_1.Op != OpS390XMOVDconst { 5444 continue 5445 } 5446 c := auxIntToInt64(v_1.AuxInt) 5447 if !(is16Bit(c)) { 5448 continue 5449 } 5450 v.reset(OpS390XADDCconst) 5451 v.AuxInt = int16ToAuxInt(int16(c)) 5452 v.AddArg(x) 5453 return true 5454 } 5455 break 5456 } 5457 return false 5458 } 5459 func rewriteValueS390X_OpS390XADDE(v *Value) bool { 5460 v_2 := v.Args[2] 5461 v_1 := v.Args[1] 5462 v_0 := v.Args[0] 5463 // match: (ADDE x y (FlagEQ)) 5464 // result: (ADDC x y) 5465 for { 5466 x := v_0 5467 y := v_1 5468 if v_2.Op != OpS390XFlagEQ { 5469 break 5470 } 5471 v.reset(OpS390XADDC) 5472 v.AddArg2(x, y) 5473 return true 5474 } 5475 // match: (ADDE x y (FlagLT)) 5476 // result: (ADDC x y) 5477 for { 5478 x := v_0 5479 y := v_1 5480 if v_2.Op != OpS390XFlagLT { 5481 break 5482 } 5483 v.reset(OpS390XADDC) 5484 v.AddArg2(x, y) 5485 return true 5486 } 5487 // match: (ADDE x y (Select1 (ADDCconst [-1] (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) c))))) 5488 // result: (ADDE x y c) 5489 for { 5490 x := v_0 5491 y := v_1 5492 if v_2.Op != OpSelect1 { 5493 break 5494 } 5495 v_2_0 := v_2.Args[0] 5496 if v_2_0.Op != OpS390XADDCconst || auxIntToInt16(v_2_0.AuxInt) != -1 { 5497 break 5498 } 5499 v_2_0_0 := v_2_0.Args[0] 5500 if v_2_0_0.Op != OpSelect0 { 5501 break 5502 } 5503 v_2_0_0_0 := v_2_0_0.Args[0] 5504 if v_2_0_0_0.Op != OpS390XADDE { 5505 break 5506 } 5507 c := v_2_0_0_0.Args[2] 5508 v_2_0_0_0_0 := v_2_0_0_0.Args[0] 5509 if v_2_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0_0_0.AuxInt) != 0 { 5510 break 5511 } 5512 v_2_0_0_0_1 := v_2_0_0_0.Args[1] 5513 if v_2_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0_0_1.AuxInt) != 0 { 5514 break 5515 } 5516 v.reset(OpS390XADDE) 5517 v.AddArg3(x, y, c) 5518 return true 5519 } 5520 return false 5521 } 5522 func rewriteValueS390X_OpS390XADDW(v *Value) bool { 5523 v_1 := v.Args[1] 5524 v_0 := v.Args[0] 5525 // match: (ADDW x (MOVDconst [c])) 5526 // result: (ADDWconst [int32(c)] x) 5527 for { 5528 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5529 x := v_0 5530 if v_1.Op != OpS390XMOVDconst { 5531 continue 5532 } 5533 c := auxIntToInt64(v_1.AuxInt) 5534 v.reset(OpS390XADDWconst) 5535 v.AuxInt = int32ToAuxInt(int32(c)) 5536 v.AddArg(x) 5537 return true 5538 } 5539 break 5540 } 5541 // match: (ADDW x (NEGW y)) 5542 // result: (SUBW x y) 5543 for { 5544 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5545 x := v_0 5546 if v_1.Op != OpS390XNEGW { 5547 continue 5548 } 5549 y := v_1.Args[0] 5550 v.reset(OpS390XSUBW) 5551 v.AddArg2(x, y) 5552 return true 5553 } 5554 break 5555 } 5556 // match: (ADDW <t> x g:(MOVWload [off] {sym} ptr mem)) 5557 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5558 // result: (ADDWload <t> [off] {sym} x ptr mem) 5559 for { 5560 t := v.Type 5561 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5562 x := v_0 5563 g := v_1 5564 if g.Op != OpS390XMOVWload { 5565 continue 5566 } 5567 off := auxIntToInt32(g.AuxInt) 5568 sym := auxToSym(g.Aux) 5569 mem := g.Args[1] 5570 ptr := g.Args[0] 5571 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5572 continue 5573 } 5574 v.reset(OpS390XADDWload) 5575 v.Type = t 5576 v.AuxInt = int32ToAuxInt(off) 5577 v.Aux = symToAux(sym) 5578 v.AddArg3(x, ptr, mem) 5579 return true 5580 } 5581 break 5582 } 5583 // match: (ADDW <t> x g:(MOVWZload [off] {sym} ptr mem)) 5584 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5585 // result: (ADDWload <t> [off] {sym} x ptr mem) 5586 for { 5587 t := v.Type 5588 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5589 x := v_0 5590 g := v_1 5591 if g.Op != OpS390XMOVWZload { 5592 continue 5593 } 5594 off := auxIntToInt32(g.AuxInt) 5595 sym := auxToSym(g.Aux) 5596 mem := g.Args[1] 5597 ptr := g.Args[0] 5598 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5599 continue 5600 } 5601 v.reset(OpS390XADDWload) 5602 v.Type = t 5603 v.AuxInt = int32ToAuxInt(off) 5604 v.Aux = symToAux(sym) 5605 v.AddArg3(x, ptr, mem) 5606 return true 5607 } 5608 break 5609 } 5610 return false 5611 } 5612 func rewriteValueS390X_OpS390XADDWconst(v *Value) bool { 5613 v_0 := v.Args[0] 5614 // match: (ADDWconst [c] x) 5615 // cond: int32(c)==0 5616 // result: x 5617 for { 5618 c := auxIntToInt32(v.AuxInt) 5619 x := v_0 5620 if !(int32(c) == 0) { 5621 break 5622 } 5623 v.copyOf(x) 5624 return true 5625 } 5626 // match: (ADDWconst [c] (MOVDconst [d])) 5627 // result: (MOVDconst [int64(c)+d]) 5628 for { 5629 c := auxIntToInt32(v.AuxInt) 5630 if v_0.Op != OpS390XMOVDconst { 5631 break 5632 } 5633 d := auxIntToInt64(v_0.AuxInt) 5634 v.reset(OpS390XMOVDconst) 5635 v.AuxInt = int64ToAuxInt(int64(c) + d) 5636 return true 5637 } 5638 // match: (ADDWconst [c] (ADDWconst [d] x)) 5639 // result: (ADDWconst [int32(c+d)] x) 5640 for { 5641 c := auxIntToInt32(v.AuxInt) 5642 if v_0.Op != OpS390XADDWconst { 5643 break 5644 } 5645 d := auxIntToInt32(v_0.AuxInt) 5646 x := v_0.Args[0] 5647 v.reset(OpS390XADDWconst) 5648 v.AuxInt = int32ToAuxInt(int32(c + d)) 5649 v.AddArg(x) 5650 return true 5651 } 5652 return false 5653 } 5654 func rewriteValueS390X_OpS390XADDWload(v *Value) bool { 5655 v_2 := v.Args[2] 5656 v_1 := v.Args[1] 5657 v_0 := v.Args[0] 5658 // match: (ADDWload [off1] {sym} x (ADDconst [off2] ptr) mem) 5659 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 5660 // result: (ADDWload [off1+off2] {sym} x ptr mem) 5661 for { 5662 off1 := auxIntToInt32(v.AuxInt) 5663 sym := auxToSym(v.Aux) 5664 x := v_0 5665 if v_1.Op != OpS390XADDconst { 5666 break 5667 } 5668 off2 := auxIntToInt32(v_1.AuxInt) 5669 ptr := v_1.Args[0] 5670 mem := v_2 5671 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 5672 break 5673 } 5674 v.reset(OpS390XADDWload) 5675 v.AuxInt = int32ToAuxInt(off1 + off2) 5676 v.Aux = symToAux(sym) 5677 v.AddArg3(x, ptr, mem) 5678 return true 5679 } 5680 // match: (ADDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 5681 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 5682 // result: (ADDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 5683 for { 5684 o1 := auxIntToInt32(v.AuxInt) 5685 s1 := auxToSym(v.Aux) 5686 x := v_0 5687 if v_1.Op != OpS390XMOVDaddr { 5688 break 5689 } 5690 o2 := auxIntToInt32(v_1.AuxInt) 5691 s2 := auxToSym(v_1.Aux) 5692 ptr := v_1.Args[0] 5693 mem := v_2 5694 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 5695 break 5696 } 5697 v.reset(OpS390XADDWload) 5698 v.AuxInt = int32ToAuxInt(o1 + o2) 5699 v.Aux = symToAux(mergeSym(s1, s2)) 5700 v.AddArg3(x, ptr, mem) 5701 return true 5702 } 5703 return false 5704 } 5705 func rewriteValueS390X_OpS390XADDconst(v *Value) bool { 5706 v_0 := v.Args[0] 5707 // match: (ADDconst [c] (MOVDaddr [d] {s} x:(SB))) 5708 // cond: ((c+d)&1 == 0) && is32Bit(int64(c)+int64(d)) 5709 // result: (MOVDaddr [c+d] {s} x) 5710 for { 5711 c := auxIntToInt32(v.AuxInt) 5712 if v_0.Op != OpS390XMOVDaddr { 5713 break 5714 } 5715 d := auxIntToInt32(v_0.AuxInt) 5716 s := auxToSym(v_0.Aux) 5717 x := v_0.Args[0] 5718 if x.Op != OpSB || !(((c+d)&1 == 0) && is32Bit(int64(c)+int64(d))) { 5719 break 5720 } 5721 v.reset(OpS390XMOVDaddr) 5722 v.AuxInt = int32ToAuxInt(c + d) 5723 v.Aux = symToAux(s) 5724 v.AddArg(x) 5725 return true 5726 } 5727 // match: (ADDconst [c] (MOVDaddr [d] {s} x)) 5728 // cond: x.Op != OpSB && is20Bit(int64(c)+int64(d)) 5729 // result: (MOVDaddr [c+d] {s} x) 5730 for { 5731 c := auxIntToInt32(v.AuxInt) 5732 if v_0.Op != OpS390XMOVDaddr { 5733 break 5734 } 5735 d := auxIntToInt32(v_0.AuxInt) 5736 s := auxToSym(v_0.Aux) 5737 x := v_0.Args[0] 5738 if !(x.Op != OpSB && is20Bit(int64(c)+int64(d))) { 5739 break 5740 } 5741 v.reset(OpS390XMOVDaddr) 5742 v.AuxInt = int32ToAuxInt(c + d) 5743 v.Aux = symToAux(s) 5744 v.AddArg(x) 5745 return true 5746 } 5747 // match: (ADDconst [c] (MOVDaddridx [d] {s} x y)) 5748 // cond: is20Bit(int64(c)+int64(d)) 5749 // result: (MOVDaddridx [c+d] {s} x y) 5750 for { 5751 c := auxIntToInt32(v.AuxInt) 5752 if v_0.Op != OpS390XMOVDaddridx { 5753 break 5754 } 5755 d := auxIntToInt32(v_0.AuxInt) 5756 s := auxToSym(v_0.Aux) 5757 y := v_0.Args[1] 5758 x := v_0.Args[0] 5759 if !(is20Bit(int64(c) + int64(d))) { 5760 break 5761 } 5762 v.reset(OpS390XMOVDaddridx) 5763 v.AuxInt = int32ToAuxInt(c + d) 5764 v.Aux = symToAux(s) 5765 v.AddArg2(x, y) 5766 return true 5767 } 5768 // match: (ADDconst [0] x) 5769 // result: x 5770 for { 5771 if auxIntToInt32(v.AuxInt) != 0 { 5772 break 5773 } 5774 x := v_0 5775 v.copyOf(x) 5776 return true 5777 } 5778 // match: (ADDconst [c] (MOVDconst [d])) 5779 // result: (MOVDconst [int64(c)+d]) 5780 for { 5781 c := auxIntToInt32(v.AuxInt) 5782 if v_0.Op != OpS390XMOVDconst { 5783 break 5784 } 5785 d := auxIntToInt64(v_0.AuxInt) 5786 v.reset(OpS390XMOVDconst) 5787 v.AuxInt = int64ToAuxInt(int64(c) + d) 5788 return true 5789 } 5790 // match: (ADDconst [c] (ADDconst [d] x)) 5791 // cond: is32Bit(int64(c)+int64(d)) 5792 // result: (ADDconst [c+d] x) 5793 for { 5794 c := auxIntToInt32(v.AuxInt) 5795 if v_0.Op != OpS390XADDconst { 5796 break 5797 } 5798 d := auxIntToInt32(v_0.AuxInt) 5799 x := v_0.Args[0] 5800 if !(is32Bit(int64(c) + int64(d))) { 5801 break 5802 } 5803 v.reset(OpS390XADDconst) 5804 v.AuxInt = int32ToAuxInt(c + d) 5805 v.AddArg(x) 5806 return true 5807 } 5808 return false 5809 } 5810 func rewriteValueS390X_OpS390XADDload(v *Value) bool { 5811 v_2 := v.Args[2] 5812 v_1 := v.Args[1] 5813 v_0 := v.Args[0] 5814 b := v.Block 5815 // match: (ADDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 5816 // cond: isSamePtr(ptr1, ptr2) 5817 // result: (ADD x (LGDR <t> y)) 5818 for { 5819 t := v.Type 5820 off := auxIntToInt32(v.AuxInt) 5821 sym := auxToSym(v.Aux) 5822 x := v_0 5823 ptr1 := v_1 5824 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 5825 break 5826 } 5827 y := v_2.Args[1] 5828 ptr2 := v_2.Args[0] 5829 if !(isSamePtr(ptr1, ptr2)) { 5830 break 5831 } 5832 v.reset(OpS390XADD) 5833 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 5834 v0.AddArg(y) 5835 v.AddArg2(x, v0) 5836 return true 5837 } 5838 // match: (ADDload [off1] {sym} x (ADDconst [off2] ptr) mem) 5839 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 5840 // result: (ADDload [off1+off2] {sym} x ptr mem) 5841 for { 5842 off1 := auxIntToInt32(v.AuxInt) 5843 sym := auxToSym(v.Aux) 5844 x := v_0 5845 if v_1.Op != OpS390XADDconst { 5846 break 5847 } 5848 off2 := auxIntToInt32(v_1.AuxInt) 5849 ptr := v_1.Args[0] 5850 mem := v_2 5851 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 5852 break 5853 } 5854 v.reset(OpS390XADDload) 5855 v.AuxInt = int32ToAuxInt(off1 + off2) 5856 v.Aux = symToAux(sym) 5857 v.AddArg3(x, ptr, mem) 5858 return true 5859 } 5860 // match: (ADDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 5861 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 5862 // result: (ADDload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 5863 for { 5864 o1 := auxIntToInt32(v.AuxInt) 5865 s1 := auxToSym(v.Aux) 5866 x := v_0 5867 if v_1.Op != OpS390XMOVDaddr { 5868 break 5869 } 5870 o2 := auxIntToInt32(v_1.AuxInt) 5871 s2 := auxToSym(v_1.Aux) 5872 ptr := v_1.Args[0] 5873 mem := v_2 5874 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 5875 break 5876 } 5877 v.reset(OpS390XADDload) 5878 v.AuxInt = int32ToAuxInt(o1 + o2) 5879 v.Aux = symToAux(mergeSym(s1, s2)) 5880 v.AddArg3(x, ptr, mem) 5881 return true 5882 } 5883 return false 5884 } 5885 func rewriteValueS390X_OpS390XAND(v *Value) bool { 5886 v_1 := v.Args[1] 5887 v_0 := v.Args[0] 5888 b := v.Block 5889 typ := &b.Func.Config.Types 5890 // match: (AND x (MOVDconst [c])) 5891 // cond: s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)) != nil 5892 // result: (RISBGZ x {*s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c))}) 5893 for { 5894 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5895 x := v_0 5896 if v_1.Op != OpS390XMOVDconst { 5897 continue 5898 } 5899 c := auxIntToInt64(v_1.AuxInt) 5900 if !(s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)) != nil) { 5901 continue 5902 } 5903 v.reset(OpS390XRISBGZ) 5904 v.Aux = s390xRotateParamsToAux(*s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c))) 5905 v.AddArg(x) 5906 return true 5907 } 5908 break 5909 } 5910 // match: (AND x (MOVDconst [c])) 5911 // cond: is32Bit(c) && c < 0 5912 // result: (ANDconst [c] x) 5913 for { 5914 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5915 x := v_0 5916 if v_1.Op != OpS390XMOVDconst { 5917 continue 5918 } 5919 c := auxIntToInt64(v_1.AuxInt) 5920 if !(is32Bit(c) && c < 0) { 5921 continue 5922 } 5923 v.reset(OpS390XANDconst) 5924 v.AuxInt = int64ToAuxInt(c) 5925 v.AddArg(x) 5926 return true 5927 } 5928 break 5929 } 5930 // match: (AND x (MOVDconst [c])) 5931 // cond: is32Bit(c) && c >= 0 5932 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(c)] x)) 5933 for { 5934 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5935 x := v_0 5936 if v_1.Op != OpS390XMOVDconst { 5937 continue 5938 } 5939 c := auxIntToInt64(v_1.AuxInt) 5940 if !(is32Bit(c) && c >= 0) { 5941 continue 5942 } 5943 v.reset(OpS390XMOVWZreg) 5944 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 5945 v0.AuxInt = int32ToAuxInt(int32(c)) 5946 v0.AddArg(x) 5947 v.AddArg(v0) 5948 return true 5949 } 5950 break 5951 } 5952 // match: (AND (MOVDconst [c]) (MOVDconst [d])) 5953 // result: (MOVDconst [c&d]) 5954 for { 5955 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5956 if v_0.Op != OpS390XMOVDconst { 5957 continue 5958 } 5959 c := auxIntToInt64(v_0.AuxInt) 5960 if v_1.Op != OpS390XMOVDconst { 5961 continue 5962 } 5963 d := auxIntToInt64(v_1.AuxInt) 5964 v.reset(OpS390XMOVDconst) 5965 v.AuxInt = int64ToAuxInt(c & d) 5966 return true 5967 } 5968 break 5969 } 5970 // match: (AND x x) 5971 // result: x 5972 for { 5973 x := v_0 5974 if x != v_1 { 5975 break 5976 } 5977 v.copyOf(x) 5978 return true 5979 } 5980 // match: (AND <t> x g:(MOVDload [off] {sym} ptr mem)) 5981 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5982 // result: (ANDload <t> [off] {sym} x ptr mem) 5983 for { 5984 t := v.Type 5985 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5986 x := v_0 5987 g := v_1 5988 if g.Op != OpS390XMOVDload { 5989 continue 5990 } 5991 off := auxIntToInt32(g.AuxInt) 5992 sym := auxToSym(g.Aux) 5993 mem := g.Args[1] 5994 ptr := g.Args[0] 5995 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5996 continue 5997 } 5998 v.reset(OpS390XANDload) 5999 v.Type = t 6000 v.AuxInt = int32ToAuxInt(off) 6001 v.Aux = symToAux(sym) 6002 v.AddArg3(x, ptr, mem) 6003 return true 6004 } 6005 break 6006 } 6007 return false 6008 } 6009 func rewriteValueS390X_OpS390XANDW(v *Value) bool { 6010 v_1 := v.Args[1] 6011 v_0 := v.Args[0] 6012 // match: (ANDW x (MOVDconst [c])) 6013 // result: (ANDWconst [int32(c)] x) 6014 for { 6015 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6016 x := v_0 6017 if v_1.Op != OpS390XMOVDconst { 6018 continue 6019 } 6020 c := auxIntToInt64(v_1.AuxInt) 6021 v.reset(OpS390XANDWconst) 6022 v.AuxInt = int32ToAuxInt(int32(c)) 6023 v.AddArg(x) 6024 return true 6025 } 6026 break 6027 } 6028 // match: (ANDW x x) 6029 // result: x 6030 for { 6031 x := v_0 6032 if x != v_1 { 6033 break 6034 } 6035 v.copyOf(x) 6036 return true 6037 } 6038 // match: (ANDW <t> x g:(MOVWload [off] {sym} ptr mem)) 6039 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 6040 // result: (ANDWload <t> [off] {sym} x ptr mem) 6041 for { 6042 t := v.Type 6043 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6044 x := v_0 6045 g := v_1 6046 if g.Op != OpS390XMOVWload { 6047 continue 6048 } 6049 off := auxIntToInt32(g.AuxInt) 6050 sym := auxToSym(g.Aux) 6051 mem := g.Args[1] 6052 ptr := g.Args[0] 6053 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 6054 continue 6055 } 6056 v.reset(OpS390XANDWload) 6057 v.Type = t 6058 v.AuxInt = int32ToAuxInt(off) 6059 v.Aux = symToAux(sym) 6060 v.AddArg3(x, ptr, mem) 6061 return true 6062 } 6063 break 6064 } 6065 // match: (ANDW <t> x g:(MOVWZload [off] {sym} ptr mem)) 6066 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 6067 // result: (ANDWload <t> [off] {sym} x ptr mem) 6068 for { 6069 t := v.Type 6070 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6071 x := v_0 6072 g := v_1 6073 if g.Op != OpS390XMOVWZload { 6074 continue 6075 } 6076 off := auxIntToInt32(g.AuxInt) 6077 sym := auxToSym(g.Aux) 6078 mem := g.Args[1] 6079 ptr := g.Args[0] 6080 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 6081 continue 6082 } 6083 v.reset(OpS390XANDWload) 6084 v.Type = t 6085 v.AuxInt = int32ToAuxInt(off) 6086 v.Aux = symToAux(sym) 6087 v.AddArg3(x, ptr, mem) 6088 return true 6089 } 6090 break 6091 } 6092 return false 6093 } 6094 func rewriteValueS390X_OpS390XANDWconst(v *Value) bool { 6095 v_0 := v.Args[0] 6096 // match: (ANDWconst [c] (ANDWconst [d] x)) 6097 // result: (ANDWconst [c&d] x) 6098 for { 6099 c := auxIntToInt32(v.AuxInt) 6100 if v_0.Op != OpS390XANDWconst { 6101 break 6102 } 6103 d := auxIntToInt32(v_0.AuxInt) 6104 x := v_0.Args[0] 6105 v.reset(OpS390XANDWconst) 6106 v.AuxInt = int32ToAuxInt(c & d) 6107 v.AddArg(x) 6108 return true 6109 } 6110 // match: (ANDWconst [0x00ff] x) 6111 // result: (MOVBZreg x) 6112 for { 6113 if auxIntToInt32(v.AuxInt) != 0x00ff { 6114 break 6115 } 6116 x := v_0 6117 v.reset(OpS390XMOVBZreg) 6118 v.AddArg(x) 6119 return true 6120 } 6121 // match: (ANDWconst [0xffff] x) 6122 // result: (MOVHZreg x) 6123 for { 6124 if auxIntToInt32(v.AuxInt) != 0xffff { 6125 break 6126 } 6127 x := v_0 6128 v.reset(OpS390XMOVHZreg) 6129 v.AddArg(x) 6130 return true 6131 } 6132 // match: (ANDWconst [c] _) 6133 // cond: int32(c)==0 6134 // result: (MOVDconst [0]) 6135 for { 6136 c := auxIntToInt32(v.AuxInt) 6137 if !(int32(c) == 0) { 6138 break 6139 } 6140 v.reset(OpS390XMOVDconst) 6141 v.AuxInt = int64ToAuxInt(0) 6142 return true 6143 } 6144 // match: (ANDWconst [c] x) 6145 // cond: int32(c)==-1 6146 // result: x 6147 for { 6148 c := auxIntToInt32(v.AuxInt) 6149 x := v_0 6150 if !(int32(c) == -1) { 6151 break 6152 } 6153 v.copyOf(x) 6154 return true 6155 } 6156 // match: (ANDWconst [c] (MOVDconst [d])) 6157 // result: (MOVDconst [int64(c)&d]) 6158 for { 6159 c := auxIntToInt32(v.AuxInt) 6160 if v_0.Op != OpS390XMOVDconst { 6161 break 6162 } 6163 d := auxIntToInt64(v_0.AuxInt) 6164 v.reset(OpS390XMOVDconst) 6165 v.AuxInt = int64ToAuxInt(int64(c) & d) 6166 return true 6167 } 6168 return false 6169 } 6170 func rewriteValueS390X_OpS390XANDWload(v *Value) bool { 6171 v_2 := v.Args[2] 6172 v_1 := v.Args[1] 6173 v_0 := v.Args[0] 6174 // match: (ANDWload [off1] {sym} x (ADDconst [off2] ptr) mem) 6175 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 6176 // result: (ANDWload [off1+off2] {sym} x ptr mem) 6177 for { 6178 off1 := auxIntToInt32(v.AuxInt) 6179 sym := auxToSym(v.Aux) 6180 x := v_0 6181 if v_1.Op != OpS390XADDconst { 6182 break 6183 } 6184 off2 := auxIntToInt32(v_1.AuxInt) 6185 ptr := v_1.Args[0] 6186 mem := v_2 6187 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 6188 break 6189 } 6190 v.reset(OpS390XANDWload) 6191 v.AuxInt = int32ToAuxInt(off1 + off2) 6192 v.Aux = symToAux(sym) 6193 v.AddArg3(x, ptr, mem) 6194 return true 6195 } 6196 // match: (ANDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 6197 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 6198 // result: (ANDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 6199 for { 6200 o1 := auxIntToInt32(v.AuxInt) 6201 s1 := auxToSym(v.Aux) 6202 x := v_0 6203 if v_1.Op != OpS390XMOVDaddr { 6204 break 6205 } 6206 o2 := auxIntToInt32(v_1.AuxInt) 6207 s2 := auxToSym(v_1.Aux) 6208 ptr := v_1.Args[0] 6209 mem := v_2 6210 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 6211 break 6212 } 6213 v.reset(OpS390XANDWload) 6214 v.AuxInt = int32ToAuxInt(o1 + o2) 6215 v.Aux = symToAux(mergeSym(s1, s2)) 6216 v.AddArg3(x, ptr, mem) 6217 return true 6218 } 6219 return false 6220 } 6221 func rewriteValueS390X_OpS390XANDconst(v *Value) bool { 6222 v_0 := v.Args[0] 6223 // match: (ANDconst [c] (ANDconst [d] x)) 6224 // result: (ANDconst [c&d] x) 6225 for { 6226 c := auxIntToInt64(v.AuxInt) 6227 if v_0.Op != OpS390XANDconst { 6228 break 6229 } 6230 d := auxIntToInt64(v_0.AuxInt) 6231 x := v_0.Args[0] 6232 v.reset(OpS390XANDconst) 6233 v.AuxInt = int64ToAuxInt(c & d) 6234 v.AddArg(x) 6235 return true 6236 } 6237 // match: (ANDconst [0] _) 6238 // result: (MOVDconst [0]) 6239 for { 6240 if auxIntToInt64(v.AuxInt) != 0 { 6241 break 6242 } 6243 v.reset(OpS390XMOVDconst) 6244 v.AuxInt = int64ToAuxInt(0) 6245 return true 6246 } 6247 // match: (ANDconst [-1] x) 6248 // result: x 6249 for { 6250 if auxIntToInt64(v.AuxInt) != -1 { 6251 break 6252 } 6253 x := v_0 6254 v.copyOf(x) 6255 return true 6256 } 6257 // match: (ANDconst [c] (MOVDconst [d])) 6258 // result: (MOVDconst [c&d]) 6259 for { 6260 c := auxIntToInt64(v.AuxInt) 6261 if v_0.Op != OpS390XMOVDconst { 6262 break 6263 } 6264 d := auxIntToInt64(v_0.AuxInt) 6265 v.reset(OpS390XMOVDconst) 6266 v.AuxInt = int64ToAuxInt(c & d) 6267 return true 6268 } 6269 return false 6270 } 6271 func rewriteValueS390X_OpS390XANDload(v *Value) bool { 6272 v_2 := v.Args[2] 6273 v_1 := v.Args[1] 6274 v_0 := v.Args[0] 6275 b := v.Block 6276 // match: (ANDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 6277 // cond: isSamePtr(ptr1, ptr2) 6278 // result: (AND x (LGDR <t> y)) 6279 for { 6280 t := v.Type 6281 off := auxIntToInt32(v.AuxInt) 6282 sym := auxToSym(v.Aux) 6283 x := v_0 6284 ptr1 := v_1 6285 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 6286 break 6287 } 6288 y := v_2.Args[1] 6289 ptr2 := v_2.Args[0] 6290 if !(isSamePtr(ptr1, ptr2)) { 6291 break 6292 } 6293 v.reset(OpS390XAND) 6294 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 6295 v0.AddArg(y) 6296 v.AddArg2(x, v0) 6297 return true 6298 } 6299 // match: (ANDload [off1] {sym} x (ADDconst [off2] ptr) mem) 6300 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 6301 // result: (ANDload [off1+off2] {sym} x ptr mem) 6302 for { 6303 off1 := auxIntToInt32(v.AuxInt) 6304 sym := auxToSym(v.Aux) 6305 x := v_0 6306 if v_1.Op != OpS390XADDconst { 6307 break 6308 } 6309 off2 := auxIntToInt32(v_1.AuxInt) 6310 ptr := v_1.Args[0] 6311 mem := v_2 6312 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 6313 break 6314 } 6315 v.reset(OpS390XANDload) 6316 v.AuxInt = int32ToAuxInt(off1 + off2) 6317 v.Aux = symToAux(sym) 6318 v.AddArg3(x, ptr, mem) 6319 return true 6320 } 6321 // match: (ANDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 6322 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 6323 // result: (ANDload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 6324 for { 6325 o1 := auxIntToInt32(v.AuxInt) 6326 s1 := auxToSym(v.Aux) 6327 x := v_0 6328 if v_1.Op != OpS390XMOVDaddr { 6329 break 6330 } 6331 o2 := auxIntToInt32(v_1.AuxInt) 6332 s2 := auxToSym(v_1.Aux) 6333 ptr := v_1.Args[0] 6334 mem := v_2 6335 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 6336 break 6337 } 6338 v.reset(OpS390XANDload) 6339 v.AuxInt = int32ToAuxInt(o1 + o2) 6340 v.Aux = symToAux(mergeSym(s1, s2)) 6341 v.AddArg3(x, ptr, mem) 6342 return true 6343 } 6344 return false 6345 } 6346 func rewriteValueS390X_OpS390XCMP(v *Value) bool { 6347 v_1 := v.Args[1] 6348 v_0 := v.Args[0] 6349 b := v.Block 6350 // match: (CMP x (MOVDconst [c])) 6351 // cond: is32Bit(c) 6352 // result: (CMPconst x [int32(c)]) 6353 for { 6354 x := v_0 6355 if v_1.Op != OpS390XMOVDconst { 6356 break 6357 } 6358 c := auxIntToInt64(v_1.AuxInt) 6359 if !(is32Bit(c)) { 6360 break 6361 } 6362 v.reset(OpS390XCMPconst) 6363 v.AuxInt = int32ToAuxInt(int32(c)) 6364 v.AddArg(x) 6365 return true 6366 } 6367 // match: (CMP (MOVDconst [c]) x) 6368 // cond: is32Bit(c) 6369 // result: (InvertFlags (CMPconst x [int32(c)])) 6370 for { 6371 if v_0.Op != OpS390XMOVDconst { 6372 break 6373 } 6374 c := auxIntToInt64(v_0.AuxInt) 6375 x := v_1 6376 if !(is32Bit(c)) { 6377 break 6378 } 6379 v.reset(OpS390XInvertFlags) 6380 v0 := b.NewValue0(v.Pos, OpS390XCMPconst, types.TypeFlags) 6381 v0.AuxInt = int32ToAuxInt(int32(c)) 6382 v0.AddArg(x) 6383 v.AddArg(v0) 6384 return true 6385 } 6386 // match: (CMP x y) 6387 // cond: canonLessThan(x,y) 6388 // result: (InvertFlags (CMP y x)) 6389 for { 6390 x := v_0 6391 y := v_1 6392 if !(canonLessThan(x, y)) { 6393 break 6394 } 6395 v.reset(OpS390XInvertFlags) 6396 v0 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 6397 v0.AddArg2(y, x) 6398 v.AddArg(v0) 6399 return true 6400 } 6401 return false 6402 } 6403 func rewriteValueS390X_OpS390XCMPU(v *Value) bool { 6404 v_1 := v.Args[1] 6405 v_0 := v.Args[0] 6406 b := v.Block 6407 // match: (CMPU x (MOVDconst [c])) 6408 // cond: isU32Bit(c) 6409 // result: (CMPUconst x [int32(c)]) 6410 for { 6411 x := v_0 6412 if v_1.Op != OpS390XMOVDconst { 6413 break 6414 } 6415 c := auxIntToInt64(v_1.AuxInt) 6416 if !(isU32Bit(c)) { 6417 break 6418 } 6419 v.reset(OpS390XCMPUconst) 6420 v.AuxInt = int32ToAuxInt(int32(c)) 6421 v.AddArg(x) 6422 return true 6423 } 6424 // match: (CMPU (MOVDconst [c]) x) 6425 // cond: isU32Bit(c) 6426 // result: (InvertFlags (CMPUconst x [int32(c)])) 6427 for { 6428 if v_0.Op != OpS390XMOVDconst { 6429 break 6430 } 6431 c := auxIntToInt64(v_0.AuxInt) 6432 x := v_1 6433 if !(isU32Bit(c)) { 6434 break 6435 } 6436 v.reset(OpS390XInvertFlags) 6437 v0 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 6438 v0.AuxInt = int32ToAuxInt(int32(c)) 6439 v0.AddArg(x) 6440 v.AddArg(v0) 6441 return true 6442 } 6443 // match: (CMPU x y) 6444 // cond: canonLessThan(x,y) 6445 // result: (InvertFlags (CMPU y x)) 6446 for { 6447 x := v_0 6448 y := v_1 6449 if !(canonLessThan(x, y)) { 6450 break 6451 } 6452 v.reset(OpS390XInvertFlags) 6453 v0 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 6454 v0.AddArg2(y, x) 6455 v.AddArg(v0) 6456 return true 6457 } 6458 return false 6459 } 6460 func rewriteValueS390X_OpS390XCMPUconst(v *Value) bool { 6461 v_0 := v.Args[0] 6462 // match: (CMPUconst (MOVDconst [x]) [y]) 6463 // cond: uint64(x)==uint64(y) 6464 // result: (FlagEQ) 6465 for { 6466 y := auxIntToInt32(v.AuxInt) 6467 if v_0.Op != OpS390XMOVDconst { 6468 break 6469 } 6470 x := auxIntToInt64(v_0.AuxInt) 6471 if !(uint64(x) == uint64(y)) { 6472 break 6473 } 6474 v.reset(OpS390XFlagEQ) 6475 return true 6476 } 6477 // match: (CMPUconst (MOVDconst [x]) [y]) 6478 // cond: uint64(x)<uint64(y) 6479 // result: (FlagLT) 6480 for { 6481 y := auxIntToInt32(v.AuxInt) 6482 if v_0.Op != OpS390XMOVDconst { 6483 break 6484 } 6485 x := auxIntToInt64(v_0.AuxInt) 6486 if !(uint64(x) < uint64(y)) { 6487 break 6488 } 6489 v.reset(OpS390XFlagLT) 6490 return true 6491 } 6492 // match: (CMPUconst (MOVDconst [x]) [y]) 6493 // cond: uint64(x)>uint64(y) 6494 // result: (FlagGT) 6495 for { 6496 y := auxIntToInt32(v.AuxInt) 6497 if v_0.Op != OpS390XMOVDconst { 6498 break 6499 } 6500 x := auxIntToInt64(v_0.AuxInt) 6501 if !(uint64(x) > uint64(y)) { 6502 break 6503 } 6504 v.reset(OpS390XFlagGT) 6505 return true 6506 } 6507 // match: (CMPUconst (SRDconst _ [c]) [n]) 6508 // cond: c > 0 && c < 64 && (1<<uint(64-c)) <= uint64(n) 6509 // result: (FlagLT) 6510 for { 6511 n := auxIntToInt32(v.AuxInt) 6512 if v_0.Op != OpS390XSRDconst { 6513 break 6514 } 6515 c := auxIntToUint8(v_0.AuxInt) 6516 if !(c > 0 && c < 64 && (1<<uint(64-c)) <= uint64(n)) { 6517 break 6518 } 6519 v.reset(OpS390XFlagLT) 6520 return true 6521 } 6522 // match: (CMPUconst (RISBGZ x {r}) [c]) 6523 // cond: r.OutMask() < uint64(uint32(c)) 6524 // result: (FlagLT) 6525 for { 6526 c := auxIntToInt32(v.AuxInt) 6527 if v_0.Op != OpS390XRISBGZ { 6528 break 6529 } 6530 r := auxToS390xRotateParams(v_0.Aux) 6531 if !(r.OutMask() < uint64(uint32(c))) { 6532 break 6533 } 6534 v.reset(OpS390XFlagLT) 6535 return true 6536 } 6537 // match: (CMPUconst (MOVWZreg x) [c]) 6538 // result: (CMPWUconst x [c]) 6539 for { 6540 c := auxIntToInt32(v.AuxInt) 6541 if v_0.Op != OpS390XMOVWZreg { 6542 break 6543 } 6544 x := v_0.Args[0] 6545 v.reset(OpS390XCMPWUconst) 6546 v.AuxInt = int32ToAuxInt(c) 6547 v.AddArg(x) 6548 return true 6549 } 6550 // match: (CMPUconst x:(MOVHreg _) [c]) 6551 // result: (CMPWUconst x [c]) 6552 for { 6553 c := auxIntToInt32(v.AuxInt) 6554 x := v_0 6555 if x.Op != OpS390XMOVHreg { 6556 break 6557 } 6558 v.reset(OpS390XCMPWUconst) 6559 v.AuxInt = int32ToAuxInt(c) 6560 v.AddArg(x) 6561 return true 6562 } 6563 // match: (CMPUconst x:(MOVHZreg _) [c]) 6564 // result: (CMPWUconst x [c]) 6565 for { 6566 c := auxIntToInt32(v.AuxInt) 6567 x := v_0 6568 if x.Op != OpS390XMOVHZreg { 6569 break 6570 } 6571 v.reset(OpS390XCMPWUconst) 6572 v.AuxInt = int32ToAuxInt(c) 6573 v.AddArg(x) 6574 return true 6575 } 6576 // match: (CMPUconst x:(MOVBreg _) [c]) 6577 // result: (CMPWUconst x [c]) 6578 for { 6579 c := auxIntToInt32(v.AuxInt) 6580 x := v_0 6581 if x.Op != OpS390XMOVBreg { 6582 break 6583 } 6584 v.reset(OpS390XCMPWUconst) 6585 v.AuxInt = int32ToAuxInt(c) 6586 v.AddArg(x) 6587 return true 6588 } 6589 // match: (CMPUconst x:(MOVBZreg _) [c]) 6590 // result: (CMPWUconst x [c]) 6591 for { 6592 c := auxIntToInt32(v.AuxInt) 6593 x := v_0 6594 if x.Op != OpS390XMOVBZreg { 6595 break 6596 } 6597 v.reset(OpS390XCMPWUconst) 6598 v.AuxInt = int32ToAuxInt(c) 6599 v.AddArg(x) 6600 return true 6601 } 6602 // match: (CMPUconst (MOVWZreg x:(ANDWconst [m] _)) [c]) 6603 // cond: int32(m) >= 0 6604 // result: (CMPWUconst x [c]) 6605 for { 6606 c := auxIntToInt32(v.AuxInt) 6607 if v_0.Op != OpS390XMOVWZreg { 6608 break 6609 } 6610 x := v_0.Args[0] 6611 if x.Op != OpS390XANDWconst { 6612 break 6613 } 6614 m := auxIntToInt32(x.AuxInt) 6615 if !(int32(m) >= 0) { 6616 break 6617 } 6618 v.reset(OpS390XCMPWUconst) 6619 v.AuxInt = int32ToAuxInt(c) 6620 v.AddArg(x) 6621 return true 6622 } 6623 // match: (CMPUconst (MOVWreg x:(ANDWconst [m] _)) [c]) 6624 // cond: int32(m) >= 0 6625 // result: (CMPWUconst x [c]) 6626 for { 6627 c := auxIntToInt32(v.AuxInt) 6628 if v_0.Op != OpS390XMOVWreg { 6629 break 6630 } 6631 x := v_0.Args[0] 6632 if x.Op != OpS390XANDWconst { 6633 break 6634 } 6635 m := auxIntToInt32(x.AuxInt) 6636 if !(int32(m) >= 0) { 6637 break 6638 } 6639 v.reset(OpS390XCMPWUconst) 6640 v.AuxInt = int32ToAuxInt(c) 6641 v.AddArg(x) 6642 return true 6643 } 6644 return false 6645 } 6646 func rewriteValueS390X_OpS390XCMPW(v *Value) bool { 6647 v_1 := v.Args[1] 6648 v_0 := v.Args[0] 6649 b := v.Block 6650 // match: (CMPW x (MOVDconst [c])) 6651 // result: (CMPWconst x [int32(c)]) 6652 for { 6653 x := v_0 6654 if v_1.Op != OpS390XMOVDconst { 6655 break 6656 } 6657 c := auxIntToInt64(v_1.AuxInt) 6658 v.reset(OpS390XCMPWconst) 6659 v.AuxInt = int32ToAuxInt(int32(c)) 6660 v.AddArg(x) 6661 return true 6662 } 6663 // match: (CMPW (MOVDconst [c]) x) 6664 // result: (InvertFlags (CMPWconst x [int32(c)])) 6665 for { 6666 if v_0.Op != OpS390XMOVDconst { 6667 break 6668 } 6669 c := auxIntToInt64(v_0.AuxInt) 6670 x := v_1 6671 v.reset(OpS390XInvertFlags) 6672 v0 := b.NewValue0(v.Pos, OpS390XCMPWconst, types.TypeFlags) 6673 v0.AuxInt = int32ToAuxInt(int32(c)) 6674 v0.AddArg(x) 6675 v.AddArg(v0) 6676 return true 6677 } 6678 // match: (CMPW x y) 6679 // cond: canonLessThan(x,y) 6680 // result: (InvertFlags (CMPW y x)) 6681 for { 6682 x := v_0 6683 y := v_1 6684 if !(canonLessThan(x, y)) { 6685 break 6686 } 6687 v.reset(OpS390XInvertFlags) 6688 v0 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 6689 v0.AddArg2(y, x) 6690 v.AddArg(v0) 6691 return true 6692 } 6693 // match: (CMPW x (MOVWreg y)) 6694 // result: (CMPW x y) 6695 for { 6696 x := v_0 6697 if v_1.Op != OpS390XMOVWreg { 6698 break 6699 } 6700 y := v_1.Args[0] 6701 v.reset(OpS390XCMPW) 6702 v.AddArg2(x, y) 6703 return true 6704 } 6705 // match: (CMPW x (MOVWZreg y)) 6706 // result: (CMPW x y) 6707 for { 6708 x := v_0 6709 if v_1.Op != OpS390XMOVWZreg { 6710 break 6711 } 6712 y := v_1.Args[0] 6713 v.reset(OpS390XCMPW) 6714 v.AddArg2(x, y) 6715 return true 6716 } 6717 // match: (CMPW (MOVWreg x) y) 6718 // result: (CMPW x y) 6719 for { 6720 if v_0.Op != OpS390XMOVWreg { 6721 break 6722 } 6723 x := v_0.Args[0] 6724 y := v_1 6725 v.reset(OpS390XCMPW) 6726 v.AddArg2(x, y) 6727 return true 6728 } 6729 // match: (CMPW (MOVWZreg x) y) 6730 // result: (CMPW x y) 6731 for { 6732 if v_0.Op != OpS390XMOVWZreg { 6733 break 6734 } 6735 x := v_0.Args[0] 6736 y := v_1 6737 v.reset(OpS390XCMPW) 6738 v.AddArg2(x, y) 6739 return true 6740 } 6741 return false 6742 } 6743 func rewriteValueS390X_OpS390XCMPWU(v *Value) bool { 6744 v_1 := v.Args[1] 6745 v_0 := v.Args[0] 6746 b := v.Block 6747 // match: (CMPWU x (MOVDconst [c])) 6748 // result: (CMPWUconst x [int32(c)]) 6749 for { 6750 x := v_0 6751 if v_1.Op != OpS390XMOVDconst { 6752 break 6753 } 6754 c := auxIntToInt64(v_1.AuxInt) 6755 v.reset(OpS390XCMPWUconst) 6756 v.AuxInt = int32ToAuxInt(int32(c)) 6757 v.AddArg(x) 6758 return true 6759 } 6760 // match: (CMPWU (MOVDconst [c]) x) 6761 // result: (InvertFlags (CMPWUconst x [int32(c)])) 6762 for { 6763 if v_0.Op != OpS390XMOVDconst { 6764 break 6765 } 6766 c := auxIntToInt64(v_0.AuxInt) 6767 x := v_1 6768 v.reset(OpS390XInvertFlags) 6769 v0 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 6770 v0.AuxInt = int32ToAuxInt(int32(c)) 6771 v0.AddArg(x) 6772 v.AddArg(v0) 6773 return true 6774 } 6775 // match: (CMPWU x y) 6776 // cond: canonLessThan(x,y) 6777 // result: (InvertFlags (CMPWU y x)) 6778 for { 6779 x := v_0 6780 y := v_1 6781 if !(canonLessThan(x, y)) { 6782 break 6783 } 6784 v.reset(OpS390XInvertFlags) 6785 v0 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 6786 v0.AddArg2(y, x) 6787 v.AddArg(v0) 6788 return true 6789 } 6790 // match: (CMPWU x (MOVWreg y)) 6791 // result: (CMPWU x y) 6792 for { 6793 x := v_0 6794 if v_1.Op != OpS390XMOVWreg { 6795 break 6796 } 6797 y := v_1.Args[0] 6798 v.reset(OpS390XCMPWU) 6799 v.AddArg2(x, y) 6800 return true 6801 } 6802 // match: (CMPWU x (MOVWZreg y)) 6803 // result: (CMPWU x y) 6804 for { 6805 x := v_0 6806 if v_1.Op != OpS390XMOVWZreg { 6807 break 6808 } 6809 y := v_1.Args[0] 6810 v.reset(OpS390XCMPWU) 6811 v.AddArg2(x, y) 6812 return true 6813 } 6814 // match: (CMPWU (MOVWreg x) y) 6815 // result: (CMPWU x y) 6816 for { 6817 if v_0.Op != OpS390XMOVWreg { 6818 break 6819 } 6820 x := v_0.Args[0] 6821 y := v_1 6822 v.reset(OpS390XCMPWU) 6823 v.AddArg2(x, y) 6824 return true 6825 } 6826 // match: (CMPWU (MOVWZreg x) y) 6827 // result: (CMPWU x y) 6828 for { 6829 if v_0.Op != OpS390XMOVWZreg { 6830 break 6831 } 6832 x := v_0.Args[0] 6833 y := v_1 6834 v.reset(OpS390XCMPWU) 6835 v.AddArg2(x, y) 6836 return true 6837 } 6838 return false 6839 } 6840 func rewriteValueS390X_OpS390XCMPWUconst(v *Value) bool { 6841 v_0 := v.Args[0] 6842 // match: (CMPWUconst (MOVDconst [x]) [y]) 6843 // cond: uint32(x)==uint32(y) 6844 // result: (FlagEQ) 6845 for { 6846 y := auxIntToInt32(v.AuxInt) 6847 if v_0.Op != OpS390XMOVDconst { 6848 break 6849 } 6850 x := auxIntToInt64(v_0.AuxInt) 6851 if !(uint32(x) == uint32(y)) { 6852 break 6853 } 6854 v.reset(OpS390XFlagEQ) 6855 return true 6856 } 6857 // match: (CMPWUconst (MOVDconst [x]) [y]) 6858 // cond: uint32(x)<uint32(y) 6859 // result: (FlagLT) 6860 for { 6861 y := auxIntToInt32(v.AuxInt) 6862 if v_0.Op != OpS390XMOVDconst { 6863 break 6864 } 6865 x := auxIntToInt64(v_0.AuxInt) 6866 if !(uint32(x) < uint32(y)) { 6867 break 6868 } 6869 v.reset(OpS390XFlagLT) 6870 return true 6871 } 6872 // match: (CMPWUconst (MOVDconst [x]) [y]) 6873 // cond: uint32(x)>uint32(y) 6874 // result: (FlagGT) 6875 for { 6876 y := auxIntToInt32(v.AuxInt) 6877 if v_0.Op != OpS390XMOVDconst { 6878 break 6879 } 6880 x := auxIntToInt64(v_0.AuxInt) 6881 if !(uint32(x) > uint32(y)) { 6882 break 6883 } 6884 v.reset(OpS390XFlagGT) 6885 return true 6886 } 6887 // match: (CMPWUconst (MOVBZreg _) [c]) 6888 // cond: 0xff < c 6889 // result: (FlagLT) 6890 for { 6891 c := auxIntToInt32(v.AuxInt) 6892 if v_0.Op != OpS390XMOVBZreg || !(0xff < c) { 6893 break 6894 } 6895 v.reset(OpS390XFlagLT) 6896 return true 6897 } 6898 // match: (CMPWUconst (MOVHZreg _) [c]) 6899 // cond: 0xffff < c 6900 // result: (FlagLT) 6901 for { 6902 c := auxIntToInt32(v.AuxInt) 6903 if v_0.Op != OpS390XMOVHZreg || !(0xffff < c) { 6904 break 6905 } 6906 v.reset(OpS390XFlagLT) 6907 return true 6908 } 6909 // match: (CMPWUconst (SRWconst _ [c]) [n]) 6910 // cond: c > 0 && c < 32 && (1<<uint(32-c)) <= uint32(n) 6911 // result: (FlagLT) 6912 for { 6913 n := auxIntToInt32(v.AuxInt) 6914 if v_0.Op != OpS390XSRWconst { 6915 break 6916 } 6917 c := auxIntToUint8(v_0.AuxInt) 6918 if !(c > 0 && c < 32 && (1<<uint(32-c)) <= uint32(n)) { 6919 break 6920 } 6921 v.reset(OpS390XFlagLT) 6922 return true 6923 } 6924 // match: (CMPWUconst (ANDWconst _ [m]) [n]) 6925 // cond: uint32(m) < uint32(n) 6926 // result: (FlagLT) 6927 for { 6928 n := auxIntToInt32(v.AuxInt) 6929 if v_0.Op != OpS390XANDWconst { 6930 break 6931 } 6932 m := auxIntToInt32(v_0.AuxInt) 6933 if !(uint32(m) < uint32(n)) { 6934 break 6935 } 6936 v.reset(OpS390XFlagLT) 6937 return true 6938 } 6939 // match: (CMPWUconst (MOVWreg x) [c]) 6940 // result: (CMPWUconst x [c]) 6941 for { 6942 c := auxIntToInt32(v.AuxInt) 6943 if v_0.Op != OpS390XMOVWreg { 6944 break 6945 } 6946 x := v_0.Args[0] 6947 v.reset(OpS390XCMPWUconst) 6948 v.AuxInt = int32ToAuxInt(c) 6949 v.AddArg(x) 6950 return true 6951 } 6952 // match: (CMPWUconst (MOVWZreg x) [c]) 6953 // result: (CMPWUconst x [c]) 6954 for { 6955 c := auxIntToInt32(v.AuxInt) 6956 if v_0.Op != OpS390XMOVWZreg { 6957 break 6958 } 6959 x := v_0.Args[0] 6960 v.reset(OpS390XCMPWUconst) 6961 v.AuxInt = int32ToAuxInt(c) 6962 v.AddArg(x) 6963 return true 6964 } 6965 return false 6966 } 6967 func rewriteValueS390X_OpS390XCMPWconst(v *Value) bool { 6968 v_0 := v.Args[0] 6969 // match: (CMPWconst (MOVDconst [x]) [y]) 6970 // cond: int32(x)==int32(y) 6971 // result: (FlagEQ) 6972 for { 6973 y := auxIntToInt32(v.AuxInt) 6974 if v_0.Op != OpS390XMOVDconst { 6975 break 6976 } 6977 x := auxIntToInt64(v_0.AuxInt) 6978 if !(int32(x) == int32(y)) { 6979 break 6980 } 6981 v.reset(OpS390XFlagEQ) 6982 return true 6983 } 6984 // match: (CMPWconst (MOVDconst [x]) [y]) 6985 // cond: int32(x)<int32(y) 6986 // result: (FlagLT) 6987 for { 6988 y := auxIntToInt32(v.AuxInt) 6989 if v_0.Op != OpS390XMOVDconst { 6990 break 6991 } 6992 x := auxIntToInt64(v_0.AuxInt) 6993 if !(int32(x) < int32(y)) { 6994 break 6995 } 6996 v.reset(OpS390XFlagLT) 6997 return true 6998 } 6999 // match: (CMPWconst (MOVDconst [x]) [y]) 7000 // cond: int32(x)>int32(y) 7001 // result: (FlagGT) 7002 for { 7003 y := auxIntToInt32(v.AuxInt) 7004 if v_0.Op != OpS390XMOVDconst { 7005 break 7006 } 7007 x := auxIntToInt64(v_0.AuxInt) 7008 if !(int32(x) > int32(y)) { 7009 break 7010 } 7011 v.reset(OpS390XFlagGT) 7012 return true 7013 } 7014 // match: (CMPWconst (MOVBZreg _) [c]) 7015 // cond: 0xff < c 7016 // result: (FlagLT) 7017 for { 7018 c := auxIntToInt32(v.AuxInt) 7019 if v_0.Op != OpS390XMOVBZreg || !(0xff < c) { 7020 break 7021 } 7022 v.reset(OpS390XFlagLT) 7023 return true 7024 } 7025 // match: (CMPWconst (MOVHZreg _) [c]) 7026 // cond: 0xffff < c 7027 // result: (FlagLT) 7028 for { 7029 c := auxIntToInt32(v.AuxInt) 7030 if v_0.Op != OpS390XMOVHZreg || !(0xffff < c) { 7031 break 7032 } 7033 v.reset(OpS390XFlagLT) 7034 return true 7035 } 7036 // match: (CMPWconst (SRWconst _ [c]) [n]) 7037 // cond: c > 0 && n < 0 7038 // result: (FlagGT) 7039 for { 7040 n := auxIntToInt32(v.AuxInt) 7041 if v_0.Op != OpS390XSRWconst { 7042 break 7043 } 7044 c := auxIntToUint8(v_0.AuxInt) 7045 if !(c > 0 && n < 0) { 7046 break 7047 } 7048 v.reset(OpS390XFlagGT) 7049 return true 7050 } 7051 // match: (CMPWconst (ANDWconst _ [m]) [n]) 7052 // cond: int32(m) >= 0 && int32(m) < int32(n) 7053 // result: (FlagLT) 7054 for { 7055 n := auxIntToInt32(v.AuxInt) 7056 if v_0.Op != OpS390XANDWconst { 7057 break 7058 } 7059 m := auxIntToInt32(v_0.AuxInt) 7060 if !(int32(m) >= 0 && int32(m) < int32(n)) { 7061 break 7062 } 7063 v.reset(OpS390XFlagLT) 7064 return true 7065 } 7066 // match: (CMPWconst x:(SRWconst _ [c]) [n]) 7067 // cond: c > 0 && n >= 0 7068 // result: (CMPWUconst x [n]) 7069 for { 7070 n := auxIntToInt32(v.AuxInt) 7071 x := v_0 7072 if x.Op != OpS390XSRWconst { 7073 break 7074 } 7075 c := auxIntToUint8(x.AuxInt) 7076 if !(c > 0 && n >= 0) { 7077 break 7078 } 7079 v.reset(OpS390XCMPWUconst) 7080 v.AuxInt = int32ToAuxInt(n) 7081 v.AddArg(x) 7082 return true 7083 } 7084 // match: (CMPWconst (MOVWreg x) [c]) 7085 // result: (CMPWconst x [c]) 7086 for { 7087 c := auxIntToInt32(v.AuxInt) 7088 if v_0.Op != OpS390XMOVWreg { 7089 break 7090 } 7091 x := v_0.Args[0] 7092 v.reset(OpS390XCMPWconst) 7093 v.AuxInt = int32ToAuxInt(c) 7094 v.AddArg(x) 7095 return true 7096 } 7097 // match: (CMPWconst (MOVWZreg x) [c]) 7098 // result: (CMPWconst x [c]) 7099 for { 7100 c := auxIntToInt32(v.AuxInt) 7101 if v_0.Op != OpS390XMOVWZreg { 7102 break 7103 } 7104 x := v_0.Args[0] 7105 v.reset(OpS390XCMPWconst) 7106 v.AuxInt = int32ToAuxInt(c) 7107 v.AddArg(x) 7108 return true 7109 } 7110 return false 7111 } 7112 func rewriteValueS390X_OpS390XCMPconst(v *Value) bool { 7113 v_0 := v.Args[0] 7114 // match: (CMPconst (MOVDconst [x]) [y]) 7115 // cond: x==int64(y) 7116 // result: (FlagEQ) 7117 for { 7118 y := auxIntToInt32(v.AuxInt) 7119 if v_0.Op != OpS390XMOVDconst { 7120 break 7121 } 7122 x := auxIntToInt64(v_0.AuxInt) 7123 if !(x == int64(y)) { 7124 break 7125 } 7126 v.reset(OpS390XFlagEQ) 7127 return true 7128 } 7129 // match: (CMPconst (MOVDconst [x]) [y]) 7130 // cond: x<int64(y) 7131 // result: (FlagLT) 7132 for { 7133 y := auxIntToInt32(v.AuxInt) 7134 if v_0.Op != OpS390XMOVDconst { 7135 break 7136 } 7137 x := auxIntToInt64(v_0.AuxInt) 7138 if !(x < int64(y)) { 7139 break 7140 } 7141 v.reset(OpS390XFlagLT) 7142 return true 7143 } 7144 // match: (CMPconst (MOVDconst [x]) [y]) 7145 // cond: x>int64(y) 7146 // result: (FlagGT) 7147 for { 7148 y := auxIntToInt32(v.AuxInt) 7149 if v_0.Op != OpS390XMOVDconst { 7150 break 7151 } 7152 x := auxIntToInt64(v_0.AuxInt) 7153 if !(x > int64(y)) { 7154 break 7155 } 7156 v.reset(OpS390XFlagGT) 7157 return true 7158 } 7159 // match: (CMPconst (SRDconst _ [c]) [n]) 7160 // cond: c > 0 && n < 0 7161 // result: (FlagGT) 7162 for { 7163 n := auxIntToInt32(v.AuxInt) 7164 if v_0.Op != OpS390XSRDconst { 7165 break 7166 } 7167 c := auxIntToUint8(v_0.AuxInt) 7168 if !(c > 0 && n < 0) { 7169 break 7170 } 7171 v.reset(OpS390XFlagGT) 7172 return true 7173 } 7174 // match: (CMPconst (RISBGZ x {r}) [c]) 7175 // cond: c > 0 && r.OutMask() < uint64(c) 7176 // result: (FlagLT) 7177 for { 7178 c := auxIntToInt32(v.AuxInt) 7179 if v_0.Op != OpS390XRISBGZ { 7180 break 7181 } 7182 r := auxToS390xRotateParams(v_0.Aux) 7183 if !(c > 0 && r.OutMask() < uint64(c)) { 7184 break 7185 } 7186 v.reset(OpS390XFlagLT) 7187 return true 7188 } 7189 // match: (CMPconst (MOVWreg x) [c]) 7190 // result: (CMPWconst x [c]) 7191 for { 7192 c := auxIntToInt32(v.AuxInt) 7193 if v_0.Op != OpS390XMOVWreg { 7194 break 7195 } 7196 x := v_0.Args[0] 7197 v.reset(OpS390XCMPWconst) 7198 v.AuxInt = int32ToAuxInt(c) 7199 v.AddArg(x) 7200 return true 7201 } 7202 // match: (CMPconst x:(MOVHreg _) [c]) 7203 // result: (CMPWconst x [c]) 7204 for { 7205 c := auxIntToInt32(v.AuxInt) 7206 x := v_0 7207 if x.Op != OpS390XMOVHreg { 7208 break 7209 } 7210 v.reset(OpS390XCMPWconst) 7211 v.AuxInt = int32ToAuxInt(c) 7212 v.AddArg(x) 7213 return true 7214 } 7215 // match: (CMPconst x:(MOVHZreg _) [c]) 7216 // result: (CMPWconst x [c]) 7217 for { 7218 c := auxIntToInt32(v.AuxInt) 7219 x := v_0 7220 if x.Op != OpS390XMOVHZreg { 7221 break 7222 } 7223 v.reset(OpS390XCMPWconst) 7224 v.AuxInt = int32ToAuxInt(c) 7225 v.AddArg(x) 7226 return true 7227 } 7228 // match: (CMPconst x:(MOVBreg _) [c]) 7229 // result: (CMPWconst x [c]) 7230 for { 7231 c := auxIntToInt32(v.AuxInt) 7232 x := v_0 7233 if x.Op != OpS390XMOVBreg { 7234 break 7235 } 7236 v.reset(OpS390XCMPWconst) 7237 v.AuxInt = int32ToAuxInt(c) 7238 v.AddArg(x) 7239 return true 7240 } 7241 // match: (CMPconst x:(MOVBZreg _) [c]) 7242 // result: (CMPWconst x [c]) 7243 for { 7244 c := auxIntToInt32(v.AuxInt) 7245 x := v_0 7246 if x.Op != OpS390XMOVBZreg { 7247 break 7248 } 7249 v.reset(OpS390XCMPWconst) 7250 v.AuxInt = int32ToAuxInt(c) 7251 v.AddArg(x) 7252 return true 7253 } 7254 // match: (CMPconst (MOVWZreg x:(ANDWconst [m] _)) [c]) 7255 // cond: int32(m) >= 0 && c >= 0 7256 // result: (CMPWUconst x [c]) 7257 for { 7258 c := auxIntToInt32(v.AuxInt) 7259 if v_0.Op != OpS390XMOVWZreg { 7260 break 7261 } 7262 x := v_0.Args[0] 7263 if x.Op != OpS390XANDWconst { 7264 break 7265 } 7266 m := auxIntToInt32(x.AuxInt) 7267 if !(int32(m) >= 0 && c >= 0) { 7268 break 7269 } 7270 v.reset(OpS390XCMPWUconst) 7271 v.AuxInt = int32ToAuxInt(c) 7272 v.AddArg(x) 7273 return true 7274 } 7275 // match: (CMPconst (MOVWreg x:(ANDWconst [m] _)) [c]) 7276 // cond: int32(m) >= 0 && c >= 0 7277 // result: (CMPWUconst x [c]) 7278 for { 7279 c := auxIntToInt32(v.AuxInt) 7280 if v_0.Op != OpS390XMOVWreg { 7281 break 7282 } 7283 x := v_0.Args[0] 7284 if x.Op != OpS390XANDWconst { 7285 break 7286 } 7287 m := auxIntToInt32(x.AuxInt) 7288 if !(int32(m) >= 0 && c >= 0) { 7289 break 7290 } 7291 v.reset(OpS390XCMPWUconst) 7292 v.AuxInt = int32ToAuxInt(c) 7293 v.AddArg(x) 7294 return true 7295 } 7296 // match: (CMPconst x:(SRDconst _ [c]) [n]) 7297 // cond: c > 0 && n >= 0 7298 // result: (CMPUconst x [n]) 7299 for { 7300 n := auxIntToInt32(v.AuxInt) 7301 x := v_0 7302 if x.Op != OpS390XSRDconst { 7303 break 7304 } 7305 c := auxIntToUint8(x.AuxInt) 7306 if !(c > 0 && n >= 0) { 7307 break 7308 } 7309 v.reset(OpS390XCMPUconst) 7310 v.AuxInt = int32ToAuxInt(n) 7311 v.AddArg(x) 7312 return true 7313 } 7314 return false 7315 } 7316 func rewriteValueS390X_OpS390XCPSDR(v *Value) bool { 7317 v_1 := v.Args[1] 7318 v_0 := v.Args[0] 7319 // match: (CPSDR y (FMOVDconst [c])) 7320 // cond: !math.Signbit(c) 7321 // result: (LPDFR y) 7322 for { 7323 y := v_0 7324 if v_1.Op != OpS390XFMOVDconst { 7325 break 7326 } 7327 c := auxIntToFloat64(v_1.AuxInt) 7328 if !(!math.Signbit(c)) { 7329 break 7330 } 7331 v.reset(OpS390XLPDFR) 7332 v.AddArg(y) 7333 return true 7334 } 7335 // match: (CPSDR y (FMOVDconst [c])) 7336 // cond: math.Signbit(c) 7337 // result: (LNDFR y) 7338 for { 7339 y := v_0 7340 if v_1.Op != OpS390XFMOVDconst { 7341 break 7342 } 7343 c := auxIntToFloat64(v_1.AuxInt) 7344 if !(math.Signbit(c)) { 7345 break 7346 } 7347 v.reset(OpS390XLNDFR) 7348 v.AddArg(y) 7349 return true 7350 } 7351 return false 7352 } 7353 func rewriteValueS390X_OpS390XFCMP(v *Value) bool { 7354 v_1 := v.Args[1] 7355 v_0 := v.Args[0] 7356 b := v.Block 7357 // match: (FCMP x (FMOVDconst [0.0])) 7358 // result: (LTDBR x) 7359 for { 7360 x := v_0 7361 if v_1.Op != OpS390XFMOVDconst || auxIntToFloat64(v_1.AuxInt) != 0.0 { 7362 break 7363 } 7364 v.reset(OpS390XLTDBR) 7365 v.AddArg(x) 7366 return true 7367 } 7368 // match: (FCMP (FMOVDconst [0.0]) x) 7369 // result: (InvertFlags (LTDBR <v.Type> x)) 7370 for { 7371 if v_0.Op != OpS390XFMOVDconst || auxIntToFloat64(v_0.AuxInt) != 0.0 { 7372 break 7373 } 7374 x := v_1 7375 v.reset(OpS390XInvertFlags) 7376 v0 := b.NewValue0(v.Pos, OpS390XLTDBR, v.Type) 7377 v0.AddArg(x) 7378 v.AddArg(v0) 7379 return true 7380 } 7381 return false 7382 } 7383 func rewriteValueS390X_OpS390XFCMPS(v *Value) bool { 7384 v_1 := v.Args[1] 7385 v_0 := v.Args[0] 7386 b := v.Block 7387 // match: (FCMPS x (FMOVSconst [0.0])) 7388 // result: (LTEBR x) 7389 for { 7390 x := v_0 7391 if v_1.Op != OpS390XFMOVSconst || auxIntToFloat32(v_1.AuxInt) != 0.0 { 7392 break 7393 } 7394 v.reset(OpS390XLTEBR) 7395 v.AddArg(x) 7396 return true 7397 } 7398 // match: (FCMPS (FMOVSconst [0.0]) x) 7399 // result: (InvertFlags (LTEBR <v.Type> x)) 7400 for { 7401 if v_0.Op != OpS390XFMOVSconst || auxIntToFloat32(v_0.AuxInt) != 0.0 { 7402 break 7403 } 7404 x := v_1 7405 v.reset(OpS390XInvertFlags) 7406 v0 := b.NewValue0(v.Pos, OpS390XLTEBR, v.Type) 7407 v0.AddArg(x) 7408 v.AddArg(v0) 7409 return true 7410 } 7411 return false 7412 } 7413 func rewriteValueS390X_OpS390XFMOVDload(v *Value) bool { 7414 v_1 := v.Args[1] 7415 v_0 := v.Args[0] 7416 // match: (FMOVDload [off] {sym} ptr1 (MOVDstore [off] {sym} ptr2 x _)) 7417 // cond: isSamePtr(ptr1, ptr2) 7418 // result: (LDGR x) 7419 for { 7420 off := auxIntToInt32(v.AuxInt) 7421 sym := auxToSym(v.Aux) 7422 ptr1 := v_0 7423 if v_1.Op != OpS390XMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 7424 break 7425 } 7426 x := v_1.Args[1] 7427 ptr2 := v_1.Args[0] 7428 if !(isSamePtr(ptr1, ptr2)) { 7429 break 7430 } 7431 v.reset(OpS390XLDGR) 7432 v.AddArg(x) 7433 return true 7434 } 7435 // match: (FMOVDload [off] {sym} ptr1 (FMOVDstore [off] {sym} ptr2 x _)) 7436 // cond: isSamePtr(ptr1, ptr2) 7437 // result: x 7438 for { 7439 off := auxIntToInt32(v.AuxInt) 7440 sym := auxToSym(v.Aux) 7441 ptr1 := v_0 7442 if v_1.Op != OpS390XFMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 7443 break 7444 } 7445 x := v_1.Args[1] 7446 ptr2 := v_1.Args[0] 7447 if !(isSamePtr(ptr1, ptr2)) { 7448 break 7449 } 7450 v.copyOf(x) 7451 return true 7452 } 7453 // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem) 7454 // cond: is20Bit(int64(off1)+int64(off2)) 7455 // result: (FMOVDload [off1+off2] {sym} ptr mem) 7456 for { 7457 off1 := auxIntToInt32(v.AuxInt) 7458 sym := auxToSym(v.Aux) 7459 if v_0.Op != OpS390XADDconst { 7460 break 7461 } 7462 off2 := auxIntToInt32(v_0.AuxInt) 7463 ptr := v_0.Args[0] 7464 mem := v_1 7465 if !(is20Bit(int64(off1) + int64(off2))) { 7466 break 7467 } 7468 v.reset(OpS390XFMOVDload) 7469 v.AuxInt = int32ToAuxInt(off1 + off2) 7470 v.Aux = symToAux(sym) 7471 v.AddArg2(ptr, mem) 7472 return true 7473 } 7474 // match: (FMOVDload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) 7475 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 7476 // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem) 7477 for { 7478 off1 := auxIntToInt32(v.AuxInt) 7479 sym1 := auxToSym(v.Aux) 7480 if v_0.Op != OpS390XMOVDaddr { 7481 break 7482 } 7483 off2 := auxIntToInt32(v_0.AuxInt) 7484 sym2 := auxToSym(v_0.Aux) 7485 base := v_0.Args[0] 7486 mem := v_1 7487 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 7488 break 7489 } 7490 v.reset(OpS390XFMOVDload) 7491 v.AuxInt = int32ToAuxInt(off1 + off2) 7492 v.Aux = symToAux(mergeSym(sym1, sym2)) 7493 v.AddArg2(base, mem) 7494 return true 7495 } 7496 return false 7497 } 7498 func rewriteValueS390X_OpS390XFMOVDstore(v *Value) bool { 7499 v_2 := v.Args[2] 7500 v_1 := v.Args[1] 7501 v_0 := v.Args[0] 7502 // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem) 7503 // cond: is20Bit(int64(off1)+int64(off2)) 7504 // result: (FMOVDstore [off1+off2] {sym} ptr val mem) 7505 for { 7506 off1 := auxIntToInt32(v.AuxInt) 7507 sym := auxToSym(v.Aux) 7508 if v_0.Op != OpS390XADDconst { 7509 break 7510 } 7511 off2 := auxIntToInt32(v_0.AuxInt) 7512 ptr := v_0.Args[0] 7513 val := v_1 7514 mem := v_2 7515 if !(is20Bit(int64(off1) + int64(off2))) { 7516 break 7517 } 7518 v.reset(OpS390XFMOVDstore) 7519 v.AuxInt = int32ToAuxInt(off1 + off2) 7520 v.Aux = symToAux(sym) 7521 v.AddArg3(ptr, val, mem) 7522 return true 7523 } 7524 // match: (FMOVDstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem) 7525 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 7526 // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 7527 for { 7528 off1 := auxIntToInt32(v.AuxInt) 7529 sym1 := auxToSym(v.Aux) 7530 if v_0.Op != OpS390XMOVDaddr { 7531 break 7532 } 7533 off2 := auxIntToInt32(v_0.AuxInt) 7534 sym2 := auxToSym(v_0.Aux) 7535 base := v_0.Args[0] 7536 val := v_1 7537 mem := v_2 7538 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 7539 break 7540 } 7541 v.reset(OpS390XFMOVDstore) 7542 v.AuxInt = int32ToAuxInt(off1 + off2) 7543 v.Aux = symToAux(mergeSym(sym1, sym2)) 7544 v.AddArg3(base, val, mem) 7545 return true 7546 } 7547 return false 7548 } 7549 func rewriteValueS390X_OpS390XFMOVSload(v *Value) bool { 7550 v_1 := v.Args[1] 7551 v_0 := v.Args[0] 7552 // match: (FMOVSload [off] {sym} ptr1 (FMOVSstore [off] {sym} ptr2 x _)) 7553 // cond: isSamePtr(ptr1, ptr2) 7554 // result: x 7555 for { 7556 off := auxIntToInt32(v.AuxInt) 7557 sym := auxToSym(v.Aux) 7558 ptr1 := v_0 7559 if v_1.Op != OpS390XFMOVSstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 7560 break 7561 } 7562 x := v_1.Args[1] 7563 ptr2 := v_1.Args[0] 7564 if !(isSamePtr(ptr1, ptr2)) { 7565 break 7566 } 7567 v.copyOf(x) 7568 return true 7569 } 7570 // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem) 7571 // cond: is20Bit(int64(off1)+int64(off2)) 7572 // result: (FMOVSload [off1+off2] {sym} ptr mem) 7573 for { 7574 off1 := auxIntToInt32(v.AuxInt) 7575 sym := auxToSym(v.Aux) 7576 if v_0.Op != OpS390XADDconst { 7577 break 7578 } 7579 off2 := auxIntToInt32(v_0.AuxInt) 7580 ptr := v_0.Args[0] 7581 mem := v_1 7582 if !(is20Bit(int64(off1) + int64(off2))) { 7583 break 7584 } 7585 v.reset(OpS390XFMOVSload) 7586 v.AuxInt = int32ToAuxInt(off1 + off2) 7587 v.Aux = symToAux(sym) 7588 v.AddArg2(ptr, mem) 7589 return true 7590 } 7591 // match: (FMOVSload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) 7592 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 7593 // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} base mem) 7594 for { 7595 off1 := auxIntToInt32(v.AuxInt) 7596 sym1 := auxToSym(v.Aux) 7597 if v_0.Op != OpS390XMOVDaddr { 7598 break 7599 } 7600 off2 := auxIntToInt32(v_0.AuxInt) 7601 sym2 := auxToSym(v_0.Aux) 7602 base := v_0.Args[0] 7603 mem := v_1 7604 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 7605 break 7606 } 7607 v.reset(OpS390XFMOVSload) 7608 v.AuxInt = int32ToAuxInt(off1 + off2) 7609 v.Aux = symToAux(mergeSym(sym1, sym2)) 7610 v.AddArg2(base, mem) 7611 return true 7612 } 7613 return false 7614 } 7615 func rewriteValueS390X_OpS390XFMOVSstore(v *Value) bool { 7616 v_2 := v.Args[2] 7617 v_1 := v.Args[1] 7618 v_0 := v.Args[0] 7619 // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem) 7620 // cond: is20Bit(int64(off1)+int64(off2)) 7621 // result: (FMOVSstore [off1+off2] {sym} ptr val mem) 7622 for { 7623 off1 := auxIntToInt32(v.AuxInt) 7624 sym := auxToSym(v.Aux) 7625 if v_0.Op != OpS390XADDconst { 7626 break 7627 } 7628 off2 := auxIntToInt32(v_0.AuxInt) 7629 ptr := v_0.Args[0] 7630 val := v_1 7631 mem := v_2 7632 if !(is20Bit(int64(off1) + int64(off2))) { 7633 break 7634 } 7635 v.reset(OpS390XFMOVSstore) 7636 v.AuxInt = int32ToAuxInt(off1 + off2) 7637 v.Aux = symToAux(sym) 7638 v.AddArg3(ptr, val, mem) 7639 return true 7640 } 7641 // match: (FMOVSstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem) 7642 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 7643 // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 7644 for { 7645 off1 := auxIntToInt32(v.AuxInt) 7646 sym1 := auxToSym(v.Aux) 7647 if v_0.Op != OpS390XMOVDaddr { 7648 break 7649 } 7650 off2 := auxIntToInt32(v_0.AuxInt) 7651 sym2 := auxToSym(v_0.Aux) 7652 base := v_0.Args[0] 7653 val := v_1 7654 mem := v_2 7655 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 7656 break 7657 } 7658 v.reset(OpS390XFMOVSstore) 7659 v.AuxInt = int32ToAuxInt(off1 + off2) 7660 v.Aux = symToAux(mergeSym(sym1, sym2)) 7661 v.AddArg3(base, val, mem) 7662 return true 7663 } 7664 return false 7665 } 7666 func rewriteValueS390X_OpS390XFNEG(v *Value) bool { 7667 v_0 := v.Args[0] 7668 // match: (FNEG (LPDFR x)) 7669 // result: (LNDFR x) 7670 for { 7671 if v_0.Op != OpS390XLPDFR { 7672 break 7673 } 7674 x := v_0.Args[0] 7675 v.reset(OpS390XLNDFR) 7676 v.AddArg(x) 7677 return true 7678 } 7679 // match: (FNEG (LNDFR x)) 7680 // result: (LPDFR x) 7681 for { 7682 if v_0.Op != OpS390XLNDFR { 7683 break 7684 } 7685 x := v_0.Args[0] 7686 v.reset(OpS390XLPDFR) 7687 v.AddArg(x) 7688 return true 7689 } 7690 return false 7691 } 7692 func rewriteValueS390X_OpS390XFNEGS(v *Value) bool { 7693 v_0 := v.Args[0] 7694 // match: (FNEGS (LPDFR x)) 7695 // result: (LNDFR x) 7696 for { 7697 if v_0.Op != OpS390XLPDFR { 7698 break 7699 } 7700 x := v_0.Args[0] 7701 v.reset(OpS390XLNDFR) 7702 v.AddArg(x) 7703 return true 7704 } 7705 // match: (FNEGS (LNDFR x)) 7706 // result: (LPDFR x) 7707 for { 7708 if v_0.Op != OpS390XLNDFR { 7709 break 7710 } 7711 x := v_0.Args[0] 7712 v.reset(OpS390XLPDFR) 7713 v.AddArg(x) 7714 return true 7715 } 7716 return false 7717 } 7718 func rewriteValueS390X_OpS390XLDGR(v *Value) bool { 7719 v_0 := v.Args[0] 7720 b := v.Block 7721 // match: (LDGR <t> (RISBGZ x {r})) 7722 // cond: r == s390x.NewRotateParams(1, 63, 0) 7723 // result: (LPDFR (LDGR <t> x)) 7724 for { 7725 t := v.Type 7726 if v_0.Op != OpS390XRISBGZ { 7727 break 7728 } 7729 r := auxToS390xRotateParams(v_0.Aux) 7730 x := v_0.Args[0] 7731 if !(r == s390x.NewRotateParams(1, 63, 0)) { 7732 break 7733 } 7734 v.reset(OpS390XLPDFR) 7735 v0 := b.NewValue0(v.Pos, OpS390XLDGR, t) 7736 v0.AddArg(x) 7737 v.AddArg(v0) 7738 return true 7739 } 7740 // match: (LDGR <t> (OR (MOVDconst [-1<<63]) x)) 7741 // result: (LNDFR (LDGR <t> x)) 7742 for { 7743 t := v.Type 7744 if v_0.Op != OpS390XOR { 7745 break 7746 } 7747 _ = v_0.Args[1] 7748 v_0_0 := v_0.Args[0] 7749 v_0_1 := v_0.Args[1] 7750 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 7751 if v_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0.AuxInt) != -1<<63 { 7752 continue 7753 } 7754 x := v_0_1 7755 v.reset(OpS390XLNDFR) 7756 v0 := b.NewValue0(v.Pos, OpS390XLDGR, t) 7757 v0.AddArg(x) 7758 v.AddArg(v0) 7759 return true 7760 } 7761 break 7762 } 7763 // match: (LDGR <t> x:(ORload <t1> [off] {sym} (MOVDconst [-1<<63]) ptr mem)) 7764 // cond: x.Uses == 1 && clobber(x) 7765 // result: @x.Block (LNDFR <t> (LDGR <t> (MOVDload <t1> [off] {sym} ptr mem))) 7766 for { 7767 t := v.Type 7768 x := v_0 7769 if x.Op != OpS390XORload { 7770 break 7771 } 7772 t1 := x.Type 7773 off := auxIntToInt32(x.AuxInt) 7774 sym := auxToSym(x.Aux) 7775 mem := x.Args[2] 7776 x_0 := x.Args[0] 7777 if x_0.Op != OpS390XMOVDconst || auxIntToInt64(x_0.AuxInt) != -1<<63 { 7778 break 7779 } 7780 ptr := x.Args[1] 7781 if !(x.Uses == 1 && clobber(x)) { 7782 break 7783 } 7784 b = x.Block 7785 v0 := b.NewValue0(x.Pos, OpS390XLNDFR, t) 7786 v.copyOf(v0) 7787 v1 := b.NewValue0(x.Pos, OpS390XLDGR, t) 7788 v2 := b.NewValue0(x.Pos, OpS390XMOVDload, t1) 7789 v2.AuxInt = int32ToAuxInt(off) 7790 v2.Aux = symToAux(sym) 7791 v2.AddArg2(ptr, mem) 7792 v1.AddArg(v2) 7793 v0.AddArg(v1) 7794 return true 7795 } 7796 // match: (LDGR (LGDR x)) 7797 // result: x 7798 for { 7799 if v_0.Op != OpS390XLGDR { 7800 break 7801 } 7802 x := v_0.Args[0] 7803 v.copyOf(x) 7804 return true 7805 } 7806 return false 7807 } 7808 func rewriteValueS390X_OpS390XLEDBR(v *Value) bool { 7809 v_0 := v.Args[0] 7810 // match: (LEDBR (LPDFR (LDEBR x))) 7811 // result: (LPDFR x) 7812 for { 7813 if v_0.Op != OpS390XLPDFR { 7814 break 7815 } 7816 v_0_0 := v_0.Args[0] 7817 if v_0_0.Op != OpS390XLDEBR { 7818 break 7819 } 7820 x := v_0_0.Args[0] 7821 v.reset(OpS390XLPDFR) 7822 v.AddArg(x) 7823 return true 7824 } 7825 // match: (LEDBR (LNDFR (LDEBR x))) 7826 // result: (LNDFR x) 7827 for { 7828 if v_0.Op != OpS390XLNDFR { 7829 break 7830 } 7831 v_0_0 := v_0.Args[0] 7832 if v_0_0.Op != OpS390XLDEBR { 7833 break 7834 } 7835 x := v_0_0.Args[0] 7836 v.reset(OpS390XLNDFR) 7837 v.AddArg(x) 7838 return true 7839 } 7840 return false 7841 } 7842 func rewriteValueS390X_OpS390XLGDR(v *Value) bool { 7843 v_0 := v.Args[0] 7844 // match: (LGDR (LDGR x)) 7845 // result: x 7846 for { 7847 if v_0.Op != OpS390XLDGR { 7848 break 7849 } 7850 x := v_0.Args[0] 7851 v.copyOf(x) 7852 return true 7853 } 7854 return false 7855 } 7856 func rewriteValueS390X_OpS390XLOCGR(v *Value) bool { 7857 v_2 := v.Args[2] 7858 v_1 := v.Args[1] 7859 v_0 := v.Args[0] 7860 // match: (LOCGR {c} x y (InvertFlags cmp)) 7861 // result: (LOCGR {c.ReverseComparison()} x y cmp) 7862 for { 7863 c := auxToS390xCCMask(v.Aux) 7864 x := v_0 7865 y := v_1 7866 if v_2.Op != OpS390XInvertFlags { 7867 break 7868 } 7869 cmp := v_2.Args[0] 7870 v.reset(OpS390XLOCGR) 7871 v.Aux = s390xCCMaskToAux(c.ReverseComparison()) 7872 v.AddArg3(x, y, cmp) 7873 return true 7874 } 7875 // match: (LOCGR {c} _ x (FlagEQ)) 7876 // cond: c&s390x.Equal != 0 7877 // result: x 7878 for { 7879 c := auxToS390xCCMask(v.Aux) 7880 x := v_1 7881 if v_2.Op != OpS390XFlagEQ || !(c&s390x.Equal != 0) { 7882 break 7883 } 7884 v.copyOf(x) 7885 return true 7886 } 7887 // match: (LOCGR {c} _ x (FlagLT)) 7888 // cond: c&s390x.Less != 0 7889 // result: x 7890 for { 7891 c := auxToS390xCCMask(v.Aux) 7892 x := v_1 7893 if v_2.Op != OpS390XFlagLT || !(c&s390x.Less != 0) { 7894 break 7895 } 7896 v.copyOf(x) 7897 return true 7898 } 7899 // match: (LOCGR {c} _ x (FlagGT)) 7900 // cond: c&s390x.Greater != 0 7901 // result: x 7902 for { 7903 c := auxToS390xCCMask(v.Aux) 7904 x := v_1 7905 if v_2.Op != OpS390XFlagGT || !(c&s390x.Greater != 0) { 7906 break 7907 } 7908 v.copyOf(x) 7909 return true 7910 } 7911 // match: (LOCGR {c} _ x (FlagOV)) 7912 // cond: c&s390x.Unordered != 0 7913 // result: x 7914 for { 7915 c := auxToS390xCCMask(v.Aux) 7916 x := v_1 7917 if v_2.Op != OpS390XFlagOV || !(c&s390x.Unordered != 0) { 7918 break 7919 } 7920 v.copyOf(x) 7921 return true 7922 } 7923 // match: (LOCGR {c} x _ (FlagEQ)) 7924 // cond: c&s390x.Equal == 0 7925 // result: x 7926 for { 7927 c := auxToS390xCCMask(v.Aux) 7928 x := v_0 7929 if v_2.Op != OpS390XFlagEQ || !(c&s390x.Equal == 0) { 7930 break 7931 } 7932 v.copyOf(x) 7933 return true 7934 } 7935 // match: (LOCGR {c} x _ (FlagLT)) 7936 // cond: c&s390x.Less == 0 7937 // result: x 7938 for { 7939 c := auxToS390xCCMask(v.Aux) 7940 x := v_0 7941 if v_2.Op != OpS390XFlagLT || !(c&s390x.Less == 0) { 7942 break 7943 } 7944 v.copyOf(x) 7945 return true 7946 } 7947 // match: (LOCGR {c} x _ (FlagGT)) 7948 // cond: c&s390x.Greater == 0 7949 // result: x 7950 for { 7951 c := auxToS390xCCMask(v.Aux) 7952 x := v_0 7953 if v_2.Op != OpS390XFlagGT || !(c&s390x.Greater == 0) { 7954 break 7955 } 7956 v.copyOf(x) 7957 return true 7958 } 7959 // match: (LOCGR {c} x _ (FlagOV)) 7960 // cond: c&s390x.Unordered == 0 7961 // result: x 7962 for { 7963 c := auxToS390xCCMask(v.Aux) 7964 x := v_0 7965 if v_2.Op != OpS390XFlagOV || !(c&s390x.Unordered == 0) { 7966 break 7967 } 7968 v.copyOf(x) 7969 return true 7970 } 7971 return false 7972 } 7973 func rewriteValueS390X_OpS390XLTDBR(v *Value) bool { 7974 v_0 := v.Args[0] 7975 b := v.Block 7976 // match: (LTDBR (Select0 x:(FADD _ _))) 7977 // cond: b == x.Block 7978 // result: (Select1 x) 7979 for { 7980 if v_0.Op != OpSelect0 { 7981 break 7982 } 7983 x := v_0.Args[0] 7984 if x.Op != OpS390XFADD || !(b == x.Block) { 7985 break 7986 } 7987 v.reset(OpSelect1) 7988 v.AddArg(x) 7989 return true 7990 } 7991 // match: (LTDBR (Select0 x:(FSUB _ _))) 7992 // cond: b == x.Block 7993 // result: (Select1 x) 7994 for { 7995 if v_0.Op != OpSelect0 { 7996 break 7997 } 7998 x := v_0.Args[0] 7999 if x.Op != OpS390XFSUB || !(b == x.Block) { 8000 break 8001 } 8002 v.reset(OpSelect1) 8003 v.AddArg(x) 8004 return true 8005 } 8006 return false 8007 } 8008 func rewriteValueS390X_OpS390XLTEBR(v *Value) bool { 8009 v_0 := v.Args[0] 8010 b := v.Block 8011 // match: (LTEBR (Select0 x:(FADDS _ _))) 8012 // cond: b == x.Block 8013 // result: (Select1 x) 8014 for { 8015 if v_0.Op != OpSelect0 { 8016 break 8017 } 8018 x := v_0.Args[0] 8019 if x.Op != OpS390XFADDS || !(b == x.Block) { 8020 break 8021 } 8022 v.reset(OpSelect1) 8023 v.AddArg(x) 8024 return true 8025 } 8026 // match: (LTEBR (Select0 x:(FSUBS _ _))) 8027 // cond: b == x.Block 8028 // result: (Select1 x) 8029 for { 8030 if v_0.Op != OpSelect0 { 8031 break 8032 } 8033 x := v_0.Args[0] 8034 if x.Op != OpS390XFSUBS || !(b == x.Block) { 8035 break 8036 } 8037 v.reset(OpSelect1) 8038 v.AddArg(x) 8039 return true 8040 } 8041 return false 8042 } 8043 func rewriteValueS390X_OpS390XLoweredRound32F(v *Value) bool { 8044 v_0 := v.Args[0] 8045 // match: (LoweredRound32F x:(FMOVSconst)) 8046 // result: x 8047 for { 8048 x := v_0 8049 if x.Op != OpS390XFMOVSconst { 8050 break 8051 } 8052 v.copyOf(x) 8053 return true 8054 } 8055 return false 8056 } 8057 func rewriteValueS390X_OpS390XLoweredRound64F(v *Value) bool { 8058 v_0 := v.Args[0] 8059 // match: (LoweredRound64F x:(FMOVDconst)) 8060 // result: x 8061 for { 8062 x := v_0 8063 if x.Op != OpS390XFMOVDconst { 8064 break 8065 } 8066 v.copyOf(x) 8067 return true 8068 } 8069 return false 8070 } 8071 func rewriteValueS390X_OpS390XMOVBZload(v *Value) bool { 8072 v_1 := v.Args[1] 8073 v_0 := v.Args[0] 8074 // match: (MOVBZload [off] {sym} ptr1 (MOVBstore [off] {sym} ptr2 x _)) 8075 // cond: isSamePtr(ptr1, ptr2) 8076 // result: (MOVBZreg x) 8077 for { 8078 off := auxIntToInt32(v.AuxInt) 8079 sym := auxToSym(v.Aux) 8080 ptr1 := v_0 8081 if v_1.Op != OpS390XMOVBstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 8082 break 8083 } 8084 x := v_1.Args[1] 8085 ptr2 := v_1.Args[0] 8086 if !(isSamePtr(ptr1, ptr2)) { 8087 break 8088 } 8089 v.reset(OpS390XMOVBZreg) 8090 v.AddArg(x) 8091 return true 8092 } 8093 // match: (MOVBZload [off1] {sym} (ADDconst [off2] ptr) mem) 8094 // cond: is20Bit(int64(off1)+int64(off2)) 8095 // result: (MOVBZload [off1+off2] {sym} ptr mem) 8096 for { 8097 off1 := auxIntToInt32(v.AuxInt) 8098 sym := auxToSym(v.Aux) 8099 if v_0.Op != OpS390XADDconst { 8100 break 8101 } 8102 off2 := auxIntToInt32(v_0.AuxInt) 8103 ptr := v_0.Args[0] 8104 mem := v_1 8105 if !(is20Bit(int64(off1) + int64(off2))) { 8106 break 8107 } 8108 v.reset(OpS390XMOVBZload) 8109 v.AuxInt = int32ToAuxInt(off1 + off2) 8110 v.Aux = symToAux(sym) 8111 v.AddArg2(ptr, mem) 8112 return true 8113 } 8114 // match: (MOVBZload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) 8115 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 8116 // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} base mem) 8117 for { 8118 off1 := auxIntToInt32(v.AuxInt) 8119 sym1 := auxToSym(v.Aux) 8120 if v_0.Op != OpS390XMOVDaddr { 8121 break 8122 } 8123 off2 := auxIntToInt32(v_0.AuxInt) 8124 sym2 := auxToSym(v_0.Aux) 8125 base := v_0.Args[0] 8126 mem := v_1 8127 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 8128 break 8129 } 8130 v.reset(OpS390XMOVBZload) 8131 v.AuxInt = int32ToAuxInt(off1 + off2) 8132 v.Aux = symToAux(mergeSym(sym1, sym2)) 8133 v.AddArg2(base, mem) 8134 return true 8135 } 8136 return false 8137 } 8138 func rewriteValueS390X_OpS390XMOVBZreg(v *Value) bool { 8139 v_0 := v.Args[0] 8140 b := v.Block 8141 typ := &b.Func.Config.Types 8142 // match: (MOVBZreg e:(MOVBreg x)) 8143 // cond: clobberIfDead(e) 8144 // result: (MOVBZreg x) 8145 for { 8146 e := v_0 8147 if e.Op != OpS390XMOVBreg { 8148 break 8149 } 8150 x := e.Args[0] 8151 if !(clobberIfDead(e)) { 8152 break 8153 } 8154 v.reset(OpS390XMOVBZreg) 8155 v.AddArg(x) 8156 return true 8157 } 8158 // match: (MOVBZreg e:(MOVHreg x)) 8159 // cond: clobberIfDead(e) 8160 // result: (MOVBZreg x) 8161 for { 8162 e := v_0 8163 if e.Op != OpS390XMOVHreg { 8164 break 8165 } 8166 x := e.Args[0] 8167 if !(clobberIfDead(e)) { 8168 break 8169 } 8170 v.reset(OpS390XMOVBZreg) 8171 v.AddArg(x) 8172 return true 8173 } 8174 // match: (MOVBZreg e:(MOVWreg x)) 8175 // cond: clobberIfDead(e) 8176 // result: (MOVBZreg x) 8177 for { 8178 e := v_0 8179 if e.Op != OpS390XMOVWreg { 8180 break 8181 } 8182 x := e.Args[0] 8183 if !(clobberIfDead(e)) { 8184 break 8185 } 8186 v.reset(OpS390XMOVBZreg) 8187 v.AddArg(x) 8188 return true 8189 } 8190 // match: (MOVBZreg e:(MOVBZreg x)) 8191 // cond: clobberIfDead(e) 8192 // result: (MOVBZreg x) 8193 for { 8194 e := v_0 8195 if e.Op != OpS390XMOVBZreg { 8196 break 8197 } 8198 x := e.Args[0] 8199 if !(clobberIfDead(e)) { 8200 break 8201 } 8202 v.reset(OpS390XMOVBZreg) 8203 v.AddArg(x) 8204 return true 8205 } 8206 // match: (MOVBZreg e:(MOVHZreg x)) 8207 // cond: clobberIfDead(e) 8208 // result: (MOVBZreg x) 8209 for { 8210 e := v_0 8211 if e.Op != OpS390XMOVHZreg { 8212 break 8213 } 8214 x := e.Args[0] 8215 if !(clobberIfDead(e)) { 8216 break 8217 } 8218 v.reset(OpS390XMOVBZreg) 8219 v.AddArg(x) 8220 return true 8221 } 8222 // match: (MOVBZreg e:(MOVWZreg x)) 8223 // cond: clobberIfDead(e) 8224 // result: (MOVBZreg x) 8225 for { 8226 e := v_0 8227 if e.Op != OpS390XMOVWZreg { 8228 break 8229 } 8230 x := e.Args[0] 8231 if !(clobberIfDead(e)) { 8232 break 8233 } 8234 v.reset(OpS390XMOVBZreg) 8235 v.AddArg(x) 8236 return true 8237 } 8238 // match: (MOVBZreg x:(MOVBZload _ _)) 8239 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 8240 // result: x 8241 for { 8242 x := v_0 8243 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 8244 break 8245 } 8246 v.copyOf(x) 8247 return true 8248 } 8249 // match: (MOVBZreg <t> x:(MOVBload [o] {s} p mem)) 8250 // cond: x.Uses == 1 && clobber(x) 8251 // result: @x.Block (MOVBZload <t> [o] {s} p mem) 8252 for { 8253 t := v.Type 8254 x := v_0 8255 if x.Op != OpS390XMOVBload { 8256 break 8257 } 8258 o := auxIntToInt32(x.AuxInt) 8259 s := auxToSym(x.Aux) 8260 mem := x.Args[1] 8261 p := x.Args[0] 8262 if !(x.Uses == 1 && clobber(x)) { 8263 break 8264 } 8265 b = x.Block 8266 v0 := b.NewValue0(x.Pos, OpS390XMOVBZload, t) 8267 v.copyOf(v0) 8268 v0.AuxInt = int32ToAuxInt(o) 8269 v0.Aux = symToAux(s) 8270 v0.AddArg2(p, mem) 8271 return true 8272 } 8273 // match: (MOVBZreg x:(Arg <t>)) 8274 // cond: !t.IsSigned() && t.Size() == 1 8275 // result: x 8276 for { 8277 x := v_0 8278 if x.Op != OpArg { 8279 break 8280 } 8281 t := x.Type 8282 if !(!t.IsSigned() && t.Size() == 1) { 8283 break 8284 } 8285 v.copyOf(x) 8286 return true 8287 } 8288 // match: (MOVBZreg (MOVDconst [c])) 8289 // result: (MOVDconst [int64( uint8(c))]) 8290 for { 8291 if v_0.Op != OpS390XMOVDconst { 8292 break 8293 } 8294 c := auxIntToInt64(v_0.AuxInt) 8295 v.reset(OpS390XMOVDconst) 8296 v.AuxInt = int64ToAuxInt(int64(uint8(c))) 8297 return true 8298 } 8299 // match: (MOVBZreg x:(LOCGR (MOVDconst [c]) (MOVDconst [d]) _)) 8300 // cond: int64(uint8(c)) == c && int64(uint8(d)) == d && (!x.Type.IsSigned() || x.Type.Size() > 1) 8301 // result: x 8302 for { 8303 x := v_0 8304 if x.Op != OpS390XLOCGR { 8305 break 8306 } 8307 _ = x.Args[1] 8308 x_0 := x.Args[0] 8309 if x_0.Op != OpS390XMOVDconst { 8310 break 8311 } 8312 c := auxIntToInt64(x_0.AuxInt) 8313 x_1 := x.Args[1] 8314 if x_1.Op != OpS390XMOVDconst { 8315 break 8316 } 8317 d := auxIntToInt64(x_1.AuxInt) 8318 if !(int64(uint8(c)) == c && int64(uint8(d)) == d && (!x.Type.IsSigned() || x.Type.Size() > 1)) { 8319 break 8320 } 8321 v.copyOf(x) 8322 return true 8323 } 8324 // match: (MOVBZreg (RISBGZ x {r})) 8325 // cond: r.OutMerge(0x000000ff) != nil 8326 // result: (RISBGZ x {*r.OutMerge(0x000000ff)}) 8327 for { 8328 if v_0.Op != OpS390XRISBGZ { 8329 break 8330 } 8331 r := auxToS390xRotateParams(v_0.Aux) 8332 x := v_0.Args[0] 8333 if !(r.OutMerge(0x000000ff) != nil) { 8334 break 8335 } 8336 v.reset(OpS390XRISBGZ) 8337 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0x000000ff)) 8338 v.AddArg(x) 8339 return true 8340 } 8341 // match: (MOVBZreg (ANDWconst [m] x)) 8342 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x)) 8343 for { 8344 if v_0.Op != OpS390XANDWconst { 8345 break 8346 } 8347 m := auxIntToInt32(v_0.AuxInt) 8348 x := v_0.Args[0] 8349 v.reset(OpS390XMOVWZreg) 8350 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 8351 v0.AuxInt = int32ToAuxInt(int32(uint8(m))) 8352 v0.AddArg(x) 8353 v.AddArg(v0) 8354 return true 8355 } 8356 return false 8357 } 8358 func rewriteValueS390X_OpS390XMOVBload(v *Value) bool { 8359 v_1 := v.Args[1] 8360 v_0 := v.Args[0] 8361 // match: (MOVBload [off] {sym} ptr1 (MOVBstore [off] {sym} ptr2 x _)) 8362 // cond: isSamePtr(ptr1, ptr2) 8363 // result: (MOVBreg x) 8364 for { 8365 off := auxIntToInt32(v.AuxInt) 8366 sym := auxToSym(v.Aux) 8367 ptr1 := v_0 8368 if v_1.Op != OpS390XMOVBstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 8369 break 8370 } 8371 x := v_1.Args[1] 8372 ptr2 := v_1.Args[0] 8373 if !(isSamePtr(ptr1, ptr2)) { 8374 break 8375 } 8376 v.reset(OpS390XMOVBreg) 8377 v.AddArg(x) 8378 return true 8379 } 8380 // match: (MOVBload [off1] {sym} (ADDconst [off2] ptr) mem) 8381 // cond: is20Bit(int64(off1)+int64(off2)) 8382 // result: (MOVBload [off1+off2] {sym} ptr mem) 8383 for { 8384 off1 := auxIntToInt32(v.AuxInt) 8385 sym := auxToSym(v.Aux) 8386 if v_0.Op != OpS390XADDconst { 8387 break 8388 } 8389 off2 := auxIntToInt32(v_0.AuxInt) 8390 ptr := v_0.Args[0] 8391 mem := v_1 8392 if !(is20Bit(int64(off1) + int64(off2))) { 8393 break 8394 } 8395 v.reset(OpS390XMOVBload) 8396 v.AuxInt = int32ToAuxInt(off1 + off2) 8397 v.Aux = symToAux(sym) 8398 v.AddArg2(ptr, mem) 8399 return true 8400 } 8401 // match: (MOVBload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) 8402 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 8403 // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem) 8404 for { 8405 off1 := auxIntToInt32(v.AuxInt) 8406 sym1 := auxToSym(v.Aux) 8407 if v_0.Op != OpS390XMOVDaddr { 8408 break 8409 } 8410 off2 := auxIntToInt32(v_0.AuxInt) 8411 sym2 := auxToSym(v_0.Aux) 8412 base := v_0.Args[0] 8413 mem := v_1 8414 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 8415 break 8416 } 8417 v.reset(OpS390XMOVBload) 8418 v.AuxInt = int32ToAuxInt(off1 + off2) 8419 v.Aux = symToAux(mergeSym(sym1, sym2)) 8420 v.AddArg2(base, mem) 8421 return true 8422 } 8423 return false 8424 } 8425 func rewriteValueS390X_OpS390XMOVBreg(v *Value) bool { 8426 v_0 := v.Args[0] 8427 b := v.Block 8428 typ := &b.Func.Config.Types 8429 // match: (MOVBreg e:(MOVBreg x)) 8430 // cond: clobberIfDead(e) 8431 // result: (MOVBreg x) 8432 for { 8433 e := v_0 8434 if e.Op != OpS390XMOVBreg { 8435 break 8436 } 8437 x := e.Args[0] 8438 if !(clobberIfDead(e)) { 8439 break 8440 } 8441 v.reset(OpS390XMOVBreg) 8442 v.AddArg(x) 8443 return true 8444 } 8445 // match: (MOVBreg e:(MOVHreg x)) 8446 // cond: clobberIfDead(e) 8447 // result: (MOVBreg x) 8448 for { 8449 e := v_0 8450 if e.Op != OpS390XMOVHreg { 8451 break 8452 } 8453 x := e.Args[0] 8454 if !(clobberIfDead(e)) { 8455 break 8456 } 8457 v.reset(OpS390XMOVBreg) 8458 v.AddArg(x) 8459 return true 8460 } 8461 // match: (MOVBreg e:(MOVWreg x)) 8462 // cond: clobberIfDead(e) 8463 // result: (MOVBreg x) 8464 for { 8465 e := v_0 8466 if e.Op != OpS390XMOVWreg { 8467 break 8468 } 8469 x := e.Args[0] 8470 if !(clobberIfDead(e)) { 8471 break 8472 } 8473 v.reset(OpS390XMOVBreg) 8474 v.AddArg(x) 8475 return true 8476 } 8477 // match: (MOVBreg e:(MOVBZreg x)) 8478 // cond: clobberIfDead(e) 8479 // result: (MOVBreg x) 8480 for { 8481 e := v_0 8482 if e.Op != OpS390XMOVBZreg { 8483 break 8484 } 8485 x := e.Args[0] 8486 if !(clobberIfDead(e)) { 8487 break 8488 } 8489 v.reset(OpS390XMOVBreg) 8490 v.AddArg(x) 8491 return true 8492 } 8493 // match: (MOVBreg e:(MOVHZreg x)) 8494 // cond: clobberIfDead(e) 8495 // result: (MOVBreg x) 8496 for { 8497 e := v_0 8498 if e.Op != OpS390XMOVHZreg { 8499 break 8500 } 8501 x := e.Args[0] 8502 if !(clobberIfDead(e)) { 8503 break 8504 } 8505 v.reset(OpS390XMOVBreg) 8506 v.AddArg(x) 8507 return true 8508 } 8509 // match: (MOVBreg e:(MOVWZreg x)) 8510 // cond: clobberIfDead(e) 8511 // result: (MOVBreg x) 8512 for { 8513 e := v_0 8514 if e.Op != OpS390XMOVWZreg { 8515 break 8516 } 8517 x := e.Args[0] 8518 if !(clobberIfDead(e)) { 8519 break 8520 } 8521 v.reset(OpS390XMOVBreg) 8522 v.AddArg(x) 8523 return true 8524 } 8525 // match: (MOVBreg x:(MOVBload _ _)) 8526 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 8527 // result: x 8528 for { 8529 x := v_0 8530 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 8531 break 8532 } 8533 v.copyOf(x) 8534 return true 8535 } 8536 // match: (MOVBreg <t> x:(MOVBZload [o] {s} p mem)) 8537 // cond: x.Uses == 1 && clobber(x) 8538 // result: @x.Block (MOVBload <t> [o] {s} p mem) 8539 for { 8540 t := v.Type 8541 x := v_0 8542 if x.Op != OpS390XMOVBZload { 8543 break 8544 } 8545 o := auxIntToInt32(x.AuxInt) 8546 s := auxToSym(x.Aux) 8547 mem := x.Args[1] 8548 p := x.Args[0] 8549 if !(x.Uses == 1 && clobber(x)) { 8550 break 8551 } 8552 b = x.Block 8553 v0 := b.NewValue0(x.Pos, OpS390XMOVBload, t) 8554 v.copyOf(v0) 8555 v0.AuxInt = int32ToAuxInt(o) 8556 v0.Aux = symToAux(s) 8557 v0.AddArg2(p, mem) 8558 return true 8559 } 8560 // match: (MOVBreg x:(Arg <t>)) 8561 // cond: t.IsSigned() && t.Size() == 1 8562 // result: x 8563 for { 8564 x := v_0 8565 if x.Op != OpArg { 8566 break 8567 } 8568 t := x.Type 8569 if !(t.IsSigned() && t.Size() == 1) { 8570 break 8571 } 8572 v.copyOf(x) 8573 return true 8574 } 8575 // match: (MOVBreg (MOVDconst [c])) 8576 // result: (MOVDconst [int64( int8(c))]) 8577 for { 8578 if v_0.Op != OpS390XMOVDconst { 8579 break 8580 } 8581 c := auxIntToInt64(v_0.AuxInt) 8582 v.reset(OpS390XMOVDconst) 8583 v.AuxInt = int64ToAuxInt(int64(int8(c))) 8584 return true 8585 } 8586 // match: (MOVBreg (ANDWconst [m] x)) 8587 // cond: int8(m) >= 0 8588 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x)) 8589 for { 8590 if v_0.Op != OpS390XANDWconst { 8591 break 8592 } 8593 m := auxIntToInt32(v_0.AuxInt) 8594 x := v_0.Args[0] 8595 if !(int8(m) >= 0) { 8596 break 8597 } 8598 v.reset(OpS390XMOVWZreg) 8599 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 8600 v0.AuxInt = int32ToAuxInt(int32(uint8(m))) 8601 v0.AddArg(x) 8602 v.AddArg(v0) 8603 return true 8604 } 8605 return false 8606 } 8607 func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { 8608 v_2 := v.Args[2] 8609 v_1 := v.Args[1] 8610 v_0 := v.Args[0] 8611 // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem) 8612 // result: (MOVBstore [off] {sym} ptr x mem) 8613 for { 8614 off := auxIntToInt32(v.AuxInt) 8615 sym := auxToSym(v.Aux) 8616 ptr := v_0 8617 if v_1.Op != OpS390XMOVBreg { 8618 break 8619 } 8620 x := v_1.Args[0] 8621 mem := v_2 8622 v.reset(OpS390XMOVBstore) 8623 v.AuxInt = int32ToAuxInt(off) 8624 v.Aux = symToAux(sym) 8625 v.AddArg3(ptr, x, mem) 8626 return true 8627 } 8628 // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem) 8629 // result: (MOVBstore [off] {sym} ptr x mem) 8630 for { 8631 off := auxIntToInt32(v.AuxInt) 8632 sym := auxToSym(v.Aux) 8633 ptr := v_0 8634 if v_1.Op != OpS390XMOVBZreg { 8635 break 8636 } 8637 x := v_1.Args[0] 8638 mem := v_2 8639 v.reset(OpS390XMOVBstore) 8640 v.AuxInt = int32ToAuxInt(off) 8641 v.Aux = symToAux(sym) 8642 v.AddArg3(ptr, x, mem) 8643 return true 8644 } 8645 // match: (MOVBstore [off1] {sym} (ADDconst [off2] ptr) val mem) 8646 // cond: is20Bit(int64(off1)+int64(off2)) 8647 // result: (MOVBstore [off1+off2] {sym} ptr val mem) 8648 for { 8649 off1 := auxIntToInt32(v.AuxInt) 8650 sym := auxToSym(v.Aux) 8651 if v_0.Op != OpS390XADDconst { 8652 break 8653 } 8654 off2 := auxIntToInt32(v_0.AuxInt) 8655 ptr := v_0.Args[0] 8656 val := v_1 8657 mem := v_2 8658 if !(is20Bit(int64(off1) + int64(off2))) { 8659 break 8660 } 8661 v.reset(OpS390XMOVBstore) 8662 v.AuxInt = int32ToAuxInt(off1 + off2) 8663 v.Aux = symToAux(sym) 8664 v.AddArg3(ptr, val, mem) 8665 return true 8666 } 8667 // match: (MOVBstore [off] {sym} ptr (MOVDconst [c]) mem) 8668 // cond: is20Bit(int64(off)) && ptr.Op != OpSB 8669 // result: (MOVBstoreconst [makeValAndOff(int32(int8(c)),off)] {sym} ptr mem) 8670 for { 8671 off := auxIntToInt32(v.AuxInt) 8672 sym := auxToSym(v.Aux) 8673 ptr := v_0 8674 if v_1.Op != OpS390XMOVDconst { 8675 break 8676 } 8677 c := auxIntToInt64(v_1.AuxInt) 8678 mem := v_2 8679 if !(is20Bit(int64(off)) && ptr.Op != OpSB) { 8680 break 8681 } 8682 v.reset(OpS390XMOVBstoreconst) 8683 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int8(c)), off)) 8684 v.Aux = symToAux(sym) 8685 v.AddArg2(ptr, mem) 8686 return true 8687 } 8688 // match: (MOVBstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem) 8689 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 8690 // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 8691 for { 8692 off1 := auxIntToInt32(v.AuxInt) 8693 sym1 := auxToSym(v.Aux) 8694 if v_0.Op != OpS390XMOVDaddr { 8695 break 8696 } 8697 off2 := auxIntToInt32(v_0.AuxInt) 8698 sym2 := auxToSym(v_0.Aux) 8699 base := v_0.Args[0] 8700 val := v_1 8701 mem := v_2 8702 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 8703 break 8704 } 8705 v.reset(OpS390XMOVBstore) 8706 v.AuxInt = int32ToAuxInt(off1 + off2) 8707 v.Aux = symToAux(mergeSym(sym1, sym2)) 8708 v.AddArg3(base, val, mem) 8709 return true 8710 } 8711 return false 8712 } 8713 func rewriteValueS390X_OpS390XMOVBstoreconst(v *Value) bool { 8714 v_1 := v.Args[1] 8715 v_0 := v.Args[0] 8716 // match: (MOVBstoreconst [sc] {s} (ADDconst [off] ptr) mem) 8717 // cond: is20Bit(sc.Off64()+int64(off)) 8718 // result: (MOVBstoreconst [sc.addOffset32(off)] {s} ptr mem) 8719 for { 8720 sc := auxIntToValAndOff(v.AuxInt) 8721 s := auxToSym(v.Aux) 8722 if v_0.Op != OpS390XADDconst { 8723 break 8724 } 8725 off := auxIntToInt32(v_0.AuxInt) 8726 ptr := v_0.Args[0] 8727 mem := v_1 8728 if !(is20Bit(sc.Off64() + int64(off))) { 8729 break 8730 } 8731 v.reset(OpS390XMOVBstoreconst) 8732 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 8733 v.Aux = symToAux(s) 8734 v.AddArg2(ptr, mem) 8735 return true 8736 } 8737 // match: (MOVBstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) 8738 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) 8739 // result: (MOVBstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 8740 for { 8741 sc := auxIntToValAndOff(v.AuxInt) 8742 sym1 := auxToSym(v.Aux) 8743 if v_0.Op != OpS390XMOVDaddr { 8744 break 8745 } 8746 off := auxIntToInt32(v_0.AuxInt) 8747 sym2 := auxToSym(v_0.Aux) 8748 ptr := v_0.Args[0] 8749 mem := v_1 8750 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { 8751 break 8752 } 8753 v.reset(OpS390XMOVBstoreconst) 8754 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 8755 v.Aux = symToAux(mergeSym(sym1, sym2)) 8756 v.AddArg2(ptr, mem) 8757 return true 8758 } 8759 return false 8760 } 8761 func rewriteValueS390X_OpS390XMOVDBR(v *Value) bool { 8762 v_0 := v.Args[0] 8763 b := v.Block 8764 typ := &b.Func.Config.Types 8765 // match: (MOVDBR x:(MOVDload [off] {sym} ptr mem)) 8766 // cond: x.Uses == 1 8767 // result: @x.Block (MOVDBRload [off] {sym} ptr mem) 8768 for { 8769 x := v_0 8770 if x.Op != OpS390XMOVDload { 8771 break 8772 } 8773 off := auxIntToInt32(x.AuxInt) 8774 sym := auxToSym(x.Aux) 8775 mem := x.Args[1] 8776 ptr := x.Args[0] 8777 if !(x.Uses == 1) { 8778 break 8779 } 8780 b = x.Block 8781 v0 := b.NewValue0(x.Pos, OpS390XMOVDBRload, typ.UInt64) 8782 v.copyOf(v0) 8783 v0.AuxInt = int32ToAuxInt(off) 8784 v0.Aux = symToAux(sym) 8785 v0.AddArg2(ptr, mem) 8786 return true 8787 } 8788 // match: (MOVDBR x:(MOVDloadidx [off] {sym} ptr idx mem)) 8789 // cond: x.Uses == 1 8790 // result: @x.Block (MOVDBRloadidx [off] {sym} ptr idx mem) 8791 for { 8792 x := v_0 8793 if x.Op != OpS390XMOVDloadidx { 8794 break 8795 } 8796 off := auxIntToInt32(x.AuxInt) 8797 sym := auxToSym(x.Aux) 8798 mem := x.Args[2] 8799 ptr := x.Args[0] 8800 idx := x.Args[1] 8801 if !(x.Uses == 1) { 8802 break 8803 } 8804 b = x.Block 8805 v0 := b.NewValue0(v.Pos, OpS390XMOVDBRloadidx, typ.Int64) 8806 v.copyOf(v0) 8807 v0.AuxInt = int32ToAuxInt(off) 8808 v0.Aux = symToAux(sym) 8809 v0.AddArg3(ptr, idx, mem) 8810 return true 8811 } 8812 return false 8813 } 8814 func rewriteValueS390X_OpS390XMOVDaddridx(v *Value) bool { 8815 v_1 := v.Args[1] 8816 v_0 := v.Args[0] 8817 // match: (MOVDaddridx [c] {s} (ADDconst [d] x) y) 8818 // cond: is20Bit(int64(c)+int64(d)) 8819 // result: (MOVDaddridx [c+d] {s} x y) 8820 for { 8821 c := auxIntToInt32(v.AuxInt) 8822 s := auxToSym(v.Aux) 8823 if v_0.Op != OpS390XADDconst { 8824 break 8825 } 8826 d := auxIntToInt32(v_0.AuxInt) 8827 x := v_0.Args[0] 8828 y := v_1 8829 if !(is20Bit(int64(c) + int64(d))) { 8830 break 8831 } 8832 v.reset(OpS390XMOVDaddridx) 8833 v.AuxInt = int32ToAuxInt(c + d) 8834 v.Aux = symToAux(s) 8835 v.AddArg2(x, y) 8836 return true 8837 } 8838 // match: (MOVDaddridx [c] {s} x (ADDconst [d] y)) 8839 // cond: is20Bit(int64(c)+int64(d)) 8840 // result: (MOVDaddridx [c+d] {s} x y) 8841 for { 8842 c := auxIntToInt32(v.AuxInt) 8843 s := auxToSym(v.Aux) 8844 x := v_0 8845 if v_1.Op != OpS390XADDconst { 8846 break 8847 } 8848 d := auxIntToInt32(v_1.AuxInt) 8849 y := v_1.Args[0] 8850 if !(is20Bit(int64(c) + int64(d))) { 8851 break 8852 } 8853 v.reset(OpS390XMOVDaddridx) 8854 v.AuxInt = int32ToAuxInt(c + d) 8855 v.Aux = symToAux(s) 8856 v.AddArg2(x, y) 8857 return true 8858 } 8859 // match: (MOVDaddridx [off1] {sym1} (MOVDaddr [off2] {sym2} x) y) 8860 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB 8861 // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y) 8862 for { 8863 off1 := auxIntToInt32(v.AuxInt) 8864 sym1 := auxToSym(v.Aux) 8865 if v_0.Op != OpS390XMOVDaddr { 8866 break 8867 } 8868 off2 := auxIntToInt32(v_0.AuxInt) 8869 sym2 := auxToSym(v_0.Aux) 8870 x := v_0.Args[0] 8871 y := v_1 8872 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) { 8873 break 8874 } 8875 v.reset(OpS390XMOVDaddridx) 8876 v.AuxInt = int32ToAuxInt(off1 + off2) 8877 v.Aux = symToAux(mergeSym(sym1, sym2)) 8878 v.AddArg2(x, y) 8879 return true 8880 } 8881 // match: (MOVDaddridx [off1] {sym1} x (MOVDaddr [off2] {sym2} y)) 8882 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB 8883 // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y) 8884 for { 8885 off1 := auxIntToInt32(v.AuxInt) 8886 sym1 := auxToSym(v.Aux) 8887 x := v_0 8888 if v_1.Op != OpS390XMOVDaddr { 8889 break 8890 } 8891 off2 := auxIntToInt32(v_1.AuxInt) 8892 sym2 := auxToSym(v_1.Aux) 8893 y := v_1.Args[0] 8894 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB) { 8895 break 8896 } 8897 v.reset(OpS390XMOVDaddridx) 8898 v.AuxInt = int32ToAuxInt(off1 + off2) 8899 v.Aux = symToAux(mergeSym(sym1, sym2)) 8900 v.AddArg2(x, y) 8901 return true 8902 } 8903 return false 8904 } 8905 func rewriteValueS390X_OpS390XMOVDload(v *Value) bool { 8906 v_1 := v.Args[1] 8907 v_0 := v.Args[0] 8908 // match: (MOVDload [off] {sym} ptr1 (MOVDstore [off] {sym} ptr2 x _)) 8909 // cond: isSamePtr(ptr1, ptr2) 8910 // result: x 8911 for { 8912 off := auxIntToInt32(v.AuxInt) 8913 sym := auxToSym(v.Aux) 8914 ptr1 := v_0 8915 if v_1.Op != OpS390XMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 8916 break 8917 } 8918 x := v_1.Args[1] 8919 ptr2 := v_1.Args[0] 8920 if !(isSamePtr(ptr1, ptr2)) { 8921 break 8922 } 8923 v.copyOf(x) 8924 return true 8925 } 8926 // match: (MOVDload [off] {sym} ptr1 (FMOVDstore [off] {sym} ptr2 x _)) 8927 // cond: isSamePtr(ptr1, ptr2) 8928 // result: (LGDR x) 8929 for { 8930 off := auxIntToInt32(v.AuxInt) 8931 sym := auxToSym(v.Aux) 8932 ptr1 := v_0 8933 if v_1.Op != OpS390XFMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 8934 break 8935 } 8936 x := v_1.Args[1] 8937 ptr2 := v_1.Args[0] 8938 if !(isSamePtr(ptr1, ptr2)) { 8939 break 8940 } 8941 v.reset(OpS390XLGDR) 8942 v.AddArg(x) 8943 return true 8944 } 8945 // match: (MOVDload [off1] {sym} (ADDconst [off2] ptr) mem) 8946 // cond: is20Bit(int64(off1)+int64(off2)) 8947 // result: (MOVDload [off1+off2] {sym} ptr mem) 8948 for { 8949 off1 := auxIntToInt32(v.AuxInt) 8950 sym := auxToSym(v.Aux) 8951 if v_0.Op != OpS390XADDconst { 8952 break 8953 } 8954 off2 := auxIntToInt32(v_0.AuxInt) 8955 ptr := v_0.Args[0] 8956 mem := v_1 8957 if !(is20Bit(int64(off1) + int64(off2))) { 8958 break 8959 } 8960 v.reset(OpS390XMOVDload) 8961 v.AuxInt = int32ToAuxInt(off1 + off2) 8962 v.Aux = symToAux(sym) 8963 v.AddArg2(ptr, mem) 8964 return true 8965 } 8966 // match: (MOVDload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 8967 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0)) 8968 // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem) 8969 for { 8970 off1 := auxIntToInt32(v.AuxInt) 8971 sym1 := auxToSym(v.Aux) 8972 if v_0.Op != OpS390XMOVDaddr { 8973 break 8974 } 8975 t := v_0.Type 8976 off2 := auxIntToInt32(v_0.AuxInt) 8977 sym2 := auxToSym(v_0.Aux) 8978 base := v_0.Args[0] 8979 mem := v_1 8980 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) { 8981 break 8982 } 8983 v.reset(OpS390XMOVDload) 8984 v.AuxInt = int32ToAuxInt(off1 + off2) 8985 v.Aux = symToAux(mergeSym(sym1, sym2)) 8986 v.AddArg2(base, mem) 8987 return true 8988 } 8989 return false 8990 } 8991 func rewriteValueS390X_OpS390XMOVDstore(v *Value) bool { 8992 v_2 := v.Args[2] 8993 v_1 := v.Args[1] 8994 v_0 := v.Args[0] 8995 // match: (MOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem) 8996 // cond: is20Bit(int64(off1)+int64(off2)) 8997 // result: (MOVDstore [off1+off2] {sym} ptr val mem) 8998 for { 8999 off1 := auxIntToInt32(v.AuxInt) 9000 sym := auxToSym(v.Aux) 9001 if v_0.Op != OpS390XADDconst { 9002 break 9003 } 9004 off2 := auxIntToInt32(v_0.AuxInt) 9005 ptr := v_0.Args[0] 9006 val := v_1 9007 mem := v_2 9008 if !(is20Bit(int64(off1) + int64(off2))) { 9009 break 9010 } 9011 v.reset(OpS390XMOVDstore) 9012 v.AuxInt = int32ToAuxInt(off1 + off2) 9013 v.Aux = symToAux(sym) 9014 v.AddArg3(ptr, val, mem) 9015 return true 9016 } 9017 // match: (MOVDstore [off] {sym} ptr (MOVDconst [c]) mem) 9018 // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB 9019 // result: (MOVDstoreconst [makeValAndOff(int32(c),off)] {sym} ptr mem) 9020 for { 9021 off := auxIntToInt32(v.AuxInt) 9022 sym := auxToSym(v.Aux) 9023 ptr := v_0 9024 if v_1.Op != OpS390XMOVDconst { 9025 break 9026 } 9027 c := auxIntToInt64(v_1.AuxInt) 9028 mem := v_2 9029 if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) { 9030 break 9031 } 9032 v.reset(OpS390XMOVDstoreconst) 9033 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off)) 9034 v.Aux = symToAux(sym) 9035 v.AddArg2(ptr, mem) 9036 return true 9037 } 9038 // match: (MOVDstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem) 9039 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0)) 9040 // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 9041 for { 9042 off1 := auxIntToInt32(v.AuxInt) 9043 sym1 := auxToSym(v.Aux) 9044 if v_0.Op != OpS390XMOVDaddr { 9045 break 9046 } 9047 t := v_0.Type 9048 off2 := auxIntToInt32(v_0.AuxInt) 9049 sym2 := auxToSym(v_0.Aux) 9050 base := v_0.Args[0] 9051 val := v_1 9052 mem := v_2 9053 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) { 9054 break 9055 } 9056 v.reset(OpS390XMOVDstore) 9057 v.AuxInt = int32ToAuxInt(off1 + off2) 9058 v.Aux = symToAux(mergeSym(sym1, sym2)) 9059 v.AddArg3(base, val, mem) 9060 return true 9061 } 9062 // match: (MOVDstore [i] {s} p w1 x:(MOVDstore [i-8] {s} p w0 mem)) 9063 // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x) 9064 // result: (STMG2 [i-8] {s} p w0 w1 mem) 9065 for { 9066 i := auxIntToInt32(v.AuxInt) 9067 s := auxToSym(v.Aux) 9068 p := v_0 9069 w1 := v_1 9070 x := v_2 9071 if x.Op != OpS390XMOVDstore || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s { 9072 break 9073 } 9074 mem := x.Args[2] 9075 if p != x.Args[0] { 9076 break 9077 } 9078 w0 := x.Args[1] 9079 if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)) { 9080 break 9081 } 9082 v.reset(OpS390XSTMG2) 9083 v.AuxInt = int32ToAuxInt(i - 8) 9084 v.Aux = symToAux(s) 9085 v.AddArg4(p, w0, w1, mem) 9086 return true 9087 } 9088 // match: (MOVDstore [i] {s} p w2 x:(STMG2 [i-16] {s} p w0 w1 mem)) 9089 // cond: x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x) 9090 // result: (STMG3 [i-16] {s} p w0 w1 w2 mem) 9091 for { 9092 i := auxIntToInt32(v.AuxInt) 9093 s := auxToSym(v.Aux) 9094 p := v_0 9095 w2 := v_1 9096 x := v_2 9097 if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s { 9098 break 9099 } 9100 mem := x.Args[3] 9101 if p != x.Args[0] { 9102 break 9103 } 9104 w0 := x.Args[1] 9105 w1 := x.Args[2] 9106 if !(x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)) { 9107 break 9108 } 9109 v.reset(OpS390XSTMG3) 9110 v.AuxInt = int32ToAuxInt(i - 16) 9111 v.Aux = symToAux(s) 9112 v.AddArg5(p, w0, w1, w2, mem) 9113 return true 9114 } 9115 // match: (MOVDstore [i] {s} p w3 x:(STMG3 [i-24] {s} p w0 w1 w2 mem)) 9116 // cond: x.Uses == 1 && is20Bit(int64(i)-24) && setPos(v, x.Pos) && clobber(x) 9117 // result: (STMG4 [i-24] {s} p w0 w1 w2 w3 mem) 9118 for { 9119 i := auxIntToInt32(v.AuxInt) 9120 s := auxToSym(v.Aux) 9121 p := v_0 9122 w3 := v_1 9123 x := v_2 9124 if x.Op != OpS390XSTMG3 || auxIntToInt32(x.AuxInt) != i-24 || auxToSym(x.Aux) != s { 9125 break 9126 } 9127 mem := x.Args[4] 9128 if p != x.Args[0] { 9129 break 9130 } 9131 w0 := x.Args[1] 9132 w1 := x.Args[2] 9133 w2 := x.Args[3] 9134 if !(x.Uses == 1 && is20Bit(int64(i)-24) && setPos(v, x.Pos) && clobber(x)) { 9135 break 9136 } 9137 v.reset(OpS390XSTMG4) 9138 v.AuxInt = int32ToAuxInt(i - 24) 9139 v.Aux = symToAux(s) 9140 v.AddArg6(p, w0, w1, w2, w3, mem) 9141 return true 9142 } 9143 // match: (MOVDstore [off] {sym} ptr r:(MOVDBR x) mem) 9144 // cond: r.Uses == 1 9145 // result: (MOVDBRstore [off] {sym} ptr x mem) 9146 for { 9147 off := auxIntToInt32(v.AuxInt) 9148 sym := auxToSym(v.Aux) 9149 ptr := v_0 9150 r := v_1 9151 if r.Op != OpS390XMOVDBR { 9152 break 9153 } 9154 x := r.Args[0] 9155 mem := v_2 9156 if !(r.Uses == 1) { 9157 break 9158 } 9159 v.reset(OpS390XMOVDBRstore) 9160 v.AuxInt = int32ToAuxInt(off) 9161 v.Aux = symToAux(sym) 9162 v.AddArg3(ptr, x, mem) 9163 return true 9164 } 9165 return false 9166 } 9167 func rewriteValueS390X_OpS390XMOVDstoreconst(v *Value) bool { 9168 v_1 := v.Args[1] 9169 v_0 := v.Args[0] 9170 // match: (MOVDstoreconst [sc] {s} (ADDconst [off] ptr) mem) 9171 // cond: isU12Bit(sc.Off64()+int64(off)) 9172 // result: (MOVDstoreconst [sc.addOffset32(off)] {s} ptr mem) 9173 for { 9174 sc := auxIntToValAndOff(v.AuxInt) 9175 s := auxToSym(v.Aux) 9176 if v_0.Op != OpS390XADDconst { 9177 break 9178 } 9179 off := auxIntToInt32(v_0.AuxInt) 9180 ptr := v_0.Args[0] 9181 mem := v_1 9182 if !(isU12Bit(sc.Off64() + int64(off))) { 9183 break 9184 } 9185 v.reset(OpS390XMOVDstoreconst) 9186 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 9187 v.Aux = symToAux(s) 9188 v.AddArg2(ptr, mem) 9189 return true 9190 } 9191 // match: (MOVDstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) 9192 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) 9193 // result: (MOVDstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 9194 for { 9195 sc := auxIntToValAndOff(v.AuxInt) 9196 sym1 := auxToSym(v.Aux) 9197 if v_0.Op != OpS390XMOVDaddr { 9198 break 9199 } 9200 off := auxIntToInt32(v_0.AuxInt) 9201 sym2 := auxToSym(v_0.Aux) 9202 ptr := v_0.Args[0] 9203 mem := v_1 9204 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { 9205 break 9206 } 9207 v.reset(OpS390XMOVDstoreconst) 9208 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 9209 v.Aux = symToAux(mergeSym(sym1, sym2)) 9210 v.AddArg2(ptr, mem) 9211 return true 9212 } 9213 return false 9214 } 9215 func rewriteValueS390X_OpS390XMOVDstoreidx(v *Value) bool { 9216 v_3 := v.Args[3] 9217 v_2 := v.Args[2] 9218 v_1 := v.Args[1] 9219 v_0 := v.Args[0] 9220 // match: (MOVDstoreidx [off] {sym} ptr idx r:(MOVDBR x) mem) 9221 // cond: r.Uses == 1 9222 // result: (MOVDBRstoreidx [off] {sym} ptr idx x mem) 9223 for { 9224 off := auxIntToInt32(v.AuxInt) 9225 sym := auxToSym(v.Aux) 9226 ptr := v_0 9227 idx := v_1 9228 r := v_2 9229 if r.Op != OpS390XMOVDBR { 9230 break 9231 } 9232 x := r.Args[0] 9233 mem := v_3 9234 if !(r.Uses == 1) { 9235 break 9236 } 9237 v.reset(OpS390XMOVDBRstoreidx) 9238 v.AuxInt = int32ToAuxInt(off) 9239 v.Aux = symToAux(sym) 9240 v.AddArg4(ptr, idx, x, mem) 9241 return true 9242 } 9243 return false 9244 } 9245 func rewriteValueS390X_OpS390XMOVHZload(v *Value) bool { 9246 v_1 := v.Args[1] 9247 v_0 := v.Args[0] 9248 // match: (MOVHZload [off] {sym} ptr1 (MOVHstore [off] {sym} ptr2 x _)) 9249 // cond: isSamePtr(ptr1, ptr2) 9250 // result: (MOVHZreg x) 9251 for { 9252 off := auxIntToInt32(v.AuxInt) 9253 sym := auxToSym(v.Aux) 9254 ptr1 := v_0 9255 if v_1.Op != OpS390XMOVHstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 9256 break 9257 } 9258 x := v_1.Args[1] 9259 ptr2 := v_1.Args[0] 9260 if !(isSamePtr(ptr1, ptr2)) { 9261 break 9262 } 9263 v.reset(OpS390XMOVHZreg) 9264 v.AddArg(x) 9265 return true 9266 } 9267 // match: (MOVHZload [off1] {sym} (ADDconst [off2] ptr) mem) 9268 // cond: is20Bit(int64(off1)+int64(off2)) 9269 // result: (MOVHZload [off1+off2] {sym} ptr mem) 9270 for { 9271 off1 := auxIntToInt32(v.AuxInt) 9272 sym := auxToSym(v.Aux) 9273 if v_0.Op != OpS390XADDconst { 9274 break 9275 } 9276 off2 := auxIntToInt32(v_0.AuxInt) 9277 ptr := v_0.Args[0] 9278 mem := v_1 9279 if !(is20Bit(int64(off1) + int64(off2))) { 9280 break 9281 } 9282 v.reset(OpS390XMOVHZload) 9283 v.AuxInt = int32ToAuxInt(off1 + off2) 9284 v.Aux = symToAux(sym) 9285 v.AddArg2(ptr, mem) 9286 return true 9287 } 9288 // match: (MOVHZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 9289 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) 9290 // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} base mem) 9291 for { 9292 off1 := auxIntToInt32(v.AuxInt) 9293 sym1 := auxToSym(v.Aux) 9294 if v_0.Op != OpS390XMOVDaddr { 9295 break 9296 } 9297 t := v_0.Type 9298 off2 := auxIntToInt32(v_0.AuxInt) 9299 sym2 := auxToSym(v_0.Aux) 9300 base := v_0.Args[0] 9301 mem := v_1 9302 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { 9303 break 9304 } 9305 v.reset(OpS390XMOVHZload) 9306 v.AuxInt = int32ToAuxInt(off1 + off2) 9307 v.Aux = symToAux(mergeSym(sym1, sym2)) 9308 v.AddArg2(base, mem) 9309 return true 9310 } 9311 return false 9312 } 9313 func rewriteValueS390X_OpS390XMOVHZreg(v *Value) bool { 9314 v_0 := v.Args[0] 9315 b := v.Block 9316 typ := &b.Func.Config.Types 9317 // match: (MOVHZreg e:(MOVBZreg x)) 9318 // cond: clobberIfDead(e) 9319 // result: (MOVBZreg x) 9320 for { 9321 e := v_0 9322 if e.Op != OpS390XMOVBZreg { 9323 break 9324 } 9325 x := e.Args[0] 9326 if !(clobberIfDead(e)) { 9327 break 9328 } 9329 v.reset(OpS390XMOVBZreg) 9330 v.AddArg(x) 9331 return true 9332 } 9333 // match: (MOVHZreg e:(MOVHreg x)) 9334 // cond: clobberIfDead(e) 9335 // result: (MOVHZreg x) 9336 for { 9337 e := v_0 9338 if e.Op != OpS390XMOVHreg { 9339 break 9340 } 9341 x := e.Args[0] 9342 if !(clobberIfDead(e)) { 9343 break 9344 } 9345 v.reset(OpS390XMOVHZreg) 9346 v.AddArg(x) 9347 return true 9348 } 9349 // match: (MOVHZreg e:(MOVWreg x)) 9350 // cond: clobberIfDead(e) 9351 // result: (MOVHZreg x) 9352 for { 9353 e := v_0 9354 if e.Op != OpS390XMOVWreg { 9355 break 9356 } 9357 x := e.Args[0] 9358 if !(clobberIfDead(e)) { 9359 break 9360 } 9361 v.reset(OpS390XMOVHZreg) 9362 v.AddArg(x) 9363 return true 9364 } 9365 // match: (MOVHZreg e:(MOVHZreg x)) 9366 // cond: clobberIfDead(e) 9367 // result: (MOVHZreg x) 9368 for { 9369 e := v_0 9370 if e.Op != OpS390XMOVHZreg { 9371 break 9372 } 9373 x := e.Args[0] 9374 if !(clobberIfDead(e)) { 9375 break 9376 } 9377 v.reset(OpS390XMOVHZreg) 9378 v.AddArg(x) 9379 return true 9380 } 9381 // match: (MOVHZreg e:(MOVWZreg x)) 9382 // cond: clobberIfDead(e) 9383 // result: (MOVHZreg x) 9384 for { 9385 e := v_0 9386 if e.Op != OpS390XMOVWZreg { 9387 break 9388 } 9389 x := e.Args[0] 9390 if !(clobberIfDead(e)) { 9391 break 9392 } 9393 v.reset(OpS390XMOVHZreg) 9394 v.AddArg(x) 9395 return true 9396 } 9397 // match: (MOVHZreg x:(MOVBZload _ _)) 9398 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 9399 // result: x 9400 for { 9401 x := v_0 9402 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 9403 break 9404 } 9405 v.copyOf(x) 9406 return true 9407 } 9408 // match: (MOVHZreg x:(MOVHZload _ _)) 9409 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) 9410 // result: x 9411 for { 9412 x := v_0 9413 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) { 9414 break 9415 } 9416 v.copyOf(x) 9417 return true 9418 } 9419 // match: (MOVHZreg <t> x:(MOVHload [o] {s} p mem)) 9420 // cond: x.Uses == 1 && clobber(x) 9421 // result: @x.Block (MOVHZload <t> [o] {s} p mem) 9422 for { 9423 t := v.Type 9424 x := v_0 9425 if x.Op != OpS390XMOVHload { 9426 break 9427 } 9428 o := auxIntToInt32(x.AuxInt) 9429 s := auxToSym(x.Aux) 9430 mem := x.Args[1] 9431 p := x.Args[0] 9432 if !(x.Uses == 1 && clobber(x)) { 9433 break 9434 } 9435 b = x.Block 9436 v0 := b.NewValue0(x.Pos, OpS390XMOVHZload, t) 9437 v.copyOf(v0) 9438 v0.AuxInt = int32ToAuxInt(o) 9439 v0.Aux = symToAux(s) 9440 v0.AddArg2(p, mem) 9441 return true 9442 } 9443 // match: (MOVHZreg x:(Arg <t>)) 9444 // cond: !t.IsSigned() && t.Size() <= 2 9445 // result: x 9446 for { 9447 x := v_0 9448 if x.Op != OpArg { 9449 break 9450 } 9451 t := x.Type 9452 if !(!t.IsSigned() && t.Size() <= 2) { 9453 break 9454 } 9455 v.copyOf(x) 9456 return true 9457 } 9458 // match: (MOVHZreg (MOVDconst [c])) 9459 // result: (MOVDconst [int64(uint16(c))]) 9460 for { 9461 if v_0.Op != OpS390XMOVDconst { 9462 break 9463 } 9464 c := auxIntToInt64(v_0.AuxInt) 9465 v.reset(OpS390XMOVDconst) 9466 v.AuxInt = int64ToAuxInt(int64(uint16(c))) 9467 return true 9468 } 9469 // match: (MOVHZreg (RISBGZ x {r})) 9470 // cond: r.OutMerge(0x0000ffff) != nil 9471 // result: (RISBGZ x {*r.OutMerge(0x0000ffff)}) 9472 for { 9473 if v_0.Op != OpS390XRISBGZ { 9474 break 9475 } 9476 r := auxToS390xRotateParams(v_0.Aux) 9477 x := v_0.Args[0] 9478 if !(r.OutMerge(0x0000ffff) != nil) { 9479 break 9480 } 9481 v.reset(OpS390XRISBGZ) 9482 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0x0000ffff)) 9483 v.AddArg(x) 9484 return true 9485 } 9486 // match: (MOVHZreg (ANDWconst [m] x)) 9487 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x)) 9488 for { 9489 if v_0.Op != OpS390XANDWconst { 9490 break 9491 } 9492 m := auxIntToInt32(v_0.AuxInt) 9493 x := v_0.Args[0] 9494 v.reset(OpS390XMOVWZreg) 9495 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 9496 v0.AuxInt = int32ToAuxInt(int32(uint16(m))) 9497 v0.AddArg(x) 9498 v.AddArg(v0) 9499 return true 9500 } 9501 return false 9502 } 9503 func rewriteValueS390X_OpS390XMOVHload(v *Value) bool { 9504 v_1 := v.Args[1] 9505 v_0 := v.Args[0] 9506 // match: (MOVHload [off] {sym} ptr1 (MOVHstore [off] {sym} ptr2 x _)) 9507 // cond: isSamePtr(ptr1, ptr2) 9508 // result: (MOVHreg x) 9509 for { 9510 off := auxIntToInt32(v.AuxInt) 9511 sym := auxToSym(v.Aux) 9512 ptr1 := v_0 9513 if v_1.Op != OpS390XMOVHstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 9514 break 9515 } 9516 x := v_1.Args[1] 9517 ptr2 := v_1.Args[0] 9518 if !(isSamePtr(ptr1, ptr2)) { 9519 break 9520 } 9521 v.reset(OpS390XMOVHreg) 9522 v.AddArg(x) 9523 return true 9524 } 9525 // match: (MOVHload [off1] {sym} (ADDconst [off2] ptr) mem) 9526 // cond: is20Bit(int64(off1)+int64(off2)) 9527 // result: (MOVHload [off1+off2] {sym} ptr mem) 9528 for { 9529 off1 := auxIntToInt32(v.AuxInt) 9530 sym := auxToSym(v.Aux) 9531 if v_0.Op != OpS390XADDconst { 9532 break 9533 } 9534 off2 := auxIntToInt32(v_0.AuxInt) 9535 ptr := v_0.Args[0] 9536 mem := v_1 9537 if !(is20Bit(int64(off1) + int64(off2))) { 9538 break 9539 } 9540 v.reset(OpS390XMOVHload) 9541 v.AuxInt = int32ToAuxInt(off1 + off2) 9542 v.Aux = symToAux(sym) 9543 v.AddArg2(ptr, mem) 9544 return true 9545 } 9546 // match: (MOVHload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 9547 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) 9548 // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} base mem) 9549 for { 9550 off1 := auxIntToInt32(v.AuxInt) 9551 sym1 := auxToSym(v.Aux) 9552 if v_0.Op != OpS390XMOVDaddr { 9553 break 9554 } 9555 t := v_0.Type 9556 off2 := auxIntToInt32(v_0.AuxInt) 9557 sym2 := auxToSym(v_0.Aux) 9558 base := v_0.Args[0] 9559 mem := v_1 9560 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { 9561 break 9562 } 9563 v.reset(OpS390XMOVHload) 9564 v.AuxInt = int32ToAuxInt(off1 + off2) 9565 v.Aux = symToAux(mergeSym(sym1, sym2)) 9566 v.AddArg2(base, mem) 9567 return true 9568 } 9569 return false 9570 } 9571 func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool { 9572 v_0 := v.Args[0] 9573 b := v.Block 9574 typ := &b.Func.Config.Types 9575 // match: (MOVHreg e:(MOVBreg x)) 9576 // cond: clobberIfDead(e) 9577 // result: (MOVBreg x) 9578 for { 9579 e := v_0 9580 if e.Op != OpS390XMOVBreg { 9581 break 9582 } 9583 x := e.Args[0] 9584 if !(clobberIfDead(e)) { 9585 break 9586 } 9587 v.reset(OpS390XMOVBreg) 9588 v.AddArg(x) 9589 return true 9590 } 9591 // match: (MOVHreg e:(MOVHreg x)) 9592 // cond: clobberIfDead(e) 9593 // result: (MOVHreg x) 9594 for { 9595 e := v_0 9596 if e.Op != OpS390XMOVHreg { 9597 break 9598 } 9599 x := e.Args[0] 9600 if !(clobberIfDead(e)) { 9601 break 9602 } 9603 v.reset(OpS390XMOVHreg) 9604 v.AddArg(x) 9605 return true 9606 } 9607 // match: (MOVHreg e:(MOVWreg x)) 9608 // cond: clobberIfDead(e) 9609 // result: (MOVHreg x) 9610 for { 9611 e := v_0 9612 if e.Op != OpS390XMOVWreg { 9613 break 9614 } 9615 x := e.Args[0] 9616 if !(clobberIfDead(e)) { 9617 break 9618 } 9619 v.reset(OpS390XMOVHreg) 9620 v.AddArg(x) 9621 return true 9622 } 9623 // match: (MOVHreg e:(MOVHZreg x)) 9624 // cond: clobberIfDead(e) 9625 // result: (MOVHreg x) 9626 for { 9627 e := v_0 9628 if e.Op != OpS390XMOVHZreg { 9629 break 9630 } 9631 x := e.Args[0] 9632 if !(clobberIfDead(e)) { 9633 break 9634 } 9635 v.reset(OpS390XMOVHreg) 9636 v.AddArg(x) 9637 return true 9638 } 9639 // match: (MOVHreg e:(MOVWZreg x)) 9640 // cond: clobberIfDead(e) 9641 // result: (MOVHreg x) 9642 for { 9643 e := v_0 9644 if e.Op != OpS390XMOVWZreg { 9645 break 9646 } 9647 x := e.Args[0] 9648 if !(clobberIfDead(e)) { 9649 break 9650 } 9651 v.reset(OpS390XMOVHreg) 9652 v.AddArg(x) 9653 return true 9654 } 9655 // match: (MOVHreg x:(MOVBload _ _)) 9656 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 9657 // result: x 9658 for { 9659 x := v_0 9660 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 9661 break 9662 } 9663 v.copyOf(x) 9664 return true 9665 } 9666 // match: (MOVHreg x:(MOVHload _ _)) 9667 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 9668 // result: x 9669 for { 9670 x := v_0 9671 if x.Op != OpS390XMOVHload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 9672 break 9673 } 9674 v.copyOf(x) 9675 return true 9676 } 9677 // match: (MOVHreg x:(MOVBZload _ _)) 9678 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 9679 // result: x 9680 for { 9681 x := v_0 9682 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 9683 break 9684 } 9685 v.copyOf(x) 9686 return true 9687 } 9688 // match: (MOVHreg <t> x:(MOVHZload [o] {s} p mem)) 9689 // cond: x.Uses == 1 && clobber(x) 9690 // result: @x.Block (MOVHload <t> [o] {s} p mem) 9691 for { 9692 t := v.Type 9693 x := v_0 9694 if x.Op != OpS390XMOVHZload { 9695 break 9696 } 9697 o := auxIntToInt32(x.AuxInt) 9698 s := auxToSym(x.Aux) 9699 mem := x.Args[1] 9700 p := x.Args[0] 9701 if !(x.Uses == 1 && clobber(x)) { 9702 break 9703 } 9704 b = x.Block 9705 v0 := b.NewValue0(x.Pos, OpS390XMOVHload, t) 9706 v.copyOf(v0) 9707 v0.AuxInt = int32ToAuxInt(o) 9708 v0.Aux = symToAux(s) 9709 v0.AddArg2(p, mem) 9710 return true 9711 } 9712 // match: (MOVHreg x:(Arg <t>)) 9713 // cond: t.IsSigned() && t.Size() <= 2 9714 // result: x 9715 for { 9716 x := v_0 9717 if x.Op != OpArg { 9718 break 9719 } 9720 t := x.Type 9721 if !(t.IsSigned() && t.Size() <= 2) { 9722 break 9723 } 9724 v.copyOf(x) 9725 return true 9726 } 9727 // match: (MOVHreg (MOVDconst [c])) 9728 // result: (MOVDconst [int64(int16(c))]) 9729 for { 9730 if v_0.Op != OpS390XMOVDconst { 9731 break 9732 } 9733 c := auxIntToInt64(v_0.AuxInt) 9734 v.reset(OpS390XMOVDconst) 9735 v.AuxInt = int64ToAuxInt(int64(int16(c))) 9736 return true 9737 } 9738 // match: (MOVHreg (ANDWconst [m] x)) 9739 // cond: int16(m) >= 0 9740 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x)) 9741 for { 9742 if v_0.Op != OpS390XANDWconst { 9743 break 9744 } 9745 m := auxIntToInt32(v_0.AuxInt) 9746 x := v_0.Args[0] 9747 if !(int16(m) >= 0) { 9748 break 9749 } 9750 v.reset(OpS390XMOVWZreg) 9751 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 9752 v0.AuxInt = int32ToAuxInt(int32(uint16(m))) 9753 v0.AddArg(x) 9754 v.AddArg(v0) 9755 return true 9756 } 9757 return false 9758 } 9759 func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { 9760 v_2 := v.Args[2] 9761 v_1 := v.Args[1] 9762 v_0 := v.Args[0] 9763 // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem) 9764 // result: (MOVHstore [off] {sym} ptr x mem) 9765 for { 9766 off := auxIntToInt32(v.AuxInt) 9767 sym := auxToSym(v.Aux) 9768 ptr := v_0 9769 if v_1.Op != OpS390XMOVHreg { 9770 break 9771 } 9772 x := v_1.Args[0] 9773 mem := v_2 9774 v.reset(OpS390XMOVHstore) 9775 v.AuxInt = int32ToAuxInt(off) 9776 v.Aux = symToAux(sym) 9777 v.AddArg3(ptr, x, mem) 9778 return true 9779 } 9780 // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem) 9781 // result: (MOVHstore [off] {sym} ptr x mem) 9782 for { 9783 off := auxIntToInt32(v.AuxInt) 9784 sym := auxToSym(v.Aux) 9785 ptr := v_0 9786 if v_1.Op != OpS390XMOVHZreg { 9787 break 9788 } 9789 x := v_1.Args[0] 9790 mem := v_2 9791 v.reset(OpS390XMOVHstore) 9792 v.AuxInt = int32ToAuxInt(off) 9793 v.Aux = symToAux(sym) 9794 v.AddArg3(ptr, x, mem) 9795 return true 9796 } 9797 // match: (MOVHstore [off1] {sym} (ADDconst [off2] ptr) val mem) 9798 // cond: is20Bit(int64(off1)+int64(off2)) 9799 // result: (MOVHstore [off1+off2] {sym} ptr val mem) 9800 for { 9801 off1 := auxIntToInt32(v.AuxInt) 9802 sym := auxToSym(v.Aux) 9803 if v_0.Op != OpS390XADDconst { 9804 break 9805 } 9806 off2 := auxIntToInt32(v_0.AuxInt) 9807 ptr := v_0.Args[0] 9808 val := v_1 9809 mem := v_2 9810 if !(is20Bit(int64(off1) + int64(off2))) { 9811 break 9812 } 9813 v.reset(OpS390XMOVHstore) 9814 v.AuxInt = int32ToAuxInt(off1 + off2) 9815 v.Aux = symToAux(sym) 9816 v.AddArg3(ptr, val, mem) 9817 return true 9818 } 9819 // match: (MOVHstore [off] {sym} ptr (MOVDconst [c]) mem) 9820 // cond: isU12Bit(int64(off)) && ptr.Op != OpSB 9821 // result: (MOVHstoreconst [makeValAndOff(int32(int16(c)),off)] {sym} ptr mem) 9822 for { 9823 off := auxIntToInt32(v.AuxInt) 9824 sym := auxToSym(v.Aux) 9825 ptr := v_0 9826 if v_1.Op != OpS390XMOVDconst { 9827 break 9828 } 9829 c := auxIntToInt64(v_1.AuxInt) 9830 mem := v_2 9831 if !(isU12Bit(int64(off)) && ptr.Op != OpSB) { 9832 break 9833 } 9834 v.reset(OpS390XMOVHstoreconst) 9835 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int16(c)), off)) 9836 v.Aux = symToAux(sym) 9837 v.AddArg2(ptr, mem) 9838 return true 9839 } 9840 // match: (MOVHstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem) 9841 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) 9842 // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 9843 for { 9844 off1 := auxIntToInt32(v.AuxInt) 9845 sym1 := auxToSym(v.Aux) 9846 if v_0.Op != OpS390XMOVDaddr { 9847 break 9848 } 9849 t := v_0.Type 9850 off2 := auxIntToInt32(v_0.AuxInt) 9851 sym2 := auxToSym(v_0.Aux) 9852 base := v_0.Args[0] 9853 val := v_1 9854 mem := v_2 9855 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { 9856 break 9857 } 9858 v.reset(OpS390XMOVHstore) 9859 v.AuxInt = int32ToAuxInt(off1 + off2) 9860 v.Aux = symToAux(mergeSym(sym1, sym2)) 9861 v.AddArg3(base, val, mem) 9862 return true 9863 } 9864 // match: (MOVHstore [off] {sym} ptr (Bswap16 val) mem) 9865 // result: (MOVHBRstore [off] {sym} ptr val mem) 9866 for { 9867 off := auxIntToInt32(v.AuxInt) 9868 sym := auxToSym(v.Aux) 9869 ptr := v_0 9870 if v_1.Op != OpBswap16 { 9871 break 9872 } 9873 val := v_1.Args[0] 9874 mem := v_2 9875 v.reset(OpS390XMOVHBRstore) 9876 v.AuxInt = int32ToAuxInt(off) 9877 v.Aux = symToAux(sym) 9878 v.AddArg3(ptr, val, mem) 9879 return true 9880 } 9881 return false 9882 } 9883 func rewriteValueS390X_OpS390XMOVHstoreconst(v *Value) bool { 9884 v_1 := v.Args[1] 9885 v_0 := v.Args[0] 9886 // match: (MOVHstoreconst [sc] {s} (ADDconst [off] ptr) mem) 9887 // cond: isU12Bit(sc.Off64()+int64(off)) 9888 // result: (MOVHstoreconst [sc.addOffset32(off)] {s} ptr mem) 9889 for { 9890 sc := auxIntToValAndOff(v.AuxInt) 9891 s := auxToSym(v.Aux) 9892 if v_0.Op != OpS390XADDconst { 9893 break 9894 } 9895 off := auxIntToInt32(v_0.AuxInt) 9896 ptr := v_0.Args[0] 9897 mem := v_1 9898 if !(isU12Bit(sc.Off64() + int64(off))) { 9899 break 9900 } 9901 v.reset(OpS390XMOVHstoreconst) 9902 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 9903 v.Aux = symToAux(s) 9904 v.AddArg2(ptr, mem) 9905 return true 9906 } 9907 // match: (MOVHstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) 9908 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) 9909 // result: (MOVHstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 9910 for { 9911 sc := auxIntToValAndOff(v.AuxInt) 9912 sym1 := auxToSym(v.Aux) 9913 if v_0.Op != OpS390XMOVDaddr { 9914 break 9915 } 9916 off := auxIntToInt32(v_0.AuxInt) 9917 sym2 := auxToSym(v_0.Aux) 9918 ptr := v_0.Args[0] 9919 mem := v_1 9920 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { 9921 break 9922 } 9923 v.reset(OpS390XMOVHstoreconst) 9924 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 9925 v.Aux = symToAux(mergeSym(sym1, sym2)) 9926 v.AddArg2(ptr, mem) 9927 return true 9928 } 9929 return false 9930 } 9931 func rewriteValueS390X_OpS390XMOVHstoreidx(v *Value) bool { 9932 v_3 := v.Args[3] 9933 v_2 := v.Args[2] 9934 v_1 := v.Args[1] 9935 v_0 := v.Args[0] 9936 // match: (MOVHstoreidx [off] {sym} ptr idx (Bswap16 val) mem) 9937 // result: (MOVHBRstoreidx [off] {sym} ptr idx val mem) 9938 for { 9939 off := auxIntToInt32(v.AuxInt) 9940 sym := auxToSym(v.Aux) 9941 ptr := v_0 9942 idx := v_1 9943 if v_2.Op != OpBswap16 { 9944 break 9945 } 9946 val := v_2.Args[0] 9947 mem := v_3 9948 v.reset(OpS390XMOVHBRstoreidx) 9949 v.AuxInt = int32ToAuxInt(off) 9950 v.Aux = symToAux(sym) 9951 v.AddArg4(ptr, idx, val, mem) 9952 return true 9953 } 9954 return false 9955 } 9956 func rewriteValueS390X_OpS390XMOVWBR(v *Value) bool { 9957 v_0 := v.Args[0] 9958 b := v.Block 9959 typ := &b.Func.Config.Types 9960 // match: (MOVWBR x:(MOVWZload [off] {sym} ptr mem)) 9961 // cond: x.Uses == 1 9962 // result: @x.Block (MOVWZreg (MOVWBRload [off] {sym} ptr mem)) 9963 for { 9964 x := v_0 9965 if x.Op != OpS390XMOVWZload { 9966 break 9967 } 9968 off := auxIntToInt32(x.AuxInt) 9969 sym := auxToSym(x.Aux) 9970 mem := x.Args[1] 9971 ptr := x.Args[0] 9972 if !(x.Uses == 1) { 9973 break 9974 } 9975 b = x.Block 9976 v0 := b.NewValue0(x.Pos, OpS390XMOVWZreg, typ.UInt64) 9977 v.copyOf(v0) 9978 v1 := b.NewValue0(x.Pos, OpS390XMOVWBRload, typ.UInt32) 9979 v1.AuxInt = int32ToAuxInt(off) 9980 v1.Aux = symToAux(sym) 9981 v1.AddArg2(ptr, mem) 9982 v0.AddArg(v1) 9983 return true 9984 } 9985 // match: (MOVWBR x:(MOVWZloadidx [off] {sym} ptr idx mem)) 9986 // cond: x.Uses == 1 9987 // result: @x.Block (MOVWZreg (MOVWBRloadidx [off] {sym} ptr idx mem)) 9988 for { 9989 x := v_0 9990 if x.Op != OpS390XMOVWZloadidx { 9991 break 9992 } 9993 off := auxIntToInt32(x.AuxInt) 9994 sym := auxToSym(x.Aux) 9995 mem := x.Args[2] 9996 ptr := x.Args[0] 9997 idx := x.Args[1] 9998 if !(x.Uses == 1) { 9999 break 10000 } 10001 b = x.Block 10002 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 10003 v.copyOf(v0) 10004 v1 := b.NewValue0(v.Pos, OpS390XMOVWBRloadidx, typ.Int32) 10005 v1.AuxInt = int32ToAuxInt(off) 10006 v1.Aux = symToAux(sym) 10007 v1.AddArg3(ptr, idx, mem) 10008 v0.AddArg(v1) 10009 return true 10010 } 10011 return false 10012 } 10013 func rewriteValueS390X_OpS390XMOVWZload(v *Value) bool { 10014 v_1 := v.Args[1] 10015 v_0 := v.Args[0] 10016 // match: (MOVWZload [off] {sym} ptr1 (MOVWstore [off] {sym} ptr2 x _)) 10017 // cond: isSamePtr(ptr1, ptr2) 10018 // result: (MOVWZreg x) 10019 for { 10020 off := auxIntToInt32(v.AuxInt) 10021 sym := auxToSym(v.Aux) 10022 ptr1 := v_0 10023 if v_1.Op != OpS390XMOVWstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 10024 break 10025 } 10026 x := v_1.Args[1] 10027 ptr2 := v_1.Args[0] 10028 if !(isSamePtr(ptr1, ptr2)) { 10029 break 10030 } 10031 v.reset(OpS390XMOVWZreg) 10032 v.AddArg(x) 10033 return true 10034 } 10035 // match: (MOVWZload [off1] {sym} (ADDconst [off2] ptr) mem) 10036 // cond: is20Bit(int64(off1)+int64(off2)) 10037 // result: (MOVWZload [off1+off2] {sym} ptr mem) 10038 for { 10039 off1 := auxIntToInt32(v.AuxInt) 10040 sym := auxToSym(v.Aux) 10041 if v_0.Op != OpS390XADDconst { 10042 break 10043 } 10044 off2 := auxIntToInt32(v_0.AuxInt) 10045 ptr := v_0.Args[0] 10046 mem := v_1 10047 if !(is20Bit(int64(off1) + int64(off2))) { 10048 break 10049 } 10050 v.reset(OpS390XMOVWZload) 10051 v.AuxInt = int32ToAuxInt(off1 + off2) 10052 v.Aux = symToAux(sym) 10053 v.AddArg2(ptr, mem) 10054 return true 10055 } 10056 // match: (MOVWZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 10057 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) 10058 // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} base mem) 10059 for { 10060 off1 := auxIntToInt32(v.AuxInt) 10061 sym1 := auxToSym(v.Aux) 10062 if v_0.Op != OpS390XMOVDaddr { 10063 break 10064 } 10065 t := v_0.Type 10066 off2 := auxIntToInt32(v_0.AuxInt) 10067 sym2 := auxToSym(v_0.Aux) 10068 base := v_0.Args[0] 10069 mem := v_1 10070 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { 10071 break 10072 } 10073 v.reset(OpS390XMOVWZload) 10074 v.AuxInt = int32ToAuxInt(off1 + off2) 10075 v.Aux = symToAux(mergeSym(sym1, sym2)) 10076 v.AddArg2(base, mem) 10077 return true 10078 } 10079 return false 10080 } 10081 func rewriteValueS390X_OpS390XMOVWZreg(v *Value) bool { 10082 v_0 := v.Args[0] 10083 b := v.Block 10084 // match: (MOVWZreg e:(MOVBZreg x)) 10085 // cond: clobberIfDead(e) 10086 // result: (MOVBZreg x) 10087 for { 10088 e := v_0 10089 if e.Op != OpS390XMOVBZreg { 10090 break 10091 } 10092 x := e.Args[0] 10093 if !(clobberIfDead(e)) { 10094 break 10095 } 10096 v.reset(OpS390XMOVBZreg) 10097 v.AddArg(x) 10098 return true 10099 } 10100 // match: (MOVWZreg e:(MOVHZreg x)) 10101 // cond: clobberIfDead(e) 10102 // result: (MOVHZreg x) 10103 for { 10104 e := v_0 10105 if e.Op != OpS390XMOVHZreg { 10106 break 10107 } 10108 x := e.Args[0] 10109 if !(clobberIfDead(e)) { 10110 break 10111 } 10112 v.reset(OpS390XMOVHZreg) 10113 v.AddArg(x) 10114 return true 10115 } 10116 // match: (MOVWZreg e:(MOVWreg x)) 10117 // cond: clobberIfDead(e) 10118 // result: (MOVWZreg x) 10119 for { 10120 e := v_0 10121 if e.Op != OpS390XMOVWreg { 10122 break 10123 } 10124 x := e.Args[0] 10125 if !(clobberIfDead(e)) { 10126 break 10127 } 10128 v.reset(OpS390XMOVWZreg) 10129 v.AddArg(x) 10130 return true 10131 } 10132 // match: (MOVWZreg e:(MOVWZreg x)) 10133 // cond: clobberIfDead(e) 10134 // result: (MOVWZreg x) 10135 for { 10136 e := v_0 10137 if e.Op != OpS390XMOVWZreg { 10138 break 10139 } 10140 x := e.Args[0] 10141 if !(clobberIfDead(e)) { 10142 break 10143 } 10144 v.reset(OpS390XMOVWZreg) 10145 v.AddArg(x) 10146 return true 10147 } 10148 // match: (MOVWZreg x:(MOVBZload _ _)) 10149 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 10150 // result: x 10151 for { 10152 x := v_0 10153 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 10154 break 10155 } 10156 v.copyOf(x) 10157 return true 10158 } 10159 // match: (MOVWZreg x:(MOVHZload _ _)) 10160 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) 10161 // result: x 10162 for { 10163 x := v_0 10164 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) { 10165 break 10166 } 10167 v.copyOf(x) 10168 return true 10169 } 10170 // match: (MOVWZreg x:(MOVWZload _ _)) 10171 // cond: (!x.Type.IsSigned() || x.Type.Size() > 4) 10172 // result: x 10173 for { 10174 x := v_0 10175 if x.Op != OpS390XMOVWZload || !(!x.Type.IsSigned() || x.Type.Size() > 4) { 10176 break 10177 } 10178 v.copyOf(x) 10179 return true 10180 } 10181 // match: (MOVWZreg <t> x:(MOVWload [o] {s} p mem)) 10182 // cond: x.Uses == 1 && clobber(x) 10183 // result: @x.Block (MOVWZload <t> [o] {s} p mem) 10184 for { 10185 t := v.Type 10186 x := v_0 10187 if x.Op != OpS390XMOVWload { 10188 break 10189 } 10190 o := auxIntToInt32(x.AuxInt) 10191 s := auxToSym(x.Aux) 10192 mem := x.Args[1] 10193 p := x.Args[0] 10194 if !(x.Uses == 1 && clobber(x)) { 10195 break 10196 } 10197 b = x.Block 10198 v0 := b.NewValue0(x.Pos, OpS390XMOVWZload, t) 10199 v.copyOf(v0) 10200 v0.AuxInt = int32ToAuxInt(o) 10201 v0.Aux = symToAux(s) 10202 v0.AddArg2(p, mem) 10203 return true 10204 } 10205 // match: (MOVWZreg x:(Arg <t>)) 10206 // cond: !t.IsSigned() && t.Size() <= 4 10207 // result: x 10208 for { 10209 x := v_0 10210 if x.Op != OpArg { 10211 break 10212 } 10213 t := x.Type 10214 if !(!t.IsSigned() && t.Size() <= 4) { 10215 break 10216 } 10217 v.copyOf(x) 10218 return true 10219 } 10220 // match: (MOVWZreg (MOVDconst [c])) 10221 // result: (MOVDconst [int64(uint32(c))]) 10222 for { 10223 if v_0.Op != OpS390XMOVDconst { 10224 break 10225 } 10226 c := auxIntToInt64(v_0.AuxInt) 10227 v.reset(OpS390XMOVDconst) 10228 v.AuxInt = int64ToAuxInt(int64(uint32(c))) 10229 return true 10230 } 10231 // match: (MOVWZreg (RISBGZ x {r})) 10232 // cond: r.OutMerge(0xffffffff) != nil 10233 // result: (RISBGZ x {*r.OutMerge(0xffffffff)}) 10234 for { 10235 if v_0.Op != OpS390XRISBGZ { 10236 break 10237 } 10238 r := auxToS390xRotateParams(v_0.Aux) 10239 x := v_0.Args[0] 10240 if !(r.OutMerge(0xffffffff) != nil) { 10241 break 10242 } 10243 v.reset(OpS390XRISBGZ) 10244 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0xffffffff)) 10245 v.AddArg(x) 10246 return true 10247 } 10248 return false 10249 } 10250 func rewriteValueS390X_OpS390XMOVWload(v *Value) bool { 10251 v_1 := v.Args[1] 10252 v_0 := v.Args[0] 10253 // match: (MOVWload [off] {sym} ptr1 (MOVWstore [off] {sym} ptr2 x _)) 10254 // cond: isSamePtr(ptr1, ptr2) 10255 // result: (MOVWreg x) 10256 for { 10257 off := auxIntToInt32(v.AuxInt) 10258 sym := auxToSym(v.Aux) 10259 ptr1 := v_0 10260 if v_1.Op != OpS390XMOVWstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 10261 break 10262 } 10263 x := v_1.Args[1] 10264 ptr2 := v_1.Args[0] 10265 if !(isSamePtr(ptr1, ptr2)) { 10266 break 10267 } 10268 v.reset(OpS390XMOVWreg) 10269 v.AddArg(x) 10270 return true 10271 } 10272 // match: (MOVWload [off1] {sym} (ADDconst [off2] ptr) mem) 10273 // cond: is20Bit(int64(off1)+int64(off2)) 10274 // result: (MOVWload [off1+off2] {sym} ptr mem) 10275 for { 10276 off1 := auxIntToInt32(v.AuxInt) 10277 sym := auxToSym(v.Aux) 10278 if v_0.Op != OpS390XADDconst { 10279 break 10280 } 10281 off2 := auxIntToInt32(v_0.AuxInt) 10282 ptr := v_0.Args[0] 10283 mem := v_1 10284 if !(is20Bit(int64(off1) + int64(off2))) { 10285 break 10286 } 10287 v.reset(OpS390XMOVWload) 10288 v.AuxInt = int32ToAuxInt(off1 + off2) 10289 v.Aux = symToAux(sym) 10290 v.AddArg2(ptr, mem) 10291 return true 10292 } 10293 // match: (MOVWload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 10294 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) 10295 // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem) 10296 for { 10297 off1 := auxIntToInt32(v.AuxInt) 10298 sym1 := auxToSym(v.Aux) 10299 if v_0.Op != OpS390XMOVDaddr { 10300 break 10301 } 10302 t := v_0.Type 10303 off2 := auxIntToInt32(v_0.AuxInt) 10304 sym2 := auxToSym(v_0.Aux) 10305 base := v_0.Args[0] 10306 mem := v_1 10307 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { 10308 break 10309 } 10310 v.reset(OpS390XMOVWload) 10311 v.AuxInt = int32ToAuxInt(off1 + off2) 10312 v.Aux = symToAux(mergeSym(sym1, sym2)) 10313 v.AddArg2(base, mem) 10314 return true 10315 } 10316 return false 10317 } 10318 func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool { 10319 v_0 := v.Args[0] 10320 b := v.Block 10321 // match: (MOVWreg e:(MOVBreg x)) 10322 // cond: clobberIfDead(e) 10323 // result: (MOVBreg x) 10324 for { 10325 e := v_0 10326 if e.Op != OpS390XMOVBreg { 10327 break 10328 } 10329 x := e.Args[0] 10330 if !(clobberIfDead(e)) { 10331 break 10332 } 10333 v.reset(OpS390XMOVBreg) 10334 v.AddArg(x) 10335 return true 10336 } 10337 // match: (MOVWreg e:(MOVHreg x)) 10338 // cond: clobberIfDead(e) 10339 // result: (MOVHreg x) 10340 for { 10341 e := v_0 10342 if e.Op != OpS390XMOVHreg { 10343 break 10344 } 10345 x := e.Args[0] 10346 if !(clobberIfDead(e)) { 10347 break 10348 } 10349 v.reset(OpS390XMOVHreg) 10350 v.AddArg(x) 10351 return true 10352 } 10353 // match: (MOVWreg e:(MOVWreg x)) 10354 // cond: clobberIfDead(e) 10355 // result: (MOVWreg x) 10356 for { 10357 e := v_0 10358 if e.Op != OpS390XMOVWreg { 10359 break 10360 } 10361 x := e.Args[0] 10362 if !(clobberIfDead(e)) { 10363 break 10364 } 10365 v.reset(OpS390XMOVWreg) 10366 v.AddArg(x) 10367 return true 10368 } 10369 // match: (MOVWreg e:(MOVWZreg x)) 10370 // cond: clobberIfDead(e) 10371 // result: (MOVWreg x) 10372 for { 10373 e := v_0 10374 if e.Op != OpS390XMOVWZreg { 10375 break 10376 } 10377 x := e.Args[0] 10378 if !(clobberIfDead(e)) { 10379 break 10380 } 10381 v.reset(OpS390XMOVWreg) 10382 v.AddArg(x) 10383 return true 10384 } 10385 // match: (MOVWreg x:(MOVBload _ _)) 10386 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 10387 // result: x 10388 for { 10389 x := v_0 10390 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 10391 break 10392 } 10393 v.copyOf(x) 10394 return true 10395 } 10396 // match: (MOVWreg x:(MOVHload _ _)) 10397 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 10398 // result: x 10399 for { 10400 x := v_0 10401 if x.Op != OpS390XMOVHload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 10402 break 10403 } 10404 v.copyOf(x) 10405 return true 10406 } 10407 // match: (MOVWreg x:(MOVWload _ _)) 10408 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 10409 // result: x 10410 for { 10411 x := v_0 10412 if x.Op != OpS390XMOVWload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 10413 break 10414 } 10415 v.copyOf(x) 10416 return true 10417 } 10418 // match: (MOVWreg x:(MOVBZload _ _)) 10419 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 10420 // result: x 10421 for { 10422 x := v_0 10423 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 10424 break 10425 } 10426 v.copyOf(x) 10427 return true 10428 } 10429 // match: (MOVWreg x:(MOVHZload _ _)) 10430 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) 10431 // result: x 10432 for { 10433 x := v_0 10434 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) { 10435 break 10436 } 10437 v.copyOf(x) 10438 return true 10439 } 10440 // match: (MOVWreg <t> x:(MOVWZload [o] {s} p mem)) 10441 // cond: x.Uses == 1 && clobber(x) 10442 // result: @x.Block (MOVWload <t> [o] {s} p mem) 10443 for { 10444 t := v.Type 10445 x := v_0 10446 if x.Op != OpS390XMOVWZload { 10447 break 10448 } 10449 o := auxIntToInt32(x.AuxInt) 10450 s := auxToSym(x.Aux) 10451 mem := x.Args[1] 10452 p := x.Args[0] 10453 if !(x.Uses == 1 && clobber(x)) { 10454 break 10455 } 10456 b = x.Block 10457 v0 := b.NewValue0(x.Pos, OpS390XMOVWload, t) 10458 v.copyOf(v0) 10459 v0.AuxInt = int32ToAuxInt(o) 10460 v0.Aux = symToAux(s) 10461 v0.AddArg2(p, mem) 10462 return true 10463 } 10464 // match: (MOVWreg x:(Arg <t>)) 10465 // cond: t.IsSigned() && t.Size() <= 4 10466 // result: x 10467 for { 10468 x := v_0 10469 if x.Op != OpArg { 10470 break 10471 } 10472 t := x.Type 10473 if !(t.IsSigned() && t.Size() <= 4) { 10474 break 10475 } 10476 v.copyOf(x) 10477 return true 10478 } 10479 // match: (MOVWreg (MOVDconst [c])) 10480 // result: (MOVDconst [int64(int32(c))]) 10481 for { 10482 if v_0.Op != OpS390XMOVDconst { 10483 break 10484 } 10485 c := auxIntToInt64(v_0.AuxInt) 10486 v.reset(OpS390XMOVDconst) 10487 v.AuxInt = int64ToAuxInt(int64(int32(c))) 10488 return true 10489 } 10490 return false 10491 } 10492 func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool { 10493 v_2 := v.Args[2] 10494 v_1 := v.Args[1] 10495 v_0 := v.Args[0] 10496 // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem) 10497 // result: (MOVWstore [off] {sym} ptr x mem) 10498 for { 10499 off := auxIntToInt32(v.AuxInt) 10500 sym := auxToSym(v.Aux) 10501 ptr := v_0 10502 if v_1.Op != OpS390XMOVWreg { 10503 break 10504 } 10505 x := v_1.Args[0] 10506 mem := v_2 10507 v.reset(OpS390XMOVWstore) 10508 v.AuxInt = int32ToAuxInt(off) 10509 v.Aux = symToAux(sym) 10510 v.AddArg3(ptr, x, mem) 10511 return true 10512 } 10513 // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem) 10514 // result: (MOVWstore [off] {sym} ptr x mem) 10515 for { 10516 off := auxIntToInt32(v.AuxInt) 10517 sym := auxToSym(v.Aux) 10518 ptr := v_0 10519 if v_1.Op != OpS390XMOVWZreg { 10520 break 10521 } 10522 x := v_1.Args[0] 10523 mem := v_2 10524 v.reset(OpS390XMOVWstore) 10525 v.AuxInt = int32ToAuxInt(off) 10526 v.Aux = symToAux(sym) 10527 v.AddArg3(ptr, x, mem) 10528 return true 10529 } 10530 // match: (MOVWstore [off1] {sym} (ADDconst [off2] ptr) val mem) 10531 // cond: is20Bit(int64(off1)+int64(off2)) 10532 // result: (MOVWstore [off1+off2] {sym} ptr val mem) 10533 for { 10534 off1 := auxIntToInt32(v.AuxInt) 10535 sym := auxToSym(v.Aux) 10536 if v_0.Op != OpS390XADDconst { 10537 break 10538 } 10539 off2 := auxIntToInt32(v_0.AuxInt) 10540 ptr := v_0.Args[0] 10541 val := v_1 10542 mem := v_2 10543 if !(is20Bit(int64(off1) + int64(off2))) { 10544 break 10545 } 10546 v.reset(OpS390XMOVWstore) 10547 v.AuxInt = int32ToAuxInt(off1 + off2) 10548 v.Aux = symToAux(sym) 10549 v.AddArg3(ptr, val, mem) 10550 return true 10551 } 10552 // match: (MOVWstore [off] {sym} ptr (MOVDconst [c]) mem) 10553 // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB 10554 // result: (MOVWstoreconst [makeValAndOff(int32(c),off)] {sym} ptr mem) 10555 for { 10556 off := auxIntToInt32(v.AuxInt) 10557 sym := auxToSym(v.Aux) 10558 ptr := v_0 10559 if v_1.Op != OpS390XMOVDconst { 10560 break 10561 } 10562 c := auxIntToInt64(v_1.AuxInt) 10563 mem := v_2 10564 if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) { 10565 break 10566 } 10567 v.reset(OpS390XMOVWstoreconst) 10568 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off)) 10569 v.Aux = symToAux(sym) 10570 v.AddArg2(ptr, mem) 10571 return true 10572 } 10573 // match: (MOVWstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem) 10574 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) 10575 // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 10576 for { 10577 off1 := auxIntToInt32(v.AuxInt) 10578 sym1 := auxToSym(v.Aux) 10579 if v_0.Op != OpS390XMOVDaddr { 10580 break 10581 } 10582 t := v_0.Type 10583 off2 := auxIntToInt32(v_0.AuxInt) 10584 sym2 := auxToSym(v_0.Aux) 10585 base := v_0.Args[0] 10586 val := v_1 10587 mem := v_2 10588 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { 10589 break 10590 } 10591 v.reset(OpS390XMOVWstore) 10592 v.AuxInt = int32ToAuxInt(off1 + off2) 10593 v.Aux = symToAux(mergeSym(sym1, sym2)) 10594 v.AddArg3(base, val, mem) 10595 return true 10596 } 10597 // match: (MOVWstore [i] {s} p w1 x:(MOVWstore [i-4] {s} p w0 mem)) 10598 // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && setPos(v, x.Pos) && clobber(x) 10599 // result: (STM2 [i-4] {s} p w0 w1 mem) 10600 for { 10601 i := auxIntToInt32(v.AuxInt) 10602 s := auxToSym(v.Aux) 10603 p := v_0 10604 w1 := v_1 10605 x := v_2 10606 if x.Op != OpS390XMOVWstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { 10607 break 10608 } 10609 mem := x.Args[2] 10610 if p != x.Args[0] { 10611 break 10612 } 10613 w0 := x.Args[1] 10614 if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && setPos(v, x.Pos) && clobber(x)) { 10615 break 10616 } 10617 v.reset(OpS390XSTM2) 10618 v.AuxInt = int32ToAuxInt(i - 4) 10619 v.Aux = symToAux(s) 10620 v.AddArg4(p, w0, w1, mem) 10621 return true 10622 } 10623 // match: (MOVWstore [i] {s} p w2 x:(STM2 [i-8] {s} p w0 w1 mem)) 10624 // cond: x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x) 10625 // result: (STM3 [i-8] {s} p w0 w1 w2 mem) 10626 for { 10627 i := auxIntToInt32(v.AuxInt) 10628 s := auxToSym(v.Aux) 10629 p := v_0 10630 w2 := v_1 10631 x := v_2 10632 if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s { 10633 break 10634 } 10635 mem := x.Args[3] 10636 if p != x.Args[0] { 10637 break 10638 } 10639 w0 := x.Args[1] 10640 w1 := x.Args[2] 10641 if !(x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)) { 10642 break 10643 } 10644 v.reset(OpS390XSTM3) 10645 v.AuxInt = int32ToAuxInt(i - 8) 10646 v.Aux = symToAux(s) 10647 v.AddArg5(p, w0, w1, w2, mem) 10648 return true 10649 } 10650 // match: (MOVWstore [i] {s} p w3 x:(STM3 [i-12] {s} p w0 w1 w2 mem)) 10651 // cond: x.Uses == 1 && is20Bit(int64(i)-12) && setPos(v, x.Pos) && clobber(x) 10652 // result: (STM4 [i-12] {s} p w0 w1 w2 w3 mem) 10653 for { 10654 i := auxIntToInt32(v.AuxInt) 10655 s := auxToSym(v.Aux) 10656 p := v_0 10657 w3 := v_1 10658 x := v_2 10659 if x.Op != OpS390XSTM3 || auxIntToInt32(x.AuxInt) != i-12 || auxToSym(x.Aux) != s { 10660 break 10661 } 10662 mem := x.Args[4] 10663 if p != x.Args[0] { 10664 break 10665 } 10666 w0 := x.Args[1] 10667 w1 := x.Args[2] 10668 w2 := x.Args[3] 10669 if !(x.Uses == 1 && is20Bit(int64(i)-12) && setPos(v, x.Pos) && clobber(x)) { 10670 break 10671 } 10672 v.reset(OpS390XSTM4) 10673 v.AuxInt = int32ToAuxInt(i - 12) 10674 v.Aux = symToAux(s) 10675 v.AddArg6(p, w0, w1, w2, w3, mem) 10676 return true 10677 } 10678 // match: (MOVWstore [off] {sym} ptr r:(MOVWBR x) mem) 10679 // cond: r.Uses == 1 10680 // result: (MOVWBRstore [off] {sym} ptr x mem) 10681 for { 10682 off := auxIntToInt32(v.AuxInt) 10683 sym := auxToSym(v.Aux) 10684 ptr := v_0 10685 r := v_1 10686 if r.Op != OpS390XMOVWBR { 10687 break 10688 } 10689 x := r.Args[0] 10690 mem := v_2 10691 if !(r.Uses == 1) { 10692 break 10693 } 10694 v.reset(OpS390XMOVWBRstore) 10695 v.AuxInt = int32ToAuxInt(off) 10696 v.Aux = symToAux(sym) 10697 v.AddArg3(ptr, x, mem) 10698 return true 10699 } 10700 return false 10701 } 10702 func rewriteValueS390X_OpS390XMOVWstoreconst(v *Value) bool { 10703 v_1 := v.Args[1] 10704 v_0 := v.Args[0] 10705 // match: (MOVWstoreconst [sc] {s} (ADDconst [off] ptr) mem) 10706 // cond: isU12Bit(sc.Off64()+int64(off)) 10707 // result: (MOVWstoreconst [sc.addOffset32(off)] {s} ptr mem) 10708 for { 10709 sc := auxIntToValAndOff(v.AuxInt) 10710 s := auxToSym(v.Aux) 10711 if v_0.Op != OpS390XADDconst { 10712 break 10713 } 10714 off := auxIntToInt32(v_0.AuxInt) 10715 ptr := v_0.Args[0] 10716 mem := v_1 10717 if !(isU12Bit(sc.Off64() + int64(off))) { 10718 break 10719 } 10720 v.reset(OpS390XMOVWstoreconst) 10721 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 10722 v.Aux = symToAux(s) 10723 v.AddArg2(ptr, mem) 10724 return true 10725 } 10726 // match: (MOVWstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) 10727 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) 10728 // result: (MOVWstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 10729 for { 10730 sc := auxIntToValAndOff(v.AuxInt) 10731 sym1 := auxToSym(v.Aux) 10732 if v_0.Op != OpS390XMOVDaddr { 10733 break 10734 } 10735 off := auxIntToInt32(v_0.AuxInt) 10736 sym2 := auxToSym(v_0.Aux) 10737 ptr := v_0.Args[0] 10738 mem := v_1 10739 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { 10740 break 10741 } 10742 v.reset(OpS390XMOVWstoreconst) 10743 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 10744 v.Aux = symToAux(mergeSym(sym1, sym2)) 10745 v.AddArg2(ptr, mem) 10746 return true 10747 } 10748 return false 10749 } 10750 func rewriteValueS390X_OpS390XMOVWstoreidx(v *Value) bool { 10751 v_3 := v.Args[3] 10752 v_2 := v.Args[2] 10753 v_1 := v.Args[1] 10754 v_0 := v.Args[0] 10755 // match: (MOVWstoreidx [off] {sym} ptr idx r:(MOVWBR x) mem) 10756 // cond: r.Uses == 1 10757 // result: (MOVWBRstoreidx [off] {sym} ptr idx x mem) 10758 for { 10759 off := auxIntToInt32(v.AuxInt) 10760 sym := auxToSym(v.Aux) 10761 ptr := v_0 10762 idx := v_1 10763 r := v_2 10764 if r.Op != OpS390XMOVWBR { 10765 break 10766 } 10767 x := r.Args[0] 10768 mem := v_3 10769 if !(r.Uses == 1) { 10770 break 10771 } 10772 v.reset(OpS390XMOVWBRstoreidx) 10773 v.AuxInt = int32ToAuxInt(off) 10774 v.Aux = symToAux(sym) 10775 v.AddArg4(ptr, idx, x, mem) 10776 return true 10777 } 10778 return false 10779 } 10780 func rewriteValueS390X_OpS390XMULLD(v *Value) bool { 10781 v_1 := v.Args[1] 10782 v_0 := v.Args[0] 10783 // match: (MULLD x (MOVDconst [c])) 10784 // cond: is32Bit(c) 10785 // result: (MULLDconst [int32(c)] x) 10786 for { 10787 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 10788 x := v_0 10789 if v_1.Op != OpS390XMOVDconst { 10790 continue 10791 } 10792 c := auxIntToInt64(v_1.AuxInt) 10793 if !(is32Bit(c)) { 10794 continue 10795 } 10796 v.reset(OpS390XMULLDconst) 10797 v.AuxInt = int32ToAuxInt(int32(c)) 10798 v.AddArg(x) 10799 return true 10800 } 10801 break 10802 } 10803 // match: (MULLD <t> x g:(MOVDload [off] {sym} ptr mem)) 10804 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 10805 // result: (MULLDload <t> [off] {sym} x ptr mem) 10806 for { 10807 t := v.Type 10808 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 10809 x := v_0 10810 g := v_1 10811 if g.Op != OpS390XMOVDload { 10812 continue 10813 } 10814 off := auxIntToInt32(g.AuxInt) 10815 sym := auxToSym(g.Aux) 10816 mem := g.Args[1] 10817 ptr := g.Args[0] 10818 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 10819 continue 10820 } 10821 v.reset(OpS390XMULLDload) 10822 v.Type = t 10823 v.AuxInt = int32ToAuxInt(off) 10824 v.Aux = symToAux(sym) 10825 v.AddArg3(x, ptr, mem) 10826 return true 10827 } 10828 break 10829 } 10830 return false 10831 } 10832 func rewriteValueS390X_OpS390XMULLDconst(v *Value) bool { 10833 v_0 := v.Args[0] 10834 b := v.Block 10835 // match: (MULLDconst <t> x [c]) 10836 // cond: isPowerOfTwo32(c&(c-1)) 10837 // result: (ADD (SLDconst <t> x [uint8(log32(c&(c-1)))]) (SLDconst <t> x [uint8(log32(c&^(c-1)))])) 10838 for { 10839 t := v.Type 10840 c := auxIntToInt32(v.AuxInt) 10841 x := v_0 10842 if !(isPowerOfTwo32(c & (c - 1))) { 10843 break 10844 } 10845 v.reset(OpS390XADD) 10846 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 10847 v0.AuxInt = uint8ToAuxInt(uint8(log32(c & (c - 1)))) 10848 v0.AddArg(x) 10849 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 10850 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1)))) 10851 v1.AddArg(x) 10852 v.AddArg2(v0, v1) 10853 return true 10854 } 10855 // match: (MULLDconst <t> x [c]) 10856 // cond: isPowerOfTwo32(c+(c&^(c-1))) 10857 // result: (SUB (SLDconst <t> x [uint8(log32(c+(c&^(c-1))))]) (SLDconst <t> x [uint8(log32(c&^(c-1)))])) 10858 for { 10859 t := v.Type 10860 c := auxIntToInt32(v.AuxInt) 10861 x := v_0 10862 if !(isPowerOfTwo32(c + (c &^ (c - 1)))) { 10863 break 10864 } 10865 v.reset(OpS390XSUB) 10866 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 10867 v0.AuxInt = uint8ToAuxInt(uint8(log32(c + (c &^ (c - 1))))) 10868 v0.AddArg(x) 10869 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 10870 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1)))) 10871 v1.AddArg(x) 10872 v.AddArg2(v0, v1) 10873 return true 10874 } 10875 // match: (MULLDconst <t> x [c]) 10876 // cond: isPowerOfTwo32(-c+(-c&^(-c-1))) 10877 // result: (SUB (SLDconst <t> x [uint8(log32(-c&^(-c-1)))]) (SLDconst <t> x [uint8(log32(-c+(-c&^(-c-1))))])) 10878 for { 10879 t := v.Type 10880 c := auxIntToInt32(v.AuxInt) 10881 x := v_0 10882 if !(isPowerOfTwo32(-c + (-c &^ (-c - 1)))) { 10883 break 10884 } 10885 v.reset(OpS390XSUB) 10886 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 10887 v0.AuxInt = uint8ToAuxInt(uint8(log32(-c &^ (-c - 1)))) 10888 v0.AddArg(x) 10889 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 10890 v1.AuxInt = uint8ToAuxInt(uint8(log32(-c + (-c &^ (-c - 1))))) 10891 v1.AddArg(x) 10892 v.AddArg2(v0, v1) 10893 return true 10894 } 10895 // match: (MULLDconst [c] (MOVDconst [d])) 10896 // result: (MOVDconst [int64(c)*d]) 10897 for { 10898 c := auxIntToInt32(v.AuxInt) 10899 if v_0.Op != OpS390XMOVDconst { 10900 break 10901 } 10902 d := auxIntToInt64(v_0.AuxInt) 10903 v.reset(OpS390XMOVDconst) 10904 v.AuxInt = int64ToAuxInt(int64(c) * d) 10905 return true 10906 } 10907 return false 10908 } 10909 func rewriteValueS390X_OpS390XMULLDload(v *Value) bool { 10910 v_2 := v.Args[2] 10911 v_1 := v.Args[1] 10912 v_0 := v.Args[0] 10913 b := v.Block 10914 // match: (MULLDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 10915 // cond: isSamePtr(ptr1, ptr2) 10916 // result: (MULLD x (LGDR <t> y)) 10917 for { 10918 t := v.Type 10919 off := auxIntToInt32(v.AuxInt) 10920 sym := auxToSym(v.Aux) 10921 x := v_0 10922 ptr1 := v_1 10923 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 10924 break 10925 } 10926 y := v_2.Args[1] 10927 ptr2 := v_2.Args[0] 10928 if !(isSamePtr(ptr1, ptr2)) { 10929 break 10930 } 10931 v.reset(OpS390XMULLD) 10932 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 10933 v0.AddArg(y) 10934 v.AddArg2(x, v0) 10935 return true 10936 } 10937 // match: (MULLDload [off1] {sym} x (ADDconst [off2] ptr) mem) 10938 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 10939 // result: (MULLDload [off1+off2] {sym} x ptr mem) 10940 for { 10941 off1 := auxIntToInt32(v.AuxInt) 10942 sym := auxToSym(v.Aux) 10943 x := v_0 10944 if v_1.Op != OpS390XADDconst { 10945 break 10946 } 10947 off2 := auxIntToInt32(v_1.AuxInt) 10948 ptr := v_1.Args[0] 10949 mem := v_2 10950 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 10951 break 10952 } 10953 v.reset(OpS390XMULLDload) 10954 v.AuxInt = int32ToAuxInt(off1 + off2) 10955 v.Aux = symToAux(sym) 10956 v.AddArg3(x, ptr, mem) 10957 return true 10958 } 10959 // match: (MULLDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 10960 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 10961 // result: (MULLDload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 10962 for { 10963 o1 := auxIntToInt32(v.AuxInt) 10964 s1 := auxToSym(v.Aux) 10965 x := v_0 10966 if v_1.Op != OpS390XMOVDaddr { 10967 break 10968 } 10969 o2 := auxIntToInt32(v_1.AuxInt) 10970 s2 := auxToSym(v_1.Aux) 10971 ptr := v_1.Args[0] 10972 mem := v_2 10973 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 10974 break 10975 } 10976 v.reset(OpS390XMULLDload) 10977 v.AuxInt = int32ToAuxInt(o1 + o2) 10978 v.Aux = symToAux(mergeSym(s1, s2)) 10979 v.AddArg3(x, ptr, mem) 10980 return true 10981 } 10982 return false 10983 } 10984 func rewriteValueS390X_OpS390XMULLW(v *Value) bool { 10985 v_1 := v.Args[1] 10986 v_0 := v.Args[0] 10987 // match: (MULLW x (MOVDconst [c])) 10988 // result: (MULLWconst [int32(c)] x) 10989 for { 10990 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 10991 x := v_0 10992 if v_1.Op != OpS390XMOVDconst { 10993 continue 10994 } 10995 c := auxIntToInt64(v_1.AuxInt) 10996 v.reset(OpS390XMULLWconst) 10997 v.AuxInt = int32ToAuxInt(int32(c)) 10998 v.AddArg(x) 10999 return true 11000 } 11001 break 11002 } 11003 // match: (MULLW <t> x g:(MOVWload [off] {sym} ptr mem)) 11004 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 11005 // result: (MULLWload <t> [off] {sym} x ptr mem) 11006 for { 11007 t := v.Type 11008 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11009 x := v_0 11010 g := v_1 11011 if g.Op != OpS390XMOVWload { 11012 continue 11013 } 11014 off := auxIntToInt32(g.AuxInt) 11015 sym := auxToSym(g.Aux) 11016 mem := g.Args[1] 11017 ptr := g.Args[0] 11018 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 11019 continue 11020 } 11021 v.reset(OpS390XMULLWload) 11022 v.Type = t 11023 v.AuxInt = int32ToAuxInt(off) 11024 v.Aux = symToAux(sym) 11025 v.AddArg3(x, ptr, mem) 11026 return true 11027 } 11028 break 11029 } 11030 // match: (MULLW <t> x g:(MOVWZload [off] {sym} ptr mem)) 11031 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 11032 // result: (MULLWload <t> [off] {sym} x ptr mem) 11033 for { 11034 t := v.Type 11035 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11036 x := v_0 11037 g := v_1 11038 if g.Op != OpS390XMOVWZload { 11039 continue 11040 } 11041 off := auxIntToInt32(g.AuxInt) 11042 sym := auxToSym(g.Aux) 11043 mem := g.Args[1] 11044 ptr := g.Args[0] 11045 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 11046 continue 11047 } 11048 v.reset(OpS390XMULLWload) 11049 v.Type = t 11050 v.AuxInt = int32ToAuxInt(off) 11051 v.Aux = symToAux(sym) 11052 v.AddArg3(x, ptr, mem) 11053 return true 11054 } 11055 break 11056 } 11057 return false 11058 } 11059 func rewriteValueS390X_OpS390XMULLWconst(v *Value) bool { 11060 v_0 := v.Args[0] 11061 b := v.Block 11062 // match: (MULLWconst <t> x [c]) 11063 // cond: isPowerOfTwo32(c&(c-1)) 11064 // result: (ADDW (SLWconst <t> x [uint8(log32(c&(c-1)))]) (SLWconst <t> x [uint8(log32(c&^(c-1)))])) 11065 for { 11066 t := v.Type 11067 c := auxIntToInt32(v.AuxInt) 11068 x := v_0 11069 if !(isPowerOfTwo32(c & (c - 1))) { 11070 break 11071 } 11072 v.reset(OpS390XADDW) 11073 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11074 v0.AuxInt = uint8ToAuxInt(uint8(log32(c & (c - 1)))) 11075 v0.AddArg(x) 11076 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11077 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1)))) 11078 v1.AddArg(x) 11079 v.AddArg2(v0, v1) 11080 return true 11081 } 11082 // match: (MULLWconst <t> x [c]) 11083 // cond: isPowerOfTwo32(c+(c&^(c-1))) 11084 // result: (SUBW (SLWconst <t> x [uint8(log32(c+(c&^(c-1))))]) (SLWconst <t> x [uint8(log32(c&^(c-1)))])) 11085 for { 11086 t := v.Type 11087 c := auxIntToInt32(v.AuxInt) 11088 x := v_0 11089 if !(isPowerOfTwo32(c + (c &^ (c - 1)))) { 11090 break 11091 } 11092 v.reset(OpS390XSUBW) 11093 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11094 v0.AuxInt = uint8ToAuxInt(uint8(log32(c + (c &^ (c - 1))))) 11095 v0.AddArg(x) 11096 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11097 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1)))) 11098 v1.AddArg(x) 11099 v.AddArg2(v0, v1) 11100 return true 11101 } 11102 // match: (MULLWconst <t> x [c]) 11103 // cond: isPowerOfTwo32(-c+(-c&^(-c-1))) 11104 // result: (SUBW (SLWconst <t> x [uint8(log32(-c&^(-c-1)))]) (SLWconst <t> x [uint8(log32(-c+(-c&^(-c-1))))])) 11105 for { 11106 t := v.Type 11107 c := auxIntToInt32(v.AuxInt) 11108 x := v_0 11109 if !(isPowerOfTwo32(-c + (-c &^ (-c - 1)))) { 11110 break 11111 } 11112 v.reset(OpS390XSUBW) 11113 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11114 v0.AuxInt = uint8ToAuxInt(uint8(log32(-c &^ (-c - 1)))) 11115 v0.AddArg(x) 11116 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11117 v1.AuxInt = uint8ToAuxInt(uint8(log32(-c + (-c &^ (-c - 1))))) 11118 v1.AddArg(x) 11119 v.AddArg2(v0, v1) 11120 return true 11121 } 11122 // match: (MULLWconst [c] (MOVDconst [d])) 11123 // result: (MOVDconst [int64(c*int32(d))]) 11124 for { 11125 c := auxIntToInt32(v.AuxInt) 11126 if v_0.Op != OpS390XMOVDconst { 11127 break 11128 } 11129 d := auxIntToInt64(v_0.AuxInt) 11130 v.reset(OpS390XMOVDconst) 11131 v.AuxInt = int64ToAuxInt(int64(c * int32(d))) 11132 return true 11133 } 11134 return false 11135 } 11136 func rewriteValueS390X_OpS390XMULLWload(v *Value) bool { 11137 v_2 := v.Args[2] 11138 v_1 := v.Args[1] 11139 v_0 := v.Args[0] 11140 // match: (MULLWload [off1] {sym} x (ADDconst [off2] ptr) mem) 11141 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 11142 // result: (MULLWload [off1+off2] {sym} x ptr mem) 11143 for { 11144 off1 := auxIntToInt32(v.AuxInt) 11145 sym := auxToSym(v.Aux) 11146 x := v_0 11147 if v_1.Op != OpS390XADDconst { 11148 break 11149 } 11150 off2 := auxIntToInt32(v_1.AuxInt) 11151 ptr := v_1.Args[0] 11152 mem := v_2 11153 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 11154 break 11155 } 11156 v.reset(OpS390XMULLWload) 11157 v.AuxInt = int32ToAuxInt(off1 + off2) 11158 v.Aux = symToAux(sym) 11159 v.AddArg3(x, ptr, mem) 11160 return true 11161 } 11162 // match: (MULLWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 11163 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 11164 // result: (MULLWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 11165 for { 11166 o1 := auxIntToInt32(v.AuxInt) 11167 s1 := auxToSym(v.Aux) 11168 x := v_0 11169 if v_1.Op != OpS390XMOVDaddr { 11170 break 11171 } 11172 o2 := auxIntToInt32(v_1.AuxInt) 11173 s2 := auxToSym(v_1.Aux) 11174 ptr := v_1.Args[0] 11175 mem := v_2 11176 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 11177 break 11178 } 11179 v.reset(OpS390XMULLWload) 11180 v.AuxInt = int32ToAuxInt(o1 + o2) 11181 v.Aux = symToAux(mergeSym(s1, s2)) 11182 v.AddArg3(x, ptr, mem) 11183 return true 11184 } 11185 return false 11186 } 11187 func rewriteValueS390X_OpS390XNEG(v *Value) bool { 11188 v_0 := v.Args[0] 11189 // match: (NEG (MOVDconst [c])) 11190 // result: (MOVDconst [-c]) 11191 for { 11192 if v_0.Op != OpS390XMOVDconst { 11193 break 11194 } 11195 c := auxIntToInt64(v_0.AuxInt) 11196 v.reset(OpS390XMOVDconst) 11197 v.AuxInt = int64ToAuxInt(-c) 11198 return true 11199 } 11200 // match: (NEG (ADDconst [c] (NEG x))) 11201 // cond: c != -(1<<31) 11202 // result: (ADDconst [-c] x) 11203 for { 11204 if v_0.Op != OpS390XADDconst { 11205 break 11206 } 11207 c := auxIntToInt32(v_0.AuxInt) 11208 v_0_0 := v_0.Args[0] 11209 if v_0_0.Op != OpS390XNEG { 11210 break 11211 } 11212 x := v_0_0.Args[0] 11213 if !(c != -(1 << 31)) { 11214 break 11215 } 11216 v.reset(OpS390XADDconst) 11217 v.AuxInt = int32ToAuxInt(-c) 11218 v.AddArg(x) 11219 return true 11220 } 11221 return false 11222 } 11223 func rewriteValueS390X_OpS390XNEGW(v *Value) bool { 11224 v_0 := v.Args[0] 11225 // match: (NEGW (MOVDconst [c])) 11226 // result: (MOVDconst [int64(int32(-c))]) 11227 for { 11228 if v_0.Op != OpS390XMOVDconst { 11229 break 11230 } 11231 c := auxIntToInt64(v_0.AuxInt) 11232 v.reset(OpS390XMOVDconst) 11233 v.AuxInt = int64ToAuxInt(int64(int32(-c))) 11234 return true 11235 } 11236 return false 11237 } 11238 func rewriteValueS390X_OpS390XNOT(v *Value) bool { 11239 v_0 := v.Args[0] 11240 b := v.Block 11241 typ := &b.Func.Config.Types 11242 // match: (NOT x) 11243 // result: (XOR (MOVDconst [-1]) x) 11244 for { 11245 x := v_0 11246 v.reset(OpS390XXOR) 11247 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 11248 v0.AuxInt = int64ToAuxInt(-1) 11249 v.AddArg2(v0, x) 11250 return true 11251 } 11252 } 11253 func rewriteValueS390X_OpS390XNOTW(v *Value) bool { 11254 v_0 := v.Args[0] 11255 // match: (NOTW x) 11256 // result: (XORWconst [-1] x) 11257 for { 11258 x := v_0 11259 v.reset(OpS390XXORWconst) 11260 v.AuxInt = int32ToAuxInt(-1) 11261 v.AddArg(x) 11262 return true 11263 } 11264 } 11265 func rewriteValueS390X_OpS390XOR(v *Value) bool { 11266 v_1 := v.Args[1] 11267 v_0 := v.Args[0] 11268 b := v.Block 11269 // match: (OR x (MOVDconst [c])) 11270 // cond: isU32Bit(c) 11271 // result: (ORconst [c] x) 11272 for { 11273 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11274 x := v_0 11275 if v_1.Op != OpS390XMOVDconst { 11276 continue 11277 } 11278 c := auxIntToInt64(v_1.AuxInt) 11279 if !(isU32Bit(c)) { 11280 continue 11281 } 11282 v.reset(OpS390XORconst) 11283 v.AuxInt = int64ToAuxInt(c) 11284 v.AddArg(x) 11285 return true 11286 } 11287 break 11288 } 11289 // match: (OR (MOVDconst [-1<<63]) (LGDR <t> x)) 11290 // result: (LGDR <t> (LNDFR <x.Type> x)) 11291 for { 11292 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11293 if v_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0.AuxInt) != -1<<63 || v_1.Op != OpS390XLGDR { 11294 continue 11295 } 11296 t := v_1.Type 11297 x := v_1.Args[0] 11298 v.reset(OpS390XLGDR) 11299 v.Type = t 11300 v0 := b.NewValue0(v.Pos, OpS390XLNDFR, x.Type) 11301 v0.AddArg(x) 11302 v.AddArg(v0) 11303 return true 11304 } 11305 break 11306 } 11307 // match: (OR (RISBGZ (LGDR x) {r}) (LGDR (LPDFR <t> y))) 11308 // cond: r == s390x.NewRotateParams(0, 0, 0) 11309 // result: (LGDR (CPSDR <t> y x)) 11310 for { 11311 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11312 if v_0.Op != OpS390XRISBGZ { 11313 continue 11314 } 11315 r := auxToS390xRotateParams(v_0.Aux) 11316 v_0_0 := v_0.Args[0] 11317 if v_0_0.Op != OpS390XLGDR { 11318 continue 11319 } 11320 x := v_0_0.Args[0] 11321 if v_1.Op != OpS390XLGDR { 11322 continue 11323 } 11324 v_1_0 := v_1.Args[0] 11325 if v_1_0.Op != OpS390XLPDFR { 11326 continue 11327 } 11328 t := v_1_0.Type 11329 y := v_1_0.Args[0] 11330 if !(r == s390x.NewRotateParams(0, 0, 0)) { 11331 continue 11332 } 11333 v.reset(OpS390XLGDR) 11334 v0 := b.NewValue0(v.Pos, OpS390XCPSDR, t) 11335 v0.AddArg2(y, x) 11336 v.AddArg(v0) 11337 return true 11338 } 11339 break 11340 } 11341 // match: (OR (RISBGZ (LGDR x) {r}) (MOVDconst [c])) 11342 // cond: c >= 0 && r == s390x.NewRotateParams(0, 0, 0) 11343 // result: (LGDR (CPSDR <x.Type> (FMOVDconst <x.Type> [math.Float64frombits(uint64(c))]) x)) 11344 for { 11345 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11346 if v_0.Op != OpS390XRISBGZ { 11347 continue 11348 } 11349 r := auxToS390xRotateParams(v_0.Aux) 11350 v_0_0 := v_0.Args[0] 11351 if v_0_0.Op != OpS390XLGDR { 11352 continue 11353 } 11354 x := v_0_0.Args[0] 11355 if v_1.Op != OpS390XMOVDconst { 11356 continue 11357 } 11358 c := auxIntToInt64(v_1.AuxInt) 11359 if !(c >= 0 && r == s390x.NewRotateParams(0, 0, 0)) { 11360 continue 11361 } 11362 v.reset(OpS390XLGDR) 11363 v0 := b.NewValue0(v.Pos, OpS390XCPSDR, x.Type) 11364 v1 := b.NewValue0(v.Pos, OpS390XFMOVDconst, x.Type) 11365 v1.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c))) 11366 v0.AddArg2(v1, x) 11367 v.AddArg(v0) 11368 return true 11369 } 11370 break 11371 } 11372 // match: (OR (MOVDconst [c]) (MOVDconst [d])) 11373 // result: (MOVDconst [c|d]) 11374 for { 11375 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11376 if v_0.Op != OpS390XMOVDconst { 11377 continue 11378 } 11379 c := auxIntToInt64(v_0.AuxInt) 11380 if v_1.Op != OpS390XMOVDconst { 11381 continue 11382 } 11383 d := auxIntToInt64(v_1.AuxInt) 11384 v.reset(OpS390XMOVDconst) 11385 v.AuxInt = int64ToAuxInt(c | d) 11386 return true 11387 } 11388 break 11389 } 11390 // match: (OR x x) 11391 // result: x 11392 for { 11393 x := v_0 11394 if x != v_1 { 11395 break 11396 } 11397 v.copyOf(x) 11398 return true 11399 } 11400 // match: (OR <t> x g:(MOVDload [off] {sym} ptr mem)) 11401 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 11402 // result: (ORload <t> [off] {sym} x ptr mem) 11403 for { 11404 t := v.Type 11405 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11406 x := v_0 11407 g := v_1 11408 if g.Op != OpS390XMOVDload { 11409 continue 11410 } 11411 off := auxIntToInt32(g.AuxInt) 11412 sym := auxToSym(g.Aux) 11413 mem := g.Args[1] 11414 ptr := g.Args[0] 11415 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 11416 continue 11417 } 11418 v.reset(OpS390XORload) 11419 v.Type = t 11420 v.AuxInt = int32ToAuxInt(off) 11421 v.Aux = symToAux(sym) 11422 v.AddArg3(x, ptr, mem) 11423 return true 11424 } 11425 break 11426 } 11427 return false 11428 } 11429 func rewriteValueS390X_OpS390XORW(v *Value) bool { 11430 v_1 := v.Args[1] 11431 v_0 := v.Args[0] 11432 // match: (ORW x (MOVDconst [c])) 11433 // result: (ORWconst [int32(c)] x) 11434 for { 11435 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11436 x := v_0 11437 if v_1.Op != OpS390XMOVDconst { 11438 continue 11439 } 11440 c := auxIntToInt64(v_1.AuxInt) 11441 v.reset(OpS390XORWconst) 11442 v.AuxInt = int32ToAuxInt(int32(c)) 11443 v.AddArg(x) 11444 return true 11445 } 11446 break 11447 } 11448 // match: (ORW x x) 11449 // result: x 11450 for { 11451 x := v_0 11452 if x != v_1 { 11453 break 11454 } 11455 v.copyOf(x) 11456 return true 11457 } 11458 // match: (ORW <t> x g:(MOVWload [off] {sym} ptr mem)) 11459 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 11460 // result: (ORWload <t> [off] {sym} x ptr mem) 11461 for { 11462 t := v.Type 11463 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11464 x := v_0 11465 g := v_1 11466 if g.Op != OpS390XMOVWload { 11467 continue 11468 } 11469 off := auxIntToInt32(g.AuxInt) 11470 sym := auxToSym(g.Aux) 11471 mem := g.Args[1] 11472 ptr := g.Args[0] 11473 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 11474 continue 11475 } 11476 v.reset(OpS390XORWload) 11477 v.Type = t 11478 v.AuxInt = int32ToAuxInt(off) 11479 v.Aux = symToAux(sym) 11480 v.AddArg3(x, ptr, mem) 11481 return true 11482 } 11483 break 11484 } 11485 // match: (ORW <t> x g:(MOVWZload [off] {sym} ptr mem)) 11486 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 11487 // result: (ORWload <t> [off] {sym} x ptr mem) 11488 for { 11489 t := v.Type 11490 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11491 x := v_0 11492 g := v_1 11493 if g.Op != OpS390XMOVWZload { 11494 continue 11495 } 11496 off := auxIntToInt32(g.AuxInt) 11497 sym := auxToSym(g.Aux) 11498 mem := g.Args[1] 11499 ptr := g.Args[0] 11500 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 11501 continue 11502 } 11503 v.reset(OpS390XORWload) 11504 v.Type = t 11505 v.AuxInt = int32ToAuxInt(off) 11506 v.Aux = symToAux(sym) 11507 v.AddArg3(x, ptr, mem) 11508 return true 11509 } 11510 break 11511 } 11512 return false 11513 } 11514 func rewriteValueS390X_OpS390XORWconst(v *Value) bool { 11515 v_0 := v.Args[0] 11516 // match: (ORWconst [c] x) 11517 // cond: int32(c)==0 11518 // result: x 11519 for { 11520 c := auxIntToInt32(v.AuxInt) 11521 x := v_0 11522 if !(int32(c) == 0) { 11523 break 11524 } 11525 v.copyOf(x) 11526 return true 11527 } 11528 // match: (ORWconst [c] _) 11529 // cond: int32(c)==-1 11530 // result: (MOVDconst [-1]) 11531 for { 11532 c := auxIntToInt32(v.AuxInt) 11533 if !(int32(c) == -1) { 11534 break 11535 } 11536 v.reset(OpS390XMOVDconst) 11537 v.AuxInt = int64ToAuxInt(-1) 11538 return true 11539 } 11540 // match: (ORWconst [c] (MOVDconst [d])) 11541 // result: (MOVDconst [int64(c)|d]) 11542 for { 11543 c := auxIntToInt32(v.AuxInt) 11544 if v_0.Op != OpS390XMOVDconst { 11545 break 11546 } 11547 d := auxIntToInt64(v_0.AuxInt) 11548 v.reset(OpS390XMOVDconst) 11549 v.AuxInt = int64ToAuxInt(int64(c) | d) 11550 return true 11551 } 11552 return false 11553 } 11554 func rewriteValueS390X_OpS390XORWload(v *Value) bool { 11555 v_2 := v.Args[2] 11556 v_1 := v.Args[1] 11557 v_0 := v.Args[0] 11558 // match: (ORWload [off1] {sym} x (ADDconst [off2] ptr) mem) 11559 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 11560 // result: (ORWload [off1+off2] {sym} x ptr mem) 11561 for { 11562 off1 := auxIntToInt32(v.AuxInt) 11563 sym := auxToSym(v.Aux) 11564 x := v_0 11565 if v_1.Op != OpS390XADDconst { 11566 break 11567 } 11568 off2 := auxIntToInt32(v_1.AuxInt) 11569 ptr := v_1.Args[0] 11570 mem := v_2 11571 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 11572 break 11573 } 11574 v.reset(OpS390XORWload) 11575 v.AuxInt = int32ToAuxInt(off1 + off2) 11576 v.Aux = symToAux(sym) 11577 v.AddArg3(x, ptr, mem) 11578 return true 11579 } 11580 // match: (ORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 11581 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 11582 // result: (ORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 11583 for { 11584 o1 := auxIntToInt32(v.AuxInt) 11585 s1 := auxToSym(v.Aux) 11586 x := v_0 11587 if v_1.Op != OpS390XMOVDaddr { 11588 break 11589 } 11590 o2 := auxIntToInt32(v_1.AuxInt) 11591 s2 := auxToSym(v_1.Aux) 11592 ptr := v_1.Args[0] 11593 mem := v_2 11594 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 11595 break 11596 } 11597 v.reset(OpS390XORWload) 11598 v.AuxInt = int32ToAuxInt(o1 + o2) 11599 v.Aux = symToAux(mergeSym(s1, s2)) 11600 v.AddArg3(x, ptr, mem) 11601 return true 11602 } 11603 return false 11604 } 11605 func rewriteValueS390X_OpS390XORconst(v *Value) bool { 11606 v_0 := v.Args[0] 11607 // match: (ORconst [0] x) 11608 // result: x 11609 for { 11610 if auxIntToInt64(v.AuxInt) != 0 { 11611 break 11612 } 11613 x := v_0 11614 v.copyOf(x) 11615 return true 11616 } 11617 // match: (ORconst [-1] _) 11618 // result: (MOVDconst [-1]) 11619 for { 11620 if auxIntToInt64(v.AuxInt) != -1 { 11621 break 11622 } 11623 v.reset(OpS390XMOVDconst) 11624 v.AuxInt = int64ToAuxInt(-1) 11625 return true 11626 } 11627 // match: (ORconst [c] (MOVDconst [d])) 11628 // result: (MOVDconst [c|d]) 11629 for { 11630 c := auxIntToInt64(v.AuxInt) 11631 if v_0.Op != OpS390XMOVDconst { 11632 break 11633 } 11634 d := auxIntToInt64(v_0.AuxInt) 11635 v.reset(OpS390XMOVDconst) 11636 v.AuxInt = int64ToAuxInt(c | d) 11637 return true 11638 } 11639 return false 11640 } 11641 func rewriteValueS390X_OpS390XORload(v *Value) bool { 11642 v_2 := v.Args[2] 11643 v_1 := v.Args[1] 11644 v_0 := v.Args[0] 11645 b := v.Block 11646 // match: (ORload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 11647 // cond: isSamePtr(ptr1, ptr2) 11648 // result: (OR x (LGDR <t> y)) 11649 for { 11650 t := v.Type 11651 off := auxIntToInt32(v.AuxInt) 11652 sym := auxToSym(v.Aux) 11653 x := v_0 11654 ptr1 := v_1 11655 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 11656 break 11657 } 11658 y := v_2.Args[1] 11659 ptr2 := v_2.Args[0] 11660 if !(isSamePtr(ptr1, ptr2)) { 11661 break 11662 } 11663 v.reset(OpS390XOR) 11664 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 11665 v0.AddArg(y) 11666 v.AddArg2(x, v0) 11667 return true 11668 } 11669 // match: (ORload [off1] {sym} x (ADDconst [off2] ptr) mem) 11670 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 11671 // result: (ORload [off1+off2] {sym} x ptr mem) 11672 for { 11673 off1 := auxIntToInt32(v.AuxInt) 11674 sym := auxToSym(v.Aux) 11675 x := v_0 11676 if v_1.Op != OpS390XADDconst { 11677 break 11678 } 11679 off2 := auxIntToInt32(v_1.AuxInt) 11680 ptr := v_1.Args[0] 11681 mem := v_2 11682 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 11683 break 11684 } 11685 v.reset(OpS390XORload) 11686 v.AuxInt = int32ToAuxInt(off1 + off2) 11687 v.Aux = symToAux(sym) 11688 v.AddArg3(x, ptr, mem) 11689 return true 11690 } 11691 // match: (ORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 11692 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 11693 // result: (ORload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 11694 for { 11695 o1 := auxIntToInt32(v.AuxInt) 11696 s1 := auxToSym(v.Aux) 11697 x := v_0 11698 if v_1.Op != OpS390XMOVDaddr { 11699 break 11700 } 11701 o2 := auxIntToInt32(v_1.AuxInt) 11702 s2 := auxToSym(v_1.Aux) 11703 ptr := v_1.Args[0] 11704 mem := v_2 11705 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 11706 break 11707 } 11708 v.reset(OpS390XORload) 11709 v.AuxInt = int32ToAuxInt(o1 + o2) 11710 v.Aux = symToAux(mergeSym(s1, s2)) 11711 v.AddArg3(x, ptr, mem) 11712 return true 11713 } 11714 return false 11715 } 11716 func rewriteValueS390X_OpS390XRISBGZ(v *Value) bool { 11717 v_0 := v.Args[0] 11718 b := v.Block 11719 // match: (RISBGZ (MOVWZreg x) {r}) 11720 // cond: r.InMerge(0xffffffff) != nil 11721 // result: (RISBGZ x {*r.InMerge(0xffffffff)}) 11722 for { 11723 r := auxToS390xRotateParams(v.Aux) 11724 if v_0.Op != OpS390XMOVWZreg { 11725 break 11726 } 11727 x := v_0.Args[0] 11728 if !(r.InMerge(0xffffffff) != nil) { 11729 break 11730 } 11731 v.reset(OpS390XRISBGZ) 11732 v.Aux = s390xRotateParamsToAux(*r.InMerge(0xffffffff)) 11733 v.AddArg(x) 11734 return true 11735 } 11736 // match: (RISBGZ (MOVHZreg x) {r}) 11737 // cond: r.InMerge(0x0000ffff) != nil 11738 // result: (RISBGZ x {*r.InMerge(0x0000ffff)}) 11739 for { 11740 r := auxToS390xRotateParams(v.Aux) 11741 if v_0.Op != OpS390XMOVHZreg { 11742 break 11743 } 11744 x := v_0.Args[0] 11745 if !(r.InMerge(0x0000ffff) != nil) { 11746 break 11747 } 11748 v.reset(OpS390XRISBGZ) 11749 v.Aux = s390xRotateParamsToAux(*r.InMerge(0x0000ffff)) 11750 v.AddArg(x) 11751 return true 11752 } 11753 // match: (RISBGZ (MOVBZreg x) {r}) 11754 // cond: r.InMerge(0x000000ff) != nil 11755 // result: (RISBGZ x {*r.InMerge(0x000000ff)}) 11756 for { 11757 r := auxToS390xRotateParams(v.Aux) 11758 if v_0.Op != OpS390XMOVBZreg { 11759 break 11760 } 11761 x := v_0.Args[0] 11762 if !(r.InMerge(0x000000ff) != nil) { 11763 break 11764 } 11765 v.reset(OpS390XRISBGZ) 11766 v.Aux = s390xRotateParamsToAux(*r.InMerge(0x000000ff)) 11767 v.AddArg(x) 11768 return true 11769 } 11770 // match: (RISBGZ (SLDconst x [c]) {r}) 11771 // cond: r.InMerge(^uint64(0)<<c) != nil 11772 // result: (RISBGZ x {(*r.InMerge(^uint64(0)<<c)).RotateLeft(c)}) 11773 for { 11774 r := auxToS390xRotateParams(v.Aux) 11775 if v_0.Op != OpS390XSLDconst { 11776 break 11777 } 11778 c := auxIntToUint8(v_0.AuxInt) 11779 x := v_0.Args[0] 11780 if !(r.InMerge(^uint64(0)<<c) != nil) { 11781 break 11782 } 11783 v.reset(OpS390XRISBGZ) 11784 v.Aux = s390xRotateParamsToAux((*r.InMerge(^uint64(0) << c)).RotateLeft(c)) 11785 v.AddArg(x) 11786 return true 11787 } 11788 // match: (RISBGZ (SRDconst x [c]) {r}) 11789 // cond: r.InMerge(^uint64(0)>>c) != nil 11790 // result: (RISBGZ x {(*r.InMerge(^uint64(0)>>c)).RotateLeft(-c)}) 11791 for { 11792 r := auxToS390xRotateParams(v.Aux) 11793 if v_0.Op != OpS390XSRDconst { 11794 break 11795 } 11796 c := auxIntToUint8(v_0.AuxInt) 11797 x := v_0.Args[0] 11798 if !(r.InMerge(^uint64(0)>>c) != nil) { 11799 break 11800 } 11801 v.reset(OpS390XRISBGZ) 11802 v.Aux = s390xRotateParamsToAux((*r.InMerge(^uint64(0) >> c)).RotateLeft(-c)) 11803 v.AddArg(x) 11804 return true 11805 } 11806 // match: (RISBGZ (RISBGZ x {y}) {z}) 11807 // cond: z.InMerge(y.OutMask()) != nil 11808 // result: (RISBGZ x {(*z.InMerge(y.OutMask())).RotateLeft(y.Amount)}) 11809 for { 11810 z := auxToS390xRotateParams(v.Aux) 11811 if v_0.Op != OpS390XRISBGZ { 11812 break 11813 } 11814 y := auxToS390xRotateParams(v_0.Aux) 11815 x := v_0.Args[0] 11816 if !(z.InMerge(y.OutMask()) != nil) { 11817 break 11818 } 11819 v.reset(OpS390XRISBGZ) 11820 v.Aux = s390xRotateParamsToAux((*z.InMerge(y.OutMask())).RotateLeft(y.Amount)) 11821 v.AddArg(x) 11822 return true 11823 } 11824 // match: (RISBGZ x {r}) 11825 // cond: r.End == 63 && r.Start == -r.Amount&63 11826 // result: (SRDconst x [-r.Amount&63]) 11827 for { 11828 r := auxToS390xRotateParams(v.Aux) 11829 x := v_0 11830 if !(r.End == 63 && r.Start == -r.Amount&63) { 11831 break 11832 } 11833 v.reset(OpS390XSRDconst) 11834 v.AuxInt = uint8ToAuxInt(-r.Amount & 63) 11835 v.AddArg(x) 11836 return true 11837 } 11838 // match: (RISBGZ x {r}) 11839 // cond: r.Start == 0 && r.End == 63-r.Amount 11840 // result: (SLDconst x [r.Amount]) 11841 for { 11842 r := auxToS390xRotateParams(v.Aux) 11843 x := v_0 11844 if !(r.Start == 0 && r.End == 63-r.Amount) { 11845 break 11846 } 11847 v.reset(OpS390XSLDconst) 11848 v.AuxInt = uint8ToAuxInt(r.Amount) 11849 v.AddArg(x) 11850 return true 11851 } 11852 // match: (RISBGZ (SRADconst x [c]) {r}) 11853 // cond: r.Start == r.End && (r.Start+r.Amount)&63 <= c 11854 // result: (RISBGZ x {s390x.NewRotateParams(r.Start, r.Start, -r.Start&63)}) 11855 for { 11856 r := auxToS390xRotateParams(v.Aux) 11857 if v_0.Op != OpS390XSRADconst { 11858 break 11859 } 11860 c := auxIntToUint8(v_0.AuxInt) 11861 x := v_0.Args[0] 11862 if !(r.Start == r.End && (r.Start+r.Amount)&63 <= c) { 11863 break 11864 } 11865 v.reset(OpS390XRISBGZ) 11866 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(r.Start, r.Start, -r.Start&63)) 11867 v.AddArg(x) 11868 return true 11869 } 11870 // match: (RISBGZ x {r}) 11871 // cond: r == s390x.NewRotateParams(56, 63, 0) 11872 // result: (MOVBZreg x) 11873 for { 11874 r := auxToS390xRotateParams(v.Aux) 11875 x := v_0 11876 if !(r == s390x.NewRotateParams(56, 63, 0)) { 11877 break 11878 } 11879 v.reset(OpS390XMOVBZreg) 11880 v.AddArg(x) 11881 return true 11882 } 11883 // match: (RISBGZ x {r}) 11884 // cond: r == s390x.NewRotateParams(48, 63, 0) 11885 // result: (MOVHZreg x) 11886 for { 11887 r := auxToS390xRotateParams(v.Aux) 11888 x := v_0 11889 if !(r == s390x.NewRotateParams(48, 63, 0)) { 11890 break 11891 } 11892 v.reset(OpS390XMOVHZreg) 11893 v.AddArg(x) 11894 return true 11895 } 11896 // match: (RISBGZ x {r}) 11897 // cond: r == s390x.NewRotateParams(32, 63, 0) 11898 // result: (MOVWZreg x) 11899 for { 11900 r := auxToS390xRotateParams(v.Aux) 11901 x := v_0 11902 if !(r == s390x.NewRotateParams(32, 63, 0)) { 11903 break 11904 } 11905 v.reset(OpS390XMOVWZreg) 11906 v.AddArg(x) 11907 return true 11908 } 11909 // match: (RISBGZ (LGDR <t> x) {r}) 11910 // cond: r == s390x.NewRotateParams(1, 63, 0) 11911 // result: (LGDR <t> (LPDFR <x.Type> x)) 11912 for { 11913 r := auxToS390xRotateParams(v.Aux) 11914 if v_0.Op != OpS390XLGDR { 11915 break 11916 } 11917 t := v_0.Type 11918 x := v_0.Args[0] 11919 if !(r == s390x.NewRotateParams(1, 63, 0)) { 11920 break 11921 } 11922 v.reset(OpS390XLGDR) 11923 v.Type = t 11924 v0 := b.NewValue0(v.Pos, OpS390XLPDFR, x.Type) 11925 v0.AddArg(x) 11926 v.AddArg(v0) 11927 return true 11928 } 11929 return false 11930 } 11931 func rewriteValueS390X_OpS390XRLL(v *Value) bool { 11932 v_1 := v.Args[1] 11933 v_0 := v.Args[0] 11934 // match: (RLL x (MOVDconst [c])) 11935 // result: (RLLconst x [uint8(c&31)]) 11936 for { 11937 x := v_0 11938 if v_1.Op != OpS390XMOVDconst { 11939 break 11940 } 11941 c := auxIntToInt64(v_1.AuxInt) 11942 v.reset(OpS390XRLLconst) 11943 v.AuxInt = uint8ToAuxInt(uint8(c & 31)) 11944 v.AddArg(x) 11945 return true 11946 } 11947 return false 11948 } 11949 func rewriteValueS390X_OpS390XRLLG(v *Value) bool { 11950 v_1 := v.Args[1] 11951 v_0 := v.Args[0] 11952 // match: (RLLG x (MOVDconst [c])) 11953 // result: (RISBGZ x {s390x.NewRotateParams(0, 63, uint8(c&63))}) 11954 for { 11955 x := v_0 11956 if v_1.Op != OpS390XMOVDconst { 11957 break 11958 } 11959 c := auxIntToInt64(v_1.AuxInt) 11960 v.reset(OpS390XRISBGZ) 11961 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(0, 63, uint8(c&63))) 11962 v.AddArg(x) 11963 return true 11964 } 11965 return false 11966 } 11967 func rewriteValueS390X_OpS390XSLD(v *Value) bool { 11968 v_1 := v.Args[1] 11969 v_0 := v.Args[0] 11970 b := v.Block 11971 typ := &b.Func.Config.Types 11972 // match: (SLD x (MOVDconst [c])) 11973 // result: (SLDconst x [uint8(c&63)]) 11974 for { 11975 x := v_0 11976 if v_1.Op != OpS390XMOVDconst { 11977 break 11978 } 11979 c := auxIntToInt64(v_1.AuxInt) 11980 v.reset(OpS390XSLDconst) 11981 v.AuxInt = uint8ToAuxInt(uint8(c & 63)) 11982 v.AddArg(x) 11983 return true 11984 } 11985 // match: (SLD x (RISBGZ y {r})) 11986 // cond: r.Amount == 0 && r.OutMask()&63 == 63 11987 // result: (SLD x y) 11988 for { 11989 x := v_0 11990 if v_1.Op != OpS390XRISBGZ { 11991 break 11992 } 11993 r := auxToS390xRotateParams(v_1.Aux) 11994 y := v_1.Args[0] 11995 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 11996 break 11997 } 11998 v.reset(OpS390XSLD) 11999 v.AddArg2(x, y) 12000 return true 12001 } 12002 // match: (SLD x (AND (MOVDconst [c]) y)) 12003 // result: (SLD x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 12004 for { 12005 x := v_0 12006 if v_1.Op != OpS390XAND { 12007 break 12008 } 12009 _ = v_1.Args[1] 12010 v_1_0 := v_1.Args[0] 12011 v_1_1 := v_1.Args[1] 12012 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 12013 if v_1_0.Op != OpS390XMOVDconst { 12014 continue 12015 } 12016 c := auxIntToInt64(v_1_0.AuxInt) 12017 y := v_1_1 12018 v.reset(OpS390XSLD) 12019 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 12020 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 12021 v0.AddArg(y) 12022 v.AddArg2(x, v0) 12023 return true 12024 } 12025 break 12026 } 12027 // match: (SLD x (ANDWconst [c] y)) 12028 // cond: c&63 == 63 12029 // result: (SLD x y) 12030 for { 12031 x := v_0 12032 if v_1.Op != OpS390XANDWconst { 12033 break 12034 } 12035 c := auxIntToInt32(v_1.AuxInt) 12036 y := v_1.Args[0] 12037 if !(c&63 == 63) { 12038 break 12039 } 12040 v.reset(OpS390XSLD) 12041 v.AddArg2(x, y) 12042 return true 12043 } 12044 // match: (SLD x (MOVWreg y)) 12045 // result: (SLD x y) 12046 for { 12047 x := v_0 12048 if v_1.Op != OpS390XMOVWreg { 12049 break 12050 } 12051 y := v_1.Args[0] 12052 v.reset(OpS390XSLD) 12053 v.AddArg2(x, y) 12054 return true 12055 } 12056 // match: (SLD x (MOVHreg y)) 12057 // result: (SLD x y) 12058 for { 12059 x := v_0 12060 if v_1.Op != OpS390XMOVHreg { 12061 break 12062 } 12063 y := v_1.Args[0] 12064 v.reset(OpS390XSLD) 12065 v.AddArg2(x, y) 12066 return true 12067 } 12068 // match: (SLD x (MOVBreg y)) 12069 // result: (SLD x y) 12070 for { 12071 x := v_0 12072 if v_1.Op != OpS390XMOVBreg { 12073 break 12074 } 12075 y := v_1.Args[0] 12076 v.reset(OpS390XSLD) 12077 v.AddArg2(x, y) 12078 return true 12079 } 12080 // match: (SLD x (MOVWZreg y)) 12081 // result: (SLD x y) 12082 for { 12083 x := v_0 12084 if v_1.Op != OpS390XMOVWZreg { 12085 break 12086 } 12087 y := v_1.Args[0] 12088 v.reset(OpS390XSLD) 12089 v.AddArg2(x, y) 12090 return true 12091 } 12092 // match: (SLD x (MOVHZreg y)) 12093 // result: (SLD x y) 12094 for { 12095 x := v_0 12096 if v_1.Op != OpS390XMOVHZreg { 12097 break 12098 } 12099 y := v_1.Args[0] 12100 v.reset(OpS390XSLD) 12101 v.AddArg2(x, y) 12102 return true 12103 } 12104 // match: (SLD x (MOVBZreg y)) 12105 // result: (SLD x y) 12106 for { 12107 x := v_0 12108 if v_1.Op != OpS390XMOVBZreg { 12109 break 12110 } 12111 y := v_1.Args[0] 12112 v.reset(OpS390XSLD) 12113 v.AddArg2(x, y) 12114 return true 12115 } 12116 return false 12117 } 12118 func rewriteValueS390X_OpS390XSLDconst(v *Value) bool { 12119 v_0 := v.Args[0] 12120 // match: (SLDconst (SRDconst x [c]) [d]) 12121 // result: (RISBGZ x {s390x.NewRotateParams(uint8(max8(0, int8(c-d))), 63-d, uint8(int8(d-c)&63))}) 12122 for { 12123 d := auxIntToUint8(v.AuxInt) 12124 if v_0.Op != OpS390XSRDconst { 12125 break 12126 } 12127 c := auxIntToUint8(v_0.AuxInt) 12128 x := v_0.Args[0] 12129 v.reset(OpS390XRISBGZ) 12130 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(uint8(max8(0, int8(c-d))), 63-d, uint8(int8(d-c)&63))) 12131 v.AddArg(x) 12132 return true 12133 } 12134 // match: (SLDconst (RISBGZ x {r}) [c]) 12135 // cond: s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask()) != nil 12136 // result: (RISBGZ x {(*s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask())).RotateLeft(r.Amount)}) 12137 for { 12138 c := auxIntToUint8(v.AuxInt) 12139 if v_0.Op != OpS390XRISBGZ { 12140 break 12141 } 12142 r := auxToS390xRotateParams(v_0.Aux) 12143 x := v_0.Args[0] 12144 if !(s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask()) != nil) { 12145 break 12146 } 12147 v.reset(OpS390XRISBGZ) 12148 v.Aux = s390xRotateParamsToAux((*s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask())).RotateLeft(r.Amount)) 12149 v.AddArg(x) 12150 return true 12151 } 12152 // match: (SLDconst x [0]) 12153 // result: x 12154 for { 12155 if auxIntToUint8(v.AuxInt) != 0 { 12156 break 12157 } 12158 x := v_0 12159 v.copyOf(x) 12160 return true 12161 } 12162 return false 12163 } 12164 func rewriteValueS390X_OpS390XSLW(v *Value) bool { 12165 v_1 := v.Args[1] 12166 v_0 := v.Args[0] 12167 b := v.Block 12168 typ := &b.Func.Config.Types 12169 // match: (SLW x (MOVDconst [c])) 12170 // cond: c&32 == 0 12171 // result: (SLWconst x [uint8(c&31)]) 12172 for { 12173 x := v_0 12174 if v_1.Op != OpS390XMOVDconst { 12175 break 12176 } 12177 c := auxIntToInt64(v_1.AuxInt) 12178 if !(c&32 == 0) { 12179 break 12180 } 12181 v.reset(OpS390XSLWconst) 12182 v.AuxInt = uint8ToAuxInt(uint8(c & 31)) 12183 v.AddArg(x) 12184 return true 12185 } 12186 // match: (SLW _ (MOVDconst [c])) 12187 // cond: c&32 != 0 12188 // result: (MOVDconst [0]) 12189 for { 12190 if v_1.Op != OpS390XMOVDconst { 12191 break 12192 } 12193 c := auxIntToInt64(v_1.AuxInt) 12194 if !(c&32 != 0) { 12195 break 12196 } 12197 v.reset(OpS390XMOVDconst) 12198 v.AuxInt = int64ToAuxInt(0) 12199 return true 12200 } 12201 // match: (SLW x (RISBGZ y {r})) 12202 // cond: r.Amount == 0 && r.OutMask()&63 == 63 12203 // result: (SLW x y) 12204 for { 12205 x := v_0 12206 if v_1.Op != OpS390XRISBGZ { 12207 break 12208 } 12209 r := auxToS390xRotateParams(v_1.Aux) 12210 y := v_1.Args[0] 12211 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 12212 break 12213 } 12214 v.reset(OpS390XSLW) 12215 v.AddArg2(x, y) 12216 return true 12217 } 12218 // match: (SLW x (AND (MOVDconst [c]) y)) 12219 // result: (SLW x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 12220 for { 12221 x := v_0 12222 if v_1.Op != OpS390XAND { 12223 break 12224 } 12225 _ = v_1.Args[1] 12226 v_1_0 := v_1.Args[0] 12227 v_1_1 := v_1.Args[1] 12228 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 12229 if v_1_0.Op != OpS390XMOVDconst { 12230 continue 12231 } 12232 c := auxIntToInt64(v_1_0.AuxInt) 12233 y := v_1_1 12234 v.reset(OpS390XSLW) 12235 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 12236 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 12237 v0.AddArg(y) 12238 v.AddArg2(x, v0) 12239 return true 12240 } 12241 break 12242 } 12243 // match: (SLW x (ANDWconst [c] y)) 12244 // cond: c&63 == 63 12245 // result: (SLW x y) 12246 for { 12247 x := v_0 12248 if v_1.Op != OpS390XANDWconst { 12249 break 12250 } 12251 c := auxIntToInt32(v_1.AuxInt) 12252 y := v_1.Args[0] 12253 if !(c&63 == 63) { 12254 break 12255 } 12256 v.reset(OpS390XSLW) 12257 v.AddArg2(x, y) 12258 return true 12259 } 12260 // match: (SLW x (MOVWreg y)) 12261 // result: (SLW x y) 12262 for { 12263 x := v_0 12264 if v_1.Op != OpS390XMOVWreg { 12265 break 12266 } 12267 y := v_1.Args[0] 12268 v.reset(OpS390XSLW) 12269 v.AddArg2(x, y) 12270 return true 12271 } 12272 // match: (SLW x (MOVHreg y)) 12273 // result: (SLW x y) 12274 for { 12275 x := v_0 12276 if v_1.Op != OpS390XMOVHreg { 12277 break 12278 } 12279 y := v_1.Args[0] 12280 v.reset(OpS390XSLW) 12281 v.AddArg2(x, y) 12282 return true 12283 } 12284 // match: (SLW x (MOVBreg y)) 12285 // result: (SLW x y) 12286 for { 12287 x := v_0 12288 if v_1.Op != OpS390XMOVBreg { 12289 break 12290 } 12291 y := v_1.Args[0] 12292 v.reset(OpS390XSLW) 12293 v.AddArg2(x, y) 12294 return true 12295 } 12296 // match: (SLW x (MOVWZreg y)) 12297 // result: (SLW x y) 12298 for { 12299 x := v_0 12300 if v_1.Op != OpS390XMOVWZreg { 12301 break 12302 } 12303 y := v_1.Args[0] 12304 v.reset(OpS390XSLW) 12305 v.AddArg2(x, y) 12306 return true 12307 } 12308 // match: (SLW x (MOVHZreg y)) 12309 // result: (SLW x y) 12310 for { 12311 x := v_0 12312 if v_1.Op != OpS390XMOVHZreg { 12313 break 12314 } 12315 y := v_1.Args[0] 12316 v.reset(OpS390XSLW) 12317 v.AddArg2(x, y) 12318 return true 12319 } 12320 // match: (SLW x (MOVBZreg y)) 12321 // result: (SLW x y) 12322 for { 12323 x := v_0 12324 if v_1.Op != OpS390XMOVBZreg { 12325 break 12326 } 12327 y := v_1.Args[0] 12328 v.reset(OpS390XSLW) 12329 v.AddArg2(x, y) 12330 return true 12331 } 12332 return false 12333 } 12334 func rewriteValueS390X_OpS390XSLWconst(v *Value) bool { 12335 v_0 := v.Args[0] 12336 // match: (SLWconst x [0]) 12337 // result: x 12338 for { 12339 if auxIntToUint8(v.AuxInt) != 0 { 12340 break 12341 } 12342 x := v_0 12343 v.copyOf(x) 12344 return true 12345 } 12346 return false 12347 } 12348 func rewriteValueS390X_OpS390XSRAD(v *Value) bool { 12349 v_1 := v.Args[1] 12350 v_0 := v.Args[0] 12351 b := v.Block 12352 typ := &b.Func.Config.Types 12353 // match: (SRAD x (MOVDconst [c])) 12354 // result: (SRADconst x [uint8(c&63)]) 12355 for { 12356 x := v_0 12357 if v_1.Op != OpS390XMOVDconst { 12358 break 12359 } 12360 c := auxIntToInt64(v_1.AuxInt) 12361 v.reset(OpS390XSRADconst) 12362 v.AuxInt = uint8ToAuxInt(uint8(c & 63)) 12363 v.AddArg(x) 12364 return true 12365 } 12366 // match: (SRAD x (RISBGZ y {r})) 12367 // cond: r.Amount == 0 && r.OutMask()&63 == 63 12368 // result: (SRAD x y) 12369 for { 12370 x := v_0 12371 if v_1.Op != OpS390XRISBGZ { 12372 break 12373 } 12374 r := auxToS390xRotateParams(v_1.Aux) 12375 y := v_1.Args[0] 12376 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 12377 break 12378 } 12379 v.reset(OpS390XSRAD) 12380 v.AddArg2(x, y) 12381 return true 12382 } 12383 // match: (SRAD x (AND (MOVDconst [c]) y)) 12384 // result: (SRAD x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 12385 for { 12386 x := v_0 12387 if v_1.Op != OpS390XAND { 12388 break 12389 } 12390 _ = v_1.Args[1] 12391 v_1_0 := v_1.Args[0] 12392 v_1_1 := v_1.Args[1] 12393 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 12394 if v_1_0.Op != OpS390XMOVDconst { 12395 continue 12396 } 12397 c := auxIntToInt64(v_1_0.AuxInt) 12398 y := v_1_1 12399 v.reset(OpS390XSRAD) 12400 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 12401 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 12402 v0.AddArg(y) 12403 v.AddArg2(x, v0) 12404 return true 12405 } 12406 break 12407 } 12408 // match: (SRAD x (ANDWconst [c] y)) 12409 // cond: c&63 == 63 12410 // result: (SRAD x y) 12411 for { 12412 x := v_0 12413 if v_1.Op != OpS390XANDWconst { 12414 break 12415 } 12416 c := auxIntToInt32(v_1.AuxInt) 12417 y := v_1.Args[0] 12418 if !(c&63 == 63) { 12419 break 12420 } 12421 v.reset(OpS390XSRAD) 12422 v.AddArg2(x, y) 12423 return true 12424 } 12425 // match: (SRAD x (MOVWreg y)) 12426 // result: (SRAD x y) 12427 for { 12428 x := v_0 12429 if v_1.Op != OpS390XMOVWreg { 12430 break 12431 } 12432 y := v_1.Args[0] 12433 v.reset(OpS390XSRAD) 12434 v.AddArg2(x, y) 12435 return true 12436 } 12437 // match: (SRAD x (MOVHreg y)) 12438 // result: (SRAD x y) 12439 for { 12440 x := v_0 12441 if v_1.Op != OpS390XMOVHreg { 12442 break 12443 } 12444 y := v_1.Args[0] 12445 v.reset(OpS390XSRAD) 12446 v.AddArg2(x, y) 12447 return true 12448 } 12449 // match: (SRAD x (MOVBreg y)) 12450 // result: (SRAD x y) 12451 for { 12452 x := v_0 12453 if v_1.Op != OpS390XMOVBreg { 12454 break 12455 } 12456 y := v_1.Args[0] 12457 v.reset(OpS390XSRAD) 12458 v.AddArg2(x, y) 12459 return true 12460 } 12461 // match: (SRAD x (MOVWZreg y)) 12462 // result: (SRAD x y) 12463 for { 12464 x := v_0 12465 if v_1.Op != OpS390XMOVWZreg { 12466 break 12467 } 12468 y := v_1.Args[0] 12469 v.reset(OpS390XSRAD) 12470 v.AddArg2(x, y) 12471 return true 12472 } 12473 // match: (SRAD x (MOVHZreg y)) 12474 // result: (SRAD x y) 12475 for { 12476 x := v_0 12477 if v_1.Op != OpS390XMOVHZreg { 12478 break 12479 } 12480 y := v_1.Args[0] 12481 v.reset(OpS390XSRAD) 12482 v.AddArg2(x, y) 12483 return true 12484 } 12485 // match: (SRAD x (MOVBZreg y)) 12486 // result: (SRAD x y) 12487 for { 12488 x := v_0 12489 if v_1.Op != OpS390XMOVBZreg { 12490 break 12491 } 12492 y := v_1.Args[0] 12493 v.reset(OpS390XSRAD) 12494 v.AddArg2(x, y) 12495 return true 12496 } 12497 return false 12498 } 12499 func rewriteValueS390X_OpS390XSRADconst(v *Value) bool { 12500 v_0 := v.Args[0] 12501 // match: (SRADconst x [0]) 12502 // result: x 12503 for { 12504 if auxIntToUint8(v.AuxInt) != 0 { 12505 break 12506 } 12507 x := v_0 12508 v.copyOf(x) 12509 return true 12510 } 12511 // match: (SRADconst [c] (MOVDconst [d])) 12512 // result: (MOVDconst [d>>uint64(c)]) 12513 for { 12514 c := auxIntToUint8(v.AuxInt) 12515 if v_0.Op != OpS390XMOVDconst { 12516 break 12517 } 12518 d := auxIntToInt64(v_0.AuxInt) 12519 v.reset(OpS390XMOVDconst) 12520 v.AuxInt = int64ToAuxInt(d >> uint64(c)) 12521 return true 12522 } 12523 return false 12524 } 12525 func rewriteValueS390X_OpS390XSRAW(v *Value) bool { 12526 v_1 := v.Args[1] 12527 v_0 := v.Args[0] 12528 b := v.Block 12529 typ := &b.Func.Config.Types 12530 // match: (SRAW x (MOVDconst [c])) 12531 // cond: c&32 == 0 12532 // result: (SRAWconst x [uint8(c&31)]) 12533 for { 12534 x := v_0 12535 if v_1.Op != OpS390XMOVDconst { 12536 break 12537 } 12538 c := auxIntToInt64(v_1.AuxInt) 12539 if !(c&32 == 0) { 12540 break 12541 } 12542 v.reset(OpS390XSRAWconst) 12543 v.AuxInt = uint8ToAuxInt(uint8(c & 31)) 12544 v.AddArg(x) 12545 return true 12546 } 12547 // match: (SRAW x (MOVDconst [c])) 12548 // cond: c&32 != 0 12549 // result: (SRAWconst x [31]) 12550 for { 12551 x := v_0 12552 if v_1.Op != OpS390XMOVDconst { 12553 break 12554 } 12555 c := auxIntToInt64(v_1.AuxInt) 12556 if !(c&32 != 0) { 12557 break 12558 } 12559 v.reset(OpS390XSRAWconst) 12560 v.AuxInt = uint8ToAuxInt(31) 12561 v.AddArg(x) 12562 return true 12563 } 12564 // match: (SRAW x (RISBGZ y {r})) 12565 // cond: r.Amount == 0 && r.OutMask()&63 == 63 12566 // result: (SRAW x y) 12567 for { 12568 x := v_0 12569 if v_1.Op != OpS390XRISBGZ { 12570 break 12571 } 12572 r := auxToS390xRotateParams(v_1.Aux) 12573 y := v_1.Args[0] 12574 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 12575 break 12576 } 12577 v.reset(OpS390XSRAW) 12578 v.AddArg2(x, y) 12579 return true 12580 } 12581 // match: (SRAW x (AND (MOVDconst [c]) y)) 12582 // result: (SRAW x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 12583 for { 12584 x := v_0 12585 if v_1.Op != OpS390XAND { 12586 break 12587 } 12588 _ = v_1.Args[1] 12589 v_1_0 := v_1.Args[0] 12590 v_1_1 := v_1.Args[1] 12591 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 12592 if v_1_0.Op != OpS390XMOVDconst { 12593 continue 12594 } 12595 c := auxIntToInt64(v_1_0.AuxInt) 12596 y := v_1_1 12597 v.reset(OpS390XSRAW) 12598 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 12599 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 12600 v0.AddArg(y) 12601 v.AddArg2(x, v0) 12602 return true 12603 } 12604 break 12605 } 12606 // match: (SRAW x (ANDWconst [c] y)) 12607 // cond: c&63 == 63 12608 // result: (SRAW x y) 12609 for { 12610 x := v_0 12611 if v_1.Op != OpS390XANDWconst { 12612 break 12613 } 12614 c := auxIntToInt32(v_1.AuxInt) 12615 y := v_1.Args[0] 12616 if !(c&63 == 63) { 12617 break 12618 } 12619 v.reset(OpS390XSRAW) 12620 v.AddArg2(x, y) 12621 return true 12622 } 12623 // match: (SRAW x (MOVWreg y)) 12624 // result: (SRAW x y) 12625 for { 12626 x := v_0 12627 if v_1.Op != OpS390XMOVWreg { 12628 break 12629 } 12630 y := v_1.Args[0] 12631 v.reset(OpS390XSRAW) 12632 v.AddArg2(x, y) 12633 return true 12634 } 12635 // match: (SRAW x (MOVHreg y)) 12636 // result: (SRAW x y) 12637 for { 12638 x := v_0 12639 if v_1.Op != OpS390XMOVHreg { 12640 break 12641 } 12642 y := v_1.Args[0] 12643 v.reset(OpS390XSRAW) 12644 v.AddArg2(x, y) 12645 return true 12646 } 12647 // match: (SRAW x (MOVBreg y)) 12648 // result: (SRAW x y) 12649 for { 12650 x := v_0 12651 if v_1.Op != OpS390XMOVBreg { 12652 break 12653 } 12654 y := v_1.Args[0] 12655 v.reset(OpS390XSRAW) 12656 v.AddArg2(x, y) 12657 return true 12658 } 12659 // match: (SRAW x (MOVWZreg y)) 12660 // result: (SRAW x y) 12661 for { 12662 x := v_0 12663 if v_1.Op != OpS390XMOVWZreg { 12664 break 12665 } 12666 y := v_1.Args[0] 12667 v.reset(OpS390XSRAW) 12668 v.AddArg2(x, y) 12669 return true 12670 } 12671 // match: (SRAW x (MOVHZreg y)) 12672 // result: (SRAW x y) 12673 for { 12674 x := v_0 12675 if v_1.Op != OpS390XMOVHZreg { 12676 break 12677 } 12678 y := v_1.Args[0] 12679 v.reset(OpS390XSRAW) 12680 v.AddArg2(x, y) 12681 return true 12682 } 12683 // match: (SRAW x (MOVBZreg y)) 12684 // result: (SRAW x y) 12685 for { 12686 x := v_0 12687 if v_1.Op != OpS390XMOVBZreg { 12688 break 12689 } 12690 y := v_1.Args[0] 12691 v.reset(OpS390XSRAW) 12692 v.AddArg2(x, y) 12693 return true 12694 } 12695 return false 12696 } 12697 func rewriteValueS390X_OpS390XSRAWconst(v *Value) bool { 12698 v_0 := v.Args[0] 12699 // match: (SRAWconst x [0]) 12700 // result: x 12701 for { 12702 if auxIntToUint8(v.AuxInt) != 0 { 12703 break 12704 } 12705 x := v_0 12706 v.copyOf(x) 12707 return true 12708 } 12709 // match: (SRAWconst [c] (MOVDconst [d])) 12710 // result: (MOVDconst [int64(int32(d))>>uint64(c)]) 12711 for { 12712 c := auxIntToUint8(v.AuxInt) 12713 if v_0.Op != OpS390XMOVDconst { 12714 break 12715 } 12716 d := auxIntToInt64(v_0.AuxInt) 12717 v.reset(OpS390XMOVDconst) 12718 v.AuxInt = int64ToAuxInt(int64(int32(d)) >> uint64(c)) 12719 return true 12720 } 12721 return false 12722 } 12723 func rewriteValueS390X_OpS390XSRD(v *Value) bool { 12724 v_1 := v.Args[1] 12725 v_0 := v.Args[0] 12726 b := v.Block 12727 typ := &b.Func.Config.Types 12728 // match: (SRD x (MOVDconst [c])) 12729 // result: (SRDconst x [uint8(c&63)]) 12730 for { 12731 x := v_0 12732 if v_1.Op != OpS390XMOVDconst { 12733 break 12734 } 12735 c := auxIntToInt64(v_1.AuxInt) 12736 v.reset(OpS390XSRDconst) 12737 v.AuxInt = uint8ToAuxInt(uint8(c & 63)) 12738 v.AddArg(x) 12739 return true 12740 } 12741 // match: (SRD x (RISBGZ y {r})) 12742 // cond: r.Amount == 0 && r.OutMask()&63 == 63 12743 // result: (SRD x y) 12744 for { 12745 x := v_0 12746 if v_1.Op != OpS390XRISBGZ { 12747 break 12748 } 12749 r := auxToS390xRotateParams(v_1.Aux) 12750 y := v_1.Args[0] 12751 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 12752 break 12753 } 12754 v.reset(OpS390XSRD) 12755 v.AddArg2(x, y) 12756 return true 12757 } 12758 // match: (SRD x (AND (MOVDconst [c]) y)) 12759 // result: (SRD x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 12760 for { 12761 x := v_0 12762 if v_1.Op != OpS390XAND { 12763 break 12764 } 12765 _ = v_1.Args[1] 12766 v_1_0 := v_1.Args[0] 12767 v_1_1 := v_1.Args[1] 12768 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 12769 if v_1_0.Op != OpS390XMOVDconst { 12770 continue 12771 } 12772 c := auxIntToInt64(v_1_0.AuxInt) 12773 y := v_1_1 12774 v.reset(OpS390XSRD) 12775 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 12776 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 12777 v0.AddArg(y) 12778 v.AddArg2(x, v0) 12779 return true 12780 } 12781 break 12782 } 12783 // match: (SRD x (ANDWconst [c] y)) 12784 // cond: c&63 == 63 12785 // result: (SRD x y) 12786 for { 12787 x := v_0 12788 if v_1.Op != OpS390XANDWconst { 12789 break 12790 } 12791 c := auxIntToInt32(v_1.AuxInt) 12792 y := v_1.Args[0] 12793 if !(c&63 == 63) { 12794 break 12795 } 12796 v.reset(OpS390XSRD) 12797 v.AddArg2(x, y) 12798 return true 12799 } 12800 // match: (SRD x (MOVWreg y)) 12801 // result: (SRD x y) 12802 for { 12803 x := v_0 12804 if v_1.Op != OpS390XMOVWreg { 12805 break 12806 } 12807 y := v_1.Args[0] 12808 v.reset(OpS390XSRD) 12809 v.AddArg2(x, y) 12810 return true 12811 } 12812 // match: (SRD x (MOVHreg y)) 12813 // result: (SRD x y) 12814 for { 12815 x := v_0 12816 if v_1.Op != OpS390XMOVHreg { 12817 break 12818 } 12819 y := v_1.Args[0] 12820 v.reset(OpS390XSRD) 12821 v.AddArg2(x, y) 12822 return true 12823 } 12824 // match: (SRD x (MOVBreg y)) 12825 // result: (SRD x y) 12826 for { 12827 x := v_0 12828 if v_1.Op != OpS390XMOVBreg { 12829 break 12830 } 12831 y := v_1.Args[0] 12832 v.reset(OpS390XSRD) 12833 v.AddArg2(x, y) 12834 return true 12835 } 12836 // match: (SRD x (MOVWZreg y)) 12837 // result: (SRD x y) 12838 for { 12839 x := v_0 12840 if v_1.Op != OpS390XMOVWZreg { 12841 break 12842 } 12843 y := v_1.Args[0] 12844 v.reset(OpS390XSRD) 12845 v.AddArg2(x, y) 12846 return true 12847 } 12848 // match: (SRD x (MOVHZreg y)) 12849 // result: (SRD x y) 12850 for { 12851 x := v_0 12852 if v_1.Op != OpS390XMOVHZreg { 12853 break 12854 } 12855 y := v_1.Args[0] 12856 v.reset(OpS390XSRD) 12857 v.AddArg2(x, y) 12858 return true 12859 } 12860 // match: (SRD x (MOVBZreg y)) 12861 // result: (SRD x y) 12862 for { 12863 x := v_0 12864 if v_1.Op != OpS390XMOVBZreg { 12865 break 12866 } 12867 y := v_1.Args[0] 12868 v.reset(OpS390XSRD) 12869 v.AddArg2(x, y) 12870 return true 12871 } 12872 return false 12873 } 12874 func rewriteValueS390X_OpS390XSRDconst(v *Value) bool { 12875 v_0 := v.Args[0] 12876 // match: (SRDconst (SLDconst x [c]) [d]) 12877 // result: (RISBGZ x {s390x.NewRotateParams(d, uint8(min8(63, int8(63-c+d))), uint8(int8(c-d)&63))}) 12878 for { 12879 d := auxIntToUint8(v.AuxInt) 12880 if v_0.Op != OpS390XSLDconst { 12881 break 12882 } 12883 c := auxIntToUint8(v_0.AuxInt) 12884 x := v_0.Args[0] 12885 v.reset(OpS390XRISBGZ) 12886 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(d, uint8(min8(63, int8(63-c+d))), uint8(int8(c-d)&63))) 12887 v.AddArg(x) 12888 return true 12889 } 12890 // match: (SRDconst (RISBGZ x {r}) [c]) 12891 // cond: s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask()) != nil 12892 // result: (RISBGZ x {(*s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask())).RotateLeft(r.Amount)}) 12893 for { 12894 c := auxIntToUint8(v.AuxInt) 12895 if v_0.Op != OpS390XRISBGZ { 12896 break 12897 } 12898 r := auxToS390xRotateParams(v_0.Aux) 12899 x := v_0.Args[0] 12900 if !(s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask()) != nil) { 12901 break 12902 } 12903 v.reset(OpS390XRISBGZ) 12904 v.Aux = s390xRotateParamsToAux((*s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask())).RotateLeft(r.Amount)) 12905 v.AddArg(x) 12906 return true 12907 } 12908 // match: (SRDconst x [0]) 12909 // result: x 12910 for { 12911 if auxIntToUint8(v.AuxInt) != 0 { 12912 break 12913 } 12914 x := v_0 12915 v.copyOf(x) 12916 return true 12917 } 12918 return false 12919 } 12920 func rewriteValueS390X_OpS390XSRW(v *Value) bool { 12921 v_1 := v.Args[1] 12922 v_0 := v.Args[0] 12923 b := v.Block 12924 typ := &b.Func.Config.Types 12925 // match: (SRW x (MOVDconst [c])) 12926 // cond: c&32 == 0 12927 // result: (SRWconst x [uint8(c&31)]) 12928 for { 12929 x := v_0 12930 if v_1.Op != OpS390XMOVDconst { 12931 break 12932 } 12933 c := auxIntToInt64(v_1.AuxInt) 12934 if !(c&32 == 0) { 12935 break 12936 } 12937 v.reset(OpS390XSRWconst) 12938 v.AuxInt = uint8ToAuxInt(uint8(c & 31)) 12939 v.AddArg(x) 12940 return true 12941 } 12942 // match: (SRW _ (MOVDconst [c])) 12943 // cond: c&32 != 0 12944 // result: (MOVDconst [0]) 12945 for { 12946 if v_1.Op != OpS390XMOVDconst { 12947 break 12948 } 12949 c := auxIntToInt64(v_1.AuxInt) 12950 if !(c&32 != 0) { 12951 break 12952 } 12953 v.reset(OpS390XMOVDconst) 12954 v.AuxInt = int64ToAuxInt(0) 12955 return true 12956 } 12957 // match: (SRW x (RISBGZ y {r})) 12958 // cond: r.Amount == 0 && r.OutMask()&63 == 63 12959 // result: (SRW x y) 12960 for { 12961 x := v_0 12962 if v_1.Op != OpS390XRISBGZ { 12963 break 12964 } 12965 r := auxToS390xRotateParams(v_1.Aux) 12966 y := v_1.Args[0] 12967 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 12968 break 12969 } 12970 v.reset(OpS390XSRW) 12971 v.AddArg2(x, y) 12972 return true 12973 } 12974 // match: (SRW x (AND (MOVDconst [c]) y)) 12975 // result: (SRW x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 12976 for { 12977 x := v_0 12978 if v_1.Op != OpS390XAND { 12979 break 12980 } 12981 _ = v_1.Args[1] 12982 v_1_0 := v_1.Args[0] 12983 v_1_1 := v_1.Args[1] 12984 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 12985 if v_1_0.Op != OpS390XMOVDconst { 12986 continue 12987 } 12988 c := auxIntToInt64(v_1_0.AuxInt) 12989 y := v_1_1 12990 v.reset(OpS390XSRW) 12991 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 12992 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 12993 v0.AddArg(y) 12994 v.AddArg2(x, v0) 12995 return true 12996 } 12997 break 12998 } 12999 // match: (SRW x (ANDWconst [c] y)) 13000 // cond: c&63 == 63 13001 // result: (SRW x y) 13002 for { 13003 x := v_0 13004 if v_1.Op != OpS390XANDWconst { 13005 break 13006 } 13007 c := auxIntToInt32(v_1.AuxInt) 13008 y := v_1.Args[0] 13009 if !(c&63 == 63) { 13010 break 13011 } 13012 v.reset(OpS390XSRW) 13013 v.AddArg2(x, y) 13014 return true 13015 } 13016 // match: (SRW x (MOVWreg y)) 13017 // result: (SRW x y) 13018 for { 13019 x := v_0 13020 if v_1.Op != OpS390XMOVWreg { 13021 break 13022 } 13023 y := v_1.Args[0] 13024 v.reset(OpS390XSRW) 13025 v.AddArg2(x, y) 13026 return true 13027 } 13028 // match: (SRW x (MOVHreg y)) 13029 // result: (SRW x y) 13030 for { 13031 x := v_0 13032 if v_1.Op != OpS390XMOVHreg { 13033 break 13034 } 13035 y := v_1.Args[0] 13036 v.reset(OpS390XSRW) 13037 v.AddArg2(x, y) 13038 return true 13039 } 13040 // match: (SRW x (MOVBreg y)) 13041 // result: (SRW x y) 13042 for { 13043 x := v_0 13044 if v_1.Op != OpS390XMOVBreg { 13045 break 13046 } 13047 y := v_1.Args[0] 13048 v.reset(OpS390XSRW) 13049 v.AddArg2(x, y) 13050 return true 13051 } 13052 // match: (SRW x (MOVWZreg y)) 13053 // result: (SRW x y) 13054 for { 13055 x := v_0 13056 if v_1.Op != OpS390XMOVWZreg { 13057 break 13058 } 13059 y := v_1.Args[0] 13060 v.reset(OpS390XSRW) 13061 v.AddArg2(x, y) 13062 return true 13063 } 13064 // match: (SRW x (MOVHZreg y)) 13065 // result: (SRW x y) 13066 for { 13067 x := v_0 13068 if v_1.Op != OpS390XMOVHZreg { 13069 break 13070 } 13071 y := v_1.Args[0] 13072 v.reset(OpS390XSRW) 13073 v.AddArg2(x, y) 13074 return true 13075 } 13076 // match: (SRW x (MOVBZreg y)) 13077 // result: (SRW x y) 13078 for { 13079 x := v_0 13080 if v_1.Op != OpS390XMOVBZreg { 13081 break 13082 } 13083 y := v_1.Args[0] 13084 v.reset(OpS390XSRW) 13085 v.AddArg2(x, y) 13086 return true 13087 } 13088 return false 13089 } 13090 func rewriteValueS390X_OpS390XSRWconst(v *Value) bool { 13091 v_0 := v.Args[0] 13092 // match: (SRWconst x [0]) 13093 // result: x 13094 for { 13095 if auxIntToUint8(v.AuxInt) != 0 { 13096 break 13097 } 13098 x := v_0 13099 v.copyOf(x) 13100 return true 13101 } 13102 return false 13103 } 13104 func rewriteValueS390X_OpS390XSTM2(v *Value) bool { 13105 v_3 := v.Args[3] 13106 v_2 := v.Args[2] 13107 v_1 := v.Args[1] 13108 v_0 := v.Args[0] 13109 // match: (STM2 [i] {s} p w2 w3 x:(STM2 [i-8] {s} p w0 w1 mem)) 13110 // cond: x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x) 13111 // result: (STM4 [i-8] {s} p w0 w1 w2 w3 mem) 13112 for { 13113 i := auxIntToInt32(v.AuxInt) 13114 s := auxToSym(v.Aux) 13115 p := v_0 13116 w2 := v_1 13117 w3 := v_2 13118 x := v_3 13119 if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s { 13120 break 13121 } 13122 mem := x.Args[3] 13123 if p != x.Args[0] { 13124 break 13125 } 13126 w0 := x.Args[1] 13127 w1 := x.Args[2] 13128 if !(x.Uses == 1 && is20Bit(int64(i)-8) && setPos(v, x.Pos) && clobber(x)) { 13129 break 13130 } 13131 v.reset(OpS390XSTM4) 13132 v.AuxInt = int32ToAuxInt(i - 8) 13133 v.Aux = symToAux(s) 13134 v.AddArg6(p, w0, w1, w2, w3, mem) 13135 return true 13136 } 13137 // match: (STM2 [i] {s} p (SRDconst [32] x) x mem) 13138 // result: (MOVDstore [i] {s} p x mem) 13139 for { 13140 i := auxIntToInt32(v.AuxInt) 13141 s := auxToSym(v.Aux) 13142 p := v_0 13143 if v_1.Op != OpS390XSRDconst || auxIntToUint8(v_1.AuxInt) != 32 { 13144 break 13145 } 13146 x := v_1.Args[0] 13147 if x != v_2 { 13148 break 13149 } 13150 mem := v_3 13151 v.reset(OpS390XMOVDstore) 13152 v.AuxInt = int32ToAuxInt(i) 13153 v.Aux = symToAux(s) 13154 v.AddArg3(p, x, mem) 13155 return true 13156 } 13157 return false 13158 } 13159 func rewriteValueS390X_OpS390XSTMG2(v *Value) bool { 13160 v_3 := v.Args[3] 13161 v_2 := v.Args[2] 13162 v_1 := v.Args[1] 13163 v_0 := v.Args[0] 13164 // match: (STMG2 [i] {s} p w2 w3 x:(STMG2 [i-16] {s} p w0 w1 mem)) 13165 // cond: x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x) 13166 // result: (STMG4 [i-16] {s} p w0 w1 w2 w3 mem) 13167 for { 13168 i := auxIntToInt32(v.AuxInt) 13169 s := auxToSym(v.Aux) 13170 p := v_0 13171 w2 := v_1 13172 w3 := v_2 13173 x := v_3 13174 if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s { 13175 break 13176 } 13177 mem := x.Args[3] 13178 if p != x.Args[0] { 13179 break 13180 } 13181 w0 := x.Args[1] 13182 w1 := x.Args[2] 13183 if !(x.Uses == 1 && is20Bit(int64(i)-16) && setPos(v, x.Pos) && clobber(x)) { 13184 break 13185 } 13186 v.reset(OpS390XSTMG4) 13187 v.AuxInt = int32ToAuxInt(i - 16) 13188 v.Aux = symToAux(s) 13189 v.AddArg6(p, w0, w1, w2, w3, mem) 13190 return true 13191 } 13192 return false 13193 } 13194 func rewriteValueS390X_OpS390XSUB(v *Value) bool { 13195 v_1 := v.Args[1] 13196 v_0 := v.Args[0] 13197 b := v.Block 13198 // match: (SUB x (MOVDconst [c])) 13199 // cond: is32Bit(c) 13200 // result: (SUBconst x [int32(c)]) 13201 for { 13202 x := v_0 13203 if v_1.Op != OpS390XMOVDconst { 13204 break 13205 } 13206 c := auxIntToInt64(v_1.AuxInt) 13207 if !(is32Bit(c)) { 13208 break 13209 } 13210 v.reset(OpS390XSUBconst) 13211 v.AuxInt = int32ToAuxInt(int32(c)) 13212 v.AddArg(x) 13213 return true 13214 } 13215 // match: (SUB (MOVDconst [c]) x) 13216 // cond: is32Bit(c) 13217 // result: (NEG (SUBconst <v.Type> x [int32(c)])) 13218 for { 13219 if v_0.Op != OpS390XMOVDconst { 13220 break 13221 } 13222 c := auxIntToInt64(v_0.AuxInt) 13223 x := v_1 13224 if !(is32Bit(c)) { 13225 break 13226 } 13227 v.reset(OpS390XNEG) 13228 v0 := b.NewValue0(v.Pos, OpS390XSUBconst, v.Type) 13229 v0.AuxInt = int32ToAuxInt(int32(c)) 13230 v0.AddArg(x) 13231 v.AddArg(v0) 13232 return true 13233 } 13234 // match: (SUB x x) 13235 // result: (MOVDconst [0]) 13236 for { 13237 x := v_0 13238 if x != v_1 { 13239 break 13240 } 13241 v.reset(OpS390XMOVDconst) 13242 v.AuxInt = int64ToAuxInt(0) 13243 return true 13244 } 13245 // match: (SUB <t> x g:(MOVDload [off] {sym} ptr mem)) 13246 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 13247 // result: (SUBload <t> [off] {sym} x ptr mem) 13248 for { 13249 t := v.Type 13250 x := v_0 13251 g := v_1 13252 if g.Op != OpS390XMOVDload { 13253 break 13254 } 13255 off := auxIntToInt32(g.AuxInt) 13256 sym := auxToSym(g.Aux) 13257 mem := g.Args[1] 13258 ptr := g.Args[0] 13259 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 13260 break 13261 } 13262 v.reset(OpS390XSUBload) 13263 v.Type = t 13264 v.AuxInt = int32ToAuxInt(off) 13265 v.Aux = symToAux(sym) 13266 v.AddArg3(x, ptr, mem) 13267 return true 13268 } 13269 return false 13270 } 13271 func rewriteValueS390X_OpS390XSUBE(v *Value) bool { 13272 v_2 := v.Args[2] 13273 v_1 := v.Args[1] 13274 v_0 := v.Args[0] 13275 // match: (SUBE x y (FlagGT)) 13276 // result: (SUBC x y) 13277 for { 13278 x := v_0 13279 y := v_1 13280 if v_2.Op != OpS390XFlagGT { 13281 break 13282 } 13283 v.reset(OpS390XSUBC) 13284 v.AddArg2(x, y) 13285 return true 13286 } 13287 // match: (SUBE x y (FlagOV)) 13288 // result: (SUBC x y) 13289 for { 13290 x := v_0 13291 y := v_1 13292 if v_2.Op != OpS390XFlagOV { 13293 break 13294 } 13295 v.reset(OpS390XSUBC) 13296 v.AddArg2(x, y) 13297 return true 13298 } 13299 // match: (SUBE x y (Select1 (SUBC (MOVDconst [0]) (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) c)))))) 13300 // result: (SUBE x y c) 13301 for { 13302 x := v_0 13303 y := v_1 13304 if v_2.Op != OpSelect1 { 13305 break 13306 } 13307 v_2_0 := v_2.Args[0] 13308 if v_2_0.Op != OpS390XSUBC { 13309 break 13310 } 13311 _ = v_2_0.Args[1] 13312 v_2_0_0 := v_2_0.Args[0] 13313 if v_2_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 { 13314 break 13315 } 13316 v_2_0_1 := v_2_0.Args[1] 13317 if v_2_0_1.Op != OpS390XNEG { 13318 break 13319 } 13320 v_2_0_1_0 := v_2_0_1.Args[0] 13321 if v_2_0_1_0.Op != OpSelect0 { 13322 break 13323 } 13324 v_2_0_1_0_0 := v_2_0_1_0.Args[0] 13325 if v_2_0_1_0_0.Op != OpS390XSUBE { 13326 break 13327 } 13328 c := v_2_0_1_0_0.Args[2] 13329 v_2_0_1_0_0_0 := v_2_0_1_0_0.Args[0] 13330 if v_2_0_1_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_1_0_0_0.AuxInt) != 0 { 13331 break 13332 } 13333 v_2_0_1_0_0_1 := v_2_0_1_0_0.Args[1] 13334 if v_2_0_1_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_1_0_0_1.AuxInt) != 0 { 13335 break 13336 } 13337 v.reset(OpS390XSUBE) 13338 v.AddArg3(x, y, c) 13339 return true 13340 } 13341 return false 13342 } 13343 func rewriteValueS390X_OpS390XSUBW(v *Value) bool { 13344 v_1 := v.Args[1] 13345 v_0 := v.Args[0] 13346 b := v.Block 13347 // match: (SUBW x (MOVDconst [c])) 13348 // result: (SUBWconst x [int32(c)]) 13349 for { 13350 x := v_0 13351 if v_1.Op != OpS390XMOVDconst { 13352 break 13353 } 13354 c := auxIntToInt64(v_1.AuxInt) 13355 v.reset(OpS390XSUBWconst) 13356 v.AuxInt = int32ToAuxInt(int32(c)) 13357 v.AddArg(x) 13358 return true 13359 } 13360 // match: (SUBW (MOVDconst [c]) x) 13361 // result: (NEGW (SUBWconst <v.Type> x [int32(c)])) 13362 for { 13363 if v_0.Op != OpS390XMOVDconst { 13364 break 13365 } 13366 c := auxIntToInt64(v_0.AuxInt) 13367 x := v_1 13368 v.reset(OpS390XNEGW) 13369 v0 := b.NewValue0(v.Pos, OpS390XSUBWconst, v.Type) 13370 v0.AuxInt = int32ToAuxInt(int32(c)) 13371 v0.AddArg(x) 13372 v.AddArg(v0) 13373 return true 13374 } 13375 // match: (SUBW x x) 13376 // result: (MOVDconst [0]) 13377 for { 13378 x := v_0 13379 if x != v_1 { 13380 break 13381 } 13382 v.reset(OpS390XMOVDconst) 13383 v.AuxInt = int64ToAuxInt(0) 13384 return true 13385 } 13386 // match: (SUBW <t> x g:(MOVWload [off] {sym} ptr mem)) 13387 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 13388 // result: (SUBWload <t> [off] {sym} x ptr mem) 13389 for { 13390 t := v.Type 13391 x := v_0 13392 g := v_1 13393 if g.Op != OpS390XMOVWload { 13394 break 13395 } 13396 off := auxIntToInt32(g.AuxInt) 13397 sym := auxToSym(g.Aux) 13398 mem := g.Args[1] 13399 ptr := g.Args[0] 13400 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 13401 break 13402 } 13403 v.reset(OpS390XSUBWload) 13404 v.Type = t 13405 v.AuxInt = int32ToAuxInt(off) 13406 v.Aux = symToAux(sym) 13407 v.AddArg3(x, ptr, mem) 13408 return true 13409 } 13410 // match: (SUBW <t> x g:(MOVWZload [off] {sym} ptr mem)) 13411 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 13412 // result: (SUBWload <t> [off] {sym} x ptr mem) 13413 for { 13414 t := v.Type 13415 x := v_0 13416 g := v_1 13417 if g.Op != OpS390XMOVWZload { 13418 break 13419 } 13420 off := auxIntToInt32(g.AuxInt) 13421 sym := auxToSym(g.Aux) 13422 mem := g.Args[1] 13423 ptr := g.Args[0] 13424 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 13425 break 13426 } 13427 v.reset(OpS390XSUBWload) 13428 v.Type = t 13429 v.AuxInt = int32ToAuxInt(off) 13430 v.Aux = symToAux(sym) 13431 v.AddArg3(x, ptr, mem) 13432 return true 13433 } 13434 return false 13435 } 13436 func rewriteValueS390X_OpS390XSUBWconst(v *Value) bool { 13437 v_0 := v.Args[0] 13438 // match: (SUBWconst [c] x) 13439 // cond: int32(c) == 0 13440 // result: x 13441 for { 13442 c := auxIntToInt32(v.AuxInt) 13443 x := v_0 13444 if !(int32(c) == 0) { 13445 break 13446 } 13447 v.copyOf(x) 13448 return true 13449 } 13450 // match: (SUBWconst [c] x) 13451 // result: (ADDWconst [-int32(c)] x) 13452 for { 13453 c := auxIntToInt32(v.AuxInt) 13454 x := v_0 13455 v.reset(OpS390XADDWconst) 13456 v.AuxInt = int32ToAuxInt(-int32(c)) 13457 v.AddArg(x) 13458 return true 13459 } 13460 } 13461 func rewriteValueS390X_OpS390XSUBWload(v *Value) bool { 13462 v_2 := v.Args[2] 13463 v_1 := v.Args[1] 13464 v_0 := v.Args[0] 13465 // match: (SUBWload [off1] {sym} x (ADDconst [off2] ptr) mem) 13466 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 13467 // result: (SUBWload [off1+off2] {sym} x ptr mem) 13468 for { 13469 off1 := auxIntToInt32(v.AuxInt) 13470 sym := auxToSym(v.Aux) 13471 x := v_0 13472 if v_1.Op != OpS390XADDconst { 13473 break 13474 } 13475 off2 := auxIntToInt32(v_1.AuxInt) 13476 ptr := v_1.Args[0] 13477 mem := v_2 13478 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 13479 break 13480 } 13481 v.reset(OpS390XSUBWload) 13482 v.AuxInt = int32ToAuxInt(off1 + off2) 13483 v.Aux = symToAux(sym) 13484 v.AddArg3(x, ptr, mem) 13485 return true 13486 } 13487 // match: (SUBWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 13488 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 13489 // result: (SUBWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 13490 for { 13491 o1 := auxIntToInt32(v.AuxInt) 13492 s1 := auxToSym(v.Aux) 13493 x := v_0 13494 if v_1.Op != OpS390XMOVDaddr { 13495 break 13496 } 13497 o2 := auxIntToInt32(v_1.AuxInt) 13498 s2 := auxToSym(v_1.Aux) 13499 ptr := v_1.Args[0] 13500 mem := v_2 13501 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 13502 break 13503 } 13504 v.reset(OpS390XSUBWload) 13505 v.AuxInt = int32ToAuxInt(o1 + o2) 13506 v.Aux = symToAux(mergeSym(s1, s2)) 13507 v.AddArg3(x, ptr, mem) 13508 return true 13509 } 13510 return false 13511 } 13512 func rewriteValueS390X_OpS390XSUBconst(v *Value) bool { 13513 v_0 := v.Args[0] 13514 // match: (SUBconst [0] x) 13515 // result: x 13516 for { 13517 if auxIntToInt32(v.AuxInt) != 0 { 13518 break 13519 } 13520 x := v_0 13521 v.copyOf(x) 13522 return true 13523 } 13524 // match: (SUBconst [c] x) 13525 // cond: c != -(1<<31) 13526 // result: (ADDconst [-c] x) 13527 for { 13528 c := auxIntToInt32(v.AuxInt) 13529 x := v_0 13530 if !(c != -(1 << 31)) { 13531 break 13532 } 13533 v.reset(OpS390XADDconst) 13534 v.AuxInt = int32ToAuxInt(-c) 13535 v.AddArg(x) 13536 return true 13537 } 13538 // match: (SUBconst (MOVDconst [d]) [c]) 13539 // result: (MOVDconst [d-int64(c)]) 13540 for { 13541 c := auxIntToInt32(v.AuxInt) 13542 if v_0.Op != OpS390XMOVDconst { 13543 break 13544 } 13545 d := auxIntToInt64(v_0.AuxInt) 13546 v.reset(OpS390XMOVDconst) 13547 v.AuxInt = int64ToAuxInt(d - int64(c)) 13548 return true 13549 } 13550 // match: (SUBconst (SUBconst x [d]) [c]) 13551 // cond: is32Bit(-int64(c)-int64(d)) 13552 // result: (ADDconst [-c-d] x) 13553 for { 13554 c := auxIntToInt32(v.AuxInt) 13555 if v_0.Op != OpS390XSUBconst { 13556 break 13557 } 13558 d := auxIntToInt32(v_0.AuxInt) 13559 x := v_0.Args[0] 13560 if !(is32Bit(-int64(c) - int64(d))) { 13561 break 13562 } 13563 v.reset(OpS390XADDconst) 13564 v.AuxInt = int32ToAuxInt(-c - d) 13565 v.AddArg(x) 13566 return true 13567 } 13568 return false 13569 } 13570 func rewriteValueS390X_OpS390XSUBload(v *Value) bool { 13571 v_2 := v.Args[2] 13572 v_1 := v.Args[1] 13573 v_0 := v.Args[0] 13574 b := v.Block 13575 // match: (SUBload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 13576 // cond: isSamePtr(ptr1, ptr2) 13577 // result: (SUB x (LGDR <t> y)) 13578 for { 13579 t := v.Type 13580 off := auxIntToInt32(v.AuxInt) 13581 sym := auxToSym(v.Aux) 13582 x := v_0 13583 ptr1 := v_1 13584 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 13585 break 13586 } 13587 y := v_2.Args[1] 13588 ptr2 := v_2.Args[0] 13589 if !(isSamePtr(ptr1, ptr2)) { 13590 break 13591 } 13592 v.reset(OpS390XSUB) 13593 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 13594 v0.AddArg(y) 13595 v.AddArg2(x, v0) 13596 return true 13597 } 13598 // match: (SUBload [off1] {sym} x (ADDconst [off2] ptr) mem) 13599 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 13600 // result: (SUBload [off1+off2] {sym} x ptr mem) 13601 for { 13602 off1 := auxIntToInt32(v.AuxInt) 13603 sym := auxToSym(v.Aux) 13604 x := v_0 13605 if v_1.Op != OpS390XADDconst { 13606 break 13607 } 13608 off2 := auxIntToInt32(v_1.AuxInt) 13609 ptr := v_1.Args[0] 13610 mem := v_2 13611 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 13612 break 13613 } 13614 v.reset(OpS390XSUBload) 13615 v.AuxInt = int32ToAuxInt(off1 + off2) 13616 v.Aux = symToAux(sym) 13617 v.AddArg3(x, ptr, mem) 13618 return true 13619 } 13620 // match: (SUBload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 13621 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 13622 // result: (SUBload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 13623 for { 13624 o1 := auxIntToInt32(v.AuxInt) 13625 s1 := auxToSym(v.Aux) 13626 x := v_0 13627 if v_1.Op != OpS390XMOVDaddr { 13628 break 13629 } 13630 o2 := auxIntToInt32(v_1.AuxInt) 13631 s2 := auxToSym(v_1.Aux) 13632 ptr := v_1.Args[0] 13633 mem := v_2 13634 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 13635 break 13636 } 13637 v.reset(OpS390XSUBload) 13638 v.AuxInt = int32ToAuxInt(o1 + o2) 13639 v.Aux = symToAux(mergeSym(s1, s2)) 13640 v.AddArg3(x, ptr, mem) 13641 return true 13642 } 13643 return false 13644 } 13645 func rewriteValueS390X_OpS390XSumBytes2(v *Value) bool { 13646 v_0 := v.Args[0] 13647 b := v.Block 13648 typ := &b.Func.Config.Types 13649 // match: (SumBytes2 x) 13650 // result: (ADDW (SRWconst <typ.UInt8> x [8]) x) 13651 for { 13652 x := v_0 13653 v.reset(OpS390XADDW) 13654 v0 := b.NewValue0(v.Pos, OpS390XSRWconst, typ.UInt8) 13655 v0.AuxInt = uint8ToAuxInt(8) 13656 v0.AddArg(x) 13657 v.AddArg2(v0, x) 13658 return true 13659 } 13660 } 13661 func rewriteValueS390X_OpS390XSumBytes4(v *Value) bool { 13662 v_0 := v.Args[0] 13663 b := v.Block 13664 typ := &b.Func.Config.Types 13665 // match: (SumBytes4 x) 13666 // result: (SumBytes2 (ADDW <typ.UInt16> (SRWconst <typ.UInt16> x [16]) x)) 13667 for { 13668 x := v_0 13669 v.reset(OpS390XSumBytes2) 13670 v0 := b.NewValue0(v.Pos, OpS390XADDW, typ.UInt16) 13671 v1 := b.NewValue0(v.Pos, OpS390XSRWconst, typ.UInt16) 13672 v1.AuxInt = uint8ToAuxInt(16) 13673 v1.AddArg(x) 13674 v0.AddArg2(v1, x) 13675 v.AddArg(v0) 13676 return true 13677 } 13678 } 13679 func rewriteValueS390X_OpS390XSumBytes8(v *Value) bool { 13680 v_0 := v.Args[0] 13681 b := v.Block 13682 typ := &b.Func.Config.Types 13683 // match: (SumBytes8 x) 13684 // result: (SumBytes4 (ADDW <typ.UInt32> (SRDconst <typ.UInt32> x [32]) x)) 13685 for { 13686 x := v_0 13687 v.reset(OpS390XSumBytes4) 13688 v0 := b.NewValue0(v.Pos, OpS390XADDW, typ.UInt32) 13689 v1 := b.NewValue0(v.Pos, OpS390XSRDconst, typ.UInt32) 13690 v1.AuxInt = uint8ToAuxInt(32) 13691 v1.AddArg(x) 13692 v0.AddArg2(v1, x) 13693 v.AddArg(v0) 13694 return true 13695 } 13696 } 13697 func rewriteValueS390X_OpS390XXOR(v *Value) bool { 13698 v_1 := v.Args[1] 13699 v_0 := v.Args[0] 13700 // match: (XOR x (MOVDconst [c])) 13701 // cond: isU32Bit(c) 13702 // result: (XORconst [c] x) 13703 for { 13704 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 13705 x := v_0 13706 if v_1.Op != OpS390XMOVDconst { 13707 continue 13708 } 13709 c := auxIntToInt64(v_1.AuxInt) 13710 if !(isU32Bit(c)) { 13711 continue 13712 } 13713 v.reset(OpS390XXORconst) 13714 v.AuxInt = int64ToAuxInt(c) 13715 v.AddArg(x) 13716 return true 13717 } 13718 break 13719 } 13720 // match: (XOR (MOVDconst [c]) (MOVDconst [d])) 13721 // result: (MOVDconst [c^d]) 13722 for { 13723 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 13724 if v_0.Op != OpS390XMOVDconst { 13725 continue 13726 } 13727 c := auxIntToInt64(v_0.AuxInt) 13728 if v_1.Op != OpS390XMOVDconst { 13729 continue 13730 } 13731 d := auxIntToInt64(v_1.AuxInt) 13732 v.reset(OpS390XMOVDconst) 13733 v.AuxInt = int64ToAuxInt(c ^ d) 13734 return true 13735 } 13736 break 13737 } 13738 // match: (XOR x x) 13739 // result: (MOVDconst [0]) 13740 for { 13741 x := v_0 13742 if x != v_1 { 13743 break 13744 } 13745 v.reset(OpS390XMOVDconst) 13746 v.AuxInt = int64ToAuxInt(0) 13747 return true 13748 } 13749 // match: (XOR <t> x g:(MOVDload [off] {sym} ptr mem)) 13750 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 13751 // result: (XORload <t> [off] {sym} x ptr mem) 13752 for { 13753 t := v.Type 13754 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 13755 x := v_0 13756 g := v_1 13757 if g.Op != OpS390XMOVDload { 13758 continue 13759 } 13760 off := auxIntToInt32(g.AuxInt) 13761 sym := auxToSym(g.Aux) 13762 mem := g.Args[1] 13763 ptr := g.Args[0] 13764 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 13765 continue 13766 } 13767 v.reset(OpS390XXORload) 13768 v.Type = t 13769 v.AuxInt = int32ToAuxInt(off) 13770 v.Aux = symToAux(sym) 13771 v.AddArg3(x, ptr, mem) 13772 return true 13773 } 13774 break 13775 } 13776 return false 13777 } 13778 func rewriteValueS390X_OpS390XXORW(v *Value) bool { 13779 v_1 := v.Args[1] 13780 v_0 := v.Args[0] 13781 // match: (XORW x (MOVDconst [c])) 13782 // result: (XORWconst [int32(c)] x) 13783 for { 13784 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 13785 x := v_0 13786 if v_1.Op != OpS390XMOVDconst { 13787 continue 13788 } 13789 c := auxIntToInt64(v_1.AuxInt) 13790 v.reset(OpS390XXORWconst) 13791 v.AuxInt = int32ToAuxInt(int32(c)) 13792 v.AddArg(x) 13793 return true 13794 } 13795 break 13796 } 13797 // match: (XORW x x) 13798 // result: (MOVDconst [0]) 13799 for { 13800 x := v_0 13801 if x != v_1 { 13802 break 13803 } 13804 v.reset(OpS390XMOVDconst) 13805 v.AuxInt = int64ToAuxInt(0) 13806 return true 13807 } 13808 // match: (XORW <t> x g:(MOVWload [off] {sym} ptr mem)) 13809 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 13810 // result: (XORWload <t> [off] {sym} x ptr mem) 13811 for { 13812 t := v.Type 13813 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 13814 x := v_0 13815 g := v_1 13816 if g.Op != OpS390XMOVWload { 13817 continue 13818 } 13819 off := auxIntToInt32(g.AuxInt) 13820 sym := auxToSym(g.Aux) 13821 mem := g.Args[1] 13822 ptr := g.Args[0] 13823 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 13824 continue 13825 } 13826 v.reset(OpS390XXORWload) 13827 v.Type = t 13828 v.AuxInt = int32ToAuxInt(off) 13829 v.Aux = symToAux(sym) 13830 v.AddArg3(x, ptr, mem) 13831 return true 13832 } 13833 break 13834 } 13835 // match: (XORW <t> x g:(MOVWZload [off] {sym} ptr mem)) 13836 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 13837 // result: (XORWload <t> [off] {sym} x ptr mem) 13838 for { 13839 t := v.Type 13840 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 13841 x := v_0 13842 g := v_1 13843 if g.Op != OpS390XMOVWZload { 13844 continue 13845 } 13846 off := auxIntToInt32(g.AuxInt) 13847 sym := auxToSym(g.Aux) 13848 mem := g.Args[1] 13849 ptr := g.Args[0] 13850 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 13851 continue 13852 } 13853 v.reset(OpS390XXORWload) 13854 v.Type = t 13855 v.AuxInt = int32ToAuxInt(off) 13856 v.Aux = symToAux(sym) 13857 v.AddArg3(x, ptr, mem) 13858 return true 13859 } 13860 break 13861 } 13862 return false 13863 } 13864 func rewriteValueS390X_OpS390XXORWconst(v *Value) bool { 13865 v_0 := v.Args[0] 13866 // match: (XORWconst [c] x) 13867 // cond: int32(c)==0 13868 // result: x 13869 for { 13870 c := auxIntToInt32(v.AuxInt) 13871 x := v_0 13872 if !(int32(c) == 0) { 13873 break 13874 } 13875 v.copyOf(x) 13876 return true 13877 } 13878 // match: (XORWconst [c] (MOVDconst [d])) 13879 // result: (MOVDconst [int64(c)^d]) 13880 for { 13881 c := auxIntToInt32(v.AuxInt) 13882 if v_0.Op != OpS390XMOVDconst { 13883 break 13884 } 13885 d := auxIntToInt64(v_0.AuxInt) 13886 v.reset(OpS390XMOVDconst) 13887 v.AuxInt = int64ToAuxInt(int64(c) ^ d) 13888 return true 13889 } 13890 return false 13891 } 13892 func rewriteValueS390X_OpS390XXORWload(v *Value) bool { 13893 v_2 := v.Args[2] 13894 v_1 := v.Args[1] 13895 v_0 := v.Args[0] 13896 // match: (XORWload [off1] {sym} x (ADDconst [off2] ptr) mem) 13897 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 13898 // result: (XORWload [off1+off2] {sym} x ptr mem) 13899 for { 13900 off1 := auxIntToInt32(v.AuxInt) 13901 sym := auxToSym(v.Aux) 13902 x := v_0 13903 if v_1.Op != OpS390XADDconst { 13904 break 13905 } 13906 off2 := auxIntToInt32(v_1.AuxInt) 13907 ptr := v_1.Args[0] 13908 mem := v_2 13909 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 13910 break 13911 } 13912 v.reset(OpS390XXORWload) 13913 v.AuxInt = int32ToAuxInt(off1 + off2) 13914 v.Aux = symToAux(sym) 13915 v.AddArg3(x, ptr, mem) 13916 return true 13917 } 13918 // match: (XORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 13919 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 13920 // result: (XORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 13921 for { 13922 o1 := auxIntToInt32(v.AuxInt) 13923 s1 := auxToSym(v.Aux) 13924 x := v_0 13925 if v_1.Op != OpS390XMOVDaddr { 13926 break 13927 } 13928 o2 := auxIntToInt32(v_1.AuxInt) 13929 s2 := auxToSym(v_1.Aux) 13930 ptr := v_1.Args[0] 13931 mem := v_2 13932 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 13933 break 13934 } 13935 v.reset(OpS390XXORWload) 13936 v.AuxInt = int32ToAuxInt(o1 + o2) 13937 v.Aux = symToAux(mergeSym(s1, s2)) 13938 v.AddArg3(x, ptr, mem) 13939 return true 13940 } 13941 return false 13942 } 13943 func rewriteValueS390X_OpS390XXORconst(v *Value) bool { 13944 v_0 := v.Args[0] 13945 // match: (XORconst [0] x) 13946 // result: x 13947 for { 13948 if auxIntToInt64(v.AuxInt) != 0 { 13949 break 13950 } 13951 x := v_0 13952 v.copyOf(x) 13953 return true 13954 } 13955 // match: (XORconst [c] (MOVDconst [d])) 13956 // result: (MOVDconst [c^d]) 13957 for { 13958 c := auxIntToInt64(v.AuxInt) 13959 if v_0.Op != OpS390XMOVDconst { 13960 break 13961 } 13962 d := auxIntToInt64(v_0.AuxInt) 13963 v.reset(OpS390XMOVDconst) 13964 v.AuxInt = int64ToAuxInt(c ^ d) 13965 return true 13966 } 13967 return false 13968 } 13969 func rewriteValueS390X_OpS390XXORload(v *Value) bool { 13970 v_2 := v.Args[2] 13971 v_1 := v.Args[1] 13972 v_0 := v.Args[0] 13973 b := v.Block 13974 // match: (XORload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 13975 // cond: isSamePtr(ptr1, ptr2) 13976 // result: (XOR x (LGDR <t> y)) 13977 for { 13978 t := v.Type 13979 off := auxIntToInt32(v.AuxInt) 13980 sym := auxToSym(v.Aux) 13981 x := v_0 13982 ptr1 := v_1 13983 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 13984 break 13985 } 13986 y := v_2.Args[1] 13987 ptr2 := v_2.Args[0] 13988 if !(isSamePtr(ptr1, ptr2)) { 13989 break 13990 } 13991 v.reset(OpS390XXOR) 13992 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 13993 v0.AddArg(y) 13994 v.AddArg2(x, v0) 13995 return true 13996 } 13997 // match: (XORload [off1] {sym} x (ADDconst [off2] ptr) mem) 13998 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 13999 // result: (XORload [off1+off2] {sym} x ptr mem) 14000 for { 14001 off1 := auxIntToInt32(v.AuxInt) 14002 sym := auxToSym(v.Aux) 14003 x := v_0 14004 if v_1.Op != OpS390XADDconst { 14005 break 14006 } 14007 off2 := auxIntToInt32(v_1.AuxInt) 14008 ptr := v_1.Args[0] 14009 mem := v_2 14010 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 14011 break 14012 } 14013 v.reset(OpS390XXORload) 14014 v.AuxInt = int32ToAuxInt(off1 + off2) 14015 v.Aux = symToAux(sym) 14016 v.AddArg3(x, ptr, mem) 14017 return true 14018 } 14019 // match: (XORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 14020 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 14021 // result: (XORload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 14022 for { 14023 o1 := auxIntToInt32(v.AuxInt) 14024 s1 := auxToSym(v.Aux) 14025 x := v_0 14026 if v_1.Op != OpS390XMOVDaddr { 14027 break 14028 } 14029 o2 := auxIntToInt32(v_1.AuxInt) 14030 s2 := auxToSym(v_1.Aux) 14031 ptr := v_1.Args[0] 14032 mem := v_2 14033 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 14034 break 14035 } 14036 v.reset(OpS390XXORload) 14037 v.AuxInt = int32ToAuxInt(o1 + o2) 14038 v.Aux = symToAux(mergeSym(s1, s2)) 14039 v.AddArg3(x, ptr, mem) 14040 return true 14041 } 14042 return false 14043 } 14044 func rewriteValueS390X_OpSelect0(v *Value) bool { 14045 v_0 := v.Args[0] 14046 b := v.Block 14047 typ := &b.Func.Config.Types 14048 // match: (Select0 (Add64carry x y c)) 14049 // result: (Select0 <typ.UInt64> (ADDE x y (Select1 <types.TypeFlags> (ADDCconst c [-1])))) 14050 for { 14051 if v_0.Op != OpAdd64carry { 14052 break 14053 } 14054 c := v_0.Args[2] 14055 x := v_0.Args[0] 14056 y := v_0.Args[1] 14057 v.reset(OpSelect0) 14058 v.Type = typ.UInt64 14059 v0 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags)) 14060 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 14061 v2 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags)) 14062 v2.AuxInt = int16ToAuxInt(-1) 14063 v2.AddArg(c) 14064 v1.AddArg(v2) 14065 v0.AddArg3(x, y, v1) 14066 v.AddArg(v0) 14067 return true 14068 } 14069 // match: (Select0 (Sub64borrow x y c)) 14070 // result: (Select0 <typ.UInt64> (SUBE x y (Select1 <types.TypeFlags> (SUBC (MOVDconst [0]) c)))) 14071 for { 14072 if v_0.Op != OpSub64borrow { 14073 break 14074 } 14075 c := v_0.Args[2] 14076 x := v_0.Args[0] 14077 y := v_0.Args[1] 14078 v.reset(OpSelect0) 14079 v.Type = typ.UInt64 14080 v0 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags)) 14081 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 14082 v2 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags)) 14083 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 14084 v3.AuxInt = int64ToAuxInt(0) 14085 v2.AddArg2(v3, c) 14086 v1.AddArg(v2) 14087 v0.AddArg3(x, y, v1) 14088 v.AddArg(v0) 14089 return true 14090 } 14091 // match: (Select0 <t> (AddTupleFirst32 val tuple)) 14092 // result: (ADDW val (Select0 <t> tuple)) 14093 for { 14094 t := v.Type 14095 if v_0.Op != OpS390XAddTupleFirst32 { 14096 break 14097 } 14098 tuple := v_0.Args[1] 14099 val := v_0.Args[0] 14100 v.reset(OpS390XADDW) 14101 v0 := b.NewValue0(v.Pos, OpSelect0, t) 14102 v0.AddArg(tuple) 14103 v.AddArg2(val, v0) 14104 return true 14105 } 14106 // match: (Select0 <t> (AddTupleFirst64 val tuple)) 14107 // result: (ADD val (Select0 <t> tuple)) 14108 for { 14109 t := v.Type 14110 if v_0.Op != OpS390XAddTupleFirst64 { 14111 break 14112 } 14113 tuple := v_0.Args[1] 14114 val := v_0.Args[0] 14115 v.reset(OpS390XADD) 14116 v0 := b.NewValue0(v.Pos, OpSelect0, t) 14117 v0.AddArg(tuple) 14118 v.AddArg2(val, v0) 14119 return true 14120 } 14121 // match: (Select0 (ADDCconst (MOVDconst [c]) [d])) 14122 // result: (MOVDconst [c+int64(d)]) 14123 for { 14124 if v_0.Op != OpS390XADDCconst { 14125 break 14126 } 14127 d := auxIntToInt16(v_0.AuxInt) 14128 v_0_0 := v_0.Args[0] 14129 if v_0_0.Op != OpS390XMOVDconst { 14130 break 14131 } 14132 c := auxIntToInt64(v_0_0.AuxInt) 14133 v.reset(OpS390XMOVDconst) 14134 v.AuxInt = int64ToAuxInt(c + int64(d)) 14135 return true 14136 } 14137 // match: (Select0 (SUBC (MOVDconst [c]) (MOVDconst [d]))) 14138 // result: (MOVDconst [c-d]) 14139 for { 14140 if v_0.Op != OpS390XSUBC { 14141 break 14142 } 14143 _ = v_0.Args[1] 14144 v_0_0 := v_0.Args[0] 14145 if v_0_0.Op != OpS390XMOVDconst { 14146 break 14147 } 14148 c := auxIntToInt64(v_0_0.AuxInt) 14149 v_0_1 := v_0.Args[1] 14150 if v_0_1.Op != OpS390XMOVDconst { 14151 break 14152 } 14153 d := auxIntToInt64(v_0_1.AuxInt) 14154 v.reset(OpS390XMOVDconst) 14155 v.AuxInt = int64ToAuxInt(c - d) 14156 return true 14157 } 14158 // match: (Select0 (FADD (FMUL y z) x)) 14159 // cond: x.Block.Func.useFMA(v) 14160 // result: (FMADD x y z) 14161 for { 14162 if v_0.Op != OpS390XFADD { 14163 break 14164 } 14165 _ = v_0.Args[1] 14166 v_0_0 := v_0.Args[0] 14167 v_0_1 := v_0.Args[1] 14168 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 14169 if v_0_0.Op != OpS390XFMUL { 14170 continue 14171 } 14172 z := v_0_0.Args[1] 14173 y := v_0_0.Args[0] 14174 x := v_0_1 14175 if !(x.Block.Func.useFMA(v)) { 14176 continue 14177 } 14178 v.reset(OpS390XFMADD) 14179 v.AddArg3(x, y, z) 14180 return true 14181 } 14182 break 14183 } 14184 // match: (Select0 (FSUB (FMUL y z) x)) 14185 // cond: x.Block.Func.useFMA(v) 14186 // result: (FMSUB x y z) 14187 for { 14188 if v_0.Op != OpS390XFSUB { 14189 break 14190 } 14191 x := v_0.Args[1] 14192 v_0_0 := v_0.Args[0] 14193 if v_0_0.Op != OpS390XFMUL { 14194 break 14195 } 14196 z := v_0_0.Args[1] 14197 y := v_0_0.Args[0] 14198 if !(x.Block.Func.useFMA(v)) { 14199 break 14200 } 14201 v.reset(OpS390XFMSUB) 14202 v.AddArg3(x, y, z) 14203 return true 14204 } 14205 // match: (Select0 (FADDS (FMULS y z) x)) 14206 // cond: x.Block.Func.useFMA(v) 14207 // result: (FMADDS x y z) 14208 for { 14209 if v_0.Op != OpS390XFADDS { 14210 break 14211 } 14212 _ = v_0.Args[1] 14213 v_0_0 := v_0.Args[0] 14214 v_0_1 := v_0.Args[1] 14215 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 14216 if v_0_0.Op != OpS390XFMULS { 14217 continue 14218 } 14219 z := v_0_0.Args[1] 14220 y := v_0_0.Args[0] 14221 x := v_0_1 14222 if !(x.Block.Func.useFMA(v)) { 14223 continue 14224 } 14225 v.reset(OpS390XFMADDS) 14226 v.AddArg3(x, y, z) 14227 return true 14228 } 14229 break 14230 } 14231 // match: (Select0 (FSUBS (FMULS y z) x)) 14232 // cond: x.Block.Func.useFMA(v) 14233 // result: (FMSUBS x y z) 14234 for { 14235 if v_0.Op != OpS390XFSUBS { 14236 break 14237 } 14238 x := v_0.Args[1] 14239 v_0_0 := v_0.Args[0] 14240 if v_0_0.Op != OpS390XFMULS { 14241 break 14242 } 14243 z := v_0_0.Args[1] 14244 y := v_0_0.Args[0] 14245 if !(x.Block.Func.useFMA(v)) { 14246 break 14247 } 14248 v.reset(OpS390XFMSUBS) 14249 v.AddArg3(x, y, z) 14250 return true 14251 } 14252 return false 14253 } 14254 func rewriteValueS390X_OpSelect1(v *Value) bool { 14255 v_0 := v.Args[0] 14256 b := v.Block 14257 typ := &b.Func.Config.Types 14258 // match: (Select1 (Add64carry x y c)) 14259 // result: (Select0 <typ.UInt64> (ADDE (MOVDconst [0]) (MOVDconst [0]) (Select1 <types.TypeFlags> (ADDE x y (Select1 <types.TypeFlags> (ADDCconst c [-1])))))) 14260 for { 14261 if v_0.Op != OpAdd64carry { 14262 break 14263 } 14264 c := v_0.Args[2] 14265 x := v_0.Args[0] 14266 y := v_0.Args[1] 14267 v.reset(OpSelect0) 14268 v.Type = typ.UInt64 14269 v0 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags)) 14270 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 14271 v1.AuxInt = int64ToAuxInt(0) 14272 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 14273 v3 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags)) 14274 v4 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 14275 v5 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags)) 14276 v5.AuxInt = int16ToAuxInt(-1) 14277 v5.AddArg(c) 14278 v4.AddArg(v5) 14279 v3.AddArg3(x, y, v4) 14280 v2.AddArg(v3) 14281 v0.AddArg3(v1, v1, v2) 14282 v.AddArg(v0) 14283 return true 14284 } 14285 // match: (Select1 (Sub64borrow x y c)) 14286 // result: (NEG (Select0 <typ.UInt64> (SUBE (MOVDconst [0]) (MOVDconst [0]) (Select1 <types.TypeFlags> (SUBE x y (Select1 <types.TypeFlags> (SUBC (MOVDconst [0]) c))))))) 14287 for { 14288 if v_0.Op != OpSub64borrow { 14289 break 14290 } 14291 c := v_0.Args[2] 14292 x := v_0.Args[0] 14293 y := v_0.Args[1] 14294 v.reset(OpS390XNEG) 14295 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64) 14296 v1 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags)) 14297 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 14298 v2.AuxInt = int64ToAuxInt(0) 14299 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 14300 v4 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags)) 14301 v5 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 14302 v6 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags)) 14303 v6.AddArg2(v2, c) 14304 v5.AddArg(v6) 14305 v4.AddArg3(x, y, v5) 14306 v3.AddArg(v4) 14307 v1.AddArg3(v2, v2, v3) 14308 v0.AddArg(v1) 14309 v.AddArg(v0) 14310 return true 14311 } 14312 // match: (Select1 (AddTupleFirst32 _ tuple)) 14313 // result: (Select1 tuple) 14314 for { 14315 if v_0.Op != OpS390XAddTupleFirst32 { 14316 break 14317 } 14318 tuple := v_0.Args[1] 14319 v.reset(OpSelect1) 14320 v.AddArg(tuple) 14321 return true 14322 } 14323 // match: (Select1 (AddTupleFirst64 _ tuple)) 14324 // result: (Select1 tuple) 14325 for { 14326 if v_0.Op != OpS390XAddTupleFirst64 { 14327 break 14328 } 14329 tuple := v_0.Args[1] 14330 v.reset(OpSelect1) 14331 v.AddArg(tuple) 14332 return true 14333 } 14334 // match: (Select1 (ADDCconst (MOVDconst [c]) [d])) 14335 // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0 14336 // result: (FlagEQ) 14337 for { 14338 if v_0.Op != OpS390XADDCconst { 14339 break 14340 } 14341 d := auxIntToInt16(v_0.AuxInt) 14342 v_0_0 := v_0.Args[0] 14343 if v_0_0.Op != OpS390XMOVDconst { 14344 break 14345 } 14346 c := auxIntToInt64(v_0_0.AuxInt) 14347 if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0) { 14348 break 14349 } 14350 v.reset(OpS390XFlagEQ) 14351 return true 14352 } 14353 // match: (Select1 (ADDCconst (MOVDconst [c]) [d])) 14354 // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0 14355 // result: (FlagLT) 14356 for { 14357 if v_0.Op != OpS390XADDCconst { 14358 break 14359 } 14360 d := auxIntToInt16(v_0.AuxInt) 14361 v_0_0 := v_0.Args[0] 14362 if v_0_0.Op != OpS390XMOVDconst { 14363 break 14364 } 14365 c := auxIntToInt64(v_0_0.AuxInt) 14366 if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0) { 14367 break 14368 } 14369 v.reset(OpS390XFlagLT) 14370 return true 14371 } 14372 // match: (Select1 (SUBC (MOVDconst [c]) (MOVDconst [d]))) 14373 // cond: uint64(d) <= uint64(c) && c-d == 0 14374 // result: (FlagGT) 14375 for { 14376 if v_0.Op != OpS390XSUBC { 14377 break 14378 } 14379 _ = v_0.Args[1] 14380 v_0_0 := v_0.Args[0] 14381 if v_0_0.Op != OpS390XMOVDconst { 14382 break 14383 } 14384 c := auxIntToInt64(v_0_0.AuxInt) 14385 v_0_1 := v_0.Args[1] 14386 if v_0_1.Op != OpS390XMOVDconst { 14387 break 14388 } 14389 d := auxIntToInt64(v_0_1.AuxInt) 14390 if !(uint64(d) <= uint64(c) && c-d == 0) { 14391 break 14392 } 14393 v.reset(OpS390XFlagGT) 14394 return true 14395 } 14396 // match: (Select1 (SUBC (MOVDconst [c]) (MOVDconst [d]))) 14397 // cond: uint64(d) <= uint64(c) && c-d != 0 14398 // result: (FlagOV) 14399 for { 14400 if v_0.Op != OpS390XSUBC { 14401 break 14402 } 14403 _ = v_0.Args[1] 14404 v_0_0 := v_0.Args[0] 14405 if v_0_0.Op != OpS390XMOVDconst { 14406 break 14407 } 14408 c := auxIntToInt64(v_0_0.AuxInt) 14409 v_0_1 := v_0.Args[1] 14410 if v_0_1.Op != OpS390XMOVDconst { 14411 break 14412 } 14413 d := auxIntToInt64(v_0_1.AuxInt) 14414 if !(uint64(d) <= uint64(c) && c-d != 0) { 14415 break 14416 } 14417 v.reset(OpS390XFlagOV) 14418 return true 14419 } 14420 return false 14421 } 14422 func rewriteValueS390X_OpSlicemask(v *Value) bool { 14423 v_0 := v.Args[0] 14424 b := v.Block 14425 // match: (Slicemask <t> x) 14426 // result: (SRADconst (NEG <t> x) [63]) 14427 for { 14428 t := v.Type 14429 x := v_0 14430 v.reset(OpS390XSRADconst) 14431 v.AuxInt = uint8ToAuxInt(63) 14432 v0 := b.NewValue0(v.Pos, OpS390XNEG, t) 14433 v0.AddArg(x) 14434 v.AddArg(v0) 14435 return true 14436 } 14437 } 14438 func rewriteValueS390X_OpStore(v *Value) bool { 14439 v_2 := v.Args[2] 14440 v_1 := v.Args[1] 14441 v_0 := v.Args[0] 14442 // match: (Store {t} ptr val mem) 14443 // cond: t.Size() == 8 && t.IsFloat() 14444 // result: (FMOVDstore ptr val mem) 14445 for { 14446 t := auxToType(v.Aux) 14447 ptr := v_0 14448 val := v_1 14449 mem := v_2 14450 if !(t.Size() == 8 && t.IsFloat()) { 14451 break 14452 } 14453 v.reset(OpS390XFMOVDstore) 14454 v.AddArg3(ptr, val, mem) 14455 return true 14456 } 14457 // match: (Store {t} ptr val mem) 14458 // cond: t.Size() == 4 && t.IsFloat() 14459 // result: (FMOVSstore ptr val mem) 14460 for { 14461 t := auxToType(v.Aux) 14462 ptr := v_0 14463 val := v_1 14464 mem := v_2 14465 if !(t.Size() == 4 && t.IsFloat()) { 14466 break 14467 } 14468 v.reset(OpS390XFMOVSstore) 14469 v.AddArg3(ptr, val, mem) 14470 return true 14471 } 14472 // match: (Store {t} ptr val mem) 14473 // cond: t.Size() == 8 && !t.IsFloat() 14474 // result: (MOVDstore ptr val mem) 14475 for { 14476 t := auxToType(v.Aux) 14477 ptr := v_0 14478 val := v_1 14479 mem := v_2 14480 if !(t.Size() == 8 && !t.IsFloat()) { 14481 break 14482 } 14483 v.reset(OpS390XMOVDstore) 14484 v.AddArg3(ptr, val, mem) 14485 return true 14486 } 14487 // match: (Store {t} ptr val mem) 14488 // cond: t.Size() == 4 && !t.IsFloat() 14489 // result: (MOVWstore ptr val mem) 14490 for { 14491 t := auxToType(v.Aux) 14492 ptr := v_0 14493 val := v_1 14494 mem := v_2 14495 if !(t.Size() == 4 && !t.IsFloat()) { 14496 break 14497 } 14498 v.reset(OpS390XMOVWstore) 14499 v.AddArg3(ptr, val, mem) 14500 return true 14501 } 14502 // match: (Store {t} ptr val mem) 14503 // cond: t.Size() == 2 14504 // result: (MOVHstore ptr val mem) 14505 for { 14506 t := auxToType(v.Aux) 14507 ptr := v_0 14508 val := v_1 14509 mem := v_2 14510 if !(t.Size() == 2) { 14511 break 14512 } 14513 v.reset(OpS390XMOVHstore) 14514 v.AddArg3(ptr, val, mem) 14515 return true 14516 } 14517 // match: (Store {t} ptr val mem) 14518 // cond: t.Size() == 1 14519 // result: (MOVBstore ptr val mem) 14520 for { 14521 t := auxToType(v.Aux) 14522 ptr := v_0 14523 val := v_1 14524 mem := v_2 14525 if !(t.Size() == 1) { 14526 break 14527 } 14528 v.reset(OpS390XMOVBstore) 14529 v.AddArg3(ptr, val, mem) 14530 return true 14531 } 14532 return false 14533 } 14534 func rewriteValueS390X_OpSub32F(v *Value) bool { 14535 v_1 := v.Args[1] 14536 v_0 := v.Args[0] 14537 b := v.Block 14538 typ := &b.Func.Config.Types 14539 // match: (Sub32F x y) 14540 // result: (Select0 (FSUBS x y)) 14541 for { 14542 x := v_0 14543 y := v_1 14544 v.reset(OpSelect0) 14545 v0 := b.NewValue0(v.Pos, OpS390XFSUBS, types.NewTuple(typ.Float32, types.TypeFlags)) 14546 v0.AddArg2(x, y) 14547 v.AddArg(v0) 14548 return true 14549 } 14550 } 14551 func rewriteValueS390X_OpSub64F(v *Value) bool { 14552 v_1 := v.Args[1] 14553 v_0 := v.Args[0] 14554 b := v.Block 14555 typ := &b.Func.Config.Types 14556 // match: (Sub64F x y) 14557 // result: (Select0 (FSUB x y)) 14558 for { 14559 x := v_0 14560 y := v_1 14561 v.reset(OpSelect0) 14562 v0 := b.NewValue0(v.Pos, OpS390XFSUB, types.NewTuple(typ.Float64, types.TypeFlags)) 14563 v0.AddArg2(x, y) 14564 v.AddArg(v0) 14565 return true 14566 } 14567 } 14568 func rewriteValueS390X_OpTrunc(v *Value) bool { 14569 v_0 := v.Args[0] 14570 // match: (Trunc x) 14571 // result: (FIDBR [5] x) 14572 for { 14573 x := v_0 14574 v.reset(OpS390XFIDBR) 14575 v.AuxInt = int8ToAuxInt(5) 14576 v.AddArg(x) 14577 return true 14578 } 14579 } 14580 func rewriteValueS390X_OpZero(v *Value) bool { 14581 v_1 := v.Args[1] 14582 v_0 := v.Args[0] 14583 b := v.Block 14584 // match: (Zero [0] _ mem) 14585 // result: mem 14586 for { 14587 if auxIntToInt64(v.AuxInt) != 0 { 14588 break 14589 } 14590 mem := v_1 14591 v.copyOf(mem) 14592 return true 14593 } 14594 // match: (Zero [1] destptr mem) 14595 // result: (MOVBstoreconst [0] destptr mem) 14596 for { 14597 if auxIntToInt64(v.AuxInt) != 1 { 14598 break 14599 } 14600 destptr := v_0 14601 mem := v_1 14602 v.reset(OpS390XMOVBstoreconst) 14603 v.AuxInt = valAndOffToAuxInt(0) 14604 v.AddArg2(destptr, mem) 14605 return true 14606 } 14607 // match: (Zero [2] destptr mem) 14608 // result: (MOVHstoreconst [0] destptr mem) 14609 for { 14610 if auxIntToInt64(v.AuxInt) != 2 { 14611 break 14612 } 14613 destptr := v_0 14614 mem := v_1 14615 v.reset(OpS390XMOVHstoreconst) 14616 v.AuxInt = valAndOffToAuxInt(0) 14617 v.AddArg2(destptr, mem) 14618 return true 14619 } 14620 // match: (Zero [4] destptr mem) 14621 // result: (MOVWstoreconst [0] destptr mem) 14622 for { 14623 if auxIntToInt64(v.AuxInt) != 4 { 14624 break 14625 } 14626 destptr := v_0 14627 mem := v_1 14628 v.reset(OpS390XMOVWstoreconst) 14629 v.AuxInt = valAndOffToAuxInt(0) 14630 v.AddArg2(destptr, mem) 14631 return true 14632 } 14633 // match: (Zero [8] destptr mem) 14634 // result: (MOVDstoreconst [0] destptr mem) 14635 for { 14636 if auxIntToInt64(v.AuxInt) != 8 { 14637 break 14638 } 14639 destptr := v_0 14640 mem := v_1 14641 v.reset(OpS390XMOVDstoreconst) 14642 v.AuxInt = valAndOffToAuxInt(0) 14643 v.AddArg2(destptr, mem) 14644 return true 14645 } 14646 // match: (Zero [3] destptr mem) 14647 // result: (MOVBstoreconst [makeValAndOff(0,2)] destptr (MOVHstoreconst [0] destptr mem)) 14648 for { 14649 if auxIntToInt64(v.AuxInt) != 3 { 14650 break 14651 } 14652 destptr := v_0 14653 mem := v_1 14654 v.reset(OpS390XMOVBstoreconst) 14655 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 2)) 14656 v0 := b.NewValue0(v.Pos, OpS390XMOVHstoreconst, types.TypeMem) 14657 v0.AuxInt = valAndOffToAuxInt(0) 14658 v0.AddArg2(destptr, mem) 14659 v.AddArg2(destptr, v0) 14660 return true 14661 } 14662 // match: (Zero [5] destptr mem) 14663 // result: (MOVBstoreconst [makeValAndOff(0,4)] destptr (MOVWstoreconst [0] destptr mem)) 14664 for { 14665 if auxIntToInt64(v.AuxInt) != 5 { 14666 break 14667 } 14668 destptr := v_0 14669 mem := v_1 14670 v.reset(OpS390XMOVBstoreconst) 14671 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4)) 14672 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem) 14673 v0.AuxInt = valAndOffToAuxInt(0) 14674 v0.AddArg2(destptr, mem) 14675 v.AddArg2(destptr, v0) 14676 return true 14677 } 14678 // match: (Zero [6] destptr mem) 14679 // result: (MOVHstoreconst [makeValAndOff(0,4)] destptr (MOVWstoreconst [0] destptr mem)) 14680 for { 14681 if auxIntToInt64(v.AuxInt) != 6 { 14682 break 14683 } 14684 destptr := v_0 14685 mem := v_1 14686 v.reset(OpS390XMOVHstoreconst) 14687 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4)) 14688 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem) 14689 v0.AuxInt = valAndOffToAuxInt(0) 14690 v0.AddArg2(destptr, mem) 14691 v.AddArg2(destptr, v0) 14692 return true 14693 } 14694 // match: (Zero [7] destptr mem) 14695 // result: (MOVWstoreconst [makeValAndOff(0,3)] destptr (MOVWstoreconst [0] destptr mem)) 14696 for { 14697 if auxIntToInt64(v.AuxInt) != 7 { 14698 break 14699 } 14700 destptr := v_0 14701 mem := v_1 14702 v.reset(OpS390XMOVWstoreconst) 14703 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 3)) 14704 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem) 14705 v0.AuxInt = valAndOffToAuxInt(0) 14706 v0.AddArg2(destptr, mem) 14707 v.AddArg2(destptr, v0) 14708 return true 14709 } 14710 // match: (Zero [s] destptr mem) 14711 // cond: s > 0 && s <= 1024 14712 // result: (CLEAR [makeValAndOff(int32(s), 0)] destptr mem) 14713 for { 14714 s := auxIntToInt64(v.AuxInt) 14715 destptr := v_0 14716 mem := v_1 14717 if !(s > 0 && s <= 1024) { 14718 break 14719 } 14720 v.reset(OpS390XCLEAR) 14721 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s), 0)) 14722 v.AddArg2(destptr, mem) 14723 return true 14724 } 14725 // match: (Zero [s] destptr mem) 14726 // cond: s > 1024 14727 // result: (LoweredZero [s%256] destptr (ADDconst <destptr.Type> destptr [(int32(s)/256)*256]) mem) 14728 for { 14729 s := auxIntToInt64(v.AuxInt) 14730 destptr := v_0 14731 mem := v_1 14732 if !(s > 1024) { 14733 break 14734 } 14735 v.reset(OpS390XLoweredZero) 14736 v.AuxInt = int64ToAuxInt(s % 256) 14737 v0 := b.NewValue0(v.Pos, OpS390XADDconst, destptr.Type) 14738 v0.AuxInt = int32ToAuxInt((int32(s) / 256) * 256) 14739 v0.AddArg(destptr) 14740 v.AddArg3(destptr, v0, mem) 14741 return true 14742 } 14743 return false 14744 } 14745 func rewriteBlockS390X(b *Block) bool { 14746 typ := &b.Func.Config.Types 14747 switch b.Kind { 14748 case BlockS390XBRC: 14749 // match: (BRC {c} x:(CMP _ _) yes no) 14750 // cond: c&s390x.Unordered != 0 14751 // result: (BRC {c&^s390x.Unordered} x yes no) 14752 for b.Controls[0].Op == OpS390XCMP { 14753 x := b.Controls[0] 14754 c := auxToS390xCCMask(b.Aux) 14755 if !(c&s390x.Unordered != 0) { 14756 break 14757 } 14758 b.resetWithControl(BlockS390XBRC, x) 14759 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14760 return true 14761 } 14762 // match: (BRC {c} x:(CMPW _ _) yes no) 14763 // cond: c&s390x.Unordered != 0 14764 // result: (BRC {c&^s390x.Unordered} x yes no) 14765 for b.Controls[0].Op == OpS390XCMPW { 14766 x := b.Controls[0] 14767 c := auxToS390xCCMask(b.Aux) 14768 if !(c&s390x.Unordered != 0) { 14769 break 14770 } 14771 b.resetWithControl(BlockS390XBRC, x) 14772 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14773 return true 14774 } 14775 // match: (BRC {c} x:(CMPU _ _) yes no) 14776 // cond: c&s390x.Unordered != 0 14777 // result: (BRC {c&^s390x.Unordered} x yes no) 14778 for b.Controls[0].Op == OpS390XCMPU { 14779 x := b.Controls[0] 14780 c := auxToS390xCCMask(b.Aux) 14781 if !(c&s390x.Unordered != 0) { 14782 break 14783 } 14784 b.resetWithControl(BlockS390XBRC, x) 14785 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14786 return true 14787 } 14788 // match: (BRC {c} x:(CMPWU _ _) yes no) 14789 // cond: c&s390x.Unordered != 0 14790 // result: (BRC {c&^s390x.Unordered} x yes no) 14791 for b.Controls[0].Op == OpS390XCMPWU { 14792 x := b.Controls[0] 14793 c := auxToS390xCCMask(b.Aux) 14794 if !(c&s390x.Unordered != 0) { 14795 break 14796 } 14797 b.resetWithControl(BlockS390XBRC, x) 14798 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14799 return true 14800 } 14801 // match: (BRC {c} x:(CMPconst _) yes no) 14802 // cond: c&s390x.Unordered != 0 14803 // result: (BRC {c&^s390x.Unordered} x yes no) 14804 for b.Controls[0].Op == OpS390XCMPconst { 14805 x := b.Controls[0] 14806 c := auxToS390xCCMask(b.Aux) 14807 if !(c&s390x.Unordered != 0) { 14808 break 14809 } 14810 b.resetWithControl(BlockS390XBRC, x) 14811 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14812 return true 14813 } 14814 // match: (BRC {c} x:(CMPWconst _) yes no) 14815 // cond: c&s390x.Unordered != 0 14816 // result: (BRC {c&^s390x.Unordered} x yes no) 14817 for b.Controls[0].Op == OpS390XCMPWconst { 14818 x := b.Controls[0] 14819 c := auxToS390xCCMask(b.Aux) 14820 if !(c&s390x.Unordered != 0) { 14821 break 14822 } 14823 b.resetWithControl(BlockS390XBRC, x) 14824 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14825 return true 14826 } 14827 // match: (BRC {c} x:(CMPUconst _) yes no) 14828 // cond: c&s390x.Unordered != 0 14829 // result: (BRC {c&^s390x.Unordered} x yes no) 14830 for b.Controls[0].Op == OpS390XCMPUconst { 14831 x := b.Controls[0] 14832 c := auxToS390xCCMask(b.Aux) 14833 if !(c&s390x.Unordered != 0) { 14834 break 14835 } 14836 b.resetWithControl(BlockS390XBRC, x) 14837 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14838 return true 14839 } 14840 // match: (BRC {c} x:(CMPWUconst _) yes no) 14841 // cond: c&s390x.Unordered != 0 14842 // result: (BRC {c&^s390x.Unordered} x yes no) 14843 for b.Controls[0].Op == OpS390XCMPWUconst { 14844 x := b.Controls[0] 14845 c := auxToS390xCCMask(b.Aux) 14846 if !(c&s390x.Unordered != 0) { 14847 break 14848 } 14849 b.resetWithControl(BlockS390XBRC, x) 14850 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14851 return true 14852 } 14853 // match: (BRC {c} (CMP x y) yes no) 14854 // result: (CGRJ {c&^s390x.Unordered} x y yes no) 14855 for b.Controls[0].Op == OpS390XCMP { 14856 v_0 := b.Controls[0] 14857 y := v_0.Args[1] 14858 x := v_0.Args[0] 14859 c := auxToS390xCCMask(b.Aux) 14860 b.resetWithControl2(BlockS390XCGRJ, x, y) 14861 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14862 return true 14863 } 14864 // match: (BRC {c} (CMPW x y) yes no) 14865 // result: (CRJ {c&^s390x.Unordered} x y yes no) 14866 for b.Controls[0].Op == OpS390XCMPW { 14867 v_0 := b.Controls[0] 14868 y := v_0.Args[1] 14869 x := v_0.Args[0] 14870 c := auxToS390xCCMask(b.Aux) 14871 b.resetWithControl2(BlockS390XCRJ, x, y) 14872 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14873 return true 14874 } 14875 // match: (BRC {c} (CMPU x y) yes no) 14876 // result: (CLGRJ {c&^s390x.Unordered} x y yes no) 14877 for b.Controls[0].Op == OpS390XCMPU { 14878 v_0 := b.Controls[0] 14879 y := v_0.Args[1] 14880 x := v_0.Args[0] 14881 c := auxToS390xCCMask(b.Aux) 14882 b.resetWithControl2(BlockS390XCLGRJ, x, y) 14883 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14884 return true 14885 } 14886 // match: (BRC {c} (CMPWU x y) yes no) 14887 // result: (CLRJ {c&^s390x.Unordered} x y yes no) 14888 for b.Controls[0].Op == OpS390XCMPWU { 14889 v_0 := b.Controls[0] 14890 y := v_0.Args[1] 14891 x := v_0.Args[0] 14892 c := auxToS390xCCMask(b.Aux) 14893 b.resetWithControl2(BlockS390XCLRJ, x, y) 14894 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14895 return true 14896 } 14897 // match: (BRC {c} (CMPconst x [y]) yes no) 14898 // cond: y == int32( int8(y)) 14899 // result: (CGIJ {c&^s390x.Unordered} x [ int8(y)] yes no) 14900 for b.Controls[0].Op == OpS390XCMPconst { 14901 v_0 := b.Controls[0] 14902 y := auxIntToInt32(v_0.AuxInt) 14903 x := v_0.Args[0] 14904 c := auxToS390xCCMask(b.Aux) 14905 if !(y == int32(int8(y))) { 14906 break 14907 } 14908 b.resetWithControl(BlockS390XCGIJ, x) 14909 b.AuxInt = int8ToAuxInt(int8(y)) 14910 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14911 return true 14912 } 14913 // match: (BRC {c} (CMPWconst x [y]) yes no) 14914 // cond: y == int32( int8(y)) 14915 // result: (CIJ {c&^s390x.Unordered} x [ int8(y)] yes no) 14916 for b.Controls[0].Op == OpS390XCMPWconst { 14917 v_0 := b.Controls[0] 14918 y := auxIntToInt32(v_0.AuxInt) 14919 x := v_0.Args[0] 14920 c := auxToS390xCCMask(b.Aux) 14921 if !(y == int32(int8(y))) { 14922 break 14923 } 14924 b.resetWithControl(BlockS390XCIJ, x) 14925 b.AuxInt = int8ToAuxInt(int8(y)) 14926 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14927 return true 14928 } 14929 // match: (BRC {c} (CMPUconst x [y]) yes no) 14930 // cond: y == int32(uint8(y)) 14931 // result: (CLGIJ {c&^s390x.Unordered} x [uint8(y)] yes no) 14932 for b.Controls[0].Op == OpS390XCMPUconst { 14933 v_0 := b.Controls[0] 14934 y := auxIntToInt32(v_0.AuxInt) 14935 x := v_0.Args[0] 14936 c := auxToS390xCCMask(b.Aux) 14937 if !(y == int32(uint8(y))) { 14938 break 14939 } 14940 b.resetWithControl(BlockS390XCLGIJ, x) 14941 b.AuxInt = uint8ToAuxInt(uint8(y)) 14942 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14943 return true 14944 } 14945 // match: (BRC {c} (CMPWUconst x [y]) yes no) 14946 // cond: y == int32(uint8(y)) 14947 // result: (CLIJ {c&^s390x.Unordered} x [uint8(y)] yes no) 14948 for b.Controls[0].Op == OpS390XCMPWUconst { 14949 v_0 := b.Controls[0] 14950 y := auxIntToInt32(v_0.AuxInt) 14951 x := v_0.Args[0] 14952 c := auxToS390xCCMask(b.Aux) 14953 if !(y == int32(uint8(y))) { 14954 break 14955 } 14956 b.resetWithControl(BlockS390XCLIJ, x) 14957 b.AuxInt = uint8ToAuxInt(uint8(y)) 14958 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 14959 return true 14960 } 14961 // match: (BRC {s390x.Less} (CMPconst x [ 128]) yes no) 14962 // result: (CGIJ {s390x.LessOrEqual} x [ 127] yes no) 14963 for b.Controls[0].Op == OpS390XCMPconst { 14964 v_0 := b.Controls[0] 14965 if auxIntToInt32(v_0.AuxInt) != 128 { 14966 break 14967 } 14968 x := v_0.Args[0] 14969 if auxToS390xCCMask(b.Aux) != s390x.Less { 14970 break 14971 } 14972 b.resetWithControl(BlockS390XCGIJ, x) 14973 b.AuxInt = int8ToAuxInt(127) 14974 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 14975 return true 14976 } 14977 // match: (BRC {s390x.Less} (CMPWconst x [ 128]) yes no) 14978 // result: (CIJ {s390x.LessOrEqual} x [ 127] yes no) 14979 for b.Controls[0].Op == OpS390XCMPWconst { 14980 v_0 := b.Controls[0] 14981 if auxIntToInt32(v_0.AuxInt) != 128 { 14982 break 14983 } 14984 x := v_0.Args[0] 14985 if auxToS390xCCMask(b.Aux) != s390x.Less { 14986 break 14987 } 14988 b.resetWithControl(BlockS390XCIJ, x) 14989 b.AuxInt = int8ToAuxInt(127) 14990 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 14991 return true 14992 } 14993 // match: (BRC {s390x.LessOrEqual} (CMPconst x [-129]) yes no) 14994 // result: (CGIJ {s390x.Less} x [-128] yes no) 14995 for b.Controls[0].Op == OpS390XCMPconst { 14996 v_0 := b.Controls[0] 14997 if auxIntToInt32(v_0.AuxInt) != -129 { 14998 break 14999 } 15000 x := v_0.Args[0] 15001 if auxToS390xCCMask(b.Aux) != s390x.LessOrEqual { 15002 break 15003 } 15004 b.resetWithControl(BlockS390XCGIJ, x) 15005 b.AuxInt = int8ToAuxInt(-128) 15006 b.Aux = s390xCCMaskToAux(s390x.Less) 15007 return true 15008 } 15009 // match: (BRC {s390x.LessOrEqual} (CMPWconst x [-129]) yes no) 15010 // result: (CIJ {s390x.Less} x [-128] yes no) 15011 for b.Controls[0].Op == OpS390XCMPWconst { 15012 v_0 := b.Controls[0] 15013 if auxIntToInt32(v_0.AuxInt) != -129 { 15014 break 15015 } 15016 x := v_0.Args[0] 15017 if auxToS390xCCMask(b.Aux) != s390x.LessOrEqual { 15018 break 15019 } 15020 b.resetWithControl(BlockS390XCIJ, x) 15021 b.AuxInt = int8ToAuxInt(-128) 15022 b.Aux = s390xCCMaskToAux(s390x.Less) 15023 return true 15024 } 15025 // match: (BRC {s390x.Greater} (CMPconst x [-129]) yes no) 15026 // result: (CGIJ {s390x.GreaterOrEqual} x [-128] yes no) 15027 for b.Controls[0].Op == OpS390XCMPconst { 15028 v_0 := b.Controls[0] 15029 if auxIntToInt32(v_0.AuxInt) != -129 { 15030 break 15031 } 15032 x := v_0.Args[0] 15033 if auxToS390xCCMask(b.Aux) != s390x.Greater { 15034 break 15035 } 15036 b.resetWithControl(BlockS390XCGIJ, x) 15037 b.AuxInt = int8ToAuxInt(-128) 15038 b.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 15039 return true 15040 } 15041 // match: (BRC {s390x.Greater} (CMPWconst x [-129]) yes no) 15042 // result: (CIJ {s390x.GreaterOrEqual} x [-128] yes no) 15043 for b.Controls[0].Op == OpS390XCMPWconst { 15044 v_0 := b.Controls[0] 15045 if auxIntToInt32(v_0.AuxInt) != -129 { 15046 break 15047 } 15048 x := v_0.Args[0] 15049 if auxToS390xCCMask(b.Aux) != s390x.Greater { 15050 break 15051 } 15052 b.resetWithControl(BlockS390XCIJ, x) 15053 b.AuxInt = int8ToAuxInt(-128) 15054 b.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 15055 return true 15056 } 15057 // match: (BRC {s390x.GreaterOrEqual} (CMPconst x [ 128]) yes no) 15058 // result: (CGIJ {s390x.Greater} x [ 127] yes no) 15059 for b.Controls[0].Op == OpS390XCMPconst { 15060 v_0 := b.Controls[0] 15061 if auxIntToInt32(v_0.AuxInt) != 128 { 15062 break 15063 } 15064 x := v_0.Args[0] 15065 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 15066 break 15067 } 15068 b.resetWithControl(BlockS390XCGIJ, x) 15069 b.AuxInt = int8ToAuxInt(127) 15070 b.Aux = s390xCCMaskToAux(s390x.Greater) 15071 return true 15072 } 15073 // match: (BRC {s390x.GreaterOrEqual} (CMPWconst x [ 128]) yes no) 15074 // result: (CIJ {s390x.Greater} x [ 127] yes no) 15075 for b.Controls[0].Op == OpS390XCMPWconst { 15076 v_0 := b.Controls[0] 15077 if auxIntToInt32(v_0.AuxInt) != 128 { 15078 break 15079 } 15080 x := v_0.Args[0] 15081 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 15082 break 15083 } 15084 b.resetWithControl(BlockS390XCIJ, x) 15085 b.AuxInt = int8ToAuxInt(127) 15086 b.Aux = s390xCCMaskToAux(s390x.Greater) 15087 return true 15088 } 15089 // match: (BRC {s390x.Less} (CMPWUconst x [256]) yes no) 15090 // result: (CLIJ {s390x.LessOrEqual} x [255] yes no) 15091 for b.Controls[0].Op == OpS390XCMPWUconst { 15092 v_0 := b.Controls[0] 15093 if auxIntToInt32(v_0.AuxInt) != 256 { 15094 break 15095 } 15096 x := v_0.Args[0] 15097 if auxToS390xCCMask(b.Aux) != s390x.Less { 15098 break 15099 } 15100 b.resetWithControl(BlockS390XCLIJ, x) 15101 b.AuxInt = uint8ToAuxInt(255) 15102 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 15103 return true 15104 } 15105 // match: (BRC {s390x.Less} (CMPUconst x [256]) yes no) 15106 // result: (CLGIJ {s390x.LessOrEqual} x [255] yes no) 15107 for b.Controls[0].Op == OpS390XCMPUconst { 15108 v_0 := b.Controls[0] 15109 if auxIntToInt32(v_0.AuxInt) != 256 { 15110 break 15111 } 15112 x := v_0.Args[0] 15113 if auxToS390xCCMask(b.Aux) != s390x.Less { 15114 break 15115 } 15116 b.resetWithControl(BlockS390XCLGIJ, x) 15117 b.AuxInt = uint8ToAuxInt(255) 15118 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 15119 return true 15120 } 15121 // match: (BRC {s390x.GreaterOrEqual} (CMPWUconst x [256]) yes no) 15122 // result: (CLIJ {s390x.Greater} x [255] yes no) 15123 for b.Controls[0].Op == OpS390XCMPWUconst { 15124 v_0 := b.Controls[0] 15125 if auxIntToInt32(v_0.AuxInt) != 256 { 15126 break 15127 } 15128 x := v_0.Args[0] 15129 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 15130 break 15131 } 15132 b.resetWithControl(BlockS390XCLIJ, x) 15133 b.AuxInt = uint8ToAuxInt(255) 15134 b.Aux = s390xCCMaskToAux(s390x.Greater) 15135 return true 15136 } 15137 // match: (BRC {s390x.GreaterOrEqual} (CMPUconst x [256]) yes no) 15138 // result: (CLGIJ {s390x.Greater} x [255] yes no) 15139 for b.Controls[0].Op == OpS390XCMPUconst { 15140 v_0 := b.Controls[0] 15141 if auxIntToInt32(v_0.AuxInt) != 256 { 15142 break 15143 } 15144 x := v_0.Args[0] 15145 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 15146 break 15147 } 15148 b.resetWithControl(BlockS390XCLGIJ, x) 15149 b.AuxInt = uint8ToAuxInt(255) 15150 b.Aux = s390xCCMaskToAux(s390x.Greater) 15151 return true 15152 } 15153 // match: (BRC {c} (CMPconst x [y]) yes no) 15154 // cond: y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater) 15155 // result: (CLGIJ {c} x [uint8(y)] yes no) 15156 for b.Controls[0].Op == OpS390XCMPconst { 15157 v_0 := b.Controls[0] 15158 y := auxIntToInt32(v_0.AuxInt) 15159 x := v_0.Args[0] 15160 c := auxToS390xCCMask(b.Aux) 15161 if !(y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) { 15162 break 15163 } 15164 b.resetWithControl(BlockS390XCLGIJ, x) 15165 b.AuxInt = uint8ToAuxInt(uint8(y)) 15166 b.Aux = s390xCCMaskToAux(c) 15167 return true 15168 } 15169 // match: (BRC {c} (CMPWconst x [y]) yes no) 15170 // cond: y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater) 15171 // result: (CLIJ {c} x [uint8(y)] yes no) 15172 for b.Controls[0].Op == OpS390XCMPWconst { 15173 v_0 := b.Controls[0] 15174 y := auxIntToInt32(v_0.AuxInt) 15175 x := v_0.Args[0] 15176 c := auxToS390xCCMask(b.Aux) 15177 if !(y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) { 15178 break 15179 } 15180 b.resetWithControl(BlockS390XCLIJ, x) 15181 b.AuxInt = uint8ToAuxInt(uint8(y)) 15182 b.Aux = s390xCCMaskToAux(c) 15183 return true 15184 } 15185 // match: (BRC {c} (CMPUconst x [y]) yes no) 15186 // cond: y == int32( int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater) 15187 // result: (CGIJ {c} x [ int8(y)] yes no) 15188 for b.Controls[0].Op == OpS390XCMPUconst { 15189 v_0 := b.Controls[0] 15190 y := auxIntToInt32(v_0.AuxInt) 15191 x := v_0.Args[0] 15192 c := auxToS390xCCMask(b.Aux) 15193 if !(y == int32(int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) { 15194 break 15195 } 15196 b.resetWithControl(BlockS390XCGIJ, x) 15197 b.AuxInt = int8ToAuxInt(int8(y)) 15198 b.Aux = s390xCCMaskToAux(c) 15199 return true 15200 } 15201 // match: (BRC {c} (CMPWUconst x [y]) yes no) 15202 // cond: y == int32( int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater) 15203 // result: (CIJ {c} x [ int8(y)] yes no) 15204 for b.Controls[0].Op == OpS390XCMPWUconst { 15205 v_0 := b.Controls[0] 15206 y := auxIntToInt32(v_0.AuxInt) 15207 x := v_0.Args[0] 15208 c := auxToS390xCCMask(b.Aux) 15209 if !(y == int32(int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) { 15210 break 15211 } 15212 b.resetWithControl(BlockS390XCIJ, x) 15213 b.AuxInt = int8ToAuxInt(int8(y)) 15214 b.Aux = s390xCCMaskToAux(c) 15215 return true 15216 } 15217 // match: (BRC {c} (InvertFlags cmp) yes no) 15218 // result: (BRC {c.ReverseComparison()} cmp yes no) 15219 for b.Controls[0].Op == OpS390XInvertFlags { 15220 v_0 := b.Controls[0] 15221 cmp := v_0.Args[0] 15222 c := auxToS390xCCMask(b.Aux) 15223 b.resetWithControl(BlockS390XBRC, cmp) 15224 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 15225 return true 15226 } 15227 // match: (BRC {c} (FlagEQ) yes no) 15228 // cond: c&s390x.Equal != 0 15229 // result: (First yes no) 15230 for b.Controls[0].Op == OpS390XFlagEQ { 15231 c := auxToS390xCCMask(b.Aux) 15232 if !(c&s390x.Equal != 0) { 15233 break 15234 } 15235 b.Reset(BlockFirst) 15236 return true 15237 } 15238 // match: (BRC {c} (FlagLT) yes no) 15239 // cond: c&s390x.Less != 0 15240 // result: (First yes no) 15241 for b.Controls[0].Op == OpS390XFlagLT { 15242 c := auxToS390xCCMask(b.Aux) 15243 if !(c&s390x.Less != 0) { 15244 break 15245 } 15246 b.Reset(BlockFirst) 15247 return true 15248 } 15249 // match: (BRC {c} (FlagGT) yes no) 15250 // cond: c&s390x.Greater != 0 15251 // result: (First yes no) 15252 for b.Controls[0].Op == OpS390XFlagGT { 15253 c := auxToS390xCCMask(b.Aux) 15254 if !(c&s390x.Greater != 0) { 15255 break 15256 } 15257 b.Reset(BlockFirst) 15258 return true 15259 } 15260 // match: (BRC {c} (FlagOV) yes no) 15261 // cond: c&s390x.Unordered != 0 15262 // result: (First yes no) 15263 for b.Controls[0].Op == OpS390XFlagOV { 15264 c := auxToS390xCCMask(b.Aux) 15265 if !(c&s390x.Unordered != 0) { 15266 break 15267 } 15268 b.Reset(BlockFirst) 15269 return true 15270 } 15271 // match: (BRC {c} (FlagEQ) yes no) 15272 // cond: c&s390x.Equal == 0 15273 // result: (First no yes) 15274 for b.Controls[0].Op == OpS390XFlagEQ { 15275 c := auxToS390xCCMask(b.Aux) 15276 if !(c&s390x.Equal == 0) { 15277 break 15278 } 15279 b.Reset(BlockFirst) 15280 b.swapSuccessors() 15281 return true 15282 } 15283 // match: (BRC {c} (FlagLT) yes no) 15284 // cond: c&s390x.Less == 0 15285 // result: (First no yes) 15286 for b.Controls[0].Op == OpS390XFlagLT { 15287 c := auxToS390xCCMask(b.Aux) 15288 if !(c&s390x.Less == 0) { 15289 break 15290 } 15291 b.Reset(BlockFirst) 15292 b.swapSuccessors() 15293 return true 15294 } 15295 // match: (BRC {c} (FlagGT) yes no) 15296 // cond: c&s390x.Greater == 0 15297 // result: (First no yes) 15298 for b.Controls[0].Op == OpS390XFlagGT { 15299 c := auxToS390xCCMask(b.Aux) 15300 if !(c&s390x.Greater == 0) { 15301 break 15302 } 15303 b.Reset(BlockFirst) 15304 b.swapSuccessors() 15305 return true 15306 } 15307 // match: (BRC {c} (FlagOV) yes no) 15308 // cond: c&s390x.Unordered == 0 15309 // result: (First no yes) 15310 for b.Controls[0].Op == OpS390XFlagOV { 15311 c := auxToS390xCCMask(b.Aux) 15312 if !(c&s390x.Unordered == 0) { 15313 break 15314 } 15315 b.Reset(BlockFirst) 15316 b.swapSuccessors() 15317 return true 15318 } 15319 case BlockS390XCGIJ: 15320 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 15321 // cond: c&s390x.Equal != 0 && int64(x) == int64(y) 15322 // result: (First yes no) 15323 for b.Controls[0].Op == OpS390XMOVDconst { 15324 v_0 := b.Controls[0] 15325 x := auxIntToInt64(v_0.AuxInt) 15326 y := auxIntToInt8(b.AuxInt) 15327 c := auxToS390xCCMask(b.Aux) 15328 if !(c&s390x.Equal != 0 && int64(x) == int64(y)) { 15329 break 15330 } 15331 b.Reset(BlockFirst) 15332 return true 15333 } 15334 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 15335 // cond: c&s390x.Less != 0 && int64(x) < int64(y) 15336 // result: (First yes no) 15337 for b.Controls[0].Op == OpS390XMOVDconst { 15338 v_0 := b.Controls[0] 15339 x := auxIntToInt64(v_0.AuxInt) 15340 y := auxIntToInt8(b.AuxInt) 15341 c := auxToS390xCCMask(b.Aux) 15342 if !(c&s390x.Less != 0 && int64(x) < int64(y)) { 15343 break 15344 } 15345 b.Reset(BlockFirst) 15346 return true 15347 } 15348 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 15349 // cond: c&s390x.Greater != 0 && int64(x) > int64(y) 15350 // result: (First yes no) 15351 for b.Controls[0].Op == OpS390XMOVDconst { 15352 v_0 := b.Controls[0] 15353 x := auxIntToInt64(v_0.AuxInt) 15354 y := auxIntToInt8(b.AuxInt) 15355 c := auxToS390xCCMask(b.Aux) 15356 if !(c&s390x.Greater != 0 && int64(x) > int64(y)) { 15357 break 15358 } 15359 b.Reset(BlockFirst) 15360 return true 15361 } 15362 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 15363 // cond: c&s390x.Equal == 0 && int64(x) == int64(y) 15364 // result: (First no yes) 15365 for b.Controls[0].Op == OpS390XMOVDconst { 15366 v_0 := b.Controls[0] 15367 x := auxIntToInt64(v_0.AuxInt) 15368 y := auxIntToInt8(b.AuxInt) 15369 c := auxToS390xCCMask(b.Aux) 15370 if !(c&s390x.Equal == 0 && int64(x) == int64(y)) { 15371 break 15372 } 15373 b.Reset(BlockFirst) 15374 b.swapSuccessors() 15375 return true 15376 } 15377 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 15378 // cond: c&s390x.Less == 0 && int64(x) < int64(y) 15379 // result: (First no yes) 15380 for b.Controls[0].Op == OpS390XMOVDconst { 15381 v_0 := b.Controls[0] 15382 x := auxIntToInt64(v_0.AuxInt) 15383 y := auxIntToInt8(b.AuxInt) 15384 c := auxToS390xCCMask(b.Aux) 15385 if !(c&s390x.Less == 0 && int64(x) < int64(y)) { 15386 break 15387 } 15388 b.Reset(BlockFirst) 15389 b.swapSuccessors() 15390 return true 15391 } 15392 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 15393 // cond: c&s390x.Greater == 0 && int64(x) > int64(y) 15394 // result: (First no yes) 15395 for b.Controls[0].Op == OpS390XMOVDconst { 15396 v_0 := b.Controls[0] 15397 x := auxIntToInt64(v_0.AuxInt) 15398 y := auxIntToInt8(b.AuxInt) 15399 c := auxToS390xCCMask(b.Aux) 15400 if !(c&s390x.Greater == 0 && int64(x) > int64(y)) { 15401 break 15402 } 15403 b.Reset(BlockFirst) 15404 b.swapSuccessors() 15405 return true 15406 } 15407 // match: (CGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 15408 // result: (BRC {s390x.NoCarry} carry) 15409 for b.Controls[0].Op == OpSelect0 { 15410 v_0 := b.Controls[0] 15411 v_0_0 := v_0.Args[0] 15412 if v_0_0.Op != OpS390XADDE { 15413 break 15414 } 15415 carry := v_0_0.Args[2] 15416 v_0_0_0 := v_0_0.Args[0] 15417 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 15418 break 15419 } 15420 v_0_0_1 := v_0_0.Args[1] 15421 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal { 15422 break 15423 } 15424 b.resetWithControl(BlockS390XBRC, carry) 15425 b.Aux = s390xCCMaskToAux(s390x.NoCarry) 15426 return true 15427 } 15428 // match: (CGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1]) 15429 // result: (BRC {s390x.Carry} carry) 15430 for b.Controls[0].Op == OpSelect0 { 15431 v_0 := b.Controls[0] 15432 v_0_0 := v_0.Args[0] 15433 if v_0_0.Op != OpS390XADDE { 15434 break 15435 } 15436 carry := v_0_0.Args[2] 15437 v_0_0_0 := v_0_0.Args[0] 15438 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 15439 break 15440 } 15441 v_0_0_1 := v_0_0.Args[1] 15442 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal { 15443 break 15444 } 15445 b.resetWithControl(BlockS390XBRC, carry) 15446 b.Aux = s390xCCMaskToAux(s390x.Carry) 15447 return true 15448 } 15449 // match: (CGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 15450 // result: (BRC {s390x.Carry} carry) 15451 for b.Controls[0].Op == OpSelect0 { 15452 v_0 := b.Controls[0] 15453 v_0_0 := v_0.Args[0] 15454 if v_0_0.Op != OpS390XADDE { 15455 break 15456 } 15457 carry := v_0_0.Args[2] 15458 v_0_0_0 := v_0_0.Args[0] 15459 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 15460 break 15461 } 15462 v_0_0_1 := v_0_0.Args[1] 15463 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater { 15464 break 15465 } 15466 b.resetWithControl(BlockS390XBRC, carry) 15467 b.Aux = s390xCCMaskToAux(s390x.Carry) 15468 return true 15469 } 15470 // match: (CGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1]) 15471 // result: (BRC {s390x.NoCarry} carry) 15472 for b.Controls[0].Op == OpSelect0 { 15473 v_0 := b.Controls[0] 15474 v_0_0 := v_0.Args[0] 15475 if v_0_0.Op != OpS390XADDE { 15476 break 15477 } 15478 carry := v_0_0.Args[2] 15479 v_0_0_0 := v_0_0.Args[0] 15480 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 15481 break 15482 } 15483 v_0_0_1 := v_0_0.Args[1] 15484 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater { 15485 break 15486 } 15487 b.resetWithControl(BlockS390XBRC, carry) 15488 b.Aux = s390xCCMaskToAux(s390x.NoCarry) 15489 return true 15490 } 15491 // match: (CGIJ {s390x.Greater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 15492 // result: (BRC {s390x.Carry} carry) 15493 for b.Controls[0].Op == OpSelect0 { 15494 v_0 := b.Controls[0] 15495 v_0_0 := v_0.Args[0] 15496 if v_0_0.Op != OpS390XADDE { 15497 break 15498 } 15499 carry := v_0_0.Args[2] 15500 v_0_0_0 := v_0_0.Args[0] 15501 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 15502 break 15503 } 15504 v_0_0_1 := v_0_0.Args[1] 15505 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater { 15506 break 15507 } 15508 b.resetWithControl(BlockS390XBRC, carry) 15509 b.Aux = s390xCCMaskToAux(s390x.Carry) 15510 return true 15511 } 15512 // match: (CGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 15513 // result: (BRC {s390x.NoBorrow} borrow) 15514 for b.Controls[0].Op == OpS390XNEG { 15515 v_0 := b.Controls[0] 15516 v_0_0 := v_0.Args[0] 15517 if v_0_0.Op != OpSelect0 { 15518 break 15519 } 15520 v_0_0_0 := v_0_0.Args[0] 15521 if v_0_0_0.Op != OpS390XSUBE { 15522 break 15523 } 15524 borrow := v_0_0_0.Args[2] 15525 v_0_0_0_0 := v_0_0_0.Args[0] 15526 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 15527 break 15528 } 15529 v_0_0_0_1 := v_0_0_0.Args[1] 15530 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 { 15531 break 15532 } 15533 b.resetWithControl(BlockS390XBRC, borrow) 15534 b.Aux = s390xCCMaskToAux(s390x.NoBorrow) 15535 return true 15536 } 15537 // match: (CGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1]) 15538 // result: (BRC {s390x.Borrow} borrow) 15539 for b.Controls[0].Op == OpS390XNEG { 15540 v_0 := b.Controls[0] 15541 v_0_0 := v_0.Args[0] 15542 if v_0_0.Op != OpSelect0 { 15543 break 15544 } 15545 v_0_0_0 := v_0_0.Args[0] 15546 if v_0_0_0.Op != OpS390XSUBE { 15547 break 15548 } 15549 borrow := v_0_0_0.Args[2] 15550 v_0_0_0_0 := v_0_0_0.Args[0] 15551 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 15552 break 15553 } 15554 v_0_0_0_1 := v_0_0_0.Args[1] 15555 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 { 15556 break 15557 } 15558 b.resetWithControl(BlockS390XBRC, borrow) 15559 b.Aux = s390xCCMaskToAux(s390x.Borrow) 15560 return true 15561 } 15562 // match: (CGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 15563 // result: (BRC {s390x.Borrow} borrow) 15564 for b.Controls[0].Op == OpS390XNEG { 15565 v_0 := b.Controls[0] 15566 v_0_0 := v_0.Args[0] 15567 if v_0_0.Op != OpSelect0 { 15568 break 15569 } 15570 v_0_0_0 := v_0_0.Args[0] 15571 if v_0_0_0.Op != OpS390XSUBE { 15572 break 15573 } 15574 borrow := v_0_0_0.Args[2] 15575 v_0_0_0_0 := v_0_0_0.Args[0] 15576 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 15577 break 15578 } 15579 v_0_0_0_1 := v_0_0_0.Args[1] 15580 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 { 15581 break 15582 } 15583 b.resetWithControl(BlockS390XBRC, borrow) 15584 b.Aux = s390xCCMaskToAux(s390x.Borrow) 15585 return true 15586 } 15587 // match: (CGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1]) 15588 // result: (BRC {s390x.NoBorrow} borrow) 15589 for b.Controls[0].Op == OpS390XNEG { 15590 v_0 := b.Controls[0] 15591 v_0_0 := v_0.Args[0] 15592 if v_0_0.Op != OpSelect0 { 15593 break 15594 } 15595 v_0_0_0 := v_0_0.Args[0] 15596 if v_0_0_0.Op != OpS390XSUBE { 15597 break 15598 } 15599 borrow := v_0_0_0.Args[2] 15600 v_0_0_0_0 := v_0_0_0.Args[0] 15601 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 15602 break 15603 } 15604 v_0_0_0_1 := v_0_0_0.Args[1] 15605 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 { 15606 break 15607 } 15608 b.resetWithControl(BlockS390XBRC, borrow) 15609 b.Aux = s390xCCMaskToAux(s390x.NoBorrow) 15610 return true 15611 } 15612 // match: (CGIJ {s390x.Greater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 15613 // result: (BRC {s390x.Borrow} borrow) 15614 for b.Controls[0].Op == OpS390XNEG { 15615 v_0 := b.Controls[0] 15616 v_0_0 := v_0.Args[0] 15617 if v_0_0.Op != OpSelect0 { 15618 break 15619 } 15620 v_0_0_0 := v_0_0.Args[0] 15621 if v_0_0_0.Op != OpS390XSUBE { 15622 break 15623 } 15624 borrow := v_0_0_0.Args[2] 15625 v_0_0_0_0 := v_0_0_0.Args[0] 15626 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 15627 break 15628 } 15629 v_0_0_0_1 := v_0_0_0.Args[1] 15630 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 { 15631 break 15632 } 15633 b.resetWithControl(BlockS390XBRC, borrow) 15634 b.Aux = s390xCCMaskToAux(s390x.Borrow) 15635 return true 15636 } 15637 case BlockS390XCGRJ: 15638 // match: (CGRJ {c} x (MOVDconst [y]) yes no) 15639 // cond: is8Bit(y) 15640 // result: (CGIJ {c} x [ int8(y)] yes no) 15641 for b.Controls[1].Op == OpS390XMOVDconst { 15642 x := b.Controls[0] 15643 v_1 := b.Controls[1] 15644 y := auxIntToInt64(v_1.AuxInt) 15645 c := auxToS390xCCMask(b.Aux) 15646 if !(is8Bit(y)) { 15647 break 15648 } 15649 b.resetWithControl(BlockS390XCGIJ, x) 15650 b.AuxInt = int8ToAuxInt(int8(y)) 15651 b.Aux = s390xCCMaskToAux(c) 15652 return true 15653 } 15654 // match: (CGRJ {c} (MOVDconst [x]) y yes no) 15655 // cond: is8Bit(x) 15656 // result: (CGIJ {c.ReverseComparison()} y [ int8(x)] yes no) 15657 for b.Controls[0].Op == OpS390XMOVDconst { 15658 v_0 := b.Controls[0] 15659 x := auxIntToInt64(v_0.AuxInt) 15660 y := b.Controls[1] 15661 c := auxToS390xCCMask(b.Aux) 15662 if !(is8Bit(x)) { 15663 break 15664 } 15665 b.resetWithControl(BlockS390XCGIJ, y) 15666 b.AuxInt = int8ToAuxInt(int8(x)) 15667 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 15668 return true 15669 } 15670 // match: (CGRJ {c} x (MOVDconst [y]) yes no) 15671 // cond: !is8Bit(y) && is32Bit(y) 15672 // result: (BRC {c} (CMPconst x [int32(y)]) yes no) 15673 for b.Controls[1].Op == OpS390XMOVDconst { 15674 x := b.Controls[0] 15675 v_1 := b.Controls[1] 15676 y := auxIntToInt64(v_1.AuxInt) 15677 c := auxToS390xCCMask(b.Aux) 15678 if !(!is8Bit(y) && is32Bit(y)) { 15679 break 15680 } 15681 v0 := b.NewValue0(x.Pos, OpS390XCMPconst, types.TypeFlags) 15682 v0.AuxInt = int32ToAuxInt(int32(y)) 15683 v0.AddArg(x) 15684 b.resetWithControl(BlockS390XBRC, v0) 15685 b.Aux = s390xCCMaskToAux(c) 15686 return true 15687 } 15688 // match: (CGRJ {c} (MOVDconst [x]) y yes no) 15689 // cond: !is8Bit(x) && is32Bit(x) 15690 // result: (BRC {c.ReverseComparison()} (CMPconst y [int32(x)]) yes no) 15691 for b.Controls[0].Op == OpS390XMOVDconst { 15692 v_0 := b.Controls[0] 15693 x := auxIntToInt64(v_0.AuxInt) 15694 y := b.Controls[1] 15695 c := auxToS390xCCMask(b.Aux) 15696 if !(!is8Bit(x) && is32Bit(x)) { 15697 break 15698 } 15699 v0 := b.NewValue0(v_0.Pos, OpS390XCMPconst, types.TypeFlags) 15700 v0.AuxInt = int32ToAuxInt(int32(x)) 15701 v0.AddArg(y) 15702 b.resetWithControl(BlockS390XBRC, v0) 15703 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 15704 return true 15705 } 15706 // match: (CGRJ {c} x y yes no) 15707 // cond: x == y && c&s390x.Equal != 0 15708 // result: (First yes no) 15709 for { 15710 x := b.Controls[0] 15711 y := b.Controls[1] 15712 c := auxToS390xCCMask(b.Aux) 15713 if !(x == y && c&s390x.Equal != 0) { 15714 break 15715 } 15716 b.Reset(BlockFirst) 15717 return true 15718 } 15719 // match: (CGRJ {c} x y yes no) 15720 // cond: x == y && c&s390x.Equal == 0 15721 // result: (First no yes) 15722 for { 15723 x := b.Controls[0] 15724 y := b.Controls[1] 15725 c := auxToS390xCCMask(b.Aux) 15726 if !(x == y && c&s390x.Equal == 0) { 15727 break 15728 } 15729 b.Reset(BlockFirst) 15730 b.swapSuccessors() 15731 return true 15732 } 15733 case BlockS390XCIJ: 15734 // match: (CIJ {c} (MOVWreg x) [y] yes no) 15735 // result: (CIJ {c} x [y] yes no) 15736 for b.Controls[0].Op == OpS390XMOVWreg { 15737 v_0 := b.Controls[0] 15738 x := v_0.Args[0] 15739 y := auxIntToInt8(b.AuxInt) 15740 c := auxToS390xCCMask(b.Aux) 15741 b.resetWithControl(BlockS390XCIJ, x) 15742 b.AuxInt = int8ToAuxInt(y) 15743 b.Aux = s390xCCMaskToAux(c) 15744 return true 15745 } 15746 // match: (CIJ {c} (MOVWZreg x) [y] yes no) 15747 // result: (CIJ {c} x [y] yes no) 15748 for b.Controls[0].Op == OpS390XMOVWZreg { 15749 v_0 := b.Controls[0] 15750 x := v_0.Args[0] 15751 y := auxIntToInt8(b.AuxInt) 15752 c := auxToS390xCCMask(b.Aux) 15753 b.resetWithControl(BlockS390XCIJ, x) 15754 b.AuxInt = int8ToAuxInt(y) 15755 b.Aux = s390xCCMaskToAux(c) 15756 return true 15757 } 15758 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 15759 // cond: c&s390x.Equal != 0 && int32(x) == int32(y) 15760 // result: (First yes no) 15761 for b.Controls[0].Op == OpS390XMOVDconst { 15762 v_0 := b.Controls[0] 15763 x := auxIntToInt64(v_0.AuxInt) 15764 y := auxIntToInt8(b.AuxInt) 15765 c := auxToS390xCCMask(b.Aux) 15766 if !(c&s390x.Equal != 0 && int32(x) == int32(y)) { 15767 break 15768 } 15769 b.Reset(BlockFirst) 15770 return true 15771 } 15772 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 15773 // cond: c&s390x.Less != 0 && int32(x) < int32(y) 15774 // result: (First yes no) 15775 for b.Controls[0].Op == OpS390XMOVDconst { 15776 v_0 := b.Controls[0] 15777 x := auxIntToInt64(v_0.AuxInt) 15778 y := auxIntToInt8(b.AuxInt) 15779 c := auxToS390xCCMask(b.Aux) 15780 if !(c&s390x.Less != 0 && int32(x) < int32(y)) { 15781 break 15782 } 15783 b.Reset(BlockFirst) 15784 return true 15785 } 15786 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 15787 // cond: c&s390x.Greater != 0 && int32(x) > int32(y) 15788 // result: (First yes no) 15789 for b.Controls[0].Op == OpS390XMOVDconst { 15790 v_0 := b.Controls[0] 15791 x := auxIntToInt64(v_0.AuxInt) 15792 y := auxIntToInt8(b.AuxInt) 15793 c := auxToS390xCCMask(b.Aux) 15794 if !(c&s390x.Greater != 0 && int32(x) > int32(y)) { 15795 break 15796 } 15797 b.Reset(BlockFirst) 15798 return true 15799 } 15800 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 15801 // cond: c&s390x.Equal == 0 && int32(x) == int32(y) 15802 // result: (First no yes) 15803 for b.Controls[0].Op == OpS390XMOVDconst { 15804 v_0 := b.Controls[0] 15805 x := auxIntToInt64(v_0.AuxInt) 15806 y := auxIntToInt8(b.AuxInt) 15807 c := auxToS390xCCMask(b.Aux) 15808 if !(c&s390x.Equal == 0 && int32(x) == int32(y)) { 15809 break 15810 } 15811 b.Reset(BlockFirst) 15812 b.swapSuccessors() 15813 return true 15814 } 15815 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 15816 // cond: c&s390x.Less == 0 && int32(x) < int32(y) 15817 // result: (First no yes) 15818 for b.Controls[0].Op == OpS390XMOVDconst { 15819 v_0 := b.Controls[0] 15820 x := auxIntToInt64(v_0.AuxInt) 15821 y := auxIntToInt8(b.AuxInt) 15822 c := auxToS390xCCMask(b.Aux) 15823 if !(c&s390x.Less == 0 && int32(x) < int32(y)) { 15824 break 15825 } 15826 b.Reset(BlockFirst) 15827 b.swapSuccessors() 15828 return true 15829 } 15830 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 15831 // cond: c&s390x.Greater == 0 && int32(x) > int32(y) 15832 // result: (First no yes) 15833 for b.Controls[0].Op == OpS390XMOVDconst { 15834 v_0 := b.Controls[0] 15835 x := auxIntToInt64(v_0.AuxInt) 15836 y := auxIntToInt8(b.AuxInt) 15837 c := auxToS390xCCMask(b.Aux) 15838 if !(c&s390x.Greater == 0 && int32(x) > int32(y)) { 15839 break 15840 } 15841 b.Reset(BlockFirst) 15842 b.swapSuccessors() 15843 return true 15844 } 15845 case BlockS390XCLGIJ: 15846 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 15847 // cond: c&s390x.Equal != 0 && uint64(x) == uint64(y) 15848 // result: (First yes no) 15849 for b.Controls[0].Op == OpS390XMOVDconst { 15850 v_0 := b.Controls[0] 15851 x := auxIntToInt64(v_0.AuxInt) 15852 y := auxIntToUint8(b.AuxInt) 15853 c := auxToS390xCCMask(b.Aux) 15854 if !(c&s390x.Equal != 0 && uint64(x) == uint64(y)) { 15855 break 15856 } 15857 b.Reset(BlockFirst) 15858 return true 15859 } 15860 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 15861 // cond: c&s390x.Less != 0 && uint64(x) < uint64(y) 15862 // result: (First yes no) 15863 for b.Controls[0].Op == OpS390XMOVDconst { 15864 v_0 := b.Controls[0] 15865 x := auxIntToInt64(v_0.AuxInt) 15866 y := auxIntToUint8(b.AuxInt) 15867 c := auxToS390xCCMask(b.Aux) 15868 if !(c&s390x.Less != 0 && uint64(x) < uint64(y)) { 15869 break 15870 } 15871 b.Reset(BlockFirst) 15872 return true 15873 } 15874 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 15875 // cond: c&s390x.Greater != 0 && uint64(x) > uint64(y) 15876 // result: (First yes no) 15877 for b.Controls[0].Op == OpS390XMOVDconst { 15878 v_0 := b.Controls[0] 15879 x := auxIntToInt64(v_0.AuxInt) 15880 y := auxIntToUint8(b.AuxInt) 15881 c := auxToS390xCCMask(b.Aux) 15882 if !(c&s390x.Greater != 0 && uint64(x) > uint64(y)) { 15883 break 15884 } 15885 b.Reset(BlockFirst) 15886 return true 15887 } 15888 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 15889 // cond: c&s390x.Equal == 0 && uint64(x) == uint64(y) 15890 // result: (First no yes) 15891 for b.Controls[0].Op == OpS390XMOVDconst { 15892 v_0 := b.Controls[0] 15893 x := auxIntToInt64(v_0.AuxInt) 15894 y := auxIntToUint8(b.AuxInt) 15895 c := auxToS390xCCMask(b.Aux) 15896 if !(c&s390x.Equal == 0 && uint64(x) == uint64(y)) { 15897 break 15898 } 15899 b.Reset(BlockFirst) 15900 b.swapSuccessors() 15901 return true 15902 } 15903 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 15904 // cond: c&s390x.Less == 0 && uint64(x) < uint64(y) 15905 // result: (First no yes) 15906 for b.Controls[0].Op == OpS390XMOVDconst { 15907 v_0 := b.Controls[0] 15908 x := auxIntToInt64(v_0.AuxInt) 15909 y := auxIntToUint8(b.AuxInt) 15910 c := auxToS390xCCMask(b.Aux) 15911 if !(c&s390x.Less == 0 && uint64(x) < uint64(y)) { 15912 break 15913 } 15914 b.Reset(BlockFirst) 15915 b.swapSuccessors() 15916 return true 15917 } 15918 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 15919 // cond: c&s390x.Greater == 0 && uint64(x) > uint64(y) 15920 // result: (First no yes) 15921 for b.Controls[0].Op == OpS390XMOVDconst { 15922 v_0 := b.Controls[0] 15923 x := auxIntToInt64(v_0.AuxInt) 15924 y := auxIntToUint8(b.AuxInt) 15925 c := auxToS390xCCMask(b.Aux) 15926 if !(c&s390x.Greater == 0 && uint64(x) > uint64(y)) { 15927 break 15928 } 15929 b.Reset(BlockFirst) 15930 b.swapSuccessors() 15931 return true 15932 } 15933 // match: (CLGIJ {s390x.GreaterOrEqual} _ [0] yes no) 15934 // result: (First yes no) 15935 for { 15936 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 15937 break 15938 } 15939 b.Reset(BlockFirst) 15940 return true 15941 } 15942 // match: (CLGIJ {s390x.Less} _ [0] yes no) 15943 // result: (First no yes) 15944 for { 15945 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Less { 15946 break 15947 } 15948 b.Reset(BlockFirst) 15949 b.swapSuccessors() 15950 return true 15951 } 15952 // match: (CLGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 15953 // result: (BRC {s390x.NoCarry} carry) 15954 for b.Controls[0].Op == OpSelect0 { 15955 v_0 := b.Controls[0] 15956 v_0_0 := v_0.Args[0] 15957 if v_0_0.Op != OpS390XADDE { 15958 break 15959 } 15960 carry := v_0_0.Args[2] 15961 v_0_0_0 := v_0_0.Args[0] 15962 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 15963 break 15964 } 15965 v_0_0_1 := v_0_0.Args[1] 15966 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal { 15967 break 15968 } 15969 b.resetWithControl(BlockS390XBRC, carry) 15970 b.Aux = s390xCCMaskToAux(s390x.NoCarry) 15971 return true 15972 } 15973 // match: (CLGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1]) 15974 // result: (BRC {s390x.Carry} carry) 15975 for b.Controls[0].Op == OpSelect0 { 15976 v_0 := b.Controls[0] 15977 v_0_0 := v_0.Args[0] 15978 if v_0_0.Op != OpS390XADDE { 15979 break 15980 } 15981 carry := v_0_0.Args[2] 15982 v_0_0_0 := v_0_0.Args[0] 15983 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 15984 break 15985 } 15986 v_0_0_1 := v_0_0.Args[1] 15987 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal { 15988 break 15989 } 15990 b.resetWithControl(BlockS390XBRC, carry) 15991 b.Aux = s390xCCMaskToAux(s390x.Carry) 15992 return true 15993 } 15994 // match: (CLGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 15995 // result: (BRC {s390x.Carry} carry) 15996 for b.Controls[0].Op == OpSelect0 { 15997 v_0 := b.Controls[0] 15998 v_0_0 := v_0.Args[0] 15999 if v_0_0.Op != OpS390XADDE { 16000 break 16001 } 16002 carry := v_0_0.Args[2] 16003 v_0_0_0 := v_0_0.Args[0] 16004 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 16005 break 16006 } 16007 v_0_0_1 := v_0_0.Args[1] 16008 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater { 16009 break 16010 } 16011 b.resetWithControl(BlockS390XBRC, carry) 16012 b.Aux = s390xCCMaskToAux(s390x.Carry) 16013 return true 16014 } 16015 // match: (CLGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1]) 16016 // result: (BRC {s390x.NoCarry} carry) 16017 for b.Controls[0].Op == OpSelect0 { 16018 v_0 := b.Controls[0] 16019 v_0_0 := v_0.Args[0] 16020 if v_0_0.Op != OpS390XADDE { 16021 break 16022 } 16023 carry := v_0_0.Args[2] 16024 v_0_0_0 := v_0_0.Args[0] 16025 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 16026 break 16027 } 16028 v_0_0_1 := v_0_0.Args[1] 16029 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater { 16030 break 16031 } 16032 b.resetWithControl(BlockS390XBRC, carry) 16033 b.Aux = s390xCCMaskToAux(s390x.NoCarry) 16034 return true 16035 } 16036 // match: (CLGIJ {s390x.Greater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 16037 // result: (BRC {s390x.Carry} carry) 16038 for b.Controls[0].Op == OpSelect0 { 16039 v_0 := b.Controls[0] 16040 v_0_0 := v_0.Args[0] 16041 if v_0_0.Op != OpS390XADDE { 16042 break 16043 } 16044 carry := v_0_0.Args[2] 16045 v_0_0_0 := v_0_0.Args[0] 16046 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 16047 break 16048 } 16049 v_0_0_1 := v_0_0.Args[1] 16050 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater { 16051 break 16052 } 16053 b.resetWithControl(BlockS390XBRC, carry) 16054 b.Aux = s390xCCMaskToAux(s390x.Carry) 16055 return true 16056 } 16057 // match: (CLGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 16058 // result: (BRC {s390x.NoBorrow} borrow) 16059 for b.Controls[0].Op == OpS390XNEG { 16060 v_0 := b.Controls[0] 16061 v_0_0 := v_0.Args[0] 16062 if v_0_0.Op != OpSelect0 { 16063 break 16064 } 16065 v_0_0_0 := v_0_0.Args[0] 16066 if v_0_0_0.Op != OpS390XSUBE { 16067 break 16068 } 16069 borrow := v_0_0_0.Args[2] 16070 v_0_0_0_0 := v_0_0_0.Args[0] 16071 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16072 break 16073 } 16074 v_0_0_0_1 := v_0_0_0.Args[1] 16075 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 { 16076 break 16077 } 16078 b.resetWithControl(BlockS390XBRC, borrow) 16079 b.Aux = s390xCCMaskToAux(s390x.NoBorrow) 16080 return true 16081 } 16082 // match: (CLGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1]) 16083 // result: (BRC {s390x.Borrow} borrow) 16084 for b.Controls[0].Op == OpS390XNEG { 16085 v_0 := b.Controls[0] 16086 v_0_0 := v_0.Args[0] 16087 if v_0_0.Op != OpSelect0 { 16088 break 16089 } 16090 v_0_0_0 := v_0_0.Args[0] 16091 if v_0_0_0.Op != OpS390XSUBE { 16092 break 16093 } 16094 borrow := v_0_0_0.Args[2] 16095 v_0_0_0_0 := v_0_0_0.Args[0] 16096 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16097 break 16098 } 16099 v_0_0_0_1 := v_0_0_0.Args[1] 16100 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 { 16101 break 16102 } 16103 b.resetWithControl(BlockS390XBRC, borrow) 16104 b.Aux = s390xCCMaskToAux(s390x.Borrow) 16105 return true 16106 } 16107 // match: (CLGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 16108 // result: (BRC {s390x.Borrow} borrow) 16109 for b.Controls[0].Op == OpS390XNEG { 16110 v_0 := b.Controls[0] 16111 v_0_0 := v_0.Args[0] 16112 if v_0_0.Op != OpSelect0 { 16113 break 16114 } 16115 v_0_0_0 := v_0_0.Args[0] 16116 if v_0_0_0.Op != OpS390XSUBE { 16117 break 16118 } 16119 borrow := v_0_0_0.Args[2] 16120 v_0_0_0_0 := v_0_0_0.Args[0] 16121 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16122 break 16123 } 16124 v_0_0_0_1 := v_0_0_0.Args[1] 16125 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 { 16126 break 16127 } 16128 b.resetWithControl(BlockS390XBRC, borrow) 16129 b.Aux = s390xCCMaskToAux(s390x.Borrow) 16130 return true 16131 } 16132 // match: (CLGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1]) 16133 // result: (BRC {s390x.NoBorrow} borrow) 16134 for b.Controls[0].Op == OpS390XNEG { 16135 v_0 := b.Controls[0] 16136 v_0_0 := v_0.Args[0] 16137 if v_0_0.Op != OpSelect0 { 16138 break 16139 } 16140 v_0_0_0 := v_0_0.Args[0] 16141 if v_0_0_0.Op != OpS390XSUBE { 16142 break 16143 } 16144 borrow := v_0_0_0.Args[2] 16145 v_0_0_0_0 := v_0_0_0.Args[0] 16146 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16147 break 16148 } 16149 v_0_0_0_1 := v_0_0_0.Args[1] 16150 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 { 16151 break 16152 } 16153 b.resetWithControl(BlockS390XBRC, borrow) 16154 b.Aux = s390xCCMaskToAux(s390x.NoBorrow) 16155 return true 16156 } 16157 // match: (CLGIJ {s390x.Greater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 16158 // result: (BRC {s390x.Borrow} borrow) 16159 for b.Controls[0].Op == OpS390XNEG { 16160 v_0 := b.Controls[0] 16161 v_0_0 := v_0.Args[0] 16162 if v_0_0.Op != OpSelect0 { 16163 break 16164 } 16165 v_0_0_0 := v_0_0.Args[0] 16166 if v_0_0_0.Op != OpS390XSUBE { 16167 break 16168 } 16169 borrow := v_0_0_0.Args[2] 16170 v_0_0_0_0 := v_0_0_0.Args[0] 16171 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16172 break 16173 } 16174 v_0_0_0_1 := v_0_0_0.Args[1] 16175 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 { 16176 break 16177 } 16178 b.resetWithControl(BlockS390XBRC, borrow) 16179 b.Aux = s390xCCMaskToAux(s390x.Borrow) 16180 return true 16181 } 16182 case BlockS390XCLGRJ: 16183 // match: (CLGRJ {c} x (MOVDconst [y]) yes no) 16184 // cond: isU8Bit(y) 16185 // result: (CLGIJ {c} x [uint8(y)] yes no) 16186 for b.Controls[1].Op == OpS390XMOVDconst { 16187 x := b.Controls[0] 16188 v_1 := b.Controls[1] 16189 y := auxIntToInt64(v_1.AuxInt) 16190 c := auxToS390xCCMask(b.Aux) 16191 if !(isU8Bit(y)) { 16192 break 16193 } 16194 b.resetWithControl(BlockS390XCLGIJ, x) 16195 b.AuxInt = uint8ToAuxInt(uint8(y)) 16196 b.Aux = s390xCCMaskToAux(c) 16197 return true 16198 } 16199 // match: (CLGRJ {c} (MOVDconst [x]) y yes no) 16200 // cond: isU8Bit(x) 16201 // result: (CLGIJ {c.ReverseComparison()} y [uint8(x)] yes no) 16202 for b.Controls[0].Op == OpS390XMOVDconst { 16203 v_0 := b.Controls[0] 16204 x := auxIntToInt64(v_0.AuxInt) 16205 y := b.Controls[1] 16206 c := auxToS390xCCMask(b.Aux) 16207 if !(isU8Bit(x)) { 16208 break 16209 } 16210 b.resetWithControl(BlockS390XCLGIJ, y) 16211 b.AuxInt = uint8ToAuxInt(uint8(x)) 16212 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 16213 return true 16214 } 16215 // match: (CLGRJ {c} x (MOVDconst [y]) yes no) 16216 // cond: !isU8Bit(y) && isU32Bit(y) 16217 // result: (BRC {c} (CMPUconst x [int32(y)]) yes no) 16218 for b.Controls[1].Op == OpS390XMOVDconst { 16219 x := b.Controls[0] 16220 v_1 := b.Controls[1] 16221 y := auxIntToInt64(v_1.AuxInt) 16222 c := auxToS390xCCMask(b.Aux) 16223 if !(!isU8Bit(y) && isU32Bit(y)) { 16224 break 16225 } 16226 v0 := b.NewValue0(x.Pos, OpS390XCMPUconst, types.TypeFlags) 16227 v0.AuxInt = int32ToAuxInt(int32(y)) 16228 v0.AddArg(x) 16229 b.resetWithControl(BlockS390XBRC, v0) 16230 b.Aux = s390xCCMaskToAux(c) 16231 return true 16232 } 16233 // match: (CLGRJ {c} (MOVDconst [x]) y yes no) 16234 // cond: !isU8Bit(x) && isU32Bit(x) 16235 // result: (BRC {c.ReverseComparison()} (CMPUconst y [int32(x)]) yes no) 16236 for b.Controls[0].Op == OpS390XMOVDconst { 16237 v_0 := b.Controls[0] 16238 x := auxIntToInt64(v_0.AuxInt) 16239 y := b.Controls[1] 16240 c := auxToS390xCCMask(b.Aux) 16241 if !(!isU8Bit(x) && isU32Bit(x)) { 16242 break 16243 } 16244 v0 := b.NewValue0(v_0.Pos, OpS390XCMPUconst, types.TypeFlags) 16245 v0.AuxInt = int32ToAuxInt(int32(x)) 16246 v0.AddArg(y) 16247 b.resetWithControl(BlockS390XBRC, v0) 16248 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 16249 return true 16250 } 16251 // match: (CLGRJ {c} x y yes no) 16252 // cond: x == y && c&s390x.Equal != 0 16253 // result: (First yes no) 16254 for { 16255 x := b.Controls[0] 16256 y := b.Controls[1] 16257 c := auxToS390xCCMask(b.Aux) 16258 if !(x == y && c&s390x.Equal != 0) { 16259 break 16260 } 16261 b.Reset(BlockFirst) 16262 return true 16263 } 16264 // match: (CLGRJ {c} x y yes no) 16265 // cond: x == y && c&s390x.Equal == 0 16266 // result: (First no yes) 16267 for { 16268 x := b.Controls[0] 16269 y := b.Controls[1] 16270 c := auxToS390xCCMask(b.Aux) 16271 if !(x == y && c&s390x.Equal == 0) { 16272 break 16273 } 16274 b.Reset(BlockFirst) 16275 b.swapSuccessors() 16276 return true 16277 } 16278 case BlockS390XCLIJ: 16279 // match: (CLIJ {s390x.LessOrGreater} (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp) [0] yes no) 16280 // cond: int32(x) != 0 16281 // result: (BRC {d} cmp yes no) 16282 for b.Controls[0].Op == OpS390XLOCGR { 16283 v_0 := b.Controls[0] 16284 d := auxToS390xCCMask(v_0.Aux) 16285 cmp := v_0.Args[2] 16286 v_0_0 := v_0.Args[0] 16287 if v_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0.AuxInt) != 0 { 16288 break 16289 } 16290 v_0_1 := v_0.Args[1] 16291 if v_0_1.Op != OpS390XMOVDconst { 16292 break 16293 } 16294 x := auxIntToInt64(v_0_1.AuxInt) 16295 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater || !(int32(x) != 0) { 16296 break 16297 } 16298 b.resetWithControl(BlockS390XBRC, cmp) 16299 b.Aux = s390xCCMaskToAux(d) 16300 return true 16301 } 16302 // match: (CLIJ {c} (MOVWreg x) [y] yes no) 16303 // result: (CLIJ {c} x [y] yes no) 16304 for b.Controls[0].Op == OpS390XMOVWreg { 16305 v_0 := b.Controls[0] 16306 x := v_0.Args[0] 16307 y := auxIntToUint8(b.AuxInt) 16308 c := auxToS390xCCMask(b.Aux) 16309 b.resetWithControl(BlockS390XCLIJ, x) 16310 b.AuxInt = uint8ToAuxInt(y) 16311 b.Aux = s390xCCMaskToAux(c) 16312 return true 16313 } 16314 // match: (CLIJ {c} (MOVWZreg x) [y] yes no) 16315 // result: (CLIJ {c} x [y] yes no) 16316 for b.Controls[0].Op == OpS390XMOVWZreg { 16317 v_0 := b.Controls[0] 16318 x := v_0.Args[0] 16319 y := auxIntToUint8(b.AuxInt) 16320 c := auxToS390xCCMask(b.Aux) 16321 b.resetWithControl(BlockS390XCLIJ, x) 16322 b.AuxInt = uint8ToAuxInt(y) 16323 b.Aux = s390xCCMaskToAux(c) 16324 return true 16325 } 16326 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 16327 // cond: c&s390x.Equal != 0 && uint32(x) == uint32(y) 16328 // result: (First yes no) 16329 for b.Controls[0].Op == OpS390XMOVDconst { 16330 v_0 := b.Controls[0] 16331 x := auxIntToInt64(v_0.AuxInt) 16332 y := auxIntToUint8(b.AuxInt) 16333 c := auxToS390xCCMask(b.Aux) 16334 if !(c&s390x.Equal != 0 && uint32(x) == uint32(y)) { 16335 break 16336 } 16337 b.Reset(BlockFirst) 16338 return true 16339 } 16340 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 16341 // cond: c&s390x.Less != 0 && uint32(x) < uint32(y) 16342 // result: (First yes no) 16343 for b.Controls[0].Op == OpS390XMOVDconst { 16344 v_0 := b.Controls[0] 16345 x := auxIntToInt64(v_0.AuxInt) 16346 y := auxIntToUint8(b.AuxInt) 16347 c := auxToS390xCCMask(b.Aux) 16348 if !(c&s390x.Less != 0 && uint32(x) < uint32(y)) { 16349 break 16350 } 16351 b.Reset(BlockFirst) 16352 return true 16353 } 16354 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 16355 // cond: c&s390x.Greater != 0 && uint32(x) > uint32(y) 16356 // result: (First yes no) 16357 for b.Controls[0].Op == OpS390XMOVDconst { 16358 v_0 := b.Controls[0] 16359 x := auxIntToInt64(v_0.AuxInt) 16360 y := auxIntToUint8(b.AuxInt) 16361 c := auxToS390xCCMask(b.Aux) 16362 if !(c&s390x.Greater != 0 && uint32(x) > uint32(y)) { 16363 break 16364 } 16365 b.Reset(BlockFirst) 16366 return true 16367 } 16368 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 16369 // cond: c&s390x.Equal == 0 && uint32(x) == uint32(y) 16370 // result: (First no yes) 16371 for b.Controls[0].Op == OpS390XMOVDconst { 16372 v_0 := b.Controls[0] 16373 x := auxIntToInt64(v_0.AuxInt) 16374 y := auxIntToUint8(b.AuxInt) 16375 c := auxToS390xCCMask(b.Aux) 16376 if !(c&s390x.Equal == 0 && uint32(x) == uint32(y)) { 16377 break 16378 } 16379 b.Reset(BlockFirst) 16380 b.swapSuccessors() 16381 return true 16382 } 16383 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 16384 // cond: c&s390x.Less == 0 && uint32(x) < uint32(y) 16385 // result: (First no yes) 16386 for b.Controls[0].Op == OpS390XMOVDconst { 16387 v_0 := b.Controls[0] 16388 x := auxIntToInt64(v_0.AuxInt) 16389 y := auxIntToUint8(b.AuxInt) 16390 c := auxToS390xCCMask(b.Aux) 16391 if !(c&s390x.Less == 0 && uint32(x) < uint32(y)) { 16392 break 16393 } 16394 b.Reset(BlockFirst) 16395 b.swapSuccessors() 16396 return true 16397 } 16398 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 16399 // cond: c&s390x.Greater == 0 && uint32(x) > uint32(y) 16400 // result: (First no yes) 16401 for b.Controls[0].Op == OpS390XMOVDconst { 16402 v_0 := b.Controls[0] 16403 x := auxIntToInt64(v_0.AuxInt) 16404 y := auxIntToUint8(b.AuxInt) 16405 c := auxToS390xCCMask(b.Aux) 16406 if !(c&s390x.Greater == 0 && uint32(x) > uint32(y)) { 16407 break 16408 } 16409 b.Reset(BlockFirst) 16410 b.swapSuccessors() 16411 return true 16412 } 16413 // match: (CLIJ {s390x.GreaterOrEqual} _ [0] yes no) 16414 // result: (First yes no) 16415 for { 16416 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 16417 break 16418 } 16419 b.Reset(BlockFirst) 16420 return true 16421 } 16422 // match: (CLIJ {s390x.Less} _ [0] yes no) 16423 // result: (First no yes) 16424 for { 16425 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Less { 16426 break 16427 } 16428 b.Reset(BlockFirst) 16429 b.swapSuccessors() 16430 return true 16431 } 16432 case BlockS390XCLRJ: 16433 // match: (CLRJ {c} x (MOVDconst [y]) yes no) 16434 // cond: isU8Bit(y) 16435 // result: (CLIJ {c} x [uint8(y)] yes no) 16436 for b.Controls[1].Op == OpS390XMOVDconst { 16437 x := b.Controls[0] 16438 v_1 := b.Controls[1] 16439 y := auxIntToInt64(v_1.AuxInt) 16440 c := auxToS390xCCMask(b.Aux) 16441 if !(isU8Bit(y)) { 16442 break 16443 } 16444 b.resetWithControl(BlockS390XCLIJ, x) 16445 b.AuxInt = uint8ToAuxInt(uint8(y)) 16446 b.Aux = s390xCCMaskToAux(c) 16447 return true 16448 } 16449 // match: (CLRJ {c} (MOVDconst [x]) y yes no) 16450 // cond: isU8Bit(x) 16451 // result: (CLIJ {c.ReverseComparison()} y [uint8(x)] yes no) 16452 for b.Controls[0].Op == OpS390XMOVDconst { 16453 v_0 := b.Controls[0] 16454 x := auxIntToInt64(v_0.AuxInt) 16455 y := b.Controls[1] 16456 c := auxToS390xCCMask(b.Aux) 16457 if !(isU8Bit(x)) { 16458 break 16459 } 16460 b.resetWithControl(BlockS390XCLIJ, y) 16461 b.AuxInt = uint8ToAuxInt(uint8(x)) 16462 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 16463 return true 16464 } 16465 // match: (CLRJ {c} x (MOVDconst [y]) yes no) 16466 // cond: !isU8Bit(y) && isU32Bit(y) 16467 // result: (BRC {c} (CMPWUconst x [int32(y)]) yes no) 16468 for b.Controls[1].Op == OpS390XMOVDconst { 16469 x := b.Controls[0] 16470 v_1 := b.Controls[1] 16471 y := auxIntToInt64(v_1.AuxInt) 16472 c := auxToS390xCCMask(b.Aux) 16473 if !(!isU8Bit(y) && isU32Bit(y)) { 16474 break 16475 } 16476 v0 := b.NewValue0(x.Pos, OpS390XCMPWUconst, types.TypeFlags) 16477 v0.AuxInt = int32ToAuxInt(int32(y)) 16478 v0.AddArg(x) 16479 b.resetWithControl(BlockS390XBRC, v0) 16480 b.Aux = s390xCCMaskToAux(c) 16481 return true 16482 } 16483 // match: (CLRJ {c} (MOVDconst [x]) y yes no) 16484 // cond: !isU8Bit(x) && isU32Bit(x) 16485 // result: (BRC {c.ReverseComparison()} (CMPWUconst y [int32(x)]) yes no) 16486 for b.Controls[0].Op == OpS390XMOVDconst { 16487 v_0 := b.Controls[0] 16488 x := auxIntToInt64(v_0.AuxInt) 16489 y := b.Controls[1] 16490 c := auxToS390xCCMask(b.Aux) 16491 if !(!isU8Bit(x) && isU32Bit(x)) { 16492 break 16493 } 16494 v0 := b.NewValue0(v_0.Pos, OpS390XCMPWUconst, types.TypeFlags) 16495 v0.AuxInt = int32ToAuxInt(int32(x)) 16496 v0.AddArg(y) 16497 b.resetWithControl(BlockS390XBRC, v0) 16498 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 16499 return true 16500 } 16501 // match: (CLRJ {c} x y yes no) 16502 // cond: x == y && c&s390x.Equal != 0 16503 // result: (First yes no) 16504 for { 16505 x := b.Controls[0] 16506 y := b.Controls[1] 16507 c := auxToS390xCCMask(b.Aux) 16508 if !(x == y && c&s390x.Equal != 0) { 16509 break 16510 } 16511 b.Reset(BlockFirst) 16512 return true 16513 } 16514 // match: (CLRJ {c} x y yes no) 16515 // cond: x == y && c&s390x.Equal == 0 16516 // result: (First no yes) 16517 for { 16518 x := b.Controls[0] 16519 y := b.Controls[1] 16520 c := auxToS390xCCMask(b.Aux) 16521 if !(x == y && c&s390x.Equal == 0) { 16522 break 16523 } 16524 b.Reset(BlockFirst) 16525 b.swapSuccessors() 16526 return true 16527 } 16528 case BlockS390XCRJ: 16529 // match: (CRJ {c} x (MOVDconst [y]) yes no) 16530 // cond: is8Bit(y) 16531 // result: (CIJ {c} x [ int8(y)] yes no) 16532 for b.Controls[1].Op == OpS390XMOVDconst { 16533 x := b.Controls[0] 16534 v_1 := b.Controls[1] 16535 y := auxIntToInt64(v_1.AuxInt) 16536 c := auxToS390xCCMask(b.Aux) 16537 if !(is8Bit(y)) { 16538 break 16539 } 16540 b.resetWithControl(BlockS390XCIJ, x) 16541 b.AuxInt = int8ToAuxInt(int8(y)) 16542 b.Aux = s390xCCMaskToAux(c) 16543 return true 16544 } 16545 // match: (CRJ {c} (MOVDconst [x]) y yes no) 16546 // cond: is8Bit(x) 16547 // result: (CIJ {c.ReverseComparison()} y [ int8(x)] yes no) 16548 for b.Controls[0].Op == OpS390XMOVDconst { 16549 v_0 := b.Controls[0] 16550 x := auxIntToInt64(v_0.AuxInt) 16551 y := b.Controls[1] 16552 c := auxToS390xCCMask(b.Aux) 16553 if !(is8Bit(x)) { 16554 break 16555 } 16556 b.resetWithControl(BlockS390XCIJ, y) 16557 b.AuxInt = int8ToAuxInt(int8(x)) 16558 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 16559 return true 16560 } 16561 // match: (CRJ {c} x (MOVDconst [y]) yes no) 16562 // cond: !is8Bit(y) && is32Bit(y) 16563 // result: (BRC {c} (CMPWconst x [int32(y)]) yes no) 16564 for b.Controls[1].Op == OpS390XMOVDconst { 16565 x := b.Controls[0] 16566 v_1 := b.Controls[1] 16567 y := auxIntToInt64(v_1.AuxInt) 16568 c := auxToS390xCCMask(b.Aux) 16569 if !(!is8Bit(y) && is32Bit(y)) { 16570 break 16571 } 16572 v0 := b.NewValue0(x.Pos, OpS390XCMPWconst, types.TypeFlags) 16573 v0.AuxInt = int32ToAuxInt(int32(y)) 16574 v0.AddArg(x) 16575 b.resetWithControl(BlockS390XBRC, v0) 16576 b.Aux = s390xCCMaskToAux(c) 16577 return true 16578 } 16579 // match: (CRJ {c} (MOVDconst [x]) y yes no) 16580 // cond: !is8Bit(x) && is32Bit(x) 16581 // result: (BRC {c.ReverseComparison()} (CMPWconst y [int32(x)]) yes no) 16582 for b.Controls[0].Op == OpS390XMOVDconst { 16583 v_0 := b.Controls[0] 16584 x := auxIntToInt64(v_0.AuxInt) 16585 y := b.Controls[1] 16586 c := auxToS390xCCMask(b.Aux) 16587 if !(!is8Bit(x) && is32Bit(x)) { 16588 break 16589 } 16590 v0 := b.NewValue0(v_0.Pos, OpS390XCMPWconst, types.TypeFlags) 16591 v0.AuxInt = int32ToAuxInt(int32(x)) 16592 v0.AddArg(y) 16593 b.resetWithControl(BlockS390XBRC, v0) 16594 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 16595 return true 16596 } 16597 // match: (CRJ {c} x y yes no) 16598 // cond: x == y && c&s390x.Equal != 0 16599 // result: (First yes no) 16600 for { 16601 x := b.Controls[0] 16602 y := b.Controls[1] 16603 c := auxToS390xCCMask(b.Aux) 16604 if !(x == y && c&s390x.Equal != 0) { 16605 break 16606 } 16607 b.Reset(BlockFirst) 16608 return true 16609 } 16610 // match: (CRJ {c} x y yes no) 16611 // cond: x == y && c&s390x.Equal == 0 16612 // result: (First no yes) 16613 for { 16614 x := b.Controls[0] 16615 y := b.Controls[1] 16616 c := auxToS390xCCMask(b.Aux) 16617 if !(x == y && c&s390x.Equal == 0) { 16618 break 16619 } 16620 b.Reset(BlockFirst) 16621 b.swapSuccessors() 16622 return true 16623 } 16624 case BlockIf: 16625 // match: (If cond yes no) 16626 // result: (CLIJ {s390x.LessOrGreater} (MOVBZreg <typ.Bool> cond) [0] yes no) 16627 for { 16628 cond := b.Controls[0] 16629 v0 := b.NewValue0(cond.Pos, OpS390XMOVBZreg, typ.Bool) 16630 v0.AddArg(cond) 16631 b.resetWithControl(BlockS390XCLIJ, v0) 16632 b.AuxInt = uint8ToAuxInt(0) 16633 b.Aux = s390xCCMaskToAux(s390x.LessOrGreater) 16634 return true 16635 } 16636 } 16637 return false 16638 }