1;; Pipeline model for LoongArch LA464 cores. 2 3;; Copyright (C) 2021-2022 Free Software Foundation, Inc. 4;; Contributed by Loongson Ltd. 5 6;; This file is part of GCC. 7;; 8;; GCC is free software; you can redistribute it and/or modify it 9;; under the terms of the GNU General Public License as published 10;; by the Free Software Foundation; either version 3, or (at your 11;; option) any later version. 12;; 13;; GCC is distributed in the hope that it will be useful, but WITHOUT 14;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 16;; License for more details. 17;; 18;; You should have received a copy of the GNU General Public License 19;; along with GCC; see the file COPYING3. If not see 20;; <http://www.gnu.org/licenses/>. 21 22;; Uncomment the following line to output automata for debugging. 23;; (automata_option "v") 24 25;; Automaton for integer instructions. 26(define_automaton "la464_a_alu") 27 28;; Automaton for floating-point instructions. 29(define_automaton "la464_a_falu") 30 31;; Automaton for memory operations. 32(define_automaton "la464_a_mem") 33 34;; Describe the resources. 35 36(define_cpu_unit "la464_alu1" "la464_a_alu") 37(define_cpu_unit "la464_alu2" "la464_a_alu") 38(define_cpu_unit "la464_mem1" "la464_a_mem") 39(define_cpu_unit "la464_mem2" "la464_a_mem") 40(define_cpu_unit "la464_falu1" "la464_a_falu") 41(define_cpu_unit "la464_falu2" "la464_a_falu") 42 43;; Describe instruction reservations. 44 45(define_insn_reservation "la464_arith" 1 46 (and (match_test "TARGET_TUNE_LA464") 47 (eq_attr "type" "arith,clz,const,logical, 48 move,nop,shift,signext,slt")) 49 "la464_alu1 | la464_alu2") 50 51(define_insn_reservation "la464_branch" 1 52 (and (match_test "TARGET_TUNE_LA464") 53 (eq_attr "type" "branch,jump,call,condmove,trap")) 54 "la464_alu1 | la464_alu2") 55 56(define_insn_reservation "la464_imul" 7 57 (and (match_test "TARGET_TUNE_LA464") 58 (eq_attr "type" "imul")) 59 "la464_alu1 | la464_alu2") 60 61(define_insn_reservation "la464_idiv_si" 12 62 (and (match_test "TARGET_TUNE_LA464") 63 (and (eq_attr "type" "idiv") 64 (eq_attr "mode" "SI"))) 65 "la464_alu1 | la464_alu2") 66 67(define_insn_reservation "la464_idiv_di" 25 68 (and (match_test "TARGET_TUNE_LA464") 69 (and (eq_attr "type" "idiv") 70 (eq_attr "mode" "DI"))) 71 "la464_alu1 | la464_alu2") 72 73(define_insn_reservation "la464_load" 4 74 (and (match_test "TARGET_TUNE_LA464") 75 (eq_attr "type" "load")) 76 "la464_mem1 | la464_mem2") 77 78(define_insn_reservation "la464_gpr_fp" 16 79 (and (match_test "TARGET_TUNE_LA464") 80 (eq_attr "type" "mftg,mgtf")) 81 "la464_mem1") 82 83(define_insn_reservation "la464_fpload" 4 84 (and (match_test "TARGET_TUNE_LA464") 85 (eq_attr "type" "fpload")) 86 "la464_mem1 | la464_mem2") 87 88(define_insn_reservation "la464_prefetch" 0 89 (and (match_test "TARGET_TUNE_LA464") 90 (eq_attr "type" "prefetch,prefetchx")) 91 "la464_mem1 | la464_mem2") 92 93(define_insn_reservation "la464_store" 0 94 (and (match_test "TARGET_TUNE_LA464") 95 (eq_attr "type" "store,fpstore,fpidxstore")) 96 "la464_mem1 | la464_mem2") 97 98(define_insn_reservation "la464_fadd" 4 99 (and (match_test "TARGET_TUNE_LA464") 100 (eq_attr "type" "fadd,fmul,fmadd")) 101 "la464_falu1 | la464_falu2") 102 103(define_insn_reservation "la464_fcmp" 2 104 (and (match_test "TARGET_TUNE_LA464") 105 (eq_attr "type" "fabs,fcmp,fmove,fneg")) 106 "la464_falu1 | la464_falu2") 107 108(define_insn_reservation "la464_fcvt" 4 109 (and (match_test "TARGET_TUNE_LA464") 110 (eq_attr "type" "fcvt")) 111 "la464_falu1 | la464_falu2") 112 113(define_insn_reservation "la464_fdiv_sf" 12 114 (and (match_test "TARGET_TUNE_LA464") 115 (and (eq_attr "type" "fdiv,frdiv,fsqrt,frsqrt") 116 (eq_attr "mode" "SF"))) 117 "la464_falu1 | la464_falu2") 118 119(define_insn_reservation "la464_fdiv_df" 19 120 (and (match_test "TARGET_TUNE_LA464") 121 (and (eq_attr "type" "fdiv,frdiv,fsqrt,frsqrt") 122 (eq_attr "mode" "DF"))) 123 "la464_falu1 | la464_falu2") 124 125;; Force single-dispatch for unknown or multi. 126(define_insn_reservation "la464_unknown" 1 127 (and (match_test "TARGET_TUNE_LA464") 128 (eq_attr "type" "unknown,multi,atomic,syncloop")) 129 "la464_alu1 + la464_alu2 + la464_falu1 130 + la464_falu2 + la464_mem1 + la464_mem2") 131 132;; End of DFA-based pipeline description for la464 133