Hi Bill,
On Mon, Feb 11, 2019 at 07:36:11AM -0600, Bill Schmidt wrote:
> 2019-02-11 Bill Schmidt <[email protected]>
>
> * 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 <[email protected]>
>
> * 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