From: Matthew Wahab Date: Fri, 23 Sep 2016 08:52:55 +0000 (+0000) Subject: [PATCH 2/17][Testsuite] Add a selector for ARM FP16 alternative format support. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a5b42ee71336cfe55e42c50e2379be21c347b97a;p=gcc.git [PATCH 2/17][Testsuite] Add a selector for ARM FP16 alternative format support. 2016-09-23 Matthew Wahab * doc/sourcebuild.texi (ARM-specific attributes): Add entries for arm_fp16_alternative_ok and arm_fp16_none_ok. testsuite/ 2016-09-23 Matthew Wahab * g++.dg/ext/arm-fp16/arm-fp16-ops-3.C: Use arm_fp16_alternative_ok. * g++.dg/ext/arm-fp16/arm-fp16-ops-4.C: Likewise. * gcc.dg/torture/arm-fp16-int-convert-alt.c: Likewise. * gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c: Likewise. * gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c: Likewise. * gcc.target/arm/fp16-compile-alt-1.c: Likewise. * gcc.target/arm/fp16-compile-alt-10.c: Likewise. * gcc.target/arm/fp16-compile-alt-11.c: Likewise. * gcc.target/arm/fp16-compile-alt-12.c: Likewise. * gcc.target/arm/fp16-compile-alt-2.c: Likewise. * gcc.target/arm/fp16-compile-alt-3.c: Likewise. * gcc.target/arm/fp16-compile-alt-4.c: Likewise. * gcc.target/arm/fp16-compile-alt-5.c: Likewise. * gcc.target/arm/fp16-compile-alt-6.c: Likewise. * gcc.target/arm/fp16-compile-alt-7.c: Likewise. * gcc.target/arm/fp16-compile-alt-8.c: Likewise. * gcc.target/arm/fp16-compile-alt-9.c: Likewise. * gcc.target/arm/fp16-compile-none-1.c: Use arm_fp16_none_ok. * gcc.target/arm/fp16-compile-none-2.c: Likewise. * gcc.target/arm/fp16-rounding-alt-1.c: Use arm_fp16_alternative_ok. * lib/target-supports.exp (check_effective_target_arm_fp16_alternative_ok_nocache): New. (check_effective_target_arm_fp16_alternative_ok): New. (check_effective_target_arm_fp16_none_ok_nocache): New. (check_effective_target_arm_fp16_none_ok): New. From-SVN: r240400 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 79aa31b089f..ff9a1e210f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-09-23 Matthew Wahab + + * doc/sourcebuild.texi (ARM-specific attributes): Add entries for + arm_fp16_alternative_ok and arm_fp16_none_ok. + 2016-09-23 Martin Liska * ipa-icf.c (sem_variable::merge): Replace adress diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index d18c3b4c27b..fac03499bb5 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1598,6 +1598,13 @@ options, including @code{-mfp16-format=ieee} if necessary to obtain the Test system supports executing Neon half-precision float instructions. (Implies previous.) +@item arm_fp16_alternative_ok +ARM target supports the ARM FP16 alternative format. Some multilibs +may be incompatible with the options needed. + +@item arm_fp16_none_ok +ARM target supports specifying none as the ARM FP16 format. + @item arm_thumb1_ok ARM target generates Thumb-1 code for @code{-mthumb}. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 998df2c65c7..b0aeb5e5065 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,33 @@ +2016-09-23 Matthew Wahab + + * g++.dg/ext/arm-fp16/arm-fp16-ops-3.C: Use + arm_fp16_alternative_ok. + * g++.dg/ext/arm-fp16/arm-fp16-ops-4.C: Likewise. + * gcc.dg/torture/arm-fp16-int-convert-alt.c: Likewise. + * gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c: Likewise. + * gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c: Likewise. + * gcc.target/arm/fp16-compile-alt-1.c: Likewise. + * gcc.target/arm/fp16-compile-alt-10.c: Likewise. + * gcc.target/arm/fp16-compile-alt-11.c: Likewise. + * gcc.target/arm/fp16-compile-alt-12.c: Likewise. + * gcc.target/arm/fp16-compile-alt-2.c: Likewise. + * gcc.target/arm/fp16-compile-alt-3.c: Likewise. + * gcc.target/arm/fp16-compile-alt-4.c: Likewise. + * gcc.target/arm/fp16-compile-alt-5.c: Likewise. + * gcc.target/arm/fp16-compile-alt-6.c: Likewise. + * gcc.target/arm/fp16-compile-alt-7.c: Likewise. + * gcc.target/arm/fp16-compile-alt-8.c: Likewise. + * gcc.target/arm/fp16-compile-alt-9.c: Likewise. + * gcc.target/arm/fp16-compile-none-1.c: Use arm_fp16_none_ok. + * gcc.target/arm/fp16-compile-none-2.c: Likewise. + * gcc.target/arm/fp16-rounding-alt-1.c: Use + arm_fp16_alternative_ok. + * lib/target-supports.exp + (check_effective_target_arm_fp16_alternative_ok_nocache): New. + (check_effective_target_arm_fp16_alternative_ok): New. + (check_effective_target_arm_fp16_none_ok_nocache): New. + (check_effective_target_arm_fp16_none_ok): New. + 2016-09-23 Martin Liska * gcc.dg/ipa/pr77653.c: Replace adress diff --git a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-3.C b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-3.C index 8f9ab64bc45..29080c7514f 100644 --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-3.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-3.C @@ -1,5 +1,6 @@ /* Test various operators on __fp16 and mixed __fp16/float operands. */ /* { dg-do run { target arm*-*-* } } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ #include "arm-fp16-ops.h" diff --git a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-4.C b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-4.C index 4877f392c06..4be8883faad 100644 --- a/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-4.C +++ b/gcc/testsuite/g++.dg/ext/arm-fp16/arm-fp16-ops-4.C @@ -1,5 +1,6 @@ /* Test various operators on __fp16 and mixed __fp16/float operands. */ /* { dg-do run { target arm*-*-* } } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative -ffast-math" } */ #include "arm-fp16-ops.h" diff --git a/gcc/testsuite/gcc.dg/torture/arm-fp16-int-convert-alt.c b/gcc/testsuite/gcc.dg/torture/arm-fp16-int-convert-alt.c index ba1f9905e21..f013b59ddde 100644 --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-int-convert-alt.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-int-convert-alt.c @@ -1,5 +1,6 @@ /* Test floating-point conversions. Standard types and __fp16. */ /* { dg-do run { target arm*-*-* } } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } /* { dg-options "-mfp16-format=alternative" } */ #include "fp-int-convert.h" diff --git a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c index 8f9ab64bc45..7716baf818e 100644 --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-3.c @@ -1,5 +1,6 @@ /* Test various operators on __fp16 and mixed __fp16/float operands. */ /* { dg-do run { target arm*-*-* } } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } /* { dg-options "-mfp16-format=alternative" } */ #include "arm-fp16-ops.h" diff --git a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c index 4877f392c06..1940f4320d0 100644 --- a/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c +++ b/gcc/testsuite/gcc.dg/torture/arm-fp16-ops-4.c @@ -1,5 +1,6 @@ /* Test various operators on __fp16 and mixed __fp16/float operands. */ /* { dg-do run { target arm*-*-* } } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } /* { dg-options "-mfp16-format=alternative -ffast-math" } */ #include "arm-fp16-ops.h" diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-1.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-1.c index 3abcd947a6f..0845e886a83 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-1.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-1.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ __fp16 xx = 0.0; diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-10.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-10.c index 2e3d31fdf07..a8772a19ae0 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-10.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-10.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative -pedantic -std=gnu99" } */ #include diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-11.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-11.c index 62a7a3df5ff..1cb3d2c4963 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-11.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-11.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative -pedantic -std=gnu99" } */ #include diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-12.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-12.c index 09586e9b8fc..3c3bd2f02f6 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-12.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-12.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ float xx __attribute__((mode(HF))) = 0.0; diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-2.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-2.c index b7fe99d5370..8a45f1f4ae1 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-2.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-3.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-3.c index f325a84fe77..e786a51da69 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-3.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-3.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-4.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-4.c index 4b9b3311732..cfeb61aaea7 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-4.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-4.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-5.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-5.c index 458f5073b3f..3b741ae62dc 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-5.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-5.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-6.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-6.c index dbb4a999924..abffff5fa60 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-6.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-6.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ /* This number is the maximum value representable in the alternative diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-7.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-7.c index 40940a63421..c339f197cd7 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-7.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-7.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative -pedantic" } */ /* This number overflows the range of the alternative encoding. Since this diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-8.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-8.c index cbc0a3947e2..deeb5cd5574 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-8.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-8.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-9.c b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-9.c index 6487c8d67dd..f9f565453e7 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-alt-9.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-alt-9.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ /* Encoding taken from: http://en.wikipedia.org/wiki/Half_precision */ diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-none-1.c b/gcc/testsuite/gcc.target/arm/fp16-compile-none-1.c index e91250581a0..9472249e2e2 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-none-1.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-none-1.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_none_ok } */ /* { dg-options "-mfp16-format=none" } */ /* __fp16 type name is not recognized unless you explicitly enable it diff --git a/gcc/testsuite/gcc.target/arm/fp16-compile-none-2.c b/gcc/testsuite/gcc.target/arm/fp16-compile-none-2.c index eb7eef5eaf2..9ec21e5c1cc 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-compile-none-2.c +++ b/gcc/testsuite/gcc.target/arm/fp16-compile-none-2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_fp16_none_ok } */ /* { dg-options "-mfp16-format=none" } */ /* mode(HF) attributes are not recognized unless you explicitly enable diff --git a/gcc/testsuite/gcc.target/arm/fp16-rounding-alt-1.c b/gcc/testsuite/gcc.target/arm/fp16-rounding-alt-1.c index f50b4475f19..1c15b613239 100644 --- a/gcc/testsuite/gcc.target/arm/fp16-rounding-alt-1.c +++ b/gcc/testsuite/gcc.target/arm/fp16-rounding-alt-1.c @@ -3,6 +3,7 @@ from double to __fp16. */ /* { dg-do run } */ +/* { dg-require-effective-target arm_fp16_alternative_ok } */ /* { dg-options "-mfp16-format=alternative" } */ #include diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 6724a7fd214..dfee6cf4e0b 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3356,6 +3356,65 @@ proc add_options_for_arm_neon_fp16 { flags } { return "$flags $et_arm_neon_fp16_flags" } +# Return 1 if this is an ARM target supporting the FP16 alternative +# format. Some multilibs may be incompatible with the options needed. Also +# set et_arm_neon_fp16_flags to the best options to add. + +proc check_effective_target_arm_fp16_alternative_ok_nocache { } { + global et_arm_neon_fp16_flags + set et_arm_neon_fp16_flags "" + if { [check_effective_target_arm32] } { + foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16" + "-mfpu=neon-fp16 -mfloat-abi=softfp"} { + if { [check_no_compiler_messages_nocache \ + arm_fp16_alternative_ok object { + #if !defined (__ARM_FP16_FORMAT_ALTERNATIVE) + #error __ARM_FP16_FORMAT_ALTERNATIVE not defined + #endif + } "$flags -mfp16-format=alternative"] } { + set et_arm_neon_fp16_flags "$flags -mfp16-format=alternative" + return 1 + } + } + } + + return 0 +} + +proc check_effective_target_arm_fp16_alternative_ok { } { + return [check_cached_effective_target arm_fp16_alternative_ok \ + check_effective_target_arm_fp16_alternative_ok_nocache] +} + +# Return 1 if this is an ARM target supports specifying the FP16 none +# format. Some multilibs may be incompatible with the options needed. + +proc check_effective_target_arm_fp16_none_ok_nocache { } { + if { [check_effective_target_arm32] } { + foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16" + "-mfpu=neon-fp16 -mfloat-abi=softfp"} { + if { [check_no_compiler_messages_nocache \ + arm_fp16_none_ok object { + #if defined (__ARM_FP16_FORMAT_ALTERNATIVE) + #error __ARM_FP16_FORMAT_ALTERNATIVE defined + #endif + #if defined (__ARM_FP16_FORMAT_IEEE) + #error __ARM_FP16_FORMAT_IEEE defined + #endif + } "$flags -mfp16-format=none"] } { + return 1 + } + } + } + + return 0 +} + +proc check_effective_target_arm_fp16_none_ok { } { + return [check_cached_effective_target arm_fp16_none_ok \ + check_effective_target_arm_fp16_none_ok_nocache] +} + # Return 1 if this is an ARM target supporting -mfpu=neon-fp-armv8 # -mfloat-abi=softfp or equivalent options. Some multilibs may be # incompatible with these options. Also set et_arm_v8_neon_flags to the