diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-12-03 18:06:24 +0000 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2019-12-03 18:06:24 +0000 |
commit | 6c812953c1c7a1cb791827b896bca0376d0b9402 (patch) | |
tree | 534ac9a3aa65dae82b9fb9147b106d537ec913b9 /gcc/testsuite/gcc.target/aarch64/sve/acle/general/deref_1.c | |
parent | 1b529ef2f5dbf488927de7519e5f0816ae0956a2 (diff) |
Mark constant-sized objects as addressable if they have poly-int accesses
If SVE code is written for a specific vector length, it might load from
or store to fixed-sized objects. This needs to work even without
-msve-vector-bits=N (which should never be needed for correctness).
There's no way of handling a direct poly-int sized reference to a
fixed-size register; it would have to go via memory. And in that
case it's more efficient to mark the fixed-size object as
addressable from the outset, like we do for array references
with non-constant indices.
2019-12-03 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* cfgexpand.c (discover_nonconstant_array_refs_r): If an access
with POLY_INT_CST size is made to a fixed-size object, force the
object to live in memory.
gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/deref_1.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@278941 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/aarch64/sve/acle/general/deref_1.c')
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/sve/acle/general/deref_1.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/deref_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/deref_1.c new file mode 100644 index 00000000000..99d831936a5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/deref_1.c @@ -0,0 +1,25 @@ +/* { dg-options "-O2" } */ + +#include <arm_sve.h> + +uint64_t +f1 (int32_t *x, int32_t *y) +{ + union { uint64_t x; char c[8]; } u; + svbool_t pg = svptrue_b32 (); + *(svbool_t *)&u.c[0] = svcmpeq (pg, svld1 (pg, x), 0); + *(svbool_t *)&u.c[4] = svcmpeq (pg, svld1 (pg, y), 1); + return u.x; +} + +typedef unsigned int v4si __attribute__((vector_size(16))); + +/* The aliasing is somewhat dubious here, but it must compile. */ + +v4si +f2 (void) +{ + v4si res; + *(svuint32_t *) &res = svindex_u32 (0, 1); + return res; +} |