[Mesa-dev] [PATCH 2/4] i965: Turn not.nz x into cmp.z x,0.
Kenneth Graunke
kenneth at whitecape.org
Tue Aug 16 02:30:16 UTC 2016
On Monday, August 15, 2016 2:24:30 PM PDT Matt Turner wrote:
> This allow conditional mod propagation to handle it.
>
> HSW:
>
> total instructions in shared programs: 8270006 -> 8269855 (-0.00%)
> instructions in affected programs: 41552 -> 41401 (-0.36%)
> helped: 136
>
> total cycles in shared programs: 82424584 -> 82420414 (-0.01%)
> cycles in affected programs: 745390 -> 741220 (-0.56%)
> helped: 86
> HURT: 27
>
> BDW:
>
> total instructions in shared programs: 11644113 -> 11643810 (-0.00%)
> instructions in affected programs: 68405 -> 68102 (-0.44%)
> helped: 278
>
> total cycles in shared programs: 144891558 -> 144883684 (-0.01%)
> cycles in affected programs: 866424 -> 858550 (-0.91%)
> helped: 226
> HURT: 27
>
> Also prevents regressions in "nir: Convert ineg(b2i(a)) to a if it's a
> boolean."
> ---
> src/mesa/drivers/dri/i965/brw_fs.cpp | 9 +++++++++
> src/mesa/drivers/dri/i965/brw_vec4.cpp | 9 +++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index d1ac80a..7ee50e7 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -2301,6 +2301,15 @@ fs_visitor::opt_algebraic()
> break;
> }
> break;
> + case BRW_OPCODE_NOT:
> + if (inst->dst.is_null() &&
> + inst->conditional_mod == BRW_CONDITIONAL_NZ) {
> + inst->opcode = BRW_OPCODE_CMP;
> + inst->conditional_mod = BRW_CONDITIONAL_Z;
> + inst->src[1] = retype(brw_imm_d(0), inst->src[0].type);
> + progress = true;
> + }
> + break;
> case BRW_OPCODE_LRP:
> if (inst->src[1].equals(inst->src[2])) {
> inst->opcode = BRW_OPCODE_MOV;
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index 2cf0e17..337a363 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -746,6 +746,15 @@ vec4_visitor::opt_algebraic()
> progress = true;
> }
> break;
> + case BRW_OPCODE_NOT:
> + if (inst->dst.is_null() &&
> + inst->conditional_mod == BRW_CONDITIONAL_NZ) {
> + inst->opcode = BRW_OPCODE_CMP;
> + inst->conditional_mod = BRW_CONDITIONAL_Z;
> + inst->src[1] = retype(brw_imm_d(0), inst->src[0].type);
> + progress = true;
> + }
> + break;
> case BRW_OPCODE_CMP:
> if (inst->conditional_mod == BRW_CONDITIONAL_GE &&
> inst->src[0].abs &&
>
This works for boolean values, but I don't think it works in general:
val not val not.nz val cmp.z val 0
0 ffffffff yes yes
1 fffffffe yes no
ffffffff 0 no no
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160815/004831d0/attachment-0001.sig>
More information about the mesa-dev
mailing list