[Mesa-dev] [PATCH 01/13] i965/fs: Allow constant propagation into MACH.
Kenneth Graunke
kenneth at whitecape.org
Sun Mar 31 19:23:29 PDT 2013
On 03/20/2013 05:36 PM, Eric Anholt wrote:
> This happens quite a bit with varying-index uniform loads. We could also
> do better by avoiding the MACH entirely, but there's no reason not to at
> least take this step.
> ---
> src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Okay, yeah, so we constant propagate the immediate into both the MUL and
the MACH. That makes sense...may free up a register.
It'd be nice to eliminate it if the constant is small enough, yeah.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
> index 194ed07..2d0391a 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
> @@ -261,6 +261,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
> progress = true;
> break;
>
> + case BRW_OPCODE_MACH:
> case BRW_OPCODE_MUL:
> case BRW_OPCODE_ADD:
> if (i == 1) {
> @@ -268,10 +269,11 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
> progress = true;
> } else if (i == 0 && inst->src[1].file != IMM) {
> /* Fit this constant in by commuting the operands.
> - * Exception: we can't do this for 32-bit integer MUL
> + * Exception: we can't do this for 32-bit integer MUL/MACH
> * because it's asymmetric.
> */
> - if (inst->opcode == BRW_OPCODE_MUL &&
> + if ((inst->opcode == BRW_OPCODE_MUL ||
> + inst->opcode == BRW_OPCODE_MACH) &&
> (inst->src[1].type == BRW_REGISTER_TYPE_D ||
> inst->src[1].type == BRW_REGISTER_TYPE_UD))
> break;
More information about the mesa-dev
mailing list