backport: re PR target/81959 (PowerPC __float128 optimization fails with integer PRE_INC addresses)

[gcc]
2017-12-11  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Back port from trunk
	2017-12-01  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81959
	* config/rs6000/rs6000.c (rs6000_address_for_fpconvert): Check for
	whether we can allocate pseudos before trying to fix an address.
	* config/rs6000/rs6000.md (float_<mode>si2_hw): Make sure the
	memory address is indexed or indirect.
	(floatuns_<mode>si2_hw2): Likewise.

[gcct/testsuite]
2017-12-11  Michael Meissner  <meissner@linux.vnet.ibm.com>

	Back port from trunk
	2017-12-01  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/81959
	* gcc.target/powerpc/pr81959.c: New test.

From-SVN: r255545
This commit is contained in:
Michael Meissner 2017-12-11 18:54:55 +00:00 committed by Michael Meissner
parent e9c07226b8
commit 634940f168
5 changed files with 53 additions and 1 deletions

View File

@ -1,3 +1,15 @@
2017-12-11 Michael Meissner <meissner@linux.vnet.ibm.com>
Back port from trunk
2017-12-01 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/81959
* config/rs6000/rs6000.c (rs6000_address_for_fpconvert): Check for
whether we can allocate pseudos before trying to fix an address.
* config/rs6000/rs6000.md (float_<mode>si2_hw): Make sure the
memory address is indexed or indirect.
(floatuns_<mode>si2_hw2): Likewise.
2017-12-11 Sudakshina Das <sudi.das@arm.com>
Backported from trunk

View File

@ -40023,7 +40023,8 @@ rs6000_address_for_fpconvert (rtx x)
gcc_assert (MEM_P (x));
addr = XEXP (x, 0);
if (! legitimate_indirect_address_p (addr, strict_p)
if (can_create_pseudo_p ()
&& ! legitimate_indirect_address_p (addr, strict_p)
&& ! legitimate_indexed_address_p (addr, strict_p))
{
if (GET_CODE (addr) == PRE_INC || GET_CODE (addr) == PRE_DEC)

View File

@ -14642,6 +14642,9 @@
{
if (GET_CODE (operands[2]) == SCRATCH)
operands[2] = gen_reg_rtx (DImode);
if (MEM_P (operands[1]))
operands[1] = rs6000_address_for_fpconvert (operands[1]);
})
(define_insn_and_split "float<QHI:mode><IEEE128:mode>2"
@ -14705,6 +14708,9 @@
{
if (GET_CODE (operands[2]) == SCRATCH)
operands[2] = gen_reg_rtx (DImode);
if (MEM_P (operands[1]))
operands[1] = rs6000_address_for_fpconvert (operands[1]);
})
(define_insn_and_split "floatuns<QHI:mode><IEEE128:mode>2"

View File

@ -1,3 +1,11 @@
2017-12-11 Michael Meissner <meissner@linux.vnet.ibm.com>
Back port from trunk
2017-12-01 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/81959
* gcc.target/powerpc/pr81959.c: New test.
2017-12-11 Sudakshina Das <sudi.das@arm.com>
Backported from trunk

View File

@ -0,0 +1,25 @@
/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mpower9-vector -O2 -mfloat128" } */
/* PR 81959, the compiler raised on unrecognizable insn message in converting
int to __float128, where the int had a PRE_INC in the address. */
#ifndef ARRAY_SIZE
#define ARRAY_SIZE 1024
#endif
void
convert_int_to_float128 (__float128 * __restrict__ p,
int * __restrict__ q)
{
unsigned long i;
for (i = 0; i < ARRAY_SIZE; i++)
p[i] = (__float128)q[i];
}
/* { dg-final { scan-assembler {\mlfiwax\M|\mlxsiwax\M} } } */
/* { dg-final { scan-assembler {\mxscvsdqp\M} } } */
/* { dg-final { scan-assembler-not {\mmtvsrd\M} } } */
/* { dg-final { scan-assembler-not {\mmtvsrw[sz]\M} } } */