]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add support for Loongson 2K1000 processor.
authorChenghua Xu <paul.hua.gm@gmail.com>
Wed, 7 Nov 2018 08:58:05 +0000 (08:58 +0000)
committerChenghua Xu <paulhua@gcc.gnu.org>
Wed, 7 Nov 2018 08:58:05 +0000 (08:58 +0000)
gcc/
* config/mips/gs264e.md: New.
* config/mips/mips-cpus.def: Define gs264e.
* config/mips/mips-tables.opt: Regenerate.
* config/mips/mips.c (mips_rtx_cost_data): Add DEFAULT_COSTS for
gs264e.
(mips_issue_rate): Add support for gs264e.
(mips_multipass_dfa_lookahead): Likewise.
* config/mips/mips.h: Define TARGET_GS264E and TUNE_GS264E.
(MIPS_ISA_LEVEL_SPEC): Infer mips64r2 from gs264e.
(MIPS_ASE_MSA_SPEC): New.
(BASE_DRIVER_SELF_SPECS): march=gs264e implies -mmsa.
(ISA_HAS_FUSED_MADD4): Enable for TARGET_GS264E.
(ISA_HAS_UNFUSED_MADD4): Exclude TARGET_GS264E.
* config/mips/mips.md: Include gs264e.md.
(processor): Add gs264e.
* config/mips/mips.opt (MSA): Use Mask instead of Var.
* doc/invoke.texi: Add gs264e to supported architectures.

From-SVN: r265867

gcc/ChangeLog
gcc/config/mips/gs264e.md [new file with mode: 0644]
gcc/config/mips/mips-cpus.def
gcc/config/mips/mips-tables.opt
gcc/config/mips/mips.c
gcc/config/mips/mips.h
gcc/config/mips/mips.md
gcc/config/mips/mips.opt
gcc/doc/invoke.texi

index 6b7f65bd07bc87853981f5e6542dee79550956d5..379c53172dfb5b310233ae115c035bf25c5b814d 100644 (file)
@@ -1,3 +1,23 @@
+2018-11-07  Chenghua Xu  <paul.hua.gm@gmail.com>
+
+       * config/mips/gs264e.md: New.
+       * config/mips/mips-cpus.def: Define gs264e.
+       * config/mips/mips-tables.opt: Regenerate.
+       * config/mips/mips.c (mips_rtx_cost_data): Add DEFAULT_COSTS for
+       gs264e.
+       (mips_issue_rate): Add support for gs264e.
+       (mips_multipass_dfa_lookahead): Likewise.
+       * config/mips/mips.h: Define TARGET_GS264E and TUNE_GS264E.
+       (MIPS_ISA_LEVEL_SPEC): Infer mips64r2 from gs264e.
+       (MIPS_ASE_MSA_SPEC): New.
+       (BASE_DRIVER_SELF_SPECS): march=gs264e implies -mmsa.
+       (ISA_HAS_FUSED_MADD4): Enable for TARGET_GS264E.
+       (ISA_HAS_UNFUSED_MADD4): Exclude TARGET_GS264E.
+       * config/mips/mips.md: Include gs264e.md.
+       (processor): Add gs264e.
+       * config/mips/mips.opt (MSA): Use Mask instead of Var.
+       * doc/invoke.texi: Add gs264e to supported architectures.
+
 2018-11-07  Chenghua Xu  <paul.hua.gm@gmail.com>
 
        * config/mips/gs464e.md: New.
diff --git a/gcc/config/mips/gs264e.md b/gcc/config/mips/gs264e.md
new file mode 100644 (file)
index 0000000..8f1f9e1
--- /dev/null
@@ -0,0 +1,133 @@
+;; Pipeline model for Loongson gs264e cores.
+
+;; Copyright (C) 2018 Free Software Foundation, Inc.
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published
+;; by the Free Software Foundation; either version 3, or (at your
+;; option) any later version.
+;;
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+;; License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3.  If not see
+;; <http://www.gnu.org/licenses/>.
+
+;; Uncomment the following line to output automata for debugging.
+;; (automata_option "v")
+
+;; Automaton for integer instructions.
+(define_automaton "gs264e_a_alu")
+
+;; Automaton for floating-point instructions.
+(define_automaton "gs264e_a_falu")
+
+;; Automaton for memory operations.
+(define_automaton "gs264e_a_mem")
+
+;; Describe the resources.
+
+(define_cpu_unit "gs264e_alu1" "gs264e_a_alu")
+(define_cpu_unit "gs264e_mem1" "gs264e_a_mem")
+(define_cpu_unit "gs264e_falu1" "gs264e_a_falu")
+
+;; Describe instruction reservations.
+
+(define_insn_reservation "gs264e_arith" 1
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "arith,clz,const,logical,
+                       move,nop,shift,signext,slt"))
+  "gs264e_alu1")
+
+(define_insn_reservation "gs264e_branch" 1
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "branch,jump,call,condmove,trap"))
+  "gs264e_alu1")
+
+(define_insn_reservation "gs264e_mfhilo" 1
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "mfhi,mflo,mthi,mtlo"))
+  "gs264e_alu1")
+
+;; Operation imul3nc is fully pipelined.
+(define_insn_reservation "gs264e_imul3nc" 7
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "imul3nc"))
+  "gs264e_alu1")
+
+(define_insn_reservation "gs264e_imul" 7
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "imul,imadd"))
+  "gs264e_alu1")
+
+(define_insn_reservation "gs264e_idiv_si" 12
+  (and (eq_attr "cpu" "gs264e")
+       (and (eq_attr "type" "idiv")
+           (eq_attr "mode" "SI")))
+  "gs264e_alu1")
+
+(define_insn_reservation "gs264e_idiv_di" 25
+  (and (eq_attr "cpu" "gs264e")
+       (and (eq_attr "type" "idiv")
+           (eq_attr "mode" "DI")))
+  "gs264e_alu1")
+
+(define_insn_reservation "gs264e_load" 4
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "load"))
+  "gs264e_mem1")
+
+(define_insn_reservation "gs264e_fpload" 4
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "load,mfc,mtc"))
+  "gs264e_mem1")
+
+(define_insn_reservation "gs264e_prefetch" 0
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "prefetch,prefetchx"))
+  "gs264e_mem1")
+
+(define_insn_reservation "gs264e_store" 0
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "store,fpstore,fpidxstore"))
+  "gs264e_mem1")
+
+(define_insn_reservation "gs264e_fadd" 4
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "fadd,fmul,fmadd"))
+  "gs264e_falu1")
+
+(define_insn_reservation "gs264e_fcmp" 2
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "fabs,fcmp,fmove,fneg"))
+  "gs264e_falu1")
+
+(define_insn_reservation "gs264e_fcvt" 4
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "fcvt"))
+  "gs264e_falu1")
+
+(define_insn_reservation "gs264e_fdiv_sf" 12
+  (and (eq_attr "cpu" "gs264e")
+       (and (eq_attr "type" "fdiv,frdiv,fsqrt,frsqrt")
+           (eq_attr "mode" "SF")))
+  "gs264e_falu1")
+
+(define_insn_reservation "gs264e_fdiv_df" 19
+  (and (eq_attr "cpu" "gs264e")
+       (and (eq_attr "type" "fdiv,frdiv,fsqrt,frsqrt")
+           (eq_attr "mode" "DF")))
+  "gs264e_falu1")
+
+;; Force single-dispatch for unknown or multi.
+(define_insn_reservation "gs264e_unknown" 1
+  (and (eq_attr "cpu" "gs264e")
+       (eq_attr "type" "unknown,multi,atomic,syncloop"))
+  "gs264e_alu1 + gs264e_falu1 + gs264e_mem1")
+
+;; End of DFA-based pipeline description for gs264e
index b05b455c3c5d14f6c2815055c9e6ce9c797a0aac..747739f4b90eeff7f142f7dd0f8f0e3de4a1dc20 100644 (file)
@@ -165,6 +165,7 @@ MIPS_CPU ("xlr", PROCESSOR_XLR, 64, PTF_AVOID_BRANCHLIKELY_SPEED)
 MIPS_CPU ("loongson3a", PROCESSOR_GS464, 65, PTF_AVOID_BRANCHLIKELY_SPEED)
 MIPS_CPU ("gs464", PROCESSOR_GS464, 65, PTF_AVOID_BRANCHLIKELY_SPEED)
 MIPS_CPU ("gs464e", PROCESSOR_GS464E, 65, PTF_AVOID_BRANCHLIKELY_SPEED)
+MIPS_CPU ("gs264e", PROCESSOR_GS264E, 65, PTF_AVOID_BRANCHLIKELY_SPEED)
 MIPS_CPU ("octeon", PROCESSOR_OCTEON, 65, PTF_AVOID_BRANCHLIKELY_SPEED)
 MIPS_CPU ("octeon+", PROCESSOR_OCTEON, 65, PTF_AVOID_BRANCHLIKELY_SPEED)
 MIPS_CPU ("octeon2", PROCESSOR_OCTEON2, 65, PTF_AVOID_BRANCHLIKELY_SPEED)
index 539266aec8964fa349a80e404ac64b0f2fdd1fb4..7ab2cf5414b09688e08fe212630afbb5d7b1361c 100644 (file)
@@ -685,26 +685,29 @@ EnumValue
 Enum(mips_arch_opt_value) String(gs464e) Value(98) Canonical
 
 EnumValue
-Enum(mips_arch_opt_value) String(octeon) Value(99) Canonical
+Enum(mips_arch_opt_value) String(gs264e) Value(99) Canonical
 
 EnumValue
-Enum(mips_arch_opt_value) String(octeon+) Value(100) Canonical
+Enum(mips_arch_opt_value) String(octeon) Value(100) Canonical
 
 EnumValue
-Enum(mips_arch_opt_value) String(octeon2) Value(101) Canonical
+Enum(mips_arch_opt_value) String(octeon+) Value(101) Canonical
 
 EnumValue
-Enum(mips_arch_opt_value) String(octeon3) Value(102) Canonical
+Enum(mips_arch_opt_value) String(octeon2) Value(102) Canonical
 
 EnumValue
-Enum(mips_arch_opt_value) String(xlp) Value(103) Canonical
+Enum(mips_arch_opt_value) String(octeon3) Value(103) Canonical
 
 EnumValue
-Enum(mips_arch_opt_value) String(i6400) Value(104) Canonical
+Enum(mips_arch_opt_value) String(xlp) Value(104) Canonical
 
 EnumValue
-Enum(mips_arch_opt_value) String(i6500) Value(105) Canonical
+Enum(mips_arch_opt_value) String(i6400) Value(105) Canonical
 
 EnumValue
-Enum(mips_arch_opt_value) String(p6600) Value(106) Canonical
+Enum(mips_arch_opt_value) String(i6500) Value(106) Canonical
+
+EnumValue
+Enum(mips_arch_opt_value) String(p6600) Value(107) Canonical
 
index 74f6f8dfdae8e9c3482c49c22924ec3fd604d07d..2b83e4ec679cf64dec92082c30f77a7708fa3dc8 100644 (file)
@@ -842,6 +842,9 @@ static const struct mips_rtx_cost_data
   { /* Loongson gs464e.  */
     DEFAULT_COSTS
   },
+  { /* Loongson gs264e.  */
+    DEFAULT_COSTS
+  },
   { /* M4k */
     DEFAULT_COSTS
   },
@@ -14605,6 +14608,7 @@ mips_issue_rate (void)
     case PROCESSOR_OCTEON2:
     case PROCESSOR_OCTEON3:
     case PROCESSOR_I6400:
+    case PROCESSOR_GS264E:
       return 2;
 
     case PROCESSOR_SB1:
@@ -14753,7 +14757,7 @@ mips_multipass_dfa_lookahead (void)
   if (TUNE_LOONGSON_2EF || TUNE_GS464 || TUNE_GS464E)
     return 4;
 
-  if (TUNE_OCTEON)
+  if (TUNE_OCTEON || TUNE_GS264E)
     return 2;
 
   if (TUNE_P5600 || TUNE_P6600 || TUNE_I6400)
index 193d399d0b8cd6b89fe830c7b24867a06538aeae..0a92cf6788af569361165c177c2522979c69f8e0 100644 (file)
@@ -268,6 +268,7 @@ struct mips_cpu_info {
 #define TARGET_LOONGSON_2EF         (TARGET_LOONGSON_2E || TARGET_LOONGSON_2F)
 #define TARGET_GS464               (mips_arch == PROCESSOR_GS464)
 #define TARGET_GS464E              (mips_arch == PROCESSOR_GS464E)
+#define TARGET_GS264E              (mips_arch == PROCESSOR_GS264E)
 #define TARGET_MIPS3900             (mips_arch == PROCESSOR_R3900)
 #define TARGET_MIPS4000             (mips_arch == PROCESSOR_R4000)
 #define TARGET_MIPS4120             (mips_arch == PROCESSOR_R4120)
@@ -301,6 +302,7 @@ struct mips_cpu_info {
                                     || mips_tune == PROCESSOR_LOONGSON_2F)
 #define TUNE_GS464                 (mips_tune == PROCESSOR_GS464)
 #define TUNE_GS464E                (mips_tune == PROCESSOR_GS464E)
+#define TUNE_GS264E                (mips_tune == PROCESSOR_GS264E)
 #define TUNE_MIPS3000               (mips_tune == PROCESSOR_R3000)
 #define TUNE_MIPS3900               (mips_tune == PROCESSOR_R3900)
 #define TUNE_MIPS4000               (mips_tune == PROCESSOR_R4000)
@@ -794,8 +796,8 @@ struct mips_cpu_info {
      %{march=mips32r6: -mips32r6} \
      %{march=mips64|march=5k*|march=20k*|march=sb1*|march=sr71000 \
        |march=xlr: -mips64} \
-     %{march=mips64r2|march=loongson3a|march=gs464|march=gs464e|march=octeon \
-       |march=xlp: -mips64r2} \
+     %{march=mips64r2|march=loongson3a|march=gs464|march=gs464e|march=gs264e \
+       |march=octeon|march=xlp: -mips64r2} \
      %{march=mips64r3: -mips64r3} \
      %{march=mips64r5: -mips64r5} \
      %{march=mips64r6|march=i6400|march=i6500|march=p6600: -mips64r6}}"
@@ -898,7 +900,9 @@ struct mips_cpu_info {
   MIPS_ISA_NAN2008_SPEC,       \
   MIPS_ASE_DSP_SPEC,           \
   MIPS_ASE_LOONGSON_MMI_SPEC,  \
-  MIPS_ASE_LOONGSON_EXT_SPEC
+  MIPS_ASE_LOONGSON_EXT_SPEC,  \
+  MIPS_ASE_MSA_SPEC
+
 
 #define MIPS_ASE_DSP_SPEC \
   "%{!mno-dsp: \
@@ -913,7 +917,12 @@ struct mips_cpu_info {
 #define MIPS_ASE_LOONGSON_EXT_SPEC                                             \
   "%{!mno-loongson-ext:                                                                \
      %{march=loongson3a|march=gs464: -mloongson-ext}                           \
-     {march=gs464e: %{!mno-loongson-ext2: -mloongson-ext2 -mloongson-ext}}}"
+     %{march=gs464e|march=gs264e: %{!mno-loongson-ext2:                        \
+       -mloongson-ext2 -mloongson-ext}}}"
+
+#define MIPS_ASE_MSA_SPEC                                              \
+  "%{!mno-msa:                                                         \
+     %{march=gs264e: -mmsa}}"
 
 #define DRIVER_SELF_SPECS \
   MIPS_ISA_LEVEL_SPEC,   \
@@ -1103,7 +1112,8 @@ struct mips_cpu_info {
 #define ISA_HAS_FUSED_MADD4    (mips_madd4                             \
                                 && (TARGET_MIPS8000                    \
                                     || TARGET_GS464                    \
-                                    || TARGET_GS464E))
+                                    || TARGET_GS464E                   \
+                                    || TARGET_GS264E))
 
 /* ISA has 4 operand unfused madd instructions of the form
    'd = [+-] (a * b [+-] c)'.  */
@@ -1111,7 +1121,8 @@ struct mips_cpu_info {
                                 && ISA_HAS_FP4                         \
                                 && !TARGET_MIPS8000                    \
                                 && !TARGET_GS464                       \
-                                && !TARGET_GS464E)
+                                && !TARGET_GS464E                      \
+                                && !TARGET_GS264E)
 
 /* ISA has 3 operand r6 fused madd instructions of the form
    'c = c [+-] (a * b)'.  */
index acf572ab0d3803c40fdbd93e6c1c4ba8deaef0fd..9e222dc0df0eef87c2492ce53614d17e19b69872 100644 (file)
@@ -39,6 +39,7 @@
   loongson_2f
   gs464
   gs464e
+  gs264e
   m4k
   octeon
   octeon2
 (include "loongson2ef.md")
 (include "gs464.md")
 (include "gs464e.md")
+(include "gs264e.md")
 (include "octeon.md")
 (include "sb1.md")
 (include "sr71k.md")
index c0c8005b025ed34a4fe488c5eee25268c6742010..16c33d12e2208a252bab04fe885bd4ccd229d587 100644 (file)
@@ -300,7 +300,7 @@ Target Report Mask(MICROMIPS)
 Use microMIPS instructions.
 
 mmsa
-Target Report Var(TARGET_MSA)
+Target Report Mask(MSA)
 Use MIPS MSA Extension instructions.
 
 mmt
index d7897a23f2bca6fe2ffcd452a02e1c779d4b4ce5..ae260c6ac6d72668292a61a677096dae50b6a095 100644 (file)
@@ -20799,7 +20799,7 @@ The processor names are:
 @samp{i6400}, @samp{i6500},
 @samp{interaptiv},
 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
-@samp{gs464e},
+@samp{gs464e}, @samp{gs264e},
 @samp{m4k},
 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
 @samp{m5100}, @samp{m5101},