i965/fs: Use greater-equal cmod to implement maximum.
authorMatt Turner <mattst88@gmail.com>
Sat, 29 Aug 2015 00:10:00 +0000 (17:10 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 31 Aug 2015 18:51:59 +0000 (11:51 -0700)
The docs specifically call out SEL with .l and .ge as the
implementations of MIN and MAX respectively. Among other things,
SEL with these conditional mods are commutative.

See commit 3b7f683f.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/drivers/dri/i965/brw_fs_builder.h
src/mesa/drivers/dri/i965/brw_fs_surface_builder.cpp

index 34545eaa0fbd65b4da2694e64f407457748dd4f4..df10a9de293a4c64ab74912688267b4426b65c95 100644 (file)
@@ -372,6 +372,8 @@ namespace brw {
       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);
+
          if (shader->devinfo->gen >= 6) {
             set_condmod(mod, SEL(dst, fix_unsigned_negate(src0),
                                  fix_unsigned_negate(src1)));
index 50e0acd05f5572881679720387e6034f829a0836..727e8d1b82a2e037ff3c58573199e9a09da736ba 100644 (file)
@@ -686,7 +686,7 @@ namespace {
                if (is_signed)
                   bld.emit_minmax(offset(dst, bld, c), offset(dst, bld, c),
                                   fs_reg(-(int)scale(widths[c] - s) - 1),
-                                  BRW_CONDITIONAL_G);
+                                  BRW_CONDITIONAL_GE);
             }
          }
 
@@ -717,7 +717,7 @@ namespace {
                if (is_signed)
                   bld.emit_minmax(offset(dst, bld, c),
                                   offset(dst, bld, c), fs_reg(-1.0f),
-                                  BRW_CONDITIONAL_G);
+                                  BRW_CONDITIONAL_GE);
             }
          }
          return dst;
@@ -741,7 +741,7 @@ namespace {
                /* Clamp the normalized floating-point argument. */
                if (is_signed) {
                   bld.emit_minmax(offset(fdst, bld, c), offset(src, bld, c),
-                                  fs_reg(-1.0f), BRW_CONDITIONAL_G);
+                                  fs_reg(-1.0f), BRW_CONDITIONAL_GE);
 
                   bld.emit_minmax(offset(fdst, bld, c), offset(fdst, bld, c),
                                   fs_reg(1.0f), BRW_CONDITIONAL_L);
@@ -812,7 +812,7 @@ namespace {
                /* Clamp to the minimum value. */
                if (widths[c] < 16)
                   bld.emit_minmax(offset(fdst, bld, c), offset(fdst, bld, c),
-                                  fs_reg(0.0f), BRW_CONDITIONAL_G);
+                                  fs_reg(0.0f), BRW_CONDITIONAL_GE);
 
                /* Convert to 16-bit floating-point. */
                bld.F32TO16(offset(dst, bld, c), offset(fdst, bld, c));