Skip to content

Commit 5bb1dae

Browse files
authored
[Wasm RyuJit] Add various wasm binops to instrswasm (#122081)
Let's add the opcodes first and see if CCA can update the switch statement separately.
1 parent f81f825 commit 5bb1dae

File tree

1 file changed

+109
-5
lines changed

1 file changed

+109
-5
lines changed

src/coreclr/jit/instrswasm.h

Lines changed: 109 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,116 @@ INST(br, "br", 0, IF_ULEB128, 0x0C)
3030
INST(local_get, "local.get", 0, IF_ULEB128, 0x20)
3131
INST(i32_load, "i32.load", 0, IF_MEMARG, 0x28)
3232
INST(i64_load, "i64.load", 0, IF_MEMARG, 0x29)
33-
INST(f32_load, "f32.load", 0, IF_MEMARG, 0x2a)
34-
INST(f64_load, "f64.load", 0, IF_MEMARG, 0x2b)
35-
INST(i32_add, "i32.add", 0, IF_OPCODE, 0x6a)
36-
INST(i64_add, "i64.add", 0, IF_OPCODE, 0x7c)
33+
INST(f32_load, "f32.load", 0, IF_MEMARG, 0x2A)
34+
INST(f64_load, "f64.load", 0, IF_MEMARG, 0x2B)
35+
// 5.4.7 Numeric Instructions
36+
// TODO-WASM: Constants
37+
// INST(i32_const, "i32.const", 0, IF_LEB128, 0x41)
38+
// INST(i64_const, "i64.const", 0, IF_LEB128, 0x42)
39+
// INST(f32_const, "f32.const", 0, IF_F32, 0x43)
40+
// INST(f64_const, "f64.const", 0, IF_F64, 0x44)
41+
// Integer comparisons
42+
INST(i32_eqz, "i32.eqz", 0, IF_OPCODE, 0x45)
43+
INST(i32_eq, "i32.eq", 0, IF_OPCODE, 0x46)
44+
INST(i32_ne, "i32.ne", 0, IF_OPCODE, 0x47)
45+
INST(i32_lt_s, "i32.lt_s", 0, IF_OPCODE, 0x48)
46+
INST(i32_lt_u, "i32.lt_u", 0, IF_OPCODE, 0x49)
47+
INST(i32_gt_s, "i32.gt_s", 0, IF_OPCODE, 0x4A)
48+
INST(i32_gt_u, "i32.gt_u", 0, IF_OPCODE, 0x4B)
49+
INST(i32_le_s, "i32.le_s", 0, IF_OPCODE, 0x4C)
50+
INST(i32_le_u, "i32.le_u", 0, IF_OPCODE, 0x4D)
51+
INST(i32_ge_s, "i32.ge_s", 0, IF_OPCODE, 0x4E)
52+
INST(i32_ge_u, "i32.ge_u", 0, IF_OPCODE, 0x4F)
53+
INST(i64_eqz, "i64.eqz", 0, IF_OPCODE, 0x50)
54+
INST(i64_eq, "i64.eq", 0, IF_OPCODE, 0x51)
55+
INST(i64_ne, "i64.ne", 0, IF_OPCODE, 0x52)
56+
INST(i64_lt_s, "i64.lt_s", 0, IF_OPCODE, 0x53)
57+
INST(i64_lt_u, "i64.lt_u", 0, IF_OPCODE, 0x54)
58+
INST(i64_gt_s, "i64.gt_s", 0, IF_OPCODE, 0x55)
59+
INST(i64_gt_u, "i64.gt_u", 0, IF_OPCODE, 0x56)
60+
INST(i64_le_s, "i64.le_s", 0, IF_OPCODE, 0x57)
61+
INST(i64_le_u, "i64.le_u", 0, IF_OPCODE, 0x58)
62+
INST(i64_ge_s, "i64.ge_s", 0, IF_OPCODE, 0x59)
63+
INST(i64_ge_u, "i64.ge_u", 0, IF_OPCODE, 0x5A)
64+
// Floating-point comparisons
65+
INST(f32_eq, "f32.eq", 0, IF_OPCODE, 0x5B)
66+
INST(f32_ne, "f32.ne", 0, IF_OPCODE, 0x5C)
67+
INST(f32_lt, "f32.lt", 0, IF_OPCODE, 0x5D)
68+
INST(f32_gt, "f32.gt", 0, IF_OPCODE, 0x5E)
69+
INST(f32_le, "f32.le", 0, IF_OPCODE, 0x5F)
70+
INST(f32_ge, "f32.ge", 0, IF_OPCODE, 0x60)
71+
INST(f64_eq, "f64.eq", 0, IF_OPCODE, 0x61)
72+
INST(f64_ne, "f64.ne", 0, IF_OPCODE, 0x62)
73+
INST(f64_lt, "f64.lt", 0, IF_OPCODE, 0x63)
74+
INST(f64_gt, "f64.gt", 0, IF_OPCODE, 0x64)
75+
INST(f64_le, "f64.le", 0, IF_OPCODE, 0x65)
76+
INST(f64_ge, "f64.ge", 0, IF_OPCODE, 0x66)
77+
// Integer arithmetic and logic operations
78+
INST(i32_clz, "i32.clz", 0, IF_OPCODE, 0x67)
79+
INST(i32_ctz, "i32.ctz", 0, IF_OPCODE, 0x68)
80+
INST(i32_popcnt, "i32.popcnt", 0, IF_OPCODE, 0x69)
81+
INST(i32_add, "i32.add", 0, IF_OPCODE, 0x6A)
82+
INST(i32_sub, "i32.sub", 0, IF_OPCODE, 0x6B)
83+
INST(i32_mul, "i32.mul", 0, IF_OPCODE, 0x6C)
84+
INST(i32_div_s, "i32.div_s", 0, IF_OPCODE, 0x6D)
85+
INST(i32_div_u, "i32.div_u", 0, IF_OPCODE, 0x6E)
86+
INST(i32_rem_s, "i32.rem_s", 0, IF_OPCODE, 0x6F)
87+
INST(i32_rem_u, "i32.rem_u", 0, IF_OPCODE, 0x70)
88+
INST(i32_and, "i32.and", 0, IF_OPCODE, 0x71)
89+
INST(i32_or, "i32.or", 0, IF_OPCODE, 0x72)
90+
INST(i32_xor, "i32.xor", 0, IF_OPCODE, 0x73)
91+
INST(i32_shl, "i32.shl", 0, IF_OPCODE, 0x74)
92+
INST(i32_shr_s, "i32.shr_s", 0, IF_OPCODE, 0x75)
93+
INST(i32_shr_u, "i32.shr_u", 0, IF_OPCODE, 0x76)
94+
INST(i32_rotl, "i32.rotl", 0, IF_OPCODE, 0x77)
95+
INST(i32_rotr, "i32.rotr", 0, IF_OPCODE, 0x78)
96+
INST(i64_clz, "i64.clz", 0, IF_OPCODE, 0x79)
97+
INST(i64_ctz, "i64.ctz", 0, IF_OPCODE, 0x7A)
98+
INST(i64_popcnt, "i64.popcnt", 0, IF_OPCODE, 0x7B)
99+
INST(i64_add, "i64.add", 0, IF_OPCODE, 0x7C)
100+
INST(i64_sub, "i64.sub", 0, IF_OPCODE, 0x7D)
101+
INST(i64_mul, "i64.mul", 0, IF_OPCODE, 0x7E)
102+
INST(i64_div_s, "i64.div_s", 0, IF_OPCODE, 0x7F)
103+
INST(i64_div_u, "i64.div_u", 0, IF_OPCODE, 0x80)
104+
INST(i64_rem_s, "i64.rem_s", 0, IF_OPCODE, 0x81)
105+
INST(i64_rem_u, "i64.rem_u", 0, IF_OPCODE, 0x82)
106+
INST(i64_and, "i64.and", 0, IF_OPCODE, 0x83)
107+
INST(i64_or, "i64.or", 0, IF_OPCODE, 0x84)
108+
INST(i64_xor, "i64.xor", 0, IF_OPCODE, 0x85)
109+
INST(i64_shl, "i64.shl", 0, IF_OPCODE, 0x86)
110+
INST(i64_shr_s, "i64.shr_s", 0, IF_OPCODE, 0x87)
111+
INST(i64_shr_u, "i64.shr_u", 0, IF_OPCODE, 0x88)
112+
INST(i64_rotl, "i64.rotl", 0, IF_OPCODE, 0x89)
113+
INST(i64_rotr, "i64.rotr", 0, IF_OPCODE, 0x8A)
114+
// Floating point arithmetic operations
115+
INST(f32_abs, "f32.abs", 0, IF_OPCODE, 0x8B)
116+
INST(f32_neg, "f32.neg", 0, IF_OPCODE, 0x8C)
117+
INST(f32_ceil, "f32.ceil", 0, IF_OPCODE, 0x8D)
118+
INST(f32_floor, "f32.floor", 0, IF_OPCODE, 0x8E)
119+
INST(f32_trunc, "f32.trunc", 0, IF_OPCODE, 0x8F)
120+
INST(f32_nearest, "f32.nearest", 0, IF_OPCODE, 0x90)
121+
INST(f32_sqrt, "f32.sqrt", 0, IF_OPCODE, 0x91)
37122
INST(f32_add, "f32.add", 0, IF_OPCODE, 0x92)
38-
INST(f64_add, "f64.add", 0, IF_OPCODE, 0xa0)
123+
INST(f32_sub, "f32.sub", 0, IF_OPCODE, 0x93)
124+
INST(f32_mul, "f32.mul", 0, IF_OPCODE, 0x94)
125+
INST(f32_div, "f32.div", 0, IF_OPCODE, 0x95)
126+
INST(f32_min, "f32.min", 0, IF_OPCODE, 0x96)
127+
INST(f32_max, "f32.max", 0, IF_OPCODE, 0x97)
128+
INST(f32_copysign,"f32.copysign",0, IF_OPCODE, 0x98)
129+
INST(f64_abs, "f64.abs", 0, IF_OPCODE, 0x99)
130+
INST(f64_neg, "f64.neg", 0, IF_OPCODE, 0x9A)
131+
INST(f64_ceil, "f64.ceil", 0, IF_OPCODE, 0x9B)
132+
INST(f64_floor, "f64.floor", 0, IF_OPCODE, 0x9C)
133+
INST(f64_trunc, "f64.trunc", 0, IF_OPCODE, 0x9D)
134+
INST(f64_nearest, "f64.nearest", 0, IF_OPCODE, 0x9E)
135+
INST(f64_sqrt, "f64.sqrt", 0, IF_OPCODE, 0x9F)
136+
INST(f64_add, "f64.add", 0, IF_OPCODE, 0xA0)
137+
INST(f64_sub, "f64.sub", 0, IF_OPCODE, 0xA1)
138+
INST(f64_mul, "f64.mul", 0, IF_OPCODE, 0xA2)
139+
INST(f64_div, "f64.div", 0, IF_OPCODE, 0xA3)
140+
INST(f64_min, "f64.min", 0, IF_OPCODE, 0xA4)
141+
INST(f64_max, "f64.max", 0, IF_OPCODE, 0xA5)
142+
INST(f64_copysign,"f64.copysign",0, IF_OPCODE, 0xA6)
39143
// clang-format on
40144

41145
#undef INST

0 commit comments

Comments
 (0)