Try harder to preserve operand ties in maybe_legitimize_operands
authorRichard Sandiford <richard.sandiford@linaro.org>
Fri, 25 May 2018 06:35:30 +0000 (06:35 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 25 May 2018 06:35:30 +0000 (06:35 +0000)
commitb883fc9b54d360b5f73bf226bb489e8612502298
tree2419d2426ca05211e88a58c9f30bb73e43a06db4
parent9143aa524cee23faf8d4f11d0a8a7b5393952406
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.

From-SVN: r260706
gcc/ChangeLog
gcc/optabs.c