diff mbox series

[1/4] add support for a new instruction: OP_FMA

Message ID 20200905111211.82199-2-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series builtin: teach sparse to linearize __builtin_fma() | expand

Commit Message

Luc Van Oostenryck Sept. 5, 2020, 11:12 a.m. UTC
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 <luc.vanoostenryck@gmail.com>
---
 linearize.c | 2 ++
 opcode.def  | 1 +
 2 files changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/linearize.c b/linearize.c
index 5a8e74970d98..1a2677713123 100644
--- a/linearize.c
+++ b/linearize.c
@@ -244,6 +244,7 @@  static const char *opcodes[] = {
 
 	/* Special three-input */
 	[OP_SEL] = "select",
+	[OP_FMA] = "fma",
 	
 	/* Memory */
 	[OP_LOAD] = "load",
@@ -461,6 +462,7 @@  const char *show_instruction(struct instruction *insn)
 		break;
 
 	case OP_SEL:
+	case OP_FMA:
 		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 2583e2f4a602..58fe9983cbc2 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(FMA,             BADOP,    BADOP,    BADOP, 3, OPF_TARGET)
 
 /* Memory */
 OPCODE(LOAD,            BADOP,    BADOP,    BADOP, 1, OPF_TARGET)