public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] DOC: Update COND_LEN document
@ 2023-10-26  3:43 Juzhe-Zhong
  2023-10-26  9:25 ` Richard Sandiford
  0 siblings, 1 reply; 4+ messages in thread
From: Juzhe-Zhong @ 2023-10-26  3:43 UTC (permalink / raw)
  To: gcc-patches; +Cc: richard.sandiford, rguenther, Juzhe-Zhong

As Richard's suggested. We need to adapt doc for cond_len operations.

gcc/ChangeLog:

	* doc/md.texi: Update document.

---
 gcc/doc/md.texi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index daa318ee3da..dd2c26edf7b 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -7400,6 +7400,8 @@ form of @samp{@var{op}@var{mode}2}.
 @itemx @samp{cond_len_lshr@var{mode}}
 When operand 1 is true and element index < operand 5 + operand 6, perform an operation on operands 2 and 3 and
 store the result in operand 0, otherwise store operand 4 in operand 0.
+operand 4 should be well-defined value for reduction situation, and undefined value for some arithmetic operations
+e.g. integer division.
 The operation only works for the operands are vectors.
 
 @smallexample
-- 
2.36.3


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

* Re: [PATCH] DOC: Update COND_LEN document
  2023-10-26  3:43 [PATCH] DOC: Update COND_LEN document Juzhe-Zhong
@ 2023-10-26  9:25 ` Richard Sandiford
  2023-10-26  9:44   ` juzhe.zhong
  2023-10-26  9:55   ` juzhe.zhong
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Sandiford @ 2023-10-26  9:25 UTC (permalink / raw)
  To: Juzhe-Zhong; +Cc: gcc-patches, rguenther

Juzhe-Zhong <juzhe.zhong@rivai.ai> writes:
> As Richard's suggested. We need to adapt doc for cond_len operations.
>
> gcc/ChangeLog:
>
> 	* doc/md.texi: Update document.

Thanks for addressing my comment.  I was thinking about the
pseudo code though.  Currently it is:

for (i = 0; i < ops[4] + ops[5]; i++)
  op0[i] = op1[i] ? @var{op} op2[i] : op3[i];

but I think the outcome of the discussion was that it should instead be:

for (i = 0; i < GET_MODE_NUNITS (@var{m}); i++)
  op0[i] = (i < ops[4] + ops[5] && op1[i]
            ? @var{op} op2[i]
            : op3[i]);

to match internal-fn.cc.  The binary and ternary optabs would need a
similar update.

Thanks,
Richard

> ---
>  gcc/doc/md.texi | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
> index daa318ee3da..dd2c26edf7b 100644
> --- a/gcc/doc/md.texi
> +++ b/gcc/doc/md.texi
> @@ -7400,6 +7400,8 @@ form of @samp{@var{op}@var{mode}2}.
>  @itemx @samp{cond_len_lshr@var{mode}}
>  When operand 1 is true and element index < operand 5 + operand 6, perform an operation on operands 2 and 3 and
>  store the result in operand 0, otherwise store operand 4 in operand 0.
> +operand 4 should be well-defined value for reduction situation, and undefined value for some arithmetic operations
> +e.g. integer division.
>  The operation only works for the operands are vectors.
>  
>  @smallexample

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

* Re: Re: [PATCH] DOC: Update COND_LEN document
  2023-10-26  9:25 ` Richard Sandiford
@ 2023-10-26  9:44   ` juzhe.zhong
  2023-10-26  9:55   ` juzhe.zhong
  1 sibling, 0 replies; 4+ messages in thread
From: juzhe.zhong @ 2023-10-26  9:44 UTC (permalink / raw)
  To: richard.sandiford; +Cc: gcc-patches, rguenther

[-- Attachment #1: Type: text/plain, Size: 1851 bytes --]

Hi, Richard.

I tried your pseudo code, but report a warning:

../../../../gcc/gcc/doc/invoke.texi:20243: warning: `.' or `,' must follow @xref, not )

I have tried several changes, still failed to eliminate this warning.


juzhe.zhong@rivai.ai
 
From: Richard Sandiford
Date: 2023-10-26 17:25
To: Juzhe-Zhong
CC: gcc-patches; rguenther
Subject: Re: [PATCH] DOC: Update COND_LEN document
Juzhe-Zhong <juzhe.zhong@rivai.ai> writes:
> As Richard's suggested. We need to adapt doc for cond_len operations.
>
> gcc/ChangeLog:
>
> * doc/md.texi: Update document.
 
Thanks for addressing my comment.  I was thinking about the
pseudo code though.  Currently it is:
 
for (i = 0; i < ops[4] + ops[5]; i++)
  op0[i] = op1[i] ? @var{op} op2[i] : op3[i];
 
but I think the outcome of the discussion was that it should instead be:
 
for (i = 0; i < GET_MODE_NUNITS (@var{m}); i++)
  op0[i] = (i < ops[4] + ops[5] && op1[i]
            ? @var{op} op2[i]
            : op3[i]);
 
to match internal-fn.cc.  The binary and ternary optabs would need a
similar update.
 
Thanks,
Richard
 
> ---
>  gcc/doc/md.texi | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
> index daa318ee3da..dd2c26edf7b 100644
> --- a/gcc/doc/md.texi
> +++ b/gcc/doc/md.texi
> @@ -7400,6 +7400,8 @@ form of @samp{@var{op}@var{mode}2}.
>  @itemx @samp{cond_len_lshr@var{mode}}
>  When operand 1 is true and element index < operand 5 + operand 6, perform an operation on operands 2 and 3 and
>  store the result in operand 0, otherwise store operand 4 in operand 0.
> +operand 4 should be well-defined value for reduction situation, and undefined value for some arithmetic operations
> +e.g. integer division.
>  The operation only works for the operands are vectors.
>  
>  @smallexample
 

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

* Re: Re: [PATCH] DOC: Update COND_LEN document
  2023-10-26  9:25 ` Richard Sandiford
  2023-10-26  9:44   ` juzhe.zhong
@ 2023-10-26  9:55   ` juzhe.zhong
  1 sibling, 0 replies; 4+ messages in thread
From: juzhe.zhong @ 2023-10-26  9:55 UTC (permalink / raw)
  To: richard.sandiford; +Cc: gcc-patches, rguenther

[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]

Oh. I made a mistake here.

Forget about my last email.

https://gcc.gnu.org/pipermail/gcc-patches/2023-October/634376.html 
Here is the V2 address comments as you suggested.

Could you take a look ?

Thanks.



juzhe.zhong@rivai.ai
 
From: Richard Sandiford
Date: 2023-10-26 17:25
To: Juzhe-Zhong
CC: gcc-patches; rguenther
Subject: Re: [PATCH] DOC: Update COND_LEN document
Juzhe-Zhong <juzhe.zhong@rivai.ai> writes:
> As Richard's suggested. We need to adapt doc for cond_len operations.
>
> gcc/ChangeLog:
>
> * doc/md.texi: Update document.
 
Thanks for addressing my comment.  I was thinking about the
pseudo code though.  Currently it is:
 
for (i = 0; i < ops[4] + ops[5]; i++)
  op0[i] = op1[i] ? @var{op} op2[i] : op3[i];
 
but I think the outcome of the discussion was that it should instead be:
 
for (i = 0; i < GET_MODE_NUNITS (@var{m}); i++)
  op0[i] = (i < ops[4] + ops[5] && op1[i]
            ? @var{op} op2[i]
            : op3[i]);
 
to match internal-fn.cc.  The binary and ternary optabs would need a
similar update.
 
Thanks,
Richard
 
> ---
>  gcc/doc/md.texi | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
> index daa318ee3da..dd2c26edf7b 100644
> --- a/gcc/doc/md.texi
> +++ b/gcc/doc/md.texi
> @@ -7400,6 +7400,8 @@ form of @samp{@var{op}@var{mode}2}.
>  @itemx @samp{cond_len_lshr@var{mode}}
>  When operand 1 is true and element index < operand 5 + operand 6, perform an operation on operands 2 and 3 and
>  store the result in operand 0, otherwise store operand 4 in operand 0.
> +operand 4 should be well-defined value for reduction situation, and undefined value for some arithmetic operations
> +e.g. integer division.
>  The operation only works for the operands are vectors.
>  
>  @smallexample
 

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

end of thread, other threads:[~2023-10-26  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26  3:43 [PATCH] DOC: Update COND_LEN document Juzhe-Zhong
2023-10-26  9:25 ` Richard Sandiford
2023-10-26  9:44   ` juzhe.zhong
2023-10-26  9:55   ` juzhe.zhong

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).