diff mbox

[gomp4,5/23] Use precisions in get_mode_bounds and fix BImode

Message ID 52A5DA28.2060902@codesourcery.com
State New
Headers show

Commit Message

Bernd Schmidt Dec. 9, 2013, 2:56 p.m. UTC

diff mbox

Patch

This is actually an old patch from the C6X 40-bit-int patchkit which
fell through the cracks. It turns out to be necessary for ptx to get
correct behaviour for BImode.

	gcc/
	* stor-layout.c (get_mode_bounds): Use GET_MODE_PRECISION, not
	GET_MODE_BITSIZE.  Handle BImode specially.

------------------------------------------------------------------------
Index: gcc/stor-layout.c
===================================================================
--- gcc/stor-layout.c.orig
+++ gcc/stor-layout.c
@@ -2827,11 +2827,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));