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