Implement C _FloatN, _FloatNx types [version 6]

Matthew Wahab matthew.wahab@foss.arm.com
Mon Aug 22 10:48:00 GMT 2016


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



More information about the Fortran mailing list