From: Uros Bizjak <ubizjak@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Vladimir Yakovlev <vbyakovl23@gmail.com>,
"Kumar, Venkataramanan" <Venkataramanan.Kumar@amd.com>
Subject: [PATCH, dataflow]: Fix PR55845, 454.calculix miscompares on x86 AVX due to movement of vzeroupper
Date: Sun, 06 Jan 2013 15:48:00 -0000 [thread overview]
Message-ID: <CAFULd4asYbD30GODKEYOUyoCH3mKRtm+zbXEW0+nK8O=6wZ7hw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 815 bytes --]
Hello!
Attached patch fixes runtime comparison failure of 454.calculix due to
wrong movement of vzeroupper in jump2 pass. It turns out, that
can_move_insns_accross function does not special-case
unspec_volatiles, so vzeroupper is allowed to pass various 256bit avx
instructions.
The patch rejects moves of unspec_volatile insns in can_move_insn_accross.
2012-01-06 Uros Bizjak <ubizjak@gmail.com>
PR rtl-optimization/55845
* df-problems.c (can_move_insns_across): Stop scanning at
unspec_volatile source instruction.
2012-01-06 Uros Bizjak <ubizjak@gmail.com>
Vladimir Yakovlev <vladimir.b.yakovlev@intel.com>
PR rtl-optimization/55845
* gcc.target/i386/pr55845.c: New test.
Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32} AVX target.
OK for mainline and 4.7 branch?
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1393 bytes --]
Index: df-problems.c
===================================================================
--- df-problems.c (revision 194945)
+++ df-problems.c (working copy)
@@ -3916,6 +3916,10 @@ can_move_insns_across (rtx from, rtx to, rtx acros
break;
if (NONDEBUG_INSN_P (insn))
{
+ /* Do not move unspec_volatile insns. */
+ if (GET_CODE (PATTERN (insn)) == UNSPEC_VOLATILE)
+ break;
+
if (may_trap_or_fault_p (PATTERN (insn))
&& (trapping_insns_in_across || other_branch_live != NULL))
break;
Index: testsuite/gcc.target/i386/pr55845.c
===================================================================
--- testsuite/gcc.target/i386/pr55845.c (revision 0)
+++ testsuite/gcc.target/i386/pr55845.c (working copy)
@@ -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 ();
+}
next reply other threads:[~2013-01-06 15:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-06 15:48 Uros Bizjak [this message]
2013-01-06 16:23 ` Jakub Jelinek
2013-01-06 16:44 ` Eric Botcazou
2013-01-07 16:52 ` Uros Bizjak
2013-01-07 23:26 ` Jakub Jelinek
2013-01-08 7:10 ` Uros Bizjak
2013-01-08 17:55 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFULd4asYbD30GODKEYOUyoCH3mKRtm+zbXEW0+nK8O=6wZ7hw@mail.gmail.com' \
--to=ubizjak@gmail.com \
--cc=Venkataramanan.Kumar@amd.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=vbyakovl23@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).