[Mesa-dev] [PATCH 1/4] i965: Don't emit saturates for instructions without destinations.
Kenneth Graunke
kenneth at whitecape.org
Mon Feb 23 00:40:49 PST 2015
On Tuesday, February 10, 2015 11:09:57 AM Matt Turner wrote:
> We were special casing OPCODE_END but no other instructions that have no
> destination, like OPCODE_KIL, leading us to emitting MOVs with null
> destinations.
>
> total instructions in shared programs: 5950886 -> 5947182 (-0.06%)
> instructions in affected programs: 139700 -> 135996 (-2.65%)
> helped: 904
> ---
> src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 2 +-
> src/mesa/drivers/dri/i965/brw_vec4_vp.cpp | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
> index 7f2874d..dd3d331 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
> @@ -517,7 +517,7 @@ fs_visitor::emit_fragment_program_code()
> /* To handle saturates, we emit a MOV with a saturate bit, which
> * optimization should fold into the preceding instructions when safe.
> */
> - if (fpi->Opcode != OPCODE_END) {
> + if (_mesa_num_inst_dst_regs(fpi->Opcode) != 0) {
> fs_reg real_dst = get_fp_dst_reg(&fpi->DstReg);
>
> for (int i = 0; i < 4; i++) {
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
> index 85f2de5..434f032 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_vp.cpp
> @@ -387,7 +387,7 @@ vec4_vs_visitor::emit_program_code()
> }
>
> /* Copy the temporary back into the actual destination register. */
> - if (vpi->Opcode != OPCODE_END) {
> + if (_mesa_num_inst_dst_regs(vpi->Opcode) != 0) {
> emit(MOV(get_vp_dst_reg(vpi->DstReg), src_reg(dst)));
> }
> }
>
I figured since we talked about this on IRC, I'd give you a:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
for this patch at least (it looks like Ian's hit the others).
-------------- 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: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150223/38a9a0e7/attachment.sig>
More information about the mesa-dev
mailing list