public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: gcc-patches@gcc.gnu.org, richard.earnshaw@arm.com,
	marcus.shawcroft@arm.com, kyrylo.tkachov@arm.com,
	Wilco.Dijkstra@arm.com
Subject: Re: [PATCH v2 1/9] aarch64: Accept 0 as first argument to compares
Date: Tue, 31 Mar 2020 17:55:44 +0100	[thread overview]
Message-ID: <mptr1x8a2gf.fsf@arm.com> (raw)
In-Reply-To: <20200321024231.13778-2-richard.henderson@linaro.org> (Richard Henderson's message of "Fri, 20 Mar 2020 19:42:23 -0700")

Richard Henderson <richard.henderson@linaro.org> writes:
> While cmp (extended register) and cmp (immediate) uses <Wn|WSP>,
> cmp (shifted register) uses <Wn>.  So we can perform cmp xzr, x0.
>
> For ccmp, we only have <Wn> as an input.
>
> 	* config/aarch64/aarch64.md (cmp<GPI>): For operand 0, use
> 	aarch64_reg_or_zero.  Shuffle reg/reg to last alternative
> 	and accept Z.
> 	(@ccmpcc<GPI>): For operand 0, use aarch64_reg_or_zero and Z.
> 	(@ccmpcc<GPI>_rev): Likewise.

Looks good, but...

> ---
>  gcc/config/aarch64/aarch64.md | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index c7c4d1dd519..b9ae51e48dd 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> @@ -502,7 +502,7 @@
>  	   [(match_operand 0 "cc_register" "")
>  	    (const_int 0)])
>  	  (compare:CC_ONLY
> -	    (match_operand:GPI 2 "register_operand" "r,r,r")
> +	    (match_operand:GPI 2 "aarch64_reg_or_zero" "rZ,rZ,rZ")
>  	    (match_operand:GPI 3 "aarch64_ccmp_operand" "r,Uss,Usn"))
>  	  (unspec:CC_ONLY
>  	    [(match_operand 5 "immediate_operand")]
> @@ -542,7 +542,7 @@
>  	    [(match_operand 5 "immediate_operand")]
>  	    UNSPEC_NZCV)
>  	  (compare:CC_ONLY
> -	    (match_operand:GPI 2 "register_operand" "r,r,r")
> +	    (match_operand:GPI 2 "aarch64_reg_or_zero" "rZ,rZ,rZ")
>  	    (match_operand:GPI 3 "aarch64_ccmp_operand" "r,Uss,Usn"))))]
>    ""
>    "@
> @@ -3961,14 +3961,14 @@
>  
>  (define_insn "cmp<mode>"
>    [(set (reg:CC CC_REGNUM)
> -	(compare:CC (match_operand:GPI 0 "register_operand" "rk,rk,rk")
> -		    (match_operand:GPI 1 "aarch64_plus_operand" "r,I,J")))]
> +	(compare:CC (match_operand:GPI 0 "aarch64_reg_or_zero" "rk,rk,rkZ")
> +		    (match_operand:GPI 1 "aarch64_plus_operand" "I,J,rZ")))]
>    ""
>    "@
> -   cmp\\t%<w>0, %<w>1
>     cmp\\t%<w>0, %1
> -   cmn\\t%<w>0, #%n1"
> -  [(set_attr "type" "alus_sreg,alus_imm,alus_imm")]
> +   cmn\\t%<w>0, #%n1
> +   cmp\\t%<w>0, %<w>1"
> +  [(set_attr "type" "alus_imm,alus_imm,alus_sreg")]
>  )
>  
>  (define_insn "fcmp<mode>"

...does adding 'Z' to operand 1 enable any new combinations?
I guess it allows (compare:CC (const_int 0) (const_int 0)),
but it's borderline whether that should be valid rtl.

Richard

  reply	other threads:[~2020-03-31 16:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-21  2:42 [PATCH v2 0/9] aarch64: Implement TImode comparisons Richard Henderson
2020-03-21  2:42 ` [PATCH v2 1/9] aarch64: Accept 0 as first argument to compares Richard Henderson
2020-03-31 16:55   ` Richard Sandiford [this message]
2020-03-31 17:15     ` Richard Henderson
2020-03-21  2:42 ` [PATCH v2 2/9] aarch64: Accept zeros in add<GPI>3_carryin Richard Henderson
2020-03-21  2:42 ` [PATCH v2 3/9] aarch64: Add <su>cmp_*_carryinC patterns Richard Henderson
2020-03-22 19:30   ` Segher Boessenkool
2020-03-22 20:40     ` Richard Henderson
2020-03-31 18:34   ` Richard Sandiford
2020-03-31 22:44     ` Richard Henderson
2020-04-01 12:37       ` Segher Boessenkool
2020-04-01 16:28       ` Richard Sandiford
2020-04-01 17:14         ` Richard Henderson
2020-03-21  2:42 ` [PATCH v2 4/9] aarch64: Add <su>cmp<GPI>_carryinC_m2 Richard Henderson
2020-03-21  2:42 ` [PATCH v2 5/9] aarch64: Provide expander for sub<GPI>3_compare1 Richard Henderson
2020-03-21  2:42 ` [PATCH v2 6/9] aarch64: Introduce aarch64_expand_addsubti Richard Henderson
2020-03-21  2:42 ` [PATCH v2 7/9] aarch64: Adjust result of aarch64_gen_compare_reg Richard Henderson
2020-03-22 21:55   ` Segher Boessenkool
2020-03-22 22:21     ` Richard Henderson
2020-03-21  2:42 ` [PATCH v2 8/9] aarch64: Implement TImode comparisons Richard Henderson
2020-03-21  2:42 ` [PATCH v2 9/9] aarch64: Implement absti2 Richard Henderson

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=mptr1x8a2gf.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=marcus.shawcroft@arm.com \
    --cc=richard.earnshaw@arm.com \
    --cc=richard.henderson@linaro.org \
    /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).