-
Notifications
You must be signed in to change notification settings - Fork 15
Upstream ARC-V RMX-100 #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MichielDerhaeg
wants to merge
3
commits into
trunk
Choose a base branch
from
michiel/upstream_rmx100
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| ;; DFA scheduling description of the Synopsys RMX-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_rmx100") | ||
|
|
||
| (define_cpu_unit "arcv_rmx100_ALU" "arcv_rmx100") | ||
| ;(define_cpu_unit "arcv_rmx100_CSR" "arcv_rmx100") | ||
| (define_cpu_unit "arcv_rmx100_FPU" "arcv_rmx100") | ||
| (define_cpu_unit "arcv_rmx100_MPY" "arcv_rmx100") | ||
| (define_cpu_unit "arcv_rmx100_DIV" "arcv_rmx100") | ||
| (define_cpu_unit "arcv_rmx100_DMP" "arcv_rmx100") | ||
|
|
||
| ;; Instruction reservation for arithmetic instructions. | ||
| (define_insn_reservation "arcv_rmx100_alu_arith" 1 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "unknown, const, arith, shift, slt, multi, auipc, nop, | ||
| logical, move, atomic, mvpair, bitmanip, clz, ctz, cpop, | ||
| zicond, condmove, clmul, min, max, minu, maxu, rotate")) | ||
| "arcv_rmx100_ALU") | ||
|
|
||
| (define_insn_reservation "arcv_rmx100_jmp_insn" 1 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "branch, jump, call, jalr, ret, trap")) | ||
| "arcv_rmx100_ALU") | ||
|
|
||
| ; DIV insn: latency may be overridden by a define_bypass | ||
| (define_insn_reservation "arcv_rmx100_div_insn" 35 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "idiv")) | ||
| "arcv_rmx100_DIV*35") | ||
|
|
||
| ; MPY insn: latency may be overridden by a define_bypass | ||
| (define_insn_reservation "arcv_rmx100_mpy32_insn" 9 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "imul")) | ||
| "arcv_rmx100_MPY") | ||
|
|
||
| (define_insn_reservation "arcv_rmx100_load_insn" 3 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "load")) | ||
| "arcv_rmx100_DMP,nothing*2") | ||
|
|
||
| (define_insn_reservation "arcv_rmx100_store_insn" 1 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "store,fpstore")) | ||
| "arcv_rmx100_DMP") | ||
|
|
||
| ;; FPU scheduling. FIXME: This is based on the "fast" unit for now, the "slow" | ||
| ;; option remains to be implemented later (together with the -mfpu flag). | ||
|
|
||
| (define_insn_reservation "arcv_rmx100_fpload_insn" 3 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "fpload")) | ||
| "arcv_rmx100_DMP,nothing*2") | ||
|
|
||
| (define_insn_reservation "arcv_rmx100_farith_insn" 2 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "fadd,fcmp")) | ||
| "arcv_rmx100_FPU,nothing") | ||
|
|
||
| (define_insn_reservation "arcv_rmx100_xfer" 1 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "fmove,mtc,mfc,fcvt,fcvt_f2i,fcvt_i2f")) | ||
| "arcv_rmx100_FPU") | ||
|
|
||
| (define_insn_reservation "arcv_rmx100_fmul_insn" 2 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "fmul")) | ||
| "arcv_rmx100_FPU,nothing") | ||
|
|
||
| (define_insn_reservation "arcv_rmx100_fmac_insn" 2 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "fmadd")) | ||
| "arcv_rmx100_FPU,nothing") | ||
|
|
||
| (define_insn_reservation "arcv_rmx100_fdiv_insn" 10 | ||
| (and (eq_attr "tune" "arcv_rmx100") | ||
| (eq_attr "type" "fdiv,fsqrt")) | ||
| "arcv_rmx100_FPU") | ||
|
|
||
|
|
||
| (define_bypass 1 "arcv_rmx100_mpy32_insn" "arcv_rmx100_*" "arcv_mpy_1c_bypass_p") | ||
| (define_bypass 2 "arcv_rmx100_mpy32_insn" "arcv_rmx100_*" "arcv_mpy_2c_bypass_p") | ||
|
|
||
| (define_bypass 9 "arcv_rmx100_div_insn" "arcv_rmx100_*" "arcv_mpy_1c_bypass_p") | ||
| (define_bypass 9 "arcv_rmx100_div_insn" "arcv_rmx100_*" "arcv_mpy_2c_bypass_p") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -685,6 +685,30 @@ static const struct riscv_tune_param tt_ascalon_d8_tune_info = { | |
| true, /* prefer-agnostic. */ | ||
| }; | ||
|
|
||
| /* Costs to use when optimizing for Synopsys RMX-100. */ | ||
| static const struct riscv_tune_param arcv_rmx100_tune_info = { | ||
| {COSTS_N_INSNS (2), COSTS_N_INSNS (2)}, /* fp_add */ | ||
| {COSTS_N_INSNS (2), COSTS_N_INSNS (2)}, /* fp_mul */ | ||
| {COSTS_N_INSNS (17), COSTS_N_INSNS (17)}, /* fp_div */ | ||
| {COSTS_N_INSNS (2), COSTS_N_INSNS (2)}, /* int_mul */ | ||
| {COSTS_N_INSNS (17), COSTS_N_INSNS (17)}, /* int_div */ | ||
| 1, /* issue_rate */ | ||
| 4, /* branch_cost */ | ||
| 2, /* memory_cost */ | ||
| 4, /* fmv_cost */ | ||
| false, /* slow_unaligned_access */ | ||
| false, /* vector_unaligned_access */ | ||
| false, /* use_divmod_expansion */ | ||
| false, /* overlap_op_by_pieces */ | ||
| true, /* use_zero_stride_load */ | ||
| false, /* speculative_sched_vsetvl */ | ||
| RISCV_FUSE_NOTHING, /* fusible_ops */ | ||
| NULL, /* vector cost */ | ||
| NULL, /* function_align */ | ||
| NULL, /* jump_align */ | ||
| NULL, /* loop_align */ | ||
| }; | ||
|
|
||
| /* Costs to use when optimizing for size. */ | ||
| static const struct riscv_tune_param optimize_size_tune_info = { | ||
| {COSTS_N_INSNS (1), COSTS_N_INSNS (1)}, /* fp_add */ | ||
|
|
@@ -10466,6 +10490,30 @@ riscv_store_data_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn) | |
| return store_data_bypass_p (out_insn, in_insn); | ||
| } | ||
|
|
||
| /* Implement one boolean function for each of the values of the | ||
| arcv_mpy_option enum, for the needs of rhx100.md. */ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FIXME |
||
|
|
||
| bool | ||
| arcv_mpy_1c_bypass_p (rtx_insn *out_insn ATTRIBUTE_UNUSED, | ||
| rtx_insn *in_insn ATTRIBUTE_UNUSED) | ||
| { | ||
| return arcv_mpy_option == ARCV_MPY_OPTION_1C; | ||
| } | ||
|
|
||
| bool | ||
| arcv_mpy_2c_bypass_p (rtx_insn *out_insn ATTRIBUTE_UNUSED, | ||
| rtx_insn *in_insn ATTRIBUTE_UNUSED) | ||
| { | ||
| return arcv_mpy_option == ARCV_MPY_OPTION_2C; | ||
| } | ||
|
|
||
| bool | ||
| arcv_mpy_10c_bypass_p (rtx_insn *out_insn ATTRIBUTE_UNUSED, | ||
| rtx_insn *in_insn ATTRIBUTE_UNUSED) | ||
| { | ||
| return arcv_mpy_option == ARCV_MPY_OPTION_10C; | ||
| } | ||
|
|
||
| /* Implement TARGET_SECONDARY_MEMORY_NEEDED. | ||
|
|
||
| When floating-point registers are wider than integer ones, moves between | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -396,3 +396,20 @@ Specifies whether the fence.tso instruction should be used. | |
| mautovec-segment | ||
| Target Integer Var(riscv_mautovec_segment) Init(1) | ||
| Enable (default) or disable generation of vector segment load/store instructions. | ||
|
|
||
| Enum | ||
| Name(arcv_mpy_option) Type(enum arcv_mpy_option_enum) | ||
| Valid arguments to -param=arcv_mpy_option=: | ||
|
|
||
| EnumValue | ||
| Enum(arcv_mpy_option) String(1c) Value(ARCV_MPY_OPTION_1C) | ||
|
|
||
| EnumValue | ||
| Enum(arcv_mpy_option) String(2c) Value(ARCV_MPY_OPTION_2C) | ||
|
|
||
| EnumValue | ||
| Enum(arcv_mpy_option) String(10c) Value(ARCV_MPY_OPTION_10C) | ||
|
|
||
| -param=arcv-mpy-option= | ||
| Target RejectNegative Joined Enum(arcv_mpy_option) Var(arcv_mpy_option) Init(ARCV_MPY_OPTION_2C) | ||
| The type of MPY unit used by the RMX-100 core (to be used in combination with -mtune=rmx100) (default: 2c). | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FIXME |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME