This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, rs6000] Clarify when typedef names can be used with AltiVec vector types
- From: Bill Schmidt <wschmidt at linux dot ibm dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Segher Boessenkool <segher at kernel dot crashing dot org>
- Date: Tue, 18 Dec 2018 07:25:30 -0600
- Subject: Re: [PATCH, rs6000] Clarify when typedef names can be used with AltiVec vector types
- References: <20181218103358.F04E1D80327@oc3748833570.ibm.com>
On 12/18/18 4:33 AM, Ulrich Weigand wrote:
> Bill Schmidt wrote:
>
>> +@item
>> +When using vector in keyword-and-predefine mode; for example,
>> +
>> +@smallexample
>> +/* With -maltivec only: */
> This is a bit confusing (at least to me). What does "with -maltivec only"
> mean here? Just adding -maltivec will *not* switch to keyword-and-
> predefine mode, as far as I can tell. Rather, to switch to that mode
> you'll have to disable GNU extensions, e.g. via -std=c11, and then
> include <altivec.h> to get the predefine.
>
> Bye,
> Ulrich
>
Sorry about that. Here's another try, also verified on powerpc64le-linux-gnu.
Is this ok?
Thanks,
Bill
2018-12-18 Bill Schmidt <wschmidt@linux.ibm.com>
* doc/extend.texi (PowerPC Altivec/VSX Built-in Functions):
Describe when a typedef name can be used as the type specifier for
a vector type, and when it cannot.
Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi (revision 265974)
+++ gcc/doc/extend.texi (working copy)
@@ -16229,9 +16229,32 @@ disabled. To use them, you must include @code{<al
@item
GCC allows using a @code{typedef} name as the type specifier for a
-vector type.
+vector type, but only under the following circumstances:
+@itemize @bullet
+
@item
+When using @code{__vector} instead of @code{vector}; for example,
+
+@smallexample
+typedef signed short int16;
+__vector int16 data;
+@end smallexample
+
+@item
+When using @code{vector} in keyword-and-predefine mode; for example,
+
+@smallexample
+typedef signed short int16;
+vector int16 data;
+@end smallexample
+
+Note that keyword-and-predefine mode is enabled by disabling GNU
+extensions (e.g., by using @code{-std=c11}) and including
+@code{<altivec.h>}.
+@end itemize
+
+@item
For C, overloaded functions are implemented with macros so the following
does not work: