Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/compile/internal/ssa

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

View as plain text