[PATCH][ARM,AARCH64] target/PR68674: relayout vector_types in expand_expr
Christian Bruel
christian.bruel@st.com
Fri Jan 8 13:29:00 GMT 2016
When compiling code with attribute targets on arm or aarch64,
vector_type_mode returns different results (eg Vmode or BLKmode)
depending on the current simd flags that are not set between functions.
for example the following code:
#include <arm_neon.h>
extern int8x8_t a;
extern int8x8_t b;
int16x8_t
__attribute__ ((target("fpu=neon")))
foo(void)
{
return vaddl_s8 (a, b);
}
Triggers gcc_asserts in copy_to_mode_regs while expanding NEON builtins
, because the mismatch and DECL_MODE current's TYPE_MODE used in
expand_builtin for global variables.
but the best explanation is in the vector_type_mode:
/* Vector types need to re-check the target flags each time we report
the machine mode. We need to do this because attribute target can
change the result of vector_mode_supported_p and have_regs_of_mode
on a per-function basis. Thus the TYPE_MODE of a VECTOR_TYPE can
change on a per-function basis. */
I first tried to hack the 2 machine descriptions to insert
convert_to_mode or relayout_decls here and there, but I found this very
fragile. Instead a more central relayout the of type while expanding
gave good results, as proposed here.
bootstraped and tested with no regression for arm, aarch64 and i586.
Does this look to be the right approach ?
nb: for testing this patch is complementary with
https://gcc.gnu.org/ml/gcc-patches/2016-01/msg00332.html
https://gcc.gnu.org/ml/gcc-patches/2016-01/msg00248.html
thanks for your comments.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr68674.patch
Type: text/x-patch
Size: 2108 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160108/52d3e9a3/attachment.bin>
More information about the Gcc-patches
mailing list