re PR target/82703 (Wrong addition of std::array components with -O2 -ftree-loop-vectorize -ftree-slp-vectorize (works fine with -O2))

PR target/82703
	* config/i386/i386-protos.h (maybe_get_pool_constant): Removed.
	* config/i386/i386.c (maybe_get_pool_constant): Removed.
	(ix86_split_to_parts): Use avoid_constant_pool_reference instead of
	maybe_get_pool_constant.
	* config/i386/predicates.md (zero_extended_scalar_load_operand):
	Likewise.

	* gcc.dg/pr82703.c: New test.

From-SVN: r254146
This commit is contained in:
Jakub Jelinek 2017-10-27 14:25:34 +02:00
parent c14baec783
commit dba9a0fe80
6 changed files with 48 additions and 25 deletions

View File

@ -1,5 +1,15 @@
2017-10-27 Jakub Jelinek <jakub@redhat.com>
PR target/82703
* config/i386/i386-protos.h (maybe_get_pool_constant): Removed.
* config/i386/i386.c (maybe_get_pool_constant): Removed.
(ix86_split_to_parts): Use avoid_constant_pool_reference instead of
maybe_get_pool_constant.
* config/i386/predicates.md (zero_extended_scalar_load_operand):
Likewise.
2017-10-24 Qing Zhao <qing.zhao@oracle.com>
Wilco Dijkstra <wilco.dijkstra@arm.com>
Wilco Dijkstra <wilco.dijkstra@arm.com>
* builtins.c (expand_builtin_update_setjmp_buf): Add a
converstion to Pmode from the buf_addr.

View File

@ -282,8 +282,6 @@ extern bool i386_pe_type_dllexport_p (tree);
extern int i386_pe_reloc_rw_mask (void);
extern rtx maybe_get_pool_constant (rtx);
extern char internal_label_prefix[16];
extern int internal_label_prefix_len;

View File

@ -19830,20 +19830,6 @@ ix86_expand_clear (rtx dest)
emit_insn (tmp);
}
/* X is an unchanging MEM. If it is a constant pool reference, return
the constant pool rtx, else NULL. */
rtx
maybe_get_pool_constant (rtx x)
{
x = ix86_delegitimize_address (XEXP (x, 0));
if (GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x))
return get_pool_constant (x);
return NULL_RTX;
}
void
ix86_expand_move (machine_mode mode, rtx operands[])
{
@ -25371,11 +25357,7 @@ ix86_split_to_parts (rtx operand, rtx *parts, machine_mode mode)
/* Optimize constant pool reference to immediates. This is used by fp
moves, that force all constants to memory to allow combining. */
if (MEM_P (operand) && MEM_READONLY_P (operand))
{
rtx tmp = maybe_get_pool_constant (operand);
if (tmp)
operand = tmp;
}
operand = avoid_constant_pool_reference (operand);
if (MEM_P (operand) && !offsettable_memref_p (operand))
{

View File

@ -975,9 +975,9 @@
(match_code "mem")
{
unsigned n_elts;
op = maybe_get_pool_constant (op);
op = avoid_constant_pool_reference (op);
if (!(op && GET_CODE (op) == CONST_VECTOR))
if (GET_CODE (op) != CONST_VECTOR)
return false;
n_elts = CONST_VECTOR_NUNITS (op);

View File

@ -1,5 +1,10 @@
2017-10-27 Jakub Jelinek <jakub@redhat.com>
PR target/82703
* gcc.dg/pr82703.c: New test.
2017-10-24 Qing Zhao <qing.zhao@oracle.com>
Wilco Dijkstra <wilco.dijkstra@arm.com>
Wilco Dijkstra <wilco.dijkstra@arm.com>
PR middle-end/80295
* gcc.target/aarch64/pr80295.c: New test.

View File

@ -0,0 +1,28 @@
/* PR target/82703 */
/* { dg-do run } */
/* { dg-options "-O2 -fno-tree-sra -ftree-vectorize" } */
__attribute__((noinline, noclone)) void
compare (const double *p, const double *q)
{
for (int i = 0; i < 3; ++i)
if (p[i] != q[i])
__builtin_abort ();
}
double vr[3] = { 4, 4, 4 };
int
main ()
{
double v1[3] = { 1, 2, 3 };
double v2[3] = { 3, 2, 1 };
double v3[3];
__builtin_memcpy (v3, v1, sizeof (v1));
for (int i = 0; i < 3; ++i)
v3[i] += v2[i];
for (int i = 0; i < 3; ++i)
v1[i] += v2[i];
compare (v3, vr);
return 0;
}