Fix vect_float markup for a couple of tests (PR 83888)

Message ID 87wp09ok1f.fsf@linaro.org
State New
Headers show
Series
  • Fix vect_float markup for a couple of tests (PR 83888)
Related show

Commit Message

Richard Sandiford Jan. 22, 2018, 5:55 p.m.
vect_float is true for arm*-*-* targets, but the support is only
available when -funsafe-math-optimizations is on.  This caused
failures in two tests that disable fast-math.

The easiest fix seemed to be to add a new target selector for
"vect_float without special options".

Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
OK to install?

Richard


2018-01-22  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	PR testsuite/83888
	* doc/sourcebuild.texi (vect_float): Say that the selector
	only describes the situation when -funsafe-math-optimizations is on.
	(vect_float_strict): Document.

gcc/testsuite/
	PR testsuite/83888
	* lib/target-supports.exp (check_effective_target_vect_float): Say
	that the result only holds when -funsafe-math-optimizations is on.
	(check_effective_target_vect_float_strict): New procedure.
	* gcc.dg/vect/no-fast-math-vect16.c: Use vect_float_strict instead
	of vect_float.
	* gcc.dg/vect/vect-reduc-6.c: Likewise.

Comments

Richard Biener Jan. 23, 2018, 10:25 a.m. | #1
On Mon, Jan 22, 2018 at 6:55 PM, Richard Sandiford
<richard.sandiford@linaro.org> wrote:
> vect_float is true for arm*-*-* targets, but the support is only

> available when -funsafe-math-optimizations is on.  This caused

> failures in two tests that disable fast-math.

>

> The easiest fix seemed to be to add a new target selector for

> "vect_float without special options".

>

> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.

> OK to install?


Ok - so arm float vectors are not IEEE compliant?

Richard.

> Richard

>

>

> 2018-01-22  Richard Sandiford  <richard.sandiford@linaro.org>

>

> gcc/

>         PR testsuite/83888

>         * doc/sourcebuild.texi (vect_float): Say that the selector

>         only describes the situation when -funsafe-math-optimizations is on.

>         (vect_float_strict): Document.

>

> gcc/testsuite/

>         PR testsuite/83888

>         * lib/target-supports.exp (check_effective_target_vect_float): Say

>         that the result only holds when -funsafe-math-optimizations is on.

>         (check_effective_target_vect_float_strict): New procedure.

>         * gcc.dg/vect/no-fast-math-vect16.c: Use vect_float_strict instead

>         of vect_float.

>         * gcc.dg/vect/vect-reduc-6.c: Likewise.

>

> Index: gcc/doc/sourcebuild.texi

> ===================================================================

> --- gcc/doc/sourcebuild.texi    2018-01-22 17:51:03.860579049 +0000

> +++ gcc/doc/sourcebuild.texi    2018-01-22 17:54:02.172848564 +0000

> @@ -1403,7 +1403,13 @@ The target's preferred vector alignment

>  alignment.

>

>  @item vect_float

> -Target supports hardware vectors of @code{float}.

> +Target supports hardware vectors of @code{float} when

> +@option{-funsafe-math-optimizations} is in effect.

> +

> +@item vect_float_strict

> +Target supports hardware vectors of @code{float} when

> +@option{-funsafe-math-optimizations} is not in effect.

> +This implies @code{vect_float}.

>

>  @item vect_int

>  Target supports hardware vectors of @code{int}.

> Index: gcc/testsuite/lib/target-supports.exp

> ===================================================================

> --- gcc/testsuite/lib/target-supports.exp       2018-01-22 17:51:03.817580787 +0000

> +++ gcc/testsuite/lib/target-supports.exp       2018-01-22 17:54:02.173848531 +0000

> @@ -5492,7 +5492,8 @@ proc check_effective_target_vect_long {

>      return $answer

>  }

>

> -# Return 1 if the target supports hardware vectors of float, 0 otherwise.

> +# Return 1 if the target supports hardware vectors of float when

> +# -funsafe-math-optimizations is enabled, 0 otherwise.

>  #

>  # This won't change for different subtargets so cache the result.

>

> @@ -5525,6 +5526,14 @@ proc check_effective_target_vect_float {

>      return $et_vect_float_saved($et_index)

>  }

>

> +# Return 1 if the target supports hardware vectors of float without

> +# -funsafe-math-optimizations being enabled, 0 otherwise.

> +

> +proc check_effective_target_vect_float_strict { } {

> +    return [expr { [check_effective_target_vect_float]

> +                  && ![istarget arm*-*-*] }]

> +}

> +

>  # Return 1 if the target supports hardware vectors of double, 0 otherwise.

>  #

>  # This won't change for different subtargets so cache the result.

> Index: gcc/testsuite/gcc.dg/vect/no-fast-math-vect16.c

> ===================================================================

> --- gcc/testsuite/gcc.dg/vect/no-fast-math-vect16.c     2018-01-13 18:01:15.293116922 +0000

> +++ gcc/testsuite/gcc.dg/vect/no-fast-math-vect16.c     2018-01-22 17:54:02.172848564 +0000

> @@ -1,4 +1,4 @@

> -/* { dg-require-effective-target vect_float } */

> +/* { dg-require-effective-target vect_float_strict } */

>

>  #include <stdarg.h>

>  #include "tree-vect.h"

> Index: gcc/testsuite/gcc.dg/vect/vect-reduc-6.c

> ===================================================================

> --- gcc/testsuite/gcc.dg/vect/vect-reduc-6.c    2018-01-13 18:01:15.294116882 +0000

> +++ gcc/testsuite/gcc.dg/vect/vect-reduc-6.c    2018-01-22 17:54:02.172848564 +0000

> @@ -1,4 +1,4 @@

> -/* { dg-require-effective-target vect_float } */

> +/* { dg-require-effective-target vect_float_strict } */

>  /* { dg-additional-options "-fno-fast-math" } */

>

>  #include <stdarg.h>
Richard Sandiford Jan. 23, 2018, 10:40 a.m. | #2
Richard Biener <richard.guenther@gmail.com> writes:
> On Mon, Jan 22, 2018 at 6:55 PM, Richard Sandiford

> <richard.sandiford@linaro.org> wrote:

>> vect_float is true for arm*-*-* targets, but the support is only

>> available when -funsafe-math-optimizations is on.  This caused

>> failures in two tests that disable fast-math.

>>

>> The easiest fix seemed to be to add a new target selector for

>> "vect_float without special options".

>>

>> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.

>> OK to install?

>

> Ok - so arm float vectors are not IEEE compliant?


Not for subnormals apparently:

; Note that NEON operations don't support the full IEEE 754 standard: in
; particular, denormal values are flushed to zero.  This means that GCC cannot
; use those instructions for autovectorization, etc. unless
; -funsafe-math-optimizations is in effect (in which case flush-to-zero
; behavior is permissible).

Thanks,
Richard

Patch

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	2018-01-22 17:51:03.860579049 +0000
+++ gcc/doc/sourcebuild.texi	2018-01-22 17:54:02.172848564 +0000
@@ -1403,7 +1403,13 @@  The target's preferred vector alignment
 alignment.
 
 @item vect_float
-Target supports hardware vectors of @code{float}.
+Target supports hardware vectors of @code{float} when
+@option{-funsafe-math-optimizations} is in effect.
+
+@item vect_float_strict
+Target supports hardware vectors of @code{float} when
+@option{-funsafe-math-optimizations} is not in effect.
+This implies @code{vect_float}.
 
 @item vect_int
 Target supports hardware vectors of @code{int}.
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2018-01-22 17:51:03.817580787 +0000
+++ gcc/testsuite/lib/target-supports.exp	2018-01-22 17:54:02.173848531 +0000
@@ -5492,7 +5492,8 @@  proc check_effective_target_vect_long {
     return $answer
 }
 
-# Return 1 if the target supports hardware vectors of float, 0 otherwise.
+# Return 1 if the target supports hardware vectors of float when
+# -funsafe-math-optimizations is enabled, 0 otherwise.
 #
 # This won't change for different subtargets so cache the result.
 
@@ -5525,6 +5526,14 @@  proc check_effective_target_vect_float {
     return $et_vect_float_saved($et_index)
 }
 
+# Return 1 if the target supports hardware vectors of float without
+# -funsafe-math-optimizations being enabled, 0 otherwise.
+
+proc check_effective_target_vect_float_strict { } {
+    return [expr { [check_effective_target_vect_float]
+		   && ![istarget arm*-*-*] }]
+}
+
 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
 #
 # This won't change for different subtargets so cache the result.
Index: gcc/testsuite/gcc.dg/vect/no-fast-math-vect16.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/no-fast-math-vect16.c	2018-01-13 18:01:15.293116922 +0000
+++ gcc/testsuite/gcc.dg/vect/no-fast-math-vect16.c	2018-01-22 17:54:02.172848564 +0000
@@ -1,4 +1,4 @@ 
-/* { dg-require-effective-target vect_float } */
+/* { dg-require-effective-target vect_float_strict } */
 
 #include <stdarg.h>
 #include "tree-vect.h"
Index: gcc/testsuite/gcc.dg/vect/vect-reduc-6.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-reduc-6.c	2018-01-13 18:01:15.294116882 +0000
+++ gcc/testsuite/gcc.dg/vect/vect-reduc-6.c	2018-01-22 17:54:02.172848564 +0000
@@ -1,4 +1,4 @@ 
-/* { dg-require-effective-target vect_float } */
+/* { dg-require-effective-target vect_float_strict } */
 /* { dg-additional-options "-fno-fast-math" } */
 
 #include <stdarg.h>