This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, ARM] PR65835 Fix LTO support for neon builtins



This is the new version of the patch that removes the "lto1 target specific builtin not available" error message happening in the LTO streamer-in while loading the NEON intrinsic in the global context, without arm_fpu_index being set with the current FPU mode.

nb: Needs https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01714.html to pass

Also robustified the associated test.

Thanks,

2015-12-17  Christian Bruel  <christian.bruel@st.com>

	PR target/65837
	* arm-builtins.c (ARM_BUILTIN_CRYPTO_BASE): New enum.
	(arm_init_neon_builtins): Move neon_set_p and neon_crypto_set_p...
	(arm_init_neon_builtins_internal, arm_init_crypto_builtins_internal):
	Here.
	* arm_builtin_decl (arm_init_neon_builtins_internal)
	(arm_init_crypto_builtins_internal): Call if needed.

2015-12-17  Christian Bruel  <christian.bruel@st.com>

	PR target/65837
	* gcc.target/arm/lto/pr65837_0.c: Robustify dg tests.
	Use intrinsinc name from arm_neon.h.

Index: config/arm/arm-builtins.c
===================================================================
--- config/arm/arm-builtins.c	(revision 231774)
+++ config/arm/arm-builtins.c	(working copy)
@@ -519,6 +519,8 @@ enum arm_builtins
 #undef CRYPTO2
 #undef CRYPTO3
 
+  ARM_BUILTIN_CRYPTO_BASE,
+
 #define CRYPTO1(L, U, M1, M2) \
   ARM_BUILTIN_CRYPTO_##U,
 #define CRYPTO2(L, U, M1, M2, M3) \
@@ -893,11 +895,19 @@ arm_init_simd_builtin_scalar_types (void
 					     "__builtin_neon_uti");
 }
 
+static bool neon_set_p = false;
+static bool neon_crypto_set_p = false;
+
 static void
 arm_init_neon_builtins_internal (void)
 {
   unsigned int i, fcode = ARM_BUILTIN_NEON_PATTERN_START;
 
+  if (neon_set_p)
+    return;
+
+  neon_set_p = true;
+
   arm_init_simd_builtin_types ();
 
   /* Strong-typing hasn't been implemented for all AdvSIMD builtin intrinsics.
@@ -1020,6 +1030,11 @@ arm_init_neon_builtins_internal (void)
 static void
 arm_init_crypto_builtins_internal (void)
 {
+  if (neon_crypto_set_p)
+    return;
+
+  neon_crypto_set_p = true;
+
   tree V16UQI_type_node
     = arm_simd_builtin_type (V16QImode, true, false);
 
@@ -1098,23 +1113,13 @@ arm_init_crypto_builtins_internal (void)
   #undef FT3
 }
 
-static bool neon_set_p = false;
-static bool neon_crypto_set_p = false;
-
 void
 arm_init_neon_builtins (void)
 {
-  if (! neon_set_p)
-    {
-      neon_set_p = true;
-      arm_init_neon_builtins_internal ();
-    }
+  arm_init_neon_builtins_internal ();
 
-  if (! neon_crypto_set_p && TARGET_CRYPTO && TARGET_HARD_FLOAT)
-    {
-      neon_crypto_set_p = true;
-      arm_init_crypto_builtins_internal ();
-    }
+  if (TARGET_CRYPTO && TARGET_HARD_FLOAT)
+    arm_init_crypto_builtins_internal ();
 }
 
 #undef NUM_DREG_TYPES
@@ -1802,11 +1807,22 @@ arm_init_builtins (void)
 /* Return the ARM builtin for CODE.  */
 
 tree
-arm_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
+arm_builtin_decl (unsigned code, bool initialize_p)
 {
   if (code >= ARM_BUILTIN_MAX)
     return error_mark_node;
 
+  if (! arm_builtin_decls[code] && initialize_p)
+    {
+      /* arm_fpu_index is not set to test global features here.  */
+      if (code >= ARM_BUILTIN_CRYPTO_BASE)
+	{
+	  arm_init_neon_builtins_internal ();
+	  if (code < ARM_BUILTIN_NEON_BASE)
+	    arm_init_crypto_builtins_internal ();
+	}
+    }
+
   return arm_builtin_decls[code];
 }
 
Index: testsuite/gcc.target/arm/lto/pr65837_0.c
===================================================================
--- testsuite/gcc.target/arm/lto/pr65837_0.c	(revision 231774)
+++ testsuite/gcc.target/arm/lto/pr65837_0.c	(working copy)
@@ -1,5 +1,7 @@
 /* { dg-lto-do run } */
-/* { dg-lto-options {{-flto -mfpu=neon}} } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-skip-if "need hardfp ABI" { *-*-* } { "-mfloat-abi=soft" } { "" } } */
+/* { dg-lto-options {{-flto -mfpu=neon -mfloat-abi=hard}} } */
 /* { dg-suppress-ld-options {-mfpu=neon} } */
 
 #include "arm_neon.h"
@@ -8,7 +10,8 @@ float32x2_t a, b, c, e;
 
 int main()
 {
-  e = __builtin_neon_vmls_lanev2sf (a, b, c, 0);
+  e = vmls_lane_f32 (a, b, c, 0);
   return 0;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]