public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>
To: Jim Wilson <jim.wilson@linaro.org>, Michael Matz <matz@suse.de>
Cc: Richard Biener <richard.guenther@gmail.com>,
	 Jeff Law <law@redhat.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, ARM] stop changing signedness in PROMOTE_MODE
Date: Thu, 16 Jul 2015 09:40:00 -0000	[thread overview]
Message-ID: <55A775B9.8040701@foss.arm.com> (raw)
In-Reply-To: <CABXYE2Us3rBaVr02+cxGKm8KrUU8MbX=dGKauim=zhMOL3L5OQ@mail.gmail.com>

On 15/07/15 16:54, Jim Wilson wrote:
> On Wed, Jul 15, 2015 at 6:04 AM, Michael Matz <matz@suse.de> wrote:
>> Hi,
>>
>> On Tue, 14 Jul 2015, Jim Wilson wrote:
>>
>>> Now that we do have the problem, we can't fix it without an ARM port ABI
>>> change, which is undesirable, so we may have to fix it with a MI change.
>>
>> What's the ABI implication of fixing the inconsistency?
> 

I think that's the wrong question.  We wouldn't change the ABI to fix an
internal problem in GCC.  So the real question is what's the performance
impact of changing PROMOTE_MODE to be the same as the ABI requirements?

There's no easy answer to that since we'd have to consider all the
different architecture variants we currently have to support.  At the
very least we'd have to think about ARMv3 (no signed byte or half-word
loads), ARMv4 (signed byte and half-word loads), ARMv4t (thumb1) and
ARMv7 (thumb2).

R.

> Currently signed chars and signed shorts are passed sign-extended.  If
> we make TARGET_PROMOTE_FUNCTION_MODE work the same as PROMOTE_MODE,
> then they will be passed zero-extended.
> 
> Given the testcase:
> 
> int sub (int) __attribute__ ((noinline));
> int sub2 (signed char) __attribute__ ((noinline));
> int sub (int i) { return sub2 (i); }
> int sub2 (signed char c) { return c & 0xff; }
> 
> Currently sub will do a char sign-extend to convert the int to signed
> char, and sub2 will do a char zero-extend for the and.  With the
> change, sub will do a char zero-extend to convert the int to unsigned
> char, and sub2 will do nothing.  If you compile sub without the change
> and sub2 with the change, then you lose the and operation and get a
> sign-extended char at the end.
> 
>>> There were two MI changes suggested, one was fixing the out-of-ssa pass
>>> to handle SUBREG_PROMOTED_P promotions.  The other was to disallow
>>> creating PHI nodes between parms and locals.  I haven't had a chance to
>>> try implementing the second one yet; I hope to work on that today.
>>
>> Don't bother with the latter, it doesn't have a chance of being accepted.
> 
> I tried looking at it anyways, as I need to learn more about this
> stuff.  It didn't seem feasible without changing a lot of optimization
> passes which doesn't seem reasonable.
> 
>> If the terrible hack in outof-ssa really will be necessary (and I really
>> really hope it won't) then I think I prefer the approach you partly tried
>> in comment #12 of PR 65932 already.  Let partition_to_pseudo[] refer to
>> the promoted subreg and deal with that situation in emit_partition_copy;
>> I'd then hope that the unsignedsrcp parameter could go away (unfortunately
>> the sizeexp will have to stay).
> 
> Yes, I think that is a cleaner way to do it, but I had trouble getting
> that to work as I don't know enough about the code yet.  Doing it
> directly in emit_partition_copy was easier, just to prove it could
> work.  I can go back and try to make this work again.
> 
> Jim
> 

  reply	other threads:[~2015-07-16  9:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30  1:56 Jim Wilson
2015-07-02  9:07 ` Richard Earnshaw
2015-07-07 18:25   ` Jim Wilson
2015-07-07 15:07 ` Jeff Law
2015-07-07 16:29   ` Jim Wilson
2015-07-07 21:35     ` Richard Biener
2015-07-10 15:46       ` Jim Wilson
2015-07-13  8:19         ` Richard Biener
2015-07-13 15:29           ` Michael Matz
2015-07-13 15:35             ` H.J. Lu
2015-07-14 16:38             ` Richard Earnshaw
2015-07-14 16:49               ` Richard Biener
2015-07-14 17:07               ` Jim Wilson
2015-07-14 17:23                 ` Richard Biener
2015-07-15 13:25                 ` Michael Matz
2015-07-15 16:01                   ` Jim Wilson
2015-07-16  9:40                     ` Richard Earnshaw [this message]
2015-07-16 15:02                       ` Michael Matz
2015-07-16 15:20                         ` Richard Earnshaw
2015-07-15 13:04               ` Michael Matz
2015-07-08 22:54     ` Jeff Law
2015-07-10 15:35       ` Jim Wilson
2016-02-04  8:58 ` Ramana Radhakrishnan
2016-02-15 11:32   ` Kyrill Tkachov
2016-02-16 10:44     ` Ramana Radhakrishnan
2016-02-17 10:03     ` Christophe Lyon
2016-02-17 10:05       ` Kyrill Tkachov
2016-02-17 10:20         ` Christophe Lyon
2016-02-17 10:22           ` Kyrill Tkachov
2016-02-18 10:16             ` Christophe Lyon
2016-03-07  4:43           ` Ramana Radhakrishnan
2016-03-07 12:55             ` Christophe Lyon

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=55A775B9.8040701@foss.arm.com \
    --to=richard.earnshaw@foss.arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jim.wilson@linaro.org \
    --cc=law@redhat.com \
    --cc=matz@suse.de \
    --cc=richard.guenther@gmail.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).