[RS6000] num_insns_constant ICE
commitceb8c8c4cae47fd07cd7dda74bb31b98ce4adadc
authorAlan Modra <amodra@gmail.com>
Fri, 30 Nov 2018 13:33:18 +0000 (1 00:03 +1030)
committerAlan Modra <amodra@gcc.gnu.org>
Fri, 30 Nov 2018 13:33:18 +0000 (1 00:03 +1030)
tree23089fda67e1747910ad9f2b45f26840fed7944e
parentf44697b78a06bf880ba25e9d4cd721f24282a797
[RS6000] num_insns_constant ICE

This patch came about from investigating an ICE that appeared when I
was retesting an old half-baked patch of mine to rs6000_rtx_costs.
If a const_double is fed to rs6000_is_valid_and_mask and from there to
rs6000_is_valid_mask where INTVAL is used, gcc will ICE.

The num_insns_constant ICE was introduced with git commit f337168d97.
However, the code was buggy before that.  There was no point in
testing for a mask since the mask predicates only handle const_int.
In fact, I don't think the function ever handled floating point
constants that might match a load of minus one and mask.  It does now.
I've added a few comments regarding splitters so the next person
looking at this code can see how this works.

The patch also extracts code out of num_insns_constant that needed to
handle multiple gprs for DFmode constants in 32-bit mode, to a
function that handles multiple gprs a little more generally.  I don't
think there is any need for anything but the 32-bit DFmode case
currently, but this allows for possible future uses.  The
CONST_WIDE_INT case is also not used currently, and needed fixing.
Adding CONST_WIDE_INT_NUNITS - 1 only makes sense if the elements of
the array were being shifted into a register of size larger than the
element size (which is 64-bits).

* config/rs6000/rs6000.c (num_insns_constant_gpr): Renamed from
num_insns_constant_wide.  Make static.  Revise comment.
(num_insns_constant_multi): New function.
(num_insns_constant): Formatting.  Correct CONST_WIDE_INT
calculation.  Simplify and extract code common to both
CONST_INT and CONST_DOUBLE.  Add gcc_unreachable for unhandled
const_double modes.
* config/rs6000/rs6000-protos.h (num_insns_const_wide): Delete.

From-SVN: r266662
gcc/ChangeLog
gcc/config/rs6000/rs6000-protos.h
gcc/config/rs6000/rs6000.c