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