public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/115688] [15 regression] ICE on simple test case from r15-703-gb390b011569635
Date: Fri, 28 Jun 2024 09:07:33 +0000	[thread overview]
Message-ID: <bug-115688-4-nCVZcc2mx0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115688-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115688

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
The assertion does expose an inconsistent combination !TARGET_ALTIVEC but
TARGET_VSX wiht 32-bit target attribute -mvsx.  There is one special handling
for altivec_abi:

  /* Disable VSX and Altivec silently if the user switched cpus to power7 in a
     target attribute or pragma which automatically enables both options,
     unless the altivec ABI was set.  This is set by default for 64-bit, but
     not for 32-bit.  Don't move this before the above code using ignore_masks,
     since it can reset the cleared VSX/ALTIVEC flag again.  */
  if (main_target_opt && !main_target_opt->x_rs6000_altivec_abi)
    rs6000_isa_flags &= ~((OPTION_MASK_VSX | OPTION_MASK_ALTIVEC)
                          & ~rs6000_isa_flags_explicit);

// 32 bit has altivec_abi unset, so that's why it doesn't ICE at -m64.

It would mask off altivec and vsx flag bit if they are not specified explicitly
for 32-bit (which has altivec_abi unset). For the given case, vsx is explicitly
specified, altivec is implicitly enabled as it's part of ISA_2_6_MASKS_SERVER.
When hitting the above hunk, vsx is kept as it's explicitly enabled but altivec
gets masked off. Then it results in an unexpected status that we have vsx but
not altivec. The fix looks to guard altivec masking off by checking if vsx is
explicitly specified.

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index cd14e5a34ed..a8a3b79dda0 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -3925,8 +3925,12 @@ rs6000_option_override_internal (bool global_init_p)
      not for 32-bit.  Don't move this before the above code using
ignore_masks,
      since it can reset the cleared VSX/ALTIVEC flag again.  */
   if (main_target_opt && !main_target_opt->x_rs6000_altivec_abi)
-    rs6000_isa_flags &= ~((OPTION_MASK_VSX | OPTION_MASK_ALTIVEC)
-                          & ~rs6000_isa_flags_explicit);
+    {
+      rs6000_isa_flags &= ~(OPTION_MASK_VSX & ~rs6000_isa_flags_explicit);
+      /* Don't mask off ALTIVEC if it is enabled by an explicit VSX.  */
+      if (!TARGET_VSX || !(rs6000_isa_flags_explicit & OPTION_MASK_VSX))
+        rs6000_isa_flags &= ~(OPTION_MASK_ALTIVEC &
~rs6000_isa_flags_explicit);
+    }

   if (TARGET_CRYPTO && !TARGET_ALTIVEC)
     {

  parent reply	other threads:[~2024-06-28  9:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 18:06 [Bug target/115688] New: " bergner at gcc dot gnu.org
2024-06-27 18:07 ` [Bug target/115688] " bergner at gcc dot gnu.org
2024-06-28  1:22 ` linkw at gcc dot gnu.org
2024-06-28  6:26 ` [Bug target/115688] [15 regression] " rguenth at gcc dot gnu.org
2024-06-28  9:07 ` linkw at gcc dot gnu.org [this message]
2024-06-28 14:50 ` segher at gcc dot gnu.org
2024-06-28 16:06 ` bergner at gcc dot gnu.org
2024-06-28 18:13 ` segher at gcc dot gnu.org
2024-06-28 23:32 ` bergner at gcc dot gnu.org
2024-06-30  2:58 ` linkw at gcc dot gnu.org
2024-06-30  3:42 ` linkw at gcc dot gnu.org

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=bug-115688-4-nCVZcc2mx0@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).