i965/fs: Optimize saturating SEL.G(E) with imm val <= 0.0f.
authorMatt Turner <mattst88@gmail.com>
Mon, 28 Oct 2013 04:26:36 +0000 (21:26 -0700)
committerMatt Turner <mattst88@gmail.com>
Fri, 1 Nov 2013 22:21:07 +0000 (15:21 -0700)
Only one program's instruction count is changed, but a shader in Tropics
is also affected.

instructions in affected programs:     326 -> 320 (-1.84%)

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.cpp

index 56284d94e0b3ce76f100cab13c1ad557bd0723d5..7064910281f01a1efc42311e4da4c638e0f4c579 100644 (file)
@@ -1897,6 +1897,20 @@ fs_visitor::opt_algebraic()
                   break;
                }
                break;
+            case BRW_CONDITIONAL_GE:
+            case BRW_CONDITIONAL_G:
+               switch (inst->src[1].type) {
+               case BRW_REGISTER_TYPE_F:
+                  if (inst->src[1].imm.f <= 0.0f) {
+                     inst->opcode = BRW_OPCODE_MOV;
+                     inst->src[1] = reg_undef;
+                     inst->conditional_mod = BRW_CONDITIONAL_NONE;
+                     progress = true;
+                  }
+                  break;
+               default:
+                  break;
+               }
             default:
                break;
             }