Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions gcc/config/riscv/arcv-rhx100.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
;; DFA scheduling description of the Synopsys RHX-100 cpu
;; for GNU C compiler
;; Copyright (C) 2023 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/>.

(define_automaton "arcv_rhx100")

(define_cpu_unit "arcv_rhx100_ALU_A_fuse0_early" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_ALU_A_fuse1_early" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_ALU_B_fuse0_early" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_ALU_B_fuse1_early" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_MPY32" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_DIV" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_DMP_fuse0" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_DMP_fuse1" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_fdivsqrt" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_issueA_fuse0" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_issueA_fuse1" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_issueB_fuse0" "arcv_rhx100")
(define_cpu_unit "arcv_rhx100_issueB_fuse1" "arcv_rhx100")

;; Instruction reservation for arithmetic instructions (pipe A, pipe B).
(define_insn_reservation "arcv_rhx100_alu_early_arith" 1
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "unknown,move,const,arith,shift,slt,multi,auipc,nop,logical,\
bitmanip,min,max,minu,maxu,clz,ctz,atomic,\
condmove,mvpair,zicond,cpop,clmul"))
"((arcv_rhx100_issueA_fuse0 + arcv_rhx100_ALU_A_fuse0_early) | (arcv_rhx100_issueA_fuse1 + arcv_rhx100_ALU_A_fuse1_early)) | ((arcv_rhx100_issueB_fuse0 + arcv_rhx100_ALU_B_fuse0_early) | (arcv_rhx100_issueB_fuse1 + arcv_rhx100_ALU_B_fuse1_early))")

(define_insn_reservation "arcv_rhx100_imul_fused" 4
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "imul_fused"))
"(arcv_rhx100_issueA_fuse0 + arcv_rhx100_issueA_fuse1 + arcv_rhx100_ALU_A_fuse0_early + arcv_rhx100_ALU_A_fuse1_early + arcv_rhx100_MPY32), nothing*3")

(define_insn_reservation "arcv_rhx100_alu_fused" 1
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "alu_fused"))
"(arcv_rhx100_issueA_fuse0 + arcv_rhx100_issueA_fuse1 + arcv_rhx100_ALU_A_fuse0_early + arcv_rhx100_ALU_A_fuse1_early) | (arcv_rhx100_issueB_fuse0 + arcv_rhx100_issueB_fuse1 + arcv_rhx100_ALU_B_fuse0_early + arcv_rhx100_ALU_B_fuse1_early)")

(define_insn_reservation "arcv_rhx100_jmp_insn" 1
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "branch,jump,call,jalr,ret,trap"))
"arcv_rhx100_issueA_fuse0 | arcv_rhx100_issueA_fuse1")

(define_insn_reservation "arcv_rhx100_div_insn" 12
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "idiv"))
"arcv_rhx100_issueA_fuse0 + arcv_rhx100_DIV, nothing*11")

(define_insn_reservation "arcv_rhx100_mpy32_insn" 4
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "imul"))
"arcv_rhx100_issueA_fuse0 + arcv_rhx100_MPY32, nothing*3")

(define_insn_reservation "arcv_rhx100_load_insn" 3
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "load,fpload"))
"(arcv_rhx100_issueB_fuse0 + arcv_rhx100_DMP_fuse0) | (arcv_rhx100_issueB_fuse1 + arcv_rhx100_DMP_fuse1)")

(define_insn_reservation "arcv_rhx100_store_insn" 1
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "store,fpstore"))
"(arcv_rhx100_issueB_fuse0 + arcv_rhx100_DMP_fuse0) | (arcv_rhx100_issueB_fuse1 + arcv_rhx100_DMP_fuse1)")

;; (soft) floating points
(define_insn_reservation "arcv_rhx100_xfer" 3
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "mfc,mtc,fcvt,fcvt_i2f,fcvt_f2i,fmove,fcmp"))
"(arcv_rhx100_ALU_A_fuse0_early | arcv_rhx100_ALU_B_fuse0_early), nothing*2")

(define_insn_reservation "arcv_rhx100_fmul" 5
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "fadd,fmul,fmadd"))
"(arcv_rhx100_ALU_A_fuse0_early | arcv_rhx100_ALU_B_fuse0_early)")

(define_insn_reservation "arcv_rhx100_fdiv" 20
(and (eq_attr "tune" "arcv_rhx100")
(eq_attr "type" "fdiv,fsqrt"))
"arcv_rhx100_fdivsqrt*20")

;(final_presence_set "arcv_rhx100_issueA_fuse1" "arcv_rhx100_issueA_fuse0")
;(final_presence_set "arcv_rhx100_issueB_fuse1" "arcv_rhx100_issueB_fuse0")
;(final_presence_set "arcv_rhx100_ALU_A_fuse1_early" "arcv_rhx100_ALU_A_fuse0_early")
;(final_presence_set "arcv_rhx100_ALU_B_fuse1_early" "arcv_rhx100_ALU_B_fuse0_early")

;; Bypasses
;(define_bypass 0 "arcv_rhx100_alu_early_arith" "arcv_rhx100_store_insn" "riscv_store_data_bypass_p")
(define_bypass 1 "arcv_rhx100_alu_early_arith" "arcv_rhx100_store_insn" "riscv_store_data_bypass_p")

;(define_bypass 0 "arcv_rhx100_load_insn" "arcv_rhx100_store_insn" "riscv_store_data_bypass_p")
(define_bypass 1 "arcv_rhx100_load_insn" "arcv_rhx100_store_insn" "riscv_store_data_bypass_p")
(define_bypass 1 "arcv_rhx100_load_insn" "arcv_rhx100_alu_early_arith")
(define_bypass 1 "arcv_rhx100_load_insn" "arcv_rhx100_mpy*_insn")
(define_bypass 2 "arcv_rhx100_load_insn" "arcv_rhx100_load_insn")
(define_bypass 1 "arcv_rhx100_load_insn" "arcv_rhx100_div_insn")

(define_bypass 3 "arcv_rhx100_mpy32_insn" "arcv_rhx100_mpy*_insn")
(define_bypass 3 "arcv_rhx100_mpy32_insn" "arcv_rhx100_div_insn")
2 changes: 2 additions & 0 deletions gcc/config/riscv/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@
(zero_extract "srliw")])
(define_code_attr extract_shift [(sign_extract "ashiftrt")
(zero_extract "lshiftrt")])
(define_code_attr is_zero_extract [(sign_extract "false")
(zero_extract "true")])

;; This code iterator allows the two right shift instructions to be
;; generated from the same template.
Expand Down
3 changes: 3 additions & 0 deletions gcc/config/riscv/riscv-c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile)
builtin_define_with_int_value ("__riscv_th_v_intrinsic",
riscv_ext_version_value (0, 11));

if (riscv_is_micro_arch (arcv_rhx100))
builtin_define ("__riscv_rhx");

/* Define architecture extension test macros. */
builtin_define_with_int_value ("__riscv_arch_test", 1);

Expand Down
1 change: 1 addition & 0 deletions gcc/config/riscv/riscv-cores.def
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ RISCV_TUNE("xt-c920v2", generic, generic_ooo_tune_info)
RISCV_TUNE("xiangshan-nanhu", xiangshan, xiangshan_nanhu_tune_info)
RISCV_TUNE("xiangshan-kunminghu", xiangshan, generic_ooo_tune_info)
RISCV_TUNE("arc-v-rmx-100-series", arcv_rmx100, arcv_rmx100_tune_info)
RISCV_TUNE("arc-v-rhx-100-series", arcv_rhx100, arcv_rhx100_tune_info)
RISCV_TUNE("generic-ooo", generic_ooo, generic_ooo_tune_info)
RISCV_TUNE("size", generic, optimize_size_tune_info)
RISCV_TUNE("mips-p8700", mips_p8700, mips_p8700_tune_info)
Expand Down
1 change: 1 addition & 0 deletions gcc/config/riscv/riscv-opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum riscv_microarchitecture_type {
mips_p8700,
tt_ascalon_d8,
arcv_rmx100,
arcv_rhx100,
};
extern enum riscv_microarchitecture_type riscv_microarchitecture;

Expand Down
4 changes: 4 additions & 0 deletions gcc/config/riscv/riscv-protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,10 @@ extern unsigned int th_int_get_mask (unsigned int);
extern unsigned int th_int_get_save_adjustment (void);
extern rtx th_int_adjust_cfi_prologue (unsigned int);
extern const char *th_asm_output_opcode (FILE *asm_out_file, const char *p);

extern bool riscv_macro_fusion_p ();
extern bool riscv_is_micro_arch (enum riscv_microarchitecture_type);

#ifdef RTX_CODE
extern const char*
th_mempair_output_move (rtx[4], bool, machine_mode, RTX_CODE);
Expand Down
Loading