wa-lang.org/wazero@v1.0.2/internal/wazeroir/operations.go (about)

     1  package wazeroir
     2  
     3  import "fmt"
     4  
     5  // UnsignedInt represents unsigned 32-bit or 64-bit integers.
     6  type UnsignedInt byte
     7  
     8  const (
     9  	UnsignedInt32 UnsignedInt = iota
    10  	UnsignedInt64
    11  )
    12  
    13  // String implements fmt.Stringer.
    14  func (s UnsignedInt) String() (ret string) {
    15  	switch s {
    16  	case UnsignedInt32:
    17  		ret = "i32"
    18  	case UnsignedInt64:
    19  		ret = "i64"
    20  	}
    21  	return
    22  }
    23  
    24  // SignedInt represents signed or unsigned integers.
    25  type SignedInt byte
    26  
    27  const (
    28  	SignedInt32 SignedInt = iota
    29  	SignedInt64
    30  	SignedUint32
    31  	SignedUint64
    32  )
    33  
    34  // String implements fmt.Stringer.
    35  func (s SignedInt) String() (ret string) {
    36  	switch s {
    37  	case SignedUint32:
    38  		ret = "u32"
    39  	case SignedUint64:
    40  		ret = "u64"
    41  	case SignedInt32:
    42  		ret = "s32"
    43  	case SignedInt64:
    44  		ret = "s64"
    45  	}
    46  	return
    47  }
    48  
    49  // Float represents the scalar double or single precision floating points.
    50  type Float byte
    51  
    52  const (
    53  	Float32 Float = iota
    54  	Float64
    55  )
    56  
    57  // String implements fmt.Stringer.
    58  func (s Float) String() (ret string) {
    59  	switch s {
    60  	case Float32:
    61  		ret = "f32"
    62  	case Float64:
    63  		ret = "f64"
    64  	}
    65  	return
    66  }
    67  
    68  // UnsignedType is the union of UnsignedInt, Float and V128 vector type.
    69  type UnsignedType byte
    70  
    71  const (
    72  	UnsignedTypeI32 UnsignedType = iota
    73  	UnsignedTypeI64
    74  	UnsignedTypeF32
    75  	UnsignedTypeF64
    76  	UnsignedTypeV128
    77  	UnsignedTypeUnknown
    78  )
    79  
    80  // String implements fmt.Stringer.
    81  func (s UnsignedType) String() (ret string) {
    82  	switch s {
    83  	case UnsignedTypeI32:
    84  		ret = "i32"
    85  	case UnsignedTypeI64:
    86  		ret = "i64"
    87  	case UnsignedTypeF32:
    88  		ret = "f32"
    89  	case UnsignedTypeF64:
    90  		ret = "f64"
    91  	case UnsignedTypeV128:
    92  		ret = "v128"
    93  	case UnsignedTypeUnknown:
    94  		ret = "unknown"
    95  	}
    96  	return
    97  }
    98  
    99  // SignedType is the union of SignedInt and Float types.
   100  type SignedType byte
   101  
   102  const (
   103  	SignedTypeInt32 SignedType = iota
   104  	SignedTypeUint32
   105  	SignedTypeInt64
   106  	SignedTypeUint64
   107  	SignedTypeFloat32
   108  	SignedTypeFloat64
   109  )
   110  
   111  // String implements fmt.Stringer.
   112  func (s SignedType) String() (ret string) {
   113  	switch s {
   114  	case SignedTypeInt32:
   115  		ret = "s32"
   116  	case SignedTypeUint32:
   117  		ret = "u32"
   118  	case SignedTypeInt64:
   119  		ret = "s64"
   120  	case SignedTypeUint64:
   121  		ret = "u64"
   122  	case SignedTypeFloat32:
   123  		ret = "f32"
   124  	case SignedTypeFloat64:
   125  		ret = "f64"
   126  	}
   127  	return
   128  }
   129  
   130  // Operation is the interface implemented by each individual operation.
   131  type Operation interface {
   132  	// Kind returns the kind of the implementation.
   133  	Kind() OperationKind
   134  	// TODO String()
   135  }
   136  
   137  // OperationKind is the kind of each implementation of Operation interface.
   138  type OperationKind uint16
   139  
   140  // String implements fmt.Stringer.
   141  func (o OperationKind) String() (ret string) {
   142  	switch o {
   143  	case OperationKindUnreachable:
   144  		ret = "Unreachable"
   145  	case OperationKindLabel:
   146  		ret = "Label"
   147  	case OperationKindBr:
   148  		ret = "Br"
   149  	case OperationKindBrIf:
   150  		ret = "BrIf"
   151  	case OperationKindBrTable:
   152  		ret = "BrTable"
   153  	case OperationKindCall:
   154  		ret = "Call"
   155  	case OperationKindCallIndirect:
   156  		ret = "CallIndirect"
   157  	case OperationKindDrop:
   158  		ret = "Drop"
   159  	case OperationKindSelect:
   160  		ret = "Select"
   161  	case OperationKindPick:
   162  		ret = "Pick"
   163  	case OperationKindSet:
   164  		ret = "Swap"
   165  	case OperationKindGlobalGet:
   166  		ret = "GlobalGet"
   167  	case OperationKindGlobalSet:
   168  		ret = "GlobalSet"
   169  	case OperationKindLoad:
   170  		ret = "Load"
   171  	case OperationKindLoad8:
   172  		ret = "Load8"
   173  	case OperationKindLoad16:
   174  		ret = "Load16"
   175  	case OperationKindLoad32:
   176  		ret = "Load32"
   177  	case OperationKindStore:
   178  		ret = "Store"
   179  	case OperationKindStore8:
   180  		ret = "Store8"
   181  	case OperationKindStore16:
   182  		ret = "Store16"
   183  	case OperationKindStore32:
   184  		ret = "Store32"
   185  	case OperationKindMemorySize:
   186  		ret = "MemorySize"
   187  	case OperationKindMemoryGrow:
   188  		ret = "MemoryGrow"
   189  	case OperationKindConstI32:
   190  		ret = "ConstI32"
   191  	case OperationKindConstI64:
   192  		ret = "ConstI64"
   193  	case OperationKindConstF32:
   194  		ret = "ConstF32"
   195  	case OperationKindConstF64:
   196  		ret = "ConstF64"
   197  	case OperationKindEq:
   198  		ret = "Eq"
   199  	case OperationKindNe:
   200  		ret = "Ne"
   201  	case OperationKindEqz:
   202  		ret = "Eqz"
   203  	case OperationKindLt:
   204  		ret = "Lt"
   205  	case OperationKindGt:
   206  		ret = "Gt"
   207  	case OperationKindLe:
   208  		ret = "Le"
   209  	case OperationKindGe:
   210  		ret = "Ge"
   211  	case OperationKindAdd:
   212  		ret = "Add"
   213  	case OperationKindSub:
   214  		ret = "Sub"
   215  	case OperationKindMul:
   216  		ret = "Mul"
   217  	case OperationKindClz:
   218  		ret = "Clz"
   219  	case OperationKindCtz:
   220  		ret = "Ctz"
   221  	case OperationKindPopcnt:
   222  		ret = "Popcnt"
   223  	case OperationKindDiv:
   224  		ret = "Div"
   225  	case OperationKindRem:
   226  		ret = "Rem"
   227  	case OperationKindAnd:
   228  		ret = "And"
   229  	case OperationKindOr:
   230  		ret = "Or"
   231  	case OperationKindXor:
   232  		ret = "Xor"
   233  	case OperationKindShl:
   234  		ret = "Shl"
   235  	case OperationKindShr:
   236  		ret = "Shr"
   237  	case OperationKindRotl:
   238  		ret = "Rotl"
   239  	case OperationKindRotr:
   240  		ret = "Rotr"
   241  	case OperationKindAbs:
   242  		ret = "Abs"
   243  	case OperationKindNeg:
   244  		ret = "Neg"
   245  	case OperationKindCeil:
   246  		ret = "Ceil"
   247  	case OperationKindFloor:
   248  		ret = "Floor"
   249  	case OperationKindTrunc:
   250  		ret = "Trunc"
   251  	case OperationKindNearest:
   252  		ret = "Nearest"
   253  	case OperationKindSqrt:
   254  		ret = "Sqrt"
   255  	case OperationKindMin:
   256  		ret = "Min"
   257  	case OperationKindMax:
   258  		ret = "Max"
   259  	case OperationKindCopysign:
   260  		ret = "Copysign"
   261  	case OperationKindI32WrapFromI64:
   262  		ret = "I32WrapFromI64"
   263  	case OperationKindITruncFromF:
   264  		ret = "ITruncFromF"
   265  	case OperationKindFConvertFromI:
   266  		ret = "FConvertFromI"
   267  	case OperationKindF32DemoteFromF64:
   268  		ret = "F32DemoteFromF64"
   269  	case OperationKindF64PromoteFromF32:
   270  		ret = "F64PromoteFromF32"
   271  	case OperationKindI32ReinterpretFromF32:
   272  		ret = "I32ReinterpretFromF32"
   273  	case OperationKindI64ReinterpretFromF64:
   274  		ret = "I64ReinterpretFromF64"
   275  	case OperationKindF32ReinterpretFromI32:
   276  		ret = "F32ReinterpretFromI32"
   277  	case OperationKindF64ReinterpretFromI64:
   278  		ret = "F64ReinterpretFromI64"
   279  	case OperationKindExtend:
   280  		ret = "Extend"
   281  	case OperationKindMemoryInit:
   282  		ret = "MemoryInit"
   283  	case OperationKindDataDrop:
   284  		ret = "DataDrop"
   285  	case OperationKindMemoryCopy:
   286  		ret = "MemoryCopy"
   287  	case OperationKindMemoryFill:
   288  		ret = "MemoryFill"
   289  	case OperationKindTableInit:
   290  		ret = "TableInit"
   291  	case OperationKindElemDrop:
   292  		ret = "ElemDrop"
   293  	case OperationKindTableCopy:
   294  		ret = "TableCopy"
   295  	case OperationKindRefFunc:
   296  		ret = "RefFunc"
   297  	case OperationKindTableGet:
   298  		ret = "TableGet"
   299  	case OperationKindTableSet:
   300  		ret = "TableSet"
   301  	case OperationKindTableSize:
   302  		ret = "TableSize"
   303  	case OperationKindTableGrow:
   304  		ret = "TableGrow"
   305  	case OperationKindTableFill:
   306  		ret = "TableFill"
   307  	case OperationKindV128Const:
   308  		ret = "ConstV128"
   309  	case OperationKindV128Add:
   310  		ret = "V128Add"
   311  	case OperationKindV128Sub:
   312  		ret = "V128Sub"
   313  	case OperationKindV128Load:
   314  		ret = "V128Load"
   315  	case OperationKindV128LoadLane:
   316  		ret = "V128LoadLane"
   317  	case OperationKindV128Store:
   318  		ret = "V128Store"
   319  	case OperationKindV128StoreLane:
   320  		ret = "V128StoreLane"
   321  	case OperationKindV128ExtractLane:
   322  		ret = "V128ExtractLane"
   323  	case OperationKindV128ReplaceLane:
   324  		ret = "V128ReplaceLane"
   325  	case OperationKindV128Splat:
   326  		ret = "V128Splat"
   327  	case OperationKindV128Shuffle:
   328  		ret = "V128Shuffle"
   329  	case OperationKindV128Swizzle:
   330  		ret = "V128Swizzle"
   331  	case OperationKindV128AnyTrue:
   332  		ret = "V128AnyTrue"
   333  	case OperationKindV128AllTrue:
   334  		ret = "V128AllTrue"
   335  	case OperationKindV128And:
   336  		ret = "V128And"
   337  	case OperationKindV128Not:
   338  		ret = "V128Not"
   339  	case OperationKindV128Or:
   340  		ret = "V128Or"
   341  	case OperationKindV128Xor:
   342  		ret = "V128Xor"
   343  	case OperationKindV128Bitselect:
   344  		ret = "V128Bitselect"
   345  	case OperationKindV128AndNot:
   346  		ret = "V128AndNot"
   347  	case OperationKindV128BitMask:
   348  		ret = "V128BitMask"
   349  	case OperationKindV128Shl:
   350  		ret = "V128Shl"
   351  	case OperationKindV128Shr:
   352  		ret = "V128Shr"
   353  	case OperationKindV128Cmp:
   354  		ret = "V128Cmp"
   355  	case OperationKindSignExtend32From8:
   356  		ret = "SignExtend32From8"
   357  	case OperationKindSignExtend32From16:
   358  		ret = "SignExtend32From16"
   359  	case OperationKindSignExtend64From8:
   360  		ret = "SignExtend64From8"
   361  	case OperationKindSignExtend64From16:
   362  		ret = "SignExtend64From16"
   363  	case OperationKindSignExtend64From32:
   364  		ret = "SignExtend64From32"
   365  	case OperationKindV128AddSat:
   366  		ret = "V128AddSat"
   367  	case OperationKindV128SubSat:
   368  		ret = "V128SubSat"
   369  	case OperationKindV128Mul:
   370  		ret = "V128Mul"
   371  	case OperationKindV128Div:
   372  		ret = "V128Div"
   373  	case OperationKindV128Neg:
   374  		ret = "V128Neg"
   375  	case OperationKindV128Sqrt:
   376  		ret = "V128Sqrt"
   377  	case OperationKindV128Abs:
   378  		ret = "V128Abs"
   379  	case OperationKindV128Popcnt:
   380  		ret = "V128Popcnt"
   381  	case OperationKindV128Min:
   382  		ret = "V128Min"
   383  	case OperationKindV128Max:
   384  		ret = "V128Max"
   385  	case OperationKindV128AvgrU:
   386  		ret = "V128AvgrU"
   387  	case OperationKindV128Ceil:
   388  		ret = "V128Ceil"
   389  	case OperationKindV128Floor:
   390  		ret = "V128Floor"
   391  	case OperationKindV128Trunc:
   392  		ret = "V128Trunc"
   393  	case OperationKindV128Nearest:
   394  		ret = "V128Nearest"
   395  	case OperationKindV128Pmin:
   396  		ret = "V128Pmin"
   397  	case OperationKindV128Pmax:
   398  		ret = "V128Pmax"
   399  	case OperationKindV128Extend:
   400  		ret = "V128Extend"
   401  	case OperationKindV128ExtMul:
   402  		ret = "V128ExtMul"
   403  	case OperationKindV128Q15mulrSatS:
   404  		ret = "V128Q15mulrSatS"
   405  	case OperationKindV128ExtAddPairwise:
   406  		ret = "V128ExtAddPairwise"
   407  	case OperationKindV128FloatPromote:
   408  		ret = "V128FloatPromote"
   409  	case OperationKindV128FloatDemote:
   410  		ret = "V128FloatDemote"
   411  	case OperationKindV128FConvertFromI:
   412  		ret = "V128FConvertFromI"
   413  	case OperationKindV128Dot:
   414  		ret = "V128Dot"
   415  	case OperationKindV128Narrow:
   416  		ret = "V128Narrow"
   417  	case OperationKindV128ITruncSatFromF:
   418  		ret = "V128ITruncSatFromF"
   419  	default:
   420  		panic(fmt.Errorf("unknown operation %d", o))
   421  	}
   422  	return
   423  }
   424  
   425  const (
   426  	// OperationKindUnreachable is the kind for OperationUnreachable.
   427  	OperationKindUnreachable OperationKind = iota
   428  	// OperationKindLabel is the kind for OperationLabel.
   429  	OperationKindLabel
   430  	// OperationKindBr is the kind for OperationBr.
   431  	OperationKindBr
   432  	// OperationKindBrIf is the kind for OperationBrIf.
   433  	OperationKindBrIf
   434  	// OperationKindBrTable is the kind for OperationBrTable.
   435  	OperationKindBrTable
   436  	// OperationKindCall is the kind for OperationCall.
   437  	OperationKindCall
   438  	// OperationKindCallIndirect is the kind for OperationCallIndirect.
   439  	OperationKindCallIndirect
   440  	// OperationKindDrop is the kind for OperationDrop.
   441  	OperationKindDrop
   442  	// OperationKindSelect is the kind for OperationSelect.
   443  	OperationKindSelect
   444  	// OperationKindPick is the kind for OperationPick.
   445  	OperationKindPick
   446  	// OperationKindSet is the kind for OperationSet.
   447  	OperationKindSet
   448  	// OperationKindGlobalGet is the kind for OperationGlobalGet.
   449  	OperationKindGlobalGet
   450  	// OperationKindGlobalSet is the kind for OperationGlobalSet.
   451  	OperationKindGlobalSet
   452  	// OperationKindLoad is the kind for OperationLoad.
   453  	OperationKindLoad
   454  	// OperationKindLoad8 is the kind for OperationLoad8.
   455  	OperationKindLoad8
   456  	// OperationKindLoad16 is the kind for OperationLoad16.
   457  	OperationKindLoad16
   458  	// OperationKindLoad32 is the kind for OperationLoad32.
   459  	OperationKindLoad32
   460  	// OperationKindStore is the kind for OperationStore.
   461  	OperationKindStore
   462  	// OperationKindStore8 is the kind for OperationStore8.
   463  	OperationKindStore8
   464  	// OperationKindStore16 is the kind for OperationStore16.
   465  	OperationKindStore16
   466  	// OperationKindStore32 is the kind for OperationStore32.
   467  	OperationKindStore32
   468  	// OperationKindMemorySize is the kind for OperationMemorySize.
   469  	OperationKindMemorySize
   470  	// OperationKindMemoryGrow is the kind for OperationMemoryGrow.
   471  	OperationKindMemoryGrow
   472  	// OperationKindConstI32 is the kind for OperationConstI32.
   473  	OperationKindConstI32
   474  	// OperationKindConstI64 is the kind for OperationConstI64.
   475  	OperationKindConstI64
   476  	// OperationKindConstF32 is the kind for OperationConstF32.
   477  	OperationKindConstF32
   478  	// OperationKindConstF64 is the kind for OperationConstF64.
   479  	OperationKindConstF64
   480  	// OperationKindEq is the kind for OperationEq.
   481  	OperationKindEq
   482  	// OperationKindNe is the kind for OperationNe.
   483  	OperationKindNe
   484  	// OperationKindEqz is the kind for OperationEqz.
   485  	OperationKindEqz
   486  	// OperationKindLt is the kind for OperationLt.
   487  	OperationKindLt
   488  	// OperationKindGt is the kind for OperationGt.
   489  	OperationKindGt
   490  	// OperationKindLe is the kind for OperationLe.
   491  	OperationKindLe
   492  	// OperationKindGe is the kind for OperationGe.
   493  	OperationKindGe
   494  	// OperationKindAdd is the kind for OperationAdd.
   495  	OperationKindAdd
   496  	// OperationKindSub is the kind for OperationSub.
   497  	OperationKindSub
   498  	// OperationKindMul is the kind for OperationMul.
   499  	OperationKindMul
   500  	// OperationKindClz is the kind for OperationClz.
   501  	OperationKindClz
   502  	// OperationKindCtz is the kind for OperationCtz.
   503  	OperationKindCtz
   504  	// OperationKindPopcnt is the kind for OperationPopcnt.
   505  	OperationKindPopcnt
   506  	// OperationKindDiv is the kind for OperationDiv.
   507  	OperationKindDiv
   508  	// OperationKindRem is the kind for OperationRem.
   509  	OperationKindRem
   510  	// OperationKindAnd is the kind for OperationAnd.
   511  	OperationKindAnd
   512  	// OperationKindOr is the kind for OperationOr.
   513  	OperationKindOr
   514  	// OperationKindXor is the kind for OperationXor.
   515  	OperationKindXor
   516  	// OperationKindShl is the kind for OperationShl.
   517  	OperationKindShl
   518  	// OperationKindShr is the kind for OperationShr.
   519  	OperationKindShr
   520  	// OperationKindRotl is the kind for OperationRotl.
   521  	OperationKindRotl
   522  	// OperationKindRotr is the kind for OperationRotr.
   523  	OperationKindRotr
   524  	// OperationKindAbs is the kind for OperationAbs.
   525  	OperationKindAbs
   526  	// OperationKindNeg is the kind for OperationNeg.
   527  	OperationKindNeg
   528  	// OperationKindCeil is the kind for OperationCeil.
   529  	OperationKindCeil
   530  	// OperationKindFloor is the kind for OperationFloor.
   531  	OperationKindFloor
   532  	// OperationKindTrunc is the kind for OperationTrunc.
   533  	OperationKindTrunc
   534  	// OperationKindNearest is the kind for OperationNearest.
   535  	OperationKindNearest
   536  	// OperationKindSqrt is the kind for OperationSqrt.
   537  	OperationKindSqrt
   538  	// OperationKindMin is the kind for OperationMin.
   539  	OperationKindMin
   540  	// OperationKindMax is the kind for OperationMax.
   541  	OperationKindMax
   542  	// OperationKindCopysign is the kind for OperationCopysign.
   543  	OperationKindCopysign
   544  	// OperationKindI32WrapFromI64 is the kind for OperationI32WrapFromI64.
   545  	OperationKindI32WrapFromI64
   546  	// OperationKindITruncFromF is the kind for OperationITruncFromF.
   547  	OperationKindITruncFromF
   548  	// OperationKindFConvertFromI is the kind for OperationFConvertFromI.
   549  	OperationKindFConvertFromI
   550  	// OperationKindF32DemoteFromF64 is the kind for OperationF32DemoteFromF64.
   551  	OperationKindF32DemoteFromF64
   552  	// OperationKindF64PromoteFromF32 is the kind for OperationF64PromoteFromF32.
   553  	OperationKindF64PromoteFromF32
   554  	// OperationKindI32ReinterpretFromF32 is the kind for OperationI32ReinterpretFromF32.
   555  	OperationKindI32ReinterpretFromF32
   556  	// OperationKindI64ReinterpretFromF64 is the kind for OperationI64ReinterpretFromF64.
   557  	OperationKindI64ReinterpretFromF64
   558  	// OperationKindF32ReinterpretFromI32 is the kind for OperationF32ReinterpretFromI32.
   559  	OperationKindF32ReinterpretFromI32
   560  	// OperationKindF64ReinterpretFromI64 is the kind for OperationF64ReinterpretFromI64.
   561  	OperationKindF64ReinterpretFromI64
   562  	// OperationKindExtend is the kind for OperationExtend.
   563  	OperationKindExtend
   564  	// OperationKindSignExtend32From8 is the kind for OperationSignExtend32From8.
   565  	OperationKindSignExtend32From8
   566  	// OperationKindSignExtend32From16 is the kind for OperationSignExtend32From16.
   567  	OperationKindSignExtend32From16
   568  	// OperationKindSignExtend64From8 is the kind for OperationSignExtend64From8.
   569  	OperationKindSignExtend64From8
   570  	// OperationKindSignExtend64From16 is the kind for OperationSignExtend64From16.
   571  	OperationKindSignExtend64From16
   572  	// OperationKindSignExtend64From32 is the kind for OperationSignExtend64From32.
   573  	OperationKindSignExtend64From32
   574  	// OperationKindMemoryInit is the kind for OperationMemoryInit.
   575  	OperationKindMemoryInit
   576  	// OperationKindDataDrop is the kind for OperationDataDrop.
   577  	OperationKindDataDrop
   578  	// OperationKindMemoryCopy is the kind for OperationMemoryCopy.
   579  	OperationKindMemoryCopy
   580  	// OperationKindMemoryFill is the kind for OperationMemoryFill.
   581  	OperationKindMemoryFill
   582  	// OperationKindTableInit is the kind for OperationTableInit.
   583  	OperationKindTableInit
   584  	// OperationKindElemDrop is the kind for OperationElemDrop.
   585  	OperationKindElemDrop
   586  	// OperationKindTableCopy is the kind for OperationTableCopy.
   587  	OperationKindTableCopy
   588  	// OperationKindRefFunc is the kind for OperationRefFunc.
   589  	OperationKindRefFunc
   590  	// OperationKindTableGet is the kind for OperationTableGet.
   591  	OperationKindTableGet
   592  	// OperationKindTableSet is the kind for OperationTableSet.
   593  	OperationKindTableSet
   594  	// OperationKindTableSize is the kind for OperationTableSize.
   595  	OperationKindTableSize
   596  	// OperationKindTableGrow is the kind for OperationTableGrow.
   597  	OperationKindTableGrow
   598  	// OperationKindTableFill is the kind for OperationTableFill.
   599  	OperationKindTableFill
   600  
   601  	// Vector value related instructions are prefixed by V128.
   602  
   603  	// OperationKindV128Const is the kind for OperationV128Const.
   604  	OperationKindV128Const
   605  	// OperationKindV128Add is the kind for OperationV128Add.
   606  	OperationKindV128Add
   607  	// OperationKindV128Sub is the kind for OperationV128Sub.
   608  	OperationKindV128Sub
   609  	// OperationKindV128Load is the kind for OperationV128Load.
   610  	OperationKindV128Load
   611  	// OperationKindV128LoadLane is the kind for OperationV128LoadLane.
   612  	OperationKindV128LoadLane
   613  	// OperationKindV128Store is the kind for OperationV128Store.
   614  	OperationKindV128Store
   615  	// OperationKindV128StoreLane is the kind for OperationV128StoreLane.
   616  	OperationKindV128StoreLane
   617  	// OperationKindV128ExtractLane is the kind for OperationV128ExtractLane.
   618  	OperationKindV128ExtractLane
   619  	// OperationKindV128ReplaceLane is the kind for OperationV128ReplaceLane.
   620  	OperationKindV128ReplaceLane
   621  	// OperationKindV128Splat is the kind for OperationV128Splat.
   622  	OperationKindV128Splat
   623  	// OperationKindV128Shuffle is the kind for OperationV128Shuffle.
   624  	OperationKindV128Shuffle
   625  	// OperationKindV128Swizzle is the kind for OperationV128Swizzle.
   626  	OperationKindV128Swizzle
   627  	// OperationKindV128AnyTrue is the kind for OperationV128AnyTrue.
   628  	OperationKindV128AnyTrue
   629  	// OperationKindV128AllTrue is the kind for OperationV128AllTrue.
   630  	OperationKindV128AllTrue
   631  	// OperationKindV128BitMask is the kind for OperationV128BitMask.
   632  	OperationKindV128BitMask
   633  	// OperationKindV128And is the kind for OperationV128And.
   634  	OperationKindV128And
   635  	// OperationKindV128Not is the kind for OperationV128Not.
   636  	OperationKindV128Not
   637  	// OperationKindV128Or is the kind for OperationV128Or.
   638  	OperationKindV128Or
   639  	// OperationKindV128Xor is the kind for OperationV128Xor.
   640  	OperationKindV128Xor
   641  	// OperationKindV128Bitselect is the kind for OperationV128Bitselect.
   642  	OperationKindV128Bitselect
   643  	// OperationKindV128AndNot is the kind for OperationV128AndNot.
   644  	OperationKindV128AndNot
   645  	// OperationKindV128Shl is the kind for OperationV128Shl.
   646  	OperationKindV128Shl
   647  	// OperationKindV128Shr is the kind for OperationV128Shr.
   648  	OperationKindV128Shr
   649  	// OperationKindV128Cmp is the kind for OperationV128Cmp.
   650  	OperationKindV128Cmp
   651  	// OperationKindV128AddSat is the kind for OperationV128AddSat.
   652  	OperationKindV128AddSat
   653  	// OperationKindV128SubSat is the kind for OperationV128SubSat.
   654  	OperationKindV128SubSat
   655  	// OperationKindV128Mul is the kind for OperationV128Mul.
   656  	OperationKindV128Mul
   657  	// OperationKindV128Div is the kind for OperationV128Div.
   658  	OperationKindV128Div
   659  	// OperationKindV128Neg is the kind for OperationV128Neg.
   660  	OperationKindV128Neg
   661  	// OperationKindV128Sqrt is the kind for OperationV128Sqrt.
   662  	OperationKindV128Sqrt
   663  	// OperationKindV128Abs is the kind for OperationV128Abs.
   664  	OperationKindV128Abs
   665  	// OperationKindV128Popcnt is the kind for OperationV128Popcnt.
   666  	OperationKindV128Popcnt
   667  	// OperationKindV128Min is the kind for OperationV128Min.
   668  	OperationKindV128Min
   669  	// OperationKindV128Max is the kind for OperationV128Max.
   670  	OperationKindV128Max
   671  	// OperationKindV128AvgrU is the kind for OperationV128AvgrU.
   672  	OperationKindV128AvgrU
   673  	// OperationKindV128Pmin is the kind for OperationV128Pmin.
   674  	OperationKindV128Pmin
   675  	// OperationKindV128Pmax is the kind for OperationV128Pmax.
   676  	OperationKindV128Pmax
   677  	// OperationKindV128Ceil is the kind for OperationV128Ceil.
   678  	OperationKindV128Ceil
   679  	// OperationKindV128Floor is the kind for OperationV128Floor.
   680  	OperationKindV128Floor
   681  	// OperationKindV128Trunc is the kind for OperationV128Trunc.
   682  	OperationKindV128Trunc
   683  	// OperationKindV128Nearest is the kind for OperationV128Nearest.
   684  	OperationKindV128Nearest
   685  	// OperationKindV128Extend is the kind for OperationV128Extend.
   686  	OperationKindV128Extend
   687  	// OperationKindV128ExtMul is the kind for OperationV128ExtMul.
   688  	OperationKindV128ExtMul
   689  	// OperationKindV128Q15mulrSatS is the kind for OperationV128Q15mulrSatS.
   690  	OperationKindV128Q15mulrSatS
   691  	// OperationKindV128ExtAddPairwise is the kind for OperationV128ExtAddPairwise.
   692  	OperationKindV128ExtAddPairwise
   693  	// OperationKindV128FloatPromote is the kind for OperationV128FloatPromote.
   694  	OperationKindV128FloatPromote
   695  	// OperationKindV128FloatDemote is the kind for OperationV128FloatDemote.
   696  	OperationKindV128FloatDemote
   697  	// OperationKindV128FConvertFromI is the kind for OperationV128FConvertFromI.
   698  	OperationKindV128FConvertFromI
   699  	// OperationKindV128Dot is the kind for OperationV128Dot.
   700  	OperationKindV128Dot
   701  	// OperationKindV128Narrow is the kind for OperationV128Narrow.
   702  	OperationKindV128Narrow
   703  	// OperationKindV128ITruncSatFromF is the kind for OperationV128ITruncSatFromF.
   704  	OperationKindV128ITruncSatFromF
   705  
   706  	// operationKindEnd is always placed at the bottom of this iota definition to be used in the test.
   707  	operationKindEnd
   708  )
   709  
   710  // Label is the label of each block in wazeroir where "block" consists of multiple operations,
   711  // and must end with branching operations (e.g. OperationBr or OperationBrIf).
   712  type Label struct {
   713  	FrameID uint32
   714  	Kind    LabelKind
   715  }
   716  
   717  // String implements fmt.Stringer.
   718  func (l *Label) String() (ret string) {
   719  	if l == nil {
   720  		// Sometimes String() is called on the nil label which is interpreted
   721  		// as the function return.
   722  		return ""
   723  	}
   724  	switch l.Kind {
   725  	case LabelKindHeader:
   726  		ret = fmt.Sprintf(".L%d", l.FrameID)
   727  	case LabelKindElse:
   728  		ret = fmt.Sprintf(".L%d_else", l.FrameID)
   729  	case LabelKindContinuation:
   730  		ret = fmt.Sprintf(".L%d_cont", l.FrameID)
   731  	}
   732  	return
   733  }
   734  
   735  // LabelKind is the kind of the label.
   736  type LabelKind = byte
   737  
   738  const (
   739  	// LabelKindHeader is the header for various blocks. For example, the "then" block of
   740  	// wasm.OpcodeIfName in Wasm has the label of this kind.
   741  	LabelKindHeader LabelKind = iota
   742  	// LabelKindElse is the kind of label for "else" block of wasm.OpcodeIfName in Wasm.
   743  	LabelKindElse
   744  	// LabelKindContinuation is the kind of label which is the continuation of blocks.
   745  	// For example, for wasm text like
   746  	// (func
   747  	//   ....
   748  	//   (if (local.get 0) (then (nop)) (else (nop)))
   749  	//   return
   750  	// )
   751  	// we have the continuation block (of if-block) corresponding to "return" opcode.
   752  	LabelKindContinuation
   753  )
   754  
   755  func (l *Label) asBranchTarget() *BranchTarget {
   756  	return &BranchTarget{Label: l}
   757  }
   758  
   759  func (l *Label) asBranchTargetDrop() *BranchTargetDrop {
   760  	return &BranchTargetDrop{Target: l.asBranchTarget()}
   761  }
   762  
   763  // BranchTarget represents the branch operation's target such as OperationBr of OperationBrIf.
   764  type BranchTarget struct {
   765  	// Label holds the target label. Note that this is nullable and in that case
   766  	// the branch target is the "return" of the function.
   767  	Label *Label
   768  }
   769  
   770  // IsReturnTarget returns true if the branch target is the function return, false otherwise.
   771  func (b *BranchTarget) IsReturnTarget() bool {
   772  	return b.Label == nil
   773  }
   774  
   775  // String implements fmt.Stringer.
   776  func (b *BranchTarget) String() (ret string) {
   777  	if b.IsReturnTarget() {
   778  		ret = ".return"
   779  	} else {
   780  		ret = b.Label.String()
   781  	}
   782  	return
   783  }
   784  
   785  // BranchTargetDrop represents the branch target and the drop range which must be dropped
   786  // before give the control over to the target label.
   787  type BranchTargetDrop struct {
   788  	Target *BranchTarget
   789  	ToDrop *InclusiveRange
   790  }
   791  
   792  // String implements fmt.Stringer.
   793  func (b *BranchTargetDrop) String() (ret string) {
   794  	if b.ToDrop != nil {
   795  		ret = fmt.Sprintf("%s(drop %d..%d)", b.Target, b.ToDrop.Start, b.ToDrop.End)
   796  	} else {
   797  		ret = b.Target.String()
   798  	}
   799  	return
   800  }
   801  
   802  // OperationUnreachable implements Operation.
   803  //
   804  // This corresponds to wasm.OpcodeUnreachable.
   805  //
   806  // The engines are expected to exit the execution with wasmruntime.ErrRuntimeUnreachable error.
   807  type OperationUnreachable struct{}
   808  
   809  // Kind implements Operation.Kind
   810  func (*OperationUnreachable) Kind() OperationKind {
   811  	return OperationKindUnreachable
   812  }
   813  
   814  // OperationLabel implements Operation.
   815  //
   816  // This is used to inform the engines of the beginning of a label.
   817  type OperationLabel struct {
   818  	Label *Label
   819  }
   820  
   821  // Kind implements Operation.Kind
   822  func (*OperationLabel) Kind() OperationKind {
   823  	return OperationKindLabel
   824  }
   825  
   826  // OperationBr implements Operation.
   827  //
   828  // The engines are expected to branch into OperationBr.Target label.
   829  type OperationBr struct {
   830  	Target *BranchTarget
   831  }
   832  
   833  // Kind implements Operation.Kind
   834  func (*OperationBr) Kind() OperationKind {
   835  	return OperationKindBr
   836  }
   837  
   838  // OperationBrIf implements Operation.
   839  //
   840  // The engines are expected to pop a value and branch into OperationBrIf.Then label if the value equals 1.
   841  // Otherwise, the code branches into OperationBrIf.Else label.
   842  type OperationBrIf struct {
   843  	Then, Else *BranchTargetDrop
   844  }
   845  
   846  // Kind implements Operation.Kind
   847  func (*OperationBrIf) Kind() OperationKind {
   848  	return OperationKindBrIf
   849  }
   850  
   851  // OperationBrTable implements Operation.
   852  //
   853  // This corresponds to wasm.OpcodeBrTableName except that the label
   854  // here means the wazeroir level, not the ones of Wasm.
   855  //
   856  // The engines are expected to do the br_table operation base on the
   857  // OperationBrTable.Default and OperationBrTable.Targets. More precisely,
   858  // this pops a value from the stack (called "index") and decide which branch we go into next
   859  // based on the value.
   860  //
   861  // For example, assume we have operations like {default: L_DEFAULT, targets: [L0, L1, L2]}.
   862  // If "index" >= len(defaults), then branch into the L_DEFAULT label.
   863  // Otherwise, we enter label of targets[index].
   864  type OperationBrTable struct {
   865  	Targets []*BranchTargetDrop
   866  	Default *BranchTargetDrop
   867  }
   868  
   869  // Kind implements Operation.Kind
   870  func (*OperationBrTable) Kind() OperationKind {
   871  	return OperationKindBrTable
   872  }
   873  
   874  // OperationCall implements Operation.
   875  //
   876  // This corresponds to wasm.OpcodeCallName, and engines are expected to
   877  // enter into a function whose index equals OperationCall.FunctionIndex.
   878  type OperationCall struct {
   879  	FunctionIndex uint32
   880  }
   881  
   882  // Kind implements Operation.Kind
   883  func (*OperationCall) Kind() OperationKind {
   884  	return OperationKindCall
   885  }
   886  
   887  // OperationCallIndirect implements Operation.
   888  //
   889  // This corresponds to wasm.OpcodeCallIndirectName, and engines are expected to
   890  // consume the one value from the top of stack (called "offset"),
   891  // and make a function call against the function whose function address equals
   892  // Tables[OperationCallIndirect.TableIndex][offset].
   893  //
   894  // Note: This is called indirect function call in the sense that the target function is indirectly
   895  // determined by the current state (top value) of the stack.
   896  // Therefore, two checks are performed at runtime before entering the target function:
   897  // 1) whether "offset" exceeds the length of table Tables[OperationCallIndirect.TableIndex].
   898  // 2) whether the type of the function table[offset] matches the function type specified by OperationCallIndirect.TypeIndex.
   899  type OperationCallIndirect struct {
   900  	TypeIndex, TableIndex uint32
   901  }
   902  
   903  // Kind implements Operation.Kind
   904  func (*OperationCallIndirect) Kind() OperationKind {
   905  	return OperationKindCallIndirect
   906  }
   907  
   908  // InclusiveRange is the range which spans across the value stack starting from the top to the bottom, and
   909  // both boundary are included in the range.
   910  type InclusiveRange struct {
   911  	Start, End int
   912  }
   913  
   914  // OperationDrop implements Operation.
   915  //
   916  // The engines are expected to discard the values selected by OperationDrop.Depth which
   917  // starts from the top of the stack to the bottom.
   918  type OperationDrop struct {
   919  	// Depths spans across the uint64 value stack at runtime to be dropped by this operation.
   920  	Depth *InclusiveRange
   921  }
   922  
   923  // Kind implements Operation.Kind
   924  func (*OperationDrop) Kind() OperationKind {
   925  	return OperationKindDrop
   926  }
   927  
   928  // OperationSelect implements Operation.
   929  //
   930  // This corresponds to wasm.OpcodeSelect.
   931  //
   932  // The engines are expected to pop three values, say [..., x2, x1, c], then if the value "c" equals zero,
   933  // "x1" is pushed back onto the stack and, otherwise "x2" is pushed back.
   934  type OperationSelect struct {
   935  	// IsTargetVector true if the selection target value's type is wasm.ValueTypeV128.
   936  	IsTargetVector bool
   937  }
   938  
   939  // Kind implements Operation.Kind
   940  func (*OperationSelect) Kind() OperationKind {
   941  	return OperationKindSelect
   942  }
   943  
   944  // OperationPick implements Operation.
   945  //
   946  // The engines are expected to copy a value pointed by OperationPick.Depth, and push the
   947  // copied value onto the top of the stack.
   948  type OperationPick struct {
   949  	// Depth is the location of the pick target in the uint64 value stack at runtime.
   950  	// If IsTargetVector=true, this points to the location of the lower 64-bits of the vector.
   951  	Depth          int
   952  	IsTargetVector bool
   953  }
   954  
   955  // Kind implements Operation.Kind
   956  func (*OperationPick) Kind() OperationKind {
   957  	return OperationKindPick
   958  }
   959  
   960  // OperationSet implements Operation.
   961  //
   962  // The engines are expected to set the top value of the stack to the location specified by
   963  // OperationSet.Depth.
   964  type OperationSet struct {
   965  	// Depth is the location of the set target in the uint64 value stack at runtime.
   966  	// If IsTargetVector=true, this points the location of the lower 64-bits of the vector.
   967  	Depth          int
   968  	IsTargetVector bool
   969  }
   970  
   971  // Kind implements Operation.Kind
   972  func (*OperationSet) Kind() OperationKind {
   973  	return OperationKindSet
   974  }
   975  
   976  // OperationGlobalGet implements Operation.
   977  //
   978  // The engines are expected to read the global value specified by OperationGlobalGet.Index,
   979  // and push the copy of the value onto the stack.
   980  //
   981  // See wasm.OpcodeGlobalGet.
   982  type OperationGlobalGet struct{ Index uint32 }
   983  
   984  // Kind implements Operation.Kind
   985  func (*OperationGlobalGet) Kind() OperationKind {
   986  	return OperationKindGlobalGet
   987  }
   988  
   989  // OperationGlobalSet implements Operation.
   990  //
   991  // The engines are expected to consume the value from the top of the stack,
   992  // and write the value into the global specified by OperationGlobalSet.Index.
   993  //
   994  // See wasm.OpcodeGlobalSet.
   995  type OperationGlobalSet struct{ Index uint32 }
   996  
   997  // Kind implements Operation.Kind
   998  func (*OperationGlobalSet) Kind() OperationKind {
   999  	return OperationKindGlobalSet
  1000  }
  1001  
  1002  // MemoryArg is the "memarg" to all memory instructions.
  1003  //
  1004  // See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#memory-instructions%E2%91%A0
  1005  type MemoryArg struct {
  1006  	// Alignment the expected alignment (expressed as the exponent of a power of 2). Default to the natural alignment.
  1007  	//
  1008  	// "Natural alignment" is defined here as the smallest power of two that can hold the size of the value type. Ex
  1009  	// wasm.ValueTypeI64 is encoded in 8 little-endian bytes. 2^3 = 8, so the natural alignment is three.
  1010  	Alignment uint32
  1011  
  1012  	// Offset is the address offset added to the instruction's dynamic address operand, yielding a 33-bit effective
  1013  	// address that is the zero-based index at which the memory is accessed. Default to zero.
  1014  	Offset uint32
  1015  }
  1016  
  1017  // OperationLoad implements Operation.
  1018  //
  1019  // This corresponds to wasm.OpcodeI32LoadName wasm.OpcodeI64LoadName wasm.OpcodeF32LoadName and wasm.OpcodeF64LoadName.
  1020  //
  1021  // The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary,
  1022  // otherwise load the corresponding value following the semantics of the corresponding WebAssembly instruction.
  1023  type OperationLoad struct {
  1024  	Type UnsignedType
  1025  	Arg  *MemoryArg
  1026  }
  1027  
  1028  // Kind implements Operation.Kind
  1029  func (*OperationLoad) Kind() OperationKind {
  1030  	return OperationKindLoad
  1031  }
  1032  
  1033  // OperationLoad8 implements Operation.
  1034  //
  1035  // This corresponds to wasm.OpcodeI32Load8SName wasm.OpcodeI32Load8UName wasm.OpcodeI64Load8SName wasm.OpcodeI64Load8UName.
  1036  //
  1037  // The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary,
  1038  // otherwise load the corresponding value following the semantics of the corresponding WebAssembly instruction.
  1039  type OperationLoad8 struct {
  1040  	Type SignedInt
  1041  	Arg  *MemoryArg
  1042  }
  1043  
  1044  // Kind implements Operation.Kind
  1045  func (OperationLoad8) Kind() OperationKind {
  1046  	return OperationKindLoad8
  1047  }
  1048  
  1049  // OperationLoad16 implements Operation.
  1050  //
  1051  // This corresponds to wasm.OpcodeI32Load16SName wasm.OpcodeI32Load16UName wasm.OpcodeI64Load16SName wasm.OpcodeI64Load16UName.
  1052  //
  1053  // The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary,
  1054  // otherwise load the corresponding value following the semantics of the corresponding WebAssembly instruction.
  1055  type OperationLoad16 struct {
  1056  	Type SignedInt
  1057  	Arg  *MemoryArg
  1058  }
  1059  
  1060  // Kind implements Operation.Kind
  1061  func (OperationLoad16) Kind() OperationKind {
  1062  	return OperationKindLoad16
  1063  }
  1064  
  1065  // OperationLoad32 implements Operation.
  1066  //
  1067  // This corresponds to wasm.OpcodeI64Load32SName wasm.OpcodeI64Load32UName.
  1068  //
  1069  // The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary,
  1070  // otherwise load the corresponding value following the semantics of the corresponding WebAssembly instruction.
  1071  type OperationLoad32 struct {
  1072  	Signed bool
  1073  	Arg    *MemoryArg
  1074  }
  1075  
  1076  // Kind implements Operation.Kind
  1077  func (OperationLoad32) Kind() OperationKind {
  1078  	return OperationKindLoad32
  1079  }
  1080  
  1081  // OperationStore implements Operation.
  1082  //
  1083  // # This corresponds to wasm.OpcodeI32StoreName wasm.OpcodeI64StoreName wasm.OpcodeF32StoreName wasm.OpcodeF64StoreName
  1084  //
  1085  // The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary,
  1086  // otherwise store the corresponding value following the semantics of the corresponding WebAssembly instruction.
  1087  type OperationStore struct {
  1088  	Type UnsignedType
  1089  	Arg  *MemoryArg
  1090  }
  1091  
  1092  // Kind implements Operation.Kind
  1093  func (*OperationStore) Kind() OperationKind {
  1094  	return OperationKindStore
  1095  }
  1096  
  1097  // OperationStore8 implements Operation.
  1098  //
  1099  // # This corresponds to wasm.OpcodeI32Store8Name wasm.OpcodeI64Store8Name
  1100  //
  1101  // The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary,
  1102  // otherwise store the corresponding value following the semantics of the corresponding WebAssembly instruction.
  1103  type OperationStore8 struct {
  1104  	Arg *MemoryArg
  1105  }
  1106  
  1107  // Kind implements Operation.Kind
  1108  func (OperationStore8) Kind() OperationKind {
  1109  	return OperationKindStore8
  1110  }
  1111  
  1112  // OperationStore16 implements Operation.
  1113  //
  1114  // # This corresponds to wasm.OpcodeI32Store16Name wasm.OpcodeI64Store16Name
  1115  //
  1116  // The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary,
  1117  // otherwise store the corresponding value following the semantics of the corresponding WebAssembly instruction.
  1118  type OperationStore16 struct {
  1119  	Arg *MemoryArg
  1120  }
  1121  
  1122  // Kind implements Operation.Kind
  1123  func (OperationStore16) Kind() OperationKind {
  1124  	return OperationKindStore16
  1125  }
  1126  
  1127  // OperationStore32 implements Operation.
  1128  //
  1129  // # This corresponds to wasm.OpcodeI64Store32Name
  1130  //
  1131  // The engines are expected to check the boundary of memory length, and exit the execution if this exceeds the boundary,
  1132  // otherwise store the corresponding value following the semantics of the corresponding WebAssembly instruction.
  1133  type OperationStore32 struct {
  1134  	Arg *MemoryArg
  1135  }
  1136  
  1137  // Kind implements Operation.Kind.
  1138  func (OperationStore32) Kind() OperationKind {
  1139  	return OperationKindStore32
  1140  }
  1141  
  1142  // OperationMemorySize implements Operation.
  1143  //
  1144  // This corresponds to wasm.OpcodeMemorySize.
  1145  //
  1146  // The engines are expected to push the current page size of the memory onto the stack.
  1147  type OperationMemorySize struct{}
  1148  
  1149  // Kind implements Operation.Kind.
  1150  func (OperationMemorySize) Kind() OperationKind {
  1151  	return OperationKindMemorySize
  1152  }
  1153  
  1154  // OperationMemoryGrow implements Operation.
  1155  type OperationMemoryGrow struct{ Alignment uint64 }
  1156  
  1157  // Kind implements Operation.Kind.
  1158  //
  1159  // This corresponds to wasm.OpcodeMemoryGrow.
  1160  //
  1161  // The engines are expected to pop one value from the top of the stack, then
  1162  // execute wasm.MemoryInstance Grow with the value, and push the previous
  1163  // page size of the memory onto the stack.
  1164  func (OperationMemoryGrow) Kind() OperationKind {
  1165  	return OperationKindMemoryGrow
  1166  }
  1167  
  1168  // OperationConstI32 implements Operation.
  1169  //
  1170  // This corresponds to wasm.OpcodeI32Const.
  1171  type OperationConstI32 struct{ Value uint32 }
  1172  
  1173  // Kind implements Operation.Kind.
  1174  func (OperationConstI32) Kind() OperationKind {
  1175  	return OperationKindConstI32
  1176  }
  1177  
  1178  // OperationConstI64 implements Operation.
  1179  //
  1180  // This corresponds to wasm.OpcodeI64Const.
  1181  type OperationConstI64 struct{ Value uint64 }
  1182  
  1183  // Kind implements Operation.Kind.
  1184  func (OperationConstI64) Kind() OperationKind {
  1185  	return OperationKindConstI64
  1186  }
  1187  
  1188  // OperationConstF32 implements Operation.
  1189  //
  1190  // This corresponds to wasm.OpcodeF32Const.
  1191  type OperationConstF32 struct{ Value float32 }
  1192  
  1193  // Kind implements Operation.Kind.
  1194  func (OperationConstF32) Kind() OperationKind {
  1195  	return OperationKindConstF32
  1196  }
  1197  
  1198  // OperationConstF64 implements Operation.
  1199  //
  1200  // This corresponds to wasm.OpcodeF64Const.
  1201  type OperationConstF64 struct{ Value float64 }
  1202  
  1203  // Kind implements Operation.Kind.
  1204  func (OperationConstF64) Kind() OperationKind {
  1205  	return OperationKindConstF64
  1206  }
  1207  
  1208  // OperationEq implements Operation.
  1209  //
  1210  // This corresponds to wasm.OpcodeI32EqName wasm.OpcodeI64EqName wasm.OpcodeF32EqName wasm.OpcodeF64EqName
  1211  type OperationEq struct{ Type UnsignedType }
  1212  
  1213  // Kind implements Operation.Kind.
  1214  func (OperationEq) Kind() OperationKind {
  1215  	return OperationKindEq
  1216  }
  1217  
  1218  // OperationNe implements Operation.
  1219  //
  1220  // This corresponds to wasm.OpcodeI32NeName wasm.OpcodeI64NeName wasm.OpcodeF32NeName wasm.OpcodeF64NeName
  1221  type OperationNe struct{ Type UnsignedType }
  1222  
  1223  // Kind implements Operation.Kind.
  1224  func (OperationNe) Kind() OperationKind {
  1225  	return OperationKindNe
  1226  }
  1227  
  1228  // OperationEqz implements Operation.
  1229  //
  1230  // This corresponds to wasm.OpcodeI32EqzName wasm.OpcodeI64EqzName
  1231  type OperationEqz struct{ Type UnsignedInt }
  1232  
  1233  // Kind implements Operation.Kind.
  1234  func (OperationEqz) Kind() OperationKind {
  1235  	return OperationKindEqz
  1236  }
  1237  
  1238  // OperationLt implements Operation.
  1239  //
  1240  // This corresponds to wasm.OpcodeI32LtS wasm.OpcodeI32LtU wasm.OpcodeI64LtS wasm.OpcodeI64LtU wasm.OpcodeF32Lt wasm.OpcodeF64Lt
  1241  type OperationLt struct{ Type SignedType }
  1242  
  1243  // Kind implements Operation.Kind.
  1244  func (OperationLt) Kind() OperationKind {
  1245  	return OperationKindLt
  1246  }
  1247  
  1248  // OperationGt implements Operation.
  1249  //
  1250  // This corresponds to wasm.OpcodeI32GtS wasm.OpcodeI32GtU wasm.OpcodeI64GtS wasm.OpcodeI64GtU wasm.OpcodeF32Gt wasm.OpcodeF64Gt
  1251  type OperationGt struct{ Type SignedType }
  1252  
  1253  // Kind implements Operation.Kind.
  1254  func (OperationGt) Kind() OperationKind {
  1255  	return OperationKindGt
  1256  }
  1257  
  1258  // OperationLe implements Operation.
  1259  //
  1260  // This corresponds to wasm.OpcodeI32LeS wasm.OpcodeI32LeU wasm.OpcodeI64LeS wasm.OpcodeI64LeU wasm.OpcodeF32Le wasm.OpcodeF64Le
  1261  type OperationLe struct{ Type SignedType }
  1262  
  1263  // Kind implements Operation.Kind.
  1264  func (OperationLe) Kind() OperationKind {
  1265  	return OperationKindLe
  1266  }
  1267  
  1268  // OperationGe implements Operation.
  1269  //
  1270  // This corresponds to wasm.OpcodeI32GeS wasm.OpcodeI32GeU wasm.OpcodeI64GeS wasm.OpcodeI64GeU wasm.OpcodeF32Ge wasm.OpcodeF64Ge
  1271  type OperationGe struct{ Type SignedType }
  1272  
  1273  // Kind implements Operation.Kind.
  1274  func (OperationGe) Kind() OperationKind {
  1275  	return OperationKindGe
  1276  }
  1277  
  1278  // OperationAdd implements Operation.
  1279  //
  1280  // This corresponds to wasm.OpcodeI32AddName wasm.OpcodeI64AddName wasm.OpcodeF32AddName wasm.OpcodeF64AddName.
  1281  type OperationAdd struct{ Type UnsignedType }
  1282  
  1283  // Kind implements Operation.Kind.
  1284  func (OperationAdd) Kind() OperationKind {
  1285  	return OperationKindAdd
  1286  }
  1287  
  1288  // OperationSub implements Operation.
  1289  //
  1290  // This corresponds to wasm.OpcodeI32SubName wasm.OpcodeI64SubName wasm.OpcodeF32SubName wasm.OpcodeF64SubName.
  1291  type OperationSub struct{ Type UnsignedType }
  1292  
  1293  // Kind implements Operation.Kind.
  1294  func (OperationSub) Kind() OperationKind {
  1295  	return OperationKindSub
  1296  }
  1297  
  1298  // OperationMul implements Operation.
  1299  //
  1300  // This corresponds to wasm.OpcodeI32MulName wasm.OpcodeI64MulName wasm.OpcodeF32MulName wasm.OpcodeF64MulName.
  1301  type OperationMul struct{ Type UnsignedType }
  1302  
  1303  // Kind implements Operation.Kind.
  1304  func (OperationMul) Kind() OperationKind {
  1305  	return OperationKindMul
  1306  }
  1307  
  1308  // OperationClz implements Operation.
  1309  //
  1310  // This corresponds to wasm.OpcodeI32ClzName wasm.OpcodeI64ClzName.
  1311  //
  1312  // The engines are expected to count up the leading zeros in the
  1313  // current top of the stack, and push the count result.
  1314  // For example, stack of [..., 0x00_ff_ff_ff] results in [..., 8].
  1315  // See wasm.OpcodeI32Clz wasm.OpcodeI64Clz
  1316  type OperationClz struct{ Type UnsignedInt }
  1317  
  1318  // Kind implements Operation.Kind.
  1319  func (OperationClz) Kind() OperationKind {
  1320  	return OperationKindClz
  1321  }
  1322  
  1323  // OperationCtz implements Operation.
  1324  //
  1325  // This corresponds to wasm.OpcodeI32CtzName wasm.OpcodeI64CtzName.
  1326  //
  1327  // The engines are expected to count up the trailing zeros in the
  1328  // current top of the stack, and push the count result.
  1329  // For example, stack of [..., 0xff_ff_ff_00] results in [..., 8].
  1330  type OperationCtz struct{ Type UnsignedInt }
  1331  
  1332  // Kind implements Operation.Kind.
  1333  func (OperationCtz) Kind() OperationKind {
  1334  	return OperationKindCtz
  1335  }
  1336  
  1337  // OperationPopcnt implements Operation.
  1338  //
  1339  // This corresponds to wasm.OpcodeI32PopcntName wasm.OpcodeI64PopcntName.
  1340  //
  1341  // The engines are expected to count up the number of set bits in the
  1342  // current top of the stack, and push the count result.
  1343  // For example, stack of [..., 0b00_00_00_11] results in [..., 2].
  1344  type OperationPopcnt struct{ Type UnsignedInt }
  1345  
  1346  // Kind implements Operation.Kind.
  1347  func (OperationPopcnt) Kind() OperationKind {
  1348  	return OperationKindPopcnt
  1349  }
  1350  
  1351  // OperationDiv implements Operation.
  1352  //
  1353  // This corresponds to wasm.OpcodeI32DivS wasm.OpcodeI32DivU wasm.OpcodeI64DivS
  1354  //
  1355  //	wasm.OpcodeI64DivU wasm.OpcodeF32Div wasm.OpcodeF64Div.
  1356  type OperationDiv struct{ Type SignedType }
  1357  
  1358  // Kind implements Operation.Kind.
  1359  func (OperationDiv) Kind() OperationKind {
  1360  	return OperationKindDiv
  1361  }
  1362  
  1363  // OperationRem implements Operation.
  1364  //
  1365  // This corresponds to wasm.OpcodeI32RemS wasm.OpcodeI32RemU wasm.OpcodeI64RemS wasm.OpcodeI64RemU.
  1366  //
  1367  // The engines are expected to perform division on the top
  1368  // two values of integer type on the stack and puts the remainder of the result
  1369  // onto the stack. For example, stack [..., 10, 3] results in [..., 1] where
  1370  // the quotient is discarded.
  1371  type OperationRem struct{ Type SignedInt }
  1372  
  1373  // Kind implements Operation.Kind.
  1374  func (OperationRem) Kind() OperationKind {
  1375  	return OperationKindRem
  1376  }
  1377  
  1378  // OperationAnd implements Operation.
  1379  //
  1380  // # This corresponds to wasm.OpcodeI32AndName wasm.OpcodeI64AndName
  1381  //
  1382  // The engines are expected to perform "And" operation on
  1383  // top two values on the stack, and pushes the result.
  1384  type OperationAnd struct{ Type UnsignedInt }
  1385  
  1386  // Kind implements Operation.Kind.
  1387  func (OperationAnd) Kind() OperationKind {
  1388  	return OperationKindAnd
  1389  }
  1390  
  1391  // OperationOr implements Operation.
  1392  //
  1393  // # This corresponds to wasm.OpcodeI32OrName wasm.OpcodeI64OrName
  1394  //
  1395  // The engines are expected to perform "Or" operation on
  1396  // top two values on the stack, and pushes the result.
  1397  type OperationOr struct{ Type UnsignedInt }
  1398  
  1399  // Kind implements Operation.Kind.
  1400  func (OperationOr) Kind() OperationKind {
  1401  	return OperationKindOr
  1402  }
  1403  
  1404  // OperationXor implements Operation.
  1405  //
  1406  // # This corresponds to wasm.OpcodeI32XorName wasm.OpcodeI64XorName
  1407  //
  1408  // The engines are expected to perform "Xor" operation on
  1409  // top two values on the stack, and pushes the result.
  1410  type OperationXor struct{ Type UnsignedInt }
  1411  
  1412  // Kind implements Operation.Kind.
  1413  func (OperationXor) Kind() OperationKind {
  1414  	return OperationKindXor
  1415  }
  1416  
  1417  // OperationShl implements Operation.
  1418  //
  1419  // # This corresponds to wasm.OpcodeI32ShlName wasm.OpcodeI64ShlName
  1420  //
  1421  // The engines are expected to perform "Shl" operation on
  1422  // top two values on the stack, and pushes the result.
  1423  type OperationShl struct{ Type UnsignedInt }
  1424  
  1425  // Kind implements Operation.Kind.
  1426  func (OperationShl) Kind() OperationKind {
  1427  	return OperationKindShl
  1428  }
  1429  
  1430  // OperationShr implements Operation.
  1431  //
  1432  // # This corresponds to wasm.OpcodeI32ShrSName wasm.OpcodeI32ShrUName wasm.OpcodeI64ShrSName wasm.OpcodeI64ShrUName
  1433  //
  1434  // If OperationShr.Type is signed integer, then, the engines are expected to perform arithmetic right shift on the two
  1435  // top values on the stack, otherwise do the logical right shift.
  1436  type OperationShr struct{ Type SignedInt }
  1437  
  1438  // Kind implements Operation.Kind.
  1439  func (OperationShr) Kind() OperationKind {
  1440  	return OperationKindShr
  1441  }
  1442  
  1443  // OperationRotl implements Operation.
  1444  //
  1445  // # This corresponds to wasm.OpcodeI32RotlName wasm.OpcodeI64RotlName
  1446  //
  1447  // The engines are expected to perform "Rotl" operation on
  1448  // top two values on the stack, and pushes the result.
  1449  type OperationRotl struct{ Type UnsignedInt }
  1450  
  1451  // Kind implements Operation.Kind.
  1452  func (OperationRotl) Kind() OperationKind {
  1453  	return OperationKindRotl
  1454  }
  1455  
  1456  // OperationRotr implements Operation.
  1457  //
  1458  // # This corresponds to wasm.OpcodeI32RotrName wasm.OpcodeI64RotrName
  1459  //
  1460  // The engines are expected to perform "Rotr" operation on
  1461  // top two values on the stack, and pushes the result.
  1462  type OperationRotr struct{ Type UnsignedInt }
  1463  
  1464  // Kind implements Operation.Kind.
  1465  func (OperationRotr) Kind() OperationKind {
  1466  	return OperationKindRotr
  1467  }
  1468  
  1469  // OperationAbs implements Operation.
  1470  //
  1471  // This corresponds to wasm.OpcodeF32Abs wasm.OpcodeF64Abs
  1472  type OperationAbs struct{ Type Float }
  1473  
  1474  // Kind implements Operation.Kind.
  1475  func (OperationAbs) Kind() OperationKind {
  1476  	return OperationKindAbs
  1477  }
  1478  
  1479  // OperationNeg implements Operation.
  1480  //
  1481  // This corresponds to wasm.OpcodeF32Neg wasm.OpcodeF64Neg
  1482  type OperationNeg struct{ Type Float }
  1483  
  1484  // Kind implements Operation.Kind.
  1485  func (OperationNeg) Kind() OperationKind {
  1486  	return OperationKindNeg
  1487  }
  1488  
  1489  // OperationCeil implements Operation.
  1490  //
  1491  // This corresponds to wasm.OpcodeF32CeilName wasm.OpcodeF64CeilName
  1492  type OperationCeil struct{ Type Float }
  1493  
  1494  // Kind implements Operation.Kind.
  1495  func (OperationCeil) Kind() OperationKind {
  1496  	return OperationKindCeil
  1497  }
  1498  
  1499  // OperationFloor implements Operation.
  1500  //
  1501  // This corresponds to wasm.OpcodeF32FloorName wasm.OpcodeF64FloorName
  1502  type OperationFloor struct{ Type Float }
  1503  
  1504  // Kind implements Operation.Kind.
  1505  func (OperationFloor) Kind() OperationKind {
  1506  	return OperationKindFloor
  1507  }
  1508  
  1509  // OperationTrunc implements Operation.
  1510  //
  1511  // This corresponds to wasm.OpcodeF32TruncName wasm.OpcodeF64TruncName
  1512  type OperationTrunc struct{ Type Float }
  1513  
  1514  // Kind implements Operation.Kind.
  1515  func (OperationTrunc) Kind() OperationKind {
  1516  	return OperationKindTrunc
  1517  }
  1518  
  1519  // OperationNearest implements Operation.
  1520  //
  1521  // # This corresponds to wasm.OpcodeF32NearestName wasm.OpcodeF64NearestName
  1522  //
  1523  // Note: this is *not* equivalent to math.Round and instead has the same
  1524  // the semantics of LLVM's rint intrinsic. See https://llvm.org/docs/LangRef.html#llvm-rint-intrinsic.
  1525  // For example, math.Round(-4.5) produces -5 while we want to produce -4.
  1526  type OperationNearest struct{ Type Float }
  1527  
  1528  // Kind implements Operation.Kind.
  1529  func (OperationNearest) Kind() OperationKind {
  1530  	return OperationKindNearest
  1531  }
  1532  
  1533  // OperationSqrt implements Operation.
  1534  //
  1535  // This corresponds to wasm.OpcodeF32SqrtName wasm.OpcodeF64SqrtName
  1536  type OperationSqrt struct{ Type Float }
  1537  
  1538  // Kind implements Operation.Kind.
  1539  func (OperationSqrt) Kind() OperationKind {
  1540  	return OperationKindSqrt
  1541  }
  1542  
  1543  // OperationMin implements Operation.
  1544  //
  1545  // # This corresponds to wasm.OpcodeF32MinName wasm.OpcodeF64MinName
  1546  //
  1547  // The engines are expected to pop two values from the stack, and push back the maximum of
  1548  // these two values onto the stack. For example, stack [..., 100.1, 1.9] results in [..., 1.9].
  1549  //
  1550  // Note: WebAssembly specifies that min/max must always return NaN if one of values is NaN,
  1551  // which is a different behavior different from math.Min.
  1552  type OperationMin struct{ Type Float }
  1553  
  1554  // Kind implements Operation.Kind.
  1555  func (OperationMin) Kind() OperationKind {
  1556  	return OperationKindMin
  1557  }
  1558  
  1559  // OperationMax implements Operation.
  1560  //
  1561  // # This corresponds to wasm.OpcodeF32MaxName wasm.OpcodeF64MaxName
  1562  //
  1563  // The engines are expected to pop two values from the stack, and push back the maximum of
  1564  // these two values onto the stack. For example, stack [..., 100.1, 1.9] results in [..., 100.1].
  1565  //
  1566  // Note: WebAssembly specifies that min/max must always return NaN if one of values is NaN,
  1567  // which is a different behavior different from math.Max.
  1568  type OperationMax struct{ Type Float }
  1569  
  1570  // Kind implements Operation.Kind.
  1571  func (OperationMax) Kind() OperationKind {
  1572  	return OperationKindMax
  1573  }
  1574  
  1575  // OperationCopysign implements Operation.
  1576  //
  1577  // # This corresponds to wasm.OpcodeF32CopysignName wasm.OpcodeF64CopysignName
  1578  //
  1579  // The engines are expected to pop two float values from the stack, and copy the signbit of
  1580  // the first-popped value to the last one.
  1581  // For example, stack [..., 1.213, -5.0] results in [..., -1.213].
  1582  type OperationCopysign struct{ Type Float }
  1583  
  1584  // Kind implements Operation.Kind.
  1585  func (OperationCopysign) Kind() OperationKind {
  1586  	return OperationKindCopysign
  1587  }
  1588  
  1589  // OperationI32WrapFromI64 implements Operation.
  1590  //
  1591  // This corresponds to wasm.OpcodeI32WrapI64 and equivalent to uint64(uint32(v)) in Go.
  1592  //
  1593  // The engines are expected to replace the 64-bit int on top of the stack
  1594  // with the corresponding 32-bit integer.
  1595  type OperationI32WrapFromI64 struct{}
  1596  
  1597  // Kind implements Operation.Kind.
  1598  func (OperationI32WrapFromI64) Kind() OperationKind {
  1599  	return OperationKindI32WrapFromI64
  1600  }
  1601  
  1602  // OperationITruncFromF implements Operation.
  1603  //
  1604  // This corresponds to
  1605  //
  1606  //	wasm.OpcodeI32TruncF32SName wasm.OpcodeI32TruncF32UName wasm.OpcodeI32TruncF64SName
  1607  //	wasm.OpcodeI32TruncF64UName wasm.OpcodeI64TruncF32SName wasm.OpcodeI64TruncF32UName wasm.OpcodeI64TruncF64SName
  1608  //	wasm.OpcodeI64TruncF64UName. wasm.OpcodeI32TruncSatF32SName wasm.OpcodeI32TruncSatF32UName
  1609  //	wasm.OpcodeI32TruncSatF64SName wasm.OpcodeI32TruncSatF64UName wasm.OpcodeI64TruncSatF32SName
  1610  //	wasm.OpcodeI64TruncSatF32UName wasm.OpcodeI64TruncSatF64SName wasm.OpcodeI64TruncSatF64UName
  1611  //
  1612  // See [1] and [2] for when we encounter undefined behavior in the WebAssembly specification if OperationITruncFromF.NonTrapping == false.
  1613  // To summarize, if the source float value is NaN or doesn't fit in the destination range of integers (incl. +=Inf),
  1614  // then the runtime behavior is undefined. In wazero, the engines are expected to exit the execution in these undefined cases with
  1615  // wasmruntime.ErrRuntimeInvalidConversionToInteger error.
  1616  //
  1617  // [1] https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#-hrefop-trunc-umathrmtruncmathsfu_m-n-z for unsigned integers.
  1618  // [2] https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#-hrefop-trunc-smathrmtruncmathsfs_m-n-z for signed integers.
  1619  type OperationITruncFromF struct {
  1620  	InputType  Float
  1621  	OutputType SignedInt
  1622  	// NonTrapping true if this conversion is "nontrapping" in the sense of the
  1623  	// https://github.com/WebAssembly/spec/blob/ce4b6c4d47eb06098cc7ab2e81f24748da822f20/proposals/nontrapping-float-to-int-conversion/Overview.md
  1624  	NonTrapping bool
  1625  }
  1626  
  1627  // Kind implements Operation.Kind.
  1628  func (OperationITruncFromF) Kind() OperationKind {
  1629  	return OperationKindITruncFromF
  1630  }
  1631  
  1632  // OperationFConvertFromI implements Operation.
  1633  //
  1634  // This corresponds to
  1635  //
  1636  //	wasm.OpcodeF32ConvertI32SName wasm.OpcodeF32ConvertI32UName wasm.OpcodeF32ConvertI64SName wasm.OpcodeF32ConvertI64UName
  1637  //	wasm.OpcodeF64ConvertI32SName wasm.OpcodeF64ConvertI32UName wasm.OpcodeF64ConvertI64SName wasm.OpcodeF64ConvertI64UName
  1638  //
  1639  // and equivalent to float32(uint32(x)), float32(int32(x)), etc in Go.
  1640  type OperationFConvertFromI struct {
  1641  	InputType  SignedInt
  1642  	OutputType Float
  1643  }
  1644  
  1645  // Kind implements Operation.Kind.
  1646  func (OperationFConvertFromI) Kind() OperationKind {
  1647  	return OperationKindFConvertFromI
  1648  }
  1649  
  1650  // OperationF32DemoteFromF64 implements Operation.
  1651  //
  1652  // This corresponds to wasm.OpcodeF32DemoteF64 and is equivalent float32(float64(v)).
  1653  type OperationF32DemoteFromF64 struct{}
  1654  
  1655  // Kind implements Operation.Kind.
  1656  func (OperationF32DemoteFromF64) Kind() OperationKind {
  1657  	return OperationKindF32DemoteFromF64
  1658  }
  1659  
  1660  // OperationF64PromoteFromF32 implements Operation.
  1661  //
  1662  // This corresponds to wasm.OpcodeF64PromoteF32 and is equivalent float64(float32(v)).
  1663  type OperationF64PromoteFromF32 struct{}
  1664  
  1665  // Kind implements Operation.Kind.
  1666  func (OperationF64PromoteFromF32) Kind() OperationKind {
  1667  	return OperationKindF64PromoteFromF32
  1668  }
  1669  
  1670  // OperationI32ReinterpretFromF32 implements Operation.
  1671  //
  1672  // This corresponds to wasm.OpcodeI32ReinterpretF32Name.
  1673  type OperationI32ReinterpretFromF32 struct{}
  1674  
  1675  // Kind implements Operation.Kind.
  1676  func (OperationI32ReinterpretFromF32) Kind() OperationKind {
  1677  	return OperationKindI32ReinterpretFromF32
  1678  }
  1679  
  1680  // OperationI64ReinterpretFromF64 implements Operation.
  1681  //
  1682  // This corresponds to wasm.OpcodeI64ReinterpretF64Name.
  1683  type OperationI64ReinterpretFromF64 struct{}
  1684  
  1685  // Kind implements Operation.Kind.
  1686  func (OperationI64ReinterpretFromF64) Kind() OperationKind {
  1687  	return OperationKindI64ReinterpretFromF64
  1688  }
  1689  
  1690  // OperationF32ReinterpretFromI32 implements Operation.
  1691  //
  1692  // This corresponds to wasm.OpcodeF32ReinterpretI32Name.
  1693  type OperationF32ReinterpretFromI32 struct{}
  1694  
  1695  // Kind implements Operation.Kind.
  1696  func (OperationF32ReinterpretFromI32) Kind() OperationKind {
  1697  	return OperationKindF32ReinterpretFromI32
  1698  }
  1699  
  1700  // OperationF64ReinterpretFromI64 implements Operation.
  1701  //
  1702  // This corresponds to wasm.OpcodeF64ReinterpretI64Name.
  1703  type OperationF64ReinterpretFromI64 struct{}
  1704  
  1705  // Kind implements Operation.Kind.
  1706  func (OperationF64ReinterpretFromI64) Kind() OperationKind {
  1707  	return OperationKindF64ReinterpretFromI64
  1708  }
  1709  
  1710  // OperationExtend implements Operation.
  1711  //
  1712  // # This corresponds to wasm.OpcodeI64ExtendI32SName wasm.OpcodeI64ExtendI32UName
  1713  //
  1714  // The engines are expected to extend the 32-bit signed or unsigned int on top of the stack
  1715  // as a 64-bit integer of corresponding signedness. For unsigned case, this is just reinterpreting the
  1716  // underlying bit pattern as 64-bit integer. For signed case, this is sign-extension which preserves the
  1717  // original integer's sign.
  1718  type OperationExtend struct{ Signed bool }
  1719  
  1720  // Kind implements Operation.Kind.
  1721  func (OperationExtend) Kind() OperationKind {
  1722  	return OperationKindExtend
  1723  }
  1724  
  1725  // OperationSignExtend32From8 implements Operation.
  1726  //
  1727  // This corresponds to wasm.OpcodeI32Extend8SName.
  1728  //
  1729  // The engines are expected to sign-extend the first 8-bits of 32-bit in as signed 32-bit int.
  1730  type OperationSignExtend32From8 struct{}
  1731  
  1732  // Kind implements Operation.Kind.
  1733  func (OperationSignExtend32From8) Kind() OperationKind {
  1734  	return OperationKindSignExtend32From8
  1735  }
  1736  
  1737  // OperationSignExtend32From16 implements Operation.
  1738  //
  1739  // This corresponds to wasm.OpcodeI32Extend16SName.
  1740  //
  1741  // The engines are expected to sign-extend the first 16-bits of 32-bit in as signed 32-bit int.
  1742  type OperationSignExtend32From16 struct{}
  1743  
  1744  // Kind implements Operation.Kind.
  1745  func (OperationSignExtend32From16) Kind() OperationKind {
  1746  	return OperationKindSignExtend32From16
  1747  }
  1748  
  1749  // OperationSignExtend64From8 implements Operation.
  1750  //
  1751  // This corresponds to wasm.OpcodeI64Extend8SName.
  1752  //
  1753  // The engines are expected to sign-extend the first 8-bits of 64-bit in as signed 32-bit int.
  1754  type OperationSignExtend64From8 struct{}
  1755  
  1756  // Kind implements Operation.Kind.
  1757  func (OperationSignExtend64From8) Kind() OperationKind {
  1758  	return OperationKindSignExtend64From8
  1759  }
  1760  
  1761  // OperationSignExtend64From16 implements Operation.
  1762  //
  1763  // This corresponds to wasm.OpcodeI64Extend16SName.
  1764  //
  1765  // The engines are expected to sign-extend the first 16-bits of 64-bit in as signed 32-bit int.
  1766  type OperationSignExtend64From16 struct{}
  1767  
  1768  // Kind implements Operation.Kind.
  1769  func (OperationSignExtend64From16) Kind() OperationKind {
  1770  	return OperationKindSignExtend64From16
  1771  }
  1772  
  1773  // OperationSignExtend64From32 implements Operation.
  1774  //
  1775  // This corresponds to wasm.OpcodeI64Extend32SName.
  1776  //
  1777  // The engines are expected to sign-extend the first 32-bits of 64-bit in as signed 32-bit int.
  1778  type OperationSignExtend64From32 struct{}
  1779  
  1780  // Kind implements Operation.Kind.
  1781  func (OperationSignExtend64From32) Kind() OperationKind {
  1782  	return OperationKindSignExtend64From32
  1783  }
  1784  
  1785  // OperationMemoryInit implements Operation.
  1786  //
  1787  // This corresponds to wasm.OpcodeMemoryInitName.
  1788  type OperationMemoryInit struct {
  1789  	// DataIndex is the index of the data instance in ModuleInstance.DataInstances
  1790  	// by which this operation instantiates a part of the memory.
  1791  	DataIndex uint32
  1792  }
  1793  
  1794  // Kind implements Operation.Kind.
  1795  func (OperationMemoryInit) Kind() OperationKind {
  1796  	return OperationKindMemoryInit
  1797  }
  1798  
  1799  // OperationDataDrop implements Operation.
  1800  //
  1801  // This corresponds to wasm.OpcodeDataDropName.
  1802  type OperationDataDrop struct {
  1803  	// DataIndex is the index of the data instance in ModuleInstance.DataInstances
  1804  	// which this operation drops.
  1805  	DataIndex uint32
  1806  }
  1807  
  1808  // Kind implements Operation.Kind.
  1809  func (OperationDataDrop) Kind() OperationKind {
  1810  	return OperationKindDataDrop
  1811  }
  1812  
  1813  // OperationMemoryCopy implements Operation.
  1814  //
  1815  // This corresponds to wasm.OpcodeMemoryCopyName.
  1816  type OperationMemoryCopy struct{}
  1817  
  1818  // Kind implements Operation.Kind.
  1819  func (OperationMemoryCopy) Kind() OperationKind {
  1820  	return OperationKindMemoryCopy
  1821  }
  1822  
  1823  // OperationMemoryFill implements Operation.
  1824  //
  1825  // This corresponds to wasm.OpcodeMemoryFillName.
  1826  type OperationMemoryFill struct{}
  1827  
  1828  // Kind implements Operation.Kind.
  1829  func (OperationMemoryFill) Kind() OperationKind {
  1830  	return OperationKindMemoryFill
  1831  }
  1832  
  1833  // OperationTableInit implements Operation.
  1834  //
  1835  // This corresponds to wasm.OpcodeTableInitName.
  1836  type OperationTableInit struct {
  1837  	// ElemIndex is the index of the element by which this operation initializes a part of the table.
  1838  	ElemIndex uint32
  1839  	// TableIndex is the index of the table on which this operation initialize by the target element.
  1840  	TableIndex uint32
  1841  }
  1842  
  1843  // Kind implements Operation.Kind.
  1844  func (OperationTableInit) Kind() OperationKind {
  1845  	return OperationKindTableInit
  1846  }
  1847  
  1848  // OperationElemDrop implements Operation.
  1849  //
  1850  // This corresponds to wasm.OpcodeElemDropName.
  1851  type OperationElemDrop struct {
  1852  	// ElemIndex is the index of the element which this operation drops.
  1853  	ElemIndex uint32
  1854  }
  1855  
  1856  // Kind implements Operation.Kind.
  1857  func (OperationElemDrop) Kind() OperationKind {
  1858  	return OperationKindElemDrop
  1859  }
  1860  
  1861  // OperationTableCopy implements Operation.
  1862  //
  1863  // This corresponds to wasm.OpcodeTableCopyName.
  1864  type OperationTableCopy struct {
  1865  	SrcTableIndex, DstTableIndex uint32
  1866  }
  1867  
  1868  // Kind implements Operation.Kind.
  1869  func (OperationTableCopy) Kind() OperationKind {
  1870  	return OperationKindTableCopy
  1871  }
  1872  
  1873  // OperationRefFunc implements Operation.
  1874  //
  1875  // This corresponds to wasm.OpcodeRefFuncName, and engines are expected to
  1876  // push the opaque pointer value of engine specific func for the given FunctionIndex.
  1877  //
  1878  // Note: in wazero, we express any reference types (funcref or externref) as opaque pointers which is uint64.
  1879  // Therefore, the engine implementations emit instructions to push the address of *function onto the stack.
  1880  type OperationRefFunc struct {
  1881  	FunctionIndex uint32
  1882  }
  1883  
  1884  // Kind implements Operation.Kind.
  1885  func (OperationRefFunc) Kind() OperationKind {
  1886  	return OperationKindRefFunc
  1887  }
  1888  
  1889  // OperationTableGet implements Operation.
  1890  //
  1891  // This corresponds to wasm.OpcodeTableGetName.
  1892  type OperationTableGet struct {
  1893  	TableIndex uint32
  1894  }
  1895  
  1896  // Kind implements Operation.Kind.
  1897  func (OperationTableGet) Kind() OperationKind {
  1898  	return OperationKindTableGet
  1899  }
  1900  
  1901  // OperationTableSet implements Operation.
  1902  //
  1903  // This corresponds to wasm.OpcodeTableSetName.
  1904  type OperationTableSet struct {
  1905  	TableIndex uint32
  1906  }
  1907  
  1908  // Kind implements Operation.Kind.
  1909  func (OperationTableSet) Kind() OperationKind {
  1910  	return OperationKindTableSet
  1911  }
  1912  
  1913  // OperationTableSize implements Operation.
  1914  //
  1915  // This corresponds to wasm.OpcodeTableSizeName.
  1916  type OperationTableSize struct {
  1917  	TableIndex uint32
  1918  }
  1919  
  1920  // Kind implements Operation.Kind.
  1921  func (OperationTableSize) Kind() OperationKind {
  1922  	return OperationKindTableSize
  1923  }
  1924  
  1925  // OperationTableGrow implements Operation.
  1926  //
  1927  // This corresponds to wasm.OpcodeTableGrowName.
  1928  type OperationTableGrow struct {
  1929  	TableIndex uint32
  1930  }
  1931  
  1932  // Kind implements Operation.Kind.
  1933  func (OperationTableGrow) Kind() OperationKind {
  1934  	return OperationKindTableGrow
  1935  }
  1936  
  1937  // OperationTableFill implements Operation.
  1938  //
  1939  // This corresponds to wasm.OpcodeTableFillName.
  1940  type OperationTableFill struct {
  1941  	TableIndex uint32
  1942  }
  1943  
  1944  // Kind implements Operation.Kind.
  1945  func (OperationTableFill) Kind() OperationKind {
  1946  	return OperationKindTableFill
  1947  }
  1948  
  1949  // OperationV128Const implements Operation.
  1950  type OperationV128Const struct {
  1951  	Lo, Hi uint64
  1952  }
  1953  
  1954  // Kind implements Operation.Kind.
  1955  //
  1956  // This corresponds to wasm.OpcodeVecV128Const.
  1957  func (OperationV128Const) Kind() OperationKind {
  1958  	return OperationKindV128Const
  1959  }
  1960  
  1961  // Shape corresponds to a shape of v128 values.
  1962  // https://webassembly.github.io/spec/core/syntax/instructions.html#syntax-shape
  1963  type Shape = byte
  1964  
  1965  const (
  1966  	ShapeI8x16 Shape = iota
  1967  	ShapeI16x8
  1968  	ShapeI32x4
  1969  	ShapeI64x2
  1970  	ShapeF32x4
  1971  	ShapeF64x2
  1972  )
  1973  
  1974  func shapeName(s Shape) (ret string) {
  1975  	switch s {
  1976  	case ShapeI8x16:
  1977  		ret = "I8x16"
  1978  	case ShapeI16x8:
  1979  		ret = "I16x8"
  1980  	case ShapeI32x4:
  1981  		ret = "I32x4"
  1982  	case ShapeI64x2:
  1983  		ret = "I64x2"
  1984  	case ShapeF32x4:
  1985  		ret = "F32x4"
  1986  	case ShapeF64x2:
  1987  		ret = "F64x2"
  1988  	}
  1989  	return
  1990  }
  1991  
  1992  // OperationV128Add implements Operation.
  1993  //
  1994  // This corresponds to wasm.OpcodeVecI8x16AddName wasm.OpcodeVecI16x8AddName wasm.OpcodeVecI32x4AddName
  1995  //
  1996  //	wasm.OpcodeVecI64x2AddName wasm.OpcodeVecF32x4AddName wasm.OpcodeVecF64x2AddName
  1997  type OperationV128Add struct {
  1998  	Shape Shape
  1999  }
  2000  
  2001  // Kind implements Operation.Kind.
  2002  func (OperationV128Add) Kind() OperationKind {
  2003  	return OperationKindV128Add
  2004  }
  2005  
  2006  // OperationV128Sub implements Operation.
  2007  //
  2008  // This corresponds to wasm.OpcodeVecI8x16SubName wasm.OpcodeVecI16x8SubName wasm.OpcodeVecI32x4SubName
  2009  //
  2010  //	wasm.OpcodeVecI64x2SubName wasm.OpcodeVecF32x4SubName wasm.OpcodeVecF64x2SubName
  2011  type OperationV128Sub struct {
  2012  	Shape Shape
  2013  }
  2014  
  2015  // Kind implements Operation.Kind.
  2016  func (OperationV128Sub) Kind() OperationKind {
  2017  	return OperationKindV128Sub
  2018  }
  2019  
  2020  // V128LoadType represents a type of wasm.OpcodeVecV128Load* instructions.
  2021  type V128LoadType = byte
  2022  
  2023  const (
  2024  	// V128LoadType128 corresponds to wasm.OpcodeVecV128LoadName.
  2025  	V128LoadType128 V128LoadType = iota
  2026  	// V128LoadType8x8s corresponds to wasm.OpcodeVecV128Load8x8SName.
  2027  	V128LoadType8x8s
  2028  	// V128LoadType8x8u corresponds to wasm.OpcodeVecV128Load8x8UName.
  2029  	V128LoadType8x8u
  2030  	// V128LoadType16x4s corresponds to wasm.OpcodeVecV128Load16x4SName
  2031  	V128LoadType16x4s
  2032  	// V128LoadType16x4u corresponds to wasm.OpcodeVecV128Load16x4UName
  2033  	V128LoadType16x4u
  2034  	// V128LoadType32x2s corresponds to wasm.OpcodeVecV128Load32x2SName
  2035  	V128LoadType32x2s
  2036  	// V128LoadType32x2u corresponds to wasm.OpcodeVecV128Load32x2UName
  2037  	V128LoadType32x2u
  2038  	// V128LoadType8Splat corresponds to wasm.OpcodeVecV128Load8SplatName
  2039  	V128LoadType8Splat
  2040  	// V128LoadType16Splat corresponds to wasm.OpcodeVecV128Load16SplatName
  2041  	V128LoadType16Splat
  2042  	// V128LoadType32Splat corresponds to wasm.OpcodeVecV128Load32SplatName
  2043  	V128LoadType32Splat
  2044  	// V128LoadType64Splat corresponds to wasm.OpcodeVecV128Load64SplatName
  2045  	V128LoadType64Splat
  2046  	// V128LoadType32zero corresponds to wasm.OpcodeVecV128Load32zeroName
  2047  	V128LoadType32zero
  2048  	// V128LoadType64zero corresponds to wasm.OpcodeVecV128Load64zeroName
  2049  	V128LoadType64zero
  2050  )
  2051  
  2052  // OperationV128Load implements Operation.
  2053  //
  2054  // This corresponds to
  2055  //
  2056  //	wasm.OpcodeVecV128LoadName wasm.OpcodeVecV128Load8x8SName wasm.OpcodeVecV128Load8x8UName
  2057  //	wasm.OpcodeVecV128Load16x4SName wasm.OpcodeVecV128Load16x4UName wasm.OpcodeVecV128Load32x2SName
  2058  //	wasm.OpcodeVecV128Load32x2UName wasm.OpcodeVecV128Load8SplatName wasm.OpcodeVecV128Load16SplatName
  2059  //	wasm.OpcodeVecV128Load32SplatName wasm.OpcodeVecV128Load64SplatName wasm.OpcodeVecV128Load32zeroName
  2060  //	wasm.OpcodeVecV128Load64zeroName
  2061  type OperationV128Load struct {
  2062  	Type V128LoadType
  2063  	Arg  *MemoryArg
  2064  }
  2065  
  2066  // Kind implements Operation.Kind.
  2067  func (OperationV128Load) Kind() OperationKind {
  2068  	return OperationKindV128Load
  2069  }
  2070  
  2071  // OperationV128LoadLane implements Operation.
  2072  //
  2073  // This corresponds to wasm.OpcodeVecV128Load8LaneName wasm.OpcodeVecV128Load16LaneName
  2074  //
  2075  //	wasm.OpcodeVecV128Load32LaneName wasm.OpcodeVecV128Load64LaneName.
  2076  type OperationV128LoadLane struct {
  2077  	// LaneIndex is >=0 && <(128/LaneSize).
  2078  	LaneIndex byte
  2079  	// LaneSize is either 8, 16, 32, or 64.
  2080  	LaneSize byte
  2081  	Arg      *MemoryArg
  2082  }
  2083  
  2084  // Kind implements Operation.Kind.
  2085  func (OperationV128LoadLane) Kind() OperationKind {
  2086  	return OperationKindV128LoadLane
  2087  }
  2088  
  2089  // OperationV128Store implements Operation.
  2090  //
  2091  // This corresponds to wasm.OpcodeVecV128Load8LaneName wasm.OpcodeVecV128Load16LaneName
  2092  //
  2093  //	wasm.OpcodeVecV128Load32LaneName wasm.OpcodeVecV128Load64LaneName.
  2094  type OperationV128Store struct {
  2095  	Arg *MemoryArg
  2096  }
  2097  
  2098  // Kind implements Operation.Kind.
  2099  func (OperationV128Store) Kind() OperationKind {
  2100  	return OperationKindV128Store
  2101  }
  2102  
  2103  // OperationV128StoreLane implements Operation.
  2104  //
  2105  // This corresponds to wasm.OpcodeVecV128Load8LaneName wasm.OpcodeVecV128Load16LaneName
  2106  //
  2107  //	wasm.OpcodeVecV128Load32LaneName wasm.OpcodeVecV128Load64LaneName.
  2108  type OperationV128StoreLane struct {
  2109  	// LaneIndex is >=0 && <(128/LaneSize).
  2110  	LaneIndex byte
  2111  	// LaneSize is either 8, 16, 32, or 64.
  2112  	LaneSize byte
  2113  	Arg      *MemoryArg
  2114  }
  2115  
  2116  // Kind implements Operation.Kind.
  2117  func (OperationV128StoreLane) Kind() OperationKind {
  2118  	return OperationKindV128StoreLane
  2119  }
  2120  
  2121  // OperationV128ExtractLane implements Operation.
  2122  //
  2123  // This corresponds to
  2124  //
  2125  //	wasm.OpcodeVecI8x16ExtractLaneSName wasm.OpcodeVecI8x16ExtractLaneUName
  2126  //	wasm.OpcodeVecI16x8ExtractLaneSName wasm.OpcodeVecI16x8ExtractLaneUName
  2127  //	wasm.OpcodeVecI32x4ExtractLaneName wasm.OpcodeVecI64x2ExtractLaneName
  2128  //	wasm.OpcodeVecF32x4ExtractLaneName wasm.OpcodeVecF64x2ExtractLaneName.
  2129  type OperationV128ExtractLane struct {
  2130  	// LaneIndex is >=0 && <M where shape = NxM.
  2131  	LaneIndex byte
  2132  	// Signed is used when shape is either i8x16 or i16x2 to specify whether to sign-extend or not.
  2133  	Signed bool
  2134  	Shape  Shape
  2135  }
  2136  
  2137  // Kind implements Operation.Kind.
  2138  func (OperationV128ExtractLane) Kind() OperationKind {
  2139  	return OperationKindV128ExtractLane
  2140  }
  2141  
  2142  // OperationV128ReplaceLane implements Operation.
  2143  //
  2144  // This corresponds to
  2145  //
  2146  //	wasm.OpcodeVecI8x16ReplaceLaneName wasm.OpcodeVecI16x8ReplaceLaneName
  2147  //	wasm.OpcodeVecI32x4ReplaceLaneName wasm.OpcodeVecI64x2ReplaceLaneName
  2148  //	wasm.OpcodeVecF32x4ReplaceLaneName wasm.OpcodeVecF64x2ReplaceLaneName.
  2149  type OperationV128ReplaceLane struct {
  2150  	// LaneIndex is >=0 && <M where shape = NxM.
  2151  	LaneIndex byte
  2152  	Shape     Shape
  2153  }
  2154  
  2155  // Kind implements Operation.Kind.
  2156  func (OperationV128ReplaceLane) Kind() OperationKind {
  2157  	return OperationKindV128ReplaceLane
  2158  }
  2159  
  2160  // OperationV128Splat implements Operation.
  2161  //
  2162  // This corresponds to
  2163  //
  2164  //	wasm.OpcodeVecI8x16SplatName wasm.OpcodeVecI16x8SplatName
  2165  //	wasm.OpcodeVecI32x4SplatName wasm.OpcodeVecI64x2SplatName
  2166  //	wasm.OpcodeVecF32x4SplatName wasm.OpcodeVecF64x2SplatName.
  2167  type OperationV128Splat struct {
  2168  	Shape Shape
  2169  }
  2170  
  2171  // Kind implements Operation.Kind.
  2172  func (OperationV128Splat) Kind() OperationKind {
  2173  	return OperationKindV128Splat
  2174  }
  2175  
  2176  // OperationV128Shuffle implements Operation.
  2177  type OperationV128Shuffle struct {
  2178  	Lanes [16]byte
  2179  }
  2180  
  2181  // Kind implements Operation.Kind.
  2182  //
  2183  // This corresponds to wasm.OpcodeVecV128i8x16ShuffleName.
  2184  func (OperationV128Shuffle) Kind() OperationKind {
  2185  	return OperationKindV128Shuffle
  2186  }
  2187  
  2188  // OperationV128Swizzle implements Operation.
  2189  type OperationV128Swizzle struct{}
  2190  
  2191  // Kind implements Operation.Kind.
  2192  //
  2193  // This corresponds to wasm.OpcodeVecI8x16SwizzleName.
  2194  func (OperationV128Swizzle) Kind() OperationKind {
  2195  	return OperationKindV128Swizzle
  2196  }
  2197  
  2198  // OperationV128AnyTrue implements Operation.
  2199  //
  2200  // This corresponds to wasm.OpcodeVecV128AnyTrueName.
  2201  type OperationV128AnyTrue struct{}
  2202  
  2203  // Kind implements Operation.Kind.
  2204  func (OperationV128AnyTrue) Kind() OperationKind {
  2205  	return OperationKindV128AnyTrue
  2206  }
  2207  
  2208  // OperationV128AllTrue implements Operation.
  2209  //
  2210  // This corresponds to
  2211  //
  2212  //	wasm.OpcodeVecI8x16AllTrueName wasm.OpcodeVecI16x8AllTrueName
  2213  //	wasm.OpcodeVecI32x4AllTrueName wasm.OpcodeVecI64x2AllTrueName.
  2214  type OperationV128AllTrue struct {
  2215  	Shape Shape
  2216  }
  2217  
  2218  // Kind implements Operation.Kind.
  2219  func (OperationV128AllTrue) Kind() OperationKind {
  2220  	return OperationKindV128AllTrue
  2221  }
  2222  
  2223  // OperationV128BitMask implements Operation.
  2224  //
  2225  // This corresponds to
  2226  //
  2227  //	wasm.OpcodeVecI8x16BitMaskName wasm.OpcodeVecI16x8BitMaskName
  2228  //	wasm.OpcodeVecI32x4BitMaskName wasm.OpcodeVecI64x2BitMaskName.
  2229  type OperationV128BitMask struct {
  2230  	Shape Shape
  2231  }
  2232  
  2233  // Kind implements Operation.Kind.
  2234  func (OperationV128BitMask) Kind() OperationKind {
  2235  	return OperationKindV128BitMask
  2236  }
  2237  
  2238  // OperationV128And implements Operation.
  2239  //
  2240  // This corresponds to wasm.OpcodeVecV128And.
  2241  type OperationV128And struct{}
  2242  
  2243  // Kind implements Operation.Kind.
  2244  func (OperationV128And) Kind() OperationKind {
  2245  	return OperationKindV128And
  2246  }
  2247  
  2248  // OperationV128Not implements Operation.
  2249  //
  2250  // This corresponds to wasm.OpcodeVecV128Not.
  2251  type OperationV128Not struct{}
  2252  
  2253  // Kind implements Operation.Kind.
  2254  func (OperationV128Not) Kind() OperationKind {
  2255  	return OperationKindV128Not
  2256  }
  2257  
  2258  // OperationV128Or implements Operation.
  2259  //
  2260  // This corresponds to wasm.OpcodeVecV128Or.
  2261  type OperationV128Or struct{}
  2262  
  2263  // Kind implements Operation.Kind.
  2264  func (OperationV128Or) Kind() OperationKind {
  2265  	return OperationKindV128Or
  2266  }
  2267  
  2268  // OperationV128Xor implements Operation.
  2269  //
  2270  // This corresponds to wasm.OpcodeVecV128Xor.
  2271  type OperationV128Xor struct{}
  2272  
  2273  // Kind implements Operation.Kind.
  2274  func (OperationV128Xor) Kind() OperationKind {
  2275  	return OperationKindV128Xor
  2276  }
  2277  
  2278  // OperationV128Bitselect implements Operation.
  2279  //
  2280  // This corresponds to wasm.OpcodeVecV128Bitselect.
  2281  type OperationV128Bitselect struct{}
  2282  
  2283  // Kind implements Operation.Kind.
  2284  func (OperationV128Bitselect) Kind() OperationKind {
  2285  	return OperationKindV128Bitselect
  2286  }
  2287  
  2288  // OperationV128AndNot implements Operation.
  2289  //
  2290  // This corresponds to wasm.OpcodeVecV128AndNot.
  2291  type OperationV128AndNot struct{}
  2292  
  2293  // Kind implements Operation.Kind.
  2294  func (OperationV128AndNot) Kind() OperationKind {
  2295  	return OperationKindV128AndNot
  2296  }
  2297  
  2298  // OperationV128Shl implements Operation.
  2299  //
  2300  // This corresponds to
  2301  //
  2302  //	wasm.OpcodeVecI8x16ShlName wasm.OpcodeVecI16x8ShlName
  2303  //	wasm.OpcodeVecI32x4ShlName wasm.OpcodeVecI64x2ShlName
  2304  type OperationV128Shl struct {
  2305  	Shape Shape
  2306  }
  2307  
  2308  // Kind implements Operation.Kind.
  2309  func (OperationV128Shl) Kind() OperationKind {
  2310  	return OperationKindV128Shl
  2311  }
  2312  
  2313  // OperationV128Shr implements Operation.
  2314  //
  2315  // This corresponds to
  2316  //
  2317  //	wasm.OpcodeVecI8x16ShrSName wasm.OpcodeVecI8x16ShrUName wasm.OpcodeVecI16x8ShrSName
  2318  //	wasm.OpcodeVecI16x8ShrUName wasm.OpcodeVecI32x4ShrSName wasm.OpcodeVecI32x4ShrUName.
  2319  //	wasm.OpcodeVecI64x2ShrSName wasm.OpcodeVecI64x2ShrUName.
  2320  type OperationV128Shr struct {
  2321  	Shape  Shape
  2322  	Signed bool
  2323  }
  2324  
  2325  // Kind implements Operation.Kind.
  2326  func (OperationV128Shr) Kind() OperationKind {
  2327  	return OperationKindV128Shr
  2328  }
  2329  
  2330  // OperationV128Cmp implements Operation.
  2331  //
  2332  // This corresponds to
  2333  //
  2334  //	wasm.OpcodeVecI8x16EqName, wasm.OpcodeVecI8x16NeName, wasm.OpcodeVecI8x16LtSName, wasm.OpcodeVecI8x16LtUName, wasm.OpcodeVecI8x16GtSName,
  2335  //	wasm.OpcodeVecI8x16GtUName, wasm.OpcodeVecI8x16LeSName, wasm.OpcodeVecI8x16LeUName, wasm.OpcodeVecI8x16GeSName, wasm.OpcodeVecI8x16GeUName,
  2336  //	wasm.OpcodeVecI16x8EqName, wasm.OpcodeVecI16x8NeName, wasm.OpcodeVecI16x8LtSName, wasm.OpcodeVecI16x8LtUName, wasm.OpcodeVecI16x8GtSName,
  2337  //	wasm.OpcodeVecI16x8GtUName, wasm.OpcodeVecI16x8LeSName, wasm.OpcodeVecI16x8LeUName, wasm.OpcodeVecI16x8GeSName, wasm.OpcodeVecI16x8GeUName,
  2338  //	wasm.OpcodeVecI32x4EqName, wasm.OpcodeVecI32x4NeName, wasm.OpcodeVecI32x4LtSName, wasm.OpcodeVecI32x4LtUName, wasm.OpcodeVecI32x4GtSName,
  2339  //	wasm.OpcodeVecI32x4GtUName, wasm.OpcodeVecI32x4LeSName, wasm.OpcodeVecI32x4LeUName, wasm.OpcodeVecI32x4GeSName, wasm.OpcodeVecI32x4GeUName,
  2340  //	wasm.OpcodeVecI64x2EqName, wasm.OpcodeVecI64x2NeName, wasm.OpcodeVecI64x2LtSName, wasm.OpcodeVecI64x2GtSName, wasm.OpcodeVecI64x2LeSName,
  2341  //	wasm.OpcodeVecI64x2GeSName, wasm.OpcodeVecF32x4EqName, wasm.OpcodeVecF32x4NeName, wasm.OpcodeVecF32x4LtName, wasm.OpcodeVecF32x4GtName,
  2342  //	wasm.OpcodeVecF32x4LeName, wasm.OpcodeVecF32x4GeName, wasm.OpcodeVecF64x2EqName, wasm.OpcodeVecF64x2NeName, wasm.OpcodeVecF64x2LtName,
  2343  //	wasm.OpcodeVecF64x2GtName, wasm.OpcodeVecF64x2LeName, wasm.OpcodeVecF64x2GeName
  2344  type OperationV128Cmp struct {
  2345  	Type V128CmpType
  2346  }
  2347  
  2348  // V128CmpType represents a type of vector comparison operation.
  2349  type V128CmpType = byte
  2350  
  2351  const (
  2352  	// V128CmpTypeI8x16Eq corresponds to wasm.OpcodeVecI8x16EqName.
  2353  	V128CmpTypeI8x16Eq V128CmpType = iota
  2354  	// V128CmpTypeI8x16Ne corresponds to wasm.OpcodeVecI8x16NeName.
  2355  	V128CmpTypeI8x16Ne
  2356  	// V128CmpTypeI8x16LtS corresponds to wasm.OpcodeVecI8x16LtSName.
  2357  	V128CmpTypeI8x16LtS
  2358  	// V128CmpTypeI8x16LtU corresponds to wasm.OpcodeVecI8x16LtUName.
  2359  	V128CmpTypeI8x16LtU
  2360  	// V128CmpTypeI8x16GtS corresponds to wasm.OpcodeVecI8x16GtSName.
  2361  	V128CmpTypeI8x16GtS
  2362  	// V128CmpTypeI8x16GtU corresponds to wasm.OpcodeVecI8x16GtUName.
  2363  	V128CmpTypeI8x16GtU
  2364  	// V128CmpTypeI8x16LeS corresponds to wasm.OpcodeVecI8x16LeSName.
  2365  	V128CmpTypeI8x16LeS
  2366  	// V128CmpTypeI8x16LeU corresponds to wasm.OpcodeVecI8x16LeUName.
  2367  	V128CmpTypeI8x16LeU
  2368  	// V128CmpTypeI8x16GeS corresponds to wasm.OpcodeVecI8x16GeSName.
  2369  	V128CmpTypeI8x16GeS
  2370  	// V128CmpTypeI8x16GeU corresponds to wasm.OpcodeVecI8x16GeUName.
  2371  	V128CmpTypeI8x16GeU
  2372  	// V128CmpTypeI16x8Eq corresponds to wasm.OpcodeVecI16x8EqName.
  2373  	V128CmpTypeI16x8Eq
  2374  	// V128CmpTypeI16x8Ne corresponds to wasm.OpcodeVecI16x8NeName.
  2375  	V128CmpTypeI16x8Ne
  2376  	// V128CmpTypeI16x8LtS corresponds to wasm.OpcodeVecI16x8LtSName.
  2377  	V128CmpTypeI16x8LtS
  2378  	// V128CmpTypeI16x8LtU corresponds to wasm.OpcodeVecI16x8LtUName.
  2379  	V128CmpTypeI16x8LtU
  2380  	// V128CmpTypeI16x8GtS corresponds to wasm.OpcodeVecI16x8GtSName.
  2381  	V128CmpTypeI16x8GtS
  2382  	// V128CmpTypeI16x8GtU corresponds to wasm.OpcodeVecI16x8GtUName.
  2383  	V128CmpTypeI16x8GtU
  2384  	// V128CmpTypeI16x8LeS corresponds to wasm.OpcodeVecI16x8LeSName.
  2385  	V128CmpTypeI16x8LeS
  2386  	// V128CmpTypeI16x8LeU corresponds to wasm.OpcodeVecI16x8LeUName.
  2387  	V128CmpTypeI16x8LeU
  2388  	// V128CmpTypeI16x8GeS corresponds to wasm.OpcodeVecI16x8GeSName.
  2389  	V128CmpTypeI16x8GeS
  2390  	// V128CmpTypeI16x8GeU corresponds to wasm.OpcodeVecI16x8GeUName.
  2391  	V128CmpTypeI16x8GeU
  2392  	// V128CmpTypeI32x4Eq corresponds to wasm.OpcodeVecI32x4EqName.
  2393  	V128CmpTypeI32x4Eq
  2394  	// V128CmpTypeI32x4Ne corresponds to wasm.OpcodeVecI32x4NeName.
  2395  	V128CmpTypeI32x4Ne
  2396  	// V128CmpTypeI32x4LtS corresponds to wasm.OpcodeVecI32x4LtSName.
  2397  	V128CmpTypeI32x4LtS
  2398  	// V128CmpTypeI32x4LtU corresponds to wasm.OpcodeVecI32x4LtUName.
  2399  	V128CmpTypeI32x4LtU
  2400  	// V128CmpTypeI32x4GtS corresponds to wasm.OpcodeVecI32x4GtSName.
  2401  	V128CmpTypeI32x4GtS
  2402  	// V128CmpTypeI32x4GtU corresponds to wasm.OpcodeVecI32x4GtUName.
  2403  	V128CmpTypeI32x4GtU
  2404  	// V128CmpTypeI32x4LeS corresponds to wasm.OpcodeVecI32x4LeSName.
  2405  	V128CmpTypeI32x4LeS
  2406  	// V128CmpTypeI32x4LeU corresponds to wasm.OpcodeVecI32x4LeUName.
  2407  	V128CmpTypeI32x4LeU
  2408  	// V128CmpTypeI32x4GeS corresponds to wasm.OpcodeVecI32x4GeSName.
  2409  	V128CmpTypeI32x4GeS
  2410  	// V128CmpTypeI32x4GeU corresponds to wasm.OpcodeVecI32x4GeUName.
  2411  	V128CmpTypeI32x4GeU
  2412  	// V128CmpTypeI64x2Eq corresponds to wasm.OpcodeVecI64x2EqName.
  2413  	V128CmpTypeI64x2Eq
  2414  	// V128CmpTypeI64x2Ne corresponds to wasm.OpcodeVecI64x2NeName.
  2415  	V128CmpTypeI64x2Ne
  2416  	// V128CmpTypeI64x2LtS corresponds to wasm.OpcodeVecI64x2LtSName.
  2417  	V128CmpTypeI64x2LtS
  2418  	// V128CmpTypeI64x2GtS corresponds to wasm.OpcodeVecI64x2GtSName.
  2419  	V128CmpTypeI64x2GtS
  2420  	// V128CmpTypeI64x2LeS corresponds to wasm.OpcodeVecI64x2LeSName.
  2421  	V128CmpTypeI64x2LeS
  2422  	// V128CmpTypeI64x2GeS corresponds to wasm.OpcodeVecI64x2GeSName.
  2423  	V128CmpTypeI64x2GeS
  2424  	// V128CmpTypeF32x4Eq corresponds to wasm.OpcodeVecF32x4EqName.
  2425  	V128CmpTypeF32x4Eq
  2426  	// V128CmpTypeF32x4Ne corresponds to wasm.OpcodeVecF32x4NeName.
  2427  	V128CmpTypeF32x4Ne
  2428  	// V128CmpTypeF32x4Lt corresponds to wasm.OpcodeVecF32x4LtName.
  2429  	V128CmpTypeF32x4Lt
  2430  	// V128CmpTypeF32x4Gt corresponds to wasm.OpcodeVecF32x4GtName.
  2431  	V128CmpTypeF32x4Gt
  2432  	// V128CmpTypeF32x4Le corresponds to wasm.OpcodeVecF32x4LeName.
  2433  	V128CmpTypeF32x4Le
  2434  	// V128CmpTypeF32x4Ge corresponds to wasm.OpcodeVecF32x4GeName.
  2435  	V128CmpTypeF32x4Ge
  2436  	// V128CmpTypeF64x2Eq corresponds to wasm.OpcodeVecF64x2EqName.
  2437  	V128CmpTypeF64x2Eq
  2438  	// V128CmpTypeF64x2Ne corresponds to wasm.OpcodeVecF64x2NeName.
  2439  	V128CmpTypeF64x2Ne
  2440  	// V128CmpTypeF64x2Lt corresponds to wasm.OpcodeVecF64x2LtName.
  2441  	V128CmpTypeF64x2Lt
  2442  	// V128CmpTypeF64x2Gt corresponds to wasm.OpcodeVecF64x2GtName.
  2443  	V128CmpTypeF64x2Gt
  2444  	// V128CmpTypeF64x2Le corresponds to wasm.OpcodeVecF64x2LeName.
  2445  	V128CmpTypeF64x2Le
  2446  	// V128CmpTypeF64x2Ge corresponds to wasm.OpcodeVecF64x2GeName.
  2447  	V128CmpTypeF64x2Ge
  2448  )
  2449  
  2450  // Kind implements Operation.Kind.
  2451  func (OperationV128Cmp) Kind() OperationKind {
  2452  	return OperationKindV128Cmp
  2453  }
  2454  
  2455  // OperationV128AddSat implements Operation.
  2456  //
  2457  // This corresponds to wasm.OpcodeVecI8x16AddSatUName wasm.OpcodeVecI8x16AddSatSName
  2458  //
  2459  //	wasm.OpcodeVecI16x8AddSatUName wasm.OpcodeVecI16x8AddSatSName
  2460  type OperationV128AddSat struct {
  2461  	// Shape is either ShapeI8x16 or ShapeI16x8.
  2462  	Shape  Shape
  2463  	Signed bool
  2464  }
  2465  
  2466  // Kind implements Operation.Kind.
  2467  func (OperationV128AddSat) Kind() OperationKind {
  2468  	return OperationKindV128AddSat
  2469  }
  2470  
  2471  // OperationV128SubSat implements Operation.
  2472  //
  2473  // This corresponds to wasm.OpcodeVecI8x16SubSatUName wasm.OpcodeVecI8x16SubSatSName
  2474  //
  2475  //	wasm.OpcodeVecI16x8SubSatUName wasm.OpcodeVecI16x8SubSatSName
  2476  type OperationV128SubSat struct {
  2477  	// Shape is either ShapeI8x16 or ShapeI16x8.
  2478  	Shape  Shape
  2479  	Signed bool
  2480  }
  2481  
  2482  // Kind implements Operation.Kind.
  2483  func (OperationV128SubSat) Kind() OperationKind {
  2484  	return OperationKindV128SubSat
  2485  }
  2486  
  2487  // OperationV128Mul implements Operation.
  2488  //
  2489  // This corresponds to wasm.OpcodeVecF32x4MulName wasm.OpcodeVecF64x2MulName
  2490  //
  2491  //	wasm.OpcodeVecI16x8MulName wasm.OpcodeVecI32x4MulName wasm.OpcodeVecI64x2MulName.
  2492  type OperationV128Mul struct {
  2493  	// Shape is either ShapeI16x8, ShapeI32x4, ShapeI64x2, ShapeF32x4 or ShapeF64x2.
  2494  	Shape Shape
  2495  }
  2496  
  2497  // Kind implements Operation.Kind.
  2498  func (OperationV128Mul) Kind() OperationKind {
  2499  	return OperationKindV128Mul
  2500  }
  2501  
  2502  // OperationV128Div implements Operation.
  2503  //
  2504  // This corresponds to wasm.OpcodeVecF32x4DivName wasm.OpcodeVecF64x2DivName.
  2505  type OperationV128Div struct {
  2506  	// Shape is either ShapeF32x4 or ShapeF64x2.
  2507  	Shape Shape
  2508  }
  2509  
  2510  // Kind implements Operation.Kind.
  2511  func (OperationV128Div) Kind() OperationKind {
  2512  	return OperationKindV128Div
  2513  }
  2514  
  2515  // OperationV128Neg implements Operation.
  2516  //
  2517  // This corresponds to wasm.OpcodeVecI8x16NegName wasm.OpcodeVecI16x8NegName wasm.OpcodeVecI32x4NegName
  2518  //
  2519  //	wasm.OpcodeVecI64x2NegName wasm.OpcodeVecF32x4NegName wasm.OpcodeVecF64x2NegName.
  2520  type OperationV128Neg struct {
  2521  	Shape Shape
  2522  }
  2523  
  2524  // Kind implements Operation.Kind.
  2525  func (OperationV128Neg) Kind() OperationKind {
  2526  	return OperationKindV128Neg
  2527  }
  2528  
  2529  // OperationV128Sqrt implements Operation.
  2530  //
  2531  // This corresponds to wasm.OpcodeVecF32x4SqrtName wasm.OpcodeVecF64x2SqrtName.
  2532  type OperationV128Sqrt struct {
  2533  	// Shape is either ShapeF32x4 or ShapeF64x2.
  2534  	Shape Shape
  2535  }
  2536  
  2537  // Kind implements Operation.Kind.
  2538  func (OperationV128Sqrt) Kind() OperationKind {
  2539  	return OperationKindV128Sqrt
  2540  }
  2541  
  2542  // OperationV128Abs implements Operation.
  2543  //
  2544  // This corresponds to wasm.OpcodeVecI8x16AbsName wasm.OpcodeVecI16x8AbsName wasm.OpcodeVecI32x4AbsName
  2545  //
  2546  //	wasm.OpcodeVecI64x2AbsName wasm.OpcodeVecF32x4AbsName wasm.OpcodeVecF64x2AbsName.
  2547  type OperationV128Abs struct {
  2548  	Shape Shape
  2549  }
  2550  
  2551  // Kind implements Operation.Kind.
  2552  func (OperationV128Abs) Kind() OperationKind {
  2553  	return OperationKindV128Abs
  2554  }
  2555  
  2556  // OperationV128Popcnt implements Operation.
  2557  //
  2558  // This corresponds to wasm.OpcodeVecI8x16PopcntName.
  2559  type OperationV128Popcnt struct {
  2560  	Shape Shape
  2561  }
  2562  
  2563  // Kind implements Operation.Kind.
  2564  func (OperationV128Popcnt) Kind() OperationKind {
  2565  	return OperationKindV128Popcnt
  2566  }
  2567  
  2568  // OperationV128Min implements Operation.
  2569  //
  2570  // This corresponds to
  2571  //
  2572  //	wasm.OpcodeVecI8x16MinSName wasm.OpcodeVecI8x16MinUName wasm.OpcodeVecI16x8MinSName wasm.OpcodeVecI16x8MinUName
  2573  //	wasm.OpcodeVecI32x4MinSName wasm.OpcodeVecI32x4MinUName wasm.OpcodeVecI16x8MinSName wasm.OpcodeVecI16x8MinUName
  2574  //	wasm.OpcodeVecF32x4MinName wasm.OpcodeVecF64x2MinName
  2575  type OperationV128Min struct {
  2576  	Shape  Shape
  2577  	Signed bool
  2578  }
  2579  
  2580  // Kind implements Operation.Kind.
  2581  func (OperationV128Min) Kind() OperationKind {
  2582  	return OperationKindV128Min
  2583  }
  2584  
  2585  // OperationV128Max implements Operation.
  2586  //
  2587  // This corresponds to
  2588  //
  2589  //	wasm.OpcodeVecI8x16MaxSName wasm.OpcodeVecI8x16MaxUName wasm.OpcodeVecI16x8MaxSName wasm.OpcodeVecI16x8MaxUName
  2590  //	wasm.OpcodeVecI32x4MaxSName wasm.OpcodeVecI32x4MaxUName wasm.OpcodeVecI16x8MaxSName wasm.OpcodeVecI16x8MaxUName
  2591  //	wasm.OpcodeVecF32x4MaxName wasm.OpcodeVecF64x2MaxName.
  2592  type OperationV128Max struct {
  2593  	Shape  Shape
  2594  	Signed bool
  2595  }
  2596  
  2597  // Kind implements Operation.Kind.
  2598  func (OperationV128Max) Kind() OperationKind {
  2599  	return OperationKindV128Max
  2600  }
  2601  
  2602  // OperationV128AvgrU implements Operation.
  2603  //
  2604  // This corresponds to wasm.OpcodeVecI8x16AvgrUName.
  2605  type OperationV128AvgrU struct {
  2606  	Shape Shape
  2607  }
  2608  
  2609  // Kind implements Operation.Kind.
  2610  func (OperationV128AvgrU) Kind() OperationKind {
  2611  	return OperationKindV128AvgrU
  2612  }
  2613  
  2614  // OperationV128Pmin implements Operation.
  2615  //
  2616  // This corresponds to wasm.OpcodeVecF32x4PminName wasm.OpcodeVecF64x2PminName.
  2617  type OperationV128Pmin struct{ Shape Shape }
  2618  
  2619  // Kind implements Operation.Kind
  2620  func (OperationV128Pmin) Kind() OperationKind {
  2621  	return OperationKindV128Pmin
  2622  }
  2623  
  2624  // OperationV128Pmax implements Operation.
  2625  //
  2626  // This corresponds to wasm.OpcodeVecF32x4PmaxName wasm.OpcodeVecF64x2PmaxName.
  2627  type OperationV128Pmax struct{ Shape Shape }
  2628  
  2629  // Kind implements Operation.Kind
  2630  func (OperationV128Pmax) Kind() OperationKind {
  2631  	return OperationKindV128Pmax
  2632  }
  2633  
  2634  // OperationV128Ceil implements Operation.
  2635  //
  2636  // This corresponds to wasm.OpcodeVecF32x4CeilName wasm.OpcodeVecF64x2CeilName
  2637  type OperationV128Ceil struct{ Shape Shape }
  2638  
  2639  // Kind implements Operation.Kind
  2640  func (OperationV128Ceil) Kind() OperationKind {
  2641  	return OperationKindV128Ceil
  2642  }
  2643  
  2644  // OperationV128Floor implements Operation.
  2645  //
  2646  // This corresponds to wasm.OpcodeVecF32x4FloorName wasm.OpcodeVecF64x2FloorName
  2647  type OperationV128Floor struct{ Shape Shape }
  2648  
  2649  // Kind implements Operation.Kind
  2650  func (OperationV128Floor) Kind() OperationKind {
  2651  	return OperationKindV128Floor
  2652  }
  2653  
  2654  // OperationV128Trunc implements Operation.
  2655  //
  2656  // This corresponds to wasm.OpcodeVecF32x4TruncName wasm.OpcodeVecF64x2TruncName
  2657  type OperationV128Trunc struct{ Shape Shape }
  2658  
  2659  // Kind implements Operation.Kind
  2660  func (OperationV128Trunc) Kind() OperationKind {
  2661  	return OperationKindV128Trunc
  2662  }
  2663  
  2664  // OperationV128Nearest implements Operation.
  2665  //
  2666  // This corresponds to wasm.OpcodeVecF32x4NearestName wasm.OpcodeVecF64x2NearestName
  2667  type OperationV128Nearest struct{ Shape Shape }
  2668  
  2669  // Kind implements Operation.Kind
  2670  func (OperationV128Nearest) Kind() OperationKind {
  2671  	return OperationKindV128Nearest
  2672  }
  2673  
  2674  // OperationV128Extend implements Operation
  2675  //
  2676  // This corresponds to
  2677  //
  2678  //	wasm.OpcodeVecI16x8ExtendLowI8x16SName wasm.OpcodeVecI16x8ExtendHighI8x16SName
  2679  //	wasm.OpcodeVecI16x8ExtendLowI8x16UName wasm.OpcodeVecI16x8ExtendHighI8x16UName
  2680  //	wasm.OpcodeVecI32x4ExtendLowI16x8SName wasm.OpcodeVecI32x4ExtendHighI16x8SName
  2681  //	wasm.OpcodeVecI32x4ExtendLowI16x8UName wasm.OpcodeVecI32x4ExtendHighI16x8UName
  2682  //	wasm.OpcodeVecI64x2ExtendLowI32x4SName wasm.OpcodeVecI64x2ExtendHighI32x4SName
  2683  //	wasm.OpcodeVecI64x2ExtendLowI32x4UName wasm.OpcodeVecI64x2ExtendHighI32x4UName
  2684  type OperationV128Extend struct {
  2685  	// OriginShape is the shape of the original lanes for extension which is
  2686  	// either ShapeI8x16, ShapeI16x8, or ShapeI32x4.
  2687  	OriginShape Shape
  2688  	Signed      bool
  2689  	// UseLow true if it uses the lower half of vector for extension.
  2690  	UseLow bool
  2691  }
  2692  
  2693  // Kind implements Operation.Kind
  2694  func (OperationV128Extend) Kind() OperationKind {
  2695  	return OperationKindV128Extend
  2696  }
  2697  
  2698  // OperationV128ExtMul implements Operation
  2699  //
  2700  // This corresponds to
  2701  //
  2702  //		wasm.OpcodeVecI16x8ExtMulLowI8x16SName wasm.OpcodeVecI16x8ExtMulLowI8x16UName
  2703  //		wasm.OpcodeVecI16x8ExtMulHighI8x16SName wasm.OpcodeVecI16x8ExtMulHighI8x16UName
  2704  //	 wasm.OpcodeVecI32x4ExtMulLowI16x8SName wasm.OpcodeVecI32x4ExtMulLowI16x8UName
  2705  //		wasm.OpcodeVecI32x4ExtMulHighI16x8SName wasm.OpcodeVecI32x4ExtMulHighI16x8UName
  2706  //	 wasm.OpcodeVecI64x2ExtMulLowI32x4SName wasm.OpcodeVecI64x2ExtMulLowI32x4UName
  2707  //		wasm.OpcodeVecI64x2ExtMulHighI32x4SName wasm.OpcodeVecI64x2ExtMulHighI32x4UName.
  2708  type OperationV128ExtMul struct {
  2709  	// OriginShape is the shape of the original lanes for extension which is
  2710  	// either ShapeI8x16, ShapeI16x8, or ShapeI32x4.
  2711  	OriginShape Shape
  2712  	Signed      bool
  2713  	// UseLow true if it uses the lower half of vector for extension.
  2714  	UseLow bool
  2715  }
  2716  
  2717  // Kind implements Operation.Kind
  2718  func (OperationV128ExtMul) Kind() OperationKind {
  2719  	return OperationKindV128ExtMul
  2720  }
  2721  
  2722  // OperationV128Q15mulrSatS implements Operation
  2723  //
  2724  // This corresponds to wasm.OpcodeVecI16x8Q15mulrSatSName
  2725  type OperationV128Q15mulrSatS struct{}
  2726  
  2727  // Kind implements Operation.Kind
  2728  func (OperationV128Q15mulrSatS) Kind() OperationKind {
  2729  	return OperationKindV128Q15mulrSatS
  2730  }
  2731  
  2732  // OperationV128ExtAddPairwise implements Operation.
  2733  //
  2734  // This corresponds to
  2735  //
  2736  //	wasm.OpcodeVecI16x8ExtaddPairwiseI8x16SName wasm.OpcodeVecI16x8ExtaddPairwiseI8x16UName
  2737  //	wasm.OpcodeVecI32x4ExtaddPairwiseI16x8SName wasm.OpcodeVecI32x4ExtaddPairwiseI16x8UName.
  2738  type OperationV128ExtAddPairwise struct {
  2739  	// OriginShape is the shape of the original lanes for extension which is
  2740  	// either ShapeI8x16, or ShapeI16x8.
  2741  	OriginShape Shape
  2742  	Signed      bool
  2743  }
  2744  
  2745  // Kind implements Operation.Kind.
  2746  func (OperationV128ExtAddPairwise) Kind() OperationKind {
  2747  	return OperationKindV128ExtAddPairwise
  2748  }
  2749  
  2750  // OperationV128FloatPromote implements Operation.
  2751  //
  2752  // This corresponds to wasm.OpcodeVecF64x2PromoteLowF32x4ZeroName
  2753  // This discards the higher 64-bit of a vector, and promotes two
  2754  // 32-bit floats in the lower 64-bit as two 64-bit floats.
  2755  type OperationV128FloatPromote struct{}
  2756  
  2757  // Kind implements Operation.Kind.
  2758  func (OperationV128FloatPromote) Kind() OperationKind {
  2759  	return OperationKindV128FloatPromote
  2760  }
  2761  
  2762  // OperationV128FloatDemote implements Operation.
  2763  //
  2764  // This corresponds to wasm.OpcodeVecF32x4DemoteF64x2ZeroName.
  2765  type OperationV128FloatDemote struct{}
  2766  
  2767  // Kind implements Operation.Kind.
  2768  func (OperationV128FloatDemote) Kind() OperationKind {
  2769  	return OperationKindV128FloatDemote
  2770  }
  2771  
  2772  // OperationV128FConvertFromI implements Operation.
  2773  //
  2774  // This corresponds to
  2775  //
  2776  //	wasm.OpcodeVecF32x4ConvertI32x4SName wasm.OpcodeVecF32x4ConvertI32x4UName
  2777  //	wasm.OpcodeVecF64x2ConvertLowI32x4SName wasm.OpcodeVecF64x2ConvertLowI32x4UName.
  2778  type OperationV128FConvertFromI struct {
  2779  	// DestinationShape is the shape of the destination lanes for conversion which is
  2780  	// either ShapeF32x4, or ShapeF64x2.
  2781  	DestinationShape Shape
  2782  	Signed           bool
  2783  }
  2784  
  2785  // Kind implements Operation.Kind.
  2786  func (OperationV128FConvertFromI) Kind() OperationKind {
  2787  	return OperationKindV128FConvertFromI
  2788  }
  2789  
  2790  // OperationV128Dot implements Operation.
  2791  //
  2792  // This corresponds to wasm.OpcodeVecI32x4DotI16x8SName
  2793  type OperationV128Dot struct{}
  2794  
  2795  // Kind implements Operation.Kind.
  2796  func (OperationV128Dot) Kind() OperationKind {
  2797  	return OperationKindV128Dot
  2798  }
  2799  
  2800  // OperationV128Narrow implements Operation.
  2801  //
  2802  // This corresponds to
  2803  //
  2804  //	wasm.OpcodeVecI8x16NarrowI16x8SName wasm.OpcodeVecI8x16NarrowI16x8UName
  2805  //	wasm.OpcodeVecI16x8NarrowI32x4SName wasm.OpcodeVecI16x8NarrowI32x4UName.
  2806  type OperationV128Narrow struct {
  2807  	// OriginShape is the shape of the original lanes for narrowing which is
  2808  	// either ShapeI16x8, or ShapeI32x4.
  2809  	OriginShape Shape
  2810  	Signed      bool
  2811  }
  2812  
  2813  // Kind implements Operation.Kind.
  2814  func (OperationV128Narrow) Kind() OperationKind {
  2815  	return OperationKindV128Narrow
  2816  }
  2817  
  2818  // OperationV128ITruncSatFromF implements Operation.
  2819  //
  2820  // This corresponds to
  2821  //
  2822  //	wasm.OpcodeVecI32x4TruncSatF64x2UZeroName wasm.OpcodeVecI32x4TruncSatF64x2SZeroName
  2823  //	wasm.OpcodeVecI32x4TruncSatF32x4UName wasm.OpcodeVecI32x4TruncSatF32x4SName.
  2824  type OperationV128ITruncSatFromF struct {
  2825  	// OriginShape is the shape of the original lanes for truncation which is
  2826  	// either ShapeF32x4, or ShapeF64x2.
  2827  	OriginShape Shape
  2828  	Signed      bool
  2829  }
  2830  
  2831  // Kind implements Operation.Kind.
  2832  func (OperationV128ITruncSatFromF) Kind() OperationKind {
  2833  	return OperationKindV128ITruncSatFromF
  2834  }