#[repr(u8)]pub enum Opcode {
Show 221 variants
Nop = 0,
Ret = 1,
Call = 2,
Call1 = 3,
Call2 = 4,
Call3 = 5,
Call4 = 6,
CallIndirect = 7,
Jump = 8,
XJump = 9,
BrIf = 10,
BrIfNot = 11,
BrIfXeq32 = 12,
BrIfXneq32 = 13,
BrIfXslt32 = 14,
BrIfXslteq32 = 15,
BrIfXult32 = 16,
BrIfXulteq32 = 17,
BrIfXeq64 = 18,
BrIfXneq64 = 19,
BrIfXslt64 = 20,
BrIfXslteq64 = 21,
BrIfXult64 = 22,
BrIfXulteq64 = 23,
BrIfXeq32I8 = 24,
BrIfXeq32I32 = 25,
BrIfXneq32I8 = 26,
BrIfXneq32I32 = 27,
BrIfXslt32I8 = 28,
BrIfXslt32I32 = 29,
BrIfXsgt32I8 = 30,
BrIfXsgt32I32 = 31,
BrIfXslteq32I8 = 32,
BrIfXslteq32I32 = 33,
BrIfXsgteq32I8 = 34,
BrIfXsgteq32I32 = 35,
BrIfXult32U8 = 36,
BrIfXult32U32 = 37,
BrIfXulteq32U8 = 38,
BrIfXulteq32U32 = 39,
BrIfXugt32U8 = 40,
BrIfXugt32U32 = 41,
BrIfXugteq32U8 = 42,
BrIfXugteq32U32 = 43,
BrIfXeq64I8 = 44,
BrIfXeq64I32 = 45,
BrIfXneq64I8 = 46,
BrIfXneq64I32 = 47,
BrIfXslt64I8 = 48,
BrIfXslt64I32 = 49,
BrIfXsgt64I8 = 50,
BrIfXsgt64I32 = 51,
BrIfXslteq64I8 = 52,
BrIfXslteq64I32 = 53,
BrIfXsgteq64I8 = 54,
BrIfXsgteq64I32 = 55,
BrIfXult64U8 = 56,
BrIfXult64U32 = 57,
BrIfXulteq64U8 = 58,
BrIfXulteq64U32 = 59,
BrIfXugt64U8 = 60,
BrIfXugt64U32 = 61,
BrIfXugteq64U8 = 62,
BrIfXugteq64U32 = 63,
BrTable32 = 64,
Xmov = 65,
Xzero = 66,
Xone = 67,
Xconst8 = 68,
Xconst16 = 69,
Xconst32 = 70,
Xconst64 = 71,
Xadd32 = 72,
Xadd32U8 = 73,
Xadd32U32 = 74,
Xadd64 = 75,
Xadd64U8 = 76,
Xadd64U32 = 77,
Xmadd32 = 78,
Xmadd64 = 79,
Xsub32 = 80,
Xsub32U8 = 81,
Xsub32U32 = 82,
Xsub64 = 83,
Xsub64U8 = 84,
Xsub64U32 = 85,
XMul32 = 86,
Xmul32S8 = 87,
Xmul32S32 = 88,
XMul64 = 89,
Xmul64S8 = 90,
Xmul64S32 = 91,
Xctz32 = 92,
Xctz64 = 93,
Xclz32 = 94,
Xclz64 = 95,
Xpopcnt32 = 96,
Xpopcnt64 = 97,
Xrotl32 = 98,
Xrotl64 = 99,
Xrotr32 = 100,
Xrotr64 = 101,
Xshl32 = 102,
Xshr32S = 103,
Xshr32U = 104,
Xshl64 = 105,
Xshr64S = 106,
Xshr64U = 107,
Xshl32U6 = 108,
Xshr32SU6 = 109,
Xshr32UU6 = 110,
Xshl64U6 = 111,
Xshr64SU6 = 112,
Xshr64UU6 = 113,
Xneg32 = 114,
Xneg64 = 115,
Xeq64 = 116,
Xneq64 = 117,
Xslt64 = 118,
Xslteq64 = 119,
Xult64 = 120,
Xulteq64 = 121,
Xeq32 = 122,
Xneq32 = 123,
Xslt32 = 124,
Xslteq32 = 125,
Xult32 = 126,
Xulteq32 = 127,
XLoad8U32O32 = 128,
XLoad8S32O32 = 129,
XLoad16LeU32O32 = 130,
XLoad16LeS32O32 = 131,
XLoad32LeO32 = 132,
XLoad64LeO32 = 133,
XStore8O32 = 134,
XStore16LeO32 = 135,
XStore32LeO32 = 136,
XStore64LeO32 = 137,
XLoad8U32Z = 138,
XLoad8S32Z = 139,
XLoad16LeU32Z = 140,
XLoad16LeS32Z = 141,
XLoad32LeZ = 142,
XLoad64LeZ = 143,
XStore8Z = 144,
XStore16LeZ = 145,
XStore32LeZ = 146,
XStore64LeZ = 147,
XLoad8U32G32 = 148,
XLoad8S32G32 = 149,
XLoad16LeU32G32 = 150,
XLoad16LeS32G32 = 151,
XLoad32LeG32 = 152,
XLoad64LeG32 = 153,
XStore8G32 = 154,
XStore16LeG32 = 155,
XStore32LeG32 = 156,
XStore64LeG32 = 157,
XLoad8U32G32Bne = 158,
XLoad8S32G32Bne = 159,
XLoad16LeU32G32Bne = 160,
XLoad16LeS32G32Bne = 161,
XLoad32LeG32Bne = 162,
XLoad64LeG32Bne = 163,
XStore8G32Bne = 164,
XStore16LeG32Bne = 165,
XStore32LeG32Bne = 166,
XStore64LeG32Bne = 167,
PushFrame = 168,
PopFrame = 169,
PushFrameSave = 170,
PopFrameRestore = 171,
StackAlloc32 = 172,
StackFree32 = 173,
Zext8 = 174,
Zext16 = 175,
Zext32 = 176,
Sext8 = 177,
Sext16 = 178,
Sext32 = 179,
XAbs32 = 180,
XAbs64 = 181,
XDiv32S = 182,
XDiv64S = 183,
XDiv32U = 184,
XDiv64U = 185,
XRem32S = 186,
XRem64S = 187,
XRem32U = 188,
XRem64U = 189,
XBand32 = 190,
Xband32S8 = 191,
Xband32S32 = 192,
XBand64 = 193,
Xband64S8 = 194,
Xband64S32 = 195,
XBor32 = 196,
Xbor32S8 = 197,
Xbor32S32 = 198,
XBor64 = 199,
Xbor64S8 = 200,
Xbor64S32 = 201,
XBxor32 = 202,
Xbxor32S8 = 203,
Xbxor32S32 = 204,
XBxor64 = 205,
Xbxor64S8 = 206,
Xbxor64S32 = 207,
XBnot32 = 208,
XBnot64 = 209,
Xmin32U = 210,
Xmin32S = 211,
Xmax32U = 212,
Xmax32S = 213,
Xmin64U = 214,
Xmin64S = 215,
Xmax64U = 216,
Xmax64S = 217,
XSelect32 = 218,
XSelect64 = 219,
ExtendedOp = 220,
}Expand description
An opcode without its immediates and operands.
Variants§
Nop = 0
No-operation.
Ret = 1
Transfer control the address in the lr register.
Call = 2
Transfer control to the PC at the given offset and set the lr
register to the PC just after this instruction.
This instruction generally assumes that the Pulley ABI is being respected where arguments are in argument registers (starting at x0 for integer arguments) and results are in result registers. This instruction itself assume that all arguments are already in their registers. Subsequent instructions below enable moving arguments into the correct registers as part of the same call instruction.
Call1 = 3
Like call, but also x0 = arg1
Call2 = 4
Like call, but also x0, x1 = arg1, arg2
Call3 = 5
Like call, but also x0, x1, x2 = arg1, arg2, arg3
Call4 = 6
Like call, but also x0, x1, x2, x3 = arg1, arg2, arg3, arg4
CallIndirect = 7
Transfer control to the PC in reg and set lr to the PC just
after this instruction.
Jump = 8
Unconditionally transfer control to the PC at the given offset.
XJump = 9
Unconditionally transfer control to the PC at specified register.
BrIf = 10
Conditionally transfer control to the given PC offset if
low32(cond) contains a non-zero value.
BrIfNot = 11
Conditionally transfer control to the given PC offset if
low32(cond) contains a zero value.
BrIfXeq32 = 12
Branch if a == b.
BrIfXneq32 = 13
Branch if a != b.
BrIfXslt32 = 14
Branch if signed a < b.
BrIfXslteq32 = 15
Branch if signed a <= b.
BrIfXult32 = 16
Branch if unsigned a < b.
BrIfXulteq32 = 17
Branch if unsigned a <= b.
BrIfXeq64 = 18
Branch if a == b.
BrIfXneq64 = 19
Branch if a != b.
BrIfXslt64 = 20
Branch if signed a < b.
BrIfXslteq64 = 21
Branch if signed a <= b.
BrIfXult64 = 22
Branch if unsigned a < b.
BrIfXulteq64 = 23
Branch if unsigned a <= b.
BrIfXeq32I8 = 24
Branch if a == b.
BrIfXeq32I32 = 25
Branch if a == b.
BrIfXneq32I8 = 26
Branch if a != b.
BrIfXneq32I32 = 27
Branch if a != b.
BrIfXslt32I8 = 28
Branch if signed a < b.
BrIfXslt32I32 = 29
Branch if signed a < b.
BrIfXsgt32I8 = 30
Branch if signed a > b.
BrIfXsgt32I32 = 31
Branch if signed a > b.
BrIfXslteq32I8 = 32
Branch if signed a <= b.
BrIfXslteq32I32 = 33
Branch if signed a <= b.
BrIfXsgteq32I8 = 34
Branch if signed a >= b.
BrIfXsgteq32I32 = 35
Branch if signed a >= b.
BrIfXult32U8 = 36
Branch if unsigned a < b.
BrIfXult32U32 = 37
Branch if unsigned a < b.
BrIfXulteq32U8 = 38
Branch if unsigned a <= b.
BrIfXulteq32U32 = 39
Branch if unsigned a <= b.
BrIfXugt32U8 = 40
Branch if unsigned a > b.
BrIfXugt32U32 = 41
Branch if unsigned a > b.
BrIfXugteq32U8 = 42
Branch if unsigned a >= b.
BrIfXugteq32U32 = 43
Branch if unsigned a >= b.
BrIfXeq64I8 = 44
Branch if a == b.
BrIfXeq64I32 = 45
Branch if a == b.
BrIfXneq64I8 = 46
Branch if a != b.
BrIfXneq64I32 = 47
Branch if a != b.
BrIfXslt64I8 = 48
Branch if signed a < b.
BrIfXslt64I32 = 49
Branch if signed a < b.
BrIfXsgt64I8 = 50
Branch if signed a > b.
BrIfXsgt64I32 = 51
Branch if signed a > b.
BrIfXslteq64I8 = 52
Branch if signed a <= b.
BrIfXslteq64I32 = 53
Branch if signed a <= b.
BrIfXsgteq64I8 = 54
Branch if signed a >= b.
BrIfXsgteq64I32 = 55
Branch if signed a >= b.
BrIfXult64U8 = 56
Branch if unsigned a < b.
BrIfXult64U32 = 57
Branch if unsigned a < b.
BrIfXulteq64U8 = 58
Branch if unsigned a <= b.
BrIfXulteq64U32 = 59
Branch if unsigned a <= b.
BrIfXugt64U8 = 60
Branch if unsigned a > b.
BrIfXugt64U32 = 61
Branch if unsigned a > b.
BrIfXugteq64U8 = 62
Branch if unsigned a >= b.
BrIfXugteq64U32 = 63
Branch if unsigned a >= b.
BrTable32 = 64
Branch to the label indicated by low32(idx).
After this instruction are amt instances of PcRelOffset
and the idx selects which one will be branched to. The value
of idx is clamped to amt - 1 (e.g. the last offset is the
“default” one.
Xmov = 65
Move between x registers.
Xzero = 66
Set dst = 0
Xone = 67
Set dst = 1
Xconst8 = 68
Set dst = sign_extend(imm8).
Xconst16 = 69
Set dst = sign_extend(imm16).
Xconst32 = 70
Set dst = sign_extend(imm32).
Xconst64 = 71
Set dst = imm64.
Xadd32 = 72
32-bit wrapping addition: low32(dst) = low32(src1) + low32(src2).
The upper 32-bits of dst are unmodified.
Xadd32U8 = 73
Same as xadd32 but src2 is a zero-extended 8-bit immediate.
Xadd32U32 = 74
Same as xadd32 but src2 is a 32-bit immediate.
Xadd64 = 75
64-bit wrapping addition: dst = src1 + src2.
Xadd64U8 = 76
Same as xadd64 but src2 is a zero-extended 8-bit immediate.
Xadd64U32 = 77
Same as xadd64 but src2 is a zero-extended 32-bit immediate.
Xmadd32 = 78
low32(dst) = low32(src1) * low32(src2) + low32(src3)
Xmadd64 = 79
dst = src1 * src2 + src3
Xsub32 = 80
32-bit wrapping subtraction: low32(dst) = low32(src1) - low32(src2).
The upper 32-bits of dst are unmodified.
Xsub32U8 = 81
Same as xsub32 but src2 is a zero-extended 8-bit immediate.
Xsub32U32 = 82
Same as xsub32 but src2 is a 32-bit immediate.
Xsub64 = 83
64-bit wrapping subtraction: dst = src1 - src2.
Xsub64U8 = 84
Same as xsub64 but src2 is a zero-extended 8-bit immediate.
Xsub64U32 = 85
Same as xsub64 but src2 is a zero-extended 32-bit immediate.
XMul32 = 86
low32(dst) = low32(src1) * low32(src2)
Xmul32S8 = 87
Same as xmul64 but src2 is a sign-extended 8-bit immediate.
Xmul32S32 = 88
Same as xmul32 but src2 is a sign-extended 32-bit immediate.
XMul64 = 89
dst = src1 * src2
Xmul64S8 = 90
Same as xmul64 but src2 is a sign-extended 8-bit immediate.
Xmul64S32 = 91
Same as xmul64 but src2 is a sign-extended 64-bit immediate.
Xctz32 = 92
low32(dst) = trailing_zeros(low32(src))
Xctz64 = 93
dst = trailing_zeros(src)
Xclz32 = 94
low32(dst) = leading_zeros(low32(src))
Xclz64 = 95
dst = leading_zeros(src)
Xpopcnt32 = 96
low32(dst) = count_ones(low32(src))
Xpopcnt64 = 97
dst = count_ones(src)
Xrotl32 = 98
low32(dst) = rotate_left(low32(src1), low32(src2))
Xrotl64 = 99
dst = rotate_left(src1, src2)
Xrotr32 = 100
low32(dst) = rotate_right(low32(src1), low32(src2))
Xrotr64 = 101
dst = rotate_right(src1, src2)
Xshl32 = 102
low32(dst) = low32(src1) << low5(src2)
Xshr32S = 103
low32(dst) = low32(src1) >> low5(src2)
Xshr32U = 104
low32(dst) = low32(src1) >> low5(src2)
Xshl64 = 105
dst = src1 << low5(src2)
Xshr64S = 106
dst = src1 >> low6(src2)
Xshr64U = 107
dst = src1 >> low6(src2)
Xshl32U6 = 108
low32(dst) = low32(src1) << low5(src2)
Xshr32SU6 = 109
low32(dst) = low32(src1) >> low5(src2)
Xshr32UU6 = 110
low32(dst) = low32(src1) >> low5(src2)
Xshl64U6 = 111
dst = src1 << low5(src2)
Xshr64SU6 = 112
dst = src1 >> low6(src2)
Xshr64UU6 = 113
dst = src1 >> low6(src2)
Xneg32 = 114
low32(dst) = -low32(src)
Xneg64 = 115
dst = -src
Xeq64 = 116
low32(dst) = src1 == src2
Xneq64 = 117
low32(dst) = src1 != src2
Xslt64 = 118
low32(dst) = src1 < src2 (signed)
Xslteq64 = 119
low32(dst) = src1 <= src2 (signed)
Xult64 = 120
low32(dst) = src1 < src2 (unsigned)
Xulteq64 = 121
low32(dst) = src1 <= src2 (unsigned)
Xeq32 = 122
low32(dst) = low32(src1) == low32(src2)
Xneq32 = 123
low32(dst) = low32(src1) != low32(src2)
Xslt32 = 124
low32(dst) = low32(src1) < low32(src2) (signed)
Xslteq32 = 125
low32(dst) = low32(src1) <= low32(src2) (signed)
Xult32 = 126
low32(dst) = low32(src1) < low32(src2) (unsigned)
Xulteq32 = 127
low32(dst) = low32(src1) <= low32(src2) (unsigned)
XLoad8U32O32 = 128
low32(dst) = zext_8_32(*addr)
XLoad8S32O32 = 129
low32(dst) = sext_8_32(*addr)
XLoad16LeU32O32 = 130
low32(dst) = o32ext_16_32(*addr)
XLoad16LeS32O32 = 131
low32(dst) = sext_16_32(*addr)
XLoad32LeO32 = 132
low32(dst) = *addr
XLoad64LeO32 = 133
dst = *addr
XStore8O32 = 134
*addr = low8(src)
XStore16LeO32 = 135
*addr = low16(src)
XStore32LeO32 = 136
*addr = low32(src)
XStore64LeO32 = 137
*addr = src
XLoad8U32Z = 138
low32(dst) = zext_8_32(*addr)
XLoad8S32Z = 139
low32(dst) = sext_8_32(*addr)
XLoad16LeU32Z = 140
low32(dst) = zext_16_32(*addr)
XLoad16LeS32Z = 141
low32(dst) = sext_16_32(*addr)
XLoad32LeZ = 142
low32(dst) = *addr
XLoad64LeZ = 143
dst = *addr
XStore8Z = 144
*addr = low8(src)
XStore16LeZ = 145
*addr = low16(src)
XStore32LeZ = 146
*addr = low32(src)
XStore64LeZ = 147
*addr = src
XLoad8U32G32 = 148
low32(dst) = zext_8_32(*addr)
XLoad8S32G32 = 149
low32(dst) = sext_8_32(*addr)
XLoad16LeU32G32 = 150
low32(dst) = zext_16_32(*addr)
XLoad16LeS32G32 = 151
low32(dst) = sext_16_32(*addr)
XLoad32LeG32 = 152
low32(dst) = *addr
XLoad64LeG32 = 153
dst = *addr
XStore8G32 = 154
*addr = low8(src)
XStore16LeG32 = 155
*addr = low16(src)
XStore32LeG32 = 156
*addr = low32(src)
XStore64LeG32 = 157
*addr = src
XLoad8U32G32Bne = 158
low32(dst) = zext_8_32(*addr)
XLoad8S32G32Bne = 159
low32(dst) = sext_8_32(*addr)
XLoad16LeU32G32Bne = 160
low32(dst) = zext_16_32(*addr)
XLoad16LeS32G32Bne = 161
low32(dst) = sext_16_32(*addr)
XLoad32LeG32Bne = 162
low32(dst) = *addr
XLoad64LeG32Bne = 163
dst = *addr
XStore8G32Bne = 164
*addr = low8(src)
XStore16LeG32Bne = 165
*addr = low16(src)
XStore32LeG32Bne = 166
*addr = low32(src)
XStore64LeG32Bne = 167
*addr = src
PushFrame = 168
push lr; push fp; fp = sp
PopFrame = 169
sp = fp; pop fp; pop lr
PushFrameSave = 170
Macro-instruction to enter a function, allocate some stack, and then save some registers.
This is equivalent to push_frame, stack_alloc32 amt, then
saving all of regs to the top of the stack just allocated.
PopFrameRestore = 171
Inverse of push_frame_save. Restores regs from the top of
the stack, then runs stack_free32 amt, then runs pop_frame.
StackAlloc32 = 172
sp = sp.checked_sub(amt)
StackFree32 = 173
sp = sp + amt
Zext8 = 174
dst = zext(low8(src))
Zext16 = 175
dst = zext(low16(src))
Zext32 = 176
dst = zext(low32(src))
Sext8 = 177
dst = sext(low8(src))
Sext16 = 178
dst = sext(low16(src))
Sext32 = 179
dst = sext(low32(src))
XAbs32 = 180
low32(dst) = |low32(src)|
XAbs64 = 181
dst = |src|
XDiv32S = 182
low32(dst) = low32(src1) / low32(src2) (signed)
XDiv64S = 183
dst = src1 / src2 (signed)
XDiv32U = 184
low32(dst) = low32(src1) / low32(src2) (unsigned)
XDiv64U = 185
dst = src1 / src2 (unsigned)
XRem32S = 186
low32(dst) = low32(src1) % low32(src2) (signed)
XRem64S = 187
dst = src1 / src2 (signed)
XRem32U = 188
low32(dst) = low32(src1) % low32(src2) (unsigned)
XRem64U = 189
dst = src1 / src2 (unsigned)
XBand32 = 190
low32(dst) = low32(src1) & low32(src2)
Xband32S8 = 191
Same as xband64 but src2 is a sign-extended 8-bit immediate.
Xband32S32 = 192
Same as xband32 but src2 is a sign-extended 32-bit immediate.
XBand64 = 193
dst = src1 & src2
Xband64S8 = 194
Same as xband64 but src2 is a sign-extended 8-bit immediate.
Xband64S32 = 195
Same as xband64 but src2 is a sign-extended 32-bit immediate.
XBor32 = 196
low32(dst) = low32(src1) | low32(src2)
Xbor32S8 = 197
Same as xbor64 but src2 is a sign-extended 8-bit immediate.
Xbor32S32 = 198
Same as xbor32 but src2 is a sign-extended 32-bit immediate.
XBor64 = 199
dst = src1 | src2
Xbor64S8 = 200
Same as xbor64 but src2 is a sign-extended 8-bit immediate.
Xbor64S32 = 201
Same as xbor64 but src2 is a sign-extended 32-bit immediate.
XBxor32 = 202
low32(dst) = low32(src1) ^ low32(src2)
Xbxor32S8 = 203
Same as xbxor64 but src2 is a sign-extended 8-bit immediate.
Xbxor32S32 = 204
Same as xbxor32 but src2 is a sign-extended 32-bit immediate.
XBxor64 = 205
dst = src1 ^ src2
Xbxor64S8 = 206
Same as xbxor64 but src2 is a sign-extended 8-bit immediate.
Xbxor64S32 = 207
Same as xbxor64 but src2 is a sign-extended 32-bit immediate.
XBnot32 = 208
low32(dst) = !low32(src1)
XBnot64 = 209
dst = !src1
Xmin32U = 210
low32(dst) = min(low32(src1), low32(src2)) (unsigned)
Xmin32S = 211
low32(dst) = min(low32(src1), low32(src2)) (signed)
Xmax32U = 212
low32(dst) = max(low32(src1), low32(src2)) (unsigned)
Xmax32S = 213
low32(dst) = max(low32(src1), low32(src2)) (signed)
Xmin64U = 214
dst = min(src1, src2) (unsigned)
Xmin64S = 215
dst = min(src1, src2) (signed)
Xmax64U = 216
dst = max(src1, src2) (unsigned)
Xmax64S = 217
dst = max(src1, src2) (signed)
XSelect32 = 218
low32(dst) = low32(cond) ? low32(if_nonzero) : low32(if_zero)
XSelect64 = 219
dst = low32(cond) ? if_nonzero : if_zero
ExtendedOp = 220
The extended-op opcode. An ExtendedOpcode follows this opcode.
Implementations§
Source§impl Opcode
impl Opcode
Sourcepub fn new(byte: u8) -> Option<Self>
pub fn new(byte: u8) -> Option<Self>
Create a new Opcode from the given byte.
Returns None if byte is not a valid opcode.
Sourcepub unsafe fn unchecked_new(byte: u8) -> Self
pub unsafe fn unchecked_new(byte: u8) -> Self
Like new but does not check whether byte is a valid opcode.
§Safety
It is unsafe to pass a byte that is not a valid opcode.