public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kewen Lin <linkw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-6383] rs6000: Allow powerpc64 to be unset for implicit 64 bit [PR108240]
Date: Wed,  1 Mar 2023 05:19:26 +0000 (GMT)	[thread overview]
Message-ID: <20230301051926.DE0043858D33@sourceware.org> (raw)

https://gcc.gnu.org/g:392f399ae0595e6b4433c18900cc67991fb140f4

commit r13-6383-g392f399ae0595e6b4433c18900cc67991fb140f4
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue Feb 28 23:17:48 2023 -0600

    rs6000: Allow powerpc64 to be unset for implicit 64 bit [PR108240]
    
    Before r13-4894, if 64 bit is explicitly specified, option
    powerpc64 is explicitly enabled too; while if 64 bit is
    implicitly enabled and there is no explicit setting for
    option powerpc64, option powerpc64 is eventually enabled
    or not would rely on the default value of the used cpu.
    It's initially set as the setting for 64 bit, but later if
    the used cpu doesn't have powerpc64 supported by default,
    it gets cleared.
    
    To keep it consistent with before (also the relevant error/
    warning messages), this patch is to allow that powerpc64
    can be unset if 64 bit is enabled implicitly, and only stop
    it from being unset if 64 bit is enabled explicitly.
    
    Note that since the behaviors are different for implicit
    and explicit 64 bit, I failed to construct one solid test
    case since it becomes fragile once RUNTESTFLAGS specifying
    -m64 explicitly.
    
            PR target/108240
    
    gcc/ChangeLog:
    
            * config/rs6000/rs6000.cc (rs6000_option_override_internal): Allow
            implicit powerpc64 setting to be unset if 64 bit is enabled implicitly.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 16ca3a31757..8e0b0d022db 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -3662,14 +3662,17 @@ rs6000_option_override_internal (bool global_init_p)
 
   /* Without option powerpc64 specified explicitly, we need to ensure
      powerpc64 always enabled for 64 bit here, otherwise some following
-     checks can use unexpected TARGET_POWERPC64 value.  Meanwhile, we
-     need to ensure set_masks doesn't have OPTION_MASK_POWERPC64 on,
-     otherwise later processing can clear it.  */
+     checks can use unexpected TARGET_POWERPC64 value.  */
   if (!(rs6000_isa_flags_explicit & OPTION_MASK_POWERPC64)
       && TARGET_64BIT)
     {
       rs6000_isa_flags |= OPTION_MASK_POWERPC64;
-      set_masks &= ~OPTION_MASK_POWERPC64;
+      /* Need to stop powerpc64 from being unset in later processing,
+	 so clear it in set_masks.  But as PR108240 shows, to keep it
+	 consistent with before, we want to make this only if 64 bit
+	 is enabled explicitly.  This is a hack, revisit this later.  */
+      if (rs6000_isa_flags_explicit & OPTION_MASK_64BIT)
+	set_masks &= ~OPTION_MASK_POWERPC64;
     }
 
   /* Process the -mcpu=<xxx> and -mtune=<xxx> argument.  If the user changed

                 reply	other threads:[~2023-03-01  5:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230301051926.DE0043858D33@sourceware.org \
    --to=linkw@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.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).