public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: "Kewen.Lin" <linkw@linux.ibm.com>
Cc: Iain Sandoe <iain@sandoe.co.uk>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] rs6000: Rework option -mpowerpc64 handling [PR106680]
Date: Thu, 29 Sep 2022 12:11:00 -0500	[thread overview]
Message-ID: <20220929171100.GY25951@gate.crashing.org> (raw)
In-Reply-To: <5e64fed0-7e79-3d60-da62-5c2bf3e2c707@linux.ibm.com>

On Thu, Sep 29, 2022 at 01:45:16PM +0800, Kewen.Lin wrote:
> I found this flag is mainly related to tune setting and spotted that we have some code
> for tune setting when no explicit cpu is given. 
> 
> ...
> 
>   else
>     {
>       size_t i;
>       enum processor_type tune_proc
> 	= (TARGET_POWERPC64 ? PROCESSOR_DEFAULT64 : PROCESSOR_DEFAULT);
> 
>       tune_index = -1;
>       for (i = 0; i < ARRAY_SIZE (processor_target_table); i++)
> 	if (processor_target_table[i].processor == tune_proc)
> 	  {
> 	    tune_index = i;
> 	    break;
> 	  }
>     }

Ah cool, that needs fixing yes.

> --- a/gcc/config/rs6000/rs6000.cc
> +++ b/gcc/config/rs6000/rs6000.cc
> @@ -3702,7 +3702,7 @@ rs6000_option_override_internal (bool global_init_p)
>        else
>  	{
>  	  /* PowerPC 64-bit LE requires at least ISA 2.07.  */
> -	  const char *default_cpu = (!TARGET_POWERPC64
> +	  const char *default_cpu = (!TARGET_POWERPC64 && TARGET_32BIT
>  				     ? "powerpc"
>  				     : (BYTES_BIG_ENDIAN
>  					? "powerpc64"

... but not like that.  If this snippet should happen later just move it
later.  Or introduce a new variable to make the control flow less
confused.  Or something else.  But don't make the code more complex,
introducing more special cases like this.

> +#ifdef OS_MISSING_POWERPC64
> +      else if (OS_MISSING_POWERPC64)
> +	/* It's unexpected to have OPTION_MASK_POWERPC64 on for OSes which
> +	   miss powerpc64 support, so disable it.  */
> +	rs6000_isa_flags &= ~OPTION_MASK_POWERPC64;
> +#endif

All silent stuff is always bad.

If things are done well, we will end up with *less* code than what we
had before, not more!


Segher

  parent reply	other threads:[~2022-09-29 17:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28  5:30 Kewen.Lin
2022-09-28  6:37 ` Iain Sandoe
2022-09-28 16:18   ` Iain Sandoe
2022-09-28 19:09     ` Iain Sandoe
2022-09-29  5:45       ` Kewen.Lin
2022-09-29  8:16         ` Iain Sandoe
2022-09-29  9:12           ` Kewen.Lin
2022-09-29 16:14             ` Iain Sandoe
2022-09-29 17:04           ` Segher Boessenkool
2022-09-29 18:25             ` Iain Sandoe
2022-09-29 18:37               ` Segher Boessenkool
2022-09-30  9:26                 ` Kewen.Lin
2022-09-29 17:11         ` Segher Boessenkool [this message]
2022-09-30 12:15           ` Kewen.Lin
2022-10-03 21:15             ` Segher Boessenkool
2022-10-10  2:15               ` Kewen.Lin
2022-10-10 13:58                 ` Segher Boessenkool
2022-10-12  8:26                   ` Kewen.Lin
2022-09-28 21:30     ` Segher Boessenkool
2022-09-28 23:04       ` Iain Sandoe
2022-09-28 23:16         ` Iain Sandoe
2022-09-29 17:26           ` Segher Boessenkool
2022-09-29 17:18         ` Segher Boessenkool
2022-09-29 18:33           ` Iain Sandoe
2022-09-29 18:50             ` Segher Boessenkool
2022-09-28 22:04 ` Segher Boessenkool
2022-09-29  6:16   ` Kewen.Lin
2022-09-29 18:56     ` Segher Boessenkool

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=20220929171100.GY25951@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iain@sandoe.co.uk \
    --cc=linkw@linux.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).