This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

define __ALTIVEC__


by popular request... i have 3 people ask me about this missing
feature.

this patch defines __ALTIVEC__ for --enable-altivec, and when
the user configured with the altivec triplets.

the mentally painful gymnastics are because we can't just blindly
redefine CPP_SPEC without clobbering it for the sysv4 version of 
altivec.  in the interest of being safe...

ok?

2002-02-25  Aldy Hernandez  <aldyh@redhat.com>

	* config/rs6000/altivec.h (__ALTIVEC__): Define only if not
	previously defined.

	* config/rs6000/sysv4.h (__PPC_SYSV4__): Define.

	* config/rs6000/altivec-defs.h (CPP_SPEC): Define.

	* config/rs6000/linuxaltivec.h (CPP_SPEC): Define.

	* config/rs6000/eabialtivec.h (CPP_SPEC): Define.

	* config/rs6000/rs6000.h (CPP_CPU_SPEC): Define __ALTIVEC__ to 1.

Index: config/rs6000/altivec.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/altivec.h,v
retrieving revision 1.12
diff -c -p -r1.12 altivec.h
*** altivec.h	2002/02/23 00:51:51	1.12
--- altivec.h	2002/02/25 07:24:25
*************** Boston, MA 02111-1307, USA.  */
*** 35,41 ****
--- 35,43 ----
  /* Required by Motorola specs.  */
  #define __VEC__ 10206
  
+ #ifndef __ALTIVEC__
  #define __ALTIVEC__ 1
+ #endif
  
  #define __vector __attribute__((vector_size(16)))
  
Index: config/rs6000/sysv4.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.84
diff -c -p -r1.84 sysv4.h
*** sysv4.h	2002/02/19 19:40:41	1.84
--- sysv4.h	2002/02/25 07:24:26
*************** ncrtn.o%s"
*** 1512,1514 ****
--- 1512,1517 ----
  
  /* Generate entries in .fixup for relocatable addresses.  */
  #define RELOCATABLE_NEEDS_FIXUP
+ 
+ /* Internal symbol, so later include files know we are sysv4.  */
+ #define __PPC_SYSV4__ 1
Index: config/rs6000/altivec-defs.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/altivec-defs.h,v
retrieving revision 1.1
diff -c -p -r1.1 altivec-defs.h
*** altivec-defs.h	2002/01/15 23:29:03	1.1
--- altivec-defs.h	2002/02/25 07:24:26
*************** do {					\
*** 25,27 ****
--- 25,46 ----
    rs6000_altivec_abi = 1;		\
    target_flags |= MASK_ALTIVEC;		\
  } while (0)
+ 
+ #undef  CPP_SPEC
+ #ifndef __PPC_SYSV4__
+ /* It is safe to define here, because no one else on our include chain
+    will define CPP_SPEC, except sysv4.h and that's handled below.  */
+ #define CPP_SPEC "-D__ALTIVEC__=1"
+ #else
+ /* Same as sysv4.h's definition, but with -D__ALTIVEC__.  */
+ #define	CPP_SPEC "-D__ALTIVEC__=1 %{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
+ %{mads: %(cpp_os_ads) } \
+ %{myellowknife: %(cpp_os_yellowknife) } \
+ %{mmvme: %(cpp_os_mvme) } \
+ %{msim: %(cpp_os_sim) } \
+ %{mcall-freebsd: %(cpp_os_freebsd) } \
+ %{mcall-linux: %(cpp_os_linux) } \
+ %{mcall-gnu: %(cpp_os_gnu) } \
+ %{mcall-netbsd: %(cpp_os_netbsd) } \
+ %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: %(cpp_os_default) }}}}}}}}"
+ #endif
Index: config/rs6000/linuxaltivec.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/linuxaltivec.h,v
retrieving revision 1.2
diff -c -p -r1.2 linuxaltivec.h
*** linuxaltivec.h	2001/12/20 04:42:22	1.2
--- linuxaltivec.h	2002/02/25 07:24:26
*************** Boston, MA 02111-1307, USA.  */
*** 29,31 ****
--- 29,44 ----
  
  #undef SUBSUBTARGET_OVERRIDE_OPTIONS
  #define SUBSUBTARGET_OVERRIDE_OPTIONS rs6000_altivec_abi = 1
+ 
+ /* Same as sysv4.h's definition but with -D__ALTIVEC__.  */
+ #undef	CPP_SPEC
+ #define	CPP_SPEC "-D__ALTIVEC__=1 %{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
+ %{mads: %(cpp_os_ads) } \
+ %{myellowknife: %(cpp_os_yellowknife) } \
+ %{mmvme: %(cpp_os_mvme) } \
+ %{msim: %(cpp_os_sim) } \
+ %{mcall-freebsd: %(cpp_os_freebsd) } \
+ %{mcall-linux: %(cpp_os_linux) } \
+ %{mcall-gnu: %(cpp_os_gnu) } \
+ %{mcall-netbsd: %(cpp_os_netbsd) } \
+ %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: %(cpp_os_default) }}}}}}}}"
Index: config/rs6000/eabialtivec.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/eabialtivec.h,v
retrieving revision 1.1
diff -c -p -r1.1 eabialtivec.h
*** eabialtivec.h	2001/12/13 23:14:45	1.1
--- eabialtivec.h	2002/02/25 07:24:26
*************** Boston, MA 02111-1307, USA.  */
*** 29,31 ****
--- 29,34 ----
  
  #undef SUBSUBTARGET_OVERRIDE_OPTIONS
  #define SUBSUBTARGET_OVERRIDE_OPTIONS	rs6000_altivec_abi = 1
+ 
+ #undef CPP_SPEC
+ #define CPP_SPEC "-D__ALTIVEC__=1"
Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.184
diff -c -p -r1.184 rs6000.h
*** rs6000.h	2002/02/21 02:34:20	1.184
--- rs6000.h	2002/02/25 07:24:28
*************** Boston, MA 02111-1307, USA.  */
*** 84,90 ****
  %{mcpu=821: -D_ARCH_PPC} \
  %{mcpu=823: -D_ARCH_PPC} \
  %{mcpu=860: -D_ARCH_PPC} \
! %{maltivec: -D__ALTIVEC__}"
  
  /* Common ASM definitions used by ASM_SPEC among the various targets
     for handling -mcpu=xxx switches.  */
--- 84,90 ----
  %{mcpu=821: -D_ARCH_PPC} \
  %{mcpu=823: -D_ARCH_PPC} \
  %{mcpu=860: -D_ARCH_PPC} \
! %{maltivec: -D__ALTIVEC__=1}"
  
  /* Common ASM definitions used by ASM_SPEC among the various targets
     for handling -mcpu=xxx switches.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]