public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Pop <sebpop@gmail.com>
To: Richard Guenther <rguenther@suse.de>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix PR47594: Sign extend constants while translating to Graphite
Date: Tue, 26 Jul 2011 14:33:00 -0000	[thread overview]
Message-ID: <CAFk3UF9OARBf3uQuL6QckjoZh8Ec8HaX9K-5pLYkMj9+v3kVcg@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1107261020220.810@zhemvz.fhfr.qr>

On Tue, Jul 26, 2011 at 03:22, Richard Guenther <rguenther@suse.de> wrote:
> On Mon, 25 Jul 2011, Sebastian Pop wrote:
>
>> "Bug 47594 - gfortran.dg/vect/vect-5.f90 execution test fails when
>> compiled with -O2 -fgraphite-identity"
>>
>> The problem is due to the fact that Graphite generates this loop:
>>
>>     for (scat_3=0;scat_3<=4294967295*scat_1+T_51-1;scat_3++) {
>>       S6(scat_1,scat_3);
>>     }
>>
>> that has a "-1" encoded as an unsigned "4294967295".  This constant
>> comes from the computation of the number of iterations "M - I" of
>> the inner loop:
>>
>>         do I = 1, N
>>           do J = I, M
>>             A(J,2) = B(J)
>>           end do
>>         end do
>>
>> The patch fixes the problem by sign-extending the constants for the
>> step of a chain of recurrence in scan_tree_for_params_right_scev.
>>
>> The same patter could occur for multiplication by a scalar, like in
>> "-1 * N" and so the patch also fixes these cases in
>> scan_tree_for_params.
>
> That certainly feels odd (again).  How does it end up being unsigned
> in the first place?

We got this expression from niter.  niter analysis turns all expressions
into unsigned types before starting computations.  I tried to see if we
could improve niter, but that would be a major work.  I also thought
about using PPL or ISL to implement niter for graphite.

> Randomly sign-extending stuff looks bogus to me.
> Does graphite operate on infinite precision signed integers?  Or
> does it operate on twos-complement fixed precision integers?

Graphite represents constants using mpz_t.

Sebastian

  parent reply	other threads:[~2011-07-26 14:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-25 17:07 Sebastian Pop
     [not found] ` <alpine.LNX.2.00.1107261020220.810@zhemvz.fhfr.qr>
2011-07-26 14:33   ` Sebastian Pop [this message]
2011-07-26 14:35     ` Richard Guenther
2011-07-26 14:50       ` Sebastian Pop
2011-07-26 15:26         ` Richard Guenther
2011-07-27 16:51           ` Sebastian Pop
2011-07-28  9:31             ` Richard Guenther
2011-07-30  7:37               ` Sebastian Pop
     [not found]                 ` <20110730133351.GA1564@bromo.med.uc.edu>
2011-07-30 17:09                   ` Sebastian Pop
2011-08-02  5:02                     ` [PATCH 0/2] Fix PR47594 Sebastian Pop
2011-08-02  5:03                       ` [PATCH 1/2] Use build_zero_cst or build_one_cst Sebastian Pop
2011-08-02  8:53                         ` Richard Guenther
2011-08-02  5:03                       ` [PATCH 2/2] Fix PR47594: Build signed niter expressions Sebastian Pop
2011-08-02  7:48                         ` Zdenek Dvorak
2011-08-02  9:51                         ` Richard Guenther
2011-08-02 15:10                           ` Sebastian Pop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFk3UF9OARBf3uQuL6QckjoZh8Ec8HaX9K-5pLYkMj9+v3kVcg@mail.gmail.com \
    --to=sebpop@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).