public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, ARM, testsuite] Add -mfloat-abi=hard to arm_neon_ok
@ 2017-06-02 14:19 Christophe Lyon
  2017-06-07  9:13 ` Christophe Lyon
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Lyon @ 2017-06-02 14:19 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2698 bytes --]

Hi,

I have recently updated the dejagnu version I use for
cross-testing arm and aarch64 toolchains to 1.6+. One of the side
effects was mentioned by Jonathan in
https://gcc.gnu.org/ml/gcc-patches/2017-05/msg01267.html. Since I
use multilibs to test many configurations, I noticed several
changes in the results I get.

In particular, on arm-none-linux-gnueabihf with -march=armv5t,
all the tests that require arm_neon_ok fail to compile because
they now use -march=armv5t -mfpu=neon -mfloat-abi=softfp
-march=armv7-a, which leads to a failure to include
gnu/stubs-soft.h (not present since the target is
'hf'). Previously, -march=armv5t was appended, making the tests
unsupported because -mfpu=neon conflicts with -march=armv5t. Now,
arm_neon_ok succeeds because it only checks if some preprocessor
defines are present.

This patch fixes that by including arm_neon.h in arm_neon_ok, such
that it fails for unsupported cases. However, since most of these
tests should pass instead of becoming unsupported, I have added flag
combinations with -mfloat-abi=hard.

However, this is not sufficient to make the
gcc.target/arm/lto/pr65837* tests pass: they do not require
arm_neon_ok, and when I tried to add it, they still failed
because these lto tests do not support dg-add-options. My
proposal is to add a new
check_effective_target_arm_neon_ok_no_float_abi function which
tries to use neon without trying to change the -mfloat-abi
setting (that is, the same as arm_neon_ok, with only ""
and "-mfpu=neon" in the list of flags) . This makes these two lto
tests unsupported for non-hf targets (again because
gnu/stubs-soft.h is not present).

To make them pass on "hf" targets:
- I added -mfpu=neon to dg-lto-options in pr65837-attr_0.c,
  because the fpu attributes in arm_neon.h only work if
  -mfpu=neon is enabled
- I removed dg-suppress-ld-options {-mfpu=neon} from pr65837_0.c,
  -mfpu=neon is needed for the test to compile with toolchains
  where the default fpu is not neon (eg vfpv3-d16-fp16)

On arm-none-linux-gnueabihf --with-cpu=cortex-a9 --with-fpu=vfp
and multilib test flag=-march=armv5t, this patch brings:
- 2 UNRESOLVED -> FAIL (gcc.dg/vect/vect-align-1.c)
- 14 UNRESOLVED -> XPASS (in gcc.dg/vect/)
- 2765 new PASS
- 3639 FAIL -> PASS
- 1826 UNRESOLVED -> PASS
- 102 UNRESOLVED -> XFAIL

as visible in the red cell at
http://people.linaro.org/~christophe.lyon/cross-validation/gcc-test-patches/248552-gnu-stubs9.patch/report-build-info.html
(the build-failed line can be ignored, it was caused by a server
problem)

Sorry, the explanation is almost longer than the patch :-)

Is it OK for trunk?
(Just realizing that I forgot to document the new functions :( )

Thanks,

Christophe

[-- Attachment #2: gnu-stubs9.chlog.txt --]
[-- Type: text/plain, Size: 519 bytes --]

2017-06-02  Christophe Lyon  <christophe.lyon@linaro.org>

	* lib/target-supports.exp
	(check_effective_target_arm_neon_ok_nocache): Add flags with
	-mfloat-abi=hard. Include arm_neon.h.
	(check_effective_target_arm_neon_ok_no_float_abi_nocache): New.
	(check_effective_target_arm_neon_ok_no_float_abi): New.
	* gcc.target/arm/lto/pr65837_0.c: Require
	arm_neon_ok_no_float_abi. Add -mfpu=neon to dg-lto-options.
	* gcc.target/arm/lto/pr65837-attr_0.c: Require
	arm_neon_ok_no_float_abi. Remove dg-suppress-ld-options.

[-- Attachment #3: gnu-stubs9.patch.txt --]
[-- Type: text/plain, Size: 3193 bytes --]

diff --git a/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c b/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c
index ebc5f44..f00480b 100644
--- a/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c
+++ b/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c
@@ -1,6 +1,7 @@
 /* { dg-lto-do run } */
 /* { dg-require-effective-target arm_neon_hw } */
-/* { dg-lto-options {{-flto}} } */
+/* { dg-require-effective-target arm_neon_ok_no_float_abi } */
+/* { dg-lto-options {{-flto -mfpu=neon}} } */
 
 #include "arm_neon.h"
 
diff --git a/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c b/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c
index 6b2def9..5d7cea7 100644
--- a/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c
+++ b/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c
@@ -1,7 +1,7 @@
 /* { dg-lto-do run } */
 /* { dg-require-effective-target arm_neon_hw } */
+/* { dg-require-effective-target arm_neon_ok_no_float_abi } */
 /* { dg-lto-options {{-flto -mfpu=neon}} } */
-/* { dg-suppress-ld-options {-mfpu=neon} } */
 
 #include "arm_neon.h"
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ded6383..720b10b 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3434,8 +3434,9 @@ proc check_effective_target_arm_neon_ok_nocache { } {
     global et_arm_neon_flags
     set et_arm_neon_flags ""
     if { [check_effective_target_arm32] } {
-	foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp" "-mfpu=neon -mfloat-abi=softfp -march=armv7-a"} {
+	foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp" "-mfpu=neon -mfloat-abi=softfp -march=armv7-a" "-mfloat-abi=hard" "-mfpu=neon -mfloat-abi=hard" "-mfpu=neon -mfloat-abi=hard -march=armv7-a"} {
 	    if { [check_no_compiler_messages_nocache arm_neon_ok object {
+		#include <arm_neon.h>
 		int dummy;
 		#ifndef __ARM_NEON__
 		#error not NEON
@@ -3460,6 +3461,38 @@ proc check_effective_target_arm_neon_ok { } {
 		check_effective_target_arm_neon_ok_nocache]
 }
 
+# Return 1 if this is an ARM target supporting -mfpu=neon without any
+# -mfloat-abi= option.  Useful in tests where add_options is not
+# supported (such as lto tests).
+
+proc check_effective_target_arm_neon_ok_no_float_abi_nocache { } {
+    if { [check_effective_target_arm32] } {
+	foreach flags {"" "-mfpu=neon"} {
+	    if { [check_no_compiler_messages_nocache arm_neon_ok_no_float_abi object {
+		#include <arm_neon.h>
+		int dummy;
+		#ifndef __ARM_NEON__
+		#error not NEON
+		#endif
+		/* Avoid the case where a test adds -mfpu=neon, but the toolchain is
+		   configured for -mcpu=arm926ej-s, for example.  */
+		#if __ARM_ARCH < 7 || __ARM_ARCH_PROFILE == 'M'
+		#error Architecture does not support NEON.
+		#endif
+	    } "$flags"] } {
+		return 1
+	    }
+	}
+    }
+
+    return 0
+}
+
+proc check_effective_target_arm_neon_ok_no_float_abi { } {
+    return [check_cached_effective_target arm_neon_ok_no_float_abi \
+		check_effective_target_arm_neon_ok_no_float_abi_nocache]
+}
+
 proc check_effective_target_arm_crc_ok_nocache { } {
     global et_arm_crc_flags
     set et_arm_crc_flags "-march=armv8-a+crc"

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-26  9:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02 14:19 [Patch, ARM, testsuite] Add -mfloat-abi=hard to arm_neon_ok Christophe Lyon
2017-06-07  9:13 ` Christophe Lyon
2017-06-16 15:39   ` Christophe Lyon
2017-06-26  7:34     ` Christophe Lyon
2017-06-26  9:13   ` Kyrill Tkachov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).