i965: Make emit_minmax return an instruction*.
authorMatt Turner <mattst88@gmail.com>
Thu, 11 Feb 2016 21:41:58 +0000 (13:41 -0800)
committerMatt Turner <mattst88@gmail.com>
Wed, 17 Feb 2016 20:35:27 +0000 (12:35 -0800)
And use it in brw_fs_nir.cpp.

src/mesa/drivers/dri/i965/brw_fs_builder.h
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_vec4_builder.h

index bb94c3d7071fcb445bd79a0423d939958846741c..9a3cc3a50c2f26b129fa79356421dc1f8b80af4f 100644 (file)
@@ -369,14 +369,14 @@ namespace brw {
        *
        * Generally useful to get the minimum or maximum of two values.
        */
-      void
+      instruction *
       emit_minmax(const dst_reg &dst, const src_reg &src0,
                   const src_reg &src1, brw_conditional_mod mod) const
       {
          assert(mod == BRW_CONDITIONAL_GE || mod == BRW_CONDITIONAL_L);
 
-         set_condmod(mod, SEL(dst, fix_unsigned_negate(src0),
-                              fix_unsigned_negate(src1)));
+         return set_condmod(mod, SEL(dst, fix_unsigned_negate(src0),
+                                     fix_unsigned_negate(src1)));
       }
 
       /**
index cf2e782c630d78ff212d4a0626e8522b75ab2989..db20c71406ef362d313bc688ee17125896af6d56 100644 (file)
@@ -950,16 +950,14 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
    case nir_op_fmin:
    case nir_op_imin:
    case nir_op_umin:
-      inst = bld.emit(BRW_OPCODE_SEL, result, op[0], op[1]);
-      inst->conditional_mod = BRW_CONDITIONAL_L;
+      inst = bld.emit_minmax(result, op[0], op[1], BRW_CONDITIONAL_L);
       inst->saturate = instr->dest.saturate;
       break;
 
    case nir_op_fmax:
    case nir_op_imax:
    case nir_op_umax:
-      inst = bld.emit(BRW_OPCODE_SEL, result, op[0], op[1]);
-      inst->conditional_mod = BRW_CONDITIONAL_GE;
+      inst = bld.emit_minmax(result, op[0], op[1], BRW_CONDITIONAL_GE);
       inst->saturate = instr->dest.saturate;
       break;
 
index a0b390b0fd51bd3642d3142474479e1781c1ee3d..3a8617e05acf61409a7169c713722eb1a71f2acf 100644 (file)
@@ -299,12 +299,14 @@ namespace brw {
        *
        * Generally useful to get the minimum or maximum of two values.
        */
-      void
+      instruction *
       emit_minmax(const dst_reg &dst, const src_reg &src0,
                   const src_reg &src1, brw_conditional_mod mod) const
       {
-         set_condmod(mod, SEL(dst, fix_unsigned_negate(src0),
-                              fix_unsigned_negate(src1)));
+         assert(mod == BRW_CONDITIONAL_GE || mod == BRW_CONDITIONAL_L);
+
+         return set_condmod(mod, SEL(dst, fix_unsigned_negate(src0),
+                                     fix_unsigned_negate(src1)));
       }
 
       /**