The support for the linearization of builtins was already added for __builtin_unreachable() but this builtin has no arguments and no return value. So, to complete the experience of builtin linearization, add the linearization of __builtin_fma(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- linearize.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/linearize.c b/linearize.c index bf55045bcbce..7157ba511671 100644 --- a/linearize.c +++ b/linearize.c @@ -2585,6 +2585,23 @@ struct entrypoint *linearize_symbol(struct symbol *sym) * Builtin functions */ +static pseudo_t linearize_fma(struct entrypoint *ep, struct expression *expr) +{ + struct instruction *insn = alloc_typed_instruction(OP_FMA, expr->ctype); + struct expression *arg; + + PREPARE_PTR_LIST(expr->args, arg); + insn->src1 = linearize_expression(ep, arg); + NEXT_PTR_LIST(arg) + insn->src2 = linearize_expression(ep, arg); + NEXT_PTR_LIST(arg) + insn->src3 = linearize_expression(ep, arg); + FINISH_PTR_LIST(arg); + + add_one_insn(ep, insn); + return insn->target = alloc_pseudo(insn); +} + static pseudo_t linearize_unreachable(struct entrypoint *ep, struct expression *exp) { add_unreachable(ep); @@ -2597,6 +2614,9 @@ static struct sym_init { struct symbol_op op; } builtins_table[] = { // must be declared in builtin.c:declare_builtins[] + { "__builtin_fma", linearize_fma }, + { "__builtin_fmaf", linearize_fma }, + { "__builtin_fmal", linearize_fma }, { "__builtin_unreachable", linearize_unreachable }, { } }; -- 2.28.0