Patchwork [03/44] Generate in priority signed types for integer constants.

login
register
mail settings
Submitter Sebastian Pop
Date Sept. 30, 2010, 6 p.m.
Message ID <1285869696-10915-4-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/66190/
State New
Headers show

Comments

Sebastian Pop - Sept. 30, 2010, 6 p.m.
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>

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/branches/graphite@162703 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                  |    5 +++++
 gcc/ChangeLog.graphite         |    5 +++++
 gcc/graphite-clast-to-gimple.c |   12 +++++++++---
 3 files changed, 19 insertions(+), 3 deletions(-)
H.J. Lu - Dec. 2, 2010, 3:04 a.m.
On Thu, Sep 30, 2010 at 11:00 AM, Sebastian Pop <sebpop@gmail.com> wrote:
> From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
>
> 2010-07-29  Sebastian Pop  <sebastian.pop@amd.com>
>
>        * graphite-clast-to-gimple.c (gcc_type_for_interval): Generate in
>        priority signed types.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46761
H.J. Lu - Feb. 9, 2011, 4:03 a.m.
On Wed, Dec 1, 2010 at 7:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Sep 30, 2010 at 11:00 AM, Sebastian Pop <sebpop@gmail.com> wrote:
>> From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
>>
>> 2010-07-29  Sebastian Pop  <sebastian.pop@amd.com>
>>
>>        * graphite-clast-to-gimple.c (gcc_type_for_interval): Generate in
>>        priority signed types.
>>
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46761
>
>

This also caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47654
H.J. Lu - Feb. 9, 2011, 4:05 a.m.
On Tue, Feb 8, 2011 at 8:03 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Dec 1, 2010 at 7:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Thu, Sep 30, 2010 at 11:00 AM, Sebastian Pop <sebpop@gmail.com> wrote:
>>> From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
>>>
>>> 2010-07-29  Sebastian Pop  <sebastian.pop@amd.com>
>>>
>>>        * graphite-clast-to-gimple.c (gcc_type_for_interval): Generate in
>>>        priority signed types.
>>>
>>
>> This caused:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46761
>>
>>
>
> This also caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47654
>
>

This also caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47655

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b78ba82..6e10b2f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
 
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index dd37363..b469a12 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 73bd971..88a72f1 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);