aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/spu
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-10-26 11:28:25 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-10-26 11:28:25 +0000
commitf073de07ad00d4be604bdbaeab14786850932601 (patch)
tree825db4f6d56d10a34af45d9e3c9e8dcaf128e151 /gcc/config/spu
parent4bc19a3b1a9fe74e515b7c54082bbad27decc227 (diff)
downloadgcc-f073de07ad00d4be604bdbaeab14786850932601.zip
gcc-f073de07ad00d4be604bdbaeab14786850932601.tar.gz
gcc-f073de07ad00d4be604bdbaeab14786850932601.tar.bz2
This patch adds a new hook that gives the preferred alignment for a static rtx...
TARGET_STATIC_RTX_ALIGNMENT This patch adds a new hook that gives the preferred alignment for a static rtx, so that we don't need to query the front end in force_const_mem. 2017-10-26 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * target.def (static_rtx_alignment): New hook. * targhooks.h (default_static_rtx_alignment): Declare. * targhooks.c (default_static_rtx_alignment): New function. * doc/tm.texi.in (TARGET_STATIC_RTX_ALIGNMENT): New hook. * doc/tm.texi: Regenerate. * varasm.c (force_const_mem): Use targetm.static_rtx_alignment instead of targetm.constant_alignment. Remove call to set_mem_attributes. * config/cris/cris.c (TARGET_STATIC_RTX_ALIGNMENT): Redefine. (cris_preferred_mininum_alignment): New function, split out from... (cris_constant_alignment): ...here. (cris_static_rtx_alignment): New function. * config/i386/i386.c (ix86_static_rtx_alignment): New function, split out from... (ix86_constant_alignment): ...here. (TARGET_STATIC_RTX_ALIGNMENT): Redefine. * config/mmix/mmix.c (TARGET_STATIC_RTX_ALIGNMENT): Redefine. (mmix_static_rtx_alignment): New function. * config/spu/spu.c (spu_static_rtx_alignment): New function. (TARGET_STATIC_RTX_ALIGNMENT): Redefine. From-SVN: r254102
Diffstat (limited to 'gcc/config/spu')
-rw-r--r--gcc/config/spu/spu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index eda7fca..bf21cca 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -7196,6 +7196,18 @@ spu_truly_noop_truncation (unsigned int outprec, unsigned int inprec)
return inprec <= 32 && outprec <= inprec;
}
+/* Implement TARGET_STATIC_RTX_ALIGNMENT.
+
+ Make all static objects 16-byte aligned. This allows us to assume
+ they are also padded to 16 bytes, which means we can use a single
+ load or store instruction to access them. */
+
+static HOST_WIDE_INT
+spu_static_rtx_alignment (machine_mode mode)
+{
+ return MAX (GET_MODE_ALIGNMENT (mode), 128);
+}
+
/* Implement TARGET_CONSTANT_ALIGNMENT.
Make all static objects 16-byte aligned. This allows us to assume
@@ -7447,6 +7459,8 @@ static const struct attribute_spec spu_attribute_table[] =
#undef TARGET_TRULY_NOOP_TRUNCATION
#define TARGET_TRULY_NOOP_TRUNCATION spu_truly_noop_truncation
+#undef TARGET_STATIC_RTX_ALIGNMENT
+#define TARGET_STATIC_RTX_ALIGNMENT spu_static_rtx_alignment
#undef TARGET_CONSTANT_ALIGNMENT
#define TARGET_CONSTANT_ALIGNMENT spu_constant_alignment