Source file src/cmd/compile/internal/ssa/rewriteRISCV64.go

     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 "cmd/compile/internal/types"
     8  
     9  func rewriteValueRISCV64(v *Value) bool {
    10  	switch v.Op {
    11  	case OpAbs:
    12  		v.Op = OpRISCV64FABSD
    13  		return true
    14  	case OpAdd16:
    15  		v.Op = OpRISCV64ADD
    16  		return true
    17  	case OpAdd32:
    18  		v.Op = OpRISCV64ADD
    19  		return true
    20  	case OpAdd32F:
    21  		v.Op = OpRISCV64FADDS
    22  		return true
    23  	case OpAdd64:
    24  		v.Op = OpRISCV64ADD
    25  		return true
    26  	case OpAdd64F:
    27  		v.Op = OpRISCV64FADDD
    28  		return true
    29  	case OpAdd8:
    30  		v.Op = OpRISCV64ADD
    31  		return true
    32  	case OpAddPtr:
    33  		v.Op = OpRISCV64ADD
    34  		return true
    35  	case OpAddr:
    36  		return rewriteValueRISCV64_OpAddr(v)
    37  	case OpAnd16:
    38  		v.Op = OpRISCV64AND
    39  		return true
    40  	case OpAnd32:
    41  		v.Op = OpRISCV64AND
    42  		return true
    43  	case OpAnd64:
    44  		v.Op = OpRISCV64AND
    45  		return true
    46  	case OpAnd8:
    47  		v.Op = OpRISCV64AND
    48  		return true
    49  	case OpAndB:
    50  		v.Op = OpRISCV64AND
    51  		return true
    52  	case OpAtomicAdd32:
    53  		v.Op = OpRISCV64LoweredAtomicAdd32
    54  		return true
    55  	case OpAtomicAdd64:
    56  		v.Op = OpRISCV64LoweredAtomicAdd64
    57  		return true
    58  	case OpAtomicAnd32:
    59  		v.Op = OpRISCV64LoweredAtomicAnd32
    60  		return true
    61  	case OpAtomicAnd8:
    62  		return rewriteValueRISCV64_OpAtomicAnd8(v)
    63  	case OpAtomicCompareAndSwap32:
    64  		v.Op = OpRISCV64LoweredAtomicCas32
    65  		return true
    66  	case OpAtomicCompareAndSwap64:
    67  		v.Op = OpRISCV64LoweredAtomicCas64
    68  		return true
    69  	case OpAtomicExchange32:
    70  		v.Op = OpRISCV64LoweredAtomicExchange32
    71  		return true
    72  	case OpAtomicExchange64:
    73  		v.Op = OpRISCV64LoweredAtomicExchange64
    74  		return true
    75  	case OpAtomicLoad32:
    76  		v.Op = OpRISCV64LoweredAtomicLoad32
    77  		return true
    78  	case OpAtomicLoad64:
    79  		v.Op = OpRISCV64LoweredAtomicLoad64
    80  		return true
    81  	case OpAtomicLoad8:
    82  		v.Op = OpRISCV64LoweredAtomicLoad8
    83  		return true
    84  	case OpAtomicLoadPtr:
    85  		v.Op = OpRISCV64LoweredAtomicLoad64
    86  		return true
    87  	case OpAtomicOr32:
    88  		v.Op = OpRISCV64LoweredAtomicOr32
    89  		return true
    90  	case OpAtomicOr8:
    91  		return rewriteValueRISCV64_OpAtomicOr8(v)
    92  	case OpAtomicStore32:
    93  		v.Op = OpRISCV64LoweredAtomicStore32
    94  		return true
    95  	case OpAtomicStore64:
    96  		v.Op = OpRISCV64LoweredAtomicStore64
    97  		return true
    98  	case OpAtomicStore8:
    99  		v.Op = OpRISCV64LoweredAtomicStore8
   100  		return true
   101  	case OpAtomicStorePtrNoWB:
   102  		v.Op = OpRISCV64LoweredAtomicStore64
   103  		return true
   104  	case OpAvg64u:
   105  		return rewriteValueRISCV64_OpAvg64u(v)
   106  	case OpClosureCall:
   107  		v.Op = OpRISCV64CALLclosure
   108  		return true
   109  	case OpCom16:
   110  		v.Op = OpRISCV64NOT
   111  		return true
   112  	case OpCom32:
   113  		v.Op = OpRISCV64NOT
   114  		return true
   115  	case OpCom64:
   116  		v.Op = OpRISCV64NOT
   117  		return true
   118  	case OpCom8:
   119  		v.Op = OpRISCV64NOT
   120  		return true
   121  	case OpConst16:
   122  		return rewriteValueRISCV64_OpConst16(v)
   123  	case OpConst32:
   124  		return rewriteValueRISCV64_OpConst32(v)
   125  	case OpConst32F:
   126  		return rewriteValueRISCV64_OpConst32F(v)
   127  	case OpConst64:
   128  		return rewriteValueRISCV64_OpConst64(v)
   129  	case OpConst64F:
   130  		return rewriteValueRISCV64_OpConst64F(v)
   131  	case OpConst8:
   132  		return rewriteValueRISCV64_OpConst8(v)
   133  	case OpConstBool:
   134  		return rewriteValueRISCV64_OpConstBool(v)
   135  	case OpConstNil:
   136  		return rewriteValueRISCV64_OpConstNil(v)
   137  	case OpConvert:
   138  		v.Op = OpRISCV64MOVconvert
   139  		return true
   140  	case OpCopysign:
   141  		v.Op = OpRISCV64FSGNJD
   142  		return true
   143  	case OpCvt32Fto32:
   144  		v.Op = OpRISCV64FCVTWS
   145  		return true
   146  	case OpCvt32Fto64:
   147  		v.Op = OpRISCV64FCVTLS
   148  		return true
   149  	case OpCvt32Fto64F:
   150  		v.Op = OpRISCV64FCVTDS
   151  		return true
   152  	case OpCvt32to32F:
   153  		v.Op = OpRISCV64FCVTSW
   154  		return true
   155  	case OpCvt32to64F:
   156  		v.Op = OpRISCV64FCVTDW
   157  		return true
   158  	case OpCvt64Fto32:
   159  		v.Op = OpRISCV64FCVTWD
   160  		return true
   161  	case OpCvt64Fto32F:
   162  		v.Op = OpRISCV64FCVTSD
   163  		return true
   164  	case OpCvt64Fto64:
   165  		v.Op = OpRISCV64FCVTLD
   166  		return true
   167  	case OpCvt64to32F:
   168  		v.Op = OpRISCV64FCVTSL
   169  		return true
   170  	case OpCvt64to64F:
   171  		v.Op = OpRISCV64FCVTDL
   172  		return true
   173  	case OpCvtBoolToUint8:
   174  		v.Op = OpCopy
   175  		return true
   176  	case OpDiv16:
   177  		return rewriteValueRISCV64_OpDiv16(v)
   178  	case OpDiv16u:
   179  		return rewriteValueRISCV64_OpDiv16u(v)
   180  	case OpDiv32:
   181  		return rewriteValueRISCV64_OpDiv32(v)
   182  	case OpDiv32F:
   183  		v.Op = OpRISCV64FDIVS
   184  		return true
   185  	case OpDiv32u:
   186  		v.Op = OpRISCV64DIVUW
   187  		return true
   188  	case OpDiv64:
   189  		return rewriteValueRISCV64_OpDiv64(v)
   190  	case OpDiv64F:
   191  		v.Op = OpRISCV64FDIVD
   192  		return true
   193  	case OpDiv64u:
   194  		v.Op = OpRISCV64DIVU
   195  		return true
   196  	case OpDiv8:
   197  		return rewriteValueRISCV64_OpDiv8(v)
   198  	case OpDiv8u:
   199  		return rewriteValueRISCV64_OpDiv8u(v)
   200  	case OpEq16:
   201  		return rewriteValueRISCV64_OpEq16(v)
   202  	case OpEq32:
   203  		return rewriteValueRISCV64_OpEq32(v)
   204  	case OpEq32F:
   205  		v.Op = OpRISCV64FEQS
   206  		return true
   207  	case OpEq64:
   208  		return rewriteValueRISCV64_OpEq64(v)
   209  	case OpEq64F:
   210  		v.Op = OpRISCV64FEQD
   211  		return true
   212  	case OpEq8:
   213  		return rewriteValueRISCV64_OpEq8(v)
   214  	case OpEqB:
   215  		return rewriteValueRISCV64_OpEqB(v)
   216  	case OpEqPtr:
   217  		return rewriteValueRISCV64_OpEqPtr(v)
   218  	case OpFMA:
   219  		v.Op = OpRISCV64FMADDD
   220  		return true
   221  	case OpGetCallerPC:
   222  		v.Op = OpRISCV64LoweredGetCallerPC
   223  		return true
   224  	case OpGetCallerSP:
   225  		v.Op = OpRISCV64LoweredGetCallerSP
   226  		return true
   227  	case OpGetClosurePtr:
   228  		v.Op = OpRISCV64LoweredGetClosurePtr
   229  		return true
   230  	case OpHmul32:
   231  		return rewriteValueRISCV64_OpHmul32(v)
   232  	case OpHmul32u:
   233  		return rewriteValueRISCV64_OpHmul32u(v)
   234  	case OpHmul64:
   235  		v.Op = OpRISCV64MULH
   236  		return true
   237  	case OpHmul64u:
   238  		v.Op = OpRISCV64MULHU
   239  		return true
   240  	case OpInterCall:
   241  		v.Op = OpRISCV64CALLinter
   242  		return true
   243  	case OpIsInBounds:
   244  		v.Op = OpLess64U
   245  		return true
   246  	case OpIsNonNil:
   247  		v.Op = OpRISCV64SNEZ
   248  		return true
   249  	case OpIsSliceInBounds:
   250  		v.Op = OpLeq64U
   251  		return true
   252  	case OpLeq16:
   253  		return rewriteValueRISCV64_OpLeq16(v)
   254  	case OpLeq16U:
   255  		return rewriteValueRISCV64_OpLeq16U(v)
   256  	case OpLeq32:
   257  		return rewriteValueRISCV64_OpLeq32(v)
   258  	case OpLeq32F:
   259  		v.Op = OpRISCV64FLES
   260  		return true
   261  	case OpLeq32U:
   262  		return rewriteValueRISCV64_OpLeq32U(v)
   263  	case OpLeq64:
   264  		return rewriteValueRISCV64_OpLeq64(v)
   265  	case OpLeq64F:
   266  		v.Op = OpRISCV64FLED
   267  		return true
   268  	case OpLeq64U:
   269  		return rewriteValueRISCV64_OpLeq64U(v)
   270  	case OpLeq8:
   271  		return rewriteValueRISCV64_OpLeq8(v)
   272  	case OpLeq8U:
   273  		return rewriteValueRISCV64_OpLeq8U(v)
   274  	case OpLess16:
   275  		return rewriteValueRISCV64_OpLess16(v)
   276  	case OpLess16U:
   277  		return rewriteValueRISCV64_OpLess16U(v)
   278  	case OpLess32:
   279  		return rewriteValueRISCV64_OpLess32(v)
   280  	case OpLess32F:
   281  		v.Op = OpRISCV64FLTS
   282  		return true
   283  	case OpLess32U:
   284  		return rewriteValueRISCV64_OpLess32U(v)
   285  	case OpLess64:
   286  		v.Op = OpRISCV64SLT
   287  		return true
   288  	case OpLess64F:
   289  		v.Op = OpRISCV64FLTD
   290  		return true
   291  	case OpLess64U:
   292  		v.Op = OpRISCV64SLTU
   293  		return true
   294  	case OpLess8:
   295  		return rewriteValueRISCV64_OpLess8(v)
   296  	case OpLess8U:
   297  		return rewriteValueRISCV64_OpLess8U(v)
   298  	case OpLoad:
   299  		return rewriteValueRISCV64_OpLoad(v)
   300  	case OpLocalAddr:
   301  		return rewriteValueRISCV64_OpLocalAddr(v)
   302  	case OpLsh16x16:
   303  		return rewriteValueRISCV64_OpLsh16x16(v)
   304  	case OpLsh16x32:
   305  		return rewriteValueRISCV64_OpLsh16x32(v)
   306  	case OpLsh16x64:
   307  		return rewriteValueRISCV64_OpLsh16x64(v)
   308  	case OpLsh16x8:
   309  		return rewriteValueRISCV64_OpLsh16x8(v)
   310  	case OpLsh32x16:
   311  		return rewriteValueRISCV64_OpLsh32x16(v)
   312  	case OpLsh32x32:
   313  		return rewriteValueRISCV64_OpLsh32x32(v)
   314  	case OpLsh32x64:
   315  		return rewriteValueRISCV64_OpLsh32x64(v)
   316  	case OpLsh32x8:
   317  		return rewriteValueRISCV64_OpLsh32x8(v)
   318  	case OpLsh64x16:
   319  		return rewriteValueRISCV64_OpLsh64x16(v)
   320  	case OpLsh64x32:
   321  		return rewriteValueRISCV64_OpLsh64x32(v)
   322  	case OpLsh64x64:
   323  		return rewriteValueRISCV64_OpLsh64x64(v)
   324  	case OpLsh64x8:
   325  		return rewriteValueRISCV64_OpLsh64x8(v)
   326  	case OpLsh8x16:
   327  		return rewriteValueRISCV64_OpLsh8x16(v)
   328  	case OpLsh8x32:
   329  		return rewriteValueRISCV64_OpLsh8x32(v)
   330  	case OpLsh8x64:
   331  		return rewriteValueRISCV64_OpLsh8x64(v)
   332  	case OpLsh8x8:
   333  		return rewriteValueRISCV64_OpLsh8x8(v)
   334  	case OpMod16:
   335  		return rewriteValueRISCV64_OpMod16(v)
   336  	case OpMod16u:
   337  		return rewriteValueRISCV64_OpMod16u(v)
   338  	case OpMod32:
   339  		return rewriteValueRISCV64_OpMod32(v)
   340  	case OpMod32u:
   341  		v.Op = OpRISCV64REMUW
   342  		return true
   343  	case OpMod64:
   344  		return rewriteValueRISCV64_OpMod64(v)
   345  	case OpMod64u:
   346  		v.Op = OpRISCV64REMU
   347  		return true
   348  	case OpMod8:
   349  		return rewriteValueRISCV64_OpMod8(v)
   350  	case OpMod8u:
   351  		return rewriteValueRISCV64_OpMod8u(v)
   352  	case OpMove:
   353  		return rewriteValueRISCV64_OpMove(v)
   354  	case OpMul16:
   355  		return rewriteValueRISCV64_OpMul16(v)
   356  	case OpMul32:
   357  		v.Op = OpRISCV64MULW
   358  		return true
   359  	case OpMul32F:
   360  		v.Op = OpRISCV64FMULS
   361  		return true
   362  	case OpMul64:
   363  		v.Op = OpRISCV64MUL
   364  		return true
   365  	case OpMul64F:
   366  		v.Op = OpRISCV64FMULD
   367  		return true
   368  	case OpMul64uhilo:
   369  		v.Op = OpRISCV64LoweredMuluhilo
   370  		return true
   371  	case OpMul64uover:
   372  		v.Op = OpRISCV64LoweredMuluover
   373  		return true
   374  	case OpMul8:
   375  		return rewriteValueRISCV64_OpMul8(v)
   376  	case OpNeg16:
   377  		v.Op = OpRISCV64NEG
   378  		return true
   379  	case OpNeg32:
   380  		v.Op = OpRISCV64NEG
   381  		return true
   382  	case OpNeg32F:
   383  		v.Op = OpRISCV64FNEGS
   384  		return true
   385  	case OpNeg64:
   386  		v.Op = OpRISCV64NEG
   387  		return true
   388  	case OpNeg64F:
   389  		v.Op = OpRISCV64FNEGD
   390  		return true
   391  	case OpNeg8:
   392  		v.Op = OpRISCV64NEG
   393  		return true
   394  	case OpNeq16:
   395  		return rewriteValueRISCV64_OpNeq16(v)
   396  	case OpNeq32:
   397  		return rewriteValueRISCV64_OpNeq32(v)
   398  	case OpNeq32F:
   399  		v.Op = OpRISCV64FNES
   400  		return true
   401  	case OpNeq64:
   402  		return rewriteValueRISCV64_OpNeq64(v)
   403  	case OpNeq64F:
   404  		v.Op = OpRISCV64FNED
   405  		return true
   406  	case OpNeq8:
   407  		return rewriteValueRISCV64_OpNeq8(v)
   408  	case OpNeqB:
   409  		v.Op = OpRISCV64XOR
   410  		return true
   411  	case OpNeqPtr:
   412  		return rewriteValueRISCV64_OpNeqPtr(v)
   413  	case OpNilCheck:
   414  		v.Op = OpRISCV64LoweredNilCheck
   415  		return true
   416  	case OpNot:
   417  		v.Op = OpRISCV64SEQZ
   418  		return true
   419  	case OpOffPtr:
   420  		return rewriteValueRISCV64_OpOffPtr(v)
   421  	case OpOr16:
   422  		v.Op = OpRISCV64OR
   423  		return true
   424  	case OpOr32:
   425  		v.Op = OpRISCV64OR
   426  		return true
   427  	case OpOr64:
   428  		v.Op = OpRISCV64OR
   429  		return true
   430  	case OpOr8:
   431  		v.Op = OpRISCV64OR
   432  		return true
   433  	case OpOrB:
   434  		v.Op = OpRISCV64OR
   435  		return true
   436  	case OpPanicBounds:
   437  		return rewriteValueRISCV64_OpPanicBounds(v)
   438  	case OpRISCV64ADD:
   439  		return rewriteValueRISCV64_OpRISCV64ADD(v)
   440  	case OpRISCV64ADDI:
   441  		return rewriteValueRISCV64_OpRISCV64ADDI(v)
   442  	case OpRISCV64AND:
   443  		return rewriteValueRISCV64_OpRISCV64AND(v)
   444  	case OpRISCV64ANDI:
   445  		return rewriteValueRISCV64_OpRISCV64ANDI(v)
   446  	case OpRISCV64FMADDD:
   447  		return rewriteValueRISCV64_OpRISCV64FMADDD(v)
   448  	case OpRISCV64FMSUBD:
   449  		return rewriteValueRISCV64_OpRISCV64FMSUBD(v)
   450  	case OpRISCV64FNMADDD:
   451  		return rewriteValueRISCV64_OpRISCV64FNMADDD(v)
   452  	case OpRISCV64FNMSUBD:
   453  		return rewriteValueRISCV64_OpRISCV64FNMSUBD(v)
   454  	case OpRISCV64MOVBUload:
   455  		return rewriteValueRISCV64_OpRISCV64MOVBUload(v)
   456  	case OpRISCV64MOVBUreg:
   457  		return rewriteValueRISCV64_OpRISCV64MOVBUreg(v)
   458  	case OpRISCV64MOVBload:
   459  		return rewriteValueRISCV64_OpRISCV64MOVBload(v)
   460  	case OpRISCV64MOVBreg:
   461  		return rewriteValueRISCV64_OpRISCV64MOVBreg(v)
   462  	case OpRISCV64MOVBstore:
   463  		return rewriteValueRISCV64_OpRISCV64MOVBstore(v)
   464  	case OpRISCV64MOVBstorezero:
   465  		return rewriteValueRISCV64_OpRISCV64MOVBstorezero(v)
   466  	case OpRISCV64MOVDload:
   467  		return rewriteValueRISCV64_OpRISCV64MOVDload(v)
   468  	case OpRISCV64MOVDnop:
   469  		return rewriteValueRISCV64_OpRISCV64MOVDnop(v)
   470  	case OpRISCV64MOVDreg:
   471  		return rewriteValueRISCV64_OpRISCV64MOVDreg(v)
   472  	case OpRISCV64MOVDstore:
   473  		return rewriteValueRISCV64_OpRISCV64MOVDstore(v)
   474  	case OpRISCV64MOVDstorezero:
   475  		return rewriteValueRISCV64_OpRISCV64MOVDstorezero(v)
   476  	case OpRISCV64MOVHUload:
   477  		return rewriteValueRISCV64_OpRISCV64MOVHUload(v)
   478  	case OpRISCV64MOVHUreg:
   479  		return rewriteValueRISCV64_OpRISCV64MOVHUreg(v)
   480  	case OpRISCV64MOVHload:
   481  		return rewriteValueRISCV64_OpRISCV64MOVHload(v)
   482  	case OpRISCV64MOVHreg:
   483  		return rewriteValueRISCV64_OpRISCV64MOVHreg(v)
   484  	case OpRISCV64MOVHstore:
   485  		return rewriteValueRISCV64_OpRISCV64MOVHstore(v)
   486  	case OpRISCV64MOVHstorezero:
   487  		return rewriteValueRISCV64_OpRISCV64MOVHstorezero(v)
   488  	case OpRISCV64MOVWUload:
   489  		return rewriteValueRISCV64_OpRISCV64MOVWUload(v)
   490  	case OpRISCV64MOVWUreg:
   491  		return rewriteValueRISCV64_OpRISCV64MOVWUreg(v)
   492  	case OpRISCV64MOVWload:
   493  		return rewriteValueRISCV64_OpRISCV64MOVWload(v)
   494  	case OpRISCV64MOVWreg:
   495  		return rewriteValueRISCV64_OpRISCV64MOVWreg(v)
   496  	case OpRISCV64MOVWstore:
   497  		return rewriteValueRISCV64_OpRISCV64MOVWstore(v)
   498  	case OpRISCV64MOVWstorezero:
   499  		return rewriteValueRISCV64_OpRISCV64MOVWstorezero(v)
   500  	case OpRISCV64NEG:
   501  		return rewriteValueRISCV64_OpRISCV64NEG(v)
   502  	case OpRISCV64NEGW:
   503  		return rewriteValueRISCV64_OpRISCV64NEGW(v)
   504  	case OpRISCV64OR:
   505  		return rewriteValueRISCV64_OpRISCV64OR(v)
   506  	case OpRISCV64ORI:
   507  		return rewriteValueRISCV64_OpRISCV64ORI(v)
   508  	case OpRISCV64SLL:
   509  		return rewriteValueRISCV64_OpRISCV64SLL(v)
   510  	case OpRISCV64SLLI:
   511  		return rewriteValueRISCV64_OpRISCV64SLLI(v)
   512  	case OpRISCV64SLTI:
   513  		return rewriteValueRISCV64_OpRISCV64SLTI(v)
   514  	case OpRISCV64SLTIU:
   515  		return rewriteValueRISCV64_OpRISCV64SLTIU(v)
   516  	case OpRISCV64SRA:
   517  		return rewriteValueRISCV64_OpRISCV64SRA(v)
   518  	case OpRISCV64SRAI:
   519  		return rewriteValueRISCV64_OpRISCV64SRAI(v)
   520  	case OpRISCV64SRL:
   521  		return rewriteValueRISCV64_OpRISCV64SRL(v)
   522  	case OpRISCV64SRLI:
   523  		return rewriteValueRISCV64_OpRISCV64SRLI(v)
   524  	case OpRISCV64SUB:
   525  		return rewriteValueRISCV64_OpRISCV64SUB(v)
   526  	case OpRISCV64SUBW:
   527  		return rewriteValueRISCV64_OpRISCV64SUBW(v)
   528  	case OpRISCV64XOR:
   529  		return rewriteValueRISCV64_OpRISCV64XOR(v)
   530  	case OpRotateLeft16:
   531  		return rewriteValueRISCV64_OpRotateLeft16(v)
   532  	case OpRotateLeft32:
   533  		return rewriteValueRISCV64_OpRotateLeft32(v)
   534  	case OpRotateLeft64:
   535  		return rewriteValueRISCV64_OpRotateLeft64(v)
   536  	case OpRotateLeft8:
   537  		return rewriteValueRISCV64_OpRotateLeft8(v)
   538  	case OpRound32F:
   539  		v.Op = OpCopy
   540  		return true
   541  	case OpRound64F:
   542  		v.Op = OpCopy
   543  		return true
   544  	case OpRsh16Ux16:
   545  		return rewriteValueRISCV64_OpRsh16Ux16(v)
   546  	case OpRsh16Ux32:
   547  		return rewriteValueRISCV64_OpRsh16Ux32(v)
   548  	case OpRsh16Ux64:
   549  		return rewriteValueRISCV64_OpRsh16Ux64(v)
   550  	case OpRsh16Ux8:
   551  		return rewriteValueRISCV64_OpRsh16Ux8(v)
   552  	case OpRsh16x16:
   553  		return rewriteValueRISCV64_OpRsh16x16(v)
   554  	case OpRsh16x32:
   555  		return rewriteValueRISCV64_OpRsh16x32(v)
   556  	case OpRsh16x64:
   557  		return rewriteValueRISCV64_OpRsh16x64(v)
   558  	case OpRsh16x8:
   559  		return rewriteValueRISCV64_OpRsh16x8(v)
   560  	case OpRsh32Ux16:
   561  		return rewriteValueRISCV64_OpRsh32Ux16(v)
   562  	case OpRsh32Ux32:
   563  		return rewriteValueRISCV64_OpRsh32Ux32(v)
   564  	case OpRsh32Ux64:
   565  		return rewriteValueRISCV64_OpRsh32Ux64(v)
   566  	case OpRsh32Ux8:
   567  		return rewriteValueRISCV64_OpRsh32Ux8(v)
   568  	case OpRsh32x16:
   569  		return rewriteValueRISCV64_OpRsh32x16(v)
   570  	case OpRsh32x32:
   571  		return rewriteValueRISCV64_OpRsh32x32(v)
   572  	case OpRsh32x64:
   573  		return rewriteValueRISCV64_OpRsh32x64(v)
   574  	case OpRsh32x8:
   575  		return rewriteValueRISCV64_OpRsh32x8(v)
   576  	case OpRsh64Ux16:
   577  		return rewriteValueRISCV64_OpRsh64Ux16(v)
   578  	case OpRsh64Ux32:
   579  		return rewriteValueRISCV64_OpRsh64Ux32(v)
   580  	case OpRsh64Ux64:
   581  		return rewriteValueRISCV64_OpRsh64Ux64(v)
   582  	case OpRsh64Ux8:
   583  		return rewriteValueRISCV64_OpRsh64Ux8(v)
   584  	case OpRsh64x16:
   585  		return rewriteValueRISCV64_OpRsh64x16(v)
   586  	case OpRsh64x32:
   587  		return rewriteValueRISCV64_OpRsh64x32(v)
   588  	case OpRsh64x64:
   589  		return rewriteValueRISCV64_OpRsh64x64(v)
   590  	case OpRsh64x8:
   591  		return rewriteValueRISCV64_OpRsh64x8(v)
   592  	case OpRsh8Ux16:
   593  		return rewriteValueRISCV64_OpRsh8Ux16(v)
   594  	case OpRsh8Ux32:
   595  		return rewriteValueRISCV64_OpRsh8Ux32(v)
   596  	case OpRsh8Ux64:
   597  		return rewriteValueRISCV64_OpRsh8Ux64(v)
   598  	case OpRsh8Ux8:
   599  		return rewriteValueRISCV64_OpRsh8Ux8(v)
   600  	case OpRsh8x16:
   601  		return rewriteValueRISCV64_OpRsh8x16(v)
   602  	case OpRsh8x32:
   603  		return rewriteValueRISCV64_OpRsh8x32(v)
   604  	case OpRsh8x64:
   605  		return rewriteValueRISCV64_OpRsh8x64(v)
   606  	case OpRsh8x8:
   607  		return rewriteValueRISCV64_OpRsh8x8(v)
   608  	case OpSignExt16to32:
   609  		v.Op = OpRISCV64MOVHreg
   610  		return true
   611  	case OpSignExt16to64:
   612  		v.Op = OpRISCV64MOVHreg
   613  		return true
   614  	case OpSignExt32to64:
   615  		v.Op = OpRISCV64MOVWreg
   616  		return true
   617  	case OpSignExt8to16:
   618  		v.Op = OpRISCV64MOVBreg
   619  		return true
   620  	case OpSignExt8to32:
   621  		v.Op = OpRISCV64MOVBreg
   622  		return true
   623  	case OpSignExt8to64:
   624  		v.Op = OpRISCV64MOVBreg
   625  		return true
   626  	case OpSlicemask:
   627  		return rewriteValueRISCV64_OpSlicemask(v)
   628  	case OpSqrt:
   629  		v.Op = OpRISCV64FSQRTD
   630  		return true
   631  	case OpSqrt32:
   632  		v.Op = OpRISCV64FSQRTS
   633  		return true
   634  	case OpStaticCall:
   635  		v.Op = OpRISCV64CALLstatic
   636  		return true
   637  	case OpStore:
   638  		return rewriteValueRISCV64_OpStore(v)
   639  	case OpSub16:
   640  		v.Op = OpRISCV64SUB
   641  		return true
   642  	case OpSub32:
   643  		v.Op = OpRISCV64SUB
   644  		return true
   645  	case OpSub32F:
   646  		v.Op = OpRISCV64FSUBS
   647  		return true
   648  	case OpSub64:
   649  		v.Op = OpRISCV64SUB
   650  		return true
   651  	case OpSub64F:
   652  		v.Op = OpRISCV64FSUBD
   653  		return true
   654  	case OpSub8:
   655  		v.Op = OpRISCV64SUB
   656  		return true
   657  	case OpSubPtr:
   658  		v.Op = OpRISCV64SUB
   659  		return true
   660  	case OpTailCall:
   661  		v.Op = OpRISCV64CALLtail
   662  		return true
   663  	case OpTrunc16to8:
   664  		v.Op = OpCopy
   665  		return true
   666  	case OpTrunc32to16:
   667  		v.Op = OpCopy
   668  		return true
   669  	case OpTrunc32to8:
   670  		v.Op = OpCopy
   671  		return true
   672  	case OpTrunc64to16:
   673  		v.Op = OpCopy
   674  		return true
   675  	case OpTrunc64to32:
   676  		v.Op = OpCopy
   677  		return true
   678  	case OpTrunc64to8:
   679  		v.Op = OpCopy
   680  		return true
   681  	case OpWB:
   682  		v.Op = OpRISCV64LoweredWB
   683  		return true
   684  	case OpXor16:
   685  		v.Op = OpRISCV64XOR
   686  		return true
   687  	case OpXor32:
   688  		v.Op = OpRISCV64XOR
   689  		return true
   690  	case OpXor64:
   691  		v.Op = OpRISCV64XOR
   692  		return true
   693  	case OpXor8:
   694  		v.Op = OpRISCV64XOR
   695  		return true
   696  	case OpZero:
   697  		return rewriteValueRISCV64_OpZero(v)
   698  	case OpZeroExt16to32:
   699  		v.Op = OpRISCV64MOVHUreg
   700  		return true
   701  	case OpZeroExt16to64:
   702  		v.Op = OpRISCV64MOVHUreg
   703  		return true
   704  	case OpZeroExt32to64:
   705  		v.Op = OpRISCV64MOVWUreg
   706  		return true
   707  	case OpZeroExt8to16:
   708  		v.Op = OpRISCV64MOVBUreg
   709  		return true
   710  	case OpZeroExt8to32:
   711  		v.Op = OpRISCV64MOVBUreg
   712  		return true
   713  	case OpZeroExt8to64:
   714  		v.Op = OpRISCV64MOVBUreg
   715  		return true
   716  	}
   717  	return false
   718  }
   719  func rewriteValueRISCV64_OpAddr(v *Value) bool {
   720  	v_0 := v.Args[0]
   721  	// match: (Addr {sym} base)
   722  	// result: (MOVaddr {sym} [0] base)
   723  	for {
   724  		sym := auxToSym(v.Aux)
   725  		base := v_0
   726  		v.reset(OpRISCV64MOVaddr)
   727  		v.AuxInt = int32ToAuxInt(0)
   728  		v.Aux = symToAux(sym)
   729  		v.AddArg(base)
   730  		return true
   731  	}
   732  }
   733  func rewriteValueRISCV64_OpAtomicAnd8(v *Value) bool {
   734  	v_2 := v.Args[2]
   735  	v_1 := v.Args[1]
   736  	v_0 := v.Args[0]
   737  	b := v.Block
   738  	typ := &b.Func.Config.Types
   739  	// match: (AtomicAnd8 ptr val mem)
   740  	// result: (LoweredAtomicAnd32 (ANDI <typ.Uintptr> [^3] ptr) (NOT <typ.UInt32> (SLL <typ.UInt32> (XORI <typ.UInt32> [0xff] (ZeroExt8to32 val)) (SLLI <typ.UInt64> [3] (ANDI <typ.UInt64> [3] ptr)))) mem)
   741  	for {
   742  		ptr := v_0
   743  		val := v_1
   744  		mem := v_2
   745  		v.reset(OpRISCV64LoweredAtomicAnd32)
   746  		v0 := b.NewValue0(v.Pos, OpRISCV64ANDI, typ.Uintptr)
   747  		v0.AuxInt = int64ToAuxInt(^3)
   748  		v0.AddArg(ptr)
   749  		v1 := b.NewValue0(v.Pos, OpRISCV64NOT, typ.UInt32)
   750  		v2 := b.NewValue0(v.Pos, OpRISCV64SLL, typ.UInt32)
   751  		v3 := b.NewValue0(v.Pos, OpRISCV64XORI, typ.UInt32)
   752  		v3.AuxInt = int64ToAuxInt(0xff)
   753  		v4 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
   754  		v4.AddArg(val)
   755  		v3.AddArg(v4)
   756  		v5 := b.NewValue0(v.Pos, OpRISCV64SLLI, typ.UInt64)
   757  		v5.AuxInt = int64ToAuxInt(3)
   758  		v6 := b.NewValue0(v.Pos, OpRISCV64ANDI, typ.UInt64)
   759  		v6.AuxInt = int64ToAuxInt(3)
   760  		v6.AddArg(ptr)
   761  		v5.AddArg(v6)
   762  		v2.AddArg2(v3, v5)
   763  		v1.AddArg(v2)
   764  		v.AddArg3(v0, v1, mem)
   765  		return true
   766  	}
   767  }
   768  func rewriteValueRISCV64_OpAtomicOr8(v *Value) bool {
   769  	v_2 := v.Args[2]
   770  	v_1 := v.Args[1]
   771  	v_0 := v.Args[0]
   772  	b := v.Block
   773  	typ := &b.Func.Config.Types
   774  	// match: (AtomicOr8 ptr val mem)
   775  	// result: (LoweredAtomicOr32 (ANDI <typ.Uintptr> [^3] ptr) (SLL <typ.UInt32> (ZeroExt8to32 val) (SLLI <typ.UInt64> [3] (ANDI <typ.UInt64> [3] ptr))) mem)
   776  	for {
   777  		ptr := v_0
   778  		val := v_1
   779  		mem := v_2
   780  		v.reset(OpRISCV64LoweredAtomicOr32)
   781  		v0 := b.NewValue0(v.Pos, OpRISCV64ANDI, typ.Uintptr)
   782  		v0.AuxInt = int64ToAuxInt(^3)
   783  		v0.AddArg(ptr)
   784  		v1 := b.NewValue0(v.Pos, OpRISCV64SLL, typ.UInt32)
   785  		v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
   786  		v2.AddArg(val)
   787  		v3 := b.NewValue0(v.Pos, OpRISCV64SLLI, typ.UInt64)
   788  		v3.AuxInt = int64ToAuxInt(3)
   789  		v4 := b.NewValue0(v.Pos, OpRISCV64ANDI, typ.UInt64)
   790  		v4.AuxInt = int64ToAuxInt(3)
   791  		v4.AddArg(ptr)
   792  		v3.AddArg(v4)
   793  		v1.AddArg2(v2, v3)
   794  		v.AddArg3(v0, v1, mem)
   795  		return true
   796  	}
   797  }
   798  func rewriteValueRISCV64_OpAvg64u(v *Value) bool {
   799  	v_1 := v.Args[1]
   800  	v_0 := v.Args[0]
   801  	b := v.Block
   802  	// match: (Avg64u <t> x y)
   803  	// result: (ADD (ADD <t> (SRLI <t> [1] x) (SRLI <t> [1] y)) (ANDI <t> [1] (AND <t> x y)))
   804  	for {
   805  		t := v.Type
   806  		x := v_0
   807  		y := v_1
   808  		v.reset(OpRISCV64ADD)
   809  		v0 := b.NewValue0(v.Pos, OpRISCV64ADD, t)
   810  		v1 := b.NewValue0(v.Pos, OpRISCV64SRLI, t)
   811  		v1.AuxInt = int64ToAuxInt(1)
   812  		v1.AddArg(x)
   813  		v2 := b.NewValue0(v.Pos, OpRISCV64SRLI, t)
   814  		v2.AuxInt = int64ToAuxInt(1)
   815  		v2.AddArg(y)
   816  		v0.AddArg2(v1, v2)
   817  		v3 := b.NewValue0(v.Pos, OpRISCV64ANDI, t)
   818  		v3.AuxInt = int64ToAuxInt(1)
   819  		v4 := b.NewValue0(v.Pos, OpRISCV64AND, t)
   820  		v4.AddArg2(x, y)
   821  		v3.AddArg(v4)
   822  		v.AddArg2(v0, v3)
   823  		return true
   824  	}
   825  }
   826  func rewriteValueRISCV64_OpConst16(v *Value) bool {
   827  	// match: (Const16 [val])
   828  	// result: (MOVDconst [int64(val)])
   829  	for {
   830  		val := auxIntToInt16(v.AuxInt)
   831  		v.reset(OpRISCV64MOVDconst)
   832  		v.AuxInt = int64ToAuxInt(int64(val))
   833  		return true
   834  	}
   835  }
   836  func rewriteValueRISCV64_OpConst32(v *Value) bool {
   837  	// match: (Const32 [val])
   838  	// result: (MOVDconst [int64(val)])
   839  	for {
   840  		val := auxIntToInt32(v.AuxInt)
   841  		v.reset(OpRISCV64MOVDconst)
   842  		v.AuxInt = int64ToAuxInt(int64(val))
   843  		return true
   844  	}
   845  }
   846  func rewriteValueRISCV64_OpConst32F(v *Value) bool {
   847  	b := v.Block
   848  	typ := &b.Func.Config.Types
   849  	// match: (Const32F [val])
   850  	// result: (FMVSX (MOVDconst [int64(math.Float32bits(val))]))
   851  	for {
   852  		val := auxIntToFloat32(v.AuxInt)
   853  		v.reset(OpRISCV64FMVSX)
   854  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
   855  		v0.AuxInt = int64ToAuxInt(int64(math.Float32bits(val)))
   856  		v.AddArg(v0)
   857  		return true
   858  	}
   859  }
   860  func rewriteValueRISCV64_OpConst64(v *Value) bool {
   861  	// match: (Const64 [val])
   862  	// result: (MOVDconst [int64(val)])
   863  	for {
   864  		val := auxIntToInt64(v.AuxInt)
   865  		v.reset(OpRISCV64MOVDconst)
   866  		v.AuxInt = int64ToAuxInt(int64(val))
   867  		return true
   868  	}
   869  }
   870  func rewriteValueRISCV64_OpConst64F(v *Value) bool {
   871  	b := v.Block
   872  	typ := &b.Func.Config.Types
   873  	// match: (Const64F [val])
   874  	// result: (FMVDX (MOVDconst [int64(math.Float64bits(val))]))
   875  	for {
   876  		val := auxIntToFloat64(v.AuxInt)
   877  		v.reset(OpRISCV64FMVDX)
   878  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
   879  		v0.AuxInt = int64ToAuxInt(int64(math.Float64bits(val)))
   880  		v.AddArg(v0)
   881  		return true
   882  	}
   883  }
   884  func rewriteValueRISCV64_OpConst8(v *Value) bool {
   885  	// match: (Const8 [val])
   886  	// result: (MOVDconst [int64(val)])
   887  	for {
   888  		val := auxIntToInt8(v.AuxInt)
   889  		v.reset(OpRISCV64MOVDconst)
   890  		v.AuxInt = int64ToAuxInt(int64(val))
   891  		return true
   892  	}
   893  }
   894  func rewriteValueRISCV64_OpConstBool(v *Value) bool {
   895  	// match: (ConstBool [val])
   896  	// result: (MOVDconst [int64(b2i(val))])
   897  	for {
   898  		val := auxIntToBool(v.AuxInt)
   899  		v.reset(OpRISCV64MOVDconst)
   900  		v.AuxInt = int64ToAuxInt(int64(b2i(val)))
   901  		return true
   902  	}
   903  }
   904  func rewriteValueRISCV64_OpConstNil(v *Value) bool {
   905  	// match: (ConstNil)
   906  	// result: (MOVDconst [0])
   907  	for {
   908  		v.reset(OpRISCV64MOVDconst)
   909  		v.AuxInt = int64ToAuxInt(0)
   910  		return true
   911  	}
   912  }
   913  func rewriteValueRISCV64_OpDiv16(v *Value) bool {
   914  	v_1 := v.Args[1]
   915  	v_0 := v.Args[0]
   916  	b := v.Block
   917  	typ := &b.Func.Config.Types
   918  	// match: (Div16 x y [false])
   919  	// result: (DIVW (SignExt16to32 x) (SignExt16to32 y))
   920  	for {
   921  		if auxIntToBool(v.AuxInt) != false {
   922  			break
   923  		}
   924  		x := v_0
   925  		y := v_1
   926  		v.reset(OpRISCV64DIVW)
   927  		v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
   928  		v0.AddArg(x)
   929  		v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
   930  		v1.AddArg(y)
   931  		v.AddArg2(v0, v1)
   932  		return true
   933  	}
   934  	return false
   935  }
   936  func rewriteValueRISCV64_OpDiv16u(v *Value) bool {
   937  	v_1 := v.Args[1]
   938  	v_0 := v.Args[0]
   939  	b := v.Block
   940  	typ := &b.Func.Config.Types
   941  	// match: (Div16u x y)
   942  	// result: (DIVUW (ZeroExt16to32 x) (ZeroExt16to32 y))
   943  	for {
   944  		x := v_0
   945  		y := v_1
   946  		v.reset(OpRISCV64DIVUW)
   947  		v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
   948  		v0.AddArg(x)
   949  		v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
   950  		v1.AddArg(y)
   951  		v.AddArg2(v0, v1)
   952  		return true
   953  	}
   954  }
   955  func rewriteValueRISCV64_OpDiv32(v *Value) bool {
   956  	v_1 := v.Args[1]
   957  	v_0 := v.Args[0]
   958  	// match: (Div32 x y [false])
   959  	// result: (DIVW x y)
   960  	for {
   961  		if auxIntToBool(v.AuxInt) != false {
   962  			break
   963  		}
   964  		x := v_0
   965  		y := v_1
   966  		v.reset(OpRISCV64DIVW)
   967  		v.AddArg2(x, y)
   968  		return true
   969  	}
   970  	return false
   971  }
   972  func rewriteValueRISCV64_OpDiv64(v *Value) bool {
   973  	v_1 := v.Args[1]
   974  	v_0 := v.Args[0]
   975  	// match: (Div64 x y [false])
   976  	// result: (DIV x y)
   977  	for {
   978  		if auxIntToBool(v.AuxInt) != false {
   979  			break
   980  		}
   981  		x := v_0
   982  		y := v_1
   983  		v.reset(OpRISCV64DIV)
   984  		v.AddArg2(x, y)
   985  		return true
   986  	}
   987  	return false
   988  }
   989  func rewriteValueRISCV64_OpDiv8(v *Value) bool {
   990  	v_1 := v.Args[1]
   991  	v_0 := v.Args[0]
   992  	b := v.Block
   993  	typ := &b.Func.Config.Types
   994  	// match: (Div8 x y)
   995  	// result: (DIVW (SignExt8to32 x) (SignExt8to32 y))
   996  	for {
   997  		x := v_0
   998  		y := v_1
   999  		v.reset(OpRISCV64DIVW)
  1000  		v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
  1001  		v0.AddArg(x)
  1002  		v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
  1003  		v1.AddArg(y)
  1004  		v.AddArg2(v0, v1)
  1005  		return true
  1006  	}
  1007  }
  1008  func rewriteValueRISCV64_OpDiv8u(v *Value) bool {
  1009  	v_1 := v.Args[1]
  1010  	v_0 := v.Args[0]
  1011  	b := v.Block
  1012  	typ := &b.Func.Config.Types
  1013  	// match: (Div8u x y)
  1014  	// result: (DIVUW (ZeroExt8to32 x) (ZeroExt8to32 y))
  1015  	for {
  1016  		x := v_0
  1017  		y := v_1
  1018  		v.reset(OpRISCV64DIVUW)
  1019  		v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
  1020  		v0.AddArg(x)
  1021  		v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
  1022  		v1.AddArg(y)
  1023  		v.AddArg2(v0, v1)
  1024  		return true
  1025  	}
  1026  }
  1027  func rewriteValueRISCV64_OpEq16(v *Value) bool {
  1028  	v_1 := v.Args[1]
  1029  	v_0 := v.Args[0]
  1030  	b := v.Block
  1031  	typ := &b.Func.Config.Types
  1032  	// match: (Eq16 x y)
  1033  	// result: (SEQZ (SUB <x.Type> (ZeroExt16to64 x) (ZeroExt16to64 y)))
  1034  	for {
  1035  		x := v_0
  1036  		y := v_1
  1037  		v.reset(OpRISCV64SEQZ)
  1038  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
  1039  		v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  1040  		v1.AddArg(x)
  1041  		v2 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  1042  		v2.AddArg(y)
  1043  		v0.AddArg2(v1, v2)
  1044  		v.AddArg(v0)
  1045  		return true
  1046  	}
  1047  }
  1048  func rewriteValueRISCV64_OpEq32(v *Value) bool {
  1049  	v_1 := v.Args[1]
  1050  	v_0 := v.Args[0]
  1051  	b := v.Block
  1052  	typ := &b.Func.Config.Types
  1053  	// match: (Eq32 x y)
  1054  	// result: (SEQZ (SUB <x.Type> (ZeroExt32to64 x) (ZeroExt32to64 y)))
  1055  	for {
  1056  		x := v_0
  1057  		y := v_1
  1058  		v.reset(OpRISCV64SEQZ)
  1059  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
  1060  		v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1061  		v1.AddArg(x)
  1062  		v2 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1063  		v2.AddArg(y)
  1064  		v0.AddArg2(v1, v2)
  1065  		v.AddArg(v0)
  1066  		return true
  1067  	}
  1068  }
  1069  func rewriteValueRISCV64_OpEq64(v *Value) bool {
  1070  	v_1 := v.Args[1]
  1071  	v_0 := v.Args[0]
  1072  	b := v.Block
  1073  	// match: (Eq64 x y)
  1074  	// result: (SEQZ (SUB <x.Type> x y))
  1075  	for {
  1076  		x := v_0
  1077  		y := v_1
  1078  		v.reset(OpRISCV64SEQZ)
  1079  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
  1080  		v0.AddArg2(x, y)
  1081  		v.AddArg(v0)
  1082  		return true
  1083  	}
  1084  }
  1085  func rewriteValueRISCV64_OpEq8(v *Value) bool {
  1086  	v_1 := v.Args[1]
  1087  	v_0 := v.Args[0]
  1088  	b := v.Block
  1089  	typ := &b.Func.Config.Types
  1090  	// match: (Eq8 x y)
  1091  	// result: (SEQZ (SUB <x.Type> (ZeroExt8to64 x) (ZeroExt8to64 y)))
  1092  	for {
  1093  		x := v_0
  1094  		y := v_1
  1095  		v.reset(OpRISCV64SEQZ)
  1096  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
  1097  		v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  1098  		v1.AddArg(x)
  1099  		v2 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  1100  		v2.AddArg(y)
  1101  		v0.AddArg2(v1, v2)
  1102  		v.AddArg(v0)
  1103  		return true
  1104  	}
  1105  }
  1106  func rewriteValueRISCV64_OpEqB(v *Value) bool {
  1107  	v_1 := v.Args[1]
  1108  	v_0 := v.Args[0]
  1109  	b := v.Block
  1110  	typ := &b.Func.Config.Types
  1111  	// match: (EqB x y)
  1112  	// result: (SEQZ (XOR <typ.Bool> x y))
  1113  	for {
  1114  		x := v_0
  1115  		y := v_1
  1116  		v.reset(OpRISCV64SEQZ)
  1117  		v0 := b.NewValue0(v.Pos, OpRISCV64XOR, typ.Bool)
  1118  		v0.AddArg2(x, y)
  1119  		v.AddArg(v0)
  1120  		return true
  1121  	}
  1122  }
  1123  func rewriteValueRISCV64_OpEqPtr(v *Value) bool {
  1124  	v_1 := v.Args[1]
  1125  	v_0 := v.Args[0]
  1126  	b := v.Block
  1127  	typ := &b.Func.Config.Types
  1128  	// match: (EqPtr x y)
  1129  	// result: (SEQZ (SUB <typ.Uintptr> x y))
  1130  	for {
  1131  		x := v_0
  1132  		y := v_1
  1133  		v.reset(OpRISCV64SEQZ)
  1134  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, typ.Uintptr)
  1135  		v0.AddArg2(x, y)
  1136  		v.AddArg(v0)
  1137  		return true
  1138  	}
  1139  }
  1140  func rewriteValueRISCV64_OpHmul32(v *Value) bool {
  1141  	v_1 := v.Args[1]
  1142  	v_0 := v.Args[0]
  1143  	b := v.Block
  1144  	typ := &b.Func.Config.Types
  1145  	// match: (Hmul32 x y)
  1146  	// result: (SRAI [32] (MUL (SignExt32to64 x) (SignExt32to64 y)))
  1147  	for {
  1148  		x := v_0
  1149  		y := v_1
  1150  		v.reset(OpRISCV64SRAI)
  1151  		v.AuxInt = int64ToAuxInt(32)
  1152  		v0 := b.NewValue0(v.Pos, OpRISCV64MUL, typ.Int64)
  1153  		v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
  1154  		v1.AddArg(x)
  1155  		v2 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
  1156  		v2.AddArg(y)
  1157  		v0.AddArg2(v1, v2)
  1158  		v.AddArg(v0)
  1159  		return true
  1160  	}
  1161  }
  1162  func rewriteValueRISCV64_OpHmul32u(v *Value) bool {
  1163  	v_1 := v.Args[1]
  1164  	v_0 := v.Args[0]
  1165  	b := v.Block
  1166  	typ := &b.Func.Config.Types
  1167  	// match: (Hmul32u x y)
  1168  	// result: (SRLI [32] (MUL (ZeroExt32to64 x) (ZeroExt32to64 y)))
  1169  	for {
  1170  		x := v_0
  1171  		y := v_1
  1172  		v.reset(OpRISCV64SRLI)
  1173  		v.AuxInt = int64ToAuxInt(32)
  1174  		v0 := b.NewValue0(v.Pos, OpRISCV64MUL, typ.Int64)
  1175  		v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1176  		v1.AddArg(x)
  1177  		v2 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1178  		v2.AddArg(y)
  1179  		v0.AddArg2(v1, v2)
  1180  		v.AddArg(v0)
  1181  		return true
  1182  	}
  1183  }
  1184  func rewriteValueRISCV64_OpLeq16(v *Value) bool {
  1185  	v_1 := v.Args[1]
  1186  	v_0 := v.Args[0]
  1187  	b := v.Block
  1188  	typ := &b.Func.Config.Types
  1189  	// match: (Leq16 x y)
  1190  	// result: (Not (Less16 y x))
  1191  	for {
  1192  		x := v_0
  1193  		y := v_1
  1194  		v.reset(OpNot)
  1195  		v0 := b.NewValue0(v.Pos, OpLess16, typ.Bool)
  1196  		v0.AddArg2(y, x)
  1197  		v.AddArg(v0)
  1198  		return true
  1199  	}
  1200  }
  1201  func rewriteValueRISCV64_OpLeq16U(v *Value) bool {
  1202  	v_1 := v.Args[1]
  1203  	v_0 := v.Args[0]
  1204  	b := v.Block
  1205  	typ := &b.Func.Config.Types
  1206  	// match: (Leq16U x y)
  1207  	// result: (Not (Less16U y x))
  1208  	for {
  1209  		x := v_0
  1210  		y := v_1
  1211  		v.reset(OpNot)
  1212  		v0 := b.NewValue0(v.Pos, OpLess16U, typ.Bool)
  1213  		v0.AddArg2(y, x)
  1214  		v.AddArg(v0)
  1215  		return true
  1216  	}
  1217  }
  1218  func rewriteValueRISCV64_OpLeq32(v *Value) bool {
  1219  	v_1 := v.Args[1]
  1220  	v_0 := v.Args[0]
  1221  	b := v.Block
  1222  	typ := &b.Func.Config.Types
  1223  	// match: (Leq32 x y)
  1224  	// result: (Not (Less32 y x))
  1225  	for {
  1226  		x := v_0
  1227  		y := v_1
  1228  		v.reset(OpNot)
  1229  		v0 := b.NewValue0(v.Pos, OpLess32, typ.Bool)
  1230  		v0.AddArg2(y, x)
  1231  		v.AddArg(v0)
  1232  		return true
  1233  	}
  1234  }
  1235  func rewriteValueRISCV64_OpLeq32U(v *Value) bool {
  1236  	v_1 := v.Args[1]
  1237  	v_0 := v.Args[0]
  1238  	b := v.Block
  1239  	typ := &b.Func.Config.Types
  1240  	// match: (Leq32U x y)
  1241  	// result: (Not (Less32U y x))
  1242  	for {
  1243  		x := v_0
  1244  		y := v_1
  1245  		v.reset(OpNot)
  1246  		v0 := b.NewValue0(v.Pos, OpLess32U, typ.Bool)
  1247  		v0.AddArg2(y, x)
  1248  		v.AddArg(v0)
  1249  		return true
  1250  	}
  1251  }
  1252  func rewriteValueRISCV64_OpLeq64(v *Value) bool {
  1253  	v_1 := v.Args[1]
  1254  	v_0 := v.Args[0]
  1255  	b := v.Block
  1256  	typ := &b.Func.Config.Types
  1257  	// match: (Leq64 x y)
  1258  	// result: (Not (Less64 y x))
  1259  	for {
  1260  		x := v_0
  1261  		y := v_1
  1262  		v.reset(OpNot)
  1263  		v0 := b.NewValue0(v.Pos, OpLess64, typ.Bool)
  1264  		v0.AddArg2(y, x)
  1265  		v.AddArg(v0)
  1266  		return true
  1267  	}
  1268  }
  1269  func rewriteValueRISCV64_OpLeq64U(v *Value) bool {
  1270  	v_1 := v.Args[1]
  1271  	v_0 := v.Args[0]
  1272  	b := v.Block
  1273  	typ := &b.Func.Config.Types
  1274  	// match: (Leq64U x y)
  1275  	// result: (Not (Less64U y x))
  1276  	for {
  1277  		x := v_0
  1278  		y := v_1
  1279  		v.reset(OpNot)
  1280  		v0 := b.NewValue0(v.Pos, OpLess64U, typ.Bool)
  1281  		v0.AddArg2(y, x)
  1282  		v.AddArg(v0)
  1283  		return true
  1284  	}
  1285  }
  1286  func rewriteValueRISCV64_OpLeq8(v *Value) bool {
  1287  	v_1 := v.Args[1]
  1288  	v_0 := v.Args[0]
  1289  	b := v.Block
  1290  	typ := &b.Func.Config.Types
  1291  	// match: (Leq8 x y)
  1292  	// result: (Not (Less8 y x))
  1293  	for {
  1294  		x := v_0
  1295  		y := v_1
  1296  		v.reset(OpNot)
  1297  		v0 := b.NewValue0(v.Pos, OpLess8, typ.Bool)
  1298  		v0.AddArg2(y, x)
  1299  		v.AddArg(v0)
  1300  		return true
  1301  	}
  1302  }
  1303  func rewriteValueRISCV64_OpLeq8U(v *Value) bool {
  1304  	v_1 := v.Args[1]
  1305  	v_0 := v.Args[0]
  1306  	b := v.Block
  1307  	typ := &b.Func.Config.Types
  1308  	// match: (Leq8U x y)
  1309  	// result: (Not (Less8U y x))
  1310  	for {
  1311  		x := v_0
  1312  		y := v_1
  1313  		v.reset(OpNot)
  1314  		v0 := b.NewValue0(v.Pos, OpLess8U, typ.Bool)
  1315  		v0.AddArg2(y, x)
  1316  		v.AddArg(v0)
  1317  		return true
  1318  	}
  1319  }
  1320  func rewriteValueRISCV64_OpLess16(v *Value) bool {
  1321  	v_1 := v.Args[1]
  1322  	v_0 := v.Args[0]
  1323  	b := v.Block
  1324  	typ := &b.Func.Config.Types
  1325  	// match: (Less16 x y)
  1326  	// result: (SLT (SignExt16to64 x) (SignExt16to64 y))
  1327  	for {
  1328  		x := v_0
  1329  		y := v_1
  1330  		v.reset(OpRISCV64SLT)
  1331  		v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
  1332  		v0.AddArg(x)
  1333  		v1 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
  1334  		v1.AddArg(y)
  1335  		v.AddArg2(v0, v1)
  1336  		return true
  1337  	}
  1338  }
  1339  func rewriteValueRISCV64_OpLess16U(v *Value) bool {
  1340  	v_1 := v.Args[1]
  1341  	v_0 := v.Args[0]
  1342  	b := v.Block
  1343  	typ := &b.Func.Config.Types
  1344  	// match: (Less16U x y)
  1345  	// result: (SLTU (ZeroExt16to64 x) (ZeroExt16to64 y))
  1346  	for {
  1347  		x := v_0
  1348  		y := v_1
  1349  		v.reset(OpRISCV64SLTU)
  1350  		v0 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  1351  		v0.AddArg(x)
  1352  		v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  1353  		v1.AddArg(y)
  1354  		v.AddArg2(v0, v1)
  1355  		return true
  1356  	}
  1357  }
  1358  func rewriteValueRISCV64_OpLess32(v *Value) bool {
  1359  	v_1 := v.Args[1]
  1360  	v_0 := v.Args[0]
  1361  	b := v.Block
  1362  	typ := &b.Func.Config.Types
  1363  	// match: (Less32 x y)
  1364  	// result: (SLT (SignExt32to64 x) (SignExt32to64 y))
  1365  	for {
  1366  		x := v_0
  1367  		y := v_1
  1368  		v.reset(OpRISCV64SLT)
  1369  		v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
  1370  		v0.AddArg(x)
  1371  		v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
  1372  		v1.AddArg(y)
  1373  		v.AddArg2(v0, v1)
  1374  		return true
  1375  	}
  1376  }
  1377  func rewriteValueRISCV64_OpLess32U(v *Value) bool {
  1378  	v_1 := v.Args[1]
  1379  	v_0 := v.Args[0]
  1380  	b := v.Block
  1381  	typ := &b.Func.Config.Types
  1382  	// match: (Less32U x y)
  1383  	// result: (SLTU (ZeroExt32to64 x) (ZeroExt32to64 y))
  1384  	for {
  1385  		x := v_0
  1386  		y := v_1
  1387  		v.reset(OpRISCV64SLTU)
  1388  		v0 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1389  		v0.AddArg(x)
  1390  		v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1391  		v1.AddArg(y)
  1392  		v.AddArg2(v0, v1)
  1393  		return true
  1394  	}
  1395  }
  1396  func rewriteValueRISCV64_OpLess8(v *Value) bool {
  1397  	v_1 := v.Args[1]
  1398  	v_0 := v.Args[0]
  1399  	b := v.Block
  1400  	typ := &b.Func.Config.Types
  1401  	// match: (Less8 x y)
  1402  	// result: (SLT (SignExt8to64 x) (SignExt8to64 y))
  1403  	for {
  1404  		x := v_0
  1405  		y := v_1
  1406  		v.reset(OpRISCV64SLT)
  1407  		v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
  1408  		v0.AddArg(x)
  1409  		v1 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
  1410  		v1.AddArg(y)
  1411  		v.AddArg2(v0, v1)
  1412  		return true
  1413  	}
  1414  }
  1415  func rewriteValueRISCV64_OpLess8U(v *Value) bool {
  1416  	v_1 := v.Args[1]
  1417  	v_0 := v.Args[0]
  1418  	b := v.Block
  1419  	typ := &b.Func.Config.Types
  1420  	// match: (Less8U x y)
  1421  	// result: (SLTU (ZeroExt8to64 x) (ZeroExt8to64 y))
  1422  	for {
  1423  		x := v_0
  1424  		y := v_1
  1425  		v.reset(OpRISCV64SLTU)
  1426  		v0 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  1427  		v0.AddArg(x)
  1428  		v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  1429  		v1.AddArg(y)
  1430  		v.AddArg2(v0, v1)
  1431  		return true
  1432  	}
  1433  }
  1434  func rewriteValueRISCV64_OpLoad(v *Value) bool {
  1435  	v_1 := v.Args[1]
  1436  	v_0 := v.Args[0]
  1437  	// match: (Load <t> ptr mem)
  1438  	// cond: t.IsBoolean()
  1439  	// result: (MOVBUload ptr mem)
  1440  	for {
  1441  		t := v.Type
  1442  		ptr := v_0
  1443  		mem := v_1
  1444  		if !(t.IsBoolean()) {
  1445  			break
  1446  		}
  1447  		v.reset(OpRISCV64MOVBUload)
  1448  		v.AddArg2(ptr, mem)
  1449  		return true
  1450  	}
  1451  	// match: (Load <t> ptr mem)
  1452  	// cond: ( is8BitInt(t) && isSigned(t))
  1453  	// result: (MOVBload ptr mem)
  1454  	for {
  1455  		t := v.Type
  1456  		ptr := v_0
  1457  		mem := v_1
  1458  		if !(is8BitInt(t) && isSigned(t)) {
  1459  			break
  1460  		}
  1461  		v.reset(OpRISCV64MOVBload)
  1462  		v.AddArg2(ptr, mem)
  1463  		return true
  1464  	}
  1465  	// match: (Load <t> ptr mem)
  1466  	// cond: ( is8BitInt(t) && !isSigned(t))
  1467  	// result: (MOVBUload ptr mem)
  1468  	for {
  1469  		t := v.Type
  1470  		ptr := v_0
  1471  		mem := v_1
  1472  		if !(is8BitInt(t) && !isSigned(t)) {
  1473  			break
  1474  		}
  1475  		v.reset(OpRISCV64MOVBUload)
  1476  		v.AddArg2(ptr, mem)
  1477  		return true
  1478  	}
  1479  	// match: (Load <t> ptr mem)
  1480  	// cond: (is16BitInt(t) && isSigned(t))
  1481  	// result: (MOVHload ptr mem)
  1482  	for {
  1483  		t := v.Type
  1484  		ptr := v_0
  1485  		mem := v_1
  1486  		if !(is16BitInt(t) && isSigned(t)) {
  1487  			break
  1488  		}
  1489  		v.reset(OpRISCV64MOVHload)
  1490  		v.AddArg2(ptr, mem)
  1491  		return true
  1492  	}
  1493  	// match: (Load <t> ptr mem)
  1494  	// cond: (is16BitInt(t) && !isSigned(t))
  1495  	// result: (MOVHUload ptr mem)
  1496  	for {
  1497  		t := v.Type
  1498  		ptr := v_0
  1499  		mem := v_1
  1500  		if !(is16BitInt(t) && !isSigned(t)) {
  1501  			break
  1502  		}
  1503  		v.reset(OpRISCV64MOVHUload)
  1504  		v.AddArg2(ptr, mem)
  1505  		return true
  1506  	}
  1507  	// match: (Load <t> ptr mem)
  1508  	// cond: (is32BitInt(t) && isSigned(t))
  1509  	// result: (MOVWload ptr mem)
  1510  	for {
  1511  		t := v.Type
  1512  		ptr := v_0
  1513  		mem := v_1
  1514  		if !(is32BitInt(t) && isSigned(t)) {
  1515  			break
  1516  		}
  1517  		v.reset(OpRISCV64MOVWload)
  1518  		v.AddArg2(ptr, mem)
  1519  		return true
  1520  	}
  1521  	// match: (Load <t> ptr mem)
  1522  	// cond: (is32BitInt(t) && !isSigned(t))
  1523  	// result: (MOVWUload ptr mem)
  1524  	for {
  1525  		t := v.Type
  1526  		ptr := v_0
  1527  		mem := v_1
  1528  		if !(is32BitInt(t) && !isSigned(t)) {
  1529  			break
  1530  		}
  1531  		v.reset(OpRISCV64MOVWUload)
  1532  		v.AddArg2(ptr, mem)
  1533  		return true
  1534  	}
  1535  	// match: (Load <t> ptr mem)
  1536  	// cond: (is64BitInt(t) || isPtr(t))
  1537  	// result: (MOVDload ptr mem)
  1538  	for {
  1539  		t := v.Type
  1540  		ptr := v_0
  1541  		mem := v_1
  1542  		if !(is64BitInt(t) || isPtr(t)) {
  1543  			break
  1544  		}
  1545  		v.reset(OpRISCV64MOVDload)
  1546  		v.AddArg2(ptr, mem)
  1547  		return true
  1548  	}
  1549  	// match: (Load <t> ptr mem)
  1550  	// cond: is32BitFloat(t)
  1551  	// result: (FMOVWload ptr mem)
  1552  	for {
  1553  		t := v.Type
  1554  		ptr := v_0
  1555  		mem := v_1
  1556  		if !(is32BitFloat(t)) {
  1557  			break
  1558  		}
  1559  		v.reset(OpRISCV64FMOVWload)
  1560  		v.AddArg2(ptr, mem)
  1561  		return true
  1562  	}
  1563  	// match: (Load <t> ptr mem)
  1564  	// cond: is64BitFloat(t)
  1565  	// result: (FMOVDload ptr mem)
  1566  	for {
  1567  		t := v.Type
  1568  		ptr := v_0
  1569  		mem := v_1
  1570  		if !(is64BitFloat(t)) {
  1571  			break
  1572  		}
  1573  		v.reset(OpRISCV64FMOVDload)
  1574  		v.AddArg2(ptr, mem)
  1575  		return true
  1576  	}
  1577  	return false
  1578  }
  1579  func rewriteValueRISCV64_OpLocalAddr(v *Value) bool {
  1580  	v_0 := v.Args[0]
  1581  	// match: (LocalAddr {sym} base _)
  1582  	// result: (MOVaddr {sym} base)
  1583  	for {
  1584  		sym := auxToSym(v.Aux)
  1585  		base := v_0
  1586  		v.reset(OpRISCV64MOVaddr)
  1587  		v.Aux = symToAux(sym)
  1588  		v.AddArg(base)
  1589  		return true
  1590  	}
  1591  }
  1592  func rewriteValueRISCV64_OpLsh16x16(v *Value) bool {
  1593  	v_1 := v.Args[1]
  1594  	v_0 := v.Args[0]
  1595  	b := v.Block
  1596  	typ := &b.Func.Config.Types
  1597  	// match: (Lsh16x16 <t> x y)
  1598  	// result: (AND (SLL <t> x y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt16to64 y))))
  1599  	for {
  1600  		t := v.Type
  1601  		x := v_0
  1602  		y := v_1
  1603  		v.reset(OpRISCV64AND)
  1604  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1605  		v0.AddArg2(x, y)
  1606  		v1 := b.NewValue0(v.Pos, OpNeg16, t)
  1607  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1608  		v2.AuxInt = int64ToAuxInt(64)
  1609  		v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  1610  		v3.AddArg(y)
  1611  		v2.AddArg(v3)
  1612  		v1.AddArg(v2)
  1613  		v.AddArg2(v0, v1)
  1614  		return true
  1615  	}
  1616  }
  1617  func rewriteValueRISCV64_OpLsh16x32(v *Value) bool {
  1618  	v_1 := v.Args[1]
  1619  	v_0 := v.Args[0]
  1620  	b := v.Block
  1621  	typ := &b.Func.Config.Types
  1622  	// match: (Lsh16x32 <t> x y)
  1623  	// result: (AND (SLL <t> x y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt32to64 y))))
  1624  	for {
  1625  		t := v.Type
  1626  		x := v_0
  1627  		y := v_1
  1628  		v.reset(OpRISCV64AND)
  1629  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1630  		v0.AddArg2(x, y)
  1631  		v1 := b.NewValue0(v.Pos, OpNeg16, t)
  1632  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1633  		v2.AuxInt = int64ToAuxInt(64)
  1634  		v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1635  		v3.AddArg(y)
  1636  		v2.AddArg(v3)
  1637  		v1.AddArg(v2)
  1638  		v.AddArg2(v0, v1)
  1639  		return true
  1640  	}
  1641  }
  1642  func rewriteValueRISCV64_OpLsh16x64(v *Value) bool {
  1643  	v_1 := v.Args[1]
  1644  	v_0 := v.Args[0]
  1645  	b := v.Block
  1646  	// match: (Lsh16x64 <t> x y)
  1647  	// result: (AND (SLL <t> x y) (Neg16 <t> (SLTIU <t> [64] y)))
  1648  	for {
  1649  		t := v.Type
  1650  		x := v_0
  1651  		y := v_1
  1652  		v.reset(OpRISCV64AND)
  1653  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1654  		v0.AddArg2(x, y)
  1655  		v1 := b.NewValue0(v.Pos, OpNeg16, t)
  1656  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1657  		v2.AuxInt = int64ToAuxInt(64)
  1658  		v2.AddArg(y)
  1659  		v1.AddArg(v2)
  1660  		v.AddArg2(v0, v1)
  1661  		return true
  1662  	}
  1663  }
  1664  func rewriteValueRISCV64_OpLsh16x8(v *Value) bool {
  1665  	v_1 := v.Args[1]
  1666  	v_0 := v.Args[0]
  1667  	b := v.Block
  1668  	typ := &b.Func.Config.Types
  1669  	// match: (Lsh16x8 <t> x y)
  1670  	// result: (AND (SLL <t> x y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt8to64 y))))
  1671  	for {
  1672  		t := v.Type
  1673  		x := v_0
  1674  		y := v_1
  1675  		v.reset(OpRISCV64AND)
  1676  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1677  		v0.AddArg2(x, y)
  1678  		v1 := b.NewValue0(v.Pos, OpNeg16, t)
  1679  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1680  		v2.AuxInt = int64ToAuxInt(64)
  1681  		v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  1682  		v3.AddArg(y)
  1683  		v2.AddArg(v3)
  1684  		v1.AddArg(v2)
  1685  		v.AddArg2(v0, v1)
  1686  		return true
  1687  	}
  1688  }
  1689  func rewriteValueRISCV64_OpLsh32x16(v *Value) bool {
  1690  	v_1 := v.Args[1]
  1691  	v_0 := v.Args[0]
  1692  	b := v.Block
  1693  	typ := &b.Func.Config.Types
  1694  	// match: (Lsh32x16 <t> x y)
  1695  	// result: (AND (SLL <t> x y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt16to64 y))))
  1696  	for {
  1697  		t := v.Type
  1698  		x := v_0
  1699  		y := v_1
  1700  		v.reset(OpRISCV64AND)
  1701  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1702  		v0.AddArg2(x, y)
  1703  		v1 := b.NewValue0(v.Pos, OpNeg32, t)
  1704  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1705  		v2.AuxInt = int64ToAuxInt(64)
  1706  		v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  1707  		v3.AddArg(y)
  1708  		v2.AddArg(v3)
  1709  		v1.AddArg(v2)
  1710  		v.AddArg2(v0, v1)
  1711  		return true
  1712  	}
  1713  }
  1714  func rewriteValueRISCV64_OpLsh32x32(v *Value) bool {
  1715  	v_1 := v.Args[1]
  1716  	v_0 := v.Args[0]
  1717  	b := v.Block
  1718  	typ := &b.Func.Config.Types
  1719  	// match: (Lsh32x32 <t> x y)
  1720  	// result: (AND (SLL <t> x y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt32to64 y))))
  1721  	for {
  1722  		t := v.Type
  1723  		x := v_0
  1724  		y := v_1
  1725  		v.reset(OpRISCV64AND)
  1726  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1727  		v0.AddArg2(x, y)
  1728  		v1 := b.NewValue0(v.Pos, OpNeg32, t)
  1729  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1730  		v2.AuxInt = int64ToAuxInt(64)
  1731  		v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1732  		v3.AddArg(y)
  1733  		v2.AddArg(v3)
  1734  		v1.AddArg(v2)
  1735  		v.AddArg2(v0, v1)
  1736  		return true
  1737  	}
  1738  }
  1739  func rewriteValueRISCV64_OpLsh32x64(v *Value) bool {
  1740  	v_1 := v.Args[1]
  1741  	v_0 := v.Args[0]
  1742  	b := v.Block
  1743  	// match: (Lsh32x64 <t> x y)
  1744  	// result: (AND (SLL <t> x y) (Neg32 <t> (SLTIU <t> [64] y)))
  1745  	for {
  1746  		t := v.Type
  1747  		x := v_0
  1748  		y := v_1
  1749  		v.reset(OpRISCV64AND)
  1750  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1751  		v0.AddArg2(x, y)
  1752  		v1 := b.NewValue0(v.Pos, OpNeg32, t)
  1753  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1754  		v2.AuxInt = int64ToAuxInt(64)
  1755  		v2.AddArg(y)
  1756  		v1.AddArg(v2)
  1757  		v.AddArg2(v0, v1)
  1758  		return true
  1759  	}
  1760  }
  1761  func rewriteValueRISCV64_OpLsh32x8(v *Value) bool {
  1762  	v_1 := v.Args[1]
  1763  	v_0 := v.Args[0]
  1764  	b := v.Block
  1765  	typ := &b.Func.Config.Types
  1766  	// match: (Lsh32x8 <t> x y)
  1767  	// result: (AND (SLL <t> x y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt8to64 y))))
  1768  	for {
  1769  		t := v.Type
  1770  		x := v_0
  1771  		y := v_1
  1772  		v.reset(OpRISCV64AND)
  1773  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1774  		v0.AddArg2(x, y)
  1775  		v1 := b.NewValue0(v.Pos, OpNeg32, t)
  1776  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1777  		v2.AuxInt = int64ToAuxInt(64)
  1778  		v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  1779  		v3.AddArg(y)
  1780  		v2.AddArg(v3)
  1781  		v1.AddArg(v2)
  1782  		v.AddArg2(v0, v1)
  1783  		return true
  1784  	}
  1785  }
  1786  func rewriteValueRISCV64_OpLsh64x16(v *Value) bool {
  1787  	v_1 := v.Args[1]
  1788  	v_0 := v.Args[0]
  1789  	b := v.Block
  1790  	typ := &b.Func.Config.Types
  1791  	// match: (Lsh64x16 <t> x y)
  1792  	// result: (AND (SLL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt16to64 y))))
  1793  	for {
  1794  		t := v.Type
  1795  		x := v_0
  1796  		y := v_1
  1797  		v.reset(OpRISCV64AND)
  1798  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1799  		v0.AddArg2(x, y)
  1800  		v1 := b.NewValue0(v.Pos, OpNeg64, t)
  1801  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1802  		v2.AuxInt = int64ToAuxInt(64)
  1803  		v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  1804  		v3.AddArg(y)
  1805  		v2.AddArg(v3)
  1806  		v1.AddArg(v2)
  1807  		v.AddArg2(v0, v1)
  1808  		return true
  1809  	}
  1810  }
  1811  func rewriteValueRISCV64_OpLsh64x32(v *Value) bool {
  1812  	v_1 := v.Args[1]
  1813  	v_0 := v.Args[0]
  1814  	b := v.Block
  1815  	typ := &b.Func.Config.Types
  1816  	// match: (Lsh64x32 <t> x y)
  1817  	// result: (AND (SLL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt32to64 y))))
  1818  	for {
  1819  		t := v.Type
  1820  		x := v_0
  1821  		y := v_1
  1822  		v.reset(OpRISCV64AND)
  1823  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1824  		v0.AddArg2(x, y)
  1825  		v1 := b.NewValue0(v.Pos, OpNeg64, t)
  1826  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1827  		v2.AuxInt = int64ToAuxInt(64)
  1828  		v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1829  		v3.AddArg(y)
  1830  		v2.AddArg(v3)
  1831  		v1.AddArg(v2)
  1832  		v.AddArg2(v0, v1)
  1833  		return true
  1834  	}
  1835  }
  1836  func rewriteValueRISCV64_OpLsh64x64(v *Value) bool {
  1837  	v_1 := v.Args[1]
  1838  	v_0 := v.Args[0]
  1839  	b := v.Block
  1840  	// match: (Lsh64x64 <t> x y)
  1841  	// result: (AND (SLL <t> x y) (Neg64 <t> (SLTIU <t> [64] y)))
  1842  	for {
  1843  		t := v.Type
  1844  		x := v_0
  1845  		y := v_1
  1846  		v.reset(OpRISCV64AND)
  1847  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1848  		v0.AddArg2(x, y)
  1849  		v1 := b.NewValue0(v.Pos, OpNeg64, t)
  1850  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1851  		v2.AuxInt = int64ToAuxInt(64)
  1852  		v2.AddArg(y)
  1853  		v1.AddArg(v2)
  1854  		v.AddArg2(v0, v1)
  1855  		return true
  1856  	}
  1857  }
  1858  func rewriteValueRISCV64_OpLsh64x8(v *Value) bool {
  1859  	v_1 := v.Args[1]
  1860  	v_0 := v.Args[0]
  1861  	b := v.Block
  1862  	typ := &b.Func.Config.Types
  1863  	// match: (Lsh64x8 <t> x y)
  1864  	// result: (AND (SLL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt8to64 y))))
  1865  	for {
  1866  		t := v.Type
  1867  		x := v_0
  1868  		y := v_1
  1869  		v.reset(OpRISCV64AND)
  1870  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1871  		v0.AddArg2(x, y)
  1872  		v1 := b.NewValue0(v.Pos, OpNeg64, t)
  1873  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1874  		v2.AuxInt = int64ToAuxInt(64)
  1875  		v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  1876  		v3.AddArg(y)
  1877  		v2.AddArg(v3)
  1878  		v1.AddArg(v2)
  1879  		v.AddArg2(v0, v1)
  1880  		return true
  1881  	}
  1882  }
  1883  func rewriteValueRISCV64_OpLsh8x16(v *Value) bool {
  1884  	v_1 := v.Args[1]
  1885  	v_0 := v.Args[0]
  1886  	b := v.Block
  1887  	typ := &b.Func.Config.Types
  1888  	// match: (Lsh8x16 <t> x y)
  1889  	// result: (AND (SLL <t> x y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt16to64 y))))
  1890  	for {
  1891  		t := v.Type
  1892  		x := v_0
  1893  		y := v_1
  1894  		v.reset(OpRISCV64AND)
  1895  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1896  		v0.AddArg2(x, y)
  1897  		v1 := b.NewValue0(v.Pos, OpNeg8, t)
  1898  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1899  		v2.AuxInt = int64ToAuxInt(64)
  1900  		v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  1901  		v3.AddArg(y)
  1902  		v2.AddArg(v3)
  1903  		v1.AddArg(v2)
  1904  		v.AddArg2(v0, v1)
  1905  		return true
  1906  	}
  1907  }
  1908  func rewriteValueRISCV64_OpLsh8x32(v *Value) bool {
  1909  	v_1 := v.Args[1]
  1910  	v_0 := v.Args[0]
  1911  	b := v.Block
  1912  	typ := &b.Func.Config.Types
  1913  	// match: (Lsh8x32 <t> x y)
  1914  	// result: (AND (SLL <t> x y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt32to64 y))))
  1915  	for {
  1916  		t := v.Type
  1917  		x := v_0
  1918  		y := v_1
  1919  		v.reset(OpRISCV64AND)
  1920  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1921  		v0.AddArg2(x, y)
  1922  		v1 := b.NewValue0(v.Pos, OpNeg8, t)
  1923  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1924  		v2.AuxInt = int64ToAuxInt(64)
  1925  		v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  1926  		v3.AddArg(y)
  1927  		v2.AddArg(v3)
  1928  		v1.AddArg(v2)
  1929  		v.AddArg2(v0, v1)
  1930  		return true
  1931  	}
  1932  }
  1933  func rewriteValueRISCV64_OpLsh8x64(v *Value) bool {
  1934  	v_1 := v.Args[1]
  1935  	v_0 := v.Args[0]
  1936  	b := v.Block
  1937  	// match: (Lsh8x64 <t> x y)
  1938  	// result: (AND (SLL <t> x y) (Neg8 <t> (SLTIU <t> [64] y)))
  1939  	for {
  1940  		t := v.Type
  1941  		x := v_0
  1942  		y := v_1
  1943  		v.reset(OpRISCV64AND)
  1944  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1945  		v0.AddArg2(x, y)
  1946  		v1 := b.NewValue0(v.Pos, OpNeg8, t)
  1947  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1948  		v2.AuxInt = int64ToAuxInt(64)
  1949  		v2.AddArg(y)
  1950  		v1.AddArg(v2)
  1951  		v.AddArg2(v0, v1)
  1952  		return true
  1953  	}
  1954  }
  1955  func rewriteValueRISCV64_OpLsh8x8(v *Value) bool {
  1956  	v_1 := v.Args[1]
  1957  	v_0 := v.Args[0]
  1958  	b := v.Block
  1959  	typ := &b.Func.Config.Types
  1960  	// match: (Lsh8x8 <t> x y)
  1961  	// result: (AND (SLL <t> x y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt8to64 y))))
  1962  	for {
  1963  		t := v.Type
  1964  		x := v_0
  1965  		y := v_1
  1966  		v.reset(OpRISCV64AND)
  1967  		v0 := b.NewValue0(v.Pos, OpRISCV64SLL, t)
  1968  		v0.AddArg2(x, y)
  1969  		v1 := b.NewValue0(v.Pos, OpNeg8, t)
  1970  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  1971  		v2.AuxInt = int64ToAuxInt(64)
  1972  		v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  1973  		v3.AddArg(y)
  1974  		v2.AddArg(v3)
  1975  		v1.AddArg(v2)
  1976  		v.AddArg2(v0, v1)
  1977  		return true
  1978  	}
  1979  }
  1980  func rewriteValueRISCV64_OpMod16(v *Value) bool {
  1981  	v_1 := v.Args[1]
  1982  	v_0 := v.Args[0]
  1983  	b := v.Block
  1984  	typ := &b.Func.Config.Types
  1985  	// match: (Mod16 x y [false])
  1986  	// result: (REMW (SignExt16to32 x) (SignExt16to32 y))
  1987  	for {
  1988  		if auxIntToBool(v.AuxInt) != false {
  1989  			break
  1990  		}
  1991  		x := v_0
  1992  		y := v_1
  1993  		v.reset(OpRISCV64REMW)
  1994  		v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
  1995  		v0.AddArg(x)
  1996  		v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
  1997  		v1.AddArg(y)
  1998  		v.AddArg2(v0, v1)
  1999  		return true
  2000  	}
  2001  	return false
  2002  }
  2003  func rewriteValueRISCV64_OpMod16u(v *Value) bool {
  2004  	v_1 := v.Args[1]
  2005  	v_0 := v.Args[0]
  2006  	b := v.Block
  2007  	typ := &b.Func.Config.Types
  2008  	// match: (Mod16u x y)
  2009  	// result: (REMUW (ZeroExt16to32 x) (ZeroExt16to32 y))
  2010  	for {
  2011  		x := v_0
  2012  		y := v_1
  2013  		v.reset(OpRISCV64REMUW)
  2014  		v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
  2015  		v0.AddArg(x)
  2016  		v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
  2017  		v1.AddArg(y)
  2018  		v.AddArg2(v0, v1)
  2019  		return true
  2020  	}
  2021  }
  2022  func rewriteValueRISCV64_OpMod32(v *Value) bool {
  2023  	v_1 := v.Args[1]
  2024  	v_0 := v.Args[0]
  2025  	// match: (Mod32 x y [false])
  2026  	// result: (REMW x y)
  2027  	for {
  2028  		if auxIntToBool(v.AuxInt) != false {
  2029  			break
  2030  		}
  2031  		x := v_0
  2032  		y := v_1
  2033  		v.reset(OpRISCV64REMW)
  2034  		v.AddArg2(x, y)
  2035  		return true
  2036  	}
  2037  	return false
  2038  }
  2039  func rewriteValueRISCV64_OpMod64(v *Value) bool {
  2040  	v_1 := v.Args[1]
  2041  	v_0 := v.Args[0]
  2042  	// match: (Mod64 x y [false])
  2043  	// result: (REM x y)
  2044  	for {
  2045  		if auxIntToBool(v.AuxInt) != false {
  2046  			break
  2047  		}
  2048  		x := v_0
  2049  		y := v_1
  2050  		v.reset(OpRISCV64REM)
  2051  		v.AddArg2(x, y)
  2052  		return true
  2053  	}
  2054  	return false
  2055  }
  2056  func rewriteValueRISCV64_OpMod8(v *Value) bool {
  2057  	v_1 := v.Args[1]
  2058  	v_0 := v.Args[0]
  2059  	b := v.Block
  2060  	typ := &b.Func.Config.Types
  2061  	// match: (Mod8 x y)
  2062  	// result: (REMW (SignExt8to32 x) (SignExt8to32 y))
  2063  	for {
  2064  		x := v_0
  2065  		y := v_1
  2066  		v.reset(OpRISCV64REMW)
  2067  		v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
  2068  		v0.AddArg(x)
  2069  		v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
  2070  		v1.AddArg(y)
  2071  		v.AddArg2(v0, v1)
  2072  		return true
  2073  	}
  2074  }
  2075  func rewriteValueRISCV64_OpMod8u(v *Value) bool {
  2076  	v_1 := v.Args[1]
  2077  	v_0 := v.Args[0]
  2078  	b := v.Block
  2079  	typ := &b.Func.Config.Types
  2080  	// match: (Mod8u x y)
  2081  	// result: (REMUW (ZeroExt8to32 x) (ZeroExt8to32 y))
  2082  	for {
  2083  		x := v_0
  2084  		y := v_1
  2085  		v.reset(OpRISCV64REMUW)
  2086  		v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
  2087  		v0.AddArg(x)
  2088  		v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
  2089  		v1.AddArg(y)
  2090  		v.AddArg2(v0, v1)
  2091  		return true
  2092  	}
  2093  }
  2094  func rewriteValueRISCV64_OpMove(v *Value) bool {
  2095  	v_2 := v.Args[2]
  2096  	v_1 := v.Args[1]
  2097  	v_0 := v.Args[0]
  2098  	b := v.Block
  2099  	config := b.Func.Config
  2100  	typ := &b.Func.Config.Types
  2101  	// match: (Move [0] _ _ mem)
  2102  	// result: mem
  2103  	for {
  2104  		if auxIntToInt64(v.AuxInt) != 0 {
  2105  			break
  2106  		}
  2107  		mem := v_2
  2108  		v.copyOf(mem)
  2109  		return true
  2110  	}
  2111  	// match: (Move [1] dst src mem)
  2112  	// result: (MOVBstore dst (MOVBload src mem) mem)
  2113  	for {
  2114  		if auxIntToInt64(v.AuxInt) != 1 {
  2115  			break
  2116  		}
  2117  		dst := v_0
  2118  		src := v_1
  2119  		mem := v_2
  2120  		v.reset(OpRISCV64MOVBstore)
  2121  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2122  		v0.AddArg2(src, mem)
  2123  		v.AddArg3(dst, v0, mem)
  2124  		return true
  2125  	}
  2126  	// match: (Move [2] {t} dst src mem)
  2127  	// cond: t.Alignment()%2 == 0
  2128  	// result: (MOVHstore dst (MOVHload src mem) mem)
  2129  	for {
  2130  		if auxIntToInt64(v.AuxInt) != 2 {
  2131  			break
  2132  		}
  2133  		t := auxToType(v.Aux)
  2134  		dst := v_0
  2135  		src := v_1
  2136  		mem := v_2
  2137  		if !(t.Alignment()%2 == 0) {
  2138  			break
  2139  		}
  2140  		v.reset(OpRISCV64MOVHstore)
  2141  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2142  		v0.AddArg2(src, mem)
  2143  		v.AddArg3(dst, v0, mem)
  2144  		return true
  2145  	}
  2146  	// match: (Move [2] dst src mem)
  2147  	// result: (MOVBstore [1] dst (MOVBload [1] src mem) (MOVBstore dst (MOVBload src mem) mem))
  2148  	for {
  2149  		if auxIntToInt64(v.AuxInt) != 2 {
  2150  			break
  2151  		}
  2152  		dst := v_0
  2153  		src := v_1
  2154  		mem := v_2
  2155  		v.reset(OpRISCV64MOVBstore)
  2156  		v.AuxInt = int32ToAuxInt(1)
  2157  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2158  		v0.AuxInt = int32ToAuxInt(1)
  2159  		v0.AddArg2(src, mem)
  2160  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  2161  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2162  		v2.AddArg2(src, mem)
  2163  		v1.AddArg3(dst, v2, mem)
  2164  		v.AddArg3(dst, v0, v1)
  2165  		return true
  2166  	}
  2167  	// match: (Move [4] {t} dst src mem)
  2168  	// cond: t.Alignment()%4 == 0
  2169  	// result: (MOVWstore dst (MOVWload src mem) mem)
  2170  	for {
  2171  		if auxIntToInt64(v.AuxInt) != 4 {
  2172  			break
  2173  		}
  2174  		t := auxToType(v.Aux)
  2175  		dst := v_0
  2176  		src := v_1
  2177  		mem := v_2
  2178  		if !(t.Alignment()%4 == 0) {
  2179  			break
  2180  		}
  2181  		v.reset(OpRISCV64MOVWstore)
  2182  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVWload, typ.Int32)
  2183  		v0.AddArg2(src, mem)
  2184  		v.AddArg3(dst, v0, mem)
  2185  		return true
  2186  	}
  2187  	// match: (Move [4] {t} dst src mem)
  2188  	// cond: t.Alignment()%2 == 0
  2189  	// result: (MOVHstore [2] dst (MOVHload [2] src mem) (MOVHstore dst (MOVHload src mem) mem))
  2190  	for {
  2191  		if auxIntToInt64(v.AuxInt) != 4 {
  2192  			break
  2193  		}
  2194  		t := auxToType(v.Aux)
  2195  		dst := v_0
  2196  		src := v_1
  2197  		mem := v_2
  2198  		if !(t.Alignment()%2 == 0) {
  2199  			break
  2200  		}
  2201  		v.reset(OpRISCV64MOVHstore)
  2202  		v.AuxInt = int32ToAuxInt(2)
  2203  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2204  		v0.AuxInt = int32ToAuxInt(2)
  2205  		v0.AddArg2(src, mem)
  2206  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  2207  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2208  		v2.AddArg2(src, mem)
  2209  		v1.AddArg3(dst, v2, mem)
  2210  		v.AddArg3(dst, v0, v1)
  2211  		return true
  2212  	}
  2213  	// match: (Move [4] dst src mem)
  2214  	// result: (MOVBstore [3] dst (MOVBload [3] src mem) (MOVBstore [2] dst (MOVBload [2] src mem) (MOVBstore [1] dst (MOVBload [1] src mem) (MOVBstore dst (MOVBload src mem) mem))))
  2215  	for {
  2216  		if auxIntToInt64(v.AuxInt) != 4 {
  2217  			break
  2218  		}
  2219  		dst := v_0
  2220  		src := v_1
  2221  		mem := v_2
  2222  		v.reset(OpRISCV64MOVBstore)
  2223  		v.AuxInt = int32ToAuxInt(3)
  2224  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2225  		v0.AuxInt = int32ToAuxInt(3)
  2226  		v0.AddArg2(src, mem)
  2227  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  2228  		v1.AuxInt = int32ToAuxInt(2)
  2229  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2230  		v2.AuxInt = int32ToAuxInt(2)
  2231  		v2.AddArg2(src, mem)
  2232  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  2233  		v3.AuxInt = int32ToAuxInt(1)
  2234  		v4 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2235  		v4.AuxInt = int32ToAuxInt(1)
  2236  		v4.AddArg2(src, mem)
  2237  		v5 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  2238  		v6 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2239  		v6.AddArg2(src, mem)
  2240  		v5.AddArg3(dst, v6, mem)
  2241  		v3.AddArg3(dst, v4, v5)
  2242  		v1.AddArg3(dst, v2, v3)
  2243  		v.AddArg3(dst, v0, v1)
  2244  		return true
  2245  	}
  2246  	// match: (Move [8] {t} dst src mem)
  2247  	// cond: t.Alignment()%8 == 0
  2248  	// result: (MOVDstore dst (MOVDload src mem) mem)
  2249  	for {
  2250  		if auxIntToInt64(v.AuxInt) != 8 {
  2251  			break
  2252  		}
  2253  		t := auxToType(v.Aux)
  2254  		dst := v_0
  2255  		src := v_1
  2256  		mem := v_2
  2257  		if !(t.Alignment()%8 == 0) {
  2258  			break
  2259  		}
  2260  		v.reset(OpRISCV64MOVDstore)
  2261  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2262  		v0.AddArg2(src, mem)
  2263  		v.AddArg3(dst, v0, mem)
  2264  		return true
  2265  	}
  2266  	// match: (Move [8] {t} dst src mem)
  2267  	// cond: t.Alignment()%4 == 0
  2268  	// result: (MOVWstore [4] dst (MOVWload [4] src mem) (MOVWstore dst (MOVWload src mem) mem))
  2269  	for {
  2270  		if auxIntToInt64(v.AuxInt) != 8 {
  2271  			break
  2272  		}
  2273  		t := auxToType(v.Aux)
  2274  		dst := v_0
  2275  		src := v_1
  2276  		mem := v_2
  2277  		if !(t.Alignment()%4 == 0) {
  2278  			break
  2279  		}
  2280  		v.reset(OpRISCV64MOVWstore)
  2281  		v.AuxInt = int32ToAuxInt(4)
  2282  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVWload, typ.Int32)
  2283  		v0.AuxInt = int32ToAuxInt(4)
  2284  		v0.AddArg2(src, mem)
  2285  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVWstore, types.TypeMem)
  2286  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVWload, typ.Int32)
  2287  		v2.AddArg2(src, mem)
  2288  		v1.AddArg3(dst, v2, mem)
  2289  		v.AddArg3(dst, v0, v1)
  2290  		return true
  2291  	}
  2292  	// match: (Move [8] {t} dst src mem)
  2293  	// cond: t.Alignment()%2 == 0
  2294  	// result: (MOVHstore [6] dst (MOVHload [6] src mem) (MOVHstore [4] dst (MOVHload [4] src mem) (MOVHstore [2] dst (MOVHload [2] src mem) (MOVHstore dst (MOVHload src mem) mem))))
  2295  	for {
  2296  		if auxIntToInt64(v.AuxInt) != 8 {
  2297  			break
  2298  		}
  2299  		t := auxToType(v.Aux)
  2300  		dst := v_0
  2301  		src := v_1
  2302  		mem := v_2
  2303  		if !(t.Alignment()%2 == 0) {
  2304  			break
  2305  		}
  2306  		v.reset(OpRISCV64MOVHstore)
  2307  		v.AuxInt = int32ToAuxInt(6)
  2308  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2309  		v0.AuxInt = int32ToAuxInt(6)
  2310  		v0.AddArg2(src, mem)
  2311  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  2312  		v1.AuxInt = int32ToAuxInt(4)
  2313  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2314  		v2.AuxInt = int32ToAuxInt(4)
  2315  		v2.AddArg2(src, mem)
  2316  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  2317  		v3.AuxInt = int32ToAuxInt(2)
  2318  		v4 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2319  		v4.AuxInt = int32ToAuxInt(2)
  2320  		v4.AddArg2(src, mem)
  2321  		v5 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  2322  		v6 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2323  		v6.AddArg2(src, mem)
  2324  		v5.AddArg3(dst, v6, mem)
  2325  		v3.AddArg3(dst, v4, v5)
  2326  		v1.AddArg3(dst, v2, v3)
  2327  		v.AddArg3(dst, v0, v1)
  2328  		return true
  2329  	}
  2330  	// match: (Move [3] dst src mem)
  2331  	// result: (MOVBstore [2] dst (MOVBload [2] src mem) (MOVBstore [1] dst (MOVBload [1] src mem) (MOVBstore dst (MOVBload src mem) mem)))
  2332  	for {
  2333  		if auxIntToInt64(v.AuxInt) != 3 {
  2334  			break
  2335  		}
  2336  		dst := v_0
  2337  		src := v_1
  2338  		mem := v_2
  2339  		v.reset(OpRISCV64MOVBstore)
  2340  		v.AuxInt = int32ToAuxInt(2)
  2341  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2342  		v0.AuxInt = int32ToAuxInt(2)
  2343  		v0.AddArg2(src, mem)
  2344  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  2345  		v1.AuxInt = int32ToAuxInt(1)
  2346  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2347  		v2.AuxInt = int32ToAuxInt(1)
  2348  		v2.AddArg2(src, mem)
  2349  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  2350  		v4 := b.NewValue0(v.Pos, OpRISCV64MOVBload, typ.Int8)
  2351  		v4.AddArg2(src, mem)
  2352  		v3.AddArg3(dst, v4, mem)
  2353  		v1.AddArg3(dst, v2, v3)
  2354  		v.AddArg3(dst, v0, v1)
  2355  		return true
  2356  	}
  2357  	// match: (Move [6] {t} dst src mem)
  2358  	// cond: t.Alignment()%2 == 0
  2359  	// result: (MOVHstore [4] dst (MOVHload [4] src mem) (MOVHstore [2] dst (MOVHload [2] src mem) (MOVHstore dst (MOVHload src mem) mem)))
  2360  	for {
  2361  		if auxIntToInt64(v.AuxInt) != 6 {
  2362  			break
  2363  		}
  2364  		t := auxToType(v.Aux)
  2365  		dst := v_0
  2366  		src := v_1
  2367  		mem := v_2
  2368  		if !(t.Alignment()%2 == 0) {
  2369  			break
  2370  		}
  2371  		v.reset(OpRISCV64MOVHstore)
  2372  		v.AuxInt = int32ToAuxInt(4)
  2373  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2374  		v0.AuxInt = int32ToAuxInt(4)
  2375  		v0.AddArg2(src, mem)
  2376  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  2377  		v1.AuxInt = int32ToAuxInt(2)
  2378  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2379  		v2.AuxInt = int32ToAuxInt(2)
  2380  		v2.AddArg2(src, mem)
  2381  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  2382  		v4 := b.NewValue0(v.Pos, OpRISCV64MOVHload, typ.Int16)
  2383  		v4.AddArg2(src, mem)
  2384  		v3.AddArg3(dst, v4, mem)
  2385  		v1.AddArg3(dst, v2, v3)
  2386  		v.AddArg3(dst, v0, v1)
  2387  		return true
  2388  	}
  2389  	// match: (Move [12] {t} dst src mem)
  2390  	// cond: t.Alignment()%4 == 0
  2391  	// result: (MOVWstore [8] dst (MOVWload [8] src mem) (MOVWstore [4] dst (MOVWload [4] src mem) (MOVWstore dst (MOVWload src mem) mem)))
  2392  	for {
  2393  		if auxIntToInt64(v.AuxInt) != 12 {
  2394  			break
  2395  		}
  2396  		t := auxToType(v.Aux)
  2397  		dst := v_0
  2398  		src := v_1
  2399  		mem := v_2
  2400  		if !(t.Alignment()%4 == 0) {
  2401  			break
  2402  		}
  2403  		v.reset(OpRISCV64MOVWstore)
  2404  		v.AuxInt = int32ToAuxInt(8)
  2405  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVWload, typ.Int32)
  2406  		v0.AuxInt = int32ToAuxInt(8)
  2407  		v0.AddArg2(src, mem)
  2408  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVWstore, types.TypeMem)
  2409  		v1.AuxInt = int32ToAuxInt(4)
  2410  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVWload, typ.Int32)
  2411  		v2.AuxInt = int32ToAuxInt(4)
  2412  		v2.AddArg2(src, mem)
  2413  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVWstore, types.TypeMem)
  2414  		v4 := b.NewValue0(v.Pos, OpRISCV64MOVWload, typ.Int32)
  2415  		v4.AddArg2(src, mem)
  2416  		v3.AddArg3(dst, v4, mem)
  2417  		v1.AddArg3(dst, v2, v3)
  2418  		v.AddArg3(dst, v0, v1)
  2419  		return true
  2420  	}
  2421  	// match: (Move [16] {t} dst src mem)
  2422  	// cond: t.Alignment()%8 == 0
  2423  	// result: (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem))
  2424  	for {
  2425  		if auxIntToInt64(v.AuxInt) != 16 {
  2426  			break
  2427  		}
  2428  		t := auxToType(v.Aux)
  2429  		dst := v_0
  2430  		src := v_1
  2431  		mem := v_2
  2432  		if !(t.Alignment()%8 == 0) {
  2433  			break
  2434  		}
  2435  		v.reset(OpRISCV64MOVDstore)
  2436  		v.AuxInt = int32ToAuxInt(8)
  2437  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2438  		v0.AuxInt = int32ToAuxInt(8)
  2439  		v0.AddArg2(src, mem)
  2440  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  2441  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2442  		v2.AddArg2(src, mem)
  2443  		v1.AddArg3(dst, v2, mem)
  2444  		v.AddArg3(dst, v0, v1)
  2445  		return true
  2446  	}
  2447  	// match: (Move [24] {t} dst src mem)
  2448  	// cond: t.Alignment()%8 == 0
  2449  	// result: (MOVDstore [16] dst (MOVDload [16] src mem) (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem)))
  2450  	for {
  2451  		if auxIntToInt64(v.AuxInt) != 24 {
  2452  			break
  2453  		}
  2454  		t := auxToType(v.Aux)
  2455  		dst := v_0
  2456  		src := v_1
  2457  		mem := v_2
  2458  		if !(t.Alignment()%8 == 0) {
  2459  			break
  2460  		}
  2461  		v.reset(OpRISCV64MOVDstore)
  2462  		v.AuxInt = int32ToAuxInt(16)
  2463  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2464  		v0.AuxInt = int32ToAuxInt(16)
  2465  		v0.AddArg2(src, mem)
  2466  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  2467  		v1.AuxInt = int32ToAuxInt(8)
  2468  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2469  		v2.AuxInt = int32ToAuxInt(8)
  2470  		v2.AddArg2(src, mem)
  2471  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  2472  		v4 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2473  		v4.AddArg2(src, mem)
  2474  		v3.AddArg3(dst, v4, mem)
  2475  		v1.AddArg3(dst, v2, v3)
  2476  		v.AddArg3(dst, v0, v1)
  2477  		return true
  2478  	}
  2479  	// match: (Move [32] {t} dst src mem)
  2480  	// cond: t.Alignment()%8 == 0
  2481  	// result: (MOVDstore [24] dst (MOVDload [24] src mem) (MOVDstore [16] dst (MOVDload [16] src mem) (MOVDstore [8] dst (MOVDload [8] src mem) (MOVDstore dst (MOVDload src mem) mem))))
  2482  	for {
  2483  		if auxIntToInt64(v.AuxInt) != 32 {
  2484  			break
  2485  		}
  2486  		t := auxToType(v.Aux)
  2487  		dst := v_0
  2488  		src := v_1
  2489  		mem := v_2
  2490  		if !(t.Alignment()%8 == 0) {
  2491  			break
  2492  		}
  2493  		v.reset(OpRISCV64MOVDstore)
  2494  		v.AuxInt = int32ToAuxInt(24)
  2495  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2496  		v0.AuxInt = int32ToAuxInt(24)
  2497  		v0.AddArg2(src, mem)
  2498  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  2499  		v1.AuxInt = int32ToAuxInt(16)
  2500  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2501  		v2.AuxInt = int32ToAuxInt(16)
  2502  		v2.AddArg2(src, mem)
  2503  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  2504  		v3.AuxInt = int32ToAuxInt(8)
  2505  		v4 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2506  		v4.AuxInt = int32ToAuxInt(8)
  2507  		v4.AddArg2(src, mem)
  2508  		v5 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  2509  		v6 := b.NewValue0(v.Pos, OpRISCV64MOVDload, typ.Int64)
  2510  		v6.AddArg2(src, mem)
  2511  		v5.AddArg3(dst, v6, mem)
  2512  		v3.AddArg3(dst, v4, v5)
  2513  		v1.AddArg3(dst, v2, v3)
  2514  		v.AddArg3(dst, v0, v1)
  2515  		return true
  2516  	}
  2517  	// match: (Move [s] {t} dst src mem)
  2518  	// cond: s%8 == 0 && s <= 8*128 && t.Alignment()%8 == 0 && !config.noDuffDevice && logLargeCopy(v, s)
  2519  	// result: (DUFFCOPY [16 * (128 - s/8)] dst src mem)
  2520  	for {
  2521  		s := auxIntToInt64(v.AuxInt)
  2522  		t := auxToType(v.Aux)
  2523  		dst := v_0
  2524  		src := v_1
  2525  		mem := v_2
  2526  		if !(s%8 == 0 && s <= 8*128 && t.Alignment()%8 == 0 && !config.noDuffDevice && logLargeCopy(v, s)) {
  2527  			break
  2528  		}
  2529  		v.reset(OpRISCV64DUFFCOPY)
  2530  		v.AuxInt = int64ToAuxInt(16 * (128 - s/8))
  2531  		v.AddArg3(dst, src, mem)
  2532  		return true
  2533  	}
  2534  	// match: (Move [s] {t} dst src mem)
  2535  	// cond: (s <= 16 || logLargeCopy(v, s))
  2536  	// result: (LoweredMove [t.Alignment()] dst src (ADDI <src.Type> [s-moveSize(t.Alignment(), config)] src) mem)
  2537  	for {
  2538  		s := auxIntToInt64(v.AuxInt)
  2539  		t := auxToType(v.Aux)
  2540  		dst := v_0
  2541  		src := v_1
  2542  		mem := v_2
  2543  		if !(s <= 16 || logLargeCopy(v, s)) {
  2544  			break
  2545  		}
  2546  		v.reset(OpRISCV64LoweredMove)
  2547  		v.AuxInt = int64ToAuxInt(t.Alignment())
  2548  		v0 := b.NewValue0(v.Pos, OpRISCV64ADDI, src.Type)
  2549  		v0.AuxInt = int64ToAuxInt(s - moveSize(t.Alignment(), config))
  2550  		v0.AddArg(src)
  2551  		v.AddArg4(dst, src, v0, mem)
  2552  		return true
  2553  	}
  2554  	return false
  2555  }
  2556  func rewriteValueRISCV64_OpMul16(v *Value) bool {
  2557  	v_1 := v.Args[1]
  2558  	v_0 := v.Args[0]
  2559  	b := v.Block
  2560  	typ := &b.Func.Config.Types
  2561  	// match: (Mul16 x y)
  2562  	// result: (MULW (SignExt16to32 x) (SignExt16to32 y))
  2563  	for {
  2564  		x := v_0
  2565  		y := v_1
  2566  		v.reset(OpRISCV64MULW)
  2567  		v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
  2568  		v0.AddArg(x)
  2569  		v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
  2570  		v1.AddArg(y)
  2571  		v.AddArg2(v0, v1)
  2572  		return true
  2573  	}
  2574  }
  2575  func rewriteValueRISCV64_OpMul8(v *Value) bool {
  2576  	v_1 := v.Args[1]
  2577  	v_0 := v.Args[0]
  2578  	b := v.Block
  2579  	typ := &b.Func.Config.Types
  2580  	// match: (Mul8 x y)
  2581  	// result: (MULW (SignExt8to32 x) (SignExt8to32 y))
  2582  	for {
  2583  		x := v_0
  2584  		y := v_1
  2585  		v.reset(OpRISCV64MULW)
  2586  		v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
  2587  		v0.AddArg(x)
  2588  		v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
  2589  		v1.AddArg(y)
  2590  		v.AddArg2(v0, v1)
  2591  		return true
  2592  	}
  2593  }
  2594  func rewriteValueRISCV64_OpNeq16(v *Value) bool {
  2595  	v_1 := v.Args[1]
  2596  	v_0 := v.Args[0]
  2597  	b := v.Block
  2598  	typ := &b.Func.Config.Types
  2599  	// match: (Neq16 x y)
  2600  	// result: (SNEZ (SUB <x.Type> (ZeroExt16to64 x) (ZeroExt16to64 y)))
  2601  	for {
  2602  		x := v_0
  2603  		y := v_1
  2604  		v.reset(OpRISCV64SNEZ)
  2605  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
  2606  		v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  2607  		v1.AddArg(x)
  2608  		v2 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  2609  		v2.AddArg(y)
  2610  		v0.AddArg2(v1, v2)
  2611  		v.AddArg(v0)
  2612  		return true
  2613  	}
  2614  }
  2615  func rewriteValueRISCV64_OpNeq32(v *Value) bool {
  2616  	v_1 := v.Args[1]
  2617  	v_0 := v.Args[0]
  2618  	b := v.Block
  2619  	typ := &b.Func.Config.Types
  2620  	// match: (Neq32 x y)
  2621  	// result: (SNEZ (SUB <x.Type> (ZeroExt32to64 x) (ZeroExt32to64 y)))
  2622  	for {
  2623  		x := v_0
  2624  		y := v_1
  2625  		v.reset(OpRISCV64SNEZ)
  2626  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
  2627  		v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  2628  		v1.AddArg(x)
  2629  		v2 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  2630  		v2.AddArg(y)
  2631  		v0.AddArg2(v1, v2)
  2632  		v.AddArg(v0)
  2633  		return true
  2634  	}
  2635  }
  2636  func rewriteValueRISCV64_OpNeq64(v *Value) bool {
  2637  	v_1 := v.Args[1]
  2638  	v_0 := v.Args[0]
  2639  	b := v.Block
  2640  	// match: (Neq64 x y)
  2641  	// result: (SNEZ (SUB <x.Type> x y))
  2642  	for {
  2643  		x := v_0
  2644  		y := v_1
  2645  		v.reset(OpRISCV64SNEZ)
  2646  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
  2647  		v0.AddArg2(x, y)
  2648  		v.AddArg(v0)
  2649  		return true
  2650  	}
  2651  }
  2652  func rewriteValueRISCV64_OpNeq8(v *Value) bool {
  2653  	v_1 := v.Args[1]
  2654  	v_0 := v.Args[0]
  2655  	b := v.Block
  2656  	typ := &b.Func.Config.Types
  2657  	// match: (Neq8 x y)
  2658  	// result: (SNEZ (SUB <x.Type> (ZeroExt8to64 x) (ZeroExt8to64 y)))
  2659  	for {
  2660  		x := v_0
  2661  		y := v_1
  2662  		v.reset(OpRISCV64SNEZ)
  2663  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
  2664  		v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  2665  		v1.AddArg(x)
  2666  		v2 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  2667  		v2.AddArg(y)
  2668  		v0.AddArg2(v1, v2)
  2669  		v.AddArg(v0)
  2670  		return true
  2671  	}
  2672  }
  2673  func rewriteValueRISCV64_OpNeqPtr(v *Value) bool {
  2674  	v_1 := v.Args[1]
  2675  	v_0 := v.Args[0]
  2676  	b := v.Block
  2677  	typ := &b.Func.Config.Types
  2678  	// match: (NeqPtr x y)
  2679  	// result: (SNEZ (SUB <typ.Uintptr> x y))
  2680  	for {
  2681  		x := v_0
  2682  		y := v_1
  2683  		v.reset(OpRISCV64SNEZ)
  2684  		v0 := b.NewValue0(v.Pos, OpRISCV64SUB, typ.Uintptr)
  2685  		v0.AddArg2(x, y)
  2686  		v.AddArg(v0)
  2687  		return true
  2688  	}
  2689  }
  2690  func rewriteValueRISCV64_OpOffPtr(v *Value) bool {
  2691  	v_0 := v.Args[0]
  2692  	b := v.Block
  2693  	typ := &b.Func.Config.Types
  2694  	// match: (OffPtr [off] ptr:(SP))
  2695  	// cond: is32Bit(off)
  2696  	// result: (MOVaddr [int32(off)] ptr)
  2697  	for {
  2698  		off := auxIntToInt64(v.AuxInt)
  2699  		ptr := v_0
  2700  		if ptr.Op != OpSP || !(is32Bit(off)) {
  2701  			break
  2702  		}
  2703  		v.reset(OpRISCV64MOVaddr)
  2704  		v.AuxInt = int32ToAuxInt(int32(off))
  2705  		v.AddArg(ptr)
  2706  		return true
  2707  	}
  2708  	// match: (OffPtr [off] ptr)
  2709  	// cond: is32Bit(off)
  2710  	// result: (ADDI [off] ptr)
  2711  	for {
  2712  		off := auxIntToInt64(v.AuxInt)
  2713  		ptr := v_0
  2714  		if !(is32Bit(off)) {
  2715  			break
  2716  		}
  2717  		v.reset(OpRISCV64ADDI)
  2718  		v.AuxInt = int64ToAuxInt(off)
  2719  		v.AddArg(ptr)
  2720  		return true
  2721  	}
  2722  	// match: (OffPtr [off] ptr)
  2723  	// result: (ADD (MOVDconst [off]) ptr)
  2724  	for {
  2725  		off := auxIntToInt64(v.AuxInt)
  2726  		ptr := v_0
  2727  		v.reset(OpRISCV64ADD)
  2728  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  2729  		v0.AuxInt = int64ToAuxInt(off)
  2730  		v.AddArg2(v0, ptr)
  2731  		return true
  2732  	}
  2733  }
  2734  func rewriteValueRISCV64_OpPanicBounds(v *Value) bool {
  2735  	v_2 := v.Args[2]
  2736  	v_1 := v.Args[1]
  2737  	v_0 := v.Args[0]
  2738  	// match: (PanicBounds [kind] x y mem)
  2739  	// cond: boundsABI(kind) == 0
  2740  	// result: (LoweredPanicBoundsA [kind] x y mem)
  2741  	for {
  2742  		kind := auxIntToInt64(v.AuxInt)
  2743  		x := v_0
  2744  		y := v_1
  2745  		mem := v_2
  2746  		if !(boundsABI(kind) == 0) {
  2747  			break
  2748  		}
  2749  		v.reset(OpRISCV64LoweredPanicBoundsA)
  2750  		v.AuxInt = int64ToAuxInt(kind)
  2751  		v.AddArg3(x, y, mem)
  2752  		return true
  2753  	}
  2754  	// match: (PanicBounds [kind] x y mem)
  2755  	// cond: boundsABI(kind) == 1
  2756  	// result: (LoweredPanicBoundsB [kind] x y mem)
  2757  	for {
  2758  		kind := auxIntToInt64(v.AuxInt)
  2759  		x := v_0
  2760  		y := v_1
  2761  		mem := v_2
  2762  		if !(boundsABI(kind) == 1) {
  2763  			break
  2764  		}
  2765  		v.reset(OpRISCV64LoweredPanicBoundsB)
  2766  		v.AuxInt = int64ToAuxInt(kind)
  2767  		v.AddArg3(x, y, mem)
  2768  		return true
  2769  	}
  2770  	// match: (PanicBounds [kind] x y mem)
  2771  	// cond: boundsABI(kind) == 2
  2772  	// result: (LoweredPanicBoundsC [kind] x y mem)
  2773  	for {
  2774  		kind := auxIntToInt64(v.AuxInt)
  2775  		x := v_0
  2776  		y := v_1
  2777  		mem := v_2
  2778  		if !(boundsABI(kind) == 2) {
  2779  			break
  2780  		}
  2781  		v.reset(OpRISCV64LoweredPanicBoundsC)
  2782  		v.AuxInt = int64ToAuxInt(kind)
  2783  		v.AddArg3(x, y, mem)
  2784  		return true
  2785  	}
  2786  	return false
  2787  }
  2788  func rewriteValueRISCV64_OpRISCV64ADD(v *Value) bool {
  2789  	v_1 := v.Args[1]
  2790  	v_0 := v.Args[0]
  2791  	// match: (ADD (MOVDconst [val]) x)
  2792  	// cond: is32Bit(val)
  2793  	// result: (ADDI [val] x)
  2794  	for {
  2795  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
  2796  			if v_0.Op != OpRISCV64MOVDconst {
  2797  				continue
  2798  			}
  2799  			val := auxIntToInt64(v_0.AuxInt)
  2800  			x := v_1
  2801  			if !(is32Bit(val)) {
  2802  				continue
  2803  			}
  2804  			v.reset(OpRISCV64ADDI)
  2805  			v.AuxInt = int64ToAuxInt(val)
  2806  			v.AddArg(x)
  2807  			return true
  2808  		}
  2809  		break
  2810  	}
  2811  	return false
  2812  }
  2813  func rewriteValueRISCV64_OpRISCV64ADDI(v *Value) bool {
  2814  	v_0 := v.Args[0]
  2815  	// match: (ADDI [c] (MOVaddr [d] {s} x))
  2816  	// cond: is32Bit(c+int64(d))
  2817  	// result: (MOVaddr [int32(c)+d] {s} x)
  2818  	for {
  2819  		c := auxIntToInt64(v.AuxInt)
  2820  		if v_0.Op != OpRISCV64MOVaddr {
  2821  			break
  2822  		}
  2823  		d := auxIntToInt32(v_0.AuxInt)
  2824  		s := auxToSym(v_0.Aux)
  2825  		x := v_0.Args[0]
  2826  		if !(is32Bit(c + int64(d))) {
  2827  			break
  2828  		}
  2829  		v.reset(OpRISCV64MOVaddr)
  2830  		v.AuxInt = int32ToAuxInt(int32(c) + d)
  2831  		v.Aux = symToAux(s)
  2832  		v.AddArg(x)
  2833  		return true
  2834  	}
  2835  	// match: (ADDI [0] x)
  2836  	// result: x
  2837  	for {
  2838  		if auxIntToInt64(v.AuxInt) != 0 {
  2839  			break
  2840  		}
  2841  		x := v_0
  2842  		v.copyOf(x)
  2843  		return true
  2844  	}
  2845  	// match: (ADDI [x] (MOVDconst [y]))
  2846  	// cond: is32Bit(x + y)
  2847  	// result: (MOVDconst [x + y])
  2848  	for {
  2849  		x := auxIntToInt64(v.AuxInt)
  2850  		if v_0.Op != OpRISCV64MOVDconst {
  2851  			break
  2852  		}
  2853  		y := auxIntToInt64(v_0.AuxInt)
  2854  		if !(is32Bit(x + y)) {
  2855  			break
  2856  		}
  2857  		v.reset(OpRISCV64MOVDconst)
  2858  		v.AuxInt = int64ToAuxInt(x + y)
  2859  		return true
  2860  	}
  2861  	return false
  2862  }
  2863  func rewriteValueRISCV64_OpRISCV64AND(v *Value) bool {
  2864  	v_1 := v.Args[1]
  2865  	v_0 := v.Args[0]
  2866  	// match: (AND (MOVDconst [val]) x)
  2867  	// cond: is32Bit(val)
  2868  	// result: (ANDI [val] x)
  2869  	for {
  2870  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
  2871  			if v_0.Op != OpRISCV64MOVDconst {
  2872  				continue
  2873  			}
  2874  			val := auxIntToInt64(v_0.AuxInt)
  2875  			x := v_1
  2876  			if !(is32Bit(val)) {
  2877  				continue
  2878  			}
  2879  			v.reset(OpRISCV64ANDI)
  2880  			v.AuxInt = int64ToAuxInt(val)
  2881  			v.AddArg(x)
  2882  			return true
  2883  		}
  2884  		break
  2885  	}
  2886  	return false
  2887  }
  2888  func rewriteValueRISCV64_OpRISCV64ANDI(v *Value) bool {
  2889  	v_0 := v.Args[0]
  2890  	// match: (ANDI [0] x)
  2891  	// result: (MOVDconst [0])
  2892  	for {
  2893  		if auxIntToInt64(v.AuxInt) != 0 {
  2894  			break
  2895  		}
  2896  		v.reset(OpRISCV64MOVDconst)
  2897  		v.AuxInt = int64ToAuxInt(0)
  2898  		return true
  2899  	}
  2900  	// match: (ANDI [-1] x)
  2901  	// result: x
  2902  	for {
  2903  		if auxIntToInt64(v.AuxInt) != -1 {
  2904  			break
  2905  		}
  2906  		x := v_0
  2907  		v.copyOf(x)
  2908  		return true
  2909  	}
  2910  	// match: (ANDI [x] (MOVDconst [y]))
  2911  	// result: (MOVDconst [x & y])
  2912  	for {
  2913  		x := auxIntToInt64(v.AuxInt)
  2914  		if v_0.Op != OpRISCV64MOVDconst {
  2915  			break
  2916  		}
  2917  		y := auxIntToInt64(v_0.AuxInt)
  2918  		v.reset(OpRISCV64MOVDconst)
  2919  		v.AuxInt = int64ToAuxInt(x & y)
  2920  		return true
  2921  	}
  2922  	return false
  2923  }
  2924  func rewriteValueRISCV64_OpRISCV64FMADDD(v *Value) bool {
  2925  	v_2 := v.Args[2]
  2926  	v_1 := v.Args[1]
  2927  	v_0 := v.Args[0]
  2928  	// match: (FMADDD neg:(FNEGD x) y z)
  2929  	// cond: neg.Uses == 1
  2930  	// result: (FNMADDD x y z)
  2931  	for {
  2932  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
  2933  			neg := v_0
  2934  			if neg.Op != OpRISCV64FNEGD {
  2935  				continue
  2936  			}
  2937  			x := neg.Args[0]
  2938  			y := v_1
  2939  			z := v_2
  2940  			if !(neg.Uses == 1) {
  2941  				continue
  2942  			}
  2943  			v.reset(OpRISCV64FNMADDD)
  2944  			v.AddArg3(x, y, z)
  2945  			return true
  2946  		}
  2947  		break
  2948  	}
  2949  	// match: (FMADDD x y neg:(FNEGD z))
  2950  	// cond: neg.Uses == 1
  2951  	// result: (FMSUBD x y z)
  2952  	for {
  2953  		x := v_0
  2954  		y := v_1
  2955  		neg := v_2
  2956  		if neg.Op != OpRISCV64FNEGD {
  2957  			break
  2958  		}
  2959  		z := neg.Args[0]
  2960  		if !(neg.Uses == 1) {
  2961  			break
  2962  		}
  2963  		v.reset(OpRISCV64FMSUBD)
  2964  		v.AddArg3(x, y, z)
  2965  		return true
  2966  	}
  2967  	return false
  2968  }
  2969  func rewriteValueRISCV64_OpRISCV64FMSUBD(v *Value) bool {
  2970  	v_2 := v.Args[2]
  2971  	v_1 := v.Args[1]
  2972  	v_0 := v.Args[0]
  2973  	// match: (FMSUBD neg:(FNEGD x) y z)
  2974  	// cond: neg.Uses == 1
  2975  	// result: (FNMSUBD x y z)
  2976  	for {
  2977  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
  2978  			neg := v_0
  2979  			if neg.Op != OpRISCV64FNEGD {
  2980  				continue
  2981  			}
  2982  			x := neg.Args[0]
  2983  			y := v_1
  2984  			z := v_2
  2985  			if !(neg.Uses == 1) {
  2986  				continue
  2987  			}
  2988  			v.reset(OpRISCV64FNMSUBD)
  2989  			v.AddArg3(x, y, z)
  2990  			return true
  2991  		}
  2992  		break
  2993  	}
  2994  	// match: (FMSUBD x y neg:(FNEGD z))
  2995  	// cond: neg.Uses == 1
  2996  	// result: (FMADDD x y z)
  2997  	for {
  2998  		x := v_0
  2999  		y := v_1
  3000  		neg := v_2
  3001  		if neg.Op != OpRISCV64FNEGD {
  3002  			break
  3003  		}
  3004  		z := neg.Args[0]
  3005  		if !(neg.Uses == 1) {
  3006  			break
  3007  		}
  3008  		v.reset(OpRISCV64FMADDD)
  3009  		v.AddArg3(x, y, z)
  3010  		return true
  3011  	}
  3012  	return false
  3013  }
  3014  func rewriteValueRISCV64_OpRISCV64FNMADDD(v *Value) bool {
  3015  	v_2 := v.Args[2]
  3016  	v_1 := v.Args[1]
  3017  	v_0 := v.Args[0]
  3018  	// match: (FNMADDD neg:(FNEGD x) y z)
  3019  	// cond: neg.Uses == 1
  3020  	// result: (FMADDD x y z)
  3021  	for {
  3022  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
  3023  			neg := v_0
  3024  			if neg.Op != OpRISCV64FNEGD {
  3025  				continue
  3026  			}
  3027  			x := neg.Args[0]
  3028  			y := v_1
  3029  			z := v_2
  3030  			if !(neg.Uses == 1) {
  3031  				continue
  3032  			}
  3033  			v.reset(OpRISCV64FMADDD)
  3034  			v.AddArg3(x, y, z)
  3035  			return true
  3036  		}
  3037  		break
  3038  	}
  3039  	// match: (FNMADDD x y neg:(FNEGD z))
  3040  	// cond: neg.Uses == 1
  3041  	// result: (FNMSUBD x y z)
  3042  	for {
  3043  		x := v_0
  3044  		y := v_1
  3045  		neg := v_2
  3046  		if neg.Op != OpRISCV64FNEGD {
  3047  			break
  3048  		}
  3049  		z := neg.Args[0]
  3050  		if !(neg.Uses == 1) {
  3051  			break
  3052  		}
  3053  		v.reset(OpRISCV64FNMSUBD)
  3054  		v.AddArg3(x, y, z)
  3055  		return true
  3056  	}
  3057  	return false
  3058  }
  3059  func rewriteValueRISCV64_OpRISCV64FNMSUBD(v *Value) bool {
  3060  	v_2 := v.Args[2]
  3061  	v_1 := v.Args[1]
  3062  	v_0 := v.Args[0]
  3063  	// match: (FNMSUBD neg:(FNEGD x) y z)
  3064  	// cond: neg.Uses == 1
  3065  	// result: (FMSUBD x y z)
  3066  	for {
  3067  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
  3068  			neg := v_0
  3069  			if neg.Op != OpRISCV64FNEGD {
  3070  				continue
  3071  			}
  3072  			x := neg.Args[0]
  3073  			y := v_1
  3074  			z := v_2
  3075  			if !(neg.Uses == 1) {
  3076  				continue
  3077  			}
  3078  			v.reset(OpRISCV64FMSUBD)
  3079  			v.AddArg3(x, y, z)
  3080  			return true
  3081  		}
  3082  		break
  3083  	}
  3084  	// match: (FNMSUBD x y neg:(FNEGD z))
  3085  	// cond: neg.Uses == 1
  3086  	// result: (FNMADDD x y z)
  3087  	for {
  3088  		x := v_0
  3089  		y := v_1
  3090  		neg := v_2
  3091  		if neg.Op != OpRISCV64FNEGD {
  3092  			break
  3093  		}
  3094  		z := neg.Args[0]
  3095  		if !(neg.Uses == 1) {
  3096  			break
  3097  		}
  3098  		v.reset(OpRISCV64FNMADDD)
  3099  		v.AddArg3(x, y, z)
  3100  		return true
  3101  	}
  3102  	return false
  3103  }
  3104  func rewriteValueRISCV64_OpRISCV64MOVBUload(v *Value) bool {
  3105  	v_1 := v.Args[1]
  3106  	v_0 := v.Args[0]
  3107  	// match: (MOVBUload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem)
  3108  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  3109  	// result: (MOVBUload [off1+off2] {mergeSym(sym1,sym2)} base mem)
  3110  	for {
  3111  		off1 := auxIntToInt32(v.AuxInt)
  3112  		sym1 := auxToSym(v.Aux)
  3113  		if v_0.Op != OpRISCV64MOVaddr {
  3114  			break
  3115  		}
  3116  		off2 := auxIntToInt32(v_0.AuxInt)
  3117  		sym2 := auxToSym(v_0.Aux)
  3118  		base := v_0.Args[0]
  3119  		mem := v_1
  3120  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  3121  			break
  3122  		}
  3123  		v.reset(OpRISCV64MOVBUload)
  3124  		v.AuxInt = int32ToAuxInt(off1 + off2)
  3125  		v.Aux = symToAux(mergeSym(sym1, sym2))
  3126  		v.AddArg2(base, mem)
  3127  		return true
  3128  	}
  3129  	// match: (MOVBUload [off1] {sym} (ADDI [off2] base) mem)
  3130  	// cond: is32Bit(int64(off1)+off2)
  3131  	// result: (MOVBUload [off1+int32(off2)] {sym} base mem)
  3132  	for {
  3133  		off1 := auxIntToInt32(v.AuxInt)
  3134  		sym := auxToSym(v.Aux)
  3135  		if v_0.Op != OpRISCV64ADDI {
  3136  			break
  3137  		}
  3138  		off2 := auxIntToInt64(v_0.AuxInt)
  3139  		base := v_0.Args[0]
  3140  		mem := v_1
  3141  		if !(is32Bit(int64(off1) + off2)) {
  3142  			break
  3143  		}
  3144  		v.reset(OpRISCV64MOVBUload)
  3145  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  3146  		v.Aux = symToAux(sym)
  3147  		v.AddArg2(base, mem)
  3148  		return true
  3149  	}
  3150  	return false
  3151  }
  3152  func rewriteValueRISCV64_OpRISCV64MOVBUreg(v *Value) bool {
  3153  	v_0 := v.Args[0]
  3154  	b := v.Block
  3155  	// match: (MOVBUreg (MOVDconst [c]))
  3156  	// result: (MOVDconst [int64(uint8(c))])
  3157  	for {
  3158  		if v_0.Op != OpRISCV64MOVDconst {
  3159  			break
  3160  		}
  3161  		c := auxIntToInt64(v_0.AuxInt)
  3162  		v.reset(OpRISCV64MOVDconst)
  3163  		v.AuxInt = int64ToAuxInt(int64(uint8(c)))
  3164  		return true
  3165  	}
  3166  	// match: (MOVBUreg x:(MOVBUload _ _))
  3167  	// result: (MOVDreg x)
  3168  	for {
  3169  		x := v_0
  3170  		if x.Op != OpRISCV64MOVBUload {
  3171  			break
  3172  		}
  3173  		v.reset(OpRISCV64MOVDreg)
  3174  		v.AddArg(x)
  3175  		return true
  3176  	}
  3177  	// match: (MOVBUreg x:(MOVBUreg _))
  3178  	// result: (MOVDreg x)
  3179  	for {
  3180  		x := v_0
  3181  		if x.Op != OpRISCV64MOVBUreg {
  3182  			break
  3183  		}
  3184  		v.reset(OpRISCV64MOVDreg)
  3185  		v.AddArg(x)
  3186  		return true
  3187  	}
  3188  	// match: (MOVBUreg <t> x:(MOVBload [off] {sym} ptr mem))
  3189  	// cond: x.Uses == 1 && clobber(x)
  3190  	// result: @x.Block (MOVBUload <t> [off] {sym} ptr mem)
  3191  	for {
  3192  		t := v.Type
  3193  		x := v_0
  3194  		if x.Op != OpRISCV64MOVBload {
  3195  			break
  3196  		}
  3197  		off := auxIntToInt32(x.AuxInt)
  3198  		sym := auxToSym(x.Aux)
  3199  		mem := x.Args[1]
  3200  		ptr := x.Args[0]
  3201  		if !(x.Uses == 1 && clobber(x)) {
  3202  			break
  3203  		}
  3204  		b = x.Block
  3205  		v0 := b.NewValue0(x.Pos, OpRISCV64MOVBUload, t)
  3206  		v.copyOf(v0)
  3207  		v0.AuxInt = int32ToAuxInt(off)
  3208  		v0.Aux = symToAux(sym)
  3209  		v0.AddArg2(ptr, mem)
  3210  		return true
  3211  	}
  3212  	return false
  3213  }
  3214  func rewriteValueRISCV64_OpRISCV64MOVBload(v *Value) bool {
  3215  	v_1 := v.Args[1]
  3216  	v_0 := v.Args[0]
  3217  	// match: (MOVBload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem)
  3218  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  3219  	// result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem)
  3220  	for {
  3221  		off1 := auxIntToInt32(v.AuxInt)
  3222  		sym1 := auxToSym(v.Aux)
  3223  		if v_0.Op != OpRISCV64MOVaddr {
  3224  			break
  3225  		}
  3226  		off2 := auxIntToInt32(v_0.AuxInt)
  3227  		sym2 := auxToSym(v_0.Aux)
  3228  		base := v_0.Args[0]
  3229  		mem := v_1
  3230  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  3231  			break
  3232  		}
  3233  		v.reset(OpRISCV64MOVBload)
  3234  		v.AuxInt = int32ToAuxInt(off1 + off2)
  3235  		v.Aux = symToAux(mergeSym(sym1, sym2))
  3236  		v.AddArg2(base, mem)
  3237  		return true
  3238  	}
  3239  	// match: (MOVBload [off1] {sym} (ADDI [off2] base) mem)
  3240  	// cond: is32Bit(int64(off1)+off2)
  3241  	// result: (MOVBload [off1+int32(off2)] {sym} base mem)
  3242  	for {
  3243  		off1 := auxIntToInt32(v.AuxInt)
  3244  		sym := auxToSym(v.Aux)
  3245  		if v_0.Op != OpRISCV64ADDI {
  3246  			break
  3247  		}
  3248  		off2 := auxIntToInt64(v_0.AuxInt)
  3249  		base := v_0.Args[0]
  3250  		mem := v_1
  3251  		if !(is32Bit(int64(off1) + off2)) {
  3252  			break
  3253  		}
  3254  		v.reset(OpRISCV64MOVBload)
  3255  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  3256  		v.Aux = symToAux(sym)
  3257  		v.AddArg2(base, mem)
  3258  		return true
  3259  	}
  3260  	return false
  3261  }
  3262  func rewriteValueRISCV64_OpRISCV64MOVBreg(v *Value) bool {
  3263  	v_0 := v.Args[0]
  3264  	b := v.Block
  3265  	// match: (MOVBreg (MOVDconst [c]))
  3266  	// result: (MOVDconst [int64(int8(c))])
  3267  	for {
  3268  		if v_0.Op != OpRISCV64MOVDconst {
  3269  			break
  3270  		}
  3271  		c := auxIntToInt64(v_0.AuxInt)
  3272  		v.reset(OpRISCV64MOVDconst)
  3273  		v.AuxInt = int64ToAuxInt(int64(int8(c)))
  3274  		return true
  3275  	}
  3276  	// match: (MOVBreg x:(MOVBload _ _))
  3277  	// result: (MOVDreg x)
  3278  	for {
  3279  		x := v_0
  3280  		if x.Op != OpRISCV64MOVBload {
  3281  			break
  3282  		}
  3283  		v.reset(OpRISCV64MOVDreg)
  3284  		v.AddArg(x)
  3285  		return true
  3286  	}
  3287  	// match: (MOVBreg x:(MOVBreg _))
  3288  	// result: (MOVDreg x)
  3289  	for {
  3290  		x := v_0
  3291  		if x.Op != OpRISCV64MOVBreg {
  3292  			break
  3293  		}
  3294  		v.reset(OpRISCV64MOVDreg)
  3295  		v.AddArg(x)
  3296  		return true
  3297  	}
  3298  	// match: (MOVBreg <t> x:(MOVBUload [off] {sym} ptr mem))
  3299  	// cond: x.Uses == 1 && clobber(x)
  3300  	// result: @x.Block (MOVBload <t> [off] {sym} ptr mem)
  3301  	for {
  3302  		t := v.Type
  3303  		x := v_0
  3304  		if x.Op != OpRISCV64MOVBUload {
  3305  			break
  3306  		}
  3307  		off := auxIntToInt32(x.AuxInt)
  3308  		sym := auxToSym(x.Aux)
  3309  		mem := x.Args[1]
  3310  		ptr := x.Args[0]
  3311  		if !(x.Uses == 1 && clobber(x)) {
  3312  			break
  3313  		}
  3314  		b = x.Block
  3315  		v0 := b.NewValue0(x.Pos, OpRISCV64MOVBload, t)
  3316  		v.copyOf(v0)
  3317  		v0.AuxInt = int32ToAuxInt(off)
  3318  		v0.Aux = symToAux(sym)
  3319  		v0.AddArg2(ptr, mem)
  3320  		return true
  3321  	}
  3322  	return false
  3323  }
  3324  func rewriteValueRISCV64_OpRISCV64MOVBstore(v *Value) bool {
  3325  	v_2 := v.Args[2]
  3326  	v_1 := v.Args[1]
  3327  	v_0 := v.Args[0]
  3328  	// match: (MOVBstore [off1] {sym1} (MOVaddr [off2] {sym2} base) val mem)
  3329  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  3330  	// result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
  3331  	for {
  3332  		off1 := auxIntToInt32(v.AuxInt)
  3333  		sym1 := auxToSym(v.Aux)
  3334  		if v_0.Op != OpRISCV64MOVaddr {
  3335  			break
  3336  		}
  3337  		off2 := auxIntToInt32(v_0.AuxInt)
  3338  		sym2 := auxToSym(v_0.Aux)
  3339  		base := v_0.Args[0]
  3340  		val := v_1
  3341  		mem := v_2
  3342  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  3343  			break
  3344  		}
  3345  		v.reset(OpRISCV64MOVBstore)
  3346  		v.AuxInt = int32ToAuxInt(off1 + off2)
  3347  		v.Aux = symToAux(mergeSym(sym1, sym2))
  3348  		v.AddArg3(base, val, mem)
  3349  		return true
  3350  	}
  3351  	// match: (MOVBstore [off1] {sym} (ADDI [off2] base) val mem)
  3352  	// cond: is32Bit(int64(off1)+off2)
  3353  	// result: (MOVBstore [off1+int32(off2)] {sym} base val mem)
  3354  	for {
  3355  		off1 := auxIntToInt32(v.AuxInt)
  3356  		sym := auxToSym(v.Aux)
  3357  		if v_0.Op != OpRISCV64ADDI {
  3358  			break
  3359  		}
  3360  		off2 := auxIntToInt64(v_0.AuxInt)
  3361  		base := v_0.Args[0]
  3362  		val := v_1
  3363  		mem := v_2
  3364  		if !(is32Bit(int64(off1) + off2)) {
  3365  			break
  3366  		}
  3367  		v.reset(OpRISCV64MOVBstore)
  3368  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  3369  		v.Aux = symToAux(sym)
  3370  		v.AddArg3(base, val, mem)
  3371  		return true
  3372  	}
  3373  	// match: (MOVBstore [off] {sym} ptr (MOVDconst [0]) mem)
  3374  	// result: (MOVBstorezero [off] {sym} ptr mem)
  3375  	for {
  3376  		off := auxIntToInt32(v.AuxInt)
  3377  		sym := auxToSym(v.Aux)
  3378  		ptr := v_0
  3379  		if v_1.Op != OpRISCV64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
  3380  			break
  3381  		}
  3382  		mem := v_2
  3383  		v.reset(OpRISCV64MOVBstorezero)
  3384  		v.AuxInt = int32ToAuxInt(off)
  3385  		v.Aux = symToAux(sym)
  3386  		v.AddArg2(ptr, mem)
  3387  		return true
  3388  	}
  3389  	// match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem)
  3390  	// result: (MOVBstore [off] {sym} ptr x mem)
  3391  	for {
  3392  		off := auxIntToInt32(v.AuxInt)
  3393  		sym := auxToSym(v.Aux)
  3394  		ptr := v_0
  3395  		if v_1.Op != OpRISCV64MOVBreg {
  3396  			break
  3397  		}
  3398  		x := v_1.Args[0]
  3399  		mem := v_2
  3400  		v.reset(OpRISCV64MOVBstore)
  3401  		v.AuxInt = int32ToAuxInt(off)
  3402  		v.Aux = symToAux(sym)
  3403  		v.AddArg3(ptr, x, mem)
  3404  		return true
  3405  	}
  3406  	// match: (MOVBstore [off] {sym} ptr (MOVHreg x) mem)
  3407  	// result: (MOVBstore [off] {sym} ptr x mem)
  3408  	for {
  3409  		off := auxIntToInt32(v.AuxInt)
  3410  		sym := auxToSym(v.Aux)
  3411  		ptr := v_0
  3412  		if v_1.Op != OpRISCV64MOVHreg {
  3413  			break
  3414  		}
  3415  		x := v_1.Args[0]
  3416  		mem := v_2
  3417  		v.reset(OpRISCV64MOVBstore)
  3418  		v.AuxInt = int32ToAuxInt(off)
  3419  		v.Aux = symToAux(sym)
  3420  		v.AddArg3(ptr, x, mem)
  3421  		return true
  3422  	}
  3423  	// match: (MOVBstore [off] {sym} ptr (MOVWreg x) mem)
  3424  	// result: (MOVBstore [off] {sym} ptr x mem)
  3425  	for {
  3426  		off := auxIntToInt32(v.AuxInt)
  3427  		sym := auxToSym(v.Aux)
  3428  		ptr := v_0
  3429  		if v_1.Op != OpRISCV64MOVWreg {
  3430  			break
  3431  		}
  3432  		x := v_1.Args[0]
  3433  		mem := v_2
  3434  		v.reset(OpRISCV64MOVBstore)
  3435  		v.AuxInt = int32ToAuxInt(off)
  3436  		v.Aux = symToAux(sym)
  3437  		v.AddArg3(ptr, x, mem)
  3438  		return true
  3439  	}
  3440  	// match: (MOVBstore [off] {sym} ptr (MOVBUreg x) mem)
  3441  	// result: (MOVBstore [off] {sym} ptr x mem)
  3442  	for {
  3443  		off := auxIntToInt32(v.AuxInt)
  3444  		sym := auxToSym(v.Aux)
  3445  		ptr := v_0
  3446  		if v_1.Op != OpRISCV64MOVBUreg {
  3447  			break
  3448  		}
  3449  		x := v_1.Args[0]
  3450  		mem := v_2
  3451  		v.reset(OpRISCV64MOVBstore)
  3452  		v.AuxInt = int32ToAuxInt(off)
  3453  		v.Aux = symToAux(sym)
  3454  		v.AddArg3(ptr, x, mem)
  3455  		return true
  3456  	}
  3457  	// match: (MOVBstore [off] {sym} ptr (MOVHUreg x) mem)
  3458  	// result: (MOVBstore [off] {sym} ptr x mem)
  3459  	for {
  3460  		off := auxIntToInt32(v.AuxInt)
  3461  		sym := auxToSym(v.Aux)
  3462  		ptr := v_0
  3463  		if v_1.Op != OpRISCV64MOVHUreg {
  3464  			break
  3465  		}
  3466  		x := v_1.Args[0]
  3467  		mem := v_2
  3468  		v.reset(OpRISCV64MOVBstore)
  3469  		v.AuxInt = int32ToAuxInt(off)
  3470  		v.Aux = symToAux(sym)
  3471  		v.AddArg3(ptr, x, mem)
  3472  		return true
  3473  	}
  3474  	// match: (MOVBstore [off] {sym} ptr (MOVWUreg x) mem)
  3475  	// result: (MOVBstore [off] {sym} ptr x mem)
  3476  	for {
  3477  		off := auxIntToInt32(v.AuxInt)
  3478  		sym := auxToSym(v.Aux)
  3479  		ptr := v_0
  3480  		if v_1.Op != OpRISCV64MOVWUreg {
  3481  			break
  3482  		}
  3483  		x := v_1.Args[0]
  3484  		mem := v_2
  3485  		v.reset(OpRISCV64MOVBstore)
  3486  		v.AuxInt = int32ToAuxInt(off)
  3487  		v.Aux = symToAux(sym)
  3488  		v.AddArg3(ptr, x, mem)
  3489  		return true
  3490  	}
  3491  	return false
  3492  }
  3493  func rewriteValueRISCV64_OpRISCV64MOVBstorezero(v *Value) bool {
  3494  	v_1 := v.Args[1]
  3495  	v_0 := v.Args[0]
  3496  	// match: (MOVBstorezero [off1] {sym1} (MOVaddr [off2] {sym2} ptr) mem)
  3497  	// cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2))
  3498  	// result: (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
  3499  	for {
  3500  		off1 := auxIntToInt32(v.AuxInt)
  3501  		sym1 := auxToSym(v.Aux)
  3502  		if v_0.Op != OpRISCV64MOVaddr {
  3503  			break
  3504  		}
  3505  		off2 := auxIntToInt32(v_0.AuxInt)
  3506  		sym2 := auxToSym(v_0.Aux)
  3507  		ptr := v_0.Args[0]
  3508  		mem := v_1
  3509  		if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2))) {
  3510  			break
  3511  		}
  3512  		v.reset(OpRISCV64MOVBstorezero)
  3513  		v.AuxInt = int32ToAuxInt(off1 + off2)
  3514  		v.Aux = symToAux(mergeSym(sym1, sym2))
  3515  		v.AddArg2(ptr, mem)
  3516  		return true
  3517  	}
  3518  	// match: (MOVBstorezero [off1] {sym} (ADDI [off2] ptr) mem)
  3519  	// cond: is32Bit(int64(off1)+off2)
  3520  	// result: (MOVBstorezero [off1+int32(off2)] {sym} ptr mem)
  3521  	for {
  3522  		off1 := auxIntToInt32(v.AuxInt)
  3523  		sym := auxToSym(v.Aux)
  3524  		if v_0.Op != OpRISCV64ADDI {
  3525  			break
  3526  		}
  3527  		off2 := auxIntToInt64(v_0.AuxInt)
  3528  		ptr := v_0.Args[0]
  3529  		mem := v_1
  3530  		if !(is32Bit(int64(off1) + off2)) {
  3531  			break
  3532  		}
  3533  		v.reset(OpRISCV64MOVBstorezero)
  3534  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  3535  		v.Aux = symToAux(sym)
  3536  		v.AddArg2(ptr, mem)
  3537  		return true
  3538  	}
  3539  	return false
  3540  }
  3541  func rewriteValueRISCV64_OpRISCV64MOVDload(v *Value) bool {
  3542  	v_1 := v.Args[1]
  3543  	v_0 := v.Args[0]
  3544  	// match: (MOVDload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem)
  3545  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  3546  	// result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem)
  3547  	for {
  3548  		off1 := auxIntToInt32(v.AuxInt)
  3549  		sym1 := auxToSym(v.Aux)
  3550  		if v_0.Op != OpRISCV64MOVaddr {
  3551  			break
  3552  		}
  3553  		off2 := auxIntToInt32(v_0.AuxInt)
  3554  		sym2 := auxToSym(v_0.Aux)
  3555  		base := v_0.Args[0]
  3556  		mem := v_1
  3557  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  3558  			break
  3559  		}
  3560  		v.reset(OpRISCV64MOVDload)
  3561  		v.AuxInt = int32ToAuxInt(off1 + off2)
  3562  		v.Aux = symToAux(mergeSym(sym1, sym2))
  3563  		v.AddArg2(base, mem)
  3564  		return true
  3565  	}
  3566  	// match: (MOVDload [off1] {sym} (ADDI [off2] base) mem)
  3567  	// cond: is32Bit(int64(off1)+off2)
  3568  	// result: (MOVDload [off1+int32(off2)] {sym} base mem)
  3569  	for {
  3570  		off1 := auxIntToInt32(v.AuxInt)
  3571  		sym := auxToSym(v.Aux)
  3572  		if v_0.Op != OpRISCV64ADDI {
  3573  			break
  3574  		}
  3575  		off2 := auxIntToInt64(v_0.AuxInt)
  3576  		base := v_0.Args[0]
  3577  		mem := v_1
  3578  		if !(is32Bit(int64(off1) + off2)) {
  3579  			break
  3580  		}
  3581  		v.reset(OpRISCV64MOVDload)
  3582  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  3583  		v.Aux = symToAux(sym)
  3584  		v.AddArg2(base, mem)
  3585  		return true
  3586  	}
  3587  	return false
  3588  }
  3589  func rewriteValueRISCV64_OpRISCV64MOVDnop(v *Value) bool {
  3590  	v_0 := v.Args[0]
  3591  	// match: (MOVDnop (MOVDconst [c]))
  3592  	// result: (MOVDconst [c])
  3593  	for {
  3594  		if v_0.Op != OpRISCV64MOVDconst {
  3595  			break
  3596  		}
  3597  		c := auxIntToInt64(v_0.AuxInt)
  3598  		v.reset(OpRISCV64MOVDconst)
  3599  		v.AuxInt = int64ToAuxInt(c)
  3600  		return true
  3601  	}
  3602  	return false
  3603  }
  3604  func rewriteValueRISCV64_OpRISCV64MOVDreg(v *Value) bool {
  3605  	v_0 := v.Args[0]
  3606  	// match: (MOVDreg x)
  3607  	// cond: x.Uses == 1
  3608  	// result: (MOVDnop x)
  3609  	for {
  3610  		x := v_0
  3611  		if !(x.Uses == 1) {
  3612  			break
  3613  		}
  3614  		v.reset(OpRISCV64MOVDnop)
  3615  		v.AddArg(x)
  3616  		return true
  3617  	}
  3618  	return false
  3619  }
  3620  func rewriteValueRISCV64_OpRISCV64MOVDstore(v *Value) bool {
  3621  	v_2 := v.Args[2]
  3622  	v_1 := v.Args[1]
  3623  	v_0 := v.Args[0]
  3624  	// match: (MOVDstore [off1] {sym1} (MOVaddr [off2] {sym2} base) val mem)
  3625  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  3626  	// result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
  3627  	for {
  3628  		off1 := auxIntToInt32(v.AuxInt)
  3629  		sym1 := auxToSym(v.Aux)
  3630  		if v_0.Op != OpRISCV64MOVaddr {
  3631  			break
  3632  		}
  3633  		off2 := auxIntToInt32(v_0.AuxInt)
  3634  		sym2 := auxToSym(v_0.Aux)
  3635  		base := v_0.Args[0]
  3636  		val := v_1
  3637  		mem := v_2
  3638  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  3639  			break
  3640  		}
  3641  		v.reset(OpRISCV64MOVDstore)
  3642  		v.AuxInt = int32ToAuxInt(off1 + off2)
  3643  		v.Aux = symToAux(mergeSym(sym1, sym2))
  3644  		v.AddArg3(base, val, mem)
  3645  		return true
  3646  	}
  3647  	// match: (MOVDstore [off1] {sym} (ADDI [off2] base) val mem)
  3648  	// cond: is32Bit(int64(off1)+off2)
  3649  	// result: (MOVDstore [off1+int32(off2)] {sym} base val mem)
  3650  	for {
  3651  		off1 := auxIntToInt32(v.AuxInt)
  3652  		sym := auxToSym(v.Aux)
  3653  		if v_0.Op != OpRISCV64ADDI {
  3654  			break
  3655  		}
  3656  		off2 := auxIntToInt64(v_0.AuxInt)
  3657  		base := v_0.Args[0]
  3658  		val := v_1
  3659  		mem := v_2
  3660  		if !(is32Bit(int64(off1) + off2)) {
  3661  			break
  3662  		}
  3663  		v.reset(OpRISCV64MOVDstore)
  3664  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  3665  		v.Aux = symToAux(sym)
  3666  		v.AddArg3(base, val, mem)
  3667  		return true
  3668  	}
  3669  	// match: (MOVDstore [off] {sym} ptr (MOVDconst [0]) mem)
  3670  	// result: (MOVDstorezero [off] {sym} ptr mem)
  3671  	for {
  3672  		off := auxIntToInt32(v.AuxInt)
  3673  		sym := auxToSym(v.Aux)
  3674  		ptr := v_0
  3675  		if v_1.Op != OpRISCV64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
  3676  			break
  3677  		}
  3678  		mem := v_2
  3679  		v.reset(OpRISCV64MOVDstorezero)
  3680  		v.AuxInt = int32ToAuxInt(off)
  3681  		v.Aux = symToAux(sym)
  3682  		v.AddArg2(ptr, mem)
  3683  		return true
  3684  	}
  3685  	return false
  3686  }
  3687  func rewriteValueRISCV64_OpRISCV64MOVDstorezero(v *Value) bool {
  3688  	v_1 := v.Args[1]
  3689  	v_0 := v.Args[0]
  3690  	// match: (MOVDstorezero [off1] {sym1} (MOVaddr [off2] {sym2} ptr) mem)
  3691  	// cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2))
  3692  	// result: (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
  3693  	for {
  3694  		off1 := auxIntToInt32(v.AuxInt)
  3695  		sym1 := auxToSym(v.Aux)
  3696  		if v_0.Op != OpRISCV64MOVaddr {
  3697  			break
  3698  		}
  3699  		off2 := auxIntToInt32(v_0.AuxInt)
  3700  		sym2 := auxToSym(v_0.Aux)
  3701  		ptr := v_0.Args[0]
  3702  		mem := v_1
  3703  		if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2))) {
  3704  			break
  3705  		}
  3706  		v.reset(OpRISCV64MOVDstorezero)
  3707  		v.AuxInt = int32ToAuxInt(off1 + off2)
  3708  		v.Aux = symToAux(mergeSym(sym1, sym2))
  3709  		v.AddArg2(ptr, mem)
  3710  		return true
  3711  	}
  3712  	// match: (MOVDstorezero [off1] {sym} (ADDI [off2] ptr) mem)
  3713  	// cond: is32Bit(int64(off1)+off2)
  3714  	// result: (MOVDstorezero [off1+int32(off2)] {sym} ptr mem)
  3715  	for {
  3716  		off1 := auxIntToInt32(v.AuxInt)
  3717  		sym := auxToSym(v.Aux)
  3718  		if v_0.Op != OpRISCV64ADDI {
  3719  			break
  3720  		}
  3721  		off2 := auxIntToInt64(v_0.AuxInt)
  3722  		ptr := v_0.Args[0]
  3723  		mem := v_1
  3724  		if !(is32Bit(int64(off1) + off2)) {
  3725  			break
  3726  		}
  3727  		v.reset(OpRISCV64MOVDstorezero)
  3728  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  3729  		v.Aux = symToAux(sym)
  3730  		v.AddArg2(ptr, mem)
  3731  		return true
  3732  	}
  3733  	return false
  3734  }
  3735  func rewriteValueRISCV64_OpRISCV64MOVHUload(v *Value) bool {
  3736  	v_1 := v.Args[1]
  3737  	v_0 := v.Args[0]
  3738  	// match: (MOVHUload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem)
  3739  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  3740  	// result: (MOVHUload [off1+off2] {mergeSym(sym1,sym2)} base mem)
  3741  	for {
  3742  		off1 := auxIntToInt32(v.AuxInt)
  3743  		sym1 := auxToSym(v.Aux)
  3744  		if v_0.Op != OpRISCV64MOVaddr {
  3745  			break
  3746  		}
  3747  		off2 := auxIntToInt32(v_0.AuxInt)
  3748  		sym2 := auxToSym(v_0.Aux)
  3749  		base := v_0.Args[0]
  3750  		mem := v_1
  3751  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  3752  			break
  3753  		}
  3754  		v.reset(OpRISCV64MOVHUload)
  3755  		v.AuxInt = int32ToAuxInt(off1 + off2)
  3756  		v.Aux = symToAux(mergeSym(sym1, sym2))
  3757  		v.AddArg2(base, mem)
  3758  		return true
  3759  	}
  3760  	// match: (MOVHUload [off1] {sym} (ADDI [off2] base) mem)
  3761  	// cond: is32Bit(int64(off1)+off2)
  3762  	// result: (MOVHUload [off1+int32(off2)] {sym} base mem)
  3763  	for {
  3764  		off1 := auxIntToInt32(v.AuxInt)
  3765  		sym := auxToSym(v.Aux)
  3766  		if v_0.Op != OpRISCV64ADDI {
  3767  			break
  3768  		}
  3769  		off2 := auxIntToInt64(v_0.AuxInt)
  3770  		base := v_0.Args[0]
  3771  		mem := v_1
  3772  		if !(is32Bit(int64(off1) + off2)) {
  3773  			break
  3774  		}
  3775  		v.reset(OpRISCV64MOVHUload)
  3776  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  3777  		v.Aux = symToAux(sym)
  3778  		v.AddArg2(base, mem)
  3779  		return true
  3780  	}
  3781  	return false
  3782  }
  3783  func rewriteValueRISCV64_OpRISCV64MOVHUreg(v *Value) bool {
  3784  	v_0 := v.Args[0]
  3785  	b := v.Block
  3786  	// match: (MOVHUreg (MOVDconst [c]))
  3787  	// result: (MOVDconst [int64(uint16(c))])
  3788  	for {
  3789  		if v_0.Op != OpRISCV64MOVDconst {
  3790  			break
  3791  		}
  3792  		c := auxIntToInt64(v_0.AuxInt)
  3793  		v.reset(OpRISCV64MOVDconst)
  3794  		v.AuxInt = int64ToAuxInt(int64(uint16(c)))
  3795  		return true
  3796  	}
  3797  	// match: (MOVHUreg x:(MOVBUload _ _))
  3798  	// result: (MOVDreg x)
  3799  	for {
  3800  		x := v_0
  3801  		if x.Op != OpRISCV64MOVBUload {
  3802  			break
  3803  		}
  3804  		v.reset(OpRISCV64MOVDreg)
  3805  		v.AddArg(x)
  3806  		return true
  3807  	}
  3808  	// match: (MOVHUreg x:(MOVHUload _ _))
  3809  	// result: (MOVDreg x)
  3810  	for {
  3811  		x := v_0
  3812  		if x.Op != OpRISCV64MOVHUload {
  3813  			break
  3814  		}
  3815  		v.reset(OpRISCV64MOVDreg)
  3816  		v.AddArg(x)
  3817  		return true
  3818  	}
  3819  	// match: (MOVHUreg x:(MOVBUreg _))
  3820  	// result: (MOVDreg x)
  3821  	for {
  3822  		x := v_0
  3823  		if x.Op != OpRISCV64MOVBUreg {
  3824  			break
  3825  		}
  3826  		v.reset(OpRISCV64MOVDreg)
  3827  		v.AddArg(x)
  3828  		return true
  3829  	}
  3830  	// match: (MOVHUreg x:(MOVHUreg _))
  3831  	// result: (MOVDreg x)
  3832  	for {
  3833  		x := v_0
  3834  		if x.Op != OpRISCV64MOVHUreg {
  3835  			break
  3836  		}
  3837  		v.reset(OpRISCV64MOVDreg)
  3838  		v.AddArg(x)
  3839  		return true
  3840  	}
  3841  	// match: (MOVHUreg <t> x:(MOVHload [off] {sym} ptr mem))
  3842  	// cond: x.Uses == 1 && clobber(x)
  3843  	// result: @x.Block (MOVHUload <t> [off] {sym} ptr mem)
  3844  	for {
  3845  		t := v.Type
  3846  		x := v_0
  3847  		if x.Op != OpRISCV64MOVHload {
  3848  			break
  3849  		}
  3850  		off := auxIntToInt32(x.AuxInt)
  3851  		sym := auxToSym(x.Aux)
  3852  		mem := x.Args[1]
  3853  		ptr := x.Args[0]
  3854  		if !(x.Uses == 1 && clobber(x)) {
  3855  			break
  3856  		}
  3857  		b = x.Block
  3858  		v0 := b.NewValue0(x.Pos, OpRISCV64MOVHUload, t)
  3859  		v.copyOf(v0)
  3860  		v0.AuxInt = int32ToAuxInt(off)
  3861  		v0.Aux = symToAux(sym)
  3862  		v0.AddArg2(ptr, mem)
  3863  		return true
  3864  	}
  3865  	return false
  3866  }
  3867  func rewriteValueRISCV64_OpRISCV64MOVHload(v *Value) bool {
  3868  	v_1 := v.Args[1]
  3869  	v_0 := v.Args[0]
  3870  	// match: (MOVHload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem)
  3871  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  3872  	// result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} base mem)
  3873  	for {
  3874  		off1 := auxIntToInt32(v.AuxInt)
  3875  		sym1 := auxToSym(v.Aux)
  3876  		if v_0.Op != OpRISCV64MOVaddr {
  3877  			break
  3878  		}
  3879  		off2 := auxIntToInt32(v_0.AuxInt)
  3880  		sym2 := auxToSym(v_0.Aux)
  3881  		base := v_0.Args[0]
  3882  		mem := v_1
  3883  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  3884  			break
  3885  		}
  3886  		v.reset(OpRISCV64MOVHload)
  3887  		v.AuxInt = int32ToAuxInt(off1 + off2)
  3888  		v.Aux = symToAux(mergeSym(sym1, sym2))
  3889  		v.AddArg2(base, mem)
  3890  		return true
  3891  	}
  3892  	// match: (MOVHload [off1] {sym} (ADDI [off2] base) mem)
  3893  	// cond: is32Bit(int64(off1)+off2)
  3894  	// result: (MOVHload [off1+int32(off2)] {sym} base mem)
  3895  	for {
  3896  		off1 := auxIntToInt32(v.AuxInt)
  3897  		sym := auxToSym(v.Aux)
  3898  		if v_0.Op != OpRISCV64ADDI {
  3899  			break
  3900  		}
  3901  		off2 := auxIntToInt64(v_0.AuxInt)
  3902  		base := v_0.Args[0]
  3903  		mem := v_1
  3904  		if !(is32Bit(int64(off1) + off2)) {
  3905  			break
  3906  		}
  3907  		v.reset(OpRISCV64MOVHload)
  3908  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  3909  		v.Aux = symToAux(sym)
  3910  		v.AddArg2(base, mem)
  3911  		return true
  3912  	}
  3913  	return false
  3914  }
  3915  func rewriteValueRISCV64_OpRISCV64MOVHreg(v *Value) bool {
  3916  	v_0 := v.Args[0]
  3917  	b := v.Block
  3918  	// match: (MOVHreg (MOVDconst [c]))
  3919  	// result: (MOVDconst [int64(int16(c))])
  3920  	for {
  3921  		if v_0.Op != OpRISCV64MOVDconst {
  3922  			break
  3923  		}
  3924  		c := auxIntToInt64(v_0.AuxInt)
  3925  		v.reset(OpRISCV64MOVDconst)
  3926  		v.AuxInt = int64ToAuxInt(int64(int16(c)))
  3927  		return true
  3928  	}
  3929  	// match: (MOVHreg x:(MOVBload _ _))
  3930  	// result: (MOVDreg x)
  3931  	for {
  3932  		x := v_0
  3933  		if x.Op != OpRISCV64MOVBload {
  3934  			break
  3935  		}
  3936  		v.reset(OpRISCV64MOVDreg)
  3937  		v.AddArg(x)
  3938  		return true
  3939  	}
  3940  	// match: (MOVHreg x:(MOVBUload _ _))
  3941  	// result: (MOVDreg x)
  3942  	for {
  3943  		x := v_0
  3944  		if x.Op != OpRISCV64MOVBUload {
  3945  			break
  3946  		}
  3947  		v.reset(OpRISCV64MOVDreg)
  3948  		v.AddArg(x)
  3949  		return true
  3950  	}
  3951  	// match: (MOVHreg x:(MOVHload _ _))
  3952  	// result: (MOVDreg x)
  3953  	for {
  3954  		x := v_0
  3955  		if x.Op != OpRISCV64MOVHload {
  3956  			break
  3957  		}
  3958  		v.reset(OpRISCV64MOVDreg)
  3959  		v.AddArg(x)
  3960  		return true
  3961  	}
  3962  	// match: (MOVHreg x:(MOVBreg _))
  3963  	// result: (MOVDreg x)
  3964  	for {
  3965  		x := v_0
  3966  		if x.Op != OpRISCV64MOVBreg {
  3967  			break
  3968  		}
  3969  		v.reset(OpRISCV64MOVDreg)
  3970  		v.AddArg(x)
  3971  		return true
  3972  	}
  3973  	// match: (MOVHreg x:(MOVBUreg _))
  3974  	// result: (MOVDreg x)
  3975  	for {
  3976  		x := v_0
  3977  		if x.Op != OpRISCV64MOVBUreg {
  3978  			break
  3979  		}
  3980  		v.reset(OpRISCV64MOVDreg)
  3981  		v.AddArg(x)
  3982  		return true
  3983  	}
  3984  	// match: (MOVHreg x:(MOVHreg _))
  3985  	// result: (MOVDreg x)
  3986  	for {
  3987  		x := v_0
  3988  		if x.Op != OpRISCV64MOVHreg {
  3989  			break
  3990  		}
  3991  		v.reset(OpRISCV64MOVDreg)
  3992  		v.AddArg(x)
  3993  		return true
  3994  	}
  3995  	// match: (MOVHreg <t> x:(MOVHUload [off] {sym} ptr mem))
  3996  	// cond: x.Uses == 1 && clobber(x)
  3997  	// result: @x.Block (MOVHload <t> [off] {sym} ptr mem)
  3998  	for {
  3999  		t := v.Type
  4000  		x := v_0
  4001  		if x.Op != OpRISCV64MOVHUload {
  4002  			break
  4003  		}
  4004  		off := auxIntToInt32(x.AuxInt)
  4005  		sym := auxToSym(x.Aux)
  4006  		mem := x.Args[1]
  4007  		ptr := x.Args[0]
  4008  		if !(x.Uses == 1 && clobber(x)) {
  4009  			break
  4010  		}
  4011  		b = x.Block
  4012  		v0 := b.NewValue0(x.Pos, OpRISCV64MOVHload, t)
  4013  		v.copyOf(v0)
  4014  		v0.AuxInt = int32ToAuxInt(off)
  4015  		v0.Aux = symToAux(sym)
  4016  		v0.AddArg2(ptr, mem)
  4017  		return true
  4018  	}
  4019  	return false
  4020  }
  4021  func rewriteValueRISCV64_OpRISCV64MOVHstore(v *Value) bool {
  4022  	v_2 := v.Args[2]
  4023  	v_1 := v.Args[1]
  4024  	v_0 := v.Args[0]
  4025  	// match: (MOVHstore [off1] {sym1} (MOVaddr [off2] {sym2} base) val mem)
  4026  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  4027  	// result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
  4028  	for {
  4029  		off1 := auxIntToInt32(v.AuxInt)
  4030  		sym1 := auxToSym(v.Aux)
  4031  		if v_0.Op != OpRISCV64MOVaddr {
  4032  			break
  4033  		}
  4034  		off2 := auxIntToInt32(v_0.AuxInt)
  4035  		sym2 := auxToSym(v_0.Aux)
  4036  		base := v_0.Args[0]
  4037  		val := v_1
  4038  		mem := v_2
  4039  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  4040  			break
  4041  		}
  4042  		v.reset(OpRISCV64MOVHstore)
  4043  		v.AuxInt = int32ToAuxInt(off1 + off2)
  4044  		v.Aux = symToAux(mergeSym(sym1, sym2))
  4045  		v.AddArg3(base, val, mem)
  4046  		return true
  4047  	}
  4048  	// match: (MOVHstore [off1] {sym} (ADDI [off2] base) val mem)
  4049  	// cond: is32Bit(int64(off1)+off2)
  4050  	// result: (MOVHstore [off1+int32(off2)] {sym} base val mem)
  4051  	for {
  4052  		off1 := auxIntToInt32(v.AuxInt)
  4053  		sym := auxToSym(v.Aux)
  4054  		if v_0.Op != OpRISCV64ADDI {
  4055  			break
  4056  		}
  4057  		off2 := auxIntToInt64(v_0.AuxInt)
  4058  		base := v_0.Args[0]
  4059  		val := v_1
  4060  		mem := v_2
  4061  		if !(is32Bit(int64(off1) + off2)) {
  4062  			break
  4063  		}
  4064  		v.reset(OpRISCV64MOVHstore)
  4065  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  4066  		v.Aux = symToAux(sym)
  4067  		v.AddArg3(base, val, mem)
  4068  		return true
  4069  	}
  4070  	// match: (MOVHstore [off] {sym} ptr (MOVDconst [0]) mem)
  4071  	// result: (MOVHstorezero [off] {sym} ptr mem)
  4072  	for {
  4073  		off := auxIntToInt32(v.AuxInt)
  4074  		sym := auxToSym(v.Aux)
  4075  		ptr := v_0
  4076  		if v_1.Op != OpRISCV64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
  4077  			break
  4078  		}
  4079  		mem := v_2
  4080  		v.reset(OpRISCV64MOVHstorezero)
  4081  		v.AuxInt = int32ToAuxInt(off)
  4082  		v.Aux = symToAux(sym)
  4083  		v.AddArg2(ptr, mem)
  4084  		return true
  4085  	}
  4086  	// match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem)
  4087  	// result: (MOVHstore [off] {sym} ptr x mem)
  4088  	for {
  4089  		off := auxIntToInt32(v.AuxInt)
  4090  		sym := auxToSym(v.Aux)
  4091  		ptr := v_0
  4092  		if v_1.Op != OpRISCV64MOVHreg {
  4093  			break
  4094  		}
  4095  		x := v_1.Args[0]
  4096  		mem := v_2
  4097  		v.reset(OpRISCV64MOVHstore)
  4098  		v.AuxInt = int32ToAuxInt(off)
  4099  		v.Aux = symToAux(sym)
  4100  		v.AddArg3(ptr, x, mem)
  4101  		return true
  4102  	}
  4103  	// match: (MOVHstore [off] {sym} ptr (MOVWreg x) mem)
  4104  	// result: (MOVHstore [off] {sym} ptr x mem)
  4105  	for {
  4106  		off := auxIntToInt32(v.AuxInt)
  4107  		sym := auxToSym(v.Aux)
  4108  		ptr := v_0
  4109  		if v_1.Op != OpRISCV64MOVWreg {
  4110  			break
  4111  		}
  4112  		x := v_1.Args[0]
  4113  		mem := v_2
  4114  		v.reset(OpRISCV64MOVHstore)
  4115  		v.AuxInt = int32ToAuxInt(off)
  4116  		v.Aux = symToAux(sym)
  4117  		v.AddArg3(ptr, x, mem)
  4118  		return true
  4119  	}
  4120  	// match: (MOVHstore [off] {sym} ptr (MOVHUreg x) mem)
  4121  	// result: (MOVHstore [off] {sym} ptr x mem)
  4122  	for {
  4123  		off := auxIntToInt32(v.AuxInt)
  4124  		sym := auxToSym(v.Aux)
  4125  		ptr := v_0
  4126  		if v_1.Op != OpRISCV64MOVHUreg {
  4127  			break
  4128  		}
  4129  		x := v_1.Args[0]
  4130  		mem := v_2
  4131  		v.reset(OpRISCV64MOVHstore)
  4132  		v.AuxInt = int32ToAuxInt(off)
  4133  		v.Aux = symToAux(sym)
  4134  		v.AddArg3(ptr, x, mem)
  4135  		return true
  4136  	}
  4137  	// match: (MOVHstore [off] {sym} ptr (MOVWUreg x) mem)
  4138  	// result: (MOVHstore [off] {sym} ptr x mem)
  4139  	for {
  4140  		off := auxIntToInt32(v.AuxInt)
  4141  		sym := auxToSym(v.Aux)
  4142  		ptr := v_0
  4143  		if v_1.Op != OpRISCV64MOVWUreg {
  4144  			break
  4145  		}
  4146  		x := v_1.Args[0]
  4147  		mem := v_2
  4148  		v.reset(OpRISCV64MOVHstore)
  4149  		v.AuxInt = int32ToAuxInt(off)
  4150  		v.Aux = symToAux(sym)
  4151  		v.AddArg3(ptr, x, mem)
  4152  		return true
  4153  	}
  4154  	return false
  4155  }
  4156  func rewriteValueRISCV64_OpRISCV64MOVHstorezero(v *Value) bool {
  4157  	v_1 := v.Args[1]
  4158  	v_0 := v.Args[0]
  4159  	// match: (MOVHstorezero [off1] {sym1} (MOVaddr [off2] {sym2} ptr) mem)
  4160  	// cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2))
  4161  	// result: (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
  4162  	for {
  4163  		off1 := auxIntToInt32(v.AuxInt)
  4164  		sym1 := auxToSym(v.Aux)
  4165  		if v_0.Op != OpRISCV64MOVaddr {
  4166  			break
  4167  		}
  4168  		off2 := auxIntToInt32(v_0.AuxInt)
  4169  		sym2 := auxToSym(v_0.Aux)
  4170  		ptr := v_0.Args[0]
  4171  		mem := v_1
  4172  		if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2))) {
  4173  			break
  4174  		}
  4175  		v.reset(OpRISCV64MOVHstorezero)
  4176  		v.AuxInt = int32ToAuxInt(off1 + off2)
  4177  		v.Aux = symToAux(mergeSym(sym1, sym2))
  4178  		v.AddArg2(ptr, mem)
  4179  		return true
  4180  	}
  4181  	// match: (MOVHstorezero [off1] {sym} (ADDI [off2] ptr) mem)
  4182  	// cond: is32Bit(int64(off1)+off2)
  4183  	// result: (MOVHstorezero [off1+int32(off2)] {sym} ptr mem)
  4184  	for {
  4185  		off1 := auxIntToInt32(v.AuxInt)
  4186  		sym := auxToSym(v.Aux)
  4187  		if v_0.Op != OpRISCV64ADDI {
  4188  			break
  4189  		}
  4190  		off2 := auxIntToInt64(v_0.AuxInt)
  4191  		ptr := v_0.Args[0]
  4192  		mem := v_1
  4193  		if !(is32Bit(int64(off1) + off2)) {
  4194  			break
  4195  		}
  4196  		v.reset(OpRISCV64MOVHstorezero)
  4197  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  4198  		v.Aux = symToAux(sym)
  4199  		v.AddArg2(ptr, mem)
  4200  		return true
  4201  	}
  4202  	return false
  4203  }
  4204  func rewriteValueRISCV64_OpRISCV64MOVWUload(v *Value) bool {
  4205  	v_1 := v.Args[1]
  4206  	v_0 := v.Args[0]
  4207  	// match: (MOVWUload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem)
  4208  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  4209  	// result: (MOVWUload [off1+off2] {mergeSym(sym1,sym2)} base mem)
  4210  	for {
  4211  		off1 := auxIntToInt32(v.AuxInt)
  4212  		sym1 := auxToSym(v.Aux)
  4213  		if v_0.Op != OpRISCV64MOVaddr {
  4214  			break
  4215  		}
  4216  		off2 := auxIntToInt32(v_0.AuxInt)
  4217  		sym2 := auxToSym(v_0.Aux)
  4218  		base := v_0.Args[0]
  4219  		mem := v_1
  4220  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  4221  			break
  4222  		}
  4223  		v.reset(OpRISCV64MOVWUload)
  4224  		v.AuxInt = int32ToAuxInt(off1 + off2)
  4225  		v.Aux = symToAux(mergeSym(sym1, sym2))
  4226  		v.AddArg2(base, mem)
  4227  		return true
  4228  	}
  4229  	// match: (MOVWUload [off1] {sym} (ADDI [off2] base) mem)
  4230  	// cond: is32Bit(int64(off1)+off2)
  4231  	// result: (MOVWUload [off1+int32(off2)] {sym} base mem)
  4232  	for {
  4233  		off1 := auxIntToInt32(v.AuxInt)
  4234  		sym := auxToSym(v.Aux)
  4235  		if v_0.Op != OpRISCV64ADDI {
  4236  			break
  4237  		}
  4238  		off2 := auxIntToInt64(v_0.AuxInt)
  4239  		base := v_0.Args[0]
  4240  		mem := v_1
  4241  		if !(is32Bit(int64(off1) + off2)) {
  4242  			break
  4243  		}
  4244  		v.reset(OpRISCV64MOVWUload)
  4245  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  4246  		v.Aux = symToAux(sym)
  4247  		v.AddArg2(base, mem)
  4248  		return true
  4249  	}
  4250  	return false
  4251  }
  4252  func rewriteValueRISCV64_OpRISCV64MOVWUreg(v *Value) bool {
  4253  	v_0 := v.Args[0]
  4254  	b := v.Block
  4255  	// match: (MOVWUreg (MOVDconst [c]))
  4256  	// result: (MOVDconst [int64(uint32(c))])
  4257  	for {
  4258  		if v_0.Op != OpRISCV64MOVDconst {
  4259  			break
  4260  		}
  4261  		c := auxIntToInt64(v_0.AuxInt)
  4262  		v.reset(OpRISCV64MOVDconst)
  4263  		v.AuxInt = int64ToAuxInt(int64(uint32(c)))
  4264  		return true
  4265  	}
  4266  	// match: (MOVWUreg x:(MOVBUload _ _))
  4267  	// result: (MOVDreg x)
  4268  	for {
  4269  		x := v_0
  4270  		if x.Op != OpRISCV64MOVBUload {
  4271  			break
  4272  		}
  4273  		v.reset(OpRISCV64MOVDreg)
  4274  		v.AddArg(x)
  4275  		return true
  4276  	}
  4277  	// match: (MOVWUreg x:(MOVHUload _ _))
  4278  	// result: (MOVDreg x)
  4279  	for {
  4280  		x := v_0
  4281  		if x.Op != OpRISCV64MOVHUload {
  4282  			break
  4283  		}
  4284  		v.reset(OpRISCV64MOVDreg)
  4285  		v.AddArg(x)
  4286  		return true
  4287  	}
  4288  	// match: (MOVWUreg x:(MOVWUload _ _))
  4289  	// result: (MOVDreg x)
  4290  	for {
  4291  		x := v_0
  4292  		if x.Op != OpRISCV64MOVWUload {
  4293  			break
  4294  		}
  4295  		v.reset(OpRISCV64MOVDreg)
  4296  		v.AddArg(x)
  4297  		return true
  4298  	}
  4299  	// match: (MOVWUreg x:(MOVBUreg _))
  4300  	// result: (MOVDreg x)
  4301  	for {
  4302  		x := v_0
  4303  		if x.Op != OpRISCV64MOVBUreg {
  4304  			break
  4305  		}
  4306  		v.reset(OpRISCV64MOVDreg)
  4307  		v.AddArg(x)
  4308  		return true
  4309  	}
  4310  	// match: (MOVWUreg x:(MOVHUreg _))
  4311  	// result: (MOVDreg x)
  4312  	for {
  4313  		x := v_0
  4314  		if x.Op != OpRISCV64MOVHUreg {
  4315  			break
  4316  		}
  4317  		v.reset(OpRISCV64MOVDreg)
  4318  		v.AddArg(x)
  4319  		return true
  4320  	}
  4321  	// match: (MOVWUreg x:(MOVWUreg _))
  4322  	// result: (MOVDreg x)
  4323  	for {
  4324  		x := v_0
  4325  		if x.Op != OpRISCV64MOVWUreg {
  4326  			break
  4327  		}
  4328  		v.reset(OpRISCV64MOVDreg)
  4329  		v.AddArg(x)
  4330  		return true
  4331  	}
  4332  	// match: (MOVWUreg <t> x:(MOVWload [off] {sym} ptr mem))
  4333  	// cond: x.Uses == 1 && clobber(x)
  4334  	// result: @x.Block (MOVWUload <t> [off] {sym} ptr mem)
  4335  	for {
  4336  		t := v.Type
  4337  		x := v_0
  4338  		if x.Op != OpRISCV64MOVWload {
  4339  			break
  4340  		}
  4341  		off := auxIntToInt32(x.AuxInt)
  4342  		sym := auxToSym(x.Aux)
  4343  		mem := x.Args[1]
  4344  		ptr := x.Args[0]
  4345  		if !(x.Uses == 1 && clobber(x)) {
  4346  			break
  4347  		}
  4348  		b = x.Block
  4349  		v0 := b.NewValue0(x.Pos, OpRISCV64MOVWUload, t)
  4350  		v.copyOf(v0)
  4351  		v0.AuxInt = int32ToAuxInt(off)
  4352  		v0.Aux = symToAux(sym)
  4353  		v0.AddArg2(ptr, mem)
  4354  		return true
  4355  	}
  4356  	return false
  4357  }
  4358  func rewriteValueRISCV64_OpRISCV64MOVWload(v *Value) bool {
  4359  	v_1 := v.Args[1]
  4360  	v_0 := v.Args[0]
  4361  	// match: (MOVWload [off1] {sym1} (MOVaddr [off2] {sym2} base) mem)
  4362  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  4363  	// result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem)
  4364  	for {
  4365  		off1 := auxIntToInt32(v.AuxInt)
  4366  		sym1 := auxToSym(v.Aux)
  4367  		if v_0.Op != OpRISCV64MOVaddr {
  4368  			break
  4369  		}
  4370  		off2 := auxIntToInt32(v_0.AuxInt)
  4371  		sym2 := auxToSym(v_0.Aux)
  4372  		base := v_0.Args[0]
  4373  		mem := v_1
  4374  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  4375  			break
  4376  		}
  4377  		v.reset(OpRISCV64MOVWload)
  4378  		v.AuxInt = int32ToAuxInt(off1 + off2)
  4379  		v.Aux = symToAux(mergeSym(sym1, sym2))
  4380  		v.AddArg2(base, mem)
  4381  		return true
  4382  	}
  4383  	// match: (MOVWload [off1] {sym} (ADDI [off2] base) mem)
  4384  	// cond: is32Bit(int64(off1)+off2)
  4385  	// result: (MOVWload [off1+int32(off2)] {sym} base mem)
  4386  	for {
  4387  		off1 := auxIntToInt32(v.AuxInt)
  4388  		sym := auxToSym(v.Aux)
  4389  		if v_0.Op != OpRISCV64ADDI {
  4390  			break
  4391  		}
  4392  		off2 := auxIntToInt64(v_0.AuxInt)
  4393  		base := v_0.Args[0]
  4394  		mem := v_1
  4395  		if !(is32Bit(int64(off1) + off2)) {
  4396  			break
  4397  		}
  4398  		v.reset(OpRISCV64MOVWload)
  4399  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  4400  		v.Aux = symToAux(sym)
  4401  		v.AddArg2(base, mem)
  4402  		return true
  4403  	}
  4404  	return false
  4405  }
  4406  func rewriteValueRISCV64_OpRISCV64MOVWreg(v *Value) bool {
  4407  	v_0 := v.Args[0]
  4408  	b := v.Block
  4409  	// match: (MOVWreg (MOVDconst [c]))
  4410  	// result: (MOVDconst [int64(int32(c))])
  4411  	for {
  4412  		if v_0.Op != OpRISCV64MOVDconst {
  4413  			break
  4414  		}
  4415  		c := auxIntToInt64(v_0.AuxInt)
  4416  		v.reset(OpRISCV64MOVDconst)
  4417  		v.AuxInt = int64ToAuxInt(int64(int32(c)))
  4418  		return true
  4419  	}
  4420  	// match: (MOVWreg x:(MOVBload _ _))
  4421  	// result: (MOVDreg x)
  4422  	for {
  4423  		x := v_0
  4424  		if x.Op != OpRISCV64MOVBload {
  4425  			break
  4426  		}
  4427  		v.reset(OpRISCV64MOVDreg)
  4428  		v.AddArg(x)
  4429  		return true
  4430  	}
  4431  	// match: (MOVWreg x:(MOVBUload _ _))
  4432  	// result: (MOVDreg x)
  4433  	for {
  4434  		x := v_0
  4435  		if x.Op != OpRISCV64MOVBUload {
  4436  			break
  4437  		}
  4438  		v.reset(OpRISCV64MOVDreg)
  4439  		v.AddArg(x)
  4440  		return true
  4441  	}
  4442  	// match: (MOVWreg x:(MOVHload _ _))
  4443  	// result: (MOVDreg x)
  4444  	for {
  4445  		x := v_0
  4446  		if x.Op != OpRISCV64MOVHload {
  4447  			break
  4448  		}
  4449  		v.reset(OpRISCV64MOVDreg)
  4450  		v.AddArg(x)
  4451  		return true
  4452  	}
  4453  	// match: (MOVWreg x:(MOVHUload _ _))
  4454  	// result: (MOVDreg x)
  4455  	for {
  4456  		x := v_0
  4457  		if x.Op != OpRISCV64MOVHUload {
  4458  			break
  4459  		}
  4460  		v.reset(OpRISCV64MOVDreg)
  4461  		v.AddArg(x)
  4462  		return true
  4463  	}
  4464  	// match: (MOVWreg x:(MOVWload _ _))
  4465  	// result: (MOVDreg x)
  4466  	for {
  4467  		x := v_0
  4468  		if x.Op != OpRISCV64MOVWload {
  4469  			break
  4470  		}
  4471  		v.reset(OpRISCV64MOVDreg)
  4472  		v.AddArg(x)
  4473  		return true
  4474  	}
  4475  	// match: (MOVWreg x:(MOVBreg _))
  4476  	// result: (MOVDreg x)
  4477  	for {
  4478  		x := v_0
  4479  		if x.Op != OpRISCV64MOVBreg {
  4480  			break
  4481  		}
  4482  		v.reset(OpRISCV64MOVDreg)
  4483  		v.AddArg(x)
  4484  		return true
  4485  	}
  4486  	// match: (MOVWreg x:(MOVBUreg _))
  4487  	// result: (MOVDreg x)
  4488  	for {
  4489  		x := v_0
  4490  		if x.Op != OpRISCV64MOVBUreg {
  4491  			break
  4492  		}
  4493  		v.reset(OpRISCV64MOVDreg)
  4494  		v.AddArg(x)
  4495  		return true
  4496  	}
  4497  	// match: (MOVWreg x:(MOVHreg _))
  4498  	// result: (MOVDreg x)
  4499  	for {
  4500  		x := v_0
  4501  		if x.Op != OpRISCV64MOVHreg {
  4502  			break
  4503  		}
  4504  		v.reset(OpRISCV64MOVDreg)
  4505  		v.AddArg(x)
  4506  		return true
  4507  	}
  4508  	// match: (MOVWreg x:(MOVWreg _))
  4509  	// result: (MOVDreg x)
  4510  	for {
  4511  		x := v_0
  4512  		if x.Op != OpRISCV64MOVWreg {
  4513  			break
  4514  		}
  4515  		v.reset(OpRISCV64MOVDreg)
  4516  		v.AddArg(x)
  4517  		return true
  4518  	}
  4519  	// match: (MOVWreg <t> x:(MOVWUload [off] {sym} ptr mem))
  4520  	// cond: x.Uses == 1 && clobber(x)
  4521  	// result: @x.Block (MOVWload <t> [off] {sym} ptr mem)
  4522  	for {
  4523  		t := v.Type
  4524  		x := v_0
  4525  		if x.Op != OpRISCV64MOVWUload {
  4526  			break
  4527  		}
  4528  		off := auxIntToInt32(x.AuxInt)
  4529  		sym := auxToSym(x.Aux)
  4530  		mem := x.Args[1]
  4531  		ptr := x.Args[0]
  4532  		if !(x.Uses == 1 && clobber(x)) {
  4533  			break
  4534  		}
  4535  		b = x.Block
  4536  		v0 := b.NewValue0(x.Pos, OpRISCV64MOVWload, t)
  4537  		v.copyOf(v0)
  4538  		v0.AuxInt = int32ToAuxInt(off)
  4539  		v0.Aux = symToAux(sym)
  4540  		v0.AddArg2(ptr, mem)
  4541  		return true
  4542  	}
  4543  	return false
  4544  }
  4545  func rewriteValueRISCV64_OpRISCV64MOVWstore(v *Value) bool {
  4546  	v_2 := v.Args[2]
  4547  	v_1 := v.Args[1]
  4548  	v_0 := v.Args[0]
  4549  	// match: (MOVWstore [off1] {sym1} (MOVaddr [off2] {sym2} base) val mem)
  4550  	// cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
  4551  	// result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
  4552  	for {
  4553  		off1 := auxIntToInt32(v.AuxInt)
  4554  		sym1 := auxToSym(v.Aux)
  4555  		if v_0.Op != OpRISCV64MOVaddr {
  4556  			break
  4557  		}
  4558  		off2 := auxIntToInt32(v_0.AuxInt)
  4559  		sym2 := auxToSym(v_0.Aux)
  4560  		base := v_0.Args[0]
  4561  		val := v_1
  4562  		mem := v_2
  4563  		if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
  4564  			break
  4565  		}
  4566  		v.reset(OpRISCV64MOVWstore)
  4567  		v.AuxInt = int32ToAuxInt(off1 + off2)
  4568  		v.Aux = symToAux(mergeSym(sym1, sym2))
  4569  		v.AddArg3(base, val, mem)
  4570  		return true
  4571  	}
  4572  	// match: (MOVWstore [off1] {sym} (ADDI [off2] base) val mem)
  4573  	// cond: is32Bit(int64(off1)+off2)
  4574  	// result: (MOVWstore [off1+int32(off2)] {sym} base val mem)
  4575  	for {
  4576  		off1 := auxIntToInt32(v.AuxInt)
  4577  		sym := auxToSym(v.Aux)
  4578  		if v_0.Op != OpRISCV64ADDI {
  4579  			break
  4580  		}
  4581  		off2 := auxIntToInt64(v_0.AuxInt)
  4582  		base := v_0.Args[0]
  4583  		val := v_1
  4584  		mem := v_2
  4585  		if !(is32Bit(int64(off1) + off2)) {
  4586  			break
  4587  		}
  4588  		v.reset(OpRISCV64MOVWstore)
  4589  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  4590  		v.Aux = symToAux(sym)
  4591  		v.AddArg3(base, val, mem)
  4592  		return true
  4593  	}
  4594  	// match: (MOVWstore [off] {sym} ptr (MOVDconst [0]) mem)
  4595  	// result: (MOVWstorezero [off] {sym} ptr mem)
  4596  	for {
  4597  		off := auxIntToInt32(v.AuxInt)
  4598  		sym := auxToSym(v.Aux)
  4599  		ptr := v_0
  4600  		if v_1.Op != OpRISCV64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
  4601  			break
  4602  		}
  4603  		mem := v_2
  4604  		v.reset(OpRISCV64MOVWstorezero)
  4605  		v.AuxInt = int32ToAuxInt(off)
  4606  		v.Aux = symToAux(sym)
  4607  		v.AddArg2(ptr, mem)
  4608  		return true
  4609  	}
  4610  	// match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem)
  4611  	// result: (MOVWstore [off] {sym} ptr x mem)
  4612  	for {
  4613  		off := auxIntToInt32(v.AuxInt)
  4614  		sym := auxToSym(v.Aux)
  4615  		ptr := v_0
  4616  		if v_1.Op != OpRISCV64MOVWreg {
  4617  			break
  4618  		}
  4619  		x := v_1.Args[0]
  4620  		mem := v_2
  4621  		v.reset(OpRISCV64MOVWstore)
  4622  		v.AuxInt = int32ToAuxInt(off)
  4623  		v.Aux = symToAux(sym)
  4624  		v.AddArg3(ptr, x, mem)
  4625  		return true
  4626  	}
  4627  	// match: (MOVWstore [off] {sym} ptr (MOVWUreg x) mem)
  4628  	// result: (MOVWstore [off] {sym} ptr x mem)
  4629  	for {
  4630  		off := auxIntToInt32(v.AuxInt)
  4631  		sym := auxToSym(v.Aux)
  4632  		ptr := v_0
  4633  		if v_1.Op != OpRISCV64MOVWUreg {
  4634  			break
  4635  		}
  4636  		x := v_1.Args[0]
  4637  		mem := v_2
  4638  		v.reset(OpRISCV64MOVWstore)
  4639  		v.AuxInt = int32ToAuxInt(off)
  4640  		v.Aux = symToAux(sym)
  4641  		v.AddArg3(ptr, x, mem)
  4642  		return true
  4643  	}
  4644  	return false
  4645  }
  4646  func rewriteValueRISCV64_OpRISCV64MOVWstorezero(v *Value) bool {
  4647  	v_1 := v.Args[1]
  4648  	v_0 := v.Args[0]
  4649  	// match: (MOVWstorezero [off1] {sym1} (MOVaddr [off2] {sym2} ptr) mem)
  4650  	// cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2))
  4651  	// result: (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
  4652  	for {
  4653  		off1 := auxIntToInt32(v.AuxInt)
  4654  		sym1 := auxToSym(v.Aux)
  4655  		if v_0.Op != OpRISCV64MOVaddr {
  4656  			break
  4657  		}
  4658  		off2 := auxIntToInt32(v_0.AuxInt)
  4659  		sym2 := auxToSym(v_0.Aux)
  4660  		ptr := v_0.Args[0]
  4661  		mem := v_1
  4662  		if !(canMergeSym(sym1, sym2) && is32Bit(int64(off1)+int64(off2))) {
  4663  			break
  4664  		}
  4665  		v.reset(OpRISCV64MOVWstorezero)
  4666  		v.AuxInt = int32ToAuxInt(off1 + off2)
  4667  		v.Aux = symToAux(mergeSym(sym1, sym2))
  4668  		v.AddArg2(ptr, mem)
  4669  		return true
  4670  	}
  4671  	// match: (MOVWstorezero [off1] {sym} (ADDI [off2] ptr) mem)
  4672  	// cond: is32Bit(int64(off1)+off2)
  4673  	// result: (MOVWstorezero [off1+int32(off2)] {sym} ptr mem)
  4674  	for {
  4675  		off1 := auxIntToInt32(v.AuxInt)
  4676  		sym := auxToSym(v.Aux)
  4677  		if v_0.Op != OpRISCV64ADDI {
  4678  			break
  4679  		}
  4680  		off2 := auxIntToInt64(v_0.AuxInt)
  4681  		ptr := v_0.Args[0]
  4682  		mem := v_1
  4683  		if !(is32Bit(int64(off1) + off2)) {
  4684  			break
  4685  		}
  4686  		v.reset(OpRISCV64MOVWstorezero)
  4687  		v.AuxInt = int32ToAuxInt(off1 + int32(off2))
  4688  		v.Aux = symToAux(sym)
  4689  		v.AddArg2(ptr, mem)
  4690  		return true
  4691  	}
  4692  	return false
  4693  }
  4694  func rewriteValueRISCV64_OpRISCV64NEG(v *Value) bool {
  4695  	v_0 := v.Args[0]
  4696  	// match: (NEG (MOVDconst [x]))
  4697  	// result: (MOVDconst [-x])
  4698  	for {
  4699  		if v_0.Op != OpRISCV64MOVDconst {
  4700  			break
  4701  		}
  4702  		x := auxIntToInt64(v_0.AuxInt)
  4703  		v.reset(OpRISCV64MOVDconst)
  4704  		v.AuxInt = int64ToAuxInt(-x)
  4705  		return true
  4706  	}
  4707  	return false
  4708  }
  4709  func rewriteValueRISCV64_OpRISCV64NEGW(v *Value) bool {
  4710  	v_0 := v.Args[0]
  4711  	// match: (NEGW (MOVDconst [x]))
  4712  	// result: (MOVDconst [int64(int32(-x))])
  4713  	for {
  4714  		if v_0.Op != OpRISCV64MOVDconst {
  4715  			break
  4716  		}
  4717  		x := auxIntToInt64(v_0.AuxInt)
  4718  		v.reset(OpRISCV64MOVDconst)
  4719  		v.AuxInt = int64ToAuxInt(int64(int32(-x)))
  4720  		return true
  4721  	}
  4722  	return false
  4723  }
  4724  func rewriteValueRISCV64_OpRISCV64OR(v *Value) bool {
  4725  	v_1 := v.Args[1]
  4726  	v_0 := v.Args[0]
  4727  	// match: (OR (MOVDconst [val]) x)
  4728  	// cond: is32Bit(val)
  4729  	// result: (ORI [val] x)
  4730  	for {
  4731  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
  4732  			if v_0.Op != OpRISCV64MOVDconst {
  4733  				continue
  4734  			}
  4735  			val := auxIntToInt64(v_0.AuxInt)
  4736  			x := v_1
  4737  			if !(is32Bit(val)) {
  4738  				continue
  4739  			}
  4740  			v.reset(OpRISCV64ORI)
  4741  			v.AuxInt = int64ToAuxInt(val)
  4742  			v.AddArg(x)
  4743  			return true
  4744  		}
  4745  		break
  4746  	}
  4747  	return false
  4748  }
  4749  func rewriteValueRISCV64_OpRISCV64ORI(v *Value) bool {
  4750  	v_0 := v.Args[0]
  4751  	// match: (ORI [0] x)
  4752  	// result: x
  4753  	for {
  4754  		if auxIntToInt64(v.AuxInt) != 0 {
  4755  			break
  4756  		}
  4757  		x := v_0
  4758  		v.copyOf(x)
  4759  		return true
  4760  	}
  4761  	// match: (ORI [-1] x)
  4762  	// result: (MOVDconst [-1])
  4763  	for {
  4764  		if auxIntToInt64(v.AuxInt) != -1 {
  4765  			break
  4766  		}
  4767  		v.reset(OpRISCV64MOVDconst)
  4768  		v.AuxInt = int64ToAuxInt(-1)
  4769  		return true
  4770  	}
  4771  	// match: (ORI [x] (MOVDconst [y]))
  4772  	// result: (MOVDconst [x | y])
  4773  	for {
  4774  		x := auxIntToInt64(v.AuxInt)
  4775  		if v_0.Op != OpRISCV64MOVDconst {
  4776  			break
  4777  		}
  4778  		y := auxIntToInt64(v_0.AuxInt)
  4779  		v.reset(OpRISCV64MOVDconst)
  4780  		v.AuxInt = int64ToAuxInt(x | y)
  4781  		return true
  4782  	}
  4783  	return false
  4784  }
  4785  func rewriteValueRISCV64_OpRISCV64SLL(v *Value) bool {
  4786  	v_1 := v.Args[1]
  4787  	v_0 := v.Args[0]
  4788  	// match: (SLL x (MOVDconst [val]))
  4789  	// result: (SLLI [int64(val&63)] x)
  4790  	for {
  4791  		x := v_0
  4792  		if v_1.Op != OpRISCV64MOVDconst {
  4793  			break
  4794  		}
  4795  		val := auxIntToInt64(v_1.AuxInt)
  4796  		v.reset(OpRISCV64SLLI)
  4797  		v.AuxInt = int64ToAuxInt(int64(val & 63))
  4798  		v.AddArg(x)
  4799  		return true
  4800  	}
  4801  	return false
  4802  }
  4803  func rewriteValueRISCV64_OpRISCV64SLLI(v *Value) bool {
  4804  	v_0 := v.Args[0]
  4805  	// match: (SLLI [x] (MOVDconst [y]))
  4806  	// cond: is32Bit(y << x)
  4807  	// result: (MOVDconst [y << x])
  4808  	for {
  4809  		x := auxIntToInt64(v.AuxInt)
  4810  		if v_0.Op != OpRISCV64MOVDconst {
  4811  			break
  4812  		}
  4813  		y := auxIntToInt64(v_0.AuxInt)
  4814  		if !(is32Bit(y << x)) {
  4815  			break
  4816  		}
  4817  		v.reset(OpRISCV64MOVDconst)
  4818  		v.AuxInt = int64ToAuxInt(y << x)
  4819  		return true
  4820  	}
  4821  	return false
  4822  }
  4823  func rewriteValueRISCV64_OpRISCV64SLTI(v *Value) bool {
  4824  	v_0 := v.Args[0]
  4825  	// match: (SLTI [x] (MOVDconst [y]))
  4826  	// result: (MOVDconst [b2i(int64(y) < int64(x))])
  4827  	for {
  4828  		x := auxIntToInt64(v.AuxInt)
  4829  		if v_0.Op != OpRISCV64MOVDconst {
  4830  			break
  4831  		}
  4832  		y := auxIntToInt64(v_0.AuxInt)
  4833  		v.reset(OpRISCV64MOVDconst)
  4834  		v.AuxInt = int64ToAuxInt(b2i(int64(y) < int64(x)))
  4835  		return true
  4836  	}
  4837  	return false
  4838  }
  4839  func rewriteValueRISCV64_OpRISCV64SLTIU(v *Value) bool {
  4840  	v_0 := v.Args[0]
  4841  	// match: (SLTIU [x] (MOVDconst [y]))
  4842  	// result: (MOVDconst [b2i(uint64(y) < uint64(x))])
  4843  	for {
  4844  		x := auxIntToInt64(v.AuxInt)
  4845  		if v_0.Op != OpRISCV64MOVDconst {
  4846  			break
  4847  		}
  4848  		y := auxIntToInt64(v_0.AuxInt)
  4849  		v.reset(OpRISCV64MOVDconst)
  4850  		v.AuxInt = int64ToAuxInt(b2i(uint64(y) < uint64(x)))
  4851  		return true
  4852  	}
  4853  	return false
  4854  }
  4855  func rewriteValueRISCV64_OpRISCV64SRA(v *Value) bool {
  4856  	v_1 := v.Args[1]
  4857  	v_0 := v.Args[0]
  4858  	// match: (SRA x (MOVDconst [val]))
  4859  	// result: (SRAI [int64(val&63)] x)
  4860  	for {
  4861  		x := v_0
  4862  		if v_1.Op != OpRISCV64MOVDconst {
  4863  			break
  4864  		}
  4865  		val := auxIntToInt64(v_1.AuxInt)
  4866  		v.reset(OpRISCV64SRAI)
  4867  		v.AuxInt = int64ToAuxInt(int64(val & 63))
  4868  		v.AddArg(x)
  4869  		return true
  4870  	}
  4871  	return false
  4872  }
  4873  func rewriteValueRISCV64_OpRISCV64SRAI(v *Value) bool {
  4874  	v_0 := v.Args[0]
  4875  	// match: (SRAI [x] (MOVDconst [y]))
  4876  	// result: (MOVDconst [int64(y) >> x])
  4877  	for {
  4878  		x := auxIntToInt64(v.AuxInt)
  4879  		if v_0.Op != OpRISCV64MOVDconst {
  4880  			break
  4881  		}
  4882  		y := auxIntToInt64(v_0.AuxInt)
  4883  		v.reset(OpRISCV64MOVDconst)
  4884  		v.AuxInt = int64ToAuxInt(int64(y) >> x)
  4885  		return true
  4886  	}
  4887  	return false
  4888  }
  4889  func rewriteValueRISCV64_OpRISCV64SRL(v *Value) bool {
  4890  	v_1 := v.Args[1]
  4891  	v_0 := v.Args[0]
  4892  	// match: (SRL x (MOVDconst [val]))
  4893  	// result: (SRLI [int64(val&63)] x)
  4894  	for {
  4895  		x := v_0
  4896  		if v_1.Op != OpRISCV64MOVDconst {
  4897  			break
  4898  		}
  4899  		val := auxIntToInt64(v_1.AuxInt)
  4900  		v.reset(OpRISCV64SRLI)
  4901  		v.AuxInt = int64ToAuxInt(int64(val & 63))
  4902  		v.AddArg(x)
  4903  		return true
  4904  	}
  4905  	return false
  4906  }
  4907  func rewriteValueRISCV64_OpRISCV64SRLI(v *Value) bool {
  4908  	v_0 := v.Args[0]
  4909  	// match: (SRLI [x] (MOVDconst [y]))
  4910  	// result: (MOVDconst [int64(uint64(y) >> x)])
  4911  	for {
  4912  		x := auxIntToInt64(v.AuxInt)
  4913  		if v_0.Op != OpRISCV64MOVDconst {
  4914  			break
  4915  		}
  4916  		y := auxIntToInt64(v_0.AuxInt)
  4917  		v.reset(OpRISCV64MOVDconst)
  4918  		v.AuxInt = int64ToAuxInt(int64(uint64(y) >> x))
  4919  		return true
  4920  	}
  4921  	return false
  4922  }
  4923  func rewriteValueRISCV64_OpRISCV64SUB(v *Value) bool {
  4924  	v_1 := v.Args[1]
  4925  	v_0 := v.Args[0]
  4926  	// match: (SUB x (MOVDconst [val]))
  4927  	// cond: is32Bit(-val)
  4928  	// result: (ADDI [-val] x)
  4929  	for {
  4930  		x := v_0
  4931  		if v_1.Op != OpRISCV64MOVDconst {
  4932  			break
  4933  		}
  4934  		val := auxIntToInt64(v_1.AuxInt)
  4935  		if !(is32Bit(-val)) {
  4936  			break
  4937  		}
  4938  		v.reset(OpRISCV64ADDI)
  4939  		v.AuxInt = int64ToAuxInt(-val)
  4940  		v.AddArg(x)
  4941  		return true
  4942  	}
  4943  	// match: (SUB x (MOVDconst [0]))
  4944  	// result: x
  4945  	for {
  4946  		x := v_0
  4947  		if v_1.Op != OpRISCV64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
  4948  			break
  4949  		}
  4950  		v.copyOf(x)
  4951  		return true
  4952  	}
  4953  	// match: (SUB (MOVDconst [0]) x)
  4954  	// result: (NEG x)
  4955  	for {
  4956  		if v_0.Op != OpRISCV64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0 {
  4957  			break
  4958  		}
  4959  		x := v_1
  4960  		v.reset(OpRISCV64NEG)
  4961  		v.AddArg(x)
  4962  		return true
  4963  	}
  4964  	return false
  4965  }
  4966  func rewriteValueRISCV64_OpRISCV64SUBW(v *Value) bool {
  4967  	v_1 := v.Args[1]
  4968  	v_0 := v.Args[0]
  4969  	// match: (SUBW x (MOVDconst [0]))
  4970  	// result: (ADDIW [0] x)
  4971  	for {
  4972  		x := v_0
  4973  		if v_1.Op != OpRISCV64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
  4974  			break
  4975  		}
  4976  		v.reset(OpRISCV64ADDIW)
  4977  		v.AuxInt = int64ToAuxInt(0)
  4978  		v.AddArg(x)
  4979  		return true
  4980  	}
  4981  	// match: (SUBW (MOVDconst [0]) x)
  4982  	// result: (NEGW x)
  4983  	for {
  4984  		if v_0.Op != OpRISCV64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0 {
  4985  			break
  4986  		}
  4987  		x := v_1
  4988  		v.reset(OpRISCV64NEGW)
  4989  		v.AddArg(x)
  4990  		return true
  4991  	}
  4992  	return false
  4993  }
  4994  func rewriteValueRISCV64_OpRISCV64XOR(v *Value) bool {
  4995  	v_1 := v.Args[1]
  4996  	v_0 := v.Args[0]
  4997  	// match: (XOR (MOVDconst [val]) x)
  4998  	// cond: is32Bit(val)
  4999  	// result: (XORI [val] x)
  5000  	for {
  5001  		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
  5002  			if v_0.Op != OpRISCV64MOVDconst {
  5003  				continue
  5004  			}
  5005  			val := auxIntToInt64(v_0.AuxInt)
  5006  			x := v_1
  5007  			if !(is32Bit(val)) {
  5008  				continue
  5009  			}
  5010  			v.reset(OpRISCV64XORI)
  5011  			v.AuxInt = int64ToAuxInt(val)
  5012  			v.AddArg(x)
  5013  			return true
  5014  		}
  5015  		break
  5016  	}
  5017  	return false
  5018  }
  5019  func rewriteValueRISCV64_OpRotateLeft16(v *Value) bool {
  5020  	v_1 := v.Args[1]
  5021  	v_0 := v.Args[0]
  5022  	b := v.Block
  5023  	typ := &b.Func.Config.Types
  5024  	// match: (RotateLeft16 <t> x (MOVDconst [c]))
  5025  	// result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15])))
  5026  	for {
  5027  		t := v.Type
  5028  		x := v_0
  5029  		if v_1.Op != OpRISCV64MOVDconst {
  5030  			break
  5031  		}
  5032  		c := auxIntToInt64(v_1.AuxInt)
  5033  		v.reset(OpOr16)
  5034  		v0 := b.NewValue0(v.Pos, OpLsh16x64, t)
  5035  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  5036  		v1.AuxInt = int64ToAuxInt(c & 15)
  5037  		v0.AddArg2(x, v1)
  5038  		v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t)
  5039  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  5040  		v3.AuxInt = int64ToAuxInt(-c & 15)
  5041  		v2.AddArg2(x, v3)
  5042  		v.AddArg2(v0, v2)
  5043  		return true
  5044  	}
  5045  	return false
  5046  }
  5047  func rewriteValueRISCV64_OpRotateLeft32(v *Value) bool {
  5048  	v_1 := v.Args[1]
  5049  	v_0 := v.Args[0]
  5050  	b := v.Block
  5051  	typ := &b.Func.Config.Types
  5052  	// match: (RotateLeft32 <t> x (MOVDconst [c]))
  5053  	// result: (Or32 (Lsh32x64 <t> x (MOVDconst [c&31])) (Rsh32Ux64 <t> x (MOVDconst [-c&31])))
  5054  	for {
  5055  		t := v.Type
  5056  		x := v_0
  5057  		if v_1.Op != OpRISCV64MOVDconst {
  5058  			break
  5059  		}
  5060  		c := auxIntToInt64(v_1.AuxInt)
  5061  		v.reset(OpOr32)
  5062  		v0 := b.NewValue0(v.Pos, OpLsh32x64, t)
  5063  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  5064  		v1.AuxInt = int64ToAuxInt(c & 31)
  5065  		v0.AddArg2(x, v1)
  5066  		v2 := b.NewValue0(v.Pos, OpRsh32Ux64, t)
  5067  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  5068  		v3.AuxInt = int64ToAuxInt(-c & 31)
  5069  		v2.AddArg2(x, v3)
  5070  		v.AddArg2(v0, v2)
  5071  		return true
  5072  	}
  5073  	return false
  5074  }
  5075  func rewriteValueRISCV64_OpRotateLeft64(v *Value) bool {
  5076  	v_1 := v.Args[1]
  5077  	v_0 := v.Args[0]
  5078  	b := v.Block
  5079  	typ := &b.Func.Config.Types
  5080  	// match: (RotateLeft64 <t> x (MOVDconst [c]))
  5081  	// result: (Or64 (Lsh64x64 <t> x (MOVDconst [c&63])) (Rsh64Ux64 <t> x (MOVDconst [-c&63])))
  5082  	for {
  5083  		t := v.Type
  5084  		x := v_0
  5085  		if v_1.Op != OpRISCV64MOVDconst {
  5086  			break
  5087  		}
  5088  		c := auxIntToInt64(v_1.AuxInt)
  5089  		v.reset(OpOr64)
  5090  		v0 := b.NewValue0(v.Pos, OpLsh64x64, t)
  5091  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  5092  		v1.AuxInt = int64ToAuxInt(c & 63)
  5093  		v0.AddArg2(x, v1)
  5094  		v2 := b.NewValue0(v.Pos, OpRsh64Ux64, t)
  5095  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  5096  		v3.AuxInt = int64ToAuxInt(-c & 63)
  5097  		v2.AddArg2(x, v3)
  5098  		v.AddArg2(v0, v2)
  5099  		return true
  5100  	}
  5101  	return false
  5102  }
  5103  func rewriteValueRISCV64_OpRotateLeft8(v *Value) bool {
  5104  	v_1 := v.Args[1]
  5105  	v_0 := v.Args[0]
  5106  	b := v.Block
  5107  	typ := &b.Func.Config.Types
  5108  	// match: (RotateLeft8 <t> x (MOVDconst [c]))
  5109  	// result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7])))
  5110  	for {
  5111  		t := v.Type
  5112  		x := v_0
  5113  		if v_1.Op != OpRISCV64MOVDconst {
  5114  			break
  5115  		}
  5116  		c := auxIntToInt64(v_1.AuxInt)
  5117  		v.reset(OpOr8)
  5118  		v0 := b.NewValue0(v.Pos, OpLsh8x64, t)
  5119  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  5120  		v1.AuxInt = int64ToAuxInt(c & 7)
  5121  		v0.AddArg2(x, v1)
  5122  		v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t)
  5123  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  5124  		v3.AuxInt = int64ToAuxInt(-c & 7)
  5125  		v2.AddArg2(x, v3)
  5126  		v.AddArg2(v0, v2)
  5127  		return true
  5128  	}
  5129  	return false
  5130  }
  5131  func rewriteValueRISCV64_OpRsh16Ux16(v *Value) bool {
  5132  	v_1 := v.Args[1]
  5133  	v_0 := v.Args[0]
  5134  	b := v.Block
  5135  	typ := &b.Func.Config.Types
  5136  	// match: (Rsh16Ux16 <t> x y)
  5137  	// result: (AND (SRL <t> (ZeroExt16to64 x) y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt16to64 y))))
  5138  	for {
  5139  		t := v.Type
  5140  		x := v_0
  5141  		y := v_1
  5142  		v.reset(OpRISCV64AND)
  5143  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5144  		v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5145  		v1.AddArg(x)
  5146  		v0.AddArg2(v1, y)
  5147  		v2 := b.NewValue0(v.Pos, OpNeg16, t)
  5148  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5149  		v3.AuxInt = int64ToAuxInt(64)
  5150  		v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5151  		v4.AddArg(y)
  5152  		v3.AddArg(v4)
  5153  		v2.AddArg(v3)
  5154  		v.AddArg2(v0, v2)
  5155  		return true
  5156  	}
  5157  }
  5158  func rewriteValueRISCV64_OpRsh16Ux32(v *Value) bool {
  5159  	v_1 := v.Args[1]
  5160  	v_0 := v.Args[0]
  5161  	b := v.Block
  5162  	typ := &b.Func.Config.Types
  5163  	// match: (Rsh16Ux32 <t> x y)
  5164  	// result: (AND (SRL <t> (ZeroExt16to64 x) y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt32to64 y))))
  5165  	for {
  5166  		t := v.Type
  5167  		x := v_0
  5168  		y := v_1
  5169  		v.reset(OpRISCV64AND)
  5170  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5171  		v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5172  		v1.AddArg(x)
  5173  		v0.AddArg2(v1, y)
  5174  		v2 := b.NewValue0(v.Pos, OpNeg16, t)
  5175  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5176  		v3.AuxInt = int64ToAuxInt(64)
  5177  		v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5178  		v4.AddArg(y)
  5179  		v3.AddArg(v4)
  5180  		v2.AddArg(v3)
  5181  		v.AddArg2(v0, v2)
  5182  		return true
  5183  	}
  5184  }
  5185  func rewriteValueRISCV64_OpRsh16Ux64(v *Value) bool {
  5186  	v_1 := v.Args[1]
  5187  	v_0 := v.Args[0]
  5188  	b := v.Block
  5189  	typ := &b.Func.Config.Types
  5190  	// match: (Rsh16Ux64 <t> x y)
  5191  	// result: (AND (SRL <t> (ZeroExt16to64 x) y) (Neg16 <t> (SLTIU <t> [64] y)))
  5192  	for {
  5193  		t := v.Type
  5194  		x := v_0
  5195  		y := v_1
  5196  		v.reset(OpRISCV64AND)
  5197  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5198  		v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5199  		v1.AddArg(x)
  5200  		v0.AddArg2(v1, y)
  5201  		v2 := b.NewValue0(v.Pos, OpNeg16, t)
  5202  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5203  		v3.AuxInt = int64ToAuxInt(64)
  5204  		v3.AddArg(y)
  5205  		v2.AddArg(v3)
  5206  		v.AddArg2(v0, v2)
  5207  		return true
  5208  	}
  5209  }
  5210  func rewriteValueRISCV64_OpRsh16Ux8(v *Value) bool {
  5211  	v_1 := v.Args[1]
  5212  	v_0 := v.Args[0]
  5213  	b := v.Block
  5214  	typ := &b.Func.Config.Types
  5215  	// match: (Rsh16Ux8 <t> x y)
  5216  	// result: (AND (SRL <t> (ZeroExt16to64 x) y) (Neg16 <t> (SLTIU <t> [64] (ZeroExt8to64 y))))
  5217  	for {
  5218  		t := v.Type
  5219  		x := v_0
  5220  		y := v_1
  5221  		v.reset(OpRISCV64AND)
  5222  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5223  		v1 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5224  		v1.AddArg(x)
  5225  		v0.AddArg2(v1, y)
  5226  		v2 := b.NewValue0(v.Pos, OpNeg16, t)
  5227  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5228  		v3.AuxInt = int64ToAuxInt(64)
  5229  		v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5230  		v4.AddArg(y)
  5231  		v3.AddArg(v4)
  5232  		v2.AddArg(v3)
  5233  		v.AddArg2(v0, v2)
  5234  		return true
  5235  	}
  5236  }
  5237  func rewriteValueRISCV64_OpRsh16x16(v *Value) bool {
  5238  	v_1 := v.Args[1]
  5239  	v_0 := v.Args[0]
  5240  	b := v.Block
  5241  	typ := &b.Func.Config.Types
  5242  	// match: (Rsh16x16 <t> x y)
  5243  	// result: (SRA <t> (SignExt16to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt16to64 y)))))
  5244  	for {
  5245  		t := v.Type
  5246  		x := v_0
  5247  		y := v_1
  5248  		v.reset(OpRISCV64SRA)
  5249  		v.Type = t
  5250  		v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
  5251  		v0.AddArg(x)
  5252  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5253  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5254  		v2.AuxInt = int64ToAuxInt(-1)
  5255  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5256  		v3.AuxInt = int64ToAuxInt(64)
  5257  		v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5258  		v4.AddArg(y)
  5259  		v3.AddArg(v4)
  5260  		v2.AddArg(v3)
  5261  		v1.AddArg2(y, v2)
  5262  		v.AddArg2(v0, v1)
  5263  		return true
  5264  	}
  5265  }
  5266  func rewriteValueRISCV64_OpRsh16x32(v *Value) bool {
  5267  	v_1 := v.Args[1]
  5268  	v_0 := v.Args[0]
  5269  	b := v.Block
  5270  	typ := &b.Func.Config.Types
  5271  	// match: (Rsh16x32 <t> x y)
  5272  	// result: (SRA <t> (SignExt16to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt32to64 y)))))
  5273  	for {
  5274  		t := v.Type
  5275  		x := v_0
  5276  		y := v_1
  5277  		v.reset(OpRISCV64SRA)
  5278  		v.Type = t
  5279  		v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
  5280  		v0.AddArg(x)
  5281  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5282  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5283  		v2.AuxInt = int64ToAuxInt(-1)
  5284  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5285  		v3.AuxInt = int64ToAuxInt(64)
  5286  		v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5287  		v4.AddArg(y)
  5288  		v3.AddArg(v4)
  5289  		v2.AddArg(v3)
  5290  		v1.AddArg2(y, v2)
  5291  		v.AddArg2(v0, v1)
  5292  		return true
  5293  	}
  5294  }
  5295  func rewriteValueRISCV64_OpRsh16x64(v *Value) bool {
  5296  	v_1 := v.Args[1]
  5297  	v_0 := v.Args[0]
  5298  	b := v.Block
  5299  	typ := &b.Func.Config.Types
  5300  	// match: (Rsh16x64 <t> x y)
  5301  	// result: (SRA <t> (SignExt16to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] y))))
  5302  	for {
  5303  		t := v.Type
  5304  		x := v_0
  5305  		y := v_1
  5306  		v.reset(OpRISCV64SRA)
  5307  		v.Type = t
  5308  		v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
  5309  		v0.AddArg(x)
  5310  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5311  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5312  		v2.AuxInt = int64ToAuxInt(-1)
  5313  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5314  		v3.AuxInt = int64ToAuxInt(64)
  5315  		v3.AddArg(y)
  5316  		v2.AddArg(v3)
  5317  		v1.AddArg2(y, v2)
  5318  		v.AddArg2(v0, v1)
  5319  		return true
  5320  	}
  5321  }
  5322  func rewriteValueRISCV64_OpRsh16x8(v *Value) bool {
  5323  	v_1 := v.Args[1]
  5324  	v_0 := v.Args[0]
  5325  	b := v.Block
  5326  	typ := &b.Func.Config.Types
  5327  	// match: (Rsh16x8 <t> x y)
  5328  	// result: (SRA <t> (SignExt16to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt8to64 y)))))
  5329  	for {
  5330  		t := v.Type
  5331  		x := v_0
  5332  		y := v_1
  5333  		v.reset(OpRISCV64SRA)
  5334  		v.Type = t
  5335  		v0 := b.NewValue0(v.Pos, OpSignExt16to64, typ.Int64)
  5336  		v0.AddArg(x)
  5337  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5338  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5339  		v2.AuxInt = int64ToAuxInt(-1)
  5340  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5341  		v3.AuxInt = int64ToAuxInt(64)
  5342  		v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5343  		v4.AddArg(y)
  5344  		v3.AddArg(v4)
  5345  		v2.AddArg(v3)
  5346  		v1.AddArg2(y, v2)
  5347  		v.AddArg2(v0, v1)
  5348  		return true
  5349  	}
  5350  }
  5351  func rewriteValueRISCV64_OpRsh32Ux16(v *Value) bool {
  5352  	v_1 := v.Args[1]
  5353  	v_0 := v.Args[0]
  5354  	b := v.Block
  5355  	typ := &b.Func.Config.Types
  5356  	// match: (Rsh32Ux16 <t> x y)
  5357  	// result: (AND (SRL <t> (ZeroExt32to64 x) y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt16to64 y))))
  5358  	for {
  5359  		t := v.Type
  5360  		x := v_0
  5361  		y := v_1
  5362  		v.reset(OpRISCV64AND)
  5363  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5364  		v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5365  		v1.AddArg(x)
  5366  		v0.AddArg2(v1, y)
  5367  		v2 := b.NewValue0(v.Pos, OpNeg32, t)
  5368  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5369  		v3.AuxInt = int64ToAuxInt(64)
  5370  		v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5371  		v4.AddArg(y)
  5372  		v3.AddArg(v4)
  5373  		v2.AddArg(v3)
  5374  		v.AddArg2(v0, v2)
  5375  		return true
  5376  	}
  5377  }
  5378  func rewriteValueRISCV64_OpRsh32Ux32(v *Value) bool {
  5379  	v_1 := v.Args[1]
  5380  	v_0 := v.Args[0]
  5381  	b := v.Block
  5382  	typ := &b.Func.Config.Types
  5383  	// match: (Rsh32Ux32 <t> x y)
  5384  	// result: (AND (SRL <t> (ZeroExt32to64 x) y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt32to64 y))))
  5385  	for {
  5386  		t := v.Type
  5387  		x := v_0
  5388  		y := v_1
  5389  		v.reset(OpRISCV64AND)
  5390  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5391  		v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5392  		v1.AddArg(x)
  5393  		v0.AddArg2(v1, y)
  5394  		v2 := b.NewValue0(v.Pos, OpNeg32, t)
  5395  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5396  		v3.AuxInt = int64ToAuxInt(64)
  5397  		v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5398  		v4.AddArg(y)
  5399  		v3.AddArg(v4)
  5400  		v2.AddArg(v3)
  5401  		v.AddArg2(v0, v2)
  5402  		return true
  5403  	}
  5404  }
  5405  func rewriteValueRISCV64_OpRsh32Ux64(v *Value) bool {
  5406  	v_1 := v.Args[1]
  5407  	v_0 := v.Args[0]
  5408  	b := v.Block
  5409  	typ := &b.Func.Config.Types
  5410  	// match: (Rsh32Ux64 <t> x y)
  5411  	// result: (AND (SRL <t> (ZeroExt32to64 x) y) (Neg32 <t> (SLTIU <t> [64] y)))
  5412  	for {
  5413  		t := v.Type
  5414  		x := v_0
  5415  		y := v_1
  5416  		v.reset(OpRISCV64AND)
  5417  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5418  		v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5419  		v1.AddArg(x)
  5420  		v0.AddArg2(v1, y)
  5421  		v2 := b.NewValue0(v.Pos, OpNeg32, t)
  5422  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5423  		v3.AuxInt = int64ToAuxInt(64)
  5424  		v3.AddArg(y)
  5425  		v2.AddArg(v3)
  5426  		v.AddArg2(v0, v2)
  5427  		return true
  5428  	}
  5429  }
  5430  func rewriteValueRISCV64_OpRsh32Ux8(v *Value) bool {
  5431  	v_1 := v.Args[1]
  5432  	v_0 := v.Args[0]
  5433  	b := v.Block
  5434  	typ := &b.Func.Config.Types
  5435  	// match: (Rsh32Ux8 <t> x y)
  5436  	// result: (AND (SRL <t> (ZeroExt32to64 x) y) (Neg32 <t> (SLTIU <t> [64] (ZeroExt8to64 y))))
  5437  	for {
  5438  		t := v.Type
  5439  		x := v_0
  5440  		y := v_1
  5441  		v.reset(OpRISCV64AND)
  5442  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5443  		v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5444  		v1.AddArg(x)
  5445  		v0.AddArg2(v1, y)
  5446  		v2 := b.NewValue0(v.Pos, OpNeg32, t)
  5447  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5448  		v3.AuxInt = int64ToAuxInt(64)
  5449  		v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5450  		v4.AddArg(y)
  5451  		v3.AddArg(v4)
  5452  		v2.AddArg(v3)
  5453  		v.AddArg2(v0, v2)
  5454  		return true
  5455  	}
  5456  }
  5457  func rewriteValueRISCV64_OpRsh32x16(v *Value) bool {
  5458  	v_1 := v.Args[1]
  5459  	v_0 := v.Args[0]
  5460  	b := v.Block
  5461  	typ := &b.Func.Config.Types
  5462  	// match: (Rsh32x16 <t> x y)
  5463  	// result: (SRA <t> (SignExt32to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt16to64 y)))))
  5464  	for {
  5465  		t := v.Type
  5466  		x := v_0
  5467  		y := v_1
  5468  		v.reset(OpRISCV64SRA)
  5469  		v.Type = t
  5470  		v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
  5471  		v0.AddArg(x)
  5472  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5473  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5474  		v2.AuxInt = int64ToAuxInt(-1)
  5475  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5476  		v3.AuxInt = int64ToAuxInt(64)
  5477  		v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5478  		v4.AddArg(y)
  5479  		v3.AddArg(v4)
  5480  		v2.AddArg(v3)
  5481  		v1.AddArg2(y, v2)
  5482  		v.AddArg2(v0, v1)
  5483  		return true
  5484  	}
  5485  }
  5486  func rewriteValueRISCV64_OpRsh32x32(v *Value) bool {
  5487  	v_1 := v.Args[1]
  5488  	v_0 := v.Args[0]
  5489  	b := v.Block
  5490  	typ := &b.Func.Config.Types
  5491  	// match: (Rsh32x32 <t> x y)
  5492  	// result: (SRA <t> (SignExt32to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt32to64 y)))))
  5493  	for {
  5494  		t := v.Type
  5495  		x := v_0
  5496  		y := v_1
  5497  		v.reset(OpRISCV64SRA)
  5498  		v.Type = t
  5499  		v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
  5500  		v0.AddArg(x)
  5501  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5502  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5503  		v2.AuxInt = int64ToAuxInt(-1)
  5504  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5505  		v3.AuxInt = int64ToAuxInt(64)
  5506  		v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5507  		v4.AddArg(y)
  5508  		v3.AddArg(v4)
  5509  		v2.AddArg(v3)
  5510  		v1.AddArg2(y, v2)
  5511  		v.AddArg2(v0, v1)
  5512  		return true
  5513  	}
  5514  }
  5515  func rewriteValueRISCV64_OpRsh32x64(v *Value) bool {
  5516  	v_1 := v.Args[1]
  5517  	v_0 := v.Args[0]
  5518  	b := v.Block
  5519  	typ := &b.Func.Config.Types
  5520  	// match: (Rsh32x64 <t> x y)
  5521  	// result: (SRA <t> (SignExt32to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] y))))
  5522  	for {
  5523  		t := v.Type
  5524  		x := v_0
  5525  		y := v_1
  5526  		v.reset(OpRISCV64SRA)
  5527  		v.Type = t
  5528  		v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
  5529  		v0.AddArg(x)
  5530  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5531  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5532  		v2.AuxInt = int64ToAuxInt(-1)
  5533  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5534  		v3.AuxInt = int64ToAuxInt(64)
  5535  		v3.AddArg(y)
  5536  		v2.AddArg(v3)
  5537  		v1.AddArg2(y, v2)
  5538  		v.AddArg2(v0, v1)
  5539  		return true
  5540  	}
  5541  }
  5542  func rewriteValueRISCV64_OpRsh32x8(v *Value) bool {
  5543  	v_1 := v.Args[1]
  5544  	v_0 := v.Args[0]
  5545  	b := v.Block
  5546  	typ := &b.Func.Config.Types
  5547  	// match: (Rsh32x8 <t> x y)
  5548  	// result: (SRA <t> (SignExt32to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt8to64 y)))))
  5549  	for {
  5550  		t := v.Type
  5551  		x := v_0
  5552  		y := v_1
  5553  		v.reset(OpRISCV64SRA)
  5554  		v.Type = t
  5555  		v0 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
  5556  		v0.AddArg(x)
  5557  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5558  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5559  		v2.AuxInt = int64ToAuxInt(-1)
  5560  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5561  		v3.AuxInt = int64ToAuxInt(64)
  5562  		v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5563  		v4.AddArg(y)
  5564  		v3.AddArg(v4)
  5565  		v2.AddArg(v3)
  5566  		v1.AddArg2(y, v2)
  5567  		v.AddArg2(v0, v1)
  5568  		return true
  5569  	}
  5570  }
  5571  func rewriteValueRISCV64_OpRsh64Ux16(v *Value) bool {
  5572  	v_1 := v.Args[1]
  5573  	v_0 := v.Args[0]
  5574  	b := v.Block
  5575  	typ := &b.Func.Config.Types
  5576  	// match: (Rsh64Ux16 <t> x y)
  5577  	// result: (AND (SRL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt16to64 y))))
  5578  	for {
  5579  		t := v.Type
  5580  		x := v_0
  5581  		y := v_1
  5582  		v.reset(OpRISCV64AND)
  5583  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5584  		v0.AddArg2(x, y)
  5585  		v1 := b.NewValue0(v.Pos, OpNeg64, t)
  5586  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5587  		v2.AuxInt = int64ToAuxInt(64)
  5588  		v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5589  		v3.AddArg(y)
  5590  		v2.AddArg(v3)
  5591  		v1.AddArg(v2)
  5592  		v.AddArg2(v0, v1)
  5593  		return true
  5594  	}
  5595  }
  5596  func rewriteValueRISCV64_OpRsh64Ux32(v *Value) bool {
  5597  	v_1 := v.Args[1]
  5598  	v_0 := v.Args[0]
  5599  	b := v.Block
  5600  	typ := &b.Func.Config.Types
  5601  	// match: (Rsh64Ux32 <t> x y)
  5602  	// result: (AND (SRL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt32to64 y))))
  5603  	for {
  5604  		t := v.Type
  5605  		x := v_0
  5606  		y := v_1
  5607  		v.reset(OpRISCV64AND)
  5608  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5609  		v0.AddArg2(x, y)
  5610  		v1 := b.NewValue0(v.Pos, OpNeg64, t)
  5611  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5612  		v2.AuxInt = int64ToAuxInt(64)
  5613  		v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5614  		v3.AddArg(y)
  5615  		v2.AddArg(v3)
  5616  		v1.AddArg(v2)
  5617  		v.AddArg2(v0, v1)
  5618  		return true
  5619  	}
  5620  }
  5621  func rewriteValueRISCV64_OpRsh64Ux64(v *Value) bool {
  5622  	v_1 := v.Args[1]
  5623  	v_0 := v.Args[0]
  5624  	b := v.Block
  5625  	// match: (Rsh64Ux64 <t> x y)
  5626  	// result: (AND (SRL <t> x y) (Neg64 <t> (SLTIU <t> [64] y)))
  5627  	for {
  5628  		t := v.Type
  5629  		x := v_0
  5630  		y := v_1
  5631  		v.reset(OpRISCV64AND)
  5632  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5633  		v0.AddArg2(x, y)
  5634  		v1 := b.NewValue0(v.Pos, OpNeg64, t)
  5635  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5636  		v2.AuxInt = int64ToAuxInt(64)
  5637  		v2.AddArg(y)
  5638  		v1.AddArg(v2)
  5639  		v.AddArg2(v0, v1)
  5640  		return true
  5641  	}
  5642  }
  5643  func rewriteValueRISCV64_OpRsh64Ux8(v *Value) bool {
  5644  	v_1 := v.Args[1]
  5645  	v_0 := v.Args[0]
  5646  	b := v.Block
  5647  	typ := &b.Func.Config.Types
  5648  	// match: (Rsh64Ux8 <t> x y)
  5649  	// result: (AND (SRL <t> x y) (Neg64 <t> (SLTIU <t> [64] (ZeroExt8to64 y))))
  5650  	for {
  5651  		t := v.Type
  5652  		x := v_0
  5653  		y := v_1
  5654  		v.reset(OpRISCV64AND)
  5655  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5656  		v0.AddArg2(x, y)
  5657  		v1 := b.NewValue0(v.Pos, OpNeg64, t)
  5658  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5659  		v2.AuxInt = int64ToAuxInt(64)
  5660  		v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5661  		v3.AddArg(y)
  5662  		v2.AddArg(v3)
  5663  		v1.AddArg(v2)
  5664  		v.AddArg2(v0, v1)
  5665  		return true
  5666  	}
  5667  }
  5668  func rewriteValueRISCV64_OpRsh64x16(v *Value) bool {
  5669  	v_1 := v.Args[1]
  5670  	v_0 := v.Args[0]
  5671  	b := v.Block
  5672  	typ := &b.Func.Config.Types
  5673  	// match: (Rsh64x16 <t> x y)
  5674  	// result: (SRA <t> x (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt16to64 y)))))
  5675  	for {
  5676  		t := v.Type
  5677  		x := v_0
  5678  		y := v_1
  5679  		v.reset(OpRISCV64SRA)
  5680  		v.Type = t
  5681  		v0 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5682  		v1 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5683  		v1.AuxInt = int64ToAuxInt(-1)
  5684  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5685  		v2.AuxInt = int64ToAuxInt(64)
  5686  		v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5687  		v3.AddArg(y)
  5688  		v2.AddArg(v3)
  5689  		v1.AddArg(v2)
  5690  		v0.AddArg2(y, v1)
  5691  		v.AddArg2(x, v0)
  5692  		return true
  5693  	}
  5694  }
  5695  func rewriteValueRISCV64_OpRsh64x32(v *Value) bool {
  5696  	v_1 := v.Args[1]
  5697  	v_0 := v.Args[0]
  5698  	b := v.Block
  5699  	typ := &b.Func.Config.Types
  5700  	// match: (Rsh64x32 <t> x y)
  5701  	// result: (SRA <t> x (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt32to64 y)))))
  5702  	for {
  5703  		t := v.Type
  5704  		x := v_0
  5705  		y := v_1
  5706  		v.reset(OpRISCV64SRA)
  5707  		v.Type = t
  5708  		v0 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5709  		v1 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5710  		v1.AuxInt = int64ToAuxInt(-1)
  5711  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5712  		v2.AuxInt = int64ToAuxInt(64)
  5713  		v3 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5714  		v3.AddArg(y)
  5715  		v2.AddArg(v3)
  5716  		v1.AddArg(v2)
  5717  		v0.AddArg2(y, v1)
  5718  		v.AddArg2(x, v0)
  5719  		return true
  5720  	}
  5721  }
  5722  func rewriteValueRISCV64_OpRsh64x64(v *Value) bool {
  5723  	v_1 := v.Args[1]
  5724  	v_0 := v.Args[0]
  5725  	b := v.Block
  5726  	// match: (Rsh64x64 <t> x y)
  5727  	// result: (SRA <t> x (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] y))))
  5728  	for {
  5729  		t := v.Type
  5730  		x := v_0
  5731  		y := v_1
  5732  		v.reset(OpRISCV64SRA)
  5733  		v.Type = t
  5734  		v0 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5735  		v1 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5736  		v1.AuxInt = int64ToAuxInt(-1)
  5737  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5738  		v2.AuxInt = int64ToAuxInt(64)
  5739  		v2.AddArg(y)
  5740  		v1.AddArg(v2)
  5741  		v0.AddArg2(y, v1)
  5742  		v.AddArg2(x, v0)
  5743  		return true
  5744  	}
  5745  }
  5746  func rewriteValueRISCV64_OpRsh64x8(v *Value) bool {
  5747  	v_1 := v.Args[1]
  5748  	v_0 := v.Args[0]
  5749  	b := v.Block
  5750  	typ := &b.Func.Config.Types
  5751  	// match: (Rsh64x8 <t> x y)
  5752  	// result: (SRA <t> x (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt8to64 y)))))
  5753  	for {
  5754  		t := v.Type
  5755  		x := v_0
  5756  		y := v_1
  5757  		v.reset(OpRISCV64SRA)
  5758  		v.Type = t
  5759  		v0 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5760  		v1 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5761  		v1.AuxInt = int64ToAuxInt(-1)
  5762  		v2 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5763  		v2.AuxInt = int64ToAuxInt(64)
  5764  		v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5765  		v3.AddArg(y)
  5766  		v2.AddArg(v3)
  5767  		v1.AddArg(v2)
  5768  		v0.AddArg2(y, v1)
  5769  		v.AddArg2(x, v0)
  5770  		return true
  5771  	}
  5772  }
  5773  func rewriteValueRISCV64_OpRsh8Ux16(v *Value) bool {
  5774  	v_1 := v.Args[1]
  5775  	v_0 := v.Args[0]
  5776  	b := v.Block
  5777  	typ := &b.Func.Config.Types
  5778  	// match: (Rsh8Ux16 <t> x y)
  5779  	// result: (AND (SRL <t> (ZeroExt8to64 x) y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt16to64 y))))
  5780  	for {
  5781  		t := v.Type
  5782  		x := v_0
  5783  		y := v_1
  5784  		v.reset(OpRISCV64AND)
  5785  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5786  		v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5787  		v1.AddArg(x)
  5788  		v0.AddArg2(v1, y)
  5789  		v2 := b.NewValue0(v.Pos, OpNeg8, t)
  5790  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5791  		v3.AuxInt = int64ToAuxInt(64)
  5792  		v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5793  		v4.AddArg(y)
  5794  		v3.AddArg(v4)
  5795  		v2.AddArg(v3)
  5796  		v.AddArg2(v0, v2)
  5797  		return true
  5798  	}
  5799  }
  5800  func rewriteValueRISCV64_OpRsh8Ux32(v *Value) bool {
  5801  	v_1 := v.Args[1]
  5802  	v_0 := v.Args[0]
  5803  	b := v.Block
  5804  	typ := &b.Func.Config.Types
  5805  	// match: (Rsh8Ux32 <t> x y)
  5806  	// result: (AND (SRL <t> (ZeroExt8to64 x) y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt32to64 y))))
  5807  	for {
  5808  		t := v.Type
  5809  		x := v_0
  5810  		y := v_1
  5811  		v.reset(OpRISCV64AND)
  5812  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5813  		v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5814  		v1.AddArg(x)
  5815  		v0.AddArg2(v1, y)
  5816  		v2 := b.NewValue0(v.Pos, OpNeg8, t)
  5817  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5818  		v3.AuxInt = int64ToAuxInt(64)
  5819  		v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5820  		v4.AddArg(y)
  5821  		v3.AddArg(v4)
  5822  		v2.AddArg(v3)
  5823  		v.AddArg2(v0, v2)
  5824  		return true
  5825  	}
  5826  }
  5827  func rewriteValueRISCV64_OpRsh8Ux64(v *Value) bool {
  5828  	v_1 := v.Args[1]
  5829  	v_0 := v.Args[0]
  5830  	b := v.Block
  5831  	typ := &b.Func.Config.Types
  5832  	// match: (Rsh8Ux64 <t> x y)
  5833  	// result: (AND (SRL <t> (ZeroExt8to64 x) y) (Neg8 <t> (SLTIU <t> [64] y)))
  5834  	for {
  5835  		t := v.Type
  5836  		x := v_0
  5837  		y := v_1
  5838  		v.reset(OpRISCV64AND)
  5839  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5840  		v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5841  		v1.AddArg(x)
  5842  		v0.AddArg2(v1, y)
  5843  		v2 := b.NewValue0(v.Pos, OpNeg8, t)
  5844  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5845  		v3.AuxInt = int64ToAuxInt(64)
  5846  		v3.AddArg(y)
  5847  		v2.AddArg(v3)
  5848  		v.AddArg2(v0, v2)
  5849  		return true
  5850  	}
  5851  }
  5852  func rewriteValueRISCV64_OpRsh8Ux8(v *Value) bool {
  5853  	v_1 := v.Args[1]
  5854  	v_0 := v.Args[0]
  5855  	b := v.Block
  5856  	typ := &b.Func.Config.Types
  5857  	// match: (Rsh8Ux8 <t> x y)
  5858  	// result: (AND (SRL <t> (ZeroExt8to64 x) y) (Neg8 <t> (SLTIU <t> [64] (ZeroExt8to64 y))))
  5859  	for {
  5860  		t := v.Type
  5861  		x := v_0
  5862  		y := v_1
  5863  		v.reset(OpRISCV64AND)
  5864  		v0 := b.NewValue0(v.Pos, OpRISCV64SRL, t)
  5865  		v1 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5866  		v1.AddArg(x)
  5867  		v0.AddArg2(v1, y)
  5868  		v2 := b.NewValue0(v.Pos, OpNeg8, t)
  5869  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, t)
  5870  		v3.AuxInt = int64ToAuxInt(64)
  5871  		v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5872  		v4.AddArg(y)
  5873  		v3.AddArg(v4)
  5874  		v2.AddArg(v3)
  5875  		v.AddArg2(v0, v2)
  5876  		return true
  5877  	}
  5878  }
  5879  func rewriteValueRISCV64_OpRsh8x16(v *Value) bool {
  5880  	v_1 := v.Args[1]
  5881  	v_0 := v.Args[0]
  5882  	b := v.Block
  5883  	typ := &b.Func.Config.Types
  5884  	// match: (Rsh8x16 <t> x y)
  5885  	// result: (SRA <t> (SignExt8to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt16to64 y)))))
  5886  	for {
  5887  		t := v.Type
  5888  		x := v_0
  5889  		y := v_1
  5890  		v.reset(OpRISCV64SRA)
  5891  		v.Type = t
  5892  		v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
  5893  		v0.AddArg(x)
  5894  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5895  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5896  		v2.AuxInt = int64ToAuxInt(-1)
  5897  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5898  		v3.AuxInt = int64ToAuxInt(64)
  5899  		v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
  5900  		v4.AddArg(y)
  5901  		v3.AddArg(v4)
  5902  		v2.AddArg(v3)
  5903  		v1.AddArg2(y, v2)
  5904  		v.AddArg2(v0, v1)
  5905  		return true
  5906  	}
  5907  }
  5908  func rewriteValueRISCV64_OpRsh8x32(v *Value) bool {
  5909  	v_1 := v.Args[1]
  5910  	v_0 := v.Args[0]
  5911  	b := v.Block
  5912  	typ := &b.Func.Config.Types
  5913  	// match: (Rsh8x32 <t> x y)
  5914  	// result: (SRA <t> (SignExt8to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt32to64 y)))))
  5915  	for {
  5916  		t := v.Type
  5917  		x := v_0
  5918  		y := v_1
  5919  		v.reset(OpRISCV64SRA)
  5920  		v.Type = t
  5921  		v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
  5922  		v0.AddArg(x)
  5923  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5924  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5925  		v2.AuxInt = int64ToAuxInt(-1)
  5926  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5927  		v3.AuxInt = int64ToAuxInt(64)
  5928  		v4 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
  5929  		v4.AddArg(y)
  5930  		v3.AddArg(v4)
  5931  		v2.AddArg(v3)
  5932  		v1.AddArg2(y, v2)
  5933  		v.AddArg2(v0, v1)
  5934  		return true
  5935  	}
  5936  }
  5937  func rewriteValueRISCV64_OpRsh8x64(v *Value) bool {
  5938  	v_1 := v.Args[1]
  5939  	v_0 := v.Args[0]
  5940  	b := v.Block
  5941  	typ := &b.Func.Config.Types
  5942  	// match: (Rsh8x64 <t> x y)
  5943  	// result: (SRA <t> (SignExt8to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] y))))
  5944  	for {
  5945  		t := v.Type
  5946  		x := v_0
  5947  		y := v_1
  5948  		v.reset(OpRISCV64SRA)
  5949  		v.Type = t
  5950  		v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
  5951  		v0.AddArg(x)
  5952  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5953  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5954  		v2.AuxInt = int64ToAuxInt(-1)
  5955  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5956  		v3.AuxInt = int64ToAuxInt(64)
  5957  		v3.AddArg(y)
  5958  		v2.AddArg(v3)
  5959  		v1.AddArg2(y, v2)
  5960  		v.AddArg2(v0, v1)
  5961  		return true
  5962  	}
  5963  }
  5964  func rewriteValueRISCV64_OpRsh8x8(v *Value) bool {
  5965  	v_1 := v.Args[1]
  5966  	v_0 := v.Args[0]
  5967  	b := v.Block
  5968  	typ := &b.Func.Config.Types
  5969  	// match: (Rsh8x8 <t> x y)
  5970  	// result: (SRA <t> (SignExt8to64 x) (OR <y.Type> y (ADDI <y.Type> [-1] (SLTIU <y.Type> [64] (ZeroExt8to64 y)))))
  5971  	for {
  5972  		t := v.Type
  5973  		x := v_0
  5974  		y := v_1
  5975  		v.reset(OpRISCV64SRA)
  5976  		v.Type = t
  5977  		v0 := b.NewValue0(v.Pos, OpSignExt8to64, typ.Int64)
  5978  		v0.AddArg(x)
  5979  		v1 := b.NewValue0(v.Pos, OpRISCV64OR, y.Type)
  5980  		v2 := b.NewValue0(v.Pos, OpRISCV64ADDI, y.Type)
  5981  		v2.AuxInt = int64ToAuxInt(-1)
  5982  		v3 := b.NewValue0(v.Pos, OpRISCV64SLTIU, y.Type)
  5983  		v3.AuxInt = int64ToAuxInt(64)
  5984  		v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
  5985  		v4.AddArg(y)
  5986  		v3.AddArg(v4)
  5987  		v2.AddArg(v3)
  5988  		v1.AddArg2(y, v2)
  5989  		v.AddArg2(v0, v1)
  5990  		return true
  5991  	}
  5992  }
  5993  func rewriteValueRISCV64_OpSlicemask(v *Value) bool {
  5994  	v_0 := v.Args[0]
  5995  	b := v.Block
  5996  	// match: (Slicemask <t> x)
  5997  	// result: (NOT (SRAI <t> [63] (ADDI <t> [-1] x)))
  5998  	for {
  5999  		t := v.Type
  6000  		x := v_0
  6001  		v.reset(OpRISCV64NOT)
  6002  		v0 := b.NewValue0(v.Pos, OpRISCV64SRAI, t)
  6003  		v0.AuxInt = int64ToAuxInt(63)
  6004  		v1 := b.NewValue0(v.Pos, OpRISCV64ADDI, t)
  6005  		v1.AuxInt = int64ToAuxInt(-1)
  6006  		v1.AddArg(x)
  6007  		v0.AddArg(v1)
  6008  		v.AddArg(v0)
  6009  		return true
  6010  	}
  6011  }
  6012  func rewriteValueRISCV64_OpStore(v *Value) bool {
  6013  	v_2 := v.Args[2]
  6014  	v_1 := v.Args[1]
  6015  	v_0 := v.Args[0]
  6016  	// match: (Store {t} ptr val mem)
  6017  	// cond: t.Size() == 1
  6018  	// result: (MOVBstore ptr val mem)
  6019  	for {
  6020  		t := auxToType(v.Aux)
  6021  		ptr := v_0
  6022  		val := v_1
  6023  		mem := v_2
  6024  		if !(t.Size() == 1) {
  6025  			break
  6026  		}
  6027  		v.reset(OpRISCV64MOVBstore)
  6028  		v.AddArg3(ptr, val, mem)
  6029  		return true
  6030  	}
  6031  	// match: (Store {t} ptr val mem)
  6032  	// cond: t.Size() == 2
  6033  	// result: (MOVHstore ptr val mem)
  6034  	for {
  6035  		t := auxToType(v.Aux)
  6036  		ptr := v_0
  6037  		val := v_1
  6038  		mem := v_2
  6039  		if !(t.Size() == 2) {
  6040  			break
  6041  		}
  6042  		v.reset(OpRISCV64MOVHstore)
  6043  		v.AddArg3(ptr, val, mem)
  6044  		return true
  6045  	}
  6046  	// match: (Store {t} ptr val mem)
  6047  	// cond: t.Size() == 4 && !is32BitFloat(val.Type)
  6048  	// result: (MOVWstore ptr val mem)
  6049  	for {
  6050  		t := auxToType(v.Aux)
  6051  		ptr := v_0
  6052  		val := v_1
  6053  		mem := v_2
  6054  		if !(t.Size() == 4 && !is32BitFloat(val.Type)) {
  6055  			break
  6056  		}
  6057  		v.reset(OpRISCV64MOVWstore)
  6058  		v.AddArg3(ptr, val, mem)
  6059  		return true
  6060  	}
  6061  	// match: (Store {t} ptr val mem)
  6062  	// cond: t.Size() == 8 && !is64BitFloat(val.Type)
  6063  	// result: (MOVDstore ptr val mem)
  6064  	for {
  6065  		t := auxToType(v.Aux)
  6066  		ptr := v_0
  6067  		val := v_1
  6068  		mem := v_2
  6069  		if !(t.Size() == 8 && !is64BitFloat(val.Type)) {
  6070  			break
  6071  		}
  6072  		v.reset(OpRISCV64MOVDstore)
  6073  		v.AddArg3(ptr, val, mem)
  6074  		return true
  6075  	}
  6076  	// match: (Store {t} ptr val mem)
  6077  	// cond: t.Size() == 4 && is32BitFloat(val.Type)
  6078  	// result: (FMOVWstore ptr val mem)
  6079  	for {
  6080  		t := auxToType(v.Aux)
  6081  		ptr := v_0
  6082  		val := v_1
  6083  		mem := v_2
  6084  		if !(t.Size() == 4 && is32BitFloat(val.Type)) {
  6085  			break
  6086  		}
  6087  		v.reset(OpRISCV64FMOVWstore)
  6088  		v.AddArg3(ptr, val, mem)
  6089  		return true
  6090  	}
  6091  	// match: (Store {t} ptr val mem)
  6092  	// cond: t.Size() == 8 && is64BitFloat(val.Type)
  6093  	// result: (FMOVDstore ptr val mem)
  6094  	for {
  6095  		t := auxToType(v.Aux)
  6096  		ptr := v_0
  6097  		val := v_1
  6098  		mem := v_2
  6099  		if !(t.Size() == 8 && is64BitFloat(val.Type)) {
  6100  			break
  6101  		}
  6102  		v.reset(OpRISCV64FMOVDstore)
  6103  		v.AddArg3(ptr, val, mem)
  6104  		return true
  6105  	}
  6106  	return false
  6107  }
  6108  func rewriteValueRISCV64_OpZero(v *Value) bool {
  6109  	v_1 := v.Args[1]
  6110  	v_0 := v.Args[0]
  6111  	b := v.Block
  6112  	config := b.Func.Config
  6113  	typ := &b.Func.Config.Types
  6114  	// match: (Zero [0] _ mem)
  6115  	// result: mem
  6116  	for {
  6117  		if auxIntToInt64(v.AuxInt) != 0 {
  6118  			break
  6119  		}
  6120  		mem := v_1
  6121  		v.copyOf(mem)
  6122  		return true
  6123  	}
  6124  	// match: (Zero [1] ptr mem)
  6125  	// result: (MOVBstore ptr (MOVDconst [0]) mem)
  6126  	for {
  6127  		if auxIntToInt64(v.AuxInt) != 1 {
  6128  			break
  6129  		}
  6130  		ptr := v_0
  6131  		mem := v_1
  6132  		v.reset(OpRISCV64MOVBstore)
  6133  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6134  		v0.AuxInt = int64ToAuxInt(0)
  6135  		v.AddArg3(ptr, v0, mem)
  6136  		return true
  6137  	}
  6138  	// match: (Zero [2] {t} ptr mem)
  6139  	// cond: t.Alignment()%2 == 0
  6140  	// result: (MOVHstore ptr (MOVDconst [0]) mem)
  6141  	for {
  6142  		if auxIntToInt64(v.AuxInt) != 2 {
  6143  			break
  6144  		}
  6145  		t := auxToType(v.Aux)
  6146  		ptr := v_0
  6147  		mem := v_1
  6148  		if !(t.Alignment()%2 == 0) {
  6149  			break
  6150  		}
  6151  		v.reset(OpRISCV64MOVHstore)
  6152  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6153  		v0.AuxInt = int64ToAuxInt(0)
  6154  		v.AddArg3(ptr, v0, mem)
  6155  		return true
  6156  	}
  6157  	// match: (Zero [2] ptr mem)
  6158  	// result: (MOVBstore [1] ptr (MOVDconst [0]) (MOVBstore ptr (MOVDconst [0]) mem))
  6159  	for {
  6160  		if auxIntToInt64(v.AuxInt) != 2 {
  6161  			break
  6162  		}
  6163  		ptr := v_0
  6164  		mem := v_1
  6165  		v.reset(OpRISCV64MOVBstore)
  6166  		v.AuxInt = int32ToAuxInt(1)
  6167  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6168  		v0.AuxInt = int64ToAuxInt(0)
  6169  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  6170  		v1.AddArg3(ptr, v0, mem)
  6171  		v.AddArg3(ptr, v0, v1)
  6172  		return true
  6173  	}
  6174  	// match: (Zero [4] {t} ptr mem)
  6175  	// cond: t.Alignment()%4 == 0
  6176  	// result: (MOVWstore ptr (MOVDconst [0]) mem)
  6177  	for {
  6178  		if auxIntToInt64(v.AuxInt) != 4 {
  6179  			break
  6180  		}
  6181  		t := auxToType(v.Aux)
  6182  		ptr := v_0
  6183  		mem := v_1
  6184  		if !(t.Alignment()%4 == 0) {
  6185  			break
  6186  		}
  6187  		v.reset(OpRISCV64MOVWstore)
  6188  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6189  		v0.AuxInt = int64ToAuxInt(0)
  6190  		v.AddArg3(ptr, v0, mem)
  6191  		return true
  6192  	}
  6193  	// match: (Zero [4] {t} ptr mem)
  6194  	// cond: t.Alignment()%2 == 0
  6195  	// result: (MOVHstore [2] ptr (MOVDconst [0]) (MOVHstore ptr (MOVDconst [0]) mem))
  6196  	for {
  6197  		if auxIntToInt64(v.AuxInt) != 4 {
  6198  			break
  6199  		}
  6200  		t := auxToType(v.Aux)
  6201  		ptr := v_0
  6202  		mem := v_1
  6203  		if !(t.Alignment()%2 == 0) {
  6204  			break
  6205  		}
  6206  		v.reset(OpRISCV64MOVHstore)
  6207  		v.AuxInt = int32ToAuxInt(2)
  6208  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6209  		v0.AuxInt = int64ToAuxInt(0)
  6210  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  6211  		v1.AddArg3(ptr, v0, mem)
  6212  		v.AddArg3(ptr, v0, v1)
  6213  		return true
  6214  	}
  6215  	// match: (Zero [4] ptr mem)
  6216  	// result: (MOVBstore [3] ptr (MOVDconst [0]) (MOVBstore [2] ptr (MOVDconst [0]) (MOVBstore [1] ptr (MOVDconst [0]) (MOVBstore ptr (MOVDconst [0]) mem))))
  6217  	for {
  6218  		if auxIntToInt64(v.AuxInt) != 4 {
  6219  			break
  6220  		}
  6221  		ptr := v_0
  6222  		mem := v_1
  6223  		v.reset(OpRISCV64MOVBstore)
  6224  		v.AuxInt = int32ToAuxInt(3)
  6225  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6226  		v0.AuxInt = int64ToAuxInt(0)
  6227  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  6228  		v1.AuxInt = int32ToAuxInt(2)
  6229  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  6230  		v2.AuxInt = int32ToAuxInt(1)
  6231  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  6232  		v3.AddArg3(ptr, v0, mem)
  6233  		v2.AddArg3(ptr, v0, v3)
  6234  		v1.AddArg3(ptr, v0, v2)
  6235  		v.AddArg3(ptr, v0, v1)
  6236  		return true
  6237  	}
  6238  	// match: (Zero [8] {t} ptr mem)
  6239  	// cond: t.Alignment()%8 == 0
  6240  	// result: (MOVDstore ptr (MOVDconst [0]) mem)
  6241  	for {
  6242  		if auxIntToInt64(v.AuxInt) != 8 {
  6243  			break
  6244  		}
  6245  		t := auxToType(v.Aux)
  6246  		ptr := v_0
  6247  		mem := v_1
  6248  		if !(t.Alignment()%8 == 0) {
  6249  			break
  6250  		}
  6251  		v.reset(OpRISCV64MOVDstore)
  6252  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6253  		v0.AuxInt = int64ToAuxInt(0)
  6254  		v.AddArg3(ptr, v0, mem)
  6255  		return true
  6256  	}
  6257  	// match: (Zero [8] {t} ptr mem)
  6258  	// cond: t.Alignment()%4 == 0
  6259  	// result: (MOVWstore [4] ptr (MOVDconst [0]) (MOVWstore ptr (MOVDconst [0]) mem))
  6260  	for {
  6261  		if auxIntToInt64(v.AuxInt) != 8 {
  6262  			break
  6263  		}
  6264  		t := auxToType(v.Aux)
  6265  		ptr := v_0
  6266  		mem := v_1
  6267  		if !(t.Alignment()%4 == 0) {
  6268  			break
  6269  		}
  6270  		v.reset(OpRISCV64MOVWstore)
  6271  		v.AuxInt = int32ToAuxInt(4)
  6272  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6273  		v0.AuxInt = int64ToAuxInt(0)
  6274  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVWstore, types.TypeMem)
  6275  		v1.AddArg3(ptr, v0, mem)
  6276  		v.AddArg3(ptr, v0, v1)
  6277  		return true
  6278  	}
  6279  	// match: (Zero [8] {t} ptr mem)
  6280  	// cond: t.Alignment()%2 == 0
  6281  	// result: (MOVHstore [6] ptr (MOVDconst [0]) (MOVHstore [4] ptr (MOVDconst [0]) (MOVHstore [2] ptr (MOVDconst [0]) (MOVHstore ptr (MOVDconst [0]) mem))))
  6282  	for {
  6283  		if auxIntToInt64(v.AuxInt) != 8 {
  6284  			break
  6285  		}
  6286  		t := auxToType(v.Aux)
  6287  		ptr := v_0
  6288  		mem := v_1
  6289  		if !(t.Alignment()%2 == 0) {
  6290  			break
  6291  		}
  6292  		v.reset(OpRISCV64MOVHstore)
  6293  		v.AuxInt = int32ToAuxInt(6)
  6294  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6295  		v0.AuxInt = int64ToAuxInt(0)
  6296  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  6297  		v1.AuxInt = int32ToAuxInt(4)
  6298  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  6299  		v2.AuxInt = int32ToAuxInt(2)
  6300  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  6301  		v3.AddArg3(ptr, v0, mem)
  6302  		v2.AddArg3(ptr, v0, v3)
  6303  		v1.AddArg3(ptr, v0, v2)
  6304  		v.AddArg3(ptr, v0, v1)
  6305  		return true
  6306  	}
  6307  	// match: (Zero [3] ptr mem)
  6308  	// result: (MOVBstore [2] ptr (MOVDconst [0]) (MOVBstore [1] ptr (MOVDconst [0]) (MOVBstore ptr (MOVDconst [0]) mem)))
  6309  	for {
  6310  		if auxIntToInt64(v.AuxInt) != 3 {
  6311  			break
  6312  		}
  6313  		ptr := v_0
  6314  		mem := v_1
  6315  		v.reset(OpRISCV64MOVBstore)
  6316  		v.AuxInt = int32ToAuxInt(2)
  6317  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6318  		v0.AuxInt = int64ToAuxInt(0)
  6319  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  6320  		v1.AuxInt = int32ToAuxInt(1)
  6321  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVBstore, types.TypeMem)
  6322  		v2.AddArg3(ptr, v0, mem)
  6323  		v1.AddArg3(ptr, v0, v2)
  6324  		v.AddArg3(ptr, v0, v1)
  6325  		return true
  6326  	}
  6327  	// match: (Zero [6] {t} ptr mem)
  6328  	// cond: t.Alignment()%2 == 0
  6329  	// result: (MOVHstore [4] ptr (MOVDconst [0]) (MOVHstore [2] ptr (MOVDconst [0]) (MOVHstore ptr (MOVDconst [0]) mem)))
  6330  	for {
  6331  		if auxIntToInt64(v.AuxInt) != 6 {
  6332  			break
  6333  		}
  6334  		t := auxToType(v.Aux)
  6335  		ptr := v_0
  6336  		mem := v_1
  6337  		if !(t.Alignment()%2 == 0) {
  6338  			break
  6339  		}
  6340  		v.reset(OpRISCV64MOVHstore)
  6341  		v.AuxInt = int32ToAuxInt(4)
  6342  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6343  		v0.AuxInt = int64ToAuxInt(0)
  6344  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  6345  		v1.AuxInt = int32ToAuxInt(2)
  6346  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVHstore, types.TypeMem)
  6347  		v2.AddArg3(ptr, v0, mem)
  6348  		v1.AddArg3(ptr, v0, v2)
  6349  		v.AddArg3(ptr, v0, v1)
  6350  		return true
  6351  	}
  6352  	// match: (Zero [12] {t} ptr mem)
  6353  	// cond: t.Alignment()%4 == 0
  6354  	// result: (MOVWstore [8] ptr (MOVDconst [0]) (MOVWstore [4] ptr (MOVDconst [0]) (MOVWstore ptr (MOVDconst [0]) mem)))
  6355  	for {
  6356  		if auxIntToInt64(v.AuxInt) != 12 {
  6357  			break
  6358  		}
  6359  		t := auxToType(v.Aux)
  6360  		ptr := v_0
  6361  		mem := v_1
  6362  		if !(t.Alignment()%4 == 0) {
  6363  			break
  6364  		}
  6365  		v.reset(OpRISCV64MOVWstore)
  6366  		v.AuxInt = int32ToAuxInt(8)
  6367  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6368  		v0.AuxInt = int64ToAuxInt(0)
  6369  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVWstore, types.TypeMem)
  6370  		v1.AuxInt = int32ToAuxInt(4)
  6371  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVWstore, types.TypeMem)
  6372  		v2.AddArg3(ptr, v0, mem)
  6373  		v1.AddArg3(ptr, v0, v2)
  6374  		v.AddArg3(ptr, v0, v1)
  6375  		return true
  6376  	}
  6377  	// match: (Zero [16] {t} ptr mem)
  6378  	// cond: t.Alignment()%8 == 0
  6379  	// result: (MOVDstore [8] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem))
  6380  	for {
  6381  		if auxIntToInt64(v.AuxInt) != 16 {
  6382  			break
  6383  		}
  6384  		t := auxToType(v.Aux)
  6385  		ptr := v_0
  6386  		mem := v_1
  6387  		if !(t.Alignment()%8 == 0) {
  6388  			break
  6389  		}
  6390  		v.reset(OpRISCV64MOVDstore)
  6391  		v.AuxInt = int32ToAuxInt(8)
  6392  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6393  		v0.AuxInt = int64ToAuxInt(0)
  6394  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  6395  		v1.AddArg3(ptr, v0, mem)
  6396  		v.AddArg3(ptr, v0, v1)
  6397  		return true
  6398  	}
  6399  	// match: (Zero [24] {t} ptr mem)
  6400  	// cond: t.Alignment()%8 == 0
  6401  	// result: (MOVDstore [16] ptr (MOVDconst [0]) (MOVDstore [8] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem)))
  6402  	for {
  6403  		if auxIntToInt64(v.AuxInt) != 24 {
  6404  			break
  6405  		}
  6406  		t := auxToType(v.Aux)
  6407  		ptr := v_0
  6408  		mem := v_1
  6409  		if !(t.Alignment()%8 == 0) {
  6410  			break
  6411  		}
  6412  		v.reset(OpRISCV64MOVDstore)
  6413  		v.AuxInt = int32ToAuxInt(16)
  6414  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6415  		v0.AuxInt = int64ToAuxInt(0)
  6416  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  6417  		v1.AuxInt = int32ToAuxInt(8)
  6418  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  6419  		v2.AddArg3(ptr, v0, mem)
  6420  		v1.AddArg3(ptr, v0, v2)
  6421  		v.AddArg3(ptr, v0, v1)
  6422  		return true
  6423  	}
  6424  	// match: (Zero [32] {t} ptr mem)
  6425  	// cond: t.Alignment()%8 == 0
  6426  	// result: (MOVDstore [24] ptr (MOVDconst [0]) (MOVDstore [16] ptr (MOVDconst [0]) (MOVDstore [8] ptr (MOVDconst [0]) (MOVDstore ptr (MOVDconst [0]) mem))))
  6427  	for {
  6428  		if auxIntToInt64(v.AuxInt) != 32 {
  6429  			break
  6430  		}
  6431  		t := auxToType(v.Aux)
  6432  		ptr := v_0
  6433  		mem := v_1
  6434  		if !(t.Alignment()%8 == 0) {
  6435  			break
  6436  		}
  6437  		v.reset(OpRISCV64MOVDstore)
  6438  		v.AuxInt = int32ToAuxInt(24)
  6439  		v0 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6440  		v0.AuxInt = int64ToAuxInt(0)
  6441  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  6442  		v1.AuxInt = int32ToAuxInt(16)
  6443  		v2 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  6444  		v2.AuxInt = int32ToAuxInt(8)
  6445  		v3 := b.NewValue0(v.Pos, OpRISCV64MOVDstore, types.TypeMem)
  6446  		v3.AddArg3(ptr, v0, mem)
  6447  		v2.AddArg3(ptr, v0, v3)
  6448  		v1.AddArg3(ptr, v0, v2)
  6449  		v.AddArg3(ptr, v0, v1)
  6450  		return true
  6451  	}
  6452  	// match: (Zero [s] {t} ptr mem)
  6453  	// cond: s%8 == 0 && s <= 8*128 && t.Alignment()%8 == 0 && !config.noDuffDevice
  6454  	// result: (DUFFZERO [8 * (128 - s/8)] ptr mem)
  6455  	for {
  6456  		s := auxIntToInt64(v.AuxInt)
  6457  		t := auxToType(v.Aux)
  6458  		ptr := v_0
  6459  		mem := v_1
  6460  		if !(s%8 == 0 && s <= 8*128 && t.Alignment()%8 == 0 && !config.noDuffDevice) {
  6461  			break
  6462  		}
  6463  		v.reset(OpRISCV64DUFFZERO)
  6464  		v.AuxInt = int64ToAuxInt(8 * (128 - s/8))
  6465  		v.AddArg2(ptr, mem)
  6466  		return true
  6467  	}
  6468  	// match: (Zero [s] {t} ptr mem)
  6469  	// result: (LoweredZero [t.Alignment()] ptr (ADD <ptr.Type> ptr (MOVDconst [s-moveSize(t.Alignment(), config)])) mem)
  6470  	for {
  6471  		s := auxIntToInt64(v.AuxInt)
  6472  		t := auxToType(v.Aux)
  6473  		ptr := v_0
  6474  		mem := v_1
  6475  		v.reset(OpRISCV64LoweredZero)
  6476  		v.AuxInt = int64ToAuxInt(t.Alignment())
  6477  		v0 := b.NewValue0(v.Pos, OpRISCV64ADD, ptr.Type)
  6478  		v1 := b.NewValue0(v.Pos, OpRISCV64MOVDconst, typ.UInt64)
  6479  		v1.AuxInt = int64ToAuxInt(s - moveSize(t.Alignment(), config))
  6480  		v0.AddArg2(ptr, v1)
  6481  		v.AddArg3(ptr, v0, mem)
  6482  		return true
  6483  	}
  6484  }
  6485  func rewriteBlockRISCV64(b *Block) bool {
  6486  	switch b.Kind {
  6487  	case BlockRISCV64BEQ:
  6488  		// match: (BEQ (MOVDconst [0]) cond yes no)
  6489  		// result: (BEQZ cond yes no)
  6490  		for b.Controls[0].Op == OpRISCV64MOVDconst {
  6491  			v_0 := b.Controls[0]
  6492  			if auxIntToInt64(v_0.AuxInt) != 0 {
  6493  				break
  6494  			}
  6495  			cond := b.Controls[1]
  6496  			b.resetWithControl(BlockRISCV64BEQZ, cond)
  6497  			return true
  6498  		}
  6499  		// match: (BEQ cond (MOVDconst [0]) yes no)
  6500  		// result: (BEQZ cond yes no)
  6501  		for b.Controls[1].Op == OpRISCV64MOVDconst {
  6502  			cond := b.Controls[0]
  6503  			v_1 := b.Controls[1]
  6504  			if auxIntToInt64(v_1.AuxInt) != 0 {
  6505  				break
  6506  			}
  6507  			b.resetWithControl(BlockRISCV64BEQZ, cond)
  6508  			return true
  6509  		}
  6510  	case BlockRISCV64BEQZ:
  6511  		// match: (BEQZ (SEQZ x) yes no)
  6512  		// result: (BNEZ x yes no)
  6513  		for b.Controls[0].Op == OpRISCV64SEQZ {
  6514  			v_0 := b.Controls[0]
  6515  			x := v_0.Args[0]
  6516  			b.resetWithControl(BlockRISCV64BNEZ, x)
  6517  			return true
  6518  		}
  6519  		// match: (BEQZ (SNEZ x) yes no)
  6520  		// result: (BEQZ x yes no)
  6521  		for b.Controls[0].Op == OpRISCV64SNEZ {
  6522  			v_0 := b.Controls[0]
  6523  			x := v_0.Args[0]
  6524  			b.resetWithControl(BlockRISCV64BEQZ, x)
  6525  			return true
  6526  		}
  6527  		// match: (BEQZ x:(NEG y) yes no)
  6528  		// cond: x.Uses == 1
  6529  		// result: (BEQZ y yes no)
  6530  		for b.Controls[0].Op == OpRISCV64NEG {
  6531  			x := b.Controls[0]
  6532  			y := x.Args[0]
  6533  			if !(x.Uses == 1) {
  6534  				break
  6535  			}
  6536  			b.resetWithControl(BlockRISCV64BEQZ, y)
  6537  			return true
  6538  		}
  6539  		// match: (BEQZ (SUB x y) yes no)
  6540  		// result: (BEQ x y yes no)
  6541  		for b.Controls[0].Op == OpRISCV64SUB {
  6542  			v_0 := b.Controls[0]
  6543  			y := v_0.Args[1]
  6544  			x := v_0.Args[0]
  6545  			b.resetWithControl2(BlockRISCV64BEQ, x, y)
  6546  			return true
  6547  		}
  6548  		// match: (BEQZ (SLT x y) yes no)
  6549  		// result: (BGE x y yes no)
  6550  		for b.Controls[0].Op == OpRISCV64SLT {
  6551  			v_0 := b.Controls[0]
  6552  			y := v_0.Args[1]
  6553  			x := v_0.Args[0]
  6554  			b.resetWithControl2(BlockRISCV64BGE, x, y)
  6555  			return true
  6556  		}
  6557  		// match: (BEQZ (SLTU x y) yes no)
  6558  		// result: (BGEU x y yes no)
  6559  		for b.Controls[0].Op == OpRISCV64SLTU {
  6560  			v_0 := b.Controls[0]
  6561  			y := v_0.Args[1]
  6562  			x := v_0.Args[0]
  6563  			b.resetWithControl2(BlockRISCV64BGEU, x, y)
  6564  			return true
  6565  		}
  6566  	case BlockRISCV64BGE:
  6567  		// match: (BGE (MOVDconst [0]) cond yes no)
  6568  		// result: (BLEZ cond yes no)
  6569  		for b.Controls[0].Op == OpRISCV64MOVDconst {
  6570  			v_0 := b.Controls[0]
  6571  			if auxIntToInt64(v_0.AuxInt) != 0 {
  6572  				break
  6573  			}
  6574  			cond := b.Controls[1]
  6575  			b.resetWithControl(BlockRISCV64BLEZ, cond)
  6576  			return true
  6577  		}
  6578  		// match: (BGE cond (MOVDconst [0]) yes no)
  6579  		// result: (BGEZ cond yes no)
  6580  		for b.Controls[1].Op == OpRISCV64MOVDconst {
  6581  			cond := b.Controls[0]
  6582  			v_1 := b.Controls[1]
  6583  			if auxIntToInt64(v_1.AuxInt) != 0 {
  6584  				break
  6585  			}
  6586  			b.resetWithControl(BlockRISCV64BGEZ, cond)
  6587  			return true
  6588  		}
  6589  	case BlockRISCV64BLT:
  6590  		// match: (BLT (MOVDconst [0]) cond yes no)
  6591  		// result: (BGTZ cond yes no)
  6592  		for b.Controls[0].Op == OpRISCV64MOVDconst {
  6593  			v_0 := b.Controls[0]
  6594  			if auxIntToInt64(v_0.AuxInt) != 0 {
  6595  				break
  6596  			}
  6597  			cond := b.Controls[1]
  6598  			b.resetWithControl(BlockRISCV64BGTZ, cond)
  6599  			return true
  6600  		}
  6601  		// match: (BLT cond (MOVDconst [0]) yes no)
  6602  		// result: (BLTZ cond yes no)
  6603  		for b.Controls[1].Op == OpRISCV64MOVDconst {
  6604  			cond := b.Controls[0]
  6605  			v_1 := b.Controls[1]
  6606  			if auxIntToInt64(v_1.AuxInt) != 0 {
  6607  				break
  6608  			}
  6609  			b.resetWithControl(BlockRISCV64BLTZ, cond)
  6610  			return true
  6611  		}
  6612  	case BlockRISCV64BNE:
  6613  		// match: (BNE (MOVDconst [0]) cond yes no)
  6614  		// result: (BNEZ cond yes no)
  6615  		for b.Controls[0].Op == OpRISCV64MOVDconst {
  6616  			v_0 := b.Controls[0]
  6617  			if auxIntToInt64(v_0.AuxInt) != 0 {
  6618  				break
  6619  			}
  6620  			cond := b.Controls[1]
  6621  			b.resetWithControl(BlockRISCV64BNEZ, cond)
  6622  			return true
  6623  		}
  6624  		// match: (BNE cond (MOVDconst [0]) yes no)
  6625  		// result: (BNEZ cond yes no)
  6626  		for b.Controls[1].Op == OpRISCV64MOVDconst {
  6627  			cond := b.Controls[0]
  6628  			v_1 := b.Controls[1]
  6629  			if auxIntToInt64(v_1.AuxInt) != 0 {
  6630  				break
  6631  			}
  6632  			b.resetWithControl(BlockRISCV64BNEZ, cond)
  6633  			return true
  6634  		}
  6635  	case BlockRISCV64BNEZ:
  6636  		// match: (BNEZ (SEQZ x) yes no)
  6637  		// result: (BEQZ x yes no)
  6638  		for b.Controls[0].Op == OpRISCV64SEQZ {
  6639  			v_0 := b.Controls[0]
  6640  			x := v_0.Args[0]
  6641  			b.resetWithControl(BlockRISCV64BEQZ, x)
  6642  			return true
  6643  		}
  6644  		// match: (BNEZ (SNEZ x) yes no)
  6645  		// result: (BNEZ x yes no)
  6646  		for b.Controls[0].Op == OpRISCV64SNEZ {
  6647  			v_0 := b.Controls[0]
  6648  			x := v_0.Args[0]
  6649  			b.resetWithControl(BlockRISCV64BNEZ, x)
  6650  			return true
  6651  		}
  6652  		// match: (BNEZ x:(NEG y) yes no)
  6653  		// cond: x.Uses == 1
  6654  		// result: (BNEZ y yes no)
  6655  		for b.Controls[0].Op == OpRISCV64NEG {
  6656  			x := b.Controls[0]
  6657  			y := x.Args[0]
  6658  			if !(x.Uses == 1) {
  6659  				break
  6660  			}
  6661  			b.resetWithControl(BlockRISCV64BNEZ, y)
  6662  			return true
  6663  		}
  6664  		// match: (BNEZ (SUB x y) yes no)
  6665  		// result: (BNE x y yes no)
  6666  		for b.Controls[0].Op == OpRISCV64SUB {
  6667  			v_0 := b.Controls[0]
  6668  			y := v_0.Args[1]
  6669  			x := v_0.Args[0]
  6670  			b.resetWithControl2(BlockRISCV64BNE, x, y)
  6671  			return true
  6672  		}
  6673  		// match: (BNEZ (SLT x y) yes no)
  6674  		// result: (BLT x y yes no)
  6675  		for b.Controls[0].Op == OpRISCV64SLT {
  6676  			v_0 := b.Controls[0]
  6677  			y := v_0.Args[1]
  6678  			x := v_0.Args[0]
  6679  			b.resetWithControl2(BlockRISCV64BLT, x, y)
  6680  			return true
  6681  		}
  6682  		// match: (BNEZ (SLTU x y) yes no)
  6683  		// result: (BLTU x y yes no)
  6684  		for b.Controls[0].Op == OpRISCV64SLTU {
  6685  			v_0 := b.Controls[0]
  6686  			y := v_0.Args[1]
  6687  			x := v_0.Args[0]
  6688  			b.resetWithControl2(BlockRISCV64BLTU, x, y)
  6689  			return true
  6690  		}
  6691  	case BlockIf:
  6692  		// match: (If cond yes no)
  6693  		// result: (BNEZ cond yes no)
  6694  		for {
  6695  			cond := b.Controls[0]
  6696  			b.resetWithControl(BlockRISCV64BNEZ, cond)
  6697  			return true
  6698  		}
  6699  	}
  6700  	return false
  6701  }
  6702  

View as plain text