github.com/bir3/gocompiler@v0.3.205/src/cmd/compile/internal/ssa/rewrite386.go (about) 1 // Code generated from _gen/386.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 9 func rewriteValue386(v *Value) bool { 10 switch v.Op { 11 case Op386ADCL: 12 return rewriteValue386_Op386ADCL(v) 13 case Op386ADDL: 14 return rewriteValue386_Op386ADDL(v) 15 case Op386ADDLcarry: 16 return rewriteValue386_Op386ADDLcarry(v) 17 case Op386ADDLconst: 18 return rewriteValue386_Op386ADDLconst(v) 19 case Op386ADDLconstmodify: 20 return rewriteValue386_Op386ADDLconstmodify(v) 21 case Op386ADDLload: 22 return rewriteValue386_Op386ADDLload(v) 23 case Op386ADDLmodify: 24 return rewriteValue386_Op386ADDLmodify(v) 25 case Op386ADDSD: 26 return rewriteValue386_Op386ADDSD(v) 27 case Op386ADDSDload: 28 return rewriteValue386_Op386ADDSDload(v) 29 case Op386ADDSS: 30 return rewriteValue386_Op386ADDSS(v) 31 case Op386ADDSSload: 32 return rewriteValue386_Op386ADDSSload(v) 33 case Op386ANDL: 34 return rewriteValue386_Op386ANDL(v) 35 case Op386ANDLconst: 36 return rewriteValue386_Op386ANDLconst(v) 37 case Op386ANDLconstmodify: 38 return rewriteValue386_Op386ANDLconstmodify(v) 39 case Op386ANDLload: 40 return rewriteValue386_Op386ANDLload(v) 41 case Op386ANDLmodify: 42 return rewriteValue386_Op386ANDLmodify(v) 43 case Op386CMPB: 44 return rewriteValue386_Op386CMPB(v) 45 case Op386CMPBconst: 46 return rewriteValue386_Op386CMPBconst(v) 47 case Op386CMPBload: 48 return rewriteValue386_Op386CMPBload(v) 49 case Op386CMPL: 50 return rewriteValue386_Op386CMPL(v) 51 case Op386CMPLconst: 52 return rewriteValue386_Op386CMPLconst(v) 53 case Op386CMPLload: 54 return rewriteValue386_Op386CMPLload(v) 55 case Op386CMPW: 56 return rewriteValue386_Op386CMPW(v) 57 case Op386CMPWconst: 58 return rewriteValue386_Op386CMPWconst(v) 59 case Op386CMPWload: 60 return rewriteValue386_Op386CMPWload(v) 61 case Op386DIVSD: 62 return rewriteValue386_Op386DIVSD(v) 63 case Op386DIVSDload: 64 return rewriteValue386_Op386DIVSDload(v) 65 case Op386DIVSS: 66 return rewriteValue386_Op386DIVSS(v) 67 case Op386DIVSSload: 68 return rewriteValue386_Op386DIVSSload(v) 69 case Op386LEAL: 70 return rewriteValue386_Op386LEAL(v) 71 case Op386LEAL1: 72 return rewriteValue386_Op386LEAL1(v) 73 case Op386LEAL2: 74 return rewriteValue386_Op386LEAL2(v) 75 case Op386LEAL4: 76 return rewriteValue386_Op386LEAL4(v) 77 case Op386LEAL8: 78 return rewriteValue386_Op386LEAL8(v) 79 case Op386MOVBLSX: 80 return rewriteValue386_Op386MOVBLSX(v) 81 case Op386MOVBLSXload: 82 return rewriteValue386_Op386MOVBLSXload(v) 83 case Op386MOVBLZX: 84 return rewriteValue386_Op386MOVBLZX(v) 85 case Op386MOVBload: 86 return rewriteValue386_Op386MOVBload(v) 87 case Op386MOVBstore: 88 return rewriteValue386_Op386MOVBstore(v) 89 case Op386MOVBstoreconst: 90 return rewriteValue386_Op386MOVBstoreconst(v) 91 case Op386MOVLload: 92 return rewriteValue386_Op386MOVLload(v) 93 case Op386MOVLstore: 94 return rewriteValue386_Op386MOVLstore(v) 95 case Op386MOVLstoreconst: 96 return rewriteValue386_Op386MOVLstoreconst(v) 97 case Op386MOVSDconst: 98 return rewriteValue386_Op386MOVSDconst(v) 99 case Op386MOVSDload: 100 return rewriteValue386_Op386MOVSDload(v) 101 case Op386MOVSDstore: 102 return rewriteValue386_Op386MOVSDstore(v) 103 case Op386MOVSSconst: 104 return rewriteValue386_Op386MOVSSconst(v) 105 case Op386MOVSSload: 106 return rewriteValue386_Op386MOVSSload(v) 107 case Op386MOVSSstore: 108 return rewriteValue386_Op386MOVSSstore(v) 109 case Op386MOVWLSX: 110 return rewriteValue386_Op386MOVWLSX(v) 111 case Op386MOVWLSXload: 112 return rewriteValue386_Op386MOVWLSXload(v) 113 case Op386MOVWLZX: 114 return rewriteValue386_Op386MOVWLZX(v) 115 case Op386MOVWload: 116 return rewriteValue386_Op386MOVWload(v) 117 case Op386MOVWstore: 118 return rewriteValue386_Op386MOVWstore(v) 119 case Op386MOVWstoreconst: 120 return rewriteValue386_Op386MOVWstoreconst(v) 121 case Op386MULL: 122 return rewriteValue386_Op386MULL(v) 123 case Op386MULLconst: 124 return rewriteValue386_Op386MULLconst(v) 125 case Op386MULLload: 126 return rewriteValue386_Op386MULLload(v) 127 case Op386MULSD: 128 return rewriteValue386_Op386MULSD(v) 129 case Op386MULSDload: 130 return rewriteValue386_Op386MULSDload(v) 131 case Op386MULSS: 132 return rewriteValue386_Op386MULSS(v) 133 case Op386MULSSload: 134 return rewriteValue386_Op386MULSSload(v) 135 case Op386NEGL: 136 return rewriteValue386_Op386NEGL(v) 137 case Op386NOTL: 138 return rewriteValue386_Op386NOTL(v) 139 case Op386ORL: 140 return rewriteValue386_Op386ORL(v) 141 case Op386ORLconst: 142 return rewriteValue386_Op386ORLconst(v) 143 case Op386ORLconstmodify: 144 return rewriteValue386_Op386ORLconstmodify(v) 145 case Op386ORLload: 146 return rewriteValue386_Op386ORLload(v) 147 case Op386ORLmodify: 148 return rewriteValue386_Op386ORLmodify(v) 149 case Op386ROLB: 150 return rewriteValue386_Op386ROLB(v) 151 case Op386ROLBconst: 152 return rewriteValue386_Op386ROLBconst(v) 153 case Op386ROLL: 154 return rewriteValue386_Op386ROLL(v) 155 case Op386ROLLconst: 156 return rewriteValue386_Op386ROLLconst(v) 157 case Op386ROLW: 158 return rewriteValue386_Op386ROLW(v) 159 case Op386ROLWconst: 160 return rewriteValue386_Op386ROLWconst(v) 161 case Op386SARB: 162 return rewriteValue386_Op386SARB(v) 163 case Op386SARBconst: 164 return rewriteValue386_Op386SARBconst(v) 165 case Op386SARL: 166 return rewriteValue386_Op386SARL(v) 167 case Op386SARLconst: 168 return rewriteValue386_Op386SARLconst(v) 169 case Op386SARW: 170 return rewriteValue386_Op386SARW(v) 171 case Op386SARWconst: 172 return rewriteValue386_Op386SARWconst(v) 173 case Op386SBBL: 174 return rewriteValue386_Op386SBBL(v) 175 case Op386SBBLcarrymask: 176 return rewriteValue386_Op386SBBLcarrymask(v) 177 case Op386SETA: 178 return rewriteValue386_Op386SETA(v) 179 case Op386SETAE: 180 return rewriteValue386_Op386SETAE(v) 181 case Op386SETB: 182 return rewriteValue386_Op386SETB(v) 183 case Op386SETBE: 184 return rewriteValue386_Op386SETBE(v) 185 case Op386SETEQ: 186 return rewriteValue386_Op386SETEQ(v) 187 case Op386SETG: 188 return rewriteValue386_Op386SETG(v) 189 case Op386SETGE: 190 return rewriteValue386_Op386SETGE(v) 191 case Op386SETL: 192 return rewriteValue386_Op386SETL(v) 193 case Op386SETLE: 194 return rewriteValue386_Op386SETLE(v) 195 case Op386SETNE: 196 return rewriteValue386_Op386SETNE(v) 197 case Op386SHLL: 198 return rewriteValue386_Op386SHLL(v) 199 case Op386SHLLconst: 200 return rewriteValue386_Op386SHLLconst(v) 201 case Op386SHRB: 202 return rewriteValue386_Op386SHRB(v) 203 case Op386SHRBconst: 204 return rewriteValue386_Op386SHRBconst(v) 205 case Op386SHRL: 206 return rewriteValue386_Op386SHRL(v) 207 case Op386SHRLconst: 208 return rewriteValue386_Op386SHRLconst(v) 209 case Op386SHRW: 210 return rewriteValue386_Op386SHRW(v) 211 case Op386SHRWconst: 212 return rewriteValue386_Op386SHRWconst(v) 213 case Op386SUBL: 214 return rewriteValue386_Op386SUBL(v) 215 case Op386SUBLcarry: 216 return rewriteValue386_Op386SUBLcarry(v) 217 case Op386SUBLconst: 218 return rewriteValue386_Op386SUBLconst(v) 219 case Op386SUBLload: 220 return rewriteValue386_Op386SUBLload(v) 221 case Op386SUBLmodify: 222 return rewriteValue386_Op386SUBLmodify(v) 223 case Op386SUBSD: 224 return rewriteValue386_Op386SUBSD(v) 225 case Op386SUBSDload: 226 return rewriteValue386_Op386SUBSDload(v) 227 case Op386SUBSS: 228 return rewriteValue386_Op386SUBSS(v) 229 case Op386SUBSSload: 230 return rewriteValue386_Op386SUBSSload(v) 231 case Op386XORL: 232 return rewriteValue386_Op386XORL(v) 233 case Op386XORLconst: 234 return rewriteValue386_Op386XORLconst(v) 235 case Op386XORLconstmodify: 236 return rewriteValue386_Op386XORLconstmodify(v) 237 case Op386XORLload: 238 return rewriteValue386_Op386XORLload(v) 239 case Op386XORLmodify: 240 return rewriteValue386_Op386XORLmodify(v) 241 case OpAdd16: 242 v.Op = Op386ADDL 243 return true 244 case OpAdd32: 245 v.Op = Op386ADDL 246 return true 247 case OpAdd32F: 248 v.Op = Op386ADDSS 249 return true 250 case OpAdd32carry: 251 v.Op = Op386ADDLcarry 252 return true 253 case OpAdd32withcarry: 254 v.Op = Op386ADCL 255 return true 256 case OpAdd64F: 257 v.Op = Op386ADDSD 258 return true 259 case OpAdd8: 260 v.Op = Op386ADDL 261 return true 262 case OpAddPtr: 263 v.Op = Op386ADDL 264 return true 265 case OpAddr: 266 return rewriteValue386_OpAddr(v) 267 case OpAnd16: 268 v.Op = Op386ANDL 269 return true 270 case OpAnd32: 271 v.Op = Op386ANDL 272 return true 273 case OpAnd8: 274 v.Op = Op386ANDL 275 return true 276 case OpAndB: 277 v.Op = Op386ANDL 278 return true 279 case OpAvg32u: 280 v.Op = Op386AVGLU 281 return true 282 case OpBswap32: 283 v.Op = Op386BSWAPL 284 return true 285 case OpClosureCall: 286 v.Op = Op386CALLclosure 287 return true 288 case OpCom16: 289 v.Op = Op386NOTL 290 return true 291 case OpCom32: 292 v.Op = Op386NOTL 293 return true 294 case OpCom8: 295 v.Op = Op386NOTL 296 return true 297 case OpConst16: 298 return rewriteValue386_OpConst16(v) 299 case OpConst32: 300 v.Op = Op386MOVLconst 301 return true 302 case OpConst32F: 303 v.Op = Op386MOVSSconst 304 return true 305 case OpConst64F: 306 v.Op = Op386MOVSDconst 307 return true 308 case OpConst8: 309 return rewriteValue386_OpConst8(v) 310 case OpConstBool: 311 return rewriteValue386_OpConstBool(v) 312 case OpConstNil: 313 return rewriteValue386_OpConstNil(v) 314 case OpCtz16: 315 return rewriteValue386_OpCtz16(v) 316 case OpCtz16NonZero: 317 v.Op = Op386BSFL 318 return true 319 case OpCvt32Fto32: 320 v.Op = Op386CVTTSS2SL 321 return true 322 case OpCvt32Fto64F: 323 v.Op = Op386CVTSS2SD 324 return true 325 case OpCvt32to32F: 326 v.Op = Op386CVTSL2SS 327 return true 328 case OpCvt32to64F: 329 v.Op = Op386CVTSL2SD 330 return true 331 case OpCvt64Fto32: 332 v.Op = Op386CVTTSD2SL 333 return true 334 case OpCvt64Fto32F: 335 v.Op = Op386CVTSD2SS 336 return true 337 case OpCvtBoolToUint8: 338 v.Op = OpCopy 339 return true 340 case OpDiv16: 341 v.Op = Op386DIVW 342 return true 343 case OpDiv16u: 344 v.Op = Op386DIVWU 345 return true 346 case OpDiv32: 347 v.Op = Op386DIVL 348 return true 349 case OpDiv32F: 350 v.Op = Op386DIVSS 351 return true 352 case OpDiv32u: 353 v.Op = Op386DIVLU 354 return true 355 case OpDiv64F: 356 v.Op = Op386DIVSD 357 return true 358 case OpDiv8: 359 return rewriteValue386_OpDiv8(v) 360 case OpDiv8u: 361 return rewriteValue386_OpDiv8u(v) 362 case OpEq16: 363 return rewriteValue386_OpEq16(v) 364 case OpEq32: 365 return rewriteValue386_OpEq32(v) 366 case OpEq32F: 367 return rewriteValue386_OpEq32F(v) 368 case OpEq64F: 369 return rewriteValue386_OpEq64F(v) 370 case OpEq8: 371 return rewriteValue386_OpEq8(v) 372 case OpEqB: 373 return rewriteValue386_OpEqB(v) 374 case OpEqPtr: 375 return rewriteValue386_OpEqPtr(v) 376 case OpGetCallerPC: 377 v.Op = Op386LoweredGetCallerPC 378 return true 379 case OpGetCallerSP: 380 v.Op = Op386LoweredGetCallerSP 381 return true 382 case OpGetClosurePtr: 383 v.Op = Op386LoweredGetClosurePtr 384 return true 385 case OpGetG: 386 v.Op = Op386LoweredGetG 387 return true 388 case OpHmul32: 389 v.Op = Op386HMULL 390 return true 391 case OpHmul32u: 392 v.Op = Op386HMULLU 393 return true 394 case OpInterCall: 395 v.Op = Op386CALLinter 396 return true 397 case OpIsInBounds: 398 return rewriteValue386_OpIsInBounds(v) 399 case OpIsNonNil: 400 return rewriteValue386_OpIsNonNil(v) 401 case OpIsSliceInBounds: 402 return rewriteValue386_OpIsSliceInBounds(v) 403 case OpLeq16: 404 return rewriteValue386_OpLeq16(v) 405 case OpLeq16U: 406 return rewriteValue386_OpLeq16U(v) 407 case OpLeq32: 408 return rewriteValue386_OpLeq32(v) 409 case OpLeq32F: 410 return rewriteValue386_OpLeq32F(v) 411 case OpLeq32U: 412 return rewriteValue386_OpLeq32U(v) 413 case OpLeq64F: 414 return rewriteValue386_OpLeq64F(v) 415 case OpLeq8: 416 return rewriteValue386_OpLeq8(v) 417 case OpLeq8U: 418 return rewriteValue386_OpLeq8U(v) 419 case OpLess16: 420 return rewriteValue386_OpLess16(v) 421 case OpLess16U: 422 return rewriteValue386_OpLess16U(v) 423 case OpLess32: 424 return rewriteValue386_OpLess32(v) 425 case OpLess32F: 426 return rewriteValue386_OpLess32F(v) 427 case OpLess32U: 428 return rewriteValue386_OpLess32U(v) 429 case OpLess64F: 430 return rewriteValue386_OpLess64F(v) 431 case OpLess8: 432 return rewriteValue386_OpLess8(v) 433 case OpLess8U: 434 return rewriteValue386_OpLess8U(v) 435 case OpLoad: 436 return rewriteValue386_OpLoad(v) 437 case OpLocalAddr: 438 return rewriteValue386_OpLocalAddr(v) 439 case OpLsh16x16: 440 return rewriteValue386_OpLsh16x16(v) 441 case OpLsh16x32: 442 return rewriteValue386_OpLsh16x32(v) 443 case OpLsh16x64: 444 return rewriteValue386_OpLsh16x64(v) 445 case OpLsh16x8: 446 return rewriteValue386_OpLsh16x8(v) 447 case OpLsh32x16: 448 return rewriteValue386_OpLsh32x16(v) 449 case OpLsh32x32: 450 return rewriteValue386_OpLsh32x32(v) 451 case OpLsh32x64: 452 return rewriteValue386_OpLsh32x64(v) 453 case OpLsh32x8: 454 return rewriteValue386_OpLsh32x8(v) 455 case OpLsh8x16: 456 return rewriteValue386_OpLsh8x16(v) 457 case OpLsh8x32: 458 return rewriteValue386_OpLsh8x32(v) 459 case OpLsh8x64: 460 return rewriteValue386_OpLsh8x64(v) 461 case OpLsh8x8: 462 return rewriteValue386_OpLsh8x8(v) 463 case OpMod16: 464 v.Op = Op386MODW 465 return true 466 case OpMod16u: 467 v.Op = Op386MODWU 468 return true 469 case OpMod32: 470 v.Op = Op386MODL 471 return true 472 case OpMod32u: 473 v.Op = Op386MODLU 474 return true 475 case OpMod8: 476 return rewriteValue386_OpMod8(v) 477 case OpMod8u: 478 return rewriteValue386_OpMod8u(v) 479 case OpMove: 480 return rewriteValue386_OpMove(v) 481 case OpMul16: 482 v.Op = Op386MULL 483 return true 484 case OpMul32: 485 v.Op = Op386MULL 486 return true 487 case OpMul32F: 488 v.Op = Op386MULSS 489 return true 490 case OpMul32uhilo: 491 v.Op = Op386MULLQU 492 return true 493 case OpMul64F: 494 v.Op = Op386MULSD 495 return true 496 case OpMul8: 497 v.Op = Op386MULL 498 return true 499 case OpNeg16: 500 v.Op = Op386NEGL 501 return true 502 case OpNeg32: 503 v.Op = Op386NEGL 504 return true 505 case OpNeg32F: 506 return rewriteValue386_OpNeg32F(v) 507 case OpNeg64F: 508 return rewriteValue386_OpNeg64F(v) 509 case OpNeg8: 510 v.Op = Op386NEGL 511 return true 512 case OpNeq16: 513 return rewriteValue386_OpNeq16(v) 514 case OpNeq32: 515 return rewriteValue386_OpNeq32(v) 516 case OpNeq32F: 517 return rewriteValue386_OpNeq32F(v) 518 case OpNeq64F: 519 return rewriteValue386_OpNeq64F(v) 520 case OpNeq8: 521 return rewriteValue386_OpNeq8(v) 522 case OpNeqB: 523 return rewriteValue386_OpNeqB(v) 524 case OpNeqPtr: 525 return rewriteValue386_OpNeqPtr(v) 526 case OpNilCheck: 527 v.Op = Op386LoweredNilCheck 528 return true 529 case OpNot: 530 return rewriteValue386_OpNot(v) 531 case OpOffPtr: 532 return rewriteValue386_OpOffPtr(v) 533 case OpOr16: 534 v.Op = Op386ORL 535 return true 536 case OpOr32: 537 v.Op = Op386ORL 538 return true 539 case OpOr8: 540 v.Op = Op386ORL 541 return true 542 case OpOrB: 543 v.Op = Op386ORL 544 return true 545 case OpPanicBounds: 546 return rewriteValue386_OpPanicBounds(v) 547 case OpPanicExtend: 548 return rewriteValue386_OpPanicExtend(v) 549 case OpRotateLeft16: 550 v.Op = Op386ROLW 551 return true 552 case OpRotateLeft32: 553 v.Op = Op386ROLL 554 return true 555 case OpRotateLeft8: 556 v.Op = Op386ROLB 557 return true 558 case OpRound32F: 559 v.Op = OpCopy 560 return true 561 case OpRound64F: 562 v.Op = OpCopy 563 return true 564 case OpRsh16Ux16: 565 return rewriteValue386_OpRsh16Ux16(v) 566 case OpRsh16Ux32: 567 return rewriteValue386_OpRsh16Ux32(v) 568 case OpRsh16Ux64: 569 return rewriteValue386_OpRsh16Ux64(v) 570 case OpRsh16Ux8: 571 return rewriteValue386_OpRsh16Ux8(v) 572 case OpRsh16x16: 573 return rewriteValue386_OpRsh16x16(v) 574 case OpRsh16x32: 575 return rewriteValue386_OpRsh16x32(v) 576 case OpRsh16x64: 577 return rewriteValue386_OpRsh16x64(v) 578 case OpRsh16x8: 579 return rewriteValue386_OpRsh16x8(v) 580 case OpRsh32Ux16: 581 return rewriteValue386_OpRsh32Ux16(v) 582 case OpRsh32Ux32: 583 return rewriteValue386_OpRsh32Ux32(v) 584 case OpRsh32Ux64: 585 return rewriteValue386_OpRsh32Ux64(v) 586 case OpRsh32Ux8: 587 return rewriteValue386_OpRsh32Ux8(v) 588 case OpRsh32x16: 589 return rewriteValue386_OpRsh32x16(v) 590 case OpRsh32x32: 591 return rewriteValue386_OpRsh32x32(v) 592 case OpRsh32x64: 593 return rewriteValue386_OpRsh32x64(v) 594 case OpRsh32x8: 595 return rewriteValue386_OpRsh32x8(v) 596 case OpRsh8Ux16: 597 return rewriteValue386_OpRsh8Ux16(v) 598 case OpRsh8Ux32: 599 return rewriteValue386_OpRsh8Ux32(v) 600 case OpRsh8Ux64: 601 return rewriteValue386_OpRsh8Ux64(v) 602 case OpRsh8Ux8: 603 return rewriteValue386_OpRsh8Ux8(v) 604 case OpRsh8x16: 605 return rewriteValue386_OpRsh8x16(v) 606 case OpRsh8x32: 607 return rewriteValue386_OpRsh8x32(v) 608 case OpRsh8x64: 609 return rewriteValue386_OpRsh8x64(v) 610 case OpRsh8x8: 611 return rewriteValue386_OpRsh8x8(v) 612 case OpSelect0: 613 return rewriteValue386_OpSelect0(v) 614 case OpSelect1: 615 return rewriteValue386_OpSelect1(v) 616 case OpSignExt16to32: 617 v.Op = Op386MOVWLSX 618 return true 619 case OpSignExt8to16: 620 v.Op = Op386MOVBLSX 621 return true 622 case OpSignExt8to32: 623 v.Op = Op386MOVBLSX 624 return true 625 case OpSignmask: 626 return rewriteValue386_OpSignmask(v) 627 case OpSlicemask: 628 return rewriteValue386_OpSlicemask(v) 629 case OpSqrt: 630 v.Op = Op386SQRTSD 631 return true 632 case OpSqrt32: 633 v.Op = Op386SQRTSS 634 return true 635 case OpStaticCall: 636 v.Op = Op386CALLstatic 637 return true 638 case OpStore: 639 return rewriteValue386_OpStore(v) 640 case OpSub16: 641 v.Op = Op386SUBL 642 return true 643 case OpSub32: 644 v.Op = Op386SUBL 645 return true 646 case OpSub32F: 647 v.Op = Op386SUBSS 648 return true 649 case OpSub32carry: 650 v.Op = Op386SUBLcarry 651 return true 652 case OpSub32withcarry: 653 v.Op = Op386SBBL 654 return true 655 case OpSub64F: 656 v.Op = Op386SUBSD 657 return true 658 case OpSub8: 659 v.Op = Op386SUBL 660 return true 661 case OpSubPtr: 662 v.Op = Op386SUBL 663 return true 664 case OpTailCall: 665 v.Op = Op386CALLtail 666 return true 667 case OpTrunc16to8: 668 v.Op = OpCopy 669 return true 670 case OpTrunc32to16: 671 v.Op = OpCopy 672 return true 673 case OpTrunc32to8: 674 v.Op = OpCopy 675 return true 676 case OpWB: 677 v.Op = Op386LoweredWB 678 return true 679 case OpXor16: 680 v.Op = Op386XORL 681 return true 682 case OpXor32: 683 v.Op = Op386XORL 684 return true 685 case OpXor8: 686 v.Op = Op386XORL 687 return true 688 case OpZero: 689 return rewriteValue386_OpZero(v) 690 case OpZeroExt16to32: 691 v.Op = Op386MOVWLZX 692 return true 693 case OpZeroExt8to16: 694 v.Op = Op386MOVBLZX 695 return true 696 case OpZeroExt8to32: 697 v.Op = Op386MOVBLZX 698 return true 699 case OpZeromask: 700 return rewriteValue386_OpZeromask(v) 701 } 702 return false 703 } 704 func rewriteValue386_Op386ADCL(v *Value) bool { 705 v_2 := v.Args[2] 706 v_1 := v.Args[1] 707 v_0 := v.Args[0] 708 // match: (ADCL x (MOVLconst [c]) f) 709 // result: (ADCLconst [c] x f) 710 for { 711 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 712 x := v_0 713 if v_1.Op != Op386MOVLconst { 714 continue 715 } 716 c := auxIntToInt32(v_1.AuxInt) 717 f := v_2 718 v.reset(Op386ADCLconst) 719 v.AuxInt = int32ToAuxInt(c) 720 v.AddArg2(x, f) 721 return true 722 } 723 break 724 } 725 return false 726 } 727 func rewriteValue386_Op386ADDL(v *Value) bool { 728 v_1 := v.Args[1] 729 v_0 := v.Args[0] 730 // match: (ADDL x (MOVLconst [c])) 731 // result: (ADDLconst [c] x) 732 for { 733 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 734 x := v_0 735 if v_1.Op != Op386MOVLconst { 736 continue 737 } 738 c := auxIntToInt32(v_1.AuxInt) 739 v.reset(Op386ADDLconst) 740 v.AuxInt = int32ToAuxInt(c) 741 v.AddArg(x) 742 return true 743 } 744 break 745 } 746 // match: (ADDL x (SHLLconst [3] y)) 747 // result: (LEAL8 x y) 748 for { 749 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 750 x := v_0 751 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 3 { 752 continue 753 } 754 y := v_1.Args[0] 755 v.reset(Op386LEAL8) 756 v.AddArg2(x, y) 757 return true 758 } 759 break 760 } 761 // match: (ADDL x (SHLLconst [2] y)) 762 // result: (LEAL4 x y) 763 for { 764 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 765 x := v_0 766 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 2 { 767 continue 768 } 769 y := v_1.Args[0] 770 v.reset(Op386LEAL4) 771 v.AddArg2(x, y) 772 return true 773 } 774 break 775 } 776 // match: (ADDL x (SHLLconst [1] y)) 777 // result: (LEAL2 x y) 778 for { 779 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 780 x := v_0 781 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 { 782 continue 783 } 784 y := v_1.Args[0] 785 v.reset(Op386LEAL2) 786 v.AddArg2(x, y) 787 return true 788 } 789 break 790 } 791 // match: (ADDL x (ADDL y y)) 792 // result: (LEAL2 x y) 793 for { 794 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 795 x := v_0 796 if v_1.Op != Op386ADDL { 797 continue 798 } 799 y := v_1.Args[1] 800 if y != v_1.Args[0] { 801 continue 802 } 803 v.reset(Op386LEAL2) 804 v.AddArg2(x, y) 805 return true 806 } 807 break 808 } 809 // match: (ADDL x (ADDL x y)) 810 // result: (LEAL2 y x) 811 for { 812 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 813 x := v_0 814 if v_1.Op != Op386ADDL { 815 continue 816 } 817 _ = v_1.Args[1] 818 v_1_0 := v_1.Args[0] 819 v_1_1 := v_1.Args[1] 820 for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { 821 if x != v_1_0 { 822 continue 823 } 824 y := v_1_1 825 v.reset(Op386LEAL2) 826 v.AddArg2(y, x) 827 return true 828 } 829 } 830 break 831 } 832 // match: (ADDL (ADDLconst [c] x) y) 833 // result: (LEAL1 [c] x y) 834 for { 835 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 836 if v_0.Op != Op386ADDLconst { 837 continue 838 } 839 c := auxIntToInt32(v_0.AuxInt) 840 x := v_0.Args[0] 841 y := v_1 842 v.reset(Op386LEAL1) 843 v.AuxInt = int32ToAuxInt(c) 844 v.AddArg2(x, y) 845 return true 846 } 847 break 848 } 849 // match: (ADDL x (LEAL [c] {s} y)) 850 // cond: x.Op != OpSB && y.Op != OpSB 851 // result: (LEAL1 [c] {s} x y) 852 for { 853 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 854 x := v_0 855 if v_1.Op != Op386LEAL { 856 continue 857 } 858 c := auxIntToInt32(v_1.AuxInt) 859 s := auxToSym(v_1.Aux) 860 y := v_1.Args[0] 861 if !(x.Op != OpSB && y.Op != OpSB) { 862 continue 863 } 864 v.reset(Op386LEAL1) 865 v.AuxInt = int32ToAuxInt(c) 866 v.Aux = symToAux(s) 867 v.AddArg2(x, y) 868 return true 869 } 870 break 871 } 872 // match: (ADDL x l:(MOVLload [off] {sym} ptr mem)) 873 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 874 // result: (ADDLload x [off] {sym} ptr mem) 875 for { 876 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 877 x := v_0 878 l := v_1 879 if l.Op != Op386MOVLload { 880 continue 881 } 882 off := auxIntToInt32(l.AuxInt) 883 sym := auxToSym(l.Aux) 884 mem := l.Args[1] 885 ptr := l.Args[0] 886 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 887 continue 888 } 889 v.reset(Op386ADDLload) 890 v.AuxInt = int32ToAuxInt(off) 891 v.Aux = symToAux(sym) 892 v.AddArg3(x, ptr, mem) 893 return true 894 } 895 break 896 } 897 // match: (ADDL x (NEGL y)) 898 // result: (SUBL x y) 899 for { 900 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 901 x := v_0 902 if v_1.Op != Op386NEGL { 903 continue 904 } 905 y := v_1.Args[0] 906 v.reset(Op386SUBL) 907 v.AddArg2(x, y) 908 return true 909 } 910 break 911 } 912 return false 913 } 914 func rewriteValue386_Op386ADDLcarry(v *Value) bool { 915 v_1 := v.Args[1] 916 v_0 := v.Args[0] 917 // match: (ADDLcarry x (MOVLconst [c])) 918 // result: (ADDLconstcarry [c] x) 919 for { 920 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 921 x := v_0 922 if v_1.Op != Op386MOVLconst { 923 continue 924 } 925 c := auxIntToInt32(v_1.AuxInt) 926 v.reset(Op386ADDLconstcarry) 927 v.AuxInt = int32ToAuxInt(c) 928 v.AddArg(x) 929 return true 930 } 931 break 932 } 933 return false 934 } 935 func rewriteValue386_Op386ADDLconst(v *Value) bool { 936 v_0 := v.Args[0] 937 // match: (ADDLconst [c] (ADDL x y)) 938 // result: (LEAL1 [c] x y) 939 for { 940 c := auxIntToInt32(v.AuxInt) 941 if v_0.Op != Op386ADDL { 942 break 943 } 944 y := v_0.Args[1] 945 x := v_0.Args[0] 946 v.reset(Op386LEAL1) 947 v.AuxInt = int32ToAuxInt(c) 948 v.AddArg2(x, y) 949 return true 950 } 951 // match: (ADDLconst [c] (LEAL [d] {s} x)) 952 // cond: is32Bit(int64(c)+int64(d)) 953 // result: (LEAL [c+d] {s} x) 954 for { 955 c := auxIntToInt32(v.AuxInt) 956 if v_0.Op != Op386LEAL { 957 break 958 } 959 d := auxIntToInt32(v_0.AuxInt) 960 s := auxToSym(v_0.Aux) 961 x := v_0.Args[0] 962 if !(is32Bit(int64(c) + int64(d))) { 963 break 964 } 965 v.reset(Op386LEAL) 966 v.AuxInt = int32ToAuxInt(c + d) 967 v.Aux = symToAux(s) 968 v.AddArg(x) 969 return true 970 } 971 // match: (ADDLconst [c] x:(SP)) 972 // result: (LEAL [c] x) 973 for { 974 c := auxIntToInt32(v.AuxInt) 975 x := v_0 976 if x.Op != OpSP { 977 break 978 } 979 v.reset(Op386LEAL) 980 v.AuxInt = int32ToAuxInt(c) 981 v.AddArg(x) 982 return true 983 } 984 // match: (ADDLconst [c] (LEAL1 [d] {s} x y)) 985 // cond: is32Bit(int64(c)+int64(d)) 986 // result: (LEAL1 [c+d] {s} x y) 987 for { 988 c := auxIntToInt32(v.AuxInt) 989 if v_0.Op != Op386LEAL1 { 990 break 991 } 992 d := auxIntToInt32(v_0.AuxInt) 993 s := auxToSym(v_0.Aux) 994 y := v_0.Args[1] 995 x := v_0.Args[0] 996 if !(is32Bit(int64(c) + int64(d))) { 997 break 998 } 999 v.reset(Op386LEAL1) 1000 v.AuxInt = int32ToAuxInt(c + d) 1001 v.Aux = symToAux(s) 1002 v.AddArg2(x, y) 1003 return true 1004 } 1005 // match: (ADDLconst [c] (LEAL2 [d] {s} x y)) 1006 // cond: is32Bit(int64(c)+int64(d)) 1007 // result: (LEAL2 [c+d] {s} x y) 1008 for { 1009 c := auxIntToInt32(v.AuxInt) 1010 if v_0.Op != Op386LEAL2 { 1011 break 1012 } 1013 d := auxIntToInt32(v_0.AuxInt) 1014 s := auxToSym(v_0.Aux) 1015 y := v_0.Args[1] 1016 x := v_0.Args[0] 1017 if !(is32Bit(int64(c) + int64(d))) { 1018 break 1019 } 1020 v.reset(Op386LEAL2) 1021 v.AuxInt = int32ToAuxInt(c + d) 1022 v.Aux = symToAux(s) 1023 v.AddArg2(x, y) 1024 return true 1025 } 1026 // match: (ADDLconst [c] (LEAL4 [d] {s} x y)) 1027 // cond: is32Bit(int64(c)+int64(d)) 1028 // result: (LEAL4 [c+d] {s} x y) 1029 for { 1030 c := auxIntToInt32(v.AuxInt) 1031 if v_0.Op != Op386LEAL4 { 1032 break 1033 } 1034 d := auxIntToInt32(v_0.AuxInt) 1035 s := auxToSym(v_0.Aux) 1036 y := v_0.Args[1] 1037 x := v_0.Args[0] 1038 if !(is32Bit(int64(c) + int64(d))) { 1039 break 1040 } 1041 v.reset(Op386LEAL4) 1042 v.AuxInt = int32ToAuxInt(c + d) 1043 v.Aux = symToAux(s) 1044 v.AddArg2(x, y) 1045 return true 1046 } 1047 // match: (ADDLconst [c] (LEAL8 [d] {s} x y)) 1048 // cond: is32Bit(int64(c)+int64(d)) 1049 // result: (LEAL8 [c+d] {s} x y) 1050 for { 1051 c := auxIntToInt32(v.AuxInt) 1052 if v_0.Op != Op386LEAL8 { 1053 break 1054 } 1055 d := auxIntToInt32(v_0.AuxInt) 1056 s := auxToSym(v_0.Aux) 1057 y := v_0.Args[1] 1058 x := v_0.Args[0] 1059 if !(is32Bit(int64(c) + int64(d))) { 1060 break 1061 } 1062 v.reset(Op386LEAL8) 1063 v.AuxInt = int32ToAuxInt(c + d) 1064 v.Aux = symToAux(s) 1065 v.AddArg2(x, y) 1066 return true 1067 } 1068 // match: (ADDLconst [c] x) 1069 // cond: c==0 1070 // result: x 1071 for { 1072 c := auxIntToInt32(v.AuxInt) 1073 x := v_0 1074 if !(c == 0) { 1075 break 1076 } 1077 v.copyOf(x) 1078 return true 1079 } 1080 // match: (ADDLconst [c] (MOVLconst [d])) 1081 // result: (MOVLconst [c+d]) 1082 for { 1083 c := auxIntToInt32(v.AuxInt) 1084 if v_0.Op != Op386MOVLconst { 1085 break 1086 } 1087 d := auxIntToInt32(v_0.AuxInt) 1088 v.reset(Op386MOVLconst) 1089 v.AuxInt = int32ToAuxInt(c + d) 1090 return true 1091 } 1092 // match: (ADDLconst [c] (ADDLconst [d] x)) 1093 // result: (ADDLconst [c+d] x) 1094 for { 1095 c := auxIntToInt32(v.AuxInt) 1096 if v_0.Op != Op386ADDLconst { 1097 break 1098 } 1099 d := auxIntToInt32(v_0.AuxInt) 1100 x := v_0.Args[0] 1101 v.reset(Op386ADDLconst) 1102 v.AuxInt = int32ToAuxInt(c + d) 1103 v.AddArg(x) 1104 return true 1105 } 1106 return false 1107 } 1108 func rewriteValue386_Op386ADDLconstmodify(v *Value) bool { 1109 v_1 := v.Args[1] 1110 v_0 := v.Args[0] 1111 b := v.Block 1112 config := b.Func.Config 1113 // match: (ADDLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem) 1114 // cond: valoff1.canAdd32(off2) 1115 // result: (ADDLconstmodify [valoff1.addOffset32(off2)] {sym} base mem) 1116 for { 1117 valoff1 := auxIntToValAndOff(v.AuxInt) 1118 sym := auxToSym(v.Aux) 1119 if v_0.Op != Op386ADDLconst { 1120 break 1121 } 1122 off2 := auxIntToInt32(v_0.AuxInt) 1123 base := v_0.Args[0] 1124 mem := v_1 1125 if !(valoff1.canAdd32(off2)) { 1126 break 1127 } 1128 v.reset(Op386ADDLconstmodify) 1129 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2)) 1130 v.Aux = symToAux(sym) 1131 v.AddArg2(base, mem) 1132 return true 1133 } 1134 // match: (ADDLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem) 1135 // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 1136 // result: (ADDLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem) 1137 for { 1138 valoff1 := auxIntToValAndOff(v.AuxInt) 1139 sym1 := auxToSym(v.Aux) 1140 if v_0.Op != Op386LEAL { 1141 break 1142 } 1143 off2 := auxIntToInt32(v_0.AuxInt) 1144 sym2 := auxToSym(v_0.Aux) 1145 base := v_0.Args[0] 1146 mem := v_1 1147 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 1148 break 1149 } 1150 v.reset(Op386ADDLconstmodify) 1151 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2)) 1152 v.Aux = symToAux(mergeSym(sym1, sym2)) 1153 v.AddArg2(base, mem) 1154 return true 1155 } 1156 return false 1157 } 1158 func rewriteValue386_Op386ADDLload(v *Value) bool { 1159 v_2 := v.Args[2] 1160 v_1 := v.Args[1] 1161 v_0 := v.Args[0] 1162 b := v.Block 1163 config := b.Func.Config 1164 // match: (ADDLload [off1] {sym} val (ADDLconst [off2] base) mem) 1165 // cond: is32Bit(int64(off1)+int64(off2)) 1166 // result: (ADDLload [off1+off2] {sym} val base mem) 1167 for { 1168 off1 := auxIntToInt32(v.AuxInt) 1169 sym := auxToSym(v.Aux) 1170 val := v_0 1171 if v_1.Op != Op386ADDLconst { 1172 break 1173 } 1174 off2 := auxIntToInt32(v_1.AuxInt) 1175 base := v_1.Args[0] 1176 mem := v_2 1177 if !(is32Bit(int64(off1) + int64(off2))) { 1178 break 1179 } 1180 v.reset(Op386ADDLload) 1181 v.AuxInt = int32ToAuxInt(off1 + off2) 1182 v.Aux = symToAux(sym) 1183 v.AddArg3(val, base, mem) 1184 return true 1185 } 1186 // match: (ADDLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 1187 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 1188 // result: (ADDLload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 1189 for { 1190 off1 := auxIntToInt32(v.AuxInt) 1191 sym1 := auxToSym(v.Aux) 1192 val := v_0 1193 if v_1.Op != Op386LEAL { 1194 break 1195 } 1196 off2 := auxIntToInt32(v_1.AuxInt) 1197 sym2 := auxToSym(v_1.Aux) 1198 base := v_1.Args[0] 1199 mem := v_2 1200 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 1201 break 1202 } 1203 v.reset(Op386ADDLload) 1204 v.AuxInt = int32ToAuxInt(off1 + off2) 1205 v.Aux = symToAux(mergeSym(sym1, sym2)) 1206 v.AddArg3(val, base, mem) 1207 return true 1208 } 1209 return false 1210 } 1211 func rewriteValue386_Op386ADDLmodify(v *Value) bool { 1212 v_2 := v.Args[2] 1213 v_1 := v.Args[1] 1214 v_0 := v.Args[0] 1215 b := v.Block 1216 config := b.Func.Config 1217 // match: (ADDLmodify [off1] {sym} (ADDLconst [off2] base) val mem) 1218 // cond: is32Bit(int64(off1)+int64(off2)) 1219 // result: (ADDLmodify [off1+off2] {sym} base val mem) 1220 for { 1221 off1 := auxIntToInt32(v.AuxInt) 1222 sym := auxToSym(v.Aux) 1223 if v_0.Op != Op386ADDLconst { 1224 break 1225 } 1226 off2 := auxIntToInt32(v_0.AuxInt) 1227 base := v_0.Args[0] 1228 val := v_1 1229 mem := v_2 1230 if !(is32Bit(int64(off1) + int64(off2))) { 1231 break 1232 } 1233 v.reset(Op386ADDLmodify) 1234 v.AuxInt = int32ToAuxInt(off1 + off2) 1235 v.Aux = symToAux(sym) 1236 v.AddArg3(base, val, mem) 1237 return true 1238 } 1239 // match: (ADDLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 1240 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 1241 // result: (ADDLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem) 1242 for { 1243 off1 := auxIntToInt32(v.AuxInt) 1244 sym1 := auxToSym(v.Aux) 1245 if v_0.Op != Op386LEAL { 1246 break 1247 } 1248 off2 := auxIntToInt32(v_0.AuxInt) 1249 sym2 := auxToSym(v_0.Aux) 1250 base := v_0.Args[0] 1251 val := v_1 1252 mem := v_2 1253 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 1254 break 1255 } 1256 v.reset(Op386ADDLmodify) 1257 v.AuxInt = int32ToAuxInt(off1 + off2) 1258 v.Aux = symToAux(mergeSym(sym1, sym2)) 1259 v.AddArg3(base, val, mem) 1260 return true 1261 } 1262 return false 1263 } 1264 func rewriteValue386_Op386ADDSD(v *Value) bool { 1265 v_1 := v.Args[1] 1266 v_0 := v.Args[0] 1267 // match: (ADDSD x l:(MOVSDload [off] {sym} ptr mem)) 1268 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 1269 // result: (ADDSDload x [off] {sym} ptr mem) 1270 for { 1271 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 1272 x := v_0 1273 l := v_1 1274 if l.Op != Op386MOVSDload { 1275 continue 1276 } 1277 off := auxIntToInt32(l.AuxInt) 1278 sym := auxToSym(l.Aux) 1279 mem := l.Args[1] 1280 ptr := l.Args[0] 1281 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 1282 continue 1283 } 1284 v.reset(Op386ADDSDload) 1285 v.AuxInt = int32ToAuxInt(off) 1286 v.Aux = symToAux(sym) 1287 v.AddArg3(x, ptr, mem) 1288 return true 1289 } 1290 break 1291 } 1292 return false 1293 } 1294 func rewriteValue386_Op386ADDSDload(v *Value) bool { 1295 v_2 := v.Args[2] 1296 v_1 := v.Args[1] 1297 v_0 := v.Args[0] 1298 b := v.Block 1299 config := b.Func.Config 1300 // match: (ADDSDload [off1] {sym} val (ADDLconst [off2] base) mem) 1301 // cond: is32Bit(int64(off1)+int64(off2)) 1302 // result: (ADDSDload [off1+off2] {sym} val base mem) 1303 for { 1304 off1 := auxIntToInt32(v.AuxInt) 1305 sym := auxToSym(v.Aux) 1306 val := v_0 1307 if v_1.Op != Op386ADDLconst { 1308 break 1309 } 1310 off2 := auxIntToInt32(v_1.AuxInt) 1311 base := v_1.Args[0] 1312 mem := v_2 1313 if !(is32Bit(int64(off1) + int64(off2))) { 1314 break 1315 } 1316 v.reset(Op386ADDSDload) 1317 v.AuxInt = int32ToAuxInt(off1 + off2) 1318 v.Aux = symToAux(sym) 1319 v.AddArg3(val, base, mem) 1320 return true 1321 } 1322 // match: (ADDSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 1323 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 1324 // result: (ADDSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 1325 for { 1326 off1 := auxIntToInt32(v.AuxInt) 1327 sym1 := auxToSym(v.Aux) 1328 val := v_0 1329 if v_1.Op != Op386LEAL { 1330 break 1331 } 1332 off2 := auxIntToInt32(v_1.AuxInt) 1333 sym2 := auxToSym(v_1.Aux) 1334 base := v_1.Args[0] 1335 mem := v_2 1336 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 1337 break 1338 } 1339 v.reset(Op386ADDSDload) 1340 v.AuxInt = int32ToAuxInt(off1 + off2) 1341 v.Aux = symToAux(mergeSym(sym1, sym2)) 1342 v.AddArg3(val, base, mem) 1343 return true 1344 } 1345 return false 1346 } 1347 func rewriteValue386_Op386ADDSS(v *Value) bool { 1348 v_1 := v.Args[1] 1349 v_0 := v.Args[0] 1350 // match: (ADDSS x l:(MOVSSload [off] {sym} ptr mem)) 1351 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 1352 // result: (ADDSSload x [off] {sym} ptr mem) 1353 for { 1354 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 1355 x := v_0 1356 l := v_1 1357 if l.Op != Op386MOVSSload { 1358 continue 1359 } 1360 off := auxIntToInt32(l.AuxInt) 1361 sym := auxToSym(l.Aux) 1362 mem := l.Args[1] 1363 ptr := l.Args[0] 1364 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 1365 continue 1366 } 1367 v.reset(Op386ADDSSload) 1368 v.AuxInt = int32ToAuxInt(off) 1369 v.Aux = symToAux(sym) 1370 v.AddArg3(x, ptr, mem) 1371 return true 1372 } 1373 break 1374 } 1375 return false 1376 } 1377 func rewriteValue386_Op386ADDSSload(v *Value) bool { 1378 v_2 := v.Args[2] 1379 v_1 := v.Args[1] 1380 v_0 := v.Args[0] 1381 b := v.Block 1382 config := b.Func.Config 1383 // match: (ADDSSload [off1] {sym} val (ADDLconst [off2] base) mem) 1384 // cond: is32Bit(int64(off1)+int64(off2)) 1385 // result: (ADDSSload [off1+off2] {sym} val base mem) 1386 for { 1387 off1 := auxIntToInt32(v.AuxInt) 1388 sym := auxToSym(v.Aux) 1389 val := v_0 1390 if v_1.Op != Op386ADDLconst { 1391 break 1392 } 1393 off2 := auxIntToInt32(v_1.AuxInt) 1394 base := v_1.Args[0] 1395 mem := v_2 1396 if !(is32Bit(int64(off1) + int64(off2))) { 1397 break 1398 } 1399 v.reset(Op386ADDSSload) 1400 v.AuxInt = int32ToAuxInt(off1 + off2) 1401 v.Aux = symToAux(sym) 1402 v.AddArg3(val, base, mem) 1403 return true 1404 } 1405 // match: (ADDSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 1406 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 1407 // result: (ADDSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 1408 for { 1409 off1 := auxIntToInt32(v.AuxInt) 1410 sym1 := auxToSym(v.Aux) 1411 val := v_0 1412 if v_1.Op != Op386LEAL { 1413 break 1414 } 1415 off2 := auxIntToInt32(v_1.AuxInt) 1416 sym2 := auxToSym(v_1.Aux) 1417 base := v_1.Args[0] 1418 mem := v_2 1419 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 1420 break 1421 } 1422 v.reset(Op386ADDSSload) 1423 v.AuxInt = int32ToAuxInt(off1 + off2) 1424 v.Aux = symToAux(mergeSym(sym1, sym2)) 1425 v.AddArg3(val, base, mem) 1426 return true 1427 } 1428 return false 1429 } 1430 func rewriteValue386_Op386ANDL(v *Value) bool { 1431 v_1 := v.Args[1] 1432 v_0 := v.Args[0] 1433 // match: (ANDL x (MOVLconst [c])) 1434 // result: (ANDLconst [c] x) 1435 for { 1436 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 1437 x := v_0 1438 if v_1.Op != Op386MOVLconst { 1439 continue 1440 } 1441 c := auxIntToInt32(v_1.AuxInt) 1442 v.reset(Op386ANDLconst) 1443 v.AuxInt = int32ToAuxInt(c) 1444 v.AddArg(x) 1445 return true 1446 } 1447 break 1448 } 1449 // match: (ANDL x l:(MOVLload [off] {sym} ptr mem)) 1450 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 1451 // result: (ANDLload x [off] {sym} ptr mem) 1452 for { 1453 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 1454 x := v_0 1455 l := v_1 1456 if l.Op != Op386MOVLload { 1457 continue 1458 } 1459 off := auxIntToInt32(l.AuxInt) 1460 sym := auxToSym(l.Aux) 1461 mem := l.Args[1] 1462 ptr := l.Args[0] 1463 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 1464 continue 1465 } 1466 v.reset(Op386ANDLload) 1467 v.AuxInt = int32ToAuxInt(off) 1468 v.Aux = symToAux(sym) 1469 v.AddArg3(x, ptr, mem) 1470 return true 1471 } 1472 break 1473 } 1474 // match: (ANDL x x) 1475 // result: x 1476 for { 1477 x := v_0 1478 if x != v_1 { 1479 break 1480 } 1481 v.copyOf(x) 1482 return true 1483 } 1484 return false 1485 } 1486 func rewriteValue386_Op386ANDLconst(v *Value) bool { 1487 v_0 := v.Args[0] 1488 // match: (ANDLconst [c] (ANDLconst [d] x)) 1489 // result: (ANDLconst [c & d] x) 1490 for { 1491 c := auxIntToInt32(v.AuxInt) 1492 if v_0.Op != Op386ANDLconst { 1493 break 1494 } 1495 d := auxIntToInt32(v_0.AuxInt) 1496 x := v_0.Args[0] 1497 v.reset(Op386ANDLconst) 1498 v.AuxInt = int32ToAuxInt(c & d) 1499 v.AddArg(x) 1500 return true 1501 } 1502 // match: (ANDLconst [c] _) 1503 // cond: c==0 1504 // result: (MOVLconst [0]) 1505 for { 1506 c := auxIntToInt32(v.AuxInt) 1507 if !(c == 0) { 1508 break 1509 } 1510 v.reset(Op386MOVLconst) 1511 v.AuxInt = int32ToAuxInt(0) 1512 return true 1513 } 1514 // match: (ANDLconst [c] x) 1515 // cond: c==-1 1516 // result: x 1517 for { 1518 c := auxIntToInt32(v.AuxInt) 1519 x := v_0 1520 if !(c == -1) { 1521 break 1522 } 1523 v.copyOf(x) 1524 return true 1525 } 1526 // match: (ANDLconst [c] (MOVLconst [d])) 1527 // result: (MOVLconst [c&d]) 1528 for { 1529 c := auxIntToInt32(v.AuxInt) 1530 if v_0.Op != Op386MOVLconst { 1531 break 1532 } 1533 d := auxIntToInt32(v_0.AuxInt) 1534 v.reset(Op386MOVLconst) 1535 v.AuxInt = int32ToAuxInt(c & d) 1536 return true 1537 } 1538 return false 1539 } 1540 func rewriteValue386_Op386ANDLconstmodify(v *Value) bool { 1541 v_1 := v.Args[1] 1542 v_0 := v.Args[0] 1543 b := v.Block 1544 config := b.Func.Config 1545 // match: (ANDLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem) 1546 // cond: valoff1.canAdd32(off2) 1547 // result: (ANDLconstmodify [valoff1.addOffset32(off2)] {sym} base mem) 1548 for { 1549 valoff1 := auxIntToValAndOff(v.AuxInt) 1550 sym := auxToSym(v.Aux) 1551 if v_0.Op != Op386ADDLconst { 1552 break 1553 } 1554 off2 := auxIntToInt32(v_0.AuxInt) 1555 base := v_0.Args[0] 1556 mem := v_1 1557 if !(valoff1.canAdd32(off2)) { 1558 break 1559 } 1560 v.reset(Op386ANDLconstmodify) 1561 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2)) 1562 v.Aux = symToAux(sym) 1563 v.AddArg2(base, mem) 1564 return true 1565 } 1566 // match: (ANDLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem) 1567 // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 1568 // result: (ANDLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem) 1569 for { 1570 valoff1 := auxIntToValAndOff(v.AuxInt) 1571 sym1 := auxToSym(v.Aux) 1572 if v_0.Op != Op386LEAL { 1573 break 1574 } 1575 off2 := auxIntToInt32(v_0.AuxInt) 1576 sym2 := auxToSym(v_0.Aux) 1577 base := v_0.Args[0] 1578 mem := v_1 1579 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 1580 break 1581 } 1582 v.reset(Op386ANDLconstmodify) 1583 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2)) 1584 v.Aux = symToAux(mergeSym(sym1, sym2)) 1585 v.AddArg2(base, mem) 1586 return true 1587 } 1588 return false 1589 } 1590 func rewriteValue386_Op386ANDLload(v *Value) bool { 1591 v_2 := v.Args[2] 1592 v_1 := v.Args[1] 1593 v_0 := v.Args[0] 1594 b := v.Block 1595 config := b.Func.Config 1596 // match: (ANDLload [off1] {sym} val (ADDLconst [off2] base) mem) 1597 // cond: is32Bit(int64(off1)+int64(off2)) 1598 // result: (ANDLload [off1+off2] {sym} val base mem) 1599 for { 1600 off1 := auxIntToInt32(v.AuxInt) 1601 sym := auxToSym(v.Aux) 1602 val := v_0 1603 if v_1.Op != Op386ADDLconst { 1604 break 1605 } 1606 off2 := auxIntToInt32(v_1.AuxInt) 1607 base := v_1.Args[0] 1608 mem := v_2 1609 if !(is32Bit(int64(off1) + int64(off2))) { 1610 break 1611 } 1612 v.reset(Op386ANDLload) 1613 v.AuxInt = int32ToAuxInt(off1 + off2) 1614 v.Aux = symToAux(sym) 1615 v.AddArg3(val, base, mem) 1616 return true 1617 } 1618 // match: (ANDLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 1619 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 1620 // result: (ANDLload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 1621 for { 1622 off1 := auxIntToInt32(v.AuxInt) 1623 sym1 := auxToSym(v.Aux) 1624 val := v_0 1625 if v_1.Op != Op386LEAL { 1626 break 1627 } 1628 off2 := auxIntToInt32(v_1.AuxInt) 1629 sym2 := auxToSym(v_1.Aux) 1630 base := v_1.Args[0] 1631 mem := v_2 1632 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 1633 break 1634 } 1635 v.reset(Op386ANDLload) 1636 v.AuxInt = int32ToAuxInt(off1 + off2) 1637 v.Aux = symToAux(mergeSym(sym1, sym2)) 1638 v.AddArg3(val, base, mem) 1639 return true 1640 } 1641 return false 1642 } 1643 func rewriteValue386_Op386ANDLmodify(v *Value) bool { 1644 v_2 := v.Args[2] 1645 v_1 := v.Args[1] 1646 v_0 := v.Args[0] 1647 b := v.Block 1648 config := b.Func.Config 1649 // match: (ANDLmodify [off1] {sym} (ADDLconst [off2] base) val mem) 1650 // cond: is32Bit(int64(off1)+int64(off2)) 1651 // result: (ANDLmodify [off1+off2] {sym} base val mem) 1652 for { 1653 off1 := auxIntToInt32(v.AuxInt) 1654 sym := auxToSym(v.Aux) 1655 if v_0.Op != Op386ADDLconst { 1656 break 1657 } 1658 off2 := auxIntToInt32(v_0.AuxInt) 1659 base := v_0.Args[0] 1660 val := v_1 1661 mem := v_2 1662 if !(is32Bit(int64(off1) + int64(off2))) { 1663 break 1664 } 1665 v.reset(Op386ANDLmodify) 1666 v.AuxInt = int32ToAuxInt(off1 + off2) 1667 v.Aux = symToAux(sym) 1668 v.AddArg3(base, val, mem) 1669 return true 1670 } 1671 // match: (ANDLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 1672 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 1673 // result: (ANDLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem) 1674 for { 1675 off1 := auxIntToInt32(v.AuxInt) 1676 sym1 := auxToSym(v.Aux) 1677 if v_0.Op != Op386LEAL { 1678 break 1679 } 1680 off2 := auxIntToInt32(v_0.AuxInt) 1681 sym2 := auxToSym(v_0.Aux) 1682 base := v_0.Args[0] 1683 val := v_1 1684 mem := v_2 1685 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 1686 break 1687 } 1688 v.reset(Op386ANDLmodify) 1689 v.AuxInt = int32ToAuxInt(off1 + off2) 1690 v.Aux = symToAux(mergeSym(sym1, sym2)) 1691 v.AddArg3(base, val, mem) 1692 return true 1693 } 1694 return false 1695 } 1696 func rewriteValue386_Op386CMPB(v *Value) bool { 1697 v_1 := v.Args[1] 1698 v_0 := v.Args[0] 1699 b := v.Block 1700 // match: (CMPB x (MOVLconst [c])) 1701 // result: (CMPBconst x [int8(c)]) 1702 for { 1703 x := v_0 1704 if v_1.Op != Op386MOVLconst { 1705 break 1706 } 1707 c := auxIntToInt32(v_1.AuxInt) 1708 v.reset(Op386CMPBconst) 1709 v.AuxInt = int8ToAuxInt(int8(c)) 1710 v.AddArg(x) 1711 return true 1712 } 1713 // match: (CMPB (MOVLconst [c]) x) 1714 // result: (InvertFlags (CMPBconst x [int8(c)])) 1715 for { 1716 if v_0.Op != Op386MOVLconst { 1717 break 1718 } 1719 c := auxIntToInt32(v_0.AuxInt) 1720 x := v_1 1721 v.reset(Op386InvertFlags) 1722 v0 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 1723 v0.AuxInt = int8ToAuxInt(int8(c)) 1724 v0.AddArg(x) 1725 v.AddArg(v0) 1726 return true 1727 } 1728 // match: (CMPB x y) 1729 // cond: canonLessThan(x,y) 1730 // result: (InvertFlags (CMPB y x)) 1731 for { 1732 x := v_0 1733 y := v_1 1734 if !(canonLessThan(x, y)) { 1735 break 1736 } 1737 v.reset(Op386InvertFlags) 1738 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags) 1739 v0.AddArg2(y, x) 1740 v.AddArg(v0) 1741 return true 1742 } 1743 // match: (CMPB l:(MOVBload {sym} [off] ptr mem) x) 1744 // cond: canMergeLoad(v, l) && clobber(l) 1745 // result: (CMPBload {sym} [off] ptr x mem) 1746 for { 1747 l := v_0 1748 if l.Op != Op386MOVBload { 1749 break 1750 } 1751 off := auxIntToInt32(l.AuxInt) 1752 sym := auxToSym(l.Aux) 1753 mem := l.Args[1] 1754 ptr := l.Args[0] 1755 x := v_1 1756 if !(canMergeLoad(v, l) && clobber(l)) { 1757 break 1758 } 1759 v.reset(Op386CMPBload) 1760 v.AuxInt = int32ToAuxInt(off) 1761 v.Aux = symToAux(sym) 1762 v.AddArg3(ptr, x, mem) 1763 return true 1764 } 1765 // match: (CMPB x l:(MOVBload {sym} [off] ptr mem)) 1766 // cond: canMergeLoad(v, l) && clobber(l) 1767 // result: (InvertFlags (CMPBload {sym} [off] ptr x mem)) 1768 for { 1769 x := v_0 1770 l := v_1 1771 if l.Op != Op386MOVBload { 1772 break 1773 } 1774 off := auxIntToInt32(l.AuxInt) 1775 sym := auxToSym(l.Aux) 1776 mem := l.Args[1] 1777 ptr := l.Args[0] 1778 if !(canMergeLoad(v, l) && clobber(l)) { 1779 break 1780 } 1781 v.reset(Op386InvertFlags) 1782 v0 := b.NewValue0(l.Pos, Op386CMPBload, types.TypeFlags) 1783 v0.AuxInt = int32ToAuxInt(off) 1784 v0.Aux = symToAux(sym) 1785 v0.AddArg3(ptr, x, mem) 1786 v.AddArg(v0) 1787 return true 1788 } 1789 return false 1790 } 1791 func rewriteValue386_Op386CMPBconst(v *Value) bool { 1792 v_0 := v.Args[0] 1793 b := v.Block 1794 // match: (CMPBconst (MOVLconst [x]) [y]) 1795 // cond: int8(x)==y 1796 // result: (FlagEQ) 1797 for { 1798 y := auxIntToInt8(v.AuxInt) 1799 if v_0.Op != Op386MOVLconst { 1800 break 1801 } 1802 x := auxIntToInt32(v_0.AuxInt) 1803 if !(int8(x) == y) { 1804 break 1805 } 1806 v.reset(Op386FlagEQ) 1807 return true 1808 } 1809 // match: (CMPBconst (MOVLconst [x]) [y]) 1810 // cond: int8(x)<y && uint8(x)<uint8(y) 1811 // result: (FlagLT_ULT) 1812 for { 1813 y := auxIntToInt8(v.AuxInt) 1814 if v_0.Op != Op386MOVLconst { 1815 break 1816 } 1817 x := auxIntToInt32(v_0.AuxInt) 1818 if !(int8(x) < y && uint8(x) < uint8(y)) { 1819 break 1820 } 1821 v.reset(Op386FlagLT_ULT) 1822 return true 1823 } 1824 // match: (CMPBconst (MOVLconst [x]) [y]) 1825 // cond: int8(x)<y && uint8(x)>uint8(y) 1826 // result: (FlagLT_UGT) 1827 for { 1828 y := auxIntToInt8(v.AuxInt) 1829 if v_0.Op != Op386MOVLconst { 1830 break 1831 } 1832 x := auxIntToInt32(v_0.AuxInt) 1833 if !(int8(x) < y && uint8(x) > uint8(y)) { 1834 break 1835 } 1836 v.reset(Op386FlagLT_UGT) 1837 return true 1838 } 1839 // match: (CMPBconst (MOVLconst [x]) [y]) 1840 // cond: int8(x)>y && uint8(x)<uint8(y) 1841 // result: (FlagGT_ULT) 1842 for { 1843 y := auxIntToInt8(v.AuxInt) 1844 if v_0.Op != Op386MOVLconst { 1845 break 1846 } 1847 x := auxIntToInt32(v_0.AuxInt) 1848 if !(int8(x) > y && uint8(x) < uint8(y)) { 1849 break 1850 } 1851 v.reset(Op386FlagGT_ULT) 1852 return true 1853 } 1854 // match: (CMPBconst (MOVLconst [x]) [y]) 1855 // cond: int8(x)>y && uint8(x)>uint8(y) 1856 // result: (FlagGT_UGT) 1857 for { 1858 y := auxIntToInt8(v.AuxInt) 1859 if v_0.Op != Op386MOVLconst { 1860 break 1861 } 1862 x := auxIntToInt32(v_0.AuxInt) 1863 if !(int8(x) > y && uint8(x) > uint8(y)) { 1864 break 1865 } 1866 v.reset(Op386FlagGT_UGT) 1867 return true 1868 } 1869 // match: (CMPBconst (ANDLconst _ [m]) [n]) 1870 // cond: 0 <= int8(m) && int8(m) < n 1871 // result: (FlagLT_ULT) 1872 for { 1873 n := auxIntToInt8(v.AuxInt) 1874 if v_0.Op != Op386ANDLconst { 1875 break 1876 } 1877 m := auxIntToInt32(v_0.AuxInt) 1878 if !(0 <= int8(m) && int8(m) < n) { 1879 break 1880 } 1881 v.reset(Op386FlagLT_ULT) 1882 return true 1883 } 1884 // match: (CMPBconst l:(ANDL x y) [0]) 1885 // cond: l.Uses==1 1886 // result: (TESTB x y) 1887 for { 1888 if auxIntToInt8(v.AuxInt) != 0 { 1889 break 1890 } 1891 l := v_0 1892 if l.Op != Op386ANDL { 1893 break 1894 } 1895 y := l.Args[1] 1896 x := l.Args[0] 1897 if !(l.Uses == 1) { 1898 break 1899 } 1900 v.reset(Op386TESTB) 1901 v.AddArg2(x, y) 1902 return true 1903 } 1904 // match: (CMPBconst l:(ANDLconst [c] x) [0]) 1905 // cond: l.Uses==1 1906 // result: (TESTBconst [int8(c)] x) 1907 for { 1908 if auxIntToInt8(v.AuxInt) != 0 { 1909 break 1910 } 1911 l := v_0 1912 if l.Op != Op386ANDLconst { 1913 break 1914 } 1915 c := auxIntToInt32(l.AuxInt) 1916 x := l.Args[0] 1917 if !(l.Uses == 1) { 1918 break 1919 } 1920 v.reset(Op386TESTBconst) 1921 v.AuxInt = int8ToAuxInt(int8(c)) 1922 v.AddArg(x) 1923 return true 1924 } 1925 // match: (CMPBconst x [0]) 1926 // result: (TESTB x x) 1927 for { 1928 if auxIntToInt8(v.AuxInt) != 0 { 1929 break 1930 } 1931 x := v_0 1932 v.reset(Op386TESTB) 1933 v.AddArg2(x, x) 1934 return true 1935 } 1936 // match: (CMPBconst l:(MOVBload {sym} [off] ptr mem) [c]) 1937 // cond: l.Uses == 1 && clobber(l) 1938 // result: @l.Block (CMPBconstload {sym} [makeValAndOff(int32(c),off)] ptr mem) 1939 for { 1940 c := auxIntToInt8(v.AuxInt) 1941 l := v_0 1942 if l.Op != Op386MOVBload { 1943 break 1944 } 1945 off := auxIntToInt32(l.AuxInt) 1946 sym := auxToSym(l.Aux) 1947 mem := l.Args[1] 1948 ptr := l.Args[0] 1949 if !(l.Uses == 1 && clobber(l)) { 1950 break 1951 } 1952 b = l.Block 1953 v0 := b.NewValue0(l.Pos, Op386CMPBconstload, types.TypeFlags) 1954 v.copyOf(v0) 1955 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off)) 1956 v0.Aux = symToAux(sym) 1957 v0.AddArg2(ptr, mem) 1958 return true 1959 } 1960 return false 1961 } 1962 func rewriteValue386_Op386CMPBload(v *Value) bool { 1963 v_2 := v.Args[2] 1964 v_1 := v.Args[1] 1965 v_0 := v.Args[0] 1966 // match: (CMPBload {sym} [off] ptr (MOVLconst [c]) mem) 1967 // result: (CMPBconstload {sym} [makeValAndOff(int32(int8(c)),off)] ptr mem) 1968 for { 1969 off := auxIntToInt32(v.AuxInt) 1970 sym := auxToSym(v.Aux) 1971 ptr := v_0 1972 if v_1.Op != Op386MOVLconst { 1973 break 1974 } 1975 c := auxIntToInt32(v_1.AuxInt) 1976 mem := v_2 1977 v.reset(Op386CMPBconstload) 1978 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int8(c)), off)) 1979 v.Aux = symToAux(sym) 1980 v.AddArg2(ptr, mem) 1981 return true 1982 } 1983 return false 1984 } 1985 func rewriteValue386_Op386CMPL(v *Value) bool { 1986 v_1 := v.Args[1] 1987 v_0 := v.Args[0] 1988 b := v.Block 1989 // match: (CMPL x (MOVLconst [c])) 1990 // result: (CMPLconst x [c]) 1991 for { 1992 x := v_0 1993 if v_1.Op != Op386MOVLconst { 1994 break 1995 } 1996 c := auxIntToInt32(v_1.AuxInt) 1997 v.reset(Op386CMPLconst) 1998 v.AuxInt = int32ToAuxInt(c) 1999 v.AddArg(x) 2000 return true 2001 } 2002 // match: (CMPL (MOVLconst [c]) x) 2003 // result: (InvertFlags (CMPLconst x [c])) 2004 for { 2005 if v_0.Op != Op386MOVLconst { 2006 break 2007 } 2008 c := auxIntToInt32(v_0.AuxInt) 2009 x := v_1 2010 v.reset(Op386InvertFlags) 2011 v0 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 2012 v0.AuxInt = int32ToAuxInt(c) 2013 v0.AddArg(x) 2014 v.AddArg(v0) 2015 return true 2016 } 2017 // match: (CMPL x y) 2018 // cond: canonLessThan(x,y) 2019 // result: (InvertFlags (CMPL y x)) 2020 for { 2021 x := v_0 2022 y := v_1 2023 if !(canonLessThan(x, y)) { 2024 break 2025 } 2026 v.reset(Op386InvertFlags) 2027 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 2028 v0.AddArg2(y, x) 2029 v.AddArg(v0) 2030 return true 2031 } 2032 // match: (CMPL l:(MOVLload {sym} [off] ptr mem) x) 2033 // cond: canMergeLoad(v, l) && clobber(l) 2034 // result: (CMPLload {sym} [off] ptr x mem) 2035 for { 2036 l := v_0 2037 if l.Op != Op386MOVLload { 2038 break 2039 } 2040 off := auxIntToInt32(l.AuxInt) 2041 sym := auxToSym(l.Aux) 2042 mem := l.Args[1] 2043 ptr := l.Args[0] 2044 x := v_1 2045 if !(canMergeLoad(v, l) && clobber(l)) { 2046 break 2047 } 2048 v.reset(Op386CMPLload) 2049 v.AuxInt = int32ToAuxInt(off) 2050 v.Aux = symToAux(sym) 2051 v.AddArg3(ptr, x, mem) 2052 return true 2053 } 2054 // match: (CMPL x l:(MOVLload {sym} [off] ptr mem)) 2055 // cond: canMergeLoad(v, l) && clobber(l) 2056 // result: (InvertFlags (CMPLload {sym} [off] ptr x mem)) 2057 for { 2058 x := v_0 2059 l := v_1 2060 if l.Op != Op386MOVLload { 2061 break 2062 } 2063 off := auxIntToInt32(l.AuxInt) 2064 sym := auxToSym(l.Aux) 2065 mem := l.Args[1] 2066 ptr := l.Args[0] 2067 if !(canMergeLoad(v, l) && clobber(l)) { 2068 break 2069 } 2070 v.reset(Op386InvertFlags) 2071 v0 := b.NewValue0(l.Pos, Op386CMPLload, types.TypeFlags) 2072 v0.AuxInt = int32ToAuxInt(off) 2073 v0.Aux = symToAux(sym) 2074 v0.AddArg3(ptr, x, mem) 2075 v.AddArg(v0) 2076 return true 2077 } 2078 return false 2079 } 2080 func rewriteValue386_Op386CMPLconst(v *Value) bool { 2081 v_0 := v.Args[0] 2082 b := v.Block 2083 // match: (CMPLconst (MOVLconst [x]) [y]) 2084 // cond: x==y 2085 // result: (FlagEQ) 2086 for { 2087 y := auxIntToInt32(v.AuxInt) 2088 if v_0.Op != Op386MOVLconst { 2089 break 2090 } 2091 x := auxIntToInt32(v_0.AuxInt) 2092 if !(x == y) { 2093 break 2094 } 2095 v.reset(Op386FlagEQ) 2096 return true 2097 } 2098 // match: (CMPLconst (MOVLconst [x]) [y]) 2099 // cond: x<y && uint32(x)<uint32(y) 2100 // result: (FlagLT_ULT) 2101 for { 2102 y := auxIntToInt32(v.AuxInt) 2103 if v_0.Op != Op386MOVLconst { 2104 break 2105 } 2106 x := auxIntToInt32(v_0.AuxInt) 2107 if !(x < y && uint32(x) < uint32(y)) { 2108 break 2109 } 2110 v.reset(Op386FlagLT_ULT) 2111 return true 2112 } 2113 // match: (CMPLconst (MOVLconst [x]) [y]) 2114 // cond: x<y && uint32(x)>uint32(y) 2115 // result: (FlagLT_UGT) 2116 for { 2117 y := auxIntToInt32(v.AuxInt) 2118 if v_0.Op != Op386MOVLconst { 2119 break 2120 } 2121 x := auxIntToInt32(v_0.AuxInt) 2122 if !(x < y && uint32(x) > uint32(y)) { 2123 break 2124 } 2125 v.reset(Op386FlagLT_UGT) 2126 return true 2127 } 2128 // match: (CMPLconst (MOVLconst [x]) [y]) 2129 // cond: x>y && uint32(x)<uint32(y) 2130 // result: (FlagGT_ULT) 2131 for { 2132 y := auxIntToInt32(v.AuxInt) 2133 if v_0.Op != Op386MOVLconst { 2134 break 2135 } 2136 x := auxIntToInt32(v_0.AuxInt) 2137 if !(x > y && uint32(x) < uint32(y)) { 2138 break 2139 } 2140 v.reset(Op386FlagGT_ULT) 2141 return true 2142 } 2143 // match: (CMPLconst (MOVLconst [x]) [y]) 2144 // cond: x>y && uint32(x)>uint32(y) 2145 // result: (FlagGT_UGT) 2146 for { 2147 y := auxIntToInt32(v.AuxInt) 2148 if v_0.Op != Op386MOVLconst { 2149 break 2150 } 2151 x := auxIntToInt32(v_0.AuxInt) 2152 if !(x > y && uint32(x) > uint32(y)) { 2153 break 2154 } 2155 v.reset(Op386FlagGT_UGT) 2156 return true 2157 } 2158 // match: (CMPLconst (SHRLconst _ [c]) [n]) 2159 // cond: 0 <= n && 0 < c && c <= 32 && (1<<uint64(32-c)) <= uint64(n) 2160 // result: (FlagLT_ULT) 2161 for { 2162 n := auxIntToInt32(v.AuxInt) 2163 if v_0.Op != Op386SHRLconst { 2164 break 2165 } 2166 c := auxIntToInt32(v_0.AuxInt) 2167 if !(0 <= n && 0 < c && c <= 32 && (1<<uint64(32-c)) <= uint64(n)) { 2168 break 2169 } 2170 v.reset(Op386FlagLT_ULT) 2171 return true 2172 } 2173 // match: (CMPLconst (ANDLconst _ [m]) [n]) 2174 // cond: 0 <= m && m < n 2175 // result: (FlagLT_ULT) 2176 for { 2177 n := auxIntToInt32(v.AuxInt) 2178 if v_0.Op != Op386ANDLconst { 2179 break 2180 } 2181 m := auxIntToInt32(v_0.AuxInt) 2182 if !(0 <= m && m < n) { 2183 break 2184 } 2185 v.reset(Op386FlagLT_ULT) 2186 return true 2187 } 2188 // match: (CMPLconst l:(ANDL x y) [0]) 2189 // cond: l.Uses==1 2190 // result: (TESTL x y) 2191 for { 2192 if auxIntToInt32(v.AuxInt) != 0 { 2193 break 2194 } 2195 l := v_0 2196 if l.Op != Op386ANDL { 2197 break 2198 } 2199 y := l.Args[1] 2200 x := l.Args[0] 2201 if !(l.Uses == 1) { 2202 break 2203 } 2204 v.reset(Op386TESTL) 2205 v.AddArg2(x, y) 2206 return true 2207 } 2208 // match: (CMPLconst l:(ANDLconst [c] x) [0]) 2209 // cond: l.Uses==1 2210 // result: (TESTLconst [c] x) 2211 for { 2212 if auxIntToInt32(v.AuxInt) != 0 { 2213 break 2214 } 2215 l := v_0 2216 if l.Op != Op386ANDLconst { 2217 break 2218 } 2219 c := auxIntToInt32(l.AuxInt) 2220 x := l.Args[0] 2221 if !(l.Uses == 1) { 2222 break 2223 } 2224 v.reset(Op386TESTLconst) 2225 v.AuxInt = int32ToAuxInt(c) 2226 v.AddArg(x) 2227 return true 2228 } 2229 // match: (CMPLconst x [0]) 2230 // result: (TESTL x x) 2231 for { 2232 if auxIntToInt32(v.AuxInt) != 0 { 2233 break 2234 } 2235 x := v_0 2236 v.reset(Op386TESTL) 2237 v.AddArg2(x, x) 2238 return true 2239 } 2240 // match: (CMPLconst l:(MOVLload {sym} [off] ptr mem) [c]) 2241 // cond: l.Uses == 1 && clobber(l) 2242 // result: @l.Block (CMPLconstload {sym} [makeValAndOff(int32(c),off)] ptr mem) 2243 for { 2244 c := auxIntToInt32(v.AuxInt) 2245 l := v_0 2246 if l.Op != Op386MOVLload { 2247 break 2248 } 2249 off := auxIntToInt32(l.AuxInt) 2250 sym := auxToSym(l.Aux) 2251 mem := l.Args[1] 2252 ptr := l.Args[0] 2253 if !(l.Uses == 1 && clobber(l)) { 2254 break 2255 } 2256 b = l.Block 2257 v0 := b.NewValue0(l.Pos, Op386CMPLconstload, types.TypeFlags) 2258 v.copyOf(v0) 2259 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off)) 2260 v0.Aux = symToAux(sym) 2261 v0.AddArg2(ptr, mem) 2262 return true 2263 } 2264 return false 2265 } 2266 func rewriteValue386_Op386CMPLload(v *Value) bool { 2267 v_2 := v.Args[2] 2268 v_1 := v.Args[1] 2269 v_0 := v.Args[0] 2270 // match: (CMPLload {sym} [off] ptr (MOVLconst [c]) mem) 2271 // result: (CMPLconstload {sym} [makeValAndOff(c,off)] ptr mem) 2272 for { 2273 off := auxIntToInt32(v.AuxInt) 2274 sym := auxToSym(v.Aux) 2275 ptr := v_0 2276 if v_1.Op != Op386MOVLconst { 2277 break 2278 } 2279 c := auxIntToInt32(v_1.AuxInt) 2280 mem := v_2 2281 v.reset(Op386CMPLconstload) 2282 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off)) 2283 v.Aux = symToAux(sym) 2284 v.AddArg2(ptr, mem) 2285 return true 2286 } 2287 return false 2288 } 2289 func rewriteValue386_Op386CMPW(v *Value) bool { 2290 v_1 := v.Args[1] 2291 v_0 := v.Args[0] 2292 b := v.Block 2293 // match: (CMPW x (MOVLconst [c])) 2294 // result: (CMPWconst x [int16(c)]) 2295 for { 2296 x := v_0 2297 if v_1.Op != Op386MOVLconst { 2298 break 2299 } 2300 c := auxIntToInt32(v_1.AuxInt) 2301 v.reset(Op386CMPWconst) 2302 v.AuxInt = int16ToAuxInt(int16(c)) 2303 v.AddArg(x) 2304 return true 2305 } 2306 // match: (CMPW (MOVLconst [c]) x) 2307 // result: (InvertFlags (CMPWconst x [int16(c)])) 2308 for { 2309 if v_0.Op != Op386MOVLconst { 2310 break 2311 } 2312 c := auxIntToInt32(v_0.AuxInt) 2313 x := v_1 2314 v.reset(Op386InvertFlags) 2315 v0 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 2316 v0.AuxInt = int16ToAuxInt(int16(c)) 2317 v0.AddArg(x) 2318 v.AddArg(v0) 2319 return true 2320 } 2321 // match: (CMPW x y) 2322 // cond: canonLessThan(x,y) 2323 // result: (InvertFlags (CMPW y x)) 2324 for { 2325 x := v_0 2326 y := v_1 2327 if !(canonLessThan(x, y)) { 2328 break 2329 } 2330 v.reset(Op386InvertFlags) 2331 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags) 2332 v0.AddArg2(y, x) 2333 v.AddArg(v0) 2334 return true 2335 } 2336 // match: (CMPW l:(MOVWload {sym} [off] ptr mem) x) 2337 // cond: canMergeLoad(v, l) && clobber(l) 2338 // result: (CMPWload {sym} [off] ptr x mem) 2339 for { 2340 l := v_0 2341 if l.Op != Op386MOVWload { 2342 break 2343 } 2344 off := auxIntToInt32(l.AuxInt) 2345 sym := auxToSym(l.Aux) 2346 mem := l.Args[1] 2347 ptr := l.Args[0] 2348 x := v_1 2349 if !(canMergeLoad(v, l) && clobber(l)) { 2350 break 2351 } 2352 v.reset(Op386CMPWload) 2353 v.AuxInt = int32ToAuxInt(off) 2354 v.Aux = symToAux(sym) 2355 v.AddArg3(ptr, x, mem) 2356 return true 2357 } 2358 // match: (CMPW x l:(MOVWload {sym} [off] ptr mem)) 2359 // cond: canMergeLoad(v, l) && clobber(l) 2360 // result: (InvertFlags (CMPWload {sym} [off] ptr x mem)) 2361 for { 2362 x := v_0 2363 l := v_1 2364 if l.Op != Op386MOVWload { 2365 break 2366 } 2367 off := auxIntToInt32(l.AuxInt) 2368 sym := auxToSym(l.Aux) 2369 mem := l.Args[1] 2370 ptr := l.Args[0] 2371 if !(canMergeLoad(v, l) && clobber(l)) { 2372 break 2373 } 2374 v.reset(Op386InvertFlags) 2375 v0 := b.NewValue0(l.Pos, Op386CMPWload, types.TypeFlags) 2376 v0.AuxInt = int32ToAuxInt(off) 2377 v0.Aux = symToAux(sym) 2378 v0.AddArg3(ptr, x, mem) 2379 v.AddArg(v0) 2380 return true 2381 } 2382 return false 2383 } 2384 func rewriteValue386_Op386CMPWconst(v *Value) bool { 2385 v_0 := v.Args[0] 2386 b := v.Block 2387 // match: (CMPWconst (MOVLconst [x]) [y]) 2388 // cond: int16(x)==y 2389 // result: (FlagEQ) 2390 for { 2391 y := auxIntToInt16(v.AuxInt) 2392 if v_0.Op != Op386MOVLconst { 2393 break 2394 } 2395 x := auxIntToInt32(v_0.AuxInt) 2396 if !(int16(x) == y) { 2397 break 2398 } 2399 v.reset(Op386FlagEQ) 2400 return true 2401 } 2402 // match: (CMPWconst (MOVLconst [x]) [y]) 2403 // cond: int16(x)<y && uint16(x)<uint16(y) 2404 // result: (FlagLT_ULT) 2405 for { 2406 y := auxIntToInt16(v.AuxInt) 2407 if v_0.Op != Op386MOVLconst { 2408 break 2409 } 2410 x := auxIntToInt32(v_0.AuxInt) 2411 if !(int16(x) < y && uint16(x) < uint16(y)) { 2412 break 2413 } 2414 v.reset(Op386FlagLT_ULT) 2415 return true 2416 } 2417 // match: (CMPWconst (MOVLconst [x]) [y]) 2418 // cond: int16(x)<y && uint16(x)>uint16(y) 2419 // result: (FlagLT_UGT) 2420 for { 2421 y := auxIntToInt16(v.AuxInt) 2422 if v_0.Op != Op386MOVLconst { 2423 break 2424 } 2425 x := auxIntToInt32(v_0.AuxInt) 2426 if !(int16(x) < y && uint16(x) > uint16(y)) { 2427 break 2428 } 2429 v.reset(Op386FlagLT_UGT) 2430 return true 2431 } 2432 // match: (CMPWconst (MOVLconst [x]) [y]) 2433 // cond: int16(x)>y && uint16(x)<uint16(y) 2434 // result: (FlagGT_ULT) 2435 for { 2436 y := auxIntToInt16(v.AuxInt) 2437 if v_0.Op != Op386MOVLconst { 2438 break 2439 } 2440 x := auxIntToInt32(v_0.AuxInt) 2441 if !(int16(x) > y && uint16(x) < uint16(y)) { 2442 break 2443 } 2444 v.reset(Op386FlagGT_ULT) 2445 return true 2446 } 2447 // match: (CMPWconst (MOVLconst [x]) [y]) 2448 // cond: int16(x)>y && uint16(x)>uint16(y) 2449 // result: (FlagGT_UGT) 2450 for { 2451 y := auxIntToInt16(v.AuxInt) 2452 if v_0.Op != Op386MOVLconst { 2453 break 2454 } 2455 x := auxIntToInt32(v_0.AuxInt) 2456 if !(int16(x) > y && uint16(x) > uint16(y)) { 2457 break 2458 } 2459 v.reset(Op386FlagGT_UGT) 2460 return true 2461 } 2462 // match: (CMPWconst (ANDLconst _ [m]) [n]) 2463 // cond: 0 <= int16(m) && int16(m) < n 2464 // result: (FlagLT_ULT) 2465 for { 2466 n := auxIntToInt16(v.AuxInt) 2467 if v_0.Op != Op386ANDLconst { 2468 break 2469 } 2470 m := auxIntToInt32(v_0.AuxInt) 2471 if !(0 <= int16(m) && int16(m) < n) { 2472 break 2473 } 2474 v.reset(Op386FlagLT_ULT) 2475 return true 2476 } 2477 // match: (CMPWconst l:(ANDL x y) [0]) 2478 // cond: l.Uses==1 2479 // result: (TESTW x y) 2480 for { 2481 if auxIntToInt16(v.AuxInt) != 0 { 2482 break 2483 } 2484 l := v_0 2485 if l.Op != Op386ANDL { 2486 break 2487 } 2488 y := l.Args[1] 2489 x := l.Args[0] 2490 if !(l.Uses == 1) { 2491 break 2492 } 2493 v.reset(Op386TESTW) 2494 v.AddArg2(x, y) 2495 return true 2496 } 2497 // match: (CMPWconst l:(ANDLconst [c] x) [0]) 2498 // cond: l.Uses==1 2499 // result: (TESTWconst [int16(c)] x) 2500 for { 2501 if auxIntToInt16(v.AuxInt) != 0 { 2502 break 2503 } 2504 l := v_0 2505 if l.Op != Op386ANDLconst { 2506 break 2507 } 2508 c := auxIntToInt32(l.AuxInt) 2509 x := l.Args[0] 2510 if !(l.Uses == 1) { 2511 break 2512 } 2513 v.reset(Op386TESTWconst) 2514 v.AuxInt = int16ToAuxInt(int16(c)) 2515 v.AddArg(x) 2516 return true 2517 } 2518 // match: (CMPWconst x [0]) 2519 // result: (TESTW x x) 2520 for { 2521 if auxIntToInt16(v.AuxInt) != 0 { 2522 break 2523 } 2524 x := v_0 2525 v.reset(Op386TESTW) 2526 v.AddArg2(x, x) 2527 return true 2528 } 2529 // match: (CMPWconst l:(MOVWload {sym} [off] ptr mem) [c]) 2530 // cond: l.Uses == 1 && clobber(l) 2531 // result: @l.Block (CMPWconstload {sym} [makeValAndOff(int32(c),off)] ptr mem) 2532 for { 2533 c := auxIntToInt16(v.AuxInt) 2534 l := v_0 2535 if l.Op != Op386MOVWload { 2536 break 2537 } 2538 off := auxIntToInt32(l.AuxInt) 2539 sym := auxToSym(l.Aux) 2540 mem := l.Args[1] 2541 ptr := l.Args[0] 2542 if !(l.Uses == 1 && clobber(l)) { 2543 break 2544 } 2545 b = l.Block 2546 v0 := b.NewValue0(l.Pos, Op386CMPWconstload, types.TypeFlags) 2547 v.copyOf(v0) 2548 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off)) 2549 v0.Aux = symToAux(sym) 2550 v0.AddArg2(ptr, mem) 2551 return true 2552 } 2553 return false 2554 } 2555 func rewriteValue386_Op386CMPWload(v *Value) bool { 2556 v_2 := v.Args[2] 2557 v_1 := v.Args[1] 2558 v_0 := v.Args[0] 2559 // match: (CMPWload {sym} [off] ptr (MOVLconst [c]) mem) 2560 // result: (CMPWconstload {sym} [makeValAndOff(int32(int16(c)),off)] ptr mem) 2561 for { 2562 off := auxIntToInt32(v.AuxInt) 2563 sym := auxToSym(v.Aux) 2564 ptr := v_0 2565 if v_1.Op != Op386MOVLconst { 2566 break 2567 } 2568 c := auxIntToInt32(v_1.AuxInt) 2569 mem := v_2 2570 v.reset(Op386CMPWconstload) 2571 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int16(c)), off)) 2572 v.Aux = symToAux(sym) 2573 v.AddArg2(ptr, mem) 2574 return true 2575 } 2576 return false 2577 } 2578 func rewriteValue386_Op386DIVSD(v *Value) bool { 2579 v_1 := v.Args[1] 2580 v_0 := v.Args[0] 2581 // match: (DIVSD x l:(MOVSDload [off] {sym} ptr mem)) 2582 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 2583 // result: (DIVSDload x [off] {sym} ptr mem) 2584 for { 2585 x := v_0 2586 l := v_1 2587 if l.Op != Op386MOVSDload { 2588 break 2589 } 2590 off := auxIntToInt32(l.AuxInt) 2591 sym := auxToSym(l.Aux) 2592 mem := l.Args[1] 2593 ptr := l.Args[0] 2594 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 2595 break 2596 } 2597 v.reset(Op386DIVSDload) 2598 v.AuxInt = int32ToAuxInt(off) 2599 v.Aux = symToAux(sym) 2600 v.AddArg3(x, ptr, mem) 2601 return true 2602 } 2603 return false 2604 } 2605 func rewriteValue386_Op386DIVSDload(v *Value) bool { 2606 v_2 := v.Args[2] 2607 v_1 := v.Args[1] 2608 v_0 := v.Args[0] 2609 b := v.Block 2610 config := b.Func.Config 2611 // match: (DIVSDload [off1] {sym} val (ADDLconst [off2] base) mem) 2612 // cond: is32Bit(int64(off1)+int64(off2)) 2613 // result: (DIVSDload [off1+off2] {sym} val base mem) 2614 for { 2615 off1 := auxIntToInt32(v.AuxInt) 2616 sym := auxToSym(v.Aux) 2617 val := v_0 2618 if v_1.Op != Op386ADDLconst { 2619 break 2620 } 2621 off2 := auxIntToInt32(v_1.AuxInt) 2622 base := v_1.Args[0] 2623 mem := v_2 2624 if !(is32Bit(int64(off1) + int64(off2))) { 2625 break 2626 } 2627 v.reset(Op386DIVSDload) 2628 v.AuxInt = int32ToAuxInt(off1 + off2) 2629 v.Aux = symToAux(sym) 2630 v.AddArg3(val, base, mem) 2631 return true 2632 } 2633 // match: (DIVSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 2634 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 2635 // result: (DIVSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 2636 for { 2637 off1 := auxIntToInt32(v.AuxInt) 2638 sym1 := auxToSym(v.Aux) 2639 val := v_0 2640 if v_1.Op != Op386LEAL { 2641 break 2642 } 2643 off2 := auxIntToInt32(v_1.AuxInt) 2644 sym2 := auxToSym(v_1.Aux) 2645 base := v_1.Args[0] 2646 mem := v_2 2647 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 2648 break 2649 } 2650 v.reset(Op386DIVSDload) 2651 v.AuxInt = int32ToAuxInt(off1 + off2) 2652 v.Aux = symToAux(mergeSym(sym1, sym2)) 2653 v.AddArg3(val, base, mem) 2654 return true 2655 } 2656 return false 2657 } 2658 func rewriteValue386_Op386DIVSS(v *Value) bool { 2659 v_1 := v.Args[1] 2660 v_0 := v.Args[0] 2661 // match: (DIVSS x l:(MOVSSload [off] {sym} ptr mem)) 2662 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 2663 // result: (DIVSSload x [off] {sym} ptr mem) 2664 for { 2665 x := v_0 2666 l := v_1 2667 if l.Op != Op386MOVSSload { 2668 break 2669 } 2670 off := auxIntToInt32(l.AuxInt) 2671 sym := auxToSym(l.Aux) 2672 mem := l.Args[1] 2673 ptr := l.Args[0] 2674 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 2675 break 2676 } 2677 v.reset(Op386DIVSSload) 2678 v.AuxInt = int32ToAuxInt(off) 2679 v.Aux = symToAux(sym) 2680 v.AddArg3(x, ptr, mem) 2681 return true 2682 } 2683 return false 2684 } 2685 func rewriteValue386_Op386DIVSSload(v *Value) bool { 2686 v_2 := v.Args[2] 2687 v_1 := v.Args[1] 2688 v_0 := v.Args[0] 2689 b := v.Block 2690 config := b.Func.Config 2691 // match: (DIVSSload [off1] {sym} val (ADDLconst [off2] base) mem) 2692 // cond: is32Bit(int64(off1)+int64(off2)) 2693 // result: (DIVSSload [off1+off2] {sym} val base mem) 2694 for { 2695 off1 := auxIntToInt32(v.AuxInt) 2696 sym := auxToSym(v.Aux) 2697 val := v_0 2698 if v_1.Op != Op386ADDLconst { 2699 break 2700 } 2701 off2 := auxIntToInt32(v_1.AuxInt) 2702 base := v_1.Args[0] 2703 mem := v_2 2704 if !(is32Bit(int64(off1) + int64(off2))) { 2705 break 2706 } 2707 v.reset(Op386DIVSSload) 2708 v.AuxInt = int32ToAuxInt(off1 + off2) 2709 v.Aux = symToAux(sym) 2710 v.AddArg3(val, base, mem) 2711 return true 2712 } 2713 // match: (DIVSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 2714 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 2715 // result: (DIVSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 2716 for { 2717 off1 := auxIntToInt32(v.AuxInt) 2718 sym1 := auxToSym(v.Aux) 2719 val := v_0 2720 if v_1.Op != Op386LEAL { 2721 break 2722 } 2723 off2 := auxIntToInt32(v_1.AuxInt) 2724 sym2 := auxToSym(v_1.Aux) 2725 base := v_1.Args[0] 2726 mem := v_2 2727 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 2728 break 2729 } 2730 v.reset(Op386DIVSSload) 2731 v.AuxInt = int32ToAuxInt(off1 + off2) 2732 v.Aux = symToAux(mergeSym(sym1, sym2)) 2733 v.AddArg3(val, base, mem) 2734 return true 2735 } 2736 return false 2737 } 2738 func rewriteValue386_Op386LEAL(v *Value) bool { 2739 v_0 := v.Args[0] 2740 // match: (LEAL [c] {s} (ADDLconst [d] x)) 2741 // cond: is32Bit(int64(c)+int64(d)) 2742 // result: (LEAL [c+d] {s} x) 2743 for { 2744 c := auxIntToInt32(v.AuxInt) 2745 s := auxToSym(v.Aux) 2746 if v_0.Op != Op386ADDLconst { 2747 break 2748 } 2749 d := auxIntToInt32(v_0.AuxInt) 2750 x := v_0.Args[0] 2751 if !(is32Bit(int64(c) + int64(d))) { 2752 break 2753 } 2754 v.reset(Op386LEAL) 2755 v.AuxInt = int32ToAuxInt(c + d) 2756 v.Aux = symToAux(s) 2757 v.AddArg(x) 2758 return true 2759 } 2760 // match: (LEAL [c] {s} (ADDL x y)) 2761 // cond: x.Op != OpSB && y.Op != OpSB 2762 // result: (LEAL1 [c] {s} x y) 2763 for { 2764 c := auxIntToInt32(v.AuxInt) 2765 s := auxToSym(v.Aux) 2766 if v_0.Op != Op386ADDL { 2767 break 2768 } 2769 _ = v_0.Args[1] 2770 v_0_0 := v_0.Args[0] 2771 v_0_1 := v_0.Args[1] 2772 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 2773 x := v_0_0 2774 y := v_0_1 2775 if !(x.Op != OpSB && y.Op != OpSB) { 2776 continue 2777 } 2778 v.reset(Op386LEAL1) 2779 v.AuxInt = int32ToAuxInt(c) 2780 v.Aux = symToAux(s) 2781 v.AddArg2(x, y) 2782 return true 2783 } 2784 break 2785 } 2786 // match: (LEAL [off1] {sym1} (LEAL [off2] {sym2} x)) 2787 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 2788 // result: (LEAL [off1+off2] {mergeSym(sym1,sym2)} x) 2789 for { 2790 off1 := auxIntToInt32(v.AuxInt) 2791 sym1 := auxToSym(v.Aux) 2792 if v_0.Op != Op386LEAL { 2793 break 2794 } 2795 off2 := auxIntToInt32(v_0.AuxInt) 2796 sym2 := auxToSym(v_0.Aux) 2797 x := v_0.Args[0] 2798 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 2799 break 2800 } 2801 v.reset(Op386LEAL) 2802 v.AuxInt = int32ToAuxInt(off1 + off2) 2803 v.Aux = symToAux(mergeSym(sym1, sym2)) 2804 v.AddArg(x) 2805 return true 2806 } 2807 // match: (LEAL [off1] {sym1} (LEAL1 [off2] {sym2} x y)) 2808 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 2809 // result: (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y) 2810 for { 2811 off1 := auxIntToInt32(v.AuxInt) 2812 sym1 := auxToSym(v.Aux) 2813 if v_0.Op != Op386LEAL1 { 2814 break 2815 } 2816 off2 := auxIntToInt32(v_0.AuxInt) 2817 sym2 := auxToSym(v_0.Aux) 2818 y := v_0.Args[1] 2819 x := v_0.Args[0] 2820 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 2821 break 2822 } 2823 v.reset(Op386LEAL1) 2824 v.AuxInt = int32ToAuxInt(off1 + off2) 2825 v.Aux = symToAux(mergeSym(sym1, sym2)) 2826 v.AddArg2(x, y) 2827 return true 2828 } 2829 // match: (LEAL [off1] {sym1} (LEAL2 [off2] {sym2} x y)) 2830 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 2831 // result: (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y) 2832 for { 2833 off1 := auxIntToInt32(v.AuxInt) 2834 sym1 := auxToSym(v.Aux) 2835 if v_0.Op != Op386LEAL2 { 2836 break 2837 } 2838 off2 := auxIntToInt32(v_0.AuxInt) 2839 sym2 := auxToSym(v_0.Aux) 2840 y := v_0.Args[1] 2841 x := v_0.Args[0] 2842 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 2843 break 2844 } 2845 v.reset(Op386LEAL2) 2846 v.AuxInt = int32ToAuxInt(off1 + off2) 2847 v.Aux = symToAux(mergeSym(sym1, sym2)) 2848 v.AddArg2(x, y) 2849 return true 2850 } 2851 // match: (LEAL [off1] {sym1} (LEAL4 [off2] {sym2} x y)) 2852 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 2853 // result: (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y) 2854 for { 2855 off1 := auxIntToInt32(v.AuxInt) 2856 sym1 := auxToSym(v.Aux) 2857 if v_0.Op != Op386LEAL4 { 2858 break 2859 } 2860 off2 := auxIntToInt32(v_0.AuxInt) 2861 sym2 := auxToSym(v_0.Aux) 2862 y := v_0.Args[1] 2863 x := v_0.Args[0] 2864 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 2865 break 2866 } 2867 v.reset(Op386LEAL4) 2868 v.AuxInt = int32ToAuxInt(off1 + off2) 2869 v.Aux = symToAux(mergeSym(sym1, sym2)) 2870 v.AddArg2(x, y) 2871 return true 2872 } 2873 // match: (LEAL [off1] {sym1} (LEAL8 [off2] {sym2} x y)) 2874 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 2875 // result: (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y) 2876 for { 2877 off1 := auxIntToInt32(v.AuxInt) 2878 sym1 := auxToSym(v.Aux) 2879 if v_0.Op != Op386LEAL8 { 2880 break 2881 } 2882 off2 := auxIntToInt32(v_0.AuxInt) 2883 sym2 := auxToSym(v_0.Aux) 2884 y := v_0.Args[1] 2885 x := v_0.Args[0] 2886 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 2887 break 2888 } 2889 v.reset(Op386LEAL8) 2890 v.AuxInt = int32ToAuxInt(off1 + off2) 2891 v.Aux = symToAux(mergeSym(sym1, sym2)) 2892 v.AddArg2(x, y) 2893 return true 2894 } 2895 return false 2896 } 2897 func rewriteValue386_Op386LEAL1(v *Value) bool { 2898 v_1 := v.Args[1] 2899 v_0 := v.Args[0] 2900 // match: (LEAL1 [c] {s} (ADDLconst [d] x) y) 2901 // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB 2902 // result: (LEAL1 [c+d] {s} x y) 2903 for { 2904 c := auxIntToInt32(v.AuxInt) 2905 s := auxToSym(v.Aux) 2906 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 2907 if v_0.Op != Op386ADDLconst { 2908 continue 2909 } 2910 d := auxIntToInt32(v_0.AuxInt) 2911 x := v_0.Args[0] 2912 y := v_1 2913 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) { 2914 continue 2915 } 2916 v.reset(Op386LEAL1) 2917 v.AuxInt = int32ToAuxInt(c + d) 2918 v.Aux = symToAux(s) 2919 v.AddArg2(x, y) 2920 return true 2921 } 2922 break 2923 } 2924 // match: (LEAL1 [c] {s} x (SHLLconst [1] y)) 2925 // result: (LEAL2 [c] {s} x y) 2926 for { 2927 c := auxIntToInt32(v.AuxInt) 2928 s := auxToSym(v.Aux) 2929 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 2930 x := v_0 2931 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 { 2932 continue 2933 } 2934 y := v_1.Args[0] 2935 v.reset(Op386LEAL2) 2936 v.AuxInt = int32ToAuxInt(c) 2937 v.Aux = symToAux(s) 2938 v.AddArg2(x, y) 2939 return true 2940 } 2941 break 2942 } 2943 // match: (LEAL1 [c] {s} x (SHLLconst [2] y)) 2944 // result: (LEAL4 [c] {s} x y) 2945 for { 2946 c := auxIntToInt32(v.AuxInt) 2947 s := auxToSym(v.Aux) 2948 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 2949 x := v_0 2950 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 2 { 2951 continue 2952 } 2953 y := v_1.Args[0] 2954 v.reset(Op386LEAL4) 2955 v.AuxInt = int32ToAuxInt(c) 2956 v.Aux = symToAux(s) 2957 v.AddArg2(x, y) 2958 return true 2959 } 2960 break 2961 } 2962 // match: (LEAL1 [c] {s} x (SHLLconst [3] y)) 2963 // result: (LEAL8 [c] {s} x y) 2964 for { 2965 c := auxIntToInt32(v.AuxInt) 2966 s := auxToSym(v.Aux) 2967 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 2968 x := v_0 2969 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 3 { 2970 continue 2971 } 2972 y := v_1.Args[0] 2973 v.reset(Op386LEAL8) 2974 v.AuxInt = int32ToAuxInt(c) 2975 v.Aux = symToAux(s) 2976 v.AddArg2(x, y) 2977 return true 2978 } 2979 break 2980 } 2981 // match: (LEAL1 [off1] {sym1} (LEAL [off2] {sym2} x) y) 2982 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB 2983 // result: (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y) 2984 for { 2985 off1 := auxIntToInt32(v.AuxInt) 2986 sym1 := auxToSym(v.Aux) 2987 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 2988 if v_0.Op != Op386LEAL { 2989 continue 2990 } 2991 off2 := auxIntToInt32(v_0.AuxInt) 2992 sym2 := auxToSym(v_0.Aux) 2993 x := v_0.Args[0] 2994 y := v_1 2995 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) { 2996 continue 2997 } 2998 v.reset(Op386LEAL1) 2999 v.AuxInt = int32ToAuxInt(off1 + off2) 3000 v.Aux = symToAux(mergeSym(sym1, sym2)) 3001 v.AddArg2(x, y) 3002 return true 3003 } 3004 break 3005 } 3006 // match: (LEAL1 [off1] {sym1} x (LEAL1 [off2] {sym2} y y)) 3007 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 3008 // result: (LEAL2 [off1+off2] {mergeSym(sym1, sym2)} x y) 3009 for { 3010 off1 := auxIntToInt32(v.AuxInt) 3011 sym1 := auxToSym(v.Aux) 3012 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 3013 x := v_0 3014 if v_1.Op != Op386LEAL1 { 3015 continue 3016 } 3017 off2 := auxIntToInt32(v_1.AuxInt) 3018 sym2 := auxToSym(v_1.Aux) 3019 y := v_1.Args[1] 3020 if y != v_1.Args[0] || !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 3021 continue 3022 } 3023 v.reset(Op386LEAL2) 3024 v.AuxInt = int32ToAuxInt(off1 + off2) 3025 v.Aux = symToAux(mergeSym(sym1, sym2)) 3026 v.AddArg2(x, y) 3027 return true 3028 } 3029 break 3030 } 3031 // match: (LEAL1 [off1] {sym1} x (LEAL1 [off2] {sym2} x y)) 3032 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) 3033 // result: (LEAL2 [off1+off2] {mergeSym(sym1, sym2)} y x) 3034 for { 3035 off1 := auxIntToInt32(v.AuxInt) 3036 sym1 := auxToSym(v.Aux) 3037 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 3038 x := v_0 3039 if v_1.Op != Op386LEAL1 { 3040 continue 3041 } 3042 off2 := auxIntToInt32(v_1.AuxInt) 3043 sym2 := auxToSym(v_1.Aux) 3044 _ = v_1.Args[1] 3045 v_1_0 := v_1.Args[0] 3046 v_1_1 := v_1.Args[1] 3047 for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { 3048 if x != v_1_0 { 3049 continue 3050 } 3051 y := v_1_1 3052 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { 3053 continue 3054 } 3055 v.reset(Op386LEAL2) 3056 v.AuxInt = int32ToAuxInt(off1 + off2) 3057 v.Aux = symToAux(mergeSym(sym1, sym2)) 3058 v.AddArg2(y, x) 3059 return true 3060 } 3061 } 3062 break 3063 } 3064 // match: (LEAL1 [0] {nil} x y) 3065 // result: (ADDL x y) 3066 for { 3067 if auxIntToInt32(v.AuxInt) != 0 || auxToSym(v.Aux) != nil { 3068 break 3069 } 3070 x := v_0 3071 y := v_1 3072 v.reset(Op386ADDL) 3073 v.AddArg2(x, y) 3074 return true 3075 } 3076 return false 3077 } 3078 func rewriteValue386_Op386LEAL2(v *Value) bool { 3079 v_1 := v.Args[1] 3080 v_0 := v.Args[0] 3081 // match: (LEAL2 [c] {s} (ADDLconst [d] x) y) 3082 // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB 3083 // result: (LEAL2 [c+d] {s} x y) 3084 for { 3085 c := auxIntToInt32(v.AuxInt) 3086 s := auxToSym(v.Aux) 3087 if v_0.Op != Op386ADDLconst { 3088 break 3089 } 3090 d := auxIntToInt32(v_0.AuxInt) 3091 x := v_0.Args[0] 3092 y := v_1 3093 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) { 3094 break 3095 } 3096 v.reset(Op386LEAL2) 3097 v.AuxInt = int32ToAuxInt(c + d) 3098 v.Aux = symToAux(s) 3099 v.AddArg2(x, y) 3100 return true 3101 } 3102 // match: (LEAL2 [c] {s} x (ADDLconst [d] y)) 3103 // cond: is32Bit(int64(c)+2*int64(d)) && y.Op != OpSB 3104 // result: (LEAL2 [c+2*d] {s} x y) 3105 for { 3106 c := auxIntToInt32(v.AuxInt) 3107 s := auxToSym(v.Aux) 3108 x := v_0 3109 if v_1.Op != Op386ADDLconst { 3110 break 3111 } 3112 d := auxIntToInt32(v_1.AuxInt) 3113 y := v_1.Args[0] 3114 if !(is32Bit(int64(c)+2*int64(d)) && y.Op != OpSB) { 3115 break 3116 } 3117 v.reset(Op386LEAL2) 3118 v.AuxInt = int32ToAuxInt(c + 2*d) 3119 v.Aux = symToAux(s) 3120 v.AddArg2(x, y) 3121 return true 3122 } 3123 // match: (LEAL2 [c] {s} x (SHLLconst [1] y)) 3124 // result: (LEAL4 [c] {s} x y) 3125 for { 3126 c := auxIntToInt32(v.AuxInt) 3127 s := auxToSym(v.Aux) 3128 x := v_0 3129 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 { 3130 break 3131 } 3132 y := v_1.Args[0] 3133 v.reset(Op386LEAL4) 3134 v.AuxInt = int32ToAuxInt(c) 3135 v.Aux = symToAux(s) 3136 v.AddArg2(x, y) 3137 return true 3138 } 3139 // match: (LEAL2 [c] {s} x (SHLLconst [2] y)) 3140 // result: (LEAL8 [c] {s} x y) 3141 for { 3142 c := auxIntToInt32(v.AuxInt) 3143 s := auxToSym(v.Aux) 3144 x := v_0 3145 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 2 { 3146 break 3147 } 3148 y := v_1.Args[0] 3149 v.reset(Op386LEAL8) 3150 v.AuxInt = int32ToAuxInt(c) 3151 v.Aux = symToAux(s) 3152 v.AddArg2(x, y) 3153 return true 3154 } 3155 // match: (LEAL2 [off1] {sym1} (LEAL [off2] {sym2} x) y) 3156 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB 3157 // result: (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y) 3158 for { 3159 off1 := auxIntToInt32(v.AuxInt) 3160 sym1 := auxToSym(v.Aux) 3161 if v_0.Op != Op386LEAL { 3162 break 3163 } 3164 off2 := auxIntToInt32(v_0.AuxInt) 3165 sym2 := auxToSym(v_0.Aux) 3166 x := v_0.Args[0] 3167 y := v_1 3168 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) { 3169 break 3170 } 3171 v.reset(Op386LEAL2) 3172 v.AuxInt = int32ToAuxInt(off1 + off2) 3173 v.Aux = symToAux(mergeSym(sym1, sym2)) 3174 v.AddArg2(x, y) 3175 return true 3176 } 3177 // match: (LEAL2 [off1] {sym} x (LEAL1 [off2] {nil} y y)) 3178 // cond: is32Bit(int64(off1)+2*int64(off2)) 3179 // result: (LEAL4 [off1+2*off2] {sym} x y) 3180 for { 3181 off1 := auxIntToInt32(v.AuxInt) 3182 sym := auxToSym(v.Aux) 3183 x := v_0 3184 if v_1.Op != Op386LEAL1 { 3185 break 3186 } 3187 off2 := auxIntToInt32(v_1.AuxInt) 3188 if auxToSym(v_1.Aux) != nil { 3189 break 3190 } 3191 y := v_1.Args[1] 3192 if y != v_1.Args[0] || !(is32Bit(int64(off1) + 2*int64(off2))) { 3193 break 3194 } 3195 v.reset(Op386LEAL4) 3196 v.AuxInt = int32ToAuxInt(off1 + 2*off2) 3197 v.Aux = symToAux(sym) 3198 v.AddArg2(x, y) 3199 return true 3200 } 3201 return false 3202 } 3203 func rewriteValue386_Op386LEAL4(v *Value) bool { 3204 v_1 := v.Args[1] 3205 v_0 := v.Args[0] 3206 // match: (LEAL4 [c] {s} (ADDLconst [d] x) y) 3207 // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB 3208 // result: (LEAL4 [c+d] {s} x y) 3209 for { 3210 c := auxIntToInt32(v.AuxInt) 3211 s := auxToSym(v.Aux) 3212 if v_0.Op != Op386ADDLconst { 3213 break 3214 } 3215 d := auxIntToInt32(v_0.AuxInt) 3216 x := v_0.Args[0] 3217 y := v_1 3218 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) { 3219 break 3220 } 3221 v.reset(Op386LEAL4) 3222 v.AuxInt = int32ToAuxInt(c + d) 3223 v.Aux = symToAux(s) 3224 v.AddArg2(x, y) 3225 return true 3226 } 3227 // match: (LEAL4 [c] {s} x (ADDLconst [d] y)) 3228 // cond: is32Bit(int64(c)+4*int64(d)) && y.Op != OpSB 3229 // result: (LEAL4 [c+4*d] {s} x y) 3230 for { 3231 c := auxIntToInt32(v.AuxInt) 3232 s := auxToSym(v.Aux) 3233 x := v_0 3234 if v_1.Op != Op386ADDLconst { 3235 break 3236 } 3237 d := auxIntToInt32(v_1.AuxInt) 3238 y := v_1.Args[0] 3239 if !(is32Bit(int64(c)+4*int64(d)) && y.Op != OpSB) { 3240 break 3241 } 3242 v.reset(Op386LEAL4) 3243 v.AuxInt = int32ToAuxInt(c + 4*d) 3244 v.Aux = symToAux(s) 3245 v.AddArg2(x, y) 3246 return true 3247 } 3248 // match: (LEAL4 [c] {s} x (SHLLconst [1] y)) 3249 // result: (LEAL8 [c] {s} x y) 3250 for { 3251 c := auxIntToInt32(v.AuxInt) 3252 s := auxToSym(v.Aux) 3253 x := v_0 3254 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 { 3255 break 3256 } 3257 y := v_1.Args[0] 3258 v.reset(Op386LEAL8) 3259 v.AuxInt = int32ToAuxInt(c) 3260 v.Aux = symToAux(s) 3261 v.AddArg2(x, y) 3262 return true 3263 } 3264 // match: (LEAL4 [off1] {sym1} (LEAL [off2] {sym2} x) y) 3265 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB 3266 // result: (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y) 3267 for { 3268 off1 := auxIntToInt32(v.AuxInt) 3269 sym1 := auxToSym(v.Aux) 3270 if v_0.Op != Op386LEAL { 3271 break 3272 } 3273 off2 := auxIntToInt32(v_0.AuxInt) 3274 sym2 := auxToSym(v_0.Aux) 3275 x := v_0.Args[0] 3276 y := v_1 3277 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) { 3278 break 3279 } 3280 v.reset(Op386LEAL4) 3281 v.AuxInt = int32ToAuxInt(off1 + off2) 3282 v.Aux = symToAux(mergeSym(sym1, sym2)) 3283 v.AddArg2(x, y) 3284 return true 3285 } 3286 // match: (LEAL4 [off1] {sym} x (LEAL1 [off2] {nil} y y)) 3287 // cond: is32Bit(int64(off1)+4*int64(off2)) 3288 // result: (LEAL8 [off1+4*off2] {sym} x y) 3289 for { 3290 off1 := auxIntToInt32(v.AuxInt) 3291 sym := auxToSym(v.Aux) 3292 x := v_0 3293 if v_1.Op != Op386LEAL1 { 3294 break 3295 } 3296 off2 := auxIntToInt32(v_1.AuxInt) 3297 if auxToSym(v_1.Aux) != nil { 3298 break 3299 } 3300 y := v_1.Args[1] 3301 if y != v_1.Args[0] || !(is32Bit(int64(off1) + 4*int64(off2))) { 3302 break 3303 } 3304 v.reset(Op386LEAL8) 3305 v.AuxInt = int32ToAuxInt(off1 + 4*off2) 3306 v.Aux = symToAux(sym) 3307 v.AddArg2(x, y) 3308 return true 3309 } 3310 return false 3311 } 3312 func rewriteValue386_Op386LEAL8(v *Value) bool { 3313 v_1 := v.Args[1] 3314 v_0 := v.Args[0] 3315 // match: (LEAL8 [c] {s} (ADDLconst [d] x) y) 3316 // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB 3317 // result: (LEAL8 [c+d] {s} x y) 3318 for { 3319 c := auxIntToInt32(v.AuxInt) 3320 s := auxToSym(v.Aux) 3321 if v_0.Op != Op386ADDLconst { 3322 break 3323 } 3324 d := auxIntToInt32(v_0.AuxInt) 3325 x := v_0.Args[0] 3326 y := v_1 3327 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) { 3328 break 3329 } 3330 v.reset(Op386LEAL8) 3331 v.AuxInt = int32ToAuxInt(c + d) 3332 v.Aux = symToAux(s) 3333 v.AddArg2(x, y) 3334 return true 3335 } 3336 // match: (LEAL8 [c] {s} x (ADDLconst [d] y)) 3337 // cond: is32Bit(int64(c)+8*int64(d)) && y.Op != OpSB 3338 // result: (LEAL8 [c+8*d] {s} x y) 3339 for { 3340 c := auxIntToInt32(v.AuxInt) 3341 s := auxToSym(v.Aux) 3342 x := v_0 3343 if v_1.Op != Op386ADDLconst { 3344 break 3345 } 3346 d := auxIntToInt32(v_1.AuxInt) 3347 y := v_1.Args[0] 3348 if !(is32Bit(int64(c)+8*int64(d)) && y.Op != OpSB) { 3349 break 3350 } 3351 v.reset(Op386LEAL8) 3352 v.AuxInt = int32ToAuxInt(c + 8*d) 3353 v.Aux = symToAux(s) 3354 v.AddArg2(x, y) 3355 return true 3356 } 3357 // match: (LEAL8 [off1] {sym1} (LEAL [off2] {sym2} x) y) 3358 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB 3359 // result: (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y) 3360 for { 3361 off1 := auxIntToInt32(v.AuxInt) 3362 sym1 := auxToSym(v.Aux) 3363 if v_0.Op != Op386LEAL { 3364 break 3365 } 3366 off2 := auxIntToInt32(v_0.AuxInt) 3367 sym2 := auxToSym(v_0.Aux) 3368 x := v_0.Args[0] 3369 y := v_1 3370 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) { 3371 break 3372 } 3373 v.reset(Op386LEAL8) 3374 v.AuxInt = int32ToAuxInt(off1 + off2) 3375 v.Aux = symToAux(mergeSym(sym1, sym2)) 3376 v.AddArg2(x, y) 3377 return true 3378 } 3379 return false 3380 } 3381 func rewriteValue386_Op386MOVBLSX(v *Value) bool { 3382 v_0 := v.Args[0] 3383 b := v.Block 3384 // match: (MOVBLSX x:(MOVBload [off] {sym} ptr mem)) 3385 // cond: x.Uses == 1 && clobber(x) 3386 // result: @x.Block (MOVBLSXload <v.Type> [off] {sym} ptr mem) 3387 for { 3388 x := v_0 3389 if x.Op != Op386MOVBload { 3390 break 3391 } 3392 off := auxIntToInt32(x.AuxInt) 3393 sym := auxToSym(x.Aux) 3394 mem := x.Args[1] 3395 ptr := x.Args[0] 3396 if !(x.Uses == 1 && clobber(x)) { 3397 break 3398 } 3399 b = x.Block 3400 v0 := b.NewValue0(x.Pos, Op386MOVBLSXload, v.Type) 3401 v.copyOf(v0) 3402 v0.AuxInt = int32ToAuxInt(off) 3403 v0.Aux = symToAux(sym) 3404 v0.AddArg2(ptr, mem) 3405 return true 3406 } 3407 // match: (MOVBLSX (ANDLconst [c] x)) 3408 // cond: c & 0x80 == 0 3409 // result: (ANDLconst [c & 0x7f] x) 3410 for { 3411 if v_0.Op != Op386ANDLconst { 3412 break 3413 } 3414 c := auxIntToInt32(v_0.AuxInt) 3415 x := v_0.Args[0] 3416 if !(c&0x80 == 0) { 3417 break 3418 } 3419 v.reset(Op386ANDLconst) 3420 v.AuxInt = int32ToAuxInt(c & 0x7f) 3421 v.AddArg(x) 3422 return true 3423 } 3424 return false 3425 } 3426 func rewriteValue386_Op386MOVBLSXload(v *Value) bool { 3427 v_1 := v.Args[1] 3428 v_0 := v.Args[0] 3429 b := v.Block 3430 config := b.Func.Config 3431 // match: (MOVBLSXload [off] {sym} ptr (MOVBstore [off2] {sym2} ptr2 x _)) 3432 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) 3433 // result: (MOVBLSX x) 3434 for { 3435 off := auxIntToInt32(v.AuxInt) 3436 sym := auxToSym(v.Aux) 3437 ptr := v_0 3438 if v_1.Op != Op386MOVBstore { 3439 break 3440 } 3441 off2 := auxIntToInt32(v_1.AuxInt) 3442 sym2 := auxToSym(v_1.Aux) 3443 x := v_1.Args[1] 3444 ptr2 := v_1.Args[0] 3445 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) { 3446 break 3447 } 3448 v.reset(Op386MOVBLSX) 3449 v.AddArg(x) 3450 return true 3451 } 3452 // match: (MOVBLSXload [off1] {sym1} (LEAL [off2] {sym2} base) mem) 3453 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 3454 // result: (MOVBLSXload [off1+off2] {mergeSym(sym1,sym2)} base mem) 3455 for { 3456 off1 := auxIntToInt32(v.AuxInt) 3457 sym1 := auxToSym(v.Aux) 3458 if v_0.Op != Op386LEAL { 3459 break 3460 } 3461 off2 := auxIntToInt32(v_0.AuxInt) 3462 sym2 := auxToSym(v_0.Aux) 3463 base := v_0.Args[0] 3464 mem := v_1 3465 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 3466 break 3467 } 3468 v.reset(Op386MOVBLSXload) 3469 v.AuxInt = int32ToAuxInt(off1 + off2) 3470 v.Aux = symToAux(mergeSym(sym1, sym2)) 3471 v.AddArg2(base, mem) 3472 return true 3473 } 3474 return false 3475 } 3476 func rewriteValue386_Op386MOVBLZX(v *Value) bool { 3477 v_0 := v.Args[0] 3478 b := v.Block 3479 // match: (MOVBLZX x:(MOVBload [off] {sym} ptr mem)) 3480 // cond: x.Uses == 1 && clobber(x) 3481 // result: @x.Block (MOVBload <v.Type> [off] {sym} ptr mem) 3482 for { 3483 x := v_0 3484 if x.Op != Op386MOVBload { 3485 break 3486 } 3487 off := auxIntToInt32(x.AuxInt) 3488 sym := auxToSym(x.Aux) 3489 mem := x.Args[1] 3490 ptr := x.Args[0] 3491 if !(x.Uses == 1 && clobber(x)) { 3492 break 3493 } 3494 b = x.Block 3495 v0 := b.NewValue0(x.Pos, Op386MOVBload, v.Type) 3496 v.copyOf(v0) 3497 v0.AuxInt = int32ToAuxInt(off) 3498 v0.Aux = symToAux(sym) 3499 v0.AddArg2(ptr, mem) 3500 return true 3501 } 3502 // match: (MOVBLZX (ANDLconst [c] x)) 3503 // result: (ANDLconst [c & 0xff] x) 3504 for { 3505 if v_0.Op != Op386ANDLconst { 3506 break 3507 } 3508 c := auxIntToInt32(v_0.AuxInt) 3509 x := v_0.Args[0] 3510 v.reset(Op386ANDLconst) 3511 v.AuxInt = int32ToAuxInt(c & 0xff) 3512 v.AddArg(x) 3513 return true 3514 } 3515 return false 3516 } 3517 func rewriteValue386_Op386MOVBload(v *Value) bool { 3518 v_1 := v.Args[1] 3519 v_0 := v.Args[0] 3520 b := v.Block 3521 config := b.Func.Config 3522 // match: (MOVBload [off] {sym} ptr (MOVBstore [off2] {sym2} ptr2 x _)) 3523 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) 3524 // result: (MOVBLZX x) 3525 for { 3526 off := auxIntToInt32(v.AuxInt) 3527 sym := auxToSym(v.Aux) 3528 ptr := v_0 3529 if v_1.Op != Op386MOVBstore { 3530 break 3531 } 3532 off2 := auxIntToInt32(v_1.AuxInt) 3533 sym2 := auxToSym(v_1.Aux) 3534 x := v_1.Args[1] 3535 ptr2 := v_1.Args[0] 3536 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) { 3537 break 3538 } 3539 v.reset(Op386MOVBLZX) 3540 v.AddArg(x) 3541 return true 3542 } 3543 // match: (MOVBload [off1] {sym} (ADDLconst [off2] ptr) mem) 3544 // cond: is32Bit(int64(off1)+int64(off2)) 3545 // result: (MOVBload [off1+off2] {sym} ptr mem) 3546 for { 3547 off1 := auxIntToInt32(v.AuxInt) 3548 sym := auxToSym(v.Aux) 3549 if v_0.Op != Op386ADDLconst { 3550 break 3551 } 3552 off2 := auxIntToInt32(v_0.AuxInt) 3553 ptr := v_0.Args[0] 3554 mem := v_1 3555 if !(is32Bit(int64(off1) + int64(off2))) { 3556 break 3557 } 3558 v.reset(Op386MOVBload) 3559 v.AuxInt = int32ToAuxInt(off1 + off2) 3560 v.Aux = symToAux(sym) 3561 v.AddArg2(ptr, mem) 3562 return true 3563 } 3564 // match: (MOVBload [off1] {sym1} (LEAL [off2] {sym2} base) mem) 3565 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 3566 // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem) 3567 for { 3568 off1 := auxIntToInt32(v.AuxInt) 3569 sym1 := auxToSym(v.Aux) 3570 if v_0.Op != Op386LEAL { 3571 break 3572 } 3573 off2 := auxIntToInt32(v_0.AuxInt) 3574 sym2 := auxToSym(v_0.Aux) 3575 base := v_0.Args[0] 3576 mem := v_1 3577 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 3578 break 3579 } 3580 v.reset(Op386MOVBload) 3581 v.AuxInt = int32ToAuxInt(off1 + off2) 3582 v.Aux = symToAux(mergeSym(sym1, sym2)) 3583 v.AddArg2(base, mem) 3584 return true 3585 } 3586 // match: (MOVBload [off] {sym} (SB) _) 3587 // cond: symIsRO(sym) 3588 // result: (MOVLconst [int32(read8(sym, int64(off)))]) 3589 for { 3590 off := auxIntToInt32(v.AuxInt) 3591 sym := auxToSym(v.Aux) 3592 if v_0.Op != OpSB || !(symIsRO(sym)) { 3593 break 3594 } 3595 v.reset(Op386MOVLconst) 3596 v.AuxInt = int32ToAuxInt(int32(read8(sym, int64(off)))) 3597 return true 3598 } 3599 return false 3600 } 3601 func rewriteValue386_Op386MOVBstore(v *Value) bool { 3602 v_2 := v.Args[2] 3603 v_1 := v.Args[1] 3604 v_0 := v.Args[0] 3605 b := v.Block 3606 config := b.Func.Config 3607 // match: (MOVBstore [off] {sym} ptr (MOVBLSX x) mem) 3608 // result: (MOVBstore [off] {sym} ptr x mem) 3609 for { 3610 off := auxIntToInt32(v.AuxInt) 3611 sym := auxToSym(v.Aux) 3612 ptr := v_0 3613 if v_1.Op != Op386MOVBLSX { 3614 break 3615 } 3616 x := v_1.Args[0] 3617 mem := v_2 3618 v.reset(Op386MOVBstore) 3619 v.AuxInt = int32ToAuxInt(off) 3620 v.Aux = symToAux(sym) 3621 v.AddArg3(ptr, x, mem) 3622 return true 3623 } 3624 // match: (MOVBstore [off] {sym} ptr (MOVBLZX x) mem) 3625 // result: (MOVBstore [off] {sym} ptr x mem) 3626 for { 3627 off := auxIntToInt32(v.AuxInt) 3628 sym := auxToSym(v.Aux) 3629 ptr := v_0 3630 if v_1.Op != Op386MOVBLZX { 3631 break 3632 } 3633 x := v_1.Args[0] 3634 mem := v_2 3635 v.reset(Op386MOVBstore) 3636 v.AuxInt = int32ToAuxInt(off) 3637 v.Aux = symToAux(sym) 3638 v.AddArg3(ptr, x, mem) 3639 return true 3640 } 3641 // match: (MOVBstore [off1] {sym} (ADDLconst [off2] ptr) val mem) 3642 // cond: is32Bit(int64(off1)+int64(off2)) 3643 // result: (MOVBstore [off1+off2] {sym} ptr val mem) 3644 for { 3645 off1 := auxIntToInt32(v.AuxInt) 3646 sym := auxToSym(v.Aux) 3647 if v_0.Op != Op386ADDLconst { 3648 break 3649 } 3650 off2 := auxIntToInt32(v_0.AuxInt) 3651 ptr := v_0.Args[0] 3652 val := v_1 3653 mem := v_2 3654 if !(is32Bit(int64(off1) + int64(off2))) { 3655 break 3656 } 3657 v.reset(Op386MOVBstore) 3658 v.AuxInt = int32ToAuxInt(off1 + off2) 3659 v.Aux = symToAux(sym) 3660 v.AddArg3(ptr, val, mem) 3661 return true 3662 } 3663 // match: (MOVBstore [off] {sym} ptr (MOVLconst [c]) mem) 3664 // result: (MOVBstoreconst [makeValAndOff(c,off)] {sym} ptr mem) 3665 for { 3666 off := auxIntToInt32(v.AuxInt) 3667 sym := auxToSym(v.Aux) 3668 ptr := v_0 3669 if v_1.Op != Op386MOVLconst { 3670 break 3671 } 3672 c := auxIntToInt32(v_1.AuxInt) 3673 mem := v_2 3674 v.reset(Op386MOVBstoreconst) 3675 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off)) 3676 v.Aux = symToAux(sym) 3677 v.AddArg2(ptr, mem) 3678 return true 3679 } 3680 // match: (MOVBstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 3681 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 3682 // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 3683 for { 3684 off1 := auxIntToInt32(v.AuxInt) 3685 sym1 := auxToSym(v.Aux) 3686 if v_0.Op != Op386LEAL { 3687 break 3688 } 3689 off2 := auxIntToInt32(v_0.AuxInt) 3690 sym2 := auxToSym(v_0.Aux) 3691 base := v_0.Args[0] 3692 val := v_1 3693 mem := v_2 3694 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 3695 break 3696 } 3697 v.reset(Op386MOVBstore) 3698 v.AuxInt = int32ToAuxInt(off1 + off2) 3699 v.Aux = symToAux(mergeSym(sym1, sym2)) 3700 v.AddArg3(base, val, mem) 3701 return true 3702 } 3703 // match: (MOVBstore [i] {s} p (SHRWconst [8] w) x:(MOVBstore [i-1] {s} p w mem)) 3704 // cond: x.Uses == 1 && clobber(x) 3705 // result: (MOVWstore [i-1] {s} p w mem) 3706 for { 3707 i := auxIntToInt32(v.AuxInt) 3708 s := auxToSym(v.Aux) 3709 p := v_0 3710 if v_1.Op != Op386SHRWconst || auxIntToInt16(v_1.AuxInt) != 8 { 3711 break 3712 } 3713 w := v_1.Args[0] 3714 x := v_2 3715 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 3716 break 3717 } 3718 mem := x.Args[2] 3719 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) { 3720 break 3721 } 3722 v.reset(Op386MOVWstore) 3723 v.AuxInt = int32ToAuxInt(i - 1) 3724 v.Aux = symToAux(s) 3725 v.AddArg3(p, w, mem) 3726 return true 3727 } 3728 // match: (MOVBstore [i] {s} p (SHRLconst [8] w) x:(MOVBstore [i-1] {s} p w mem)) 3729 // cond: x.Uses == 1 && clobber(x) 3730 // result: (MOVWstore [i-1] {s} p w mem) 3731 for { 3732 i := auxIntToInt32(v.AuxInt) 3733 s := auxToSym(v.Aux) 3734 p := v_0 3735 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 8 { 3736 break 3737 } 3738 w := v_1.Args[0] 3739 x := v_2 3740 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 3741 break 3742 } 3743 mem := x.Args[2] 3744 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) { 3745 break 3746 } 3747 v.reset(Op386MOVWstore) 3748 v.AuxInt = int32ToAuxInt(i - 1) 3749 v.Aux = symToAux(s) 3750 v.AddArg3(p, w, mem) 3751 return true 3752 } 3753 // match: (MOVBstore [i] {s} p w x:(MOVBstore {s} [i+1] p (SHRWconst [8] w) mem)) 3754 // cond: x.Uses == 1 && clobber(x) 3755 // result: (MOVWstore [i] {s} p w mem) 3756 for { 3757 i := auxIntToInt32(v.AuxInt) 3758 s := auxToSym(v.Aux) 3759 p := v_0 3760 w := v_1 3761 x := v_2 3762 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i+1 || auxToSym(x.Aux) != s { 3763 break 3764 } 3765 mem := x.Args[2] 3766 if p != x.Args[0] { 3767 break 3768 } 3769 x_1 := x.Args[1] 3770 if x_1.Op != Op386SHRWconst || auxIntToInt16(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && clobber(x)) { 3771 break 3772 } 3773 v.reset(Op386MOVWstore) 3774 v.AuxInt = int32ToAuxInt(i) 3775 v.Aux = symToAux(s) 3776 v.AddArg3(p, w, mem) 3777 return true 3778 } 3779 // match: (MOVBstore [i] {s} p w x:(MOVBstore {s} [i+1] p (SHRLconst [8] w) mem)) 3780 // cond: x.Uses == 1 && clobber(x) 3781 // result: (MOVWstore [i] {s} p w mem) 3782 for { 3783 i := auxIntToInt32(v.AuxInt) 3784 s := auxToSym(v.Aux) 3785 p := v_0 3786 w := v_1 3787 x := v_2 3788 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i+1 || auxToSym(x.Aux) != s { 3789 break 3790 } 3791 mem := x.Args[2] 3792 if p != x.Args[0] { 3793 break 3794 } 3795 x_1 := x.Args[1] 3796 if x_1.Op != Op386SHRLconst || auxIntToInt32(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && clobber(x)) { 3797 break 3798 } 3799 v.reset(Op386MOVWstore) 3800 v.AuxInt = int32ToAuxInt(i) 3801 v.Aux = symToAux(s) 3802 v.AddArg3(p, w, mem) 3803 return true 3804 } 3805 // match: (MOVBstore [i] {s} p (SHRLconst [j] w) x:(MOVBstore [i-1] {s} p w0:(SHRLconst [j-8] w) mem)) 3806 // cond: x.Uses == 1 && clobber(x) 3807 // result: (MOVWstore [i-1] {s} p w0 mem) 3808 for { 3809 i := auxIntToInt32(v.AuxInt) 3810 s := auxToSym(v.Aux) 3811 p := v_0 3812 if v_1.Op != Op386SHRLconst { 3813 break 3814 } 3815 j := auxIntToInt32(v_1.AuxInt) 3816 w := v_1.Args[0] 3817 x := v_2 3818 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { 3819 break 3820 } 3821 mem := x.Args[2] 3822 if p != x.Args[0] { 3823 break 3824 } 3825 w0 := x.Args[1] 3826 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-8 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { 3827 break 3828 } 3829 v.reset(Op386MOVWstore) 3830 v.AuxInt = int32ToAuxInt(i - 1) 3831 v.Aux = symToAux(s) 3832 v.AddArg3(p, w0, mem) 3833 return true 3834 } 3835 // match: (MOVBstore [i] {s} p1 (SHRWconst [8] w) x:(MOVBstore [i] {s} p0 w mem)) 3836 // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x) 3837 // result: (MOVWstore [i] {s} p0 w mem) 3838 for { 3839 i := auxIntToInt32(v.AuxInt) 3840 s := auxToSym(v.Aux) 3841 p1 := v_0 3842 if v_1.Op != Op386SHRWconst || auxIntToInt16(v_1.AuxInt) != 8 { 3843 break 3844 } 3845 w := v_1.Args[0] 3846 x := v_2 3847 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s { 3848 break 3849 } 3850 mem := x.Args[2] 3851 p0 := x.Args[0] 3852 if w != x.Args[1] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) { 3853 break 3854 } 3855 v.reset(Op386MOVWstore) 3856 v.AuxInt = int32ToAuxInt(i) 3857 v.Aux = symToAux(s) 3858 v.AddArg3(p0, w, mem) 3859 return true 3860 } 3861 // match: (MOVBstore [i] {s} p1 (SHRLconst [8] w) x:(MOVBstore [i] {s} p0 w mem)) 3862 // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x) 3863 // result: (MOVWstore [i] {s} p0 w mem) 3864 for { 3865 i := auxIntToInt32(v.AuxInt) 3866 s := auxToSym(v.Aux) 3867 p1 := v_0 3868 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 8 { 3869 break 3870 } 3871 w := v_1.Args[0] 3872 x := v_2 3873 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s { 3874 break 3875 } 3876 mem := x.Args[2] 3877 p0 := x.Args[0] 3878 if w != x.Args[1] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) { 3879 break 3880 } 3881 v.reset(Op386MOVWstore) 3882 v.AuxInt = int32ToAuxInt(i) 3883 v.Aux = symToAux(s) 3884 v.AddArg3(p0, w, mem) 3885 return true 3886 } 3887 // match: (MOVBstore [i] {s} p0 w x:(MOVBstore {s} [i] p1 (SHRWconst [8] w) mem)) 3888 // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x) 3889 // result: (MOVWstore [i] {s} p0 w mem) 3890 for { 3891 i := auxIntToInt32(v.AuxInt) 3892 s := auxToSym(v.Aux) 3893 p0 := v_0 3894 w := v_1 3895 x := v_2 3896 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s { 3897 break 3898 } 3899 mem := x.Args[2] 3900 p1 := x.Args[0] 3901 x_1 := x.Args[1] 3902 if x_1.Op != Op386SHRWconst || auxIntToInt16(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) { 3903 break 3904 } 3905 v.reset(Op386MOVWstore) 3906 v.AuxInt = int32ToAuxInt(i) 3907 v.Aux = symToAux(s) 3908 v.AddArg3(p0, w, mem) 3909 return true 3910 } 3911 // match: (MOVBstore [i] {s} p0 w x:(MOVBstore {s} [i] p1 (SHRLconst [8] w) mem)) 3912 // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x) 3913 // result: (MOVWstore [i] {s} p0 w mem) 3914 for { 3915 i := auxIntToInt32(v.AuxInt) 3916 s := auxToSym(v.Aux) 3917 p0 := v_0 3918 w := v_1 3919 x := v_2 3920 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s { 3921 break 3922 } 3923 mem := x.Args[2] 3924 p1 := x.Args[0] 3925 x_1 := x.Args[1] 3926 if x_1.Op != Op386SHRLconst || auxIntToInt32(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) { 3927 break 3928 } 3929 v.reset(Op386MOVWstore) 3930 v.AuxInt = int32ToAuxInt(i) 3931 v.Aux = symToAux(s) 3932 v.AddArg3(p0, w, mem) 3933 return true 3934 } 3935 // match: (MOVBstore [i] {s} p1 (SHRLconst [j] w) x:(MOVBstore [i] {s} p0 w0:(SHRLconst [j-8] w) mem)) 3936 // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x) 3937 // result: (MOVWstore [i] {s} p0 w0 mem) 3938 for { 3939 i := auxIntToInt32(v.AuxInt) 3940 s := auxToSym(v.Aux) 3941 p1 := v_0 3942 if v_1.Op != Op386SHRLconst { 3943 break 3944 } 3945 j := auxIntToInt32(v_1.AuxInt) 3946 w := v_1.Args[0] 3947 x := v_2 3948 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s { 3949 break 3950 } 3951 mem := x.Args[2] 3952 p0 := x.Args[0] 3953 w0 := x.Args[1] 3954 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-8 || w != w0.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) { 3955 break 3956 } 3957 v.reset(Op386MOVWstore) 3958 v.AuxInt = int32ToAuxInt(i) 3959 v.Aux = symToAux(s) 3960 v.AddArg3(p0, w0, mem) 3961 return true 3962 } 3963 return false 3964 } 3965 func rewriteValue386_Op386MOVBstoreconst(v *Value) bool { 3966 v_1 := v.Args[1] 3967 v_0 := v.Args[0] 3968 b := v.Block 3969 config := b.Func.Config 3970 // match: (MOVBstoreconst [sc] {s} (ADDLconst [off] ptr) mem) 3971 // cond: sc.canAdd32(off) 3972 // result: (MOVBstoreconst [sc.addOffset32(off)] {s} ptr mem) 3973 for { 3974 sc := auxIntToValAndOff(v.AuxInt) 3975 s := auxToSym(v.Aux) 3976 if v_0.Op != Op386ADDLconst { 3977 break 3978 } 3979 off := auxIntToInt32(v_0.AuxInt) 3980 ptr := v_0.Args[0] 3981 mem := v_1 3982 if !(sc.canAdd32(off)) { 3983 break 3984 } 3985 v.reset(Op386MOVBstoreconst) 3986 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 3987 v.Aux = symToAux(s) 3988 v.AddArg2(ptr, mem) 3989 return true 3990 } 3991 // match: (MOVBstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem) 3992 // cond: canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared) 3993 // result: (MOVBstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 3994 for { 3995 sc := auxIntToValAndOff(v.AuxInt) 3996 sym1 := auxToSym(v.Aux) 3997 if v_0.Op != Op386LEAL { 3998 break 3999 } 4000 off := auxIntToInt32(v_0.AuxInt) 4001 sym2 := auxToSym(v_0.Aux) 4002 ptr := v_0.Args[0] 4003 mem := v_1 4004 if !(canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) { 4005 break 4006 } 4007 v.reset(Op386MOVBstoreconst) 4008 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 4009 v.Aux = symToAux(mergeSym(sym1, sym2)) 4010 v.AddArg2(ptr, mem) 4011 return true 4012 } 4013 // match: (MOVBstoreconst [c] {s} p x:(MOVBstoreconst [a] {s} p mem)) 4014 // cond: x.Uses == 1 && a.Off() + 1 == c.Off() && clobber(x) 4015 // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p mem) 4016 for { 4017 c := auxIntToValAndOff(v.AuxInt) 4018 s := auxToSym(v.Aux) 4019 p := v_0 4020 x := v_1 4021 if x.Op != Op386MOVBstoreconst { 4022 break 4023 } 4024 a := auxIntToValAndOff(x.AuxInt) 4025 if auxToSym(x.Aux) != s { 4026 break 4027 } 4028 mem := x.Args[1] 4029 if p != x.Args[0] || !(x.Uses == 1 && a.Off()+1 == c.Off() && clobber(x)) { 4030 break 4031 } 4032 v.reset(Op386MOVWstoreconst) 4033 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off())) 4034 v.Aux = symToAux(s) 4035 v.AddArg2(p, mem) 4036 return true 4037 } 4038 // match: (MOVBstoreconst [a] {s} p x:(MOVBstoreconst [c] {s} p mem)) 4039 // cond: x.Uses == 1 && a.Off() + 1 == c.Off() && clobber(x) 4040 // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p mem) 4041 for { 4042 a := auxIntToValAndOff(v.AuxInt) 4043 s := auxToSym(v.Aux) 4044 p := v_0 4045 x := v_1 4046 if x.Op != Op386MOVBstoreconst { 4047 break 4048 } 4049 c := auxIntToValAndOff(x.AuxInt) 4050 if auxToSym(x.Aux) != s { 4051 break 4052 } 4053 mem := x.Args[1] 4054 if p != x.Args[0] || !(x.Uses == 1 && a.Off()+1 == c.Off() && clobber(x)) { 4055 break 4056 } 4057 v.reset(Op386MOVWstoreconst) 4058 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off())) 4059 v.Aux = symToAux(s) 4060 v.AddArg2(p, mem) 4061 return true 4062 } 4063 // match: (MOVBstoreconst [c] {s} p1 x:(MOVBstoreconst [a] {s} p0 mem)) 4064 // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x) 4065 // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p0 mem) 4066 for { 4067 c := auxIntToValAndOff(v.AuxInt) 4068 s := auxToSym(v.Aux) 4069 p1 := v_0 4070 x := v_1 4071 if x.Op != Op386MOVBstoreconst { 4072 break 4073 } 4074 a := auxIntToValAndOff(x.AuxInt) 4075 if auxToSym(x.Aux) != s { 4076 break 4077 } 4078 mem := x.Args[1] 4079 p0 := x.Args[0] 4080 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)) { 4081 break 4082 } 4083 v.reset(Op386MOVWstoreconst) 4084 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off())) 4085 v.Aux = symToAux(s) 4086 v.AddArg2(p0, mem) 4087 return true 4088 } 4089 // match: (MOVBstoreconst [a] {s} p0 x:(MOVBstoreconst [c] {s} p1 mem)) 4090 // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x) 4091 // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p0 mem) 4092 for { 4093 a := auxIntToValAndOff(v.AuxInt) 4094 s := auxToSym(v.Aux) 4095 p0 := v_0 4096 x := v_1 4097 if x.Op != Op386MOVBstoreconst { 4098 break 4099 } 4100 c := auxIntToValAndOff(x.AuxInt) 4101 if auxToSym(x.Aux) != s { 4102 break 4103 } 4104 mem := x.Args[1] 4105 p1 := x.Args[0] 4106 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)) { 4107 break 4108 } 4109 v.reset(Op386MOVWstoreconst) 4110 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off())) 4111 v.Aux = symToAux(s) 4112 v.AddArg2(p0, mem) 4113 return true 4114 } 4115 return false 4116 } 4117 func rewriteValue386_Op386MOVLload(v *Value) bool { 4118 v_1 := v.Args[1] 4119 v_0 := v.Args[0] 4120 b := v.Block 4121 config := b.Func.Config 4122 // match: (MOVLload [off] {sym} ptr (MOVLstore [off2] {sym2} ptr2 x _)) 4123 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) 4124 // result: x 4125 for { 4126 off := auxIntToInt32(v.AuxInt) 4127 sym := auxToSym(v.Aux) 4128 ptr := v_0 4129 if v_1.Op != Op386MOVLstore { 4130 break 4131 } 4132 off2 := auxIntToInt32(v_1.AuxInt) 4133 sym2 := auxToSym(v_1.Aux) 4134 x := v_1.Args[1] 4135 ptr2 := v_1.Args[0] 4136 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) { 4137 break 4138 } 4139 v.copyOf(x) 4140 return true 4141 } 4142 // match: (MOVLload [off1] {sym} (ADDLconst [off2] ptr) mem) 4143 // cond: is32Bit(int64(off1)+int64(off2)) 4144 // result: (MOVLload [off1+off2] {sym} ptr mem) 4145 for { 4146 off1 := auxIntToInt32(v.AuxInt) 4147 sym := auxToSym(v.Aux) 4148 if v_0.Op != Op386ADDLconst { 4149 break 4150 } 4151 off2 := auxIntToInt32(v_0.AuxInt) 4152 ptr := v_0.Args[0] 4153 mem := v_1 4154 if !(is32Bit(int64(off1) + int64(off2))) { 4155 break 4156 } 4157 v.reset(Op386MOVLload) 4158 v.AuxInt = int32ToAuxInt(off1 + off2) 4159 v.Aux = symToAux(sym) 4160 v.AddArg2(ptr, mem) 4161 return true 4162 } 4163 // match: (MOVLload [off1] {sym1} (LEAL [off2] {sym2} base) mem) 4164 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 4165 // result: (MOVLload [off1+off2] {mergeSym(sym1,sym2)} base mem) 4166 for { 4167 off1 := auxIntToInt32(v.AuxInt) 4168 sym1 := auxToSym(v.Aux) 4169 if v_0.Op != Op386LEAL { 4170 break 4171 } 4172 off2 := auxIntToInt32(v_0.AuxInt) 4173 sym2 := auxToSym(v_0.Aux) 4174 base := v_0.Args[0] 4175 mem := v_1 4176 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 4177 break 4178 } 4179 v.reset(Op386MOVLload) 4180 v.AuxInt = int32ToAuxInt(off1 + off2) 4181 v.Aux = symToAux(mergeSym(sym1, sym2)) 4182 v.AddArg2(base, mem) 4183 return true 4184 } 4185 // match: (MOVLload [off] {sym} (SB) _) 4186 // cond: symIsRO(sym) 4187 // result: (MOVLconst [int32(read32(sym, int64(off), config.ctxt.Arch.ByteOrder))]) 4188 for { 4189 off := auxIntToInt32(v.AuxInt) 4190 sym := auxToSym(v.Aux) 4191 if v_0.Op != OpSB || !(symIsRO(sym)) { 4192 break 4193 } 4194 v.reset(Op386MOVLconst) 4195 v.AuxInt = int32ToAuxInt(int32(read32(sym, int64(off), config.ctxt.Arch.ByteOrder))) 4196 return true 4197 } 4198 return false 4199 } 4200 func rewriteValue386_Op386MOVLstore(v *Value) bool { 4201 v_2 := v.Args[2] 4202 v_1 := v.Args[1] 4203 v_0 := v.Args[0] 4204 b := v.Block 4205 config := b.Func.Config 4206 // match: (MOVLstore [off1] {sym} (ADDLconst [off2] ptr) val mem) 4207 // cond: is32Bit(int64(off1)+int64(off2)) 4208 // result: (MOVLstore [off1+off2] {sym} ptr val mem) 4209 for { 4210 off1 := auxIntToInt32(v.AuxInt) 4211 sym := auxToSym(v.Aux) 4212 if v_0.Op != Op386ADDLconst { 4213 break 4214 } 4215 off2 := auxIntToInt32(v_0.AuxInt) 4216 ptr := v_0.Args[0] 4217 val := v_1 4218 mem := v_2 4219 if !(is32Bit(int64(off1) + int64(off2))) { 4220 break 4221 } 4222 v.reset(Op386MOVLstore) 4223 v.AuxInt = int32ToAuxInt(off1 + off2) 4224 v.Aux = symToAux(sym) 4225 v.AddArg3(ptr, val, mem) 4226 return true 4227 } 4228 // match: (MOVLstore [off] {sym} ptr (MOVLconst [c]) mem) 4229 // result: (MOVLstoreconst [makeValAndOff(c,off)] {sym} ptr mem) 4230 for { 4231 off := auxIntToInt32(v.AuxInt) 4232 sym := auxToSym(v.Aux) 4233 ptr := v_0 4234 if v_1.Op != Op386MOVLconst { 4235 break 4236 } 4237 c := auxIntToInt32(v_1.AuxInt) 4238 mem := v_2 4239 v.reset(Op386MOVLstoreconst) 4240 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off)) 4241 v.Aux = symToAux(sym) 4242 v.AddArg2(ptr, mem) 4243 return true 4244 } 4245 // match: (MOVLstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 4246 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 4247 // result: (MOVLstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 4248 for { 4249 off1 := auxIntToInt32(v.AuxInt) 4250 sym1 := auxToSym(v.Aux) 4251 if v_0.Op != Op386LEAL { 4252 break 4253 } 4254 off2 := auxIntToInt32(v_0.AuxInt) 4255 sym2 := auxToSym(v_0.Aux) 4256 base := v_0.Args[0] 4257 val := v_1 4258 mem := v_2 4259 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 4260 break 4261 } 4262 v.reset(Op386MOVLstore) 4263 v.AuxInt = int32ToAuxInt(off1 + off2) 4264 v.Aux = symToAux(mergeSym(sym1, sym2)) 4265 v.AddArg3(base, val, mem) 4266 return true 4267 } 4268 // match: (MOVLstore {sym} [off] ptr y:(ADDLload x [off] {sym} ptr mem) mem) 4269 // cond: y.Uses==1 && clobber(y) 4270 // result: (ADDLmodify [off] {sym} ptr x mem) 4271 for { 4272 off := auxIntToInt32(v.AuxInt) 4273 sym := auxToSym(v.Aux) 4274 ptr := v_0 4275 y := v_1 4276 if y.Op != Op386ADDLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym { 4277 break 4278 } 4279 mem := y.Args[2] 4280 x := y.Args[0] 4281 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) { 4282 break 4283 } 4284 v.reset(Op386ADDLmodify) 4285 v.AuxInt = int32ToAuxInt(off) 4286 v.Aux = symToAux(sym) 4287 v.AddArg3(ptr, x, mem) 4288 return true 4289 } 4290 // match: (MOVLstore {sym} [off] ptr y:(ANDLload x [off] {sym} ptr mem) mem) 4291 // cond: y.Uses==1 && clobber(y) 4292 // result: (ANDLmodify [off] {sym} ptr x mem) 4293 for { 4294 off := auxIntToInt32(v.AuxInt) 4295 sym := auxToSym(v.Aux) 4296 ptr := v_0 4297 y := v_1 4298 if y.Op != Op386ANDLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym { 4299 break 4300 } 4301 mem := y.Args[2] 4302 x := y.Args[0] 4303 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) { 4304 break 4305 } 4306 v.reset(Op386ANDLmodify) 4307 v.AuxInt = int32ToAuxInt(off) 4308 v.Aux = symToAux(sym) 4309 v.AddArg3(ptr, x, mem) 4310 return true 4311 } 4312 // match: (MOVLstore {sym} [off] ptr y:(ORLload x [off] {sym} ptr mem) mem) 4313 // cond: y.Uses==1 && clobber(y) 4314 // result: (ORLmodify [off] {sym} ptr x mem) 4315 for { 4316 off := auxIntToInt32(v.AuxInt) 4317 sym := auxToSym(v.Aux) 4318 ptr := v_0 4319 y := v_1 4320 if y.Op != Op386ORLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym { 4321 break 4322 } 4323 mem := y.Args[2] 4324 x := y.Args[0] 4325 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) { 4326 break 4327 } 4328 v.reset(Op386ORLmodify) 4329 v.AuxInt = int32ToAuxInt(off) 4330 v.Aux = symToAux(sym) 4331 v.AddArg3(ptr, x, mem) 4332 return true 4333 } 4334 // match: (MOVLstore {sym} [off] ptr y:(XORLload x [off] {sym} ptr mem) mem) 4335 // cond: y.Uses==1 && clobber(y) 4336 // result: (XORLmodify [off] {sym} ptr x mem) 4337 for { 4338 off := auxIntToInt32(v.AuxInt) 4339 sym := auxToSym(v.Aux) 4340 ptr := v_0 4341 y := v_1 4342 if y.Op != Op386XORLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym { 4343 break 4344 } 4345 mem := y.Args[2] 4346 x := y.Args[0] 4347 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) { 4348 break 4349 } 4350 v.reset(Op386XORLmodify) 4351 v.AuxInt = int32ToAuxInt(off) 4352 v.Aux = symToAux(sym) 4353 v.AddArg3(ptr, x, mem) 4354 return true 4355 } 4356 // match: (MOVLstore {sym} [off] ptr y:(ADDL l:(MOVLload [off] {sym} ptr mem) x) mem) 4357 // cond: y.Uses==1 && l.Uses==1 && clobber(y, l) 4358 // result: (ADDLmodify [off] {sym} ptr x mem) 4359 for { 4360 off := auxIntToInt32(v.AuxInt) 4361 sym := auxToSym(v.Aux) 4362 ptr := v_0 4363 y := v_1 4364 if y.Op != Op386ADDL { 4365 break 4366 } 4367 _ = y.Args[1] 4368 y_0 := y.Args[0] 4369 y_1 := y.Args[1] 4370 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 { 4371 l := y_0 4372 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym { 4373 continue 4374 } 4375 mem := l.Args[1] 4376 if ptr != l.Args[0] { 4377 continue 4378 } 4379 x := y_1 4380 if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) { 4381 continue 4382 } 4383 v.reset(Op386ADDLmodify) 4384 v.AuxInt = int32ToAuxInt(off) 4385 v.Aux = symToAux(sym) 4386 v.AddArg3(ptr, x, mem) 4387 return true 4388 } 4389 break 4390 } 4391 // match: (MOVLstore {sym} [off] ptr y:(SUBL l:(MOVLload [off] {sym} ptr mem) x) mem) 4392 // cond: y.Uses==1 && l.Uses==1 && clobber(y, l) 4393 // result: (SUBLmodify [off] {sym} ptr x mem) 4394 for { 4395 off := auxIntToInt32(v.AuxInt) 4396 sym := auxToSym(v.Aux) 4397 ptr := v_0 4398 y := v_1 4399 if y.Op != Op386SUBL { 4400 break 4401 } 4402 x := y.Args[1] 4403 l := y.Args[0] 4404 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym { 4405 break 4406 } 4407 mem := l.Args[1] 4408 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) { 4409 break 4410 } 4411 v.reset(Op386SUBLmodify) 4412 v.AuxInt = int32ToAuxInt(off) 4413 v.Aux = symToAux(sym) 4414 v.AddArg3(ptr, x, mem) 4415 return true 4416 } 4417 // match: (MOVLstore {sym} [off] ptr y:(ANDL l:(MOVLload [off] {sym} ptr mem) x) mem) 4418 // cond: y.Uses==1 && l.Uses==1 && clobber(y, l) 4419 // result: (ANDLmodify [off] {sym} ptr x mem) 4420 for { 4421 off := auxIntToInt32(v.AuxInt) 4422 sym := auxToSym(v.Aux) 4423 ptr := v_0 4424 y := v_1 4425 if y.Op != Op386ANDL { 4426 break 4427 } 4428 _ = y.Args[1] 4429 y_0 := y.Args[0] 4430 y_1 := y.Args[1] 4431 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 { 4432 l := y_0 4433 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym { 4434 continue 4435 } 4436 mem := l.Args[1] 4437 if ptr != l.Args[0] { 4438 continue 4439 } 4440 x := y_1 4441 if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) { 4442 continue 4443 } 4444 v.reset(Op386ANDLmodify) 4445 v.AuxInt = int32ToAuxInt(off) 4446 v.Aux = symToAux(sym) 4447 v.AddArg3(ptr, x, mem) 4448 return true 4449 } 4450 break 4451 } 4452 // match: (MOVLstore {sym} [off] ptr y:(ORL l:(MOVLload [off] {sym} ptr mem) x) mem) 4453 // cond: y.Uses==1 && l.Uses==1 && clobber(y, l) 4454 // result: (ORLmodify [off] {sym} ptr x mem) 4455 for { 4456 off := auxIntToInt32(v.AuxInt) 4457 sym := auxToSym(v.Aux) 4458 ptr := v_0 4459 y := v_1 4460 if y.Op != Op386ORL { 4461 break 4462 } 4463 _ = y.Args[1] 4464 y_0 := y.Args[0] 4465 y_1 := y.Args[1] 4466 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 { 4467 l := y_0 4468 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym { 4469 continue 4470 } 4471 mem := l.Args[1] 4472 if ptr != l.Args[0] { 4473 continue 4474 } 4475 x := y_1 4476 if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) { 4477 continue 4478 } 4479 v.reset(Op386ORLmodify) 4480 v.AuxInt = int32ToAuxInt(off) 4481 v.Aux = symToAux(sym) 4482 v.AddArg3(ptr, x, mem) 4483 return true 4484 } 4485 break 4486 } 4487 // match: (MOVLstore {sym} [off] ptr y:(XORL l:(MOVLload [off] {sym} ptr mem) x) mem) 4488 // cond: y.Uses==1 && l.Uses==1 && clobber(y, l) 4489 // result: (XORLmodify [off] {sym} ptr x mem) 4490 for { 4491 off := auxIntToInt32(v.AuxInt) 4492 sym := auxToSym(v.Aux) 4493 ptr := v_0 4494 y := v_1 4495 if y.Op != Op386XORL { 4496 break 4497 } 4498 _ = y.Args[1] 4499 y_0 := y.Args[0] 4500 y_1 := y.Args[1] 4501 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 { 4502 l := y_0 4503 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym { 4504 continue 4505 } 4506 mem := l.Args[1] 4507 if ptr != l.Args[0] { 4508 continue 4509 } 4510 x := y_1 4511 if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) { 4512 continue 4513 } 4514 v.reset(Op386XORLmodify) 4515 v.AuxInt = int32ToAuxInt(off) 4516 v.Aux = symToAux(sym) 4517 v.AddArg3(ptr, x, mem) 4518 return true 4519 } 4520 break 4521 } 4522 // match: (MOVLstore {sym} [off] ptr y:(ADDLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem) 4523 // cond: y.Uses==1 && l.Uses==1 && clobber(y, l) 4524 // result: (ADDLconstmodify [makeValAndOff(c,off)] {sym} ptr mem) 4525 for { 4526 off := auxIntToInt32(v.AuxInt) 4527 sym := auxToSym(v.Aux) 4528 ptr := v_0 4529 y := v_1 4530 if y.Op != Op386ADDLconst { 4531 break 4532 } 4533 c := auxIntToInt32(y.AuxInt) 4534 l := y.Args[0] 4535 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym { 4536 break 4537 } 4538 mem := l.Args[1] 4539 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) { 4540 break 4541 } 4542 v.reset(Op386ADDLconstmodify) 4543 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off)) 4544 v.Aux = symToAux(sym) 4545 v.AddArg2(ptr, mem) 4546 return true 4547 } 4548 // match: (MOVLstore {sym} [off] ptr y:(ANDLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem) 4549 // cond: y.Uses==1 && l.Uses==1 && clobber(y, l) 4550 // result: (ANDLconstmodify [makeValAndOff(c,off)] {sym} ptr mem) 4551 for { 4552 off := auxIntToInt32(v.AuxInt) 4553 sym := auxToSym(v.Aux) 4554 ptr := v_0 4555 y := v_1 4556 if y.Op != Op386ANDLconst { 4557 break 4558 } 4559 c := auxIntToInt32(y.AuxInt) 4560 l := y.Args[0] 4561 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym { 4562 break 4563 } 4564 mem := l.Args[1] 4565 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) { 4566 break 4567 } 4568 v.reset(Op386ANDLconstmodify) 4569 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off)) 4570 v.Aux = symToAux(sym) 4571 v.AddArg2(ptr, mem) 4572 return true 4573 } 4574 // match: (MOVLstore {sym} [off] ptr y:(ORLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem) 4575 // cond: y.Uses==1 && l.Uses==1 && clobber(y, l) 4576 // result: (ORLconstmodify [makeValAndOff(c,off)] {sym} ptr mem) 4577 for { 4578 off := auxIntToInt32(v.AuxInt) 4579 sym := auxToSym(v.Aux) 4580 ptr := v_0 4581 y := v_1 4582 if y.Op != Op386ORLconst { 4583 break 4584 } 4585 c := auxIntToInt32(y.AuxInt) 4586 l := y.Args[0] 4587 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym { 4588 break 4589 } 4590 mem := l.Args[1] 4591 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) { 4592 break 4593 } 4594 v.reset(Op386ORLconstmodify) 4595 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off)) 4596 v.Aux = symToAux(sym) 4597 v.AddArg2(ptr, mem) 4598 return true 4599 } 4600 // match: (MOVLstore {sym} [off] ptr y:(XORLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem) 4601 // cond: y.Uses==1 && l.Uses==1 && clobber(y, l) 4602 // result: (XORLconstmodify [makeValAndOff(c,off)] {sym} ptr mem) 4603 for { 4604 off := auxIntToInt32(v.AuxInt) 4605 sym := auxToSym(v.Aux) 4606 ptr := v_0 4607 y := v_1 4608 if y.Op != Op386XORLconst { 4609 break 4610 } 4611 c := auxIntToInt32(y.AuxInt) 4612 l := y.Args[0] 4613 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym { 4614 break 4615 } 4616 mem := l.Args[1] 4617 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) { 4618 break 4619 } 4620 v.reset(Op386XORLconstmodify) 4621 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off)) 4622 v.Aux = symToAux(sym) 4623 v.AddArg2(ptr, mem) 4624 return true 4625 } 4626 return false 4627 } 4628 func rewriteValue386_Op386MOVLstoreconst(v *Value) bool { 4629 v_1 := v.Args[1] 4630 v_0 := v.Args[0] 4631 b := v.Block 4632 config := b.Func.Config 4633 // match: (MOVLstoreconst [sc] {s} (ADDLconst [off] ptr) mem) 4634 // cond: sc.canAdd32(off) 4635 // result: (MOVLstoreconst [sc.addOffset32(off)] {s} ptr mem) 4636 for { 4637 sc := auxIntToValAndOff(v.AuxInt) 4638 s := auxToSym(v.Aux) 4639 if v_0.Op != Op386ADDLconst { 4640 break 4641 } 4642 off := auxIntToInt32(v_0.AuxInt) 4643 ptr := v_0.Args[0] 4644 mem := v_1 4645 if !(sc.canAdd32(off)) { 4646 break 4647 } 4648 v.reset(Op386MOVLstoreconst) 4649 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 4650 v.Aux = symToAux(s) 4651 v.AddArg2(ptr, mem) 4652 return true 4653 } 4654 // match: (MOVLstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem) 4655 // cond: canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared) 4656 // result: (MOVLstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 4657 for { 4658 sc := auxIntToValAndOff(v.AuxInt) 4659 sym1 := auxToSym(v.Aux) 4660 if v_0.Op != Op386LEAL { 4661 break 4662 } 4663 off := auxIntToInt32(v_0.AuxInt) 4664 sym2 := auxToSym(v_0.Aux) 4665 ptr := v_0.Args[0] 4666 mem := v_1 4667 if !(canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) { 4668 break 4669 } 4670 v.reset(Op386MOVLstoreconst) 4671 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 4672 v.Aux = symToAux(mergeSym(sym1, sym2)) 4673 v.AddArg2(ptr, mem) 4674 return true 4675 } 4676 return false 4677 } 4678 func rewriteValue386_Op386MOVSDconst(v *Value) bool { 4679 b := v.Block 4680 config := b.Func.Config 4681 typ := &b.Func.Config.Types 4682 // match: (MOVSDconst [c]) 4683 // cond: config.ctxt.Flag_shared 4684 // result: (MOVSDconst2 (MOVSDconst1 [c])) 4685 for { 4686 c := auxIntToFloat64(v.AuxInt) 4687 if !(config.ctxt.Flag_shared) { 4688 break 4689 } 4690 v.reset(Op386MOVSDconst2) 4691 v0 := b.NewValue0(v.Pos, Op386MOVSDconst1, typ.UInt32) 4692 v0.AuxInt = float64ToAuxInt(c) 4693 v.AddArg(v0) 4694 return true 4695 } 4696 return false 4697 } 4698 func rewriteValue386_Op386MOVSDload(v *Value) bool { 4699 v_1 := v.Args[1] 4700 v_0 := v.Args[0] 4701 b := v.Block 4702 config := b.Func.Config 4703 // match: (MOVSDload [off1] {sym} (ADDLconst [off2] ptr) mem) 4704 // cond: is32Bit(int64(off1)+int64(off2)) 4705 // result: (MOVSDload [off1+off2] {sym} ptr mem) 4706 for { 4707 off1 := auxIntToInt32(v.AuxInt) 4708 sym := auxToSym(v.Aux) 4709 if v_0.Op != Op386ADDLconst { 4710 break 4711 } 4712 off2 := auxIntToInt32(v_0.AuxInt) 4713 ptr := v_0.Args[0] 4714 mem := v_1 4715 if !(is32Bit(int64(off1) + int64(off2))) { 4716 break 4717 } 4718 v.reset(Op386MOVSDload) 4719 v.AuxInt = int32ToAuxInt(off1 + off2) 4720 v.Aux = symToAux(sym) 4721 v.AddArg2(ptr, mem) 4722 return true 4723 } 4724 // match: (MOVSDload [off1] {sym1} (LEAL [off2] {sym2} base) mem) 4725 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 4726 // result: (MOVSDload [off1+off2] {mergeSym(sym1,sym2)} base mem) 4727 for { 4728 off1 := auxIntToInt32(v.AuxInt) 4729 sym1 := auxToSym(v.Aux) 4730 if v_0.Op != Op386LEAL { 4731 break 4732 } 4733 off2 := auxIntToInt32(v_0.AuxInt) 4734 sym2 := auxToSym(v_0.Aux) 4735 base := v_0.Args[0] 4736 mem := v_1 4737 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 4738 break 4739 } 4740 v.reset(Op386MOVSDload) 4741 v.AuxInt = int32ToAuxInt(off1 + off2) 4742 v.Aux = symToAux(mergeSym(sym1, sym2)) 4743 v.AddArg2(base, mem) 4744 return true 4745 } 4746 return false 4747 } 4748 func rewriteValue386_Op386MOVSDstore(v *Value) bool { 4749 v_2 := v.Args[2] 4750 v_1 := v.Args[1] 4751 v_0 := v.Args[0] 4752 b := v.Block 4753 config := b.Func.Config 4754 // match: (MOVSDstore [off1] {sym} (ADDLconst [off2] ptr) val mem) 4755 // cond: is32Bit(int64(off1)+int64(off2)) 4756 // result: (MOVSDstore [off1+off2] {sym} ptr val mem) 4757 for { 4758 off1 := auxIntToInt32(v.AuxInt) 4759 sym := auxToSym(v.Aux) 4760 if v_0.Op != Op386ADDLconst { 4761 break 4762 } 4763 off2 := auxIntToInt32(v_0.AuxInt) 4764 ptr := v_0.Args[0] 4765 val := v_1 4766 mem := v_2 4767 if !(is32Bit(int64(off1) + int64(off2))) { 4768 break 4769 } 4770 v.reset(Op386MOVSDstore) 4771 v.AuxInt = int32ToAuxInt(off1 + off2) 4772 v.Aux = symToAux(sym) 4773 v.AddArg3(ptr, val, mem) 4774 return true 4775 } 4776 // match: (MOVSDstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 4777 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 4778 // result: (MOVSDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 4779 for { 4780 off1 := auxIntToInt32(v.AuxInt) 4781 sym1 := auxToSym(v.Aux) 4782 if v_0.Op != Op386LEAL { 4783 break 4784 } 4785 off2 := auxIntToInt32(v_0.AuxInt) 4786 sym2 := auxToSym(v_0.Aux) 4787 base := v_0.Args[0] 4788 val := v_1 4789 mem := v_2 4790 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 4791 break 4792 } 4793 v.reset(Op386MOVSDstore) 4794 v.AuxInt = int32ToAuxInt(off1 + off2) 4795 v.Aux = symToAux(mergeSym(sym1, sym2)) 4796 v.AddArg3(base, val, mem) 4797 return true 4798 } 4799 return false 4800 } 4801 func rewriteValue386_Op386MOVSSconst(v *Value) bool { 4802 b := v.Block 4803 config := b.Func.Config 4804 typ := &b.Func.Config.Types 4805 // match: (MOVSSconst [c]) 4806 // cond: config.ctxt.Flag_shared 4807 // result: (MOVSSconst2 (MOVSSconst1 [c])) 4808 for { 4809 c := auxIntToFloat32(v.AuxInt) 4810 if !(config.ctxt.Flag_shared) { 4811 break 4812 } 4813 v.reset(Op386MOVSSconst2) 4814 v0 := b.NewValue0(v.Pos, Op386MOVSSconst1, typ.UInt32) 4815 v0.AuxInt = float32ToAuxInt(c) 4816 v.AddArg(v0) 4817 return true 4818 } 4819 return false 4820 } 4821 func rewriteValue386_Op386MOVSSload(v *Value) bool { 4822 v_1 := v.Args[1] 4823 v_0 := v.Args[0] 4824 b := v.Block 4825 config := b.Func.Config 4826 // match: (MOVSSload [off1] {sym} (ADDLconst [off2] ptr) mem) 4827 // cond: is32Bit(int64(off1)+int64(off2)) 4828 // result: (MOVSSload [off1+off2] {sym} ptr mem) 4829 for { 4830 off1 := auxIntToInt32(v.AuxInt) 4831 sym := auxToSym(v.Aux) 4832 if v_0.Op != Op386ADDLconst { 4833 break 4834 } 4835 off2 := auxIntToInt32(v_0.AuxInt) 4836 ptr := v_0.Args[0] 4837 mem := v_1 4838 if !(is32Bit(int64(off1) + int64(off2))) { 4839 break 4840 } 4841 v.reset(Op386MOVSSload) 4842 v.AuxInt = int32ToAuxInt(off1 + off2) 4843 v.Aux = symToAux(sym) 4844 v.AddArg2(ptr, mem) 4845 return true 4846 } 4847 // match: (MOVSSload [off1] {sym1} (LEAL [off2] {sym2} base) mem) 4848 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 4849 // result: (MOVSSload [off1+off2] {mergeSym(sym1,sym2)} base mem) 4850 for { 4851 off1 := auxIntToInt32(v.AuxInt) 4852 sym1 := auxToSym(v.Aux) 4853 if v_0.Op != Op386LEAL { 4854 break 4855 } 4856 off2 := auxIntToInt32(v_0.AuxInt) 4857 sym2 := auxToSym(v_0.Aux) 4858 base := v_0.Args[0] 4859 mem := v_1 4860 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 4861 break 4862 } 4863 v.reset(Op386MOVSSload) 4864 v.AuxInt = int32ToAuxInt(off1 + off2) 4865 v.Aux = symToAux(mergeSym(sym1, sym2)) 4866 v.AddArg2(base, mem) 4867 return true 4868 } 4869 return false 4870 } 4871 func rewriteValue386_Op386MOVSSstore(v *Value) bool { 4872 v_2 := v.Args[2] 4873 v_1 := v.Args[1] 4874 v_0 := v.Args[0] 4875 b := v.Block 4876 config := b.Func.Config 4877 // match: (MOVSSstore [off1] {sym} (ADDLconst [off2] ptr) val mem) 4878 // cond: is32Bit(int64(off1)+int64(off2)) 4879 // result: (MOVSSstore [off1+off2] {sym} ptr val mem) 4880 for { 4881 off1 := auxIntToInt32(v.AuxInt) 4882 sym := auxToSym(v.Aux) 4883 if v_0.Op != Op386ADDLconst { 4884 break 4885 } 4886 off2 := auxIntToInt32(v_0.AuxInt) 4887 ptr := v_0.Args[0] 4888 val := v_1 4889 mem := v_2 4890 if !(is32Bit(int64(off1) + int64(off2))) { 4891 break 4892 } 4893 v.reset(Op386MOVSSstore) 4894 v.AuxInt = int32ToAuxInt(off1 + off2) 4895 v.Aux = symToAux(sym) 4896 v.AddArg3(ptr, val, mem) 4897 return true 4898 } 4899 // match: (MOVSSstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 4900 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 4901 // result: (MOVSSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 4902 for { 4903 off1 := auxIntToInt32(v.AuxInt) 4904 sym1 := auxToSym(v.Aux) 4905 if v_0.Op != Op386LEAL { 4906 break 4907 } 4908 off2 := auxIntToInt32(v_0.AuxInt) 4909 sym2 := auxToSym(v_0.Aux) 4910 base := v_0.Args[0] 4911 val := v_1 4912 mem := v_2 4913 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 4914 break 4915 } 4916 v.reset(Op386MOVSSstore) 4917 v.AuxInt = int32ToAuxInt(off1 + off2) 4918 v.Aux = symToAux(mergeSym(sym1, sym2)) 4919 v.AddArg3(base, val, mem) 4920 return true 4921 } 4922 return false 4923 } 4924 func rewriteValue386_Op386MOVWLSX(v *Value) bool { 4925 v_0 := v.Args[0] 4926 b := v.Block 4927 // match: (MOVWLSX x:(MOVWload [off] {sym} ptr mem)) 4928 // cond: x.Uses == 1 && clobber(x) 4929 // result: @x.Block (MOVWLSXload <v.Type> [off] {sym} ptr mem) 4930 for { 4931 x := v_0 4932 if x.Op != Op386MOVWload { 4933 break 4934 } 4935 off := auxIntToInt32(x.AuxInt) 4936 sym := auxToSym(x.Aux) 4937 mem := x.Args[1] 4938 ptr := x.Args[0] 4939 if !(x.Uses == 1 && clobber(x)) { 4940 break 4941 } 4942 b = x.Block 4943 v0 := b.NewValue0(x.Pos, Op386MOVWLSXload, v.Type) 4944 v.copyOf(v0) 4945 v0.AuxInt = int32ToAuxInt(off) 4946 v0.Aux = symToAux(sym) 4947 v0.AddArg2(ptr, mem) 4948 return true 4949 } 4950 // match: (MOVWLSX (ANDLconst [c] x)) 4951 // cond: c & 0x8000 == 0 4952 // result: (ANDLconst [c & 0x7fff] x) 4953 for { 4954 if v_0.Op != Op386ANDLconst { 4955 break 4956 } 4957 c := auxIntToInt32(v_0.AuxInt) 4958 x := v_0.Args[0] 4959 if !(c&0x8000 == 0) { 4960 break 4961 } 4962 v.reset(Op386ANDLconst) 4963 v.AuxInt = int32ToAuxInt(c & 0x7fff) 4964 v.AddArg(x) 4965 return true 4966 } 4967 return false 4968 } 4969 func rewriteValue386_Op386MOVWLSXload(v *Value) bool { 4970 v_1 := v.Args[1] 4971 v_0 := v.Args[0] 4972 b := v.Block 4973 config := b.Func.Config 4974 // match: (MOVWLSXload [off] {sym} ptr (MOVWstore [off2] {sym2} ptr2 x _)) 4975 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) 4976 // result: (MOVWLSX x) 4977 for { 4978 off := auxIntToInt32(v.AuxInt) 4979 sym := auxToSym(v.Aux) 4980 ptr := v_0 4981 if v_1.Op != Op386MOVWstore { 4982 break 4983 } 4984 off2 := auxIntToInt32(v_1.AuxInt) 4985 sym2 := auxToSym(v_1.Aux) 4986 x := v_1.Args[1] 4987 ptr2 := v_1.Args[0] 4988 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) { 4989 break 4990 } 4991 v.reset(Op386MOVWLSX) 4992 v.AddArg(x) 4993 return true 4994 } 4995 // match: (MOVWLSXload [off1] {sym1} (LEAL [off2] {sym2} base) mem) 4996 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 4997 // result: (MOVWLSXload [off1+off2] {mergeSym(sym1,sym2)} base mem) 4998 for { 4999 off1 := auxIntToInt32(v.AuxInt) 5000 sym1 := auxToSym(v.Aux) 5001 if v_0.Op != Op386LEAL { 5002 break 5003 } 5004 off2 := auxIntToInt32(v_0.AuxInt) 5005 sym2 := auxToSym(v_0.Aux) 5006 base := v_0.Args[0] 5007 mem := v_1 5008 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 5009 break 5010 } 5011 v.reset(Op386MOVWLSXload) 5012 v.AuxInt = int32ToAuxInt(off1 + off2) 5013 v.Aux = symToAux(mergeSym(sym1, sym2)) 5014 v.AddArg2(base, mem) 5015 return true 5016 } 5017 return false 5018 } 5019 func rewriteValue386_Op386MOVWLZX(v *Value) bool { 5020 v_0 := v.Args[0] 5021 b := v.Block 5022 // match: (MOVWLZX x:(MOVWload [off] {sym} ptr mem)) 5023 // cond: x.Uses == 1 && clobber(x) 5024 // result: @x.Block (MOVWload <v.Type> [off] {sym} ptr mem) 5025 for { 5026 x := v_0 5027 if x.Op != Op386MOVWload { 5028 break 5029 } 5030 off := auxIntToInt32(x.AuxInt) 5031 sym := auxToSym(x.Aux) 5032 mem := x.Args[1] 5033 ptr := x.Args[0] 5034 if !(x.Uses == 1 && clobber(x)) { 5035 break 5036 } 5037 b = x.Block 5038 v0 := b.NewValue0(x.Pos, Op386MOVWload, v.Type) 5039 v.copyOf(v0) 5040 v0.AuxInt = int32ToAuxInt(off) 5041 v0.Aux = symToAux(sym) 5042 v0.AddArg2(ptr, mem) 5043 return true 5044 } 5045 // match: (MOVWLZX (ANDLconst [c] x)) 5046 // result: (ANDLconst [c & 0xffff] x) 5047 for { 5048 if v_0.Op != Op386ANDLconst { 5049 break 5050 } 5051 c := auxIntToInt32(v_0.AuxInt) 5052 x := v_0.Args[0] 5053 v.reset(Op386ANDLconst) 5054 v.AuxInt = int32ToAuxInt(c & 0xffff) 5055 v.AddArg(x) 5056 return true 5057 } 5058 return false 5059 } 5060 func rewriteValue386_Op386MOVWload(v *Value) bool { 5061 v_1 := v.Args[1] 5062 v_0 := v.Args[0] 5063 b := v.Block 5064 config := b.Func.Config 5065 // match: (MOVWload [off] {sym} ptr (MOVWstore [off2] {sym2} ptr2 x _)) 5066 // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) 5067 // result: (MOVWLZX x) 5068 for { 5069 off := auxIntToInt32(v.AuxInt) 5070 sym := auxToSym(v.Aux) 5071 ptr := v_0 5072 if v_1.Op != Op386MOVWstore { 5073 break 5074 } 5075 off2 := auxIntToInt32(v_1.AuxInt) 5076 sym2 := auxToSym(v_1.Aux) 5077 x := v_1.Args[1] 5078 ptr2 := v_1.Args[0] 5079 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) { 5080 break 5081 } 5082 v.reset(Op386MOVWLZX) 5083 v.AddArg(x) 5084 return true 5085 } 5086 // match: (MOVWload [off1] {sym} (ADDLconst [off2] ptr) mem) 5087 // cond: is32Bit(int64(off1)+int64(off2)) 5088 // result: (MOVWload [off1+off2] {sym} ptr mem) 5089 for { 5090 off1 := auxIntToInt32(v.AuxInt) 5091 sym := auxToSym(v.Aux) 5092 if v_0.Op != Op386ADDLconst { 5093 break 5094 } 5095 off2 := auxIntToInt32(v_0.AuxInt) 5096 ptr := v_0.Args[0] 5097 mem := v_1 5098 if !(is32Bit(int64(off1) + int64(off2))) { 5099 break 5100 } 5101 v.reset(Op386MOVWload) 5102 v.AuxInt = int32ToAuxInt(off1 + off2) 5103 v.Aux = symToAux(sym) 5104 v.AddArg2(ptr, mem) 5105 return true 5106 } 5107 // match: (MOVWload [off1] {sym1} (LEAL [off2] {sym2} base) mem) 5108 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 5109 // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem) 5110 for { 5111 off1 := auxIntToInt32(v.AuxInt) 5112 sym1 := auxToSym(v.Aux) 5113 if v_0.Op != Op386LEAL { 5114 break 5115 } 5116 off2 := auxIntToInt32(v_0.AuxInt) 5117 sym2 := auxToSym(v_0.Aux) 5118 base := v_0.Args[0] 5119 mem := v_1 5120 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 5121 break 5122 } 5123 v.reset(Op386MOVWload) 5124 v.AuxInt = int32ToAuxInt(off1 + off2) 5125 v.Aux = symToAux(mergeSym(sym1, sym2)) 5126 v.AddArg2(base, mem) 5127 return true 5128 } 5129 // match: (MOVWload [off] {sym} (SB) _) 5130 // cond: symIsRO(sym) 5131 // result: (MOVLconst [int32(read16(sym, int64(off), config.ctxt.Arch.ByteOrder))]) 5132 for { 5133 off := auxIntToInt32(v.AuxInt) 5134 sym := auxToSym(v.Aux) 5135 if v_0.Op != OpSB || !(symIsRO(sym)) { 5136 break 5137 } 5138 v.reset(Op386MOVLconst) 5139 v.AuxInt = int32ToAuxInt(int32(read16(sym, int64(off), config.ctxt.Arch.ByteOrder))) 5140 return true 5141 } 5142 return false 5143 } 5144 func rewriteValue386_Op386MOVWstore(v *Value) bool { 5145 v_2 := v.Args[2] 5146 v_1 := v.Args[1] 5147 v_0 := v.Args[0] 5148 b := v.Block 5149 config := b.Func.Config 5150 // match: (MOVWstore [off] {sym} ptr (MOVWLSX x) mem) 5151 // result: (MOVWstore [off] {sym} ptr x mem) 5152 for { 5153 off := auxIntToInt32(v.AuxInt) 5154 sym := auxToSym(v.Aux) 5155 ptr := v_0 5156 if v_1.Op != Op386MOVWLSX { 5157 break 5158 } 5159 x := v_1.Args[0] 5160 mem := v_2 5161 v.reset(Op386MOVWstore) 5162 v.AuxInt = int32ToAuxInt(off) 5163 v.Aux = symToAux(sym) 5164 v.AddArg3(ptr, x, mem) 5165 return true 5166 } 5167 // match: (MOVWstore [off] {sym} ptr (MOVWLZX x) mem) 5168 // result: (MOVWstore [off] {sym} ptr x mem) 5169 for { 5170 off := auxIntToInt32(v.AuxInt) 5171 sym := auxToSym(v.Aux) 5172 ptr := v_0 5173 if v_1.Op != Op386MOVWLZX { 5174 break 5175 } 5176 x := v_1.Args[0] 5177 mem := v_2 5178 v.reset(Op386MOVWstore) 5179 v.AuxInt = int32ToAuxInt(off) 5180 v.Aux = symToAux(sym) 5181 v.AddArg3(ptr, x, mem) 5182 return true 5183 } 5184 // match: (MOVWstore [off1] {sym} (ADDLconst [off2] ptr) val mem) 5185 // cond: is32Bit(int64(off1)+int64(off2)) 5186 // result: (MOVWstore [off1+off2] {sym} ptr val mem) 5187 for { 5188 off1 := auxIntToInt32(v.AuxInt) 5189 sym := auxToSym(v.Aux) 5190 if v_0.Op != Op386ADDLconst { 5191 break 5192 } 5193 off2 := auxIntToInt32(v_0.AuxInt) 5194 ptr := v_0.Args[0] 5195 val := v_1 5196 mem := v_2 5197 if !(is32Bit(int64(off1) + int64(off2))) { 5198 break 5199 } 5200 v.reset(Op386MOVWstore) 5201 v.AuxInt = int32ToAuxInt(off1 + off2) 5202 v.Aux = symToAux(sym) 5203 v.AddArg3(ptr, val, mem) 5204 return true 5205 } 5206 // match: (MOVWstore [off] {sym} ptr (MOVLconst [c]) mem) 5207 // result: (MOVWstoreconst [makeValAndOff(c,off)] {sym} ptr mem) 5208 for { 5209 off := auxIntToInt32(v.AuxInt) 5210 sym := auxToSym(v.Aux) 5211 ptr := v_0 5212 if v_1.Op != Op386MOVLconst { 5213 break 5214 } 5215 c := auxIntToInt32(v_1.AuxInt) 5216 mem := v_2 5217 v.reset(Op386MOVWstoreconst) 5218 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off)) 5219 v.Aux = symToAux(sym) 5220 v.AddArg2(ptr, mem) 5221 return true 5222 } 5223 // match: (MOVWstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 5224 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 5225 // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 5226 for { 5227 off1 := auxIntToInt32(v.AuxInt) 5228 sym1 := auxToSym(v.Aux) 5229 if v_0.Op != Op386LEAL { 5230 break 5231 } 5232 off2 := auxIntToInt32(v_0.AuxInt) 5233 sym2 := auxToSym(v_0.Aux) 5234 base := v_0.Args[0] 5235 val := v_1 5236 mem := v_2 5237 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 5238 break 5239 } 5240 v.reset(Op386MOVWstore) 5241 v.AuxInt = int32ToAuxInt(off1 + off2) 5242 v.Aux = symToAux(mergeSym(sym1, sym2)) 5243 v.AddArg3(base, val, mem) 5244 return true 5245 } 5246 // match: (MOVWstore [i] {s} p (SHRLconst [16] w) x:(MOVWstore [i-2] {s} p w mem)) 5247 // cond: x.Uses == 1 && clobber(x) 5248 // result: (MOVLstore [i-2] {s} p w mem) 5249 for { 5250 i := auxIntToInt32(v.AuxInt) 5251 s := auxToSym(v.Aux) 5252 p := v_0 5253 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 16 { 5254 break 5255 } 5256 w := v_1.Args[0] 5257 x := v_2 5258 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 5259 break 5260 } 5261 mem := x.Args[2] 5262 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) { 5263 break 5264 } 5265 v.reset(Op386MOVLstore) 5266 v.AuxInt = int32ToAuxInt(i - 2) 5267 v.Aux = symToAux(s) 5268 v.AddArg3(p, w, mem) 5269 return true 5270 } 5271 // match: (MOVWstore [i] {s} p (SHRLconst [j] w) x:(MOVWstore [i-2] {s} p w0:(SHRLconst [j-16] w) mem)) 5272 // cond: x.Uses == 1 && clobber(x) 5273 // result: (MOVLstore [i-2] {s} p w0 mem) 5274 for { 5275 i := auxIntToInt32(v.AuxInt) 5276 s := auxToSym(v.Aux) 5277 p := v_0 5278 if v_1.Op != Op386SHRLconst { 5279 break 5280 } 5281 j := auxIntToInt32(v_1.AuxInt) 5282 w := v_1.Args[0] 5283 x := v_2 5284 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { 5285 break 5286 } 5287 mem := x.Args[2] 5288 if p != x.Args[0] { 5289 break 5290 } 5291 w0 := x.Args[1] 5292 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { 5293 break 5294 } 5295 v.reset(Op386MOVLstore) 5296 v.AuxInt = int32ToAuxInt(i - 2) 5297 v.Aux = symToAux(s) 5298 v.AddArg3(p, w0, mem) 5299 return true 5300 } 5301 // match: (MOVWstore [i] {s} p1 (SHRLconst [16] w) x:(MOVWstore [i] {s} p0 w mem)) 5302 // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x) 5303 // result: (MOVLstore [i] {s} p0 w mem) 5304 for { 5305 i := auxIntToInt32(v.AuxInt) 5306 s := auxToSym(v.Aux) 5307 p1 := v_0 5308 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 16 { 5309 break 5310 } 5311 w := v_1.Args[0] 5312 x := v_2 5313 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s { 5314 break 5315 } 5316 mem := x.Args[2] 5317 p0 := x.Args[0] 5318 if w != x.Args[1] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)) { 5319 break 5320 } 5321 v.reset(Op386MOVLstore) 5322 v.AuxInt = int32ToAuxInt(i) 5323 v.Aux = symToAux(s) 5324 v.AddArg3(p0, w, mem) 5325 return true 5326 } 5327 // match: (MOVWstore [i] {s} p1 (SHRLconst [j] w) x:(MOVWstore [i] {s} p0 w0:(SHRLconst [j-16] w) mem)) 5328 // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x) 5329 // result: (MOVLstore [i] {s} p0 w0 mem) 5330 for { 5331 i := auxIntToInt32(v.AuxInt) 5332 s := auxToSym(v.Aux) 5333 p1 := v_0 5334 if v_1.Op != Op386SHRLconst { 5335 break 5336 } 5337 j := auxIntToInt32(v_1.AuxInt) 5338 w := v_1.Args[0] 5339 x := v_2 5340 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s { 5341 break 5342 } 5343 mem := x.Args[2] 5344 p0 := x.Args[0] 5345 w0 := x.Args[1] 5346 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)) { 5347 break 5348 } 5349 v.reset(Op386MOVLstore) 5350 v.AuxInt = int32ToAuxInt(i) 5351 v.Aux = symToAux(s) 5352 v.AddArg3(p0, w0, mem) 5353 return true 5354 } 5355 return false 5356 } 5357 func rewriteValue386_Op386MOVWstoreconst(v *Value) bool { 5358 v_1 := v.Args[1] 5359 v_0 := v.Args[0] 5360 b := v.Block 5361 config := b.Func.Config 5362 // match: (MOVWstoreconst [sc] {s} (ADDLconst [off] ptr) mem) 5363 // cond: sc.canAdd32(off) 5364 // result: (MOVWstoreconst [sc.addOffset32(off)] {s} ptr mem) 5365 for { 5366 sc := auxIntToValAndOff(v.AuxInt) 5367 s := auxToSym(v.Aux) 5368 if v_0.Op != Op386ADDLconst { 5369 break 5370 } 5371 off := auxIntToInt32(v_0.AuxInt) 5372 ptr := v_0.Args[0] 5373 mem := v_1 5374 if !(sc.canAdd32(off)) { 5375 break 5376 } 5377 v.reset(Op386MOVWstoreconst) 5378 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 5379 v.Aux = symToAux(s) 5380 v.AddArg2(ptr, mem) 5381 return true 5382 } 5383 // match: (MOVWstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem) 5384 // cond: canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared) 5385 // result: (MOVWstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem) 5386 for { 5387 sc := auxIntToValAndOff(v.AuxInt) 5388 sym1 := auxToSym(v.Aux) 5389 if v_0.Op != Op386LEAL { 5390 break 5391 } 5392 off := auxIntToInt32(v_0.AuxInt) 5393 sym2 := auxToSym(v_0.Aux) 5394 ptr := v_0.Args[0] 5395 mem := v_1 5396 if !(canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) { 5397 break 5398 } 5399 v.reset(Op386MOVWstoreconst) 5400 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) 5401 v.Aux = symToAux(mergeSym(sym1, sym2)) 5402 v.AddArg2(ptr, mem) 5403 return true 5404 } 5405 // match: (MOVWstoreconst [c] {s} p x:(MOVWstoreconst [a] {s} p mem)) 5406 // cond: x.Uses == 1 && a.Off() + 2 == c.Off() && clobber(x) 5407 // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p mem) 5408 for { 5409 c := auxIntToValAndOff(v.AuxInt) 5410 s := auxToSym(v.Aux) 5411 p := v_0 5412 x := v_1 5413 if x.Op != Op386MOVWstoreconst { 5414 break 5415 } 5416 a := auxIntToValAndOff(x.AuxInt) 5417 if auxToSym(x.Aux) != s { 5418 break 5419 } 5420 mem := x.Args[1] 5421 if p != x.Args[0] || !(x.Uses == 1 && a.Off()+2 == c.Off() && clobber(x)) { 5422 break 5423 } 5424 v.reset(Op386MOVLstoreconst) 5425 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off())) 5426 v.Aux = symToAux(s) 5427 v.AddArg2(p, mem) 5428 return true 5429 } 5430 // match: (MOVWstoreconst [a] {s} p x:(MOVWstoreconst [c] {s} p mem)) 5431 // cond: x.Uses == 1 && ValAndOff(a).Off() + 2 == ValAndOff(c).Off() && clobber(x) 5432 // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p mem) 5433 for { 5434 a := auxIntToValAndOff(v.AuxInt) 5435 s := auxToSym(v.Aux) 5436 p := v_0 5437 x := v_1 5438 if x.Op != Op386MOVWstoreconst { 5439 break 5440 } 5441 c := auxIntToValAndOff(x.AuxInt) 5442 if auxToSym(x.Aux) != s { 5443 break 5444 } 5445 mem := x.Args[1] 5446 if p != x.Args[0] || !(x.Uses == 1 && ValAndOff(a).Off()+2 == ValAndOff(c).Off() && clobber(x)) { 5447 break 5448 } 5449 v.reset(Op386MOVLstoreconst) 5450 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off())) 5451 v.Aux = symToAux(s) 5452 v.AddArg2(p, mem) 5453 return true 5454 } 5455 // match: (MOVWstoreconst [c] {s} p1 x:(MOVWstoreconst [a] {s} p0 mem)) 5456 // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x) 5457 // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p0 mem) 5458 for { 5459 c := auxIntToValAndOff(v.AuxInt) 5460 s := auxToSym(v.Aux) 5461 p1 := v_0 5462 x := v_1 5463 if x.Op != Op386MOVWstoreconst { 5464 break 5465 } 5466 a := auxIntToValAndOff(x.AuxInt) 5467 if auxToSym(x.Aux) != s { 5468 break 5469 } 5470 mem := x.Args[1] 5471 p0 := x.Args[0] 5472 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)) { 5473 break 5474 } 5475 v.reset(Op386MOVLstoreconst) 5476 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off())) 5477 v.Aux = symToAux(s) 5478 v.AddArg2(p0, mem) 5479 return true 5480 } 5481 // match: (MOVWstoreconst [a] {s} p0 x:(MOVWstoreconst [c] {s} p1 mem)) 5482 // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x) 5483 // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p0 mem) 5484 for { 5485 a := auxIntToValAndOff(v.AuxInt) 5486 s := auxToSym(v.Aux) 5487 p0 := v_0 5488 x := v_1 5489 if x.Op != Op386MOVWstoreconst { 5490 break 5491 } 5492 c := auxIntToValAndOff(x.AuxInt) 5493 if auxToSym(x.Aux) != s { 5494 break 5495 } 5496 mem := x.Args[1] 5497 p1 := x.Args[0] 5498 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)) { 5499 break 5500 } 5501 v.reset(Op386MOVLstoreconst) 5502 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off())) 5503 v.Aux = symToAux(s) 5504 v.AddArg2(p0, mem) 5505 return true 5506 } 5507 return false 5508 } 5509 func rewriteValue386_Op386MULL(v *Value) bool { 5510 v_1 := v.Args[1] 5511 v_0 := v.Args[0] 5512 // match: (MULL x (MOVLconst [c])) 5513 // result: (MULLconst [c] x) 5514 for { 5515 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5516 x := v_0 5517 if v_1.Op != Op386MOVLconst { 5518 continue 5519 } 5520 c := auxIntToInt32(v_1.AuxInt) 5521 v.reset(Op386MULLconst) 5522 v.AuxInt = int32ToAuxInt(c) 5523 v.AddArg(x) 5524 return true 5525 } 5526 break 5527 } 5528 // match: (MULL x l:(MOVLload [off] {sym} ptr mem)) 5529 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 5530 // result: (MULLload x [off] {sym} ptr mem) 5531 for { 5532 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5533 x := v_0 5534 l := v_1 5535 if l.Op != Op386MOVLload { 5536 continue 5537 } 5538 off := auxIntToInt32(l.AuxInt) 5539 sym := auxToSym(l.Aux) 5540 mem := l.Args[1] 5541 ptr := l.Args[0] 5542 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 5543 continue 5544 } 5545 v.reset(Op386MULLload) 5546 v.AuxInt = int32ToAuxInt(off) 5547 v.Aux = symToAux(sym) 5548 v.AddArg3(x, ptr, mem) 5549 return true 5550 } 5551 break 5552 } 5553 return false 5554 } 5555 func rewriteValue386_Op386MULLconst(v *Value) bool { 5556 v_0 := v.Args[0] 5557 b := v.Block 5558 // match: (MULLconst [c] (MULLconst [d] x)) 5559 // result: (MULLconst [c * d] x) 5560 for { 5561 c := auxIntToInt32(v.AuxInt) 5562 if v_0.Op != Op386MULLconst { 5563 break 5564 } 5565 d := auxIntToInt32(v_0.AuxInt) 5566 x := v_0.Args[0] 5567 v.reset(Op386MULLconst) 5568 v.AuxInt = int32ToAuxInt(c * d) 5569 v.AddArg(x) 5570 return true 5571 } 5572 // match: (MULLconst [-9] x) 5573 // result: (NEGL (LEAL8 <v.Type> x x)) 5574 for { 5575 if auxIntToInt32(v.AuxInt) != -9 { 5576 break 5577 } 5578 x := v_0 5579 v.reset(Op386NEGL) 5580 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type) 5581 v0.AddArg2(x, x) 5582 v.AddArg(v0) 5583 return true 5584 } 5585 // match: (MULLconst [-5] x) 5586 // result: (NEGL (LEAL4 <v.Type> x x)) 5587 for { 5588 if auxIntToInt32(v.AuxInt) != -5 { 5589 break 5590 } 5591 x := v_0 5592 v.reset(Op386NEGL) 5593 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type) 5594 v0.AddArg2(x, x) 5595 v.AddArg(v0) 5596 return true 5597 } 5598 // match: (MULLconst [-3] x) 5599 // result: (NEGL (LEAL2 <v.Type> x x)) 5600 for { 5601 if auxIntToInt32(v.AuxInt) != -3 { 5602 break 5603 } 5604 x := v_0 5605 v.reset(Op386NEGL) 5606 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type) 5607 v0.AddArg2(x, x) 5608 v.AddArg(v0) 5609 return true 5610 } 5611 // match: (MULLconst [-1] x) 5612 // result: (NEGL x) 5613 for { 5614 if auxIntToInt32(v.AuxInt) != -1 { 5615 break 5616 } 5617 x := v_0 5618 v.reset(Op386NEGL) 5619 v.AddArg(x) 5620 return true 5621 } 5622 // match: (MULLconst [0] _) 5623 // result: (MOVLconst [0]) 5624 for { 5625 if auxIntToInt32(v.AuxInt) != 0 { 5626 break 5627 } 5628 v.reset(Op386MOVLconst) 5629 v.AuxInt = int32ToAuxInt(0) 5630 return true 5631 } 5632 // match: (MULLconst [1] x) 5633 // result: x 5634 for { 5635 if auxIntToInt32(v.AuxInt) != 1 { 5636 break 5637 } 5638 x := v_0 5639 v.copyOf(x) 5640 return true 5641 } 5642 // match: (MULLconst [3] x) 5643 // result: (LEAL2 x x) 5644 for { 5645 if auxIntToInt32(v.AuxInt) != 3 { 5646 break 5647 } 5648 x := v_0 5649 v.reset(Op386LEAL2) 5650 v.AddArg2(x, x) 5651 return true 5652 } 5653 // match: (MULLconst [5] x) 5654 // result: (LEAL4 x x) 5655 for { 5656 if auxIntToInt32(v.AuxInt) != 5 { 5657 break 5658 } 5659 x := v_0 5660 v.reset(Op386LEAL4) 5661 v.AddArg2(x, x) 5662 return true 5663 } 5664 // match: (MULLconst [7] x) 5665 // result: (LEAL2 x (LEAL2 <v.Type> x x)) 5666 for { 5667 if auxIntToInt32(v.AuxInt) != 7 { 5668 break 5669 } 5670 x := v_0 5671 v.reset(Op386LEAL2) 5672 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type) 5673 v0.AddArg2(x, x) 5674 v.AddArg2(x, v0) 5675 return true 5676 } 5677 // match: (MULLconst [9] x) 5678 // result: (LEAL8 x x) 5679 for { 5680 if auxIntToInt32(v.AuxInt) != 9 { 5681 break 5682 } 5683 x := v_0 5684 v.reset(Op386LEAL8) 5685 v.AddArg2(x, x) 5686 return true 5687 } 5688 // match: (MULLconst [11] x) 5689 // result: (LEAL2 x (LEAL4 <v.Type> x x)) 5690 for { 5691 if auxIntToInt32(v.AuxInt) != 11 { 5692 break 5693 } 5694 x := v_0 5695 v.reset(Op386LEAL2) 5696 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type) 5697 v0.AddArg2(x, x) 5698 v.AddArg2(x, v0) 5699 return true 5700 } 5701 // match: (MULLconst [13] x) 5702 // result: (LEAL4 x (LEAL2 <v.Type> x x)) 5703 for { 5704 if auxIntToInt32(v.AuxInt) != 13 { 5705 break 5706 } 5707 x := v_0 5708 v.reset(Op386LEAL4) 5709 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type) 5710 v0.AddArg2(x, x) 5711 v.AddArg2(x, v0) 5712 return true 5713 } 5714 // match: (MULLconst [19] x) 5715 // result: (LEAL2 x (LEAL8 <v.Type> x x)) 5716 for { 5717 if auxIntToInt32(v.AuxInt) != 19 { 5718 break 5719 } 5720 x := v_0 5721 v.reset(Op386LEAL2) 5722 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type) 5723 v0.AddArg2(x, x) 5724 v.AddArg2(x, v0) 5725 return true 5726 } 5727 // match: (MULLconst [21] x) 5728 // result: (LEAL4 x (LEAL4 <v.Type> x x)) 5729 for { 5730 if auxIntToInt32(v.AuxInt) != 21 { 5731 break 5732 } 5733 x := v_0 5734 v.reset(Op386LEAL4) 5735 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type) 5736 v0.AddArg2(x, x) 5737 v.AddArg2(x, v0) 5738 return true 5739 } 5740 // match: (MULLconst [25] x) 5741 // result: (LEAL8 x (LEAL2 <v.Type> x x)) 5742 for { 5743 if auxIntToInt32(v.AuxInt) != 25 { 5744 break 5745 } 5746 x := v_0 5747 v.reset(Op386LEAL8) 5748 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type) 5749 v0.AddArg2(x, x) 5750 v.AddArg2(x, v0) 5751 return true 5752 } 5753 // match: (MULLconst [27] x) 5754 // result: (LEAL8 (LEAL2 <v.Type> x x) (LEAL2 <v.Type> x x)) 5755 for { 5756 if auxIntToInt32(v.AuxInt) != 27 { 5757 break 5758 } 5759 x := v_0 5760 v.reset(Op386LEAL8) 5761 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type) 5762 v0.AddArg2(x, x) 5763 v.AddArg2(v0, v0) 5764 return true 5765 } 5766 // match: (MULLconst [37] x) 5767 // result: (LEAL4 x (LEAL8 <v.Type> x x)) 5768 for { 5769 if auxIntToInt32(v.AuxInt) != 37 { 5770 break 5771 } 5772 x := v_0 5773 v.reset(Op386LEAL4) 5774 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type) 5775 v0.AddArg2(x, x) 5776 v.AddArg2(x, v0) 5777 return true 5778 } 5779 // match: (MULLconst [41] x) 5780 // result: (LEAL8 x (LEAL4 <v.Type> x x)) 5781 for { 5782 if auxIntToInt32(v.AuxInt) != 41 { 5783 break 5784 } 5785 x := v_0 5786 v.reset(Op386LEAL8) 5787 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type) 5788 v0.AddArg2(x, x) 5789 v.AddArg2(x, v0) 5790 return true 5791 } 5792 // match: (MULLconst [45] x) 5793 // result: (LEAL8 (LEAL4 <v.Type> x x) (LEAL4 <v.Type> x x)) 5794 for { 5795 if auxIntToInt32(v.AuxInt) != 45 { 5796 break 5797 } 5798 x := v_0 5799 v.reset(Op386LEAL8) 5800 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type) 5801 v0.AddArg2(x, x) 5802 v.AddArg2(v0, v0) 5803 return true 5804 } 5805 // match: (MULLconst [73] x) 5806 // result: (LEAL8 x (LEAL8 <v.Type> x x)) 5807 for { 5808 if auxIntToInt32(v.AuxInt) != 73 { 5809 break 5810 } 5811 x := v_0 5812 v.reset(Op386LEAL8) 5813 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type) 5814 v0.AddArg2(x, x) 5815 v.AddArg2(x, v0) 5816 return true 5817 } 5818 // match: (MULLconst [81] x) 5819 // result: (LEAL8 (LEAL8 <v.Type> x x) (LEAL8 <v.Type> x x)) 5820 for { 5821 if auxIntToInt32(v.AuxInt) != 81 { 5822 break 5823 } 5824 x := v_0 5825 v.reset(Op386LEAL8) 5826 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type) 5827 v0.AddArg2(x, x) 5828 v.AddArg2(v0, v0) 5829 return true 5830 } 5831 // match: (MULLconst [c] x) 5832 // cond: isPowerOfTwo32(c+1) && c >= 15 5833 // result: (SUBL (SHLLconst <v.Type> [int32(log32(c+1))] x) x) 5834 for { 5835 c := auxIntToInt32(v.AuxInt) 5836 x := v_0 5837 if !(isPowerOfTwo32(c+1) && c >= 15) { 5838 break 5839 } 5840 v.reset(Op386SUBL) 5841 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type) 5842 v0.AuxInt = int32ToAuxInt(int32(log32(c + 1))) 5843 v0.AddArg(x) 5844 v.AddArg2(v0, x) 5845 return true 5846 } 5847 // match: (MULLconst [c] x) 5848 // cond: isPowerOfTwo32(c-1) && c >= 17 5849 // result: (LEAL1 (SHLLconst <v.Type> [int32(log32(c-1))] x) x) 5850 for { 5851 c := auxIntToInt32(v.AuxInt) 5852 x := v_0 5853 if !(isPowerOfTwo32(c-1) && c >= 17) { 5854 break 5855 } 5856 v.reset(Op386LEAL1) 5857 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type) 5858 v0.AuxInt = int32ToAuxInt(int32(log32(c - 1))) 5859 v0.AddArg(x) 5860 v.AddArg2(v0, x) 5861 return true 5862 } 5863 // match: (MULLconst [c] x) 5864 // cond: isPowerOfTwo32(c-2) && c >= 34 5865 // result: (LEAL2 (SHLLconst <v.Type> [int32(log32(c-2))] x) x) 5866 for { 5867 c := auxIntToInt32(v.AuxInt) 5868 x := v_0 5869 if !(isPowerOfTwo32(c-2) && c >= 34) { 5870 break 5871 } 5872 v.reset(Op386LEAL2) 5873 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type) 5874 v0.AuxInt = int32ToAuxInt(int32(log32(c - 2))) 5875 v0.AddArg(x) 5876 v.AddArg2(v0, x) 5877 return true 5878 } 5879 // match: (MULLconst [c] x) 5880 // cond: isPowerOfTwo32(c-4) && c >= 68 5881 // result: (LEAL4 (SHLLconst <v.Type> [int32(log32(c-4))] x) x) 5882 for { 5883 c := auxIntToInt32(v.AuxInt) 5884 x := v_0 5885 if !(isPowerOfTwo32(c-4) && c >= 68) { 5886 break 5887 } 5888 v.reset(Op386LEAL4) 5889 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type) 5890 v0.AuxInt = int32ToAuxInt(int32(log32(c - 4))) 5891 v0.AddArg(x) 5892 v.AddArg2(v0, x) 5893 return true 5894 } 5895 // match: (MULLconst [c] x) 5896 // cond: isPowerOfTwo32(c-8) && c >= 136 5897 // result: (LEAL8 (SHLLconst <v.Type> [int32(log32(c-8))] x) x) 5898 for { 5899 c := auxIntToInt32(v.AuxInt) 5900 x := v_0 5901 if !(isPowerOfTwo32(c-8) && c >= 136) { 5902 break 5903 } 5904 v.reset(Op386LEAL8) 5905 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type) 5906 v0.AuxInt = int32ToAuxInt(int32(log32(c - 8))) 5907 v0.AddArg(x) 5908 v.AddArg2(v0, x) 5909 return true 5910 } 5911 // match: (MULLconst [c] x) 5912 // cond: c%3 == 0 && isPowerOfTwo32(c/3) 5913 // result: (SHLLconst [int32(log32(c/3))] (LEAL2 <v.Type> x x)) 5914 for { 5915 c := auxIntToInt32(v.AuxInt) 5916 x := v_0 5917 if !(c%3 == 0 && isPowerOfTwo32(c/3)) { 5918 break 5919 } 5920 v.reset(Op386SHLLconst) 5921 v.AuxInt = int32ToAuxInt(int32(log32(c / 3))) 5922 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type) 5923 v0.AddArg2(x, x) 5924 v.AddArg(v0) 5925 return true 5926 } 5927 // match: (MULLconst [c] x) 5928 // cond: c%5 == 0 && isPowerOfTwo32(c/5) 5929 // result: (SHLLconst [int32(log32(c/5))] (LEAL4 <v.Type> x x)) 5930 for { 5931 c := auxIntToInt32(v.AuxInt) 5932 x := v_0 5933 if !(c%5 == 0 && isPowerOfTwo32(c/5)) { 5934 break 5935 } 5936 v.reset(Op386SHLLconst) 5937 v.AuxInt = int32ToAuxInt(int32(log32(c / 5))) 5938 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type) 5939 v0.AddArg2(x, x) 5940 v.AddArg(v0) 5941 return true 5942 } 5943 // match: (MULLconst [c] x) 5944 // cond: c%9 == 0 && isPowerOfTwo32(c/9) 5945 // result: (SHLLconst [int32(log32(c/9))] (LEAL8 <v.Type> x x)) 5946 for { 5947 c := auxIntToInt32(v.AuxInt) 5948 x := v_0 5949 if !(c%9 == 0 && isPowerOfTwo32(c/9)) { 5950 break 5951 } 5952 v.reset(Op386SHLLconst) 5953 v.AuxInt = int32ToAuxInt(int32(log32(c / 9))) 5954 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type) 5955 v0.AddArg2(x, x) 5956 v.AddArg(v0) 5957 return true 5958 } 5959 // match: (MULLconst [c] (MOVLconst [d])) 5960 // result: (MOVLconst [c*d]) 5961 for { 5962 c := auxIntToInt32(v.AuxInt) 5963 if v_0.Op != Op386MOVLconst { 5964 break 5965 } 5966 d := auxIntToInt32(v_0.AuxInt) 5967 v.reset(Op386MOVLconst) 5968 v.AuxInt = int32ToAuxInt(c * d) 5969 return true 5970 } 5971 return false 5972 } 5973 func rewriteValue386_Op386MULLload(v *Value) bool { 5974 v_2 := v.Args[2] 5975 v_1 := v.Args[1] 5976 v_0 := v.Args[0] 5977 b := v.Block 5978 config := b.Func.Config 5979 // match: (MULLload [off1] {sym} val (ADDLconst [off2] base) mem) 5980 // cond: is32Bit(int64(off1)+int64(off2)) 5981 // result: (MULLload [off1+off2] {sym} val base mem) 5982 for { 5983 off1 := auxIntToInt32(v.AuxInt) 5984 sym := auxToSym(v.Aux) 5985 val := v_0 5986 if v_1.Op != Op386ADDLconst { 5987 break 5988 } 5989 off2 := auxIntToInt32(v_1.AuxInt) 5990 base := v_1.Args[0] 5991 mem := v_2 5992 if !(is32Bit(int64(off1) + int64(off2))) { 5993 break 5994 } 5995 v.reset(Op386MULLload) 5996 v.AuxInt = int32ToAuxInt(off1 + off2) 5997 v.Aux = symToAux(sym) 5998 v.AddArg3(val, base, mem) 5999 return true 6000 } 6001 // match: (MULLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 6002 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 6003 // result: (MULLload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 6004 for { 6005 off1 := auxIntToInt32(v.AuxInt) 6006 sym1 := auxToSym(v.Aux) 6007 val := v_0 6008 if v_1.Op != Op386LEAL { 6009 break 6010 } 6011 off2 := auxIntToInt32(v_1.AuxInt) 6012 sym2 := auxToSym(v_1.Aux) 6013 base := v_1.Args[0] 6014 mem := v_2 6015 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 6016 break 6017 } 6018 v.reset(Op386MULLload) 6019 v.AuxInt = int32ToAuxInt(off1 + off2) 6020 v.Aux = symToAux(mergeSym(sym1, sym2)) 6021 v.AddArg3(val, base, mem) 6022 return true 6023 } 6024 return false 6025 } 6026 func rewriteValue386_Op386MULSD(v *Value) bool { 6027 v_1 := v.Args[1] 6028 v_0 := v.Args[0] 6029 // match: (MULSD x l:(MOVSDload [off] {sym} ptr mem)) 6030 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 6031 // result: (MULSDload x [off] {sym} ptr mem) 6032 for { 6033 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6034 x := v_0 6035 l := v_1 6036 if l.Op != Op386MOVSDload { 6037 continue 6038 } 6039 off := auxIntToInt32(l.AuxInt) 6040 sym := auxToSym(l.Aux) 6041 mem := l.Args[1] 6042 ptr := l.Args[0] 6043 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 6044 continue 6045 } 6046 v.reset(Op386MULSDload) 6047 v.AuxInt = int32ToAuxInt(off) 6048 v.Aux = symToAux(sym) 6049 v.AddArg3(x, ptr, mem) 6050 return true 6051 } 6052 break 6053 } 6054 return false 6055 } 6056 func rewriteValue386_Op386MULSDload(v *Value) bool { 6057 v_2 := v.Args[2] 6058 v_1 := v.Args[1] 6059 v_0 := v.Args[0] 6060 b := v.Block 6061 config := b.Func.Config 6062 // match: (MULSDload [off1] {sym} val (ADDLconst [off2] base) mem) 6063 // cond: is32Bit(int64(off1)+int64(off2)) 6064 // result: (MULSDload [off1+off2] {sym} val base mem) 6065 for { 6066 off1 := auxIntToInt32(v.AuxInt) 6067 sym := auxToSym(v.Aux) 6068 val := v_0 6069 if v_1.Op != Op386ADDLconst { 6070 break 6071 } 6072 off2 := auxIntToInt32(v_1.AuxInt) 6073 base := v_1.Args[0] 6074 mem := v_2 6075 if !(is32Bit(int64(off1) + int64(off2))) { 6076 break 6077 } 6078 v.reset(Op386MULSDload) 6079 v.AuxInt = int32ToAuxInt(off1 + off2) 6080 v.Aux = symToAux(sym) 6081 v.AddArg3(val, base, mem) 6082 return true 6083 } 6084 // match: (MULSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 6085 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 6086 // result: (MULSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 6087 for { 6088 off1 := auxIntToInt32(v.AuxInt) 6089 sym1 := auxToSym(v.Aux) 6090 val := v_0 6091 if v_1.Op != Op386LEAL { 6092 break 6093 } 6094 off2 := auxIntToInt32(v_1.AuxInt) 6095 sym2 := auxToSym(v_1.Aux) 6096 base := v_1.Args[0] 6097 mem := v_2 6098 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 6099 break 6100 } 6101 v.reset(Op386MULSDload) 6102 v.AuxInt = int32ToAuxInt(off1 + off2) 6103 v.Aux = symToAux(mergeSym(sym1, sym2)) 6104 v.AddArg3(val, base, mem) 6105 return true 6106 } 6107 return false 6108 } 6109 func rewriteValue386_Op386MULSS(v *Value) bool { 6110 v_1 := v.Args[1] 6111 v_0 := v.Args[0] 6112 // match: (MULSS x l:(MOVSSload [off] {sym} ptr mem)) 6113 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 6114 // result: (MULSSload x [off] {sym} ptr mem) 6115 for { 6116 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6117 x := v_0 6118 l := v_1 6119 if l.Op != Op386MOVSSload { 6120 continue 6121 } 6122 off := auxIntToInt32(l.AuxInt) 6123 sym := auxToSym(l.Aux) 6124 mem := l.Args[1] 6125 ptr := l.Args[0] 6126 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 6127 continue 6128 } 6129 v.reset(Op386MULSSload) 6130 v.AuxInt = int32ToAuxInt(off) 6131 v.Aux = symToAux(sym) 6132 v.AddArg3(x, ptr, mem) 6133 return true 6134 } 6135 break 6136 } 6137 return false 6138 } 6139 func rewriteValue386_Op386MULSSload(v *Value) bool { 6140 v_2 := v.Args[2] 6141 v_1 := v.Args[1] 6142 v_0 := v.Args[0] 6143 b := v.Block 6144 config := b.Func.Config 6145 // match: (MULSSload [off1] {sym} val (ADDLconst [off2] base) mem) 6146 // cond: is32Bit(int64(off1)+int64(off2)) 6147 // result: (MULSSload [off1+off2] {sym} val base mem) 6148 for { 6149 off1 := auxIntToInt32(v.AuxInt) 6150 sym := auxToSym(v.Aux) 6151 val := v_0 6152 if v_1.Op != Op386ADDLconst { 6153 break 6154 } 6155 off2 := auxIntToInt32(v_1.AuxInt) 6156 base := v_1.Args[0] 6157 mem := v_2 6158 if !(is32Bit(int64(off1) + int64(off2))) { 6159 break 6160 } 6161 v.reset(Op386MULSSload) 6162 v.AuxInt = int32ToAuxInt(off1 + off2) 6163 v.Aux = symToAux(sym) 6164 v.AddArg3(val, base, mem) 6165 return true 6166 } 6167 // match: (MULSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 6168 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 6169 // result: (MULSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 6170 for { 6171 off1 := auxIntToInt32(v.AuxInt) 6172 sym1 := auxToSym(v.Aux) 6173 val := v_0 6174 if v_1.Op != Op386LEAL { 6175 break 6176 } 6177 off2 := auxIntToInt32(v_1.AuxInt) 6178 sym2 := auxToSym(v_1.Aux) 6179 base := v_1.Args[0] 6180 mem := v_2 6181 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 6182 break 6183 } 6184 v.reset(Op386MULSSload) 6185 v.AuxInt = int32ToAuxInt(off1 + off2) 6186 v.Aux = symToAux(mergeSym(sym1, sym2)) 6187 v.AddArg3(val, base, mem) 6188 return true 6189 } 6190 return false 6191 } 6192 func rewriteValue386_Op386NEGL(v *Value) bool { 6193 v_0 := v.Args[0] 6194 // match: (NEGL (MOVLconst [c])) 6195 // result: (MOVLconst [-c]) 6196 for { 6197 if v_0.Op != Op386MOVLconst { 6198 break 6199 } 6200 c := auxIntToInt32(v_0.AuxInt) 6201 v.reset(Op386MOVLconst) 6202 v.AuxInt = int32ToAuxInt(-c) 6203 return true 6204 } 6205 return false 6206 } 6207 func rewriteValue386_Op386NOTL(v *Value) bool { 6208 v_0 := v.Args[0] 6209 // match: (NOTL (MOVLconst [c])) 6210 // result: (MOVLconst [^c]) 6211 for { 6212 if v_0.Op != Op386MOVLconst { 6213 break 6214 } 6215 c := auxIntToInt32(v_0.AuxInt) 6216 v.reset(Op386MOVLconst) 6217 v.AuxInt = int32ToAuxInt(^c) 6218 return true 6219 } 6220 return false 6221 } 6222 func rewriteValue386_Op386ORL(v *Value) bool { 6223 v_1 := v.Args[1] 6224 v_0 := v.Args[0] 6225 b := v.Block 6226 typ := &b.Func.Config.Types 6227 // match: (ORL x (MOVLconst [c])) 6228 // result: (ORLconst [c] x) 6229 for { 6230 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6231 x := v_0 6232 if v_1.Op != Op386MOVLconst { 6233 continue 6234 } 6235 c := auxIntToInt32(v_1.AuxInt) 6236 v.reset(Op386ORLconst) 6237 v.AuxInt = int32ToAuxInt(c) 6238 v.AddArg(x) 6239 return true 6240 } 6241 break 6242 } 6243 // match: (ORL x l:(MOVLload [off] {sym} ptr mem)) 6244 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 6245 // result: (ORLload x [off] {sym} ptr mem) 6246 for { 6247 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6248 x := v_0 6249 l := v_1 6250 if l.Op != Op386MOVLload { 6251 continue 6252 } 6253 off := auxIntToInt32(l.AuxInt) 6254 sym := auxToSym(l.Aux) 6255 mem := l.Args[1] 6256 ptr := l.Args[0] 6257 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 6258 continue 6259 } 6260 v.reset(Op386ORLload) 6261 v.AuxInt = int32ToAuxInt(off) 6262 v.Aux = symToAux(sym) 6263 v.AddArg3(x, ptr, mem) 6264 return true 6265 } 6266 break 6267 } 6268 // match: (ORL x x) 6269 // result: x 6270 for { 6271 x := v_0 6272 if x != v_1 { 6273 break 6274 } 6275 v.copyOf(x) 6276 return true 6277 } 6278 // match: (ORL x0:(MOVBload [i0] {s} p mem) s0:(SHLLconst [8] x1:(MOVBload [i1] {s} p mem))) 6279 // cond: i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, s0) 6280 // result: @mergePoint(b,x0,x1) (MOVWload [i0] {s} p mem) 6281 for { 6282 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6283 x0 := v_0 6284 if x0.Op != Op386MOVBload { 6285 continue 6286 } 6287 i0 := auxIntToInt32(x0.AuxInt) 6288 s := auxToSym(x0.Aux) 6289 mem := x0.Args[1] 6290 p := x0.Args[0] 6291 s0 := v_1 6292 if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 8 { 6293 continue 6294 } 6295 x1 := s0.Args[0] 6296 if x1.Op != Op386MOVBload { 6297 continue 6298 } 6299 i1 := auxIntToInt32(x1.AuxInt) 6300 if auxToSym(x1.Aux) != s { 6301 continue 6302 } 6303 _ = x1.Args[1] 6304 if p != x1.Args[0] || mem != x1.Args[1] || !(i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, s0)) { 6305 continue 6306 } 6307 b = mergePoint(b, x0, x1) 6308 v0 := b.NewValue0(x1.Pos, Op386MOVWload, typ.UInt16) 6309 v.copyOf(v0) 6310 v0.AuxInt = int32ToAuxInt(i0) 6311 v0.Aux = symToAux(s) 6312 v0.AddArg2(p, mem) 6313 return true 6314 } 6315 break 6316 } 6317 // match: (ORL x0:(MOVBload [i] {s} p0 mem) s0:(SHLLconst [8] x1:(MOVBload [i] {s} p1 mem))) 6318 // cond: x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && sequentialAddresses(p0, p1, 1) && mergePoint(b,x0,x1) != nil && clobber(x0, x1, s0) 6319 // result: @mergePoint(b,x0,x1) (MOVWload [i] {s} p0 mem) 6320 for { 6321 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6322 x0 := v_0 6323 if x0.Op != Op386MOVBload { 6324 continue 6325 } 6326 i := auxIntToInt32(x0.AuxInt) 6327 s := auxToSym(x0.Aux) 6328 mem := x0.Args[1] 6329 p0 := x0.Args[0] 6330 s0 := v_1 6331 if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 8 { 6332 continue 6333 } 6334 x1 := s0.Args[0] 6335 if x1.Op != Op386MOVBload || auxIntToInt32(x1.AuxInt) != i || auxToSym(x1.Aux) != s { 6336 continue 6337 } 6338 _ = x1.Args[1] 6339 p1 := x1.Args[0] 6340 if mem != x1.Args[1] || !(x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && sequentialAddresses(p0, p1, 1) && mergePoint(b, x0, x1) != nil && clobber(x0, x1, s0)) { 6341 continue 6342 } 6343 b = mergePoint(b, x0, x1) 6344 v0 := b.NewValue0(x1.Pos, Op386MOVWload, typ.UInt16) 6345 v.copyOf(v0) 6346 v0.AuxInt = int32ToAuxInt(i) 6347 v0.Aux = symToAux(s) 6348 v0.AddArg2(p0, mem) 6349 return true 6350 } 6351 break 6352 } 6353 // match: (ORL o0:(ORL x0:(MOVWload [i0] {s} p mem) s0:(SHLLconst [16] x1:(MOVBload [i2] {s} p mem))) s1:(SHLLconst [24] x2:(MOVBload [i3] {s} p mem))) 6354 // cond: i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && o0.Uses == 1 && mergePoint(b,x0,x1,x2) != nil && clobber(x0, x1, x2, s0, s1, o0) 6355 // result: @mergePoint(b,x0,x1,x2) (MOVLload [i0] {s} p mem) 6356 for { 6357 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6358 o0 := v_0 6359 if o0.Op != Op386ORL { 6360 continue 6361 } 6362 _ = o0.Args[1] 6363 o0_0 := o0.Args[0] 6364 o0_1 := o0.Args[1] 6365 for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 { 6366 x0 := o0_0 6367 if x0.Op != Op386MOVWload { 6368 continue 6369 } 6370 i0 := auxIntToInt32(x0.AuxInt) 6371 s := auxToSym(x0.Aux) 6372 mem := x0.Args[1] 6373 p := x0.Args[0] 6374 s0 := o0_1 6375 if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 16 { 6376 continue 6377 } 6378 x1 := s0.Args[0] 6379 if x1.Op != Op386MOVBload { 6380 continue 6381 } 6382 i2 := auxIntToInt32(x1.AuxInt) 6383 if auxToSym(x1.Aux) != s { 6384 continue 6385 } 6386 _ = x1.Args[1] 6387 if p != x1.Args[0] || mem != x1.Args[1] { 6388 continue 6389 } 6390 s1 := v_1 6391 if s1.Op != Op386SHLLconst || auxIntToInt32(s1.AuxInt) != 24 { 6392 continue 6393 } 6394 x2 := s1.Args[0] 6395 if x2.Op != Op386MOVBload { 6396 continue 6397 } 6398 i3 := auxIntToInt32(x2.AuxInt) 6399 if auxToSym(x2.Aux) != s { 6400 continue 6401 } 6402 _ = x2.Args[1] 6403 if p != x2.Args[0] || mem != x2.Args[1] || !(i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && o0.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) { 6404 continue 6405 } 6406 b = mergePoint(b, x0, x1, x2) 6407 v0 := b.NewValue0(x2.Pos, Op386MOVLload, typ.UInt32) 6408 v.copyOf(v0) 6409 v0.AuxInt = int32ToAuxInt(i0) 6410 v0.Aux = symToAux(s) 6411 v0.AddArg2(p, mem) 6412 return true 6413 } 6414 } 6415 break 6416 } 6417 // match: (ORL o0:(ORL x0:(MOVWload [i] {s} p0 mem) s0:(SHLLconst [16] x1:(MOVBload [i] {s} p1 mem))) s1:(SHLLconst [24] x2:(MOVBload [i] {s} p2 mem))) 6418 // cond: x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && o0.Uses == 1 && sequentialAddresses(p0, p1, 2) && sequentialAddresses(p1, p2, 1) && mergePoint(b,x0,x1,x2) != nil && clobber(x0, x1, x2, s0, s1, o0) 6419 // result: @mergePoint(b,x0,x1,x2) (MOVLload [i] {s} p0 mem) 6420 for { 6421 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 6422 o0 := v_0 6423 if o0.Op != Op386ORL { 6424 continue 6425 } 6426 _ = o0.Args[1] 6427 o0_0 := o0.Args[0] 6428 o0_1 := o0.Args[1] 6429 for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 { 6430 x0 := o0_0 6431 if x0.Op != Op386MOVWload { 6432 continue 6433 } 6434 i := auxIntToInt32(x0.AuxInt) 6435 s := auxToSym(x0.Aux) 6436 mem := x0.Args[1] 6437 p0 := x0.Args[0] 6438 s0 := o0_1 6439 if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 16 { 6440 continue 6441 } 6442 x1 := s0.Args[0] 6443 if x1.Op != Op386MOVBload || auxIntToInt32(x1.AuxInt) != i || auxToSym(x1.Aux) != s { 6444 continue 6445 } 6446 _ = x1.Args[1] 6447 p1 := x1.Args[0] 6448 if mem != x1.Args[1] { 6449 continue 6450 } 6451 s1 := v_1 6452 if s1.Op != Op386SHLLconst || auxIntToInt32(s1.AuxInt) != 24 { 6453 continue 6454 } 6455 x2 := s1.Args[0] 6456 if x2.Op != Op386MOVBload || auxIntToInt32(x2.AuxInt) != i || auxToSym(x2.Aux) != s { 6457 continue 6458 } 6459 _ = x2.Args[1] 6460 p2 := x2.Args[0] 6461 if mem != x2.Args[1] || !(x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && o0.Uses == 1 && sequentialAddresses(p0, p1, 2) && sequentialAddresses(p1, p2, 1) && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) { 6462 continue 6463 } 6464 b = mergePoint(b, x0, x1, x2) 6465 v0 := b.NewValue0(x2.Pos, Op386MOVLload, typ.UInt32) 6466 v.copyOf(v0) 6467 v0.AuxInt = int32ToAuxInt(i) 6468 v0.Aux = symToAux(s) 6469 v0.AddArg2(p0, mem) 6470 return true 6471 } 6472 } 6473 break 6474 } 6475 return false 6476 } 6477 func rewriteValue386_Op386ORLconst(v *Value) bool { 6478 v_0 := v.Args[0] 6479 // match: (ORLconst [c] x) 6480 // cond: c==0 6481 // result: x 6482 for { 6483 c := auxIntToInt32(v.AuxInt) 6484 x := v_0 6485 if !(c == 0) { 6486 break 6487 } 6488 v.copyOf(x) 6489 return true 6490 } 6491 // match: (ORLconst [c] _) 6492 // cond: c==-1 6493 // result: (MOVLconst [-1]) 6494 for { 6495 c := auxIntToInt32(v.AuxInt) 6496 if !(c == -1) { 6497 break 6498 } 6499 v.reset(Op386MOVLconst) 6500 v.AuxInt = int32ToAuxInt(-1) 6501 return true 6502 } 6503 // match: (ORLconst [c] (MOVLconst [d])) 6504 // result: (MOVLconst [c|d]) 6505 for { 6506 c := auxIntToInt32(v.AuxInt) 6507 if v_0.Op != Op386MOVLconst { 6508 break 6509 } 6510 d := auxIntToInt32(v_0.AuxInt) 6511 v.reset(Op386MOVLconst) 6512 v.AuxInt = int32ToAuxInt(c | d) 6513 return true 6514 } 6515 return false 6516 } 6517 func rewriteValue386_Op386ORLconstmodify(v *Value) bool { 6518 v_1 := v.Args[1] 6519 v_0 := v.Args[0] 6520 b := v.Block 6521 config := b.Func.Config 6522 // match: (ORLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem) 6523 // cond: valoff1.canAdd32(off2) 6524 // result: (ORLconstmodify [valoff1.addOffset32(off2)] {sym} base mem) 6525 for { 6526 valoff1 := auxIntToValAndOff(v.AuxInt) 6527 sym := auxToSym(v.Aux) 6528 if v_0.Op != Op386ADDLconst { 6529 break 6530 } 6531 off2 := auxIntToInt32(v_0.AuxInt) 6532 base := v_0.Args[0] 6533 mem := v_1 6534 if !(valoff1.canAdd32(off2)) { 6535 break 6536 } 6537 v.reset(Op386ORLconstmodify) 6538 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2)) 6539 v.Aux = symToAux(sym) 6540 v.AddArg2(base, mem) 6541 return true 6542 } 6543 // match: (ORLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem) 6544 // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 6545 // result: (ORLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem) 6546 for { 6547 valoff1 := auxIntToValAndOff(v.AuxInt) 6548 sym1 := auxToSym(v.Aux) 6549 if v_0.Op != Op386LEAL { 6550 break 6551 } 6552 off2 := auxIntToInt32(v_0.AuxInt) 6553 sym2 := auxToSym(v_0.Aux) 6554 base := v_0.Args[0] 6555 mem := v_1 6556 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 6557 break 6558 } 6559 v.reset(Op386ORLconstmodify) 6560 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2)) 6561 v.Aux = symToAux(mergeSym(sym1, sym2)) 6562 v.AddArg2(base, mem) 6563 return true 6564 } 6565 return false 6566 } 6567 func rewriteValue386_Op386ORLload(v *Value) bool { 6568 v_2 := v.Args[2] 6569 v_1 := v.Args[1] 6570 v_0 := v.Args[0] 6571 b := v.Block 6572 config := b.Func.Config 6573 // match: (ORLload [off1] {sym} val (ADDLconst [off2] base) mem) 6574 // cond: is32Bit(int64(off1)+int64(off2)) 6575 // result: (ORLload [off1+off2] {sym} val base mem) 6576 for { 6577 off1 := auxIntToInt32(v.AuxInt) 6578 sym := auxToSym(v.Aux) 6579 val := v_0 6580 if v_1.Op != Op386ADDLconst { 6581 break 6582 } 6583 off2 := auxIntToInt32(v_1.AuxInt) 6584 base := v_1.Args[0] 6585 mem := v_2 6586 if !(is32Bit(int64(off1) + int64(off2))) { 6587 break 6588 } 6589 v.reset(Op386ORLload) 6590 v.AuxInt = int32ToAuxInt(off1 + off2) 6591 v.Aux = symToAux(sym) 6592 v.AddArg3(val, base, mem) 6593 return true 6594 } 6595 // match: (ORLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 6596 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 6597 // result: (ORLload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 6598 for { 6599 off1 := auxIntToInt32(v.AuxInt) 6600 sym1 := auxToSym(v.Aux) 6601 val := v_0 6602 if v_1.Op != Op386LEAL { 6603 break 6604 } 6605 off2 := auxIntToInt32(v_1.AuxInt) 6606 sym2 := auxToSym(v_1.Aux) 6607 base := v_1.Args[0] 6608 mem := v_2 6609 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 6610 break 6611 } 6612 v.reset(Op386ORLload) 6613 v.AuxInt = int32ToAuxInt(off1 + off2) 6614 v.Aux = symToAux(mergeSym(sym1, sym2)) 6615 v.AddArg3(val, base, mem) 6616 return true 6617 } 6618 return false 6619 } 6620 func rewriteValue386_Op386ORLmodify(v *Value) bool { 6621 v_2 := v.Args[2] 6622 v_1 := v.Args[1] 6623 v_0 := v.Args[0] 6624 b := v.Block 6625 config := b.Func.Config 6626 // match: (ORLmodify [off1] {sym} (ADDLconst [off2] base) val mem) 6627 // cond: is32Bit(int64(off1)+int64(off2)) 6628 // result: (ORLmodify [off1+off2] {sym} base val mem) 6629 for { 6630 off1 := auxIntToInt32(v.AuxInt) 6631 sym := auxToSym(v.Aux) 6632 if v_0.Op != Op386ADDLconst { 6633 break 6634 } 6635 off2 := auxIntToInt32(v_0.AuxInt) 6636 base := v_0.Args[0] 6637 val := v_1 6638 mem := v_2 6639 if !(is32Bit(int64(off1) + int64(off2))) { 6640 break 6641 } 6642 v.reset(Op386ORLmodify) 6643 v.AuxInt = int32ToAuxInt(off1 + off2) 6644 v.Aux = symToAux(sym) 6645 v.AddArg3(base, val, mem) 6646 return true 6647 } 6648 // match: (ORLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 6649 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 6650 // result: (ORLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem) 6651 for { 6652 off1 := auxIntToInt32(v.AuxInt) 6653 sym1 := auxToSym(v.Aux) 6654 if v_0.Op != Op386LEAL { 6655 break 6656 } 6657 off2 := auxIntToInt32(v_0.AuxInt) 6658 sym2 := auxToSym(v_0.Aux) 6659 base := v_0.Args[0] 6660 val := v_1 6661 mem := v_2 6662 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 6663 break 6664 } 6665 v.reset(Op386ORLmodify) 6666 v.AuxInt = int32ToAuxInt(off1 + off2) 6667 v.Aux = symToAux(mergeSym(sym1, sym2)) 6668 v.AddArg3(base, val, mem) 6669 return true 6670 } 6671 return false 6672 } 6673 func rewriteValue386_Op386ROLB(v *Value) bool { 6674 v_1 := v.Args[1] 6675 v_0 := v.Args[0] 6676 // match: (ROLB x (MOVLconst [c])) 6677 // result: (ROLBconst [int8(c&7)] x) 6678 for { 6679 x := v_0 6680 if v_1.Op != Op386MOVLconst { 6681 break 6682 } 6683 c := auxIntToInt32(v_1.AuxInt) 6684 v.reset(Op386ROLBconst) 6685 v.AuxInt = int8ToAuxInt(int8(c & 7)) 6686 v.AddArg(x) 6687 return true 6688 } 6689 return false 6690 } 6691 func rewriteValue386_Op386ROLBconst(v *Value) bool { 6692 v_0 := v.Args[0] 6693 // match: (ROLBconst [0] x) 6694 // result: x 6695 for { 6696 if auxIntToInt8(v.AuxInt) != 0 { 6697 break 6698 } 6699 x := v_0 6700 v.copyOf(x) 6701 return true 6702 } 6703 return false 6704 } 6705 func rewriteValue386_Op386ROLL(v *Value) bool { 6706 v_1 := v.Args[1] 6707 v_0 := v.Args[0] 6708 // match: (ROLL x (MOVLconst [c])) 6709 // result: (ROLLconst [c&31] x) 6710 for { 6711 x := v_0 6712 if v_1.Op != Op386MOVLconst { 6713 break 6714 } 6715 c := auxIntToInt32(v_1.AuxInt) 6716 v.reset(Op386ROLLconst) 6717 v.AuxInt = int32ToAuxInt(c & 31) 6718 v.AddArg(x) 6719 return true 6720 } 6721 return false 6722 } 6723 func rewriteValue386_Op386ROLLconst(v *Value) bool { 6724 v_0 := v.Args[0] 6725 // match: (ROLLconst [0] x) 6726 // result: x 6727 for { 6728 if auxIntToInt32(v.AuxInt) != 0 { 6729 break 6730 } 6731 x := v_0 6732 v.copyOf(x) 6733 return true 6734 } 6735 return false 6736 } 6737 func rewriteValue386_Op386ROLW(v *Value) bool { 6738 v_1 := v.Args[1] 6739 v_0 := v.Args[0] 6740 // match: (ROLW x (MOVLconst [c])) 6741 // result: (ROLWconst [int16(c&15)] x) 6742 for { 6743 x := v_0 6744 if v_1.Op != Op386MOVLconst { 6745 break 6746 } 6747 c := auxIntToInt32(v_1.AuxInt) 6748 v.reset(Op386ROLWconst) 6749 v.AuxInt = int16ToAuxInt(int16(c & 15)) 6750 v.AddArg(x) 6751 return true 6752 } 6753 return false 6754 } 6755 func rewriteValue386_Op386ROLWconst(v *Value) bool { 6756 v_0 := v.Args[0] 6757 // match: (ROLWconst [0] x) 6758 // result: x 6759 for { 6760 if auxIntToInt16(v.AuxInt) != 0 { 6761 break 6762 } 6763 x := v_0 6764 v.copyOf(x) 6765 return true 6766 } 6767 return false 6768 } 6769 func rewriteValue386_Op386SARB(v *Value) bool { 6770 v_1 := v.Args[1] 6771 v_0 := v.Args[0] 6772 // match: (SARB x (MOVLconst [c])) 6773 // result: (SARBconst [int8(min(int64(c&31),7))] x) 6774 for { 6775 x := v_0 6776 if v_1.Op != Op386MOVLconst { 6777 break 6778 } 6779 c := auxIntToInt32(v_1.AuxInt) 6780 v.reset(Op386SARBconst) 6781 v.AuxInt = int8ToAuxInt(int8(min(int64(c&31), 7))) 6782 v.AddArg(x) 6783 return true 6784 } 6785 return false 6786 } 6787 func rewriteValue386_Op386SARBconst(v *Value) bool { 6788 v_0 := v.Args[0] 6789 // match: (SARBconst x [0]) 6790 // result: x 6791 for { 6792 if auxIntToInt8(v.AuxInt) != 0 { 6793 break 6794 } 6795 x := v_0 6796 v.copyOf(x) 6797 return true 6798 } 6799 // match: (SARBconst [c] (MOVLconst [d])) 6800 // result: (MOVLconst [d>>uint64(c)]) 6801 for { 6802 c := auxIntToInt8(v.AuxInt) 6803 if v_0.Op != Op386MOVLconst { 6804 break 6805 } 6806 d := auxIntToInt32(v_0.AuxInt) 6807 v.reset(Op386MOVLconst) 6808 v.AuxInt = int32ToAuxInt(d >> uint64(c)) 6809 return true 6810 } 6811 return false 6812 } 6813 func rewriteValue386_Op386SARL(v *Value) bool { 6814 v_1 := v.Args[1] 6815 v_0 := v.Args[0] 6816 // match: (SARL x (MOVLconst [c])) 6817 // result: (SARLconst [c&31] x) 6818 for { 6819 x := v_0 6820 if v_1.Op != Op386MOVLconst { 6821 break 6822 } 6823 c := auxIntToInt32(v_1.AuxInt) 6824 v.reset(Op386SARLconst) 6825 v.AuxInt = int32ToAuxInt(c & 31) 6826 v.AddArg(x) 6827 return true 6828 } 6829 // match: (SARL x (ANDLconst [31] y)) 6830 // result: (SARL x y) 6831 for { 6832 x := v_0 6833 if v_1.Op != Op386ANDLconst || auxIntToInt32(v_1.AuxInt) != 31 { 6834 break 6835 } 6836 y := v_1.Args[0] 6837 v.reset(Op386SARL) 6838 v.AddArg2(x, y) 6839 return true 6840 } 6841 return false 6842 } 6843 func rewriteValue386_Op386SARLconst(v *Value) bool { 6844 v_0 := v.Args[0] 6845 // match: (SARLconst x [0]) 6846 // result: x 6847 for { 6848 if auxIntToInt32(v.AuxInt) != 0 { 6849 break 6850 } 6851 x := v_0 6852 v.copyOf(x) 6853 return true 6854 } 6855 // match: (SARLconst [c] (MOVLconst [d])) 6856 // result: (MOVLconst [d>>uint64(c)]) 6857 for { 6858 c := auxIntToInt32(v.AuxInt) 6859 if v_0.Op != Op386MOVLconst { 6860 break 6861 } 6862 d := auxIntToInt32(v_0.AuxInt) 6863 v.reset(Op386MOVLconst) 6864 v.AuxInt = int32ToAuxInt(d >> uint64(c)) 6865 return true 6866 } 6867 return false 6868 } 6869 func rewriteValue386_Op386SARW(v *Value) bool { 6870 v_1 := v.Args[1] 6871 v_0 := v.Args[0] 6872 // match: (SARW x (MOVLconst [c])) 6873 // result: (SARWconst [int16(min(int64(c&31),15))] x) 6874 for { 6875 x := v_0 6876 if v_1.Op != Op386MOVLconst { 6877 break 6878 } 6879 c := auxIntToInt32(v_1.AuxInt) 6880 v.reset(Op386SARWconst) 6881 v.AuxInt = int16ToAuxInt(int16(min(int64(c&31), 15))) 6882 v.AddArg(x) 6883 return true 6884 } 6885 return false 6886 } 6887 func rewriteValue386_Op386SARWconst(v *Value) bool { 6888 v_0 := v.Args[0] 6889 // match: (SARWconst x [0]) 6890 // result: x 6891 for { 6892 if auxIntToInt16(v.AuxInt) != 0 { 6893 break 6894 } 6895 x := v_0 6896 v.copyOf(x) 6897 return true 6898 } 6899 // match: (SARWconst [c] (MOVLconst [d])) 6900 // result: (MOVLconst [d>>uint64(c)]) 6901 for { 6902 c := auxIntToInt16(v.AuxInt) 6903 if v_0.Op != Op386MOVLconst { 6904 break 6905 } 6906 d := auxIntToInt32(v_0.AuxInt) 6907 v.reset(Op386MOVLconst) 6908 v.AuxInt = int32ToAuxInt(d >> uint64(c)) 6909 return true 6910 } 6911 return false 6912 } 6913 func rewriteValue386_Op386SBBL(v *Value) bool { 6914 v_2 := v.Args[2] 6915 v_1 := v.Args[1] 6916 v_0 := v.Args[0] 6917 // match: (SBBL x (MOVLconst [c]) f) 6918 // result: (SBBLconst [c] x f) 6919 for { 6920 x := v_0 6921 if v_1.Op != Op386MOVLconst { 6922 break 6923 } 6924 c := auxIntToInt32(v_1.AuxInt) 6925 f := v_2 6926 v.reset(Op386SBBLconst) 6927 v.AuxInt = int32ToAuxInt(c) 6928 v.AddArg2(x, f) 6929 return true 6930 } 6931 return false 6932 } 6933 func rewriteValue386_Op386SBBLcarrymask(v *Value) bool { 6934 v_0 := v.Args[0] 6935 // match: (SBBLcarrymask (FlagEQ)) 6936 // result: (MOVLconst [0]) 6937 for { 6938 if v_0.Op != Op386FlagEQ { 6939 break 6940 } 6941 v.reset(Op386MOVLconst) 6942 v.AuxInt = int32ToAuxInt(0) 6943 return true 6944 } 6945 // match: (SBBLcarrymask (FlagLT_ULT)) 6946 // result: (MOVLconst [-1]) 6947 for { 6948 if v_0.Op != Op386FlagLT_ULT { 6949 break 6950 } 6951 v.reset(Op386MOVLconst) 6952 v.AuxInt = int32ToAuxInt(-1) 6953 return true 6954 } 6955 // match: (SBBLcarrymask (FlagLT_UGT)) 6956 // result: (MOVLconst [0]) 6957 for { 6958 if v_0.Op != Op386FlagLT_UGT { 6959 break 6960 } 6961 v.reset(Op386MOVLconst) 6962 v.AuxInt = int32ToAuxInt(0) 6963 return true 6964 } 6965 // match: (SBBLcarrymask (FlagGT_ULT)) 6966 // result: (MOVLconst [-1]) 6967 for { 6968 if v_0.Op != Op386FlagGT_ULT { 6969 break 6970 } 6971 v.reset(Op386MOVLconst) 6972 v.AuxInt = int32ToAuxInt(-1) 6973 return true 6974 } 6975 // match: (SBBLcarrymask (FlagGT_UGT)) 6976 // result: (MOVLconst [0]) 6977 for { 6978 if v_0.Op != Op386FlagGT_UGT { 6979 break 6980 } 6981 v.reset(Op386MOVLconst) 6982 v.AuxInt = int32ToAuxInt(0) 6983 return true 6984 } 6985 return false 6986 } 6987 func rewriteValue386_Op386SETA(v *Value) bool { 6988 v_0 := v.Args[0] 6989 // match: (SETA (InvertFlags x)) 6990 // result: (SETB x) 6991 for { 6992 if v_0.Op != Op386InvertFlags { 6993 break 6994 } 6995 x := v_0.Args[0] 6996 v.reset(Op386SETB) 6997 v.AddArg(x) 6998 return true 6999 } 7000 // match: (SETA (FlagEQ)) 7001 // result: (MOVLconst [0]) 7002 for { 7003 if v_0.Op != Op386FlagEQ { 7004 break 7005 } 7006 v.reset(Op386MOVLconst) 7007 v.AuxInt = int32ToAuxInt(0) 7008 return true 7009 } 7010 // match: (SETA (FlagLT_ULT)) 7011 // result: (MOVLconst [0]) 7012 for { 7013 if v_0.Op != Op386FlagLT_ULT { 7014 break 7015 } 7016 v.reset(Op386MOVLconst) 7017 v.AuxInt = int32ToAuxInt(0) 7018 return true 7019 } 7020 // match: (SETA (FlagLT_UGT)) 7021 // result: (MOVLconst [1]) 7022 for { 7023 if v_0.Op != Op386FlagLT_UGT { 7024 break 7025 } 7026 v.reset(Op386MOVLconst) 7027 v.AuxInt = int32ToAuxInt(1) 7028 return true 7029 } 7030 // match: (SETA (FlagGT_ULT)) 7031 // result: (MOVLconst [0]) 7032 for { 7033 if v_0.Op != Op386FlagGT_ULT { 7034 break 7035 } 7036 v.reset(Op386MOVLconst) 7037 v.AuxInt = int32ToAuxInt(0) 7038 return true 7039 } 7040 // match: (SETA (FlagGT_UGT)) 7041 // result: (MOVLconst [1]) 7042 for { 7043 if v_0.Op != Op386FlagGT_UGT { 7044 break 7045 } 7046 v.reset(Op386MOVLconst) 7047 v.AuxInt = int32ToAuxInt(1) 7048 return true 7049 } 7050 return false 7051 } 7052 func rewriteValue386_Op386SETAE(v *Value) bool { 7053 v_0 := v.Args[0] 7054 // match: (SETAE (InvertFlags x)) 7055 // result: (SETBE x) 7056 for { 7057 if v_0.Op != Op386InvertFlags { 7058 break 7059 } 7060 x := v_0.Args[0] 7061 v.reset(Op386SETBE) 7062 v.AddArg(x) 7063 return true 7064 } 7065 // match: (SETAE (FlagEQ)) 7066 // result: (MOVLconst [1]) 7067 for { 7068 if v_0.Op != Op386FlagEQ { 7069 break 7070 } 7071 v.reset(Op386MOVLconst) 7072 v.AuxInt = int32ToAuxInt(1) 7073 return true 7074 } 7075 // match: (SETAE (FlagLT_ULT)) 7076 // result: (MOVLconst [0]) 7077 for { 7078 if v_0.Op != Op386FlagLT_ULT { 7079 break 7080 } 7081 v.reset(Op386MOVLconst) 7082 v.AuxInt = int32ToAuxInt(0) 7083 return true 7084 } 7085 // match: (SETAE (FlagLT_UGT)) 7086 // result: (MOVLconst [1]) 7087 for { 7088 if v_0.Op != Op386FlagLT_UGT { 7089 break 7090 } 7091 v.reset(Op386MOVLconst) 7092 v.AuxInt = int32ToAuxInt(1) 7093 return true 7094 } 7095 // match: (SETAE (FlagGT_ULT)) 7096 // result: (MOVLconst [0]) 7097 for { 7098 if v_0.Op != Op386FlagGT_ULT { 7099 break 7100 } 7101 v.reset(Op386MOVLconst) 7102 v.AuxInt = int32ToAuxInt(0) 7103 return true 7104 } 7105 // match: (SETAE (FlagGT_UGT)) 7106 // result: (MOVLconst [1]) 7107 for { 7108 if v_0.Op != Op386FlagGT_UGT { 7109 break 7110 } 7111 v.reset(Op386MOVLconst) 7112 v.AuxInt = int32ToAuxInt(1) 7113 return true 7114 } 7115 return false 7116 } 7117 func rewriteValue386_Op386SETB(v *Value) bool { 7118 v_0 := v.Args[0] 7119 // match: (SETB (InvertFlags x)) 7120 // result: (SETA x) 7121 for { 7122 if v_0.Op != Op386InvertFlags { 7123 break 7124 } 7125 x := v_0.Args[0] 7126 v.reset(Op386SETA) 7127 v.AddArg(x) 7128 return true 7129 } 7130 // match: (SETB (FlagEQ)) 7131 // result: (MOVLconst [0]) 7132 for { 7133 if v_0.Op != Op386FlagEQ { 7134 break 7135 } 7136 v.reset(Op386MOVLconst) 7137 v.AuxInt = int32ToAuxInt(0) 7138 return true 7139 } 7140 // match: (SETB (FlagLT_ULT)) 7141 // result: (MOVLconst [1]) 7142 for { 7143 if v_0.Op != Op386FlagLT_ULT { 7144 break 7145 } 7146 v.reset(Op386MOVLconst) 7147 v.AuxInt = int32ToAuxInt(1) 7148 return true 7149 } 7150 // match: (SETB (FlagLT_UGT)) 7151 // result: (MOVLconst [0]) 7152 for { 7153 if v_0.Op != Op386FlagLT_UGT { 7154 break 7155 } 7156 v.reset(Op386MOVLconst) 7157 v.AuxInt = int32ToAuxInt(0) 7158 return true 7159 } 7160 // match: (SETB (FlagGT_ULT)) 7161 // result: (MOVLconst [1]) 7162 for { 7163 if v_0.Op != Op386FlagGT_ULT { 7164 break 7165 } 7166 v.reset(Op386MOVLconst) 7167 v.AuxInt = int32ToAuxInt(1) 7168 return true 7169 } 7170 // match: (SETB (FlagGT_UGT)) 7171 // result: (MOVLconst [0]) 7172 for { 7173 if v_0.Op != Op386FlagGT_UGT { 7174 break 7175 } 7176 v.reset(Op386MOVLconst) 7177 v.AuxInt = int32ToAuxInt(0) 7178 return true 7179 } 7180 return false 7181 } 7182 func rewriteValue386_Op386SETBE(v *Value) bool { 7183 v_0 := v.Args[0] 7184 // match: (SETBE (InvertFlags x)) 7185 // result: (SETAE x) 7186 for { 7187 if v_0.Op != Op386InvertFlags { 7188 break 7189 } 7190 x := v_0.Args[0] 7191 v.reset(Op386SETAE) 7192 v.AddArg(x) 7193 return true 7194 } 7195 // match: (SETBE (FlagEQ)) 7196 // result: (MOVLconst [1]) 7197 for { 7198 if v_0.Op != Op386FlagEQ { 7199 break 7200 } 7201 v.reset(Op386MOVLconst) 7202 v.AuxInt = int32ToAuxInt(1) 7203 return true 7204 } 7205 // match: (SETBE (FlagLT_ULT)) 7206 // result: (MOVLconst [1]) 7207 for { 7208 if v_0.Op != Op386FlagLT_ULT { 7209 break 7210 } 7211 v.reset(Op386MOVLconst) 7212 v.AuxInt = int32ToAuxInt(1) 7213 return true 7214 } 7215 // match: (SETBE (FlagLT_UGT)) 7216 // result: (MOVLconst [0]) 7217 for { 7218 if v_0.Op != Op386FlagLT_UGT { 7219 break 7220 } 7221 v.reset(Op386MOVLconst) 7222 v.AuxInt = int32ToAuxInt(0) 7223 return true 7224 } 7225 // match: (SETBE (FlagGT_ULT)) 7226 // result: (MOVLconst [1]) 7227 for { 7228 if v_0.Op != Op386FlagGT_ULT { 7229 break 7230 } 7231 v.reset(Op386MOVLconst) 7232 v.AuxInt = int32ToAuxInt(1) 7233 return true 7234 } 7235 // match: (SETBE (FlagGT_UGT)) 7236 // result: (MOVLconst [0]) 7237 for { 7238 if v_0.Op != Op386FlagGT_UGT { 7239 break 7240 } 7241 v.reset(Op386MOVLconst) 7242 v.AuxInt = int32ToAuxInt(0) 7243 return true 7244 } 7245 return false 7246 } 7247 func rewriteValue386_Op386SETEQ(v *Value) bool { 7248 v_0 := v.Args[0] 7249 // match: (SETEQ (InvertFlags x)) 7250 // result: (SETEQ x) 7251 for { 7252 if v_0.Op != Op386InvertFlags { 7253 break 7254 } 7255 x := v_0.Args[0] 7256 v.reset(Op386SETEQ) 7257 v.AddArg(x) 7258 return true 7259 } 7260 // match: (SETEQ (FlagEQ)) 7261 // result: (MOVLconst [1]) 7262 for { 7263 if v_0.Op != Op386FlagEQ { 7264 break 7265 } 7266 v.reset(Op386MOVLconst) 7267 v.AuxInt = int32ToAuxInt(1) 7268 return true 7269 } 7270 // match: (SETEQ (FlagLT_ULT)) 7271 // result: (MOVLconst [0]) 7272 for { 7273 if v_0.Op != Op386FlagLT_ULT { 7274 break 7275 } 7276 v.reset(Op386MOVLconst) 7277 v.AuxInt = int32ToAuxInt(0) 7278 return true 7279 } 7280 // match: (SETEQ (FlagLT_UGT)) 7281 // result: (MOVLconst [0]) 7282 for { 7283 if v_0.Op != Op386FlagLT_UGT { 7284 break 7285 } 7286 v.reset(Op386MOVLconst) 7287 v.AuxInt = int32ToAuxInt(0) 7288 return true 7289 } 7290 // match: (SETEQ (FlagGT_ULT)) 7291 // result: (MOVLconst [0]) 7292 for { 7293 if v_0.Op != Op386FlagGT_ULT { 7294 break 7295 } 7296 v.reset(Op386MOVLconst) 7297 v.AuxInt = int32ToAuxInt(0) 7298 return true 7299 } 7300 // match: (SETEQ (FlagGT_UGT)) 7301 // result: (MOVLconst [0]) 7302 for { 7303 if v_0.Op != Op386FlagGT_UGT { 7304 break 7305 } 7306 v.reset(Op386MOVLconst) 7307 v.AuxInt = int32ToAuxInt(0) 7308 return true 7309 } 7310 return false 7311 } 7312 func rewriteValue386_Op386SETG(v *Value) bool { 7313 v_0 := v.Args[0] 7314 // match: (SETG (InvertFlags x)) 7315 // result: (SETL x) 7316 for { 7317 if v_0.Op != Op386InvertFlags { 7318 break 7319 } 7320 x := v_0.Args[0] 7321 v.reset(Op386SETL) 7322 v.AddArg(x) 7323 return true 7324 } 7325 // match: (SETG (FlagEQ)) 7326 // result: (MOVLconst [0]) 7327 for { 7328 if v_0.Op != Op386FlagEQ { 7329 break 7330 } 7331 v.reset(Op386MOVLconst) 7332 v.AuxInt = int32ToAuxInt(0) 7333 return true 7334 } 7335 // match: (SETG (FlagLT_ULT)) 7336 // result: (MOVLconst [0]) 7337 for { 7338 if v_0.Op != Op386FlagLT_ULT { 7339 break 7340 } 7341 v.reset(Op386MOVLconst) 7342 v.AuxInt = int32ToAuxInt(0) 7343 return true 7344 } 7345 // match: (SETG (FlagLT_UGT)) 7346 // result: (MOVLconst [0]) 7347 for { 7348 if v_0.Op != Op386FlagLT_UGT { 7349 break 7350 } 7351 v.reset(Op386MOVLconst) 7352 v.AuxInt = int32ToAuxInt(0) 7353 return true 7354 } 7355 // match: (SETG (FlagGT_ULT)) 7356 // result: (MOVLconst [1]) 7357 for { 7358 if v_0.Op != Op386FlagGT_ULT { 7359 break 7360 } 7361 v.reset(Op386MOVLconst) 7362 v.AuxInt = int32ToAuxInt(1) 7363 return true 7364 } 7365 // match: (SETG (FlagGT_UGT)) 7366 // result: (MOVLconst [1]) 7367 for { 7368 if v_0.Op != Op386FlagGT_UGT { 7369 break 7370 } 7371 v.reset(Op386MOVLconst) 7372 v.AuxInt = int32ToAuxInt(1) 7373 return true 7374 } 7375 return false 7376 } 7377 func rewriteValue386_Op386SETGE(v *Value) bool { 7378 v_0 := v.Args[0] 7379 // match: (SETGE (InvertFlags x)) 7380 // result: (SETLE x) 7381 for { 7382 if v_0.Op != Op386InvertFlags { 7383 break 7384 } 7385 x := v_0.Args[0] 7386 v.reset(Op386SETLE) 7387 v.AddArg(x) 7388 return true 7389 } 7390 // match: (SETGE (FlagEQ)) 7391 // result: (MOVLconst [1]) 7392 for { 7393 if v_0.Op != Op386FlagEQ { 7394 break 7395 } 7396 v.reset(Op386MOVLconst) 7397 v.AuxInt = int32ToAuxInt(1) 7398 return true 7399 } 7400 // match: (SETGE (FlagLT_ULT)) 7401 // result: (MOVLconst [0]) 7402 for { 7403 if v_0.Op != Op386FlagLT_ULT { 7404 break 7405 } 7406 v.reset(Op386MOVLconst) 7407 v.AuxInt = int32ToAuxInt(0) 7408 return true 7409 } 7410 // match: (SETGE (FlagLT_UGT)) 7411 // result: (MOVLconst [0]) 7412 for { 7413 if v_0.Op != Op386FlagLT_UGT { 7414 break 7415 } 7416 v.reset(Op386MOVLconst) 7417 v.AuxInt = int32ToAuxInt(0) 7418 return true 7419 } 7420 // match: (SETGE (FlagGT_ULT)) 7421 // result: (MOVLconst [1]) 7422 for { 7423 if v_0.Op != Op386FlagGT_ULT { 7424 break 7425 } 7426 v.reset(Op386MOVLconst) 7427 v.AuxInt = int32ToAuxInt(1) 7428 return true 7429 } 7430 // match: (SETGE (FlagGT_UGT)) 7431 // result: (MOVLconst [1]) 7432 for { 7433 if v_0.Op != Op386FlagGT_UGT { 7434 break 7435 } 7436 v.reset(Op386MOVLconst) 7437 v.AuxInt = int32ToAuxInt(1) 7438 return true 7439 } 7440 return false 7441 } 7442 func rewriteValue386_Op386SETL(v *Value) bool { 7443 v_0 := v.Args[0] 7444 // match: (SETL (InvertFlags x)) 7445 // result: (SETG x) 7446 for { 7447 if v_0.Op != Op386InvertFlags { 7448 break 7449 } 7450 x := v_0.Args[0] 7451 v.reset(Op386SETG) 7452 v.AddArg(x) 7453 return true 7454 } 7455 // match: (SETL (FlagEQ)) 7456 // result: (MOVLconst [0]) 7457 for { 7458 if v_0.Op != Op386FlagEQ { 7459 break 7460 } 7461 v.reset(Op386MOVLconst) 7462 v.AuxInt = int32ToAuxInt(0) 7463 return true 7464 } 7465 // match: (SETL (FlagLT_ULT)) 7466 // result: (MOVLconst [1]) 7467 for { 7468 if v_0.Op != Op386FlagLT_ULT { 7469 break 7470 } 7471 v.reset(Op386MOVLconst) 7472 v.AuxInt = int32ToAuxInt(1) 7473 return true 7474 } 7475 // match: (SETL (FlagLT_UGT)) 7476 // result: (MOVLconst [1]) 7477 for { 7478 if v_0.Op != Op386FlagLT_UGT { 7479 break 7480 } 7481 v.reset(Op386MOVLconst) 7482 v.AuxInt = int32ToAuxInt(1) 7483 return true 7484 } 7485 // match: (SETL (FlagGT_ULT)) 7486 // result: (MOVLconst [0]) 7487 for { 7488 if v_0.Op != Op386FlagGT_ULT { 7489 break 7490 } 7491 v.reset(Op386MOVLconst) 7492 v.AuxInt = int32ToAuxInt(0) 7493 return true 7494 } 7495 // match: (SETL (FlagGT_UGT)) 7496 // result: (MOVLconst [0]) 7497 for { 7498 if v_0.Op != Op386FlagGT_UGT { 7499 break 7500 } 7501 v.reset(Op386MOVLconst) 7502 v.AuxInt = int32ToAuxInt(0) 7503 return true 7504 } 7505 return false 7506 } 7507 func rewriteValue386_Op386SETLE(v *Value) bool { 7508 v_0 := v.Args[0] 7509 // match: (SETLE (InvertFlags x)) 7510 // result: (SETGE x) 7511 for { 7512 if v_0.Op != Op386InvertFlags { 7513 break 7514 } 7515 x := v_0.Args[0] 7516 v.reset(Op386SETGE) 7517 v.AddArg(x) 7518 return true 7519 } 7520 // match: (SETLE (FlagEQ)) 7521 // result: (MOVLconst [1]) 7522 for { 7523 if v_0.Op != Op386FlagEQ { 7524 break 7525 } 7526 v.reset(Op386MOVLconst) 7527 v.AuxInt = int32ToAuxInt(1) 7528 return true 7529 } 7530 // match: (SETLE (FlagLT_ULT)) 7531 // result: (MOVLconst [1]) 7532 for { 7533 if v_0.Op != Op386FlagLT_ULT { 7534 break 7535 } 7536 v.reset(Op386MOVLconst) 7537 v.AuxInt = int32ToAuxInt(1) 7538 return true 7539 } 7540 // match: (SETLE (FlagLT_UGT)) 7541 // result: (MOVLconst [1]) 7542 for { 7543 if v_0.Op != Op386FlagLT_UGT { 7544 break 7545 } 7546 v.reset(Op386MOVLconst) 7547 v.AuxInt = int32ToAuxInt(1) 7548 return true 7549 } 7550 // match: (SETLE (FlagGT_ULT)) 7551 // result: (MOVLconst [0]) 7552 for { 7553 if v_0.Op != Op386FlagGT_ULT { 7554 break 7555 } 7556 v.reset(Op386MOVLconst) 7557 v.AuxInt = int32ToAuxInt(0) 7558 return true 7559 } 7560 // match: (SETLE (FlagGT_UGT)) 7561 // result: (MOVLconst [0]) 7562 for { 7563 if v_0.Op != Op386FlagGT_UGT { 7564 break 7565 } 7566 v.reset(Op386MOVLconst) 7567 v.AuxInt = int32ToAuxInt(0) 7568 return true 7569 } 7570 return false 7571 } 7572 func rewriteValue386_Op386SETNE(v *Value) bool { 7573 v_0 := v.Args[0] 7574 // match: (SETNE (InvertFlags x)) 7575 // result: (SETNE x) 7576 for { 7577 if v_0.Op != Op386InvertFlags { 7578 break 7579 } 7580 x := v_0.Args[0] 7581 v.reset(Op386SETNE) 7582 v.AddArg(x) 7583 return true 7584 } 7585 // match: (SETNE (FlagEQ)) 7586 // result: (MOVLconst [0]) 7587 for { 7588 if v_0.Op != Op386FlagEQ { 7589 break 7590 } 7591 v.reset(Op386MOVLconst) 7592 v.AuxInt = int32ToAuxInt(0) 7593 return true 7594 } 7595 // match: (SETNE (FlagLT_ULT)) 7596 // result: (MOVLconst [1]) 7597 for { 7598 if v_0.Op != Op386FlagLT_ULT { 7599 break 7600 } 7601 v.reset(Op386MOVLconst) 7602 v.AuxInt = int32ToAuxInt(1) 7603 return true 7604 } 7605 // match: (SETNE (FlagLT_UGT)) 7606 // result: (MOVLconst [1]) 7607 for { 7608 if v_0.Op != Op386FlagLT_UGT { 7609 break 7610 } 7611 v.reset(Op386MOVLconst) 7612 v.AuxInt = int32ToAuxInt(1) 7613 return true 7614 } 7615 // match: (SETNE (FlagGT_ULT)) 7616 // result: (MOVLconst [1]) 7617 for { 7618 if v_0.Op != Op386FlagGT_ULT { 7619 break 7620 } 7621 v.reset(Op386MOVLconst) 7622 v.AuxInt = int32ToAuxInt(1) 7623 return true 7624 } 7625 // match: (SETNE (FlagGT_UGT)) 7626 // result: (MOVLconst [1]) 7627 for { 7628 if v_0.Op != Op386FlagGT_UGT { 7629 break 7630 } 7631 v.reset(Op386MOVLconst) 7632 v.AuxInt = int32ToAuxInt(1) 7633 return true 7634 } 7635 return false 7636 } 7637 func rewriteValue386_Op386SHLL(v *Value) bool { 7638 v_1 := v.Args[1] 7639 v_0 := v.Args[0] 7640 // match: (SHLL x (MOVLconst [c])) 7641 // result: (SHLLconst [c&31] x) 7642 for { 7643 x := v_0 7644 if v_1.Op != Op386MOVLconst { 7645 break 7646 } 7647 c := auxIntToInt32(v_1.AuxInt) 7648 v.reset(Op386SHLLconst) 7649 v.AuxInt = int32ToAuxInt(c & 31) 7650 v.AddArg(x) 7651 return true 7652 } 7653 // match: (SHLL x (ANDLconst [31] y)) 7654 // result: (SHLL x y) 7655 for { 7656 x := v_0 7657 if v_1.Op != Op386ANDLconst || auxIntToInt32(v_1.AuxInt) != 31 { 7658 break 7659 } 7660 y := v_1.Args[0] 7661 v.reset(Op386SHLL) 7662 v.AddArg2(x, y) 7663 return true 7664 } 7665 return false 7666 } 7667 func rewriteValue386_Op386SHLLconst(v *Value) bool { 7668 v_0 := v.Args[0] 7669 // match: (SHLLconst x [0]) 7670 // result: x 7671 for { 7672 if auxIntToInt32(v.AuxInt) != 0 { 7673 break 7674 } 7675 x := v_0 7676 v.copyOf(x) 7677 return true 7678 } 7679 return false 7680 } 7681 func rewriteValue386_Op386SHRB(v *Value) bool { 7682 v_1 := v.Args[1] 7683 v_0 := v.Args[0] 7684 // match: (SHRB x (MOVLconst [c])) 7685 // cond: c&31 < 8 7686 // result: (SHRBconst [int8(c&31)] x) 7687 for { 7688 x := v_0 7689 if v_1.Op != Op386MOVLconst { 7690 break 7691 } 7692 c := auxIntToInt32(v_1.AuxInt) 7693 if !(c&31 < 8) { 7694 break 7695 } 7696 v.reset(Op386SHRBconst) 7697 v.AuxInt = int8ToAuxInt(int8(c & 31)) 7698 v.AddArg(x) 7699 return true 7700 } 7701 // match: (SHRB _ (MOVLconst [c])) 7702 // cond: c&31 >= 8 7703 // result: (MOVLconst [0]) 7704 for { 7705 if v_1.Op != Op386MOVLconst { 7706 break 7707 } 7708 c := auxIntToInt32(v_1.AuxInt) 7709 if !(c&31 >= 8) { 7710 break 7711 } 7712 v.reset(Op386MOVLconst) 7713 v.AuxInt = int32ToAuxInt(0) 7714 return true 7715 } 7716 return false 7717 } 7718 func rewriteValue386_Op386SHRBconst(v *Value) bool { 7719 v_0 := v.Args[0] 7720 // match: (SHRBconst x [0]) 7721 // result: x 7722 for { 7723 if auxIntToInt8(v.AuxInt) != 0 { 7724 break 7725 } 7726 x := v_0 7727 v.copyOf(x) 7728 return true 7729 } 7730 return false 7731 } 7732 func rewriteValue386_Op386SHRL(v *Value) bool { 7733 v_1 := v.Args[1] 7734 v_0 := v.Args[0] 7735 // match: (SHRL x (MOVLconst [c])) 7736 // result: (SHRLconst [c&31] x) 7737 for { 7738 x := v_0 7739 if v_1.Op != Op386MOVLconst { 7740 break 7741 } 7742 c := auxIntToInt32(v_1.AuxInt) 7743 v.reset(Op386SHRLconst) 7744 v.AuxInt = int32ToAuxInt(c & 31) 7745 v.AddArg(x) 7746 return true 7747 } 7748 // match: (SHRL x (ANDLconst [31] y)) 7749 // result: (SHRL x y) 7750 for { 7751 x := v_0 7752 if v_1.Op != Op386ANDLconst || auxIntToInt32(v_1.AuxInt) != 31 { 7753 break 7754 } 7755 y := v_1.Args[0] 7756 v.reset(Op386SHRL) 7757 v.AddArg2(x, y) 7758 return true 7759 } 7760 return false 7761 } 7762 func rewriteValue386_Op386SHRLconst(v *Value) bool { 7763 v_0 := v.Args[0] 7764 // match: (SHRLconst x [0]) 7765 // result: x 7766 for { 7767 if auxIntToInt32(v.AuxInt) != 0 { 7768 break 7769 } 7770 x := v_0 7771 v.copyOf(x) 7772 return true 7773 } 7774 return false 7775 } 7776 func rewriteValue386_Op386SHRW(v *Value) bool { 7777 v_1 := v.Args[1] 7778 v_0 := v.Args[0] 7779 // match: (SHRW x (MOVLconst [c])) 7780 // cond: c&31 < 16 7781 // result: (SHRWconst [int16(c&31)] x) 7782 for { 7783 x := v_0 7784 if v_1.Op != Op386MOVLconst { 7785 break 7786 } 7787 c := auxIntToInt32(v_1.AuxInt) 7788 if !(c&31 < 16) { 7789 break 7790 } 7791 v.reset(Op386SHRWconst) 7792 v.AuxInt = int16ToAuxInt(int16(c & 31)) 7793 v.AddArg(x) 7794 return true 7795 } 7796 // match: (SHRW _ (MOVLconst [c])) 7797 // cond: c&31 >= 16 7798 // result: (MOVLconst [0]) 7799 for { 7800 if v_1.Op != Op386MOVLconst { 7801 break 7802 } 7803 c := auxIntToInt32(v_1.AuxInt) 7804 if !(c&31 >= 16) { 7805 break 7806 } 7807 v.reset(Op386MOVLconst) 7808 v.AuxInt = int32ToAuxInt(0) 7809 return true 7810 } 7811 return false 7812 } 7813 func rewriteValue386_Op386SHRWconst(v *Value) bool { 7814 v_0 := v.Args[0] 7815 // match: (SHRWconst x [0]) 7816 // result: x 7817 for { 7818 if auxIntToInt16(v.AuxInt) != 0 { 7819 break 7820 } 7821 x := v_0 7822 v.copyOf(x) 7823 return true 7824 } 7825 return false 7826 } 7827 func rewriteValue386_Op386SUBL(v *Value) bool { 7828 v_1 := v.Args[1] 7829 v_0 := v.Args[0] 7830 b := v.Block 7831 // match: (SUBL x (MOVLconst [c])) 7832 // result: (SUBLconst x [c]) 7833 for { 7834 x := v_0 7835 if v_1.Op != Op386MOVLconst { 7836 break 7837 } 7838 c := auxIntToInt32(v_1.AuxInt) 7839 v.reset(Op386SUBLconst) 7840 v.AuxInt = int32ToAuxInt(c) 7841 v.AddArg(x) 7842 return true 7843 } 7844 // match: (SUBL (MOVLconst [c]) x) 7845 // result: (NEGL (SUBLconst <v.Type> x [c])) 7846 for { 7847 if v_0.Op != Op386MOVLconst { 7848 break 7849 } 7850 c := auxIntToInt32(v_0.AuxInt) 7851 x := v_1 7852 v.reset(Op386NEGL) 7853 v0 := b.NewValue0(v.Pos, Op386SUBLconst, v.Type) 7854 v0.AuxInt = int32ToAuxInt(c) 7855 v0.AddArg(x) 7856 v.AddArg(v0) 7857 return true 7858 } 7859 // match: (SUBL x l:(MOVLload [off] {sym} ptr mem)) 7860 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 7861 // result: (SUBLload x [off] {sym} ptr mem) 7862 for { 7863 x := v_0 7864 l := v_1 7865 if l.Op != Op386MOVLload { 7866 break 7867 } 7868 off := auxIntToInt32(l.AuxInt) 7869 sym := auxToSym(l.Aux) 7870 mem := l.Args[1] 7871 ptr := l.Args[0] 7872 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 7873 break 7874 } 7875 v.reset(Op386SUBLload) 7876 v.AuxInt = int32ToAuxInt(off) 7877 v.Aux = symToAux(sym) 7878 v.AddArg3(x, ptr, mem) 7879 return true 7880 } 7881 // match: (SUBL x x) 7882 // result: (MOVLconst [0]) 7883 for { 7884 x := v_0 7885 if x != v_1 { 7886 break 7887 } 7888 v.reset(Op386MOVLconst) 7889 v.AuxInt = int32ToAuxInt(0) 7890 return true 7891 } 7892 return false 7893 } 7894 func rewriteValue386_Op386SUBLcarry(v *Value) bool { 7895 v_1 := v.Args[1] 7896 v_0 := v.Args[0] 7897 // match: (SUBLcarry x (MOVLconst [c])) 7898 // result: (SUBLconstcarry [c] x) 7899 for { 7900 x := v_0 7901 if v_1.Op != Op386MOVLconst { 7902 break 7903 } 7904 c := auxIntToInt32(v_1.AuxInt) 7905 v.reset(Op386SUBLconstcarry) 7906 v.AuxInt = int32ToAuxInt(c) 7907 v.AddArg(x) 7908 return true 7909 } 7910 return false 7911 } 7912 func rewriteValue386_Op386SUBLconst(v *Value) bool { 7913 v_0 := v.Args[0] 7914 // match: (SUBLconst [c] x) 7915 // cond: c==0 7916 // result: x 7917 for { 7918 c := auxIntToInt32(v.AuxInt) 7919 x := v_0 7920 if !(c == 0) { 7921 break 7922 } 7923 v.copyOf(x) 7924 return true 7925 } 7926 // match: (SUBLconst [c] x) 7927 // result: (ADDLconst [-c] x) 7928 for { 7929 c := auxIntToInt32(v.AuxInt) 7930 x := v_0 7931 v.reset(Op386ADDLconst) 7932 v.AuxInt = int32ToAuxInt(-c) 7933 v.AddArg(x) 7934 return true 7935 } 7936 } 7937 func rewriteValue386_Op386SUBLload(v *Value) bool { 7938 v_2 := v.Args[2] 7939 v_1 := v.Args[1] 7940 v_0 := v.Args[0] 7941 b := v.Block 7942 config := b.Func.Config 7943 // match: (SUBLload [off1] {sym} val (ADDLconst [off2] base) mem) 7944 // cond: is32Bit(int64(off1)+int64(off2)) 7945 // result: (SUBLload [off1+off2] {sym} val base mem) 7946 for { 7947 off1 := auxIntToInt32(v.AuxInt) 7948 sym := auxToSym(v.Aux) 7949 val := v_0 7950 if v_1.Op != Op386ADDLconst { 7951 break 7952 } 7953 off2 := auxIntToInt32(v_1.AuxInt) 7954 base := v_1.Args[0] 7955 mem := v_2 7956 if !(is32Bit(int64(off1) + int64(off2))) { 7957 break 7958 } 7959 v.reset(Op386SUBLload) 7960 v.AuxInt = int32ToAuxInt(off1 + off2) 7961 v.Aux = symToAux(sym) 7962 v.AddArg3(val, base, mem) 7963 return true 7964 } 7965 // match: (SUBLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 7966 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 7967 // result: (SUBLload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 7968 for { 7969 off1 := auxIntToInt32(v.AuxInt) 7970 sym1 := auxToSym(v.Aux) 7971 val := v_0 7972 if v_1.Op != Op386LEAL { 7973 break 7974 } 7975 off2 := auxIntToInt32(v_1.AuxInt) 7976 sym2 := auxToSym(v_1.Aux) 7977 base := v_1.Args[0] 7978 mem := v_2 7979 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 7980 break 7981 } 7982 v.reset(Op386SUBLload) 7983 v.AuxInt = int32ToAuxInt(off1 + off2) 7984 v.Aux = symToAux(mergeSym(sym1, sym2)) 7985 v.AddArg3(val, base, mem) 7986 return true 7987 } 7988 return false 7989 } 7990 func rewriteValue386_Op386SUBLmodify(v *Value) bool { 7991 v_2 := v.Args[2] 7992 v_1 := v.Args[1] 7993 v_0 := v.Args[0] 7994 b := v.Block 7995 config := b.Func.Config 7996 // match: (SUBLmodify [off1] {sym} (ADDLconst [off2] base) val mem) 7997 // cond: is32Bit(int64(off1)+int64(off2)) 7998 // result: (SUBLmodify [off1+off2] {sym} base val mem) 7999 for { 8000 off1 := auxIntToInt32(v.AuxInt) 8001 sym := auxToSym(v.Aux) 8002 if v_0.Op != Op386ADDLconst { 8003 break 8004 } 8005 off2 := auxIntToInt32(v_0.AuxInt) 8006 base := v_0.Args[0] 8007 val := v_1 8008 mem := v_2 8009 if !(is32Bit(int64(off1) + int64(off2))) { 8010 break 8011 } 8012 v.reset(Op386SUBLmodify) 8013 v.AuxInt = int32ToAuxInt(off1 + off2) 8014 v.Aux = symToAux(sym) 8015 v.AddArg3(base, val, mem) 8016 return true 8017 } 8018 // match: (SUBLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 8019 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 8020 // result: (SUBLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem) 8021 for { 8022 off1 := auxIntToInt32(v.AuxInt) 8023 sym1 := auxToSym(v.Aux) 8024 if v_0.Op != Op386LEAL { 8025 break 8026 } 8027 off2 := auxIntToInt32(v_0.AuxInt) 8028 sym2 := auxToSym(v_0.Aux) 8029 base := v_0.Args[0] 8030 val := v_1 8031 mem := v_2 8032 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 8033 break 8034 } 8035 v.reset(Op386SUBLmodify) 8036 v.AuxInt = int32ToAuxInt(off1 + off2) 8037 v.Aux = symToAux(mergeSym(sym1, sym2)) 8038 v.AddArg3(base, val, mem) 8039 return true 8040 } 8041 return false 8042 } 8043 func rewriteValue386_Op386SUBSD(v *Value) bool { 8044 v_1 := v.Args[1] 8045 v_0 := v.Args[0] 8046 // match: (SUBSD x l:(MOVSDload [off] {sym} ptr mem)) 8047 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 8048 // result: (SUBSDload x [off] {sym} ptr mem) 8049 for { 8050 x := v_0 8051 l := v_1 8052 if l.Op != Op386MOVSDload { 8053 break 8054 } 8055 off := auxIntToInt32(l.AuxInt) 8056 sym := auxToSym(l.Aux) 8057 mem := l.Args[1] 8058 ptr := l.Args[0] 8059 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 8060 break 8061 } 8062 v.reset(Op386SUBSDload) 8063 v.AuxInt = int32ToAuxInt(off) 8064 v.Aux = symToAux(sym) 8065 v.AddArg3(x, ptr, mem) 8066 return true 8067 } 8068 return false 8069 } 8070 func rewriteValue386_Op386SUBSDload(v *Value) bool { 8071 v_2 := v.Args[2] 8072 v_1 := v.Args[1] 8073 v_0 := v.Args[0] 8074 b := v.Block 8075 config := b.Func.Config 8076 // match: (SUBSDload [off1] {sym} val (ADDLconst [off2] base) mem) 8077 // cond: is32Bit(int64(off1)+int64(off2)) 8078 // result: (SUBSDload [off1+off2] {sym} val base mem) 8079 for { 8080 off1 := auxIntToInt32(v.AuxInt) 8081 sym := auxToSym(v.Aux) 8082 val := v_0 8083 if v_1.Op != Op386ADDLconst { 8084 break 8085 } 8086 off2 := auxIntToInt32(v_1.AuxInt) 8087 base := v_1.Args[0] 8088 mem := v_2 8089 if !(is32Bit(int64(off1) + int64(off2))) { 8090 break 8091 } 8092 v.reset(Op386SUBSDload) 8093 v.AuxInt = int32ToAuxInt(off1 + off2) 8094 v.Aux = symToAux(sym) 8095 v.AddArg3(val, base, mem) 8096 return true 8097 } 8098 // match: (SUBSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 8099 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 8100 // result: (SUBSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 8101 for { 8102 off1 := auxIntToInt32(v.AuxInt) 8103 sym1 := auxToSym(v.Aux) 8104 val := v_0 8105 if v_1.Op != Op386LEAL { 8106 break 8107 } 8108 off2 := auxIntToInt32(v_1.AuxInt) 8109 sym2 := auxToSym(v_1.Aux) 8110 base := v_1.Args[0] 8111 mem := v_2 8112 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 8113 break 8114 } 8115 v.reset(Op386SUBSDload) 8116 v.AuxInt = int32ToAuxInt(off1 + off2) 8117 v.Aux = symToAux(mergeSym(sym1, sym2)) 8118 v.AddArg3(val, base, mem) 8119 return true 8120 } 8121 return false 8122 } 8123 func rewriteValue386_Op386SUBSS(v *Value) bool { 8124 v_1 := v.Args[1] 8125 v_0 := v.Args[0] 8126 // match: (SUBSS x l:(MOVSSload [off] {sym} ptr mem)) 8127 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 8128 // result: (SUBSSload x [off] {sym} ptr mem) 8129 for { 8130 x := v_0 8131 l := v_1 8132 if l.Op != Op386MOVSSload { 8133 break 8134 } 8135 off := auxIntToInt32(l.AuxInt) 8136 sym := auxToSym(l.Aux) 8137 mem := l.Args[1] 8138 ptr := l.Args[0] 8139 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 8140 break 8141 } 8142 v.reset(Op386SUBSSload) 8143 v.AuxInt = int32ToAuxInt(off) 8144 v.Aux = symToAux(sym) 8145 v.AddArg3(x, ptr, mem) 8146 return true 8147 } 8148 return false 8149 } 8150 func rewriteValue386_Op386SUBSSload(v *Value) bool { 8151 v_2 := v.Args[2] 8152 v_1 := v.Args[1] 8153 v_0 := v.Args[0] 8154 b := v.Block 8155 config := b.Func.Config 8156 // match: (SUBSSload [off1] {sym} val (ADDLconst [off2] base) mem) 8157 // cond: is32Bit(int64(off1)+int64(off2)) 8158 // result: (SUBSSload [off1+off2] {sym} val base mem) 8159 for { 8160 off1 := auxIntToInt32(v.AuxInt) 8161 sym := auxToSym(v.Aux) 8162 val := v_0 8163 if v_1.Op != Op386ADDLconst { 8164 break 8165 } 8166 off2 := auxIntToInt32(v_1.AuxInt) 8167 base := v_1.Args[0] 8168 mem := v_2 8169 if !(is32Bit(int64(off1) + int64(off2))) { 8170 break 8171 } 8172 v.reset(Op386SUBSSload) 8173 v.AuxInt = int32ToAuxInt(off1 + off2) 8174 v.Aux = symToAux(sym) 8175 v.AddArg3(val, base, mem) 8176 return true 8177 } 8178 // match: (SUBSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 8179 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 8180 // result: (SUBSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 8181 for { 8182 off1 := auxIntToInt32(v.AuxInt) 8183 sym1 := auxToSym(v.Aux) 8184 val := v_0 8185 if v_1.Op != Op386LEAL { 8186 break 8187 } 8188 off2 := auxIntToInt32(v_1.AuxInt) 8189 sym2 := auxToSym(v_1.Aux) 8190 base := v_1.Args[0] 8191 mem := v_2 8192 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 8193 break 8194 } 8195 v.reset(Op386SUBSSload) 8196 v.AuxInt = int32ToAuxInt(off1 + off2) 8197 v.Aux = symToAux(mergeSym(sym1, sym2)) 8198 v.AddArg3(val, base, mem) 8199 return true 8200 } 8201 return false 8202 } 8203 func rewriteValue386_Op386XORL(v *Value) bool { 8204 v_1 := v.Args[1] 8205 v_0 := v.Args[0] 8206 // match: (XORL x (MOVLconst [c])) 8207 // result: (XORLconst [c] x) 8208 for { 8209 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 8210 x := v_0 8211 if v_1.Op != Op386MOVLconst { 8212 continue 8213 } 8214 c := auxIntToInt32(v_1.AuxInt) 8215 v.reset(Op386XORLconst) 8216 v.AuxInt = int32ToAuxInt(c) 8217 v.AddArg(x) 8218 return true 8219 } 8220 break 8221 } 8222 // match: (XORL x l:(MOVLload [off] {sym} ptr mem)) 8223 // cond: canMergeLoadClobber(v, l, x) && clobber(l) 8224 // result: (XORLload x [off] {sym} ptr mem) 8225 for { 8226 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 8227 x := v_0 8228 l := v_1 8229 if l.Op != Op386MOVLload { 8230 continue 8231 } 8232 off := auxIntToInt32(l.AuxInt) 8233 sym := auxToSym(l.Aux) 8234 mem := l.Args[1] 8235 ptr := l.Args[0] 8236 if !(canMergeLoadClobber(v, l, x) && clobber(l)) { 8237 continue 8238 } 8239 v.reset(Op386XORLload) 8240 v.AuxInt = int32ToAuxInt(off) 8241 v.Aux = symToAux(sym) 8242 v.AddArg3(x, ptr, mem) 8243 return true 8244 } 8245 break 8246 } 8247 // match: (XORL x x) 8248 // result: (MOVLconst [0]) 8249 for { 8250 x := v_0 8251 if x != v_1 { 8252 break 8253 } 8254 v.reset(Op386MOVLconst) 8255 v.AuxInt = int32ToAuxInt(0) 8256 return true 8257 } 8258 return false 8259 } 8260 func rewriteValue386_Op386XORLconst(v *Value) bool { 8261 v_0 := v.Args[0] 8262 // match: (XORLconst [c] (XORLconst [d] x)) 8263 // result: (XORLconst [c ^ d] x) 8264 for { 8265 c := auxIntToInt32(v.AuxInt) 8266 if v_0.Op != Op386XORLconst { 8267 break 8268 } 8269 d := auxIntToInt32(v_0.AuxInt) 8270 x := v_0.Args[0] 8271 v.reset(Op386XORLconst) 8272 v.AuxInt = int32ToAuxInt(c ^ d) 8273 v.AddArg(x) 8274 return true 8275 } 8276 // match: (XORLconst [c] x) 8277 // cond: c==0 8278 // result: x 8279 for { 8280 c := auxIntToInt32(v.AuxInt) 8281 x := v_0 8282 if !(c == 0) { 8283 break 8284 } 8285 v.copyOf(x) 8286 return true 8287 } 8288 // match: (XORLconst [c] (MOVLconst [d])) 8289 // result: (MOVLconst [c^d]) 8290 for { 8291 c := auxIntToInt32(v.AuxInt) 8292 if v_0.Op != Op386MOVLconst { 8293 break 8294 } 8295 d := auxIntToInt32(v_0.AuxInt) 8296 v.reset(Op386MOVLconst) 8297 v.AuxInt = int32ToAuxInt(c ^ d) 8298 return true 8299 } 8300 return false 8301 } 8302 func rewriteValue386_Op386XORLconstmodify(v *Value) bool { 8303 v_1 := v.Args[1] 8304 v_0 := v.Args[0] 8305 b := v.Block 8306 config := b.Func.Config 8307 // match: (XORLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem) 8308 // cond: valoff1.canAdd32(off2) 8309 // result: (XORLconstmodify [valoff1.addOffset32(off2)] {sym} base mem) 8310 for { 8311 valoff1 := auxIntToValAndOff(v.AuxInt) 8312 sym := auxToSym(v.Aux) 8313 if v_0.Op != Op386ADDLconst { 8314 break 8315 } 8316 off2 := auxIntToInt32(v_0.AuxInt) 8317 base := v_0.Args[0] 8318 mem := v_1 8319 if !(valoff1.canAdd32(off2)) { 8320 break 8321 } 8322 v.reset(Op386XORLconstmodify) 8323 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2)) 8324 v.Aux = symToAux(sym) 8325 v.AddArg2(base, mem) 8326 return true 8327 } 8328 // match: (XORLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem) 8329 // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 8330 // result: (XORLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem) 8331 for { 8332 valoff1 := auxIntToValAndOff(v.AuxInt) 8333 sym1 := auxToSym(v.Aux) 8334 if v_0.Op != Op386LEAL { 8335 break 8336 } 8337 off2 := auxIntToInt32(v_0.AuxInt) 8338 sym2 := auxToSym(v_0.Aux) 8339 base := v_0.Args[0] 8340 mem := v_1 8341 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 8342 break 8343 } 8344 v.reset(Op386XORLconstmodify) 8345 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2)) 8346 v.Aux = symToAux(mergeSym(sym1, sym2)) 8347 v.AddArg2(base, mem) 8348 return true 8349 } 8350 return false 8351 } 8352 func rewriteValue386_Op386XORLload(v *Value) bool { 8353 v_2 := v.Args[2] 8354 v_1 := v.Args[1] 8355 v_0 := v.Args[0] 8356 b := v.Block 8357 config := b.Func.Config 8358 // match: (XORLload [off1] {sym} val (ADDLconst [off2] base) mem) 8359 // cond: is32Bit(int64(off1)+int64(off2)) 8360 // result: (XORLload [off1+off2] {sym} val base mem) 8361 for { 8362 off1 := auxIntToInt32(v.AuxInt) 8363 sym := auxToSym(v.Aux) 8364 val := v_0 8365 if v_1.Op != Op386ADDLconst { 8366 break 8367 } 8368 off2 := auxIntToInt32(v_1.AuxInt) 8369 base := v_1.Args[0] 8370 mem := v_2 8371 if !(is32Bit(int64(off1) + int64(off2))) { 8372 break 8373 } 8374 v.reset(Op386XORLload) 8375 v.AuxInt = int32ToAuxInt(off1 + off2) 8376 v.Aux = symToAux(sym) 8377 v.AddArg3(val, base, mem) 8378 return true 8379 } 8380 // match: (XORLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem) 8381 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 8382 // result: (XORLload [off1+off2] {mergeSym(sym1,sym2)} val base mem) 8383 for { 8384 off1 := auxIntToInt32(v.AuxInt) 8385 sym1 := auxToSym(v.Aux) 8386 val := v_0 8387 if v_1.Op != Op386LEAL { 8388 break 8389 } 8390 off2 := auxIntToInt32(v_1.AuxInt) 8391 sym2 := auxToSym(v_1.Aux) 8392 base := v_1.Args[0] 8393 mem := v_2 8394 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 8395 break 8396 } 8397 v.reset(Op386XORLload) 8398 v.AuxInt = int32ToAuxInt(off1 + off2) 8399 v.Aux = symToAux(mergeSym(sym1, sym2)) 8400 v.AddArg3(val, base, mem) 8401 return true 8402 } 8403 return false 8404 } 8405 func rewriteValue386_Op386XORLmodify(v *Value) bool { 8406 v_2 := v.Args[2] 8407 v_1 := v.Args[1] 8408 v_0 := v.Args[0] 8409 b := v.Block 8410 config := b.Func.Config 8411 // match: (XORLmodify [off1] {sym} (ADDLconst [off2] base) val mem) 8412 // cond: is32Bit(int64(off1)+int64(off2)) 8413 // result: (XORLmodify [off1+off2] {sym} base val mem) 8414 for { 8415 off1 := auxIntToInt32(v.AuxInt) 8416 sym := auxToSym(v.Aux) 8417 if v_0.Op != Op386ADDLconst { 8418 break 8419 } 8420 off2 := auxIntToInt32(v_0.AuxInt) 8421 base := v_0.Args[0] 8422 val := v_1 8423 mem := v_2 8424 if !(is32Bit(int64(off1) + int64(off2))) { 8425 break 8426 } 8427 v.reset(Op386XORLmodify) 8428 v.AuxInt = int32ToAuxInt(off1 + off2) 8429 v.Aux = symToAux(sym) 8430 v.AddArg3(base, val, mem) 8431 return true 8432 } 8433 // match: (XORLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem) 8434 // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared) 8435 // result: (XORLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem) 8436 for { 8437 off1 := auxIntToInt32(v.AuxInt) 8438 sym1 := auxToSym(v.Aux) 8439 if v_0.Op != Op386LEAL { 8440 break 8441 } 8442 off2 := auxIntToInt32(v_0.AuxInt) 8443 sym2 := auxToSym(v_0.Aux) 8444 base := v_0.Args[0] 8445 val := v_1 8446 mem := v_2 8447 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) { 8448 break 8449 } 8450 v.reset(Op386XORLmodify) 8451 v.AuxInt = int32ToAuxInt(off1 + off2) 8452 v.Aux = symToAux(mergeSym(sym1, sym2)) 8453 v.AddArg3(base, val, mem) 8454 return true 8455 } 8456 return false 8457 } 8458 func rewriteValue386_OpAddr(v *Value) bool { 8459 v_0 := v.Args[0] 8460 // match: (Addr {sym} base) 8461 // result: (LEAL {sym} base) 8462 for { 8463 sym := auxToSym(v.Aux) 8464 base := v_0 8465 v.reset(Op386LEAL) 8466 v.Aux = symToAux(sym) 8467 v.AddArg(base) 8468 return true 8469 } 8470 } 8471 func rewriteValue386_OpConst16(v *Value) bool { 8472 // match: (Const16 [c]) 8473 // result: (MOVLconst [int32(c)]) 8474 for { 8475 c := auxIntToInt16(v.AuxInt) 8476 v.reset(Op386MOVLconst) 8477 v.AuxInt = int32ToAuxInt(int32(c)) 8478 return true 8479 } 8480 } 8481 func rewriteValue386_OpConst8(v *Value) bool { 8482 // match: (Const8 [c]) 8483 // result: (MOVLconst [int32(c)]) 8484 for { 8485 c := auxIntToInt8(v.AuxInt) 8486 v.reset(Op386MOVLconst) 8487 v.AuxInt = int32ToAuxInt(int32(c)) 8488 return true 8489 } 8490 } 8491 func rewriteValue386_OpConstBool(v *Value) bool { 8492 // match: (ConstBool [c]) 8493 // result: (MOVLconst [b2i32(c)]) 8494 for { 8495 c := auxIntToBool(v.AuxInt) 8496 v.reset(Op386MOVLconst) 8497 v.AuxInt = int32ToAuxInt(b2i32(c)) 8498 return true 8499 } 8500 } 8501 func rewriteValue386_OpConstNil(v *Value) bool { 8502 // match: (ConstNil) 8503 // result: (MOVLconst [0]) 8504 for { 8505 v.reset(Op386MOVLconst) 8506 v.AuxInt = int32ToAuxInt(0) 8507 return true 8508 } 8509 } 8510 func rewriteValue386_OpCtz16(v *Value) bool { 8511 v_0 := v.Args[0] 8512 b := v.Block 8513 typ := &b.Func.Config.Types 8514 // match: (Ctz16 x) 8515 // result: (BSFL (ORLconst <typ.UInt32> [0x10000] x)) 8516 for { 8517 x := v_0 8518 v.reset(Op386BSFL) 8519 v0 := b.NewValue0(v.Pos, Op386ORLconst, typ.UInt32) 8520 v0.AuxInt = int32ToAuxInt(0x10000) 8521 v0.AddArg(x) 8522 v.AddArg(v0) 8523 return true 8524 } 8525 } 8526 func rewriteValue386_OpDiv8(v *Value) bool { 8527 v_1 := v.Args[1] 8528 v_0 := v.Args[0] 8529 b := v.Block 8530 typ := &b.Func.Config.Types 8531 // match: (Div8 x y) 8532 // result: (DIVW (SignExt8to16 x) (SignExt8to16 y)) 8533 for { 8534 x := v_0 8535 y := v_1 8536 v.reset(Op386DIVW) 8537 v0 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16) 8538 v0.AddArg(x) 8539 v1 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16) 8540 v1.AddArg(y) 8541 v.AddArg2(v0, v1) 8542 return true 8543 } 8544 } 8545 func rewriteValue386_OpDiv8u(v *Value) bool { 8546 v_1 := v.Args[1] 8547 v_0 := v.Args[0] 8548 b := v.Block 8549 typ := &b.Func.Config.Types 8550 // match: (Div8u x y) 8551 // result: (DIVWU (ZeroExt8to16 x) (ZeroExt8to16 y)) 8552 for { 8553 x := v_0 8554 y := v_1 8555 v.reset(Op386DIVWU) 8556 v0 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16) 8557 v0.AddArg(x) 8558 v1 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16) 8559 v1.AddArg(y) 8560 v.AddArg2(v0, v1) 8561 return true 8562 } 8563 } 8564 func rewriteValue386_OpEq16(v *Value) bool { 8565 v_1 := v.Args[1] 8566 v_0 := v.Args[0] 8567 b := v.Block 8568 // match: (Eq16 x y) 8569 // result: (SETEQ (CMPW x y)) 8570 for { 8571 x := v_0 8572 y := v_1 8573 v.reset(Op386SETEQ) 8574 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags) 8575 v0.AddArg2(x, y) 8576 v.AddArg(v0) 8577 return true 8578 } 8579 } 8580 func rewriteValue386_OpEq32(v *Value) bool { 8581 v_1 := v.Args[1] 8582 v_0 := v.Args[0] 8583 b := v.Block 8584 // match: (Eq32 x y) 8585 // result: (SETEQ (CMPL x y)) 8586 for { 8587 x := v_0 8588 y := v_1 8589 v.reset(Op386SETEQ) 8590 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 8591 v0.AddArg2(x, y) 8592 v.AddArg(v0) 8593 return true 8594 } 8595 } 8596 func rewriteValue386_OpEq32F(v *Value) bool { 8597 v_1 := v.Args[1] 8598 v_0 := v.Args[0] 8599 b := v.Block 8600 // match: (Eq32F x y) 8601 // result: (SETEQF (UCOMISS x y)) 8602 for { 8603 x := v_0 8604 y := v_1 8605 v.reset(Op386SETEQF) 8606 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags) 8607 v0.AddArg2(x, y) 8608 v.AddArg(v0) 8609 return true 8610 } 8611 } 8612 func rewriteValue386_OpEq64F(v *Value) bool { 8613 v_1 := v.Args[1] 8614 v_0 := v.Args[0] 8615 b := v.Block 8616 // match: (Eq64F x y) 8617 // result: (SETEQF (UCOMISD x y)) 8618 for { 8619 x := v_0 8620 y := v_1 8621 v.reset(Op386SETEQF) 8622 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags) 8623 v0.AddArg2(x, y) 8624 v.AddArg(v0) 8625 return true 8626 } 8627 } 8628 func rewriteValue386_OpEq8(v *Value) bool { 8629 v_1 := v.Args[1] 8630 v_0 := v.Args[0] 8631 b := v.Block 8632 // match: (Eq8 x y) 8633 // result: (SETEQ (CMPB x y)) 8634 for { 8635 x := v_0 8636 y := v_1 8637 v.reset(Op386SETEQ) 8638 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags) 8639 v0.AddArg2(x, y) 8640 v.AddArg(v0) 8641 return true 8642 } 8643 } 8644 func rewriteValue386_OpEqB(v *Value) bool { 8645 v_1 := v.Args[1] 8646 v_0 := v.Args[0] 8647 b := v.Block 8648 // match: (EqB x y) 8649 // result: (SETEQ (CMPB x y)) 8650 for { 8651 x := v_0 8652 y := v_1 8653 v.reset(Op386SETEQ) 8654 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags) 8655 v0.AddArg2(x, y) 8656 v.AddArg(v0) 8657 return true 8658 } 8659 } 8660 func rewriteValue386_OpEqPtr(v *Value) bool { 8661 v_1 := v.Args[1] 8662 v_0 := v.Args[0] 8663 b := v.Block 8664 // match: (EqPtr x y) 8665 // result: (SETEQ (CMPL x y)) 8666 for { 8667 x := v_0 8668 y := v_1 8669 v.reset(Op386SETEQ) 8670 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 8671 v0.AddArg2(x, y) 8672 v.AddArg(v0) 8673 return true 8674 } 8675 } 8676 func rewriteValue386_OpIsInBounds(v *Value) bool { 8677 v_1 := v.Args[1] 8678 v_0 := v.Args[0] 8679 b := v.Block 8680 // match: (IsInBounds idx len) 8681 // result: (SETB (CMPL idx len)) 8682 for { 8683 idx := v_0 8684 len := v_1 8685 v.reset(Op386SETB) 8686 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 8687 v0.AddArg2(idx, len) 8688 v.AddArg(v0) 8689 return true 8690 } 8691 } 8692 func rewriteValue386_OpIsNonNil(v *Value) bool { 8693 v_0 := v.Args[0] 8694 b := v.Block 8695 // match: (IsNonNil p) 8696 // result: (SETNE (TESTL p p)) 8697 for { 8698 p := v_0 8699 v.reset(Op386SETNE) 8700 v0 := b.NewValue0(v.Pos, Op386TESTL, types.TypeFlags) 8701 v0.AddArg2(p, p) 8702 v.AddArg(v0) 8703 return true 8704 } 8705 } 8706 func rewriteValue386_OpIsSliceInBounds(v *Value) bool { 8707 v_1 := v.Args[1] 8708 v_0 := v.Args[0] 8709 b := v.Block 8710 // match: (IsSliceInBounds idx len) 8711 // result: (SETBE (CMPL idx len)) 8712 for { 8713 idx := v_0 8714 len := v_1 8715 v.reset(Op386SETBE) 8716 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 8717 v0.AddArg2(idx, len) 8718 v.AddArg(v0) 8719 return true 8720 } 8721 } 8722 func rewriteValue386_OpLeq16(v *Value) bool { 8723 v_1 := v.Args[1] 8724 v_0 := v.Args[0] 8725 b := v.Block 8726 // match: (Leq16 x y) 8727 // result: (SETLE (CMPW x y)) 8728 for { 8729 x := v_0 8730 y := v_1 8731 v.reset(Op386SETLE) 8732 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags) 8733 v0.AddArg2(x, y) 8734 v.AddArg(v0) 8735 return true 8736 } 8737 } 8738 func rewriteValue386_OpLeq16U(v *Value) bool { 8739 v_1 := v.Args[1] 8740 v_0 := v.Args[0] 8741 b := v.Block 8742 // match: (Leq16U x y) 8743 // result: (SETBE (CMPW x y)) 8744 for { 8745 x := v_0 8746 y := v_1 8747 v.reset(Op386SETBE) 8748 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags) 8749 v0.AddArg2(x, y) 8750 v.AddArg(v0) 8751 return true 8752 } 8753 } 8754 func rewriteValue386_OpLeq32(v *Value) bool { 8755 v_1 := v.Args[1] 8756 v_0 := v.Args[0] 8757 b := v.Block 8758 // match: (Leq32 x y) 8759 // result: (SETLE (CMPL x y)) 8760 for { 8761 x := v_0 8762 y := v_1 8763 v.reset(Op386SETLE) 8764 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 8765 v0.AddArg2(x, y) 8766 v.AddArg(v0) 8767 return true 8768 } 8769 } 8770 func rewriteValue386_OpLeq32F(v *Value) bool { 8771 v_1 := v.Args[1] 8772 v_0 := v.Args[0] 8773 b := v.Block 8774 // match: (Leq32F x y) 8775 // result: (SETGEF (UCOMISS y x)) 8776 for { 8777 x := v_0 8778 y := v_1 8779 v.reset(Op386SETGEF) 8780 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags) 8781 v0.AddArg2(y, x) 8782 v.AddArg(v0) 8783 return true 8784 } 8785 } 8786 func rewriteValue386_OpLeq32U(v *Value) bool { 8787 v_1 := v.Args[1] 8788 v_0 := v.Args[0] 8789 b := v.Block 8790 // match: (Leq32U x y) 8791 // result: (SETBE (CMPL x y)) 8792 for { 8793 x := v_0 8794 y := v_1 8795 v.reset(Op386SETBE) 8796 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 8797 v0.AddArg2(x, y) 8798 v.AddArg(v0) 8799 return true 8800 } 8801 } 8802 func rewriteValue386_OpLeq64F(v *Value) bool { 8803 v_1 := v.Args[1] 8804 v_0 := v.Args[0] 8805 b := v.Block 8806 // match: (Leq64F x y) 8807 // result: (SETGEF (UCOMISD y x)) 8808 for { 8809 x := v_0 8810 y := v_1 8811 v.reset(Op386SETGEF) 8812 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags) 8813 v0.AddArg2(y, x) 8814 v.AddArg(v0) 8815 return true 8816 } 8817 } 8818 func rewriteValue386_OpLeq8(v *Value) bool { 8819 v_1 := v.Args[1] 8820 v_0 := v.Args[0] 8821 b := v.Block 8822 // match: (Leq8 x y) 8823 // result: (SETLE (CMPB x y)) 8824 for { 8825 x := v_0 8826 y := v_1 8827 v.reset(Op386SETLE) 8828 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags) 8829 v0.AddArg2(x, y) 8830 v.AddArg(v0) 8831 return true 8832 } 8833 } 8834 func rewriteValue386_OpLeq8U(v *Value) bool { 8835 v_1 := v.Args[1] 8836 v_0 := v.Args[0] 8837 b := v.Block 8838 // match: (Leq8U x y) 8839 // result: (SETBE (CMPB x y)) 8840 for { 8841 x := v_0 8842 y := v_1 8843 v.reset(Op386SETBE) 8844 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags) 8845 v0.AddArg2(x, y) 8846 v.AddArg(v0) 8847 return true 8848 } 8849 } 8850 func rewriteValue386_OpLess16(v *Value) bool { 8851 v_1 := v.Args[1] 8852 v_0 := v.Args[0] 8853 b := v.Block 8854 // match: (Less16 x y) 8855 // result: (SETL (CMPW x y)) 8856 for { 8857 x := v_0 8858 y := v_1 8859 v.reset(Op386SETL) 8860 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags) 8861 v0.AddArg2(x, y) 8862 v.AddArg(v0) 8863 return true 8864 } 8865 } 8866 func rewriteValue386_OpLess16U(v *Value) bool { 8867 v_1 := v.Args[1] 8868 v_0 := v.Args[0] 8869 b := v.Block 8870 // match: (Less16U x y) 8871 // result: (SETB (CMPW x y)) 8872 for { 8873 x := v_0 8874 y := v_1 8875 v.reset(Op386SETB) 8876 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags) 8877 v0.AddArg2(x, y) 8878 v.AddArg(v0) 8879 return true 8880 } 8881 } 8882 func rewriteValue386_OpLess32(v *Value) bool { 8883 v_1 := v.Args[1] 8884 v_0 := v.Args[0] 8885 b := v.Block 8886 // match: (Less32 x y) 8887 // result: (SETL (CMPL x y)) 8888 for { 8889 x := v_0 8890 y := v_1 8891 v.reset(Op386SETL) 8892 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 8893 v0.AddArg2(x, y) 8894 v.AddArg(v0) 8895 return true 8896 } 8897 } 8898 func rewriteValue386_OpLess32F(v *Value) bool { 8899 v_1 := v.Args[1] 8900 v_0 := v.Args[0] 8901 b := v.Block 8902 // match: (Less32F x y) 8903 // result: (SETGF (UCOMISS y x)) 8904 for { 8905 x := v_0 8906 y := v_1 8907 v.reset(Op386SETGF) 8908 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags) 8909 v0.AddArg2(y, x) 8910 v.AddArg(v0) 8911 return true 8912 } 8913 } 8914 func rewriteValue386_OpLess32U(v *Value) bool { 8915 v_1 := v.Args[1] 8916 v_0 := v.Args[0] 8917 b := v.Block 8918 // match: (Less32U x y) 8919 // result: (SETB (CMPL x y)) 8920 for { 8921 x := v_0 8922 y := v_1 8923 v.reset(Op386SETB) 8924 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 8925 v0.AddArg2(x, y) 8926 v.AddArg(v0) 8927 return true 8928 } 8929 } 8930 func rewriteValue386_OpLess64F(v *Value) bool { 8931 v_1 := v.Args[1] 8932 v_0 := v.Args[0] 8933 b := v.Block 8934 // match: (Less64F x y) 8935 // result: (SETGF (UCOMISD y x)) 8936 for { 8937 x := v_0 8938 y := v_1 8939 v.reset(Op386SETGF) 8940 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags) 8941 v0.AddArg2(y, x) 8942 v.AddArg(v0) 8943 return true 8944 } 8945 } 8946 func rewriteValue386_OpLess8(v *Value) bool { 8947 v_1 := v.Args[1] 8948 v_0 := v.Args[0] 8949 b := v.Block 8950 // match: (Less8 x y) 8951 // result: (SETL (CMPB x y)) 8952 for { 8953 x := v_0 8954 y := v_1 8955 v.reset(Op386SETL) 8956 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags) 8957 v0.AddArg2(x, y) 8958 v.AddArg(v0) 8959 return true 8960 } 8961 } 8962 func rewriteValue386_OpLess8U(v *Value) bool { 8963 v_1 := v.Args[1] 8964 v_0 := v.Args[0] 8965 b := v.Block 8966 // match: (Less8U x y) 8967 // result: (SETB (CMPB x y)) 8968 for { 8969 x := v_0 8970 y := v_1 8971 v.reset(Op386SETB) 8972 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags) 8973 v0.AddArg2(x, y) 8974 v.AddArg(v0) 8975 return true 8976 } 8977 } 8978 func rewriteValue386_OpLoad(v *Value) bool { 8979 v_1 := v.Args[1] 8980 v_0 := v.Args[0] 8981 // match: (Load <t> ptr mem) 8982 // cond: (is32BitInt(t) || isPtr(t)) 8983 // result: (MOVLload ptr mem) 8984 for { 8985 t := v.Type 8986 ptr := v_0 8987 mem := v_1 8988 if !(is32BitInt(t) || isPtr(t)) { 8989 break 8990 } 8991 v.reset(Op386MOVLload) 8992 v.AddArg2(ptr, mem) 8993 return true 8994 } 8995 // match: (Load <t> ptr mem) 8996 // cond: is16BitInt(t) 8997 // result: (MOVWload ptr mem) 8998 for { 8999 t := v.Type 9000 ptr := v_0 9001 mem := v_1 9002 if !(is16BitInt(t)) { 9003 break 9004 } 9005 v.reset(Op386MOVWload) 9006 v.AddArg2(ptr, mem) 9007 return true 9008 } 9009 // match: (Load <t> ptr mem) 9010 // cond: (t.IsBoolean() || is8BitInt(t)) 9011 // result: (MOVBload ptr mem) 9012 for { 9013 t := v.Type 9014 ptr := v_0 9015 mem := v_1 9016 if !(t.IsBoolean() || is8BitInt(t)) { 9017 break 9018 } 9019 v.reset(Op386MOVBload) 9020 v.AddArg2(ptr, mem) 9021 return true 9022 } 9023 // match: (Load <t> ptr mem) 9024 // cond: is32BitFloat(t) 9025 // result: (MOVSSload ptr mem) 9026 for { 9027 t := v.Type 9028 ptr := v_0 9029 mem := v_1 9030 if !(is32BitFloat(t)) { 9031 break 9032 } 9033 v.reset(Op386MOVSSload) 9034 v.AddArg2(ptr, mem) 9035 return true 9036 } 9037 // match: (Load <t> ptr mem) 9038 // cond: is64BitFloat(t) 9039 // result: (MOVSDload ptr mem) 9040 for { 9041 t := v.Type 9042 ptr := v_0 9043 mem := v_1 9044 if !(is64BitFloat(t)) { 9045 break 9046 } 9047 v.reset(Op386MOVSDload) 9048 v.AddArg2(ptr, mem) 9049 return true 9050 } 9051 return false 9052 } 9053 func rewriteValue386_OpLocalAddr(v *Value) bool { 9054 v_0 := v.Args[0] 9055 // match: (LocalAddr {sym} base _) 9056 // result: (LEAL {sym} base) 9057 for { 9058 sym := auxToSym(v.Aux) 9059 base := v_0 9060 v.reset(Op386LEAL) 9061 v.Aux = symToAux(sym) 9062 v.AddArg(base) 9063 return true 9064 } 9065 } 9066 func rewriteValue386_OpLsh16x16(v *Value) bool { 9067 v_1 := v.Args[1] 9068 v_0 := v.Args[0] 9069 b := v.Block 9070 // match: (Lsh16x16 <t> x y) 9071 // cond: !shiftIsBounded(v) 9072 // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32]))) 9073 for { 9074 t := v.Type 9075 x := v_0 9076 y := v_1 9077 if !(!shiftIsBounded(v)) { 9078 break 9079 } 9080 v.reset(Op386ANDL) 9081 v0 := b.NewValue0(v.Pos, Op386SHLL, t) 9082 v0.AddArg2(x, y) 9083 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 9084 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 9085 v2.AuxInt = int16ToAuxInt(32) 9086 v2.AddArg(y) 9087 v1.AddArg(v2) 9088 v.AddArg2(v0, v1) 9089 return true 9090 } 9091 // match: (Lsh16x16 <t> x y) 9092 // cond: shiftIsBounded(v) 9093 // result: (SHLL <t> x y) 9094 for { 9095 t := v.Type 9096 x := v_0 9097 y := v_1 9098 if !(shiftIsBounded(v)) { 9099 break 9100 } 9101 v.reset(Op386SHLL) 9102 v.Type = t 9103 v.AddArg2(x, y) 9104 return true 9105 } 9106 return false 9107 } 9108 func rewriteValue386_OpLsh16x32(v *Value) bool { 9109 v_1 := v.Args[1] 9110 v_0 := v.Args[0] 9111 b := v.Block 9112 // match: (Lsh16x32 <t> x y) 9113 // cond: !shiftIsBounded(v) 9114 // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32]))) 9115 for { 9116 t := v.Type 9117 x := v_0 9118 y := v_1 9119 if !(!shiftIsBounded(v)) { 9120 break 9121 } 9122 v.reset(Op386ANDL) 9123 v0 := b.NewValue0(v.Pos, Op386SHLL, t) 9124 v0.AddArg2(x, y) 9125 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 9126 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 9127 v2.AuxInt = int32ToAuxInt(32) 9128 v2.AddArg(y) 9129 v1.AddArg(v2) 9130 v.AddArg2(v0, v1) 9131 return true 9132 } 9133 // match: (Lsh16x32 <t> x y) 9134 // cond: shiftIsBounded(v) 9135 // result: (SHLL <t> x y) 9136 for { 9137 t := v.Type 9138 x := v_0 9139 y := v_1 9140 if !(shiftIsBounded(v)) { 9141 break 9142 } 9143 v.reset(Op386SHLL) 9144 v.Type = t 9145 v.AddArg2(x, y) 9146 return true 9147 } 9148 return false 9149 } 9150 func rewriteValue386_OpLsh16x64(v *Value) bool { 9151 v_1 := v.Args[1] 9152 v_0 := v.Args[0] 9153 // match: (Lsh16x64 x (Const64 [c])) 9154 // cond: uint64(c) < 16 9155 // result: (SHLLconst x [int32(c)]) 9156 for { 9157 x := v_0 9158 if v_1.Op != OpConst64 { 9159 break 9160 } 9161 c := auxIntToInt64(v_1.AuxInt) 9162 if !(uint64(c) < 16) { 9163 break 9164 } 9165 v.reset(Op386SHLLconst) 9166 v.AuxInt = int32ToAuxInt(int32(c)) 9167 v.AddArg(x) 9168 return true 9169 } 9170 // match: (Lsh16x64 _ (Const64 [c])) 9171 // cond: uint64(c) >= 16 9172 // result: (Const16 [0]) 9173 for { 9174 if v_1.Op != OpConst64 { 9175 break 9176 } 9177 c := auxIntToInt64(v_1.AuxInt) 9178 if !(uint64(c) >= 16) { 9179 break 9180 } 9181 v.reset(OpConst16) 9182 v.AuxInt = int16ToAuxInt(0) 9183 return true 9184 } 9185 return false 9186 } 9187 func rewriteValue386_OpLsh16x8(v *Value) bool { 9188 v_1 := v.Args[1] 9189 v_0 := v.Args[0] 9190 b := v.Block 9191 // match: (Lsh16x8 <t> x y) 9192 // cond: !shiftIsBounded(v) 9193 // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32]))) 9194 for { 9195 t := v.Type 9196 x := v_0 9197 y := v_1 9198 if !(!shiftIsBounded(v)) { 9199 break 9200 } 9201 v.reset(Op386ANDL) 9202 v0 := b.NewValue0(v.Pos, Op386SHLL, t) 9203 v0.AddArg2(x, y) 9204 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 9205 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 9206 v2.AuxInt = int8ToAuxInt(32) 9207 v2.AddArg(y) 9208 v1.AddArg(v2) 9209 v.AddArg2(v0, v1) 9210 return true 9211 } 9212 // match: (Lsh16x8 <t> x y) 9213 // cond: shiftIsBounded(v) 9214 // result: (SHLL <t> x y) 9215 for { 9216 t := v.Type 9217 x := v_0 9218 y := v_1 9219 if !(shiftIsBounded(v)) { 9220 break 9221 } 9222 v.reset(Op386SHLL) 9223 v.Type = t 9224 v.AddArg2(x, y) 9225 return true 9226 } 9227 return false 9228 } 9229 func rewriteValue386_OpLsh32x16(v *Value) bool { 9230 v_1 := v.Args[1] 9231 v_0 := v.Args[0] 9232 b := v.Block 9233 // match: (Lsh32x16 <t> x y) 9234 // cond: !shiftIsBounded(v) 9235 // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32]))) 9236 for { 9237 t := v.Type 9238 x := v_0 9239 y := v_1 9240 if !(!shiftIsBounded(v)) { 9241 break 9242 } 9243 v.reset(Op386ANDL) 9244 v0 := b.NewValue0(v.Pos, Op386SHLL, t) 9245 v0.AddArg2(x, y) 9246 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 9247 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 9248 v2.AuxInt = int16ToAuxInt(32) 9249 v2.AddArg(y) 9250 v1.AddArg(v2) 9251 v.AddArg2(v0, v1) 9252 return true 9253 } 9254 // match: (Lsh32x16 <t> x y) 9255 // cond: shiftIsBounded(v) 9256 // result: (SHLL <t> x y) 9257 for { 9258 t := v.Type 9259 x := v_0 9260 y := v_1 9261 if !(shiftIsBounded(v)) { 9262 break 9263 } 9264 v.reset(Op386SHLL) 9265 v.Type = t 9266 v.AddArg2(x, y) 9267 return true 9268 } 9269 return false 9270 } 9271 func rewriteValue386_OpLsh32x32(v *Value) bool { 9272 v_1 := v.Args[1] 9273 v_0 := v.Args[0] 9274 b := v.Block 9275 // match: (Lsh32x32 <t> x y) 9276 // cond: !shiftIsBounded(v) 9277 // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32]))) 9278 for { 9279 t := v.Type 9280 x := v_0 9281 y := v_1 9282 if !(!shiftIsBounded(v)) { 9283 break 9284 } 9285 v.reset(Op386ANDL) 9286 v0 := b.NewValue0(v.Pos, Op386SHLL, t) 9287 v0.AddArg2(x, y) 9288 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 9289 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 9290 v2.AuxInt = int32ToAuxInt(32) 9291 v2.AddArg(y) 9292 v1.AddArg(v2) 9293 v.AddArg2(v0, v1) 9294 return true 9295 } 9296 // match: (Lsh32x32 <t> x y) 9297 // cond: shiftIsBounded(v) 9298 // result: (SHLL <t> x y) 9299 for { 9300 t := v.Type 9301 x := v_0 9302 y := v_1 9303 if !(shiftIsBounded(v)) { 9304 break 9305 } 9306 v.reset(Op386SHLL) 9307 v.Type = t 9308 v.AddArg2(x, y) 9309 return true 9310 } 9311 return false 9312 } 9313 func rewriteValue386_OpLsh32x64(v *Value) bool { 9314 v_1 := v.Args[1] 9315 v_0 := v.Args[0] 9316 // match: (Lsh32x64 x (Const64 [c])) 9317 // cond: uint64(c) < 32 9318 // result: (SHLLconst x [int32(c)]) 9319 for { 9320 x := v_0 9321 if v_1.Op != OpConst64 { 9322 break 9323 } 9324 c := auxIntToInt64(v_1.AuxInt) 9325 if !(uint64(c) < 32) { 9326 break 9327 } 9328 v.reset(Op386SHLLconst) 9329 v.AuxInt = int32ToAuxInt(int32(c)) 9330 v.AddArg(x) 9331 return true 9332 } 9333 // match: (Lsh32x64 _ (Const64 [c])) 9334 // cond: uint64(c) >= 32 9335 // result: (Const32 [0]) 9336 for { 9337 if v_1.Op != OpConst64 { 9338 break 9339 } 9340 c := auxIntToInt64(v_1.AuxInt) 9341 if !(uint64(c) >= 32) { 9342 break 9343 } 9344 v.reset(OpConst32) 9345 v.AuxInt = int32ToAuxInt(0) 9346 return true 9347 } 9348 return false 9349 } 9350 func rewriteValue386_OpLsh32x8(v *Value) bool { 9351 v_1 := v.Args[1] 9352 v_0 := v.Args[0] 9353 b := v.Block 9354 // match: (Lsh32x8 <t> x y) 9355 // cond: !shiftIsBounded(v) 9356 // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32]))) 9357 for { 9358 t := v.Type 9359 x := v_0 9360 y := v_1 9361 if !(!shiftIsBounded(v)) { 9362 break 9363 } 9364 v.reset(Op386ANDL) 9365 v0 := b.NewValue0(v.Pos, Op386SHLL, t) 9366 v0.AddArg2(x, y) 9367 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 9368 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 9369 v2.AuxInt = int8ToAuxInt(32) 9370 v2.AddArg(y) 9371 v1.AddArg(v2) 9372 v.AddArg2(v0, v1) 9373 return true 9374 } 9375 // match: (Lsh32x8 <t> x y) 9376 // cond: shiftIsBounded(v) 9377 // result: (SHLL <t> x y) 9378 for { 9379 t := v.Type 9380 x := v_0 9381 y := v_1 9382 if !(shiftIsBounded(v)) { 9383 break 9384 } 9385 v.reset(Op386SHLL) 9386 v.Type = t 9387 v.AddArg2(x, y) 9388 return true 9389 } 9390 return false 9391 } 9392 func rewriteValue386_OpLsh8x16(v *Value) bool { 9393 v_1 := v.Args[1] 9394 v_0 := v.Args[0] 9395 b := v.Block 9396 // match: (Lsh8x16 <t> x y) 9397 // cond: !shiftIsBounded(v) 9398 // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32]))) 9399 for { 9400 t := v.Type 9401 x := v_0 9402 y := v_1 9403 if !(!shiftIsBounded(v)) { 9404 break 9405 } 9406 v.reset(Op386ANDL) 9407 v0 := b.NewValue0(v.Pos, Op386SHLL, t) 9408 v0.AddArg2(x, y) 9409 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 9410 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 9411 v2.AuxInt = int16ToAuxInt(32) 9412 v2.AddArg(y) 9413 v1.AddArg(v2) 9414 v.AddArg2(v0, v1) 9415 return true 9416 } 9417 // match: (Lsh8x16 <t> x y) 9418 // cond: shiftIsBounded(v) 9419 // result: (SHLL <t> x y) 9420 for { 9421 t := v.Type 9422 x := v_0 9423 y := v_1 9424 if !(shiftIsBounded(v)) { 9425 break 9426 } 9427 v.reset(Op386SHLL) 9428 v.Type = t 9429 v.AddArg2(x, y) 9430 return true 9431 } 9432 return false 9433 } 9434 func rewriteValue386_OpLsh8x32(v *Value) bool { 9435 v_1 := v.Args[1] 9436 v_0 := v.Args[0] 9437 b := v.Block 9438 // match: (Lsh8x32 <t> x y) 9439 // cond: !shiftIsBounded(v) 9440 // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32]))) 9441 for { 9442 t := v.Type 9443 x := v_0 9444 y := v_1 9445 if !(!shiftIsBounded(v)) { 9446 break 9447 } 9448 v.reset(Op386ANDL) 9449 v0 := b.NewValue0(v.Pos, Op386SHLL, t) 9450 v0.AddArg2(x, y) 9451 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 9452 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 9453 v2.AuxInt = int32ToAuxInt(32) 9454 v2.AddArg(y) 9455 v1.AddArg(v2) 9456 v.AddArg2(v0, v1) 9457 return true 9458 } 9459 // match: (Lsh8x32 <t> x y) 9460 // cond: shiftIsBounded(v) 9461 // result: (SHLL <t> x y) 9462 for { 9463 t := v.Type 9464 x := v_0 9465 y := v_1 9466 if !(shiftIsBounded(v)) { 9467 break 9468 } 9469 v.reset(Op386SHLL) 9470 v.Type = t 9471 v.AddArg2(x, y) 9472 return true 9473 } 9474 return false 9475 } 9476 func rewriteValue386_OpLsh8x64(v *Value) bool { 9477 v_1 := v.Args[1] 9478 v_0 := v.Args[0] 9479 // match: (Lsh8x64 x (Const64 [c])) 9480 // cond: uint64(c) < 8 9481 // result: (SHLLconst x [int32(c)]) 9482 for { 9483 x := v_0 9484 if v_1.Op != OpConst64 { 9485 break 9486 } 9487 c := auxIntToInt64(v_1.AuxInt) 9488 if !(uint64(c) < 8) { 9489 break 9490 } 9491 v.reset(Op386SHLLconst) 9492 v.AuxInt = int32ToAuxInt(int32(c)) 9493 v.AddArg(x) 9494 return true 9495 } 9496 // match: (Lsh8x64 _ (Const64 [c])) 9497 // cond: uint64(c) >= 8 9498 // result: (Const8 [0]) 9499 for { 9500 if v_1.Op != OpConst64 { 9501 break 9502 } 9503 c := auxIntToInt64(v_1.AuxInt) 9504 if !(uint64(c) >= 8) { 9505 break 9506 } 9507 v.reset(OpConst8) 9508 v.AuxInt = int8ToAuxInt(0) 9509 return true 9510 } 9511 return false 9512 } 9513 func rewriteValue386_OpLsh8x8(v *Value) bool { 9514 v_1 := v.Args[1] 9515 v_0 := v.Args[0] 9516 b := v.Block 9517 // match: (Lsh8x8 <t> x y) 9518 // cond: !shiftIsBounded(v) 9519 // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32]))) 9520 for { 9521 t := v.Type 9522 x := v_0 9523 y := v_1 9524 if !(!shiftIsBounded(v)) { 9525 break 9526 } 9527 v.reset(Op386ANDL) 9528 v0 := b.NewValue0(v.Pos, Op386SHLL, t) 9529 v0.AddArg2(x, y) 9530 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 9531 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 9532 v2.AuxInt = int8ToAuxInt(32) 9533 v2.AddArg(y) 9534 v1.AddArg(v2) 9535 v.AddArg2(v0, v1) 9536 return true 9537 } 9538 // match: (Lsh8x8 <t> x y) 9539 // cond: shiftIsBounded(v) 9540 // result: (SHLL <t> x y) 9541 for { 9542 t := v.Type 9543 x := v_0 9544 y := v_1 9545 if !(shiftIsBounded(v)) { 9546 break 9547 } 9548 v.reset(Op386SHLL) 9549 v.Type = t 9550 v.AddArg2(x, y) 9551 return true 9552 } 9553 return false 9554 } 9555 func rewriteValue386_OpMod8(v *Value) bool { 9556 v_1 := v.Args[1] 9557 v_0 := v.Args[0] 9558 b := v.Block 9559 typ := &b.Func.Config.Types 9560 // match: (Mod8 x y) 9561 // result: (MODW (SignExt8to16 x) (SignExt8to16 y)) 9562 for { 9563 x := v_0 9564 y := v_1 9565 v.reset(Op386MODW) 9566 v0 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16) 9567 v0.AddArg(x) 9568 v1 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16) 9569 v1.AddArg(y) 9570 v.AddArg2(v0, v1) 9571 return true 9572 } 9573 } 9574 func rewriteValue386_OpMod8u(v *Value) bool { 9575 v_1 := v.Args[1] 9576 v_0 := v.Args[0] 9577 b := v.Block 9578 typ := &b.Func.Config.Types 9579 // match: (Mod8u x y) 9580 // result: (MODWU (ZeroExt8to16 x) (ZeroExt8to16 y)) 9581 for { 9582 x := v_0 9583 y := v_1 9584 v.reset(Op386MODWU) 9585 v0 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16) 9586 v0.AddArg(x) 9587 v1 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16) 9588 v1.AddArg(y) 9589 v.AddArg2(v0, v1) 9590 return true 9591 } 9592 } 9593 func rewriteValue386_OpMove(v *Value) bool { 9594 v_2 := v.Args[2] 9595 v_1 := v.Args[1] 9596 v_0 := v.Args[0] 9597 b := v.Block 9598 config := b.Func.Config 9599 typ := &b.Func.Config.Types 9600 // match: (Move [0] _ _ mem) 9601 // result: mem 9602 for { 9603 if auxIntToInt64(v.AuxInt) != 0 { 9604 break 9605 } 9606 mem := v_2 9607 v.copyOf(mem) 9608 return true 9609 } 9610 // match: (Move [1] dst src mem) 9611 // result: (MOVBstore dst (MOVBload src mem) mem) 9612 for { 9613 if auxIntToInt64(v.AuxInt) != 1 { 9614 break 9615 } 9616 dst := v_0 9617 src := v_1 9618 mem := v_2 9619 v.reset(Op386MOVBstore) 9620 v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8) 9621 v0.AddArg2(src, mem) 9622 v.AddArg3(dst, v0, mem) 9623 return true 9624 } 9625 // match: (Move [2] dst src mem) 9626 // result: (MOVWstore dst (MOVWload src mem) mem) 9627 for { 9628 if auxIntToInt64(v.AuxInt) != 2 { 9629 break 9630 } 9631 dst := v_0 9632 src := v_1 9633 mem := v_2 9634 v.reset(Op386MOVWstore) 9635 v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16) 9636 v0.AddArg2(src, mem) 9637 v.AddArg3(dst, v0, mem) 9638 return true 9639 } 9640 // match: (Move [4] dst src mem) 9641 // result: (MOVLstore dst (MOVLload src mem) mem) 9642 for { 9643 if auxIntToInt64(v.AuxInt) != 4 { 9644 break 9645 } 9646 dst := v_0 9647 src := v_1 9648 mem := v_2 9649 v.reset(Op386MOVLstore) 9650 v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) 9651 v0.AddArg2(src, mem) 9652 v.AddArg3(dst, v0, mem) 9653 return true 9654 } 9655 // match: (Move [3] dst src mem) 9656 // result: (MOVBstore [2] dst (MOVBload [2] src mem) (MOVWstore dst (MOVWload src mem) mem)) 9657 for { 9658 if auxIntToInt64(v.AuxInt) != 3 { 9659 break 9660 } 9661 dst := v_0 9662 src := v_1 9663 mem := v_2 9664 v.reset(Op386MOVBstore) 9665 v.AuxInt = int32ToAuxInt(2) 9666 v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8) 9667 v0.AuxInt = int32ToAuxInt(2) 9668 v0.AddArg2(src, mem) 9669 v1 := b.NewValue0(v.Pos, Op386MOVWstore, types.TypeMem) 9670 v2 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16) 9671 v2.AddArg2(src, mem) 9672 v1.AddArg3(dst, v2, mem) 9673 v.AddArg3(dst, v0, v1) 9674 return true 9675 } 9676 // match: (Move [5] dst src mem) 9677 // result: (MOVBstore [4] dst (MOVBload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) 9678 for { 9679 if auxIntToInt64(v.AuxInt) != 5 { 9680 break 9681 } 9682 dst := v_0 9683 src := v_1 9684 mem := v_2 9685 v.reset(Op386MOVBstore) 9686 v.AuxInt = int32ToAuxInt(4) 9687 v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8) 9688 v0.AuxInt = int32ToAuxInt(4) 9689 v0.AddArg2(src, mem) 9690 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) 9691 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) 9692 v2.AddArg2(src, mem) 9693 v1.AddArg3(dst, v2, mem) 9694 v.AddArg3(dst, v0, v1) 9695 return true 9696 } 9697 // match: (Move [6] dst src mem) 9698 // result: (MOVWstore [4] dst (MOVWload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) 9699 for { 9700 if auxIntToInt64(v.AuxInt) != 6 { 9701 break 9702 } 9703 dst := v_0 9704 src := v_1 9705 mem := v_2 9706 v.reset(Op386MOVWstore) 9707 v.AuxInt = int32ToAuxInt(4) 9708 v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16) 9709 v0.AuxInt = int32ToAuxInt(4) 9710 v0.AddArg2(src, mem) 9711 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) 9712 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) 9713 v2.AddArg2(src, mem) 9714 v1.AddArg3(dst, v2, mem) 9715 v.AddArg3(dst, v0, v1) 9716 return true 9717 } 9718 // match: (Move [7] dst src mem) 9719 // result: (MOVLstore [3] dst (MOVLload [3] src mem) (MOVLstore dst (MOVLload src mem) mem)) 9720 for { 9721 if auxIntToInt64(v.AuxInt) != 7 { 9722 break 9723 } 9724 dst := v_0 9725 src := v_1 9726 mem := v_2 9727 v.reset(Op386MOVLstore) 9728 v.AuxInt = int32ToAuxInt(3) 9729 v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) 9730 v0.AuxInt = int32ToAuxInt(3) 9731 v0.AddArg2(src, mem) 9732 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) 9733 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) 9734 v2.AddArg2(src, mem) 9735 v1.AddArg3(dst, v2, mem) 9736 v.AddArg3(dst, v0, v1) 9737 return true 9738 } 9739 // match: (Move [8] dst src mem) 9740 // result: (MOVLstore [4] dst (MOVLload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) 9741 for { 9742 if auxIntToInt64(v.AuxInt) != 8 { 9743 break 9744 } 9745 dst := v_0 9746 src := v_1 9747 mem := v_2 9748 v.reset(Op386MOVLstore) 9749 v.AuxInt = int32ToAuxInt(4) 9750 v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) 9751 v0.AuxInt = int32ToAuxInt(4) 9752 v0.AddArg2(src, mem) 9753 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) 9754 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) 9755 v2.AddArg2(src, mem) 9756 v1.AddArg3(dst, v2, mem) 9757 v.AddArg3(dst, v0, v1) 9758 return true 9759 } 9760 // match: (Move [s] dst src mem) 9761 // cond: s > 8 && s%4 != 0 9762 // result: (Move [s-s%4] (ADDLconst <dst.Type> dst [int32(s%4)]) (ADDLconst <src.Type> src [int32(s%4)]) (MOVLstore dst (MOVLload src mem) mem)) 9763 for { 9764 s := auxIntToInt64(v.AuxInt) 9765 dst := v_0 9766 src := v_1 9767 mem := v_2 9768 if !(s > 8 && s%4 != 0) { 9769 break 9770 } 9771 v.reset(OpMove) 9772 v.AuxInt = int64ToAuxInt(s - s%4) 9773 v0 := b.NewValue0(v.Pos, Op386ADDLconst, dst.Type) 9774 v0.AuxInt = int32ToAuxInt(int32(s % 4)) 9775 v0.AddArg(dst) 9776 v1 := b.NewValue0(v.Pos, Op386ADDLconst, src.Type) 9777 v1.AuxInt = int32ToAuxInt(int32(s % 4)) 9778 v1.AddArg(src) 9779 v2 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) 9780 v3 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) 9781 v3.AddArg2(src, mem) 9782 v2.AddArg3(dst, v3, mem) 9783 v.AddArg3(v0, v1, v2) 9784 return true 9785 } 9786 // match: (Move [s] dst src mem) 9787 // cond: s > 8 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice && logLargeCopy(v, s) 9788 // result: (DUFFCOPY [10*(128-s/4)] dst src mem) 9789 for { 9790 s := auxIntToInt64(v.AuxInt) 9791 dst := v_0 9792 src := v_1 9793 mem := v_2 9794 if !(s > 8 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice && logLargeCopy(v, s)) { 9795 break 9796 } 9797 v.reset(Op386DUFFCOPY) 9798 v.AuxInt = int64ToAuxInt(10 * (128 - s/4)) 9799 v.AddArg3(dst, src, mem) 9800 return true 9801 } 9802 // match: (Move [s] dst src mem) 9803 // cond: (s > 4*128 || config.noDuffDevice) && s%4 == 0 && logLargeCopy(v, s) 9804 // result: (REPMOVSL dst src (MOVLconst [int32(s/4)]) mem) 9805 for { 9806 s := auxIntToInt64(v.AuxInt) 9807 dst := v_0 9808 src := v_1 9809 mem := v_2 9810 if !((s > 4*128 || config.noDuffDevice) && s%4 == 0 && logLargeCopy(v, s)) { 9811 break 9812 } 9813 v.reset(Op386REPMOVSL) 9814 v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32) 9815 v0.AuxInt = int32ToAuxInt(int32(s / 4)) 9816 v.AddArg4(dst, src, v0, mem) 9817 return true 9818 } 9819 return false 9820 } 9821 func rewriteValue386_OpNeg32F(v *Value) bool { 9822 v_0 := v.Args[0] 9823 b := v.Block 9824 typ := &b.Func.Config.Types 9825 // match: (Neg32F x) 9826 // result: (PXOR x (MOVSSconst <typ.Float32> [float32(math.Copysign(0, -1))])) 9827 for { 9828 x := v_0 9829 v.reset(Op386PXOR) 9830 v0 := b.NewValue0(v.Pos, Op386MOVSSconst, typ.Float32) 9831 v0.AuxInt = float32ToAuxInt(float32(math.Copysign(0, -1))) 9832 v.AddArg2(x, v0) 9833 return true 9834 } 9835 } 9836 func rewriteValue386_OpNeg64F(v *Value) bool { 9837 v_0 := v.Args[0] 9838 b := v.Block 9839 typ := &b.Func.Config.Types 9840 // match: (Neg64F x) 9841 // result: (PXOR x (MOVSDconst <typ.Float64> [math.Copysign(0, -1)])) 9842 for { 9843 x := v_0 9844 v.reset(Op386PXOR) 9845 v0 := b.NewValue0(v.Pos, Op386MOVSDconst, typ.Float64) 9846 v0.AuxInt = float64ToAuxInt(math.Copysign(0, -1)) 9847 v.AddArg2(x, v0) 9848 return true 9849 } 9850 } 9851 func rewriteValue386_OpNeq16(v *Value) bool { 9852 v_1 := v.Args[1] 9853 v_0 := v.Args[0] 9854 b := v.Block 9855 // match: (Neq16 x y) 9856 // result: (SETNE (CMPW x y)) 9857 for { 9858 x := v_0 9859 y := v_1 9860 v.reset(Op386SETNE) 9861 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags) 9862 v0.AddArg2(x, y) 9863 v.AddArg(v0) 9864 return true 9865 } 9866 } 9867 func rewriteValue386_OpNeq32(v *Value) bool { 9868 v_1 := v.Args[1] 9869 v_0 := v.Args[0] 9870 b := v.Block 9871 // match: (Neq32 x y) 9872 // result: (SETNE (CMPL x y)) 9873 for { 9874 x := v_0 9875 y := v_1 9876 v.reset(Op386SETNE) 9877 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 9878 v0.AddArg2(x, y) 9879 v.AddArg(v0) 9880 return true 9881 } 9882 } 9883 func rewriteValue386_OpNeq32F(v *Value) bool { 9884 v_1 := v.Args[1] 9885 v_0 := v.Args[0] 9886 b := v.Block 9887 // match: (Neq32F x y) 9888 // result: (SETNEF (UCOMISS x y)) 9889 for { 9890 x := v_0 9891 y := v_1 9892 v.reset(Op386SETNEF) 9893 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags) 9894 v0.AddArg2(x, y) 9895 v.AddArg(v0) 9896 return true 9897 } 9898 } 9899 func rewriteValue386_OpNeq64F(v *Value) bool { 9900 v_1 := v.Args[1] 9901 v_0 := v.Args[0] 9902 b := v.Block 9903 // match: (Neq64F x y) 9904 // result: (SETNEF (UCOMISD x y)) 9905 for { 9906 x := v_0 9907 y := v_1 9908 v.reset(Op386SETNEF) 9909 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags) 9910 v0.AddArg2(x, y) 9911 v.AddArg(v0) 9912 return true 9913 } 9914 } 9915 func rewriteValue386_OpNeq8(v *Value) bool { 9916 v_1 := v.Args[1] 9917 v_0 := v.Args[0] 9918 b := v.Block 9919 // match: (Neq8 x y) 9920 // result: (SETNE (CMPB x y)) 9921 for { 9922 x := v_0 9923 y := v_1 9924 v.reset(Op386SETNE) 9925 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags) 9926 v0.AddArg2(x, y) 9927 v.AddArg(v0) 9928 return true 9929 } 9930 } 9931 func rewriteValue386_OpNeqB(v *Value) bool { 9932 v_1 := v.Args[1] 9933 v_0 := v.Args[0] 9934 b := v.Block 9935 // match: (NeqB x y) 9936 // result: (SETNE (CMPB x y)) 9937 for { 9938 x := v_0 9939 y := v_1 9940 v.reset(Op386SETNE) 9941 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags) 9942 v0.AddArg2(x, y) 9943 v.AddArg(v0) 9944 return true 9945 } 9946 } 9947 func rewriteValue386_OpNeqPtr(v *Value) bool { 9948 v_1 := v.Args[1] 9949 v_0 := v.Args[0] 9950 b := v.Block 9951 // match: (NeqPtr x y) 9952 // result: (SETNE (CMPL x y)) 9953 for { 9954 x := v_0 9955 y := v_1 9956 v.reset(Op386SETNE) 9957 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags) 9958 v0.AddArg2(x, y) 9959 v.AddArg(v0) 9960 return true 9961 } 9962 } 9963 func rewriteValue386_OpNot(v *Value) bool { 9964 v_0 := v.Args[0] 9965 // match: (Not x) 9966 // result: (XORLconst [1] x) 9967 for { 9968 x := v_0 9969 v.reset(Op386XORLconst) 9970 v.AuxInt = int32ToAuxInt(1) 9971 v.AddArg(x) 9972 return true 9973 } 9974 } 9975 func rewriteValue386_OpOffPtr(v *Value) bool { 9976 v_0 := v.Args[0] 9977 // match: (OffPtr [off] ptr) 9978 // result: (ADDLconst [int32(off)] ptr) 9979 for { 9980 off := auxIntToInt64(v.AuxInt) 9981 ptr := v_0 9982 v.reset(Op386ADDLconst) 9983 v.AuxInt = int32ToAuxInt(int32(off)) 9984 v.AddArg(ptr) 9985 return true 9986 } 9987 } 9988 func rewriteValue386_OpPanicBounds(v *Value) bool { 9989 v_2 := v.Args[2] 9990 v_1 := v.Args[1] 9991 v_0 := v.Args[0] 9992 // match: (PanicBounds [kind] x y mem) 9993 // cond: boundsABI(kind) == 0 9994 // result: (LoweredPanicBoundsA [kind] x y mem) 9995 for { 9996 kind := auxIntToInt64(v.AuxInt) 9997 x := v_0 9998 y := v_1 9999 mem := v_2 10000 if !(boundsABI(kind) == 0) { 10001 break 10002 } 10003 v.reset(Op386LoweredPanicBoundsA) 10004 v.AuxInt = int64ToAuxInt(kind) 10005 v.AddArg3(x, y, mem) 10006 return true 10007 } 10008 // match: (PanicBounds [kind] x y mem) 10009 // cond: boundsABI(kind) == 1 10010 // result: (LoweredPanicBoundsB [kind] x y mem) 10011 for { 10012 kind := auxIntToInt64(v.AuxInt) 10013 x := v_0 10014 y := v_1 10015 mem := v_2 10016 if !(boundsABI(kind) == 1) { 10017 break 10018 } 10019 v.reset(Op386LoweredPanicBoundsB) 10020 v.AuxInt = int64ToAuxInt(kind) 10021 v.AddArg3(x, y, mem) 10022 return true 10023 } 10024 // match: (PanicBounds [kind] x y mem) 10025 // cond: boundsABI(kind) == 2 10026 // result: (LoweredPanicBoundsC [kind] x y mem) 10027 for { 10028 kind := auxIntToInt64(v.AuxInt) 10029 x := v_0 10030 y := v_1 10031 mem := v_2 10032 if !(boundsABI(kind) == 2) { 10033 break 10034 } 10035 v.reset(Op386LoweredPanicBoundsC) 10036 v.AuxInt = int64ToAuxInt(kind) 10037 v.AddArg3(x, y, mem) 10038 return true 10039 } 10040 return false 10041 } 10042 func rewriteValue386_OpPanicExtend(v *Value) bool { 10043 v_3 := v.Args[3] 10044 v_2 := v.Args[2] 10045 v_1 := v.Args[1] 10046 v_0 := v.Args[0] 10047 // match: (PanicExtend [kind] hi lo y mem) 10048 // cond: boundsABI(kind) == 0 10049 // result: (LoweredPanicExtendA [kind] hi lo y mem) 10050 for { 10051 kind := auxIntToInt64(v.AuxInt) 10052 hi := v_0 10053 lo := v_1 10054 y := v_2 10055 mem := v_3 10056 if !(boundsABI(kind) == 0) { 10057 break 10058 } 10059 v.reset(Op386LoweredPanicExtendA) 10060 v.AuxInt = int64ToAuxInt(kind) 10061 v.AddArg4(hi, lo, y, mem) 10062 return true 10063 } 10064 // match: (PanicExtend [kind] hi lo y mem) 10065 // cond: boundsABI(kind) == 1 10066 // result: (LoweredPanicExtendB [kind] hi lo y mem) 10067 for { 10068 kind := auxIntToInt64(v.AuxInt) 10069 hi := v_0 10070 lo := v_1 10071 y := v_2 10072 mem := v_3 10073 if !(boundsABI(kind) == 1) { 10074 break 10075 } 10076 v.reset(Op386LoweredPanicExtendB) 10077 v.AuxInt = int64ToAuxInt(kind) 10078 v.AddArg4(hi, lo, y, mem) 10079 return true 10080 } 10081 // match: (PanicExtend [kind] hi lo y mem) 10082 // cond: boundsABI(kind) == 2 10083 // result: (LoweredPanicExtendC [kind] hi lo y mem) 10084 for { 10085 kind := auxIntToInt64(v.AuxInt) 10086 hi := v_0 10087 lo := v_1 10088 y := v_2 10089 mem := v_3 10090 if !(boundsABI(kind) == 2) { 10091 break 10092 } 10093 v.reset(Op386LoweredPanicExtendC) 10094 v.AuxInt = int64ToAuxInt(kind) 10095 v.AddArg4(hi, lo, y, mem) 10096 return true 10097 } 10098 return false 10099 } 10100 func rewriteValue386_OpRsh16Ux16(v *Value) bool { 10101 v_1 := v.Args[1] 10102 v_0 := v.Args[0] 10103 b := v.Block 10104 // match: (Rsh16Ux16 <t> x y) 10105 // cond: !shiftIsBounded(v) 10106 // result: (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPWconst y [16]))) 10107 for { 10108 t := v.Type 10109 x := v_0 10110 y := v_1 10111 if !(!shiftIsBounded(v)) { 10112 break 10113 } 10114 v.reset(Op386ANDL) 10115 v0 := b.NewValue0(v.Pos, Op386SHRW, t) 10116 v0.AddArg2(x, y) 10117 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 10118 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 10119 v2.AuxInt = int16ToAuxInt(16) 10120 v2.AddArg(y) 10121 v1.AddArg(v2) 10122 v.AddArg2(v0, v1) 10123 return true 10124 } 10125 // match: (Rsh16Ux16 <t> x y) 10126 // cond: shiftIsBounded(v) 10127 // result: (SHRW <t> x y) 10128 for { 10129 t := v.Type 10130 x := v_0 10131 y := v_1 10132 if !(shiftIsBounded(v)) { 10133 break 10134 } 10135 v.reset(Op386SHRW) 10136 v.Type = t 10137 v.AddArg2(x, y) 10138 return true 10139 } 10140 return false 10141 } 10142 func rewriteValue386_OpRsh16Ux32(v *Value) bool { 10143 v_1 := v.Args[1] 10144 v_0 := v.Args[0] 10145 b := v.Block 10146 // match: (Rsh16Ux32 <t> x y) 10147 // cond: !shiftIsBounded(v) 10148 // result: (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPLconst y [16]))) 10149 for { 10150 t := v.Type 10151 x := v_0 10152 y := v_1 10153 if !(!shiftIsBounded(v)) { 10154 break 10155 } 10156 v.reset(Op386ANDL) 10157 v0 := b.NewValue0(v.Pos, Op386SHRW, t) 10158 v0.AddArg2(x, y) 10159 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 10160 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 10161 v2.AuxInt = int32ToAuxInt(16) 10162 v2.AddArg(y) 10163 v1.AddArg(v2) 10164 v.AddArg2(v0, v1) 10165 return true 10166 } 10167 // match: (Rsh16Ux32 <t> x y) 10168 // cond: shiftIsBounded(v) 10169 // result: (SHRW <t> x y) 10170 for { 10171 t := v.Type 10172 x := v_0 10173 y := v_1 10174 if !(shiftIsBounded(v)) { 10175 break 10176 } 10177 v.reset(Op386SHRW) 10178 v.Type = t 10179 v.AddArg2(x, y) 10180 return true 10181 } 10182 return false 10183 } 10184 func rewriteValue386_OpRsh16Ux64(v *Value) bool { 10185 v_1 := v.Args[1] 10186 v_0 := v.Args[0] 10187 // match: (Rsh16Ux64 x (Const64 [c])) 10188 // cond: uint64(c) < 16 10189 // result: (SHRWconst x [int16(c)]) 10190 for { 10191 x := v_0 10192 if v_1.Op != OpConst64 { 10193 break 10194 } 10195 c := auxIntToInt64(v_1.AuxInt) 10196 if !(uint64(c) < 16) { 10197 break 10198 } 10199 v.reset(Op386SHRWconst) 10200 v.AuxInt = int16ToAuxInt(int16(c)) 10201 v.AddArg(x) 10202 return true 10203 } 10204 // match: (Rsh16Ux64 _ (Const64 [c])) 10205 // cond: uint64(c) >= 16 10206 // result: (Const16 [0]) 10207 for { 10208 if v_1.Op != OpConst64 { 10209 break 10210 } 10211 c := auxIntToInt64(v_1.AuxInt) 10212 if !(uint64(c) >= 16) { 10213 break 10214 } 10215 v.reset(OpConst16) 10216 v.AuxInt = int16ToAuxInt(0) 10217 return true 10218 } 10219 return false 10220 } 10221 func rewriteValue386_OpRsh16Ux8(v *Value) bool { 10222 v_1 := v.Args[1] 10223 v_0 := v.Args[0] 10224 b := v.Block 10225 // match: (Rsh16Ux8 <t> x y) 10226 // cond: !shiftIsBounded(v) 10227 // result: (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPBconst y [16]))) 10228 for { 10229 t := v.Type 10230 x := v_0 10231 y := v_1 10232 if !(!shiftIsBounded(v)) { 10233 break 10234 } 10235 v.reset(Op386ANDL) 10236 v0 := b.NewValue0(v.Pos, Op386SHRW, t) 10237 v0.AddArg2(x, y) 10238 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 10239 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 10240 v2.AuxInt = int8ToAuxInt(16) 10241 v2.AddArg(y) 10242 v1.AddArg(v2) 10243 v.AddArg2(v0, v1) 10244 return true 10245 } 10246 // match: (Rsh16Ux8 <t> x y) 10247 // cond: shiftIsBounded(v) 10248 // result: (SHRW <t> x y) 10249 for { 10250 t := v.Type 10251 x := v_0 10252 y := v_1 10253 if !(shiftIsBounded(v)) { 10254 break 10255 } 10256 v.reset(Op386SHRW) 10257 v.Type = t 10258 v.AddArg2(x, y) 10259 return true 10260 } 10261 return false 10262 } 10263 func rewriteValue386_OpRsh16x16(v *Value) bool { 10264 v_1 := v.Args[1] 10265 v_0 := v.Args[0] 10266 b := v.Block 10267 // match: (Rsh16x16 <t> x y) 10268 // cond: !shiftIsBounded(v) 10269 // result: (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [16]))))) 10270 for { 10271 t := v.Type 10272 x := v_0 10273 y := v_1 10274 if !(!shiftIsBounded(v)) { 10275 break 10276 } 10277 v.reset(Op386SARW) 10278 v.Type = t 10279 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type) 10280 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) 10281 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) 10282 v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 10283 v3.AuxInt = int16ToAuxInt(16) 10284 v3.AddArg(y) 10285 v2.AddArg(v3) 10286 v1.AddArg(v2) 10287 v0.AddArg2(y, v1) 10288 v.AddArg2(x, v0) 10289 return true 10290 } 10291 // match: (Rsh16x16 <t> x y) 10292 // cond: shiftIsBounded(v) 10293 // result: (SARW x y) 10294 for { 10295 x := v_0 10296 y := v_1 10297 if !(shiftIsBounded(v)) { 10298 break 10299 } 10300 v.reset(Op386SARW) 10301 v.AddArg2(x, y) 10302 return true 10303 } 10304 return false 10305 } 10306 func rewriteValue386_OpRsh16x32(v *Value) bool { 10307 v_1 := v.Args[1] 10308 v_0 := v.Args[0] 10309 b := v.Block 10310 // match: (Rsh16x32 <t> x y) 10311 // cond: !shiftIsBounded(v) 10312 // result: (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [16]))))) 10313 for { 10314 t := v.Type 10315 x := v_0 10316 y := v_1 10317 if !(!shiftIsBounded(v)) { 10318 break 10319 } 10320 v.reset(Op386SARW) 10321 v.Type = t 10322 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type) 10323 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) 10324 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) 10325 v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 10326 v3.AuxInt = int32ToAuxInt(16) 10327 v3.AddArg(y) 10328 v2.AddArg(v3) 10329 v1.AddArg(v2) 10330 v0.AddArg2(y, v1) 10331 v.AddArg2(x, v0) 10332 return true 10333 } 10334 // match: (Rsh16x32 <t> x y) 10335 // cond: shiftIsBounded(v) 10336 // result: (SARW x y) 10337 for { 10338 x := v_0 10339 y := v_1 10340 if !(shiftIsBounded(v)) { 10341 break 10342 } 10343 v.reset(Op386SARW) 10344 v.AddArg2(x, y) 10345 return true 10346 } 10347 return false 10348 } 10349 func rewriteValue386_OpRsh16x64(v *Value) bool { 10350 v_1 := v.Args[1] 10351 v_0 := v.Args[0] 10352 // match: (Rsh16x64 x (Const64 [c])) 10353 // cond: uint64(c) < 16 10354 // result: (SARWconst x [int16(c)]) 10355 for { 10356 x := v_0 10357 if v_1.Op != OpConst64 { 10358 break 10359 } 10360 c := auxIntToInt64(v_1.AuxInt) 10361 if !(uint64(c) < 16) { 10362 break 10363 } 10364 v.reset(Op386SARWconst) 10365 v.AuxInt = int16ToAuxInt(int16(c)) 10366 v.AddArg(x) 10367 return true 10368 } 10369 // match: (Rsh16x64 x (Const64 [c])) 10370 // cond: uint64(c) >= 16 10371 // result: (SARWconst x [15]) 10372 for { 10373 x := v_0 10374 if v_1.Op != OpConst64 { 10375 break 10376 } 10377 c := auxIntToInt64(v_1.AuxInt) 10378 if !(uint64(c) >= 16) { 10379 break 10380 } 10381 v.reset(Op386SARWconst) 10382 v.AuxInt = int16ToAuxInt(15) 10383 v.AddArg(x) 10384 return true 10385 } 10386 return false 10387 } 10388 func rewriteValue386_OpRsh16x8(v *Value) bool { 10389 v_1 := v.Args[1] 10390 v_0 := v.Args[0] 10391 b := v.Block 10392 // match: (Rsh16x8 <t> x y) 10393 // cond: !shiftIsBounded(v) 10394 // result: (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [16]))))) 10395 for { 10396 t := v.Type 10397 x := v_0 10398 y := v_1 10399 if !(!shiftIsBounded(v)) { 10400 break 10401 } 10402 v.reset(Op386SARW) 10403 v.Type = t 10404 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type) 10405 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) 10406 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) 10407 v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 10408 v3.AuxInt = int8ToAuxInt(16) 10409 v3.AddArg(y) 10410 v2.AddArg(v3) 10411 v1.AddArg(v2) 10412 v0.AddArg2(y, v1) 10413 v.AddArg2(x, v0) 10414 return true 10415 } 10416 // match: (Rsh16x8 <t> x y) 10417 // cond: shiftIsBounded(v) 10418 // result: (SARW x y) 10419 for { 10420 x := v_0 10421 y := v_1 10422 if !(shiftIsBounded(v)) { 10423 break 10424 } 10425 v.reset(Op386SARW) 10426 v.AddArg2(x, y) 10427 return true 10428 } 10429 return false 10430 } 10431 func rewriteValue386_OpRsh32Ux16(v *Value) bool { 10432 v_1 := v.Args[1] 10433 v_0 := v.Args[0] 10434 b := v.Block 10435 // match: (Rsh32Ux16 <t> x y) 10436 // cond: !shiftIsBounded(v) 10437 // result: (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32]))) 10438 for { 10439 t := v.Type 10440 x := v_0 10441 y := v_1 10442 if !(!shiftIsBounded(v)) { 10443 break 10444 } 10445 v.reset(Op386ANDL) 10446 v0 := b.NewValue0(v.Pos, Op386SHRL, t) 10447 v0.AddArg2(x, y) 10448 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 10449 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 10450 v2.AuxInt = int16ToAuxInt(32) 10451 v2.AddArg(y) 10452 v1.AddArg(v2) 10453 v.AddArg2(v0, v1) 10454 return true 10455 } 10456 // match: (Rsh32Ux16 <t> x y) 10457 // cond: shiftIsBounded(v) 10458 // result: (SHRL <t> x y) 10459 for { 10460 t := v.Type 10461 x := v_0 10462 y := v_1 10463 if !(shiftIsBounded(v)) { 10464 break 10465 } 10466 v.reset(Op386SHRL) 10467 v.Type = t 10468 v.AddArg2(x, y) 10469 return true 10470 } 10471 return false 10472 } 10473 func rewriteValue386_OpRsh32Ux32(v *Value) bool { 10474 v_1 := v.Args[1] 10475 v_0 := v.Args[0] 10476 b := v.Block 10477 // match: (Rsh32Ux32 <t> x y) 10478 // cond: !shiftIsBounded(v) 10479 // result: (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32]))) 10480 for { 10481 t := v.Type 10482 x := v_0 10483 y := v_1 10484 if !(!shiftIsBounded(v)) { 10485 break 10486 } 10487 v.reset(Op386ANDL) 10488 v0 := b.NewValue0(v.Pos, Op386SHRL, t) 10489 v0.AddArg2(x, y) 10490 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 10491 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 10492 v2.AuxInt = int32ToAuxInt(32) 10493 v2.AddArg(y) 10494 v1.AddArg(v2) 10495 v.AddArg2(v0, v1) 10496 return true 10497 } 10498 // match: (Rsh32Ux32 <t> x y) 10499 // cond: shiftIsBounded(v) 10500 // result: (SHRL <t> x y) 10501 for { 10502 t := v.Type 10503 x := v_0 10504 y := v_1 10505 if !(shiftIsBounded(v)) { 10506 break 10507 } 10508 v.reset(Op386SHRL) 10509 v.Type = t 10510 v.AddArg2(x, y) 10511 return true 10512 } 10513 return false 10514 } 10515 func rewriteValue386_OpRsh32Ux64(v *Value) bool { 10516 v_1 := v.Args[1] 10517 v_0 := v.Args[0] 10518 // match: (Rsh32Ux64 x (Const64 [c])) 10519 // cond: uint64(c) < 32 10520 // result: (SHRLconst x [int32(c)]) 10521 for { 10522 x := v_0 10523 if v_1.Op != OpConst64 { 10524 break 10525 } 10526 c := auxIntToInt64(v_1.AuxInt) 10527 if !(uint64(c) < 32) { 10528 break 10529 } 10530 v.reset(Op386SHRLconst) 10531 v.AuxInt = int32ToAuxInt(int32(c)) 10532 v.AddArg(x) 10533 return true 10534 } 10535 // match: (Rsh32Ux64 _ (Const64 [c])) 10536 // cond: uint64(c) >= 32 10537 // result: (Const32 [0]) 10538 for { 10539 if v_1.Op != OpConst64 { 10540 break 10541 } 10542 c := auxIntToInt64(v_1.AuxInt) 10543 if !(uint64(c) >= 32) { 10544 break 10545 } 10546 v.reset(OpConst32) 10547 v.AuxInt = int32ToAuxInt(0) 10548 return true 10549 } 10550 return false 10551 } 10552 func rewriteValue386_OpRsh32Ux8(v *Value) bool { 10553 v_1 := v.Args[1] 10554 v_0 := v.Args[0] 10555 b := v.Block 10556 // match: (Rsh32Ux8 <t> x y) 10557 // cond: !shiftIsBounded(v) 10558 // result: (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32]))) 10559 for { 10560 t := v.Type 10561 x := v_0 10562 y := v_1 10563 if !(!shiftIsBounded(v)) { 10564 break 10565 } 10566 v.reset(Op386ANDL) 10567 v0 := b.NewValue0(v.Pos, Op386SHRL, t) 10568 v0.AddArg2(x, y) 10569 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 10570 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 10571 v2.AuxInt = int8ToAuxInt(32) 10572 v2.AddArg(y) 10573 v1.AddArg(v2) 10574 v.AddArg2(v0, v1) 10575 return true 10576 } 10577 // match: (Rsh32Ux8 <t> x y) 10578 // cond: shiftIsBounded(v) 10579 // result: (SHRL <t> x y) 10580 for { 10581 t := v.Type 10582 x := v_0 10583 y := v_1 10584 if !(shiftIsBounded(v)) { 10585 break 10586 } 10587 v.reset(Op386SHRL) 10588 v.Type = t 10589 v.AddArg2(x, y) 10590 return true 10591 } 10592 return false 10593 } 10594 func rewriteValue386_OpRsh32x16(v *Value) bool { 10595 v_1 := v.Args[1] 10596 v_0 := v.Args[0] 10597 b := v.Block 10598 // match: (Rsh32x16 <t> x y) 10599 // cond: !shiftIsBounded(v) 10600 // result: (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [32]))))) 10601 for { 10602 t := v.Type 10603 x := v_0 10604 y := v_1 10605 if !(!shiftIsBounded(v)) { 10606 break 10607 } 10608 v.reset(Op386SARL) 10609 v.Type = t 10610 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type) 10611 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) 10612 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) 10613 v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 10614 v3.AuxInt = int16ToAuxInt(32) 10615 v3.AddArg(y) 10616 v2.AddArg(v3) 10617 v1.AddArg(v2) 10618 v0.AddArg2(y, v1) 10619 v.AddArg2(x, v0) 10620 return true 10621 } 10622 // match: (Rsh32x16 <t> x y) 10623 // cond: shiftIsBounded(v) 10624 // result: (SARL x y) 10625 for { 10626 x := v_0 10627 y := v_1 10628 if !(shiftIsBounded(v)) { 10629 break 10630 } 10631 v.reset(Op386SARL) 10632 v.AddArg2(x, y) 10633 return true 10634 } 10635 return false 10636 } 10637 func rewriteValue386_OpRsh32x32(v *Value) bool { 10638 v_1 := v.Args[1] 10639 v_0 := v.Args[0] 10640 b := v.Block 10641 // match: (Rsh32x32 <t> x y) 10642 // cond: !shiftIsBounded(v) 10643 // result: (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [32]))))) 10644 for { 10645 t := v.Type 10646 x := v_0 10647 y := v_1 10648 if !(!shiftIsBounded(v)) { 10649 break 10650 } 10651 v.reset(Op386SARL) 10652 v.Type = t 10653 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type) 10654 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) 10655 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) 10656 v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 10657 v3.AuxInt = int32ToAuxInt(32) 10658 v3.AddArg(y) 10659 v2.AddArg(v3) 10660 v1.AddArg(v2) 10661 v0.AddArg2(y, v1) 10662 v.AddArg2(x, v0) 10663 return true 10664 } 10665 // match: (Rsh32x32 <t> x y) 10666 // cond: shiftIsBounded(v) 10667 // result: (SARL x y) 10668 for { 10669 x := v_0 10670 y := v_1 10671 if !(shiftIsBounded(v)) { 10672 break 10673 } 10674 v.reset(Op386SARL) 10675 v.AddArg2(x, y) 10676 return true 10677 } 10678 return false 10679 } 10680 func rewriteValue386_OpRsh32x64(v *Value) bool { 10681 v_1 := v.Args[1] 10682 v_0 := v.Args[0] 10683 // match: (Rsh32x64 x (Const64 [c])) 10684 // cond: uint64(c) < 32 10685 // result: (SARLconst x [int32(c)]) 10686 for { 10687 x := v_0 10688 if v_1.Op != OpConst64 { 10689 break 10690 } 10691 c := auxIntToInt64(v_1.AuxInt) 10692 if !(uint64(c) < 32) { 10693 break 10694 } 10695 v.reset(Op386SARLconst) 10696 v.AuxInt = int32ToAuxInt(int32(c)) 10697 v.AddArg(x) 10698 return true 10699 } 10700 // match: (Rsh32x64 x (Const64 [c])) 10701 // cond: uint64(c) >= 32 10702 // result: (SARLconst x [31]) 10703 for { 10704 x := v_0 10705 if v_1.Op != OpConst64 { 10706 break 10707 } 10708 c := auxIntToInt64(v_1.AuxInt) 10709 if !(uint64(c) >= 32) { 10710 break 10711 } 10712 v.reset(Op386SARLconst) 10713 v.AuxInt = int32ToAuxInt(31) 10714 v.AddArg(x) 10715 return true 10716 } 10717 return false 10718 } 10719 func rewriteValue386_OpRsh32x8(v *Value) bool { 10720 v_1 := v.Args[1] 10721 v_0 := v.Args[0] 10722 b := v.Block 10723 // match: (Rsh32x8 <t> x y) 10724 // cond: !shiftIsBounded(v) 10725 // result: (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [32]))))) 10726 for { 10727 t := v.Type 10728 x := v_0 10729 y := v_1 10730 if !(!shiftIsBounded(v)) { 10731 break 10732 } 10733 v.reset(Op386SARL) 10734 v.Type = t 10735 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type) 10736 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) 10737 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) 10738 v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 10739 v3.AuxInt = int8ToAuxInt(32) 10740 v3.AddArg(y) 10741 v2.AddArg(v3) 10742 v1.AddArg(v2) 10743 v0.AddArg2(y, v1) 10744 v.AddArg2(x, v0) 10745 return true 10746 } 10747 // match: (Rsh32x8 <t> x y) 10748 // cond: shiftIsBounded(v) 10749 // result: (SARL x y) 10750 for { 10751 x := v_0 10752 y := v_1 10753 if !(shiftIsBounded(v)) { 10754 break 10755 } 10756 v.reset(Op386SARL) 10757 v.AddArg2(x, y) 10758 return true 10759 } 10760 return false 10761 } 10762 func rewriteValue386_OpRsh8Ux16(v *Value) bool { 10763 v_1 := v.Args[1] 10764 v_0 := v.Args[0] 10765 b := v.Block 10766 // match: (Rsh8Ux16 <t> x y) 10767 // cond: !shiftIsBounded(v) 10768 // result: (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPWconst y [8]))) 10769 for { 10770 t := v.Type 10771 x := v_0 10772 y := v_1 10773 if !(!shiftIsBounded(v)) { 10774 break 10775 } 10776 v.reset(Op386ANDL) 10777 v0 := b.NewValue0(v.Pos, Op386SHRB, t) 10778 v0.AddArg2(x, y) 10779 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 10780 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 10781 v2.AuxInt = int16ToAuxInt(8) 10782 v2.AddArg(y) 10783 v1.AddArg(v2) 10784 v.AddArg2(v0, v1) 10785 return true 10786 } 10787 // match: (Rsh8Ux16 <t> x y) 10788 // cond: shiftIsBounded(v) 10789 // result: (SHRB <t> x y) 10790 for { 10791 t := v.Type 10792 x := v_0 10793 y := v_1 10794 if !(shiftIsBounded(v)) { 10795 break 10796 } 10797 v.reset(Op386SHRB) 10798 v.Type = t 10799 v.AddArg2(x, y) 10800 return true 10801 } 10802 return false 10803 } 10804 func rewriteValue386_OpRsh8Ux32(v *Value) bool { 10805 v_1 := v.Args[1] 10806 v_0 := v.Args[0] 10807 b := v.Block 10808 // match: (Rsh8Ux32 <t> x y) 10809 // cond: !shiftIsBounded(v) 10810 // result: (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPLconst y [8]))) 10811 for { 10812 t := v.Type 10813 x := v_0 10814 y := v_1 10815 if !(!shiftIsBounded(v)) { 10816 break 10817 } 10818 v.reset(Op386ANDL) 10819 v0 := b.NewValue0(v.Pos, Op386SHRB, t) 10820 v0.AddArg2(x, y) 10821 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 10822 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 10823 v2.AuxInt = int32ToAuxInt(8) 10824 v2.AddArg(y) 10825 v1.AddArg(v2) 10826 v.AddArg2(v0, v1) 10827 return true 10828 } 10829 // match: (Rsh8Ux32 <t> x y) 10830 // cond: shiftIsBounded(v) 10831 // result: (SHRB <t> x y) 10832 for { 10833 t := v.Type 10834 x := v_0 10835 y := v_1 10836 if !(shiftIsBounded(v)) { 10837 break 10838 } 10839 v.reset(Op386SHRB) 10840 v.Type = t 10841 v.AddArg2(x, y) 10842 return true 10843 } 10844 return false 10845 } 10846 func rewriteValue386_OpRsh8Ux64(v *Value) bool { 10847 v_1 := v.Args[1] 10848 v_0 := v.Args[0] 10849 // match: (Rsh8Ux64 x (Const64 [c])) 10850 // cond: uint64(c) < 8 10851 // result: (SHRBconst x [int8(c)]) 10852 for { 10853 x := v_0 10854 if v_1.Op != OpConst64 { 10855 break 10856 } 10857 c := auxIntToInt64(v_1.AuxInt) 10858 if !(uint64(c) < 8) { 10859 break 10860 } 10861 v.reset(Op386SHRBconst) 10862 v.AuxInt = int8ToAuxInt(int8(c)) 10863 v.AddArg(x) 10864 return true 10865 } 10866 // match: (Rsh8Ux64 _ (Const64 [c])) 10867 // cond: uint64(c) >= 8 10868 // result: (Const8 [0]) 10869 for { 10870 if v_1.Op != OpConst64 { 10871 break 10872 } 10873 c := auxIntToInt64(v_1.AuxInt) 10874 if !(uint64(c) >= 8) { 10875 break 10876 } 10877 v.reset(OpConst8) 10878 v.AuxInt = int8ToAuxInt(0) 10879 return true 10880 } 10881 return false 10882 } 10883 func rewriteValue386_OpRsh8Ux8(v *Value) bool { 10884 v_1 := v.Args[1] 10885 v_0 := v.Args[0] 10886 b := v.Block 10887 // match: (Rsh8Ux8 <t> x y) 10888 // cond: !shiftIsBounded(v) 10889 // result: (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPBconst y [8]))) 10890 for { 10891 t := v.Type 10892 x := v_0 10893 y := v_1 10894 if !(!shiftIsBounded(v)) { 10895 break 10896 } 10897 v.reset(Op386ANDL) 10898 v0 := b.NewValue0(v.Pos, Op386SHRB, t) 10899 v0.AddArg2(x, y) 10900 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 10901 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 10902 v2.AuxInt = int8ToAuxInt(8) 10903 v2.AddArg(y) 10904 v1.AddArg(v2) 10905 v.AddArg2(v0, v1) 10906 return true 10907 } 10908 // match: (Rsh8Ux8 <t> x y) 10909 // cond: shiftIsBounded(v) 10910 // result: (SHRB <t> x y) 10911 for { 10912 t := v.Type 10913 x := v_0 10914 y := v_1 10915 if !(shiftIsBounded(v)) { 10916 break 10917 } 10918 v.reset(Op386SHRB) 10919 v.Type = t 10920 v.AddArg2(x, y) 10921 return true 10922 } 10923 return false 10924 } 10925 func rewriteValue386_OpRsh8x16(v *Value) bool { 10926 v_1 := v.Args[1] 10927 v_0 := v.Args[0] 10928 b := v.Block 10929 // match: (Rsh8x16 <t> x y) 10930 // cond: !shiftIsBounded(v) 10931 // result: (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [8]))))) 10932 for { 10933 t := v.Type 10934 x := v_0 10935 y := v_1 10936 if !(!shiftIsBounded(v)) { 10937 break 10938 } 10939 v.reset(Op386SARB) 10940 v.Type = t 10941 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type) 10942 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) 10943 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) 10944 v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) 10945 v3.AuxInt = int16ToAuxInt(8) 10946 v3.AddArg(y) 10947 v2.AddArg(v3) 10948 v1.AddArg(v2) 10949 v0.AddArg2(y, v1) 10950 v.AddArg2(x, v0) 10951 return true 10952 } 10953 // match: (Rsh8x16 <t> x y) 10954 // cond: shiftIsBounded(v) 10955 // result: (SARB x y) 10956 for { 10957 x := v_0 10958 y := v_1 10959 if !(shiftIsBounded(v)) { 10960 break 10961 } 10962 v.reset(Op386SARB) 10963 v.AddArg2(x, y) 10964 return true 10965 } 10966 return false 10967 } 10968 func rewriteValue386_OpRsh8x32(v *Value) bool { 10969 v_1 := v.Args[1] 10970 v_0 := v.Args[0] 10971 b := v.Block 10972 // match: (Rsh8x32 <t> x y) 10973 // cond: !shiftIsBounded(v) 10974 // result: (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [8]))))) 10975 for { 10976 t := v.Type 10977 x := v_0 10978 y := v_1 10979 if !(!shiftIsBounded(v)) { 10980 break 10981 } 10982 v.reset(Op386SARB) 10983 v.Type = t 10984 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type) 10985 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) 10986 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) 10987 v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 10988 v3.AuxInt = int32ToAuxInt(8) 10989 v3.AddArg(y) 10990 v2.AddArg(v3) 10991 v1.AddArg(v2) 10992 v0.AddArg2(y, v1) 10993 v.AddArg2(x, v0) 10994 return true 10995 } 10996 // match: (Rsh8x32 <t> x y) 10997 // cond: shiftIsBounded(v) 10998 // result: (SARB x y) 10999 for { 11000 x := v_0 11001 y := v_1 11002 if !(shiftIsBounded(v)) { 11003 break 11004 } 11005 v.reset(Op386SARB) 11006 v.AddArg2(x, y) 11007 return true 11008 } 11009 return false 11010 } 11011 func rewriteValue386_OpRsh8x64(v *Value) bool { 11012 v_1 := v.Args[1] 11013 v_0 := v.Args[0] 11014 // match: (Rsh8x64 x (Const64 [c])) 11015 // cond: uint64(c) < 8 11016 // result: (SARBconst x [int8(c)]) 11017 for { 11018 x := v_0 11019 if v_1.Op != OpConst64 { 11020 break 11021 } 11022 c := auxIntToInt64(v_1.AuxInt) 11023 if !(uint64(c) < 8) { 11024 break 11025 } 11026 v.reset(Op386SARBconst) 11027 v.AuxInt = int8ToAuxInt(int8(c)) 11028 v.AddArg(x) 11029 return true 11030 } 11031 // match: (Rsh8x64 x (Const64 [c])) 11032 // cond: uint64(c) >= 8 11033 // result: (SARBconst x [7]) 11034 for { 11035 x := v_0 11036 if v_1.Op != OpConst64 { 11037 break 11038 } 11039 c := auxIntToInt64(v_1.AuxInt) 11040 if !(uint64(c) >= 8) { 11041 break 11042 } 11043 v.reset(Op386SARBconst) 11044 v.AuxInt = int8ToAuxInt(7) 11045 v.AddArg(x) 11046 return true 11047 } 11048 return false 11049 } 11050 func rewriteValue386_OpRsh8x8(v *Value) bool { 11051 v_1 := v.Args[1] 11052 v_0 := v.Args[0] 11053 b := v.Block 11054 // match: (Rsh8x8 <t> x y) 11055 // cond: !shiftIsBounded(v) 11056 // result: (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [8]))))) 11057 for { 11058 t := v.Type 11059 x := v_0 11060 y := v_1 11061 if !(!shiftIsBounded(v)) { 11062 break 11063 } 11064 v.reset(Op386SARB) 11065 v.Type = t 11066 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type) 11067 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) 11068 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) 11069 v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) 11070 v3.AuxInt = int8ToAuxInt(8) 11071 v3.AddArg(y) 11072 v2.AddArg(v3) 11073 v1.AddArg(v2) 11074 v0.AddArg2(y, v1) 11075 v.AddArg2(x, v0) 11076 return true 11077 } 11078 // match: (Rsh8x8 <t> x y) 11079 // cond: shiftIsBounded(v) 11080 // result: (SARB x y) 11081 for { 11082 x := v_0 11083 y := v_1 11084 if !(shiftIsBounded(v)) { 11085 break 11086 } 11087 v.reset(Op386SARB) 11088 v.AddArg2(x, y) 11089 return true 11090 } 11091 return false 11092 } 11093 func rewriteValue386_OpSelect0(v *Value) bool { 11094 v_0 := v.Args[0] 11095 b := v.Block 11096 typ := &b.Func.Config.Types 11097 // match: (Select0 (Mul32uover x y)) 11098 // result: (Select0 <typ.UInt32> (MULLU x y)) 11099 for { 11100 if v_0.Op != OpMul32uover { 11101 break 11102 } 11103 y := v_0.Args[1] 11104 x := v_0.Args[0] 11105 v.reset(OpSelect0) 11106 v.Type = typ.UInt32 11107 v0 := b.NewValue0(v.Pos, Op386MULLU, types.NewTuple(typ.UInt32, types.TypeFlags)) 11108 v0.AddArg2(x, y) 11109 v.AddArg(v0) 11110 return true 11111 } 11112 return false 11113 } 11114 func rewriteValue386_OpSelect1(v *Value) bool { 11115 v_0 := v.Args[0] 11116 b := v.Block 11117 typ := &b.Func.Config.Types 11118 // match: (Select1 (Mul32uover x y)) 11119 // result: (SETO (Select1 <types.TypeFlags> (MULLU x y))) 11120 for { 11121 if v_0.Op != OpMul32uover { 11122 break 11123 } 11124 y := v_0.Args[1] 11125 x := v_0.Args[0] 11126 v.reset(Op386SETO) 11127 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 11128 v1 := b.NewValue0(v.Pos, Op386MULLU, types.NewTuple(typ.UInt32, types.TypeFlags)) 11129 v1.AddArg2(x, y) 11130 v0.AddArg(v1) 11131 v.AddArg(v0) 11132 return true 11133 } 11134 return false 11135 } 11136 func rewriteValue386_OpSignmask(v *Value) bool { 11137 v_0 := v.Args[0] 11138 // match: (Signmask x) 11139 // result: (SARLconst x [31]) 11140 for { 11141 x := v_0 11142 v.reset(Op386SARLconst) 11143 v.AuxInt = int32ToAuxInt(31) 11144 v.AddArg(x) 11145 return true 11146 } 11147 } 11148 func rewriteValue386_OpSlicemask(v *Value) bool { 11149 v_0 := v.Args[0] 11150 b := v.Block 11151 // match: (Slicemask <t> x) 11152 // result: (SARLconst (NEGL <t> x) [31]) 11153 for { 11154 t := v.Type 11155 x := v_0 11156 v.reset(Op386SARLconst) 11157 v.AuxInt = int32ToAuxInt(31) 11158 v0 := b.NewValue0(v.Pos, Op386NEGL, t) 11159 v0.AddArg(x) 11160 v.AddArg(v0) 11161 return true 11162 } 11163 } 11164 func rewriteValue386_OpStore(v *Value) bool { 11165 v_2 := v.Args[2] 11166 v_1 := v.Args[1] 11167 v_0 := v.Args[0] 11168 // match: (Store {t} ptr val mem) 11169 // cond: t.Size() == 8 && is64BitFloat(val.Type) 11170 // result: (MOVSDstore ptr val mem) 11171 for { 11172 t := auxToType(v.Aux) 11173 ptr := v_0 11174 val := v_1 11175 mem := v_2 11176 if !(t.Size() == 8 && is64BitFloat(val.Type)) { 11177 break 11178 } 11179 v.reset(Op386MOVSDstore) 11180 v.AddArg3(ptr, val, mem) 11181 return true 11182 } 11183 // match: (Store {t} ptr val mem) 11184 // cond: t.Size() == 4 && is32BitFloat(val.Type) 11185 // result: (MOVSSstore ptr val mem) 11186 for { 11187 t := auxToType(v.Aux) 11188 ptr := v_0 11189 val := v_1 11190 mem := v_2 11191 if !(t.Size() == 4 && is32BitFloat(val.Type)) { 11192 break 11193 } 11194 v.reset(Op386MOVSSstore) 11195 v.AddArg3(ptr, val, mem) 11196 return true 11197 } 11198 // match: (Store {t} ptr val mem) 11199 // cond: t.Size() == 4 11200 // result: (MOVLstore ptr val mem) 11201 for { 11202 t := auxToType(v.Aux) 11203 ptr := v_0 11204 val := v_1 11205 mem := v_2 11206 if !(t.Size() == 4) { 11207 break 11208 } 11209 v.reset(Op386MOVLstore) 11210 v.AddArg3(ptr, val, mem) 11211 return true 11212 } 11213 // match: (Store {t} ptr val mem) 11214 // cond: t.Size() == 2 11215 // result: (MOVWstore ptr val mem) 11216 for { 11217 t := auxToType(v.Aux) 11218 ptr := v_0 11219 val := v_1 11220 mem := v_2 11221 if !(t.Size() == 2) { 11222 break 11223 } 11224 v.reset(Op386MOVWstore) 11225 v.AddArg3(ptr, val, mem) 11226 return true 11227 } 11228 // match: (Store {t} ptr val mem) 11229 // cond: t.Size() == 1 11230 // result: (MOVBstore ptr val mem) 11231 for { 11232 t := auxToType(v.Aux) 11233 ptr := v_0 11234 val := v_1 11235 mem := v_2 11236 if !(t.Size() == 1) { 11237 break 11238 } 11239 v.reset(Op386MOVBstore) 11240 v.AddArg3(ptr, val, mem) 11241 return true 11242 } 11243 return false 11244 } 11245 func rewriteValue386_OpZero(v *Value) bool { 11246 v_1 := v.Args[1] 11247 v_0 := v.Args[0] 11248 b := v.Block 11249 config := b.Func.Config 11250 typ := &b.Func.Config.Types 11251 // match: (Zero [0] _ mem) 11252 // result: mem 11253 for { 11254 if auxIntToInt64(v.AuxInt) != 0 { 11255 break 11256 } 11257 mem := v_1 11258 v.copyOf(mem) 11259 return true 11260 } 11261 // match: (Zero [1] destptr mem) 11262 // result: (MOVBstoreconst [0] destptr mem) 11263 for { 11264 if auxIntToInt64(v.AuxInt) != 1 { 11265 break 11266 } 11267 destptr := v_0 11268 mem := v_1 11269 v.reset(Op386MOVBstoreconst) 11270 v.AuxInt = valAndOffToAuxInt(0) 11271 v.AddArg2(destptr, mem) 11272 return true 11273 } 11274 // match: (Zero [2] destptr mem) 11275 // result: (MOVWstoreconst [0] destptr mem) 11276 for { 11277 if auxIntToInt64(v.AuxInt) != 2 { 11278 break 11279 } 11280 destptr := v_0 11281 mem := v_1 11282 v.reset(Op386MOVWstoreconst) 11283 v.AuxInt = valAndOffToAuxInt(0) 11284 v.AddArg2(destptr, mem) 11285 return true 11286 } 11287 // match: (Zero [4] destptr mem) 11288 // result: (MOVLstoreconst [0] destptr mem) 11289 for { 11290 if auxIntToInt64(v.AuxInt) != 4 { 11291 break 11292 } 11293 destptr := v_0 11294 mem := v_1 11295 v.reset(Op386MOVLstoreconst) 11296 v.AuxInt = valAndOffToAuxInt(0) 11297 v.AddArg2(destptr, mem) 11298 return true 11299 } 11300 // match: (Zero [3] destptr mem) 11301 // result: (MOVBstoreconst [makeValAndOff(0,2)] destptr (MOVWstoreconst [makeValAndOff(0,0)] destptr mem)) 11302 for { 11303 if auxIntToInt64(v.AuxInt) != 3 { 11304 break 11305 } 11306 destptr := v_0 11307 mem := v_1 11308 v.reset(Op386MOVBstoreconst) 11309 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 2)) 11310 v0 := b.NewValue0(v.Pos, Op386MOVWstoreconst, types.TypeMem) 11311 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0)) 11312 v0.AddArg2(destptr, mem) 11313 v.AddArg2(destptr, v0) 11314 return true 11315 } 11316 // match: (Zero [5] destptr mem) 11317 // result: (MOVBstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem)) 11318 for { 11319 if auxIntToInt64(v.AuxInt) != 5 { 11320 break 11321 } 11322 destptr := v_0 11323 mem := v_1 11324 v.reset(Op386MOVBstoreconst) 11325 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4)) 11326 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11327 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0)) 11328 v0.AddArg2(destptr, mem) 11329 v.AddArg2(destptr, v0) 11330 return true 11331 } 11332 // match: (Zero [6] destptr mem) 11333 // result: (MOVWstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem)) 11334 for { 11335 if auxIntToInt64(v.AuxInt) != 6 { 11336 break 11337 } 11338 destptr := v_0 11339 mem := v_1 11340 v.reset(Op386MOVWstoreconst) 11341 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4)) 11342 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11343 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0)) 11344 v0.AddArg2(destptr, mem) 11345 v.AddArg2(destptr, v0) 11346 return true 11347 } 11348 // match: (Zero [7] destptr mem) 11349 // result: (MOVLstoreconst [makeValAndOff(0,3)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem)) 11350 for { 11351 if auxIntToInt64(v.AuxInt) != 7 { 11352 break 11353 } 11354 destptr := v_0 11355 mem := v_1 11356 v.reset(Op386MOVLstoreconst) 11357 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 3)) 11358 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11359 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0)) 11360 v0.AddArg2(destptr, mem) 11361 v.AddArg2(destptr, v0) 11362 return true 11363 } 11364 // match: (Zero [s] destptr mem) 11365 // cond: s%4 != 0 && s > 4 11366 // result: (Zero [s-s%4] (ADDLconst destptr [int32(s%4)]) (MOVLstoreconst [0] destptr mem)) 11367 for { 11368 s := auxIntToInt64(v.AuxInt) 11369 destptr := v_0 11370 mem := v_1 11371 if !(s%4 != 0 && s > 4) { 11372 break 11373 } 11374 v.reset(OpZero) 11375 v.AuxInt = int64ToAuxInt(s - s%4) 11376 v0 := b.NewValue0(v.Pos, Op386ADDLconst, typ.UInt32) 11377 v0.AuxInt = int32ToAuxInt(int32(s % 4)) 11378 v0.AddArg(destptr) 11379 v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11380 v1.AuxInt = valAndOffToAuxInt(0) 11381 v1.AddArg2(destptr, mem) 11382 v.AddArg2(v0, v1) 11383 return true 11384 } 11385 // match: (Zero [8] destptr mem) 11386 // result: (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem)) 11387 for { 11388 if auxIntToInt64(v.AuxInt) != 8 { 11389 break 11390 } 11391 destptr := v_0 11392 mem := v_1 11393 v.reset(Op386MOVLstoreconst) 11394 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4)) 11395 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11396 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0)) 11397 v0.AddArg2(destptr, mem) 11398 v.AddArg2(destptr, v0) 11399 return true 11400 } 11401 // match: (Zero [12] destptr mem) 11402 // result: (MOVLstoreconst [makeValAndOff(0,8)] destptr (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))) 11403 for { 11404 if auxIntToInt64(v.AuxInt) != 12 { 11405 break 11406 } 11407 destptr := v_0 11408 mem := v_1 11409 v.reset(Op386MOVLstoreconst) 11410 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 8)) 11411 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11412 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4)) 11413 v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11414 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0)) 11415 v1.AddArg2(destptr, mem) 11416 v0.AddArg2(destptr, v1) 11417 v.AddArg2(destptr, v0) 11418 return true 11419 } 11420 // match: (Zero [16] destptr mem) 11421 // result: (MOVLstoreconst [makeValAndOff(0,12)] destptr (MOVLstoreconst [makeValAndOff(0,8)] destptr (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem)))) 11422 for { 11423 if auxIntToInt64(v.AuxInt) != 16 { 11424 break 11425 } 11426 destptr := v_0 11427 mem := v_1 11428 v.reset(Op386MOVLstoreconst) 11429 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 12)) 11430 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11431 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 8)) 11432 v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11433 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4)) 11434 v2 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) 11435 v2.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0)) 11436 v2.AddArg2(destptr, mem) 11437 v1.AddArg2(destptr, v2) 11438 v0.AddArg2(destptr, v1) 11439 v.AddArg2(destptr, v0) 11440 return true 11441 } 11442 // match: (Zero [s] destptr mem) 11443 // cond: s > 16 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice 11444 // result: (DUFFZERO [1*(128-s/4)] destptr (MOVLconst [0]) mem) 11445 for { 11446 s := auxIntToInt64(v.AuxInt) 11447 destptr := v_0 11448 mem := v_1 11449 if !(s > 16 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice) { 11450 break 11451 } 11452 v.reset(Op386DUFFZERO) 11453 v.AuxInt = int64ToAuxInt(1 * (128 - s/4)) 11454 v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32) 11455 v0.AuxInt = int32ToAuxInt(0) 11456 v.AddArg3(destptr, v0, mem) 11457 return true 11458 } 11459 // match: (Zero [s] destptr mem) 11460 // cond: (s > 4*128 || (config.noDuffDevice && s > 16)) && s%4 == 0 11461 // result: (REPSTOSL destptr (MOVLconst [int32(s/4)]) (MOVLconst [0]) mem) 11462 for { 11463 s := auxIntToInt64(v.AuxInt) 11464 destptr := v_0 11465 mem := v_1 11466 if !((s > 4*128 || (config.noDuffDevice && s > 16)) && s%4 == 0) { 11467 break 11468 } 11469 v.reset(Op386REPSTOSL) 11470 v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32) 11471 v0.AuxInt = int32ToAuxInt(int32(s / 4)) 11472 v1 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32) 11473 v1.AuxInt = int32ToAuxInt(0) 11474 v.AddArg4(destptr, v0, v1, mem) 11475 return true 11476 } 11477 return false 11478 } 11479 func rewriteValue386_OpZeromask(v *Value) bool { 11480 v_0 := v.Args[0] 11481 b := v.Block 11482 // match: (Zeromask <t> x) 11483 // result: (XORLconst [-1] (SBBLcarrymask <t> (CMPLconst x [1]))) 11484 for { 11485 t := v.Type 11486 x := v_0 11487 v.reset(Op386XORLconst) 11488 v.AuxInt = int32ToAuxInt(-1) 11489 v0 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) 11490 v1 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) 11491 v1.AuxInt = int32ToAuxInt(1) 11492 v1.AddArg(x) 11493 v0.AddArg(v1) 11494 v.AddArg(v0) 11495 return true 11496 } 11497 } 11498 func rewriteBlock386(b *Block) bool { 11499 switch b.Kind { 11500 case Block386EQ: 11501 // match: (EQ (InvertFlags cmp) yes no) 11502 // result: (EQ cmp yes no) 11503 for b.Controls[0].Op == Op386InvertFlags { 11504 v_0 := b.Controls[0] 11505 cmp := v_0.Args[0] 11506 b.resetWithControl(Block386EQ, cmp) 11507 return true 11508 } 11509 // match: (EQ (FlagEQ) yes no) 11510 // result: (First yes no) 11511 for b.Controls[0].Op == Op386FlagEQ { 11512 b.Reset(BlockFirst) 11513 return true 11514 } 11515 // match: (EQ (FlagLT_ULT) yes no) 11516 // result: (First no yes) 11517 for b.Controls[0].Op == Op386FlagLT_ULT { 11518 b.Reset(BlockFirst) 11519 b.swapSuccessors() 11520 return true 11521 } 11522 // match: (EQ (FlagLT_UGT) yes no) 11523 // result: (First no yes) 11524 for b.Controls[0].Op == Op386FlagLT_UGT { 11525 b.Reset(BlockFirst) 11526 b.swapSuccessors() 11527 return true 11528 } 11529 // match: (EQ (FlagGT_ULT) yes no) 11530 // result: (First no yes) 11531 for b.Controls[0].Op == Op386FlagGT_ULT { 11532 b.Reset(BlockFirst) 11533 b.swapSuccessors() 11534 return true 11535 } 11536 // match: (EQ (FlagGT_UGT) yes no) 11537 // result: (First no yes) 11538 for b.Controls[0].Op == Op386FlagGT_UGT { 11539 b.Reset(BlockFirst) 11540 b.swapSuccessors() 11541 return true 11542 } 11543 case Block386GE: 11544 // match: (GE (InvertFlags cmp) yes no) 11545 // result: (LE cmp yes no) 11546 for b.Controls[0].Op == Op386InvertFlags { 11547 v_0 := b.Controls[0] 11548 cmp := v_0.Args[0] 11549 b.resetWithControl(Block386LE, cmp) 11550 return true 11551 } 11552 // match: (GE (FlagEQ) yes no) 11553 // result: (First yes no) 11554 for b.Controls[0].Op == Op386FlagEQ { 11555 b.Reset(BlockFirst) 11556 return true 11557 } 11558 // match: (GE (FlagLT_ULT) yes no) 11559 // result: (First no yes) 11560 for b.Controls[0].Op == Op386FlagLT_ULT { 11561 b.Reset(BlockFirst) 11562 b.swapSuccessors() 11563 return true 11564 } 11565 // match: (GE (FlagLT_UGT) yes no) 11566 // result: (First no yes) 11567 for b.Controls[0].Op == Op386FlagLT_UGT { 11568 b.Reset(BlockFirst) 11569 b.swapSuccessors() 11570 return true 11571 } 11572 // match: (GE (FlagGT_ULT) yes no) 11573 // result: (First yes no) 11574 for b.Controls[0].Op == Op386FlagGT_ULT { 11575 b.Reset(BlockFirst) 11576 return true 11577 } 11578 // match: (GE (FlagGT_UGT) yes no) 11579 // result: (First yes no) 11580 for b.Controls[0].Op == Op386FlagGT_UGT { 11581 b.Reset(BlockFirst) 11582 return true 11583 } 11584 case Block386GT: 11585 // match: (GT (InvertFlags cmp) yes no) 11586 // result: (LT cmp yes no) 11587 for b.Controls[0].Op == Op386InvertFlags { 11588 v_0 := b.Controls[0] 11589 cmp := v_0.Args[0] 11590 b.resetWithControl(Block386LT, cmp) 11591 return true 11592 } 11593 // match: (GT (FlagEQ) yes no) 11594 // result: (First no yes) 11595 for b.Controls[0].Op == Op386FlagEQ { 11596 b.Reset(BlockFirst) 11597 b.swapSuccessors() 11598 return true 11599 } 11600 // match: (GT (FlagLT_ULT) yes no) 11601 // result: (First no yes) 11602 for b.Controls[0].Op == Op386FlagLT_ULT { 11603 b.Reset(BlockFirst) 11604 b.swapSuccessors() 11605 return true 11606 } 11607 // match: (GT (FlagLT_UGT) yes no) 11608 // result: (First no yes) 11609 for b.Controls[0].Op == Op386FlagLT_UGT { 11610 b.Reset(BlockFirst) 11611 b.swapSuccessors() 11612 return true 11613 } 11614 // match: (GT (FlagGT_ULT) yes no) 11615 // result: (First yes no) 11616 for b.Controls[0].Op == Op386FlagGT_ULT { 11617 b.Reset(BlockFirst) 11618 return true 11619 } 11620 // match: (GT (FlagGT_UGT) yes no) 11621 // result: (First yes no) 11622 for b.Controls[0].Op == Op386FlagGT_UGT { 11623 b.Reset(BlockFirst) 11624 return true 11625 } 11626 case BlockIf: 11627 // match: (If (SETL cmp) yes no) 11628 // result: (LT cmp yes no) 11629 for b.Controls[0].Op == Op386SETL { 11630 v_0 := b.Controls[0] 11631 cmp := v_0.Args[0] 11632 b.resetWithControl(Block386LT, cmp) 11633 return true 11634 } 11635 // match: (If (SETLE cmp) yes no) 11636 // result: (LE cmp yes no) 11637 for b.Controls[0].Op == Op386SETLE { 11638 v_0 := b.Controls[0] 11639 cmp := v_0.Args[0] 11640 b.resetWithControl(Block386LE, cmp) 11641 return true 11642 } 11643 // match: (If (SETG cmp) yes no) 11644 // result: (GT cmp yes no) 11645 for b.Controls[0].Op == Op386SETG { 11646 v_0 := b.Controls[0] 11647 cmp := v_0.Args[0] 11648 b.resetWithControl(Block386GT, cmp) 11649 return true 11650 } 11651 // match: (If (SETGE cmp) yes no) 11652 // result: (GE cmp yes no) 11653 for b.Controls[0].Op == Op386SETGE { 11654 v_0 := b.Controls[0] 11655 cmp := v_0.Args[0] 11656 b.resetWithControl(Block386GE, cmp) 11657 return true 11658 } 11659 // match: (If (SETEQ cmp) yes no) 11660 // result: (EQ cmp yes no) 11661 for b.Controls[0].Op == Op386SETEQ { 11662 v_0 := b.Controls[0] 11663 cmp := v_0.Args[0] 11664 b.resetWithControl(Block386EQ, cmp) 11665 return true 11666 } 11667 // match: (If (SETNE cmp) yes no) 11668 // result: (NE cmp yes no) 11669 for b.Controls[0].Op == Op386SETNE { 11670 v_0 := b.Controls[0] 11671 cmp := v_0.Args[0] 11672 b.resetWithControl(Block386NE, cmp) 11673 return true 11674 } 11675 // match: (If (SETB cmp) yes no) 11676 // result: (ULT cmp yes no) 11677 for b.Controls[0].Op == Op386SETB { 11678 v_0 := b.Controls[0] 11679 cmp := v_0.Args[0] 11680 b.resetWithControl(Block386ULT, cmp) 11681 return true 11682 } 11683 // match: (If (SETBE cmp) yes no) 11684 // result: (ULE cmp yes no) 11685 for b.Controls[0].Op == Op386SETBE { 11686 v_0 := b.Controls[0] 11687 cmp := v_0.Args[0] 11688 b.resetWithControl(Block386ULE, cmp) 11689 return true 11690 } 11691 // match: (If (SETA cmp) yes no) 11692 // result: (UGT cmp yes no) 11693 for b.Controls[0].Op == Op386SETA { 11694 v_0 := b.Controls[0] 11695 cmp := v_0.Args[0] 11696 b.resetWithControl(Block386UGT, cmp) 11697 return true 11698 } 11699 // match: (If (SETAE cmp) yes no) 11700 // result: (UGE cmp yes no) 11701 for b.Controls[0].Op == Op386SETAE { 11702 v_0 := b.Controls[0] 11703 cmp := v_0.Args[0] 11704 b.resetWithControl(Block386UGE, cmp) 11705 return true 11706 } 11707 // match: (If (SETO cmp) yes no) 11708 // result: (OS cmp yes no) 11709 for b.Controls[0].Op == Op386SETO { 11710 v_0 := b.Controls[0] 11711 cmp := v_0.Args[0] 11712 b.resetWithControl(Block386OS, cmp) 11713 return true 11714 } 11715 // match: (If (SETGF cmp) yes no) 11716 // result: (UGT cmp yes no) 11717 for b.Controls[0].Op == Op386SETGF { 11718 v_0 := b.Controls[0] 11719 cmp := v_0.Args[0] 11720 b.resetWithControl(Block386UGT, cmp) 11721 return true 11722 } 11723 // match: (If (SETGEF cmp) yes no) 11724 // result: (UGE cmp yes no) 11725 for b.Controls[0].Op == Op386SETGEF { 11726 v_0 := b.Controls[0] 11727 cmp := v_0.Args[0] 11728 b.resetWithControl(Block386UGE, cmp) 11729 return true 11730 } 11731 // match: (If (SETEQF cmp) yes no) 11732 // result: (EQF cmp yes no) 11733 for b.Controls[0].Op == Op386SETEQF { 11734 v_0 := b.Controls[0] 11735 cmp := v_0.Args[0] 11736 b.resetWithControl(Block386EQF, cmp) 11737 return true 11738 } 11739 // match: (If (SETNEF cmp) yes no) 11740 // result: (NEF cmp yes no) 11741 for b.Controls[0].Op == Op386SETNEF { 11742 v_0 := b.Controls[0] 11743 cmp := v_0.Args[0] 11744 b.resetWithControl(Block386NEF, cmp) 11745 return true 11746 } 11747 // match: (If cond yes no) 11748 // result: (NE (TESTB cond cond) yes no) 11749 for { 11750 cond := b.Controls[0] 11751 v0 := b.NewValue0(cond.Pos, Op386TESTB, types.TypeFlags) 11752 v0.AddArg2(cond, cond) 11753 b.resetWithControl(Block386NE, v0) 11754 return true 11755 } 11756 case Block386LE: 11757 // match: (LE (InvertFlags cmp) yes no) 11758 // result: (GE cmp yes no) 11759 for b.Controls[0].Op == Op386InvertFlags { 11760 v_0 := b.Controls[0] 11761 cmp := v_0.Args[0] 11762 b.resetWithControl(Block386GE, cmp) 11763 return true 11764 } 11765 // match: (LE (FlagEQ) yes no) 11766 // result: (First yes no) 11767 for b.Controls[0].Op == Op386FlagEQ { 11768 b.Reset(BlockFirst) 11769 return true 11770 } 11771 // match: (LE (FlagLT_ULT) yes no) 11772 // result: (First yes no) 11773 for b.Controls[0].Op == Op386FlagLT_ULT { 11774 b.Reset(BlockFirst) 11775 return true 11776 } 11777 // match: (LE (FlagLT_UGT) yes no) 11778 // result: (First yes no) 11779 for b.Controls[0].Op == Op386FlagLT_UGT { 11780 b.Reset(BlockFirst) 11781 return true 11782 } 11783 // match: (LE (FlagGT_ULT) yes no) 11784 // result: (First no yes) 11785 for b.Controls[0].Op == Op386FlagGT_ULT { 11786 b.Reset(BlockFirst) 11787 b.swapSuccessors() 11788 return true 11789 } 11790 // match: (LE (FlagGT_UGT) yes no) 11791 // result: (First no yes) 11792 for b.Controls[0].Op == Op386FlagGT_UGT { 11793 b.Reset(BlockFirst) 11794 b.swapSuccessors() 11795 return true 11796 } 11797 case Block386LT: 11798 // match: (LT (InvertFlags cmp) yes no) 11799 // result: (GT cmp yes no) 11800 for b.Controls[0].Op == Op386InvertFlags { 11801 v_0 := b.Controls[0] 11802 cmp := v_0.Args[0] 11803 b.resetWithControl(Block386GT, cmp) 11804 return true 11805 } 11806 // match: (LT (FlagEQ) yes no) 11807 // result: (First no yes) 11808 for b.Controls[0].Op == Op386FlagEQ { 11809 b.Reset(BlockFirst) 11810 b.swapSuccessors() 11811 return true 11812 } 11813 // match: (LT (FlagLT_ULT) yes no) 11814 // result: (First yes no) 11815 for b.Controls[0].Op == Op386FlagLT_ULT { 11816 b.Reset(BlockFirst) 11817 return true 11818 } 11819 // match: (LT (FlagLT_UGT) yes no) 11820 // result: (First yes no) 11821 for b.Controls[0].Op == Op386FlagLT_UGT { 11822 b.Reset(BlockFirst) 11823 return true 11824 } 11825 // match: (LT (FlagGT_ULT) yes no) 11826 // result: (First no yes) 11827 for b.Controls[0].Op == Op386FlagGT_ULT { 11828 b.Reset(BlockFirst) 11829 b.swapSuccessors() 11830 return true 11831 } 11832 // match: (LT (FlagGT_UGT) yes no) 11833 // result: (First no yes) 11834 for b.Controls[0].Op == Op386FlagGT_UGT { 11835 b.Reset(BlockFirst) 11836 b.swapSuccessors() 11837 return true 11838 } 11839 case Block386NE: 11840 // match: (NE (TESTB (SETL cmp) (SETL cmp)) yes no) 11841 // result: (LT cmp yes no) 11842 for b.Controls[0].Op == Op386TESTB { 11843 v_0 := b.Controls[0] 11844 _ = v_0.Args[1] 11845 v_0_0 := v_0.Args[0] 11846 if v_0_0.Op != Op386SETL { 11847 break 11848 } 11849 cmp := v_0_0.Args[0] 11850 v_0_1 := v_0.Args[1] 11851 if v_0_1.Op != Op386SETL || cmp != v_0_1.Args[0] { 11852 break 11853 } 11854 b.resetWithControl(Block386LT, cmp) 11855 return true 11856 } 11857 // match: (NE (TESTB (SETLE cmp) (SETLE cmp)) yes no) 11858 // result: (LE cmp yes no) 11859 for b.Controls[0].Op == Op386TESTB { 11860 v_0 := b.Controls[0] 11861 _ = v_0.Args[1] 11862 v_0_0 := v_0.Args[0] 11863 if v_0_0.Op != Op386SETLE { 11864 break 11865 } 11866 cmp := v_0_0.Args[0] 11867 v_0_1 := v_0.Args[1] 11868 if v_0_1.Op != Op386SETLE || cmp != v_0_1.Args[0] { 11869 break 11870 } 11871 b.resetWithControl(Block386LE, cmp) 11872 return true 11873 } 11874 // match: (NE (TESTB (SETG cmp) (SETG cmp)) yes no) 11875 // result: (GT cmp yes no) 11876 for b.Controls[0].Op == Op386TESTB { 11877 v_0 := b.Controls[0] 11878 _ = v_0.Args[1] 11879 v_0_0 := v_0.Args[0] 11880 if v_0_0.Op != Op386SETG { 11881 break 11882 } 11883 cmp := v_0_0.Args[0] 11884 v_0_1 := v_0.Args[1] 11885 if v_0_1.Op != Op386SETG || cmp != v_0_1.Args[0] { 11886 break 11887 } 11888 b.resetWithControl(Block386GT, cmp) 11889 return true 11890 } 11891 // match: (NE (TESTB (SETGE cmp) (SETGE cmp)) yes no) 11892 // result: (GE cmp yes no) 11893 for b.Controls[0].Op == Op386TESTB { 11894 v_0 := b.Controls[0] 11895 _ = v_0.Args[1] 11896 v_0_0 := v_0.Args[0] 11897 if v_0_0.Op != Op386SETGE { 11898 break 11899 } 11900 cmp := v_0_0.Args[0] 11901 v_0_1 := v_0.Args[1] 11902 if v_0_1.Op != Op386SETGE || cmp != v_0_1.Args[0] { 11903 break 11904 } 11905 b.resetWithControl(Block386GE, cmp) 11906 return true 11907 } 11908 // match: (NE (TESTB (SETEQ cmp) (SETEQ cmp)) yes no) 11909 // result: (EQ cmp yes no) 11910 for b.Controls[0].Op == Op386TESTB { 11911 v_0 := b.Controls[0] 11912 _ = v_0.Args[1] 11913 v_0_0 := v_0.Args[0] 11914 if v_0_0.Op != Op386SETEQ { 11915 break 11916 } 11917 cmp := v_0_0.Args[0] 11918 v_0_1 := v_0.Args[1] 11919 if v_0_1.Op != Op386SETEQ || cmp != v_0_1.Args[0] { 11920 break 11921 } 11922 b.resetWithControl(Block386EQ, cmp) 11923 return true 11924 } 11925 // match: (NE (TESTB (SETNE cmp) (SETNE cmp)) yes no) 11926 // result: (NE cmp yes no) 11927 for b.Controls[0].Op == Op386TESTB { 11928 v_0 := b.Controls[0] 11929 _ = v_0.Args[1] 11930 v_0_0 := v_0.Args[0] 11931 if v_0_0.Op != Op386SETNE { 11932 break 11933 } 11934 cmp := v_0_0.Args[0] 11935 v_0_1 := v_0.Args[1] 11936 if v_0_1.Op != Op386SETNE || cmp != v_0_1.Args[0] { 11937 break 11938 } 11939 b.resetWithControl(Block386NE, cmp) 11940 return true 11941 } 11942 // match: (NE (TESTB (SETB cmp) (SETB cmp)) yes no) 11943 // result: (ULT cmp yes no) 11944 for b.Controls[0].Op == Op386TESTB { 11945 v_0 := b.Controls[0] 11946 _ = v_0.Args[1] 11947 v_0_0 := v_0.Args[0] 11948 if v_0_0.Op != Op386SETB { 11949 break 11950 } 11951 cmp := v_0_0.Args[0] 11952 v_0_1 := v_0.Args[1] 11953 if v_0_1.Op != Op386SETB || cmp != v_0_1.Args[0] { 11954 break 11955 } 11956 b.resetWithControl(Block386ULT, cmp) 11957 return true 11958 } 11959 // match: (NE (TESTB (SETBE cmp) (SETBE cmp)) yes no) 11960 // result: (ULE cmp yes no) 11961 for b.Controls[0].Op == Op386TESTB { 11962 v_0 := b.Controls[0] 11963 _ = v_0.Args[1] 11964 v_0_0 := v_0.Args[0] 11965 if v_0_0.Op != Op386SETBE { 11966 break 11967 } 11968 cmp := v_0_0.Args[0] 11969 v_0_1 := v_0.Args[1] 11970 if v_0_1.Op != Op386SETBE || cmp != v_0_1.Args[0] { 11971 break 11972 } 11973 b.resetWithControl(Block386ULE, cmp) 11974 return true 11975 } 11976 // match: (NE (TESTB (SETA cmp) (SETA cmp)) yes no) 11977 // result: (UGT cmp yes no) 11978 for b.Controls[0].Op == Op386TESTB { 11979 v_0 := b.Controls[0] 11980 _ = v_0.Args[1] 11981 v_0_0 := v_0.Args[0] 11982 if v_0_0.Op != Op386SETA { 11983 break 11984 } 11985 cmp := v_0_0.Args[0] 11986 v_0_1 := v_0.Args[1] 11987 if v_0_1.Op != Op386SETA || cmp != v_0_1.Args[0] { 11988 break 11989 } 11990 b.resetWithControl(Block386UGT, cmp) 11991 return true 11992 } 11993 // match: (NE (TESTB (SETAE cmp) (SETAE cmp)) yes no) 11994 // result: (UGE cmp yes no) 11995 for b.Controls[0].Op == Op386TESTB { 11996 v_0 := b.Controls[0] 11997 _ = v_0.Args[1] 11998 v_0_0 := v_0.Args[0] 11999 if v_0_0.Op != Op386SETAE { 12000 break 12001 } 12002 cmp := v_0_0.Args[0] 12003 v_0_1 := v_0.Args[1] 12004 if v_0_1.Op != Op386SETAE || cmp != v_0_1.Args[0] { 12005 break 12006 } 12007 b.resetWithControl(Block386UGE, cmp) 12008 return true 12009 } 12010 // match: (NE (TESTB (SETO cmp) (SETO cmp)) yes no) 12011 // result: (OS cmp yes no) 12012 for b.Controls[0].Op == Op386TESTB { 12013 v_0 := b.Controls[0] 12014 _ = v_0.Args[1] 12015 v_0_0 := v_0.Args[0] 12016 if v_0_0.Op != Op386SETO { 12017 break 12018 } 12019 cmp := v_0_0.Args[0] 12020 v_0_1 := v_0.Args[1] 12021 if v_0_1.Op != Op386SETO || cmp != v_0_1.Args[0] { 12022 break 12023 } 12024 b.resetWithControl(Block386OS, cmp) 12025 return true 12026 } 12027 // match: (NE (TESTB (SETGF cmp) (SETGF cmp)) yes no) 12028 // result: (UGT cmp yes no) 12029 for b.Controls[0].Op == Op386TESTB { 12030 v_0 := b.Controls[0] 12031 _ = v_0.Args[1] 12032 v_0_0 := v_0.Args[0] 12033 if v_0_0.Op != Op386SETGF { 12034 break 12035 } 12036 cmp := v_0_0.Args[0] 12037 v_0_1 := v_0.Args[1] 12038 if v_0_1.Op != Op386SETGF || cmp != v_0_1.Args[0] { 12039 break 12040 } 12041 b.resetWithControl(Block386UGT, cmp) 12042 return true 12043 } 12044 // match: (NE (TESTB (SETGEF cmp) (SETGEF cmp)) yes no) 12045 // result: (UGE cmp yes no) 12046 for b.Controls[0].Op == Op386TESTB { 12047 v_0 := b.Controls[0] 12048 _ = v_0.Args[1] 12049 v_0_0 := v_0.Args[0] 12050 if v_0_0.Op != Op386SETGEF { 12051 break 12052 } 12053 cmp := v_0_0.Args[0] 12054 v_0_1 := v_0.Args[1] 12055 if v_0_1.Op != Op386SETGEF || cmp != v_0_1.Args[0] { 12056 break 12057 } 12058 b.resetWithControl(Block386UGE, cmp) 12059 return true 12060 } 12061 // match: (NE (TESTB (SETEQF cmp) (SETEQF cmp)) yes no) 12062 // result: (EQF cmp yes no) 12063 for b.Controls[0].Op == Op386TESTB { 12064 v_0 := b.Controls[0] 12065 _ = v_0.Args[1] 12066 v_0_0 := v_0.Args[0] 12067 if v_0_0.Op != Op386SETEQF { 12068 break 12069 } 12070 cmp := v_0_0.Args[0] 12071 v_0_1 := v_0.Args[1] 12072 if v_0_1.Op != Op386SETEQF || cmp != v_0_1.Args[0] { 12073 break 12074 } 12075 b.resetWithControl(Block386EQF, cmp) 12076 return true 12077 } 12078 // match: (NE (TESTB (SETNEF cmp) (SETNEF cmp)) yes no) 12079 // result: (NEF cmp yes no) 12080 for b.Controls[0].Op == Op386TESTB { 12081 v_0 := b.Controls[0] 12082 _ = v_0.Args[1] 12083 v_0_0 := v_0.Args[0] 12084 if v_0_0.Op != Op386SETNEF { 12085 break 12086 } 12087 cmp := v_0_0.Args[0] 12088 v_0_1 := v_0.Args[1] 12089 if v_0_1.Op != Op386SETNEF || cmp != v_0_1.Args[0] { 12090 break 12091 } 12092 b.resetWithControl(Block386NEF, cmp) 12093 return true 12094 } 12095 // match: (NE (InvertFlags cmp) yes no) 12096 // result: (NE cmp yes no) 12097 for b.Controls[0].Op == Op386InvertFlags { 12098 v_0 := b.Controls[0] 12099 cmp := v_0.Args[0] 12100 b.resetWithControl(Block386NE, cmp) 12101 return true 12102 } 12103 // match: (NE (FlagEQ) yes no) 12104 // result: (First no yes) 12105 for b.Controls[0].Op == Op386FlagEQ { 12106 b.Reset(BlockFirst) 12107 b.swapSuccessors() 12108 return true 12109 } 12110 // match: (NE (FlagLT_ULT) yes no) 12111 // result: (First yes no) 12112 for b.Controls[0].Op == Op386FlagLT_ULT { 12113 b.Reset(BlockFirst) 12114 return true 12115 } 12116 // match: (NE (FlagLT_UGT) yes no) 12117 // result: (First yes no) 12118 for b.Controls[0].Op == Op386FlagLT_UGT { 12119 b.Reset(BlockFirst) 12120 return true 12121 } 12122 // match: (NE (FlagGT_ULT) yes no) 12123 // result: (First yes no) 12124 for b.Controls[0].Op == Op386FlagGT_ULT { 12125 b.Reset(BlockFirst) 12126 return true 12127 } 12128 // match: (NE (FlagGT_UGT) yes no) 12129 // result: (First yes no) 12130 for b.Controls[0].Op == Op386FlagGT_UGT { 12131 b.Reset(BlockFirst) 12132 return true 12133 } 12134 case Block386UGE: 12135 // match: (UGE (InvertFlags cmp) yes no) 12136 // result: (ULE cmp yes no) 12137 for b.Controls[0].Op == Op386InvertFlags { 12138 v_0 := b.Controls[0] 12139 cmp := v_0.Args[0] 12140 b.resetWithControl(Block386ULE, cmp) 12141 return true 12142 } 12143 // match: (UGE (FlagEQ) yes no) 12144 // result: (First yes no) 12145 for b.Controls[0].Op == Op386FlagEQ { 12146 b.Reset(BlockFirst) 12147 return true 12148 } 12149 // match: (UGE (FlagLT_ULT) yes no) 12150 // result: (First no yes) 12151 for b.Controls[0].Op == Op386FlagLT_ULT { 12152 b.Reset(BlockFirst) 12153 b.swapSuccessors() 12154 return true 12155 } 12156 // match: (UGE (FlagLT_UGT) yes no) 12157 // result: (First yes no) 12158 for b.Controls[0].Op == Op386FlagLT_UGT { 12159 b.Reset(BlockFirst) 12160 return true 12161 } 12162 // match: (UGE (FlagGT_ULT) yes no) 12163 // result: (First no yes) 12164 for b.Controls[0].Op == Op386FlagGT_ULT { 12165 b.Reset(BlockFirst) 12166 b.swapSuccessors() 12167 return true 12168 } 12169 // match: (UGE (FlagGT_UGT) yes no) 12170 // result: (First yes no) 12171 for b.Controls[0].Op == Op386FlagGT_UGT { 12172 b.Reset(BlockFirst) 12173 return true 12174 } 12175 case Block386UGT: 12176 // match: (UGT (InvertFlags cmp) yes no) 12177 // result: (ULT cmp yes no) 12178 for b.Controls[0].Op == Op386InvertFlags { 12179 v_0 := b.Controls[0] 12180 cmp := v_0.Args[0] 12181 b.resetWithControl(Block386ULT, cmp) 12182 return true 12183 } 12184 // match: (UGT (FlagEQ) yes no) 12185 // result: (First no yes) 12186 for b.Controls[0].Op == Op386FlagEQ { 12187 b.Reset(BlockFirst) 12188 b.swapSuccessors() 12189 return true 12190 } 12191 // match: (UGT (FlagLT_ULT) yes no) 12192 // result: (First no yes) 12193 for b.Controls[0].Op == Op386FlagLT_ULT { 12194 b.Reset(BlockFirst) 12195 b.swapSuccessors() 12196 return true 12197 } 12198 // match: (UGT (FlagLT_UGT) yes no) 12199 // result: (First yes no) 12200 for b.Controls[0].Op == Op386FlagLT_UGT { 12201 b.Reset(BlockFirst) 12202 return true 12203 } 12204 // match: (UGT (FlagGT_ULT) yes no) 12205 // result: (First no yes) 12206 for b.Controls[0].Op == Op386FlagGT_ULT { 12207 b.Reset(BlockFirst) 12208 b.swapSuccessors() 12209 return true 12210 } 12211 // match: (UGT (FlagGT_UGT) yes no) 12212 // result: (First yes no) 12213 for b.Controls[0].Op == Op386FlagGT_UGT { 12214 b.Reset(BlockFirst) 12215 return true 12216 } 12217 case Block386ULE: 12218 // match: (ULE (InvertFlags cmp) yes no) 12219 // result: (UGE cmp yes no) 12220 for b.Controls[0].Op == Op386InvertFlags { 12221 v_0 := b.Controls[0] 12222 cmp := v_0.Args[0] 12223 b.resetWithControl(Block386UGE, cmp) 12224 return true 12225 } 12226 // match: (ULE (FlagEQ) yes no) 12227 // result: (First yes no) 12228 for b.Controls[0].Op == Op386FlagEQ { 12229 b.Reset(BlockFirst) 12230 return true 12231 } 12232 // match: (ULE (FlagLT_ULT) yes no) 12233 // result: (First yes no) 12234 for b.Controls[0].Op == Op386FlagLT_ULT { 12235 b.Reset(BlockFirst) 12236 return true 12237 } 12238 // match: (ULE (FlagLT_UGT) yes no) 12239 // result: (First no yes) 12240 for b.Controls[0].Op == Op386FlagLT_UGT { 12241 b.Reset(BlockFirst) 12242 b.swapSuccessors() 12243 return true 12244 } 12245 // match: (ULE (FlagGT_ULT) yes no) 12246 // result: (First yes no) 12247 for b.Controls[0].Op == Op386FlagGT_ULT { 12248 b.Reset(BlockFirst) 12249 return true 12250 } 12251 // match: (ULE (FlagGT_UGT) yes no) 12252 // result: (First no yes) 12253 for b.Controls[0].Op == Op386FlagGT_UGT { 12254 b.Reset(BlockFirst) 12255 b.swapSuccessors() 12256 return true 12257 } 12258 case Block386ULT: 12259 // match: (ULT (InvertFlags cmp) yes no) 12260 // result: (UGT cmp yes no) 12261 for b.Controls[0].Op == Op386InvertFlags { 12262 v_0 := b.Controls[0] 12263 cmp := v_0.Args[0] 12264 b.resetWithControl(Block386UGT, cmp) 12265 return true 12266 } 12267 // match: (ULT (FlagEQ) yes no) 12268 // result: (First no yes) 12269 for b.Controls[0].Op == Op386FlagEQ { 12270 b.Reset(BlockFirst) 12271 b.swapSuccessors() 12272 return true 12273 } 12274 // match: (ULT (FlagLT_ULT) yes no) 12275 // result: (First yes no) 12276 for b.Controls[0].Op == Op386FlagLT_ULT { 12277 b.Reset(BlockFirst) 12278 return true 12279 } 12280 // match: (ULT (FlagLT_UGT) yes no) 12281 // result: (First no yes) 12282 for b.Controls[0].Op == Op386FlagLT_UGT { 12283 b.Reset(BlockFirst) 12284 b.swapSuccessors() 12285 return true 12286 } 12287 // match: (ULT (FlagGT_ULT) yes no) 12288 // result: (First yes no) 12289 for b.Controls[0].Op == Op386FlagGT_ULT { 12290 b.Reset(BlockFirst) 12291 return true 12292 } 12293 // match: (ULT (FlagGT_UGT) yes no) 12294 // result: (First no yes) 12295 for b.Controls[0].Op == Op386FlagGT_UGT { 12296 b.Reset(BlockFirst) 12297 b.swapSuccessors() 12298 return true 12299 } 12300 } 12301 return false 12302 }