From bb1fe112f1ddccf0f6f1b71c2dfb2f796645fa94 Mon Sep 17 00:00:00 2001 From: Marc Tiehuis Date: Sun, 10 Mar 2024 18:15:15 +1300 Subject: [PATCH] wasm/codegen: add "and" + "or" impl for big ints --- src/arch/wasm/CodeGen.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index e940e37619..d2f22040dd 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -2658,19 +2658,19 @@ fn binOpBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) Inner .rem => return func.callIntrinsic("__umodti3", &.{ ty.toIntern(), ty.toIntern() }, ty, &.{ lhs, rhs }), .shr => return func.callIntrinsic("__lshrti3", &.{ ty.toIntern(), .i32_type }, ty, &.{ lhs, rhs }), .shl => return func.callIntrinsic("__ashlti3", &.{ ty.toIntern(), .i32_type }, ty, &.{ lhs, rhs }), - .xor => { + .@"and", .@"or", .xor => { const result = try func.allocStack(ty); try func.emitWValue(result); const lhs_high_bit = try func.load(lhs, Type.u64, 0); const rhs_high_bit = try func.load(rhs, Type.u64, 0); - const xor_high_bit = try func.binOp(lhs_high_bit, rhs_high_bit, Type.u64, .xor); - try func.store(.stack, xor_high_bit, Type.u64, result.offset()); + const op_high_bit = try func.binOp(lhs_high_bit, rhs_high_bit, Type.u64, op); + try func.store(.stack, op_high_bit, Type.u64, result.offset()); try func.emitWValue(result); const lhs_low_bit = try func.load(lhs, Type.u64, 8); const rhs_low_bit = try func.load(rhs, Type.u64, 8); - const xor_low_bit = try func.binOp(lhs_low_bit, rhs_low_bit, Type.u64, .xor); - try func.store(.stack, xor_low_bit, Type.u64, result.offset() + 8); + const op_low_bit = try func.binOp(lhs_low_bit, rhs_low_bit, Type.u64, op); + try func.store(.stack, op_low_bit, Type.u64, result.offset() + 8); return result; }, .add, .sub => {