public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Jiong Wang <jiong.wang@arm.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix seq_cost prototype to use signed int
Date: Tue, 08 Sep 2015 15:39:00 -0000	[thread overview]
Message-ID: <55EF0061.6090203@redhat.com> (raw)
In-Reply-To: <n99zj0x6ipx.fsf@arm.com>

On 09/08/2015 09:17 AM, Jiong Wang wrote:
>
> Jeff Law writes:
>
>> On 09/08/2015 06:17 AM, Jiong Wang wrote:
>>>
>>> All other cost helper functions are using signed int to hold cost
>>> while seq_cost is using unsigned int.
>>>
>>> This fix this. bootstrap OK on x86.
>>>
>>> OK for trunk?
>>>
>>> 2015-09-08  Jiong Wang  <jiong.wang@arm.com>
>>>
>>> gcc/
>>>     * rtl.h (seq_cost): Change return type from "unsigned" to "int".
>>>     * rtlanal.c (seq_cost): Likewise.
>> Why not go the other way and start making things unsigned -- for a cost
>> function like this, unsigned seems more natural to me.
>
> I was using "(unsigned) -1" to represent maximum cost, then later known
> there is MAX_COST macro and found it's actually signed type, and quick
> search shows most of the code in gcc/rtlanal.c, are using "int", so I am
> changing seq_cost which seems to be the only cost helper using unsigned.
Understood.  But the natural type should be unsigned as far as I can 
tell.  The fact that we're using signed types all over the place is 
probably a historical wart.

So I'd start by changing the MAX_COST macro to an unsigned type, then 
fix any fallout from that.  That should be a patch unto itself.  Then we 
can have additional follow-up patches to fix the types of costing 
related variables, parameters & return values.

Jeff

      reply	other threads:[~2015-09-08 15:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08 12:26 Jiong Wang
2015-09-08 15:03 ` Jeff Law
2015-09-08 15:27   ` Jiong Wang
2015-09-08 15:39     ` Jeff Law [this message]

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=55EF0061.6090203@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jiong.wang@arm.com \
    /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).