[gcc(refs/vendors/redhat/heads/gcc-8-branch)] [PATCH] rs6000 improve handling of built-in initialization [PR95952]

Jakub Jelinek jakub@gcc.gnu.org
Thu Sep 17 17:11:24 GMT 2020


https://gcc.gnu.org/g:8358168306e45b5757929191517c056f228aa846

commit 8358168306e45b5757929191517c056f228aa846
Author: Will Schmidt <will_schmidt@vnet.ibm.com>
Date:   Mon Jul 13 13:38:17 2020 -0500

    [PATCH] rs6000 improve handling of built-in initialization [PR95952]
    
      Handle a scenario with a combination of old hardware, gcc-8 and
    binutils where gcc will ICE during it's selftest.  This ICE was exposed
    when the builtin processing for better #pragma support was added, where
    we no longer skip builtin initialization based on the current mask.
    
    Per the bug report and assorted debug, the ICE occurrs when building
    the gcc-8 branch on a 970* based system with an old binutils.  (gcc-9 and
    newer is OK.  binutils 2.34 is reported to allow success).
    
    The attached patch adds a clause to the builtin initialization to skip
    initialization of a builtin when the builtin mask is set but the icode
    value is zero.   The subsequent assert check remains in place.
    
    2020-07-13  Will Schmidt  <will_schmidt@vnet.ibm.com>
    
    gcc/ChangeLog:
    
            PR target/95952
    
            * config/rs6000/rs6000.c (altivec_init_builtins): Add continue clause to
            predicate builtin handling.

Diff:
---
 gcc/config/rs6000/rs6000.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 2f7bac6adff..05414306ac4 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -18017,6 +18017,22 @@ altivec_init_builtins (void)
 	mode1 = VOIDmode;
       else
 	{
+	  /* PR95952:  Gracefully skip builtins that do not have the icode properly
+	  set, but do have the builtin mask set.  This has occurred in older gcc
+	  builds with older binutils support when binutils refuses code generation
+	  for instructions that it does not support.  This was exposed by changes
+	  allowing all builtins being initialized for better #pragma support.  */
+	  if (d->icode == CODE_FOR_nothing && d->mask)
+	    {
+	      HOST_WIDE_INT builtin_mask = rs6000_builtin_mask;
+	      if (TARGET_DEBUG_BUILTIN)
+		{
+		  fprintf (stderr, "altivec predicate builtin %s skipped", d->name);
+		  fprintf (stderr, " (icode:%d, mask:%lx, builtin_mask:0x%lx\n",
+			   d->icode, d->mask, builtin_mask);
+		}
+	      continue;
+	    }
 	  /* Cannot define builtin if the instruction is disabled.  */
 	  gcc_assert (d->icode != CODE_FOR_nothing);
 	  mode1 = insn_data[d->icode].operand[1].mode;


More information about the Gcc-cvs mailing list