github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/compile/internal/ssa/rewriteRISCV64.go (about) 1 // Code generated from gen/RISCV64.rules; DO NOT EDIT. 2 // generated with: cd gen; go run *.go 3 4 package ssa 5 6 import "math" 7 import "github.com/gagliardetto/golang-go/cmd/compile/internal/types" 8 9 func rewriteValueRISCV64(v *Value) bool { 10 switch v.Op { 11 case OpAdd16: 12 return rewriteValueRISCV64_OpAdd16_0(v) 13 case OpAdd32: 14 return rewriteValueRISCV64_OpAdd32_0(v) 15 case OpAdd32F: 16 return rewriteValueRISCV64_OpAdd32F_0(v) 17 case OpAdd64: 18 return rewriteValueRISCV64_OpAdd64_0(v) 19 case OpAdd64F: 20 return rewriteValueRISCV64_OpAdd64F_0(v) 21 case OpAdd8: 22 return rewriteValueRISCV64_OpAdd8_0(v) 23 case OpAddPtr: 24 return rewriteValueRISCV64_OpAddPtr_0(v) 25 case OpAddr: 26 return rewriteValueRISCV64_OpAddr_0(v) 27 case OpAnd16: 28 return rewriteValueRISCV64_OpAnd16_0(v) 29 case OpAnd32: 30 return rewriteValueRISCV64_OpAnd32_0(v) 31 case OpAnd64: 32 return rewriteValueRISCV64_OpAnd64_0(v) 33 case OpAnd8: 34 return rewriteValueRISCV64_OpAnd8_0(v) 35 case OpAndB: 36 return rewriteValueRISCV64_OpAndB_0(v) 37 case OpAvg64u: 38 return rewriteValueRISCV64_OpAvg64u_0(v) 39 case OpClosureCall: 40 return rewriteValueRISCV64_OpClosureCall_0(v) 41 case OpCom16: 42 return rewriteValueRISCV64_OpCom16_0(v) 43 case OpCom32: 44 return rewriteValueRISCV64_OpCom32_0(v) 45 case OpCom64: 46 return rewriteValueRISCV64_OpCom64_0(v) 47 case OpCom8: 48 return rewriteValueRISCV64_OpCom8_0(v) 49 case OpConst16: 50 return rewriteValueRISCV64_OpConst16_0(v) 51 case OpConst32: 52 return rewriteValueRISCV64_OpConst32_0(v) 53 case OpConst32F: 54 return rewriteValueRISCV64_OpConst32F_0(v) 55 case OpConst64: 56 return rewriteValueRISCV64_OpConst64_0(v) 57 case OpConst64F: 58 return rewriteValueRISCV64_OpConst64F_0(v) 59 case OpConst8: 60 return rewriteValueRISCV64_OpConst8_0(v) 61 case OpConstBool: 62 return rewriteValueRISCV64_OpConstBool_0(v) 63 case OpConstNil: 64 return rewriteValueRISCV64_OpConstNil_0(v) 65 case OpConvert: 66 return rewriteValueRISCV64_OpConvert_0(v) 67 case OpCvt32Fto32: 68 return rewriteValueRISCV64_OpCvt32Fto32_0(v) 69 case OpCvt32Fto64: 70 return rewriteValueRISCV64_OpCvt32Fto64_0(v) 71 case OpCvt32Fto64F: 72 return rewriteValueRISCV64_OpCvt32Fto64F_0(v) 73 case OpCvt32to32F: 74 return rewriteValueRISCV64_OpCvt32to32F_0(v) 75 case OpCvt32to64F: 76 return rewriteValueRISCV64_OpCvt32to64F_0(v) 77 case OpCvt64Fto32: 78 return rewriteValueRISCV64_OpCvt64Fto32_0(v) 79 case OpCvt64Fto32F: 80 return rewriteValueRISCV64_OpCvt64Fto32F_0(v) 81 case OpCvt64Fto64: 82 return rewriteValueRISCV64_OpCvt64Fto64_0(v) 83 case OpCvt64to32F: 84 return rewriteValueRISCV64_OpCvt64to32F_0(v) 85 case OpCvt64to64F: 86 return rewriteValueRISCV64_OpCvt64to64F_0(v) 87 case OpDiv16: 88 return rewriteValueRISCV64_OpDiv16_0(v) 89 case OpDiv16u: 90 return rewriteValueRISCV64_OpDiv16u_0(v) 91 case OpDiv32: 92 return rewriteValueRISCV64_OpDiv32_0(v) 93 case OpDiv32F: 94 return rewriteValueRISCV64_OpDiv32F_0(v) 95 case OpDiv32u: 96 return rewriteValueRISCV64_OpDiv32u_0(v) 97 case OpDiv64: 98 return rewriteValueRISCV64_OpDiv64_0(v) 99 case OpDiv64F: 100 return rewriteValueRISCV64_OpDiv64F_0(v) 101 case OpDiv64u: 102 return rewriteValueRISCV64_OpDiv64u_0(v) 103 case OpDiv8: 104 return rewriteValueRISCV64_OpDiv8_0(v) 105 case OpDiv8u: 106 return rewriteValueRISCV64_OpDiv8u_0(v) 107 case OpEq16: 108 return rewriteValueRISCV64_OpEq16_0(v) 109 case OpEq32: 110 return rewriteValueRISCV64_OpEq32_0(v) 111 case OpEq32F: 112 return rewriteValueRISCV64_OpEq32F_0(v) 113 case OpEq64: 114 return rewriteValueRISCV64_OpEq64_0(v) 115 case OpEq64F: 116 return rewriteValueRISCV64_OpEq64F_0(v) 117 case OpEq8: 118 return rewriteValueRISCV64_OpEq8_0(v) 119 case OpEqB: 120 return rewriteValueRISCV64_OpEqB_0(v) 121 case OpEqPtr: 122 return rewriteValueRISCV64_OpEqPtr_0(v) 123 case OpGeq16: 124 return rewriteValueRISCV64_OpGeq16_0(v) 125 case OpGeq16U: 126 return rewriteValueRISCV64_OpGeq16U_0(v) 127 case OpGeq32: 128 return rewriteValueRISCV64_OpGeq32_0(v) 129 case OpGeq32F: 130 return rewriteValueRISCV64_OpGeq32F_0(v) 131 case OpGeq32U: 132 return rewriteValueRISCV64_OpGeq32U_0(v) 133 case OpGeq64: 134 return rewriteValueRISCV64_OpGeq64_0(v) 135 case OpGeq64F: 136 return rewriteValueRISCV64_OpGeq64F_0(v) 137 case OpGeq64U: 138 return rewriteValueRISCV64_OpGeq64U_0(v) 139 case OpGeq8: 140 return rewriteValueRISCV64_OpGeq8_0(v) 141 case OpGeq8U: 142 return rewriteValueRISCV64_OpGeq8U_0(v) 143 case OpGetCallerPC: 144 return rewriteValueRISCV64_OpGetCallerPC_0(v) 145 case OpGetCallerSP: 146 return rewriteValueRISCV64_OpGetCallerSP_0(v) 147 case OpGetClosurePtr: 148 return rewriteValueRISCV64_OpGetClosurePtr_0(v) 149 case OpGreater16: 150 return rewriteValueRISCV64_OpGreater16_0(v) 151 case OpGreater16U: 152 return rewriteValueRISCV64_OpGreater16U_0(v) 153 case OpGreater32: 154 return rewriteValueRISCV64_OpGreater32_0(v) 155 case OpGreater32F: 156 return rewriteValueRISCV64_OpGreater32F_0(v) 157 case OpGreater32U: 158 return rewriteValueRISCV64_OpGreater32U_0(v) 159 case OpGreater64: 160 return rewriteValueRISCV64_OpGreater64_0(v) 161 case OpGreater64F: 162 return rewriteValueRISCV64_OpGreater64F_0(v) 163 case OpGreater64U: 164 return rewriteValueRISCV64_OpGreater64U_0(v) 165 case OpGreater8: 166 return rewriteValueRISCV64_OpGreater8_0(v) 167 case OpGreater8U: 168 return rewriteValueRISCV64_OpGreater8U_0(v) 169 case OpHmul32: 170 return rewriteValueRISCV64_OpHmul32_0(v) 171 case OpHmul32u: 172 return rewriteValueRISCV64_OpHmul32u_0(v) 173 case OpHmul64: 174 return rewriteValueRISCV64_OpHmul64_0(v) 175 case OpHmul64u: 176 return rewriteValueRISCV64_OpHmul64u_0(v) 177 case OpInterCall: 178 return rewriteValueRISCV64_OpInterCall_0(v) 179 case OpIsInBounds: 180 return rewriteValueRISCV64_OpIsInBounds_0(v) 181 case OpIsNonNil: 182 return rewriteValueRISCV64_OpIsNonNil_0(v) 183 case OpIsSliceInBounds: 184 return rewriteValueRISCV64_OpIsSliceInBounds_0(v) 185 case OpLeq16: 186 return rewriteValueRISCV64_OpLeq16_0(v) 187 case OpLeq16U: 188 return rewriteValueRISCV64_OpLeq16U_0(v) 189 case OpLeq32: 190 return rewriteValueRISCV64_OpLeq32_0(v) 191 case OpLeq32F: 192 return rewriteValueRISCV64_OpLeq32F_0(v) 193 case OpLeq32U: 194 return rewriteValueRISCV64_OpLeq32U_0(v) 195 case OpLeq64: 196 return rewriteValueRISCV64_OpLeq64_0(v) 197 case OpLeq64F: 198 return rewriteValueRISCV64_OpLeq64F_0(v) 199 case OpLeq64U: 200 return rewriteValueRISCV64_OpLeq64U_0(v) 201 case OpLeq8: 202 return rewriteValueRISCV64_OpLeq8_0(v) 203 case OpLeq8U: 204 return rewriteValueRISCV64_OpLeq8U_0(v) 205 case OpLess16: 206 return rewriteValueRISCV64_OpLess16_0(v) 207 case OpLess16U: 208 return rewriteValueRISCV64_OpLess16U_0(v) 209 case OpLess32: 210 return rewriteValueRISCV64_OpLess32_0(v) 211 case OpLess32F: 212 return rewriteValueRISCV64_OpLess32F_0(v) 213 case OpLess32U: 214 return rewriteValueRISCV64_OpLess32U_0(v) 215 case OpLess64: 216 return rewriteValueRISCV64_OpLess64_0(v) 217 case OpLess64F: 218 return rewriteValueRISCV64_OpLess64F_0(v) 219 case OpLess64U: 220 return rewriteValueRISCV64_OpLess64U_0(v) 221 case OpLess8: 222 return rewriteValueRISCV64_OpLess8_0(v) 223 case OpLess8U: 224 return rewriteValueRISCV64_OpLess8U_0(v) 225 case OpLoad: 226 return rewriteValueRISCV64_OpLoad_0(v) 227 case OpLocalAddr: 228 return rewriteValueRISCV64_OpLocalAddr_0(v) 229 case OpLsh16x16: 230 return rewriteValueRISCV64_OpLsh16x16_0(v) 231 case OpLsh16x32: 232 return rewriteValueRISCV64_OpLsh16x32_0(v) 233 case OpLsh16x64: 234 return rewriteValueRISCV64_OpLsh16x64_0(v) 235 case OpLsh16x8: 236 return rewriteValueRISCV64_OpLsh16x8_0(v) 237 case OpLsh32x16: 238 return rewriteValueRISCV64_OpLsh32x16_0(v) 239 case OpLsh32x32: 240 return rewriteValueRISCV64_OpLsh32x32_0(v) 241 case OpLsh32x64: 242 return rewriteValueRISCV64_OpLsh32x64_0(v) 243 case OpLsh32x8: 244 return rewriteValueRISCV64_OpLsh32x8_0(v) 245 case OpLsh64x16: 246 return rewriteValueRISCV64_OpLsh64x16_0(v) 247 case OpLsh64x32: 248 return rewriteValueRISCV64_OpLsh64x32_0(v) 249 case OpLsh64x64: 250 return rewriteValueRISCV64_OpLsh64x64_0(v) 251 case OpLsh64x8: 252 return rewriteValueRISCV64_OpLsh64x8_0(v) 253 case OpLsh8x16: 254 return rewriteValueRISCV64_OpLsh8x16_0(v) 255 case OpLsh8x32: 256 return rewriteValueRISCV64_OpLsh8x32_0(v) 257 case OpLsh8x64: 258 return rewriteValueRISCV64_OpLsh8x64_0(v) 259 case OpLsh8x8: 260 return rewriteValueRISCV64_OpLsh8x8_0(v) 261 case OpMod16: 262 return rewriteValueRISCV64_OpMod16_0(v) 263 case OpMod16u: 264 return rewriteValueRISCV64_OpMod16u_0(v) 265 case OpMod32: 266 return rewriteValueRISCV64_OpMod32_0(v) 267 case OpMod32u: 268 return rewriteValueRISCV64_OpMod32u_0(v) 269 case OpMod64: 270 return rewriteValueRISCV64_OpMod64_0(v) 271 case OpMod64u: 272 return rewriteValueRISCV64_OpMod64u_0(v) 273 case OpMod8: 274 return rewriteValueRISCV64_OpMod8_0(v) 275 case OpMod8u: 276 return rewriteValueRISCV64_OpMod8u_0(v) 277 case OpMove: 278 return rewriteValueRISCV64_OpMove_0(v) 279 case OpMul16: 280 return rewriteValueRISCV64_OpMul16_0(v) 281 case OpMul32: 282 return rewriteValueRISCV64_OpMul32_0(v) 283 case OpMul32F: 284 return rewriteValueRISCV64_OpMul32F_0(v) 285 case OpMul64: 286 return rewriteValueRISCV64_OpMul64_0(v) 287 case OpMul64F: 288 return rewriteValueRISCV64_OpMul64F_0(v) 289 case OpMul8: 290 return rewriteValueRISCV64_OpMul8_0(v) 291 case OpNeg16: 292 return rewriteValueRISCV64_OpNeg16_0(v) 293 case OpNeg32: 294 return rewriteValueRISCV64_OpNeg32_0(v) 295 case OpNeg32F: 296 return rewriteValueRISCV64_OpNeg32F_0(v) 297 case OpNeg64: 298 return rewriteValueRISCV64_OpNeg64_0(v) 299 case OpNeg64F: 300 return rewriteValueRISCV64_OpNeg64F_0(v) 301 case OpNeg8: 302 return rewriteValueRISCV64_OpNeg8_0(v) 303 case OpNeq16: 304 return rewriteValueRISCV64_OpNeq16_0(v) 305 case OpNeq32: 306 return rewriteValueRISCV64_OpNeq32_0(v) 307 case OpNeq32F: 308 return rewriteValueRISCV64_OpNeq32F_0(v) 309 case OpNeq64: 310 return rewriteValueRISCV64_OpNeq64_0(v) 311 case OpNeq64F: 312 return rewriteValueRISCV64_OpNeq64F_0(v) 313 case OpNeq8: 314 return rewriteValueRISCV64_OpNeq8_0(v) 315 case OpNeqB: 316 return rewriteValueRISCV64_OpNeqB_0(v) 317 case OpNeqPtr: 318 return rewriteValueRISCV64_OpNeqPtr_0(v) 319 case OpNilCheck: 320 return rewriteValueRISCV64_OpNilCheck_0(v) 321 case OpNot: 322 return rewriteValueRISCV64_OpNot_0(v) 323 case OpOffPtr: 324 return rewriteValueRISCV64_OpOffPtr_0(v) 325 case OpOr16: 326 return rewriteValueRISCV64_OpOr16_0(v) 327 case OpOr32: 328 return rewriteValueRISCV64_OpOr32_0(v) 329 case OpOr64: 330 return rewriteValueRISCV64_OpOr64_0(v) 331 case OpOr8: 332 return rewriteValueRISCV64_OpOr8_0(v) 333 case OpOrB: 334 return rewriteValueRISCV64_OpOrB_0(v) 335 case OpPanicBounds: 336 return rewriteValueRISCV64_OpPanicBounds_0(v) 337 case OpRISCV64ADD: 338 return rewriteValueRISCV64_OpRISCV64ADD_0(v) 339 case OpRISCV64ADDI: 340 return rewriteValueRISCV64_OpRISCV64ADDI_0(v) 341 case OpRISCV64MOVBUload: 342 return rewriteValueRISCV64_OpRISCV64MOVBUload_0(v) 343 case OpRISCV64MOVBload: 344 return rewriteValueRISCV64_OpRISCV64MOVBload_0(v) 345 case OpRISCV64MOVBstore: 346 return rewriteValueRISCV64_OpRISCV64MOVBstore_0(v) 347 case OpRISCV64MOVDconst: 348 return rewriteValueRISCV64_OpRISCV64MOVDconst_0(v) 349 case OpRISCV64MOVDload: 350 return rewriteValueRISCV64_OpRISCV64MOVDload_0(v) 351 case OpRISCV64MOVDstore: 352 return rewriteValueRISCV64_OpRISCV64MOVDstore_0(v) 353 case OpRISCV64MOVHUload: 354 return rewriteValueRISCV64_OpRISCV64MOVHUload_0(v) 355 case OpRISCV64MOVHload: 356 return rewriteValueRISCV64_OpRISCV64MOVHload_0(v) 357 case OpRISCV64MOVHstore: 358 return rewriteValueRISCV64_OpRISCV64MOVHstore_0(v) 359 case OpRISCV64MOVWUload: 360 return rewriteValueRISCV64_OpRISCV64MOVWUload_0(v) 361 case OpRISCV64MOVWload: 362 return rewriteValueRISCV64_OpRISCV64MOVWload_0(v) 363 case OpRISCV64MOVWstore: 364 return rewriteValueRISCV64_OpRISCV64MOVWstore_0(v) 365 case OpRotateLeft16: 366 return rewriteValueRISCV64_OpRotateLeft16_0(v) 367 case OpRotateLeft32: 368 return rewriteValueRISCV64_OpRotateLeft32_0(v) 369 case OpRotateLeft64: 370 return rewriteValueRISCV64_OpRotateLeft64_0(v) 371 case OpRotateLeft8: 372 return rewriteValueRISCV64_OpRotateLeft8_0(v) 373 case OpRound32F: 374 return rewriteValueRISCV64_OpRound32F_0(v) 375 case OpRound64F: 376 return rewriteValueRISCV64_OpRound64F_0(v) 377 case OpRsh16Ux16: 378 return rewriteValueRISCV64_OpRsh16Ux16_0(v) 379 case OpRsh16Ux32: 380 return rewriteValueRISCV64_OpRsh16Ux32_0(v) 381 case OpRsh16Ux64: 382 return rewriteValueRISCV64_OpRsh16Ux64_0(v) 383 case OpRsh16Ux8: 384 return rewriteValueRISCV64_OpRsh16Ux8_0(v) 385 case OpRsh16x16: 386 return rewriteValueRISCV64_OpRsh16x16_0(v) 387 case OpRsh16x32: 388 return rewriteValueRISCV64_OpRsh16x32_0(v) 389 case OpRsh16x64: 390 return rewriteValueRISCV64_OpRsh16x64_0(v) 391 case OpRsh16x8: 392 return rewriteValueRISCV64_OpRsh16x8_0(v) 393 case OpRsh32Ux16: 394 return rewriteValueRISCV64_OpRsh32Ux16_0(v) 395 case OpRsh32Ux32: 396 return rewriteValueRISCV64_OpRsh32Ux32_0(v) 397 case OpRsh32Ux64: 398 return rewriteValueRISCV64_OpRsh32Ux64_0(v) 399 case OpRsh32Ux8: 400 return rewriteValueRISCV64_OpRsh32Ux8_0(v) 401 case OpRsh32x16: 402 return rewriteValueRISCV64_OpRsh32x16_0(v) 403 case OpRsh32x32: 404 return rewriteValueRISCV64_OpRsh32x32_0(v) 405 case OpRsh32x64: 406 return rewriteValueRISCV64_OpRsh32x64_0(v) 407 case OpRsh32x8: 408 return rewriteValueRISCV64_OpRsh32x8_0(v) 409 case OpRsh64Ux16: 410 return rewriteValueRISCV64_OpRsh64Ux16_0(v) 411 case OpRsh64Ux32: 412 return rewriteValueRISCV64_OpRsh64Ux32_0(v) 413 case OpRsh64Ux64: 414 return rewriteValueRISCV64_OpRsh64Ux64_0(v) 415 case OpRsh64Ux8: 416 return rewriteValueRISCV64_OpRsh64Ux8_0(v) 417 case OpRsh64x16: 418 return rewriteValueRISCV64_OpRsh64x16_0(v) 419 case OpRsh64x32: 420 return rewriteValueRISCV64_OpRsh64x32_0(v) 421 case OpRsh64x64: 422 return rewriteValueRISCV64_OpRsh64x64_0(v) 423 case OpRsh64x8: 424 return rewriteValueRISCV64_OpRsh64x8_0(v) 425 case OpRsh8Ux16: 426 return rewriteValueRISCV64_OpRsh8Ux16_0(v) 427 case OpRsh8Ux32: 428 return rewriteValueRISCV64_OpRsh8Ux32_0(v) 429 case OpRsh8Ux64: 430 return rewriteValueRISCV64_OpRsh8Ux64_0(v) 431 case OpRsh8Ux8: 432 return rewriteValueRISCV64_OpRsh8Ux8_0(v) 433 case OpRsh8x16: 434 return rewriteValueRISCV64_OpRsh8x16_0(v) 435 case OpRsh8x32: 436 return rewriteValueRISCV64_OpRsh8x32_0(v) 437 case OpRsh8x64: 438 return rewriteValueRISCV64_OpRsh8x64_0(v) 439 case OpRsh8x8: 440 return rewriteValueRISCV64_OpRsh8x8_0(v) 441 case OpSignExt16to32: 442 return rewriteValueRISCV64_OpSignExt16to32_0(v) 443 case OpSignExt16to64: 444 return rewriteValueRISCV64_OpSignExt16to64_0(v) 445 case OpSignExt32to64: 446 return rewriteValueRISCV64_OpSignExt32to64_0(v) 447 case OpSignExt8to16: 448 return rewriteValueRISCV64_OpSignExt8to16_0(v) 449 case OpSignExt8to32: 450 return rewriteValueRISCV64_OpSignExt8to32_0(v) 451 case OpSignExt8to64: 452 return rewriteValueRISCV64_OpSignExt8to64_0(v) 453 case OpSlicemask: 454 return rewriteValueRISCV64_OpSlicemask_0(v) 455 case OpSqrt: 456 return rewriteValueRISCV64_OpSqrt_0(v) 457 case OpStaticCall: 458 return rewriteValueRISCV64_OpStaticCall_0(v) 459 case OpStore: 460 return rewriteValueRISCV64_OpStore_0(v) 461 case OpSub16: 462 return rewriteValueRISCV64_OpSub16_0(v) 463 case OpSub32: 464 return rewriteValueRISCV64_OpSub32_0(v) 465 case OpSub32F: 466 return rewriteValueRISCV64_OpSub32F_0(v) 467 case OpSub64: 468 return rewriteValueRISCV64_OpSub64_0(v) 469 case OpSub64F: 470 return rewriteValueRISCV64_OpSub64F_0(v) 471 case OpSub8: 472 return rewriteValueRISCV64_OpSub8_0(v) 473 case OpSubPtr: 474 return rewriteValueRISCV64_OpSubPtr_0(v) 475 case OpTrunc16to8: 476 return rewriteValueRISCV64_OpTrunc16to8_0(v) 477 case OpTrunc32to16: 478 return rewriteValueRISCV64_OpTrunc32to16_0(v) 479 case OpTrunc32to8: 480 return rewriteValueRISCV64_OpTrunc32to8_0(v) 481 case OpTrunc64to16: 482 return rewriteValueRISCV64_OpTrunc64to16_0(v) 483 case OpTrunc64to32: 484 return rewriteValueRISCV64_OpTrunc64to32_0(v) 485 case OpTrunc64to8: 486 return rewriteValueRISCV64_OpTrunc64to8_0(v) 487 case OpWB: 488 return rewriteValueRISCV64_OpWB_0(v) 489 case OpXor16: 490 return rewriteValueRISCV64_OpXor16_0(v) 491 case OpXor32: 492 return rewriteValueRISCV64_OpXor32_0(v) 493 case OpXor64: 494 return rewriteValueRISCV64_OpXor64_0(v) 495 case OpXor8: 496 return rewriteValueRISCV64_OpXor8_0(v) 497 case OpZero: 498 return rewriteValueRISCV64_OpZero_0(v) 499 case OpZeroExt16to32: 500 return rewriteValueRISCV64_OpZeroExt16to32_0(v) 501 case OpZeroExt16to64: 502 return rewriteValueRISCV64_OpZeroExt16to64_0(v) 503 case OpZeroExt32to64: 504 return rewriteValueRISCV64_OpZeroExt32to64_0(v) 505 case OpZeroExt8to16: 506 return rewriteValueRISCV64_OpZeroExt8to16_0(v) 507 case OpZeroExt8to32: 508 return rewriteValueRISCV64_OpZeroExt8to32_0(v) 509 case OpZeroExt8to64: 510 return rewriteValueRISCV64_OpZeroExt8to64_0(v) 511 } 512 return false 513 } 514 func rewriteValueRISCV64_OpAdd16_0(v *Value) bool { 515 // match: (Add16 x y) 516 // result: (ADD x y) 517 for { 518 y := v.Args[1] 519 x := v.Args[0] 520 v.reset(OpRISCV64ADD) 521 v.AddArg(x) 522 v.AddArg(y) 523 return true 524 } 525 } 526 func rewriteValueRISCV64_OpAdd32_0(v *Value) bool { 527 // match: (Add32 x y) 528 // result: (ADD x y) 529 for { 530 y := v.Args[1] 531 x := v.Args[0] 532 v.reset(OpRISCV64ADD) 533 v.AddArg(x) 534 v.AddArg(y) 535 return true 536 } 537 } 538 func rewriteValueRISCV64_OpAdd32F_0(v *Value) bool { 539 // match: (Add32F x y) 540 // result: (FADDS x y) 541 for { 542 y := v.Args[1] 543 x := v.Args[0] 544 v.reset(OpRISCV64FADDS) 545 v.AddArg(x) 546 v.AddArg(y) 547 return true 548 } 549 } 550 func rewriteValueRISCV64_OpAdd64_0(v *Value) bool { 551 // match: (Add64 x y) 552 // result: (ADD x y) 553 for { 554 y := v.Args[1] 555 x := v.Args[0] 556 v.reset(OpRISCV64ADD) 557 v.AddArg(x) 558 v.AddArg(y) 559 return true 560 } 561 } 562 func rewriteValueRISCV64_OpAdd64F_0(v *Value) bool { 563 // match: (Add64F x y) 564 // result: (FADDD x y) 565 for { 566 y := v.Args[1] 567 x := v.Args[0] 568 v.reset(OpRISCV64FADDD) 569 v.AddArg(x) 570 v.AddArg(y) 571 return true 572 } 573 } 574 func rewriteValueRISCV64_OpAdd8_0(v *Value) bool { 575 // match: (Add8 x y) 576 // result: (ADD x y) 577 for { 578 y := v.Args[1] 579 x := v.Args[0] 580 v.reset(OpRISCV64ADD) 581 v.AddArg(x) 582 v.AddArg(y) 583 return true 584 } 585 } 586 func rewriteValueRISCV64_OpAddPtr_0(v *Value) bool { 587 // match: (AddPtr x y) 588 // result: (ADD x y) 589 for { 590 y := v.Args[1] 591 x := v.Args[0] 592 v.reset(OpRISCV64ADD) 593 v.AddArg(x) 594 v.AddArg(y) 595 return true 596 } 597 } 598 func rewriteValueRISCV64_OpAddr_0(v *Value) bool { 599 // match: (Addr {sym} base) 600 // result: (MOVaddr {sym} base) 601 for { 602 sym := v.Aux 603 base := v.Args[0] 604 v.reset(OpRISCV64MOVaddr) 605 v.Aux = sym 606 v.AddArg(base) 607 return true 608 } 609 } 610 func rewriteValueRISCV64_OpAnd16_0(v *Value) bool { 611 // match: (And16 x y) 612 // result: (AND x y) 613 for { 614 y := v.Args[1] 615 x := v.Args[0] 616 v.reset(OpRISCV64AND) 617 v.AddArg(x) 618 v.AddArg(y) 619 return true 620 } 621 } 622 func rewriteValueRISCV64_OpAnd32_0(v *Value) bool { 623 // match: (And32 x y) 624 // result: (AND x y) 625 for { 626 y := v.Args[1] 627 x := v.Args[0] 628 v.reset(OpRISCV64AND) 629 v.AddArg(x) 630 v.AddArg(y) 631 return true 632 } 633 } 634 func rewriteValueRISCV64_OpAnd64_0(v *Value) bool { 635 // match: (And64 x y) 636 // result: (AND x y) 637 for { 638 y := v.Args[1] 639 x := v.Args[0] 640 v.reset(OpRISCV64AND) 641 v.AddArg(x) 642 v.AddArg(y) 643 return true 644 } 645 } 646 func rewriteValueRISCV64_OpAnd8_0(v *Value) bool { 647 // match: (And8 x y) 648 // result: (AND x y) 649 for { 650 y := v.Args[1] 651 x := v.Args[0] 652 v.reset(OpRISCV64AND) 653 v.AddArg(x) 654 v.AddArg(y) 655 return true 656 } 657 } 658 func rewriteValueRISCV64_OpAndB_0(v *Value) bool { 659 // match: (AndB x y) 660 // result: (AND x y) 661 for { 662 y := v.Args[1] 663 x := v.Args[0] 664 v.reset(OpRISCV64AND) 665 v.AddArg(x) 666 v.AddArg(y) 667 return true 668 } 669 } 670 func rewriteValueRISCV64_OpAvg64u_0(v *Value) bool { 671 b := v.Block 672 // match: (Avg64u <t> x y) 673 // result: (ADD (ADD <t> (SRLI <t> [1] x) (SRLI <t> [1] y)) (ANDI <t> [1] (AND <t> x y))) 674 for { 675 t := v.Type 676 y := v.Args[1] 677 x := v.Args[0] 678 v.reset(OpRISCV64ADD) 679 v0 := b.NewValue0(v.Pos, OpRISCV64ADD, t) 680 v1 := b.NewValue0(v.Pos, OpRISCV64SRLI, t) 681 v1.AuxInt = 1 682 v1.AddArg(x) 683 v0.AddArg(v1) 684 v2 := b.NewValue0(v.Pos, OpRISCV64SRLI, t) 685 v2.AuxInt = 1 686 v2.AddArg(y) 687 v0.AddArg(v2) 688 v.AddArg(v0) 689 v3 := b.NewValue0(v.Pos, OpRISCV64ANDI, t) 690 v3.AuxInt = 1 691 v4 := b.NewValue0(v.Pos, OpRISCV64AND, t) 692 v4.AddArg(x) 693 v4.AddArg(y) 694 v3.AddArg(v4) 695 v.AddArg(v3) 696 return true 697 } 698 } 699 func rewriteValueRISCV64_OpClosureCall_0(v *Value) bool { 700 // match: (ClosureCall [argwid] entry closure mem) 701 // result: (CALLclosure [argwid] entry closure mem) 702 for { 703 argwid := v.AuxInt 704 mem := v.Args[2] 705 entry := v.Args[0] 706 closure := v.Args[1] 707 v.reset(OpRISCV64CALLclosure) 708 v.AuxInt = argwid 709 v.AddArg(entry) 710 v.AddArg(closure) 711 v.AddArg(mem) 712 return true 713 } 714 } 715 func rewriteValueRISCV64_OpCom16_0(v *Value) bool { 716 // match: (Com16 x) 717 // result: (XORI [int64(-1)] x) 718 for { 719 x := v.Args[0] 720 v.reset(OpRISCV64XORI) 721 v.AuxInt = int64(-1) 722 v.AddArg(x) 723 return true 724 } 725 } 726 func rewriteValueRISCV64_OpCom32_0(v *Value) bool { 727 // match: (Com32 x) 728 // result: (XORI [int64(-1)] x) 729 for { 730 x := v.Args[0] 731 v.reset(OpRISCV64XORI) 732 v.AuxInt = int64(-1) 733 v.AddArg(x) 734 return true 735 } 736 } 737 func rewriteValueRISCV64_OpCom64_0(v *Value) bool { 738 // match: (Com64 x) 739 // result: (XORI [int64(-1)] x) 740 for { 741 x := v.Args[0] 742 v.reset(OpRISCV64XORI) 743 v.AuxInt = int64(-1) 744 v.AddArg(x) 745 return true 746 } 747 } 748 func rewriteValueRISCV64_OpCom8_0(v *Value) bool { 749 // match: (Com8 x) 750 // result: (XORI [int64(-1)] x) 751 for { 752 x := v.Args[0] 753 v.reset(OpRISCV64XORI) 754 v.AuxInt = int64(-1) 755 v.AddArg(x) 756 return true 757 } 758 } 759 func rewriteValueRISCV64_OpConst16_0(v *Value) bool { 760 // match: (Const16 [val]) 761 // result: (MOVHconst [val]) 762 for { 763 val := v.AuxInt 764 v.reset(OpRISCV64MOVHconst) 765 v.AuxInt = val 766 return true 767 } 768 } 769 func rewriteValueRISCV64_OpConst32_0(v *Value) bool { 770 // match: (Const32 [val]) 771 // result: (MOVWconst [val]) 772 for { 773 val := v.AuxInt 774 v.reset(OpRISCV64MOVWconst) 775 v.AuxInt = val 776 return true 777 } 778 } 779 func rewriteValueRISCV64_OpConst32F_0(v *Value) bool { 780 b := v.Block 781 typ := &b.Func.Config.Types 782 // match: (Const32F [val]) 783 // result: (FMVSX (MOVWconst [int64(int32(math.Float32bits(float32(math.Float64frombits(uint64(val))))))])) 784 for { 785 val := v.AuxInt 786 v.reset(OpRISCV64FMVSX) 787 v0 := b.NewValue0(v.Pos, OpRISCV64MOVWconst, typ.UInt32) 788 v0.AuxInt = int64(int32(math.Float32bits(float32(math.Float64frombits(uint64(val)))))) 789 v.AddArg(v0) 790 return true 791 } 792 } 793 func rewriteValueRISCV64_OpConst64_0(v *Value) bool { 794 // match: (Const64 [val]) 795 // result: (MOVDconst [val]) 796 for { 797 val := v.AuxInt 798 v.reset(OpRISCV64MOVDconst) 799 v.AuxInt = val 800 return true 801 } 802 } 803 func rewriteValueRISCV64_OpConst64F_0(v *Value) bool { 804 b := v.Block 805 typ := &b.Func.Config.Types 806 // match: (Const64F [val]) 807 // result: (FMVDX (MOVDconst [val])) 808 for { 809 val := v.AuxInt 810 v.reset(OpRISCV64FMVDX) 811 v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 812 v0.AuxInt = val 813 v.AddArg(v0) 814 return true 815 } 816 } 817 func rewriteValueRISCV64_OpConst8_0(v *Value) bool { 818 // match: (Const8 [val]) 819 // result: (MOVBconst [val]) 820 for { 821 val := v.AuxInt 822 v.reset(OpRISCV64MOVBconst) 823 v.AuxInt = val 824 return true 825 } 826 } 827 func rewriteValueRISCV64_OpConstBool_0(v *Value) bool { 828 // match: (ConstBool [b]) 829 // result: (MOVBconst [b]) 830 for { 831 b := v.AuxInt 832 v.reset(OpRISCV64MOVBconst) 833 v.AuxInt = b 834 return true 835 } 836 } 837 func rewriteValueRISCV64_OpConstNil_0(v *Value) bool { 838 // match: (ConstNil) 839 // result: (MOVDconst [0]) 840 for { 841 v.reset(OpRISCV64MOVDconst) 842 v.AuxInt = 0 843 return true 844 } 845 } 846 func rewriteValueRISCV64_OpConvert_0(v *Value) bool { 847 // match: (Convert x mem) 848 // result: (MOVconvert x mem) 849 for { 850 mem := v.Args[1] 851 x := v.Args[0] 852 v.reset(OpRISCV64MOVconvert) 853 v.AddArg(x) 854 v.AddArg(mem) 855 return true 856 } 857 } 858 func rewriteValueRISCV64_OpCvt32Fto32_0(v *Value) bool { 859 // match: (Cvt32Fto32 x) 860 // result: (FCVTWS x) 861 for { 862 x := v.Args[0] 863 v.reset(OpRISCV64FCVTWS) 864 v.AddArg(x) 865 return true 866 } 867 } 868 func rewriteValueRISCV64_OpCvt32Fto64_0(v *Value) bool { 869 // match: (Cvt32Fto64 x) 870 // result: (FCVTLS x) 871 for { 872 x := v.Args[0] 873 v.reset(OpRISCV64FCVTLS) 874 v.AddArg(x) 875 return true 876 } 877 } 878 func rewriteValueRISCV64_OpCvt32Fto64F_0(v *Value) bool { 879 // match: (Cvt32Fto64F x) 880 // result: (FCVTDS x) 881 for { 882 x := v.Args[0] 883 v.reset(OpRISCV64FCVTDS) 884 v.AddArg(x) 885 return true 886 } 887 } 888 func rewriteValueRISCV64_OpCvt32to32F_0(v *Value) bool { 889 // match: (Cvt32to32F x) 890 // result: (FCVTSW x) 891 for { 892 x := v.Args[0] 893 v.reset(OpRISCV64FCVTSW) 894 v.AddArg(x) 895 return true 896 } 897 } 898 func rewriteValueRISCV64_OpCvt32to64F_0(v *Value) bool { 899 // match: (Cvt32to64F x) 900 // result: (FCVTDW x) 901 for { 902 x := v.Args[0] 903 v.reset(OpRISCV64FCVTDW) 904 v.AddArg(x) 905 return true 906 } 907 } 908 func rewriteValueRISCV64_OpCvt64Fto32_0(v *Value) bool { 909 // match: (Cvt64Fto32 x) 910 // result: (FCVTWD x) 911 for { 912 x := v.Args[0] 913 v.reset(OpRISCV64FCVTWD) 914 v.AddArg(x) 915 return true 916 } 917 } 918 func rewriteValueRISCV64_OpCvt64Fto32F_0(v *Value) bool { 919 // match: (Cvt64Fto32F x) 920 // result: (FCVTSD x) 921 for { 922 x := v.Args[0] 923 v.reset(OpRISCV64FCVTSD) 924 v.AddArg(x) 925 return true 926 } 927 } 928 func rewriteValueRISCV64_OpCvt64Fto64_0(v *Value) bool { 929 // match: (Cvt64Fto64 x) 930 // result: (FCVTLD x) 931 for { 932 x := v.Args[0] 933 v.reset(OpRISCV64FCVTLD) 934 v.AddArg(x) 935 return true 936 } 937 } 938 func rewriteValueRISCV64_OpCvt64to32F_0(v *Value) bool { 939 // match: (Cvt64to32F x) 940 // result: (FCVTSL x) 941 for { 942 x := v.Args[0] 943 v.reset(OpRISCV64FCVTSL) 944 v.AddArg(x) 945 return true 946 } 947 } 948 func rewriteValueRISCV64_OpCvt64to64F_0(v *Value) bool { 949 // match: (Cvt64to64F x) 950 // result: (FCVTDL x) 951 for { 952 x := v.Args[0] 953 v.reset(OpRISCV64FCVTDL) 954 v.AddArg(x) 955 return true 956 } 957 } 958 func rewriteValueRISCV64_OpDiv16_0(v *Value) bool { 959 b := v.Block 960 typ := &b.Func.Config.Types 961 // match: (Div16 x y) 962 // result: (DIVW (SignExt16to32 x) (SignExt16to32 y)) 963 for { 964 y := v.Args[1] 965 x := v.Args[0] 966 v.reset(OpRISCV64DIVW) 967 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 968 v0.AddArg(x) 969 v.AddArg(v0) 970 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 971 v1.AddArg(y) 972 v.AddArg(v1) 973 return true 974 } 975 } 976 func rewriteValueRISCV64_OpDiv16u_0(v *Value) bool { 977 b := v.Block 978 typ := &b.Func.Config.Types 979 // match: (Div16u x y) 980 // result: (DIVUW (ZeroExt16to32 x) (ZeroExt16to32 y)) 981 for { 982 y := v.Args[1] 983 x := v.Args[0] 984 v.reset(OpRISCV64DIVUW) 985 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 986 v0.AddArg(x) 987 v.AddArg(v0) 988 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 989 v1.AddArg(y) 990 v.AddArg(v1) 991 return true 992 } 993 } 994 func rewriteValueRISCV64_OpDiv32_0(v *Value) bool { 995 // match: (Div32 x y) 996 // result: (DIVW x y) 997 for { 998 y := v.Args[1] 999 x := v.Args[0] 1000 v.reset(OpRISCV64DIVW) 1001 v.AddArg(x) 1002 v.AddArg(y) 1003 return true 1004 } 1005 } 1006 func rewriteValueRISCV64_OpDiv32F_0(v *Value) bool { 1007 // match: (Div32F x y) 1008 // result: (FDIVS x y) 1009 for { 1010 y := v.Args[1] 1011 x := v.Args[0] 1012 v.reset(OpRISCV64FDIVS) 1013 v.AddArg(x) 1014 v.AddArg(y) 1015 return true 1016 } 1017 } 1018 func rewriteValueRISCV64_OpDiv32u_0(v *Value) bool { 1019 // match: (Div32u x y) 1020 // result: (DIVUW x y) 1021 for { 1022 y := v.Args[1] 1023 x := v.Args[0] 1024 v.reset(OpRISCV64DIVUW) 1025 v.AddArg(x) 1026 v.AddArg(y) 1027 return true 1028 } 1029 } 1030 func rewriteValueRISCV64_OpDiv64_0(v *Value) bool { 1031 // match: (Div64 x y) 1032 // result: (DIV x y) 1033 for { 1034 y := v.Args[1] 1035 x := v.Args[0] 1036 v.reset(OpRISCV64DIV) 1037 v.AddArg(x) 1038 v.AddArg(y) 1039 return true 1040 } 1041 } 1042 func rewriteValueRISCV64_OpDiv64F_0(v *Value) bool { 1043 // match: (Div64F x y) 1044 // result: (FDIVD x y) 1045 for { 1046 y := v.Args[1] 1047 x := v.Args[0] 1048 v.reset(OpRISCV64FDIVD) 1049 v.AddArg(x) 1050 v.AddArg(y) 1051 return true 1052 } 1053 } 1054 func rewriteValueRISCV64_OpDiv64u_0(v *Value) bool { 1055 // match: (Div64u x y) 1056 // result: (DIVU x y) 1057 for { 1058 y := v.Args[1] 1059 x := v.Args[0] 1060 v.reset(OpRISCV64DIVU) 1061 v.AddArg(x) 1062 v.AddArg(y) 1063 return true 1064 } 1065 } 1066 func rewriteValueRISCV64_OpDiv8_0(v *Value) bool { 1067 b := v.Block 1068 typ := &b.Func.Config.Types 1069 // match: (Div8 x y) 1070 // result: (DIVW (SignExt8to32 x) (SignExt8to32 y)) 1071 for { 1072 y := v.Args[1] 1073 x := v.Args[0] 1074 v.reset(OpRISCV64DIVW) 1075 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 1076 v0.AddArg(x) 1077 v.AddArg(v0) 1078 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 1079 v1.AddArg(y) 1080 v.AddArg(v1) 1081 return true 1082 } 1083 } 1084 func rewriteValueRISCV64_OpDiv8u_0(v *Value) bool { 1085 b := v.Block 1086 typ := &b.Func.Config.Types 1087 // match: (Div8u x y) 1088 // result: (DIVUW (ZeroExt8to32 x) (ZeroExt8to32 y)) 1089 for { 1090 y := v.Args[1] 1091 x := v.Args[0] 1092 v.reset(OpRISCV64DIVUW) 1093 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 1094 v0.AddArg(x) 1095 v.AddArg(v0) 1096 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 1097 v1.AddArg(y) 1098 v.AddArg(v1) 1099 return true 1100 } 1101 } 1102 func rewriteValueRISCV64_OpEq16_0(v *Value) bool { 1103 b := v.Block 1104 typ := &b.Func.Config.Types 1105 // match: (Eq16 x y) 1106 // result: (SEQZ (ZeroExt16to64 (SUB <x.Type> x y))) 1107 for { 1108 y := v.Args[1] 1109 x := v.Args[0] 1110 v.reset(OpRISCV64SEQZ) 1111 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1112 v1 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 1113 v1.AddArg(x) 1114 v1.AddArg(y) 1115 v0.AddArg(v1) 1116 v.AddArg(v0) 1117 return true 1118 } 1119 } 1120 func rewriteValueRISCV64_OpEq32_0(v *Value) bool { 1121 b := v.Block 1122 typ := &b.Func.Config.Types 1123 // match: (Eq32 x y) 1124 // result: (SEQZ (ZeroExt32to64 (SUB <x.Type> x y))) 1125 for { 1126 y := v.Args[1] 1127 x := v.Args[0] 1128 v.reset(OpRISCV64SEQZ) 1129 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1130 v1 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 1131 v1.AddArg(x) 1132 v1.AddArg(y) 1133 v0.AddArg(v1) 1134 v.AddArg(v0) 1135 return true 1136 } 1137 } 1138 func rewriteValueRISCV64_OpEq32F_0(v *Value) bool { 1139 // match: (Eq32F x y) 1140 // result: (FEQS x y) 1141 for { 1142 y := v.Args[1] 1143 x := v.Args[0] 1144 v.reset(OpRISCV64FEQS) 1145 v.AddArg(x) 1146 v.AddArg(y) 1147 return true 1148 } 1149 } 1150 func rewriteValueRISCV64_OpEq64_0(v *Value) bool { 1151 b := v.Block 1152 // match: (Eq64 x y) 1153 // result: (SEQZ (SUB <x.Type> x y)) 1154 for { 1155 y := v.Args[1] 1156 x := v.Args[0] 1157 v.reset(OpRISCV64SEQZ) 1158 v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 1159 v0.AddArg(x) 1160 v0.AddArg(y) 1161 v.AddArg(v0) 1162 return true 1163 } 1164 } 1165 func rewriteValueRISCV64_OpEq64F_0(v *Value) bool { 1166 // match: (Eq64F x y) 1167 // result: (FEQD x y) 1168 for { 1169 y := v.Args[1] 1170 x := v.Args[0] 1171 v.reset(OpRISCV64FEQD) 1172 v.AddArg(x) 1173 v.AddArg(y) 1174 return true 1175 } 1176 } 1177 func rewriteValueRISCV64_OpEq8_0(v *Value) bool { 1178 b := v.Block 1179 typ := &b.Func.Config.Types 1180 // match: (Eq8 x y) 1181 // result: (SEQZ (ZeroExt8to64 (SUB <x.Type> x y))) 1182 for { 1183 y := v.Args[1] 1184 x := v.Args[0] 1185 v.reset(OpRISCV64SEQZ) 1186 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1187 v1 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 1188 v1.AddArg(x) 1189 v1.AddArg(y) 1190 v0.AddArg(v1) 1191 v.AddArg(v0) 1192 return true 1193 } 1194 } 1195 func rewriteValueRISCV64_OpEqB_0(v *Value) bool { 1196 b := v.Block 1197 typ := &b.Func.Config.Types 1198 // match: (EqB x y) 1199 // result: (XORI [1] (XOR <typ.Bool> x y)) 1200 for { 1201 y := v.Args[1] 1202 x := v.Args[0] 1203 v.reset(OpRISCV64XORI) 1204 v.AuxInt = 1 1205 v0 := b.NewValue0(v.Pos, OpRISCV64XOR, typ.Bool) 1206 v0.AddArg(x) 1207 v0.AddArg(y) 1208 v.AddArg(v0) 1209 return true 1210 } 1211 } 1212 func rewriteValueRISCV64_OpEqPtr_0(v *Value) bool { 1213 b := v.Block 1214 // match: (EqPtr x y) 1215 // result: (SEQZ (SUB <x.Type> x y)) 1216 for { 1217 y := v.Args[1] 1218 x := v.Args[0] 1219 v.reset(OpRISCV64SEQZ) 1220 v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 1221 v0.AddArg(x) 1222 v0.AddArg(y) 1223 v.AddArg(v0) 1224 return true 1225 } 1226 } 1227 func rewriteValueRISCV64_OpGeq16_0(v *Value) bool { 1228 b := v.Block 1229 typ := &b.Func.Config.Types 1230 // match: (Geq16 x y) 1231 // result: (Not (Less16 x y)) 1232 for { 1233 y := v.Args[1] 1234 x := v.Args[0] 1235 v.reset(OpNot) 1236 v0 := b.NewValue0(v.Pos, OpLess16, typ.Bool) 1237 v0.AddArg(x) 1238 v0.AddArg(y) 1239 v.AddArg(v0) 1240 return true 1241 } 1242 } 1243 func rewriteValueRISCV64_OpGeq16U_0(v *Value) bool { 1244 b := v.Block 1245 typ := &b.Func.Config.Types 1246 // match: (Geq16U x y) 1247 // result: (Not (Less16U x y)) 1248 for { 1249 y := v.Args[1] 1250 x := v.Args[0] 1251 v.reset(OpNot) 1252 v0 := b.NewValue0(v.Pos, OpLess16U, typ.Bool) 1253 v0.AddArg(x) 1254 v0.AddArg(y) 1255 v.AddArg(v0) 1256 return true 1257 } 1258 } 1259 func rewriteValueRISCV64_OpGeq32_0(v *Value) bool { 1260 b := v.Block 1261 typ := &b.Func.Config.Types 1262 // match: (Geq32 x y) 1263 // result: (Not (Less32 x y)) 1264 for { 1265 y := v.Args[1] 1266 x := v.Args[0] 1267 v.reset(OpNot) 1268 v0 := b.NewValue0(v.Pos, OpLess32, typ.Bool) 1269 v0.AddArg(x) 1270 v0.AddArg(y) 1271 v.AddArg(v0) 1272 return true 1273 } 1274 } 1275 func rewriteValueRISCV64_OpGeq32F_0(v *Value) bool { 1276 // match: (Geq32F x y) 1277 // result: (FLES y x) 1278 for { 1279 y := v.Args[1] 1280 x := v.Args[0] 1281 v.reset(OpRISCV64FLES) 1282 v.AddArg(y) 1283 v.AddArg(x) 1284 return true 1285 } 1286 } 1287 func rewriteValueRISCV64_OpGeq32U_0(v *Value) bool { 1288 b := v.Block 1289 typ := &b.Func.Config.Types 1290 // match: (Geq32U x y) 1291 // result: (Not (Less32U x y)) 1292 for { 1293 y := v.Args[1] 1294 x := v.Args[0] 1295 v.reset(OpNot) 1296 v0 := b.NewValue0(v.Pos, OpLess32U, typ.Bool) 1297 v0.AddArg(x) 1298 v0.AddArg(y) 1299 v.AddArg(v0) 1300 return true 1301 } 1302 } 1303 func rewriteValueRISCV64_OpGeq64_0(v *Value) bool { 1304 b := v.Block 1305 typ := &b.Func.Config.Types 1306 // match: (Geq64 x y) 1307 // result: (Not (Less64 x y)) 1308 for { 1309 y := v.Args[1] 1310 x := v.Args[0] 1311 v.reset(OpNot) 1312 v0 := b.NewValue0(v.Pos, OpLess64, typ.Bool) 1313 v0.AddArg(x) 1314 v0.AddArg(y) 1315 v.AddArg(v0) 1316 return true 1317 } 1318 } 1319 func rewriteValueRISCV64_OpGeq64F_0(v *Value) bool { 1320 // match: (Geq64F x y) 1321 // result: (FLED y x) 1322 for { 1323 y := v.Args[1] 1324 x := v.Args[0] 1325 v.reset(OpRISCV64FLED) 1326 v.AddArg(y) 1327 v.AddArg(x) 1328 return true 1329 } 1330 } 1331 func rewriteValueRISCV64_OpGeq64U_0(v *Value) bool { 1332 b := v.Block 1333 typ := &b.Func.Config.Types 1334 // match: (Geq64U x y) 1335 // result: (Not (Less64U x y)) 1336 for { 1337 y := v.Args[1] 1338 x := v.Args[0] 1339 v.reset(OpNot) 1340 v0 := b.NewValue0(v.Pos, OpLess64U, typ.Bool) 1341 v0.AddArg(x) 1342 v0.AddArg(y) 1343 v.AddArg(v0) 1344 return true 1345 } 1346 } 1347 func rewriteValueRISCV64_OpGeq8_0(v *Value) bool { 1348 b := v.Block 1349 typ := &b.Func.Config.Types 1350 // match: (Geq8 x y) 1351 // result: (Not (Less8 x y)) 1352 for { 1353 y := v.Args[1] 1354 x := v.Args[0] 1355 v.reset(OpNot) 1356 v0 := b.NewValue0(v.Pos, OpLess8, typ.Bool) 1357 v0.AddArg(x) 1358 v0.AddArg(y) 1359 v.AddArg(v0) 1360 return true 1361 } 1362 } 1363 func rewriteValueRISCV64_OpGeq8U_0(v *Value) bool { 1364 b := v.Block 1365 typ := &b.Func.Config.Types 1366 // match: (Geq8U x y) 1367 // result: (Not (Less8U x y)) 1368 for { 1369 y := v.Args[1] 1370 x := v.Args[0] 1371 v.reset(OpNot) 1372 v0 := b.NewValue0(v.Pos, OpLess8U, typ.Bool) 1373 v0.AddArg(x) 1374 v0.AddArg(y) 1375 v.AddArg(v0) 1376 return true 1377 } 1378 } 1379 func rewriteValueRISCV64_OpGetCallerPC_0(v *Value) bool { 1380 // match: (GetCallerPC) 1381 // result: (LoweredGetCallerPC) 1382 for { 1383 v.reset(OpRISCV64LoweredGetCallerPC) 1384 return true 1385 } 1386 } 1387 func rewriteValueRISCV64_OpGetCallerSP_0(v *Value) bool { 1388 // match: (GetCallerSP) 1389 // result: (LoweredGetCallerSP) 1390 for { 1391 v.reset(OpRISCV64LoweredGetCallerSP) 1392 return true 1393 } 1394 } 1395 func rewriteValueRISCV64_OpGetClosurePtr_0(v *Value) bool { 1396 // match: (GetClosurePtr) 1397 // result: (LoweredGetClosurePtr) 1398 for { 1399 v.reset(OpRISCV64LoweredGetClosurePtr) 1400 return true 1401 } 1402 } 1403 func rewriteValueRISCV64_OpGreater16_0(v *Value) bool { 1404 // match: (Greater16 x y) 1405 // result: (Less16 y x) 1406 for { 1407 y := v.Args[1] 1408 x := v.Args[0] 1409 v.reset(OpLess16) 1410 v.AddArg(y) 1411 v.AddArg(x) 1412 return true 1413 } 1414 } 1415 func rewriteValueRISCV64_OpGreater16U_0(v *Value) bool { 1416 // match: (Greater16U x y) 1417 // result: (Less16U y x) 1418 for { 1419 y := v.Args[1] 1420 x := v.Args[0] 1421 v.reset(OpLess16U) 1422 v.AddArg(y) 1423 v.AddArg(x) 1424 return true 1425 } 1426 } 1427 func rewriteValueRISCV64_OpGreater32_0(v *Value) bool { 1428 // match: (Greater32 x y) 1429 // result: (Less32 y x) 1430 for { 1431 y := v.Args[1] 1432 x := v.Args[0] 1433 v.reset(OpLess32) 1434 v.AddArg(y) 1435 v.AddArg(x) 1436 return true 1437 } 1438 } 1439 func rewriteValueRISCV64_OpGreater32F_0(v *Value) bool { 1440 // match: (Greater32F x y) 1441 // result: (FLTS y x) 1442 for { 1443 y := v.Args[1] 1444 x := v.Args[0] 1445 v.reset(OpRISCV64FLTS) 1446 v.AddArg(y) 1447 v.AddArg(x) 1448 return true 1449 } 1450 } 1451 func rewriteValueRISCV64_OpGreater32U_0(v *Value) bool { 1452 // match: (Greater32U x y) 1453 // result: (Less32U y x) 1454 for { 1455 y := v.Args[1] 1456 x := v.Args[0] 1457 v.reset(OpLess32U) 1458 v.AddArg(y) 1459 v.AddArg(x) 1460 return true 1461 } 1462 } 1463 func rewriteValueRISCV64_OpGreater64_0(v *Value) bool { 1464 // match: (Greater64 x y) 1465 // result: (Less64 y x) 1466 for { 1467 y := v.Args[1] 1468 x := v.Args[0] 1469 v.reset(OpLess64) 1470 v.AddArg(y) 1471 v.AddArg(x) 1472 return true 1473 } 1474 } 1475 func rewriteValueRISCV64_OpGreater64F_0(v *Value) bool { 1476 // match: (Greater64F x y) 1477 // result: (FLTD y x) 1478 for { 1479 y := v.Args[1] 1480 x := v.Args[0] 1481 v.reset(OpRISCV64FLTD) 1482 v.AddArg(y) 1483 v.AddArg(x) 1484 return true 1485 } 1486 } 1487 func rewriteValueRISCV64_OpGreater64U_0(v *Value) bool { 1488 // match: (Greater64U x y) 1489 // result: (Less64U y x) 1490 for { 1491 y := v.Args[1] 1492 x := v.Args[0] 1493 v.reset(OpLess64U) 1494 v.AddArg(y) 1495 v.AddArg(x) 1496 return true 1497 } 1498 } 1499 func rewriteValueRISCV64_OpGreater8_0(v *Value) bool { 1500 // match: (Greater8 x y) 1501 // result: (Less8 y x) 1502 for { 1503 y := v.Args[1] 1504 x := v.Args[0] 1505 v.reset(OpLess8) 1506 v.AddArg(y) 1507 v.AddArg(x) 1508 return true 1509 } 1510 } 1511 func rewriteValueRISCV64_OpGreater8U_0(v *Value) bool { 1512 // match: (Greater8U x y) 1513 // result: (Less8U y x) 1514 for { 1515 y := v.Args[1] 1516 x := v.Args[0] 1517 v.reset(OpLess8U) 1518 v.AddArg(y) 1519 v.AddArg(x) 1520 return true 1521 } 1522 } 1523 func rewriteValueRISCV64_OpHmul32_0(v *Value) bool { 1524 b := v.Block 1525 typ := &b.Func.Config.Types 1526 // match: (Hmul32 x y) 1527 // result: (SRAI [32] (MUL (SignExt32to64 x) (SignExt32to64 y))) 1528 for { 1529 y := v.Args[1] 1530 x := v.Args[0] 1531 v.reset(OpRISCV64SRAI) 1532 v.AuxInt = 32 1533 v0 := b.NewValue0(v.Pos, OpRISCV64MUL, typ.Int64) 1534 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1535 v1.AddArg(x) 1536 v0.AddArg(v1) 1537 v2 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1538 v2.AddArg(y) 1539 v0.AddArg(v2) 1540 v.AddArg(v0) 1541 return true 1542 } 1543 } 1544 func rewriteValueRISCV64_OpHmul32u_0(v *Value) bool { 1545 b := v.Block 1546 typ := &b.Func.Config.Types 1547 // match: (Hmul32u x y) 1548 // result: (SRLI [32] (MUL (ZeroExt32to64 x) (ZeroExt32to64 y))) 1549 for { 1550 y := v.Args[1] 1551 x := v.Args[0] 1552 v.reset(OpRISCV64SRLI) 1553 v.AuxInt = 32 1554 v0 := b.NewValue0(v.Pos, OpRISCV64MUL, typ.Int64) 1555 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1556 v1.AddArg(x) 1557 v0.AddArg(v1) 1558 v2 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1559 v2.AddArg(y) 1560 v0.AddArg(v2) 1561 v.AddArg(v0) 1562 return true 1563 } 1564 } 1565 func rewriteValueRISCV64_OpHmul64_0(v *Value) bool { 1566 // match: (Hmul64 x y) 1567 // result: (MULH x y) 1568 for { 1569 y := v.Args[1] 1570 x := v.Args[0] 1571 v.reset(OpRISCV64MULH) 1572 v.AddArg(x) 1573 v.AddArg(y) 1574 return true 1575 } 1576 } 1577 func rewriteValueRISCV64_OpHmul64u_0(v *Value) bool { 1578 // match: (Hmul64u x y) 1579 // result: (MULHU x y) 1580 for { 1581 y := v.Args[1] 1582 x := v.Args[0] 1583 v.reset(OpRISCV64MULHU) 1584 v.AddArg(x) 1585 v.AddArg(y) 1586 return true 1587 } 1588 } 1589 func rewriteValueRISCV64_OpInterCall_0(v *Value) bool { 1590 // match: (InterCall [argwid] entry mem) 1591 // result: (CALLinter [argwid] entry mem) 1592 for { 1593 argwid := v.AuxInt 1594 mem := v.Args[1] 1595 entry := v.Args[0] 1596 v.reset(OpRISCV64CALLinter) 1597 v.AuxInt = argwid 1598 v.AddArg(entry) 1599 v.AddArg(mem) 1600 return true 1601 } 1602 } 1603 func rewriteValueRISCV64_OpIsInBounds_0(v *Value) bool { 1604 // match: (IsInBounds idx len) 1605 // result: (Less64U idx len) 1606 for { 1607 len := v.Args[1] 1608 idx := v.Args[0] 1609 v.reset(OpLess64U) 1610 v.AddArg(idx) 1611 v.AddArg(len) 1612 return true 1613 } 1614 } 1615 func rewriteValueRISCV64_OpIsNonNil_0(v *Value) bool { 1616 b := v.Block 1617 typ := &b.Func.Config.Types 1618 // match: (IsNonNil p) 1619 // result: (NeqPtr (MOVDconst) p) 1620 for { 1621 p := v.Args[0] 1622 v.reset(OpNeqPtr) 1623 v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 1624 v.AddArg(v0) 1625 v.AddArg(p) 1626 return true 1627 } 1628 } 1629 func rewriteValueRISCV64_OpIsSliceInBounds_0(v *Value) bool { 1630 // match: (IsSliceInBounds idx len) 1631 // result: (Leq64U idx len) 1632 for { 1633 len := v.Args[1] 1634 idx := v.Args[0] 1635 v.reset(OpLeq64U) 1636 v.AddArg(idx) 1637 v.AddArg(len) 1638 return true 1639 } 1640 } 1641 func rewriteValueRISCV64_OpLeq16_0(v *Value) bool { 1642 b := v.Block 1643 typ := &b.Func.Config.Types 1644 // match: (Leq16 x y) 1645 // result: (Not (Less16 y x)) 1646 for { 1647 y := v.Args[1] 1648 x := v.Args[0] 1649 v.reset(OpNot) 1650 v0 := b.NewValue0(v.Pos, OpLess16, typ.Bool) 1651 v0.AddArg(y) 1652 v0.AddArg(x) 1653 v.AddArg(v0) 1654 return true 1655 } 1656 } 1657 func rewriteValueRISCV64_OpLeq16U_0(v *Value) bool { 1658 b := v.Block 1659 typ := &b.Func.Config.Types 1660 // match: (Leq16U x y) 1661 // result: (Not (Less16U y x)) 1662 for { 1663 y := v.Args[1] 1664 x := v.Args[0] 1665 v.reset(OpNot) 1666 v0 := b.NewValue0(v.Pos, OpLess16U, typ.Bool) 1667 v0.AddArg(y) 1668 v0.AddArg(x) 1669 v.AddArg(v0) 1670 return true 1671 } 1672 } 1673 func rewriteValueRISCV64_OpLeq32_0(v *Value) bool { 1674 b := v.Block 1675 typ := &b.Func.Config.Types 1676 // match: (Leq32 x y) 1677 // result: (Not (Less32 y x)) 1678 for { 1679 y := v.Args[1] 1680 x := v.Args[0] 1681 v.reset(OpNot) 1682 v0 := b.NewValue0(v.Pos, OpLess32, typ.Bool) 1683 v0.AddArg(y) 1684 v0.AddArg(x) 1685 v.AddArg(v0) 1686 return true 1687 } 1688 } 1689 func rewriteValueRISCV64_OpLeq32F_0(v *Value) bool { 1690 // match: (Leq32F x y) 1691 // result: (FLES x y) 1692 for { 1693 y := v.Args[1] 1694 x := v.Args[0] 1695 v.reset(OpRISCV64FLES) 1696 v.AddArg(x) 1697 v.AddArg(y) 1698 return true 1699 } 1700 } 1701 func rewriteValueRISCV64_OpLeq32U_0(v *Value) bool { 1702 b := v.Block 1703 typ := &b.Func.Config.Types 1704 // match: (Leq32U x y) 1705 // result: (Not (Less32U y x)) 1706 for { 1707 y := v.Args[1] 1708 x := v.Args[0] 1709 v.reset(OpNot) 1710 v0 := b.NewValue0(v.Pos, OpLess32U, typ.Bool) 1711 v0.AddArg(y) 1712 v0.AddArg(x) 1713 v.AddArg(v0) 1714 return true 1715 } 1716 } 1717 func rewriteValueRISCV64_OpLeq64_0(v *Value) bool { 1718 b := v.Block 1719 typ := &b.Func.Config.Types 1720 // match: (Leq64 x y) 1721 // result: (Not (Less64 y x)) 1722 for { 1723 y := v.Args[1] 1724 x := v.Args[0] 1725 v.reset(OpNot) 1726 v0 := b.NewValue0(v.Pos, OpLess64, typ.Bool) 1727 v0.AddArg(y) 1728 v0.AddArg(x) 1729 v.AddArg(v0) 1730 return true 1731 } 1732 } 1733 func rewriteValueRISCV64_OpLeq64F_0(v *Value) bool { 1734 // match: (Leq64F x y) 1735 // result: (FLED x y) 1736 for { 1737 y := v.Args[1] 1738 x := v.Args[0] 1739 v.reset(OpRISCV64FLED) 1740 v.AddArg(x) 1741 v.AddArg(y) 1742 return true 1743 } 1744 } 1745 func rewriteValueRISCV64_OpLeq64U_0(v *Value) bool { 1746 b := v.Block 1747 typ := &b.Func.Config.Types 1748 // match: (Leq64U x y) 1749 // result: (Not (Less64U y x)) 1750 for { 1751 y := v.Args[1] 1752 x := v.Args[0] 1753 v.reset(OpNot) 1754 v0 := b.NewValue0(v.Pos, OpLess64U, typ.Bool) 1755 v0.AddArg(y) 1756 v0.AddArg(x) 1757 v.AddArg(v0) 1758 return true 1759 } 1760 } 1761 func rewriteValueRISCV64_OpLeq8_0(v *Value) bool { 1762 b := v.Block 1763 typ := &b.Func.Config.Types 1764 // match: (Leq8 x y) 1765 // result: (Not (Less8 y x)) 1766 for { 1767 y := v.Args[1] 1768 x := v.Args[0] 1769 v.reset(OpNot) 1770 v0 := b.NewValue0(v.Pos, OpLess8, typ.Bool) 1771 v0.AddArg(y) 1772 v0.AddArg(x) 1773 v.AddArg(v0) 1774 return true 1775 } 1776 } 1777 func rewriteValueRISCV64_OpLeq8U_0(v *Value) bool { 1778 b := v.Block 1779 typ := &b.Func.Config.Types 1780 // match: (Leq8U x y) 1781 // result: (Not (Less8U y x)) 1782 for { 1783 y := v.Args[1] 1784 x := v.Args[0] 1785 v.reset(OpNot) 1786 v0 := b.NewValue0(v.Pos, OpLess8U, typ.Bool) 1787 v0.AddArg(y) 1788 v0.AddArg(x) 1789 v.AddArg(v0) 1790 return true 1791 } 1792 } 1793 func rewriteValueRISCV64_OpLess16_0(v *Value) bool { 1794 b := v.Block 1795 typ := &b.Func.Config.Types 1796 // match: (Less16 x y) 1797 // result: (SLT (SignExt16to64 x) (SignExt16to64 y)) 1798 for { 1799 y := v.Args[1] 1800 x := v.Args[0] 1801 v.reset(OpRISCV64SLT) 1802 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 1803 v0.AddArg(x) 1804 v.AddArg(v0) 1805 v1 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 1806 v1.AddArg(y) 1807 v.AddArg(v1) 1808 return true 1809 } 1810 } 1811 func rewriteValueRISCV64_OpLess16U_0(v *Value) bool { 1812 b := v.Block 1813 typ := &b.Func.Config.Types 1814 // match: (Less16U x y) 1815 // result: (SLTU (ZeroExt16to64 x) (ZeroExt16to64 y)) 1816 for { 1817 y := v.Args[1] 1818 x := v.Args[0] 1819 v.reset(OpRISCV64SLTU) 1820 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1821 v0.AddArg(x) 1822 v.AddArg(v0) 1823 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 1824 v1.AddArg(y) 1825 v.AddArg(v1) 1826 return true 1827 } 1828 } 1829 func rewriteValueRISCV64_OpLess32_0(v *Value) bool { 1830 b := v.Block 1831 typ := &b.Func.Config.Types 1832 // match: (Less32 x y) 1833 // result: (SLT (SignExt32to64 x) (SignExt32to64 y)) 1834 for { 1835 y := v.Args[1] 1836 x := v.Args[0] 1837 v.reset(OpRISCV64SLT) 1838 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1839 v0.AddArg(x) 1840 v.AddArg(v0) 1841 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 1842 v1.AddArg(y) 1843 v.AddArg(v1) 1844 return true 1845 } 1846 } 1847 func rewriteValueRISCV64_OpLess32F_0(v *Value) bool { 1848 // match: (Less32F x y) 1849 // result: (FLTS x y) 1850 for { 1851 y := v.Args[1] 1852 x := v.Args[0] 1853 v.reset(OpRISCV64FLTS) 1854 v.AddArg(x) 1855 v.AddArg(y) 1856 return true 1857 } 1858 } 1859 func rewriteValueRISCV64_OpLess32U_0(v *Value) bool { 1860 b := v.Block 1861 typ := &b.Func.Config.Types 1862 // match: (Less32U x y) 1863 // result: (SLTU (ZeroExt32to64 x) (ZeroExt32to64 y)) 1864 for { 1865 y := v.Args[1] 1866 x := v.Args[0] 1867 v.reset(OpRISCV64SLTU) 1868 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1869 v0.AddArg(x) 1870 v.AddArg(v0) 1871 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 1872 v1.AddArg(y) 1873 v.AddArg(v1) 1874 return true 1875 } 1876 } 1877 func rewriteValueRISCV64_OpLess64_0(v *Value) bool { 1878 // match: (Less64 x y) 1879 // result: (SLT x y) 1880 for { 1881 y := v.Args[1] 1882 x := v.Args[0] 1883 v.reset(OpRISCV64SLT) 1884 v.AddArg(x) 1885 v.AddArg(y) 1886 return true 1887 } 1888 } 1889 func rewriteValueRISCV64_OpLess64F_0(v *Value) bool { 1890 // match: (Less64F x y) 1891 // result: (FLTD x y) 1892 for { 1893 y := v.Args[1] 1894 x := v.Args[0] 1895 v.reset(OpRISCV64FLTD) 1896 v.AddArg(x) 1897 v.AddArg(y) 1898 return true 1899 } 1900 } 1901 func rewriteValueRISCV64_OpLess64U_0(v *Value) bool { 1902 // match: (Less64U x y) 1903 // result: (SLTU x y) 1904 for { 1905 y := v.Args[1] 1906 x := v.Args[0] 1907 v.reset(OpRISCV64SLTU) 1908 v.AddArg(x) 1909 v.AddArg(y) 1910 return true 1911 } 1912 } 1913 func rewriteValueRISCV64_OpLess8_0(v *Value) bool { 1914 b := v.Block 1915 typ := &b.Func.Config.Types 1916 // match: (Less8 x y) 1917 // result: (SLT (SignExt8to64 x) (SignExt8to64 y)) 1918 for { 1919 y := v.Args[1] 1920 x := v.Args[0] 1921 v.reset(OpRISCV64SLT) 1922 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1923 v0.AddArg(x) 1924 v.AddArg(v0) 1925 v1 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 1926 v1.AddArg(y) 1927 v.AddArg(v1) 1928 return true 1929 } 1930 } 1931 func rewriteValueRISCV64_OpLess8U_0(v *Value) bool { 1932 b := v.Block 1933 typ := &b.Func.Config.Types 1934 // match: (Less8U x y) 1935 // result: (SLTU (ZeroExt8to64 x) (ZeroExt8to64 y)) 1936 for { 1937 y := v.Args[1] 1938 x := v.Args[0] 1939 v.reset(OpRISCV64SLTU) 1940 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1941 v0.AddArg(x) 1942 v.AddArg(v0) 1943 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 1944 v1.AddArg(y) 1945 v.AddArg(v1) 1946 return true 1947 } 1948 } 1949 func rewriteValueRISCV64_OpLoad_0(v *Value) bool { 1950 // match: (Load <t> ptr mem) 1951 // cond: t.IsBoolean() 1952 // result: (MOVBUload ptr mem) 1953 for { 1954 t := v.Type 1955 mem := v.Args[1] 1956 ptr := v.Args[0] 1957 if !(t.IsBoolean()) { 1958 break 1959 } 1960 v.reset(OpRISCV64MOVBUload) 1961 v.AddArg(ptr) 1962 v.AddArg(mem) 1963 return true 1964 } 1965 // match: (Load <t> ptr mem) 1966 // cond: ( is8BitInt(t) && isSigned(t)) 1967 // result: (MOVBload ptr mem) 1968 for { 1969 t := v.Type 1970 mem := v.Args[1] 1971 ptr := v.Args[0] 1972 if !(is8BitInt(t) && isSigned(t)) { 1973 break 1974 } 1975 v.reset(OpRISCV64MOVBload) 1976 v.AddArg(ptr) 1977 v.AddArg(mem) 1978 return true 1979 } 1980 // match: (Load <t> ptr mem) 1981 // cond: ( is8BitInt(t) && !isSigned(t)) 1982 // result: (MOVBUload ptr mem) 1983 for { 1984 t := v.Type 1985 mem := v.Args[1] 1986 ptr := v.Args[0] 1987 if !(is8BitInt(t) && !isSigned(t)) { 1988 break 1989 } 1990 v.reset(OpRISCV64MOVBUload) 1991 v.AddArg(ptr) 1992 v.AddArg(mem) 1993 return true 1994 } 1995 // match: (Load <t> ptr mem) 1996 // cond: (is16BitInt(t) && isSigned(t)) 1997 // result: (MOVHload ptr mem) 1998 for { 1999 t := v.Type 2000 mem := v.Args[1] 2001 ptr := v.Args[0] 2002 if !(is16BitInt(t) && isSigned(t)) { 2003 break 2004 } 2005 v.reset(OpRISCV64MOVHload) 2006 v.AddArg(ptr) 2007 v.AddArg(mem) 2008 return true 2009 } 2010 // match: (Load <t> ptr mem) 2011 // cond: (is16BitInt(t) && !isSigned(t)) 2012 // result: (MOVHUload ptr mem) 2013 for { 2014 t := v.Type 2015 mem := v.Args[1] 2016 ptr := v.Args[0] 2017 if !(is16BitInt(t) && !isSigned(t)) { 2018 break 2019 } 2020 v.reset(OpRISCV64MOVHUload) 2021 v.AddArg(ptr) 2022 v.AddArg(mem) 2023 return true 2024 } 2025 // match: (Load <t> ptr mem) 2026 // cond: (is32BitInt(t) && isSigned(t)) 2027 // result: (MOVWload ptr mem) 2028 for { 2029 t := v.Type 2030 mem := v.Args[1] 2031 ptr := v.Args[0] 2032 if !(is32BitInt(t) && isSigned(t)) { 2033 break 2034 } 2035 v.reset(OpRISCV64MOVWload) 2036 v.AddArg(ptr) 2037 v.AddArg(mem) 2038 return true 2039 } 2040 // match: (Load <t> ptr mem) 2041 // cond: (is32BitInt(t) && !isSigned(t)) 2042 // result: (MOVWUload ptr mem) 2043 for { 2044 t := v.Type 2045 mem := v.Args[1] 2046 ptr := v.Args[0] 2047 if !(is32BitInt(t) && !isSigned(t)) { 2048 break 2049 } 2050 v.reset(OpRISCV64MOVWUload) 2051 v.AddArg(ptr) 2052 v.AddArg(mem) 2053 return true 2054 } 2055 // match: (Load <t> ptr mem) 2056 // cond: (is64BitInt(t) || isPtr(t)) 2057 // result: (MOVDload ptr mem) 2058 for { 2059 t := v.Type 2060 mem := v.Args[1] 2061 ptr := v.Args[0] 2062 if !(is64BitInt(t) || isPtr(t)) { 2063 break 2064 } 2065 v.reset(OpRISCV64MOVDload) 2066 v.AddArg(ptr) 2067 v.AddArg(mem) 2068 return true 2069 } 2070 // match: (Load <t> ptr mem) 2071 // cond: is32BitFloat(t) 2072 // result: (FMOVWload ptr mem) 2073 for { 2074 t := v.Type 2075 mem := v.Args[1] 2076 ptr := v.Args[0] 2077 if !(is32BitFloat(t)) { 2078 break 2079 } 2080 v.reset(OpRISCV64FMOVWload) 2081 v.AddArg(ptr) 2082 v.AddArg(mem) 2083 return true 2084 } 2085 // match: (Load <t> ptr mem) 2086 // cond: is64BitFloat(t) 2087 // result: (FMOVDload ptr mem) 2088 for { 2089 t := v.Type 2090 mem := v.Args[1] 2091 ptr := v.Args[0] 2092 if !(is64BitFloat(t)) { 2093 break 2094 } 2095 v.reset(OpRISCV64FMOVDload) 2096 v.AddArg(ptr) 2097 v.AddArg(mem) 2098 return true 2099 } 2100 return false 2101 } 2102 func rewriteValueRISCV64_OpLocalAddr_0(v *Value) bool { 2103 // match: (LocalAddr {sym} base _) 2104 // result: (MOVaddr {sym} base) 2105 for { 2106 sym := v.Aux 2107 _ = v.Args[1] 2108 base := v.Args[0] 2109 v.reset(OpRISCV64MOVaddr) 2110 v.Aux = sym 2111 v.AddArg(base) 2112 return true 2113 } 2114 } 2115 func rewriteValueRISCV64_OpLsh16x16_0(v *Value) bool { 2116 b := v.Block 2117 typ := &b.Func.Config.Types 2118 // match: (Lsh16x16 <t> x y) 2119 // result: (AND (SLL <t> x y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt16to64 y)))) 2120 for { 2121 t := v.Type 2122 y := v.Args[1] 2123 x := v.Args[0] 2124 v.reset(OpRISCV64AND) 2125 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2126 v0.AddArg(x) 2127 v0.AddArg(y) 2128 v.AddArg(v0) 2129 v1 := b.NewValue0(v.Pos, OpNeg16, t) 2130 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2131 v2.AuxInt = 64 2132 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2133 v3.AddArg(y) 2134 v2.AddArg(v3) 2135 v1.AddArg(v2) 2136 v.AddArg(v1) 2137 return true 2138 } 2139 } 2140 func rewriteValueRISCV64_OpLsh16x32_0(v *Value) bool { 2141 b := v.Block 2142 typ := &b.Func.Config.Types 2143 // match: (Lsh16x32 <t> x y) 2144 // result: (AND (SLL <t> x y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt32to64 y)))) 2145 for { 2146 t := v.Type 2147 y := v.Args[1] 2148 x := v.Args[0] 2149 v.reset(OpRISCV64AND) 2150 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2151 v0.AddArg(x) 2152 v0.AddArg(y) 2153 v.AddArg(v0) 2154 v1 := b.NewValue0(v.Pos, OpNeg16, t) 2155 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2156 v2.AuxInt = 64 2157 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2158 v3.AddArg(y) 2159 v2.AddArg(v3) 2160 v1.AddArg(v2) 2161 v.AddArg(v1) 2162 return true 2163 } 2164 } 2165 func rewriteValueRISCV64_OpLsh16x64_0(v *Value) bool { 2166 b := v.Block 2167 // match: (Lsh16x64 <t> x y) 2168 // result: (AND (SLL <t> x y) (Neg16 <t> (SLTIU <t> [64] y))) 2169 for { 2170 t := v.Type 2171 y := v.Args[1] 2172 x := v.Args[0] 2173 v.reset(OpRISCV64AND) 2174 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2175 v0.AddArg(x) 2176 v0.AddArg(y) 2177 v.AddArg(v0) 2178 v1 := b.NewValue0(v.Pos, OpNeg16, t) 2179 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2180 v2.AuxInt = 64 2181 v2.AddArg(y) 2182 v1.AddArg(v2) 2183 v.AddArg(v1) 2184 return true 2185 } 2186 } 2187 func rewriteValueRISCV64_OpLsh16x8_0(v *Value) bool { 2188 b := v.Block 2189 typ := &b.Func.Config.Types 2190 // match: (Lsh16x8 <t> x y) 2191 // result: (AND (SLL <t> x y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt8to64 y)))) 2192 for { 2193 t := v.Type 2194 y := v.Args[1] 2195 x := v.Args[0] 2196 v.reset(OpRISCV64AND) 2197 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2198 v0.AddArg(x) 2199 v0.AddArg(y) 2200 v.AddArg(v0) 2201 v1 := b.NewValue0(v.Pos, OpNeg16, t) 2202 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2203 v2.AuxInt = 64 2204 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2205 v3.AddArg(y) 2206 v2.AddArg(v3) 2207 v1.AddArg(v2) 2208 v.AddArg(v1) 2209 return true 2210 } 2211 } 2212 func rewriteValueRISCV64_OpLsh32x16_0(v *Value) bool { 2213 b := v.Block 2214 typ := &b.Func.Config.Types 2215 // match: (Lsh32x16 <t> x y) 2216 // result: (AND (SLL <t> x y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt16to64 y)))) 2217 for { 2218 t := v.Type 2219 y := v.Args[1] 2220 x := v.Args[0] 2221 v.reset(OpRISCV64AND) 2222 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2223 v0.AddArg(x) 2224 v0.AddArg(y) 2225 v.AddArg(v0) 2226 v1 := b.NewValue0(v.Pos, OpNeg32, t) 2227 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2228 v2.AuxInt = 64 2229 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2230 v3.AddArg(y) 2231 v2.AddArg(v3) 2232 v1.AddArg(v2) 2233 v.AddArg(v1) 2234 return true 2235 } 2236 } 2237 func rewriteValueRISCV64_OpLsh32x32_0(v *Value) bool { 2238 b := v.Block 2239 typ := &b.Func.Config.Types 2240 // match: (Lsh32x32 <t> x y) 2241 // result: (AND (SLL <t> x y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt32to64 y)))) 2242 for { 2243 t := v.Type 2244 y := v.Args[1] 2245 x := v.Args[0] 2246 v.reset(OpRISCV64AND) 2247 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2248 v0.AddArg(x) 2249 v0.AddArg(y) 2250 v.AddArg(v0) 2251 v1 := b.NewValue0(v.Pos, OpNeg32, t) 2252 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2253 v2.AuxInt = 64 2254 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2255 v3.AddArg(y) 2256 v2.AddArg(v3) 2257 v1.AddArg(v2) 2258 v.AddArg(v1) 2259 return true 2260 } 2261 } 2262 func rewriteValueRISCV64_OpLsh32x64_0(v *Value) bool { 2263 b := v.Block 2264 // match: (Lsh32x64 <t> x y) 2265 // result: (AND (SLL <t> x y) (Neg32 <t> (SLTIU <t> [64] y))) 2266 for { 2267 t := v.Type 2268 y := v.Args[1] 2269 x := v.Args[0] 2270 v.reset(OpRISCV64AND) 2271 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2272 v0.AddArg(x) 2273 v0.AddArg(y) 2274 v.AddArg(v0) 2275 v1 := b.NewValue0(v.Pos, OpNeg32, t) 2276 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2277 v2.AuxInt = 64 2278 v2.AddArg(y) 2279 v1.AddArg(v2) 2280 v.AddArg(v1) 2281 return true 2282 } 2283 } 2284 func rewriteValueRISCV64_OpLsh32x8_0(v *Value) bool { 2285 b := v.Block 2286 typ := &b.Func.Config.Types 2287 // match: (Lsh32x8 <t> x y) 2288 // result: (AND (SLL <t> x y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt8to64 y)))) 2289 for { 2290 t := v.Type 2291 y := v.Args[1] 2292 x := v.Args[0] 2293 v.reset(OpRISCV64AND) 2294 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2295 v0.AddArg(x) 2296 v0.AddArg(y) 2297 v.AddArg(v0) 2298 v1 := b.NewValue0(v.Pos, OpNeg32, t) 2299 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2300 v2.AuxInt = 64 2301 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2302 v3.AddArg(y) 2303 v2.AddArg(v3) 2304 v1.AddArg(v2) 2305 v.AddArg(v1) 2306 return true 2307 } 2308 } 2309 func rewriteValueRISCV64_OpLsh64x16_0(v *Value) bool { 2310 b := v.Block 2311 typ := &b.Func.Config.Types 2312 // match: (Lsh64x16 <t> x y) 2313 // result: (AND (SLL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt16to64 y)))) 2314 for { 2315 t := v.Type 2316 y := v.Args[1] 2317 x := v.Args[0] 2318 v.reset(OpRISCV64AND) 2319 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2320 v0.AddArg(x) 2321 v0.AddArg(y) 2322 v.AddArg(v0) 2323 v1 := b.NewValue0(v.Pos, OpNeg64, t) 2324 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2325 v2.AuxInt = 64 2326 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2327 v3.AddArg(y) 2328 v2.AddArg(v3) 2329 v1.AddArg(v2) 2330 v.AddArg(v1) 2331 return true 2332 } 2333 } 2334 func rewriteValueRISCV64_OpLsh64x32_0(v *Value) bool { 2335 b := v.Block 2336 typ := &b.Func.Config.Types 2337 // match: (Lsh64x32 <t> x y) 2338 // result: (AND (SLL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt32to64 y)))) 2339 for { 2340 t := v.Type 2341 y := v.Args[1] 2342 x := v.Args[0] 2343 v.reset(OpRISCV64AND) 2344 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2345 v0.AddArg(x) 2346 v0.AddArg(y) 2347 v.AddArg(v0) 2348 v1 := b.NewValue0(v.Pos, OpNeg64, t) 2349 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2350 v2.AuxInt = 64 2351 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2352 v3.AddArg(y) 2353 v2.AddArg(v3) 2354 v1.AddArg(v2) 2355 v.AddArg(v1) 2356 return true 2357 } 2358 } 2359 func rewriteValueRISCV64_OpLsh64x64_0(v *Value) bool { 2360 b := v.Block 2361 // match: (Lsh64x64 <t> x y) 2362 // result: (AND (SLL <t> x y) (Neg64 <t> (SLTIU <t> [64] y))) 2363 for { 2364 t := v.Type 2365 y := v.Args[1] 2366 x := v.Args[0] 2367 v.reset(OpRISCV64AND) 2368 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2369 v0.AddArg(x) 2370 v0.AddArg(y) 2371 v.AddArg(v0) 2372 v1 := b.NewValue0(v.Pos, OpNeg64, t) 2373 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2374 v2.AuxInt = 64 2375 v2.AddArg(y) 2376 v1.AddArg(v2) 2377 v.AddArg(v1) 2378 return true 2379 } 2380 } 2381 func rewriteValueRISCV64_OpLsh64x8_0(v *Value) bool { 2382 b := v.Block 2383 typ := &b.Func.Config.Types 2384 // match: (Lsh64x8 <t> x y) 2385 // result: (AND (SLL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt8to64 y)))) 2386 for { 2387 t := v.Type 2388 y := v.Args[1] 2389 x := v.Args[0] 2390 v.reset(OpRISCV64AND) 2391 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2392 v0.AddArg(x) 2393 v0.AddArg(y) 2394 v.AddArg(v0) 2395 v1 := b.NewValue0(v.Pos, OpNeg64, t) 2396 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2397 v2.AuxInt = 64 2398 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2399 v3.AddArg(y) 2400 v2.AddArg(v3) 2401 v1.AddArg(v2) 2402 v.AddArg(v1) 2403 return true 2404 } 2405 } 2406 func rewriteValueRISCV64_OpLsh8x16_0(v *Value) bool { 2407 b := v.Block 2408 typ := &b.Func.Config.Types 2409 // match: (Lsh8x16 <t> x y) 2410 // result: (AND (SLL <t> x y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt16to64 y)))) 2411 for { 2412 t := v.Type 2413 y := v.Args[1] 2414 x := v.Args[0] 2415 v.reset(OpRISCV64AND) 2416 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2417 v0.AddArg(x) 2418 v0.AddArg(y) 2419 v.AddArg(v0) 2420 v1 := b.NewValue0(v.Pos, OpNeg8, t) 2421 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2422 v2.AuxInt = 64 2423 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2424 v3.AddArg(y) 2425 v2.AddArg(v3) 2426 v1.AddArg(v2) 2427 v.AddArg(v1) 2428 return true 2429 } 2430 } 2431 func rewriteValueRISCV64_OpLsh8x32_0(v *Value) bool { 2432 b := v.Block 2433 typ := &b.Func.Config.Types 2434 // match: (Lsh8x32 <t> x y) 2435 // result: (AND (SLL <t> x y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt32to64 y)))) 2436 for { 2437 t := v.Type 2438 y := v.Args[1] 2439 x := v.Args[0] 2440 v.reset(OpRISCV64AND) 2441 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2442 v0.AddArg(x) 2443 v0.AddArg(y) 2444 v.AddArg(v0) 2445 v1 := b.NewValue0(v.Pos, OpNeg8, t) 2446 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2447 v2.AuxInt = 64 2448 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2449 v3.AddArg(y) 2450 v2.AddArg(v3) 2451 v1.AddArg(v2) 2452 v.AddArg(v1) 2453 return true 2454 } 2455 } 2456 func rewriteValueRISCV64_OpLsh8x64_0(v *Value) bool { 2457 b := v.Block 2458 // match: (Lsh8x64 <t> x y) 2459 // result: (AND (SLL <t> x y) (Neg8 <t> (SLTIU <t> [64] y))) 2460 for { 2461 t := v.Type 2462 y := v.Args[1] 2463 x := v.Args[0] 2464 v.reset(OpRISCV64AND) 2465 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2466 v0.AddArg(x) 2467 v0.AddArg(y) 2468 v.AddArg(v0) 2469 v1 := b.NewValue0(v.Pos, OpNeg8, t) 2470 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2471 v2.AuxInt = 64 2472 v2.AddArg(y) 2473 v1.AddArg(v2) 2474 v.AddArg(v1) 2475 return true 2476 } 2477 } 2478 func rewriteValueRISCV64_OpLsh8x8_0(v *Value) bool { 2479 b := v.Block 2480 typ := &b.Func.Config.Types 2481 // match: (Lsh8x8 <t> x y) 2482 // result: (AND (SLL <t> x y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt8to64 y)))) 2483 for { 2484 t := v.Type 2485 y := v.Args[1] 2486 x := v.Args[0] 2487 v.reset(OpRISCV64AND) 2488 v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t) 2489 v0.AddArg(x) 2490 v0.AddArg(y) 2491 v.AddArg(v0) 2492 v1 := b.NewValue0(v.Pos, OpNeg8, t) 2493 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 2494 v2.AuxInt = 64 2495 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2496 v3.AddArg(y) 2497 v2.AddArg(v3) 2498 v1.AddArg(v2) 2499 v.AddArg(v1) 2500 return true 2501 } 2502 } 2503 func rewriteValueRISCV64_OpMod16_0(v *Value) bool { 2504 b := v.Block 2505 typ := &b.Func.Config.Types 2506 // match: (Mod16 x y) 2507 // result: (REMW (SignExt16to32 x) (SignExt16to32 y)) 2508 for { 2509 y := v.Args[1] 2510 x := v.Args[0] 2511 v.reset(OpRISCV64REMW) 2512 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 2513 v0.AddArg(x) 2514 v.AddArg(v0) 2515 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 2516 v1.AddArg(y) 2517 v.AddArg(v1) 2518 return true 2519 } 2520 } 2521 func rewriteValueRISCV64_OpMod16u_0(v *Value) bool { 2522 b := v.Block 2523 typ := &b.Func.Config.Types 2524 // match: (Mod16u x y) 2525 // result: (REMUW (ZeroExt16to32 x) (ZeroExt16to32 y)) 2526 for { 2527 y := v.Args[1] 2528 x := v.Args[0] 2529 v.reset(OpRISCV64REMUW) 2530 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 2531 v0.AddArg(x) 2532 v.AddArg(v0) 2533 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32) 2534 v1.AddArg(y) 2535 v.AddArg(v1) 2536 return true 2537 } 2538 } 2539 func rewriteValueRISCV64_OpMod32_0(v *Value) bool { 2540 // match: (Mod32 x y) 2541 // result: (REMW x y) 2542 for { 2543 y := v.Args[1] 2544 x := v.Args[0] 2545 v.reset(OpRISCV64REMW) 2546 v.AddArg(x) 2547 v.AddArg(y) 2548 return true 2549 } 2550 } 2551 func rewriteValueRISCV64_OpMod32u_0(v *Value) bool { 2552 // match: (Mod32u x y) 2553 // result: (REMUW x y) 2554 for { 2555 y := v.Args[1] 2556 x := v.Args[0] 2557 v.reset(OpRISCV64REMUW) 2558 v.AddArg(x) 2559 v.AddArg(y) 2560 return true 2561 } 2562 } 2563 func rewriteValueRISCV64_OpMod64_0(v *Value) bool { 2564 // match: (Mod64 x y) 2565 // result: (REM x y) 2566 for { 2567 y := v.Args[1] 2568 x := v.Args[0] 2569 v.reset(OpRISCV64REM) 2570 v.AddArg(x) 2571 v.AddArg(y) 2572 return true 2573 } 2574 } 2575 func rewriteValueRISCV64_OpMod64u_0(v *Value) bool { 2576 // match: (Mod64u x y) 2577 // result: (REMU x y) 2578 for { 2579 y := v.Args[1] 2580 x := v.Args[0] 2581 v.reset(OpRISCV64REMU) 2582 v.AddArg(x) 2583 v.AddArg(y) 2584 return true 2585 } 2586 } 2587 func rewriteValueRISCV64_OpMod8_0(v *Value) bool { 2588 b := v.Block 2589 typ := &b.Func.Config.Types 2590 // match: (Mod8 x y) 2591 // result: (REMW (SignExt8to32 x) (SignExt8to32 y)) 2592 for { 2593 y := v.Args[1] 2594 x := v.Args[0] 2595 v.reset(OpRISCV64REMW) 2596 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 2597 v0.AddArg(x) 2598 v.AddArg(v0) 2599 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 2600 v1.AddArg(y) 2601 v.AddArg(v1) 2602 return true 2603 } 2604 } 2605 func rewriteValueRISCV64_OpMod8u_0(v *Value) bool { 2606 b := v.Block 2607 typ := &b.Func.Config.Types 2608 // match: (Mod8u x y) 2609 // result: (REMUW (ZeroExt8to32 x) (ZeroExt8to32 y)) 2610 for { 2611 y := v.Args[1] 2612 x := v.Args[0] 2613 v.reset(OpRISCV64REMUW) 2614 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 2615 v0.AddArg(x) 2616 v.AddArg(v0) 2617 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32) 2618 v1.AddArg(y) 2619 v.AddArg(v1) 2620 return true 2621 } 2622 } 2623 func rewriteValueRISCV64_OpMove_0(v *Value) bool { 2624 b := v.Block 2625 config := b.Func.Config 2626 typ := &b.Func.Config.Types 2627 // match: (Move [0] _ _ mem) 2628 // result: mem 2629 for { 2630 if v.AuxInt != 0 { 2631 break 2632 } 2633 mem := v.Args[2] 2634 v.reset(OpCopy) 2635 v.Type = mem.Type 2636 v.AddArg(mem) 2637 return true 2638 } 2639 // match: (Move [1] dst src mem) 2640 // result: (MOVBstore dst (MOVBload src mem) mem) 2641 for { 2642 if v.AuxInt != 1 { 2643 break 2644 } 2645 mem := v.Args[2] 2646 dst := v.Args[0] 2647 src := v.Args[1] 2648 v.reset(OpRISCV64MOVBstore) 2649 v.AddArg(dst) 2650 v0 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8) 2651 v0.AddArg(src) 2652 v0.AddArg(mem) 2653 v.AddArg(v0) 2654 v.AddArg(mem) 2655 return true 2656 } 2657 // match: (Move [2] dst src mem) 2658 // result: (MOVHstore dst (MOVHload src mem) mem) 2659 for { 2660 if v.AuxInt != 2 { 2661 break 2662 } 2663 mem := v.Args[2] 2664 dst := v.Args[0] 2665 src := v.Args[1] 2666 v.reset(OpRISCV64MOVHstore) 2667 v.AddArg(dst) 2668 v0 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16) 2669 v0.AddArg(src) 2670 v0.AddArg(mem) 2671 v.AddArg(v0) 2672 v.AddArg(mem) 2673 return true 2674 } 2675 // match: (Move [4] dst src mem) 2676 // result: (MOVWstore dst (MOVWload src mem) mem) 2677 for { 2678 if v.AuxInt != 4 { 2679 break 2680 } 2681 mem := v.Args[2] 2682 dst := v.Args[0] 2683 src := v.Args[1] 2684 v.reset(OpRISCV64MOVWstore) 2685 v.AddArg(dst) 2686 v0 := b.NewValue0(v.Pos, OpRISCV64MOVWload, typ.Int32) 2687 v0.AddArg(src) 2688 v0.AddArg(mem) 2689 v.AddArg(v0) 2690 v.AddArg(mem) 2691 return true 2692 } 2693 // match: (Move [8] dst src mem) 2694 // result: (MOVDstore dst (MOVDload src mem) mem) 2695 for { 2696 if v.AuxInt != 8 { 2697 break 2698 } 2699 mem := v.Args[2] 2700 dst := v.Args[0] 2701 src := v.Args[1] 2702 v.reset(OpRISCV64MOVDstore) 2703 v.AddArg(dst) 2704 v0 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64) 2705 v0.AddArg(src) 2706 v0.AddArg(mem) 2707 v.AddArg(v0) 2708 v.AddArg(mem) 2709 return true 2710 } 2711 // match: (Move [s] {t} dst src mem) 2712 // result: (LoweredMove [t.(*types.Type).Alignment()] dst src (ADDI <src.Type> [s-moveSize(t.(*types.Type).Alignment(), config)] src) mem) 2713 for { 2714 s := v.AuxInt 2715 t := v.Aux 2716 mem := v.Args[2] 2717 dst := v.Args[0] 2718 src := v.Args[1] 2719 v.reset(OpRISCV64LoweredMove) 2720 v.AuxInt = t.(*types.Type).Alignment() 2721 v.AddArg(dst) 2722 v.AddArg(src) 2723 v0 := b.NewValue0(v.Pos, OpRISCV64ADDI, src.Type) 2724 v0.AuxInt = s - moveSize(t.(*types.Type).Alignment(), config) 2725 v0.AddArg(src) 2726 v.AddArg(v0) 2727 v.AddArg(mem) 2728 return true 2729 } 2730 } 2731 func rewriteValueRISCV64_OpMul16_0(v *Value) bool { 2732 b := v.Block 2733 typ := &b.Func.Config.Types 2734 // match: (Mul16 x y) 2735 // result: (MULW (SignExt16to32 x) (SignExt16to32 y)) 2736 for { 2737 y := v.Args[1] 2738 x := v.Args[0] 2739 v.reset(OpRISCV64MULW) 2740 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 2741 v0.AddArg(x) 2742 v.AddArg(v0) 2743 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32) 2744 v1.AddArg(y) 2745 v.AddArg(v1) 2746 return true 2747 } 2748 } 2749 func rewriteValueRISCV64_OpMul32_0(v *Value) bool { 2750 // match: (Mul32 x y) 2751 // result: (MULW x y) 2752 for { 2753 y := v.Args[1] 2754 x := v.Args[0] 2755 v.reset(OpRISCV64MULW) 2756 v.AddArg(x) 2757 v.AddArg(y) 2758 return true 2759 } 2760 } 2761 func rewriteValueRISCV64_OpMul32F_0(v *Value) bool { 2762 // match: (Mul32F x y) 2763 // result: (FMULS x y) 2764 for { 2765 y := v.Args[1] 2766 x := v.Args[0] 2767 v.reset(OpRISCV64FMULS) 2768 v.AddArg(x) 2769 v.AddArg(y) 2770 return true 2771 } 2772 } 2773 func rewriteValueRISCV64_OpMul64_0(v *Value) bool { 2774 // match: (Mul64 x y) 2775 // result: (MUL x y) 2776 for { 2777 y := v.Args[1] 2778 x := v.Args[0] 2779 v.reset(OpRISCV64MUL) 2780 v.AddArg(x) 2781 v.AddArg(y) 2782 return true 2783 } 2784 } 2785 func rewriteValueRISCV64_OpMul64F_0(v *Value) bool { 2786 // match: (Mul64F x y) 2787 // result: (FMULD x y) 2788 for { 2789 y := v.Args[1] 2790 x := v.Args[0] 2791 v.reset(OpRISCV64FMULD) 2792 v.AddArg(x) 2793 v.AddArg(y) 2794 return true 2795 } 2796 } 2797 func rewriteValueRISCV64_OpMul8_0(v *Value) bool { 2798 b := v.Block 2799 typ := &b.Func.Config.Types 2800 // match: (Mul8 x y) 2801 // result: (MULW (SignExt8to32 x) (SignExt8to32 y)) 2802 for { 2803 y := v.Args[1] 2804 x := v.Args[0] 2805 v.reset(OpRISCV64MULW) 2806 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 2807 v0.AddArg(x) 2808 v.AddArg(v0) 2809 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32) 2810 v1.AddArg(y) 2811 v.AddArg(v1) 2812 return true 2813 } 2814 } 2815 func rewriteValueRISCV64_OpNeg16_0(v *Value) bool { 2816 b := v.Block 2817 typ := &b.Func.Config.Types 2818 // match: (Neg16 x) 2819 // result: (SUB (MOVHconst) x) 2820 for { 2821 x := v.Args[0] 2822 v.reset(OpRISCV64SUB) 2823 v0 := b.NewValue0(v.Pos, OpRISCV64MOVHconst, typ.UInt16) 2824 v.AddArg(v0) 2825 v.AddArg(x) 2826 return true 2827 } 2828 } 2829 func rewriteValueRISCV64_OpNeg32_0(v *Value) bool { 2830 b := v.Block 2831 typ := &b.Func.Config.Types 2832 // match: (Neg32 x) 2833 // result: (SUB (MOVWconst) x) 2834 for { 2835 x := v.Args[0] 2836 v.reset(OpRISCV64SUB) 2837 v0 := b.NewValue0(v.Pos, OpRISCV64MOVWconst, typ.UInt32) 2838 v.AddArg(v0) 2839 v.AddArg(x) 2840 return true 2841 } 2842 } 2843 func rewriteValueRISCV64_OpNeg32F_0(v *Value) bool { 2844 // match: (Neg32F x) 2845 // result: (FNEGS x) 2846 for { 2847 x := v.Args[0] 2848 v.reset(OpRISCV64FNEGS) 2849 v.AddArg(x) 2850 return true 2851 } 2852 } 2853 func rewriteValueRISCV64_OpNeg64_0(v *Value) bool { 2854 b := v.Block 2855 typ := &b.Func.Config.Types 2856 // match: (Neg64 x) 2857 // result: (SUB (MOVDconst) x) 2858 for { 2859 x := v.Args[0] 2860 v.reset(OpRISCV64SUB) 2861 v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 2862 v.AddArg(v0) 2863 v.AddArg(x) 2864 return true 2865 } 2866 } 2867 func rewriteValueRISCV64_OpNeg64F_0(v *Value) bool { 2868 // match: (Neg64F x) 2869 // result: (FNEGD x) 2870 for { 2871 x := v.Args[0] 2872 v.reset(OpRISCV64FNEGD) 2873 v.AddArg(x) 2874 return true 2875 } 2876 } 2877 func rewriteValueRISCV64_OpNeg8_0(v *Value) bool { 2878 b := v.Block 2879 typ := &b.Func.Config.Types 2880 // match: (Neg8 x) 2881 // result: (SUB (MOVBconst) x) 2882 for { 2883 x := v.Args[0] 2884 v.reset(OpRISCV64SUB) 2885 v0 := b.NewValue0(v.Pos, OpRISCV64MOVBconst, typ.UInt8) 2886 v.AddArg(v0) 2887 v.AddArg(x) 2888 return true 2889 } 2890 } 2891 func rewriteValueRISCV64_OpNeq16_0(v *Value) bool { 2892 b := v.Block 2893 typ := &b.Func.Config.Types 2894 // match: (Neq16 x y) 2895 // result: (SNEZ (ZeroExt16to64 (SUB <x.Type> x y))) 2896 for { 2897 y := v.Args[1] 2898 x := v.Args[0] 2899 v.reset(OpRISCV64SNEZ) 2900 v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 2901 v1 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 2902 v1.AddArg(x) 2903 v1.AddArg(y) 2904 v0.AddArg(v1) 2905 v.AddArg(v0) 2906 return true 2907 } 2908 } 2909 func rewriteValueRISCV64_OpNeq32_0(v *Value) bool { 2910 b := v.Block 2911 typ := &b.Func.Config.Types 2912 // match: (Neq32 x y) 2913 // result: (SNEZ (ZeroExt32to64 (SUB <x.Type> x y))) 2914 for { 2915 y := v.Args[1] 2916 x := v.Args[0] 2917 v.reset(OpRISCV64SNEZ) 2918 v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 2919 v1 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 2920 v1.AddArg(x) 2921 v1.AddArg(y) 2922 v0.AddArg(v1) 2923 v.AddArg(v0) 2924 return true 2925 } 2926 } 2927 func rewriteValueRISCV64_OpNeq32F_0(v *Value) bool { 2928 // match: (Neq32F x y) 2929 // result: (FNES x y) 2930 for { 2931 y := v.Args[1] 2932 x := v.Args[0] 2933 v.reset(OpRISCV64FNES) 2934 v.AddArg(x) 2935 v.AddArg(y) 2936 return true 2937 } 2938 } 2939 func rewriteValueRISCV64_OpNeq64_0(v *Value) bool { 2940 b := v.Block 2941 // match: (Neq64 x y) 2942 // result: (SNEZ (SUB <x.Type> x y)) 2943 for { 2944 y := v.Args[1] 2945 x := v.Args[0] 2946 v.reset(OpRISCV64SNEZ) 2947 v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 2948 v0.AddArg(x) 2949 v0.AddArg(y) 2950 v.AddArg(v0) 2951 return true 2952 } 2953 } 2954 func rewriteValueRISCV64_OpNeq64F_0(v *Value) bool { 2955 // match: (Neq64F x y) 2956 // result: (FNED x y) 2957 for { 2958 y := v.Args[1] 2959 x := v.Args[0] 2960 v.reset(OpRISCV64FNED) 2961 v.AddArg(x) 2962 v.AddArg(y) 2963 return true 2964 } 2965 } 2966 func rewriteValueRISCV64_OpNeq8_0(v *Value) bool { 2967 b := v.Block 2968 typ := &b.Func.Config.Types 2969 // match: (Neq8 x y) 2970 // result: (SNEZ (ZeroExt8to64 (SUB <x.Type> x y))) 2971 for { 2972 y := v.Args[1] 2973 x := v.Args[0] 2974 v.reset(OpRISCV64SNEZ) 2975 v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 2976 v1 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 2977 v1.AddArg(x) 2978 v1.AddArg(y) 2979 v0.AddArg(v1) 2980 v.AddArg(v0) 2981 return true 2982 } 2983 } 2984 func rewriteValueRISCV64_OpNeqB_0(v *Value) bool { 2985 // match: (NeqB x y) 2986 // result: (XOR x y) 2987 for { 2988 y := v.Args[1] 2989 x := v.Args[0] 2990 v.reset(OpRISCV64XOR) 2991 v.AddArg(x) 2992 v.AddArg(y) 2993 return true 2994 } 2995 } 2996 func rewriteValueRISCV64_OpNeqPtr_0(v *Value) bool { 2997 b := v.Block 2998 // match: (NeqPtr x y) 2999 // result: (SNEZ (SUB <x.Type> x y)) 3000 for { 3001 y := v.Args[1] 3002 x := v.Args[0] 3003 v.reset(OpRISCV64SNEZ) 3004 v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type) 3005 v0.AddArg(x) 3006 v0.AddArg(y) 3007 v.AddArg(v0) 3008 return true 3009 } 3010 } 3011 func rewriteValueRISCV64_OpNilCheck_0(v *Value) bool { 3012 // match: (NilCheck ptr mem) 3013 // result: (LoweredNilCheck ptr mem) 3014 for { 3015 mem := v.Args[1] 3016 ptr := v.Args[0] 3017 v.reset(OpRISCV64LoweredNilCheck) 3018 v.AddArg(ptr) 3019 v.AddArg(mem) 3020 return true 3021 } 3022 } 3023 func rewriteValueRISCV64_OpNot_0(v *Value) bool { 3024 // match: (Not x) 3025 // result: (XORI [1] x) 3026 for { 3027 x := v.Args[0] 3028 v.reset(OpRISCV64XORI) 3029 v.AuxInt = 1 3030 v.AddArg(x) 3031 return true 3032 } 3033 } 3034 func rewriteValueRISCV64_OpOffPtr_0(v *Value) bool { 3035 b := v.Block 3036 typ := &b.Func.Config.Types 3037 // match: (OffPtr [off] ptr:(SP)) 3038 // result: (MOVaddr [off] ptr) 3039 for { 3040 off := v.AuxInt 3041 ptr := v.Args[0] 3042 if ptr.Op != OpSP { 3043 break 3044 } 3045 v.reset(OpRISCV64MOVaddr) 3046 v.AuxInt = off 3047 v.AddArg(ptr) 3048 return true 3049 } 3050 // match: (OffPtr [off] ptr) 3051 // cond: is32Bit(off) 3052 // result: (ADDI [off] ptr) 3053 for { 3054 off := v.AuxInt 3055 ptr := v.Args[0] 3056 if !(is32Bit(off)) { 3057 break 3058 } 3059 v.reset(OpRISCV64ADDI) 3060 v.AuxInt = off 3061 v.AddArg(ptr) 3062 return true 3063 } 3064 // match: (OffPtr [off] ptr) 3065 // result: (ADD (MOVDconst [off]) ptr) 3066 for { 3067 off := v.AuxInt 3068 ptr := v.Args[0] 3069 v.reset(OpRISCV64ADD) 3070 v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 3071 v0.AuxInt = off 3072 v.AddArg(v0) 3073 v.AddArg(ptr) 3074 return true 3075 } 3076 } 3077 func rewriteValueRISCV64_OpOr16_0(v *Value) bool { 3078 // match: (Or16 x y) 3079 // result: (OR x y) 3080 for { 3081 y := v.Args[1] 3082 x := v.Args[0] 3083 v.reset(OpRISCV64OR) 3084 v.AddArg(x) 3085 v.AddArg(y) 3086 return true 3087 } 3088 } 3089 func rewriteValueRISCV64_OpOr32_0(v *Value) bool { 3090 // match: (Or32 x y) 3091 // result: (OR x y) 3092 for { 3093 y := v.Args[1] 3094 x := v.Args[0] 3095 v.reset(OpRISCV64OR) 3096 v.AddArg(x) 3097 v.AddArg(y) 3098 return true 3099 } 3100 } 3101 func rewriteValueRISCV64_OpOr64_0(v *Value) bool { 3102 // match: (Or64 x y) 3103 // result: (OR x y) 3104 for { 3105 y := v.Args[1] 3106 x := v.Args[0] 3107 v.reset(OpRISCV64OR) 3108 v.AddArg(x) 3109 v.AddArg(y) 3110 return true 3111 } 3112 } 3113 func rewriteValueRISCV64_OpOr8_0(v *Value) bool { 3114 // match: (Or8 x y) 3115 // result: (OR x y) 3116 for { 3117 y := v.Args[1] 3118 x := v.Args[0] 3119 v.reset(OpRISCV64OR) 3120 v.AddArg(x) 3121 v.AddArg(y) 3122 return true 3123 } 3124 } 3125 func rewriteValueRISCV64_OpOrB_0(v *Value) bool { 3126 // match: (OrB x y) 3127 // result: (OR x y) 3128 for { 3129 y := v.Args[1] 3130 x := v.Args[0] 3131 v.reset(OpRISCV64OR) 3132 v.AddArg(x) 3133 v.AddArg(y) 3134 return true 3135 } 3136 } 3137 func rewriteValueRISCV64_OpPanicBounds_0(v *Value) bool { 3138 // match: (PanicBounds [kind] x y mem) 3139 // cond: boundsABI(kind) == 0 3140 // result: (LoweredPanicBoundsA [kind] x y mem) 3141 for { 3142 kind := v.AuxInt 3143 mem := v.Args[2] 3144 x := v.Args[0] 3145 y := v.Args[1] 3146 if !(boundsABI(kind) == 0) { 3147 break 3148 } 3149 v.reset(OpRISCV64LoweredPanicBoundsA) 3150 v.AuxInt = kind 3151 v.AddArg(x) 3152 v.AddArg(y) 3153 v.AddArg(mem) 3154 return true 3155 } 3156 // match: (PanicBounds [kind] x y mem) 3157 // cond: boundsABI(kind) == 1 3158 // result: (LoweredPanicBoundsB [kind] x y mem) 3159 for { 3160 kind := v.AuxInt 3161 mem := v.Args[2] 3162 x := v.Args[0] 3163 y := v.Args[1] 3164 if !(boundsABI(kind) == 1) { 3165 break 3166 } 3167 v.reset(OpRISCV64LoweredPanicBoundsB) 3168 v.AuxInt = kind 3169 v.AddArg(x) 3170 v.AddArg(y) 3171 v.AddArg(mem) 3172 return true 3173 } 3174 // match: (PanicBounds [kind] x y mem) 3175 // cond: boundsABI(kind) == 2 3176 // result: (LoweredPanicBoundsC [kind] x y mem) 3177 for { 3178 kind := v.AuxInt 3179 mem := v.Args[2] 3180 x := v.Args[0] 3181 y := v.Args[1] 3182 if !(boundsABI(kind) == 2) { 3183 break 3184 } 3185 v.reset(OpRISCV64LoweredPanicBoundsC) 3186 v.AuxInt = kind 3187 v.AddArg(x) 3188 v.AddArg(y) 3189 v.AddArg(mem) 3190 return true 3191 } 3192 return false 3193 } 3194 func rewriteValueRISCV64_OpRISCV64ADD_0(v *Value) bool { 3195 // match: (ADD (MOVDconst [off]) ptr) 3196 // cond: is32Bit(off) 3197 // result: (ADDI [off] ptr) 3198 for { 3199 ptr := v.Args[1] 3200 v_0 := v.Args[0] 3201 if v_0.Op != OpRISCV64MOVDconst { 3202 break 3203 } 3204 off := v_0.AuxInt 3205 if !(is32Bit(off)) { 3206 break 3207 } 3208 v.reset(OpRISCV64ADDI) 3209 v.AuxInt = off 3210 v.AddArg(ptr) 3211 return true 3212 } 3213 // match: (ADD ptr (MOVDconst [off])) 3214 // cond: is32Bit(off) 3215 // result: (ADDI [off] ptr) 3216 for { 3217 _ = v.Args[1] 3218 ptr := v.Args[0] 3219 v_1 := v.Args[1] 3220 if v_1.Op != OpRISCV64MOVDconst { 3221 break 3222 } 3223 off := v_1.AuxInt 3224 if !(is32Bit(off)) { 3225 break 3226 } 3227 v.reset(OpRISCV64ADDI) 3228 v.AuxInt = off 3229 v.AddArg(ptr) 3230 return true 3231 } 3232 return false 3233 } 3234 func rewriteValueRISCV64_OpRISCV64ADDI_0(v *Value) bool { 3235 // match: (ADDI [c] (MOVaddr [d] {s} x)) 3236 // cond: is32Bit(c+d) 3237 // result: (MOVaddr [c+d] {s} x) 3238 for { 3239 c := v.AuxInt 3240 v_0 := v.Args[0] 3241 if v_0.Op != OpRISCV64MOVaddr { 3242 break 3243 } 3244 d := v_0.AuxInt 3245 s := v_0.Aux 3246 x := v_0.Args[0] 3247 if !(is32Bit(c + d)) { 3248 break 3249 } 3250 v.reset(OpRISCV64MOVaddr) 3251 v.AuxInt = c + d 3252 v.Aux = s 3253 v.AddArg(x) 3254 return true 3255 } 3256 // match: (ADDI [0] x) 3257 // result: x 3258 for { 3259 if v.AuxInt != 0 { 3260 break 3261 } 3262 x := v.Args[0] 3263 v.reset(OpCopy) 3264 v.Type = x.Type 3265 v.AddArg(x) 3266 return true 3267 } 3268 return false 3269 } 3270 func rewriteValueRISCV64_OpRISCV64MOVBUload_0(v *Value) bool { 3271 // match: (MOVBUload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem) 3272 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3273 // result: (MOVBUload [off1+off2] {mergeSym(sym1,sym2)} base mem) 3274 for { 3275 off1 := v.AuxInt 3276 sym1 := v.Aux 3277 mem := v.Args[1] 3278 v_0 := v.Args[0] 3279 if v_0.Op != OpRISCV64MOVaddr { 3280 break 3281 } 3282 off2 := v_0.AuxInt 3283 sym2 := v_0.Aux 3284 base := v_0.Args[0] 3285 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3286 break 3287 } 3288 v.reset(OpRISCV64MOVBUload) 3289 v.AuxInt = off1 + off2 3290 v.Aux = mergeSym(sym1, sym2) 3291 v.AddArg(base) 3292 v.AddArg(mem) 3293 return true 3294 } 3295 // match: (MOVBUload [off1] {sym} (ADDI [off2] base) mem) 3296 // cond: is32Bit(off1+off2) 3297 // result: (MOVBUload [off1+off2] {sym} base mem) 3298 for { 3299 off1 := v.AuxInt 3300 sym := v.Aux 3301 mem := v.Args[1] 3302 v_0 := v.Args[0] 3303 if v_0.Op != OpRISCV64ADDI { 3304 break 3305 } 3306 off2 := v_0.AuxInt 3307 base := v_0.Args[0] 3308 if !(is32Bit(off1 + off2)) { 3309 break 3310 } 3311 v.reset(OpRISCV64MOVBUload) 3312 v.AuxInt = off1 + off2 3313 v.Aux = sym 3314 v.AddArg(base) 3315 v.AddArg(mem) 3316 return true 3317 } 3318 return false 3319 } 3320 func rewriteValueRISCV64_OpRISCV64MOVBload_0(v *Value) bool { 3321 // match: (MOVBload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem) 3322 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3323 // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem) 3324 for { 3325 off1 := v.AuxInt 3326 sym1 := v.Aux 3327 mem := v.Args[1] 3328 v_0 := v.Args[0] 3329 if v_0.Op != OpRISCV64MOVaddr { 3330 break 3331 } 3332 off2 := v_0.AuxInt 3333 sym2 := v_0.Aux 3334 base := v_0.Args[0] 3335 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3336 break 3337 } 3338 v.reset(OpRISCV64MOVBload) 3339 v.AuxInt = off1 + off2 3340 v.Aux = mergeSym(sym1, sym2) 3341 v.AddArg(base) 3342 v.AddArg(mem) 3343 return true 3344 } 3345 // match: (MOVBload [off1] {sym} (ADDI [off2] base) mem) 3346 // cond: is32Bit(off1+off2) 3347 // result: (MOVBload [off1+off2] {sym} base mem) 3348 for { 3349 off1 := v.AuxInt 3350 sym := v.Aux 3351 mem := v.Args[1] 3352 v_0 := v.Args[0] 3353 if v_0.Op != OpRISCV64ADDI { 3354 break 3355 } 3356 off2 := v_0.AuxInt 3357 base := v_0.Args[0] 3358 if !(is32Bit(off1 + off2)) { 3359 break 3360 } 3361 v.reset(OpRISCV64MOVBload) 3362 v.AuxInt = off1 + off2 3363 v.Aux = sym 3364 v.AddArg(base) 3365 v.AddArg(mem) 3366 return true 3367 } 3368 return false 3369 } 3370 func rewriteValueRISCV64_OpRISCV64MOVBstore_0(v *Value) bool { 3371 // match: (MOVBstore [off1] {sym1} (MOVaddr [off2] {sym2} base) val mem) 3372 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3373 // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 3374 for { 3375 off1 := v.AuxInt 3376 sym1 := v.Aux 3377 mem := v.Args[2] 3378 v_0 := v.Args[0] 3379 if v_0.Op != OpRISCV64MOVaddr { 3380 break 3381 } 3382 off2 := v_0.AuxInt 3383 sym2 := v_0.Aux 3384 base := v_0.Args[0] 3385 val := v.Args[1] 3386 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3387 break 3388 } 3389 v.reset(OpRISCV64MOVBstore) 3390 v.AuxInt = off1 + off2 3391 v.Aux = mergeSym(sym1, sym2) 3392 v.AddArg(base) 3393 v.AddArg(val) 3394 v.AddArg(mem) 3395 return true 3396 } 3397 // match: (MOVBstore [off1] {sym} (ADDI [off2] base) val mem) 3398 // cond: is32Bit(off1+off2) 3399 // result: (MOVBstore [off1+off2] {sym} base val mem) 3400 for { 3401 off1 := v.AuxInt 3402 sym := v.Aux 3403 mem := v.Args[2] 3404 v_0 := v.Args[0] 3405 if v_0.Op != OpRISCV64ADDI { 3406 break 3407 } 3408 off2 := v_0.AuxInt 3409 base := v_0.Args[0] 3410 val := v.Args[1] 3411 if !(is32Bit(off1 + off2)) { 3412 break 3413 } 3414 v.reset(OpRISCV64MOVBstore) 3415 v.AuxInt = off1 + off2 3416 v.Aux = sym 3417 v.AddArg(base) 3418 v.AddArg(val) 3419 v.AddArg(mem) 3420 return true 3421 } 3422 return false 3423 } 3424 func rewriteValueRISCV64_OpRISCV64MOVDconst_0(v *Value) bool { 3425 b := v.Block 3426 typ := &b.Func.Config.Types 3427 // match: (MOVDconst <t> [c]) 3428 // cond: !is32Bit(c) && int32(c) < 0 3429 // result: (ADD (SLLI <t> [32] (MOVDconst [c>>32+1])) (MOVDconst [int64(int32(c))])) 3430 for { 3431 t := v.Type 3432 c := v.AuxInt 3433 if !(!is32Bit(c) && int32(c) < 0) { 3434 break 3435 } 3436 v.reset(OpRISCV64ADD) 3437 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 3438 v0.AuxInt = 32 3439 v1 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 3440 v1.AuxInt = c>>32 + 1 3441 v0.AddArg(v1) 3442 v.AddArg(v0) 3443 v2 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 3444 v2.AuxInt = int64(int32(c)) 3445 v.AddArg(v2) 3446 return true 3447 } 3448 // match: (MOVDconst <t> [c]) 3449 // cond: !is32Bit(c) && int32(c) >= 0 3450 // result: (ADD (SLLI <t> [32] (MOVDconst [c>>32+0])) (MOVDconst [int64(int32(c))])) 3451 for { 3452 t := v.Type 3453 c := v.AuxInt 3454 if !(!is32Bit(c) && int32(c) >= 0) { 3455 break 3456 } 3457 v.reset(OpRISCV64ADD) 3458 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 3459 v0.AuxInt = 32 3460 v1 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 3461 v1.AuxInt = c>>32 + 0 3462 v0.AddArg(v1) 3463 v.AddArg(v0) 3464 v2 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 3465 v2.AuxInt = int64(int32(c)) 3466 v.AddArg(v2) 3467 return true 3468 } 3469 return false 3470 } 3471 func rewriteValueRISCV64_OpRISCV64MOVDload_0(v *Value) bool { 3472 // match: (MOVDload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem) 3473 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3474 // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem) 3475 for { 3476 off1 := v.AuxInt 3477 sym1 := v.Aux 3478 mem := v.Args[1] 3479 v_0 := v.Args[0] 3480 if v_0.Op != OpRISCV64MOVaddr { 3481 break 3482 } 3483 off2 := v_0.AuxInt 3484 sym2 := v_0.Aux 3485 base := v_0.Args[0] 3486 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3487 break 3488 } 3489 v.reset(OpRISCV64MOVDload) 3490 v.AuxInt = off1 + off2 3491 v.Aux = mergeSym(sym1, sym2) 3492 v.AddArg(base) 3493 v.AddArg(mem) 3494 return true 3495 } 3496 // match: (MOVDload [off1] {sym} (ADDI [off2] base) mem) 3497 // cond: is32Bit(off1+off2) 3498 // result: (MOVDload [off1+off2] {sym} base mem) 3499 for { 3500 off1 := v.AuxInt 3501 sym := v.Aux 3502 mem := v.Args[1] 3503 v_0 := v.Args[0] 3504 if v_0.Op != OpRISCV64ADDI { 3505 break 3506 } 3507 off2 := v_0.AuxInt 3508 base := v_0.Args[0] 3509 if !(is32Bit(off1 + off2)) { 3510 break 3511 } 3512 v.reset(OpRISCV64MOVDload) 3513 v.AuxInt = off1 + off2 3514 v.Aux = sym 3515 v.AddArg(base) 3516 v.AddArg(mem) 3517 return true 3518 } 3519 return false 3520 } 3521 func rewriteValueRISCV64_OpRISCV64MOVDstore_0(v *Value) bool { 3522 // match: (MOVDstore [off1] {sym1} (MOVaddr [off2] {sym2} base) val mem) 3523 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3524 // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 3525 for { 3526 off1 := v.AuxInt 3527 sym1 := v.Aux 3528 mem := v.Args[2] 3529 v_0 := v.Args[0] 3530 if v_0.Op != OpRISCV64MOVaddr { 3531 break 3532 } 3533 off2 := v_0.AuxInt 3534 sym2 := v_0.Aux 3535 base := v_0.Args[0] 3536 val := v.Args[1] 3537 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3538 break 3539 } 3540 v.reset(OpRISCV64MOVDstore) 3541 v.AuxInt = off1 + off2 3542 v.Aux = mergeSym(sym1, sym2) 3543 v.AddArg(base) 3544 v.AddArg(val) 3545 v.AddArg(mem) 3546 return true 3547 } 3548 // match: (MOVDstore [off1] {sym} (ADDI [off2] base) val mem) 3549 // cond: is32Bit(off1+off2) 3550 // result: (MOVDstore [off1+off2] {sym} base val mem) 3551 for { 3552 off1 := v.AuxInt 3553 sym := v.Aux 3554 mem := v.Args[2] 3555 v_0 := v.Args[0] 3556 if v_0.Op != OpRISCV64ADDI { 3557 break 3558 } 3559 off2 := v_0.AuxInt 3560 base := v_0.Args[0] 3561 val := v.Args[1] 3562 if !(is32Bit(off1 + off2)) { 3563 break 3564 } 3565 v.reset(OpRISCV64MOVDstore) 3566 v.AuxInt = off1 + off2 3567 v.Aux = sym 3568 v.AddArg(base) 3569 v.AddArg(val) 3570 v.AddArg(mem) 3571 return true 3572 } 3573 return false 3574 } 3575 func rewriteValueRISCV64_OpRISCV64MOVHUload_0(v *Value) bool { 3576 // match: (MOVHUload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem) 3577 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3578 // result: (MOVHUload [off1+off2] {mergeSym(sym1,sym2)} base mem) 3579 for { 3580 off1 := v.AuxInt 3581 sym1 := v.Aux 3582 mem := v.Args[1] 3583 v_0 := v.Args[0] 3584 if v_0.Op != OpRISCV64MOVaddr { 3585 break 3586 } 3587 off2 := v_0.AuxInt 3588 sym2 := v_0.Aux 3589 base := v_0.Args[0] 3590 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3591 break 3592 } 3593 v.reset(OpRISCV64MOVHUload) 3594 v.AuxInt = off1 + off2 3595 v.Aux = mergeSym(sym1, sym2) 3596 v.AddArg(base) 3597 v.AddArg(mem) 3598 return true 3599 } 3600 // match: (MOVHUload [off1] {sym} (ADDI [off2] base) mem) 3601 // cond: is32Bit(off1+off2) 3602 // result: (MOVHUload [off1+off2] {sym} base mem) 3603 for { 3604 off1 := v.AuxInt 3605 sym := v.Aux 3606 mem := v.Args[1] 3607 v_0 := v.Args[0] 3608 if v_0.Op != OpRISCV64ADDI { 3609 break 3610 } 3611 off2 := v_0.AuxInt 3612 base := v_0.Args[0] 3613 if !(is32Bit(off1 + off2)) { 3614 break 3615 } 3616 v.reset(OpRISCV64MOVHUload) 3617 v.AuxInt = off1 + off2 3618 v.Aux = sym 3619 v.AddArg(base) 3620 v.AddArg(mem) 3621 return true 3622 } 3623 return false 3624 } 3625 func rewriteValueRISCV64_OpRISCV64MOVHload_0(v *Value) bool { 3626 // match: (MOVHload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem) 3627 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3628 // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} base mem) 3629 for { 3630 off1 := v.AuxInt 3631 sym1 := v.Aux 3632 mem := v.Args[1] 3633 v_0 := v.Args[0] 3634 if v_0.Op != OpRISCV64MOVaddr { 3635 break 3636 } 3637 off2 := v_0.AuxInt 3638 sym2 := v_0.Aux 3639 base := v_0.Args[0] 3640 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3641 break 3642 } 3643 v.reset(OpRISCV64MOVHload) 3644 v.AuxInt = off1 + off2 3645 v.Aux = mergeSym(sym1, sym2) 3646 v.AddArg(base) 3647 v.AddArg(mem) 3648 return true 3649 } 3650 // match: (MOVHload [off1] {sym} (ADDI [off2] base) mem) 3651 // cond: is32Bit(off1+off2) 3652 // result: (MOVHload [off1+off2] {sym} base mem) 3653 for { 3654 off1 := v.AuxInt 3655 sym := v.Aux 3656 mem := v.Args[1] 3657 v_0 := v.Args[0] 3658 if v_0.Op != OpRISCV64ADDI { 3659 break 3660 } 3661 off2 := v_0.AuxInt 3662 base := v_0.Args[0] 3663 if !(is32Bit(off1 + off2)) { 3664 break 3665 } 3666 v.reset(OpRISCV64MOVHload) 3667 v.AuxInt = off1 + off2 3668 v.Aux = sym 3669 v.AddArg(base) 3670 v.AddArg(mem) 3671 return true 3672 } 3673 return false 3674 } 3675 func rewriteValueRISCV64_OpRISCV64MOVHstore_0(v *Value) bool { 3676 // match: (MOVHstore [off1] {sym1} (MOVaddr [off2] {sym2} base) val mem) 3677 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3678 // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 3679 for { 3680 off1 := v.AuxInt 3681 sym1 := v.Aux 3682 mem := v.Args[2] 3683 v_0 := v.Args[0] 3684 if v_0.Op != OpRISCV64MOVaddr { 3685 break 3686 } 3687 off2 := v_0.AuxInt 3688 sym2 := v_0.Aux 3689 base := v_0.Args[0] 3690 val := v.Args[1] 3691 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3692 break 3693 } 3694 v.reset(OpRISCV64MOVHstore) 3695 v.AuxInt = off1 + off2 3696 v.Aux = mergeSym(sym1, sym2) 3697 v.AddArg(base) 3698 v.AddArg(val) 3699 v.AddArg(mem) 3700 return true 3701 } 3702 // match: (MOVHstore [off1] {sym} (ADDI [off2] base) val mem) 3703 // cond: is32Bit(off1+off2) 3704 // result: (MOVHstore [off1+off2] {sym} base val mem) 3705 for { 3706 off1 := v.AuxInt 3707 sym := v.Aux 3708 mem := v.Args[2] 3709 v_0 := v.Args[0] 3710 if v_0.Op != OpRISCV64ADDI { 3711 break 3712 } 3713 off2 := v_0.AuxInt 3714 base := v_0.Args[0] 3715 val := v.Args[1] 3716 if !(is32Bit(off1 + off2)) { 3717 break 3718 } 3719 v.reset(OpRISCV64MOVHstore) 3720 v.AuxInt = off1 + off2 3721 v.Aux = sym 3722 v.AddArg(base) 3723 v.AddArg(val) 3724 v.AddArg(mem) 3725 return true 3726 } 3727 return false 3728 } 3729 func rewriteValueRISCV64_OpRISCV64MOVWUload_0(v *Value) bool { 3730 // match: (MOVWUload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem) 3731 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3732 // result: (MOVWUload [off1+off2] {mergeSym(sym1,sym2)} base mem) 3733 for { 3734 off1 := v.AuxInt 3735 sym1 := v.Aux 3736 mem := v.Args[1] 3737 v_0 := v.Args[0] 3738 if v_0.Op != OpRISCV64MOVaddr { 3739 break 3740 } 3741 off2 := v_0.AuxInt 3742 sym2 := v_0.Aux 3743 base := v_0.Args[0] 3744 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3745 break 3746 } 3747 v.reset(OpRISCV64MOVWUload) 3748 v.AuxInt = off1 + off2 3749 v.Aux = mergeSym(sym1, sym2) 3750 v.AddArg(base) 3751 v.AddArg(mem) 3752 return true 3753 } 3754 // match: (MOVWUload [off1] {sym} (ADDI [off2] base) mem) 3755 // cond: is32Bit(off1+off2) 3756 // result: (MOVWUload [off1+off2] {sym} base mem) 3757 for { 3758 off1 := v.AuxInt 3759 sym := v.Aux 3760 mem := v.Args[1] 3761 v_0 := v.Args[0] 3762 if v_0.Op != OpRISCV64ADDI { 3763 break 3764 } 3765 off2 := v_0.AuxInt 3766 base := v_0.Args[0] 3767 if !(is32Bit(off1 + off2)) { 3768 break 3769 } 3770 v.reset(OpRISCV64MOVWUload) 3771 v.AuxInt = off1 + off2 3772 v.Aux = sym 3773 v.AddArg(base) 3774 v.AddArg(mem) 3775 return true 3776 } 3777 return false 3778 } 3779 func rewriteValueRISCV64_OpRISCV64MOVWload_0(v *Value) bool { 3780 // match: (MOVWload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem) 3781 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3782 // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem) 3783 for { 3784 off1 := v.AuxInt 3785 sym1 := v.Aux 3786 mem := v.Args[1] 3787 v_0 := v.Args[0] 3788 if v_0.Op != OpRISCV64MOVaddr { 3789 break 3790 } 3791 off2 := v_0.AuxInt 3792 sym2 := v_0.Aux 3793 base := v_0.Args[0] 3794 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3795 break 3796 } 3797 v.reset(OpRISCV64MOVWload) 3798 v.AuxInt = off1 + off2 3799 v.Aux = mergeSym(sym1, sym2) 3800 v.AddArg(base) 3801 v.AddArg(mem) 3802 return true 3803 } 3804 // match: (MOVWload [off1] {sym} (ADDI [off2] base) mem) 3805 // cond: is32Bit(off1+off2) 3806 // result: (MOVWload [off1+off2] {sym} base mem) 3807 for { 3808 off1 := v.AuxInt 3809 sym := v.Aux 3810 mem := v.Args[1] 3811 v_0 := v.Args[0] 3812 if v_0.Op != OpRISCV64ADDI { 3813 break 3814 } 3815 off2 := v_0.AuxInt 3816 base := v_0.Args[0] 3817 if !(is32Bit(off1 + off2)) { 3818 break 3819 } 3820 v.reset(OpRISCV64MOVWload) 3821 v.AuxInt = off1 + off2 3822 v.Aux = sym 3823 v.AddArg(base) 3824 v.AddArg(mem) 3825 return true 3826 } 3827 return false 3828 } 3829 func rewriteValueRISCV64_OpRISCV64MOVWstore_0(v *Value) bool { 3830 // match: (MOVWstore [off1] {sym1} (MOVaddr [off2] {sym2} base) val mem) 3831 // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) 3832 // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 3833 for { 3834 off1 := v.AuxInt 3835 sym1 := v.Aux 3836 mem := v.Args[2] 3837 v_0 := v.Args[0] 3838 if v_0.Op != OpRISCV64MOVaddr { 3839 break 3840 } 3841 off2 := v_0.AuxInt 3842 sym2 := v_0.Aux 3843 base := v_0.Args[0] 3844 val := v.Args[1] 3845 if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { 3846 break 3847 } 3848 v.reset(OpRISCV64MOVWstore) 3849 v.AuxInt = off1 + off2 3850 v.Aux = mergeSym(sym1, sym2) 3851 v.AddArg(base) 3852 v.AddArg(val) 3853 v.AddArg(mem) 3854 return true 3855 } 3856 // match: (MOVWstore [off1] {sym} (ADDI [off2] base) val mem) 3857 // cond: is32Bit(off1+off2) 3858 // result: (MOVWstore [off1+off2] {sym} base val mem) 3859 for { 3860 off1 := v.AuxInt 3861 sym := v.Aux 3862 mem := v.Args[2] 3863 v_0 := v.Args[0] 3864 if v_0.Op != OpRISCV64ADDI { 3865 break 3866 } 3867 off2 := v_0.AuxInt 3868 base := v_0.Args[0] 3869 val := v.Args[1] 3870 if !(is32Bit(off1 + off2)) { 3871 break 3872 } 3873 v.reset(OpRISCV64MOVWstore) 3874 v.AuxInt = off1 + off2 3875 v.Aux = sym 3876 v.AddArg(base) 3877 v.AddArg(val) 3878 v.AddArg(mem) 3879 return true 3880 } 3881 return false 3882 } 3883 func rewriteValueRISCV64_OpRotateLeft16_0(v *Value) bool { 3884 b := v.Block 3885 typ := &b.Func.Config.Types 3886 // match: (RotateLeft16 <t> x (MOVHconst [c])) 3887 // result: (Or16 (Lsh16x64 <t> x (MOVHconst [c&15])) (Rsh16Ux64 <t> x (MOVHconst [-c&15]))) 3888 for { 3889 t := v.Type 3890 _ = v.Args[1] 3891 x := v.Args[0] 3892 v_1 := v.Args[1] 3893 if v_1.Op != OpRISCV64MOVHconst { 3894 break 3895 } 3896 c := v_1.AuxInt 3897 v.reset(OpOr16) 3898 v0 := b.NewValue0(v.Pos, OpLsh16x64, t) 3899 v0.AddArg(x) 3900 v1 := b.NewValue0(v.Pos, OpRISCV64MOVHconst, typ.UInt16) 3901 v1.AuxInt = c & 15 3902 v0.AddArg(v1) 3903 v.AddArg(v0) 3904 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t) 3905 v2.AddArg(x) 3906 v3 := b.NewValue0(v.Pos, OpRISCV64MOVHconst, typ.UInt16) 3907 v3.AuxInt = -c & 15 3908 v2.AddArg(v3) 3909 v.AddArg(v2) 3910 return true 3911 } 3912 return false 3913 } 3914 func rewriteValueRISCV64_OpRotateLeft32_0(v *Value) bool { 3915 b := v.Block 3916 typ := &b.Func.Config.Types 3917 // match: (RotateLeft32 <t> x (MOVWconst [c])) 3918 // result: (Or32 (Lsh32x64 <t> x (MOVWconst [c&31])) (Rsh32Ux64 <t> x (MOVWconst [-c&31]))) 3919 for { 3920 t := v.Type 3921 _ = v.Args[1] 3922 x := v.Args[0] 3923 v_1 := v.Args[1] 3924 if v_1.Op != OpRISCV64MOVWconst { 3925 break 3926 } 3927 c := v_1.AuxInt 3928 v.reset(OpOr32) 3929 v0 := b.NewValue0(v.Pos, OpLsh32x64, t) 3930 v0.AddArg(x) 3931 v1 := b.NewValue0(v.Pos, OpRISCV64MOVWconst, typ.UInt32) 3932 v1.AuxInt = c & 31 3933 v0.AddArg(v1) 3934 v.AddArg(v0) 3935 v2 := b.NewValue0(v.Pos, OpRsh32Ux64, t) 3936 v2.AddArg(x) 3937 v3 := b.NewValue0(v.Pos, OpRISCV64MOVWconst, typ.UInt32) 3938 v3.AuxInt = -c & 31 3939 v2.AddArg(v3) 3940 v.AddArg(v2) 3941 return true 3942 } 3943 return false 3944 } 3945 func rewriteValueRISCV64_OpRotateLeft64_0(v *Value) bool { 3946 b := v.Block 3947 typ := &b.Func.Config.Types 3948 // match: (RotateLeft64 <t> x (MOVDconst [c])) 3949 // result: (Or64 (Lsh64x64 <t> x (MOVDconst [c&63])) (Rsh64Ux64 <t> x (MOVDconst [-c&63]))) 3950 for { 3951 t := v.Type 3952 _ = v.Args[1] 3953 x := v.Args[0] 3954 v_1 := v.Args[1] 3955 if v_1.Op != OpRISCV64MOVDconst { 3956 break 3957 } 3958 c := v_1.AuxInt 3959 v.reset(OpOr64) 3960 v0 := b.NewValue0(v.Pos, OpLsh64x64, t) 3961 v0.AddArg(x) 3962 v1 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 3963 v1.AuxInt = c & 63 3964 v0.AddArg(v1) 3965 v.AddArg(v0) 3966 v2 := b.NewValue0(v.Pos, OpRsh64Ux64, t) 3967 v2.AddArg(x) 3968 v3 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 3969 v3.AuxInt = -c & 63 3970 v2.AddArg(v3) 3971 v.AddArg(v2) 3972 return true 3973 } 3974 return false 3975 } 3976 func rewriteValueRISCV64_OpRotateLeft8_0(v *Value) bool { 3977 b := v.Block 3978 typ := &b.Func.Config.Types 3979 // match: (RotateLeft8 <t> x (MOVBconst [c])) 3980 // result: (Or8 (Lsh8x64 <t> x (MOVBconst [c&7])) (Rsh8Ux64 <t> x (MOVBconst [-c&7]))) 3981 for { 3982 t := v.Type 3983 _ = v.Args[1] 3984 x := v.Args[0] 3985 v_1 := v.Args[1] 3986 if v_1.Op != OpRISCV64MOVBconst { 3987 break 3988 } 3989 c := v_1.AuxInt 3990 v.reset(OpOr8) 3991 v0 := b.NewValue0(v.Pos, OpLsh8x64, t) 3992 v0.AddArg(x) 3993 v1 := b.NewValue0(v.Pos, OpRISCV64MOVBconst, typ.UInt8) 3994 v1.AuxInt = c & 7 3995 v0.AddArg(v1) 3996 v.AddArg(v0) 3997 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t) 3998 v2.AddArg(x) 3999 v3 := b.NewValue0(v.Pos, OpRISCV64MOVBconst, typ.UInt8) 4000 v3.AuxInt = -c & 7 4001 v2.AddArg(v3) 4002 v.AddArg(v2) 4003 return true 4004 } 4005 return false 4006 } 4007 func rewriteValueRISCV64_OpRound32F_0(v *Value) bool { 4008 // match: (Round32F x) 4009 // result: x 4010 for { 4011 x := v.Args[0] 4012 v.reset(OpCopy) 4013 v.Type = x.Type 4014 v.AddArg(x) 4015 return true 4016 } 4017 } 4018 func rewriteValueRISCV64_OpRound64F_0(v *Value) bool { 4019 // match: (Round64F x) 4020 // result: x 4021 for { 4022 x := v.Args[0] 4023 v.reset(OpCopy) 4024 v.Type = x.Type 4025 v.AddArg(x) 4026 return true 4027 } 4028 } 4029 func rewriteValueRISCV64_OpRsh16Ux16_0(v *Value) bool { 4030 b := v.Block 4031 typ := &b.Func.Config.Types 4032 // match: (Rsh16Ux16 <t> x y) 4033 // result: (AND (SRL <t> (ZeroExt16to64 x) y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt16to64 y)))) 4034 for { 4035 t := v.Type 4036 y := v.Args[1] 4037 x := v.Args[0] 4038 v.reset(OpRISCV64AND) 4039 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4040 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4041 v1.AddArg(x) 4042 v0.AddArg(v1) 4043 v0.AddArg(y) 4044 v.AddArg(v0) 4045 v2 := b.NewValue0(v.Pos, OpNeg16, t) 4046 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4047 v3.AuxInt = 64 4048 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4049 v4.AddArg(y) 4050 v3.AddArg(v4) 4051 v2.AddArg(v3) 4052 v.AddArg(v2) 4053 return true 4054 } 4055 } 4056 func rewriteValueRISCV64_OpRsh16Ux32_0(v *Value) bool { 4057 b := v.Block 4058 typ := &b.Func.Config.Types 4059 // match: (Rsh16Ux32 <t> x y) 4060 // result: (AND (SRL <t> (ZeroExt16to64 x) y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt32to64 y)))) 4061 for { 4062 t := v.Type 4063 y := v.Args[1] 4064 x := v.Args[0] 4065 v.reset(OpRISCV64AND) 4066 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4067 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4068 v1.AddArg(x) 4069 v0.AddArg(v1) 4070 v0.AddArg(y) 4071 v.AddArg(v0) 4072 v2 := b.NewValue0(v.Pos, OpNeg16, t) 4073 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4074 v3.AuxInt = 64 4075 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4076 v4.AddArg(y) 4077 v3.AddArg(v4) 4078 v2.AddArg(v3) 4079 v.AddArg(v2) 4080 return true 4081 } 4082 } 4083 func rewriteValueRISCV64_OpRsh16Ux64_0(v *Value) bool { 4084 b := v.Block 4085 typ := &b.Func.Config.Types 4086 // match: (Rsh16Ux64 <t> x y) 4087 // result: (AND (SRL <t> (ZeroExt16to64 x) y) (Neg16 <t> (SLTIU <t> [64] y))) 4088 for { 4089 t := v.Type 4090 y := v.Args[1] 4091 x := v.Args[0] 4092 v.reset(OpRISCV64AND) 4093 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4094 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4095 v1.AddArg(x) 4096 v0.AddArg(v1) 4097 v0.AddArg(y) 4098 v.AddArg(v0) 4099 v2 := b.NewValue0(v.Pos, OpNeg16, t) 4100 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4101 v3.AuxInt = 64 4102 v3.AddArg(y) 4103 v2.AddArg(v3) 4104 v.AddArg(v2) 4105 return true 4106 } 4107 } 4108 func rewriteValueRISCV64_OpRsh16Ux8_0(v *Value) bool { 4109 b := v.Block 4110 typ := &b.Func.Config.Types 4111 // match: (Rsh16Ux8 <t> x y) 4112 // result: (AND (SRL <t> (ZeroExt16to64 x) y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt8to64 y)))) 4113 for { 4114 t := v.Type 4115 y := v.Args[1] 4116 x := v.Args[0] 4117 v.reset(OpRISCV64AND) 4118 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4119 v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4120 v1.AddArg(x) 4121 v0.AddArg(v1) 4122 v0.AddArg(y) 4123 v.AddArg(v0) 4124 v2 := b.NewValue0(v.Pos, OpNeg16, t) 4125 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4126 v3.AuxInt = 64 4127 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4128 v4.AddArg(y) 4129 v3.AddArg(v4) 4130 v2.AddArg(v3) 4131 v.AddArg(v2) 4132 return true 4133 } 4134 } 4135 func rewriteValueRISCV64_OpRsh16x16_0(v *Value) bool { 4136 b := v.Block 4137 typ := &b.Func.Config.Types 4138 // match: (Rsh16x16 <t> x y) 4139 // result: (SRA <t> (SignExt16to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt16to64 y))))) 4140 for { 4141 t := v.Type 4142 y := v.Args[1] 4143 x := v.Args[0] 4144 v.reset(OpRISCV64SRA) 4145 v.Type = t 4146 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 4147 v0.AddArg(x) 4148 v.AddArg(v0) 4149 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4150 v1.AddArg(y) 4151 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4152 v2.AuxInt = -1 4153 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4154 v3.AuxInt = 64 4155 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4156 v4.AddArg(y) 4157 v3.AddArg(v4) 4158 v2.AddArg(v3) 4159 v1.AddArg(v2) 4160 v.AddArg(v1) 4161 return true 4162 } 4163 } 4164 func rewriteValueRISCV64_OpRsh16x32_0(v *Value) bool { 4165 b := v.Block 4166 typ := &b.Func.Config.Types 4167 // match: (Rsh16x32 <t> x y) 4168 // result: (SRA <t> (SignExt16to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt32to64 y))))) 4169 for { 4170 t := v.Type 4171 y := v.Args[1] 4172 x := v.Args[0] 4173 v.reset(OpRISCV64SRA) 4174 v.Type = t 4175 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 4176 v0.AddArg(x) 4177 v.AddArg(v0) 4178 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4179 v1.AddArg(y) 4180 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4181 v2.AuxInt = -1 4182 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4183 v3.AuxInt = 64 4184 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4185 v4.AddArg(y) 4186 v3.AddArg(v4) 4187 v2.AddArg(v3) 4188 v1.AddArg(v2) 4189 v.AddArg(v1) 4190 return true 4191 } 4192 } 4193 func rewriteValueRISCV64_OpRsh16x64_0(v *Value) bool { 4194 b := v.Block 4195 typ := &b.Func.Config.Types 4196 // match: (Rsh16x64 <t> x y) 4197 // result: (SRA <t> (SignExt16to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] y)))) 4198 for { 4199 t := v.Type 4200 y := v.Args[1] 4201 x := v.Args[0] 4202 v.reset(OpRISCV64SRA) 4203 v.Type = t 4204 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 4205 v0.AddArg(x) 4206 v.AddArg(v0) 4207 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4208 v1.AddArg(y) 4209 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4210 v2.AuxInt = -1 4211 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4212 v3.AuxInt = 64 4213 v3.AddArg(y) 4214 v2.AddArg(v3) 4215 v1.AddArg(v2) 4216 v.AddArg(v1) 4217 return true 4218 } 4219 } 4220 func rewriteValueRISCV64_OpRsh16x8_0(v *Value) bool { 4221 b := v.Block 4222 typ := &b.Func.Config.Types 4223 // match: (Rsh16x8 <t> x y) 4224 // result: (SRA <t> (SignExt16to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt8to64 y))))) 4225 for { 4226 t := v.Type 4227 y := v.Args[1] 4228 x := v.Args[0] 4229 v.reset(OpRISCV64SRA) 4230 v.Type = t 4231 v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64) 4232 v0.AddArg(x) 4233 v.AddArg(v0) 4234 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4235 v1.AddArg(y) 4236 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4237 v2.AuxInt = -1 4238 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4239 v3.AuxInt = 64 4240 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4241 v4.AddArg(y) 4242 v3.AddArg(v4) 4243 v2.AddArg(v3) 4244 v1.AddArg(v2) 4245 v.AddArg(v1) 4246 return true 4247 } 4248 } 4249 func rewriteValueRISCV64_OpRsh32Ux16_0(v *Value) bool { 4250 b := v.Block 4251 typ := &b.Func.Config.Types 4252 // match: (Rsh32Ux16 <t> x y) 4253 // result: (AND (SRL <t> (ZeroExt32to64 x) y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt16to64 y)))) 4254 for { 4255 t := v.Type 4256 y := v.Args[1] 4257 x := v.Args[0] 4258 v.reset(OpRISCV64AND) 4259 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4260 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4261 v1.AddArg(x) 4262 v0.AddArg(v1) 4263 v0.AddArg(y) 4264 v.AddArg(v0) 4265 v2 := b.NewValue0(v.Pos, OpNeg32, t) 4266 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4267 v3.AuxInt = 64 4268 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4269 v4.AddArg(y) 4270 v3.AddArg(v4) 4271 v2.AddArg(v3) 4272 v.AddArg(v2) 4273 return true 4274 } 4275 } 4276 func rewriteValueRISCV64_OpRsh32Ux32_0(v *Value) bool { 4277 b := v.Block 4278 typ := &b.Func.Config.Types 4279 // match: (Rsh32Ux32 <t> x y) 4280 // result: (AND (SRL <t> (ZeroExt32to64 x) y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt32to64 y)))) 4281 for { 4282 t := v.Type 4283 y := v.Args[1] 4284 x := v.Args[0] 4285 v.reset(OpRISCV64AND) 4286 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4287 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4288 v1.AddArg(x) 4289 v0.AddArg(v1) 4290 v0.AddArg(y) 4291 v.AddArg(v0) 4292 v2 := b.NewValue0(v.Pos, OpNeg32, t) 4293 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4294 v3.AuxInt = 64 4295 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4296 v4.AddArg(y) 4297 v3.AddArg(v4) 4298 v2.AddArg(v3) 4299 v.AddArg(v2) 4300 return true 4301 } 4302 } 4303 func rewriteValueRISCV64_OpRsh32Ux64_0(v *Value) bool { 4304 b := v.Block 4305 typ := &b.Func.Config.Types 4306 // match: (Rsh32Ux64 <t> x y) 4307 // result: (AND (SRL <t> (ZeroExt32to64 x) y) (Neg32 <t> (SLTIU <t> [64] y))) 4308 for { 4309 t := v.Type 4310 y := v.Args[1] 4311 x := v.Args[0] 4312 v.reset(OpRISCV64AND) 4313 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4314 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4315 v1.AddArg(x) 4316 v0.AddArg(v1) 4317 v0.AddArg(y) 4318 v.AddArg(v0) 4319 v2 := b.NewValue0(v.Pos, OpNeg32, t) 4320 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4321 v3.AuxInt = 64 4322 v3.AddArg(y) 4323 v2.AddArg(v3) 4324 v.AddArg(v2) 4325 return true 4326 } 4327 } 4328 func rewriteValueRISCV64_OpRsh32Ux8_0(v *Value) bool { 4329 b := v.Block 4330 typ := &b.Func.Config.Types 4331 // match: (Rsh32Ux8 <t> x y) 4332 // result: (AND (SRL <t> (ZeroExt32to64 x) y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt8to64 y)))) 4333 for { 4334 t := v.Type 4335 y := v.Args[1] 4336 x := v.Args[0] 4337 v.reset(OpRISCV64AND) 4338 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4339 v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4340 v1.AddArg(x) 4341 v0.AddArg(v1) 4342 v0.AddArg(y) 4343 v.AddArg(v0) 4344 v2 := b.NewValue0(v.Pos, OpNeg32, t) 4345 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4346 v3.AuxInt = 64 4347 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4348 v4.AddArg(y) 4349 v3.AddArg(v4) 4350 v2.AddArg(v3) 4351 v.AddArg(v2) 4352 return true 4353 } 4354 } 4355 func rewriteValueRISCV64_OpRsh32x16_0(v *Value) bool { 4356 b := v.Block 4357 typ := &b.Func.Config.Types 4358 // match: (Rsh32x16 <t> x y) 4359 // result: (SRA <t> (SignExt32to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt16to64 y))))) 4360 for { 4361 t := v.Type 4362 y := v.Args[1] 4363 x := v.Args[0] 4364 v.reset(OpRISCV64SRA) 4365 v.Type = t 4366 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 4367 v0.AddArg(x) 4368 v.AddArg(v0) 4369 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4370 v1.AddArg(y) 4371 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4372 v2.AuxInt = -1 4373 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4374 v3.AuxInt = 64 4375 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4376 v4.AddArg(y) 4377 v3.AddArg(v4) 4378 v2.AddArg(v3) 4379 v1.AddArg(v2) 4380 v.AddArg(v1) 4381 return true 4382 } 4383 } 4384 func rewriteValueRISCV64_OpRsh32x32_0(v *Value) bool { 4385 b := v.Block 4386 typ := &b.Func.Config.Types 4387 // match: (Rsh32x32 <t> x y) 4388 // result: (SRA <t> (SignExt32to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt32to64 y))))) 4389 for { 4390 t := v.Type 4391 y := v.Args[1] 4392 x := v.Args[0] 4393 v.reset(OpRISCV64SRA) 4394 v.Type = t 4395 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 4396 v0.AddArg(x) 4397 v.AddArg(v0) 4398 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4399 v1.AddArg(y) 4400 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4401 v2.AuxInt = -1 4402 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4403 v3.AuxInt = 64 4404 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4405 v4.AddArg(y) 4406 v3.AddArg(v4) 4407 v2.AddArg(v3) 4408 v1.AddArg(v2) 4409 v.AddArg(v1) 4410 return true 4411 } 4412 } 4413 func rewriteValueRISCV64_OpRsh32x64_0(v *Value) bool { 4414 b := v.Block 4415 typ := &b.Func.Config.Types 4416 // match: (Rsh32x64 <t> x y) 4417 // result: (SRA <t> (SignExt32to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] y)))) 4418 for { 4419 t := v.Type 4420 y := v.Args[1] 4421 x := v.Args[0] 4422 v.reset(OpRISCV64SRA) 4423 v.Type = t 4424 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 4425 v0.AddArg(x) 4426 v.AddArg(v0) 4427 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4428 v1.AddArg(y) 4429 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4430 v2.AuxInt = -1 4431 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4432 v3.AuxInt = 64 4433 v3.AddArg(y) 4434 v2.AddArg(v3) 4435 v1.AddArg(v2) 4436 v.AddArg(v1) 4437 return true 4438 } 4439 } 4440 func rewriteValueRISCV64_OpRsh32x8_0(v *Value) bool { 4441 b := v.Block 4442 typ := &b.Func.Config.Types 4443 // match: (Rsh32x8 <t> x y) 4444 // result: (SRA <t> (SignExt32to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt8to64 y))))) 4445 for { 4446 t := v.Type 4447 y := v.Args[1] 4448 x := v.Args[0] 4449 v.reset(OpRISCV64SRA) 4450 v.Type = t 4451 v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64) 4452 v0.AddArg(x) 4453 v.AddArg(v0) 4454 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4455 v1.AddArg(y) 4456 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4457 v2.AuxInt = -1 4458 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4459 v3.AuxInt = 64 4460 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4461 v4.AddArg(y) 4462 v3.AddArg(v4) 4463 v2.AddArg(v3) 4464 v1.AddArg(v2) 4465 v.AddArg(v1) 4466 return true 4467 } 4468 } 4469 func rewriteValueRISCV64_OpRsh64Ux16_0(v *Value) bool { 4470 b := v.Block 4471 typ := &b.Func.Config.Types 4472 // match: (Rsh64Ux16 <t> x y) 4473 // result: (AND (SRL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt16to64 y)))) 4474 for { 4475 t := v.Type 4476 y := v.Args[1] 4477 x := v.Args[0] 4478 v.reset(OpRISCV64AND) 4479 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4480 v0.AddArg(x) 4481 v0.AddArg(y) 4482 v.AddArg(v0) 4483 v1 := b.NewValue0(v.Pos, OpNeg64, t) 4484 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4485 v2.AuxInt = 64 4486 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4487 v3.AddArg(y) 4488 v2.AddArg(v3) 4489 v1.AddArg(v2) 4490 v.AddArg(v1) 4491 return true 4492 } 4493 } 4494 func rewriteValueRISCV64_OpRsh64Ux32_0(v *Value) bool { 4495 b := v.Block 4496 typ := &b.Func.Config.Types 4497 // match: (Rsh64Ux32 <t> x y) 4498 // result: (AND (SRL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt32to64 y)))) 4499 for { 4500 t := v.Type 4501 y := v.Args[1] 4502 x := v.Args[0] 4503 v.reset(OpRISCV64AND) 4504 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4505 v0.AddArg(x) 4506 v0.AddArg(y) 4507 v.AddArg(v0) 4508 v1 := b.NewValue0(v.Pos, OpNeg64, t) 4509 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4510 v2.AuxInt = 64 4511 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4512 v3.AddArg(y) 4513 v2.AddArg(v3) 4514 v1.AddArg(v2) 4515 v.AddArg(v1) 4516 return true 4517 } 4518 } 4519 func rewriteValueRISCV64_OpRsh64Ux64_0(v *Value) bool { 4520 b := v.Block 4521 // match: (Rsh64Ux64 <t> x y) 4522 // result: (AND (SRL <t> x y) (Neg64 <t> (SLTIU <t> [64] y))) 4523 for { 4524 t := v.Type 4525 y := v.Args[1] 4526 x := v.Args[0] 4527 v.reset(OpRISCV64AND) 4528 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4529 v0.AddArg(x) 4530 v0.AddArg(y) 4531 v.AddArg(v0) 4532 v1 := b.NewValue0(v.Pos, OpNeg64, t) 4533 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4534 v2.AuxInt = 64 4535 v2.AddArg(y) 4536 v1.AddArg(v2) 4537 v.AddArg(v1) 4538 return true 4539 } 4540 } 4541 func rewriteValueRISCV64_OpRsh64Ux8_0(v *Value) bool { 4542 b := v.Block 4543 typ := &b.Func.Config.Types 4544 // match: (Rsh64Ux8 <t> x y) 4545 // result: (AND (SRL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt8to64 y)))) 4546 for { 4547 t := v.Type 4548 y := v.Args[1] 4549 x := v.Args[0] 4550 v.reset(OpRISCV64AND) 4551 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4552 v0.AddArg(x) 4553 v0.AddArg(y) 4554 v.AddArg(v0) 4555 v1 := b.NewValue0(v.Pos, OpNeg64, t) 4556 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4557 v2.AuxInt = 64 4558 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4559 v3.AddArg(y) 4560 v2.AddArg(v3) 4561 v1.AddArg(v2) 4562 v.AddArg(v1) 4563 return true 4564 } 4565 } 4566 func rewriteValueRISCV64_OpRsh64x16_0(v *Value) bool { 4567 b := v.Block 4568 typ := &b.Func.Config.Types 4569 // match: (Rsh64x16 <t> x y) 4570 // result: (SRA <t> x (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt16to64 y))))) 4571 for { 4572 t := v.Type 4573 y := v.Args[1] 4574 x := v.Args[0] 4575 v.reset(OpRISCV64SRA) 4576 v.Type = t 4577 v.AddArg(x) 4578 v0 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4579 v0.AddArg(y) 4580 v1 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4581 v1.AuxInt = -1 4582 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4583 v2.AuxInt = 64 4584 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4585 v3.AddArg(y) 4586 v2.AddArg(v3) 4587 v1.AddArg(v2) 4588 v0.AddArg(v1) 4589 v.AddArg(v0) 4590 return true 4591 } 4592 } 4593 func rewriteValueRISCV64_OpRsh64x32_0(v *Value) bool { 4594 b := v.Block 4595 typ := &b.Func.Config.Types 4596 // match: (Rsh64x32 <t> x y) 4597 // result: (SRA <t> x (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt32to64 y))))) 4598 for { 4599 t := v.Type 4600 y := v.Args[1] 4601 x := v.Args[0] 4602 v.reset(OpRISCV64SRA) 4603 v.Type = t 4604 v.AddArg(x) 4605 v0 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4606 v0.AddArg(y) 4607 v1 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4608 v1.AuxInt = -1 4609 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4610 v2.AuxInt = 64 4611 v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4612 v3.AddArg(y) 4613 v2.AddArg(v3) 4614 v1.AddArg(v2) 4615 v0.AddArg(v1) 4616 v.AddArg(v0) 4617 return true 4618 } 4619 } 4620 func rewriteValueRISCV64_OpRsh64x64_0(v *Value) bool { 4621 b := v.Block 4622 // match: (Rsh64x64 <t> x y) 4623 // result: (SRA <t> x (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] y)))) 4624 for { 4625 t := v.Type 4626 y := v.Args[1] 4627 x := v.Args[0] 4628 v.reset(OpRISCV64SRA) 4629 v.Type = t 4630 v.AddArg(x) 4631 v0 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4632 v0.AddArg(y) 4633 v1 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4634 v1.AuxInt = -1 4635 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4636 v2.AuxInt = 64 4637 v2.AddArg(y) 4638 v1.AddArg(v2) 4639 v0.AddArg(v1) 4640 v.AddArg(v0) 4641 return true 4642 } 4643 } 4644 func rewriteValueRISCV64_OpRsh64x8_0(v *Value) bool { 4645 b := v.Block 4646 typ := &b.Func.Config.Types 4647 // match: (Rsh64x8 <t> x y) 4648 // result: (SRA <t> x (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt8to64 y))))) 4649 for { 4650 t := v.Type 4651 y := v.Args[1] 4652 x := v.Args[0] 4653 v.reset(OpRISCV64SRA) 4654 v.Type = t 4655 v.AddArg(x) 4656 v0 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4657 v0.AddArg(y) 4658 v1 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4659 v1.AuxInt = -1 4660 v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4661 v2.AuxInt = 64 4662 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4663 v3.AddArg(y) 4664 v2.AddArg(v3) 4665 v1.AddArg(v2) 4666 v0.AddArg(v1) 4667 v.AddArg(v0) 4668 return true 4669 } 4670 } 4671 func rewriteValueRISCV64_OpRsh8Ux16_0(v *Value) bool { 4672 b := v.Block 4673 typ := &b.Func.Config.Types 4674 // match: (Rsh8Ux16 <t> x y) 4675 // result: (AND (SRL <t> (ZeroExt8to64 x) y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt16to64 y)))) 4676 for { 4677 t := v.Type 4678 y := v.Args[1] 4679 x := v.Args[0] 4680 v.reset(OpRISCV64AND) 4681 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4682 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4683 v1.AddArg(x) 4684 v0.AddArg(v1) 4685 v0.AddArg(y) 4686 v.AddArg(v0) 4687 v2 := b.NewValue0(v.Pos, OpNeg8, t) 4688 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4689 v3.AuxInt = 64 4690 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4691 v4.AddArg(y) 4692 v3.AddArg(v4) 4693 v2.AddArg(v3) 4694 v.AddArg(v2) 4695 return true 4696 } 4697 } 4698 func rewriteValueRISCV64_OpRsh8Ux32_0(v *Value) bool { 4699 b := v.Block 4700 typ := &b.Func.Config.Types 4701 // match: (Rsh8Ux32 <t> x y) 4702 // result: (AND (SRL <t> (ZeroExt8to64 x) y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt32to64 y)))) 4703 for { 4704 t := v.Type 4705 y := v.Args[1] 4706 x := v.Args[0] 4707 v.reset(OpRISCV64AND) 4708 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4709 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4710 v1.AddArg(x) 4711 v0.AddArg(v1) 4712 v0.AddArg(y) 4713 v.AddArg(v0) 4714 v2 := b.NewValue0(v.Pos, OpNeg8, t) 4715 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4716 v3.AuxInt = 64 4717 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4718 v4.AddArg(y) 4719 v3.AddArg(v4) 4720 v2.AddArg(v3) 4721 v.AddArg(v2) 4722 return true 4723 } 4724 } 4725 func rewriteValueRISCV64_OpRsh8Ux64_0(v *Value) bool { 4726 b := v.Block 4727 typ := &b.Func.Config.Types 4728 // match: (Rsh8Ux64 <t> x y) 4729 // result: (AND (SRL <t> (ZeroExt8to64 x) y) (Neg8 <t> (SLTIU <t> [64] y))) 4730 for { 4731 t := v.Type 4732 y := v.Args[1] 4733 x := v.Args[0] 4734 v.reset(OpRISCV64AND) 4735 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4736 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4737 v1.AddArg(x) 4738 v0.AddArg(v1) 4739 v0.AddArg(y) 4740 v.AddArg(v0) 4741 v2 := b.NewValue0(v.Pos, OpNeg8, t) 4742 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4743 v3.AuxInt = 64 4744 v3.AddArg(y) 4745 v2.AddArg(v3) 4746 v.AddArg(v2) 4747 return true 4748 } 4749 } 4750 func rewriteValueRISCV64_OpRsh8Ux8_0(v *Value) bool { 4751 b := v.Block 4752 typ := &b.Func.Config.Types 4753 // match: (Rsh8Ux8 <t> x y) 4754 // result: (AND (SRL <t> (ZeroExt8to64 x) y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt8to64 y)))) 4755 for { 4756 t := v.Type 4757 y := v.Args[1] 4758 x := v.Args[0] 4759 v.reset(OpRISCV64AND) 4760 v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t) 4761 v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4762 v1.AddArg(x) 4763 v0.AddArg(v1) 4764 v0.AddArg(y) 4765 v.AddArg(v0) 4766 v2 := b.NewValue0(v.Pos, OpNeg8, t) 4767 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t) 4768 v3.AuxInt = 64 4769 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4770 v4.AddArg(y) 4771 v3.AddArg(v4) 4772 v2.AddArg(v3) 4773 v.AddArg(v2) 4774 return true 4775 } 4776 } 4777 func rewriteValueRISCV64_OpRsh8x16_0(v *Value) bool { 4778 b := v.Block 4779 typ := &b.Func.Config.Types 4780 // match: (Rsh8x16 <t> x y) 4781 // result: (SRA <t> (SignExt8to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt16to64 y))))) 4782 for { 4783 t := v.Type 4784 y := v.Args[1] 4785 x := v.Args[0] 4786 v.reset(OpRISCV64SRA) 4787 v.Type = t 4788 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 4789 v0.AddArg(x) 4790 v.AddArg(v0) 4791 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4792 v1.AddArg(y) 4793 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4794 v2.AuxInt = -1 4795 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4796 v3.AuxInt = 64 4797 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64) 4798 v4.AddArg(y) 4799 v3.AddArg(v4) 4800 v2.AddArg(v3) 4801 v1.AddArg(v2) 4802 v.AddArg(v1) 4803 return true 4804 } 4805 } 4806 func rewriteValueRISCV64_OpRsh8x32_0(v *Value) bool { 4807 b := v.Block 4808 typ := &b.Func.Config.Types 4809 // match: (Rsh8x32 <t> x y) 4810 // result: (SRA <t> (SignExt8to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt32to64 y))))) 4811 for { 4812 t := v.Type 4813 y := v.Args[1] 4814 x := v.Args[0] 4815 v.reset(OpRISCV64SRA) 4816 v.Type = t 4817 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 4818 v0.AddArg(x) 4819 v.AddArg(v0) 4820 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4821 v1.AddArg(y) 4822 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4823 v2.AuxInt = -1 4824 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4825 v3.AuxInt = 64 4826 v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64) 4827 v4.AddArg(y) 4828 v3.AddArg(v4) 4829 v2.AddArg(v3) 4830 v1.AddArg(v2) 4831 v.AddArg(v1) 4832 return true 4833 } 4834 } 4835 func rewriteValueRISCV64_OpRsh8x64_0(v *Value) bool { 4836 b := v.Block 4837 typ := &b.Func.Config.Types 4838 // match: (Rsh8x64 <t> x y) 4839 // result: (SRA <t> (SignExt8to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] y)))) 4840 for { 4841 t := v.Type 4842 y := v.Args[1] 4843 x := v.Args[0] 4844 v.reset(OpRISCV64SRA) 4845 v.Type = t 4846 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 4847 v0.AddArg(x) 4848 v.AddArg(v0) 4849 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4850 v1.AddArg(y) 4851 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4852 v2.AuxInt = -1 4853 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4854 v3.AuxInt = 64 4855 v3.AddArg(y) 4856 v2.AddArg(v3) 4857 v1.AddArg(v2) 4858 v.AddArg(v1) 4859 return true 4860 } 4861 } 4862 func rewriteValueRISCV64_OpRsh8x8_0(v *Value) bool { 4863 b := v.Block 4864 typ := &b.Func.Config.Types 4865 // match: (Rsh8x8 <t> x y) 4866 // result: (SRA <t> (SignExt8to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt8to64 y))))) 4867 for { 4868 t := v.Type 4869 y := v.Args[1] 4870 x := v.Args[0] 4871 v.reset(OpRISCV64SRA) 4872 v.Type = t 4873 v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64) 4874 v0.AddArg(x) 4875 v.AddArg(v0) 4876 v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type) 4877 v1.AddArg(y) 4878 v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type) 4879 v2.AuxInt = -1 4880 v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type) 4881 v3.AuxInt = 64 4882 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64) 4883 v4.AddArg(y) 4884 v3.AddArg(v4) 4885 v2.AddArg(v3) 4886 v1.AddArg(v2) 4887 v.AddArg(v1) 4888 return true 4889 } 4890 } 4891 func rewriteValueRISCV64_OpSignExt16to32_0(v *Value) bool { 4892 b := v.Block 4893 // match: (SignExt16to32 <t> x) 4894 // result: (SRAI [48] (SLLI <t> [48] x)) 4895 for { 4896 t := v.Type 4897 x := v.Args[0] 4898 v.reset(OpRISCV64SRAI) 4899 v.AuxInt = 48 4900 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 4901 v0.AuxInt = 48 4902 v0.AddArg(x) 4903 v.AddArg(v0) 4904 return true 4905 } 4906 } 4907 func rewriteValueRISCV64_OpSignExt16to64_0(v *Value) bool { 4908 b := v.Block 4909 // match: (SignExt16to64 <t> x) 4910 // result: (SRAI [48] (SLLI <t> [48] x)) 4911 for { 4912 t := v.Type 4913 x := v.Args[0] 4914 v.reset(OpRISCV64SRAI) 4915 v.AuxInt = 48 4916 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 4917 v0.AuxInt = 48 4918 v0.AddArg(x) 4919 v.AddArg(v0) 4920 return true 4921 } 4922 } 4923 func rewriteValueRISCV64_OpSignExt32to64_0(v *Value) bool { 4924 b := v.Block 4925 // match: (SignExt32to64 <t> x) 4926 // result: (SRAI [32] (SLLI <t> [32] x)) 4927 for { 4928 t := v.Type 4929 x := v.Args[0] 4930 v.reset(OpRISCV64SRAI) 4931 v.AuxInt = 32 4932 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 4933 v0.AuxInt = 32 4934 v0.AddArg(x) 4935 v.AddArg(v0) 4936 return true 4937 } 4938 } 4939 func rewriteValueRISCV64_OpSignExt8to16_0(v *Value) bool { 4940 b := v.Block 4941 // match: (SignExt8to16 <t> x) 4942 // result: (SRAI [56] (SLLI <t> [56] x)) 4943 for { 4944 t := v.Type 4945 x := v.Args[0] 4946 v.reset(OpRISCV64SRAI) 4947 v.AuxInt = 56 4948 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 4949 v0.AuxInt = 56 4950 v0.AddArg(x) 4951 v.AddArg(v0) 4952 return true 4953 } 4954 } 4955 func rewriteValueRISCV64_OpSignExt8to32_0(v *Value) bool { 4956 b := v.Block 4957 // match: (SignExt8to32 <t> x) 4958 // result: (SRAI [56] (SLLI <t> [56] x)) 4959 for { 4960 t := v.Type 4961 x := v.Args[0] 4962 v.reset(OpRISCV64SRAI) 4963 v.AuxInt = 56 4964 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 4965 v0.AuxInt = 56 4966 v0.AddArg(x) 4967 v.AddArg(v0) 4968 return true 4969 } 4970 } 4971 func rewriteValueRISCV64_OpSignExt8to64_0(v *Value) bool { 4972 b := v.Block 4973 // match: (SignExt8to64 <t> x) 4974 // result: (SRAI [56] (SLLI <t> [56] x)) 4975 for { 4976 t := v.Type 4977 x := v.Args[0] 4978 v.reset(OpRISCV64SRAI) 4979 v.AuxInt = 56 4980 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 4981 v0.AuxInt = 56 4982 v0.AddArg(x) 4983 v.AddArg(v0) 4984 return true 4985 } 4986 } 4987 func rewriteValueRISCV64_OpSlicemask_0(v *Value) bool { 4988 b := v.Block 4989 typ := &b.Func.Config.Types 4990 // match: (Slicemask <t> x) 4991 // result: (XOR (MOVDconst [-1]) (SRA <t> (SUB <t> x (MOVDconst [1])) (MOVDconst [63]))) 4992 for { 4993 t := v.Type 4994 x := v.Args[0] 4995 v.reset(OpRISCV64XOR) 4996 v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 4997 v0.AuxInt = -1 4998 v.AddArg(v0) 4999 v1 := b.NewValue0(v.Pos, OpRISCV64SRA, t) 5000 v2 := b.NewValue0(v.Pos, OpRISCV64SUB, t) 5001 v2.AddArg(x) 5002 v3 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 5003 v3.AuxInt = 1 5004 v2.AddArg(v3) 5005 v1.AddArg(v2) 5006 v4 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 5007 v4.AuxInt = 63 5008 v1.AddArg(v4) 5009 v.AddArg(v1) 5010 return true 5011 } 5012 } 5013 func rewriteValueRISCV64_OpSqrt_0(v *Value) bool { 5014 // match: (Sqrt x) 5015 // result: (FSQRTD x) 5016 for { 5017 x := v.Args[0] 5018 v.reset(OpRISCV64FSQRTD) 5019 v.AddArg(x) 5020 return true 5021 } 5022 } 5023 func rewriteValueRISCV64_OpStaticCall_0(v *Value) bool { 5024 // match: (StaticCall [argwid] {target} mem) 5025 // result: (CALLstatic [argwid] {target} mem) 5026 for { 5027 argwid := v.AuxInt 5028 target := v.Aux 5029 mem := v.Args[0] 5030 v.reset(OpRISCV64CALLstatic) 5031 v.AuxInt = argwid 5032 v.Aux = target 5033 v.AddArg(mem) 5034 return true 5035 } 5036 } 5037 func rewriteValueRISCV64_OpStore_0(v *Value) bool { 5038 // match: (Store {t} ptr val mem) 5039 // cond: t.(*types.Type).Size() == 1 5040 // result: (MOVBstore ptr val mem) 5041 for { 5042 t := v.Aux 5043 mem := v.Args[2] 5044 ptr := v.Args[0] 5045 val := v.Args[1] 5046 if !(t.(*types.Type).Size() == 1) { 5047 break 5048 } 5049 v.reset(OpRISCV64MOVBstore) 5050 v.AddArg(ptr) 5051 v.AddArg(val) 5052 v.AddArg(mem) 5053 return true 5054 } 5055 // match: (Store {t} ptr val mem) 5056 // cond: t.(*types.Type).Size() == 2 5057 // result: (MOVHstore ptr val mem) 5058 for { 5059 t := v.Aux 5060 mem := v.Args[2] 5061 ptr := v.Args[0] 5062 val := v.Args[1] 5063 if !(t.(*types.Type).Size() == 2) { 5064 break 5065 } 5066 v.reset(OpRISCV64MOVHstore) 5067 v.AddArg(ptr) 5068 v.AddArg(val) 5069 v.AddArg(mem) 5070 return true 5071 } 5072 // match: (Store {t} ptr val mem) 5073 // cond: t.(*types.Type).Size() == 4 && !is32BitFloat(val.Type) 5074 // result: (MOVWstore ptr val mem) 5075 for { 5076 t := v.Aux 5077 mem := v.Args[2] 5078 ptr := v.Args[0] 5079 val := v.Args[1] 5080 if !(t.(*types.Type).Size() == 4 && !is32BitFloat(val.Type)) { 5081 break 5082 } 5083 v.reset(OpRISCV64MOVWstore) 5084 v.AddArg(ptr) 5085 v.AddArg(val) 5086 v.AddArg(mem) 5087 return true 5088 } 5089 // match: (Store {t} ptr val mem) 5090 // cond: t.(*types.Type).Size() == 8 && !is64BitFloat(val.Type) 5091 // result: (MOVDstore ptr val mem) 5092 for { 5093 t := v.Aux 5094 mem := v.Args[2] 5095 ptr := v.Args[0] 5096 val := v.Args[1] 5097 if !(t.(*types.Type).Size() == 8 && !is64BitFloat(val.Type)) { 5098 break 5099 } 5100 v.reset(OpRISCV64MOVDstore) 5101 v.AddArg(ptr) 5102 v.AddArg(val) 5103 v.AddArg(mem) 5104 return true 5105 } 5106 // match: (Store {t} ptr val mem) 5107 // cond: t.(*types.Type).Size() == 4 && is32BitFloat(val.Type) 5108 // result: (FMOVWstore ptr val mem) 5109 for { 5110 t := v.Aux 5111 mem := v.Args[2] 5112 ptr := v.Args[0] 5113 val := v.Args[1] 5114 if !(t.(*types.Type).Size() == 4 && is32BitFloat(val.Type)) { 5115 break 5116 } 5117 v.reset(OpRISCV64FMOVWstore) 5118 v.AddArg(ptr) 5119 v.AddArg(val) 5120 v.AddArg(mem) 5121 return true 5122 } 5123 // match: (Store {t} ptr val mem) 5124 // cond: t.(*types.Type).Size() == 8 && is64BitFloat(val.Type) 5125 // result: (FMOVDstore ptr val mem) 5126 for { 5127 t := v.Aux 5128 mem := v.Args[2] 5129 ptr := v.Args[0] 5130 val := v.Args[1] 5131 if !(t.(*types.Type).Size() == 8 && is64BitFloat(val.Type)) { 5132 break 5133 } 5134 v.reset(OpRISCV64FMOVDstore) 5135 v.AddArg(ptr) 5136 v.AddArg(val) 5137 v.AddArg(mem) 5138 return true 5139 } 5140 return false 5141 } 5142 func rewriteValueRISCV64_OpSub16_0(v *Value) bool { 5143 // match: (Sub16 x y) 5144 // result: (SUB x y) 5145 for { 5146 y := v.Args[1] 5147 x := v.Args[0] 5148 v.reset(OpRISCV64SUB) 5149 v.AddArg(x) 5150 v.AddArg(y) 5151 return true 5152 } 5153 } 5154 func rewriteValueRISCV64_OpSub32_0(v *Value) bool { 5155 // match: (Sub32 x y) 5156 // result: (SUB x y) 5157 for { 5158 y := v.Args[1] 5159 x := v.Args[0] 5160 v.reset(OpRISCV64SUB) 5161 v.AddArg(x) 5162 v.AddArg(y) 5163 return true 5164 } 5165 } 5166 func rewriteValueRISCV64_OpSub32F_0(v *Value) bool { 5167 // match: (Sub32F x y) 5168 // result: (FSUBS x y) 5169 for { 5170 y := v.Args[1] 5171 x := v.Args[0] 5172 v.reset(OpRISCV64FSUBS) 5173 v.AddArg(x) 5174 v.AddArg(y) 5175 return true 5176 } 5177 } 5178 func rewriteValueRISCV64_OpSub64_0(v *Value) bool { 5179 // match: (Sub64 x y) 5180 // result: (SUB x y) 5181 for { 5182 y := v.Args[1] 5183 x := v.Args[0] 5184 v.reset(OpRISCV64SUB) 5185 v.AddArg(x) 5186 v.AddArg(y) 5187 return true 5188 } 5189 } 5190 func rewriteValueRISCV64_OpSub64F_0(v *Value) bool { 5191 // match: (Sub64F x y) 5192 // result: (FSUBD x y) 5193 for { 5194 y := v.Args[1] 5195 x := v.Args[0] 5196 v.reset(OpRISCV64FSUBD) 5197 v.AddArg(x) 5198 v.AddArg(y) 5199 return true 5200 } 5201 } 5202 func rewriteValueRISCV64_OpSub8_0(v *Value) bool { 5203 // match: (Sub8 x y) 5204 // result: (SUB x y) 5205 for { 5206 y := v.Args[1] 5207 x := v.Args[0] 5208 v.reset(OpRISCV64SUB) 5209 v.AddArg(x) 5210 v.AddArg(y) 5211 return true 5212 } 5213 } 5214 func rewriteValueRISCV64_OpSubPtr_0(v *Value) bool { 5215 // match: (SubPtr x y) 5216 // result: (SUB x y) 5217 for { 5218 y := v.Args[1] 5219 x := v.Args[0] 5220 v.reset(OpRISCV64SUB) 5221 v.AddArg(x) 5222 v.AddArg(y) 5223 return true 5224 } 5225 } 5226 func rewriteValueRISCV64_OpTrunc16to8_0(v *Value) bool { 5227 // match: (Trunc16to8 x) 5228 // result: x 5229 for { 5230 x := v.Args[0] 5231 v.reset(OpCopy) 5232 v.Type = x.Type 5233 v.AddArg(x) 5234 return true 5235 } 5236 } 5237 func rewriteValueRISCV64_OpTrunc32to16_0(v *Value) bool { 5238 // match: (Trunc32to16 x) 5239 // result: x 5240 for { 5241 x := v.Args[0] 5242 v.reset(OpCopy) 5243 v.Type = x.Type 5244 v.AddArg(x) 5245 return true 5246 } 5247 } 5248 func rewriteValueRISCV64_OpTrunc32to8_0(v *Value) bool { 5249 // match: (Trunc32to8 x) 5250 // result: x 5251 for { 5252 x := v.Args[0] 5253 v.reset(OpCopy) 5254 v.Type = x.Type 5255 v.AddArg(x) 5256 return true 5257 } 5258 } 5259 func rewriteValueRISCV64_OpTrunc64to16_0(v *Value) bool { 5260 // match: (Trunc64to16 x) 5261 // result: x 5262 for { 5263 x := v.Args[0] 5264 v.reset(OpCopy) 5265 v.Type = x.Type 5266 v.AddArg(x) 5267 return true 5268 } 5269 } 5270 func rewriteValueRISCV64_OpTrunc64to32_0(v *Value) bool { 5271 // match: (Trunc64to32 x) 5272 // result: x 5273 for { 5274 x := v.Args[0] 5275 v.reset(OpCopy) 5276 v.Type = x.Type 5277 v.AddArg(x) 5278 return true 5279 } 5280 } 5281 func rewriteValueRISCV64_OpTrunc64to8_0(v *Value) bool { 5282 // match: (Trunc64to8 x) 5283 // result: x 5284 for { 5285 x := v.Args[0] 5286 v.reset(OpCopy) 5287 v.Type = x.Type 5288 v.AddArg(x) 5289 return true 5290 } 5291 } 5292 func rewriteValueRISCV64_OpWB_0(v *Value) bool { 5293 // match: (WB {fn} destptr srcptr mem) 5294 // result: (LoweredWB {fn} destptr srcptr mem) 5295 for { 5296 fn := v.Aux 5297 mem := v.Args[2] 5298 destptr := v.Args[0] 5299 srcptr := v.Args[1] 5300 v.reset(OpRISCV64LoweredWB) 5301 v.Aux = fn 5302 v.AddArg(destptr) 5303 v.AddArg(srcptr) 5304 v.AddArg(mem) 5305 return true 5306 } 5307 } 5308 func rewriteValueRISCV64_OpXor16_0(v *Value) bool { 5309 // match: (Xor16 x y) 5310 // result: (XOR x y) 5311 for { 5312 y := v.Args[1] 5313 x := v.Args[0] 5314 v.reset(OpRISCV64XOR) 5315 v.AddArg(x) 5316 v.AddArg(y) 5317 return true 5318 } 5319 } 5320 func rewriteValueRISCV64_OpXor32_0(v *Value) bool { 5321 // match: (Xor32 x y) 5322 // result: (XOR x y) 5323 for { 5324 y := v.Args[1] 5325 x := v.Args[0] 5326 v.reset(OpRISCV64XOR) 5327 v.AddArg(x) 5328 v.AddArg(y) 5329 return true 5330 } 5331 } 5332 func rewriteValueRISCV64_OpXor64_0(v *Value) bool { 5333 // match: (Xor64 x y) 5334 // result: (XOR x y) 5335 for { 5336 y := v.Args[1] 5337 x := v.Args[0] 5338 v.reset(OpRISCV64XOR) 5339 v.AddArg(x) 5340 v.AddArg(y) 5341 return true 5342 } 5343 } 5344 func rewriteValueRISCV64_OpXor8_0(v *Value) bool { 5345 // match: (Xor8 x y) 5346 // result: (XOR x y) 5347 for { 5348 y := v.Args[1] 5349 x := v.Args[0] 5350 v.reset(OpRISCV64XOR) 5351 v.AddArg(x) 5352 v.AddArg(y) 5353 return true 5354 } 5355 } 5356 func rewriteValueRISCV64_OpZero_0(v *Value) bool { 5357 b := v.Block 5358 config := b.Func.Config 5359 typ := &b.Func.Config.Types 5360 // match: (Zero [0] _ mem) 5361 // result: mem 5362 for { 5363 if v.AuxInt != 0 { 5364 break 5365 } 5366 mem := v.Args[1] 5367 v.reset(OpCopy) 5368 v.Type = mem.Type 5369 v.AddArg(mem) 5370 return true 5371 } 5372 // match: (Zero [1] ptr mem) 5373 // result: (MOVBstore ptr (MOVBconst) mem) 5374 for { 5375 if v.AuxInt != 1 { 5376 break 5377 } 5378 mem := v.Args[1] 5379 ptr := v.Args[0] 5380 v.reset(OpRISCV64MOVBstore) 5381 v.AddArg(ptr) 5382 v0 := b.NewValue0(v.Pos, OpRISCV64MOVBconst, typ.UInt8) 5383 v.AddArg(v0) 5384 v.AddArg(mem) 5385 return true 5386 } 5387 // match: (Zero [2] ptr mem) 5388 // result: (MOVHstore ptr (MOVHconst) mem) 5389 for { 5390 if v.AuxInt != 2 { 5391 break 5392 } 5393 mem := v.Args[1] 5394 ptr := v.Args[0] 5395 v.reset(OpRISCV64MOVHstore) 5396 v.AddArg(ptr) 5397 v0 := b.NewValue0(v.Pos, OpRISCV64MOVHconst, typ.UInt16) 5398 v.AddArg(v0) 5399 v.AddArg(mem) 5400 return true 5401 } 5402 // match: (Zero [4] ptr mem) 5403 // result: (MOVWstore ptr (MOVWconst) mem) 5404 for { 5405 if v.AuxInt != 4 { 5406 break 5407 } 5408 mem := v.Args[1] 5409 ptr := v.Args[0] 5410 v.reset(OpRISCV64MOVWstore) 5411 v.AddArg(ptr) 5412 v0 := b.NewValue0(v.Pos, OpRISCV64MOVWconst, typ.UInt32) 5413 v.AddArg(v0) 5414 v.AddArg(mem) 5415 return true 5416 } 5417 // match: (Zero [8] ptr mem) 5418 // result: (MOVDstore ptr (MOVDconst) mem) 5419 for { 5420 if v.AuxInt != 8 { 5421 break 5422 } 5423 mem := v.Args[1] 5424 ptr := v.Args[0] 5425 v.reset(OpRISCV64MOVDstore) 5426 v.AddArg(ptr) 5427 v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 5428 v.AddArg(v0) 5429 v.AddArg(mem) 5430 return true 5431 } 5432 // match: (Zero [s] {t} ptr mem) 5433 // result: (LoweredZero [t.(*types.Type).Alignment()] ptr (ADD <ptr.Type> ptr (MOVDconst [s-moveSize(t.(*types.Type).Alignment(), config)])) mem) 5434 for { 5435 s := v.AuxInt 5436 t := v.Aux 5437 mem := v.Args[1] 5438 ptr := v.Args[0] 5439 v.reset(OpRISCV64LoweredZero) 5440 v.AuxInt = t.(*types.Type).Alignment() 5441 v.AddArg(ptr) 5442 v0 := b.NewValue0(v.Pos, OpRISCV64ADD, ptr.Type) 5443 v0.AddArg(ptr) 5444 v1 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64) 5445 v1.AuxInt = s - moveSize(t.(*types.Type).Alignment(), config) 5446 v0.AddArg(v1) 5447 v.AddArg(v0) 5448 v.AddArg(mem) 5449 return true 5450 } 5451 } 5452 func rewriteValueRISCV64_OpZeroExt16to32_0(v *Value) bool { 5453 b := v.Block 5454 // match: (ZeroExt16to32 <t> x) 5455 // result: (SRLI [48] (SLLI <t> [48] x)) 5456 for { 5457 t := v.Type 5458 x := v.Args[0] 5459 v.reset(OpRISCV64SRLI) 5460 v.AuxInt = 48 5461 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 5462 v0.AuxInt = 48 5463 v0.AddArg(x) 5464 v.AddArg(v0) 5465 return true 5466 } 5467 } 5468 func rewriteValueRISCV64_OpZeroExt16to64_0(v *Value) bool { 5469 b := v.Block 5470 // match: (ZeroExt16to64 <t> x) 5471 // result: (SRLI [48] (SLLI <t> [48] x)) 5472 for { 5473 t := v.Type 5474 x := v.Args[0] 5475 v.reset(OpRISCV64SRLI) 5476 v.AuxInt = 48 5477 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 5478 v0.AuxInt = 48 5479 v0.AddArg(x) 5480 v.AddArg(v0) 5481 return true 5482 } 5483 } 5484 func rewriteValueRISCV64_OpZeroExt32to64_0(v *Value) bool { 5485 b := v.Block 5486 // match: (ZeroExt32to64 <t> x) 5487 // result: (SRLI [32] (SLLI <t> [32] x)) 5488 for { 5489 t := v.Type 5490 x := v.Args[0] 5491 v.reset(OpRISCV64SRLI) 5492 v.AuxInt = 32 5493 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 5494 v0.AuxInt = 32 5495 v0.AddArg(x) 5496 v.AddArg(v0) 5497 return true 5498 } 5499 } 5500 func rewriteValueRISCV64_OpZeroExt8to16_0(v *Value) bool { 5501 b := v.Block 5502 // match: (ZeroExt8to16 <t> x) 5503 // result: (SRLI [56] (SLLI <t> [56] x)) 5504 for { 5505 t := v.Type 5506 x := v.Args[0] 5507 v.reset(OpRISCV64SRLI) 5508 v.AuxInt = 56 5509 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 5510 v0.AuxInt = 56 5511 v0.AddArg(x) 5512 v.AddArg(v0) 5513 return true 5514 } 5515 } 5516 func rewriteValueRISCV64_OpZeroExt8to32_0(v *Value) bool { 5517 b := v.Block 5518 // match: (ZeroExt8to32 <t> x) 5519 // result: (SRLI [56] (SLLI <t> [56] x)) 5520 for { 5521 t := v.Type 5522 x := v.Args[0] 5523 v.reset(OpRISCV64SRLI) 5524 v.AuxInt = 56 5525 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 5526 v0.AuxInt = 56 5527 v0.AddArg(x) 5528 v.AddArg(v0) 5529 return true 5530 } 5531 } 5532 func rewriteValueRISCV64_OpZeroExt8to64_0(v *Value) bool { 5533 b := v.Block 5534 // match: (ZeroExt8to64 <t> x) 5535 // result: (SRLI [56] (SLLI <t> [56] x)) 5536 for { 5537 t := v.Type 5538 x := v.Args[0] 5539 v.reset(OpRISCV64SRLI) 5540 v.AuxInt = 56 5541 v0 := b.NewValue0(v.Pos, OpRISCV64SLLI, t) 5542 v0.AuxInt = 56 5543 v0.AddArg(x) 5544 v.AddArg(v0) 5545 return true 5546 } 5547 } 5548 func rewriteBlockRISCV64(b *Block) bool { 5549 switch b.Kind { 5550 case BlockIf: 5551 // match: (If cond yes no) 5552 // result: (BNE cond yes no) 5553 for { 5554 cond := b.Controls[0] 5555 b.Reset(BlockRISCV64BNE) 5556 b.AddControl(cond) 5557 return true 5558 } 5559 } 5560 return false 5561 }