summaryrefslogtreecommitdiff
path: root/gcc/genmodes.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-10-16 10:53:40 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-10-16 10:53:40 +0000
commit550a338052c374cb1f6c07ffd883c4046565fdd4 (patch)
treebb0ffdac0fdaa344fbacf57dbb9ec48a3aa2299d /gcc/genmodes.c
parent9b17a646d90ad0cc30daf8432aa60ad0d751d914 (diff)
[AArch64] Add partial SVE vector modes
This patch adds extra vector modes that represent a half, quarter or eighth of what an SVE vector can hold. This is useful for describing the memory vector involved in an extending load or truncating store. It might also be useful in future for representing "unpacked" SVE registers, i.e. registers that contain values in the low bits of a wider containing element. The new modes could have the same width as an Advanced SIMD mode for certain -msve-vector-bits=N options, so we need to ensure that they come later in the mode list and that Advanced SIMD modes always "win". 2019-10-16 Richard Sandiford <richard.sandiford@arm.com> gcc/ * genmodes.c (mode_data::order): New field. (blank_mode): Update accordingly. (VECTOR_MODES_WITH_PREFIX): Add an order parameter. (make_vector_modes): Likewise. (VECTOR_MODES): Update use accordingly. (cmp_modes): Sort by the new order field ahead of sorting by size. * config/aarch64/aarch64-modes.def (VNx2QI, VN2xHI, VNx2SI) (VNx4QI, VNx4HI, VNx8QI): New partial vector modes. * config/aarch64/aarch64.c (VEC_PARTIAL): New flag value. (aarch64_classify_vector_mode): Handle the new partial modes. (aarch64_vl_bytes): New function. (aarch64_hard_regno_nregs): Use it instead of BYTES_PER_SVE_VECTOR when counting the number of registers in an SVE mode. (aarch64_class_max_nregs): Likewise. (aarch64_hard_regno_mode_ok): Don't allow partial vectors in registers yet. (aarch64_classify_address): Treat partial vectors analogously to full vectors. (aarch64_print_address_internal): Consolidate the printing of MUL VL addresses, using aarch64_vl_bytes as the number of bytes represented by "VL". (aarch64_vector_mode_supported_p): Reject partial vector modes. From-SVN: r277062
Diffstat (limited to 'gcc/genmodes.c')
-rw-r--r--gcc/genmodes.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index f33eefa2494..95522d6b539 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -53,6 +53,7 @@ struct mode_data
const char *name; /* printable mode name -- SI, not SImode */
enum mode_class cl; /* this mode class */
+ unsigned int order; /* top-level sorting order */
unsigned int precision; /* size in bits, equiv to TYPE_PRECISION */
unsigned int bytesize; /* storage size in addressable units */
unsigned int ncomponents; /* number of subunits */
@@ -85,7 +86,7 @@ static struct mode_data *void_mode;
static const struct mode_data blank_mode = {
0, "<unknown>", MAX_MODE_CLASS,
- -1U, -1U, -1U, -1U,
+ 0, -1U, -1U, -1U, -1U,
0, 0, 0, 0, 0, 0,
"<unknown>", 0, 0, 0, 0, false, false, 0
};
@@ -484,14 +485,15 @@ make_complex_modes (enum mode_class cl,
}
}
-/* For all modes in class CL, construct vector modes of width
- WIDTH, having as many components as necessary. */
-#define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W) \
- make_vector_modes (MODE_##C, #PREFIX, W, __FILE__, __LINE__)
-#define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W)
+/* For all modes in class CL, construct vector modes of width WIDTH,
+ having as many components as necessary. ORDER is the sorting order
+ of the mode, with smaller numbers indicating a higher priority. */
+#define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W, ORDER) \
+ make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, __LINE__)
+#define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W, 0)
static void ATTRIBUTE_UNUSED
make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
- const char *file, unsigned int line)
+ unsigned int order, const char *file, unsigned int line)
{
struct mode_data *m;
struct mode_data *v;
@@ -530,6 +532,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
}
v = new_mode (vclass, xstrdup (buf), file, line);
+ v->order = order;
v->component = m;
v->ncomponents = ncomponents;
}
@@ -832,6 +835,11 @@ cmp_modes (const void *a, const void *b)
const struct mode_data *const m = *(const struct mode_data *const*)a;
const struct mode_data *const n = *(const struct mode_data *const*)b;
+ if (m->order > n->order)
+ return 1;
+ else if (m->order < n->order)
+ return -1;
+
if (m->bytesize > n->bytesize)
return 1;
else if (m->bytesize < n->bytesize)