Generate in priority signed types for integer constants.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Sep 2010 21:16:25 +0000 (21:16 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Sep 2010 21:16:25 +0000 (21:16 +0000)
2010-07-29  Sebastian Pop  <sebastian.pop@amd.com>

* graphite-clast-to-gimple.c (gcc_type_for_interval): Generate in
priority signed types.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164772 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ChangeLog.graphite
gcc/graphite-clast-to-gimple.c

index 20fa477..51522af 100644 (file)
@@ -1,5 +1,10 @@
 2010-09-30  Sebastian Pop  <sebastian.pop@amd.com>
 
+       * graphite-clast-to-gimple.c (gcc_type_for_interval): Generate in
+       priority signed types.
+
+2010-09-30  Sebastian Pop  <sebastian.pop@amd.com>
+
        * graphite-clast-to-gimple.c (max_signed_precision_type): Remove the call
        to lang_hooks.types.type_for_size.  Call build_nonstandard_integer_type.
 
index dd37363..b469a12 100644 (file)
@@ -1,5 +1,10 @@
 2010-07-29  Sebastian Pop  <sebastian.pop@amd.com>
 
+       * graphite-clast-to-gimple.c (gcc_type_for_interval): Generate in
+       priority signed types.
+
+2010-07-29  Sebastian Pop  <sebastian.pop@amd.com>
+
        * graphite-clast-to-gimple.c (max_signed_precision_type): Remove the call
        to lang_hooks.types.type_for_size.  Call build_nonstandard_integer_type.
 
index 73bd971..88a72f1 100644 (file)
@@ -459,9 +459,6 @@ gcc_type_for_interval (mpz_t low, mpz_t up)
 
   gcc_assert (mpz_cmp (low, up) <= 0);
 
-  if (mpz_sgn (low) < 0)
-    unsigned_p = false;
-
   prec_up = precision_for_value (up);
   prec_int = precision_for_interval (low, up);
   precision = MAX (prec_up, prec_int);
@@ -472,6 +469,15 @@ gcc_type_for_interval (mpz_t low, mpz_t up)
       return integer_type_node;
     }
 
+  if (mpz_sgn (low) <= 0)
+    unsigned_p = false;
+
+  else if (precision < BITS_PER_WORD)
+    {
+      unsigned_p = false;
+      precision++;
+    }
+
   mode = smallest_mode_for_size (precision, MODE_INT);
   precision = GET_MODE_PRECISION (mode);
   type = build_nonstandard_integer_type (precision, unsigned_p);