From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] tree-optimization/106513 - fix mistake in bswap symbolic number shifts
Date: Wed, 10 Aug 2022 15:59:34 +0200 [thread overview]
Message-ID: <YvO5xt5T8SPLT+9b@tucnak> (raw)
In-Reply-To: <20220810134711.51ABC13AB3@imap2.suse-dmz.suse.de>
On Wed, Aug 10, 2022 at 03:47:10PM +0200, Richard Biener via Gcc-patches wrote:
> This fixes a mistake in typing a local variable in the symbolic
> shift routine.
>
> Bootstrap & regtest pending on x86_64-unknown-linux-gnu.
>
> PR tree-optimization/106513
> * gimple-ssa-store-merging.cc (do_shift_rotate): Use uint64_t
> for head_marker.
Ok.
>
> * gcc.dg/torture/pr106513.c: New testcase.
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/torture/pr106513.c
> @@ -0,0 +1,26 @@
> +/* { dg-do run } */
> +
> +typedef __INT64_TYPE__ int64_t;
> +
> +__attribute__((noinline)) int64_t
> +swap64 (int64_t n)
> +{
> + return (((n & (((int64_t) 0xff) )) << 56) |
> + ((n & (((int64_t) 0xff) << 8)) << 40) |
> + ((n & (((int64_t) 0xff) << 16)) << 24) |
> + ((n & (((int64_t) 0xff) << 24)) << 8) |
> + ((n & (((int64_t) 0xff) << 32)) >> 8) |
> + ((n & (((int64_t) 0xff) << 40)) >> 24) |
> + ((n & (((int64_t) 0xff) << 48)) >> 40) |
> + ((n & ((int64_t)(0xffull << 56))) >> 56));
> +}
> +
> +int main (void)
> +{
> + volatile int64_t n = 0x8000000000000000l;
> +
> + if (swap64(n) != 0xffffffffffffff80l)
> + __builtin_abort ();
Please use ll instead of l in both cases above.
Perhaps -0x80ll would be simpler...
Jakub
prev parent reply other threads:[~2022-08-10 13:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-10 13:47 Richard Biener
2022-08-10 13:59 ` Jakub Jelinek [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=YvO5xt5T8SPLT+9b@tucnak \
--to=jakub@redhat.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).