authorgravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2021-01-16 18:22:20+01:00
committergravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2021-01-16 18:22:20+01:00
log6a87ce0b62a3c9d3a795f3a16b1650f4a8c3b2fc
tree634a0f3f69f0dbe3b1d4130873bf4114d1c43c1e
parent6c19aeddca7f1f2c25c7d34dd9f6011b495670a9
signaturelock-open Commit is signed but in an unrecognized format.

Generate correct opcode for 'addGen' depending on type


1 files changed, 9 insertions(+), 1 deletions(-)

src/codegen/wasm.zig+9-1
......@@ -264,7 +264,15 @@ pub const Context = struct {
264264 try self.emitWValue(lhs);
265265 try self.emitWValue(rhs);
266266
267 try self.code.append(0x6A); // i32.add
267 const opcode: u8 = switch (inst.base.ty.tag()) {
268 .u32, .i32 => 0x6A, //i32.add
269 .u64, .i64 => 0x7C, //i64.add
270 .f32 => 0x92, //f32.add
271 .f64 => 0xA0, //f64.add
272 else => return self.fail(inst.base.src, "TODO - Implement wasm genAdd for type '{s}'", .{inst.base.ty.tag()}),
273 };
274
275 try self.code.append(opcode);
268276 return WValue.none;
269277 }
270278