This patch handles moves involving structure constants. It's a backport of:
http://gcc.gnu.org/ml/gcc-patches/2011-04/msg00200.html
which Richard Earnshaw has approved, but which cannot be applied yet because it depends on 4/5. The patch is needed because 3/5 would otherwise expose new instances of the PR.
Richard
gcc/ PR target/46329 * config/arm/arm.c (arm_legitimate_constant_p_1): Return false for all Neon struct constants.
gcc/testsuite/ From Richard Earnshaw rearnsha@arm.com
PR target/46329 * gcc.target/arm/pr46329.c: New test.
Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c 2011-04-19 16:38:16.000000000 +0000 +++ gcc/config/arm/arm.c 2011-04-20 07:54:11.000000000 +0000 @@ -140,7 +140,7 @@ static void arm_internal_label (FILE *, static void arm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); static bool arm_have_conditional_execution (void); -static bool arm_cannot_force_const_mem (enum machine_mode, rtx); +static bool arm_cannot_force_const_mem (rtx); static bool arm_legitimate_constant_p (enum machine_mode, rtx); static bool arm_rtx_costs_1 (rtx, enum rtx_code, int*, bool); static bool arm_size_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *); @@ -6465,8 +6465,14 @@ arm_tls_referenced_p (rtx x) When generating pic allow anything. */
static bool -arm_legitimate_constant_p_1 (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x) +arm_legitimate_constant_p_1 (enum machine_mode mode, rtx x) { + /* At present, we have no support for Neon structure constants, so forbid + them here. It might be possible to handle simple cases like 0 and -1 + in future. */ + if (TARGET_NEON && VALID_NEON_STRUCT_MODE (mode)) + return false; + return flag_pic || !label_mentioned_p (x); }
Index: gcc/testsuite/gcc.target/arm/pr46329.c =================================================================== --- /dev/null 2010-10-05 15:55:33.000000000 +0000 +++ gcc/testsuite/gcc.target/arm/pr46329.c 2011-04-19 16:38:16.000000000 +0000 @@ -0,0 +1,9 @@ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_neon } */ + +int __attribute__ ((vector_size (32))) x; +void +foo (void) +{ + x <<= x; +}