[PATCH] rs6000: Support more short/char to float conversion

Segher Boessenkool segher@kernel.crashing.org
Wed Jun 9 23:23:06 GMT 2021


Hi!

On Fri, May 07, 2021 at 10:30:38AM +0800, Kewen.Lin wrote:
> For some cases that when we load unsigned char/short values from
> the appropriate unsigned char/short memories and convert them to
> double/single precision floating point value, there would be
> implicit conversions to int first.  It makes GCC not leverage the
> P9 instructions lxsibzx/lxsihzx.  This patch is to add the related
> define_insn_and_split to support this kind of scenario.

> +/* { dg-final { scan-assembler     "lxsibzx"  } } */
> +/* { dg-final { scan-assembler     "lxsihzx"  } } */
> +/* { dg-final { scan-assembler     "vextsb2d" } } */
> +/* { dg-final { scan-assembler     "vextsh2d" } } */

On my unpatched compiler all these already work, but you say they don't?

For the first two I get
        lxsibzx 33,0,3
        vextsb2d 0,1
        xscvsxddp 0,32
        fadd 1,0,1
        blr
and
        lbz 9,0(3)
        mtvsrwa 0,9
        fcfid 0,0
        fadd 1,0,1
        blr
is that different for you?

In either case, use \m and \M please.

> +/* { dg-final { scan-assembler-not "mfvsrd"   } } */
> +/* { dg-final { scan-assembler-not "mfvsrwz"  } } */
> +/* { dg-final { scan-assembler-not "mtvsrd"   } } */
> +/* { dg-final { scan-assembler-not "mtvsrwa"  } } */
> +/* { dg-final { scan-assembler-not "mtvsrwz"  } } */

Here as well, or you could just do

/* { dg-final { scan-assembler-not "\mm[tf]vsr"  } } */

in this case, since no VSR<->GPR moves should happen at all.


Segher


More information about the Gcc-patches mailing list