[m68k] Convert CPP_SPEC to TARGET_CPU_CPP_BUILTINS

Gunther Nikl gni@gecko.de
Mon Sep 15 14:59:00 GMT 2003


On Mon, Sep 15, 2003 at 04:13:33PM +0200, Bernardo Innocenti wrote:
> Gunther Nikl wrote:
> >On Sun, Sep 14, 2003 at 10:35:17PM +0200, Bernardo Innocenti wrote:
> >
> >>+	builtin_define_std ("mc68000");		\
> >>+	if (TARGET_68020)			\
> >>+	  {					\
> >>+	    builtin_define_std ("mc68020");	\
> >>+	    builtin_define_std ("mc68030");	\
> >>+	  }					\
> >
> >  Its true that -m68030 is a synonym for -m68020 with GCC. However, 
> >  defining mc68030 together with mc68020 changes previous behaviour.
> >  mc68030 was only defined through the specsfile when -m68030 was
> >  really specified on the commandline.
> 
> I know, but there's no easy way to recover this information at this time.
> Because the 68030 looks exactly like a 68020 except for the cache size,
> the compiler doesn't care and user code should care even less.

  I know. It looks like the mc68030 define was added wrongly in the specs.

> To get that right, we would have to add dummy MASK_68030 and TARGET_68030
> macros just for that porpose.

  This would burn a bit. Testing TARGET_* flags isn't the same as tests in
  a specsfile. Whats needed is a way to intercept argument parsing.

> >>+	if (TARGET_68040 || TARGET_68040_ONLY)	\
> >>+	  builtin_define_std ("mc68040");	\
> >
> >  I think that TARGET_68040 is enough.
> 
> Hmmm... not if we want -m68060 to also define __mc68040__:

  AFAIK, you only defined mc68000 and mc680x0 for your target switch. Thus
  you should structure it like this:

   if (TARGET_68060) ...
   else if (TARGET_68040) ...
   else if (TARGET_68020) ...

  Thats what I do with the AmigaOS port and I dropped the mc68030 define.

> >>+	if (TARGET_68881)			\
> >>+	  builtin_define ("__HAVE_68881__");	\
> >
> >  This is also a change in behaviour if soft-float was default. 
> >  TARGET_68881
> >  is also true when -m680[46]0 was specified on the commandline.
> 
> This behavior should still hold:
> 
>    { "68881", MASK_68881, "" },
> 
> -m68881 adds the MASK_68881 flag.
> 
>    { "soft-float", - (MASK_68040_ONLY|MASK_68881),
> 
> -msoft-float removes the MASK_68881 flag.

  Right, but if you look at the specs which had no FPU as default, then only
  -m68881 would define HAVE_68881. MASK_68881 is also set for m680[46]0.
  Thus HAVE_68881 would now also be defined where it wasn't before. Thats
  why I still have it in CPP_SPEC. And I don't want HAVE_68881 be defined
  for m680[46]0 because that enables math-68881.h (at least on my system)

> >>+	if (TARGET_CPU32)			\
> >>+	  {					\
> >>+	    builtin_define_std ("mc68332");	\
> >>+	    builtin_define_std ("mcpu32");	\
> >>+	  }					\
> >
> >  I believe that will also change the behaviour because TARGET_CPU32 is
> >  "TARGET_68020 && !TARGET_BITFIELD" which you can also get without
> >  specifying -mcpu32.
> 
> No, you can't:
> 
>  { { "68020", - (MASK_ALL_CF_BITS|MASK_68060|MASK_68040|MASK_68040_ONLY),
>      N_("Generate code for a 68020") },
>    { "c68020", - (MASK_ALL_CF_BITS|MASK_68060|MASK_68040|MASK_68040_ONLY),
>      N_("Generate code for a 68020") },
>    { "68020", (MASK_68020|MASK_BITFIELD), "" },
>    { "c68020", (MASK_68020|MASK_BITFIELD), "" },

  You can by using -m68020 and -mno-bitfield. This would trigger
  TARGET_CPU32.

> >>+	if (flag_pic)				\
> >>+	  {					\
> >>+	    builtin_define ("__PIC__");		\
> >>+	    builtin_define ("__pic__");		\
> >>+	  }					\
> >
> >  Shouldn't these defined depending an the specific flag_pic value?
> 
> That's right, but I noticed all other back-ends just define both symbols
> without caring at all... I thought it was odd, but there has to be a
> reason.

  For me that looks simply wrong.

  Gunther



More information about the Gcc-patches mailing list