i965/nir/vec4: Implement min/max operations
authorAntia Puentes <apuentes@igalia.com>
Tue, 16 Jun 2015 22:34:57 +0000 (00:34 +0200)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 3 Aug 2015 16:40:48 +0000 (09:40 -0700)
Adds NIR ALU operations:
   * nir_op_fmin
   * nir_op_imin
   * nir_op_umin
   * nir_op_fmax
   * nir_op_imax
   * nir_op_umax

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

index ab6335a85461f45f4bbe6dd72bfe00833b9933c6..584ea5b2299d851fc70acbaa8e85c884d39d761c 100644 (file)
@@ -847,6 +847,20 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr)
       inst->saturate = instr->dest.saturate;
       break;
 
+   case nir_op_fmin:
+   case nir_op_imin:
+   case nir_op_umin:
+      inst = emit_minmax(BRW_CONDITIONAL_L, dst, op[0], op[1]);
+      inst->saturate = instr->dest.saturate;
+      break;
+
+   case nir_op_fmax:
+   case nir_op_imax:
+   case nir_op_umax:
+      inst = emit_minmax(BRW_CONDITIONAL_GE, dst, op[0], op[1]);
+      inst->saturate = instr->dest.saturate;
+      break;
+
    default:
       unreachable("Unimplemented ALU operation");
    }