diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36e39d6d26a..936c2ffda50 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-06-12 Kazu Hirata + + * config/m68k/m68k.c (m68k_tune_flags): New. + (override_options): Compute m68k_tune_flags. + (MULL_COST, MULW_COST): Update for various variants of CFV2. + * config/m68k/m68k.h (TUNE_MAC, TUNE_EMAC): New. + 2008-06-12 Jakub Jelinek PR middle-end/36506 diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index a1437d29c36..f95e37e9479 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -391,6 +391,9 @@ enum fpu_type m68k_fpu; /* The set of FL_* flags that apply to the target processor. */ unsigned int m68k_cpu_flags; +/* The set of FL_* flags that apply to the processor to be tuned for. */ +unsigned int m68k_tune_flags; + /* Asm templates for calling or jumping to an arbitrary symbolic address, or NULL if such calls or jumps are not supported. The address is held in operand 0. */ @@ -571,13 +574,23 @@ override_options (void) /* Set the directly-usable versions of the -mcpu and -mtune settings. */ m68k_cpu = entry->device; if (m68k_tune_entry) - m68k_tune = m68k_tune_entry->microarch; + { + m68k_tune = m68k_tune_entry->microarch; + m68k_tune_flags = m68k_tune_entry->flags; + } #ifdef M68K_DEFAULT_TUNE else if (!m68k_cpu_entry && !m68k_arch_entry) - m68k_tune = M68K_DEFAULT_TUNE; + { + enum target_device dev; + dev = all_microarchs[M68K_DEFAULT_TUNE].device; + m68k_tune_flags = all_devices[dev]->flags; + } #endif else - m68k_tune = entry->microarch; + { + m68k_tune = entry->microarch; + m68k_tune_flags = entry->flags; + } /* Set the type of FPU. */ m68k_fpu = (!TARGET_HARD_FLOAT ? FPUTYPE_NONE @@ -2226,13 +2239,18 @@ m68k_rtx_costs (rtx x, int code, int outer_code, int *total) #define MULL_COST \ (TUNE_68060 ? 2 \ : TUNE_68040 ? 5 \ - : TUNE_CFV2 ? 10 \ + : (TUNE_CFV2 && TUNE_EMAC) ? 3 \ + : (TUNE_CFV2 && TUNE_MAC) ? 4 \ + : TUNE_CFV2 ? 8 \ : TARGET_COLDFIRE ? 3 : 13) #define MULW_COST \ (TUNE_68060 ? 2 \ : TUNE_68040 ? 3 \ - : TUNE_68000_10 || TUNE_CFV2 ? 5 \ + : TUNE_68000_10 ? 5 \ + : (TUNE_CFV2 && TUNE_EMAC) ? 3 \ + : (TUNE_CFV2 && TUNE_MAC) ? 2 \ + : TUNE_CFV2 ? 8 \ : TARGET_COLDFIRE ? 2 : 8) #define DIVW_COST \ diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index 7a68595a334..2bb725f0423 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -269,6 +269,9 @@ along with GCC; see the file COPYING3. If not see #define TUNE_CFV3 (m68k_tune == ucfv3) #define TUNE_CFV4 (m68k_tune == ucfv4 || m68k_tune == ucfv4e) +#define TUNE_MAC ((m68k_tune_flags & FL_CF_MAC) != 0) +#define TUNE_EMAC ((m68k_tune_flags & FL_CF_EMAC) != 0) + #define OVERRIDE_OPTIONS override_options() /* These are meant to be redefined in the host dependent files */ @@ -1137,6 +1140,7 @@ extern enum target_device m68k_cpu; extern enum uarch_type m68k_tune; extern enum fpu_type m68k_fpu; extern unsigned int m68k_cpu_flags; +extern unsigned int m68k_tune_flags; extern const char *m68k_symbolic_call; extern const char *m68k_symbolic_jump;