This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch combine] Don't create vector mode ZERO_EXTEND from subregs
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: James Greenhalgh <james dot greenhalgh at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, nd at arm dot com, law at redhat dot com
- Date: Sat, 16 Dec 2017 21:14:08 -0600
- Subject: Re: [Patch combine] Don't create vector mode ZERO_EXTEND from subregs
- Authentication-results: sourceware.org; auth=none
- References: <1513001933-17348-1-git-send-email-james.greenhalgh@arm.com>
Hi!
On Mon, Dec 11, 2017 at 02:18:53PM +0000, James Greenhalgh wrote:
>
> In simplify_set we try transforming the paradoxical subreg expression:
>
> (set FOO (subreg:M (mem:N BAR) 0))
>
> in to:
>
> (set FOO (zero_extend:M (mem:N BAR)))
>
> However, this code does not consider the case where M is a vector
> mode, allowing it to construct (for example):
>
> (zero_extend:V4SI (mem:SI))
>
> This would clearly have the wrong semantics, but fortunately we fail long
> before then in expand_compound_operation. As we really don't want a vector
> zero_extend of a scalar value.
>
> We need to explicitly reject vector modes from this transformation.
It does not consider any other modes either. Both modes involved are
required to be SCALAR_INT_MODE_P (for zero_extend to be valid at all and
to be equivalent to the subreg); could you test for that instead please?
Segher