diff mbox

Fix PR80281

Message ID alpine.LSU.2.20.1704061319250.30715@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener April 6, 2017, 11:24 a.m. UTC
On Wed, 5 Apr 2017, Christophe Lyon wrote:

> On 5 April 2017 at 13:41, Bin.Cheng <amker.cheng@gmail.com> wrote:
> > On Wed, Apr 5, 2017 at 12:38 PM, Markus Trippelsdorf
> > <markus@trippelsdorf.de> wrote:
> >> On 2017.04.03 at 15:20 +0200, Richard Biener wrote:
> >>> I'm re-testing the following variant.
> >>>
> >>> Richard.
> >>>
> >>> 2017-04-03  Richard Biener  <rguenther@suse.de>
> >>>
> >>>       PR middle-end/80281
> >>>       * match.pd (A + (-B) -> A - B): Make sure to preserve unsigned
> >>>       arithmetic done for the negate or the plus.  Simplify.
> >>>       (A - (-B) -> A + B): Likewise.
> >>>       * fold-const.c (split_tree): Make sure to not negate pointers.
> >>>
> >>>       * gcc.dg/torture/pr80281.c: New testcase.
> >>
> >> gcc.dg/tree-ssa/pr40921.c started to fail with -march=skylake:
> >>
> >>  % gcc -march=skylake -c -O2 -fdump-tree-optimized -ffast-math -c gcc.dg/tree-ssa/pr40921.c
> >>  % cat pr40921.i.227t.optimized | grep "\-y"
> >>    _3 = -y_4(D);
> > Also on AArch64.
> >
> 
> And on some arm configurations, if that's easier to reproduce:
> * -mthumb/-march=armv8-a/-mfpu=crypto-neon-fp-armv8/-mfloat-abi=hard
> * --with-cpu=cortex-a15 --with-fpu=neon-vfpv4
> * --with-cpu=cortex-a57 --with-fpu=crypto-neon-fp-armv8

These are all spurious -- when you allow FMAs to be detected there'll
be an unary minus but which SSA name is negated depends on SSA name
allocation.

It's somewhat hard to fortify the testcase against the FMA case so
the following simply turns off FMA detection.

Tested on x86_64-unknown-linux-gnu, applied.

Richard.

2017-04-06  Richard Biener  <rguenther@suse.de>

	PR middle-end/80281
	* gcc.dg/tree-ssa/pr40921.c: Add -fp-contract=off.
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/tree-ssa/pr40921.c
===================================================================
--- gcc/testsuite/gcc.dg/tree-ssa/pr40921.c	(revision 246725)
+++ gcc/testsuite/gcc.dg/tree-ssa/pr40921.c	(working copy)
@@ -1,26 +1,24 @@ 
-
 /* { dg-do compile } */
-/* { dg-options "-O2  -fdump-tree-optimized -ffast-math" } */
+/* { dg-options "-O2  -fdump-tree-optimized -ffast-math -ffp-contract=off" } */
 
 unsigned int foo (unsigned int x, unsigned int y, unsigned int z)
 {
-      return x + (-y * z * z);
+  return x + (-y * z * z);
 }
 
 float bar (float x, float y, float z)
 {
-      return x + (-y * z * z);
+  return x + (-y * z * z);
 }
 
 float bar2 (float x, float y, float z)
 {
-      return x + (-y * z * z * 5.0f);
+  return x + (-y * z * z * 5.0f);
 }
 
 float bar3 (float x, float y, float z)
 {
-      return x + (-y * x * -z);
+  return x + (-y * x * -z);
 }
 
-
 /* { dg-final { scan-tree-dump-times "_* = -y_" 0 "optimized" } } */