[PATCH] emit-rtl.c: Allow vector subreg of float vectors
Mon Aug 10 16:22:58 GMT 2020
Andrew Stubbs <firstname.lastname@example.org> writes:
> On 06/08/2020 04:54, Richard Sandiford wrote:
>>> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
>>> index f9b0e9714d9..d7067989ad7 100644
>>> --- a/gcc/emit-rtl.c
>>> +++ b/gcc/emit-rtl.c
>>> @@ -947,6 +947,11 @@ validate_subreg (machine_mode omode, machine_mode imode,
>>> else if (VECTOR_MODE_P (omode)
>>> && GET_MODE_INNER (omode) == GET_MODE_INNER (imode))
>>> + /* Allow sections of vectors, both smaller and paradoxical. (This just
>>> + works for integers, but needs to be explicitly allowed for floats.) */
>>> + else if (VECTOR_MODE_P (omode) && VECTOR_MODE_P (imode)
>>> + && GET_MODE_INNER (omode) == GET_MODE_INNER (imode))
>>> + ;
>> Might be missing something, but isn't this a subcondition of the
>> previous “else if”? It looks like that ought to catch every case
>> that the new one does.
> Apparently, Hongtao and Uroš fixed my problem while I was working on this.
> Yes, my patch does the same (although I would question whether it's safe
> to use "GET_MODE_INNER (imode)" without having first confirmed "imode"
> is a vector mode).
FWIW, skipping the VECTOR_MODE_P test means that we also allow vector
paradoxical subregs of scalars, which can be useful if you're trying
to make a vector in which only element 0 is initialised. (Only works
for element 0 though.) IIRC this is what some of the x86 patterns do.
Guess it means we also allow vector subregs of complex values,
but that kind-of seems OK/useful too.
More information about the Gcc-patches