github.com/bir3/gocompiler@v0.9.2202/src/cmd/compile/internal/ssa/rewriteWasm.go (about) 1 // Code generated from _gen/Wasm.rules using 'go generate'; DO NOT EDIT. 2 3 package ssa 4 5 import "github.com/bir3/gocompiler/src/internal/buildcfg" 6 import "math" 7 import "github.com/bir3/gocompiler/src/cmd/compile/internal/types" 8 9 func rewriteValueWasm(v *Value) bool { 10 switch v.Op { 11 case OpAbs: 12 v.Op = OpWasmF64Abs 13 return true 14 case OpAdd16: 15 v.Op = OpWasmI64Add 16 return true 17 case OpAdd32: 18 v.Op = OpWasmI64Add 19 return true 20 case OpAdd32F: 21 v.Op = OpWasmF32Add 22 return true 23 case OpAdd64: 24 v.Op = OpWasmI64Add 25 return true 26 case OpAdd64F: 27 v.Op = OpWasmF64Add 28 return true 29 case OpAdd8: 30 v.Op = OpWasmI64Add 31 return true 32 case OpAddPtr: 33 v.Op = OpWasmI64Add 34 return true 35 case OpAddr: 36 return rewriteValueWasm_OpAddr(v) 37 case OpAnd16: 38 v.Op = OpWasmI64And 39 return true 40 case OpAnd32: 41 v.Op = OpWasmI64And 42 return true 43 case OpAnd64: 44 v.Op = OpWasmI64And 45 return true 46 case OpAnd8: 47 v.Op = OpWasmI64And 48 return true 49 case OpAndB: 50 v.Op = OpWasmI64And 51 return true 52 case OpBitLen64: 53 return rewriteValueWasm_OpBitLen64(v) 54 case OpCeil: 55 v.Op = OpWasmF64Ceil 56 return true 57 case OpClosureCall: 58 v.Op = OpWasmLoweredClosureCall 59 return true 60 case OpCom16: 61 return rewriteValueWasm_OpCom16(v) 62 case OpCom32: 63 return rewriteValueWasm_OpCom32(v) 64 case OpCom64: 65 return rewriteValueWasm_OpCom64(v) 66 case OpCom8: 67 return rewriteValueWasm_OpCom8(v) 68 case OpCondSelect: 69 v.Op = OpWasmSelect 70 return true 71 case OpConst16: 72 return rewriteValueWasm_OpConst16(v) 73 case OpConst32: 74 return rewriteValueWasm_OpConst32(v) 75 case OpConst32F: 76 v.Op = OpWasmF32Const 77 return true 78 case OpConst64: 79 v.Op = OpWasmI64Const 80 return true 81 case OpConst64F: 82 v.Op = OpWasmF64Const 83 return true 84 case OpConst8: 85 return rewriteValueWasm_OpConst8(v) 86 case OpConstBool: 87 return rewriteValueWasm_OpConstBool(v) 88 case OpConstNil: 89 return rewriteValueWasm_OpConstNil(v) 90 case OpConvert: 91 v.Op = OpWasmLoweredConvert 92 return true 93 case OpCopysign: 94 v.Op = OpWasmF64Copysign 95 return true 96 case OpCtz16: 97 return rewriteValueWasm_OpCtz16(v) 98 case OpCtz16NonZero: 99 v.Op = OpWasmI64Ctz 100 return true 101 case OpCtz32: 102 return rewriteValueWasm_OpCtz32(v) 103 case OpCtz32NonZero: 104 v.Op = OpWasmI64Ctz 105 return true 106 case OpCtz64: 107 v.Op = OpWasmI64Ctz 108 return true 109 case OpCtz64NonZero: 110 v.Op = OpWasmI64Ctz 111 return true 112 case OpCtz8: 113 return rewriteValueWasm_OpCtz8(v) 114 case OpCtz8NonZero: 115 v.Op = OpWasmI64Ctz 116 return true 117 case OpCvt32Fto32: 118 v.Op = OpWasmI64TruncSatF32S 119 return true 120 case OpCvt32Fto32U: 121 v.Op = OpWasmI64TruncSatF32U 122 return true 123 case OpCvt32Fto64: 124 v.Op = OpWasmI64TruncSatF32S 125 return true 126 case OpCvt32Fto64F: 127 v.Op = OpWasmF64PromoteF32 128 return true 129 case OpCvt32Fto64U: 130 v.Op = OpWasmI64TruncSatF32U 131 return true 132 case OpCvt32Uto32F: 133 return rewriteValueWasm_OpCvt32Uto32F(v) 134 case OpCvt32Uto64F: 135 return rewriteValueWasm_OpCvt32Uto64F(v) 136 case OpCvt32to32F: 137 return rewriteValueWasm_OpCvt32to32F(v) 138 case OpCvt32to64F: 139 return rewriteValueWasm_OpCvt32to64F(v) 140 case OpCvt64Fto32: 141 v.Op = OpWasmI64TruncSatF64S 142 return true 143 case OpCvt64Fto32F: 144 v.Op = OpWasmF32DemoteF64 145 return true 146 case OpCvt64Fto32U: 147 v.Op = OpWasmI64TruncSatF64U 148 return true 149 case OpCvt64Fto64: 150 v.Op = OpWasmI64TruncSatF64S 151 return true 152 case OpCvt64Fto64U: 153 v.Op = OpWasmI64TruncSatF64U 154 return true 155 case OpCvt64Uto32F: 156 v.Op = OpWasmF32ConvertI64U 157 return true 158 case OpCvt64Uto64F: 159 v.Op = OpWasmF64ConvertI64U 160 return true 161 case OpCvt64to32F: 162 v.Op = OpWasmF32ConvertI64S 163 return true 164 case OpCvt64to64F: 165 v.Op = OpWasmF64ConvertI64S 166 return true 167 case OpCvtBoolToUint8: 168 v.Op = OpCopy 169 return true 170 case OpDiv16: 171 return rewriteValueWasm_OpDiv16(v) 172 case OpDiv16u: 173 return rewriteValueWasm_OpDiv16u(v) 174 case OpDiv32: 175 return rewriteValueWasm_OpDiv32(v) 176 case OpDiv32F: 177 v.Op = OpWasmF32Div 178 return true 179 case OpDiv32u: 180 return rewriteValueWasm_OpDiv32u(v) 181 case OpDiv64: 182 return rewriteValueWasm_OpDiv64(v) 183 case OpDiv64F: 184 v.Op = OpWasmF64Div 185 return true 186 case OpDiv64u: 187 v.Op = OpWasmI64DivU 188 return true 189 case OpDiv8: 190 return rewriteValueWasm_OpDiv8(v) 191 case OpDiv8u: 192 return rewriteValueWasm_OpDiv8u(v) 193 case OpEq16: 194 return rewriteValueWasm_OpEq16(v) 195 case OpEq32: 196 return rewriteValueWasm_OpEq32(v) 197 case OpEq32F: 198 v.Op = OpWasmF32Eq 199 return true 200 case OpEq64: 201 v.Op = OpWasmI64Eq 202 return true 203 case OpEq64F: 204 v.Op = OpWasmF64Eq 205 return true 206 case OpEq8: 207 return rewriteValueWasm_OpEq8(v) 208 case OpEqB: 209 v.Op = OpWasmI64Eq 210 return true 211 case OpEqPtr: 212 v.Op = OpWasmI64Eq 213 return true 214 case OpFloor: 215 v.Op = OpWasmF64Floor 216 return true 217 case OpGetCallerPC: 218 v.Op = OpWasmLoweredGetCallerPC 219 return true 220 case OpGetCallerSP: 221 v.Op = OpWasmLoweredGetCallerSP 222 return true 223 case OpGetClosurePtr: 224 v.Op = OpWasmLoweredGetClosurePtr 225 return true 226 case OpInterCall: 227 v.Op = OpWasmLoweredInterCall 228 return true 229 case OpIsInBounds: 230 v.Op = OpWasmI64LtU 231 return true 232 case OpIsNonNil: 233 return rewriteValueWasm_OpIsNonNil(v) 234 case OpIsSliceInBounds: 235 v.Op = OpWasmI64LeU 236 return true 237 case OpLeq16: 238 return rewriteValueWasm_OpLeq16(v) 239 case OpLeq16U: 240 return rewriteValueWasm_OpLeq16U(v) 241 case OpLeq32: 242 return rewriteValueWasm_OpLeq32(v) 243 case OpLeq32F: 244 v.Op = OpWasmF32Le 245 return true 246 case OpLeq32U: 247 return rewriteValueWasm_OpLeq32U(v) 248 case OpLeq64: 249 v.Op = OpWasmI64LeS 250 return true 251 case OpLeq64F: 252 v.Op = OpWasmF64Le 253 return true 254 case OpLeq64U: 255 v.Op = OpWasmI64LeU 256 return true 257 case OpLeq8: 258 return rewriteValueWasm_OpLeq8(v) 259 case OpLeq8U: 260 return rewriteValueWasm_OpLeq8U(v) 261 case OpLess16: 262 return rewriteValueWasm_OpLess16(v) 263 case OpLess16U: 264 return rewriteValueWasm_OpLess16U(v) 265 case OpLess32: 266 return rewriteValueWasm_OpLess32(v) 267 case OpLess32F: 268 v.Op = OpWasmF32Lt 269 return true 270 case OpLess32U: 271 return rewriteValueWasm_OpLess32U(v) 272 case OpLess64: 273 v.Op = OpWasmI64LtS 274 return true 275 case OpLess64F: 276 v.Op = OpWasmF64Lt 277 return true 278 case OpLess64U: 279 v.Op = OpWasmI64LtU 280 return true 281 case OpLess8: 282 return rewriteValueWasm_OpLess8(v) 283 case OpLess8U: 284 return rewriteValueWasm_OpLess8U(v) 285 case OpLoad: 286 return rewriteValueWasm_OpLoad(v) 287 case OpLocalAddr: 288 return rewriteValueWasm_OpLocalAddr(v) 289 case OpLsh16x16: 290 return rewriteValueWasm_OpLsh16x16(v) 291 case OpLsh16x32: 292 return rewriteValueWasm_OpLsh16x32(v) 293 case OpLsh16x64: 294 v.Op = OpLsh64x64 295 return true 296 case OpLsh16x8: 297 return rewriteValueWasm_OpLsh16x8(v) 298 case OpLsh32x16: 299 return rewriteValueWasm_OpLsh32x16(v) 300 case OpLsh32x32: 301 return rewriteValueWasm_OpLsh32x32(v) 302 case OpLsh32x64: 303 v.Op = OpLsh64x64 304 return true 305 case OpLsh32x8: 306 return rewriteValueWasm_OpLsh32x8(v) 307 case OpLsh64x16: 308 return rewriteValueWasm_OpLsh64x16(v) 309 case OpLsh64x32: 310 return rewriteValueWasm_OpLsh64x32(v) 311 case OpLsh64x64: 312 return rewriteValueWasm_OpLsh64x64(v) 313 case OpLsh64x8: 314 return rewriteValueWasm_OpLsh64x8(v) 315 case OpLsh8x16: 316 return rewriteValueWasm_OpLsh8x16(v) 317 case OpLsh8x32: 318 return rewriteValueWasm_OpLsh8x32(v) 319 case OpLsh8x64: 320 v.Op = OpLsh64x64 321 return true 322 case OpLsh8x8: 323 return rewriteValueWasm_OpLsh8x8(v) 324 case OpMod16: 325 return rewriteValueWasm_OpMod16(v) 326 case OpMod16u: 327 return rewriteValueWasm_OpMod16u(v) 328 case OpMod32: 329 return rewriteValueWasm_OpMod32(v) 330 case OpMod32u: 331 return rewriteValueWasm_OpMod32u(v) 332 case OpMod64: 333 return rewriteValueWasm_OpMod64(v) 334 case OpMod64u: 335 v.Op = OpWasmI64RemU 336 return true 337 case OpMod8: 338 return rewriteValueWasm_OpMod8(v) 339 case OpMod8u: 340 return rewriteValueWasm_OpMod8u(v) 341 case OpMove: 342 return rewriteValueWasm_OpMove(v) 343 case OpMul16: 344 v.Op = OpWasmI64Mul 345 return true 346 case OpMul32: 347 v.Op = OpWasmI64Mul 348 return true 349 case OpMul32F: 350 v.Op = OpWasmF32Mul 351 return true 352 case OpMul64: 353 v.Op = OpWasmI64Mul 354 return true 355 case OpMul64F: 356 v.Op = OpWasmF64Mul 357 return true 358 case OpMul8: 359 v.Op = OpWasmI64Mul 360 return true 361 case OpNeg16: 362 return rewriteValueWasm_OpNeg16(v) 363 case OpNeg32: 364 return rewriteValueWasm_OpNeg32(v) 365 case OpNeg32F: 366 v.Op = OpWasmF32Neg 367 return true 368 case OpNeg64: 369 return rewriteValueWasm_OpNeg64(v) 370 case OpNeg64F: 371 v.Op = OpWasmF64Neg 372 return true 373 case OpNeg8: 374 return rewriteValueWasm_OpNeg8(v) 375 case OpNeq16: 376 return rewriteValueWasm_OpNeq16(v) 377 case OpNeq32: 378 return rewriteValueWasm_OpNeq32(v) 379 case OpNeq32F: 380 v.Op = OpWasmF32Ne 381 return true 382 case OpNeq64: 383 v.Op = OpWasmI64Ne 384 return true 385 case OpNeq64F: 386 v.Op = OpWasmF64Ne 387 return true 388 case OpNeq8: 389 return rewriteValueWasm_OpNeq8(v) 390 case OpNeqB: 391 v.Op = OpWasmI64Ne 392 return true 393 case OpNeqPtr: 394 v.Op = OpWasmI64Ne 395 return true 396 case OpNilCheck: 397 v.Op = OpWasmLoweredNilCheck 398 return true 399 case OpNot: 400 v.Op = OpWasmI64Eqz 401 return true 402 case OpOffPtr: 403 v.Op = OpWasmI64AddConst 404 return true 405 case OpOr16: 406 v.Op = OpWasmI64Or 407 return true 408 case OpOr32: 409 v.Op = OpWasmI64Or 410 return true 411 case OpOr64: 412 v.Op = OpWasmI64Or 413 return true 414 case OpOr8: 415 v.Op = OpWasmI64Or 416 return true 417 case OpOrB: 418 v.Op = OpWasmI64Or 419 return true 420 case OpPopCount16: 421 return rewriteValueWasm_OpPopCount16(v) 422 case OpPopCount32: 423 return rewriteValueWasm_OpPopCount32(v) 424 case OpPopCount64: 425 v.Op = OpWasmI64Popcnt 426 return true 427 case OpPopCount8: 428 return rewriteValueWasm_OpPopCount8(v) 429 case OpRotateLeft16: 430 return rewriteValueWasm_OpRotateLeft16(v) 431 case OpRotateLeft32: 432 v.Op = OpWasmI32Rotl 433 return true 434 case OpRotateLeft64: 435 v.Op = OpWasmI64Rotl 436 return true 437 case OpRotateLeft8: 438 return rewriteValueWasm_OpRotateLeft8(v) 439 case OpRound32F: 440 v.Op = OpCopy 441 return true 442 case OpRound64F: 443 v.Op = OpCopy 444 return true 445 case OpRoundToEven: 446 v.Op = OpWasmF64Nearest 447 return true 448 case OpRsh16Ux16: 449 return rewriteValueWasm_OpRsh16Ux16(v) 450 case OpRsh16Ux32: 451 return rewriteValueWasm_OpRsh16Ux32(v) 452 case OpRsh16Ux64: 453 return rewriteValueWasm_OpRsh16Ux64(v) 454 case OpRsh16Ux8: 455 return rewriteValueWasm_OpRsh16Ux8(v) 456 case OpRsh16x16: 457 return rewriteValueWasm_OpRsh16x16(v) 458 case OpRsh16x32: 459 return rewriteValueWasm_OpRsh16x32(v) 460 case OpRsh16x64: 461 return rewriteValueWasm_OpRsh16x64(v) 462 case OpRsh16x8: 463 return rewriteValueWasm_OpRsh16x8(v) 464 case OpRsh32Ux16: 465 return rewriteValueWasm_OpRsh32Ux16(v) 466 case OpRsh32Ux32: 467 return rewriteValueWasm_OpRsh32Ux32(v) 468 case OpRsh32Ux64: 469 return rewriteValueWasm_OpRsh32Ux64(v) 470 case OpRsh32Ux8: 471 return rewriteValueWasm_OpRsh32Ux8(v) 472 case OpRsh32x16: 473 return rewriteValueWasm_OpRsh32x16(v) 474 case OpRsh32x32: 475 return rewriteValueWasm_OpRsh32x32(v) 476 case OpRsh32x64: 477 return rewriteValueWasm_OpRsh32x64(v) 478 case OpRsh32x8: 479 return rewriteValueWasm_OpRsh32x8(v) 480 case OpRsh64Ux16: 481 return rewriteValueWasm_OpRsh64Ux16(v) 482 case OpRsh64Ux32: 483 return rewriteValueWasm_OpRsh64Ux32(v) 484 case OpRsh64Ux64: 485 return rewriteValueWasm_OpRsh64Ux64(v) 486 case OpRsh64Ux8: 487 return rewriteValueWasm_OpRsh64Ux8(v) 488 case OpRsh64x16: 489 return rewriteValueWasm_OpRsh64x16(v) 490 case OpRsh64x32: 491 return rewriteValueWasm_OpRsh64x32(v) 492 case OpRsh64x64: 493 return rewriteValueWasm_OpRsh64x64(v) 494 case OpRsh64x8: 495 return rewriteValueWasm_OpRsh64x8(v) 496 case OpRsh8Ux16: 497 return rewriteValueWasm_OpRsh8Ux16(v) 498 case OpRsh8Ux32: 499 return rewriteValueWasm_OpRsh8Ux32(v) 500 case OpRsh8Ux64: 501 return rewriteValueWasm_OpRsh8Ux64(v) 502 case OpRsh8Ux8: 503 return rewriteValueWasm_OpRsh8Ux8(v) 504 case OpRsh8x16: 505 return rewriteValueWasm_OpRsh8x16(v) 506 case OpRsh8x32: 507 return rewriteValueWasm_OpRsh8x32(v) 508 case OpRsh8x64: 509 return rewriteValueWasm_OpRsh8x64(v) 510 case OpRsh8x8: 511 return rewriteValueWasm_OpRsh8x8(v) 512 case OpSignExt16to32: 513 return rewriteValueWasm_OpSignExt16to32(v) 514 case OpSignExt16to64: 515 return rewriteValueWasm_OpSignExt16to64(v) 516 case OpSignExt32to64: 517 return rewriteValueWasm_OpSignExt32to64(v) 518 case OpSignExt8to16: 519 return rewriteValueWasm_OpSignExt8to16(v) 520 case OpSignExt8to32: 521 return rewriteValueWasm_OpSignExt8to32(v) 522 case OpSignExt8to64: 523 return rewriteValueWasm_OpSignExt8to64(v) 524 case OpSlicemask: 525 return rewriteValueWasm_OpSlicemask(v) 526 case OpSqrt: 527 v.Op = OpWasmF64Sqrt 528 return true 529 case OpSqrt32: 530 v.Op = OpWasmF32Sqrt 531 return true 532 case OpStaticCall: 533 v.Op = OpWasmLoweredStaticCall 534 return true 535 case OpStore: 536 return rewriteValueWasm_OpStore(v) 537 case OpSub16: 538 v.Op = OpWasmI64Sub 539 return true 540 case OpSub32: 541 v.Op = OpWasmI64Sub 542 return true 543 case OpSub32F: 544 v.Op = OpWasmF32Sub 545 return true 546 case OpSub64: 547 v.Op = OpWasmI64Sub 548 return true 549 case OpSub64F: 550 v.Op = OpWasmF64Sub 551 return true 552 case OpSub8: 553 v.Op = OpWasmI64Sub 554 return true 555 case OpSubPtr: 556 v.Op = OpWasmI64Sub 557 return true 558 case OpTailCall: 559 v.Op = OpWasmLoweredTailCall 560 return true 561 case OpTrunc: 562 v.Op = OpWasmF64Trunc 563 return true 564 case OpTrunc16to8: 565 v.Op = OpCopy 566 return true 567 case OpTrunc32to16: 568 v.Op = OpCopy 569 return true 570 case OpTrunc32to8: 571 v.Op = OpCopy 572 return true 573 case OpTrunc64to16: 574 v.Op = OpCopy 575 return true 576 case OpTrunc64to32: 577 v.Op = OpCopy 578 return true 579 case OpTrunc64to8: 580 v.Op = OpCopy 581 return true 582 case OpWB: 583 v.Op = OpWasmLoweredWB 584 return true 585 case OpWasmF64Add: 586 return rewriteValueWasm_OpWasmF64Add(v) 587 case OpWasmF64Mul: 588 return rewriteValueWasm_OpWasmF64Mul(v) 589 case OpWasmI64Add: 590 return rewriteValueWasm_OpWasmI64Add(v) 591 case OpWasmI64AddConst: 592 return rewriteValueWasm_OpWasmI64AddConst(v) 593 case OpWasmI64And: 594 return rewriteValueWasm_OpWasmI64And(v) 595 case OpWasmI64Eq: 596 return rewriteValueWasm_OpWasmI64Eq(v) 597 case OpWasmI64Eqz: 598 return rewriteValueWasm_OpWasmI64Eqz(v) 599 case OpWasmI64LeU: 600 return rewriteValueWasm_OpWasmI64LeU(v) 601 case OpWasmI64Load: 602 return rewriteValueWasm_OpWasmI64Load(v) 603 case OpWasmI64Load16S: 604 return rewriteValueWasm_OpWasmI64Load16S(v) 605 case OpWasmI64Load16U: 606 return rewriteValueWasm_OpWasmI64Load16U(v) 607 case OpWasmI64Load32S: 608 return rewriteValueWasm_OpWasmI64Load32S(v) 609 case OpWasmI64Load32U: 610 return rewriteValueWasm_OpWasmI64Load32U(v) 611 case OpWasmI64Load8S: 612 return rewriteValueWasm_OpWasmI64Load8S(v) 613 case OpWasmI64Load8U: 614 return rewriteValueWasm_OpWasmI64Load8U(v) 615 case OpWasmI64LtU: 616 return rewriteValueWasm_OpWasmI64LtU(v) 617 case OpWasmI64Mul: 618 return rewriteValueWasm_OpWasmI64Mul(v) 619 case OpWasmI64Ne: 620 return rewriteValueWasm_OpWasmI64Ne(v) 621 case OpWasmI64Or: 622 return rewriteValueWasm_OpWasmI64Or(v) 623 case OpWasmI64Shl: 624 return rewriteValueWasm_OpWasmI64Shl(v) 625 case OpWasmI64ShrS: 626 return rewriteValueWasm_OpWasmI64ShrS(v) 627 case OpWasmI64ShrU: 628 return rewriteValueWasm_OpWasmI64ShrU(v) 629 case OpWasmI64Store: 630 return rewriteValueWasm_OpWasmI64Store(v) 631 case OpWasmI64Store16: 632 return rewriteValueWasm_OpWasmI64Store16(v) 633 case OpWasmI64Store32: 634 return rewriteValueWasm_OpWasmI64Store32(v) 635 case OpWasmI64Store8: 636 return rewriteValueWasm_OpWasmI64Store8(v) 637 case OpWasmI64Xor: 638 return rewriteValueWasm_OpWasmI64Xor(v) 639 case OpXor16: 640 v.Op = OpWasmI64Xor 641 return true 642 case OpXor32: 643 v.Op = OpWasmI64Xor 644 return true 645 case OpXor64: 646 v.Op = OpWasmI64Xor 647 return true 648 case OpXor8: 649 v.Op = OpWasmI64Xor 650 return true 651 case OpZero: 652 return rewriteValueWasm_OpZero(v) 653 case OpZeroExt16to32: 654 return rewriteValueWasm_OpZeroExt16to32(v) 655 case OpZeroExt16to64: 656 return rewriteValueWasm_OpZeroExt16to64(v) 657 case OpZeroExt32to64: 658 return rewriteValueWasm_OpZeroExt32to64(v) 659 case OpZeroExt8to16: 660 return rewriteValueWasm_OpZeroExt8to16(v) 661 case OpZeroExt8to32: 662 return rewriteValueWasm_OpZeroExt8to32(v) 663 case OpZeroExt8to64: 664 return rewriteValueWasm_OpZeroExt8to64(v) 665 } 666 return false 667 } 668 func rewriteValueWasm_OpAddr(v *Value) bool { 669 v_0 := v.Args[0] 670 // match: (Addr {sym} base) 671 // result: (LoweredAddr {sym} [0] base) 672 for { 673 sym := auxToSym(v.Aux) 674 base := v_0 675 v.reset(OpWasmLoweredAddr) 676 v.AuxInt = int32ToAuxInt(0) 677 v.Aux = symToAux(sym) 678 v.AddArg(base) 679 return true 680 } 681 } 682 func rewriteValueWasm_OpBitLen64(v *Value) bool { 683 v_0 := v.Args[0] 684 b := v.Block 685 typ := &b.Func.Config.Types 686 // match: (BitLen64 x) 687 // result: (I64Sub (I64Const [64]) (I64Clz x)) 688 for { 689 x := v_0 690 v.reset(OpWasmI64Sub) 691 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 692 v0.AuxInt = int64ToAuxInt(64) 693 v1 := b.NewValue0(v.Pos, OpWasmI64Clz, typ.Int64) 694 v1.AddArg(x) 695 v.AddArg2(v0, v1) 696 return true 697 } 698 } 699 func rewriteValueWasm_OpCom16(v *Value) bool { 700 v_0 := v.Args[0] 701 b := v.Block 702 typ := &b.Func.Config.Types 703 // match: (Com16 x) 704 // result: (I64Xor x (I64Const [-1])) 705 for { 706 x := v_0 707 v.reset(OpWasmI64Xor) 708 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 709 v0.AuxInt = int64ToAuxInt(-1) 710 v.AddArg2(x, v0) 711 return true 712 } 713 } 714 func rewriteValueWasm_OpCom32(v *Value) bool { 715 v_0 := v.Args[0] 716 b := v.Block 717 typ := &b.Func.Config.Types 718 // match: (Com32 x) 719 // result: (I64Xor x (I64Const [-1])) 720 for { 721 x := v_0 722 v.reset(OpWasmI64Xor) 723 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 724 v0.AuxInt = int64ToAuxInt(-1) 725 v.AddArg2(x, v0) 726 return true 727 } 728 } 729 func rewriteValueWasm_OpCom64(v *Value) bool { 730 v_0 := v.Args[0] 731 b := v.Block 732 typ := &b.Func.Config.Types 733 // match: (Com64 x) 734 // result: (I64Xor x (I64Const [-1])) 735 for { 736 x := v_0 737 v.reset(OpWasmI64Xor) 738 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 739 v0.AuxInt = int64ToAuxInt(-1) 740 v.AddArg2(x, v0) 741 return true 742 } 743 } 744 func rewriteValueWasm_OpCom8(v *Value) bool { 745 v_0 := v.Args[0] 746 b := v.Block 747 typ := &b.Func.Config.Types 748 // match: (Com8 x) 749 // result: (I64Xor x (I64Const [-1])) 750 for { 751 x := v_0 752 v.reset(OpWasmI64Xor) 753 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 754 v0.AuxInt = int64ToAuxInt(-1) 755 v.AddArg2(x, v0) 756 return true 757 } 758 } 759 func rewriteValueWasm_OpConst16(v *Value) bool { 760 // match: (Const16 [c]) 761 // result: (I64Const [int64(c)]) 762 for { 763 c := auxIntToInt16(v.AuxInt) 764 v.reset(OpWasmI64Const) 765 v.AuxInt = int64ToAuxInt(int64(c)) 766 return true 767 } 768 } 769 func rewriteValueWasm_OpConst32(v *Value) bool { 770 // match: (Const32 [c]) 771 // result: (I64Const [int64(c)]) 772 for { 773 c := auxIntToInt32(v.AuxInt) 774 v.reset(OpWasmI64Const) 775 v.AuxInt = int64ToAuxInt(int64(c)) 776 return true 777 } 778 } 779 func rewriteValueWasm_OpConst8(v *Value) bool { 780 // match: (Const8 [c]) 781 // result: (I64Const [int64(c)]) 782 for { 783 c := auxIntToInt8(v.AuxInt) 784 v.reset(OpWasmI64Const) 785 v.AuxInt = int64ToAuxInt(int64(c)) 786 return true 787 } 788 } 789 func rewriteValueWasm_OpConstBool(v *Value) bool { 790 // match: (ConstBool [c]) 791 // result: (I64Const [b2i(c)]) 792 for { 793 c := auxIntToBool(v.AuxInt) 794 v.reset(OpWasmI64Const) 795 v.AuxInt = int64ToAuxInt(b2i(c)) 796 return true 797 } 798 } 799 func rewriteValueWasm_OpConstNil(v *Value) bool { 800 // match: (ConstNil) 801 // result: (I64Const [0]) 802 for { 803 v.reset(OpWasmI64Const) 804 v.AuxInt = int64ToAuxInt(0) 805 return true 806 } 807 } 808 func rewriteValueWasm_OpCtz16(v *Value) bool { 809 v_0 := v.Args[0] 810 b := v.Block 811 typ := &b.Func.Config.Types 812 // match: (Ctz16 x) 813 // result: (I64Ctz (I64Or x (I64Const [0x10000]))) 814 for { 815 x := v_0 816 v.reset(OpWasmI64Ctz) 817 v0 := b.NewValue0(v.Pos, OpWasmI64Or, typ.Int64) 818 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 819 v1.AuxInt = int64ToAuxInt(0x10000) 820 v0.AddArg2(x, v1) 821 v.AddArg(v0) 822 return true 823 } 824 } 825 func rewriteValueWasm_OpCtz32(v *Value) bool { 826 v_0 := v.Args[0] 827 b := v.Block 828 typ := &b.Func.Config.Types 829 // match: (Ctz32 x) 830 // result: (I64Ctz (I64Or x (I64Const [0x100000000]))) 831 for { 832 x := v_0 833 v.reset(OpWasmI64Ctz) 834 v0 := b.NewValue0(v.Pos, OpWasmI64Or, typ.Int64) 835 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 836 v1.AuxInt = int64ToAuxInt(0x100000000) 837 v0.AddArg2(x, v1) 838 v.AddArg(v0) 839 return true 840 } 841 } 842 func rewriteValueWasm_OpCtz8(v *Value) bool { 843 v_0 := v.Args[0] 844 b := v.Block 845 typ := &b.Func.Config.Types 846 // match: (Ctz8 x) 847 // result: (I64Ctz (I64Or x (I64Const [0x100]))) 848 for { 849 x := v_0 850 v.reset(OpWasmI64Ctz) 851 v0 := b.NewValue0(v.Pos, OpWasmI64Or, typ.Int64) 852 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 853 v1.AuxInt = int64ToAuxInt(0x100) 854 v0.AddArg2(x, v1) 855 v.AddArg(v0) 856 return true 857 } 858 } 859 func rewriteValueWasm_OpCvt32Uto32F(v *Value) bool { 860 v_0 := v.Args[0] 861 b := v.Block 862 typ := &b.Func.Config.Types 863 // match: (Cvt32Uto32F x) 864 // result: (F32ConvertI64U (ZeroExt32to64 x)) 865 for { 866 x := v_0 867 v.reset(OpWasmF32ConvertI64U) 868 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 869 v0.AddArg(x) 870 v.AddArg(v0) 871 return true 872 } 873 } 874 func rewriteValueWasm_OpCvt32Uto64F(v *Value) bool { 875 v_0 := v.Args[0] 876 b := v.Block 877 typ := &b.Func.Config.Types 878 // match: (Cvt32Uto64F x) 879 // result: (F64ConvertI64U (ZeroExt32to64 x)) 880 for { 881 x := v_0 882 v.reset(OpWasmF64ConvertI64U) 883 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 884 v0.AddArg(x) 885 v.AddArg(v0) 886 return true 887 } 888 } 889 func rewriteValueWasm_OpCvt32to32F(v *Value) bool { 890 v_0 := v.Args[0] 891 b := v.Block 892 typ := &b.Func.Config.Types 893 // match: (Cvt32to32F x) 894 // result: (F32ConvertI64S (SignExt32to64 x)) 895 for { 896 x := v_0 897 v.reset(OpWasmF32ConvertI64S) 898 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 899 v0.AddArg(x) 900 v.AddArg(v0) 901 return true 902 } 903 } 904 func rewriteValueWasm_OpCvt32to64F(v *Value) bool { 905 v_0 := v.Args[0] 906 b := v.Block 907 typ := &b.Func.Config.Types 908 // match: (Cvt32to64F x) 909 // result: (F64ConvertI64S (SignExt32to64 x)) 910 for { 911 x := v_0 912 v.reset(OpWasmF64ConvertI64S) 913 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 914 v0.AddArg(x) 915 v.AddArg(v0) 916 return true 917 } 918 } 919 func rewriteValueWasm_OpDiv16(v *Value) bool { 920 v_1 := v.Args[1] 921 v_0 := v.Args[0] 922 b := v.Block 923 typ := &b.Func.Config.Types 924 // match: (Div16 [false] x y) 925 // result: (I64DivS (SignExt16to64 x) (SignExt16to64 y)) 926 for { 927 if auxIntToBool(v.AuxInt) != false { 928 break 929 } 930 x := v_0 931 y := v_1 932 v.reset(OpWasmI64DivS) 933 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 934 v0.AddArg(x) 935 v1 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 936 v1.AddArg(y) 937 v.AddArg2(v0, v1) 938 return true 939 } 940 return false 941 } 942 func rewriteValueWasm_OpDiv16u(v *Value) bool { 943 v_1 := v.Args[1] 944 v_0 := v.Args[0] 945 b := v.Block 946 typ := &b.Func.Config.Types 947 // match: (Div16u x y) 948 // result: (I64DivU (ZeroExt16to64 x) (ZeroExt16to64 y)) 949 for { 950 x := v_0 951 y := v_1 952 v.reset(OpWasmI64DivU) 953 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 954 v0.AddArg(x) 955 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 956 v1.AddArg(y) 957 v.AddArg2(v0, v1) 958 return true 959 } 960 } 961 func rewriteValueWasm_OpDiv32(v *Value) bool { 962 v_1 := v.Args[1] 963 v_0 := v.Args[0] 964 b := v.Block 965 typ := &b.Func.Config.Types 966 // match: (Div32 [false] x y) 967 // result: (I64DivS (SignExt32to64 x) (SignExt32to64 y)) 968 for { 969 if auxIntToBool(v.AuxInt) != false { 970 break 971 } 972 x := v_0 973 y := v_1 974 v.reset(OpWasmI64DivS) 975 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 976 v0.AddArg(x) 977 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 978 v1.AddArg(y) 979 v.AddArg2(v0, v1) 980 return true 981 } 982 return false 983 } 984 func rewriteValueWasm_OpDiv32u(v *Value) bool { 985 v_1 := v.Args[1] 986 v_0 := v.Args[0] 987 b := v.Block 988 typ := &b.Func.Config.Types 989 // match: (Div32u x y) 990 // result: (I64DivU (ZeroExt32to64 x) (ZeroExt32to64 y)) 991 for { 992 x := v_0 993 y := v_1 994 v.reset(OpWasmI64DivU) 995 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 996 v0.AddArg(x) 997 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 998 v1.AddArg(y) 999 v.AddArg2(v0, v1) 1000 return true 1001 } 1002 } 1003 func rewriteValueWasm_OpDiv64(v *Value) bool { 1004 v_1 := v.Args[1] 1005 v_0 := v.Args[0] 1006 // match: (Div64 [false] x y) 1007 // result: (I64DivS x y) 1008 for { 1009 if auxIntToBool(v.AuxInt) != false { 1010 break 1011 } 1012 x := v_0 1013 y := v_1 1014 v.reset(OpWasmI64DivS) 1015 v.AddArg2(x, y) 1016 return true 1017 } 1018 return false 1019 } 1020 func rewriteValueWasm_OpDiv8(v *Value) bool { 1021 v_1 := v.Args[1] 1022 v_0 := v.Args[0] 1023 b := v.Block 1024 typ := &b.Func.Config.Types 1025 // match: (Div8 x y) 1026 // result: (I64DivS (SignExt8to64 x) (SignExt8to64 y)) 1027 for { 1028 x := v_0 1029 y := v_1 1030 v.reset(OpWasmI64DivS) 1031 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1032 v0.AddArg(x) 1033 v1 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1034 v1.AddArg(y) 1035 v.AddArg2(v0, v1) 1036 return true 1037 } 1038 } 1039 func rewriteValueWasm_OpDiv8u(v *Value) bool { 1040 v_1 := v.Args[1] 1041 v_0 := v.Args[0] 1042 b := v.Block 1043 typ := &b.Func.Config.Types 1044 // match: (Div8u x y) 1045 // result: (I64DivU (ZeroExt8to64 x) (ZeroExt8to64 y)) 1046 for { 1047 x := v_0 1048 y := v_1 1049 v.reset(OpWasmI64DivU) 1050 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1051 v0.AddArg(x) 1052 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1053 v1.AddArg(y) 1054 v.AddArg2(v0, v1) 1055 return true 1056 } 1057 } 1058 func rewriteValueWasm_OpEq16(v *Value) bool { 1059 v_1 := v.Args[1] 1060 v_0 := v.Args[0] 1061 b := v.Block 1062 typ := &b.Func.Config.Types 1063 // match: (Eq16 x y) 1064 // result: (I64Eq (ZeroExt16to64 x) (ZeroExt16to64 y)) 1065 for { 1066 x := v_0 1067 y := v_1 1068 v.reset(OpWasmI64Eq) 1069 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1070 v0.AddArg(x) 1071 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1072 v1.AddArg(y) 1073 v.AddArg2(v0, v1) 1074 return true 1075 } 1076 } 1077 func rewriteValueWasm_OpEq32(v *Value) bool { 1078 v_1 := v.Args[1] 1079 v_0 := v.Args[0] 1080 b := v.Block 1081 typ := &b.Func.Config.Types 1082 // match: (Eq32 x y) 1083 // result: (I64Eq (ZeroExt32to64 x) (ZeroExt32to64 y)) 1084 for { 1085 x := v_0 1086 y := v_1 1087 v.reset(OpWasmI64Eq) 1088 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1089 v0.AddArg(x) 1090 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1091 v1.AddArg(y) 1092 v.AddArg2(v0, v1) 1093 return true 1094 } 1095 } 1096 func rewriteValueWasm_OpEq8(v *Value) bool { 1097 v_1 := v.Args[1] 1098 v_0 := v.Args[0] 1099 b := v.Block 1100 typ := &b.Func.Config.Types 1101 // match: (Eq8 x y) 1102 // result: (I64Eq (ZeroExt8to64 x) (ZeroExt8to64 y)) 1103 for { 1104 x := v_0 1105 y := v_1 1106 v.reset(OpWasmI64Eq) 1107 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1108 v0.AddArg(x) 1109 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1110 v1.AddArg(y) 1111 v.AddArg2(v0, v1) 1112 return true 1113 } 1114 } 1115 func rewriteValueWasm_OpIsNonNil(v *Value) bool { 1116 v_0 := v.Args[0] 1117 b := v.Block 1118 typ := &b.Func.Config.Types 1119 // match: (IsNonNil p) 1120 // result: (I64Eqz (I64Eqz p)) 1121 for { 1122 p := v_0 1123 v.reset(OpWasmI64Eqz) 1124 v0 := b.NewValue0(v.Pos, OpWasmI64Eqz, typ.Bool) 1125 v0.AddArg(p) 1126 v.AddArg(v0) 1127 return true 1128 } 1129 } 1130 func rewriteValueWasm_OpLeq16(v *Value) bool { 1131 v_1 := v.Args[1] 1132 v_0 := v.Args[0] 1133 b := v.Block 1134 typ := &b.Func.Config.Types 1135 // match: (Leq16 x y) 1136 // result: (I64LeS (SignExt16to64 x) (SignExt16to64 y)) 1137 for { 1138 x := v_0 1139 y := v_1 1140 v.reset(OpWasmI64LeS) 1141 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 1142 v0.AddArg(x) 1143 v1 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 1144 v1.AddArg(y) 1145 v.AddArg2(v0, v1) 1146 return true 1147 } 1148 } 1149 func rewriteValueWasm_OpLeq16U(v *Value) bool { 1150 v_1 := v.Args[1] 1151 v_0 := v.Args[0] 1152 b := v.Block 1153 typ := &b.Func.Config.Types 1154 // match: (Leq16U x y) 1155 // result: (I64LeU (ZeroExt16to64 x) (ZeroExt16to64 y)) 1156 for { 1157 x := v_0 1158 y := v_1 1159 v.reset(OpWasmI64LeU) 1160 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1161 v0.AddArg(x) 1162 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1163 v1.AddArg(y) 1164 v.AddArg2(v0, v1) 1165 return true 1166 } 1167 } 1168 func rewriteValueWasm_OpLeq32(v *Value) bool { 1169 v_1 := v.Args[1] 1170 v_0 := v.Args[0] 1171 b := v.Block 1172 typ := &b.Func.Config.Types 1173 // match: (Leq32 x y) 1174 // result: (I64LeS (SignExt32to64 x) (SignExt32to64 y)) 1175 for { 1176 x := v_0 1177 y := v_1 1178 v.reset(OpWasmI64LeS) 1179 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1180 v0.AddArg(x) 1181 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1182 v1.AddArg(y) 1183 v.AddArg2(v0, v1) 1184 return true 1185 } 1186 } 1187 func rewriteValueWasm_OpLeq32U(v *Value) bool { 1188 v_1 := v.Args[1] 1189 v_0 := v.Args[0] 1190 b := v.Block 1191 typ := &b.Func.Config.Types 1192 // match: (Leq32U x y) 1193 // result: (I64LeU (ZeroExt32to64 x) (ZeroExt32to64 y)) 1194 for { 1195 x := v_0 1196 y := v_1 1197 v.reset(OpWasmI64LeU) 1198 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1199 v0.AddArg(x) 1200 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1201 v1.AddArg(y) 1202 v.AddArg2(v0, v1) 1203 return true 1204 } 1205 } 1206 func rewriteValueWasm_OpLeq8(v *Value) bool { 1207 v_1 := v.Args[1] 1208 v_0 := v.Args[0] 1209 b := v.Block 1210 typ := &b.Func.Config.Types 1211 // match: (Leq8 x y) 1212 // result: (I64LeS (SignExt8to64 x) (SignExt8to64 y)) 1213 for { 1214 x := v_0 1215 y := v_1 1216 v.reset(OpWasmI64LeS) 1217 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1218 v0.AddArg(x) 1219 v1 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1220 v1.AddArg(y) 1221 v.AddArg2(v0, v1) 1222 return true 1223 } 1224 } 1225 func rewriteValueWasm_OpLeq8U(v *Value) bool { 1226 v_1 := v.Args[1] 1227 v_0 := v.Args[0] 1228 b := v.Block 1229 typ := &b.Func.Config.Types 1230 // match: (Leq8U x y) 1231 // result: (I64LeU (ZeroExt8to64 x) (ZeroExt8to64 y)) 1232 for { 1233 x := v_0 1234 y := v_1 1235 v.reset(OpWasmI64LeU) 1236 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1237 v0.AddArg(x) 1238 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1239 v1.AddArg(y) 1240 v.AddArg2(v0, v1) 1241 return true 1242 } 1243 } 1244 func rewriteValueWasm_OpLess16(v *Value) bool { 1245 v_1 := v.Args[1] 1246 v_0 := v.Args[0] 1247 b := v.Block 1248 typ := &b.Func.Config.Types 1249 // match: (Less16 x y) 1250 // result: (I64LtS (SignExt16to64 x) (SignExt16to64 y)) 1251 for { 1252 x := v_0 1253 y := v_1 1254 v.reset(OpWasmI64LtS) 1255 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 1256 v0.AddArg(x) 1257 v1 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 1258 v1.AddArg(y) 1259 v.AddArg2(v0, v1) 1260 return true 1261 } 1262 } 1263 func rewriteValueWasm_OpLess16U(v *Value) bool { 1264 v_1 := v.Args[1] 1265 v_0 := v.Args[0] 1266 b := v.Block 1267 typ := &b.Func.Config.Types 1268 // match: (Less16U x y) 1269 // result: (I64LtU (ZeroExt16to64 x) (ZeroExt16to64 y)) 1270 for { 1271 x := v_0 1272 y := v_1 1273 v.reset(OpWasmI64LtU) 1274 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1275 v0.AddArg(x) 1276 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1277 v1.AddArg(y) 1278 v.AddArg2(v0, v1) 1279 return true 1280 } 1281 } 1282 func rewriteValueWasm_OpLess32(v *Value) bool { 1283 v_1 := v.Args[1] 1284 v_0 := v.Args[0] 1285 b := v.Block 1286 typ := &b.Func.Config.Types 1287 // match: (Less32 x y) 1288 // result: (I64LtS (SignExt32to64 x) (SignExt32to64 y)) 1289 for { 1290 x := v_0 1291 y := v_1 1292 v.reset(OpWasmI64LtS) 1293 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1294 v0.AddArg(x) 1295 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1296 v1.AddArg(y) 1297 v.AddArg2(v0, v1) 1298 return true 1299 } 1300 } 1301 func rewriteValueWasm_OpLess32U(v *Value) bool { 1302 v_1 := v.Args[1] 1303 v_0 := v.Args[0] 1304 b := v.Block 1305 typ := &b.Func.Config.Types 1306 // match: (Less32U x y) 1307 // result: (I64LtU (ZeroExt32to64 x) (ZeroExt32to64 y)) 1308 for { 1309 x := v_0 1310 y := v_1 1311 v.reset(OpWasmI64LtU) 1312 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1313 v0.AddArg(x) 1314 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1315 v1.AddArg(y) 1316 v.AddArg2(v0, v1) 1317 return true 1318 } 1319 } 1320 func rewriteValueWasm_OpLess8(v *Value) bool { 1321 v_1 := v.Args[1] 1322 v_0 := v.Args[0] 1323 b := v.Block 1324 typ := &b.Func.Config.Types 1325 // match: (Less8 x y) 1326 // result: (I64LtS (SignExt8to64 x) (SignExt8to64 y)) 1327 for { 1328 x := v_0 1329 y := v_1 1330 v.reset(OpWasmI64LtS) 1331 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1332 v0.AddArg(x) 1333 v1 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1334 v1.AddArg(y) 1335 v.AddArg2(v0, v1) 1336 return true 1337 } 1338 } 1339 func rewriteValueWasm_OpLess8U(v *Value) bool { 1340 v_1 := v.Args[1] 1341 v_0 := v.Args[0] 1342 b := v.Block 1343 typ := &b.Func.Config.Types 1344 // match: (Less8U x y) 1345 // result: (I64LtU (ZeroExt8to64 x) (ZeroExt8to64 y)) 1346 for { 1347 x := v_0 1348 y := v_1 1349 v.reset(OpWasmI64LtU) 1350 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1351 v0.AddArg(x) 1352 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1353 v1.AddArg(y) 1354 v.AddArg2(v0, v1) 1355 return true 1356 } 1357 } 1358 func rewriteValueWasm_OpLoad(v *Value) bool { 1359 v_1 := v.Args[1] 1360 v_0 := v.Args[0] 1361 // match: (Load <t> ptr mem) 1362 // cond: is32BitFloat(t) 1363 // result: (F32Load ptr mem) 1364 for { 1365 t := v.Type 1366 ptr := v_0 1367 mem := v_1 1368 if !(is32BitFloat(t)) { 1369 break 1370 } 1371 v.reset(OpWasmF32Load) 1372 v.AddArg2(ptr, mem) 1373 return true 1374 } 1375 // match: (Load <t> ptr mem) 1376 // cond: is64BitFloat(t) 1377 // result: (F64Load ptr mem) 1378 for { 1379 t := v.Type 1380 ptr := v_0 1381 mem := v_1 1382 if !(is64BitFloat(t)) { 1383 break 1384 } 1385 v.reset(OpWasmF64Load) 1386 v.AddArg2(ptr, mem) 1387 return true 1388 } 1389 // match: (Load <t> ptr mem) 1390 // cond: t.Size() == 8 1391 // result: (I64Load ptr mem) 1392 for { 1393 t := v.Type 1394 ptr := v_0 1395 mem := v_1 1396 if !(t.Size() == 8) { 1397 break 1398 } 1399 v.reset(OpWasmI64Load) 1400 v.AddArg2(ptr, mem) 1401 return true 1402 } 1403 // match: (Load <t> ptr mem) 1404 // cond: t.Size() == 4 && !t.IsSigned() 1405 // result: (I64Load32U ptr mem) 1406 for { 1407 t := v.Type 1408 ptr := v_0 1409 mem := v_1 1410 if !(t.Size() == 4 && !t.IsSigned()) { 1411 break 1412 } 1413 v.reset(OpWasmI64Load32U) 1414 v.AddArg2(ptr, mem) 1415 return true 1416 } 1417 // match: (Load <t> ptr mem) 1418 // cond: t.Size() == 4 && t.IsSigned() 1419 // result: (I64Load32S ptr mem) 1420 for { 1421 t := v.Type 1422 ptr := v_0 1423 mem := v_1 1424 if !(t.Size() == 4 && t.IsSigned()) { 1425 break 1426 } 1427 v.reset(OpWasmI64Load32S) 1428 v.AddArg2(ptr, mem) 1429 return true 1430 } 1431 // match: (Load <t> ptr mem) 1432 // cond: t.Size() == 2 && !t.IsSigned() 1433 // result: (I64Load16U ptr mem) 1434 for { 1435 t := v.Type 1436 ptr := v_0 1437 mem := v_1 1438 if !(t.Size() == 2 && !t.IsSigned()) { 1439 break 1440 } 1441 v.reset(OpWasmI64Load16U) 1442 v.AddArg2(ptr, mem) 1443 return true 1444 } 1445 // match: (Load <t> ptr mem) 1446 // cond: t.Size() == 2 && t.IsSigned() 1447 // result: (I64Load16S ptr mem) 1448 for { 1449 t := v.Type 1450 ptr := v_0 1451 mem := v_1 1452 if !(t.Size() == 2 && t.IsSigned()) { 1453 break 1454 } 1455 v.reset(OpWasmI64Load16S) 1456 v.AddArg2(ptr, mem) 1457 return true 1458 } 1459 // match: (Load <t> ptr mem) 1460 // cond: t.Size() == 1 && !t.IsSigned() 1461 // result: (I64Load8U ptr mem) 1462 for { 1463 t := v.Type 1464 ptr := v_0 1465 mem := v_1 1466 if !(t.Size() == 1 && !t.IsSigned()) { 1467 break 1468 } 1469 v.reset(OpWasmI64Load8U) 1470 v.AddArg2(ptr, mem) 1471 return true 1472 } 1473 // match: (Load <t> ptr mem) 1474 // cond: t.Size() == 1 && t.IsSigned() 1475 // result: (I64Load8S ptr mem) 1476 for { 1477 t := v.Type 1478 ptr := v_0 1479 mem := v_1 1480 if !(t.Size() == 1 && t.IsSigned()) { 1481 break 1482 } 1483 v.reset(OpWasmI64Load8S) 1484 v.AddArg2(ptr, mem) 1485 return true 1486 } 1487 return false 1488 } 1489 func rewriteValueWasm_OpLocalAddr(v *Value) bool { 1490 v_1 := v.Args[1] 1491 v_0 := v.Args[0] 1492 b := v.Block 1493 typ := &b.Func.Config.Types 1494 // match: (LocalAddr <t> {sym} base mem) 1495 // cond: t.Elem().HasPointers() 1496 // result: (LoweredAddr {sym} (SPanchored base mem)) 1497 for { 1498 t := v.Type 1499 sym := auxToSym(v.Aux) 1500 base := v_0 1501 mem := v_1 1502 if !(t.Elem().HasPointers()) { 1503 break 1504 } 1505 v.reset(OpWasmLoweredAddr) 1506 v.Aux = symToAux(sym) 1507 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr) 1508 v0.AddArg2(base, mem) 1509 v.AddArg(v0) 1510 return true 1511 } 1512 // match: (LocalAddr <t> {sym} base _) 1513 // cond: !t.Elem().HasPointers() 1514 // result: (LoweredAddr {sym} base) 1515 for { 1516 t := v.Type 1517 sym := auxToSym(v.Aux) 1518 base := v_0 1519 if !(!t.Elem().HasPointers()) { 1520 break 1521 } 1522 v.reset(OpWasmLoweredAddr) 1523 v.Aux = symToAux(sym) 1524 v.AddArg(base) 1525 return true 1526 } 1527 return false 1528 } 1529 func rewriteValueWasm_OpLsh16x16(v *Value) bool { 1530 v_1 := v.Args[1] 1531 v_0 := v.Args[0] 1532 b := v.Block 1533 typ := &b.Func.Config.Types 1534 // match: (Lsh16x16 [c] x y) 1535 // result: (Lsh64x64 [c] x (ZeroExt16to64 y)) 1536 for { 1537 c := auxIntToBool(v.AuxInt) 1538 x := v_0 1539 y := v_1 1540 v.reset(OpLsh64x64) 1541 v.AuxInt = boolToAuxInt(c) 1542 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1543 v0.AddArg(y) 1544 v.AddArg2(x, v0) 1545 return true 1546 } 1547 } 1548 func rewriteValueWasm_OpLsh16x32(v *Value) bool { 1549 v_1 := v.Args[1] 1550 v_0 := v.Args[0] 1551 b := v.Block 1552 typ := &b.Func.Config.Types 1553 // match: (Lsh16x32 [c] x y) 1554 // result: (Lsh64x64 [c] x (ZeroExt32to64 y)) 1555 for { 1556 c := auxIntToBool(v.AuxInt) 1557 x := v_0 1558 y := v_1 1559 v.reset(OpLsh64x64) 1560 v.AuxInt = boolToAuxInt(c) 1561 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1562 v0.AddArg(y) 1563 v.AddArg2(x, v0) 1564 return true 1565 } 1566 } 1567 func rewriteValueWasm_OpLsh16x8(v *Value) bool { 1568 v_1 := v.Args[1] 1569 v_0 := v.Args[0] 1570 b := v.Block 1571 typ := &b.Func.Config.Types 1572 // match: (Lsh16x8 [c] x y) 1573 // result: (Lsh64x64 [c] x (ZeroExt8to64 y)) 1574 for { 1575 c := auxIntToBool(v.AuxInt) 1576 x := v_0 1577 y := v_1 1578 v.reset(OpLsh64x64) 1579 v.AuxInt = boolToAuxInt(c) 1580 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1581 v0.AddArg(y) 1582 v.AddArg2(x, v0) 1583 return true 1584 } 1585 } 1586 func rewriteValueWasm_OpLsh32x16(v *Value) bool { 1587 v_1 := v.Args[1] 1588 v_0 := v.Args[0] 1589 b := v.Block 1590 typ := &b.Func.Config.Types 1591 // match: (Lsh32x16 [c] x y) 1592 // result: (Lsh64x64 [c] x (ZeroExt16to64 y)) 1593 for { 1594 c := auxIntToBool(v.AuxInt) 1595 x := v_0 1596 y := v_1 1597 v.reset(OpLsh64x64) 1598 v.AuxInt = boolToAuxInt(c) 1599 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1600 v0.AddArg(y) 1601 v.AddArg2(x, v0) 1602 return true 1603 } 1604 } 1605 func rewriteValueWasm_OpLsh32x32(v *Value) bool { 1606 v_1 := v.Args[1] 1607 v_0 := v.Args[0] 1608 b := v.Block 1609 typ := &b.Func.Config.Types 1610 // match: (Lsh32x32 [c] x y) 1611 // result: (Lsh64x64 [c] x (ZeroExt32to64 y)) 1612 for { 1613 c := auxIntToBool(v.AuxInt) 1614 x := v_0 1615 y := v_1 1616 v.reset(OpLsh64x64) 1617 v.AuxInt = boolToAuxInt(c) 1618 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1619 v0.AddArg(y) 1620 v.AddArg2(x, v0) 1621 return true 1622 } 1623 } 1624 func rewriteValueWasm_OpLsh32x8(v *Value) bool { 1625 v_1 := v.Args[1] 1626 v_0 := v.Args[0] 1627 b := v.Block 1628 typ := &b.Func.Config.Types 1629 // match: (Lsh32x8 [c] x y) 1630 // result: (Lsh64x64 [c] x (ZeroExt8to64 y)) 1631 for { 1632 c := auxIntToBool(v.AuxInt) 1633 x := v_0 1634 y := v_1 1635 v.reset(OpLsh64x64) 1636 v.AuxInt = boolToAuxInt(c) 1637 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1638 v0.AddArg(y) 1639 v.AddArg2(x, v0) 1640 return true 1641 } 1642 } 1643 func rewriteValueWasm_OpLsh64x16(v *Value) bool { 1644 v_1 := v.Args[1] 1645 v_0 := v.Args[0] 1646 b := v.Block 1647 typ := &b.Func.Config.Types 1648 // match: (Lsh64x16 [c] x y) 1649 // result: (Lsh64x64 [c] x (ZeroExt16to64 y)) 1650 for { 1651 c := auxIntToBool(v.AuxInt) 1652 x := v_0 1653 y := v_1 1654 v.reset(OpLsh64x64) 1655 v.AuxInt = boolToAuxInt(c) 1656 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1657 v0.AddArg(y) 1658 v.AddArg2(x, v0) 1659 return true 1660 } 1661 } 1662 func rewriteValueWasm_OpLsh64x32(v *Value) bool { 1663 v_1 := v.Args[1] 1664 v_0 := v.Args[0] 1665 b := v.Block 1666 typ := &b.Func.Config.Types 1667 // match: (Lsh64x32 [c] x y) 1668 // result: (Lsh64x64 [c] x (ZeroExt32to64 y)) 1669 for { 1670 c := auxIntToBool(v.AuxInt) 1671 x := v_0 1672 y := v_1 1673 v.reset(OpLsh64x64) 1674 v.AuxInt = boolToAuxInt(c) 1675 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1676 v0.AddArg(y) 1677 v.AddArg2(x, v0) 1678 return true 1679 } 1680 } 1681 func rewriteValueWasm_OpLsh64x64(v *Value) bool { 1682 v_1 := v.Args[1] 1683 v_0 := v.Args[0] 1684 b := v.Block 1685 typ := &b.Func.Config.Types 1686 // match: (Lsh64x64 x y) 1687 // cond: shiftIsBounded(v) 1688 // result: (I64Shl x y) 1689 for { 1690 x := v_0 1691 y := v_1 1692 if !(shiftIsBounded(v)) { 1693 break 1694 } 1695 v.reset(OpWasmI64Shl) 1696 v.AddArg2(x, y) 1697 return true 1698 } 1699 // match: (Lsh64x64 x (I64Const [c])) 1700 // cond: uint64(c) < 64 1701 // result: (I64Shl x (I64Const [c])) 1702 for { 1703 x := v_0 1704 if v_1.Op != OpWasmI64Const { 1705 break 1706 } 1707 c := auxIntToInt64(v_1.AuxInt) 1708 if !(uint64(c) < 64) { 1709 break 1710 } 1711 v.reset(OpWasmI64Shl) 1712 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 1713 v0.AuxInt = int64ToAuxInt(c) 1714 v.AddArg2(x, v0) 1715 return true 1716 } 1717 // match: (Lsh64x64 x (I64Const [c])) 1718 // cond: uint64(c) >= 64 1719 // result: (I64Const [0]) 1720 for { 1721 if v_1.Op != OpWasmI64Const { 1722 break 1723 } 1724 c := auxIntToInt64(v_1.AuxInt) 1725 if !(uint64(c) >= 64) { 1726 break 1727 } 1728 v.reset(OpWasmI64Const) 1729 v.AuxInt = int64ToAuxInt(0) 1730 return true 1731 } 1732 // match: (Lsh64x64 x y) 1733 // result: (Select (I64Shl x y) (I64Const [0]) (I64LtU y (I64Const [64]))) 1734 for { 1735 x := v_0 1736 y := v_1 1737 v.reset(OpWasmSelect) 1738 v0 := b.NewValue0(v.Pos, OpWasmI64Shl, typ.Int64) 1739 v0.AddArg2(x, y) 1740 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 1741 v1.AuxInt = int64ToAuxInt(0) 1742 v2 := b.NewValue0(v.Pos, OpWasmI64LtU, typ.Bool) 1743 v3 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 1744 v3.AuxInt = int64ToAuxInt(64) 1745 v2.AddArg2(y, v3) 1746 v.AddArg3(v0, v1, v2) 1747 return true 1748 } 1749 } 1750 func rewriteValueWasm_OpLsh64x8(v *Value) bool { 1751 v_1 := v.Args[1] 1752 v_0 := v.Args[0] 1753 b := v.Block 1754 typ := &b.Func.Config.Types 1755 // match: (Lsh64x8 [c] x y) 1756 // result: (Lsh64x64 [c] x (ZeroExt8to64 y)) 1757 for { 1758 c := auxIntToBool(v.AuxInt) 1759 x := v_0 1760 y := v_1 1761 v.reset(OpLsh64x64) 1762 v.AuxInt = boolToAuxInt(c) 1763 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1764 v0.AddArg(y) 1765 v.AddArg2(x, v0) 1766 return true 1767 } 1768 } 1769 func rewriteValueWasm_OpLsh8x16(v *Value) bool { 1770 v_1 := v.Args[1] 1771 v_0 := v.Args[0] 1772 b := v.Block 1773 typ := &b.Func.Config.Types 1774 // match: (Lsh8x16 [c] x y) 1775 // result: (Lsh64x64 [c] x (ZeroExt16to64 y)) 1776 for { 1777 c := auxIntToBool(v.AuxInt) 1778 x := v_0 1779 y := v_1 1780 v.reset(OpLsh64x64) 1781 v.AuxInt = boolToAuxInt(c) 1782 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1783 v0.AddArg(y) 1784 v.AddArg2(x, v0) 1785 return true 1786 } 1787 } 1788 func rewriteValueWasm_OpLsh8x32(v *Value) bool { 1789 v_1 := v.Args[1] 1790 v_0 := v.Args[0] 1791 b := v.Block 1792 typ := &b.Func.Config.Types 1793 // match: (Lsh8x32 [c] x y) 1794 // result: (Lsh64x64 [c] x (ZeroExt32to64 y)) 1795 for { 1796 c := auxIntToBool(v.AuxInt) 1797 x := v_0 1798 y := v_1 1799 v.reset(OpLsh64x64) 1800 v.AuxInt = boolToAuxInt(c) 1801 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1802 v0.AddArg(y) 1803 v.AddArg2(x, v0) 1804 return true 1805 } 1806 } 1807 func rewriteValueWasm_OpLsh8x8(v *Value) bool { 1808 v_1 := v.Args[1] 1809 v_0 := v.Args[0] 1810 b := v.Block 1811 typ := &b.Func.Config.Types 1812 // match: (Lsh8x8 [c] x y) 1813 // result: (Lsh64x64 [c] x (ZeroExt8to64 y)) 1814 for { 1815 c := auxIntToBool(v.AuxInt) 1816 x := v_0 1817 y := v_1 1818 v.reset(OpLsh64x64) 1819 v.AuxInt = boolToAuxInt(c) 1820 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1821 v0.AddArg(y) 1822 v.AddArg2(x, v0) 1823 return true 1824 } 1825 } 1826 func rewriteValueWasm_OpMod16(v *Value) bool { 1827 v_1 := v.Args[1] 1828 v_0 := v.Args[0] 1829 b := v.Block 1830 typ := &b.Func.Config.Types 1831 // match: (Mod16 [false] x y) 1832 // result: (I64RemS (SignExt16to64 x) (SignExt16to64 y)) 1833 for { 1834 if auxIntToBool(v.AuxInt) != false { 1835 break 1836 } 1837 x := v_0 1838 y := v_1 1839 v.reset(OpWasmI64RemS) 1840 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 1841 v0.AddArg(x) 1842 v1 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 1843 v1.AddArg(y) 1844 v.AddArg2(v0, v1) 1845 return true 1846 } 1847 return false 1848 } 1849 func rewriteValueWasm_OpMod16u(v *Value) bool { 1850 v_1 := v.Args[1] 1851 v_0 := v.Args[0] 1852 b := v.Block 1853 typ := &b.Func.Config.Types 1854 // match: (Mod16u x y) 1855 // result: (I64RemU (ZeroExt16to64 x) (ZeroExt16to64 y)) 1856 for { 1857 x := v_0 1858 y := v_1 1859 v.reset(OpWasmI64RemU) 1860 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1861 v0.AddArg(x) 1862 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1863 v1.AddArg(y) 1864 v.AddArg2(v0, v1) 1865 return true 1866 } 1867 } 1868 func rewriteValueWasm_OpMod32(v *Value) bool { 1869 v_1 := v.Args[1] 1870 v_0 := v.Args[0] 1871 b := v.Block 1872 typ := &b.Func.Config.Types 1873 // match: (Mod32 [false] x y) 1874 // result: (I64RemS (SignExt32to64 x) (SignExt32to64 y)) 1875 for { 1876 if auxIntToBool(v.AuxInt) != false { 1877 break 1878 } 1879 x := v_0 1880 y := v_1 1881 v.reset(OpWasmI64RemS) 1882 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1883 v0.AddArg(x) 1884 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1885 v1.AddArg(y) 1886 v.AddArg2(v0, v1) 1887 return true 1888 } 1889 return false 1890 } 1891 func rewriteValueWasm_OpMod32u(v *Value) bool { 1892 v_1 := v.Args[1] 1893 v_0 := v.Args[0] 1894 b := v.Block 1895 typ := &b.Func.Config.Types 1896 // match: (Mod32u x y) 1897 // result: (I64RemU (ZeroExt32to64 x) (ZeroExt32to64 y)) 1898 for { 1899 x := v_0 1900 y := v_1 1901 v.reset(OpWasmI64RemU) 1902 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1903 v0.AddArg(x) 1904 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1905 v1.AddArg(y) 1906 v.AddArg2(v0, v1) 1907 return true 1908 } 1909 } 1910 func rewriteValueWasm_OpMod64(v *Value) bool { 1911 v_1 := v.Args[1] 1912 v_0 := v.Args[0] 1913 // match: (Mod64 [false] x y) 1914 // result: (I64RemS x y) 1915 for { 1916 if auxIntToBool(v.AuxInt) != false { 1917 break 1918 } 1919 x := v_0 1920 y := v_1 1921 v.reset(OpWasmI64RemS) 1922 v.AddArg2(x, y) 1923 return true 1924 } 1925 return false 1926 } 1927 func rewriteValueWasm_OpMod8(v *Value) bool { 1928 v_1 := v.Args[1] 1929 v_0 := v.Args[0] 1930 b := v.Block 1931 typ := &b.Func.Config.Types 1932 // match: (Mod8 x y) 1933 // result: (I64RemS (SignExt8to64 x) (SignExt8to64 y)) 1934 for { 1935 x := v_0 1936 y := v_1 1937 v.reset(OpWasmI64RemS) 1938 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1939 v0.AddArg(x) 1940 v1 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1941 v1.AddArg(y) 1942 v.AddArg2(v0, v1) 1943 return true 1944 } 1945 } 1946 func rewriteValueWasm_OpMod8u(v *Value) bool { 1947 v_1 := v.Args[1] 1948 v_0 := v.Args[0] 1949 b := v.Block 1950 typ := &b.Func.Config.Types 1951 // match: (Mod8u x y) 1952 // result: (I64RemU (ZeroExt8to64 x) (ZeroExt8to64 y)) 1953 for { 1954 x := v_0 1955 y := v_1 1956 v.reset(OpWasmI64RemU) 1957 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1958 v0.AddArg(x) 1959 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1960 v1.AddArg(y) 1961 v.AddArg2(v0, v1) 1962 return true 1963 } 1964 } 1965 func rewriteValueWasm_OpMove(v *Value) bool { 1966 v_2 := v.Args[2] 1967 v_1 := v.Args[1] 1968 v_0 := v.Args[0] 1969 b := v.Block 1970 typ := &b.Func.Config.Types 1971 // match: (Move [0] _ _ mem) 1972 // result: mem 1973 for { 1974 if auxIntToInt64(v.AuxInt) != 0 { 1975 break 1976 } 1977 mem := v_2 1978 v.copyOf(mem) 1979 return true 1980 } 1981 // match: (Move [1] dst src mem) 1982 // result: (I64Store8 dst (I64Load8U src mem) mem) 1983 for { 1984 if auxIntToInt64(v.AuxInt) != 1 { 1985 break 1986 } 1987 dst := v_0 1988 src := v_1 1989 mem := v_2 1990 v.reset(OpWasmI64Store8) 1991 v0 := b.NewValue0(v.Pos, OpWasmI64Load8U, typ.UInt8) 1992 v0.AddArg2(src, mem) 1993 v.AddArg3(dst, v0, mem) 1994 return true 1995 } 1996 // match: (Move [2] dst src mem) 1997 // result: (I64Store16 dst (I64Load16U src mem) mem) 1998 for { 1999 if auxIntToInt64(v.AuxInt) != 2 { 2000 break 2001 } 2002 dst := v_0 2003 src := v_1 2004 mem := v_2 2005 v.reset(OpWasmI64Store16) 2006 v0 := b.NewValue0(v.Pos, OpWasmI64Load16U, typ.UInt16) 2007 v0.AddArg2(src, mem) 2008 v.AddArg3(dst, v0, mem) 2009 return true 2010 } 2011 // match: (Move [4] dst src mem) 2012 // result: (I64Store32 dst (I64Load32U src mem) mem) 2013 for { 2014 if auxIntToInt64(v.AuxInt) != 4 { 2015 break 2016 } 2017 dst := v_0 2018 src := v_1 2019 mem := v_2 2020 v.reset(OpWasmI64Store32) 2021 v0 := b.NewValue0(v.Pos, OpWasmI64Load32U, typ.UInt32) 2022 v0.AddArg2(src, mem) 2023 v.AddArg3(dst, v0, mem) 2024 return true 2025 } 2026 // match: (Move [8] dst src mem) 2027 // result: (I64Store dst (I64Load src mem) mem) 2028 for { 2029 if auxIntToInt64(v.AuxInt) != 8 { 2030 break 2031 } 2032 dst := v_0 2033 src := v_1 2034 mem := v_2 2035 v.reset(OpWasmI64Store) 2036 v0 := b.NewValue0(v.Pos, OpWasmI64Load, typ.UInt64) 2037 v0.AddArg2(src, mem) 2038 v.AddArg3(dst, v0, mem) 2039 return true 2040 } 2041 // match: (Move [16] dst src mem) 2042 // result: (I64Store [8] dst (I64Load [8] src mem) (I64Store dst (I64Load src mem) mem)) 2043 for { 2044 if auxIntToInt64(v.AuxInt) != 16 { 2045 break 2046 } 2047 dst := v_0 2048 src := v_1 2049 mem := v_2 2050 v.reset(OpWasmI64Store) 2051 v.AuxInt = int64ToAuxInt(8) 2052 v0 := b.NewValue0(v.Pos, OpWasmI64Load, typ.UInt64) 2053 v0.AuxInt = int64ToAuxInt(8) 2054 v0.AddArg2(src, mem) 2055 v1 := b.NewValue0(v.Pos, OpWasmI64Store, types.TypeMem) 2056 v2 := b.NewValue0(v.Pos, OpWasmI64Load, typ.UInt64) 2057 v2.AddArg2(src, mem) 2058 v1.AddArg3(dst, v2, mem) 2059 v.AddArg3(dst, v0, v1) 2060 return true 2061 } 2062 // match: (Move [3] dst src mem) 2063 // result: (I64Store8 [2] dst (I64Load8U [2] src mem) (I64Store16 dst (I64Load16U src mem) mem)) 2064 for { 2065 if auxIntToInt64(v.AuxInt) != 3 { 2066 break 2067 } 2068 dst := v_0 2069 src := v_1 2070 mem := v_2 2071 v.reset(OpWasmI64Store8) 2072 v.AuxInt = int64ToAuxInt(2) 2073 v0 := b.NewValue0(v.Pos, OpWasmI64Load8U, typ.UInt8) 2074 v0.AuxInt = int64ToAuxInt(2) 2075 v0.AddArg2(src, mem) 2076 v1 := b.NewValue0(v.Pos, OpWasmI64Store16, types.TypeMem) 2077 v2 := b.NewValue0(v.Pos, OpWasmI64Load16U, typ.UInt16) 2078 v2.AddArg2(src, mem) 2079 v1.AddArg3(dst, v2, mem) 2080 v.AddArg3(dst, v0, v1) 2081 return true 2082 } 2083 // match: (Move [5] dst src mem) 2084 // result: (I64Store8 [4] dst (I64Load8U [4] src mem) (I64Store32 dst (I64Load32U src mem) mem)) 2085 for { 2086 if auxIntToInt64(v.AuxInt) != 5 { 2087 break 2088 } 2089 dst := v_0 2090 src := v_1 2091 mem := v_2 2092 v.reset(OpWasmI64Store8) 2093 v.AuxInt = int64ToAuxInt(4) 2094 v0 := b.NewValue0(v.Pos, OpWasmI64Load8U, typ.UInt8) 2095 v0.AuxInt = int64ToAuxInt(4) 2096 v0.AddArg2(src, mem) 2097 v1 := b.NewValue0(v.Pos, OpWasmI64Store32, types.TypeMem) 2098 v2 := b.NewValue0(v.Pos, OpWasmI64Load32U, typ.UInt32) 2099 v2.AddArg2(src, mem) 2100 v1.AddArg3(dst, v2, mem) 2101 v.AddArg3(dst, v0, v1) 2102 return true 2103 } 2104 // match: (Move [6] dst src mem) 2105 // result: (I64Store16 [4] dst (I64Load16U [4] src mem) (I64Store32 dst (I64Load32U src mem) mem)) 2106 for { 2107 if auxIntToInt64(v.AuxInt) != 6 { 2108 break 2109 } 2110 dst := v_0 2111 src := v_1 2112 mem := v_2 2113 v.reset(OpWasmI64Store16) 2114 v.AuxInt = int64ToAuxInt(4) 2115 v0 := b.NewValue0(v.Pos, OpWasmI64Load16U, typ.UInt16) 2116 v0.AuxInt = int64ToAuxInt(4) 2117 v0.AddArg2(src, mem) 2118 v1 := b.NewValue0(v.Pos, OpWasmI64Store32, types.TypeMem) 2119 v2 := b.NewValue0(v.Pos, OpWasmI64Load32U, typ.UInt32) 2120 v2.AddArg2(src, mem) 2121 v1.AddArg3(dst, v2, mem) 2122 v.AddArg3(dst, v0, v1) 2123 return true 2124 } 2125 // match: (Move [7] dst src mem) 2126 // result: (I64Store32 [3] dst (I64Load32U [3] src mem) (I64Store32 dst (I64Load32U src mem) mem)) 2127 for { 2128 if auxIntToInt64(v.AuxInt) != 7 { 2129 break 2130 } 2131 dst := v_0 2132 src := v_1 2133 mem := v_2 2134 v.reset(OpWasmI64Store32) 2135 v.AuxInt = int64ToAuxInt(3) 2136 v0 := b.NewValue0(v.Pos, OpWasmI64Load32U, typ.UInt32) 2137 v0.AuxInt = int64ToAuxInt(3) 2138 v0.AddArg2(src, mem) 2139 v1 := b.NewValue0(v.Pos, OpWasmI64Store32, types.TypeMem) 2140 v2 := b.NewValue0(v.Pos, OpWasmI64Load32U, typ.UInt32) 2141 v2.AddArg2(src, mem) 2142 v1.AddArg3(dst, v2, mem) 2143 v.AddArg3(dst, v0, v1) 2144 return true 2145 } 2146 // match: (Move [s] dst src mem) 2147 // cond: s > 8 && s < 16 2148 // result: (I64Store [s-8] dst (I64Load [s-8] src mem) (I64Store dst (I64Load src mem) mem)) 2149 for { 2150 s := auxIntToInt64(v.AuxInt) 2151 dst := v_0 2152 src := v_1 2153 mem := v_2 2154 if !(s > 8 && s < 16) { 2155 break 2156 } 2157 v.reset(OpWasmI64Store) 2158 v.AuxInt = int64ToAuxInt(s - 8) 2159 v0 := b.NewValue0(v.Pos, OpWasmI64Load, typ.UInt64) 2160 v0.AuxInt = int64ToAuxInt(s - 8) 2161 v0.AddArg2(src, mem) 2162 v1 := b.NewValue0(v.Pos, OpWasmI64Store, types.TypeMem) 2163 v2 := b.NewValue0(v.Pos, OpWasmI64Load, typ.UInt64) 2164 v2.AddArg2(src, mem) 2165 v1.AddArg3(dst, v2, mem) 2166 v.AddArg3(dst, v0, v1) 2167 return true 2168 } 2169 // match: (Move [s] dst src mem) 2170 // cond: logLargeCopy(v, s) 2171 // result: (LoweredMove [s] dst src mem) 2172 for { 2173 s := auxIntToInt64(v.AuxInt) 2174 dst := v_0 2175 src := v_1 2176 mem := v_2 2177 if !(logLargeCopy(v, s)) { 2178 break 2179 } 2180 v.reset(OpWasmLoweredMove) 2181 v.AuxInt = int64ToAuxInt(s) 2182 v.AddArg3(dst, src, mem) 2183 return true 2184 } 2185 return false 2186 } 2187 func rewriteValueWasm_OpNeg16(v *Value) bool { 2188 v_0 := v.Args[0] 2189 b := v.Block 2190 typ := &b.Func.Config.Types 2191 // match: (Neg16 x) 2192 // result: (I64Sub (I64Const [0]) x) 2193 for { 2194 x := v_0 2195 v.reset(OpWasmI64Sub) 2196 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2197 v0.AuxInt = int64ToAuxInt(0) 2198 v.AddArg2(v0, x) 2199 return true 2200 } 2201 } 2202 func rewriteValueWasm_OpNeg32(v *Value) bool { 2203 v_0 := v.Args[0] 2204 b := v.Block 2205 typ := &b.Func.Config.Types 2206 // match: (Neg32 x) 2207 // result: (I64Sub (I64Const [0]) x) 2208 for { 2209 x := v_0 2210 v.reset(OpWasmI64Sub) 2211 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2212 v0.AuxInt = int64ToAuxInt(0) 2213 v.AddArg2(v0, x) 2214 return true 2215 } 2216 } 2217 func rewriteValueWasm_OpNeg64(v *Value) bool { 2218 v_0 := v.Args[0] 2219 b := v.Block 2220 typ := &b.Func.Config.Types 2221 // match: (Neg64 x) 2222 // result: (I64Sub (I64Const [0]) x) 2223 for { 2224 x := v_0 2225 v.reset(OpWasmI64Sub) 2226 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2227 v0.AuxInt = int64ToAuxInt(0) 2228 v.AddArg2(v0, x) 2229 return true 2230 } 2231 } 2232 func rewriteValueWasm_OpNeg8(v *Value) bool { 2233 v_0 := v.Args[0] 2234 b := v.Block 2235 typ := &b.Func.Config.Types 2236 // match: (Neg8 x) 2237 // result: (I64Sub (I64Const [0]) x) 2238 for { 2239 x := v_0 2240 v.reset(OpWasmI64Sub) 2241 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2242 v0.AuxInt = int64ToAuxInt(0) 2243 v.AddArg2(v0, x) 2244 return true 2245 } 2246 } 2247 func rewriteValueWasm_OpNeq16(v *Value) bool { 2248 v_1 := v.Args[1] 2249 v_0 := v.Args[0] 2250 b := v.Block 2251 typ := &b.Func.Config.Types 2252 // match: (Neq16 x y) 2253 // result: (I64Ne (ZeroExt16to64 x) (ZeroExt16to64 y)) 2254 for { 2255 x := v_0 2256 y := v_1 2257 v.reset(OpWasmI64Ne) 2258 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2259 v0.AddArg(x) 2260 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2261 v1.AddArg(y) 2262 v.AddArg2(v0, v1) 2263 return true 2264 } 2265 } 2266 func rewriteValueWasm_OpNeq32(v *Value) bool { 2267 v_1 := v.Args[1] 2268 v_0 := v.Args[0] 2269 b := v.Block 2270 typ := &b.Func.Config.Types 2271 // match: (Neq32 x y) 2272 // result: (I64Ne (ZeroExt32to64 x) (ZeroExt32to64 y)) 2273 for { 2274 x := v_0 2275 y := v_1 2276 v.reset(OpWasmI64Ne) 2277 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2278 v0.AddArg(x) 2279 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2280 v1.AddArg(y) 2281 v.AddArg2(v0, v1) 2282 return true 2283 } 2284 } 2285 func rewriteValueWasm_OpNeq8(v *Value) bool { 2286 v_1 := v.Args[1] 2287 v_0 := v.Args[0] 2288 b := v.Block 2289 typ := &b.Func.Config.Types 2290 // match: (Neq8 x y) 2291 // result: (I64Ne (ZeroExt8to64 x) (ZeroExt8to64 y)) 2292 for { 2293 x := v_0 2294 y := v_1 2295 v.reset(OpWasmI64Ne) 2296 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2297 v0.AddArg(x) 2298 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2299 v1.AddArg(y) 2300 v.AddArg2(v0, v1) 2301 return true 2302 } 2303 } 2304 func rewriteValueWasm_OpPopCount16(v *Value) bool { 2305 v_0 := v.Args[0] 2306 b := v.Block 2307 typ := &b.Func.Config.Types 2308 // match: (PopCount16 x) 2309 // result: (I64Popcnt (ZeroExt16to64 x)) 2310 for { 2311 x := v_0 2312 v.reset(OpWasmI64Popcnt) 2313 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2314 v0.AddArg(x) 2315 v.AddArg(v0) 2316 return true 2317 } 2318 } 2319 func rewriteValueWasm_OpPopCount32(v *Value) bool { 2320 v_0 := v.Args[0] 2321 b := v.Block 2322 typ := &b.Func.Config.Types 2323 // match: (PopCount32 x) 2324 // result: (I64Popcnt (ZeroExt32to64 x)) 2325 for { 2326 x := v_0 2327 v.reset(OpWasmI64Popcnt) 2328 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2329 v0.AddArg(x) 2330 v.AddArg(v0) 2331 return true 2332 } 2333 } 2334 func rewriteValueWasm_OpPopCount8(v *Value) bool { 2335 v_0 := v.Args[0] 2336 b := v.Block 2337 typ := &b.Func.Config.Types 2338 // match: (PopCount8 x) 2339 // result: (I64Popcnt (ZeroExt8to64 x)) 2340 for { 2341 x := v_0 2342 v.reset(OpWasmI64Popcnt) 2343 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2344 v0.AddArg(x) 2345 v.AddArg(v0) 2346 return true 2347 } 2348 } 2349 func rewriteValueWasm_OpRotateLeft16(v *Value) bool { 2350 v_1 := v.Args[1] 2351 v_0 := v.Args[0] 2352 b := v.Block 2353 typ := &b.Func.Config.Types 2354 // match: (RotateLeft16 <t> x (I64Const [c])) 2355 // result: (Or16 (Lsh16x64 <t> x (I64Const [c&15])) (Rsh16Ux64 <t> x (I64Const [-c&15]))) 2356 for { 2357 t := v.Type 2358 x := v_0 2359 if v_1.Op != OpWasmI64Const { 2360 break 2361 } 2362 c := auxIntToInt64(v_1.AuxInt) 2363 v.reset(OpOr16) 2364 v0 := b.NewValue0(v.Pos, OpLsh16x64, t) 2365 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2366 v1.AuxInt = int64ToAuxInt(c & 15) 2367 v0.AddArg2(x, v1) 2368 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t) 2369 v3 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2370 v3.AuxInt = int64ToAuxInt(-c & 15) 2371 v2.AddArg2(x, v3) 2372 v.AddArg2(v0, v2) 2373 return true 2374 } 2375 return false 2376 } 2377 func rewriteValueWasm_OpRotateLeft8(v *Value) bool { 2378 v_1 := v.Args[1] 2379 v_0 := v.Args[0] 2380 b := v.Block 2381 typ := &b.Func.Config.Types 2382 // match: (RotateLeft8 <t> x (I64Const [c])) 2383 // result: (Or8 (Lsh8x64 <t> x (I64Const [c&7])) (Rsh8Ux64 <t> x (I64Const [-c&7]))) 2384 for { 2385 t := v.Type 2386 x := v_0 2387 if v_1.Op != OpWasmI64Const { 2388 break 2389 } 2390 c := auxIntToInt64(v_1.AuxInt) 2391 v.reset(OpOr8) 2392 v0 := b.NewValue0(v.Pos, OpLsh8x64, t) 2393 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2394 v1.AuxInt = int64ToAuxInt(c & 7) 2395 v0.AddArg2(x, v1) 2396 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t) 2397 v3 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2398 v3.AuxInt = int64ToAuxInt(-c & 7) 2399 v2.AddArg2(x, v3) 2400 v.AddArg2(v0, v2) 2401 return true 2402 } 2403 return false 2404 } 2405 func rewriteValueWasm_OpRsh16Ux16(v *Value) bool { 2406 v_1 := v.Args[1] 2407 v_0 := v.Args[0] 2408 b := v.Block 2409 typ := &b.Func.Config.Types 2410 // match: (Rsh16Ux16 [c] x y) 2411 // result: (Rsh64Ux64 [c] (ZeroExt16to64 x) (ZeroExt16to64 y)) 2412 for { 2413 c := auxIntToBool(v.AuxInt) 2414 x := v_0 2415 y := v_1 2416 v.reset(OpRsh64Ux64) 2417 v.AuxInt = boolToAuxInt(c) 2418 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2419 v0.AddArg(x) 2420 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2421 v1.AddArg(y) 2422 v.AddArg2(v0, v1) 2423 return true 2424 } 2425 } 2426 func rewriteValueWasm_OpRsh16Ux32(v *Value) bool { 2427 v_1 := v.Args[1] 2428 v_0 := v.Args[0] 2429 b := v.Block 2430 typ := &b.Func.Config.Types 2431 // match: (Rsh16Ux32 [c] x y) 2432 // result: (Rsh64Ux64 [c] (ZeroExt16to64 x) (ZeroExt32to64 y)) 2433 for { 2434 c := auxIntToBool(v.AuxInt) 2435 x := v_0 2436 y := v_1 2437 v.reset(OpRsh64Ux64) 2438 v.AuxInt = boolToAuxInt(c) 2439 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2440 v0.AddArg(x) 2441 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2442 v1.AddArg(y) 2443 v.AddArg2(v0, v1) 2444 return true 2445 } 2446 } 2447 func rewriteValueWasm_OpRsh16Ux64(v *Value) bool { 2448 v_1 := v.Args[1] 2449 v_0 := v.Args[0] 2450 b := v.Block 2451 typ := &b.Func.Config.Types 2452 // match: (Rsh16Ux64 [c] x y) 2453 // result: (Rsh64Ux64 [c] (ZeroExt16to64 x) y) 2454 for { 2455 c := auxIntToBool(v.AuxInt) 2456 x := v_0 2457 y := v_1 2458 v.reset(OpRsh64Ux64) 2459 v.AuxInt = boolToAuxInt(c) 2460 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2461 v0.AddArg(x) 2462 v.AddArg2(v0, y) 2463 return true 2464 } 2465 } 2466 func rewriteValueWasm_OpRsh16Ux8(v *Value) bool { 2467 v_1 := v.Args[1] 2468 v_0 := v.Args[0] 2469 b := v.Block 2470 typ := &b.Func.Config.Types 2471 // match: (Rsh16Ux8 [c] x y) 2472 // result: (Rsh64Ux64 [c] (ZeroExt16to64 x) (ZeroExt8to64 y)) 2473 for { 2474 c := auxIntToBool(v.AuxInt) 2475 x := v_0 2476 y := v_1 2477 v.reset(OpRsh64Ux64) 2478 v.AuxInt = boolToAuxInt(c) 2479 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2480 v0.AddArg(x) 2481 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2482 v1.AddArg(y) 2483 v.AddArg2(v0, v1) 2484 return true 2485 } 2486 } 2487 func rewriteValueWasm_OpRsh16x16(v *Value) bool { 2488 v_1 := v.Args[1] 2489 v_0 := v.Args[0] 2490 b := v.Block 2491 typ := &b.Func.Config.Types 2492 // match: (Rsh16x16 [c] x y) 2493 // result: (Rsh64x64 [c] (SignExt16to64 x) (ZeroExt16to64 y)) 2494 for { 2495 c := auxIntToBool(v.AuxInt) 2496 x := v_0 2497 y := v_1 2498 v.reset(OpRsh64x64) 2499 v.AuxInt = boolToAuxInt(c) 2500 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 2501 v0.AddArg(x) 2502 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2503 v1.AddArg(y) 2504 v.AddArg2(v0, v1) 2505 return true 2506 } 2507 } 2508 func rewriteValueWasm_OpRsh16x32(v *Value) bool { 2509 v_1 := v.Args[1] 2510 v_0 := v.Args[0] 2511 b := v.Block 2512 typ := &b.Func.Config.Types 2513 // match: (Rsh16x32 [c] x y) 2514 // result: (Rsh64x64 [c] (SignExt16to64 x) (ZeroExt32to64 y)) 2515 for { 2516 c := auxIntToBool(v.AuxInt) 2517 x := v_0 2518 y := v_1 2519 v.reset(OpRsh64x64) 2520 v.AuxInt = boolToAuxInt(c) 2521 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 2522 v0.AddArg(x) 2523 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2524 v1.AddArg(y) 2525 v.AddArg2(v0, v1) 2526 return true 2527 } 2528 } 2529 func rewriteValueWasm_OpRsh16x64(v *Value) bool { 2530 v_1 := v.Args[1] 2531 v_0 := v.Args[0] 2532 b := v.Block 2533 typ := &b.Func.Config.Types 2534 // match: (Rsh16x64 [c] x y) 2535 // result: (Rsh64x64 [c] (SignExt16to64 x) y) 2536 for { 2537 c := auxIntToBool(v.AuxInt) 2538 x := v_0 2539 y := v_1 2540 v.reset(OpRsh64x64) 2541 v.AuxInt = boolToAuxInt(c) 2542 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 2543 v0.AddArg(x) 2544 v.AddArg2(v0, y) 2545 return true 2546 } 2547 } 2548 func rewriteValueWasm_OpRsh16x8(v *Value) bool { 2549 v_1 := v.Args[1] 2550 v_0 := v.Args[0] 2551 b := v.Block 2552 typ := &b.Func.Config.Types 2553 // match: (Rsh16x8 [c] x y) 2554 // result: (Rsh64x64 [c] (SignExt16to64 x) (ZeroExt8to64 y)) 2555 for { 2556 c := auxIntToBool(v.AuxInt) 2557 x := v_0 2558 y := v_1 2559 v.reset(OpRsh64x64) 2560 v.AuxInt = boolToAuxInt(c) 2561 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 2562 v0.AddArg(x) 2563 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2564 v1.AddArg(y) 2565 v.AddArg2(v0, v1) 2566 return true 2567 } 2568 } 2569 func rewriteValueWasm_OpRsh32Ux16(v *Value) bool { 2570 v_1 := v.Args[1] 2571 v_0 := v.Args[0] 2572 b := v.Block 2573 typ := &b.Func.Config.Types 2574 // match: (Rsh32Ux16 [c] x y) 2575 // result: (Rsh64Ux64 [c] (ZeroExt32to64 x) (ZeroExt16to64 y)) 2576 for { 2577 c := auxIntToBool(v.AuxInt) 2578 x := v_0 2579 y := v_1 2580 v.reset(OpRsh64Ux64) 2581 v.AuxInt = boolToAuxInt(c) 2582 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2583 v0.AddArg(x) 2584 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2585 v1.AddArg(y) 2586 v.AddArg2(v0, v1) 2587 return true 2588 } 2589 } 2590 func rewriteValueWasm_OpRsh32Ux32(v *Value) bool { 2591 v_1 := v.Args[1] 2592 v_0 := v.Args[0] 2593 b := v.Block 2594 typ := &b.Func.Config.Types 2595 // match: (Rsh32Ux32 [c] x y) 2596 // result: (Rsh64Ux64 [c] (ZeroExt32to64 x) (ZeroExt32to64 y)) 2597 for { 2598 c := auxIntToBool(v.AuxInt) 2599 x := v_0 2600 y := v_1 2601 v.reset(OpRsh64Ux64) 2602 v.AuxInt = boolToAuxInt(c) 2603 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2604 v0.AddArg(x) 2605 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2606 v1.AddArg(y) 2607 v.AddArg2(v0, v1) 2608 return true 2609 } 2610 } 2611 func rewriteValueWasm_OpRsh32Ux64(v *Value) bool { 2612 v_1 := v.Args[1] 2613 v_0 := v.Args[0] 2614 b := v.Block 2615 typ := &b.Func.Config.Types 2616 // match: (Rsh32Ux64 [c] x y) 2617 // result: (Rsh64Ux64 [c] (ZeroExt32to64 x) y) 2618 for { 2619 c := auxIntToBool(v.AuxInt) 2620 x := v_0 2621 y := v_1 2622 v.reset(OpRsh64Ux64) 2623 v.AuxInt = boolToAuxInt(c) 2624 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2625 v0.AddArg(x) 2626 v.AddArg2(v0, y) 2627 return true 2628 } 2629 } 2630 func rewriteValueWasm_OpRsh32Ux8(v *Value) bool { 2631 v_1 := v.Args[1] 2632 v_0 := v.Args[0] 2633 b := v.Block 2634 typ := &b.Func.Config.Types 2635 // match: (Rsh32Ux8 [c] x y) 2636 // result: (Rsh64Ux64 [c] (ZeroExt32to64 x) (ZeroExt8to64 y)) 2637 for { 2638 c := auxIntToBool(v.AuxInt) 2639 x := v_0 2640 y := v_1 2641 v.reset(OpRsh64Ux64) 2642 v.AuxInt = boolToAuxInt(c) 2643 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2644 v0.AddArg(x) 2645 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2646 v1.AddArg(y) 2647 v.AddArg2(v0, v1) 2648 return true 2649 } 2650 } 2651 func rewriteValueWasm_OpRsh32x16(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: (Rsh32x16 [c] x y) 2657 // result: (Rsh64x64 [c] (SignExt32to64 x) (ZeroExt16to64 y)) 2658 for { 2659 c := auxIntToBool(v.AuxInt) 2660 x := v_0 2661 y := v_1 2662 v.reset(OpRsh64x64) 2663 v.AuxInt = boolToAuxInt(c) 2664 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 2665 v0.AddArg(x) 2666 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2667 v1.AddArg(y) 2668 v.AddArg2(v0, v1) 2669 return true 2670 } 2671 } 2672 func rewriteValueWasm_OpRsh32x32(v *Value) bool { 2673 v_1 := v.Args[1] 2674 v_0 := v.Args[0] 2675 b := v.Block 2676 typ := &b.Func.Config.Types 2677 // match: (Rsh32x32 [c] x y) 2678 // result: (Rsh64x64 [c] (SignExt32to64 x) (ZeroExt32to64 y)) 2679 for { 2680 c := auxIntToBool(v.AuxInt) 2681 x := v_0 2682 y := v_1 2683 v.reset(OpRsh64x64) 2684 v.AuxInt = boolToAuxInt(c) 2685 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 2686 v0.AddArg(x) 2687 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2688 v1.AddArg(y) 2689 v.AddArg2(v0, v1) 2690 return true 2691 } 2692 } 2693 func rewriteValueWasm_OpRsh32x64(v *Value) bool { 2694 v_1 := v.Args[1] 2695 v_0 := v.Args[0] 2696 b := v.Block 2697 typ := &b.Func.Config.Types 2698 // match: (Rsh32x64 [c] x y) 2699 // result: (Rsh64x64 [c] (SignExt32to64 x) y) 2700 for { 2701 c := auxIntToBool(v.AuxInt) 2702 x := v_0 2703 y := v_1 2704 v.reset(OpRsh64x64) 2705 v.AuxInt = boolToAuxInt(c) 2706 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 2707 v0.AddArg(x) 2708 v.AddArg2(v0, y) 2709 return true 2710 } 2711 } 2712 func rewriteValueWasm_OpRsh32x8(v *Value) bool { 2713 v_1 := v.Args[1] 2714 v_0 := v.Args[0] 2715 b := v.Block 2716 typ := &b.Func.Config.Types 2717 // match: (Rsh32x8 [c] x y) 2718 // result: (Rsh64x64 [c] (SignExt32to64 x) (ZeroExt8to64 y)) 2719 for { 2720 c := auxIntToBool(v.AuxInt) 2721 x := v_0 2722 y := v_1 2723 v.reset(OpRsh64x64) 2724 v.AuxInt = boolToAuxInt(c) 2725 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 2726 v0.AddArg(x) 2727 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2728 v1.AddArg(y) 2729 v.AddArg2(v0, v1) 2730 return true 2731 } 2732 } 2733 func rewriteValueWasm_OpRsh64Ux16(v *Value) bool { 2734 v_1 := v.Args[1] 2735 v_0 := v.Args[0] 2736 b := v.Block 2737 typ := &b.Func.Config.Types 2738 // match: (Rsh64Ux16 [c] x y) 2739 // result: (Rsh64Ux64 [c] x (ZeroExt16to64 y)) 2740 for { 2741 c := auxIntToBool(v.AuxInt) 2742 x := v_0 2743 y := v_1 2744 v.reset(OpRsh64Ux64) 2745 v.AuxInt = boolToAuxInt(c) 2746 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2747 v0.AddArg(y) 2748 v.AddArg2(x, v0) 2749 return true 2750 } 2751 } 2752 func rewriteValueWasm_OpRsh64Ux32(v *Value) bool { 2753 v_1 := v.Args[1] 2754 v_0 := v.Args[0] 2755 b := v.Block 2756 typ := &b.Func.Config.Types 2757 // match: (Rsh64Ux32 [c] x y) 2758 // result: (Rsh64Ux64 [c] x (ZeroExt32to64 y)) 2759 for { 2760 c := auxIntToBool(v.AuxInt) 2761 x := v_0 2762 y := v_1 2763 v.reset(OpRsh64Ux64) 2764 v.AuxInt = boolToAuxInt(c) 2765 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2766 v0.AddArg(y) 2767 v.AddArg2(x, v0) 2768 return true 2769 } 2770 } 2771 func rewriteValueWasm_OpRsh64Ux64(v *Value) bool { 2772 v_1 := v.Args[1] 2773 v_0 := v.Args[0] 2774 b := v.Block 2775 typ := &b.Func.Config.Types 2776 // match: (Rsh64Ux64 x y) 2777 // cond: shiftIsBounded(v) 2778 // result: (I64ShrU x y) 2779 for { 2780 x := v_0 2781 y := v_1 2782 if !(shiftIsBounded(v)) { 2783 break 2784 } 2785 v.reset(OpWasmI64ShrU) 2786 v.AddArg2(x, y) 2787 return true 2788 } 2789 // match: (Rsh64Ux64 x (I64Const [c])) 2790 // cond: uint64(c) < 64 2791 // result: (I64ShrU x (I64Const [c])) 2792 for { 2793 x := v_0 2794 if v_1.Op != OpWasmI64Const { 2795 break 2796 } 2797 c := auxIntToInt64(v_1.AuxInt) 2798 if !(uint64(c) < 64) { 2799 break 2800 } 2801 v.reset(OpWasmI64ShrU) 2802 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2803 v0.AuxInt = int64ToAuxInt(c) 2804 v.AddArg2(x, v0) 2805 return true 2806 } 2807 // match: (Rsh64Ux64 x (I64Const [c])) 2808 // cond: uint64(c) >= 64 2809 // result: (I64Const [0]) 2810 for { 2811 if v_1.Op != OpWasmI64Const { 2812 break 2813 } 2814 c := auxIntToInt64(v_1.AuxInt) 2815 if !(uint64(c) >= 64) { 2816 break 2817 } 2818 v.reset(OpWasmI64Const) 2819 v.AuxInt = int64ToAuxInt(0) 2820 return true 2821 } 2822 // match: (Rsh64Ux64 x y) 2823 // result: (Select (I64ShrU x y) (I64Const [0]) (I64LtU y (I64Const [64]))) 2824 for { 2825 x := v_0 2826 y := v_1 2827 v.reset(OpWasmSelect) 2828 v0 := b.NewValue0(v.Pos, OpWasmI64ShrU, typ.Int64) 2829 v0.AddArg2(x, y) 2830 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2831 v1.AuxInt = int64ToAuxInt(0) 2832 v2 := b.NewValue0(v.Pos, OpWasmI64LtU, typ.Bool) 2833 v3 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2834 v3.AuxInt = int64ToAuxInt(64) 2835 v2.AddArg2(y, v3) 2836 v.AddArg3(v0, v1, v2) 2837 return true 2838 } 2839 } 2840 func rewriteValueWasm_OpRsh64Ux8(v *Value) bool { 2841 v_1 := v.Args[1] 2842 v_0 := v.Args[0] 2843 b := v.Block 2844 typ := &b.Func.Config.Types 2845 // match: (Rsh64Ux8 [c] x y) 2846 // result: (Rsh64Ux64 [c] x (ZeroExt8to64 y)) 2847 for { 2848 c := auxIntToBool(v.AuxInt) 2849 x := v_0 2850 y := v_1 2851 v.reset(OpRsh64Ux64) 2852 v.AuxInt = boolToAuxInt(c) 2853 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2854 v0.AddArg(y) 2855 v.AddArg2(x, v0) 2856 return true 2857 } 2858 } 2859 func rewriteValueWasm_OpRsh64x16(v *Value) bool { 2860 v_1 := v.Args[1] 2861 v_0 := v.Args[0] 2862 b := v.Block 2863 typ := &b.Func.Config.Types 2864 // match: (Rsh64x16 [c] x y) 2865 // result: (Rsh64x64 [c] x (ZeroExt16to64 y)) 2866 for { 2867 c := auxIntToBool(v.AuxInt) 2868 x := v_0 2869 y := v_1 2870 v.reset(OpRsh64x64) 2871 v.AuxInt = boolToAuxInt(c) 2872 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2873 v0.AddArg(y) 2874 v.AddArg2(x, v0) 2875 return true 2876 } 2877 } 2878 func rewriteValueWasm_OpRsh64x32(v *Value) bool { 2879 v_1 := v.Args[1] 2880 v_0 := v.Args[0] 2881 b := v.Block 2882 typ := &b.Func.Config.Types 2883 // match: (Rsh64x32 [c] x y) 2884 // result: (Rsh64x64 [c] x (ZeroExt32to64 y)) 2885 for { 2886 c := auxIntToBool(v.AuxInt) 2887 x := v_0 2888 y := v_1 2889 v.reset(OpRsh64x64) 2890 v.AuxInt = boolToAuxInt(c) 2891 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2892 v0.AddArg(y) 2893 v.AddArg2(x, v0) 2894 return true 2895 } 2896 } 2897 func rewriteValueWasm_OpRsh64x64(v *Value) bool { 2898 v_1 := v.Args[1] 2899 v_0 := v.Args[0] 2900 b := v.Block 2901 typ := &b.Func.Config.Types 2902 // match: (Rsh64x64 x y) 2903 // cond: shiftIsBounded(v) 2904 // result: (I64ShrS x y) 2905 for { 2906 x := v_0 2907 y := v_1 2908 if !(shiftIsBounded(v)) { 2909 break 2910 } 2911 v.reset(OpWasmI64ShrS) 2912 v.AddArg2(x, y) 2913 return true 2914 } 2915 // match: (Rsh64x64 x (I64Const [c])) 2916 // cond: uint64(c) < 64 2917 // result: (I64ShrS x (I64Const [c])) 2918 for { 2919 x := v_0 2920 if v_1.Op != OpWasmI64Const { 2921 break 2922 } 2923 c := auxIntToInt64(v_1.AuxInt) 2924 if !(uint64(c) < 64) { 2925 break 2926 } 2927 v.reset(OpWasmI64ShrS) 2928 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2929 v0.AuxInt = int64ToAuxInt(c) 2930 v.AddArg2(x, v0) 2931 return true 2932 } 2933 // match: (Rsh64x64 x (I64Const [c])) 2934 // cond: uint64(c) >= 64 2935 // result: (I64ShrS x (I64Const [63])) 2936 for { 2937 x := v_0 2938 if v_1.Op != OpWasmI64Const { 2939 break 2940 } 2941 c := auxIntToInt64(v_1.AuxInt) 2942 if !(uint64(c) >= 64) { 2943 break 2944 } 2945 v.reset(OpWasmI64ShrS) 2946 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2947 v0.AuxInt = int64ToAuxInt(63) 2948 v.AddArg2(x, v0) 2949 return true 2950 } 2951 // match: (Rsh64x64 x y) 2952 // result: (I64ShrS x (Select <typ.Int64> y (I64Const [63]) (I64LtU y (I64Const [64])))) 2953 for { 2954 x := v_0 2955 y := v_1 2956 v.reset(OpWasmI64ShrS) 2957 v0 := b.NewValue0(v.Pos, OpWasmSelect, typ.Int64) 2958 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2959 v1.AuxInt = int64ToAuxInt(63) 2960 v2 := b.NewValue0(v.Pos, OpWasmI64LtU, typ.Bool) 2961 v3 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 2962 v3.AuxInt = int64ToAuxInt(64) 2963 v2.AddArg2(y, v3) 2964 v0.AddArg3(y, v1, v2) 2965 v.AddArg2(x, v0) 2966 return true 2967 } 2968 } 2969 func rewriteValueWasm_OpRsh64x8(v *Value) bool { 2970 v_1 := v.Args[1] 2971 v_0 := v.Args[0] 2972 b := v.Block 2973 typ := &b.Func.Config.Types 2974 // match: (Rsh64x8 [c] x y) 2975 // result: (Rsh64x64 [c] x (ZeroExt8to64 y)) 2976 for { 2977 c := auxIntToBool(v.AuxInt) 2978 x := v_0 2979 y := v_1 2980 v.reset(OpRsh64x64) 2981 v.AuxInt = boolToAuxInt(c) 2982 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2983 v0.AddArg(y) 2984 v.AddArg2(x, v0) 2985 return true 2986 } 2987 } 2988 func rewriteValueWasm_OpRsh8Ux16(v *Value) bool { 2989 v_1 := v.Args[1] 2990 v_0 := v.Args[0] 2991 b := v.Block 2992 typ := &b.Func.Config.Types 2993 // match: (Rsh8Ux16 [c] x y) 2994 // result: (Rsh64Ux64 [c] (ZeroExt8to64 x) (ZeroExt16to64 y)) 2995 for { 2996 c := auxIntToBool(v.AuxInt) 2997 x := v_0 2998 y := v_1 2999 v.reset(OpRsh64Ux64) 3000 v.AuxInt = boolToAuxInt(c) 3001 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 3002 v0.AddArg(x) 3003 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 3004 v1.AddArg(y) 3005 v.AddArg2(v0, v1) 3006 return true 3007 } 3008 } 3009 func rewriteValueWasm_OpRsh8Ux32(v *Value) bool { 3010 v_1 := v.Args[1] 3011 v_0 := v.Args[0] 3012 b := v.Block 3013 typ := &b.Func.Config.Types 3014 // match: (Rsh8Ux32 [c] x y) 3015 // result: (Rsh64Ux64 [c] (ZeroExt8to64 x) (ZeroExt32to64 y)) 3016 for { 3017 c := auxIntToBool(v.AuxInt) 3018 x := v_0 3019 y := v_1 3020 v.reset(OpRsh64Ux64) 3021 v.AuxInt = boolToAuxInt(c) 3022 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 3023 v0.AddArg(x) 3024 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 3025 v1.AddArg(y) 3026 v.AddArg2(v0, v1) 3027 return true 3028 } 3029 } 3030 func rewriteValueWasm_OpRsh8Ux64(v *Value) bool { 3031 v_1 := v.Args[1] 3032 v_0 := v.Args[0] 3033 b := v.Block 3034 typ := &b.Func.Config.Types 3035 // match: (Rsh8Ux64 [c] x y) 3036 // result: (Rsh64Ux64 [c] (ZeroExt8to64 x) y) 3037 for { 3038 c := auxIntToBool(v.AuxInt) 3039 x := v_0 3040 y := v_1 3041 v.reset(OpRsh64Ux64) 3042 v.AuxInt = boolToAuxInt(c) 3043 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 3044 v0.AddArg(x) 3045 v.AddArg2(v0, y) 3046 return true 3047 } 3048 } 3049 func rewriteValueWasm_OpRsh8Ux8(v *Value) bool { 3050 v_1 := v.Args[1] 3051 v_0 := v.Args[0] 3052 b := v.Block 3053 typ := &b.Func.Config.Types 3054 // match: (Rsh8Ux8 [c] x y) 3055 // result: (Rsh64Ux64 [c] (ZeroExt8to64 x) (ZeroExt8to64 y)) 3056 for { 3057 c := auxIntToBool(v.AuxInt) 3058 x := v_0 3059 y := v_1 3060 v.reset(OpRsh64Ux64) 3061 v.AuxInt = boolToAuxInt(c) 3062 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 3063 v0.AddArg(x) 3064 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 3065 v1.AddArg(y) 3066 v.AddArg2(v0, v1) 3067 return true 3068 } 3069 } 3070 func rewriteValueWasm_OpRsh8x16(v *Value) bool { 3071 v_1 := v.Args[1] 3072 v_0 := v.Args[0] 3073 b := v.Block 3074 typ := &b.Func.Config.Types 3075 // match: (Rsh8x16 [c] x y) 3076 // result: (Rsh64x64 [c] (SignExt8to64 x) (ZeroExt16to64 y)) 3077 for { 3078 c := auxIntToBool(v.AuxInt) 3079 x := v_0 3080 y := v_1 3081 v.reset(OpRsh64x64) 3082 v.AuxInt = boolToAuxInt(c) 3083 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 3084 v0.AddArg(x) 3085 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 3086 v1.AddArg(y) 3087 v.AddArg2(v0, v1) 3088 return true 3089 } 3090 } 3091 func rewriteValueWasm_OpRsh8x32(v *Value) bool { 3092 v_1 := v.Args[1] 3093 v_0 := v.Args[0] 3094 b := v.Block 3095 typ := &b.Func.Config.Types 3096 // match: (Rsh8x32 [c] x y) 3097 // result: (Rsh64x64 [c] (SignExt8to64 x) (ZeroExt32to64 y)) 3098 for { 3099 c := auxIntToBool(v.AuxInt) 3100 x := v_0 3101 y := v_1 3102 v.reset(OpRsh64x64) 3103 v.AuxInt = boolToAuxInt(c) 3104 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 3105 v0.AddArg(x) 3106 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 3107 v1.AddArg(y) 3108 v.AddArg2(v0, v1) 3109 return true 3110 } 3111 } 3112 func rewriteValueWasm_OpRsh8x64(v *Value) bool { 3113 v_1 := v.Args[1] 3114 v_0 := v.Args[0] 3115 b := v.Block 3116 typ := &b.Func.Config.Types 3117 // match: (Rsh8x64 [c] x y) 3118 // result: (Rsh64x64 [c] (SignExt8to64 x) y) 3119 for { 3120 c := auxIntToBool(v.AuxInt) 3121 x := v_0 3122 y := v_1 3123 v.reset(OpRsh64x64) 3124 v.AuxInt = boolToAuxInt(c) 3125 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 3126 v0.AddArg(x) 3127 v.AddArg2(v0, y) 3128 return true 3129 } 3130 } 3131 func rewriteValueWasm_OpRsh8x8(v *Value) bool { 3132 v_1 := v.Args[1] 3133 v_0 := v.Args[0] 3134 b := v.Block 3135 typ := &b.Func.Config.Types 3136 // match: (Rsh8x8 [c] x y) 3137 // result: (Rsh64x64 [c] (SignExt8to64 x) (ZeroExt8to64 y)) 3138 for { 3139 c := auxIntToBool(v.AuxInt) 3140 x := v_0 3141 y := v_1 3142 v.reset(OpRsh64x64) 3143 v.AuxInt = boolToAuxInt(c) 3144 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 3145 v0.AddArg(x) 3146 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 3147 v1.AddArg(y) 3148 v.AddArg2(v0, v1) 3149 return true 3150 } 3151 } 3152 func rewriteValueWasm_OpSignExt16to32(v *Value) bool { 3153 v_0 := v.Args[0] 3154 b := v.Block 3155 typ := &b.Func.Config.Types 3156 // match: (SignExt16to32 x:(I64Load16S _ _)) 3157 // result: x 3158 for { 3159 x := v_0 3160 if x.Op != OpWasmI64Load16S { 3161 break 3162 } 3163 v.copyOf(x) 3164 return true 3165 } 3166 // match: (SignExt16to32 x) 3167 // cond: buildcfg.GOWASM.SignExt 3168 // result: (I64Extend16S x) 3169 for { 3170 x := v_0 3171 if !(buildcfg.GOWASM.SignExt) { 3172 break 3173 } 3174 v.reset(OpWasmI64Extend16S) 3175 v.AddArg(x) 3176 return true 3177 } 3178 // match: (SignExt16to32 x) 3179 // result: (I64ShrS (I64Shl x (I64Const [48])) (I64Const [48])) 3180 for { 3181 x := v_0 3182 v.reset(OpWasmI64ShrS) 3183 v0 := b.NewValue0(v.Pos, OpWasmI64Shl, typ.Int64) 3184 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3185 v1.AuxInt = int64ToAuxInt(48) 3186 v0.AddArg2(x, v1) 3187 v.AddArg2(v0, v1) 3188 return true 3189 } 3190 } 3191 func rewriteValueWasm_OpSignExt16to64(v *Value) bool { 3192 v_0 := v.Args[0] 3193 b := v.Block 3194 typ := &b.Func.Config.Types 3195 // match: (SignExt16to64 x:(I64Load16S _ _)) 3196 // result: x 3197 for { 3198 x := v_0 3199 if x.Op != OpWasmI64Load16S { 3200 break 3201 } 3202 v.copyOf(x) 3203 return true 3204 } 3205 // match: (SignExt16to64 x) 3206 // cond: buildcfg.GOWASM.SignExt 3207 // result: (I64Extend16S x) 3208 for { 3209 x := v_0 3210 if !(buildcfg.GOWASM.SignExt) { 3211 break 3212 } 3213 v.reset(OpWasmI64Extend16S) 3214 v.AddArg(x) 3215 return true 3216 } 3217 // match: (SignExt16to64 x) 3218 // result: (I64ShrS (I64Shl x (I64Const [48])) (I64Const [48])) 3219 for { 3220 x := v_0 3221 v.reset(OpWasmI64ShrS) 3222 v0 := b.NewValue0(v.Pos, OpWasmI64Shl, typ.Int64) 3223 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3224 v1.AuxInt = int64ToAuxInt(48) 3225 v0.AddArg2(x, v1) 3226 v.AddArg2(v0, v1) 3227 return true 3228 } 3229 } 3230 func rewriteValueWasm_OpSignExt32to64(v *Value) bool { 3231 v_0 := v.Args[0] 3232 b := v.Block 3233 typ := &b.Func.Config.Types 3234 // match: (SignExt32to64 x:(I64Load32S _ _)) 3235 // result: x 3236 for { 3237 x := v_0 3238 if x.Op != OpWasmI64Load32S { 3239 break 3240 } 3241 v.copyOf(x) 3242 return true 3243 } 3244 // match: (SignExt32to64 x) 3245 // cond: buildcfg.GOWASM.SignExt 3246 // result: (I64Extend32S x) 3247 for { 3248 x := v_0 3249 if !(buildcfg.GOWASM.SignExt) { 3250 break 3251 } 3252 v.reset(OpWasmI64Extend32S) 3253 v.AddArg(x) 3254 return true 3255 } 3256 // match: (SignExt32to64 x) 3257 // result: (I64ShrS (I64Shl x (I64Const [32])) (I64Const [32])) 3258 for { 3259 x := v_0 3260 v.reset(OpWasmI64ShrS) 3261 v0 := b.NewValue0(v.Pos, OpWasmI64Shl, typ.Int64) 3262 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3263 v1.AuxInt = int64ToAuxInt(32) 3264 v0.AddArg2(x, v1) 3265 v.AddArg2(v0, v1) 3266 return true 3267 } 3268 } 3269 func rewriteValueWasm_OpSignExt8to16(v *Value) bool { 3270 v_0 := v.Args[0] 3271 b := v.Block 3272 typ := &b.Func.Config.Types 3273 // match: (SignExt8to16 x:(I64Load8S _ _)) 3274 // result: x 3275 for { 3276 x := v_0 3277 if x.Op != OpWasmI64Load8S { 3278 break 3279 } 3280 v.copyOf(x) 3281 return true 3282 } 3283 // match: (SignExt8to16 x) 3284 // cond: buildcfg.GOWASM.SignExt 3285 // result: (I64Extend8S x) 3286 for { 3287 x := v_0 3288 if !(buildcfg.GOWASM.SignExt) { 3289 break 3290 } 3291 v.reset(OpWasmI64Extend8S) 3292 v.AddArg(x) 3293 return true 3294 } 3295 // match: (SignExt8to16 x) 3296 // result: (I64ShrS (I64Shl x (I64Const [56])) (I64Const [56])) 3297 for { 3298 x := v_0 3299 v.reset(OpWasmI64ShrS) 3300 v0 := b.NewValue0(v.Pos, OpWasmI64Shl, typ.Int64) 3301 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3302 v1.AuxInt = int64ToAuxInt(56) 3303 v0.AddArg2(x, v1) 3304 v.AddArg2(v0, v1) 3305 return true 3306 } 3307 } 3308 func rewriteValueWasm_OpSignExt8to32(v *Value) bool { 3309 v_0 := v.Args[0] 3310 b := v.Block 3311 typ := &b.Func.Config.Types 3312 // match: (SignExt8to32 x:(I64Load8S _ _)) 3313 // result: x 3314 for { 3315 x := v_0 3316 if x.Op != OpWasmI64Load8S { 3317 break 3318 } 3319 v.copyOf(x) 3320 return true 3321 } 3322 // match: (SignExt8to32 x) 3323 // cond: buildcfg.GOWASM.SignExt 3324 // result: (I64Extend8S x) 3325 for { 3326 x := v_0 3327 if !(buildcfg.GOWASM.SignExt) { 3328 break 3329 } 3330 v.reset(OpWasmI64Extend8S) 3331 v.AddArg(x) 3332 return true 3333 } 3334 // match: (SignExt8to32 x) 3335 // result: (I64ShrS (I64Shl x (I64Const [56])) (I64Const [56])) 3336 for { 3337 x := v_0 3338 v.reset(OpWasmI64ShrS) 3339 v0 := b.NewValue0(v.Pos, OpWasmI64Shl, typ.Int64) 3340 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3341 v1.AuxInt = int64ToAuxInt(56) 3342 v0.AddArg2(x, v1) 3343 v.AddArg2(v0, v1) 3344 return true 3345 } 3346 } 3347 func rewriteValueWasm_OpSignExt8to64(v *Value) bool { 3348 v_0 := v.Args[0] 3349 b := v.Block 3350 typ := &b.Func.Config.Types 3351 // match: (SignExt8to64 x:(I64Load8S _ _)) 3352 // result: x 3353 for { 3354 x := v_0 3355 if x.Op != OpWasmI64Load8S { 3356 break 3357 } 3358 v.copyOf(x) 3359 return true 3360 } 3361 // match: (SignExt8to64 x) 3362 // cond: buildcfg.GOWASM.SignExt 3363 // result: (I64Extend8S x) 3364 for { 3365 x := v_0 3366 if !(buildcfg.GOWASM.SignExt) { 3367 break 3368 } 3369 v.reset(OpWasmI64Extend8S) 3370 v.AddArg(x) 3371 return true 3372 } 3373 // match: (SignExt8to64 x) 3374 // result: (I64ShrS (I64Shl x (I64Const [56])) (I64Const [56])) 3375 for { 3376 x := v_0 3377 v.reset(OpWasmI64ShrS) 3378 v0 := b.NewValue0(v.Pos, OpWasmI64Shl, typ.Int64) 3379 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3380 v1.AuxInt = int64ToAuxInt(56) 3381 v0.AddArg2(x, v1) 3382 v.AddArg2(v0, v1) 3383 return true 3384 } 3385 } 3386 func rewriteValueWasm_OpSlicemask(v *Value) bool { 3387 v_0 := v.Args[0] 3388 b := v.Block 3389 typ := &b.Func.Config.Types 3390 // match: (Slicemask x) 3391 // result: (I64ShrS (I64Sub (I64Const [0]) x) (I64Const [63])) 3392 for { 3393 x := v_0 3394 v.reset(OpWasmI64ShrS) 3395 v0 := b.NewValue0(v.Pos, OpWasmI64Sub, typ.Int64) 3396 v1 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3397 v1.AuxInt = int64ToAuxInt(0) 3398 v0.AddArg2(v1, x) 3399 v2 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3400 v2.AuxInt = int64ToAuxInt(63) 3401 v.AddArg2(v0, v2) 3402 return true 3403 } 3404 } 3405 func rewriteValueWasm_OpStore(v *Value) bool { 3406 v_2 := v.Args[2] 3407 v_1 := v.Args[1] 3408 v_0 := v.Args[0] 3409 // match: (Store {t} ptr val mem) 3410 // cond: is64BitFloat(t) 3411 // result: (F64Store ptr val mem) 3412 for { 3413 t := auxToType(v.Aux) 3414 ptr := v_0 3415 val := v_1 3416 mem := v_2 3417 if !(is64BitFloat(t)) { 3418 break 3419 } 3420 v.reset(OpWasmF64Store) 3421 v.AddArg3(ptr, val, mem) 3422 return true 3423 } 3424 // match: (Store {t} ptr val mem) 3425 // cond: is32BitFloat(t) 3426 // result: (F32Store ptr val mem) 3427 for { 3428 t := auxToType(v.Aux) 3429 ptr := v_0 3430 val := v_1 3431 mem := v_2 3432 if !(is32BitFloat(t)) { 3433 break 3434 } 3435 v.reset(OpWasmF32Store) 3436 v.AddArg3(ptr, val, mem) 3437 return true 3438 } 3439 // match: (Store {t} ptr val mem) 3440 // cond: t.Size() == 8 3441 // result: (I64Store ptr val mem) 3442 for { 3443 t := auxToType(v.Aux) 3444 ptr := v_0 3445 val := v_1 3446 mem := v_2 3447 if !(t.Size() == 8) { 3448 break 3449 } 3450 v.reset(OpWasmI64Store) 3451 v.AddArg3(ptr, val, mem) 3452 return true 3453 } 3454 // match: (Store {t} ptr val mem) 3455 // cond: t.Size() == 4 3456 // result: (I64Store32 ptr val mem) 3457 for { 3458 t := auxToType(v.Aux) 3459 ptr := v_0 3460 val := v_1 3461 mem := v_2 3462 if !(t.Size() == 4) { 3463 break 3464 } 3465 v.reset(OpWasmI64Store32) 3466 v.AddArg3(ptr, val, mem) 3467 return true 3468 } 3469 // match: (Store {t} ptr val mem) 3470 // cond: t.Size() == 2 3471 // result: (I64Store16 ptr val mem) 3472 for { 3473 t := auxToType(v.Aux) 3474 ptr := v_0 3475 val := v_1 3476 mem := v_2 3477 if !(t.Size() == 2) { 3478 break 3479 } 3480 v.reset(OpWasmI64Store16) 3481 v.AddArg3(ptr, val, mem) 3482 return true 3483 } 3484 // match: (Store {t} ptr val mem) 3485 // cond: t.Size() == 1 3486 // result: (I64Store8 ptr val mem) 3487 for { 3488 t := auxToType(v.Aux) 3489 ptr := v_0 3490 val := v_1 3491 mem := v_2 3492 if !(t.Size() == 1) { 3493 break 3494 } 3495 v.reset(OpWasmI64Store8) 3496 v.AddArg3(ptr, val, mem) 3497 return true 3498 } 3499 return false 3500 } 3501 func rewriteValueWasm_OpWasmF64Add(v *Value) bool { 3502 v_1 := v.Args[1] 3503 v_0 := v.Args[0] 3504 b := v.Block 3505 typ := &b.Func.Config.Types 3506 // match: (F64Add (F64Const [x]) (F64Const [y])) 3507 // result: (F64Const [x + y]) 3508 for { 3509 if v_0.Op != OpWasmF64Const { 3510 break 3511 } 3512 x := auxIntToFloat64(v_0.AuxInt) 3513 if v_1.Op != OpWasmF64Const { 3514 break 3515 } 3516 y := auxIntToFloat64(v_1.AuxInt) 3517 v.reset(OpWasmF64Const) 3518 v.AuxInt = float64ToAuxInt(x + y) 3519 return true 3520 } 3521 // match: (F64Add (F64Const [x]) y) 3522 // cond: y.Op != OpWasmF64Const 3523 // result: (F64Add y (F64Const [x])) 3524 for { 3525 if v_0.Op != OpWasmF64Const { 3526 break 3527 } 3528 x := auxIntToFloat64(v_0.AuxInt) 3529 y := v_1 3530 if !(y.Op != OpWasmF64Const) { 3531 break 3532 } 3533 v.reset(OpWasmF64Add) 3534 v0 := b.NewValue0(v.Pos, OpWasmF64Const, typ.Float64) 3535 v0.AuxInt = float64ToAuxInt(x) 3536 v.AddArg2(y, v0) 3537 return true 3538 } 3539 return false 3540 } 3541 func rewriteValueWasm_OpWasmF64Mul(v *Value) bool { 3542 v_1 := v.Args[1] 3543 v_0 := v.Args[0] 3544 b := v.Block 3545 typ := &b.Func.Config.Types 3546 // match: (F64Mul (F64Const [x]) (F64Const [y])) 3547 // cond: !math.IsNaN(x * y) 3548 // result: (F64Const [x * y]) 3549 for { 3550 if v_0.Op != OpWasmF64Const { 3551 break 3552 } 3553 x := auxIntToFloat64(v_0.AuxInt) 3554 if v_1.Op != OpWasmF64Const { 3555 break 3556 } 3557 y := auxIntToFloat64(v_1.AuxInt) 3558 if !(!math.IsNaN(x * y)) { 3559 break 3560 } 3561 v.reset(OpWasmF64Const) 3562 v.AuxInt = float64ToAuxInt(x * y) 3563 return true 3564 } 3565 // match: (F64Mul (F64Const [x]) y) 3566 // cond: y.Op != OpWasmF64Const 3567 // result: (F64Mul y (F64Const [x])) 3568 for { 3569 if v_0.Op != OpWasmF64Const { 3570 break 3571 } 3572 x := auxIntToFloat64(v_0.AuxInt) 3573 y := v_1 3574 if !(y.Op != OpWasmF64Const) { 3575 break 3576 } 3577 v.reset(OpWasmF64Mul) 3578 v0 := b.NewValue0(v.Pos, OpWasmF64Const, typ.Float64) 3579 v0.AuxInt = float64ToAuxInt(x) 3580 v.AddArg2(y, v0) 3581 return true 3582 } 3583 return false 3584 } 3585 func rewriteValueWasm_OpWasmI64Add(v *Value) bool { 3586 v_1 := v.Args[1] 3587 v_0 := v.Args[0] 3588 b := v.Block 3589 typ := &b.Func.Config.Types 3590 // match: (I64Add (I64Const [x]) (I64Const [y])) 3591 // result: (I64Const [x + y]) 3592 for { 3593 if v_0.Op != OpWasmI64Const { 3594 break 3595 } 3596 x := auxIntToInt64(v_0.AuxInt) 3597 if v_1.Op != OpWasmI64Const { 3598 break 3599 } 3600 y := auxIntToInt64(v_1.AuxInt) 3601 v.reset(OpWasmI64Const) 3602 v.AuxInt = int64ToAuxInt(x + y) 3603 return true 3604 } 3605 // match: (I64Add (I64Const [x]) y) 3606 // cond: y.Op != OpWasmI64Const 3607 // result: (I64Add y (I64Const [x])) 3608 for { 3609 if v_0.Op != OpWasmI64Const { 3610 break 3611 } 3612 x := auxIntToInt64(v_0.AuxInt) 3613 y := v_1 3614 if !(y.Op != OpWasmI64Const) { 3615 break 3616 } 3617 v.reset(OpWasmI64Add) 3618 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3619 v0.AuxInt = int64ToAuxInt(x) 3620 v.AddArg2(y, v0) 3621 return true 3622 } 3623 // match: (I64Add x (I64Const <t> [y])) 3624 // cond: !t.IsPtr() 3625 // result: (I64AddConst [y] x) 3626 for { 3627 x := v_0 3628 if v_1.Op != OpWasmI64Const { 3629 break 3630 } 3631 t := v_1.Type 3632 y := auxIntToInt64(v_1.AuxInt) 3633 if !(!t.IsPtr()) { 3634 break 3635 } 3636 v.reset(OpWasmI64AddConst) 3637 v.AuxInt = int64ToAuxInt(y) 3638 v.AddArg(x) 3639 return true 3640 } 3641 return false 3642 } 3643 func rewriteValueWasm_OpWasmI64AddConst(v *Value) bool { 3644 v_0 := v.Args[0] 3645 // match: (I64AddConst [0] x) 3646 // result: x 3647 for { 3648 if auxIntToInt64(v.AuxInt) != 0 { 3649 break 3650 } 3651 x := v_0 3652 v.copyOf(x) 3653 return true 3654 } 3655 // match: (I64AddConst [off] (LoweredAddr {sym} [off2] base)) 3656 // cond: isU32Bit(off+int64(off2)) 3657 // result: (LoweredAddr {sym} [int32(off)+off2] base) 3658 for { 3659 off := auxIntToInt64(v.AuxInt) 3660 if v_0.Op != OpWasmLoweredAddr { 3661 break 3662 } 3663 off2 := auxIntToInt32(v_0.AuxInt) 3664 sym := auxToSym(v_0.Aux) 3665 base := v_0.Args[0] 3666 if !(isU32Bit(off + int64(off2))) { 3667 break 3668 } 3669 v.reset(OpWasmLoweredAddr) 3670 v.AuxInt = int32ToAuxInt(int32(off) + off2) 3671 v.Aux = symToAux(sym) 3672 v.AddArg(base) 3673 return true 3674 } 3675 // match: (I64AddConst [off] x:(SP)) 3676 // cond: isU32Bit(off) 3677 // result: (LoweredAddr [int32(off)] x) 3678 for { 3679 off := auxIntToInt64(v.AuxInt) 3680 x := v_0 3681 if x.Op != OpSP || !(isU32Bit(off)) { 3682 break 3683 } 3684 v.reset(OpWasmLoweredAddr) 3685 v.AuxInt = int32ToAuxInt(int32(off)) 3686 v.AddArg(x) 3687 return true 3688 } 3689 return false 3690 } 3691 func rewriteValueWasm_OpWasmI64And(v *Value) bool { 3692 v_1 := v.Args[1] 3693 v_0 := v.Args[0] 3694 b := v.Block 3695 typ := &b.Func.Config.Types 3696 // match: (I64And (I64Const [x]) (I64Const [y])) 3697 // result: (I64Const [x & y]) 3698 for { 3699 if v_0.Op != OpWasmI64Const { 3700 break 3701 } 3702 x := auxIntToInt64(v_0.AuxInt) 3703 if v_1.Op != OpWasmI64Const { 3704 break 3705 } 3706 y := auxIntToInt64(v_1.AuxInt) 3707 v.reset(OpWasmI64Const) 3708 v.AuxInt = int64ToAuxInt(x & y) 3709 return true 3710 } 3711 // match: (I64And (I64Const [x]) y) 3712 // cond: y.Op != OpWasmI64Const 3713 // result: (I64And y (I64Const [x])) 3714 for { 3715 if v_0.Op != OpWasmI64Const { 3716 break 3717 } 3718 x := auxIntToInt64(v_0.AuxInt) 3719 y := v_1 3720 if !(y.Op != OpWasmI64Const) { 3721 break 3722 } 3723 v.reset(OpWasmI64And) 3724 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3725 v0.AuxInt = int64ToAuxInt(x) 3726 v.AddArg2(y, v0) 3727 return true 3728 } 3729 return false 3730 } 3731 func rewriteValueWasm_OpWasmI64Eq(v *Value) bool { 3732 v_1 := v.Args[1] 3733 v_0 := v.Args[0] 3734 b := v.Block 3735 typ := &b.Func.Config.Types 3736 // match: (I64Eq (I64Const [x]) (I64Const [y])) 3737 // cond: x == y 3738 // result: (I64Const [1]) 3739 for { 3740 if v_0.Op != OpWasmI64Const { 3741 break 3742 } 3743 x := auxIntToInt64(v_0.AuxInt) 3744 if v_1.Op != OpWasmI64Const { 3745 break 3746 } 3747 y := auxIntToInt64(v_1.AuxInt) 3748 if !(x == y) { 3749 break 3750 } 3751 v.reset(OpWasmI64Const) 3752 v.AuxInt = int64ToAuxInt(1) 3753 return true 3754 } 3755 // match: (I64Eq (I64Const [x]) (I64Const [y])) 3756 // cond: x != y 3757 // result: (I64Const [0]) 3758 for { 3759 if v_0.Op != OpWasmI64Const { 3760 break 3761 } 3762 x := auxIntToInt64(v_0.AuxInt) 3763 if v_1.Op != OpWasmI64Const { 3764 break 3765 } 3766 y := auxIntToInt64(v_1.AuxInt) 3767 if !(x != y) { 3768 break 3769 } 3770 v.reset(OpWasmI64Const) 3771 v.AuxInt = int64ToAuxInt(0) 3772 return true 3773 } 3774 // match: (I64Eq (I64Const [x]) y) 3775 // cond: y.Op != OpWasmI64Const 3776 // result: (I64Eq y (I64Const [x])) 3777 for { 3778 if v_0.Op != OpWasmI64Const { 3779 break 3780 } 3781 x := auxIntToInt64(v_0.AuxInt) 3782 y := v_1 3783 if !(y.Op != OpWasmI64Const) { 3784 break 3785 } 3786 v.reset(OpWasmI64Eq) 3787 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 3788 v0.AuxInt = int64ToAuxInt(x) 3789 v.AddArg2(y, v0) 3790 return true 3791 } 3792 // match: (I64Eq x (I64Const [0])) 3793 // result: (I64Eqz x) 3794 for { 3795 x := v_0 3796 if v_1.Op != OpWasmI64Const || auxIntToInt64(v_1.AuxInt) != 0 { 3797 break 3798 } 3799 v.reset(OpWasmI64Eqz) 3800 v.AddArg(x) 3801 return true 3802 } 3803 return false 3804 } 3805 func rewriteValueWasm_OpWasmI64Eqz(v *Value) bool { 3806 v_0 := v.Args[0] 3807 // match: (I64Eqz (I64Eqz (I64Eqz x))) 3808 // result: (I64Eqz x) 3809 for { 3810 if v_0.Op != OpWasmI64Eqz { 3811 break 3812 } 3813 v_0_0 := v_0.Args[0] 3814 if v_0_0.Op != OpWasmI64Eqz { 3815 break 3816 } 3817 x := v_0_0.Args[0] 3818 v.reset(OpWasmI64Eqz) 3819 v.AddArg(x) 3820 return true 3821 } 3822 return false 3823 } 3824 func rewriteValueWasm_OpWasmI64LeU(v *Value) bool { 3825 v_1 := v.Args[1] 3826 v_0 := v.Args[0] 3827 b := v.Block 3828 typ := &b.Func.Config.Types 3829 // match: (I64LeU x (I64Const [0])) 3830 // result: (I64Eqz x) 3831 for { 3832 x := v_0 3833 if v_1.Op != OpWasmI64Const || auxIntToInt64(v_1.AuxInt) != 0 { 3834 break 3835 } 3836 v.reset(OpWasmI64Eqz) 3837 v.AddArg(x) 3838 return true 3839 } 3840 // match: (I64LeU (I64Const [1]) x) 3841 // result: (I64Eqz (I64Eqz x)) 3842 for { 3843 if v_0.Op != OpWasmI64Const || auxIntToInt64(v_0.AuxInt) != 1 { 3844 break 3845 } 3846 x := v_1 3847 v.reset(OpWasmI64Eqz) 3848 v0 := b.NewValue0(v.Pos, OpWasmI64Eqz, typ.Bool) 3849 v0.AddArg(x) 3850 v.AddArg(v0) 3851 return true 3852 } 3853 return false 3854 } 3855 func rewriteValueWasm_OpWasmI64Load(v *Value) bool { 3856 v_1 := v.Args[1] 3857 v_0 := v.Args[0] 3858 b := v.Block 3859 config := b.Func.Config 3860 // match: (I64Load [off] (I64AddConst [off2] ptr) mem) 3861 // cond: isU32Bit(off+off2) 3862 // result: (I64Load [off+off2] ptr mem) 3863 for { 3864 off := auxIntToInt64(v.AuxInt) 3865 if v_0.Op != OpWasmI64AddConst { 3866 break 3867 } 3868 off2 := auxIntToInt64(v_0.AuxInt) 3869 ptr := v_0.Args[0] 3870 mem := v_1 3871 if !(isU32Bit(off + off2)) { 3872 break 3873 } 3874 v.reset(OpWasmI64Load) 3875 v.AuxInt = int64ToAuxInt(off + off2) 3876 v.AddArg2(ptr, mem) 3877 return true 3878 } 3879 // match: (I64Load [off] (LoweredAddr {sym} [off2] (SB)) _) 3880 // cond: symIsRO(sym) && isU32Bit(off+int64(off2)) 3881 // result: (I64Const [int64(read64(sym, off+int64(off2), config.ctxt.Arch.ByteOrder))]) 3882 for { 3883 off := auxIntToInt64(v.AuxInt) 3884 if v_0.Op != OpWasmLoweredAddr { 3885 break 3886 } 3887 off2 := auxIntToInt32(v_0.AuxInt) 3888 sym := auxToSym(v_0.Aux) 3889 v_0_0 := v_0.Args[0] 3890 if v_0_0.Op != OpSB || !(symIsRO(sym) && isU32Bit(off+int64(off2))) { 3891 break 3892 } 3893 v.reset(OpWasmI64Const) 3894 v.AuxInt = int64ToAuxInt(int64(read64(sym, off+int64(off2), config.ctxt.Arch.ByteOrder))) 3895 return true 3896 } 3897 return false 3898 } 3899 func rewriteValueWasm_OpWasmI64Load16S(v *Value) bool { 3900 v_1 := v.Args[1] 3901 v_0 := v.Args[0] 3902 // match: (I64Load16S [off] (I64AddConst [off2] ptr) mem) 3903 // cond: isU32Bit(off+off2) 3904 // result: (I64Load16S [off+off2] ptr mem) 3905 for { 3906 off := auxIntToInt64(v.AuxInt) 3907 if v_0.Op != OpWasmI64AddConst { 3908 break 3909 } 3910 off2 := auxIntToInt64(v_0.AuxInt) 3911 ptr := v_0.Args[0] 3912 mem := v_1 3913 if !(isU32Bit(off + off2)) { 3914 break 3915 } 3916 v.reset(OpWasmI64Load16S) 3917 v.AuxInt = int64ToAuxInt(off + off2) 3918 v.AddArg2(ptr, mem) 3919 return true 3920 } 3921 return false 3922 } 3923 func rewriteValueWasm_OpWasmI64Load16U(v *Value) bool { 3924 v_1 := v.Args[1] 3925 v_0 := v.Args[0] 3926 b := v.Block 3927 config := b.Func.Config 3928 // match: (I64Load16U [off] (I64AddConst [off2] ptr) mem) 3929 // cond: isU32Bit(off+off2) 3930 // result: (I64Load16U [off+off2] ptr mem) 3931 for { 3932 off := auxIntToInt64(v.AuxInt) 3933 if v_0.Op != OpWasmI64AddConst { 3934 break 3935 } 3936 off2 := auxIntToInt64(v_0.AuxInt) 3937 ptr := v_0.Args[0] 3938 mem := v_1 3939 if !(isU32Bit(off + off2)) { 3940 break 3941 } 3942 v.reset(OpWasmI64Load16U) 3943 v.AuxInt = int64ToAuxInt(off + off2) 3944 v.AddArg2(ptr, mem) 3945 return true 3946 } 3947 // match: (I64Load16U [off] (LoweredAddr {sym} [off2] (SB)) _) 3948 // cond: symIsRO(sym) && isU32Bit(off+int64(off2)) 3949 // result: (I64Const [int64(read16(sym, off+int64(off2), config.ctxt.Arch.ByteOrder))]) 3950 for { 3951 off := auxIntToInt64(v.AuxInt) 3952 if v_0.Op != OpWasmLoweredAddr { 3953 break 3954 } 3955 off2 := auxIntToInt32(v_0.AuxInt) 3956 sym := auxToSym(v_0.Aux) 3957 v_0_0 := v_0.Args[0] 3958 if v_0_0.Op != OpSB || !(symIsRO(sym) && isU32Bit(off+int64(off2))) { 3959 break 3960 } 3961 v.reset(OpWasmI64Const) 3962 v.AuxInt = int64ToAuxInt(int64(read16(sym, off+int64(off2), config.ctxt.Arch.ByteOrder))) 3963 return true 3964 } 3965 return false 3966 } 3967 func rewriteValueWasm_OpWasmI64Load32S(v *Value) bool { 3968 v_1 := v.Args[1] 3969 v_0 := v.Args[0] 3970 // match: (I64Load32S [off] (I64AddConst [off2] ptr) mem) 3971 // cond: isU32Bit(off+off2) 3972 // result: (I64Load32S [off+off2] ptr mem) 3973 for { 3974 off := auxIntToInt64(v.AuxInt) 3975 if v_0.Op != OpWasmI64AddConst { 3976 break 3977 } 3978 off2 := auxIntToInt64(v_0.AuxInt) 3979 ptr := v_0.Args[0] 3980 mem := v_1 3981 if !(isU32Bit(off + off2)) { 3982 break 3983 } 3984 v.reset(OpWasmI64Load32S) 3985 v.AuxInt = int64ToAuxInt(off + off2) 3986 v.AddArg2(ptr, mem) 3987 return true 3988 } 3989 return false 3990 } 3991 func rewriteValueWasm_OpWasmI64Load32U(v *Value) bool { 3992 v_1 := v.Args[1] 3993 v_0 := v.Args[0] 3994 b := v.Block 3995 config := b.Func.Config 3996 // match: (I64Load32U [off] (I64AddConst [off2] ptr) mem) 3997 // cond: isU32Bit(off+off2) 3998 // result: (I64Load32U [off+off2] ptr mem) 3999 for { 4000 off := auxIntToInt64(v.AuxInt) 4001 if v_0.Op != OpWasmI64AddConst { 4002 break 4003 } 4004 off2 := auxIntToInt64(v_0.AuxInt) 4005 ptr := v_0.Args[0] 4006 mem := v_1 4007 if !(isU32Bit(off + off2)) { 4008 break 4009 } 4010 v.reset(OpWasmI64Load32U) 4011 v.AuxInt = int64ToAuxInt(off + off2) 4012 v.AddArg2(ptr, mem) 4013 return true 4014 } 4015 // match: (I64Load32U [off] (LoweredAddr {sym} [off2] (SB)) _) 4016 // cond: symIsRO(sym) && isU32Bit(off+int64(off2)) 4017 // result: (I64Const [int64(read32(sym, off+int64(off2), config.ctxt.Arch.ByteOrder))]) 4018 for { 4019 off := auxIntToInt64(v.AuxInt) 4020 if v_0.Op != OpWasmLoweredAddr { 4021 break 4022 } 4023 off2 := auxIntToInt32(v_0.AuxInt) 4024 sym := auxToSym(v_0.Aux) 4025 v_0_0 := v_0.Args[0] 4026 if v_0_0.Op != OpSB || !(symIsRO(sym) && isU32Bit(off+int64(off2))) { 4027 break 4028 } 4029 v.reset(OpWasmI64Const) 4030 v.AuxInt = int64ToAuxInt(int64(read32(sym, off+int64(off2), config.ctxt.Arch.ByteOrder))) 4031 return true 4032 } 4033 return false 4034 } 4035 func rewriteValueWasm_OpWasmI64Load8S(v *Value) bool { 4036 v_1 := v.Args[1] 4037 v_0 := v.Args[0] 4038 // match: (I64Load8S [off] (I64AddConst [off2] ptr) mem) 4039 // cond: isU32Bit(off+off2) 4040 // result: (I64Load8S [off+off2] ptr mem) 4041 for { 4042 off := auxIntToInt64(v.AuxInt) 4043 if v_0.Op != OpWasmI64AddConst { 4044 break 4045 } 4046 off2 := auxIntToInt64(v_0.AuxInt) 4047 ptr := v_0.Args[0] 4048 mem := v_1 4049 if !(isU32Bit(off + off2)) { 4050 break 4051 } 4052 v.reset(OpWasmI64Load8S) 4053 v.AuxInt = int64ToAuxInt(off + off2) 4054 v.AddArg2(ptr, mem) 4055 return true 4056 } 4057 return false 4058 } 4059 func rewriteValueWasm_OpWasmI64Load8U(v *Value) bool { 4060 v_1 := v.Args[1] 4061 v_0 := v.Args[0] 4062 // match: (I64Load8U [off] (I64AddConst [off2] ptr) mem) 4063 // cond: isU32Bit(off+off2) 4064 // result: (I64Load8U [off+off2] ptr mem) 4065 for { 4066 off := auxIntToInt64(v.AuxInt) 4067 if v_0.Op != OpWasmI64AddConst { 4068 break 4069 } 4070 off2 := auxIntToInt64(v_0.AuxInt) 4071 ptr := v_0.Args[0] 4072 mem := v_1 4073 if !(isU32Bit(off + off2)) { 4074 break 4075 } 4076 v.reset(OpWasmI64Load8U) 4077 v.AuxInt = int64ToAuxInt(off + off2) 4078 v.AddArg2(ptr, mem) 4079 return true 4080 } 4081 // match: (I64Load8U [off] (LoweredAddr {sym} [off2] (SB)) _) 4082 // cond: symIsRO(sym) && isU32Bit(off+int64(off2)) 4083 // result: (I64Const [int64(read8(sym, off+int64(off2)))]) 4084 for { 4085 off := auxIntToInt64(v.AuxInt) 4086 if v_0.Op != OpWasmLoweredAddr { 4087 break 4088 } 4089 off2 := auxIntToInt32(v_0.AuxInt) 4090 sym := auxToSym(v_0.Aux) 4091 v_0_0 := v_0.Args[0] 4092 if v_0_0.Op != OpSB || !(symIsRO(sym) && isU32Bit(off+int64(off2))) { 4093 break 4094 } 4095 v.reset(OpWasmI64Const) 4096 v.AuxInt = int64ToAuxInt(int64(read8(sym, off+int64(off2)))) 4097 return true 4098 } 4099 return false 4100 } 4101 func rewriteValueWasm_OpWasmI64LtU(v *Value) bool { 4102 v_1 := v.Args[1] 4103 v_0 := v.Args[0] 4104 b := v.Block 4105 typ := &b.Func.Config.Types 4106 // match: (I64LtU (I64Const [0]) x) 4107 // result: (I64Eqz (I64Eqz x)) 4108 for { 4109 if v_0.Op != OpWasmI64Const || auxIntToInt64(v_0.AuxInt) != 0 { 4110 break 4111 } 4112 x := v_1 4113 v.reset(OpWasmI64Eqz) 4114 v0 := b.NewValue0(v.Pos, OpWasmI64Eqz, typ.Bool) 4115 v0.AddArg(x) 4116 v.AddArg(v0) 4117 return true 4118 } 4119 // match: (I64LtU x (I64Const [1])) 4120 // result: (I64Eqz x) 4121 for { 4122 x := v_0 4123 if v_1.Op != OpWasmI64Const || auxIntToInt64(v_1.AuxInt) != 1 { 4124 break 4125 } 4126 v.reset(OpWasmI64Eqz) 4127 v.AddArg(x) 4128 return true 4129 } 4130 return false 4131 } 4132 func rewriteValueWasm_OpWasmI64Mul(v *Value) bool { 4133 v_1 := v.Args[1] 4134 v_0 := v.Args[0] 4135 b := v.Block 4136 typ := &b.Func.Config.Types 4137 // match: (I64Mul (I64Const [x]) (I64Const [y])) 4138 // result: (I64Const [x * y]) 4139 for { 4140 if v_0.Op != OpWasmI64Const { 4141 break 4142 } 4143 x := auxIntToInt64(v_0.AuxInt) 4144 if v_1.Op != OpWasmI64Const { 4145 break 4146 } 4147 y := auxIntToInt64(v_1.AuxInt) 4148 v.reset(OpWasmI64Const) 4149 v.AuxInt = int64ToAuxInt(x * y) 4150 return true 4151 } 4152 // match: (I64Mul (I64Const [x]) y) 4153 // cond: y.Op != OpWasmI64Const 4154 // result: (I64Mul y (I64Const [x])) 4155 for { 4156 if v_0.Op != OpWasmI64Const { 4157 break 4158 } 4159 x := auxIntToInt64(v_0.AuxInt) 4160 y := v_1 4161 if !(y.Op != OpWasmI64Const) { 4162 break 4163 } 4164 v.reset(OpWasmI64Mul) 4165 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4166 v0.AuxInt = int64ToAuxInt(x) 4167 v.AddArg2(y, v0) 4168 return true 4169 } 4170 return false 4171 } 4172 func rewriteValueWasm_OpWasmI64Ne(v *Value) bool { 4173 v_1 := v.Args[1] 4174 v_0 := v.Args[0] 4175 b := v.Block 4176 typ := &b.Func.Config.Types 4177 // match: (I64Ne (I64Const [x]) (I64Const [y])) 4178 // cond: x == y 4179 // result: (I64Const [0]) 4180 for { 4181 if v_0.Op != OpWasmI64Const { 4182 break 4183 } 4184 x := auxIntToInt64(v_0.AuxInt) 4185 if v_1.Op != OpWasmI64Const { 4186 break 4187 } 4188 y := auxIntToInt64(v_1.AuxInt) 4189 if !(x == y) { 4190 break 4191 } 4192 v.reset(OpWasmI64Const) 4193 v.AuxInt = int64ToAuxInt(0) 4194 return true 4195 } 4196 // match: (I64Ne (I64Const [x]) (I64Const [y])) 4197 // cond: x != y 4198 // result: (I64Const [1]) 4199 for { 4200 if v_0.Op != OpWasmI64Const { 4201 break 4202 } 4203 x := auxIntToInt64(v_0.AuxInt) 4204 if v_1.Op != OpWasmI64Const { 4205 break 4206 } 4207 y := auxIntToInt64(v_1.AuxInt) 4208 if !(x != y) { 4209 break 4210 } 4211 v.reset(OpWasmI64Const) 4212 v.AuxInt = int64ToAuxInt(1) 4213 return true 4214 } 4215 // match: (I64Ne (I64Const [x]) y) 4216 // cond: y.Op != OpWasmI64Const 4217 // result: (I64Ne y (I64Const [x])) 4218 for { 4219 if v_0.Op != OpWasmI64Const { 4220 break 4221 } 4222 x := auxIntToInt64(v_0.AuxInt) 4223 y := v_1 4224 if !(y.Op != OpWasmI64Const) { 4225 break 4226 } 4227 v.reset(OpWasmI64Ne) 4228 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4229 v0.AuxInt = int64ToAuxInt(x) 4230 v.AddArg2(y, v0) 4231 return true 4232 } 4233 // match: (I64Ne x (I64Const [0])) 4234 // result: (I64Eqz (I64Eqz x)) 4235 for { 4236 x := v_0 4237 if v_1.Op != OpWasmI64Const || auxIntToInt64(v_1.AuxInt) != 0 { 4238 break 4239 } 4240 v.reset(OpWasmI64Eqz) 4241 v0 := b.NewValue0(v.Pos, OpWasmI64Eqz, typ.Bool) 4242 v0.AddArg(x) 4243 v.AddArg(v0) 4244 return true 4245 } 4246 return false 4247 } 4248 func rewriteValueWasm_OpWasmI64Or(v *Value) bool { 4249 v_1 := v.Args[1] 4250 v_0 := v.Args[0] 4251 b := v.Block 4252 typ := &b.Func.Config.Types 4253 // match: (I64Or (I64Const [x]) (I64Const [y])) 4254 // result: (I64Const [x | y]) 4255 for { 4256 if v_0.Op != OpWasmI64Const { 4257 break 4258 } 4259 x := auxIntToInt64(v_0.AuxInt) 4260 if v_1.Op != OpWasmI64Const { 4261 break 4262 } 4263 y := auxIntToInt64(v_1.AuxInt) 4264 v.reset(OpWasmI64Const) 4265 v.AuxInt = int64ToAuxInt(x | y) 4266 return true 4267 } 4268 // match: (I64Or (I64Const [x]) y) 4269 // cond: y.Op != OpWasmI64Const 4270 // result: (I64Or y (I64Const [x])) 4271 for { 4272 if v_0.Op != OpWasmI64Const { 4273 break 4274 } 4275 x := auxIntToInt64(v_0.AuxInt) 4276 y := v_1 4277 if !(y.Op != OpWasmI64Const) { 4278 break 4279 } 4280 v.reset(OpWasmI64Or) 4281 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4282 v0.AuxInt = int64ToAuxInt(x) 4283 v.AddArg2(y, v0) 4284 return true 4285 } 4286 return false 4287 } 4288 func rewriteValueWasm_OpWasmI64Shl(v *Value) bool { 4289 v_1 := v.Args[1] 4290 v_0 := v.Args[0] 4291 // match: (I64Shl (I64Const [x]) (I64Const [y])) 4292 // result: (I64Const [x << uint64(y)]) 4293 for { 4294 if v_0.Op != OpWasmI64Const { 4295 break 4296 } 4297 x := auxIntToInt64(v_0.AuxInt) 4298 if v_1.Op != OpWasmI64Const { 4299 break 4300 } 4301 y := auxIntToInt64(v_1.AuxInt) 4302 v.reset(OpWasmI64Const) 4303 v.AuxInt = int64ToAuxInt(x << uint64(y)) 4304 return true 4305 } 4306 return false 4307 } 4308 func rewriteValueWasm_OpWasmI64ShrS(v *Value) bool { 4309 v_1 := v.Args[1] 4310 v_0 := v.Args[0] 4311 // match: (I64ShrS (I64Const [x]) (I64Const [y])) 4312 // result: (I64Const [x >> uint64(y)]) 4313 for { 4314 if v_0.Op != OpWasmI64Const { 4315 break 4316 } 4317 x := auxIntToInt64(v_0.AuxInt) 4318 if v_1.Op != OpWasmI64Const { 4319 break 4320 } 4321 y := auxIntToInt64(v_1.AuxInt) 4322 v.reset(OpWasmI64Const) 4323 v.AuxInt = int64ToAuxInt(x >> uint64(y)) 4324 return true 4325 } 4326 return false 4327 } 4328 func rewriteValueWasm_OpWasmI64ShrU(v *Value) bool { 4329 v_1 := v.Args[1] 4330 v_0 := v.Args[0] 4331 // match: (I64ShrU (I64Const [x]) (I64Const [y])) 4332 // result: (I64Const [int64(uint64(x) >> uint64(y))]) 4333 for { 4334 if v_0.Op != OpWasmI64Const { 4335 break 4336 } 4337 x := auxIntToInt64(v_0.AuxInt) 4338 if v_1.Op != OpWasmI64Const { 4339 break 4340 } 4341 y := auxIntToInt64(v_1.AuxInt) 4342 v.reset(OpWasmI64Const) 4343 v.AuxInt = int64ToAuxInt(int64(uint64(x) >> uint64(y))) 4344 return true 4345 } 4346 return false 4347 } 4348 func rewriteValueWasm_OpWasmI64Store(v *Value) bool { 4349 v_2 := v.Args[2] 4350 v_1 := v.Args[1] 4351 v_0 := v.Args[0] 4352 // match: (I64Store [off] (I64AddConst [off2] ptr) val mem) 4353 // cond: isU32Bit(off+off2) 4354 // result: (I64Store [off+off2] ptr val mem) 4355 for { 4356 off := auxIntToInt64(v.AuxInt) 4357 if v_0.Op != OpWasmI64AddConst { 4358 break 4359 } 4360 off2 := auxIntToInt64(v_0.AuxInt) 4361 ptr := v_0.Args[0] 4362 val := v_1 4363 mem := v_2 4364 if !(isU32Bit(off + off2)) { 4365 break 4366 } 4367 v.reset(OpWasmI64Store) 4368 v.AuxInt = int64ToAuxInt(off + off2) 4369 v.AddArg3(ptr, val, mem) 4370 return true 4371 } 4372 return false 4373 } 4374 func rewriteValueWasm_OpWasmI64Store16(v *Value) bool { 4375 v_2 := v.Args[2] 4376 v_1 := v.Args[1] 4377 v_0 := v.Args[0] 4378 // match: (I64Store16 [off] (I64AddConst [off2] ptr) val mem) 4379 // cond: isU32Bit(off+off2) 4380 // result: (I64Store16 [off+off2] ptr val mem) 4381 for { 4382 off := auxIntToInt64(v.AuxInt) 4383 if v_0.Op != OpWasmI64AddConst { 4384 break 4385 } 4386 off2 := auxIntToInt64(v_0.AuxInt) 4387 ptr := v_0.Args[0] 4388 val := v_1 4389 mem := v_2 4390 if !(isU32Bit(off + off2)) { 4391 break 4392 } 4393 v.reset(OpWasmI64Store16) 4394 v.AuxInt = int64ToAuxInt(off + off2) 4395 v.AddArg3(ptr, val, mem) 4396 return true 4397 } 4398 return false 4399 } 4400 func rewriteValueWasm_OpWasmI64Store32(v *Value) bool { 4401 v_2 := v.Args[2] 4402 v_1 := v.Args[1] 4403 v_0 := v.Args[0] 4404 // match: (I64Store32 [off] (I64AddConst [off2] ptr) val mem) 4405 // cond: isU32Bit(off+off2) 4406 // result: (I64Store32 [off+off2] ptr val mem) 4407 for { 4408 off := auxIntToInt64(v.AuxInt) 4409 if v_0.Op != OpWasmI64AddConst { 4410 break 4411 } 4412 off2 := auxIntToInt64(v_0.AuxInt) 4413 ptr := v_0.Args[0] 4414 val := v_1 4415 mem := v_2 4416 if !(isU32Bit(off + off2)) { 4417 break 4418 } 4419 v.reset(OpWasmI64Store32) 4420 v.AuxInt = int64ToAuxInt(off + off2) 4421 v.AddArg3(ptr, val, mem) 4422 return true 4423 } 4424 return false 4425 } 4426 func rewriteValueWasm_OpWasmI64Store8(v *Value) bool { 4427 v_2 := v.Args[2] 4428 v_1 := v.Args[1] 4429 v_0 := v.Args[0] 4430 // match: (I64Store8 [off] (I64AddConst [off2] ptr) val mem) 4431 // cond: isU32Bit(off+off2) 4432 // result: (I64Store8 [off+off2] ptr val mem) 4433 for { 4434 off := auxIntToInt64(v.AuxInt) 4435 if v_0.Op != OpWasmI64AddConst { 4436 break 4437 } 4438 off2 := auxIntToInt64(v_0.AuxInt) 4439 ptr := v_0.Args[0] 4440 val := v_1 4441 mem := v_2 4442 if !(isU32Bit(off + off2)) { 4443 break 4444 } 4445 v.reset(OpWasmI64Store8) 4446 v.AuxInt = int64ToAuxInt(off + off2) 4447 v.AddArg3(ptr, val, mem) 4448 return true 4449 } 4450 return false 4451 } 4452 func rewriteValueWasm_OpWasmI64Xor(v *Value) bool { 4453 v_1 := v.Args[1] 4454 v_0 := v.Args[0] 4455 b := v.Block 4456 typ := &b.Func.Config.Types 4457 // match: (I64Xor (I64Const [x]) (I64Const [y])) 4458 // result: (I64Const [x ^ y]) 4459 for { 4460 if v_0.Op != OpWasmI64Const { 4461 break 4462 } 4463 x := auxIntToInt64(v_0.AuxInt) 4464 if v_1.Op != OpWasmI64Const { 4465 break 4466 } 4467 y := auxIntToInt64(v_1.AuxInt) 4468 v.reset(OpWasmI64Const) 4469 v.AuxInt = int64ToAuxInt(x ^ y) 4470 return true 4471 } 4472 // match: (I64Xor (I64Const [x]) y) 4473 // cond: y.Op != OpWasmI64Const 4474 // result: (I64Xor y (I64Const [x])) 4475 for { 4476 if v_0.Op != OpWasmI64Const { 4477 break 4478 } 4479 x := auxIntToInt64(v_0.AuxInt) 4480 y := v_1 4481 if !(y.Op != OpWasmI64Const) { 4482 break 4483 } 4484 v.reset(OpWasmI64Xor) 4485 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4486 v0.AuxInt = int64ToAuxInt(x) 4487 v.AddArg2(y, v0) 4488 return true 4489 } 4490 return false 4491 } 4492 func rewriteValueWasm_OpZero(v *Value) bool { 4493 v_1 := v.Args[1] 4494 v_0 := v.Args[0] 4495 b := v.Block 4496 typ := &b.Func.Config.Types 4497 // match: (Zero [0] _ mem) 4498 // result: mem 4499 for { 4500 if auxIntToInt64(v.AuxInt) != 0 { 4501 break 4502 } 4503 mem := v_1 4504 v.copyOf(mem) 4505 return true 4506 } 4507 // match: (Zero [1] destptr mem) 4508 // result: (I64Store8 destptr (I64Const [0]) mem) 4509 for { 4510 if auxIntToInt64(v.AuxInt) != 1 { 4511 break 4512 } 4513 destptr := v_0 4514 mem := v_1 4515 v.reset(OpWasmI64Store8) 4516 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4517 v0.AuxInt = int64ToAuxInt(0) 4518 v.AddArg3(destptr, v0, mem) 4519 return true 4520 } 4521 // match: (Zero [2] destptr mem) 4522 // result: (I64Store16 destptr (I64Const [0]) mem) 4523 for { 4524 if auxIntToInt64(v.AuxInt) != 2 { 4525 break 4526 } 4527 destptr := v_0 4528 mem := v_1 4529 v.reset(OpWasmI64Store16) 4530 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4531 v0.AuxInt = int64ToAuxInt(0) 4532 v.AddArg3(destptr, v0, mem) 4533 return true 4534 } 4535 // match: (Zero [4] destptr mem) 4536 // result: (I64Store32 destptr (I64Const [0]) mem) 4537 for { 4538 if auxIntToInt64(v.AuxInt) != 4 { 4539 break 4540 } 4541 destptr := v_0 4542 mem := v_1 4543 v.reset(OpWasmI64Store32) 4544 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4545 v0.AuxInt = int64ToAuxInt(0) 4546 v.AddArg3(destptr, v0, mem) 4547 return true 4548 } 4549 // match: (Zero [8] destptr mem) 4550 // result: (I64Store destptr (I64Const [0]) mem) 4551 for { 4552 if auxIntToInt64(v.AuxInt) != 8 { 4553 break 4554 } 4555 destptr := v_0 4556 mem := v_1 4557 v.reset(OpWasmI64Store) 4558 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4559 v0.AuxInt = int64ToAuxInt(0) 4560 v.AddArg3(destptr, v0, mem) 4561 return true 4562 } 4563 // match: (Zero [3] destptr mem) 4564 // result: (I64Store8 [2] destptr (I64Const [0]) (I64Store16 destptr (I64Const [0]) mem)) 4565 for { 4566 if auxIntToInt64(v.AuxInt) != 3 { 4567 break 4568 } 4569 destptr := v_0 4570 mem := v_1 4571 v.reset(OpWasmI64Store8) 4572 v.AuxInt = int64ToAuxInt(2) 4573 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4574 v0.AuxInt = int64ToAuxInt(0) 4575 v1 := b.NewValue0(v.Pos, OpWasmI64Store16, types.TypeMem) 4576 v1.AddArg3(destptr, v0, mem) 4577 v.AddArg3(destptr, v0, v1) 4578 return true 4579 } 4580 // match: (Zero [5] destptr mem) 4581 // result: (I64Store8 [4] destptr (I64Const [0]) (I64Store32 destptr (I64Const [0]) mem)) 4582 for { 4583 if auxIntToInt64(v.AuxInt) != 5 { 4584 break 4585 } 4586 destptr := v_0 4587 mem := v_1 4588 v.reset(OpWasmI64Store8) 4589 v.AuxInt = int64ToAuxInt(4) 4590 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4591 v0.AuxInt = int64ToAuxInt(0) 4592 v1 := b.NewValue0(v.Pos, OpWasmI64Store32, types.TypeMem) 4593 v1.AddArg3(destptr, v0, mem) 4594 v.AddArg3(destptr, v0, v1) 4595 return true 4596 } 4597 // match: (Zero [6] destptr mem) 4598 // result: (I64Store16 [4] destptr (I64Const [0]) (I64Store32 destptr (I64Const [0]) mem)) 4599 for { 4600 if auxIntToInt64(v.AuxInt) != 6 { 4601 break 4602 } 4603 destptr := v_0 4604 mem := v_1 4605 v.reset(OpWasmI64Store16) 4606 v.AuxInt = int64ToAuxInt(4) 4607 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4608 v0.AuxInt = int64ToAuxInt(0) 4609 v1 := b.NewValue0(v.Pos, OpWasmI64Store32, types.TypeMem) 4610 v1.AddArg3(destptr, v0, mem) 4611 v.AddArg3(destptr, v0, v1) 4612 return true 4613 } 4614 // match: (Zero [7] destptr mem) 4615 // result: (I64Store32 [3] destptr (I64Const [0]) (I64Store32 destptr (I64Const [0]) mem)) 4616 for { 4617 if auxIntToInt64(v.AuxInt) != 7 { 4618 break 4619 } 4620 destptr := v_0 4621 mem := v_1 4622 v.reset(OpWasmI64Store32) 4623 v.AuxInt = int64ToAuxInt(3) 4624 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4625 v0.AuxInt = int64ToAuxInt(0) 4626 v1 := b.NewValue0(v.Pos, OpWasmI64Store32, types.TypeMem) 4627 v1.AddArg3(destptr, v0, mem) 4628 v.AddArg3(destptr, v0, v1) 4629 return true 4630 } 4631 // match: (Zero [s] destptr mem) 4632 // cond: s%8 != 0 && s > 8 && s < 32 4633 // result: (Zero [s-s%8] (OffPtr <destptr.Type> destptr [s%8]) (I64Store destptr (I64Const [0]) mem)) 4634 for { 4635 s := auxIntToInt64(v.AuxInt) 4636 destptr := v_0 4637 mem := v_1 4638 if !(s%8 != 0 && s > 8 && s < 32) { 4639 break 4640 } 4641 v.reset(OpZero) 4642 v.AuxInt = int64ToAuxInt(s - s%8) 4643 v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) 4644 v0.AuxInt = int64ToAuxInt(s % 8) 4645 v0.AddArg(destptr) 4646 v1 := b.NewValue0(v.Pos, OpWasmI64Store, types.TypeMem) 4647 v2 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4648 v2.AuxInt = int64ToAuxInt(0) 4649 v1.AddArg3(destptr, v2, mem) 4650 v.AddArg2(v0, v1) 4651 return true 4652 } 4653 // match: (Zero [16] destptr mem) 4654 // result: (I64Store [8] destptr (I64Const [0]) (I64Store destptr (I64Const [0]) mem)) 4655 for { 4656 if auxIntToInt64(v.AuxInt) != 16 { 4657 break 4658 } 4659 destptr := v_0 4660 mem := v_1 4661 v.reset(OpWasmI64Store) 4662 v.AuxInt = int64ToAuxInt(8) 4663 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4664 v0.AuxInt = int64ToAuxInt(0) 4665 v1 := b.NewValue0(v.Pos, OpWasmI64Store, types.TypeMem) 4666 v1.AddArg3(destptr, v0, mem) 4667 v.AddArg3(destptr, v0, v1) 4668 return true 4669 } 4670 // match: (Zero [24] destptr mem) 4671 // result: (I64Store [16] destptr (I64Const [0]) (I64Store [8] destptr (I64Const [0]) (I64Store destptr (I64Const [0]) mem))) 4672 for { 4673 if auxIntToInt64(v.AuxInt) != 24 { 4674 break 4675 } 4676 destptr := v_0 4677 mem := v_1 4678 v.reset(OpWasmI64Store) 4679 v.AuxInt = int64ToAuxInt(16) 4680 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4681 v0.AuxInt = int64ToAuxInt(0) 4682 v1 := b.NewValue0(v.Pos, OpWasmI64Store, types.TypeMem) 4683 v1.AuxInt = int64ToAuxInt(8) 4684 v2 := b.NewValue0(v.Pos, OpWasmI64Store, types.TypeMem) 4685 v2.AddArg3(destptr, v0, mem) 4686 v1.AddArg3(destptr, v0, v2) 4687 v.AddArg3(destptr, v0, v1) 4688 return true 4689 } 4690 // match: (Zero [32] destptr mem) 4691 // result: (I64Store [24] destptr (I64Const [0]) (I64Store [16] destptr (I64Const [0]) (I64Store [8] destptr (I64Const [0]) (I64Store destptr (I64Const [0]) mem)))) 4692 for { 4693 if auxIntToInt64(v.AuxInt) != 32 { 4694 break 4695 } 4696 destptr := v_0 4697 mem := v_1 4698 v.reset(OpWasmI64Store) 4699 v.AuxInt = int64ToAuxInt(24) 4700 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4701 v0.AuxInt = int64ToAuxInt(0) 4702 v1 := b.NewValue0(v.Pos, OpWasmI64Store, types.TypeMem) 4703 v1.AuxInt = int64ToAuxInt(16) 4704 v2 := b.NewValue0(v.Pos, OpWasmI64Store, types.TypeMem) 4705 v2.AuxInt = int64ToAuxInt(8) 4706 v3 := b.NewValue0(v.Pos, OpWasmI64Store, types.TypeMem) 4707 v3.AddArg3(destptr, v0, mem) 4708 v2.AddArg3(destptr, v0, v3) 4709 v1.AddArg3(destptr, v0, v2) 4710 v.AddArg3(destptr, v0, v1) 4711 return true 4712 } 4713 // match: (Zero [s] destptr mem) 4714 // result: (LoweredZero [s] destptr mem) 4715 for { 4716 s := auxIntToInt64(v.AuxInt) 4717 destptr := v_0 4718 mem := v_1 4719 v.reset(OpWasmLoweredZero) 4720 v.AuxInt = int64ToAuxInt(s) 4721 v.AddArg2(destptr, mem) 4722 return true 4723 } 4724 } 4725 func rewriteValueWasm_OpZeroExt16to32(v *Value) bool { 4726 v_0 := v.Args[0] 4727 b := v.Block 4728 typ := &b.Func.Config.Types 4729 // match: (ZeroExt16to32 x:(I64Load16U _ _)) 4730 // result: x 4731 for { 4732 x := v_0 4733 if x.Op != OpWasmI64Load16U { 4734 break 4735 } 4736 v.copyOf(x) 4737 return true 4738 } 4739 // match: (ZeroExt16to32 x) 4740 // result: (I64And x (I64Const [0xffff])) 4741 for { 4742 x := v_0 4743 v.reset(OpWasmI64And) 4744 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4745 v0.AuxInt = int64ToAuxInt(0xffff) 4746 v.AddArg2(x, v0) 4747 return true 4748 } 4749 } 4750 func rewriteValueWasm_OpZeroExt16to64(v *Value) bool { 4751 v_0 := v.Args[0] 4752 b := v.Block 4753 typ := &b.Func.Config.Types 4754 // match: (ZeroExt16to64 x:(I64Load16U _ _)) 4755 // result: x 4756 for { 4757 x := v_0 4758 if x.Op != OpWasmI64Load16U { 4759 break 4760 } 4761 v.copyOf(x) 4762 return true 4763 } 4764 // match: (ZeroExt16to64 x) 4765 // result: (I64And x (I64Const [0xffff])) 4766 for { 4767 x := v_0 4768 v.reset(OpWasmI64And) 4769 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4770 v0.AuxInt = int64ToAuxInt(0xffff) 4771 v.AddArg2(x, v0) 4772 return true 4773 } 4774 } 4775 func rewriteValueWasm_OpZeroExt32to64(v *Value) bool { 4776 v_0 := v.Args[0] 4777 b := v.Block 4778 typ := &b.Func.Config.Types 4779 // match: (ZeroExt32to64 x:(I64Load32U _ _)) 4780 // result: x 4781 for { 4782 x := v_0 4783 if x.Op != OpWasmI64Load32U { 4784 break 4785 } 4786 v.copyOf(x) 4787 return true 4788 } 4789 // match: (ZeroExt32to64 x) 4790 // result: (I64And x (I64Const [0xffffffff])) 4791 for { 4792 x := v_0 4793 v.reset(OpWasmI64And) 4794 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4795 v0.AuxInt = int64ToAuxInt(0xffffffff) 4796 v.AddArg2(x, v0) 4797 return true 4798 } 4799 } 4800 func rewriteValueWasm_OpZeroExt8to16(v *Value) bool { 4801 v_0 := v.Args[0] 4802 b := v.Block 4803 typ := &b.Func.Config.Types 4804 // match: (ZeroExt8to16 x:(I64Load8U _ _)) 4805 // result: x 4806 for { 4807 x := v_0 4808 if x.Op != OpWasmI64Load8U { 4809 break 4810 } 4811 v.copyOf(x) 4812 return true 4813 } 4814 // match: (ZeroExt8to16 x) 4815 // result: (I64And x (I64Const [0xff])) 4816 for { 4817 x := v_0 4818 v.reset(OpWasmI64And) 4819 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4820 v0.AuxInt = int64ToAuxInt(0xff) 4821 v.AddArg2(x, v0) 4822 return true 4823 } 4824 } 4825 func rewriteValueWasm_OpZeroExt8to32(v *Value) bool { 4826 v_0 := v.Args[0] 4827 b := v.Block 4828 typ := &b.Func.Config.Types 4829 // match: (ZeroExt8to32 x:(I64Load8U _ _)) 4830 // result: x 4831 for { 4832 x := v_0 4833 if x.Op != OpWasmI64Load8U { 4834 break 4835 } 4836 v.copyOf(x) 4837 return true 4838 } 4839 // match: (ZeroExt8to32 x) 4840 // result: (I64And x (I64Const [0xff])) 4841 for { 4842 x := v_0 4843 v.reset(OpWasmI64And) 4844 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4845 v0.AuxInt = int64ToAuxInt(0xff) 4846 v.AddArg2(x, v0) 4847 return true 4848 } 4849 } 4850 func rewriteValueWasm_OpZeroExt8to64(v *Value) bool { 4851 v_0 := v.Args[0] 4852 b := v.Block 4853 typ := &b.Func.Config.Types 4854 // match: (ZeroExt8to64 x:(I64Load8U _ _)) 4855 // result: x 4856 for { 4857 x := v_0 4858 if x.Op != OpWasmI64Load8U { 4859 break 4860 } 4861 v.copyOf(x) 4862 return true 4863 } 4864 // match: (ZeroExt8to64 x) 4865 // result: (I64And x (I64Const [0xff])) 4866 for { 4867 x := v_0 4868 v.reset(OpWasmI64And) 4869 v0 := b.NewValue0(v.Pos, OpWasmI64Const, typ.Int64) 4870 v0.AuxInt = int64ToAuxInt(0xff) 4871 v.AddArg2(x, v0) 4872 return true 4873 } 4874 } 4875 func rewriteBlockWasm(b *Block) bool { 4876 return false 4877 }