From: Eric Anholt Date: Fri, 22 Jul 2011 23:18:39 +0000 (-0700) Subject: i965/fs: If we see a RCP of a constant, try to constant fold it. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d8d6b41b85a18685351f3023a4cd41266ba9e68;p=mesa.git i965/fs: If we see a RCP of a constant, try to constant fold it. --- diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 9c3180fbc1c..351d1dd283e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1056,6 +1056,20 @@ fs_visitor::propagate_constants() progress = true; } break; + + case FS_OPCODE_RCP: + /* The hardware doesn't do math on immediate values + * (because why are you doing that, seriously?), but + * the correct answer is to just constant fold it + * anyway. + */ + assert(i == 0); + if (inst->src[0].imm.f != 0.0f) { + scan_inst->opcode = BRW_OPCODE_MOV; + scan_inst->src[0] = inst->src[0]; + progress = true; + } + break; } }