re PR target/65837 ([arm-linux-gnueabihf] lto1 target specific builtin not available)

gcc
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.

gcc/testsuite
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.

From-SVN: r232403
This commit is contained in:
Christian Bruel 2016-01-15 09:46:49 +01:00 committed by Christian Bruel
parent bdc27e509c
commit edef1fa8ff
8 changed files with 90 additions and 29 deletions

View File

@ -1,3 +1,18 @@
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.
2016-01-15 Richard Biener <rguenther@suse.de>
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 <sandra@codesourcery.com>
* doc/invoke.texi (Submodel Options): Rename section to

View File

@ -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:

View File

@ -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 *);

View File

@ -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);
}

View File

@ -1,3 +1,10 @@
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.
2016-01-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/69117

View File

@ -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 .*" } */
}

View File

@ -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;
}

View File

@ -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;
}