public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: James Greenhalgh <james.greenhalgh@arm.com>
To: Sudi Das <Sudi.Das@arm.com>
Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>,
	"gcc-patches@gcc.gnu.org"	<gcc-patches@gcc.gnu.org>,
	nd <nd@arm.com>, Marcus Shawcroft	<Marcus.Shawcroft@arm.com>
Subject: Re: [PATCH][AArch64] Add BIC-imm and ORR-imm SIMD pattern
Date: Tue, 26 Sep 2017 19:04:00 -0000	[thread overview]
Message-ID: <20170926190437.GA40622@arm.com> (raw)
In-Reply-To: <DB5PR08MB1048C82AC75F2E8FA7A96C78987A0@DB5PR08MB1048.eurprd08.prod.outlook.com>

On Mon, Sep 25, 2017 at 11:13:57AM +0100, Sudi Das wrote:
> 
> Hi James
> 
> I put aarch64_output_simd_general_immediate looking at the similarities of
> the immediates for mov/mvni and orr/bic. The CHECK macro in
> aarch64_simd_valid_immediate both checks
> and converts the immediates in a manner that are needed for the instructions.
> 
> Having said that, I agree that maybe I could have refactored
> aarch64_output_simd_mov_immediate to do the work rather than creating a new
> functions to do similar things. I have done so in this patch.

Thanks, this looks much neater.

> I have also changed the names of the enum simd_immediate_check to be better
> indicative of what they are doing. 

Thanks, I'd tweak them to look more like the bitmasks you use them as, but
that is a small change for my personal preference.

> Lastly I have added more cases in the tests (according to all the possible
> CHECKs) and made them dg-do assemble (although I had to add --save-temps so
> that the scan-assembler would work). Do you think I should not put that
> option and rather create separate tests?

This is good - thanks.

I think clean up the enum definitions and this patch will be good.

> @@ -308,6 +308,16 @@ enum aarch64_parse_opt_result
>    AARCH64_PARSE_INVALID_ARG		/* Invalid arch, tune, cpu arg.  */
>  };
>  
> +/* Enum to distinguish which type of check is to be done in
> +   aarch64_simd_valid_immediate.  This is used as a bitmask where
> +   AARCH64_CHECK_MOV has both bits set.  Thus AARCH64_CHECK_MOV will
> +   perform all checks.  Adding new types would require changes accordingly.  */
> +enum simd_immediate_check {
> +  AARCH64_CHECK_ORR  = 1,	/* Perform immediate checks for ORR.  */
> +  AARCH64_CHECK_BIC  = 2,	/* Perform immediate checks for BIC.  */
> +  AARCH64_CHECK_MOV  = 3	/* Perform all checks (used for MOVI/MNVI).  */

These are used in bit-mask style, so how about:

  AARCH64_CHECK_ORR = 1 << 0,
  AARCH64_CHECK_BIC = 1 << 1,
  AARCH64_CHECK_MOV = AARCH64_CHECK_ORR | AARCH64_CHECK_BIC

Which is more self-documenting.

> @@ -13001,7 +13013,8 @@ aarch64_float_const_representable_p (rtx x)
>  char*
>  aarch64_output_simd_mov_immediate (rtx const_vector,
>  				   machine_mode mode,
> -				   unsigned width)
> +				   unsigned width,
> +				   enum simd_immediate_check which)

This function is sorely missing a comment explaining the parameters - it
would be very helpful if you could add one as part of this patch.

Thanks,
James

  reply	other threads:[~2017-09-26 19:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18 16:51 Sudi Das
2017-05-05 13:38 ` Richard Earnshaw (lists)
2017-08-07 13:56   ` Sudi Das
2017-09-20 10:39     ` James Greenhalgh
2017-09-25 10:14       ` Sudi Das
2017-09-26 19:04         ` James Greenhalgh [this message]
2017-09-27 17:57           ` Sudi Das
2017-09-28  8:55             ` Richard Earnshaw (lists)
2017-10-02  9:05               ` Sudi Das
2017-10-04 15:41                 ` Richard Earnshaw (lists)
2017-10-04 23:05                   ` Steve Ellcey
2017-10-05 15:41                     ` Sudi Das

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=20170926190437.GA40622@arm.com \
    --to=james.greenhalgh@arm.com \
    --cc=Marcus.Shawcroft@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=Sudi.Das@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@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).