[patch] coprocessor modes

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Tue Mar 27 10:26:00 GMT 2007


DJ Delorie wrote:

>    for (c = 0; c < MAX_MODE_CLASS; c++)
>      for (m = modes[c]; m; m = m->next)
> -      {
> -	int count_;
> -	printf ("  %smode,%n", m->name, &count_);
> -	printf ("%*s/* %s:%d */\n", 27 - count_, "",
> -		 trim_filename (m->file), m->line);
> -      }
> +      for (p = 0; p <= m->copro_p; p++)

for_all_mode_prefixes?


Also, I don't know if this patch has any compile-time effect on
"normal" targets.  If it has...

> +/* True if MODE is a coprocessor mode.  */
> +#define COPRO_MODE_P(MODE) (NON_COPRO_MODE (MODE) != MODE)

... it would be nice if genmodes could generate a HAVE_COPRO_MODES
macro, so that this would be:

#define COPRO_MODE_P(MODE) (HAVE_COPRO_MODES && NON_COPRO_MODE (MODE) != MODE)

and effectively hardcoded to 0 for normal targets.  Likewise for
COPRO_VALUE_P and for {,NON_}COPRO_MODE:

#define COPRO_MODE(MODE) (HAVE_COPRO_MODES ? ... : (MODE))
#define NON_COPRO_MODE(MODE) (HAVE_COPRO_MODES ? ... : (MODE))

Alternatively you can use

#define COPRO_MODE(MODE) (gcc_assert (HAVE_COPRO_MODES), ...)
#define NON_COPRO_MODE(MODE) (gcc_assert (HAVE_COPRO_MODES), ...)

If you go for the assertion, only two places require some adaptation:

- subreg_strength (which you may declare as inline):

> +  if (GET_CODE (x) == SUBREG
> +      && COPRO_MODE (GET_MODE (x)) == COPRO_MODE (GET_MODE (SUBREG_REG (x))))
> +    return 1;

  if (!HAVE_COPRO_MODES)
    return 0;

- expand_expr_real_p

> +          if (GET_MODE (DECL_RTL (exp)) != COPRO_MODE (DECL_MODE (exp)))

This would become, likewise:

  if (COPRO_MODE_P (decl_rtl)
      ? GET_MODE (decl_rtl) != COPRO_MODE (DECL_MODE (exp))
      : GET_MODE (decl_rtl) != DECL_MODE (exp))

and then, because of the enclosing if:

  if (COPRO_MODE_P (GET_MODE (decl_rtl))
      ? GET_MODE (decl_rtl) != COPRO_MODE (DECL_MODE (exp))
      : true)

-->

  if (!(COPRO_MODE_P (GET_MODE (decl_rtl))
        && GET_MODE (decl_rtl) == COPRO_MODE (DECL_MODE (exp)))

HTH,

Paolo



More information about the Gcc-patches mailing list