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...@@ -2658,19 +2658,19 @@ fn binOpBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) Inner
2658 .rem => return func.callIntrinsic("__umodti3", &.{ ty.toIntern(), ty.toIntern() }, ty, &.{ lhs, rhs }),2658 .rem => return func.callIntrinsic("__umodti3", &.{ ty.toIntern(), ty.toIntern() }, ty, &.{ lhs, rhs }),
2659 .shr => return func.callIntrinsic("__lshrti3", &.{ ty.toIntern(), .i32_type }, ty, &.{ lhs, rhs }),2659 .shr => return func.callIntrinsic("__lshrti3", &.{ ty.toIntern(), .i32_type }, ty, &.{ lhs, rhs }),
2660 .shl => return func.callIntrinsic("__ashlti3", &.{ ty.toIntern(), .i32_type }, ty, &.{ lhs, rhs }),2660 .shl => return func.callIntrinsic("__ashlti3", &.{ ty.toIntern(), .i32_type }, ty, &.{ lhs, rhs }),
2661 .xor => {2661 .@"and", .@"or", .xor => {
2662 const result = try func.allocStack(ty);2662 const result = try func.allocStack(ty);
2663 try func.emitWValue(result);2663 try func.emitWValue(result);
2664 const lhs_high_bit = try func.load(lhs, Type.u64, 0);2664 const lhs_high_bit = try func.load(lhs, Type.u64, 0);
2665 const rhs_high_bit = try func.load(rhs, Type.u64, 0);2665 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);2666 const op_high_bit = try func.binOp(lhs_high_bit, rhs_high_bit, Type.u64, op);
2667 try func.store(.stack, xor_high_bit, Type.u64, result.offset());2667 try func.store(.stack, op_high_bit, Type.u64, result.offset());
26682668
2669 try func.emitWValue(result);2669 try func.emitWValue(result);
2670 const lhs_low_bit = try func.load(lhs, Type.u64, 8);2670 const lhs_low_bit = try func.load(lhs, Type.u64, 8);
2671 const rhs_low_bit = try func.load(rhs, Type.u64, 8);2671 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);2672 const op_low_bit = try func.binOp(lhs_low_bit, rhs_low_bit, Type.u64, op);
2673 try func.store(.stack, xor_low_bit, Type.u64, result.offset() + 8);2673 try func.store(.stack, op_low_bit, Type.u64, result.offset() + 8);
2674 return result;2674 return result;
2675 },2675 },
2676 .add, .sub => {2676 .add, .sub => {