authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2023-06-22 22:40:13+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-24 16:47:49-07:00
log447ca4e3fff021f471b748187b53f0a4744ad0bc
tree16c4edaf3014dc03809b67be52112b361003f44c
parent283d6509730a0ca6fae0ed07a1814f5a9237f282

translate-c: update to new cast builtin syntax


2 files changed, 113 insertions(+), 121 deletions(-)

src/translate_c.zig+86-60
......@@ -1010,17 +1010,23 @@ fn buildFlexibleArrayFn(
10101010 const bit_offset = layout.getFieldOffset(field_index); // this is a target-specific constant based on the struct layout
10111011 const byte_offset = bit_offset / 8;
10121012
1013 const casted_self = try Tag.ptr_cast.create(c.arena, .{
1013 const casted_self = try Tag.as.create(c.arena, .{
10141014 .lhs = intermediate_type_ident,
1015 .rhs = self_param,
1015 .rhs = try Tag.ptr_cast.create(c.arena, self_param),
10161016 });
10171017 const field_offset = try transCreateNodeNumber(c, byte_offset, .int);
10181018 const field_ptr = try Tag.add.create(c.arena, .{ .lhs = casted_self, .rhs = field_offset });
10191019
1020 const alignment = try Tag.alignof.create(c.arena, element_type);
1021
1022 const ptr_val = try Tag.align_cast.create(c.arena, .{ .lhs = alignment, .rhs = field_ptr });
1023 const ptr_cast = try Tag.ptr_cast.create(c.arena, .{ .lhs = return_type_ident, .rhs = ptr_val });
1020 const ptr_cast = try Tag.as.create(c.arena, .{
1021 .lhs = return_type_ident,
1022 .rhs = try Tag.ptr_cast.create(
1023 c.arena,
1024 try Tag.align_cast.create(
1025 c.arena,
1026 field_ptr,
1027 ),
1028 ),
1029 });
10241030 const return_stmt = try Tag.@"return".create(c.arena, ptr_cast);
10251031 try block_scope.statements.append(return_stmt);
10261032
......@@ -1579,14 +1585,14 @@ fn transOffsetOfExpr(
15791585/// pointer arithmetic expressions, where wraparound will ensure we get the correct value.
15801586/// node -> @bitCast(usize, @intCast(isize, node))
15811587fn usizeCastForWrappingPtrArithmetic(gpa: mem.Allocator, node: Node) TransError!Node {
1582 const intcast_node = try Tag.int_cast.create(gpa, .{
1588 const intcast_node = try Tag.as.create(gpa, .{
15831589 .lhs = try Tag.type.create(gpa, "isize"),
1584 .rhs = node,
1590 .rhs = try Tag.int_cast.create(gpa, node),
15851591 });
15861592
1587 return Tag.bit_cast.create(gpa, .{
1593 return Tag.as.create(gpa, .{
15881594 .lhs = try Tag.type.create(gpa, "usize"),
1589 .rhs = intcast_node,
1595 .rhs = try Tag.bit_cast.create(gpa, intcast_node),
15901596 });
15911597}
15921598
......@@ -1781,7 +1787,10 @@ fn transBinaryOperator(
17811787 const elem_type = c_pointer.castTag(.c_pointer).?.data.elem_type;
17821788 const sizeof = try Tag.sizeof.create(c.arena, elem_type);
17831789
1784 const bitcast = try Tag.bit_cast.create(c.arena, .{ .lhs = ptrdiff_type, .rhs = infixOpNode });
1790 const bitcast = try Tag.as.create(c.arena, .{
1791 .lhs = ptrdiff_type,
1792 .rhs = try Tag.bit_cast.create(c.arena, infixOpNode),
1793 });
17851794
17861795 return Tag.div_exact.create(c.arena, .{
17871796 .lhs = bitcast,
......@@ -2310,7 +2319,7 @@ fn transIntegerLiteral(
23102319 // unsigned char y = 256;
23112320 // How this gets evaluated is the 256 is an integer, which gets truncated to signed char, then bit-casted
23122321 // to unsigned char, resulting in 0. In order for this to work, we have to emit this zig code:
2313 // var y = @bitCast(u8, @truncate(i8, @as(c_int, 256)));
2322 // var y = @as(u8, @bitCast(@as(i8, @truncate(@as(c_int, 256)))));
23142323 // Ideally in translate-c we could flatten this out to simply:
23152324 // var y: u8 = 0;
23162325 // But the first step is to be correct, and the next step is to make the output more elegant.
......@@ -2501,7 +2510,10 @@ fn transCCast(
25012510 .lt => {
25022511 // @truncate(SameSignSmallerInt, src_int_expr)
25032512 const ty_node = try transQualTypeIntWidthOf(c, dst_type, src_type_is_signed);
2504 src_int_expr = try Tag.truncate.create(c.arena, .{ .lhs = ty_node, .rhs = src_int_expr });
2513 src_int_expr = try Tag.as.create(c.arena, .{
2514 .lhs = ty_node,
2515 .rhs = try Tag.truncate.create(c.arena, src_int_expr),
2516 });
25052517 },
25062518 .gt => {
25072519 // @as(SameSignBiggerInt, src_int_expr)
......@@ -2512,36 +2524,57 @@ fn transCCast(
25122524 // src_int_expr = src_int_expr
25132525 },
25142526 }
2515 // @bitCast(dest_type, intermediate_value)
2516 return Tag.bit_cast.create(c.arena, .{ .lhs = dst_node, .rhs = src_int_expr });
2527 // @as(dest_type, @bitCast(intermediate_value))
2528 return Tag.as.create(c.arena, .{
2529 .lhs = dst_node,
2530 .rhs = try Tag.bit_cast.create(c.arena, src_int_expr),
2531 });
25172532 }
25182533 if (cIsVector(src_type) or cIsVector(dst_type)) {
25192534 // C cast where at least 1 operand is a vector requires them to be same size
2520 // @bitCast(dest_type, val)
2521 return Tag.bit_cast.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
2535 // @as(dest_type, @bitCast(val))
2536 return Tag.as.create(c.arena, .{
2537 .lhs = dst_node,
2538 .rhs = try Tag.bit_cast.create(c.arena, expr),
2539 });
25222540 }
25232541 if (cIsInteger(dst_type) and qualTypeIsPtr(src_type)) {
25242542 // @intCast(dest_type, @intFromPtr(val))
25252543 const int_from_ptr = try Tag.int_from_ptr.create(c.arena, expr);
2526 return Tag.int_cast.create(c.arena, .{ .lhs = dst_node, .rhs = int_from_ptr });
2544 return Tag.as.create(c.arena, .{
2545 .lhs = dst_node,
2546 .rhs = try Tag.int_cast.create(c.arena, int_from_ptr),
2547 });
25272548 }
25282549 if (cIsInteger(src_type) and qualTypeIsPtr(dst_type)) {
2529 // @ptrFromInt(dest_type, val)
2530 return Tag.ptr_from_int.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
2550 // @as(dest_type, @ptrFromInt(val))
2551 return Tag.as.create(c.arena, .{
2552 .lhs = dst_node,
2553 .rhs = try Tag.ptr_from_int.create(c.arena, expr),
2554 });
25312555 }
25322556 if (cIsFloating(src_type) and cIsFloating(dst_type)) {
2533 // @floatCast(dest_type, val)
2534 return Tag.float_cast.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
2557 // @as(dest_type, @floatCast(val))
2558 return Tag.as.create(c.arena, .{
2559 .lhs = dst_node,
2560 .rhs = try Tag.float_cast.create(c.arena, expr),
2561 });
25352562 }
25362563 if (cIsFloating(src_type) and !cIsFloating(dst_type)) {
2537 // @intFromFloat(dest_type, val)
2538 return Tag.int_from_float.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
2564 // @as(dest_type, @intFromFloat(val))
2565 return Tag.as.create(c.arena, .{
2566 .lhs = dst_node,
2567 .rhs = try Tag.int_from_float.create(c.arena, expr),
2568 });
25392569 }
25402570 if (!cIsFloating(src_type) and cIsFloating(dst_type)) {
25412571 var rhs = expr;
25422572 if (qualTypeIsBoolean(src_type)) rhs = try Tag.int_from_bool.create(c.arena, expr);
2543 // @floatFromInt(dest_type, val)
2544 return Tag.float_from_int.create(c.arena, .{ .lhs = dst_node, .rhs = rhs });
2573 // @as(dest_type, @floatFromInt(val))
2574 return Tag.as.create(c.arena, .{
2575 .lhs = dst_node,
2576 .rhs = try Tag.float_from_int.create(c.arena, rhs),
2577 });
25452578 }
25462579 if (qualTypeIsBoolean(src_type) and !qualTypeIsBoolean(dst_type)) {
25472580 // @intFromBool returns a u1
......@@ -3487,9 +3520,9 @@ fn transSignedArrayAccess(
34873520
34883521 const then_value = try Tag.add.create(c.arena, .{
34893522 .lhs = container_node,
3490 .rhs = try Tag.int_cast.create(c.arena, .{
3523 .rhs = try Tag.as.create(c.arena, .{
34913524 .lhs = try Tag.type.create(c.arena, "usize"),
3492 .rhs = tmp_ref,
3525 .rhs = try Tag.int_cast.create(c.arena, tmp_ref),
34933526 }),
34943527 });
34953528
......@@ -3499,17 +3532,17 @@ fn transSignedArrayAccess(
34993532 });
35003533
35013534 const minuend = container_node;
3502 const signed_size = try Tag.int_cast.create(c.arena, .{
3535 const signed_size = try Tag.as.create(c.arena, .{
35033536 .lhs = try Tag.type.create(c.arena, "isize"),
3504 .rhs = tmp_ref,
3537 .rhs = try Tag.int_cast.create(c.arena, tmp_ref),
35053538 });
35063539 const to_cast = try Tag.add_wrap.create(c.arena, .{
35073540 .lhs = signed_size,
35083541 .rhs = try Tag.negate.create(c.arena, Tag.one_literal.init()),
35093542 });
3510 const bitcast_node = try Tag.bit_cast.create(c.arena, .{
3543 const bitcast_node = try Tag.as.create(c.arena, .{
35113544 .lhs = try Tag.type.create(c.arena, "usize"),
3512 .rhs = to_cast,
3545 .rhs = try Tag.bit_cast.create(c.arena, to_cast),
35133546 });
35143547 const subtrahend = try Tag.bit_not.create(c.arena, bitcast_node);
35153548 const difference = try Tag.sub.create(c.arena, .{
......@@ -3566,7 +3599,13 @@ fn transArrayAccess(c: *Context, scope: *Scope, stmt: *const clang.ArraySubscrip
35663599 const rhs = if (is_longlong or is_signed) blk: {
35673600 // check if long long first so that signed long long doesn't just become unsigned long long
35683601 const typeid_node = if (is_longlong) try Tag.type.create(c.arena, "usize") else try transQualTypeIntWidthOf(c, subscr_qt, false);
3569 break :blk try Tag.int_cast.create(c.arena, .{ .lhs = typeid_node, .rhs = try transExpr(c, scope, subscr_expr, .used) });
3602 break :blk try Tag.as.create(c.arena, .{
3603 .lhs = typeid_node,
3604 .rhs = try Tag.int_cast.create(
3605 c.arena,
3606 try transExpr(c, scope, subscr_expr, .used),
3607 ),
3608 });
35703609 } else try transExpr(c, scope, subscr_expr, .used);
35713610
35723611 const node = try Tag.array_access.create(c.arena, .{
......@@ -3968,8 +4007,7 @@ fn transCreateCompoundAssign(
39684007 }
39694008
39704009 if (is_shift) {
3971 const cast_to_type = try qualTypeToLog2IntRef(c, scope, rhs_qt, loc);
3972 rhs_node = try Tag.int_cast.create(c.arena, .{ .lhs = cast_to_type, .rhs = rhs_node });
4010 rhs_node = try Tag.int_cast.create(c.arena, rhs_node);
39734011 } else if (requires_int_cast) {
39744012 rhs_node = try transCCast(c, scope, loc, lhs_qt, rhs_qt, rhs_node);
39754013 }
......@@ -4008,8 +4046,7 @@ fn transCreateCompoundAssign(
40084046 try block_scope.statements.append(assign);
40094047 } else {
40104048 if (is_shift) {
4011 const cast_to_type = try qualTypeToLog2IntRef(c, &block_scope.base, rhs_qt, loc);
4012 rhs_node = try Tag.int_cast.create(c.arena, .{ .lhs = cast_to_type, .rhs = rhs_node });
4049 rhs_node = try Tag.int_cast.create(c.arena, rhs_node);
40134050 } else if (requires_int_cast) {
40144051 rhs_node = try transCCast(c, &block_scope.base, loc, lhs_qt, rhs_qt, rhs_node);
40154052 }
......@@ -4029,7 +4066,10 @@ fn transCreateCompoundAssign(
40294066// Casting away const or volatile requires us to use @ptrFromInt
40304067fn removeCVQualifiers(c: *Context, dst_type_node: Node, expr: Node) Error!Node {
40314068 const int_from_ptr = try Tag.int_from_ptr.create(c.arena, expr);
4032 return Tag.ptr_from_int.create(c.arena, .{ .lhs = dst_type_node, .rhs = int_from_ptr });
4069 return Tag.as.create(c.arena, .{
4070 .lhs = dst_type_node,
4071 .rhs = try Tag.ptr_from_int.create(c.arena, int_from_ptr),
4072 });
40334073}
40344074
40354075fn transCPtrCast(
......@@ -4062,11 +4102,12 @@ fn transCPtrCast(
40624102 // For opaque types a ptrCast is enough
40634103 expr
40644104 else blk: {
4065 const alignof = try Tag.std_meta_alignment.create(c.arena, dst_type_node);
4066 const align_cast = try Tag.align_cast.create(c.arena, .{ .lhs = alignof, .rhs = expr });
4067 break :blk align_cast;
4105 break :blk try Tag.align_cast.create(c.arena, expr);
40684106 };
4069 return Tag.ptr_cast.create(c.arena, .{ .lhs = dst_type_node, .rhs = rhs });
4107 return Tag.as.create(c.arena, .{
4108 .lhs = dst_type_node,
4109 .rhs = try Tag.ptr_cast.create(c.arena, rhs),
4110 });
40704111 }
40714112}
40724113
......@@ -4337,19 +4378,6 @@ fn qualTypeIntBitWidth(c: *Context, qt: clang.QualType) !u32 {
43374378 }
43384379}
43394380
4340fn qualTypeToLog2IntRef(c: *Context, scope: *Scope, qt: clang.QualType, source_loc: clang.SourceLocation) !Node {
4341 const int_bit_width = try qualTypeIntBitWidth(c, qt);
4342
4343 if (int_bit_width != 0) {
4344 // we can perform the log2 now.
4345 const cast_bit_width = math.log2_int(u64, int_bit_width);
4346 return Tag.log2_int_type.create(c.arena, cast_bit_width);
4347 }
4348
4349 const zig_type = try transQualType(c, scope, qt, source_loc);
4350 return Tag.std_math_Log2Int.create(c.arena, zig_type);
4351}
4352
43534381fn qualTypeChildIsFnProto(qt: clang.QualType) bool {
43544382 const ty = qualTypeCanon(qt);
43554383
......@@ -4731,14 +4759,12 @@ fn transCreateNodeShiftOp(
47314759
47324760 const lhs_expr = stmt.getLHS();
47334761 const rhs_expr = stmt.getRHS();
4734 const rhs_location = rhs_expr.getBeginLoc();
47354762 // lhs >> @as(u5, rh)
47364763
47374764 const lhs = try transExpr(c, scope, lhs_expr, .used);
47384765
4739 const rhs_type = try qualTypeToLog2IntRef(c, scope, stmt.getType(), rhs_location);
47404766 const rhs = try transExprCoercing(c, scope, rhs_expr, .used);
4741 const rhs_casted = try Tag.int_cast.create(c.arena, .{ .lhs = rhs_type, .rhs = rhs });
4767 const rhs_casted = try Tag.int_cast.create(c.arena, rhs);
47424768
47434769 return transCreateNodeInfixOp(c, op, lhs, rhs_casted, used);
47444770}
......@@ -6513,9 +6539,9 @@ fn parseCPostfixExpr(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ?Node)
65136539 },
65146540 .LBracket => {
65156541 const index_val = try macroIntFromBool(c, try parseCExpr(c, m, scope));
6516 const index = try Tag.int_cast.create(c.arena, .{
6542 const index = try Tag.as.create(c.arena, .{
65176543 .lhs = try Tag.type.create(c.arena, "usize"),
6518 .rhs = index_val,
6544 .rhs = try Tag.int_cast.create(c.arena, index_val),
65196545 });
65206546 node = try Tag.array_access.create(c.arena, .{ .lhs = node, .rhs = index });
65216547 try m.skip(c, .RBracket);
src/translate_c/ast.zig+27-61
......@@ -115,15 +115,10 @@ pub const Node = extern union {
115115
116116 /// @import("std").zig.c_builtins.<name>
117117 import_c_builtin,
118 log2_int_type,
119 /// @import("std").math.Log2Int(operand)
120 std_math_Log2Int,
121 /// @intCast(lhs, rhs)
118 /// @intCast(operand)
122119 int_cast,
123120 /// @import("std").zig.c_translation.promoteIntLiteral(value, type, base)
124121 helpers_promoteIntLiteral,
125 /// @import("std").meta.alignment(value)
126 std_meta_alignment,
127122 /// @import("std").zig.c_translation.signedRemainder(lhs, rhs)
128123 signed_remainder,
129124 /// @divTrunc(lhs, rhs)
......@@ -132,23 +127,23 @@ pub const Node = extern union {
132127 int_from_bool,
133128 /// @as(lhs, rhs)
134129 as,
135 /// @truncate(lhs, rhs)
130 /// @truncate(operand)
136131 truncate,
137 /// @bitCast(lhs, rhs)
132 /// @bitCast(operand)
138133 bit_cast,
139 /// @floatCast(lhs, rhs)
134 /// @floatCast(operand)
140135 float_cast,
141 /// @intFromFloat(lhs, rhs)
136 /// @intFromFloat(operand)
142137 int_from_float,
143 /// @floatFromInt(lhs, rhs)
138 /// @floatFromInt(operand)
144139 float_from_int,
145 /// @ptrFromInt(lhs, rhs)
140 /// @ptrFromInt(operand)
146141 ptr_from_int,
147142 /// @intFromPtr(operand)
148143 int_from_ptr,
149 /// @alignCast(lhs, rhs)
144 /// @alignCast(operand)
150145 align_cast,
151 /// @ptrCast(lhs, rhs)
146 /// @ptrCast(operand)
152147 ptr_cast,
153148 /// @divExact(lhs, rhs)
154149 div_exact,
......@@ -254,7 +249,6 @@ pub const Node = extern union {
254249 .@"comptime",
255250 .@"defer",
256251 .asm_simple,
257 .std_math_Log2Int,
258252 .negate,
259253 .negate_wrap,
260254 .bit_not,
......@@ -270,12 +264,20 @@ pub const Node = extern union {
270264 .switch_else,
271265 .block_single,
272266 .helpers_sizeof,
273 .std_meta_alignment,
274267 .int_from_bool,
275268 .sizeof,
276269 .alignof,
277270 .typeof,
278271 .typeinfo,
272 .align_cast,
273 .truncate,
274 .bit_cast,
275 .float_cast,
276 .int_from_float,
277 .float_from_int,
278 .ptr_from_int,
279 .ptr_cast,
280 .int_cast,
279281 => Payload.UnOp,
280282
281283 .add,
......@@ -314,24 +316,15 @@ pub const Node = extern union {
314316 .bit_xor_assign,
315317 .div_trunc,
316318 .signed_remainder,
317 .int_cast,
318319 .as,
319 .truncate,
320 .bit_cast,
321 .float_cast,
322 .int_from_float,
323 .float_from_int,
324 .ptr_from_int,
325320 .array_cat,
326321 .ellipsis3,
327322 .assign,
328 .align_cast,
329323 .array_access,
330324 .std_mem_zeroinit,
331325 .helpers_flexible_array_type,
332326 .helpers_shuffle_vector_index,
333327 .vector,
334 .ptr_cast,
335328 .div_exact,
336329 .offset_of,
337330 .helpers_cast,
......@@ -367,7 +360,6 @@ pub const Node = extern union {
367360 .c_pointer, .single_pointer => Payload.Pointer,
368361 .array_type, .null_sentinel_array_type => Payload.Array,
369362 .arg_redecl, .alias, .fail_decl => Payload.ArgRedecl,
370 .log2_int_type => Payload.Log2IntType,
371363 .var_simple, .pub_var_simple, .static_local_var, .mut_str => Payload.SimpleVarDecl,
372364 .enum_constant => Payload.EnumConstant,
373365 .array_filler => Payload.ArrayFiller,
......@@ -644,11 +636,6 @@ pub const Payload = struct {
644636 },
645637 };
646638
647 pub const Log2IntType = struct {
648 base: Payload,
649 data: std.math.Log2Int(u64),
650 };
651
652639 pub const SimpleVarDecl = struct {
653640 base: Payload,
654641 data: struct {
......@@ -885,11 +872,6 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
885872 try c.buf.append('\n');
886873 return @as(NodeIndex, 0); // error: integer value 0 cannot be coerced to type 'std.mem.Allocator.Error!u32'
887874 },
888 .std_math_Log2Int => {
889 const payload = node.castTag(.std_math_Log2Int).?.data;
890 const import_node = try renderStdImport(c, &.{ "math", "Log2Int" });
891 return renderCall(c, import_node, &.{payload});
892 },
893875 .helpers_cast => {
894876 const payload = node.castTag(.helpers_cast).?.data;
895877 const import_node = try renderStdImport(c, &.{ "zig", "c_translation", "cast" });
......@@ -900,11 +882,6 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
900882 const import_node = try renderStdImport(c, &.{ "zig", "c_translation", "promoteIntLiteral" });
901883 return renderCall(c, import_node, &.{ payload.type, payload.value, payload.base });
902884 },
903 .std_meta_alignment => {
904 const payload = node.castTag(.std_meta_alignment).?.data;
905 const import_node = try renderStdImport(c, &.{ "meta", "alignment" });
906 return renderCall(c, import_node, &.{payload});
907 },
908885 .helpers_sizeof => {
909886 const payload = node.castTag(.helpers_sizeof).?.data;
910887 const import_node = try renderStdImport(c, &.{ "zig", "c_translation", "sizeof" });
......@@ -1081,14 +1058,6 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
10811058 .data = undefined,
10821059 });
10831060 },
1084 .log2_int_type => {
1085 const payload = node.castTag(.log2_int_type).?.data;
1086 return c.addNode(.{
1087 .tag = .identifier,
1088 .main_token = try c.addTokenFmt(.identifier, "u{d}", .{payload}),
1089 .data = undefined,
1090 });
1091 },
10921061 .identifier => {
10931062 const payload = node.castTag(.identifier).?.data;
10941063 return c.addNode(.{
......@@ -1344,7 +1313,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
13441313 },
13451314 .int_cast => {
13461315 const payload = node.castTag(.int_cast).?.data;
1347 return renderBuiltinCall(c, "@intCast", &.{ payload.lhs, payload.rhs });
1316 return renderBuiltinCall(c, "@intCast", &.{payload});
13481317 },
13491318 .signed_remainder => {
13501319 const payload = node.castTag(.signed_remainder).?.data;
......@@ -1365,27 +1334,27 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
13651334 },
13661335 .truncate => {
13671336 const payload = node.castTag(.truncate).?.data;
1368 return renderBuiltinCall(c, "@truncate", &.{ payload.lhs, payload.rhs });
1337 return renderBuiltinCall(c, "@truncate", &.{payload});
13691338 },
13701339 .bit_cast => {
13711340 const payload = node.castTag(.bit_cast).?.data;
1372 return renderBuiltinCall(c, "@bitCast", &.{ payload.lhs, payload.rhs });
1341 return renderBuiltinCall(c, "@bitCast", &.{payload});
13731342 },
13741343 .float_cast => {
13751344 const payload = node.castTag(.float_cast).?.data;
1376 return renderBuiltinCall(c, "@floatCast", &.{ payload.lhs, payload.rhs });
1345 return renderBuiltinCall(c, "@floatCast", &.{payload});
13771346 },
13781347 .int_from_float => {
13791348 const payload = node.castTag(.int_from_float).?.data;
1380 return renderBuiltinCall(c, "@intFromFloat", &.{ payload.lhs, payload.rhs });
1349 return renderBuiltinCall(c, "@intFromFloat", &.{payload});
13811350 },
13821351 .float_from_int => {
13831352 const payload = node.castTag(.float_from_int).?.data;
1384 return renderBuiltinCall(c, "@floatFromInt", &.{ payload.lhs, payload.rhs });
1353 return renderBuiltinCall(c, "@floatFromInt", &.{payload});
13851354 },
13861355 .ptr_from_int => {
13871356 const payload = node.castTag(.ptr_from_int).?.data;
1388 return renderBuiltinCall(c, "@ptrFromInt", &.{ payload.lhs, payload.rhs });
1357 return renderBuiltinCall(c, "@ptrFromInt", &.{payload});
13891358 },
13901359 .int_from_ptr => {
13911360 const payload = node.castTag(.int_from_ptr).?.data;
......@@ -1393,11 +1362,11 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
13931362 },
13941363 .align_cast => {
13951364 const payload = node.castTag(.align_cast).?.data;
1396 return renderBuiltinCall(c, "@alignCast", &.{ payload.lhs, payload.rhs });
1365 return renderBuiltinCall(c, "@alignCast", &.{payload});
13971366 },
13981367 .ptr_cast => {
13991368 const payload = node.castTag(.ptr_cast).?.data;
1400 return renderBuiltinCall(c, "@ptrCast", &.{ payload.lhs, payload.rhs });
1369 return renderBuiltinCall(c, "@ptrCast", &.{payload});
14011370 },
14021371 .div_exact => {
14031372 const payload = node.castTag(.div_exact).?.data;
......@@ -2330,14 +2299,11 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex {
23302299 .float_from_int,
23312300 .ptr_from_int,
23322301 .std_mem_zeroes,
2333 .std_math_Log2Int,
2334 .log2_int_type,
23352302 .int_from_ptr,
23362303 .sizeof,
23372304 .alignof,
23382305 .typeof,
23392306 .typeinfo,
2340 .std_meta_alignment,
23412307 .vector,
23422308 .helpers_sizeof,
23432309 .helpers_cast,