From eb448bee82b18bb8130c2d848e6c9e89e8503bd0 Mon Sep 17 00:00:00 2001 From: Chung-Lin Tang Date: Sun, 22 Jul 2012 07:05:28 +0000 Subject: [PATCH] NetLogic Microsystems Inc. 2012-07-22 Chung-Lin Tang Maxim Kuvyrkov NetLogic Microsystems Inc. * config/mips/mips.c (mips_issue_rate): Handle XLP. * config/mips/mips.md: Include xlp.md. * config/mips/xlp.md: New file. Co-Authored-By: Maxim Kuvyrkov From-SVN: r189754 --- gcc/ChangeLog | 8 ++ gcc/config/mips/mips.c | 3 + gcc/config/mips/mips.md | 1 + gcc/config/mips/xlp.md | 213 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 225 insertions(+) create mode 100644 gcc/config/mips/xlp.md diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 28f96158b86..dc3bdc01252 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2012-07-22 Chung-Lin Tang + Maxim Kuvyrkov + NetLogic Microsystems Inc. + + * config/mips/mips.c (mips_issue_rate): Handle XLP. + * config/mips/mips.md: Include xlp.md. + * config/mips/xlp.md: New file. + 2012-07-21 Steven Bosscher PR gcov-profile/32543 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index e4e93e69731..e9e4ec10c43 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -12502,6 +12502,9 @@ mips_issue_rate (void) case PROCESSOR_LOONGSON_3A: return 4; + case PROCESSOR_XLP: + return (reload_completed ? 4 : 3); + default: return 1; } diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index af741ba2b82..febe07799e6 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -942,6 +942,7 @@ (include "sb1.md") (include "sr71k.md") (include "xlr.md") +(include "xlp.md") (include "generic.md") ;; diff --git a/gcc/config/mips/xlp.md b/gcc/config/mips/xlp.md new file mode 100644 index 00000000000..994c9b16df8 --- /dev/null +++ b/gcc/config/mips/xlp.md @@ -0,0 +1,213 @@ +;; DFA-based pipeline description for the XLP. +;; Copyright (C) 2012 Free Software Foundation, Inc. +;; +;; xlp.md Machine Description for the Broadcom XLP Microprocessor +;; 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 +;; . + +(define_automaton "xlp_cpu") + +;; CPU function units. +(define_cpu_unit "xlp_ex0" "xlp_cpu") +(define_cpu_unit "xlp_ex1" "xlp_cpu") +(define_cpu_unit "xlp_ex2" "xlp_cpu") +(define_cpu_unit "xlp_ex3" "xlp_cpu") + +;; Integer Multiply Unit +(define_cpu_unit "xlp_div" "xlp_cpu") + +;; ALU2 completion port. +(define_cpu_unit "xlp_ex2_wrb" "xlp_cpu") + +(define_automaton "xlp_fpu") + +;; Floating-point units. +(define_cpu_unit "xlp_fp" "xlp_fpu") + +;; Floating Point Sqrt/Divide +(define_cpu_unit "xlp_divsq" "xlp_fpu") + +;; FPU completion port. +(define_cpu_unit "xlp_fp_wrb" "xlp_fpu") + +;; Define reservations for common combinations. + +;; +;; The ordering of the instruction-execution-path/resource-usage +;; descriptions (also known as reservation RTL) is roughly ordered +;; based on the define attribute RTL for the "type" classification. +;; When modifying, remember that the first test that matches is the +;; reservation used! +;; +(define_insn_reservation "ir_xlp_unknown" 1 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "unknown,multi")) + "xlp_ex0+xlp_ex1+xlp_ex2+xlp_ex3") + +(define_insn_reservation "ir_xlp_branch" 1 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "branch,jump,call")) + "xlp_ex3") + +(define_insn_reservation "ir_xlp_prefetch" 1 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "prefetch,prefetchx")) + "xlp_ex0|xlp_ex1") + +(define_insn_reservation "ir_xlp_load" 4 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "load")) + "xlp_ex0|xlp_ex1") + +(define_insn_reservation "ir_xlp_fpload" 5 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "fpload,fpidxload")) + "xlp_ex0|xlp_ex1") + +(define_insn_reservation "ir_xlp_alu" 1 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "const,arith,shift,slt,clz,signext,logical,move,trap,nop")) + "xlp_ex0|xlp_ex1|(xlp_ex2,xlp_ex2_wrb)|xlp_ex3") + +(define_insn_reservation "ir_xlp_condmov" 1 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "condmove") + (eq_attr "mode" "SI,DI")) + "xlp_ex2,xlp_ex2_wrb") + +(define_insn_reservation "ir_xlp_mul" 5 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "imul,imadd")) + "xlp_ex2,nothing*4,xlp_ex2_wrb") + +(define_insn_reservation "ir_xlp_mul3" 3 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "imul3")) + "xlp_ex2,nothing*2,xlp_ex2_wrb") + +(define_insn_reservation "ir_xlp_div" 24 + (and (eq_attr "cpu" "xlp") + (eq_attr "mode" "SI") + (eq_attr "type" "idiv")) + "xlp_ex2+xlp_div,xlp_div*23,xlp_ex2_wrb") + +(define_insn_reservation "ir_xlp_ddiv" 48 + (and (eq_attr "cpu" "xlp") + (eq_attr "mode" "DI") + (eq_attr "type" "idiv")) + "xlp_ex2+xlp_div,xlp_div*47,xlp_ex2_wrb") + +(define_insn_reservation "ir_xlp_store" 1 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "store,fpstore,fpidxstore")) + "xlp_ex0|xlp_ex1") + +(define_insn_reservation "ir_xlp_fpmove" 2 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "mfc")) + "xlp_ex3,xlp_fp,xlp_fp_wrb") + +(define_insn_reservation "ir_xlp_mfhi" 1 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "mfhi")) + "xlp_ex2,xlp_ex2_wrb") + +(define_insn_reservation "ir_xlp_mflo" 1 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "mflo")) + "xlp_ex2,xlp_ex2_wrb") + +(define_insn_reservation "ir_xlp_mthi" 1 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "mthi")) + "xlp_ex2,xlp_ex2_wrb") + +(define_insn_reservation "ir_xlp_mtlo" 3 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "mtlo")) + "xlp_ex2,nothing*2,xlp_ex2_wrb") + +(define_insn_reservation "ir_xlp_fp2" 2 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "fmove,fneg,fabs,condmove")) + "xlp_fp,nothing,xlp_fp_wrb") + +(define_insn_reservation "ir_xlp_fp3" 3 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "fcmp")) + "xlp_fp,nothing*2,xlp_fp_wrb") + +(define_insn_reservation "ir_xlp_fp4" 4 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "fcvt")) + "xlp_fp,nothing*3,xlp_fp_wrb") + +(define_insn_reservation "ir_xlp_fp5" 5 + (and (eq_attr "cpu" "xlp") + (eq_attr "mode" "SF") + (eq_attr "type" "fadd,fmul")) + "xlp_fp,nothing*4,xlp_fp_wrb") + +(define_insn_reservation "ir_xlp_fp6" 6 + (and (eq_attr "cpu" "xlp") + (eq_attr "mode" "DF") + (eq_attr "type" "fadd,fmul")) + "xlp_fp,nothing*5,xlp_fp_wrb") + +(define_insn_reservation "ir_xlp_fp9" 9 + (and (eq_attr "cpu" "xlp") + (eq_attr "mode" "SF") + (eq_attr "type" "fmadd")) + "xlp_fp,nothing*3,xlp_fp,nothing*3,xlp_fp_wrb") + +(define_insn_reservation "ir_xlp_fp11" 11 + (and (eq_attr "cpu" "xlp") + (eq_attr "mode" "DF") + (eq_attr "type" "fmadd")) + "xlp_fp,nothing*4,xlp_fp,nothing*4,xlp_fp_wrb") + +(define_insn_reservation "ir_xlp_fpcomplex_s" 23 + (and (eq_attr "cpu" "xlp") + (eq_attr "mode" "SF") + (eq_attr "type" "fdiv,frdiv,frdiv1,frdiv2,fsqrt,frsqrt,frsqrt1,frsqrt2")) + "xlp_fp+xlp_divsq,xlp_divsq*22,xlp_fp_wrb") + +(define_insn_reservation "ir_xlp_fpcomplex_d" 38 + (and (eq_attr "cpu" "xlp") + (eq_attr "mode" "DF") + (eq_attr "type" "fdiv,frdiv,frdiv1,frdiv2,fsqrt,frsqrt,frsqrt1,frsqrt2")) + "xlp_fp+xlp_divsq,xlp_divsq*37,xlp_fp_wrb") + +(define_bypass 3 "ir_xlp_mul" "ir_xlp_mfhi") + +(define_insn_reservation "ir_xlp_atomic" 15 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "atomic")) + "xlp_ex0|xlp_ex1") + +;; Sync loop consists of (in order) +;; (1) optional sync, +;; (2) LL instruction, +;; (3) branch and 1-2 ALU instructions, +;; (4) SC instruction, +;; (5) optional sync, +;; (6) branch and ALU instruction. +;; The net result of this reservation is a big delay with flush of +;; ALU pipeline and outgoing reservations discouraging use of EX3. +(define_insn_reservation "ir_xlp_sync_loop" 40 + (and (eq_attr "cpu" "xlp") + (eq_attr "type" "syncloop")) + "(xlp_ex0+xlp_ex1+xlp_ex2+xlp_ex3)*39,xlp_ex3+(xlp_ex0|xlp_ex1|(xlp_ex2,xlp_ex2_wrb))") -- 2.30.2