[Mesa-dev] [PATCH 5/7] i965/fs: Don't dead code eliminate CMP(N).
Eric Anholt
eric at anholt.net
Tue Oct 22 22:56:20 CEST 2013
Matt Turner <mattst88 at gmail.com> writes:
> An future commit will enable CSE for CMP instructions. It operates on
> the following code
>
> cmp.ge.f0(8) null g45<8,8,1>F 0F
> (+f0) sel(8) g50<1>F g40<8,8,1>F g10<8,8,1>F
> cmp.ge.f0(8) null g45<8,8,1>F 0F
> (+f0) sel(8) g51<1>F g41<8,8,1>F g11<8,8,1>F
> cmp.ge.f0(8) null g45<8,8,1>F 0F
> (+f0) sel(8) g52<1>F g42<8,8,1>F g12<8,8,1>F
> cmp.ge.f0(8) null g45<8,8,1>F 0F
> (+f0) sel(8) g53<1>F g43<8,8,1>F g13<8,8,1>F
>
> by adding a new cmp.ge.f0(8) instruction writing into a GRF destination
> and replacing the existing compares with MOVs from that destination,
> leading to:
>
> cmp.ge.f0(8) g30<1>F g45<8,8,1>F 0F
> mov(8) null g30<1>F
> (+f0) sel(8) g50<1>F g40<8,8,1>F g10<8,8,1>F
> mov(8) null g30<1>F
> (+f0) sel(8) g51<1>F g41<8,8,1>F g11<8,8,1>F
> mov(8) null g30<1>F
> (+f0) sel(8) g52<1>F g42<8,8,1>F g12<8,8,1>F
> mov(8) null g30<1>F
> (+f0) sel(8) g53<1>F g43<8,8,1>F g13<8,8,1>F
>
> The next patch will enable dead code elimination of MOVs with a null
> destination, which in turn would cause the pass to recognize that the
> new compare's g30 destination is never read and delete the instruction.
> This would leave the flag register in an unknown state and break the
> program.
I think we should just not generate the dead MOVs, instead. It would
just be a matter of checking for dst.file == GRF when generating the
temporary, right?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131022/28c28084/attachment.pgp>
More information about the mesa-dev
mailing list