From 8ba8ec53f9dc56ef16f71b2a6315282b45fa6c94 Mon Sep 17 00:00:00 2001 From: uros Date: Thu, 22 Nov 2007 11:25:11 +0000 Subject: [PATCH] * config/i386/i386.h (TARGET_CPU_CPP_BUILTINS): Change checking of ix86_arch and ix86_tune into a switch statement. (enum processor_type): Default PROCESSOR_I386 to 0. * config/i386/i386.c (ix86_decompose_address): Use TARGET_K6 instead of "ix86_tune == PROCESSOR_K6". (ia32_multipass_dfa_lookahead): Change checking of ix86_tune into a switch statement. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130349 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 +++ gcc/config/i386/i386.c | 19 +++-- gcc/config/i386/i386.h | 208 +++++++++++++++++++++++++------------------------ 3 files changed, 128 insertions(+), 109 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac51ad54899..32c472e03bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2007-11-22 Uros Bizjak + + * config/i386/i386.h (TARGET_CPU_CPP_BUILTINS): Change checking + of ix86_arch and ix86_tune into a switch statement. + (enum processor_type): Default PROCESSOR_I386 to 0. + * config/i386/i386.c (ix86_decompose_address): Use TARGET_K6 instead + of "ix86_tune == PROCESSOR_K6". + (ia32_multipass_dfa_lookahead): Change checking of ix86_tune into + a switch statement. + 2007-11-22 Tom Tromey * config/mmix/mmix.c (mmix_encode_section_info): Use alloca to diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f3bbf72e6e3..b378aaec8dd 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6781,7 +6781,7 @@ ix86_decompose_address (rtx addr, struct ix86_address *out) /* Special case: on K6, [%esi] makes the instruction vector decoded. Avoid this by transforming to [%esi+0]. */ - if (ix86_tune == PROCESSOR_K6 && !optimize_size + if (TARGET_K6 && !optimize_size && base_reg && !index_reg && !disp && REG_P (base_reg) && REGNO_REG_CLASS (REGNO (base_reg)) == SIREG) @@ -16661,15 +16661,18 @@ ix86_adjust_cost (rtx insn, rtx link, rtx dep_insn, int cost) static int ia32_multipass_dfa_lookahead (void) { - if (ix86_tune == PROCESSOR_PENTIUM) - return 2; + switch (ix86_tune) + { + case PROCESSOR_PENTIUM: + return 2; - if (ix86_tune == PROCESSOR_PENTIUMPRO - || ix86_tune == PROCESSOR_K6) - return 1; + case PROCESSOR_PENTIUMPRO: + case PROCESSOR_K6: + return 1; - else - return 0; + default: + return 0; + } } diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 872425e4b5f..3a36149a471 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -531,21 +531,90 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); builtin_define_std ("i386"); \ } \ \ - /* Built-ins based on -mtune= (or -march= if no \ - -mtune= given). */ \ - if (TARGET_386) \ - builtin_define ("__tune_i386__"); \ - else if (TARGET_486) \ - builtin_define ("__tune_i486__"); \ - else if (TARGET_PENTIUM) \ + /* Built-ins based on -march=. */ \ + switch (ix86_arch) \ + { \ + case PROCESSOR_I386: \ + break; \ + case PROCESSOR_I486: \ + builtin_define ("__i486"); \ + builtin_define ("__i486__"); \ + break; \ + case PROCESSOR_PENTIUM: \ + builtin_define ("__i586"); \ + builtin_define ("__i586__"); \ + builtin_define ("__pentium"); \ + builtin_define ("__pentium__"); \ + if (last_arch_char == 'x') \ + builtin_define ("__pentium_mmx__"); \ + break; \ + case PROCESSOR_PENTIUMPRO: \ + builtin_define ("__i686"); \ + builtin_define ("__i686__"); \ + builtin_define ("__pentiumpro"); \ + builtin_define ("__pentiumpro__"); \ + break; \ + case PROCESSOR_GEODE: \ + builtin_define ("__geode"); \ + builtin_define ("__geode__"); \ + break; \ + case PROCESSOR_K6: \ + builtin_define ("__k6"); \ + builtin_define ("__k6__"); \ + if (last_arch_char == '2') \ + builtin_define ("__k6_2__"); \ + else if (last_arch_char == '3') \ + builtin_define ("__k6_3__"); \ + break; \ + case PROCESSOR_ATHLON: \ + builtin_define ("__athlon"); \ + builtin_define ("__athlon__"); \ + /* Only plain "athlon" lacks SSE. */ \ + if (last_arch_char != 'n') \ + builtin_define ("__athlon_sse__"); \ + break; \ + case PROCESSOR_K8: \ + builtin_define ("__k8"); \ + builtin_define ("__k8__"); \ + break; \ + case PROCESSOR_AMDFAM10: \ + builtin_define ("__amdfam10"); \ + builtin_define ("__amdfam10__"); \ + break; \ + case PROCESSOR_PENTIUM4: \ + builtin_define ("__pentium4"); \ + builtin_define ("__pentium4__"); \ + break; \ + case PROCESSOR_NOCONA: \ + builtin_define ("__nocona"); \ + builtin_define ("__nocona__"); \ + break; \ + case PROCESSOR_CORE2: \ + builtin_define ("__core2"); \ + builtin_define ("__core2__"); \ + break; \ + case PROCESSOR_GENERIC32: \ + case PROCESSOR_GENERIC64: \ + case PROCESSOR_max: \ + gcc_unreachable (); \ + } \ + \ + /* Built-ins based on -mtune=. */ \ + switch (ix86_tune) \ { \ + case PROCESSOR_I386: \ + builtin_define ("__tune_i386__"); \ + break; \ + case PROCESSOR_I486: \ + builtin_define ("__tune_i486__"); \ + break; \ + case PROCESSOR_PENTIUM: \ builtin_define ("__tune_i586__"); \ builtin_define ("__tune_pentium__"); \ if (last_tune_char == 'x') \ builtin_define ("__tune_pentium_mmx__"); \ - } \ - else if (TARGET_PENTIUMPRO) \ - { \ + break; \ + case PROCESSOR_PENTIUMPRO: \ builtin_define ("__tune_i686__"); \ builtin_define ("__tune_pentiumpro__"); \ switch (last_tune_char) \ @@ -557,36 +626,44 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); builtin_define ("__tune_pentium2__"); \ break; \ } \ - } \ - else if (TARGET_GEODE) \ - { \ + break; \ + case PROCESSOR_GEODE: \ builtin_define ("__tune_geode__"); \ - } \ - else if (TARGET_K6) \ - { \ + break; \ + case PROCESSOR_K6: \ builtin_define ("__tune_k6__"); \ if (last_tune_char == '2') \ builtin_define ("__tune_k6_2__"); \ else if (last_tune_char == '3') \ builtin_define ("__tune_k6_3__"); \ - } \ - else if (TARGET_ATHLON) \ - { \ + break; \ + case PROCESSOR_ATHLON: \ builtin_define ("__tune_athlon__"); \ /* Only plain "athlon" lacks SSE. */ \ if (last_tune_char != 'n') \ builtin_define ("__tune_athlon_sse__"); \ + break; \ + case PROCESSOR_K8: \ + builtin_define ("__tune_k8__"); \ + break; \ + case PROCESSOR_AMDFAM10: \ + builtin_define ("__tune_amdfam10__"); \ + break; \ + case PROCESSOR_PENTIUM4: \ + builtin_define ("__tune_pentium4__"); \ + break; \ + case PROCESSOR_NOCONA: \ + builtin_define ("__tune_nocona__"); \ + break; \ + case PROCESSOR_CORE2: \ + builtin_define ("__tune_core2__"); \ + break; \ + case PROCESSOR_GENERIC32: \ + case PROCESSOR_GENERIC64: \ + break; \ + case PROCESSOR_max: \ + gcc_unreachable (); \ } \ - else if (TARGET_K8) \ - builtin_define ("__tune_k8__"); \ - else if (TARGET_AMDFAM10) \ - builtin_define ("__tune_amdfam10__"); \ - else if (TARGET_PENTIUM4) \ - builtin_define ("__tune_pentium4__"); \ - else if (TARGET_NOCONA) \ - builtin_define ("__tune_nocona__"); \ - else if (TARGET_CORE2) \ - builtin_define ("__tune_core2__"); \ \ if (TARGET_MMX) \ builtin_define ("__MMX__"); \ @@ -614,77 +691,6 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); builtin_define ("__SSE_MATH__"); \ if (TARGET_SSE_MATH && TARGET_SSE2) \ builtin_define ("__SSE2_MATH__"); \ - \ - /* Built-ins based on -march=. */ \ - if (ix86_arch == PROCESSOR_I486) \ - { \ - builtin_define ("__i486"); \ - builtin_define ("__i486__"); \ - } \ - else if (ix86_arch == PROCESSOR_PENTIUM) \ - { \ - builtin_define ("__i586"); \ - builtin_define ("__i586__"); \ - builtin_define ("__pentium"); \ - builtin_define ("__pentium__"); \ - if (last_arch_char == 'x') \ - builtin_define ("__pentium_mmx__"); \ - } \ - else if (ix86_arch == PROCESSOR_PENTIUMPRO) \ - { \ - builtin_define ("__i686"); \ - builtin_define ("__i686__"); \ - builtin_define ("__pentiumpro"); \ - builtin_define ("__pentiumpro__"); \ - } \ - else if (ix86_arch == PROCESSOR_GEODE) \ - { \ - builtin_define ("__geode"); \ - builtin_define ("__geode__"); \ - } \ - else if (ix86_arch == PROCESSOR_K6) \ - { \ - \ - builtin_define ("__k6"); \ - builtin_define ("__k6__"); \ - if (last_arch_char == '2') \ - builtin_define ("__k6_2__"); \ - else if (last_arch_char == '3') \ - builtin_define ("__k6_3__"); \ - } \ - else if (ix86_arch == PROCESSOR_ATHLON) \ - { \ - builtin_define ("__athlon"); \ - builtin_define ("__athlon__"); \ - /* Only plain "athlon" lacks SSE. */ \ - if (last_arch_char != 'n') \ - builtin_define ("__athlon_sse__"); \ - } \ - else if (ix86_arch == PROCESSOR_K8) \ - { \ - builtin_define ("__k8"); \ - builtin_define ("__k8__"); \ - } \ - else if (ix86_arch == PROCESSOR_AMDFAM10) \ - { \ - builtin_define ("__amdfam10"); \ - builtin_define ("__amdfam10__"); \ - } \ - else if (ix86_arch == PROCESSOR_PENTIUM4) \ - { \ - builtin_define ("__pentium4"); \ - builtin_define ("__pentium4__"); \ - } \ - else if (ix86_arch == PROCESSOR_NOCONA) \ - { \ - builtin_define ("__nocona"); \ - builtin_define ("__nocona__"); \ - } \ - else if (ix86_arch == PROCESSOR_CORE2) \ - { \ - builtin_define ("__core2"); \ - builtin_define ("__core2__"); \ - } \ } \ while (0) @@ -2271,7 +2277,7 @@ do { \ enum processor_type { - PROCESSOR_I386, /* 80386 */ + PROCESSOR_I386 = 0, /* 80386 */ PROCESSOR_I486, /* 80486DX, 80486SX, 80486DX[24] */ PROCESSOR_PENTIUM, PROCESSOR_PENTIUMPRO, -- 2.11.0