From 9937d33bf9454de48d852d69d90fe05f966f8026 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Sat, 5 Sep 2020 11:51:24 +0200 Subject: add support for a new instruction: OP_FMADD This will be the instruction for fused multiply-add but the motivation for it is some experimentation with the linearization of builtins. Signed-off-by: Luc Van Oostenryck --- Documentation/IR.rst | 7 +++++++ linearize.c | 2 ++ opcode.def | 1 + 3 files changed, 10 insertions(+) diff --git a/Documentation/IR.rst b/Documentation/IR.rst index 97d4b2b2..ff5af1c5 100644 --- a/Documentation/IR.rst +++ b/Documentation/IR.rst @@ -309,6 +309,13 @@ Ternary ops * .target: result of the operation * .type: type of .target +.. op:: OP_FMADD + Fused multiply-add. + + * .src1, .src2, .src3: operands (types must be compatible with .target) + * .target: result of the operation (must be a floating-point type) + * .type: type of .target + .. op:: OP_RANGE Range/bounds checking (only used for an unused sparse extension). diff --git a/linearize.c b/linearize.c index 5a8e7497..0d91d412 100644 --- a/linearize.c +++ b/linearize.c @@ -244,6 +244,7 @@ static const char *opcodes[] = { /* Special three-input */ [OP_SEL] = "select", + [OP_FMADD] = "fmadd", /* Memory */ [OP_LOAD] = "load", @@ -461,6 +462,7 @@ const char *show_instruction(struct instruction *insn) break; case OP_SEL: + case OP_FMADD: buf += sprintf(buf, "%s <- %s, %s, %s", show_pseudo(insn->target), show_pseudo(insn->src1), show_pseudo(insn->src2), show_pseudo(insn->src3)); break; diff --git a/opcode.def b/opcode.def index 2583e2f4..7959efaf 100644 --- a/opcode.def +++ b/opcode.def @@ -91,6 +91,7 @@ OPCODE(SLICE, BADOP, BADOP, BADOP, 1, OPF_TARGET) /* Select - three input values */ OPCODE(SEL, BADOP, BADOP, BADOP, 3, OPF_TARGET) +OPCODE(FMADD, BADOP, BADOP, BADOP, 3, OPF_TARGET) /* Memory */ OPCODE(LOAD, BADOP, BADOP, BADOP, 1, OPF_TARGET) -- cgit 1.2.3-korg