Use extract_bit_field_as_subreg for vectors
commitca152861fe3942f851c2fbab214450d4ff3cfb99
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jan 2018 21:46:38 +0000 (3 21:46 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jan 2018 21:46:38 +0000 (3 21:46 +0000)
tree723e0087b658c0c78b9cd5821bcf18a50d70fc36
parent48ce740d3bfbd9a1a58b7283b730ed90c556b913
Use extract_bit_field_as_subreg for vectors

extract_bit_field_1 tries to use vec_extract to extract part of a
vector.  However, if that pattern isn't defined or if the operands
aren't suitable, another good approach is to try a direct subreg
reference.  This is particularly useful for multi-vector modes on
SVE (e.g. when extracting one vector from an LD2 result).

The function would go on to try the same thing anyway, but only
if there is an integer mode with the same size as the vector mode,
which isn't true for SVE modes (and doesn't seem a good thing to
require in general).  Even when there is an integer mode, doing the
operation on the original modes avoids some unnecessary bitcasting.

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

gcc/
* expmed.c (extract_bit_field_1): For vector extracts,
fall back to extract_bit_field_as_subreg if vec_extract
isn't available.

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