2015-01-16 Christian Bruel <christian.bruel@st.com>
PR target/65837
* config/arm/arm-builtins.c (ARM_BUILTIN_CRYPTO_BASE): New enum tag.
(arm_init_neon_builtins_internal): Rename arm_init_neon_builtins,
(arm_init_crypto_builtins_internal): Rename arm_init_crypto_builtins.
use add_builtin_function_ext_scope instead of add_builtin_function.
(neon_set_p, neon_crypto_set_p): Remove.
(arm_init_builtins): Always call arm_init_neon_builtins and
arm_init_crypto_builtins.
(arm_expand_builtin): Check that builtins are allowed for the arch.
* config/arm/arm-protos.h (arm_init_neon_builtins): Remove prototype.
* config/arm/arm.c (arm_valid_target_attribute_tree): Remove
arm_init_neon_builtins call.
2015-01-16 Christian Bruel <christian.bruel@st.com>
PR target/65837
* gcc.target/arm/attr-neon-builtin-fail2.c: New test.
* gcc.target/arm/lto/pr65837-attr_0.c: New test.
* gcc.target/arm/lto/pr65837_0.c: Fix skip condition and use ACLE name.
===================================================================
@@ -526,6 +526,8 @@ enum arm_builtins
#define CRYPTO3(L, U, M1, M2, M3, M4) \
ARM_BUILTIN_CRYPTO_##U,
+ ARM_BUILTIN_CRYPTO_BASE,
+
#include "crypto.def"
#undef CRYPTO1
@@ -893,8 +895,12 @@ arm_init_simd_builtin_scalar_types (void)
"__builtin_neon_uti");
}
+/* Set up all the NEON builtins, even builtins for instructions that are not
+ in the current target ISA to allow the user to compile particular modules
+ with different target specific options that differ from the command line
+ options. */
static void
-arm_init_neon_builtins_internal (void)
+arm_init_neon_builtins (void)
{
unsigned int i, fcode = ARM_BUILTIN_NEON_PATTERN_START;
@@ -1018,7 +1024,7 @@ static void
}
static void
-arm_init_crypto_builtins_internal (void)
+arm_init_crypto_builtins (void)
{
tree V16UQI_type_node
= arm_simd_builtin_type (V16QImode, true, false);
@@ -1098,25 +1104,6 @@ static 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 ();
- }
-
- if (! neon_crypto_set_p && TARGET_CRYPTO && TARGET_HARD_FLOAT)
- {
- neon_crypto_set_p = true;
- arm_init_crypto_builtins_internal ();
- }
-}
-
#undef NUM_DREG_TYPES
#undef NUM_QREG_TYPES
@@ -1777,9 +1764,13 @@ arm_init_builtins (void)
arm_init_neon_builtins which uses it. */
arm_init_fp16_builtins ();
- if (TARGET_NEON)
- arm_init_neon_builtins ();
+ if (TARGET_HARD_FLOAT)
+ {
+ arm_init_neon_builtins ();
+ arm_init_crypto_builtins ();
+ }
+
if (TARGET_CRC32)
arm_init_crc32_builtins ();
@@ -2226,6 +2217,15 @@ constant_arg:
static rtx
arm_expand_neon_builtin (int fcode, tree exp, rtx target)
{
+ /* Check in the context of the function making the call whether the
+ builtin is supported. */
+ if (! TARGET_NEON)
+ {
+ fatal_error (input_location,
+ "You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use these intrinsics.");
+ return const0_rtx;
+ }
+
if (fcode == ARM_BUILTIN_NEON_LANE_CHECK)
{
/* Builtin is only to check bounds of the lane passed to some intrinsics
@@ -2336,6 +2336,16 @@ arm_expand_builtin (tree exp,
if (fcode >= ARM_BUILTIN_NEON_BASE)
return arm_expand_neon_builtin (fcode, exp, target);
+ /* Check in the context of the function making the call whether the
+ builtin is supported. */
+ if (fcode >= ARM_BUILTIN_CRYPTO_BASE
+ && (!TARGET_CRYPTO || !TARGET_HARD_FLOAT))
+ {
+ fatal_error (input_location,
+ "You must enable crypto intrinsics (e.g. include -mfloat-abi=softfp -mfpu=crypto-neon...) to use these intrinsics.");
+ return const0_rtx;
+ }
+
switch (fcode)
{
case ARM_BUILTIN_GET_FPSCR:
===================================================================
@@ -213,7 +213,6 @@ 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 *);
===================================================================
@@ -29937,9 +29937,6 @@ arm_valid_target_attribute_tree (tree args, struct
/* 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);
}
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-lto-do run } */
+/* { dg-require-effective-target arm_neon_hw } */
+/* { dg-lto-options {{-flto}} } */
+
+#include "arm_neon.h"
+
+#pragma GCC target ("fpu=neon")
+
+float32x2_t a, b, c, e;
+
+int main()
+{
+ e = vmls_lane_f32 (a, b, c, 0);
+ return 0;
+}
+
===================================================================
@@ -1,4 +1,5 @@
/* { dg-lto-do run } */
+/* { dg-require-effective-target arm_neon_hw } */
/* { dg-lto-options {{-flto -mfpu=neon}} } */
/* { dg-suppress-ld-options {-mfpu=neon} } */
@@ -8,7 +9,7 @@ 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;
}