diff mbox series

[testsuite] add "inf" target attribute

Message ID 67FF69F4-E8C1-483A-8055-C99E65EA2D40@comcast.net
State New
Headers show
Series [testsuite] add "inf" target attribute | expand

Commit Message

Paul Koning Nov. 1, 2018, 7:30 p.m. UTC
A number of test cases fail on pdp11 because they use the "inf" float value which does not exist on that target (nor on VAX).  Rainer Orth and Joseph Myers suggested adding a new effective-target keyword to check for this, and require it for tests that have that dependency.

The attached patch implements this.  Ok for trunk?

	paul

ChangeLog:

2018-11-01  Paul Koning  <ni1d@arrl.net>

	* doc/sourcebuild.texi (target attributes): Document new "inf"
	effective target keyword.

Comments

Joseph Myers Nov. 1, 2018, 8:52 p.m. UTC | #1
On Thu, 1 Nov 2018, Paul Koning wrote:

> +@item inf
> +Target supports floating point infinite (@code{inf}).
>  @end table

Do you mean supports infinity for type double?  (That's what the 
implementation does.)  Supporting it for double is not the same as 
supporting it for float (SPU supports it for double but not float, hence 
various such tests, which require infinities or NaNs (or other IEEE 
features SPU doesn't have) for float, being disabled for SPU).)
Paul Koning Nov. 1, 2018, 9:02 p.m. UTC | #2
> On Nov 1, 2018, at 4:52 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> 
> On Thu, 1 Nov 2018, Paul Koning wrote:
> 
>> +@item inf
>> +Target supports floating point infinite (@code{inf}).
>> @end table
> 
> Do you mean supports infinity for type double?  (That's what the 
> implementation does.)  Supporting it for double is not the same as 
> supporting it for float (SPU supports it for double but not float, hence 
> various such tests, which require infinities or NaNs (or other IEEE 
> features SPU doesn't have) for float, being disabled for SPU).)

Yes, I do mean for double.  I suppose I should say that.

I noticed SPU avoids using __builtin_inff by conditional compile.  I thought of adding an "inff" flag also.  The reason I didn't is that my target does not need that, so I would end up with a new feature that would only be applied on targets I do not know.

	paul
Jeff Law Nov. 4, 2018, 7:33 p.m. UTC | #3
On 11/1/18 1:30 PM, Paul Koning wrote:
> A number of test cases fail on pdp11 because they use the "inf" float value which does not exist on that target (nor on VAX).  Rainer Orth and Joseph Myers suggested adding a new effective-target keyword to check for this, and require it for tests that have that dependency.
> 
> The attached patch implements this.  Ok for trunk?
> 
> 	paul
> 
> ChangeLog:
> 
> 2018-11-01  Paul Koning  <ni1d@arrl.net>
> 
> 	* doc/sourcebuild.texi (target attributes): Document new "inf"
> 	effective target keyword.
OK with me.

jeff
Paul Koning Nov. 5, 2018, 7:38 p.m. UTC | #4
> On Nov 4, 2018, at 2:33 PM, Jeff Law <law@redhat.com> wrote:
> 
> On 11/1/18 1:30 PM, Paul Koning wrote:
>> A number of test cases fail on pdp11 because they use the "inf" float value which does not exist on that target (nor on VAX).  Rainer Orth and Joseph Myers suggested adding a new effective-target keyword to check for this, and require it for tests that have that dependency.
>> 
>> The attached patch implements this.  Ok for trunk?
>> 
>> 	paul
>> 
>> ChangeLog:
>> 
>> 2018-11-01  Paul Koning  <ni1d@arrl.net>
>> 
>> 	* doc/sourcebuild.texi (target attributes): Document new "inf"
>> 	effective target keyword.
> OK with me.
> 
> jeff

Thanks.  Committed, with the doc change clarified to address Joseph's comment.

	paul

Index: doc/sourcebuild.texi
===================================================================
--- doc/sourcebuild.texi	(revision 265814)
+++ doc/sourcebuild.texi	(revision 265815)
@@ -1393,8 +1393,11 @@ for any options added with @code{dg-add-options}.
 Target has runtime support for any options added with
 @code{dg-add-options} for any @code{_Float@var{n}} or
 @code{_Float@var{n}x} type.
+
+@item inf
+Target supports floating point infinite (@code{inf}) for type
+@code{double}.
 @end table
-
 @subsubsection Fortran-specific attributes
 
 @table @code
diff mbox series

Patch

Index: doc/sourcebuild.texi
===================================================================
--- doc/sourcebuild.texi	(revision 265728)
+++ doc/sourcebuild.texi	(working copy)
@@ -1393,8 +1393,10 @@  for any options added with @code{dg-add-options}.
 Target has runtime support for any options added with
 @code{dg-add-options} for any @code{_Float@var{n}} or
 @code{_Float@var{n}x} type.
+
+@item inf
+Target supports floating point infinite (@code{inf}).
 @end table
-
 @subsubsection Fortran-specific attributes
 
 @table @code


testsuite/ChangeLog:

2018-11-01  Paul Koning  <ni1d@arrl.net>

	* lib/target-supports.exp: Add check for "inf" effective target
	keyword.
	* gcc.dg/builtins-44.c: Skip if no infinite support.
	* gcc.dg/builtins-45.c: Ditto.
	* gcc.dg/torture/builtin-complex-1.c: Ditto.
	* gcc.dg/torture/builtin-cproj-1.c: Ditto.
	* gcc.dg/torture/builtin-frexp-1.c: Ditto.
	* gcc.dg/torture/builtin-ldexp-1.c: Ditto.
	* gcc.dg/torture/builtin-logb-1.c: Ditto.
	* gcc.dg/torture/builtin-math-2.c: Ditto.
	* gcc.dg/torture/builtin-math-5.c: Ditto.
	* gcc.dg/torture/builtin-math-7.c: Ditto.
	* gcc.dg/torture/builtin-modf-1.c: Ditto.
	* gcc.dg/torture/type-generic-1.c: Ditto.


Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 265728)
+++ lib/target-supports.exp	(working copy)
@@ -8933,3 +8933,10 @@  proc check_effective_target_cet { } {
 	}
     } "-O2" ]
 }
+
+# Return 1 if target supports floating point "infinite"
+proc check_effective_target_inf { } {
+    return [check_no_compiler_messages supports_inf assembly {
+        const double pinf = __builtin_inf ();
+    }]
+}
Index: gcc.dg/builtins-44.c
===================================================================
--- gcc.dg/builtins-44.c	(revision 265728)
+++ gcc.dg/builtins-44.c	(working copy)
@@ -1,4 +1,5 @@ 
 /* { dg-do compile } */
+/* { dg-require-effective-target inf } */
 /* { dg-options "-O1 -fno-trapping-math -fno-finite-math-only -fdump-tree-optimized" } */
   
 extern void f(int);
Index: gcc.dg/builtins-45.c
===================================================================
--- gcc.dg/builtins-45.c	(revision 265728)
+++ gcc.dg/builtins-45.c	(working copy)
@@ -1,4 +1,5 @@ 
 /* { dg-do compile } */
+/* { dg-require-effective-target inf } */
 /* { dg-options "-O1 -fno-trapping-math -fno-finite-math-only -fdump-tree-optimized" } */
   
 extern void f(int);
Index: gcc.dg/torture/builtin-complex-1.c
===================================================================
--- gcc.dg/torture/builtin-complex-1.c	(revision 265728)
+++ gcc.dg/torture/builtin-complex-1.c	(working copy)
@@ -1,6 +1,7 @@ 
 /* Test __builtin_complex semantics.  */
 /* { dg-do run } */
 /* { dg-options "-std=c11 -pedantic-errors" } */
+/* { dg-require-effective-target inf } */
 /* { dg-add-options ieee } */
 
 extern void exit (int);
Index: gcc.dg/torture/builtin-cproj-1.c
===================================================================
--- gcc.dg/torture/builtin-cproj-1.c	(revision 265728)
+++ gcc.dg/torture/builtin-cproj-1.c	(working copy)
@@ -7,6 +7,7 @@ 
 
 /* { dg-do link } */
 /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
+/* { dg-require-effective-target inf } */
 /* { dg-add-options ieee } */
 
 /* All references to link_error should go away at compile-time.  The
Index: gcc.dg/torture/builtin-frexp-1.c
===================================================================
--- gcc.dg/torture/builtin-frexp-1.c	(revision 265728)
+++ gcc.dg/torture/builtin-frexp-1.c	(working copy)
@@ -9,6 +9,7 @@ 
 /* { dg-options "-fno-finite-math-only" { target sh*-*-* } } */
 /* In order to fold algebraic exprs below, targets with "composite"
    floating point formats need -funsafe-math-optimizations.  */
+/* { dg-require-effective-target inf } */
 /* { dg-options "-funsafe-math-optimizations" { target powerpc*-*-* } } */
 
 extern void link_error(int);
Index: gcc.dg/torture/builtin-ldexp-1.c
===================================================================
--- gcc.dg/torture/builtin-ldexp-1.c	(revision 265728)
+++ gcc.dg/torture/builtin-ldexp-1.c	(working copy)
@@ -7,6 +7,7 @@ 
 
 /* { dg-do link } */
 /* { dg-options "-fno-finite-math-only" { target sh*-*-* } } */
+/* { dg-require-effective-target inf } */
 /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 
 extern void link_error(int);
Index: gcc.dg/torture/builtin-logb-1.c
===================================================================
--- gcc.dg/torture/builtin-logb-1.c	(revision 265728)
+++ gcc.dg/torture/builtin-logb-1.c	(working copy)
@@ -9,6 +9,7 @@ 
 /* { dg-options "-fno-finite-math-only" { target sh*-*-* } } */
 /* In order to fold algebraic exprs below, targets with "composite"
    floating point formats need -funsafe-math-optimizations.  */
+/* { dg-require-effective-target inf } */
 /* { dg-options "-funsafe-math-optimizations" { target powerpc*-*-* } } */
 
 extern void link_error(int);
Index: gcc.dg/torture/builtin-math-2.c
===================================================================
--- gcc.dg/torture/builtin-math-2.c	(revision 265728)
+++ gcc.dg/torture/builtin-math-2.c	(working copy)
@@ -6,6 +6,7 @@ 
    Origin: Kaveh R. Ghazi,  October 22, 2006.  */
 
 /* { dg-do compile } */
+/* { dg-require-effective-target inf } */
 /* { dg-options "-fdump-tree-original" } */
 
 extern void foof (float);
Index: gcc.dg/torture/builtin-math-5.c
===================================================================
--- gcc.dg/torture/builtin-math-5.c	(revision 265728)
+++ gcc.dg/torture/builtin-math-5.c	(working copy)
@@ -6,6 +6,7 @@ 
    Origin: Kaveh R. Ghazi,  January 28, 2009.  */
 
 /* { dg-do compile } */
+/* { dg-require-effective-target inf } */
 /* { dg-options "-fdump-tree-original" } */
 
 extern void foof (_Complex float);
Index: gcc.dg/torture/builtin-math-7.c
===================================================================
--- gcc.dg/torture/builtin-math-7.c	(revision 265728)
+++ gcc.dg/torture/builtin-math-7.c	(working copy)
@@ -7,6 +7,7 @@ 
 /* { dg-do run } */
 /* C6X fails due to -freciprocal-math default.  */
 /* { dg-skip-if "" { tic6x-*-* } } */
+/* { dg-require-effective-target inf } */
 /* { dg-add-options ieee } */
 /* { dg-require-effective-target large_double } */
 
Index: gcc.dg/torture/builtin-modf-1.c
===================================================================
--- gcc.dg/torture/builtin-modf-1.c	(revision 265728)
+++ gcc.dg/torture/builtin-modf-1.c	(working copy)
@@ -6,6 +6,7 @@ 
    Origin: Kaveh R. Ghazi,  February 23, 2007.  */
 
 /* { dg-do link } */
+/* { dg-require-effective-target inf } */
 /* { dg-options "-fno-finite-math-only" { target sh*-*-* } } */
 /* { dg-options "-funsafe-math-optimizations -fsigned-zeros -fno-associative-math" { target powerpc-*-darwin* powerpc*-*-linux* } } */
 
Index: gcc.dg/torture/type-generic-1.c
===================================================================
--- gcc.dg/torture/type-generic-1.c	(revision 265728)
+++ gcc.dg/torture/type-generic-1.c	(working copy)
@@ -2,6 +2,7 @@ 
    without any fast-math flags.  */
 
 /* { dg-do run } */
+/* { dg-require-effective-target inf } */
 /* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
 /* { dg-skip-if "No subnormal support" { csky-*-* } { "-mhard-float" } } */
 /* { dg-options "-DUNSAFE" { target tic6x*-*-* visium-*-* nvptx-*-* } } */