Off list, Segher asked that I break the patch eliminating a shift right when transfering SFmode from a vector register to a GPR register down into smaller chunks. The power7 and power8 instructions that convert values in the double precision format to single precision actually duplicate the 32-bits in the first word and second word (the ISA says the second word is undefined). We are in the process of issuing an update to ISA 3.0 to clarify that this will be the required behavior going forward.
I have broken the patches down to 8 chunks. Some of the patch are just cosmetic of things I noticed while doing the main patch. One patch eliminates the shift. Another fixes up the peephole2 that optimizes putting a SFmode into a union and then doing masking on the value. And the final patch updates the tests that need to be changed. I have verified that each of these sub-patches build, and after all 8 patches have been applied, I did the full bootstrap and regresion test, and like the previous combination patch there were no regressions. If only some of the patches are applied, then there will be 3 regressions until the remaining patches are applied. This is patch #8. Can I check this into the trunk? It fixes the two tests (pr71977-1.c and direct-move-float1.c) that need to be adjusted with the previous patches applies. It also adds a new test to test combining round from DFmode to SFmode and move it to a GPR. 2017-09-25 Michael Meissner <meiss...@linux.vnet.ibm.com> * gcc.target/powerpc/pr71977-1.c: Update test to know that we don't generate a 32-bit shift after doing XSCVDPSPN. * gcc.target/powerpc/direct-move-float1.c: Likewise. * gcc.target/powerpc/direct-move-float3.c: New test. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Index: gcc/testsuite/gcc.target/powerpc/pr71977-1.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/pr71977-1.c (revision 253176) +++ gcc/testsuite/gcc.target/powerpc/pr71977-1.c (working copy) @@ -23,9 +23,9 @@ mask_and_float_var (float f, uint32_t ma return u.value; } -/* { dg-final { scan-assembler "\[ \t\]xxland " } } */ -/* { dg-final { scan-assembler-not "\[ \t\]and " } } */ -/* { dg-final { scan-assembler-not "\[ \t\]mfvsrd " } } */ -/* { dg-final { scan-assembler-not "\[ \t\]stxv" } } */ -/* { dg-final { scan-assembler-not "\[ \t\]lxv" } } */ -/* { dg-final { scan-assembler-not "\[ \t\]srdi " } } */ +/* { dg-final { scan-assembler {\mxxland\M} } } */ +/* { dg-final { scan-assembler-not {\mand\M} } } */ +/* { dg-final { scan-assembler-not {\mmfvsrd\M} } } */ +/* { dg-final { scan-assembler-not {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxv\M} } } */ +/* { dg-final { scan-assembler-not {\msrdi\M} } } */ Index: gcc/testsuite/gcc.target/powerpc/direct-move-float1.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/direct-move-float1.c (revision 253159) +++ gcc/testsuite/gcc.target/powerpc/direct-move-float1.c (working copy) @@ -4,10 +4,10 @@ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ /* { dg-options "-mcpu=power8 -O2" } */ -/* { dg-final { scan-assembler "mtvsrd" } } */ -/* { dg-final { scan-assembler "mfvsrd" } } */ -/* { dg-final { scan-assembler "xscvdpspn" } } */ -/* { dg-final { scan-assembler "xscvspdpn" } } */ +/* { dg-final { scan-assembler {\mmtvsrd\M} } } */ +/* { dg-final { scan-assembler {\mmfvsrwz\M} } } */ +/* { dg-final { scan-assembler {\mxscvdpspn\M} } } */ +/* { dg-final { scan-assembler {\mxscvspdpn\M} } } */ /* Check code generation for direct move for float types. */ Index: gcc/testsuite/gcc.target/powerpc/direct-move-float3.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/direct-move-float3.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/direct-move-float3.c (revision 0) @@ -0,0 +1,30 @@ +/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-skip-if "" { powerpc*-*-*spe* } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-options "-mpower8-vector -O2" } */ + +/* Test that we generate XSCVDPSP instead of FRSP and XSCVDPSPN when we combine + a round from double to float and moving the float value to a GPR. */ + +union u { + float f; + unsigned int ui; + int si; +}; + +unsigned int +ui_d (double d) +{ + union u x; + x.f = d; + return x.ui; +} + +/* { dg-final { scan-assembler {\mmfvsrwz\M} } } */ +/* { dg-final { scan-assembler {\mxscvdpsp\M} } } */ +/* { dg-final { scan-assembler-not {\mmfvsrd\M} } } */ +/* { dg-final { scan-assembler-not {\mmtvsrwz\M} } } */ +/* { dg-final { scan-assembler-not {\mmtvsrd\M} } } */ +/* { dg-final { scan-assembler-not {\mxscvdpspn\M} } } */ +/* { dg-final { scan-assembler-not {\msrdi\M} } } */