This is the mail archive of the gcc@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]

Re: Defining __powerpc__ in rs6000.h


On Friday 18 May 2001 20:27, David O'Brien wrote:
> On Fri, May 18, 2001 at 11:16:21AM -0700, Geoff Keating wrote:
> > "David O'Brien" <obrien@FreeBSD.org> writes:
> > > Would it be possible to define __powerpc__, __ppc__, etc... in
> > > CPP_CPU_SPEC, or something simular as is done in i386/i386.h and
> > > alpha/alpha.h?
> >
> > Some of these chips are not powerpc, so the define would be wrong.
>
> Sorry, I did not mean those exact defines, but the applicable ones.  The
> why it is done in i386/i386.h and alpha/alpha.h would work for rs6000.h
> maybe.  I don't know the exact -D's to use, but I'm sure you guys do.
>
>
> #define CPP_CPU_SPEC \
> "%{!mcpu*: \
>   %{mpower: %{!mpower2: -D_ARCH_PWR -D__power__}} \
>   %{mpower2: -D_ARCH_PWR2 -D__power__ -D__power2__} \
>   %{mpowerpc*: -D_ARCH_PPC -D__powerpc__} \
> ..snip..
> %{mcpu=603: -D_ARCH_PPC -D__powerpc__ -D__ppc__ -D__ppc603__ -Acpu=powerpc
> -Amachine=powerpc} \ ..snip..
> %{mcpu=740: -D_ARCH_PPC -D__powerpc__ -D__ppc__ -D__ppc740__ -Acpu=powerpc
> -Acpu=powerpc -Amachine=powerpc} \ ..etc..

Hmm, sounds good. How about splitting the defines though?

Like:

#define CPP_CPU_POWERPC_SPEC \
"-D_ARCH_PPC -D__powerpc__  -D__powerpc -D__PPC__ -D__PPC -Acpu=powerpc  \
-Amachine=powerpc}"

#define CPP_CPU_SPEC \
"%{!mcpu*: \
  %{mpower: %{!mpower2: -D_ARCH_PWR -D__power__}} \
  %{mpower2: -D_ARCH_PWR2 -D__power__ -D__power2__} \
  %{mpowerpc: %{cpp_cpu_powerpc_spec}} \
..snip..
%{mcpu=603:  -D__PPC603__  %{cpp_cpu_powerpc_spec}} \
..snip..
%{mcpu=740:  -D__PPC740__  %{cpp_cpu_powerpc_spec}} \
..snip..
%{mcpu=860:  -D__PPC860__  -D_SOFT_FLOAT %{cpp_cpu_powerpc_spec}} \
..etc..

I think it's safe to completely kill -Dpowerpc and -DPPC, I've never seen 
sources using them, they all seem to use the variants with underscores.

Now, I no longer remember all the implications of using CPP_*_SPEC vs. 
CPP_PREDEFINES, but now that we have a real cpp binary that always reads the 
specs file, most of the problems of the old days should be gone.

I'm a little bit unsure about the 'cpp -undef' which currently only leaves 
-D_ARCH_PPC defined of all the CPU defines. I guess CPU_*_SPEC will change 
behaviour here, but it seems like we want this :-).

Franz.


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