This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 2/3] Generate in priority signed types for integer constants.
- From: Sebastian Pop <sebpop at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: gcc-graphite at googlegroups dot com, Sebastian Pop <sebpop at gmail dot com>
- Date: Thu, 29 Jul 2010 21:06:36 -0500
- Subject: [PATCH 2/3] Generate in priority signed types for integer constants.
- References: <1280455597-2075-1-git-send-email-sebpop@gmail.com>
2010-07-29 Sebastian Pop <sebastian.pop@amd.com>
* graphite-clast-to-gimple.c (gcc_type_for_interval): Generate in
priority signed types.
---
gcc/ChangeLog.graphite | 5 +++++
gcc/graphite-clast-to-gimple.c | 12 +++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 9898a8c..8278652 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -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.
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 534c88e..c642d19 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -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);
--
1.7.0.4