From bbfdbc02709342c0048d73be7c5d8110c576cb2b Mon Sep 17 00:00:00 2001 From: jakub Date: Tue, 8 Jan 2013 18:00:10 +0000 Subject: [PATCH] PR rtl-optimization/55845 * df-problems.c (can_move_insns_across): Stop scanning at volatile_insn_p source instruction or give up if across_from .. across_to range contains any volatile_insn_p instructions. * gcc.target/i386/pr55845.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195028 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 ++++++++ gcc/df-problems.c | 8 +++++-- gcc/testsuite/ChangeLog | 6 +++++ gcc/testsuite/gcc.target/i386/pr55845.c | 39 +++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr55845.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 757ee869a4e..83e02978ecb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2012-01-08 Jakub Jelinek + Uros Bizjak + + PR rtl-optimization/55845 + * df-problems.c (can_move_insns_across): Stop scanning at + volatile_insn_p source instruction or give up if + across_from .. across_to range contains any volatile_insn_p + instructions. + 2013-01-08 Tejas Belagod * config/aarch64/aarch64-simd.md (vec_init): New. diff --git a/gcc/df-problems.c b/gcc/df-problems.c index 89a6189325f..0af593d6c97 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -1,6 +1,6 @@ /* Standard problems for dataflow support routines. Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. Originally contributed by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com) Major rewrite contributed by Danny Berlin (dberlin@dberlin.org) @@ -3858,6 +3858,8 @@ can_move_insns_across (rtx from, rtx to, rtx across_from, rtx across_to, } if (NONDEBUG_INSN_P (insn)) { + if (volatile_insn_p (PATTERN (insn))) + return false; memrefs_in_across |= for_each_rtx (&PATTERN (insn), find_memory, NULL); note_stores (PATTERN (insn), find_memory_stores, @@ -3917,7 +3919,9 @@ can_move_insns_across (rtx from, rtx to, rtx across_from, rtx across_to, if (NONDEBUG_INSN_P (insn)) { if (may_trap_or_fault_p (PATTERN (insn)) - && (trapping_insns_in_across || other_branch_live != NULL)) + && (trapping_insns_in_across + || other_branch_live != NULL + || volatile_insn_p (PATTERN (insn)))) break; /* We cannot move memory stores past each other, or move memory diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eab4c351b29..d509109c1eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-01-08 Uros Bizjak + Vladimir Yakovlev + + PR rtl-optimization/55845 + * gcc.target/i386/pr55845.c: New test. + 2013-01-08 Tejas Belagod * gcc.target/aarch64/vect-mull-compile.c: Explicitly scan for diff --git a/gcc/testsuite/gcc.target/i386/pr55845.c b/gcc/testsuite/gcc.target/i386/pr55845.c new file mode 100644 index 00000000000..59f7520efd6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr55845.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-require-effective-target avx } */ +/* { dg-options "-O3 -ffast-math -fschedule-insns -mavx -mvzeroupper" } */ + +#include "avx-check.h" + +#define N 100 + +double +__attribute__((noinline)) +foo (int size, double *y, double *x) +{ + double sum = 0.0; + int i; + for (i = 0, sum = 0.; i < size; i++) + sum += y[i] * x[i]; + return sum; +} + +static void +__attribute__ ((noinline)) +avx_test () +{ + double x[N]; + double y[N]; + double s; + int i; + + for (i = 0; i < N; i++) + { + x[i] = i; + y[i] = i; + } + + s = foo (N, y, x); + + if (s != 328350.0) + abort (); +} -- 2.11.4.GIT