diff options
author | Adam Nemet <anemet@caviumnetworks.com> | 2008-08-25 00:57:01 +0000 |
---|---|---|
committer | Adam Nemet <nemet@gcc.gnu.org> | 2008-08-25 00:57:01 +0000 |
commit | d97e6aca01c5d9e6b41fe5e2e4c551e9777162ea (patch) | |
tree | f13d95beb43ba81bd154edae66a1cafd6d601e63 /gcc/config | |
parent | 807e74dbc6dcae64f4b6dc32cd376ec87607bd67 (diff) | |
download | gcc-d97e6aca01c5d9e6b41fe5e2e4c551e9777162ea.zip gcc-d97e6aca01c5d9e6b41fe5e2e4c551e9777162ea.tar.gz gcc-d97e6aca01c5d9e6b41fe5e2e4c551e9777162ea.tar.bz2 |
config.gcc (mips64*-*-linux*): Handle mips64octeon*-*-linux*.
* config.gcc (mips64*-*-linux*): Handle mips64octeon*-*-linux*.
* config/mips/mips.h (enum processor_type): Add PROCESSOR_OCTEON.
(TARGET_OCTEON): New macro.
(TARGET_CPU_CPP_BUILTINS): Define __OCTEON__ for Octeon.
(MIPS_ISA_LEVEL_SPEC, MIPS_ARCH_FLOAT_SPEC): Handle -march=octeon.
(ISA_HAS_POP): New macro.
* config/mips/driver-native.c (host_detect_local_cpu): Handle
Octeon.
* config/mips/mips.c (mips_cpu_info_table, mips_rtx_cost_data):
Handle Octeon.
* config/mips/mips.md (cpu): Add octeon.
(type): Add pop attribute value.
(popcount<mode>2): New pattern.
* doc/invoke.texi (-march=@var{arch}): Add octeon.
testsuite/
* gcc.target/mips/octeon-pop-1.c: New test.
From-SVN: r139554
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/mips/driver-native.c | 2 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 15 | ||||
-rw-r--r-- | gcc/config/mips/mips.h | 13 | ||||
-rw-r--r-- | gcc/config/mips/mips.md | 21 |
4 files changed, 46 insertions, 5 deletions
diff --git a/gcc/config/mips/driver-native.c b/gcc/config/mips/driver-native.c index 24831c6..1947d71 100644 --- a/gcc/config/mips/driver-native.c +++ b/gcc/config/mips/driver-native.c @@ -67,6 +67,8 @@ host_detect_local_cpu (int argc, const char **argv) cpu = "sb1"; else if (strstr (buf, "R5000") != NULL) cpu = "r5000"; + else if (strstr (buf, "Octeon") != NULL) + cpu = "octeon"; break; } diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index e9eb20c..8a2ba16 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -652,7 +652,10 @@ static const struct mips_cpu_info mips_cpu_info_table[] = { { "sb1", PROCESSOR_SB1, 64, PTF_AVOID_BRANCHLIKELY }, { "sb1a", PROCESSOR_SB1A, 64, PTF_AVOID_BRANCHLIKELY }, { "sr71000", PROCESSOR_SR71000, 64, PTF_AVOID_BRANCHLIKELY }, - { "xlr", PROCESSOR_XLR, 64, 0 } + { "xlr", PROCESSOR_XLR, 64, 0 }, + + /* MIPS64 Release 2 processors. */ + { "octeon", PROCESSOR_OCTEON, 65, PTF_AVOID_BRANCHLIKELY } }; /* Default costs. If these are used for a processor we should look @@ -852,6 +855,16 @@ static const struct mips_rtx_cost_data mips_rtx_cost_data[PROCESSOR_MAX] = { { /* M4k */ DEFAULT_COSTS }, + /* Octeon */ + { + SOFT_FP_COSTS, + COSTS_N_INSNS (5), /* int_mult_si */ + COSTS_N_INSNS (5), /* int_mult_di */ + COSTS_N_INSNS (72), /* int_div_si */ + COSTS_N_INSNS (72), /* int_div_di */ + 1, /* branch_cost */ + 4 /* memory_latency */ + }, { /* R3900 */ COSTS_N_INSNS (2), /* fp_add */ COSTS_N_INSNS (4), /* fp_mult_sf */ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 30d77eb..acf2b6c 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -50,6 +50,7 @@ enum processor_type { PROCESSOR_LOONGSON_2E, PROCESSOR_LOONGSON_2F, PROCESSOR_M4K, + PROCESSOR_OCTEON, PROCESSOR_R3900, PROCESSOR_R6000, PROCESSOR_R4000, @@ -253,6 +254,7 @@ enum mips_code_readable_setting { #define TARGET_MIPS5500 (mips_arch == PROCESSOR_R5500) #define TARGET_MIPS7000 (mips_arch == PROCESSOR_R7000) #define TARGET_MIPS9000 (mips_arch == PROCESSOR_R9000) +#define TARGET_OCTEON (mips_arch == PROCESSOR_OCTEON) #define TARGET_SB1 (mips_arch == PROCESSOR_SB1 \ || mips_arch == PROCESSOR_SB1A) #define TARGET_SR71K (mips_arch == PROCESSOR_SR71000) @@ -529,6 +531,10 @@ enum mips_code_readable_setting { if (TARGET_LOONGSON_VECTORS) \ builtin_define ("__mips_loongson_vector_rev"); \ \ + /* Historical Octeon macro. */ \ + if (TARGET_OCTEON) \ + builtin_define ("__OCTEON__"); \ + \ /* Macros dependent on the C dialect. */ \ if (preprocessing_asm_p ()) \ { \ @@ -693,7 +699,7 @@ enum mips_code_readable_setting { %{march=mips32r2|march=m4k|march=4ke*|march=4ksd|march=24k* \ |march=34k*|march=74k*: -mips32r2} \ %{march=mips64|march=5k*|march=20k*|march=sb1*|march=sr71000: -mips64} \ - %{march=mips64r2: -mips64r2} \ + %{march=mips64r2|march=octeon: -mips64r2} \ %{!march=*: -" MULTILIB_ISA_DEFAULT "}}" /* A spec that infers a -mhard-float or -msoft-float setting from an @@ -703,7 +709,7 @@ enum mips_code_readable_setting { #define MIPS_ARCH_FLOAT_SPEC \ "%{mhard-float|msoft-float|march=mips*:; \ march=vr41*|march=m4k|march=4k*|march=24kc|march=24kec \ - |march=34kc|march=74kc|march=5kc: -msoft-float; \ + |march=34kc|march=74kc|march=5kc|march=octeon: -msoft-float; \ march=*: -mhard-float}" /* A spec condition that matches 32-bit options. It only works if @@ -996,6 +1002,9 @@ enum mips_code_readable_setting { (target_flags_explicit & MASK_LLSC \ ? TARGET_LLSC && !TARGET_MIPS16 \ : ISA_HAS_LL_SC) + +/* ISA includes the pop instruction. */ +#define ISA_HAS_POP TARGET_OCTEON /* Add -G xx support. */ diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index 4d09085..4204ec1 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -344,6 +344,7 @@ ;; slt set less than instructions ;; signext sign extend instructions ;; clz the clz and clo instructions +;; pop the pop instruction ;; trap trap if instructions ;; imul integer multiply 2 operands ;; imul3 integer multiply 3 operands @@ -372,7 +373,7 @@ (define_attr "type" "unknown,branch,jump,call,load,fpload,fpidxload,store,fpstore,fpidxstore, prefetch,prefetchx,condmove,mtc,mfc,mthilo,mfhilo,const,arith,logical, - shift,slt,signext,clz,trap,imul,imul3,imadd,idiv,move,fmove,fadd,fmul, + shift,slt,signext,clz,pop,trap,imul,imul3,imadd,idiv,move,fmove,fadd,fmul, fmadd,fdiv,frdiv,frdiv1,frdiv2,fabs,fneg,fcmp,fcvt,fsqrt,frsqrt,frsqrt1, frsqrt2,multi,nop,ghost" (cond [(eq_attr "jal" "!unset") (const_string "call") @@ -556,7 +557,7 @@ ;; Attribute describing the processor. This attribute must match exactly ;; with the processor_type enumeration in mips.h. (define_attr "cpu" - "r3000,4kc,4kp,5kc,5kf,20kc,24kc,24kf2_1,24kf1_1,74kc,74kf2_1,74kf1_1,74kf3_2,loongson_2e,loongson_2f,m4k,r3900,r6000,r4000,r4100,r4111,r4120,r4130,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,sb1,sb1a,sr71000,xlr" + "r3000,4kc,4kp,5kc,5kf,20kc,24kc,24kf2_1,24kf1_1,74kc,74kf2_1,74kf1_1,74kf3_2,loongson_2e,loongson_2f,m4k,octeon,r3900,r6000,r4000,r4100,r4111,r4120,r4130,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,sb1,sb1a,sr71000,xlr" (const (symbol_ref "mips_tune"))) ;; The type of hardware hazard associated with this instruction. @@ -2410,6 +2411,22 @@ "<d>clz\t%0,%1" [(set_attr "type" "clz") (set_attr "mode" "<MODE>")]) + +;; +;; ................... +;; +;; Count number of set bits. +;; +;; ................... +;; + +(define_insn "popcount<mode>2" + [(set (match_operand:GPR 0 "register_operand" "=d") + (popcount:GPR (match_operand:GPR 1 "register_operand" "d")))] + "ISA_HAS_POP" + "<d>pop\t%0,%1" + [(set_attr "type" "pop") + (set_attr "mode" "<MODE>")]) ;; ;; .................... |