get_mode_bounds should also use GET_MODE_PRECISION, but this exposes a
problem on ia64 - BImode needs to be handled specially here to work
around another preexisting special case in gen_int_mode.


Bernd
        * stor-layout.c (get_mode_bounds): Use GET_MODE_PRECISION.  Special
        case BImode.

Index: gcc/stor-layout.c
===================================================================
--- gcc/stor-layout.c.orig
+++ gcc/stor-layout.c
@@ -2439,11 +2439,26 @@ get_mode_bounds (enum machine_mode mode,
                 enum machine_mode target_mode,
                 rtx *mmin, rtx *mmax)
 {
-  unsigned size = GET_MODE_BITSIZE (mode);
+  unsigned size = GET_MODE_PRECISION (mode);
   unsigned HOST_WIDE_INT min_val, max_val;
 
   gcc_assert (size <= HOST_BITS_PER_WIDE_INT);
 
+  /* gen_int_mode performs an unwanted canonicalization for BImode.  */
+  if (mode == BImode)
+    {
+      if (sign)
+       {
+         *mmin = constm1_rtx;
+         *mmax = const0_rtx;
+       }
+      else
+       {
+         *mmin = const0_rtx;
+         *mmax = const1_rtx;
+       }
+      return;
+    }
   if (sign)
     {
       min_val = -((unsigned HOST_WIDE_INT) 1 << (size - 1));

Reply via email to