i965/nir/vec4: Implement floating-point fused multiply-add
authorAntia Puentes <apuentes@igalia.com>
Wed, 17 Jun 2015 07:51:10 +0000 (09:51 +0200)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 3 Aug 2015 16:40:49 +0000 (09:40 -0700)
Adds NIR ALU operation:
   * nir_op_ffma

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp

index b332fd315fb9b9ba5684690d5ef24319c85d384b..2cf157678c9da5258e1c8403eda7475319b6d63f 100644 (file)
@@ -1193,6 +1193,15 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
       emit(SHR(dst, op[0], op[1]));
       break;
 
+   case nir_op_ffma:
+      op[0] = fix_3src_operand(op[0]);
+      op[1] = fix_3src_operand(op[1]);
+      op[2] = fix_3src_operand(op[2]);
+
+      inst = emit(MAD(dst, op[2], op[1], op[0]));
+      inst->saturate = instr->dest.saturate;
+      break;
+
    default:
       unreachable("Unimplemented ALU operation");
    }