Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
Yes. I aggree with you that we should wait until all theadvector are acccepted. Thanks. juzhe.zh...@rivai.ai From: Jeff Law Date: 2024-01-10 01:49 To: 钟居哲; cooper.joshua; gcc-patches CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Christoph Müllner; jinma; Cooper Qu Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. On 1/8/24 16:04, 钟居哲 wrote: > This patch looks ok from myside. Likewise. So I think the only question for this specific patch is whether or not it makes sense to include it now or wait for more of the thead bits to get to acceptance. I tend to think it should wait since I don't think it has any value without the rest of the thead vector changes and it's not 100% clear if those changes are going to make it into gcc-14 or not. Jeff
Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
On 1/8/24 16:04, 钟居哲 wrote: This patch looks ok from myside. Likewise. So I think the only question for this specific patch is whether or not it makes sense to include it now or wait for more of the thead bits to get to acceptance. I tend to think it should wait since I don't think it has any value without the rest of the thead vector changes and it's not 100% clear if those changes are going to make it into gcc-14 or not. Jeff
Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
This patch looks ok from myside. juzhe.zh...@rivai.ai From: Jun Sha (Joshua) Date: 2024-01-03 14:08 To: gcc-patches CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; jeffreyalaw; christoph.muellner; juzhe.zhong; Jun Sha (Joshua); Jin Ma; Xianmiao Qu Subject: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. This patch adds th. prefix to all XTheadVector instructions by implementing new assembly output functions. We only check the prefix is 'v', so that no extra attribute is needed. gcc/ChangeLog: * config/riscv/riscv-protos.h (riscv_asm_output_opcode): New function to add assembler insn code prefix/suffix. (th_asm_output_opcode): Thead function to add assembler insn code prefix/suffix. * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. * config/riscv/thead.cc (th_asm_output_opcode): Likewise gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/xtheadvector/prefix.c: New test. Co-authored-by: Jin Ma Co-authored-by: Xianmiao Qu Co-authored-by: Christoph Müllner --- gcc/config/riscv/riscv-protos.h | 2 ++ gcc/config/riscv/riscv.cc | 11 +++ gcc/config/riscv/riscv.h| 4 gcc/config/riscv/thead.cc | 13 + .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 5 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index 31049ef7523..71724dabdb5 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -102,6 +102,7 @@ struct riscv_address_info { }; /* Routines implemented in riscv.cc. */ +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const char *p); extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); extern int riscv_float_const_rtx_index_for_fli (rtx); @@ -717,6 +718,7 @@ extern void th_mempair_prepare_save_restore_operands (rtx[4], bool, int, HOST_WIDE_INT, int, HOST_WIDE_INT); extern void th_mempair_save_restore_regs (rtx[4], bool, machine_mode); +extern const char *th_asm_output_opcode (FILE *asm_out_file, const char *p); #ifdef RTX_CODE extern const char* th_mempair_output_move (rtx[4], bool, machine_mode, RTX_CODE); diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 0d1cbc5cb5f..51878797287 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -5636,6 +5636,17 @@ riscv_get_v_regno_alignment (machine_mode mode) return lmul; } +/* Define ASM_OUTPUT_OPCODE to do anything special before + emitting an opcode. */ +const char * +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) +{ + if (TARGET_XTHEADVECTOR) +return th_asm_output_opcode (asm_out_file, p); + + return p; +} + /* Implement TARGET_PRINT_OPERAND. The RISCV-specific operand codes are: 'h' Print the high-part relocation associated with OP, after stripping diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index 6df9ec73c5e..c33361a254d 100644 --- a/gcc/config/riscv/riscv.h +++ b/gcc/config/riscv/riscv.h @@ -826,6 +826,10 @@ extern enum riscv_cc get_riscv_cc (const rtx use); asm_fprintf ((FILE), "%U%s", (NAME)); \ } while (0) +#undef ASM_OUTPUT_OPCODE +#define ASM_OUTPUT_OPCODE(STREAM, PTR) \ + (PTR) = riscv_asm_output_opcode(STREAM, PTR) + #define JUMP_TABLES_IN_TEXT_SECTION 0 #define CASE_VECTOR_MODE SImode #define CASE_VECTOR_PC_RELATIVE (riscv_cmodel != CM_MEDLOW) diff --git a/gcc/config/riscv/thead.cc b/gcc/config/riscv/thead.cc index 20353995931..dc3aed3904d 100644 --- a/gcc/config/riscv/thead.cc +++ b/gcc/config/riscv/thead.cc @@ -883,6 +883,19 @@ th_output_move (rtx dest, rtx src) return NULL; } +/* Define ASM_OUTPUT_OPCODE to do anything special before + emitting an opcode. */ +const char * +th_asm_output_opcode (FILE *asm_out_file, const char *p) +{ + /* We need to add th. prefix to all the xtheadvector + instructions here.*/ + if (current_output_insn != NULL && p[0] == 'v') +fputs ("th.", asm_out_file); + + return p; +} + /* Implement TARGET_PRINT_OPERAND_ADDRESS for XTheadMemIdx. */ bool diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c new file mode 100644 index 000..eee727ef6b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gc_xtheadvector -mabi=ilp32 -O0" } */ + +#include "riscv_vector.h" + +vint32m1_t +prefix (vint32m1_t vx, vint32m1_t vy, size_t vl) +{ + return __riscv_vadd_vv_i32m1 (vx, vy, vl); +} + +/* { dg-final { scan-assembler {\mth\.v\M} } } */ -- 2.17.1
Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
I am on vacation today. I will back tomorrow or late tonight. I think we can land theadvector before spring festival as long as it is not invasive to RVV1.0 Replied Message FromjoshuaDate01/08/2024 11:17 ToKito Cheng Ccjuzhe.zh...@rivai.ai,jeffreyalaw,gcc-patches,Jim Wilson,palmer,andrew,philipp.tomsich,christoph.muellner,jinma,cooper.quSubjectRe:Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.Hi Kito, Thank you for your support. So even during stage 4, we can merge this for GCC 14? -- 发件人:Kito Cheng 发送时间:2024年1月8日(星期一) 11:06 收件人:joshua 抄 送:"juzhe.zh...@rivai.ai"; jeffreyalaw; "gcc-patches"; Jim Wilson; palmer; andrew; "philipp.tomsich"; "christoph.muellner"; jinma; "cooper.qu" 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. I am ok with merging this for GCC 14, as we discussed several times in the RISC-V GCC sync up meeting, I think at least we reach consensus among Jeff Law, Palmer Dabbelt and me. But please be careful: don't break anything for standard vector stuff. On Mon, Jan 8, 2024 at 10:11 AM joshua wrote: > > Hi Juzhe, > > Stage 3 will close today and there are still some patches that > haven't been reviewed left. > So is it possible to get xtheadvector merged in GCC-14? > We emailed Kito regarding this, but haven't got any reply yet. > > Joshua > > > > > > > -- > 发件人:juzhe.zh...@rivai.ai > 发送时间:2024年1月4日(星期四) 17:18 > 收件人:"cooper.joshua"; jeffreyalaw; "gcc-patches" > 抄 送:Jim Wilson; palmer; andrew; "philipp.tomsich"; "christoph.muellner"; jinma; "cooper.qu" > 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. > > > \ No newline at end of file > Each file needs newline. > > > I am not able to review arch stuff. This needs kito. > > > Besides, Andrew Pinski want us defer theadvector to GCC-15. > > > I have no strong opinion here. > > > juzhe.zh...@rivai.ai > > > 发件人: joshua > 发送时间: 2024-01-04 17:15 > 收件人: 钟居哲; Jeff Law; gcc-patches > 抄送: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Christoph Müllner; jinma; Cooper Qu > 主题: Re:Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. > > Hi Juzhe, > > So is the following patch that this patch relies on OK to commit? > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > Joshua > > > > > -- > 发件人:钟居哲 > 发送时间:2024年1月2日(星期二) 06:57 > 收件人:Jeff Law; "cooper.joshua"; "gcc-patches" > 抄 送:"jim.wilson.gcc"; palmer; andrew; "philipp.tomsich"; "Christoph Müllner"; jinma; Cooper Qu > 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. > > > This is Ok from my side. > But before commit this patch, I think we need this patch first: > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > > I will be back to work so I will take a look at other patches today. > juzhe.zh...@rivai.ai > > > From: Jeff Law > Date: 2024-01-01 01:43 > To: Jun Sha (Joshua); gcc-patches > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; juzhe.zhong; Jin Ma; Xianmiao Qu > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. > > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > This patch adds th. prefix to all XTheadVector instructions by > > implementing new assembly output functions. We only check the > > prefix is 'v', so that no extra attribute is needed. > > > > gcc/ChangeLog: > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > New function to add assembler insn code prefix/suffix. > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > Co-authored-by: Jin Ma > > Co-authored-by: Xianmiao Qu > > Co-authored-by: Christoph Müllner > > --- > > gcc/config/riscv/riscv-protos.h | 1 + > > gcc/config/riscv/riscv.cc | 14 ++ > > gcc/config/riscv/riscv.h | 4 > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > 4 files changed, 31 insertions(+) > > create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h > > index 31049ef7523..5ea54b45703 100644 > > --- a/gcc/config/riscv/riscv-protos.h > > +++ b/gcc/config/riscv/riscv-protos.h > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > }; > > > > /* Routines implemented in riscv.cc. */ > > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const char *p); > > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > > extern bool riscv_symbolic_constant_p (rtx, enum
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
It depends on the timing when you send out the v1 patch to the mailing list, not the timing of when to merge, but of course it's case by case, I would say no IF it's still not ready when time is the end of Feb for this kind of big patch set. On Mon, Jan 8, 2024 at 11:17 AM joshua wrote: > > Hi Kito, > > Thank you for your support. > So even during stage 4, we can merge this for GCC 14? > > > > > > -- > 发件人:Kito Cheng > 发送时间:2024年1月8日(星期一) 11:06 > 收件人:joshua > 抄 送:"juzhe.zh...@rivai.ai"; > jeffreyalaw; "gcc-patches"; > Jim Wilson; palmer; > andrew; "philipp.tomsich"; > "christoph.muellner"; > jinma; "cooper.qu" > 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > > > I am ok with merging this for GCC 14, as we discussed several times in > the RISC-V GCC sync up meeting, I think at least we reach consensus > among Jeff Law, Palmer Dabbelt and me. > > But please be careful: don't break anything for standard vector stuff. > > On Mon, Jan 8, 2024 at 10:11 AM joshua > wrote: > > > > Hi Juzhe, > > > > Stage 3 will close today and there are still some patches that > > haven't been reviewed left. > > So is it possible to get xtheadvector merged in GCC-14? > > We emailed Kito regarding this, but haven't got any reply yet. > > > > Joshua > > > > > > > > > > > > > > -- > > 发件人:juzhe.zh...@rivai.ai > > 发送时间:2024年1月4日(星期四) 17:18 > > 收件人:"cooper.joshua"; > > jeffreyalaw; "gcc-patches" > > 抄 送:Jim Wilson; palmer; > > andrew; "philipp.tomsich"; > > "christoph.muellner"; > > jinma; "cooper.qu" > > 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions > > of XTheadVector. > > > > > > \ No newline at end of file > > Each file needs newline. > > > > > > I am not able to review arch stuff. This needs kito. > > > > > > Besides, Andrew Pinski want us defer theadvector to GCC-15. > > > > > > I have no strong opinion here. > > > > > > juzhe.zh...@rivai.ai > > > > > > 发件人: joshua > > 发送时间: 2024-01-04 17:15 > > 收件人: 钟居哲; Jeff Law; gcc-patches > > 抄送: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Christoph Müllner; > > jinma; Cooper Qu > > 主题: Re:Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > > XTheadVector. > > > > Hi Juzhe, > > > > So is the following patch that this patch relies on OK to commit? > > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > > > Joshua > > > > > > > > > > -- > > 发件人:钟居哲 > > 发送时间:2024年1月2日(星期二) 06:57 > > 收件人:Jeff Law; > > "cooper.joshua"; > > "gcc-patches" > > 抄 送:"jim.wilson.gcc"; palmer; > > andrew; "philipp.tomsich"; > > "Christoph Müllner"; > > jinma; Cooper Qu > > 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions > > of XTheadVector. > > > > > > This is Ok from my side. > > But before commit this patch, I think we need this patch first: > > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > > > > > I will be back to work so I will take a look at other patches today. > > juzhe.zh...@rivai.ai > > > > > > From: Jeff Law > > Date: 2024-01-01 01:43 > > To: Jun Sha (Joshua); gcc-patches > > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; > > juzhe.zhong; Jin Ma; Xianmiao Qu > > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions > > of XTheadVector. > > > > > > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > > This patch adds th. prefix to all XTheadVector instructions by > > > implementing new assembly output functions. We only check the > > > prefix is 'v', so that no extra attribute is needed. > > > > > > gcc/ChangeLog: > > > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > > New function to add assembler insn code prefix/suffix. > > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > > > Co-authored-by: Jin Ma > > > Co-authored-by: Xianmiao Qu > > > Co-authored-by: Christoph Müllner > > > --- > > > gcc/config/riscv/riscv-protos.h| 1 + > > > gcc/config/riscv/riscv.cc | 14 ++ > > > gcc/config/riscv/riscv.h | 4 > > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > > 4 files changed, 31 insertions(+) > > > create mode 100644 > > > gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > > > diff --git a/gcc/config/riscv/riscv-protos.h > > > b/gcc/config/riscv/riscv-protos.h > > > index 31049ef7523..5ea54b45703 100644 > > > --- a/gcc/config/riscv/riscv-protos.h > > > +++ b/gcc/config/riscv/riscv-protos.h > > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > > }; > > > > > > /* Routines implemented in riscv.cc. */ > > >
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
I am ok with merging this for GCC 14, as we discussed several times in the RISC-V GCC sync up meeting, I think at least we reach consensus among Jeff Law, Palmer Dabbelt and me. But please be careful: don't break anything for standard vector stuff. On Mon, Jan 8, 2024 at 10:11 AM joshua wrote: > > Hi Juzhe, > > Stage 3 will close today and there are still some patches that > haven't been reviewed left. > So is it possible to get xtheadvector merged in GCC-14? > We emailed Kito regarding this, but haven't got any reply yet. > > Joshua > > > > > > > -- > 发件人:juzhe.zh...@rivai.ai > 发送时间:2024年1月4日(星期四) 17:18 > 收件人:"cooper.joshua"; > jeffreyalaw; "gcc-patches" > 抄 送:Jim Wilson; palmer; > andrew; "philipp.tomsich"; > "christoph.muellner"; > jinma; "cooper.qu" > 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > > > \ No newline at end of file > Each file needs newline. > > > I am not able to review arch stuff. This needs kito. > > > Besides, Andrew Pinski want us defer theadvector to GCC-15. > > > I have no strong opinion here. > > > juzhe.zh...@rivai.ai > > > 发件人: joshua > 发送时间: 2024-01-04 17:15 > 收件人: 钟居哲; Jeff Law; gcc-patches > 抄送: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Christoph Müllner; > jinma; Cooper Qu > 主题: Re:Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > > Hi Juzhe, > > So is the following patch that this patch relies on OK to commit? > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > Joshua > > > > > -- > 发件人:钟居哲 > 发送时间:2024年1月2日(星期二) 06:57 > 收件人:Jeff Law; > "cooper.joshua"; > "gcc-patches" > 抄 送:"jim.wilson.gcc"; palmer; > andrew; "philipp.tomsich"; > "Christoph Müllner"; > jinma; Cooper Qu > 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > > > This is Ok from my side. > But before commit this patch, I think we need this patch first: > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > > I will be back to work so I will take a look at other patches today. > juzhe.zh...@rivai.ai > > > From: Jeff Law > Date: 2024-01-01 01:43 > To: Jun Sha (Joshua); gcc-patches > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; > juzhe.zhong; Jin Ma; Xianmiao Qu > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > This patch adds th. prefix to all XTheadVector instructions by > > implementing new assembly output functions. We only check the > > prefix is 'v', so that no extra attribute is needed. > > > > gcc/ChangeLog: > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > New function to add assembler insn code prefix/suffix. > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > Co-authored-by: Jin Ma > > Co-authored-by: Xianmiao Qu > > Co-authored-by: Christoph Müllner > > --- > > gcc/config/riscv/riscv-protos.h| 1 + > > gcc/config/riscv/riscv.cc | 14 ++ > > gcc/config/riscv/riscv.h | 4 > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > 4 files changed, 31 insertions(+) > > create mode 100644 > > gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > diff --git a/gcc/config/riscv/riscv-protos.h > > b/gcc/config/riscv/riscv-protos.h > > index 31049ef7523..5ea54b45703 100644 > > --- a/gcc/config/riscv/riscv-protos.h > > +++ b/gcc/config/riscv/riscv-protos.h > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > }; > > > > /* Routines implemented in riscv.cc. */ > > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const char > > *p); > > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > > extern int riscv_float_const_rtx_index_for_fli (rtx); > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > > index 0d1cbc5cb5f..ea1d59d9cf2 100644 > > --- a/gcc/config/riscv/riscv.cc > > +++ b/gcc/config/riscv/riscv.cc > > @@ -5636,6 +5636,20 @@ riscv_get_v_regno_alignment (machine_mode mode) > > return lmul; > > } > > > > +/* Define ASM_OUTPUT_OPCODE to do anything special before > > + emitting an opcode. */ > > +const char * > > +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) > > +{ > > + /* We need to add th. prefix to all the xtheadvector > > + insturctions here.*/ > > + if (TARGET_XTHEADVECTOR && current_output_insn != NULL_RTX && > > + p[0] == 'v') > > +fputs ("th.", asm_out_file); > > + > > + return p; > Just a formatting nit. The GNU standards
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
On Thu, Jan 4, 2024 at 10:18 AM juzhe.zh...@rivai.ai wrote: > > \ No newline at end of file > > Each file needs newline. > > I am not able to review arch stuff. This needs kito. > > Besides, Andrew Pinski want us defer theadvector to GCC-15. Maybe I misread this (sorry if so), but I though that was answered by Kito here: https://gcc.gnu.org/pipermail/gcc-patches/2024-January/641723.html > > I have no strong opinion here. > > > juzhe.zh...@rivai.ai > > > 发件人: joshua > 发送时间: 2024-01-04 17:15 > 收件人: 钟居哲; Jeff Law; gcc-patches > 抄送: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Christoph Müllner; > jinma; Cooper Qu > 主题: Re:Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > Hi Juzhe, > > So is the following patch that this patch relies on OK to commit? > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > Joshua > > > > > -- > 发件人:钟居哲 > 发送时间:2024年1月2日(星期二) 06:57 > 收件人:Jeff Law; > "cooper.joshua"; > "gcc-patches" > 抄 送:"jim.wilson.gcc"; palmer; > andrew; "philipp.tomsich"; > "Christoph Müllner"; > jinma; Cooper Qu > 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > > > This is Ok from my side. > But before commit this patch, I think we need this patch first: > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > > I will be back to work so I will take a look at other patches today. > juzhe.zh...@rivai.ai > > > From: Jeff Law > Date: 2024-01-01 01:43 > To: Jun Sha (Joshua); gcc-patches > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; > juzhe.zhong; Jin Ma; Xianmiao Qu > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > This patch adds th. prefix to all XTheadVector instructions by > > implementing new assembly output functions. We only check the > > prefix is 'v', so that no extra attribute is needed. > > > > gcc/ChangeLog: > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > New function to add assembler insn code prefix/suffix. > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > Co-authored-by: Jin Ma > > Co-authored-by: Xianmiao Qu > > Co-authored-by: Christoph Müllner > > --- > > gcc/config/riscv/riscv-protos.h| 1 + > > gcc/config/riscv/riscv.cc | 14 ++ > > gcc/config/riscv/riscv.h | 4 > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > 4 files changed, 31 insertions(+) > > create mode 100644 > > gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > diff --git a/gcc/config/riscv/riscv-protos.h > > b/gcc/config/riscv/riscv-protos.h > > index 31049ef7523..5ea54b45703 100644 > > --- a/gcc/config/riscv/riscv-protos.h > > +++ b/gcc/config/riscv/riscv-protos.h > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > }; > > > > /* Routines implemented in riscv.cc. */ > > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const char > > *p); > > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > > extern int riscv_float_const_rtx_index_for_fli (rtx); > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > > index 0d1cbc5cb5f..ea1d59d9cf2 100644 > > --- a/gcc/config/riscv/riscv.cc > > +++ b/gcc/config/riscv/riscv.cc > > @@ -5636,6 +5636,20 @@ riscv_get_v_regno_alignment (machine_mode mode) > > return lmul; > > } > > > > +/* Define ASM_OUTPUT_OPCODE to do anything special before > > + emitting an opcode. */ > > +const char * > > +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) > > +{ > > + /* We need to add th. prefix to all the xtheadvector > > + insturctions here.*/ > > + if (TARGET_XTHEADVECTOR && current_output_insn != NULL_RTX && > > + p[0] == 'v') > > +fputs ("th.", asm_out_file); > > + > > + return p; > Just a formatting nit. The GNU standards break lines before the > operator, not after. So >if (TARGET_XTHEADVECTOR >&& current_output_insn != NULL >&& p[0] == 'v') > > Note that current_output_insn is "extern rtx_insn *", so use NULL, not > NULL_RTX. > > Neither of these nits require a new version for review. Just fix them. > > If Juzhe is fine with this, so am I. We can refine it if necessary later. > > jeff > > >
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
\ No newline at end of file Each file needs newline. I am not able to review arch stuff. This needs kito. Besides, Andrew Pinski want us defer theadvector to GCC-15. I have no strong opinion here. juzhe.zh...@rivai.ai 发件人: joshua 发送时间: 2024-01-04 17:15 收件人: 钟居哲; Jeff Law; gcc-patches 抄送: jim.wilson.gcc; palmer; andrew; philipp.tomsich; Christoph Müllner; jinma; Cooper Qu 主题: Re:Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. Hi Juzhe, So is the following patch that this patch relies on OK to commit? https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html Joshua -- 发件人:钟居哲 发送时间:2024年1月2日(星期二) 06:57 收件人:Jeff Law; "cooper.joshua"; "gcc-patches" 抄 送:"jim.wilson.gcc"; palmer; andrew; "philipp.tomsich"; "Christoph Müllner"; jinma; Cooper Qu 主 题:Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. This is Ok from my side. But before commit this patch, I think we need this patch first: https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html I will be back to work so I will take a look at other patches today. juzhe.zh...@rivai.ai From: Jeff Law Date: 2024-01-01 01:43 To: Jun Sha (Joshua); gcc-patches CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; juzhe.zhong; Jin Ma; Xianmiao Qu Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. On 12/28/23 21:19, Jun Sha (Joshua) wrote: > This patch adds th. prefix to all XTheadVector instructions by > implementing new assembly output functions. We only check the > prefix is 'v', so that no extra attribute is needed. > > gcc/ChangeLog: > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > New function to add assembler insn code prefix/suffix. > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > Co-authored-by: Jin Ma > Co-authored-by: Xianmiao Qu > Co-authored-by: Christoph Müllner > --- > gcc/config/riscv/riscv-protos.h| 1 + > gcc/config/riscv/riscv.cc | 14 ++ > gcc/config/riscv/riscv.h | 4 > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > 4 files changed, 31 insertions(+) > create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h > index 31049ef7523..5ea54b45703 100644 > --- a/gcc/config/riscv/riscv-protos.h > +++ b/gcc/config/riscv/riscv-protos.h > @@ -102,6 +102,7 @@ struct riscv_address_info { > }; > > /* Routines implemented in riscv.cc. */ > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const char > *p); > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > extern int riscv_float_const_rtx_index_for_fli (rtx); > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > index 0d1cbc5cb5f..ea1d59d9cf2 100644 > --- a/gcc/config/riscv/riscv.cc > +++ b/gcc/config/riscv/riscv.cc > @@ -5636,6 +5636,20 @@ riscv_get_v_regno_alignment (machine_mode mode) > return lmul; > } > > +/* Define ASM_OUTPUT_OPCODE to do anything special before > + emitting an opcode. */ > +const char * > +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) > +{ > + /* We need to add th. prefix to all the xtheadvector > + insturctions here.*/ > + if (TARGET_XTHEADVECTOR && current_output_insn != NULL_RTX && > + p[0] == 'v') > +fputs ("th.", asm_out_file); > + > + return p; Just a formatting nit. The GNU standards break lines before the operator, not after. So if (TARGET_XTHEADVECTOR && current_output_insn != NULL && p[0] == 'v') Note that current_output_insn is "extern rtx_insn *", so use NULL, not NULL_RTX. Neither of these nits require a new version for review. Just fix them. If Juzhe is fine with this, so am I. We can refine it if necessary later. jeff
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
Hi Andrew: That's kinda compromise and trade off on the t-head vector stuffs, we would like to accept that, but without disturbing the vector 1.0 implementation too much, t-head vector is transitional product and it will freeze/stop there forever without extending new stuffs like vector bfloat and vector crypto stuffs. So we think using ASM_OUTPUT_OPCODE is better in this case rather than adding %^ to every vector pattern for the t-head vector. On Wed, Jan 3, 2024 at 11:26 AM juzhe.zh...@rivai.ai wrote: > > No. It will need to change all patterns in vector.md. > It's a nightmare. > > You should note I will refine vector.md in GCC-15, mixing theadvector things > make me impossible to maintain > RVV1.0. > > > juzhe.zh...@rivai.ai > > > From: Andrew Pinski > Date: 2024-01-03 11:19 > To: juzhe.zh...@rivai.ai > CC: jeffreyalaw; cooper.joshua; gcc-patches; Jim Wilson; palmer; andrew; > philipp.tomsich; christoph.muellner; jinma; cooper.qu > Subject: Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the > instructions of XTheadVector. > On Tue, Jan 2, 2024 at 7:07 PM juzhe.zh...@rivai.ai > wrote: > > > > We have no choice. You should know theadvector is totally unrelated with > > RVV1.0 standard ISA. > > > > Adding `%^' which missing totally unrelated ISA makes no sens to me. > > No, it implements it in a different way. > Basically all of the patterns which are supported get changed to be > instead of "v*" becomes instead "%^v" and then you change > riscv_print_operand_punct_valid_p to allow '^' and then you add '^' > support to riscv_print_operand (like '~' is handled there). > > And the next patch adds a few more '%' to support printing different > different strings based on XTheadVector or not. > > This is how almost all other targets handle this kind of things > instead of hacking ASM_OUTPUT_OPCODE . > > Thanks, > Andrew Pinski > > > > > > > > juzhe.zh...@rivai.ai > > > > > > From: Andrew Pinski > > Date: 2024-01-03 10:54 > > To: 钟居哲 > > CC: Jeff Law; cooper.joshua; gcc-patches; jim.wilson.gcc; palmer; andrew; > > philipp.tomsich; Christoph Müllner; jinma; Cooper Qu > > Subject: Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the > > instructions of XTheadVector. > > On Mon, Jan 1, 2024 at 2:59 PM 钟居哲 wrote: > > > > > > This is Ok from my side. > > > But before commit this patch, I think we need this patch first: > > > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > > > > > I will be back to work so I will take a look at other patches today. > > > > > > Note I hate it. It would be better if you use something like `%^' (see > > `~` for an example of how that works) instead of hacking > > riscv_asm_output_opcode really. In fact that is how other targets > > implement this kind of things. > > > > Thanks, > > Andrew PInski > > > > > > > > juzhe.zh...@rivai.ai > > > > > > > > > From: Jeff Law > > > Date: 2024-01-01 01:43 > > > To: Jun Sha (Joshua); gcc-patches > > > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; > > > juzhe.zhong; Jin Ma; Xianmiao Qu > > > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the > > > instructions of XTheadVector. > > > > > > > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > > > This patch adds th. prefix to all XTheadVector instructions by > > > > implementing new assembly output functions. We only check the > > > > prefix is 'v', so that no extra attribute is needed. > > > > > > > > gcc/ChangeLog: > > > > > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > > > New function to add assembler insn code prefix/suffix. > > > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > > > > > Co-authored-by: Jin Ma > > > > Co-authored-by: Xianmiao Qu > > > > Co-authored-by: Christoph Müllner > > > > --- > > > > gcc/config/riscv/riscv-protos.h| 1 + > > > > gcc/config/riscv/riscv.cc | 14 ++ > > > > gcc/config/riscv/riscv.h | 4 > > > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > > > 4 files changed, 31 insertions(+) > > > > create mode 100644 > > > > gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > > > > > diff --git a/gcc/config/riscv/riscv-protos.h > > > > b/gcc/config/riscv/riscv-protos.h > > > > index 31049ef7523..5ea54b45703 100644 > > > > --- a/gcc/config/riscv/riscv-protos.h > > > > +++ b/gcc/config/riscv/riscv-protos.h > > > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > > > }; > > > > > > > > /* Routines implemented in riscv.cc. */ > > > > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const > > > > char *p); > > > > extern enum riscv_symbol_type riscv_classify_symbolic_expression > > > > (rtx); > > > > extern bool
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
On Tue, Jan 2, 2024 at 7:26 PM juzhe.zh...@rivai.ai wrote: > > No. It will need to change all patterns in vector.md. > It's a nightmare. > > You should note I will refine vector.md in GCC-15, mixing theadvector things > make me impossible to maintain > RVV1.0. Then we should not support theadvector if things are getting this messy. Both ways are hacks really. Either way we need a better way of implementing this. Hacking theadvector support using rewriting is wrong and not maintainable either. I suspect we should wait on supporting theadvector until GCC 15 anyways. Thanks, Andrew Pinski > > > juzhe.zh...@rivai.ai > > > From: Andrew Pinski > Date: 2024-01-03 11:19 > To: juzhe.zh...@rivai.ai > CC: jeffreyalaw; cooper.joshua; gcc-patches; Jim Wilson; palmer; andrew; > philipp.tomsich; christoph.muellner; jinma; cooper.qu > Subject: Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the > instructions of XTheadVector. > On Tue, Jan 2, 2024 at 7:07 PM juzhe.zh...@rivai.ai > wrote: > > > > We have no choice. You should know theadvector is totally unrelated with > > RVV1.0 standard ISA. > > > > Adding `%^' which missing totally unrelated ISA makes no sens to me. > > No, it implements it in a different way. > Basically all of the patterns which are supported get changed to be > instead of "v*" becomes instead "%^v" and then you change > riscv_print_operand_punct_valid_p to allow '^' and then you add '^' > support to riscv_print_operand (like '~' is handled there). > > And the next patch adds a few more '%' to support printing different > different strings based on XTheadVector or not. > > This is how almost all other targets handle this kind of things > instead of hacking ASM_OUTPUT_OPCODE . > > Thanks, > Andrew Pinski > > > > > > > > juzhe.zh...@rivai.ai > > > > > > From: Andrew Pinski > > Date: 2024-01-03 10:54 > > To: 钟居哲 > > CC: Jeff Law; cooper.joshua; gcc-patches; jim.wilson.gcc; palmer; andrew; > > philipp.tomsich; Christoph Müllner; jinma; Cooper Qu > > Subject: Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the > > instructions of XTheadVector. > > On Mon, Jan 1, 2024 at 2:59 PM 钟居哲 wrote: > > > > > > This is Ok from my side. > > > But before commit this patch, I think we need this patch first: > > > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > > > > > I will be back to work so I will take a look at other patches today. > > > > > > Note I hate it. It would be better if you use something like `%^' (see > > `~` for an example of how that works) instead of hacking > > riscv_asm_output_opcode really. In fact that is how other targets > > implement this kind of things. > > > > Thanks, > > Andrew PInski > > > > > > > > juzhe.zh...@rivai.ai > > > > > > > > > From: Jeff Law > > > Date: 2024-01-01 01:43 > > > To: Jun Sha (Joshua); gcc-patches > > > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; > > > juzhe.zhong; Jin Ma; Xianmiao Qu > > > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the > > > instructions of XTheadVector. > > > > > > > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > > > This patch adds th. prefix to all XTheadVector instructions by > > > > implementing new assembly output functions. We only check the > > > > prefix is 'v', so that no extra attribute is needed. > > > > > > > > gcc/ChangeLog: > > > > > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > > > New function to add assembler insn code prefix/suffix. > > > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > > > > > Co-authored-by: Jin Ma > > > > Co-authored-by: Xianmiao Qu > > > > Co-authored-by: Christoph Müllner > > > > --- > > > > gcc/config/riscv/riscv-protos.h| 1 + > > > > gcc/config/riscv/riscv.cc | 14 ++ > > > > gcc/config/riscv/riscv.h | 4 > > > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > > > 4 files changed, 31 insertions(+) > > > > create mode 100644 > > > > gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > > > > > diff --git a/gcc/config/riscv/riscv-protos.h > > > > b/gcc/config/riscv/riscv-protos.h > > > > index 31049ef7523..5ea54b45703 100644 > > > > --- a/gcc/config/riscv/riscv-protos.h > > > > +++ b/gcc/config/riscv/riscv-protos.h > > > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > > > }; > > > > > > > > /* Routines implemented in riscv.cc. */ > > > > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const > > > > char *p); > > > > extern enum riscv_symbol_type riscv_classify_symbolic_expression > > > > (rtx); > > > > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > > > > extern int riscv_float_const_rtx_index_for_fli (rtx); > > > >
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
No. It will need to change all patterns in vector.md. It's a nightmare. You should note I will refine vector.md in GCC-15, mixing theadvector things make me impossible to maintain RVV1.0. juzhe.zh...@rivai.ai From: Andrew Pinski Date: 2024-01-03 11:19 To: juzhe.zh...@rivai.ai CC: jeffreyalaw; cooper.joshua; gcc-patches; Jim Wilson; palmer; andrew; philipp.tomsich; christoph.muellner; jinma; cooper.qu Subject: Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. On Tue, Jan 2, 2024 at 7:07 PM juzhe.zh...@rivai.ai wrote: > > We have no choice. You should know theadvector is totally unrelated with > RVV1.0 standard ISA. > > Adding `%^' which missing totally unrelated ISA makes no sens to me. No, it implements it in a different way. Basically all of the patterns which are supported get changed to be instead of "v*" becomes instead "%^v" and then you change riscv_print_operand_punct_valid_p to allow '^' and then you add '^' support to riscv_print_operand (like '~' is handled there). And the next patch adds a few more '%' to support printing different different strings based on XTheadVector or not. This is how almost all other targets handle this kind of things instead of hacking ASM_OUTPUT_OPCODE . Thanks, Andrew Pinski > > > juzhe.zh...@rivai.ai > > > From: Andrew Pinski > Date: 2024-01-03 10:54 > To: 钟居哲 > CC: Jeff Law; cooper.joshua; gcc-patches; jim.wilson.gcc; palmer; andrew; > philipp.tomsich; Christoph Müllner; jinma; Cooper Qu > Subject: Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the > instructions of XTheadVector. > On Mon, Jan 1, 2024 at 2:59 PM 钟居哲 wrote: > > > > This is Ok from my side. > > But before commit this patch, I think we need this patch first: > > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > > > I will be back to work so I will take a look at other patches today. > > > Note I hate it. It would be better if you use something like `%^' (see > `~` for an example of how that works) instead of hacking > riscv_asm_output_opcode really. In fact that is how other targets > implement this kind of things. > > Thanks, > Andrew PInski > > > > > juzhe.zh...@rivai.ai > > > > > > From: Jeff Law > > Date: 2024-01-01 01:43 > > To: Jun Sha (Joshua); gcc-patches > > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; > > juzhe.zhong; Jin Ma; Xianmiao Qu > > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions > > of XTheadVector. > > > > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > > This patch adds th. prefix to all XTheadVector instructions by > > > implementing new assembly output functions. We only check the > > > prefix is 'v', so that no extra attribute is needed. > > > > > > gcc/ChangeLog: > > > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > > New function to add assembler insn code prefix/suffix. > > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > > > Co-authored-by: Jin Ma > > > Co-authored-by: Xianmiao Qu > > > Co-authored-by: Christoph Müllner > > > --- > > > gcc/config/riscv/riscv-protos.h| 1 + > > > gcc/config/riscv/riscv.cc | 14 ++ > > > gcc/config/riscv/riscv.h | 4 > > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > > 4 files changed, 31 insertions(+) > > > create mode 100644 > > > gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > > > diff --git a/gcc/config/riscv/riscv-protos.h > > > b/gcc/config/riscv/riscv-protos.h > > > index 31049ef7523..5ea54b45703 100644 > > > --- a/gcc/config/riscv/riscv-protos.h > > > +++ b/gcc/config/riscv/riscv-protos.h > > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > > }; > > > > > > /* Routines implemented in riscv.cc. */ > > > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const > > > char *p); > > > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > > > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > > > extern int riscv_float_const_rtx_index_for_fli (rtx); > > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > > > index 0d1cbc5cb5f..ea1d59d9cf2 100644 > > > --- a/gcc/config/riscv/riscv.cc > > > +++ b/gcc/config/riscv/riscv.cc > > > @@ -5636,6 +5636,20 @@ riscv_get_v_regno_alignment (machine_mode mode) > > > return lmul; > > > } > > > > > > +/* Define ASM_OUTPUT_OPCODE to do anything special before > > > + emitting an opcode. */ > > > +const char * > > > +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) > > > +{ > > > + /* We need to add th. prefix to all the xtheadvector > > > + insturctions here.*/ > > > + if (TARGET_XTHEADVECTOR && current_output_insn != NULL_RTX && > >
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
On Tue, Jan 2, 2024 at 7:07 PM juzhe.zh...@rivai.ai wrote: > > We have no choice. You should know theadvector is totally unrelated with > RVV1.0 standard ISA. > > Adding `%^' which missing totally unrelated ISA makes no sens to me. No, it implements it in a different way. Basically all of the patterns which are supported get changed to be instead of "v*" becomes instead "%^v" and then you change riscv_print_operand_punct_valid_p to allow '^' and then you add '^' support to riscv_print_operand (like '~' is handled there). And the next patch adds a few more '%' to support printing different different strings based on XTheadVector or not. This is how almost all other targets handle this kind of things instead of hacking ASM_OUTPUT_OPCODE . Thanks, Andrew Pinski > > > juzhe.zh...@rivai.ai > > > From: Andrew Pinski > Date: 2024-01-03 10:54 > To: 钟居哲 > CC: Jeff Law; cooper.joshua; gcc-patches; jim.wilson.gcc; palmer; andrew; > philipp.tomsich; Christoph Müllner; jinma; Cooper Qu > Subject: Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the > instructions of XTheadVector. > On Mon, Jan 1, 2024 at 2:59 PM 钟居哲 wrote: > > > > This is Ok from my side. > > But before commit this patch, I think we need this patch first: > > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > > > I will be back to work so I will take a look at other patches today. > > > Note I hate it. It would be better if you use something like `%^' (see > `~` for an example of how that works) instead of hacking > riscv_asm_output_opcode really. In fact that is how other targets > implement this kind of things. > > Thanks, > Andrew PInski > > > > > juzhe.zh...@rivai.ai > > > > > > From: Jeff Law > > Date: 2024-01-01 01:43 > > To: Jun Sha (Joshua); gcc-patches > > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; > > juzhe.zhong; Jin Ma; Xianmiao Qu > > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions > > of XTheadVector. > > > > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > > This patch adds th. prefix to all XTheadVector instructions by > > > implementing new assembly output functions. We only check the > > > prefix is 'v', so that no extra attribute is needed. > > > > > > gcc/ChangeLog: > > > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > > New function to add assembler insn code prefix/suffix. > > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > > > Co-authored-by: Jin Ma > > > Co-authored-by: Xianmiao Qu > > > Co-authored-by: Christoph Müllner > > > --- > > > gcc/config/riscv/riscv-protos.h| 1 + > > > gcc/config/riscv/riscv.cc | 14 ++ > > > gcc/config/riscv/riscv.h | 4 > > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > > 4 files changed, 31 insertions(+) > > > create mode 100644 > > > gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > > > diff --git a/gcc/config/riscv/riscv-protos.h > > > b/gcc/config/riscv/riscv-protos.h > > > index 31049ef7523..5ea54b45703 100644 > > > --- a/gcc/config/riscv/riscv-protos.h > > > +++ b/gcc/config/riscv/riscv-protos.h > > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > > }; > > > > > > /* Routines implemented in riscv.cc. */ > > > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const > > > char *p); > > > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > > > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > > > extern int riscv_float_const_rtx_index_for_fli (rtx); > > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > > > index 0d1cbc5cb5f..ea1d59d9cf2 100644 > > > --- a/gcc/config/riscv/riscv.cc > > > +++ b/gcc/config/riscv/riscv.cc > > > @@ -5636,6 +5636,20 @@ riscv_get_v_regno_alignment (machine_mode mode) > > > return lmul; > > > } > > > > > > +/* Define ASM_OUTPUT_OPCODE to do anything special before > > > + emitting an opcode. */ > > > +const char * > > > +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) > > > +{ > > > + /* We need to add th. prefix to all the xtheadvector > > > + insturctions here.*/ > > > + if (TARGET_XTHEADVECTOR && current_output_insn != NULL_RTX && > > > + p[0] == 'v') > > > +fputs ("th.", asm_out_file); > > > + > > > + return p; > > Just a formatting nit. The GNU standards break lines before the > > operator, not after. So > >if (TARGET_XTHEADVECTOR > >&& current_output_insn != NULL > >&& p[0] == 'v') > > > > Note that current_output_insn is "extern rtx_insn *", so use NULL, not > > NULL_RTX. > > > > Neither of these nits require a new version for review. Just fix them. > > > > If Juzhe is fine with this, so am I. We can
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
We have no choice. You should know theadvector is totally unrelated with RVV1.0 standard ISA. Adding `%^' which missing totally unrelated ISA makes no sens to me. juzhe.zh...@rivai.ai From: Andrew Pinski Date: 2024-01-03 10:54 To: 钟居哲 CC: Jeff Law; cooper.joshua; gcc-patches; jim.wilson.gcc; palmer; andrew; philipp.tomsich; Christoph Müllner; jinma; Cooper Qu Subject: Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. On Mon, Jan 1, 2024 at 2:59 PM 钟居哲 wrote: > > This is Ok from my side. > But before commit this patch, I think we need this patch first: > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > I will be back to work so I will take a look at other patches today. Note I hate it. It would be better if you use something like `%^' (see `~` for an example of how that works) instead of hacking riscv_asm_output_opcode really. In fact that is how other targets implement this kind of things. Thanks, Andrew PInski > > juzhe.zh...@rivai.ai > > > From: Jeff Law > Date: 2024-01-01 01:43 > To: Jun Sha (Joshua); gcc-patches > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; > juzhe.zhong; Jin Ma; Xianmiao Qu > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > This patch adds th. prefix to all XTheadVector instructions by > > implementing new assembly output functions. We only check the > > prefix is 'v', so that no extra attribute is needed. > > > > gcc/ChangeLog: > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > New function to add assembler insn code prefix/suffix. > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > Co-authored-by: Jin Ma > > Co-authored-by: Xianmiao Qu > > Co-authored-by: Christoph Müllner > > --- > > gcc/config/riscv/riscv-protos.h| 1 + > > gcc/config/riscv/riscv.cc | 14 ++ > > gcc/config/riscv/riscv.h | 4 > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > 4 files changed, 31 insertions(+) > > create mode 100644 > > gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > diff --git a/gcc/config/riscv/riscv-protos.h > > b/gcc/config/riscv/riscv-protos.h > > index 31049ef7523..5ea54b45703 100644 > > --- a/gcc/config/riscv/riscv-protos.h > > +++ b/gcc/config/riscv/riscv-protos.h > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > }; > > > > /* Routines implemented in riscv.cc. */ > > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const char > > *p); > > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > > extern int riscv_float_const_rtx_index_for_fli (rtx); > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > > index 0d1cbc5cb5f..ea1d59d9cf2 100644 > > --- a/gcc/config/riscv/riscv.cc > > +++ b/gcc/config/riscv/riscv.cc > > @@ -5636,6 +5636,20 @@ riscv_get_v_regno_alignment (machine_mode mode) > > return lmul; > > } > > > > +/* Define ASM_OUTPUT_OPCODE to do anything special before > > + emitting an opcode. */ > > +const char * > > +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) > > +{ > > + /* We need to add th. prefix to all the xtheadvector > > + insturctions here.*/ > > + if (TARGET_XTHEADVECTOR && current_output_insn != NULL_RTX && > > + p[0] == 'v') > > +fputs ("th.", asm_out_file); > > + > > + return p; > Just a formatting nit. The GNU standards break lines before the > operator, not after. So >if (TARGET_XTHEADVECTOR >&& current_output_insn != NULL >&& p[0] == 'v') > > Note that current_output_insn is "extern rtx_insn *", so use NULL, not > NULL_RTX. > > Neither of these nits require a new version for review. Just fix them. > > If Juzhe is fine with this, so am I. We can refine it if necessary later. > > jeff >
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
On Mon, Jan 1, 2024 at 2:59 PM 钟居哲 wrote: > > This is Ok from my side. > But before commit this patch, I think we need this patch first: > https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html > > I will be back to work so I will take a look at other patches today. Note I hate it. It would be better if you use something like `%^' (see `~` for an example of how that works) instead of hacking riscv_asm_output_opcode really. In fact that is how other targets implement this kind of things. Thanks, Andrew PInski > > juzhe.zh...@rivai.ai > > > From: Jeff Law > Date: 2024-01-01 01:43 > To: Jun Sha (Joshua); gcc-patches > CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; > juzhe.zhong; Jin Ma; Xianmiao Qu > Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of > XTheadVector. > > > On 12/28/23 21:19, Jun Sha (Joshua) wrote: > > This patch adds th. prefix to all XTheadVector instructions by > > implementing new assembly output functions. We only check the > > prefix is 'v', so that no extra attribute is needed. > > > > gcc/ChangeLog: > > > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > > New function to add assembler insn code prefix/suffix. > > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > > > Co-authored-by: Jin Ma > > Co-authored-by: Xianmiao Qu > > Co-authored-by: Christoph Müllner > > --- > > gcc/config/riscv/riscv-protos.h| 1 + > > gcc/config/riscv/riscv.cc | 14 ++ > > gcc/config/riscv/riscv.h | 4 > > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > > 4 files changed, 31 insertions(+) > > create mode 100644 > > gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > > > diff --git a/gcc/config/riscv/riscv-protos.h > > b/gcc/config/riscv/riscv-protos.h > > index 31049ef7523..5ea54b45703 100644 > > --- a/gcc/config/riscv/riscv-protos.h > > +++ b/gcc/config/riscv/riscv-protos.h > > @@ -102,6 +102,7 @@ struct riscv_address_info { > > }; > > > > /* Routines implemented in riscv.cc. */ > > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const char > > *p); > > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > > extern int riscv_float_const_rtx_index_for_fli (rtx); > > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > > index 0d1cbc5cb5f..ea1d59d9cf2 100644 > > --- a/gcc/config/riscv/riscv.cc > > +++ b/gcc/config/riscv/riscv.cc > > @@ -5636,6 +5636,20 @@ riscv_get_v_regno_alignment (machine_mode mode) > > return lmul; > > } > > > > +/* Define ASM_OUTPUT_OPCODE to do anything special before > > + emitting an opcode. */ > > +const char * > > +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) > > +{ > > + /* We need to add th. prefix to all the xtheadvector > > + insturctions here.*/ > > + if (TARGET_XTHEADVECTOR && current_output_insn != NULL_RTX && > > + p[0] == 'v') > > +fputs ("th.", asm_out_file); > > + > > + return p; > Just a formatting nit. The GNU standards break lines before the > operator, not after. So >if (TARGET_XTHEADVECTOR >&& current_output_insn != NULL >&& p[0] == 'v') > > Note that current_output_insn is "extern rtx_insn *", so use NULL, not > NULL_RTX. > > Neither of these nits require a new version for review. Just fix them. > > If Juzhe is fine with this, so am I. We can refine it if necessary later. > > jeff >
Re: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
This is Ok from my side. But before commit this patch, I think we need this patch first: https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641533.html I will be back to work so I will take a look at other patches today. juzhe.zh...@rivai.ai From: Jeff Law Date: 2024-01-01 01:43 To: Jun Sha (Joshua); gcc-patches CC: jim.wilson.gcc; palmer; andrew; philipp.tomsich; christoph.muellner; juzhe.zhong; Jin Ma; Xianmiao Qu Subject: Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector. On 12/28/23 21:19, Jun Sha (Joshua) wrote: > This patch adds th. prefix to all XTheadVector instructions by > implementing new assembly output functions. We only check the > prefix is 'v', so that no extra attribute is needed. > > gcc/ChangeLog: > > * config/riscv/riscv-protos.h (riscv_asm_output_opcode): > New function to add assembler insn code prefix/suffix. > * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. > * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. > > Co-authored-by: Jin Ma > Co-authored-by: Xianmiao Qu > Co-authored-by: Christoph Müllner > --- > gcc/config/riscv/riscv-protos.h| 1 + > gcc/config/riscv/riscv.cc | 14 ++ > gcc/config/riscv/riscv.h | 4 > .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 > 4 files changed, 31 insertions(+) > create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c > > diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h > index 31049ef7523..5ea54b45703 100644 > --- a/gcc/config/riscv/riscv-protos.h > +++ b/gcc/config/riscv/riscv-protos.h > @@ -102,6 +102,7 @@ struct riscv_address_info { > }; > > /* Routines implemented in riscv.cc. */ > +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const char > *p); > extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); > extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); > extern int riscv_float_const_rtx_index_for_fli (rtx); > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc > index 0d1cbc5cb5f..ea1d59d9cf2 100644 > --- a/gcc/config/riscv/riscv.cc > +++ b/gcc/config/riscv/riscv.cc > @@ -5636,6 +5636,20 @@ riscv_get_v_regno_alignment (machine_mode mode) > return lmul; > } > > +/* Define ASM_OUTPUT_OPCODE to do anything special before > + emitting an opcode. */ > +const char * > +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) > +{ > + /* We need to add th. prefix to all the xtheadvector > + insturctions here.*/ > + if (TARGET_XTHEADVECTOR && current_output_insn != NULL_RTX && > + p[0] == 'v') > +fputs ("th.", asm_out_file); > + > + return p; Just a formatting nit. The GNU standards break lines before the operator, not after. So if (TARGET_XTHEADVECTOR && current_output_insn != NULL && p[0] == 'v') Note that current_output_insn is "extern rtx_insn *", so use NULL, not NULL_RTX. Neither of these nits require a new version for review. Just fix them. If Juzhe is fine with this, so am I. We can refine it if necessary later. jeff
Re: [PATCH v4] RISC-V: Adds the prefix "th." for the instructions of XTheadVector.
On 12/28/23 21:19, Jun Sha (Joshua) wrote: This patch adds th. prefix to all XTheadVector instructions by implementing new assembly output functions. We only check the prefix is 'v', so that no extra attribute is needed. gcc/ChangeLog: * config/riscv/riscv-protos.h (riscv_asm_output_opcode): New function to add assembler insn code prefix/suffix. * config/riscv/riscv.cc (riscv_asm_output_opcode): Likewise. * config/riscv/riscv.h (ASM_OUTPUT_OPCODE): Likewise. Co-authored-by: Jin Ma Co-authored-by: Xianmiao Qu Co-authored-by: Christoph Müllner --- gcc/config/riscv/riscv-protos.h| 1 + gcc/config/riscv/riscv.cc | 14 ++ gcc/config/riscv/riscv.h | 4 .../gcc.target/riscv/rvv/xtheadvector/prefix.c | 12 4 files changed, 31 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/prefix.c diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index 31049ef7523..5ea54b45703 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -102,6 +102,7 @@ struct riscv_address_info { }; /* Routines implemented in riscv.cc. */ +extern const char *riscv_asm_output_opcode (FILE *asm_out_file, const char *p); extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx); extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *); extern int riscv_float_const_rtx_index_for_fli (rtx); diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 0d1cbc5cb5f..ea1d59d9cf2 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -5636,6 +5636,20 @@ riscv_get_v_regno_alignment (machine_mode mode) return lmul; } +/* Define ASM_OUTPUT_OPCODE to do anything special before + emitting an opcode. */ +const char * +riscv_asm_output_opcode (FILE *asm_out_file, const char *p) +{ + /* We need to add th. prefix to all the xtheadvector + insturctions here.*/ + if (TARGET_XTHEADVECTOR && current_output_insn != NULL_RTX && + p[0] == 'v') +fputs ("th.", asm_out_file); + + return p; Just a formatting nit. The GNU standards break lines before the operator, not after. So if (TARGET_XTHEADVECTOR && current_output_insn != NULL && p[0] == 'v') Note that current_output_insn is "extern rtx_insn *", so use NULL, not NULL_RTX. Neither of these nits require a new version for review. Just fix them. If Juzhe is fine with this, so am I. We can refine it if necessary later. jeff