This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 21/25] GCN Back-end (part 2/2).
On 12/11/2018 17:20, Segher Boessenkool wrote:
If you don't want useless USEs deleted, use UNSPEC_VOLATILE instead?
Or actually use the register, i.e. as input to an actually needed
instruction.
They're not useless. If we want to do scalar operations in vector
registers (and we often do, on this target), then we need to write a "1"
into the EXEC (vector mask) register.
Unless we want to rewrite all scalar operations in terms of vec_merge
then there's no way to "actually use the register".
There are additional patterns that do scalar operations in scalar
registers, and therefore do not depend on EXEC, but there are not a
complete set of instructions for these, so usually we don't use those
until reload_completed (via splits). I did think of simply disabling
them until reload_completed, but there are cases where we do want them,
so that didn't work.
Of course, it's possible that we took a wrong turn early on and ended up
with a sub-optimal arrangement, but it is where we are.
If combine is changing an X and a USE to just that X if it can, combine
is doing a great job!
Not if the "simpler" instruction is somehow more expensive. And, in our
case, it isn't the instruction itself that is more expensive, but the
extra instructions that may (or may not) need to be inserted around it
later.
I might investigate putting the USE inside an UNSPEC_VOLATILE. That
would have the advantage of letting combine run again. This feels like a
future project I'd rather not have block the port submission though.
If there are two instructions that both have an UNSPEC_VOLATILE, will
combine coalesce them into one in the combined pattern?
Thanks
Andrew