public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to describe ‘earlyclobber’ explicitly for specific source operand ?
       [not found] <eb109969-0133-49eb-b392-b35a065f12ba@Spark>
@ 2021-11-19  7:28 ` Jojo R
  2021-11-19 21:54   ` Peter Bergner
  0 siblings, 1 reply; 4+ messages in thread
From: Jojo R @ 2021-11-19  7:28 UTC (permalink / raw)
  To: GCC Development

Hi,

	We know gcc supply earlyclobber function to avoid register overlap,

	but it can not describe explicitly for specific source operand, is it right ?

	The vector ISA spec of risc-v describe some register overlap rules here:

	https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#sec-vec-operands

	e.g.

	# Widening signed integer add/subtract, 2*SEW = 2*SEW +/- SEW
	vwadd.wv vd, vs2, vs1, vm # vector-vector

	it means vd can overlap vs2, but can not overlap vs1,
	there are more registers are wasted if gcc can not describe earlyclobber of vd only for vs1,
	also gcc will generate extra REG-REG move instruction :(

	Any suggestions ?

Thanks.

— Jojo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to describe ‘earlyclobber’ explicitly for specific source operand ?
  2021-11-19  7:28 ` How to describe ‘earlyclobber’ explicitly for specific source operand ? Jojo R
@ 2021-11-19 21:54   ` Peter Bergner
  2021-11-22  6:40     ` Jojo R
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Bergner @ 2021-11-19 21:54 UTC (permalink / raw)
  To: Jojo R, GCC Development

On 11/19/21 1:28 AM, Jojo R via Gcc wrote:
> 	We know gcc supply earlyclobber function to avoid register overlap,
> 
> 	but it can not describe explicitly for specific source operand, is it right ?

You add the early clobber to the OUTPUT operand(s) that can clobber any of the
input source operands.  You don't mark the source operands that could be clobbered.

Peter



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to describe ‘earlyclobber’ explicitly for specific source operand ?
  2021-11-19 21:54   ` Peter Bergner
@ 2021-11-22  6:40     ` Jojo R
  2021-11-23 12:22       ` Richard Earnshaw
  0 siblings, 1 reply; 4+ messages in thread
From: Jojo R @ 2021-11-22  6:40 UTC (permalink / raw)
  To: GCC Development, Peter Bergner


— Jojo
在 2021年11月20日 +0800 AM6:11,Peter Bergner <bergner@linux.ibm.com>,写道:
> On 11/19/21 1:28 AM, Jojo R via Gcc wrote:
> > We know gcc supply earlyclobber function to avoid register overlap,
> >
> > but it can not describe explicitly for specific source operand, is it right ?
>
> You add the early clobber to the OUTPUT operand(s) that can clobber any of the
> input source operands. You don't mark the source operands that could be clobbered.
Yes, so we need to enhance the early clobber to cover this scene ?
>
> Peter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to describe ‘earlyclobber’ explicitly for specific source operand ?
  2021-11-22  6:40     ` Jojo R
@ 2021-11-23 12:22       ` Richard Earnshaw
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Earnshaw @ 2021-11-23 12:22 UTC (permalink / raw)
  To: Jojo R, GCC Development, Peter Bergner



On 22/11/2021 06:40, Jojo R via Gcc wrote:
> 
> — Jojo
> 在 2021年11月20日 +0800 AM6:11,Peter Bergner <bergner@linux.ibm.com>,写道:
>> On 11/19/21 1:28 AM, Jojo R via Gcc wrote:
>>> We know gcc supply earlyclobber function to avoid register overlap,
>>>
>>> but it can not describe explicitly for specific source operand, is it right ?
>>
>> You add the early clobber to the OUTPUT operand(s) that can clobber any of the
>> input source operands. You don't mark the source operands that could be clobbered.
> Yes, so we need to enhance the early clobber to cover this scene ?
>>
>> Peter

You can write alternatives that explicitly tie a source to the 
destination, provided that the source and destination are the same size. 
  See the Arm backend for examples.

R.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-23 12:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <eb109969-0133-49eb-b392-b35a065f12ba@Spark>
2021-11-19  7:28 ` How to describe ‘earlyclobber’ explicitly for specific source operand ? Jojo R
2021-11-19 21:54   ` Peter Bergner
2021-11-22  6:40     ` Jojo R
2021-11-23 12:22       ` Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).