Try harder to preserve operand ties in maybe_legitimize_operands
commit5430ed0d4d2863a590d2a53aebf9a64e8ddbf77a
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 May 2018 06:35:30 +0000 (25 06:35 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 May 2018 06:35:30 +0000 (25 06:35 +0000)
tree2419d2426ca05211e88a58c9f30bb73e43a06db4
parentd68410736480e652b14d1ce9c863369f53d0fa61
Try harder to preserve operand ties in maybe_legitimize_operands

maybe_legitimize_operands normally goes through each operand in turn
and legitimises it in isolation.  For example, if two operands to
an instruction initially have constant value C, and the instruction
requires both operands to be registers, the function ends up forcing
C into a register twice and passing two different registers to the
instruction.

I think we should try a bit harder to preserve the rtx_equal_p
property, if it's easy to do.  Some targets can optimise that
case better than they would the general case of all operands
being different.  This is particularly true for SVE after the
upcoming changes to the IFN_COND_* routines.

This is hard to test on its own, but is covered by the upcoming
IFN_COND_* patches.

2018-05-25  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* optabs.c (can_reuse_operands_p): New function.
(maybe_legitimize_operands): Try to reuse the results for
earlier operands.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260706 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/optabs.c