From: Jakub Jelinek <jakub@redhat.com>
To: Kyrill Tkachov <kyrylo.tkachov@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>,
Richard Earnshaw <Richard.Earnshaw@arm.com>
Subject: Re: [PATCH][ARM] PR 65694: Properly sign-extend large numbers before passing to GEN_INT in arm_canonicalize_comparison
Date: Fri, 10 Apr 2015 08:57:00 -0000 [thread overview]
Message-ID: <20150410085720.GS19273@tucnak.redhat.com> (raw)
In-Reply-To: <55278AC7.9070807@arm.com>
On Fri, Apr 10, 2015 at 09:33:11AM +0100, Kyrill Tkachov wrote:
> 2015-04-09 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
Missing
PR target/65694
line here.
> * config/arm/arm.c (arm_canonicalize_comparison): Use ARM_SIGN_EXTEND
> when creating +1 values for SImode and trunc_int_for_mode for similar
> DImode operations.
>
> 2015-04-09 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
Ditto.
> * g++.dg/torture/pr65694.C: New test.
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index 369cb67..5342b33 100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -4984,7 +4984,7 @@ arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
> if (i != maxval
> && arm_const_double_by_immediates (GEN_INT (i + 1)))
> {
> - *op1 = GEN_INT (i + 1);
> + *op1 = GEN_INT (trunc_int_for_mode (i + 1, DImode));
> *code = *code == GT ? GE : LT;
> return;
> }
> @@ -4994,7 +4994,7 @@ arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
> if (i != ~((unsigned HOST_WIDE_INT) 0)
> && arm_const_double_by_immediates (GEN_INT (i + 1)))
> {
> - *op1 = GEN_INT (i + 1);
> + *op1 = GEN_INT (trunc_int_for_mode (i + 1, DImode));
The above two aren't strictly necessary, HOST_WIDE_INT is always 64-bit, so
is DImode, and GEN_INT takes HOST_WIDE_INT.
You haven't changed it in the GEN_INT (i + 1) calls passed to
arm_const_double_by_immediates anyway.
I'd think you can leave those changes to cleanup in stage1 if desirable.
> @@ -5047,7 +5047,7 @@ arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
> if (i != maxval
> && (const_ok_for_arm (i + 1) || const_ok_for_arm (-(i + 1))))
> {
> - *op1 = GEN_INT (i + 1);
> + *op1 = GEN_INT (ARM_SIGN_EXTEND (i + 1));
> *code = *code == GT ? GE : LT;
> return;
> }
> @@ -5069,7 +5069,7 @@ arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
> if (i != ~((unsigned HOST_WIDE_INT) 0)
> && (const_ok_for_arm (i + 1) || const_ok_for_arm (-(i + 1))))
> {
> - *op1 = GEN_INT (i + 1);
> + *op1 = GEN_INT (ARM_SIGN_EXTEND (i + 1));
> *code = *code == GTU ? GEU : LTU;
> return;
> }
This looks ok to me, but I'll defer the final word to ARM maintainers.
That said, the ARM_SIGN_EXTEND macro could very well use some cleanup too
now that HOST_WIDE_INT is always 64-bit and one can e.g. use
HOST_WIDE_INT_{U,}C macros to build large constants.
Jakub
next prev parent reply other threads:[~2015-04-10 8:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 8:33 Kyrill Tkachov
2015-04-10 8:57 ` Jakub Jelinek [this message]
2015-04-10 11:06 ` Kyrill Tkachov
2015-04-10 16:11 ` Jakub Jelinek
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=20150410085720.GS19273@tucnak.redhat.com \
--to=jakub@redhat.com \
--cc=Richard.Earnshaw@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=kyrylo.tkachov@arm.com \
--cc=ramana.radhakrishnan@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).