public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@linaro.org>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Earnshaw <richard.earnshaw@arm.com>,
	 James Greenhalgh <james.greenhalgh@arm.com>,
	 Marcus Shawcroft <marcus.shawcroft@arm.com>,
	 gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix aarch64_simd_reg_or_zero predicate (PR fortran/84565)
Date: Tue, 27 Feb 2018 14:22:00 -0000	[thread overview]
Message-ID: <87muzuh5r5.fsf@linaro.org> (raw)
In-Reply-To: <20180227091251.GD5867@tucnak> (Jakub Jelinek's message of "Tue,	27 Feb 2018 10:12:51 +0100")

Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> The following testcase ICEs, because the aarch64_cmeqdf instruction
> starting with r256612 no longer accepts CONST0_RTX (E_DFmode) as
> valid argument, but the expander generates it anyway.
>
> The bug has been introduced during the addition of aarch64_simd_imm_zero
> and aarch64_simd_or_scalar_imm_zero predicates, before the predicate
> used to be:
> (define_predicate "aarch64_simd_reg_or_zero"
>   (and (match_code "reg,subreg,const_int,const_double,const_vector")
>        (ior (match_operand 0 "register_operand")
>            (ior (match_test "op == const0_rtx")
>                 (match_test "aarch64_simd_imm_zero_p (op, mode)")))))
> with
> bool
> aarch64_simd_imm_zero_p (rtx x, machine_mode mode)
> {
>   return x == CONST0_RTX (mode);
> }
> and so matched not just const,const_vector zeros, but also
> const_int zero (that is through op == const0_rtx) and const_double
> zero too.

Thanks for fixing this.

> Bootstrapped/regtested on aarch64-linux (scratch Fedora gcc 8 package build
> with the patch applied), ok for trunk?
>
> 2018-02-27  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR fortran/84565
> 	* config/aarch64/predicates.md (aarch64_simd_reg_or_zero): Use
> 	aarch64_simd_or_scalar_imm_zero rather than aarch64_simd_imm_zero.
>
> 	* gfortran.dg/pr84565.f90: New test.
>
> --- gcc/config/aarch64/predicates.md.jj	2018-02-06 13:13:06.305751221 +0100
> +++ gcc/config/aarch64/predicates.md	2018-02-26 16:30:01.902195208 +0100
> @@ -395,7 +395,7 @@ (define_predicate "aarch64_simd_reg_or_z
>    (and (match_code "reg,subreg,const_int,const_double,const,const_vector")
>         (ior (match_operand 0 "register_operand")
>  	    (match_test "op == const0_rtx")
> -	    (match_operand 0 "aarch64_simd_imm_zero"))))
> +	    (match_operand 0 "aarch64_simd_or_scalar_imm_zero"))))

I think this makes the match_test on the line above redundant.

LGTM otherwise (but I can't approve).  We should probably clean up
the predicates so that the zero checks are more consistent.  genrecog
could probably help by ignoring predicate codes that obviously don't
apply (CONST_INT for vectors, CONST_VECTOR for ints, etc.).  But that's
obviously all stage 1 stuff.

Richard

  reply	other threads:[~2018-02-27 14:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27  9:50 Jakub Jelinek
2018-02-27 14:22 ` Richard Sandiford [this message]
2018-02-28 21:49   ` Jakub Jelinek
2018-03-07 10:36   ` James Greenhalgh
2018-03-06 16:13 ` Patch ping (Re: [PATCH] Fix aarch64_simd_reg_or_zero predicate (PR fortran/84565)) Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87muzuh5r5.fsf@linaro.org \
    --to=richard.sandiford@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=james.greenhalgh@arm.com \
    --cc=marcus.shawcroft@arm.com \
    --cc=richard.earnshaw@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).