Altivec Linux support in GCC

Aldy Hernandez aldyh@redhat.com
Tue Apr 15 21:53:00 GMT 2003


> No, that wasn't the reason for -maltivec.
>
> -maltivec is the ISA selection flag.  -mabi=xxx is the ABI selection
> flag.  There's an important distinction from the user's point of view
> about which flags are ISA selection and which change the ABI, because
> one set is safe and the other isn't.

This set of defaults is not sane from a user's perspective, just 
judging from the amount of mail I get on this.  As it stands I doubt 
more than 10% of users understand this.

> If users are confused by -maltivec, it's most likely because of the
> name.  Historically, all ISA selection flags in the ppc ports have had

Well, why can't we have -maltivec mean what everyone but about 5 people 
think it means, and then have something like -misa=altivec that means 
what you want it to mean?  I doubt more than those 5 people are going 
to use -misa=altivec anyhow.

As it stands we are catering for a very select group of people and 
confusing everybody else.  It doesn't mean anything if you and I 
understand it, if just about every user out there doesn't.

> short names like -maltivec or -mstring; I believe I made a proposal to
> change that but never got time to implement it.

Well I propose to have -maltivec imply -mabi=altivec; it doesn't matter 
if it historically it is an ISA selection flag.  I propose it, am 
willing to code it, and dispel the average Joe's confusion.  For that 
matter, the patch is included below.  If you propose something else and 
not implement it, it really doesn't gain us anything.

Aldy

2003-04-15  Aldy Hernandez  <aldyh@redhat.com>

	* doc/invoke.texi (RS/6000 and PowerPC Options): Document altivec
	extensions.

	* config/rs6000/eabialtivec.h: Remove SUBSUBTARGET_OVERRIDE_OPTIONS.

	* config/rs6000/linuxaltivec.h: Same.

	* config/rs6000/rs6000.c (rs6000_override_options): TARGET_ALTIVEC
	implies TARGET_ALTIVEC_ABI by default.

Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.259
diff -c -p -r1.259 invoke.texi
*** doc/invoke.texi	7 Apr 2003 18:49:09 -0000	1.259
--- doc/invoke.texi	15 Apr 2003 21:16:44 -0000
*************** scheduling parameters set by @option{-mt
*** 6971,6979 ****
   @opindex maltivec
   @opindex mno-altivec
   These switches enable or disable the use of built-in functions that
! allow access to the AltiVec instruction set.  You may also need to set
! @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
! enhancements.

   @item -mabi=spe
   @opindex mabi=spe
--- 6971,6996 ----
   @opindex maltivec
   @opindex mno-altivec
   These switches enable or disable the use of built-in functions that
! allow access to the AltiVec instruction set.  This option also enables
! AltiVec extensions to the current ABI.  See @option{-mabi=altivec}.
!
! @item -mabi=altivec
! @opindex mabi=altivec
! Extend the current ABI with AltiVec ABI extensions.  This does not
! change the default ABI, instead it adds the AltiVec ABI extensions to
! the current ABI.  This option is enabled by default when
! @option{-maltivec} is specified.
!
! @item -mabi=no-altivec
! @opindex mabi=no-altivec
! Disable AltiVec ABI extensions for the current ABI.
!
! It is sometimes (but seldom) desirable to disable AltiVec ABI
! extensions even if @option{-maltivec} is specified.  Using this option
! will cause GCC not to save call saved AltiVec registers as mandated by
! the AltiVec ABI.  It will also disable using AltiVec registers as
! arguments when passing vectors as arguments; and it will disable
! setting the VRSAVE register, even if @option{-mvrsave=yes} is used.

   @item -mabi=spe
   @opindex mabi=spe
*************** Return all structures in memory (as spec
*** 7245,7260 ****
   @opindex msvr4-struct-return
   Return structures smaller than 8 bytes in registers (as specified by 
the
   SVR4 ABI)@.
-
- @item -mabi=altivec
- @opindex mabi=altivec
- Extend the current ABI with AltiVec ABI extensions.  This does not
- change the default ABI, instead it adds the AltiVec ABI extensions to
- the current ABI@.
-
- @item -mabi=no-altivec
- @opindex mabi=no-altivec
- Disable AltiVec ABI extensions for the current ABI.

   @item -mprototype
   @itemx -mno-prototype
--- 7262,7267 ----
Index: config/rs6000/eabialtivec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/eabialtivec.h,v
retrieving revision 1.1
diff -c -p -r1.1 eabialtivec.h
*** config/rs6000/eabialtivec.h	13 Dec 2001 23:14:45 -0000	1.1
--- config/rs6000/eabialtivec.h	15 Apr 2003 21:16:44 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 26,31 ****

   #undef TARGET_VERSION
   #define TARGET_VERSION fprintf (stderr, " (PowerPC Embedded with 
AltiVec)");
-
- #undef SUBSUBTARGET_OVERRIDE_OPTIONS
- #define SUBSUBTARGET_OVERRIDE_OPTIONS	rs6000_altivec_abi = 1
--- 26,28 ----
Index: config/rs6000/linuxaltivec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/linuxaltivec.h,v
retrieving revision 1.2
diff -c -p -r1.2 linuxaltivec.h
*** config/rs6000/linuxaltivec.h	20 Dec 2001 04:42:22 -0000	1.2
--- config/rs6000/linuxaltivec.h	15 Apr 2003 21:16:44 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 26,31 ****
   /* Override rs6000.h and sysv4.h definition.  */
   #undef	TARGET_DEFAULT
   #define	TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | 
MASK_ALTIVEC)
-
- #undef SUBSUBTARGET_OVERRIDE_OPTIONS
- #define SUBSUBTARGET_OVERRIDE_OPTIONS rs6000_altivec_abi = 1
--- 26,28 ----
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.458
diff -c -p -r1.458 rs6000.c
*** config/rs6000/rs6000.c	14 Apr 2003 22:54:35 -0000	1.458
--- config/rs6000/rs6000.c	15 Apr 2003 21:16:46 -0000
*************** rs6000_override_options (default_cpu)
*** 706,711 ****
--- 706,716 ----
   	rs6000_long_double_type_size = size;
       }

+   /* TARGET_ALTIVEC implies TARGET_ALTIVEC_ABI unless the user
+      specified an -mabi= option.  */
+   if (TARGET_ALTIVEC && rs6000_abi_string == NULL)
+     rs6000_altivec_abi = 1;
+
     /* Handle -mabi= options.  */
     rs6000_parse_abi_options ();



More information about the Gcc mailing list