match.pd handling of three-constant bitops
commit6a833a2e4223c46a2748eab9e5e0059287bb0ad3
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jan 2018 07:13:57 +0000 (3 07:13 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jan 2018 07:13:57 +0000 (3 07:13 +0000)
treefcb44ccf099df984033df19505fd84e7a39d4e7b
parentcde959e76a2c8580fec69e5d04ca9666ff28f919
match.pd handling of three-constant bitops

natch.pd tries to reassociate two bit operations if both of them have
constant operands.  However, with the polynomial integers added later,
there's no guarantee that a bit operation on two integers can be folded
at compile time.  This means that the pattern can trigger for operations
on three constants, and as things stood could endlessly oscillate
between the two associations.

This patch keeps the existing pattern for the normal case of a
non-constant first operand.  When all three operands are constant it
tries to find a pair of constants that do fold.  If none do, it keeps
the original expression as-was.

2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* match.pd: Handle bit operations involving three constants
and try to fold one pair.

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