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