This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Implement C _FloatN, _FloatNx types [version 6]
- From: Matthew Wahab <matthew dot wahab at foss dot arm dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Mon, 22 Aug 2016 11:47:50 +0100
- Subject: Re: Implement C _FloatN, _FloatNx types [version 6]
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.20.1606211202040.4526@digraph.polyomino.org.uk> <alpine.DEB.2.20.1606211738200.31330@digraph.polyomino.org.uk> <alpine.DEB.2.20.1606231418120.21240@digraph.polyomino.org.uk> <alpine.DEB.2.20.1606271720270.7438@digraph.polyomino.org.uk> <alpine.DEB.2.20.1607191347340.9265@digraph.polyomino.org.uk> <alpine.DEB.2.20.1607222158330.22448@digraph.polyomino.org.uk> <20160817154244.GA39270@arm.com> <alpine.DEB.2.20.1608171641000.7156@digraph.polyomino.org.uk> <alpine.DEB.2.20.1608172015080.27199@digraph.polyomino.org.uk>
Hello,
On 17/08/16 21:17, Joseph Myers wrote:
[Version 6 changes the testsuite to use dg-add-options systematically
to add any options that may be needed for the types to be supported;
this should allow the _Float128 and _Float64x tests to run for
powerpc64le, but I have not tested that; it could do with powerpc
maintainer testing that the tests do indeed run. It also has fixes
for the fp-int-convert issues pointed out in
<https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01279.html>. There are
no changes to the patch outside the testsuite and associated
documentation of effective-target and dg-add-options keywords.]
ISO/IEC TS 18661-3:2015 defines C bindings to IEEE interchange and
extended types, in the form of _FloatN and _FloatNx type names with
corresponding fN/FN and fNx/FNx constant suffixes and FLTN_* / FLTNX_*
<float.h> macros. This patch implements support for this feature in
GCC.
There are some test failure on arm that appear to be due to this patch.
Index: gcc/testsuite/gcc.dg/torture/fp-int-convert-float32x-timode.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/fp-int-convert-float32x-timode.c (nonexistent)
+++ gcc/testsuite/gcc.dg/torture/fp-int-convert-float32x-timode.c (working copy)
@@ -0,0 +1,16 @@
+/* Test floating-point conversions. _Float32x type with TImode. */
+/* { dg-do run } */
+/* { dg-options "" } */
+/* { dg-add-options float32x } */
+/* { dg-require-effective-target float32x_runtime } */
+
+#define __STDC_WANT_IEC_60559_TYPES_EXT__
+#include <float.h>
+#include "fp-int-convert.h"
+
+int
+main (void)
+{
+ TEST_I_F(TItype, UTItype, _Float32, FLT32X_MANT_DIG, FLT32X_MAX_EXP);
+ exit (0);
+
This test fails with an abort at runtime. The other float32x tests pass.
Index: gcc/testsuite/gcc.dg/torture/fp-int-convert.h
===================================================================
--- gcc/testsuite/gcc.dg/torture/fp-int-convert.h (revision 239543)
+++ gcc/testsuite/gcc.dg/torture/fp-int-convert.h (working copy)
@@ -15,20 +15,21 @@ typedef long TItype;
typedef unsigned long UTItype;
#endif
-/* TEST_I_F(I, U, F, P) tests conversions between the pair of signed
- and unsigned integer types I and U and the floating-point type F,
- where P is the binary precision of the floating point type. We
- test conversions of the values 0, 1, 0x7...f, 0x8...0, 0xf...f. We
- also test conversions of values half way between two
- representable values (rounding both ways), just above half way, and
- just below half way. */
-#define TEST_I_F(I, U, F, P) \
+/* TEST_I_F(I, U, F, P, M) tests conversions between the pair of
+ signed and unsigned integer types I and U and the floating-point
+ type F, where P is the binary precision of the floating point type
+ and M is the MAX_EXP value for that type (so 2^M overflows, 2^(M-1)
+ does not). We test conversions of the values 0, 1, 0x7...f,
+ 0x8...0, 0xf...f. We also test conversions of values half way
+ between two representable values (rounding both ways), just above
+ half way, and just below half way. */
+#define TEST_I_F(I, U, F, P, M) \
This change makes gcc.dg/torture/arm-fp16-int-convert-{alt,ieee].c fail because
they still pass four arguments to the macro, not five.
Matthew