public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kewen.Lin" <linkw@linux.ibm.com>
To: will schmidt <will_schmidt@vnet.ibm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	David Edelsohn <dje.gcc@gmail.com>,
	Segher Boessenkool <segher@kernel.crashing.org>
Subject: Re: [PATCH, rs6000] Clean up the option_mask defines (part 1)
Date: Thu, 26 May 2022 15:01:37 +0800	[thread overview]
Message-ID: <e84d86e6-6d17-d624-c6e0-b3a7fc6995ec@linux.ibm.com> (raw)
In-Reply-To: <338badbf-d784-76fb-95f2-58f6aa7ffae7@linux.ibm.com>

on 2022/5/26 14:12, Kewen.Lin via Gcc-patches wrote:
> Hi Will,
> 
> on 2022/5/26 04:25, will schmidt via Gcc-patches wrote:
>> [PATCH, rs6000] Clean up the option_mask defines
>>     
>> Hi,
>>
>> We have an assortment of MASK and OPTION_MASK #defines throughout
>> the rs6000 code, MASK_ALTIVEC and OPTION_MASK_ALTIVEC as an example.
>>
>> We currently #define the MASK_<xxxx> entries to their OPTION_MASK_<xxxx>
>> equivalents so the two names could be used interchangeably.
>>
>> The mapping is in place from when we switched from using
>> target_flags to rs6000_isa_flags via
>> commit 4d9675496a28ef6184f2a9c3ac5e6e3ea63606c1 in 2012.
>>
>> This patch converts the references for most of the lingering MASK_*
>> values to OPTION_MASK_*  and removes the now redundant defines.
>>
> 
> Nice, thanks for the cleanup!
> 
>> I have split this into multiple parts due to size.
>>
> 
> I guess they can be bootstrapped & regressed incrementally?
> 
> I found there are still some masks left:
> 
> MASK_POWERPC64, MASK_64BIT and MASK_LITTLE_ENDIAN.
> 
> Is there one part 4 for them?  Or is there some particular reason
> not to clean up them?
> 

aha, I see.  Those three are conditional definitions, I agree it's better
to leave them alone. :)


>> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
>> index d4defc855d02..200bef3f822e 100644
>> --- a/gcc/config/rs6000/rs6000.cc
>> +++ b/gcc/config/rs6000/rs6000.cc
>> @@ -20727,15 +20727,15 @@ rs6000_darwin_file_start (void)
>>      const char *arg;
>>      const char *name;
>>      HOST_WIDE_INT if_set;
>>    } mapping[] = {
>>      { "ppc64", "ppc64", MASK_64BIT },
>> -    { "970", "ppc970", MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64 },
>> +    { "970", "ppc970", OPTION_MASK_PPC_GPOPT | OPTION_MASK_MFCRF | MASK_POWERPC64 },

Nit: This line is too long.

>>      { "power4", "ppc970", 0 },
>>      { "G5", "ppc970", 0 },
>>      { "7450", "ppc7450", 0 },
>> -    { "7400", "ppc7400", MASK_ALTIVEC },
>> +    { "7400", "ppc7400", OPTION_MASK_ALTIVEC },
>>      { "G4", "ppc7400", 0 },
>>      { "750", "ppc750", 0 },
>>      { "740", "ppc750", 0 },
>>      { "G3", "ppc750", 0 },
>>      { "604e", "ppc604e", 0 },
...
>>  /* Builtin targets.  For now, we reuse the masks for those options that are in
>>     target flags, and pick a random bit for ldbl128, which isn't in
>>     target_flags.  */

Nit: Some of these BTM lines below exceed 80 characters, a few already existed
previously.

>>  #define RS6000_BTM_ALWAYS	0		/* Always enabled.  */
>> -#define RS6000_BTM_ALTIVEC	MASK_ALTIVEC	/* VMX/altivec vectors.  */
>> -#define RS6000_BTM_CMPB		MASK_CMPB	/* ISA 2.05: compare bytes.  */
>> +#define RS6000_BTM_ALTIVEC	OPTION_MASK_ALTIVEC	/* VMX/altivec vectors.  */
>> +#define RS6000_BTM_CMPB		OPTION_MASK_CMPB	/* ISA 2.05: compare bytes.  */
>>  #define RS6000_BTM_VSX		MASK_VSX	/* VSX (vector/scalar).  */
>>  #define RS6000_BTM_P8_VECTOR	MASK_P8_VECTOR	/* ISA 2.07 vector.  */
>>  #define RS6000_BTM_P9_VECTOR	MASK_P9_VECTOR	/* ISA 3.0 vector.  */
>>  #define RS6000_BTM_P9_MISC	MASK_P9_MISC	/* ISA 3.0 misc. non-vector */
>> -#define RS6000_BTM_CRYPTO	MASK_CRYPTO	/* crypto funcs.  */
>> +#define RS6000_BTM_CRYPTO	OPTION_MASK_CRYPTO	/* crypto funcs.  */
>>  #define RS6000_BTM_HTM		MASK_HTM	/* hardware TM funcs.  */
>> -#define RS6000_BTM_FRE		MASK_POPCNTB	/* FRE instruction.  */
>> -#define RS6000_BTM_FRES		MASK_PPC_GFXOPT	/* FRES instruction.  */
>> -#define RS6000_BTM_FRSQRTE	MASK_PPC_GFXOPT	/* FRSQRTE instruction.  */
>> -#define RS6000_BTM_FRSQRTES	MASK_POPCNTB	/* FRSQRTES instruction.  */
>> +#define RS6000_BTM_FRE		OPTION_MASK_POPCNTB	/* FRE instruction.  */
>> +#define RS6000_BTM_FRES		OPTION_MASK_PPC_GFXOPT	/* FRES instruction.  */
>> +#define RS6000_BTM_FRSQRTE	OPTION_MASK_PPC_GFXOPT	/* FRSQRTE instruction.  */
>> +#define RS6000_BTM_FRSQRTES	OPTION_MASK_POPCNTB	/* FRSQRTES instruction.  */
>>  #define RS6000_BTM_POPCNTD	MASK_POPCNTD	/* Target supports ISA 2.06.  */
>> -#define RS6000_BTM_CELL		MASK_FPRND	/* Target is cell powerpc.  */
>> +#define RS6000_BTM_CELL		OPTION_MASK_FPRND	/* Target is cell powerpc.  */
>>  #define RS6000_BTM_DFP		MASK_DFP	/* Decimal floating point.  */
>>  #define RS6000_BTM_HARD_FLOAT	MASK_SOFT_FLOAT	/* Hardware floating point.  */
>>  #define RS6000_BTM_LDBL128	MASK_MULTIPLE	/* 128-bit long double.  */
>>  #define RS6000_BTM_64BIT	MASK_64BIT	/* 64-bit addressing.  */
>>  #define RS6000_BTM_POWERPC64	MASK_POWERPC64	/* 64-bit registers.  */


BR,
Kewen

BR,
Kewen

  reply	other threads:[~2022-05-26  7:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 20:25 will schmidt
2022-05-25 20:29 ` [PATCH, rs6000] Clean up the option_mask defines (part 2) will schmidt
2022-05-25 20:30 ` [PATCH, rs6000] Clean up the option_mask defines (part 3) will schmidt
2022-05-26  6:12 ` [PATCH, rs6000] Clean up the option_mask defines (part 1) Kewen.Lin
2022-05-26  7:01   ` Kewen.Lin [this message]
2022-05-26 10:47     ` Segher Boessenkool
2022-05-26 14:40       ` will schmidt
2022-05-26 18:31         ` Segher Boessenkool
2022-05-26 19:38           ` will schmidt

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=e84d86e6-6d17-d624-c6e0-b3a7fc6995ec@linux.ibm.com \
    --to=linkw@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=will_schmidt@vnet.ibm.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).