Commit 6ce12f6a by Richard Sandiford Committed by Richard Sandiford

Allow targets to pick a vector prefix other than "V"

Originally the SVE port used the names for 256-bit vectors, as the
next available increment after Advanced SIMD.  However, that was
always a bit of a hack and is bound to confuse people new to the code.

Nothing actually requires vector modes to have names of the form
V<nunits><mode>, and after talking it over with the AArch64 maintainers,
we agreed to switch to things like:

    VNx16QI

instead.  This patch lets targets pick this kind of prefix.

2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* machmode.def (VECTOR_MODES_WITH_PREFIX): Document.
	* genmodes.c (VECTOR_MODES_WITH_PREFIX): New macro.
	(VECTOR_MODES): Use it.
	(make_vector_modes): Take the prefix as an argument.

From-SVN: r256203
parent 5c0caeb3
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org> 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
* machmode.def (VECTOR_MODES_WITH_PREFIX): Document.
* genmodes.c (VECTOR_MODES_WITH_PREFIX): New macro.
(VECTOR_MODES): Use it.
(make_vector_modes): Take the prefix as an argument.
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
......
...@@ -483,9 +483,11 @@ make_complex_modes (enum mode_class cl, ...@@ -483,9 +483,11 @@ make_complex_modes (enum mode_class cl,
/* For all modes in class CL, construct vector modes of width /* For all modes in class CL, construct vector modes of width
WIDTH, having as many components as necessary. */ WIDTH, having as many components as necessary. */
#define VECTOR_MODES(C, W) make_vector_modes (MODE_##C, W, __FILE__, __LINE__) #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)
static void ATTRIBUTE_UNUSED static void ATTRIBUTE_UNUSED
make_vector_modes (enum mode_class cl, unsigned int width, make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
const char *file, unsigned int line) const char *file, unsigned int line)
{ {
struct mode_data *m; struct mode_data *m;
...@@ -516,8 +518,8 @@ make_vector_modes (enum mode_class cl, unsigned int width, ...@@ -516,8 +518,8 @@ make_vector_modes (enum mode_class cl, unsigned int width,
if (cl == MODE_INT && m->precision == 1) if (cl == MODE_INT && m->precision == 1)
continue; continue;
if ((size_t)snprintf (buf, sizeof buf, "V%u%s", ncomponents, m->name) if ((size_t) snprintf (buf, sizeof buf, "%s%u%s", prefix,
>= sizeof buf) ncomponents, m->name) >= sizeof buf)
{ {
error ("%s:%d: mode name \"%s\" is too long", error ("%s:%d: mode name \"%s\" is too long",
m->file, m->line, m->name); m->file, m->line, m->name);
......
...@@ -142,6 +142,10 @@ along with GCC; see the file COPYING3. If not see ...@@ -142,6 +142,10 @@ along with GCC; see the file COPYING3. If not see
than two bytes (if CLASS is FLOAT). CLASS must be INT or than two bytes (if CLASS is FLOAT). CLASS must be INT or
FLOAT. The names follow the same rule as VECTOR_MODE uses. FLOAT. The names follow the same rule as VECTOR_MODE uses.
VECTOR_MODES_WITH_PREFIX (PREFIX, CLASS, WIDTH);
Like VECTOR_MODES, but start the mode names with PREFIX instead
of the usual "V".
VECTOR_BOOL_MODE (NAME, COUNT, BYTESIZE) VECTOR_BOOL_MODE (NAME, COUNT, BYTESIZE)
Create a vector mode called NAME that contains COUNT boolean Create a vector mode called NAME that contains COUNT boolean
elements and occupies BYTESIZE bytes in total. Each boolean elements and occupies BYTESIZE bytes in total. Each boolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment