github.com/bir3/gocompiler@v0.3.205/src/cmd/compile/internal/ssa/rewriteS390X.go (about) 1 // Code generated from _gen/S390X.rules; DO NOT EDIT. 2 // generated with: cd _gen; go run . 3 4 package ssa 5 6 import "math" 7 import "github.com/bir3/gocompiler/src/cmd/compile/internal/types" 8 import "github.com/bir3/gocompiler/src/cmd/internal/obj/s390x" 9 10 func rewriteValueS390X(v *Value) bool { 11 switch v.Op { 12 case OpAdd16: 13 v.Op = OpS390XADDW 14 return true 15 case OpAdd32: 16 v.Op = OpS390XADDW 17 return true 18 case OpAdd32F: 19 return rewriteValueS390X_OpAdd32F(v) 20 case OpAdd64: 21 v.Op = OpS390XADD 22 return true 23 case OpAdd64F: 24 return rewriteValueS390X_OpAdd64F(v) 25 case OpAdd8: 26 v.Op = OpS390XADDW 27 return true 28 case OpAddPtr: 29 v.Op = OpS390XADD 30 return true 31 case OpAddr: 32 return rewriteValueS390X_OpAddr(v) 33 case OpAnd16: 34 v.Op = OpS390XANDW 35 return true 36 case OpAnd32: 37 v.Op = OpS390XANDW 38 return true 39 case OpAnd64: 40 v.Op = OpS390XAND 41 return true 42 case OpAnd8: 43 v.Op = OpS390XANDW 44 return true 45 case OpAndB: 46 v.Op = OpS390XANDW 47 return true 48 case OpAtomicAdd32: 49 return rewriteValueS390X_OpAtomicAdd32(v) 50 case OpAtomicAdd64: 51 return rewriteValueS390X_OpAtomicAdd64(v) 52 case OpAtomicAnd32: 53 v.Op = OpS390XLAN 54 return true 55 case OpAtomicAnd8: 56 return rewriteValueS390X_OpAtomicAnd8(v) 57 case OpAtomicCompareAndSwap32: 58 return rewriteValueS390X_OpAtomicCompareAndSwap32(v) 59 case OpAtomicCompareAndSwap64: 60 return rewriteValueS390X_OpAtomicCompareAndSwap64(v) 61 case OpAtomicExchange32: 62 return rewriteValueS390X_OpAtomicExchange32(v) 63 case OpAtomicExchange64: 64 return rewriteValueS390X_OpAtomicExchange64(v) 65 case OpAtomicLoad32: 66 return rewriteValueS390X_OpAtomicLoad32(v) 67 case OpAtomicLoad64: 68 return rewriteValueS390X_OpAtomicLoad64(v) 69 case OpAtomicLoad8: 70 return rewriteValueS390X_OpAtomicLoad8(v) 71 case OpAtomicLoadAcq32: 72 return rewriteValueS390X_OpAtomicLoadAcq32(v) 73 case OpAtomicLoadPtr: 74 return rewriteValueS390X_OpAtomicLoadPtr(v) 75 case OpAtomicOr32: 76 v.Op = OpS390XLAO 77 return true 78 case OpAtomicOr8: 79 return rewriteValueS390X_OpAtomicOr8(v) 80 case OpAtomicStore32: 81 return rewriteValueS390X_OpAtomicStore32(v) 82 case OpAtomicStore64: 83 return rewriteValueS390X_OpAtomicStore64(v) 84 case OpAtomicStore8: 85 return rewriteValueS390X_OpAtomicStore8(v) 86 case OpAtomicStorePtrNoWB: 87 return rewriteValueS390X_OpAtomicStorePtrNoWB(v) 88 case OpAtomicStoreRel32: 89 return rewriteValueS390X_OpAtomicStoreRel32(v) 90 case OpAvg64u: 91 return rewriteValueS390X_OpAvg64u(v) 92 case OpBitLen64: 93 return rewriteValueS390X_OpBitLen64(v) 94 case OpBswap32: 95 v.Op = OpS390XMOVWBR 96 return true 97 case OpBswap64: 98 v.Op = OpS390XMOVDBR 99 return true 100 case OpCeil: 101 return rewriteValueS390X_OpCeil(v) 102 case OpClosureCall: 103 v.Op = OpS390XCALLclosure 104 return true 105 case OpCom16: 106 v.Op = OpS390XNOTW 107 return true 108 case OpCom32: 109 v.Op = OpS390XNOTW 110 return true 111 case OpCom64: 112 v.Op = OpS390XNOT 113 return true 114 case OpCom8: 115 v.Op = OpS390XNOTW 116 return true 117 case OpConst16: 118 return rewriteValueS390X_OpConst16(v) 119 case OpConst32: 120 return rewriteValueS390X_OpConst32(v) 121 case OpConst32F: 122 v.Op = OpS390XFMOVSconst 123 return true 124 case OpConst64: 125 return rewriteValueS390X_OpConst64(v) 126 case OpConst64F: 127 v.Op = OpS390XFMOVDconst 128 return true 129 case OpConst8: 130 return rewriteValueS390X_OpConst8(v) 131 case OpConstBool: 132 return rewriteValueS390X_OpConstBool(v) 133 case OpConstNil: 134 return rewriteValueS390X_OpConstNil(v) 135 case OpCtz32: 136 return rewriteValueS390X_OpCtz32(v) 137 case OpCtz32NonZero: 138 v.Op = OpCtz32 139 return true 140 case OpCtz64: 141 return rewriteValueS390X_OpCtz64(v) 142 case OpCtz64NonZero: 143 v.Op = OpCtz64 144 return true 145 case OpCvt32Fto32: 146 v.Op = OpS390XCFEBRA 147 return true 148 case OpCvt32Fto32U: 149 v.Op = OpS390XCLFEBR 150 return true 151 case OpCvt32Fto64: 152 v.Op = OpS390XCGEBRA 153 return true 154 case OpCvt32Fto64F: 155 v.Op = OpS390XLDEBR 156 return true 157 case OpCvt32Fto64U: 158 v.Op = OpS390XCLGEBR 159 return true 160 case OpCvt32Uto32F: 161 v.Op = OpS390XCELFBR 162 return true 163 case OpCvt32Uto64F: 164 v.Op = OpS390XCDLFBR 165 return true 166 case OpCvt32to32F: 167 v.Op = OpS390XCEFBRA 168 return true 169 case OpCvt32to64F: 170 v.Op = OpS390XCDFBRA 171 return true 172 case OpCvt64Fto32: 173 v.Op = OpS390XCFDBRA 174 return true 175 case OpCvt64Fto32F: 176 v.Op = OpS390XLEDBR 177 return true 178 case OpCvt64Fto32U: 179 v.Op = OpS390XCLFDBR 180 return true 181 case OpCvt64Fto64: 182 v.Op = OpS390XCGDBRA 183 return true 184 case OpCvt64Fto64U: 185 v.Op = OpS390XCLGDBR 186 return true 187 case OpCvt64Uto32F: 188 v.Op = OpS390XCELGBR 189 return true 190 case OpCvt64Uto64F: 191 v.Op = OpS390XCDLGBR 192 return true 193 case OpCvt64to32F: 194 v.Op = OpS390XCEGBRA 195 return true 196 case OpCvt64to64F: 197 v.Op = OpS390XCDGBRA 198 return true 199 case OpCvtBoolToUint8: 200 v.Op = OpCopy 201 return true 202 case OpDiv16: 203 return rewriteValueS390X_OpDiv16(v) 204 case OpDiv16u: 205 return rewriteValueS390X_OpDiv16u(v) 206 case OpDiv32: 207 return rewriteValueS390X_OpDiv32(v) 208 case OpDiv32F: 209 v.Op = OpS390XFDIVS 210 return true 211 case OpDiv32u: 212 return rewriteValueS390X_OpDiv32u(v) 213 case OpDiv64: 214 return rewriteValueS390X_OpDiv64(v) 215 case OpDiv64F: 216 v.Op = OpS390XFDIV 217 return true 218 case OpDiv64u: 219 v.Op = OpS390XDIVDU 220 return true 221 case OpDiv8: 222 return rewriteValueS390X_OpDiv8(v) 223 case OpDiv8u: 224 return rewriteValueS390X_OpDiv8u(v) 225 case OpEq16: 226 return rewriteValueS390X_OpEq16(v) 227 case OpEq32: 228 return rewriteValueS390X_OpEq32(v) 229 case OpEq32F: 230 return rewriteValueS390X_OpEq32F(v) 231 case OpEq64: 232 return rewriteValueS390X_OpEq64(v) 233 case OpEq64F: 234 return rewriteValueS390X_OpEq64F(v) 235 case OpEq8: 236 return rewriteValueS390X_OpEq8(v) 237 case OpEqB: 238 return rewriteValueS390X_OpEqB(v) 239 case OpEqPtr: 240 return rewriteValueS390X_OpEqPtr(v) 241 case OpFMA: 242 return rewriteValueS390X_OpFMA(v) 243 case OpFloor: 244 return rewriteValueS390X_OpFloor(v) 245 case OpGetCallerPC: 246 v.Op = OpS390XLoweredGetCallerPC 247 return true 248 case OpGetCallerSP: 249 v.Op = OpS390XLoweredGetCallerSP 250 return true 251 case OpGetClosurePtr: 252 v.Op = OpS390XLoweredGetClosurePtr 253 return true 254 case OpGetG: 255 v.Op = OpS390XLoweredGetG 256 return true 257 case OpHmul32: 258 return rewriteValueS390X_OpHmul32(v) 259 case OpHmul32u: 260 return rewriteValueS390X_OpHmul32u(v) 261 case OpHmul64: 262 v.Op = OpS390XMULHD 263 return true 264 case OpHmul64u: 265 v.Op = OpS390XMULHDU 266 return true 267 case OpITab: 268 return rewriteValueS390X_OpITab(v) 269 case OpInterCall: 270 v.Op = OpS390XCALLinter 271 return true 272 case OpIsInBounds: 273 return rewriteValueS390X_OpIsInBounds(v) 274 case OpIsNonNil: 275 return rewriteValueS390X_OpIsNonNil(v) 276 case OpIsSliceInBounds: 277 return rewriteValueS390X_OpIsSliceInBounds(v) 278 case OpLeq16: 279 return rewriteValueS390X_OpLeq16(v) 280 case OpLeq16U: 281 return rewriteValueS390X_OpLeq16U(v) 282 case OpLeq32: 283 return rewriteValueS390X_OpLeq32(v) 284 case OpLeq32F: 285 return rewriteValueS390X_OpLeq32F(v) 286 case OpLeq32U: 287 return rewriteValueS390X_OpLeq32U(v) 288 case OpLeq64: 289 return rewriteValueS390X_OpLeq64(v) 290 case OpLeq64F: 291 return rewriteValueS390X_OpLeq64F(v) 292 case OpLeq64U: 293 return rewriteValueS390X_OpLeq64U(v) 294 case OpLeq8: 295 return rewriteValueS390X_OpLeq8(v) 296 case OpLeq8U: 297 return rewriteValueS390X_OpLeq8U(v) 298 case OpLess16: 299 return rewriteValueS390X_OpLess16(v) 300 case OpLess16U: 301 return rewriteValueS390X_OpLess16U(v) 302 case OpLess32: 303 return rewriteValueS390X_OpLess32(v) 304 case OpLess32F: 305 return rewriteValueS390X_OpLess32F(v) 306 case OpLess32U: 307 return rewriteValueS390X_OpLess32U(v) 308 case OpLess64: 309 return rewriteValueS390X_OpLess64(v) 310 case OpLess64F: 311 return rewriteValueS390X_OpLess64F(v) 312 case OpLess64U: 313 return rewriteValueS390X_OpLess64U(v) 314 case OpLess8: 315 return rewriteValueS390X_OpLess8(v) 316 case OpLess8U: 317 return rewriteValueS390X_OpLess8U(v) 318 case OpLoad: 319 return rewriteValueS390X_OpLoad(v) 320 case OpLocalAddr: 321 return rewriteValueS390X_OpLocalAddr(v) 322 case OpLsh16x16: 323 return rewriteValueS390X_OpLsh16x16(v) 324 case OpLsh16x32: 325 return rewriteValueS390X_OpLsh16x32(v) 326 case OpLsh16x64: 327 return rewriteValueS390X_OpLsh16x64(v) 328 case OpLsh16x8: 329 return rewriteValueS390X_OpLsh16x8(v) 330 case OpLsh32x16: 331 return rewriteValueS390X_OpLsh32x16(v) 332 case OpLsh32x32: 333 return rewriteValueS390X_OpLsh32x32(v) 334 case OpLsh32x64: 335 return rewriteValueS390X_OpLsh32x64(v) 336 case OpLsh32x8: 337 return rewriteValueS390X_OpLsh32x8(v) 338 case OpLsh64x16: 339 return rewriteValueS390X_OpLsh64x16(v) 340 case OpLsh64x32: 341 return rewriteValueS390X_OpLsh64x32(v) 342 case OpLsh64x64: 343 return rewriteValueS390X_OpLsh64x64(v) 344 case OpLsh64x8: 345 return rewriteValueS390X_OpLsh64x8(v) 346 case OpLsh8x16: 347 return rewriteValueS390X_OpLsh8x16(v) 348 case OpLsh8x32: 349 return rewriteValueS390X_OpLsh8x32(v) 350 case OpLsh8x64: 351 return rewriteValueS390X_OpLsh8x64(v) 352 case OpLsh8x8: 353 return rewriteValueS390X_OpLsh8x8(v) 354 case OpMod16: 355 return rewriteValueS390X_OpMod16(v) 356 case OpMod16u: 357 return rewriteValueS390X_OpMod16u(v) 358 case OpMod32: 359 return rewriteValueS390X_OpMod32(v) 360 case OpMod32u: 361 return rewriteValueS390X_OpMod32u(v) 362 case OpMod64: 363 return rewriteValueS390X_OpMod64(v) 364 case OpMod64u: 365 v.Op = OpS390XMODDU 366 return true 367 case OpMod8: 368 return rewriteValueS390X_OpMod8(v) 369 case OpMod8u: 370 return rewriteValueS390X_OpMod8u(v) 371 case OpMove: 372 return rewriteValueS390X_OpMove(v) 373 case OpMul16: 374 v.Op = OpS390XMULLW 375 return true 376 case OpMul32: 377 v.Op = OpS390XMULLW 378 return true 379 case OpMul32F: 380 v.Op = OpS390XFMULS 381 return true 382 case OpMul64: 383 v.Op = OpS390XMULLD 384 return true 385 case OpMul64F: 386 v.Op = OpS390XFMUL 387 return true 388 case OpMul64uhilo: 389 v.Op = OpS390XMLGR 390 return true 391 case OpMul8: 392 v.Op = OpS390XMULLW 393 return true 394 case OpNeg16: 395 v.Op = OpS390XNEGW 396 return true 397 case OpNeg32: 398 v.Op = OpS390XNEGW 399 return true 400 case OpNeg32F: 401 v.Op = OpS390XFNEGS 402 return true 403 case OpNeg64: 404 v.Op = OpS390XNEG 405 return true 406 case OpNeg64F: 407 v.Op = OpS390XFNEG 408 return true 409 case OpNeg8: 410 v.Op = OpS390XNEGW 411 return true 412 case OpNeq16: 413 return rewriteValueS390X_OpNeq16(v) 414 case OpNeq32: 415 return rewriteValueS390X_OpNeq32(v) 416 case OpNeq32F: 417 return rewriteValueS390X_OpNeq32F(v) 418 case OpNeq64: 419 return rewriteValueS390X_OpNeq64(v) 420 case OpNeq64F: 421 return rewriteValueS390X_OpNeq64F(v) 422 case OpNeq8: 423 return rewriteValueS390X_OpNeq8(v) 424 case OpNeqB: 425 return rewriteValueS390X_OpNeqB(v) 426 case OpNeqPtr: 427 return rewriteValueS390X_OpNeqPtr(v) 428 case OpNilCheck: 429 v.Op = OpS390XLoweredNilCheck 430 return true 431 case OpNot: 432 return rewriteValueS390X_OpNot(v) 433 case OpOffPtr: 434 return rewriteValueS390X_OpOffPtr(v) 435 case OpOr16: 436 v.Op = OpS390XORW 437 return true 438 case OpOr32: 439 v.Op = OpS390XORW 440 return true 441 case OpOr64: 442 v.Op = OpS390XOR 443 return true 444 case OpOr8: 445 v.Op = OpS390XORW 446 return true 447 case OpOrB: 448 v.Op = OpS390XORW 449 return true 450 case OpPanicBounds: 451 return rewriteValueS390X_OpPanicBounds(v) 452 case OpPopCount16: 453 return rewriteValueS390X_OpPopCount16(v) 454 case OpPopCount32: 455 return rewriteValueS390X_OpPopCount32(v) 456 case OpPopCount64: 457 return rewriteValueS390X_OpPopCount64(v) 458 case OpPopCount8: 459 return rewriteValueS390X_OpPopCount8(v) 460 case OpRotateLeft16: 461 return rewriteValueS390X_OpRotateLeft16(v) 462 case OpRotateLeft32: 463 v.Op = OpS390XRLL 464 return true 465 case OpRotateLeft64: 466 v.Op = OpS390XRLLG 467 return true 468 case OpRotateLeft8: 469 return rewriteValueS390X_OpRotateLeft8(v) 470 case OpRound: 471 return rewriteValueS390X_OpRound(v) 472 case OpRound32F: 473 v.Op = OpS390XLoweredRound32F 474 return true 475 case OpRound64F: 476 v.Op = OpS390XLoweredRound64F 477 return true 478 case OpRoundToEven: 479 return rewriteValueS390X_OpRoundToEven(v) 480 case OpRsh16Ux16: 481 return rewriteValueS390X_OpRsh16Ux16(v) 482 case OpRsh16Ux32: 483 return rewriteValueS390X_OpRsh16Ux32(v) 484 case OpRsh16Ux64: 485 return rewriteValueS390X_OpRsh16Ux64(v) 486 case OpRsh16Ux8: 487 return rewriteValueS390X_OpRsh16Ux8(v) 488 case OpRsh16x16: 489 return rewriteValueS390X_OpRsh16x16(v) 490 case OpRsh16x32: 491 return rewriteValueS390X_OpRsh16x32(v) 492 case OpRsh16x64: 493 return rewriteValueS390X_OpRsh16x64(v) 494 case OpRsh16x8: 495 return rewriteValueS390X_OpRsh16x8(v) 496 case OpRsh32Ux16: 497 return rewriteValueS390X_OpRsh32Ux16(v) 498 case OpRsh32Ux32: 499 return rewriteValueS390X_OpRsh32Ux32(v) 500 case OpRsh32Ux64: 501 return rewriteValueS390X_OpRsh32Ux64(v) 502 case OpRsh32Ux8: 503 return rewriteValueS390X_OpRsh32Ux8(v) 504 case OpRsh32x16: 505 return rewriteValueS390X_OpRsh32x16(v) 506 case OpRsh32x32: 507 return rewriteValueS390X_OpRsh32x32(v) 508 case OpRsh32x64: 509 return rewriteValueS390X_OpRsh32x64(v) 510 case OpRsh32x8: 511 return rewriteValueS390X_OpRsh32x8(v) 512 case OpRsh64Ux16: 513 return rewriteValueS390X_OpRsh64Ux16(v) 514 case OpRsh64Ux32: 515 return rewriteValueS390X_OpRsh64Ux32(v) 516 case OpRsh64Ux64: 517 return rewriteValueS390X_OpRsh64Ux64(v) 518 case OpRsh64Ux8: 519 return rewriteValueS390X_OpRsh64Ux8(v) 520 case OpRsh64x16: 521 return rewriteValueS390X_OpRsh64x16(v) 522 case OpRsh64x32: 523 return rewriteValueS390X_OpRsh64x32(v) 524 case OpRsh64x64: 525 return rewriteValueS390X_OpRsh64x64(v) 526 case OpRsh64x8: 527 return rewriteValueS390X_OpRsh64x8(v) 528 case OpRsh8Ux16: 529 return rewriteValueS390X_OpRsh8Ux16(v) 530 case OpRsh8Ux32: 531 return rewriteValueS390X_OpRsh8Ux32(v) 532 case OpRsh8Ux64: 533 return rewriteValueS390X_OpRsh8Ux64(v) 534 case OpRsh8Ux8: 535 return rewriteValueS390X_OpRsh8Ux8(v) 536 case OpRsh8x16: 537 return rewriteValueS390X_OpRsh8x16(v) 538 case OpRsh8x32: 539 return rewriteValueS390X_OpRsh8x32(v) 540 case OpRsh8x64: 541 return rewriteValueS390X_OpRsh8x64(v) 542 case OpRsh8x8: 543 return rewriteValueS390X_OpRsh8x8(v) 544 case OpS390XADD: 545 return rewriteValueS390X_OpS390XADD(v) 546 case OpS390XADDC: 547 return rewriteValueS390X_OpS390XADDC(v) 548 case OpS390XADDE: 549 return rewriteValueS390X_OpS390XADDE(v) 550 case OpS390XADDW: 551 return rewriteValueS390X_OpS390XADDW(v) 552 case OpS390XADDWconst: 553 return rewriteValueS390X_OpS390XADDWconst(v) 554 case OpS390XADDWload: 555 return rewriteValueS390X_OpS390XADDWload(v) 556 case OpS390XADDconst: 557 return rewriteValueS390X_OpS390XADDconst(v) 558 case OpS390XADDload: 559 return rewriteValueS390X_OpS390XADDload(v) 560 case OpS390XAND: 561 return rewriteValueS390X_OpS390XAND(v) 562 case OpS390XANDW: 563 return rewriteValueS390X_OpS390XANDW(v) 564 case OpS390XANDWconst: 565 return rewriteValueS390X_OpS390XANDWconst(v) 566 case OpS390XANDWload: 567 return rewriteValueS390X_OpS390XANDWload(v) 568 case OpS390XANDconst: 569 return rewriteValueS390X_OpS390XANDconst(v) 570 case OpS390XANDload: 571 return rewriteValueS390X_OpS390XANDload(v) 572 case OpS390XCMP: 573 return rewriteValueS390X_OpS390XCMP(v) 574 case OpS390XCMPU: 575 return rewriteValueS390X_OpS390XCMPU(v) 576 case OpS390XCMPUconst: 577 return rewriteValueS390X_OpS390XCMPUconst(v) 578 case OpS390XCMPW: 579 return rewriteValueS390X_OpS390XCMPW(v) 580 case OpS390XCMPWU: 581 return rewriteValueS390X_OpS390XCMPWU(v) 582 case OpS390XCMPWUconst: 583 return rewriteValueS390X_OpS390XCMPWUconst(v) 584 case OpS390XCMPWconst: 585 return rewriteValueS390X_OpS390XCMPWconst(v) 586 case OpS390XCMPconst: 587 return rewriteValueS390X_OpS390XCMPconst(v) 588 case OpS390XCPSDR: 589 return rewriteValueS390X_OpS390XCPSDR(v) 590 case OpS390XFCMP: 591 return rewriteValueS390X_OpS390XFCMP(v) 592 case OpS390XFCMPS: 593 return rewriteValueS390X_OpS390XFCMPS(v) 594 case OpS390XFMOVDload: 595 return rewriteValueS390X_OpS390XFMOVDload(v) 596 case OpS390XFMOVDstore: 597 return rewriteValueS390X_OpS390XFMOVDstore(v) 598 case OpS390XFMOVSload: 599 return rewriteValueS390X_OpS390XFMOVSload(v) 600 case OpS390XFMOVSstore: 601 return rewriteValueS390X_OpS390XFMOVSstore(v) 602 case OpS390XFNEG: 603 return rewriteValueS390X_OpS390XFNEG(v) 604 case OpS390XFNEGS: 605 return rewriteValueS390X_OpS390XFNEGS(v) 606 case OpS390XLDGR: 607 return rewriteValueS390X_OpS390XLDGR(v) 608 case OpS390XLEDBR: 609 return rewriteValueS390X_OpS390XLEDBR(v) 610 case OpS390XLGDR: 611 return rewriteValueS390X_OpS390XLGDR(v) 612 case OpS390XLOCGR: 613 return rewriteValueS390X_OpS390XLOCGR(v) 614 case OpS390XLTDBR: 615 return rewriteValueS390X_OpS390XLTDBR(v) 616 case OpS390XLTEBR: 617 return rewriteValueS390X_OpS390XLTEBR(v) 618 case OpS390XLoweredRound32F: 619 return rewriteValueS390X_OpS390XLoweredRound32F(v) 620 case OpS390XLoweredRound64F: 621 return rewriteValueS390X_OpS390XLoweredRound64F(v) 622 case OpS390XMOVBZload: 623 return rewriteValueS390X_OpS390XMOVBZload(v) 624 case OpS390XMOVBZreg: 625 return rewriteValueS390X_OpS390XMOVBZreg(v) 626 case OpS390XMOVBload: 627 return rewriteValueS390X_OpS390XMOVBload(v) 628 case OpS390XMOVBreg: 629 return rewriteValueS390X_OpS390XMOVBreg(v) 630 case OpS390XMOVBstore: 631 return rewriteValueS390X_OpS390XMOVBstore(v) 632 case OpS390XMOVBstoreconst: 633 return rewriteValueS390X_OpS390XMOVBstoreconst(v) 634 case OpS390XMOVDaddridx: 635 return rewriteValueS390X_OpS390XMOVDaddridx(v) 636 case OpS390XMOVDload: 637 return rewriteValueS390X_OpS390XMOVDload(v) 638 case OpS390XMOVDstore: 639 return rewriteValueS390X_OpS390XMOVDstore(v) 640 case OpS390XMOVDstoreconst: 641 return rewriteValueS390X_OpS390XMOVDstoreconst(v) 642 case OpS390XMOVHBRstore: 643 return rewriteValueS390X_OpS390XMOVHBRstore(v) 644 case OpS390XMOVHZload: 645 return rewriteValueS390X_OpS390XMOVHZload(v) 646 case OpS390XMOVHZreg: 647 return rewriteValueS390X_OpS390XMOVHZreg(v) 648 case OpS390XMOVHload: 649 return rewriteValueS390X_OpS390XMOVHload(v) 650 case OpS390XMOVHreg: 651 return rewriteValueS390X_OpS390XMOVHreg(v) 652 case OpS390XMOVHstore: 653 return rewriteValueS390X_OpS390XMOVHstore(v) 654 case OpS390XMOVHstoreconst: 655 return rewriteValueS390X_OpS390XMOVHstoreconst(v) 656 case OpS390XMOVWBRstore: 657 return rewriteValueS390X_OpS390XMOVWBRstore(v) 658 case OpS390XMOVWZload: 659 return rewriteValueS390X_OpS390XMOVWZload(v) 660 case OpS390XMOVWZreg: 661 return rewriteValueS390X_OpS390XMOVWZreg(v) 662 case OpS390XMOVWload: 663 return rewriteValueS390X_OpS390XMOVWload(v) 664 case OpS390XMOVWreg: 665 return rewriteValueS390X_OpS390XMOVWreg(v) 666 case OpS390XMOVWstore: 667 return rewriteValueS390X_OpS390XMOVWstore(v) 668 case OpS390XMOVWstoreconst: 669 return rewriteValueS390X_OpS390XMOVWstoreconst(v) 670 case OpS390XMULLD: 671 return rewriteValueS390X_OpS390XMULLD(v) 672 case OpS390XMULLDconst: 673 return rewriteValueS390X_OpS390XMULLDconst(v) 674 case OpS390XMULLDload: 675 return rewriteValueS390X_OpS390XMULLDload(v) 676 case OpS390XMULLW: 677 return rewriteValueS390X_OpS390XMULLW(v) 678 case OpS390XMULLWconst: 679 return rewriteValueS390X_OpS390XMULLWconst(v) 680 case OpS390XMULLWload: 681 return rewriteValueS390X_OpS390XMULLWload(v) 682 case OpS390XNEG: 683 return rewriteValueS390X_OpS390XNEG(v) 684 case OpS390XNEGW: 685 return rewriteValueS390X_OpS390XNEGW(v) 686 case OpS390XNOT: 687 return rewriteValueS390X_OpS390XNOT(v) 688 case OpS390XNOTW: 689 return rewriteValueS390X_OpS390XNOTW(v) 690 case OpS390XOR: 691 return rewriteValueS390X_OpS390XOR(v) 692 case OpS390XORW: 693 return rewriteValueS390X_OpS390XORW(v) 694 case OpS390XORWconst: 695 return rewriteValueS390X_OpS390XORWconst(v) 696 case OpS390XORWload: 697 return rewriteValueS390X_OpS390XORWload(v) 698 case OpS390XORconst: 699 return rewriteValueS390X_OpS390XORconst(v) 700 case OpS390XORload: 701 return rewriteValueS390X_OpS390XORload(v) 702 case OpS390XRISBGZ: 703 return rewriteValueS390X_OpS390XRISBGZ(v) 704 case OpS390XRLL: 705 return rewriteValueS390X_OpS390XRLL(v) 706 case OpS390XRLLG: 707 return rewriteValueS390X_OpS390XRLLG(v) 708 case OpS390XSLD: 709 return rewriteValueS390X_OpS390XSLD(v) 710 case OpS390XSLDconst: 711 return rewriteValueS390X_OpS390XSLDconst(v) 712 case OpS390XSLW: 713 return rewriteValueS390X_OpS390XSLW(v) 714 case OpS390XSLWconst: 715 return rewriteValueS390X_OpS390XSLWconst(v) 716 case OpS390XSRAD: 717 return rewriteValueS390X_OpS390XSRAD(v) 718 case OpS390XSRADconst: 719 return rewriteValueS390X_OpS390XSRADconst(v) 720 case OpS390XSRAW: 721 return rewriteValueS390X_OpS390XSRAW(v) 722 case OpS390XSRAWconst: 723 return rewriteValueS390X_OpS390XSRAWconst(v) 724 case OpS390XSRD: 725 return rewriteValueS390X_OpS390XSRD(v) 726 case OpS390XSRDconst: 727 return rewriteValueS390X_OpS390XSRDconst(v) 728 case OpS390XSRW: 729 return rewriteValueS390X_OpS390XSRW(v) 730 case OpS390XSRWconst: 731 return rewriteValueS390X_OpS390XSRWconst(v) 732 case OpS390XSTM2: 733 return rewriteValueS390X_OpS390XSTM2(v) 734 case OpS390XSTMG2: 735 return rewriteValueS390X_OpS390XSTMG2(v) 736 case OpS390XSUB: 737 return rewriteValueS390X_OpS390XSUB(v) 738 case OpS390XSUBE: 739 return rewriteValueS390X_OpS390XSUBE(v) 740 case OpS390XSUBW: 741 return rewriteValueS390X_OpS390XSUBW(v) 742 case OpS390XSUBWconst: 743 return rewriteValueS390X_OpS390XSUBWconst(v) 744 case OpS390XSUBWload: 745 return rewriteValueS390X_OpS390XSUBWload(v) 746 case OpS390XSUBconst: 747 return rewriteValueS390X_OpS390XSUBconst(v) 748 case OpS390XSUBload: 749 return rewriteValueS390X_OpS390XSUBload(v) 750 case OpS390XSumBytes2: 751 return rewriteValueS390X_OpS390XSumBytes2(v) 752 case OpS390XSumBytes4: 753 return rewriteValueS390X_OpS390XSumBytes4(v) 754 case OpS390XSumBytes8: 755 return rewriteValueS390X_OpS390XSumBytes8(v) 756 case OpS390XXOR: 757 return rewriteValueS390X_OpS390XXOR(v) 758 case OpS390XXORW: 759 return rewriteValueS390X_OpS390XXORW(v) 760 case OpS390XXORWconst: 761 return rewriteValueS390X_OpS390XXORWconst(v) 762 case OpS390XXORWload: 763 return rewriteValueS390X_OpS390XXORWload(v) 764 case OpS390XXORconst: 765 return rewriteValueS390X_OpS390XXORconst(v) 766 case OpS390XXORload: 767 return rewriteValueS390X_OpS390XXORload(v) 768 case OpSelect0: 769 return rewriteValueS390X_OpSelect0(v) 770 case OpSelect1: 771 return rewriteValueS390X_OpSelect1(v) 772 case OpSignExt16to32: 773 v.Op = OpS390XMOVHreg 774 return true 775 case OpSignExt16to64: 776 v.Op = OpS390XMOVHreg 777 return true 778 case OpSignExt32to64: 779 v.Op = OpS390XMOVWreg 780 return true 781 case OpSignExt8to16: 782 v.Op = OpS390XMOVBreg 783 return true 784 case OpSignExt8to32: 785 v.Op = OpS390XMOVBreg 786 return true 787 case OpSignExt8to64: 788 v.Op = OpS390XMOVBreg 789 return true 790 case OpSlicemask: 791 return rewriteValueS390X_OpSlicemask(v) 792 case OpSqrt: 793 v.Op = OpS390XFSQRT 794 return true 795 case OpSqrt32: 796 v.Op = OpS390XFSQRTS 797 return true 798 case OpStaticCall: 799 v.Op = OpS390XCALLstatic 800 return true 801 case OpStore: 802 return rewriteValueS390X_OpStore(v) 803 case OpSub16: 804 v.Op = OpS390XSUBW 805 return true 806 case OpSub32: 807 v.Op = OpS390XSUBW 808 return true 809 case OpSub32F: 810 return rewriteValueS390X_OpSub32F(v) 811 case OpSub64: 812 v.Op = OpS390XSUB 813 return true 814 case OpSub64F: 815 return rewriteValueS390X_OpSub64F(v) 816 case OpSub8: 817 v.Op = OpS390XSUBW 818 return true 819 case OpSubPtr: 820 v.Op = OpS390XSUB 821 return true 822 case OpTailCall: 823 v.Op = OpS390XCALLtail 824 return true 825 case OpTrunc: 826 return rewriteValueS390X_OpTrunc(v) 827 case OpTrunc16to8: 828 v.Op = OpCopy 829 return true 830 case OpTrunc32to16: 831 v.Op = OpCopy 832 return true 833 case OpTrunc32to8: 834 v.Op = OpCopy 835 return true 836 case OpTrunc64to16: 837 v.Op = OpCopy 838 return true 839 case OpTrunc64to32: 840 v.Op = OpCopy 841 return true 842 case OpTrunc64to8: 843 v.Op = OpCopy 844 return true 845 case OpWB: 846 v.Op = OpS390XLoweredWB 847 return true 848 case OpXor16: 849 v.Op = OpS390XXORW 850 return true 851 case OpXor32: 852 v.Op = OpS390XXORW 853 return true 854 case OpXor64: 855 v.Op = OpS390XXOR 856 return true 857 case OpXor8: 858 v.Op = OpS390XXORW 859 return true 860 case OpZero: 861 return rewriteValueS390X_OpZero(v) 862 case OpZeroExt16to32: 863 v.Op = OpS390XMOVHZreg 864 return true 865 case OpZeroExt16to64: 866 v.Op = OpS390XMOVHZreg 867 return true 868 case OpZeroExt32to64: 869 v.Op = OpS390XMOVWZreg 870 return true 871 case OpZeroExt8to16: 872 v.Op = OpS390XMOVBZreg 873 return true 874 case OpZeroExt8to32: 875 v.Op = OpS390XMOVBZreg 876 return true 877 case OpZeroExt8to64: 878 v.Op = OpS390XMOVBZreg 879 return true 880 } 881 return false 882 } 883 func rewriteValueS390X_OpAdd32F(v *Value) bool { 884 v_1 := v.Args[1] 885 v_0 := v.Args[0] 886 b := v.Block 887 typ := &b.Func.Config.Types 888 // match: (Add32F x y) 889 // result: (Select0 (FADDS x y)) 890 for { 891 x := v_0 892 y := v_1 893 v.reset(OpSelect0) 894 v0 := b.NewValue0(v.Pos, OpS390XFADDS, types.NewTuple(typ.Float32, types.TypeFlags)) 895 v0.AddArg2(x, y) 896 v.AddArg(v0) 897 return true 898 } 899 } 900 func rewriteValueS390X_OpAdd64F(v *Value) bool { 901 v_1 := v.Args[1] 902 v_0 := v.Args[0] 903 b := v.Block 904 typ := &b.Func.Config.Types 905 // match: (Add64F x y) 906 // result: (Select0 (FADD x y)) 907 for { 908 x := v_0 909 y := v_1 910 v.reset(OpSelect0) 911 v0 := b.NewValue0(v.Pos, OpS390XFADD, types.NewTuple(typ.Float64, types.TypeFlags)) 912 v0.AddArg2(x, y) 913 v.AddArg(v0) 914 return true 915 } 916 } 917 func rewriteValueS390X_OpAddr(v *Value) bool { 918 v_0 := v.Args[0] 919 // match: (Addr {sym} base) 920 // result: (MOVDaddr {sym} base) 921 for { 922 sym := auxToSym(v.Aux) 923 base := v_0 924 v.reset(OpS390XMOVDaddr) 925 v.Aux = symToAux(sym) 926 v.AddArg(base) 927 return true 928 } 929 } 930 func rewriteValueS390X_OpAtomicAdd32(v *Value) bool { 931 v_2 := v.Args[2] 932 v_1 := v.Args[1] 933 v_0 := v.Args[0] 934 b := v.Block 935 typ := &b.Func.Config.Types 936 // match: (AtomicAdd32 ptr val mem) 937 // result: (AddTupleFirst32 val (LAA ptr val mem)) 938 for { 939 ptr := v_0 940 val := v_1 941 mem := v_2 942 v.reset(OpS390XAddTupleFirst32) 943 v0 := b.NewValue0(v.Pos, OpS390XLAA, types.NewTuple(typ.UInt32, types.TypeMem)) 944 v0.AddArg3(ptr, val, mem) 945 v.AddArg2(val, v0) 946 return true 947 } 948 } 949 func rewriteValueS390X_OpAtomicAdd64(v *Value) bool { 950 v_2 := v.Args[2] 951 v_1 := v.Args[1] 952 v_0 := v.Args[0] 953 b := v.Block 954 typ := &b.Func.Config.Types 955 // match: (AtomicAdd64 ptr val mem) 956 // result: (AddTupleFirst64 val (LAAG ptr val mem)) 957 for { 958 ptr := v_0 959 val := v_1 960 mem := v_2 961 v.reset(OpS390XAddTupleFirst64) 962 v0 := b.NewValue0(v.Pos, OpS390XLAAG, types.NewTuple(typ.UInt64, types.TypeMem)) 963 v0.AddArg3(ptr, val, mem) 964 v.AddArg2(val, v0) 965 return true 966 } 967 } 968 func rewriteValueS390X_OpAtomicAnd8(v *Value) bool { 969 v_2 := v.Args[2] 970 v_1 := v.Args[1] 971 v_0 := v.Args[0] 972 b := v.Block 973 typ := &b.Func.Config.Types 974 // match: (AtomicAnd8 ptr val mem) 975 // 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) 976 for { 977 ptr := v_0 978 val := v_1 979 mem := v_2 980 v.reset(OpS390XLANfloor) 981 v0 := b.NewValue0(v.Pos, OpS390XRLL, typ.UInt32) 982 v1 := b.NewValue0(v.Pos, OpS390XORWconst, typ.UInt32) 983 v1.AuxInt = int32ToAuxInt(-1 << 8) 984 v1.AddArg(val) 985 v2 := b.NewValue0(v.Pos, OpS390XRXSBG, typ.UInt32) 986 v2.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(59, 60, 3)) 987 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 988 v3.AuxInt = int64ToAuxInt(3 << 3) 989 v2.AddArg2(v3, ptr) 990 v0.AddArg2(v1, v2) 991 v.AddArg3(ptr, v0, mem) 992 return true 993 } 994 } 995 func rewriteValueS390X_OpAtomicCompareAndSwap32(v *Value) bool { 996 v_3 := v.Args[3] 997 v_2 := v.Args[2] 998 v_1 := v.Args[1] 999 v_0 := v.Args[0] 1000 // match: (AtomicCompareAndSwap32 ptr old new_ mem) 1001 // result: (LoweredAtomicCas32 ptr old new_ mem) 1002 for { 1003 ptr := v_0 1004 old := v_1 1005 new_ := v_2 1006 mem := v_3 1007 v.reset(OpS390XLoweredAtomicCas32) 1008 v.AddArg4(ptr, old, new_, mem) 1009 return true 1010 } 1011 } 1012 func rewriteValueS390X_OpAtomicCompareAndSwap64(v *Value) bool { 1013 v_3 := v.Args[3] 1014 v_2 := v.Args[2] 1015 v_1 := v.Args[1] 1016 v_0 := v.Args[0] 1017 // match: (AtomicCompareAndSwap64 ptr old new_ mem) 1018 // result: (LoweredAtomicCas64 ptr old new_ mem) 1019 for { 1020 ptr := v_0 1021 old := v_1 1022 new_ := v_2 1023 mem := v_3 1024 v.reset(OpS390XLoweredAtomicCas64) 1025 v.AddArg4(ptr, old, new_, mem) 1026 return true 1027 } 1028 } 1029 func rewriteValueS390X_OpAtomicExchange32(v *Value) bool { 1030 v_2 := v.Args[2] 1031 v_1 := v.Args[1] 1032 v_0 := v.Args[0] 1033 // match: (AtomicExchange32 ptr val mem) 1034 // result: (LoweredAtomicExchange32 ptr val mem) 1035 for { 1036 ptr := v_0 1037 val := v_1 1038 mem := v_2 1039 v.reset(OpS390XLoweredAtomicExchange32) 1040 v.AddArg3(ptr, val, mem) 1041 return true 1042 } 1043 } 1044 func rewriteValueS390X_OpAtomicExchange64(v *Value) bool { 1045 v_2 := v.Args[2] 1046 v_1 := v.Args[1] 1047 v_0 := v.Args[0] 1048 // match: (AtomicExchange64 ptr val mem) 1049 // result: (LoweredAtomicExchange64 ptr val mem) 1050 for { 1051 ptr := v_0 1052 val := v_1 1053 mem := v_2 1054 v.reset(OpS390XLoweredAtomicExchange64) 1055 v.AddArg3(ptr, val, mem) 1056 return true 1057 } 1058 } 1059 func rewriteValueS390X_OpAtomicLoad32(v *Value) bool { 1060 v_1 := v.Args[1] 1061 v_0 := v.Args[0] 1062 // match: (AtomicLoad32 ptr mem) 1063 // result: (MOVWZatomicload ptr mem) 1064 for { 1065 ptr := v_0 1066 mem := v_1 1067 v.reset(OpS390XMOVWZatomicload) 1068 v.AddArg2(ptr, mem) 1069 return true 1070 } 1071 } 1072 func rewriteValueS390X_OpAtomicLoad64(v *Value) bool { 1073 v_1 := v.Args[1] 1074 v_0 := v.Args[0] 1075 // match: (AtomicLoad64 ptr mem) 1076 // result: (MOVDatomicload ptr mem) 1077 for { 1078 ptr := v_0 1079 mem := v_1 1080 v.reset(OpS390XMOVDatomicload) 1081 v.AddArg2(ptr, mem) 1082 return true 1083 } 1084 } 1085 func rewriteValueS390X_OpAtomicLoad8(v *Value) bool { 1086 v_1 := v.Args[1] 1087 v_0 := v.Args[0] 1088 // match: (AtomicLoad8 ptr mem) 1089 // result: (MOVBZatomicload ptr mem) 1090 for { 1091 ptr := v_0 1092 mem := v_1 1093 v.reset(OpS390XMOVBZatomicload) 1094 v.AddArg2(ptr, mem) 1095 return true 1096 } 1097 } 1098 func rewriteValueS390X_OpAtomicLoadAcq32(v *Value) bool { 1099 v_1 := v.Args[1] 1100 v_0 := v.Args[0] 1101 // match: (AtomicLoadAcq32 ptr mem) 1102 // result: (MOVWZatomicload ptr mem) 1103 for { 1104 ptr := v_0 1105 mem := v_1 1106 v.reset(OpS390XMOVWZatomicload) 1107 v.AddArg2(ptr, mem) 1108 return true 1109 } 1110 } 1111 func rewriteValueS390X_OpAtomicLoadPtr(v *Value) bool { 1112 v_1 := v.Args[1] 1113 v_0 := v.Args[0] 1114 // match: (AtomicLoadPtr ptr mem) 1115 // result: (MOVDatomicload ptr mem) 1116 for { 1117 ptr := v_0 1118 mem := v_1 1119 v.reset(OpS390XMOVDatomicload) 1120 v.AddArg2(ptr, mem) 1121 return true 1122 } 1123 } 1124 func rewriteValueS390X_OpAtomicOr8(v *Value) bool { 1125 v_2 := v.Args[2] 1126 v_1 := v.Args[1] 1127 v_0 := v.Args[0] 1128 b := v.Block 1129 typ := &b.Func.Config.Types 1130 // match: (AtomicOr8 ptr val mem) 1131 // result: (LAOfloor ptr (SLW <typ.UInt32> (MOVBZreg <typ.UInt32> val) (RXSBG <typ.UInt32> {s390x.NewRotateParams(59, 60, 3)} (MOVDconst [3<<3]) ptr)) mem) 1132 for { 1133 ptr := v_0 1134 val := v_1 1135 mem := v_2 1136 v.reset(OpS390XLAOfloor) 1137 v0 := b.NewValue0(v.Pos, OpS390XSLW, typ.UInt32) 1138 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt32) 1139 v1.AddArg(val) 1140 v2 := b.NewValue0(v.Pos, OpS390XRXSBG, typ.UInt32) 1141 v2.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(59, 60, 3)) 1142 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1143 v3.AuxInt = int64ToAuxInt(3 << 3) 1144 v2.AddArg2(v3, ptr) 1145 v0.AddArg2(v1, v2) 1146 v.AddArg3(ptr, v0, mem) 1147 return true 1148 } 1149 } 1150 func rewriteValueS390X_OpAtomicStore32(v *Value) bool { 1151 v_2 := v.Args[2] 1152 v_1 := v.Args[1] 1153 v_0 := v.Args[0] 1154 b := v.Block 1155 // match: (AtomicStore32 ptr val mem) 1156 // result: (SYNC (MOVWatomicstore ptr val mem)) 1157 for { 1158 ptr := v_0 1159 val := v_1 1160 mem := v_2 1161 v.reset(OpS390XSYNC) 1162 v0 := b.NewValue0(v.Pos, OpS390XMOVWatomicstore, types.TypeMem) 1163 v0.AddArg3(ptr, val, mem) 1164 v.AddArg(v0) 1165 return true 1166 } 1167 } 1168 func rewriteValueS390X_OpAtomicStore64(v *Value) bool { 1169 v_2 := v.Args[2] 1170 v_1 := v.Args[1] 1171 v_0 := v.Args[0] 1172 b := v.Block 1173 // match: (AtomicStore64 ptr val mem) 1174 // result: (SYNC (MOVDatomicstore ptr val mem)) 1175 for { 1176 ptr := v_0 1177 val := v_1 1178 mem := v_2 1179 v.reset(OpS390XSYNC) 1180 v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem) 1181 v0.AddArg3(ptr, val, mem) 1182 v.AddArg(v0) 1183 return true 1184 } 1185 } 1186 func rewriteValueS390X_OpAtomicStore8(v *Value) bool { 1187 v_2 := v.Args[2] 1188 v_1 := v.Args[1] 1189 v_0 := v.Args[0] 1190 b := v.Block 1191 // match: (AtomicStore8 ptr val mem) 1192 // result: (SYNC (MOVBatomicstore ptr val mem)) 1193 for { 1194 ptr := v_0 1195 val := v_1 1196 mem := v_2 1197 v.reset(OpS390XSYNC) 1198 v0 := b.NewValue0(v.Pos, OpS390XMOVBatomicstore, types.TypeMem) 1199 v0.AddArg3(ptr, val, mem) 1200 v.AddArg(v0) 1201 return true 1202 } 1203 } 1204 func rewriteValueS390X_OpAtomicStorePtrNoWB(v *Value) bool { 1205 v_2 := v.Args[2] 1206 v_1 := v.Args[1] 1207 v_0 := v.Args[0] 1208 b := v.Block 1209 // match: (AtomicStorePtrNoWB ptr val mem) 1210 // result: (SYNC (MOVDatomicstore ptr val mem)) 1211 for { 1212 ptr := v_0 1213 val := v_1 1214 mem := v_2 1215 v.reset(OpS390XSYNC) 1216 v0 := b.NewValue0(v.Pos, OpS390XMOVDatomicstore, types.TypeMem) 1217 v0.AddArg3(ptr, val, mem) 1218 v.AddArg(v0) 1219 return true 1220 } 1221 } 1222 func rewriteValueS390X_OpAtomicStoreRel32(v *Value) bool { 1223 v_2 := v.Args[2] 1224 v_1 := v.Args[1] 1225 v_0 := v.Args[0] 1226 // match: (AtomicStoreRel32 ptr val mem) 1227 // result: (MOVWatomicstore ptr val mem) 1228 for { 1229 ptr := v_0 1230 val := v_1 1231 mem := v_2 1232 v.reset(OpS390XMOVWatomicstore) 1233 v.AddArg3(ptr, val, mem) 1234 return true 1235 } 1236 } 1237 func rewriteValueS390X_OpAvg64u(v *Value) bool { 1238 v_1 := v.Args[1] 1239 v_0 := v.Args[0] 1240 b := v.Block 1241 // match: (Avg64u <t> x y) 1242 // result: (ADD (SRDconst <t> (SUB <t> x y) [1]) y) 1243 for { 1244 t := v.Type 1245 x := v_0 1246 y := v_1 1247 v.reset(OpS390XADD) 1248 v0 := b.NewValue0(v.Pos, OpS390XSRDconst, t) 1249 v0.AuxInt = uint8ToAuxInt(1) 1250 v1 := b.NewValue0(v.Pos, OpS390XSUB, t) 1251 v1.AddArg2(x, y) 1252 v0.AddArg(v1) 1253 v.AddArg2(v0, y) 1254 return true 1255 } 1256 } 1257 func rewriteValueS390X_OpBitLen64(v *Value) bool { 1258 v_0 := v.Args[0] 1259 b := v.Block 1260 typ := &b.Func.Config.Types 1261 // match: (BitLen64 x) 1262 // result: (SUB (MOVDconst [64]) (FLOGR x)) 1263 for { 1264 x := v_0 1265 v.reset(OpS390XSUB) 1266 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1267 v0.AuxInt = int64ToAuxInt(64) 1268 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64) 1269 v1.AddArg(x) 1270 v.AddArg2(v0, v1) 1271 return true 1272 } 1273 } 1274 func rewriteValueS390X_OpCeil(v *Value) bool { 1275 v_0 := v.Args[0] 1276 // match: (Ceil x) 1277 // result: (FIDBR [6] x) 1278 for { 1279 x := v_0 1280 v.reset(OpS390XFIDBR) 1281 v.AuxInt = int8ToAuxInt(6) 1282 v.AddArg(x) 1283 return true 1284 } 1285 } 1286 func rewriteValueS390X_OpConst16(v *Value) bool { 1287 // match: (Const16 [val]) 1288 // result: (MOVDconst [int64(val)]) 1289 for { 1290 val := auxIntToInt16(v.AuxInt) 1291 v.reset(OpS390XMOVDconst) 1292 v.AuxInt = int64ToAuxInt(int64(val)) 1293 return true 1294 } 1295 } 1296 func rewriteValueS390X_OpConst32(v *Value) bool { 1297 // match: (Const32 [val]) 1298 // result: (MOVDconst [int64(val)]) 1299 for { 1300 val := auxIntToInt32(v.AuxInt) 1301 v.reset(OpS390XMOVDconst) 1302 v.AuxInt = int64ToAuxInt(int64(val)) 1303 return true 1304 } 1305 } 1306 func rewriteValueS390X_OpConst64(v *Value) bool { 1307 // match: (Const64 [val]) 1308 // result: (MOVDconst [int64(val)]) 1309 for { 1310 val := auxIntToInt64(v.AuxInt) 1311 v.reset(OpS390XMOVDconst) 1312 v.AuxInt = int64ToAuxInt(int64(val)) 1313 return true 1314 } 1315 } 1316 func rewriteValueS390X_OpConst8(v *Value) bool { 1317 // match: (Const8 [val]) 1318 // result: (MOVDconst [int64(val)]) 1319 for { 1320 val := auxIntToInt8(v.AuxInt) 1321 v.reset(OpS390XMOVDconst) 1322 v.AuxInt = int64ToAuxInt(int64(val)) 1323 return true 1324 } 1325 } 1326 func rewriteValueS390X_OpConstBool(v *Value) bool { 1327 // match: (ConstBool [t]) 1328 // result: (MOVDconst [b2i(t)]) 1329 for { 1330 t := auxIntToBool(v.AuxInt) 1331 v.reset(OpS390XMOVDconst) 1332 v.AuxInt = int64ToAuxInt(b2i(t)) 1333 return true 1334 } 1335 } 1336 func rewriteValueS390X_OpConstNil(v *Value) bool { 1337 // match: (ConstNil) 1338 // result: (MOVDconst [0]) 1339 for { 1340 v.reset(OpS390XMOVDconst) 1341 v.AuxInt = int64ToAuxInt(0) 1342 return true 1343 } 1344 } 1345 func rewriteValueS390X_OpCtz32(v *Value) bool { 1346 v_0 := v.Args[0] 1347 b := v.Block 1348 typ := &b.Func.Config.Types 1349 // match: (Ctz32 <t> x) 1350 // result: (SUB (MOVDconst [64]) (FLOGR (MOVWZreg (ANDW <t> (SUBWconst <t> [1] x) (NOTW <t> x))))) 1351 for { 1352 t := v.Type 1353 x := v_0 1354 v.reset(OpS390XSUB) 1355 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1356 v0.AuxInt = int64ToAuxInt(64) 1357 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64) 1358 v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 1359 v3 := b.NewValue0(v.Pos, OpS390XANDW, t) 1360 v4 := b.NewValue0(v.Pos, OpS390XSUBWconst, t) 1361 v4.AuxInt = int32ToAuxInt(1) 1362 v4.AddArg(x) 1363 v5 := b.NewValue0(v.Pos, OpS390XNOTW, t) 1364 v5.AddArg(x) 1365 v3.AddArg2(v4, v5) 1366 v2.AddArg(v3) 1367 v1.AddArg(v2) 1368 v.AddArg2(v0, v1) 1369 return true 1370 } 1371 } 1372 func rewriteValueS390X_OpCtz64(v *Value) bool { 1373 v_0 := v.Args[0] 1374 b := v.Block 1375 typ := &b.Func.Config.Types 1376 // match: (Ctz64 <t> x) 1377 // result: (SUB (MOVDconst [64]) (FLOGR (AND <t> (SUBconst <t> [1] x) (NOT <t> x)))) 1378 for { 1379 t := v.Type 1380 x := v_0 1381 v.reset(OpS390XSUB) 1382 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1383 v0.AuxInt = int64ToAuxInt(64) 1384 v1 := b.NewValue0(v.Pos, OpS390XFLOGR, typ.UInt64) 1385 v2 := b.NewValue0(v.Pos, OpS390XAND, t) 1386 v3 := b.NewValue0(v.Pos, OpS390XSUBconst, t) 1387 v3.AuxInt = int32ToAuxInt(1) 1388 v3.AddArg(x) 1389 v4 := b.NewValue0(v.Pos, OpS390XNOT, t) 1390 v4.AddArg(x) 1391 v2.AddArg2(v3, v4) 1392 v1.AddArg(v2) 1393 v.AddArg2(v0, v1) 1394 return true 1395 } 1396 } 1397 func rewriteValueS390X_OpDiv16(v *Value) bool { 1398 v_1 := v.Args[1] 1399 v_0 := v.Args[0] 1400 b := v.Block 1401 typ := &b.Func.Config.Types 1402 // match: (Div16 x y) 1403 // result: (DIVW (MOVHreg x) (MOVHreg y)) 1404 for { 1405 x := v_0 1406 y := v_1 1407 v.reset(OpS390XDIVW) 1408 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1409 v0.AddArg(x) 1410 v1 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1411 v1.AddArg(y) 1412 v.AddArg2(v0, v1) 1413 return true 1414 } 1415 } 1416 func rewriteValueS390X_OpDiv16u(v *Value) bool { 1417 v_1 := v.Args[1] 1418 v_0 := v.Args[0] 1419 b := v.Block 1420 typ := &b.Func.Config.Types 1421 // match: (Div16u x y) 1422 // result: (DIVWU (MOVHZreg x) (MOVHZreg y)) 1423 for { 1424 x := v_0 1425 y := v_1 1426 v.reset(OpS390XDIVWU) 1427 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 1428 v0.AddArg(x) 1429 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 1430 v1.AddArg(y) 1431 v.AddArg2(v0, v1) 1432 return true 1433 } 1434 } 1435 func rewriteValueS390X_OpDiv32(v *Value) bool { 1436 v_1 := v.Args[1] 1437 v_0 := v.Args[0] 1438 b := v.Block 1439 typ := &b.Func.Config.Types 1440 // match: (Div32 x y) 1441 // result: (DIVW (MOVWreg x) y) 1442 for { 1443 x := v_0 1444 y := v_1 1445 v.reset(OpS390XDIVW) 1446 v0 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64) 1447 v0.AddArg(x) 1448 v.AddArg2(v0, y) 1449 return true 1450 } 1451 } 1452 func rewriteValueS390X_OpDiv32u(v *Value) bool { 1453 v_1 := v.Args[1] 1454 v_0 := v.Args[0] 1455 b := v.Block 1456 typ := &b.Func.Config.Types 1457 // match: (Div32u x y) 1458 // result: (DIVWU (MOVWZreg x) y) 1459 for { 1460 x := v_0 1461 y := v_1 1462 v.reset(OpS390XDIVWU) 1463 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 1464 v0.AddArg(x) 1465 v.AddArg2(v0, y) 1466 return true 1467 } 1468 } 1469 func rewriteValueS390X_OpDiv64(v *Value) bool { 1470 v_1 := v.Args[1] 1471 v_0 := v.Args[0] 1472 // match: (Div64 x y) 1473 // result: (DIVD x y) 1474 for { 1475 x := v_0 1476 y := v_1 1477 v.reset(OpS390XDIVD) 1478 v.AddArg2(x, y) 1479 return true 1480 } 1481 } 1482 func rewriteValueS390X_OpDiv8(v *Value) bool { 1483 v_1 := v.Args[1] 1484 v_0 := v.Args[0] 1485 b := v.Block 1486 typ := &b.Func.Config.Types 1487 // match: (Div8 x y) 1488 // result: (DIVW (MOVBreg x) (MOVBreg y)) 1489 for { 1490 x := v_0 1491 y := v_1 1492 v.reset(OpS390XDIVW) 1493 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1494 v0.AddArg(x) 1495 v1 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1496 v1.AddArg(y) 1497 v.AddArg2(v0, v1) 1498 return true 1499 } 1500 } 1501 func rewriteValueS390X_OpDiv8u(v *Value) bool { 1502 v_1 := v.Args[1] 1503 v_0 := v.Args[0] 1504 b := v.Block 1505 typ := &b.Func.Config.Types 1506 // match: (Div8u x y) 1507 // result: (DIVWU (MOVBZreg x) (MOVBZreg y)) 1508 for { 1509 x := v_0 1510 y := v_1 1511 v.reset(OpS390XDIVWU) 1512 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 1513 v0.AddArg(x) 1514 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 1515 v1.AddArg(y) 1516 v.AddArg2(v0, v1) 1517 return true 1518 } 1519 } 1520 func rewriteValueS390X_OpEq16(v *Value) bool { 1521 v_1 := v.Args[1] 1522 v_0 := v.Args[0] 1523 b := v.Block 1524 typ := &b.Func.Config.Types 1525 // match: (Eq16 x y) 1526 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y))) 1527 for { 1528 x := v_0 1529 y := v_1 1530 v.reset(OpS390XLOCGR) 1531 v.Aux = s390xCCMaskToAux(s390x.Equal) 1532 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1533 v0.AuxInt = int64ToAuxInt(0) 1534 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1535 v1.AuxInt = int64ToAuxInt(1) 1536 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1537 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1538 v3.AddArg(x) 1539 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1540 v4.AddArg(y) 1541 v2.AddArg2(v3, v4) 1542 v.AddArg3(v0, v1, v2) 1543 return true 1544 } 1545 } 1546 func rewriteValueS390X_OpEq32(v *Value) bool { 1547 v_1 := v.Args[1] 1548 v_0 := v.Args[0] 1549 b := v.Block 1550 typ := &b.Func.Config.Types 1551 // match: (Eq32 x y) 1552 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y)) 1553 for { 1554 x := v_0 1555 y := v_1 1556 v.reset(OpS390XLOCGR) 1557 v.Aux = s390xCCMaskToAux(s390x.Equal) 1558 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1559 v0.AuxInt = int64ToAuxInt(0) 1560 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1561 v1.AuxInt = int64ToAuxInt(1) 1562 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1563 v2.AddArg2(x, y) 1564 v.AddArg3(v0, v1, v2) 1565 return true 1566 } 1567 } 1568 func rewriteValueS390X_OpEq32F(v *Value) bool { 1569 v_1 := v.Args[1] 1570 v_0 := v.Args[0] 1571 b := v.Block 1572 typ := &b.Func.Config.Types 1573 // match: (Eq32F x y) 1574 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y)) 1575 for { 1576 x := v_0 1577 y := v_1 1578 v.reset(OpS390XLOCGR) 1579 v.Aux = s390xCCMaskToAux(s390x.Equal) 1580 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1581 v0.AuxInt = int64ToAuxInt(0) 1582 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1583 v1.AuxInt = int64ToAuxInt(1) 1584 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags) 1585 v2.AddArg2(x, y) 1586 v.AddArg3(v0, v1, v2) 1587 return true 1588 } 1589 } 1590 func rewriteValueS390X_OpEq64(v *Value) bool { 1591 v_1 := v.Args[1] 1592 v_0 := v.Args[0] 1593 b := v.Block 1594 typ := &b.Func.Config.Types 1595 // match: (Eq64 x y) 1596 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 1597 for { 1598 x := v_0 1599 y := v_1 1600 v.reset(OpS390XLOCGR) 1601 v.Aux = s390xCCMaskToAux(s390x.Equal) 1602 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1603 v0.AuxInt = int64ToAuxInt(0) 1604 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1605 v1.AuxInt = int64ToAuxInt(1) 1606 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 1607 v2.AddArg2(x, y) 1608 v.AddArg3(v0, v1, v2) 1609 return true 1610 } 1611 } 1612 func rewriteValueS390X_OpEq64F(v *Value) bool { 1613 v_1 := v.Args[1] 1614 v_0 := v.Args[0] 1615 b := v.Block 1616 typ := &b.Func.Config.Types 1617 // match: (Eq64F x y) 1618 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y)) 1619 for { 1620 x := v_0 1621 y := v_1 1622 v.reset(OpS390XLOCGR) 1623 v.Aux = s390xCCMaskToAux(s390x.Equal) 1624 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1625 v0.AuxInt = int64ToAuxInt(0) 1626 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1627 v1.AuxInt = int64ToAuxInt(1) 1628 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags) 1629 v2.AddArg2(x, y) 1630 v.AddArg3(v0, v1, v2) 1631 return true 1632 } 1633 } 1634 func rewriteValueS390X_OpEq8(v *Value) bool { 1635 v_1 := v.Args[1] 1636 v_0 := v.Args[0] 1637 b := v.Block 1638 typ := &b.Func.Config.Types 1639 // match: (Eq8 x y) 1640 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 1641 for { 1642 x := v_0 1643 y := v_1 1644 v.reset(OpS390XLOCGR) 1645 v.Aux = s390xCCMaskToAux(s390x.Equal) 1646 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1647 v0.AuxInt = int64ToAuxInt(0) 1648 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1649 v1.AuxInt = int64ToAuxInt(1) 1650 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1651 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1652 v3.AddArg(x) 1653 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1654 v4.AddArg(y) 1655 v2.AddArg2(v3, v4) 1656 v.AddArg3(v0, v1, v2) 1657 return true 1658 } 1659 } 1660 func rewriteValueS390X_OpEqB(v *Value) bool { 1661 v_1 := v.Args[1] 1662 v_0 := v.Args[0] 1663 b := v.Block 1664 typ := &b.Func.Config.Types 1665 // match: (EqB x y) 1666 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 1667 for { 1668 x := v_0 1669 y := v_1 1670 v.reset(OpS390XLOCGR) 1671 v.Aux = s390xCCMaskToAux(s390x.Equal) 1672 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1673 v0.AuxInt = int64ToAuxInt(0) 1674 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1675 v1.AuxInt = int64ToAuxInt(1) 1676 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1677 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1678 v3.AddArg(x) 1679 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 1680 v4.AddArg(y) 1681 v2.AddArg2(v3, v4) 1682 v.AddArg3(v0, v1, v2) 1683 return true 1684 } 1685 } 1686 func rewriteValueS390X_OpEqPtr(v *Value) bool { 1687 v_1 := v.Args[1] 1688 v_0 := v.Args[0] 1689 b := v.Block 1690 typ := &b.Func.Config.Types 1691 // match: (EqPtr x y) 1692 // result: (LOCGR {s390x.Equal} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 1693 for { 1694 x := v_0 1695 y := v_1 1696 v.reset(OpS390XLOCGR) 1697 v.Aux = s390xCCMaskToAux(s390x.Equal) 1698 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1699 v0.AuxInt = int64ToAuxInt(0) 1700 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1701 v1.AuxInt = int64ToAuxInt(1) 1702 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 1703 v2.AddArg2(x, y) 1704 v.AddArg3(v0, v1, v2) 1705 return true 1706 } 1707 } 1708 func rewriteValueS390X_OpFMA(v *Value) bool { 1709 v_2 := v.Args[2] 1710 v_1 := v.Args[1] 1711 v_0 := v.Args[0] 1712 // match: (FMA x y z) 1713 // result: (FMADD z x y) 1714 for { 1715 x := v_0 1716 y := v_1 1717 z := v_2 1718 v.reset(OpS390XFMADD) 1719 v.AddArg3(z, x, y) 1720 return true 1721 } 1722 } 1723 func rewriteValueS390X_OpFloor(v *Value) bool { 1724 v_0 := v.Args[0] 1725 // match: (Floor x) 1726 // result: (FIDBR [7] x) 1727 for { 1728 x := v_0 1729 v.reset(OpS390XFIDBR) 1730 v.AuxInt = int8ToAuxInt(7) 1731 v.AddArg(x) 1732 return true 1733 } 1734 } 1735 func rewriteValueS390X_OpHmul32(v *Value) bool { 1736 v_1 := v.Args[1] 1737 v_0 := v.Args[0] 1738 b := v.Block 1739 typ := &b.Func.Config.Types 1740 // match: (Hmul32 x y) 1741 // result: (SRDconst [32] (MULLD (MOVWreg x) (MOVWreg y))) 1742 for { 1743 x := v_0 1744 y := v_1 1745 v.reset(OpS390XSRDconst) 1746 v.AuxInt = uint8ToAuxInt(32) 1747 v0 := b.NewValue0(v.Pos, OpS390XMULLD, typ.Int64) 1748 v1 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64) 1749 v1.AddArg(x) 1750 v2 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64) 1751 v2.AddArg(y) 1752 v0.AddArg2(v1, v2) 1753 v.AddArg(v0) 1754 return true 1755 } 1756 } 1757 func rewriteValueS390X_OpHmul32u(v *Value) bool { 1758 v_1 := v.Args[1] 1759 v_0 := v.Args[0] 1760 b := v.Block 1761 typ := &b.Func.Config.Types 1762 // match: (Hmul32u x y) 1763 // result: (SRDconst [32] (MULLD (MOVWZreg x) (MOVWZreg y))) 1764 for { 1765 x := v_0 1766 y := v_1 1767 v.reset(OpS390XSRDconst) 1768 v.AuxInt = uint8ToAuxInt(32) 1769 v0 := b.NewValue0(v.Pos, OpS390XMULLD, typ.Int64) 1770 v1 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 1771 v1.AddArg(x) 1772 v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 1773 v2.AddArg(y) 1774 v0.AddArg2(v1, v2) 1775 v.AddArg(v0) 1776 return true 1777 } 1778 } 1779 func rewriteValueS390X_OpITab(v *Value) bool { 1780 v_0 := v.Args[0] 1781 // match: (ITab (Load ptr mem)) 1782 // result: (MOVDload ptr mem) 1783 for { 1784 if v_0.Op != OpLoad { 1785 break 1786 } 1787 mem := v_0.Args[1] 1788 ptr := v_0.Args[0] 1789 v.reset(OpS390XMOVDload) 1790 v.AddArg2(ptr, mem) 1791 return true 1792 } 1793 return false 1794 } 1795 func rewriteValueS390X_OpIsInBounds(v *Value) bool { 1796 v_1 := v.Args[1] 1797 v_0 := v.Args[0] 1798 b := v.Block 1799 typ := &b.Func.Config.Types 1800 // match: (IsInBounds idx len) 1801 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPU idx len)) 1802 for { 1803 idx := v_0 1804 len := v_1 1805 v.reset(OpS390XLOCGR) 1806 v.Aux = s390xCCMaskToAux(s390x.Less) 1807 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1808 v0.AuxInt = int64ToAuxInt(0) 1809 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1810 v1.AuxInt = int64ToAuxInt(1) 1811 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 1812 v2.AddArg2(idx, len) 1813 v.AddArg3(v0, v1, v2) 1814 return true 1815 } 1816 } 1817 func rewriteValueS390X_OpIsNonNil(v *Value) bool { 1818 v_0 := v.Args[0] 1819 b := v.Block 1820 typ := &b.Func.Config.Types 1821 // match: (IsNonNil p) 1822 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPconst p [0])) 1823 for { 1824 p := v_0 1825 v.reset(OpS390XLOCGR) 1826 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 1827 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1828 v0.AuxInt = int64ToAuxInt(0) 1829 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1830 v1.AuxInt = int64ToAuxInt(1) 1831 v2 := b.NewValue0(v.Pos, OpS390XCMPconst, types.TypeFlags) 1832 v2.AuxInt = int32ToAuxInt(0) 1833 v2.AddArg(p) 1834 v.AddArg3(v0, v1, v2) 1835 return true 1836 } 1837 } 1838 func rewriteValueS390X_OpIsSliceInBounds(v *Value) bool { 1839 v_1 := v.Args[1] 1840 v_0 := v.Args[0] 1841 b := v.Block 1842 typ := &b.Func.Config.Types 1843 // match: (IsSliceInBounds idx len) 1844 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPU idx len)) 1845 for { 1846 idx := v_0 1847 len := v_1 1848 v.reset(OpS390XLOCGR) 1849 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1850 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1851 v0.AuxInt = int64ToAuxInt(0) 1852 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1853 v1.AuxInt = int64ToAuxInt(1) 1854 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 1855 v2.AddArg2(idx, len) 1856 v.AddArg3(v0, v1, v2) 1857 return true 1858 } 1859 } 1860 func rewriteValueS390X_OpLeq16(v *Value) bool { 1861 v_1 := v.Args[1] 1862 v_0 := v.Args[0] 1863 b := v.Block 1864 typ := &b.Func.Config.Types 1865 // match: (Leq16 x y) 1866 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y))) 1867 for { 1868 x := v_0 1869 y := v_1 1870 v.reset(OpS390XLOCGR) 1871 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1872 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1873 v0.AuxInt = int64ToAuxInt(0) 1874 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1875 v1.AuxInt = int64ToAuxInt(1) 1876 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1877 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1878 v3.AddArg(x) 1879 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 1880 v4.AddArg(y) 1881 v2.AddArg2(v3, v4) 1882 v.AddArg3(v0, v1, v2) 1883 return true 1884 } 1885 } 1886 func rewriteValueS390X_OpLeq16U(v *Value) bool { 1887 v_1 := v.Args[1] 1888 v_0 := v.Args[0] 1889 b := v.Block 1890 typ := &b.Func.Config.Types 1891 // match: (Leq16U x y) 1892 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVHZreg x) (MOVHZreg y))) 1893 for { 1894 x := v_0 1895 y := v_1 1896 v.reset(OpS390XLOCGR) 1897 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1898 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1899 v0.AuxInt = int64ToAuxInt(0) 1900 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1901 v1.AuxInt = int64ToAuxInt(1) 1902 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 1903 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 1904 v3.AddArg(x) 1905 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 1906 v4.AddArg(y) 1907 v2.AddArg2(v3, v4) 1908 v.AddArg3(v0, v1, v2) 1909 return true 1910 } 1911 } 1912 func rewriteValueS390X_OpLeq32(v *Value) bool { 1913 v_1 := v.Args[1] 1914 v_0 := v.Args[0] 1915 b := v.Block 1916 typ := &b.Func.Config.Types 1917 // match: (Leq32 x y) 1918 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y)) 1919 for { 1920 x := v_0 1921 y := v_1 1922 v.reset(OpS390XLOCGR) 1923 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1924 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1925 v0.AuxInt = int64ToAuxInt(0) 1926 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1927 v1.AuxInt = int64ToAuxInt(1) 1928 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 1929 v2.AddArg2(x, y) 1930 v.AddArg3(v0, v1, v2) 1931 return true 1932 } 1933 } 1934 func rewriteValueS390X_OpLeq32F(v *Value) bool { 1935 v_1 := v.Args[1] 1936 v_0 := v.Args[0] 1937 b := v.Block 1938 typ := &b.Func.Config.Types 1939 // match: (Leq32F x y) 1940 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y)) 1941 for { 1942 x := v_0 1943 y := v_1 1944 v.reset(OpS390XLOCGR) 1945 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1946 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1947 v0.AuxInt = int64ToAuxInt(0) 1948 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1949 v1.AuxInt = int64ToAuxInt(1) 1950 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags) 1951 v2.AddArg2(x, y) 1952 v.AddArg3(v0, v1, v2) 1953 return true 1954 } 1955 } 1956 func rewriteValueS390X_OpLeq32U(v *Value) bool { 1957 v_1 := v.Args[1] 1958 v_0 := v.Args[0] 1959 b := v.Block 1960 typ := &b.Func.Config.Types 1961 // match: (Leq32U x y) 1962 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU x y)) 1963 for { 1964 x := v_0 1965 y := v_1 1966 v.reset(OpS390XLOCGR) 1967 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1968 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1969 v0.AuxInt = int64ToAuxInt(0) 1970 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1971 v1.AuxInt = int64ToAuxInt(1) 1972 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 1973 v2.AddArg2(x, y) 1974 v.AddArg3(v0, v1, v2) 1975 return true 1976 } 1977 } 1978 func rewriteValueS390X_OpLeq64(v *Value) bool { 1979 v_1 := v.Args[1] 1980 v_0 := v.Args[0] 1981 b := v.Block 1982 typ := &b.Func.Config.Types 1983 // match: (Leq64 x y) 1984 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 1985 for { 1986 x := v_0 1987 y := v_1 1988 v.reset(OpS390XLOCGR) 1989 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 1990 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1991 v0.AuxInt = int64ToAuxInt(0) 1992 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 1993 v1.AuxInt = int64ToAuxInt(1) 1994 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 1995 v2.AddArg2(x, y) 1996 v.AddArg3(v0, v1, v2) 1997 return true 1998 } 1999 } 2000 func rewriteValueS390X_OpLeq64F(v *Value) bool { 2001 v_1 := v.Args[1] 2002 v_0 := v.Args[0] 2003 b := v.Block 2004 typ := &b.Func.Config.Types 2005 // match: (Leq64F x y) 2006 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y)) 2007 for { 2008 x := v_0 2009 y := v_1 2010 v.reset(OpS390XLOCGR) 2011 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2012 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2013 v0.AuxInt = int64ToAuxInt(0) 2014 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2015 v1.AuxInt = int64ToAuxInt(1) 2016 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags) 2017 v2.AddArg2(x, y) 2018 v.AddArg3(v0, v1, v2) 2019 return true 2020 } 2021 } 2022 func rewriteValueS390X_OpLeq64U(v *Value) bool { 2023 v_1 := v.Args[1] 2024 v_0 := v.Args[0] 2025 b := v.Block 2026 typ := &b.Func.Config.Types 2027 // match: (Leq64U x y) 2028 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPU x y)) 2029 for { 2030 x := v_0 2031 y := v_1 2032 v.reset(OpS390XLOCGR) 2033 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2034 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2035 v0.AuxInt = int64ToAuxInt(0) 2036 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2037 v1.AuxInt = int64ToAuxInt(1) 2038 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 2039 v2.AddArg2(x, y) 2040 v.AddArg3(v0, v1, v2) 2041 return true 2042 } 2043 } 2044 func rewriteValueS390X_OpLeq8(v *Value) bool { 2045 v_1 := v.Args[1] 2046 v_0 := v.Args[0] 2047 b := v.Block 2048 typ := &b.Func.Config.Types 2049 // match: (Leq8 x y) 2050 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 2051 for { 2052 x := v_0 2053 y := v_1 2054 v.reset(OpS390XLOCGR) 2055 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2056 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2057 v0.AuxInt = int64ToAuxInt(0) 2058 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2059 v1.AuxInt = int64ToAuxInt(1) 2060 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 2061 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 2062 v3.AddArg(x) 2063 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 2064 v4.AddArg(y) 2065 v2.AddArg2(v3, v4) 2066 v.AddArg3(v0, v1, v2) 2067 return true 2068 } 2069 } 2070 func rewriteValueS390X_OpLeq8U(v *Value) bool { 2071 v_1 := v.Args[1] 2072 v_0 := v.Args[0] 2073 b := v.Block 2074 typ := &b.Func.Config.Types 2075 // match: (Leq8U x y) 2076 // result: (LOCGR {s390x.LessOrEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVBZreg x) (MOVBZreg y))) 2077 for { 2078 x := v_0 2079 y := v_1 2080 v.reset(OpS390XLOCGR) 2081 v.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 2082 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2083 v0.AuxInt = int64ToAuxInt(0) 2084 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2085 v1.AuxInt = int64ToAuxInt(1) 2086 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 2087 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2088 v3.AddArg(x) 2089 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2090 v4.AddArg(y) 2091 v2.AddArg2(v3, v4) 2092 v.AddArg3(v0, v1, v2) 2093 return true 2094 } 2095 } 2096 func rewriteValueS390X_OpLess16(v *Value) bool { 2097 v_1 := v.Args[1] 2098 v_0 := v.Args[0] 2099 b := v.Block 2100 typ := &b.Func.Config.Types 2101 // match: (Less16 x y) 2102 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y))) 2103 for { 2104 x := v_0 2105 y := v_1 2106 v.reset(OpS390XLOCGR) 2107 v.Aux = s390xCCMaskToAux(s390x.Less) 2108 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2109 v0.AuxInt = int64ToAuxInt(0) 2110 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2111 v1.AuxInt = int64ToAuxInt(1) 2112 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 2113 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 2114 v3.AddArg(x) 2115 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 2116 v4.AddArg(y) 2117 v2.AddArg2(v3, v4) 2118 v.AddArg3(v0, v1, v2) 2119 return true 2120 } 2121 } 2122 func rewriteValueS390X_OpLess16U(v *Value) bool { 2123 v_1 := v.Args[1] 2124 v_0 := v.Args[0] 2125 b := v.Block 2126 typ := &b.Func.Config.Types 2127 // match: (Less16U x y) 2128 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVHZreg x) (MOVHZreg y))) 2129 for { 2130 x := v_0 2131 y := v_1 2132 v.reset(OpS390XLOCGR) 2133 v.Aux = s390xCCMaskToAux(s390x.Less) 2134 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2135 v0.AuxInt = int64ToAuxInt(0) 2136 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2137 v1.AuxInt = int64ToAuxInt(1) 2138 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 2139 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2140 v3.AddArg(x) 2141 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2142 v4.AddArg(y) 2143 v2.AddArg2(v3, v4) 2144 v.AddArg3(v0, v1, v2) 2145 return true 2146 } 2147 } 2148 func rewriteValueS390X_OpLess32(v *Value) bool { 2149 v_1 := v.Args[1] 2150 v_0 := v.Args[0] 2151 b := v.Block 2152 typ := &b.Func.Config.Types 2153 // match: (Less32 x y) 2154 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y)) 2155 for { 2156 x := v_0 2157 y := v_1 2158 v.reset(OpS390XLOCGR) 2159 v.Aux = s390xCCMaskToAux(s390x.Less) 2160 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2161 v0.AuxInt = int64ToAuxInt(0) 2162 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2163 v1.AuxInt = int64ToAuxInt(1) 2164 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 2165 v2.AddArg2(x, y) 2166 v.AddArg3(v0, v1, v2) 2167 return true 2168 } 2169 } 2170 func rewriteValueS390X_OpLess32F(v *Value) bool { 2171 v_1 := v.Args[1] 2172 v_0 := v.Args[0] 2173 b := v.Block 2174 typ := &b.Func.Config.Types 2175 // match: (Less32F x y) 2176 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y)) 2177 for { 2178 x := v_0 2179 y := v_1 2180 v.reset(OpS390XLOCGR) 2181 v.Aux = s390xCCMaskToAux(s390x.Less) 2182 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2183 v0.AuxInt = int64ToAuxInt(0) 2184 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2185 v1.AuxInt = int64ToAuxInt(1) 2186 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags) 2187 v2.AddArg2(x, y) 2188 v.AddArg3(v0, v1, v2) 2189 return true 2190 } 2191 } 2192 func rewriteValueS390X_OpLess32U(v *Value) bool { 2193 v_1 := v.Args[1] 2194 v_0 := v.Args[0] 2195 b := v.Block 2196 typ := &b.Func.Config.Types 2197 // match: (Less32U x y) 2198 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU x y)) 2199 for { 2200 x := v_0 2201 y := v_1 2202 v.reset(OpS390XLOCGR) 2203 v.Aux = s390xCCMaskToAux(s390x.Less) 2204 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2205 v0.AuxInt = int64ToAuxInt(0) 2206 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2207 v1.AuxInt = int64ToAuxInt(1) 2208 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 2209 v2.AddArg2(x, y) 2210 v.AddArg3(v0, v1, v2) 2211 return true 2212 } 2213 } 2214 func rewriteValueS390X_OpLess64(v *Value) bool { 2215 v_1 := v.Args[1] 2216 v_0 := v.Args[0] 2217 b := v.Block 2218 typ := &b.Func.Config.Types 2219 // match: (Less64 x y) 2220 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 2221 for { 2222 x := v_0 2223 y := v_1 2224 v.reset(OpS390XLOCGR) 2225 v.Aux = s390xCCMaskToAux(s390x.Less) 2226 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2227 v0.AuxInt = int64ToAuxInt(0) 2228 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2229 v1.AuxInt = int64ToAuxInt(1) 2230 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 2231 v2.AddArg2(x, y) 2232 v.AddArg3(v0, v1, v2) 2233 return true 2234 } 2235 } 2236 func rewriteValueS390X_OpLess64F(v *Value) bool { 2237 v_1 := v.Args[1] 2238 v_0 := v.Args[0] 2239 b := v.Block 2240 typ := &b.Func.Config.Types 2241 // match: (Less64F x y) 2242 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y)) 2243 for { 2244 x := v_0 2245 y := v_1 2246 v.reset(OpS390XLOCGR) 2247 v.Aux = s390xCCMaskToAux(s390x.Less) 2248 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2249 v0.AuxInt = int64ToAuxInt(0) 2250 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2251 v1.AuxInt = int64ToAuxInt(1) 2252 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags) 2253 v2.AddArg2(x, y) 2254 v.AddArg3(v0, v1, v2) 2255 return true 2256 } 2257 } 2258 func rewriteValueS390X_OpLess64U(v *Value) bool { 2259 v_1 := v.Args[1] 2260 v_0 := v.Args[0] 2261 b := v.Block 2262 typ := &b.Func.Config.Types 2263 // match: (Less64U x y) 2264 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPU x y)) 2265 for { 2266 x := v_0 2267 y := v_1 2268 v.reset(OpS390XLOCGR) 2269 v.Aux = s390xCCMaskToAux(s390x.Less) 2270 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2271 v0.AuxInt = int64ToAuxInt(0) 2272 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2273 v1.AuxInt = int64ToAuxInt(1) 2274 v2 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 2275 v2.AddArg2(x, y) 2276 v.AddArg3(v0, v1, v2) 2277 return true 2278 } 2279 } 2280 func rewriteValueS390X_OpLess8(v *Value) bool { 2281 v_1 := v.Args[1] 2282 v_0 := v.Args[0] 2283 b := v.Block 2284 typ := &b.Func.Config.Types 2285 // match: (Less8 x y) 2286 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 2287 for { 2288 x := v_0 2289 y := v_1 2290 v.reset(OpS390XLOCGR) 2291 v.Aux = s390xCCMaskToAux(s390x.Less) 2292 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2293 v0.AuxInt = int64ToAuxInt(0) 2294 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2295 v1.AuxInt = int64ToAuxInt(1) 2296 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 2297 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 2298 v3.AddArg(x) 2299 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 2300 v4.AddArg(y) 2301 v2.AddArg2(v3, v4) 2302 v.AddArg3(v0, v1, v2) 2303 return true 2304 } 2305 } 2306 func rewriteValueS390X_OpLess8U(v *Value) bool { 2307 v_1 := v.Args[1] 2308 v_0 := v.Args[0] 2309 b := v.Block 2310 typ := &b.Func.Config.Types 2311 // match: (Less8U x y) 2312 // result: (LOCGR {s390x.Less} (MOVDconst [0]) (MOVDconst [1]) (CMPWU (MOVBZreg x) (MOVBZreg y))) 2313 for { 2314 x := v_0 2315 y := v_1 2316 v.reset(OpS390XLOCGR) 2317 v.Aux = s390xCCMaskToAux(s390x.Less) 2318 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2319 v0.AuxInt = int64ToAuxInt(0) 2320 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2321 v1.AuxInt = int64ToAuxInt(1) 2322 v2 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 2323 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2324 v3.AddArg(x) 2325 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2326 v4.AddArg(y) 2327 v2.AddArg2(v3, v4) 2328 v.AddArg3(v0, v1, v2) 2329 return true 2330 } 2331 } 2332 func rewriteValueS390X_OpLoad(v *Value) bool { 2333 v_1 := v.Args[1] 2334 v_0 := v.Args[0] 2335 // match: (Load <t> ptr mem) 2336 // cond: (is64BitInt(t) || isPtr(t)) 2337 // result: (MOVDload ptr mem) 2338 for { 2339 t := v.Type 2340 ptr := v_0 2341 mem := v_1 2342 if !(is64BitInt(t) || isPtr(t)) { 2343 break 2344 } 2345 v.reset(OpS390XMOVDload) 2346 v.AddArg2(ptr, mem) 2347 return true 2348 } 2349 // match: (Load <t> ptr mem) 2350 // cond: is32BitInt(t) && isSigned(t) 2351 // result: (MOVWload ptr mem) 2352 for { 2353 t := v.Type 2354 ptr := v_0 2355 mem := v_1 2356 if !(is32BitInt(t) && isSigned(t)) { 2357 break 2358 } 2359 v.reset(OpS390XMOVWload) 2360 v.AddArg2(ptr, mem) 2361 return true 2362 } 2363 // match: (Load <t> ptr mem) 2364 // cond: is32BitInt(t) && !isSigned(t) 2365 // result: (MOVWZload ptr mem) 2366 for { 2367 t := v.Type 2368 ptr := v_0 2369 mem := v_1 2370 if !(is32BitInt(t) && !isSigned(t)) { 2371 break 2372 } 2373 v.reset(OpS390XMOVWZload) 2374 v.AddArg2(ptr, mem) 2375 return true 2376 } 2377 // match: (Load <t> ptr mem) 2378 // cond: is16BitInt(t) && isSigned(t) 2379 // result: (MOVHload ptr mem) 2380 for { 2381 t := v.Type 2382 ptr := v_0 2383 mem := v_1 2384 if !(is16BitInt(t) && isSigned(t)) { 2385 break 2386 } 2387 v.reset(OpS390XMOVHload) 2388 v.AddArg2(ptr, mem) 2389 return true 2390 } 2391 // match: (Load <t> ptr mem) 2392 // cond: is16BitInt(t) && !isSigned(t) 2393 // result: (MOVHZload ptr mem) 2394 for { 2395 t := v.Type 2396 ptr := v_0 2397 mem := v_1 2398 if !(is16BitInt(t) && !isSigned(t)) { 2399 break 2400 } 2401 v.reset(OpS390XMOVHZload) 2402 v.AddArg2(ptr, mem) 2403 return true 2404 } 2405 // match: (Load <t> ptr mem) 2406 // cond: is8BitInt(t) && isSigned(t) 2407 // result: (MOVBload ptr mem) 2408 for { 2409 t := v.Type 2410 ptr := v_0 2411 mem := v_1 2412 if !(is8BitInt(t) && isSigned(t)) { 2413 break 2414 } 2415 v.reset(OpS390XMOVBload) 2416 v.AddArg2(ptr, mem) 2417 return true 2418 } 2419 // match: (Load <t> ptr mem) 2420 // cond: (t.IsBoolean() || (is8BitInt(t) && !isSigned(t))) 2421 // result: (MOVBZload ptr mem) 2422 for { 2423 t := v.Type 2424 ptr := v_0 2425 mem := v_1 2426 if !(t.IsBoolean() || (is8BitInt(t) && !isSigned(t))) { 2427 break 2428 } 2429 v.reset(OpS390XMOVBZload) 2430 v.AddArg2(ptr, mem) 2431 return true 2432 } 2433 // match: (Load <t> ptr mem) 2434 // cond: is32BitFloat(t) 2435 // result: (FMOVSload ptr mem) 2436 for { 2437 t := v.Type 2438 ptr := v_0 2439 mem := v_1 2440 if !(is32BitFloat(t)) { 2441 break 2442 } 2443 v.reset(OpS390XFMOVSload) 2444 v.AddArg2(ptr, mem) 2445 return true 2446 } 2447 // match: (Load <t> ptr mem) 2448 // cond: is64BitFloat(t) 2449 // result: (FMOVDload ptr mem) 2450 for { 2451 t := v.Type 2452 ptr := v_0 2453 mem := v_1 2454 if !(is64BitFloat(t)) { 2455 break 2456 } 2457 v.reset(OpS390XFMOVDload) 2458 v.AddArg2(ptr, mem) 2459 return true 2460 } 2461 return false 2462 } 2463 func rewriteValueS390X_OpLocalAddr(v *Value) bool { 2464 v_0 := v.Args[0] 2465 // match: (LocalAddr {sym} base _) 2466 // result: (MOVDaddr {sym} base) 2467 for { 2468 sym := auxToSym(v.Aux) 2469 base := v_0 2470 v.reset(OpS390XMOVDaddr) 2471 v.Aux = symToAux(sym) 2472 v.AddArg(base) 2473 return true 2474 } 2475 } 2476 func rewriteValueS390X_OpLsh16x16(v *Value) bool { 2477 v_1 := v.Args[1] 2478 v_0 := v.Args[0] 2479 b := v.Block 2480 typ := &b.Func.Config.Types 2481 // match: (Lsh16x16 x y) 2482 // cond: shiftIsBounded(v) 2483 // result: (SLW x y) 2484 for { 2485 x := v_0 2486 y := v_1 2487 if !(shiftIsBounded(v)) { 2488 break 2489 } 2490 v.reset(OpS390XSLW) 2491 v.AddArg2(x, y) 2492 return true 2493 } 2494 // match: (Lsh16x16 <t> x y) 2495 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 2496 for { 2497 t := v.Type 2498 x := v_0 2499 y := v_1 2500 v.reset(OpS390XLOCGR) 2501 v.Type = t 2502 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2503 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2504 v0.AddArg2(x, y) 2505 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2506 v1.AuxInt = int64ToAuxInt(0) 2507 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2508 v2.AuxInt = int32ToAuxInt(64) 2509 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2510 v3.AddArg(y) 2511 v2.AddArg(v3) 2512 v.AddArg3(v0, v1, v2) 2513 return true 2514 } 2515 } 2516 func rewriteValueS390X_OpLsh16x32(v *Value) bool { 2517 v_1 := v.Args[1] 2518 v_0 := v.Args[0] 2519 b := v.Block 2520 typ := &b.Func.Config.Types 2521 // match: (Lsh16x32 x y) 2522 // cond: shiftIsBounded(v) 2523 // result: (SLW x y) 2524 for { 2525 x := v_0 2526 y := v_1 2527 if !(shiftIsBounded(v)) { 2528 break 2529 } 2530 v.reset(OpS390XSLW) 2531 v.AddArg2(x, y) 2532 return true 2533 } 2534 // match: (Lsh16x32 <t> x y) 2535 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 2536 for { 2537 t := v.Type 2538 x := v_0 2539 y := v_1 2540 v.reset(OpS390XLOCGR) 2541 v.Type = t 2542 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2543 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2544 v0.AddArg2(x, y) 2545 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2546 v1.AuxInt = int64ToAuxInt(0) 2547 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2548 v2.AuxInt = int32ToAuxInt(64) 2549 v2.AddArg(y) 2550 v.AddArg3(v0, v1, v2) 2551 return true 2552 } 2553 } 2554 func rewriteValueS390X_OpLsh16x64(v *Value) bool { 2555 v_1 := v.Args[1] 2556 v_0 := v.Args[0] 2557 b := v.Block 2558 typ := &b.Func.Config.Types 2559 // match: (Lsh16x64 x y) 2560 // cond: shiftIsBounded(v) 2561 // result: (SLW x y) 2562 for { 2563 x := v_0 2564 y := v_1 2565 if !(shiftIsBounded(v)) { 2566 break 2567 } 2568 v.reset(OpS390XSLW) 2569 v.AddArg2(x, y) 2570 return true 2571 } 2572 // match: (Lsh16x64 <t> x y) 2573 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 2574 for { 2575 t := v.Type 2576 x := v_0 2577 y := v_1 2578 v.reset(OpS390XLOCGR) 2579 v.Type = t 2580 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2581 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2582 v0.AddArg2(x, y) 2583 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2584 v1.AuxInt = int64ToAuxInt(0) 2585 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 2586 v2.AuxInt = int32ToAuxInt(64) 2587 v2.AddArg(y) 2588 v.AddArg3(v0, v1, v2) 2589 return true 2590 } 2591 } 2592 func rewriteValueS390X_OpLsh16x8(v *Value) bool { 2593 v_1 := v.Args[1] 2594 v_0 := v.Args[0] 2595 b := v.Block 2596 typ := &b.Func.Config.Types 2597 // match: (Lsh16x8 x y) 2598 // cond: shiftIsBounded(v) 2599 // result: (SLW x y) 2600 for { 2601 x := v_0 2602 y := v_1 2603 if !(shiftIsBounded(v)) { 2604 break 2605 } 2606 v.reset(OpS390XSLW) 2607 v.AddArg2(x, y) 2608 return true 2609 } 2610 // match: (Lsh16x8 <t> x y) 2611 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 2612 for { 2613 t := v.Type 2614 x := v_0 2615 y := v_1 2616 v.reset(OpS390XLOCGR) 2617 v.Type = t 2618 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2619 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2620 v0.AddArg2(x, y) 2621 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2622 v1.AuxInt = int64ToAuxInt(0) 2623 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2624 v2.AuxInt = int32ToAuxInt(64) 2625 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2626 v3.AddArg(y) 2627 v2.AddArg(v3) 2628 v.AddArg3(v0, v1, v2) 2629 return true 2630 } 2631 } 2632 func rewriteValueS390X_OpLsh32x16(v *Value) bool { 2633 v_1 := v.Args[1] 2634 v_0 := v.Args[0] 2635 b := v.Block 2636 typ := &b.Func.Config.Types 2637 // match: (Lsh32x16 x y) 2638 // cond: shiftIsBounded(v) 2639 // result: (SLW x y) 2640 for { 2641 x := v_0 2642 y := v_1 2643 if !(shiftIsBounded(v)) { 2644 break 2645 } 2646 v.reset(OpS390XSLW) 2647 v.AddArg2(x, y) 2648 return true 2649 } 2650 // match: (Lsh32x16 <t> x y) 2651 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 2652 for { 2653 t := v.Type 2654 x := v_0 2655 y := v_1 2656 v.reset(OpS390XLOCGR) 2657 v.Type = t 2658 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2659 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2660 v0.AddArg2(x, y) 2661 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2662 v1.AuxInt = int64ToAuxInt(0) 2663 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2664 v2.AuxInt = int32ToAuxInt(64) 2665 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2666 v3.AddArg(y) 2667 v2.AddArg(v3) 2668 v.AddArg3(v0, v1, v2) 2669 return true 2670 } 2671 } 2672 func rewriteValueS390X_OpLsh32x32(v *Value) bool { 2673 v_1 := v.Args[1] 2674 v_0 := v.Args[0] 2675 b := v.Block 2676 typ := &b.Func.Config.Types 2677 // match: (Lsh32x32 x y) 2678 // cond: shiftIsBounded(v) 2679 // result: (SLW x y) 2680 for { 2681 x := v_0 2682 y := v_1 2683 if !(shiftIsBounded(v)) { 2684 break 2685 } 2686 v.reset(OpS390XSLW) 2687 v.AddArg2(x, y) 2688 return true 2689 } 2690 // match: (Lsh32x32 <t> x y) 2691 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 2692 for { 2693 t := v.Type 2694 x := v_0 2695 y := v_1 2696 v.reset(OpS390XLOCGR) 2697 v.Type = t 2698 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2699 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2700 v0.AddArg2(x, y) 2701 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2702 v1.AuxInt = int64ToAuxInt(0) 2703 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2704 v2.AuxInt = int32ToAuxInt(64) 2705 v2.AddArg(y) 2706 v.AddArg3(v0, v1, v2) 2707 return true 2708 } 2709 } 2710 func rewriteValueS390X_OpLsh32x64(v *Value) bool { 2711 v_1 := v.Args[1] 2712 v_0 := v.Args[0] 2713 b := v.Block 2714 typ := &b.Func.Config.Types 2715 // match: (Lsh32x64 x y) 2716 // cond: shiftIsBounded(v) 2717 // result: (SLW x y) 2718 for { 2719 x := v_0 2720 y := v_1 2721 if !(shiftIsBounded(v)) { 2722 break 2723 } 2724 v.reset(OpS390XSLW) 2725 v.AddArg2(x, y) 2726 return true 2727 } 2728 // match: (Lsh32x64 <t> x y) 2729 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 2730 for { 2731 t := v.Type 2732 x := v_0 2733 y := v_1 2734 v.reset(OpS390XLOCGR) 2735 v.Type = t 2736 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2737 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2738 v0.AddArg2(x, y) 2739 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2740 v1.AuxInt = int64ToAuxInt(0) 2741 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 2742 v2.AuxInt = int32ToAuxInt(64) 2743 v2.AddArg(y) 2744 v.AddArg3(v0, v1, v2) 2745 return true 2746 } 2747 } 2748 func rewriteValueS390X_OpLsh32x8(v *Value) bool { 2749 v_1 := v.Args[1] 2750 v_0 := v.Args[0] 2751 b := v.Block 2752 typ := &b.Func.Config.Types 2753 // match: (Lsh32x8 x y) 2754 // cond: shiftIsBounded(v) 2755 // result: (SLW x y) 2756 for { 2757 x := v_0 2758 y := v_1 2759 if !(shiftIsBounded(v)) { 2760 break 2761 } 2762 v.reset(OpS390XSLW) 2763 v.AddArg2(x, y) 2764 return true 2765 } 2766 // match: (Lsh32x8 <t> x y) 2767 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 2768 for { 2769 t := v.Type 2770 x := v_0 2771 y := v_1 2772 v.reset(OpS390XLOCGR) 2773 v.Type = t 2774 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2775 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2776 v0.AddArg2(x, y) 2777 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2778 v1.AuxInt = int64ToAuxInt(0) 2779 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2780 v2.AuxInt = int32ToAuxInt(64) 2781 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2782 v3.AddArg(y) 2783 v2.AddArg(v3) 2784 v.AddArg3(v0, v1, v2) 2785 return true 2786 } 2787 } 2788 func rewriteValueS390X_OpLsh64x16(v *Value) bool { 2789 v_1 := v.Args[1] 2790 v_0 := v.Args[0] 2791 b := v.Block 2792 typ := &b.Func.Config.Types 2793 // match: (Lsh64x16 x y) 2794 // cond: shiftIsBounded(v) 2795 // result: (SLD x y) 2796 for { 2797 x := v_0 2798 y := v_1 2799 if !(shiftIsBounded(v)) { 2800 break 2801 } 2802 v.reset(OpS390XSLD) 2803 v.AddArg2(x, y) 2804 return true 2805 } 2806 // match: (Lsh64x16 <t> x y) 2807 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 2808 for { 2809 t := v.Type 2810 x := v_0 2811 y := v_1 2812 v.reset(OpS390XLOCGR) 2813 v.Type = t 2814 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2815 v0 := b.NewValue0(v.Pos, OpS390XSLD, t) 2816 v0.AddArg2(x, y) 2817 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2818 v1.AuxInt = int64ToAuxInt(0) 2819 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2820 v2.AuxInt = int32ToAuxInt(64) 2821 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2822 v3.AddArg(y) 2823 v2.AddArg(v3) 2824 v.AddArg3(v0, v1, v2) 2825 return true 2826 } 2827 } 2828 func rewriteValueS390X_OpLsh64x32(v *Value) bool { 2829 v_1 := v.Args[1] 2830 v_0 := v.Args[0] 2831 b := v.Block 2832 typ := &b.Func.Config.Types 2833 // match: (Lsh64x32 x y) 2834 // cond: shiftIsBounded(v) 2835 // result: (SLD x y) 2836 for { 2837 x := v_0 2838 y := v_1 2839 if !(shiftIsBounded(v)) { 2840 break 2841 } 2842 v.reset(OpS390XSLD) 2843 v.AddArg2(x, y) 2844 return true 2845 } 2846 // match: (Lsh64x32 <t> x y) 2847 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 2848 for { 2849 t := v.Type 2850 x := v_0 2851 y := v_1 2852 v.reset(OpS390XLOCGR) 2853 v.Type = t 2854 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2855 v0 := b.NewValue0(v.Pos, OpS390XSLD, t) 2856 v0.AddArg2(x, y) 2857 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2858 v1.AuxInt = int64ToAuxInt(0) 2859 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2860 v2.AuxInt = int32ToAuxInt(64) 2861 v2.AddArg(y) 2862 v.AddArg3(v0, v1, v2) 2863 return true 2864 } 2865 } 2866 func rewriteValueS390X_OpLsh64x64(v *Value) bool { 2867 v_1 := v.Args[1] 2868 v_0 := v.Args[0] 2869 b := v.Block 2870 typ := &b.Func.Config.Types 2871 // match: (Lsh64x64 x y) 2872 // cond: shiftIsBounded(v) 2873 // result: (SLD x y) 2874 for { 2875 x := v_0 2876 y := v_1 2877 if !(shiftIsBounded(v)) { 2878 break 2879 } 2880 v.reset(OpS390XSLD) 2881 v.AddArg2(x, y) 2882 return true 2883 } 2884 // match: (Lsh64x64 <t> x y) 2885 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 2886 for { 2887 t := v.Type 2888 x := v_0 2889 y := v_1 2890 v.reset(OpS390XLOCGR) 2891 v.Type = t 2892 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2893 v0 := b.NewValue0(v.Pos, OpS390XSLD, t) 2894 v0.AddArg2(x, y) 2895 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2896 v1.AuxInt = int64ToAuxInt(0) 2897 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 2898 v2.AuxInt = int32ToAuxInt(64) 2899 v2.AddArg(y) 2900 v.AddArg3(v0, v1, v2) 2901 return true 2902 } 2903 } 2904 func rewriteValueS390X_OpLsh64x8(v *Value) bool { 2905 v_1 := v.Args[1] 2906 v_0 := v.Args[0] 2907 b := v.Block 2908 typ := &b.Func.Config.Types 2909 // match: (Lsh64x8 x y) 2910 // cond: shiftIsBounded(v) 2911 // result: (SLD x y) 2912 for { 2913 x := v_0 2914 y := v_1 2915 if !(shiftIsBounded(v)) { 2916 break 2917 } 2918 v.reset(OpS390XSLD) 2919 v.AddArg2(x, y) 2920 return true 2921 } 2922 // match: (Lsh64x8 <t> x y) 2923 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 2924 for { 2925 t := v.Type 2926 x := v_0 2927 y := v_1 2928 v.reset(OpS390XLOCGR) 2929 v.Type = t 2930 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2931 v0 := b.NewValue0(v.Pos, OpS390XSLD, t) 2932 v0.AddArg2(x, y) 2933 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2934 v1.AuxInt = int64ToAuxInt(0) 2935 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2936 v2.AuxInt = int32ToAuxInt(64) 2937 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 2938 v3.AddArg(y) 2939 v2.AddArg(v3) 2940 v.AddArg3(v0, v1, v2) 2941 return true 2942 } 2943 } 2944 func rewriteValueS390X_OpLsh8x16(v *Value) bool { 2945 v_1 := v.Args[1] 2946 v_0 := v.Args[0] 2947 b := v.Block 2948 typ := &b.Func.Config.Types 2949 // match: (Lsh8x16 x y) 2950 // cond: shiftIsBounded(v) 2951 // result: (SLW x y) 2952 for { 2953 x := v_0 2954 y := v_1 2955 if !(shiftIsBounded(v)) { 2956 break 2957 } 2958 v.reset(OpS390XSLW) 2959 v.AddArg2(x, y) 2960 return true 2961 } 2962 // match: (Lsh8x16 <t> x y) 2963 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 2964 for { 2965 t := v.Type 2966 x := v_0 2967 y := v_1 2968 v.reset(OpS390XLOCGR) 2969 v.Type = t 2970 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 2971 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 2972 v0.AddArg2(x, y) 2973 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 2974 v1.AuxInt = int64ToAuxInt(0) 2975 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 2976 v2.AuxInt = int32ToAuxInt(64) 2977 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 2978 v3.AddArg(y) 2979 v2.AddArg(v3) 2980 v.AddArg3(v0, v1, v2) 2981 return true 2982 } 2983 } 2984 func rewriteValueS390X_OpLsh8x32(v *Value) bool { 2985 v_1 := v.Args[1] 2986 v_0 := v.Args[0] 2987 b := v.Block 2988 typ := &b.Func.Config.Types 2989 // match: (Lsh8x32 x y) 2990 // cond: shiftIsBounded(v) 2991 // result: (SLW x y) 2992 for { 2993 x := v_0 2994 y := v_1 2995 if !(shiftIsBounded(v)) { 2996 break 2997 } 2998 v.reset(OpS390XSLW) 2999 v.AddArg2(x, y) 3000 return true 3001 } 3002 // match: (Lsh8x32 <t> x y) 3003 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 3004 for { 3005 t := v.Type 3006 x := v_0 3007 y := v_1 3008 v.reset(OpS390XLOCGR) 3009 v.Type = t 3010 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 3011 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 3012 v0.AddArg2(x, y) 3013 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3014 v1.AuxInt = int64ToAuxInt(0) 3015 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 3016 v2.AuxInt = int32ToAuxInt(64) 3017 v2.AddArg(y) 3018 v.AddArg3(v0, v1, v2) 3019 return true 3020 } 3021 } 3022 func rewriteValueS390X_OpLsh8x64(v *Value) bool { 3023 v_1 := v.Args[1] 3024 v_0 := v.Args[0] 3025 b := v.Block 3026 typ := &b.Func.Config.Types 3027 // match: (Lsh8x64 x y) 3028 // cond: shiftIsBounded(v) 3029 // result: (SLW x y) 3030 for { 3031 x := v_0 3032 y := v_1 3033 if !(shiftIsBounded(v)) { 3034 break 3035 } 3036 v.reset(OpS390XSLW) 3037 v.AddArg2(x, y) 3038 return true 3039 } 3040 // match: (Lsh8x64 <t> x y) 3041 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 3042 for { 3043 t := v.Type 3044 x := v_0 3045 y := v_1 3046 v.reset(OpS390XLOCGR) 3047 v.Type = t 3048 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 3049 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 3050 v0.AddArg2(x, y) 3051 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3052 v1.AuxInt = int64ToAuxInt(0) 3053 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 3054 v2.AuxInt = int32ToAuxInt(64) 3055 v2.AddArg(y) 3056 v.AddArg3(v0, v1, v2) 3057 return true 3058 } 3059 } 3060 func rewriteValueS390X_OpLsh8x8(v *Value) bool { 3061 v_1 := v.Args[1] 3062 v_0 := v.Args[0] 3063 b := v.Block 3064 typ := &b.Func.Config.Types 3065 // match: (Lsh8x8 x y) 3066 // cond: shiftIsBounded(v) 3067 // result: (SLW x y) 3068 for { 3069 x := v_0 3070 y := v_1 3071 if !(shiftIsBounded(v)) { 3072 break 3073 } 3074 v.reset(OpS390XSLW) 3075 v.AddArg2(x, y) 3076 return true 3077 } 3078 // match: (Lsh8x8 <t> x y) 3079 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SLW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 3080 for { 3081 t := v.Type 3082 x := v_0 3083 y := v_1 3084 v.reset(OpS390XLOCGR) 3085 v.Type = t 3086 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 3087 v0 := b.NewValue0(v.Pos, OpS390XSLW, t) 3088 v0.AddArg2(x, y) 3089 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3090 v1.AuxInt = int64ToAuxInt(0) 3091 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 3092 v2.AuxInt = int32ToAuxInt(64) 3093 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 3094 v3.AddArg(y) 3095 v2.AddArg(v3) 3096 v.AddArg3(v0, v1, v2) 3097 return true 3098 } 3099 } 3100 func rewriteValueS390X_OpMod16(v *Value) bool { 3101 v_1 := v.Args[1] 3102 v_0 := v.Args[0] 3103 b := v.Block 3104 typ := &b.Func.Config.Types 3105 // match: (Mod16 x y) 3106 // result: (MODW (MOVHreg x) (MOVHreg y)) 3107 for { 3108 x := v_0 3109 y := v_1 3110 v.reset(OpS390XMODW) 3111 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 3112 v0.AddArg(x) 3113 v1 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 3114 v1.AddArg(y) 3115 v.AddArg2(v0, v1) 3116 return true 3117 } 3118 } 3119 func rewriteValueS390X_OpMod16u(v *Value) bool { 3120 v_1 := v.Args[1] 3121 v_0 := v.Args[0] 3122 b := v.Block 3123 typ := &b.Func.Config.Types 3124 // match: (Mod16u x y) 3125 // result: (MODWU (MOVHZreg x) (MOVHZreg y)) 3126 for { 3127 x := v_0 3128 y := v_1 3129 v.reset(OpS390XMODWU) 3130 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 3131 v0.AddArg(x) 3132 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 3133 v1.AddArg(y) 3134 v.AddArg2(v0, v1) 3135 return true 3136 } 3137 } 3138 func rewriteValueS390X_OpMod32(v *Value) bool { 3139 v_1 := v.Args[1] 3140 v_0 := v.Args[0] 3141 b := v.Block 3142 typ := &b.Func.Config.Types 3143 // match: (Mod32 x y) 3144 // result: (MODW (MOVWreg x) y) 3145 for { 3146 x := v_0 3147 y := v_1 3148 v.reset(OpS390XMODW) 3149 v0 := b.NewValue0(v.Pos, OpS390XMOVWreg, typ.Int64) 3150 v0.AddArg(x) 3151 v.AddArg2(v0, y) 3152 return true 3153 } 3154 } 3155 func rewriteValueS390X_OpMod32u(v *Value) bool { 3156 v_1 := v.Args[1] 3157 v_0 := v.Args[0] 3158 b := v.Block 3159 typ := &b.Func.Config.Types 3160 // match: (Mod32u x y) 3161 // result: (MODWU (MOVWZreg x) y) 3162 for { 3163 x := v_0 3164 y := v_1 3165 v.reset(OpS390XMODWU) 3166 v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) 3167 v0.AddArg(x) 3168 v.AddArg2(v0, y) 3169 return true 3170 } 3171 } 3172 func rewriteValueS390X_OpMod64(v *Value) bool { 3173 v_1 := v.Args[1] 3174 v_0 := v.Args[0] 3175 // match: (Mod64 x y) 3176 // result: (MODD x y) 3177 for { 3178 x := v_0 3179 y := v_1 3180 v.reset(OpS390XMODD) 3181 v.AddArg2(x, y) 3182 return true 3183 } 3184 } 3185 func rewriteValueS390X_OpMod8(v *Value) bool { 3186 v_1 := v.Args[1] 3187 v_0 := v.Args[0] 3188 b := v.Block 3189 typ := &b.Func.Config.Types 3190 // match: (Mod8 x y) 3191 // result: (MODW (MOVBreg x) (MOVBreg y)) 3192 for { 3193 x := v_0 3194 y := v_1 3195 v.reset(OpS390XMODW) 3196 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3197 v0.AddArg(x) 3198 v1 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3199 v1.AddArg(y) 3200 v.AddArg2(v0, v1) 3201 return true 3202 } 3203 } 3204 func rewriteValueS390X_OpMod8u(v *Value) bool { 3205 v_1 := v.Args[1] 3206 v_0 := v.Args[0] 3207 b := v.Block 3208 typ := &b.Func.Config.Types 3209 // match: (Mod8u x y) 3210 // result: (MODWU (MOVBZreg x) (MOVBZreg y)) 3211 for { 3212 x := v_0 3213 y := v_1 3214 v.reset(OpS390XMODWU) 3215 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 3216 v0.AddArg(x) 3217 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 3218 v1.AddArg(y) 3219 v.AddArg2(v0, v1) 3220 return true 3221 } 3222 } 3223 func rewriteValueS390X_OpMove(v *Value) bool { 3224 v_2 := v.Args[2] 3225 v_1 := v.Args[1] 3226 v_0 := v.Args[0] 3227 b := v.Block 3228 typ := &b.Func.Config.Types 3229 // match: (Move [0] _ _ mem) 3230 // result: mem 3231 for { 3232 if auxIntToInt64(v.AuxInt) != 0 { 3233 break 3234 } 3235 mem := v_2 3236 v.copyOf(mem) 3237 return true 3238 } 3239 // match: (Move [1] dst src mem) 3240 // result: (MOVBstore dst (MOVBZload src mem) mem) 3241 for { 3242 if auxIntToInt64(v.AuxInt) != 1 { 3243 break 3244 } 3245 dst := v_0 3246 src := v_1 3247 mem := v_2 3248 v.reset(OpS390XMOVBstore) 3249 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8) 3250 v0.AddArg2(src, mem) 3251 v.AddArg3(dst, v0, mem) 3252 return true 3253 } 3254 // match: (Move [2] dst src mem) 3255 // result: (MOVHstore dst (MOVHZload src mem) mem) 3256 for { 3257 if auxIntToInt64(v.AuxInt) != 2 { 3258 break 3259 } 3260 dst := v_0 3261 src := v_1 3262 mem := v_2 3263 v.reset(OpS390XMOVHstore) 3264 v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16) 3265 v0.AddArg2(src, mem) 3266 v.AddArg3(dst, v0, mem) 3267 return true 3268 } 3269 // match: (Move [4] dst src mem) 3270 // result: (MOVWstore dst (MOVWZload src mem) mem) 3271 for { 3272 if auxIntToInt64(v.AuxInt) != 4 { 3273 break 3274 } 3275 dst := v_0 3276 src := v_1 3277 mem := v_2 3278 v.reset(OpS390XMOVWstore) 3279 v0 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32) 3280 v0.AddArg2(src, mem) 3281 v.AddArg3(dst, v0, mem) 3282 return true 3283 } 3284 // match: (Move [8] dst src mem) 3285 // result: (MOVDstore dst (MOVDload src mem) mem) 3286 for { 3287 if auxIntToInt64(v.AuxInt) != 8 { 3288 break 3289 } 3290 dst := v_0 3291 src := v_1 3292 mem := v_2 3293 v.reset(OpS390XMOVDstore) 3294 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3295 v0.AddArg2(src, mem) 3296 v.AddArg3(dst, v0, mem) 3297 return true 3298 } 3299 // match: (Move [16] dst src mem) 3300 // result: (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem)) 3301 for { 3302 if auxIntToInt64(v.AuxInt) != 16 { 3303 break 3304 } 3305 dst := v_0 3306 src := v_1 3307 mem := v_2 3308 v.reset(OpS390XMOVDstore) 3309 v.AuxInt = int32ToAuxInt(8) 3310 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3311 v0.AuxInt = int32ToAuxInt(8) 3312 v0.AddArg2(src, mem) 3313 v1 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem) 3314 v2 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3315 v2.AddArg2(src, mem) 3316 v1.AddArg3(dst, v2, mem) 3317 v.AddArg3(dst, v0, v1) 3318 return true 3319 } 3320 // match: (Move [24] dst src mem) 3321 // result: (MOVDstore [16] dst (MOVDload [16] src mem) (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem))) 3322 for { 3323 if auxIntToInt64(v.AuxInt) != 24 { 3324 break 3325 } 3326 dst := v_0 3327 src := v_1 3328 mem := v_2 3329 v.reset(OpS390XMOVDstore) 3330 v.AuxInt = int32ToAuxInt(16) 3331 v0 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3332 v0.AuxInt = int32ToAuxInt(16) 3333 v0.AddArg2(src, mem) 3334 v1 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem) 3335 v1.AuxInt = int32ToAuxInt(8) 3336 v2 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3337 v2.AuxInt = int32ToAuxInt(8) 3338 v2.AddArg2(src, mem) 3339 v3 := b.NewValue0(v.Pos, OpS390XMOVDstore, types.TypeMem) 3340 v4 := b.NewValue0(v.Pos, OpS390XMOVDload, typ.UInt64) 3341 v4.AddArg2(src, mem) 3342 v3.AddArg3(dst, v4, mem) 3343 v1.AddArg3(dst, v2, v3) 3344 v.AddArg3(dst, v0, v1) 3345 return true 3346 } 3347 // match: (Move [3] dst src mem) 3348 // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHZload src mem) mem)) 3349 for { 3350 if auxIntToInt64(v.AuxInt) != 3 { 3351 break 3352 } 3353 dst := v_0 3354 src := v_1 3355 mem := v_2 3356 v.reset(OpS390XMOVBstore) 3357 v.AuxInt = int32ToAuxInt(2) 3358 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8) 3359 v0.AuxInt = int32ToAuxInt(2) 3360 v0.AddArg2(src, mem) 3361 v1 := b.NewValue0(v.Pos, OpS390XMOVHstore, types.TypeMem) 3362 v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16) 3363 v2.AddArg2(src, mem) 3364 v1.AddArg3(dst, v2, mem) 3365 v.AddArg3(dst, v0, v1) 3366 return true 3367 } 3368 // match: (Move [5] dst src mem) 3369 // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)) 3370 for { 3371 if auxIntToInt64(v.AuxInt) != 5 { 3372 break 3373 } 3374 dst := v_0 3375 src := v_1 3376 mem := v_2 3377 v.reset(OpS390XMOVBstore) 3378 v.AuxInt = int32ToAuxInt(4) 3379 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8) 3380 v0.AuxInt = int32ToAuxInt(4) 3381 v0.AddArg2(src, mem) 3382 v1 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem) 3383 v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32) 3384 v2.AddArg2(src, mem) 3385 v1.AddArg3(dst, v2, mem) 3386 v.AddArg3(dst, v0, v1) 3387 return true 3388 } 3389 // match: (Move [6] dst src mem) 3390 // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)) 3391 for { 3392 if auxIntToInt64(v.AuxInt) != 6 { 3393 break 3394 } 3395 dst := v_0 3396 src := v_1 3397 mem := v_2 3398 v.reset(OpS390XMOVHstore) 3399 v.AuxInt = int32ToAuxInt(4) 3400 v0 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16) 3401 v0.AuxInt = int32ToAuxInt(4) 3402 v0.AddArg2(src, mem) 3403 v1 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem) 3404 v2 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32) 3405 v2.AddArg2(src, mem) 3406 v1.AddArg3(dst, v2, mem) 3407 v.AddArg3(dst, v0, v1) 3408 return true 3409 } 3410 // match: (Move [7] dst src mem) 3411 // result: (MOVBstore [6] dst (MOVBZload [6] src mem) (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))) 3412 for { 3413 if auxIntToInt64(v.AuxInt) != 7 { 3414 break 3415 } 3416 dst := v_0 3417 src := v_1 3418 mem := v_2 3419 v.reset(OpS390XMOVBstore) 3420 v.AuxInt = int32ToAuxInt(6) 3421 v0 := b.NewValue0(v.Pos, OpS390XMOVBZload, typ.UInt8) 3422 v0.AuxInt = int32ToAuxInt(6) 3423 v0.AddArg2(src, mem) 3424 v1 := b.NewValue0(v.Pos, OpS390XMOVHstore, types.TypeMem) 3425 v1.AuxInt = int32ToAuxInt(4) 3426 v2 := b.NewValue0(v.Pos, OpS390XMOVHZload, typ.UInt16) 3427 v2.AuxInt = int32ToAuxInt(4) 3428 v2.AddArg2(src, mem) 3429 v3 := b.NewValue0(v.Pos, OpS390XMOVWstore, types.TypeMem) 3430 v4 := b.NewValue0(v.Pos, OpS390XMOVWZload, typ.UInt32) 3431 v4.AddArg2(src, mem) 3432 v3.AddArg3(dst, v4, mem) 3433 v1.AddArg3(dst, v2, v3) 3434 v.AddArg3(dst, v0, v1) 3435 return true 3436 } 3437 // match: (Move [s] dst src mem) 3438 // cond: s > 0 && s <= 256 && logLargeCopy(v, s) 3439 // result: (MVC [makeValAndOff(int32(s), 0)] dst src mem) 3440 for { 3441 s := auxIntToInt64(v.AuxInt) 3442 dst := v_0 3443 src := v_1 3444 mem := v_2 3445 if !(s > 0 && s <= 256 && logLargeCopy(v, s)) { 3446 break 3447 } 3448 v.reset(OpS390XMVC) 3449 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s), 0)) 3450 v.AddArg3(dst, src, mem) 3451 return true 3452 } 3453 // match: (Move [s] dst src mem) 3454 // cond: s > 256 && s <= 512 && logLargeCopy(v, s) 3455 // result: (MVC [makeValAndOff(int32(s)-256, 256)] dst src (MVC [makeValAndOff(256, 0)] dst src mem)) 3456 for { 3457 s := auxIntToInt64(v.AuxInt) 3458 dst := v_0 3459 src := v_1 3460 mem := v_2 3461 if !(s > 256 && s <= 512 && logLargeCopy(v, s)) { 3462 break 3463 } 3464 v.reset(OpS390XMVC) 3465 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-256, 256)) 3466 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3467 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0)) 3468 v0.AddArg3(dst, src, mem) 3469 v.AddArg3(dst, src, v0) 3470 return true 3471 } 3472 // match: (Move [s] dst src mem) 3473 // cond: s > 512 && s <= 768 && logLargeCopy(v, s) 3474 // result: (MVC [makeValAndOff(int32(s)-512, 512)] dst src (MVC [makeValAndOff(256, 256)] dst src (MVC [makeValAndOff(256, 0)] dst src mem))) 3475 for { 3476 s := auxIntToInt64(v.AuxInt) 3477 dst := v_0 3478 src := v_1 3479 mem := v_2 3480 if !(s > 512 && s <= 768 && logLargeCopy(v, s)) { 3481 break 3482 } 3483 v.reset(OpS390XMVC) 3484 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-512, 512)) 3485 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3486 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 256)) 3487 v1 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3488 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0)) 3489 v1.AddArg3(dst, src, mem) 3490 v0.AddArg3(dst, src, v1) 3491 v.AddArg3(dst, src, v0) 3492 return true 3493 } 3494 // match: (Move [s] dst src mem) 3495 // cond: s > 768 && s <= 1024 && logLargeCopy(v, s) 3496 // 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)))) 3497 for { 3498 s := auxIntToInt64(v.AuxInt) 3499 dst := v_0 3500 src := v_1 3501 mem := v_2 3502 if !(s > 768 && s <= 1024 && logLargeCopy(v, s)) { 3503 break 3504 } 3505 v.reset(OpS390XMVC) 3506 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s)-768, 768)) 3507 v0 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3508 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 512)) 3509 v1 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3510 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 256)) 3511 v2 := b.NewValue0(v.Pos, OpS390XMVC, types.TypeMem) 3512 v2.AuxInt = valAndOffToAuxInt(makeValAndOff(256, 0)) 3513 v2.AddArg3(dst, src, mem) 3514 v1.AddArg3(dst, src, v2) 3515 v0.AddArg3(dst, src, v1) 3516 v.AddArg3(dst, src, v0) 3517 return true 3518 } 3519 // match: (Move [s] dst src mem) 3520 // cond: s > 1024 && logLargeCopy(v, s) 3521 // result: (LoweredMove [s%256] dst src (ADD <src.Type> src (MOVDconst [(s/256)*256])) mem) 3522 for { 3523 s := auxIntToInt64(v.AuxInt) 3524 dst := v_0 3525 src := v_1 3526 mem := v_2 3527 if !(s > 1024 && logLargeCopy(v, s)) { 3528 break 3529 } 3530 v.reset(OpS390XLoweredMove) 3531 v.AuxInt = int64ToAuxInt(s % 256) 3532 v0 := b.NewValue0(v.Pos, OpS390XADD, src.Type) 3533 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3534 v1.AuxInt = int64ToAuxInt((s / 256) * 256) 3535 v0.AddArg2(src, v1) 3536 v.AddArg4(dst, src, v0, mem) 3537 return true 3538 } 3539 return false 3540 } 3541 func rewriteValueS390X_OpNeq16(v *Value) bool { 3542 v_1 := v.Args[1] 3543 v_0 := v.Args[0] 3544 b := v.Block 3545 typ := &b.Func.Config.Types 3546 // match: (Neq16 x y) 3547 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVHreg x) (MOVHreg y))) 3548 for { 3549 x := v_0 3550 y := v_1 3551 v.reset(OpS390XLOCGR) 3552 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3553 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3554 v0.AuxInt = int64ToAuxInt(0) 3555 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3556 v1.AuxInt = int64ToAuxInt(1) 3557 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 3558 v3 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 3559 v3.AddArg(x) 3560 v4 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 3561 v4.AddArg(y) 3562 v2.AddArg2(v3, v4) 3563 v.AddArg3(v0, v1, v2) 3564 return true 3565 } 3566 } 3567 func rewriteValueS390X_OpNeq32(v *Value) bool { 3568 v_1 := v.Args[1] 3569 v_0 := v.Args[0] 3570 b := v.Block 3571 typ := &b.Func.Config.Types 3572 // match: (Neq32 x y) 3573 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW x y)) 3574 for { 3575 x := v_0 3576 y := v_1 3577 v.reset(OpS390XLOCGR) 3578 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3579 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3580 v0.AuxInt = int64ToAuxInt(0) 3581 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3582 v1.AuxInt = int64ToAuxInt(1) 3583 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 3584 v2.AddArg2(x, y) 3585 v.AddArg3(v0, v1, v2) 3586 return true 3587 } 3588 } 3589 func rewriteValueS390X_OpNeq32F(v *Value) bool { 3590 v_1 := v.Args[1] 3591 v_0 := v.Args[0] 3592 b := v.Block 3593 typ := &b.Func.Config.Types 3594 // match: (Neq32F x y) 3595 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMPS x y)) 3596 for { 3597 x := v_0 3598 y := v_1 3599 v.reset(OpS390XLOCGR) 3600 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3601 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3602 v0.AuxInt = int64ToAuxInt(0) 3603 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3604 v1.AuxInt = int64ToAuxInt(1) 3605 v2 := b.NewValue0(v.Pos, OpS390XFCMPS, types.TypeFlags) 3606 v2.AddArg2(x, y) 3607 v.AddArg3(v0, v1, v2) 3608 return true 3609 } 3610 } 3611 func rewriteValueS390X_OpNeq64(v *Value) bool { 3612 v_1 := v.Args[1] 3613 v_0 := v.Args[0] 3614 b := v.Block 3615 typ := &b.Func.Config.Types 3616 // match: (Neq64 x y) 3617 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 3618 for { 3619 x := v_0 3620 y := v_1 3621 v.reset(OpS390XLOCGR) 3622 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3623 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3624 v0.AuxInt = int64ToAuxInt(0) 3625 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3626 v1.AuxInt = int64ToAuxInt(1) 3627 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 3628 v2.AddArg2(x, y) 3629 v.AddArg3(v0, v1, v2) 3630 return true 3631 } 3632 } 3633 func rewriteValueS390X_OpNeq64F(v *Value) bool { 3634 v_1 := v.Args[1] 3635 v_0 := v.Args[0] 3636 b := v.Block 3637 typ := &b.Func.Config.Types 3638 // match: (Neq64F x y) 3639 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (FCMP x y)) 3640 for { 3641 x := v_0 3642 y := v_1 3643 v.reset(OpS390XLOCGR) 3644 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3645 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3646 v0.AuxInt = int64ToAuxInt(0) 3647 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3648 v1.AuxInt = int64ToAuxInt(1) 3649 v2 := b.NewValue0(v.Pos, OpS390XFCMP, types.TypeFlags) 3650 v2.AddArg2(x, y) 3651 v.AddArg3(v0, v1, v2) 3652 return true 3653 } 3654 } 3655 func rewriteValueS390X_OpNeq8(v *Value) bool { 3656 v_1 := v.Args[1] 3657 v_0 := v.Args[0] 3658 b := v.Block 3659 typ := &b.Func.Config.Types 3660 // match: (Neq8 x y) 3661 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 3662 for { 3663 x := v_0 3664 y := v_1 3665 v.reset(OpS390XLOCGR) 3666 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3667 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3668 v0.AuxInt = int64ToAuxInt(0) 3669 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3670 v1.AuxInt = int64ToAuxInt(1) 3671 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 3672 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3673 v3.AddArg(x) 3674 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3675 v4.AddArg(y) 3676 v2.AddArg2(v3, v4) 3677 v.AddArg3(v0, v1, v2) 3678 return true 3679 } 3680 } 3681 func rewriteValueS390X_OpNeqB(v *Value) bool { 3682 v_1 := v.Args[1] 3683 v_0 := v.Args[0] 3684 b := v.Block 3685 typ := &b.Func.Config.Types 3686 // match: (NeqB x y) 3687 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMPW (MOVBreg x) (MOVBreg y))) 3688 for { 3689 x := v_0 3690 y := v_1 3691 v.reset(OpS390XLOCGR) 3692 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3693 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3694 v0.AuxInt = int64ToAuxInt(0) 3695 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3696 v1.AuxInt = int64ToAuxInt(1) 3697 v2 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 3698 v3 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3699 v3.AddArg(x) 3700 v4 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 3701 v4.AddArg(y) 3702 v2.AddArg2(v3, v4) 3703 v.AddArg3(v0, v1, v2) 3704 return true 3705 } 3706 } 3707 func rewriteValueS390X_OpNeqPtr(v *Value) bool { 3708 v_1 := v.Args[1] 3709 v_0 := v.Args[0] 3710 b := v.Block 3711 typ := &b.Func.Config.Types 3712 // match: (NeqPtr x y) 3713 // result: (LOCGR {s390x.NotEqual} (MOVDconst [0]) (MOVDconst [1]) (CMP x y)) 3714 for { 3715 x := v_0 3716 y := v_1 3717 v.reset(OpS390XLOCGR) 3718 v.Aux = s390xCCMaskToAux(s390x.NotEqual) 3719 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3720 v0.AuxInt = int64ToAuxInt(0) 3721 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3722 v1.AuxInt = int64ToAuxInt(1) 3723 v2 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 3724 v2.AddArg2(x, y) 3725 v.AddArg3(v0, v1, v2) 3726 return true 3727 } 3728 } 3729 func rewriteValueS390X_OpNot(v *Value) bool { 3730 v_0 := v.Args[0] 3731 // match: (Not x) 3732 // result: (XORWconst [1] x) 3733 for { 3734 x := v_0 3735 v.reset(OpS390XXORWconst) 3736 v.AuxInt = int32ToAuxInt(1) 3737 v.AddArg(x) 3738 return true 3739 } 3740 } 3741 func rewriteValueS390X_OpOffPtr(v *Value) bool { 3742 v_0 := v.Args[0] 3743 b := v.Block 3744 typ := &b.Func.Config.Types 3745 // match: (OffPtr [off] ptr:(SP)) 3746 // result: (MOVDaddr [int32(off)] ptr) 3747 for { 3748 off := auxIntToInt64(v.AuxInt) 3749 ptr := v_0 3750 if ptr.Op != OpSP { 3751 break 3752 } 3753 v.reset(OpS390XMOVDaddr) 3754 v.AuxInt = int32ToAuxInt(int32(off)) 3755 v.AddArg(ptr) 3756 return true 3757 } 3758 // match: (OffPtr [off] ptr) 3759 // cond: is32Bit(off) 3760 // result: (ADDconst [int32(off)] ptr) 3761 for { 3762 off := auxIntToInt64(v.AuxInt) 3763 ptr := v_0 3764 if !(is32Bit(off)) { 3765 break 3766 } 3767 v.reset(OpS390XADDconst) 3768 v.AuxInt = int32ToAuxInt(int32(off)) 3769 v.AddArg(ptr) 3770 return true 3771 } 3772 // match: (OffPtr [off] ptr) 3773 // result: (ADD (MOVDconst [off]) ptr) 3774 for { 3775 off := auxIntToInt64(v.AuxInt) 3776 ptr := v_0 3777 v.reset(OpS390XADD) 3778 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3779 v0.AuxInt = int64ToAuxInt(off) 3780 v.AddArg2(v0, ptr) 3781 return true 3782 } 3783 } 3784 func rewriteValueS390X_OpPanicBounds(v *Value) bool { 3785 v_2 := v.Args[2] 3786 v_1 := v.Args[1] 3787 v_0 := v.Args[0] 3788 // match: (PanicBounds [kind] x y mem) 3789 // cond: boundsABI(kind) == 0 3790 // result: (LoweredPanicBoundsA [kind] x y mem) 3791 for { 3792 kind := auxIntToInt64(v.AuxInt) 3793 x := v_0 3794 y := v_1 3795 mem := v_2 3796 if !(boundsABI(kind) == 0) { 3797 break 3798 } 3799 v.reset(OpS390XLoweredPanicBoundsA) 3800 v.AuxInt = int64ToAuxInt(kind) 3801 v.AddArg3(x, y, mem) 3802 return true 3803 } 3804 // match: (PanicBounds [kind] x y mem) 3805 // cond: boundsABI(kind) == 1 3806 // result: (LoweredPanicBoundsB [kind] x y mem) 3807 for { 3808 kind := auxIntToInt64(v.AuxInt) 3809 x := v_0 3810 y := v_1 3811 mem := v_2 3812 if !(boundsABI(kind) == 1) { 3813 break 3814 } 3815 v.reset(OpS390XLoweredPanicBoundsB) 3816 v.AuxInt = int64ToAuxInt(kind) 3817 v.AddArg3(x, y, mem) 3818 return true 3819 } 3820 // match: (PanicBounds [kind] x y mem) 3821 // cond: boundsABI(kind) == 2 3822 // result: (LoweredPanicBoundsC [kind] x y mem) 3823 for { 3824 kind := auxIntToInt64(v.AuxInt) 3825 x := v_0 3826 y := v_1 3827 mem := v_2 3828 if !(boundsABI(kind) == 2) { 3829 break 3830 } 3831 v.reset(OpS390XLoweredPanicBoundsC) 3832 v.AuxInt = int64ToAuxInt(kind) 3833 v.AddArg3(x, y, mem) 3834 return true 3835 } 3836 return false 3837 } 3838 func rewriteValueS390X_OpPopCount16(v *Value) bool { 3839 v_0 := v.Args[0] 3840 b := v.Block 3841 typ := &b.Func.Config.Types 3842 // match: (PopCount16 x) 3843 // result: (MOVBZreg (SumBytes2 (POPCNT <typ.UInt16> x))) 3844 for { 3845 x := v_0 3846 v.reset(OpS390XMOVBZreg) 3847 v0 := b.NewValue0(v.Pos, OpS390XSumBytes2, typ.UInt8) 3848 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt16) 3849 v1.AddArg(x) 3850 v0.AddArg(v1) 3851 v.AddArg(v0) 3852 return true 3853 } 3854 } 3855 func rewriteValueS390X_OpPopCount32(v *Value) bool { 3856 v_0 := v.Args[0] 3857 b := v.Block 3858 typ := &b.Func.Config.Types 3859 // match: (PopCount32 x) 3860 // result: (MOVBZreg (SumBytes4 (POPCNT <typ.UInt32> x))) 3861 for { 3862 x := v_0 3863 v.reset(OpS390XMOVBZreg) 3864 v0 := b.NewValue0(v.Pos, OpS390XSumBytes4, typ.UInt8) 3865 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt32) 3866 v1.AddArg(x) 3867 v0.AddArg(v1) 3868 v.AddArg(v0) 3869 return true 3870 } 3871 } 3872 func rewriteValueS390X_OpPopCount64(v *Value) bool { 3873 v_0 := v.Args[0] 3874 b := v.Block 3875 typ := &b.Func.Config.Types 3876 // match: (PopCount64 x) 3877 // result: (MOVBZreg (SumBytes8 (POPCNT <typ.UInt64> x))) 3878 for { 3879 x := v_0 3880 v.reset(OpS390XMOVBZreg) 3881 v0 := b.NewValue0(v.Pos, OpS390XSumBytes8, typ.UInt8) 3882 v1 := b.NewValue0(v.Pos, OpS390XPOPCNT, typ.UInt64) 3883 v1.AddArg(x) 3884 v0.AddArg(v1) 3885 v.AddArg(v0) 3886 return true 3887 } 3888 } 3889 func rewriteValueS390X_OpPopCount8(v *Value) bool { 3890 v_0 := v.Args[0] 3891 b := v.Block 3892 typ := &b.Func.Config.Types 3893 // match: (PopCount8 x) 3894 // result: (POPCNT (MOVBZreg x)) 3895 for { 3896 x := v_0 3897 v.reset(OpS390XPOPCNT) 3898 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 3899 v0.AddArg(x) 3900 v.AddArg(v0) 3901 return true 3902 } 3903 } 3904 func rewriteValueS390X_OpRotateLeft16(v *Value) bool { 3905 v_1 := v.Args[1] 3906 v_0 := v.Args[0] 3907 b := v.Block 3908 typ := &b.Func.Config.Types 3909 // match: (RotateLeft16 <t> x (MOVDconst [c])) 3910 // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15]))) 3911 for { 3912 t := v.Type 3913 x := v_0 3914 if v_1.Op != OpS390XMOVDconst { 3915 break 3916 } 3917 c := auxIntToInt64(v_1.AuxInt) 3918 v.reset(OpOr16) 3919 v0 := b.NewValue0(v.Pos, OpLsh16x64, t) 3920 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3921 v1.AuxInt = int64ToAuxInt(c & 15) 3922 v0.AddArg2(x, v1) 3923 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t) 3924 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3925 v3.AuxInt = int64ToAuxInt(-c & 15) 3926 v2.AddArg2(x, v3) 3927 v.AddArg2(v0, v2) 3928 return true 3929 } 3930 return false 3931 } 3932 func rewriteValueS390X_OpRotateLeft8(v *Value) bool { 3933 v_1 := v.Args[1] 3934 v_0 := v.Args[0] 3935 b := v.Block 3936 typ := &b.Func.Config.Types 3937 // match: (RotateLeft8 <t> x (MOVDconst [c])) 3938 // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7]))) 3939 for { 3940 t := v.Type 3941 x := v_0 3942 if v_1.Op != OpS390XMOVDconst { 3943 break 3944 } 3945 c := auxIntToInt64(v_1.AuxInt) 3946 v.reset(OpOr8) 3947 v0 := b.NewValue0(v.Pos, OpLsh8x64, t) 3948 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3949 v1.AuxInt = int64ToAuxInt(c & 7) 3950 v0.AddArg2(x, v1) 3951 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t) 3952 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 3953 v3.AuxInt = int64ToAuxInt(-c & 7) 3954 v2.AddArg2(x, v3) 3955 v.AddArg2(v0, v2) 3956 return true 3957 } 3958 return false 3959 } 3960 func rewriteValueS390X_OpRound(v *Value) bool { 3961 v_0 := v.Args[0] 3962 // match: (Round x) 3963 // result: (FIDBR [1] x) 3964 for { 3965 x := v_0 3966 v.reset(OpS390XFIDBR) 3967 v.AuxInt = int8ToAuxInt(1) 3968 v.AddArg(x) 3969 return true 3970 } 3971 } 3972 func rewriteValueS390X_OpRoundToEven(v *Value) bool { 3973 v_0 := v.Args[0] 3974 // match: (RoundToEven x) 3975 // result: (FIDBR [4] x) 3976 for { 3977 x := v_0 3978 v.reset(OpS390XFIDBR) 3979 v.AuxInt = int8ToAuxInt(4) 3980 v.AddArg(x) 3981 return true 3982 } 3983 } 3984 func rewriteValueS390X_OpRsh16Ux16(v *Value) bool { 3985 v_1 := v.Args[1] 3986 v_0 := v.Args[0] 3987 b := v.Block 3988 typ := &b.Func.Config.Types 3989 // match: (Rsh16Ux16 x y) 3990 // cond: shiftIsBounded(v) 3991 // result: (SRW (MOVHZreg x) y) 3992 for { 3993 x := v_0 3994 y := v_1 3995 if !(shiftIsBounded(v)) { 3996 break 3997 } 3998 v.reset(OpS390XSRW) 3999 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4000 v0.AddArg(x) 4001 v.AddArg2(v0, y) 4002 return true 4003 } 4004 // match: (Rsh16Ux16 <t> x y) 4005 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 4006 for { 4007 t := v.Type 4008 x := v_0 4009 y := v_1 4010 v.reset(OpS390XLOCGR) 4011 v.Type = t 4012 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4013 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4014 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4015 v1.AddArg(x) 4016 v0.AddArg2(v1, y) 4017 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4018 v2.AuxInt = int64ToAuxInt(0) 4019 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4020 v3.AuxInt = int32ToAuxInt(64) 4021 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4022 v4.AddArg(y) 4023 v3.AddArg(v4) 4024 v.AddArg3(v0, v2, v3) 4025 return true 4026 } 4027 } 4028 func rewriteValueS390X_OpRsh16Ux32(v *Value) bool { 4029 v_1 := v.Args[1] 4030 v_0 := v.Args[0] 4031 b := v.Block 4032 typ := &b.Func.Config.Types 4033 // match: (Rsh16Ux32 x y) 4034 // cond: shiftIsBounded(v) 4035 // result: (SRW (MOVHZreg x) y) 4036 for { 4037 x := v_0 4038 y := v_1 4039 if !(shiftIsBounded(v)) { 4040 break 4041 } 4042 v.reset(OpS390XSRW) 4043 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4044 v0.AddArg(x) 4045 v.AddArg2(v0, y) 4046 return true 4047 } 4048 // match: (Rsh16Ux32 <t> x y) 4049 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [64])) 4050 for { 4051 t := v.Type 4052 x := v_0 4053 y := v_1 4054 v.reset(OpS390XLOCGR) 4055 v.Type = t 4056 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4057 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4058 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4059 v1.AddArg(x) 4060 v0.AddArg2(v1, y) 4061 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4062 v2.AuxInt = int64ToAuxInt(0) 4063 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4064 v3.AuxInt = int32ToAuxInt(64) 4065 v3.AddArg(y) 4066 v.AddArg3(v0, v2, v3) 4067 return true 4068 } 4069 } 4070 func rewriteValueS390X_OpRsh16Ux64(v *Value) bool { 4071 v_1 := v.Args[1] 4072 v_0 := v.Args[0] 4073 b := v.Block 4074 typ := &b.Func.Config.Types 4075 // match: (Rsh16Ux64 x y) 4076 // cond: shiftIsBounded(v) 4077 // result: (SRW (MOVHZreg x) y) 4078 for { 4079 x := v_0 4080 y := v_1 4081 if !(shiftIsBounded(v)) { 4082 break 4083 } 4084 v.reset(OpS390XSRW) 4085 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4086 v0.AddArg(x) 4087 v.AddArg2(v0, y) 4088 return true 4089 } 4090 // match: (Rsh16Ux64 <t> x y) 4091 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [64])) 4092 for { 4093 t := v.Type 4094 x := v_0 4095 y := v_1 4096 v.reset(OpS390XLOCGR) 4097 v.Type = t 4098 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4099 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4100 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4101 v1.AddArg(x) 4102 v0.AddArg2(v1, y) 4103 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4104 v2.AuxInt = int64ToAuxInt(0) 4105 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4106 v3.AuxInt = int32ToAuxInt(64) 4107 v3.AddArg(y) 4108 v.AddArg3(v0, v2, v3) 4109 return true 4110 } 4111 } 4112 func rewriteValueS390X_OpRsh16Ux8(v *Value) bool { 4113 v_1 := v.Args[1] 4114 v_0 := v.Args[0] 4115 b := v.Block 4116 typ := &b.Func.Config.Types 4117 // match: (Rsh16Ux8 x y) 4118 // cond: shiftIsBounded(v) 4119 // result: (SRW (MOVHZreg x) y) 4120 for { 4121 x := v_0 4122 y := v_1 4123 if !(shiftIsBounded(v)) { 4124 break 4125 } 4126 v.reset(OpS390XSRW) 4127 v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4128 v0.AddArg(x) 4129 v.AddArg2(v0, y) 4130 return true 4131 } 4132 // match: (Rsh16Ux8 <t> x y) 4133 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 4134 for { 4135 t := v.Type 4136 x := v_0 4137 y := v_1 4138 v.reset(OpS390XLOCGR) 4139 v.Type = t 4140 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4141 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4142 v1 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4143 v1.AddArg(x) 4144 v0.AddArg2(v1, y) 4145 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4146 v2.AuxInt = int64ToAuxInt(0) 4147 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4148 v3.AuxInt = int32ToAuxInt(64) 4149 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4150 v4.AddArg(y) 4151 v3.AddArg(v4) 4152 v.AddArg3(v0, v2, v3) 4153 return true 4154 } 4155 } 4156 func rewriteValueS390X_OpRsh16x16(v *Value) bool { 4157 v_1 := v.Args[1] 4158 v_0 := v.Args[0] 4159 b := v.Block 4160 typ := &b.Func.Config.Types 4161 // match: (Rsh16x16 x y) 4162 // cond: shiftIsBounded(v) 4163 // result: (SRAW (MOVHreg x) y) 4164 for { 4165 x := v_0 4166 y := v_1 4167 if !(shiftIsBounded(v)) { 4168 break 4169 } 4170 v.reset(OpS390XSRAW) 4171 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4172 v0.AddArg(x) 4173 v.AddArg2(v0, y) 4174 return true 4175 } 4176 // match: (Rsh16x16 x y) 4177 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64]))) 4178 for { 4179 x := v_0 4180 y := v_1 4181 v.reset(OpS390XSRAW) 4182 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4183 v0.AddArg(x) 4184 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4185 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4186 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4187 v2.AuxInt = int64ToAuxInt(63) 4188 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4189 v3.AuxInt = int32ToAuxInt(64) 4190 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4191 v4.AddArg(y) 4192 v3.AddArg(v4) 4193 v1.AddArg3(y, v2, v3) 4194 v.AddArg2(v0, v1) 4195 return true 4196 } 4197 } 4198 func rewriteValueS390X_OpRsh16x32(v *Value) bool { 4199 v_1 := v.Args[1] 4200 v_0 := v.Args[0] 4201 b := v.Block 4202 typ := &b.Func.Config.Types 4203 // match: (Rsh16x32 x y) 4204 // cond: shiftIsBounded(v) 4205 // result: (SRAW (MOVHreg x) y) 4206 for { 4207 x := v_0 4208 y := v_1 4209 if !(shiftIsBounded(v)) { 4210 break 4211 } 4212 v.reset(OpS390XSRAW) 4213 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4214 v0.AddArg(x) 4215 v.AddArg2(v0, y) 4216 return true 4217 } 4218 // match: (Rsh16x32 x y) 4219 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64]))) 4220 for { 4221 x := v_0 4222 y := v_1 4223 v.reset(OpS390XSRAW) 4224 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4225 v0.AddArg(x) 4226 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4227 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4228 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4229 v2.AuxInt = int64ToAuxInt(63) 4230 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4231 v3.AuxInt = int32ToAuxInt(64) 4232 v3.AddArg(y) 4233 v1.AddArg3(y, v2, v3) 4234 v.AddArg2(v0, v1) 4235 return true 4236 } 4237 } 4238 func rewriteValueS390X_OpRsh16x64(v *Value) bool { 4239 v_1 := v.Args[1] 4240 v_0 := v.Args[0] 4241 b := v.Block 4242 typ := &b.Func.Config.Types 4243 // match: (Rsh16x64 x y) 4244 // cond: shiftIsBounded(v) 4245 // result: (SRAW (MOVHreg x) y) 4246 for { 4247 x := v_0 4248 y := v_1 4249 if !(shiftIsBounded(v)) { 4250 break 4251 } 4252 v.reset(OpS390XSRAW) 4253 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4254 v0.AddArg(x) 4255 v.AddArg2(v0, y) 4256 return true 4257 } 4258 // match: (Rsh16x64 x y) 4259 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64]))) 4260 for { 4261 x := v_0 4262 y := v_1 4263 v.reset(OpS390XSRAW) 4264 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4265 v0.AddArg(x) 4266 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4267 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4268 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4269 v2.AuxInt = int64ToAuxInt(63) 4270 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4271 v3.AuxInt = int32ToAuxInt(64) 4272 v3.AddArg(y) 4273 v1.AddArg3(y, v2, v3) 4274 v.AddArg2(v0, v1) 4275 return true 4276 } 4277 } 4278 func rewriteValueS390X_OpRsh16x8(v *Value) bool { 4279 v_1 := v.Args[1] 4280 v_0 := v.Args[0] 4281 b := v.Block 4282 typ := &b.Func.Config.Types 4283 // match: (Rsh16x8 x y) 4284 // cond: shiftIsBounded(v) 4285 // result: (SRAW (MOVHreg x) y) 4286 for { 4287 x := v_0 4288 y := v_1 4289 if !(shiftIsBounded(v)) { 4290 break 4291 } 4292 v.reset(OpS390XSRAW) 4293 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4294 v0.AddArg(x) 4295 v.AddArg2(v0, y) 4296 return true 4297 } 4298 // match: (Rsh16x8 x y) 4299 // result: (SRAW (MOVHreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64]))) 4300 for { 4301 x := v_0 4302 y := v_1 4303 v.reset(OpS390XSRAW) 4304 v0 := b.NewValue0(v.Pos, OpS390XMOVHreg, typ.Int64) 4305 v0.AddArg(x) 4306 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4307 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4308 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4309 v2.AuxInt = int64ToAuxInt(63) 4310 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4311 v3.AuxInt = int32ToAuxInt(64) 4312 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4313 v4.AddArg(y) 4314 v3.AddArg(v4) 4315 v1.AddArg3(y, v2, v3) 4316 v.AddArg2(v0, v1) 4317 return true 4318 } 4319 } 4320 func rewriteValueS390X_OpRsh32Ux16(v *Value) bool { 4321 v_1 := v.Args[1] 4322 v_0 := v.Args[0] 4323 b := v.Block 4324 typ := &b.Func.Config.Types 4325 // match: (Rsh32Ux16 x y) 4326 // cond: shiftIsBounded(v) 4327 // result: (SRW x y) 4328 for { 4329 x := v_0 4330 y := v_1 4331 if !(shiftIsBounded(v)) { 4332 break 4333 } 4334 v.reset(OpS390XSRW) 4335 v.AddArg2(x, y) 4336 return true 4337 } 4338 // match: (Rsh32Ux16 <t> x y) 4339 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 4340 for { 4341 t := v.Type 4342 x := v_0 4343 y := v_1 4344 v.reset(OpS390XLOCGR) 4345 v.Type = t 4346 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4347 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4348 v0.AddArg2(x, y) 4349 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4350 v1.AuxInt = int64ToAuxInt(0) 4351 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4352 v2.AuxInt = int32ToAuxInt(64) 4353 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4354 v3.AddArg(y) 4355 v2.AddArg(v3) 4356 v.AddArg3(v0, v1, v2) 4357 return true 4358 } 4359 } 4360 func rewriteValueS390X_OpRsh32Ux32(v *Value) bool { 4361 v_1 := v.Args[1] 4362 v_0 := v.Args[0] 4363 b := v.Block 4364 typ := &b.Func.Config.Types 4365 // match: (Rsh32Ux32 x y) 4366 // cond: shiftIsBounded(v) 4367 // result: (SRW x y) 4368 for { 4369 x := v_0 4370 y := v_1 4371 if !(shiftIsBounded(v)) { 4372 break 4373 } 4374 v.reset(OpS390XSRW) 4375 v.AddArg2(x, y) 4376 return true 4377 } 4378 // match: (Rsh32Ux32 <t> x y) 4379 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 4380 for { 4381 t := v.Type 4382 x := v_0 4383 y := v_1 4384 v.reset(OpS390XLOCGR) 4385 v.Type = t 4386 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4387 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4388 v0.AddArg2(x, y) 4389 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4390 v1.AuxInt = int64ToAuxInt(0) 4391 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4392 v2.AuxInt = int32ToAuxInt(64) 4393 v2.AddArg(y) 4394 v.AddArg3(v0, v1, v2) 4395 return true 4396 } 4397 } 4398 func rewriteValueS390X_OpRsh32Ux64(v *Value) bool { 4399 v_1 := v.Args[1] 4400 v_0 := v.Args[0] 4401 b := v.Block 4402 typ := &b.Func.Config.Types 4403 // match: (Rsh32Ux64 x y) 4404 // cond: shiftIsBounded(v) 4405 // result: (SRW x y) 4406 for { 4407 x := v_0 4408 y := v_1 4409 if !(shiftIsBounded(v)) { 4410 break 4411 } 4412 v.reset(OpS390XSRW) 4413 v.AddArg2(x, y) 4414 return true 4415 } 4416 // match: (Rsh32Ux64 <t> x y) 4417 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 4418 for { 4419 t := v.Type 4420 x := v_0 4421 y := v_1 4422 v.reset(OpS390XLOCGR) 4423 v.Type = t 4424 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4425 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4426 v0.AddArg2(x, y) 4427 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4428 v1.AuxInt = int64ToAuxInt(0) 4429 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4430 v2.AuxInt = int32ToAuxInt(64) 4431 v2.AddArg(y) 4432 v.AddArg3(v0, v1, v2) 4433 return true 4434 } 4435 } 4436 func rewriteValueS390X_OpRsh32Ux8(v *Value) bool { 4437 v_1 := v.Args[1] 4438 v_0 := v.Args[0] 4439 b := v.Block 4440 typ := &b.Func.Config.Types 4441 // match: (Rsh32Ux8 x y) 4442 // cond: shiftIsBounded(v) 4443 // result: (SRW x y) 4444 for { 4445 x := v_0 4446 y := v_1 4447 if !(shiftIsBounded(v)) { 4448 break 4449 } 4450 v.reset(OpS390XSRW) 4451 v.AddArg2(x, y) 4452 return true 4453 } 4454 // match: (Rsh32Ux8 <t> x y) 4455 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 4456 for { 4457 t := v.Type 4458 x := v_0 4459 y := v_1 4460 v.reset(OpS390XLOCGR) 4461 v.Type = t 4462 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4463 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4464 v0.AddArg2(x, y) 4465 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4466 v1.AuxInt = int64ToAuxInt(0) 4467 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4468 v2.AuxInt = int32ToAuxInt(64) 4469 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4470 v3.AddArg(y) 4471 v2.AddArg(v3) 4472 v.AddArg3(v0, v1, v2) 4473 return true 4474 } 4475 } 4476 func rewriteValueS390X_OpRsh32x16(v *Value) bool { 4477 v_1 := v.Args[1] 4478 v_0 := v.Args[0] 4479 b := v.Block 4480 typ := &b.Func.Config.Types 4481 // match: (Rsh32x16 x y) 4482 // cond: shiftIsBounded(v) 4483 // result: (SRAW x y) 4484 for { 4485 x := v_0 4486 y := v_1 4487 if !(shiftIsBounded(v)) { 4488 break 4489 } 4490 v.reset(OpS390XSRAW) 4491 v.AddArg2(x, y) 4492 return true 4493 } 4494 // match: (Rsh32x16 x y) 4495 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64]))) 4496 for { 4497 x := v_0 4498 y := v_1 4499 v.reset(OpS390XSRAW) 4500 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4501 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4502 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4503 v1.AuxInt = int64ToAuxInt(63) 4504 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4505 v2.AuxInt = int32ToAuxInt(64) 4506 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4507 v3.AddArg(y) 4508 v2.AddArg(v3) 4509 v0.AddArg3(y, v1, v2) 4510 v.AddArg2(x, v0) 4511 return true 4512 } 4513 } 4514 func rewriteValueS390X_OpRsh32x32(v *Value) bool { 4515 v_1 := v.Args[1] 4516 v_0 := v.Args[0] 4517 b := v.Block 4518 // match: (Rsh32x32 x y) 4519 // cond: shiftIsBounded(v) 4520 // result: (SRAW x y) 4521 for { 4522 x := v_0 4523 y := v_1 4524 if !(shiftIsBounded(v)) { 4525 break 4526 } 4527 v.reset(OpS390XSRAW) 4528 v.AddArg2(x, y) 4529 return true 4530 } 4531 // match: (Rsh32x32 x y) 4532 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64]))) 4533 for { 4534 x := v_0 4535 y := v_1 4536 v.reset(OpS390XSRAW) 4537 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4538 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4539 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4540 v1.AuxInt = int64ToAuxInt(63) 4541 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4542 v2.AuxInt = int32ToAuxInt(64) 4543 v2.AddArg(y) 4544 v0.AddArg3(y, v1, v2) 4545 v.AddArg2(x, v0) 4546 return true 4547 } 4548 } 4549 func rewriteValueS390X_OpRsh32x64(v *Value) bool { 4550 v_1 := v.Args[1] 4551 v_0 := v.Args[0] 4552 b := v.Block 4553 // match: (Rsh32x64 x y) 4554 // cond: shiftIsBounded(v) 4555 // result: (SRAW x y) 4556 for { 4557 x := v_0 4558 y := v_1 4559 if !(shiftIsBounded(v)) { 4560 break 4561 } 4562 v.reset(OpS390XSRAW) 4563 v.AddArg2(x, y) 4564 return true 4565 } 4566 // match: (Rsh32x64 x y) 4567 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64]))) 4568 for { 4569 x := v_0 4570 y := v_1 4571 v.reset(OpS390XSRAW) 4572 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4573 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4574 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4575 v1.AuxInt = int64ToAuxInt(63) 4576 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4577 v2.AuxInt = int32ToAuxInt(64) 4578 v2.AddArg(y) 4579 v0.AddArg3(y, v1, v2) 4580 v.AddArg2(x, v0) 4581 return true 4582 } 4583 } 4584 func rewriteValueS390X_OpRsh32x8(v *Value) bool { 4585 v_1 := v.Args[1] 4586 v_0 := v.Args[0] 4587 b := v.Block 4588 typ := &b.Func.Config.Types 4589 // match: (Rsh32x8 x y) 4590 // cond: shiftIsBounded(v) 4591 // result: (SRAW x y) 4592 for { 4593 x := v_0 4594 y := v_1 4595 if !(shiftIsBounded(v)) { 4596 break 4597 } 4598 v.reset(OpS390XSRAW) 4599 v.AddArg2(x, y) 4600 return true 4601 } 4602 // match: (Rsh32x8 x y) 4603 // result: (SRAW x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64]))) 4604 for { 4605 x := v_0 4606 y := v_1 4607 v.reset(OpS390XSRAW) 4608 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4609 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4610 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4611 v1.AuxInt = int64ToAuxInt(63) 4612 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4613 v2.AuxInt = int32ToAuxInt(64) 4614 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4615 v3.AddArg(y) 4616 v2.AddArg(v3) 4617 v0.AddArg3(y, v1, v2) 4618 v.AddArg2(x, v0) 4619 return true 4620 } 4621 } 4622 func rewriteValueS390X_OpRsh64Ux16(v *Value) bool { 4623 v_1 := v.Args[1] 4624 v_0 := v.Args[0] 4625 b := v.Block 4626 typ := &b.Func.Config.Types 4627 // match: (Rsh64Ux16 x y) 4628 // cond: shiftIsBounded(v) 4629 // result: (SRD x y) 4630 for { 4631 x := v_0 4632 y := v_1 4633 if !(shiftIsBounded(v)) { 4634 break 4635 } 4636 v.reset(OpS390XSRD) 4637 v.AddArg2(x, y) 4638 return true 4639 } 4640 // match: (Rsh64Ux16 <t> x y) 4641 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 4642 for { 4643 t := v.Type 4644 x := v_0 4645 y := v_1 4646 v.reset(OpS390XLOCGR) 4647 v.Type = t 4648 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4649 v0 := b.NewValue0(v.Pos, OpS390XSRD, t) 4650 v0.AddArg2(x, y) 4651 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4652 v1.AuxInt = int64ToAuxInt(0) 4653 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4654 v2.AuxInt = int32ToAuxInt(64) 4655 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4656 v3.AddArg(y) 4657 v2.AddArg(v3) 4658 v.AddArg3(v0, v1, v2) 4659 return true 4660 } 4661 } 4662 func rewriteValueS390X_OpRsh64Ux32(v *Value) bool { 4663 v_1 := v.Args[1] 4664 v_0 := v.Args[0] 4665 b := v.Block 4666 typ := &b.Func.Config.Types 4667 // match: (Rsh64Ux32 x y) 4668 // cond: shiftIsBounded(v) 4669 // result: (SRD x y) 4670 for { 4671 x := v_0 4672 y := v_1 4673 if !(shiftIsBounded(v)) { 4674 break 4675 } 4676 v.reset(OpS390XSRD) 4677 v.AddArg2(x, y) 4678 return true 4679 } 4680 // match: (Rsh64Ux32 <t> x y) 4681 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 4682 for { 4683 t := v.Type 4684 x := v_0 4685 y := v_1 4686 v.reset(OpS390XLOCGR) 4687 v.Type = t 4688 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4689 v0 := b.NewValue0(v.Pos, OpS390XSRD, t) 4690 v0.AddArg2(x, y) 4691 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4692 v1.AuxInt = int64ToAuxInt(0) 4693 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4694 v2.AuxInt = int32ToAuxInt(64) 4695 v2.AddArg(y) 4696 v.AddArg3(v0, v1, v2) 4697 return true 4698 } 4699 } 4700 func rewriteValueS390X_OpRsh64Ux64(v *Value) bool { 4701 v_1 := v.Args[1] 4702 v_0 := v.Args[0] 4703 b := v.Block 4704 typ := &b.Func.Config.Types 4705 // match: (Rsh64Ux64 x y) 4706 // cond: shiftIsBounded(v) 4707 // result: (SRD x y) 4708 for { 4709 x := v_0 4710 y := v_1 4711 if !(shiftIsBounded(v)) { 4712 break 4713 } 4714 v.reset(OpS390XSRD) 4715 v.AddArg2(x, y) 4716 return true 4717 } 4718 // match: (Rsh64Ux64 <t> x y) 4719 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 4720 for { 4721 t := v.Type 4722 x := v_0 4723 y := v_1 4724 v.reset(OpS390XLOCGR) 4725 v.Type = t 4726 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4727 v0 := b.NewValue0(v.Pos, OpS390XSRD, t) 4728 v0.AddArg2(x, y) 4729 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4730 v1.AuxInt = int64ToAuxInt(0) 4731 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4732 v2.AuxInt = int32ToAuxInt(64) 4733 v2.AddArg(y) 4734 v.AddArg3(v0, v1, v2) 4735 return true 4736 } 4737 } 4738 func rewriteValueS390X_OpRsh64Ux8(v *Value) bool { 4739 v_1 := v.Args[1] 4740 v_0 := v.Args[0] 4741 b := v.Block 4742 typ := &b.Func.Config.Types 4743 // match: (Rsh64Ux8 x y) 4744 // cond: shiftIsBounded(v) 4745 // result: (SRD x y) 4746 for { 4747 x := v_0 4748 y := v_1 4749 if !(shiftIsBounded(v)) { 4750 break 4751 } 4752 v.reset(OpS390XSRD) 4753 v.AddArg2(x, y) 4754 return true 4755 } 4756 // match: (Rsh64Ux8 <t> x y) 4757 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRD <t> x y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 4758 for { 4759 t := v.Type 4760 x := v_0 4761 y := v_1 4762 v.reset(OpS390XLOCGR) 4763 v.Type = t 4764 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4765 v0 := b.NewValue0(v.Pos, OpS390XSRD, t) 4766 v0.AddArg2(x, y) 4767 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4768 v1.AuxInt = int64ToAuxInt(0) 4769 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4770 v2.AuxInt = int32ToAuxInt(64) 4771 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4772 v3.AddArg(y) 4773 v2.AddArg(v3) 4774 v.AddArg3(v0, v1, v2) 4775 return true 4776 } 4777 } 4778 func rewriteValueS390X_OpRsh64x16(v *Value) bool { 4779 v_1 := v.Args[1] 4780 v_0 := v.Args[0] 4781 b := v.Block 4782 typ := &b.Func.Config.Types 4783 // match: (Rsh64x16 x y) 4784 // cond: shiftIsBounded(v) 4785 // result: (SRAD x y) 4786 for { 4787 x := v_0 4788 y := v_1 4789 if !(shiftIsBounded(v)) { 4790 break 4791 } 4792 v.reset(OpS390XSRAD) 4793 v.AddArg2(x, y) 4794 return true 4795 } 4796 // match: (Rsh64x16 x y) 4797 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64]))) 4798 for { 4799 x := v_0 4800 y := v_1 4801 v.reset(OpS390XSRAD) 4802 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4803 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4804 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4805 v1.AuxInt = int64ToAuxInt(63) 4806 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4807 v2.AuxInt = int32ToAuxInt(64) 4808 v3 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4809 v3.AddArg(y) 4810 v2.AddArg(v3) 4811 v0.AddArg3(y, v1, v2) 4812 v.AddArg2(x, v0) 4813 return true 4814 } 4815 } 4816 func rewriteValueS390X_OpRsh64x32(v *Value) bool { 4817 v_1 := v.Args[1] 4818 v_0 := v.Args[0] 4819 b := v.Block 4820 // match: (Rsh64x32 x y) 4821 // cond: shiftIsBounded(v) 4822 // result: (SRAD x y) 4823 for { 4824 x := v_0 4825 y := v_1 4826 if !(shiftIsBounded(v)) { 4827 break 4828 } 4829 v.reset(OpS390XSRAD) 4830 v.AddArg2(x, y) 4831 return true 4832 } 4833 // match: (Rsh64x32 x y) 4834 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64]))) 4835 for { 4836 x := v_0 4837 y := v_1 4838 v.reset(OpS390XSRAD) 4839 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4840 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4841 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4842 v1.AuxInt = int64ToAuxInt(63) 4843 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4844 v2.AuxInt = int32ToAuxInt(64) 4845 v2.AddArg(y) 4846 v0.AddArg3(y, v1, v2) 4847 v.AddArg2(x, v0) 4848 return true 4849 } 4850 } 4851 func rewriteValueS390X_OpRsh64x64(v *Value) bool { 4852 v_1 := v.Args[1] 4853 v_0 := v.Args[0] 4854 b := v.Block 4855 // match: (Rsh64x64 x y) 4856 // cond: shiftIsBounded(v) 4857 // result: (SRAD x y) 4858 for { 4859 x := v_0 4860 y := v_1 4861 if !(shiftIsBounded(v)) { 4862 break 4863 } 4864 v.reset(OpS390XSRAD) 4865 v.AddArg2(x, y) 4866 return true 4867 } 4868 // match: (Rsh64x64 x y) 4869 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64]))) 4870 for { 4871 x := v_0 4872 y := v_1 4873 v.reset(OpS390XSRAD) 4874 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4875 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4876 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4877 v1.AuxInt = int64ToAuxInt(63) 4878 v2 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 4879 v2.AuxInt = int32ToAuxInt(64) 4880 v2.AddArg(y) 4881 v0.AddArg3(y, v1, v2) 4882 v.AddArg2(x, v0) 4883 return true 4884 } 4885 } 4886 func rewriteValueS390X_OpRsh64x8(v *Value) bool { 4887 v_1 := v.Args[1] 4888 v_0 := v.Args[0] 4889 b := v.Block 4890 typ := &b.Func.Config.Types 4891 // match: (Rsh64x8 x y) 4892 // cond: shiftIsBounded(v) 4893 // result: (SRAD x y) 4894 for { 4895 x := v_0 4896 y := v_1 4897 if !(shiftIsBounded(v)) { 4898 break 4899 } 4900 v.reset(OpS390XSRAD) 4901 v.AddArg2(x, y) 4902 return true 4903 } 4904 // match: (Rsh64x8 x y) 4905 // result: (SRAD x (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64]))) 4906 for { 4907 x := v_0 4908 y := v_1 4909 v.reset(OpS390XSRAD) 4910 v0 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 4911 v0.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4912 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 4913 v1.AuxInt = int64ToAuxInt(63) 4914 v2 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4915 v2.AuxInt = int32ToAuxInt(64) 4916 v3 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4917 v3.AddArg(y) 4918 v2.AddArg(v3) 4919 v0.AddArg3(y, v1, v2) 4920 v.AddArg2(x, v0) 4921 return true 4922 } 4923 } 4924 func rewriteValueS390X_OpRsh8Ux16(v *Value) bool { 4925 v_1 := v.Args[1] 4926 v_0 := v.Args[0] 4927 b := v.Block 4928 typ := &b.Func.Config.Types 4929 // match: (Rsh8Ux16 x y) 4930 // cond: shiftIsBounded(v) 4931 // result: (SRW (MOVBZreg x) y) 4932 for { 4933 x := v_0 4934 y := v_1 4935 if !(shiftIsBounded(v)) { 4936 break 4937 } 4938 v.reset(OpS390XSRW) 4939 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4940 v0.AddArg(x) 4941 v.AddArg2(v0, y) 4942 return true 4943 } 4944 // match: (Rsh8Ux16 <t> x y) 4945 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVHZreg y) [64])) 4946 for { 4947 t := v.Type 4948 x := v_0 4949 y := v_1 4950 v.reset(OpS390XLOCGR) 4951 v.Type = t 4952 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4953 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4954 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4955 v1.AddArg(x) 4956 v0.AddArg2(v1, y) 4957 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 4958 v2.AuxInt = int64ToAuxInt(0) 4959 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 4960 v3.AuxInt = int32ToAuxInt(64) 4961 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 4962 v4.AddArg(y) 4963 v3.AddArg(v4) 4964 v.AddArg3(v0, v2, v3) 4965 return true 4966 } 4967 } 4968 func rewriteValueS390X_OpRsh8Ux32(v *Value) bool { 4969 v_1 := v.Args[1] 4970 v_0 := v.Args[0] 4971 b := v.Block 4972 typ := &b.Func.Config.Types 4973 // match: (Rsh8Ux32 x y) 4974 // cond: shiftIsBounded(v) 4975 // result: (SRW (MOVBZreg x) y) 4976 for { 4977 x := v_0 4978 y := v_1 4979 if !(shiftIsBounded(v)) { 4980 break 4981 } 4982 v.reset(OpS390XSRW) 4983 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4984 v0.AddArg(x) 4985 v.AddArg2(v0, y) 4986 return true 4987 } 4988 // match: (Rsh8Ux32 <t> x y) 4989 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [64])) 4990 for { 4991 t := v.Type 4992 x := v_0 4993 y := v_1 4994 v.reset(OpS390XLOCGR) 4995 v.Type = t 4996 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 4997 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 4998 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 4999 v1.AddArg(x) 5000 v0.AddArg2(v1, y) 5001 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 5002 v2.AuxInt = int64ToAuxInt(0) 5003 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5004 v3.AuxInt = int32ToAuxInt(64) 5005 v3.AddArg(y) 5006 v.AddArg3(v0, v2, v3) 5007 return true 5008 } 5009 } 5010 func rewriteValueS390X_OpRsh8Ux64(v *Value) bool { 5011 v_1 := v.Args[1] 5012 v_0 := v.Args[0] 5013 b := v.Block 5014 typ := &b.Func.Config.Types 5015 // match: (Rsh8Ux64 x y) 5016 // cond: shiftIsBounded(v) 5017 // result: (SRW (MOVBZreg x) y) 5018 for { 5019 x := v_0 5020 y := v_1 5021 if !(shiftIsBounded(v)) { 5022 break 5023 } 5024 v.reset(OpS390XSRW) 5025 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5026 v0.AddArg(x) 5027 v.AddArg2(v0, y) 5028 return true 5029 } 5030 // match: (Rsh8Ux64 <t> x y) 5031 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [64])) 5032 for { 5033 t := v.Type 5034 x := v_0 5035 y := v_1 5036 v.reset(OpS390XLOCGR) 5037 v.Type = t 5038 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5039 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 5040 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5041 v1.AddArg(x) 5042 v0.AddArg2(v1, y) 5043 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 5044 v2.AuxInt = int64ToAuxInt(0) 5045 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 5046 v3.AuxInt = int32ToAuxInt(64) 5047 v3.AddArg(y) 5048 v.AddArg3(v0, v2, v3) 5049 return true 5050 } 5051 } 5052 func rewriteValueS390X_OpRsh8Ux8(v *Value) bool { 5053 v_1 := v.Args[1] 5054 v_0 := v.Args[0] 5055 b := v.Block 5056 typ := &b.Func.Config.Types 5057 // match: (Rsh8Ux8 x y) 5058 // cond: shiftIsBounded(v) 5059 // result: (SRW (MOVBZreg x) y) 5060 for { 5061 x := v_0 5062 y := v_1 5063 if !(shiftIsBounded(v)) { 5064 break 5065 } 5066 v.reset(OpS390XSRW) 5067 v0 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5068 v0.AddArg(x) 5069 v.AddArg2(v0, y) 5070 return true 5071 } 5072 // match: (Rsh8Ux8 <t> x y) 5073 // result: (LOCGR {s390x.GreaterOrEqual} <t> (SRW <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst (MOVBZreg y) [64])) 5074 for { 5075 t := v.Type 5076 x := v_0 5077 y := v_1 5078 v.reset(OpS390XLOCGR) 5079 v.Type = t 5080 v.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5081 v0 := b.NewValue0(v.Pos, OpS390XSRW, t) 5082 v1 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5083 v1.AddArg(x) 5084 v0.AddArg2(v1, y) 5085 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 5086 v2.AuxInt = int64ToAuxInt(0) 5087 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5088 v3.AuxInt = int32ToAuxInt(64) 5089 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5090 v4.AddArg(y) 5091 v3.AddArg(v4) 5092 v.AddArg3(v0, v2, v3) 5093 return true 5094 } 5095 } 5096 func rewriteValueS390X_OpRsh8x16(v *Value) bool { 5097 v_1 := v.Args[1] 5098 v_0 := v.Args[0] 5099 b := v.Block 5100 typ := &b.Func.Config.Types 5101 // match: (Rsh8x16 x y) 5102 // cond: shiftIsBounded(v) 5103 // result: (SRAW (MOVBreg x) y) 5104 for { 5105 x := v_0 5106 y := v_1 5107 if !(shiftIsBounded(v)) { 5108 break 5109 } 5110 v.reset(OpS390XSRAW) 5111 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5112 v0.AddArg(x) 5113 v.AddArg2(v0, y) 5114 return true 5115 } 5116 // match: (Rsh8x16 x y) 5117 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVHZreg y) [64]))) 5118 for { 5119 x := v_0 5120 y := v_1 5121 v.reset(OpS390XSRAW) 5122 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5123 v0.AddArg(x) 5124 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 5125 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5126 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 5127 v2.AuxInt = int64ToAuxInt(63) 5128 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5129 v3.AuxInt = int32ToAuxInt(64) 5130 v4 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) 5131 v4.AddArg(y) 5132 v3.AddArg(v4) 5133 v1.AddArg3(y, v2, v3) 5134 v.AddArg2(v0, v1) 5135 return true 5136 } 5137 } 5138 func rewriteValueS390X_OpRsh8x32(v *Value) bool { 5139 v_1 := v.Args[1] 5140 v_0 := v.Args[0] 5141 b := v.Block 5142 typ := &b.Func.Config.Types 5143 // match: (Rsh8x32 x y) 5144 // cond: shiftIsBounded(v) 5145 // result: (SRAW (MOVBreg x) y) 5146 for { 5147 x := v_0 5148 y := v_1 5149 if !(shiftIsBounded(v)) { 5150 break 5151 } 5152 v.reset(OpS390XSRAW) 5153 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5154 v0.AddArg(x) 5155 v.AddArg2(v0, y) 5156 return true 5157 } 5158 // match: (Rsh8x32 x y) 5159 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst y [64]))) 5160 for { 5161 x := v_0 5162 y := v_1 5163 v.reset(OpS390XSRAW) 5164 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5165 v0.AddArg(x) 5166 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 5167 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5168 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 5169 v2.AuxInt = int64ToAuxInt(63) 5170 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5171 v3.AuxInt = int32ToAuxInt(64) 5172 v3.AddArg(y) 5173 v1.AddArg3(y, v2, v3) 5174 v.AddArg2(v0, v1) 5175 return true 5176 } 5177 } 5178 func rewriteValueS390X_OpRsh8x64(v *Value) bool { 5179 v_1 := v.Args[1] 5180 v_0 := v.Args[0] 5181 b := v.Block 5182 typ := &b.Func.Config.Types 5183 // match: (Rsh8x64 x y) 5184 // cond: shiftIsBounded(v) 5185 // result: (SRAW (MOVBreg x) y) 5186 for { 5187 x := v_0 5188 y := v_1 5189 if !(shiftIsBounded(v)) { 5190 break 5191 } 5192 v.reset(OpS390XSRAW) 5193 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5194 v0.AddArg(x) 5195 v.AddArg2(v0, y) 5196 return true 5197 } 5198 // match: (Rsh8x64 x y) 5199 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPUconst y [64]))) 5200 for { 5201 x := v_0 5202 y := v_1 5203 v.reset(OpS390XSRAW) 5204 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5205 v0.AddArg(x) 5206 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 5207 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5208 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 5209 v2.AuxInt = int64ToAuxInt(63) 5210 v3 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 5211 v3.AuxInt = int32ToAuxInt(64) 5212 v3.AddArg(y) 5213 v1.AddArg3(y, v2, v3) 5214 v.AddArg2(v0, v1) 5215 return true 5216 } 5217 } 5218 func rewriteValueS390X_OpRsh8x8(v *Value) bool { 5219 v_1 := v.Args[1] 5220 v_0 := v.Args[0] 5221 b := v.Block 5222 typ := &b.Func.Config.Types 5223 // match: (Rsh8x8 x y) 5224 // cond: shiftIsBounded(v) 5225 // result: (SRAW (MOVBreg x) y) 5226 for { 5227 x := v_0 5228 y := v_1 5229 if !(shiftIsBounded(v)) { 5230 break 5231 } 5232 v.reset(OpS390XSRAW) 5233 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5234 v0.AddArg(x) 5235 v.AddArg2(v0, y) 5236 return true 5237 } 5238 // match: (Rsh8x8 x y) 5239 // result: (SRAW (MOVBreg x) (LOCGR {s390x.GreaterOrEqual} <y.Type> y (MOVDconst <y.Type> [63]) (CMPWUconst (MOVBZreg y) [64]))) 5240 for { 5241 x := v_0 5242 y := v_1 5243 v.reset(OpS390XSRAW) 5244 v0 := b.NewValue0(v.Pos, OpS390XMOVBreg, typ.Int64) 5245 v0.AddArg(x) 5246 v1 := b.NewValue0(v.Pos, OpS390XLOCGR, y.Type) 5247 v1.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 5248 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, y.Type) 5249 v2.AuxInt = int64ToAuxInt(63) 5250 v3 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 5251 v3.AuxInt = int32ToAuxInt(64) 5252 v4 := b.NewValue0(v.Pos, OpS390XMOVBZreg, typ.UInt64) 5253 v4.AddArg(y) 5254 v3.AddArg(v4) 5255 v1.AddArg3(y, v2, v3) 5256 v.AddArg2(v0, v1) 5257 return true 5258 } 5259 } 5260 func rewriteValueS390X_OpS390XADD(v *Value) bool { 5261 v_1 := v.Args[1] 5262 v_0 := v.Args[0] 5263 // match: (ADD x (MOVDconst [c])) 5264 // cond: is32Bit(c) 5265 // result: (ADDconst [int32(c)] x) 5266 for { 5267 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5268 x := v_0 5269 if v_1.Op != OpS390XMOVDconst { 5270 continue 5271 } 5272 c := auxIntToInt64(v_1.AuxInt) 5273 if !(is32Bit(c)) { 5274 continue 5275 } 5276 v.reset(OpS390XADDconst) 5277 v.AuxInt = int32ToAuxInt(int32(c)) 5278 v.AddArg(x) 5279 return true 5280 } 5281 break 5282 } 5283 // match: (ADD idx (MOVDaddr [c] {s} ptr)) 5284 // cond: ptr.Op != OpSB 5285 // result: (MOVDaddridx [c] {s} ptr idx) 5286 for { 5287 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5288 idx := v_0 5289 if v_1.Op != OpS390XMOVDaddr { 5290 continue 5291 } 5292 c := auxIntToInt32(v_1.AuxInt) 5293 s := auxToSym(v_1.Aux) 5294 ptr := v_1.Args[0] 5295 if !(ptr.Op != OpSB) { 5296 continue 5297 } 5298 v.reset(OpS390XMOVDaddridx) 5299 v.AuxInt = int32ToAuxInt(c) 5300 v.Aux = symToAux(s) 5301 v.AddArg2(ptr, idx) 5302 return true 5303 } 5304 break 5305 } 5306 // match: (ADD x (NEG y)) 5307 // result: (SUB x y) 5308 for { 5309 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5310 x := v_0 5311 if v_1.Op != OpS390XNEG { 5312 continue 5313 } 5314 y := v_1.Args[0] 5315 v.reset(OpS390XSUB) 5316 v.AddArg2(x, y) 5317 return true 5318 } 5319 break 5320 } 5321 // match: (ADD <t> x g:(MOVDload [off] {sym} ptr mem)) 5322 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5323 // result: (ADDload <t> [off] {sym} x ptr mem) 5324 for { 5325 t := v.Type 5326 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5327 x := v_0 5328 g := v_1 5329 if g.Op != OpS390XMOVDload { 5330 continue 5331 } 5332 off := auxIntToInt32(g.AuxInt) 5333 sym := auxToSym(g.Aux) 5334 mem := g.Args[1] 5335 ptr := g.Args[0] 5336 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5337 continue 5338 } 5339 v.reset(OpS390XADDload) 5340 v.Type = t 5341 v.AuxInt = int32ToAuxInt(off) 5342 v.Aux = symToAux(sym) 5343 v.AddArg3(x, ptr, mem) 5344 return true 5345 } 5346 break 5347 } 5348 return false 5349 } 5350 func rewriteValueS390X_OpS390XADDC(v *Value) bool { 5351 v_1 := v.Args[1] 5352 v_0 := v.Args[0] 5353 // match: (ADDC x (MOVDconst [c])) 5354 // cond: is16Bit(c) 5355 // result: (ADDCconst x [int16(c)]) 5356 for { 5357 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5358 x := v_0 5359 if v_1.Op != OpS390XMOVDconst { 5360 continue 5361 } 5362 c := auxIntToInt64(v_1.AuxInt) 5363 if !(is16Bit(c)) { 5364 continue 5365 } 5366 v.reset(OpS390XADDCconst) 5367 v.AuxInt = int16ToAuxInt(int16(c)) 5368 v.AddArg(x) 5369 return true 5370 } 5371 break 5372 } 5373 return false 5374 } 5375 func rewriteValueS390X_OpS390XADDE(v *Value) bool { 5376 v_2 := v.Args[2] 5377 v_1 := v.Args[1] 5378 v_0 := v.Args[0] 5379 // match: (ADDE x y (FlagEQ)) 5380 // result: (ADDC x y) 5381 for { 5382 x := v_0 5383 y := v_1 5384 if v_2.Op != OpS390XFlagEQ { 5385 break 5386 } 5387 v.reset(OpS390XADDC) 5388 v.AddArg2(x, y) 5389 return true 5390 } 5391 // match: (ADDE x y (FlagLT)) 5392 // result: (ADDC x y) 5393 for { 5394 x := v_0 5395 y := v_1 5396 if v_2.Op != OpS390XFlagLT { 5397 break 5398 } 5399 v.reset(OpS390XADDC) 5400 v.AddArg2(x, y) 5401 return true 5402 } 5403 // match: (ADDE x y (Select1 (ADDCconst [-1] (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) c))))) 5404 // result: (ADDE x y c) 5405 for { 5406 x := v_0 5407 y := v_1 5408 if v_2.Op != OpSelect1 { 5409 break 5410 } 5411 v_2_0 := v_2.Args[0] 5412 if v_2_0.Op != OpS390XADDCconst || auxIntToInt16(v_2_0.AuxInt) != -1 { 5413 break 5414 } 5415 v_2_0_0 := v_2_0.Args[0] 5416 if v_2_0_0.Op != OpSelect0 { 5417 break 5418 } 5419 v_2_0_0_0 := v_2_0_0.Args[0] 5420 if v_2_0_0_0.Op != OpS390XADDE { 5421 break 5422 } 5423 c := v_2_0_0_0.Args[2] 5424 v_2_0_0_0_0 := v_2_0_0_0.Args[0] 5425 if v_2_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0_0_0.AuxInt) != 0 { 5426 break 5427 } 5428 v_2_0_0_0_1 := v_2_0_0_0.Args[1] 5429 if v_2_0_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0_0_1.AuxInt) != 0 { 5430 break 5431 } 5432 v.reset(OpS390XADDE) 5433 v.AddArg3(x, y, c) 5434 return true 5435 } 5436 return false 5437 } 5438 func rewriteValueS390X_OpS390XADDW(v *Value) bool { 5439 v_1 := v.Args[1] 5440 v_0 := v.Args[0] 5441 // match: (ADDW x (MOVDconst [c])) 5442 // result: (ADDWconst [int32(c)] x) 5443 for { 5444 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5445 x := v_0 5446 if v_1.Op != OpS390XMOVDconst { 5447 continue 5448 } 5449 c := auxIntToInt64(v_1.AuxInt) 5450 v.reset(OpS390XADDWconst) 5451 v.AuxInt = int32ToAuxInt(int32(c)) 5452 v.AddArg(x) 5453 return true 5454 } 5455 break 5456 } 5457 // match: (ADDW x (NEGW y)) 5458 // result: (SUBW x y) 5459 for { 5460 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5461 x := v_0 5462 if v_1.Op != OpS390XNEGW { 5463 continue 5464 } 5465 y := v_1.Args[0] 5466 v.reset(OpS390XSUBW) 5467 v.AddArg2(x, y) 5468 return true 5469 } 5470 break 5471 } 5472 // match: (ADDW <t> x g:(MOVWload [off] {sym} ptr mem)) 5473 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5474 // result: (ADDWload <t> [off] {sym} x ptr mem) 5475 for { 5476 t := v.Type 5477 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5478 x := v_0 5479 g := v_1 5480 if g.Op != OpS390XMOVWload { 5481 continue 5482 } 5483 off := auxIntToInt32(g.AuxInt) 5484 sym := auxToSym(g.Aux) 5485 mem := g.Args[1] 5486 ptr := g.Args[0] 5487 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5488 continue 5489 } 5490 v.reset(OpS390XADDWload) 5491 v.Type = t 5492 v.AuxInt = int32ToAuxInt(off) 5493 v.Aux = symToAux(sym) 5494 v.AddArg3(x, ptr, mem) 5495 return true 5496 } 5497 break 5498 } 5499 // match: (ADDW <t> x g:(MOVWZload [off] {sym} ptr mem)) 5500 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5501 // result: (ADDWload <t> [off] {sym} x ptr mem) 5502 for { 5503 t := v.Type 5504 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5505 x := v_0 5506 g := v_1 5507 if g.Op != OpS390XMOVWZload { 5508 continue 5509 } 5510 off := auxIntToInt32(g.AuxInt) 5511 sym := auxToSym(g.Aux) 5512 mem := g.Args[1] 5513 ptr := g.Args[0] 5514 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5515 continue 5516 } 5517 v.reset(OpS390XADDWload) 5518 v.Type = t 5519 v.AuxInt = int32ToAuxInt(off) 5520 v.Aux = symToAux(sym) 5521 v.AddArg3(x, ptr, mem) 5522 return true 5523 } 5524 break 5525 } 5526 return false 5527 } 5528 func rewriteValueS390X_OpS390XADDWconst(v *Value) bool { 5529 v_0 := v.Args[0] 5530 // match: (ADDWconst [c] x) 5531 // cond: int32(c)==0 5532 // result: x 5533 for { 5534 c := auxIntToInt32(v.AuxInt) 5535 x := v_0 5536 if !(int32(c) == 0) { 5537 break 5538 } 5539 v.copyOf(x) 5540 return true 5541 } 5542 // match: (ADDWconst [c] (MOVDconst [d])) 5543 // result: (MOVDconst [int64(c)+d]) 5544 for { 5545 c := auxIntToInt32(v.AuxInt) 5546 if v_0.Op != OpS390XMOVDconst { 5547 break 5548 } 5549 d := auxIntToInt64(v_0.AuxInt) 5550 v.reset(OpS390XMOVDconst) 5551 v.AuxInt = int64ToAuxInt(int64(c) + d) 5552 return true 5553 } 5554 // match: (ADDWconst [c] (ADDWconst [d] x)) 5555 // result: (ADDWconst [int32(c+d)] x) 5556 for { 5557 c := auxIntToInt32(v.AuxInt) 5558 if v_0.Op != OpS390XADDWconst { 5559 break 5560 } 5561 d := auxIntToInt32(v_0.AuxInt) 5562 x := v_0.Args[0] 5563 v.reset(OpS390XADDWconst) 5564 v.AuxInt = int32ToAuxInt(int32(c + d)) 5565 v.AddArg(x) 5566 return true 5567 } 5568 return false 5569 } 5570 func rewriteValueS390X_OpS390XADDWload(v *Value) bool { 5571 v_2 := v.Args[2] 5572 v_1 := v.Args[1] 5573 v_0 := v.Args[0] 5574 // match: (ADDWload [off1] {sym} x (ADDconst [off2] ptr) mem) 5575 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 5576 // result: (ADDWload [off1+off2] {sym} x ptr mem) 5577 for { 5578 off1 := auxIntToInt32(v.AuxInt) 5579 sym := auxToSym(v.Aux) 5580 x := v_0 5581 if v_1.Op != OpS390XADDconst { 5582 break 5583 } 5584 off2 := auxIntToInt32(v_1.AuxInt) 5585 ptr := v_1.Args[0] 5586 mem := v_2 5587 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 5588 break 5589 } 5590 v.reset(OpS390XADDWload) 5591 v.AuxInt = int32ToAuxInt(off1 + off2) 5592 v.Aux = symToAux(sym) 5593 v.AddArg3(x, ptr, mem) 5594 return true 5595 } 5596 // match: (ADDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 5597 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 5598 // result: (ADDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 5599 for { 5600 o1 := auxIntToInt32(v.AuxInt) 5601 s1 := auxToSym(v.Aux) 5602 x := v_0 5603 if v_1.Op != OpS390XMOVDaddr { 5604 break 5605 } 5606 o2 := auxIntToInt32(v_1.AuxInt) 5607 s2 := auxToSym(v_1.Aux) 5608 ptr := v_1.Args[0] 5609 mem := v_2 5610 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 5611 break 5612 } 5613 v.reset(OpS390XADDWload) 5614 v.AuxInt = int32ToAuxInt(o1 + o2) 5615 v.Aux = symToAux(mergeSym(s1, s2)) 5616 v.AddArg3(x, ptr, mem) 5617 return true 5618 } 5619 return false 5620 } 5621 func rewriteValueS390X_OpS390XADDconst(v *Value) bool { 5622 v_0 := v.Args[0] 5623 // match: (ADDconst [c] (MOVDaddr [d] {s} x:(SB))) 5624 // cond: ((c+d)&1 == 0) && is32Bit(int64(c)+int64(d)) 5625 // result: (MOVDaddr [c+d] {s} x) 5626 for { 5627 c := auxIntToInt32(v.AuxInt) 5628 if v_0.Op != OpS390XMOVDaddr { 5629 break 5630 } 5631 d := auxIntToInt32(v_0.AuxInt) 5632 s := auxToSym(v_0.Aux) 5633 x := v_0.Args[0] 5634 if x.Op != OpSB || !(((c+d)&1 == 0) && is32Bit(int64(c)+int64(d))) { 5635 break 5636 } 5637 v.reset(OpS390XMOVDaddr) 5638 v.AuxInt = int32ToAuxInt(c + d) 5639 v.Aux = symToAux(s) 5640 v.AddArg(x) 5641 return true 5642 } 5643 // match: (ADDconst [c] (MOVDaddr [d] {s} x)) 5644 // cond: x.Op != OpSB && is20Bit(int64(c)+int64(d)) 5645 // result: (MOVDaddr [c+d] {s} x) 5646 for { 5647 c := auxIntToInt32(v.AuxInt) 5648 if v_0.Op != OpS390XMOVDaddr { 5649 break 5650 } 5651 d := auxIntToInt32(v_0.AuxInt) 5652 s := auxToSym(v_0.Aux) 5653 x := v_0.Args[0] 5654 if !(x.Op != OpSB && is20Bit(int64(c)+int64(d))) { 5655 break 5656 } 5657 v.reset(OpS390XMOVDaddr) 5658 v.AuxInt = int32ToAuxInt(c + d) 5659 v.Aux = symToAux(s) 5660 v.AddArg(x) 5661 return true 5662 } 5663 // match: (ADDconst [c] (MOVDaddridx [d] {s} x y)) 5664 // cond: is20Bit(int64(c)+int64(d)) 5665 // result: (MOVDaddridx [c+d] {s} x y) 5666 for { 5667 c := auxIntToInt32(v.AuxInt) 5668 if v_0.Op != OpS390XMOVDaddridx { 5669 break 5670 } 5671 d := auxIntToInt32(v_0.AuxInt) 5672 s := auxToSym(v_0.Aux) 5673 y := v_0.Args[1] 5674 x := v_0.Args[0] 5675 if !(is20Bit(int64(c) + int64(d))) { 5676 break 5677 } 5678 v.reset(OpS390XMOVDaddridx) 5679 v.AuxInt = int32ToAuxInt(c + d) 5680 v.Aux = symToAux(s) 5681 v.AddArg2(x, y) 5682 return true 5683 } 5684 // match: (ADDconst [0] x) 5685 // result: x 5686 for { 5687 if auxIntToInt32(v.AuxInt) != 0 { 5688 break 5689 } 5690 x := v_0 5691 v.copyOf(x) 5692 return true 5693 } 5694 // match: (ADDconst [c] (MOVDconst [d])) 5695 // result: (MOVDconst [int64(c)+d]) 5696 for { 5697 c := auxIntToInt32(v.AuxInt) 5698 if v_0.Op != OpS390XMOVDconst { 5699 break 5700 } 5701 d := auxIntToInt64(v_0.AuxInt) 5702 v.reset(OpS390XMOVDconst) 5703 v.AuxInt = int64ToAuxInt(int64(c) + d) 5704 return true 5705 } 5706 // match: (ADDconst [c] (ADDconst [d] x)) 5707 // cond: is32Bit(int64(c)+int64(d)) 5708 // result: (ADDconst [c+d] x) 5709 for { 5710 c := auxIntToInt32(v.AuxInt) 5711 if v_0.Op != OpS390XADDconst { 5712 break 5713 } 5714 d := auxIntToInt32(v_0.AuxInt) 5715 x := v_0.Args[0] 5716 if !(is32Bit(int64(c) + int64(d))) { 5717 break 5718 } 5719 v.reset(OpS390XADDconst) 5720 v.AuxInt = int32ToAuxInt(c + d) 5721 v.AddArg(x) 5722 return true 5723 } 5724 return false 5725 } 5726 func rewriteValueS390X_OpS390XADDload(v *Value) bool { 5727 v_2 := v.Args[2] 5728 v_1 := v.Args[1] 5729 v_0 := v.Args[0] 5730 b := v.Block 5731 // match: (ADDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 5732 // cond: isSamePtr(ptr1, ptr2) 5733 // result: (ADD x (LGDR <t> y)) 5734 for { 5735 t := v.Type 5736 off := auxIntToInt32(v.AuxInt) 5737 sym := auxToSym(v.Aux) 5738 x := v_0 5739 ptr1 := v_1 5740 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 5741 break 5742 } 5743 y := v_2.Args[1] 5744 ptr2 := v_2.Args[0] 5745 if !(isSamePtr(ptr1, ptr2)) { 5746 break 5747 } 5748 v.reset(OpS390XADD) 5749 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 5750 v0.AddArg(y) 5751 v.AddArg2(x, v0) 5752 return true 5753 } 5754 // match: (ADDload [off1] {sym} x (ADDconst [off2] ptr) mem) 5755 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 5756 // result: (ADDload [off1+off2] {sym} x ptr mem) 5757 for { 5758 off1 := auxIntToInt32(v.AuxInt) 5759 sym := auxToSym(v.Aux) 5760 x := v_0 5761 if v_1.Op != OpS390XADDconst { 5762 break 5763 } 5764 off2 := auxIntToInt32(v_1.AuxInt) 5765 ptr := v_1.Args[0] 5766 mem := v_2 5767 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 5768 break 5769 } 5770 v.reset(OpS390XADDload) 5771 v.AuxInt = int32ToAuxInt(off1 + off2) 5772 v.Aux = symToAux(sym) 5773 v.AddArg3(x, ptr, mem) 5774 return true 5775 } 5776 // match: (ADDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 5777 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 5778 // result: (ADDload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 5779 for { 5780 o1 := auxIntToInt32(v.AuxInt) 5781 s1 := auxToSym(v.Aux) 5782 x := v_0 5783 if v_1.Op != OpS390XMOVDaddr { 5784 break 5785 } 5786 o2 := auxIntToInt32(v_1.AuxInt) 5787 s2 := auxToSym(v_1.Aux) 5788 ptr := v_1.Args[0] 5789 mem := v_2 5790 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 5791 break 5792 } 5793 v.reset(OpS390XADDload) 5794 v.AuxInt = int32ToAuxInt(o1 + o2) 5795 v.Aux = symToAux(mergeSym(s1, s2)) 5796 v.AddArg3(x, ptr, mem) 5797 return true 5798 } 5799 return false 5800 } 5801 func rewriteValueS390X_OpS390XAND(v *Value) bool { 5802 v_1 := v.Args[1] 5803 v_0 := v.Args[0] 5804 b := v.Block 5805 typ := &b.Func.Config.Types 5806 // match: (AND x (MOVDconst [c])) 5807 // cond: s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)) != nil 5808 // result: (RISBGZ x {*s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c))}) 5809 for { 5810 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5811 x := v_0 5812 if v_1.Op != OpS390XMOVDconst { 5813 continue 5814 } 5815 c := auxIntToInt64(v_1.AuxInt) 5816 if !(s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c)) != nil) { 5817 continue 5818 } 5819 v.reset(OpS390XRISBGZ) 5820 v.Aux = s390xRotateParamsToAux(*s390x.NewRotateParams(0, 63, 0).OutMerge(uint64(c))) 5821 v.AddArg(x) 5822 return true 5823 } 5824 break 5825 } 5826 // match: (AND x (MOVDconst [c])) 5827 // cond: is32Bit(c) && c < 0 5828 // result: (ANDconst [c] x) 5829 for { 5830 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5831 x := v_0 5832 if v_1.Op != OpS390XMOVDconst { 5833 continue 5834 } 5835 c := auxIntToInt64(v_1.AuxInt) 5836 if !(is32Bit(c) && c < 0) { 5837 continue 5838 } 5839 v.reset(OpS390XANDconst) 5840 v.AuxInt = int64ToAuxInt(c) 5841 v.AddArg(x) 5842 return true 5843 } 5844 break 5845 } 5846 // match: (AND x (MOVDconst [c])) 5847 // cond: is32Bit(c) && c >= 0 5848 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(c)] x)) 5849 for { 5850 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5851 x := v_0 5852 if v_1.Op != OpS390XMOVDconst { 5853 continue 5854 } 5855 c := auxIntToInt64(v_1.AuxInt) 5856 if !(is32Bit(c) && c >= 0) { 5857 continue 5858 } 5859 v.reset(OpS390XMOVWZreg) 5860 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 5861 v0.AuxInt = int32ToAuxInt(int32(c)) 5862 v0.AddArg(x) 5863 v.AddArg(v0) 5864 return true 5865 } 5866 break 5867 } 5868 // match: (AND (MOVDconst [c]) (MOVDconst [d])) 5869 // result: (MOVDconst [c&d]) 5870 for { 5871 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5872 if v_0.Op != OpS390XMOVDconst { 5873 continue 5874 } 5875 c := auxIntToInt64(v_0.AuxInt) 5876 if v_1.Op != OpS390XMOVDconst { 5877 continue 5878 } 5879 d := auxIntToInt64(v_1.AuxInt) 5880 v.reset(OpS390XMOVDconst) 5881 v.AuxInt = int64ToAuxInt(c & d) 5882 return true 5883 } 5884 break 5885 } 5886 // match: (AND x x) 5887 // result: x 5888 for { 5889 x := v_0 5890 if x != v_1 { 5891 break 5892 } 5893 v.copyOf(x) 5894 return true 5895 } 5896 // match: (AND <t> x g:(MOVDload [off] {sym} ptr mem)) 5897 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5898 // result: (ANDload <t> [off] {sym} x ptr mem) 5899 for { 5900 t := v.Type 5901 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5902 x := v_0 5903 g := v_1 5904 if g.Op != OpS390XMOVDload { 5905 continue 5906 } 5907 off := auxIntToInt32(g.AuxInt) 5908 sym := auxToSym(g.Aux) 5909 mem := g.Args[1] 5910 ptr := g.Args[0] 5911 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5912 continue 5913 } 5914 v.reset(OpS390XANDload) 5915 v.Type = t 5916 v.AuxInt = int32ToAuxInt(off) 5917 v.Aux = symToAux(sym) 5918 v.AddArg3(x, ptr, mem) 5919 return true 5920 } 5921 break 5922 } 5923 return false 5924 } 5925 func rewriteValueS390X_OpS390XANDW(v *Value) bool { 5926 v_1 := v.Args[1] 5927 v_0 := v.Args[0] 5928 // match: (ANDW x (MOVDconst [c])) 5929 // result: (ANDWconst [int32(c)] x) 5930 for { 5931 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5932 x := v_0 5933 if v_1.Op != OpS390XMOVDconst { 5934 continue 5935 } 5936 c := auxIntToInt64(v_1.AuxInt) 5937 v.reset(OpS390XANDWconst) 5938 v.AuxInt = int32ToAuxInt(int32(c)) 5939 v.AddArg(x) 5940 return true 5941 } 5942 break 5943 } 5944 // match: (ANDW x x) 5945 // result: x 5946 for { 5947 x := v_0 5948 if x != v_1 { 5949 break 5950 } 5951 v.copyOf(x) 5952 return true 5953 } 5954 // match: (ANDW <t> x g:(MOVWload [off] {sym} ptr mem)) 5955 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5956 // result: (ANDWload <t> [off] {sym} x ptr mem) 5957 for { 5958 t := v.Type 5959 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5960 x := v_0 5961 g := v_1 5962 if g.Op != OpS390XMOVWload { 5963 continue 5964 } 5965 off := auxIntToInt32(g.AuxInt) 5966 sym := auxToSym(g.Aux) 5967 mem := g.Args[1] 5968 ptr := g.Args[0] 5969 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5970 continue 5971 } 5972 v.reset(OpS390XANDWload) 5973 v.Type = t 5974 v.AuxInt = int32ToAuxInt(off) 5975 v.Aux = symToAux(sym) 5976 v.AddArg3(x, ptr, mem) 5977 return true 5978 } 5979 break 5980 } 5981 // match: (ANDW <t> x g:(MOVWZload [off] {sym} ptr mem)) 5982 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 5983 // result: (ANDWload <t> [off] {sym} x ptr mem) 5984 for { 5985 t := v.Type 5986 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5987 x := v_0 5988 g := v_1 5989 if g.Op != OpS390XMOVWZload { 5990 continue 5991 } 5992 off := auxIntToInt32(g.AuxInt) 5993 sym := auxToSym(g.Aux) 5994 mem := g.Args[1] 5995 ptr := g.Args[0] 5996 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 5997 continue 5998 } 5999 v.reset(OpS390XANDWload) 6000 v.Type = t 6001 v.AuxInt = int32ToAuxInt(off) 6002 v.Aux = symToAux(sym) 6003 v.AddArg3(x, ptr, mem) 6004 return true 6005 } 6006 break 6007 } 6008 return false 6009 } 6010 func rewriteValueS390X_OpS390XANDWconst(v *Value) bool { 6011 v_0 := v.Args[0] 6012 // match: (ANDWconst [c] (ANDWconst [d] x)) 6013 // result: (ANDWconst [c&d] x) 6014 for { 6015 c := auxIntToInt32(v.AuxInt) 6016 if v_0.Op != OpS390XANDWconst { 6017 break 6018 } 6019 d := auxIntToInt32(v_0.AuxInt) 6020 x := v_0.Args[0] 6021 v.reset(OpS390XANDWconst) 6022 v.AuxInt = int32ToAuxInt(c & d) 6023 v.AddArg(x) 6024 return true 6025 } 6026 // match: (ANDWconst [0x00ff] x) 6027 // result: (MOVBZreg x) 6028 for { 6029 if auxIntToInt32(v.AuxInt) != 0x00ff { 6030 break 6031 } 6032 x := v_0 6033 v.reset(OpS390XMOVBZreg) 6034 v.AddArg(x) 6035 return true 6036 } 6037 // match: (ANDWconst [0xffff] x) 6038 // result: (MOVHZreg x) 6039 for { 6040 if auxIntToInt32(v.AuxInt) != 0xffff { 6041 break 6042 } 6043 x := v_0 6044 v.reset(OpS390XMOVHZreg) 6045 v.AddArg(x) 6046 return true 6047 } 6048 // match: (ANDWconst [c] _) 6049 // cond: int32(c)==0 6050 // result: (MOVDconst [0]) 6051 for { 6052 c := auxIntToInt32(v.AuxInt) 6053 if !(int32(c) == 0) { 6054 break 6055 } 6056 v.reset(OpS390XMOVDconst) 6057 v.AuxInt = int64ToAuxInt(0) 6058 return true 6059 } 6060 // match: (ANDWconst [c] x) 6061 // cond: int32(c)==-1 6062 // result: x 6063 for { 6064 c := auxIntToInt32(v.AuxInt) 6065 x := v_0 6066 if !(int32(c) == -1) { 6067 break 6068 } 6069 v.copyOf(x) 6070 return true 6071 } 6072 // match: (ANDWconst [c] (MOVDconst [d])) 6073 // result: (MOVDconst [int64(c)&d]) 6074 for { 6075 c := auxIntToInt32(v.AuxInt) 6076 if v_0.Op != OpS390XMOVDconst { 6077 break 6078 } 6079 d := auxIntToInt64(v_0.AuxInt) 6080 v.reset(OpS390XMOVDconst) 6081 v.AuxInt = int64ToAuxInt(int64(c) & d) 6082 return true 6083 } 6084 return false 6085 } 6086 func rewriteValueS390X_OpS390XANDWload(v *Value) bool { 6087 v_2 := v.Args[2] 6088 v_1 := v.Args[1] 6089 v_0 := v.Args[0] 6090 // match: (ANDWload [off1] {sym} x (ADDconst [off2] ptr) mem) 6091 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 6092 // result: (ANDWload [off1+off2] {sym} x ptr mem) 6093 for { 6094 off1 := auxIntToInt32(v.AuxInt) 6095 sym := auxToSym(v.Aux) 6096 x := v_0 6097 if v_1.Op != OpS390XADDconst { 6098 break 6099 } 6100 off2 := auxIntToInt32(v_1.AuxInt) 6101 ptr := v_1.Args[0] 6102 mem := v_2 6103 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 6104 break 6105 } 6106 v.reset(OpS390XANDWload) 6107 v.AuxInt = int32ToAuxInt(off1 + off2) 6108 v.Aux = symToAux(sym) 6109 v.AddArg3(x, ptr, mem) 6110 return true 6111 } 6112 // match: (ANDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 6113 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 6114 // result: (ANDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 6115 for { 6116 o1 := auxIntToInt32(v.AuxInt) 6117 s1 := auxToSym(v.Aux) 6118 x := v_0 6119 if v_1.Op != OpS390XMOVDaddr { 6120 break 6121 } 6122 o2 := auxIntToInt32(v_1.AuxInt) 6123 s2 := auxToSym(v_1.Aux) 6124 ptr := v_1.Args[0] 6125 mem := v_2 6126 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 6127 break 6128 } 6129 v.reset(OpS390XANDWload) 6130 v.AuxInt = int32ToAuxInt(o1 + o2) 6131 v.Aux = symToAux(mergeSym(s1, s2)) 6132 v.AddArg3(x, ptr, mem) 6133 return true 6134 } 6135 return false 6136 } 6137 func rewriteValueS390X_OpS390XANDconst(v *Value) bool { 6138 v_0 := v.Args[0] 6139 // match: (ANDconst [c] (ANDconst [d] x)) 6140 // result: (ANDconst [c&d] x) 6141 for { 6142 c := auxIntToInt64(v.AuxInt) 6143 if v_0.Op != OpS390XANDconst { 6144 break 6145 } 6146 d := auxIntToInt64(v_0.AuxInt) 6147 x := v_0.Args[0] 6148 v.reset(OpS390XANDconst) 6149 v.AuxInt = int64ToAuxInt(c & d) 6150 v.AddArg(x) 6151 return true 6152 } 6153 // match: (ANDconst [0] _) 6154 // result: (MOVDconst [0]) 6155 for { 6156 if auxIntToInt64(v.AuxInt) != 0 { 6157 break 6158 } 6159 v.reset(OpS390XMOVDconst) 6160 v.AuxInt = int64ToAuxInt(0) 6161 return true 6162 } 6163 // match: (ANDconst [-1] x) 6164 // result: x 6165 for { 6166 if auxIntToInt64(v.AuxInt) != -1 { 6167 break 6168 } 6169 x := v_0 6170 v.copyOf(x) 6171 return true 6172 } 6173 // match: (ANDconst [c] (MOVDconst [d])) 6174 // result: (MOVDconst [c&d]) 6175 for { 6176 c := auxIntToInt64(v.AuxInt) 6177 if v_0.Op != OpS390XMOVDconst { 6178 break 6179 } 6180 d := auxIntToInt64(v_0.AuxInt) 6181 v.reset(OpS390XMOVDconst) 6182 v.AuxInt = int64ToAuxInt(c & d) 6183 return true 6184 } 6185 return false 6186 } 6187 func rewriteValueS390X_OpS390XANDload(v *Value) bool { 6188 v_2 := v.Args[2] 6189 v_1 := v.Args[1] 6190 v_0 := v.Args[0] 6191 b := v.Block 6192 // match: (ANDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 6193 // cond: isSamePtr(ptr1, ptr2) 6194 // result: (AND x (LGDR <t> y)) 6195 for { 6196 t := v.Type 6197 off := auxIntToInt32(v.AuxInt) 6198 sym := auxToSym(v.Aux) 6199 x := v_0 6200 ptr1 := v_1 6201 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 6202 break 6203 } 6204 y := v_2.Args[1] 6205 ptr2 := v_2.Args[0] 6206 if !(isSamePtr(ptr1, ptr2)) { 6207 break 6208 } 6209 v.reset(OpS390XAND) 6210 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 6211 v0.AddArg(y) 6212 v.AddArg2(x, v0) 6213 return true 6214 } 6215 // match: (ANDload [off1] {sym} x (ADDconst [off2] ptr) mem) 6216 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 6217 // result: (ANDload [off1+off2] {sym} x ptr mem) 6218 for { 6219 off1 := auxIntToInt32(v.AuxInt) 6220 sym := auxToSym(v.Aux) 6221 x := v_0 6222 if v_1.Op != OpS390XADDconst { 6223 break 6224 } 6225 off2 := auxIntToInt32(v_1.AuxInt) 6226 ptr := v_1.Args[0] 6227 mem := v_2 6228 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 6229 break 6230 } 6231 v.reset(OpS390XANDload) 6232 v.AuxInt = int32ToAuxInt(off1 + off2) 6233 v.Aux = symToAux(sym) 6234 v.AddArg3(x, ptr, mem) 6235 return true 6236 } 6237 // match: (ANDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 6238 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 6239 // result: (ANDload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 6240 for { 6241 o1 := auxIntToInt32(v.AuxInt) 6242 s1 := auxToSym(v.Aux) 6243 x := v_0 6244 if v_1.Op != OpS390XMOVDaddr { 6245 break 6246 } 6247 o2 := auxIntToInt32(v_1.AuxInt) 6248 s2 := auxToSym(v_1.Aux) 6249 ptr := v_1.Args[0] 6250 mem := v_2 6251 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 6252 break 6253 } 6254 v.reset(OpS390XANDload) 6255 v.AuxInt = int32ToAuxInt(o1 + o2) 6256 v.Aux = symToAux(mergeSym(s1, s2)) 6257 v.AddArg3(x, ptr, mem) 6258 return true 6259 } 6260 return false 6261 } 6262 func rewriteValueS390X_OpS390XCMP(v *Value) bool { 6263 v_1 := v.Args[1] 6264 v_0 := v.Args[0] 6265 b := v.Block 6266 // match: (CMP x (MOVDconst [c])) 6267 // cond: is32Bit(c) 6268 // result: (CMPconst x [int32(c)]) 6269 for { 6270 x := v_0 6271 if v_1.Op != OpS390XMOVDconst { 6272 break 6273 } 6274 c := auxIntToInt64(v_1.AuxInt) 6275 if !(is32Bit(c)) { 6276 break 6277 } 6278 v.reset(OpS390XCMPconst) 6279 v.AuxInt = int32ToAuxInt(int32(c)) 6280 v.AddArg(x) 6281 return true 6282 } 6283 // match: (CMP (MOVDconst [c]) x) 6284 // cond: is32Bit(c) 6285 // result: (InvertFlags (CMPconst x [int32(c)])) 6286 for { 6287 if v_0.Op != OpS390XMOVDconst { 6288 break 6289 } 6290 c := auxIntToInt64(v_0.AuxInt) 6291 x := v_1 6292 if !(is32Bit(c)) { 6293 break 6294 } 6295 v.reset(OpS390XInvertFlags) 6296 v0 := b.NewValue0(v.Pos, OpS390XCMPconst, types.TypeFlags) 6297 v0.AuxInt = int32ToAuxInt(int32(c)) 6298 v0.AddArg(x) 6299 v.AddArg(v0) 6300 return true 6301 } 6302 // match: (CMP x y) 6303 // cond: canonLessThan(x,y) 6304 // result: (InvertFlags (CMP y x)) 6305 for { 6306 x := v_0 6307 y := v_1 6308 if !(canonLessThan(x, y)) { 6309 break 6310 } 6311 v.reset(OpS390XInvertFlags) 6312 v0 := b.NewValue0(v.Pos, OpS390XCMP, types.TypeFlags) 6313 v0.AddArg2(y, x) 6314 v.AddArg(v0) 6315 return true 6316 } 6317 return false 6318 } 6319 func rewriteValueS390X_OpS390XCMPU(v *Value) bool { 6320 v_1 := v.Args[1] 6321 v_0 := v.Args[0] 6322 b := v.Block 6323 // match: (CMPU x (MOVDconst [c])) 6324 // cond: isU32Bit(c) 6325 // result: (CMPUconst x [int32(c)]) 6326 for { 6327 x := v_0 6328 if v_1.Op != OpS390XMOVDconst { 6329 break 6330 } 6331 c := auxIntToInt64(v_1.AuxInt) 6332 if !(isU32Bit(c)) { 6333 break 6334 } 6335 v.reset(OpS390XCMPUconst) 6336 v.AuxInt = int32ToAuxInt(int32(c)) 6337 v.AddArg(x) 6338 return true 6339 } 6340 // match: (CMPU (MOVDconst [c]) x) 6341 // cond: isU32Bit(c) 6342 // result: (InvertFlags (CMPUconst x [int32(c)])) 6343 for { 6344 if v_0.Op != OpS390XMOVDconst { 6345 break 6346 } 6347 c := auxIntToInt64(v_0.AuxInt) 6348 x := v_1 6349 if !(isU32Bit(c)) { 6350 break 6351 } 6352 v.reset(OpS390XInvertFlags) 6353 v0 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) 6354 v0.AuxInt = int32ToAuxInt(int32(c)) 6355 v0.AddArg(x) 6356 v.AddArg(v0) 6357 return true 6358 } 6359 // match: (CMPU x y) 6360 // cond: canonLessThan(x,y) 6361 // result: (InvertFlags (CMPU y x)) 6362 for { 6363 x := v_0 6364 y := v_1 6365 if !(canonLessThan(x, y)) { 6366 break 6367 } 6368 v.reset(OpS390XInvertFlags) 6369 v0 := b.NewValue0(v.Pos, OpS390XCMPU, types.TypeFlags) 6370 v0.AddArg2(y, x) 6371 v.AddArg(v0) 6372 return true 6373 } 6374 return false 6375 } 6376 func rewriteValueS390X_OpS390XCMPUconst(v *Value) bool { 6377 v_0 := v.Args[0] 6378 // match: (CMPUconst (MOVDconst [x]) [y]) 6379 // cond: uint64(x)==uint64(y) 6380 // result: (FlagEQ) 6381 for { 6382 y := auxIntToInt32(v.AuxInt) 6383 if v_0.Op != OpS390XMOVDconst { 6384 break 6385 } 6386 x := auxIntToInt64(v_0.AuxInt) 6387 if !(uint64(x) == uint64(y)) { 6388 break 6389 } 6390 v.reset(OpS390XFlagEQ) 6391 return true 6392 } 6393 // match: (CMPUconst (MOVDconst [x]) [y]) 6394 // cond: uint64(x)<uint64(y) 6395 // result: (FlagLT) 6396 for { 6397 y := auxIntToInt32(v.AuxInt) 6398 if v_0.Op != OpS390XMOVDconst { 6399 break 6400 } 6401 x := auxIntToInt64(v_0.AuxInt) 6402 if !(uint64(x) < uint64(y)) { 6403 break 6404 } 6405 v.reset(OpS390XFlagLT) 6406 return true 6407 } 6408 // match: (CMPUconst (MOVDconst [x]) [y]) 6409 // cond: uint64(x)>uint64(y) 6410 // result: (FlagGT) 6411 for { 6412 y := auxIntToInt32(v.AuxInt) 6413 if v_0.Op != OpS390XMOVDconst { 6414 break 6415 } 6416 x := auxIntToInt64(v_0.AuxInt) 6417 if !(uint64(x) > uint64(y)) { 6418 break 6419 } 6420 v.reset(OpS390XFlagGT) 6421 return true 6422 } 6423 // match: (CMPUconst (SRDconst _ [c]) [n]) 6424 // cond: c > 0 && c < 64 && (1<<uint(64-c)) <= uint64(n) 6425 // result: (FlagLT) 6426 for { 6427 n := auxIntToInt32(v.AuxInt) 6428 if v_0.Op != OpS390XSRDconst { 6429 break 6430 } 6431 c := auxIntToUint8(v_0.AuxInt) 6432 if !(c > 0 && c < 64 && (1<<uint(64-c)) <= uint64(n)) { 6433 break 6434 } 6435 v.reset(OpS390XFlagLT) 6436 return true 6437 } 6438 // match: (CMPUconst (RISBGZ x {r}) [c]) 6439 // cond: r.OutMask() < uint64(uint32(c)) 6440 // result: (FlagLT) 6441 for { 6442 c := auxIntToInt32(v.AuxInt) 6443 if v_0.Op != OpS390XRISBGZ { 6444 break 6445 } 6446 r := auxToS390xRotateParams(v_0.Aux) 6447 if !(r.OutMask() < uint64(uint32(c))) { 6448 break 6449 } 6450 v.reset(OpS390XFlagLT) 6451 return true 6452 } 6453 // match: (CMPUconst (MOVWZreg x) [c]) 6454 // result: (CMPWUconst x [c]) 6455 for { 6456 c := auxIntToInt32(v.AuxInt) 6457 if v_0.Op != OpS390XMOVWZreg { 6458 break 6459 } 6460 x := v_0.Args[0] 6461 v.reset(OpS390XCMPWUconst) 6462 v.AuxInt = int32ToAuxInt(c) 6463 v.AddArg(x) 6464 return true 6465 } 6466 // match: (CMPUconst x:(MOVHreg _) [c]) 6467 // result: (CMPWUconst x [c]) 6468 for { 6469 c := auxIntToInt32(v.AuxInt) 6470 x := v_0 6471 if x.Op != OpS390XMOVHreg { 6472 break 6473 } 6474 v.reset(OpS390XCMPWUconst) 6475 v.AuxInt = int32ToAuxInt(c) 6476 v.AddArg(x) 6477 return true 6478 } 6479 // match: (CMPUconst x:(MOVHZreg _) [c]) 6480 // result: (CMPWUconst x [c]) 6481 for { 6482 c := auxIntToInt32(v.AuxInt) 6483 x := v_0 6484 if x.Op != OpS390XMOVHZreg { 6485 break 6486 } 6487 v.reset(OpS390XCMPWUconst) 6488 v.AuxInt = int32ToAuxInt(c) 6489 v.AddArg(x) 6490 return true 6491 } 6492 // match: (CMPUconst x:(MOVBreg _) [c]) 6493 // result: (CMPWUconst x [c]) 6494 for { 6495 c := auxIntToInt32(v.AuxInt) 6496 x := v_0 6497 if x.Op != OpS390XMOVBreg { 6498 break 6499 } 6500 v.reset(OpS390XCMPWUconst) 6501 v.AuxInt = int32ToAuxInt(c) 6502 v.AddArg(x) 6503 return true 6504 } 6505 // match: (CMPUconst x:(MOVBZreg _) [c]) 6506 // result: (CMPWUconst x [c]) 6507 for { 6508 c := auxIntToInt32(v.AuxInt) 6509 x := v_0 6510 if x.Op != OpS390XMOVBZreg { 6511 break 6512 } 6513 v.reset(OpS390XCMPWUconst) 6514 v.AuxInt = int32ToAuxInt(c) 6515 v.AddArg(x) 6516 return true 6517 } 6518 // match: (CMPUconst (MOVWZreg x:(ANDWconst [m] _)) [c]) 6519 // cond: int32(m) >= 0 6520 // result: (CMPWUconst x [c]) 6521 for { 6522 c := auxIntToInt32(v.AuxInt) 6523 if v_0.Op != OpS390XMOVWZreg { 6524 break 6525 } 6526 x := v_0.Args[0] 6527 if x.Op != OpS390XANDWconst { 6528 break 6529 } 6530 m := auxIntToInt32(x.AuxInt) 6531 if !(int32(m) >= 0) { 6532 break 6533 } 6534 v.reset(OpS390XCMPWUconst) 6535 v.AuxInt = int32ToAuxInt(c) 6536 v.AddArg(x) 6537 return true 6538 } 6539 // match: (CMPUconst (MOVWreg x:(ANDWconst [m] _)) [c]) 6540 // cond: int32(m) >= 0 6541 // result: (CMPWUconst x [c]) 6542 for { 6543 c := auxIntToInt32(v.AuxInt) 6544 if v_0.Op != OpS390XMOVWreg { 6545 break 6546 } 6547 x := v_0.Args[0] 6548 if x.Op != OpS390XANDWconst { 6549 break 6550 } 6551 m := auxIntToInt32(x.AuxInt) 6552 if !(int32(m) >= 0) { 6553 break 6554 } 6555 v.reset(OpS390XCMPWUconst) 6556 v.AuxInt = int32ToAuxInt(c) 6557 v.AddArg(x) 6558 return true 6559 } 6560 return false 6561 } 6562 func rewriteValueS390X_OpS390XCMPW(v *Value) bool { 6563 v_1 := v.Args[1] 6564 v_0 := v.Args[0] 6565 b := v.Block 6566 // match: (CMPW x (MOVDconst [c])) 6567 // result: (CMPWconst x [int32(c)]) 6568 for { 6569 x := v_0 6570 if v_1.Op != OpS390XMOVDconst { 6571 break 6572 } 6573 c := auxIntToInt64(v_1.AuxInt) 6574 v.reset(OpS390XCMPWconst) 6575 v.AuxInt = int32ToAuxInt(int32(c)) 6576 v.AddArg(x) 6577 return true 6578 } 6579 // match: (CMPW (MOVDconst [c]) x) 6580 // result: (InvertFlags (CMPWconst x [int32(c)])) 6581 for { 6582 if v_0.Op != OpS390XMOVDconst { 6583 break 6584 } 6585 c := auxIntToInt64(v_0.AuxInt) 6586 x := v_1 6587 v.reset(OpS390XInvertFlags) 6588 v0 := b.NewValue0(v.Pos, OpS390XCMPWconst, types.TypeFlags) 6589 v0.AuxInt = int32ToAuxInt(int32(c)) 6590 v0.AddArg(x) 6591 v.AddArg(v0) 6592 return true 6593 } 6594 // match: (CMPW x y) 6595 // cond: canonLessThan(x,y) 6596 // result: (InvertFlags (CMPW y x)) 6597 for { 6598 x := v_0 6599 y := v_1 6600 if !(canonLessThan(x, y)) { 6601 break 6602 } 6603 v.reset(OpS390XInvertFlags) 6604 v0 := b.NewValue0(v.Pos, OpS390XCMPW, types.TypeFlags) 6605 v0.AddArg2(y, x) 6606 v.AddArg(v0) 6607 return true 6608 } 6609 // match: (CMPW x (MOVWreg y)) 6610 // result: (CMPW x y) 6611 for { 6612 x := v_0 6613 if v_1.Op != OpS390XMOVWreg { 6614 break 6615 } 6616 y := v_1.Args[0] 6617 v.reset(OpS390XCMPW) 6618 v.AddArg2(x, y) 6619 return true 6620 } 6621 // match: (CMPW x (MOVWZreg y)) 6622 // result: (CMPW x y) 6623 for { 6624 x := v_0 6625 if v_1.Op != OpS390XMOVWZreg { 6626 break 6627 } 6628 y := v_1.Args[0] 6629 v.reset(OpS390XCMPW) 6630 v.AddArg2(x, y) 6631 return true 6632 } 6633 // match: (CMPW (MOVWreg x) y) 6634 // result: (CMPW x y) 6635 for { 6636 if v_0.Op != OpS390XMOVWreg { 6637 break 6638 } 6639 x := v_0.Args[0] 6640 y := v_1 6641 v.reset(OpS390XCMPW) 6642 v.AddArg2(x, y) 6643 return true 6644 } 6645 // match: (CMPW (MOVWZreg x) y) 6646 // result: (CMPW x y) 6647 for { 6648 if v_0.Op != OpS390XMOVWZreg { 6649 break 6650 } 6651 x := v_0.Args[0] 6652 y := v_1 6653 v.reset(OpS390XCMPW) 6654 v.AddArg2(x, y) 6655 return true 6656 } 6657 return false 6658 } 6659 func rewriteValueS390X_OpS390XCMPWU(v *Value) bool { 6660 v_1 := v.Args[1] 6661 v_0 := v.Args[0] 6662 b := v.Block 6663 // match: (CMPWU x (MOVDconst [c])) 6664 // result: (CMPWUconst x [int32(c)]) 6665 for { 6666 x := v_0 6667 if v_1.Op != OpS390XMOVDconst { 6668 break 6669 } 6670 c := auxIntToInt64(v_1.AuxInt) 6671 v.reset(OpS390XCMPWUconst) 6672 v.AuxInt = int32ToAuxInt(int32(c)) 6673 v.AddArg(x) 6674 return true 6675 } 6676 // match: (CMPWU (MOVDconst [c]) x) 6677 // result: (InvertFlags (CMPWUconst x [int32(c)])) 6678 for { 6679 if v_0.Op != OpS390XMOVDconst { 6680 break 6681 } 6682 c := auxIntToInt64(v_0.AuxInt) 6683 x := v_1 6684 v.reset(OpS390XInvertFlags) 6685 v0 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) 6686 v0.AuxInt = int32ToAuxInt(int32(c)) 6687 v0.AddArg(x) 6688 v.AddArg(v0) 6689 return true 6690 } 6691 // match: (CMPWU x y) 6692 // cond: canonLessThan(x,y) 6693 // result: (InvertFlags (CMPWU y x)) 6694 for { 6695 x := v_0 6696 y := v_1 6697 if !(canonLessThan(x, y)) { 6698 break 6699 } 6700 v.reset(OpS390XInvertFlags) 6701 v0 := b.NewValue0(v.Pos, OpS390XCMPWU, types.TypeFlags) 6702 v0.AddArg2(y, x) 6703 v.AddArg(v0) 6704 return true 6705 } 6706 // match: (CMPWU x (MOVWreg y)) 6707 // result: (CMPWU x y) 6708 for { 6709 x := v_0 6710 if v_1.Op != OpS390XMOVWreg { 6711 break 6712 } 6713 y := v_1.Args[0] 6714 v.reset(OpS390XCMPWU) 6715 v.AddArg2(x, y) 6716 return true 6717 } 6718 // match: (CMPWU x (MOVWZreg y)) 6719 // result: (CMPWU x y) 6720 for { 6721 x := v_0 6722 if v_1.Op != OpS390XMOVWZreg { 6723 break 6724 } 6725 y := v_1.Args[0] 6726 v.reset(OpS390XCMPWU) 6727 v.AddArg2(x, y) 6728 return true 6729 } 6730 // match: (CMPWU (MOVWreg x) y) 6731 // result: (CMPWU x y) 6732 for { 6733 if v_0.Op != OpS390XMOVWreg { 6734 break 6735 } 6736 x := v_0.Args[0] 6737 y := v_1 6738 v.reset(OpS390XCMPWU) 6739 v.AddArg2(x, y) 6740 return true 6741 } 6742 // match: (CMPWU (MOVWZreg x) y) 6743 // result: (CMPWU x y) 6744 for { 6745 if v_0.Op != OpS390XMOVWZreg { 6746 break 6747 } 6748 x := v_0.Args[0] 6749 y := v_1 6750 v.reset(OpS390XCMPWU) 6751 v.AddArg2(x, y) 6752 return true 6753 } 6754 return false 6755 } 6756 func rewriteValueS390X_OpS390XCMPWUconst(v *Value) bool { 6757 v_0 := v.Args[0] 6758 // match: (CMPWUconst (MOVDconst [x]) [y]) 6759 // cond: uint32(x)==uint32(y) 6760 // result: (FlagEQ) 6761 for { 6762 y := auxIntToInt32(v.AuxInt) 6763 if v_0.Op != OpS390XMOVDconst { 6764 break 6765 } 6766 x := auxIntToInt64(v_0.AuxInt) 6767 if !(uint32(x) == uint32(y)) { 6768 break 6769 } 6770 v.reset(OpS390XFlagEQ) 6771 return true 6772 } 6773 // match: (CMPWUconst (MOVDconst [x]) [y]) 6774 // cond: uint32(x)<uint32(y) 6775 // result: (FlagLT) 6776 for { 6777 y := auxIntToInt32(v.AuxInt) 6778 if v_0.Op != OpS390XMOVDconst { 6779 break 6780 } 6781 x := auxIntToInt64(v_0.AuxInt) 6782 if !(uint32(x) < uint32(y)) { 6783 break 6784 } 6785 v.reset(OpS390XFlagLT) 6786 return true 6787 } 6788 // match: (CMPWUconst (MOVDconst [x]) [y]) 6789 // cond: uint32(x)>uint32(y) 6790 // result: (FlagGT) 6791 for { 6792 y := auxIntToInt32(v.AuxInt) 6793 if v_0.Op != OpS390XMOVDconst { 6794 break 6795 } 6796 x := auxIntToInt64(v_0.AuxInt) 6797 if !(uint32(x) > uint32(y)) { 6798 break 6799 } 6800 v.reset(OpS390XFlagGT) 6801 return true 6802 } 6803 // match: (CMPWUconst (MOVBZreg _) [c]) 6804 // cond: 0xff < c 6805 // result: (FlagLT) 6806 for { 6807 c := auxIntToInt32(v.AuxInt) 6808 if v_0.Op != OpS390XMOVBZreg || !(0xff < c) { 6809 break 6810 } 6811 v.reset(OpS390XFlagLT) 6812 return true 6813 } 6814 // match: (CMPWUconst (MOVHZreg _) [c]) 6815 // cond: 0xffff < c 6816 // result: (FlagLT) 6817 for { 6818 c := auxIntToInt32(v.AuxInt) 6819 if v_0.Op != OpS390XMOVHZreg || !(0xffff < c) { 6820 break 6821 } 6822 v.reset(OpS390XFlagLT) 6823 return true 6824 } 6825 // match: (CMPWUconst (SRWconst _ [c]) [n]) 6826 // cond: c > 0 && c < 32 && (1<<uint(32-c)) <= uint32(n) 6827 // result: (FlagLT) 6828 for { 6829 n := auxIntToInt32(v.AuxInt) 6830 if v_0.Op != OpS390XSRWconst { 6831 break 6832 } 6833 c := auxIntToUint8(v_0.AuxInt) 6834 if !(c > 0 && c < 32 && (1<<uint(32-c)) <= uint32(n)) { 6835 break 6836 } 6837 v.reset(OpS390XFlagLT) 6838 return true 6839 } 6840 // match: (CMPWUconst (ANDWconst _ [m]) [n]) 6841 // cond: uint32(m) < uint32(n) 6842 // result: (FlagLT) 6843 for { 6844 n := auxIntToInt32(v.AuxInt) 6845 if v_0.Op != OpS390XANDWconst { 6846 break 6847 } 6848 m := auxIntToInt32(v_0.AuxInt) 6849 if !(uint32(m) < uint32(n)) { 6850 break 6851 } 6852 v.reset(OpS390XFlagLT) 6853 return true 6854 } 6855 // match: (CMPWUconst (MOVWreg x) [c]) 6856 // result: (CMPWUconst x [c]) 6857 for { 6858 c := auxIntToInt32(v.AuxInt) 6859 if v_0.Op != OpS390XMOVWreg { 6860 break 6861 } 6862 x := v_0.Args[0] 6863 v.reset(OpS390XCMPWUconst) 6864 v.AuxInt = int32ToAuxInt(c) 6865 v.AddArg(x) 6866 return true 6867 } 6868 // match: (CMPWUconst (MOVWZreg x) [c]) 6869 // result: (CMPWUconst x [c]) 6870 for { 6871 c := auxIntToInt32(v.AuxInt) 6872 if v_0.Op != OpS390XMOVWZreg { 6873 break 6874 } 6875 x := v_0.Args[0] 6876 v.reset(OpS390XCMPWUconst) 6877 v.AuxInt = int32ToAuxInt(c) 6878 v.AddArg(x) 6879 return true 6880 } 6881 return false 6882 } 6883 func rewriteValueS390X_OpS390XCMPWconst(v *Value) bool { 6884 v_0 := v.Args[0] 6885 // match: (CMPWconst (MOVDconst [x]) [y]) 6886 // cond: int32(x)==int32(y) 6887 // result: (FlagEQ) 6888 for { 6889 y := auxIntToInt32(v.AuxInt) 6890 if v_0.Op != OpS390XMOVDconst { 6891 break 6892 } 6893 x := auxIntToInt64(v_0.AuxInt) 6894 if !(int32(x) == int32(y)) { 6895 break 6896 } 6897 v.reset(OpS390XFlagEQ) 6898 return true 6899 } 6900 // match: (CMPWconst (MOVDconst [x]) [y]) 6901 // cond: int32(x)<int32(y) 6902 // result: (FlagLT) 6903 for { 6904 y := auxIntToInt32(v.AuxInt) 6905 if v_0.Op != OpS390XMOVDconst { 6906 break 6907 } 6908 x := auxIntToInt64(v_0.AuxInt) 6909 if !(int32(x) < int32(y)) { 6910 break 6911 } 6912 v.reset(OpS390XFlagLT) 6913 return true 6914 } 6915 // match: (CMPWconst (MOVDconst [x]) [y]) 6916 // cond: int32(x)>int32(y) 6917 // result: (FlagGT) 6918 for { 6919 y := auxIntToInt32(v.AuxInt) 6920 if v_0.Op != OpS390XMOVDconst { 6921 break 6922 } 6923 x := auxIntToInt64(v_0.AuxInt) 6924 if !(int32(x) > int32(y)) { 6925 break 6926 } 6927 v.reset(OpS390XFlagGT) 6928 return true 6929 } 6930 // match: (CMPWconst (MOVBZreg _) [c]) 6931 // cond: 0xff < c 6932 // result: (FlagLT) 6933 for { 6934 c := auxIntToInt32(v.AuxInt) 6935 if v_0.Op != OpS390XMOVBZreg || !(0xff < c) { 6936 break 6937 } 6938 v.reset(OpS390XFlagLT) 6939 return true 6940 } 6941 // match: (CMPWconst (MOVHZreg _) [c]) 6942 // cond: 0xffff < c 6943 // result: (FlagLT) 6944 for { 6945 c := auxIntToInt32(v.AuxInt) 6946 if v_0.Op != OpS390XMOVHZreg || !(0xffff < c) { 6947 break 6948 } 6949 v.reset(OpS390XFlagLT) 6950 return true 6951 } 6952 // match: (CMPWconst (SRWconst _ [c]) [n]) 6953 // cond: c > 0 && n < 0 6954 // result: (FlagGT) 6955 for { 6956 n := auxIntToInt32(v.AuxInt) 6957 if v_0.Op != OpS390XSRWconst { 6958 break 6959 } 6960 c := auxIntToUint8(v_0.AuxInt) 6961 if !(c > 0 && n < 0) { 6962 break 6963 } 6964 v.reset(OpS390XFlagGT) 6965 return true 6966 } 6967 // match: (CMPWconst (ANDWconst _ [m]) [n]) 6968 // cond: int32(m) >= 0 && int32(m) < int32(n) 6969 // result: (FlagLT) 6970 for { 6971 n := auxIntToInt32(v.AuxInt) 6972 if v_0.Op != OpS390XANDWconst { 6973 break 6974 } 6975 m := auxIntToInt32(v_0.AuxInt) 6976 if !(int32(m) >= 0 && int32(m) < int32(n)) { 6977 break 6978 } 6979 v.reset(OpS390XFlagLT) 6980 return true 6981 } 6982 // match: (CMPWconst x:(SRWconst _ [c]) [n]) 6983 // cond: c > 0 && n >= 0 6984 // result: (CMPWUconst x [n]) 6985 for { 6986 n := auxIntToInt32(v.AuxInt) 6987 x := v_0 6988 if x.Op != OpS390XSRWconst { 6989 break 6990 } 6991 c := auxIntToUint8(x.AuxInt) 6992 if !(c > 0 && n >= 0) { 6993 break 6994 } 6995 v.reset(OpS390XCMPWUconst) 6996 v.AuxInt = int32ToAuxInt(n) 6997 v.AddArg(x) 6998 return true 6999 } 7000 // match: (CMPWconst (MOVWreg x) [c]) 7001 // result: (CMPWconst x [c]) 7002 for { 7003 c := auxIntToInt32(v.AuxInt) 7004 if v_0.Op != OpS390XMOVWreg { 7005 break 7006 } 7007 x := v_0.Args[0] 7008 v.reset(OpS390XCMPWconst) 7009 v.AuxInt = int32ToAuxInt(c) 7010 v.AddArg(x) 7011 return true 7012 } 7013 // match: (CMPWconst (MOVWZreg x) [c]) 7014 // result: (CMPWconst x [c]) 7015 for { 7016 c := auxIntToInt32(v.AuxInt) 7017 if v_0.Op != OpS390XMOVWZreg { 7018 break 7019 } 7020 x := v_0.Args[0] 7021 v.reset(OpS390XCMPWconst) 7022 v.AuxInt = int32ToAuxInt(c) 7023 v.AddArg(x) 7024 return true 7025 } 7026 return false 7027 } 7028 func rewriteValueS390X_OpS390XCMPconst(v *Value) bool { 7029 v_0 := v.Args[0] 7030 // match: (CMPconst (MOVDconst [x]) [y]) 7031 // cond: x==int64(y) 7032 // result: (FlagEQ) 7033 for { 7034 y := auxIntToInt32(v.AuxInt) 7035 if v_0.Op != OpS390XMOVDconst { 7036 break 7037 } 7038 x := auxIntToInt64(v_0.AuxInt) 7039 if !(x == int64(y)) { 7040 break 7041 } 7042 v.reset(OpS390XFlagEQ) 7043 return true 7044 } 7045 // match: (CMPconst (MOVDconst [x]) [y]) 7046 // cond: x<int64(y) 7047 // result: (FlagLT) 7048 for { 7049 y := auxIntToInt32(v.AuxInt) 7050 if v_0.Op != OpS390XMOVDconst { 7051 break 7052 } 7053 x := auxIntToInt64(v_0.AuxInt) 7054 if !(x < int64(y)) { 7055 break 7056 } 7057 v.reset(OpS390XFlagLT) 7058 return true 7059 } 7060 // match: (CMPconst (MOVDconst [x]) [y]) 7061 // cond: x>int64(y) 7062 // result: (FlagGT) 7063 for { 7064 y := auxIntToInt32(v.AuxInt) 7065 if v_0.Op != OpS390XMOVDconst { 7066 break 7067 } 7068 x := auxIntToInt64(v_0.AuxInt) 7069 if !(x > int64(y)) { 7070 break 7071 } 7072 v.reset(OpS390XFlagGT) 7073 return true 7074 } 7075 // match: (CMPconst (SRDconst _ [c]) [n]) 7076 // cond: c > 0 && n < 0 7077 // result: (FlagGT) 7078 for { 7079 n := auxIntToInt32(v.AuxInt) 7080 if v_0.Op != OpS390XSRDconst { 7081 break 7082 } 7083 c := auxIntToUint8(v_0.AuxInt) 7084 if !(c > 0 && n < 0) { 7085 break 7086 } 7087 v.reset(OpS390XFlagGT) 7088 return true 7089 } 7090 // match: (CMPconst (RISBGZ x {r}) [c]) 7091 // cond: c > 0 && r.OutMask() < uint64(c) 7092 // result: (FlagLT) 7093 for { 7094 c := auxIntToInt32(v.AuxInt) 7095 if v_0.Op != OpS390XRISBGZ { 7096 break 7097 } 7098 r := auxToS390xRotateParams(v_0.Aux) 7099 if !(c > 0 && r.OutMask() < uint64(c)) { 7100 break 7101 } 7102 v.reset(OpS390XFlagLT) 7103 return true 7104 } 7105 // match: (CMPconst (MOVWreg x) [c]) 7106 // result: (CMPWconst x [c]) 7107 for { 7108 c := auxIntToInt32(v.AuxInt) 7109 if v_0.Op != OpS390XMOVWreg { 7110 break 7111 } 7112 x := v_0.Args[0] 7113 v.reset(OpS390XCMPWconst) 7114 v.AuxInt = int32ToAuxInt(c) 7115 v.AddArg(x) 7116 return true 7117 } 7118 // match: (CMPconst x:(MOVHreg _) [c]) 7119 // result: (CMPWconst x [c]) 7120 for { 7121 c := auxIntToInt32(v.AuxInt) 7122 x := v_0 7123 if x.Op != OpS390XMOVHreg { 7124 break 7125 } 7126 v.reset(OpS390XCMPWconst) 7127 v.AuxInt = int32ToAuxInt(c) 7128 v.AddArg(x) 7129 return true 7130 } 7131 // match: (CMPconst x:(MOVHZreg _) [c]) 7132 // result: (CMPWconst x [c]) 7133 for { 7134 c := auxIntToInt32(v.AuxInt) 7135 x := v_0 7136 if x.Op != OpS390XMOVHZreg { 7137 break 7138 } 7139 v.reset(OpS390XCMPWconst) 7140 v.AuxInt = int32ToAuxInt(c) 7141 v.AddArg(x) 7142 return true 7143 } 7144 // match: (CMPconst x:(MOVBreg _) [c]) 7145 // result: (CMPWconst x [c]) 7146 for { 7147 c := auxIntToInt32(v.AuxInt) 7148 x := v_0 7149 if x.Op != OpS390XMOVBreg { 7150 break 7151 } 7152 v.reset(OpS390XCMPWconst) 7153 v.AuxInt = int32ToAuxInt(c) 7154 v.AddArg(x) 7155 return true 7156 } 7157 // match: (CMPconst x:(MOVBZreg _) [c]) 7158 // result: (CMPWconst x [c]) 7159 for { 7160 c := auxIntToInt32(v.AuxInt) 7161 x := v_0 7162 if x.Op != OpS390XMOVBZreg { 7163 break 7164 } 7165 v.reset(OpS390XCMPWconst) 7166 v.AuxInt = int32ToAuxInt(c) 7167 v.AddArg(x) 7168 return true 7169 } 7170 // match: (CMPconst (MOVWZreg x:(ANDWconst [m] _)) [c]) 7171 // cond: int32(m) >= 0 && c >= 0 7172 // result: (CMPWUconst x [c]) 7173 for { 7174 c := auxIntToInt32(v.AuxInt) 7175 if v_0.Op != OpS390XMOVWZreg { 7176 break 7177 } 7178 x := v_0.Args[0] 7179 if x.Op != OpS390XANDWconst { 7180 break 7181 } 7182 m := auxIntToInt32(x.AuxInt) 7183 if !(int32(m) >= 0 && c >= 0) { 7184 break 7185 } 7186 v.reset(OpS390XCMPWUconst) 7187 v.AuxInt = int32ToAuxInt(c) 7188 v.AddArg(x) 7189 return true 7190 } 7191 // match: (CMPconst (MOVWreg x:(ANDWconst [m] _)) [c]) 7192 // cond: int32(m) >= 0 && c >= 0 7193 // result: (CMPWUconst x [c]) 7194 for { 7195 c := auxIntToInt32(v.AuxInt) 7196 if v_0.Op != OpS390XMOVWreg { 7197 break 7198 } 7199 x := v_0.Args[0] 7200 if x.Op != OpS390XANDWconst { 7201 break 7202 } 7203 m := auxIntToInt32(x.AuxInt) 7204 if !(int32(m) >= 0 && c >= 0) { 7205 break 7206 } 7207 v.reset(OpS390XCMPWUconst) 7208 v.AuxInt = int32ToAuxInt(c) 7209 v.AddArg(x) 7210 return true 7211 } 7212 // match: (CMPconst x:(SRDconst _ [c]) [n]) 7213 // cond: c > 0 && n >= 0 7214 // result: (CMPUconst x [n]) 7215 for { 7216 n := auxIntToInt32(v.AuxInt) 7217 x := v_0 7218 if x.Op != OpS390XSRDconst { 7219 break 7220 } 7221 c := auxIntToUint8(x.AuxInt) 7222 if !(c > 0 && n >= 0) { 7223 break 7224 } 7225 v.reset(OpS390XCMPUconst) 7226 v.AuxInt = int32ToAuxInt(n) 7227 v.AddArg(x) 7228 return true 7229 } 7230 return false 7231 } 7232 func rewriteValueS390X_OpS390XCPSDR(v *Value) bool { 7233 v_1 := v.Args[1] 7234 v_0 := v.Args[0] 7235 // match: (CPSDR y (FMOVDconst [c])) 7236 // cond: !math.Signbit(c) 7237 // result: (LPDFR y) 7238 for { 7239 y := v_0 7240 if v_1.Op != OpS390XFMOVDconst { 7241 break 7242 } 7243 c := auxIntToFloat64(v_1.AuxInt) 7244 if !(!math.Signbit(c)) { 7245 break 7246 } 7247 v.reset(OpS390XLPDFR) 7248 v.AddArg(y) 7249 return true 7250 } 7251 // match: (CPSDR y (FMOVDconst [c])) 7252 // cond: math.Signbit(c) 7253 // result: (LNDFR y) 7254 for { 7255 y := v_0 7256 if v_1.Op != OpS390XFMOVDconst { 7257 break 7258 } 7259 c := auxIntToFloat64(v_1.AuxInt) 7260 if !(math.Signbit(c)) { 7261 break 7262 } 7263 v.reset(OpS390XLNDFR) 7264 v.AddArg(y) 7265 return true 7266 } 7267 return false 7268 } 7269 func rewriteValueS390X_OpS390XFCMP(v *Value) bool { 7270 v_1 := v.Args[1] 7271 v_0 := v.Args[0] 7272 b := v.Block 7273 // match: (FCMP x (FMOVDconst [0.0])) 7274 // result: (LTDBR x) 7275 for { 7276 x := v_0 7277 if v_1.Op != OpS390XFMOVDconst || auxIntToFloat64(v_1.AuxInt) != 0.0 { 7278 break 7279 } 7280 v.reset(OpS390XLTDBR) 7281 v.AddArg(x) 7282 return true 7283 } 7284 // match: (FCMP (FMOVDconst [0.0]) x) 7285 // result: (InvertFlags (LTDBR <v.Type> x)) 7286 for { 7287 if v_0.Op != OpS390XFMOVDconst || auxIntToFloat64(v_0.AuxInt) != 0.0 { 7288 break 7289 } 7290 x := v_1 7291 v.reset(OpS390XInvertFlags) 7292 v0 := b.NewValue0(v.Pos, OpS390XLTDBR, v.Type) 7293 v0.AddArg(x) 7294 v.AddArg(v0) 7295 return true 7296 } 7297 return false 7298 } 7299 func rewriteValueS390X_OpS390XFCMPS(v *Value) bool { 7300 v_1 := v.Args[1] 7301 v_0 := v.Args[0] 7302 b := v.Block 7303 // match: (FCMPS x (FMOVSconst [0.0])) 7304 // result: (LTEBR x) 7305 for { 7306 x := v_0 7307 if v_1.Op != OpS390XFMOVSconst || auxIntToFloat32(v_1.AuxInt) != 0.0 { 7308 break 7309 } 7310 v.reset(OpS390XLTEBR) 7311 v.AddArg(x) 7312 return true 7313 } 7314 // match: (FCMPS (FMOVSconst [0.0]) x) 7315 // result: (InvertFlags (LTEBR <v.Type> x)) 7316 for { 7317 if v_0.Op != OpS390XFMOVSconst || auxIntToFloat32(v_0.AuxInt) != 0.0 { 7318 break 7319 } 7320 x := v_1 7321 v.reset(OpS390XInvertFlags) 7322 v0 := b.NewValue0(v.Pos, OpS390XLTEBR, v.Type) 7323 v0.AddArg(x) 7324 v.AddArg(v0) 7325 return true 7326 } 7327 return false 7328 } 7329 func rewriteValueS390X_OpS390XFMOVDload(v *Value) bool { 7330 v_1 := v.Args[1] 7331 v_0 := v.Args[0] 7332 // match: (FMOVDload [off] {sym} ptr1 (MOVDstore [off] {sym} ptr2 x _)) 7333 // cond: isSamePtr(ptr1, ptr2) 7334 // result: (LDGR x) 7335 for { 7336 off := auxIntToInt32(v.AuxInt) 7337 sym := auxToSym(v.Aux) 7338 ptr1 := v_0 7339 if v_1.Op != OpS390XMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 7340 break 7341 } 7342 x := v_1.Args[1] 7343 ptr2 := v_1.Args[0] 7344 if !(isSamePtr(ptr1, ptr2)) { 7345 break 7346 } 7347 v.reset(OpS390XLDGR) 7348 v.AddArg(x) 7349 return true 7350 } 7351 // match: (FMOVDload [off] {sym} ptr1 (FMOVDstore [off] {sym} ptr2 x _)) 7352 // cond: isSamePtr(ptr1, ptr2) 7353 // result: x 7354 for { 7355 off := auxIntToInt32(v.AuxInt) 7356 sym := auxToSym(v.Aux) 7357 ptr1 := v_0 7358 if v_1.Op != OpS390XFMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 7359 break 7360 } 7361 x := v_1.Args[1] 7362 ptr2 := v_1.Args[0] 7363 if !(isSamePtr(ptr1, ptr2)) { 7364 break 7365 } 7366 v.copyOf(x) 7367 return true 7368 } 7369 // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem) 7370 // cond: is20Bit(int64(off1)+int64(off2)) 7371 // result: (FMOVDload [off1+off2] {sym} ptr mem) 7372 for { 7373 off1 := auxIntToInt32(v.AuxInt) 7374 sym := auxToSym(v.Aux) 7375 if v_0.Op != OpS390XADDconst { 7376 break 7377 } 7378 off2 := auxIntToInt32(v_0.AuxInt) 7379 ptr := v_0.Args[0] 7380 mem := v_1 7381 if !(is20Bit(int64(off1) + int64(off2))) { 7382 break 7383 } 7384 v.reset(OpS390XFMOVDload) 7385 v.AuxInt = int32ToAuxInt(off1 + off2) 7386 v.Aux = symToAux(sym) 7387 v.AddArg2(ptr, mem) 7388 return true 7389 } 7390 // match: (FMOVDload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) 7391 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 7392 // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem) 7393 for { 7394 off1 := auxIntToInt32(v.AuxInt) 7395 sym1 := auxToSym(v.Aux) 7396 if v_0.Op != OpS390XMOVDaddr { 7397 break 7398 } 7399 off2 := auxIntToInt32(v_0.AuxInt) 7400 sym2 := auxToSym(v_0.Aux) 7401 base := v_0.Args[0] 7402 mem := v_1 7403 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 7404 break 7405 } 7406 v.reset(OpS390XFMOVDload) 7407 v.AuxInt = int32ToAuxInt(off1 + off2) 7408 v.Aux = symToAux(mergeSym(sym1, sym2)) 7409 v.AddArg2(base, mem) 7410 return true 7411 } 7412 return false 7413 } 7414 func rewriteValueS390X_OpS390XFMOVDstore(v *Value) bool { 7415 v_2 := v.Args[2] 7416 v_1 := v.Args[1] 7417 v_0 := v.Args[0] 7418 // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem) 7419 // cond: is20Bit(int64(off1)+int64(off2)) 7420 // result: (FMOVDstore [off1+off2] {sym} ptr val mem) 7421 for { 7422 off1 := auxIntToInt32(v.AuxInt) 7423 sym := auxToSym(v.Aux) 7424 if v_0.Op != OpS390XADDconst { 7425 break 7426 } 7427 off2 := auxIntToInt32(v_0.AuxInt) 7428 ptr := v_0.Args[0] 7429 val := v_1 7430 mem := v_2 7431 if !(is20Bit(int64(off1) + int64(off2))) { 7432 break 7433 } 7434 v.reset(OpS390XFMOVDstore) 7435 v.AuxInt = int32ToAuxInt(off1 + off2) 7436 v.Aux = symToAux(sym) 7437 v.AddArg3(ptr, val, mem) 7438 return true 7439 } 7440 // match: (FMOVDstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem) 7441 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 7442 // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 7443 for { 7444 off1 := auxIntToInt32(v.AuxInt) 7445 sym1 := auxToSym(v.Aux) 7446 if v_0.Op != OpS390XMOVDaddr { 7447 break 7448 } 7449 off2 := auxIntToInt32(v_0.AuxInt) 7450 sym2 := auxToSym(v_0.Aux) 7451 base := v_0.Args[0] 7452 val := v_1 7453 mem := v_2 7454 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 7455 break 7456 } 7457 v.reset(OpS390XFMOVDstore) 7458 v.AuxInt = int32ToAuxInt(off1 + off2) 7459 v.Aux = symToAux(mergeSym(sym1, sym2)) 7460 v.AddArg3(base, val, mem) 7461 return true 7462 } 7463 return false 7464 } 7465 func rewriteValueS390X_OpS390XFMOVSload(v *Value) bool { 7466 v_1 := v.Args[1] 7467 v_0 := v.Args[0] 7468 // match: (FMOVSload [off] {sym} ptr1 (FMOVSstore [off] {sym} ptr2 x _)) 7469 // cond: isSamePtr(ptr1, ptr2) 7470 // result: x 7471 for { 7472 off := auxIntToInt32(v.AuxInt) 7473 sym := auxToSym(v.Aux) 7474 ptr1 := v_0 7475 if v_1.Op != OpS390XFMOVSstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 7476 break 7477 } 7478 x := v_1.Args[1] 7479 ptr2 := v_1.Args[0] 7480 if !(isSamePtr(ptr1, ptr2)) { 7481 break 7482 } 7483 v.copyOf(x) 7484 return true 7485 } 7486 // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem) 7487 // cond: is20Bit(int64(off1)+int64(off2)) 7488 // result: (FMOVSload [off1+off2] {sym} ptr mem) 7489 for { 7490 off1 := auxIntToInt32(v.AuxInt) 7491 sym := auxToSym(v.Aux) 7492 if v_0.Op != OpS390XADDconst { 7493 break 7494 } 7495 off2 := auxIntToInt32(v_0.AuxInt) 7496 ptr := v_0.Args[0] 7497 mem := v_1 7498 if !(is20Bit(int64(off1) + int64(off2))) { 7499 break 7500 } 7501 v.reset(OpS390XFMOVSload) 7502 v.AuxInt = int32ToAuxInt(off1 + off2) 7503 v.Aux = symToAux(sym) 7504 v.AddArg2(ptr, mem) 7505 return true 7506 } 7507 // match: (FMOVSload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) 7508 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 7509 // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} base mem) 7510 for { 7511 off1 := auxIntToInt32(v.AuxInt) 7512 sym1 := auxToSym(v.Aux) 7513 if v_0.Op != OpS390XMOVDaddr { 7514 break 7515 } 7516 off2 := auxIntToInt32(v_0.AuxInt) 7517 sym2 := auxToSym(v_0.Aux) 7518 base := v_0.Args[0] 7519 mem := v_1 7520 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 7521 break 7522 } 7523 v.reset(OpS390XFMOVSload) 7524 v.AuxInt = int32ToAuxInt(off1 + off2) 7525 v.Aux = symToAux(mergeSym(sym1, sym2)) 7526 v.AddArg2(base, mem) 7527 return true 7528 } 7529 return false 7530 } 7531 func rewriteValueS390X_OpS390XFMOVSstore(v *Value) bool { 7532 v_2 := v.Args[2] 7533 v_1 := v.Args[1] 7534 v_0 := v.Args[0] 7535 // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem) 7536 // cond: is20Bit(int64(off1)+int64(off2)) 7537 // result: (FMOVSstore [off1+off2] {sym} ptr val mem) 7538 for { 7539 off1 := auxIntToInt32(v.AuxInt) 7540 sym := auxToSym(v.Aux) 7541 if v_0.Op != OpS390XADDconst { 7542 break 7543 } 7544 off2 := auxIntToInt32(v_0.AuxInt) 7545 ptr := v_0.Args[0] 7546 val := v_1 7547 mem := v_2 7548 if !(is20Bit(int64(off1) + int64(off2))) { 7549 break 7550 } 7551 v.reset(OpS390XFMOVSstore) 7552 v.AuxInt = int32ToAuxInt(off1 + off2) 7553 v.Aux = symToAux(sym) 7554 v.AddArg3(ptr, val, mem) 7555 return true 7556 } 7557 // match: (FMOVSstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem) 7558 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 7559 // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 7560 for { 7561 off1 := auxIntToInt32(v.AuxInt) 7562 sym1 := auxToSym(v.Aux) 7563 if v_0.Op != OpS390XMOVDaddr { 7564 break 7565 } 7566 off2 := auxIntToInt32(v_0.AuxInt) 7567 sym2 := auxToSym(v_0.Aux) 7568 base := v_0.Args[0] 7569 val := v_1 7570 mem := v_2 7571 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 7572 break 7573 } 7574 v.reset(OpS390XFMOVSstore) 7575 v.AuxInt = int32ToAuxInt(off1 + off2) 7576 v.Aux = symToAux(mergeSym(sym1, sym2)) 7577 v.AddArg3(base, val, mem) 7578 return true 7579 } 7580 return false 7581 } 7582 func rewriteValueS390X_OpS390XFNEG(v *Value) bool { 7583 v_0 := v.Args[0] 7584 // match: (FNEG (LPDFR x)) 7585 // result: (LNDFR x) 7586 for { 7587 if v_0.Op != OpS390XLPDFR { 7588 break 7589 } 7590 x := v_0.Args[0] 7591 v.reset(OpS390XLNDFR) 7592 v.AddArg(x) 7593 return true 7594 } 7595 // match: (FNEG (LNDFR x)) 7596 // result: (LPDFR x) 7597 for { 7598 if v_0.Op != OpS390XLNDFR { 7599 break 7600 } 7601 x := v_0.Args[0] 7602 v.reset(OpS390XLPDFR) 7603 v.AddArg(x) 7604 return true 7605 } 7606 return false 7607 } 7608 func rewriteValueS390X_OpS390XFNEGS(v *Value) bool { 7609 v_0 := v.Args[0] 7610 // match: (FNEGS (LPDFR x)) 7611 // result: (LNDFR x) 7612 for { 7613 if v_0.Op != OpS390XLPDFR { 7614 break 7615 } 7616 x := v_0.Args[0] 7617 v.reset(OpS390XLNDFR) 7618 v.AddArg(x) 7619 return true 7620 } 7621 // match: (FNEGS (LNDFR x)) 7622 // result: (LPDFR x) 7623 for { 7624 if v_0.Op != OpS390XLNDFR { 7625 break 7626 } 7627 x := v_0.Args[0] 7628 v.reset(OpS390XLPDFR) 7629 v.AddArg(x) 7630 return true 7631 } 7632 return false 7633 } 7634 func rewriteValueS390X_OpS390XLDGR(v *Value) bool { 7635 v_0 := v.Args[0] 7636 b := v.Block 7637 // match: (LDGR <t> (RISBGZ x {r})) 7638 // cond: r == s390x.NewRotateParams(1, 63, 0) 7639 // result: (LPDFR (LDGR <t> x)) 7640 for { 7641 t := v.Type 7642 if v_0.Op != OpS390XRISBGZ { 7643 break 7644 } 7645 r := auxToS390xRotateParams(v_0.Aux) 7646 x := v_0.Args[0] 7647 if !(r == s390x.NewRotateParams(1, 63, 0)) { 7648 break 7649 } 7650 v.reset(OpS390XLPDFR) 7651 v0 := b.NewValue0(v.Pos, OpS390XLDGR, t) 7652 v0.AddArg(x) 7653 v.AddArg(v0) 7654 return true 7655 } 7656 // match: (LDGR <t> (OR (MOVDconst [-1<<63]) x)) 7657 // result: (LNDFR (LDGR <t> x)) 7658 for { 7659 t := v.Type 7660 if v_0.Op != OpS390XOR { 7661 break 7662 } 7663 _ = v_0.Args[1] 7664 v_0_0 := v_0.Args[0] 7665 v_0_1 := v_0.Args[1] 7666 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 7667 if v_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0.AuxInt) != -1<<63 { 7668 continue 7669 } 7670 x := v_0_1 7671 v.reset(OpS390XLNDFR) 7672 v0 := b.NewValue0(v.Pos, OpS390XLDGR, t) 7673 v0.AddArg(x) 7674 v.AddArg(v0) 7675 return true 7676 } 7677 break 7678 } 7679 // match: (LDGR <t> x:(ORload <t1> [off] {sym} (MOVDconst [-1<<63]) ptr mem)) 7680 // cond: x.Uses == 1 && clobber(x) 7681 // result: @x.Block (LNDFR <t> (LDGR <t> (MOVDload <t1> [off] {sym} ptr mem))) 7682 for { 7683 t := v.Type 7684 x := v_0 7685 if x.Op != OpS390XORload { 7686 break 7687 } 7688 t1 := x.Type 7689 off := auxIntToInt32(x.AuxInt) 7690 sym := auxToSym(x.Aux) 7691 mem := x.Args[2] 7692 x_0 := x.Args[0] 7693 if x_0.Op != OpS390XMOVDconst || auxIntToInt64(x_0.AuxInt) != -1<<63 { 7694 break 7695 } 7696 ptr := x.Args[1] 7697 if !(x.Uses == 1 && clobber(x)) { 7698 break 7699 } 7700 b = x.Block 7701 v0 := b.NewValue0(x.Pos, OpS390XLNDFR, t) 7702 v.copyOf(v0) 7703 v1 := b.NewValue0(x.Pos, OpS390XLDGR, t) 7704 v2 := b.NewValue0(x.Pos, OpS390XMOVDload, t1) 7705 v2.AuxInt = int32ToAuxInt(off) 7706 v2.Aux = symToAux(sym) 7707 v2.AddArg2(ptr, mem) 7708 v1.AddArg(v2) 7709 v0.AddArg(v1) 7710 return true 7711 } 7712 // match: (LDGR (LGDR x)) 7713 // result: x 7714 for { 7715 if v_0.Op != OpS390XLGDR { 7716 break 7717 } 7718 x := v_0.Args[0] 7719 v.copyOf(x) 7720 return true 7721 } 7722 return false 7723 } 7724 func rewriteValueS390X_OpS390XLEDBR(v *Value) bool { 7725 v_0 := v.Args[0] 7726 // match: (LEDBR (LPDFR (LDEBR x))) 7727 // result: (LPDFR x) 7728 for { 7729 if v_0.Op != OpS390XLPDFR { 7730 break 7731 } 7732 v_0_0 := v_0.Args[0] 7733 if v_0_0.Op != OpS390XLDEBR { 7734 break 7735 } 7736 x := v_0_0.Args[0] 7737 v.reset(OpS390XLPDFR) 7738 v.AddArg(x) 7739 return true 7740 } 7741 // match: (LEDBR (LNDFR (LDEBR x))) 7742 // result: (LNDFR x) 7743 for { 7744 if v_0.Op != OpS390XLNDFR { 7745 break 7746 } 7747 v_0_0 := v_0.Args[0] 7748 if v_0_0.Op != OpS390XLDEBR { 7749 break 7750 } 7751 x := v_0_0.Args[0] 7752 v.reset(OpS390XLNDFR) 7753 v.AddArg(x) 7754 return true 7755 } 7756 return false 7757 } 7758 func rewriteValueS390X_OpS390XLGDR(v *Value) bool { 7759 v_0 := v.Args[0] 7760 // match: (LGDR (LDGR x)) 7761 // result: x 7762 for { 7763 if v_0.Op != OpS390XLDGR { 7764 break 7765 } 7766 x := v_0.Args[0] 7767 v.copyOf(x) 7768 return true 7769 } 7770 return false 7771 } 7772 func rewriteValueS390X_OpS390XLOCGR(v *Value) bool { 7773 v_2 := v.Args[2] 7774 v_1 := v.Args[1] 7775 v_0 := v.Args[0] 7776 // match: (LOCGR {c} x y (InvertFlags cmp)) 7777 // result: (LOCGR {c.ReverseComparison()} x y cmp) 7778 for { 7779 c := auxToS390xCCMask(v.Aux) 7780 x := v_0 7781 y := v_1 7782 if v_2.Op != OpS390XInvertFlags { 7783 break 7784 } 7785 cmp := v_2.Args[0] 7786 v.reset(OpS390XLOCGR) 7787 v.Aux = s390xCCMaskToAux(c.ReverseComparison()) 7788 v.AddArg3(x, y, cmp) 7789 return true 7790 } 7791 // match: (LOCGR {c} _ x (FlagEQ)) 7792 // cond: c&s390x.Equal != 0 7793 // result: x 7794 for { 7795 c := auxToS390xCCMask(v.Aux) 7796 x := v_1 7797 if v_2.Op != OpS390XFlagEQ || !(c&s390x.Equal != 0) { 7798 break 7799 } 7800 v.copyOf(x) 7801 return true 7802 } 7803 // match: (LOCGR {c} _ x (FlagLT)) 7804 // cond: c&s390x.Less != 0 7805 // result: x 7806 for { 7807 c := auxToS390xCCMask(v.Aux) 7808 x := v_1 7809 if v_2.Op != OpS390XFlagLT || !(c&s390x.Less != 0) { 7810 break 7811 } 7812 v.copyOf(x) 7813 return true 7814 } 7815 // match: (LOCGR {c} _ x (FlagGT)) 7816 // cond: c&s390x.Greater != 0 7817 // result: x 7818 for { 7819 c := auxToS390xCCMask(v.Aux) 7820 x := v_1 7821 if v_2.Op != OpS390XFlagGT || !(c&s390x.Greater != 0) { 7822 break 7823 } 7824 v.copyOf(x) 7825 return true 7826 } 7827 // match: (LOCGR {c} _ x (FlagOV)) 7828 // cond: c&s390x.Unordered != 0 7829 // result: x 7830 for { 7831 c := auxToS390xCCMask(v.Aux) 7832 x := v_1 7833 if v_2.Op != OpS390XFlagOV || !(c&s390x.Unordered != 0) { 7834 break 7835 } 7836 v.copyOf(x) 7837 return true 7838 } 7839 // match: (LOCGR {c} x _ (FlagEQ)) 7840 // cond: c&s390x.Equal == 0 7841 // result: x 7842 for { 7843 c := auxToS390xCCMask(v.Aux) 7844 x := v_0 7845 if v_2.Op != OpS390XFlagEQ || !(c&s390x.Equal == 0) { 7846 break 7847 } 7848 v.copyOf(x) 7849 return true 7850 } 7851 // match: (LOCGR {c} x _ (FlagLT)) 7852 // cond: c&s390x.Less == 0 7853 // result: x 7854 for { 7855 c := auxToS390xCCMask(v.Aux) 7856 x := v_0 7857 if v_2.Op != OpS390XFlagLT || !(c&s390x.Less == 0) { 7858 break 7859 } 7860 v.copyOf(x) 7861 return true 7862 } 7863 // match: (LOCGR {c} x _ (FlagGT)) 7864 // cond: c&s390x.Greater == 0 7865 // result: x 7866 for { 7867 c := auxToS390xCCMask(v.Aux) 7868 x := v_0 7869 if v_2.Op != OpS390XFlagGT || !(c&s390x.Greater == 0) { 7870 break 7871 } 7872 v.copyOf(x) 7873 return true 7874 } 7875 // match: (LOCGR {c} x _ (FlagOV)) 7876 // cond: c&s390x.Unordered == 0 7877 // result: x 7878 for { 7879 c := auxToS390xCCMask(v.Aux) 7880 x := v_0 7881 if v_2.Op != OpS390XFlagOV || !(c&s390x.Unordered == 0) { 7882 break 7883 } 7884 v.copyOf(x) 7885 return true 7886 } 7887 return false 7888 } 7889 func rewriteValueS390X_OpS390XLTDBR(v *Value) bool { 7890 v_0 := v.Args[0] 7891 b := v.Block 7892 // match: (LTDBR (Select0 x:(FADD _ _))) 7893 // cond: b == x.Block 7894 // result: (Select1 x) 7895 for { 7896 if v_0.Op != OpSelect0 { 7897 break 7898 } 7899 x := v_0.Args[0] 7900 if x.Op != OpS390XFADD || !(b == x.Block) { 7901 break 7902 } 7903 v.reset(OpSelect1) 7904 v.AddArg(x) 7905 return true 7906 } 7907 // match: (LTDBR (Select0 x:(FSUB _ _))) 7908 // cond: b == x.Block 7909 // result: (Select1 x) 7910 for { 7911 if v_0.Op != OpSelect0 { 7912 break 7913 } 7914 x := v_0.Args[0] 7915 if x.Op != OpS390XFSUB || !(b == x.Block) { 7916 break 7917 } 7918 v.reset(OpSelect1) 7919 v.AddArg(x) 7920 return true 7921 } 7922 return false 7923 } 7924 func rewriteValueS390X_OpS390XLTEBR(v *Value) bool { 7925 v_0 := v.Args[0] 7926 b := v.Block 7927 // match: (LTEBR (Select0 x:(FADDS _ _))) 7928 // cond: b == x.Block 7929 // result: (Select1 x) 7930 for { 7931 if v_0.Op != OpSelect0 { 7932 break 7933 } 7934 x := v_0.Args[0] 7935 if x.Op != OpS390XFADDS || !(b == x.Block) { 7936 break 7937 } 7938 v.reset(OpSelect1) 7939 v.AddArg(x) 7940 return true 7941 } 7942 // match: (LTEBR (Select0 x:(FSUBS _ _))) 7943 // cond: b == x.Block 7944 // result: (Select1 x) 7945 for { 7946 if v_0.Op != OpSelect0 { 7947 break 7948 } 7949 x := v_0.Args[0] 7950 if x.Op != OpS390XFSUBS || !(b == x.Block) { 7951 break 7952 } 7953 v.reset(OpSelect1) 7954 v.AddArg(x) 7955 return true 7956 } 7957 return false 7958 } 7959 func rewriteValueS390X_OpS390XLoweredRound32F(v *Value) bool { 7960 v_0 := v.Args[0] 7961 // match: (LoweredRound32F x:(FMOVSconst)) 7962 // result: x 7963 for { 7964 x := v_0 7965 if x.Op != OpS390XFMOVSconst { 7966 break 7967 } 7968 v.copyOf(x) 7969 return true 7970 } 7971 return false 7972 } 7973 func rewriteValueS390X_OpS390XLoweredRound64F(v *Value) bool { 7974 v_0 := v.Args[0] 7975 // match: (LoweredRound64F x:(FMOVDconst)) 7976 // result: x 7977 for { 7978 x := v_0 7979 if x.Op != OpS390XFMOVDconst { 7980 break 7981 } 7982 v.copyOf(x) 7983 return true 7984 } 7985 return false 7986 } 7987 func rewriteValueS390X_OpS390XMOVBZload(v *Value) bool { 7988 v_1 := v.Args[1] 7989 v_0 := v.Args[0] 7990 // match: (MOVBZload [off] {sym} ptr1 (MOVBstore [off] {sym} ptr2 x _)) 7991 // cond: isSamePtr(ptr1, ptr2) 7992 // result: (MOVBZreg x) 7993 for { 7994 off := auxIntToInt32(v.AuxInt) 7995 sym := auxToSym(v.Aux) 7996 ptr1 := v_0 7997 if v_1.Op != OpS390XMOVBstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 7998 break 7999 } 8000 x := v_1.Args[1] 8001 ptr2 := v_1.Args[0] 8002 if !(isSamePtr(ptr1, ptr2)) { 8003 break 8004 } 8005 v.reset(OpS390XMOVBZreg) 8006 v.AddArg(x) 8007 return true 8008 } 8009 // match: (MOVBZload [off1] {sym} (ADDconst [off2] ptr) mem) 8010 // cond: is20Bit(int64(off1)+int64(off2)) 8011 // result: (MOVBZload [off1+off2] {sym} ptr mem) 8012 for { 8013 off1 := auxIntToInt32(v.AuxInt) 8014 sym := auxToSym(v.Aux) 8015 if v_0.Op != OpS390XADDconst { 8016 break 8017 } 8018 off2 := auxIntToInt32(v_0.AuxInt) 8019 ptr := v_0.Args[0] 8020 mem := v_1 8021 if !(is20Bit(int64(off1) + int64(off2))) { 8022 break 8023 } 8024 v.reset(OpS390XMOVBZload) 8025 v.AuxInt = int32ToAuxInt(off1 + off2) 8026 v.Aux = symToAux(sym) 8027 v.AddArg2(ptr, mem) 8028 return true 8029 } 8030 // match: (MOVBZload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) 8031 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 8032 // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} base mem) 8033 for { 8034 off1 := auxIntToInt32(v.AuxInt) 8035 sym1 := auxToSym(v.Aux) 8036 if v_0.Op != OpS390XMOVDaddr { 8037 break 8038 } 8039 off2 := auxIntToInt32(v_0.AuxInt) 8040 sym2 := auxToSym(v_0.Aux) 8041 base := v_0.Args[0] 8042 mem := v_1 8043 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 8044 break 8045 } 8046 v.reset(OpS390XMOVBZload) 8047 v.AuxInt = int32ToAuxInt(off1 + off2) 8048 v.Aux = symToAux(mergeSym(sym1, sym2)) 8049 v.AddArg2(base, mem) 8050 return true 8051 } 8052 return false 8053 } 8054 func rewriteValueS390X_OpS390XMOVBZreg(v *Value) bool { 8055 v_0 := v.Args[0] 8056 b := v.Block 8057 typ := &b.Func.Config.Types 8058 // match: (MOVBZreg e:(MOVBreg x)) 8059 // cond: clobberIfDead(e) 8060 // result: (MOVBZreg x) 8061 for { 8062 e := v_0 8063 if e.Op != OpS390XMOVBreg { 8064 break 8065 } 8066 x := e.Args[0] 8067 if !(clobberIfDead(e)) { 8068 break 8069 } 8070 v.reset(OpS390XMOVBZreg) 8071 v.AddArg(x) 8072 return true 8073 } 8074 // match: (MOVBZreg e:(MOVHreg x)) 8075 // cond: clobberIfDead(e) 8076 // result: (MOVBZreg x) 8077 for { 8078 e := v_0 8079 if e.Op != OpS390XMOVHreg { 8080 break 8081 } 8082 x := e.Args[0] 8083 if !(clobberIfDead(e)) { 8084 break 8085 } 8086 v.reset(OpS390XMOVBZreg) 8087 v.AddArg(x) 8088 return true 8089 } 8090 // match: (MOVBZreg e:(MOVWreg x)) 8091 // cond: clobberIfDead(e) 8092 // result: (MOVBZreg x) 8093 for { 8094 e := v_0 8095 if e.Op != OpS390XMOVWreg { 8096 break 8097 } 8098 x := e.Args[0] 8099 if !(clobberIfDead(e)) { 8100 break 8101 } 8102 v.reset(OpS390XMOVBZreg) 8103 v.AddArg(x) 8104 return true 8105 } 8106 // match: (MOVBZreg e:(MOVBZreg x)) 8107 // cond: clobberIfDead(e) 8108 // result: (MOVBZreg x) 8109 for { 8110 e := v_0 8111 if e.Op != OpS390XMOVBZreg { 8112 break 8113 } 8114 x := e.Args[0] 8115 if !(clobberIfDead(e)) { 8116 break 8117 } 8118 v.reset(OpS390XMOVBZreg) 8119 v.AddArg(x) 8120 return true 8121 } 8122 // match: (MOVBZreg e:(MOVHZreg x)) 8123 // cond: clobberIfDead(e) 8124 // result: (MOVBZreg x) 8125 for { 8126 e := v_0 8127 if e.Op != OpS390XMOVHZreg { 8128 break 8129 } 8130 x := e.Args[0] 8131 if !(clobberIfDead(e)) { 8132 break 8133 } 8134 v.reset(OpS390XMOVBZreg) 8135 v.AddArg(x) 8136 return true 8137 } 8138 // match: (MOVBZreg e:(MOVWZreg x)) 8139 // cond: clobberIfDead(e) 8140 // result: (MOVBZreg x) 8141 for { 8142 e := v_0 8143 if e.Op != OpS390XMOVWZreg { 8144 break 8145 } 8146 x := e.Args[0] 8147 if !(clobberIfDead(e)) { 8148 break 8149 } 8150 v.reset(OpS390XMOVBZreg) 8151 v.AddArg(x) 8152 return true 8153 } 8154 // match: (MOVBZreg x:(MOVBZload _ _)) 8155 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 8156 // result: x 8157 for { 8158 x := v_0 8159 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 8160 break 8161 } 8162 v.copyOf(x) 8163 return true 8164 } 8165 // match: (MOVBZreg <t> x:(MOVBload [o] {s} p mem)) 8166 // cond: x.Uses == 1 && clobber(x) 8167 // result: @x.Block (MOVBZload <t> [o] {s} p mem) 8168 for { 8169 t := v.Type 8170 x := v_0 8171 if x.Op != OpS390XMOVBload { 8172 break 8173 } 8174 o := auxIntToInt32(x.AuxInt) 8175 s := auxToSym(x.Aux) 8176 mem := x.Args[1] 8177 p := x.Args[0] 8178 if !(x.Uses == 1 && clobber(x)) { 8179 break 8180 } 8181 b = x.Block 8182 v0 := b.NewValue0(x.Pos, OpS390XMOVBZload, t) 8183 v.copyOf(v0) 8184 v0.AuxInt = int32ToAuxInt(o) 8185 v0.Aux = symToAux(s) 8186 v0.AddArg2(p, mem) 8187 return true 8188 } 8189 // match: (MOVBZreg x:(Arg <t>)) 8190 // cond: !t.IsSigned() && t.Size() == 1 8191 // result: x 8192 for { 8193 x := v_0 8194 if x.Op != OpArg { 8195 break 8196 } 8197 t := x.Type 8198 if !(!t.IsSigned() && t.Size() == 1) { 8199 break 8200 } 8201 v.copyOf(x) 8202 return true 8203 } 8204 // match: (MOVBZreg (MOVDconst [c])) 8205 // result: (MOVDconst [int64( uint8(c))]) 8206 for { 8207 if v_0.Op != OpS390XMOVDconst { 8208 break 8209 } 8210 c := auxIntToInt64(v_0.AuxInt) 8211 v.reset(OpS390XMOVDconst) 8212 v.AuxInt = int64ToAuxInt(int64(uint8(c))) 8213 return true 8214 } 8215 // match: (MOVBZreg x:(LOCGR (MOVDconst [c]) (MOVDconst [d]) _)) 8216 // cond: int64(uint8(c)) == c && int64(uint8(d)) == d && (!x.Type.IsSigned() || x.Type.Size() > 1) 8217 // result: x 8218 for { 8219 x := v_0 8220 if x.Op != OpS390XLOCGR { 8221 break 8222 } 8223 _ = x.Args[1] 8224 x_0 := x.Args[0] 8225 if x_0.Op != OpS390XMOVDconst { 8226 break 8227 } 8228 c := auxIntToInt64(x_0.AuxInt) 8229 x_1 := x.Args[1] 8230 if x_1.Op != OpS390XMOVDconst { 8231 break 8232 } 8233 d := auxIntToInt64(x_1.AuxInt) 8234 if !(int64(uint8(c)) == c && int64(uint8(d)) == d && (!x.Type.IsSigned() || x.Type.Size() > 1)) { 8235 break 8236 } 8237 v.copyOf(x) 8238 return true 8239 } 8240 // match: (MOVBZreg (RISBGZ x {r})) 8241 // cond: r.OutMerge(0x000000ff) != nil 8242 // result: (RISBGZ x {*r.OutMerge(0x000000ff)}) 8243 for { 8244 if v_0.Op != OpS390XRISBGZ { 8245 break 8246 } 8247 r := auxToS390xRotateParams(v_0.Aux) 8248 x := v_0.Args[0] 8249 if !(r.OutMerge(0x000000ff) != nil) { 8250 break 8251 } 8252 v.reset(OpS390XRISBGZ) 8253 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0x000000ff)) 8254 v.AddArg(x) 8255 return true 8256 } 8257 // match: (MOVBZreg (ANDWconst [m] x)) 8258 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x)) 8259 for { 8260 if v_0.Op != OpS390XANDWconst { 8261 break 8262 } 8263 m := auxIntToInt32(v_0.AuxInt) 8264 x := v_0.Args[0] 8265 v.reset(OpS390XMOVWZreg) 8266 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 8267 v0.AuxInt = int32ToAuxInt(int32(uint8(m))) 8268 v0.AddArg(x) 8269 v.AddArg(v0) 8270 return true 8271 } 8272 return false 8273 } 8274 func rewriteValueS390X_OpS390XMOVBload(v *Value) bool { 8275 v_1 := v.Args[1] 8276 v_0 := v.Args[0] 8277 // match: (MOVBload [off] {sym} ptr1 (MOVBstore [off] {sym} ptr2 x _)) 8278 // cond: isSamePtr(ptr1, ptr2) 8279 // result: (MOVBreg x) 8280 for { 8281 off := auxIntToInt32(v.AuxInt) 8282 sym := auxToSym(v.Aux) 8283 ptr1 := v_0 8284 if v_1.Op != OpS390XMOVBstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 8285 break 8286 } 8287 x := v_1.Args[1] 8288 ptr2 := v_1.Args[0] 8289 if !(isSamePtr(ptr1, ptr2)) { 8290 break 8291 } 8292 v.reset(OpS390XMOVBreg) 8293 v.AddArg(x) 8294 return true 8295 } 8296 // match: (MOVBload [off1] {sym} (ADDconst [off2] ptr) mem) 8297 // cond: is20Bit(int64(off1)+int64(off2)) 8298 // result: (MOVBload [off1+off2] {sym} ptr mem) 8299 for { 8300 off1 := auxIntToInt32(v.AuxInt) 8301 sym := auxToSym(v.Aux) 8302 if v_0.Op != OpS390XADDconst { 8303 break 8304 } 8305 off2 := auxIntToInt32(v_0.AuxInt) 8306 ptr := v_0.Args[0] 8307 mem := v_1 8308 if !(is20Bit(int64(off1) + int64(off2))) { 8309 break 8310 } 8311 v.reset(OpS390XMOVBload) 8312 v.AuxInt = int32ToAuxInt(off1 + off2) 8313 v.Aux = symToAux(sym) 8314 v.AddArg2(ptr, mem) 8315 return true 8316 } 8317 // match: (MOVBload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) 8318 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 8319 // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem) 8320 for { 8321 off1 := auxIntToInt32(v.AuxInt) 8322 sym1 := auxToSym(v.Aux) 8323 if v_0.Op != OpS390XMOVDaddr { 8324 break 8325 } 8326 off2 := auxIntToInt32(v_0.AuxInt) 8327 sym2 := auxToSym(v_0.Aux) 8328 base := v_0.Args[0] 8329 mem := v_1 8330 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 8331 break 8332 } 8333 v.reset(OpS390XMOVBload) 8334 v.AuxInt = int32ToAuxInt(off1 + off2) 8335 v.Aux = symToAux(mergeSym(sym1, sym2)) 8336 v.AddArg2(base, mem) 8337 return true 8338 } 8339 return false 8340 } 8341 func rewriteValueS390X_OpS390XMOVBreg(v *Value) bool { 8342 v_0 := v.Args[0] 8343 b := v.Block 8344 typ := &b.Func.Config.Types 8345 // match: (MOVBreg e:(MOVBreg x)) 8346 // cond: clobberIfDead(e) 8347 // result: (MOVBreg x) 8348 for { 8349 e := v_0 8350 if e.Op != OpS390XMOVBreg { 8351 break 8352 } 8353 x := e.Args[0] 8354 if !(clobberIfDead(e)) { 8355 break 8356 } 8357 v.reset(OpS390XMOVBreg) 8358 v.AddArg(x) 8359 return true 8360 } 8361 // match: (MOVBreg e:(MOVHreg x)) 8362 // cond: clobberIfDead(e) 8363 // result: (MOVBreg x) 8364 for { 8365 e := v_0 8366 if e.Op != OpS390XMOVHreg { 8367 break 8368 } 8369 x := e.Args[0] 8370 if !(clobberIfDead(e)) { 8371 break 8372 } 8373 v.reset(OpS390XMOVBreg) 8374 v.AddArg(x) 8375 return true 8376 } 8377 // match: (MOVBreg e:(MOVWreg x)) 8378 // cond: clobberIfDead(e) 8379 // result: (MOVBreg x) 8380 for { 8381 e := v_0 8382 if e.Op != OpS390XMOVWreg { 8383 break 8384 } 8385 x := e.Args[0] 8386 if !(clobberIfDead(e)) { 8387 break 8388 } 8389 v.reset(OpS390XMOVBreg) 8390 v.AddArg(x) 8391 return true 8392 } 8393 // match: (MOVBreg e:(MOVBZreg x)) 8394 // cond: clobberIfDead(e) 8395 // result: (MOVBreg x) 8396 for { 8397 e := v_0 8398 if e.Op != OpS390XMOVBZreg { 8399 break 8400 } 8401 x := e.Args[0] 8402 if !(clobberIfDead(e)) { 8403 break 8404 } 8405 v.reset(OpS390XMOVBreg) 8406 v.AddArg(x) 8407 return true 8408 } 8409 // match: (MOVBreg e:(MOVHZreg x)) 8410 // cond: clobberIfDead(e) 8411 // result: (MOVBreg x) 8412 for { 8413 e := v_0 8414 if e.Op != OpS390XMOVHZreg { 8415 break 8416 } 8417 x := e.Args[0] 8418 if !(clobberIfDead(e)) { 8419 break 8420 } 8421 v.reset(OpS390XMOVBreg) 8422 v.AddArg(x) 8423 return true 8424 } 8425 // match: (MOVBreg e:(MOVWZreg x)) 8426 // cond: clobberIfDead(e) 8427 // result: (MOVBreg x) 8428 for { 8429 e := v_0 8430 if e.Op != OpS390XMOVWZreg { 8431 break 8432 } 8433 x := e.Args[0] 8434 if !(clobberIfDead(e)) { 8435 break 8436 } 8437 v.reset(OpS390XMOVBreg) 8438 v.AddArg(x) 8439 return true 8440 } 8441 // match: (MOVBreg x:(MOVBload _ _)) 8442 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 8443 // result: x 8444 for { 8445 x := v_0 8446 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 8447 break 8448 } 8449 v.copyOf(x) 8450 return true 8451 } 8452 // match: (MOVBreg <t> x:(MOVBZload [o] {s} p mem)) 8453 // cond: x.Uses == 1 && clobber(x) 8454 // result: @x.Block (MOVBload <t> [o] {s} p mem) 8455 for { 8456 t := v.Type 8457 x := v_0 8458 if x.Op != OpS390XMOVBZload { 8459 break 8460 } 8461 o := auxIntToInt32(x.AuxInt) 8462 s := auxToSym(x.Aux) 8463 mem := x.Args[1] 8464 p := x.Args[0] 8465 if !(x.Uses == 1 && clobber(x)) { 8466 break 8467 } 8468 b = x.Block 8469 v0 := b.NewValue0(x.Pos, OpS390XMOVBload, t) 8470 v.copyOf(v0) 8471 v0.AuxInt = int32ToAuxInt(o) 8472 v0.Aux = symToAux(s) 8473 v0.AddArg2(p, mem) 8474 return true 8475 } 8476 // match: (MOVBreg x:(Arg <t>)) 8477 // cond: t.IsSigned() && t.Size() == 1 8478 // result: x 8479 for { 8480 x := v_0 8481 if x.Op != OpArg { 8482 break 8483 } 8484 t := x.Type 8485 if !(t.IsSigned() && t.Size() == 1) { 8486 break 8487 } 8488 v.copyOf(x) 8489 return true 8490 } 8491 // match: (MOVBreg (MOVDconst [c])) 8492 // result: (MOVDconst [int64( int8(c))]) 8493 for { 8494 if v_0.Op != OpS390XMOVDconst { 8495 break 8496 } 8497 c := auxIntToInt64(v_0.AuxInt) 8498 v.reset(OpS390XMOVDconst) 8499 v.AuxInt = int64ToAuxInt(int64(int8(c))) 8500 return true 8501 } 8502 // match: (MOVBreg (ANDWconst [m] x)) 8503 // cond: int8(m) >= 0 8504 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x)) 8505 for { 8506 if v_0.Op != OpS390XANDWconst { 8507 break 8508 } 8509 m := auxIntToInt32(v_0.AuxInt) 8510 x := v_0.Args[0] 8511 if !(int8(m) >= 0) { 8512 break 8513 } 8514 v.reset(OpS390XMOVWZreg) 8515 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 8516 v0.AuxInt = int32ToAuxInt(int32(uint8(m))) 8517 v0.AddArg(x) 8518 v.AddArg(v0) 8519 return true 8520 } 8521 return false 8522 } 8523 func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { 8524 v_2 := v.Args[2] 8525 v_1 := v.Args[1] 8526 v_0 := v.Args[0] 8527 // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem) 8528 // result: (MOVBstore [off] {sym} ptr x mem) 8529 for { 8530 off := auxIntToInt32(v.AuxInt) 8531 sym := auxToSym(v.Aux) 8532 ptr := v_0 8533 if v_1.Op != OpS390XMOVBreg { 8534 break 8535 } 8536 x := v_1.Args[0] 8537 mem := v_2 8538 v.reset(OpS390XMOVBstore) 8539 v.AuxInt = int32ToAuxInt(off) 8540 v.Aux = symToAux(sym) 8541 v.AddArg3(ptr, x, mem) 8542 return true 8543 } 8544 // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem) 8545 // result: (MOVBstore [off] {sym} ptr x mem) 8546 for { 8547 off := auxIntToInt32(v.AuxInt) 8548 sym := auxToSym(v.Aux) 8549 ptr := v_0 8550 if v_1.Op != OpS390XMOVBZreg { 8551 break 8552 } 8553 x := v_1.Args[0] 8554 mem := v_2 8555 v.reset(OpS390XMOVBstore) 8556 v.AuxInt = int32ToAuxInt(off) 8557 v.Aux = symToAux(sym) 8558 v.AddArg3(ptr, x, mem) 8559 return true 8560 } 8561 // match: (MOVBstore [off1] {sym} (ADDconst [off2] ptr) val mem) 8562 // cond: is20Bit(int64(off1)+int64(off2)) 8563 // result: (MOVBstore [off1+off2] {sym} ptr val mem) 8564 for { 8565 off1 := auxIntToInt32(v.AuxInt) 8566 sym := auxToSym(v.Aux) 8567 if v_0.Op != OpS390XADDconst { 8568 break 8569 } 8570 off2 := auxIntToInt32(v_0.AuxInt) 8571 ptr := v_0.Args[0] 8572 val := v_1 8573 mem := v_2 8574 if !(is20Bit(int64(off1) + int64(off2))) { 8575 break 8576 } 8577 v.reset(OpS390XMOVBstore) 8578 v.AuxInt = int32ToAuxInt(off1 + off2) 8579 v.Aux = symToAux(sym) 8580 v.AddArg3(ptr, val, mem) 8581 return true 8582 } 8583 // match: (MOVBstore [off] {sym} ptr (MOVDconst [c]) mem) 8584 // cond: is20Bit(int64(off)) && ptr.Op != OpSB 8585 // result: (MOVBstoreconst [makeValAndOff(int32(int8(c)),off)] {sym} ptr mem) 8586 for { 8587 off := auxIntToInt32(v.AuxInt) 8588 sym := auxToSym(v.Aux) 8589 ptr := v_0 8590 if v_1.Op != OpS390XMOVDconst { 8591 break 8592 } 8593 c := auxIntToInt64(v_1.AuxInt) 8594 mem := v_2 8595 if !(is20Bit(int64(off)) && ptr.Op != OpSB) { 8596 break 8597 } 8598 v.reset(OpS390XMOVBstoreconst) 8599 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int8(c)), off)) 8600 v.Aux = symToAux(sym) 8601 v.AddArg2(ptr, mem) 8602 return true 8603 } 8604 // match: (MOVBstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem) 8605 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 8606 // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 8607 for { 8608 off1 := auxIntToInt32(v.AuxInt) 8609 sym1 := auxToSym(v.Aux) 8610 if v_0.Op != OpS390XMOVDaddr { 8611 break 8612 } 8613 off2 := auxIntToInt32(v_0.AuxInt) 8614 sym2 := auxToSym(v_0.Aux) 8615 base := v_0.Args[0] 8616 val := v_1 8617 mem := v_2 8618 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 8619 break 8620 } 8621 v.reset(OpS390XMOVBstore) 8622 v.AuxInt = int32ToAuxInt(off1 + off2) 8623 v.Aux = symToAux(mergeSym(sym1, sym2)) 8624 v.AddArg3(base, val, mem) 8625 return true 8626 } 8627 // match: (MOVBstore [i] {s} p w x:(MOVBstore [i-1] {s} p (SRDconst [8] w) mem)) 8628 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 8629 // result: (MOVHstore [i-1] {s} p w mem) 8630 for { 8631 i := auxIntToInt32(v.AuxInt) 8632 s := auxToSym(v.Aux) 8633 p := v_0 8634 w := v_1 8635 x := v_2 8636 if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 8637 break 8638 } 8639 mem := x.Args[2] 8640 if p != x.Args[0] { 8641 break 8642 } 8643 x_1 := x.Args[1] 8644 if x_1.Op != OpS390XSRDconst || auxIntToUint8(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 8645 break 8646 } 8647 v.reset(OpS390XMOVHstore) 8648 v.AuxInt = int32ToAuxInt(i - 1) 8649 v.Aux = symToAux(s) 8650 v.AddArg3(p, w, mem) 8651 return true 8652 } 8653 // match: (MOVBstore [i] {s} p w0:(SRDconst [j] w) x:(MOVBstore [i-1] {s} p (SRDconst [j+8] w) mem)) 8654 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 8655 // result: (MOVHstore [i-1] {s} p w0 mem) 8656 for { 8657 i := auxIntToInt32(v.AuxInt) 8658 s := auxToSym(v.Aux) 8659 p := v_0 8660 w0 := v_1 8661 if w0.Op != OpS390XSRDconst { 8662 break 8663 } 8664 j := auxIntToUint8(w0.AuxInt) 8665 w := w0.Args[0] 8666 x := v_2 8667 if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 8668 break 8669 } 8670 mem := x.Args[2] 8671 if p != x.Args[0] { 8672 break 8673 } 8674 x_1 := x.Args[1] 8675 if x_1.Op != OpS390XSRDconst || auxIntToUint8(x_1.AuxInt) != j+8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 8676 break 8677 } 8678 v.reset(OpS390XMOVHstore) 8679 v.AuxInt = int32ToAuxInt(i - 1) 8680 v.Aux = symToAux(s) 8681 v.AddArg3(p, w0, mem) 8682 return true 8683 } 8684 // match: (MOVBstore [i] {s} p w x:(MOVBstore [i-1] {s} p (SRWconst [8] w) mem)) 8685 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 8686 // result: (MOVHstore [i-1] {s} p w mem) 8687 for { 8688 i := auxIntToInt32(v.AuxInt) 8689 s := auxToSym(v.Aux) 8690 p := v_0 8691 w := v_1 8692 x := v_2 8693 if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 8694 break 8695 } 8696 mem := x.Args[2] 8697 if p != x.Args[0] { 8698 break 8699 } 8700 x_1 := x.Args[1] 8701 if x_1.Op != OpS390XSRWconst || auxIntToUint8(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 8702 break 8703 } 8704 v.reset(OpS390XMOVHstore) 8705 v.AuxInt = int32ToAuxInt(i - 1) 8706 v.Aux = symToAux(s) 8707 v.AddArg3(p, w, mem) 8708 return true 8709 } 8710 // match: (MOVBstore [i] {s} p w0:(SRWconst [j] w) x:(MOVBstore [i-1] {s} p (SRWconst [j+8] w) mem)) 8711 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 8712 // result: (MOVHstore [i-1] {s} p w0 mem) 8713 for { 8714 i := auxIntToInt32(v.AuxInt) 8715 s := auxToSym(v.Aux) 8716 p := v_0 8717 w0 := v_1 8718 if w0.Op != OpS390XSRWconst { 8719 break 8720 } 8721 j := auxIntToUint8(w0.AuxInt) 8722 w := w0.Args[0] 8723 x := v_2 8724 if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 8725 break 8726 } 8727 mem := x.Args[2] 8728 if p != x.Args[0] { 8729 break 8730 } 8731 x_1 := x.Args[1] 8732 if x_1.Op != OpS390XSRWconst || auxIntToUint8(x_1.AuxInt) != j+8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 8733 break 8734 } 8735 v.reset(OpS390XMOVHstore) 8736 v.AuxInt = int32ToAuxInt(i - 1) 8737 v.Aux = symToAux(s) 8738 v.AddArg3(p, w0, mem) 8739 return true 8740 } 8741 // match: (MOVBstore [i] {s} p (SRDconst [8] w) x:(MOVBstore [i-1] {s} p w mem)) 8742 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 8743 // result: (MOVHBRstore [i-1] {s} p w mem) 8744 for { 8745 i := auxIntToInt32(v.AuxInt) 8746 s := auxToSym(v.Aux) 8747 p := v_0 8748 if v_1.Op != OpS390XSRDconst || auxIntToUint8(v_1.AuxInt) != 8 { 8749 break 8750 } 8751 w := v_1.Args[0] 8752 x := v_2 8753 if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 8754 break 8755 } 8756 mem := x.Args[2] 8757 if p != x.Args[0] || w != x.Args[1] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 8758 break 8759 } 8760 v.reset(OpS390XMOVHBRstore) 8761 v.AuxInt = int32ToAuxInt(i - 1) 8762 v.Aux = symToAux(s) 8763 v.AddArg3(p, w, mem) 8764 return true 8765 } 8766 // match: (MOVBstore [i] {s} p (SRDconst [j] w) x:(MOVBstore [i-1] {s} p w0:(SRDconst [j-8] w) mem)) 8767 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 8768 // result: (MOVHBRstore [i-1] {s} p w0 mem) 8769 for { 8770 i := auxIntToInt32(v.AuxInt) 8771 s := auxToSym(v.Aux) 8772 p := v_0 8773 if v_1.Op != OpS390XSRDconst { 8774 break 8775 } 8776 j := auxIntToUint8(v_1.AuxInt) 8777 w := v_1.Args[0] 8778 x := v_2 8779 if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 8780 break 8781 } 8782 mem := x.Args[2] 8783 if p != x.Args[0] { 8784 break 8785 } 8786 w0 := x.Args[1] 8787 if w0.Op != OpS390XSRDconst || auxIntToUint8(w0.AuxInt) != j-8 || w != w0.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 8788 break 8789 } 8790 v.reset(OpS390XMOVHBRstore) 8791 v.AuxInt = int32ToAuxInt(i - 1) 8792 v.Aux = symToAux(s) 8793 v.AddArg3(p, w0, mem) 8794 return true 8795 } 8796 // match: (MOVBstore [i] {s} p (SRWconst [8] w) x:(MOVBstore [i-1] {s} p w mem)) 8797 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 8798 // result: (MOVHBRstore [i-1] {s} p w mem) 8799 for { 8800 i := auxIntToInt32(v.AuxInt) 8801 s := auxToSym(v.Aux) 8802 p := v_0 8803 if v_1.Op != OpS390XSRWconst || auxIntToUint8(v_1.AuxInt) != 8 { 8804 break 8805 } 8806 w := v_1.Args[0] 8807 x := v_2 8808 if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 8809 break 8810 } 8811 mem := x.Args[2] 8812 if p != x.Args[0] || w != x.Args[1] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 8813 break 8814 } 8815 v.reset(OpS390XMOVHBRstore) 8816 v.AuxInt = int32ToAuxInt(i - 1) 8817 v.Aux = symToAux(s) 8818 v.AddArg3(p, w, mem) 8819 return true 8820 } 8821 // match: (MOVBstore [i] {s} p (SRWconst [j] w) x:(MOVBstore [i-1] {s} p w0:(SRWconst [j-8] w) mem)) 8822 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 8823 // result: (MOVHBRstore [i-1] {s} p w0 mem) 8824 for { 8825 i := auxIntToInt32(v.AuxInt) 8826 s := auxToSym(v.Aux) 8827 p := v_0 8828 if v_1.Op != OpS390XSRWconst { 8829 break 8830 } 8831 j := auxIntToUint8(v_1.AuxInt) 8832 w := v_1.Args[0] 8833 x := v_2 8834 if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 8835 break 8836 } 8837 mem := x.Args[2] 8838 if p != x.Args[0] { 8839 break 8840 } 8841 w0 := x.Args[1] 8842 if w0.Op != OpS390XSRWconst || auxIntToUint8(w0.AuxInt) != j-8 || w != w0.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 8843 break 8844 } 8845 v.reset(OpS390XMOVHBRstore) 8846 v.AuxInt = int32ToAuxInt(i - 1) 8847 v.Aux = symToAux(s) 8848 v.AddArg3(p, w0, mem) 8849 return true 8850 } 8851 // match: (MOVBstore [7] {s} p1 (SRDconst w) x1:(MOVHBRstore [5] {s} p1 (SRDconst w) x2:(MOVWBRstore [1] {s} p1 (SRDconst w) x3:(MOVBstore [0] {s} p1 w mem)))) 8852 // cond: x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && clobber(x1, x2, x3) 8853 // result: (MOVDBRstore {s} p1 w mem) 8854 for { 8855 if auxIntToInt32(v.AuxInt) != 7 { 8856 break 8857 } 8858 s := auxToSym(v.Aux) 8859 p1 := v_0 8860 if v_1.Op != OpS390XSRDconst { 8861 break 8862 } 8863 w := v_1.Args[0] 8864 x1 := v_2 8865 if x1.Op != OpS390XMOVHBRstore || auxIntToInt32(x1.AuxInt) != 5 || auxToSym(x1.Aux) != s { 8866 break 8867 } 8868 _ = x1.Args[2] 8869 if p1 != x1.Args[0] { 8870 break 8871 } 8872 x1_1 := x1.Args[1] 8873 if x1_1.Op != OpS390XSRDconst || w != x1_1.Args[0] { 8874 break 8875 } 8876 x2 := x1.Args[2] 8877 if x2.Op != OpS390XMOVWBRstore || auxIntToInt32(x2.AuxInt) != 1 || auxToSym(x2.Aux) != s { 8878 break 8879 } 8880 _ = x2.Args[2] 8881 if p1 != x2.Args[0] { 8882 break 8883 } 8884 x2_1 := x2.Args[1] 8885 if x2_1.Op != OpS390XSRDconst || w != x2_1.Args[0] { 8886 break 8887 } 8888 x3 := x2.Args[2] 8889 if x3.Op != OpS390XMOVBstore || auxIntToInt32(x3.AuxInt) != 0 || auxToSym(x3.Aux) != s { 8890 break 8891 } 8892 mem := x3.Args[2] 8893 if p1 != x3.Args[0] || w != x3.Args[1] || !(x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && clobber(x1, x2, x3)) { 8894 break 8895 } 8896 v.reset(OpS390XMOVDBRstore) 8897 v.Aux = symToAux(s) 8898 v.AddArg3(p1, w, mem) 8899 return true 8900 } 8901 return false 8902 } 8903 func rewriteValueS390X_OpS390XMOVBstoreconst(v *Value) bool { 8904 v_1 := v.Args[1] 8905 v_0 := v.Args[0] 8906 // match: (MOVBstoreconst [sc] {s} (ADDconst [off] ptr) mem) 8907 // cond: is20Bit(sc.Off64()+int64(off)) 8908 // result: (MOVBstoreconst [sc.addOffset32(off)] {s} ptr mem) 8909 for { 8910 sc := auxIntToValAndOff(v.AuxInt) 8911 s := auxToSym(v.Aux) 8912 if v_0.Op != OpS390XADDconst { 8913 break 8914 } 8915 off := auxIntToInt32(v_0.AuxInt) 8916 ptr := v_0.Args[0] 8917 mem := v_1 8918 if !(is20Bit(sc.Off64() + int64(off))) { 8919 break 8920 } 8921 v.reset(OpS390XMOVBstoreconst) 8922 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 8923 v.Aux = symToAux(s) 8924 v.AddArg2(ptr, mem) 8925 return true 8926 } 8927 // match: (MOVBstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) 8928 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) 8929 // result: (MOVBstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 8930 for { 8931 sc := auxIntToValAndOff(v.AuxInt) 8932 sym1 := auxToSym(v.Aux) 8933 if v_0.Op != OpS390XMOVDaddr { 8934 break 8935 } 8936 off := auxIntToInt32(v_0.AuxInt) 8937 sym2 := auxToSym(v_0.Aux) 8938 ptr := v_0.Args[0] 8939 mem := v_1 8940 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { 8941 break 8942 } 8943 v.reset(OpS390XMOVBstoreconst) 8944 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 8945 v.Aux = symToAux(mergeSym(sym1, sym2)) 8946 v.AddArg2(ptr, mem) 8947 return true 8948 } 8949 // match: (MOVBstoreconst [c] {s} p x:(MOVBstoreconst [a] {s} p mem)) 8950 // cond: p.Op != OpSB && x.Uses == 1 && a.Off() + 1 == c.Off() && clobber(x) 8951 // result: (MOVHstoreconst [makeValAndOff(c.Val()&0xff | a.Val()<<8, a.Off())] {s} p mem) 8952 for { 8953 c := auxIntToValAndOff(v.AuxInt) 8954 s := auxToSym(v.Aux) 8955 p := v_0 8956 x := v_1 8957 if x.Op != OpS390XMOVBstoreconst { 8958 break 8959 } 8960 a := auxIntToValAndOff(x.AuxInt) 8961 if auxToSym(x.Aux) != s { 8962 break 8963 } 8964 mem := x.Args[1] 8965 if p != x.Args[0] || !(p.Op != OpSB && x.Uses == 1 && a.Off()+1 == c.Off() && clobber(x)) { 8966 break 8967 } 8968 v.reset(OpS390XMOVHstoreconst) 8969 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c.Val()&0xff|a.Val()<<8, a.Off())) 8970 v.Aux = symToAux(s) 8971 v.AddArg2(p, mem) 8972 return true 8973 } 8974 return false 8975 } 8976 func rewriteValueS390X_OpS390XMOVDaddridx(v *Value) bool { 8977 v_1 := v.Args[1] 8978 v_0 := v.Args[0] 8979 // match: (MOVDaddridx [c] {s} (ADDconst [d] x) y) 8980 // cond: is20Bit(int64(c)+int64(d)) 8981 // result: (MOVDaddridx [c+d] {s} x y) 8982 for { 8983 c := auxIntToInt32(v.AuxInt) 8984 s := auxToSym(v.Aux) 8985 if v_0.Op != OpS390XADDconst { 8986 break 8987 } 8988 d := auxIntToInt32(v_0.AuxInt) 8989 x := v_0.Args[0] 8990 y := v_1 8991 if !(is20Bit(int64(c) + int64(d))) { 8992 break 8993 } 8994 v.reset(OpS390XMOVDaddridx) 8995 v.AuxInt = int32ToAuxInt(c + d) 8996 v.Aux = symToAux(s) 8997 v.AddArg2(x, y) 8998 return true 8999 } 9000 // match: (MOVDaddridx [c] {s} x (ADDconst [d] y)) 9001 // cond: is20Bit(int64(c)+int64(d)) 9002 // result: (MOVDaddridx [c+d] {s} x y) 9003 for { 9004 c := auxIntToInt32(v.AuxInt) 9005 s := auxToSym(v.Aux) 9006 x := v_0 9007 if v_1.Op != OpS390XADDconst { 9008 break 9009 } 9010 d := auxIntToInt32(v_1.AuxInt) 9011 y := v_1.Args[0] 9012 if !(is20Bit(int64(c) + int64(d))) { 9013 break 9014 } 9015 v.reset(OpS390XMOVDaddridx) 9016 v.AuxInt = int32ToAuxInt(c + d) 9017 v.Aux = symToAux(s) 9018 v.AddArg2(x, y) 9019 return true 9020 } 9021 // match: (MOVDaddridx [off1] {sym1} (MOVDaddr [off2] {sym2} x) y) 9022 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB 9023 // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y) 9024 for { 9025 off1 := auxIntToInt32(v.AuxInt) 9026 sym1 := auxToSym(v.Aux) 9027 if v_0.Op != OpS390XMOVDaddr { 9028 break 9029 } 9030 off2 := auxIntToInt32(v_0.AuxInt) 9031 sym2 := auxToSym(v_0.Aux) 9032 x := v_0.Args[0] 9033 y := v_1 9034 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) { 9035 break 9036 } 9037 v.reset(OpS390XMOVDaddridx) 9038 v.AuxInt = int32ToAuxInt(off1 + off2) 9039 v.Aux = symToAux(mergeSym(sym1, sym2)) 9040 v.AddArg2(x, y) 9041 return true 9042 } 9043 // match: (MOVDaddridx [off1] {sym1} x (MOVDaddr [off2] {sym2} y)) 9044 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB 9045 // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y) 9046 for { 9047 off1 := auxIntToInt32(v.AuxInt) 9048 sym1 := auxToSym(v.Aux) 9049 x := v_0 9050 if v_1.Op != OpS390XMOVDaddr { 9051 break 9052 } 9053 off2 := auxIntToInt32(v_1.AuxInt) 9054 sym2 := auxToSym(v_1.Aux) 9055 y := v_1.Args[0] 9056 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB) { 9057 break 9058 } 9059 v.reset(OpS390XMOVDaddridx) 9060 v.AuxInt = int32ToAuxInt(off1 + off2) 9061 v.Aux = symToAux(mergeSym(sym1, sym2)) 9062 v.AddArg2(x, y) 9063 return true 9064 } 9065 return false 9066 } 9067 func rewriteValueS390X_OpS390XMOVDload(v *Value) bool { 9068 v_1 := v.Args[1] 9069 v_0 := v.Args[0] 9070 // match: (MOVDload [off] {sym} ptr1 (MOVDstore [off] {sym} ptr2 x _)) 9071 // cond: isSamePtr(ptr1, ptr2) 9072 // result: x 9073 for { 9074 off := auxIntToInt32(v.AuxInt) 9075 sym := auxToSym(v.Aux) 9076 ptr1 := v_0 9077 if v_1.Op != OpS390XMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 9078 break 9079 } 9080 x := v_1.Args[1] 9081 ptr2 := v_1.Args[0] 9082 if !(isSamePtr(ptr1, ptr2)) { 9083 break 9084 } 9085 v.copyOf(x) 9086 return true 9087 } 9088 // match: (MOVDload [off] {sym} ptr1 (FMOVDstore [off] {sym} ptr2 x _)) 9089 // cond: isSamePtr(ptr1, ptr2) 9090 // result: (LGDR x) 9091 for { 9092 off := auxIntToInt32(v.AuxInt) 9093 sym := auxToSym(v.Aux) 9094 ptr1 := v_0 9095 if v_1.Op != OpS390XFMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 9096 break 9097 } 9098 x := v_1.Args[1] 9099 ptr2 := v_1.Args[0] 9100 if !(isSamePtr(ptr1, ptr2)) { 9101 break 9102 } 9103 v.reset(OpS390XLGDR) 9104 v.AddArg(x) 9105 return true 9106 } 9107 // match: (MOVDload [off1] {sym} (ADDconst [off2] ptr) mem) 9108 // cond: is20Bit(int64(off1)+int64(off2)) 9109 // result: (MOVDload [off1+off2] {sym} ptr mem) 9110 for { 9111 off1 := auxIntToInt32(v.AuxInt) 9112 sym := auxToSym(v.Aux) 9113 if v_0.Op != OpS390XADDconst { 9114 break 9115 } 9116 off2 := auxIntToInt32(v_0.AuxInt) 9117 ptr := v_0.Args[0] 9118 mem := v_1 9119 if !(is20Bit(int64(off1) + int64(off2))) { 9120 break 9121 } 9122 v.reset(OpS390XMOVDload) 9123 v.AuxInt = int32ToAuxInt(off1 + off2) 9124 v.Aux = symToAux(sym) 9125 v.AddArg2(ptr, mem) 9126 return true 9127 } 9128 // match: (MOVDload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 9129 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0)) 9130 // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem) 9131 for { 9132 off1 := auxIntToInt32(v.AuxInt) 9133 sym1 := auxToSym(v.Aux) 9134 if v_0.Op != OpS390XMOVDaddr { 9135 break 9136 } 9137 t := v_0.Type 9138 off2 := auxIntToInt32(v_0.AuxInt) 9139 sym2 := auxToSym(v_0.Aux) 9140 base := v_0.Args[0] 9141 mem := v_1 9142 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) { 9143 break 9144 } 9145 v.reset(OpS390XMOVDload) 9146 v.AuxInt = int32ToAuxInt(off1 + off2) 9147 v.Aux = symToAux(mergeSym(sym1, sym2)) 9148 v.AddArg2(base, mem) 9149 return true 9150 } 9151 return false 9152 } 9153 func rewriteValueS390X_OpS390XMOVDstore(v *Value) bool { 9154 v_2 := v.Args[2] 9155 v_1 := v.Args[1] 9156 v_0 := v.Args[0] 9157 // match: (MOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem) 9158 // cond: is20Bit(int64(off1)+int64(off2)) 9159 // result: (MOVDstore [off1+off2] {sym} ptr val mem) 9160 for { 9161 off1 := auxIntToInt32(v.AuxInt) 9162 sym := auxToSym(v.Aux) 9163 if v_0.Op != OpS390XADDconst { 9164 break 9165 } 9166 off2 := auxIntToInt32(v_0.AuxInt) 9167 ptr := v_0.Args[0] 9168 val := v_1 9169 mem := v_2 9170 if !(is20Bit(int64(off1) + int64(off2))) { 9171 break 9172 } 9173 v.reset(OpS390XMOVDstore) 9174 v.AuxInt = int32ToAuxInt(off1 + off2) 9175 v.Aux = symToAux(sym) 9176 v.AddArg3(ptr, val, mem) 9177 return true 9178 } 9179 // match: (MOVDstore [off] {sym} ptr (MOVDconst [c]) mem) 9180 // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB 9181 // result: (MOVDstoreconst [makeValAndOff(int32(c),off)] {sym} ptr mem) 9182 for { 9183 off := auxIntToInt32(v.AuxInt) 9184 sym := auxToSym(v.Aux) 9185 ptr := v_0 9186 if v_1.Op != OpS390XMOVDconst { 9187 break 9188 } 9189 c := auxIntToInt64(v_1.AuxInt) 9190 mem := v_2 9191 if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) { 9192 break 9193 } 9194 v.reset(OpS390XMOVDstoreconst) 9195 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off)) 9196 v.Aux = symToAux(sym) 9197 v.AddArg2(ptr, mem) 9198 return true 9199 } 9200 // match: (MOVDstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem) 9201 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0)) 9202 // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 9203 for { 9204 off1 := auxIntToInt32(v.AuxInt) 9205 sym1 := auxToSym(v.Aux) 9206 if v_0.Op != OpS390XMOVDaddr { 9207 break 9208 } 9209 t := v_0.Type 9210 off2 := auxIntToInt32(v_0.AuxInt) 9211 sym2 := auxToSym(v_0.Aux) 9212 base := v_0.Args[0] 9213 val := v_1 9214 mem := v_2 9215 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) { 9216 break 9217 } 9218 v.reset(OpS390XMOVDstore) 9219 v.AuxInt = int32ToAuxInt(off1 + off2) 9220 v.Aux = symToAux(mergeSym(sym1, sym2)) 9221 v.AddArg3(base, val, mem) 9222 return true 9223 } 9224 // match: (MOVDstore [i] {s} p w1 x:(MOVDstore [i-8] {s} p w0 mem)) 9225 // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x) 9226 // result: (STMG2 [i-8] {s} p w0 w1 mem) 9227 for { 9228 i := auxIntToInt32(v.AuxInt) 9229 s := auxToSym(v.Aux) 9230 p := v_0 9231 w1 := v_1 9232 x := v_2 9233 if x.Op != OpS390XMOVDstore || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s { 9234 break 9235 } 9236 mem := x.Args[2] 9237 if p != x.Args[0] { 9238 break 9239 } 9240 w0 := x.Args[1] 9241 if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x)) { 9242 break 9243 } 9244 v.reset(OpS390XSTMG2) 9245 v.AuxInt = int32ToAuxInt(i - 8) 9246 v.Aux = symToAux(s) 9247 v.AddArg4(p, w0, w1, mem) 9248 return true 9249 } 9250 // match: (MOVDstore [i] {s} p w2 x:(STMG2 [i-16] {s} p w0 w1 mem)) 9251 // cond: x.Uses == 1 && is20Bit(int64(i)-16) && clobber(x) 9252 // result: (STMG3 [i-16] {s} p w0 w1 w2 mem) 9253 for { 9254 i := auxIntToInt32(v.AuxInt) 9255 s := auxToSym(v.Aux) 9256 p := v_0 9257 w2 := v_1 9258 x := v_2 9259 if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s { 9260 break 9261 } 9262 mem := x.Args[3] 9263 if p != x.Args[0] { 9264 break 9265 } 9266 w0 := x.Args[1] 9267 w1 := x.Args[2] 9268 if !(x.Uses == 1 && is20Bit(int64(i)-16) && clobber(x)) { 9269 break 9270 } 9271 v.reset(OpS390XSTMG3) 9272 v.AuxInt = int32ToAuxInt(i - 16) 9273 v.Aux = symToAux(s) 9274 v.AddArg5(p, w0, w1, w2, mem) 9275 return true 9276 } 9277 // match: (MOVDstore [i] {s} p w3 x:(STMG3 [i-24] {s} p w0 w1 w2 mem)) 9278 // cond: x.Uses == 1 && is20Bit(int64(i)-24) && clobber(x) 9279 // result: (STMG4 [i-24] {s} p w0 w1 w2 w3 mem) 9280 for { 9281 i := auxIntToInt32(v.AuxInt) 9282 s := auxToSym(v.Aux) 9283 p := v_0 9284 w3 := v_1 9285 x := v_2 9286 if x.Op != OpS390XSTMG3 || auxIntToInt32(x.AuxInt) != i-24 || auxToSym(x.Aux) != s { 9287 break 9288 } 9289 mem := x.Args[4] 9290 if p != x.Args[0] { 9291 break 9292 } 9293 w0 := x.Args[1] 9294 w1 := x.Args[2] 9295 w2 := x.Args[3] 9296 if !(x.Uses == 1 && is20Bit(int64(i)-24) && clobber(x)) { 9297 break 9298 } 9299 v.reset(OpS390XSTMG4) 9300 v.AuxInt = int32ToAuxInt(i - 24) 9301 v.Aux = symToAux(s) 9302 v.AddArg6(p, w0, w1, w2, w3, mem) 9303 return true 9304 } 9305 return false 9306 } 9307 func rewriteValueS390X_OpS390XMOVDstoreconst(v *Value) bool { 9308 v_1 := v.Args[1] 9309 v_0 := v.Args[0] 9310 // match: (MOVDstoreconst [sc] {s} (ADDconst [off] ptr) mem) 9311 // cond: isU12Bit(sc.Off64()+int64(off)) 9312 // result: (MOVDstoreconst [sc.addOffset32(off)] {s} ptr mem) 9313 for { 9314 sc := auxIntToValAndOff(v.AuxInt) 9315 s := auxToSym(v.Aux) 9316 if v_0.Op != OpS390XADDconst { 9317 break 9318 } 9319 off := auxIntToInt32(v_0.AuxInt) 9320 ptr := v_0.Args[0] 9321 mem := v_1 9322 if !(isU12Bit(sc.Off64() + int64(off))) { 9323 break 9324 } 9325 v.reset(OpS390XMOVDstoreconst) 9326 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 9327 v.Aux = symToAux(s) 9328 v.AddArg2(ptr, mem) 9329 return true 9330 } 9331 // match: (MOVDstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) 9332 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) 9333 // result: (MOVDstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 9334 for { 9335 sc := auxIntToValAndOff(v.AuxInt) 9336 sym1 := auxToSym(v.Aux) 9337 if v_0.Op != OpS390XMOVDaddr { 9338 break 9339 } 9340 off := auxIntToInt32(v_0.AuxInt) 9341 sym2 := auxToSym(v_0.Aux) 9342 ptr := v_0.Args[0] 9343 mem := v_1 9344 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { 9345 break 9346 } 9347 v.reset(OpS390XMOVDstoreconst) 9348 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 9349 v.Aux = symToAux(mergeSym(sym1, sym2)) 9350 v.AddArg2(ptr, mem) 9351 return true 9352 } 9353 return false 9354 } 9355 func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { 9356 v_2 := v.Args[2] 9357 v_1 := v.Args[1] 9358 v_0 := v.Args[0] 9359 // match: (MOVHBRstore [i] {s} p (SRDconst [16] w) x:(MOVHBRstore [i-2] {s} p w mem)) 9360 // cond: x.Uses == 1 && clobber(x) 9361 // result: (MOVWBRstore [i-2] {s} p w mem) 9362 for { 9363 i := auxIntToInt32(v.AuxInt) 9364 s := auxToSym(v.Aux) 9365 p := v_0 9366 if v_1.Op != OpS390XSRDconst || auxIntToUint8(v_1.AuxInt) != 16 { 9367 break 9368 } 9369 w := v_1.Args[0] 9370 x := v_2 9371 if x.Op != OpS390XMOVHBRstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 9372 break 9373 } 9374 mem := x.Args[2] 9375 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) { 9376 break 9377 } 9378 v.reset(OpS390XMOVWBRstore) 9379 v.AuxInt = int32ToAuxInt(i - 2) 9380 v.Aux = symToAux(s) 9381 v.AddArg3(p, w, mem) 9382 return true 9383 } 9384 // match: (MOVHBRstore [i] {s} p (SRDconst [j] w) x:(MOVHBRstore [i-2] {s} p w0:(SRDconst [j-16] w) mem)) 9385 // cond: x.Uses == 1 && clobber(x) 9386 // result: (MOVWBRstore [i-2] {s} p w0 mem) 9387 for { 9388 i := auxIntToInt32(v.AuxInt) 9389 s := auxToSym(v.Aux) 9390 p := v_0 9391 if v_1.Op != OpS390XSRDconst { 9392 break 9393 } 9394 j := auxIntToUint8(v_1.AuxInt) 9395 w := v_1.Args[0] 9396 x := v_2 9397 if x.Op != OpS390XMOVHBRstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 9398 break 9399 } 9400 mem := x.Args[2] 9401 if p != x.Args[0] { 9402 break 9403 } 9404 w0 := x.Args[1] 9405 if w0.Op != OpS390XSRDconst || auxIntToUint8(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { 9406 break 9407 } 9408 v.reset(OpS390XMOVWBRstore) 9409 v.AuxInt = int32ToAuxInt(i - 2) 9410 v.Aux = symToAux(s) 9411 v.AddArg3(p, w0, mem) 9412 return true 9413 } 9414 // match: (MOVHBRstore [i] {s} p (SRWconst [16] w) x:(MOVHBRstore [i-2] {s} p w mem)) 9415 // cond: x.Uses == 1 && clobber(x) 9416 // result: (MOVWBRstore [i-2] {s} p w mem) 9417 for { 9418 i := auxIntToInt32(v.AuxInt) 9419 s := auxToSym(v.Aux) 9420 p := v_0 9421 if v_1.Op != OpS390XSRWconst || auxIntToUint8(v_1.AuxInt) != 16 { 9422 break 9423 } 9424 w := v_1.Args[0] 9425 x := v_2 9426 if x.Op != OpS390XMOVHBRstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 9427 break 9428 } 9429 mem := x.Args[2] 9430 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) { 9431 break 9432 } 9433 v.reset(OpS390XMOVWBRstore) 9434 v.AuxInt = int32ToAuxInt(i - 2) 9435 v.Aux = symToAux(s) 9436 v.AddArg3(p, w, mem) 9437 return true 9438 } 9439 // match: (MOVHBRstore [i] {s} p (SRWconst [j] w) x:(MOVHBRstore [i-2] {s} p w0:(SRWconst [j-16] w) mem)) 9440 // cond: x.Uses == 1 && clobber(x) 9441 // result: (MOVWBRstore [i-2] {s} p w0 mem) 9442 for { 9443 i := auxIntToInt32(v.AuxInt) 9444 s := auxToSym(v.Aux) 9445 p := v_0 9446 if v_1.Op != OpS390XSRWconst { 9447 break 9448 } 9449 j := auxIntToUint8(v_1.AuxInt) 9450 w := v_1.Args[0] 9451 x := v_2 9452 if x.Op != OpS390XMOVHBRstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 9453 break 9454 } 9455 mem := x.Args[2] 9456 if p != x.Args[0] { 9457 break 9458 } 9459 w0 := x.Args[1] 9460 if w0.Op != OpS390XSRWconst || auxIntToUint8(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { 9461 break 9462 } 9463 v.reset(OpS390XMOVWBRstore) 9464 v.AuxInt = int32ToAuxInt(i - 2) 9465 v.Aux = symToAux(s) 9466 v.AddArg3(p, w0, mem) 9467 return true 9468 } 9469 return false 9470 } 9471 func rewriteValueS390X_OpS390XMOVHZload(v *Value) bool { 9472 v_1 := v.Args[1] 9473 v_0 := v.Args[0] 9474 // match: (MOVHZload [off] {sym} ptr1 (MOVHstore [off] {sym} ptr2 x _)) 9475 // cond: isSamePtr(ptr1, ptr2) 9476 // result: (MOVHZreg x) 9477 for { 9478 off := auxIntToInt32(v.AuxInt) 9479 sym := auxToSym(v.Aux) 9480 ptr1 := v_0 9481 if v_1.Op != OpS390XMOVHstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 9482 break 9483 } 9484 x := v_1.Args[1] 9485 ptr2 := v_1.Args[0] 9486 if !(isSamePtr(ptr1, ptr2)) { 9487 break 9488 } 9489 v.reset(OpS390XMOVHZreg) 9490 v.AddArg(x) 9491 return true 9492 } 9493 // match: (MOVHZload [off1] {sym} (ADDconst [off2] ptr) mem) 9494 // cond: is20Bit(int64(off1)+int64(off2)) 9495 // result: (MOVHZload [off1+off2] {sym} ptr mem) 9496 for { 9497 off1 := auxIntToInt32(v.AuxInt) 9498 sym := auxToSym(v.Aux) 9499 if v_0.Op != OpS390XADDconst { 9500 break 9501 } 9502 off2 := auxIntToInt32(v_0.AuxInt) 9503 ptr := v_0.Args[0] 9504 mem := v_1 9505 if !(is20Bit(int64(off1) + int64(off2))) { 9506 break 9507 } 9508 v.reset(OpS390XMOVHZload) 9509 v.AuxInt = int32ToAuxInt(off1 + off2) 9510 v.Aux = symToAux(sym) 9511 v.AddArg2(ptr, mem) 9512 return true 9513 } 9514 // match: (MOVHZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 9515 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) 9516 // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} base mem) 9517 for { 9518 off1 := auxIntToInt32(v.AuxInt) 9519 sym1 := auxToSym(v.Aux) 9520 if v_0.Op != OpS390XMOVDaddr { 9521 break 9522 } 9523 t := v_0.Type 9524 off2 := auxIntToInt32(v_0.AuxInt) 9525 sym2 := auxToSym(v_0.Aux) 9526 base := v_0.Args[0] 9527 mem := v_1 9528 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { 9529 break 9530 } 9531 v.reset(OpS390XMOVHZload) 9532 v.AuxInt = int32ToAuxInt(off1 + off2) 9533 v.Aux = symToAux(mergeSym(sym1, sym2)) 9534 v.AddArg2(base, mem) 9535 return true 9536 } 9537 return false 9538 } 9539 func rewriteValueS390X_OpS390XMOVHZreg(v *Value) bool { 9540 v_0 := v.Args[0] 9541 b := v.Block 9542 typ := &b.Func.Config.Types 9543 // match: (MOVHZreg e:(MOVBZreg x)) 9544 // cond: clobberIfDead(e) 9545 // result: (MOVBZreg x) 9546 for { 9547 e := v_0 9548 if e.Op != OpS390XMOVBZreg { 9549 break 9550 } 9551 x := e.Args[0] 9552 if !(clobberIfDead(e)) { 9553 break 9554 } 9555 v.reset(OpS390XMOVBZreg) 9556 v.AddArg(x) 9557 return true 9558 } 9559 // match: (MOVHZreg e:(MOVHreg x)) 9560 // cond: clobberIfDead(e) 9561 // result: (MOVHZreg x) 9562 for { 9563 e := v_0 9564 if e.Op != OpS390XMOVHreg { 9565 break 9566 } 9567 x := e.Args[0] 9568 if !(clobberIfDead(e)) { 9569 break 9570 } 9571 v.reset(OpS390XMOVHZreg) 9572 v.AddArg(x) 9573 return true 9574 } 9575 // match: (MOVHZreg e:(MOVWreg x)) 9576 // cond: clobberIfDead(e) 9577 // result: (MOVHZreg x) 9578 for { 9579 e := v_0 9580 if e.Op != OpS390XMOVWreg { 9581 break 9582 } 9583 x := e.Args[0] 9584 if !(clobberIfDead(e)) { 9585 break 9586 } 9587 v.reset(OpS390XMOVHZreg) 9588 v.AddArg(x) 9589 return true 9590 } 9591 // match: (MOVHZreg e:(MOVHZreg x)) 9592 // cond: clobberIfDead(e) 9593 // result: (MOVHZreg x) 9594 for { 9595 e := v_0 9596 if e.Op != OpS390XMOVHZreg { 9597 break 9598 } 9599 x := e.Args[0] 9600 if !(clobberIfDead(e)) { 9601 break 9602 } 9603 v.reset(OpS390XMOVHZreg) 9604 v.AddArg(x) 9605 return true 9606 } 9607 // match: (MOVHZreg e:(MOVWZreg x)) 9608 // cond: clobberIfDead(e) 9609 // result: (MOVHZreg x) 9610 for { 9611 e := v_0 9612 if e.Op != OpS390XMOVWZreg { 9613 break 9614 } 9615 x := e.Args[0] 9616 if !(clobberIfDead(e)) { 9617 break 9618 } 9619 v.reset(OpS390XMOVHZreg) 9620 v.AddArg(x) 9621 return true 9622 } 9623 // match: (MOVHZreg x:(MOVBZload _ _)) 9624 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 9625 // result: x 9626 for { 9627 x := v_0 9628 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 9629 break 9630 } 9631 v.copyOf(x) 9632 return true 9633 } 9634 // match: (MOVHZreg x:(MOVHZload _ _)) 9635 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) 9636 // result: x 9637 for { 9638 x := v_0 9639 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) { 9640 break 9641 } 9642 v.copyOf(x) 9643 return true 9644 } 9645 // match: (MOVHZreg <t> x:(MOVHload [o] {s} p mem)) 9646 // cond: x.Uses == 1 && clobber(x) 9647 // result: @x.Block (MOVHZload <t> [o] {s} p mem) 9648 for { 9649 t := v.Type 9650 x := v_0 9651 if x.Op != OpS390XMOVHload { 9652 break 9653 } 9654 o := auxIntToInt32(x.AuxInt) 9655 s := auxToSym(x.Aux) 9656 mem := x.Args[1] 9657 p := x.Args[0] 9658 if !(x.Uses == 1 && clobber(x)) { 9659 break 9660 } 9661 b = x.Block 9662 v0 := b.NewValue0(x.Pos, OpS390XMOVHZload, t) 9663 v.copyOf(v0) 9664 v0.AuxInt = int32ToAuxInt(o) 9665 v0.Aux = symToAux(s) 9666 v0.AddArg2(p, mem) 9667 return true 9668 } 9669 // match: (MOVHZreg x:(Arg <t>)) 9670 // cond: !t.IsSigned() && t.Size() <= 2 9671 // result: x 9672 for { 9673 x := v_0 9674 if x.Op != OpArg { 9675 break 9676 } 9677 t := x.Type 9678 if !(!t.IsSigned() && t.Size() <= 2) { 9679 break 9680 } 9681 v.copyOf(x) 9682 return true 9683 } 9684 // match: (MOVHZreg (MOVDconst [c])) 9685 // result: (MOVDconst [int64(uint16(c))]) 9686 for { 9687 if v_0.Op != OpS390XMOVDconst { 9688 break 9689 } 9690 c := auxIntToInt64(v_0.AuxInt) 9691 v.reset(OpS390XMOVDconst) 9692 v.AuxInt = int64ToAuxInt(int64(uint16(c))) 9693 return true 9694 } 9695 // match: (MOVHZreg (RISBGZ x {r})) 9696 // cond: r.OutMerge(0x0000ffff) != nil 9697 // result: (RISBGZ x {*r.OutMerge(0x0000ffff)}) 9698 for { 9699 if v_0.Op != OpS390XRISBGZ { 9700 break 9701 } 9702 r := auxToS390xRotateParams(v_0.Aux) 9703 x := v_0.Args[0] 9704 if !(r.OutMerge(0x0000ffff) != nil) { 9705 break 9706 } 9707 v.reset(OpS390XRISBGZ) 9708 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0x0000ffff)) 9709 v.AddArg(x) 9710 return true 9711 } 9712 // match: (MOVHZreg (ANDWconst [m] x)) 9713 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x)) 9714 for { 9715 if v_0.Op != OpS390XANDWconst { 9716 break 9717 } 9718 m := auxIntToInt32(v_0.AuxInt) 9719 x := v_0.Args[0] 9720 v.reset(OpS390XMOVWZreg) 9721 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 9722 v0.AuxInt = int32ToAuxInt(int32(uint16(m))) 9723 v0.AddArg(x) 9724 v.AddArg(v0) 9725 return true 9726 } 9727 return false 9728 } 9729 func rewriteValueS390X_OpS390XMOVHload(v *Value) bool { 9730 v_1 := v.Args[1] 9731 v_0 := v.Args[0] 9732 // match: (MOVHload [off] {sym} ptr1 (MOVHstore [off] {sym} ptr2 x _)) 9733 // cond: isSamePtr(ptr1, ptr2) 9734 // result: (MOVHreg x) 9735 for { 9736 off := auxIntToInt32(v.AuxInt) 9737 sym := auxToSym(v.Aux) 9738 ptr1 := v_0 9739 if v_1.Op != OpS390XMOVHstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 9740 break 9741 } 9742 x := v_1.Args[1] 9743 ptr2 := v_1.Args[0] 9744 if !(isSamePtr(ptr1, ptr2)) { 9745 break 9746 } 9747 v.reset(OpS390XMOVHreg) 9748 v.AddArg(x) 9749 return true 9750 } 9751 // match: (MOVHload [off1] {sym} (ADDconst [off2] ptr) mem) 9752 // cond: is20Bit(int64(off1)+int64(off2)) 9753 // result: (MOVHload [off1+off2] {sym} ptr mem) 9754 for { 9755 off1 := auxIntToInt32(v.AuxInt) 9756 sym := auxToSym(v.Aux) 9757 if v_0.Op != OpS390XADDconst { 9758 break 9759 } 9760 off2 := auxIntToInt32(v_0.AuxInt) 9761 ptr := v_0.Args[0] 9762 mem := v_1 9763 if !(is20Bit(int64(off1) + int64(off2))) { 9764 break 9765 } 9766 v.reset(OpS390XMOVHload) 9767 v.AuxInt = int32ToAuxInt(off1 + off2) 9768 v.Aux = symToAux(sym) 9769 v.AddArg2(ptr, mem) 9770 return true 9771 } 9772 // match: (MOVHload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 9773 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) 9774 // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} base mem) 9775 for { 9776 off1 := auxIntToInt32(v.AuxInt) 9777 sym1 := auxToSym(v.Aux) 9778 if v_0.Op != OpS390XMOVDaddr { 9779 break 9780 } 9781 t := v_0.Type 9782 off2 := auxIntToInt32(v_0.AuxInt) 9783 sym2 := auxToSym(v_0.Aux) 9784 base := v_0.Args[0] 9785 mem := v_1 9786 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { 9787 break 9788 } 9789 v.reset(OpS390XMOVHload) 9790 v.AuxInt = int32ToAuxInt(off1 + off2) 9791 v.Aux = symToAux(mergeSym(sym1, sym2)) 9792 v.AddArg2(base, mem) 9793 return true 9794 } 9795 return false 9796 } 9797 func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool { 9798 v_0 := v.Args[0] 9799 b := v.Block 9800 typ := &b.Func.Config.Types 9801 // match: (MOVHreg e:(MOVBreg x)) 9802 // cond: clobberIfDead(e) 9803 // result: (MOVBreg x) 9804 for { 9805 e := v_0 9806 if e.Op != OpS390XMOVBreg { 9807 break 9808 } 9809 x := e.Args[0] 9810 if !(clobberIfDead(e)) { 9811 break 9812 } 9813 v.reset(OpS390XMOVBreg) 9814 v.AddArg(x) 9815 return true 9816 } 9817 // match: (MOVHreg e:(MOVHreg x)) 9818 // cond: clobberIfDead(e) 9819 // result: (MOVHreg x) 9820 for { 9821 e := v_0 9822 if e.Op != OpS390XMOVHreg { 9823 break 9824 } 9825 x := e.Args[0] 9826 if !(clobberIfDead(e)) { 9827 break 9828 } 9829 v.reset(OpS390XMOVHreg) 9830 v.AddArg(x) 9831 return true 9832 } 9833 // match: (MOVHreg e:(MOVWreg x)) 9834 // cond: clobberIfDead(e) 9835 // result: (MOVHreg x) 9836 for { 9837 e := v_0 9838 if e.Op != OpS390XMOVWreg { 9839 break 9840 } 9841 x := e.Args[0] 9842 if !(clobberIfDead(e)) { 9843 break 9844 } 9845 v.reset(OpS390XMOVHreg) 9846 v.AddArg(x) 9847 return true 9848 } 9849 // match: (MOVHreg e:(MOVHZreg x)) 9850 // cond: clobberIfDead(e) 9851 // result: (MOVHreg x) 9852 for { 9853 e := v_0 9854 if e.Op != OpS390XMOVHZreg { 9855 break 9856 } 9857 x := e.Args[0] 9858 if !(clobberIfDead(e)) { 9859 break 9860 } 9861 v.reset(OpS390XMOVHreg) 9862 v.AddArg(x) 9863 return true 9864 } 9865 // match: (MOVHreg e:(MOVWZreg x)) 9866 // cond: clobberIfDead(e) 9867 // result: (MOVHreg x) 9868 for { 9869 e := v_0 9870 if e.Op != OpS390XMOVWZreg { 9871 break 9872 } 9873 x := e.Args[0] 9874 if !(clobberIfDead(e)) { 9875 break 9876 } 9877 v.reset(OpS390XMOVHreg) 9878 v.AddArg(x) 9879 return true 9880 } 9881 // match: (MOVHreg x:(MOVBload _ _)) 9882 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 9883 // result: x 9884 for { 9885 x := v_0 9886 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 9887 break 9888 } 9889 v.copyOf(x) 9890 return true 9891 } 9892 // match: (MOVHreg x:(MOVHload _ _)) 9893 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 9894 // result: x 9895 for { 9896 x := v_0 9897 if x.Op != OpS390XMOVHload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 9898 break 9899 } 9900 v.copyOf(x) 9901 return true 9902 } 9903 // match: (MOVHreg x:(MOVBZload _ _)) 9904 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 9905 // result: x 9906 for { 9907 x := v_0 9908 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 9909 break 9910 } 9911 v.copyOf(x) 9912 return true 9913 } 9914 // match: (MOVHreg <t> x:(MOVHZload [o] {s} p mem)) 9915 // cond: x.Uses == 1 && clobber(x) 9916 // result: @x.Block (MOVHload <t> [o] {s} p mem) 9917 for { 9918 t := v.Type 9919 x := v_0 9920 if x.Op != OpS390XMOVHZload { 9921 break 9922 } 9923 o := auxIntToInt32(x.AuxInt) 9924 s := auxToSym(x.Aux) 9925 mem := x.Args[1] 9926 p := x.Args[0] 9927 if !(x.Uses == 1 && clobber(x)) { 9928 break 9929 } 9930 b = x.Block 9931 v0 := b.NewValue0(x.Pos, OpS390XMOVHload, t) 9932 v.copyOf(v0) 9933 v0.AuxInt = int32ToAuxInt(o) 9934 v0.Aux = symToAux(s) 9935 v0.AddArg2(p, mem) 9936 return true 9937 } 9938 // match: (MOVHreg x:(Arg <t>)) 9939 // cond: t.IsSigned() && t.Size() <= 2 9940 // result: x 9941 for { 9942 x := v_0 9943 if x.Op != OpArg { 9944 break 9945 } 9946 t := x.Type 9947 if !(t.IsSigned() && t.Size() <= 2) { 9948 break 9949 } 9950 v.copyOf(x) 9951 return true 9952 } 9953 // match: (MOVHreg (MOVDconst [c])) 9954 // result: (MOVDconst [int64(int16(c))]) 9955 for { 9956 if v_0.Op != OpS390XMOVDconst { 9957 break 9958 } 9959 c := auxIntToInt64(v_0.AuxInt) 9960 v.reset(OpS390XMOVDconst) 9961 v.AuxInt = int64ToAuxInt(int64(int16(c))) 9962 return true 9963 } 9964 // match: (MOVHreg (ANDWconst [m] x)) 9965 // cond: int16(m) >= 0 9966 // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x)) 9967 for { 9968 if v_0.Op != OpS390XANDWconst { 9969 break 9970 } 9971 m := auxIntToInt32(v_0.AuxInt) 9972 x := v_0.Args[0] 9973 if !(int16(m) >= 0) { 9974 break 9975 } 9976 v.reset(OpS390XMOVWZreg) 9977 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 9978 v0.AuxInt = int32ToAuxInt(int32(uint16(m))) 9979 v0.AddArg(x) 9980 v.AddArg(v0) 9981 return true 9982 } 9983 return false 9984 } 9985 func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { 9986 v_2 := v.Args[2] 9987 v_1 := v.Args[1] 9988 v_0 := v.Args[0] 9989 // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem) 9990 // result: (MOVHstore [off] {sym} ptr x mem) 9991 for { 9992 off := auxIntToInt32(v.AuxInt) 9993 sym := auxToSym(v.Aux) 9994 ptr := v_0 9995 if v_1.Op != OpS390XMOVHreg { 9996 break 9997 } 9998 x := v_1.Args[0] 9999 mem := v_2 10000 v.reset(OpS390XMOVHstore) 10001 v.AuxInt = int32ToAuxInt(off) 10002 v.Aux = symToAux(sym) 10003 v.AddArg3(ptr, x, mem) 10004 return true 10005 } 10006 // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem) 10007 // result: (MOVHstore [off] {sym} ptr x mem) 10008 for { 10009 off := auxIntToInt32(v.AuxInt) 10010 sym := auxToSym(v.Aux) 10011 ptr := v_0 10012 if v_1.Op != OpS390XMOVHZreg { 10013 break 10014 } 10015 x := v_1.Args[0] 10016 mem := v_2 10017 v.reset(OpS390XMOVHstore) 10018 v.AuxInt = int32ToAuxInt(off) 10019 v.Aux = symToAux(sym) 10020 v.AddArg3(ptr, x, mem) 10021 return true 10022 } 10023 // match: (MOVHstore [off1] {sym} (ADDconst [off2] ptr) val mem) 10024 // cond: is20Bit(int64(off1)+int64(off2)) 10025 // result: (MOVHstore [off1+off2] {sym} ptr val mem) 10026 for { 10027 off1 := auxIntToInt32(v.AuxInt) 10028 sym := auxToSym(v.Aux) 10029 if v_0.Op != OpS390XADDconst { 10030 break 10031 } 10032 off2 := auxIntToInt32(v_0.AuxInt) 10033 ptr := v_0.Args[0] 10034 val := v_1 10035 mem := v_2 10036 if !(is20Bit(int64(off1) + int64(off2))) { 10037 break 10038 } 10039 v.reset(OpS390XMOVHstore) 10040 v.AuxInt = int32ToAuxInt(off1 + off2) 10041 v.Aux = symToAux(sym) 10042 v.AddArg3(ptr, val, mem) 10043 return true 10044 } 10045 // match: (MOVHstore [off] {sym} ptr (MOVDconst [c]) mem) 10046 // cond: isU12Bit(int64(off)) && ptr.Op != OpSB 10047 // result: (MOVHstoreconst [makeValAndOff(int32(int16(c)),off)] {sym} ptr mem) 10048 for { 10049 off := auxIntToInt32(v.AuxInt) 10050 sym := auxToSym(v.Aux) 10051 ptr := v_0 10052 if v_1.Op != OpS390XMOVDconst { 10053 break 10054 } 10055 c := auxIntToInt64(v_1.AuxInt) 10056 mem := v_2 10057 if !(isU12Bit(int64(off)) && ptr.Op != OpSB) { 10058 break 10059 } 10060 v.reset(OpS390XMOVHstoreconst) 10061 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int16(c)), off)) 10062 v.Aux = symToAux(sym) 10063 v.AddArg2(ptr, mem) 10064 return true 10065 } 10066 // match: (MOVHstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem) 10067 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) 10068 // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 10069 for { 10070 off1 := auxIntToInt32(v.AuxInt) 10071 sym1 := auxToSym(v.Aux) 10072 if v_0.Op != OpS390XMOVDaddr { 10073 break 10074 } 10075 t := v_0.Type 10076 off2 := auxIntToInt32(v_0.AuxInt) 10077 sym2 := auxToSym(v_0.Aux) 10078 base := v_0.Args[0] 10079 val := v_1 10080 mem := v_2 10081 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { 10082 break 10083 } 10084 v.reset(OpS390XMOVHstore) 10085 v.AuxInt = int32ToAuxInt(off1 + off2) 10086 v.Aux = symToAux(mergeSym(sym1, sym2)) 10087 v.AddArg3(base, val, mem) 10088 return true 10089 } 10090 // match: (MOVHstore [i] {s} p w x:(MOVHstore [i-2] {s} p (SRDconst [16] w) mem)) 10091 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 10092 // result: (MOVWstore [i-2] {s} p w mem) 10093 for { 10094 i := auxIntToInt32(v.AuxInt) 10095 s := auxToSym(v.Aux) 10096 p := v_0 10097 w := v_1 10098 x := v_2 10099 if x.Op != OpS390XMOVHstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 10100 break 10101 } 10102 mem := x.Args[2] 10103 if p != x.Args[0] { 10104 break 10105 } 10106 x_1 := x.Args[1] 10107 if x_1.Op != OpS390XSRDconst || auxIntToUint8(x_1.AuxInt) != 16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 10108 break 10109 } 10110 v.reset(OpS390XMOVWstore) 10111 v.AuxInt = int32ToAuxInt(i - 2) 10112 v.Aux = symToAux(s) 10113 v.AddArg3(p, w, mem) 10114 return true 10115 } 10116 // match: (MOVHstore [i] {s} p w0:(SRDconst [j] w) x:(MOVHstore [i-2] {s} p (SRDconst [j+16] w) mem)) 10117 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 10118 // result: (MOVWstore [i-2] {s} p w0 mem) 10119 for { 10120 i := auxIntToInt32(v.AuxInt) 10121 s := auxToSym(v.Aux) 10122 p := v_0 10123 w0 := v_1 10124 if w0.Op != OpS390XSRDconst { 10125 break 10126 } 10127 j := auxIntToUint8(w0.AuxInt) 10128 w := w0.Args[0] 10129 x := v_2 10130 if x.Op != OpS390XMOVHstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 10131 break 10132 } 10133 mem := x.Args[2] 10134 if p != x.Args[0] { 10135 break 10136 } 10137 x_1 := x.Args[1] 10138 if x_1.Op != OpS390XSRDconst || auxIntToUint8(x_1.AuxInt) != j+16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 10139 break 10140 } 10141 v.reset(OpS390XMOVWstore) 10142 v.AuxInt = int32ToAuxInt(i - 2) 10143 v.Aux = symToAux(s) 10144 v.AddArg3(p, w0, mem) 10145 return true 10146 } 10147 // match: (MOVHstore [i] {s} p w x:(MOVHstore [i-2] {s} p (SRWconst [16] w) mem)) 10148 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 10149 // result: (MOVWstore [i-2] {s} p w mem) 10150 for { 10151 i := auxIntToInt32(v.AuxInt) 10152 s := auxToSym(v.Aux) 10153 p := v_0 10154 w := v_1 10155 x := v_2 10156 if x.Op != OpS390XMOVHstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 10157 break 10158 } 10159 mem := x.Args[2] 10160 if p != x.Args[0] { 10161 break 10162 } 10163 x_1 := x.Args[1] 10164 if x_1.Op != OpS390XSRWconst || auxIntToUint8(x_1.AuxInt) != 16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 10165 break 10166 } 10167 v.reset(OpS390XMOVWstore) 10168 v.AuxInt = int32ToAuxInt(i - 2) 10169 v.Aux = symToAux(s) 10170 v.AddArg3(p, w, mem) 10171 return true 10172 } 10173 // match: (MOVHstore [i] {s} p w0:(SRWconst [j] w) x:(MOVHstore [i-2] {s} p (SRWconst [j+16] w) mem)) 10174 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 10175 // result: (MOVWstore [i-2] {s} p w0 mem) 10176 for { 10177 i := auxIntToInt32(v.AuxInt) 10178 s := auxToSym(v.Aux) 10179 p := v_0 10180 w0 := v_1 10181 if w0.Op != OpS390XSRWconst { 10182 break 10183 } 10184 j := auxIntToUint8(w0.AuxInt) 10185 w := w0.Args[0] 10186 x := v_2 10187 if x.Op != OpS390XMOVHstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 10188 break 10189 } 10190 mem := x.Args[2] 10191 if p != x.Args[0] { 10192 break 10193 } 10194 x_1 := x.Args[1] 10195 if x_1.Op != OpS390XSRWconst || auxIntToUint8(x_1.AuxInt) != j+16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 10196 break 10197 } 10198 v.reset(OpS390XMOVWstore) 10199 v.AuxInt = int32ToAuxInt(i - 2) 10200 v.Aux = symToAux(s) 10201 v.AddArg3(p, w0, mem) 10202 return true 10203 } 10204 return false 10205 } 10206 func rewriteValueS390X_OpS390XMOVHstoreconst(v *Value) bool { 10207 v_1 := v.Args[1] 10208 v_0 := v.Args[0] 10209 b := v.Block 10210 typ := &b.Func.Config.Types 10211 // match: (MOVHstoreconst [sc] {s} (ADDconst [off] ptr) mem) 10212 // cond: isU12Bit(sc.Off64()+int64(off)) 10213 // result: (MOVHstoreconst [sc.addOffset32(off)] {s} ptr mem) 10214 for { 10215 sc := auxIntToValAndOff(v.AuxInt) 10216 s := auxToSym(v.Aux) 10217 if v_0.Op != OpS390XADDconst { 10218 break 10219 } 10220 off := auxIntToInt32(v_0.AuxInt) 10221 ptr := v_0.Args[0] 10222 mem := v_1 10223 if !(isU12Bit(sc.Off64() + int64(off))) { 10224 break 10225 } 10226 v.reset(OpS390XMOVHstoreconst) 10227 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 10228 v.Aux = symToAux(s) 10229 v.AddArg2(ptr, mem) 10230 return true 10231 } 10232 // match: (MOVHstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) 10233 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) 10234 // result: (MOVHstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 10235 for { 10236 sc := auxIntToValAndOff(v.AuxInt) 10237 sym1 := auxToSym(v.Aux) 10238 if v_0.Op != OpS390XMOVDaddr { 10239 break 10240 } 10241 off := auxIntToInt32(v_0.AuxInt) 10242 sym2 := auxToSym(v_0.Aux) 10243 ptr := v_0.Args[0] 10244 mem := v_1 10245 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { 10246 break 10247 } 10248 v.reset(OpS390XMOVHstoreconst) 10249 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 10250 v.Aux = symToAux(mergeSym(sym1, sym2)) 10251 v.AddArg2(ptr, mem) 10252 return true 10253 } 10254 // match: (MOVHstoreconst [c] {s} p x:(MOVHstoreconst [a] {s} p mem)) 10255 // cond: p.Op != OpSB && x.Uses == 1 && a.Off() + 2 == c.Off() && clobber(x) 10256 // result: (MOVWstore [a.Off()] {s} p (MOVDconst [int64(c.Val()&0xffff | a.Val()<<16)]) mem) 10257 for { 10258 c := auxIntToValAndOff(v.AuxInt) 10259 s := auxToSym(v.Aux) 10260 p := v_0 10261 x := v_1 10262 if x.Op != OpS390XMOVHstoreconst { 10263 break 10264 } 10265 a := auxIntToValAndOff(x.AuxInt) 10266 if auxToSym(x.Aux) != s { 10267 break 10268 } 10269 mem := x.Args[1] 10270 if p != x.Args[0] || !(p.Op != OpSB && x.Uses == 1 && a.Off()+2 == c.Off() && clobber(x)) { 10271 break 10272 } 10273 v.reset(OpS390XMOVWstore) 10274 v.AuxInt = int32ToAuxInt(a.Off()) 10275 v.Aux = symToAux(s) 10276 v0 := b.NewValue0(x.Pos, OpS390XMOVDconst, typ.UInt64) 10277 v0.AuxInt = int64ToAuxInt(int64(c.Val()&0xffff | a.Val()<<16)) 10278 v.AddArg3(p, v0, mem) 10279 return true 10280 } 10281 return false 10282 } 10283 func rewriteValueS390X_OpS390XMOVWBRstore(v *Value) bool { 10284 v_2 := v.Args[2] 10285 v_1 := v.Args[1] 10286 v_0 := v.Args[0] 10287 // match: (MOVWBRstore [i] {s} p (SRDconst [32] w) x:(MOVWBRstore [i-4] {s} p w mem)) 10288 // cond: x.Uses == 1 && clobber(x) 10289 // result: (MOVDBRstore [i-4] {s} p w mem) 10290 for { 10291 i := auxIntToInt32(v.AuxInt) 10292 s := auxToSym(v.Aux) 10293 p := v_0 10294 if v_1.Op != OpS390XSRDconst || auxIntToUint8(v_1.AuxInt) != 32 { 10295 break 10296 } 10297 w := v_1.Args[0] 10298 x := v_2 10299 if x.Op != OpS390XMOVWBRstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { 10300 break 10301 } 10302 mem := x.Args[2] 10303 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) { 10304 break 10305 } 10306 v.reset(OpS390XMOVDBRstore) 10307 v.AuxInt = int32ToAuxInt(i - 4) 10308 v.Aux = symToAux(s) 10309 v.AddArg3(p, w, mem) 10310 return true 10311 } 10312 // match: (MOVWBRstore [i] {s} p (SRDconst [j] w) x:(MOVWBRstore [i-4] {s} p w0:(SRDconst [j-32] w) mem)) 10313 // cond: x.Uses == 1 && clobber(x) 10314 // result: (MOVDBRstore [i-4] {s} p w0 mem) 10315 for { 10316 i := auxIntToInt32(v.AuxInt) 10317 s := auxToSym(v.Aux) 10318 p := v_0 10319 if v_1.Op != OpS390XSRDconst { 10320 break 10321 } 10322 j := auxIntToUint8(v_1.AuxInt) 10323 w := v_1.Args[0] 10324 x := v_2 10325 if x.Op != OpS390XMOVWBRstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { 10326 break 10327 } 10328 mem := x.Args[2] 10329 if p != x.Args[0] { 10330 break 10331 } 10332 w0 := x.Args[1] 10333 if w0.Op != OpS390XSRDconst || auxIntToUint8(w0.AuxInt) != j-32 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { 10334 break 10335 } 10336 v.reset(OpS390XMOVDBRstore) 10337 v.AuxInt = int32ToAuxInt(i - 4) 10338 v.Aux = symToAux(s) 10339 v.AddArg3(p, w0, mem) 10340 return true 10341 } 10342 return false 10343 } 10344 func rewriteValueS390X_OpS390XMOVWZload(v *Value) bool { 10345 v_1 := v.Args[1] 10346 v_0 := v.Args[0] 10347 // match: (MOVWZload [off] {sym} ptr1 (MOVWstore [off] {sym} ptr2 x _)) 10348 // cond: isSamePtr(ptr1, ptr2) 10349 // result: (MOVWZreg x) 10350 for { 10351 off := auxIntToInt32(v.AuxInt) 10352 sym := auxToSym(v.Aux) 10353 ptr1 := v_0 10354 if v_1.Op != OpS390XMOVWstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 10355 break 10356 } 10357 x := v_1.Args[1] 10358 ptr2 := v_1.Args[0] 10359 if !(isSamePtr(ptr1, ptr2)) { 10360 break 10361 } 10362 v.reset(OpS390XMOVWZreg) 10363 v.AddArg(x) 10364 return true 10365 } 10366 // match: (MOVWZload [off1] {sym} (ADDconst [off2] ptr) mem) 10367 // cond: is20Bit(int64(off1)+int64(off2)) 10368 // result: (MOVWZload [off1+off2] {sym} ptr mem) 10369 for { 10370 off1 := auxIntToInt32(v.AuxInt) 10371 sym := auxToSym(v.Aux) 10372 if v_0.Op != OpS390XADDconst { 10373 break 10374 } 10375 off2 := auxIntToInt32(v_0.AuxInt) 10376 ptr := v_0.Args[0] 10377 mem := v_1 10378 if !(is20Bit(int64(off1) + int64(off2))) { 10379 break 10380 } 10381 v.reset(OpS390XMOVWZload) 10382 v.AuxInt = int32ToAuxInt(off1 + off2) 10383 v.Aux = symToAux(sym) 10384 v.AddArg2(ptr, mem) 10385 return true 10386 } 10387 // match: (MOVWZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 10388 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) 10389 // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} base mem) 10390 for { 10391 off1 := auxIntToInt32(v.AuxInt) 10392 sym1 := auxToSym(v.Aux) 10393 if v_0.Op != OpS390XMOVDaddr { 10394 break 10395 } 10396 t := v_0.Type 10397 off2 := auxIntToInt32(v_0.AuxInt) 10398 sym2 := auxToSym(v_0.Aux) 10399 base := v_0.Args[0] 10400 mem := v_1 10401 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { 10402 break 10403 } 10404 v.reset(OpS390XMOVWZload) 10405 v.AuxInt = int32ToAuxInt(off1 + off2) 10406 v.Aux = symToAux(mergeSym(sym1, sym2)) 10407 v.AddArg2(base, mem) 10408 return true 10409 } 10410 return false 10411 } 10412 func rewriteValueS390X_OpS390XMOVWZreg(v *Value) bool { 10413 v_0 := v.Args[0] 10414 b := v.Block 10415 // match: (MOVWZreg e:(MOVBZreg x)) 10416 // cond: clobberIfDead(e) 10417 // result: (MOVBZreg x) 10418 for { 10419 e := v_0 10420 if e.Op != OpS390XMOVBZreg { 10421 break 10422 } 10423 x := e.Args[0] 10424 if !(clobberIfDead(e)) { 10425 break 10426 } 10427 v.reset(OpS390XMOVBZreg) 10428 v.AddArg(x) 10429 return true 10430 } 10431 // match: (MOVWZreg e:(MOVHZreg x)) 10432 // cond: clobberIfDead(e) 10433 // result: (MOVHZreg x) 10434 for { 10435 e := v_0 10436 if e.Op != OpS390XMOVHZreg { 10437 break 10438 } 10439 x := e.Args[0] 10440 if !(clobberIfDead(e)) { 10441 break 10442 } 10443 v.reset(OpS390XMOVHZreg) 10444 v.AddArg(x) 10445 return true 10446 } 10447 // match: (MOVWZreg e:(MOVWreg x)) 10448 // cond: clobberIfDead(e) 10449 // result: (MOVWZreg x) 10450 for { 10451 e := v_0 10452 if e.Op != OpS390XMOVWreg { 10453 break 10454 } 10455 x := e.Args[0] 10456 if !(clobberIfDead(e)) { 10457 break 10458 } 10459 v.reset(OpS390XMOVWZreg) 10460 v.AddArg(x) 10461 return true 10462 } 10463 // match: (MOVWZreg e:(MOVWZreg x)) 10464 // cond: clobberIfDead(e) 10465 // result: (MOVWZreg x) 10466 for { 10467 e := v_0 10468 if e.Op != OpS390XMOVWZreg { 10469 break 10470 } 10471 x := e.Args[0] 10472 if !(clobberIfDead(e)) { 10473 break 10474 } 10475 v.reset(OpS390XMOVWZreg) 10476 v.AddArg(x) 10477 return true 10478 } 10479 // match: (MOVWZreg x:(MOVBZload _ _)) 10480 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 10481 // result: x 10482 for { 10483 x := v_0 10484 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 10485 break 10486 } 10487 v.copyOf(x) 10488 return true 10489 } 10490 // match: (MOVWZreg x:(MOVHZload _ _)) 10491 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) 10492 // result: x 10493 for { 10494 x := v_0 10495 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) { 10496 break 10497 } 10498 v.copyOf(x) 10499 return true 10500 } 10501 // match: (MOVWZreg x:(MOVWZload _ _)) 10502 // cond: (!x.Type.IsSigned() || x.Type.Size() > 4) 10503 // result: x 10504 for { 10505 x := v_0 10506 if x.Op != OpS390XMOVWZload || !(!x.Type.IsSigned() || x.Type.Size() > 4) { 10507 break 10508 } 10509 v.copyOf(x) 10510 return true 10511 } 10512 // match: (MOVWZreg <t> x:(MOVWload [o] {s} p mem)) 10513 // cond: x.Uses == 1 && clobber(x) 10514 // result: @x.Block (MOVWZload <t> [o] {s} p mem) 10515 for { 10516 t := v.Type 10517 x := v_0 10518 if x.Op != OpS390XMOVWload { 10519 break 10520 } 10521 o := auxIntToInt32(x.AuxInt) 10522 s := auxToSym(x.Aux) 10523 mem := x.Args[1] 10524 p := x.Args[0] 10525 if !(x.Uses == 1 && clobber(x)) { 10526 break 10527 } 10528 b = x.Block 10529 v0 := b.NewValue0(x.Pos, OpS390XMOVWZload, t) 10530 v.copyOf(v0) 10531 v0.AuxInt = int32ToAuxInt(o) 10532 v0.Aux = symToAux(s) 10533 v0.AddArg2(p, mem) 10534 return true 10535 } 10536 // match: (MOVWZreg x:(Arg <t>)) 10537 // cond: !t.IsSigned() && t.Size() <= 4 10538 // result: x 10539 for { 10540 x := v_0 10541 if x.Op != OpArg { 10542 break 10543 } 10544 t := x.Type 10545 if !(!t.IsSigned() && t.Size() <= 4) { 10546 break 10547 } 10548 v.copyOf(x) 10549 return true 10550 } 10551 // match: (MOVWZreg (MOVDconst [c])) 10552 // result: (MOVDconst [int64(uint32(c))]) 10553 for { 10554 if v_0.Op != OpS390XMOVDconst { 10555 break 10556 } 10557 c := auxIntToInt64(v_0.AuxInt) 10558 v.reset(OpS390XMOVDconst) 10559 v.AuxInt = int64ToAuxInt(int64(uint32(c))) 10560 return true 10561 } 10562 // match: (MOVWZreg (RISBGZ x {r})) 10563 // cond: r.OutMerge(0xffffffff) != nil 10564 // result: (RISBGZ x {*r.OutMerge(0xffffffff)}) 10565 for { 10566 if v_0.Op != OpS390XRISBGZ { 10567 break 10568 } 10569 r := auxToS390xRotateParams(v_0.Aux) 10570 x := v_0.Args[0] 10571 if !(r.OutMerge(0xffffffff) != nil) { 10572 break 10573 } 10574 v.reset(OpS390XRISBGZ) 10575 v.Aux = s390xRotateParamsToAux(*r.OutMerge(0xffffffff)) 10576 v.AddArg(x) 10577 return true 10578 } 10579 return false 10580 } 10581 func rewriteValueS390X_OpS390XMOVWload(v *Value) bool { 10582 v_1 := v.Args[1] 10583 v_0 := v.Args[0] 10584 // match: (MOVWload [off] {sym} ptr1 (MOVWstore [off] {sym} ptr2 x _)) 10585 // cond: isSamePtr(ptr1, ptr2) 10586 // result: (MOVWreg x) 10587 for { 10588 off := auxIntToInt32(v.AuxInt) 10589 sym := auxToSym(v.Aux) 10590 ptr1 := v_0 10591 if v_1.Op != OpS390XMOVWstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 10592 break 10593 } 10594 x := v_1.Args[1] 10595 ptr2 := v_1.Args[0] 10596 if !(isSamePtr(ptr1, ptr2)) { 10597 break 10598 } 10599 v.reset(OpS390XMOVWreg) 10600 v.AddArg(x) 10601 return true 10602 } 10603 // match: (MOVWload [off1] {sym} (ADDconst [off2] ptr) mem) 10604 // cond: is20Bit(int64(off1)+int64(off2)) 10605 // result: (MOVWload [off1+off2] {sym} ptr mem) 10606 for { 10607 off1 := auxIntToInt32(v.AuxInt) 10608 sym := auxToSym(v.Aux) 10609 if v_0.Op != OpS390XADDconst { 10610 break 10611 } 10612 off2 := auxIntToInt32(v_0.AuxInt) 10613 ptr := v_0.Args[0] 10614 mem := v_1 10615 if !(is20Bit(int64(off1) + int64(off2))) { 10616 break 10617 } 10618 v.reset(OpS390XMOVWload) 10619 v.AuxInt = int32ToAuxInt(off1 + off2) 10620 v.Aux = symToAux(sym) 10621 v.AddArg2(ptr, mem) 10622 return true 10623 } 10624 // match: (MOVWload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) 10625 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) 10626 // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem) 10627 for { 10628 off1 := auxIntToInt32(v.AuxInt) 10629 sym1 := auxToSym(v.Aux) 10630 if v_0.Op != OpS390XMOVDaddr { 10631 break 10632 } 10633 t := v_0.Type 10634 off2 := auxIntToInt32(v_0.AuxInt) 10635 sym2 := auxToSym(v_0.Aux) 10636 base := v_0.Args[0] 10637 mem := v_1 10638 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { 10639 break 10640 } 10641 v.reset(OpS390XMOVWload) 10642 v.AuxInt = int32ToAuxInt(off1 + off2) 10643 v.Aux = symToAux(mergeSym(sym1, sym2)) 10644 v.AddArg2(base, mem) 10645 return true 10646 } 10647 return false 10648 } 10649 func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool { 10650 v_0 := v.Args[0] 10651 b := v.Block 10652 // match: (MOVWreg e:(MOVBreg x)) 10653 // cond: clobberIfDead(e) 10654 // result: (MOVBreg x) 10655 for { 10656 e := v_0 10657 if e.Op != OpS390XMOVBreg { 10658 break 10659 } 10660 x := e.Args[0] 10661 if !(clobberIfDead(e)) { 10662 break 10663 } 10664 v.reset(OpS390XMOVBreg) 10665 v.AddArg(x) 10666 return true 10667 } 10668 // match: (MOVWreg e:(MOVHreg x)) 10669 // cond: clobberIfDead(e) 10670 // result: (MOVHreg x) 10671 for { 10672 e := v_0 10673 if e.Op != OpS390XMOVHreg { 10674 break 10675 } 10676 x := e.Args[0] 10677 if !(clobberIfDead(e)) { 10678 break 10679 } 10680 v.reset(OpS390XMOVHreg) 10681 v.AddArg(x) 10682 return true 10683 } 10684 // match: (MOVWreg e:(MOVWreg x)) 10685 // cond: clobberIfDead(e) 10686 // result: (MOVWreg x) 10687 for { 10688 e := v_0 10689 if e.Op != OpS390XMOVWreg { 10690 break 10691 } 10692 x := e.Args[0] 10693 if !(clobberIfDead(e)) { 10694 break 10695 } 10696 v.reset(OpS390XMOVWreg) 10697 v.AddArg(x) 10698 return true 10699 } 10700 // match: (MOVWreg e:(MOVWZreg x)) 10701 // cond: clobberIfDead(e) 10702 // result: (MOVWreg x) 10703 for { 10704 e := v_0 10705 if e.Op != OpS390XMOVWZreg { 10706 break 10707 } 10708 x := e.Args[0] 10709 if !(clobberIfDead(e)) { 10710 break 10711 } 10712 v.reset(OpS390XMOVWreg) 10713 v.AddArg(x) 10714 return true 10715 } 10716 // match: (MOVWreg x:(MOVBload _ _)) 10717 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 10718 // result: x 10719 for { 10720 x := v_0 10721 if x.Op != OpS390XMOVBload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 10722 break 10723 } 10724 v.copyOf(x) 10725 return true 10726 } 10727 // match: (MOVWreg x:(MOVHload _ _)) 10728 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 10729 // result: x 10730 for { 10731 x := v_0 10732 if x.Op != OpS390XMOVHload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 10733 break 10734 } 10735 v.copyOf(x) 10736 return true 10737 } 10738 // match: (MOVWreg x:(MOVWload _ _)) 10739 // cond: (x.Type.IsSigned() || x.Type.Size() == 8) 10740 // result: x 10741 for { 10742 x := v_0 10743 if x.Op != OpS390XMOVWload || !(x.Type.IsSigned() || x.Type.Size() == 8) { 10744 break 10745 } 10746 v.copyOf(x) 10747 return true 10748 } 10749 // match: (MOVWreg x:(MOVBZload _ _)) 10750 // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) 10751 // result: x 10752 for { 10753 x := v_0 10754 if x.Op != OpS390XMOVBZload || !(!x.Type.IsSigned() || x.Type.Size() > 1) { 10755 break 10756 } 10757 v.copyOf(x) 10758 return true 10759 } 10760 // match: (MOVWreg x:(MOVHZload _ _)) 10761 // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) 10762 // result: x 10763 for { 10764 x := v_0 10765 if x.Op != OpS390XMOVHZload || !(!x.Type.IsSigned() || x.Type.Size() > 2) { 10766 break 10767 } 10768 v.copyOf(x) 10769 return true 10770 } 10771 // match: (MOVWreg <t> x:(MOVWZload [o] {s} p mem)) 10772 // cond: x.Uses == 1 && clobber(x) 10773 // result: @x.Block (MOVWload <t> [o] {s} p mem) 10774 for { 10775 t := v.Type 10776 x := v_0 10777 if x.Op != OpS390XMOVWZload { 10778 break 10779 } 10780 o := auxIntToInt32(x.AuxInt) 10781 s := auxToSym(x.Aux) 10782 mem := x.Args[1] 10783 p := x.Args[0] 10784 if !(x.Uses == 1 && clobber(x)) { 10785 break 10786 } 10787 b = x.Block 10788 v0 := b.NewValue0(x.Pos, OpS390XMOVWload, t) 10789 v.copyOf(v0) 10790 v0.AuxInt = int32ToAuxInt(o) 10791 v0.Aux = symToAux(s) 10792 v0.AddArg2(p, mem) 10793 return true 10794 } 10795 // match: (MOVWreg x:(Arg <t>)) 10796 // cond: t.IsSigned() && t.Size() <= 4 10797 // result: x 10798 for { 10799 x := v_0 10800 if x.Op != OpArg { 10801 break 10802 } 10803 t := x.Type 10804 if !(t.IsSigned() && t.Size() <= 4) { 10805 break 10806 } 10807 v.copyOf(x) 10808 return true 10809 } 10810 // match: (MOVWreg (MOVDconst [c])) 10811 // result: (MOVDconst [int64(int32(c))]) 10812 for { 10813 if v_0.Op != OpS390XMOVDconst { 10814 break 10815 } 10816 c := auxIntToInt64(v_0.AuxInt) 10817 v.reset(OpS390XMOVDconst) 10818 v.AuxInt = int64ToAuxInt(int64(int32(c))) 10819 return true 10820 } 10821 return false 10822 } 10823 func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool { 10824 v_2 := v.Args[2] 10825 v_1 := v.Args[1] 10826 v_0 := v.Args[0] 10827 // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem) 10828 // result: (MOVWstore [off] {sym} ptr x mem) 10829 for { 10830 off := auxIntToInt32(v.AuxInt) 10831 sym := auxToSym(v.Aux) 10832 ptr := v_0 10833 if v_1.Op != OpS390XMOVWreg { 10834 break 10835 } 10836 x := v_1.Args[0] 10837 mem := v_2 10838 v.reset(OpS390XMOVWstore) 10839 v.AuxInt = int32ToAuxInt(off) 10840 v.Aux = symToAux(sym) 10841 v.AddArg3(ptr, x, mem) 10842 return true 10843 } 10844 // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem) 10845 // result: (MOVWstore [off] {sym} ptr x mem) 10846 for { 10847 off := auxIntToInt32(v.AuxInt) 10848 sym := auxToSym(v.Aux) 10849 ptr := v_0 10850 if v_1.Op != OpS390XMOVWZreg { 10851 break 10852 } 10853 x := v_1.Args[0] 10854 mem := v_2 10855 v.reset(OpS390XMOVWstore) 10856 v.AuxInt = int32ToAuxInt(off) 10857 v.Aux = symToAux(sym) 10858 v.AddArg3(ptr, x, mem) 10859 return true 10860 } 10861 // match: (MOVWstore [off1] {sym} (ADDconst [off2] ptr) val mem) 10862 // cond: is20Bit(int64(off1)+int64(off2)) 10863 // result: (MOVWstore [off1+off2] {sym} ptr val mem) 10864 for { 10865 off1 := auxIntToInt32(v.AuxInt) 10866 sym := auxToSym(v.Aux) 10867 if v_0.Op != OpS390XADDconst { 10868 break 10869 } 10870 off2 := auxIntToInt32(v_0.AuxInt) 10871 ptr := v_0.Args[0] 10872 val := v_1 10873 mem := v_2 10874 if !(is20Bit(int64(off1) + int64(off2))) { 10875 break 10876 } 10877 v.reset(OpS390XMOVWstore) 10878 v.AuxInt = int32ToAuxInt(off1 + off2) 10879 v.Aux = symToAux(sym) 10880 v.AddArg3(ptr, val, mem) 10881 return true 10882 } 10883 // match: (MOVWstore [off] {sym} ptr (MOVDconst [c]) mem) 10884 // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB 10885 // result: (MOVWstoreconst [makeValAndOff(int32(c),off)] {sym} ptr mem) 10886 for { 10887 off := auxIntToInt32(v.AuxInt) 10888 sym := auxToSym(v.Aux) 10889 ptr := v_0 10890 if v_1.Op != OpS390XMOVDconst { 10891 break 10892 } 10893 c := auxIntToInt64(v_1.AuxInt) 10894 mem := v_2 10895 if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) { 10896 break 10897 } 10898 v.reset(OpS390XMOVWstoreconst) 10899 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off)) 10900 v.Aux = symToAux(sym) 10901 v.AddArg2(ptr, mem) 10902 return true 10903 } 10904 // match: (MOVWstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem) 10905 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) 10906 // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 10907 for { 10908 off1 := auxIntToInt32(v.AuxInt) 10909 sym1 := auxToSym(v.Aux) 10910 if v_0.Op != OpS390XMOVDaddr { 10911 break 10912 } 10913 t := v_0.Type 10914 off2 := auxIntToInt32(v_0.AuxInt) 10915 sym2 := auxToSym(v_0.Aux) 10916 base := v_0.Args[0] 10917 val := v_1 10918 mem := v_2 10919 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { 10920 break 10921 } 10922 v.reset(OpS390XMOVWstore) 10923 v.AuxInt = int32ToAuxInt(off1 + off2) 10924 v.Aux = symToAux(mergeSym(sym1, sym2)) 10925 v.AddArg3(base, val, mem) 10926 return true 10927 } 10928 // match: (MOVWstore [i] {s} p (SRDconst [32] w) x:(MOVWstore [i-4] {s} p w mem)) 10929 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 10930 // result: (MOVDstore [i-4] {s} p w mem) 10931 for { 10932 i := auxIntToInt32(v.AuxInt) 10933 s := auxToSym(v.Aux) 10934 p := v_0 10935 if v_1.Op != OpS390XSRDconst || auxIntToUint8(v_1.AuxInt) != 32 { 10936 break 10937 } 10938 w := v_1.Args[0] 10939 x := v_2 10940 if x.Op != OpS390XMOVWstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { 10941 break 10942 } 10943 mem := x.Args[2] 10944 if p != x.Args[0] || w != x.Args[1] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 10945 break 10946 } 10947 v.reset(OpS390XMOVDstore) 10948 v.AuxInt = int32ToAuxInt(i - 4) 10949 v.Aux = symToAux(s) 10950 v.AddArg3(p, w, mem) 10951 return true 10952 } 10953 // match: (MOVWstore [i] {s} p w0:(SRDconst [j] w) x:(MOVWstore [i-4] {s} p (SRDconst [j+32] w) mem)) 10954 // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) 10955 // result: (MOVDstore [i-4] {s} p w0 mem) 10956 for { 10957 i := auxIntToInt32(v.AuxInt) 10958 s := auxToSym(v.Aux) 10959 p := v_0 10960 w0 := v_1 10961 if w0.Op != OpS390XSRDconst { 10962 break 10963 } 10964 j := auxIntToUint8(w0.AuxInt) 10965 w := w0.Args[0] 10966 x := v_2 10967 if x.Op != OpS390XMOVWstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { 10968 break 10969 } 10970 mem := x.Args[2] 10971 if p != x.Args[0] { 10972 break 10973 } 10974 x_1 := x.Args[1] 10975 if x_1.Op != OpS390XSRDconst || auxIntToUint8(x_1.AuxInt) != j+32 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { 10976 break 10977 } 10978 v.reset(OpS390XMOVDstore) 10979 v.AuxInt = int32ToAuxInt(i - 4) 10980 v.Aux = symToAux(s) 10981 v.AddArg3(p, w0, mem) 10982 return true 10983 } 10984 // match: (MOVWstore [i] {s} p w1 x:(MOVWstore [i-4] {s} p w0 mem)) 10985 // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && clobber(x) 10986 // result: (STM2 [i-4] {s} p w0 w1 mem) 10987 for { 10988 i := auxIntToInt32(v.AuxInt) 10989 s := auxToSym(v.Aux) 10990 p := v_0 10991 w1 := v_1 10992 x := v_2 10993 if x.Op != OpS390XMOVWstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { 10994 break 10995 } 10996 mem := x.Args[2] 10997 if p != x.Args[0] { 10998 break 10999 } 11000 w0 := x.Args[1] 11001 if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && clobber(x)) { 11002 break 11003 } 11004 v.reset(OpS390XSTM2) 11005 v.AuxInt = int32ToAuxInt(i - 4) 11006 v.Aux = symToAux(s) 11007 v.AddArg4(p, w0, w1, mem) 11008 return true 11009 } 11010 // match: (MOVWstore [i] {s} p w2 x:(STM2 [i-8] {s} p w0 w1 mem)) 11011 // cond: x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x) 11012 // result: (STM3 [i-8] {s} p w0 w1 w2 mem) 11013 for { 11014 i := auxIntToInt32(v.AuxInt) 11015 s := auxToSym(v.Aux) 11016 p := v_0 11017 w2 := v_1 11018 x := v_2 11019 if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s { 11020 break 11021 } 11022 mem := x.Args[3] 11023 if p != x.Args[0] { 11024 break 11025 } 11026 w0 := x.Args[1] 11027 w1 := x.Args[2] 11028 if !(x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x)) { 11029 break 11030 } 11031 v.reset(OpS390XSTM3) 11032 v.AuxInt = int32ToAuxInt(i - 8) 11033 v.Aux = symToAux(s) 11034 v.AddArg5(p, w0, w1, w2, mem) 11035 return true 11036 } 11037 // match: (MOVWstore [i] {s} p w3 x:(STM3 [i-12] {s} p w0 w1 w2 mem)) 11038 // cond: x.Uses == 1 && is20Bit(int64(i)-12) && clobber(x) 11039 // result: (STM4 [i-12] {s} p w0 w1 w2 w3 mem) 11040 for { 11041 i := auxIntToInt32(v.AuxInt) 11042 s := auxToSym(v.Aux) 11043 p := v_0 11044 w3 := v_1 11045 x := v_2 11046 if x.Op != OpS390XSTM3 || auxIntToInt32(x.AuxInt) != i-12 || auxToSym(x.Aux) != s { 11047 break 11048 } 11049 mem := x.Args[4] 11050 if p != x.Args[0] { 11051 break 11052 } 11053 w0 := x.Args[1] 11054 w1 := x.Args[2] 11055 w2 := x.Args[3] 11056 if !(x.Uses == 1 && is20Bit(int64(i)-12) && clobber(x)) { 11057 break 11058 } 11059 v.reset(OpS390XSTM4) 11060 v.AuxInt = int32ToAuxInt(i - 12) 11061 v.Aux = symToAux(s) 11062 v.AddArg6(p, w0, w1, w2, w3, mem) 11063 return true 11064 } 11065 return false 11066 } 11067 func rewriteValueS390X_OpS390XMOVWstoreconst(v *Value) bool { 11068 v_1 := v.Args[1] 11069 v_0 := v.Args[0] 11070 b := v.Block 11071 typ := &b.Func.Config.Types 11072 // match: (MOVWstoreconst [sc] {s} (ADDconst [off] ptr) mem) 11073 // cond: isU12Bit(sc.Off64()+int64(off)) 11074 // result: (MOVWstoreconst [sc.addOffset32(off)] {s} ptr mem) 11075 for { 11076 sc := auxIntToValAndOff(v.AuxInt) 11077 s := auxToSym(v.Aux) 11078 if v_0.Op != OpS390XADDconst { 11079 break 11080 } 11081 off := auxIntToInt32(v_0.AuxInt) 11082 ptr := v_0.Args[0] 11083 mem := v_1 11084 if !(isU12Bit(sc.Off64() + int64(off))) { 11085 break 11086 } 11087 v.reset(OpS390XMOVWstoreconst) 11088 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 11089 v.Aux = symToAux(s) 11090 v.AddArg2(ptr, mem) 11091 return true 11092 } 11093 // match: (MOVWstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) 11094 // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) 11095 // result: (MOVWstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 11096 for { 11097 sc := auxIntToValAndOff(v.AuxInt) 11098 sym1 := auxToSym(v.Aux) 11099 if v_0.Op != OpS390XMOVDaddr { 11100 break 11101 } 11102 off := auxIntToInt32(v_0.AuxInt) 11103 sym2 := auxToSym(v_0.Aux) 11104 ptr := v_0.Args[0] 11105 mem := v_1 11106 if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { 11107 break 11108 } 11109 v.reset(OpS390XMOVWstoreconst) 11110 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 11111 v.Aux = symToAux(mergeSym(sym1, sym2)) 11112 v.AddArg2(ptr, mem) 11113 return true 11114 } 11115 // match: (MOVWstoreconst [c] {s} p x:(MOVWstoreconst [a] {s} p mem)) 11116 // cond: p.Op != OpSB && x.Uses == 1 && a.Off() + 4 == c.Off() && clobber(x) 11117 // result: (MOVDstore [a.Off()] {s} p (MOVDconst [c.Val64()&0xffffffff | a.Val64()<<32]) mem) 11118 for { 11119 c := auxIntToValAndOff(v.AuxInt) 11120 s := auxToSym(v.Aux) 11121 p := v_0 11122 x := v_1 11123 if x.Op != OpS390XMOVWstoreconst { 11124 break 11125 } 11126 a := auxIntToValAndOff(x.AuxInt) 11127 if auxToSym(x.Aux) != s { 11128 break 11129 } 11130 mem := x.Args[1] 11131 if p != x.Args[0] || !(p.Op != OpSB && x.Uses == 1 && a.Off()+4 == c.Off() && clobber(x)) { 11132 break 11133 } 11134 v.reset(OpS390XMOVDstore) 11135 v.AuxInt = int32ToAuxInt(a.Off()) 11136 v.Aux = symToAux(s) 11137 v0 := b.NewValue0(x.Pos, OpS390XMOVDconst, typ.UInt64) 11138 v0.AuxInt = int64ToAuxInt(c.Val64()&0xffffffff | a.Val64()<<32) 11139 v.AddArg3(p, v0, mem) 11140 return true 11141 } 11142 return false 11143 } 11144 func rewriteValueS390X_OpS390XMULLD(v *Value) bool { 11145 v_1 := v.Args[1] 11146 v_0 := v.Args[0] 11147 // match: (MULLD x (MOVDconst [c])) 11148 // cond: is32Bit(c) 11149 // result: (MULLDconst [int32(c)] x) 11150 for { 11151 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11152 x := v_0 11153 if v_1.Op != OpS390XMOVDconst { 11154 continue 11155 } 11156 c := auxIntToInt64(v_1.AuxInt) 11157 if !(is32Bit(c)) { 11158 continue 11159 } 11160 v.reset(OpS390XMULLDconst) 11161 v.AuxInt = int32ToAuxInt(int32(c)) 11162 v.AddArg(x) 11163 return true 11164 } 11165 break 11166 } 11167 // match: (MULLD <t> x g:(MOVDload [off] {sym} ptr mem)) 11168 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 11169 // result: (MULLDload <t> [off] {sym} x ptr mem) 11170 for { 11171 t := v.Type 11172 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11173 x := v_0 11174 g := v_1 11175 if g.Op != OpS390XMOVDload { 11176 continue 11177 } 11178 off := auxIntToInt32(g.AuxInt) 11179 sym := auxToSym(g.Aux) 11180 mem := g.Args[1] 11181 ptr := g.Args[0] 11182 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 11183 continue 11184 } 11185 v.reset(OpS390XMULLDload) 11186 v.Type = t 11187 v.AuxInt = int32ToAuxInt(off) 11188 v.Aux = symToAux(sym) 11189 v.AddArg3(x, ptr, mem) 11190 return true 11191 } 11192 break 11193 } 11194 return false 11195 } 11196 func rewriteValueS390X_OpS390XMULLDconst(v *Value) bool { 11197 v_0 := v.Args[0] 11198 b := v.Block 11199 // match: (MULLDconst <t> x [c]) 11200 // cond: isPowerOfTwo32(c&(c-1)) 11201 // result: (ADD (SLDconst <t> x [uint8(log32(c&(c-1)))]) (SLDconst <t> x [uint8(log32(c&^(c-1)))])) 11202 for { 11203 t := v.Type 11204 c := auxIntToInt32(v.AuxInt) 11205 x := v_0 11206 if !(isPowerOfTwo32(c & (c - 1))) { 11207 break 11208 } 11209 v.reset(OpS390XADD) 11210 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 11211 v0.AuxInt = uint8ToAuxInt(uint8(log32(c & (c - 1)))) 11212 v0.AddArg(x) 11213 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 11214 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1)))) 11215 v1.AddArg(x) 11216 v.AddArg2(v0, v1) 11217 return true 11218 } 11219 // match: (MULLDconst <t> x [c]) 11220 // cond: isPowerOfTwo32(c+(c&^(c-1))) 11221 // result: (SUB (SLDconst <t> x [uint8(log32(c+(c&^(c-1))))]) (SLDconst <t> x [uint8(log32(c&^(c-1)))])) 11222 for { 11223 t := v.Type 11224 c := auxIntToInt32(v.AuxInt) 11225 x := v_0 11226 if !(isPowerOfTwo32(c + (c &^ (c - 1)))) { 11227 break 11228 } 11229 v.reset(OpS390XSUB) 11230 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 11231 v0.AuxInt = uint8ToAuxInt(uint8(log32(c + (c &^ (c - 1))))) 11232 v0.AddArg(x) 11233 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 11234 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1)))) 11235 v1.AddArg(x) 11236 v.AddArg2(v0, v1) 11237 return true 11238 } 11239 // match: (MULLDconst <t> x [c]) 11240 // cond: isPowerOfTwo32(-c+(-c&^(-c-1))) 11241 // result: (SUB (SLDconst <t> x [uint8(log32(-c&^(-c-1)))]) (SLDconst <t> x [uint8(log32(-c+(-c&^(-c-1))))])) 11242 for { 11243 t := v.Type 11244 c := auxIntToInt32(v.AuxInt) 11245 x := v_0 11246 if !(isPowerOfTwo32(-c + (-c &^ (-c - 1)))) { 11247 break 11248 } 11249 v.reset(OpS390XSUB) 11250 v0 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 11251 v0.AuxInt = uint8ToAuxInt(uint8(log32(-c &^ (-c - 1)))) 11252 v0.AddArg(x) 11253 v1 := b.NewValue0(v.Pos, OpS390XSLDconst, t) 11254 v1.AuxInt = uint8ToAuxInt(uint8(log32(-c + (-c &^ (-c - 1))))) 11255 v1.AddArg(x) 11256 v.AddArg2(v0, v1) 11257 return true 11258 } 11259 // match: (MULLDconst [c] (MOVDconst [d])) 11260 // result: (MOVDconst [int64(c)*d]) 11261 for { 11262 c := auxIntToInt32(v.AuxInt) 11263 if v_0.Op != OpS390XMOVDconst { 11264 break 11265 } 11266 d := auxIntToInt64(v_0.AuxInt) 11267 v.reset(OpS390XMOVDconst) 11268 v.AuxInt = int64ToAuxInt(int64(c) * d) 11269 return true 11270 } 11271 return false 11272 } 11273 func rewriteValueS390X_OpS390XMULLDload(v *Value) bool { 11274 v_2 := v.Args[2] 11275 v_1 := v.Args[1] 11276 v_0 := v.Args[0] 11277 b := v.Block 11278 // match: (MULLDload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 11279 // cond: isSamePtr(ptr1, ptr2) 11280 // result: (MULLD x (LGDR <t> y)) 11281 for { 11282 t := v.Type 11283 off := auxIntToInt32(v.AuxInt) 11284 sym := auxToSym(v.Aux) 11285 x := v_0 11286 ptr1 := v_1 11287 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 11288 break 11289 } 11290 y := v_2.Args[1] 11291 ptr2 := v_2.Args[0] 11292 if !(isSamePtr(ptr1, ptr2)) { 11293 break 11294 } 11295 v.reset(OpS390XMULLD) 11296 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 11297 v0.AddArg(y) 11298 v.AddArg2(x, v0) 11299 return true 11300 } 11301 // match: (MULLDload [off1] {sym} x (ADDconst [off2] ptr) mem) 11302 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 11303 // result: (MULLDload [off1+off2] {sym} x ptr mem) 11304 for { 11305 off1 := auxIntToInt32(v.AuxInt) 11306 sym := auxToSym(v.Aux) 11307 x := v_0 11308 if v_1.Op != OpS390XADDconst { 11309 break 11310 } 11311 off2 := auxIntToInt32(v_1.AuxInt) 11312 ptr := v_1.Args[0] 11313 mem := v_2 11314 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 11315 break 11316 } 11317 v.reset(OpS390XMULLDload) 11318 v.AuxInt = int32ToAuxInt(off1 + off2) 11319 v.Aux = symToAux(sym) 11320 v.AddArg3(x, ptr, mem) 11321 return true 11322 } 11323 // match: (MULLDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 11324 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 11325 // result: (MULLDload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 11326 for { 11327 o1 := auxIntToInt32(v.AuxInt) 11328 s1 := auxToSym(v.Aux) 11329 x := v_0 11330 if v_1.Op != OpS390XMOVDaddr { 11331 break 11332 } 11333 o2 := auxIntToInt32(v_1.AuxInt) 11334 s2 := auxToSym(v_1.Aux) 11335 ptr := v_1.Args[0] 11336 mem := v_2 11337 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 11338 break 11339 } 11340 v.reset(OpS390XMULLDload) 11341 v.AuxInt = int32ToAuxInt(o1 + o2) 11342 v.Aux = symToAux(mergeSym(s1, s2)) 11343 v.AddArg3(x, ptr, mem) 11344 return true 11345 } 11346 return false 11347 } 11348 func rewriteValueS390X_OpS390XMULLW(v *Value) bool { 11349 v_1 := v.Args[1] 11350 v_0 := v.Args[0] 11351 // match: (MULLW x (MOVDconst [c])) 11352 // result: (MULLWconst [int32(c)] x) 11353 for { 11354 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11355 x := v_0 11356 if v_1.Op != OpS390XMOVDconst { 11357 continue 11358 } 11359 c := auxIntToInt64(v_1.AuxInt) 11360 v.reset(OpS390XMULLWconst) 11361 v.AuxInt = int32ToAuxInt(int32(c)) 11362 v.AddArg(x) 11363 return true 11364 } 11365 break 11366 } 11367 // match: (MULLW <t> x g:(MOVWload [off] {sym} ptr mem)) 11368 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 11369 // result: (MULLWload <t> [off] {sym} x ptr mem) 11370 for { 11371 t := v.Type 11372 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11373 x := v_0 11374 g := v_1 11375 if g.Op != OpS390XMOVWload { 11376 continue 11377 } 11378 off := auxIntToInt32(g.AuxInt) 11379 sym := auxToSym(g.Aux) 11380 mem := g.Args[1] 11381 ptr := g.Args[0] 11382 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 11383 continue 11384 } 11385 v.reset(OpS390XMULLWload) 11386 v.Type = t 11387 v.AuxInt = int32ToAuxInt(off) 11388 v.Aux = symToAux(sym) 11389 v.AddArg3(x, ptr, mem) 11390 return true 11391 } 11392 break 11393 } 11394 // match: (MULLW <t> x g:(MOVWZload [off] {sym} ptr mem)) 11395 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 11396 // result: (MULLWload <t> [off] {sym} x ptr mem) 11397 for { 11398 t := v.Type 11399 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11400 x := v_0 11401 g := v_1 11402 if g.Op != OpS390XMOVWZload { 11403 continue 11404 } 11405 off := auxIntToInt32(g.AuxInt) 11406 sym := auxToSym(g.Aux) 11407 mem := g.Args[1] 11408 ptr := g.Args[0] 11409 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 11410 continue 11411 } 11412 v.reset(OpS390XMULLWload) 11413 v.Type = t 11414 v.AuxInt = int32ToAuxInt(off) 11415 v.Aux = symToAux(sym) 11416 v.AddArg3(x, ptr, mem) 11417 return true 11418 } 11419 break 11420 } 11421 return false 11422 } 11423 func rewriteValueS390X_OpS390XMULLWconst(v *Value) bool { 11424 v_0 := v.Args[0] 11425 b := v.Block 11426 // match: (MULLWconst <t> x [c]) 11427 // cond: isPowerOfTwo32(c&(c-1)) 11428 // result: (ADDW (SLWconst <t> x [uint8(log32(c&(c-1)))]) (SLWconst <t> x [uint8(log32(c&^(c-1)))])) 11429 for { 11430 t := v.Type 11431 c := auxIntToInt32(v.AuxInt) 11432 x := v_0 11433 if !(isPowerOfTwo32(c & (c - 1))) { 11434 break 11435 } 11436 v.reset(OpS390XADDW) 11437 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11438 v0.AuxInt = uint8ToAuxInt(uint8(log32(c & (c - 1)))) 11439 v0.AddArg(x) 11440 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11441 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1)))) 11442 v1.AddArg(x) 11443 v.AddArg2(v0, v1) 11444 return true 11445 } 11446 // match: (MULLWconst <t> x [c]) 11447 // cond: isPowerOfTwo32(c+(c&^(c-1))) 11448 // result: (SUBW (SLWconst <t> x [uint8(log32(c+(c&^(c-1))))]) (SLWconst <t> x [uint8(log32(c&^(c-1)))])) 11449 for { 11450 t := v.Type 11451 c := auxIntToInt32(v.AuxInt) 11452 x := v_0 11453 if !(isPowerOfTwo32(c + (c &^ (c - 1)))) { 11454 break 11455 } 11456 v.reset(OpS390XSUBW) 11457 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11458 v0.AuxInt = uint8ToAuxInt(uint8(log32(c + (c &^ (c - 1))))) 11459 v0.AddArg(x) 11460 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11461 v1.AuxInt = uint8ToAuxInt(uint8(log32(c &^ (c - 1)))) 11462 v1.AddArg(x) 11463 v.AddArg2(v0, v1) 11464 return true 11465 } 11466 // match: (MULLWconst <t> x [c]) 11467 // cond: isPowerOfTwo32(-c+(-c&^(-c-1))) 11468 // result: (SUBW (SLWconst <t> x [uint8(log32(-c&^(-c-1)))]) (SLWconst <t> x [uint8(log32(-c+(-c&^(-c-1))))])) 11469 for { 11470 t := v.Type 11471 c := auxIntToInt32(v.AuxInt) 11472 x := v_0 11473 if !(isPowerOfTwo32(-c + (-c &^ (-c - 1)))) { 11474 break 11475 } 11476 v.reset(OpS390XSUBW) 11477 v0 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11478 v0.AuxInt = uint8ToAuxInt(uint8(log32(-c &^ (-c - 1)))) 11479 v0.AddArg(x) 11480 v1 := b.NewValue0(v.Pos, OpS390XSLWconst, t) 11481 v1.AuxInt = uint8ToAuxInt(uint8(log32(-c + (-c &^ (-c - 1))))) 11482 v1.AddArg(x) 11483 v.AddArg2(v0, v1) 11484 return true 11485 } 11486 // match: (MULLWconst [c] (MOVDconst [d])) 11487 // result: (MOVDconst [int64(c*int32(d))]) 11488 for { 11489 c := auxIntToInt32(v.AuxInt) 11490 if v_0.Op != OpS390XMOVDconst { 11491 break 11492 } 11493 d := auxIntToInt64(v_0.AuxInt) 11494 v.reset(OpS390XMOVDconst) 11495 v.AuxInt = int64ToAuxInt(int64(c * int32(d))) 11496 return true 11497 } 11498 return false 11499 } 11500 func rewriteValueS390X_OpS390XMULLWload(v *Value) bool { 11501 v_2 := v.Args[2] 11502 v_1 := v.Args[1] 11503 v_0 := v.Args[0] 11504 // match: (MULLWload [off1] {sym} x (ADDconst [off2] ptr) mem) 11505 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 11506 // result: (MULLWload [off1+off2] {sym} x ptr mem) 11507 for { 11508 off1 := auxIntToInt32(v.AuxInt) 11509 sym := auxToSym(v.Aux) 11510 x := v_0 11511 if v_1.Op != OpS390XADDconst { 11512 break 11513 } 11514 off2 := auxIntToInt32(v_1.AuxInt) 11515 ptr := v_1.Args[0] 11516 mem := v_2 11517 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 11518 break 11519 } 11520 v.reset(OpS390XMULLWload) 11521 v.AuxInt = int32ToAuxInt(off1 + off2) 11522 v.Aux = symToAux(sym) 11523 v.AddArg3(x, ptr, mem) 11524 return true 11525 } 11526 // match: (MULLWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 11527 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 11528 // result: (MULLWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 11529 for { 11530 o1 := auxIntToInt32(v.AuxInt) 11531 s1 := auxToSym(v.Aux) 11532 x := v_0 11533 if v_1.Op != OpS390XMOVDaddr { 11534 break 11535 } 11536 o2 := auxIntToInt32(v_1.AuxInt) 11537 s2 := auxToSym(v_1.Aux) 11538 ptr := v_1.Args[0] 11539 mem := v_2 11540 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 11541 break 11542 } 11543 v.reset(OpS390XMULLWload) 11544 v.AuxInt = int32ToAuxInt(o1 + o2) 11545 v.Aux = symToAux(mergeSym(s1, s2)) 11546 v.AddArg3(x, ptr, mem) 11547 return true 11548 } 11549 return false 11550 } 11551 func rewriteValueS390X_OpS390XNEG(v *Value) bool { 11552 v_0 := v.Args[0] 11553 // match: (NEG (MOVDconst [c])) 11554 // result: (MOVDconst [-c]) 11555 for { 11556 if v_0.Op != OpS390XMOVDconst { 11557 break 11558 } 11559 c := auxIntToInt64(v_0.AuxInt) 11560 v.reset(OpS390XMOVDconst) 11561 v.AuxInt = int64ToAuxInt(-c) 11562 return true 11563 } 11564 // match: (NEG (ADDconst [c] (NEG x))) 11565 // cond: c != -(1<<31) 11566 // result: (ADDconst [-c] x) 11567 for { 11568 if v_0.Op != OpS390XADDconst { 11569 break 11570 } 11571 c := auxIntToInt32(v_0.AuxInt) 11572 v_0_0 := v_0.Args[0] 11573 if v_0_0.Op != OpS390XNEG { 11574 break 11575 } 11576 x := v_0_0.Args[0] 11577 if !(c != -(1 << 31)) { 11578 break 11579 } 11580 v.reset(OpS390XADDconst) 11581 v.AuxInt = int32ToAuxInt(-c) 11582 v.AddArg(x) 11583 return true 11584 } 11585 return false 11586 } 11587 func rewriteValueS390X_OpS390XNEGW(v *Value) bool { 11588 v_0 := v.Args[0] 11589 // match: (NEGW (MOVDconst [c])) 11590 // result: (MOVDconst [int64(int32(-c))]) 11591 for { 11592 if v_0.Op != OpS390XMOVDconst { 11593 break 11594 } 11595 c := auxIntToInt64(v_0.AuxInt) 11596 v.reset(OpS390XMOVDconst) 11597 v.AuxInt = int64ToAuxInt(int64(int32(-c))) 11598 return true 11599 } 11600 return false 11601 } 11602 func rewriteValueS390X_OpS390XNOT(v *Value) bool { 11603 v_0 := v.Args[0] 11604 b := v.Block 11605 typ := &b.Func.Config.Types 11606 // match: (NOT x) 11607 // result: (XOR (MOVDconst [-1]) x) 11608 for { 11609 x := v_0 11610 v.reset(OpS390XXOR) 11611 v0 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 11612 v0.AuxInt = int64ToAuxInt(-1) 11613 v.AddArg2(v0, x) 11614 return true 11615 } 11616 } 11617 func rewriteValueS390X_OpS390XNOTW(v *Value) bool { 11618 v_0 := v.Args[0] 11619 // match: (NOTW x) 11620 // result: (XORWconst [-1] x) 11621 for { 11622 x := v_0 11623 v.reset(OpS390XXORWconst) 11624 v.AuxInt = int32ToAuxInt(-1) 11625 v.AddArg(x) 11626 return true 11627 } 11628 } 11629 func rewriteValueS390X_OpS390XOR(v *Value) bool { 11630 v_1 := v.Args[1] 11631 v_0 := v.Args[0] 11632 b := v.Block 11633 typ := &b.Func.Config.Types 11634 // match: (OR x (MOVDconst [c])) 11635 // cond: isU32Bit(c) 11636 // result: (ORconst [c] x) 11637 for { 11638 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11639 x := v_0 11640 if v_1.Op != OpS390XMOVDconst { 11641 continue 11642 } 11643 c := auxIntToInt64(v_1.AuxInt) 11644 if !(isU32Bit(c)) { 11645 continue 11646 } 11647 v.reset(OpS390XORconst) 11648 v.AuxInt = int64ToAuxInt(c) 11649 v.AddArg(x) 11650 return true 11651 } 11652 break 11653 } 11654 // match: (OR (MOVDconst [-1<<63]) (LGDR <t> x)) 11655 // result: (LGDR <t> (LNDFR <x.Type> x)) 11656 for { 11657 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11658 if v_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0.AuxInt) != -1<<63 || v_1.Op != OpS390XLGDR { 11659 continue 11660 } 11661 t := v_1.Type 11662 x := v_1.Args[0] 11663 v.reset(OpS390XLGDR) 11664 v.Type = t 11665 v0 := b.NewValue0(v.Pos, OpS390XLNDFR, x.Type) 11666 v0.AddArg(x) 11667 v.AddArg(v0) 11668 return true 11669 } 11670 break 11671 } 11672 // match: (OR (RISBGZ (LGDR x) {r}) (LGDR (LPDFR <t> y))) 11673 // cond: r == s390x.NewRotateParams(0, 0, 0) 11674 // result: (LGDR (CPSDR <t> y x)) 11675 for { 11676 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11677 if v_0.Op != OpS390XRISBGZ { 11678 continue 11679 } 11680 r := auxToS390xRotateParams(v_0.Aux) 11681 v_0_0 := v_0.Args[0] 11682 if v_0_0.Op != OpS390XLGDR { 11683 continue 11684 } 11685 x := v_0_0.Args[0] 11686 if v_1.Op != OpS390XLGDR { 11687 continue 11688 } 11689 v_1_0 := v_1.Args[0] 11690 if v_1_0.Op != OpS390XLPDFR { 11691 continue 11692 } 11693 t := v_1_0.Type 11694 y := v_1_0.Args[0] 11695 if !(r == s390x.NewRotateParams(0, 0, 0)) { 11696 continue 11697 } 11698 v.reset(OpS390XLGDR) 11699 v0 := b.NewValue0(v.Pos, OpS390XCPSDR, t) 11700 v0.AddArg2(y, x) 11701 v.AddArg(v0) 11702 return true 11703 } 11704 break 11705 } 11706 // match: (OR (RISBGZ (LGDR x) {r}) (MOVDconst [c])) 11707 // cond: c >= 0 && r == s390x.NewRotateParams(0, 0, 0) 11708 // result: (LGDR (CPSDR <x.Type> (FMOVDconst <x.Type> [math.Float64frombits(uint64(c))]) x)) 11709 for { 11710 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11711 if v_0.Op != OpS390XRISBGZ { 11712 continue 11713 } 11714 r := auxToS390xRotateParams(v_0.Aux) 11715 v_0_0 := v_0.Args[0] 11716 if v_0_0.Op != OpS390XLGDR { 11717 continue 11718 } 11719 x := v_0_0.Args[0] 11720 if v_1.Op != OpS390XMOVDconst { 11721 continue 11722 } 11723 c := auxIntToInt64(v_1.AuxInt) 11724 if !(c >= 0 && r == s390x.NewRotateParams(0, 0, 0)) { 11725 continue 11726 } 11727 v.reset(OpS390XLGDR) 11728 v0 := b.NewValue0(v.Pos, OpS390XCPSDR, x.Type) 11729 v1 := b.NewValue0(v.Pos, OpS390XFMOVDconst, x.Type) 11730 v1.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c))) 11731 v0.AddArg2(v1, x) 11732 v.AddArg(v0) 11733 return true 11734 } 11735 break 11736 } 11737 // match: (OR (MOVDconst [c]) (MOVDconst [d])) 11738 // result: (MOVDconst [c|d]) 11739 for { 11740 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11741 if v_0.Op != OpS390XMOVDconst { 11742 continue 11743 } 11744 c := auxIntToInt64(v_0.AuxInt) 11745 if v_1.Op != OpS390XMOVDconst { 11746 continue 11747 } 11748 d := auxIntToInt64(v_1.AuxInt) 11749 v.reset(OpS390XMOVDconst) 11750 v.AuxInt = int64ToAuxInt(c | d) 11751 return true 11752 } 11753 break 11754 } 11755 // match: (OR x x) 11756 // result: x 11757 for { 11758 x := v_0 11759 if x != v_1 { 11760 break 11761 } 11762 v.copyOf(x) 11763 return true 11764 } 11765 // match: (OR <t> x g:(MOVDload [off] {sym} ptr mem)) 11766 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 11767 // result: (ORload <t> [off] {sym} x ptr mem) 11768 for { 11769 t := v.Type 11770 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11771 x := v_0 11772 g := v_1 11773 if g.Op != OpS390XMOVDload { 11774 continue 11775 } 11776 off := auxIntToInt32(g.AuxInt) 11777 sym := auxToSym(g.Aux) 11778 mem := g.Args[1] 11779 ptr := g.Args[0] 11780 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 11781 continue 11782 } 11783 v.reset(OpS390XORload) 11784 v.Type = t 11785 v.AuxInt = int32ToAuxInt(off) 11786 v.Aux = symToAux(sym) 11787 v.AddArg3(x, ptr, mem) 11788 return true 11789 } 11790 break 11791 } 11792 // match: (OR x1:(MOVBZload [i1] {s} p mem) sh:(SLDconst [8] x0:(MOVBZload [i0] {s} p mem))) 11793 // cond: i1 == i0+1 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) 11794 // result: @mergePoint(b,x0,x1) (MOVHZload [i0] {s} p mem) 11795 for { 11796 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11797 x1 := v_0 11798 if x1.Op != OpS390XMOVBZload { 11799 continue 11800 } 11801 i1 := auxIntToInt32(x1.AuxInt) 11802 s := auxToSym(x1.Aux) 11803 mem := x1.Args[1] 11804 p := x1.Args[0] 11805 sh := v_1 11806 if sh.Op != OpS390XSLDconst || auxIntToUint8(sh.AuxInt) != 8 { 11807 continue 11808 } 11809 x0 := sh.Args[0] 11810 if x0.Op != OpS390XMOVBZload { 11811 continue 11812 } 11813 i0 := auxIntToInt32(x0.AuxInt) 11814 if auxToSym(x0.Aux) != s { 11815 continue 11816 } 11817 _ = x0.Args[1] 11818 if p != x0.Args[0] || mem != x0.Args[1] || !(i1 == i0+1 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { 11819 continue 11820 } 11821 b = mergePoint(b, x0, x1) 11822 v0 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16) 11823 v.copyOf(v0) 11824 v0.AuxInt = int32ToAuxInt(i0) 11825 v0.Aux = symToAux(s) 11826 v0.AddArg2(p, mem) 11827 return true 11828 } 11829 break 11830 } 11831 // match: (OR x1:(MOVHZload [i1] {s} p mem) sh:(SLDconst [16] x0:(MOVHZload [i0] {s} p mem))) 11832 // cond: i1 == i0+2 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) 11833 // result: @mergePoint(b,x0,x1) (MOVWZload [i0] {s} p mem) 11834 for { 11835 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11836 x1 := v_0 11837 if x1.Op != OpS390XMOVHZload { 11838 continue 11839 } 11840 i1 := auxIntToInt32(x1.AuxInt) 11841 s := auxToSym(x1.Aux) 11842 mem := x1.Args[1] 11843 p := x1.Args[0] 11844 sh := v_1 11845 if sh.Op != OpS390XSLDconst || auxIntToUint8(sh.AuxInt) != 16 { 11846 continue 11847 } 11848 x0 := sh.Args[0] 11849 if x0.Op != OpS390XMOVHZload { 11850 continue 11851 } 11852 i0 := auxIntToInt32(x0.AuxInt) 11853 if auxToSym(x0.Aux) != s { 11854 continue 11855 } 11856 _ = x0.Args[1] 11857 if p != x0.Args[0] || mem != x0.Args[1] || !(i1 == i0+2 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { 11858 continue 11859 } 11860 b = mergePoint(b, x0, x1) 11861 v0 := b.NewValue0(x0.Pos, OpS390XMOVWZload, typ.UInt32) 11862 v.copyOf(v0) 11863 v0.AuxInt = int32ToAuxInt(i0) 11864 v0.Aux = symToAux(s) 11865 v0.AddArg2(p, mem) 11866 return true 11867 } 11868 break 11869 } 11870 // match: (OR x1:(MOVWZload [i1] {s} p mem) sh:(SLDconst [32] x0:(MOVWZload [i0] {s} p mem))) 11871 // cond: i1 == i0+4 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) 11872 // result: @mergePoint(b,x0,x1) (MOVDload [i0] {s} p mem) 11873 for { 11874 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11875 x1 := v_0 11876 if x1.Op != OpS390XMOVWZload { 11877 continue 11878 } 11879 i1 := auxIntToInt32(x1.AuxInt) 11880 s := auxToSym(x1.Aux) 11881 mem := x1.Args[1] 11882 p := x1.Args[0] 11883 sh := v_1 11884 if sh.Op != OpS390XSLDconst || auxIntToUint8(sh.AuxInt) != 32 { 11885 continue 11886 } 11887 x0 := sh.Args[0] 11888 if x0.Op != OpS390XMOVWZload { 11889 continue 11890 } 11891 i0 := auxIntToInt32(x0.AuxInt) 11892 if auxToSym(x0.Aux) != s { 11893 continue 11894 } 11895 _ = x0.Args[1] 11896 if p != x0.Args[0] || mem != x0.Args[1] || !(i1 == i0+4 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { 11897 continue 11898 } 11899 b = mergePoint(b, x0, x1) 11900 v0 := b.NewValue0(x0.Pos, OpS390XMOVDload, typ.UInt64) 11901 v.copyOf(v0) 11902 v0.AuxInt = int32ToAuxInt(i0) 11903 v0.Aux = symToAux(s) 11904 v0.AddArg2(p, mem) 11905 return true 11906 } 11907 break 11908 } 11909 // match: (OR s0:(SLDconst [j0] x0:(MOVBZload [i0] {s} p mem)) or:(OR s1:(SLDconst [j1] x1:(MOVBZload [i1] {s} p mem)) y)) 11910 // cond: i1 == i0+1 && j1 == j0-8 && j1 % 16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) 11911 // result: @mergePoint(b,x0,x1,y) (OR <v.Type> (SLDconst <v.Type> [j1] (MOVHZload [i0] {s} p mem)) y) 11912 for { 11913 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11914 s0 := v_0 11915 if s0.Op != OpS390XSLDconst { 11916 continue 11917 } 11918 j0 := auxIntToUint8(s0.AuxInt) 11919 x0 := s0.Args[0] 11920 if x0.Op != OpS390XMOVBZload { 11921 continue 11922 } 11923 i0 := auxIntToInt32(x0.AuxInt) 11924 s := auxToSym(x0.Aux) 11925 mem := x0.Args[1] 11926 p := x0.Args[0] 11927 or := v_1 11928 if or.Op != OpS390XOR { 11929 continue 11930 } 11931 _ = or.Args[1] 11932 or_0 := or.Args[0] 11933 or_1 := or.Args[1] 11934 for _i1 := 0; _i1 <= 1; _i1, or_0, or_1 = _i1+1, or_1, or_0 { 11935 s1 := or_0 11936 if s1.Op != OpS390XSLDconst { 11937 continue 11938 } 11939 j1 := auxIntToUint8(s1.AuxInt) 11940 x1 := s1.Args[0] 11941 if x1.Op != OpS390XMOVBZload { 11942 continue 11943 } 11944 i1 := auxIntToInt32(x1.AuxInt) 11945 if auxToSym(x1.Aux) != s { 11946 continue 11947 } 11948 _ = x1.Args[1] 11949 if p != x1.Args[0] || mem != x1.Args[1] { 11950 continue 11951 } 11952 y := or_1 11953 if !(i1 == i0+1 && j1 == j0-8 && j1%16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { 11954 continue 11955 } 11956 b = mergePoint(b, x0, x1, y) 11957 v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type) 11958 v.copyOf(v0) 11959 v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type) 11960 v1.AuxInt = uint8ToAuxInt(j1) 11961 v2 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16) 11962 v2.AuxInt = int32ToAuxInt(i0) 11963 v2.Aux = symToAux(s) 11964 v2.AddArg2(p, mem) 11965 v1.AddArg(v2) 11966 v0.AddArg2(v1, y) 11967 return true 11968 } 11969 } 11970 break 11971 } 11972 // match: (OR s0:(SLDconst [j0] x0:(MOVHZload [i0] {s} p mem)) or:(OR s1:(SLDconst [j1] x1:(MOVHZload [i1] {s} p mem)) y)) 11973 // cond: i1 == i0+2 && j1 == j0-16 && j1 % 32 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) 11974 // result: @mergePoint(b,x0,x1,y) (OR <v.Type> (SLDconst <v.Type> [j1] (MOVWZload [i0] {s} p mem)) y) 11975 for { 11976 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11977 s0 := v_0 11978 if s0.Op != OpS390XSLDconst { 11979 continue 11980 } 11981 j0 := auxIntToUint8(s0.AuxInt) 11982 x0 := s0.Args[0] 11983 if x0.Op != OpS390XMOVHZload { 11984 continue 11985 } 11986 i0 := auxIntToInt32(x0.AuxInt) 11987 s := auxToSym(x0.Aux) 11988 mem := x0.Args[1] 11989 p := x0.Args[0] 11990 or := v_1 11991 if or.Op != OpS390XOR { 11992 continue 11993 } 11994 _ = or.Args[1] 11995 or_0 := or.Args[0] 11996 or_1 := or.Args[1] 11997 for _i1 := 0; _i1 <= 1; _i1, or_0, or_1 = _i1+1, or_1, or_0 { 11998 s1 := or_0 11999 if s1.Op != OpS390XSLDconst { 12000 continue 12001 } 12002 j1 := auxIntToUint8(s1.AuxInt) 12003 x1 := s1.Args[0] 12004 if x1.Op != OpS390XMOVHZload { 12005 continue 12006 } 12007 i1 := auxIntToInt32(x1.AuxInt) 12008 if auxToSym(x1.Aux) != s { 12009 continue 12010 } 12011 _ = x1.Args[1] 12012 if p != x1.Args[0] || mem != x1.Args[1] { 12013 continue 12014 } 12015 y := or_1 12016 if !(i1 == i0+2 && j1 == j0-16 && j1%32 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { 12017 continue 12018 } 12019 b = mergePoint(b, x0, x1, y) 12020 v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type) 12021 v.copyOf(v0) 12022 v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type) 12023 v1.AuxInt = uint8ToAuxInt(j1) 12024 v2 := b.NewValue0(x1.Pos, OpS390XMOVWZload, typ.UInt32) 12025 v2.AuxInt = int32ToAuxInt(i0) 12026 v2.Aux = symToAux(s) 12027 v2.AddArg2(p, mem) 12028 v1.AddArg(v2) 12029 v0.AddArg2(v1, y) 12030 return true 12031 } 12032 } 12033 break 12034 } 12035 // match: (OR x0:(MOVBZload [i0] {s} p mem) sh:(SLDconst [8] x1:(MOVBZload [i1] {s} p mem))) 12036 // cond: p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) 12037 // result: @mergePoint(b,x0,x1) (MOVHZreg (MOVHBRload [i0] {s} p mem)) 12038 for { 12039 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12040 x0 := v_0 12041 if x0.Op != OpS390XMOVBZload { 12042 continue 12043 } 12044 i0 := auxIntToInt32(x0.AuxInt) 12045 s := auxToSym(x0.Aux) 12046 mem := x0.Args[1] 12047 p := x0.Args[0] 12048 sh := v_1 12049 if sh.Op != OpS390XSLDconst || auxIntToUint8(sh.AuxInt) != 8 { 12050 continue 12051 } 12052 x1 := sh.Args[0] 12053 if x1.Op != OpS390XMOVBZload { 12054 continue 12055 } 12056 i1 := auxIntToInt32(x1.AuxInt) 12057 if auxToSym(x1.Aux) != s { 12058 continue 12059 } 12060 _ = x1.Args[1] 12061 if p != x1.Args[0] || mem != x1.Args[1] || !(p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { 12062 continue 12063 } 12064 b = mergePoint(b, x0, x1) 12065 v0 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64) 12066 v.copyOf(v0) 12067 v1 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16) 12068 v1.AuxInt = int32ToAuxInt(i0) 12069 v1.Aux = symToAux(s) 12070 v1.AddArg2(p, mem) 12071 v0.AddArg(v1) 12072 return true 12073 } 12074 break 12075 } 12076 // match: (OR r0:(MOVHZreg x0:(MOVHBRload [i0] {s} p mem)) sh:(SLDconst [16] r1:(MOVHZreg x1:(MOVHBRload [i1] {s} p mem)))) 12077 // cond: i1 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, r0, r1, sh) 12078 // result: @mergePoint(b,x0,x1) (MOVWZreg (MOVWBRload [i0] {s} p mem)) 12079 for { 12080 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12081 r0 := v_0 12082 if r0.Op != OpS390XMOVHZreg { 12083 continue 12084 } 12085 x0 := r0.Args[0] 12086 if x0.Op != OpS390XMOVHBRload { 12087 continue 12088 } 12089 i0 := auxIntToInt32(x0.AuxInt) 12090 s := auxToSym(x0.Aux) 12091 mem := x0.Args[1] 12092 p := x0.Args[0] 12093 sh := v_1 12094 if sh.Op != OpS390XSLDconst || auxIntToUint8(sh.AuxInt) != 16 { 12095 continue 12096 } 12097 r1 := sh.Args[0] 12098 if r1.Op != OpS390XMOVHZreg { 12099 continue 12100 } 12101 x1 := r1.Args[0] 12102 if x1.Op != OpS390XMOVHBRload { 12103 continue 12104 } 12105 i1 := auxIntToInt32(x1.AuxInt) 12106 if auxToSym(x1.Aux) != s { 12107 continue 12108 } 12109 _ = x1.Args[1] 12110 if p != x1.Args[0] || mem != x1.Args[1] || !(i1 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, r0, r1, sh)) { 12111 continue 12112 } 12113 b = mergePoint(b, x0, x1) 12114 v0 := b.NewValue0(x1.Pos, OpS390XMOVWZreg, typ.UInt64) 12115 v.copyOf(v0) 12116 v1 := b.NewValue0(x1.Pos, OpS390XMOVWBRload, typ.UInt32) 12117 v1.AuxInt = int32ToAuxInt(i0) 12118 v1.Aux = symToAux(s) 12119 v1.AddArg2(p, mem) 12120 v0.AddArg(v1) 12121 return true 12122 } 12123 break 12124 } 12125 // match: (OR r0:(MOVWZreg x0:(MOVWBRload [i0] {s} p mem)) sh:(SLDconst [32] r1:(MOVWZreg x1:(MOVWBRload [i1] {s} p mem)))) 12126 // cond: i1 == i0+4 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, r0, r1, sh) 12127 // result: @mergePoint(b,x0,x1) (MOVDBRload [i0] {s} p mem) 12128 for { 12129 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12130 r0 := v_0 12131 if r0.Op != OpS390XMOVWZreg { 12132 continue 12133 } 12134 x0 := r0.Args[0] 12135 if x0.Op != OpS390XMOVWBRload { 12136 continue 12137 } 12138 i0 := auxIntToInt32(x0.AuxInt) 12139 s := auxToSym(x0.Aux) 12140 mem := x0.Args[1] 12141 p := x0.Args[0] 12142 sh := v_1 12143 if sh.Op != OpS390XSLDconst || auxIntToUint8(sh.AuxInt) != 32 { 12144 continue 12145 } 12146 r1 := sh.Args[0] 12147 if r1.Op != OpS390XMOVWZreg { 12148 continue 12149 } 12150 x1 := r1.Args[0] 12151 if x1.Op != OpS390XMOVWBRload { 12152 continue 12153 } 12154 i1 := auxIntToInt32(x1.AuxInt) 12155 if auxToSym(x1.Aux) != s { 12156 continue 12157 } 12158 _ = x1.Args[1] 12159 if p != x1.Args[0] || mem != x1.Args[1] || !(i1 == i0+4 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, r0, r1, sh)) { 12160 continue 12161 } 12162 b = mergePoint(b, x0, x1) 12163 v0 := b.NewValue0(x1.Pos, OpS390XMOVDBRload, typ.UInt64) 12164 v.copyOf(v0) 12165 v0.AuxInt = int32ToAuxInt(i0) 12166 v0.Aux = symToAux(s) 12167 v0.AddArg2(p, mem) 12168 return true 12169 } 12170 break 12171 } 12172 // match: (OR s1:(SLDconst [j1] x1:(MOVBZload [i1] {s} p mem)) or:(OR s0:(SLDconst [j0] x0:(MOVBZload [i0] {s} p mem)) y)) 12173 // cond: p.Op != OpSB && i1 == i0+1 && j1 == j0+8 && j0 % 16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) 12174 // result: @mergePoint(b,x0,x1,y) (OR <v.Type> (SLDconst <v.Type> [j0] (MOVHZreg (MOVHBRload [i0] {s} p mem))) y) 12175 for { 12176 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12177 s1 := v_0 12178 if s1.Op != OpS390XSLDconst { 12179 continue 12180 } 12181 j1 := auxIntToUint8(s1.AuxInt) 12182 x1 := s1.Args[0] 12183 if x1.Op != OpS390XMOVBZload { 12184 continue 12185 } 12186 i1 := auxIntToInt32(x1.AuxInt) 12187 s := auxToSym(x1.Aux) 12188 mem := x1.Args[1] 12189 p := x1.Args[0] 12190 or := v_1 12191 if or.Op != OpS390XOR { 12192 continue 12193 } 12194 _ = or.Args[1] 12195 or_0 := or.Args[0] 12196 or_1 := or.Args[1] 12197 for _i1 := 0; _i1 <= 1; _i1, or_0, or_1 = _i1+1, or_1, or_0 { 12198 s0 := or_0 12199 if s0.Op != OpS390XSLDconst { 12200 continue 12201 } 12202 j0 := auxIntToUint8(s0.AuxInt) 12203 x0 := s0.Args[0] 12204 if x0.Op != OpS390XMOVBZload { 12205 continue 12206 } 12207 i0 := auxIntToInt32(x0.AuxInt) 12208 if auxToSym(x0.Aux) != s { 12209 continue 12210 } 12211 _ = x0.Args[1] 12212 if p != x0.Args[0] || mem != x0.Args[1] { 12213 continue 12214 } 12215 y := or_1 12216 if !(p.Op != OpSB && i1 == i0+1 && j1 == j0+8 && j0%16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { 12217 continue 12218 } 12219 b = mergePoint(b, x0, x1, y) 12220 v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type) 12221 v.copyOf(v0) 12222 v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type) 12223 v1.AuxInt = uint8ToAuxInt(j0) 12224 v2 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64) 12225 v3 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16) 12226 v3.AuxInt = int32ToAuxInt(i0) 12227 v3.Aux = symToAux(s) 12228 v3.AddArg2(p, mem) 12229 v2.AddArg(v3) 12230 v1.AddArg(v2) 12231 v0.AddArg2(v1, y) 12232 return true 12233 } 12234 } 12235 break 12236 } 12237 // match: (OR s1:(SLDconst [j1] r1:(MOVHZreg x1:(MOVHBRload [i1] {s} p mem))) or:(OR s0:(SLDconst [j0] r0:(MOVHZreg x0:(MOVHBRload [i0] {s} p mem))) y)) 12238 // cond: i1 == i0+2 && j1 == j0+16 && j0 % 32 == 0 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, r0, r1, s0, s1, or) 12239 // result: @mergePoint(b,x0,x1,y) (OR <v.Type> (SLDconst <v.Type> [j0] (MOVWZreg (MOVWBRload [i0] {s} p mem))) y) 12240 for { 12241 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12242 s1 := v_0 12243 if s1.Op != OpS390XSLDconst { 12244 continue 12245 } 12246 j1 := auxIntToUint8(s1.AuxInt) 12247 r1 := s1.Args[0] 12248 if r1.Op != OpS390XMOVHZreg { 12249 continue 12250 } 12251 x1 := r1.Args[0] 12252 if x1.Op != OpS390XMOVHBRload { 12253 continue 12254 } 12255 i1 := auxIntToInt32(x1.AuxInt) 12256 s := auxToSym(x1.Aux) 12257 mem := x1.Args[1] 12258 p := x1.Args[0] 12259 or := v_1 12260 if or.Op != OpS390XOR { 12261 continue 12262 } 12263 _ = or.Args[1] 12264 or_0 := or.Args[0] 12265 or_1 := or.Args[1] 12266 for _i1 := 0; _i1 <= 1; _i1, or_0, or_1 = _i1+1, or_1, or_0 { 12267 s0 := or_0 12268 if s0.Op != OpS390XSLDconst { 12269 continue 12270 } 12271 j0 := auxIntToUint8(s0.AuxInt) 12272 r0 := s0.Args[0] 12273 if r0.Op != OpS390XMOVHZreg { 12274 continue 12275 } 12276 x0 := r0.Args[0] 12277 if x0.Op != OpS390XMOVHBRload { 12278 continue 12279 } 12280 i0 := auxIntToInt32(x0.AuxInt) 12281 if auxToSym(x0.Aux) != s { 12282 continue 12283 } 12284 _ = x0.Args[1] 12285 if p != x0.Args[0] || mem != x0.Args[1] { 12286 continue 12287 } 12288 y := or_1 12289 if !(i1 == i0+2 && j1 == j0+16 && j0%32 == 0 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, r0, r1, s0, s1, or)) { 12290 continue 12291 } 12292 b = mergePoint(b, x0, x1, y) 12293 v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type) 12294 v.copyOf(v0) 12295 v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type) 12296 v1.AuxInt = uint8ToAuxInt(j0) 12297 v2 := b.NewValue0(x0.Pos, OpS390XMOVWZreg, typ.UInt64) 12298 v3 := b.NewValue0(x0.Pos, OpS390XMOVWBRload, typ.UInt32) 12299 v3.AuxInt = int32ToAuxInt(i0) 12300 v3.Aux = symToAux(s) 12301 v3.AddArg2(p, mem) 12302 v2.AddArg(v3) 12303 v1.AddArg(v2) 12304 v0.AddArg2(v1, y) 12305 return true 12306 } 12307 } 12308 break 12309 } 12310 return false 12311 } 12312 func rewriteValueS390X_OpS390XORW(v *Value) bool { 12313 v_1 := v.Args[1] 12314 v_0 := v.Args[0] 12315 b := v.Block 12316 typ := &b.Func.Config.Types 12317 // match: (ORW x (MOVDconst [c])) 12318 // result: (ORWconst [int32(c)] x) 12319 for { 12320 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12321 x := v_0 12322 if v_1.Op != OpS390XMOVDconst { 12323 continue 12324 } 12325 c := auxIntToInt64(v_1.AuxInt) 12326 v.reset(OpS390XORWconst) 12327 v.AuxInt = int32ToAuxInt(int32(c)) 12328 v.AddArg(x) 12329 return true 12330 } 12331 break 12332 } 12333 // match: (ORW x x) 12334 // result: x 12335 for { 12336 x := v_0 12337 if x != v_1 { 12338 break 12339 } 12340 v.copyOf(x) 12341 return true 12342 } 12343 // match: (ORW <t> x g:(MOVWload [off] {sym} ptr mem)) 12344 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 12345 // result: (ORWload <t> [off] {sym} x ptr mem) 12346 for { 12347 t := v.Type 12348 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12349 x := v_0 12350 g := v_1 12351 if g.Op != OpS390XMOVWload { 12352 continue 12353 } 12354 off := auxIntToInt32(g.AuxInt) 12355 sym := auxToSym(g.Aux) 12356 mem := g.Args[1] 12357 ptr := g.Args[0] 12358 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 12359 continue 12360 } 12361 v.reset(OpS390XORWload) 12362 v.Type = t 12363 v.AuxInt = int32ToAuxInt(off) 12364 v.Aux = symToAux(sym) 12365 v.AddArg3(x, ptr, mem) 12366 return true 12367 } 12368 break 12369 } 12370 // match: (ORW <t> x g:(MOVWZload [off] {sym} ptr mem)) 12371 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 12372 // result: (ORWload <t> [off] {sym} x ptr mem) 12373 for { 12374 t := v.Type 12375 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12376 x := v_0 12377 g := v_1 12378 if g.Op != OpS390XMOVWZload { 12379 continue 12380 } 12381 off := auxIntToInt32(g.AuxInt) 12382 sym := auxToSym(g.Aux) 12383 mem := g.Args[1] 12384 ptr := g.Args[0] 12385 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 12386 continue 12387 } 12388 v.reset(OpS390XORWload) 12389 v.Type = t 12390 v.AuxInt = int32ToAuxInt(off) 12391 v.Aux = symToAux(sym) 12392 v.AddArg3(x, ptr, mem) 12393 return true 12394 } 12395 break 12396 } 12397 // match: (ORW x1:(MOVBZload [i1] {s} p mem) sh:(SLWconst [8] x0:(MOVBZload [i0] {s} p mem))) 12398 // cond: i1 == i0+1 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) 12399 // result: @mergePoint(b,x0,x1) (MOVHZload [i0] {s} p mem) 12400 for { 12401 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12402 x1 := v_0 12403 if x1.Op != OpS390XMOVBZload { 12404 continue 12405 } 12406 i1 := auxIntToInt32(x1.AuxInt) 12407 s := auxToSym(x1.Aux) 12408 mem := x1.Args[1] 12409 p := x1.Args[0] 12410 sh := v_1 12411 if sh.Op != OpS390XSLWconst || auxIntToUint8(sh.AuxInt) != 8 { 12412 continue 12413 } 12414 x0 := sh.Args[0] 12415 if x0.Op != OpS390XMOVBZload { 12416 continue 12417 } 12418 i0 := auxIntToInt32(x0.AuxInt) 12419 if auxToSym(x0.Aux) != s { 12420 continue 12421 } 12422 _ = x0.Args[1] 12423 if p != x0.Args[0] || mem != x0.Args[1] || !(i1 == i0+1 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { 12424 continue 12425 } 12426 b = mergePoint(b, x0, x1) 12427 v0 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16) 12428 v.copyOf(v0) 12429 v0.AuxInt = int32ToAuxInt(i0) 12430 v0.Aux = symToAux(s) 12431 v0.AddArg2(p, mem) 12432 return true 12433 } 12434 break 12435 } 12436 // match: (ORW x1:(MOVHZload [i1] {s} p mem) sh:(SLWconst [16] x0:(MOVHZload [i0] {s} p mem))) 12437 // cond: i1 == i0+2 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) 12438 // result: @mergePoint(b,x0,x1) (MOVWZload [i0] {s} p mem) 12439 for { 12440 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12441 x1 := v_0 12442 if x1.Op != OpS390XMOVHZload { 12443 continue 12444 } 12445 i1 := auxIntToInt32(x1.AuxInt) 12446 s := auxToSym(x1.Aux) 12447 mem := x1.Args[1] 12448 p := x1.Args[0] 12449 sh := v_1 12450 if sh.Op != OpS390XSLWconst || auxIntToUint8(sh.AuxInt) != 16 { 12451 continue 12452 } 12453 x0 := sh.Args[0] 12454 if x0.Op != OpS390XMOVHZload { 12455 continue 12456 } 12457 i0 := auxIntToInt32(x0.AuxInt) 12458 if auxToSym(x0.Aux) != s { 12459 continue 12460 } 12461 _ = x0.Args[1] 12462 if p != x0.Args[0] || mem != x0.Args[1] || !(i1 == i0+2 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { 12463 continue 12464 } 12465 b = mergePoint(b, x0, x1) 12466 v0 := b.NewValue0(x0.Pos, OpS390XMOVWZload, typ.UInt32) 12467 v.copyOf(v0) 12468 v0.AuxInt = int32ToAuxInt(i0) 12469 v0.Aux = symToAux(s) 12470 v0.AddArg2(p, mem) 12471 return true 12472 } 12473 break 12474 } 12475 // match: (ORW s0:(SLWconst [j0] x0:(MOVBZload [i0] {s} p mem)) or:(ORW s1:(SLWconst [j1] x1:(MOVBZload [i1] {s} p mem)) y)) 12476 // cond: i1 == i0+1 && j1 == j0-8 && j1 % 16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) 12477 // result: @mergePoint(b,x0,x1,y) (ORW <v.Type> (SLWconst <v.Type> [j1] (MOVHZload [i0] {s} p mem)) y) 12478 for { 12479 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12480 s0 := v_0 12481 if s0.Op != OpS390XSLWconst { 12482 continue 12483 } 12484 j0 := auxIntToUint8(s0.AuxInt) 12485 x0 := s0.Args[0] 12486 if x0.Op != OpS390XMOVBZload { 12487 continue 12488 } 12489 i0 := auxIntToInt32(x0.AuxInt) 12490 s := auxToSym(x0.Aux) 12491 mem := x0.Args[1] 12492 p := x0.Args[0] 12493 or := v_1 12494 if or.Op != OpS390XORW { 12495 continue 12496 } 12497 _ = or.Args[1] 12498 or_0 := or.Args[0] 12499 or_1 := or.Args[1] 12500 for _i1 := 0; _i1 <= 1; _i1, or_0, or_1 = _i1+1, or_1, or_0 { 12501 s1 := or_0 12502 if s1.Op != OpS390XSLWconst { 12503 continue 12504 } 12505 j1 := auxIntToUint8(s1.AuxInt) 12506 x1 := s1.Args[0] 12507 if x1.Op != OpS390XMOVBZload { 12508 continue 12509 } 12510 i1 := auxIntToInt32(x1.AuxInt) 12511 if auxToSym(x1.Aux) != s { 12512 continue 12513 } 12514 _ = x1.Args[1] 12515 if p != x1.Args[0] || mem != x1.Args[1] { 12516 continue 12517 } 12518 y := or_1 12519 if !(i1 == i0+1 && j1 == j0-8 && j1%16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { 12520 continue 12521 } 12522 b = mergePoint(b, x0, x1, y) 12523 v0 := b.NewValue0(x1.Pos, OpS390XORW, v.Type) 12524 v.copyOf(v0) 12525 v1 := b.NewValue0(x1.Pos, OpS390XSLWconst, v.Type) 12526 v1.AuxInt = uint8ToAuxInt(j1) 12527 v2 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16) 12528 v2.AuxInt = int32ToAuxInt(i0) 12529 v2.Aux = symToAux(s) 12530 v2.AddArg2(p, mem) 12531 v1.AddArg(v2) 12532 v0.AddArg2(v1, y) 12533 return true 12534 } 12535 } 12536 break 12537 } 12538 // match: (ORW x0:(MOVBZload [i0] {s} p mem) sh:(SLWconst [8] x1:(MOVBZload [i1] {s} p mem))) 12539 // cond: p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) 12540 // result: @mergePoint(b,x0,x1) (MOVHZreg (MOVHBRload [i0] {s} p mem)) 12541 for { 12542 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12543 x0 := v_0 12544 if x0.Op != OpS390XMOVBZload { 12545 continue 12546 } 12547 i0 := auxIntToInt32(x0.AuxInt) 12548 s := auxToSym(x0.Aux) 12549 mem := x0.Args[1] 12550 p := x0.Args[0] 12551 sh := v_1 12552 if sh.Op != OpS390XSLWconst || auxIntToUint8(sh.AuxInt) != 8 { 12553 continue 12554 } 12555 x1 := sh.Args[0] 12556 if x1.Op != OpS390XMOVBZload { 12557 continue 12558 } 12559 i1 := auxIntToInt32(x1.AuxInt) 12560 if auxToSym(x1.Aux) != s { 12561 continue 12562 } 12563 _ = x1.Args[1] 12564 if p != x1.Args[0] || mem != x1.Args[1] || !(p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { 12565 continue 12566 } 12567 b = mergePoint(b, x0, x1) 12568 v0 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64) 12569 v.copyOf(v0) 12570 v1 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16) 12571 v1.AuxInt = int32ToAuxInt(i0) 12572 v1.Aux = symToAux(s) 12573 v1.AddArg2(p, mem) 12574 v0.AddArg(v1) 12575 return true 12576 } 12577 break 12578 } 12579 // match: (ORW r0:(MOVHZreg x0:(MOVHBRload [i0] {s} p mem)) sh:(SLWconst [16] r1:(MOVHZreg x1:(MOVHBRload [i1] {s} p mem)))) 12580 // cond: i1 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, r0, r1, sh) 12581 // result: @mergePoint(b,x0,x1) (MOVWBRload [i0] {s} p mem) 12582 for { 12583 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12584 r0 := v_0 12585 if r0.Op != OpS390XMOVHZreg { 12586 continue 12587 } 12588 x0 := r0.Args[0] 12589 if x0.Op != OpS390XMOVHBRload { 12590 continue 12591 } 12592 i0 := auxIntToInt32(x0.AuxInt) 12593 s := auxToSym(x0.Aux) 12594 mem := x0.Args[1] 12595 p := x0.Args[0] 12596 sh := v_1 12597 if sh.Op != OpS390XSLWconst || auxIntToUint8(sh.AuxInt) != 16 { 12598 continue 12599 } 12600 r1 := sh.Args[0] 12601 if r1.Op != OpS390XMOVHZreg { 12602 continue 12603 } 12604 x1 := r1.Args[0] 12605 if x1.Op != OpS390XMOVHBRload { 12606 continue 12607 } 12608 i1 := auxIntToInt32(x1.AuxInt) 12609 if auxToSym(x1.Aux) != s { 12610 continue 12611 } 12612 _ = x1.Args[1] 12613 if p != x1.Args[0] || mem != x1.Args[1] || !(i1 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, r0, r1, sh)) { 12614 continue 12615 } 12616 b = mergePoint(b, x0, x1) 12617 v0 := b.NewValue0(x1.Pos, OpS390XMOVWBRload, typ.UInt32) 12618 v.copyOf(v0) 12619 v0.AuxInt = int32ToAuxInt(i0) 12620 v0.Aux = symToAux(s) 12621 v0.AddArg2(p, mem) 12622 return true 12623 } 12624 break 12625 } 12626 // match: (ORW s1:(SLWconst [j1] x1:(MOVBZload [i1] {s} p mem)) or:(ORW s0:(SLWconst [j0] x0:(MOVBZload [i0] {s} p mem)) y)) 12627 // cond: p.Op != OpSB && i1 == i0+1 && j1 == j0+8 && j0 % 16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) 12628 // result: @mergePoint(b,x0,x1,y) (ORW <v.Type> (SLWconst <v.Type> [j0] (MOVHZreg (MOVHBRload [i0] {s} p mem))) y) 12629 for { 12630 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12631 s1 := v_0 12632 if s1.Op != OpS390XSLWconst { 12633 continue 12634 } 12635 j1 := auxIntToUint8(s1.AuxInt) 12636 x1 := s1.Args[0] 12637 if x1.Op != OpS390XMOVBZload { 12638 continue 12639 } 12640 i1 := auxIntToInt32(x1.AuxInt) 12641 s := auxToSym(x1.Aux) 12642 mem := x1.Args[1] 12643 p := x1.Args[0] 12644 or := v_1 12645 if or.Op != OpS390XORW { 12646 continue 12647 } 12648 _ = or.Args[1] 12649 or_0 := or.Args[0] 12650 or_1 := or.Args[1] 12651 for _i1 := 0; _i1 <= 1; _i1, or_0, or_1 = _i1+1, or_1, or_0 { 12652 s0 := or_0 12653 if s0.Op != OpS390XSLWconst { 12654 continue 12655 } 12656 j0 := auxIntToUint8(s0.AuxInt) 12657 x0 := s0.Args[0] 12658 if x0.Op != OpS390XMOVBZload { 12659 continue 12660 } 12661 i0 := auxIntToInt32(x0.AuxInt) 12662 if auxToSym(x0.Aux) != s { 12663 continue 12664 } 12665 _ = x0.Args[1] 12666 if p != x0.Args[0] || mem != x0.Args[1] { 12667 continue 12668 } 12669 y := or_1 12670 if !(p.Op != OpSB && i1 == i0+1 && j1 == j0+8 && j0%16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { 12671 continue 12672 } 12673 b = mergePoint(b, x0, x1, y) 12674 v0 := b.NewValue0(x0.Pos, OpS390XORW, v.Type) 12675 v.copyOf(v0) 12676 v1 := b.NewValue0(x0.Pos, OpS390XSLWconst, v.Type) 12677 v1.AuxInt = uint8ToAuxInt(j0) 12678 v2 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64) 12679 v3 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16) 12680 v3.AuxInt = int32ToAuxInt(i0) 12681 v3.Aux = symToAux(s) 12682 v3.AddArg2(p, mem) 12683 v2.AddArg(v3) 12684 v1.AddArg(v2) 12685 v0.AddArg2(v1, y) 12686 return true 12687 } 12688 } 12689 break 12690 } 12691 return false 12692 } 12693 func rewriteValueS390X_OpS390XORWconst(v *Value) bool { 12694 v_0 := v.Args[0] 12695 // match: (ORWconst [c] x) 12696 // cond: int32(c)==0 12697 // result: x 12698 for { 12699 c := auxIntToInt32(v.AuxInt) 12700 x := v_0 12701 if !(int32(c) == 0) { 12702 break 12703 } 12704 v.copyOf(x) 12705 return true 12706 } 12707 // match: (ORWconst [c] _) 12708 // cond: int32(c)==-1 12709 // result: (MOVDconst [-1]) 12710 for { 12711 c := auxIntToInt32(v.AuxInt) 12712 if !(int32(c) == -1) { 12713 break 12714 } 12715 v.reset(OpS390XMOVDconst) 12716 v.AuxInt = int64ToAuxInt(-1) 12717 return true 12718 } 12719 // match: (ORWconst [c] (MOVDconst [d])) 12720 // result: (MOVDconst [int64(c)|d]) 12721 for { 12722 c := auxIntToInt32(v.AuxInt) 12723 if v_0.Op != OpS390XMOVDconst { 12724 break 12725 } 12726 d := auxIntToInt64(v_0.AuxInt) 12727 v.reset(OpS390XMOVDconst) 12728 v.AuxInt = int64ToAuxInt(int64(c) | d) 12729 return true 12730 } 12731 return false 12732 } 12733 func rewriteValueS390X_OpS390XORWload(v *Value) bool { 12734 v_2 := v.Args[2] 12735 v_1 := v.Args[1] 12736 v_0 := v.Args[0] 12737 // match: (ORWload [off1] {sym} x (ADDconst [off2] ptr) mem) 12738 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 12739 // result: (ORWload [off1+off2] {sym} x ptr mem) 12740 for { 12741 off1 := auxIntToInt32(v.AuxInt) 12742 sym := auxToSym(v.Aux) 12743 x := v_0 12744 if v_1.Op != OpS390XADDconst { 12745 break 12746 } 12747 off2 := auxIntToInt32(v_1.AuxInt) 12748 ptr := v_1.Args[0] 12749 mem := v_2 12750 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 12751 break 12752 } 12753 v.reset(OpS390XORWload) 12754 v.AuxInt = int32ToAuxInt(off1 + off2) 12755 v.Aux = symToAux(sym) 12756 v.AddArg3(x, ptr, mem) 12757 return true 12758 } 12759 // match: (ORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 12760 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 12761 // result: (ORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 12762 for { 12763 o1 := auxIntToInt32(v.AuxInt) 12764 s1 := auxToSym(v.Aux) 12765 x := v_0 12766 if v_1.Op != OpS390XMOVDaddr { 12767 break 12768 } 12769 o2 := auxIntToInt32(v_1.AuxInt) 12770 s2 := auxToSym(v_1.Aux) 12771 ptr := v_1.Args[0] 12772 mem := v_2 12773 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 12774 break 12775 } 12776 v.reset(OpS390XORWload) 12777 v.AuxInt = int32ToAuxInt(o1 + o2) 12778 v.Aux = symToAux(mergeSym(s1, s2)) 12779 v.AddArg3(x, ptr, mem) 12780 return true 12781 } 12782 return false 12783 } 12784 func rewriteValueS390X_OpS390XORconst(v *Value) bool { 12785 v_0 := v.Args[0] 12786 // match: (ORconst [0] x) 12787 // result: x 12788 for { 12789 if auxIntToInt64(v.AuxInt) != 0 { 12790 break 12791 } 12792 x := v_0 12793 v.copyOf(x) 12794 return true 12795 } 12796 // match: (ORconst [-1] _) 12797 // result: (MOVDconst [-1]) 12798 for { 12799 if auxIntToInt64(v.AuxInt) != -1 { 12800 break 12801 } 12802 v.reset(OpS390XMOVDconst) 12803 v.AuxInt = int64ToAuxInt(-1) 12804 return true 12805 } 12806 // match: (ORconst [c] (MOVDconst [d])) 12807 // result: (MOVDconst [c|d]) 12808 for { 12809 c := auxIntToInt64(v.AuxInt) 12810 if v_0.Op != OpS390XMOVDconst { 12811 break 12812 } 12813 d := auxIntToInt64(v_0.AuxInt) 12814 v.reset(OpS390XMOVDconst) 12815 v.AuxInt = int64ToAuxInt(c | d) 12816 return true 12817 } 12818 return false 12819 } 12820 func rewriteValueS390X_OpS390XORload(v *Value) bool { 12821 v_2 := v.Args[2] 12822 v_1 := v.Args[1] 12823 v_0 := v.Args[0] 12824 b := v.Block 12825 // match: (ORload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 12826 // cond: isSamePtr(ptr1, ptr2) 12827 // result: (OR x (LGDR <t> y)) 12828 for { 12829 t := v.Type 12830 off := auxIntToInt32(v.AuxInt) 12831 sym := auxToSym(v.Aux) 12832 x := v_0 12833 ptr1 := v_1 12834 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 12835 break 12836 } 12837 y := v_2.Args[1] 12838 ptr2 := v_2.Args[0] 12839 if !(isSamePtr(ptr1, ptr2)) { 12840 break 12841 } 12842 v.reset(OpS390XOR) 12843 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 12844 v0.AddArg(y) 12845 v.AddArg2(x, v0) 12846 return true 12847 } 12848 // match: (ORload [off1] {sym} x (ADDconst [off2] ptr) mem) 12849 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 12850 // result: (ORload [off1+off2] {sym} x ptr mem) 12851 for { 12852 off1 := auxIntToInt32(v.AuxInt) 12853 sym := auxToSym(v.Aux) 12854 x := v_0 12855 if v_1.Op != OpS390XADDconst { 12856 break 12857 } 12858 off2 := auxIntToInt32(v_1.AuxInt) 12859 ptr := v_1.Args[0] 12860 mem := v_2 12861 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 12862 break 12863 } 12864 v.reset(OpS390XORload) 12865 v.AuxInt = int32ToAuxInt(off1 + off2) 12866 v.Aux = symToAux(sym) 12867 v.AddArg3(x, ptr, mem) 12868 return true 12869 } 12870 // match: (ORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 12871 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 12872 // result: (ORload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 12873 for { 12874 o1 := auxIntToInt32(v.AuxInt) 12875 s1 := auxToSym(v.Aux) 12876 x := v_0 12877 if v_1.Op != OpS390XMOVDaddr { 12878 break 12879 } 12880 o2 := auxIntToInt32(v_1.AuxInt) 12881 s2 := auxToSym(v_1.Aux) 12882 ptr := v_1.Args[0] 12883 mem := v_2 12884 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 12885 break 12886 } 12887 v.reset(OpS390XORload) 12888 v.AuxInt = int32ToAuxInt(o1 + o2) 12889 v.Aux = symToAux(mergeSym(s1, s2)) 12890 v.AddArg3(x, ptr, mem) 12891 return true 12892 } 12893 return false 12894 } 12895 func rewriteValueS390X_OpS390XRISBGZ(v *Value) bool { 12896 v_0 := v.Args[0] 12897 b := v.Block 12898 // match: (RISBGZ (MOVWZreg x) {r}) 12899 // cond: r.InMerge(0xffffffff) != nil 12900 // result: (RISBGZ x {*r.InMerge(0xffffffff)}) 12901 for { 12902 r := auxToS390xRotateParams(v.Aux) 12903 if v_0.Op != OpS390XMOVWZreg { 12904 break 12905 } 12906 x := v_0.Args[0] 12907 if !(r.InMerge(0xffffffff) != nil) { 12908 break 12909 } 12910 v.reset(OpS390XRISBGZ) 12911 v.Aux = s390xRotateParamsToAux(*r.InMerge(0xffffffff)) 12912 v.AddArg(x) 12913 return true 12914 } 12915 // match: (RISBGZ (MOVHZreg x) {r}) 12916 // cond: r.InMerge(0x0000ffff) != nil 12917 // result: (RISBGZ x {*r.InMerge(0x0000ffff)}) 12918 for { 12919 r := auxToS390xRotateParams(v.Aux) 12920 if v_0.Op != OpS390XMOVHZreg { 12921 break 12922 } 12923 x := v_0.Args[0] 12924 if !(r.InMerge(0x0000ffff) != nil) { 12925 break 12926 } 12927 v.reset(OpS390XRISBGZ) 12928 v.Aux = s390xRotateParamsToAux(*r.InMerge(0x0000ffff)) 12929 v.AddArg(x) 12930 return true 12931 } 12932 // match: (RISBGZ (MOVBZreg x) {r}) 12933 // cond: r.InMerge(0x000000ff) != nil 12934 // result: (RISBGZ x {*r.InMerge(0x000000ff)}) 12935 for { 12936 r := auxToS390xRotateParams(v.Aux) 12937 if v_0.Op != OpS390XMOVBZreg { 12938 break 12939 } 12940 x := v_0.Args[0] 12941 if !(r.InMerge(0x000000ff) != nil) { 12942 break 12943 } 12944 v.reset(OpS390XRISBGZ) 12945 v.Aux = s390xRotateParamsToAux(*r.InMerge(0x000000ff)) 12946 v.AddArg(x) 12947 return true 12948 } 12949 // match: (RISBGZ (SLDconst x [c]) {r}) 12950 // cond: r.InMerge(^uint64(0)<<c) != nil 12951 // result: (RISBGZ x {(*r.InMerge(^uint64(0)<<c)).RotateLeft(c)}) 12952 for { 12953 r := auxToS390xRotateParams(v.Aux) 12954 if v_0.Op != OpS390XSLDconst { 12955 break 12956 } 12957 c := auxIntToUint8(v_0.AuxInt) 12958 x := v_0.Args[0] 12959 if !(r.InMerge(^uint64(0)<<c) != nil) { 12960 break 12961 } 12962 v.reset(OpS390XRISBGZ) 12963 v.Aux = s390xRotateParamsToAux((*r.InMerge(^uint64(0) << c)).RotateLeft(c)) 12964 v.AddArg(x) 12965 return true 12966 } 12967 // match: (RISBGZ (SRDconst x [c]) {r}) 12968 // cond: r.InMerge(^uint64(0)>>c) != nil 12969 // result: (RISBGZ x {(*r.InMerge(^uint64(0)>>c)).RotateLeft(-c)}) 12970 for { 12971 r := auxToS390xRotateParams(v.Aux) 12972 if v_0.Op != OpS390XSRDconst { 12973 break 12974 } 12975 c := auxIntToUint8(v_0.AuxInt) 12976 x := v_0.Args[0] 12977 if !(r.InMerge(^uint64(0)>>c) != nil) { 12978 break 12979 } 12980 v.reset(OpS390XRISBGZ) 12981 v.Aux = s390xRotateParamsToAux((*r.InMerge(^uint64(0) >> c)).RotateLeft(-c)) 12982 v.AddArg(x) 12983 return true 12984 } 12985 // match: (RISBGZ (RISBGZ x {y}) {z}) 12986 // cond: z.InMerge(y.OutMask()) != nil 12987 // result: (RISBGZ x {(*z.InMerge(y.OutMask())).RotateLeft(y.Amount)}) 12988 for { 12989 z := auxToS390xRotateParams(v.Aux) 12990 if v_0.Op != OpS390XRISBGZ { 12991 break 12992 } 12993 y := auxToS390xRotateParams(v_0.Aux) 12994 x := v_0.Args[0] 12995 if !(z.InMerge(y.OutMask()) != nil) { 12996 break 12997 } 12998 v.reset(OpS390XRISBGZ) 12999 v.Aux = s390xRotateParamsToAux((*z.InMerge(y.OutMask())).RotateLeft(y.Amount)) 13000 v.AddArg(x) 13001 return true 13002 } 13003 // match: (RISBGZ x {r}) 13004 // cond: r.End == 63 && r.Start == -r.Amount&63 13005 // result: (SRDconst x [-r.Amount&63]) 13006 for { 13007 r := auxToS390xRotateParams(v.Aux) 13008 x := v_0 13009 if !(r.End == 63 && r.Start == -r.Amount&63) { 13010 break 13011 } 13012 v.reset(OpS390XSRDconst) 13013 v.AuxInt = uint8ToAuxInt(-r.Amount & 63) 13014 v.AddArg(x) 13015 return true 13016 } 13017 // match: (RISBGZ x {r}) 13018 // cond: r.Start == 0 && r.End == 63-r.Amount 13019 // result: (SLDconst x [r.Amount]) 13020 for { 13021 r := auxToS390xRotateParams(v.Aux) 13022 x := v_0 13023 if !(r.Start == 0 && r.End == 63-r.Amount) { 13024 break 13025 } 13026 v.reset(OpS390XSLDconst) 13027 v.AuxInt = uint8ToAuxInt(r.Amount) 13028 v.AddArg(x) 13029 return true 13030 } 13031 // match: (RISBGZ (SRADconst x [c]) {r}) 13032 // cond: r.Start == r.End && (r.Start+r.Amount)&63 <= c 13033 // result: (RISBGZ x {s390x.NewRotateParams(r.Start, r.Start, -r.Start&63)}) 13034 for { 13035 r := auxToS390xRotateParams(v.Aux) 13036 if v_0.Op != OpS390XSRADconst { 13037 break 13038 } 13039 c := auxIntToUint8(v_0.AuxInt) 13040 x := v_0.Args[0] 13041 if !(r.Start == r.End && (r.Start+r.Amount)&63 <= c) { 13042 break 13043 } 13044 v.reset(OpS390XRISBGZ) 13045 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(r.Start, r.Start, -r.Start&63)) 13046 v.AddArg(x) 13047 return true 13048 } 13049 // match: (RISBGZ x {r}) 13050 // cond: r == s390x.NewRotateParams(56, 63, 0) 13051 // result: (MOVBZreg x) 13052 for { 13053 r := auxToS390xRotateParams(v.Aux) 13054 x := v_0 13055 if !(r == s390x.NewRotateParams(56, 63, 0)) { 13056 break 13057 } 13058 v.reset(OpS390XMOVBZreg) 13059 v.AddArg(x) 13060 return true 13061 } 13062 // match: (RISBGZ x {r}) 13063 // cond: r == s390x.NewRotateParams(48, 63, 0) 13064 // result: (MOVHZreg x) 13065 for { 13066 r := auxToS390xRotateParams(v.Aux) 13067 x := v_0 13068 if !(r == s390x.NewRotateParams(48, 63, 0)) { 13069 break 13070 } 13071 v.reset(OpS390XMOVHZreg) 13072 v.AddArg(x) 13073 return true 13074 } 13075 // match: (RISBGZ x {r}) 13076 // cond: r == s390x.NewRotateParams(32, 63, 0) 13077 // result: (MOVWZreg x) 13078 for { 13079 r := auxToS390xRotateParams(v.Aux) 13080 x := v_0 13081 if !(r == s390x.NewRotateParams(32, 63, 0)) { 13082 break 13083 } 13084 v.reset(OpS390XMOVWZreg) 13085 v.AddArg(x) 13086 return true 13087 } 13088 // match: (RISBGZ (LGDR <t> x) {r}) 13089 // cond: r == s390x.NewRotateParams(1, 63, 0) 13090 // result: (LGDR <t> (LPDFR <x.Type> x)) 13091 for { 13092 r := auxToS390xRotateParams(v.Aux) 13093 if v_0.Op != OpS390XLGDR { 13094 break 13095 } 13096 t := v_0.Type 13097 x := v_0.Args[0] 13098 if !(r == s390x.NewRotateParams(1, 63, 0)) { 13099 break 13100 } 13101 v.reset(OpS390XLGDR) 13102 v.Type = t 13103 v0 := b.NewValue0(v.Pos, OpS390XLPDFR, x.Type) 13104 v0.AddArg(x) 13105 v.AddArg(v0) 13106 return true 13107 } 13108 return false 13109 } 13110 func rewriteValueS390X_OpS390XRLL(v *Value) bool { 13111 v_1 := v.Args[1] 13112 v_0 := v.Args[0] 13113 // match: (RLL x (MOVDconst [c])) 13114 // result: (RLLconst x [uint8(c&31)]) 13115 for { 13116 x := v_0 13117 if v_1.Op != OpS390XMOVDconst { 13118 break 13119 } 13120 c := auxIntToInt64(v_1.AuxInt) 13121 v.reset(OpS390XRLLconst) 13122 v.AuxInt = uint8ToAuxInt(uint8(c & 31)) 13123 v.AddArg(x) 13124 return true 13125 } 13126 return false 13127 } 13128 func rewriteValueS390X_OpS390XRLLG(v *Value) bool { 13129 v_1 := v.Args[1] 13130 v_0 := v.Args[0] 13131 // match: (RLLG x (MOVDconst [c])) 13132 // result: (RISBGZ x {s390x.NewRotateParams(0, 63, uint8(c&63))}) 13133 for { 13134 x := v_0 13135 if v_1.Op != OpS390XMOVDconst { 13136 break 13137 } 13138 c := auxIntToInt64(v_1.AuxInt) 13139 v.reset(OpS390XRISBGZ) 13140 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(0, 63, uint8(c&63))) 13141 v.AddArg(x) 13142 return true 13143 } 13144 return false 13145 } 13146 func rewriteValueS390X_OpS390XSLD(v *Value) bool { 13147 v_1 := v.Args[1] 13148 v_0 := v.Args[0] 13149 b := v.Block 13150 typ := &b.Func.Config.Types 13151 // match: (SLD x (MOVDconst [c])) 13152 // result: (SLDconst x [uint8(c&63)]) 13153 for { 13154 x := v_0 13155 if v_1.Op != OpS390XMOVDconst { 13156 break 13157 } 13158 c := auxIntToInt64(v_1.AuxInt) 13159 v.reset(OpS390XSLDconst) 13160 v.AuxInt = uint8ToAuxInt(uint8(c & 63)) 13161 v.AddArg(x) 13162 return true 13163 } 13164 // match: (SLD x (RISBGZ y {r})) 13165 // cond: r.Amount == 0 && r.OutMask()&63 == 63 13166 // result: (SLD x y) 13167 for { 13168 x := v_0 13169 if v_1.Op != OpS390XRISBGZ { 13170 break 13171 } 13172 r := auxToS390xRotateParams(v_1.Aux) 13173 y := v_1.Args[0] 13174 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 13175 break 13176 } 13177 v.reset(OpS390XSLD) 13178 v.AddArg2(x, y) 13179 return true 13180 } 13181 // match: (SLD x (AND (MOVDconst [c]) y)) 13182 // result: (SLD x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 13183 for { 13184 x := v_0 13185 if v_1.Op != OpS390XAND { 13186 break 13187 } 13188 _ = v_1.Args[1] 13189 v_1_0 := v_1.Args[0] 13190 v_1_1 := v_1.Args[1] 13191 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 13192 if v_1_0.Op != OpS390XMOVDconst { 13193 continue 13194 } 13195 c := auxIntToInt64(v_1_0.AuxInt) 13196 y := v_1_1 13197 v.reset(OpS390XSLD) 13198 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 13199 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 13200 v0.AddArg(y) 13201 v.AddArg2(x, v0) 13202 return true 13203 } 13204 break 13205 } 13206 // match: (SLD x (ANDWconst [c] y)) 13207 // cond: c&63 == 63 13208 // result: (SLD x y) 13209 for { 13210 x := v_0 13211 if v_1.Op != OpS390XANDWconst { 13212 break 13213 } 13214 c := auxIntToInt32(v_1.AuxInt) 13215 y := v_1.Args[0] 13216 if !(c&63 == 63) { 13217 break 13218 } 13219 v.reset(OpS390XSLD) 13220 v.AddArg2(x, y) 13221 return true 13222 } 13223 // match: (SLD x (MOVWreg y)) 13224 // result: (SLD x y) 13225 for { 13226 x := v_0 13227 if v_1.Op != OpS390XMOVWreg { 13228 break 13229 } 13230 y := v_1.Args[0] 13231 v.reset(OpS390XSLD) 13232 v.AddArg2(x, y) 13233 return true 13234 } 13235 // match: (SLD x (MOVHreg y)) 13236 // result: (SLD x y) 13237 for { 13238 x := v_0 13239 if v_1.Op != OpS390XMOVHreg { 13240 break 13241 } 13242 y := v_1.Args[0] 13243 v.reset(OpS390XSLD) 13244 v.AddArg2(x, y) 13245 return true 13246 } 13247 // match: (SLD x (MOVBreg y)) 13248 // result: (SLD x y) 13249 for { 13250 x := v_0 13251 if v_1.Op != OpS390XMOVBreg { 13252 break 13253 } 13254 y := v_1.Args[0] 13255 v.reset(OpS390XSLD) 13256 v.AddArg2(x, y) 13257 return true 13258 } 13259 // match: (SLD x (MOVWZreg y)) 13260 // result: (SLD x y) 13261 for { 13262 x := v_0 13263 if v_1.Op != OpS390XMOVWZreg { 13264 break 13265 } 13266 y := v_1.Args[0] 13267 v.reset(OpS390XSLD) 13268 v.AddArg2(x, y) 13269 return true 13270 } 13271 // match: (SLD x (MOVHZreg y)) 13272 // result: (SLD x y) 13273 for { 13274 x := v_0 13275 if v_1.Op != OpS390XMOVHZreg { 13276 break 13277 } 13278 y := v_1.Args[0] 13279 v.reset(OpS390XSLD) 13280 v.AddArg2(x, y) 13281 return true 13282 } 13283 // match: (SLD x (MOVBZreg y)) 13284 // result: (SLD x y) 13285 for { 13286 x := v_0 13287 if v_1.Op != OpS390XMOVBZreg { 13288 break 13289 } 13290 y := v_1.Args[0] 13291 v.reset(OpS390XSLD) 13292 v.AddArg2(x, y) 13293 return true 13294 } 13295 return false 13296 } 13297 func rewriteValueS390X_OpS390XSLDconst(v *Value) bool { 13298 v_0 := v.Args[0] 13299 // match: (SLDconst (SRDconst x [c]) [d]) 13300 // result: (RISBGZ x {s390x.NewRotateParams(uint8(max8(0, int8(c-d))), 63-d, uint8(int8(d-c)&63))}) 13301 for { 13302 d := auxIntToUint8(v.AuxInt) 13303 if v_0.Op != OpS390XSRDconst { 13304 break 13305 } 13306 c := auxIntToUint8(v_0.AuxInt) 13307 x := v_0.Args[0] 13308 v.reset(OpS390XRISBGZ) 13309 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(uint8(max8(0, int8(c-d))), 63-d, uint8(int8(d-c)&63))) 13310 v.AddArg(x) 13311 return true 13312 } 13313 // match: (SLDconst (RISBGZ x {r}) [c]) 13314 // cond: s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask()) != nil 13315 // result: (RISBGZ x {(*s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask())).RotateLeft(r.Amount)}) 13316 for { 13317 c := auxIntToUint8(v.AuxInt) 13318 if v_0.Op != OpS390XRISBGZ { 13319 break 13320 } 13321 r := auxToS390xRotateParams(v_0.Aux) 13322 x := v_0.Args[0] 13323 if !(s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask()) != nil) { 13324 break 13325 } 13326 v.reset(OpS390XRISBGZ) 13327 v.Aux = s390xRotateParamsToAux((*s390x.NewRotateParams(0, 63-c, c).InMerge(r.OutMask())).RotateLeft(r.Amount)) 13328 v.AddArg(x) 13329 return true 13330 } 13331 // match: (SLDconst x [0]) 13332 // result: x 13333 for { 13334 if auxIntToUint8(v.AuxInt) != 0 { 13335 break 13336 } 13337 x := v_0 13338 v.copyOf(x) 13339 return true 13340 } 13341 return false 13342 } 13343 func rewriteValueS390X_OpS390XSLW(v *Value) bool { 13344 v_1 := v.Args[1] 13345 v_0 := v.Args[0] 13346 b := v.Block 13347 typ := &b.Func.Config.Types 13348 // match: (SLW x (MOVDconst [c])) 13349 // cond: c&32 == 0 13350 // result: (SLWconst x [uint8(c&31)]) 13351 for { 13352 x := v_0 13353 if v_1.Op != OpS390XMOVDconst { 13354 break 13355 } 13356 c := auxIntToInt64(v_1.AuxInt) 13357 if !(c&32 == 0) { 13358 break 13359 } 13360 v.reset(OpS390XSLWconst) 13361 v.AuxInt = uint8ToAuxInt(uint8(c & 31)) 13362 v.AddArg(x) 13363 return true 13364 } 13365 // match: (SLW _ (MOVDconst [c])) 13366 // cond: c&32 != 0 13367 // result: (MOVDconst [0]) 13368 for { 13369 if v_1.Op != OpS390XMOVDconst { 13370 break 13371 } 13372 c := auxIntToInt64(v_1.AuxInt) 13373 if !(c&32 != 0) { 13374 break 13375 } 13376 v.reset(OpS390XMOVDconst) 13377 v.AuxInt = int64ToAuxInt(0) 13378 return true 13379 } 13380 // match: (SLW x (RISBGZ y {r})) 13381 // cond: r.Amount == 0 && r.OutMask()&63 == 63 13382 // result: (SLW x y) 13383 for { 13384 x := v_0 13385 if v_1.Op != OpS390XRISBGZ { 13386 break 13387 } 13388 r := auxToS390xRotateParams(v_1.Aux) 13389 y := v_1.Args[0] 13390 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 13391 break 13392 } 13393 v.reset(OpS390XSLW) 13394 v.AddArg2(x, y) 13395 return true 13396 } 13397 // match: (SLW x (AND (MOVDconst [c]) y)) 13398 // result: (SLW x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 13399 for { 13400 x := v_0 13401 if v_1.Op != OpS390XAND { 13402 break 13403 } 13404 _ = v_1.Args[1] 13405 v_1_0 := v_1.Args[0] 13406 v_1_1 := v_1.Args[1] 13407 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 13408 if v_1_0.Op != OpS390XMOVDconst { 13409 continue 13410 } 13411 c := auxIntToInt64(v_1_0.AuxInt) 13412 y := v_1_1 13413 v.reset(OpS390XSLW) 13414 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 13415 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 13416 v0.AddArg(y) 13417 v.AddArg2(x, v0) 13418 return true 13419 } 13420 break 13421 } 13422 // match: (SLW x (ANDWconst [c] y)) 13423 // cond: c&63 == 63 13424 // result: (SLW x y) 13425 for { 13426 x := v_0 13427 if v_1.Op != OpS390XANDWconst { 13428 break 13429 } 13430 c := auxIntToInt32(v_1.AuxInt) 13431 y := v_1.Args[0] 13432 if !(c&63 == 63) { 13433 break 13434 } 13435 v.reset(OpS390XSLW) 13436 v.AddArg2(x, y) 13437 return true 13438 } 13439 // match: (SLW x (MOVWreg y)) 13440 // result: (SLW x y) 13441 for { 13442 x := v_0 13443 if v_1.Op != OpS390XMOVWreg { 13444 break 13445 } 13446 y := v_1.Args[0] 13447 v.reset(OpS390XSLW) 13448 v.AddArg2(x, y) 13449 return true 13450 } 13451 // match: (SLW x (MOVHreg y)) 13452 // result: (SLW x y) 13453 for { 13454 x := v_0 13455 if v_1.Op != OpS390XMOVHreg { 13456 break 13457 } 13458 y := v_1.Args[0] 13459 v.reset(OpS390XSLW) 13460 v.AddArg2(x, y) 13461 return true 13462 } 13463 // match: (SLW x (MOVBreg y)) 13464 // result: (SLW x y) 13465 for { 13466 x := v_0 13467 if v_1.Op != OpS390XMOVBreg { 13468 break 13469 } 13470 y := v_1.Args[0] 13471 v.reset(OpS390XSLW) 13472 v.AddArg2(x, y) 13473 return true 13474 } 13475 // match: (SLW x (MOVWZreg y)) 13476 // result: (SLW x y) 13477 for { 13478 x := v_0 13479 if v_1.Op != OpS390XMOVWZreg { 13480 break 13481 } 13482 y := v_1.Args[0] 13483 v.reset(OpS390XSLW) 13484 v.AddArg2(x, y) 13485 return true 13486 } 13487 // match: (SLW x (MOVHZreg y)) 13488 // result: (SLW x y) 13489 for { 13490 x := v_0 13491 if v_1.Op != OpS390XMOVHZreg { 13492 break 13493 } 13494 y := v_1.Args[0] 13495 v.reset(OpS390XSLW) 13496 v.AddArg2(x, y) 13497 return true 13498 } 13499 // match: (SLW x (MOVBZreg y)) 13500 // result: (SLW x y) 13501 for { 13502 x := v_0 13503 if v_1.Op != OpS390XMOVBZreg { 13504 break 13505 } 13506 y := v_1.Args[0] 13507 v.reset(OpS390XSLW) 13508 v.AddArg2(x, y) 13509 return true 13510 } 13511 return false 13512 } 13513 func rewriteValueS390X_OpS390XSLWconst(v *Value) bool { 13514 v_0 := v.Args[0] 13515 // match: (SLWconst x [0]) 13516 // result: x 13517 for { 13518 if auxIntToUint8(v.AuxInt) != 0 { 13519 break 13520 } 13521 x := v_0 13522 v.copyOf(x) 13523 return true 13524 } 13525 return false 13526 } 13527 func rewriteValueS390X_OpS390XSRAD(v *Value) bool { 13528 v_1 := v.Args[1] 13529 v_0 := v.Args[0] 13530 b := v.Block 13531 typ := &b.Func.Config.Types 13532 // match: (SRAD x (MOVDconst [c])) 13533 // result: (SRADconst x [uint8(c&63)]) 13534 for { 13535 x := v_0 13536 if v_1.Op != OpS390XMOVDconst { 13537 break 13538 } 13539 c := auxIntToInt64(v_1.AuxInt) 13540 v.reset(OpS390XSRADconst) 13541 v.AuxInt = uint8ToAuxInt(uint8(c & 63)) 13542 v.AddArg(x) 13543 return true 13544 } 13545 // match: (SRAD x (RISBGZ y {r})) 13546 // cond: r.Amount == 0 && r.OutMask()&63 == 63 13547 // result: (SRAD x y) 13548 for { 13549 x := v_0 13550 if v_1.Op != OpS390XRISBGZ { 13551 break 13552 } 13553 r := auxToS390xRotateParams(v_1.Aux) 13554 y := v_1.Args[0] 13555 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 13556 break 13557 } 13558 v.reset(OpS390XSRAD) 13559 v.AddArg2(x, y) 13560 return true 13561 } 13562 // match: (SRAD x (AND (MOVDconst [c]) y)) 13563 // result: (SRAD x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 13564 for { 13565 x := v_0 13566 if v_1.Op != OpS390XAND { 13567 break 13568 } 13569 _ = v_1.Args[1] 13570 v_1_0 := v_1.Args[0] 13571 v_1_1 := v_1.Args[1] 13572 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 13573 if v_1_0.Op != OpS390XMOVDconst { 13574 continue 13575 } 13576 c := auxIntToInt64(v_1_0.AuxInt) 13577 y := v_1_1 13578 v.reset(OpS390XSRAD) 13579 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 13580 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 13581 v0.AddArg(y) 13582 v.AddArg2(x, v0) 13583 return true 13584 } 13585 break 13586 } 13587 // match: (SRAD x (ANDWconst [c] y)) 13588 // cond: c&63 == 63 13589 // result: (SRAD x y) 13590 for { 13591 x := v_0 13592 if v_1.Op != OpS390XANDWconst { 13593 break 13594 } 13595 c := auxIntToInt32(v_1.AuxInt) 13596 y := v_1.Args[0] 13597 if !(c&63 == 63) { 13598 break 13599 } 13600 v.reset(OpS390XSRAD) 13601 v.AddArg2(x, y) 13602 return true 13603 } 13604 // match: (SRAD x (MOVWreg y)) 13605 // result: (SRAD x y) 13606 for { 13607 x := v_0 13608 if v_1.Op != OpS390XMOVWreg { 13609 break 13610 } 13611 y := v_1.Args[0] 13612 v.reset(OpS390XSRAD) 13613 v.AddArg2(x, y) 13614 return true 13615 } 13616 // match: (SRAD x (MOVHreg y)) 13617 // result: (SRAD x y) 13618 for { 13619 x := v_0 13620 if v_1.Op != OpS390XMOVHreg { 13621 break 13622 } 13623 y := v_1.Args[0] 13624 v.reset(OpS390XSRAD) 13625 v.AddArg2(x, y) 13626 return true 13627 } 13628 // match: (SRAD x (MOVBreg y)) 13629 // result: (SRAD x y) 13630 for { 13631 x := v_0 13632 if v_1.Op != OpS390XMOVBreg { 13633 break 13634 } 13635 y := v_1.Args[0] 13636 v.reset(OpS390XSRAD) 13637 v.AddArg2(x, y) 13638 return true 13639 } 13640 // match: (SRAD x (MOVWZreg y)) 13641 // result: (SRAD x y) 13642 for { 13643 x := v_0 13644 if v_1.Op != OpS390XMOVWZreg { 13645 break 13646 } 13647 y := v_1.Args[0] 13648 v.reset(OpS390XSRAD) 13649 v.AddArg2(x, y) 13650 return true 13651 } 13652 // match: (SRAD x (MOVHZreg y)) 13653 // result: (SRAD x y) 13654 for { 13655 x := v_0 13656 if v_1.Op != OpS390XMOVHZreg { 13657 break 13658 } 13659 y := v_1.Args[0] 13660 v.reset(OpS390XSRAD) 13661 v.AddArg2(x, y) 13662 return true 13663 } 13664 // match: (SRAD x (MOVBZreg y)) 13665 // result: (SRAD x y) 13666 for { 13667 x := v_0 13668 if v_1.Op != OpS390XMOVBZreg { 13669 break 13670 } 13671 y := v_1.Args[0] 13672 v.reset(OpS390XSRAD) 13673 v.AddArg2(x, y) 13674 return true 13675 } 13676 return false 13677 } 13678 func rewriteValueS390X_OpS390XSRADconst(v *Value) bool { 13679 v_0 := v.Args[0] 13680 // match: (SRADconst x [0]) 13681 // result: x 13682 for { 13683 if auxIntToUint8(v.AuxInt) != 0 { 13684 break 13685 } 13686 x := v_0 13687 v.copyOf(x) 13688 return true 13689 } 13690 // match: (SRADconst [c] (MOVDconst [d])) 13691 // result: (MOVDconst [d>>uint64(c)]) 13692 for { 13693 c := auxIntToUint8(v.AuxInt) 13694 if v_0.Op != OpS390XMOVDconst { 13695 break 13696 } 13697 d := auxIntToInt64(v_0.AuxInt) 13698 v.reset(OpS390XMOVDconst) 13699 v.AuxInt = int64ToAuxInt(d >> uint64(c)) 13700 return true 13701 } 13702 return false 13703 } 13704 func rewriteValueS390X_OpS390XSRAW(v *Value) bool { 13705 v_1 := v.Args[1] 13706 v_0 := v.Args[0] 13707 b := v.Block 13708 typ := &b.Func.Config.Types 13709 // match: (SRAW x (MOVDconst [c])) 13710 // cond: c&32 == 0 13711 // result: (SRAWconst x [uint8(c&31)]) 13712 for { 13713 x := v_0 13714 if v_1.Op != OpS390XMOVDconst { 13715 break 13716 } 13717 c := auxIntToInt64(v_1.AuxInt) 13718 if !(c&32 == 0) { 13719 break 13720 } 13721 v.reset(OpS390XSRAWconst) 13722 v.AuxInt = uint8ToAuxInt(uint8(c & 31)) 13723 v.AddArg(x) 13724 return true 13725 } 13726 // match: (SRAW x (MOVDconst [c])) 13727 // cond: c&32 != 0 13728 // result: (SRAWconst x [31]) 13729 for { 13730 x := v_0 13731 if v_1.Op != OpS390XMOVDconst { 13732 break 13733 } 13734 c := auxIntToInt64(v_1.AuxInt) 13735 if !(c&32 != 0) { 13736 break 13737 } 13738 v.reset(OpS390XSRAWconst) 13739 v.AuxInt = uint8ToAuxInt(31) 13740 v.AddArg(x) 13741 return true 13742 } 13743 // match: (SRAW x (RISBGZ y {r})) 13744 // cond: r.Amount == 0 && r.OutMask()&63 == 63 13745 // result: (SRAW x y) 13746 for { 13747 x := v_0 13748 if v_1.Op != OpS390XRISBGZ { 13749 break 13750 } 13751 r := auxToS390xRotateParams(v_1.Aux) 13752 y := v_1.Args[0] 13753 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 13754 break 13755 } 13756 v.reset(OpS390XSRAW) 13757 v.AddArg2(x, y) 13758 return true 13759 } 13760 // match: (SRAW x (AND (MOVDconst [c]) y)) 13761 // result: (SRAW x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 13762 for { 13763 x := v_0 13764 if v_1.Op != OpS390XAND { 13765 break 13766 } 13767 _ = v_1.Args[1] 13768 v_1_0 := v_1.Args[0] 13769 v_1_1 := v_1.Args[1] 13770 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 13771 if v_1_0.Op != OpS390XMOVDconst { 13772 continue 13773 } 13774 c := auxIntToInt64(v_1_0.AuxInt) 13775 y := v_1_1 13776 v.reset(OpS390XSRAW) 13777 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 13778 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 13779 v0.AddArg(y) 13780 v.AddArg2(x, v0) 13781 return true 13782 } 13783 break 13784 } 13785 // match: (SRAW x (ANDWconst [c] y)) 13786 // cond: c&63 == 63 13787 // result: (SRAW x y) 13788 for { 13789 x := v_0 13790 if v_1.Op != OpS390XANDWconst { 13791 break 13792 } 13793 c := auxIntToInt32(v_1.AuxInt) 13794 y := v_1.Args[0] 13795 if !(c&63 == 63) { 13796 break 13797 } 13798 v.reset(OpS390XSRAW) 13799 v.AddArg2(x, y) 13800 return true 13801 } 13802 // match: (SRAW x (MOVWreg y)) 13803 // result: (SRAW x y) 13804 for { 13805 x := v_0 13806 if v_1.Op != OpS390XMOVWreg { 13807 break 13808 } 13809 y := v_1.Args[0] 13810 v.reset(OpS390XSRAW) 13811 v.AddArg2(x, y) 13812 return true 13813 } 13814 // match: (SRAW x (MOVHreg y)) 13815 // result: (SRAW x y) 13816 for { 13817 x := v_0 13818 if v_1.Op != OpS390XMOVHreg { 13819 break 13820 } 13821 y := v_1.Args[0] 13822 v.reset(OpS390XSRAW) 13823 v.AddArg2(x, y) 13824 return true 13825 } 13826 // match: (SRAW x (MOVBreg y)) 13827 // result: (SRAW x y) 13828 for { 13829 x := v_0 13830 if v_1.Op != OpS390XMOVBreg { 13831 break 13832 } 13833 y := v_1.Args[0] 13834 v.reset(OpS390XSRAW) 13835 v.AddArg2(x, y) 13836 return true 13837 } 13838 // match: (SRAW x (MOVWZreg y)) 13839 // result: (SRAW x y) 13840 for { 13841 x := v_0 13842 if v_1.Op != OpS390XMOVWZreg { 13843 break 13844 } 13845 y := v_1.Args[0] 13846 v.reset(OpS390XSRAW) 13847 v.AddArg2(x, y) 13848 return true 13849 } 13850 // match: (SRAW x (MOVHZreg y)) 13851 // result: (SRAW x y) 13852 for { 13853 x := v_0 13854 if v_1.Op != OpS390XMOVHZreg { 13855 break 13856 } 13857 y := v_1.Args[0] 13858 v.reset(OpS390XSRAW) 13859 v.AddArg2(x, y) 13860 return true 13861 } 13862 // match: (SRAW x (MOVBZreg y)) 13863 // result: (SRAW x y) 13864 for { 13865 x := v_0 13866 if v_1.Op != OpS390XMOVBZreg { 13867 break 13868 } 13869 y := v_1.Args[0] 13870 v.reset(OpS390XSRAW) 13871 v.AddArg2(x, y) 13872 return true 13873 } 13874 return false 13875 } 13876 func rewriteValueS390X_OpS390XSRAWconst(v *Value) bool { 13877 v_0 := v.Args[0] 13878 // match: (SRAWconst x [0]) 13879 // result: x 13880 for { 13881 if auxIntToUint8(v.AuxInt) != 0 { 13882 break 13883 } 13884 x := v_0 13885 v.copyOf(x) 13886 return true 13887 } 13888 // match: (SRAWconst [c] (MOVDconst [d])) 13889 // result: (MOVDconst [int64(int32(d))>>uint64(c)]) 13890 for { 13891 c := auxIntToUint8(v.AuxInt) 13892 if v_0.Op != OpS390XMOVDconst { 13893 break 13894 } 13895 d := auxIntToInt64(v_0.AuxInt) 13896 v.reset(OpS390XMOVDconst) 13897 v.AuxInt = int64ToAuxInt(int64(int32(d)) >> uint64(c)) 13898 return true 13899 } 13900 return false 13901 } 13902 func rewriteValueS390X_OpS390XSRD(v *Value) bool { 13903 v_1 := v.Args[1] 13904 v_0 := v.Args[0] 13905 b := v.Block 13906 typ := &b.Func.Config.Types 13907 // match: (SRD x (MOVDconst [c])) 13908 // result: (SRDconst x [uint8(c&63)]) 13909 for { 13910 x := v_0 13911 if v_1.Op != OpS390XMOVDconst { 13912 break 13913 } 13914 c := auxIntToInt64(v_1.AuxInt) 13915 v.reset(OpS390XSRDconst) 13916 v.AuxInt = uint8ToAuxInt(uint8(c & 63)) 13917 v.AddArg(x) 13918 return true 13919 } 13920 // match: (SRD x (RISBGZ y {r})) 13921 // cond: r.Amount == 0 && r.OutMask()&63 == 63 13922 // result: (SRD x y) 13923 for { 13924 x := v_0 13925 if v_1.Op != OpS390XRISBGZ { 13926 break 13927 } 13928 r := auxToS390xRotateParams(v_1.Aux) 13929 y := v_1.Args[0] 13930 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 13931 break 13932 } 13933 v.reset(OpS390XSRD) 13934 v.AddArg2(x, y) 13935 return true 13936 } 13937 // match: (SRD x (AND (MOVDconst [c]) y)) 13938 // result: (SRD x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 13939 for { 13940 x := v_0 13941 if v_1.Op != OpS390XAND { 13942 break 13943 } 13944 _ = v_1.Args[1] 13945 v_1_0 := v_1.Args[0] 13946 v_1_1 := v_1.Args[1] 13947 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 13948 if v_1_0.Op != OpS390XMOVDconst { 13949 continue 13950 } 13951 c := auxIntToInt64(v_1_0.AuxInt) 13952 y := v_1_1 13953 v.reset(OpS390XSRD) 13954 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 13955 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 13956 v0.AddArg(y) 13957 v.AddArg2(x, v0) 13958 return true 13959 } 13960 break 13961 } 13962 // match: (SRD x (ANDWconst [c] y)) 13963 // cond: c&63 == 63 13964 // result: (SRD x y) 13965 for { 13966 x := v_0 13967 if v_1.Op != OpS390XANDWconst { 13968 break 13969 } 13970 c := auxIntToInt32(v_1.AuxInt) 13971 y := v_1.Args[0] 13972 if !(c&63 == 63) { 13973 break 13974 } 13975 v.reset(OpS390XSRD) 13976 v.AddArg2(x, y) 13977 return true 13978 } 13979 // match: (SRD x (MOVWreg y)) 13980 // result: (SRD x y) 13981 for { 13982 x := v_0 13983 if v_1.Op != OpS390XMOVWreg { 13984 break 13985 } 13986 y := v_1.Args[0] 13987 v.reset(OpS390XSRD) 13988 v.AddArg2(x, y) 13989 return true 13990 } 13991 // match: (SRD x (MOVHreg y)) 13992 // result: (SRD x y) 13993 for { 13994 x := v_0 13995 if v_1.Op != OpS390XMOVHreg { 13996 break 13997 } 13998 y := v_1.Args[0] 13999 v.reset(OpS390XSRD) 14000 v.AddArg2(x, y) 14001 return true 14002 } 14003 // match: (SRD x (MOVBreg y)) 14004 // result: (SRD x y) 14005 for { 14006 x := v_0 14007 if v_1.Op != OpS390XMOVBreg { 14008 break 14009 } 14010 y := v_1.Args[0] 14011 v.reset(OpS390XSRD) 14012 v.AddArg2(x, y) 14013 return true 14014 } 14015 // match: (SRD x (MOVWZreg y)) 14016 // result: (SRD x y) 14017 for { 14018 x := v_0 14019 if v_1.Op != OpS390XMOVWZreg { 14020 break 14021 } 14022 y := v_1.Args[0] 14023 v.reset(OpS390XSRD) 14024 v.AddArg2(x, y) 14025 return true 14026 } 14027 // match: (SRD x (MOVHZreg y)) 14028 // result: (SRD x y) 14029 for { 14030 x := v_0 14031 if v_1.Op != OpS390XMOVHZreg { 14032 break 14033 } 14034 y := v_1.Args[0] 14035 v.reset(OpS390XSRD) 14036 v.AddArg2(x, y) 14037 return true 14038 } 14039 // match: (SRD x (MOVBZreg y)) 14040 // result: (SRD x y) 14041 for { 14042 x := v_0 14043 if v_1.Op != OpS390XMOVBZreg { 14044 break 14045 } 14046 y := v_1.Args[0] 14047 v.reset(OpS390XSRD) 14048 v.AddArg2(x, y) 14049 return true 14050 } 14051 return false 14052 } 14053 func rewriteValueS390X_OpS390XSRDconst(v *Value) bool { 14054 v_0 := v.Args[0] 14055 // match: (SRDconst (SLDconst x [c]) [d]) 14056 // result: (RISBGZ x {s390x.NewRotateParams(d, uint8(min8(63, int8(63-c+d))), uint8(int8(c-d)&63))}) 14057 for { 14058 d := auxIntToUint8(v.AuxInt) 14059 if v_0.Op != OpS390XSLDconst { 14060 break 14061 } 14062 c := auxIntToUint8(v_0.AuxInt) 14063 x := v_0.Args[0] 14064 v.reset(OpS390XRISBGZ) 14065 v.Aux = s390xRotateParamsToAux(s390x.NewRotateParams(d, uint8(min8(63, int8(63-c+d))), uint8(int8(c-d)&63))) 14066 v.AddArg(x) 14067 return true 14068 } 14069 // match: (SRDconst (RISBGZ x {r}) [c]) 14070 // cond: s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask()) != nil 14071 // result: (RISBGZ x {(*s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask())).RotateLeft(r.Amount)}) 14072 for { 14073 c := auxIntToUint8(v.AuxInt) 14074 if v_0.Op != OpS390XRISBGZ { 14075 break 14076 } 14077 r := auxToS390xRotateParams(v_0.Aux) 14078 x := v_0.Args[0] 14079 if !(s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask()) != nil) { 14080 break 14081 } 14082 v.reset(OpS390XRISBGZ) 14083 v.Aux = s390xRotateParamsToAux((*s390x.NewRotateParams(c, 63, -c&63).InMerge(r.OutMask())).RotateLeft(r.Amount)) 14084 v.AddArg(x) 14085 return true 14086 } 14087 // match: (SRDconst x [0]) 14088 // result: x 14089 for { 14090 if auxIntToUint8(v.AuxInt) != 0 { 14091 break 14092 } 14093 x := v_0 14094 v.copyOf(x) 14095 return true 14096 } 14097 return false 14098 } 14099 func rewriteValueS390X_OpS390XSRW(v *Value) bool { 14100 v_1 := v.Args[1] 14101 v_0 := v.Args[0] 14102 b := v.Block 14103 typ := &b.Func.Config.Types 14104 // match: (SRW x (MOVDconst [c])) 14105 // cond: c&32 == 0 14106 // result: (SRWconst x [uint8(c&31)]) 14107 for { 14108 x := v_0 14109 if v_1.Op != OpS390XMOVDconst { 14110 break 14111 } 14112 c := auxIntToInt64(v_1.AuxInt) 14113 if !(c&32 == 0) { 14114 break 14115 } 14116 v.reset(OpS390XSRWconst) 14117 v.AuxInt = uint8ToAuxInt(uint8(c & 31)) 14118 v.AddArg(x) 14119 return true 14120 } 14121 // match: (SRW _ (MOVDconst [c])) 14122 // cond: c&32 != 0 14123 // result: (MOVDconst [0]) 14124 for { 14125 if v_1.Op != OpS390XMOVDconst { 14126 break 14127 } 14128 c := auxIntToInt64(v_1.AuxInt) 14129 if !(c&32 != 0) { 14130 break 14131 } 14132 v.reset(OpS390XMOVDconst) 14133 v.AuxInt = int64ToAuxInt(0) 14134 return true 14135 } 14136 // match: (SRW x (RISBGZ y {r})) 14137 // cond: r.Amount == 0 && r.OutMask()&63 == 63 14138 // result: (SRW x y) 14139 for { 14140 x := v_0 14141 if v_1.Op != OpS390XRISBGZ { 14142 break 14143 } 14144 r := auxToS390xRotateParams(v_1.Aux) 14145 y := v_1.Args[0] 14146 if !(r.Amount == 0 && r.OutMask()&63 == 63) { 14147 break 14148 } 14149 v.reset(OpS390XSRW) 14150 v.AddArg2(x, y) 14151 return true 14152 } 14153 // match: (SRW x (AND (MOVDconst [c]) y)) 14154 // result: (SRW x (ANDWconst <typ.UInt32> [int32(c&63)] y)) 14155 for { 14156 x := v_0 14157 if v_1.Op != OpS390XAND { 14158 break 14159 } 14160 _ = v_1.Args[1] 14161 v_1_0 := v_1.Args[0] 14162 v_1_1 := v_1.Args[1] 14163 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { 14164 if v_1_0.Op != OpS390XMOVDconst { 14165 continue 14166 } 14167 c := auxIntToInt64(v_1_0.AuxInt) 14168 y := v_1_1 14169 v.reset(OpS390XSRW) 14170 v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) 14171 v0.AuxInt = int32ToAuxInt(int32(c & 63)) 14172 v0.AddArg(y) 14173 v.AddArg2(x, v0) 14174 return true 14175 } 14176 break 14177 } 14178 // match: (SRW x (ANDWconst [c] y)) 14179 // cond: c&63 == 63 14180 // result: (SRW x y) 14181 for { 14182 x := v_0 14183 if v_1.Op != OpS390XANDWconst { 14184 break 14185 } 14186 c := auxIntToInt32(v_1.AuxInt) 14187 y := v_1.Args[0] 14188 if !(c&63 == 63) { 14189 break 14190 } 14191 v.reset(OpS390XSRW) 14192 v.AddArg2(x, y) 14193 return true 14194 } 14195 // match: (SRW x (MOVWreg y)) 14196 // result: (SRW x y) 14197 for { 14198 x := v_0 14199 if v_1.Op != OpS390XMOVWreg { 14200 break 14201 } 14202 y := v_1.Args[0] 14203 v.reset(OpS390XSRW) 14204 v.AddArg2(x, y) 14205 return true 14206 } 14207 // match: (SRW x (MOVHreg y)) 14208 // result: (SRW x y) 14209 for { 14210 x := v_0 14211 if v_1.Op != OpS390XMOVHreg { 14212 break 14213 } 14214 y := v_1.Args[0] 14215 v.reset(OpS390XSRW) 14216 v.AddArg2(x, y) 14217 return true 14218 } 14219 // match: (SRW x (MOVBreg y)) 14220 // result: (SRW x y) 14221 for { 14222 x := v_0 14223 if v_1.Op != OpS390XMOVBreg { 14224 break 14225 } 14226 y := v_1.Args[0] 14227 v.reset(OpS390XSRW) 14228 v.AddArg2(x, y) 14229 return true 14230 } 14231 // match: (SRW x (MOVWZreg y)) 14232 // result: (SRW x y) 14233 for { 14234 x := v_0 14235 if v_1.Op != OpS390XMOVWZreg { 14236 break 14237 } 14238 y := v_1.Args[0] 14239 v.reset(OpS390XSRW) 14240 v.AddArg2(x, y) 14241 return true 14242 } 14243 // match: (SRW x (MOVHZreg y)) 14244 // result: (SRW x y) 14245 for { 14246 x := v_0 14247 if v_1.Op != OpS390XMOVHZreg { 14248 break 14249 } 14250 y := v_1.Args[0] 14251 v.reset(OpS390XSRW) 14252 v.AddArg2(x, y) 14253 return true 14254 } 14255 // match: (SRW x (MOVBZreg y)) 14256 // result: (SRW x y) 14257 for { 14258 x := v_0 14259 if v_1.Op != OpS390XMOVBZreg { 14260 break 14261 } 14262 y := v_1.Args[0] 14263 v.reset(OpS390XSRW) 14264 v.AddArg2(x, y) 14265 return true 14266 } 14267 return false 14268 } 14269 func rewriteValueS390X_OpS390XSRWconst(v *Value) bool { 14270 v_0 := v.Args[0] 14271 // match: (SRWconst x [0]) 14272 // result: x 14273 for { 14274 if auxIntToUint8(v.AuxInt) != 0 { 14275 break 14276 } 14277 x := v_0 14278 v.copyOf(x) 14279 return true 14280 } 14281 return false 14282 } 14283 func rewriteValueS390X_OpS390XSTM2(v *Value) bool { 14284 v_3 := v.Args[3] 14285 v_2 := v.Args[2] 14286 v_1 := v.Args[1] 14287 v_0 := v.Args[0] 14288 // match: (STM2 [i] {s} p w2 w3 x:(STM2 [i-8] {s} p w0 w1 mem)) 14289 // cond: x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x) 14290 // result: (STM4 [i-8] {s} p w0 w1 w2 w3 mem) 14291 for { 14292 i := auxIntToInt32(v.AuxInt) 14293 s := auxToSym(v.Aux) 14294 p := v_0 14295 w2 := v_1 14296 w3 := v_2 14297 x := v_3 14298 if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s { 14299 break 14300 } 14301 mem := x.Args[3] 14302 if p != x.Args[0] { 14303 break 14304 } 14305 w0 := x.Args[1] 14306 w1 := x.Args[2] 14307 if !(x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x)) { 14308 break 14309 } 14310 v.reset(OpS390XSTM4) 14311 v.AuxInt = int32ToAuxInt(i - 8) 14312 v.Aux = symToAux(s) 14313 v.AddArg6(p, w0, w1, w2, w3, mem) 14314 return true 14315 } 14316 // match: (STM2 [i] {s} p (SRDconst [32] x) x mem) 14317 // result: (MOVDstore [i] {s} p x mem) 14318 for { 14319 i := auxIntToInt32(v.AuxInt) 14320 s := auxToSym(v.Aux) 14321 p := v_0 14322 if v_1.Op != OpS390XSRDconst || auxIntToUint8(v_1.AuxInt) != 32 { 14323 break 14324 } 14325 x := v_1.Args[0] 14326 if x != v_2 { 14327 break 14328 } 14329 mem := v_3 14330 v.reset(OpS390XMOVDstore) 14331 v.AuxInt = int32ToAuxInt(i) 14332 v.Aux = symToAux(s) 14333 v.AddArg3(p, x, mem) 14334 return true 14335 } 14336 return false 14337 } 14338 func rewriteValueS390X_OpS390XSTMG2(v *Value) bool { 14339 v_3 := v.Args[3] 14340 v_2 := v.Args[2] 14341 v_1 := v.Args[1] 14342 v_0 := v.Args[0] 14343 // match: (STMG2 [i] {s} p w2 w3 x:(STMG2 [i-16] {s} p w0 w1 mem)) 14344 // cond: x.Uses == 1 && is20Bit(int64(i)-16) && clobber(x) 14345 // result: (STMG4 [i-16] {s} p w0 w1 w2 w3 mem) 14346 for { 14347 i := auxIntToInt32(v.AuxInt) 14348 s := auxToSym(v.Aux) 14349 p := v_0 14350 w2 := v_1 14351 w3 := v_2 14352 x := v_3 14353 if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s { 14354 break 14355 } 14356 mem := x.Args[3] 14357 if p != x.Args[0] { 14358 break 14359 } 14360 w0 := x.Args[1] 14361 w1 := x.Args[2] 14362 if !(x.Uses == 1 && is20Bit(int64(i)-16) && clobber(x)) { 14363 break 14364 } 14365 v.reset(OpS390XSTMG4) 14366 v.AuxInt = int32ToAuxInt(i - 16) 14367 v.Aux = symToAux(s) 14368 v.AddArg6(p, w0, w1, w2, w3, mem) 14369 return true 14370 } 14371 return false 14372 } 14373 func rewriteValueS390X_OpS390XSUB(v *Value) bool { 14374 v_1 := v.Args[1] 14375 v_0 := v.Args[0] 14376 b := v.Block 14377 // match: (SUB x (MOVDconst [c])) 14378 // cond: is32Bit(c) 14379 // result: (SUBconst x [int32(c)]) 14380 for { 14381 x := v_0 14382 if v_1.Op != OpS390XMOVDconst { 14383 break 14384 } 14385 c := auxIntToInt64(v_1.AuxInt) 14386 if !(is32Bit(c)) { 14387 break 14388 } 14389 v.reset(OpS390XSUBconst) 14390 v.AuxInt = int32ToAuxInt(int32(c)) 14391 v.AddArg(x) 14392 return true 14393 } 14394 // match: (SUB (MOVDconst [c]) x) 14395 // cond: is32Bit(c) 14396 // result: (NEG (SUBconst <v.Type> x [int32(c)])) 14397 for { 14398 if v_0.Op != OpS390XMOVDconst { 14399 break 14400 } 14401 c := auxIntToInt64(v_0.AuxInt) 14402 x := v_1 14403 if !(is32Bit(c)) { 14404 break 14405 } 14406 v.reset(OpS390XNEG) 14407 v0 := b.NewValue0(v.Pos, OpS390XSUBconst, v.Type) 14408 v0.AuxInt = int32ToAuxInt(int32(c)) 14409 v0.AddArg(x) 14410 v.AddArg(v0) 14411 return true 14412 } 14413 // match: (SUB x x) 14414 // result: (MOVDconst [0]) 14415 for { 14416 x := v_0 14417 if x != v_1 { 14418 break 14419 } 14420 v.reset(OpS390XMOVDconst) 14421 v.AuxInt = int64ToAuxInt(0) 14422 return true 14423 } 14424 // match: (SUB <t> x g:(MOVDload [off] {sym} ptr mem)) 14425 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 14426 // result: (SUBload <t> [off] {sym} x ptr mem) 14427 for { 14428 t := v.Type 14429 x := v_0 14430 g := v_1 14431 if g.Op != OpS390XMOVDload { 14432 break 14433 } 14434 off := auxIntToInt32(g.AuxInt) 14435 sym := auxToSym(g.Aux) 14436 mem := g.Args[1] 14437 ptr := g.Args[0] 14438 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 14439 break 14440 } 14441 v.reset(OpS390XSUBload) 14442 v.Type = t 14443 v.AuxInt = int32ToAuxInt(off) 14444 v.Aux = symToAux(sym) 14445 v.AddArg3(x, ptr, mem) 14446 return true 14447 } 14448 return false 14449 } 14450 func rewriteValueS390X_OpS390XSUBE(v *Value) bool { 14451 v_2 := v.Args[2] 14452 v_1 := v.Args[1] 14453 v_0 := v.Args[0] 14454 // match: (SUBE x y (FlagGT)) 14455 // result: (SUBC x y) 14456 for { 14457 x := v_0 14458 y := v_1 14459 if v_2.Op != OpS390XFlagGT { 14460 break 14461 } 14462 v.reset(OpS390XSUBC) 14463 v.AddArg2(x, y) 14464 return true 14465 } 14466 // match: (SUBE x y (FlagOV)) 14467 // result: (SUBC x y) 14468 for { 14469 x := v_0 14470 y := v_1 14471 if v_2.Op != OpS390XFlagOV { 14472 break 14473 } 14474 v.reset(OpS390XSUBC) 14475 v.AddArg2(x, y) 14476 return true 14477 } 14478 // match: (SUBE x y (Select1 (SUBC (MOVDconst [0]) (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) c)))))) 14479 // result: (SUBE x y c) 14480 for { 14481 x := v_0 14482 y := v_1 14483 if v_2.Op != OpSelect1 { 14484 break 14485 } 14486 v_2_0 := v_2.Args[0] 14487 if v_2_0.Op != OpS390XSUBC { 14488 break 14489 } 14490 _ = v_2_0.Args[1] 14491 v_2_0_0 := v_2_0.Args[0] 14492 if v_2_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 { 14493 break 14494 } 14495 v_2_0_1 := v_2_0.Args[1] 14496 if v_2_0_1.Op != OpS390XNEG { 14497 break 14498 } 14499 v_2_0_1_0 := v_2_0_1.Args[0] 14500 if v_2_0_1_0.Op != OpSelect0 { 14501 break 14502 } 14503 v_2_0_1_0_0 := v_2_0_1_0.Args[0] 14504 if v_2_0_1_0_0.Op != OpS390XSUBE { 14505 break 14506 } 14507 c := v_2_0_1_0_0.Args[2] 14508 v_2_0_1_0_0_0 := v_2_0_1_0_0.Args[0] 14509 if v_2_0_1_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_1_0_0_0.AuxInt) != 0 { 14510 break 14511 } 14512 v_2_0_1_0_0_1 := v_2_0_1_0_0.Args[1] 14513 if v_2_0_1_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_2_0_1_0_0_1.AuxInt) != 0 { 14514 break 14515 } 14516 v.reset(OpS390XSUBE) 14517 v.AddArg3(x, y, c) 14518 return true 14519 } 14520 return false 14521 } 14522 func rewriteValueS390X_OpS390XSUBW(v *Value) bool { 14523 v_1 := v.Args[1] 14524 v_0 := v.Args[0] 14525 b := v.Block 14526 // match: (SUBW x (MOVDconst [c])) 14527 // result: (SUBWconst x [int32(c)]) 14528 for { 14529 x := v_0 14530 if v_1.Op != OpS390XMOVDconst { 14531 break 14532 } 14533 c := auxIntToInt64(v_1.AuxInt) 14534 v.reset(OpS390XSUBWconst) 14535 v.AuxInt = int32ToAuxInt(int32(c)) 14536 v.AddArg(x) 14537 return true 14538 } 14539 // match: (SUBW (MOVDconst [c]) x) 14540 // result: (NEGW (SUBWconst <v.Type> x [int32(c)])) 14541 for { 14542 if v_0.Op != OpS390XMOVDconst { 14543 break 14544 } 14545 c := auxIntToInt64(v_0.AuxInt) 14546 x := v_1 14547 v.reset(OpS390XNEGW) 14548 v0 := b.NewValue0(v.Pos, OpS390XSUBWconst, v.Type) 14549 v0.AuxInt = int32ToAuxInt(int32(c)) 14550 v0.AddArg(x) 14551 v.AddArg(v0) 14552 return true 14553 } 14554 // match: (SUBW x x) 14555 // result: (MOVDconst [0]) 14556 for { 14557 x := v_0 14558 if x != v_1 { 14559 break 14560 } 14561 v.reset(OpS390XMOVDconst) 14562 v.AuxInt = int64ToAuxInt(0) 14563 return true 14564 } 14565 // match: (SUBW <t> x g:(MOVWload [off] {sym} ptr mem)) 14566 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 14567 // result: (SUBWload <t> [off] {sym} x ptr mem) 14568 for { 14569 t := v.Type 14570 x := v_0 14571 g := v_1 14572 if g.Op != OpS390XMOVWload { 14573 break 14574 } 14575 off := auxIntToInt32(g.AuxInt) 14576 sym := auxToSym(g.Aux) 14577 mem := g.Args[1] 14578 ptr := g.Args[0] 14579 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 14580 break 14581 } 14582 v.reset(OpS390XSUBWload) 14583 v.Type = t 14584 v.AuxInt = int32ToAuxInt(off) 14585 v.Aux = symToAux(sym) 14586 v.AddArg3(x, ptr, mem) 14587 return true 14588 } 14589 // match: (SUBW <t> x g:(MOVWZload [off] {sym} ptr mem)) 14590 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 14591 // result: (SUBWload <t> [off] {sym} x ptr mem) 14592 for { 14593 t := v.Type 14594 x := v_0 14595 g := v_1 14596 if g.Op != OpS390XMOVWZload { 14597 break 14598 } 14599 off := auxIntToInt32(g.AuxInt) 14600 sym := auxToSym(g.Aux) 14601 mem := g.Args[1] 14602 ptr := g.Args[0] 14603 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 14604 break 14605 } 14606 v.reset(OpS390XSUBWload) 14607 v.Type = t 14608 v.AuxInt = int32ToAuxInt(off) 14609 v.Aux = symToAux(sym) 14610 v.AddArg3(x, ptr, mem) 14611 return true 14612 } 14613 return false 14614 } 14615 func rewriteValueS390X_OpS390XSUBWconst(v *Value) bool { 14616 v_0 := v.Args[0] 14617 // match: (SUBWconst [c] x) 14618 // cond: int32(c) == 0 14619 // result: x 14620 for { 14621 c := auxIntToInt32(v.AuxInt) 14622 x := v_0 14623 if !(int32(c) == 0) { 14624 break 14625 } 14626 v.copyOf(x) 14627 return true 14628 } 14629 // match: (SUBWconst [c] x) 14630 // result: (ADDWconst [-int32(c)] x) 14631 for { 14632 c := auxIntToInt32(v.AuxInt) 14633 x := v_0 14634 v.reset(OpS390XADDWconst) 14635 v.AuxInt = int32ToAuxInt(-int32(c)) 14636 v.AddArg(x) 14637 return true 14638 } 14639 } 14640 func rewriteValueS390X_OpS390XSUBWload(v *Value) bool { 14641 v_2 := v.Args[2] 14642 v_1 := v.Args[1] 14643 v_0 := v.Args[0] 14644 // match: (SUBWload [off1] {sym} x (ADDconst [off2] ptr) mem) 14645 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 14646 // result: (SUBWload [off1+off2] {sym} x ptr mem) 14647 for { 14648 off1 := auxIntToInt32(v.AuxInt) 14649 sym := auxToSym(v.Aux) 14650 x := v_0 14651 if v_1.Op != OpS390XADDconst { 14652 break 14653 } 14654 off2 := auxIntToInt32(v_1.AuxInt) 14655 ptr := v_1.Args[0] 14656 mem := v_2 14657 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 14658 break 14659 } 14660 v.reset(OpS390XSUBWload) 14661 v.AuxInt = int32ToAuxInt(off1 + off2) 14662 v.Aux = symToAux(sym) 14663 v.AddArg3(x, ptr, mem) 14664 return true 14665 } 14666 // match: (SUBWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 14667 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 14668 // result: (SUBWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 14669 for { 14670 o1 := auxIntToInt32(v.AuxInt) 14671 s1 := auxToSym(v.Aux) 14672 x := v_0 14673 if v_1.Op != OpS390XMOVDaddr { 14674 break 14675 } 14676 o2 := auxIntToInt32(v_1.AuxInt) 14677 s2 := auxToSym(v_1.Aux) 14678 ptr := v_1.Args[0] 14679 mem := v_2 14680 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 14681 break 14682 } 14683 v.reset(OpS390XSUBWload) 14684 v.AuxInt = int32ToAuxInt(o1 + o2) 14685 v.Aux = symToAux(mergeSym(s1, s2)) 14686 v.AddArg3(x, ptr, mem) 14687 return true 14688 } 14689 return false 14690 } 14691 func rewriteValueS390X_OpS390XSUBconst(v *Value) bool { 14692 v_0 := v.Args[0] 14693 // match: (SUBconst [0] x) 14694 // result: x 14695 for { 14696 if auxIntToInt32(v.AuxInt) != 0 { 14697 break 14698 } 14699 x := v_0 14700 v.copyOf(x) 14701 return true 14702 } 14703 // match: (SUBconst [c] x) 14704 // cond: c != -(1<<31) 14705 // result: (ADDconst [-c] x) 14706 for { 14707 c := auxIntToInt32(v.AuxInt) 14708 x := v_0 14709 if !(c != -(1 << 31)) { 14710 break 14711 } 14712 v.reset(OpS390XADDconst) 14713 v.AuxInt = int32ToAuxInt(-c) 14714 v.AddArg(x) 14715 return true 14716 } 14717 // match: (SUBconst (MOVDconst [d]) [c]) 14718 // result: (MOVDconst [d-int64(c)]) 14719 for { 14720 c := auxIntToInt32(v.AuxInt) 14721 if v_0.Op != OpS390XMOVDconst { 14722 break 14723 } 14724 d := auxIntToInt64(v_0.AuxInt) 14725 v.reset(OpS390XMOVDconst) 14726 v.AuxInt = int64ToAuxInt(d - int64(c)) 14727 return true 14728 } 14729 // match: (SUBconst (SUBconst x [d]) [c]) 14730 // cond: is32Bit(-int64(c)-int64(d)) 14731 // result: (ADDconst [-c-d] x) 14732 for { 14733 c := auxIntToInt32(v.AuxInt) 14734 if v_0.Op != OpS390XSUBconst { 14735 break 14736 } 14737 d := auxIntToInt32(v_0.AuxInt) 14738 x := v_0.Args[0] 14739 if !(is32Bit(-int64(c) - int64(d))) { 14740 break 14741 } 14742 v.reset(OpS390XADDconst) 14743 v.AuxInt = int32ToAuxInt(-c - d) 14744 v.AddArg(x) 14745 return true 14746 } 14747 return false 14748 } 14749 func rewriteValueS390X_OpS390XSUBload(v *Value) bool { 14750 v_2 := v.Args[2] 14751 v_1 := v.Args[1] 14752 v_0 := v.Args[0] 14753 b := v.Block 14754 // match: (SUBload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 14755 // cond: isSamePtr(ptr1, ptr2) 14756 // result: (SUB x (LGDR <t> y)) 14757 for { 14758 t := v.Type 14759 off := auxIntToInt32(v.AuxInt) 14760 sym := auxToSym(v.Aux) 14761 x := v_0 14762 ptr1 := v_1 14763 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 14764 break 14765 } 14766 y := v_2.Args[1] 14767 ptr2 := v_2.Args[0] 14768 if !(isSamePtr(ptr1, ptr2)) { 14769 break 14770 } 14771 v.reset(OpS390XSUB) 14772 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 14773 v0.AddArg(y) 14774 v.AddArg2(x, v0) 14775 return true 14776 } 14777 // match: (SUBload [off1] {sym} x (ADDconst [off2] ptr) mem) 14778 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 14779 // result: (SUBload [off1+off2] {sym} x ptr mem) 14780 for { 14781 off1 := auxIntToInt32(v.AuxInt) 14782 sym := auxToSym(v.Aux) 14783 x := v_0 14784 if v_1.Op != OpS390XADDconst { 14785 break 14786 } 14787 off2 := auxIntToInt32(v_1.AuxInt) 14788 ptr := v_1.Args[0] 14789 mem := v_2 14790 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 14791 break 14792 } 14793 v.reset(OpS390XSUBload) 14794 v.AuxInt = int32ToAuxInt(off1 + off2) 14795 v.Aux = symToAux(sym) 14796 v.AddArg3(x, ptr, mem) 14797 return true 14798 } 14799 // match: (SUBload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 14800 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 14801 // result: (SUBload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 14802 for { 14803 o1 := auxIntToInt32(v.AuxInt) 14804 s1 := auxToSym(v.Aux) 14805 x := v_0 14806 if v_1.Op != OpS390XMOVDaddr { 14807 break 14808 } 14809 o2 := auxIntToInt32(v_1.AuxInt) 14810 s2 := auxToSym(v_1.Aux) 14811 ptr := v_1.Args[0] 14812 mem := v_2 14813 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 14814 break 14815 } 14816 v.reset(OpS390XSUBload) 14817 v.AuxInt = int32ToAuxInt(o1 + o2) 14818 v.Aux = symToAux(mergeSym(s1, s2)) 14819 v.AddArg3(x, ptr, mem) 14820 return true 14821 } 14822 return false 14823 } 14824 func rewriteValueS390X_OpS390XSumBytes2(v *Value) bool { 14825 v_0 := v.Args[0] 14826 b := v.Block 14827 typ := &b.Func.Config.Types 14828 // match: (SumBytes2 x) 14829 // result: (ADDW (SRWconst <typ.UInt8> x [8]) x) 14830 for { 14831 x := v_0 14832 v.reset(OpS390XADDW) 14833 v0 := b.NewValue0(v.Pos, OpS390XSRWconst, typ.UInt8) 14834 v0.AuxInt = uint8ToAuxInt(8) 14835 v0.AddArg(x) 14836 v.AddArg2(v0, x) 14837 return true 14838 } 14839 } 14840 func rewriteValueS390X_OpS390XSumBytes4(v *Value) bool { 14841 v_0 := v.Args[0] 14842 b := v.Block 14843 typ := &b.Func.Config.Types 14844 // match: (SumBytes4 x) 14845 // result: (SumBytes2 (ADDW <typ.UInt16> (SRWconst <typ.UInt16> x [16]) x)) 14846 for { 14847 x := v_0 14848 v.reset(OpS390XSumBytes2) 14849 v0 := b.NewValue0(v.Pos, OpS390XADDW, typ.UInt16) 14850 v1 := b.NewValue0(v.Pos, OpS390XSRWconst, typ.UInt16) 14851 v1.AuxInt = uint8ToAuxInt(16) 14852 v1.AddArg(x) 14853 v0.AddArg2(v1, x) 14854 v.AddArg(v0) 14855 return true 14856 } 14857 } 14858 func rewriteValueS390X_OpS390XSumBytes8(v *Value) bool { 14859 v_0 := v.Args[0] 14860 b := v.Block 14861 typ := &b.Func.Config.Types 14862 // match: (SumBytes8 x) 14863 // result: (SumBytes4 (ADDW <typ.UInt32> (SRDconst <typ.UInt32> x [32]) x)) 14864 for { 14865 x := v_0 14866 v.reset(OpS390XSumBytes4) 14867 v0 := b.NewValue0(v.Pos, OpS390XADDW, typ.UInt32) 14868 v1 := b.NewValue0(v.Pos, OpS390XSRDconst, typ.UInt32) 14869 v1.AuxInt = uint8ToAuxInt(32) 14870 v1.AddArg(x) 14871 v0.AddArg2(v1, x) 14872 v.AddArg(v0) 14873 return true 14874 } 14875 } 14876 func rewriteValueS390X_OpS390XXOR(v *Value) bool { 14877 v_1 := v.Args[1] 14878 v_0 := v.Args[0] 14879 // match: (XOR x (MOVDconst [c])) 14880 // cond: isU32Bit(c) 14881 // result: (XORconst [c] x) 14882 for { 14883 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 14884 x := v_0 14885 if v_1.Op != OpS390XMOVDconst { 14886 continue 14887 } 14888 c := auxIntToInt64(v_1.AuxInt) 14889 if !(isU32Bit(c)) { 14890 continue 14891 } 14892 v.reset(OpS390XXORconst) 14893 v.AuxInt = int64ToAuxInt(c) 14894 v.AddArg(x) 14895 return true 14896 } 14897 break 14898 } 14899 // match: (XOR (MOVDconst [c]) (MOVDconst [d])) 14900 // result: (MOVDconst [c^d]) 14901 for { 14902 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 14903 if v_0.Op != OpS390XMOVDconst { 14904 continue 14905 } 14906 c := auxIntToInt64(v_0.AuxInt) 14907 if v_1.Op != OpS390XMOVDconst { 14908 continue 14909 } 14910 d := auxIntToInt64(v_1.AuxInt) 14911 v.reset(OpS390XMOVDconst) 14912 v.AuxInt = int64ToAuxInt(c ^ d) 14913 return true 14914 } 14915 break 14916 } 14917 // match: (XOR x x) 14918 // result: (MOVDconst [0]) 14919 for { 14920 x := v_0 14921 if x != v_1 { 14922 break 14923 } 14924 v.reset(OpS390XMOVDconst) 14925 v.AuxInt = int64ToAuxInt(0) 14926 return true 14927 } 14928 // match: (XOR <t> x g:(MOVDload [off] {sym} ptr mem)) 14929 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 14930 // result: (XORload <t> [off] {sym} x ptr mem) 14931 for { 14932 t := v.Type 14933 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 14934 x := v_0 14935 g := v_1 14936 if g.Op != OpS390XMOVDload { 14937 continue 14938 } 14939 off := auxIntToInt32(g.AuxInt) 14940 sym := auxToSym(g.Aux) 14941 mem := g.Args[1] 14942 ptr := g.Args[0] 14943 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 14944 continue 14945 } 14946 v.reset(OpS390XXORload) 14947 v.Type = t 14948 v.AuxInt = int32ToAuxInt(off) 14949 v.Aux = symToAux(sym) 14950 v.AddArg3(x, ptr, mem) 14951 return true 14952 } 14953 break 14954 } 14955 return false 14956 } 14957 func rewriteValueS390X_OpS390XXORW(v *Value) bool { 14958 v_1 := v.Args[1] 14959 v_0 := v.Args[0] 14960 // match: (XORW x (MOVDconst [c])) 14961 // result: (XORWconst [int32(c)] x) 14962 for { 14963 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 14964 x := v_0 14965 if v_1.Op != OpS390XMOVDconst { 14966 continue 14967 } 14968 c := auxIntToInt64(v_1.AuxInt) 14969 v.reset(OpS390XXORWconst) 14970 v.AuxInt = int32ToAuxInt(int32(c)) 14971 v.AddArg(x) 14972 return true 14973 } 14974 break 14975 } 14976 // match: (XORW x x) 14977 // result: (MOVDconst [0]) 14978 for { 14979 x := v_0 14980 if x != v_1 { 14981 break 14982 } 14983 v.reset(OpS390XMOVDconst) 14984 v.AuxInt = int64ToAuxInt(0) 14985 return true 14986 } 14987 // match: (XORW <t> x g:(MOVWload [off] {sym} ptr mem)) 14988 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 14989 // result: (XORWload <t> [off] {sym} x ptr mem) 14990 for { 14991 t := v.Type 14992 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 14993 x := v_0 14994 g := v_1 14995 if g.Op != OpS390XMOVWload { 14996 continue 14997 } 14998 off := auxIntToInt32(g.AuxInt) 14999 sym := auxToSym(g.Aux) 15000 mem := g.Args[1] 15001 ptr := g.Args[0] 15002 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 15003 continue 15004 } 15005 v.reset(OpS390XXORWload) 15006 v.Type = t 15007 v.AuxInt = int32ToAuxInt(off) 15008 v.Aux = symToAux(sym) 15009 v.AddArg3(x, ptr, mem) 15010 return true 15011 } 15012 break 15013 } 15014 // match: (XORW <t> x g:(MOVWZload [off] {sym} ptr mem)) 15015 // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) 15016 // result: (XORWload <t> [off] {sym} x ptr mem) 15017 for { 15018 t := v.Type 15019 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 15020 x := v_0 15021 g := v_1 15022 if g.Op != OpS390XMOVWZload { 15023 continue 15024 } 15025 off := auxIntToInt32(g.AuxInt) 15026 sym := auxToSym(g.Aux) 15027 mem := g.Args[1] 15028 ptr := g.Args[0] 15029 if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { 15030 continue 15031 } 15032 v.reset(OpS390XXORWload) 15033 v.Type = t 15034 v.AuxInt = int32ToAuxInt(off) 15035 v.Aux = symToAux(sym) 15036 v.AddArg3(x, ptr, mem) 15037 return true 15038 } 15039 break 15040 } 15041 return false 15042 } 15043 func rewriteValueS390X_OpS390XXORWconst(v *Value) bool { 15044 v_0 := v.Args[0] 15045 // match: (XORWconst [c] x) 15046 // cond: int32(c)==0 15047 // result: x 15048 for { 15049 c := auxIntToInt32(v.AuxInt) 15050 x := v_0 15051 if !(int32(c) == 0) { 15052 break 15053 } 15054 v.copyOf(x) 15055 return true 15056 } 15057 // match: (XORWconst [c] (MOVDconst [d])) 15058 // result: (MOVDconst [int64(c)^d]) 15059 for { 15060 c := auxIntToInt32(v.AuxInt) 15061 if v_0.Op != OpS390XMOVDconst { 15062 break 15063 } 15064 d := auxIntToInt64(v_0.AuxInt) 15065 v.reset(OpS390XMOVDconst) 15066 v.AuxInt = int64ToAuxInt(int64(c) ^ d) 15067 return true 15068 } 15069 return false 15070 } 15071 func rewriteValueS390X_OpS390XXORWload(v *Value) bool { 15072 v_2 := v.Args[2] 15073 v_1 := v.Args[1] 15074 v_0 := v.Args[0] 15075 // match: (XORWload [off1] {sym} x (ADDconst [off2] ptr) mem) 15076 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 15077 // result: (XORWload [off1+off2] {sym} x ptr mem) 15078 for { 15079 off1 := auxIntToInt32(v.AuxInt) 15080 sym := auxToSym(v.Aux) 15081 x := v_0 15082 if v_1.Op != OpS390XADDconst { 15083 break 15084 } 15085 off2 := auxIntToInt32(v_1.AuxInt) 15086 ptr := v_1.Args[0] 15087 mem := v_2 15088 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 15089 break 15090 } 15091 v.reset(OpS390XXORWload) 15092 v.AuxInt = int32ToAuxInt(off1 + off2) 15093 v.Aux = symToAux(sym) 15094 v.AddArg3(x, ptr, mem) 15095 return true 15096 } 15097 // match: (XORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 15098 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 15099 // result: (XORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 15100 for { 15101 o1 := auxIntToInt32(v.AuxInt) 15102 s1 := auxToSym(v.Aux) 15103 x := v_0 15104 if v_1.Op != OpS390XMOVDaddr { 15105 break 15106 } 15107 o2 := auxIntToInt32(v_1.AuxInt) 15108 s2 := auxToSym(v_1.Aux) 15109 ptr := v_1.Args[0] 15110 mem := v_2 15111 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 15112 break 15113 } 15114 v.reset(OpS390XXORWload) 15115 v.AuxInt = int32ToAuxInt(o1 + o2) 15116 v.Aux = symToAux(mergeSym(s1, s2)) 15117 v.AddArg3(x, ptr, mem) 15118 return true 15119 } 15120 return false 15121 } 15122 func rewriteValueS390X_OpS390XXORconst(v *Value) bool { 15123 v_0 := v.Args[0] 15124 // match: (XORconst [0] x) 15125 // result: x 15126 for { 15127 if auxIntToInt64(v.AuxInt) != 0 { 15128 break 15129 } 15130 x := v_0 15131 v.copyOf(x) 15132 return true 15133 } 15134 // match: (XORconst [c] (MOVDconst [d])) 15135 // result: (MOVDconst [c^d]) 15136 for { 15137 c := auxIntToInt64(v.AuxInt) 15138 if v_0.Op != OpS390XMOVDconst { 15139 break 15140 } 15141 d := auxIntToInt64(v_0.AuxInt) 15142 v.reset(OpS390XMOVDconst) 15143 v.AuxInt = int64ToAuxInt(c ^ d) 15144 return true 15145 } 15146 return false 15147 } 15148 func rewriteValueS390X_OpS390XXORload(v *Value) bool { 15149 v_2 := v.Args[2] 15150 v_1 := v.Args[1] 15151 v_0 := v.Args[0] 15152 b := v.Block 15153 // match: (XORload <t> [off] {sym} x ptr1 (FMOVDstore [off] {sym} ptr2 y _)) 15154 // cond: isSamePtr(ptr1, ptr2) 15155 // result: (XOR x (LGDR <t> y)) 15156 for { 15157 t := v.Type 15158 off := auxIntToInt32(v.AuxInt) 15159 sym := auxToSym(v.Aux) 15160 x := v_0 15161 ptr1 := v_1 15162 if v_2.Op != OpS390XFMOVDstore || auxIntToInt32(v_2.AuxInt) != off || auxToSym(v_2.Aux) != sym { 15163 break 15164 } 15165 y := v_2.Args[1] 15166 ptr2 := v_2.Args[0] 15167 if !(isSamePtr(ptr1, ptr2)) { 15168 break 15169 } 15170 v.reset(OpS390XXOR) 15171 v0 := b.NewValue0(v_2.Pos, OpS390XLGDR, t) 15172 v0.AddArg(y) 15173 v.AddArg2(x, v0) 15174 return true 15175 } 15176 // match: (XORload [off1] {sym} x (ADDconst [off2] ptr) mem) 15177 // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) 15178 // result: (XORload [off1+off2] {sym} x ptr mem) 15179 for { 15180 off1 := auxIntToInt32(v.AuxInt) 15181 sym := auxToSym(v.Aux) 15182 x := v_0 15183 if v_1.Op != OpS390XADDconst { 15184 break 15185 } 15186 off2 := auxIntToInt32(v_1.AuxInt) 15187 ptr := v_1.Args[0] 15188 mem := v_2 15189 if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { 15190 break 15191 } 15192 v.reset(OpS390XXORload) 15193 v.AuxInt = int32ToAuxInt(off1 + off2) 15194 v.Aux = symToAux(sym) 15195 v.AddArg3(x, ptr, mem) 15196 return true 15197 } 15198 // match: (XORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) 15199 // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) 15200 // result: (XORload [o1+o2] {mergeSym(s1, s2)} x ptr mem) 15201 for { 15202 o1 := auxIntToInt32(v.AuxInt) 15203 s1 := auxToSym(v.Aux) 15204 x := v_0 15205 if v_1.Op != OpS390XMOVDaddr { 15206 break 15207 } 15208 o2 := auxIntToInt32(v_1.AuxInt) 15209 s2 := auxToSym(v_1.Aux) 15210 ptr := v_1.Args[0] 15211 mem := v_2 15212 if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { 15213 break 15214 } 15215 v.reset(OpS390XXORload) 15216 v.AuxInt = int32ToAuxInt(o1 + o2) 15217 v.Aux = symToAux(mergeSym(s1, s2)) 15218 v.AddArg3(x, ptr, mem) 15219 return true 15220 } 15221 return false 15222 } 15223 func rewriteValueS390X_OpSelect0(v *Value) bool { 15224 v_0 := v.Args[0] 15225 b := v.Block 15226 typ := &b.Func.Config.Types 15227 // match: (Select0 (Add64carry x y c)) 15228 // result: (Select0 <typ.UInt64> (ADDE x y (Select1 <types.TypeFlags> (ADDCconst c [-1])))) 15229 for { 15230 if v_0.Op != OpAdd64carry { 15231 break 15232 } 15233 c := v_0.Args[2] 15234 x := v_0.Args[0] 15235 y := v_0.Args[1] 15236 v.reset(OpSelect0) 15237 v.Type = typ.UInt64 15238 v0 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags)) 15239 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 15240 v2 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags)) 15241 v2.AuxInt = int16ToAuxInt(-1) 15242 v2.AddArg(c) 15243 v1.AddArg(v2) 15244 v0.AddArg3(x, y, v1) 15245 v.AddArg(v0) 15246 return true 15247 } 15248 // match: (Select0 (Sub64borrow x y c)) 15249 // result: (Select0 <typ.UInt64> (SUBE x y (Select1 <types.TypeFlags> (SUBC (MOVDconst [0]) c)))) 15250 for { 15251 if v_0.Op != OpSub64borrow { 15252 break 15253 } 15254 c := v_0.Args[2] 15255 x := v_0.Args[0] 15256 y := v_0.Args[1] 15257 v.reset(OpSelect0) 15258 v.Type = typ.UInt64 15259 v0 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags)) 15260 v1 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 15261 v2 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags)) 15262 v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 15263 v3.AuxInt = int64ToAuxInt(0) 15264 v2.AddArg2(v3, c) 15265 v1.AddArg(v2) 15266 v0.AddArg3(x, y, v1) 15267 v.AddArg(v0) 15268 return true 15269 } 15270 // match: (Select0 <t> (AddTupleFirst32 val tuple)) 15271 // result: (ADDW val (Select0 <t> tuple)) 15272 for { 15273 t := v.Type 15274 if v_0.Op != OpS390XAddTupleFirst32 { 15275 break 15276 } 15277 tuple := v_0.Args[1] 15278 val := v_0.Args[0] 15279 v.reset(OpS390XADDW) 15280 v0 := b.NewValue0(v.Pos, OpSelect0, t) 15281 v0.AddArg(tuple) 15282 v.AddArg2(val, v0) 15283 return true 15284 } 15285 // match: (Select0 <t> (AddTupleFirst64 val tuple)) 15286 // result: (ADD val (Select0 <t> tuple)) 15287 for { 15288 t := v.Type 15289 if v_0.Op != OpS390XAddTupleFirst64 { 15290 break 15291 } 15292 tuple := v_0.Args[1] 15293 val := v_0.Args[0] 15294 v.reset(OpS390XADD) 15295 v0 := b.NewValue0(v.Pos, OpSelect0, t) 15296 v0.AddArg(tuple) 15297 v.AddArg2(val, v0) 15298 return true 15299 } 15300 // match: (Select0 (ADDCconst (MOVDconst [c]) [d])) 15301 // result: (MOVDconst [c+int64(d)]) 15302 for { 15303 if v_0.Op != OpS390XADDCconst { 15304 break 15305 } 15306 d := auxIntToInt16(v_0.AuxInt) 15307 v_0_0 := v_0.Args[0] 15308 if v_0_0.Op != OpS390XMOVDconst { 15309 break 15310 } 15311 c := auxIntToInt64(v_0_0.AuxInt) 15312 v.reset(OpS390XMOVDconst) 15313 v.AuxInt = int64ToAuxInt(c + int64(d)) 15314 return true 15315 } 15316 // match: (Select0 (SUBC (MOVDconst [c]) (MOVDconst [d]))) 15317 // result: (MOVDconst [c-d]) 15318 for { 15319 if v_0.Op != OpS390XSUBC { 15320 break 15321 } 15322 _ = v_0.Args[1] 15323 v_0_0 := v_0.Args[0] 15324 if v_0_0.Op != OpS390XMOVDconst { 15325 break 15326 } 15327 c := auxIntToInt64(v_0_0.AuxInt) 15328 v_0_1 := v_0.Args[1] 15329 if v_0_1.Op != OpS390XMOVDconst { 15330 break 15331 } 15332 d := auxIntToInt64(v_0_1.AuxInt) 15333 v.reset(OpS390XMOVDconst) 15334 v.AuxInt = int64ToAuxInt(c - d) 15335 return true 15336 } 15337 // match: (Select0 (FADD (FMUL y z) x)) 15338 // cond: x.Block.Func.useFMA(v) 15339 // result: (FMADD x y z) 15340 for { 15341 if v_0.Op != OpS390XFADD { 15342 break 15343 } 15344 _ = v_0.Args[1] 15345 v_0_0 := v_0.Args[0] 15346 v_0_1 := v_0.Args[1] 15347 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 15348 if v_0_0.Op != OpS390XFMUL { 15349 continue 15350 } 15351 z := v_0_0.Args[1] 15352 y := v_0_0.Args[0] 15353 x := v_0_1 15354 if !(x.Block.Func.useFMA(v)) { 15355 continue 15356 } 15357 v.reset(OpS390XFMADD) 15358 v.AddArg3(x, y, z) 15359 return true 15360 } 15361 break 15362 } 15363 // match: (Select0 (FSUB (FMUL y z) x)) 15364 // cond: x.Block.Func.useFMA(v) 15365 // result: (FMSUB x y z) 15366 for { 15367 if v_0.Op != OpS390XFSUB { 15368 break 15369 } 15370 x := v_0.Args[1] 15371 v_0_0 := v_0.Args[0] 15372 if v_0_0.Op != OpS390XFMUL { 15373 break 15374 } 15375 z := v_0_0.Args[1] 15376 y := v_0_0.Args[0] 15377 if !(x.Block.Func.useFMA(v)) { 15378 break 15379 } 15380 v.reset(OpS390XFMSUB) 15381 v.AddArg3(x, y, z) 15382 return true 15383 } 15384 // match: (Select0 (FADDS (FMULS y z) x)) 15385 // cond: x.Block.Func.useFMA(v) 15386 // result: (FMADDS x y z) 15387 for { 15388 if v_0.Op != OpS390XFADDS { 15389 break 15390 } 15391 _ = v_0.Args[1] 15392 v_0_0 := v_0.Args[0] 15393 v_0_1 := v_0.Args[1] 15394 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 15395 if v_0_0.Op != OpS390XFMULS { 15396 continue 15397 } 15398 z := v_0_0.Args[1] 15399 y := v_0_0.Args[0] 15400 x := v_0_1 15401 if !(x.Block.Func.useFMA(v)) { 15402 continue 15403 } 15404 v.reset(OpS390XFMADDS) 15405 v.AddArg3(x, y, z) 15406 return true 15407 } 15408 break 15409 } 15410 // match: (Select0 (FSUBS (FMULS y z) x)) 15411 // cond: x.Block.Func.useFMA(v) 15412 // result: (FMSUBS x y z) 15413 for { 15414 if v_0.Op != OpS390XFSUBS { 15415 break 15416 } 15417 x := v_0.Args[1] 15418 v_0_0 := v_0.Args[0] 15419 if v_0_0.Op != OpS390XFMULS { 15420 break 15421 } 15422 z := v_0_0.Args[1] 15423 y := v_0_0.Args[0] 15424 if !(x.Block.Func.useFMA(v)) { 15425 break 15426 } 15427 v.reset(OpS390XFMSUBS) 15428 v.AddArg3(x, y, z) 15429 return true 15430 } 15431 return false 15432 } 15433 func rewriteValueS390X_OpSelect1(v *Value) bool { 15434 v_0 := v.Args[0] 15435 b := v.Block 15436 typ := &b.Func.Config.Types 15437 // match: (Select1 (Add64carry x y c)) 15438 // result: (Select0 <typ.UInt64> (ADDE (MOVDconst [0]) (MOVDconst [0]) (Select1 <types.TypeFlags> (ADDE x y (Select1 <types.TypeFlags> (ADDCconst c [-1])))))) 15439 for { 15440 if v_0.Op != OpAdd64carry { 15441 break 15442 } 15443 c := v_0.Args[2] 15444 x := v_0.Args[0] 15445 y := v_0.Args[1] 15446 v.reset(OpSelect0) 15447 v.Type = typ.UInt64 15448 v0 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags)) 15449 v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 15450 v1.AuxInt = int64ToAuxInt(0) 15451 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 15452 v3 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags)) 15453 v4 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 15454 v5 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags)) 15455 v5.AuxInt = int16ToAuxInt(-1) 15456 v5.AddArg(c) 15457 v4.AddArg(v5) 15458 v3.AddArg3(x, y, v4) 15459 v2.AddArg(v3) 15460 v0.AddArg3(v1, v1, v2) 15461 v.AddArg(v0) 15462 return true 15463 } 15464 // match: (Select1 (Sub64borrow x y c)) 15465 // result: (NEG (Select0 <typ.UInt64> (SUBE (MOVDconst [0]) (MOVDconst [0]) (Select1 <types.TypeFlags> (SUBE x y (Select1 <types.TypeFlags> (SUBC (MOVDconst [0]) c))))))) 15466 for { 15467 if v_0.Op != OpSub64borrow { 15468 break 15469 } 15470 c := v_0.Args[2] 15471 x := v_0.Args[0] 15472 y := v_0.Args[1] 15473 v.reset(OpS390XNEG) 15474 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64) 15475 v1 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags)) 15476 v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64) 15477 v2.AuxInt = int64ToAuxInt(0) 15478 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 15479 v4 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags)) 15480 v5 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 15481 v6 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags)) 15482 v6.AddArg2(v2, c) 15483 v5.AddArg(v6) 15484 v4.AddArg3(x, y, v5) 15485 v3.AddArg(v4) 15486 v1.AddArg3(v2, v2, v3) 15487 v0.AddArg(v1) 15488 v.AddArg(v0) 15489 return true 15490 } 15491 // match: (Select1 (AddTupleFirst32 _ tuple)) 15492 // result: (Select1 tuple) 15493 for { 15494 if v_0.Op != OpS390XAddTupleFirst32 { 15495 break 15496 } 15497 tuple := v_0.Args[1] 15498 v.reset(OpSelect1) 15499 v.AddArg(tuple) 15500 return true 15501 } 15502 // match: (Select1 (AddTupleFirst64 _ tuple)) 15503 // result: (Select1 tuple) 15504 for { 15505 if v_0.Op != OpS390XAddTupleFirst64 { 15506 break 15507 } 15508 tuple := v_0.Args[1] 15509 v.reset(OpSelect1) 15510 v.AddArg(tuple) 15511 return true 15512 } 15513 // match: (Select1 (ADDCconst (MOVDconst [c]) [d])) 15514 // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0 15515 // result: (FlagEQ) 15516 for { 15517 if v_0.Op != OpS390XADDCconst { 15518 break 15519 } 15520 d := auxIntToInt16(v_0.AuxInt) 15521 v_0_0 := v_0.Args[0] 15522 if v_0_0.Op != OpS390XMOVDconst { 15523 break 15524 } 15525 c := auxIntToInt64(v_0_0.AuxInt) 15526 if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0) { 15527 break 15528 } 15529 v.reset(OpS390XFlagEQ) 15530 return true 15531 } 15532 // match: (Select1 (ADDCconst (MOVDconst [c]) [d])) 15533 // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0 15534 // result: (FlagLT) 15535 for { 15536 if v_0.Op != OpS390XADDCconst { 15537 break 15538 } 15539 d := auxIntToInt16(v_0.AuxInt) 15540 v_0_0 := v_0.Args[0] 15541 if v_0_0.Op != OpS390XMOVDconst { 15542 break 15543 } 15544 c := auxIntToInt64(v_0_0.AuxInt) 15545 if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0) { 15546 break 15547 } 15548 v.reset(OpS390XFlagLT) 15549 return true 15550 } 15551 // match: (Select1 (SUBC (MOVDconst [c]) (MOVDconst [d]))) 15552 // cond: uint64(d) <= uint64(c) && c-d == 0 15553 // result: (FlagGT) 15554 for { 15555 if v_0.Op != OpS390XSUBC { 15556 break 15557 } 15558 _ = v_0.Args[1] 15559 v_0_0 := v_0.Args[0] 15560 if v_0_0.Op != OpS390XMOVDconst { 15561 break 15562 } 15563 c := auxIntToInt64(v_0_0.AuxInt) 15564 v_0_1 := v_0.Args[1] 15565 if v_0_1.Op != OpS390XMOVDconst { 15566 break 15567 } 15568 d := auxIntToInt64(v_0_1.AuxInt) 15569 if !(uint64(d) <= uint64(c) && c-d == 0) { 15570 break 15571 } 15572 v.reset(OpS390XFlagGT) 15573 return true 15574 } 15575 // match: (Select1 (SUBC (MOVDconst [c]) (MOVDconst [d]))) 15576 // cond: uint64(d) <= uint64(c) && c-d != 0 15577 // result: (FlagOV) 15578 for { 15579 if v_0.Op != OpS390XSUBC { 15580 break 15581 } 15582 _ = v_0.Args[1] 15583 v_0_0 := v_0.Args[0] 15584 if v_0_0.Op != OpS390XMOVDconst { 15585 break 15586 } 15587 c := auxIntToInt64(v_0_0.AuxInt) 15588 v_0_1 := v_0.Args[1] 15589 if v_0_1.Op != OpS390XMOVDconst { 15590 break 15591 } 15592 d := auxIntToInt64(v_0_1.AuxInt) 15593 if !(uint64(d) <= uint64(c) && c-d != 0) { 15594 break 15595 } 15596 v.reset(OpS390XFlagOV) 15597 return true 15598 } 15599 return false 15600 } 15601 func rewriteValueS390X_OpSlicemask(v *Value) bool { 15602 v_0 := v.Args[0] 15603 b := v.Block 15604 // match: (Slicemask <t> x) 15605 // result: (SRADconst (NEG <t> x) [63]) 15606 for { 15607 t := v.Type 15608 x := v_0 15609 v.reset(OpS390XSRADconst) 15610 v.AuxInt = uint8ToAuxInt(63) 15611 v0 := b.NewValue0(v.Pos, OpS390XNEG, t) 15612 v0.AddArg(x) 15613 v.AddArg(v0) 15614 return true 15615 } 15616 } 15617 func rewriteValueS390X_OpStore(v *Value) bool { 15618 v_2 := v.Args[2] 15619 v_1 := v.Args[1] 15620 v_0 := v.Args[0] 15621 // match: (Store {t} ptr val mem) 15622 // cond: t.Size() == 8 && is64BitFloat(val.Type) 15623 // result: (FMOVDstore ptr val mem) 15624 for { 15625 t := auxToType(v.Aux) 15626 ptr := v_0 15627 val := v_1 15628 mem := v_2 15629 if !(t.Size() == 8 && is64BitFloat(val.Type)) { 15630 break 15631 } 15632 v.reset(OpS390XFMOVDstore) 15633 v.AddArg3(ptr, val, mem) 15634 return true 15635 } 15636 // match: (Store {t} ptr val mem) 15637 // cond: t.Size() == 4 && is32BitFloat(val.Type) 15638 // result: (FMOVSstore ptr val mem) 15639 for { 15640 t := auxToType(v.Aux) 15641 ptr := v_0 15642 val := v_1 15643 mem := v_2 15644 if !(t.Size() == 4 && is32BitFloat(val.Type)) { 15645 break 15646 } 15647 v.reset(OpS390XFMOVSstore) 15648 v.AddArg3(ptr, val, mem) 15649 return true 15650 } 15651 // match: (Store {t} ptr val mem) 15652 // cond: t.Size() == 8 15653 // result: (MOVDstore ptr val mem) 15654 for { 15655 t := auxToType(v.Aux) 15656 ptr := v_0 15657 val := v_1 15658 mem := v_2 15659 if !(t.Size() == 8) { 15660 break 15661 } 15662 v.reset(OpS390XMOVDstore) 15663 v.AddArg3(ptr, val, mem) 15664 return true 15665 } 15666 // match: (Store {t} ptr val mem) 15667 // cond: t.Size() == 4 15668 // result: (MOVWstore ptr val mem) 15669 for { 15670 t := auxToType(v.Aux) 15671 ptr := v_0 15672 val := v_1 15673 mem := v_2 15674 if !(t.Size() == 4) { 15675 break 15676 } 15677 v.reset(OpS390XMOVWstore) 15678 v.AddArg3(ptr, val, mem) 15679 return true 15680 } 15681 // match: (Store {t} ptr val mem) 15682 // cond: t.Size() == 2 15683 // result: (MOVHstore ptr val mem) 15684 for { 15685 t := auxToType(v.Aux) 15686 ptr := v_0 15687 val := v_1 15688 mem := v_2 15689 if !(t.Size() == 2) { 15690 break 15691 } 15692 v.reset(OpS390XMOVHstore) 15693 v.AddArg3(ptr, val, mem) 15694 return true 15695 } 15696 // match: (Store {t} ptr val mem) 15697 // cond: t.Size() == 1 15698 // result: (MOVBstore ptr val mem) 15699 for { 15700 t := auxToType(v.Aux) 15701 ptr := v_0 15702 val := v_1 15703 mem := v_2 15704 if !(t.Size() == 1) { 15705 break 15706 } 15707 v.reset(OpS390XMOVBstore) 15708 v.AddArg3(ptr, val, mem) 15709 return true 15710 } 15711 return false 15712 } 15713 func rewriteValueS390X_OpSub32F(v *Value) bool { 15714 v_1 := v.Args[1] 15715 v_0 := v.Args[0] 15716 b := v.Block 15717 typ := &b.Func.Config.Types 15718 // match: (Sub32F x y) 15719 // result: (Select0 (FSUBS x y)) 15720 for { 15721 x := v_0 15722 y := v_1 15723 v.reset(OpSelect0) 15724 v0 := b.NewValue0(v.Pos, OpS390XFSUBS, types.NewTuple(typ.Float32, types.TypeFlags)) 15725 v0.AddArg2(x, y) 15726 v.AddArg(v0) 15727 return true 15728 } 15729 } 15730 func rewriteValueS390X_OpSub64F(v *Value) bool { 15731 v_1 := v.Args[1] 15732 v_0 := v.Args[0] 15733 b := v.Block 15734 typ := &b.Func.Config.Types 15735 // match: (Sub64F x y) 15736 // result: (Select0 (FSUB x y)) 15737 for { 15738 x := v_0 15739 y := v_1 15740 v.reset(OpSelect0) 15741 v0 := b.NewValue0(v.Pos, OpS390XFSUB, types.NewTuple(typ.Float64, types.TypeFlags)) 15742 v0.AddArg2(x, y) 15743 v.AddArg(v0) 15744 return true 15745 } 15746 } 15747 func rewriteValueS390X_OpTrunc(v *Value) bool { 15748 v_0 := v.Args[0] 15749 // match: (Trunc x) 15750 // result: (FIDBR [5] x) 15751 for { 15752 x := v_0 15753 v.reset(OpS390XFIDBR) 15754 v.AuxInt = int8ToAuxInt(5) 15755 v.AddArg(x) 15756 return true 15757 } 15758 } 15759 func rewriteValueS390X_OpZero(v *Value) bool { 15760 v_1 := v.Args[1] 15761 v_0 := v.Args[0] 15762 b := v.Block 15763 // match: (Zero [0] _ mem) 15764 // result: mem 15765 for { 15766 if auxIntToInt64(v.AuxInt) != 0 { 15767 break 15768 } 15769 mem := v_1 15770 v.copyOf(mem) 15771 return true 15772 } 15773 // match: (Zero [1] destptr mem) 15774 // result: (MOVBstoreconst [0] destptr mem) 15775 for { 15776 if auxIntToInt64(v.AuxInt) != 1 { 15777 break 15778 } 15779 destptr := v_0 15780 mem := v_1 15781 v.reset(OpS390XMOVBstoreconst) 15782 v.AuxInt = valAndOffToAuxInt(0) 15783 v.AddArg2(destptr, mem) 15784 return true 15785 } 15786 // match: (Zero [2] destptr mem) 15787 // result: (MOVHstoreconst [0] destptr mem) 15788 for { 15789 if auxIntToInt64(v.AuxInt) != 2 { 15790 break 15791 } 15792 destptr := v_0 15793 mem := v_1 15794 v.reset(OpS390XMOVHstoreconst) 15795 v.AuxInt = valAndOffToAuxInt(0) 15796 v.AddArg2(destptr, mem) 15797 return true 15798 } 15799 // match: (Zero [4] destptr mem) 15800 // result: (MOVWstoreconst [0] destptr mem) 15801 for { 15802 if auxIntToInt64(v.AuxInt) != 4 { 15803 break 15804 } 15805 destptr := v_0 15806 mem := v_1 15807 v.reset(OpS390XMOVWstoreconst) 15808 v.AuxInt = valAndOffToAuxInt(0) 15809 v.AddArg2(destptr, mem) 15810 return true 15811 } 15812 // match: (Zero [8] destptr mem) 15813 // result: (MOVDstoreconst [0] destptr mem) 15814 for { 15815 if auxIntToInt64(v.AuxInt) != 8 { 15816 break 15817 } 15818 destptr := v_0 15819 mem := v_1 15820 v.reset(OpS390XMOVDstoreconst) 15821 v.AuxInt = valAndOffToAuxInt(0) 15822 v.AddArg2(destptr, mem) 15823 return true 15824 } 15825 // match: (Zero [3] destptr mem) 15826 // result: (MOVBstoreconst [makeValAndOff(0,2)] destptr (MOVHstoreconst [0] destptr mem)) 15827 for { 15828 if auxIntToInt64(v.AuxInt) != 3 { 15829 break 15830 } 15831 destptr := v_0 15832 mem := v_1 15833 v.reset(OpS390XMOVBstoreconst) 15834 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 2)) 15835 v0 := b.NewValue0(v.Pos, OpS390XMOVHstoreconst, types.TypeMem) 15836 v0.AuxInt = valAndOffToAuxInt(0) 15837 v0.AddArg2(destptr, mem) 15838 v.AddArg2(destptr, v0) 15839 return true 15840 } 15841 // match: (Zero [5] destptr mem) 15842 // result: (MOVBstoreconst [makeValAndOff(0,4)] destptr (MOVWstoreconst [0] destptr mem)) 15843 for { 15844 if auxIntToInt64(v.AuxInt) != 5 { 15845 break 15846 } 15847 destptr := v_0 15848 mem := v_1 15849 v.reset(OpS390XMOVBstoreconst) 15850 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4)) 15851 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem) 15852 v0.AuxInt = valAndOffToAuxInt(0) 15853 v0.AddArg2(destptr, mem) 15854 v.AddArg2(destptr, v0) 15855 return true 15856 } 15857 // match: (Zero [6] destptr mem) 15858 // result: (MOVHstoreconst [makeValAndOff(0,4)] destptr (MOVWstoreconst [0] destptr mem)) 15859 for { 15860 if auxIntToInt64(v.AuxInt) != 6 { 15861 break 15862 } 15863 destptr := v_0 15864 mem := v_1 15865 v.reset(OpS390XMOVHstoreconst) 15866 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4)) 15867 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem) 15868 v0.AuxInt = valAndOffToAuxInt(0) 15869 v0.AddArg2(destptr, mem) 15870 v.AddArg2(destptr, v0) 15871 return true 15872 } 15873 // match: (Zero [7] destptr mem) 15874 // result: (MOVWstoreconst [makeValAndOff(0,3)] destptr (MOVWstoreconst [0] destptr mem)) 15875 for { 15876 if auxIntToInt64(v.AuxInt) != 7 { 15877 break 15878 } 15879 destptr := v_0 15880 mem := v_1 15881 v.reset(OpS390XMOVWstoreconst) 15882 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 3)) 15883 v0 := b.NewValue0(v.Pos, OpS390XMOVWstoreconst, types.TypeMem) 15884 v0.AuxInt = valAndOffToAuxInt(0) 15885 v0.AddArg2(destptr, mem) 15886 v.AddArg2(destptr, v0) 15887 return true 15888 } 15889 // match: (Zero [s] destptr mem) 15890 // cond: s > 0 && s <= 1024 15891 // result: (CLEAR [makeValAndOff(int32(s), 0)] destptr mem) 15892 for { 15893 s := auxIntToInt64(v.AuxInt) 15894 destptr := v_0 15895 mem := v_1 15896 if !(s > 0 && s <= 1024) { 15897 break 15898 } 15899 v.reset(OpS390XCLEAR) 15900 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(s), 0)) 15901 v.AddArg2(destptr, mem) 15902 return true 15903 } 15904 // match: (Zero [s] destptr mem) 15905 // cond: s > 1024 15906 // result: (LoweredZero [s%256] destptr (ADDconst <destptr.Type> destptr [(int32(s)/256)*256]) mem) 15907 for { 15908 s := auxIntToInt64(v.AuxInt) 15909 destptr := v_0 15910 mem := v_1 15911 if !(s > 1024) { 15912 break 15913 } 15914 v.reset(OpS390XLoweredZero) 15915 v.AuxInt = int64ToAuxInt(s % 256) 15916 v0 := b.NewValue0(v.Pos, OpS390XADDconst, destptr.Type) 15917 v0.AuxInt = int32ToAuxInt((int32(s) / 256) * 256) 15918 v0.AddArg(destptr) 15919 v.AddArg3(destptr, v0, mem) 15920 return true 15921 } 15922 return false 15923 } 15924 func rewriteBlockS390X(b *Block) bool { 15925 typ := &b.Func.Config.Types 15926 switch b.Kind { 15927 case BlockS390XBRC: 15928 // match: (BRC {c} x:(CMP _ _) yes no) 15929 // cond: c&s390x.Unordered != 0 15930 // result: (BRC {c&^s390x.Unordered} x yes no) 15931 for b.Controls[0].Op == OpS390XCMP { 15932 x := b.Controls[0] 15933 c := auxToS390xCCMask(b.Aux) 15934 if !(c&s390x.Unordered != 0) { 15935 break 15936 } 15937 b.resetWithControl(BlockS390XBRC, x) 15938 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 15939 return true 15940 } 15941 // match: (BRC {c} x:(CMPW _ _) yes no) 15942 // cond: c&s390x.Unordered != 0 15943 // result: (BRC {c&^s390x.Unordered} x yes no) 15944 for b.Controls[0].Op == OpS390XCMPW { 15945 x := b.Controls[0] 15946 c := auxToS390xCCMask(b.Aux) 15947 if !(c&s390x.Unordered != 0) { 15948 break 15949 } 15950 b.resetWithControl(BlockS390XBRC, x) 15951 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 15952 return true 15953 } 15954 // match: (BRC {c} x:(CMPU _ _) yes no) 15955 // cond: c&s390x.Unordered != 0 15956 // result: (BRC {c&^s390x.Unordered} x yes no) 15957 for b.Controls[0].Op == OpS390XCMPU { 15958 x := b.Controls[0] 15959 c := auxToS390xCCMask(b.Aux) 15960 if !(c&s390x.Unordered != 0) { 15961 break 15962 } 15963 b.resetWithControl(BlockS390XBRC, x) 15964 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 15965 return true 15966 } 15967 // match: (BRC {c} x:(CMPWU _ _) yes no) 15968 // cond: c&s390x.Unordered != 0 15969 // result: (BRC {c&^s390x.Unordered} x yes no) 15970 for b.Controls[0].Op == OpS390XCMPWU { 15971 x := b.Controls[0] 15972 c := auxToS390xCCMask(b.Aux) 15973 if !(c&s390x.Unordered != 0) { 15974 break 15975 } 15976 b.resetWithControl(BlockS390XBRC, x) 15977 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 15978 return true 15979 } 15980 // match: (BRC {c} x:(CMPconst _) yes no) 15981 // cond: c&s390x.Unordered != 0 15982 // result: (BRC {c&^s390x.Unordered} x yes no) 15983 for b.Controls[0].Op == OpS390XCMPconst { 15984 x := b.Controls[0] 15985 c := auxToS390xCCMask(b.Aux) 15986 if !(c&s390x.Unordered != 0) { 15987 break 15988 } 15989 b.resetWithControl(BlockS390XBRC, x) 15990 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 15991 return true 15992 } 15993 // match: (BRC {c} x:(CMPWconst _) yes no) 15994 // cond: c&s390x.Unordered != 0 15995 // result: (BRC {c&^s390x.Unordered} x yes no) 15996 for b.Controls[0].Op == OpS390XCMPWconst { 15997 x := b.Controls[0] 15998 c := auxToS390xCCMask(b.Aux) 15999 if !(c&s390x.Unordered != 0) { 16000 break 16001 } 16002 b.resetWithControl(BlockS390XBRC, x) 16003 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16004 return true 16005 } 16006 // match: (BRC {c} x:(CMPUconst _) yes no) 16007 // cond: c&s390x.Unordered != 0 16008 // result: (BRC {c&^s390x.Unordered} x yes no) 16009 for b.Controls[0].Op == OpS390XCMPUconst { 16010 x := b.Controls[0] 16011 c := auxToS390xCCMask(b.Aux) 16012 if !(c&s390x.Unordered != 0) { 16013 break 16014 } 16015 b.resetWithControl(BlockS390XBRC, x) 16016 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16017 return true 16018 } 16019 // match: (BRC {c} x:(CMPWUconst _) yes no) 16020 // cond: c&s390x.Unordered != 0 16021 // result: (BRC {c&^s390x.Unordered} x yes no) 16022 for b.Controls[0].Op == OpS390XCMPWUconst { 16023 x := b.Controls[0] 16024 c := auxToS390xCCMask(b.Aux) 16025 if !(c&s390x.Unordered != 0) { 16026 break 16027 } 16028 b.resetWithControl(BlockS390XBRC, x) 16029 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16030 return true 16031 } 16032 // match: (BRC {c} (CMP x y) yes no) 16033 // result: (CGRJ {c&^s390x.Unordered} x y yes no) 16034 for b.Controls[0].Op == OpS390XCMP { 16035 v_0 := b.Controls[0] 16036 y := v_0.Args[1] 16037 x := v_0.Args[0] 16038 c := auxToS390xCCMask(b.Aux) 16039 b.resetWithControl2(BlockS390XCGRJ, x, y) 16040 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16041 return true 16042 } 16043 // match: (BRC {c} (CMPW x y) yes no) 16044 // result: (CRJ {c&^s390x.Unordered} x y yes no) 16045 for b.Controls[0].Op == OpS390XCMPW { 16046 v_0 := b.Controls[0] 16047 y := v_0.Args[1] 16048 x := v_0.Args[0] 16049 c := auxToS390xCCMask(b.Aux) 16050 b.resetWithControl2(BlockS390XCRJ, x, y) 16051 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16052 return true 16053 } 16054 // match: (BRC {c} (CMPU x y) yes no) 16055 // result: (CLGRJ {c&^s390x.Unordered} x y yes no) 16056 for b.Controls[0].Op == OpS390XCMPU { 16057 v_0 := b.Controls[0] 16058 y := v_0.Args[1] 16059 x := v_0.Args[0] 16060 c := auxToS390xCCMask(b.Aux) 16061 b.resetWithControl2(BlockS390XCLGRJ, x, y) 16062 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16063 return true 16064 } 16065 // match: (BRC {c} (CMPWU x y) yes no) 16066 // result: (CLRJ {c&^s390x.Unordered} x y yes no) 16067 for b.Controls[0].Op == OpS390XCMPWU { 16068 v_0 := b.Controls[0] 16069 y := v_0.Args[1] 16070 x := v_0.Args[0] 16071 c := auxToS390xCCMask(b.Aux) 16072 b.resetWithControl2(BlockS390XCLRJ, x, y) 16073 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16074 return true 16075 } 16076 // match: (BRC {c} (CMPconst x [y]) yes no) 16077 // cond: y == int32( int8(y)) 16078 // result: (CGIJ {c&^s390x.Unordered} x [ int8(y)] yes no) 16079 for b.Controls[0].Op == OpS390XCMPconst { 16080 v_0 := b.Controls[0] 16081 y := auxIntToInt32(v_0.AuxInt) 16082 x := v_0.Args[0] 16083 c := auxToS390xCCMask(b.Aux) 16084 if !(y == int32(int8(y))) { 16085 break 16086 } 16087 b.resetWithControl(BlockS390XCGIJ, x) 16088 b.AuxInt = int8ToAuxInt(int8(y)) 16089 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16090 return true 16091 } 16092 // match: (BRC {c} (CMPWconst x [y]) yes no) 16093 // cond: y == int32( int8(y)) 16094 // result: (CIJ {c&^s390x.Unordered} x [ int8(y)] yes no) 16095 for b.Controls[0].Op == OpS390XCMPWconst { 16096 v_0 := b.Controls[0] 16097 y := auxIntToInt32(v_0.AuxInt) 16098 x := v_0.Args[0] 16099 c := auxToS390xCCMask(b.Aux) 16100 if !(y == int32(int8(y))) { 16101 break 16102 } 16103 b.resetWithControl(BlockS390XCIJ, x) 16104 b.AuxInt = int8ToAuxInt(int8(y)) 16105 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16106 return true 16107 } 16108 // match: (BRC {c} (CMPUconst x [y]) yes no) 16109 // cond: y == int32(uint8(y)) 16110 // result: (CLGIJ {c&^s390x.Unordered} x [uint8(y)] yes no) 16111 for b.Controls[0].Op == OpS390XCMPUconst { 16112 v_0 := b.Controls[0] 16113 y := auxIntToInt32(v_0.AuxInt) 16114 x := v_0.Args[0] 16115 c := auxToS390xCCMask(b.Aux) 16116 if !(y == int32(uint8(y))) { 16117 break 16118 } 16119 b.resetWithControl(BlockS390XCLGIJ, x) 16120 b.AuxInt = uint8ToAuxInt(uint8(y)) 16121 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16122 return true 16123 } 16124 // match: (BRC {c} (CMPWUconst x [y]) yes no) 16125 // cond: y == int32(uint8(y)) 16126 // result: (CLIJ {c&^s390x.Unordered} x [uint8(y)] yes no) 16127 for b.Controls[0].Op == OpS390XCMPWUconst { 16128 v_0 := b.Controls[0] 16129 y := auxIntToInt32(v_0.AuxInt) 16130 x := v_0.Args[0] 16131 c := auxToS390xCCMask(b.Aux) 16132 if !(y == int32(uint8(y))) { 16133 break 16134 } 16135 b.resetWithControl(BlockS390XCLIJ, x) 16136 b.AuxInt = uint8ToAuxInt(uint8(y)) 16137 b.Aux = s390xCCMaskToAux(c &^ s390x.Unordered) 16138 return true 16139 } 16140 // match: (BRC {s390x.Less} (CMPconst x [ 128]) yes no) 16141 // result: (CGIJ {s390x.LessOrEqual} x [ 127] yes no) 16142 for b.Controls[0].Op == OpS390XCMPconst { 16143 v_0 := b.Controls[0] 16144 if auxIntToInt32(v_0.AuxInt) != 128 { 16145 break 16146 } 16147 x := v_0.Args[0] 16148 if auxToS390xCCMask(b.Aux) != s390x.Less { 16149 break 16150 } 16151 b.resetWithControl(BlockS390XCGIJ, x) 16152 b.AuxInt = int8ToAuxInt(127) 16153 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 16154 return true 16155 } 16156 // match: (BRC {s390x.Less} (CMPWconst x [ 128]) yes no) 16157 // result: (CIJ {s390x.LessOrEqual} x [ 127] yes no) 16158 for b.Controls[0].Op == OpS390XCMPWconst { 16159 v_0 := b.Controls[0] 16160 if auxIntToInt32(v_0.AuxInt) != 128 { 16161 break 16162 } 16163 x := v_0.Args[0] 16164 if auxToS390xCCMask(b.Aux) != s390x.Less { 16165 break 16166 } 16167 b.resetWithControl(BlockS390XCIJ, x) 16168 b.AuxInt = int8ToAuxInt(127) 16169 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 16170 return true 16171 } 16172 // match: (BRC {s390x.LessOrEqual} (CMPconst x [-129]) yes no) 16173 // result: (CGIJ {s390x.Less} x [-128] yes no) 16174 for b.Controls[0].Op == OpS390XCMPconst { 16175 v_0 := b.Controls[0] 16176 if auxIntToInt32(v_0.AuxInt) != -129 { 16177 break 16178 } 16179 x := v_0.Args[0] 16180 if auxToS390xCCMask(b.Aux) != s390x.LessOrEqual { 16181 break 16182 } 16183 b.resetWithControl(BlockS390XCGIJ, x) 16184 b.AuxInt = int8ToAuxInt(-128) 16185 b.Aux = s390xCCMaskToAux(s390x.Less) 16186 return true 16187 } 16188 // match: (BRC {s390x.LessOrEqual} (CMPWconst x [-129]) yes no) 16189 // result: (CIJ {s390x.Less} x [-128] yes no) 16190 for b.Controls[0].Op == OpS390XCMPWconst { 16191 v_0 := b.Controls[0] 16192 if auxIntToInt32(v_0.AuxInt) != -129 { 16193 break 16194 } 16195 x := v_0.Args[0] 16196 if auxToS390xCCMask(b.Aux) != s390x.LessOrEqual { 16197 break 16198 } 16199 b.resetWithControl(BlockS390XCIJ, x) 16200 b.AuxInt = int8ToAuxInt(-128) 16201 b.Aux = s390xCCMaskToAux(s390x.Less) 16202 return true 16203 } 16204 // match: (BRC {s390x.Greater} (CMPconst x [-129]) yes no) 16205 // result: (CGIJ {s390x.GreaterOrEqual} x [-128] yes no) 16206 for b.Controls[0].Op == OpS390XCMPconst { 16207 v_0 := b.Controls[0] 16208 if auxIntToInt32(v_0.AuxInt) != -129 { 16209 break 16210 } 16211 x := v_0.Args[0] 16212 if auxToS390xCCMask(b.Aux) != s390x.Greater { 16213 break 16214 } 16215 b.resetWithControl(BlockS390XCGIJ, x) 16216 b.AuxInt = int8ToAuxInt(-128) 16217 b.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 16218 return true 16219 } 16220 // match: (BRC {s390x.Greater} (CMPWconst x [-129]) yes no) 16221 // result: (CIJ {s390x.GreaterOrEqual} x [-128] yes no) 16222 for b.Controls[0].Op == OpS390XCMPWconst { 16223 v_0 := b.Controls[0] 16224 if auxIntToInt32(v_0.AuxInt) != -129 { 16225 break 16226 } 16227 x := v_0.Args[0] 16228 if auxToS390xCCMask(b.Aux) != s390x.Greater { 16229 break 16230 } 16231 b.resetWithControl(BlockS390XCIJ, x) 16232 b.AuxInt = int8ToAuxInt(-128) 16233 b.Aux = s390xCCMaskToAux(s390x.GreaterOrEqual) 16234 return true 16235 } 16236 // match: (BRC {s390x.GreaterOrEqual} (CMPconst x [ 128]) yes no) 16237 // result: (CGIJ {s390x.Greater} x [ 127] yes no) 16238 for b.Controls[0].Op == OpS390XCMPconst { 16239 v_0 := b.Controls[0] 16240 if auxIntToInt32(v_0.AuxInt) != 128 { 16241 break 16242 } 16243 x := v_0.Args[0] 16244 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 16245 break 16246 } 16247 b.resetWithControl(BlockS390XCGIJ, x) 16248 b.AuxInt = int8ToAuxInt(127) 16249 b.Aux = s390xCCMaskToAux(s390x.Greater) 16250 return true 16251 } 16252 // match: (BRC {s390x.GreaterOrEqual} (CMPWconst x [ 128]) yes no) 16253 // result: (CIJ {s390x.Greater} x [ 127] yes no) 16254 for b.Controls[0].Op == OpS390XCMPWconst { 16255 v_0 := b.Controls[0] 16256 if auxIntToInt32(v_0.AuxInt) != 128 { 16257 break 16258 } 16259 x := v_0.Args[0] 16260 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 16261 break 16262 } 16263 b.resetWithControl(BlockS390XCIJ, x) 16264 b.AuxInt = int8ToAuxInt(127) 16265 b.Aux = s390xCCMaskToAux(s390x.Greater) 16266 return true 16267 } 16268 // match: (BRC {s390x.Less} (CMPWUconst x [256]) yes no) 16269 // result: (CLIJ {s390x.LessOrEqual} x [255] yes no) 16270 for b.Controls[0].Op == OpS390XCMPWUconst { 16271 v_0 := b.Controls[0] 16272 if auxIntToInt32(v_0.AuxInt) != 256 { 16273 break 16274 } 16275 x := v_0.Args[0] 16276 if auxToS390xCCMask(b.Aux) != s390x.Less { 16277 break 16278 } 16279 b.resetWithControl(BlockS390XCLIJ, x) 16280 b.AuxInt = uint8ToAuxInt(255) 16281 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 16282 return true 16283 } 16284 // match: (BRC {s390x.Less} (CMPUconst x [256]) yes no) 16285 // result: (CLGIJ {s390x.LessOrEqual} x [255] yes no) 16286 for b.Controls[0].Op == OpS390XCMPUconst { 16287 v_0 := b.Controls[0] 16288 if auxIntToInt32(v_0.AuxInt) != 256 { 16289 break 16290 } 16291 x := v_0.Args[0] 16292 if auxToS390xCCMask(b.Aux) != s390x.Less { 16293 break 16294 } 16295 b.resetWithControl(BlockS390XCLGIJ, x) 16296 b.AuxInt = uint8ToAuxInt(255) 16297 b.Aux = s390xCCMaskToAux(s390x.LessOrEqual) 16298 return true 16299 } 16300 // match: (BRC {s390x.GreaterOrEqual} (CMPWUconst x [256]) yes no) 16301 // result: (CLIJ {s390x.Greater} x [255] yes no) 16302 for b.Controls[0].Op == OpS390XCMPWUconst { 16303 v_0 := b.Controls[0] 16304 if auxIntToInt32(v_0.AuxInt) != 256 { 16305 break 16306 } 16307 x := v_0.Args[0] 16308 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 16309 break 16310 } 16311 b.resetWithControl(BlockS390XCLIJ, x) 16312 b.AuxInt = uint8ToAuxInt(255) 16313 b.Aux = s390xCCMaskToAux(s390x.Greater) 16314 return true 16315 } 16316 // match: (BRC {s390x.GreaterOrEqual} (CMPUconst x [256]) yes no) 16317 // result: (CLGIJ {s390x.Greater} x [255] yes no) 16318 for b.Controls[0].Op == OpS390XCMPUconst { 16319 v_0 := b.Controls[0] 16320 if auxIntToInt32(v_0.AuxInt) != 256 { 16321 break 16322 } 16323 x := v_0.Args[0] 16324 if auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 16325 break 16326 } 16327 b.resetWithControl(BlockS390XCLGIJ, x) 16328 b.AuxInt = uint8ToAuxInt(255) 16329 b.Aux = s390xCCMaskToAux(s390x.Greater) 16330 return true 16331 } 16332 // match: (BRC {c} (CMPconst x [y]) yes no) 16333 // cond: y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater) 16334 // result: (CLGIJ {c} x [uint8(y)] yes no) 16335 for b.Controls[0].Op == OpS390XCMPconst { 16336 v_0 := b.Controls[0] 16337 y := auxIntToInt32(v_0.AuxInt) 16338 x := v_0.Args[0] 16339 c := auxToS390xCCMask(b.Aux) 16340 if !(y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) { 16341 break 16342 } 16343 b.resetWithControl(BlockS390XCLGIJ, x) 16344 b.AuxInt = uint8ToAuxInt(uint8(y)) 16345 b.Aux = s390xCCMaskToAux(c) 16346 return true 16347 } 16348 // match: (BRC {c} (CMPWconst x [y]) yes no) 16349 // cond: y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater) 16350 // result: (CLIJ {c} x [uint8(y)] yes no) 16351 for b.Controls[0].Op == OpS390XCMPWconst { 16352 v_0 := b.Controls[0] 16353 y := auxIntToInt32(v_0.AuxInt) 16354 x := v_0.Args[0] 16355 c := auxToS390xCCMask(b.Aux) 16356 if !(y == int32(uint8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) { 16357 break 16358 } 16359 b.resetWithControl(BlockS390XCLIJ, x) 16360 b.AuxInt = uint8ToAuxInt(uint8(y)) 16361 b.Aux = s390xCCMaskToAux(c) 16362 return true 16363 } 16364 // match: (BRC {c} (CMPUconst x [y]) yes no) 16365 // cond: y == int32( int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater) 16366 // result: (CGIJ {c} x [ int8(y)] yes no) 16367 for b.Controls[0].Op == OpS390XCMPUconst { 16368 v_0 := b.Controls[0] 16369 y := auxIntToInt32(v_0.AuxInt) 16370 x := v_0.Args[0] 16371 c := auxToS390xCCMask(b.Aux) 16372 if !(y == int32(int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) { 16373 break 16374 } 16375 b.resetWithControl(BlockS390XCGIJ, x) 16376 b.AuxInt = int8ToAuxInt(int8(y)) 16377 b.Aux = s390xCCMaskToAux(c) 16378 return true 16379 } 16380 // match: (BRC {c} (CMPWUconst x [y]) yes no) 16381 // cond: y == int32( int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater) 16382 // result: (CIJ {c} x [ int8(y)] yes no) 16383 for b.Controls[0].Op == OpS390XCMPWUconst { 16384 v_0 := b.Controls[0] 16385 y := auxIntToInt32(v_0.AuxInt) 16386 x := v_0.Args[0] 16387 c := auxToS390xCCMask(b.Aux) 16388 if !(y == int32(int8(y)) && (c == s390x.Equal || c == s390x.LessOrGreater)) { 16389 break 16390 } 16391 b.resetWithControl(BlockS390XCIJ, x) 16392 b.AuxInt = int8ToAuxInt(int8(y)) 16393 b.Aux = s390xCCMaskToAux(c) 16394 return true 16395 } 16396 // match: (BRC {c} (InvertFlags cmp) yes no) 16397 // result: (BRC {c.ReverseComparison()} cmp yes no) 16398 for b.Controls[0].Op == OpS390XInvertFlags { 16399 v_0 := b.Controls[0] 16400 cmp := v_0.Args[0] 16401 c := auxToS390xCCMask(b.Aux) 16402 b.resetWithControl(BlockS390XBRC, cmp) 16403 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 16404 return true 16405 } 16406 // match: (BRC {c} (FlagEQ) yes no) 16407 // cond: c&s390x.Equal != 0 16408 // result: (First yes no) 16409 for b.Controls[0].Op == OpS390XFlagEQ { 16410 c := auxToS390xCCMask(b.Aux) 16411 if !(c&s390x.Equal != 0) { 16412 break 16413 } 16414 b.Reset(BlockFirst) 16415 return true 16416 } 16417 // match: (BRC {c} (FlagLT) yes no) 16418 // cond: c&s390x.Less != 0 16419 // result: (First yes no) 16420 for b.Controls[0].Op == OpS390XFlagLT { 16421 c := auxToS390xCCMask(b.Aux) 16422 if !(c&s390x.Less != 0) { 16423 break 16424 } 16425 b.Reset(BlockFirst) 16426 return true 16427 } 16428 // match: (BRC {c} (FlagGT) yes no) 16429 // cond: c&s390x.Greater != 0 16430 // result: (First yes no) 16431 for b.Controls[0].Op == OpS390XFlagGT { 16432 c := auxToS390xCCMask(b.Aux) 16433 if !(c&s390x.Greater != 0) { 16434 break 16435 } 16436 b.Reset(BlockFirst) 16437 return true 16438 } 16439 // match: (BRC {c} (FlagOV) yes no) 16440 // cond: c&s390x.Unordered != 0 16441 // result: (First yes no) 16442 for b.Controls[0].Op == OpS390XFlagOV { 16443 c := auxToS390xCCMask(b.Aux) 16444 if !(c&s390x.Unordered != 0) { 16445 break 16446 } 16447 b.Reset(BlockFirst) 16448 return true 16449 } 16450 // match: (BRC {c} (FlagEQ) yes no) 16451 // cond: c&s390x.Equal == 0 16452 // result: (First no yes) 16453 for b.Controls[0].Op == OpS390XFlagEQ { 16454 c := auxToS390xCCMask(b.Aux) 16455 if !(c&s390x.Equal == 0) { 16456 break 16457 } 16458 b.Reset(BlockFirst) 16459 b.swapSuccessors() 16460 return true 16461 } 16462 // match: (BRC {c} (FlagLT) yes no) 16463 // cond: c&s390x.Less == 0 16464 // result: (First no yes) 16465 for b.Controls[0].Op == OpS390XFlagLT { 16466 c := auxToS390xCCMask(b.Aux) 16467 if !(c&s390x.Less == 0) { 16468 break 16469 } 16470 b.Reset(BlockFirst) 16471 b.swapSuccessors() 16472 return true 16473 } 16474 // match: (BRC {c} (FlagGT) yes no) 16475 // cond: c&s390x.Greater == 0 16476 // result: (First no yes) 16477 for b.Controls[0].Op == OpS390XFlagGT { 16478 c := auxToS390xCCMask(b.Aux) 16479 if !(c&s390x.Greater == 0) { 16480 break 16481 } 16482 b.Reset(BlockFirst) 16483 b.swapSuccessors() 16484 return true 16485 } 16486 // match: (BRC {c} (FlagOV) yes no) 16487 // cond: c&s390x.Unordered == 0 16488 // result: (First no yes) 16489 for b.Controls[0].Op == OpS390XFlagOV { 16490 c := auxToS390xCCMask(b.Aux) 16491 if !(c&s390x.Unordered == 0) { 16492 break 16493 } 16494 b.Reset(BlockFirst) 16495 b.swapSuccessors() 16496 return true 16497 } 16498 case BlockS390XCGIJ: 16499 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 16500 // cond: c&s390x.Equal != 0 && int64(x) == int64(y) 16501 // result: (First yes no) 16502 for b.Controls[0].Op == OpS390XMOVDconst { 16503 v_0 := b.Controls[0] 16504 x := auxIntToInt64(v_0.AuxInt) 16505 y := auxIntToInt8(b.AuxInt) 16506 c := auxToS390xCCMask(b.Aux) 16507 if !(c&s390x.Equal != 0 && int64(x) == int64(y)) { 16508 break 16509 } 16510 b.Reset(BlockFirst) 16511 return true 16512 } 16513 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 16514 // cond: c&s390x.Less != 0 && int64(x) < int64(y) 16515 // result: (First yes no) 16516 for b.Controls[0].Op == OpS390XMOVDconst { 16517 v_0 := b.Controls[0] 16518 x := auxIntToInt64(v_0.AuxInt) 16519 y := auxIntToInt8(b.AuxInt) 16520 c := auxToS390xCCMask(b.Aux) 16521 if !(c&s390x.Less != 0 && int64(x) < int64(y)) { 16522 break 16523 } 16524 b.Reset(BlockFirst) 16525 return true 16526 } 16527 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 16528 // cond: c&s390x.Greater != 0 && int64(x) > int64(y) 16529 // result: (First yes no) 16530 for b.Controls[0].Op == OpS390XMOVDconst { 16531 v_0 := b.Controls[0] 16532 x := auxIntToInt64(v_0.AuxInt) 16533 y := auxIntToInt8(b.AuxInt) 16534 c := auxToS390xCCMask(b.Aux) 16535 if !(c&s390x.Greater != 0 && int64(x) > int64(y)) { 16536 break 16537 } 16538 b.Reset(BlockFirst) 16539 return true 16540 } 16541 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 16542 // cond: c&s390x.Equal == 0 && int64(x) == int64(y) 16543 // result: (First no yes) 16544 for b.Controls[0].Op == OpS390XMOVDconst { 16545 v_0 := b.Controls[0] 16546 x := auxIntToInt64(v_0.AuxInt) 16547 y := auxIntToInt8(b.AuxInt) 16548 c := auxToS390xCCMask(b.Aux) 16549 if !(c&s390x.Equal == 0 && int64(x) == int64(y)) { 16550 break 16551 } 16552 b.Reset(BlockFirst) 16553 b.swapSuccessors() 16554 return true 16555 } 16556 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 16557 // cond: c&s390x.Less == 0 && int64(x) < int64(y) 16558 // result: (First no yes) 16559 for b.Controls[0].Op == OpS390XMOVDconst { 16560 v_0 := b.Controls[0] 16561 x := auxIntToInt64(v_0.AuxInt) 16562 y := auxIntToInt8(b.AuxInt) 16563 c := auxToS390xCCMask(b.Aux) 16564 if !(c&s390x.Less == 0 && int64(x) < int64(y)) { 16565 break 16566 } 16567 b.Reset(BlockFirst) 16568 b.swapSuccessors() 16569 return true 16570 } 16571 // match: (CGIJ {c} (MOVDconst [x]) [y] yes no) 16572 // cond: c&s390x.Greater == 0 && int64(x) > int64(y) 16573 // result: (First no yes) 16574 for b.Controls[0].Op == OpS390XMOVDconst { 16575 v_0 := b.Controls[0] 16576 x := auxIntToInt64(v_0.AuxInt) 16577 y := auxIntToInt8(b.AuxInt) 16578 c := auxToS390xCCMask(b.Aux) 16579 if !(c&s390x.Greater == 0 && int64(x) > int64(y)) { 16580 break 16581 } 16582 b.Reset(BlockFirst) 16583 b.swapSuccessors() 16584 return true 16585 } 16586 // match: (CGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 16587 // result: (BRC {s390x.NoCarry} carry) 16588 for b.Controls[0].Op == OpSelect0 { 16589 v_0 := b.Controls[0] 16590 v_0_0 := v_0.Args[0] 16591 if v_0_0.Op != OpS390XADDE { 16592 break 16593 } 16594 carry := v_0_0.Args[2] 16595 v_0_0_0 := v_0_0.Args[0] 16596 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 16597 break 16598 } 16599 v_0_0_1 := v_0_0.Args[1] 16600 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal { 16601 break 16602 } 16603 b.resetWithControl(BlockS390XBRC, carry) 16604 b.Aux = s390xCCMaskToAux(s390x.NoCarry) 16605 return true 16606 } 16607 // match: (CGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1]) 16608 // result: (BRC {s390x.Carry} carry) 16609 for b.Controls[0].Op == OpSelect0 { 16610 v_0 := b.Controls[0] 16611 v_0_0 := v_0.Args[0] 16612 if v_0_0.Op != OpS390XADDE { 16613 break 16614 } 16615 carry := v_0_0.Args[2] 16616 v_0_0_0 := v_0_0.Args[0] 16617 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 16618 break 16619 } 16620 v_0_0_1 := v_0_0.Args[1] 16621 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal { 16622 break 16623 } 16624 b.resetWithControl(BlockS390XBRC, carry) 16625 b.Aux = s390xCCMaskToAux(s390x.Carry) 16626 return true 16627 } 16628 // match: (CGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 16629 // result: (BRC {s390x.Carry} carry) 16630 for b.Controls[0].Op == OpSelect0 { 16631 v_0 := b.Controls[0] 16632 v_0_0 := v_0.Args[0] 16633 if v_0_0.Op != OpS390XADDE { 16634 break 16635 } 16636 carry := v_0_0.Args[2] 16637 v_0_0_0 := v_0_0.Args[0] 16638 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 16639 break 16640 } 16641 v_0_0_1 := v_0_0.Args[1] 16642 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater { 16643 break 16644 } 16645 b.resetWithControl(BlockS390XBRC, carry) 16646 b.Aux = s390xCCMaskToAux(s390x.Carry) 16647 return true 16648 } 16649 // match: (CGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1]) 16650 // result: (BRC {s390x.NoCarry} carry) 16651 for b.Controls[0].Op == OpSelect0 { 16652 v_0 := b.Controls[0] 16653 v_0_0 := v_0.Args[0] 16654 if v_0_0.Op != OpS390XADDE { 16655 break 16656 } 16657 carry := v_0_0.Args[2] 16658 v_0_0_0 := v_0_0.Args[0] 16659 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 16660 break 16661 } 16662 v_0_0_1 := v_0_0.Args[1] 16663 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater { 16664 break 16665 } 16666 b.resetWithControl(BlockS390XBRC, carry) 16667 b.Aux = s390xCCMaskToAux(s390x.NoCarry) 16668 return true 16669 } 16670 // match: (CGIJ {s390x.Greater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 16671 // result: (BRC {s390x.Carry} carry) 16672 for b.Controls[0].Op == OpSelect0 { 16673 v_0 := b.Controls[0] 16674 v_0_0 := v_0.Args[0] 16675 if v_0_0.Op != OpS390XADDE { 16676 break 16677 } 16678 carry := v_0_0.Args[2] 16679 v_0_0_0 := v_0_0.Args[0] 16680 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 16681 break 16682 } 16683 v_0_0_1 := v_0_0.Args[1] 16684 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToInt8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater { 16685 break 16686 } 16687 b.resetWithControl(BlockS390XBRC, carry) 16688 b.Aux = s390xCCMaskToAux(s390x.Carry) 16689 return true 16690 } 16691 // match: (CGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 16692 // result: (BRC {s390x.NoBorrow} borrow) 16693 for b.Controls[0].Op == OpS390XNEG { 16694 v_0 := b.Controls[0] 16695 v_0_0 := v_0.Args[0] 16696 if v_0_0.Op != OpSelect0 { 16697 break 16698 } 16699 v_0_0_0 := v_0_0.Args[0] 16700 if v_0_0_0.Op != OpS390XSUBE { 16701 break 16702 } 16703 borrow := v_0_0_0.Args[2] 16704 v_0_0_0_0 := v_0_0_0.Args[0] 16705 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16706 break 16707 } 16708 v_0_0_0_1 := v_0_0_0.Args[1] 16709 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 { 16710 break 16711 } 16712 b.resetWithControl(BlockS390XBRC, borrow) 16713 b.Aux = s390xCCMaskToAux(s390x.NoBorrow) 16714 return true 16715 } 16716 // match: (CGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1]) 16717 // result: (BRC {s390x.Borrow} borrow) 16718 for b.Controls[0].Op == OpS390XNEG { 16719 v_0 := b.Controls[0] 16720 v_0_0 := v_0.Args[0] 16721 if v_0_0.Op != OpSelect0 { 16722 break 16723 } 16724 v_0_0_0 := v_0_0.Args[0] 16725 if v_0_0_0.Op != OpS390XSUBE { 16726 break 16727 } 16728 borrow := v_0_0_0.Args[2] 16729 v_0_0_0_0 := v_0_0_0.Args[0] 16730 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16731 break 16732 } 16733 v_0_0_0_1 := v_0_0_0.Args[1] 16734 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 { 16735 break 16736 } 16737 b.resetWithControl(BlockS390XBRC, borrow) 16738 b.Aux = s390xCCMaskToAux(s390x.Borrow) 16739 return true 16740 } 16741 // match: (CGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 16742 // result: (BRC {s390x.Borrow} borrow) 16743 for b.Controls[0].Op == OpS390XNEG { 16744 v_0 := b.Controls[0] 16745 v_0_0 := v_0.Args[0] 16746 if v_0_0.Op != OpSelect0 { 16747 break 16748 } 16749 v_0_0_0 := v_0_0.Args[0] 16750 if v_0_0_0.Op != OpS390XSUBE { 16751 break 16752 } 16753 borrow := v_0_0_0.Args[2] 16754 v_0_0_0_0 := v_0_0_0.Args[0] 16755 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16756 break 16757 } 16758 v_0_0_0_1 := v_0_0_0.Args[1] 16759 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 { 16760 break 16761 } 16762 b.resetWithControl(BlockS390XBRC, borrow) 16763 b.Aux = s390xCCMaskToAux(s390x.Borrow) 16764 return true 16765 } 16766 // match: (CGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1]) 16767 // result: (BRC {s390x.NoBorrow} borrow) 16768 for b.Controls[0].Op == OpS390XNEG { 16769 v_0 := b.Controls[0] 16770 v_0_0 := v_0.Args[0] 16771 if v_0_0.Op != OpSelect0 { 16772 break 16773 } 16774 v_0_0_0 := v_0_0.Args[0] 16775 if v_0_0_0.Op != OpS390XSUBE { 16776 break 16777 } 16778 borrow := v_0_0_0.Args[2] 16779 v_0_0_0_0 := v_0_0_0.Args[0] 16780 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16781 break 16782 } 16783 v_0_0_0_1 := v_0_0_0.Args[1] 16784 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 { 16785 break 16786 } 16787 b.resetWithControl(BlockS390XBRC, borrow) 16788 b.Aux = s390xCCMaskToAux(s390x.NoBorrow) 16789 return true 16790 } 16791 // match: (CGIJ {s390x.Greater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 16792 // result: (BRC {s390x.Borrow} borrow) 16793 for b.Controls[0].Op == OpS390XNEG { 16794 v_0 := b.Controls[0] 16795 v_0_0 := v_0.Args[0] 16796 if v_0_0.Op != OpSelect0 { 16797 break 16798 } 16799 v_0_0_0 := v_0_0.Args[0] 16800 if v_0_0_0.Op != OpS390XSUBE { 16801 break 16802 } 16803 borrow := v_0_0_0.Args[2] 16804 v_0_0_0_0 := v_0_0_0.Args[0] 16805 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 16806 break 16807 } 16808 v_0_0_0_1 := v_0_0_0.Args[1] 16809 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 { 16810 break 16811 } 16812 b.resetWithControl(BlockS390XBRC, borrow) 16813 b.Aux = s390xCCMaskToAux(s390x.Borrow) 16814 return true 16815 } 16816 case BlockS390XCGRJ: 16817 // match: (CGRJ {c} x (MOVDconst [y]) yes no) 16818 // cond: is8Bit(y) 16819 // result: (CGIJ {c} x [ int8(y)] yes no) 16820 for b.Controls[1].Op == OpS390XMOVDconst { 16821 x := b.Controls[0] 16822 v_1 := b.Controls[1] 16823 y := auxIntToInt64(v_1.AuxInt) 16824 c := auxToS390xCCMask(b.Aux) 16825 if !(is8Bit(y)) { 16826 break 16827 } 16828 b.resetWithControl(BlockS390XCGIJ, x) 16829 b.AuxInt = int8ToAuxInt(int8(y)) 16830 b.Aux = s390xCCMaskToAux(c) 16831 return true 16832 } 16833 // match: (CGRJ {c} (MOVDconst [x]) y yes no) 16834 // cond: is8Bit(x) 16835 // result: (CGIJ {c.ReverseComparison()} y [ int8(x)] yes no) 16836 for b.Controls[0].Op == OpS390XMOVDconst { 16837 v_0 := b.Controls[0] 16838 x := auxIntToInt64(v_0.AuxInt) 16839 y := b.Controls[1] 16840 c := auxToS390xCCMask(b.Aux) 16841 if !(is8Bit(x)) { 16842 break 16843 } 16844 b.resetWithControl(BlockS390XCGIJ, y) 16845 b.AuxInt = int8ToAuxInt(int8(x)) 16846 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 16847 return true 16848 } 16849 // match: (CGRJ {c} x (MOVDconst [y]) yes no) 16850 // cond: !is8Bit(y) && is32Bit(y) 16851 // result: (BRC {c} (CMPconst x [int32(y)]) yes no) 16852 for b.Controls[1].Op == OpS390XMOVDconst { 16853 x := b.Controls[0] 16854 v_1 := b.Controls[1] 16855 y := auxIntToInt64(v_1.AuxInt) 16856 c := auxToS390xCCMask(b.Aux) 16857 if !(!is8Bit(y) && is32Bit(y)) { 16858 break 16859 } 16860 v0 := b.NewValue0(x.Pos, OpS390XCMPconst, types.TypeFlags) 16861 v0.AuxInt = int32ToAuxInt(int32(y)) 16862 v0.AddArg(x) 16863 b.resetWithControl(BlockS390XBRC, v0) 16864 b.Aux = s390xCCMaskToAux(c) 16865 return true 16866 } 16867 // match: (CGRJ {c} (MOVDconst [x]) y yes no) 16868 // cond: !is8Bit(x) && is32Bit(x) 16869 // result: (BRC {c.ReverseComparison()} (CMPconst y [int32(x)]) yes no) 16870 for b.Controls[0].Op == OpS390XMOVDconst { 16871 v_0 := b.Controls[0] 16872 x := auxIntToInt64(v_0.AuxInt) 16873 y := b.Controls[1] 16874 c := auxToS390xCCMask(b.Aux) 16875 if !(!is8Bit(x) && is32Bit(x)) { 16876 break 16877 } 16878 v0 := b.NewValue0(v_0.Pos, OpS390XCMPconst, types.TypeFlags) 16879 v0.AuxInt = int32ToAuxInt(int32(x)) 16880 v0.AddArg(y) 16881 b.resetWithControl(BlockS390XBRC, v0) 16882 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 16883 return true 16884 } 16885 // match: (CGRJ {c} x y yes no) 16886 // cond: x == y && c&s390x.Equal != 0 16887 // result: (First yes no) 16888 for { 16889 x := b.Controls[0] 16890 y := b.Controls[1] 16891 c := auxToS390xCCMask(b.Aux) 16892 if !(x == y && c&s390x.Equal != 0) { 16893 break 16894 } 16895 b.Reset(BlockFirst) 16896 return true 16897 } 16898 // match: (CGRJ {c} x y yes no) 16899 // cond: x == y && c&s390x.Equal == 0 16900 // result: (First no yes) 16901 for { 16902 x := b.Controls[0] 16903 y := b.Controls[1] 16904 c := auxToS390xCCMask(b.Aux) 16905 if !(x == y && c&s390x.Equal == 0) { 16906 break 16907 } 16908 b.Reset(BlockFirst) 16909 b.swapSuccessors() 16910 return true 16911 } 16912 case BlockS390XCIJ: 16913 // match: (CIJ {c} (MOVWreg x) [y] yes no) 16914 // result: (CIJ {c} x [y] yes no) 16915 for b.Controls[0].Op == OpS390XMOVWreg { 16916 v_0 := b.Controls[0] 16917 x := v_0.Args[0] 16918 y := auxIntToInt8(b.AuxInt) 16919 c := auxToS390xCCMask(b.Aux) 16920 b.resetWithControl(BlockS390XCIJ, x) 16921 b.AuxInt = int8ToAuxInt(y) 16922 b.Aux = s390xCCMaskToAux(c) 16923 return true 16924 } 16925 // match: (CIJ {c} (MOVWZreg x) [y] yes no) 16926 // result: (CIJ {c} x [y] yes no) 16927 for b.Controls[0].Op == OpS390XMOVWZreg { 16928 v_0 := b.Controls[0] 16929 x := v_0.Args[0] 16930 y := auxIntToInt8(b.AuxInt) 16931 c := auxToS390xCCMask(b.Aux) 16932 b.resetWithControl(BlockS390XCIJ, x) 16933 b.AuxInt = int8ToAuxInt(y) 16934 b.Aux = s390xCCMaskToAux(c) 16935 return true 16936 } 16937 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 16938 // cond: c&s390x.Equal != 0 && int32(x) == int32(y) 16939 // result: (First yes no) 16940 for b.Controls[0].Op == OpS390XMOVDconst { 16941 v_0 := b.Controls[0] 16942 x := auxIntToInt64(v_0.AuxInt) 16943 y := auxIntToInt8(b.AuxInt) 16944 c := auxToS390xCCMask(b.Aux) 16945 if !(c&s390x.Equal != 0 && int32(x) == int32(y)) { 16946 break 16947 } 16948 b.Reset(BlockFirst) 16949 return true 16950 } 16951 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 16952 // cond: c&s390x.Less != 0 && int32(x) < int32(y) 16953 // result: (First yes no) 16954 for b.Controls[0].Op == OpS390XMOVDconst { 16955 v_0 := b.Controls[0] 16956 x := auxIntToInt64(v_0.AuxInt) 16957 y := auxIntToInt8(b.AuxInt) 16958 c := auxToS390xCCMask(b.Aux) 16959 if !(c&s390x.Less != 0 && int32(x) < int32(y)) { 16960 break 16961 } 16962 b.Reset(BlockFirst) 16963 return true 16964 } 16965 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 16966 // cond: c&s390x.Greater != 0 && int32(x) > int32(y) 16967 // result: (First yes no) 16968 for b.Controls[0].Op == OpS390XMOVDconst { 16969 v_0 := b.Controls[0] 16970 x := auxIntToInt64(v_0.AuxInt) 16971 y := auxIntToInt8(b.AuxInt) 16972 c := auxToS390xCCMask(b.Aux) 16973 if !(c&s390x.Greater != 0 && int32(x) > int32(y)) { 16974 break 16975 } 16976 b.Reset(BlockFirst) 16977 return true 16978 } 16979 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 16980 // cond: c&s390x.Equal == 0 && int32(x) == int32(y) 16981 // result: (First no yes) 16982 for b.Controls[0].Op == OpS390XMOVDconst { 16983 v_0 := b.Controls[0] 16984 x := auxIntToInt64(v_0.AuxInt) 16985 y := auxIntToInt8(b.AuxInt) 16986 c := auxToS390xCCMask(b.Aux) 16987 if !(c&s390x.Equal == 0 && int32(x) == int32(y)) { 16988 break 16989 } 16990 b.Reset(BlockFirst) 16991 b.swapSuccessors() 16992 return true 16993 } 16994 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 16995 // cond: c&s390x.Less == 0 && int32(x) < int32(y) 16996 // result: (First no yes) 16997 for b.Controls[0].Op == OpS390XMOVDconst { 16998 v_0 := b.Controls[0] 16999 x := auxIntToInt64(v_0.AuxInt) 17000 y := auxIntToInt8(b.AuxInt) 17001 c := auxToS390xCCMask(b.Aux) 17002 if !(c&s390x.Less == 0 && int32(x) < int32(y)) { 17003 break 17004 } 17005 b.Reset(BlockFirst) 17006 b.swapSuccessors() 17007 return true 17008 } 17009 // match: (CIJ {c} (MOVDconst [x]) [y] yes no) 17010 // cond: c&s390x.Greater == 0 && int32(x) > int32(y) 17011 // result: (First no yes) 17012 for b.Controls[0].Op == OpS390XMOVDconst { 17013 v_0 := b.Controls[0] 17014 x := auxIntToInt64(v_0.AuxInt) 17015 y := auxIntToInt8(b.AuxInt) 17016 c := auxToS390xCCMask(b.Aux) 17017 if !(c&s390x.Greater == 0 && int32(x) > int32(y)) { 17018 break 17019 } 17020 b.Reset(BlockFirst) 17021 b.swapSuccessors() 17022 return true 17023 } 17024 case BlockS390XCLGIJ: 17025 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 17026 // cond: c&s390x.Equal != 0 && uint64(x) == uint64(y) 17027 // result: (First yes no) 17028 for b.Controls[0].Op == OpS390XMOVDconst { 17029 v_0 := b.Controls[0] 17030 x := auxIntToInt64(v_0.AuxInt) 17031 y := auxIntToUint8(b.AuxInt) 17032 c := auxToS390xCCMask(b.Aux) 17033 if !(c&s390x.Equal != 0 && uint64(x) == uint64(y)) { 17034 break 17035 } 17036 b.Reset(BlockFirst) 17037 return true 17038 } 17039 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 17040 // cond: c&s390x.Less != 0 && uint64(x) < uint64(y) 17041 // result: (First yes no) 17042 for b.Controls[0].Op == OpS390XMOVDconst { 17043 v_0 := b.Controls[0] 17044 x := auxIntToInt64(v_0.AuxInt) 17045 y := auxIntToUint8(b.AuxInt) 17046 c := auxToS390xCCMask(b.Aux) 17047 if !(c&s390x.Less != 0 && uint64(x) < uint64(y)) { 17048 break 17049 } 17050 b.Reset(BlockFirst) 17051 return true 17052 } 17053 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 17054 // cond: c&s390x.Greater != 0 && uint64(x) > uint64(y) 17055 // result: (First yes no) 17056 for b.Controls[0].Op == OpS390XMOVDconst { 17057 v_0 := b.Controls[0] 17058 x := auxIntToInt64(v_0.AuxInt) 17059 y := auxIntToUint8(b.AuxInt) 17060 c := auxToS390xCCMask(b.Aux) 17061 if !(c&s390x.Greater != 0 && uint64(x) > uint64(y)) { 17062 break 17063 } 17064 b.Reset(BlockFirst) 17065 return true 17066 } 17067 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 17068 // cond: c&s390x.Equal == 0 && uint64(x) == uint64(y) 17069 // result: (First no yes) 17070 for b.Controls[0].Op == OpS390XMOVDconst { 17071 v_0 := b.Controls[0] 17072 x := auxIntToInt64(v_0.AuxInt) 17073 y := auxIntToUint8(b.AuxInt) 17074 c := auxToS390xCCMask(b.Aux) 17075 if !(c&s390x.Equal == 0 && uint64(x) == uint64(y)) { 17076 break 17077 } 17078 b.Reset(BlockFirst) 17079 b.swapSuccessors() 17080 return true 17081 } 17082 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 17083 // cond: c&s390x.Less == 0 && uint64(x) < uint64(y) 17084 // result: (First no yes) 17085 for b.Controls[0].Op == OpS390XMOVDconst { 17086 v_0 := b.Controls[0] 17087 x := auxIntToInt64(v_0.AuxInt) 17088 y := auxIntToUint8(b.AuxInt) 17089 c := auxToS390xCCMask(b.Aux) 17090 if !(c&s390x.Less == 0 && uint64(x) < uint64(y)) { 17091 break 17092 } 17093 b.Reset(BlockFirst) 17094 b.swapSuccessors() 17095 return true 17096 } 17097 // match: (CLGIJ {c} (MOVDconst [x]) [y] yes no) 17098 // cond: c&s390x.Greater == 0 && uint64(x) > uint64(y) 17099 // result: (First no yes) 17100 for b.Controls[0].Op == OpS390XMOVDconst { 17101 v_0 := b.Controls[0] 17102 x := auxIntToInt64(v_0.AuxInt) 17103 y := auxIntToUint8(b.AuxInt) 17104 c := auxToS390xCCMask(b.Aux) 17105 if !(c&s390x.Greater == 0 && uint64(x) > uint64(y)) { 17106 break 17107 } 17108 b.Reset(BlockFirst) 17109 b.swapSuccessors() 17110 return true 17111 } 17112 // match: (CLGIJ {s390x.GreaterOrEqual} _ [0] yes no) 17113 // result: (First yes no) 17114 for { 17115 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 17116 break 17117 } 17118 b.Reset(BlockFirst) 17119 return true 17120 } 17121 // match: (CLGIJ {s390x.Less} _ [0] yes no) 17122 // result: (First no yes) 17123 for { 17124 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Less { 17125 break 17126 } 17127 b.Reset(BlockFirst) 17128 b.swapSuccessors() 17129 return true 17130 } 17131 // match: (CLGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 17132 // result: (BRC {s390x.NoCarry} carry) 17133 for b.Controls[0].Op == OpSelect0 { 17134 v_0 := b.Controls[0] 17135 v_0_0 := v_0.Args[0] 17136 if v_0_0.Op != OpS390XADDE { 17137 break 17138 } 17139 carry := v_0_0.Args[2] 17140 v_0_0_0 := v_0_0.Args[0] 17141 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 17142 break 17143 } 17144 v_0_0_1 := v_0_0.Args[1] 17145 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Equal { 17146 break 17147 } 17148 b.resetWithControl(BlockS390XBRC, carry) 17149 b.Aux = s390xCCMaskToAux(s390x.NoCarry) 17150 return true 17151 } 17152 // match: (CLGIJ {s390x.Equal} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1]) 17153 // result: (BRC {s390x.Carry} carry) 17154 for b.Controls[0].Op == OpSelect0 { 17155 v_0 := b.Controls[0] 17156 v_0_0 := v_0.Args[0] 17157 if v_0_0.Op != OpS390XADDE { 17158 break 17159 } 17160 carry := v_0_0.Args[2] 17161 v_0_0_0 := v_0_0.Args[0] 17162 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 17163 break 17164 } 17165 v_0_0_1 := v_0_0.Args[1] 17166 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.Equal { 17167 break 17168 } 17169 b.resetWithControl(BlockS390XBRC, carry) 17170 b.Aux = s390xCCMaskToAux(s390x.Carry) 17171 return true 17172 } 17173 // match: (CLGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 17174 // result: (BRC {s390x.Carry} carry) 17175 for b.Controls[0].Op == OpSelect0 { 17176 v_0 := b.Controls[0] 17177 v_0_0 := v_0.Args[0] 17178 if v_0_0.Op != OpS390XADDE { 17179 break 17180 } 17181 carry := v_0_0.Args[2] 17182 v_0_0_0 := v_0_0.Args[0] 17183 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 17184 break 17185 } 17186 v_0_0_1 := v_0_0.Args[1] 17187 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater { 17188 break 17189 } 17190 b.resetWithControl(BlockS390XBRC, carry) 17191 b.Aux = s390xCCMaskToAux(s390x.Carry) 17192 return true 17193 } 17194 // match: (CLGIJ {s390x.LessOrGreater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [1]) 17195 // result: (BRC {s390x.NoCarry} carry) 17196 for b.Controls[0].Op == OpSelect0 { 17197 v_0 := b.Controls[0] 17198 v_0_0 := v_0.Args[0] 17199 if v_0_0.Op != OpS390XADDE { 17200 break 17201 } 17202 carry := v_0_0.Args[2] 17203 v_0_0_0 := v_0_0.Args[0] 17204 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 17205 break 17206 } 17207 v_0_0_1 := v_0_0.Args[1] 17208 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 1 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater { 17209 break 17210 } 17211 b.resetWithControl(BlockS390XBRC, carry) 17212 b.Aux = s390xCCMaskToAux(s390x.NoCarry) 17213 return true 17214 } 17215 // match: (CLGIJ {s390x.Greater} (Select0 (ADDE (MOVDconst [0]) (MOVDconst [0]) carry)) [0]) 17216 // result: (BRC {s390x.Carry} carry) 17217 for b.Controls[0].Op == OpSelect0 { 17218 v_0 := b.Controls[0] 17219 v_0_0 := v_0.Args[0] 17220 if v_0_0.Op != OpS390XADDE { 17221 break 17222 } 17223 carry := v_0_0.Args[2] 17224 v_0_0_0 := v_0_0.Args[0] 17225 if v_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0.AuxInt) != 0 { 17226 break 17227 } 17228 v_0_0_1 := v_0_0.Args[1] 17229 if v_0_0_1.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_1.AuxInt) != 0 || auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Greater { 17230 break 17231 } 17232 b.resetWithControl(BlockS390XBRC, carry) 17233 b.Aux = s390xCCMaskToAux(s390x.Carry) 17234 return true 17235 } 17236 // match: (CLGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 17237 // result: (BRC {s390x.NoBorrow} borrow) 17238 for b.Controls[0].Op == OpS390XNEG { 17239 v_0 := b.Controls[0] 17240 v_0_0 := v_0.Args[0] 17241 if v_0_0.Op != OpSelect0 { 17242 break 17243 } 17244 v_0_0_0 := v_0_0.Args[0] 17245 if v_0_0_0.Op != OpS390XSUBE { 17246 break 17247 } 17248 borrow := v_0_0_0.Args[2] 17249 v_0_0_0_0 := v_0_0_0.Args[0] 17250 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 17251 break 17252 } 17253 v_0_0_0_1 := v_0_0_0.Args[1] 17254 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 { 17255 break 17256 } 17257 b.resetWithControl(BlockS390XBRC, borrow) 17258 b.Aux = s390xCCMaskToAux(s390x.NoBorrow) 17259 return true 17260 } 17261 // match: (CLGIJ {s390x.Equal} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1]) 17262 // result: (BRC {s390x.Borrow} borrow) 17263 for b.Controls[0].Op == OpS390XNEG { 17264 v_0 := b.Controls[0] 17265 v_0_0 := v_0.Args[0] 17266 if v_0_0.Op != OpSelect0 { 17267 break 17268 } 17269 v_0_0_0 := v_0_0.Args[0] 17270 if v_0_0_0.Op != OpS390XSUBE { 17271 break 17272 } 17273 borrow := v_0_0_0.Args[2] 17274 v_0_0_0_0 := v_0_0_0.Args[0] 17275 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 17276 break 17277 } 17278 v_0_0_0_1 := v_0_0_0.Args[1] 17279 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 { 17280 break 17281 } 17282 b.resetWithControl(BlockS390XBRC, borrow) 17283 b.Aux = s390xCCMaskToAux(s390x.Borrow) 17284 return true 17285 } 17286 // match: (CLGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 17287 // result: (BRC {s390x.Borrow} borrow) 17288 for b.Controls[0].Op == OpS390XNEG { 17289 v_0 := b.Controls[0] 17290 v_0_0 := v_0.Args[0] 17291 if v_0_0.Op != OpSelect0 { 17292 break 17293 } 17294 v_0_0_0 := v_0_0.Args[0] 17295 if v_0_0_0.Op != OpS390XSUBE { 17296 break 17297 } 17298 borrow := v_0_0_0.Args[2] 17299 v_0_0_0_0 := v_0_0_0.Args[0] 17300 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 17301 break 17302 } 17303 v_0_0_0_1 := v_0_0_0.Args[1] 17304 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 { 17305 break 17306 } 17307 b.resetWithControl(BlockS390XBRC, borrow) 17308 b.Aux = s390xCCMaskToAux(s390x.Borrow) 17309 return true 17310 } 17311 // match: (CLGIJ {s390x.LessOrGreater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [1]) 17312 // result: (BRC {s390x.NoBorrow} borrow) 17313 for b.Controls[0].Op == OpS390XNEG { 17314 v_0 := b.Controls[0] 17315 v_0_0 := v_0.Args[0] 17316 if v_0_0.Op != OpSelect0 { 17317 break 17318 } 17319 v_0_0_0 := v_0_0.Args[0] 17320 if v_0_0_0.Op != OpS390XSUBE { 17321 break 17322 } 17323 borrow := v_0_0_0.Args[2] 17324 v_0_0_0_0 := v_0_0_0.Args[0] 17325 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 17326 break 17327 } 17328 v_0_0_0_1 := v_0_0_0.Args[1] 17329 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 { 17330 break 17331 } 17332 b.resetWithControl(BlockS390XBRC, borrow) 17333 b.Aux = s390xCCMaskToAux(s390x.NoBorrow) 17334 return true 17335 } 17336 // match: (CLGIJ {s390x.Greater} (NEG (Select0 (SUBE (MOVDconst [0]) (MOVDconst [0]) borrow))) [0]) 17337 // result: (BRC {s390x.Borrow} borrow) 17338 for b.Controls[0].Op == OpS390XNEG { 17339 v_0 := b.Controls[0] 17340 v_0_0 := v_0.Args[0] 17341 if v_0_0.Op != OpSelect0 { 17342 break 17343 } 17344 v_0_0_0 := v_0_0.Args[0] 17345 if v_0_0_0.Op != OpS390XSUBE { 17346 break 17347 } 17348 borrow := v_0_0_0.Args[2] 17349 v_0_0_0_0 := v_0_0_0.Args[0] 17350 if v_0_0_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0_0_0.AuxInt) != 0 { 17351 break 17352 } 17353 v_0_0_0_1 := v_0_0_0.Args[1] 17354 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 { 17355 break 17356 } 17357 b.resetWithControl(BlockS390XBRC, borrow) 17358 b.Aux = s390xCCMaskToAux(s390x.Borrow) 17359 return true 17360 } 17361 case BlockS390XCLGRJ: 17362 // match: (CLGRJ {c} x (MOVDconst [y]) yes no) 17363 // cond: isU8Bit(y) 17364 // result: (CLGIJ {c} x [uint8(y)] yes no) 17365 for b.Controls[1].Op == OpS390XMOVDconst { 17366 x := b.Controls[0] 17367 v_1 := b.Controls[1] 17368 y := auxIntToInt64(v_1.AuxInt) 17369 c := auxToS390xCCMask(b.Aux) 17370 if !(isU8Bit(y)) { 17371 break 17372 } 17373 b.resetWithControl(BlockS390XCLGIJ, x) 17374 b.AuxInt = uint8ToAuxInt(uint8(y)) 17375 b.Aux = s390xCCMaskToAux(c) 17376 return true 17377 } 17378 // match: (CLGRJ {c} (MOVDconst [x]) y yes no) 17379 // cond: isU8Bit(x) 17380 // result: (CLGIJ {c.ReverseComparison()} y [uint8(x)] yes no) 17381 for b.Controls[0].Op == OpS390XMOVDconst { 17382 v_0 := b.Controls[0] 17383 x := auxIntToInt64(v_0.AuxInt) 17384 y := b.Controls[1] 17385 c := auxToS390xCCMask(b.Aux) 17386 if !(isU8Bit(x)) { 17387 break 17388 } 17389 b.resetWithControl(BlockS390XCLGIJ, y) 17390 b.AuxInt = uint8ToAuxInt(uint8(x)) 17391 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 17392 return true 17393 } 17394 // match: (CLGRJ {c} x (MOVDconst [y]) yes no) 17395 // cond: !isU8Bit(y) && isU32Bit(y) 17396 // result: (BRC {c} (CMPUconst x [int32(y)]) yes no) 17397 for b.Controls[1].Op == OpS390XMOVDconst { 17398 x := b.Controls[0] 17399 v_1 := b.Controls[1] 17400 y := auxIntToInt64(v_1.AuxInt) 17401 c := auxToS390xCCMask(b.Aux) 17402 if !(!isU8Bit(y) && isU32Bit(y)) { 17403 break 17404 } 17405 v0 := b.NewValue0(x.Pos, OpS390XCMPUconst, types.TypeFlags) 17406 v0.AuxInt = int32ToAuxInt(int32(y)) 17407 v0.AddArg(x) 17408 b.resetWithControl(BlockS390XBRC, v0) 17409 b.Aux = s390xCCMaskToAux(c) 17410 return true 17411 } 17412 // match: (CLGRJ {c} (MOVDconst [x]) y yes no) 17413 // cond: !isU8Bit(x) && isU32Bit(x) 17414 // result: (BRC {c.ReverseComparison()} (CMPUconst y [int32(x)]) yes no) 17415 for b.Controls[0].Op == OpS390XMOVDconst { 17416 v_0 := b.Controls[0] 17417 x := auxIntToInt64(v_0.AuxInt) 17418 y := b.Controls[1] 17419 c := auxToS390xCCMask(b.Aux) 17420 if !(!isU8Bit(x) && isU32Bit(x)) { 17421 break 17422 } 17423 v0 := b.NewValue0(v_0.Pos, OpS390XCMPUconst, types.TypeFlags) 17424 v0.AuxInt = int32ToAuxInt(int32(x)) 17425 v0.AddArg(y) 17426 b.resetWithControl(BlockS390XBRC, v0) 17427 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 17428 return true 17429 } 17430 // match: (CLGRJ {c} x y yes no) 17431 // cond: x == y && c&s390x.Equal != 0 17432 // result: (First yes no) 17433 for { 17434 x := b.Controls[0] 17435 y := b.Controls[1] 17436 c := auxToS390xCCMask(b.Aux) 17437 if !(x == y && c&s390x.Equal != 0) { 17438 break 17439 } 17440 b.Reset(BlockFirst) 17441 return true 17442 } 17443 // match: (CLGRJ {c} x y yes no) 17444 // cond: x == y && c&s390x.Equal == 0 17445 // result: (First no yes) 17446 for { 17447 x := b.Controls[0] 17448 y := b.Controls[1] 17449 c := auxToS390xCCMask(b.Aux) 17450 if !(x == y && c&s390x.Equal == 0) { 17451 break 17452 } 17453 b.Reset(BlockFirst) 17454 b.swapSuccessors() 17455 return true 17456 } 17457 case BlockS390XCLIJ: 17458 // match: (CLIJ {s390x.LessOrGreater} (LOCGR {d} (MOVDconst [0]) (MOVDconst [x]) cmp) [0] yes no) 17459 // cond: int32(x) != 0 17460 // result: (BRC {d} cmp yes no) 17461 for b.Controls[0].Op == OpS390XLOCGR { 17462 v_0 := b.Controls[0] 17463 d := auxToS390xCCMask(v_0.Aux) 17464 cmp := v_0.Args[2] 17465 v_0_0 := v_0.Args[0] 17466 if v_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0.AuxInt) != 0 { 17467 break 17468 } 17469 v_0_1 := v_0.Args[1] 17470 if v_0_1.Op != OpS390XMOVDconst { 17471 break 17472 } 17473 x := auxIntToInt64(v_0_1.AuxInt) 17474 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.LessOrGreater || !(int32(x) != 0) { 17475 break 17476 } 17477 b.resetWithControl(BlockS390XBRC, cmp) 17478 b.Aux = s390xCCMaskToAux(d) 17479 return true 17480 } 17481 // match: (CLIJ {c} (MOVWreg x) [y] yes no) 17482 // result: (CLIJ {c} x [y] yes no) 17483 for b.Controls[0].Op == OpS390XMOVWreg { 17484 v_0 := b.Controls[0] 17485 x := v_0.Args[0] 17486 y := auxIntToUint8(b.AuxInt) 17487 c := auxToS390xCCMask(b.Aux) 17488 b.resetWithControl(BlockS390XCLIJ, x) 17489 b.AuxInt = uint8ToAuxInt(y) 17490 b.Aux = s390xCCMaskToAux(c) 17491 return true 17492 } 17493 // match: (CLIJ {c} (MOVWZreg x) [y] yes no) 17494 // result: (CLIJ {c} x [y] yes no) 17495 for b.Controls[0].Op == OpS390XMOVWZreg { 17496 v_0 := b.Controls[0] 17497 x := v_0.Args[0] 17498 y := auxIntToUint8(b.AuxInt) 17499 c := auxToS390xCCMask(b.Aux) 17500 b.resetWithControl(BlockS390XCLIJ, x) 17501 b.AuxInt = uint8ToAuxInt(y) 17502 b.Aux = s390xCCMaskToAux(c) 17503 return true 17504 } 17505 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 17506 // cond: c&s390x.Equal != 0 && uint32(x) == uint32(y) 17507 // result: (First yes no) 17508 for b.Controls[0].Op == OpS390XMOVDconst { 17509 v_0 := b.Controls[0] 17510 x := auxIntToInt64(v_0.AuxInt) 17511 y := auxIntToUint8(b.AuxInt) 17512 c := auxToS390xCCMask(b.Aux) 17513 if !(c&s390x.Equal != 0 && uint32(x) == uint32(y)) { 17514 break 17515 } 17516 b.Reset(BlockFirst) 17517 return true 17518 } 17519 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 17520 // cond: c&s390x.Less != 0 && uint32(x) < uint32(y) 17521 // result: (First yes no) 17522 for b.Controls[0].Op == OpS390XMOVDconst { 17523 v_0 := b.Controls[0] 17524 x := auxIntToInt64(v_0.AuxInt) 17525 y := auxIntToUint8(b.AuxInt) 17526 c := auxToS390xCCMask(b.Aux) 17527 if !(c&s390x.Less != 0 && uint32(x) < uint32(y)) { 17528 break 17529 } 17530 b.Reset(BlockFirst) 17531 return true 17532 } 17533 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 17534 // cond: c&s390x.Greater != 0 && uint32(x) > uint32(y) 17535 // result: (First yes no) 17536 for b.Controls[0].Op == OpS390XMOVDconst { 17537 v_0 := b.Controls[0] 17538 x := auxIntToInt64(v_0.AuxInt) 17539 y := auxIntToUint8(b.AuxInt) 17540 c := auxToS390xCCMask(b.Aux) 17541 if !(c&s390x.Greater != 0 && uint32(x) > uint32(y)) { 17542 break 17543 } 17544 b.Reset(BlockFirst) 17545 return true 17546 } 17547 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 17548 // cond: c&s390x.Equal == 0 && uint32(x) == uint32(y) 17549 // result: (First no yes) 17550 for b.Controls[0].Op == OpS390XMOVDconst { 17551 v_0 := b.Controls[0] 17552 x := auxIntToInt64(v_0.AuxInt) 17553 y := auxIntToUint8(b.AuxInt) 17554 c := auxToS390xCCMask(b.Aux) 17555 if !(c&s390x.Equal == 0 && uint32(x) == uint32(y)) { 17556 break 17557 } 17558 b.Reset(BlockFirst) 17559 b.swapSuccessors() 17560 return true 17561 } 17562 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 17563 // cond: c&s390x.Less == 0 && uint32(x) < uint32(y) 17564 // result: (First no yes) 17565 for b.Controls[0].Op == OpS390XMOVDconst { 17566 v_0 := b.Controls[0] 17567 x := auxIntToInt64(v_0.AuxInt) 17568 y := auxIntToUint8(b.AuxInt) 17569 c := auxToS390xCCMask(b.Aux) 17570 if !(c&s390x.Less == 0 && uint32(x) < uint32(y)) { 17571 break 17572 } 17573 b.Reset(BlockFirst) 17574 b.swapSuccessors() 17575 return true 17576 } 17577 // match: (CLIJ {c} (MOVDconst [x]) [y] yes no) 17578 // cond: c&s390x.Greater == 0 && uint32(x) > uint32(y) 17579 // result: (First no yes) 17580 for b.Controls[0].Op == OpS390XMOVDconst { 17581 v_0 := b.Controls[0] 17582 x := auxIntToInt64(v_0.AuxInt) 17583 y := auxIntToUint8(b.AuxInt) 17584 c := auxToS390xCCMask(b.Aux) 17585 if !(c&s390x.Greater == 0 && uint32(x) > uint32(y)) { 17586 break 17587 } 17588 b.Reset(BlockFirst) 17589 b.swapSuccessors() 17590 return true 17591 } 17592 // match: (CLIJ {s390x.GreaterOrEqual} _ [0] yes no) 17593 // result: (First yes no) 17594 for { 17595 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.GreaterOrEqual { 17596 break 17597 } 17598 b.Reset(BlockFirst) 17599 return true 17600 } 17601 // match: (CLIJ {s390x.Less} _ [0] yes no) 17602 // result: (First no yes) 17603 for { 17604 if auxIntToUint8(b.AuxInt) != 0 || auxToS390xCCMask(b.Aux) != s390x.Less { 17605 break 17606 } 17607 b.Reset(BlockFirst) 17608 b.swapSuccessors() 17609 return true 17610 } 17611 case BlockS390XCLRJ: 17612 // match: (CLRJ {c} x (MOVDconst [y]) yes no) 17613 // cond: isU8Bit(y) 17614 // result: (CLIJ {c} x [uint8(y)] yes no) 17615 for b.Controls[1].Op == OpS390XMOVDconst { 17616 x := b.Controls[0] 17617 v_1 := b.Controls[1] 17618 y := auxIntToInt64(v_1.AuxInt) 17619 c := auxToS390xCCMask(b.Aux) 17620 if !(isU8Bit(y)) { 17621 break 17622 } 17623 b.resetWithControl(BlockS390XCLIJ, x) 17624 b.AuxInt = uint8ToAuxInt(uint8(y)) 17625 b.Aux = s390xCCMaskToAux(c) 17626 return true 17627 } 17628 // match: (CLRJ {c} (MOVDconst [x]) y yes no) 17629 // cond: isU8Bit(x) 17630 // result: (CLIJ {c.ReverseComparison()} y [uint8(x)] yes no) 17631 for b.Controls[0].Op == OpS390XMOVDconst { 17632 v_0 := b.Controls[0] 17633 x := auxIntToInt64(v_0.AuxInt) 17634 y := b.Controls[1] 17635 c := auxToS390xCCMask(b.Aux) 17636 if !(isU8Bit(x)) { 17637 break 17638 } 17639 b.resetWithControl(BlockS390XCLIJ, y) 17640 b.AuxInt = uint8ToAuxInt(uint8(x)) 17641 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 17642 return true 17643 } 17644 // match: (CLRJ {c} x (MOVDconst [y]) yes no) 17645 // cond: !isU8Bit(y) && isU32Bit(y) 17646 // result: (BRC {c} (CMPWUconst x [int32(y)]) yes no) 17647 for b.Controls[1].Op == OpS390XMOVDconst { 17648 x := b.Controls[0] 17649 v_1 := b.Controls[1] 17650 y := auxIntToInt64(v_1.AuxInt) 17651 c := auxToS390xCCMask(b.Aux) 17652 if !(!isU8Bit(y) && isU32Bit(y)) { 17653 break 17654 } 17655 v0 := b.NewValue0(x.Pos, OpS390XCMPWUconst, types.TypeFlags) 17656 v0.AuxInt = int32ToAuxInt(int32(y)) 17657 v0.AddArg(x) 17658 b.resetWithControl(BlockS390XBRC, v0) 17659 b.Aux = s390xCCMaskToAux(c) 17660 return true 17661 } 17662 // match: (CLRJ {c} (MOVDconst [x]) y yes no) 17663 // cond: !isU8Bit(x) && isU32Bit(x) 17664 // result: (BRC {c.ReverseComparison()} (CMPWUconst y [int32(x)]) yes no) 17665 for b.Controls[0].Op == OpS390XMOVDconst { 17666 v_0 := b.Controls[0] 17667 x := auxIntToInt64(v_0.AuxInt) 17668 y := b.Controls[1] 17669 c := auxToS390xCCMask(b.Aux) 17670 if !(!isU8Bit(x) && isU32Bit(x)) { 17671 break 17672 } 17673 v0 := b.NewValue0(v_0.Pos, OpS390XCMPWUconst, types.TypeFlags) 17674 v0.AuxInt = int32ToAuxInt(int32(x)) 17675 v0.AddArg(y) 17676 b.resetWithControl(BlockS390XBRC, v0) 17677 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 17678 return true 17679 } 17680 // match: (CLRJ {c} x y yes no) 17681 // cond: x == y && c&s390x.Equal != 0 17682 // result: (First yes no) 17683 for { 17684 x := b.Controls[0] 17685 y := b.Controls[1] 17686 c := auxToS390xCCMask(b.Aux) 17687 if !(x == y && c&s390x.Equal != 0) { 17688 break 17689 } 17690 b.Reset(BlockFirst) 17691 return true 17692 } 17693 // match: (CLRJ {c} x y yes no) 17694 // cond: x == y && c&s390x.Equal == 0 17695 // result: (First no yes) 17696 for { 17697 x := b.Controls[0] 17698 y := b.Controls[1] 17699 c := auxToS390xCCMask(b.Aux) 17700 if !(x == y && c&s390x.Equal == 0) { 17701 break 17702 } 17703 b.Reset(BlockFirst) 17704 b.swapSuccessors() 17705 return true 17706 } 17707 case BlockS390XCRJ: 17708 // match: (CRJ {c} x (MOVDconst [y]) yes no) 17709 // cond: is8Bit(y) 17710 // result: (CIJ {c} x [ int8(y)] yes no) 17711 for b.Controls[1].Op == OpS390XMOVDconst { 17712 x := b.Controls[0] 17713 v_1 := b.Controls[1] 17714 y := auxIntToInt64(v_1.AuxInt) 17715 c := auxToS390xCCMask(b.Aux) 17716 if !(is8Bit(y)) { 17717 break 17718 } 17719 b.resetWithControl(BlockS390XCIJ, x) 17720 b.AuxInt = int8ToAuxInt(int8(y)) 17721 b.Aux = s390xCCMaskToAux(c) 17722 return true 17723 } 17724 // match: (CRJ {c} (MOVDconst [x]) y yes no) 17725 // cond: is8Bit(x) 17726 // result: (CIJ {c.ReverseComparison()} y [ int8(x)] yes no) 17727 for b.Controls[0].Op == OpS390XMOVDconst { 17728 v_0 := b.Controls[0] 17729 x := auxIntToInt64(v_0.AuxInt) 17730 y := b.Controls[1] 17731 c := auxToS390xCCMask(b.Aux) 17732 if !(is8Bit(x)) { 17733 break 17734 } 17735 b.resetWithControl(BlockS390XCIJ, y) 17736 b.AuxInt = int8ToAuxInt(int8(x)) 17737 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 17738 return true 17739 } 17740 // match: (CRJ {c} x (MOVDconst [y]) yes no) 17741 // cond: !is8Bit(y) && is32Bit(y) 17742 // result: (BRC {c} (CMPWconst x [int32(y)]) yes no) 17743 for b.Controls[1].Op == OpS390XMOVDconst { 17744 x := b.Controls[0] 17745 v_1 := b.Controls[1] 17746 y := auxIntToInt64(v_1.AuxInt) 17747 c := auxToS390xCCMask(b.Aux) 17748 if !(!is8Bit(y) && is32Bit(y)) { 17749 break 17750 } 17751 v0 := b.NewValue0(x.Pos, OpS390XCMPWconst, types.TypeFlags) 17752 v0.AuxInt = int32ToAuxInt(int32(y)) 17753 v0.AddArg(x) 17754 b.resetWithControl(BlockS390XBRC, v0) 17755 b.Aux = s390xCCMaskToAux(c) 17756 return true 17757 } 17758 // match: (CRJ {c} (MOVDconst [x]) y yes no) 17759 // cond: !is8Bit(x) && is32Bit(x) 17760 // result: (BRC {c.ReverseComparison()} (CMPWconst y [int32(x)]) yes no) 17761 for b.Controls[0].Op == OpS390XMOVDconst { 17762 v_0 := b.Controls[0] 17763 x := auxIntToInt64(v_0.AuxInt) 17764 y := b.Controls[1] 17765 c := auxToS390xCCMask(b.Aux) 17766 if !(!is8Bit(x) && is32Bit(x)) { 17767 break 17768 } 17769 v0 := b.NewValue0(v_0.Pos, OpS390XCMPWconst, types.TypeFlags) 17770 v0.AuxInt = int32ToAuxInt(int32(x)) 17771 v0.AddArg(y) 17772 b.resetWithControl(BlockS390XBRC, v0) 17773 b.Aux = s390xCCMaskToAux(c.ReverseComparison()) 17774 return true 17775 } 17776 // match: (CRJ {c} x y yes no) 17777 // cond: x == y && c&s390x.Equal != 0 17778 // result: (First yes no) 17779 for { 17780 x := b.Controls[0] 17781 y := b.Controls[1] 17782 c := auxToS390xCCMask(b.Aux) 17783 if !(x == y && c&s390x.Equal != 0) { 17784 break 17785 } 17786 b.Reset(BlockFirst) 17787 return true 17788 } 17789 // match: (CRJ {c} x y yes no) 17790 // cond: x == y && c&s390x.Equal == 0 17791 // result: (First no yes) 17792 for { 17793 x := b.Controls[0] 17794 y := b.Controls[1] 17795 c := auxToS390xCCMask(b.Aux) 17796 if !(x == y && c&s390x.Equal == 0) { 17797 break 17798 } 17799 b.Reset(BlockFirst) 17800 b.swapSuccessors() 17801 return true 17802 } 17803 case BlockIf: 17804 // match: (If cond yes no) 17805 // result: (CLIJ {s390x.LessOrGreater} (MOVBZreg <typ.Bool> cond) [0] yes no) 17806 for { 17807 cond := b.Controls[0] 17808 v0 := b.NewValue0(cond.Pos, OpS390XMOVBZreg, typ.Bool) 17809 v0.AddArg(cond) 17810 b.resetWithControl(BlockS390XCLIJ, v0) 17811 b.AuxInt = uint8ToAuxInt(0) 17812 b.Aux = s390xCCMaskToAux(s390x.LessOrGreater) 17813 return true 17814 } 17815 } 17816 return false 17817 }