re PR target/65837 ([arm-linux-gnueabihf] lto1 target specific builtin not available)
authorChristian Bruel <christian.bruel@st.com>
Mon, 16 Nov 2015 09:00:09 +0000 (10:00 +0100)
committerChristian Bruel <chrbr@gcc.gnu.org>
Mon, 16 Nov 2015 09:00:09 +0000 (10:00 +0100)
2015-11-16  Christian Bruel  <christian.bruel@st.com>

PR target/65837
* config/arm/arm-protos.h (arm_init_neon_builtins): Declare.
* config/arm/arm.c (arm_valid_target_attribute_tree): Call
arm_init_neon_builtins.
* config/arm/arm-builtins.c (arm_init_neon_builtins): Split into...
(arm_init_neon_builtins_internal)
(arm_init_crypto_builtins_internal):
Test and set neon_set_p, neon_crypto_set_p.
(neon_set_p, neon_crypto_set_p): New static booleans.

From-SVN: r230406

gcc/ChangeLog
gcc/config/arm/arm-builtins.c
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.c

index 3d8679b46359a60fc8369a096ce5945270f72278..2febfca57c2a2aca93141064ff9483054ee0d848 100644 (file)
@@ -1,3 +1,15 @@
+2015-11-16  Christian Bruel  <christian.bruel@st.com>
+
+       PR target/65837
+       * config/arm/arm-protos.h (arm_init_neon_builtins): Declare.
+       * config/arm/arm.c (arm_valid_target_attribute_tree): Call
+       arm_init_neon_builtins.
+       * config/arm/arm-builtins.c (arm_init_neon_builtins): Split into...
+       (arm_init_neon_builtins_internal)
+       (arm_init_crypto_builtins_internal):
+       Test and set neon_set_p, neon_crypto_set_p.
+       (neon_set_p, neon_crypto_set_p): New static booleans.
+
 2015-11-16  Christian Bruel  <christian.bruel@st.com>
 
        PR target/65837
index f73afc269c3ea10739bd9cba3af9f069e71da839..d0074051a9494009dbfa1a38dd612a0422be193c 100644 (file)
@@ -893,7 +893,7 @@ arm_init_simd_builtin_scalar_types (void)
 }
 
 static void
-arm_init_neon_builtins (void)
+arm_init_neon_builtins_internal (void)
 {
   unsigned int i, fcode = ARM_BUILTIN_NEON_PATTERN_START;
 
@@ -1014,87 +1014,105 @@ arm_init_neon_builtins (void)
                                     NULL, NULL_TREE);
       arm_builtin_decls[fcode] = fndecl;
     }
+}
 
-  if (TARGET_CRYPTO && TARGET_HARD_FLOAT)
-    {
-      tree V16UQI_type_node = arm_simd_builtin_type (V16QImode,
-                                                      true,
-                                                      false);
+static void
+arm_init_crypto_builtins_internal (void)
+{
+  tree V16UQI_type_node
+    = arm_simd_builtin_type (V16QImode, true, false);
 
-      tree V4USI_type_node = arm_simd_builtin_type (V4SImode,
-                                                     true,
-                                                     false);
+  tree V4USI_type_node
+    = arm_simd_builtin_type (V4SImode, true, false);
 
-      tree v16uqi_ftype_v16uqi
-       = build_function_type_list (V16UQI_type_node, V16UQI_type_node,
-                                   NULL_TREE);
+  tree v16uqi_ftype_v16uqi
+    = build_function_type_list (V16UQI_type_node, V16UQI_type_node,
+                               NULL_TREE);
 
-      tree v16uqi_ftype_v16uqi_v16uqi
+  tree v16uqi_ftype_v16uqi_v16uqi
        = build_function_type_list (V16UQI_type_node, V16UQI_type_node,
                                    V16UQI_type_node, NULL_TREE);
 
-      tree v4usi_ftype_v4usi
-       = build_function_type_list (V4USI_type_node, V4USI_type_node,
-                                   NULL_TREE);
-
-      tree v4usi_ftype_v4usi_v4usi
-       = build_function_type_list (V4USI_type_node, V4USI_type_node,
-                                   V4USI_type_node, NULL_TREE);
-
-      tree v4usi_ftype_v4usi_v4usi_v4usi
-       = build_function_type_list (V4USI_type_node, V4USI_type_node,
-                                   V4USI_type_node, V4USI_type_node,
-                                   NULL_TREE);
-
-      tree uti_ftype_udi_udi
-       = build_function_type_list (unsigned_intTI_type_node,
-                                   unsigned_intDI_type_node,
-                                   unsigned_intDI_type_node,
-                                   NULL_TREE);
-
-      #undef CRYPTO1
-      #undef CRYPTO2
-      #undef CRYPTO3
-      #undef C
-      #undef N
-      #undef CF
-      #undef FT1
-      #undef FT2
-      #undef FT3
-
-      #define C(U) \
-       ARM_BUILTIN_CRYPTO_##U
-      #define N(L) \
-       "__builtin_arm_crypto_"#L
-      #define FT1(R, A) \
-       R##_ftype_##A
-      #define FT2(R, A1, A2) \
-       R##_ftype_##A1##_##A2
-      #define FT3(R, A1, A2, A3) \
-        R##_ftype_##A1##_##A2##_##A3
-      #define CRYPTO1(L, U, R, A) \
-       arm_builtin_decls[C (U)] \
-         = add_builtin_function (N (L), FT1 (R, A), \
-                                 C (U), BUILT_IN_MD, NULL, NULL_TREE);
-      #define CRYPTO2(L, U, R, A1, A2)  \
-       arm_builtin_decls[C (U)]        \
-         = add_builtin_function (N (L), FT2 (R, A1, A2), \
-                                 C (U), BUILT_IN_MD, NULL, NULL_TREE);
+  tree v4usi_ftype_v4usi
+    = build_function_type_list (V4USI_type_node, V4USI_type_node,
+                               NULL_TREE);
+
+  tree v4usi_ftype_v4usi_v4usi
+    = build_function_type_list (V4USI_type_node, V4USI_type_node,
+                               V4USI_type_node, NULL_TREE);
+
+  tree v4usi_ftype_v4usi_v4usi_v4usi
+    = build_function_type_list (V4USI_type_node, V4USI_type_node,
+                               V4USI_type_node, V4USI_type_node,
+                               NULL_TREE);
 
-      #define CRYPTO3(L, U, R, A1, A2, A3) \
-       arm_builtin_decls[C (U)]           \
-         = add_builtin_function (N (L), FT3 (R, A1, A2, A3), \
+  tree uti_ftype_udi_udi
+    = build_function_type_list (unsigned_intTI_type_node,
+                               unsigned_intDI_type_node,
+                               unsigned_intDI_type_node,
+                               NULL_TREE);
+
+  #undef CRYPTO1
+  #undef CRYPTO2
+  #undef CRYPTO3
+  #undef C
+  #undef N
+  #undef CF
+  #undef FT1
+  #undef FT2
+  #undef FT3
+
+  #define C(U) \
+    ARM_BUILTIN_CRYPTO_##U
+  #define N(L) \
+    "__builtin_arm_crypto_"#L
+  #define FT1(R, A) \
+    R##_ftype_##A
+  #define FT2(R, A1, A2) \
+    R##_ftype_##A1##_##A2
+  #define FT3(R, A1, A2, A3) \
+    R##_ftype_##A1##_##A2##_##A3
+  #define CRYPTO1(L, U, R, A) \
+    arm_builtin_decls[C (U)] \
+      = add_builtin_function (N (L), FT1 (R, A), \
+                 C (U), BUILT_IN_MD, NULL, NULL_TREE);
+  #define CRYPTO2(L, U, R, A1, A2)  \
+    arm_builtin_decls[C (U)]   \
+      = add_builtin_function (N (L), FT2 (R, A1, A2), \
+                 C (U), BUILT_IN_MD, NULL, NULL_TREE);
+
+  #define CRYPTO3(L, U, R, A1, A2, A3) \
+    arm_builtin_decls[C (U)]      \
+      = add_builtin_function (N (L), FT3 (R, A1, A2, A3), \
                                  C (U), BUILT_IN_MD, NULL, NULL_TREE);
-      #include "crypto.def"
-
-      #undef CRYPTO1
-      #undef CRYPTO2
-      #undef CRYPTO3
-      #undef C
-      #undef N
-      #undef FT1
-      #undef FT2
-      #undef FT3
+  #include "crypto.def"
+
+  #undef CRYPTO1
+  #undef CRYPTO2
+  #undef CRYPTO3
+  #undef C
+  #undef N
+  #undef FT1
+  #undef FT2
+  #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 ();
+    }
+
+  if (!neon_crypto_set_p && TARGET_CRYPTO && TARGET_HARD_FLOAT)
+    {
+      neon_crypto_set_p = true;
+      arm_init_crypto_builtins_internal ();
     }
 }
 
index f9b12764b094c4931e2201bb23aa211a17be3bc9..8e737539e99ce9a774f720a24a06c3a050a6359a 100644 (file)
@@ -214,6 +214,7 @@ extern void arm_mark_dllimport (tree);
 extern bool arm_change_mode_p (tree);
 #endif
 
+extern void arm_init_neon_builtins (void);
 extern tree arm_valid_target_attribute_tree (tree, struct gcc_options *,
                                             struct gcc_options *);
 extern void arm_pr_long_calls (struct cpp_reader *);
index 10c4348d7f34f977d38dbc7d4bcace1713e01a2b..98b5c8258dc9d334da486f827f20397f15b905a5 100644 (file)
@@ -29846,6 +29846,9 @@ arm_valid_target_attribute_tree (tree args, struct gcc_options *opts,
   /* Do any overrides, such as global options arch=xxx.  */
   arm_option_override_internal (opts, opts_set);
 
+  if (TARGET_NEON)
+    arm_init_neon_builtins ();
+
   return build_target_option_node (opts);
 }