github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/compile/ssa/rewritePPC64.go (about) 1 // Code generated from _gen/PPC64.rules using 'go generate'; DO NOT EDIT. 2 3 package ssa 4 5 import ( 6 "math" 7 8 "github.com/go-asm/go/buildcfg" 9 "github.com/go-asm/go/cmd/compile/types" 10 ) 11 12 func rewriteValuePPC64(v *Value) bool { 13 switch v.Op { 14 case OpAbs: 15 v.Op = OpPPC64FABS 16 return true 17 case OpAdd16: 18 v.Op = OpPPC64ADD 19 return true 20 case OpAdd32: 21 v.Op = OpPPC64ADD 22 return true 23 case OpAdd32F: 24 v.Op = OpPPC64FADDS 25 return true 26 case OpAdd64: 27 v.Op = OpPPC64ADD 28 return true 29 case OpAdd64F: 30 v.Op = OpPPC64FADD 31 return true 32 case OpAdd8: 33 v.Op = OpPPC64ADD 34 return true 35 case OpAddPtr: 36 v.Op = OpPPC64ADD 37 return true 38 case OpAddr: 39 return rewriteValuePPC64_OpAddr(v) 40 case OpAnd16: 41 v.Op = OpPPC64AND 42 return true 43 case OpAnd32: 44 v.Op = OpPPC64AND 45 return true 46 case OpAnd64: 47 v.Op = OpPPC64AND 48 return true 49 case OpAnd8: 50 v.Op = OpPPC64AND 51 return true 52 case OpAndB: 53 v.Op = OpPPC64AND 54 return true 55 case OpAtomicAdd32: 56 v.Op = OpPPC64LoweredAtomicAdd32 57 return true 58 case OpAtomicAdd64: 59 v.Op = OpPPC64LoweredAtomicAdd64 60 return true 61 case OpAtomicAnd32: 62 v.Op = OpPPC64LoweredAtomicAnd32 63 return true 64 case OpAtomicAnd8: 65 v.Op = OpPPC64LoweredAtomicAnd8 66 return true 67 case OpAtomicCompareAndSwap32: 68 return rewriteValuePPC64_OpAtomicCompareAndSwap32(v) 69 case OpAtomicCompareAndSwap64: 70 return rewriteValuePPC64_OpAtomicCompareAndSwap64(v) 71 case OpAtomicCompareAndSwapRel32: 72 return rewriteValuePPC64_OpAtomicCompareAndSwapRel32(v) 73 case OpAtomicExchange32: 74 v.Op = OpPPC64LoweredAtomicExchange32 75 return true 76 case OpAtomicExchange64: 77 v.Op = OpPPC64LoweredAtomicExchange64 78 return true 79 case OpAtomicLoad32: 80 return rewriteValuePPC64_OpAtomicLoad32(v) 81 case OpAtomicLoad64: 82 return rewriteValuePPC64_OpAtomicLoad64(v) 83 case OpAtomicLoad8: 84 return rewriteValuePPC64_OpAtomicLoad8(v) 85 case OpAtomicLoadAcq32: 86 return rewriteValuePPC64_OpAtomicLoadAcq32(v) 87 case OpAtomicLoadAcq64: 88 return rewriteValuePPC64_OpAtomicLoadAcq64(v) 89 case OpAtomicLoadPtr: 90 return rewriteValuePPC64_OpAtomicLoadPtr(v) 91 case OpAtomicOr32: 92 v.Op = OpPPC64LoweredAtomicOr32 93 return true 94 case OpAtomicOr8: 95 v.Op = OpPPC64LoweredAtomicOr8 96 return true 97 case OpAtomicStore32: 98 return rewriteValuePPC64_OpAtomicStore32(v) 99 case OpAtomicStore64: 100 return rewriteValuePPC64_OpAtomicStore64(v) 101 case OpAtomicStore8: 102 return rewriteValuePPC64_OpAtomicStore8(v) 103 case OpAtomicStoreRel32: 104 return rewriteValuePPC64_OpAtomicStoreRel32(v) 105 case OpAtomicStoreRel64: 106 return rewriteValuePPC64_OpAtomicStoreRel64(v) 107 case OpAvg64u: 108 return rewriteValuePPC64_OpAvg64u(v) 109 case OpBitLen32: 110 return rewriteValuePPC64_OpBitLen32(v) 111 case OpBitLen64: 112 return rewriteValuePPC64_OpBitLen64(v) 113 case OpBswap16: 114 return rewriteValuePPC64_OpBswap16(v) 115 case OpBswap32: 116 return rewriteValuePPC64_OpBswap32(v) 117 case OpBswap64: 118 return rewriteValuePPC64_OpBswap64(v) 119 case OpCeil: 120 v.Op = OpPPC64FCEIL 121 return true 122 case OpClosureCall: 123 v.Op = OpPPC64CALLclosure 124 return true 125 case OpCom16: 126 return rewriteValuePPC64_OpCom16(v) 127 case OpCom32: 128 return rewriteValuePPC64_OpCom32(v) 129 case OpCom64: 130 return rewriteValuePPC64_OpCom64(v) 131 case OpCom8: 132 return rewriteValuePPC64_OpCom8(v) 133 case OpCondSelect: 134 return rewriteValuePPC64_OpCondSelect(v) 135 case OpConst16: 136 return rewriteValuePPC64_OpConst16(v) 137 case OpConst32: 138 return rewriteValuePPC64_OpConst32(v) 139 case OpConst32F: 140 v.Op = OpPPC64FMOVSconst 141 return true 142 case OpConst64: 143 return rewriteValuePPC64_OpConst64(v) 144 case OpConst64F: 145 v.Op = OpPPC64FMOVDconst 146 return true 147 case OpConst8: 148 return rewriteValuePPC64_OpConst8(v) 149 case OpConstBool: 150 return rewriteValuePPC64_OpConstBool(v) 151 case OpConstNil: 152 return rewriteValuePPC64_OpConstNil(v) 153 case OpCopysign: 154 return rewriteValuePPC64_OpCopysign(v) 155 case OpCtz16: 156 return rewriteValuePPC64_OpCtz16(v) 157 case OpCtz32: 158 return rewriteValuePPC64_OpCtz32(v) 159 case OpCtz32NonZero: 160 v.Op = OpCtz32 161 return true 162 case OpCtz64: 163 return rewriteValuePPC64_OpCtz64(v) 164 case OpCtz64NonZero: 165 v.Op = OpCtz64 166 return true 167 case OpCtz8: 168 return rewriteValuePPC64_OpCtz8(v) 169 case OpCvt32Fto32: 170 return rewriteValuePPC64_OpCvt32Fto32(v) 171 case OpCvt32Fto64: 172 return rewriteValuePPC64_OpCvt32Fto64(v) 173 case OpCvt32Fto64F: 174 v.Op = OpCopy 175 return true 176 case OpCvt32to32F: 177 return rewriteValuePPC64_OpCvt32to32F(v) 178 case OpCvt32to64F: 179 return rewriteValuePPC64_OpCvt32to64F(v) 180 case OpCvt64Fto32: 181 return rewriteValuePPC64_OpCvt64Fto32(v) 182 case OpCvt64Fto32F: 183 v.Op = OpPPC64FRSP 184 return true 185 case OpCvt64Fto64: 186 return rewriteValuePPC64_OpCvt64Fto64(v) 187 case OpCvt64to32F: 188 return rewriteValuePPC64_OpCvt64to32F(v) 189 case OpCvt64to64F: 190 return rewriteValuePPC64_OpCvt64to64F(v) 191 case OpCvtBoolToUint8: 192 v.Op = OpCopy 193 return true 194 case OpDiv16: 195 return rewriteValuePPC64_OpDiv16(v) 196 case OpDiv16u: 197 return rewriteValuePPC64_OpDiv16u(v) 198 case OpDiv32: 199 return rewriteValuePPC64_OpDiv32(v) 200 case OpDiv32F: 201 v.Op = OpPPC64FDIVS 202 return true 203 case OpDiv32u: 204 v.Op = OpPPC64DIVWU 205 return true 206 case OpDiv64: 207 return rewriteValuePPC64_OpDiv64(v) 208 case OpDiv64F: 209 v.Op = OpPPC64FDIV 210 return true 211 case OpDiv64u: 212 v.Op = OpPPC64DIVDU 213 return true 214 case OpDiv8: 215 return rewriteValuePPC64_OpDiv8(v) 216 case OpDiv8u: 217 return rewriteValuePPC64_OpDiv8u(v) 218 case OpEq16: 219 return rewriteValuePPC64_OpEq16(v) 220 case OpEq32: 221 return rewriteValuePPC64_OpEq32(v) 222 case OpEq32F: 223 return rewriteValuePPC64_OpEq32F(v) 224 case OpEq64: 225 return rewriteValuePPC64_OpEq64(v) 226 case OpEq64F: 227 return rewriteValuePPC64_OpEq64F(v) 228 case OpEq8: 229 return rewriteValuePPC64_OpEq8(v) 230 case OpEqB: 231 return rewriteValuePPC64_OpEqB(v) 232 case OpEqPtr: 233 return rewriteValuePPC64_OpEqPtr(v) 234 case OpFMA: 235 v.Op = OpPPC64FMADD 236 return true 237 case OpFloor: 238 v.Op = OpPPC64FFLOOR 239 return true 240 case OpGetCallerPC: 241 v.Op = OpPPC64LoweredGetCallerPC 242 return true 243 case OpGetCallerSP: 244 v.Op = OpPPC64LoweredGetCallerSP 245 return true 246 case OpGetClosurePtr: 247 v.Op = OpPPC64LoweredGetClosurePtr 248 return true 249 case OpHmul32: 250 v.Op = OpPPC64MULHW 251 return true 252 case OpHmul32u: 253 v.Op = OpPPC64MULHWU 254 return true 255 case OpHmul64: 256 v.Op = OpPPC64MULHD 257 return true 258 case OpHmul64u: 259 v.Op = OpPPC64MULHDU 260 return true 261 case OpInterCall: 262 v.Op = OpPPC64CALLinter 263 return true 264 case OpIsInBounds: 265 return rewriteValuePPC64_OpIsInBounds(v) 266 case OpIsNonNil: 267 return rewriteValuePPC64_OpIsNonNil(v) 268 case OpIsSliceInBounds: 269 return rewriteValuePPC64_OpIsSliceInBounds(v) 270 case OpLeq16: 271 return rewriteValuePPC64_OpLeq16(v) 272 case OpLeq16U: 273 return rewriteValuePPC64_OpLeq16U(v) 274 case OpLeq32: 275 return rewriteValuePPC64_OpLeq32(v) 276 case OpLeq32F: 277 return rewriteValuePPC64_OpLeq32F(v) 278 case OpLeq32U: 279 return rewriteValuePPC64_OpLeq32U(v) 280 case OpLeq64: 281 return rewriteValuePPC64_OpLeq64(v) 282 case OpLeq64F: 283 return rewriteValuePPC64_OpLeq64F(v) 284 case OpLeq64U: 285 return rewriteValuePPC64_OpLeq64U(v) 286 case OpLeq8: 287 return rewriteValuePPC64_OpLeq8(v) 288 case OpLeq8U: 289 return rewriteValuePPC64_OpLeq8U(v) 290 case OpLess16: 291 return rewriteValuePPC64_OpLess16(v) 292 case OpLess16U: 293 return rewriteValuePPC64_OpLess16U(v) 294 case OpLess32: 295 return rewriteValuePPC64_OpLess32(v) 296 case OpLess32F: 297 return rewriteValuePPC64_OpLess32F(v) 298 case OpLess32U: 299 return rewriteValuePPC64_OpLess32U(v) 300 case OpLess64: 301 return rewriteValuePPC64_OpLess64(v) 302 case OpLess64F: 303 return rewriteValuePPC64_OpLess64F(v) 304 case OpLess64U: 305 return rewriteValuePPC64_OpLess64U(v) 306 case OpLess8: 307 return rewriteValuePPC64_OpLess8(v) 308 case OpLess8U: 309 return rewriteValuePPC64_OpLess8U(v) 310 case OpLoad: 311 return rewriteValuePPC64_OpLoad(v) 312 case OpLocalAddr: 313 return rewriteValuePPC64_OpLocalAddr(v) 314 case OpLsh16x16: 315 return rewriteValuePPC64_OpLsh16x16(v) 316 case OpLsh16x32: 317 return rewriteValuePPC64_OpLsh16x32(v) 318 case OpLsh16x64: 319 return rewriteValuePPC64_OpLsh16x64(v) 320 case OpLsh16x8: 321 return rewriteValuePPC64_OpLsh16x8(v) 322 case OpLsh32x16: 323 return rewriteValuePPC64_OpLsh32x16(v) 324 case OpLsh32x32: 325 return rewriteValuePPC64_OpLsh32x32(v) 326 case OpLsh32x64: 327 return rewriteValuePPC64_OpLsh32x64(v) 328 case OpLsh32x8: 329 return rewriteValuePPC64_OpLsh32x8(v) 330 case OpLsh64x16: 331 return rewriteValuePPC64_OpLsh64x16(v) 332 case OpLsh64x32: 333 return rewriteValuePPC64_OpLsh64x32(v) 334 case OpLsh64x64: 335 return rewriteValuePPC64_OpLsh64x64(v) 336 case OpLsh64x8: 337 return rewriteValuePPC64_OpLsh64x8(v) 338 case OpLsh8x16: 339 return rewriteValuePPC64_OpLsh8x16(v) 340 case OpLsh8x32: 341 return rewriteValuePPC64_OpLsh8x32(v) 342 case OpLsh8x64: 343 return rewriteValuePPC64_OpLsh8x64(v) 344 case OpLsh8x8: 345 return rewriteValuePPC64_OpLsh8x8(v) 346 case OpMod16: 347 return rewriteValuePPC64_OpMod16(v) 348 case OpMod16u: 349 return rewriteValuePPC64_OpMod16u(v) 350 case OpMod32: 351 return rewriteValuePPC64_OpMod32(v) 352 case OpMod32u: 353 return rewriteValuePPC64_OpMod32u(v) 354 case OpMod64: 355 return rewriteValuePPC64_OpMod64(v) 356 case OpMod64u: 357 return rewriteValuePPC64_OpMod64u(v) 358 case OpMod8: 359 return rewriteValuePPC64_OpMod8(v) 360 case OpMod8u: 361 return rewriteValuePPC64_OpMod8u(v) 362 case OpMove: 363 return rewriteValuePPC64_OpMove(v) 364 case OpMul16: 365 v.Op = OpPPC64MULLW 366 return true 367 case OpMul32: 368 v.Op = OpPPC64MULLW 369 return true 370 case OpMul32F: 371 v.Op = OpPPC64FMULS 372 return true 373 case OpMul64: 374 v.Op = OpPPC64MULLD 375 return true 376 case OpMul64F: 377 v.Op = OpPPC64FMUL 378 return true 379 case OpMul8: 380 v.Op = OpPPC64MULLW 381 return true 382 case OpNeg16: 383 v.Op = OpPPC64NEG 384 return true 385 case OpNeg32: 386 v.Op = OpPPC64NEG 387 return true 388 case OpNeg32F: 389 v.Op = OpPPC64FNEG 390 return true 391 case OpNeg64: 392 v.Op = OpPPC64NEG 393 return true 394 case OpNeg64F: 395 v.Op = OpPPC64FNEG 396 return true 397 case OpNeg8: 398 v.Op = OpPPC64NEG 399 return true 400 case OpNeq16: 401 return rewriteValuePPC64_OpNeq16(v) 402 case OpNeq32: 403 return rewriteValuePPC64_OpNeq32(v) 404 case OpNeq32F: 405 return rewriteValuePPC64_OpNeq32F(v) 406 case OpNeq64: 407 return rewriteValuePPC64_OpNeq64(v) 408 case OpNeq64F: 409 return rewriteValuePPC64_OpNeq64F(v) 410 case OpNeq8: 411 return rewriteValuePPC64_OpNeq8(v) 412 case OpNeqB: 413 v.Op = OpPPC64XOR 414 return true 415 case OpNeqPtr: 416 return rewriteValuePPC64_OpNeqPtr(v) 417 case OpNilCheck: 418 v.Op = OpPPC64LoweredNilCheck 419 return true 420 case OpNot: 421 return rewriteValuePPC64_OpNot(v) 422 case OpOffPtr: 423 return rewriteValuePPC64_OpOffPtr(v) 424 case OpOr16: 425 v.Op = OpPPC64OR 426 return true 427 case OpOr32: 428 v.Op = OpPPC64OR 429 return true 430 case OpOr64: 431 v.Op = OpPPC64OR 432 return true 433 case OpOr8: 434 v.Op = OpPPC64OR 435 return true 436 case OpOrB: 437 v.Op = OpPPC64OR 438 return true 439 case OpPPC64ADD: 440 return rewriteValuePPC64_OpPPC64ADD(v) 441 case OpPPC64ADDE: 442 return rewriteValuePPC64_OpPPC64ADDE(v) 443 case OpPPC64ADDconst: 444 return rewriteValuePPC64_OpPPC64ADDconst(v) 445 case OpPPC64AND: 446 return rewriteValuePPC64_OpPPC64AND(v) 447 case OpPPC64ANDCCconst: 448 return rewriteValuePPC64_OpPPC64ANDCCconst(v) 449 case OpPPC64ANDN: 450 return rewriteValuePPC64_OpPPC64ANDN(v) 451 case OpPPC64BRD: 452 return rewriteValuePPC64_OpPPC64BRD(v) 453 case OpPPC64BRH: 454 return rewriteValuePPC64_OpPPC64BRH(v) 455 case OpPPC64BRW: 456 return rewriteValuePPC64_OpPPC64BRW(v) 457 case OpPPC64CLRLSLDI: 458 return rewriteValuePPC64_OpPPC64CLRLSLDI(v) 459 case OpPPC64CMP: 460 return rewriteValuePPC64_OpPPC64CMP(v) 461 case OpPPC64CMPU: 462 return rewriteValuePPC64_OpPPC64CMPU(v) 463 case OpPPC64CMPUconst: 464 return rewriteValuePPC64_OpPPC64CMPUconst(v) 465 case OpPPC64CMPW: 466 return rewriteValuePPC64_OpPPC64CMPW(v) 467 case OpPPC64CMPWU: 468 return rewriteValuePPC64_OpPPC64CMPWU(v) 469 case OpPPC64CMPWUconst: 470 return rewriteValuePPC64_OpPPC64CMPWUconst(v) 471 case OpPPC64CMPWconst: 472 return rewriteValuePPC64_OpPPC64CMPWconst(v) 473 case OpPPC64CMPconst: 474 return rewriteValuePPC64_OpPPC64CMPconst(v) 475 case OpPPC64Equal: 476 return rewriteValuePPC64_OpPPC64Equal(v) 477 case OpPPC64FABS: 478 return rewriteValuePPC64_OpPPC64FABS(v) 479 case OpPPC64FADD: 480 return rewriteValuePPC64_OpPPC64FADD(v) 481 case OpPPC64FADDS: 482 return rewriteValuePPC64_OpPPC64FADDS(v) 483 case OpPPC64FCEIL: 484 return rewriteValuePPC64_OpPPC64FCEIL(v) 485 case OpPPC64FFLOOR: 486 return rewriteValuePPC64_OpPPC64FFLOOR(v) 487 case OpPPC64FGreaterEqual: 488 return rewriteValuePPC64_OpPPC64FGreaterEqual(v) 489 case OpPPC64FGreaterThan: 490 return rewriteValuePPC64_OpPPC64FGreaterThan(v) 491 case OpPPC64FLessEqual: 492 return rewriteValuePPC64_OpPPC64FLessEqual(v) 493 case OpPPC64FLessThan: 494 return rewriteValuePPC64_OpPPC64FLessThan(v) 495 case OpPPC64FMOVDload: 496 return rewriteValuePPC64_OpPPC64FMOVDload(v) 497 case OpPPC64FMOVDstore: 498 return rewriteValuePPC64_OpPPC64FMOVDstore(v) 499 case OpPPC64FMOVSload: 500 return rewriteValuePPC64_OpPPC64FMOVSload(v) 501 case OpPPC64FMOVSstore: 502 return rewriteValuePPC64_OpPPC64FMOVSstore(v) 503 case OpPPC64FNEG: 504 return rewriteValuePPC64_OpPPC64FNEG(v) 505 case OpPPC64FSQRT: 506 return rewriteValuePPC64_OpPPC64FSQRT(v) 507 case OpPPC64FSUB: 508 return rewriteValuePPC64_OpPPC64FSUB(v) 509 case OpPPC64FSUBS: 510 return rewriteValuePPC64_OpPPC64FSUBS(v) 511 case OpPPC64FTRUNC: 512 return rewriteValuePPC64_OpPPC64FTRUNC(v) 513 case OpPPC64GreaterEqual: 514 return rewriteValuePPC64_OpPPC64GreaterEqual(v) 515 case OpPPC64GreaterThan: 516 return rewriteValuePPC64_OpPPC64GreaterThan(v) 517 case OpPPC64ISEL: 518 return rewriteValuePPC64_OpPPC64ISEL(v) 519 case OpPPC64LessEqual: 520 return rewriteValuePPC64_OpPPC64LessEqual(v) 521 case OpPPC64LessThan: 522 return rewriteValuePPC64_OpPPC64LessThan(v) 523 case OpPPC64MFVSRD: 524 return rewriteValuePPC64_OpPPC64MFVSRD(v) 525 case OpPPC64MOVBZload: 526 return rewriteValuePPC64_OpPPC64MOVBZload(v) 527 case OpPPC64MOVBZloadidx: 528 return rewriteValuePPC64_OpPPC64MOVBZloadidx(v) 529 case OpPPC64MOVBZreg: 530 return rewriteValuePPC64_OpPPC64MOVBZreg(v) 531 case OpPPC64MOVBreg: 532 return rewriteValuePPC64_OpPPC64MOVBreg(v) 533 case OpPPC64MOVBstore: 534 return rewriteValuePPC64_OpPPC64MOVBstore(v) 535 case OpPPC64MOVBstoreidx: 536 return rewriteValuePPC64_OpPPC64MOVBstoreidx(v) 537 case OpPPC64MOVBstorezero: 538 return rewriteValuePPC64_OpPPC64MOVBstorezero(v) 539 case OpPPC64MOVDaddr: 540 return rewriteValuePPC64_OpPPC64MOVDaddr(v) 541 case OpPPC64MOVDload: 542 return rewriteValuePPC64_OpPPC64MOVDload(v) 543 case OpPPC64MOVDloadidx: 544 return rewriteValuePPC64_OpPPC64MOVDloadidx(v) 545 case OpPPC64MOVDstore: 546 return rewriteValuePPC64_OpPPC64MOVDstore(v) 547 case OpPPC64MOVDstoreidx: 548 return rewriteValuePPC64_OpPPC64MOVDstoreidx(v) 549 case OpPPC64MOVDstorezero: 550 return rewriteValuePPC64_OpPPC64MOVDstorezero(v) 551 case OpPPC64MOVHBRstore: 552 return rewriteValuePPC64_OpPPC64MOVHBRstore(v) 553 case OpPPC64MOVHZload: 554 return rewriteValuePPC64_OpPPC64MOVHZload(v) 555 case OpPPC64MOVHZloadidx: 556 return rewriteValuePPC64_OpPPC64MOVHZloadidx(v) 557 case OpPPC64MOVHZreg: 558 return rewriteValuePPC64_OpPPC64MOVHZreg(v) 559 case OpPPC64MOVHload: 560 return rewriteValuePPC64_OpPPC64MOVHload(v) 561 case OpPPC64MOVHloadidx: 562 return rewriteValuePPC64_OpPPC64MOVHloadidx(v) 563 case OpPPC64MOVHreg: 564 return rewriteValuePPC64_OpPPC64MOVHreg(v) 565 case OpPPC64MOVHstore: 566 return rewriteValuePPC64_OpPPC64MOVHstore(v) 567 case OpPPC64MOVHstoreidx: 568 return rewriteValuePPC64_OpPPC64MOVHstoreidx(v) 569 case OpPPC64MOVHstorezero: 570 return rewriteValuePPC64_OpPPC64MOVHstorezero(v) 571 case OpPPC64MOVWBRstore: 572 return rewriteValuePPC64_OpPPC64MOVWBRstore(v) 573 case OpPPC64MOVWZload: 574 return rewriteValuePPC64_OpPPC64MOVWZload(v) 575 case OpPPC64MOVWZloadidx: 576 return rewriteValuePPC64_OpPPC64MOVWZloadidx(v) 577 case OpPPC64MOVWZreg: 578 return rewriteValuePPC64_OpPPC64MOVWZreg(v) 579 case OpPPC64MOVWload: 580 return rewriteValuePPC64_OpPPC64MOVWload(v) 581 case OpPPC64MOVWloadidx: 582 return rewriteValuePPC64_OpPPC64MOVWloadidx(v) 583 case OpPPC64MOVWreg: 584 return rewriteValuePPC64_OpPPC64MOVWreg(v) 585 case OpPPC64MOVWstore: 586 return rewriteValuePPC64_OpPPC64MOVWstore(v) 587 case OpPPC64MOVWstoreidx: 588 return rewriteValuePPC64_OpPPC64MOVWstoreidx(v) 589 case OpPPC64MOVWstorezero: 590 return rewriteValuePPC64_OpPPC64MOVWstorezero(v) 591 case OpPPC64MTVSRD: 592 return rewriteValuePPC64_OpPPC64MTVSRD(v) 593 case OpPPC64MULLD: 594 return rewriteValuePPC64_OpPPC64MULLD(v) 595 case OpPPC64MULLW: 596 return rewriteValuePPC64_OpPPC64MULLW(v) 597 case OpPPC64NEG: 598 return rewriteValuePPC64_OpPPC64NEG(v) 599 case OpPPC64NOR: 600 return rewriteValuePPC64_OpPPC64NOR(v) 601 case OpPPC64NotEqual: 602 return rewriteValuePPC64_OpPPC64NotEqual(v) 603 case OpPPC64OR: 604 return rewriteValuePPC64_OpPPC64OR(v) 605 case OpPPC64ORN: 606 return rewriteValuePPC64_OpPPC64ORN(v) 607 case OpPPC64ORconst: 608 return rewriteValuePPC64_OpPPC64ORconst(v) 609 case OpPPC64ROTL: 610 return rewriteValuePPC64_OpPPC64ROTL(v) 611 case OpPPC64ROTLW: 612 return rewriteValuePPC64_OpPPC64ROTLW(v) 613 case OpPPC64ROTLWconst: 614 return rewriteValuePPC64_OpPPC64ROTLWconst(v) 615 case OpPPC64SETBC: 616 return rewriteValuePPC64_OpPPC64SETBC(v) 617 case OpPPC64SETBCR: 618 return rewriteValuePPC64_OpPPC64SETBCR(v) 619 case OpPPC64SLD: 620 return rewriteValuePPC64_OpPPC64SLD(v) 621 case OpPPC64SLDconst: 622 return rewriteValuePPC64_OpPPC64SLDconst(v) 623 case OpPPC64SLW: 624 return rewriteValuePPC64_OpPPC64SLW(v) 625 case OpPPC64SLWconst: 626 return rewriteValuePPC64_OpPPC64SLWconst(v) 627 case OpPPC64SRAD: 628 return rewriteValuePPC64_OpPPC64SRAD(v) 629 case OpPPC64SRAW: 630 return rewriteValuePPC64_OpPPC64SRAW(v) 631 case OpPPC64SRD: 632 return rewriteValuePPC64_OpPPC64SRD(v) 633 case OpPPC64SRW: 634 return rewriteValuePPC64_OpPPC64SRW(v) 635 case OpPPC64SRWconst: 636 return rewriteValuePPC64_OpPPC64SRWconst(v) 637 case OpPPC64SUB: 638 return rewriteValuePPC64_OpPPC64SUB(v) 639 case OpPPC64SUBE: 640 return rewriteValuePPC64_OpPPC64SUBE(v) 641 case OpPPC64SUBFCconst: 642 return rewriteValuePPC64_OpPPC64SUBFCconst(v) 643 case OpPPC64XOR: 644 return rewriteValuePPC64_OpPPC64XOR(v) 645 case OpPPC64XORconst: 646 return rewriteValuePPC64_OpPPC64XORconst(v) 647 case OpPanicBounds: 648 return rewriteValuePPC64_OpPanicBounds(v) 649 case OpPopCount16: 650 return rewriteValuePPC64_OpPopCount16(v) 651 case OpPopCount32: 652 return rewriteValuePPC64_OpPopCount32(v) 653 case OpPopCount64: 654 v.Op = OpPPC64POPCNTD 655 return true 656 case OpPopCount8: 657 return rewriteValuePPC64_OpPopCount8(v) 658 case OpPrefetchCache: 659 return rewriteValuePPC64_OpPrefetchCache(v) 660 case OpPrefetchCacheStreamed: 661 return rewriteValuePPC64_OpPrefetchCacheStreamed(v) 662 case OpPubBarrier: 663 v.Op = OpPPC64LoweredPubBarrier 664 return true 665 case OpRotateLeft16: 666 return rewriteValuePPC64_OpRotateLeft16(v) 667 case OpRotateLeft32: 668 v.Op = OpPPC64ROTLW 669 return true 670 case OpRotateLeft64: 671 v.Op = OpPPC64ROTL 672 return true 673 case OpRotateLeft8: 674 return rewriteValuePPC64_OpRotateLeft8(v) 675 case OpRound: 676 v.Op = OpPPC64FROUND 677 return true 678 case OpRound32F: 679 v.Op = OpPPC64LoweredRound32F 680 return true 681 case OpRound64F: 682 v.Op = OpPPC64LoweredRound64F 683 return true 684 case OpRsh16Ux16: 685 return rewriteValuePPC64_OpRsh16Ux16(v) 686 case OpRsh16Ux32: 687 return rewriteValuePPC64_OpRsh16Ux32(v) 688 case OpRsh16Ux64: 689 return rewriteValuePPC64_OpRsh16Ux64(v) 690 case OpRsh16Ux8: 691 return rewriteValuePPC64_OpRsh16Ux8(v) 692 case OpRsh16x16: 693 return rewriteValuePPC64_OpRsh16x16(v) 694 case OpRsh16x32: 695 return rewriteValuePPC64_OpRsh16x32(v) 696 case OpRsh16x64: 697 return rewriteValuePPC64_OpRsh16x64(v) 698 case OpRsh16x8: 699 return rewriteValuePPC64_OpRsh16x8(v) 700 case OpRsh32Ux16: 701 return rewriteValuePPC64_OpRsh32Ux16(v) 702 case OpRsh32Ux32: 703 return rewriteValuePPC64_OpRsh32Ux32(v) 704 case OpRsh32Ux64: 705 return rewriteValuePPC64_OpRsh32Ux64(v) 706 case OpRsh32Ux8: 707 return rewriteValuePPC64_OpRsh32Ux8(v) 708 case OpRsh32x16: 709 return rewriteValuePPC64_OpRsh32x16(v) 710 case OpRsh32x32: 711 return rewriteValuePPC64_OpRsh32x32(v) 712 case OpRsh32x64: 713 return rewriteValuePPC64_OpRsh32x64(v) 714 case OpRsh32x8: 715 return rewriteValuePPC64_OpRsh32x8(v) 716 case OpRsh64Ux16: 717 return rewriteValuePPC64_OpRsh64Ux16(v) 718 case OpRsh64Ux32: 719 return rewriteValuePPC64_OpRsh64Ux32(v) 720 case OpRsh64Ux64: 721 return rewriteValuePPC64_OpRsh64Ux64(v) 722 case OpRsh64Ux8: 723 return rewriteValuePPC64_OpRsh64Ux8(v) 724 case OpRsh64x16: 725 return rewriteValuePPC64_OpRsh64x16(v) 726 case OpRsh64x32: 727 return rewriteValuePPC64_OpRsh64x32(v) 728 case OpRsh64x64: 729 return rewriteValuePPC64_OpRsh64x64(v) 730 case OpRsh64x8: 731 return rewriteValuePPC64_OpRsh64x8(v) 732 case OpRsh8Ux16: 733 return rewriteValuePPC64_OpRsh8Ux16(v) 734 case OpRsh8Ux32: 735 return rewriteValuePPC64_OpRsh8Ux32(v) 736 case OpRsh8Ux64: 737 return rewriteValuePPC64_OpRsh8Ux64(v) 738 case OpRsh8Ux8: 739 return rewriteValuePPC64_OpRsh8Ux8(v) 740 case OpRsh8x16: 741 return rewriteValuePPC64_OpRsh8x16(v) 742 case OpRsh8x32: 743 return rewriteValuePPC64_OpRsh8x32(v) 744 case OpRsh8x64: 745 return rewriteValuePPC64_OpRsh8x64(v) 746 case OpRsh8x8: 747 return rewriteValuePPC64_OpRsh8x8(v) 748 case OpSelect0: 749 return rewriteValuePPC64_OpSelect0(v) 750 case OpSelect1: 751 return rewriteValuePPC64_OpSelect1(v) 752 case OpSelectN: 753 return rewriteValuePPC64_OpSelectN(v) 754 case OpSignExt16to32: 755 v.Op = OpPPC64MOVHreg 756 return true 757 case OpSignExt16to64: 758 v.Op = OpPPC64MOVHreg 759 return true 760 case OpSignExt32to64: 761 v.Op = OpPPC64MOVWreg 762 return true 763 case OpSignExt8to16: 764 v.Op = OpPPC64MOVBreg 765 return true 766 case OpSignExt8to32: 767 v.Op = OpPPC64MOVBreg 768 return true 769 case OpSignExt8to64: 770 v.Op = OpPPC64MOVBreg 771 return true 772 case OpSlicemask: 773 return rewriteValuePPC64_OpSlicemask(v) 774 case OpSqrt: 775 v.Op = OpPPC64FSQRT 776 return true 777 case OpSqrt32: 778 v.Op = OpPPC64FSQRTS 779 return true 780 case OpStaticCall: 781 v.Op = OpPPC64CALLstatic 782 return true 783 case OpStore: 784 return rewriteValuePPC64_OpStore(v) 785 case OpSub16: 786 v.Op = OpPPC64SUB 787 return true 788 case OpSub32: 789 v.Op = OpPPC64SUB 790 return true 791 case OpSub32F: 792 v.Op = OpPPC64FSUBS 793 return true 794 case OpSub64: 795 v.Op = OpPPC64SUB 796 return true 797 case OpSub64F: 798 v.Op = OpPPC64FSUB 799 return true 800 case OpSub8: 801 v.Op = OpPPC64SUB 802 return true 803 case OpSubPtr: 804 v.Op = OpPPC64SUB 805 return true 806 case OpTailCall: 807 v.Op = OpPPC64CALLtail 808 return true 809 case OpTrunc: 810 v.Op = OpPPC64FTRUNC 811 return true 812 case OpTrunc16to8: 813 return rewriteValuePPC64_OpTrunc16to8(v) 814 case OpTrunc32to16: 815 return rewriteValuePPC64_OpTrunc32to16(v) 816 case OpTrunc32to8: 817 return rewriteValuePPC64_OpTrunc32to8(v) 818 case OpTrunc64to16: 819 return rewriteValuePPC64_OpTrunc64to16(v) 820 case OpTrunc64to32: 821 return rewriteValuePPC64_OpTrunc64to32(v) 822 case OpTrunc64to8: 823 return rewriteValuePPC64_OpTrunc64to8(v) 824 case OpWB: 825 v.Op = OpPPC64LoweredWB 826 return true 827 case OpXor16: 828 v.Op = OpPPC64XOR 829 return true 830 case OpXor32: 831 v.Op = OpPPC64XOR 832 return true 833 case OpXor64: 834 v.Op = OpPPC64XOR 835 return true 836 case OpXor8: 837 v.Op = OpPPC64XOR 838 return true 839 case OpZero: 840 return rewriteValuePPC64_OpZero(v) 841 case OpZeroExt16to32: 842 v.Op = OpPPC64MOVHZreg 843 return true 844 case OpZeroExt16to64: 845 v.Op = OpPPC64MOVHZreg 846 return true 847 case OpZeroExt32to64: 848 v.Op = OpPPC64MOVWZreg 849 return true 850 case OpZeroExt8to16: 851 v.Op = OpPPC64MOVBZreg 852 return true 853 case OpZeroExt8to32: 854 v.Op = OpPPC64MOVBZreg 855 return true 856 case OpZeroExt8to64: 857 v.Op = OpPPC64MOVBZreg 858 return true 859 } 860 return false 861 } 862 func rewriteValuePPC64_OpAddr(v *Value) bool { 863 v_0 := v.Args[0] 864 // match: (Addr {sym} base) 865 // result: (MOVDaddr {sym} [0] base) 866 for { 867 sym := auxToSym(v.Aux) 868 base := v_0 869 v.reset(OpPPC64MOVDaddr) 870 v.AuxInt = int32ToAuxInt(0) 871 v.Aux = symToAux(sym) 872 v.AddArg(base) 873 return true 874 } 875 } 876 func rewriteValuePPC64_OpAtomicCompareAndSwap32(v *Value) bool { 877 v_3 := v.Args[3] 878 v_2 := v.Args[2] 879 v_1 := v.Args[1] 880 v_0 := v.Args[0] 881 // match: (AtomicCompareAndSwap32 ptr old new_ mem) 882 // result: (LoweredAtomicCas32 [1] ptr old new_ mem) 883 for { 884 ptr := v_0 885 old := v_1 886 new_ := v_2 887 mem := v_3 888 v.reset(OpPPC64LoweredAtomicCas32) 889 v.AuxInt = int64ToAuxInt(1) 890 v.AddArg4(ptr, old, new_, mem) 891 return true 892 } 893 } 894 func rewriteValuePPC64_OpAtomicCompareAndSwap64(v *Value) bool { 895 v_3 := v.Args[3] 896 v_2 := v.Args[2] 897 v_1 := v.Args[1] 898 v_0 := v.Args[0] 899 // match: (AtomicCompareAndSwap64 ptr old new_ mem) 900 // result: (LoweredAtomicCas64 [1] ptr old new_ mem) 901 for { 902 ptr := v_0 903 old := v_1 904 new_ := v_2 905 mem := v_3 906 v.reset(OpPPC64LoweredAtomicCas64) 907 v.AuxInt = int64ToAuxInt(1) 908 v.AddArg4(ptr, old, new_, mem) 909 return true 910 } 911 } 912 func rewriteValuePPC64_OpAtomicCompareAndSwapRel32(v *Value) bool { 913 v_3 := v.Args[3] 914 v_2 := v.Args[2] 915 v_1 := v.Args[1] 916 v_0 := v.Args[0] 917 // match: (AtomicCompareAndSwapRel32 ptr old new_ mem) 918 // result: (LoweredAtomicCas32 [0] ptr old new_ mem) 919 for { 920 ptr := v_0 921 old := v_1 922 new_ := v_2 923 mem := v_3 924 v.reset(OpPPC64LoweredAtomicCas32) 925 v.AuxInt = int64ToAuxInt(0) 926 v.AddArg4(ptr, old, new_, mem) 927 return true 928 } 929 } 930 func rewriteValuePPC64_OpAtomicLoad32(v *Value) bool { 931 v_1 := v.Args[1] 932 v_0 := v.Args[0] 933 // match: (AtomicLoad32 ptr mem) 934 // result: (LoweredAtomicLoad32 [1] ptr mem) 935 for { 936 ptr := v_0 937 mem := v_1 938 v.reset(OpPPC64LoweredAtomicLoad32) 939 v.AuxInt = int64ToAuxInt(1) 940 v.AddArg2(ptr, mem) 941 return true 942 } 943 } 944 func rewriteValuePPC64_OpAtomicLoad64(v *Value) bool { 945 v_1 := v.Args[1] 946 v_0 := v.Args[0] 947 // match: (AtomicLoad64 ptr mem) 948 // result: (LoweredAtomicLoad64 [1] ptr mem) 949 for { 950 ptr := v_0 951 mem := v_1 952 v.reset(OpPPC64LoweredAtomicLoad64) 953 v.AuxInt = int64ToAuxInt(1) 954 v.AddArg2(ptr, mem) 955 return true 956 } 957 } 958 func rewriteValuePPC64_OpAtomicLoad8(v *Value) bool { 959 v_1 := v.Args[1] 960 v_0 := v.Args[0] 961 // match: (AtomicLoad8 ptr mem) 962 // result: (LoweredAtomicLoad8 [1] ptr mem) 963 for { 964 ptr := v_0 965 mem := v_1 966 v.reset(OpPPC64LoweredAtomicLoad8) 967 v.AuxInt = int64ToAuxInt(1) 968 v.AddArg2(ptr, mem) 969 return true 970 } 971 } 972 func rewriteValuePPC64_OpAtomicLoadAcq32(v *Value) bool { 973 v_1 := v.Args[1] 974 v_0 := v.Args[0] 975 // match: (AtomicLoadAcq32 ptr mem) 976 // result: (LoweredAtomicLoad32 [0] ptr mem) 977 for { 978 ptr := v_0 979 mem := v_1 980 v.reset(OpPPC64LoweredAtomicLoad32) 981 v.AuxInt = int64ToAuxInt(0) 982 v.AddArg2(ptr, mem) 983 return true 984 } 985 } 986 func rewriteValuePPC64_OpAtomicLoadAcq64(v *Value) bool { 987 v_1 := v.Args[1] 988 v_0 := v.Args[0] 989 // match: (AtomicLoadAcq64 ptr mem) 990 // result: (LoweredAtomicLoad64 [0] ptr mem) 991 for { 992 ptr := v_0 993 mem := v_1 994 v.reset(OpPPC64LoweredAtomicLoad64) 995 v.AuxInt = int64ToAuxInt(0) 996 v.AddArg2(ptr, mem) 997 return true 998 } 999 } 1000 func rewriteValuePPC64_OpAtomicLoadPtr(v *Value) bool { 1001 v_1 := v.Args[1] 1002 v_0 := v.Args[0] 1003 // match: (AtomicLoadPtr ptr mem) 1004 // result: (LoweredAtomicLoadPtr [1] ptr mem) 1005 for { 1006 ptr := v_0 1007 mem := v_1 1008 v.reset(OpPPC64LoweredAtomicLoadPtr) 1009 v.AuxInt = int64ToAuxInt(1) 1010 v.AddArg2(ptr, mem) 1011 return true 1012 } 1013 } 1014 func rewriteValuePPC64_OpAtomicStore32(v *Value) bool { 1015 v_2 := v.Args[2] 1016 v_1 := v.Args[1] 1017 v_0 := v.Args[0] 1018 // match: (AtomicStore32 ptr val mem) 1019 // result: (LoweredAtomicStore32 [1] ptr val mem) 1020 for { 1021 ptr := v_0 1022 val := v_1 1023 mem := v_2 1024 v.reset(OpPPC64LoweredAtomicStore32) 1025 v.AuxInt = int64ToAuxInt(1) 1026 v.AddArg3(ptr, val, mem) 1027 return true 1028 } 1029 } 1030 func rewriteValuePPC64_OpAtomicStore64(v *Value) bool { 1031 v_2 := v.Args[2] 1032 v_1 := v.Args[1] 1033 v_0 := v.Args[0] 1034 // match: (AtomicStore64 ptr val mem) 1035 // result: (LoweredAtomicStore64 [1] ptr val mem) 1036 for { 1037 ptr := v_0 1038 val := v_1 1039 mem := v_2 1040 v.reset(OpPPC64LoweredAtomicStore64) 1041 v.AuxInt = int64ToAuxInt(1) 1042 v.AddArg3(ptr, val, mem) 1043 return true 1044 } 1045 } 1046 func rewriteValuePPC64_OpAtomicStore8(v *Value) bool { 1047 v_2 := v.Args[2] 1048 v_1 := v.Args[1] 1049 v_0 := v.Args[0] 1050 // match: (AtomicStore8 ptr val mem) 1051 // result: (LoweredAtomicStore8 [1] ptr val mem) 1052 for { 1053 ptr := v_0 1054 val := v_1 1055 mem := v_2 1056 v.reset(OpPPC64LoweredAtomicStore8) 1057 v.AuxInt = int64ToAuxInt(1) 1058 v.AddArg3(ptr, val, mem) 1059 return true 1060 } 1061 } 1062 func rewriteValuePPC64_OpAtomicStoreRel32(v *Value) bool { 1063 v_2 := v.Args[2] 1064 v_1 := v.Args[1] 1065 v_0 := v.Args[0] 1066 // match: (AtomicStoreRel32 ptr val mem) 1067 // result: (LoweredAtomicStore32 [0] ptr val mem) 1068 for { 1069 ptr := v_0 1070 val := v_1 1071 mem := v_2 1072 v.reset(OpPPC64LoweredAtomicStore32) 1073 v.AuxInt = int64ToAuxInt(0) 1074 v.AddArg3(ptr, val, mem) 1075 return true 1076 } 1077 } 1078 func rewriteValuePPC64_OpAtomicStoreRel64(v *Value) bool { 1079 v_2 := v.Args[2] 1080 v_1 := v.Args[1] 1081 v_0 := v.Args[0] 1082 // match: (AtomicStoreRel64 ptr val mem) 1083 // result: (LoweredAtomicStore64 [0] ptr val mem) 1084 for { 1085 ptr := v_0 1086 val := v_1 1087 mem := v_2 1088 v.reset(OpPPC64LoweredAtomicStore64) 1089 v.AuxInt = int64ToAuxInt(0) 1090 v.AddArg3(ptr, val, mem) 1091 return true 1092 } 1093 } 1094 func rewriteValuePPC64_OpAvg64u(v *Value) bool { 1095 v_1 := v.Args[1] 1096 v_0 := v.Args[0] 1097 b := v.Block 1098 // match: (Avg64u <t> x y) 1099 // result: (ADD (SRDconst <t> (SUB <t> x y) [1]) y) 1100 for { 1101 t := v.Type 1102 x := v_0 1103 y := v_1 1104 v.reset(OpPPC64ADD) 1105 v0 := b.NewValue0(v.Pos, OpPPC64SRDconst, t) 1106 v0.AuxInt = int64ToAuxInt(1) 1107 v1 := b.NewValue0(v.Pos, OpPPC64SUB, t) 1108 v1.AddArg2(x, y) 1109 v0.AddArg(v1) 1110 v.AddArg2(v0, y) 1111 return true 1112 } 1113 } 1114 func rewriteValuePPC64_OpBitLen32(v *Value) bool { 1115 v_0 := v.Args[0] 1116 b := v.Block 1117 typ := &b.Func.Config.Types 1118 // match: (BitLen32 x) 1119 // result: (SUBFCconst [32] (CNTLZW <typ.Int> x)) 1120 for { 1121 x := v_0 1122 v.reset(OpPPC64SUBFCconst) 1123 v.AuxInt = int64ToAuxInt(32) 1124 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZW, typ.Int) 1125 v0.AddArg(x) 1126 v.AddArg(v0) 1127 return true 1128 } 1129 } 1130 func rewriteValuePPC64_OpBitLen64(v *Value) bool { 1131 v_0 := v.Args[0] 1132 b := v.Block 1133 typ := &b.Func.Config.Types 1134 // match: (BitLen64 x) 1135 // result: (SUBFCconst [64] (CNTLZD <typ.Int> x)) 1136 for { 1137 x := v_0 1138 v.reset(OpPPC64SUBFCconst) 1139 v.AuxInt = int64ToAuxInt(64) 1140 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZD, typ.Int) 1141 v0.AddArg(x) 1142 v.AddArg(v0) 1143 return true 1144 } 1145 } 1146 func rewriteValuePPC64_OpBswap16(v *Value) bool { 1147 v_0 := v.Args[0] 1148 b := v.Block 1149 typ := &b.Func.Config.Types 1150 // match: (Bswap16 x) 1151 // cond: buildcfg.GOPPC64>=10 1152 // result: (BRH x) 1153 for { 1154 x := v_0 1155 if !(buildcfg.GOPPC64 >= 10) { 1156 break 1157 } 1158 v.reset(OpPPC64BRH) 1159 v.AddArg(x) 1160 return true 1161 } 1162 // match: (Bswap16 x:(MOVHZload [off] {sym} ptr mem)) 1163 // result: @x.Block (MOVHBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem) 1164 for { 1165 x := v_0 1166 if x.Op != OpPPC64MOVHZload { 1167 break 1168 } 1169 off := auxIntToInt32(x.AuxInt) 1170 sym := auxToSym(x.Aux) 1171 mem := x.Args[1] 1172 ptr := x.Args[0] 1173 b = x.Block 1174 v0 := b.NewValue0(x.Pos, OpPPC64MOVHBRload, typ.UInt16) 1175 v.copyOf(v0) 1176 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type) 1177 v1.AuxInt = int32ToAuxInt(off) 1178 v1.Aux = symToAux(sym) 1179 v1.AddArg(ptr) 1180 v0.AddArg2(v1, mem) 1181 return true 1182 } 1183 // match: (Bswap16 x:(MOVHZloadidx ptr idx mem)) 1184 // result: @x.Block (MOVHBRloadidx ptr idx mem) 1185 for { 1186 x := v_0 1187 if x.Op != OpPPC64MOVHZloadidx { 1188 break 1189 } 1190 mem := x.Args[2] 1191 ptr := x.Args[0] 1192 idx := x.Args[1] 1193 b = x.Block 1194 v0 := b.NewValue0(v.Pos, OpPPC64MOVHBRloadidx, typ.Int16) 1195 v.copyOf(v0) 1196 v0.AddArg3(ptr, idx, mem) 1197 return true 1198 } 1199 return false 1200 } 1201 func rewriteValuePPC64_OpBswap32(v *Value) bool { 1202 v_0 := v.Args[0] 1203 b := v.Block 1204 typ := &b.Func.Config.Types 1205 // match: (Bswap32 x) 1206 // cond: buildcfg.GOPPC64>=10 1207 // result: (BRW x) 1208 for { 1209 x := v_0 1210 if !(buildcfg.GOPPC64 >= 10) { 1211 break 1212 } 1213 v.reset(OpPPC64BRW) 1214 v.AddArg(x) 1215 return true 1216 } 1217 // match: (Bswap32 x:(MOVWZload [off] {sym} ptr mem)) 1218 // result: @x.Block (MOVWBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem) 1219 for { 1220 x := v_0 1221 if x.Op != OpPPC64MOVWZload { 1222 break 1223 } 1224 off := auxIntToInt32(x.AuxInt) 1225 sym := auxToSym(x.Aux) 1226 mem := x.Args[1] 1227 ptr := x.Args[0] 1228 b = x.Block 1229 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32) 1230 v.copyOf(v0) 1231 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type) 1232 v1.AuxInt = int32ToAuxInt(off) 1233 v1.Aux = symToAux(sym) 1234 v1.AddArg(ptr) 1235 v0.AddArg2(v1, mem) 1236 return true 1237 } 1238 // match: (Bswap32 x:(MOVWZloadidx ptr idx mem)) 1239 // result: @x.Block (MOVWBRloadidx ptr idx mem) 1240 for { 1241 x := v_0 1242 if x.Op != OpPPC64MOVWZloadidx { 1243 break 1244 } 1245 mem := x.Args[2] 1246 ptr := x.Args[0] 1247 idx := x.Args[1] 1248 b = x.Block 1249 v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32) 1250 v.copyOf(v0) 1251 v0.AddArg3(ptr, idx, mem) 1252 return true 1253 } 1254 return false 1255 } 1256 func rewriteValuePPC64_OpBswap64(v *Value) bool { 1257 v_0 := v.Args[0] 1258 b := v.Block 1259 typ := &b.Func.Config.Types 1260 // match: (Bswap64 x) 1261 // cond: buildcfg.GOPPC64>=10 1262 // result: (BRD x) 1263 for { 1264 x := v_0 1265 if !(buildcfg.GOPPC64 >= 10) { 1266 break 1267 } 1268 v.reset(OpPPC64BRD) 1269 v.AddArg(x) 1270 return true 1271 } 1272 // match: (Bswap64 x:(MOVDload [off] {sym} ptr mem)) 1273 // result: @x.Block (MOVDBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem) 1274 for { 1275 x := v_0 1276 if x.Op != OpPPC64MOVDload { 1277 break 1278 } 1279 off := auxIntToInt32(x.AuxInt) 1280 sym := auxToSym(x.Aux) 1281 mem := x.Args[1] 1282 ptr := x.Args[0] 1283 b = x.Block 1284 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64) 1285 v.copyOf(v0) 1286 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type) 1287 v1.AuxInt = int32ToAuxInt(off) 1288 v1.Aux = symToAux(sym) 1289 v1.AddArg(ptr) 1290 v0.AddArg2(v1, mem) 1291 return true 1292 } 1293 // match: (Bswap64 x:(MOVDloadidx ptr idx mem)) 1294 // result: @x.Block (MOVDBRloadidx ptr idx mem) 1295 for { 1296 x := v_0 1297 if x.Op != OpPPC64MOVDloadidx { 1298 break 1299 } 1300 mem := x.Args[2] 1301 ptr := x.Args[0] 1302 idx := x.Args[1] 1303 b = x.Block 1304 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64) 1305 v.copyOf(v0) 1306 v0.AddArg3(ptr, idx, mem) 1307 return true 1308 } 1309 return false 1310 } 1311 func rewriteValuePPC64_OpCom16(v *Value) bool { 1312 v_0 := v.Args[0] 1313 // match: (Com16 x) 1314 // result: (NOR x x) 1315 for { 1316 x := v_0 1317 v.reset(OpPPC64NOR) 1318 v.AddArg2(x, x) 1319 return true 1320 } 1321 } 1322 func rewriteValuePPC64_OpCom32(v *Value) bool { 1323 v_0 := v.Args[0] 1324 // match: (Com32 x) 1325 // result: (NOR x x) 1326 for { 1327 x := v_0 1328 v.reset(OpPPC64NOR) 1329 v.AddArg2(x, x) 1330 return true 1331 } 1332 } 1333 func rewriteValuePPC64_OpCom64(v *Value) bool { 1334 v_0 := v.Args[0] 1335 // match: (Com64 x) 1336 // result: (NOR x x) 1337 for { 1338 x := v_0 1339 v.reset(OpPPC64NOR) 1340 v.AddArg2(x, x) 1341 return true 1342 } 1343 } 1344 func rewriteValuePPC64_OpCom8(v *Value) bool { 1345 v_0 := v.Args[0] 1346 // match: (Com8 x) 1347 // result: (NOR x x) 1348 for { 1349 x := v_0 1350 v.reset(OpPPC64NOR) 1351 v.AddArg2(x, x) 1352 return true 1353 } 1354 } 1355 func rewriteValuePPC64_OpCondSelect(v *Value) bool { 1356 v_2 := v.Args[2] 1357 v_1 := v.Args[1] 1358 v_0 := v.Args[0] 1359 b := v.Block 1360 typ := &b.Func.Config.Types 1361 // match: (CondSelect x y (SETBC [a] cmp)) 1362 // result: (ISEL [a] x y cmp) 1363 for { 1364 x := v_0 1365 y := v_1 1366 if v_2.Op != OpPPC64SETBC { 1367 break 1368 } 1369 a := auxIntToInt32(v_2.AuxInt) 1370 cmp := v_2.Args[0] 1371 v.reset(OpPPC64ISEL) 1372 v.AuxInt = int32ToAuxInt(a) 1373 v.AddArg3(x, y, cmp) 1374 return true 1375 } 1376 // match: (CondSelect x y (SETBCR [a] cmp)) 1377 // result: (ISEL [a+4] x y cmp) 1378 for { 1379 x := v_0 1380 y := v_1 1381 if v_2.Op != OpPPC64SETBCR { 1382 break 1383 } 1384 a := auxIntToInt32(v_2.AuxInt) 1385 cmp := v_2.Args[0] 1386 v.reset(OpPPC64ISEL) 1387 v.AuxInt = int32ToAuxInt(a + 4) 1388 v.AddArg3(x, y, cmp) 1389 return true 1390 } 1391 // match: (CondSelect x y bool) 1392 // cond: flagArg(bool) == nil 1393 // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [1] bool))) 1394 for { 1395 x := v_0 1396 y := v_1 1397 bool := v_2 1398 if !(flagArg(bool) == nil) { 1399 break 1400 } 1401 v.reset(OpPPC64ISEL) 1402 v.AuxInt = int32ToAuxInt(6) 1403 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 1404 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 1405 v1.AuxInt = int64ToAuxInt(1) 1406 v1.AddArg(bool) 1407 v0.AddArg(v1) 1408 v.AddArg3(x, y, v0) 1409 return true 1410 } 1411 return false 1412 } 1413 func rewriteValuePPC64_OpConst16(v *Value) bool { 1414 // match: (Const16 [val]) 1415 // result: (MOVDconst [int64(val)]) 1416 for { 1417 val := auxIntToInt16(v.AuxInt) 1418 v.reset(OpPPC64MOVDconst) 1419 v.AuxInt = int64ToAuxInt(int64(val)) 1420 return true 1421 } 1422 } 1423 func rewriteValuePPC64_OpConst32(v *Value) bool { 1424 // match: (Const32 [val]) 1425 // result: (MOVDconst [int64(val)]) 1426 for { 1427 val := auxIntToInt32(v.AuxInt) 1428 v.reset(OpPPC64MOVDconst) 1429 v.AuxInt = int64ToAuxInt(int64(val)) 1430 return true 1431 } 1432 } 1433 func rewriteValuePPC64_OpConst64(v *Value) bool { 1434 // match: (Const64 [val]) 1435 // result: (MOVDconst [int64(val)]) 1436 for { 1437 val := auxIntToInt64(v.AuxInt) 1438 v.reset(OpPPC64MOVDconst) 1439 v.AuxInt = int64ToAuxInt(int64(val)) 1440 return true 1441 } 1442 } 1443 func rewriteValuePPC64_OpConst8(v *Value) bool { 1444 // match: (Const8 [val]) 1445 // result: (MOVDconst [int64(val)]) 1446 for { 1447 val := auxIntToInt8(v.AuxInt) 1448 v.reset(OpPPC64MOVDconst) 1449 v.AuxInt = int64ToAuxInt(int64(val)) 1450 return true 1451 } 1452 } 1453 func rewriteValuePPC64_OpConstBool(v *Value) bool { 1454 // match: (ConstBool [t]) 1455 // result: (MOVDconst [b2i(t)]) 1456 for { 1457 t := auxIntToBool(v.AuxInt) 1458 v.reset(OpPPC64MOVDconst) 1459 v.AuxInt = int64ToAuxInt(b2i(t)) 1460 return true 1461 } 1462 } 1463 func rewriteValuePPC64_OpConstNil(v *Value) bool { 1464 // match: (ConstNil) 1465 // result: (MOVDconst [0]) 1466 for { 1467 v.reset(OpPPC64MOVDconst) 1468 v.AuxInt = int64ToAuxInt(0) 1469 return true 1470 } 1471 } 1472 func rewriteValuePPC64_OpCopysign(v *Value) bool { 1473 v_1 := v.Args[1] 1474 v_0 := v.Args[0] 1475 // match: (Copysign x y) 1476 // result: (FCPSGN y x) 1477 for { 1478 x := v_0 1479 y := v_1 1480 v.reset(OpPPC64FCPSGN) 1481 v.AddArg2(y, x) 1482 return true 1483 } 1484 } 1485 func rewriteValuePPC64_OpCtz16(v *Value) bool { 1486 v_0 := v.Args[0] 1487 b := v.Block 1488 typ := &b.Func.Config.Types 1489 // match: (Ctz16 x) 1490 // result: (POPCNTW (MOVHZreg (ANDN <typ.Int16> (ADDconst <typ.Int16> [-1] x) x))) 1491 for { 1492 x := v_0 1493 v.reset(OpPPC64POPCNTW) 1494 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 1495 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int16) 1496 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int16) 1497 v2.AuxInt = int64ToAuxInt(-1) 1498 v2.AddArg(x) 1499 v1.AddArg2(v2, x) 1500 v0.AddArg(v1) 1501 v.AddArg(v0) 1502 return true 1503 } 1504 } 1505 func rewriteValuePPC64_OpCtz32(v *Value) bool { 1506 v_0 := v.Args[0] 1507 b := v.Block 1508 typ := &b.Func.Config.Types 1509 // match: (Ctz32 x) 1510 // cond: buildcfg.GOPPC64<=8 1511 // result: (POPCNTW (MOVWZreg (ANDN <typ.Int> (ADDconst <typ.Int> [-1] x) x))) 1512 for { 1513 x := v_0 1514 if !(buildcfg.GOPPC64 <= 8) { 1515 break 1516 } 1517 v.reset(OpPPC64POPCNTW) 1518 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64) 1519 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int) 1520 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int) 1521 v2.AuxInt = int64ToAuxInt(-1) 1522 v2.AddArg(x) 1523 v1.AddArg2(v2, x) 1524 v0.AddArg(v1) 1525 v.AddArg(v0) 1526 return true 1527 } 1528 // match: (Ctz32 x) 1529 // result: (CNTTZW (MOVWZreg x)) 1530 for { 1531 x := v_0 1532 v.reset(OpPPC64CNTTZW) 1533 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64) 1534 v0.AddArg(x) 1535 v.AddArg(v0) 1536 return true 1537 } 1538 } 1539 func rewriteValuePPC64_OpCtz64(v *Value) bool { 1540 v_0 := v.Args[0] 1541 b := v.Block 1542 typ := &b.Func.Config.Types 1543 // match: (Ctz64 x) 1544 // cond: buildcfg.GOPPC64<=8 1545 // result: (POPCNTD (ANDN <typ.Int64> (ADDconst <typ.Int64> [-1] x) x)) 1546 for { 1547 x := v_0 1548 if !(buildcfg.GOPPC64 <= 8) { 1549 break 1550 } 1551 v.reset(OpPPC64POPCNTD) 1552 v0 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int64) 1553 v1 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int64) 1554 v1.AuxInt = int64ToAuxInt(-1) 1555 v1.AddArg(x) 1556 v0.AddArg2(v1, x) 1557 v.AddArg(v0) 1558 return true 1559 } 1560 // match: (Ctz64 x) 1561 // result: (CNTTZD x) 1562 for { 1563 x := v_0 1564 v.reset(OpPPC64CNTTZD) 1565 v.AddArg(x) 1566 return true 1567 } 1568 } 1569 func rewriteValuePPC64_OpCtz8(v *Value) bool { 1570 v_0 := v.Args[0] 1571 b := v.Block 1572 typ := &b.Func.Config.Types 1573 // match: (Ctz8 x) 1574 // result: (POPCNTB (MOVBZreg (ANDN <typ.UInt8> (ADDconst <typ.UInt8> [-1] x) x))) 1575 for { 1576 x := v_0 1577 v.reset(OpPPC64POPCNTB) 1578 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 1579 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.UInt8) 1580 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.UInt8) 1581 v2.AuxInt = int64ToAuxInt(-1) 1582 v2.AddArg(x) 1583 v1.AddArg2(v2, x) 1584 v0.AddArg(v1) 1585 v.AddArg(v0) 1586 return true 1587 } 1588 } 1589 func rewriteValuePPC64_OpCvt32Fto32(v *Value) bool { 1590 v_0 := v.Args[0] 1591 b := v.Block 1592 typ := &b.Func.Config.Types 1593 // match: (Cvt32Fto32 x) 1594 // result: (MFVSRD (FCTIWZ x)) 1595 for { 1596 x := v_0 1597 v.reset(OpPPC64MFVSRD) 1598 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64) 1599 v0.AddArg(x) 1600 v.AddArg(v0) 1601 return true 1602 } 1603 } 1604 func rewriteValuePPC64_OpCvt32Fto64(v *Value) bool { 1605 v_0 := v.Args[0] 1606 b := v.Block 1607 typ := &b.Func.Config.Types 1608 // match: (Cvt32Fto64 x) 1609 // result: (MFVSRD (FCTIDZ x)) 1610 for { 1611 x := v_0 1612 v.reset(OpPPC64MFVSRD) 1613 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64) 1614 v0.AddArg(x) 1615 v.AddArg(v0) 1616 return true 1617 } 1618 } 1619 func rewriteValuePPC64_OpCvt32to32F(v *Value) bool { 1620 v_0 := v.Args[0] 1621 b := v.Block 1622 typ := &b.Func.Config.Types 1623 // match: (Cvt32to32F x) 1624 // result: (FCFIDS (MTVSRD (SignExt32to64 x))) 1625 for { 1626 x := v_0 1627 v.reset(OpPPC64FCFIDS) 1628 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64) 1629 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1630 v1.AddArg(x) 1631 v0.AddArg(v1) 1632 v.AddArg(v0) 1633 return true 1634 } 1635 } 1636 func rewriteValuePPC64_OpCvt32to64F(v *Value) bool { 1637 v_0 := v.Args[0] 1638 b := v.Block 1639 typ := &b.Func.Config.Types 1640 // match: (Cvt32to64F x) 1641 // result: (FCFID (MTVSRD (SignExt32to64 x))) 1642 for { 1643 x := v_0 1644 v.reset(OpPPC64FCFID) 1645 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64) 1646 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1647 v1.AddArg(x) 1648 v0.AddArg(v1) 1649 v.AddArg(v0) 1650 return true 1651 } 1652 } 1653 func rewriteValuePPC64_OpCvt64Fto32(v *Value) bool { 1654 v_0 := v.Args[0] 1655 b := v.Block 1656 typ := &b.Func.Config.Types 1657 // match: (Cvt64Fto32 x) 1658 // result: (MFVSRD (FCTIWZ x)) 1659 for { 1660 x := v_0 1661 v.reset(OpPPC64MFVSRD) 1662 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64) 1663 v0.AddArg(x) 1664 v.AddArg(v0) 1665 return true 1666 } 1667 } 1668 func rewriteValuePPC64_OpCvt64Fto64(v *Value) bool { 1669 v_0 := v.Args[0] 1670 b := v.Block 1671 typ := &b.Func.Config.Types 1672 // match: (Cvt64Fto64 x) 1673 // result: (MFVSRD (FCTIDZ x)) 1674 for { 1675 x := v_0 1676 v.reset(OpPPC64MFVSRD) 1677 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64) 1678 v0.AddArg(x) 1679 v.AddArg(v0) 1680 return true 1681 } 1682 } 1683 func rewriteValuePPC64_OpCvt64to32F(v *Value) bool { 1684 v_0 := v.Args[0] 1685 b := v.Block 1686 typ := &b.Func.Config.Types 1687 // match: (Cvt64to32F x) 1688 // result: (FCFIDS (MTVSRD x)) 1689 for { 1690 x := v_0 1691 v.reset(OpPPC64FCFIDS) 1692 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64) 1693 v0.AddArg(x) 1694 v.AddArg(v0) 1695 return true 1696 } 1697 } 1698 func rewriteValuePPC64_OpCvt64to64F(v *Value) bool { 1699 v_0 := v.Args[0] 1700 b := v.Block 1701 typ := &b.Func.Config.Types 1702 // match: (Cvt64to64F x) 1703 // result: (FCFID (MTVSRD x)) 1704 for { 1705 x := v_0 1706 v.reset(OpPPC64FCFID) 1707 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64) 1708 v0.AddArg(x) 1709 v.AddArg(v0) 1710 return true 1711 } 1712 } 1713 func rewriteValuePPC64_OpDiv16(v *Value) bool { 1714 v_1 := v.Args[1] 1715 v_0 := v.Args[0] 1716 b := v.Block 1717 typ := &b.Func.Config.Types 1718 // match: (Div16 [false] x y) 1719 // result: (DIVW (SignExt16to32 x) (SignExt16to32 y)) 1720 for { 1721 if auxIntToBool(v.AuxInt) != false { 1722 break 1723 } 1724 x := v_0 1725 y := v_1 1726 v.reset(OpPPC64DIVW) 1727 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 1728 v0.AddArg(x) 1729 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 1730 v1.AddArg(y) 1731 v.AddArg2(v0, v1) 1732 return true 1733 } 1734 return false 1735 } 1736 func rewriteValuePPC64_OpDiv16u(v *Value) bool { 1737 v_1 := v.Args[1] 1738 v_0 := v.Args[0] 1739 b := v.Block 1740 typ := &b.Func.Config.Types 1741 // match: (Div16u x y) 1742 // result: (DIVWU (ZeroExt16to32 x) (ZeroExt16to32 y)) 1743 for { 1744 x := v_0 1745 y := v_1 1746 v.reset(OpPPC64DIVWU) 1747 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 1748 v0.AddArg(x) 1749 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 1750 v1.AddArg(y) 1751 v.AddArg2(v0, v1) 1752 return true 1753 } 1754 } 1755 func rewriteValuePPC64_OpDiv32(v *Value) bool { 1756 v_1 := v.Args[1] 1757 v_0 := v.Args[0] 1758 // match: (Div32 [false] x y) 1759 // result: (DIVW x y) 1760 for { 1761 if auxIntToBool(v.AuxInt) != false { 1762 break 1763 } 1764 x := v_0 1765 y := v_1 1766 v.reset(OpPPC64DIVW) 1767 v.AddArg2(x, y) 1768 return true 1769 } 1770 return false 1771 } 1772 func rewriteValuePPC64_OpDiv64(v *Value) bool { 1773 v_1 := v.Args[1] 1774 v_0 := v.Args[0] 1775 // match: (Div64 [false] x y) 1776 // result: (DIVD x y) 1777 for { 1778 if auxIntToBool(v.AuxInt) != false { 1779 break 1780 } 1781 x := v_0 1782 y := v_1 1783 v.reset(OpPPC64DIVD) 1784 v.AddArg2(x, y) 1785 return true 1786 } 1787 return false 1788 } 1789 func rewriteValuePPC64_OpDiv8(v *Value) bool { 1790 v_1 := v.Args[1] 1791 v_0 := v.Args[0] 1792 b := v.Block 1793 typ := &b.Func.Config.Types 1794 // match: (Div8 x y) 1795 // result: (DIVW (SignExt8to32 x) (SignExt8to32 y)) 1796 for { 1797 x := v_0 1798 y := v_1 1799 v.reset(OpPPC64DIVW) 1800 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 1801 v0.AddArg(x) 1802 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 1803 v1.AddArg(y) 1804 v.AddArg2(v0, v1) 1805 return true 1806 } 1807 } 1808 func rewriteValuePPC64_OpDiv8u(v *Value) bool { 1809 v_1 := v.Args[1] 1810 v_0 := v.Args[0] 1811 b := v.Block 1812 typ := &b.Func.Config.Types 1813 // match: (Div8u x y) 1814 // result: (DIVWU (ZeroExt8to32 x) (ZeroExt8to32 y)) 1815 for { 1816 x := v_0 1817 y := v_1 1818 v.reset(OpPPC64DIVWU) 1819 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 1820 v0.AddArg(x) 1821 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 1822 v1.AddArg(y) 1823 v.AddArg2(v0, v1) 1824 return true 1825 } 1826 } 1827 func rewriteValuePPC64_OpEq16(v *Value) bool { 1828 v_1 := v.Args[1] 1829 v_0 := v.Args[0] 1830 b := v.Block 1831 typ := &b.Func.Config.Types 1832 // match: (Eq16 x y) 1833 // cond: x.Type.IsSigned() && y.Type.IsSigned() 1834 // result: (Equal (CMPW (SignExt16to32 x) (SignExt16to32 y))) 1835 for { 1836 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 1837 x := v_0 1838 y := v_1 1839 if !(x.Type.IsSigned() && y.Type.IsSigned()) { 1840 continue 1841 } 1842 v.reset(OpPPC64Equal) 1843 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 1844 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 1845 v1.AddArg(x) 1846 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 1847 v2.AddArg(y) 1848 v0.AddArg2(v1, v2) 1849 v.AddArg(v0) 1850 return true 1851 } 1852 break 1853 } 1854 // match: (Eq16 x y) 1855 // result: (Equal (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y))) 1856 for { 1857 x := v_0 1858 y := v_1 1859 v.reset(OpPPC64Equal) 1860 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 1861 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 1862 v1.AddArg(x) 1863 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 1864 v2.AddArg(y) 1865 v0.AddArg2(v1, v2) 1866 v.AddArg(v0) 1867 return true 1868 } 1869 } 1870 func rewriteValuePPC64_OpEq32(v *Value) bool { 1871 v_1 := v.Args[1] 1872 v_0 := v.Args[0] 1873 b := v.Block 1874 // match: (Eq32 x y) 1875 // result: (Equal (CMPW x y)) 1876 for { 1877 x := v_0 1878 y := v_1 1879 v.reset(OpPPC64Equal) 1880 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 1881 v0.AddArg2(x, y) 1882 v.AddArg(v0) 1883 return true 1884 } 1885 } 1886 func rewriteValuePPC64_OpEq32F(v *Value) bool { 1887 v_1 := v.Args[1] 1888 v_0 := v.Args[0] 1889 b := v.Block 1890 // match: (Eq32F x y) 1891 // result: (Equal (FCMPU x y)) 1892 for { 1893 x := v_0 1894 y := v_1 1895 v.reset(OpPPC64Equal) 1896 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags) 1897 v0.AddArg2(x, y) 1898 v.AddArg(v0) 1899 return true 1900 } 1901 } 1902 func rewriteValuePPC64_OpEq64(v *Value) bool { 1903 v_1 := v.Args[1] 1904 v_0 := v.Args[0] 1905 b := v.Block 1906 // match: (Eq64 x y) 1907 // result: (Equal (CMP x y)) 1908 for { 1909 x := v_0 1910 y := v_1 1911 v.reset(OpPPC64Equal) 1912 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags) 1913 v0.AddArg2(x, y) 1914 v.AddArg(v0) 1915 return true 1916 } 1917 } 1918 func rewriteValuePPC64_OpEq64F(v *Value) bool { 1919 v_1 := v.Args[1] 1920 v_0 := v.Args[0] 1921 b := v.Block 1922 // match: (Eq64F x y) 1923 // result: (Equal (FCMPU x y)) 1924 for { 1925 x := v_0 1926 y := v_1 1927 v.reset(OpPPC64Equal) 1928 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags) 1929 v0.AddArg2(x, y) 1930 v.AddArg(v0) 1931 return true 1932 } 1933 } 1934 func rewriteValuePPC64_OpEq8(v *Value) bool { 1935 v_1 := v.Args[1] 1936 v_0 := v.Args[0] 1937 b := v.Block 1938 typ := &b.Func.Config.Types 1939 // match: (Eq8 x y) 1940 // cond: x.Type.IsSigned() && y.Type.IsSigned() 1941 // result: (Equal (CMPW (SignExt8to32 x) (SignExt8to32 y))) 1942 for { 1943 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 1944 x := v_0 1945 y := v_1 1946 if !(x.Type.IsSigned() && y.Type.IsSigned()) { 1947 continue 1948 } 1949 v.reset(OpPPC64Equal) 1950 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 1951 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 1952 v1.AddArg(x) 1953 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 1954 v2.AddArg(y) 1955 v0.AddArg2(v1, v2) 1956 v.AddArg(v0) 1957 return true 1958 } 1959 break 1960 } 1961 // match: (Eq8 x y) 1962 // result: (Equal (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y))) 1963 for { 1964 x := v_0 1965 y := v_1 1966 v.reset(OpPPC64Equal) 1967 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 1968 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 1969 v1.AddArg(x) 1970 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 1971 v2.AddArg(y) 1972 v0.AddArg2(v1, v2) 1973 v.AddArg(v0) 1974 return true 1975 } 1976 } 1977 func rewriteValuePPC64_OpEqB(v *Value) bool { 1978 v_1 := v.Args[1] 1979 v_0 := v.Args[0] 1980 b := v.Block 1981 typ := &b.Func.Config.Types 1982 // match: (EqB x y) 1983 // result: (Select0 <typ.Int> (ANDCCconst [1] (EQV x y))) 1984 for { 1985 x := v_0 1986 y := v_1 1987 v.reset(OpSelect0) 1988 v.Type = typ.Int 1989 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 1990 v0.AuxInt = int64ToAuxInt(1) 1991 v1 := b.NewValue0(v.Pos, OpPPC64EQV, typ.Int64) 1992 v1.AddArg2(x, y) 1993 v0.AddArg(v1) 1994 v.AddArg(v0) 1995 return true 1996 } 1997 } 1998 func rewriteValuePPC64_OpEqPtr(v *Value) bool { 1999 v_1 := v.Args[1] 2000 v_0 := v.Args[0] 2001 b := v.Block 2002 // match: (EqPtr x y) 2003 // result: (Equal (CMP x y)) 2004 for { 2005 x := v_0 2006 y := v_1 2007 v.reset(OpPPC64Equal) 2008 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags) 2009 v0.AddArg2(x, y) 2010 v.AddArg(v0) 2011 return true 2012 } 2013 } 2014 func rewriteValuePPC64_OpIsInBounds(v *Value) bool { 2015 v_1 := v.Args[1] 2016 v_0 := v.Args[0] 2017 b := v.Block 2018 // match: (IsInBounds idx len) 2019 // result: (LessThan (CMPU idx len)) 2020 for { 2021 idx := v_0 2022 len := v_1 2023 v.reset(OpPPC64LessThan) 2024 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags) 2025 v0.AddArg2(idx, len) 2026 v.AddArg(v0) 2027 return true 2028 } 2029 } 2030 func rewriteValuePPC64_OpIsNonNil(v *Value) bool { 2031 v_0 := v.Args[0] 2032 b := v.Block 2033 // match: (IsNonNil ptr) 2034 // result: (NotEqual (CMPconst [0] ptr)) 2035 for { 2036 ptr := v_0 2037 v.reset(OpPPC64NotEqual) 2038 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags) 2039 v0.AuxInt = int64ToAuxInt(0) 2040 v0.AddArg(ptr) 2041 v.AddArg(v0) 2042 return true 2043 } 2044 } 2045 func rewriteValuePPC64_OpIsSliceInBounds(v *Value) bool { 2046 v_1 := v.Args[1] 2047 v_0 := v.Args[0] 2048 b := v.Block 2049 // match: (IsSliceInBounds idx len) 2050 // result: (LessEqual (CMPU idx len)) 2051 for { 2052 idx := v_0 2053 len := v_1 2054 v.reset(OpPPC64LessEqual) 2055 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags) 2056 v0.AddArg2(idx, len) 2057 v.AddArg(v0) 2058 return true 2059 } 2060 } 2061 func rewriteValuePPC64_OpLeq16(v *Value) bool { 2062 v_1 := v.Args[1] 2063 v_0 := v.Args[0] 2064 b := v.Block 2065 typ := &b.Func.Config.Types 2066 // match: (Leq16 x y) 2067 // result: (LessEqual (CMPW (SignExt16to32 x) (SignExt16to32 y))) 2068 for { 2069 x := v_0 2070 y := v_1 2071 v.reset(OpPPC64LessEqual) 2072 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 2073 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 2074 v1.AddArg(x) 2075 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 2076 v2.AddArg(y) 2077 v0.AddArg2(v1, v2) 2078 v.AddArg(v0) 2079 return true 2080 } 2081 } 2082 func rewriteValuePPC64_OpLeq16U(v *Value) bool { 2083 v_1 := v.Args[1] 2084 v_0 := v.Args[0] 2085 b := v.Block 2086 typ := &b.Func.Config.Types 2087 // match: (Leq16U x y) 2088 // result: (LessEqual (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y))) 2089 for { 2090 x := v_0 2091 y := v_1 2092 v.reset(OpPPC64LessEqual) 2093 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags) 2094 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 2095 v1.AddArg(x) 2096 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 2097 v2.AddArg(y) 2098 v0.AddArg2(v1, v2) 2099 v.AddArg(v0) 2100 return true 2101 } 2102 } 2103 func rewriteValuePPC64_OpLeq32(v *Value) bool { 2104 v_1 := v.Args[1] 2105 v_0 := v.Args[0] 2106 b := v.Block 2107 // match: (Leq32 x y) 2108 // result: (LessEqual (CMPW x y)) 2109 for { 2110 x := v_0 2111 y := v_1 2112 v.reset(OpPPC64LessEqual) 2113 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 2114 v0.AddArg2(x, y) 2115 v.AddArg(v0) 2116 return true 2117 } 2118 } 2119 func rewriteValuePPC64_OpLeq32F(v *Value) bool { 2120 v_1 := v.Args[1] 2121 v_0 := v.Args[0] 2122 b := v.Block 2123 // match: (Leq32F x y) 2124 // result: (FLessEqual (FCMPU x y)) 2125 for { 2126 x := v_0 2127 y := v_1 2128 v.reset(OpPPC64FLessEqual) 2129 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags) 2130 v0.AddArg2(x, y) 2131 v.AddArg(v0) 2132 return true 2133 } 2134 } 2135 func rewriteValuePPC64_OpLeq32U(v *Value) bool { 2136 v_1 := v.Args[1] 2137 v_0 := v.Args[0] 2138 b := v.Block 2139 // match: (Leq32U x y) 2140 // result: (LessEqual (CMPWU x y)) 2141 for { 2142 x := v_0 2143 y := v_1 2144 v.reset(OpPPC64LessEqual) 2145 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags) 2146 v0.AddArg2(x, y) 2147 v.AddArg(v0) 2148 return true 2149 } 2150 } 2151 func rewriteValuePPC64_OpLeq64(v *Value) bool { 2152 v_1 := v.Args[1] 2153 v_0 := v.Args[0] 2154 b := v.Block 2155 // match: (Leq64 x y) 2156 // result: (LessEqual (CMP x y)) 2157 for { 2158 x := v_0 2159 y := v_1 2160 v.reset(OpPPC64LessEqual) 2161 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags) 2162 v0.AddArg2(x, y) 2163 v.AddArg(v0) 2164 return true 2165 } 2166 } 2167 func rewriteValuePPC64_OpLeq64F(v *Value) bool { 2168 v_1 := v.Args[1] 2169 v_0 := v.Args[0] 2170 b := v.Block 2171 // match: (Leq64F x y) 2172 // result: (FLessEqual (FCMPU x y)) 2173 for { 2174 x := v_0 2175 y := v_1 2176 v.reset(OpPPC64FLessEqual) 2177 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags) 2178 v0.AddArg2(x, y) 2179 v.AddArg(v0) 2180 return true 2181 } 2182 } 2183 func rewriteValuePPC64_OpLeq64U(v *Value) bool { 2184 v_1 := v.Args[1] 2185 v_0 := v.Args[0] 2186 b := v.Block 2187 // match: (Leq64U x y) 2188 // result: (LessEqual (CMPU x y)) 2189 for { 2190 x := v_0 2191 y := v_1 2192 v.reset(OpPPC64LessEqual) 2193 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags) 2194 v0.AddArg2(x, y) 2195 v.AddArg(v0) 2196 return true 2197 } 2198 } 2199 func rewriteValuePPC64_OpLeq8(v *Value) bool { 2200 v_1 := v.Args[1] 2201 v_0 := v.Args[0] 2202 b := v.Block 2203 typ := &b.Func.Config.Types 2204 // match: (Leq8 x y) 2205 // result: (LessEqual (CMPW (SignExt8to32 x) (SignExt8to32 y))) 2206 for { 2207 x := v_0 2208 y := v_1 2209 v.reset(OpPPC64LessEqual) 2210 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 2211 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 2212 v1.AddArg(x) 2213 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 2214 v2.AddArg(y) 2215 v0.AddArg2(v1, v2) 2216 v.AddArg(v0) 2217 return true 2218 } 2219 } 2220 func rewriteValuePPC64_OpLeq8U(v *Value) bool { 2221 v_1 := v.Args[1] 2222 v_0 := v.Args[0] 2223 b := v.Block 2224 typ := &b.Func.Config.Types 2225 // match: (Leq8U x y) 2226 // result: (LessEqual (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y))) 2227 for { 2228 x := v_0 2229 y := v_1 2230 v.reset(OpPPC64LessEqual) 2231 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags) 2232 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 2233 v1.AddArg(x) 2234 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 2235 v2.AddArg(y) 2236 v0.AddArg2(v1, v2) 2237 v.AddArg(v0) 2238 return true 2239 } 2240 } 2241 func rewriteValuePPC64_OpLess16(v *Value) bool { 2242 v_1 := v.Args[1] 2243 v_0 := v.Args[0] 2244 b := v.Block 2245 typ := &b.Func.Config.Types 2246 // match: (Less16 x y) 2247 // result: (LessThan (CMPW (SignExt16to32 x) (SignExt16to32 y))) 2248 for { 2249 x := v_0 2250 y := v_1 2251 v.reset(OpPPC64LessThan) 2252 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 2253 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 2254 v1.AddArg(x) 2255 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 2256 v2.AddArg(y) 2257 v0.AddArg2(v1, v2) 2258 v.AddArg(v0) 2259 return true 2260 } 2261 } 2262 func rewriteValuePPC64_OpLess16U(v *Value) bool { 2263 v_1 := v.Args[1] 2264 v_0 := v.Args[0] 2265 b := v.Block 2266 typ := &b.Func.Config.Types 2267 // match: (Less16U x y) 2268 // result: (LessThan (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y))) 2269 for { 2270 x := v_0 2271 y := v_1 2272 v.reset(OpPPC64LessThan) 2273 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags) 2274 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 2275 v1.AddArg(x) 2276 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 2277 v2.AddArg(y) 2278 v0.AddArg2(v1, v2) 2279 v.AddArg(v0) 2280 return true 2281 } 2282 } 2283 func rewriteValuePPC64_OpLess32(v *Value) bool { 2284 v_1 := v.Args[1] 2285 v_0 := v.Args[0] 2286 b := v.Block 2287 // match: (Less32 x y) 2288 // result: (LessThan (CMPW x y)) 2289 for { 2290 x := v_0 2291 y := v_1 2292 v.reset(OpPPC64LessThan) 2293 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 2294 v0.AddArg2(x, y) 2295 v.AddArg(v0) 2296 return true 2297 } 2298 } 2299 func rewriteValuePPC64_OpLess32F(v *Value) bool { 2300 v_1 := v.Args[1] 2301 v_0 := v.Args[0] 2302 b := v.Block 2303 // match: (Less32F x y) 2304 // result: (FLessThan (FCMPU x y)) 2305 for { 2306 x := v_0 2307 y := v_1 2308 v.reset(OpPPC64FLessThan) 2309 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags) 2310 v0.AddArg2(x, y) 2311 v.AddArg(v0) 2312 return true 2313 } 2314 } 2315 func rewriteValuePPC64_OpLess32U(v *Value) bool { 2316 v_1 := v.Args[1] 2317 v_0 := v.Args[0] 2318 b := v.Block 2319 // match: (Less32U x y) 2320 // result: (LessThan (CMPWU x y)) 2321 for { 2322 x := v_0 2323 y := v_1 2324 v.reset(OpPPC64LessThan) 2325 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags) 2326 v0.AddArg2(x, y) 2327 v.AddArg(v0) 2328 return true 2329 } 2330 } 2331 func rewriteValuePPC64_OpLess64(v *Value) bool { 2332 v_1 := v.Args[1] 2333 v_0 := v.Args[0] 2334 b := v.Block 2335 // match: (Less64 x y) 2336 // result: (LessThan (CMP x y)) 2337 for { 2338 x := v_0 2339 y := v_1 2340 v.reset(OpPPC64LessThan) 2341 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags) 2342 v0.AddArg2(x, y) 2343 v.AddArg(v0) 2344 return true 2345 } 2346 } 2347 func rewriteValuePPC64_OpLess64F(v *Value) bool { 2348 v_1 := v.Args[1] 2349 v_0 := v.Args[0] 2350 b := v.Block 2351 // match: (Less64F x y) 2352 // result: (FLessThan (FCMPU x y)) 2353 for { 2354 x := v_0 2355 y := v_1 2356 v.reset(OpPPC64FLessThan) 2357 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags) 2358 v0.AddArg2(x, y) 2359 v.AddArg(v0) 2360 return true 2361 } 2362 } 2363 func rewriteValuePPC64_OpLess64U(v *Value) bool { 2364 v_1 := v.Args[1] 2365 v_0 := v.Args[0] 2366 b := v.Block 2367 // match: (Less64U x y) 2368 // result: (LessThan (CMPU x y)) 2369 for { 2370 x := v_0 2371 y := v_1 2372 v.reset(OpPPC64LessThan) 2373 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags) 2374 v0.AddArg2(x, y) 2375 v.AddArg(v0) 2376 return true 2377 } 2378 } 2379 func rewriteValuePPC64_OpLess8(v *Value) bool { 2380 v_1 := v.Args[1] 2381 v_0 := v.Args[0] 2382 b := v.Block 2383 typ := &b.Func.Config.Types 2384 // match: (Less8 x y) 2385 // result: (LessThan (CMPW (SignExt8to32 x) (SignExt8to32 y))) 2386 for { 2387 x := v_0 2388 y := v_1 2389 v.reset(OpPPC64LessThan) 2390 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 2391 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 2392 v1.AddArg(x) 2393 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 2394 v2.AddArg(y) 2395 v0.AddArg2(v1, v2) 2396 v.AddArg(v0) 2397 return true 2398 } 2399 } 2400 func rewriteValuePPC64_OpLess8U(v *Value) bool { 2401 v_1 := v.Args[1] 2402 v_0 := v.Args[0] 2403 b := v.Block 2404 typ := &b.Func.Config.Types 2405 // match: (Less8U x y) 2406 // result: (LessThan (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y))) 2407 for { 2408 x := v_0 2409 y := v_1 2410 v.reset(OpPPC64LessThan) 2411 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags) 2412 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 2413 v1.AddArg(x) 2414 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 2415 v2.AddArg(y) 2416 v0.AddArg2(v1, v2) 2417 v.AddArg(v0) 2418 return true 2419 } 2420 } 2421 func rewriteValuePPC64_OpLoad(v *Value) bool { 2422 v_1 := v.Args[1] 2423 v_0 := v.Args[0] 2424 b := v.Block 2425 typ := &b.Func.Config.Types 2426 // match: (Load <t> ptr mem) 2427 // cond: (is64BitInt(t) || isPtr(t)) 2428 // result: (MOVDload ptr mem) 2429 for { 2430 t := v.Type 2431 ptr := v_0 2432 mem := v_1 2433 if !(is64BitInt(t) || isPtr(t)) { 2434 break 2435 } 2436 v.reset(OpPPC64MOVDload) 2437 v.AddArg2(ptr, mem) 2438 return true 2439 } 2440 // match: (Load <t> ptr mem) 2441 // cond: is32BitInt(t) && t.IsSigned() 2442 // result: (MOVWload ptr mem) 2443 for { 2444 t := v.Type 2445 ptr := v_0 2446 mem := v_1 2447 if !(is32BitInt(t) && t.IsSigned()) { 2448 break 2449 } 2450 v.reset(OpPPC64MOVWload) 2451 v.AddArg2(ptr, mem) 2452 return true 2453 } 2454 // match: (Load <t> ptr mem) 2455 // cond: is32BitInt(t) && !t.IsSigned() 2456 // result: (MOVWZload ptr mem) 2457 for { 2458 t := v.Type 2459 ptr := v_0 2460 mem := v_1 2461 if !(is32BitInt(t) && !t.IsSigned()) { 2462 break 2463 } 2464 v.reset(OpPPC64MOVWZload) 2465 v.AddArg2(ptr, mem) 2466 return true 2467 } 2468 // match: (Load <t> ptr mem) 2469 // cond: is16BitInt(t) && t.IsSigned() 2470 // result: (MOVHload ptr mem) 2471 for { 2472 t := v.Type 2473 ptr := v_0 2474 mem := v_1 2475 if !(is16BitInt(t) && t.IsSigned()) { 2476 break 2477 } 2478 v.reset(OpPPC64MOVHload) 2479 v.AddArg2(ptr, mem) 2480 return true 2481 } 2482 // match: (Load <t> ptr mem) 2483 // cond: is16BitInt(t) && !t.IsSigned() 2484 // result: (MOVHZload ptr mem) 2485 for { 2486 t := v.Type 2487 ptr := v_0 2488 mem := v_1 2489 if !(is16BitInt(t) && !t.IsSigned()) { 2490 break 2491 } 2492 v.reset(OpPPC64MOVHZload) 2493 v.AddArg2(ptr, mem) 2494 return true 2495 } 2496 // match: (Load <t> ptr mem) 2497 // cond: t.IsBoolean() 2498 // result: (MOVBZload ptr mem) 2499 for { 2500 t := v.Type 2501 ptr := v_0 2502 mem := v_1 2503 if !(t.IsBoolean()) { 2504 break 2505 } 2506 v.reset(OpPPC64MOVBZload) 2507 v.AddArg2(ptr, mem) 2508 return true 2509 } 2510 // match: (Load <t> ptr mem) 2511 // cond: is8BitInt(t) && t.IsSigned() 2512 // result: (MOVBreg (MOVBZload ptr mem)) 2513 for { 2514 t := v.Type 2515 ptr := v_0 2516 mem := v_1 2517 if !(is8BitInt(t) && t.IsSigned()) { 2518 break 2519 } 2520 v.reset(OpPPC64MOVBreg) 2521 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8) 2522 v0.AddArg2(ptr, mem) 2523 v.AddArg(v0) 2524 return true 2525 } 2526 // match: (Load <t> ptr mem) 2527 // cond: is8BitInt(t) && !t.IsSigned() 2528 // result: (MOVBZload ptr mem) 2529 for { 2530 t := v.Type 2531 ptr := v_0 2532 mem := v_1 2533 if !(is8BitInt(t) && !t.IsSigned()) { 2534 break 2535 } 2536 v.reset(OpPPC64MOVBZload) 2537 v.AddArg2(ptr, mem) 2538 return true 2539 } 2540 // match: (Load <t> ptr mem) 2541 // cond: is32BitFloat(t) 2542 // result: (FMOVSload ptr mem) 2543 for { 2544 t := v.Type 2545 ptr := v_0 2546 mem := v_1 2547 if !(is32BitFloat(t)) { 2548 break 2549 } 2550 v.reset(OpPPC64FMOVSload) 2551 v.AddArg2(ptr, mem) 2552 return true 2553 } 2554 // match: (Load <t> ptr mem) 2555 // cond: is64BitFloat(t) 2556 // result: (FMOVDload ptr mem) 2557 for { 2558 t := v.Type 2559 ptr := v_0 2560 mem := v_1 2561 if !(is64BitFloat(t)) { 2562 break 2563 } 2564 v.reset(OpPPC64FMOVDload) 2565 v.AddArg2(ptr, mem) 2566 return true 2567 } 2568 return false 2569 } 2570 func rewriteValuePPC64_OpLocalAddr(v *Value) bool { 2571 v_1 := v.Args[1] 2572 v_0 := v.Args[0] 2573 b := v.Block 2574 typ := &b.Func.Config.Types 2575 // match: (LocalAddr <t> {sym} base mem) 2576 // cond: t.Elem().HasPointers() 2577 // result: (MOVDaddr {sym} (SPanchored base mem)) 2578 for { 2579 t := v.Type 2580 sym := auxToSym(v.Aux) 2581 base := v_0 2582 mem := v_1 2583 if !(t.Elem().HasPointers()) { 2584 break 2585 } 2586 v.reset(OpPPC64MOVDaddr) 2587 v.Aux = symToAux(sym) 2588 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr) 2589 v0.AddArg2(base, mem) 2590 v.AddArg(v0) 2591 return true 2592 } 2593 // match: (LocalAddr <t> {sym} base _) 2594 // cond: !t.Elem().HasPointers() 2595 // result: (MOVDaddr {sym} base) 2596 for { 2597 t := v.Type 2598 sym := auxToSym(v.Aux) 2599 base := v_0 2600 if !(!t.Elem().HasPointers()) { 2601 break 2602 } 2603 v.reset(OpPPC64MOVDaddr) 2604 v.Aux = symToAux(sym) 2605 v.AddArg(base) 2606 return true 2607 } 2608 return false 2609 } 2610 func rewriteValuePPC64_OpLsh16x16(v *Value) bool { 2611 v_1 := v.Args[1] 2612 v_0 := v.Args[0] 2613 b := v.Block 2614 typ := &b.Func.Config.Types 2615 // match: (Lsh16x16 x y) 2616 // cond: shiftIsBounded(v) 2617 // result: (SLD x y) 2618 for { 2619 x := v_0 2620 y := v_1 2621 if !(shiftIsBounded(v)) { 2622 break 2623 } 2624 v.reset(OpPPC64SLD) 2625 v.AddArg2(x, y) 2626 return true 2627 } 2628 // match: (Lsh16x16 <t> x y) 2629 // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y))) 2630 for { 2631 t := v.Type 2632 x := v_0 2633 y := v_1 2634 v.reset(OpPPC64ISEL) 2635 v.AuxInt = int32ToAuxInt(2) 2636 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 2637 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 2638 v1.AddArg(x) 2639 v0.AddArg2(v1, y) 2640 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 2641 v2.AuxInt = int64ToAuxInt(0) 2642 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 2643 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 2644 v4.AuxInt = int64ToAuxInt(0xFFF0) 2645 v4.AddArg(y) 2646 v3.AddArg(v4) 2647 v.AddArg3(v0, v2, v3) 2648 return true 2649 } 2650 } 2651 func rewriteValuePPC64_OpLsh16x32(v *Value) bool { 2652 v_1 := v.Args[1] 2653 v_0 := v.Args[0] 2654 b := v.Block 2655 typ := &b.Func.Config.Types 2656 // match: (Lsh16x32 x y) 2657 // cond: shiftIsBounded(v) 2658 // result: (SLD x y) 2659 for { 2660 x := v_0 2661 y := v_1 2662 if !(shiftIsBounded(v)) { 2663 break 2664 } 2665 v.reset(OpPPC64SLD) 2666 v.AddArg2(x, y) 2667 return true 2668 } 2669 // match: (Lsh16x32 <t> x y) 2670 // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16])) 2671 for { 2672 t := v.Type 2673 x := v_0 2674 y := v_1 2675 v.reset(OpPPC64ISEL) 2676 v.AuxInt = int32ToAuxInt(0) 2677 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 2678 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 2679 v1.AddArg(x) 2680 v0.AddArg2(v1, y) 2681 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 2682 v2.AuxInt = int64ToAuxInt(0) 2683 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 2684 v3.AuxInt = int32ToAuxInt(16) 2685 v3.AddArg(y) 2686 v.AddArg3(v0, v2, v3) 2687 return true 2688 } 2689 } 2690 func rewriteValuePPC64_OpLsh16x64(v *Value) bool { 2691 v_1 := v.Args[1] 2692 v_0 := v.Args[0] 2693 b := v.Block 2694 typ := &b.Func.Config.Types 2695 // match: (Lsh16x64 x (MOVDconst [c])) 2696 // cond: uint64(c) < 16 2697 // result: (SLWconst x [c]) 2698 for { 2699 x := v_0 2700 if v_1.Op != OpPPC64MOVDconst { 2701 break 2702 } 2703 c := auxIntToInt64(v_1.AuxInt) 2704 if !(uint64(c) < 16) { 2705 break 2706 } 2707 v.reset(OpPPC64SLWconst) 2708 v.AuxInt = int64ToAuxInt(c) 2709 v.AddArg(x) 2710 return true 2711 } 2712 // match: (Lsh16x64 x y) 2713 // cond: shiftIsBounded(v) 2714 // result: (SLD x y) 2715 for { 2716 x := v_0 2717 y := v_1 2718 if !(shiftIsBounded(v)) { 2719 break 2720 } 2721 v.reset(OpPPC64SLD) 2722 v.AddArg2(x, y) 2723 return true 2724 } 2725 // match: (Lsh16x64 <t> x y) 2726 // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16])) 2727 for { 2728 t := v.Type 2729 x := v_0 2730 y := v_1 2731 v.reset(OpPPC64ISEL) 2732 v.AuxInt = int32ToAuxInt(0) 2733 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 2734 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 2735 v1.AddArg(x) 2736 v0.AddArg2(v1, y) 2737 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 2738 v2.AuxInt = int64ToAuxInt(0) 2739 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 2740 v3.AuxInt = int64ToAuxInt(16) 2741 v3.AddArg(y) 2742 v.AddArg3(v0, v2, v3) 2743 return true 2744 } 2745 } 2746 func rewriteValuePPC64_OpLsh16x8(v *Value) bool { 2747 v_1 := v.Args[1] 2748 v_0 := v.Args[0] 2749 b := v.Block 2750 typ := &b.Func.Config.Types 2751 // match: (Lsh16x8 x y) 2752 // cond: shiftIsBounded(v) 2753 // result: (SLD x y) 2754 for { 2755 x := v_0 2756 y := v_1 2757 if !(shiftIsBounded(v)) { 2758 break 2759 } 2760 v.reset(OpPPC64SLD) 2761 v.AddArg2(x, y) 2762 return true 2763 } 2764 // match: (Lsh16x8 <t> x y) 2765 // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y))) 2766 for { 2767 t := v.Type 2768 x := v_0 2769 y := v_1 2770 v.reset(OpPPC64ISEL) 2771 v.AuxInt = int32ToAuxInt(2) 2772 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 2773 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 2774 v1.AddArg(x) 2775 v0.AddArg2(v1, y) 2776 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 2777 v2.AuxInt = int64ToAuxInt(0) 2778 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 2779 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 2780 v4.AuxInt = int64ToAuxInt(0x00F0) 2781 v4.AddArg(y) 2782 v3.AddArg(v4) 2783 v.AddArg3(v0, v2, v3) 2784 return true 2785 } 2786 } 2787 func rewriteValuePPC64_OpLsh32x16(v *Value) bool { 2788 v_1 := v.Args[1] 2789 v_0 := v.Args[0] 2790 b := v.Block 2791 typ := &b.Func.Config.Types 2792 // match: (Lsh32x16 x y) 2793 // cond: shiftIsBounded(v) 2794 // result: (SLW x y) 2795 for { 2796 x := v_0 2797 y := v_1 2798 if !(shiftIsBounded(v)) { 2799 break 2800 } 2801 v.reset(OpPPC64SLW) 2802 v.AddArg2(x, y) 2803 return true 2804 } 2805 // match: (Lsh32x16 <t> x y) 2806 // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y))) 2807 for { 2808 t := v.Type 2809 x := v_0 2810 y := v_1 2811 v.reset(OpPPC64ISEL) 2812 v.AuxInt = int32ToAuxInt(2) 2813 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t) 2814 v0.AddArg2(x, y) 2815 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 2816 v1.AuxInt = int64ToAuxInt(0) 2817 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 2818 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 2819 v3.AuxInt = int64ToAuxInt(0xFFE0) 2820 v3.AddArg(y) 2821 v2.AddArg(v3) 2822 v.AddArg3(v0, v1, v2) 2823 return true 2824 } 2825 } 2826 func rewriteValuePPC64_OpLsh32x32(v *Value) bool { 2827 v_1 := v.Args[1] 2828 v_0 := v.Args[0] 2829 b := v.Block 2830 typ := &b.Func.Config.Types 2831 // match: (Lsh32x32 x y) 2832 // cond: shiftIsBounded(v) 2833 // result: (SLW x y) 2834 for { 2835 x := v_0 2836 y := v_1 2837 if !(shiftIsBounded(v)) { 2838 break 2839 } 2840 v.reset(OpPPC64SLW) 2841 v.AddArg2(x, y) 2842 return true 2843 } 2844 // match: (Lsh32x32 <t> x y) 2845 // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [32])) 2846 for { 2847 t := v.Type 2848 x := v_0 2849 y := v_1 2850 v.reset(OpPPC64ISEL) 2851 v.AuxInt = int32ToAuxInt(0) 2852 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t) 2853 v0.AddArg2(x, y) 2854 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 2855 v1.AuxInt = int64ToAuxInt(0) 2856 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 2857 v2.AuxInt = int32ToAuxInt(32) 2858 v2.AddArg(y) 2859 v.AddArg3(v0, v1, v2) 2860 return true 2861 } 2862 } 2863 func rewriteValuePPC64_OpLsh32x64(v *Value) bool { 2864 v_1 := v.Args[1] 2865 v_0 := v.Args[0] 2866 b := v.Block 2867 typ := &b.Func.Config.Types 2868 // match: (Lsh32x64 x (MOVDconst [c])) 2869 // cond: uint64(c) < 32 2870 // result: (SLWconst x [c]) 2871 for { 2872 x := v_0 2873 if v_1.Op != OpPPC64MOVDconst { 2874 break 2875 } 2876 c := auxIntToInt64(v_1.AuxInt) 2877 if !(uint64(c) < 32) { 2878 break 2879 } 2880 v.reset(OpPPC64SLWconst) 2881 v.AuxInt = int64ToAuxInt(c) 2882 v.AddArg(x) 2883 return true 2884 } 2885 // match: (Lsh32x64 x y) 2886 // cond: shiftIsBounded(v) 2887 // result: (SLW x y) 2888 for { 2889 x := v_0 2890 y := v_1 2891 if !(shiftIsBounded(v)) { 2892 break 2893 } 2894 v.reset(OpPPC64SLW) 2895 v.AddArg2(x, y) 2896 return true 2897 } 2898 // match: (Lsh32x64 <t> x y) 2899 // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [32])) 2900 for { 2901 t := v.Type 2902 x := v_0 2903 y := v_1 2904 v.reset(OpPPC64ISEL) 2905 v.AuxInt = int32ToAuxInt(0) 2906 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t) 2907 v0.AddArg2(x, y) 2908 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 2909 v1.AuxInt = int64ToAuxInt(0) 2910 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 2911 v2.AuxInt = int64ToAuxInt(32) 2912 v2.AddArg(y) 2913 v.AddArg3(v0, v1, v2) 2914 return true 2915 } 2916 } 2917 func rewriteValuePPC64_OpLsh32x8(v *Value) bool { 2918 v_1 := v.Args[1] 2919 v_0 := v.Args[0] 2920 b := v.Block 2921 typ := &b.Func.Config.Types 2922 // match: (Lsh32x8 x y) 2923 // cond: shiftIsBounded(v) 2924 // result: (SLW x y) 2925 for { 2926 x := v_0 2927 y := v_1 2928 if !(shiftIsBounded(v)) { 2929 break 2930 } 2931 v.reset(OpPPC64SLW) 2932 v.AddArg2(x, y) 2933 return true 2934 } 2935 // match: (Lsh32x8 <t> x y) 2936 // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y))) 2937 for { 2938 t := v.Type 2939 x := v_0 2940 y := v_1 2941 v.reset(OpPPC64ISEL) 2942 v.AuxInt = int32ToAuxInt(2) 2943 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t) 2944 v0.AddArg2(x, y) 2945 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 2946 v1.AuxInt = int64ToAuxInt(0) 2947 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 2948 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 2949 v3.AuxInt = int64ToAuxInt(0x00E0) 2950 v3.AddArg(y) 2951 v2.AddArg(v3) 2952 v.AddArg3(v0, v1, v2) 2953 return true 2954 } 2955 } 2956 func rewriteValuePPC64_OpLsh64x16(v *Value) bool { 2957 v_1 := v.Args[1] 2958 v_0 := v.Args[0] 2959 b := v.Block 2960 typ := &b.Func.Config.Types 2961 // match: (Lsh64x16 x y) 2962 // cond: shiftIsBounded(v) 2963 // result: (SLD x y) 2964 for { 2965 x := v_0 2966 y := v_1 2967 if !(shiftIsBounded(v)) { 2968 break 2969 } 2970 v.reset(OpPPC64SLD) 2971 v.AddArg2(x, y) 2972 return true 2973 } 2974 // match: (Lsh64x16 <t> x y) 2975 // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y))) 2976 for { 2977 t := v.Type 2978 x := v_0 2979 y := v_1 2980 v.reset(OpPPC64ISEL) 2981 v.AuxInt = int32ToAuxInt(2) 2982 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 2983 v0.AddArg2(x, y) 2984 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 2985 v1.AuxInt = int64ToAuxInt(0) 2986 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 2987 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 2988 v3.AuxInt = int64ToAuxInt(0xFFC0) 2989 v3.AddArg(y) 2990 v2.AddArg(v3) 2991 v.AddArg3(v0, v1, v2) 2992 return true 2993 } 2994 } 2995 func rewriteValuePPC64_OpLsh64x32(v *Value) bool { 2996 v_1 := v.Args[1] 2997 v_0 := v.Args[0] 2998 b := v.Block 2999 typ := &b.Func.Config.Types 3000 // match: (Lsh64x32 x y) 3001 // cond: shiftIsBounded(v) 3002 // result: (SLD x y) 3003 for { 3004 x := v_0 3005 y := v_1 3006 if !(shiftIsBounded(v)) { 3007 break 3008 } 3009 v.reset(OpPPC64SLD) 3010 v.AddArg2(x, y) 3011 return true 3012 } 3013 // match: (Lsh64x32 <t> x y) 3014 // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 3015 for { 3016 t := v.Type 3017 x := v_0 3018 y := v_1 3019 v.reset(OpPPC64ISEL) 3020 v.AuxInt = int32ToAuxInt(0) 3021 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 3022 v0.AddArg2(x, y) 3023 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 3024 v1.AuxInt = int64ToAuxInt(0) 3025 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 3026 v2.AuxInt = int32ToAuxInt(64) 3027 v2.AddArg(y) 3028 v.AddArg3(v0, v1, v2) 3029 return true 3030 } 3031 } 3032 func rewriteValuePPC64_OpLsh64x64(v *Value) bool { 3033 v_1 := v.Args[1] 3034 v_0 := v.Args[0] 3035 b := v.Block 3036 typ := &b.Func.Config.Types 3037 // match: (Lsh64x64 x (MOVDconst [c])) 3038 // cond: uint64(c) < 64 3039 // result: (SLDconst x [c]) 3040 for { 3041 x := v_0 3042 if v_1.Op != OpPPC64MOVDconst { 3043 break 3044 } 3045 c := auxIntToInt64(v_1.AuxInt) 3046 if !(uint64(c) < 64) { 3047 break 3048 } 3049 v.reset(OpPPC64SLDconst) 3050 v.AuxInt = int64ToAuxInt(c) 3051 v.AddArg(x) 3052 return true 3053 } 3054 // match: (Lsh64x64 x y) 3055 // cond: shiftIsBounded(v) 3056 // result: (SLD x y) 3057 for { 3058 x := v_0 3059 y := v_1 3060 if !(shiftIsBounded(v)) { 3061 break 3062 } 3063 v.reset(OpPPC64SLD) 3064 v.AddArg2(x, y) 3065 return true 3066 } 3067 // match: (Lsh64x64 <t> x y) 3068 // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 3069 for { 3070 t := v.Type 3071 x := v_0 3072 y := v_1 3073 v.reset(OpPPC64ISEL) 3074 v.AuxInt = int32ToAuxInt(0) 3075 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 3076 v0.AddArg2(x, y) 3077 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 3078 v1.AuxInt = int64ToAuxInt(0) 3079 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 3080 v2.AuxInt = int64ToAuxInt(64) 3081 v2.AddArg(y) 3082 v.AddArg3(v0, v1, v2) 3083 return true 3084 } 3085 } 3086 func rewriteValuePPC64_OpLsh64x8(v *Value) bool { 3087 v_1 := v.Args[1] 3088 v_0 := v.Args[0] 3089 b := v.Block 3090 typ := &b.Func.Config.Types 3091 // match: (Lsh64x8 x y) 3092 // cond: shiftIsBounded(v) 3093 // result: (SLD x y) 3094 for { 3095 x := v_0 3096 y := v_1 3097 if !(shiftIsBounded(v)) { 3098 break 3099 } 3100 v.reset(OpPPC64SLD) 3101 v.AddArg2(x, y) 3102 return true 3103 } 3104 // match: (Lsh64x8 <t> x y) 3105 // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y))) 3106 for { 3107 t := v.Type 3108 x := v_0 3109 y := v_1 3110 v.reset(OpPPC64ISEL) 3111 v.AuxInt = int32ToAuxInt(2) 3112 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 3113 v0.AddArg2(x, y) 3114 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 3115 v1.AuxInt = int64ToAuxInt(0) 3116 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 3117 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 3118 v3.AuxInt = int64ToAuxInt(0x00C0) 3119 v3.AddArg(y) 3120 v2.AddArg(v3) 3121 v.AddArg3(v0, v1, v2) 3122 return true 3123 } 3124 } 3125 func rewriteValuePPC64_OpLsh8x16(v *Value) bool { 3126 v_1 := v.Args[1] 3127 v_0 := v.Args[0] 3128 b := v.Block 3129 typ := &b.Func.Config.Types 3130 // match: (Lsh8x16 x y) 3131 // cond: shiftIsBounded(v) 3132 // result: (SLD x y) 3133 for { 3134 x := v_0 3135 y := v_1 3136 if !(shiftIsBounded(v)) { 3137 break 3138 } 3139 v.reset(OpPPC64SLD) 3140 v.AddArg2(x, y) 3141 return true 3142 } 3143 // match: (Lsh8x16 <t> x y) 3144 // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y))) 3145 for { 3146 t := v.Type 3147 x := v_0 3148 y := v_1 3149 v.reset(OpPPC64ISEL) 3150 v.AuxInt = int32ToAuxInt(2) 3151 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 3152 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 3153 v1.AddArg(x) 3154 v0.AddArg2(v1, y) 3155 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 3156 v2.AuxInt = int64ToAuxInt(0) 3157 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 3158 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 3159 v4.AuxInt = int64ToAuxInt(0xFFF8) 3160 v4.AddArg(y) 3161 v3.AddArg(v4) 3162 v.AddArg3(v0, v2, v3) 3163 return true 3164 } 3165 } 3166 func rewriteValuePPC64_OpLsh8x32(v *Value) bool { 3167 v_1 := v.Args[1] 3168 v_0 := v.Args[0] 3169 b := v.Block 3170 typ := &b.Func.Config.Types 3171 // match: (Lsh8x32 x y) 3172 // cond: shiftIsBounded(v) 3173 // result: (SLD x y) 3174 for { 3175 x := v_0 3176 y := v_1 3177 if !(shiftIsBounded(v)) { 3178 break 3179 } 3180 v.reset(OpPPC64SLD) 3181 v.AddArg2(x, y) 3182 return true 3183 } 3184 // match: (Lsh8x32 <t> x y) 3185 // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8])) 3186 for { 3187 t := v.Type 3188 x := v_0 3189 y := v_1 3190 v.reset(OpPPC64ISEL) 3191 v.AuxInt = int32ToAuxInt(0) 3192 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 3193 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 3194 v1.AddArg(x) 3195 v0.AddArg2(v1, y) 3196 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 3197 v2.AuxInt = int64ToAuxInt(0) 3198 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 3199 v3.AuxInt = int32ToAuxInt(8) 3200 v3.AddArg(y) 3201 v.AddArg3(v0, v2, v3) 3202 return true 3203 } 3204 } 3205 func rewriteValuePPC64_OpLsh8x64(v *Value) bool { 3206 v_1 := v.Args[1] 3207 v_0 := v.Args[0] 3208 b := v.Block 3209 typ := &b.Func.Config.Types 3210 // match: (Lsh8x64 x (MOVDconst [c])) 3211 // cond: uint64(c) < 8 3212 // result: (SLWconst x [c]) 3213 for { 3214 x := v_0 3215 if v_1.Op != OpPPC64MOVDconst { 3216 break 3217 } 3218 c := auxIntToInt64(v_1.AuxInt) 3219 if !(uint64(c) < 8) { 3220 break 3221 } 3222 v.reset(OpPPC64SLWconst) 3223 v.AuxInt = int64ToAuxInt(c) 3224 v.AddArg(x) 3225 return true 3226 } 3227 // match: (Lsh8x64 x y) 3228 // cond: shiftIsBounded(v) 3229 // result: (SLD x y) 3230 for { 3231 x := v_0 3232 y := v_1 3233 if !(shiftIsBounded(v)) { 3234 break 3235 } 3236 v.reset(OpPPC64SLD) 3237 v.AddArg2(x, y) 3238 return true 3239 } 3240 // match: (Lsh8x64 <t> x y) 3241 // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8])) 3242 for { 3243 t := v.Type 3244 x := v_0 3245 y := v_1 3246 v.reset(OpPPC64ISEL) 3247 v.AuxInt = int32ToAuxInt(0) 3248 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 3249 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 3250 v1.AddArg(x) 3251 v0.AddArg2(v1, y) 3252 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 3253 v2.AuxInt = int64ToAuxInt(0) 3254 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 3255 v3.AuxInt = int64ToAuxInt(8) 3256 v3.AddArg(y) 3257 v.AddArg3(v0, v2, v3) 3258 return true 3259 } 3260 } 3261 func rewriteValuePPC64_OpLsh8x8(v *Value) bool { 3262 v_1 := v.Args[1] 3263 v_0 := v.Args[0] 3264 b := v.Block 3265 typ := &b.Func.Config.Types 3266 // match: (Lsh8x8 x y) 3267 // cond: shiftIsBounded(v) 3268 // result: (SLD x y) 3269 for { 3270 x := v_0 3271 y := v_1 3272 if !(shiftIsBounded(v)) { 3273 break 3274 } 3275 v.reset(OpPPC64SLD) 3276 v.AddArg2(x, y) 3277 return true 3278 } 3279 // match: (Lsh8x8 <t> x y) 3280 // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y))) 3281 for { 3282 t := v.Type 3283 x := v_0 3284 y := v_1 3285 v.reset(OpPPC64ISEL) 3286 v.AuxInt = int32ToAuxInt(2) 3287 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t) 3288 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 3289 v1.AddArg(x) 3290 v0.AddArg2(v1, y) 3291 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 3292 v2.AuxInt = int64ToAuxInt(0) 3293 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 3294 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 3295 v4.AuxInt = int64ToAuxInt(0x00F8) 3296 v4.AddArg(y) 3297 v3.AddArg(v4) 3298 v.AddArg3(v0, v2, v3) 3299 return true 3300 } 3301 } 3302 func rewriteValuePPC64_OpMod16(v *Value) bool { 3303 v_1 := v.Args[1] 3304 v_0 := v.Args[0] 3305 b := v.Block 3306 typ := &b.Func.Config.Types 3307 // match: (Mod16 x y) 3308 // result: (Mod32 (SignExt16to32 x) (SignExt16to32 y)) 3309 for { 3310 x := v_0 3311 y := v_1 3312 v.reset(OpMod32) 3313 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 3314 v0.AddArg(x) 3315 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 3316 v1.AddArg(y) 3317 v.AddArg2(v0, v1) 3318 return true 3319 } 3320 } 3321 func rewriteValuePPC64_OpMod16u(v *Value) bool { 3322 v_1 := v.Args[1] 3323 v_0 := v.Args[0] 3324 b := v.Block 3325 typ := &b.Func.Config.Types 3326 // match: (Mod16u x y) 3327 // result: (Mod32u (ZeroExt16to32 x) (ZeroExt16to32 y)) 3328 for { 3329 x := v_0 3330 y := v_1 3331 v.reset(OpMod32u) 3332 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 3333 v0.AddArg(x) 3334 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 3335 v1.AddArg(y) 3336 v.AddArg2(v0, v1) 3337 return true 3338 } 3339 } 3340 func rewriteValuePPC64_OpMod32(v *Value) bool { 3341 v_1 := v.Args[1] 3342 v_0 := v.Args[0] 3343 b := v.Block 3344 typ := &b.Func.Config.Types 3345 // match: (Mod32 x y) 3346 // cond: buildcfg.GOPPC64 >= 9 3347 // result: (MODSW x y) 3348 for { 3349 x := v_0 3350 y := v_1 3351 if !(buildcfg.GOPPC64 >= 9) { 3352 break 3353 } 3354 v.reset(OpPPC64MODSW) 3355 v.AddArg2(x, y) 3356 return true 3357 } 3358 // match: (Mod32 x y) 3359 // cond: buildcfg.GOPPC64 <= 8 3360 // result: (SUB x (MULLW y (DIVW x y))) 3361 for { 3362 x := v_0 3363 y := v_1 3364 if !(buildcfg.GOPPC64 <= 8) { 3365 break 3366 } 3367 v.reset(OpPPC64SUB) 3368 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32) 3369 v1 := b.NewValue0(v.Pos, OpPPC64DIVW, typ.Int32) 3370 v1.AddArg2(x, y) 3371 v0.AddArg2(y, v1) 3372 v.AddArg2(x, v0) 3373 return true 3374 } 3375 return false 3376 } 3377 func rewriteValuePPC64_OpMod32u(v *Value) bool { 3378 v_1 := v.Args[1] 3379 v_0 := v.Args[0] 3380 b := v.Block 3381 typ := &b.Func.Config.Types 3382 // match: (Mod32u x y) 3383 // cond: buildcfg.GOPPC64 >= 9 3384 // result: (MODUW x y) 3385 for { 3386 x := v_0 3387 y := v_1 3388 if !(buildcfg.GOPPC64 >= 9) { 3389 break 3390 } 3391 v.reset(OpPPC64MODUW) 3392 v.AddArg2(x, y) 3393 return true 3394 } 3395 // match: (Mod32u x y) 3396 // cond: buildcfg.GOPPC64 <= 8 3397 // result: (SUB x (MULLW y (DIVWU x y))) 3398 for { 3399 x := v_0 3400 y := v_1 3401 if !(buildcfg.GOPPC64 <= 8) { 3402 break 3403 } 3404 v.reset(OpPPC64SUB) 3405 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32) 3406 v1 := b.NewValue0(v.Pos, OpPPC64DIVWU, typ.Int32) 3407 v1.AddArg2(x, y) 3408 v0.AddArg2(y, v1) 3409 v.AddArg2(x, v0) 3410 return true 3411 } 3412 return false 3413 } 3414 func rewriteValuePPC64_OpMod64(v *Value) bool { 3415 v_1 := v.Args[1] 3416 v_0 := v.Args[0] 3417 b := v.Block 3418 typ := &b.Func.Config.Types 3419 // match: (Mod64 x y) 3420 // cond: buildcfg.GOPPC64 >=9 3421 // result: (MODSD x y) 3422 for { 3423 x := v_0 3424 y := v_1 3425 if !(buildcfg.GOPPC64 >= 9) { 3426 break 3427 } 3428 v.reset(OpPPC64MODSD) 3429 v.AddArg2(x, y) 3430 return true 3431 } 3432 // match: (Mod64 x y) 3433 // cond: buildcfg.GOPPC64 <=8 3434 // result: (SUB x (MULLD y (DIVD x y))) 3435 for { 3436 x := v_0 3437 y := v_1 3438 if !(buildcfg.GOPPC64 <= 8) { 3439 break 3440 } 3441 v.reset(OpPPC64SUB) 3442 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64) 3443 v1 := b.NewValue0(v.Pos, OpPPC64DIVD, typ.Int64) 3444 v1.AddArg2(x, y) 3445 v0.AddArg2(y, v1) 3446 v.AddArg2(x, v0) 3447 return true 3448 } 3449 return false 3450 } 3451 func rewriteValuePPC64_OpMod64u(v *Value) bool { 3452 v_1 := v.Args[1] 3453 v_0 := v.Args[0] 3454 b := v.Block 3455 typ := &b.Func.Config.Types 3456 // match: (Mod64u x y) 3457 // cond: buildcfg.GOPPC64 >= 9 3458 // result: (MODUD x y) 3459 for { 3460 x := v_0 3461 y := v_1 3462 if !(buildcfg.GOPPC64 >= 9) { 3463 break 3464 } 3465 v.reset(OpPPC64MODUD) 3466 v.AddArg2(x, y) 3467 return true 3468 } 3469 // match: (Mod64u x y) 3470 // cond: buildcfg.GOPPC64 <= 8 3471 // result: (SUB x (MULLD y (DIVDU x y))) 3472 for { 3473 x := v_0 3474 y := v_1 3475 if !(buildcfg.GOPPC64 <= 8) { 3476 break 3477 } 3478 v.reset(OpPPC64SUB) 3479 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64) 3480 v1 := b.NewValue0(v.Pos, OpPPC64DIVDU, typ.Int64) 3481 v1.AddArg2(x, y) 3482 v0.AddArg2(y, v1) 3483 v.AddArg2(x, v0) 3484 return true 3485 } 3486 return false 3487 } 3488 func rewriteValuePPC64_OpMod8(v *Value) bool { 3489 v_1 := v.Args[1] 3490 v_0 := v.Args[0] 3491 b := v.Block 3492 typ := &b.Func.Config.Types 3493 // match: (Mod8 x y) 3494 // result: (Mod32 (SignExt8to32 x) (SignExt8to32 y)) 3495 for { 3496 x := v_0 3497 y := v_1 3498 v.reset(OpMod32) 3499 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 3500 v0.AddArg(x) 3501 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 3502 v1.AddArg(y) 3503 v.AddArg2(v0, v1) 3504 return true 3505 } 3506 } 3507 func rewriteValuePPC64_OpMod8u(v *Value) bool { 3508 v_1 := v.Args[1] 3509 v_0 := v.Args[0] 3510 b := v.Block 3511 typ := &b.Func.Config.Types 3512 // match: (Mod8u x y) 3513 // result: (Mod32u (ZeroExt8to32 x) (ZeroExt8to32 y)) 3514 for { 3515 x := v_0 3516 y := v_1 3517 v.reset(OpMod32u) 3518 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 3519 v0.AddArg(x) 3520 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 3521 v1.AddArg(y) 3522 v.AddArg2(v0, v1) 3523 return true 3524 } 3525 } 3526 func rewriteValuePPC64_OpMove(v *Value) bool { 3527 v_2 := v.Args[2] 3528 v_1 := v.Args[1] 3529 v_0 := v.Args[0] 3530 b := v.Block 3531 typ := &b.Func.Config.Types 3532 // match: (Move [0] _ _ mem) 3533 // result: mem 3534 for { 3535 if auxIntToInt64(v.AuxInt) != 0 { 3536 break 3537 } 3538 mem := v_2 3539 v.copyOf(mem) 3540 return true 3541 } 3542 // match: (Move [1] dst src mem) 3543 // result: (MOVBstore dst (MOVBZload src mem) mem) 3544 for { 3545 if auxIntToInt64(v.AuxInt) != 1 { 3546 break 3547 } 3548 dst := v_0 3549 src := v_1 3550 mem := v_2 3551 v.reset(OpPPC64MOVBstore) 3552 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8) 3553 v0.AddArg2(src, mem) 3554 v.AddArg3(dst, v0, mem) 3555 return true 3556 } 3557 // match: (Move [2] dst src mem) 3558 // result: (MOVHstore dst (MOVHZload src mem) mem) 3559 for { 3560 if auxIntToInt64(v.AuxInt) != 2 { 3561 break 3562 } 3563 dst := v_0 3564 src := v_1 3565 mem := v_2 3566 v.reset(OpPPC64MOVHstore) 3567 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16) 3568 v0.AddArg2(src, mem) 3569 v.AddArg3(dst, v0, mem) 3570 return true 3571 } 3572 // match: (Move [4] dst src mem) 3573 // result: (MOVWstore dst (MOVWZload src mem) mem) 3574 for { 3575 if auxIntToInt64(v.AuxInt) != 4 { 3576 break 3577 } 3578 dst := v_0 3579 src := v_1 3580 mem := v_2 3581 v.reset(OpPPC64MOVWstore) 3582 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32) 3583 v0.AddArg2(src, mem) 3584 v.AddArg3(dst, v0, mem) 3585 return true 3586 } 3587 // match: (Move [8] {t} dst src mem) 3588 // result: (MOVDstore dst (MOVDload src mem) mem) 3589 for { 3590 if auxIntToInt64(v.AuxInt) != 8 { 3591 break 3592 } 3593 dst := v_0 3594 src := v_1 3595 mem := v_2 3596 v.reset(OpPPC64MOVDstore) 3597 v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, typ.Int64) 3598 v0.AddArg2(src, mem) 3599 v.AddArg3(dst, v0, mem) 3600 return true 3601 } 3602 // match: (Move [3] dst src mem) 3603 // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHload src mem) mem)) 3604 for { 3605 if auxIntToInt64(v.AuxInt) != 3 { 3606 break 3607 } 3608 dst := v_0 3609 src := v_1 3610 mem := v_2 3611 v.reset(OpPPC64MOVBstore) 3612 v.AuxInt = int32ToAuxInt(2) 3613 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8) 3614 v0.AuxInt = int32ToAuxInt(2) 3615 v0.AddArg2(src, mem) 3616 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem) 3617 v2 := b.NewValue0(v.Pos, OpPPC64MOVHload, typ.Int16) 3618 v2.AddArg2(src, mem) 3619 v1.AddArg3(dst, v2, mem) 3620 v.AddArg3(dst, v0, v1) 3621 return true 3622 } 3623 // match: (Move [5] dst src mem) 3624 // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)) 3625 for { 3626 if auxIntToInt64(v.AuxInt) != 5 { 3627 break 3628 } 3629 dst := v_0 3630 src := v_1 3631 mem := v_2 3632 v.reset(OpPPC64MOVBstore) 3633 v.AuxInt = int32ToAuxInt(4) 3634 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8) 3635 v0.AuxInt = int32ToAuxInt(4) 3636 v0.AddArg2(src, mem) 3637 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem) 3638 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32) 3639 v2.AddArg2(src, mem) 3640 v1.AddArg3(dst, v2, mem) 3641 v.AddArg3(dst, v0, v1) 3642 return true 3643 } 3644 // match: (Move [6] dst src mem) 3645 // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)) 3646 for { 3647 if auxIntToInt64(v.AuxInt) != 6 { 3648 break 3649 } 3650 dst := v_0 3651 src := v_1 3652 mem := v_2 3653 v.reset(OpPPC64MOVHstore) 3654 v.AuxInt = int32ToAuxInt(4) 3655 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16) 3656 v0.AuxInt = int32ToAuxInt(4) 3657 v0.AddArg2(src, mem) 3658 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem) 3659 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32) 3660 v2.AddArg2(src, mem) 3661 v1.AddArg3(dst, v2, mem) 3662 v.AddArg3(dst, v0, v1) 3663 return true 3664 } 3665 // match: (Move [7] dst src mem) 3666 // result: (MOVBstore [6] dst (MOVBZload [6] src mem) (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))) 3667 for { 3668 if auxIntToInt64(v.AuxInt) != 7 { 3669 break 3670 } 3671 dst := v_0 3672 src := v_1 3673 mem := v_2 3674 v.reset(OpPPC64MOVBstore) 3675 v.AuxInt = int32ToAuxInt(6) 3676 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8) 3677 v0.AuxInt = int32ToAuxInt(6) 3678 v0.AddArg2(src, mem) 3679 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem) 3680 v1.AuxInt = int32ToAuxInt(4) 3681 v2 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16) 3682 v2.AuxInt = int32ToAuxInt(4) 3683 v2.AddArg2(src, mem) 3684 v3 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem) 3685 v4 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32) 3686 v4.AddArg2(src, mem) 3687 v3.AddArg3(dst, v4, mem) 3688 v1.AddArg3(dst, v2, v3) 3689 v.AddArg3(dst, v0, v1) 3690 return true 3691 } 3692 // match: (Move [s] dst src mem) 3693 // cond: s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s) 3694 // result: (LoweredMove [s] dst src mem) 3695 for { 3696 s := auxIntToInt64(v.AuxInt) 3697 dst := v_0 3698 src := v_1 3699 mem := v_2 3700 if !(s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s)) { 3701 break 3702 } 3703 v.reset(OpPPC64LoweredMove) 3704 v.AuxInt = int64ToAuxInt(s) 3705 v.AddArg3(dst, src, mem) 3706 return true 3707 } 3708 // match: (Move [s] dst src mem) 3709 // cond: s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9 3710 // result: (LoweredQuadMoveShort [s] dst src mem) 3711 for { 3712 s := auxIntToInt64(v.AuxInt) 3713 dst := v_0 3714 src := v_1 3715 mem := v_2 3716 if !(s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9) { 3717 break 3718 } 3719 v.reset(OpPPC64LoweredQuadMoveShort) 3720 v.AuxInt = int64ToAuxInt(s) 3721 v.AddArg3(dst, src, mem) 3722 return true 3723 } 3724 // match: (Move [s] dst src mem) 3725 // cond: s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s) 3726 // result: (LoweredQuadMove [s] dst src mem) 3727 for { 3728 s := auxIntToInt64(v.AuxInt) 3729 dst := v_0 3730 src := v_1 3731 mem := v_2 3732 if !(s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s)) { 3733 break 3734 } 3735 v.reset(OpPPC64LoweredQuadMove) 3736 v.AuxInt = int64ToAuxInt(s) 3737 v.AddArg3(dst, src, mem) 3738 return true 3739 } 3740 return false 3741 } 3742 func rewriteValuePPC64_OpNeq16(v *Value) bool { 3743 v_1 := v.Args[1] 3744 v_0 := v.Args[0] 3745 b := v.Block 3746 typ := &b.Func.Config.Types 3747 // match: (Neq16 x y) 3748 // cond: x.Type.IsSigned() && y.Type.IsSigned() 3749 // result: (NotEqual (CMPW (SignExt16to32 x) (SignExt16to32 y))) 3750 for { 3751 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 3752 x := v_0 3753 y := v_1 3754 if !(x.Type.IsSigned() && y.Type.IsSigned()) { 3755 continue 3756 } 3757 v.reset(OpPPC64NotEqual) 3758 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 3759 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 3760 v1.AddArg(x) 3761 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 3762 v2.AddArg(y) 3763 v0.AddArg2(v1, v2) 3764 v.AddArg(v0) 3765 return true 3766 } 3767 break 3768 } 3769 // match: (Neq16 x y) 3770 // result: (NotEqual (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y))) 3771 for { 3772 x := v_0 3773 y := v_1 3774 v.reset(OpPPC64NotEqual) 3775 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 3776 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 3777 v1.AddArg(x) 3778 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 3779 v2.AddArg(y) 3780 v0.AddArg2(v1, v2) 3781 v.AddArg(v0) 3782 return true 3783 } 3784 } 3785 func rewriteValuePPC64_OpNeq32(v *Value) bool { 3786 v_1 := v.Args[1] 3787 v_0 := v.Args[0] 3788 b := v.Block 3789 // match: (Neq32 x y) 3790 // result: (NotEqual (CMPW x y)) 3791 for { 3792 x := v_0 3793 y := v_1 3794 v.reset(OpPPC64NotEqual) 3795 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 3796 v0.AddArg2(x, y) 3797 v.AddArg(v0) 3798 return true 3799 } 3800 } 3801 func rewriteValuePPC64_OpNeq32F(v *Value) bool { 3802 v_1 := v.Args[1] 3803 v_0 := v.Args[0] 3804 b := v.Block 3805 // match: (Neq32F x y) 3806 // result: (NotEqual (FCMPU x y)) 3807 for { 3808 x := v_0 3809 y := v_1 3810 v.reset(OpPPC64NotEqual) 3811 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags) 3812 v0.AddArg2(x, y) 3813 v.AddArg(v0) 3814 return true 3815 } 3816 } 3817 func rewriteValuePPC64_OpNeq64(v *Value) bool { 3818 v_1 := v.Args[1] 3819 v_0 := v.Args[0] 3820 b := v.Block 3821 // match: (Neq64 x y) 3822 // result: (NotEqual (CMP x y)) 3823 for { 3824 x := v_0 3825 y := v_1 3826 v.reset(OpPPC64NotEqual) 3827 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags) 3828 v0.AddArg2(x, y) 3829 v.AddArg(v0) 3830 return true 3831 } 3832 } 3833 func rewriteValuePPC64_OpNeq64F(v *Value) bool { 3834 v_1 := v.Args[1] 3835 v_0 := v.Args[0] 3836 b := v.Block 3837 // match: (Neq64F x y) 3838 // result: (NotEqual (FCMPU x y)) 3839 for { 3840 x := v_0 3841 y := v_1 3842 v.reset(OpPPC64NotEqual) 3843 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags) 3844 v0.AddArg2(x, y) 3845 v.AddArg(v0) 3846 return true 3847 } 3848 } 3849 func rewriteValuePPC64_OpNeq8(v *Value) bool { 3850 v_1 := v.Args[1] 3851 v_0 := v.Args[0] 3852 b := v.Block 3853 typ := &b.Func.Config.Types 3854 // match: (Neq8 x y) 3855 // cond: x.Type.IsSigned() && y.Type.IsSigned() 3856 // result: (NotEqual (CMPW (SignExt8to32 x) (SignExt8to32 y))) 3857 for { 3858 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 3859 x := v_0 3860 y := v_1 3861 if !(x.Type.IsSigned() && y.Type.IsSigned()) { 3862 continue 3863 } 3864 v.reset(OpPPC64NotEqual) 3865 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 3866 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 3867 v1.AddArg(x) 3868 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 3869 v2.AddArg(y) 3870 v0.AddArg2(v1, v2) 3871 v.AddArg(v0) 3872 return true 3873 } 3874 break 3875 } 3876 // match: (Neq8 x y) 3877 // result: (NotEqual (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y))) 3878 for { 3879 x := v_0 3880 y := v_1 3881 v.reset(OpPPC64NotEqual) 3882 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 3883 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 3884 v1.AddArg(x) 3885 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 3886 v2.AddArg(y) 3887 v0.AddArg2(v1, v2) 3888 v.AddArg(v0) 3889 return true 3890 } 3891 } 3892 func rewriteValuePPC64_OpNeqPtr(v *Value) bool { 3893 v_1 := v.Args[1] 3894 v_0 := v.Args[0] 3895 b := v.Block 3896 // match: (NeqPtr x y) 3897 // result: (NotEqual (CMP x y)) 3898 for { 3899 x := v_0 3900 y := v_1 3901 v.reset(OpPPC64NotEqual) 3902 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags) 3903 v0.AddArg2(x, y) 3904 v.AddArg(v0) 3905 return true 3906 } 3907 } 3908 func rewriteValuePPC64_OpNot(v *Value) bool { 3909 v_0 := v.Args[0] 3910 // match: (Not x) 3911 // result: (XORconst [1] x) 3912 for { 3913 x := v_0 3914 v.reset(OpPPC64XORconst) 3915 v.AuxInt = int64ToAuxInt(1) 3916 v.AddArg(x) 3917 return true 3918 } 3919 } 3920 func rewriteValuePPC64_OpOffPtr(v *Value) bool { 3921 v_0 := v.Args[0] 3922 b := v.Block 3923 typ := &b.Func.Config.Types 3924 // match: (OffPtr [off] ptr) 3925 // result: (ADD (MOVDconst <typ.Int64> [off]) ptr) 3926 for { 3927 off := auxIntToInt64(v.AuxInt) 3928 ptr := v_0 3929 v.reset(OpPPC64ADD) 3930 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 3931 v0.AuxInt = int64ToAuxInt(off) 3932 v.AddArg2(v0, ptr) 3933 return true 3934 } 3935 } 3936 func rewriteValuePPC64_OpPPC64ADD(v *Value) bool { 3937 v_1 := v.Args[1] 3938 v_0 := v.Args[0] 3939 // match: (ADD l:(MULLD x y) z) 3940 // cond: buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l) 3941 // result: (MADDLD x y z) 3942 for { 3943 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 3944 l := v_0 3945 if l.Op != OpPPC64MULLD { 3946 continue 3947 } 3948 y := l.Args[1] 3949 x := l.Args[0] 3950 z := v_1 3951 if !(buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)) { 3952 continue 3953 } 3954 v.reset(OpPPC64MADDLD) 3955 v.AddArg3(x, y, z) 3956 return true 3957 } 3958 break 3959 } 3960 // match: (ADD x (MOVDconst <t> [c])) 3961 // cond: is32Bit(c) && !t.IsPtr() 3962 // result: (ADDconst [c] x) 3963 for { 3964 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 3965 x := v_0 3966 if v_1.Op != OpPPC64MOVDconst { 3967 continue 3968 } 3969 t := v_1.Type 3970 c := auxIntToInt64(v_1.AuxInt) 3971 if !(is32Bit(c) && !t.IsPtr()) { 3972 continue 3973 } 3974 v.reset(OpPPC64ADDconst) 3975 v.AuxInt = int64ToAuxInt(c) 3976 v.AddArg(x) 3977 return true 3978 } 3979 break 3980 } 3981 return false 3982 } 3983 func rewriteValuePPC64_OpPPC64ADDE(v *Value) bool { 3984 v_2 := v.Args[2] 3985 v_1 := v.Args[1] 3986 v_0 := v.Args[0] 3987 b := v.Block 3988 typ := &b.Func.Config.Types 3989 // match: (ADDE x y (Select1 <typ.UInt64> (ADDCconst (MOVDconst [0]) [-1]))) 3990 // result: (ADDC x y) 3991 for { 3992 x := v_0 3993 y := v_1 3994 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 { 3995 break 3996 } 3997 v_2_0 := v_2.Args[0] 3998 if v_2_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_2_0.AuxInt) != -1 { 3999 break 4000 } 4001 v_2_0_0 := v_2_0.Args[0] 4002 if v_2_0_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 { 4003 break 4004 } 4005 v.reset(OpPPC64ADDC) 4006 v.AddArg2(x, y) 4007 return true 4008 } 4009 return false 4010 } 4011 func rewriteValuePPC64_OpPPC64ADDconst(v *Value) bool { 4012 v_0 := v.Args[0] 4013 // match: (ADDconst [c] (ADDconst [d] x)) 4014 // cond: is32Bit(c+d) 4015 // result: (ADDconst [c+d] x) 4016 for { 4017 c := auxIntToInt64(v.AuxInt) 4018 if v_0.Op != OpPPC64ADDconst { 4019 break 4020 } 4021 d := auxIntToInt64(v_0.AuxInt) 4022 x := v_0.Args[0] 4023 if !(is32Bit(c + d)) { 4024 break 4025 } 4026 v.reset(OpPPC64ADDconst) 4027 v.AuxInt = int64ToAuxInt(c + d) 4028 v.AddArg(x) 4029 return true 4030 } 4031 // match: (ADDconst [0] x) 4032 // result: x 4033 for { 4034 if auxIntToInt64(v.AuxInt) != 0 { 4035 break 4036 } 4037 x := v_0 4038 v.copyOf(x) 4039 return true 4040 } 4041 // match: (ADDconst [c] (MOVDaddr [d] {sym} x)) 4042 // cond: is32Bit(c+int64(d)) 4043 // result: (MOVDaddr [int32(c+int64(d))] {sym} x) 4044 for { 4045 c := auxIntToInt64(v.AuxInt) 4046 if v_0.Op != OpPPC64MOVDaddr { 4047 break 4048 } 4049 d := auxIntToInt32(v_0.AuxInt) 4050 sym := auxToSym(v_0.Aux) 4051 x := v_0.Args[0] 4052 if !(is32Bit(c + int64(d))) { 4053 break 4054 } 4055 v.reset(OpPPC64MOVDaddr) 4056 v.AuxInt = int32ToAuxInt(int32(c + int64(d))) 4057 v.Aux = symToAux(sym) 4058 v.AddArg(x) 4059 return true 4060 } 4061 // match: (ADDconst [c] x:(SP)) 4062 // cond: is32Bit(c) 4063 // result: (MOVDaddr [int32(c)] x) 4064 for { 4065 c := auxIntToInt64(v.AuxInt) 4066 x := v_0 4067 if x.Op != OpSP || !(is32Bit(c)) { 4068 break 4069 } 4070 v.reset(OpPPC64MOVDaddr) 4071 v.AuxInt = int32ToAuxInt(int32(c)) 4072 v.AddArg(x) 4073 return true 4074 } 4075 // match: (ADDconst [c] (SUBFCconst [d] x)) 4076 // cond: is32Bit(c+d) 4077 // result: (SUBFCconst [c+d] x) 4078 for { 4079 c := auxIntToInt64(v.AuxInt) 4080 if v_0.Op != OpPPC64SUBFCconst { 4081 break 4082 } 4083 d := auxIntToInt64(v_0.AuxInt) 4084 x := v_0.Args[0] 4085 if !(is32Bit(c + d)) { 4086 break 4087 } 4088 v.reset(OpPPC64SUBFCconst) 4089 v.AuxInt = int64ToAuxInt(c + d) 4090 v.AddArg(x) 4091 return true 4092 } 4093 return false 4094 } 4095 func rewriteValuePPC64_OpPPC64AND(v *Value) bool { 4096 v_1 := v.Args[1] 4097 v_0 := v.Args[0] 4098 b := v.Block 4099 typ := &b.Func.Config.Types 4100 // match: (AND (MOVDconst [m]) (ROTLWconst [r] x)) 4101 // cond: isPPC64WordRotateMask(m) 4102 // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x) 4103 for { 4104 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4105 if v_0.Op != OpPPC64MOVDconst { 4106 continue 4107 } 4108 m := auxIntToInt64(v_0.AuxInt) 4109 if v_1.Op != OpPPC64ROTLWconst { 4110 continue 4111 } 4112 r := auxIntToInt64(v_1.AuxInt) 4113 x := v_1.Args[0] 4114 if !(isPPC64WordRotateMask(m)) { 4115 continue 4116 } 4117 v.reset(OpPPC64RLWINM) 4118 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32)) 4119 v.AddArg(x) 4120 return true 4121 } 4122 break 4123 } 4124 // match: (AND (MOVDconst [m]) (ROTLW x r)) 4125 // cond: isPPC64WordRotateMask(m) 4126 // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r) 4127 for { 4128 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4129 if v_0.Op != OpPPC64MOVDconst { 4130 continue 4131 } 4132 m := auxIntToInt64(v_0.AuxInt) 4133 if v_1.Op != OpPPC64ROTLW { 4134 continue 4135 } 4136 r := v_1.Args[1] 4137 x := v_1.Args[0] 4138 if !(isPPC64WordRotateMask(m)) { 4139 continue 4140 } 4141 v.reset(OpPPC64RLWNM) 4142 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32)) 4143 v.AddArg2(x, r) 4144 return true 4145 } 4146 break 4147 } 4148 // match: (AND (MOVDconst [m]) (SRWconst x [s])) 4149 // cond: mergePPC64RShiftMask(m,s,32) == 0 4150 // result: (MOVDconst [0]) 4151 for { 4152 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4153 if v_0.Op != OpPPC64MOVDconst { 4154 continue 4155 } 4156 m := auxIntToInt64(v_0.AuxInt) 4157 if v_1.Op != OpPPC64SRWconst { 4158 continue 4159 } 4160 s := auxIntToInt64(v_1.AuxInt) 4161 if !(mergePPC64RShiftMask(m, s, 32) == 0) { 4162 continue 4163 } 4164 v.reset(OpPPC64MOVDconst) 4165 v.AuxInt = int64ToAuxInt(0) 4166 return true 4167 } 4168 break 4169 } 4170 // match: (AND (MOVDconst [m]) (SRWconst x [s])) 4171 // cond: mergePPC64AndSrwi(m,s) != 0 4172 // result: (RLWINM [mergePPC64AndSrwi(m,s)] x) 4173 for { 4174 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4175 if v_0.Op != OpPPC64MOVDconst { 4176 continue 4177 } 4178 m := auxIntToInt64(v_0.AuxInt) 4179 if v_1.Op != OpPPC64SRWconst { 4180 continue 4181 } 4182 s := auxIntToInt64(v_1.AuxInt) 4183 x := v_1.Args[0] 4184 if !(mergePPC64AndSrwi(m, s) != 0) { 4185 continue 4186 } 4187 v.reset(OpPPC64RLWINM) 4188 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s)) 4189 v.AddArg(x) 4190 return true 4191 } 4192 break 4193 } 4194 // match: (AND x (NOR y y)) 4195 // result: (ANDN x y) 4196 for { 4197 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4198 x := v_0 4199 if v_1.Op != OpPPC64NOR { 4200 continue 4201 } 4202 y := v_1.Args[1] 4203 if y != v_1.Args[0] { 4204 continue 4205 } 4206 v.reset(OpPPC64ANDN) 4207 v.AddArg2(x, y) 4208 return true 4209 } 4210 break 4211 } 4212 // match: (AND (MOVDconst [c]) (MOVDconst [d])) 4213 // result: (MOVDconst [c&d]) 4214 for { 4215 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4216 if v_0.Op != OpPPC64MOVDconst { 4217 continue 4218 } 4219 c := auxIntToInt64(v_0.AuxInt) 4220 if v_1.Op != OpPPC64MOVDconst { 4221 continue 4222 } 4223 d := auxIntToInt64(v_1.AuxInt) 4224 v.reset(OpPPC64MOVDconst) 4225 v.AuxInt = int64ToAuxInt(c & d) 4226 return true 4227 } 4228 break 4229 } 4230 // match: (AND x (MOVDconst [-1])) 4231 // result: x 4232 for { 4233 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4234 x := v_0 4235 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 { 4236 continue 4237 } 4238 v.copyOf(x) 4239 return true 4240 } 4241 break 4242 } 4243 // match: (AND x (MOVDconst [c])) 4244 // cond: isU16Bit(c) 4245 // result: (Select0 (ANDCCconst [c] x)) 4246 for { 4247 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4248 x := v_0 4249 if v_1.Op != OpPPC64MOVDconst { 4250 continue 4251 } 4252 c := auxIntToInt64(v_1.AuxInt) 4253 if !(isU16Bit(c)) { 4254 continue 4255 } 4256 v.reset(OpSelect0) 4257 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 4258 v0.AuxInt = int64ToAuxInt(c) 4259 v0.AddArg(x) 4260 v.AddArg(v0) 4261 return true 4262 } 4263 break 4264 } 4265 // match: (AND (MOVDconst [c]) y:(MOVWZreg _)) 4266 // cond: c&0xFFFFFFFF == 0xFFFFFFFF 4267 // result: y 4268 for { 4269 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4270 if v_0.Op != OpPPC64MOVDconst { 4271 continue 4272 } 4273 c := auxIntToInt64(v_0.AuxInt) 4274 y := v_1 4275 if y.Op != OpPPC64MOVWZreg || !(c&0xFFFFFFFF == 0xFFFFFFFF) { 4276 continue 4277 } 4278 v.copyOf(y) 4279 return true 4280 } 4281 break 4282 } 4283 // match: (AND (MOVDconst [0xFFFFFFFF]) y:(MOVWreg x)) 4284 // result: (MOVWZreg x) 4285 for { 4286 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4287 if v_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0xFFFFFFFF { 4288 continue 4289 } 4290 y := v_1 4291 if y.Op != OpPPC64MOVWreg { 4292 continue 4293 } 4294 x := y.Args[0] 4295 v.reset(OpPPC64MOVWZreg) 4296 v.AddArg(x) 4297 return true 4298 } 4299 break 4300 } 4301 // match: (AND (MOVDconst [c]) x:(MOVBZload _ _)) 4302 // result: (Select0 (ANDCCconst [c&0xFF] x)) 4303 for { 4304 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 4305 if v_0.Op != OpPPC64MOVDconst { 4306 continue 4307 } 4308 c := auxIntToInt64(v_0.AuxInt) 4309 x := v_1 4310 if x.Op != OpPPC64MOVBZload { 4311 continue 4312 } 4313 v.reset(OpSelect0) 4314 v0 := b.NewValue0(x.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 4315 v0.AuxInt = int64ToAuxInt(c & 0xFF) 4316 v0.AddArg(x) 4317 v.AddArg(v0) 4318 return true 4319 } 4320 break 4321 } 4322 return false 4323 } 4324 func rewriteValuePPC64_OpPPC64ANDCCconst(v *Value) bool { 4325 v_0 := v.Args[0] 4326 // match: (ANDCCconst [c] (Select0 (ANDCCconst [d] x))) 4327 // result: (ANDCCconst [c&d] x) 4328 for { 4329 c := auxIntToInt64(v.AuxInt) 4330 if v_0.Op != OpSelect0 { 4331 break 4332 } 4333 v_0_0 := v_0.Args[0] 4334 if v_0_0.Op != OpPPC64ANDCCconst { 4335 break 4336 } 4337 d := auxIntToInt64(v_0_0.AuxInt) 4338 x := v_0_0.Args[0] 4339 v.reset(OpPPC64ANDCCconst) 4340 v.AuxInt = int64ToAuxInt(c & d) 4341 v.AddArg(x) 4342 return true 4343 } 4344 return false 4345 } 4346 func rewriteValuePPC64_OpPPC64ANDN(v *Value) bool { 4347 v_1 := v.Args[1] 4348 v_0 := v.Args[0] 4349 // match: (ANDN (MOVDconst [c]) (MOVDconst [d])) 4350 // result: (MOVDconst [c&^d]) 4351 for { 4352 if v_0.Op != OpPPC64MOVDconst { 4353 break 4354 } 4355 c := auxIntToInt64(v_0.AuxInt) 4356 if v_1.Op != OpPPC64MOVDconst { 4357 break 4358 } 4359 d := auxIntToInt64(v_1.AuxInt) 4360 v.reset(OpPPC64MOVDconst) 4361 v.AuxInt = int64ToAuxInt(c &^ d) 4362 return true 4363 } 4364 return false 4365 } 4366 func rewriteValuePPC64_OpPPC64BRD(v *Value) bool { 4367 v_0 := v.Args[0] 4368 b := v.Block 4369 typ := &b.Func.Config.Types 4370 // match: (BRD x:(MOVDload [off] {sym} ptr mem)) 4371 // cond: x.Uses == 1 4372 // result: @x.Block (MOVDBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem) 4373 for { 4374 x := v_0 4375 if x.Op != OpPPC64MOVDload { 4376 break 4377 } 4378 off := auxIntToInt32(x.AuxInt) 4379 sym := auxToSym(x.Aux) 4380 mem := x.Args[1] 4381 ptr := x.Args[0] 4382 if !(x.Uses == 1) { 4383 break 4384 } 4385 b = x.Block 4386 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64) 4387 v.copyOf(v0) 4388 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type) 4389 v1.AuxInt = int32ToAuxInt(off) 4390 v1.Aux = symToAux(sym) 4391 v1.AddArg(ptr) 4392 v0.AddArg2(v1, mem) 4393 return true 4394 } 4395 // match: (BRD x:(MOVDloadidx ptr idx mem)) 4396 // cond: x.Uses == 1 4397 // result: @x.Block (MOVDBRloadidx ptr idx mem) 4398 for { 4399 x := v_0 4400 if x.Op != OpPPC64MOVDloadidx { 4401 break 4402 } 4403 mem := x.Args[2] 4404 ptr := x.Args[0] 4405 idx := x.Args[1] 4406 if !(x.Uses == 1) { 4407 break 4408 } 4409 b = x.Block 4410 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64) 4411 v.copyOf(v0) 4412 v0.AddArg3(ptr, idx, mem) 4413 return true 4414 } 4415 return false 4416 } 4417 func rewriteValuePPC64_OpPPC64BRH(v *Value) bool { 4418 v_0 := v.Args[0] 4419 b := v.Block 4420 typ := &b.Func.Config.Types 4421 // match: (BRH x:(MOVHZload [off] {sym} ptr mem)) 4422 // cond: x.Uses == 1 4423 // result: @x.Block (MOVHBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem) 4424 for { 4425 x := v_0 4426 if x.Op != OpPPC64MOVHZload { 4427 break 4428 } 4429 off := auxIntToInt32(x.AuxInt) 4430 sym := auxToSym(x.Aux) 4431 mem := x.Args[1] 4432 ptr := x.Args[0] 4433 if !(x.Uses == 1) { 4434 break 4435 } 4436 b = x.Block 4437 v0 := b.NewValue0(x.Pos, OpPPC64MOVHBRload, typ.UInt16) 4438 v.copyOf(v0) 4439 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type) 4440 v1.AuxInt = int32ToAuxInt(off) 4441 v1.Aux = symToAux(sym) 4442 v1.AddArg(ptr) 4443 v0.AddArg2(v1, mem) 4444 return true 4445 } 4446 // match: (BRH x:(MOVHZloadidx ptr idx mem)) 4447 // cond: x.Uses == 1 4448 // result: @x.Block (MOVHBRloadidx ptr idx mem) 4449 for { 4450 x := v_0 4451 if x.Op != OpPPC64MOVHZloadidx { 4452 break 4453 } 4454 mem := x.Args[2] 4455 ptr := x.Args[0] 4456 idx := x.Args[1] 4457 if !(x.Uses == 1) { 4458 break 4459 } 4460 b = x.Block 4461 v0 := b.NewValue0(v.Pos, OpPPC64MOVHBRloadidx, typ.Int16) 4462 v.copyOf(v0) 4463 v0.AddArg3(ptr, idx, mem) 4464 return true 4465 } 4466 return false 4467 } 4468 func rewriteValuePPC64_OpPPC64BRW(v *Value) bool { 4469 v_0 := v.Args[0] 4470 b := v.Block 4471 typ := &b.Func.Config.Types 4472 // match: (BRW x:(MOVWZload [off] {sym} ptr mem)) 4473 // cond: x.Uses == 1 4474 // result: @x.Block (MOVWBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem) 4475 for { 4476 x := v_0 4477 if x.Op != OpPPC64MOVWZload { 4478 break 4479 } 4480 off := auxIntToInt32(x.AuxInt) 4481 sym := auxToSym(x.Aux) 4482 mem := x.Args[1] 4483 ptr := x.Args[0] 4484 if !(x.Uses == 1) { 4485 break 4486 } 4487 b = x.Block 4488 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32) 4489 v.copyOf(v0) 4490 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type) 4491 v1.AuxInt = int32ToAuxInt(off) 4492 v1.Aux = symToAux(sym) 4493 v1.AddArg(ptr) 4494 v0.AddArg2(v1, mem) 4495 return true 4496 } 4497 // match: (BRW x:(MOVWZloadidx ptr idx mem)) 4498 // cond: x.Uses == 1 4499 // result: @x.Block (MOVWBRloadidx ptr idx mem) 4500 for { 4501 x := v_0 4502 if x.Op != OpPPC64MOVWZloadidx { 4503 break 4504 } 4505 mem := x.Args[2] 4506 ptr := x.Args[0] 4507 idx := x.Args[1] 4508 if !(x.Uses == 1) { 4509 break 4510 } 4511 b = x.Block 4512 v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32) 4513 v.copyOf(v0) 4514 v0.AddArg3(ptr, idx, mem) 4515 return true 4516 } 4517 return false 4518 } 4519 func rewriteValuePPC64_OpPPC64CLRLSLDI(v *Value) bool { 4520 v_0 := v.Args[0] 4521 // match: (CLRLSLDI [c] (SRWconst [s] x)) 4522 // cond: mergePPC64ClrlsldiSrw(int64(c),s) != 0 4523 // result: (RLWINM [mergePPC64ClrlsldiSrw(int64(c),s)] x) 4524 for { 4525 c := auxIntToInt32(v.AuxInt) 4526 if v_0.Op != OpPPC64SRWconst { 4527 break 4528 } 4529 s := auxIntToInt64(v_0.AuxInt) 4530 x := v_0.Args[0] 4531 if !(mergePPC64ClrlsldiSrw(int64(c), s) != 0) { 4532 break 4533 } 4534 v.reset(OpPPC64RLWINM) 4535 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiSrw(int64(c), s)) 4536 v.AddArg(x) 4537 return true 4538 } 4539 // match: (CLRLSLDI [c] i:(RLWINM [s] x)) 4540 // cond: mergePPC64ClrlsldiRlwinm(c,s) != 0 4541 // result: (RLWINM [mergePPC64ClrlsldiRlwinm(c,s)] x) 4542 for { 4543 c := auxIntToInt32(v.AuxInt) 4544 i := v_0 4545 if i.Op != OpPPC64RLWINM { 4546 break 4547 } 4548 s := auxIntToInt64(i.AuxInt) 4549 x := i.Args[0] 4550 if !(mergePPC64ClrlsldiRlwinm(c, s) != 0) { 4551 break 4552 } 4553 v.reset(OpPPC64RLWINM) 4554 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiRlwinm(c, s)) 4555 v.AddArg(x) 4556 return true 4557 } 4558 return false 4559 } 4560 func rewriteValuePPC64_OpPPC64CMP(v *Value) bool { 4561 v_1 := v.Args[1] 4562 v_0 := v.Args[0] 4563 b := v.Block 4564 // match: (CMP x (MOVDconst [c])) 4565 // cond: is16Bit(c) 4566 // result: (CMPconst x [c]) 4567 for { 4568 x := v_0 4569 if v_1.Op != OpPPC64MOVDconst { 4570 break 4571 } 4572 c := auxIntToInt64(v_1.AuxInt) 4573 if !(is16Bit(c)) { 4574 break 4575 } 4576 v.reset(OpPPC64CMPconst) 4577 v.AuxInt = int64ToAuxInt(c) 4578 v.AddArg(x) 4579 return true 4580 } 4581 // match: (CMP (MOVDconst [c]) y) 4582 // cond: is16Bit(c) 4583 // result: (InvertFlags (CMPconst y [c])) 4584 for { 4585 if v_0.Op != OpPPC64MOVDconst { 4586 break 4587 } 4588 c := auxIntToInt64(v_0.AuxInt) 4589 y := v_1 4590 if !(is16Bit(c)) { 4591 break 4592 } 4593 v.reset(OpPPC64InvertFlags) 4594 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags) 4595 v0.AuxInt = int64ToAuxInt(c) 4596 v0.AddArg(y) 4597 v.AddArg(v0) 4598 return true 4599 } 4600 // match: (CMP x y) 4601 // cond: canonLessThan(x,y) 4602 // result: (InvertFlags (CMP y x)) 4603 for { 4604 x := v_0 4605 y := v_1 4606 if !(canonLessThan(x, y)) { 4607 break 4608 } 4609 v.reset(OpPPC64InvertFlags) 4610 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags) 4611 v0.AddArg2(y, x) 4612 v.AddArg(v0) 4613 return true 4614 } 4615 return false 4616 } 4617 func rewriteValuePPC64_OpPPC64CMPU(v *Value) bool { 4618 v_1 := v.Args[1] 4619 v_0 := v.Args[0] 4620 b := v.Block 4621 // match: (CMPU x (MOVDconst [c])) 4622 // cond: isU16Bit(c) 4623 // result: (CMPUconst x [c]) 4624 for { 4625 x := v_0 4626 if v_1.Op != OpPPC64MOVDconst { 4627 break 4628 } 4629 c := auxIntToInt64(v_1.AuxInt) 4630 if !(isU16Bit(c)) { 4631 break 4632 } 4633 v.reset(OpPPC64CMPUconst) 4634 v.AuxInt = int64ToAuxInt(c) 4635 v.AddArg(x) 4636 return true 4637 } 4638 // match: (CMPU (MOVDconst [c]) y) 4639 // cond: isU16Bit(c) 4640 // result: (InvertFlags (CMPUconst y [c])) 4641 for { 4642 if v_0.Op != OpPPC64MOVDconst { 4643 break 4644 } 4645 c := auxIntToInt64(v_0.AuxInt) 4646 y := v_1 4647 if !(isU16Bit(c)) { 4648 break 4649 } 4650 v.reset(OpPPC64InvertFlags) 4651 v0 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 4652 v0.AuxInt = int64ToAuxInt(c) 4653 v0.AddArg(y) 4654 v.AddArg(v0) 4655 return true 4656 } 4657 // match: (CMPU x y) 4658 // cond: canonLessThan(x,y) 4659 // result: (InvertFlags (CMPU y x)) 4660 for { 4661 x := v_0 4662 y := v_1 4663 if !(canonLessThan(x, y)) { 4664 break 4665 } 4666 v.reset(OpPPC64InvertFlags) 4667 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags) 4668 v0.AddArg2(y, x) 4669 v.AddArg(v0) 4670 return true 4671 } 4672 return false 4673 } 4674 func rewriteValuePPC64_OpPPC64CMPUconst(v *Value) bool { 4675 v_0 := v.Args[0] 4676 // match: (CMPUconst [d] (Select0 (ANDCCconst z [c]))) 4677 // cond: uint64(d) > uint64(c) 4678 // result: (FlagLT) 4679 for { 4680 d := auxIntToInt64(v.AuxInt) 4681 if v_0.Op != OpSelect0 { 4682 break 4683 } 4684 v_0_0 := v_0.Args[0] 4685 if v_0_0.Op != OpPPC64ANDCCconst { 4686 break 4687 } 4688 c := auxIntToInt64(v_0_0.AuxInt) 4689 if !(uint64(d) > uint64(c)) { 4690 break 4691 } 4692 v.reset(OpPPC64FlagLT) 4693 return true 4694 } 4695 // match: (CMPUconst (MOVDconst [x]) [y]) 4696 // cond: x==y 4697 // result: (FlagEQ) 4698 for { 4699 y := auxIntToInt64(v.AuxInt) 4700 if v_0.Op != OpPPC64MOVDconst { 4701 break 4702 } 4703 x := auxIntToInt64(v_0.AuxInt) 4704 if !(x == y) { 4705 break 4706 } 4707 v.reset(OpPPC64FlagEQ) 4708 return true 4709 } 4710 // match: (CMPUconst (MOVDconst [x]) [y]) 4711 // cond: uint64(x)<uint64(y) 4712 // result: (FlagLT) 4713 for { 4714 y := auxIntToInt64(v.AuxInt) 4715 if v_0.Op != OpPPC64MOVDconst { 4716 break 4717 } 4718 x := auxIntToInt64(v_0.AuxInt) 4719 if !(uint64(x) < uint64(y)) { 4720 break 4721 } 4722 v.reset(OpPPC64FlagLT) 4723 return true 4724 } 4725 // match: (CMPUconst (MOVDconst [x]) [y]) 4726 // cond: uint64(x)>uint64(y) 4727 // result: (FlagGT) 4728 for { 4729 y := auxIntToInt64(v.AuxInt) 4730 if v_0.Op != OpPPC64MOVDconst { 4731 break 4732 } 4733 x := auxIntToInt64(v_0.AuxInt) 4734 if !(uint64(x) > uint64(y)) { 4735 break 4736 } 4737 v.reset(OpPPC64FlagGT) 4738 return true 4739 } 4740 return false 4741 } 4742 func rewriteValuePPC64_OpPPC64CMPW(v *Value) bool { 4743 v_1 := v.Args[1] 4744 v_0 := v.Args[0] 4745 b := v.Block 4746 // match: (CMPW x (MOVWreg y)) 4747 // result: (CMPW x y) 4748 for { 4749 x := v_0 4750 if v_1.Op != OpPPC64MOVWreg { 4751 break 4752 } 4753 y := v_1.Args[0] 4754 v.reset(OpPPC64CMPW) 4755 v.AddArg2(x, y) 4756 return true 4757 } 4758 // match: (CMPW (MOVWreg x) y) 4759 // result: (CMPW x y) 4760 for { 4761 if v_0.Op != OpPPC64MOVWreg { 4762 break 4763 } 4764 x := v_0.Args[0] 4765 y := v_1 4766 v.reset(OpPPC64CMPW) 4767 v.AddArg2(x, y) 4768 return true 4769 } 4770 // match: (CMPW x (MOVDconst [c])) 4771 // cond: is16Bit(c) 4772 // result: (CMPWconst x [int32(c)]) 4773 for { 4774 x := v_0 4775 if v_1.Op != OpPPC64MOVDconst { 4776 break 4777 } 4778 c := auxIntToInt64(v_1.AuxInt) 4779 if !(is16Bit(c)) { 4780 break 4781 } 4782 v.reset(OpPPC64CMPWconst) 4783 v.AuxInt = int32ToAuxInt(int32(c)) 4784 v.AddArg(x) 4785 return true 4786 } 4787 // match: (CMPW (MOVDconst [c]) y) 4788 // cond: is16Bit(c) 4789 // result: (InvertFlags (CMPWconst y [int32(c)])) 4790 for { 4791 if v_0.Op != OpPPC64MOVDconst { 4792 break 4793 } 4794 c := auxIntToInt64(v_0.AuxInt) 4795 y := v_1 4796 if !(is16Bit(c)) { 4797 break 4798 } 4799 v.reset(OpPPC64InvertFlags) 4800 v0 := b.NewValue0(v.Pos, OpPPC64CMPWconst, types.TypeFlags) 4801 v0.AuxInt = int32ToAuxInt(int32(c)) 4802 v0.AddArg(y) 4803 v.AddArg(v0) 4804 return true 4805 } 4806 // match: (CMPW x y) 4807 // cond: canonLessThan(x,y) 4808 // result: (InvertFlags (CMPW y x)) 4809 for { 4810 x := v_0 4811 y := v_1 4812 if !(canonLessThan(x, y)) { 4813 break 4814 } 4815 v.reset(OpPPC64InvertFlags) 4816 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags) 4817 v0.AddArg2(y, x) 4818 v.AddArg(v0) 4819 return true 4820 } 4821 return false 4822 } 4823 func rewriteValuePPC64_OpPPC64CMPWU(v *Value) bool { 4824 v_1 := v.Args[1] 4825 v_0 := v.Args[0] 4826 b := v.Block 4827 // match: (CMPWU x (MOVWZreg y)) 4828 // result: (CMPWU x y) 4829 for { 4830 x := v_0 4831 if v_1.Op != OpPPC64MOVWZreg { 4832 break 4833 } 4834 y := v_1.Args[0] 4835 v.reset(OpPPC64CMPWU) 4836 v.AddArg2(x, y) 4837 return true 4838 } 4839 // match: (CMPWU (MOVWZreg x) y) 4840 // result: (CMPWU x y) 4841 for { 4842 if v_0.Op != OpPPC64MOVWZreg { 4843 break 4844 } 4845 x := v_0.Args[0] 4846 y := v_1 4847 v.reset(OpPPC64CMPWU) 4848 v.AddArg2(x, y) 4849 return true 4850 } 4851 // match: (CMPWU x (MOVDconst [c])) 4852 // cond: isU16Bit(c) 4853 // result: (CMPWUconst x [int32(c)]) 4854 for { 4855 x := v_0 4856 if v_1.Op != OpPPC64MOVDconst { 4857 break 4858 } 4859 c := auxIntToInt64(v_1.AuxInt) 4860 if !(isU16Bit(c)) { 4861 break 4862 } 4863 v.reset(OpPPC64CMPWUconst) 4864 v.AuxInt = int32ToAuxInt(int32(c)) 4865 v.AddArg(x) 4866 return true 4867 } 4868 // match: (CMPWU (MOVDconst [c]) y) 4869 // cond: isU16Bit(c) 4870 // result: (InvertFlags (CMPWUconst y [int32(c)])) 4871 for { 4872 if v_0.Op != OpPPC64MOVDconst { 4873 break 4874 } 4875 c := auxIntToInt64(v_0.AuxInt) 4876 y := v_1 4877 if !(isU16Bit(c)) { 4878 break 4879 } 4880 v.reset(OpPPC64InvertFlags) 4881 v0 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 4882 v0.AuxInt = int32ToAuxInt(int32(c)) 4883 v0.AddArg(y) 4884 v.AddArg(v0) 4885 return true 4886 } 4887 // match: (CMPWU x y) 4888 // cond: canonLessThan(x,y) 4889 // result: (InvertFlags (CMPWU y x)) 4890 for { 4891 x := v_0 4892 y := v_1 4893 if !(canonLessThan(x, y)) { 4894 break 4895 } 4896 v.reset(OpPPC64InvertFlags) 4897 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags) 4898 v0.AddArg2(y, x) 4899 v.AddArg(v0) 4900 return true 4901 } 4902 return false 4903 } 4904 func rewriteValuePPC64_OpPPC64CMPWUconst(v *Value) bool { 4905 v_0 := v.Args[0] 4906 // match: (CMPWUconst [d] (Select0 (ANDCCconst z [c]))) 4907 // cond: uint64(d) > uint64(c) 4908 // result: (FlagLT) 4909 for { 4910 d := auxIntToInt32(v.AuxInt) 4911 if v_0.Op != OpSelect0 { 4912 break 4913 } 4914 v_0_0 := v_0.Args[0] 4915 if v_0_0.Op != OpPPC64ANDCCconst { 4916 break 4917 } 4918 c := auxIntToInt64(v_0_0.AuxInt) 4919 if !(uint64(d) > uint64(c)) { 4920 break 4921 } 4922 v.reset(OpPPC64FlagLT) 4923 return true 4924 } 4925 // match: (CMPWUconst (MOVDconst [x]) [y]) 4926 // cond: int32(x)==int32(y) 4927 // result: (FlagEQ) 4928 for { 4929 y := auxIntToInt32(v.AuxInt) 4930 if v_0.Op != OpPPC64MOVDconst { 4931 break 4932 } 4933 x := auxIntToInt64(v_0.AuxInt) 4934 if !(int32(x) == int32(y)) { 4935 break 4936 } 4937 v.reset(OpPPC64FlagEQ) 4938 return true 4939 } 4940 // match: (CMPWUconst (MOVDconst [x]) [y]) 4941 // cond: uint32(x)<uint32(y) 4942 // result: (FlagLT) 4943 for { 4944 y := auxIntToInt32(v.AuxInt) 4945 if v_0.Op != OpPPC64MOVDconst { 4946 break 4947 } 4948 x := auxIntToInt64(v_0.AuxInt) 4949 if !(uint32(x) < uint32(y)) { 4950 break 4951 } 4952 v.reset(OpPPC64FlagLT) 4953 return true 4954 } 4955 // match: (CMPWUconst (MOVDconst [x]) [y]) 4956 // cond: uint32(x)>uint32(y) 4957 // result: (FlagGT) 4958 for { 4959 y := auxIntToInt32(v.AuxInt) 4960 if v_0.Op != OpPPC64MOVDconst { 4961 break 4962 } 4963 x := auxIntToInt64(v_0.AuxInt) 4964 if !(uint32(x) > uint32(y)) { 4965 break 4966 } 4967 v.reset(OpPPC64FlagGT) 4968 return true 4969 } 4970 return false 4971 } 4972 func rewriteValuePPC64_OpPPC64CMPWconst(v *Value) bool { 4973 v_0 := v.Args[0] 4974 // match: (CMPWconst (MOVDconst [x]) [y]) 4975 // cond: int32(x)==int32(y) 4976 // result: (FlagEQ) 4977 for { 4978 y := auxIntToInt32(v.AuxInt) 4979 if v_0.Op != OpPPC64MOVDconst { 4980 break 4981 } 4982 x := auxIntToInt64(v_0.AuxInt) 4983 if !(int32(x) == int32(y)) { 4984 break 4985 } 4986 v.reset(OpPPC64FlagEQ) 4987 return true 4988 } 4989 // match: (CMPWconst (MOVDconst [x]) [y]) 4990 // cond: int32(x)<int32(y) 4991 // result: (FlagLT) 4992 for { 4993 y := auxIntToInt32(v.AuxInt) 4994 if v_0.Op != OpPPC64MOVDconst { 4995 break 4996 } 4997 x := auxIntToInt64(v_0.AuxInt) 4998 if !(int32(x) < int32(y)) { 4999 break 5000 } 5001 v.reset(OpPPC64FlagLT) 5002 return true 5003 } 5004 // match: (CMPWconst (MOVDconst [x]) [y]) 5005 // cond: int32(x)>int32(y) 5006 // result: (FlagGT) 5007 for { 5008 y := auxIntToInt32(v.AuxInt) 5009 if v_0.Op != OpPPC64MOVDconst { 5010 break 5011 } 5012 x := auxIntToInt64(v_0.AuxInt) 5013 if !(int32(x) > int32(y)) { 5014 break 5015 } 5016 v.reset(OpPPC64FlagGT) 5017 return true 5018 } 5019 return false 5020 } 5021 func rewriteValuePPC64_OpPPC64CMPconst(v *Value) bool { 5022 v_0 := v.Args[0] 5023 // match: (CMPconst (MOVDconst [x]) [y]) 5024 // cond: x==y 5025 // result: (FlagEQ) 5026 for { 5027 y := auxIntToInt64(v.AuxInt) 5028 if v_0.Op != OpPPC64MOVDconst { 5029 break 5030 } 5031 x := auxIntToInt64(v_0.AuxInt) 5032 if !(x == y) { 5033 break 5034 } 5035 v.reset(OpPPC64FlagEQ) 5036 return true 5037 } 5038 // match: (CMPconst (MOVDconst [x]) [y]) 5039 // cond: x<y 5040 // result: (FlagLT) 5041 for { 5042 y := auxIntToInt64(v.AuxInt) 5043 if v_0.Op != OpPPC64MOVDconst { 5044 break 5045 } 5046 x := auxIntToInt64(v_0.AuxInt) 5047 if !(x < y) { 5048 break 5049 } 5050 v.reset(OpPPC64FlagLT) 5051 return true 5052 } 5053 // match: (CMPconst (MOVDconst [x]) [y]) 5054 // cond: x>y 5055 // result: (FlagGT) 5056 for { 5057 y := auxIntToInt64(v.AuxInt) 5058 if v_0.Op != OpPPC64MOVDconst { 5059 break 5060 } 5061 x := auxIntToInt64(v_0.AuxInt) 5062 if !(x > y) { 5063 break 5064 } 5065 v.reset(OpPPC64FlagGT) 5066 return true 5067 } 5068 return false 5069 } 5070 func rewriteValuePPC64_OpPPC64Equal(v *Value) bool { 5071 v_0 := v.Args[0] 5072 // match: (Equal (FlagEQ)) 5073 // result: (MOVDconst [1]) 5074 for { 5075 if v_0.Op != OpPPC64FlagEQ { 5076 break 5077 } 5078 v.reset(OpPPC64MOVDconst) 5079 v.AuxInt = int64ToAuxInt(1) 5080 return true 5081 } 5082 // match: (Equal (FlagLT)) 5083 // result: (MOVDconst [0]) 5084 for { 5085 if v_0.Op != OpPPC64FlagLT { 5086 break 5087 } 5088 v.reset(OpPPC64MOVDconst) 5089 v.AuxInt = int64ToAuxInt(0) 5090 return true 5091 } 5092 // match: (Equal (FlagGT)) 5093 // result: (MOVDconst [0]) 5094 for { 5095 if v_0.Op != OpPPC64FlagGT { 5096 break 5097 } 5098 v.reset(OpPPC64MOVDconst) 5099 v.AuxInt = int64ToAuxInt(0) 5100 return true 5101 } 5102 // match: (Equal (InvertFlags x)) 5103 // result: (Equal x) 5104 for { 5105 if v_0.Op != OpPPC64InvertFlags { 5106 break 5107 } 5108 x := v_0.Args[0] 5109 v.reset(OpPPC64Equal) 5110 v.AddArg(x) 5111 return true 5112 } 5113 // match: (Equal cmp) 5114 // result: (SETBC [2] cmp) 5115 for { 5116 cmp := v_0 5117 v.reset(OpPPC64SETBC) 5118 v.AuxInt = int32ToAuxInt(2) 5119 v.AddArg(cmp) 5120 return true 5121 } 5122 } 5123 func rewriteValuePPC64_OpPPC64FABS(v *Value) bool { 5124 v_0 := v.Args[0] 5125 // match: (FABS (FMOVDconst [x])) 5126 // result: (FMOVDconst [math.Abs(x)]) 5127 for { 5128 if v_0.Op != OpPPC64FMOVDconst { 5129 break 5130 } 5131 x := auxIntToFloat64(v_0.AuxInt) 5132 v.reset(OpPPC64FMOVDconst) 5133 v.AuxInt = float64ToAuxInt(math.Abs(x)) 5134 return true 5135 } 5136 return false 5137 } 5138 func rewriteValuePPC64_OpPPC64FADD(v *Value) bool { 5139 v_1 := v.Args[1] 5140 v_0 := v.Args[0] 5141 // match: (FADD (FMUL x y) z) 5142 // cond: x.Block.Func.useFMA(v) 5143 // result: (FMADD x y z) 5144 for { 5145 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5146 if v_0.Op != OpPPC64FMUL { 5147 continue 5148 } 5149 _ = v_0.Args[1] 5150 v_0_0 := v_0.Args[0] 5151 v_0_1 := v_0.Args[1] 5152 for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { 5153 x := v_0_0 5154 y := v_0_1 5155 z := v_1 5156 if !(x.Block.Func.useFMA(v)) { 5157 continue 5158 } 5159 v.reset(OpPPC64FMADD) 5160 v.AddArg3(x, y, z) 5161 return true 5162 } 5163 } 5164 break 5165 } 5166 return false 5167 } 5168 func rewriteValuePPC64_OpPPC64FADDS(v *Value) bool { 5169 v_1 := v.Args[1] 5170 v_0 := v.Args[0] 5171 // match: (FADDS (FMULS x y) z) 5172 // cond: x.Block.Func.useFMA(v) 5173 // result: (FMADDS x y z) 5174 for { 5175 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 5176 if v_0.Op != OpPPC64FMULS { 5177 continue 5178 } 5179 _ = v_0.Args[1] 5180 v_0_0 := v_0.Args[0] 5181 v_0_1 := v_0.Args[1] 5182 for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { 5183 x := v_0_0 5184 y := v_0_1 5185 z := v_1 5186 if !(x.Block.Func.useFMA(v)) { 5187 continue 5188 } 5189 v.reset(OpPPC64FMADDS) 5190 v.AddArg3(x, y, z) 5191 return true 5192 } 5193 } 5194 break 5195 } 5196 return false 5197 } 5198 func rewriteValuePPC64_OpPPC64FCEIL(v *Value) bool { 5199 v_0 := v.Args[0] 5200 // match: (FCEIL (FMOVDconst [x])) 5201 // result: (FMOVDconst [math.Ceil(x)]) 5202 for { 5203 if v_0.Op != OpPPC64FMOVDconst { 5204 break 5205 } 5206 x := auxIntToFloat64(v_0.AuxInt) 5207 v.reset(OpPPC64FMOVDconst) 5208 v.AuxInt = float64ToAuxInt(math.Ceil(x)) 5209 return true 5210 } 5211 return false 5212 } 5213 func rewriteValuePPC64_OpPPC64FFLOOR(v *Value) bool { 5214 v_0 := v.Args[0] 5215 // match: (FFLOOR (FMOVDconst [x])) 5216 // result: (FMOVDconst [math.Floor(x)]) 5217 for { 5218 if v_0.Op != OpPPC64FMOVDconst { 5219 break 5220 } 5221 x := auxIntToFloat64(v_0.AuxInt) 5222 v.reset(OpPPC64FMOVDconst) 5223 v.AuxInt = float64ToAuxInt(math.Floor(x)) 5224 return true 5225 } 5226 return false 5227 } 5228 func rewriteValuePPC64_OpPPC64FGreaterEqual(v *Value) bool { 5229 v_0 := v.Args[0] 5230 b := v.Block 5231 typ := &b.Func.Config.Types 5232 // match: (FGreaterEqual cmp) 5233 // result: (OR (SETBC [2] cmp) (SETBC [1] cmp)) 5234 for { 5235 cmp := v_0 5236 v.reset(OpPPC64OR) 5237 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32) 5238 v0.AuxInt = int32ToAuxInt(2) 5239 v0.AddArg(cmp) 5240 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32) 5241 v1.AuxInt = int32ToAuxInt(1) 5242 v1.AddArg(cmp) 5243 v.AddArg2(v0, v1) 5244 return true 5245 } 5246 } 5247 func rewriteValuePPC64_OpPPC64FGreaterThan(v *Value) bool { 5248 v_0 := v.Args[0] 5249 // match: (FGreaterThan cmp) 5250 // result: (SETBC [1] cmp) 5251 for { 5252 cmp := v_0 5253 v.reset(OpPPC64SETBC) 5254 v.AuxInt = int32ToAuxInt(1) 5255 v.AddArg(cmp) 5256 return true 5257 } 5258 } 5259 func rewriteValuePPC64_OpPPC64FLessEqual(v *Value) bool { 5260 v_0 := v.Args[0] 5261 b := v.Block 5262 typ := &b.Func.Config.Types 5263 // match: (FLessEqual cmp) 5264 // result: (OR (SETBC [2] cmp) (SETBC [0] cmp)) 5265 for { 5266 cmp := v_0 5267 v.reset(OpPPC64OR) 5268 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32) 5269 v0.AuxInt = int32ToAuxInt(2) 5270 v0.AddArg(cmp) 5271 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32) 5272 v1.AuxInt = int32ToAuxInt(0) 5273 v1.AddArg(cmp) 5274 v.AddArg2(v0, v1) 5275 return true 5276 } 5277 } 5278 func rewriteValuePPC64_OpPPC64FLessThan(v *Value) bool { 5279 v_0 := v.Args[0] 5280 // match: (FLessThan cmp) 5281 // result: (SETBC [0] cmp) 5282 for { 5283 cmp := v_0 5284 v.reset(OpPPC64SETBC) 5285 v.AuxInt = int32ToAuxInt(0) 5286 v.AddArg(cmp) 5287 return true 5288 } 5289 } 5290 func rewriteValuePPC64_OpPPC64FMOVDload(v *Value) bool { 5291 v_1 := v.Args[1] 5292 v_0 := v.Args[0] 5293 // match: (FMOVDload [off] {sym} ptr (MOVDstore [off] {sym} ptr x _)) 5294 // result: (MTVSRD x) 5295 for { 5296 off := auxIntToInt32(v.AuxInt) 5297 sym := auxToSym(v.Aux) 5298 ptr := v_0 5299 if v_1.Op != OpPPC64MOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 5300 break 5301 } 5302 x := v_1.Args[1] 5303 if ptr != v_1.Args[0] { 5304 break 5305 } 5306 v.reset(OpPPC64MTVSRD) 5307 v.AddArg(x) 5308 return true 5309 } 5310 // match: (FMOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) 5311 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 5312 // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem) 5313 for { 5314 off1 := auxIntToInt32(v.AuxInt) 5315 sym1 := auxToSym(v.Aux) 5316 p := v_0 5317 if p.Op != OpPPC64MOVDaddr { 5318 break 5319 } 5320 off2 := auxIntToInt32(p.AuxInt) 5321 sym2 := auxToSym(p.Aux) 5322 ptr := p.Args[0] 5323 mem := v_1 5324 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 5325 break 5326 } 5327 v.reset(OpPPC64FMOVDload) 5328 v.AuxInt = int32ToAuxInt(off1 + off2) 5329 v.Aux = symToAux(mergeSym(sym1, sym2)) 5330 v.AddArg2(ptr, mem) 5331 return true 5332 } 5333 // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem) 5334 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 5335 // result: (FMOVDload [off1+int32(off2)] {sym} ptr mem) 5336 for { 5337 off1 := auxIntToInt32(v.AuxInt) 5338 sym := auxToSym(v.Aux) 5339 if v_0.Op != OpPPC64ADDconst { 5340 break 5341 } 5342 off2 := auxIntToInt64(v_0.AuxInt) 5343 ptr := v_0.Args[0] 5344 mem := v_1 5345 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 5346 break 5347 } 5348 v.reset(OpPPC64FMOVDload) 5349 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 5350 v.Aux = symToAux(sym) 5351 v.AddArg2(ptr, mem) 5352 return true 5353 } 5354 return false 5355 } 5356 func rewriteValuePPC64_OpPPC64FMOVDstore(v *Value) bool { 5357 v_2 := v.Args[2] 5358 v_1 := v.Args[1] 5359 v_0 := v.Args[0] 5360 // match: (FMOVDstore [off] {sym} ptr (MTVSRD x) mem) 5361 // result: (MOVDstore [off] {sym} ptr x mem) 5362 for { 5363 off := auxIntToInt32(v.AuxInt) 5364 sym := auxToSym(v.Aux) 5365 ptr := v_0 5366 if v_1.Op != OpPPC64MTVSRD { 5367 break 5368 } 5369 x := v_1.Args[0] 5370 mem := v_2 5371 v.reset(OpPPC64MOVDstore) 5372 v.AuxInt = int32ToAuxInt(off) 5373 v.Aux = symToAux(sym) 5374 v.AddArg3(ptr, x, mem) 5375 return true 5376 } 5377 // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem) 5378 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 5379 // result: (FMOVDstore [off1+int32(off2)] {sym} ptr val mem) 5380 for { 5381 off1 := auxIntToInt32(v.AuxInt) 5382 sym := auxToSym(v.Aux) 5383 if v_0.Op != OpPPC64ADDconst { 5384 break 5385 } 5386 off2 := auxIntToInt64(v_0.AuxInt) 5387 ptr := v_0.Args[0] 5388 val := v_1 5389 mem := v_2 5390 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 5391 break 5392 } 5393 v.reset(OpPPC64FMOVDstore) 5394 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 5395 v.Aux = symToAux(sym) 5396 v.AddArg3(ptr, val, mem) 5397 return true 5398 } 5399 // match: (FMOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) 5400 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 5401 // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem) 5402 for { 5403 off1 := auxIntToInt32(v.AuxInt) 5404 sym1 := auxToSym(v.Aux) 5405 p := v_0 5406 if p.Op != OpPPC64MOVDaddr { 5407 break 5408 } 5409 off2 := auxIntToInt32(p.AuxInt) 5410 sym2 := auxToSym(p.Aux) 5411 ptr := p.Args[0] 5412 val := v_1 5413 mem := v_2 5414 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 5415 break 5416 } 5417 v.reset(OpPPC64FMOVDstore) 5418 v.AuxInt = int32ToAuxInt(off1 + off2) 5419 v.Aux = symToAux(mergeSym(sym1, sym2)) 5420 v.AddArg3(ptr, val, mem) 5421 return true 5422 } 5423 return false 5424 } 5425 func rewriteValuePPC64_OpPPC64FMOVSload(v *Value) bool { 5426 v_1 := v.Args[1] 5427 v_0 := v.Args[0] 5428 // match: (FMOVSload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) 5429 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 5430 // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} ptr mem) 5431 for { 5432 off1 := auxIntToInt32(v.AuxInt) 5433 sym1 := auxToSym(v.Aux) 5434 p := v_0 5435 if p.Op != OpPPC64MOVDaddr { 5436 break 5437 } 5438 off2 := auxIntToInt32(p.AuxInt) 5439 sym2 := auxToSym(p.Aux) 5440 ptr := p.Args[0] 5441 mem := v_1 5442 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 5443 break 5444 } 5445 v.reset(OpPPC64FMOVSload) 5446 v.AuxInt = int32ToAuxInt(off1 + off2) 5447 v.Aux = symToAux(mergeSym(sym1, sym2)) 5448 v.AddArg2(ptr, mem) 5449 return true 5450 } 5451 // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem) 5452 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 5453 // result: (FMOVSload [off1+int32(off2)] {sym} ptr mem) 5454 for { 5455 off1 := auxIntToInt32(v.AuxInt) 5456 sym := auxToSym(v.Aux) 5457 if v_0.Op != OpPPC64ADDconst { 5458 break 5459 } 5460 off2 := auxIntToInt64(v_0.AuxInt) 5461 ptr := v_0.Args[0] 5462 mem := v_1 5463 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 5464 break 5465 } 5466 v.reset(OpPPC64FMOVSload) 5467 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 5468 v.Aux = symToAux(sym) 5469 v.AddArg2(ptr, mem) 5470 return true 5471 } 5472 return false 5473 } 5474 func rewriteValuePPC64_OpPPC64FMOVSstore(v *Value) bool { 5475 v_2 := v.Args[2] 5476 v_1 := v.Args[1] 5477 v_0 := v.Args[0] 5478 // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem) 5479 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 5480 // result: (FMOVSstore [off1+int32(off2)] {sym} ptr val mem) 5481 for { 5482 off1 := auxIntToInt32(v.AuxInt) 5483 sym := auxToSym(v.Aux) 5484 if v_0.Op != OpPPC64ADDconst { 5485 break 5486 } 5487 off2 := auxIntToInt64(v_0.AuxInt) 5488 ptr := v_0.Args[0] 5489 val := v_1 5490 mem := v_2 5491 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 5492 break 5493 } 5494 v.reset(OpPPC64FMOVSstore) 5495 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 5496 v.Aux = symToAux(sym) 5497 v.AddArg3(ptr, val, mem) 5498 return true 5499 } 5500 // match: (FMOVSstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) 5501 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 5502 // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem) 5503 for { 5504 off1 := auxIntToInt32(v.AuxInt) 5505 sym1 := auxToSym(v.Aux) 5506 p := v_0 5507 if p.Op != OpPPC64MOVDaddr { 5508 break 5509 } 5510 off2 := auxIntToInt32(p.AuxInt) 5511 sym2 := auxToSym(p.Aux) 5512 ptr := p.Args[0] 5513 val := v_1 5514 mem := v_2 5515 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 5516 break 5517 } 5518 v.reset(OpPPC64FMOVSstore) 5519 v.AuxInt = int32ToAuxInt(off1 + off2) 5520 v.Aux = symToAux(mergeSym(sym1, sym2)) 5521 v.AddArg3(ptr, val, mem) 5522 return true 5523 } 5524 return false 5525 } 5526 func rewriteValuePPC64_OpPPC64FNEG(v *Value) bool { 5527 v_0 := v.Args[0] 5528 // match: (FNEG (FABS x)) 5529 // result: (FNABS x) 5530 for { 5531 if v_0.Op != OpPPC64FABS { 5532 break 5533 } 5534 x := v_0.Args[0] 5535 v.reset(OpPPC64FNABS) 5536 v.AddArg(x) 5537 return true 5538 } 5539 // match: (FNEG (FNABS x)) 5540 // result: (FABS x) 5541 for { 5542 if v_0.Op != OpPPC64FNABS { 5543 break 5544 } 5545 x := v_0.Args[0] 5546 v.reset(OpPPC64FABS) 5547 v.AddArg(x) 5548 return true 5549 } 5550 return false 5551 } 5552 func rewriteValuePPC64_OpPPC64FSQRT(v *Value) bool { 5553 v_0 := v.Args[0] 5554 // match: (FSQRT (FMOVDconst [x])) 5555 // cond: x >= 0 5556 // result: (FMOVDconst [math.Sqrt(x)]) 5557 for { 5558 if v_0.Op != OpPPC64FMOVDconst { 5559 break 5560 } 5561 x := auxIntToFloat64(v_0.AuxInt) 5562 if !(x >= 0) { 5563 break 5564 } 5565 v.reset(OpPPC64FMOVDconst) 5566 v.AuxInt = float64ToAuxInt(math.Sqrt(x)) 5567 return true 5568 } 5569 return false 5570 } 5571 func rewriteValuePPC64_OpPPC64FSUB(v *Value) bool { 5572 v_1 := v.Args[1] 5573 v_0 := v.Args[0] 5574 // match: (FSUB (FMUL x y) z) 5575 // cond: x.Block.Func.useFMA(v) 5576 // result: (FMSUB x y z) 5577 for { 5578 if v_0.Op != OpPPC64FMUL { 5579 break 5580 } 5581 _ = v_0.Args[1] 5582 v_0_0 := v_0.Args[0] 5583 v_0_1 := v_0.Args[1] 5584 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 5585 x := v_0_0 5586 y := v_0_1 5587 z := v_1 5588 if !(x.Block.Func.useFMA(v)) { 5589 continue 5590 } 5591 v.reset(OpPPC64FMSUB) 5592 v.AddArg3(x, y, z) 5593 return true 5594 } 5595 break 5596 } 5597 return false 5598 } 5599 func rewriteValuePPC64_OpPPC64FSUBS(v *Value) bool { 5600 v_1 := v.Args[1] 5601 v_0 := v.Args[0] 5602 // match: (FSUBS (FMULS x y) z) 5603 // cond: x.Block.Func.useFMA(v) 5604 // result: (FMSUBS x y z) 5605 for { 5606 if v_0.Op != OpPPC64FMULS { 5607 break 5608 } 5609 _ = v_0.Args[1] 5610 v_0_0 := v_0.Args[0] 5611 v_0_1 := v_0.Args[1] 5612 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 5613 x := v_0_0 5614 y := v_0_1 5615 z := v_1 5616 if !(x.Block.Func.useFMA(v)) { 5617 continue 5618 } 5619 v.reset(OpPPC64FMSUBS) 5620 v.AddArg3(x, y, z) 5621 return true 5622 } 5623 break 5624 } 5625 return false 5626 } 5627 func rewriteValuePPC64_OpPPC64FTRUNC(v *Value) bool { 5628 v_0 := v.Args[0] 5629 // match: (FTRUNC (FMOVDconst [x])) 5630 // result: (FMOVDconst [math.Trunc(x)]) 5631 for { 5632 if v_0.Op != OpPPC64FMOVDconst { 5633 break 5634 } 5635 x := auxIntToFloat64(v_0.AuxInt) 5636 v.reset(OpPPC64FMOVDconst) 5637 v.AuxInt = float64ToAuxInt(math.Trunc(x)) 5638 return true 5639 } 5640 return false 5641 } 5642 func rewriteValuePPC64_OpPPC64GreaterEqual(v *Value) bool { 5643 v_0 := v.Args[0] 5644 // match: (GreaterEqual (FlagEQ)) 5645 // result: (MOVDconst [1]) 5646 for { 5647 if v_0.Op != OpPPC64FlagEQ { 5648 break 5649 } 5650 v.reset(OpPPC64MOVDconst) 5651 v.AuxInt = int64ToAuxInt(1) 5652 return true 5653 } 5654 // match: (GreaterEqual (FlagLT)) 5655 // result: (MOVDconst [0]) 5656 for { 5657 if v_0.Op != OpPPC64FlagLT { 5658 break 5659 } 5660 v.reset(OpPPC64MOVDconst) 5661 v.AuxInt = int64ToAuxInt(0) 5662 return true 5663 } 5664 // match: (GreaterEqual (FlagGT)) 5665 // result: (MOVDconst [1]) 5666 for { 5667 if v_0.Op != OpPPC64FlagGT { 5668 break 5669 } 5670 v.reset(OpPPC64MOVDconst) 5671 v.AuxInt = int64ToAuxInt(1) 5672 return true 5673 } 5674 // match: (GreaterEqual (InvertFlags x)) 5675 // result: (LessEqual x) 5676 for { 5677 if v_0.Op != OpPPC64InvertFlags { 5678 break 5679 } 5680 x := v_0.Args[0] 5681 v.reset(OpPPC64LessEqual) 5682 v.AddArg(x) 5683 return true 5684 } 5685 // match: (GreaterEqual cmp) 5686 // result: (SETBCR [0] cmp) 5687 for { 5688 cmp := v_0 5689 v.reset(OpPPC64SETBCR) 5690 v.AuxInt = int32ToAuxInt(0) 5691 v.AddArg(cmp) 5692 return true 5693 } 5694 } 5695 func rewriteValuePPC64_OpPPC64GreaterThan(v *Value) bool { 5696 v_0 := v.Args[0] 5697 // match: (GreaterThan (FlagEQ)) 5698 // result: (MOVDconst [0]) 5699 for { 5700 if v_0.Op != OpPPC64FlagEQ { 5701 break 5702 } 5703 v.reset(OpPPC64MOVDconst) 5704 v.AuxInt = int64ToAuxInt(0) 5705 return true 5706 } 5707 // match: (GreaterThan (FlagLT)) 5708 // result: (MOVDconst [0]) 5709 for { 5710 if v_0.Op != OpPPC64FlagLT { 5711 break 5712 } 5713 v.reset(OpPPC64MOVDconst) 5714 v.AuxInt = int64ToAuxInt(0) 5715 return true 5716 } 5717 // match: (GreaterThan (FlagGT)) 5718 // result: (MOVDconst [1]) 5719 for { 5720 if v_0.Op != OpPPC64FlagGT { 5721 break 5722 } 5723 v.reset(OpPPC64MOVDconst) 5724 v.AuxInt = int64ToAuxInt(1) 5725 return true 5726 } 5727 // match: (GreaterThan (InvertFlags x)) 5728 // result: (LessThan x) 5729 for { 5730 if v_0.Op != OpPPC64InvertFlags { 5731 break 5732 } 5733 x := v_0.Args[0] 5734 v.reset(OpPPC64LessThan) 5735 v.AddArg(x) 5736 return true 5737 } 5738 // match: (GreaterThan cmp) 5739 // result: (SETBC [1] cmp) 5740 for { 5741 cmp := v_0 5742 v.reset(OpPPC64SETBC) 5743 v.AuxInt = int32ToAuxInt(1) 5744 v.AddArg(cmp) 5745 return true 5746 } 5747 } 5748 func rewriteValuePPC64_OpPPC64ISEL(v *Value) bool { 5749 v_2 := v.Args[2] 5750 v_1 := v.Args[1] 5751 v_0 := v.Args[0] 5752 b := v.Block 5753 typ := &b.Func.Config.Types 5754 // match: (ISEL [6] x y (Select1 (ANDCCconst [1] (SETBC [c] cmp)))) 5755 // result: (ISEL [c] x y cmp) 5756 for { 5757 if auxIntToInt32(v.AuxInt) != 6 { 5758 break 5759 } 5760 x := v_0 5761 y := v_1 5762 if v_2.Op != OpSelect1 { 5763 break 5764 } 5765 v_2_0 := v_2.Args[0] 5766 if v_2_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_2_0.AuxInt) != 1 { 5767 break 5768 } 5769 v_2_0_0 := v_2_0.Args[0] 5770 if v_2_0_0.Op != OpPPC64SETBC { 5771 break 5772 } 5773 c := auxIntToInt32(v_2_0_0.AuxInt) 5774 cmp := v_2_0_0.Args[0] 5775 v.reset(OpPPC64ISEL) 5776 v.AuxInt = int32ToAuxInt(c) 5777 v.AddArg3(x, y, cmp) 5778 return true 5779 } 5780 // match: (ISEL [6] x y (CMPconst [0] (SETBC [c] cmp))) 5781 // result: (ISEL [c] x y cmp) 5782 for { 5783 if auxIntToInt32(v.AuxInt) != 6 { 5784 break 5785 } 5786 x := v_0 5787 y := v_1 5788 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 { 5789 break 5790 } 5791 v_2_0 := v_2.Args[0] 5792 if v_2_0.Op != OpPPC64SETBC { 5793 break 5794 } 5795 c := auxIntToInt32(v_2_0.AuxInt) 5796 cmp := v_2_0.Args[0] 5797 v.reset(OpPPC64ISEL) 5798 v.AuxInt = int32ToAuxInt(c) 5799 v.AddArg3(x, y, cmp) 5800 return true 5801 } 5802 // match: (ISEL [6] x y (CMPWconst [0] (SETBC [c] cmp))) 5803 // result: (ISEL [c] x y cmp) 5804 for { 5805 if auxIntToInt32(v.AuxInt) != 6 { 5806 break 5807 } 5808 x := v_0 5809 y := v_1 5810 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 { 5811 break 5812 } 5813 v_2_0 := v_2.Args[0] 5814 if v_2_0.Op != OpPPC64SETBC { 5815 break 5816 } 5817 c := auxIntToInt32(v_2_0.AuxInt) 5818 cmp := v_2_0.Args[0] 5819 v.reset(OpPPC64ISEL) 5820 v.AuxInt = int32ToAuxInt(c) 5821 v.AddArg3(x, y, cmp) 5822 return true 5823 } 5824 // match: (ISEL [6] x y (CMPconst [0] (SETBCR [c] cmp))) 5825 // result: (ISEL [c+4] x y cmp) 5826 for { 5827 if auxIntToInt32(v.AuxInt) != 6 { 5828 break 5829 } 5830 x := v_0 5831 y := v_1 5832 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 { 5833 break 5834 } 5835 v_2_0 := v_2.Args[0] 5836 if v_2_0.Op != OpPPC64SETBCR { 5837 break 5838 } 5839 c := auxIntToInt32(v_2_0.AuxInt) 5840 cmp := v_2_0.Args[0] 5841 v.reset(OpPPC64ISEL) 5842 v.AuxInt = int32ToAuxInt(c + 4) 5843 v.AddArg3(x, y, cmp) 5844 return true 5845 } 5846 // match: (ISEL [6] x y (CMPWconst [0] (SETBCR [c] cmp))) 5847 // result: (ISEL [c+4] x y cmp) 5848 for { 5849 if auxIntToInt32(v.AuxInt) != 6 { 5850 break 5851 } 5852 x := v_0 5853 y := v_1 5854 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 { 5855 break 5856 } 5857 v_2_0 := v_2.Args[0] 5858 if v_2_0.Op != OpPPC64SETBCR { 5859 break 5860 } 5861 c := auxIntToInt32(v_2_0.AuxInt) 5862 cmp := v_2_0.Args[0] 5863 v.reset(OpPPC64ISEL) 5864 v.AuxInt = int32ToAuxInt(c + 4) 5865 v.AddArg3(x, y, cmp) 5866 return true 5867 } 5868 // match: (ISEL [2] x _ (FlagEQ)) 5869 // result: x 5870 for { 5871 if auxIntToInt32(v.AuxInt) != 2 { 5872 break 5873 } 5874 x := v_0 5875 if v_2.Op != OpPPC64FlagEQ { 5876 break 5877 } 5878 v.copyOf(x) 5879 return true 5880 } 5881 // match: (ISEL [2] _ y (FlagLT)) 5882 // result: y 5883 for { 5884 if auxIntToInt32(v.AuxInt) != 2 { 5885 break 5886 } 5887 y := v_1 5888 if v_2.Op != OpPPC64FlagLT { 5889 break 5890 } 5891 v.copyOf(y) 5892 return true 5893 } 5894 // match: (ISEL [2] _ y (FlagGT)) 5895 // result: y 5896 for { 5897 if auxIntToInt32(v.AuxInt) != 2 { 5898 break 5899 } 5900 y := v_1 5901 if v_2.Op != OpPPC64FlagGT { 5902 break 5903 } 5904 v.copyOf(y) 5905 return true 5906 } 5907 // match: (ISEL [6] _ y (FlagEQ)) 5908 // result: y 5909 for { 5910 if auxIntToInt32(v.AuxInt) != 6 { 5911 break 5912 } 5913 y := v_1 5914 if v_2.Op != OpPPC64FlagEQ { 5915 break 5916 } 5917 v.copyOf(y) 5918 return true 5919 } 5920 // match: (ISEL [6] x _ (FlagLT)) 5921 // result: x 5922 for { 5923 if auxIntToInt32(v.AuxInt) != 6 { 5924 break 5925 } 5926 x := v_0 5927 if v_2.Op != OpPPC64FlagLT { 5928 break 5929 } 5930 v.copyOf(x) 5931 return true 5932 } 5933 // match: (ISEL [6] x _ (FlagGT)) 5934 // result: x 5935 for { 5936 if auxIntToInt32(v.AuxInt) != 6 { 5937 break 5938 } 5939 x := v_0 5940 if v_2.Op != OpPPC64FlagGT { 5941 break 5942 } 5943 v.copyOf(x) 5944 return true 5945 } 5946 // match: (ISEL [0] _ y (FlagEQ)) 5947 // result: y 5948 for { 5949 if auxIntToInt32(v.AuxInt) != 0 { 5950 break 5951 } 5952 y := v_1 5953 if v_2.Op != OpPPC64FlagEQ { 5954 break 5955 } 5956 v.copyOf(y) 5957 return true 5958 } 5959 // match: (ISEL [0] _ y (FlagGT)) 5960 // result: y 5961 for { 5962 if auxIntToInt32(v.AuxInt) != 0 { 5963 break 5964 } 5965 y := v_1 5966 if v_2.Op != OpPPC64FlagGT { 5967 break 5968 } 5969 v.copyOf(y) 5970 return true 5971 } 5972 // match: (ISEL [0] x _ (FlagLT)) 5973 // result: x 5974 for { 5975 if auxIntToInt32(v.AuxInt) != 0 { 5976 break 5977 } 5978 x := v_0 5979 if v_2.Op != OpPPC64FlagLT { 5980 break 5981 } 5982 v.copyOf(x) 5983 return true 5984 } 5985 // match: (ISEL [5] _ x (FlagEQ)) 5986 // result: x 5987 for { 5988 if auxIntToInt32(v.AuxInt) != 5 { 5989 break 5990 } 5991 x := v_1 5992 if v_2.Op != OpPPC64FlagEQ { 5993 break 5994 } 5995 v.copyOf(x) 5996 return true 5997 } 5998 // match: (ISEL [5] _ x (FlagLT)) 5999 // result: x 6000 for { 6001 if auxIntToInt32(v.AuxInt) != 5 { 6002 break 6003 } 6004 x := v_1 6005 if v_2.Op != OpPPC64FlagLT { 6006 break 6007 } 6008 v.copyOf(x) 6009 return true 6010 } 6011 // match: (ISEL [5] y _ (FlagGT)) 6012 // result: y 6013 for { 6014 if auxIntToInt32(v.AuxInt) != 5 { 6015 break 6016 } 6017 y := v_0 6018 if v_2.Op != OpPPC64FlagGT { 6019 break 6020 } 6021 v.copyOf(y) 6022 return true 6023 } 6024 // match: (ISEL [1] _ y (FlagEQ)) 6025 // result: y 6026 for { 6027 if auxIntToInt32(v.AuxInt) != 1 { 6028 break 6029 } 6030 y := v_1 6031 if v_2.Op != OpPPC64FlagEQ { 6032 break 6033 } 6034 v.copyOf(y) 6035 return true 6036 } 6037 // match: (ISEL [1] _ y (FlagLT)) 6038 // result: y 6039 for { 6040 if auxIntToInt32(v.AuxInt) != 1 { 6041 break 6042 } 6043 y := v_1 6044 if v_2.Op != OpPPC64FlagLT { 6045 break 6046 } 6047 v.copyOf(y) 6048 return true 6049 } 6050 // match: (ISEL [1] x _ (FlagGT)) 6051 // result: x 6052 for { 6053 if auxIntToInt32(v.AuxInt) != 1 { 6054 break 6055 } 6056 x := v_0 6057 if v_2.Op != OpPPC64FlagGT { 6058 break 6059 } 6060 v.copyOf(x) 6061 return true 6062 } 6063 // match: (ISEL [4] x _ (FlagEQ)) 6064 // result: x 6065 for { 6066 if auxIntToInt32(v.AuxInt) != 4 { 6067 break 6068 } 6069 x := v_0 6070 if v_2.Op != OpPPC64FlagEQ { 6071 break 6072 } 6073 v.copyOf(x) 6074 return true 6075 } 6076 // match: (ISEL [4] x _ (FlagGT)) 6077 // result: x 6078 for { 6079 if auxIntToInt32(v.AuxInt) != 4 { 6080 break 6081 } 6082 x := v_0 6083 if v_2.Op != OpPPC64FlagGT { 6084 break 6085 } 6086 v.copyOf(x) 6087 return true 6088 } 6089 // match: (ISEL [4] _ y (FlagLT)) 6090 // result: y 6091 for { 6092 if auxIntToInt32(v.AuxInt) != 4 { 6093 break 6094 } 6095 y := v_1 6096 if v_2.Op != OpPPC64FlagLT { 6097 break 6098 } 6099 v.copyOf(y) 6100 return true 6101 } 6102 // match: (ISEL [2] x y (CMPconst [0] (Select0 (ANDCCconst [n] z)))) 6103 // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z ))) 6104 for { 6105 if auxIntToInt32(v.AuxInt) != 2 { 6106 break 6107 } 6108 x := v_0 6109 y := v_1 6110 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 { 6111 break 6112 } 6113 v_2_0 := v_2.Args[0] 6114 if v_2_0.Op != OpSelect0 { 6115 break 6116 } 6117 v_2_0_0 := v_2_0.Args[0] 6118 if v_2_0_0.Op != OpPPC64ANDCCconst { 6119 break 6120 } 6121 n := auxIntToInt64(v_2_0_0.AuxInt) 6122 z := v_2_0_0.Args[0] 6123 v.reset(OpPPC64ISEL) 6124 v.AuxInt = int32ToAuxInt(2) 6125 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 6126 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 6127 v1.AuxInt = int64ToAuxInt(n) 6128 v1.AddArg(z) 6129 v0.AddArg(v1) 6130 v.AddArg3(x, y, v0) 6131 return true 6132 } 6133 // match: (ISEL [2] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z)))) 6134 // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z ))) 6135 for { 6136 if auxIntToInt32(v.AuxInt) != 2 { 6137 break 6138 } 6139 x := v_0 6140 y := v_1 6141 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 { 6142 break 6143 } 6144 v_2_0 := v_2.Args[0] 6145 if v_2_0.Op != OpSelect0 { 6146 break 6147 } 6148 v_2_0_0 := v_2_0.Args[0] 6149 if v_2_0_0.Op != OpPPC64ANDCCconst { 6150 break 6151 } 6152 n := auxIntToInt64(v_2_0_0.AuxInt) 6153 z := v_2_0_0.Args[0] 6154 v.reset(OpPPC64ISEL) 6155 v.AuxInt = int32ToAuxInt(2) 6156 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 6157 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 6158 v1.AuxInt = int64ToAuxInt(n) 6159 v1.AddArg(z) 6160 v0.AddArg(v1) 6161 v.AddArg3(x, y, v0) 6162 return true 6163 } 6164 // match: (ISEL [6] x y (CMPconst [0] (Select0 (ANDCCconst [n] z)))) 6165 // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z ))) 6166 for { 6167 if auxIntToInt32(v.AuxInt) != 6 { 6168 break 6169 } 6170 x := v_0 6171 y := v_1 6172 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 { 6173 break 6174 } 6175 v_2_0 := v_2.Args[0] 6176 if v_2_0.Op != OpSelect0 { 6177 break 6178 } 6179 v_2_0_0 := v_2_0.Args[0] 6180 if v_2_0_0.Op != OpPPC64ANDCCconst { 6181 break 6182 } 6183 n := auxIntToInt64(v_2_0_0.AuxInt) 6184 z := v_2_0_0.Args[0] 6185 v.reset(OpPPC64ISEL) 6186 v.AuxInt = int32ToAuxInt(6) 6187 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 6188 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 6189 v1.AuxInt = int64ToAuxInt(n) 6190 v1.AddArg(z) 6191 v0.AddArg(v1) 6192 v.AddArg3(x, y, v0) 6193 return true 6194 } 6195 // match: (ISEL [6] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z)))) 6196 // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z ))) 6197 for { 6198 if auxIntToInt32(v.AuxInt) != 6 { 6199 break 6200 } 6201 x := v_0 6202 y := v_1 6203 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 { 6204 break 6205 } 6206 v_2_0 := v_2.Args[0] 6207 if v_2_0.Op != OpSelect0 { 6208 break 6209 } 6210 v_2_0_0 := v_2_0.Args[0] 6211 if v_2_0_0.Op != OpPPC64ANDCCconst { 6212 break 6213 } 6214 n := auxIntToInt64(v_2_0_0.AuxInt) 6215 z := v_2_0_0.Args[0] 6216 v.reset(OpPPC64ISEL) 6217 v.AuxInt = int32ToAuxInt(6) 6218 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 6219 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 6220 v1.AuxInt = int64ToAuxInt(n) 6221 v1.AddArg(z) 6222 v0.AddArg(v1) 6223 v.AddArg3(x, y, v0) 6224 return true 6225 } 6226 // match: (ISEL [n] x y (InvertFlags bool)) 6227 // cond: n%4 == 0 6228 // result: (ISEL [n+1] x y bool) 6229 for { 6230 n := auxIntToInt32(v.AuxInt) 6231 x := v_0 6232 y := v_1 6233 if v_2.Op != OpPPC64InvertFlags { 6234 break 6235 } 6236 bool := v_2.Args[0] 6237 if !(n%4 == 0) { 6238 break 6239 } 6240 v.reset(OpPPC64ISEL) 6241 v.AuxInt = int32ToAuxInt(n + 1) 6242 v.AddArg3(x, y, bool) 6243 return true 6244 } 6245 // match: (ISEL [n] x y (InvertFlags bool)) 6246 // cond: n%4 == 1 6247 // result: (ISEL [n-1] x y bool) 6248 for { 6249 n := auxIntToInt32(v.AuxInt) 6250 x := v_0 6251 y := v_1 6252 if v_2.Op != OpPPC64InvertFlags { 6253 break 6254 } 6255 bool := v_2.Args[0] 6256 if !(n%4 == 1) { 6257 break 6258 } 6259 v.reset(OpPPC64ISEL) 6260 v.AuxInt = int32ToAuxInt(n - 1) 6261 v.AddArg3(x, y, bool) 6262 return true 6263 } 6264 // match: (ISEL [n] x y (InvertFlags bool)) 6265 // cond: n%4 == 2 6266 // result: (ISEL [n] x y bool) 6267 for { 6268 n := auxIntToInt32(v.AuxInt) 6269 x := v_0 6270 y := v_1 6271 if v_2.Op != OpPPC64InvertFlags { 6272 break 6273 } 6274 bool := v_2.Args[0] 6275 if !(n%4 == 2) { 6276 break 6277 } 6278 v.reset(OpPPC64ISEL) 6279 v.AuxInt = int32ToAuxInt(n) 6280 v.AddArg3(x, y, bool) 6281 return true 6282 } 6283 return false 6284 } 6285 func rewriteValuePPC64_OpPPC64LessEqual(v *Value) bool { 6286 v_0 := v.Args[0] 6287 // match: (LessEqual (FlagEQ)) 6288 // result: (MOVDconst [1]) 6289 for { 6290 if v_0.Op != OpPPC64FlagEQ { 6291 break 6292 } 6293 v.reset(OpPPC64MOVDconst) 6294 v.AuxInt = int64ToAuxInt(1) 6295 return true 6296 } 6297 // match: (LessEqual (FlagLT)) 6298 // result: (MOVDconst [1]) 6299 for { 6300 if v_0.Op != OpPPC64FlagLT { 6301 break 6302 } 6303 v.reset(OpPPC64MOVDconst) 6304 v.AuxInt = int64ToAuxInt(1) 6305 return true 6306 } 6307 // match: (LessEqual (FlagGT)) 6308 // result: (MOVDconst [0]) 6309 for { 6310 if v_0.Op != OpPPC64FlagGT { 6311 break 6312 } 6313 v.reset(OpPPC64MOVDconst) 6314 v.AuxInt = int64ToAuxInt(0) 6315 return true 6316 } 6317 // match: (LessEqual (InvertFlags x)) 6318 // result: (GreaterEqual x) 6319 for { 6320 if v_0.Op != OpPPC64InvertFlags { 6321 break 6322 } 6323 x := v_0.Args[0] 6324 v.reset(OpPPC64GreaterEqual) 6325 v.AddArg(x) 6326 return true 6327 } 6328 // match: (LessEqual cmp) 6329 // result: (SETBCR [1] cmp) 6330 for { 6331 cmp := v_0 6332 v.reset(OpPPC64SETBCR) 6333 v.AuxInt = int32ToAuxInt(1) 6334 v.AddArg(cmp) 6335 return true 6336 } 6337 } 6338 func rewriteValuePPC64_OpPPC64LessThan(v *Value) bool { 6339 v_0 := v.Args[0] 6340 // match: (LessThan (FlagEQ)) 6341 // result: (MOVDconst [0]) 6342 for { 6343 if v_0.Op != OpPPC64FlagEQ { 6344 break 6345 } 6346 v.reset(OpPPC64MOVDconst) 6347 v.AuxInt = int64ToAuxInt(0) 6348 return true 6349 } 6350 // match: (LessThan (FlagLT)) 6351 // result: (MOVDconst [1]) 6352 for { 6353 if v_0.Op != OpPPC64FlagLT { 6354 break 6355 } 6356 v.reset(OpPPC64MOVDconst) 6357 v.AuxInt = int64ToAuxInt(1) 6358 return true 6359 } 6360 // match: (LessThan (FlagGT)) 6361 // result: (MOVDconst [0]) 6362 for { 6363 if v_0.Op != OpPPC64FlagGT { 6364 break 6365 } 6366 v.reset(OpPPC64MOVDconst) 6367 v.AuxInt = int64ToAuxInt(0) 6368 return true 6369 } 6370 // match: (LessThan (InvertFlags x)) 6371 // result: (GreaterThan x) 6372 for { 6373 if v_0.Op != OpPPC64InvertFlags { 6374 break 6375 } 6376 x := v_0.Args[0] 6377 v.reset(OpPPC64GreaterThan) 6378 v.AddArg(x) 6379 return true 6380 } 6381 // match: (LessThan cmp) 6382 // result: (SETBC [0] cmp) 6383 for { 6384 cmp := v_0 6385 v.reset(OpPPC64SETBC) 6386 v.AuxInt = int32ToAuxInt(0) 6387 v.AddArg(cmp) 6388 return true 6389 } 6390 } 6391 func rewriteValuePPC64_OpPPC64MFVSRD(v *Value) bool { 6392 v_0 := v.Args[0] 6393 b := v.Block 6394 typ := &b.Func.Config.Types 6395 // match: (MFVSRD (FMOVDconst [c])) 6396 // result: (MOVDconst [int64(math.Float64bits(c))]) 6397 for { 6398 if v_0.Op != OpPPC64FMOVDconst { 6399 break 6400 } 6401 c := auxIntToFloat64(v_0.AuxInt) 6402 v.reset(OpPPC64MOVDconst) 6403 v.AuxInt = int64ToAuxInt(int64(math.Float64bits(c))) 6404 return true 6405 } 6406 // match: (MFVSRD x:(FMOVDload [off] {sym} ptr mem)) 6407 // cond: x.Uses == 1 && clobber(x) 6408 // result: @x.Block (MOVDload [off] {sym} ptr mem) 6409 for { 6410 x := v_0 6411 if x.Op != OpPPC64FMOVDload { 6412 break 6413 } 6414 off := auxIntToInt32(x.AuxInt) 6415 sym := auxToSym(x.Aux) 6416 mem := x.Args[1] 6417 ptr := x.Args[0] 6418 if !(x.Uses == 1 && clobber(x)) { 6419 break 6420 } 6421 b = x.Block 6422 v0 := b.NewValue0(x.Pos, OpPPC64MOVDload, typ.Int64) 6423 v.copyOf(v0) 6424 v0.AuxInt = int32ToAuxInt(off) 6425 v0.Aux = symToAux(sym) 6426 v0.AddArg2(ptr, mem) 6427 return true 6428 } 6429 return false 6430 } 6431 func rewriteValuePPC64_OpPPC64MOVBZload(v *Value) bool { 6432 v_1 := v.Args[1] 6433 v_0 := v.Args[0] 6434 // match: (MOVBZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) 6435 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 6436 // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem) 6437 for { 6438 off1 := auxIntToInt32(v.AuxInt) 6439 sym1 := auxToSym(v.Aux) 6440 p := v_0 6441 if p.Op != OpPPC64MOVDaddr { 6442 break 6443 } 6444 off2 := auxIntToInt32(p.AuxInt) 6445 sym2 := auxToSym(p.Aux) 6446 ptr := p.Args[0] 6447 mem := v_1 6448 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 6449 break 6450 } 6451 v.reset(OpPPC64MOVBZload) 6452 v.AuxInt = int32ToAuxInt(off1 + off2) 6453 v.Aux = symToAux(mergeSym(sym1, sym2)) 6454 v.AddArg2(ptr, mem) 6455 return true 6456 } 6457 // match: (MOVBZload [off1] {sym} (ADDconst [off2] x) mem) 6458 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 6459 // result: (MOVBZload [off1+int32(off2)] {sym} x mem) 6460 for { 6461 off1 := auxIntToInt32(v.AuxInt) 6462 sym := auxToSym(v.Aux) 6463 if v_0.Op != OpPPC64ADDconst { 6464 break 6465 } 6466 off2 := auxIntToInt64(v_0.AuxInt) 6467 x := v_0.Args[0] 6468 mem := v_1 6469 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 6470 break 6471 } 6472 v.reset(OpPPC64MOVBZload) 6473 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 6474 v.Aux = symToAux(sym) 6475 v.AddArg2(x, mem) 6476 return true 6477 } 6478 // match: (MOVBZload [0] {sym} p:(ADD ptr idx) mem) 6479 // cond: sym == nil && p.Uses == 1 6480 // result: (MOVBZloadidx ptr idx mem) 6481 for { 6482 if auxIntToInt32(v.AuxInt) != 0 { 6483 break 6484 } 6485 sym := auxToSym(v.Aux) 6486 p := v_0 6487 if p.Op != OpPPC64ADD { 6488 break 6489 } 6490 idx := p.Args[1] 6491 ptr := p.Args[0] 6492 mem := v_1 6493 if !(sym == nil && p.Uses == 1) { 6494 break 6495 } 6496 v.reset(OpPPC64MOVBZloadidx) 6497 v.AddArg3(ptr, idx, mem) 6498 return true 6499 } 6500 return false 6501 } 6502 func rewriteValuePPC64_OpPPC64MOVBZloadidx(v *Value) bool { 6503 v_2 := v.Args[2] 6504 v_1 := v.Args[1] 6505 v_0 := v.Args[0] 6506 // match: (MOVBZloadidx ptr (MOVDconst [c]) mem) 6507 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 6508 // result: (MOVBZload [int32(c)] ptr mem) 6509 for { 6510 ptr := v_0 6511 if v_1.Op != OpPPC64MOVDconst { 6512 break 6513 } 6514 c := auxIntToInt64(v_1.AuxInt) 6515 mem := v_2 6516 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 6517 break 6518 } 6519 v.reset(OpPPC64MOVBZload) 6520 v.AuxInt = int32ToAuxInt(int32(c)) 6521 v.AddArg2(ptr, mem) 6522 return true 6523 } 6524 // match: (MOVBZloadidx (MOVDconst [c]) ptr mem) 6525 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 6526 // result: (MOVBZload [int32(c)] ptr mem) 6527 for { 6528 if v_0.Op != OpPPC64MOVDconst { 6529 break 6530 } 6531 c := auxIntToInt64(v_0.AuxInt) 6532 ptr := v_1 6533 mem := v_2 6534 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 6535 break 6536 } 6537 v.reset(OpPPC64MOVBZload) 6538 v.AuxInt = int32ToAuxInt(int32(c)) 6539 v.AddArg2(ptr, mem) 6540 return true 6541 } 6542 return false 6543 } 6544 func rewriteValuePPC64_OpPPC64MOVBZreg(v *Value) bool { 6545 v_0 := v.Args[0] 6546 b := v.Block 6547 typ := &b.Func.Config.Types 6548 // match: (MOVBZreg y:(Select0 (ANDCCconst [c] _))) 6549 // cond: uint64(c) <= 0xFF 6550 // result: y 6551 for { 6552 y := v_0 6553 if y.Op != OpSelect0 { 6554 break 6555 } 6556 y_0 := y.Args[0] 6557 if y_0.Op != OpPPC64ANDCCconst { 6558 break 6559 } 6560 c := auxIntToInt64(y_0.AuxInt) 6561 if !(uint64(c) <= 0xFF) { 6562 break 6563 } 6564 v.copyOf(y) 6565 return true 6566 } 6567 // match: (MOVBZreg (SRWconst [c] (MOVBZreg x))) 6568 // result: (SRWconst [c] (MOVBZreg x)) 6569 for { 6570 if v_0.Op != OpPPC64SRWconst { 6571 break 6572 } 6573 c := auxIntToInt64(v_0.AuxInt) 6574 v_0_0 := v_0.Args[0] 6575 if v_0_0.Op != OpPPC64MOVBZreg { 6576 break 6577 } 6578 x := v_0_0.Args[0] 6579 v.reset(OpPPC64SRWconst) 6580 v.AuxInt = int64ToAuxInt(c) 6581 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 6582 v0.AddArg(x) 6583 v.AddArg(v0) 6584 return true 6585 } 6586 // match: (MOVBZreg (SRWconst [c] x)) 6587 // cond: sizeof(x.Type) == 8 6588 // result: (SRWconst [c] x) 6589 for { 6590 if v_0.Op != OpPPC64SRWconst { 6591 break 6592 } 6593 c := auxIntToInt64(v_0.AuxInt) 6594 x := v_0.Args[0] 6595 if !(sizeof(x.Type) == 8) { 6596 break 6597 } 6598 v.reset(OpPPC64SRWconst) 6599 v.AuxInt = int64ToAuxInt(c) 6600 v.AddArg(x) 6601 return true 6602 } 6603 // match: (MOVBZreg (SRDconst [c] x)) 6604 // cond: c>=56 6605 // result: (SRDconst [c] x) 6606 for { 6607 if v_0.Op != OpPPC64SRDconst { 6608 break 6609 } 6610 c := auxIntToInt64(v_0.AuxInt) 6611 x := v_0.Args[0] 6612 if !(c >= 56) { 6613 break 6614 } 6615 v.reset(OpPPC64SRDconst) 6616 v.AuxInt = int64ToAuxInt(c) 6617 v.AddArg(x) 6618 return true 6619 } 6620 // match: (MOVBZreg (SRWconst [c] x)) 6621 // cond: c>=24 6622 // result: (SRWconst [c] x) 6623 for { 6624 if v_0.Op != OpPPC64SRWconst { 6625 break 6626 } 6627 c := auxIntToInt64(v_0.AuxInt) 6628 x := v_0.Args[0] 6629 if !(c >= 24) { 6630 break 6631 } 6632 v.reset(OpPPC64SRWconst) 6633 v.AuxInt = int64ToAuxInt(c) 6634 v.AddArg(x) 6635 return true 6636 } 6637 // match: (MOVBZreg y:(MOVBZreg _)) 6638 // result: y 6639 for { 6640 y := v_0 6641 if y.Op != OpPPC64MOVBZreg { 6642 break 6643 } 6644 v.copyOf(y) 6645 return true 6646 } 6647 // match: (MOVBZreg (MOVBreg x)) 6648 // result: (MOVBZreg x) 6649 for { 6650 if v_0.Op != OpPPC64MOVBreg { 6651 break 6652 } 6653 x := v_0.Args[0] 6654 v.reset(OpPPC64MOVBZreg) 6655 v.AddArg(x) 6656 return true 6657 } 6658 // match: (MOVBZreg (OR <t> x (MOVWZreg y))) 6659 // result: (MOVBZreg (OR <t> x y)) 6660 for { 6661 if v_0.Op != OpPPC64OR { 6662 break 6663 } 6664 t := v_0.Type 6665 _ = v_0.Args[1] 6666 v_0_0 := v_0.Args[0] 6667 v_0_1 := v_0.Args[1] 6668 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 6669 x := v_0_0 6670 if v_0_1.Op != OpPPC64MOVWZreg { 6671 continue 6672 } 6673 y := v_0_1.Args[0] 6674 v.reset(OpPPC64MOVBZreg) 6675 v0 := b.NewValue0(v.Pos, OpPPC64OR, t) 6676 v0.AddArg2(x, y) 6677 v.AddArg(v0) 6678 return true 6679 } 6680 break 6681 } 6682 // match: (MOVBZreg (XOR <t> x (MOVWZreg y))) 6683 // result: (MOVBZreg (XOR <t> x y)) 6684 for { 6685 if v_0.Op != OpPPC64XOR { 6686 break 6687 } 6688 t := v_0.Type 6689 _ = v_0.Args[1] 6690 v_0_0 := v_0.Args[0] 6691 v_0_1 := v_0.Args[1] 6692 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 6693 x := v_0_0 6694 if v_0_1.Op != OpPPC64MOVWZreg { 6695 continue 6696 } 6697 y := v_0_1.Args[0] 6698 v.reset(OpPPC64MOVBZreg) 6699 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t) 6700 v0.AddArg2(x, y) 6701 v.AddArg(v0) 6702 return true 6703 } 6704 break 6705 } 6706 // match: (MOVBZreg (AND <t> x (MOVWZreg y))) 6707 // result: (MOVBZreg (AND <t> x y)) 6708 for { 6709 if v_0.Op != OpPPC64AND { 6710 break 6711 } 6712 t := v_0.Type 6713 _ = v_0.Args[1] 6714 v_0_0 := v_0.Args[0] 6715 v_0_1 := v_0.Args[1] 6716 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 6717 x := v_0_0 6718 if v_0_1.Op != OpPPC64MOVWZreg { 6719 continue 6720 } 6721 y := v_0_1.Args[0] 6722 v.reset(OpPPC64MOVBZreg) 6723 v0 := b.NewValue0(v.Pos, OpPPC64AND, t) 6724 v0.AddArg2(x, y) 6725 v.AddArg(v0) 6726 return true 6727 } 6728 break 6729 } 6730 // match: (MOVBZreg (OR <t> x (MOVHZreg y))) 6731 // result: (MOVBZreg (OR <t> x y)) 6732 for { 6733 if v_0.Op != OpPPC64OR { 6734 break 6735 } 6736 t := v_0.Type 6737 _ = v_0.Args[1] 6738 v_0_0 := v_0.Args[0] 6739 v_0_1 := v_0.Args[1] 6740 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 6741 x := v_0_0 6742 if v_0_1.Op != OpPPC64MOVHZreg { 6743 continue 6744 } 6745 y := v_0_1.Args[0] 6746 v.reset(OpPPC64MOVBZreg) 6747 v0 := b.NewValue0(v.Pos, OpPPC64OR, t) 6748 v0.AddArg2(x, y) 6749 v.AddArg(v0) 6750 return true 6751 } 6752 break 6753 } 6754 // match: (MOVBZreg (XOR <t> x (MOVHZreg y))) 6755 // result: (MOVBZreg (XOR <t> x y)) 6756 for { 6757 if v_0.Op != OpPPC64XOR { 6758 break 6759 } 6760 t := v_0.Type 6761 _ = v_0.Args[1] 6762 v_0_0 := v_0.Args[0] 6763 v_0_1 := v_0.Args[1] 6764 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 6765 x := v_0_0 6766 if v_0_1.Op != OpPPC64MOVHZreg { 6767 continue 6768 } 6769 y := v_0_1.Args[0] 6770 v.reset(OpPPC64MOVBZreg) 6771 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t) 6772 v0.AddArg2(x, y) 6773 v.AddArg(v0) 6774 return true 6775 } 6776 break 6777 } 6778 // match: (MOVBZreg (AND <t> x (MOVHZreg y))) 6779 // result: (MOVBZreg (AND <t> x y)) 6780 for { 6781 if v_0.Op != OpPPC64AND { 6782 break 6783 } 6784 t := v_0.Type 6785 _ = v_0.Args[1] 6786 v_0_0 := v_0.Args[0] 6787 v_0_1 := v_0.Args[1] 6788 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 6789 x := v_0_0 6790 if v_0_1.Op != OpPPC64MOVHZreg { 6791 continue 6792 } 6793 y := v_0_1.Args[0] 6794 v.reset(OpPPC64MOVBZreg) 6795 v0 := b.NewValue0(v.Pos, OpPPC64AND, t) 6796 v0.AddArg2(x, y) 6797 v.AddArg(v0) 6798 return true 6799 } 6800 break 6801 } 6802 // match: (MOVBZreg (OR <t> x (MOVBZreg y))) 6803 // result: (MOVBZreg (OR <t> x y)) 6804 for { 6805 if v_0.Op != OpPPC64OR { 6806 break 6807 } 6808 t := v_0.Type 6809 _ = v_0.Args[1] 6810 v_0_0 := v_0.Args[0] 6811 v_0_1 := v_0.Args[1] 6812 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 6813 x := v_0_0 6814 if v_0_1.Op != OpPPC64MOVBZreg { 6815 continue 6816 } 6817 y := v_0_1.Args[0] 6818 v.reset(OpPPC64MOVBZreg) 6819 v0 := b.NewValue0(v.Pos, OpPPC64OR, t) 6820 v0.AddArg2(x, y) 6821 v.AddArg(v0) 6822 return true 6823 } 6824 break 6825 } 6826 // match: (MOVBZreg (XOR <t> x (MOVBZreg y))) 6827 // result: (MOVBZreg (XOR <t> x y)) 6828 for { 6829 if v_0.Op != OpPPC64XOR { 6830 break 6831 } 6832 t := v_0.Type 6833 _ = v_0.Args[1] 6834 v_0_0 := v_0.Args[0] 6835 v_0_1 := v_0.Args[1] 6836 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 6837 x := v_0_0 6838 if v_0_1.Op != OpPPC64MOVBZreg { 6839 continue 6840 } 6841 y := v_0_1.Args[0] 6842 v.reset(OpPPC64MOVBZreg) 6843 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t) 6844 v0.AddArg2(x, y) 6845 v.AddArg(v0) 6846 return true 6847 } 6848 break 6849 } 6850 // match: (MOVBZreg (AND <t> x (MOVBZreg y))) 6851 // result: (MOVBZreg (AND <t> x y)) 6852 for { 6853 if v_0.Op != OpPPC64AND { 6854 break 6855 } 6856 t := v_0.Type 6857 _ = v_0.Args[1] 6858 v_0_0 := v_0.Args[0] 6859 v_0_1 := v_0.Args[1] 6860 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 6861 x := v_0_0 6862 if v_0_1.Op != OpPPC64MOVBZreg { 6863 continue 6864 } 6865 y := v_0_1.Args[0] 6866 v.reset(OpPPC64MOVBZreg) 6867 v0 := b.NewValue0(v.Pos, OpPPC64AND, t) 6868 v0.AddArg2(x, y) 6869 v.AddArg(v0) 6870 return true 6871 } 6872 break 6873 } 6874 // match: (MOVBZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x)))) 6875 // result: z 6876 for { 6877 z := v_0 6878 if z.Op != OpSelect0 { 6879 break 6880 } 6881 z_0 := z.Args[0] 6882 if z_0.Op != OpPPC64ANDCCconst { 6883 break 6884 } 6885 z_0_0 := z_0.Args[0] 6886 if z_0_0.Op != OpPPC64MOVBZload { 6887 break 6888 } 6889 v.copyOf(z) 6890 return true 6891 } 6892 // match: (MOVBZreg z:(AND y (MOVBZload ptr x))) 6893 // result: z 6894 for { 6895 z := v_0 6896 if z.Op != OpPPC64AND { 6897 break 6898 } 6899 _ = z.Args[1] 6900 z_0 := z.Args[0] 6901 z_1 := z.Args[1] 6902 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 6903 if z_1.Op != OpPPC64MOVBZload { 6904 continue 6905 } 6906 v.copyOf(z) 6907 return true 6908 } 6909 break 6910 } 6911 // match: (MOVBZreg x:(MOVBZload _ _)) 6912 // result: x 6913 for { 6914 x := v_0 6915 if x.Op != OpPPC64MOVBZload { 6916 break 6917 } 6918 v.copyOf(x) 6919 return true 6920 } 6921 // match: (MOVBZreg x:(MOVBZloadidx _ _ _)) 6922 // result: x 6923 for { 6924 x := v_0 6925 if x.Op != OpPPC64MOVBZloadidx { 6926 break 6927 } 6928 v.copyOf(x) 6929 return true 6930 } 6931 // match: (MOVBZreg x:(Select0 (LoweredAtomicLoad8 _ _))) 6932 // result: x 6933 for { 6934 x := v_0 6935 if x.Op != OpSelect0 { 6936 break 6937 } 6938 x_0 := x.Args[0] 6939 if x_0.Op != OpPPC64LoweredAtomicLoad8 { 6940 break 6941 } 6942 v.copyOf(x) 6943 return true 6944 } 6945 // match: (MOVBZreg x:(Arg <t>)) 6946 // cond: is8BitInt(t) && !t.IsSigned() 6947 // result: x 6948 for { 6949 x := v_0 6950 if x.Op != OpArg { 6951 break 6952 } 6953 t := x.Type 6954 if !(is8BitInt(t) && !t.IsSigned()) { 6955 break 6956 } 6957 v.copyOf(x) 6958 return true 6959 } 6960 // match: (MOVBZreg (MOVDconst [c])) 6961 // result: (MOVDconst [int64(uint8(c))]) 6962 for { 6963 if v_0.Op != OpPPC64MOVDconst { 6964 break 6965 } 6966 c := auxIntToInt64(v_0.AuxInt) 6967 v.reset(OpPPC64MOVDconst) 6968 v.AuxInt = int64ToAuxInt(int64(uint8(c))) 6969 return true 6970 } 6971 return false 6972 } 6973 func rewriteValuePPC64_OpPPC64MOVBreg(v *Value) bool { 6974 v_0 := v.Args[0] 6975 b := v.Block 6976 typ := &b.Func.Config.Types 6977 // match: (MOVBreg y:(Select0 (ANDCCconst [c] _))) 6978 // cond: uint64(c) <= 0x7F 6979 // result: y 6980 for { 6981 y := v_0 6982 if y.Op != OpSelect0 { 6983 break 6984 } 6985 y_0 := y.Args[0] 6986 if y_0.Op != OpPPC64ANDCCconst { 6987 break 6988 } 6989 c := auxIntToInt64(y_0.AuxInt) 6990 if !(uint64(c) <= 0x7F) { 6991 break 6992 } 6993 v.copyOf(y) 6994 return true 6995 } 6996 // match: (MOVBreg (SRAWconst [c] (MOVBreg x))) 6997 // result: (SRAWconst [c] (MOVBreg x)) 6998 for { 6999 if v_0.Op != OpPPC64SRAWconst { 7000 break 7001 } 7002 c := auxIntToInt64(v_0.AuxInt) 7003 v_0_0 := v_0.Args[0] 7004 if v_0_0.Op != OpPPC64MOVBreg { 7005 break 7006 } 7007 x := v_0_0.Args[0] 7008 v.reset(OpPPC64SRAWconst) 7009 v.AuxInt = int64ToAuxInt(c) 7010 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 7011 v0.AddArg(x) 7012 v.AddArg(v0) 7013 return true 7014 } 7015 // match: (MOVBreg (SRAWconst [c] x)) 7016 // cond: sizeof(x.Type) == 8 7017 // result: (SRAWconst [c] x) 7018 for { 7019 if v_0.Op != OpPPC64SRAWconst { 7020 break 7021 } 7022 c := auxIntToInt64(v_0.AuxInt) 7023 x := v_0.Args[0] 7024 if !(sizeof(x.Type) == 8) { 7025 break 7026 } 7027 v.reset(OpPPC64SRAWconst) 7028 v.AuxInt = int64ToAuxInt(c) 7029 v.AddArg(x) 7030 return true 7031 } 7032 // match: (MOVBreg (SRDconst [c] x)) 7033 // cond: c>56 7034 // result: (SRDconst [c] x) 7035 for { 7036 if v_0.Op != OpPPC64SRDconst { 7037 break 7038 } 7039 c := auxIntToInt64(v_0.AuxInt) 7040 x := v_0.Args[0] 7041 if !(c > 56) { 7042 break 7043 } 7044 v.reset(OpPPC64SRDconst) 7045 v.AuxInt = int64ToAuxInt(c) 7046 v.AddArg(x) 7047 return true 7048 } 7049 // match: (MOVBreg (SRDconst [c] x)) 7050 // cond: c==56 7051 // result: (SRADconst [c] x) 7052 for { 7053 if v_0.Op != OpPPC64SRDconst { 7054 break 7055 } 7056 c := auxIntToInt64(v_0.AuxInt) 7057 x := v_0.Args[0] 7058 if !(c == 56) { 7059 break 7060 } 7061 v.reset(OpPPC64SRADconst) 7062 v.AuxInt = int64ToAuxInt(c) 7063 v.AddArg(x) 7064 return true 7065 } 7066 // match: (MOVBreg (SRADconst [c] x)) 7067 // cond: c>=56 7068 // result: (SRADconst [c] x) 7069 for { 7070 if v_0.Op != OpPPC64SRADconst { 7071 break 7072 } 7073 c := auxIntToInt64(v_0.AuxInt) 7074 x := v_0.Args[0] 7075 if !(c >= 56) { 7076 break 7077 } 7078 v.reset(OpPPC64SRADconst) 7079 v.AuxInt = int64ToAuxInt(c) 7080 v.AddArg(x) 7081 return true 7082 } 7083 // match: (MOVBreg (SRWconst [c] x)) 7084 // cond: c>24 7085 // result: (SRWconst [c] x) 7086 for { 7087 if v_0.Op != OpPPC64SRWconst { 7088 break 7089 } 7090 c := auxIntToInt64(v_0.AuxInt) 7091 x := v_0.Args[0] 7092 if !(c > 24) { 7093 break 7094 } 7095 v.reset(OpPPC64SRWconst) 7096 v.AuxInt = int64ToAuxInt(c) 7097 v.AddArg(x) 7098 return true 7099 } 7100 // match: (MOVBreg (SRWconst [c] x)) 7101 // cond: c==24 7102 // result: (SRAWconst [c] x) 7103 for { 7104 if v_0.Op != OpPPC64SRWconst { 7105 break 7106 } 7107 c := auxIntToInt64(v_0.AuxInt) 7108 x := v_0.Args[0] 7109 if !(c == 24) { 7110 break 7111 } 7112 v.reset(OpPPC64SRAWconst) 7113 v.AuxInt = int64ToAuxInt(c) 7114 v.AddArg(x) 7115 return true 7116 } 7117 // match: (MOVBreg (SRAWconst [c] x)) 7118 // cond: c>=24 7119 // result: (SRAWconst [c] x) 7120 for { 7121 if v_0.Op != OpPPC64SRAWconst { 7122 break 7123 } 7124 c := auxIntToInt64(v_0.AuxInt) 7125 x := v_0.Args[0] 7126 if !(c >= 24) { 7127 break 7128 } 7129 v.reset(OpPPC64SRAWconst) 7130 v.AuxInt = int64ToAuxInt(c) 7131 v.AddArg(x) 7132 return true 7133 } 7134 // match: (MOVBreg y:(MOVBreg _)) 7135 // result: y 7136 for { 7137 y := v_0 7138 if y.Op != OpPPC64MOVBreg { 7139 break 7140 } 7141 v.copyOf(y) 7142 return true 7143 } 7144 // match: (MOVBreg (MOVBZreg x)) 7145 // result: (MOVBreg x) 7146 for { 7147 if v_0.Op != OpPPC64MOVBZreg { 7148 break 7149 } 7150 x := v_0.Args[0] 7151 v.reset(OpPPC64MOVBreg) 7152 v.AddArg(x) 7153 return true 7154 } 7155 // match: (MOVBreg x:(Arg <t>)) 7156 // cond: is8BitInt(t) && t.IsSigned() 7157 // result: x 7158 for { 7159 x := v_0 7160 if x.Op != OpArg { 7161 break 7162 } 7163 t := x.Type 7164 if !(is8BitInt(t) && t.IsSigned()) { 7165 break 7166 } 7167 v.copyOf(x) 7168 return true 7169 } 7170 // match: (MOVBreg (MOVDconst [c])) 7171 // result: (MOVDconst [int64(int8(c))]) 7172 for { 7173 if v_0.Op != OpPPC64MOVDconst { 7174 break 7175 } 7176 c := auxIntToInt64(v_0.AuxInt) 7177 v.reset(OpPPC64MOVDconst) 7178 v.AuxInt = int64ToAuxInt(int64(int8(c))) 7179 return true 7180 } 7181 return false 7182 } 7183 func rewriteValuePPC64_OpPPC64MOVBstore(v *Value) bool { 7184 v_2 := v.Args[2] 7185 v_1 := v.Args[1] 7186 v_0 := v.Args[0] 7187 b := v.Block 7188 typ := &b.Func.Config.Types 7189 // match: (MOVBstore [off1] {sym} (ADDconst [off2] x) val mem) 7190 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 7191 // result: (MOVBstore [off1+int32(off2)] {sym} x val mem) 7192 for { 7193 off1 := auxIntToInt32(v.AuxInt) 7194 sym := auxToSym(v.Aux) 7195 if v_0.Op != OpPPC64ADDconst { 7196 break 7197 } 7198 off2 := auxIntToInt64(v_0.AuxInt) 7199 x := v_0.Args[0] 7200 val := v_1 7201 mem := v_2 7202 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 7203 break 7204 } 7205 v.reset(OpPPC64MOVBstore) 7206 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 7207 v.Aux = symToAux(sym) 7208 v.AddArg3(x, val, mem) 7209 return true 7210 } 7211 // match: (MOVBstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) 7212 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 7213 // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem) 7214 for { 7215 off1 := auxIntToInt32(v.AuxInt) 7216 sym1 := auxToSym(v.Aux) 7217 p := v_0 7218 if p.Op != OpPPC64MOVDaddr { 7219 break 7220 } 7221 off2 := auxIntToInt32(p.AuxInt) 7222 sym2 := auxToSym(p.Aux) 7223 ptr := p.Args[0] 7224 val := v_1 7225 mem := v_2 7226 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 7227 break 7228 } 7229 v.reset(OpPPC64MOVBstore) 7230 v.AuxInt = int32ToAuxInt(off1 + off2) 7231 v.Aux = symToAux(mergeSym(sym1, sym2)) 7232 v.AddArg3(ptr, val, mem) 7233 return true 7234 } 7235 // match: (MOVBstore [off] {sym} ptr (MOVDconst [0]) mem) 7236 // result: (MOVBstorezero [off] {sym} ptr mem) 7237 for { 7238 off := auxIntToInt32(v.AuxInt) 7239 sym := auxToSym(v.Aux) 7240 ptr := v_0 7241 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 { 7242 break 7243 } 7244 mem := v_2 7245 v.reset(OpPPC64MOVBstorezero) 7246 v.AuxInt = int32ToAuxInt(off) 7247 v.Aux = symToAux(sym) 7248 v.AddArg2(ptr, mem) 7249 return true 7250 } 7251 // match: (MOVBstore [0] {sym} p:(ADD ptr idx) val mem) 7252 // cond: sym == nil && p.Uses == 1 7253 // result: (MOVBstoreidx ptr idx val mem) 7254 for { 7255 if auxIntToInt32(v.AuxInt) != 0 { 7256 break 7257 } 7258 sym := auxToSym(v.Aux) 7259 p := v_0 7260 if p.Op != OpPPC64ADD { 7261 break 7262 } 7263 idx := p.Args[1] 7264 ptr := p.Args[0] 7265 val := v_1 7266 mem := v_2 7267 if !(sym == nil && p.Uses == 1) { 7268 break 7269 } 7270 v.reset(OpPPC64MOVBstoreidx) 7271 v.AddArg4(ptr, idx, val, mem) 7272 return true 7273 } 7274 // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem) 7275 // result: (MOVBstore [off] {sym} ptr x mem) 7276 for { 7277 off := auxIntToInt32(v.AuxInt) 7278 sym := auxToSym(v.Aux) 7279 ptr := v_0 7280 if v_1.Op != OpPPC64MOVBreg { 7281 break 7282 } 7283 x := v_1.Args[0] 7284 mem := v_2 7285 v.reset(OpPPC64MOVBstore) 7286 v.AuxInt = int32ToAuxInt(off) 7287 v.Aux = symToAux(sym) 7288 v.AddArg3(ptr, x, mem) 7289 return true 7290 } 7291 // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem) 7292 // result: (MOVBstore [off] {sym} ptr x mem) 7293 for { 7294 off := auxIntToInt32(v.AuxInt) 7295 sym := auxToSym(v.Aux) 7296 ptr := v_0 7297 if v_1.Op != OpPPC64MOVBZreg { 7298 break 7299 } 7300 x := v_1.Args[0] 7301 mem := v_2 7302 v.reset(OpPPC64MOVBstore) 7303 v.AuxInt = int32ToAuxInt(off) 7304 v.Aux = symToAux(sym) 7305 v.AddArg3(ptr, x, mem) 7306 return true 7307 } 7308 // match: (MOVBstore [off] {sym} ptr (MOVHreg x) mem) 7309 // result: (MOVBstore [off] {sym} ptr x mem) 7310 for { 7311 off := auxIntToInt32(v.AuxInt) 7312 sym := auxToSym(v.Aux) 7313 ptr := v_0 7314 if v_1.Op != OpPPC64MOVHreg { 7315 break 7316 } 7317 x := v_1.Args[0] 7318 mem := v_2 7319 v.reset(OpPPC64MOVBstore) 7320 v.AuxInt = int32ToAuxInt(off) 7321 v.Aux = symToAux(sym) 7322 v.AddArg3(ptr, x, mem) 7323 return true 7324 } 7325 // match: (MOVBstore [off] {sym} ptr (MOVHZreg x) mem) 7326 // result: (MOVBstore [off] {sym} ptr x mem) 7327 for { 7328 off := auxIntToInt32(v.AuxInt) 7329 sym := auxToSym(v.Aux) 7330 ptr := v_0 7331 if v_1.Op != OpPPC64MOVHZreg { 7332 break 7333 } 7334 x := v_1.Args[0] 7335 mem := v_2 7336 v.reset(OpPPC64MOVBstore) 7337 v.AuxInt = int32ToAuxInt(off) 7338 v.Aux = symToAux(sym) 7339 v.AddArg3(ptr, x, mem) 7340 return true 7341 } 7342 // match: (MOVBstore [off] {sym} ptr (MOVWreg x) mem) 7343 // result: (MOVBstore [off] {sym} ptr x mem) 7344 for { 7345 off := auxIntToInt32(v.AuxInt) 7346 sym := auxToSym(v.Aux) 7347 ptr := v_0 7348 if v_1.Op != OpPPC64MOVWreg { 7349 break 7350 } 7351 x := v_1.Args[0] 7352 mem := v_2 7353 v.reset(OpPPC64MOVBstore) 7354 v.AuxInt = int32ToAuxInt(off) 7355 v.Aux = symToAux(sym) 7356 v.AddArg3(ptr, x, mem) 7357 return true 7358 } 7359 // match: (MOVBstore [off] {sym} ptr (MOVWZreg x) mem) 7360 // result: (MOVBstore [off] {sym} ptr x mem) 7361 for { 7362 off := auxIntToInt32(v.AuxInt) 7363 sym := auxToSym(v.Aux) 7364 ptr := v_0 7365 if v_1.Op != OpPPC64MOVWZreg { 7366 break 7367 } 7368 x := v_1.Args[0] 7369 mem := v_2 7370 v.reset(OpPPC64MOVBstore) 7371 v.AuxInt = int32ToAuxInt(off) 7372 v.Aux = symToAux(sym) 7373 v.AddArg3(ptr, x, mem) 7374 return true 7375 } 7376 // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHreg x) [c]) mem) 7377 // cond: c <= 8 7378 // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem) 7379 for { 7380 off := auxIntToInt32(v.AuxInt) 7381 sym := auxToSym(v.Aux) 7382 ptr := v_0 7383 if v_1.Op != OpPPC64SRWconst { 7384 break 7385 } 7386 c := auxIntToInt64(v_1.AuxInt) 7387 v_1_0 := v_1.Args[0] 7388 if v_1_0.Op != OpPPC64MOVHreg { 7389 break 7390 } 7391 x := v_1_0.Args[0] 7392 mem := v_2 7393 if !(c <= 8) { 7394 break 7395 } 7396 v.reset(OpPPC64MOVBstore) 7397 v.AuxInt = int32ToAuxInt(off) 7398 v.Aux = symToAux(sym) 7399 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32) 7400 v0.AuxInt = int64ToAuxInt(c) 7401 v0.AddArg(x) 7402 v.AddArg3(ptr, v0, mem) 7403 return true 7404 } 7405 // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHZreg x) [c]) mem) 7406 // cond: c <= 8 7407 // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem) 7408 for { 7409 off := auxIntToInt32(v.AuxInt) 7410 sym := auxToSym(v.Aux) 7411 ptr := v_0 7412 if v_1.Op != OpPPC64SRWconst { 7413 break 7414 } 7415 c := auxIntToInt64(v_1.AuxInt) 7416 v_1_0 := v_1.Args[0] 7417 if v_1_0.Op != OpPPC64MOVHZreg { 7418 break 7419 } 7420 x := v_1_0.Args[0] 7421 mem := v_2 7422 if !(c <= 8) { 7423 break 7424 } 7425 v.reset(OpPPC64MOVBstore) 7426 v.AuxInt = int32ToAuxInt(off) 7427 v.Aux = symToAux(sym) 7428 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32) 7429 v0.AuxInt = int64ToAuxInt(c) 7430 v0.AddArg(x) 7431 v.AddArg3(ptr, v0, mem) 7432 return true 7433 } 7434 // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWreg x) [c]) mem) 7435 // cond: c <= 24 7436 // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem) 7437 for { 7438 off := auxIntToInt32(v.AuxInt) 7439 sym := auxToSym(v.Aux) 7440 ptr := v_0 7441 if v_1.Op != OpPPC64SRWconst { 7442 break 7443 } 7444 c := auxIntToInt64(v_1.AuxInt) 7445 v_1_0 := v_1.Args[0] 7446 if v_1_0.Op != OpPPC64MOVWreg { 7447 break 7448 } 7449 x := v_1_0.Args[0] 7450 mem := v_2 7451 if !(c <= 24) { 7452 break 7453 } 7454 v.reset(OpPPC64MOVBstore) 7455 v.AuxInt = int32ToAuxInt(off) 7456 v.Aux = symToAux(sym) 7457 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32) 7458 v0.AuxInt = int64ToAuxInt(c) 7459 v0.AddArg(x) 7460 v.AddArg3(ptr, v0, mem) 7461 return true 7462 } 7463 // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWZreg x) [c]) mem) 7464 // cond: c <= 24 7465 // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem) 7466 for { 7467 off := auxIntToInt32(v.AuxInt) 7468 sym := auxToSym(v.Aux) 7469 ptr := v_0 7470 if v_1.Op != OpPPC64SRWconst { 7471 break 7472 } 7473 c := auxIntToInt64(v_1.AuxInt) 7474 v_1_0 := v_1.Args[0] 7475 if v_1_0.Op != OpPPC64MOVWZreg { 7476 break 7477 } 7478 x := v_1_0.Args[0] 7479 mem := v_2 7480 if !(c <= 24) { 7481 break 7482 } 7483 v.reset(OpPPC64MOVBstore) 7484 v.AuxInt = int32ToAuxInt(off) 7485 v.Aux = symToAux(sym) 7486 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32) 7487 v0.AuxInt = int64ToAuxInt(c) 7488 v0.AddArg(x) 7489 v.AddArg3(ptr, v0, mem) 7490 return true 7491 } 7492 return false 7493 } 7494 func rewriteValuePPC64_OpPPC64MOVBstoreidx(v *Value) bool { 7495 v_3 := v.Args[3] 7496 v_2 := v.Args[2] 7497 v_1 := v.Args[1] 7498 v_0 := v.Args[0] 7499 b := v.Block 7500 typ := &b.Func.Config.Types 7501 // match: (MOVBstoreidx ptr (MOVDconst [c]) val mem) 7502 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 7503 // result: (MOVBstore [int32(c)] ptr val mem) 7504 for { 7505 ptr := v_0 7506 if v_1.Op != OpPPC64MOVDconst { 7507 break 7508 } 7509 c := auxIntToInt64(v_1.AuxInt) 7510 val := v_2 7511 mem := v_3 7512 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 7513 break 7514 } 7515 v.reset(OpPPC64MOVBstore) 7516 v.AuxInt = int32ToAuxInt(int32(c)) 7517 v.AddArg3(ptr, val, mem) 7518 return true 7519 } 7520 // match: (MOVBstoreidx (MOVDconst [c]) ptr val mem) 7521 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 7522 // result: (MOVBstore [int32(c)] ptr val mem) 7523 for { 7524 if v_0.Op != OpPPC64MOVDconst { 7525 break 7526 } 7527 c := auxIntToInt64(v_0.AuxInt) 7528 ptr := v_1 7529 val := v_2 7530 mem := v_3 7531 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 7532 break 7533 } 7534 v.reset(OpPPC64MOVBstore) 7535 v.AuxInt = int32ToAuxInt(int32(c)) 7536 v.AddArg3(ptr, val, mem) 7537 return true 7538 } 7539 // match: (MOVBstoreidx ptr idx (MOVBreg x) mem) 7540 // result: (MOVBstoreidx ptr idx x mem) 7541 for { 7542 ptr := v_0 7543 idx := v_1 7544 if v_2.Op != OpPPC64MOVBreg { 7545 break 7546 } 7547 x := v_2.Args[0] 7548 mem := v_3 7549 v.reset(OpPPC64MOVBstoreidx) 7550 v.AddArg4(ptr, idx, x, mem) 7551 return true 7552 } 7553 // match: (MOVBstoreidx ptr idx (MOVBZreg x) mem) 7554 // result: (MOVBstoreidx ptr idx x mem) 7555 for { 7556 ptr := v_0 7557 idx := v_1 7558 if v_2.Op != OpPPC64MOVBZreg { 7559 break 7560 } 7561 x := v_2.Args[0] 7562 mem := v_3 7563 v.reset(OpPPC64MOVBstoreidx) 7564 v.AddArg4(ptr, idx, x, mem) 7565 return true 7566 } 7567 // match: (MOVBstoreidx ptr idx (MOVHreg x) mem) 7568 // result: (MOVBstoreidx ptr idx x mem) 7569 for { 7570 ptr := v_0 7571 idx := v_1 7572 if v_2.Op != OpPPC64MOVHreg { 7573 break 7574 } 7575 x := v_2.Args[0] 7576 mem := v_3 7577 v.reset(OpPPC64MOVBstoreidx) 7578 v.AddArg4(ptr, idx, x, mem) 7579 return true 7580 } 7581 // match: (MOVBstoreidx ptr idx (MOVHZreg x) mem) 7582 // result: (MOVBstoreidx ptr idx x mem) 7583 for { 7584 ptr := v_0 7585 idx := v_1 7586 if v_2.Op != OpPPC64MOVHZreg { 7587 break 7588 } 7589 x := v_2.Args[0] 7590 mem := v_3 7591 v.reset(OpPPC64MOVBstoreidx) 7592 v.AddArg4(ptr, idx, x, mem) 7593 return true 7594 } 7595 // match: (MOVBstoreidx ptr idx (MOVWreg x) mem) 7596 // result: (MOVBstoreidx ptr idx x mem) 7597 for { 7598 ptr := v_0 7599 idx := v_1 7600 if v_2.Op != OpPPC64MOVWreg { 7601 break 7602 } 7603 x := v_2.Args[0] 7604 mem := v_3 7605 v.reset(OpPPC64MOVBstoreidx) 7606 v.AddArg4(ptr, idx, x, mem) 7607 return true 7608 } 7609 // match: (MOVBstoreidx ptr idx (MOVWZreg x) mem) 7610 // result: (MOVBstoreidx ptr idx x mem) 7611 for { 7612 ptr := v_0 7613 idx := v_1 7614 if v_2.Op != OpPPC64MOVWZreg { 7615 break 7616 } 7617 x := v_2.Args[0] 7618 mem := v_3 7619 v.reset(OpPPC64MOVBstoreidx) 7620 v.AddArg4(ptr, idx, x, mem) 7621 return true 7622 } 7623 // match: (MOVBstoreidx ptr idx (SRWconst (MOVHreg x) [c]) mem) 7624 // cond: c <= 8 7625 // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem) 7626 for { 7627 ptr := v_0 7628 idx := v_1 7629 if v_2.Op != OpPPC64SRWconst { 7630 break 7631 } 7632 c := auxIntToInt64(v_2.AuxInt) 7633 v_2_0 := v_2.Args[0] 7634 if v_2_0.Op != OpPPC64MOVHreg { 7635 break 7636 } 7637 x := v_2_0.Args[0] 7638 mem := v_3 7639 if !(c <= 8) { 7640 break 7641 } 7642 v.reset(OpPPC64MOVBstoreidx) 7643 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32) 7644 v0.AuxInt = int64ToAuxInt(c) 7645 v0.AddArg(x) 7646 v.AddArg4(ptr, idx, v0, mem) 7647 return true 7648 } 7649 // match: (MOVBstoreidx ptr idx (SRWconst (MOVHZreg x) [c]) mem) 7650 // cond: c <= 8 7651 // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem) 7652 for { 7653 ptr := v_0 7654 idx := v_1 7655 if v_2.Op != OpPPC64SRWconst { 7656 break 7657 } 7658 c := auxIntToInt64(v_2.AuxInt) 7659 v_2_0 := v_2.Args[0] 7660 if v_2_0.Op != OpPPC64MOVHZreg { 7661 break 7662 } 7663 x := v_2_0.Args[0] 7664 mem := v_3 7665 if !(c <= 8) { 7666 break 7667 } 7668 v.reset(OpPPC64MOVBstoreidx) 7669 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32) 7670 v0.AuxInt = int64ToAuxInt(c) 7671 v0.AddArg(x) 7672 v.AddArg4(ptr, idx, v0, mem) 7673 return true 7674 } 7675 // match: (MOVBstoreidx ptr idx (SRWconst (MOVWreg x) [c]) mem) 7676 // cond: c <= 24 7677 // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem) 7678 for { 7679 ptr := v_0 7680 idx := v_1 7681 if v_2.Op != OpPPC64SRWconst { 7682 break 7683 } 7684 c := auxIntToInt64(v_2.AuxInt) 7685 v_2_0 := v_2.Args[0] 7686 if v_2_0.Op != OpPPC64MOVWreg { 7687 break 7688 } 7689 x := v_2_0.Args[0] 7690 mem := v_3 7691 if !(c <= 24) { 7692 break 7693 } 7694 v.reset(OpPPC64MOVBstoreidx) 7695 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32) 7696 v0.AuxInt = int64ToAuxInt(c) 7697 v0.AddArg(x) 7698 v.AddArg4(ptr, idx, v0, mem) 7699 return true 7700 } 7701 // match: (MOVBstoreidx ptr idx (SRWconst (MOVWZreg x) [c]) mem) 7702 // cond: c <= 24 7703 // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem) 7704 for { 7705 ptr := v_0 7706 idx := v_1 7707 if v_2.Op != OpPPC64SRWconst { 7708 break 7709 } 7710 c := auxIntToInt64(v_2.AuxInt) 7711 v_2_0 := v_2.Args[0] 7712 if v_2_0.Op != OpPPC64MOVWZreg { 7713 break 7714 } 7715 x := v_2_0.Args[0] 7716 mem := v_3 7717 if !(c <= 24) { 7718 break 7719 } 7720 v.reset(OpPPC64MOVBstoreidx) 7721 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32) 7722 v0.AuxInt = int64ToAuxInt(c) 7723 v0.AddArg(x) 7724 v.AddArg4(ptr, idx, v0, mem) 7725 return true 7726 } 7727 return false 7728 } 7729 func rewriteValuePPC64_OpPPC64MOVBstorezero(v *Value) bool { 7730 v_1 := v.Args[1] 7731 v_0 := v.Args[0] 7732 // match: (MOVBstorezero [off1] {sym} (ADDconst [off2] x) mem) 7733 // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2))) 7734 // result: (MOVBstorezero [off1+int32(off2)] {sym} x mem) 7735 for { 7736 off1 := auxIntToInt32(v.AuxInt) 7737 sym := auxToSym(v.Aux) 7738 if v_0.Op != OpPPC64ADDconst { 7739 break 7740 } 7741 off2 := auxIntToInt64(v_0.AuxInt) 7742 x := v_0.Args[0] 7743 mem := v_1 7744 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) { 7745 break 7746 } 7747 v.reset(OpPPC64MOVBstorezero) 7748 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 7749 v.Aux = symToAux(sym) 7750 v.AddArg2(x, mem) 7751 return true 7752 } 7753 // match: (MOVBstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) 7754 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 7755 // result: (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) 7756 for { 7757 off1 := auxIntToInt32(v.AuxInt) 7758 sym1 := auxToSym(v.Aux) 7759 p := v_0 7760 if p.Op != OpPPC64MOVDaddr { 7761 break 7762 } 7763 off2 := auxIntToInt32(p.AuxInt) 7764 sym2 := auxToSym(p.Aux) 7765 x := p.Args[0] 7766 mem := v_1 7767 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 7768 break 7769 } 7770 v.reset(OpPPC64MOVBstorezero) 7771 v.AuxInt = int32ToAuxInt(off1 + off2) 7772 v.Aux = symToAux(mergeSym(sym1, sym2)) 7773 v.AddArg2(x, mem) 7774 return true 7775 } 7776 return false 7777 } 7778 func rewriteValuePPC64_OpPPC64MOVDaddr(v *Value) bool { 7779 v_0 := v.Args[0] 7780 // match: (MOVDaddr {sym} [n] p:(ADD x y)) 7781 // cond: sym == nil && n == 0 7782 // result: p 7783 for { 7784 n := auxIntToInt32(v.AuxInt) 7785 sym := auxToSym(v.Aux) 7786 p := v_0 7787 if p.Op != OpPPC64ADD { 7788 break 7789 } 7790 if !(sym == nil && n == 0) { 7791 break 7792 } 7793 v.copyOf(p) 7794 return true 7795 } 7796 // match: (MOVDaddr {sym} [n] ptr) 7797 // cond: sym == nil && n == 0 && (ptr.Op == OpArgIntReg || ptr.Op == OpPhi) 7798 // result: ptr 7799 for { 7800 n := auxIntToInt32(v.AuxInt) 7801 sym := auxToSym(v.Aux) 7802 ptr := v_0 7803 if !(sym == nil && n == 0 && (ptr.Op == OpArgIntReg || ptr.Op == OpPhi)) { 7804 break 7805 } 7806 v.copyOf(ptr) 7807 return true 7808 } 7809 return false 7810 } 7811 func rewriteValuePPC64_OpPPC64MOVDload(v *Value) bool { 7812 v_1 := v.Args[1] 7813 v_0 := v.Args[0] 7814 // match: (MOVDload [off] {sym} ptr (FMOVDstore [off] {sym} ptr x _)) 7815 // result: (MFVSRD x) 7816 for { 7817 off := auxIntToInt32(v.AuxInt) 7818 sym := auxToSym(v.Aux) 7819 ptr := v_0 7820 if v_1.Op != OpPPC64FMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym { 7821 break 7822 } 7823 x := v_1.Args[1] 7824 if ptr != v_1.Args[0] { 7825 break 7826 } 7827 v.reset(OpPPC64MFVSRD) 7828 v.AddArg(x) 7829 return true 7830 } 7831 // match: (MOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) 7832 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 7833 // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem) 7834 for { 7835 off1 := auxIntToInt32(v.AuxInt) 7836 sym1 := auxToSym(v.Aux) 7837 p := v_0 7838 if p.Op != OpPPC64MOVDaddr { 7839 break 7840 } 7841 off2 := auxIntToInt32(p.AuxInt) 7842 sym2 := auxToSym(p.Aux) 7843 ptr := p.Args[0] 7844 mem := v_1 7845 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 7846 break 7847 } 7848 v.reset(OpPPC64MOVDload) 7849 v.AuxInt = int32ToAuxInt(off1 + off2) 7850 v.Aux = symToAux(mergeSym(sym1, sym2)) 7851 v.AddArg2(ptr, mem) 7852 return true 7853 } 7854 // match: (MOVDload [off1] {sym} (ADDconst [off2] x) mem) 7855 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 7856 // result: (MOVDload [off1+int32(off2)] {sym} x mem) 7857 for { 7858 off1 := auxIntToInt32(v.AuxInt) 7859 sym := auxToSym(v.Aux) 7860 if v_0.Op != OpPPC64ADDconst { 7861 break 7862 } 7863 off2 := auxIntToInt64(v_0.AuxInt) 7864 x := v_0.Args[0] 7865 mem := v_1 7866 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 7867 break 7868 } 7869 v.reset(OpPPC64MOVDload) 7870 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 7871 v.Aux = symToAux(sym) 7872 v.AddArg2(x, mem) 7873 return true 7874 } 7875 // match: (MOVDload [0] {sym} p:(ADD ptr idx) mem) 7876 // cond: sym == nil && p.Uses == 1 7877 // result: (MOVDloadidx ptr idx mem) 7878 for { 7879 if auxIntToInt32(v.AuxInt) != 0 { 7880 break 7881 } 7882 sym := auxToSym(v.Aux) 7883 p := v_0 7884 if p.Op != OpPPC64ADD { 7885 break 7886 } 7887 idx := p.Args[1] 7888 ptr := p.Args[0] 7889 mem := v_1 7890 if !(sym == nil && p.Uses == 1) { 7891 break 7892 } 7893 v.reset(OpPPC64MOVDloadidx) 7894 v.AddArg3(ptr, idx, mem) 7895 return true 7896 } 7897 return false 7898 } 7899 func rewriteValuePPC64_OpPPC64MOVDloadidx(v *Value) bool { 7900 v_2 := v.Args[2] 7901 v_1 := v.Args[1] 7902 v_0 := v.Args[0] 7903 // match: (MOVDloadidx ptr (MOVDconst [c]) mem) 7904 // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 7905 // result: (MOVDload [int32(c)] ptr mem) 7906 for { 7907 ptr := v_0 7908 if v_1.Op != OpPPC64MOVDconst { 7909 break 7910 } 7911 c := auxIntToInt64(v_1.AuxInt) 7912 mem := v_2 7913 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 7914 break 7915 } 7916 v.reset(OpPPC64MOVDload) 7917 v.AuxInt = int32ToAuxInt(int32(c)) 7918 v.AddArg2(ptr, mem) 7919 return true 7920 } 7921 // match: (MOVDloadidx (MOVDconst [c]) ptr mem) 7922 // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 7923 // result: (MOVDload [int32(c)] ptr mem) 7924 for { 7925 if v_0.Op != OpPPC64MOVDconst { 7926 break 7927 } 7928 c := auxIntToInt64(v_0.AuxInt) 7929 ptr := v_1 7930 mem := v_2 7931 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 7932 break 7933 } 7934 v.reset(OpPPC64MOVDload) 7935 v.AuxInt = int32ToAuxInt(int32(c)) 7936 v.AddArg2(ptr, mem) 7937 return true 7938 } 7939 return false 7940 } 7941 func rewriteValuePPC64_OpPPC64MOVDstore(v *Value) bool { 7942 v_2 := v.Args[2] 7943 v_1 := v.Args[1] 7944 v_0 := v.Args[0] 7945 b := v.Block 7946 // match: (MOVDstore [off] {sym} ptr (MFVSRD x) mem) 7947 // result: (FMOVDstore [off] {sym} ptr x mem) 7948 for { 7949 off := auxIntToInt32(v.AuxInt) 7950 sym := auxToSym(v.Aux) 7951 ptr := v_0 7952 if v_1.Op != OpPPC64MFVSRD { 7953 break 7954 } 7955 x := v_1.Args[0] 7956 mem := v_2 7957 v.reset(OpPPC64FMOVDstore) 7958 v.AuxInt = int32ToAuxInt(off) 7959 v.Aux = symToAux(sym) 7960 v.AddArg3(ptr, x, mem) 7961 return true 7962 } 7963 // match: (MOVDstore [off1] {sym} (ADDconst [off2] x) val mem) 7964 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 7965 // result: (MOVDstore [off1+int32(off2)] {sym} x val mem) 7966 for { 7967 off1 := auxIntToInt32(v.AuxInt) 7968 sym := auxToSym(v.Aux) 7969 if v_0.Op != OpPPC64ADDconst { 7970 break 7971 } 7972 off2 := auxIntToInt64(v_0.AuxInt) 7973 x := v_0.Args[0] 7974 val := v_1 7975 mem := v_2 7976 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 7977 break 7978 } 7979 v.reset(OpPPC64MOVDstore) 7980 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 7981 v.Aux = symToAux(sym) 7982 v.AddArg3(x, val, mem) 7983 return true 7984 } 7985 // match: (MOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) 7986 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 7987 // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem) 7988 for { 7989 off1 := auxIntToInt32(v.AuxInt) 7990 sym1 := auxToSym(v.Aux) 7991 p := v_0 7992 if p.Op != OpPPC64MOVDaddr { 7993 break 7994 } 7995 off2 := auxIntToInt32(p.AuxInt) 7996 sym2 := auxToSym(p.Aux) 7997 ptr := p.Args[0] 7998 val := v_1 7999 mem := v_2 8000 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 8001 break 8002 } 8003 v.reset(OpPPC64MOVDstore) 8004 v.AuxInt = int32ToAuxInt(off1 + off2) 8005 v.Aux = symToAux(mergeSym(sym1, sym2)) 8006 v.AddArg3(ptr, val, mem) 8007 return true 8008 } 8009 // match: (MOVDstore [off] {sym} ptr (MOVDconst [0]) mem) 8010 // result: (MOVDstorezero [off] {sym} ptr mem) 8011 for { 8012 off := auxIntToInt32(v.AuxInt) 8013 sym := auxToSym(v.Aux) 8014 ptr := v_0 8015 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 { 8016 break 8017 } 8018 mem := v_2 8019 v.reset(OpPPC64MOVDstorezero) 8020 v.AuxInt = int32ToAuxInt(off) 8021 v.Aux = symToAux(sym) 8022 v.AddArg2(ptr, mem) 8023 return true 8024 } 8025 // match: (MOVDstore [0] {sym} p:(ADD ptr idx) val mem) 8026 // cond: sym == nil && p.Uses == 1 8027 // result: (MOVDstoreidx ptr idx val mem) 8028 for { 8029 if auxIntToInt32(v.AuxInt) != 0 { 8030 break 8031 } 8032 sym := auxToSym(v.Aux) 8033 p := v_0 8034 if p.Op != OpPPC64ADD { 8035 break 8036 } 8037 idx := p.Args[1] 8038 ptr := p.Args[0] 8039 val := v_1 8040 mem := v_2 8041 if !(sym == nil && p.Uses == 1) { 8042 break 8043 } 8044 v.reset(OpPPC64MOVDstoreidx) 8045 v.AddArg4(ptr, idx, val, mem) 8046 return true 8047 } 8048 // match: (MOVDstore [off] {sym} ptr r:(BRD val) mem) 8049 // cond: r.Uses == 1 8050 // result: (MOVDBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem) 8051 for { 8052 off := auxIntToInt32(v.AuxInt) 8053 sym := auxToSym(v.Aux) 8054 ptr := v_0 8055 r := v_1 8056 if r.Op != OpPPC64BRD { 8057 break 8058 } 8059 val := r.Args[0] 8060 mem := v_2 8061 if !(r.Uses == 1) { 8062 break 8063 } 8064 v.reset(OpPPC64MOVDBRstore) 8065 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type) 8066 v0.AuxInt = int32ToAuxInt(off) 8067 v0.Aux = symToAux(sym) 8068 v0.AddArg(ptr) 8069 v.AddArg3(v0, val, mem) 8070 return true 8071 } 8072 // match: (MOVDstore [off] {sym} ptr (Bswap64 val) mem) 8073 // result: (MOVDBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem) 8074 for { 8075 off := auxIntToInt32(v.AuxInt) 8076 sym := auxToSym(v.Aux) 8077 ptr := v_0 8078 if v_1.Op != OpBswap64 { 8079 break 8080 } 8081 val := v_1.Args[0] 8082 mem := v_2 8083 v.reset(OpPPC64MOVDBRstore) 8084 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type) 8085 v0.AuxInt = int32ToAuxInt(off) 8086 v0.Aux = symToAux(sym) 8087 v0.AddArg(ptr) 8088 v.AddArg3(v0, val, mem) 8089 return true 8090 } 8091 return false 8092 } 8093 func rewriteValuePPC64_OpPPC64MOVDstoreidx(v *Value) bool { 8094 v_3 := v.Args[3] 8095 v_2 := v.Args[2] 8096 v_1 := v.Args[1] 8097 v_0 := v.Args[0] 8098 // match: (MOVDstoreidx ptr (MOVDconst [c]) val mem) 8099 // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 8100 // result: (MOVDstore [int32(c)] ptr val mem) 8101 for { 8102 ptr := v_0 8103 if v_1.Op != OpPPC64MOVDconst { 8104 break 8105 } 8106 c := auxIntToInt64(v_1.AuxInt) 8107 val := v_2 8108 mem := v_3 8109 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 8110 break 8111 } 8112 v.reset(OpPPC64MOVDstore) 8113 v.AuxInt = int32ToAuxInt(int32(c)) 8114 v.AddArg3(ptr, val, mem) 8115 return true 8116 } 8117 // match: (MOVDstoreidx (MOVDconst [c]) ptr val mem) 8118 // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 8119 // result: (MOVDstore [int32(c)] ptr val mem) 8120 for { 8121 if v_0.Op != OpPPC64MOVDconst { 8122 break 8123 } 8124 c := auxIntToInt64(v_0.AuxInt) 8125 ptr := v_1 8126 val := v_2 8127 mem := v_3 8128 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 8129 break 8130 } 8131 v.reset(OpPPC64MOVDstore) 8132 v.AuxInt = int32ToAuxInt(int32(c)) 8133 v.AddArg3(ptr, val, mem) 8134 return true 8135 } 8136 // match: (MOVDstoreidx ptr idx r:(BRD val) mem) 8137 // cond: r.Uses == 1 8138 // result: (MOVDBRstoreidx ptr idx val mem) 8139 for { 8140 ptr := v_0 8141 idx := v_1 8142 r := v_2 8143 if r.Op != OpPPC64BRD { 8144 break 8145 } 8146 val := r.Args[0] 8147 mem := v_3 8148 if !(r.Uses == 1) { 8149 break 8150 } 8151 v.reset(OpPPC64MOVDBRstoreidx) 8152 v.AddArg4(ptr, idx, val, mem) 8153 return true 8154 } 8155 // match: (MOVDstoreidx ptr idx (Bswap64 val) mem) 8156 // result: (MOVDBRstoreidx ptr idx val mem) 8157 for { 8158 ptr := v_0 8159 idx := v_1 8160 if v_2.Op != OpBswap64 { 8161 break 8162 } 8163 val := v_2.Args[0] 8164 mem := v_3 8165 v.reset(OpPPC64MOVDBRstoreidx) 8166 v.AddArg4(ptr, idx, val, mem) 8167 return true 8168 } 8169 return false 8170 } 8171 func rewriteValuePPC64_OpPPC64MOVDstorezero(v *Value) bool { 8172 v_1 := v.Args[1] 8173 v_0 := v.Args[0] 8174 // match: (MOVDstorezero [off1] {sym} (ADDconst [off2] x) mem) 8175 // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2))) 8176 // result: (MOVDstorezero [off1+int32(off2)] {sym} x mem) 8177 for { 8178 off1 := auxIntToInt32(v.AuxInt) 8179 sym := auxToSym(v.Aux) 8180 if v_0.Op != OpPPC64ADDconst { 8181 break 8182 } 8183 off2 := auxIntToInt64(v_0.AuxInt) 8184 x := v_0.Args[0] 8185 mem := v_1 8186 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) { 8187 break 8188 } 8189 v.reset(OpPPC64MOVDstorezero) 8190 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 8191 v.Aux = symToAux(sym) 8192 v.AddArg2(x, mem) 8193 return true 8194 } 8195 // match: (MOVDstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) 8196 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 8197 // result: (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) 8198 for { 8199 off1 := auxIntToInt32(v.AuxInt) 8200 sym1 := auxToSym(v.Aux) 8201 p := v_0 8202 if p.Op != OpPPC64MOVDaddr { 8203 break 8204 } 8205 off2 := auxIntToInt32(p.AuxInt) 8206 sym2 := auxToSym(p.Aux) 8207 x := p.Args[0] 8208 mem := v_1 8209 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 8210 break 8211 } 8212 v.reset(OpPPC64MOVDstorezero) 8213 v.AuxInt = int32ToAuxInt(off1 + off2) 8214 v.Aux = symToAux(mergeSym(sym1, sym2)) 8215 v.AddArg2(x, mem) 8216 return true 8217 } 8218 return false 8219 } 8220 func rewriteValuePPC64_OpPPC64MOVHBRstore(v *Value) bool { 8221 v_2 := v.Args[2] 8222 v_1 := v.Args[1] 8223 v_0 := v.Args[0] 8224 // match: (MOVHBRstore ptr (MOVHreg x) mem) 8225 // result: (MOVHBRstore ptr x mem) 8226 for { 8227 ptr := v_0 8228 if v_1.Op != OpPPC64MOVHreg { 8229 break 8230 } 8231 x := v_1.Args[0] 8232 mem := v_2 8233 v.reset(OpPPC64MOVHBRstore) 8234 v.AddArg3(ptr, x, mem) 8235 return true 8236 } 8237 // match: (MOVHBRstore ptr (MOVHZreg x) mem) 8238 // result: (MOVHBRstore ptr x mem) 8239 for { 8240 ptr := v_0 8241 if v_1.Op != OpPPC64MOVHZreg { 8242 break 8243 } 8244 x := v_1.Args[0] 8245 mem := v_2 8246 v.reset(OpPPC64MOVHBRstore) 8247 v.AddArg3(ptr, x, mem) 8248 return true 8249 } 8250 // match: (MOVHBRstore ptr (MOVWreg x) mem) 8251 // result: (MOVHBRstore ptr x mem) 8252 for { 8253 ptr := v_0 8254 if v_1.Op != OpPPC64MOVWreg { 8255 break 8256 } 8257 x := v_1.Args[0] 8258 mem := v_2 8259 v.reset(OpPPC64MOVHBRstore) 8260 v.AddArg3(ptr, x, mem) 8261 return true 8262 } 8263 // match: (MOVHBRstore ptr (MOVWZreg x) mem) 8264 // result: (MOVHBRstore ptr x mem) 8265 for { 8266 ptr := v_0 8267 if v_1.Op != OpPPC64MOVWZreg { 8268 break 8269 } 8270 x := v_1.Args[0] 8271 mem := v_2 8272 v.reset(OpPPC64MOVHBRstore) 8273 v.AddArg3(ptr, x, mem) 8274 return true 8275 } 8276 return false 8277 } 8278 func rewriteValuePPC64_OpPPC64MOVHZload(v *Value) bool { 8279 v_1 := v.Args[1] 8280 v_0 := v.Args[0] 8281 // match: (MOVHZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) 8282 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 8283 // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem) 8284 for { 8285 off1 := auxIntToInt32(v.AuxInt) 8286 sym1 := auxToSym(v.Aux) 8287 p := v_0 8288 if p.Op != OpPPC64MOVDaddr { 8289 break 8290 } 8291 off2 := auxIntToInt32(p.AuxInt) 8292 sym2 := auxToSym(p.Aux) 8293 ptr := p.Args[0] 8294 mem := v_1 8295 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 8296 break 8297 } 8298 v.reset(OpPPC64MOVHZload) 8299 v.AuxInt = int32ToAuxInt(off1 + off2) 8300 v.Aux = symToAux(mergeSym(sym1, sym2)) 8301 v.AddArg2(ptr, mem) 8302 return true 8303 } 8304 // match: (MOVHZload [off1] {sym} (ADDconst [off2] x) mem) 8305 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 8306 // result: (MOVHZload [off1+int32(off2)] {sym} x mem) 8307 for { 8308 off1 := auxIntToInt32(v.AuxInt) 8309 sym := auxToSym(v.Aux) 8310 if v_0.Op != OpPPC64ADDconst { 8311 break 8312 } 8313 off2 := auxIntToInt64(v_0.AuxInt) 8314 x := v_0.Args[0] 8315 mem := v_1 8316 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 8317 break 8318 } 8319 v.reset(OpPPC64MOVHZload) 8320 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 8321 v.Aux = symToAux(sym) 8322 v.AddArg2(x, mem) 8323 return true 8324 } 8325 // match: (MOVHZload [0] {sym} p:(ADD ptr idx) mem) 8326 // cond: sym == nil && p.Uses == 1 8327 // result: (MOVHZloadidx ptr idx mem) 8328 for { 8329 if auxIntToInt32(v.AuxInt) != 0 { 8330 break 8331 } 8332 sym := auxToSym(v.Aux) 8333 p := v_0 8334 if p.Op != OpPPC64ADD { 8335 break 8336 } 8337 idx := p.Args[1] 8338 ptr := p.Args[0] 8339 mem := v_1 8340 if !(sym == nil && p.Uses == 1) { 8341 break 8342 } 8343 v.reset(OpPPC64MOVHZloadidx) 8344 v.AddArg3(ptr, idx, mem) 8345 return true 8346 } 8347 return false 8348 } 8349 func rewriteValuePPC64_OpPPC64MOVHZloadidx(v *Value) bool { 8350 v_2 := v.Args[2] 8351 v_1 := v.Args[1] 8352 v_0 := v.Args[0] 8353 // match: (MOVHZloadidx ptr (MOVDconst [c]) mem) 8354 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 8355 // result: (MOVHZload [int32(c)] ptr mem) 8356 for { 8357 ptr := v_0 8358 if v_1.Op != OpPPC64MOVDconst { 8359 break 8360 } 8361 c := auxIntToInt64(v_1.AuxInt) 8362 mem := v_2 8363 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 8364 break 8365 } 8366 v.reset(OpPPC64MOVHZload) 8367 v.AuxInt = int32ToAuxInt(int32(c)) 8368 v.AddArg2(ptr, mem) 8369 return true 8370 } 8371 // match: (MOVHZloadidx (MOVDconst [c]) ptr mem) 8372 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 8373 // result: (MOVHZload [int32(c)] ptr mem) 8374 for { 8375 if v_0.Op != OpPPC64MOVDconst { 8376 break 8377 } 8378 c := auxIntToInt64(v_0.AuxInt) 8379 ptr := v_1 8380 mem := v_2 8381 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 8382 break 8383 } 8384 v.reset(OpPPC64MOVHZload) 8385 v.AuxInt = int32ToAuxInt(int32(c)) 8386 v.AddArg2(ptr, mem) 8387 return true 8388 } 8389 return false 8390 } 8391 func rewriteValuePPC64_OpPPC64MOVHZreg(v *Value) bool { 8392 v_0 := v.Args[0] 8393 b := v.Block 8394 typ := &b.Func.Config.Types 8395 // match: (MOVHZreg y:(Select0 (ANDCCconst [c] _))) 8396 // cond: uint64(c) <= 0xFFFF 8397 // result: y 8398 for { 8399 y := v_0 8400 if y.Op != OpSelect0 { 8401 break 8402 } 8403 y_0 := y.Args[0] 8404 if y_0.Op != OpPPC64ANDCCconst { 8405 break 8406 } 8407 c := auxIntToInt64(y_0.AuxInt) 8408 if !(uint64(c) <= 0xFFFF) { 8409 break 8410 } 8411 v.copyOf(y) 8412 return true 8413 } 8414 // match: (MOVHZreg (SRWconst [c] (MOVBZreg x))) 8415 // result: (SRWconst [c] (MOVBZreg x)) 8416 for { 8417 if v_0.Op != OpPPC64SRWconst { 8418 break 8419 } 8420 c := auxIntToInt64(v_0.AuxInt) 8421 v_0_0 := v_0.Args[0] 8422 if v_0_0.Op != OpPPC64MOVBZreg { 8423 break 8424 } 8425 x := v_0_0.Args[0] 8426 v.reset(OpPPC64SRWconst) 8427 v.AuxInt = int64ToAuxInt(c) 8428 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 8429 v0.AddArg(x) 8430 v.AddArg(v0) 8431 return true 8432 } 8433 // match: (MOVHZreg (SRWconst [c] (MOVHZreg x))) 8434 // result: (SRWconst [c] (MOVHZreg x)) 8435 for { 8436 if v_0.Op != OpPPC64SRWconst { 8437 break 8438 } 8439 c := auxIntToInt64(v_0.AuxInt) 8440 v_0_0 := v_0.Args[0] 8441 if v_0_0.Op != OpPPC64MOVHZreg { 8442 break 8443 } 8444 x := v_0_0.Args[0] 8445 v.reset(OpPPC64SRWconst) 8446 v.AuxInt = int64ToAuxInt(c) 8447 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 8448 v0.AddArg(x) 8449 v.AddArg(v0) 8450 return true 8451 } 8452 // match: (MOVHZreg (SRWconst [c] x)) 8453 // cond: sizeof(x.Type) <= 16 8454 // result: (SRWconst [c] x) 8455 for { 8456 if v_0.Op != OpPPC64SRWconst { 8457 break 8458 } 8459 c := auxIntToInt64(v_0.AuxInt) 8460 x := v_0.Args[0] 8461 if !(sizeof(x.Type) <= 16) { 8462 break 8463 } 8464 v.reset(OpPPC64SRWconst) 8465 v.AuxInt = int64ToAuxInt(c) 8466 v.AddArg(x) 8467 return true 8468 } 8469 // match: (MOVHZreg (SRDconst [c] x)) 8470 // cond: c>=48 8471 // result: (SRDconst [c] x) 8472 for { 8473 if v_0.Op != OpPPC64SRDconst { 8474 break 8475 } 8476 c := auxIntToInt64(v_0.AuxInt) 8477 x := v_0.Args[0] 8478 if !(c >= 48) { 8479 break 8480 } 8481 v.reset(OpPPC64SRDconst) 8482 v.AuxInt = int64ToAuxInt(c) 8483 v.AddArg(x) 8484 return true 8485 } 8486 // match: (MOVHZreg (SRWconst [c] x)) 8487 // cond: c>=16 8488 // result: (SRWconst [c] x) 8489 for { 8490 if v_0.Op != OpPPC64SRWconst { 8491 break 8492 } 8493 c := auxIntToInt64(v_0.AuxInt) 8494 x := v_0.Args[0] 8495 if !(c >= 16) { 8496 break 8497 } 8498 v.reset(OpPPC64SRWconst) 8499 v.AuxInt = int64ToAuxInt(c) 8500 v.AddArg(x) 8501 return true 8502 } 8503 // match: (MOVHZreg y:(MOVHZreg _)) 8504 // result: y 8505 for { 8506 y := v_0 8507 if y.Op != OpPPC64MOVHZreg { 8508 break 8509 } 8510 v.copyOf(y) 8511 return true 8512 } 8513 // match: (MOVHZreg y:(MOVBZreg _)) 8514 // result: y 8515 for { 8516 y := v_0 8517 if y.Op != OpPPC64MOVBZreg { 8518 break 8519 } 8520 v.copyOf(y) 8521 return true 8522 } 8523 // match: (MOVHZreg y:(MOVHBRload _ _)) 8524 // result: y 8525 for { 8526 y := v_0 8527 if y.Op != OpPPC64MOVHBRload { 8528 break 8529 } 8530 v.copyOf(y) 8531 return true 8532 } 8533 // match: (MOVHZreg y:(MOVHreg x)) 8534 // result: (MOVHZreg x) 8535 for { 8536 y := v_0 8537 if y.Op != OpPPC64MOVHreg { 8538 break 8539 } 8540 x := y.Args[0] 8541 v.reset(OpPPC64MOVHZreg) 8542 v.AddArg(x) 8543 return true 8544 } 8545 // match: (MOVHZreg (OR <t> x (MOVWZreg y))) 8546 // result: (MOVHZreg (OR <t> x y)) 8547 for { 8548 if v_0.Op != OpPPC64OR { 8549 break 8550 } 8551 t := v_0.Type 8552 _ = v_0.Args[1] 8553 v_0_0 := v_0.Args[0] 8554 v_0_1 := v_0.Args[1] 8555 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 8556 x := v_0_0 8557 if v_0_1.Op != OpPPC64MOVWZreg { 8558 continue 8559 } 8560 y := v_0_1.Args[0] 8561 v.reset(OpPPC64MOVHZreg) 8562 v0 := b.NewValue0(v.Pos, OpPPC64OR, t) 8563 v0.AddArg2(x, y) 8564 v.AddArg(v0) 8565 return true 8566 } 8567 break 8568 } 8569 // match: (MOVHZreg (XOR <t> x (MOVWZreg y))) 8570 // result: (MOVHZreg (XOR <t> x y)) 8571 for { 8572 if v_0.Op != OpPPC64XOR { 8573 break 8574 } 8575 t := v_0.Type 8576 _ = v_0.Args[1] 8577 v_0_0 := v_0.Args[0] 8578 v_0_1 := v_0.Args[1] 8579 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 8580 x := v_0_0 8581 if v_0_1.Op != OpPPC64MOVWZreg { 8582 continue 8583 } 8584 y := v_0_1.Args[0] 8585 v.reset(OpPPC64MOVHZreg) 8586 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t) 8587 v0.AddArg2(x, y) 8588 v.AddArg(v0) 8589 return true 8590 } 8591 break 8592 } 8593 // match: (MOVHZreg (AND <t> x (MOVWZreg y))) 8594 // result: (MOVHZreg (AND <t> x y)) 8595 for { 8596 if v_0.Op != OpPPC64AND { 8597 break 8598 } 8599 t := v_0.Type 8600 _ = v_0.Args[1] 8601 v_0_0 := v_0.Args[0] 8602 v_0_1 := v_0.Args[1] 8603 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 8604 x := v_0_0 8605 if v_0_1.Op != OpPPC64MOVWZreg { 8606 continue 8607 } 8608 y := v_0_1.Args[0] 8609 v.reset(OpPPC64MOVHZreg) 8610 v0 := b.NewValue0(v.Pos, OpPPC64AND, t) 8611 v0.AddArg2(x, y) 8612 v.AddArg(v0) 8613 return true 8614 } 8615 break 8616 } 8617 // match: (MOVHZreg (OR <t> x (MOVHZreg y))) 8618 // result: (MOVHZreg (OR <t> x y)) 8619 for { 8620 if v_0.Op != OpPPC64OR { 8621 break 8622 } 8623 t := v_0.Type 8624 _ = v_0.Args[1] 8625 v_0_0 := v_0.Args[0] 8626 v_0_1 := v_0.Args[1] 8627 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 8628 x := v_0_0 8629 if v_0_1.Op != OpPPC64MOVHZreg { 8630 continue 8631 } 8632 y := v_0_1.Args[0] 8633 v.reset(OpPPC64MOVHZreg) 8634 v0 := b.NewValue0(v.Pos, OpPPC64OR, t) 8635 v0.AddArg2(x, y) 8636 v.AddArg(v0) 8637 return true 8638 } 8639 break 8640 } 8641 // match: (MOVHZreg (XOR <t> x (MOVHZreg y))) 8642 // result: (MOVHZreg (XOR <t> x y)) 8643 for { 8644 if v_0.Op != OpPPC64XOR { 8645 break 8646 } 8647 t := v_0.Type 8648 _ = v_0.Args[1] 8649 v_0_0 := v_0.Args[0] 8650 v_0_1 := v_0.Args[1] 8651 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 8652 x := v_0_0 8653 if v_0_1.Op != OpPPC64MOVHZreg { 8654 continue 8655 } 8656 y := v_0_1.Args[0] 8657 v.reset(OpPPC64MOVHZreg) 8658 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t) 8659 v0.AddArg2(x, y) 8660 v.AddArg(v0) 8661 return true 8662 } 8663 break 8664 } 8665 // match: (MOVHZreg (AND <t> x (MOVHZreg y))) 8666 // result: (MOVHZreg (AND <t> x y)) 8667 for { 8668 if v_0.Op != OpPPC64AND { 8669 break 8670 } 8671 t := v_0.Type 8672 _ = v_0.Args[1] 8673 v_0_0 := v_0.Args[0] 8674 v_0_1 := v_0.Args[1] 8675 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 8676 x := v_0_0 8677 if v_0_1.Op != OpPPC64MOVHZreg { 8678 continue 8679 } 8680 y := v_0_1.Args[0] 8681 v.reset(OpPPC64MOVHZreg) 8682 v0 := b.NewValue0(v.Pos, OpPPC64AND, t) 8683 v0.AddArg2(x, y) 8684 v.AddArg(v0) 8685 return true 8686 } 8687 break 8688 } 8689 // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x)))) 8690 // result: z 8691 for { 8692 z := v_0 8693 if z.Op != OpSelect0 { 8694 break 8695 } 8696 z_0 := z.Args[0] 8697 if z_0.Op != OpPPC64ANDCCconst { 8698 break 8699 } 8700 z_0_0 := z_0.Args[0] 8701 if z_0_0.Op != OpPPC64MOVBZload { 8702 break 8703 } 8704 v.copyOf(z) 8705 return true 8706 } 8707 // match: (MOVHZreg z:(AND y (MOVHZload ptr x))) 8708 // result: z 8709 for { 8710 z := v_0 8711 if z.Op != OpPPC64AND { 8712 break 8713 } 8714 _ = z.Args[1] 8715 z_0 := z.Args[0] 8716 z_1 := z.Args[1] 8717 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 8718 if z_1.Op != OpPPC64MOVHZload { 8719 continue 8720 } 8721 v.copyOf(z) 8722 return true 8723 } 8724 break 8725 } 8726 // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x)))) 8727 // result: z 8728 for { 8729 z := v_0 8730 if z.Op != OpSelect0 { 8731 break 8732 } 8733 z_0 := z.Args[0] 8734 if z_0.Op != OpPPC64ANDCCconst { 8735 break 8736 } 8737 z_0_0 := z_0.Args[0] 8738 if z_0_0.Op != OpPPC64MOVHZload { 8739 break 8740 } 8741 v.copyOf(z) 8742 return true 8743 } 8744 // match: (MOVHZreg x:(MOVBZload _ _)) 8745 // result: x 8746 for { 8747 x := v_0 8748 if x.Op != OpPPC64MOVBZload { 8749 break 8750 } 8751 v.copyOf(x) 8752 return true 8753 } 8754 // match: (MOVHZreg x:(MOVBZloadidx _ _ _)) 8755 // result: x 8756 for { 8757 x := v_0 8758 if x.Op != OpPPC64MOVBZloadidx { 8759 break 8760 } 8761 v.copyOf(x) 8762 return true 8763 } 8764 // match: (MOVHZreg x:(MOVHZload _ _)) 8765 // result: x 8766 for { 8767 x := v_0 8768 if x.Op != OpPPC64MOVHZload { 8769 break 8770 } 8771 v.copyOf(x) 8772 return true 8773 } 8774 // match: (MOVHZreg x:(MOVHZloadidx _ _ _)) 8775 // result: x 8776 for { 8777 x := v_0 8778 if x.Op != OpPPC64MOVHZloadidx { 8779 break 8780 } 8781 v.copyOf(x) 8782 return true 8783 } 8784 // match: (MOVHZreg x:(Arg <t>)) 8785 // cond: (is8BitInt(t) || is16BitInt(t)) && !t.IsSigned() 8786 // result: x 8787 for { 8788 x := v_0 8789 if x.Op != OpArg { 8790 break 8791 } 8792 t := x.Type 8793 if !((is8BitInt(t) || is16BitInt(t)) && !t.IsSigned()) { 8794 break 8795 } 8796 v.copyOf(x) 8797 return true 8798 } 8799 // match: (MOVHZreg (MOVDconst [c])) 8800 // result: (MOVDconst [int64(uint16(c))]) 8801 for { 8802 if v_0.Op != OpPPC64MOVDconst { 8803 break 8804 } 8805 c := auxIntToInt64(v_0.AuxInt) 8806 v.reset(OpPPC64MOVDconst) 8807 v.AuxInt = int64ToAuxInt(int64(uint16(c))) 8808 return true 8809 } 8810 return false 8811 } 8812 func rewriteValuePPC64_OpPPC64MOVHload(v *Value) bool { 8813 v_1 := v.Args[1] 8814 v_0 := v.Args[0] 8815 // match: (MOVHload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) 8816 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 8817 // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} ptr mem) 8818 for { 8819 off1 := auxIntToInt32(v.AuxInt) 8820 sym1 := auxToSym(v.Aux) 8821 p := v_0 8822 if p.Op != OpPPC64MOVDaddr { 8823 break 8824 } 8825 off2 := auxIntToInt32(p.AuxInt) 8826 sym2 := auxToSym(p.Aux) 8827 ptr := p.Args[0] 8828 mem := v_1 8829 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 8830 break 8831 } 8832 v.reset(OpPPC64MOVHload) 8833 v.AuxInt = int32ToAuxInt(off1 + off2) 8834 v.Aux = symToAux(mergeSym(sym1, sym2)) 8835 v.AddArg2(ptr, mem) 8836 return true 8837 } 8838 // match: (MOVHload [off1] {sym} (ADDconst [off2] x) mem) 8839 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 8840 // result: (MOVHload [off1+int32(off2)] {sym} x mem) 8841 for { 8842 off1 := auxIntToInt32(v.AuxInt) 8843 sym := auxToSym(v.Aux) 8844 if v_0.Op != OpPPC64ADDconst { 8845 break 8846 } 8847 off2 := auxIntToInt64(v_0.AuxInt) 8848 x := v_0.Args[0] 8849 mem := v_1 8850 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 8851 break 8852 } 8853 v.reset(OpPPC64MOVHload) 8854 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 8855 v.Aux = symToAux(sym) 8856 v.AddArg2(x, mem) 8857 return true 8858 } 8859 // match: (MOVHload [0] {sym} p:(ADD ptr idx) mem) 8860 // cond: sym == nil && p.Uses == 1 8861 // result: (MOVHloadidx ptr idx mem) 8862 for { 8863 if auxIntToInt32(v.AuxInt) != 0 { 8864 break 8865 } 8866 sym := auxToSym(v.Aux) 8867 p := v_0 8868 if p.Op != OpPPC64ADD { 8869 break 8870 } 8871 idx := p.Args[1] 8872 ptr := p.Args[0] 8873 mem := v_1 8874 if !(sym == nil && p.Uses == 1) { 8875 break 8876 } 8877 v.reset(OpPPC64MOVHloadidx) 8878 v.AddArg3(ptr, idx, mem) 8879 return true 8880 } 8881 return false 8882 } 8883 func rewriteValuePPC64_OpPPC64MOVHloadidx(v *Value) bool { 8884 v_2 := v.Args[2] 8885 v_1 := v.Args[1] 8886 v_0 := v.Args[0] 8887 // match: (MOVHloadidx ptr (MOVDconst [c]) mem) 8888 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 8889 // result: (MOVHload [int32(c)] ptr mem) 8890 for { 8891 ptr := v_0 8892 if v_1.Op != OpPPC64MOVDconst { 8893 break 8894 } 8895 c := auxIntToInt64(v_1.AuxInt) 8896 mem := v_2 8897 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 8898 break 8899 } 8900 v.reset(OpPPC64MOVHload) 8901 v.AuxInt = int32ToAuxInt(int32(c)) 8902 v.AddArg2(ptr, mem) 8903 return true 8904 } 8905 // match: (MOVHloadidx (MOVDconst [c]) ptr mem) 8906 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 8907 // result: (MOVHload [int32(c)] ptr mem) 8908 for { 8909 if v_0.Op != OpPPC64MOVDconst { 8910 break 8911 } 8912 c := auxIntToInt64(v_0.AuxInt) 8913 ptr := v_1 8914 mem := v_2 8915 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 8916 break 8917 } 8918 v.reset(OpPPC64MOVHload) 8919 v.AuxInt = int32ToAuxInt(int32(c)) 8920 v.AddArg2(ptr, mem) 8921 return true 8922 } 8923 return false 8924 } 8925 func rewriteValuePPC64_OpPPC64MOVHreg(v *Value) bool { 8926 v_0 := v.Args[0] 8927 b := v.Block 8928 typ := &b.Func.Config.Types 8929 // match: (MOVHreg y:(Select0 (ANDCCconst [c] _))) 8930 // cond: uint64(c) <= 0x7FFF 8931 // result: y 8932 for { 8933 y := v_0 8934 if y.Op != OpSelect0 { 8935 break 8936 } 8937 y_0 := y.Args[0] 8938 if y_0.Op != OpPPC64ANDCCconst { 8939 break 8940 } 8941 c := auxIntToInt64(y_0.AuxInt) 8942 if !(uint64(c) <= 0x7FFF) { 8943 break 8944 } 8945 v.copyOf(y) 8946 return true 8947 } 8948 // match: (MOVHreg (SRAWconst [c] (MOVBreg x))) 8949 // result: (SRAWconst [c] (MOVBreg x)) 8950 for { 8951 if v_0.Op != OpPPC64SRAWconst { 8952 break 8953 } 8954 c := auxIntToInt64(v_0.AuxInt) 8955 v_0_0 := v_0.Args[0] 8956 if v_0_0.Op != OpPPC64MOVBreg { 8957 break 8958 } 8959 x := v_0_0.Args[0] 8960 v.reset(OpPPC64SRAWconst) 8961 v.AuxInt = int64ToAuxInt(c) 8962 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 8963 v0.AddArg(x) 8964 v.AddArg(v0) 8965 return true 8966 } 8967 // match: (MOVHreg (SRAWconst [c] (MOVHreg x))) 8968 // result: (SRAWconst [c] (MOVHreg x)) 8969 for { 8970 if v_0.Op != OpPPC64SRAWconst { 8971 break 8972 } 8973 c := auxIntToInt64(v_0.AuxInt) 8974 v_0_0 := v_0.Args[0] 8975 if v_0_0.Op != OpPPC64MOVHreg { 8976 break 8977 } 8978 x := v_0_0.Args[0] 8979 v.reset(OpPPC64SRAWconst) 8980 v.AuxInt = int64ToAuxInt(c) 8981 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 8982 v0.AddArg(x) 8983 v.AddArg(v0) 8984 return true 8985 } 8986 // match: (MOVHreg (SRAWconst [c] x)) 8987 // cond: sizeof(x.Type) <= 16 8988 // result: (SRAWconst [c] x) 8989 for { 8990 if v_0.Op != OpPPC64SRAWconst { 8991 break 8992 } 8993 c := auxIntToInt64(v_0.AuxInt) 8994 x := v_0.Args[0] 8995 if !(sizeof(x.Type) <= 16) { 8996 break 8997 } 8998 v.reset(OpPPC64SRAWconst) 8999 v.AuxInt = int64ToAuxInt(c) 9000 v.AddArg(x) 9001 return true 9002 } 9003 // match: (MOVHreg (SRDconst [c] x)) 9004 // cond: c>48 9005 // result: (SRDconst [c] x) 9006 for { 9007 if v_0.Op != OpPPC64SRDconst { 9008 break 9009 } 9010 c := auxIntToInt64(v_0.AuxInt) 9011 x := v_0.Args[0] 9012 if !(c > 48) { 9013 break 9014 } 9015 v.reset(OpPPC64SRDconst) 9016 v.AuxInt = int64ToAuxInt(c) 9017 v.AddArg(x) 9018 return true 9019 } 9020 // match: (MOVHreg (SRDconst [c] x)) 9021 // cond: c==48 9022 // result: (SRADconst [c] x) 9023 for { 9024 if v_0.Op != OpPPC64SRDconst { 9025 break 9026 } 9027 c := auxIntToInt64(v_0.AuxInt) 9028 x := v_0.Args[0] 9029 if !(c == 48) { 9030 break 9031 } 9032 v.reset(OpPPC64SRADconst) 9033 v.AuxInt = int64ToAuxInt(c) 9034 v.AddArg(x) 9035 return true 9036 } 9037 // match: (MOVHreg (SRADconst [c] x)) 9038 // cond: c>=48 9039 // result: (SRADconst [c] x) 9040 for { 9041 if v_0.Op != OpPPC64SRADconst { 9042 break 9043 } 9044 c := auxIntToInt64(v_0.AuxInt) 9045 x := v_0.Args[0] 9046 if !(c >= 48) { 9047 break 9048 } 9049 v.reset(OpPPC64SRADconst) 9050 v.AuxInt = int64ToAuxInt(c) 9051 v.AddArg(x) 9052 return true 9053 } 9054 // match: (MOVHreg (SRWconst [c] x)) 9055 // cond: c>16 9056 // result: (SRWconst [c] x) 9057 for { 9058 if v_0.Op != OpPPC64SRWconst { 9059 break 9060 } 9061 c := auxIntToInt64(v_0.AuxInt) 9062 x := v_0.Args[0] 9063 if !(c > 16) { 9064 break 9065 } 9066 v.reset(OpPPC64SRWconst) 9067 v.AuxInt = int64ToAuxInt(c) 9068 v.AddArg(x) 9069 return true 9070 } 9071 // match: (MOVHreg (SRAWconst [c] x)) 9072 // cond: c>=16 9073 // result: (SRAWconst [c] x) 9074 for { 9075 if v_0.Op != OpPPC64SRAWconst { 9076 break 9077 } 9078 c := auxIntToInt64(v_0.AuxInt) 9079 x := v_0.Args[0] 9080 if !(c >= 16) { 9081 break 9082 } 9083 v.reset(OpPPC64SRAWconst) 9084 v.AuxInt = int64ToAuxInt(c) 9085 v.AddArg(x) 9086 return true 9087 } 9088 // match: (MOVHreg (SRWconst [c] x)) 9089 // cond: c==16 9090 // result: (SRAWconst [c] x) 9091 for { 9092 if v_0.Op != OpPPC64SRWconst { 9093 break 9094 } 9095 c := auxIntToInt64(v_0.AuxInt) 9096 x := v_0.Args[0] 9097 if !(c == 16) { 9098 break 9099 } 9100 v.reset(OpPPC64SRAWconst) 9101 v.AuxInt = int64ToAuxInt(c) 9102 v.AddArg(x) 9103 return true 9104 } 9105 // match: (MOVHreg y:(MOVHreg _)) 9106 // result: y 9107 for { 9108 y := v_0 9109 if y.Op != OpPPC64MOVHreg { 9110 break 9111 } 9112 v.copyOf(y) 9113 return true 9114 } 9115 // match: (MOVHreg y:(MOVBreg _)) 9116 // result: y 9117 for { 9118 y := v_0 9119 if y.Op != OpPPC64MOVBreg { 9120 break 9121 } 9122 v.copyOf(y) 9123 return true 9124 } 9125 // match: (MOVHreg y:(MOVHZreg x)) 9126 // result: (MOVHreg x) 9127 for { 9128 y := v_0 9129 if y.Op != OpPPC64MOVHZreg { 9130 break 9131 } 9132 x := y.Args[0] 9133 v.reset(OpPPC64MOVHreg) 9134 v.AddArg(x) 9135 return true 9136 } 9137 // match: (MOVHreg x:(MOVHload _ _)) 9138 // result: x 9139 for { 9140 x := v_0 9141 if x.Op != OpPPC64MOVHload { 9142 break 9143 } 9144 v.copyOf(x) 9145 return true 9146 } 9147 // match: (MOVHreg x:(MOVHloadidx _ _ _)) 9148 // result: x 9149 for { 9150 x := v_0 9151 if x.Op != OpPPC64MOVHloadidx { 9152 break 9153 } 9154 v.copyOf(x) 9155 return true 9156 } 9157 // match: (MOVHreg x:(Arg <t>)) 9158 // cond: (is8BitInt(t) || is16BitInt(t)) && t.IsSigned() 9159 // result: x 9160 for { 9161 x := v_0 9162 if x.Op != OpArg { 9163 break 9164 } 9165 t := x.Type 9166 if !((is8BitInt(t) || is16BitInt(t)) && t.IsSigned()) { 9167 break 9168 } 9169 v.copyOf(x) 9170 return true 9171 } 9172 // match: (MOVHreg (MOVDconst [c])) 9173 // result: (MOVDconst [int64(int16(c))]) 9174 for { 9175 if v_0.Op != OpPPC64MOVDconst { 9176 break 9177 } 9178 c := auxIntToInt64(v_0.AuxInt) 9179 v.reset(OpPPC64MOVDconst) 9180 v.AuxInt = int64ToAuxInt(int64(int16(c))) 9181 return true 9182 } 9183 return false 9184 } 9185 func rewriteValuePPC64_OpPPC64MOVHstore(v *Value) bool { 9186 v_2 := v.Args[2] 9187 v_1 := v.Args[1] 9188 v_0 := v.Args[0] 9189 b := v.Block 9190 // match: (MOVHstore [off1] {sym} (ADDconst [off2] x) val mem) 9191 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 9192 // result: (MOVHstore [off1+int32(off2)] {sym} x val mem) 9193 for { 9194 off1 := auxIntToInt32(v.AuxInt) 9195 sym := auxToSym(v.Aux) 9196 if v_0.Op != OpPPC64ADDconst { 9197 break 9198 } 9199 off2 := auxIntToInt64(v_0.AuxInt) 9200 x := v_0.Args[0] 9201 val := v_1 9202 mem := v_2 9203 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 9204 break 9205 } 9206 v.reset(OpPPC64MOVHstore) 9207 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 9208 v.Aux = symToAux(sym) 9209 v.AddArg3(x, val, mem) 9210 return true 9211 } 9212 // match: (MOVHstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) 9213 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 9214 // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem) 9215 for { 9216 off1 := auxIntToInt32(v.AuxInt) 9217 sym1 := auxToSym(v.Aux) 9218 p := v_0 9219 if p.Op != OpPPC64MOVDaddr { 9220 break 9221 } 9222 off2 := auxIntToInt32(p.AuxInt) 9223 sym2 := auxToSym(p.Aux) 9224 ptr := p.Args[0] 9225 val := v_1 9226 mem := v_2 9227 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 9228 break 9229 } 9230 v.reset(OpPPC64MOVHstore) 9231 v.AuxInt = int32ToAuxInt(off1 + off2) 9232 v.Aux = symToAux(mergeSym(sym1, sym2)) 9233 v.AddArg3(ptr, val, mem) 9234 return true 9235 } 9236 // match: (MOVHstore [off] {sym} ptr (MOVDconst [0]) mem) 9237 // result: (MOVHstorezero [off] {sym} ptr mem) 9238 for { 9239 off := auxIntToInt32(v.AuxInt) 9240 sym := auxToSym(v.Aux) 9241 ptr := v_0 9242 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 { 9243 break 9244 } 9245 mem := v_2 9246 v.reset(OpPPC64MOVHstorezero) 9247 v.AuxInt = int32ToAuxInt(off) 9248 v.Aux = symToAux(sym) 9249 v.AddArg2(ptr, mem) 9250 return true 9251 } 9252 // match: (MOVHstore [0] {sym} p:(ADD ptr idx) val mem) 9253 // cond: sym == nil && p.Uses == 1 9254 // result: (MOVHstoreidx ptr idx val mem) 9255 for { 9256 if auxIntToInt32(v.AuxInt) != 0 { 9257 break 9258 } 9259 sym := auxToSym(v.Aux) 9260 p := v_0 9261 if p.Op != OpPPC64ADD { 9262 break 9263 } 9264 idx := p.Args[1] 9265 ptr := p.Args[0] 9266 val := v_1 9267 mem := v_2 9268 if !(sym == nil && p.Uses == 1) { 9269 break 9270 } 9271 v.reset(OpPPC64MOVHstoreidx) 9272 v.AddArg4(ptr, idx, val, mem) 9273 return true 9274 } 9275 // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem) 9276 // result: (MOVHstore [off] {sym} ptr x mem) 9277 for { 9278 off := auxIntToInt32(v.AuxInt) 9279 sym := auxToSym(v.Aux) 9280 ptr := v_0 9281 if v_1.Op != OpPPC64MOVHreg { 9282 break 9283 } 9284 x := v_1.Args[0] 9285 mem := v_2 9286 v.reset(OpPPC64MOVHstore) 9287 v.AuxInt = int32ToAuxInt(off) 9288 v.Aux = symToAux(sym) 9289 v.AddArg3(ptr, x, mem) 9290 return true 9291 } 9292 // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem) 9293 // result: (MOVHstore [off] {sym} ptr x mem) 9294 for { 9295 off := auxIntToInt32(v.AuxInt) 9296 sym := auxToSym(v.Aux) 9297 ptr := v_0 9298 if v_1.Op != OpPPC64MOVHZreg { 9299 break 9300 } 9301 x := v_1.Args[0] 9302 mem := v_2 9303 v.reset(OpPPC64MOVHstore) 9304 v.AuxInt = int32ToAuxInt(off) 9305 v.Aux = symToAux(sym) 9306 v.AddArg3(ptr, x, mem) 9307 return true 9308 } 9309 // match: (MOVHstore [off] {sym} ptr (MOVWreg x) mem) 9310 // result: (MOVHstore [off] {sym} ptr x mem) 9311 for { 9312 off := auxIntToInt32(v.AuxInt) 9313 sym := auxToSym(v.Aux) 9314 ptr := v_0 9315 if v_1.Op != OpPPC64MOVWreg { 9316 break 9317 } 9318 x := v_1.Args[0] 9319 mem := v_2 9320 v.reset(OpPPC64MOVHstore) 9321 v.AuxInt = int32ToAuxInt(off) 9322 v.Aux = symToAux(sym) 9323 v.AddArg3(ptr, x, mem) 9324 return true 9325 } 9326 // match: (MOVHstore [off] {sym} ptr (MOVWZreg x) mem) 9327 // result: (MOVHstore [off] {sym} ptr x mem) 9328 for { 9329 off := auxIntToInt32(v.AuxInt) 9330 sym := auxToSym(v.Aux) 9331 ptr := v_0 9332 if v_1.Op != OpPPC64MOVWZreg { 9333 break 9334 } 9335 x := v_1.Args[0] 9336 mem := v_2 9337 v.reset(OpPPC64MOVHstore) 9338 v.AuxInt = int32ToAuxInt(off) 9339 v.Aux = symToAux(sym) 9340 v.AddArg3(ptr, x, mem) 9341 return true 9342 } 9343 // match: (MOVHstore [off] {sym} ptr r:(BRH val) mem) 9344 // cond: r.Uses == 1 9345 // result: (MOVHBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem) 9346 for { 9347 off := auxIntToInt32(v.AuxInt) 9348 sym := auxToSym(v.Aux) 9349 ptr := v_0 9350 r := v_1 9351 if r.Op != OpPPC64BRH { 9352 break 9353 } 9354 val := r.Args[0] 9355 mem := v_2 9356 if !(r.Uses == 1) { 9357 break 9358 } 9359 v.reset(OpPPC64MOVHBRstore) 9360 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type) 9361 v0.AuxInt = int32ToAuxInt(off) 9362 v0.Aux = symToAux(sym) 9363 v0.AddArg(ptr) 9364 v.AddArg3(v0, val, mem) 9365 return true 9366 } 9367 // match: (MOVHstore [off] {sym} ptr (Bswap16 val) mem) 9368 // result: (MOVHBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem) 9369 for { 9370 off := auxIntToInt32(v.AuxInt) 9371 sym := auxToSym(v.Aux) 9372 ptr := v_0 9373 if v_1.Op != OpBswap16 { 9374 break 9375 } 9376 val := v_1.Args[0] 9377 mem := v_2 9378 v.reset(OpPPC64MOVHBRstore) 9379 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type) 9380 v0.AuxInt = int32ToAuxInt(off) 9381 v0.Aux = symToAux(sym) 9382 v0.AddArg(ptr) 9383 v.AddArg3(v0, val, mem) 9384 return true 9385 } 9386 return false 9387 } 9388 func rewriteValuePPC64_OpPPC64MOVHstoreidx(v *Value) bool { 9389 v_3 := v.Args[3] 9390 v_2 := v.Args[2] 9391 v_1 := v.Args[1] 9392 v_0 := v.Args[0] 9393 // match: (MOVHstoreidx ptr (MOVDconst [c]) val mem) 9394 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 9395 // result: (MOVHstore [int32(c)] ptr val mem) 9396 for { 9397 ptr := v_0 9398 if v_1.Op != OpPPC64MOVDconst { 9399 break 9400 } 9401 c := auxIntToInt64(v_1.AuxInt) 9402 val := v_2 9403 mem := v_3 9404 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 9405 break 9406 } 9407 v.reset(OpPPC64MOVHstore) 9408 v.AuxInt = int32ToAuxInt(int32(c)) 9409 v.AddArg3(ptr, val, mem) 9410 return true 9411 } 9412 // match: (MOVHstoreidx (MOVDconst [c]) ptr val mem) 9413 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 9414 // result: (MOVHstore [int32(c)] ptr val mem) 9415 for { 9416 if v_0.Op != OpPPC64MOVDconst { 9417 break 9418 } 9419 c := auxIntToInt64(v_0.AuxInt) 9420 ptr := v_1 9421 val := v_2 9422 mem := v_3 9423 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 9424 break 9425 } 9426 v.reset(OpPPC64MOVHstore) 9427 v.AuxInt = int32ToAuxInt(int32(c)) 9428 v.AddArg3(ptr, val, mem) 9429 return true 9430 } 9431 // match: (MOVHstoreidx ptr idx (MOVHreg x) mem) 9432 // result: (MOVHstoreidx ptr idx x mem) 9433 for { 9434 ptr := v_0 9435 idx := v_1 9436 if v_2.Op != OpPPC64MOVHreg { 9437 break 9438 } 9439 x := v_2.Args[0] 9440 mem := v_3 9441 v.reset(OpPPC64MOVHstoreidx) 9442 v.AddArg4(ptr, idx, x, mem) 9443 return true 9444 } 9445 // match: (MOVHstoreidx ptr idx (MOVHZreg x) mem) 9446 // result: (MOVHstoreidx ptr idx x mem) 9447 for { 9448 ptr := v_0 9449 idx := v_1 9450 if v_2.Op != OpPPC64MOVHZreg { 9451 break 9452 } 9453 x := v_2.Args[0] 9454 mem := v_3 9455 v.reset(OpPPC64MOVHstoreidx) 9456 v.AddArg4(ptr, idx, x, mem) 9457 return true 9458 } 9459 // match: (MOVHstoreidx ptr idx (MOVWreg x) mem) 9460 // result: (MOVHstoreidx ptr idx x mem) 9461 for { 9462 ptr := v_0 9463 idx := v_1 9464 if v_2.Op != OpPPC64MOVWreg { 9465 break 9466 } 9467 x := v_2.Args[0] 9468 mem := v_3 9469 v.reset(OpPPC64MOVHstoreidx) 9470 v.AddArg4(ptr, idx, x, mem) 9471 return true 9472 } 9473 // match: (MOVHstoreidx ptr idx (MOVWZreg x) mem) 9474 // result: (MOVHstoreidx ptr idx x mem) 9475 for { 9476 ptr := v_0 9477 idx := v_1 9478 if v_2.Op != OpPPC64MOVWZreg { 9479 break 9480 } 9481 x := v_2.Args[0] 9482 mem := v_3 9483 v.reset(OpPPC64MOVHstoreidx) 9484 v.AddArg4(ptr, idx, x, mem) 9485 return true 9486 } 9487 // match: (MOVHstoreidx ptr idx r:(BRH val) mem) 9488 // cond: r.Uses == 1 9489 // result: (MOVHBRstoreidx ptr idx val mem) 9490 for { 9491 ptr := v_0 9492 idx := v_1 9493 r := v_2 9494 if r.Op != OpPPC64BRH { 9495 break 9496 } 9497 val := r.Args[0] 9498 mem := v_3 9499 if !(r.Uses == 1) { 9500 break 9501 } 9502 v.reset(OpPPC64MOVHBRstoreidx) 9503 v.AddArg4(ptr, idx, val, mem) 9504 return true 9505 } 9506 // match: (MOVHstoreidx ptr idx (Bswap16 val) mem) 9507 // result: (MOVHBRstoreidx ptr idx val mem) 9508 for { 9509 ptr := v_0 9510 idx := v_1 9511 if v_2.Op != OpBswap16 { 9512 break 9513 } 9514 val := v_2.Args[0] 9515 mem := v_3 9516 v.reset(OpPPC64MOVHBRstoreidx) 9517 v.AddArg4(ptr, idx, val, mem) 9518 return true 9519 } 9520 return false 9521 } 9522 func rewriteValuePPC64_OpPPC64MOVHstorezero(v *Value) bool { 9523 v_1 := v.Args[1] 9524 v_0 := v.Args[0] 9525 // match: (MOVHstorezero [off1] {sym} (ADDconst [off2] x) mem) 9526 // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2))) 9527 // result: (MOVHstorezero [off1+int32(off2)] {sym} x mem) 9528 for { 9529 off1 := auxIntToInt32(v.AuxInt) 9530 sym := auxToSym(v.Aux) 9531 if v_0.Op != OpPPC64ADDconst { 9532 break 9533 } 9534 off2 := auxIntToInt64(v_0.AuxInt) 9535 x := v_0.Args[0] 9536 mem := v_1 9537 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) { 9538 break 9539 } 9540 v.reset(OpPPC64MOVHstorezero) 9541 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 9542 v.Aux = symToAux(sym) 9543 v.AddArg2(x, mem) 9544 return true 9545 } 9546 // match: (MOVHstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) 9547 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 9548 // result: (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) 9549 for { 9550 off1 := auxIntToInt32(v.AuxInt) 9551 sym1 := auxToSym(v.Aux) 9552 p := v_0 9553 if p.Op != OpPPC64MOVDaddr { 9554 break 9555 } 9556 off2 := auxIntToInt32(p.AuxInt) 9557 sym2 := auxToSym(p.Aux) 9558 x := p.Args[0] 9559 mem := v_1 9560 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 9561 break 9562 } 9563 v.reset(OpPPC64MOVHstorezero) 9564 v.AuxInt = int32ToAuxInt(off1 + off2) 9565 v.Aux = symToAux(mergeSym(sym1, sym2)) 9566 v.AddArg2(x, mem) 9567 return true 9568 } 9569 return false 9570 } 9571 func rewriteValuePPC64_OpPPC64MOVWBRstore(v *Value) bool { 9572 v_2 := v.Args[2] 9573 v_1 := v.Args[1] 9574 v_0 := v.Args[0] 9575 // match: (MOVWBRstore ptr (MOVWreg x) mem) 9576 // result: (MOVWBRstore ptr x mem) 9577 for { 9578 ptr := v_0 9579 if v_1.Op != OpPPC64MOVWreg { 9580 break 9581 } 9582 x := v_1.Args[0] 9583 mem := v_2 9584 v.reset(OpPPC64MOVWBRstore) 9585 v.AddArg3(ptr, x, mem) 9586 return true 9587 } 9588 // match: (MOVWBRstore ptr (MOVWZreg x) mem) 9589 // result: (MOVWBRstore ptr x mem) 9590 for { 9591 ptr := v_0 9592 if v_1.Op != OpPPC64MOVWZreg { 9593 break 9594 } 9595 x := v_1.Args[0] 9596 mem := v_2 9597 v.reset(OpPPC64MOVWBRstore) 9598 v.AddArg3(ptr, x, mem) 9599 return true 9600 } 9601 return false 9602 } 9603 func rewriteValuePPC64_OpPPC64MOVWZload(v *Value) bool { 9604 v_1 := v.Args[1] 9605 v_0 := v.Args[0] 9606 // match: (MOVWZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) 9607 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 9608 // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem) 9609 for { 9610 off1 := auxIntToInt32(v.AuxInt) 9611 sym1 := auxToSym(v.Aux) 9612 p := v_0 9613 if p.Op != OpPPC64MOVDaddr { 9614 break 9615 } 9616 off2 := auxIntToInt32(p.AuxInt) 9617 sym2 := auxToSym(p.Aux) 9618 ptr := p.Args[0] 9619 mem := v_1 9620 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 9621 break 9622 } 9623 v.reset(OpPPC64MOVWZload) 9624 v.AuxInt = int32ToAuxInt(off1 + off2) 9625 v.Aux = symToAux(mergeSym(sym1, sym2)) 9626 v.AddArg2(ptr, mem) 9627 return true 9628 } 9629 // match: (MOVWZload [off1] {sym} (ADDconst [off2] x) mem) 9630 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 9631 // result: (MOVWZload [off1+int32(off2)] {sym} x mem) 9632 for { 9633 off1 := auxIntToInt32(v.AuxInt) 9634 sym := auxToSym(v.Aux) 9635 if v_0.Op != OpPPC64ADDconst { 9636 break 9637 } 9638 off2 := auxIntToInt64(v_0.AuxInt) 9639 x := v_0.Args[0] 9640 mem := v_1 9641 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 9642 break 9643 } 9644 v.reset(OpPPC64MOVWZload) 9645 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 9646 v.Aux = symToAux(sym) 9647 v.AddArg2(x, mem) 9648 return true 9649 } 9650 // match: (MOVWZload [0] {sym} p:(ADD ptr idx) mem) 9651 // cond: sym == nil && p.Uses == 1 9652 // result: (MOVWZloadidx ptr idx mem) 9653 for { 9654 if auxIntToInt32(v.AuxInt) != 0 { 9655 break 9656 } 9657 sym := auxToSym(v.Aux) 9658 p := v_0 9659 if p.Op != OpPPC64ADD { 9660 break 9661 } 9662 idx := p.Args[1] 9663 ptr := p.Args[0] 9664 mem := v_1 9665 if !(sym == nil && p.Uses == 1) { 9666 break 9667 } 9668 v.reset(OpPPC64MOVWZloadidx) 9669 v.AddArg3(ptr, idx, mem) 9670 return true 9671 } 9672 return false 9673 } 9674 func rewriteValuePPC64_OpPPC64MOVWZloadidx(v *Value) bool { 9675 v_2 := v.Args[2] 9676 v_1 := v.Args[1] 9677 v_0 := v.Args[0] 9678 // match: (MOVWZloadidx ptr (MOVDconst [c]) mem) 9679 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 9680 // result: (MOVWZload [int32(c)] ptr mem) 9681 for { 9682 ptr := v_0 9683 if v_1.Op != OpPPC64MOVDconst { 9684 break 9685 } 9686 c := auxIntToInt64(v_1.AuxInt) 9687 mem := v_2 9688 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 9689 break 9690 } 9691 v.reset(OpPPC64MOVWZload) 9692 v.AuxInt = int32ToAuxInt(int32(c)) 9693 v.AddArg2(ptr, mem) 9694 return true 9695 } 9696 // match: (MOVWZloadidx (MOVDconst [c]) ptr mem) 9697 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 9698 // result: (MOVWZload [int32(c)] ptr mem) 9699 for { 9700 if v_0.Op != OpPPC64MOVDconst { 9701 break 9702 } 9703 c := auxIntToInt64(v_0.AuxInt) 9704 ptr := v_1 9705 mem := v_2 9706 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 9707 break 9708 } 9709 v.reset(OpPPC64MOVWZload) 9710 v.AuxInt = int32ToAuxInt(int32(c)) 9711 v.AddArg2(ptr, mem) 9712 return true 9713 } 9714 return false 9715 } 9716 func rewriteValuePPC64_OpPPC64MOVWZreg(v *Value) bool { 9717 v_0 := v.Args[0] 9718 b := v.Block 9719 typ := &b.Func.Config.Types 9720 // match: (MOVWZreg y:(Select0 (ANDCCconst [c] _))) 9721 // cond: uint64(c) <= 0xFFFFFFFF 9722 // result: y 9723 for { 9724 y := v_0 9725 if y.Op != OpSelect0 { 9726 break 9727 } 9728 y_0 := y.Args[0] 9729 if y_0.Op != OpPPC64ANDCCconst { 9730 break 9731 } 9732 c := auxIntToInt64(y_0.AuxInt) 9733 if !(uint64(c) <= 0xFFFFFFFF) { 9734 break 9735 } 9736 v.copyOf(y) 9737 return true 9738 } 9739 // match: (MOVWZreg y:(AND (MOVDconst [c]) _)) 9740 // cond: uint64(c) <= 0xFFFFFFFF 9741 // result: y 9742 for { 9743 y := v_0 9744 if y.Op != OpPPC64AND { 9745 break 9746 } 9747 y_0 := y.Args[0] 9748 y_1 := y.Args[1] 9749 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 { 9750 if y_0.Op != OpPPC64MOVDconst { 9751 continue 9752 } 9753 c := auxIntToInt64(y_0.AuxInt) 9754 if !(uint64(c) <= 0xFFFFFFFF) { 9755 continue 9756 } 9757 v.copyOf(y) 9758 return true 9759 } 9760 break 9761 } 9762 // match: (MOVWZreg (SRWconst [c] (MOVBZreg x))) 9763 // result: (SRWconst [c] (MOVBZreg x)) 9764 for { 9765 if v_0.Op != OpPPC64SRWconst { 9766 break 9767 } 9768 c := auxIntToInt64(v_0.AuxInt) 9769 v_0_0 := v_0.Args[0] 9770 if v_0_0.Op != OpPPC64MOVBZreg { 9771 break 9772 } 9773 x := v_0_0.Args[0] 9774 v.reset(OpPPC64SRWconst) 9775 v.AuxInt = int64ToAuxInt(c) 9776 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 9777 v0.AddArg(x) 9778 v.AddArg(v0) 9779 return true 9780 } 9781 // match: (MOVWZreg (SRWconst [c] (MOVHZreg x))) 9782 // result: (SRWconst [c] (MOVHZreg x)) 9783 for { 9784 if v_0.Op != OpPPC64SRWconst { 9785 break 9786 } 9787 c := auxIntToInt64(v_0.AuxInt) 9788 v_0_0 := v_0.Args[0] 9789 if v_0_0.Op != OpPPC64MOVHZreg { 9790 break 9791 } 9792 x := v_0_0.Args[0] 9793 v.reset(OpPPC64SRWconst) 9794 v.AuxInt = int64ToAuxInt(c) 9795 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 9796 v0.AddArg(x) 9797 v.AddArg(v0) 9798 return true 9799 } 9800 // match: (MOVWZreg (SRWconst [c] (MOVWZreg x))) 9801 // result: (SRWconst [c] (MOVWZreg x)) 9802 for { 9803 if v_0.Op != OpPPC64SRWconst { 9804 break 9805 } 9806 c := auxIntToInt64(v_0.AuxInt) 9807 v_0_0 := v_0.Args[0] 9808 if v_0_0.Op != OpPPC64MOVWZreg { 9809 break 9810 } 9811 x := v_0_0.Args[0] 9812 v.reset(OpPPC64SRWconst) 9813 v.AuxInt = int64ToAuxInt(c) 9814 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64) 9815 v0.AddArg(x) 9816 v.AddArg(v0) 9817 return true 9818 } 9819 // match: (MOVWZreg (SRWconst [c] x)) 9820 // cond: sizeof(x.Type) <= 32 9821 // result: (SRWconst [c] x) 9822 for { 9823 if v_0.Op != OpPPC64SRWconst { 9824 break 9825 } 9826 c := auxIntToInt64(v_0.AuxInt) 9827 x := v_0.Args[0] 9828 if !(sizeof(x.Type) <= 32) { 9829 break 9830 } 9831 v.reset(OpPPC64SRWconst) 9832 v.AuxInt = int64ToAuxInt(c) 9833 v.AddArg(x) 9834 return true 9835 } 9836 // match: (MOVWZreg (SRDconst [c] x)) 9837 // cond: c>=32 9838 // result: (SRDconst [c] x) 9839 for { 9840 if v_0.Op != OpPPC64SRDconst { 9841 break 9842 } 9843 c := auxIntToInt64(v_0.AuxInt) 9844 x := v_0.Args[0] 9845 if !(c >= 32) { 9846 break 9847 } 9848 v.reset(OpPPC64SRDconst) 9849 v.AuxInt = int64ToAuxInt(c) 9850 v.AddArg(x) 9851 return true 9852 } 9853 // match: (MOVWZreg y:(MOVWZreg _)) 9854 // result: y 9855 for { 9856 y := v_0 9857 if y.Op != OpPPC64MOVWZreg { 9858 break 9859 } 9860 v.copyOf(y) 9861 return true 9862 } 9863 // match: (MOVWZreg y:(MOVHZreg _)) 9864 // result: y 9865 for { 9866 y := v_0 9867 if y.Op != OpPPC64MOVHZreg { 9868 break 9869 } 9870 v.copyOf(y) 9871 return true 9872 } 9873 // match: (MOVWZreg y:(MOVBZreg _)) 9874 // result: y 9875 for { 9876 y := v_0 9877 if y.Op != OpPPC64MOVBZreg { 9878 break 9879 } 9880 v.copyOf(y) 9881 return true 9882 } 9883 // match: (MOVWZreg y:(MOVHBRload _ _)) 9884 // result: y 9885 for { 9886 y := v_0 9887 if y.Op != OpPPC64MOVHBRload { 9888 break 9889 } 9890 v.copyOf(y) 9891 return true 9892 } 9893 // match: (MOVWZreg y:(MOVWBRload _ _)) 9894 // result: y 9895 for { 9896 y := v_0 9897 if y.Op != OpPPC64MOVWBRload { 9898 break 9899 } 9900 v.copyOf(y) 9901 return true 9902 } 9903 // match: (MOVWZreg y:(MOVWreg x)) 9904 // result: (MOVWZreg x) 9905 for { 9906 y := v_0 9907 if y.Op != OpPPC64MOVWreg { 9908 break 9909 } 9910 x := y.Args[0] 9911 v.reset(OpPPC64MOVWZreg) 9912 v.AddArg(x) 9913 return true 9914 } 9915 // match: (MOVWZreg (OR <t> x (MOVWZreg y))) 9916 // result: (MOVWZreg (OR <t> x y)) 9917 for { 9918 if v_0.Op != OpPPC64OR { 9919 break 9920 } 9921 t := v_0.Type 9922 _ = v_0.Args[1] 9923 v_0_0 := v_0.Args[0] 9924 v_0_1 := v_0.Args[1] 9925 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 9926 x := v_0_0 9927 if v_0_1.Op != OpPPC64MOVWZreg { 9928 continue 9929 } 9930 y := v_0_1.Args[0] 9931 v.reset(OpPPC64MOVWZreg) 9932 v0 := b.NewValue0(v.Pos, OpPPC64OR, t) 9933 v0.AddArg2(x, y) 9934 v.AddArg(v0) 9935 return true 9936 } 9937 break 9938 } 9939 // match: (MOVWZreg (XOR <t> x (MOVWZreg y))) 9940 // result: (MOVWZreg (XOR <t> x y)) 9941 for { 9942 if v_0.Op != OpPPC64XOR { 9943 break 9944 } 9945 t := v_0.Type 9946 _ = v_0.Args[1] 9947 v_0_0 := v_0.Args[0] 9948 v_0_1 := v_0.Args[1] 9949 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 9950 x := v_0_0 9951 if v_0_1.Op != OpPPC64MOVWZreg { 9952 continue 9953 } 9954 y := v_0_1.Args[0] 9955 v.reset(OpPPC64MOVWZreg) 9956 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t) 9957 v0.AddArg2(x, y) 9958 v.AddArg(v0) 9959 return true 9960 } 9961 break 9962 } 9963 // match: (MOVWZreg (AND <t> x (MOVWZreg y))) 9964 // result: (MOVWZreg (AND <t> x y)) 9965 for { 9966 if v_0.Op != OpPPC64AND { 9967 break 9968 } 9969 t := v_0.Type 9970 _ = v_0.Args[1] 9971 v_0_0 := v_0.Args[0] 9972 v_0_1 := v_0.Args[1] 9973 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 9974 x := v_0_0 9975 if v_0_1.Op != OpPPC64MOVWZreg { 9976 continue 9977 } 9978 y := v_0_1.Args[0] 9979 v.reset(OpPPC64MOVWZreg) 9980 v0 := b.NewValue0(v.Pos, OpPPC64AND, t) 9981 v0.AddArg2(x, y) 9982 v.AddArg(v0) 9983 return true 9984 } 9985 break 9986 } 9987 // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x)))) 9988 // result: z 9989 for { 9990 z := v_0 9991 if z.Op != OpSelect0 { 9992 break 9993 } 9994 z_0 := z.Args[0] 9995 if z_0.Op != OpPPC64ANDCCconst { 9996 break 9997 } 9998 z_0_0 := z_0.Args[0] 9999 if z_0_0.Op != OpPPC64MOVBZload { 10000 break 10001 } 10002 v.copyOf(z) 10003 return true 10004 } 10005 // match: (MOVWZreg z:(AND y (MOVWZload ptr x))) 10006 // result: z 10007 for { 10008 z := v_0 10009 if z.Op != OpPPC64AND { 10010 break 10011 } 10012 _ = z.Args[1] 10013 z_0 := z.Args[0] 10014 z_1 := z.Args[1] 10015 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 10016 if z_1.Op != OpPPC64MOVWZload { 10017 continue 10018 } 10019 v.copyOf(z) 10020 return true 10021 } 10022 break 10023 } 10024 // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x)))) 10025 // result: z 10026 for { 10027 z := v_0 10028 if z.Op != OpSelect0 { 10029 break 10030 } 10031 z_0 := z.Args[0] 10032 if z_0.Op != OpPPC64ANDCCconst { 10033 break 10034 } 10035 z_0_0 := z_0.Args[0] 10036 if z_0_0.Op != OpPPC64MOVHZload { 10037 break 10038 } 10039 v.copyOf(z) 10040 return true 10041 } 10042 // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVWZload ptr x)))) 10043 // result: z 10044 for { 10045 z := v_0 10046 if z.Op != OpSelect0 { 10047 break 10048 } 10049 z_0 := z.Args[0] 10050 if z_0.Op != OpPPC64ANDCCconst { 10051 break 10052 } 10053 z_0_0 := z_0.Args[0] 10054 if z_0_0.Op != OpPPC64MOVWZload { 10055 break 10056 } 10057 v.copyOf(z) 10058 return true 10059 } 10060 // match: (MOVWZreg x:(MOVBZload _ _)) 10061 // result: x 10062 for { 10063 x := v_0 10064 if x.Op != OpPPC64MOVBZload { 10065 break 10066 } 10067 v.copyOf(x) 10068 return true 10069 } 10070 // match: (MOVWZreg x:(MOVBZloadidx _ _ _)) 10071 // result: x 10072 for { 10073 x := v_0 10074 if x.Op != OpPPC64MOVBZloadidx { 10075 break 10076 } 10077 v.copyOf(x) 10078 return true 10079 } 10080 // match: (MOVWZreg x:(MOVHZload _ _)) 10081 // result: x 10082 for { 10083 x := v_0 10084 if x.Op != OpPPC64MOVHZload { 10085 break 10086 } 10087 v.copyOf(x) 10088 return true 10089 } 10090 // match: (MOVWZreg x:(MOVHZloadidx _ _ _)) 10091 // result: x 10092 for { 10093 x := v_0 10094 if x.Op != OpPPC64MOVHZloadidx { 10095 break 10096 } 10097 v.copyOf(x) 10098 return true 10099 } 10100 // match: (MOVWZreg x:(MOVWZload _ _)) 10101 // result: x 10102 for { 10103 x := v_0 10104 if x.Op != OpPPC64MOVWZload { 10105 break 10106 } 10107 v.copyOf(x) 10108 return true 10109 } 10110 // match: (MOVWZreg x:(MOVWZloadidx _ _ _)) 10111 // result: x 10112 for { 10113 x := v_0 10114 if x.Op != OpPPC64MOVWZloadidx { 10115 break 10116 } 10117 v.copyOf(x) 10118 return true 10119 } 10120 // match: (MOVWZreg x:(Select0 (LoweredAtomicLoad32 _ _))) 10121 // result: x 10122 for { 10123 x := v_0 10124 if x.Op != OpSelect0 { 10125 break 10126 } 10127 x_0 := x.Args[0] 10128 if x_0.Op != OpPPC64LoweredAtomicLoad32 { 10129 break 10130 } 10131 v.copyOf(x) 10132 return true 10133 } 10134 // match: (MOVWZreg x:(Arg <t>)) 10135 // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned() 10136 // result: x 10137 for { 10138 x := v_0 10139 if x.Op != OpArg { 10140 break 10141 } 10142 t := x.Type 10143 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned()) { 10144 break 10145 } 10146 v.copyOf(x) 10147 return true 10148 } 10149 // match: (MOVWZreg (MOVDconst [c])) 10150 // result: (MOVDconst [int64(uint32(c))]) 10151 for { 10152 if v_0.Op != OpPPC64MOVDconst { 10153 break 10154 } 10155 c := auxIntToInt64(v_0.AuxInt) 10156 v.reset(OpPPC64MOVDconst) 10157 v.AuxInt = int64ToAuxInt(int64(uint32(c))) 10158 return true 10159 } 10160 return false 10161 } 10162 func rewriteValuePPC64_OpPPC64MOVWload(v *Value) bool { 10163 v_1 := v.Args[1] 10164 v_0 := v.Args[0] 10165 // match: (MOVWload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) 10166 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 10167 // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} ptr mem) 10168 for { 10169 off1 := auxIntToInt32(v.AuxInt) 10170 sym1 := auxToSym(v.Aux) 10171 p := v_0 10172 if p.Op != OpPPC64MOVDaddr { 10173 break 10174 } 10175 off2 := auxIntToInt32(p.AuxInt) 10176 sym2 := auxToSym(p.Aux) 10177 ptr := p.Args[0] 10178 mem := v_1 10179 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 10180 break 10181 } 10182 v.reset(OpPPC64MOVWload) 10183 v.AuxInt = int32ToAuxInt(off1 + off2) 10184 v.Aux = symToAux(mergeSym(sym1, sym2)) 10185 v.AddArg2(ptr, mem) 10186 return true 10187 } 10188 // match: (MOVWload [off1] {sym} (ADDconst [off2] x) mem) 10189 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 10190 // result: (MOVWload [off1+int32(off2)] {sym} x mem) 10191 for { 10192 off1 := auxIntToInt32(v.AuxInt) 10193 sym := auxToSym(v.Aux) 10194 if v_0.Op != OpPPC64ADDconst { 10195 break 10196 } 10197 off2 := auxIntToInt64(v_0.AuxInt) 10198 x := v_0.Args[0] 10199 mem := v_1 10200 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 10201 break 10202 } 10203 v.reset(OpPPC64MOVWload) 10204 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 10205 v.Aux = symToAux(sym) 10206 v.AddArg2(x, mem) 10207 return true 10208 } 10209 // match: (MOVWload [0] {sym} p:(ADD ptr idx) mem) 10210 // cond: sym == nil && p.Uses == 1 10211 // result: (MOVWloadidx ptr idx mem) 10212 for { 10213 if auxIntToInt32(v.AuxInt) != 0 { 10214 break 10215 } 10216 sym := auxToSym(v.Aux) 10217 p := v_0 10218 if p.Op != OpPPC64ADD { 10219 break 10220 } 10221 idx := p.Args[1] 10222 ptr := p.Args[0] 10223 mem := v_1 10224 if !(sym == nil && p.Uses == 1) { 10225 break 10226 } 10227 v.reset(OpPPC64MOVWloadidx) 10228 v.AddArg3(ptr, idx, mem) 10229 return true 10230 } 10231 return false 10232 } 10233 func rewriteValuePPC64_OpPPC64MOVWloadidx(v *Value) bool { 10234 v_2 := v.Args[2] 10235 v_1 := v.Args[1] 10236 v_0 := v.Args[0] 10237 // match: (MOVWloadidx ptr (MOVDconst [c]) mem) 10238 // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 10239 // result: (MOVWload [int32(c)] ptr mem) 10240 for { 10241 ptr := v_0 10242 if v_1.Op != OpPPC64MOVDconst { 10243 break 10244 } 10245 c := auxIntToInt64(v_1.AuxInt) 10246 mem := v_2 10247 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 10248 break 10249 } 10250 v.reset(OpPPC64MOVWload) 10251 v.AuxInt = int32ToAuxInt(int32(c)) 10252 v.AddArg2(ptr, mem) 10253 return true 10254 } 10255 // match: (MOVWloadidx (MOVDconst [c]) ptr mem) 10256 // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 10257 // result: (MOVWload [int32(c)] ptr mem) 10258 for { 10259 if v_0.Op != OpPPC64MOVDconst { 10260 break 10261 } 10262 c := auxIntToInt64(v_0.AuxInt) 10263 ptr := v_1 10264 mem := v_2 10265 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 10266 break 10267 } 10268 v.reset(OpPPC64MOVWload) 10269 v.AuxInt = int32ToAuxInt(int32(c)) 10270 v.AddArg2(ptr, mem) 10271 return true 10272 } 10273 return false 10274 } 10275 func rewriteValuePPC64_OpPPC64MOVWreg(v *Value) bool { 10276 v_0 := v.Args[0] 10277 b := v.Block 10278 typ := &b.Func.Config.Types 10279 // match: (MOVWreg y:(Select0 (ANDCCconst [c] _))) 10280 // cond: uint64(c) <= 0xFFFF 10281 // result: y 10282 for { 10283 y := v_0 10284 if y.Op != OpSelect0 { 10285 break 10286 } 10287 y_0 := y.Args[0] 10288 if y_0.Op != OpPPC64ANDCCconst { 10289 break 10290 } 10291 c := auxIntToInt64(y_0.AuxInt) 10292 if !(uint64(c) <= 0xFFFF) { 10293 break 10294 } 10295 v.copyOf(y) 10296 return true 10297 } 10298 // match: (MOVWreg y:(AND (MOVDconst [c]) _)) 10299 // cond: uint64(c) <= 0x7FFFFFFF 10300 // result: y 10301 for { 10302 y := v_0 10303 if y.Op != OpPPC64AND { 10304 break 10305 } 10306 y_0 := y.Args[0] 10307 y_1 := y.Args[1] 10308 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 { 10309 if y_0.Op != OpPPC64MOVDconst { 10310 continue 10311 } 10312 c := auxIntToInt64(y_0.AuxInt) 10313 if !(uint64(c) <= 0x7FFFFFFF) { 10314 continue 10315 } 10316 v.copyOf(y) 10317 return true 10318 } 10319 break 10320 } 10321 // match: (MOVWreg (SRAWconst [c] (MOVBreg x))) 10322 // result: (SRAWconst [c] (MOVBreg x)) 10323 for { 10324 if v_0.Op != OpPPC64SRAWconst { 10325 break 10326 } 10327 c := auxIntToInt64(v_0.AuxInt) 10328 v_0_0 := v_0.Args[0] 10329 if v_0_0.Op != OpPPC64MOVBreg { 10330 break 10331 } 10332 x := v_0_0.Args[0] 10333 v.reset(OpPPC64SRAWconst) 10334 v.AuxInt = int64ToAuxInt(c) 10335 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 10336 v0.AddArg(x) 10337 v.AddArg(v0) 10338 return true 10339 } 10340 // match: (MOVWreg (SRAWconst [c] (MOVHreg x))) 10341 // result: (SRAWconst [c] (MOVHreg x)) 10342 for { 10343 if v_0.Op != OpPPC64SRAWconst { 10344 break 10345 } 10346 c := auxIntToInt64(v_0.AuxInt) 10347 v_0_0 := v_0.Args[0] 10348 if v_0_0.Op != OpPPC64MOVHreg { 10349 break 10350 } 10351 x := v_0_0.Args[0] 10352 v.reset(OpPPC64SRAWconst) 10353 v.AuxInt = int64ToAuxInt(c) 10354 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 10355 v0.AddArg(x) 10356 v.AddArg(v0) 10357 return true 10358 } 10359 // match: (MOVWreg (SRAWconst [c] (MOVWreg x))) 10360 // result: (SRAWconst [c] (MOVWreg x)) 10361 for { 10362 if v_0.Op != OpPPC64SRAWconst { 10363 break 10364 } 10365 c := auxIntToInt64(v_0.AuxInt) 10366 v_0_0 := v_0.Args[0] 10367 if v_0_0.Op != OpPPC64MOVWreg { 10368 break 10369 } 10370 x := v_0_0.Args[0] 10371 v.reset(OpPPC64SRAWconst) 10372 v.AuxInt = int64ToAuxInt(c) 10373 v0 := b.NewValue0(v.Pos, OpPPC64MOVWreg, typ.Int64) 10374 v0.AddArg(x) 10375 v.AddArg(v0) 10376 return true 10377 } 10378 // match: (MOVWreg (SRAWconst [c] x)) 10379 // cond: sizeof(x.Type) <= 32 10380 // result: (SRAWconst [c] x) 10381 for { 10382 if v_0.Op != OpPPC64SRAWconst { 10383 break 10384 } 10385 c := auxIntToInt64(v_0.AuxInt) 10386 x := v_0.Args[0] 10387 if !(sizeof(x.Type) <= 32) { 10388 break 10389 } 10390 v.reset(OpPPC64SRAWconst) 10391 v.AuxInt = int64ToAuxInt(c) 10392 v.AddArg(x) 10393 return true 10394 } 10395 // match: (MOVWreg (SRDconst [c] x)) 10396 // cond: c>32 10397 // result: (SRDconst [c] x) 10398 for { 10399 if v_0.Op != OpPPC64SRDconst { 10400 break 10401 } 10402 c := auxIntToInt64(v_0.AuxInt) 10403 x := v_0.Args[0] 10404 if !(c > 32) { 10405 break 10406 } 10407 v.reset(OpPPC64SRDconst) 10408 v.AuxInt = int64ToAuxInt(c) 10409 v.AddArg(x) 10410 return true 10411 } 10412 // match: (MOVWreg (SRADconst [c] x)) 10413 // cond: c>=32 10414 // result: (SRADconst [c] x) 10415 for { 10416 if v_0.Op != OpPPC64SRADconst { 10417 break 10418 } 10419 c := auxIntToInt64(v_0.AuxInt) 10420 x := v_0.Args[0] 10421 if !(c >= 32) { 10422 break 10423 } 10424 v.reset(OpPPC64SRADconst) 10425 v.AuxInt = int64ToAuxInt(c) 10426 v.AddArg(x) 10427 return true 10428 } 10429 // match: (MOVWreg (SRDconst [c] x)) 10430 // cond: c==32 10431 // result: (SRADconst [c] x) 10432 for { 10433 if v_0.Op != OpPPC64SRDconst { 10434 break 10435 } 10436 c := auxIntToInt64(v_0.AuxInt) 10437 x := v_0.Args[0] 10438 if !(c == 32) { 10439 break 10440 } 10441 v.reset(OpPPC64SRADconst) 10442 v.AuxInt = int64ToAuxInt(c) 10443 v.AddArg(x) 10444 return true 10445 } 10446 // match: (MOVWreg y:(MOVWreg _)) 10447 // result: y 10448 for { 10449 y := v_0 10450 if y.Op != OpPPC64MOVWreg { 10451 break 10452 } 10453 v.copyOf(y) 10454 return true 10455 } 10456 // match: (MOVWreg y:(MOVHreg _)) 10457 // result: y 10458 for { 10459 y := v_0 10460 if y.Op != OpPPC64MOVHreg { 10461 break 10462 } 10463 v.copyOf(y) 10464 return true 10465 } 10466 // match: (MOVWreg y:(MOVBreg _)) 10467 // result: y 10468 for { 10469 y := v_0 10470 if y.Op != OpPPC64MOVBreg { 10471 break 10472 } 10473 v.copyOf(y) 10474 return true 10475 } 10476 // match: (MOVWreg y:(MOVWZreg x)) 10477 // result: (MOVWreg x) 10478 for { 10479 y := v_0 10480 if y.Op != OpPPC64MOVWZreg { 10481 break 10482 } 10483 x := y.Args[0] 10484 v.reset(OpPPC64MOVWreg) 10485 v.AddArg(x) 10486 return true 10487 } 10488 // match: (MOVWreg x:(MOVHload _ _)) 10489 // result: x 10490 for { 10491 x := v_0 10492 if x.Op != OpPPC64MOVHload { 10493 break 10494 } 10495 v.copyOf(x) 10496 return true 10497 } 10498 // match: (MOVWreg x:(MOVHloadidx _ _ _)) 10499 // result: x 10500 for { 10501 x := v_0 10502 if x.Op != OpPPC64MOVHloadidx { 10503 break 10504 } 10505 v.copyOf(x) 10506 return true 10507 } 10508 // match: (MOVWreg x:(MOVWload _ _)) 10509 // result: x 10510 for { 10511 x := v_0 10512 if x.Op != OpPPC64MOVWload { 10513 break 10514 } 10515 v.copyOf(x) 10516 return true 10517 } 10518 // match: (MOVWreg x:(MOVWloadidx _ _ _)) 10519 // result: x 10520 for { 10521 x := v_0 10522 if x.Op != OpPPC64MOVWloadidx { 10523 break 10524 } 10525 v.copyOf(x) 10526 return true 10527 } 10528 // match: (MOVWreg x:(Arg <t>)) 10529 // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned() 10530 // result: x 10531 for { 10532 x := v_0 10533 if x.Op != OpArg { 10534 break 10535 } 10536 t := x.Type 10537 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned()) { 10538 break 10539 } 10540 v.copyOf(x) 10541 return true 10542 } 10543 // match: (MOVWreg (MOVDconst [c])) 10544 // result: (MOVDconst [int64(int32(c))]) 10545 for { 10546 if v_0.Op != OpPPC64MOVDconst { 10547 break 10548 } 10549 c := auxIntToInt64(v_0.AuxInt) 10550 v.reset(OpPPC64MOVDconst) 10551 v.AuxInt = int64ToAuxInt(int64(int32(c))) 10552 return true 10553 } 10554 return false 10555 } 10556 func rewriteValuePPC64_OpPPC64MOVWstore(v *Value) bool { 10557 v_2 := v.Args[2] 10558 v_1 := v.Args[1] 10559 v_0 := v.Args[0] 10560 b := v.Block 10561 // match: (MOVWstore [off1] {sym} (ADDconst [off2] x) val mem) 10562 // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) 10563 // result: (MOVWstore [off1+int32(off2)] {sym} x val mem) 10564 for { 10565 off1 := auxIntToInt32(v.AuxInt) 10566 sym := auxToSym(v.Aux) 10567 if v_0.Op != OpPPC64ADDconst { 10568 break 10569 } 10570 off2 := auxIntToInt64(v_0.AuxInt) 10571 x := v_0.Args[0] 10572 val := v_1 10573 mem := v_2 10574 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) { 10575 break 10576 } 10577 v.reset(OpPPC64MOVWstore) 10578 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 10579 v.Aux = symToAux(sym) 10580 v.AddArg3(x, val, mem) 10581 return true 10582 } 10583 // match: (MOVWstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) 10584 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 10585 // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem) 10586 for { 10587 off1 := auxIntToInt32(v.AuxInt) 10588 sym1 := auxToSym(v.Aux) 10589 p := v_0 10590 if p.Op != OpPPC64MOVDaddr { 10591 break 10592 } 10593 off2 := auxIntToInt32(p.AuxInt) 10594 sym2 := auxToSym(p.Aux) 10595 ptr := p.Args[0] 10596 val := v_1 10597 mem := v_2 10598 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 10599 break 10600 } 10601 v.reset(OpPPC64MOVWstore) 10602 v.AuxInt = int32ToAuxInt(off1 + off2) 10603 v.Aux = symToAux(mergeSym(sym1, sym2)) 10604 v.AddArg3(ptr, val, mem) 10605 return true 10606 } 10607 // match: (MOVWstore [off] {sym} ptr (MOVDconst [0]) mem) 10608 // result: (MOVWstorezero [off] {sym} ptr mem) 10609 for { 10610 off := auxIntToInt32(v.AuxInt) 10611 sym := auxToSym(v.Aux) 10612 ptr := v_0 10613 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 { 10614 break 10615 } 10616 mem := v_2 10617 v.reset(OpPPC64MOVWstorezero) 10618 v.AuxInt = int32ToAuxInt(off) 10619 v.Aux = symToAux(sym) 10620 v.AddArg2(ptr, mem) 10621 return true 10622 } 10623 // match: (MOVWstore [0] {sym} p:(ADD ptr idx) val mem) 10624 // cond: sym == nil && p.Uses == 1 10625 // result: (MOVWstoreidx ptr idx val mem) 10626 for { 10627 if auxIntToInt32(v.AuxInt) != 0 { 10628 break 10629 } 10630 sym := auxToSym(v.Aux) 10631 p := v_0 10632 if p.Op != OpPPC64ADD { 10633 break 10634 } 10635 idx := p.Args[1] 10636 ptr := p.Args[0] 10637 val := v_1 10638 mem := v_2 10639 if !(sym == nil && p.Uses == 1) { 10640 break 10641 } 10642 v.reset(OpPPC64MOVWstoreidx) 10643 v.AddArg4(ptr, idx, val, mem) 10644 return true 10645 } 10646 // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem) 10647 // result: (MOVWstore [off] {sym} ptr x mem) 10648 for { 10649 off := auxIntToInt32(v.AuxInt) 10650 sym := auxToSym(v.Aux) 10651 ptr := v_0 10652 if v_1.Op != OpPPC64MOVWreg { 10653 break 10654 } 10655 x := v_1.Args[0] 10656 mem := v_2 10657 v.reset(OpPPC64MOVWstore) 10658 v.AuxInt = int32ToAuxInt(off) 10659 v.Aux = symToAux(sym) 10660 v.AddArg3(ptr, x, mem) 10661 return true 10662 } 10663 // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem) 10664 // result: (MOVWstore [off] {sym} ptr x mem) 10665 for { 10666 off := auxIntToInt32(v.AuxInt) 10667 sym := auxToSym(v.Aux) 10668 ptr := v_0 10669 if v_1.Op != OpPPC64MOVWZreg { 10670 break 10671 } 10672 x := v_1.Args[0] 10673 mem := v_2 10674 v.reset(OpPPC64MOVWstore) 10675 v.AuxInt = int32ToAuxInt(off) 10676 v.Aux = symToAux(sym) 10677 v.AddArg3(ptr, x, mem) 10678 return true 10679 } 10680 // match: (MOVWstore [off] {sym} ptr r:(BRW val) mem) 10681 // cond: r.Uses == 1 10682 // result: (MOVWBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem) 10683 for { 10684 off := auxIntToInt32(v.AuxInt) 10685 sym := auxToSym(v.Aux) 10686 ptr := v_0 10687 r := v_1 10688 if r.Op != OpPPC64BRW { 10689 break 10690 } 10691 val := r.Args[0] 10692 mem := v_2 10693 if !(r.Uses == 1) { 10694 break 10695 } 10696 v.reset(OpPPC64MOVWBRstore) 10697 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type) 10698 v0.AuxInt = int32ToAuxInt(off) 10699 v0.Aux = symToAux(sym) 10700 v0.AddArg(ptr) 10701 v.AddArg3(v0, val, mem) 10702 return true 10703 } 10704 // match: (MOVWstore [off] {sym} ptr (Bswap32 val) mem) 10705 // result: (MOVWBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem) 10706 for { 10707 off := auxIntToInt32(v.AuxInt) 10708 sym := auxToSym(v.Aux) 10709 ptr := v_0 10710 if v_1.Op != OpBswap32 { 10711 break 10712 } 10713 val := v_1.Args[0] 10714 mem := v_2 10715 v.reset(OpPPC64MOVWBRstore) 10716 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type) 10717 v0.AuxInt = int32ToAuxInt(off) 10718 v0.Aux = symToAux(sym) 10719 v0.AddArg(ptr) 10720 v.AddArg3(v0, val, mem) 10721 return true 10722 } 10723 return false 10724 } 10725 func rewriteValuePPC64_OpPPC64MOVWstoreidx(v *Value) bool { 10726 v_3 := v.Args[3] 10727 v_2 := v.Args[2] 10728 v_1 := v.Args[1] 10729 v_0 := v.Args[0] 10730 // match: (MOVWstoreidx ptr (MOVDconst [c]) val mem) 10731 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 10732 // result: (MOVWstore [int32(c)] ptr val mem) 10733 for { 10734 ptr := v_0 10735 if v_1.Op != OpPPC64MOVDconst { 10736 break 10737 } 10738 c := auxIntToInt64(v_1.AuxInt) 10739 val := v_2 10740 mem := v_3 10741 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 10742 break 10743 } 10744 v.reset(OpPPC64MOVWstore) 10745 v.AuxInt = int32ToAuxInt(int32(c)) 10746 v.AddArg3(ptr, val, mem) 10747 return true 10748 } 10749 // match: (MOVWstoreidx (MOVDconst [c]) ptr val mem) 10750 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) 10751 // result: (MOVWstore [int32(c)] ptr val mem) 10752 for { 10753 if v_0.Op != OpPPC64MOVDconst { 10754 break 10755 } 10756 c := auxIntToInt64(v_0.AuxInt) 10757 ptr := v_1 10758 val := v_2 10759 mem := v_3 10760 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) { 10761 break 10762 } 10763 v.reset(OpPPC64MOVWstore) 10764 v.AuxInt = int32ToAuxInt(int32(c)) 10765 v.AddArg3(ptr, val, mem) 10766 return true 10767 } 10768 // match: (MOVWstoreidx ptr idx (MOVWreg x) mem) 10769 // result: (MOVWstoreidx ptr idx x mem) 10770 for { 10771 ptr := v_0 10772 idx := v_1 10773 if v_2.Op != OpPPC64MOVWreg { 10774 break 10775 } 10776 x := v_2.Args[0] 10777 mem := v_3 10778 v.reset(OpPPC64MOVWstoreidx) 10779 v.AddArg4(ptr, idx, x, mem) 10780 return true 10781 } 10782 // match: (MOVWstoreidx ptr idx (MOVWZreg x) mem) 10783 // result: (MOVWstoreidx ptr idx x mem) 10784 for { 10785 ptr := v_0 10786 idx := v_1 10787 if v_2.Op != OpPPC64MOVWZreg { 10788 break 10789 } 10790 x := v_2.Args[0] 10791 mem := v_3 10792 v.reset(OpPPC64MOVWstoreidx) 10793 v.AddArg4(ptr, idx, x, mem) 10794 return true 10795 } 10796 // match: (MOVWstoreidx ptr idx r:(BRW val) mem) 10797 // cond: r.Uses == 1 10798 // result: (MOVWBRstoreidx ptr idx val mem) 10799 for { 10800 ptr := v_0 10801 idx := v_1 10802 r := v_2 10803 if r.Op != OpPPC64BRW { 10804 break 10805 } 10806 val := r.Args[0] 10807 mem := v_3 10808 if !(r.Uses == 1) { 10809 break 10810 } 10811 v.reset(OpPPC64MOVWBRstoreidx) 10812 v.AddArg4(ptr, idx, val, mem) 10813 return true 10814 } 10815 // match: (MOVWstoreidx ptr idx (Bswap32 val) mem) 10816 // result: (MOVWBRstoreidx ptr idx val mem) 10817 for { 10818 ptr := v_0 10819 idx := v_1 10820 if v_2.Op != OpBswap32 { 10821 break 10822 } 10823 val := v_2.Args[0] 10824 mem := v_3 10825 v.reset(OpPPC64MOVWBRstoreidx) 10826 v.AddArg4(ptr, idx, val, mem) 10827 return true 10828 } 10829 return false 10830 } 10831 func rewriteValuePPC64_OpPPC64MOVWstorezero(v *Value) bool { 10832 v_1 := v.Args[1] 10833 v_0 := v.Args[0] 10834 // match: (MOVWstorezero [off1] {sym} (ADDconst [off2] x) mem) 10835 // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2))) 10836 // result: (MOVWstorezero [off1+int32(off2)] {sym} x mem) 10837 for { 10838 off1 := auxIntToInt32(v.AuxInt) 10839 sym := auxToSym(v.Aux) 10840 if v_0.Op != OpPPC64ADDconst { 10841 break 10842 } 10843 off2 := auxIntToInt64(v_0.AuxInt) 10844 x := v_0.Args[0] 10845 mem := v_1 10846 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) { 10847 break 10848 } 10849 v.reset(OpPPC64MOVWstorezero) 10850 v.AuxInt = int32ToAuxInt(off1 + int32(off2)) 10851 v.Aux = symToAux(sym) 10852 v.AddArg2(x, mem) 10853 return true 10854 } 10855 // match: (MOVWstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) 10856 // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2)))) 10857 // result: (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) 10858 for { 10859 off1 := auxIntToInt32(v.AuxInt) 10860 sym1 := auxToSym(v.Aux) 10861 p := v_0 10862 if p.Op != OpPPC64MOVDaddr { 10863 break 10864 } 10865 off2 := auxIntToInt32(p.AuxInt) 10866 sym2 := auxToSym(p.Aux) 10867 x := p.Args[0] 10868 mem := v_1 10869 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) { 10870 break 10871 } 10872 v.reset(OpPPC64MOVWstorezero) 10873 v.AuxInt = int32ToAuxInt(off1 + off2) 10874 v.Aux = symToAux(mergeSym(sym1, sym2)) 10875 v.AddArg2(x, mem) 10876 return true 10877 } 10878 return false 10879 } 10880 func rewriteValuePPC64_OpPPC64MTVSRD(v *Value) bool { 10881 v_0 := v.Args[0] 10882 b := v.Block 10883 typ := &b.Func.Config.Types 10884 // match: (MTVSRD (MOVDconst [c])) 10885 // cond: !math.IsNaN(math.Float64frombits(uint64(c))) 10886 // result: (FMOVDconst [math.Float64frombits(uint64(c))]) 10887 for { 10888 if v_0.Op != OpPPC64MOVDconst { 10889 break 10890 } 10891 c := auxIntToInt64(v_0.AuxInt) 10892 if !(!math.IsNaN(math.Float64frombits(uint64(c)))) { 10893 break 10894 } 10895 v.reset(OpPPC64FMOVDconst) 10896 v.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c))) 10897 return true 10898 } 10899 // match: (MTVSRD x:(MOVDload [off] {sym} ptr mem)) 10900 // cond: x.Uses == 1 && clobber(x) 10901 // result: @x.Block (FMOVDload [off] {sym} ptr mem) 10902 for { 10903 x := v_0 10904 if x.Op != OpPPC64MOVDload { 10905 break 10906 } 10907 off := auxIntToInt32(x.AuxInt) 10908 sym := auxToSym(x.Aux) 10909 mem := x.Args[1] 10910 ptr := x.Args[0] 10911 if !(x.Uses == 1 && clobber(x)) { 10912 break 10913 } 10914 b = x.Block 10915 v0 := b.NewValue0(x.Pos, OpPPC64FMOVDload, typ.Float64) 10916 v.copyOf(v0) 10917 v0.AuxInt = int32ToAuxInt(off) 10918 v0.Aux = symToAux(sym) 10919 v0.AddArg2(ptr, mem) 10920 return true 10921 } 10922 return false 10923 } 10924 func rewriteValuePPC64_OpPPC64MULLD(v *Value) bool { 10925 v_1 := v.Args[1] 10926 v_0 := v.Args[0] 10927 // match: (MULLD x (MOVDconst [c])) 10928 // cond: is16Bit(c) 10929 // result: (MULLDconst [int32(c)] x) 10930 for { 10931 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 10932 x := v_0 10933 if v_1.Op != OpPPC64MOVDconst { 10934 continue 10935 } 10936 c := auxIntToInt64(v_1.AuxInt) 10937 if !(is16Bit(c)) { 10938 continue 10939 } 10940 v.reset(OpPPC64MULLDconst) 10941 v.AuxInt = int32ToAuxInt(int32(c)) 10942 v.AddArg(x) 10943 return true 10944 } 10945 break 10946 } 10947 return false 10948 } 10949 func rewriteValuePPC64_OpPPC64MULLW(v *Value) bool { 10950 v_1 := v.Args[1] 10951 v_0 := v.Args[0] 10952 // match: (MULLW x (MOVDconst [c])) 10953 // cond: is16Bit(c) 10954 // result: (MULLWconst [int32(c)] x) 10955 for { 10956 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 10957 x := v_0 10958 if v_1.Op != OpPPC64MOVDconst { 10959 continue 10960 } 10961 c := auxIntToInt64(v_1.AuxInt) 10962 if !(is16Bit(c)) { 10963 continue 10964 } 10965 v.reset(OpPPC64MULLWconst) 10966 v.AuxInt = int32ToAuxInt(int32(c)) 10967 v.AddArg(x) 10968 return true 10969 } 10970 break 10971 } 10972 return false 10973 } 10974 func rewriteValuePPC64_OpPPC64NEG(v *Value) bool { 10975 v_0 := v.Args[0] 10976 // match: (NEG (ADDconst [c] x)) 10977 // cond: is32Bit(-c) 10978 // result: (SUBFCconst [-c] x) 10979 for { 10980 if v_0.Op != OpPPC64ADDconst { 10981 break 10982 } 10983 c := auxIntToInt64(v_0.AuxInt) 10984 x := v_0.Args[0] 10985 if !(is32Bit(-c)) { 10986 break 10987 } 10988 v.reset(OpPPC64SUBFCconst) 10989 v.AuxInt = int64ToAuxInt(-c) 10990 v.AddArg(x) 10991 return true 10992 } 10993 // match: (NEG (SUBFCconst [c] x)) 10994 // cond: is32Bit(-c) 10995 // result: (ADDconst [-c] x) 10996 for { 10997 if v_0.Op != OpPPC64SUBFCconst { 10998 break 10999 } 11000 c := auxIntToInt64(v_0.AuxInt) 11001 x := v_0.Args[0] 11002 if !(is32Bit(-c)) { 11003 break 11004 } 11005 v.reset(OpPPC64ADDconst) 11006 v.AuxInt = int64ToAuxInt(-c) 11007 v.AddArg(x) 11008 return true 11009 } 11010 // match: (NEG (SUB x y)) 11011 // result: (SUB y x) 11012 for { 11013 if v_0.Op != OpPPC64SUB { 11014 break 11015 } 11016 y := v_0.Args[1] 11017 x := v_0.Args[0] 11018 v.reset(OpPPC64SUB) 11019 v.AddArg2(y, x) 11020 return true 11021 } 11022 // match: (NEG (NEG x)) 11023 // result: x 11024 for { 11025 if v_0.Op != OpPPC64NEG { 11026 break 11027 } 11028 x := v_0.Args[0] 11029 v.copyOf(x) 11030 return true 11031 } 11032 return false 11033 } 11034 func rewriteValuePPC64_OpPPC64NOR(v *Value) bool { 11035 v_1 := v.Args[1] 11036 v_0 := v.Args[0] 11037 // match: (NOR (MOVDconst [c]) (MOVDconst [d])) 11038 // result: (MOVDconst [^(c|d)]) 11039 for { 11040 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11041 if v_0.Op != OpPPC64MOVDconst { 11042 continue 11043 } 11044 c := auxIntToInt64(v_0.AuxInt) 11045 if v_1.Op != OpPPC64MOVDconst { 11046 continue 11047 } 11048 d := auxIntToInt64(v_1.AuxInt) 11049 v.reset(OpPPC64MOVDconst) 11050 v.AuxInt = int64ToAuxInt(^(c | d)) 11051 return true 11052 } 11053 break 11054 } 11055 return false 11056 } 11057 func rewriteValuePPC64_OpPPC64NotEqual(v *Value) bool { 11058 v_0 := v.Args[0] 11059 // match: (NotEqual (FlagEQ)) 11060 // result: (MOVDconst [0]) 11061 for { 11062 if v_0.Op != OpPPC64FlagEQ { 11063 break 11064 } 11065 v.reset(OpPPC64MOVDconst) 11066 v.AuxInt = int64ToAuxInt(0) 11067 return true 11068 } 11069 // match: (NotEqual (FlagLT)) 11070 // result: (MOVDconst [1]) 11071 for { 11072 if v_0.Op != OpPPC64FlagLT { 11073 break 11074 } 11075 v.reset(OpPPC64MOVDconst) 11076 v.AuxInt = int64ToAuxInt(1) 11077 return true 11078 } 11079 // match: (NotEqual (FlagGT)) 11080 // result: (MOVDconst [1]) 11081 for { 11082 if v_0.Op != OpPPC64FlagGT { 11083 break 11084 } 11085 v.reset(OpPPC64MOVDconst) 11086 v.AuxInt = int64ToAuxInt(1) 11087 return true 11088 } 11089 // match: (NotEqual (InvertFlags x)) 11090 // result: (NotEqual x) 11091 for { 11092 if v_0.Op != OpPPC64InvertFlags { 11093 break 11094 } 11095 x := v_0.Args[0] 11096 v.reset(OpPPC64NotEqual) 11097 v.AddArg(x) 11098 return true 11099 } 11100 // match: (NotEqual cmp) 11101 // result: (SETBCR [2] cmp) 11102 for { 11103 cmp := v_0 11104 v.reset(OpPPC64SETBCR) 11105 v.AuxInt = int32ToAuxInt(2) 11106 v.AddArg(cmp) 11107 return true 11108 } 11109 } 11110 func rewriteValuePPC64_OpPPC64OR(v *Value) bool { 11111 v_1 := v.Args[1] 11112 v_0 := v.Args[0] 11113 // match: (OR x (NOR y y)) 11114 // result: (ORN x y) 11115 for { 11116 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11117 x := v_0 11118 if v_1.Op != OpPPC64NOR { 11119 continue 11120 } 11121 y := v_1.Args[1] 11122 if y != v_1.Args[0] { 11123 continue 11124 } 11125 v.reset(OpPPC64ORN) 11126 v.AddArg2(x, y) 11127 return true 11128 } 11129 break 11130 } 11131 // match: (OR (MOVDconst [c]) (MOVDconst [d])) 11132 // result: (MOVDconst [c|d]) 11133 for { 11134 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11135 if v_0.Op != OpPPC64MOVDconst { 11136 continue 11137 } 11138 c := auxIntToInt64(v_0.AuxInt) 11139 if v_1.Op != OpPPC64MOVDconst { 11140 continue 11141 } 11142 d := auxIntToInt64(v_1.AuxInt) 11143 v.reset(OpPPC64MOVDconst) 11144 v.AuxInt = int64ToAuxInt(c | d) 11145 return true 11146 } 11147 break 11148 } 11149 // match: (OR x (MOVDconst [c])) 11150 // cond: isU32Bit(c) 11151 // result: (ORconst [c] x) 11152 for { 11153 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 11154 x := v_0 11155 if v_1.Op != OpPPC64MOVDconst { 11156 continue 11157 } 11158 c := auxIntToInt64(v_1.AuxInt) 11159 if !(isU32Bit(c)) { 11160 continue 11161 } 11162 v.reset(OpPPC64ORconst) 11163 v.AuxInt = int64ToAuxInt(c) 11164 v.AddArg(x) 11165 return true 11166 } 11167 break 11168 } 11169 return false 11170 } 11171 func rewriteValuePPC64_OpPPC64ORN(v *Value) bool { 11172 v_1 := v.Args[1] 11173 v_0 := v.Args[0] 11174 // match: (ORN x (MOVDconst [-1])) 11175 // result: x 11176 for { 11177 x := v_0 11178 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 { 11179 break 11180 } 11181 v.copyOf(x) 11182 return true 11183 } 11184 // match: (ORN (MOVDconst [c]) (MOVDconst [d])) 11185 // result: (MOVDconst [c|^d]) 11186 for { 11187 if v_0.Op != OpPPC64MOVDconst { 11188 break 11189 } 11190 c := auxIntToInt64(v_0.AuxInt) 11191 if v_1.Op != OpPPC64MOVDconst { 11192 break 11193 } 11194 d := auxIntToInt64(v_1.AuxInt) 11195 v.reset(OpPPC64MOVDconst) 11196 v.AuxInt = int64ToAuxInt(c | ^d) 11197 return true 11198 } 11199 return false 11200 } 11201 func rewriteValuePPC64_OpPPC64ORconst(v *Value) bool { 11202 v_0 := v.Args[0] 11203 // match: (ORconst [c] (ORconst [d] x)) 11204 // result: (ORconst [c|d] x) 11205 for { 11206 c := auxIntToInt64(v.AuxInt) 11207 if v_0.Op != OpPPC64ORconst { 11208 break 11209 } 11210 d := auxIntToInt64(v_0.AuxInt) 11211 x := v_0.Args[0] 11212 v.reset(OpPPC64ORconst) 11213 v.AuxInt = int64ToAuxInt(c | d) 11214 v.AddArg(x) 11215 return true 11216 } 11217 // match: (ORconst [-1] _) 11218 // result: (MOVDconst [-1]) 11219 for { 11220 if auxIntToInt64(v.AuxInt) != -1 { 11221 break 11222 } 11223 v.reset(OpPPC64MOVDconst) 11224 v.AuxInt = int64ToAuxInt(-1) 11225 return true 11226 } 11227 // match: (ORconst [0] x) 11228 // result: x 11229 for { 11230 if auxIntToInt64(v.AuxInt) != 0 { 11231 break 11232 } 11233 x := v_0 11234 v.copyOf(x) 11235 return true 11236 } 11237 return false 11238 } 11239 func rewriteValuePPC64_OpPPC64ROTL(v *Value) bool { 11240 v_1 := v.Args[1] 11241 v_0 := v.Args[0] 11242 // match: (ROTL x (MOVDconst [c])) 11243 // result: (ROTLconst x [c&63]) 11244 for { 11245 x := v_0 11246 if v_1.Op != OpPPC64MOVDconst { 11247 break 11248 } 11249 c := auxIntToInt64(v_1.AuxInt) 11250 v.reset(OpPPC64ROTLconst) 11251 v.AuxInt = int64ToAuxInt(c & 63) 11252 v.AddArg(x) 11253 return true 11254 } 11255 return false 11256 } 11257 func rewriteValuePPC64_OpPPC64ROTLW(v *Value) bool { 11258 v_1 := v.Args[1] 11259 v_0 := v.Args[0] 11260 // match: (ROTLW x (MOVDconst [c])) 11261 // result: (ROTLWconst x [c&31]) 11262 for { 11263 x := v_0 11264 if v_1.Op != OpPPC64MOVDconst { 11265 break 11266 } 11267 c := auxIntToInt64(v_1.AuxInt) 11268 v.reset(OpPPC64ROTLWconst) 11269 v.AuxInt = int64ToAuxInt(c & 31) 11270 v.AddArg(x) 11271 return true 11272 } 11273 return false 11274 } 11275 func rewriteValuePPC64_OpPPC64ROTLWconst(v *Value) bool { 11276 v_0 := v.Args[0] 11277 // match: (ROTLWconst [r] (AND (MOVDconst [m]) x)) 11278 // cond: isPPC64WordRotateMask(m) 11279 // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x) 11280 for { 11281 r := auxIntToInt64(v.AuxInt) 11282 if v_0.Op != OpPPC64AND { 11283 break 11284 } 11285 _ = v_0.Args[1] 11286 v_0_0 := v_0.Args[0] 11287 v_0_1 := v_0.Args[1] 11288 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 11289 if v_0_0.Op != OpPPC64MOVDconst { 11290 continue 11291 } 11292 m := auxIntToInt64(v_0_0.AuxInt) 11293 x := v_0_1 11294 if !(isPPC64WordRotateMask(m)) { 11295 continue 11296 } 11297 v.reset(OpPPC64RLWINM) 11298 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32)) 11299 v.AddArg(x) 11300 return true 11301 } 11302 break 11303 } 11304 // match: (ROTLWconst [r] (Select0 (ANDCCconst [m] x))) 11305 // cond: isPPC64WordRotateMask(m) 11306 // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x) 11307 for { 11308 r := auxIntToInt64(v.AuxInt) 11309 if v_0.Op != OpSelect0 { 11310 break 11311 } 11312 v_0_0 := v_0.Args[0] 11313 if v_0_0.Op != OpPPC64ANDCCconst { 11314 break 11315 } 11316 m := auxIntToInt64(v_0_0.AuxInt) 11317 x := v_0_0.Args[0] 11318 if !(isPPC64WordRotateMask(m)) { 11319 break 11320 } 11321 v.reset(OpPPC64RLWINM) 11322 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32)) 11323 v.AddArg(x) 11324 return true 11325 } 11326 return false 11327 } 11328 func rewriteValuePPC64_OpPPC64SETBC(v *Value) bool { 11329 v_0 := v.Args[0] 11330 b := v.Block 11331 typ := &b.Func.Config.Types 11332 // match: (SETBC [0] (FlagLT)) 11333 // result: (MOVDconst [1]) 11334 for { 11335 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT { 11336 break 11337 } 11338 v.reset(OpPPC64MOVDconst) 11339 v.AuxInt = int64ToAuxInt(1) 11340 return true 11341 } 11342 // match: (SETBC [0] (FlagGT)) 11343 // result: (MOVDconst [0]) 11344 for { 11345 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT { 11346 break 11347 } 11348 v.reset(OpPPC64MOVDconst) 11349 v.AuxInt = int64ToAuxInt(0) 11350 return true 11351 } 11352 // match: (SETBC [0] (FlagEQ)) 11353 // result: (MOVDconst [0]) 11354 for { 11355 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ { 11356 break 11357 } 11358 v.reset(OpPPC64MOVDconst) 11359 v.AuxInt = int64ToAuxInt(0) 11360 return true 11361 } 11362 // match: (SETBC [1] (FlagGT)) 11363 // result: (MOVDconst [1]) 11364 for { 11365 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT { 11366 break 11367 } 11368 v.reset(OpPPC64MOVDconst) 11369 v.AuxInt = int64ToAuxInt(1) 11370 return true 11371 } 11372 // match: (SETBC [1] (FlagLT)) 11373 // result: (MOVDconst [0]) 11374 for { 11375 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT { 11376 break 11377 } 11378 v.reset(OpPPC64MOVDconst) 11379 v.AuxInt = int64ToAuxInt(0) 11380 return true 11381 } 11382 // match: (SETBC [1] (FlagEQ)) 11383 // result: (MOVDconst [0]) 11384 for { 11385 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ { 11386 break 11387 } 11388 v.reset(OpPPC64MOVDconst) 11389 v.AuxInt = int64ToAuxInt(0) 11390 return true 11391 } 11392 // match: (SETBC [2] (FlagEQ)) 11393 // result: (MOVDconst [1]) 11394 for { 11395 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ { 11396 break 11397 } 11398 v.reset(OpPPC64MOVDconst) 11399 v.AuxInt = int64ToAuxInt(1) 11400 return true 11401 } 11402 // match: (SETBC [2] (FlagLT)) 11403 // result: (MOVDconst [0]) 11404 for { 11405 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT { 11406 break 11407 } 11408 v.reset(OpPPC64MOVDconst) 11409 v.AuxInt = int64ToAuxInt(0) 11410 return true 11411 } 11412 // match: (SETBC [2] (FlagGT)) 11413 // result: (MOVDconst [0]) 11414 for { 11415 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT { 11416 break 11417 } 11418 v.reset(OpPPC64MOVDconst) 11419 v.AuxInt = int64ToAuxInt(0) 11420 return true 11421 } 11422 // match: (SETBC [0] (InvertFlags bool)) 11423 // result: (SETBC [1] bool) 11424 for { 11425 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags { 11426 break 11427 } 11428 bool := v_0.Args[0] 11429 v.reset(OpPPC64SETBC) 11430 v.AuxInt = int32ToAuxInt(1) 11431 v.AddArg(bool) 11432 return true 11433 } 11434 // match: (SETBC [1] (InvertFlags bool)) 11435 // result: (SETBC [0] bool) 11436 for { 11437 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags { 11438 break 11439 } 11440 bool := v_0.Args[0] 11441 v.reset(OpPPC64SETBC) 11442 v.AuxInt = int32ToAuxInt(0) 11443 v.AddArg(bool) 11444 return true 11445 } 11446 // match: (SETBC [2] (InvertFlags bool)) 11447 // result: (SETBC [2] bool) 11448 for { 11449 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags { 11450 break 11451 } 11452 bool := v_0.Args[0] 11453 v.reset(OpPPC64SETBC) 11454 v.AuxInt = int32ToAuxInt(2) 11455 v.AddArg(bool) 11456 return true 11457 } 11458 // match: (SETBC [n] (InvertFlags bool)) 11459 // result: (SETBCR [n] bool) 11460 for { 11461 n := auxIntToInt32(v.AuxInt) 11462 if v_0.Op != OpPPC64InvertFlags { 11463 break 11464 } 11465 bool := v_0.Args[0] 11466 v.reset(OpPPC64SETBCR) 11467 v.AuxInt = int32ToAuxInt(n) 11468 v.AddArg(bool) 11469 return true 11470 } 11471 // match: (SETBC [2] (CMPconst [0] (Select0 (ANDCCconst [1] z)))) 11472 // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z ))) 11473 for { 11474 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 { 11475 break 11476 } 11477 v_0_0 := v_0.Args[0] 11478 if v_0_0.Op != OpSelect0 { 11479 break 11480 } 11481 v_0_0_0 := v_0_0.Args[0] 11482 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 11483 break 11484 } 11485 z := v_0_0_0.Args[0] 11486 v.reset(OpPPC64XORconst) 11487 v.AuxInt = int64ToAuxInt(1) 11488 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64) 11489 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 11490 v1.AuxInt = int64ToAuxInt(1) 11491 v1.AddArg(z) 11492 v0.AddArg(v1) 11493 v.AddArg(v0) 11494 return true 11495 } 11496 // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z)))) 11497 // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z ))) 11498 for { 11499 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 { 11500 break 11501 } 11502 v_0_0 := v_0.Args[0] 11503 if v_0_0.Op != OpSelect0 { 11504 break 11505 } 11506 v_0_0_0 := v_0_0.Args[0] 11507 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 11508 break 11509 } 11510 z := v_0_0_0.Args[0] 11511 v.reset(OpPPC64XORconst) 11512 v.AuxInt = int64ToAuxInt(1) 11513 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64) 11514 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 11515 v1.AuxInt = int64ToAuxInt(1) 11516 v1.AddArg(z) 11517 v0.AddArg(v1) 11518 v.AddArg(v0) 11519 return true 11520 } 11521 // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z)))) 11522 // result: (SETBC [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z ))) 11523 for { 11524 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 { 11525 break 11526 } 11527 v_0_0 := v_0.Args[0] 11528 if v_0_0.Op != OpSelect0 { 11529 break 11530 } 11531 v_0_0_0 := v_0_0.Args[0] 11532 if v_0_0_0.Op != OpPPC64ANDCCconst { 11533 break 11534 } 11535 n := auxIntToInt64(v_0_0_0.AuxInt) 11536 z := v_0_0_0.Args[0] 11537 v.reset(OpPPC64SETBC) 11538 v.AuxInt = int32ToAuxInt(2) 11539 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 11540 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 11541 v1.AuxInt = int64ToAuxInt(n) 11542 v1.AddArg(z) 11543 v0.AddArg(v1) 11544 v.AddArg(v0) 11545 return true 11546 } 11547 // match: (SETBC [2] (CMPconst [0] a:(AND y z))) 11548 // cond: a.Uses == 1 11549 // result: (SETBC [2] (Select1 <types.TypeFlags> (ANDCC y z ))) 11550 for { 11551 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 { 11552 break 11553 } 11554 a := v_0.Args[0] 11555 if a.Op != OpPPC64AND { 11556 break 11557 } 11558 z := a.Args[1] 11559 y := a.Args[0] 11560 if !(a.Uses == 1) { 11561 break 11562 } 11563 v.reset(OpPPC64SETBC) 11564 v.AuxInt = int32ToAuxInt(2) 11565 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 11566 v1 := b.NewValue0(v.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags)) 11567 v1.AddArg2(y, z) 11568 v0.AddArg(v1) 11569 v.AddArg(v0) 11570 return true 11571 } 11572 // match: (SETBC [2] (CMPconst [0] o:(OR y z))) 11573 // cond: o.Uses == 1 11574 // result: (SETBC [2] (Select1 <types.TypeFlags> (ORCC y z ))) 11575 for { 11576 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 { 11577 break 11578 } 11579 o := v_0.Args[0] 11580 if o.Op != OpPPC64OR { 11581 break 11582 } 11583 z := o.Args[1] 11584 y := o.Args[0] 11585 if !(o.Uses == 1) { 11586 break 11587 } 11588 v.reset(OpPPC64SETBC) 11589 v.AuxInt = int32ToAuxInt(2) 11590 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 11591 v1 := b.NewValue0(v.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags)) 11592 v1.AddArg2(y, z) 11593 v0.AddArg(v1) 11594 v.AddArg(v0) 11595 return true 11596 } 11597 // match: (SETBC [2] (CMPconst [0] a:(XOR y z))) 11598 // cond: a.Uses == 1 11599 // result: (SETBC [2] (Select1 <types.TypeFlags> (XORCC y z ))) 11600 for { 11601 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 { 11602 break 11603 } 11604 a := v_0.Args[0] 11605 if a.Op != OpPPC64XOR { 11606 break 11607 } 11608 z := a.Args[1] 11609 y := a.Args[0] 11610 if !(a.Uses == 1) { 11611 break 11612 } 11613 v.reset(OpPPC64SETBC) 11614 v.AuxInt = int32ToAuxInt(2) 11615 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 11616 v1 := b.NewValue0(v.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags)) 11617 v1.AddArg2(y, z) 11618 v0.AddArg(v1) 11619 v.AddArg(v0) 11620 return true 11621 } 11622 return false 11623 } 11624 func rewriteValuePPC64_OpPPC64SETBCR(v *Value) bool { 11625 v_0 := v.Args[0] 11626 b := v.Block 11627 typ := &b.Func.Config.Types 11628 // match: (SETBCR [0] (FlagLT)) 11629 // result: (MOVDconst [0]) 11630 for { 11631 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT { 11632 break 11633 } 11634 v.reset(OpPPC64MOVDconst) 11635 v.AuxInt = int64ToAuxInt(0) 11636 return true 11637 } 11638 // match: (SETBCR [0] (FlagGT)) 11639 // result: (MOVDconst [1]) 11640 for { 11641 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT { 11642 break 11643 } 11644 v.reset(OpPPC64MOVDconst) 11645 v.AuxInt = int64ToAuxInt(1) 11646 return true 11647 } 11648 // match: (SETBCR [0] (FlagEQ)) 11649 // result: (MOVDconst [1]) 11650 for { 11651 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ { 11652 break 11653 } 11654 v.reset(OpPPC64MOVDconst) 11655 v.AuxInt = int64ToAuxInt(1) 11656 return true 11657 } 11658 // match: (SETBCR [1] (FlagGT)) 11659 // result: (MOVDconst [0]) 11660 for { 11661 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT { 11662 break 11663 } 11664 v.reset(OpPPC64MOVDconst) 11665 v.AuxInt = int64ToAuxInt(0) 11666 return true 11667 } 11668 // match: (SETBCR [1] (FlagLT)) 11669 // result: (MOVDconst [1]) 11670 for { 11671 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT { 11672 break 11673 } 11674 v.reset(OpPPC64MOVDconst) 11675 v.AuxInt = int64ToAuxInt(1) 11676 return true 11677 } 11678 // match: (SETBCR [1] (FlagEQ)) 11679 // result: (MOVDconst [1]) 11680 for { 11681 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ { 11682 break 11683 } 11684 v.reset(OpPPC64MOVDconst) 11685 v.AuxInt = int64ToAuxInt(1) 11686 return true 11687 } 11688 // match: (SETBCR [2] (FlagEQ)) 11689 // result: (MOVDconst [0]) 11690 for { 11691 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ { 11692 break 11693 } 11694 v.reset(OpPPC64MOVDconst) 11695 v.AuxInt = int64ToAuxInt(0) 11696 return true 11697 } 11698 // match: (SETBCR [2] (FlagLT)) 11699 // result: (MOVDconst [1]) 11700 for { 11701 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT { 11702 break 11703 } 11704 v.reset(OpPPC64MOVDconst) 11705 v.AuxInt = int64ToAuxInt(1) 11706 return true 11707 } 11708 // match: (SETBCR [2] (FlagGT)) 11709 // result: (MOVDconst [1]) 11710 for { 11711 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT { 11712 break 11713 } 11714 v.reset(OpPPC64MOVDconst) 11715 v.AuxInt = int64ToAuxInt(1) 11716 return true 11717 } 11718 // match: (SETBCR [0] (InvertFlags bool)) 11719 // result: (SETBCR [1] bool) 11720 for { 11721 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags { 11722 break 11723 } 11724 bool := v_0.Args[0] 11725 v.reset(OpPPC64SETBCR) 11726 v.AuxInt = int32ToAuxInt(1) 11727 v.AddArg(bool) 11728 return true 11729 } 11730 // match: (SETBCR [1] (InvertFlags bool)) 11731 // result: (SETBCR [0] bool) 11732 for { 11733 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags { 11734 break 11735 } 11736 bool := v_0.Args[0] 11737 v.reset(OpPPC64SETBCR) 11738 v.AuxInt = int32ToAuxInt(0) 11739 v.AddArg(bool) 11740 return true 11741 } 11742 // match: (SETBCR [2] (InvertFlags bool)) 11743 // result: (SETBCR [2] bool) 11744 for { 11745 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags { 11746 break 11747 } 11748 bool := v_0.Args[0] 11749 v.reset(OpPPC64SETBCR) 11750 v.AuxInt = int32ToAuxInt(2) 11751 v.AddArg(bool) 11752 return true 11753 } 11754 // match: (SETBCR [n] (InvertFlags bool)) 11755 // result: (SETBC [n] bool) 11756 for { 11757 n := auxIntToInt32(v.AuxInt) 11758 if v_0.Op != OpPPC64InvertFlags { 11759 break 11760 } 11761 bool := v_0.Args[0] 11762 v.reset(OpPPC64SETBC) 11763 v.AuxInt = int32ToAuxInt(n) 11764 v.AddArg(bool) 11765 return true 11766 } 11767 // match: (SETBCR [2] (CMPconst [0] (Select0 (ANDCCconst [1] z)))) 11768 // result: (Select0 <typ.UInt64> (ANDCCconst [1] z )) 11769 for { 11770 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 { 11771 break 11772 } 11773 v_0_0 := v_0.Args[0] 11774 if v_0_0.Op != OpSelect0 { 11775 break 11776 } 11777 v_0_0_0 := v_0_0.Args[0] 11778 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 11779 break 11780 } 11781 z := v_0_0_0.Args[0] 11782 v.reset(OpSelect0) 11783 v.Type = typ.UInt64 11784 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 11785 v0.AuxInt = int64ToAuxInt(1) 11786 v0.AddArg(z) 11787 v.AddArg(v0) 11788 return true 11789 } 11790 // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z)))) 11791 // result: (Select0 <typ.UInt64> (ANDCCconst [1] z )) 11792 for { 11793 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 { 11794 break 11795 } 11796 v_0_0 := v_0.Args[0] 11797 if v_0_0.Op != OpSelect0 { 11798 break 11799 } 11800 v_0_0_0 := v_0_0.Args[0] 11801 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 11802 break 11803 } 11804 z := v_0_0_0.Args[0] 11805 v.reset(OpSelect0) 11806 v.Type = typ.UInt64 11807 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 11808 v0.AuxInt = int64ToAuxInt(1) 11809 v0.AddArg(z) 11810 v.AddArg(v0) 11811 return true 11812 } 11813 // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z)))) 11814 // result: (SETBCR [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z ))) 11815 for { 11816 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 { 11817 break 11818 } 11819 v_0_0 := v_0.Args[0] 11820 if v_0_0.Op != OpSelect0 { 11821 break 11822 } 11823 v_0_0_0 := v_0_0.Args[0] 11824 if v_0_0_0.Op != OpPPC64ANDCCconst { 11825 break 11826 } 11827 n := auxIntToInt64(v_0_0_0.AuxInt) 11828 z := v_0_0_0.Args[0] 11829 v.reset(OpPPC64SETBCR) 11830 v.AuxInt = int32ToAuxInt(2) 11831 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 11832 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 11833 v1.AuxInt = int64ToAuxInt(n) 11834 v1.AddArg(z) 11835 v0.AddArg(v1) 11836 v.AddArg(v0) 11837 return true 11838 } 11839 // match: (SETBCR [2] (CMPconst [0] a:(AND y z))) 11840 // cond: a.Uses == 1 11841 // result: (SETBCR [2] (Select1 <types.TypeFlags> (ANDCC y z ))) 11842 for { 11843 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 { 11844 break 11845 } 11846 a := v_0.Args[0] 11847 if a.Op != OpPPC64AND { 11848 break 11849 } 11850 z := a.Args[1] 11851 y := a.Args[0] 11852 if !(a.Uses == 1) { 11853 break 11854 } 11855 v.reset(OpPPC64SETBCR) 11856 v.AuxInt = int32ToAuxInt(2) 11857 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 11858 v1 := b.NewValue0(v.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags)) 11859 v1.AddArg2(y, z) 11860 v0.AddArg(v1) 11861 v.AddArg(v0) 11862 return true 11863 } 11864 // match: (SETBCR [2] (CMPconst [0] o:(OR y z))) 11865 // cond: o.Uses == 1 11866 // result: (SETBCR [2] (Select1 <types.TypeFlags> (ORCC y z ))) 11867 for { 11868 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 { 11869 break 11870 } 11871 o := v_0.Args[0] 11872 if o.Op != OpPPC64OR { 11873 break 11874 } 11875 z := o.Args[1] 11876 y := o.Args[0] 11877 if !(o.Uses == 1) { 11878 break 11879 } 11880 v.reset(OpPPC64SETBCR) 11881 v.AuxInt = int32ToAuxInt(2) 11882 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 11883 v1 := b.NewValue0(v.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags)) 11884 v1.AddArg2(y, z) 11885 v0.AddArg(v1) 11886 v.AddArg(v0) 11887 return true 11888 } 11889 // match: (SETBCR [2] (CMPconst [0] a:(XOR y z))) 11890 // cond: a.Uses == 1 11891 // result: (SETBCR [2] (Select1 <types.TypeFlags> (XORCC y z ))) 11892 for { 11893 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 { 11894 break 11895 } 11896 a := v_0.Args[0] 11897 if a.Op != OpPPC64XOR { 11898 break 11899 } 11900 z := a.Args[1] 11901 y := a.Args[0] 11902 if !(a.Uses == 1) { 11903 break 11904 } 11905 v.reset(OpPPC64SETBCR) 11906 v.AuxInt = int32ToAuxInt(2) 11907 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 11908 v1 := b.NewValue0(v.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags)) 11909 v1.AddArg2(y, z) 11910 v0.AddArg(v1) 11911 v.AddArg(v0) 11912 return true 11913 } 11914 return false 11915 } 11916 func rewriteValuePPC64_OpPPC64SLD(v *Value) bool { 11917 v_1 := v.Args[1] 11918 v_0 := v.Args[0] 11919 // match: (SLD x (MOVDconst [c])) 11920 // result: (SLDconst [c&63 | (c>>6&1*63)] x) 11921 for { 11922 x := v_0 11923 if v_1.Op != OpPPC64MOVDconst { 11924 break 11925 } 11926 c := auxIntToInt64(v_1.AuxInt) 11927 v.reset(OpPPC64SLDconst) 11928 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63)) 11929 v.AddArg(x) 11930 return true 11931 } 11932 return false 11933 } 11934 func rewriteValuePPC64_OpPPC64SLDconst(v *Value) bool { 11935 v_0 := v.Args[0] 11936 // match: (SLDconst [l] (SRWconst [r] x)) 11937 // cond: mergePPC64SldiSrw(l,r) != 0 11938 // result: (RLWINM [mergePPC64SldiSrw(l,r)] x) 11939 for { 11940 l := auxIntToInt64(v.AuxInt) 11941 if v_0.Op != OpPPC64SRWconst { 11942 break 11943 } 11944 r := auxIntToInt64(v_0.AuxInt) 11945 x := v_0.Args[0] 11946 if !(mergePPC64SldiSrw(l, r) != 0) { 11947 break 11948 } 11949 v.reset(OpPPC64RLWINM) 11950 v.AuxInt = int64ToAuxInt(mergePPC64SldiSrw(l, r)) 11951 v.AddArg(x) 11952 return true 11953 } 11954 // match: (SLDconst [c] z:(MOVBZreg x)) 11955 // cond: c < 8 && z.Uses == 1 11956 // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,56,63,64)] x) 11957 for { 11958 c := auxIntToInt64(v.AuxInt) 11959 z := v_0 11960 if z.Op != OpPPC64MOVBZreg { 11961 break 11962 } 11963 x := z.Args[0] 11964 if !(c < 8 && z.Uses == 1) { 11965 break 11966 } 11967 v.reset(OpPPC64CLRLSLDI) 11968 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 56, 63, 64)) 11969 v.AddArg(x) 11970 return true 11971 } 11972 // match: (SLDconst [c] z:(MOVHZreg x)) 11973 // cond: c < 16 && z.Uses == 1 11974 // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,48,63,64)] x) 11975 for { 11976 c := auxIntToInt64(v.AuxInt) 11977 z := v_0 11978 if z.Op != OpPPC64MOVHZreg { 11979 break 11980 } 11981 x := z.Args[0] 11982 if !(c < 16 && z.Uses == 1) { 11983 break 11984 } 11985 v.reset(OpPPC64CLRLSLDI) 11986 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 48, 63, 64)) 11987 v.AddArg(x) 11988 return true 11989 } 11990 // match: (SLDconst [c] z:(MOVWZreg x)) 11991 // cond: c < 32 && z.Uses == 1 11992 // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,32,63,64)] x) 11993 for { 11994 c := auxIntToInt64(v.AuxInt) 11995 z := v_0 11996 if z.Op != OpPPC64MOVWZreg { 11997 break 11998 } 11999 x := z.Args[0] 12000 if !(c < 32 && z.Uses == 1) { 12001 break 12002 } 12003 v.reset(OpPPC64CLRLSLDI) 12004 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32, 63, 64)) 12005 v.AddArg(x) 12006 return true 12007 } 12008 // match: (SLDconst [c] z:(Select0 (ANDCCconst [d] x))) 12009 // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d)) 12010 // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x) 12011 for { 12012 c := auxIntToInt64(v.AuxInt) 12013 z := v_0 12014 if z.Op != OpSelect0 { 12015 break 12016 } 12017 z_0 := z.Args[0] 12018 if z_0.Op != OpPPC64ANDCCconst { 12019 break 12020 } 12021 d := auxIntToInt64(z_0.AuxInt) 12022 x := z_0.Args[0] 12023 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) { 12024 break 12025 } 12026 v.reset(OpPPC64CLRLSLDI) 12027 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64)) 12028 v.AddArg(x) 12029 return true 12030 } 12031 // match: (SLDconst [c] z:(AND (MOVDconst [d]) x)) 12032 // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(64-getPPC64ShiftMaskLength(d)) 12033 // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x) 12034 for { 12035 c := auxIntToInt64(v.AuxInt) 12036 z := v_0 12037 if z.Op != OpPPC64AND { 12038 break 12039 } 12040 _ = z.Args[1] 12041 z_0 := z.Args[0] 12042 z_1 := z.Args[1] 12043 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 12044 if z_0.Op != OpPPC64MOVDconst { 12045 continue 12046 } 12047 d := auxIntToInt64(z_0.AuxInt) 12048 x := z_1 12049 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) { 12050 continue 12051 } 12052 v.reset(OpPPC64CLRLSLDI) 12053 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64)) 12054 v.AddArg(x) 12055 return true 12056 } 12057 break 12058 } 12059 // match: (SLDconst [c] z:(MOVWreg x)) 12060 // cond: c < 32 && buildcfg.GOPPC64 >= 9 12061 // result: (EXTSWSLconst [c] x) 12062 for { 12063 c := auxIntToInt64(v.AuxInt) 12064 z := v_0 12065 if z.Op != OpPPC64MOVWreg { 12066 break 12067 } 12068 x := z.Args[0] 12069 if !(c < 32 && buildcfg.GOPPC64 >= 9) { 12070 break 12071 } 12072 v.reset(OpPPC64EXTSWSLconst) 12073 v.AuxInt = int64ToAuxInt(c) 12074 v.AddArg(x) 12075 return true 12076 } 12077 return false 12078 } 12079 func rewriteValuePPC64_OpPPC64SLW(v *Value) bool { 12080 v_1 := v.Args[1] 12081 v_0 := v.Args[0] 12082 // match: (SLW x (MOVDconst [c])) 12083 // result: (SLWconst [c&31 | (c>>5&1*31)] x) 12084 for { 12085 x := v_0 12086 if v_1.Op != OpPPC64MOVDconst { 12087 break 12088 } 12089 c := auxIntToInt64(v_1.AuxInt) 12090 v.reset(OpPPC64SLWconst) 12091 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31)) 12092 v.AddArg(x) 12093 return true 12094 } 12095 return false 12096 } 12097 func rewriteValuePPC64_OpPPC64SLWconst(v *Value) bool { 12098 v_0 := v.Args[0] 12099 // match: (SLWconst [c] z:(MOVBZreg x)) 12100 // cond: z.Uses == 1 && c < 8 12101 // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,24,31,32)] x) 12102 for { 12103 c := auxIntToInt64(v.AuxInt) 12104 z := v_0 12105 if z.Op != OpPPC64MOVBZreg { 12106 break 12107 } 12108 x := z.Args[0] 12109 if !(z.Uses == 1 && c < 8) { 12110 break 12111 } 12112 v.reset(OpPPC64CLRLSLWI) 12113 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 24, 31, 32)) 12114 v.AddArg(x) 12115 return true 12116 } 12117 // match: (SLWconst [c] z:(MOVHZreg x)) 12118 // cond: z.Uses == 1 && c < 16 12119 // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,16,31,32)] x) 12120 for { 12121 c := auxIntToInt64(v.AuxInt) 12122 z := v_0 12123 if z.Op != OpPPC64MOVHZreg { 12124 break 12125 } 12126 x := z.Args[0] 12127 if !(z.Uses == 1 && c < 16) { 12128 break 12129 } 12130 v.reset(OpPPC64CLRLSLWI) 12131 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 16, 31, 32)) 12132 v.AddArg(x) 12133 return true 12134 } 12135 // match: (SLWconst [c] z:(Select0 (ANDCCconst [d] x))) 12136 // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d)) 12137 // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x) 12138 for { 12139 c := auxIntToInt64(v.AuxInt) 12140 z := v_0 12141 if z.Op != OpSelect0 { 12142 break 12143 } 12144 z_0 := z.Args[0] 12145 if z_0.Op != OpPPC64ANDCCconst { 12146 break 12147 } 12148 d := auxIntToInt64(z_0.AuxInt) 12149 x := z_0.Args[0] 12150 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) { 12151 break 12152 } 12153 v.reset(OpPPC64CLRLSLWI) 12154 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32)) 12155 v.AddArg(x) 12156 return true 12157 } 12158 // match: (SLWconst [c] z:(AND (MOVDconst [d]) x)) 12159 // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d)) 12160 // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x) 12161 for { 12162 c := auxIntToInt64(v.AuxInt) 12163 z := v_0 12164 if z.Op != OpPPC64AND { 12165 break 12166 } 12167 _ = z.Args[1] 12168 z_0 := z.Args[0] 12169 z_1 := z.Args[1] 12170 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 12171 if z_0.Op != OpPPC64MOVDconst { 12172 continue 12173 } 12174 d := auxIntToInt64(z_0.AuxInt) 12175 x := z_1 12176 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) { 12177 continue 12178 } 12179 v.reset(OpPPC64CLRLSLWI) 12180 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32)) 12181 v.AddArg(x) 12182 return true 12183 } 12184 break 12185 } 12186 // match: (SLWconst [c] z:(MOVWreg x)) 12187 // cond: c < 32 && buildcfg.GOPPC64 >= 9 12188 // result: (EXTSWSLconst [c] x) 12189 for { 12190 c := auxIntToInt64(v.AuxInt) 12191 z := v_0 12192 if z.Op != OpPPC64MOVWreg { 12193 break 12194 } 12195 x := z.Args[0] 12196 if !(c < 32 && buildcfg.GOPPC64 >= 9) { 12197 break 12198 } 12199 v.reset(OpPPC64EXTSWSLconst) 12200 v.AuxInt = int64ToAuxInt(c) 12201 v.AddArg(x) 12202 return true 12203 } 12204 return false 12205 } 12206 func rewriteValuePPC64_OpPPC64SRAD(v *Value) bool { 12207 v_1 := v.Args[1] 12208 v_0 := v.Args[0] 12209 // match: (SRAD x (MOVDconst [c])) 12210 // result: (SRADconst [c&63 | (c>>6&1*63)] x) 12211 for { 12212 x := v_0 12213 if v_1.Op != OpPPC64MOVDconst { 12214 break 12215 } 12216 c := auxIntToInt64(v_1.AuxInt) 12217 v.reset(OpPPC64SRADconst) 12218 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63)) 12219 v.AddArg(x) 12220 return true 12221 } 12222 return false 12223 } 12224 func rewriteValuePPC64_OpPPC64SRAW(v *Value) bool { 12225 v_1 := v.Args[1] 12226 v_0 := v.Args[0] 12227 // match: (SRAW x (MOVDconst [c])) 12228 // result: (SRAWconst [c&31 | (c>>5&1*31)] x) 12229 for { 12230 x := v_0 12231 if v_1.Op != OpPPC64MOVDconst { 12232 break 12233 } 12234 c := auxIntToInt64(v_1.AuxInt) 12235 v.reset(OpPPC64SRAWconst) 12236 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31)) 12237 v.AddArg(x) 12238 return true 12239 } 12240 return false 12241 } 12242 func rewriteValuePPC64_OpPPC64SRD(v *Value) bool { 12243 v_1 := v.Args[1] 12244 v_0 := v.Args[0] 12245 // match: (SRD x (MOVDconst [c])) 12246 // result: (SRDconst [c&63 | (c>>6&1*63)] x) 12247 for { 12248 x := v_0 12249 if v_1.Op != OpPPC64MOVDconst { 12250 break 12251 } 12252 c := auxIntToInt64(v_1.AuxInt) 12253 v.reset(OpPPC64SRDconst) 12254 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63)) 12255 v.AddArg(x) 12256 return true 12257 } 12258 return false 12259 } 12260 func rewriteValuePPC64_OpPPC64SRW(v *Value) bool { 12261 v_1 := v.Args[1] 12262 v_0 := v.Args[0] 12263 // match: (SRW x (MOVDconst [c])) 12264 // result: (SRWconst [c&31 | (c>>5&1*31)] x) 12265 for { 12266 x := v_0 12267 if v_1.Op != OpPPC64MOVDconst { 12268 break 12269 } 12270 c := auxIntToInt64(v_1.AuxInt) 12271 v.reset(OpPPC64SRWconst) 12272 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31)) 12273 v.AddArg(x) 12274 return true 12275 } 12276 return false 12277 } 12278 func rewriteValuePPC64_OpPPC64SRWconst(v *Value) bool { 12279 v_0 := v.Args[0] 12280 // match: (SRWconst (Select0 (ANDCCconst [m] x)) [s]) 12281 // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0 12282 // result: (MOVDconst [0]) 12283 for { 12284 s := auxIntToInt64(v.AuxInt) 12285 if v_0.Op != OpSelect0 { 12286 break 12287 } 12288 v_0_0 := v_0.Args[0] 12289 if v_0_0.Op != OpPPC64ANDCCconst { 12290 break 12291 } 12292 m := auxIntToInt64(v_0_0.AuxInt) 12293 if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) { 12294 break 12295 } 12296 v.reset(OpPPC64MOVDconst) 12297 v.AuxInt = int64ToAuxInt(0) 12298 return true 12299 } 12300 // match: (SRWconst (Select0 (ANDCCconst [m] x)) [s]) 12301 // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0 12302 // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x) 12303 for { 12304 s := auxIntToInt64(v.AuxInt) 12305 if v_0.Op != OpSelect0 { 12306 break 12307 } 12308 v_0_0 := v_0.Args[0] 12309 if v_0_0.Op != OpPPC64ANDCCconst { 12310 break 12311 } 12312 m := auxIntToInt64(v_0_0.AuxInt) 12313 x := v_0_0.Args[0] 12314 if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) { 12315 break 12316 } 12317 v.reset(OpPPC64RLWINM) 12318 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s)) 12319 v.AddArg(x) 12320 return true 12321 } 12322 // match: (SRWconst (AND (MOVDconst [m]) x) [s]) 12323 // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0 12324 // result: (MOVDconst [0]) 12325 for { 12326 s := auxIntToInt64(v.AuxInt) 12327 if v_0.Op != OpPPC64AND { 12328 break 12329 } 12330 _ = v_0.Args[1] 12331 v_0_0 := v_0.Args[0] 12332 v_0_1 := v_0.Args[1] 12333 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 12334 if v_0_0.Op != OpPPC64MOVDconst { 12335 continue 12336 } 12337 m := auxIntToInt64(v_0_0.AuxInt) 12338 if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) { 12339 continue 12340 } 12341 v.reset(OpPPC64MOVDconst) 12342 v.AuxInt = int64ToAuxInt(0) 12343 return true 12344 } 12345 break 12346 } 12347 // match: (SRWconst (AND (MOVDconst [m]) x) [s]) 12348 // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0 12349 // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x) 12350 for { 12351 s := auxIntToInt64(v.AuxInt) 12352 if v_0.Op != OpPPC64AND { 12353 break 12354 } 12355 _ = v_0.Args[1] 12356 v_0_0 := v_0.Args[0] 12357 v_0_1 := v_0.Args[1] 12358 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { 12359 if v_0_0.Op != OpPPC64MOVDconst { 12360 continue 12361 } 12362 m := auxIntToInt64(v_0_0.AuxInt) 12363 x := v_0_1 12364 if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) { 12365 continue 12366 } 12367 v.reset(OpPPC64RLWINM) 12368 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s)) 12369 v.AddArg(x) 12370 return true 12371 } 12372 break 12373 } 12374 return false 12375 } 12376 func rewriteValuePPC64_OpPPC64SUB(v *Value) bool { 12377 v_1 := v.Args[1] 12378 v_0 := v.Args[0] 12379 // match: (SUB x (MOVDconst [c])) 12380 // cond: is32Bit(-c) 12381 // result: (ADDconst [-c] x) 12382 for { 12383 x := v_0 12384 if v_1.Op != OpPPC64MOVDconst { 12385 break 12386 } 12387 c := auxIntToInt64(v_1.AuxInt) 12388 if !(is32Bit(-c)) { 12389 break 12390 } 12391 v.reset(OpPPC64ADDconst) 12392 v.AuxInt = int64ToAuxInt(-c) 12393 v.AddArg(x) 12394 return true 12395 } 12396 // match: (SUB (MOVDconst [c]) x) 12397 // cond: is32Bit(c) 12398 // result: (SUBFCconst [c] x) 12399 for { 12400 if v_0.Op != OpPPC64MOVDconst { 12401 break 12402 } 12403 c := auxIntToInt64(v_0.AuxInt) 12404 x := v_1 12405 if !(is32Bit(c)) { 12406 break 12407 } 12408 v.reset(OpPPC64SUBFCconst) 12409 v.AuxInt = int64ToAuxInt(c) 12410 v.AddArg(x) 12411 return true 12412 } 12413 return false 12414 } 12415 func rewriteValuePPC64_OpPPC64SUBE(v *Value) bool { 12416 v_2 := v.Args[2] 12417 v_1 := v.Args[1] 12418 v_0 := v.Args[0] 12419 b := v.Block 12420 typ := &b.Func.Config.Types 12421 // match: (SUBE x y (Select1 <typ.UInt64> (SUBCconst (MOVDconst [0]) [0]))) 12422 // result: (SUBC x y) 12423 for { 12424 x := v_0 12425 y := v_1 12426 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 { 12427 break 12428 } 12429 v_2_0 := v_2.Args[0] 12430 if v_2_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_2_0.AuxInt) != 0 { 12431 break 12432 } 12433 v_2_0_0 := v_2_0.Args[0] 12434 if v_2_0_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 { 12435 break 12436 } 12437 v.reset(OpPPC64SUBC) 12438 v.AddArg2(x, y) 12439 return true 12440 } 12441 return false 12442 } 12443 func rewriteValuePPC64_OpPPC64SUBFCconst(v *Value) bool { 12444 v_0 := v.Args[0] 12445 // match: (SUBFCconst [c] (NEG x)) 12446 // result: (ADDconst [c] x) 12447 for { 12448 c := auxIntToInt64(v.AuxInt) 12449 if v_0.Op != OpPPC64NEG { 12450 break 12451 } 12452 x := v_0.Args[0] 12453 v.reset(OpPPC64ADDconst) 12454 v.AuxInt = int64ToAuxInt(c) 12455 v.AddArg(x) 12456 return true 12457 } 12458 // match: (SUBFCconst [c] (SUBFCconst [d] x)) 12459 // cond: is32Bit(c-d) 12460 // result: (ADDconst [c-d] x) 12461 for { 12462 c := auxIntToInt64(v.AuxInt) 12463 if v_0.Op != OpPPC64SUBFCconst { 12464 break 12465 } 12466 d := auxIntToInt64(v_0.AuxInt) 12467 x := v_0.Args[0] 12468 if !(is32Bit(c - d)) { 12469 break 12470 } 12471 v.reset(OpPPC64ADDconst) 12472 v.AuxInt = int64ToAuxInt(c - d) 12473 v.AddArg(x) 12474 return true 12475 } 12476 // match: (SUBFCconst [0] x) 12477 // result: (NEG x) 12478 for { 12479 if auxIntToInt64(v.AuxInt) != 0 { 12480 break 12481 } 12482 x := v_0 12483 v.reset(OpPPC64NEG) 12484 v.AddArg(x) 12485 return true 12486 } 12487 return false 12488 } 12489 func rewriteValuePPC64_OpPPC64XOR(v *Value) bool { 12490 v_1 := v.Args[1] 12491 v_0 := v.Args[0] 12492 // match: (XOR (MOVDconst [c]) (MOVDconst [d])) 12493 // result: (MOVDconst [c^d]) 12494 for { 12495 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12496 if v_0.Op != OpPPC64MOVDconst { 12497 continue 12498 } 12499 c := auxIntToInt64(v_0.AuxInt) 12500 if v_1.Op != OpPPC64MOVDconst { 12501 continue 12502 } 12503 d := auxIntToInt64(v_1.AuxInt) 12504 v.reset(OpPPC64MOVDconst) 12505 v.AuxInt = int64ToAuxInt(c ^ d) 12506 return true 12507 } 12508 break 12509 } 12510 // match: (XOR x (MOVDconst [c])) 12511 // cond: isU32Bit(c) 12512 // result: (XORconst [c] x) 12513 for { 12514 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { 12515 x := v_0 12516 if v_1.Op != OpPPC64MOVDconst { 12517 continue 12518 } 12519 c := auxIntToInt64(v_1.AuxInt) 12520 if !(isU32Bit(c)) { 12521 continue 12522 } 12523 v.reset(OpPPC64XORconst) 12524 v.AuxInt = int64ToAuxInt(c) 12525 v.AddArg(x) 12526 return true 12527 } 12528 break 12529 } 12530 return false 12531 } 12532 func rewriteValuePPC64_OpPPC64XORconst(v *Value) bool { 12533 v_0 := v.Args[0] 12534 // match: (XORconst [c] (XORconst [d] x)) 12535 // result: (XORconst [c^d] x) 12536 for { 12537 c := auxIntToInt64(v.AuxInt) 12538 if v_0.Op != OpPPC64XORconst { 12539 break 12540 } 12541 d := auxIntToInt64(v_0.AuxInt) 12542 x := v_0.Args[0] 12543 v.reset(OpPPC64XORconst) 12544 v.AuxInt = int64ToAuxInt(c ^ d) 12545 v.AddArg(x) 12546 return true 12547 } 12548 // match: (XORconst [0] x) 12549 // result: x 12550 for { 12551 if auxIntToInt64(v.AuxInt) != 0 { 12552 break 12553 } 12554 x := v_0 12555 v.copyOf(x) 12556 return true 12557 } 12558 // match: (XORconst [1] (SETBCR [n] cmp)) 12559 // result: (SETBC [n] cmp) 12560 for { 12561 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBCR { 12562 break 12563 } 12564 n := auxIntToInt32(v_0.AuxInt) 12565 cmp := v_0.Args[0] 12566 v.reset(OpPPC64SETBC) 12567 v.AuxInt = int32ToAuxInt(n) 12568 v.AddArg(cmp) 12569 return true 12570 } 12571 // match: (XORconst [1] (SETBC [n] cmp)) 12572 // result: (SETBCR [n] cmp) 12573 for { 12574 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBC { 12575 break 12576 } 12577 n := auxIntToInt32(v_0.AuxInt) 12578 cmp := v_0.Args[0] 12579 v.reset(OpPPC64SETBCR) 12580 v.AuxInt = int32ToAuxInt(n) 12581 v.AddArg(cmp) 12582 return true 12583 } 12584 return false 12585 } 12586 func rewriteValuePPC64_OpPanicBounds(v *Value) bool { 12587 v_2 := v.Args[2] 12588 v_1 := v.Args[1] 12589 v_0 := v.Args[0] 12590 // match: (PanicBounds [kind] x y mem) 12591 // cond: boundsABI(kind) == 0 12592 // result: (LoweredPanicBoundsA [kind] x y mem) 12593 for { 12594 kind := auxIntToInt64(v.AuxInt) 12595 x := v_0 12596 y := v_1 12597 mem := v_2 12598 if !(boundsABI(kind) == 0) { 12599 break 12600 } 12601 v.reset(OpPPC64LoweredPanicBoundsA) 12602 v.AuxInt = int64ToAuxInt(kind) 12603 v.AddArg3(x, y, mem) 12604 return true 12605 } 12606 // match: (PanicBounds [kind] x y mem) 12607 // cond: boundsABI(kind) == 1 12608 // result: (LoweredPanicBoundsB [kind] x y mem) 12609 for { 12610 kind := auxIntToInt64(v.AuxInt) 12611 x := v_0 12612 y := v_1 12613 mem := v_2 12614 if !(boundsABI(kind) == 1) { 12615 break 12616 } 12617 v.reset(OpPPC64LoweredPanicBoundsB) 12618 v.AuxInt = int64ToAuxInt(kind) 12619 v.AddArg3(x, y, mem) 12620 return true 12621 } 12622 // match: (PanicBounds [kind] x y mem) 12623 // cond: boundsABI(kind) == 2 12624 // result: (LoweredPanicBoundsC [kind] x y mem) 12625 for { 12626 kind := auxIntToInt64(v.AuxInt) 12627 x := v_0 12628 y := v_1 12629 mem := v_2 12630 if !(boundsABI(kind) == 2) { 12631 break 12632 } 12633 v.reset(OpPPC64LoweredPanicBoundsC) 12634 v.AuxInt = int64ToAuxInt(kind) 12635 v.AddArg3(x, y, mem) 12636 return true 12637 } 12638 return false 12639 } 12640 func rewriteValuePPC64_OpPopCount16(v *Value) bool { 12641 v_0 := v.Args[0] 12642 b := v.Block 12643 typ := &b.Func.Config.Types 12644 // match: (PopCount16 x) 12645 // result: (POPCNTW (MOVHZreg x)) 12646 for { 12647 x := v_0 12648 v.reset(OpPPC64POPCNTW) 12649 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 12650 v0.AddArg(x) 12651 v.AddArg(v0) 12652 return true 12653 } 12654 } 12655 func rewriteValuePPC64_OpPopCount32(v *Value) bool { 12656 v_0 := v.Args[0] 12657 b := v.Block 12658 typ := &b.Func.Config.Types 12659 // match: (PopCount32 x) 12660 // result: (POPCNTW (MOVWZreg x)) 12661 for { 12662 x := v_0 12663 v.reset(OpPPC64POPCNTW) 12664 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64) 12665 v0.AddArg(x) 12666 v.AddArg(v0) 12667 return true 12668 } 12669 } 12670 func rewriteValuePPC64_OpPopCount8(v *Value) bool { 12671 v_0 := v.Args[0] 12672 b := v.Block 12673 typ := &b.Func.Config.Types 12674 // match: (PopCount8 x) 12675 // result: (POPCNTB (MOVBZreg x)) 12676 for { 12677 x := v_0 12678 v.reset(OpPPC64POPCNTB) 12679 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 12680 v0.AddArg(x) 12681 v.AddArg(v0) 12682 return true 12683 } 12684 } 12685 func rewriteValuePPC64_OpPrefetchCache(v *Value) bool { 12686 v_1 := v.Args[1] 12687 v_0 := v.Args[0] 12688 // match: (PrefetchCache ptr mem) 12689 // result: (DCBT ptr mem [0]) 12690 for { 12691 ptr := v_0 12692 mem := v_1 12693 v.reset(OpPPC64DCBT) 12694 v.AuxInt = int64ToAuxInt(0) 12695 v.AddArg2(ptr, mem) 12696 return true 12697 } 12698 } 12699 func rewriteValuePPC64_OpPrefetchCacheStreamed(v *Value) bool { 12700 v_1 := v.Args[1] 12701 v_0 := v.Args[0] 12702 // match: (PrefetchCacheStreamed ptr mem) 12703 // result: (DCBT ptr mem [16]) 12704 for { 12705 ptr := v_0 12706 mem := v_1 12707 v.reset(OpPPC64DCBT) 12708 v.AuxInt = int64ToAuxInt(16) 12709 v.AddArg2(ptr, mem) 12710 return true 12711 } 12712 } 12713 func rewriteValuePPC64_OpRotateLeft16(v *Value) bool { 12714 v_1 := v.Args[1] 12715 v_0 := v.Args[0] 12716 b := v.Block 12717 typ := &b.Func.Config.Types 12718 // match: (RotateLeft16 <t> x (MOVDconst [c])) 12719 // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15]))) 12720 for { 12721 t := v.Type 12722 x := v_0 12723 if v_1.Op != OpPPC64MOVDconst { 12724 break 12725 } 12726 c := auxIntToInt64(v_1.AuxInt) 12727 v.reset(OpOr16) 12728 v0 := b.NewValue0(v.Pos, OpLsh16x64, t) 12729 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 12730 v1.AuxInt = int64ToAuxInt(c & 15) 12731 v0.AddArg2(x, v1) 12732 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t) 12733 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 12734 v3.AuxInt = int64ToAuxInt(-c & 15) 12735 v2.AddArg2(x, v3) 12736 v.AddArg2(v0, v2) 12737 return true 12738 } 12739 return false 12740 } 12741 func rewriteValuePPC64_OpRotateLeft8(v *Value) bool { 12742 v_1 := v.Args[1] 12743 v_0 := v.Args[0] 12744 b := v.Block 12745 typ := &b.Func.Config.Types 12746 // match: (RotateLeft8 <t> x (MOVDconst [c])) 12747 // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7]))) 12748 for { 12749 t := v.Type 12750 x := v_0 12751 if v_1.Op != OpPPC64MOVDconst { 12752 break 12753 } 12754 c := auxIntToInt64(v_1.AuxInt) 12755 v.reset(OpOr8) 12756 v0 := b.NewValue0(v.Pos, OpLsh8x64, t) 12757 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 12758 v1.AuxInt = int64ToAuxInt(c & 7) 12759 v0.AddArg2(x, v1) 12760 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t) 12761 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 12762 v3.AuxInt = int64ToAuxInt(-c & 7) 12763 v2.AddArg2(x, v3) 12764 v.AddArg2(v0, v2) 12765 return true 12766 } 12767 return false 12768 } 12769 func rewriteValuePPC64_OpRsh16Ux16(v *Value) bool { 12770 v_1 := v.Args[1] 12771 v_0 := v.Args[0] 12772 b := v.Block 12773 typ := &b.Func.Config.Types 12774 // match: (Rsh16Ux16 x y) 12775 // cond: shiftIsBounded(v) 12776 // result: (SRD (MOVHZreg x) y) 12777 for { 12778 x := v_0 12779 y := v_1 12780 if !(shiftIsBounded(v)) { 12781 break 12782 } 12783 v.reset(OpPPC64SRD) 12784 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 12785 v0.AddArg(x) 12786 v.AddArg2(v0, y) 12787 return true 12788 } 12789 // match: (Rsh16Ux16 <t> x y) 12790 // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y))) 12791 for { 12792 t := v.Type 12793 x := v_0 12794 y := v_1 12795 v.reset(OpPPC64ISEL) 12796 v.AuxInt = int32ToAuxInt(2) 12797 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 12798 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 12799 v1.AddArg(x) 12800 v0.AddArg2(v1, y) 12801 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 12802 v2.AuxInt = int64ToAuxInt(0) 12803 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 12804 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 12805 v4.AuxInt = int64ToAuxInt(0xFFF0) 12806 v4.AddArg(y) 12807 v3.AddArg(v4) 12808 v.AddArg3(v0, v2, v3) 12809 return true 12810 } 12811 } 12812 func rewriteValuePPC64_OpRsh16Ux32(v *Value) bool { 12813 v_1 := v.Args[1] 12814 v_0 := v.Args[0] 12815 b := v.Block 12816 typ := &b.Func.Config.Types 12817 // match: (Rsh16Ux32 x y) 12818 // cond: shiftIsBounded(v) 12819 // result: (SRD (MOVHZreg x) y) 12820 for { 12821 x := v_0 12822 y := v_1 12823 if !(shiftIsBounded(v)) { 12824 break 12825 } 12826 v.reset(OpPPC64SRD) 12827 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 12828 v0.AddArg(x) 12829 v.AddArg2(v0, y) 12830 return true 12831 } 12832 // match: (Rsh16Ux32 <t> x y) 12833 // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16])) 12834 for { 12835 t := v.Type 12836 x := v_0 12837 y := v_1 12838 v.reset(OpPPC64ISEL) 12839 v.AuxInt = int32ToAuxInt(0) 12840 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 12841 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 12842 v1.AddArg(x) 12843 v0.AddArg2(v1, y) 12844 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 12845 v2.AuxInt = int64ToAuxInt(0) 12846 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 12847 v3.AuxInt = int32ToAuxInt(16) 12848 v3.AddArg(y) 12849 v.AddArg3(v0, v2, v3) 12850 return true 12851 } 12852 } 12853 func rewriteValuePPC64_OpRsh16Ux64(v *Value) bool { 12854 v_1 := v.Args[1] 12855 v_0 := v.Args[0] 12856 b := v.Block 12857 typ := &b.Func.Config.Types 12858 // match: (Rsh16Ux64 x (MOVDconst [c])) 12859 // cond: uint64(c) < 16 12860 // result: (SRWconst (ZeroExt16to32 x) [c]) 12861 for { 12862 x := v_0 12863 if v_1.Op != OpPPC64MOVDconst { 12864 break 12865 } 12866 c := auxIntToInt64(v_1.AuxInt) 12867 if !(uint64(c) < 16) { 12868 break 12869 } 12870 v.reset(OpPPC64SRWconst) 12871 v.AuxInt = int64ToAuxInt(c) 12872 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 12873 v0.AddArg(x) 12874 v.AddArg(v0) 12875 return true 12876 } 12877 // match: (Rsh16Ux64 x y) 12878 // cond: shiftIsBounded(v) 12879 // result: (SRD (MOVHZreg x) y) 12880 for { 12881 x := v_0 12882 y := v_1 12883 if !(shiftIsBounded(v)) { 12884 break 12885 } 12886 v.reset(OpPPC64SRD) 12887 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 12888 v0.AddArg(x) 12889 v.AddArg2(v0, y) 12890 return true 12891 } 12892 // match: (Rsh16Ux64 <t> x y) 12893 // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16])) 12894 for { 12895 t := v.Type 12896 x := v_0 12897 y := v_1 12898 v.reset(OpPPC64ISEL) 12899 v.AuxInt = int32ToAuxInt(0) 12900 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 12901 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 12902 v1.AddArg(x) 12903 v0.AddArg2(v1, y) 12904 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 12905 v2.AuxInt = int64ToAuxInt(0) 12906 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 12907 v3.AuxInt = int64ToAuxInt(16) 12908 v3.AddArg(y) 12909 v.AddArg3(v0, v2, v3) 12910 return true 12911 } 12912 } 12913 func rewriteValuePPC64_OpRsh16Ux8(v *Value) bool { 12914 v_1 := v.Args[1] 12915 v_0 := v.Args[0] 12916 b := v.Block 12917 typ := &b.Func.Config.Types 12918 // match: (Rsh16Ux8 x y) 12919 // cond: shiftIsBounded(v) 12920 // result: (SRD (MOVHZreg x) y) 12921 for { 12922 x := v_0 12923 y := v_1 12924 if !(shiftIsBounded(v)) { 12925 break 12926 } 12927 v.reset(OpPPC64SRD) 12928 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 12929 v0.AddArg(x) 12930 v.AddArg2(v0, y) 12931 return true 12932 } 12933 // match: (Rsh16Ux8 <t> x y) 12934 // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y))) 12935 for { 12936 t := v.Type 12937 x := v_0 12938 y := v_1 12939 v.reset(OpPPC64ISEL) 12940 v.AuxInt = int32ToAuxInt(2) 12941 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 12942 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64) 12943 v1.AddArg(x) 12944 v0.AddArg2(v1, y) 12945 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 12946 v2.AuxInt = int64ToAuxInt(0) 12947 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 12948 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 12949 v4.AuxInt = int64ToAuxInt(0x00F0) 12950 v4.AddArg(y) 12951 v3.AddArg(v4) 12952 v.AddArg3(v0, v2, v3) 12953 return true 12954 } 12955 } 12956 func rewriteValuePPC64_OpRsh16x16(v *Value) bool { 12957 v_1 := v.Args[1] 12958 v_0 := v.Args[0] 12959 b := v.Block 12960 typ := &b.Func.Config.Types 12961 // match: (Rsh16x16 x y) 12962 // cond: shiftIsBounded(v) 12963 // result: (SRAD (MOVHreg x) y) 12964 for { 12965 x := v_0 12966 y := v_1 12967 if !(shiftIsBounded(v)) { 12968 break 12969 } 12970 v.reset(OpPPC64SRAD) 12971 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 12972 v0.AddArg(x) 12973 v.AddArg2(v0, y) 12974 return true 12975 } 12976 // match: (Rsh16x16 <t> x y) 12977 // result: (ISEL [2] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y))) 12978 for { 12979 t := v.Type 12980 x := v_0 12981 y := v_1 12982 v.reset(OpPPC64ISEL) 12983 v.AuxInt = int32ToAuxInt(2) 12984 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 12985 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 12986 v1.AddArg(x) 12987 v0.AddArg2(v1, y) 12988 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 12989 v2.AuxInt = int64ToAuxInt(15) 12990 v2.AddArg(v1) 12991 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 12992 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 12993 v4.AuxInt = int64ToAuxInt(0xFFF0) 12994 v4.AddArg(y) 12995 v3.AddArg(v4) 12996 v.AddArg3(v0, v2, v3) 12997 return true 12998 } 12999 } 13000 func rewriteValuePPC64_OpRsh16x32(v *Value) bool { 13001 v_1 := v.Args[1] 13002 v_0 := v.Args[0] 13003 b := v.Block 13004 typ := &b.Func.Config.Types 13005 // match: (Rsh16x32 x y) 13006 // cond: shiftIsBounded(v) 13007 // result: (SRAD (MOVHreg x) y) 13008 for { 13009 x := v_0 13010 y := v_1 13011 if !(shiftIsBounded(v)) { 13012 break 13013 } 13014 v.reset(OpPPC64SRAD) 13015 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 13016 v0.AddArg(x) 13017 v.AddArg2(v0, y) 13018 return true 13019 } 13020 // match: (Rsh16x32 <t> x y) 13021 // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPWUconst y [16])) 13022 for { 13023 t := v.Type 13024 x := v_0 13025 y := v_1 13026 v.reset(OpPPC64ISEL) 13027 v.AuxInt = int32ToAuxInt(0) 13028 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 13029 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 13030 v1.AddArg(x) 13031 v0.AddArg2(v1, y) 13032 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 13033 v2.AuxInt = int64ToAuxInt(15) 13034 v2.AddArg(v1) 13035 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 13036 v3.AuxInt = int32ToAuxInt(16) 13037 v3.AddArg(y) 13038 v.AddArg3(v0, v2, v3) 13039 return true 13040 } 13041 } 13042 func rewriteValuePPC64_OpRsh16x64(v *Value) bool { 13043 v_1 := v.Args[1] 13044 v_0 := v.Args[0] 13045 b := v.Block 13046 typ := &b.Func.Config.Types 13047 // match: (Rsh16x64 x (MOVDconst [c])) 13048 // cond: uint64(c) >= 16 13049 // result: (SRAWconst (SignExt16to32 x) [63]) 13050 for { 13051 x := v_0 13052 if v_1.Op != OpPPC64MOVDconst { 13053 break 13054 } 13055 c := auxIntToInt64(v_1.AuxInt) 13056 if !(uint64(c) >= 16) { 13057 break 13058 } 13059 v.reset(OpPPC64SRAWconst) 13060 v.AuxInt = int64ToAuxInt(63) 13061 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 13062 v0.AddArg(x) 13063 v.AddArg(v0) 13064 return true 13065 } 13066 // match: (Rsh16x64 x (MOVDconst [c])) 13067 // cond: uint64(c) < 16 13068 // result: (SRAWconst (SignExt16to32 x) [c]) 13069 for { 13070 x := v_0 13071 if v_1.Op != OpPPC64MOVDconst { 13072 break 13073 } 13074 c := auxIntToInt64(v_1.AuxInt) 13075 if !(uint64(c) < 16) { 13076 break 13077 } 13078 v.reset(OpPPC64SRAWconst) 13079 v.AuxInt = int64ToAuxInt(c) 13080 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 13081 v0.AddArg(x) 13082 v.AddArg(v0) 13083 return true 13084 } 13085 // match: (Rsh16x64 x y) 13086 // cond: shiftIsBounded(v) 13087 // result: (SRAD (MOVHreg x) y) 13088 for { 13089 x := v_0 13090 y := v_1 13091 if !(shiftIsBounded(v)) { 13092 break 13093 } 13094 v.reset(OpPPC64SRAD) 13095 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 13096 v0.AddArg(x) 13097 v.AddArg2(v0, y) 13098 return true 13099 } 13100 // match: (Rsh16x64 <t> x y) 13101 // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPUconst y [16])) 13102 for { 13103 t := v.Type 13104 x := v_0 13105 y := v_1 13106 v.reset(OpPPC64ISEL) 13107 v.AuxInt = int32ToAuxInt(0) 13108 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 13109 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 13110 v1.AddArg(x) 13111 v0.AddArg2(v1, y) 13112 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 13113 v2.AuxInt = int64ToAuxInt(15) 13114 v2.AddArg(v1) 13115 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 13116 v3.AuxInt = int64ToAuxInt(16) 13117 v3.AddArg(y) 13118 v.AddArg3(v0, v2, v3) 13119 return true 13120 } 13121 } 13122 func rewriteValuePPC64_OpRsh16x8(v *Value) bool { 13123 v_1 := v.Args[1] 13124 v_0 := v.Args[0] 13125 b := v.Block 13126 typ := &b.Func.Config.Types 13127 // match: (Rsh16x8 x y) 13128 // cond: shiftIsBounded(v) 13129 // result: (SRAD (MOVHreg x) y) 13130 for { 13131 x := v_0 13132 y := v_1 13133 if !(shiftIsBounded(v)) { 13134 break 13135 } 13136 v.reset(OpPPC64SRAD) 13137 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 13138 v0.AddArg(x) 13139 v.AddArg2(v0, y) 13140 return true 13141 } 13142 // match: (Rsh16x8 <t> x y) 13143 // result: (ISEL [2] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y))) 13144 for { 13145 t := v.Type 13146 x := v_0 13147 y := v_1 13148 v.reset(OpPPC64ISEL) 13149 v.AuxInt = int32ToAuxInt(2) 13150 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 13151 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64) 13152 v1.AddArg(x) 13153 v0.AddArg2(v1, y) 13154 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 13155 v2.AuxInt = int64ToAuxInt(15) 13156 v2.AddArg(v1) 13157 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13158 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13159 v4.AuxInt = int64ToAuxInt(0x00F0) 13160 v4.AddArg(y) 13161 v3.AddArg(v4) 13162 v.AddArg3(v0, v2, v3) 13163 return true 13164 } 13165 } 13166 func rewriteValuePPC64_OpRsh32Ux16(v *Value) bool { 13167 v_1 := v.Args[1] 13168 v_0 := v.Args[0] 13169 b := v.Block 13170 typ := &b.Func.Config.Types 13171 // match: (Rsh32Ux16 x y) 13172 // cond: shiftIsBounded(v) 13173 // result: (SRW x y) 13174 for { 13175 x := v_0 13176 y := v_1 13177 if !(shiftIsBounded(v)) { 13178 break 13179 } 13180 v.reset(OpPPC64SRW) 13181 v.AddArg2(x, y) 13182 return true 13183 } 13184 // match: (Rsh32Ux16 <t> x y) 13185 // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y))) 13186 for { 13187 t := v.Type 13188 x := v_0 13189 y := v_1 13190 v.reset(OpPPC64ISEL) 13191 v.AuxInt = int32ToAuxInt(2) 13192 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t) 13193 v0.AddArg2(x, y) 13194 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13195 v1.AuxInt = int64ToAuxInt(0) 13196 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13197 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13198 v3.AuxInt = int64ToAuxInt(0xFFE0) 13199 v3.AddArg(y) 13200 v2.AddArg(v3) 13201 v.AddArg3(v0, v1, v2) 13202 return true 13203 } 13204 } 13205 func rewriteValuePPC64_OpRsh32Ux32(v *Value) bool { 13206 v_1 := v.Args[1] 13207 v_0 := v.Args[0] 13208 b := v.Block 13209 typ := &b.Func.Config.Types 13210 // match: (Rsh32Ux32 x y) 13211 // cond: shiftIsBounded(v) 13212 // result: (SRW x y) 13213 for { 13214 x := v_0 13215 y := v_1 13216 if !(shiftIsBounded(v)) { 13217 break 13218 } 13219 v.reset(OpPPC64SRW) 13220 v.AddArg2(x, y) 13221 return true 13222 } 13223 // match: (Rsh32Ux32 <t> x y) 13224 // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPWUconst y [32])) 13225 for { 13226 t := v.Type 13227 x := v_0 13228 y := v_1 13229 v.reset(OpPPC64ISEL) 13230 v.AuxInt = int32ToAuxInt(0) 13231 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t) 13232 v0.AddArg2(x, y) 13233 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13234 v1.AuxInt = int64ToAuxInt(0) 13235 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 13236 v2.AuxInt = int32ToAuxInt(32) 13237 v2.AddArg(y) 13238 v.AddArg3(v0, v1, v2) 13239 return true 13240 } 13241 } 13242 func rewriteValuePPC64_OpRsh32Ux64(v *Value) bool { 13243 v_1 := v.Args[1] 13244 v_0 := v.Args[0] 13245 b := v.Block 13246 typ := &b.Func.Config.Types 13247 // match: (Rsh32Ux64 x (MOVDconst [c])) 13248 // cond: uint64(c) < 32 13249 // result: (SRWconst x [c]) 13250 for { 13251 x := v_0 13252 if v_1.Op != OpPPC64MOVDconst { 13253 break 13254 } 13255 c := auxIntToInt64(v_1.AuxInt) 13256 if !(uint64(c) < 32) { 13257 break 13258 } 13259 v.reset(OpPPC64SRWconst) 13260 v.AuxInt = int64ToAuxInt(c) 13261 v.AddArg(x) 13262 return true 13263 } 13264 // match: (Rsh32Ux64 x y) 13265 // cond: shiftIsBounded(v) 13266 // result: (SRW x y) 13267 for { 13268 x := v_0 13269 y := v_1 13270 if !(shiftIsBounded(v)) { 13271 break 13272 } 13273 v.reset(OpPPC64SRW) 13274 v.AddArg2(x, y) 13275 return true 13276 } 13277 // match: (Rsh32Ux64 <t> x y) 13278 // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPUconst y [32])) 13279 for { 13280 t := v.Type 13281 x := v_0 13282 y := v_1 13283 v.reset(OpPPC64ISEL) 13284 v.AuxInt = int32ToAuxInt(0) 13285 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t) 13286 v0.AddArg2(x, y) 13287 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13288 v1.AuxInt = int64ToAuxInt(0) 13289 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 13290 v2.AuxInt = int64ToAuxInt(32) 13291 v2.AddArg(y) 13292 v.AddArg3(v0, v1, v2) 13293 return true 13294 } 13295 } 13296 func rewriteValuePPC64_OpRsh32Ux8(v *Value) bool { 13297 v_1 := v.Args[1] 13298 v_0 := v.Args[0] 13299 b := v.Block 13300 typ := &b.Func.Config.Types 13301 // match: (Rsh32Ux8 x y) 13302 // cond: shiftIsBounded(v) 13303 // result: (SRW x y) 13304 for { 13305 x := v_0 13306 y := v_1 13307 if !(shiftIsBounded(v)) { 13308 break 13309 } 13310 v.reset(OpPPC64SRW) 13311 v.AddArg2(x, y) 13312 return true 13313 } 13314 // match: (Rsh32Ux8 <t> x y) 13315 // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y))) 13316 for { 13317 t := v.Type 13318 x := v_0 13319 y := v_1 13320 v.reset(OpPPC64ISEL) 13321 v.AuxInt = int32ToAuxInt(2) 13322 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t) 13323 v0.AddArg2(x, y) 13324 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13325 v1.AuxInt = int64ToAuxInt(0) 13326 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13327 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13328 v3.AuxInt = int64ToAuxInt(0x00E0) 13329 v3.AddArg(y) 13330 v2.AddArg(v3) 13331 v.AddArg3(v0, v1, v2) 13332 return true 13333 } 13334 } 13335 func rewriteValuePPC64_OpRsh32x16(v *Value) bool { 13336 v_1 := v.Args[1] 13337 v_0 := v.Args[0] 13338 b := v.Block 13339 typ := &b.Func.Config.Types 13340 // match: (Rsh32x16 x y) 13341 // cond: shiftIsBounded(v) 13342 // result: (SRAW x y) 13343 for { 13344 x := v_0 13345 y := v_1 13346 if !(shiftIsBounded(v)) { 13347 break 13348 } 13349 v.reset(OpPPC64SRAW) 13350 v.AddArg2(x, y) 13351 return true 13352 } 13353 // match: (Rsh32x16 <t> x y) 13354 // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y))) 13355 for { 13356 t := v.Type 13357 x := v_0 13358 y := v_1 13359 v.reset(OpPPC64ISEL) 13360 v.AuxInt = int32ToAuxInt(2) 13361 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t) 13362 v0.AddArg2(x, y) 13363 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t) 13364 v1.AuxInt = int64ToAuxInt(31) 13365 v1.AddArg(x) 13366 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13367 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13368 v3.AuxInt = int64ToAuxInt(0xFFE0) 13369 v3.AddArg(y) 13370 v2.AddArg(v3) 13371 v.AddArg3(v0, v1, v2) 13372 return true 13373 } 13374 } 13375 func rewriteValuePPC64_OpRsh32x32(v *Value) bool { 13376 v_1 := v.Args[1] 13377 v_0 := v.Args[0] 13378 b := v.Block 13379 // match: (Rsh32x32 x y) 13380 // cond: shiftIsBounded(v) 13381 // result: (SRAW x y) 13382 for { 13383 x := v_0 13384 y := v_1 13385 if !(shiftIsBounded(v)) { 13386 break 13387 } 13388 v.reset(OpPPC64SRAW) 13389 v.AddArg2(x, y) 13390 return true 13391 } 13392 // match: (Rsh32x32 <t> x y) 13393 // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPWUconst y [32])) 13394 for { 13395 t := v.Type 13396 x := v_0 13397 y := v_1 13398 v.reset(OpPPC64ISEL) 13399 v.AuxInt = int32ToAuxInt(0) 13400 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t) 13401 v0.AddArg2(x, y) 13402 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t) 13403 v1.AuxInt = int64ToAuxInt(31) 13404 v1.AddArg(x) 13405 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 13406 v2.AuxInt = int32ToAuxInt(32) 13407 v2.AddArg(y) 13408 v.AddArg3(v0, v1, v2) 13409 return true 13410 } 13411 } 13412 func rewriteValuePPC64_OpRsh32x64(v *Value) bool { 13413 v_1 := v.Args[1] 13414 v_0 := v.Args[0] 13415 b := v.Block 13416 // match: (Rsh32x64 x (MOVDconst [c])) 13417 // cond: uint64(c) >= 32 13418 // result: (SRAWconst x [63]) 13419 for { 13420 x := v_0 13421 if v_1.Op != OpPPC64MOVDconst { 13422 break 13423 } 13424 c := auxIntToInt64(v_1.AuxInt) 13425 if !(uint64(c) >= 32) { 13426 break 13427 } 13428 v.reset(OpPPC64SRAWconst) 13429 v.AuxInt = int64ToAuxInt(63) 13430 v.AddArg(x) 13431 return true 13432 } 13433 // match: (Rsh32x64 x (MOVDconst [c])) 13434 // cond: uint64(c) < 32 13435 // result: (SRAWconst x [c]) 13436 for { 13437 x := v_0 13438 if v_1.Op != OpPPC64MOVDconst { 13439 break 13440 } 13441 c := auxIntToInt64(v_1.AuxInt) 13442 if !(uint64(c) < 32) { 13443 break 13444 } 13445 v.reset(OpPPC64SRAWconst) 13446 v.AuxInt = int64ToAuxInt(c) 13447 v.AddArg(x) 13448 return true 13449 } 13450 // match: (Rsh32x64 x y) 13451 // cond: shiftIsBounded(v) 13452 // result: (SRAW x y) 13453 for { 13454 x := v_0 13455 y := v_1 13456 if !(shiftIsBounded(v)) { 13457 break 13458 } 13459 v.reset(OpPPC64SRAW) 13460 v.AddArg2(x, y) 13461 return true 13462 } 13463 // match: (Rsh32x64 <t> x y) 13464 // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPUconst y [32])) 13465 for { 13466 t := v.Type 13467 x := v_0 13468 y := v_1 13469 v.reset(OpPPC64ISEL) 13470 v.AuxInt = int32ToAuxInt(0) 13471 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t) 13472 v0.AddArg2(x, y) 13473 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t) 13474 v1.AuxInt = int64ToAuxInt(31) 13475 v1.AddArg(x) 13476 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 13477 v2.AuxInt = int64ToAuxInt(32) 13478 v2.AddArg(y) 13479 v.AddArg3(v0, v1, v2) 13480 return true 13481 } 13482 } 13483 func rewriteValuePPC64_OpRsh32x8(v *Value) bool { 13484 v_1 := v.Args[1] 13485 v_0 := v.Args[0] 13486 b := v.Block 13487 typ := &b.Func.Config.Types 13488 // match: (Rsh32x8 x y) 13489 // cond: shiftIsBounded(v) 13490 // result: (SRAW x y) 13491 for { 13492 x := v_0 13493 y := v_1 13494 if !(shiftIsBounded(v)) { 13495 break 13496 } 13497 v.reset(OpPPC64SRAW) 13498 v.AddArg2(x, y) 13499 return true 13500 } 13501 // match: (Rsh32x8 <t> x y) 13502 // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y))) 13503 for { 13504 t := v.Type 13505 x := v_0 13506 y := v_1 13507 v.reset(OpPPC64ISEL) 13508 v.AuxInt = int32ToAuxInt(2) 13509 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t) 13510 v0.AddArg2(x, y) 13511 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t) 13512 v1.AuxInt = int64ToAuxInt(31) 13513 v1.AddArg(x) 13514 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13515 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13516 v3.AuxInt = int64ToAuxInt(0x00E0) 13517 v3.AddArg(y) 13518 v2.AddArg(v3) 13519 v.AddArg3(v0, v1, v2) 13520 return true 13521 } 13522 } 13523 func rewriteValuePPC64_OpRsh64Ux16(v *Value) bool { 13524 v_1 := v.Args[1] 13525 v_0 := v.Args[0] 13526 b := v.Block 13527 typ := &b.Func.Config.Types 13528 // match: (Rsh64Ux16 x y) 13529 // cond: shiftIsBounded(v) 13530 // result: (SRD x y) 13531 for { 13532 x := v_0 13533 y := v_1 13534 if !(shiftIsBounded(v)) { 13535 break 13536 } 13537 v.reset(OpPPC64SRD) 13538 v.AddArg2(x, y) 13539 return true 13540 } 13541 // match: (Rsh64Ux16 <t> x y) 13542 // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y))) 13543 for { 13544 t := v.Type 13545 x := v_0 13546 y := v_1 13547 v.reset(OpPPC64ISEL) 13548 v.AuxInt = int32ToAuxInt(2) 13549 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 13550 v0.AddArg2(x, y) 13551 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13552 v1.AuxInt = int64ToAuxInt(0) 13553 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13554 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13555 v3.AuxInt = int64ToAuxInt(0xFFC0) 13556 v3.AddArg(y) 13557 v2.AddArg(v3) 13558 v.AddArg3(v0, v1, v2) 13559 return true 13560 } 13561 } 13562 func rewriteValuePPC64_OpRsh64Ux32(v *Value) bool { 13563 v_1 := v.Args[1] 13564 v_0 := v.Args[0] 13565 b := v.Block 13566 typ := &b.Func.Config.Types 13567 // match: (Rsh64Ux32 x y) 13568 // cond: shiftIsBounded(v) 13569 // result: (SRD x y) 13570 for { 13571 x := v_0 13572 y := v_1 13573 if !(shiftIsBounded(v)) { 13574 break 13575 } 13576 v.reset(OpPPC64SRD) 13577 v.AddArg2(x, y) 13578 return true 13579 } 13580 // match: (Rsh64Ux32 <t> x y) 13581 // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPWUconst y [64])) 13582 for { 13583 t := v.Type 13584 x := v_0 13585 y := v_1 13586 v.reset(OpPPC64ISEL) 13587 v.AuxInt = int32ToAuxInt(0) 13588 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 13589 v0.AddArg2(x, y) 13590 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13591 v1.AuxInt = int64ToAuxInt(0) 13592 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 13593 v2.AuxInt = int32ToAuxInt(64) 13594 v2.AddArg(y) 13595 v.AddArg3(v0, v1, v2) 13596 return true 13597 } 13598 } 13599 func rewriteValuePPC64_OpRsh64Ux64(v *Value) bool { 13600 v_1 := v.Args[1] 13601 v_0 := v.Args[0] 13602 b := v.Block 13603 typ := &b.Func.Config.Types 13604 // match: (Rsh64Ux64 x (MOVDconst [c])) 13605 // cond: uint64(c) < 64 13606 // result: (SRDconst x [c]) 13607 for { 13608 x := v_0 13609 if v_1.Op != OpPPC64MOVDconst { 13610 break 13611 } 13612 c := auxIntToInt64(v_1.AuxInt) 13613 if !(uint64(c) < 64) { 13614 break 13615 } 13616 v.reset(OpPPC64SRDconst) 13617 v.AuxInt = int64ToAuxInt(c) 13618 v.AddArg(x) 13619 return true 13620 } 13621 // match: (Rsh64Ux64 x y) 13622 // cond: shiftIsBounded(v) 13623 // result: (SRD x y) 13624 for { 13625 x := v_0 13626 y := v_1 13627 if !(shiftIsBounded(v)) { 13628 break 13629 } 13630 v.reset(OpPPC64SRD) 13631 v.AddArg2(x, y) 13632 return true 13633 } 13634 // match: (Rsh64Ux64 <t> x y) 13635 // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPUconst y [64])) 13636 for { 13637 t := v.Type 13638 x := v_0 13639 y := v_1 13640 v.reset(OpPPC64ISEL) 13641 v.AuxInt = int32ToAuxInt(0) 13642 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 13643 v0.AddArg2(x, y) 13644 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13645 v1.AuxInt = int64ToAuxInt(0) 13646 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 13647 v2.AuxInt = int64ToAuxInt(64) 13648 v2.AddArg(y) 13649 v.AddArg3(v0, v1, v2) 13650 return true 13651 } 13652 } 13653 func rewriteValuePPC64_OpRsh64Ux8(v *Value) bool { 13654 v_1 := v.Args[1] 13655 v_0 := v.Args[0] 13656 b := v.Block 13657 typ := &b.Func.Config.Types 13658 // match: (Rsh64Ux8 x y) 13659 // cond: shiftIsBounded(v) 13660 // result: (SRD x y) 13661 for { 13662 x := v_0 13663 y := v_1 13664 if !(shiftIsBounded(v)) { 13665 break 13666 } 13667 v.reset(OpPPC64SRD) 13668 v.AddArg2(x, y) 13669 return true 13670 } 13671 // match: (Rsh64Ux8 <t> x y) 13672 // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y))) 13673 for { 13674 t := v.Type 13675 x := v_0 13676 y := v_1 13677 v.reset(OpPPC64ISEL) 13678 v.AuxInt = int32ToAuxInt(2) 13679 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 13680 v0.AddArg2(x, y) 13681 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13682 v1.AuxInt = int64ToAuxInt(0) 13683 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13684 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13685 v3.AuxInt = int64ToAuxInt(0x00C0) 13686 v3.AddArg(y) 13687 v2.AddArg(v3) 13688 v.AddArg3(v0, v1, v2) 13689 return true 13690 } 13691 } 13692 func rewriteValuePPC64_OpRsh64x16(v *Value) bool { 13693 v_1 := v.Args[1] 13694 v_0 := v.Args[0] 13695 b := v.Block 13696 typ := &b.Func.Config.Types 13697 // match: (Rsh64x16 x y) 13698 // cond: shiftIsBounded(v) 13699 // result: (SRAD x y) 13700 for { 13701 x := v_0 13702 y := v_1 13703 if !(shiftIsBounded(v)) { 13704 break 13705 } 13706 v.reset(OpPPC64SRAD) 13707 v.AddArg2(x, y) 13708 return true 13709 } 13710 // match: (Rsh64x16 <t> x y) 13711 // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y))) 13712 for { 13713 t := v.Type 13714 x := v_0 13715 y := v_1 13716 v.reset(OpPPC64ISEL) 13717 v.AuxInt = int32ToAuxInt(2) 13718 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 13719 v0.AddArg2(x, y) 13720 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 13721 v1.AuxInt = int64ToAuxInt(63) 13722 v1.AddArg(x) 13723 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13724 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13725 v3.AuxInt = int64ToAuxInt(0xFFC0) 13726 v3.AddArg(y) 13727 v2.AddArg(v3) 13728 v.AddArg3(v0, v1, v2) 13729 return true 13730 } 13731 } 13732 func rewriteValuePPC64_OpRsh64x32(v *Value) bool { 13733 v_1 := v.Args[1] 13734 v_0 := v.Args[0] 13735 b := v.Block 13736 // match: (Rsh64x32 x y) 13737 // cond: shiftIsBounded(v) 13738 // result: (SRAD x y) 13739 for { 13740 x := v_0 13741 y := v_1 13742 if !(shiftIsBounded(v)) { 13743 break 13744 } 13745 v.reset(OpPPC64SRAD) 13746 v.AddArg2(x, y) 13747 return true 13748 } 13749 // match: (Rsh64x32 <t> x y) 13750 // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPWUconst y [64])) 13751 for { 13752 t := v.Type 13753 x := v_0 13754 y := v_1 13755 v.reset(OpPPC64ISEL) 13756 v.AuxInt = int32ToAuxInt(0) 13757 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 13758 v0.AddArg2(x, y) 13759 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 13760 v1.AuxInt = int64ToAuxInt(63) 13761 v1.AddArg(x) 13762 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 13763 v2.AuxInt = int32ToAuxInt(64) 13764 v2.AddArg(y) 13765 v.AddArg3(v0, v1, v2) 13766 return true 13767 } 13768 } 13769 func rewriteValuePPC64_OpRsh64x64(v *Value) bool { 13770 v_1 := v.Args[1] 13771 v_0 := v.Args[0] 13772 b := v.Block 13773 // match: (Rsh64x64 x (MOVDconst [c])) 13774 // cond: uint64(c) >= 64 13775 // result: (SRADconst x [63]) 13776 for { 13777 x := v_0 13778 if v_1.Op != OpPPC64MOVDconst { 13779 break 13780 } 13781 c := auxIntToInt64(v_1.AuxInt) 13782 if !(uint64(c) >= 64) { 13783 break 13784 } 13785 v.reset(OpPPC64SRADconst) 13786 v.AuxInt = int64ToAuxInt(63) 13787 v.AddArg(x) 13788 return true 13789 } 13790 // match: (Rsh64x64 x (MOVDconst [c])) 13791 // cond: uint64(c) < 64 13792 // result: (SRADconst x [c]) 13793 for { 13794 x := v_0 13795 if v_1.Op != OpPPC64MOVDconst { 13796 break 13797 } 13798 c := auxIntToInt64(v_1.AuxInt) 13799 if !(uint64(c) < 64) { 13800 break 13801 } 13802 v.reset(OpPPC64SRADconst) 13803 v.AuxInt = int64ToAuxInt(c) 13804 v.AddArg(x) 13805 return true 13806 } 13807 // match: (Rsh64x64 x y) 13808 // cond: shiftIsBounded(v) 13809 // result: (SRAD x y) 13810 for { 13811 x := v_0 13812 y := v_1 13813 if !(shiftIsBounded(v)) { 13814 break 13815 } 13816 v.reset(OpPPC64SRAD) 13817 v.AddArg2(x, y) 13818 return true 13819 } 13820 // match: (Rsh64x64 <t> x y) 13821 // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPUconst y [64])) 13822 for { 13823 t := v.Type 13824 x := v_0 13825 y := v_1 13826 v.reset(OpPPC64ISEL) 13827 v.AuxInt = int32ToAuxInt(0) 13828 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 13829 v0.AddArg2(x, y) 13830 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 13831 v1.AuxInt = int64ToAuxInt(63) 13832 v1.AddArg(x) 13833 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 13834 v2.AuxInt = int64ToAuxInt(64) 13835 v2.AddArg(y) 13836 v.AddArg3(v0, v1, v2) 13837 return true 13838 } 13839 } 13840 func rewriteValuePPC64_OpRsh64x8(v *Value) bool { 13841 v_1 := v.Args[1] 13842 v_0 := v.Args[0] 13843 b := v.Block 13844 typ := &b.Func.Config.Types 13845 // match: (Rsh64x8 x y) 13846 // cond: shiftIsBounded(v) 13847 // result: (SRAD x y) 13848 for { 13849 x := v_0 13850 y := v_1 13851 if !(shiftIsBounded(v)) { 13852 break 13853 } 13854 v.reset(OpPPC64SRAD) 13855 v.AddArg2(x, y) 13856 return true 13857 } 13858 // match: (Rsh64x8 <t> x y) 13859 // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y))) 13860 for { 13861 t := v.Type 13862 x := v_0 13863 y := v_1 13864 v.reset(OpPPC64ISEL) 13865 v.AuxInt = int32ToAuxInt(2) 13866 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 13867 v0.AddArg2(x, y) 13868 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 13869 v1.AuxInt = int64ToAuxInt(63) 13870 v1.AddArg(x) 13871 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13872 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13873 v3.AuxInt = int64ToAuxInt(0x00C0) 13874 v3.AddArg(y) 13875 v2.AddArg(v3) 13876 v.AddArg3(v0, v1, v2) 13877 return true 13878 } 13879 } 13880 func rewriteValuePPC64_OpRsh8Ux16(v *Value) bool { 13881 v_1 := v.Args[1] 13882 v_0 := v.Args[0] 13883 b := v.Block 13884 typ := &b.Func.Config.Types 13885 // match: (Rsh8Ux16 x y) 13886 // cond: shiftIsBounded(v) 13887 // result: (SRD (MOVBZreg x) y) 13888 for { 13889 x := v_0 13890 y := v_1 13891 if !(shiftIsBounded(v)) { 13892 break 13893 } 13894 v.reset(OpPPC64SRD) 13895 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 13896 v0.AddArg(x) 13897 v.AddArg2(v0, y) 13898 return true 13899 } 13900 // match: (Rsh8Ux16 <t> x y) 13901 // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y))) 13902 for { 13903 t := v.Type 13904 x := v_0 13905 y := v_1 13906 v.reset(OpPPC64ISEL) 13907 v.AuxInt = int32ToAuxInt(2) 13908 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 13909 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 13910 v1.AddArg(x) 13911 v0.AddArg2(v1, y) 13912 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13913 v2.AuxInt = int64ToAuxInt(0) 13914 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 13915 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 13916 v4.AuxInt = int64ToAuxInt(0xFFF8) 13917 v4.AddArg(y) 13918 v3.AddArg(v4) 13919 v.AddArg3(v0, v2, v3) 13920 return true 13921 } 13922 } 13923 func rewriteValuePPC64_OpRsh8Ux32(v *Value) bool { 13924 v_1 := v.Args[1] 13925 v_0 := v.Args[0] 13926 b := v.Block 13927 typ := &b.Func.Config.Types 13928 // match: (Rsh8Ux32 x y) 13929 // cond: shiftIsBounded(v) 13930 // result: (SRD (MOVBZreg x) y) 13931 for { 13932 x := v_0 13933 y := v_1 13934 if !(shiftIsBounded(v)) { 13935 break 13936 } 13937 v.reset(OpPPC64SRD) 13938 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 13939 v0.AddArg(x) 13940 v.AddArg2(v0, y) 13941 return true 13942 } 13943 // match: (Rsh8Ux32 <t> x y) 13944 // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8])) 13945 for { 13946 t := v.Type 13947 x := v_0 13948 y := v_1 13949 v.reset(OpPPC64ISEL) 13950 v.AuxInt = int32ToAuxInt(0) 13951 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 13952 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 13953 v1.AddArg(x) 13954 v0.AddArg2(v1, y) 13955 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 13956 v2.AuxInt = int64ToAuxInt(0) 13957 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 13958 v3.AuxInt = int32ToAuxInt(8) 13959 v3.AddArg(y) 13960 v.AddArg3(v0, v2, v3) 13961 return true 13962 } 13963 } 13964 func rewriteValuePPC64_OpRsh8Ux64(v *Value) bool { 13965 v_1 := v.Args[1] 13966 v_0 := v.Args[0] 13967 b := v.Block 13968 typ := &b.Func.Config.Types 13969 // match: (Rsh8Ux64 x (MOVDconst [c])) 13970 // cond: uint64(c) < 8 13971 // result: (SRWconst (ZeroExt8to32 x) [c]) 13972 for { 13973 x := v_0 13974 if v_1.Op != OpPPC64MOVDconst { 13975 break 13976 } 13977 c := auxIntToInt64(v_1.AuxInt) 13978 if !(uint64(c) < 8) { 13979 break 13980 } 13981 v.reset(OpPPC64SRWconst) 13982 v.AuxInt = int64ToAuxInt(c) 13983 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 13984 v0.AddArg(x) 13985 v.AddArg(v0) 13986 return true 13987 } 13988 // match: (Rsh8Ux64 x y) 13989 // cond: shiftIsBounded(v) 13990 // result: (SRD (MOVBZreg x) y) 13991 for { 13992 x := v_0 13993 y := v_1 13994 if !(shiftIsBounded(v)) { 13995 break 13996 } 13997 v.reset(OpPPC64SRD) 13998 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 13999 v0.AddArg(x) 14000 v.AddArg2(v0, y) 14001 return true 14002 } 14003 // match: (Rsh8Ux64 <t> x y) 14004 // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8])) 14005 for { 14006 t := v.Type 14007 x := v_0 14008 y := v_1 14009 v.reset(OpPPC64ISEL) 14010 v.AuxInt = int32ToAuxInt(0) 14011 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 14012 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 14013 v1.AddArg(x) 14014 v0.AddArg2(v1, y) 14015 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 14016 v2.AuxInt = int64ToAuxInt(0) 14017 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 14018 v3.AuxInt = int64ToAuxInt(8) 14019 v3.AddArg(y) 14020 v.AddArg3(v0, v2, v3) 14021 return true 14022 } 14023 } 14024 func rewriteValuePPC64_OpRsh8Ux8(v *Value) bool { 14025 v_1 := v.Args[1] 14026 v_0 := v.Args[0] 14027 b := v.Block 14028 typ := &b.Func.Config.Types 14029 // match: (Rsh8Ux8 x y) 14030 // cond: shiftIsBounded(v) 14031 // result: (SRD (MOVBZreg x) y) 14032 for { 14033 x := v_0 14034 y := v_1 14035 if !(shiftIsBounded(v)) { 14036 break 14037 } 14038 v.reset(OpPPC64SRD) 14039 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 14040 v0.AddArg(x) 14041 v.AddArg2(v0, y) 14042 return true 14043 } 14044 // match: (Rsh8Ux8 <t> x y) 14045 // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y))) 14046 for { 14047 t := v.Type 14048 x := v_0 14049 y := v_1 14050 v.reset(OpPPC64ISEL) 14051 v.AuxInt = int32ToAuxInt(2) 14052 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t) 14053 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64) 14054 v1.AddArg(x) 14055 v0.AddArg2(v1, y) 14056 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64) 14057 v2.AuxInt = int64ToAuxInt(0) 14058 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 14059 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 14060 v4.AuxInt = int64ToAuxInt(0x00F8) 14061 v4.AddArg(y) 14062 v3.AddArg(v4) 14063 v.AddArg3(v0, v2, v3) 14064 return true 14065 } 14066 } 14067 func rewriteValuePPC64_OpRsh8x16(v *Value) bool { 14068 v_1 := v.Args[1] 14069 v_0 := v.Args[0] 14070 b := v.Block 14071 typ := &b.Func.Config.Types 14072 // match: (Rsh8x16 x y) 14073 // cond: shiftIsBounded(v) 14074 // result: (SRAD (MOVBreg x) y) 14075 for { 14076 x := v_0 14077 y := v_1 14078 if !(shiftIsBounded(v)) { 14079 break 14080 } 14081 v.reset(OpPPC64SRAD) 14082 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 14083 v0.AddArg(x) 14084 v.AddArg2(v0, y) 14085 return true 14086 } 14087 // match: (Rsh8x16 <t> x y) 14088 // result: (ISEL [2] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y))) 14089 for { 14090 t := v.Type 14091 x := v_0 14092 y := v_1 14093 v.reset(OpPPC64ISEL) 14094 v.AuxInt = int32ToAuxInt(2) 14095 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 14096 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 14097 v1.AddArg(x) 14098 v0.AddArg2(v1, y) 14099 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 14100 v2.AuxInt = int64ToAuxInt(7) 14101 v2.AddArg(v1) 14102 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 14103 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 14104 v4.AuxInt = int64ToAuxInt(0xFFF8) 14105 v4.AddArg(y) 14106 v3.AddArg(v4) 14107 v.AddArg3(v0, v2, v3) 14108 return true 14109 } 14110 } 14111 func rewriteValuePPC64_OpRsh8x32(v *Value) bool { 14112 v_1 := v.Args[1] 14113 v_0 := v.Args[0] 14114 b := v.Block 14115 typ := &b.Func.Config.Types 14116 // match: (Rsh8x32 x y) 14117 // cond: shiftIsBounded(v) 14118 // result: (SRAD (MOVBreg x) y) 14119 for { 14120 x := v_0 14121 y := v_1 14122 if !(shiftIsBounded(v)) { 14123 break 14124 } 14125 v.reset(OpPPC64SRAD) 14126 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 14127 v0.AddArg(x) 14128 v.AddArg2(v0, y) 14129 return true 14130 } 14131 // match: (Rsh8x32 <t> x y) 14132 // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPWUconst y [8])) 14133 for { 14134 t := v.Type 14135 x := v_0 14136 y := v_1 14137 v.reset(OpPPC64ISEL) 14138 v.AuxInt = int32ToAuxInt(0) 14139 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 14140 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 14141 v1.AddArg(x) 14142 v0.AddArg2(v1, y) 14143 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 14144 v2.AuxInt = int64ToAuxInt(7) 14145 v2.AddArg(v1) 14146 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags) 14147 v3.AuxInt = int32ToAuxInt(8) 14148 v3.AddArg(y) 14149 v.AddArg3(v0, v2, v3) 14150 return true 14151 } 14152 } 14153 func rewriteValuePPC64_OpRsh8x64(v *Value) bool { 14154 v_1 := v.Args[1] 14155 v_0 := v.Args[0] 14156 b := v.Block 14157 typ := &b.Func.Config.Types 14158 // match: (Rsh8x64 x (MOVDconst [c])) 14159 // cond: uint64(c) >= 8 14160 // result: (SRAWconst (SignExt8to32 x) [63]) 14161 for { 14162 x := v_0 14163 if v_1.Op != OpPPC64MOVDconst { 14164 break 14165 } 14166 c := auxIntToInt64(v_1.AuxInt) 14167 if !(uint64(c) >= 8) { 14168 break 14169 } 14170 v.reset(OpPPC64SRAWconst) 14171 v.AuxInt = int64ToAuxInt(63) 14172 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 14173 v0.AddArg(x) 14174 v.AddArg(v0) 14175 return true 14176 } 14177 // match: (Rsh8x64 x (MOVDconst [c])) 14178 // cond: uint64(c) < 8 14179 // result: (SRAWconst (SignExt8to32 x) [c]) 14180 for { 14181 x := v_0 14182 if v_1.Op != OpPPC64MOVDconst { 14183 break 14184 } 14185 c := auxIntToInt64(v_1.AuxInt) 14186 if !(uint64(c) < 8) { 14187 break 14188 } 14189 v.reset(OpPPC64SRAWconst) 14190 v.AuxInt = int64ToAuxInt(c) 14191 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 14192 v0.AddArg(x) 14193 v.AddArg(v0) 14194 return true 14195 } 14196 // match: (Rsh8x64 x y) 14197 // cond: shiftIsBounded(v) 14198 // result: (SRAD (MOVBreg x) y) 14199 for { 14200 x := v_0 14201 y := v_1 14202 if !(shiftIsBounded(v)) { 14203 break 14204 } 14205 v.reset(OpPPC64SRAD) 14206 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 14207 v0.AddArg(x) 14208 v.AddArg2(v0, y) 14209 return true 14210 } 14211 // match: (Rsh8x64 <t> x y) 14212 // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPUconst y [8])) 14213 for { 14214 t := v.Type 14215 x := v_0 14216 y := v_1 14217 v.reset(OpPPC64ISEL) 14218 v.AuxInt = int32ToAuxInt(0) 14219 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 14220 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 14221 v1.AddArg(x) 14222 v0.AddArg2(v1, y) 14223 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 14224 v2.AuxInt = int64ToAuxInt(7) 14225 v2.AddArg(v1) 14226 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags) 14227 v3.AuxInt = int64ToAuxInt(8) 14228 v3.AddArg(y) 14229 v.AddArg3(v0, v2, v3) 14230 return true 14231 } 14232 } 14233 func rewriteValuePPC64_OpRsh8x8(v *Value) bool { 14234 v_1 := v.Args[1] 14235 v_0 := v.Args[0] 14236 b := v.Block 14237 typ := &b.Func.Config.Types 14238 // match: (Rsh8x8 x y) 14239 // cond: shiftIsBounded(v) 14240 // result: (SRAD (MOVBreg x) y) 14241 for { 14242 x := v_0 14243 y := v_1 14244 if !(shiftIsBounded(v)) { 14245 break 14246 } 14247 v.reset(OpPPC64SRAD) 14248 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 14249 v0.AddArg(x) 14250 v.AddArg2(v0, y) 14251 return true 14252 } 14253 // match: (Rsh8x8 <t> x y) 14254 // result: (ISEL [2] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y))) 14255 for { 14256 t := v.Type 14257 x := v_0 14258 y := v_1 14259 v.reset(OpPPC64ISEL) 14260 v.AuxInt = int32ToAuxInt(2) 14261 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t) 14262 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64) 14263 v1.AddArg(x) 14264 v0.AddArg2(v1, y) 14265 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t) 14266 v2.AuxInt = int64ToAuxInt(7) 14267 v2.AddArg(v1) 14268 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags) 14269 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 14270 v4.AuxInt = int64ToAuxInt(0x00F8) 14271 v4.AddArg(y) 14272 v3.AddArg(v4) 14273 v.AddArg3(v0, v2, v3) 14274 return true 14275 } 14276 } 14277 func rewriteValuePPC64_OpSelect0(v *Value) bool { 14278 v_0 := v.Args[0] 14279 b := v.Block 14280 typ := &b.Func.Config.Types 14281 // match: (Select0 (Mul64uhilo x y)) 14282 // result: (MULHDU x y) 14283 for { 14284 if v_0.Op != OpMul64uhilo { 14285 break 14286 } 14287 y := v_0.Args[1] 14288 x := v_0.Args[0] 14289 v.reset(OpPPC64MULHDU) 14290 v.AddArg2(x, y) 14291 return true 14292 } 14293 // match: (Select0 (Add64carry x y c)) 14294 // result: (Select0 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1])))) 14295 for { 14296 if v_0.Op != OpAdd64carry { 14297 break 14298 } 14299 c := v_0.Args[2] 14300 x := v_0.Args[0] 14301 y := v_0.Args[1] 14302 v.reset(OpSelect0) 14303 v.Type = typ.UInt64 14304 v0 := b.NewValue0(v.Pos, OpPPC64ADDE, types.NewTuple(typ.UInt64, typ.UInt64)) 14305 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64) 14306 v2 := b.NewValue0(v.Pos, OpPPC64ADDCconst, types.NewTuple(typ.UInt64, typ.UInt64)) 14307 v2.AuxInt = int64ToAuxInt(-1) 14308 v2.AddArg(c) 14309 v1.AddArg(v2) 14310 v0.AddArg3(x, y, v1) 14311 v.AddArg(v0) 14312 return true 14313 } 14314 // match: (Select0 (Sub64borrow x y c)) 14315 // result: (Select0 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0])))) 14316 for { 14317 if v_0.Op != OpSub64borrow { 14318 break 14319 } 14320 c := v_0.Args[2] 14321 x := v_0.Args[0] 14322 y := v_0.Args[1] 14323 v.reset(OpSelect0) 14324 v.Type = typ.UInt64 14325 v0 := b.NewValue0(v.Pos, OpPPC64SUBE, types.NewTuple(typ.UInt64, typ.UInt64)) 14326 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64) 14327 v2 := b.NewValue0(v.Pos, OpPPC64SUBCconst, types.NewTuple(typ.UInt64, typ.UInt64)) 14328 v2.AuxInt = int64ToAuxInt(0) 14329 v2.AddArg(c) 14330 v1.AddArg(v2) 14331 v0.AddArg3(x, y, v1) 14332 v.AddArg(v0) 14333 return true 14334 } 14335 // match: (Select0 (ANDCCconst [m] (ROTLWconst [r] x))) 14336 // cond: isPPC64WordRotateMask(m) 14337 // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x) 14338 for { 14339 if v_0.Op != OpPPC64ANDCCconst { 14340 break 14341 } 14342 m := auxIntToInt64(v_0.AuxInt) 14343 v_0_0 := v_0.Args[0] 14344 if v_0_0.Op != OpPPC64ROTLWconst { 14345 break 14346 } 14347 r := auxIntToInt64(v_0_0.AuxInt) 14348 x := v_0_0.Args[0] 14349 if !(isPPC64WordRotateMask(m)) { 14350 break 14351 } 14352 v.reset(OpPPC64RLWINM) 14353 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32)) 14354 v.AddArg(x) 14355 return true 14356 } 14357 // match: (Select0 (ANDCCconst [m] (ROTLW x r))) 14358 // cond: isPPC64WordRotateMask(m) 14359 // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r) 14360 for { 14361 if v_0.Op != OpPPC64ANDCCconst { 14362 break 14363 } 14364 m := auxIntToInt64(v_0.AuxInt) 14365 v_0_0 := v_0.Args[0] 14366 if v_0_0.Op != OpPPC64ROTLW { 14367 break 14368 } 14369 r := v_0_0.Args[1] 14370 x := v_0_0.Args[0] 14371 if !(isPPC64WordRotateMask(m)) { 14372 break 14373 } 14374 v.reset(OpPPC64RLWNM) 14375 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32)) 14376 v.AddArg2(x, r) 14377 return true 14378 } 14379 // match: (Select0 (ANDCCconst [m] (SRWconst x [s]))) 14380 // cond: mergePPC64RShiftMask(m,s,32) == 0 14381 // result: (MOVDconst [0]) 14382 for { 14383 if v_0.Op != OpPPC64ANDCCconst { 14384 break 14385 } 14386 m := auxIntToInt64(v_0.AuxInt) 14387 v_0_0 := v_0.Args[0] 14388 if v_0_0.Op != OpPPC64SRWconst { 14389 break 14390 } 14391 s := auxIntToInt64(v_0_0.AuxInt) 14392 if !(mergePPC64RShiftMask(m, s, 32) == 0) { 14393 break 14394 } 14395 v.reset(OpPPC64MOVDconst) 14396 v.AuxInt = int64ToAuxInt(0) 14397 return true 14398 } 14399 // match: (Select0 (ANDCCconst [m] (SRWconst x [s]))) 14400 // cond: mergePPC64AndSrwi(m,s) != 0 14401 // result: (RLWINM [mergePPC64AndSrwi(m,s)] x) 14402 for { 14403 if v_0.Op != OpPPC64ANDCCconst { 14404 break 14405 } 14406 m := auxIntToInt64(v_0.AuxInt) 14407 v_0_0 := v_0.Args[0] 14408 if v_0_0.Op != OpPPC64SRWconst { 14409 break 14410 } 14411 s := auxIntToInt64(v_0_0.AuxInt) 14412 x := v_0_0.Args[0] 14413 if !(mergePPC64AndSrwi(m, s) != 0) { 14414 break 14415 } 14416 v.reset(OpPPC64RLWINM) 14417 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s)) 14418 v.AddArg(x) 14419 return true 14420 } 14421 // match: (Select0 (ANDCCconst [-1] x)) 14422 // result: x 14423 for { 14424 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != -1 { 14425 break 14426 } 14427 x := v_0.Args[0] 14428 v.copyOf(x) 14429 return true 14430 } 14431 // match: (Select0 (ANDCCconst [0] _)) 14432 // result: (MOVDconst [0]) 14433 for { 14434 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 { 14435 break 14436 } 14437 v.reset(OpPPC64MOVDconst) 14438 v.AuxInt = int64ToAuxInt(0) 14439 return true 14440 } 14441 // match: (Select0 (ANDCCconst [c] y:(MOVBZreg _))) 14442 // cond: c&0xFF == 0xFF 14443 // result: y 14444 for { 14445 if v_0.Op != OpPPC64ANDCCconst { 14446 break 14447 } 14448 c := auxIntToInt64(v_0.AuxInt) 14449 y := v_0.Args[0] 14450 if y.Op != OpPPC64MOVBZreg || !(c&0xFF == 0xFF) { 14451 break 14452 } 14453 v.copyOf(y) 14454 return true 14455 } 14456 // match: (Select0 (ANDCCconst [0xFF] (MOVBreg x))) 14457 // result: (MOVBZreg x) 14458 for { 14459 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFF { 14460 break 14461 } 14462 v_0_0 := v_0.Args[0] 14463 if v_0_0.Op != OpPPC64MOVBreg { 14464 break 14465 } 14466 x := v_0_0.Args[0] 14467 v.reset(OpPPC64MOVBZreg) 14468 v.AddArg(x) 14469 return true 14470 } 14471 // match: (Select0 (ANDCCconst [c] y:(MOVHZreg _))) 14472 // cond: c&0xFFFF == 0xFFFF 14473 // result: y 14474 for { 14475 if v_0.Op != OpPPC64ANDCCconst { 14476 break 14477 } 14478 c := auxIntToInt64(v_0.AuxInt) 14479 y := v_0.Args[0] 14480 if y.Op != OpPPC64MOVHZreg || !(c&0xFFFF == 0xFFFF) { 14481 break 14482 } 14483 v.copyOf(y) 14484 return true 14485 } 14486 // match: (Select0 (ANDCCconst [0xFFFF] (MOVHreg x))) 14487 // result: (MOVHZreg x) 14488 for { 14489 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFFFF { 14490 break 14491 } 14492 v_0_0 := v_0.Args[0] 14493 if v_0_0.Op != OpPPC64MOVHreg { 14494 break 14495 } 14496 x := v_0_0.Args[0] 14497 v.reset(OpPPC64MOVHZreg) 14498 v.AddArg(x) 14499 return true 14500 } 14501 // match: (Select0 (ANDCCconst [c] (MOVBZreg x))) 14502 // result: (Select0 (ANDCCconst [c&0xFF] x)) 14503 for { 14504 if v_0.Op != OpPPC64ANDCCconst { 14505 break 14506 } 14507 c := auxIntToInt64(v_0.AuxInt) 14508 v_0_0 := v_0.Args[0] 14509 if v_0_0.Op != OpPPC64MOVBZreg { 14510 break 14511 } 14512 x := v_0_0.Args[0] 14513 v.reset(OpSelect0) 14514 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 14515 v0.AuxInt = int64ToAuxInt(c & 0xFF) 14516 v0.AddArg(x) 14517 v.AddArg(v0) 14518 return true 14519 } 14520 // match: (Select0 (ANDCCconst [c] (MOVHZreg x))) 14521 // result: (Select0 (ANDCCconst [c&0xFFFF] x)) 14522 for { 14523 if v_0.Op != OpPPC64ANDCCconst { 14524 break 14525 } 14526 c := auxIntToInt64(v_0.AuxInt) 14527 v_0_0 := v_0.Args[0] 14528 if v_0_0.Op != OpPPC64MOVHZreg { 14529 break 14530 } 14531 x := v_0_0.Args[0] 14532 v.reset(OpSelect0) 14533 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 14534 v0.AuxInt = int64ToAuxInt(c & 0xFFFF) 14535 v0.AddArg(x) 14536 v.AddArg(v0) 14537 return true 14538 } 14539 // match: (Select0 (ANDCCconst [c] (MOVWZreg x))) 14540 // result: (Select0 (ANDCCconst [c&0xFFFFFFFF] x)) 14541 for { 14542 if v_0.Op != OpPPC64ANDCCconst { 14543 break 14544 } 14545 c := auxIntToInt64(v_0.AuxInt) 14546 v_0_0 := v_0.Args[0] 14547 if v_0_0.Op != OpPPC64MOVWZreg { 14548 break 14549 } 14550 x := v_0_0.Args[0] 14551 v.reset(OpSelect0) 14552 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 14553 v0.AuxInt = int64ToAuxInt(c & 0xFFFFFFFF) 14554 v0.AddArg(x) 14555 v.AddArg(v0) 14556 return true 14557 } 14558 // match: (Select0 (ANDCCconst [1] z:(SRADconst [63] x))) 14559 // cond: z.Uses == 1 14560 // result: (SRDconst [63] x) 14561 for { 14562 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 1 { 14563 break 14564 } 14565 z := v_0.Args[0] 14566 if z.Op != OpPPC64SRADconst || auxIntToInt64(z.AuxInt) != 63 { 14567 break 14568 } 14569 x := z.Args[0] 14570 if !(z.Uses == 1) { 14571 break 14572 } 14573 v.reset(OpPPC64SRDconst) 14574 v.AuxInt = int64ToAuxInt(63) 14575 v.AddArg(x) 14576 return true 14577 } 14578 return false 14579 } 14580 func rewriteValuePPC64_OpSelect1(v *Value) bool { 14581 v_0 := v.Args[0] 14582 b := v.Block 14583 typ := &b.Func.Config.Types 14584 // match: (Select1 (Mul64uhilo x y)) 14585 // result: (MULLD x y) 14586 for { 14587 if v_0.Op != OpMul64uhilo { 14588 break 14589 } 14590 y := v_0.Args[1] 14591 x := v_0.Args[0] 14592 v.reset(OpPPC64MULLD) 14593 v.AddArg2(x, y) 14594 return true 14595 } 14596 // match: (Select1 (Add64carry x y c)) 14597 // result: (ADDZEzero (Select1 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1]))))) 14598 for { 14599 if v_0.Op != OpAdd64carry { 14600 break 14601 } 14602 c := v_0.Args[2] 14603 x := v_0.Args[0] 14604 y := v_0.Args[1] 14605 v.reset(OpPPC64ADDZEzero) 14606 v0 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64) 14607 v1 := b.NewValue0(v.Pos, OpPPC64ADDE, types.NewTuple(typ.UInt64, typ.UInt64)) 14608 v2 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64) 14609 v3 := b.NewValue0(v.Pos, OpPPC64ADDCconst, types.NewTuple(typ.UInt64, typ.UInt64)) 14610 v3.AuxInt = int64ToAuxInt(-1) 14611 v3.AddArg(c) 14612 v2.AddArg(v3) 14613 v1.AddArg3(x, y, v2) 14614 v0.AddArg(v1) 14615 v.AddArg(v0) 14616 return true 14617 } 14618 // match: (Select1 (ADDCconst n:(ADDZEzero x) [-1])) 14619 // cond: n.Uses <= 2 14620 // result: x 14621 for { 14622 if v_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_0.AuxInt) != -1 { 14623 break 14624 } 14625 n := v_0.Args[0] 14626 if n.Op != OpPPC64ADDZEzero { 14627 break 14628 } 14629 x := n.Args[0] 14630 if !(n.Uses <= 2) { 14631 break 14632 } 14633 v.copyOf(x) 14634 return true 14635 } 14636 // match: (Select1 (Sub64borrow x y c)) 14637 // result: (NEG (SUBZEzero (Select1 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0])))))) 14638 for { 14639 if v_0.Op != OpSub64borrow { 14640 break 14641 } 14642 c := v_0.Args[2] 14643 x := v_0.Args[0] 14644 y := v_0.Args[1] 14645 v.reset(OpPPC64NEG) 14646 v0 := b.NewValue0(v.Pos, OpPPC64SUBZEzero, typ.UInt64) 14647 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64) 14648 v2 := b.NewValue0(v.Pos, OpPPC64SUBE, types.NewTuple(typ.UInt64, typ.UInt64)) 14649 v3 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64) 14650 v4 := b.NewValue0(v.Pos, OpPPC64SUBCconst, types.NewTuple(typ.UInt64, typ.UInt64)) 14651 v4.AuxInt = int64ToAuxInt(0) 14652 v4.AddArg(c) 14653 v3.AddArg(v4) 14654 v2.AddArg3(x, y, v3) 14655 v1.AddArg(v2) 14656 v0.AddArg(v1) 14657 v.AddArg(v0) 14658 return true 14659 } 14660 // match: (Select1 (SUBCconst n:(NEG (SUBZEzero x)) [0])) 14661 // cond: n.Uses <= 2 14662 // result: x 14663 for { 14664 if v_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_0.AuxInt) != 0 { 14665 break 14666 } 14667 n := v_0.Args[0] 14668 if n.Op != OpPPC64NEG { 14669 break 14670 } 14671 n_0 := n.Args[0] 14672 if n_0.Op != OpPPC64SUBZEzero { 14673 break 14674 } 14675 x := n_0.Args[0] 14676 if !(n.Uses <= 2) { 14677 break 14678 } 14679 v.copyOf(x) 14680 return true 14681 } 14682 // match: (Select1 (ANDCCconst [0] _)) 14683 // result: (FlagEQ) 14684 for { 14685 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 { 14686 break 14687 } 14688 v.reset(OpPPC64FlagEQ) 14689 return true 14690 } 14691 return false 14692 } 14693 func rewriteValuePPC64_OpSelectN(v *Value) bool { 14694 v_0 := v.Args[0] 14695 b := v.Block 14696 config := b.Func.Config 14697 // match: (SelectN [0] call:(CALLstatic {sym} s1:(MOVDstore _ (MOVDconst [sz]) s2:(MOVDstore _ src s3:(MOVDstore {t} _ dst mem))))) 14698 // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1, s2, s3, call) 14699 // result: (Move [sz] dst src mem) 14700 for { 14701 if auxIntToInt64(v.AuxInt) != 0 { 14702 break 14703 } 14704 call := v_0 14705 if call.Op != OpPPC64CALLstatic || len(call.Args) != 1 { 14706 break 14707 } 14708 sym := auxToCall(call.Aux) 14709 s1 := call.Args[0] 14710 if s1.Op != OpPPC64MOVDstore { 14711 break 14712 } 14713 _ = s1.Args[2] 14714 s1_1 := s1.Args[1] 14715 if s1_1.Op != OpPPC64MOVDconst { 14716 break 14717 } 14718 sz := auxIntToInt64(s1_1.AuxInt) 14719 s2 := s1.Args[2] 14720 if s2.Op != OpPPC64MOVDstore { 14721 break 14722 } 14723 _ = s2.Args[2] 14724 src := s2.Args[1] 14725 s3 := s2.Args[2] 14726 if s3.Op != OpPPC64MOVDstore { 14727 break 14728 } 14729 mem := s3.Args[2] 14730 dst := s3.Args[1] 14731 if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1, s2, s3, call)) { 14732 break 14733 } 14734 v.reset(OpMove) 14735 v.AuxInt = int64ToAuxInt(sz) 14736 v.AddArg3(dst, src, mem) 14737 return true 14738 } 14739 // match: (SelectN [0] call:(CALLstatic {sym} dst src (MOVDconst [sz]) mem)) 14740 // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call) 14741 // result: (Move [sz] dst src mem) 14742 for { 14743 if auxIntToInt64(v.AuxInt) != 0 { 14744 break 14745 } 14746 call := v_0 14747 if call.Op != OpPPC64CALLstatic || len(call.Args) != 4 { 14748 break 14749 } 14750 sym := auxToCall(call.Aux) 14751 mem := call.Args[3] 14752 dst := call.Args[0] 14753 src := call.Args[1] 14754 call_2 := call.Args[2] 14755 if call_2.Op != OpPPC64MOVDconst { 14756 break 14757 } 14758 sz := auxIntToInt64(call_2.AuxInt) 14759 if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)) { 14760 break 14761 } 14762 v.reset(OpMove) 14763 v.AuxInt = int64ToAuxInt(sz) 14764 v.AddArg3(dst, src, mem) 14765 return true 14766 } 14767 return false 14768 } 14769 func rewriteValuePPC64_OpSlicemask(v *Value) bool { 14770 v_0 := v.Args[0] 14771 b := v.Block 14772 // match: (Slicemask <t> x) 14773 // result: (SRADconst (NEG <t> x) [63]) 14774 for { 14775 t := v.Type 14776 x := v_0 14777 v.reset(OpPPC64SRADconst) 14778 v.AuxInt = int64ToAuxInt(63) 14779 v0 := b.NewValue0(v.Pos, OpPPC64NEG, t) 14780 v0.AddArg(x) 14781 v.AddArg(v0) 14782 return true 14783 } 14784 } 14785 func rewriteValuePPC64_OpStore(v *Value) bool { 14786 v_2 := v.Args[2] 14787 v_1 := v.Args[1] 14788 v_0 := v.Args[0] 14789 // match: (Store {t} ptr val mem) 14790 // cond: t.Size() == 8 && t.IsFloat() 14791 // result: (FMOVDstore ptr val mem) 14792 for { 14793 t := auxToType(v.Aux) 14794 ptr := v_0 14795 val := v_1 14796 mem := v_2 14797 if !(t.Size() == 8 && t.IsFloat()) { 14798 break 14799 } 14800 v.reset(OpPPC64FMOVDstore) 14801 v.AddArg3(ptr, val, mem) 14802 return true 14803 } 14804 // match: (Store {t} ptr val mem) 14805 // cond: t.Size() == 4 && t.IsFloat() 14806 // result: (FMOVSstore ptr val mem) 14807 for { 14808 t := auxToType(v.Aux) 14809 ptr := v_0 14810 val := v_1 14811 mem := v_2 14812 if !(t.Size() == 4 && t.IsFloat()) { 14813 break 14814 } 14815 v.reset(OpPPC64FMOVSstore) 14816 v.AddArg3(ptr, val, mem) 14817 return true 14818 } 14819 // match: (Store {t} ptr val mem) 14820 // cond: t.Size() == 8 && !t.IsFloat() 14821 // result: (MOVDstore ptr val mem) 14822 for { 14823 t := auxToType(v.Aux) 14824 ptr := v_0 14825 val := v_1 14826 mem := v_2 14827 if !(t.Size() == 8 && !t.IsFloat()) { 14828 break 14829 } 14830 v.reset(OpPPC64MOVDstore) 14831 v.AddArg3(ptr, val, mem) 14832 return true 14833 } 14834 // match: (Store {t} ptr val mem) 14835 // cond: t.Size() == 4 && !t.IsFloat() 14836 // result: (MOVWstore ptr val mem) 14837 for { 14838 t := auxToType(v.Aux) 14839 ptr := v_0 14840 val := v_1 14841 mem := v_2 14842 if !(t.Size() == 4 && !t.IsFloat()) { 14843 break 14844 } 14845 v.reset(OpPPC64MOVWstore) 14846 v.AddArg3(ptr, val, mem) 14847 return true 14848 } 14849 // match: (Store {t} ptr val mem) 14850 // cond: t.Size() == 2 14851 // result: (MOVHstore ptr val mem) 14852 for { 14853 t := auxToType(v.Aux) 14854 ptr := v_0 14855 val := v_1 14856 mem := v_2 14857 if !(t.Size() == 2) { 14858 break 14859 } 14860 v.reset(OpPPC64MOVHstore) 14861 v.AddArg3(ptr, val, mem) 14862 return true 14863 } 14864 // match: (Store {t} ptr val mem) 14865 // cond: t.Size() == 1 14866 // result: (MOVBstore ptr val mem) 14867 for { 14868 t := auxToType(v.Aux) 14869 ptr := v_0 14870 val := v_1 14871 mem := v_2 14872 if !(t.Size() == 1) { 14873 break 14874 } 14875 v.reset(OpPPC64MOVBstore) 14876 v.AddArg3(ptr, val, mem) 14877 return true 14878 } 14879 return false 14880 } 14881 func rewriteValuePPC64_OpTrunc16to8(v *Value) bool { 14882 v_0 := v.Args[0] 14883 // match: (Trunc16to8 <t> x) 14884 // cond: t.IsSigned() 14885 // result: (MOVBreg x) 14886 for { 14887 t := v.Type 14888 x := v_0 14889 if !(t.IsSigned()) { 14890 break 14891 } 14892 v.reset(OpPPC64MOVBreg) 14893 v.AddArg(x) 14894 return true 14895 } 14896 // match: (Trunc16to8 x) 14897 // result: (MOVBZreg x) 14898 for { 14899 x := v_0 14900 v.reset(OpPPC64MOVBZreg) 14901 v.AddArg(x) 14902 return true 14903 } 14904 } 14905 func rewriteValuePPC64_OpTrunc32to16(v *Value) bool { 14906 v_0 := v.Args[0] 14907 // match: (Trunc32to16 <t> x) 14908 // cond: t.IsSigned() 14909 // result: (MOVHreg x) 14910 for { 14911 t := v.Type 14912 x := v_0 14913 if !(t.IsSigned()) { 14914 break 14915 } 14916 v.reset(OpPPC64MOVHreg) 14917 v.AddArg(x) 14918 return true 14919 } 14920 // match: (Trunc32to16 x) 14921 // result: (MOVHZreg x) 14922 for { 14923 x := v_0 14924 v.reset(OpPPC64MOVHZreg) 14925 v.AddArg(x) 14926 return true 14927 } 14928 } 14929 func rewriteValuePPC64_OpTrunc32to8(v *Value) bool { 14930 v_0 := v.Args[0] 14931 // match: (Trunc32to8 <t> x) 14932 // cond: t.IsSigned() 14933 // result: (MOVBreg x) 14934 for { 14935 t := v.Type 14936 x := v_0 14937 if !(t.IsSigned()) { 14938 break 14939 } 14940 v.reset(OpPPC64MOVBreg) 14941 v.AddArg(x) 14942 return true 14943 } 14944 // match: (Trunc32to8 x) 14945 // result: (MOVBZreg x) 14946 for { 14947 x := v_0 14948 v.reset(OpPPC64MOVBZreg) 14949 v.AddArg(x) 14950 return true 14951 } 14952 } 14953 func rewriteValuePPC64_OpTrunc64to16(v *Value) bool { 14954 v_0 := v.Args[0] 14955 // match: (Trunc64to16 <t> x) 14956 // cond: t.IsSigned() 14957 // result: (MOVHreg x) 14958 for { 14959 t := v.Type 14960 x := v_0 14961 if !(t.IsSigned()) { 14962 break 14963 } 14964 v.reset(OpPPC64MOVHreg) 14965 v.AddArg(x) 14966 return true 14967 } 14968 // match: (Trunc64to16 x) 14969 // result: (MOVHZreg x) 14970 for { 14971 x := v_0 14972 v.reset(OpPPC64MOVHZreg) 14973 v.AddArg(x) 14974 return true 14975 } 14976 } 14977 func rewriteValuePPC64_OpTrunc64to32(v *Value) bool { 14978 v_0 := v.Args[0] 14979 // match: (Trunc64to32 <t> x) 14980 // cond: t.IsSigned() 14981 // result: (MOVWreg x) 14982 for { 14983 t := v.Type 14984 x := v_0 14985 if !(t.IsSigned()) { 14986 break 14987 } 14988 v.reset(OpPPC64MOVWreg) 14989 v.AddArg(x) 14990 return true 14991 } 14992 // match: (Trunc64to32 x) 14993 // result: (MOVWZreg x) 14994 for { 14995 x := v_0 14996 v.reset(OpPPC64MOVWZreg) 14997 v.AddArg(x) 14998 return true 14999 } 15000 } 15001 func rewriteValuePPC64_OpTrunc64to8(v *Value) bool { 15002 v_0 := v.Args[0] 15003 // match: (Trunc64to8 <t> x) 15004 // cond: t.IsSigned() 15005 // result: (MOVBreg x) 15006 for { 15007 t := v.Type 15008 x := v_0 15009 if !(t.IsSigned()) { 15010 break 15011 } 15012 v.reset(OpPPC64MOVBreg) 15013 v.AddArg(x) 15014 return true 15015 } 15016 // match: (Trunc64to8 x) 15017 // result: (MOVBZreg x) 15018 for { 15019 x := v_0 15020 v.reset(OpPPC64MOVBZreg) 15021 v.AddArg(x) 15022 return true 15023 } 15024 } 15025 func rewriteValuePPC64_OpZero(v *Value) bool { 15026 v_1 := v.Args[1] 15027 v_0 := v.Args[0] 15028 b := v.Block 15029 // match: (Zero [0] _ mem) 15030 // result: mem 15031 for { 15032 if auxIntToInt64(v.AuxInt) != 0 { 15033 break 15034 } 15035 mem := v_1 15036 v.copyOf(mem) 15037 return true 15038 } 15039 // match: (Zero [1] destptr mem) 15040 // result: (MOVBstorezero destptr mem) 15041 for { 15042 if auxIntToInt64(v.AuxInt) != 1 { 15043 break 15044 } 15045 destptr := v_0 15046 mem := v_1 15047 v.reset(OpPPC64MOVBstorezero) 15048 v.AddArg2(destptr, mem) 15049 return true 15050 } 15051 // match: (Zero [2] destptr mem) 15052 // result: (MOVHstorezero destptr mem) 15053 for { 15054 if auxIntToInt64(v.AuxInt) != 2 { 15055 break 15056 } 15057 destptr := v_0 15058 mem := v_1 15059 v.reset(OpPPC64MOVHstorezero) 15060 v.AddArg2(destptr, mem) 15061 return true 15062 } 15063 // match: (Zero [3] destptr mem) 15064 // result: (MOVBstorezero [2] destptr (MOVHstorezero destptr mem)) 15065 for { 15066 if auxIntToInt64(v.AuxInt) != 3 { 15067 break 15068 } 15069 destptr := v_0 15070 mem := v_1 15071 v.reset(OpPPC64MOVBstorezero) 15072 v.AuxInt = int32ToAuxInt(2) 15073 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem) 15074 v0.AddArg2(destptr, mem) 15075 v.AddArg2(destptr, v0) 15076 return true 15077 } 15078 // match: (Zero [4] destptr mem) 15079 // result: (MOVWstorezero destptr mem) 15080 for { 15081 if auxIntToInt64(v.AuxInt) != 4 { 15082 break 15083 } 15084 destptr := v_0 15085 mem := v_1 15086 v.reset(OpPPC64MOVWstorezero) 15087 v.AddArg2(destptr, mem) 15088 return true 15089 } 15090 // match: (Zero [5] destptr mem) 15091 // result: (MOVBstorezero [4] destptr (MOVWstorezero destptr mem)) 15092 for { 15093 if auxIntToInt64(v.AuxInt) != 5 { 15094 break 15095 } 15096 destptr := v_0 15097 mem := v_1 15098 v.reset(OpPPC64MOVBstorezero) 15099 v.AuxInt = int32ToAuxInt(4) 15100 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem) 15101 v0.AddArg2(destptr, mem) 15102 v.AddArg2(destptr, v0) 15103 return true 15104 } 15105 // match: (Zero [6] destptr mem) 15106 // result: (MOVHstorezero [4] destptr (MOVWstorezero destptr mem)) 15107 for { 15108 if auxIntToInt64(v.AuxInt) != 6 { 15109 break 15110 } 15111 destptr := v_0 15112 mem := v_1 15113 v.reset(OpPPC64MOVHstorezero) 15114 v.AuxInt = int32ToAuxInt(4) 15115 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem) 15116 v0.AddArg2(destptr, mem) 15117 v.AddArg2(destptr, v0) 15118 return true 15119 } 15120 // match: (Zero [7] destptr mem) 15121 // result: (MOVBstorezero [6] destptr (MOVHstorezero [4] destptr (MOVWstorezero destptr mem))) 15122 for { 15123 if auxIntToInt64(v.AuxInt) != 7 { 15124 break 15125 } 15126 destptr := v_0 15127 mem := v_1 15128 v.reset(OpPPC64MOVBstorezero) 15129 v.AuxInt = int32ToAuxInt(6) 15130 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem) 15131 v0.AuxInt = int32ToAuxInt(4) 15132 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem) 15133 v1.AddArg2(destptr, mem) 15134 v0.AddArg2(destptr, v1) 15135 v.AddArg2(destptr, v0) 15136 return true 15137 } 15138 // match: (Zero [8] {t} destptr mem) 15139 // result: (MOVDstorezero destptr mem) 15140 for { 15141 if auxIntToInt64(v.AuxInt) != 8 { 15142 break 15143 } 15144 destptr := v_0 15145 mem := v_1 15146 v.reset(OpPPC64MOVDstorezero) 15147 v.AddArg2(destptr, mem) 15148 return true 15149 } 15150 // match: (Zero [12] {t} destptr mem) 15151 // result: (MOVWstorezero [8] destptr (MOVDstorezero [0] destptr mem)) 15152 for { 15153 if auxIntToInt64(v.AuxInt) != 12 { 15154 break 15155 } 15156 destptr := v_0 15157 mem := v_1 15158 v.reset(OpPPC64MOVWstorezero) 15159 v.AuxInt = int32ToAuxInt(8) 15160 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem) 15161 v0.AuxInt = int32ToAuxInt(0) 15162 v0.AddArg2(destptr, mem) 15163 v.AddArg2(destptr, v0) 15164 return true 15165 } 15166 // match: (Zero [16] {t} destptr mem) 15167 // result: (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem)) 15168 for { 15169 if auxIntToInt64(v.AuxInt) != 16 { 15170 break 15171 } 15172 destptr := v_0 15173 mem := v_1 15174 v.reset(OpPPC64MOVDstorezero) 15175 v.AuxInt = int32ToAuxInt(8) 15176 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem) 15177 v0.AuxInt = int32ToAuxInt(0) 15178 v0.AddArg2(destptr, mem) 15179 v.AddArg2(destptr, v0) 15180 return true 15181 } 15182 // match: (Zero [24] {t} destptr mem) 15183 // result: (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))) 15184 for { 15185 if auxIntToInt64(v.AuxInt) != 24 { 15186 break 15187 } 15188 destptr := v_0 15189 mem := v_1 15190 v.reset(OpPPC64MOVDstorezero) 15191 v.AuxInt = int32ToAuxInt(16) 15192 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem) 15193 v0.AuxInt = int32ToAuxInt(8) 15194 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem) 15195 v1.AuxInt = int32ToAuxInt(0) 15196 v1.AddArg2(destptr, mem) 15197 v0.AddArg2(destptr, v1) 15198 v.AddArg2(destptr, v0) 15199 return true 15200 } 15201 // match: (Zero [32] {t} destptr mem) 15202 // result: (MOVDstorezero [24] destptr (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem)))) 15203 for { 15204 if auxIntToInt64(v.AuxInt) != 32 { 15205 break 15206 } 15207 destptr := v_0 15208 mem := v_1 15209 v.reset(OpPPC64MOVDstorezero) 15210 v.AuxInt = int32ToAuxInt(24) 15211 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem) 15212 v0.AuxInt = int32ToAuxInt(16) 15213 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem) 15214 v1.AuxInt = int32ToAuxInt(8) 15215 v2 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem) 15216 v2.AuxInt = int32ToAuxInt(0) 15217 v2.AddArg2(destptr, mem) 15218 v1.AddArg2(destptr, v2) 15219 v0.AddArg2(destptr, v1) 15220 v.AddArg2(destptr, v0) 15221 return true 15222 } 15223 // match: (Zero [s] ptr mem) 15224 // cond: buildcfg.GOPPC64 <= 8 && s < 64 15225 // result: (LoweredZeroShort [s] ptr mem) 15226 for { 15227 s := auxIntToInt64(v.AuxInt) 15228 ptr := v_0 15229 mem := v_1 15230 if !(buildcfg.GOPPC64 <= 8 && s < 64) { 15231 break 15232 } 15233 v.reset(OpPPC64LoweredZeroShort) 15234 v.AuxInt = int64ToAuxInt(s) 15235 v.AddArg2(ptr, mem) 15236 return true 15237 } 15238 // match: (Zero [s] ptr mem) 15239 // cond: buildcfg.GOPPC64 <= 8 15240 // result: (LoweredZero [s] ptr mem) 15241 for { 15242 s := auxIntToInt64(v.AuxInt) 15243 ptr := v_0 15244 mem := v_1 15245 if !(buildcfg.GOPPC64 <= 8) { 15246 break 15247 } 15248 v.reset(OpPPC64LoweredZero) 15249 v.AuxInt = int64ToAuxInt(s) 15250 v.AddArg2(ptr, mem) 15251 return true 15252 } 15253 // match: (Zero [s] ptr mem) 15254 // cond: s < 128 && buildcfg.GOPPC64 >= 9 15255 // result: (LoweredQuadZeroShort [s] ptr mem) 15256 for { 15257 s := auxIntToInt64(v.AuxInt) 15258 ptr := v_0 15259 mem := v_1 15260 if !(s < 128 && buildcfg.GOPPC64 >= 9) { 15261 break 15262 } 15263 v.reset(OpPPC64LoweredQuadZeroShort) 15264 v.AuxInt = int64ToAuxInt(s) 15265 v.AddArg2(ptr, mem) 15266 return true 15267 } 15268 // match: (Zero [s] ptr mem) 15269 // cond: buildcfg.GOPPC64 >= 9 15270 // result: (LoweredQuadZero [s] ptr mem) 15271 for { 15272 s := auxIntToInt64(v.AuxInt) 15273 ptr := v_0 15274 mem := v_1 15275 if !(buildcfg.GOPPC64 >= 9) { 15276 break 15277 } 15278 v.reset(OpPPC64LoweredQuadZero) 15279 v.AuxInt = int64ToAuxInt(s) 15280 v.AddArg2(ptr, mem) 15281 return true 15282 } 15283 return false 15284 } 15285 func rewriteBlockPPC64(b *Block) bool { 15286 typ := &b.Func.Config.Types 15287 switch b.Kind { 15288 case BlockPPC64EQ: 15289 // match: (EQ (FlagEQ) yes no) 15290 // result: (First yes no) 15291 for b.Controls[0].Op == OpPPC64FlagEQ { 15292 b.Reset(BlockFirst) 15293 return true 15294 } 15295 // match: (EQ (FlagLT) yes no) 15296 // result: (First no yes) 15297 for b.Controls[0].Op == OpPPC64FlagLT { 15298 b.Reset(BlockFirst) 15299 b.swapSuccessors() 15300 return true 15301 } 15302 // match: (EQ (FlagGT) yes no) 15303 // result: (First no yes) 15304 for b.Controls[0].Op == OpPPC64FlagGT { 15305 b.Reset(BlockFirst) 15306 b.swapSuccessors() 15307 return true 15308 } 15309 // match: (EQ (InvertFlags cmp) yes no) 15310 // result: (EQ cmp yes no) 15311 for b.Controls[0].Op == OpPPC64InvertFlags { 15312 v_0 := b.Controls[0] 15313 cmp := v_0.Args[0] 15314 b.resetWithControl(BlockPPC64EQ, cmp) 15315 return true 15316 } 15317 // match: (EQ (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 15318 // result: (EQ (Select1 <types.TypeFlags> z) yes no) 15319 for b.Controls[0].Op == OpPPC64CMPconst { 15320 v_0 := b.Controls[0] 15321 if auxIntToInt64(v_0.AuxInt) != 0 { 15322 break 15323 } 15324 v_0_0 := v_0.Args[0] 15325 if v_0_0.Op != OpSelect0 { 15326 break 15327 } 15328 z := v_0_0.Args[0] 15329 if z.Op != OpPPC64ANDCCconst { 15330 break 15331 } 15332 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15333 v0.AddArg(z) 15334 b.resetWithControl(BlockPPC64EQ, v0) 15335 return true 15336 } 15337 // match: (EQ (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 15338 // result: (EQ (Select1 <types.TypeFlags> z) yes no) 15339 for b.Controls[0].Op == OpPPC64CMPWconst { 15340 v_0 := b.Controls[0] 15341 if auxIntToInt32(v_0.AuxInt) != 0 { 15342 break 15343 } 15344 v_0_0 := v_0.Args[0] 15345 if v_0_0.Op != OpSelect0 { 15346 break 15347 } 15348 z := v_0_0.Args[0] 15349 if z.Op != OpPPC64ANDCCconst { 15350 break 15351 } 15352 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15353 v0.AddArg(z) 15354 b.resetWithControl(BlockPPC64EQ, v0) 15355 return true 15356 } 15357 // match: (EQ (CMPconst [0] z:(AND x y)) yes no) 15358 // cond: z.Uses == 1 15359 // result: (EQ (Select1 <types.TypeFlags> (ANDCC x y)) yes no) 15360 for b.Controls[0].Op == OpPPC64CMPconst { 15361 v_0 := b.Controls[0] 15362 if auxIntToInt64(v_0.AuxInt) != 0 { 15363 break 15364 } 15365 z := v_0.Args[0] 15366 if z.Op != OpPPC64AND { 15367 break 15368 } 15369 _ = z.Args[1] 15370 z_0 := z.Args[0] 15371 z_1 := z.Args[1] 15372 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15373 x := z_0 15374 y := z_1 15375 if !(z.Uses == 1) { 15376 continue 15377 } 15378 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15379 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags)) 15380 v1.AddArg2(x, y) 15381 v0.AddArg(v1) 15382 b.resetWithControl(BlockPPC64EQ, v0) 15383 return true 15384 } 15385 break 15386 } 15387 // match: (EQ (CMPconst [0] z:(OR x y)) yes no) 15388 // cond: z.Uses == 1 15389 // result: (EQ (Select1 <types.TypeFlags> (ORCC x y)) yes no) 15390 for b.Controls[0].Op == OpPPC64CMPconst { 15391 v_0 := b.Controls[0] 15392 if auxIntToInt64(v_0.AuxInt) != 0 { 15393 break 15394 } 15395 z := v_0.Args[0] 15396 if z.Op != OpPPC64OR { 15397 break 15398 } 15399 _ = z.Args[1] 15400 z_0 := z.Args[0] 15401 z_1 := z.Args[1] 15402 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15403 x := z_0 15404 y := z_1 15405 if !(z.Uses == 1) { 15406 continue 15407 } 15408 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15409 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags)) 15410 v1.AddArg2(x, y) 15411 v0.AddArg(v1) 15412 b.resetWithControl(BlockPPC64EQ, v0) 15413 return true 15414 } 15415 break 15416 } 15417 // match: (EQ (CMPconst [0] z:(XOR x y)) yes no) 15418 // cond: z.Uses == 1 15419 // result: (EQ (Select1 <types.TypeFlags> (XORCC x y)) yes no) 15420 for b.Controls[0].Op == OpPPC64CMPconst { 15421 v_0 := b.Controls[0] 15422 if auxIntToInt64(v_0.AuxInt) != 0 { 15423 break 15424 } 15425 z := v_0.Args[0] 15426 if z.Op != OpPPC64XOR { 15427 break 15428 } 15429 _ = z.Args[1] 15430 z_0 := z.Args[0] 15431 z_1 := z.Args[1] 15432 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15433 x := z_0 15434 y := z_1 15435 if !(z.Uses == 1) { 15436 continue 15437 } 15438 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15439 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags)) 15440 v1.AddArg2(x, y) 15441 v0.AddArg(v1) 15442 b.resetWithControl(BlockPPC64EQ, v0) 15443 return true 15444 } 15445 break 15446 } 15447 case BlockPPC64GE: 15448 // match: (GE (FlagEQ) yes no) 15449 // result: (First yes no) 15450 for b.Controls[0].Op == OpPPC64FlagEQ { 15451 b.Reset(BlockFirst) 15452 return true 15453 } 15454 // match: (GE (FlagLT) yes no) 15455 // result: (First no yes) 15456 for b.Controls[0].Op == OpPPC64FlagLT { 15457 b.Reset(BlockFirst) 15458 b.swapSuccessors() 15459 return true 15460 } 15461 // match: (GE (FlagGT) yes no) 15462 // result: (First yes no) 15463 for b.Controls[0].Op == OpPPC64FlagGT { 15464 b.Reset(BlockFirst) 15465 return true 15466 } 15467 // match: (GE (InvertFlags cmp) yes no) 15468 // result: (LE cmp yes no) 15469 for b.Controls[0].Op == OpPPC64InvertFlags { 15470 v_0 := b.Controls[0] 15471 cmp := v_0.Args[0] 15472 b.resetWithControl(BlockPPC64LE, cmp) 15473 return true 15474 } 15475 // match: (GE (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 15476 // result: (GE (Select1 <types.TypeFlags> z) yes no) 15477 for b.Controls[0].Op == OpPPC64CMPconst { 15478 v_0 := b.Controls[0] 15479 if auxIntToInt64(v_0.AuxInt) != 0 { 15480 break 15481 } 15482 v_0_0 := v_0.Args[0] 15483 if v_0_0.Op != OpSelect0 { 15484 break 15485 } 15486 z := v_0_0.Args[0] 15487 if z.Op != OpPPC64ANDCCconst { 15488 break 15489 } 15490 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15491 v0.AddArg(z) 15492 b.resetWithControl(BlockPPC64GE, v0) 15493 return true 15494 } 15495 // match: (GE (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 15496 // result: (GE (Select1 <types.TypeFlags> z) yes no) 15497 for b.Controls[0].Op == OpPPC64CMPWconst { 15498 v_0 := b.Controls[0] 15499 if auxIntToInt32(v_0.AuxInt) != 0 { 15500 break 15501 } 15502 v_0_0 := v_0.Args[0] 15503 if v_0_0.Op != OpSelect0 { 15504 break 15505 } 15506 z := v_0_0.Args[0] 15507 if z.Op != OpPPC64ANDCCconst { 15508 break 15509 } 15510 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15511 v0.AddArg(z) 15512 b.resetWithControl(BlockPPC64GE, v0) 15513 return true 15514 } 15515 // match: (GE (CMPconst [0] z:(AND x y)) yes no) 15516 // cond: z.Uses == 1 15517 // result: (GE (Select1 <types.TypeFlags> (ANDCC x y)) yes no) 15518 for b.Controls[0].Op == OpPPC64CMPconst { 15519 v_0 := b.Controls[0] 15520 if auxIntToInt64(v_0.AuxInt) != 0 { 15521 break 15522 } 15523 z := v_0.Args[0] 15524 if z.Op != OpPPC64AND { 15525 break 15526 } 15527 _ = z.Args[1] 15528 z_0 := z.Args[0] 15529 z_1 := z.Args[1] 15530 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15531 x := z_0 15532 y := z_1 15533 if !(z.Uses == 1) { 15534 continue 15535 } 15536 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15537 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags)) 15538 v1.AddArg2(x, y) 15539 v0.AddArg(v1) 15540 b.resetWithControl(BlockPPC64GE, v0) 15541 return true 15542 } 15543 break 15544 } 15545 // match: (GE (CMPconst [0] z:(OR x y)) yes no) 15546 // cond: z.Uses == 1 15547 // result: (GE (Select1 <types.TypeFlags> (ORCC x y)) yes no) 15548 for b.Controls[0].Op == OpPPC64CMPconst { 15549 v_0 := b.Controls[0] 15550 if auxIntToInt64(v_0.AuxInt) != 0 { 15551 break 15552 } 15553 z := v_0.Args[0] 15554 if z.Op != OpPPC64OR { 15555 break 15556 } 15557 _ = z.Args[1] 15558 z_0 := z.Args[0] 15559 z_1 := z.Args[1] 15560 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15561 x := z_0 15562 y := z_1 15563 if !(z.Uses == 1) { 15564 continue 15565 } 15566 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15567 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags)) 15568 v1.AddArg2(x, y) 15569 v0.AddArg(v1) 15570 b.resetWithControl(BlockPPC64GE, v0) 15571 return true 15572 } 15573 break 15574 } 15575 // match: (GE (CMPconst [0] z:(XOR x y)) yes no) 15576 // cond: z.Uses == 1 15577 // result: (GE (Select1 <types.TypeFlags> (XORCC x y)) yes no) 15578 for b.Controls[0].Op == OpPPC64CMPconst { 15579 v_0 := b.Controls[0] 15580 if auxIntToInt64(v_0.AuxInt) != 0 { 15581 break 15582 } 15583 z := v_0.Args[0] 15584 if z.Op != OpPPC64XOR { 15585 break 15586 } 15587 _ = z.Args[1] 15588 z_0 := z.Args[0] 15589 z_1 := z.Args[1] 15590 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15591 x := z_0 15592 y := z_1 15593 if !(z.Uses == 1) { 15594 continue 15595 } 15596 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15597 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags)) 15598 v1.AddArg2(x, y) 15599 v0.AddArg(v1) 15600 b.resetWithControl(BlockPPC64GE, v0) 15601 return true 15602 } 15603 break 15604 } 15605 case BlockPPC64GT: 15606 // match: (GT (FlagEQ) yes no) 15607 // result: (First no yes) 15608 for b.Controls[0].Op == OpPPC64FlagEQ { 15609 b.Reset(BlockFirst) 15610 b.swapSuccessors() 15611 return true 15612 } 15613 // match: (GT (FlagLT) yes no) 15614 // result: (First no yes) 15615 for b.Controls[0].Op == OpPPC64FlagLT { 15616 b.Reset(BlockFirst) 15617 b.swapSuccessors() 15618 return true 15619 } 15620 // match: (GT (FlagGT) yes no) 15621 // result: (First yes no) 15622 for b.Controls[0].Op == OpPPC64FlagGT { 15623 b.Reset(BlockFirst) 15624 return true 15625 } 15626 // match: (GT (InvertFlags cmp) yes no) 15627 // result: (LT cmp yes no) 15628 for b.Controls[0].Op == OpPPC64InvertFlags { 15629 v_0 := b.Controls[0] 15630 cmp := v_0.Args[0] 15631 b.resetWithControl(BlockPPC64LT, cmp) 15632 return true 15633 } 15634 // match: (GT (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 15635 // result: (GT (Select1 <types.TypeFlags> z) yes no) 15636 for b.Controls[0].Op == OpPPC64CMPconst { 15637 v_0 := b.Controls[0] 15638 if auxIntToInt64(v_0.AuxInt) != 0 { 15639 break 15640 } 15641 v_0_0 := v_0.Args[0] 15642 if v_0_0.Op != OpSelect0 { 15643 break 15644 } 15645 z := v_0_0.Args[0] 15646 if z.Op != OpPPC64ANDCCconst { 15647 break 15648 } 15649 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15650 v0.AddArg(z) 15651 b.resetWithControl(BlockPPC64GT, v0) 15652 return true 15653 } 15654 // match: (GT (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 15655 // result: (GT (Select1 <types.TypeFlags> z) yes no) 15656 for b.Controls[0].Op == OpPPC64CMPWconst { 15657 v_0 := b.Controls[0] 15658 if auxIntToInt32(v_0.AuxInt) != 0 { 15659 break 15660 } 15661 v_0_0 := v_0.Args[0] 15662 if v_0_0.Op != OpSelect0 { 15663 break 15664 } 15665 z := v_0_0.Args[0] 15666 if z.Op != OpPPC64ANDCCconst { 15667 break 15668 } 15669 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15670 v0.AddArg(z) 15671 b.resetWithControl(BlockPPC64GT, v0) 15672 return true 15673 } 15674 // match: (GT (CMPconst [0] z:(AND x y)) yes no) 15675 // cond: z.Uses == 1 15676 // result: (GT (Select1 <types.TypeFlags> (ANDCC x y)) yes no) 15677 for b.Controls[0].Op == OpPPC64CMPconst { 15678 v_0 := b.Controls[0] 15679 if auxIntToInt64(v_0.AuxInt) != 0 { 15680 break 15681 } 15682 z := v_0.Args[0] 15683 if z.Op != OpPPC64AND { 15684 break 15685 } 15686 _ = z.Args[1] 15687 z_0 := z.Args[0] 15688 z_1 := z.Args[1] 15689 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15690 x := z_0 15691 y := z_1 15692 if !(z.Uses == 1) { 15693 continue 15694 } 15695 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15696 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags)) 15697 v1.AddArg2(x, y) 15698 v0.AddArg(v1) 15699 b.resetWithControl(BlockPPC64GT, v0) 15700 return true 15701 } 15702 break 15703 } 15704 // match: (GT (CMPconst [0] z:(OR x y)) yes no) 15705 // cond: z.Uses == 1 15706 // result: (GT (Select1 <types.TypeFlags> (ORCC x y)) yes no) 15707 for b.Controls[0].Op == OpPPC64CMPconst { 15708 v_0 := b.Controls[0] 15709 if auxIntToInt64(v_0.AuxInt) != 0 { 15710 break 15711 } 15712 z := v_0.Args[0] 15713 if z.Op != OpPPC64OR { 15714 break 15715 } 15716 _ = z.Args[1] 15717 z_0 := z.Args[0] 15718 z_1 := z.Args[1] 15719 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15720 x := z_0 15721 y := z_1 15722 if !(z.Uses == 1) { 15723 continue 15724 } 15725 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15726 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags)) 15727 v1.AddArg2(x, y) 15728 v0.AddArg(v1) 15729 b.resetWithControl(BlockPPC64GT, v0) 15730 return true 15731 } 15732 break 15733 } 15734 // match: (GT (CMPconst [0] z:(XOR x y)) yes no) 15735 // cond: z.Uses == 1 15736 // result: (GT (Select1 <types.TypeFlags> (XORCC x y)) yes no) 15737 for b.Controls[0].Op == OpPPC64CMPconst { 15738 v_0 := b.Controls[0] 15739 if auxIntToInt64(v_0.AuxInt) != 0 { 15740 break 15741 } 15742 z := v_0.Args[0] 15743 if z.Op != OpPPC64XOR { 15744 break 15745 } 15746 _ = z.Args[1] 15747 z_0 := z.Args[0] 15748 z_1 := z.Args[1] 15749 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15750 x := z_0 15751 y := z_1 15752 if !(z.Uses == 1) { 15753 continue 15754 } 15755 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15756 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags)) 15757 v1.AddArg2(x, y) 15758 v0.AddArg(v1) 15759 b.resetWithControl(BlockPPC64GT, v0) 15760 return true 15761 } 15762 break 15763 } 15764 case BlockIf: 15765 // match: (If (Equal cc) yes no) 15766 // result: (EQ cc yes no) 15767 for b.Controls[0].Op == OpPPC64Equal { 15768 v_0 := b.Controls[0] 15769 cc := v_0.Args[0] 15770 b.resetWithControl(BlockPPC64EQ, cc) 15771 return true 15772 } 15773 // match: (If (NotEqual cc) yes no) 15774 // result: (NE cc yes no) 15775 for b.Controls[0].Op == OpPPC64NotEqual { 15776 v_0 := b.Controls[0] 15777 cc := v_0.Args[0] 15778 b.resetWithControl(BlockPPC64NE, cc) 15779 return true 15780 } 15781 // match: (If (LessThan cc) yes no) 15782 // result: (LT cc yes no) 15783 for b.Controls[0].Op == OpPPC64LessThan { 15784 v_0 := b.Controls[0] 15785 cc := v_0.Args[0] 15786 b.resetWithControl(BlockPPC64LT, cc) 15787 return true 15788 } 15789 // match: (If (LessEqual cc) yes no) 15790 // result: (LE cc yes no) 15791 for b.Controls[0].Op == OpPPC64LessEqual { 15792 v_0 := b.Controls[0] 15793 cc := v_0.Args[0] 15794 b.resetWithControl(BlockPPC64LE, cc) 15795 return true 15796 } 15797 // match: (If (GreaterThan cc) yes no) 15798 // result: (GT cc yes no) 15799 for b.Controls[0].Op == OpPPC64GreaterThan { 15800 v_0 := b.Controls[0] 15801 cc := v_0.Args[0] 15802 b.resetWithControl(BlockPPC64GT, cc) 15803 return true 15804 } 15805 // match: (If (GreaterEqual cc) yes no) 15806 // result: (GE cc yes no) 15807 for b.Controls[0].Op == OpPPC64GreaterEqual { 15808 v_0 := b.Controls[0] 15809 cc := v_0.Args[0] 15810 b.resetWithControl(BlockPPC64GE, cc) 15811 return true 15812 } 15813 // match: (If (FLessThan cc) yes no) 15814 // result: (FLT cc yes no) 15815 for b.Controls[0].Op == OpPPC64FLessThan { 15816 v_0 := b.Controls[0] 15817 cc := v_0.Args[0] 15818 b.resetWithControl(BlockPPC64FLT, cc) 15819 return true 15820 } 15821 // match: (If (FLessEqual cc) yes no) 15822 // result: (FLE cc yes no) 15823 for b.Controls[0].Op == OpPPC64FLessEqual { 15824 v_0 := b.Controls[0] 15825 cc := v_0.Args[0] 15826 b.resetWithControl(BlockPPC64FLE, cc) 15827 return true 15828 } 15829 // match: (If (FGreaterThan cc) yes no) 15830 // result: (FGT cc yes no) 15831 for b.Controls[0].Op == OpPPC64FGreaterThan { 15832 v_0 := b.Controls[0] 15833 cc := v_0.Args[0] 15834 b.resetWithControl(BlockPPC64FGT, cc) 15835 return true 15836 } 15837 // match: (If (FGreaterEqual cc) yes no) 15838 // result: (FGE cc yes no) 15839 for b.Controls[0].Op == OpPPC64FGreaterEqual { 15840 v_0 := b.Controls[0] 15841 cc := v_0.Args[0] 15842 b.resetWithControl(BlockPPC64FGE, cc) 15843 return true 15844 } 15845 // match: (If cond yes no) 15846 // result: (NE (CMPWconst [0] (Select0 <typ.UInt32> (ANDCCconst [1] cond))) yes no) 15847 for { 15848 cond := b.Controls[0] 15849 v0 := b.NewValue0(cond.Pos, OpPPC64CMPWconst, types.TypeFlags) 15850 v0.AuxInt = int32ToAuxInt(0) 15851 v1 := b.NewValue0(cond.Pos, OpSelect0, typ.UInt32) 15852 v2 := b.NewValue0(cond.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags)) 15853 v2.AuxInt = int64ToAuxInt(1) 15854 v2.AddArg(cond) 15855 v1.AddArg(v2) 15856 v0.AddArg(v1) 15857 b.resetWithControl(BlockPPC64NE, v0) 15858 return true 15859 } 15860 case BlockPPC64LE: 15861 // match: (LE (FlagEQ) yes no) 15862 // result: (First yes no) 15863 for b.Controls[0].Op == OpPPC64FlagEQ { 15864 b.Reset(BlockFirst) 15865 return true 15866 } 15867 // match: (LE (FlagLT) yes no) 15868 // result: (First yes no) 15869 for b.Controls[0].Op == OpPPC64FlagLT { 15870 b.Reset(BlockFirst) 15871 return true 15872 } 15873 // match: (LE (FlagGT) yes no) 15874 // result: (First no yes) 15875 for b.Controls[0].Op == OpPPC64FlagGT { 15876 b.Reset(BlockFirst) 15877 b.swapSuccessors() 15878 return true 15879 } 15880 // match: (LE (InvertFlags cmp) yes no) 15881 // result: (GE cmp yes no) 15882 for b.Controls[0].Op == OpPPC64InvertFlags { 15883 v_0 := b.Controls[0] 15884 cmp := v_0.Args[0] 15885 b.resetWithControl(BlockPPC64GE, cmp) 15886 return true 15887 } 15888 // match: (LE (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 15889 // result: (LE (Select1 <types.TypeFlags> z) yes no) 15890 for b.Controls[0].Op == OpPPC64CMPconst { 15891 v_0 := b.Controls[0] 15892 if auxIntToInt64(v_0.AuxInt) != 0 { 15893 break 15894 } 15895 v_0_0 := v_0.Args[0] 15896 if v_0_0.Op != OpSelect0 { 15897 break 15898 } 15899 z := v_0_0.Args[0] 15900 if z.Op != OpPPC64ANDCCconst { 15901 break 15902 } 15903 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15904 v0.AddArg(z) 15905 b.resetWithControl(BlockPPC64LE, v0) 15906 return true 15907 } 15908 // match: (LE (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 15909 // result: (LE (Select1 <types.TypeFlags> z) yes no) 15910 for b.Controls[0].Op == OpPPC64CMPWconst { 15911 v_0 := b.Controls[0] 15912 if auxIntToInt32(v_0.AuxInt) != 0 { 15913 break 15914 } 15915 v_0_0 := v_0.Args[0] 15916 if v_0_0.Op != OpSelect0 { 15917 break 15918 } 15919 z := v_0_0.Args[0] 15920 if z.Op != OpPPC64ANDCCconst { 15921 break 15922 } 15923 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15924 v0.AddArg(z) 15925 b.resetWithControl(BlockPPC64LE, v0) 15926 return true 15927 } 15928 // match: (LE (CMPconst [0] z:(AND x y)) yes no) 15929 // cond: z.Uses == 1 15930 // result: (LE (Select1 <types.TypeFlags> (ANDCC x y)) yes no) 15931 for b.Controls[0].Op == OpPPC64CMPconst { 15932 v_0 := b.Controls[0] 15933 if auxIntToInt64(v_0.AuxInt) != 0 { 15934 break 15935 } 15936 z := v_0.Args[0] 15937 if z.Op != OpPPC64AND { 15938 break 15939 } 15940 _ = z.Args[1] 15941 z_0 := z.Args[0] 15942 z_1 := z.Args[1] 15943 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15944 x := z_0 15945 y := z_1 15946 if !(z.Uses == 1) { 15947 continue 15948 } 15949 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15950 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags)) 15951 v1.AddArg2(x, y) 15952 v0.AddArg(v1) 15953 b.resetWithControl(BlockPPC64LE, v0) 15954 return true 15955 } 15956 break 15957 } 15958 // match: (LE (CMPconst [0] z:(OR x y)) yes no) 15959 // cond: z.Uses == 1 15960 // result: (LE (Select1 <types.TypeFlags> (ORCC x y)) yes no) 15961 for b.Controls[0].Op == OpPPC64CMPconst { 15962 v_0 := b.Controls[0] 15963 if auxIntToInt64(v_0.AuxInt) != 0 { 15964 break 15965 } 15966 z := v_0.Args[0] 15967 if z.Op != OpPPC64OR { 15968 break 15969 } 15970 _ = z.Args[1] 15971 z_0 := z.Args[0] 15972 z_1 := z.Args[1] 15973 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 15974 x := z_0 15975 y := z_1 15976 if !(z.Uses == 1) { 15977 continue 15978 } 15979 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 15980 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags)) 15981 v1.AddArg2(x, y) 15982 v0.AddArg(v1) 15983 b.resetWithControl(BlockPPC64LE, v0) 15984 return true 15985 } 15986 break 15987 } 15988 // match: (LE (CMPconst [0] z:(XOR x y)) yes no) 15989 // cond: z.Uses == 1 15990 // result: (LE (Select1 <types.TypeFlags> (XORCC x y)) yes no) 15991 for b.Controls[0].Op == OpPPC64CMPconst { 15992 v_0 := b.Controls[0] 15993 if auxIntToInt64(v_0.AuxInt) != 0 { 15994 break 15995 } 15996 z := v_0.Args[0] 15997 if z.Op != OpPPC64XOR { 15998 break 15999 } 16000 _ = z.Args[1] 16001 z_0 := z.Args[0] 16002 z_1 := z.Args[1] 16003 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 16004 x := z_0 16005 y := z_1 16006 if !(z.Uses == 1) { 16007 continue 16008 } 16009 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16010 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags)) 16011 v1.AddArg2(x, y) 16012 v0.AddArg(v1) 16013 b.resetWithControl(BlockPPC64LE, v0) 16014 return true 16015 } 16016 break 16017 } 16018 case BlockPPC64LT: 16019 // match: (LT (FlagEQ) yes no) 16020 // result: (First no yes) 16021 for b.Controls[0].Op == OpPPC64FlagEQ { 16022 b.Reset(BlockFirst) 16023 b.swapSuccessors() 16024 return true 16025 } 16026 // match: (LT (FlagLT) yes no) 16027 // result: (First yes no) 16028 for b.Controls[0].Op == OpPPC64FlagLT { 16029 b.Reset(BlockFirst) 16030 return true 16031 } 16032 // match: (LT (FlagGT) yes no) 16033 // result: (First no yes) 16034 for b.Controls[0].Op == OpPPC64FlagGT { 16035 b.Reset(BlockFirst) 16036 b.swapSuccessors() 16037 return true 16038 } 16039 // match: (LT (InvertFlags cmp) yes no) 16040 // result: (GT cmp yes no) 16041 for b.Controls[0].Op == OpPPC64InvertFlags { 16042 v_0 := b.Controls[0] 16043 cmp := v_0.Args[0] 16044 b.resetWithControl(BlockPPC64GT, cmp) 16045 return true 16046 } 16047 // match: (LT (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 16048 // result: (LT (Select1 <types.TypeFlags> z) yes no) 16049 for b.Controls[0].Op == OpPPC64CMPconst { 16050 v_0 := b.Controls[0] 16051 if auxIntToInt64(v_0.AuxInt) != 0 { 16052 break 16053 } 16054 v_0_0 := v_0.Args[0] 16055 if v_0_0.Op != OpSelect0 { 16056 break 16057 } 16058 z := v_0_0.Args[0] 16059 if z.Op != OpPPC64ANDCCconst { 16060 break 16061 } 16062 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16063 v0.AddArg(z) 16064 b.resetWithControl(BlockPPC64LT, v0) 16065 return true 16066 } 16067 // match: (LT (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 16068 // result: (LT (Select1 <types.TypeFlags> z) yes no) 16069 for b.Controls[0].Op == OpPPC64CMPWconst { 16070 v_0 := b.Controls[0] 16071 if auxIntToInt32(v_0.AuxInt) != 0 { 16072 break 16073 } 16074 v_0_0 := v_0.Args[0] 16075 if v_0_0.Op != OpSelect0 { 16076 break 16077 } 16078 z := v_0_0.Args[0] 16079 if z.Op != OpPPC64ANDCCconst { 16080 break 16081 } 16082 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16083 v0.AddArg(z) 16084 b.resetWithControl(BlockPPC64LT, v0) 16085 return true 16086 } 16087 // match: (LT (CMPconst [0] z:(AND x y)) yes no) 16088 // cond: z.Uses == 1 16089 // result: (LT (Select1 <types.TypeFlags> (ANDCC x y)) yes no) 16090 for b.Controls[0].Op == OpPPC64CMPconst { 16091 v_0 := b.Controls[0] 16092 if auxIntToInt64(v_0.AuxInt) != 0 { 16093 break 16094 } 16095 z := v_0.Args[0] 16096 if z.Op != OpPPC64AND { 16097 break 16098 } 16099 _ = z.Args[1] 16100 z_0 := z.Args[0] 16101 z_1 := z.Args[1] 16102 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 16103 x := z_0 16104 y := z_1 16105 if !(z.Uses == 1) { 16106 continue 16107 } 16108 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16109 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags)) 16110 v1.AddArg2(x, y) 16111 v0.AddArg(v1) 16112 b.resetWithControl(BlockPPC64LT, v0) 16113 return true 16114 } 16115 break 16116 } 16117 // match: (LT (CMPconst [0] z:(OR x y)) yes no) 16118 // cond: z.Uses == 1 16119 // result: (LT (Select1 <types.TypeFlags> (ORCC x y)) yes no) 16120 for b.Controls[0].Op == OpPPC64CMPconst { 16121 v_0 := b.Controls[0] 16122 if auxIntToInt64(v_0.AuxInt) != 0 { 16123 break 16124 } 16125 z := v_0.Args[0] 16126 if z.Op != OpPPC64OR { 16127 break 16128 } 16129 _ = z.Args[1] 16130 z_0 := z.Args[0] 16131 z_1 := z.Args[1] 16132 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 16133 x := z_0 16134 y := z_1 16135 if !(z.Uses == 1) { 16136 continue 16137 } 16138 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16139 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags)) 16140 v1.AddArg2(x, y) 16141 v0.AddArg(v1) 16142 b.resetWithControl(BlockPPC64LT, v0) 16143 return true 16144 } 16145 break 16146 } 16147 // match: (LT (CMPconst [0] z:(XOR x y)) yes no) 16148 // cond: z.Uses == 1 16149 // result: (LT (Select1 <types.TypeFlags> (XORCC x y)) yes no) 16150 for b.Controls[0].Op == OpPPC64CMPconst { 16151 v_0 := b.Controls[0] 16152 if auxIntToInt64(v_0.AuxInt) != 0 { 16153 break 16154 } 16155 z := v_0.Args[0] 16156 if z.Op != OpPPC64XOR { 16157 break 16158 } 16159 _ = z.Args[1] 16160 z_0 := z.Args[0] 16161 z_1 := z.Args[1] 16162 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 16163 x := z_0 16164 y := z_1 16165 if !(z.Uses == 1) { 16166 continue 16167 } 16168 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16169 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags)) 16170 v1.AddArg2(x, y) 16171 v0.AddArg(v1) 16172 b.resetWithControl(BlockPPC64LT, v0) 16173 return true 16174 } 16175 break 16176 } 16177 case BlockPPC64NE: 16178 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (Equal cc)))) yes no) 16179 // result: (EQ cc yes no) 16180 for b.Controls[0].Op == OpPPC64CMPWconst { 16181 v_0 := b.Controls[0] 16182 if auxIntToInt32(v_0.AuxInt) != 0 { 16183 break 16184 } 16185 v_0_0 := v_0.Args[0] 16186 if v_0_0.Op != OpSelect0 { 16187 break 16188 } 16189 v_0_0_0 := v_0_0.Args[0] 16190 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16191 break 16192 } 16193 v_0_0_0_0 := v_0_0_0.Args[0] 16194 if v_0_0_0_0.Op != OpPPC64Equal { 16195 break 16196 } 16197 cc := v_0_0_0_0.Args[0] 16198 b.resetWithControl(BlockPPC64EQ, cc) 16199 return true 16200 } 16201 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (NotEqual cc)))) yes no) 16202 // result: (NE cc yes no) 16203 for b.Controls[0].Op == OpPPC64CMPWconst { 16204 v_0 := b.Controls[0] 16205 if auxIntToInt32(v_0.AuxInt) != 0 { 16206 break 16207 } 16208 v_0_0 := v_0.Args[0] 16209 if v_0_0.Op != OpSelect0 { 16210 break 16211 } 16212 v_0_0_0 := v_0_0.Args[0] 16213 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16214 break 16215 } 16216 v_0_0_0_0 := v_0_0_0.Args[0] 16217 if v_0_0_0_0.Op != OpPPC64NotEqual { 16218 break 16219 } 16220 cc := v_0_0_0_0.Args[0] 16221 b.resetWithControl(BlockPPC64NE, cc) 16222 return true 16223 } 16224 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (LessThan cc)))) yes no) 16225 // result: (LT cc yes no) 16226 for b.Controls[0].Op == OpPPC64CMPWconst { 16227 v_0 := b.Controls[0] 16228 if auxIntToInt32(v_0.AuxInt) != 0 { 16229 break 16230 } 16231 v_0_0 := v_0.Args[0] 16232 if v_0_0.Op != OpSelect0 { 16233 break 16234 } 16235 v_0_0_0 := v_0_0.Args[0] 16236 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16237 break 16238 } 16239 v_0_0_0_0 := v_0_0_0.Args[0] 16240 if v_0_0_0_0.Op != OpPPC64LessThan { 16241 break 16242 } 16243 cc := v_0_0_0_0.Args[0] 16244 b.resetWithControl(BlockPPC64LT, cc) 16245 return true 16246 } 16247 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (LessEqual cc)))) yes no) 16248 // result: (LE cc yes no) 16249 for b.Controls[0].Op == OpPPC64CMPWconst { 16250 v_0 := b.Controls[0] 16251 if auxIntToInt32(v_0.AuxInt) != 0 { 16252 break 16253 } 16254 v_0_0 := v_0.Args[0] 16255 if v_0_0.Op != OpSelect0 { 16256 break 16257 } 16258 v_0_0_0 := v_0_0.Args[0] 16259 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16260 break 16261 } 16262 v_0_0_0_0 := v_0_0_0.Args[0] 16263 if v_0_0_0_0.Op != OpPPC64LessEqual { 16264 break 16265 } 16266 cc := v_0_0_0_0.Args[0] 16267 b.resetWithControl(BlockPPC64LE, cc) 16268 return true 16269 } 16270 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (GreaterThan cc)))) yes no) 16271 // result: (GT cc yes no) 16272 for b.Controls[0].Op == OpPPC64CMPWconst { 16273 v_0 := b.Controls[0] 16274 if auxIntToInt32(v_0.AuxInt) != 0 { 16275 break 16276 } 16277 v_0_0 := v_0.Args[0] 16278 if v_0_0.Op != OpSelect0 { 16279 break 16280 } 16281 v_0_0_0 := v_0_0.Args[0] 16282 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16283 break 16284 } 16285 v_0_0_0_0 := v_0_0_0.Args[0] 16286 if v_0_0_0_0.Op != OpPPC64GreaterThan { 16287 break 16288 } 16289 cc := v_0_0_0_0.Args[0] 16290 b.resetWithControl(BlockPPC64GT, cc) 16291 return true 16292 } 16293 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (GreaterEqual cc)))) yes no) 16294 // result: (GE cc yes no) 16295 for b.Controls[0].Op == OpPPC64CMPWconst { 16296 v_0 := b.Controls[0] 16297 if auxIntToInt32(v_0.AuxInt) != 0 { 16298 break 16299 } 16300 v_0_0 := v_0.Args[0] 16301 if v_0_0.Op != OpSelect0 { 16302 break 16303 } 16304 v_0_0_0 := v_0_0.Args[0] 16305 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16306 break 16307 } 16308 v_0_0_0_0 := v_0_0_0.Args[0] 16309 if v_0_0_0_0.Op != OpPPC64GreaterEqual { 16310 break 16311 } 16312 cc := v_0_0_0_0.Args[0] 16313 b.resetWithControl(BlockPPC64GE, cc) 16314 return true 16315 } 16316 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FLessThan cc)))) yes no) 16317 // result: (FLT cc yes no) 16318 for b.Controls[0].Op == OpPPC64CMPWconst { 16319 v_0 := b.Controls[0] 16320 if auxIntToInt32(v_0.AuxInt) != 0 { 16321 break 16322 } 16323 v_0_0 := v_0.Args[0] 16324 if v_0_0.Op != OpSelect0 { 16325 break 16326 } 16327 v_0_0_0 := v_0_0.Args[0] 16328 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16329 break 16330 } 16331 v_0_0_0_0 := v_0_0_0.Args[0] 16332 if v_0_0_0_0.Op != OpPPC64FLessThan { 16333 break 16334 } 16335 cc := v_0_0_0_0.Args[0] 16336 b.resetWithControl(BlockPPC64FLT, cc) 16337 return true 16338 } 16339 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FLessEqual cc)))) yes no) 16340 // result: (FLE cc yes no) 16341 for b.Controls[0].Op == OpPPC64CMPWconst { 16342 v_0 := b.Controls[0] 16343 if auxIntToInt32(v_0.AuxInt) != 0 { 16344 break 16345 } 16346 v_0_0 := v_0.Args[0] 16347 if v_0_0.Op != OpSelect0 { 16348 break 16349 } 16350 v_0_0_0 := v_0_0.Args[0] 16351 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16352 break 16353 } 16354 v_0_0_0_0 := v_0_0_0.Args[0] 16355 if v_0_0_0_0.Op != OpPPC64FLessEqual { 16356 break 16357 } 16358 cc := v_0_0_0_0.Args[0] 16359 b.resetWithControl(BlockPPC64FLE, cc) 16360 return true 16361 } 16362 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FGreaterThan cc)))) yes no) 16363 // result: (FGT cc yes no) 16364 for b.Controls[0].Op == OpPPC64CMPWconst { 16365 v_0 := b.Controls[0] 16366 if auxIntToInt32(v_0.AuxInt) != 0 { 16367 break 16368 } 16369 v_0_0 := v_0.Args[0] 16370 if v_0_0.Op != OpSelect0 { 16371 break 16372 } 16373 v_0_0_0 := v_0_0.Args[0] 16374 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16375 break 16376 } 16377 v_0_0_0_0 := v_0_0_0.Args[0] 16378 if v_0_0_0_0.Op != OpPPC64FGreaterThan { 16379 break 16380 } 16381 cc := v_0_0_0_0.Args[0] 16382 b.resetWithControl(BlockPPC64FGT, cc) 16383 return true 16384 } 16385 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FGreaterEqual cc)))) yes no) 16386 // result: (FGE cc yes no) 16387 for b.Controls[0].Op == OpPPC64CMPWconst { 16388 v_0 := b.Controls[0] 16389 if auxIntToInt32(v_0.AuxInt) != 0 { 16390 break 16391 } 16392 v_0_0 := v_0.Args[0] 16393 if v_0_0.Op != OpSelect0 { 16394 break 16395 } 16396 v_0_0_0 := v_0_0.Args[0] 16397 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 { 16398 break 16399 } 16400 v_0_0_0_0 := v_0_0_0.Args[0] 16401 if v_0_0_0_0.Op != OpPPC64FGreaterEqual { 16402 break 16403 } 16404 cc := v_0_0_0_0.Args[0] 16405 b.resetWithControl(BlockPPC64FGE, cc) 16406 return true 16407 } 16408 // match: (NE (FlagEQ) yes no) 16409 // result: (First no yes) 16410 for b.Controls[0].Op == OpPPC64FlagEQ { 16411 b.Reset(BlockFirst) 16412 b.swapSuccessors() 16413 return true 16414 } 16415 // match: (NE (FlagLT) yes no) 16416 // result: (First yes no) 16417 for b.Controls[0].Op == OpPPC64FlagLT { 16418 b.Reset(BlockFirst) 16419 return true 16420 } 16421 // match: (NE (FlagGT) yes no) 16422 // result: (First yes no) 16423 for b.Controls[0].Op == OpPPC64FlagGT { 16424 b.Reset(BlockFirst) 16425 return true 16426 } 16427 // match: (NE (InvertFlags cmp) yes no) 16428 // result: (NE cmp yes no) 16429 for b.Controls[0].Op == OpPPC64InvertFlags { 16430 v_0 := b.Controls[0] 16431 cmp := v_0.Args[0] 16432 b.resetWithControl(BlockPPC64NE, cmp) 16433 return true 16434 } 16435 // match: (NE (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 16436 // result: (NE (Select1 <types.TypeFlags> z) yes no) 16437 for b.Controls[0].Op == OpPPC64CMPconst { 16438 v_0 := b.Controls[0] 16439 if auxIntToInt64(v_0.AuxInt) != 0 { 16440 break 16441 } 16442 v_0_0 := v_0.Args[0] 16443 if v_0_0.Op != OpSelect0 { 16444 break 16445 } 16446 z := v_0_0.Args[0] 16447 if z.Op != OpPPC64ANDCCconst { 16448 break 16449 } 16450 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16451 v0.AddArg(z) 16452 b.resetWithControl(BlockPPC64NE, v0) 16453 return true 16454 } 16455 // match: (NE (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no) 16456 // result: (NE (Select1 <types.TypeFlags> z) yes no) 16457 for b.Controls[0].Op == OpPPC64CMPWconst { 16458 v_0 := b.Controls[0] 16459 if auxIntToInt32(v_0.AuxInt) != 0 { 16460 break 16461 } 16462 v_0_0 := v_0.Args[0] 16463 if v_0_0.Op != OpSelect0 { 16464 break 16465 } 16466 z := v_0_0.Args[0] 16467 if z.Op != OpPPC64ANDCCconst { 16468 break 16469 } 16470 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16471 v0.AddArg(z) 16472 b.resetWithControl(BlockPPC64NE, v0) 16473 return true 16474 } 16475 // match: (NE (CMPconst [0] z:(AND x y)) yes no) 16476 // cond: z.Uses == 1 16477 // result: (NE (Select1 <types.TypeFlags> (ANDCC x y)) yes no) 16478 for b.Controls[0].Op == OpPPC64CMPconst { 16479 v_0 := b.Controls[0] 16480 if auxIntToInt64(v_0.AuxInt) != 0 { 16481 break 16482 } 16483 z := v_0.Args[0] 16484 if z.Op != OpPPC64AND { 16485 break 16486 } 16487 _ = z.Args[1] 16488 z_0 := z.Args[0] 16489 z_1 := z.Args[1] 16490 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 16491 x := z_0 16492 y := z_1 16493 if !(z.Uses == 1) { 16494 continue 16495 } 16496 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16497 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags)) 16498 v1.AddArg2(x, y) 16499 v0.AddArg(v1) 16500 b.resetWithControl(BlockPPC64NE, v0) 16501 return true 16502 } 16503 break 16504 } 16505 // match: (NE (CMPconst [0] z:(OR x y)) yes no) 16506 // cond: z.Uses == 1 16507 // result: (NE (Select1 <types.TypeFlags> (ORCC x y)) yes no) 16508 for b.Controls[0].Op == OpPPC64CMPconst { 16509 v_0 := b.Controls[0] 16510 if auxIntToInt64(v_0.AuxInt) != 0 { 16511 break 16512 } 16513 z := v_0.Args[0] 16514 if z.Op != OpPPC64OR { 16515 break 16516 } 16517 _ = z.Args[1] 16518 z_0 := z.Args[0] 16519 z_1 := z.Args[1] 16520 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 16521 x := z_0 16522 y := z_1 16523 if !(z.Uses == 1) { 16524 continue 16525 } 16526 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16527 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags)) 16528 v1.AddArg2(x, y) 16529 v0.AddArg(v1) 16530 b.resetWithControl(BlockPPC64NE, v0) 16531 return true 16532 } 16533 break 16534 } 16535 // match: (NE (CMPconst [0] z:(XOR x y)) yes no) 16536 // cond: z.Uses == 1 16537 // result: (NE (Select1 <types.TypeFlags> (XORCC x y)) yes no) 16538 for b.Controls[0].Op == OpPPC64CMPconst { 16539 v_0 := b.Controls[0] 16540 if auxIntToInt64(v_0.AuxInt) != 0 { 16541 break 16542 } 16543 z := v_0.Args[0] 16544 if z.Op != OpPPC64XOR { 16545 break 16546 } 16547 _ = z.Args[1] 16548 z_0 := z.Args[0] 16549 z_1 := z.Args[1] 16550 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 { 16551 x := z_0 16552 y := z_1 16553 if !(z.Uses == 1) { 16554 continue 16555 } 16556 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags) 16557 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags)) 16558 v1.AddArg2(x, y) 16559 v0.AddArg(v1) 16560 b.resetWithControl(BlockPPC64NE, v0) 16561 return true 16562 } 16563 break 16564 } 16565 } 16566 return false 16567 }