| ... | ... | @@ -1885,25 +1885,28 @@ pub const DeclGen = struct { |
| 1885 | 1885 | } |
| 1886 | 1886 | |
| 1887 | 1887 | fn renderBuiltinInfo(dg: *DeclGen, writer: anytype, ty: Type, info: BuiltinInfo) !void { |
| 1888 | const cty = try dg.typeToCType(ty, .complete); |
| 1889 | const is_big = cty.tag() == .array; |
| 1890 | |
| 1888 | 1891 | switch (info) { |
| 1889 | | .none => {}, |
| 1890 | | .bits => { |
| 1891 | | const target = dg.module.getTarget(); |
| 1892 | | const int_info = if (ty.isAbiInt()) ty.intInfo(target) else std.builtin.Type.Int{ |
| 1893 | | .signedness = .unsigned, |
| 1894 | | .bits = @intCast(u16, ty.bitSize(target)), |
| 1895 | | }; |
| 1892 | .none => if (!is_big) return, |
| 1893 | .bits => {}, |
| 1894 | } |
| 1896 | 1895 | |
| 1897 | | const cty = try dg.typeToCType(ty, .complete); |
| 1898 | | if (cty.tag() == .array) try writer.print(", {}", .{int_info.signedness == .signed}); |
| 1896 | const target = dg.module.getTarget(); |
| 1897 | const int_info = if (ty.isAbiInt()) ty.intInfo(target) else std.builtin.Type.Int{ |
| 1898 | .signedness = .unsigned, |
| 1899 | .bits = @intCast(u16, ty.bitSize(target)), |
| 1900 | }; |
| 1899 | 1901 | |
| 1900 | | var bits_pl = Value.Payload.U64{ .base = .{ .tag = .int_u64 }, .data = int_info.bits }; |
| 1901 | | try writer.print(", {}", .{try dg.fmtIntLiteral(switch (cty.tag()) { |
| 1902 | | else => Type.u8, |
| 1903 | | .array => Type.u16, |
| 1904 | | }, Value.initPayload(&bits_pl.base), .FunctionArgument)}); |
| 1905 | | }, |
| 1906 | | } |
| 1902 | if (is_big) try writer.print(", {}", .{int_info.signedness == .signed}); |
| 1903 | |
| 1904 | var bits_pl = Value.Payload.U64{ .base = .{ .tag = .int_u64 }, .data = int_info.bits }; |
| 1905 | try writer.print(", {}", .{try dg.fmtIntLiteral( |
| 1906 | if (is_big) Type.u16 else Type.u8, |
| 1907 | Value.initPayload(&bits_pl.base), |
| 1908 | .FunctionArgument, |
| 1909 | )}); |
| 1907 | 1910 | } |
| 1908 | 1911 | |
| 1909 | 1912 | fn fmtIntLiteral( |
| ... | ... | @@ -6099,13 +6102,16 @@ fn airBinBuiltinCall( |
| 6099 | 6102 | return .none; |
| 6100 | 6103 | } |
| 6101 | 6104 | |
| 6105 | const operand_ty = f.air.typeOf(bin_op.lhs); |
| 6106 | const operand_cty = try f.typeToCType(operand_ty, .complete); |
| 6107 | const is_big = operand_cty.tag() == .array; |
| 6108 | |
| 6102 | 6109 | const lhs = try f.resolveInst(bin_op.lhs); |
| 6103 | 6110 | const rhs = try f.resolveInst(bin_op.rhs); |
| 6104 | | try reap(f, inst, &.{ bin_op.lhs, bin_op.rhs }); |
| 6111 | if (!is_big) try reap(f, inst, &.{ bin_op.lhs, bin_op.rhs }); |
| 6105 | 6112 | |
| 6106 | 6113 | const inst_ty = f.air.typeOfIndex(inst); |
| 6107 | 6114 | const inst_scalar_ty = inst_ty.scalarType(); |
| 6108 | | const operand_ty = f.air.typeOf(bin_op.lhs); |
| 6109 | 6115 | const scalar_ty = operand_ty.scalarType(); |
| 6110 | 6116 | |
| 6111 | 6117 | const inst_scalar_cty = try f.typeToCType(inst_scalar_ty, .complete); |
| ... | ... | @@ -6113,6 +6119,7 @@ fn airBinBuiltinCall( |
| 6113 | 6119 | |
| 6114 | 6120 | const writer = f.object.writer(); |
| 6115 | 6121 | const local = try f.allocLocal(inst, inst_ty); |
| 6122 | if (is_big) try reap(f, inst, &.{ bin_op.lhs, bin_op.rhs }); |
| 6116 | 6123 | const v = try Vectorizer.start(f, inst, writer, operand_ty); |
| 6117 | 6124 | if (!ref_ret) { |
| 6118 | 6125 | try f.writeCValue(writer, local, .Other); |