[Mesa-dev] [PATCH 5/9] tgsi: implement micro_fma() in tgsi exec machine

Maxence Le Doré maxence.ledore at gmail.com
Sat Jan 4 15:42:40 PST 2014


From: Maxence Le Doré <Maxence Le Doré>

---
 src/gallium/auxiliary/tgsi/tgsi_exec.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index b614907..25d3373 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -223,6 +223,18 @@ micro_flr(union tgsi_exec_channel *dst,
 }
 
 static void
+micro_fma(union tgsi_exec_channel *dst,
+          const union tgsi_exec_channel *src0,
+          const union tgsi_exec_channel *src1,
+          const union tgsi_exec_channel *src2)
+{
+   dst->f[0] = fmaf(src0->f[0],src1->f[0],src2->f[0]);
+   dst->f[1] = fmaf(src0->f[1],src1->f[1],src2->f[1]);
+   dst->f[2] = fmaf(src0->f[2],src1->f[2],src2->f[2]);
+   dst->f[3] = fmaf(src0->f[3],src1->f[3],src2->f[3]);
+}
+
+static void
 micro_frc(union tgsi_exec_channel *dst,
           const union tgsi_exec_channel *src)
 {
@@ -3635,6 +3647,10 @@ exec_instruction(
       exec_vector_binary(mach, inst, micro_add, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
       break;
 
+   case TGSI_OPCODE_FMA:
+      exec_vector_trinary(mach, inst, micro_fma, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT);
+      break;
+
    case TGSI_OPCODE_DP3:
       exec_dp3(mach, inst);
       break;
-- 
1.8.5.2



More information about the mesa-dev mailing list