Skip to content

Commit a32098e

Browse files
artemiy-volkovMichielDerhaeg
authored andcommitted
arcv: introduce and incorporate the --param=arcv-mpy-option flag
This commit adds the new arcv-mpy-option compilation parameter with the valid (string) values of 1c, 2c, and 10c. This corresponds to different versions of the MPY/DIV unit of the RMX100 core, each of which has different latencies for imul/idiv instructions. Internally, this option is propagated to the pipeline description information in rmx100.md with the use of new helper functions defined in riscv.cc. Signed-off-by: Artemiy Volkov <artemiy@synopsys.com>
1 parent fa68a5b commit a32098e

File tree

5 files changed

+57
-5
lines changed

5 files changed

+57
-5
lines changed

gcc/config/riscv/arcv-rmx100.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@
6767
(eq_attr "type" "fadd,fmul,fmadd,fcmp"))
6868
"arcv_rmx100_FPU*2")
6969

70-
(define_insn_reservation "arcv_rmx100_fdiv_insn" 17
71-
(and (eq_attr "tune" "arcv_rmx100")
72-
(eq_attr "type" "fdiv,fsqrt"))
73-
"arcv_rmx100_FPU*17")
74-
7570
(define_insn_reservation "arcv_rmx100_xfer" 2
7671
(and (eq_attr "tune" "arcv_rmx100")
7772
(eq_attr "type" "fmove,mtc,mfc,fcvt,fcvt_f2i,fcvt_i2f"))
@@ -108,3 +103,9 @@
108103
(and (eq_attr "tune" "arcv_rmx100")
109104
(eq_attr "type" "fsqrt"))
110105
"arcv_rmx100_FPU*25")
106+
107+
(define_bypass 1 "arcv_rmx100_mpy32_insn" "arcv_rmx100_*" "arcv_mpy_1c_bypass_p")
108+
(define_bypass 2 "arcv_rmx100_mpy32_insn" "arcv_rmx100_*" "arcv_mpy_2c_bypass_p")
109+
110+
(define_bypass 9 "arcv_rmx100_div_insn" "arcv_rmx100_*" "arcv_mpy_1c_bypass_p")
111+
(define_bypass 9 "arcv_rmx100_div_insn" "arcv_rmx100_*" "arcv_mpy_2c_bypass_p")

gcc/config/riscv/riscv-opts.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ enum rvv_max_lmul_enum {
8686
RVV_DYNAMIC = 9
8787
};
8888

89+
/* ARC-V multiply option. */
90+
enum arcv_mpy_option_enum {
91+
ARCV_MPY_OPTION_1C = 1,
92+
ARCV_MPY_OPTION_2C = 2,
93+
ARCV_MPY_OPTION_10C = 8,
94+
};
95+
8996
enum riscv_multilib_select_kind {
9097
/* Select multilib by builtin way. */
9198
select_by_builtin,

gcc/config/riscv/riscv-protos.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ extern bool riscv_epilogue_uses (unsigned int);
165165
extern bool riscv_can_use_return_insn (void);
166166
extern rtx riscv_function_value (const_tree, const_tree, enum machine_mode);
167167
extern bool riscv_store_data_bypass_p (rtx_insn *, rtx_insn *);
168+
extern bool arcv_mpy_1c_bypass_p (rtx_insn *, rtx_insn *);
169+
extern bool arcv_mpy_2c_bypass_p (rtx_insn *, rtx_insn *);
170+
extern bool arcv_mpy_10c_bypass_p (rtx_insn *, rtx_insn *);
168171
extern rtx riscv_gen_gpr_save_insn (struct riscv_frame_info *);
169172
extern bool riscv_gpr_save_operation_p (rtx);
170173
extern void riscv_reinit (void);

gcc/config/riscv/riscv.cc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10490,6 +10490,30 @@ riscv_store_data_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn)
1049010490
return store_data_bypass_p (out_insn, in_insn);
1049110491
}
1049210492

10493+
/* Implement one boolean function for each of the values of the
10494+
arcv_mpy_option enum, for the needs of rhx100.md. */
10495+
10496+
bool
10497+
arcv_mpy_1c_bypass_p (rtx_insn *out_insn ATTRIBUTE_UNUSED,
10498+
rtx_insn *in_insn ATTRIBUTE_UNUSED)
10499+
{
10500+
return arcv_mpy_option == ARCV_MPY_OPTION_1C;
10501+
}
10502+
10503+
bool
10504+
arcv_mpy_2c_bypass_p (rtx_insn *out_insn ATTRIBUTE_UNUSED,
10505+
rtx_insn *in_insn ATTRIBUTE_UNUSED)
10506+
{
10507+
return arcv_mpy_option == ARCV_MPY_OPTION_2C;
10508+
}
10509+
10510+
bool
10511+
arcv_mpy_10c_bypass_p (rtx_insn *out_insn ATTRIBUTE_UNUSED,
10512+
rtx_insn *in_insn ATTRIBUTE_UNUSED)
10513+
{
10514+
return arcv_mpy_option == ARCV_MPY_OPTION_10C;
10515+
}
10516+
1049310517
/* Implement TARGET_SECONDARY_MEMORY_NEEDED.
1049410518

1049510519
When floating-point registers are wider than integer ones, moves between

gcc/config/riscv/riscv.opt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,20 @@ Specifies whether the fence.tso instruction should be used.
396396
mautovec-segment
397397
Target Integer Var(riscv_mautovec_segment) Init(1)
398398
Enable (default) or disable generation of vector segment load/store instructions.
399+
400+
Enum
401+
Name(arcv_mpy_option) Type(enum arcv_mpy_option_enum)
402+
Valid arguments to -param=arcv_mpy_option=:
403+
404+
EnumValue
405+
Enum(arcv_mpy_option) String(1c) Value(ARCV_MPY_OPTION_1C)
406+
407+
EnumValue
408+
Enum(arcv_mpy_option) String(2c) Value(ARCV_MPY_OPTION_2C)
409+
410+
EnumValue
411+
Enum(arcv_mpy_option) String(10c) Value(ARCV_MPY_OPTION_10C)
412+
413+
-param=arcv-mpy-option=
414+
Target RejectNegative Joined Enum(arcv_mpy_option) Var(arcv_mpy_option) Init(ARCV_MPY_OPTION_2C)
415+
The type of MPY unit used by the RMX-100 core (to be used in combination with -mtune=rmx100) (default: 2c).

0 commit comments

Comments
 (0)