[committed] Fix minor bug in ft32 widening multiply

Jeff Law law@redhat.com
Mon Nov 30 01:28:56 GMT 2020


Combine has this little check:

     /* Replacing the operand of a SUBREG or a ZERO_EXTEND with a
         CONST_INT is not valid, because after the replacement, the
         original mode would be gone.  Unfortunately, we can't tell
         when do_SUBST is called to replace the operand thereof, so we
         perform this test on oldval instead, checking whether an
         invalid replacement took place before we got here.  */
      gcc_assert (!(GET_CODE (oldval) == SUBREG
                    && CONST_INT_P (SUBREG_REG (oldval))));
      gcc_assert (!(GET_CODE (oldval) == ZERO_EXTEND
                    && CONST_INT_P (XEXP (oldval, 0))));


Which indirectly implies that we can never have these in the IL prior to
combine.  The ft32 port has recently started regressing a few tests
because it's triggering those assertions.  This isn't a huge surprise as
the port allows (zero_extend (const_int)) for a subset of const_int values.


This patch tightens the predicate & constraints which fixes the recent
regression.  In fact, it fixes a few dozen long standing failures in the
testsuite on ft32-elf and since the compiler is no longer faulting as
much, there's more execution tests being run as well.

Committed to the trunk.

JEff
-------------- next part --------------
commit a8ae23920f9c954ed66bd92ddbdbb1b8486b950f
Author: Stefan Kanthak <stefan.kanthak@nexgo.de>
Date:   Sun Nov 29 18:05:46 2020 -0700

    fixed _bswapsi2 function
    
    libgcc
    
            * libgcc2.c (bswapsi2): Make constants unsigned.

diff --git a/libgcc/libgcc2.c b/libgcc/libgcc2.c
index 1921d80f612..61de3b42e1d 100644
--- a/libgcc/libgcc2.c
+++ b/libgcc/libgcc2.c
@@ -468,10 +468,10 @@ __ashrdi3 (DWtype u, shift_count_type b)
 SItype
 __bswapsi2 (SItype u)
 {
-  return ((((u) & 0xff000000) >> 24)
-	  | (((u) & 0x00ff0000) >>  8)
-	  | (((u) & 0x0000ff00) <<  8)
-	  | (((u) & 0x000000ff) << 24));
+  return ((((u) & 0xff000000u) >> 24)
+	  | (((u) & 0x00ff0000u) >>  8)
+	  | (((u) & 0x0000ff00u) <<  8)
+	  | (((u) & 0x000000ffu) << 24));
 }
 #endif
 #ifdef L_bswapdi2


More information about the Gcc-patches mailing list