Hi all,

When adding the testsuite options for the crypto tests we need to make sure that don't end up adding -mfloat-abi=softfp to a hard-float target like arm-none-linux-gnueabihf. This patch adds that code to figure out which -mfpu/-mfloat-abi combination to use in a similar approach to the NEON tests.

This patch addresses the same failures that Christophe mentioned in http://gcc.gnu.org/ml/gcc-patches/2014-01/msg00375.html but with this patch we can get those tests to PASS on arm-none-linux-gnueabihf instead of being just UNSUPPORTED.

Tested arm-none-linux-gnueabihf and arm-none-eabi.

Ok for trunk?

Thanks,
Kyrill


2014-01-09  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

    * lib/target-supports.exp
    (check_effective_target_arm_crypto_ok_nocache): New.
    (check_effective_target_arm_crypto_ok): Use above procedure.
    (add_options_for_arm_crypto): Use et_arm_crypto_flags.
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 5166679..f1f4024 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2301,19 +2301,37 @@ proc check_effective_target_arm_unaligned { } {
 }
 
 # Return 1 if this is an ARM target supporting -mfpu=crypto-neon-fp-armv8
-# -mfloat-abi=softfp.
-proc check_effective_target_arm_crypto_ok {} {
+# -mfloat-abi=softfp or equivalent options.  Some multilibs may be
+# incompatible with these options.  Also set et_arm_crypto_flags to the
+# best options to add.
+
+proc check_effective_target_arm_crypto_ok_nocache { } {
+    global et_arm_crypto_flags
+    set et_arm_crypto_flags ""
     if { [check_effective_target_arm32] } {
-	return [check_no_compiler_messages arm_crypto_ok object {
-	  int foo (void)
-	  {
-	     __asm__ volatile ("aese.8 q0, q0");
-	     return 0;
-	  }
-	} "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"]
-    } else {
-	return 0
+	foreach flags {"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
+	    if { [check_no_compiler_messages_nocache arm_crypto_ok object {
+		#include "arm_neon.h"
+		uint8x16_t
+		foo (uint8x16_t a, uint8x16_t b)
+		{
+	          return vaeseq_u8 (a, b);
+		}
+	    } "$flags"] } {
+		set et_arm_crypto_flags $flags
+		return 1
+	    }
+	}
     }
+
+    return 0
+}
+
+# Return 1 if this is an ARM target supporting -mfpu=crypto-neon-fp-armv8
+
+proc check_effective_target_arm_crypto_ok { } {
+    return [check_cached_effective_target arm_crypto_ok \
+		check_effective_target_arm_crypto_ok_nocache]
 }
 
 # Add options for crypto extensions.
@@ -2321,7 +2339,8 @@ proc add_options_for_arm_crypto { flags } {
     if { ! [check_effective_target_arm_crypto_ok] } {
         return "$flags"
     }
-    return "$flags -mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"
+    global et_arm_crypto_flags
+    return "$flags $et_arm_crypto_flags"
 }
 
 # Add the options needed for NEON.  We need either -mfloat-abi=softfp

Reply via email to