On 01/06/2018 07:19 AM, Richard Sandiford wrote:
> The code in r256209 tried using subregs for two cases: to extract
> a lowpart element of a vector, or to extract a subvector from a
> wider vector.  An earlier version of the SVE port used both variants,
> but these days SVE provides vec_extract* for all cases and so only
> really needs the subvector extract, e.g. for extracting one vector
> from an LD[234] result.
> 
> 64-bit SPARC is unusual in that REGMODE_NATURAL_SIZE for vectors is
> smaller than for GPRs.  It's therefore valid to form a subreg reference
> to both halves of a V2SI but not to both halves of a DI.  This is where
> the problem in PR83699 comes from: we extract the highpart SI from a V2SI
> and want to move the result into a GPR.  This causes LRA to cycle,
> because it keeps emitting reload sequences of the form:
> 
>    (set (reg:SI tmp) (subreg:SI (reg:V2SI foo) 0))
>    (set (reg:SI reg) (reg:SI tmp))
> 
> but then assigning a GPR to tmp, thus creating the same reload
> problem as before.
> 
> However, even with that fixed, the sequence is worse than it was
> before r256209.  I don't think this means that using subregs is
> a bad idea in principle, just that it needs a different condition.
> (E.g. if SPARC supported V2SF, or if it was prepared to do the SImode
> operation on FPRs, the patch would have been an improvement, because
> we'd avoid doing the extraction via memory.)
> 
> But since there's no longer a motivating example for the single-element
> case, I think the best approach is just to drop it.  For the remaining
> subvector case, we *could* continue to use the GET_MODE_INNER check
> as well, but I don't think it's necessary, since what really matters
> is whether the register reference can be formed.
> 
> Tested so far on aarch64-linux-gnu, and by spot-checking a
> sparch64-linux-gnu cross.  OK To install?
> 
> Richard
> 
> 
> 2018-01-06  Richard Sandiford  <richard.sandif...@linaro.org>
> 
> gcc/
>       PR rtl-optimization/83699
>       * expmed.c (extract_bit_field_1): Restrict the vector usage of
>       extract_bit_field_as_subreg to cases in which the extracted
>       value is also a vector.
THanks.  Installed.

jeff

Reply via email to