authorgravatar for bratishkaerik@getgoogleoff.meEric Joldasov <bratishkaerik@getgoogleoff.me> 2023-06-14 20:27:03+06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-19 12:34:24-07:00
loga6c8ee5231230947c928bbe1c6a39eb6e1bb9c5b
tree02631a8f2b2b131116cba7e933ccb66f4da11cf9
parente6e8cacab904f10d6e5a773867826570783d0bf4

compiler: rename "@XToY" to "@YFromX", zig fmt: rewrite them

Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>

22 files changed, 339 insertions(+), 319 deletions(-)

lib/std/zig/render.zig+20
......@@ -1396,6 +1396,26 @@ fn renderBuiltinCall(
13961396 try ais.writer().writeAll("@max");
13971397 } else if (mem.eql(u8, slice, "@minimum")) {
13981398 try ais.writer().writeAll("@min");
1399 }
1400 //
1401 else if (mem.eql(u8, slice, "@boolToInt")) {
1402 try ais.writer().writeAll("@intFromBool");
1403 } else if (mem.eql(u8, slice, "@enumToInt")) {
1404 try ais.writer().writeAll("@intFromEnum");
1405 } else if (mem.eql(u8, slice, "@errorToInt")) {
1406 try ais.writer().writeAll("@intFromError");
1407 } else if (mem.eql(u8, slice, "@floatToInt")) {
1408 try ais.writer().writeAll("@intFromFloat");
1409 } else if (mem.eql(u8, slice, "@intToEnum")) {
1410 try ais.writer().writeAll("@enumFromInt");
1411 } else if (mem.eql(u8, slice, "@intToError")) {
1412 try ais.writer().writeAll("@errorFromInt");
1413 } else if (mem.eql(u8, slice, "@intToFloat")) {
1414 try ais.writer().writeAll("@floatFromInt");
1415 } else if (mem.eql(u8, slice, "@intToPtr")) {
1416 try ais.writer().writeAll("@ptrFromInt");
1417 } else if (mem.eql(u8, slice, "@ptrToInt")) {
1418 try ais.writer().writeAll("@intFromPtr");
13991419 } else {
14001420 try renderToken(ais, tree, builtin_token, .none); // @name
14011421 }
src/Air.zig+16-16
......@@ -478,11 +478,11 @@ pub const Inst = struct {
478478 /// Converts a pointer to its address. Result type is always `usize`.
479479 /// Pointer type size may be any, including slice.
480480 /// Uses the `un_op` field.
481 ptrtoint,
481 int_from_ptr,
482482 /// Given a boolean, returns 0 or 1.
483483 /// Result type is always `u1`.
484484 /// Uses the `un_op` field.
485 bool_to_int,
485 int_from_bool,
486486 /// Return a value from a function.
487487 /// Result type is always noreturn; no instructions in a block follow this one.
488488 /// Uses the `un_op` field.
......@@ -629,12 +629,12 @@ pub const Inst = struct {
629629 array_to_slice,
630630 /// Given a float operand, return the integer with the closest mathematical meaning.
631631 /// Uses the `ty_op` field.
632 float_to_int,
633 /// Same as `float_to_int` with optimized float mode.
634 float_to_int_optimized,
632 int_from_float,
633 /// Same as `int_from_float` with optimized float mode.
634 int_from_float_optimized,
635635 /// Given an integer operand, return the float with the closest mathematical meaning.
636636 /// Uses the `ty_op` field.
637 int_to_float,
637 float_from_int,
638638
639639 /// Transforms a vector into a scalar value by performing a sequential
640640 /// horizontal reduction of its elements using the specified operator.
......@@ -1337,9 +1337,9 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index, ip: *const InternPool) Type {
13371337 .struct_field_ptr_index_2,
13381338 .struct_field_ptr_index_3,
13391339 .array_to_slice,
1340 .float_to_int,
1341 .float_to_int_optimized,
1342 .int_to_float,
1340 .int_from_float,
1341 .int_from_float_optimized,
1342 .float_from_int,
13431343 .splat,
13441344 .get_union_tag,
13451345 .clz,
......@@ -1387,7 +1387,7 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index, ip: *const InternPool) Type {
13871387 .c_va_end,
13881388 => return Type.void,
13891389
1390 .ptrtoint,
1390 .int_from_ptr,
13911391 .slice_len,
13921392 .ret_addr,
13931393 .frame_addr,
......@@ -1397,7 +1397,7 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index, ip: *const InternPool) Type {
13971397 .wasm_memory_grow => return Type.i32,
13981398 .wasm_memory_size => return Type.u32,
13991399
1400 .bool_to_int => return Type.u1,
1400 .int_from_bool => return Type.u1,
14011401
14021402 .tag_name, .error_name => return Type.slice_const_u8_sentinel_0,
14031403
......@@ -1687,8 +1687,8 @@ pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool {
16871687 .is_non_err_ptr,
16881688 .bool_and,
16891689 .bool_or,
1690 .ptrtoint,
1691 .bool_to_int,
1690 .int_from_ptr,
1691 .int_from_bool,
16921692 .fptrunc,
16931693 .fpext,
16941694 .intcast,
......@@ -1718,9 +1718,9 @@ pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool {
17181718 .slice_elem_ptr,
17191719 .ptr_elem_ptr,
17201720 .array_to_slice,
1721 .float_to_int,
1722 .float_to_int_optimized,
1723 .int_to_float,
1721 .int_from_float,
1722 .int_from_float_optimized,
1723 .float_from_int,
17241724 .reduce,
17251725 .reduce_optimized,
17261726 .splat,
src/AstGen.zig+19-19
......@@ -2626,15 +2626,15 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As
26262626 .error_set_decl,
26272627 .error_set_decl_anon,
26282628 .error_set_decl_func,
2629 .int_to_enum,
2630 .enum_to_int,
2629 .enum_from_int,
2630 .int_from_enum,
26312631 .type_info,
26322632 .size_of,
26332633 .bit_size_of,
26342634 .typeof_log2_int_type,
2635 .ptr_to_int,
2635 .int_from_ptr,
26362636 .align_of,
2637 .bool_to_int,
2637 .int_from_bool,
26382638 .embed_file,
26392639 .error_name,
26402640 .sqrt,
......@@ -2655,9 +2655,9 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As
26552655 .type_name,
26562656 .frame_type,
26572657 .frame_size,
2658 .float_to_int,
2659 .int_to_float,
2660 .int_to_ptr,
2658 .int_from_float,
2659 .float_from_int,
2660 .ptr_from_int,
26612661 .float_cast,
26622662 .int_cast,
26632663 .ptr_cast,
......@@ -8281,11 +8281,11 @@ fn builtinCall(
82818281 .bit_size_of => return simpleUnOpType(gz, scope, ri, node, params[0], .bit_size_of),
82828282 .align_of => return simpleUnOpType(gz, scope, ri, node, params[0], .align_of),
82838283
8284 .ptr_to_int => return simpleUnOp(gz, scope, ri, node, .{ .rl = .none }, params[0], .ptr_to_int),
8284 .int_from_ptr => return simpleUnOp(gz, scope, ri, node, .{ .rl = .none }, params[0], .int_from_ptr),
82858285 .compile_error => return simpleUnOp(gz, scope, ri, node, .{ .rl = .{ .ty = .slice_const_u8_type } }, params[0], .compile_error),
82868286 .set_eval_branch_quota => return simpleUnOp(gz, scope, ri, node, .{ .rl = .{ .coerced_ty = .u32_type } }, params[0], .set_eval_branch_quota),
8287 .enum_to_int => return simpleUnOp(gz, scope, ri, node, .{ .rl = .none }, params[0], .enum_to_int),
8288 .bool_to_int => return simpleUnOp(gz, scope, ri, node, bool_ri, params[0], .bool_to_int),
8287 .int_from_enum => return simpleUnOp(gz, scope, ri, node, .{ .rl = .none }, params[0], .int_from_enum),
8288 .int_from_bool => return simpleUnOp(gz, scope, ri, node, bool_ri, params[0], .int_from_bool),
82898289 .embed_file => return simpleUnOp(gz, scope, ri, node, .{ .rl = .{ .ty = .slice_const_u8_type } }, params[0], .embed_file),
82908290 .error_name => return simpleUnOp(gz, scope, ri, node, .{ .rl = .{ .ty = .anyerror_type } }, params[0], .error_name),
82918291 .set_runtime_safety => return simpleUnOp(gz, scope, ri, node, bool_ri, params[0], .set_runtime_safety),
......@@ -8308,10 +8308,10 @@ fn builtinCall(
83088308 .Frame => return simpleUnOp(gz, scope, ri, node, .{ .rl = .none }, params[0], .frame_type),
83098309 .frame_size => return simpleUnOp(gz, scope, ri, node, .{ .rl = .none }, params[0], .frame_size),
83108310
8311 .float_to_int => return typeCast(gz, scope, ri, node, params[0], params[1], .float_to_int),
8312 .int_to_float => return typeCast(gz, scope, ri, node, params[0], params[1], .int_to_float),
8313 .int_to_ptr => return typeCast(gz, scope, ri, node, params[0], params[1], .int_to_ptr),
8314 .int_to_enum => return typeCast(gz, scope, ri, node, params[0], params[1], .int_to_enum),
8311 .int_from_float => return typeCast(gz, scope, ri, node, params[0], params[1], .int_from_float),
8312 .float_from_int => return typeCast(gz, scope, ri, node, params[0], params[1], .float_from_int),
8313 .ptr_from_int => return typeCast(gz, scope, ri, node, params[0], params[1], .ptr_from_int),
8314 .enum_from_int => return typeCast(gz, scope, ri, node, params[0], params[1], .enum_from_int),
83158315 .float_cast => return typeCast(gz, scope, ri, node, params[0], params[1], .float_cast),
83168316 .int_cast => return typeCast(gz, scope, ri, node, params[0], params[1], .int_cast),
83178317 .ptr_cast => return typeCast(gz, scope, ri, node, params[0], params[1], .ptr_cast),
......@@ -8352,17 +8352,17 @@ fn builtinCall(
83528352 _ = try gz.addNode(.trap, node);
83538353 return rvalue(gz, ri, .unreachable_value, node);
83548354 },
8355 .error_to_int => {
8355 .int_from_error => {
83568356 const operand = try expr(gz, scope, .{ .rl = .none }, params[0]);
8357 const result = try gz.addExtendedPayload(.error_to_int, Zir.Inst.UnNode{
8357 const result = try gz.addExtendedPayload(.int_from_error, Zir.Inst.UnNode{
83588358 .node = gz.nodeIndexToRelative(node),
83598359 .operand = operand,
83608360 });
83618361 return rvalue(gz, ri, result, node);
83628362 },
8363 .int_to_error => {
8363 .error_from_int => {
83648364 const operand = try expr(gz, scope, .{ .rl = .{ .coerced_ty = .u16_type } }, params[0]);
8365 const result = try gz.addExtendedPayload(.int_to_error, Zir.Inst.UnNode{
8365 const result = try gz.addExtendedPayload(.error_from_int, Zir.Inst.UnNode{
83668366 .node = gz.nodeIndexToRelative(node),
83678367 .operand = operand,
83688368 });
......@@ -8769,7 +8769,7 @@ fn simpleUnOp(
87698769 else
87708770 try expr(gz, scope, operand_ri, operand_node);
87718771 switch (tag) {
8772 .tag_name, .error_name, .ptr_to_int => try emitDbgStmt(gz, cursor),
8772 .tag_name, .error_name, .int_from_ptr => try emitDbgStmt(gz, cursor),
87738773 else => {},
87748774 }
87758775 const result = try gz.addUnNode(tag, operand, node);
src/Autodoc.zig+9-9
......@@ -1473,7 +1473,7 @@ fn walkInstruction(
14731473
14741474 // builtin functions
14751475 .align_of,
1476 .bool_to_int,
1476 .int_from_bool,
14771477 .embed_file,
14781478 .error_name,
14791479 .panic,
......@@ -1496,7 +1496,7 @@ fn walkInstruction(
14961496 .type_name,
14971497 .frame_type,
14981498 .frame_size,
1499 .ptr_to_int,
1499 .int_from_ptr,
15001500 .bit_not,
15011501 // @check
15021502 .clz,
......@@ -1521,10 +1521,10 @@ fn walkInstruction(
15211521 };
15221522 },
15231523
1524 .float_to_int,
1525 .int_to_float,
1526 .int_to_ptr,
1527 .int_to_enum,
1524 .int_from_float,
1525 .float_from_int,
1526 .ptr_from_int,
1527 .enum_from_int,
15281528 .float_cast,
15291529 .int_cast,
15301530 .ptr_cast,
......@@ -1936,7 +1936,7 @@ fn walkInstruction(
19361936 .expr = .{ .bitSizeOf = operand_index },
19371937 };
19381938 },
1939 .enum_to_int => {
1939 .int_from_enum => {
19401940 // not working correctly with `align()`
19411941 const un_node = data[inst_index].un_node;
19421942 const operand = try self.walkRef(
......@@ -3021,8 +3021,8 @@ fn walkInstruction(
30213021 },
30223022 };
30233023 },
3024 .error_to_int,
3025 .int_to_error,
3024 .int_from_error,
3025 .error_from_int,
30263026 .reify,
30273027 .const_cast,
30283028 .volatile_cast,
src/BuiltinFn.zig+27-27
......@@ -12,7 +12,7 @@ pub const Tag = enum {
1212 atomic_store,
1313 bit_cast,
1414 bit_offset_of,
15 bool_to_int,
15 int_from_bool,
1616 bit_size_of,
1717 breakpoint,
1818 mul_add,
......@@ -39,10 +39,10 @@ pub const Tag = enum {
3939 div_floor,
4040 div_trunc,
4141 embed_file,
42 enum_to_int,
42 int_from_enum,
4343 error_name,
4444 error_return_trace,
45 error_to_int,
45 int_from_error,
4646 err_set_cast,
4747 @"export",
4848 @"extern",
......@@ -50,7 +50,7 @@ pub const Tag = enum {
5050 field,
5151 field_parent_ptr,
5252 float_cast,
53 float_to_int,
53 int_from_float,
5454 frame,
5555 Frame,
5656 frame_address,
......@@ -60,10 +60,10 @@ pub const Tag = enum {
6060 import,
6161 in_comptime,
6262 int_cast,
63 int_to_enum,
64 int_to_error,
65 int_to_float,
66 int_to_ptr,
63 enum_from_int,
64 error_from_int,
65 float_from_int,
66 ptr_from_int,
6767 max,
6868 memcpy,
6969 memset,
......@@ -76,7 +76,7 @@ pub const Tag = enum {
7676 pop_count,
7777 prefetch,
7878 ptr_cast,
79 ptr_to_int,
79 int_from_ptr,
8080 rem,
8181 return_address,
8282 select,
......@@ -238,9 +238,9 @@ pub const list = list: {
238238 },
239239 },
240240 .{
241 "@boolToInt",
241 "@intFromBool",
242242 .{
243 .tag = .bool_to_int,
243 .tag = .int_from_bool,
244244 .param_count = 1,
245245 },
246246 },
......@@ -425,9 +425,9 @@ pub const list = list: {
425425 },
426426 },
427427 .{
428 "@enumToInt",
428 "@intFromEnum",
429429 .{
430 .tag = .enum_to_int,
430 .tag = .int_from_enum,
431431 .param_count = 1,
432432 },
433433 },
......@@ -446,9 +446,9 @@ pub const list = list: {
446446 },
447447 },
448448 .{
449 "@errorToInt",
449 "@intFromError",
450450 .{
451 .tag = .error_to_int,
451 .tag = .int_from_error,
452452 .param_count = 1,
453453 },
454454 },
......@@ -506,9 +506,9 @@ pub const list = list: {
506506 },
507507 },
508508 .{
509 "@floatToInt",
509 "@intFromFloat",
510510 .{
511 .tag = .float_to_int,
511 .tag = .int_from_float,
512512 .param_count = 2,
513513 },
514514 },
......@@ -576,31 +576,31 @@ pub const list = list: {
576576 },
577577 },
578578 .{
579 "@intToEnum",
579 "@enumFromInt",
580580 .{
581 .tag = .int_to_enum,
581 .tag = .enum_from_int,
582582 .param_count = 2,
583583 },
584584 },
585585 .{
586 "@intToError",
586 "@errorFromInt",
587587 .{
588 .tag = .int_to_error,
588 .tag = .error_from_int,
589589 .eval_to_error = .always,
590590 .param_count = 1,
591591 },
592592 },
593593 .{
594 "@intToFloat",
594 "@floatFromInt",
595595 .{
596 .tag = .int_to_float,
596 .tag = .float_from_int,
597597 .param_count = 2,
598598 },
599599 },
600600 .{
601 "@intToPtr",
601 "@ptrFromInt",
602602 .{
603 .tag = .int_to_ptr,
603 .tag = .ptr_from_int,
604604 .param_count = 2,
605605 },
606606 },
......@@ -689,9 +689,9 @@ pub const list = list: {
689689 },
690690 },
691691 .{
692 "@ptrToInt",
692 "@intFromPtr",
693693 .{
694 .tag = .ptr_to_int,
694 .tag = .int_from_ptr,
695695 .param_count = 1,
696696 },
697697 },
src/Liveness.zig+10-10
......@@ -371,9 +371,9 @@ pub fn categorizeOperand(
371371 .struct_field_ptr_index_2,
372372 .struct_field_ptr_index_3,
373373 .array_to_slice,
374 .float_to_int,
375 .float_to_int_optimized,
376 .int_to_float,
374 .int_from_float,
375 .int_from_float_optimized,
376 .float_from_int,
377377 .get_union_tag,
378378 .clz,
379379 .ctz,
......@@ -407,8 +407,8 @@ pub fn categorizeOperand(
407407 .is_non_err,
408408 .is_err_ptr,
409409 .is_non_err_ptr,
410 .ptrtoint,
411 .bool_to_int,
410 .int_from_ptr,
411 .int_from_bool,
412412 .is_named_enum_value,
413413 .tag_name,
414414 .error_name,
......@@ -1007,9 +1007,9 @@ fn analyzeInst(
10071007 .struct_field_ptr_index_2,
10081008 .struct_field_ptr_index_3,
10091009 .array_to_slice,
1010 .float_to_int,
1011 .float_to_int_optimized,
1012 .int_to_float,
1010 .int_from_float,
1011 .int_from_float_optimized,
1012 .float_from_int,
10131013 .get_union_tag,
10141014 .clz,
10151015 .ctz,
......@@ -1034,8 +1034,8 @@ fn analyzeInst(
10341034 .is_non_err,
10351035 .is_err_ptr,
10361036 .is_non_err_ptr,
1037 .ptrtoint,
1038 .bool_to_int,
1037 .int_from_ptr,
1038 .int_from_bool,
10391039 .is_named_enum_value,
10401040 .tag_name,
10411041 .error_name,
src/Liveness/Verify.zig+5-5
......@@ -97,9 +97,9 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void {
9797 .struct_field_ptr_index_2,
9898 .struct_field_ptr_index_3,
9999 .array_to_slice,
100 .float_to_int,
101 .float_to_int_optimized,
102 .int_to_float,
100 .int_from_float,
101 .int_from_float_optimized,
102 .float_from_int,
103103 .get_union_tag,
104104 .clz,
105105 .ctz,
......@@ -123,8 +123,8 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void {
123123 .is_non_err,
124124 .is_err_ptr,
125125 .is_non_err_ptr,
126 .ptrtoint,
127 .bool_to_int,
126 .int_from_ptr,
127 .int_from_bool,
128128 .is_named_enum_value,
129129 .tag_name,
130130 .error_name,
src/Sema.zig+26-26
......@@ -961,8 +961,8 @@ fn analyzeBodyInner(
961961 .elem_val_node => try sema.zirElemValNode(block, inst),
962962 .elem_type_index => try sema.zirElemTypeIndex(block, inst),
963963 .enum_literal => try sema.zirEnumLiteral(block, inst),
964 .enum_to_int => try sema.zirEnumToInt(block, inst),
965 .int_to_enum => try sema.zirIntToEnum(block, inst),
964 .int_from_enum => try sema.zirIntFromEnum(block, inst),
965 .enum_from_int => try sema.zirEnumFromInt(block, inst),
966966 .err_union_code => try sema.zirErrUnionCode(block, inst),
967967 .err_union_code_ptr => try sema.zirErrUnionCodePtr(block, inst),
968968 .err_union_payload_unsafe => try sema.zirErrUnionPayload(block, inst),
......@@ -1028,18 +1028,18 @@ fn analyzeBodyInner(
10281028 .union_init => try sema.zirUnionInit(block, inst),
10291029 .field_type => try sema.zirFieldType(block, inst),
10301030 .field_type_ref => try sema.zirFieldTypeRef(block, inst),
1031 .ptr_to_int => try sema.zirPtrToInt(block, inst),
1031 .int_from_ptr => try sema.zirIntFromPtr(block, inst),
10321032 .align_of => try sema.zirAlignOf(block, inst),
1033 .bool_to_int => try sema.zirBoolToInt(block, inst),
1033 .int_from_bool => try sema.zirIntFromBool(block, inst),
10341034 .embed_file => try sema.zirEmbedFile(block, inst),
10351035 .error_name => try sema.zirErrorName(block, inst),
10361036 .tag_name => try sema.zirTagName(block, inst),
10371037 .type_name => try sema.zirTypeName(block, inst),
10381038 .frame_type => try sema.zirFrameType(block, inst),
10391039 .frame_size => try sema.zirFrameSize(block, inst),
1040 .float_to_int => try sema.zirFloatToInt(block, inst),
1041 .int_to_float => try sema.zirIntToFloat(block, inst),
1042 .int_to_ptr => try sema.zirIntToPtr(block, inst),
1040 .int_from_float => try sema.zirIntFromFloat(block, inst),
1041 .float_from_int => try sema.zirFloatFromInt(block, inst),
1042 .ptr_from_int => try sema.zirPtrFromInt(block, inst),
10431043 .float_cast => try sema.zirFloatCast(block, inst),
10441044 .int_cast => try sema.zirIntCast(block, inst),
10451045 .ptr_cast => try sema.zirPtrCast(block, inst),
......@@ -1167,8 +1167,8 @@ fn analyzeBodyInner(
11671167 .err_set_cast => try sema.zirErrSetCast( block, extended),
11681168 .await_nosuspend => try sema.zirAwaitNosuspend( block, extended),
11691169 .select => try sema.zirSelect( block, extended),
1170 .error_to_int => try sema.zirErrorToInt( block, extended),
1171 .int_to_error => try sema.zirIntToError( block, extended),
1170 .int_from_error => try sema.zirIntFromError( block, extended),
1171 .error_from_int => try sema.zirErrorFromInt( block, extended),
11721172 .reify => try sema.zirReify( block, extended, inst),
11731173 .builtin_async_call => try sema.zirBuiltinAsyncCall( block, extended),
11741174 .cmpxchg => try sema.zirCmpxchg( block, extended),
......@@ -8116,7 +8116,7 @@ fn zirErrorValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
81168116 } })).toValue());
81178117}
81188118
8119fn zirErrorToInt(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref {
8119fn zirIntFromError(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref {
81208120 const tracy = trace(@src());
81218121 defer tracy.end();
81228122
......@@ -8156,7 +8156,7 @@ fn zirErrorToInt(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat
81568156 return block.addBitCast(Type.err_int, operand);
81578157}
81588158
8159fn zirIntToError(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref {
8159fn zirErrorFromInt(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref {
81608160 const tracy = trace(@src());
81618161 defer tracy.end();
81628162
......@@ -8258,7 +8258,7 @@ fn zirEnumLiteral(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
82588258 })).toValue());
82598259}
82608260
8261fn zirEnumToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
8261fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
82628262 const mod = sema.mod;
82638263 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
82648264 const src = inst_data.src();
......@@ -8303,7 +8303,7 @@ fn zirEnumToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
83038303 return block.addBitCast(int_tag_ty, enum_tag);
83048304}
83058305
8306fn zirIntToEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
8306fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
83078307 const mod = sema.mod;
83088308 const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
83098309 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
......@@ -9518,7 +9518,7 @@ fn analyzeAs(
95189518 };
95199519}
95209520
9521fn zirPtrToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
9521fn zirIntFromPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
95229522 const tracy = trace(@src());
95239523 defer tracy.end();
95249524
......@@ -9537,7 +9537,7 @@ fn zirPtrToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
95379537 );
95389538 }
95399539 try sema.requireRuntimeBlock(block, inst_data.src(), ptr_src);
9540 return block.addUnOp(.ptrtoint, ptr);
9540 return block.addUnOp(.int_from_ptr, ptr);
95419541}
95429542
95439543fn zirFieldVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
......@@ -19426,7 +19426,7 @@ fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1942619426 return sema.addConstant(Type.comptime_int, val);
1942719427}
1942819428
19429fn zirBoolToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
19429fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
1943019430 const mod = sema.mod;
1943119431 const inst_data = sema.code.instructions.items(.data)[inst].un_node;
1943219432 const operand = try sema.resolveInst(inst_data.operand);
......@@ -19435,7 +19435,7 @@ fn zirBoolToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
1943519435 if (val.toBool()) return sema.addConstant(Type.u1, try mod.intValue(Type.u1, 1));
1943619436 return sema.addConstant(Type.u1, try mod.intValue(Type.u1, 0));
1943719437 }
19438 return block.addUnOp(.bool_to_int, operand);
19438 return block.addUnOp(.int_from_bool, operand);
1943919439}
1944019440
1944119441fn zirErrorName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
......@@ -20748,7 +20748,7 @@ fn zirFrameSize(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
2074820748 return sema.failWithUseOfAsync(block, src);
2074920749}
2075020750
20751fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
20751fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
2075220752 const mod = sema.mod;
2075320753 const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
2075420754 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
......@@ -20776,9 +20776,9 @@ fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
2077620776 }
2077720777 return sema.addConstant(dest_ty, try mod.intValue(dest_ty, 0));
2077820778 }
20779 const result = try block.addTyOp(if (block.float_mode == .Optimized) .float_to_int_optimized else .float_to_int, dest_ty, operand);
20779 const result = try block.addTyOp(if (block.float_mode == .Optimized) .int_from_float_optimized else .int_from_float, dest_ty, operand);
2078020780 if (block.wantSafety()) {
20781 const back = try block.addTyOp(.int_to_float, operand_ty, result);
20781 const back = try block.addTyOp(.float_from_int, operand_ty, result);
2078220782 const diff = try block.addBinOp(.sub, operand, back);
2078320783 const ok_pos = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_lt_optimized else .cmp_lt, diff, try sema.addConstant(operand_ty, try mod.floatValue(operand_ty, 1.0)));
2078420784 const ok_neg = try block.addBinOp(if (block.float_mode == .Optimized) .cmp_gt_optimized else .cmp_gt, diff, try sema.addConstant(operand_ty, try mod.floatValue(operand_ty, -1.0)));
......@@ -20788,7 +20788,7 @@ fn zirFloatToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
2078820788 return result;
2078920789}
2079020790
20791fn zirIntToFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
20791fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
2079220792 const mod = sema.mod;
2079320793 const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
2079420794 const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data;
......@@ -20809,10 +20809,10 @@ fn zirIntToFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
2080920809 }
2081020810
2081120811 try sema.requireRuntimeBlock(block, inst_data.src(), operand_src);
20812 return block.addTyOp(.int_to_float, dest_ty, operand);
20812 return block.addTyOp(.float_from_int, dest_ty, operand);
2081320813}
2081420814
20815fn zirIntToPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
20815fn zirPtrFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref {
2081620816 const mod = sema.mod;
2081720817 const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
2081820818 const src = inst_data.src();
......@@ -21084,7 +21084,7 @@ fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
2108421084 if (block.wantSafety() and operand_ty.ptrAllowsZero(mod) and !dest_ty.ptrAllowsZero(mod) and
2108521085 (try sema.typeHasRuntimeBits(dest_ty.elemType2(mod)) or dest_ty.elemType2(mod).zigTypeTag(mod) == .Fn))
2108621086 {
21087 const ptr_int = try block.addUnOp(.ptrtoint, ptr);
21087 const ptr_int = try block.addUnOp(.int_from_ptr, ptr);
2108821088 const is_non_zero = try block.addBinOp(.cmp_neq, ptr_int, .zero_usize);
2108921089 const ok = if (operand_is_slice) ok: {
2109021090 const len = try sema.analyzeSliceLen(block, operand_src, operand);
......@@ -21265,7 +21265,7 @@ fn zirAlignCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
2126521265 try sema.analyzeSlicePtr(block, ptr_src, ptr, ptr_ty)
2126621266 else
2126721267 ptr;
21268 const ptr_int = try block.addUnOp(.ptrtoint, actual_ptr);
21268 const ptr_int = try block.addUnOp(.int_from_ptr, actual_ptr);
2126921269 const remainder = try block.addBinOp(.bit_and, ptr_int, align_minus_1);
2127021270 const is_aligned = try block.addBinOp(.cmp_eq, remainder, .zero_usize);
2127121271 const ok = if (ptr_ty.isSlice(mod)) ok: {
......@@ -29504,7 +29504,7 @@ fn coerceCompatiblePtrs(
2950429504 try sema.analyzeSlicePtr(block, inst_src, inst, inst_ty)
2950529505 else
2950629506 inst;
29507 const ptr_int = try block.addUnOp(.ptrtoint, actual_ptr);
29507 const ptr_int = try block.addUnOp(.int_from_ptr, actual_ptr);
2950829508 const is_non_zero = try block.addBinOp(.cmp_neq, ptr_int, .zero_usize);
2950929509 const ok = if (inst_ty.isSlice(mod)) ok: {
2951029510 const len = try sema.analyzeSliceLen(block, inst_src, inst);
src/Zir.zig+35-35
......@@ -749,9 +749,9 @@ pub const Inst = struct {
749749 /// Implements the `@bitSizeOf` builtin. Uses `un_node`.
750750 bit_size_of,
751751
752 /// Implement builtin `@ptrToInt`. Uses `un_node`.
752 /// Implement builtin `@intFromPtr`. Uses `un_node`.
753753 /// Convert a pointer to a `usize` integer.
754 ptr_to_int,
754 int_from_ptr,
755755 /// Emit an error message and fail compilation.
756756 /// Uses the `un_node` field.
757757 compile_error,
......@@ -761,11 +761,11 @@ pub const Inst = struct {
761761 set_eval_branch_quota,
762762 /// Converts an enum value into an integer. Resulting type will be the tag type
763763 /// of the enum. Uses `un_node`.
764 enum_to_int,
764 int_from_enum,
765765 /// Implement builtin `@alignOf`. Uses `un_node`.
766766 align_of,
767 /// Implement builtin `@boolToInt`. Uses `un_node`.
768 bool_to_int,
767 /// Implement builtin `@intFromBool`. Uses `un_node`.
768 int_from_bool,
769769 /// Implement builtin `@embedFile`. Uses `un_node`.
770770 embed_file,
771771 /// Implement builtin `@errorName`. Uses `un_node`.
......@@ -814,18 +814,18 @@ pub const Inst = struct {
814814 /// Implement builtin `@frameSize`. Uses `un_node`.
815815 frame_size,
816816
817 /// Implements the `@floatToInt` builtin.
817 /// Implements the `@intFromFloat` builtin.
818818 /// Uses `pl_node` with payload `Bin`. `lhs` is dest type, `rhs` is operand.
819 float_to_int,
820 /// Implements the `@intToFloat` builtin.
819 int_from_float,
820 /// Implements the `@floatFromInt` builtin.
821821 /// Uses `pl_node` with payload `Bin`. `lhs` is dest type, `rhs` is operand.
822 int_to_float,
823 /// Implements the `@intToPtr` builtin.
822 float_from_int,
823 /// Implements the `@ptrFromInt` builtin.
824824 /// Uses `pl_node` with payload `Bin`. `lhs` is dest type, `rhs` is operand.
825 int_to_ptr,
825 ptr_from_int,
826826 /// Converts an integer into an enum value.
827827 /// Uses `pl_node` with payload `Bin`. `lhs` is dest type, `rhs` is operand.
828 int_to_enum,
828 enum_from_int,
829829 /// Convert a larger float type to any other float type, possibly causing
830830 /// a loss of precision.
831831 /// Uses the `pl_node` field. AST is the `@floatCast` syntax.
......@@ -1136,14 +1136,14 @@ pub const Inst = struct {
11361136 .union_init,
11371137 .field_type,
11381138 .field_type_ref,
1139 .int_to_enum,
1140 .enum_to_int,
1139 .enum_from_int,
1140 .int_from_enum,
11411141 .type_info,
11421142 .size_of,
11431143 .bit_size_of,
1144 .ptr_to_int,
1144 .int_from_ptr,
11451145 .align_of,
1146 .bool_to_int,
1146 .int_from_bool,
11471147 .embed_file,
11481148 .error_name,
11491149 .set_runtime_safety,
......@@ -1165,9 +1165,9 @@ pub const Inst = struct {
11651165 .type_name,
11661166 .frame_type,
11671167 .frame_size,
1168 .float_to_int,
1169 .int_to_float,
1170 .int_to_ptr,
1168 .int_from_float,
1169 .float_from_int,
1170 .ptr_from_int,
11711171 .float_cast,
11721172 .int_cast,
11731173 .ptr_cast,
......@@ -1419,14 +1419,14 @@ pub const Inst = struct {
14191419 .union_init,
14201420 .field_type,
14211421 .field_type_ref,
1422 .int_to_enum,
1423 .enum_to_int,
1422 .enum_from_int,
1423 .int_from_enum,
14241424 .type_info,
14251425 .size_of,
14261426 .bit_size_of,
1427 .ptr_to_int,
1427 .int_from_ptr,
14281428 .align_of,
1429 .bool_to_int,
1429 .int_from_bool,
14301430 .embed_file,
14311431 .error_name,
14321432 .sqrt,
......@@ -1447,9 +1447,9 @@ pub const Inst = struct {
14471447 .type_name,
14481448 .frame_type,
14491449 .frame_size,
1450 .float_to_int,
1451 .int_to_float,
1452 .int_to_ptr,
1450 .int_from_float,
1451 .float_from_int,
1452 .ptr_from_int,
14531453 .float_cast,
14541454 .int_cast,
14551455 .ptr_cast,
......@@ -1679,12 +1679,12 @@ pub const Inst = struct {
16791679 .size_of = .un_node,
16801680 .bit_size_of = .un_node,
16811681
1682 .ptr_to_int = .un_node,
1682 .int_from_ptr = .un_node,
16831683 .compile_error = .un_node,
16841684 .set_eval_branch_quota = .un_node,
1685 .enum_to_int = .un_node,
1685 .int_from_enum = .un_node,
16861686 .align_of = .un_node,
1687 .bool_to_int = .un_node,
1687 .int_from_bool = .un_node,
16881688 .embed_file = .un_node,
16891689 .error_name = .un_node,
16901690 .panic = .un_node,
......@@ -1709,10 +1709,10 @@ pub const Inst = struct {
17091709 .frame_type = .un_node,
17101710 .frame_size = .un_node,
17111711
1712 .float_to_int = .pl_node,
1713 .int_to_float = .pl_node,
1714 .int_to_ptr = .pl_node,
1715 .int_to_enum = .pl_node,
1712 .int_from_float = .pl_node,
1713 .float_from_int = .pl_node,
1714 .ptr_from_int = .pl_node,
1715 .enum_from_int = .pl_node,
17161716 .float_cast = .pl_node,
17171717 .int_cast = .pl_node,
17181718 .ptr_cast = .pl_node,
......@@ -1933,10 +1933,10 @@ pub const Inst = struct {
19331933 select,
19341934 /// Implement builtin `@errToInt`.
19351935 /// `operand` is payload index to `UnNode`.
1936 error_to_int,
1936 int_from_error,
19371937 /// Implement builtin `@intToError`.
19381938 /// `operand` is payload index to `UnNode`.
1939 int_to_error,
1939 error_from_int,
19401940 /// Implement builtin `@Type`.
19411941 /// `operand` is payload index to `UnNode`.
19421942 /// `small` contains `NameStrategy`.
src/arch/aarch64/CodeGen.zig+11-11
......@@ -752,7 +752,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
752752 .fpext => try self.airFpext(inst),
753753 .intcast => try self.airIntCast(inst),
754754 .trunc => try self.airTrunc(inst),
755 .bool_to_int => try self.airBoolToInt(inst),
755 .int_from_bool => try self.airIntFromBool(inst),
756756 .is_non_null => try self.airIsNonNull(inst),
757757 .is_non_null_ptr => try self.airIsNonNullPtr(inst),
758758 .is_null => try self.airIsNull(inst),
......@@ -764,7 +764,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
764764 .load => try self.airLoad(inst),
765765 .loop => try self.airLoop(inst),
766766 .not => try self.airNot(inst),
767 .ptrtoint => try self.airPtrToInt(inst),
767 .int_from_ptr => try self.airIntFromPtr(inst),
768768 .ret => try self.airRet(inst),
769769 .ret_load => try self.airRetLoad(inst),
770770 .store => try self.airStore(inst, false),
......@@ -772,8 +772,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
772772 .struct_field_ptr=> try self.airStructFieldPtr(inst),
773773 .struct_field_val=> try self.airStructFieldVal(inst),
774774 .array_to_slice => try self.airArrayToSlice(inst),
775 .int_to_float => try self.airIntToFloat(inst),
776 .float_to_int => try self.airFloatToInt(inst),
775 .float_from_int => try self.airFloatFromInt(inst),
776 .int_from_float => try self.airIntFromFloat(inst),
777777 .cmpxchg_strong => try self.airCmpxchg(inst),
778778 .cmpxchg_weak => try self.airCmpxchg(inst),
779779 .atomic_rmw => try self.airAtomicRmw(inst),
......@@ -885,7 +885,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
885885 .cmp_neq_optimized,
886886 .cmp_vector_optimized,
887887 .reduce_optimized,
888 .float_to_int_optimized,
888 .int_from_float_optimized,
889889 => return self.fail("TODO implement optimized float mode", .{}),
890890
891891 .is_named_enum_value => return self.fail("TODO implement is_named_enum_value", .{}),
......@@ -1310,7 +1310,7 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
13101310 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
13111311}
13121312
1313fn airBoolToInt(self: *Self, inst: Air.Inst.Index) !void {
1313fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void {
13141314 const un_op = self.air.instructions.items(.data)[inst].un_op;
13151315 const operand = try self.resolveInst(un_op);
13161316 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else operand;
......@@ -5903,7 +5903,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I
59035903 }
59045904}
59055905
5906fn airPtrToInt(self: *Self, inst: Air.Inst.Index) !void {
5906fn airIntFromPtr(self: *Self, inst: Air.Inst.Index) !void {
59075907 const un_op = self.air.instructions.items(.data)[inst].un_op;
59085908 const result = try self.resolveInst(un_op);
59095909 return self.finishAir(inst, result, .{ un_op, .none, .none });
......@@ -5950,17 +5950,17 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
59505950 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
59515951}
59525952
5953fn airIntToFloat(self: *Self, inst: Air.Inst.Index) !void {
5953fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
59545954 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
5955 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntToFloat for {}", .{
5955 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatFromInt for {}", .{
59565956 self.target.cpu.arch,
59575957 });
59585958 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
59595959}
59605960
5961fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {
5961fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
59625962 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
5963 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatToInt for {}", .{
5963 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntFromFloat for {}", .{
59645964 self.target.cpu.arch,
59655965 });
59665966 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
src/arch/arm/CodeGen.zig+11-11
......@@ -736,7 +736,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
736736 .fpext => try self.airFpext(inst),
737737 .intcast => try self.airIntCast(inst),
738738 .trunc => try self.airTrunc(inst),
739 .bool_to_int => try self.airBoolToInt(inst),
739 .int_from_bool => try self.airIntFromBool(inst),
740740 .is_non_null => try self.airIsNonNull(inst),
741741 .is_non_null_ptr => try self.airIsNonNullPtr(inst),
742742 .is_null => try self.airIsNull(inst),
......@@ -748,7 +748,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
748748 .load => try self.airLoad(inst),
749749 .loop => try self.airLoop(inst),
750750 .not => try self.airNot(inst),
751 .ptrtoint => try self.airPtrToInt(inst),
751 .int_from_ptr => try self.airIntFromPtr(inst),
752752 .ret => try self.airRet(inst),
753753 .ret_load => try self.airRetLoad(inst),
754754 .store => try self.airStore(inst, false),
......@@ -756,8 +756,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
756756 .struct_field_ptr=> try self.airStructFieldPtr(inst),
757757 .struct_field_val=> try self.airStructFieldVal(inst),
758758 .array_to_slice => try self.airArrayToSlice(inst),
759 .int_to_float => try self.airIntToFloat(inst),
760 .float_to_int => try self.airFloatToInt(inst),
759 .float_from_int => try self.airFloatFromInt(inst),
760 .int_from_float => try self.airIntFromFloat(inst),
761761 .cmpxchg_strong => try self.airCmpxchg(inst),
762762 .cmpxchg_weak => try self.airCmpxchg(inst),
763763 .atomic_rmw => try self.airAtomicRmw(inst),
......@@ -869,7 +869,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
869869 .cmp_neq_optimized,
870870 .cmp_vector_optimized,
871871 .reduce_optimized,
872 .float_to_int_optimized,
872 .int_from_float_optimized,
873873 => return self.fail("TODO implement optimized float mode", .{}),
874874
875875 .is_named_enum_value => return self.fail("TODO implement is_named_enum_value", .{}),
......@@ -1269,7 +1269,7 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
12691269 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
12701270}
12711271
1272fn airBoolToInt(self: *Self, inst: Air.Inst.Index) !void {
1272fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void {
12731273 const un_op = self.air.instructions.items(.data)[inst].un_op;
12741274 const operand = try self.resolveInst(un_op);
12751275 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else operand;
......@@ -5857,7 +5857,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I
58575857 }
58585858}
58595859
5860fn airPtrToInt(self: *Self, inst: Air.Inst.Index) !void {
5860fn airIntFromPtr(self: *Self, inst: Air.Inst.Index) !void {
58615861 const un_op = self.air.instructions.items(.data)[inst].un_op;
58625862 const result = try self.resolveInst(un_op);
58635863 return self.finishAir(inst, result, .{ un_op, .none, .none });
......@@ -5903,17 +5903,17 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
59035903 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
59045904}
59055905
5906fn airIntToFloat(self: *Self, inst: Air.Inst.Index) !void {
5906fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
59075907 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
5908 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntToFloat for {}", .{
5908 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatFromInt for {}", .{
59095909 self.target.cpu.arch,
59105910 });
59115911 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
59125912}
59135913
5914fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {
5914fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
59155915 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
5916 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatToInt for {}", .{
5916 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntFromFloat for {}", .{
59175917 self.target.cpu.arch,
59185918 });
59195919 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
src/arch/riscv64/CodeGen.zig+11-11
......@@ -566,7 +566,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
566566 .fpext => try self.airFpext(inst),
567567 .intcast => try self.airIntCast(inst),
568568 .trunc => try self.airTrunc(inst),
569 .bool_to_int => try self.airBoolToInt(inst),
569 .int_from_bool => try self.airIntFromBool(inst),
570570 .is_non_null => try self.airIsNonNull(inst),
571571 .is_non_null_ptr => try self.airIsNonNullPtr(inst),
572572 .is_null => try self.airIsNull(inst),
......@@ -578,7 +578,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
578578 .load => try self.airLoad(inst),
579579 .loop => try self.airLoop(inst),
580580 .not => try self.airNot(inst),
581 .ptrtoint => try self.airPtrToInt(inst),
581 .int_from_ptr => try self.airIntFromPtr(inst),
582582 .ret => try self.airRet(inst),
583583 .ret_load => try self.airRetLoad(inst),
584584 .store => try self.airStore(inst, false),
......@@ -586,8 +586,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
586586 .struct_field_ptr=> try self.airStructFieldPtr(inst),
587587 .struct_field_val=> try self.airStructFieldVal(inst),
588588 .array_to_slice => try self.airArrayToSlice(inst),
589 .int_to_float => try self.airIntToFloat(inst),
590 .float_to_int => try self.airFloatToInt(inst),
589 .float_from_int => try self.airFloatFromInt(inst),
590 .int_from_float => try self.airIntFromFloat(inst),
591591 .cmpxchg_strong => try self.airCmpxchg(inst),
592592 .cmpxchg_weak => try self.airCmpxchg(inst),
593593 .atomic_rmw => try self.airAtomicRmw(inst),
......@@ -699,7 +699,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
699699 .cmp_neq_optimized,
700700 .cmp_vector_optimized,
701701 .reduce_optimized,
702 .float_to_int_optimized,
702 .int_from_float_optimized,
703703 => return self.fail("TODO implement optimized float mode", .{}),
704704
705705 .is_named_enum_value => return self.fail("TODO implement is_named_enum_value", .{}),
......@@ -920,7 +920,7 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
920920 // return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
921921}
922922
923fn airBoolToInt(self: *Self, inst: Air.Inst.Index) !void {
923fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void {
924924 const un_op = self.air.instructions.items(.data)[inst].un_op;
925925 const operand = try self.resolveInst(un_op);
926926 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else operand;
......@@ -2361,7 +2361,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void
23612361 }
23622362}
23632363
2364fn airPtrToInt(self: *Self, inst: Air.Inst.Index) !void {
2364fn airIntFromPtr(self: *Self, inst: Air.Inst.Index) !void {
23652365 const un_op = self.air.instructions.items(.data)[inst].un_op;
23662366 const result = try self.resolveInst(un_op);
23672367 return self.finishAir(inst, result, .{ un_op, .none, .none });
......@@ -2394,17 +2394,17 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
23942394 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
23952395}
23962396
2397fn airIntToFloat(self: *Self, inst: Air.Inst.Index) !void {
2397fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
23982398 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
2399 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntToFloat for {}", .{
2399 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatFromInt for {}", .{
24002400 self.target.cpu.arch,
24012401 });
24022402 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
24032403}
24042404
2405fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {
2405fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
24062406 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
2407 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatToInt for {}", .{
2407 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntFromFloat for {}", .{
24082408 self.target.cpu.arch,
24092409 });
24102410 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
src/arch/sparc64/CodeGen.zig+11-11
......@@ -583,7 +583,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
583583 .fpext => @panic("TODO try self.airFpext(inst)"),
584584 .intcast => try self.airIntCast(inst),
585585 .trunc => try self.airTrunc(inst),
586 .bool_to_int => try self.airBoolToInt(inst),
586 .int_from_bool => try self.airIntFromBool(inst),
587587 .is_non_null => try self.airIsNonNull(inst),
588588 .is_non_null_ptr => @panic("TODO try self.airIsNonNullPtr(inst)"),
589589 .is_null => try self.airIsNull(inst),
......@@ -595,7 +595,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
595595 .load => try self.airLoad(inst),
596596 .loop => try self.airLoop(inst),
597597 .not => try self.airNot(inst),
598 .ptrtoint => try self.airPtrToInt(inst),
598 .int_from_ptr => try self.airIntFromPtr(inst),
599599 .ret => try self.airRet(inst),
600600 .ret_load => try self.airRetLoad(inst),
601601 .store => try self.airStore(inst, false),
......@@ -603,8 +603,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
603603 .struct_field_ptr=> try self.airStructFieldPtr(inst),
604604 .struct_field_val=> try self.airStructFieldVal(inst),
605605 .array_to_slice => try self.airArrayToSlice(inst),
606 .int_to_float => try self.airIntToFloat(inst),
607 .float_to_int => try self.airFloatToInt(inst),
606 .float_from_int => try self.airFloatFromInt(inst),
607 .int_from_float => try self.airIntFromFloat(inst),
608608 .cmpxchg_strong,
609609 .cmpxchg_weak,
610610 => try self.airCmpxchg(inst),
......@@ -717,7 +717,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
717717 .cmp_neq_optimized,
718718 .cmp_vector_optimized,
719719 .reduce_optimized,
720 .float_to_int_optimized,
720 .int_from_float_optimized,
721721 => @panic("TODO implement optimized float mode"),
722722
723723 .is_named_enum_value => @panic("TODO implement is_named_enum_value"),
......@@ -1078,7 +1078,7 @@ fn airBinOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
10781078 return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none });
10791079}
10801080
1081fn airBoolToInt(self: *Self, inst: Air.Inst.Index) !void {
1081fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void {
10821082 const un_op = self.air.instructions.items(.data)[inst].un_op;
10831083 const operand = try self.resolveInst(un_op);
10841084 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else operand;
......@@ -1736,9 +1736,9 @@ fn airFence(self: *Self, inst: Air.Inst.Index) !void {
17361736 return self.finishAir(inst, .dead, .{ .none, .none, .none });
17371737}
17381738
1739fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {
1739fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
17401740 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
1741 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatToInt for {}", .{
1741 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntFromFloat for {}", .{
17421742 self.target.cpu.arch,
17431743 });
17441744 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
......@@ -1769,9 +1769,9 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void {
17691769 return self.fail("TODO implement intCast for {}", .{self.target.cpu.arch});
17701770}
17711771
1772fn airIntToFloat(self: *Self, inst: Air.Inst.Index) !void {
1772fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
17731773 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
1774 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntToFloat for {}", .{
1774 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatFromInt for {}", .{
17751775 self.target.cpu.arch,
17761776 });
17771777 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
......@@ -2276,7 +2276,7 @@ fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void {
22762276 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
22772277}
22782278
2279fn airPtrToInt(self: *Self, inst: Air.Inst.Index) !void {
2279fn airIntFromPtr(self: *Self, inst: Air.Inst.Index) !void {
22802280 const un_op = self.air.instructions.items(.data)[inst].un_op;
22812281 const result = try self.resolveInst(un_op);
22822282 return self.finishAir(inst, result, .{ un_op, .none, .none });
src/arch/wasm/CodeGen.zig+9-9
......@@ -1902,13 +1902,13 @@ fn genInst(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
19021902 .trap => func.airTrap(inst),
19031903 .breakpoint => func.airBreakpoint(inst),
19041904 .br => func.airBr(inst),
1905 .bool_to_int => func.airBoolToInt(inst),
1905 .int_from_bool => func.airIntFromBool(inst),
19061906 .cond_br => func.airCondBr(inst),
19071907 .intcast => func.airIntcast(inst),
19081908 .fptrunc => func.airFptrunc(inst),
19091909 .fpext => func.airFpext(inst),
1910 .float_to_int => func.airFloatToInt(inst),
1911 .int_to_float => func.airIntToFloat(inst),
1910 .int_from_float => func.airIntFromFloat(inst),
1911 .float_from_int => func.airFloatFromInt(inst),
19121912 .get_union_tag => func.airGetUnionTag(inst),
19131913
19141914 .@"try" => func.airTry(inst),
......@@ -1951,7 +1951,7 @@ fn genInst(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
19511951 .ptr_sub => func.airPtrBinOp(inst, .sub),
19521952 .ptr_elem_ptr => func.airPtrElemPtr(inst),
19531953 .ptr_elem_val => func.airPtrElemVal(inst),
1954 .ptrtoint => func.airPtrToInt(inst),
1954 .int_from_ptr => func.airIntFromPtr(inst),
19551955 .ret => func.airRet(inst),
19561956 .ret_ptr => func.airRetPtr(inst),
19571957 .ret_load => func.airRetLoad(inst),
......@@ -2061,7 +2061,7 @@ fn genInst(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
20612061 .cmp_neq_optimized,
20622062 .cmp_vector_optimized,
20632063 .reduce_optimized,
2064 .float_to_int_optimized,
2064 .int_from_float_optimized,
20652065 => return func.fail("TODO implement optimized float mode", .{}),
20662066
20672067 .work_item_id,
......@@ -4480,7 +4480,7 @@ fn trunc(func: *CodeGen, operand: WValue, wanted_ty: Type, given_ty: Type) Inner
44804480 return result;
44814481}
44824482
4483fn airBoolToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4483fn airIntFromBool(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
44844484 const un_op = func.air.instructions.items(.data)[inst].un_op;
44854485 const operand = try func.resolveInst(un_op);
44864486 const result = func.reuseOperand(un_op, operand);
......@@ -4511,7 +4511,7 @@ fn airArrayToSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
45114511 func.finishAir(inst, slice_local, &.{ty_op.operand});
45124512}
45134513
4514fn airPtrToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4514fn airIntFromPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
45154515 const mod = func.bin_file.base.options.module.?;
45164516 const un_op = func.air.instructions.items(.data)[inst].un_op;
45174517 const operand = try func.resolveInst(un_op);
......@@ -4812,7 +4812,7 @@ fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
48124812 func.finishAir(inst, elem_result, &.{ bin_op.lhs, bin_op.rhs });
48134813}
48144814
4815fn airFloatToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4815fn airIntFromFloat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
48164816 const mod = func.bin_file.base.options.module.?;
48174817 const ty_op = func.air.instructions.items(.data)[inst].ty_op;
48184818
......@@ -4837,7 +4837,7 @@ fn airFloatToInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
48374837 func.finishAir(inst, result, &.{ty_op.operand});
48384838}
48394839
4840fn airIntToFloat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4840fn airFloatFromInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
48414841 const mod = func.bin_file.base.options.module.?;
48424842 const ty_op = func.air.instructions.items(.data)[inst].ty_op;
48434843
src/arch/x86_64/CodeGen.zig+13-13
......@@ -1835,7 +1835,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
18351835 .fpext => try self.airFpext(inst),
18361836 .intcast => try self.airIntCast(inst),
18371837 .trunc => try self.airTrunc(inst),
1838 .bool_to_int => try self.airBoolToInt(inst),
1838 .int_from_bool => try self.airIntFromBool(inst),
18391839 .is_non_null => try self.airIsNonNull(inst),
18401840 .is_non_null_ptr => try self.airIsNonNullPtr(inst),
18411841 .is_null => try self.airIsNull(inst),
......@@ -1846,7 +1846,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
18461846 .is_err_ptr => try self.airIsErrPtr(inst),
18471847 .load => try self.airLoad(inst),
18481848 .loop => try self.airLoop(inst),
1849 .ptrtoint => try self.airPtrToInt(inst),
1849 .int_from_ptr => try self.airIntFromPtr(inst),
18501850 .ret => try self.airRet(inst),
18511851 .ret_load => try self.airRetLoad(inst),
18521852 .store => try self.airStore(inst, false),
......@@ -1854,8 +1854,8 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
18541854 .struct_field_ptr=> try self.airStructFieldPtr(inst),
18551855 .struct_field_val=> try self.airStructFieldVal(inst),
18561856 .array_to_slice => try self.airArrayToSlice(inst),
1857 .int_to_float => try self.airIntToFloat(inst),
1858 .float_to_int => try self.airFloatToInt(inst),
1857 .float_from_int => try self.airFloatFromInt(inst),
1858 .int_from_float => try self.airIntFromFloat(inst),
18591859 .cmpxchg_strong => try self.airCmpxchg(inst),
18601860 .cmpxchg_weak => try self.airCmpxchg(inst),
18611861 .atomic_rmw => try self.airAtomicRmw(inst),
......@@ -1967,7 +1967,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
19671967 .cmp_neq_optimized,
19681968 .cmp_vector_optimized,
19691969 .reduce_optimized,
1970 .float_to_int_optimized,
1970 .int_from_float_optimized,
19711971 => return self.fail("TODO implement optimized float mode", .{}),
19721972
19731973 .is_named_enum_value => return self.fail("TODO implement is_named_enum_value", .{}),
......@@ -2806,7 +2806,7 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
28062806 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
28072807}
28082808
2809fn airBoolToInt(self: *Self, inst: Air.Inst.Index) !void {
2809fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void {
28102810 const un_op = self.air.instructions.items(.data)[inst].un_op;
28112811 const ty = self.typeOfIndex(inst);
28122812
......@@ -10147,7 +10147,7 @@ fn genLazySymbolRef(
1014710147 }
1014810148}
1014910149
10150fn airPtrToInt(self: *Self, inst: Air.Inst.Index) !void {
10150fn airIntFromPtr(self: *Self, inst: Air.Inst.Index) !void {
1015110151 const un_op = self.air.instructions.items(.data)[inst].un_op;
1015210152 const result = result: {
1015310153 // TODO: handle case where the operand is a slice not a raw pointer
......@@ -10246,7 +10246,7 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
1024610246 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
1024710247}
1024810248
10249fn airIntToFloat(self: *Self, inst: Air.Inst.Index) !void {
10249fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
1025010250 const mod = self.bin_file.options.module.?;
1025110251 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
1025210252
......@@ -10260,7 +10260,7 @@ fn airIntToFloat(self: *Self, inst: Air.Inst.Index) !void {
1026010260 .signed => src_bits,
1026110261 .unsigned => src_bits + 1,
1026210262 }, 32), 8) catch unreachable;
10263 if (src_size > 8) return self.fail("TODO implement airIntToFloat from {} to {}", .{
10263 if (src_size > 8) return self.fail("TODO implement airFloatFromInt from {} to {}", .{
1026410264 src_ty.fmt(mod), dst_ty.fmt(mod),
1026510265 });
1026610266
......@@ -10287,7 +10287,7 @@ fn airIntToFloat(self: *Self, inst: Air.Inst.Index) !void {
1028710287 else => unreachable,
1028810288 },
1028910289 else => null,
10290 })) |tag| tag else return self.fail("TODO implement airIntToFloat from {} to {}", .{
10290 })) |tag| tag else return self.fail("TODO implement airFloatFromInt from {} to {}", .{
1029110291 src_ty.fmt(mod), dst_ty.fmt(mod),
1029210292 });
1029310293 const dst_alias = dst_reg.to128();
......@@ -10300,7 +10300,7 @@ fn airIntToFloat(self: *Self, inst: Air.Inst.Index) !void {
1030010300 return self.finishAir(inst, dst_mcv, .{ ty_op.operand, .none, .none });
1030110301}
1030210302
10303fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {
10303fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
1030410304 const mod = self.bin_file.options.module.?;
1030510305 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
1030610306
......@@ -10314,7 +10314,7 @@ fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {
1031410314 .signed => dst_bits,
1031510315 .unsigned => dst_bits + 1,
1031610316 }, 32), 8) catch unreachable;
10317 if (dst_size > 8) return self.fail("TODO implement airFloatToInt from {} to {}", .{
10317 if (dst_size > 8) return self.fail("TODO implement airIntFromFloat from {} to {}", .{
1031810318 src_ty.fmt(self.bin_file.options.module.?), dst_ty.fmt(self.bin_file.options.module.?),
1031910319 });
1032010320
......@@ -10340,7 +10340,7 @@ fn airFloatToInt(self: *Self, inst: Air.Inst.Index) !void {
1034010340 else => unreachable,
1034110341 },
1034210342 else => null,
10343 })) |tag| tag else return self.fail("TODO implement airFloatToInt from {} to {}", .{
10343 })) |tag| tag else return self.fail("TODO implement airIntFromFloat from {} to {}", .{
1034410344 src_ty.fmt(self.bin_file.options.module.?), dst_ty.fmt(self.bin_file.options.module.?),
1034510345 }),
1034610346 registerAlias(dst_reg, dst_size),
src/codegen/c.zig+7-7
......@@ -2943,7 +2943,7 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail,
29432943 .dbg_stmt => try airDbgStmt(f, inst),
29442944 .intcast => try airIntCast(f, inst),
29452945 .trunc => try airTrunc(f, inst),
2946 .bool_to_int => try airBoolToInt(f, inst),
2946 .int_from_bool => try airIntFromBool(f, inst),
29472947 .load => try airLoad(f, inst),
29482948 .ret => try airRet(f, inst, false),
29492949 .ret_load => try airRet(f, inst, true),
......@@ -3000,13 +3000,13 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail,
30003000 .call_never_tail => try airCall(f, inst, .never_tail),
30013001 .call_never_inline => try airCall(f, inst, .never_inline),
30023002
3003 .int_to_float,
3004 .float_to_int,
3003 .float_from_int,
3004 .int_from_float,
30053005 .fptrunc,
30063006 .fpext,
30073007 => try airFloatCast(f, inst),
30083008
3009 .ptrtoint => try airPtrToInt(f, inst),
3009 .int_from_ptr => try airIntFromPtr(f, inst),
30103010
30113011 .atomic_store_unordered => try airAtomicStore(f, inst, toMemoryOrder(.Unordered)),
30123012 .atomic_store_monotonic => try airAtomicStore(f, inst, toMemoryOrder(.Monotonic)),
......@@ -3068,7 +3068,7 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail,
30683068 .cmp_neq_optimized,
30693069 .cmp_vector_optimized,
30703070 .reduce_optimized,
3071 .float_to_int_optimized,
3071 .int_from_float_optimized,
30723072 => return f.fail("TODO implement optimized float mode", .{}),
30733073
30743074 .is_named_enum_value => return f.fail("TODO: C backend: implement is_named_enum_value", .{}),
......@@ -3562,7 +3562,7 @@ fn airTrunc(f: *Function, inst: Air.Inst.Index) !CValue {
35623562 return local;
35633563}
35643564
3565fn airBoolToInt(f: *Function, inst: Air.Inst.Index) !CValue {
3565fn airIntFromBool(f: *Function, inst: Air.Inst.Index) !CValue {
35663566 const un_op = f.air.instructions.items(.data)[inst].un_op;
35673567 const operand = try f.resolveInst(un_op);
35683568 try reap(f, inst, &.{un_op});
......@@ -5834,7 +5834,7 @@ fn airFloatCast(f: *Function, inst: Air.Inst.Index) !CValue {
58345834 return local;
58355835}
58365836
5837fn airPtrToInt(f: *Function, inst: Air.Inst.Index) !CValue {
5837fn airIntFromPtr(f: *Function, inst: Air.Inst.Index) !CValue {
58385838 const mod = f.object.dg.module;
58395839 const un_op = f.air.instructions.items(.data)[inst].un_op;
58405840
src/codegen/llvm.zig+9-9
......@@ -4417,7 +4417,7 @@ pub const FuncGen = struct {
44174417 .ret_ptr => try self.airRetPtr(inst),
44184418 .arg => try self.airArg(inst),
44194419 .bitcast => try self.airBitCast(inst),
4420 .bool_to_int => try self.airBoolToInt(inst),
4420 .int_from_bool => try self.airIntFromBool(inst),
44214421 .block => try self.airBlock(inst),
44224422 .br => try self.airBr(inst),
44234423 .switch_br => try self.airSwitchBr(inst),
......@@ -4432,7 +4432,7 @@ pub const FuncGen = struct {
44324432 .trunc => try self.airTrunc(inst),
44334433 .fptrunc => try self.airFptrunc(inst),
44344434 .fpext => try self.airFpext(inst),
4435 .ptrtoint => try self.airPtrToInt(inst),
4435 .int_from_ptr => try self.airIntFromPtr(inst),
44364436 .load => try self.airLoad(body[i..]),
44374437 .loop => try self.airLoop(inst),
44384438 .not => try self.airNot(inst),
......@@ -4452,11 +4452,11 @@ pub const FuncGen = struct {
44524452 .ptr_slice_ptr_ptr => try self.airPtrSliceFieldPtr(inst, 0),
44534453 .ptr_slice_len_ptr => try self.airPtrSliceFieldPtr(inst, 1),
44544454
4455 .float_to_int => try self.airFloatToInt(inst, false),
4456 .float_to_int_optimized => try self.airFloatToInt(inst, true),
4455 .int_from_float => try self.airIntFromFloat(inst, false),
4456 .int_from_float_optimized => try self.airIntFromFloat(inst, true),
44574457
44584458 .array_to_slice => try self.airArrayToSlice(inst),
4459 .int_to_float => try self.airIntToFloat(inst),
4459 .float_from_int => try self.airFloatFromInt(inst),
44604460 .cmpxchg_weak => try self.airCmpxchg(inst, true),
44614461 .cmpxchg_strong => try self.airCmpxchg(inst, false),
44624462 .fence => try self.airFence(inst),
......@@ -5456,7 +5456,7 @@ pub const FuncGen = struct {
54565456 return self.builder.buildInsertValue(partial, len, 1, "");
54575457 }
54585458
5459 fn airIntToFloat(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
5459 fn airFloatFromInt(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
54605460 const mod = self.dg.module;
54615461 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
54625462
......@@ -5513,7 +5513,7 @@ pub const FuncGen = struct {
55135513 return self.builder.buildCall(libc_fn.globalGetValueType(), libc_fn, &params, params.len, .C, .Auto, "");
55145514 }
55155515
5516 fn airFloatToInt(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value {
5516 fn airIntFromFloat(self: *FuncGen, inst: Air.Inst.Index, want_fast_math: bool) !?*llvm.Value {
55175517 self.builder.setFastMath(want_fast_math);
55185518
55195519 const mod = self.dg.module;
......@@ -7788,7 +7788,7 @@ pub const FuncGen = struct {
77887788 }
77897789 }
77907790
7791 fn airPtrToInt(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
7791 fn airIntFromPtr(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
77927792 const un_op = self.air.instructions.items(.data)[inst].un_op;
77937793 const operand = try self.resolveInst(un_op);
77947794 const ptr_ty = self.typeOf(un_op);
......@@ -7922,7 +7922,7 @@ pub const FuncGen = struct {
79227922 return self.builder.buildBitCast(operand, llvm_dest_ty, "");
79237923 }
79247924
7925 fn airBoolToInt(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
7925 fn airIntFromBool(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
79267926 const un_op = self.air.instructions.items(.data)[inst].un_op;
79277927 const operand = try self.resolveInst(un_op);
79287928 return operand;
src/codegen/spirv.zig+6-6
......@@ -1721,9 +1721,9 @@ pub const DeclGen = struct {
17211721
17221722 .bitcast => try self.airBitCast(inst),
17231723 .intcast, .trunc => try self.airIntCast(inst),
1724 .ptrtoint => try self.airPtrToInt(inst),
1725 .int_to_float => try self.airIntToFloat(inst),
1726 .float_to_int => try self.airFloatToInt(inst),
1724 .int_from_ptr => try self.airIntFromPtr(inst),
1725 .float_from_int => try self.airFloatFromInt(inst),
1726 .int_from_float => try self.airIntFromFloat(inst),
17271727 .not => try self.airNot(inst),
17281728
17291729 .slice_ptr => try self.airSliceField(inst, 0),
......@@ -2329,7 +2329,7 @@ pub const DeclGen = struct {
23292329 return result_id;
23302330 }
23312331
2332 fn airPtrToInt(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
2332 fn airIntFromPtr(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
23332333 if (self.liveness.isUnused(inst)) return null;
23342334
23352335 const un_op = self.air.instructions.items(.data)[inst].un_op;
......@@ -2345,7 +2345,7 @@ pub const DeclGen = struct {
23452345 return result_id;
23462346 }
23472347
2348 fn airIntToFloat(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
2348 fn airFloatFromInt(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
23492349 if (self.liveness.isUnused(inst)) return null;
23502350
23512351 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
......@@ -2371,7 +2371,7 @@ pub const DeclGen = struct {
23712371 return result_id;
23722372 }
23732373
2374 fn airFloatToInt(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
2374 fn airIntFromFloat(self: *DeclGen, inst: Air.Inst.Index) !?IdRef {
23752375 if (self.liveness.isUnused(inst)) return null;
23762376
23772377 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
src/print_air.zig+5-5
......@@ -183,8 +183,8 @@ const Writer = struct {
183183 .is_non_err,
184184 .is_err_ptr,
185185 .is_non_err_ptr,
186 .ptrtoint,
187 .bool_to_int,
186 .int_from_ptr,
187 .int_from_bool,
188188 .ret,
189189 .ret_load,
190190 .is_named_enum_value,
......@@ -254,10 +254,10 @@ const Writer = struct {
254254 .struct_field_ptr_index_2,
255255 .struct_field_ptr_index_3,
256256 .array_to_slice,
257 .int_to_float,
257 .float_from_int,
258258 .splat,
259 .float_to_int,
260 .float_to_int_optimized,
259 .int_from_float,
260 .int_from_float_optimized,
261261 .get_union_tag,
262262 .clz,
263263 .ctz,
src/print_zir.zig+9-9
......@@ -187,12 +187,12 @@ const Writer = struct {
187187 .size_of,
188188 .bit_size_of,
189189 .typeof_log2_int_type,
190 .ptr_to_int,
190 .int_from_ptr,
191191 .compile_error,
192192 .set_eval_branch_quota,
193 .enum_to_int,
193 .int_from_enum,
194194 .align_of,
195 .bool_to_int,
195 .int_from_bool,
196196 .embed_file,
197197 .error_name,
198198 .panic,
......@@ -321,10 +321,10 @@ const Writer = struct {
321321 .merge_error_sets,
322322 .bit_and,
323323 .bit_or,
324 .float_to_int,
325 .int_to_float,
326 .int_to_ptr,
327 .int_to_enum,
324 .int_from_float,
325 .float_from_int,
326 .ptr_from_int,
327 .enum_from_int,
328328 .float_cast,
329329 .int_cast,
330330 .ptr_cast,
......@@ -502,8 +502,8 @@ const Writer = struct {
502502 .set_align_stack,
503503 .set_cold,
504504 .wasm_memory_size,
505 .error_to_int,
506 .int_to_error,
505 .int_from_error,
506 .error_from_int,
507507 .reify,
508508 .c_va_copy,
509509 .c_va_end,
src/translate_c.zig+35-35
......@@ -845,7 +845,7 @@ fn visitVarDecl(c: *Context, var_decl: *const clang.VarDecl, mangled_name: ?[]co
845845 error.OutOfMemory => |e| return e,
846846 };
847847 if (!qualTypeIsBoolean(qual_type) and isBoolRes(init_node.?)) {
848 init_node = try Tag.bool_to_int.create(c.arena, init_node.?);
848 init_node = try Tag.int_from_bool.create(c.arena, init_node.?);
849849 } else if (init_node.?.tag() == .string_literal and qualTypeIsCharStar(qual_type)) {
850850 init_node = try stringLiteralToCharStar(c, init_node.?);
851851 }
......@@ -1753,16 +1753,16 @@ fn transBinaryOperator(
17531753 const rhs_uncasted = try transExpr(c, scope, stmt.getRHS(), .used);
17541754
17551755 const lhs = if (isBoolRes(lhs_uncasted))
1756 try Tag.bool_to_int.create(c.arena, lhs_uncasted)
1756 try Tag.int_from_bool.create(c.arena, lhs_uncasted)
17571757 else if (isPointerDiffExpr)
1758 try Tag.ptr_to_int.create(c.arena, lhs_uncasted)
1758 try Tag.int_from_ptr.create(c.arena, lhs_uncasted)
17591759 else
17601760 lhs_uncasted;
17611761
17621762 const rhs = if (isBoolRes(rhs_uncasted))
1763 try Tag.bool_to_int.create(c.arena, rhs_uncasted)
1763 try Tag.int_from_bool.create(c.arena, rhs_uncasted)
17641764 else if (isPointerDiffExpr)
1765 try Tag.ptr_to_int.create(c.arena, rhs_uncasted)
1765 try Tag.int_from_ptr.create(c.arena, rhs_uncasted)
17661766 else
17671767 rhs_uncasted;
17681768
......@@ -1944,7 +1944,7 @@ fn transDeclStmtOne(
19441944 else
19451945 Tag.undefined_literal.init();
19461946 if (!qualTypeIsBoolean(qual_type) and isBoolRes(init_node)) {
1947 init_node = try Tag.bool_to_int.create(c.arena, init_node);
1947 init_node = try Tag.int_from_bool.create(c.arena, init_node);
19481948 } else if (init_node.tag() == .string_literal and qualTypeIsCharStar(qual_type)) {
19491949 const dst_type_node = try transQualType(c, scope, qual_type, loc);
19501950 init_node = try removeCVQualifiers(c, dst_type_node, init_node);
......@@ -2074,11 +2074,11 @@ fn transImplicitCastExpr(
20742074 return Tag.null_literal.init();
20752075 },
20762076 .PointerToBoolean => {
2077 // @ptrToInt(val) != 0
2077 // @intFromPtr(val) != 0
20782078 const ptr_node = try transExpr(c, scope, sub_expr, .used);
2079 const ptr_to_int = try Tag.ptr_to_int.create(c.arena, ptr_node);
2079 const int_from_ptr = try Tag.int_from_ptr.create(c.arena, ptr_node);
20802080
2081 const ne = try Tag.not_equal.create(c.arena, .{ .lhs = ptr_to_int, .rhs = Tag.zero_literal.init() });
2081 const ne = try Tag.not_equal.create(c.arena, .{ .lhs = int_from_ptr, .rhs = Tag.zero_literal.init() });
20822082 return maybeSuppressResult(c, result_used, ne);
20832083 },
20842084 .IntegralToBoolean, .FloatingToBoolean => {
......@@ -2334,7 +2334,7 @@ fn transReturnStmt(
23342334 var rhs = try transExprCoercing(c, scope, val_expr, .used);
23352335 const return_qt = scope.findBlockReturnType();
23362336 if (isBoolRes(rhs) and !qualTypeIsBoolean(return_qt)) {
2337 rhs = try Tag.bool_to_int.create(c.arena, rhs);
2337 rhs = try Tag.int_from_bool.create(c.arena, rhs);
23382338 }
23392339 return Tag.@"return".create(c.arena, rhs);
23402340}
......@@ -2493,7 +2493,7 @@ fn transCCast(
24932493 var src_int_expr = expr;
24942494
24952495 if (isBoolRes(src_int_expr)) {
2496 src_int_expr = try Tag.bool_to_int.create(c.arena, src_int_expr);
2496 src_int_expr = try Tag.int_from_bool.create(c.arena, src_int_expr);
24972497 return Tag.as.create(c.arena, .{ .lhs = dst_node, .rhs = src_int_expr });
24982498 }
24992499
......@@ -2521,34 +2521,34 @@ fn transCCast(
25212521 return Tag.bit_cast.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
25222522 }
25232523 if (cIsInteger(dst_type) and qualTypeIsPtr(src_type)) {
2524 // @intCast(dest_type, @ptrToInt(val))
2525 const ptr_to_int = try Tag.ptr_to_int.create(c.arena, expr);
2526 return Tag.int_cast.create(c.arena, .{ .lhs = dst_node, .rhs = ptr_to_int });
2524 // @intCast(dest_type, @intFromPtr(val))
2525 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 });
25272527 }
25282528 if (cIsInteger(src_type) and qualTypeIsPtr(dst_type)) {
2529 // @intToPtr(dest_type, val)
2530 return Tag.int_to_ptr.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
2529 // @ptrFromInt(dest_type, val)
2530 return Tag.ptr_from_int.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
25312531 }
25322532 if (cIsFloating(src_type) and cIsFloating(dst_type)) {
25332533 // @floatCast(dest_type, val)
25342534 return Tag.float_cast.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
25352535 }
25362536 if (cIsFloating(src_type) and !cIsFloating(dst_type)) {
2537 // @floatToInt(dest_type, val)
2538 return Tag.float_to_int.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
2537 // @intFromFloat(dest_type, val)
2538 return Tag.int_from_float.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
25392539 }
25402540 if (!cIsFloating(src_type) and cIsFloating(dst_type)) {
25412541 var rhs = expr;
2542 if (qualTypeIsBoolean(src_type)) rhs = try Tag.bool_to_int.create(c.arena, expr);
2543 // @intToFloat(dest_type, val)
2544 return Tag.int_to_float.create(c.arena, .{ .lhs = dst_node, .rhs = rhs });
2542 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 });
25452545 }
25462546 if (qualTypeIsBoolean(src_type) and !qualTypeIsBoolean(dst_type)) {
2547 // @boolToInt returns either a comptime_int or a u1
2547 // @intFromBool returns a u1
25482548 // TODO: if dst_type is 1 bit & signed (bitfield) we need @bitCast
25492549 // instead of @as
2550 const bool_to_int = try Tag.bool_to_int.create(c.arena, expr);
2551 return Tag.as.create(c.arena, .{ .lhs = dst_node, .rhs = bool_to_int });
2550 const int_from_bool = try Tag.int_from_bool.create(c.arena, expr);
2551 return Tag.as.create(c.arena, .{ .lhs = dst_node, .rhs = int_from_bool });
25522552 }
25532553 // @as(dest_type, val)
25542554 return Tag.as.create(c.arena, .{ .lhs = dst_node, .rhs = expr });
......@@ -3642,7 +3642,7 @@ fn transCallExpr(c: *Context, scope: *Scope, stmt: *const clang.CallExpr, result
36423642 if (i < param_count) {
36433643 const param_qt = fn_proto.getParamType(@intCast(c_uint, i));
36443644 if (isBoolRes(arg) and cIsNativeInt(param_qt)) {
3645 arg = try Tag.bool_to_int.create(c.arena, arg);
3645 arg = try Tag.int_from_bool.create(c.arena, arg);
36463646 } else if (arg.tag() == .string_literal and qualTypeIsCharStar(param_qt)) {
36473647 const loc = @ptrCast(*const clang.Stmt, stmt).getBeginLoc();
36483648 const dst_type_node = try transQualType(c, scope, param_qt, loc);
......@@ -3774,7 +3774,7 @@ fn transUnaryOperator(c: *Context, scope: *Scope, stmt: *const clang.UnaryOperat
37743774 const sub_expr_node = try transExpr(c, scope, op_expr, .used);
37753775 const to_negate = if (isBoolRes(sub_expr_node)) blk: {
37763776 const ty_node = try Tag.type.create(c.arena, "c_int");
3777 const int_node = try Tag.bool_to_int.create(c.arena, sub_expr_node);
3777 const int_node = try Tag.int_from_bool.create(c.arena, sub_expr_node);
37783778 break :blk try Tag.as.create(c.arena, .{ .lhs = ty_node, .rhs = int_node });
37793779 } else sub_expr_node;
37803780 return Tag.negate.create(c.arena, to_negate);
......@@ -4028,8 +4028,8 @@ fn transCreateCompoundAssign(
40284028
40294029// Casting away const or volatile requires us to use @intToPtr
40304030fn removeCVQualifiers(c: *Context, dst_type_node: Node, expr: Node) Error!Node {
4031 const ptr_to_int = try Tag.ptr_to_int.create(c.arena, expr);
4032 return Tag.int_to_ptr.create(c.arena, .{ .lhs = dst_type_node, .rhs = ptr_to_int });
4031 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 });
40334033}
40344034
40354035fn transCPtrCast(
......@@ -4132,12 +4132,12 @@ fn transBinaryConditionalOperator(c: *Context, scope: *Scope, stmt: *const clang
41324132 const cond_node = try finishBoolExpr(c, &cond_scope.base, cond_expr.getBeginLoc(), ty, cond_ident, .used);
41334133 var then_body = cond_ident;
41344134 if (!res_is_bool and isBoolRes(init_node)) {
4135 then_body = try Tag.bool_to_int.create(c.arena, then_body);
4135 then_body = try Tag.int_from_bool.create(c.arena, then_body);
41364136 }
41374137
41384138 var else_body = try transExpr(c, &block_scope.base, false_expr, .used);
41394139 if (!res_is_bool and isBoolRes(else_body)) {
4140 else_body = try Tag.bool_to_int.create(c.arena, else_body);
4140 else_body = try Tag.int_from_bool.create(c.arena, else_body);
41414141 }
41424142 const if_node = try Tag.@"if".create(c.arena, .{
41434143 .cond = cond_node,
......@@ -4173,12 +4173,12 @@ fn transConditionalOperator(c: *Context, scope: *Scope, stmt: *const clang.Condi
41734173
41744174 var then_body = try transExpr(c, scope, true_expr, used);
41754175 if (!res_is_bool and isBoolRes(then_body)) {
4176 then_body = try Tag.bool_to_int.create(c.arena, then_body);
4176 then_body = try Tag.int_from_bool.create(c.arena, then_body);
41774177 }
41784178
41794179 var else_body = try transExpr(c, scope, false_expr, used);
41804180 if (!res_is_bool and isBoolRes(else_body)) {
4181 else_body = try Tag.bool_to_int.create(c.arena, else_body);
4181 else_body = try Tag.int_from_bool.create(c.arena, else_body);
41824182 }
41834183
41844184 const if_node = try Tag.@"if".create(c.arena, .{
......@@ -4556,7 +4556,7 @@ fn transCreateNodeAssign(
45564556 const lhs_node = try transExpr(c, scope, lhs, .used);
45574557 var rhs_node = try transExprCoercing(c, scope, rhs, .used);
45584558 if (!exprIsBooleanType(lhs) and isBoolRes(rhs_node)) {
4559 rhs_node = try Tag.bool_to_int.create(c.arena, rhs_node);
4559 rhs_node = try Tag.int_from_bool.create(c.arena, rhs_node);
45604560 }
45614561 return transCreateNodeInfixOp(c, .assign, lhs_node, rhs_node, .used);
45624562 }
......@@ -4574,7 +4574,7 @@ fn transCreateNodeAssign(
45744574 const tmp = try block_scope.reserveMangledName(c, "tmp");
45754575 var rhs_node = try transExpr(c, &block_scope.base, rhs, .used);
45764576 if (!exprIsBooleanType(lhs) and isBoolRes(rhs_node)) {
4577 rhs_node = try Tag.bool_to_int.create(c.arena, rhs_node);
4577 rhs_node = try Tag.int_from_bool.create(c.arena, rhs_node);
45784578 }
45794579
45804580 const tmp_decl = try Tag.var_simple.create(c.arena, .{ .name = tmp, .init = rhs_node });
......@@ -6092,7 +6092,7 @@ fn macroBoolToInt(c: *Context, node: Node) !Node {
60926092 return node;
60936093 }
60946094
6095 return Tag.bool_to_int.create(c.arena, node);
6095 return Tag.int_from_bool.create(c.arena, node);
60966096}
60976097
60986098fn macroIntToBool(c: *Context, node: Node) !Node {
src/translate_c/ast.zig+35-35
......@@ -128,8 +128,8 @@ pub const Node = extern union {
128128 signed_remainder,
129129 /// @divTrunc(lhs, rhs)
130130 div_trunc,
131 /// @boolToInt(operand)
132 bool_to_int,
131 /// @intFromBool(operand)
132 int_from_bool,
133133 /// @as(lhs, rhs)
134134 as,
135135 /// @truncate(lhs, rhs)
......@@ -138,14 +138,14 @@ pub const Node = extern union {
138138 bit_cast,
139139 /// @floatCast(lhs, rhs)
140140 float_cast,
141 /// @floatToInt(lhs, rhs)
142 float_to_int,
143 /// @intToFloat(lhs, rhs)
144 int_to_float,
145 /// @intToPtr(lhs, rhs)
146 int_to_ptr,
147 /// @ptrToInt(operand)
148 ptr_to_int,
141 /// @intFromFloat(lhs, rhs)
142 int_from_float,
143 /// @floatFromInt(lhs, rhs)
144 float_from_int,
145 /// @ptrFromInt(lhs, rhs)
146 ptr_from_int,
147 /// @intFromPtr(operand)
148 int_from_ptr,
149149 /// @alignCast(lhs, rhs)
150150 align_cast,
151151 /// @ptrCast(lhs, rhs)
......@@ -263,7 +263,7 @@ pub const Node = extern union {
263263 .address_of,
264264 .unwrap,
265265 .deref,
266 .ptr_to_int,
266 .int_from_ptr,
267267 .empty_array,
268268 .while_true,
269269 .if_not_break,
......@@ -271,7 +271,7 @@ pub const Node = extern union {
271271 .block_single,
272272 .helpers_sizeof,
273273 .std_meta_alignment,
274 .bool_to_int,
274 .int_from_bool,
275275 .sizeof,
276276 .alignof,
277277 .typeof,
......@@ -319,9 +319,9 @@ pub const Node = extern union {
319319 .truncate,
320320 .bit_cast,
321321 .float_cast,
322 .float_to_int,
323 .int_to_float,
324 .int_to_ptr,
322 .int_from_float,
323 .float_from_int,
324 .ptr_from_int,
325325 .array_cat,
326326 .ellipsis3,
327327 .assign,
......@@ -1355,9 +1355,9 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
13551355 const payload = node.castTag(.div_trunc).?.data;
13561356 return renderBuiltinCall(c, "@divTrunc", &.{ payload.lhs, payload.rhs });
13571357 },
1358 .bool_to_int => {
1359 const payload = node.castTag(.bool_to_int).?.data;
1360 return renderBuiltinCall(c, "@boolToInt", &.{payload});
1358 .int_from_bool => {
1359 const payload = node.castTag(.int_from_bool).?.data;
1360 return renderBuiltinCall(c, "@intFromBool", &.{payload});
13611361 },
13621362 .as => {
13631363 const payload = node.castTag(.as).?.data;
......@@ -1375,21 +1375,21 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
13751375 const payload = node.castTag(.float_cast).?.data;
13761376 return renderBuiltinCall(c, "@floatCast", &.{ payload.lhs, payload.rhs });
13771377 },
1378 .float_to_int => {
1379 const payload = node.castTag(.float_to_int).?.data;
1380 return renderBuiltinCall(c, "@floatToInt", &.{ payload.lhs, payload.rhs });
1378 .int_from_float => {
1379 const payload = node.castTag(.int_from_float).?.data;
1380 return renderBuiltinCall(c, "@intFromFloat", &.{ payload.lhs, payload.rhs });
13811381 },
1382 .int_to_float => {
1383 const payload = node.castTag(.int_to_float).?.data;
1384 return renderBuiltinCall(c, "@intToFloat", &.{ payload.lhs, payload.rhs });
1382 .float_from_int => {
1383 const payload = node.castTag(.float_from_int).?.data;
1384 return renderBuiltinCall(c, "@floatFromInt", &.{ payload.lhs, payload.rhs });
13851385 },
1386 .int_to_ptr => {
1387 const payload = node.castTag(.int_to_ptr).?.data;
1388 return renderBuiltinCall(c, "@intToPtr", &.{ payload.lhs, payload.rhs });
1386 .ptr_from_int => {
1387 const payload = node.castTag(.ptr_from_int).?.data;
1388 return renderBuiltinCall(c, "@ptrFromInt", &.{ payload.lhs, payload.rhs });
13891389 },
1390 .ptr_to_int => {
1391 const payload = node.castTag(.ptr_to_int).?.data;
1392 return renderBuiltinCall(c, "@ptrToInt", &.{payload});
1390 .int_from_ptr => {
1391 const payload = node.castTag(.int_from_ptr).?.data;
1392 return renderBuiltinCall(c, "@intFromPtr", &.{payload});
13931393 },
13941394 .align_cast => {
13951395 const payload = node.castTag(.align_cast).?.data;
......@@ -2326,13 +2326,13 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex {
23262326 .truncate,
23272327 .bit_cast,
23282328 .float_cast,
2329 .float_to_int,
2330 .int_to_float,
2331 .int_to_ptr,
2329 .int_from_float,
2330 .float_from_int,
2331 .ptr_from_int,
23322332 .std_mem_zeroes,
23332333 .std_math_Log2Int,
23342334 .log2_int_type,
2335 .ptr_to_int,
2335 .int_from_ptr,
23362336 .sizeof,
23372337 .alignof,
23382338 .typeof,
......@@ -2371,7 +2371,7 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex {
23712371 .call,
23722372 .array_type,
23732373 .null_sentinel_array_type,
2374 .bool_to_int,
2374 .int_from_bool,
23752375 .div_exact,
23762376 .offset_of,
23772377 .shuffle,