PowerPC specific GCC patch question

Ralf Corsepius ralf.corsepius at rtems.org
Mon Feb 14 16:33:04 UTC 2011


On 02/14/2011 11:09 AM, Sebastian Huber wrote:
> Hello,
>
> in contrib/crossrpms/patches/gcc-core-4.5.2-rtems4.11-20101216.diff we have this:
>
> diff -Naur gcc-4.5.2.orig/gcc/config/rs6000/rtems.h
> gcc-4.5.2/gcc/config/rs6000/rtems.h
> --- gcc-4.5.2.orig/gcc/config/rs6000/rtems.h	2007-08-02 12:49:31.000000000 +0200
> +++ gcc-4.5.2/gcc/config/rs6000/rtems.h	2010-12-17 16:16:29.575213615 +0100
> @@ -49,8 +49,22 @@
>   %{mcpu=604:  %{!Dppc*: %{!Dmpc*: -Dmpc604}  } } \
>   %{mcpu=750:  %{!Dppc*: %{!Dmpc*: -Dmpc750}  } } \
>   %{mcpu=821:  %{!Dppc*: %{!Dmpc*: -Dmpc821}  } } \
> -%{mcpu=860:  %{!Dppc*: %{!Dmpc*: -Dmpc860}  } }"
> +%{mcpu=860:  %{!Dppc*: %{!Dmpc*: -Dmpc860}  } } \
> +%{mcpu=8540: %{!Dppc*: %{!Dmpc*: -Dppc8540}  } }"
>
>   #undef  SUBSUBTARGET_EXTRA_SPECS
>   #define SUBSUBTARGET_EXTRA_SPECS \
>     { "cpp_os_rtems",		CPP_OS_RTEMS_SPEC }
> +
> +#undef SUBSUBTARGET_OVERRIDE_OPTIONS
> +#define SUBSUBTARGET_OVERRIDE_OPTIONS		\
> +  do {						\
> +    if (TARGET_E500)				\
> +      {						\
> +	rs6000_float_gprs = 1;			\
> +      }						\
> +  } while(0)
> +
> +#undef WCHAR_TYPE
> +
> +#undef WCHAR_TYPE_SIZE
>
> Why do we set SUBSUBTARGET_OVERRIDE_OPTIONS in that way?

The reason is this (from gcc/config/rs6000/e500.h)

#define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540)
#define TARGET_FPRS (rs6000_float_gprs == 0)
#define TARGET_E500_SINGLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 1)
#define TARGET_E500_DOUBLE (TARGET_HARD_FLOAT && rs6000_float_gprs == 2)
#define CHECK_E500_OPTIONS                                              \
   do {                                                                  \
     if (TARGET_E500 || TARGET_SPE || TARGET_SPE_ABI                     \
         || TARGET_E500_SINGLE || TARGET_E500_DOUBLE)                    \
       {                                                                 \
         if (TARGET_ALTIVEC)                                             \
           error ("AltiVec and E500 instructions cannot coexist");       \
         if (TARGET_VSX)                                                 \
           error ("VSX and E500 instructions cannot coexist");           \
         if (TARGET_64BIT)                                               \
           error ("64-bit E500 not supported");                          \
         if (TARGET_HARD_FLOAT && TARGET_FPRS)                           \
           error ("E500 and FPRs not supported");                        \
       }                                                                 \
   } while (0)


in combination with this (from the rtems-patch):
...
  MULTILIB_OPTIONS       = \
-mcpu=403/mcpu=505/mcpu=601/mcpu=603e/mcpu=604/mcpu=860/mcpu=7400 \
+mcpu=403/mcpu=505/mcpu=601/mcpu=603e/mcpu=604/mcpu=860/mcpu=7400/mcpu=8540 
\

Note: mcpu=8540 matches TARGET_E500

>  The e500v2 supports
> 64-bit floating point operations.
> With this setting I am not able to use this
> feature.
Yep, the current rtems-patch doesn't take this into account.
=> This "if" would have to be extended.

Ralf





More information about the users mailing list