Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-11-21 Thread Alexander Monakov via Gcc-patches
On Mon, 21 Nov 2022, Jeff Law wrote: > They're writing assembly code -- in my book that means they'd better have a > pretty good understanding of the architecture, its limitations and quirks. That GCC ties together optimization and inline asm interface via its internal TARGET_MODE_REP_EXTENDED

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-11-21 Thread Jeff Law via Gcc-patches
On 11/21/22 06:49, Alexander Monakov wrote: On Sun, 20 Nov 2022, Jeff Law wrote: The concern, as far as I understand would be the case where the assembly-sequence leaves an incompatible extension in the register. Right.  The question in my mind is whether or not the responsibility should be

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-11-21 Thread Alexander Monakov via Gcc-patches
On Sun, 20 Nov 2022, Jeff Law wrote: > > The concern, as far as I understand would be the case where the > > assembly-sequence leaves an incompatible extension in the register. > > Right.  The question in my mind is whether or not the responsibility should be > on the compiler or on the

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-11-20 Thread Jeff Law via Gcc-patches
On 11/4/22 17:00, Philipp Tomsich wrote: Alexander, I had missed your comment until now. On Tue, 6 Sept 2022 at 13:39, Alexander Monakov wrote: On Mon, 5 Sep 2022, Philipp Tomsich wrote: +riscv_mode_rep_extended (scalar_int_mode mode, scalar_int_mode mode_rep) +{ + /* On 64-bit

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-11-09 Thread Alexander Monakov via Gcc-patches
On Wed, 9 Nov 2022, Philipp Tomsich wrote: > > To give a specific example that will be problematic if you go far enough > > down > > the road of matching MIPS64 behavior: > > > > long f(void) > > { > > int x; > > asm("" : "=r"(x)); > > return x; > > } > > > > here GCC (unlike LLVM)

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-11-08 Thread Philipp Tomsich
On Mon, 7 Nov 2022 at 14:55, Alexander Monakov wrote: > > > > On Sat, 5 Nov 2022, Philipp Tomsich wrote: > > > Alexander, > > > > I had missed your comment until now. > > Please make sure to read replies from Jeff and Palmer as well (their responses > went to gcc-patches with empty Cc list): >

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-11-07 Thread Alexander Monakov
On Sat, 5 Nov 2022, Philipp Tomsich wrote: > Alexander, > > I had missed your comment until now. Please make sure to read replies from Jeff and Palmer as well (their responses went to gcc-patches with empty Cc list):

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-11-04 Thread Philipp Tomsich
Alexander, I had missed your comment until now. On Tue, 6 Sept 2022 at 13:39, Alexander Monakov wrote: > > On Mon, 5 Sep 2022, Philipp Tomsich wrote: > > > +riscv_mode_rep_extended (scalar_int_mode mode, scalar_int_mode mode_rep) > > +{ > > + /* On 64-bit targets, SImode register values are

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-09-17 Thread Palmer Dabbelt
On Fri, 16 Sep 2022 16:48:24 PDT (-0700), gcc-patches@gcc.gnu.org wrote: On 9/6/22 05:39, Alexander Monakov via Gcc-patches wrote: On Mon, 5 Sep 2022, Philipp Tomsich wrote: +riscv_mode_rep_extended (scalar_int_mode mode, scalar_int_mode mode_rep) +{ + /* On 64-bit targets, SImode register

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-09-16 Thread Jeff Law via Gcc-patches
On 9/6/22 05:39, Alexander Monakov via Gcc-patches wrote: On Mon, 5 Sep 2022, Philipp Tomsich wrote: +riscv_mode_rep_extended (scalar_int_mode mode, scalar_int_mode mode_rep) +{ + /* On 64-bit targets, SImode register values are sign-extended to DImode. */ + if (TARGET_64BIT && mode ==

Re: [PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-09-06 Thread Alexander Monakov via Gcc-patches
On Mon, 5 Sep 2022, Philipp Tomsich wrote: > +riscv_mode_rep_extended (scalar_int_mode mode, scalar_int_mode mode_rep) > +{ > + /* On 64-bit targets, SImode register values are sign-extended to DImode. > */ > + if (TARGET_64BIT && mode == SImode && mode_rep == DImode) > +return

[PATCH] riscv: implement TARGET_MODE_REP_EXTENDED

2022-09-05 Thread Philipp Tomsich
TARGET_MODE_REP_EXTENDED is supposed to match LOAD_EXTEND_OP, so this adds an implementation using the same logic as in LOAD_EXTEND_OP. This reduces the number of extension operations, as evidenced in the reduction of dynamic instructions for the xz benchmark in SPEC CPU: #