From: Segher Boessenkool <segher@kernel.crashing.org>
To: Bill Schmidt <wschmidt@linux.ibm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, v2] rs6000: Vector shift-right should honor modulo semantics
Date: Mon, 11 Feb 2019 16:02:00 -0000 [thread overview]
Message-ID: <20190211160115.GQ14180@gate.crashing.org> (raw)
In-Reply-To: <e54579dc-5249-a748-cd86-56ac47bc9564@linux.ibm.com>
Hi Bill,
On Mon, Feb 11, 2019 at 07:36:11AM -0600, Bill Schmidt wrote:
> 2019-02-11 Bill Schmidt <wschmidt@linux.ibm.com>
>
> * config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Shift-right
> and shift-left vector built-ins need to include a TRUNC_MOD_EXPR
> for correct semantics.
>
> [gcc/testsuite]
>
> 2019-02-11 Bill Schmidt <wschmidt@linux.ibm.com>
>
> * gcc.target/powerpc/vec-sld-modulo.c: New.
> * gcc.target/powerpc/vec-srad-modulo.c: New.
> * gcc.target/powerpc/vec-srd-modulo.c: New.
This is okay for trunk and backports. Thanks!
One comment:
> +vec_sldi (vui64_t vra, const unsigned int shb)
> +{
> + vui64_t lshift;
> + vui64_t result;
> +
> + /* Note legitimate use of wrong-type splat due to expectation that only
> + lower 6-bits are read. */
> + lshift = (vui64_t) vec_splat_s8((const unsigned char)shb);
> +
> + /* Vector Shift Left Doublewords based on the lower 6-bits
> + of corresponding element of lshift. */
> + result = vec_vsld (vra, lshift);
> +
> + return (vui64_t) result;
> +}
I realise this is a testcase, and in one frame of mind it is good to test
all different styles and bad habits. But please never use casts that do not
do anything in correct programs: the only thing such casts do is they shut
up warnings in incorrect programs (including the same program after a wrong
change). </petpeeve>
Segher
next prev parent reply other threads:[~2019-02-11 16:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 13:36 Bill Schmidt
2019-02-11 16:02 ` Segher Boessenkool [this message]
2019-02-11 16:22 ` Bill Schmidt
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=20190211160115.GQ14180@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=wschmidt@linux.ibm.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).