From 3c28b2c09f491bfa55dc9e5d7858a8b900c25432 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sun, 27 Oct 2013 21:26:36 -0700 Subject: [PATCH] i965/fs: Optimize saturating SEL.G(E) with imm val <= 0.0f. 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 Reviewed-by: Paul Berry --- src/mesa/drivers/dri/i965/brw_fs.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 56284d94e0b..7064910281f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -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; } -- 2.30.2