From: Christian Bruel Date: Fri, 15 Jan 2016 08:46:49 +0000 (+0100) Subject: re PR target/65837 ([arm-linux-gnueabihf] lto1 target specific builtin not available) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=edef1fa8ff862670d18467ed04a1cf16f2739cd2;p=gcc.git re PR target/65837 ([arm-linux-gnueabihf] lto1 target specific builtin not available) gcc 2015-01-16 Christian Bruel 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. gcc/testsuite 2015-01-16 Christian Bruel 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. From-SVN: r232403 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 410c893ee61..611801b583c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2015-01-16 Christian Bruel + + 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. + 2016-01-15 Richard Biener PR tree-optimization/69117 @@ -142,7 +157,7 @@ * ipa-polymorphic-call.c (inlined_polymorphic_ctor_dtor_block_p): use block_ultimate_origin (noncall-stmt_may_be_vtbl_ptr_store): Likewise. - + 2016-01-13 Sandra Loosemore * doc/invoke.texi (Submodel Options): Rename section to diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c index 835851f61f7..db6b29d310d 100644 --- a/gcc/config/arm/arm-builtins.c +++ b/gcc/config/arm/arm-builtins.c @@ -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,13 @@ 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. Such builtins will be rejected in arm_expand_builtin. */ + static void -arm_init_neon_builtins_internal (void) +arm_init_neon_builtins (void) { unsigned int i, fcode = ARM_BUILTIN_NEON_PATTERN_START; @@ -1018,7 +1025,7 @@ arm_init_neon_builtins_internal (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 +1105,6 @@ 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 (); - } - - 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,8 +1765,12 @@ 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 +2218,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 +2337,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: diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index e0f8f5b1cb8..28f226324a0 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -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 *); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 2a479f2eae2..1bbaa4a2b02 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -29937,9 +29937,6 @@ 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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 52f5b1e6438..8d21e6a09a6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2015-01-16 Christian Bruel + + 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. + 2016-01-15 Richard Biener PR tree-optimization/69117 diff --git a/gcc/testsuite/gcc.target/arm/attr-neon-builtin-fail2.c b/gcc/testsuite/gcc.target/arm/attr-neon-builtin-fail2.c new file mode 100644 index 00000000000..0f8ac1b723c --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/attr-neon-builtin-fail2.c @@ -0,0 +1,15 @@ +/* Check that calling a neon builtin from a function compiled with vfp fails. */ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_vfp_ok } */ +/* { dg-options "-O2 -mfloat-abi=softfp" } */ + +extern __simd64_int8_t a, b; + +__attribute__ ((target ("fpu=vfp"))) +void +foo (__simd128_int16_t *p) +{ + *p = (__simd128_int16_t)__builtin_neon_vaddlsv8qi (a, b); /* { dg-error "You must enable NEON instructions .*" } */ + +} + diff --git a/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c b/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c new file mode 100644 index 00000000000..ebc5f447a08 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c @@ -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; +} + diff --git a/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c b/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c index 000fc2a31c9..6b2def9985d 100644 --- a/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c +++ b/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c @@ -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; }