astgen.c: implement @mulAdd builtin handler

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 13:05:14 +00:00
parent 2707757d9c
commit ee19503d4d
2 changed files with 19 additions and 1 deletions

View File

@@ -5443,6 +5443,24 @@ static uint32_t builtinCallMultiArg(GenZir* gz, Scope* scope, ResultLoc rl,
}
// clang-format on
// @mulAdd — AstGen.zig:9592-9603.
// clang-format off
if (name_len == 6 && memcmp(source + name_start, "mulAdd", 6) == 0
&& param_count == 4) {
uint32_t float_type = typeExpr(gz, scope, params[0]);
ResultLoc coerced_rl = { .tag = RL_COERCED_TY,
.data = float_type, .src_node = 0, .ctx = RI_CTX_NONE };
uint32_t mulend1 = exprRl(gz, scope, coerced_rl, params[1]);
uint32_t mulend2 = exprRl(gz, scope, coerced_rl, params[2]);
ResultLoc ty_rl = { .tag = RL_TY,
.data = float_type, .src_node = 0, .ctx = RI_CTX_NONE };
uint32_t addend = exprRl(gz, scope, ty_rl, params[3]);
uint32_t result = addPlNodeTriple(
gz, ZIR_INST_MUL_ADD, node, mulend1, mulend2, addend);
return rvalue(gz, rl, result, node);
}
// clang-format on
// @cmpxchgStrong / @cmpxchgWeak — AstGen.zig:9496-9497, 9884-9905.
// clang-format off
if (param_count == 6

View File

@@ -1263,7 +1263,7 @@ const corpus_files = .{
"../test/behavior/memmove.zig",
"../test/behavior/memset.zig",
"../test/behavior/merge_error_sets.zig",
//"../test/behavior/muladd.zig",
"../test/behavior/muladd.zig",
//"../test/behavior/multiple_externs_with_conflicting_types.zig",
"../test/behavior/namespace_depends_on_compile_var.zig",
"../test/behavior/nan.zig",