authorgravatar for marc@tiehu.isMarc Tiehuis <marc@tiehu.is> 2024-03-10 18:15:15+13:00
committergravatar for marc@tiehu.isMarc Tiehuis <marc@tiehu.is> 2024-03-10 18:15:15+13:00
logbb1fe112f1ddccf0f6f1b71c2dfb2f796645fa94
treec08d99c218331649427017555f83f86b247e77d1
parentda4acf9a485bf1658194c8cb8593dd142677138d

wasm/codegen: add "and" + "or" impl for big ints


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

src/arch/wasm/CodeGen.zig+5-5
......@@ -2658,19 +2658,19 @@ fn binOpBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) Inner
26582658 .rem => return func.callIntrinsic("__umodti3", &.{ ty.toIntern(), ty.toIntern() }, ty, &.{ lhs, rhs }),
26592659 .shr => return func.callIntrinsic("__lshrti3", &.{ ty.toIntern(), .i32_type }, ty, &.{ lhs, rhs }),
26602660 .shl => return func.callIntrinsic("__ashlti3", &.{ ty.toIntern(), .i32_type }, ty, &.{ lhs, rhs }),
2661 .xor => {
2661 .@"and", .@"or", .xor => {
26622662 const result = try func.allocStack(ty);
26632663 try func.emitWValue(result);
26642664 const lhs_high_bit = try func.load(lhs, Type.u64, 0);
26652665 const rhs_high_bit = try func.load(rhs, Type.u64, 0);
2666 const xor_high_bit = try func.binOp(lhs_high_bit, rhs_high_bit, Type.u64, .xor);
2667 try func.store(.stack, xor_high_bit, Type.u64, result.offset());
2666 const op_high_bit = try func.binOp(lhs_high_bit, rhs_high_bit, Type.u64, op);
2667 try func.store(.stack, op_high_bit, Type.u64, result.offset());
26682668
26692669 try func.emitWValue(result);
26702670 const lhs_low_bit = try func.load(lhs, Type.u64, 8);
26712671 const rhs_low_bit = try func.load(rhs, Type.u64, 8);
2672 const xor_low_bit = try func.binOp(lhs_low_bit, rhs_low_bit, Type.u64, .xor);
2673 try func.store(.stack, xor_low_bit, Type.u64, result.offset() + 8);
2672 const op_low_bit = try func.binOp(lhs_low_bit, rhs_low_bit, Type.u64, op);
2673 try func.store(.stack, op_low_bit, Type.u64, result.offset() + 8);
26742674 return result;
26752675 },
26762676 .add, .sub => {