This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Fix Two Address problems with v_movreld
ClosedPublic

Authored by nhaehnle on Oct 14 2016, 1:02 PM.

Details

Summary

The v_movreld machine instruction is used with three operands that are
in a sense tied to each other (the explicit VGPR_32 def and the implicit
VGPR_NN def and use). There is no way to express that using the currently
available operand bits, and indeed there are cases where the Two Address
instructions pass does the wrong thing.

This patch introduces a new set of pseudo instructions that are identical
in intended semantics as v_movreld, but they only have two tied operands.

Having to add a new set of pseudo instructions is admittedly annoying, but
it's a fairly straightforward and solid approach. The only alternative I
see is to try to teach the Two Address instructions pass about Three Address
instructions, and I'm afraid that's trickier and is going to end up more
fragile.

Note that v_movrels does not suffer from this problem, and so this patch
does not touch it.

This fixes several GL45-CTS.shaders.indexing.* tests.

Diff Detail

Repository
rL LLVM

Event Timeline

nhaehnle updated this revision to Diff 74735.Oct 14 2016, 1:02 PM
nhaehnle retitled this revision from to AMDGPU: Fix Two Address problems with v_movreld.
nhaehnle updated this object.
nhaehnle added reviewers: arsenm, tstellarAMD.
nhaehnle added a subscriber: llvm-commits.
tstellarAMD accepted this revision.Oct 20 2016, 6:44 AM
tstellarAMD edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Oct 20 2016, 6:44 AM
This revision was automatically updated to reflect the committed changes.