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]

ppc e500: lots-a-cleanups


First, I've added a new option -mfloat-gprs=blah to toggle generation of floating point operations on the GPRs. Previously it was hard coded for the 8540.

Second, I've genericized the rs6000_parse_* functions into one function. The code duplication was getting ridiculous.

Last, I have added code to disable isel, spe, spe abi extensions, and float gprs, if another CPU is selected (-mcpu=), even if the triplet was powerpc-eabispe. This makes it so we can pass something like:

-mcpu=7400 -mhard-float

...from a powerpc-eabispe configuration, instead of having to do the insanely long:

-mcpu=7400 -mhard-float -misel=no -mspe=no -mabi=no-spe -mfloat-gprs=no

The first option implies the last 4.

Committed to mainline.

2003-04-07 Aldy Hernandez <aldyh at redhat dot com>

	* doc/invoke.texi (RS/6000 and PowerPC Options): Document
	-mfloat-gprs.

	* config/rs6000/rs6000.c: Delete rs6000_fprs.
	Declare rs6000_float_gprs.
	Declare rs6000_float_gprs_string.
	(rs6000_parse_float_gprs_option): New.
	(rs6000_override_options): Genericize rs6000_parse_* calls to use
	rs6000_parse_yes_no_option.
	Change check for cpu=8540, to use TARGET_E500.
	(rs6000_parse_isel_option): Delete.
	(rs6000_parse_spe_option): Delete.
	(rs6000_parse_vrsave_option): Delete.

	* config/rs6000/rs6000.h: Rename rs6000_fprs to rs6000_float_gprs.
	Define rs6000_float_gprs_string.
	(TARGET_OPTIONS): Add rs6000_float_gprs option.

* config/rs6000/eabi.h (TARGET_FPRS): Change to use rs6000_float_gprs.

* config/rs6000/eabispe.h: Set rs6000_float_gprs.

Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.257
diff -c -p -r1.257 invoke.texi
*** doc/invoke.texi	7 Apr 2003 02:48:53 -0000	1.257
--- doc/invoke.texi	7 Apr 2003 18:34:32 -0000
*************** in the following sections.
*** 448,453 ****
--- 448,454 ----
  -mabi=spe -mabi=no-spe @gol
  -misel=yes -misel=no @gol
  -mspe=yes -mspe=no @gol
+ -mfloat-gprs=yes -mfloat-gprs=no @gol
  -mprototype  -mno-prototype @gol
  -msim  -mmvme  -mads  -myellowknife  -memb -msdata @gol
  -msdata= at var{opt}  -mvxworks -mwindiss -G @var{num} -pthread}
*************** This switch enables or disables the gene
*** 7034,7039 ****
--- 7035,7047 ----
  @opindex mspe
  This switch enables or disables the generation of SPE simd
  instructions.
+
+ @item -mfloat-gprs= at var{yes/no}
+ @itemx -mfloat-gprs
+ @opindex mfloat-gprs
+ This switch enables or disables the generation of floating point
+ operations on the general purpose registers for architectures that
+ support it.  This option is currently only available on the MPC8540.

  @item -mfull-toc
  @itemx -mno-fp-in-toc
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.451
diff -c -p -r1.451 rs6000.c
*** config/rs6000/rs6000.c	7 Apr 2003 02:48:54 -0000	1.451
--- config/rs6000/rs6000.c	7 Apr 2003 18:34:33 -0000
*************** int rs6000_isel;
*** 98,105 ****
  /* Whether SPE simd instructions should be generated.  */
  int rs6000_spe;

! /* Nonzero if we have FPRs.  */
! int rs6000_fprs = 1;

  /* String from -misel=.  */
  const char *rs6000_isel_string;
--- 98,108 ----
  /* Whether SPE simd instructions should be generated.  */
  int rs6000_spe;

! /* Nonzero if floating point operations are done in the GPRs.  */
! int rs6000_float_gprs = 0;
!
! /* String from -mfloat-gprs=.  */
! const char *rs6000_float_gprs_string;

/* String from -misel=. */
const char *rs6000_isel_string;
*************** static rtx altivec_expand_abs_builtin PA
*** 274,282 ****
static rtx altivec_expand_predicate_builtin PARAMS ((enum insn_code, const char *, tree, rtx));
static rtx altivec_expand_stv_builtin PARAMS ((enum insn_code, tree));
static void rs6000_parse_abi_options PARAMS ((void));
! static void rs6000_parse_vrsave_option PARAMS ((void));
! static void rs6000_parse_isel_option PARAMS ((void));
! static void rs6000_parse_spe_option (void);
static int first_altivec_reg_to_save PARAMS ((void));
static unsigned int compute_vrsave_mask PARAMS ((void));
static void is_altivec_return_reg PARAMS ((rtx, void *));
--- 277,283 ----
static rtx altivec_expand_predicate_builtin PARAMS ((enum insn_code, const char *, tree, rtx));
static rtx altivec_expand_stv_builtin PARAMS ((enum insn_code, tree));
static void rs6000_parse_abi_options PARAMS ((void));
! static void rs6000_parse_yes_no_option (const char *, const char *, int *);
static int first_altivec_reg_to_save PARAMS ((void));
static unsigned int compute_vrsave_mask PARAMS ((void));
static void is_altivec_return_reg PARAMS ((rtx, void *));
*************** rs6000_override_options (default_cpu)
*** 702,715 ****
/* Handle -mabi= options. */
rs6000_parse_abi_options ();


!   /* Handle -mvrsave= option.  */
!   rs6000_parse_vrsave_option ();
!
!   /* Handle -misel= option.  */
!   rs6000_parse_isel_option ();
!
!   /* Handle -mspe= option.  */
!   rs6000_parse_spe_option ();

  #ifdef SUBTARGET_OVERRIDE_OPTIONS
    SUBTARGET_OVERRIDE_OPTIONS;
--- 703,716 ----
    /* Handle -mabi= options.  */
    rs6000_parse_abi_options ();

!   /* Handle generic -mFOO=YES/NO options.  */
!   rs6000_parse_yes_no_option ("vrsave", rs6000_altivec_vrsave_string,
! 			      &rs6000_altivec_vrsave);
!   rs6000_parse_yes_no_option ("isel", rs6000_isel_string,
! 			      &rs6000_isel);
!   rs6000_parse_yes_no_option ("spe", rs6000_spe_string, &rs6000_spe);
!   rs6000_parse_yes_no_option ("float-gprs", rs6000_float_gprs_string,
! 			      &rs6000_float_gprs);

  #ifdef SUBTARGET_OVERRIDE_OPTIONS
    SUBTARGET_OVERRIDE_OPTIONS;
*************** rs6000_override_options (default_cpu)
*** 718,727 ****
    SUBSUBTARGET_OVERRIDE_OPTIONS;
  #endif

! /* The e500 does not have string instructions, and we set
! MASK_STRING above when optimizing for size. */
! if (rs6000_cpu == PROCESSOR_PPC8540 && (target_flags & MASK_STRING) != 0)
! target_flags = target_flags & ~MASK_STRING;


    /* Handle -m(no-)longcall option.  This is a bit of a cheap hack,
       using TARGET_OPTIONS to handle a toggle switch, but we're out of
--- 719,745 ----
    SUBSUBTARGET_OVERRIDE_OPTIONS;
  #endif

!   if (TARGET_E500)
!     {
!       /* The e500 does not have string instructions, and we set
! 	 MASK_STRING above when optimizing for size.  */
!       if ((target_flags & MASK_STRING) != 0)
! 	target_flags = target_flags & ~MASK_STRING;
!     }
!   else if (rs6000_select[1].string != NULL)
!     {
!       /* For the powerpc-eabispe configuration, we set all these by
! 	 default, so let's unset them if we manually set another
! 	 CPU that is not the E500.  */
!       if (rs6000_abi_string == 0)
! 	rs6000_spe_abi = 0;
!       if (rs6000_spe_string == 0)
! 	rs6000_spe = 0;
!       if (rs6000_float_gprs_string == 0)
! 	rs6000_float_gprs = 0;
!       if (rs6000_isel_string == 0)
! 	rs6000_isel = 0;
!     }

    /* Handle -m(no-)longcall option.  This is a bit of a cheap hack,
       using TARGET_OPTIONS to handle a toggle switch, but we're out of
*************** rs6000_override_options (default_cpu)
*** 783,830 ****
    init_machine_status = rs6000_init_machine_status;
  }

! /* Handle -misel= option. */
! static void
! rs6000_parse_isel_option ()
! {
! if (rs6000_isel_string == 0)
! return;
! else if (! strcmp (rs6000_isel_string, "yes"))
! rs6000_isel = 1;
! else if (! strcmp (rs6000_isel_string, "no"))
! rs6000_isel = 0;
! else
! error ("unknown -misel= option specified: '%s'",
! rs6000_isel_string);
! }
!
! /* Handle -mspe= option. */
static void
! rs6000_parse_spe_option (void)
{
! if (rs6000_spe_string == 0)
return;
! else if (!strcmp (rs6000_spe_string, "yes"))
! rs6000_spe = 1;
! else if (!strcmp (rs6000_spe_string, "no"))
! rs6000_spe = 0;
! else
! error ("unknown -mspe= option specified: '%s'", rs6000_spe_string);
! }
!
! /* Handle -mvrsave= options. */
! static void
! rs6000_parse_vrsave_option ()
! {
! /* Generate VRSAVE instructions by default. */
! if (rs6000_altivec_vrsave_string == 0
! || ! strcmp (rs6000_altivec_vrsave_string, "yes"))
! rs6000_altivec_vrsave = 1;
! else if (! strcmp (rs6000_altivec_vrsave_string, "no"))
! rs6000_altivec_vrsave = 0;
else
! error ("unknown -mvrsave= option specified: '%s'",
! rs6000_altivec_vrsave_string);
}


  /* Handle -mabi= options.  */
--- 801,822 ----
    init_machine_status = rs6000_init_machine_status;
  }

! /* Handle generic options of the form -mfoo=yes/no.
! NAME is the option name.
! VALUE is the option value.
! FLAG is the pointer to the flag where to store a 1 or 0, depending on
! whether the option value is 'yes' or 'no' respectively. */
static void
! rs6000_parse_yes_no_option (const char *name, const char *value, int *flag)
{
! if (value == 0)
return;
! else if (!strcmp (value, "yes"))
! *flag = 1;
! else if (!strcmp (value, "no"))
! *flag = 0;
else
! error ("unknown -m%s= option specified: '%s'", name, value);
}


/* Handle -mabi= options. */
Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.262
diff -c -p -r1.262 rs6000.h
*** config/rs6000/rs6000.h 7 Apr 2003 02:48:54 -0000 1.262
--- config/rs6000/rs6000.h 7 Apr 2003 18:34:34 -0000
*************** extern enum processor_type rs6000_cpu;
*** 390,395 ****
--- 390,397 ----
N_("Specify yes/no if isel instructions should be generated") }, \
{"spe=", &rs6000_spe_string, \
N_("Specify yes/no if SPE SIMD instructions should be generated") },\
+ {"float-gprs=", &rs6000_float_gprs_string, \
+ N_("Specify yes/no if using floating point in the GPRs") }, \
{"vrsave=", &rs6000_altivec_vrsave_string, \
N_("Specify yes/no if VRSAVE instructions should be generated for AltiVec") }, \
{"longcall", &rs6000_longcall_switch, \
*************** extern int rs6000_altivec_abi;
*** 428,434 ****
extern int rs6000_spe_abi;
extern int rs6000_isel;
extern int rs6000_spe;
! extern int rs6000_fprs;
extern const char *rs6000_isel_string;
extern const char *rs6000_spe_string;
extern const char *rs6000_altivec_vrsave_string;
--- 430,437 ----
extern int rs6000_spe_abi;
extern int rs6000_isel;
extern int rs6000_spe;
! extern int rs6000_float_gprs;
! extern const char *rs6000_float_gprs_string;
extern const char *rs6000_isel_string;
extern const char *rs6000_spe_string;
extern const char *rs6000_altivec_vrsave_string;
Index: config/rs6000/eabi.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/eabi.h,v
retrieving revision 1.8
diff -c -p -r1.8 eabi.h
*** config/rs6000/eabi.h 7 Apr 2003 02:48:54 -0000 1.8
--- config/rs6000/eabi.h 7 Apr 2003 18:34:34 -0000
*************** Boston, MA 02111-1307, USA. */
*** 53,56 ****
#define TARGET_SPE rs6000_spe
#define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540)
#define TARGET_ISEL rs6000_isel
! #define TARGET_FPRS rs6000_fprs
--- 53,56 ----
#define TARGET_SPE rs6000_spe
#define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540)
#define TARGET_ISEL rs6000_isel
! #define TARGET_FPRS (!rs6000_float_gprs)
Index: config/rs6000/eabispe.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/eabispe.h,v
retrieving revision 1.3
diff -c -p -r1.3 eabispe.h
*** config/rs6000/eabispe.h 7 Apr 2003 02:48:54 -0000 1.3
--- config/rs6000/eabispe.h 7 Apr 2003 18:34:34 -0000
*************** Boston, MA 02111-1307, USA. */
*** 32,38 ****
rs6000_cpu = PROCESSOR_PPC8540; \
if (rs6000_abi_string == NULL || strstr (rs6000_abi_string, "spe") == NULL) \
rs6000_spe_abi = 1; \
! rs6000_fprs = 0; \
/* See note below. */ \
/*if (rs6000_long_double_size_string == NULL)*/ \
/* rs6000_long_double_type_size = 128;*/ \
--- 32,39 ----
rs6000_cpu = PROCESSOR_PPC8540; \
if (rs6000_abi_string == NULL || strstr (rs6000_abi_string, "spe") == NULL) \
rs6000_spe_abi = 1; \
! if (rs6000_float_gprs_string == NULL) \
! rs6000_float_gprs = 1; \
/* See note below. */ \
/*if (rs6000_long_double_size_string == NULL)*/ \
/* rs6000_long_double_type_size = 128;*/ \



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