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

gcc/ChangeLog:

	* doc/md.texi: Adapt COND_LEN pseudo code.

---
 gcc/doc/md.texi | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index daa318ee3da..fab2513105a 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -7341,8 +7341,10 @@ store the result in operand 0, otherwise store operand 2 in operand 0.
 The operation only works for the operands are vectors.
 
 @smallexample
-for (i = 0; i < ops[4] + ops[5]; i++)
-  op0[i] = op1[i] ? @var{op} op2[i] : op3[i];
+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]);
 @end smallexample
 
 where, for example, @var{op} is @code{~} for @samp{cond_len_one_cmpl@var{mode}}.
@@ -7403,8 +7405,10 @@ store the result in operand 0, otherwise store operand 4 in operand 0.
 The operation only works for the operands are vectors.
 
 @smallexample
-for (i = 0; i < ops[5] + ops[6]; i++)
-  op0[i] = op1[i] ? op2[i] @var{op} op3[i] : op4[i];
+for (i = 0; i < GET_MODE_NUNITS (@var{m}); i++)
+  op0[i] = (i < ops[5] + ops[6] && op1[i]
+            ? op2[i] @var{op} op3[i]
+            : op4[i]);
 @end smallexample
 
 where, for example, @var{op} is @code{+} for @samp{cond_len_add@var{mode}}.
@@ -7436,8 +7440,10 @@ takes 3 operands rather than two.  For example, the vector form of
 @samp{cond_len_fma@var{mode}} is equivalent to:
 
 @smallexample
-for (i = 0; i < ops[6] + ops[7]; i++)
-  op0[i] = op1[i] ? fma (op2[i], op3[i], op4[i]) : op5[i];
+for (i = 0; i < GET_MODE_NUNITS (@var{m}); i++)
+  op0[i] = (i < ops[6] + ops[7] && op1[i]
+            ? fma (op2[i], op3[i], op4[i])
+            : op5[i]);
 @end smallexample
 
 @cindex @code{neg@var{mode}cc} instruction pattern
-- 
2.36.3


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

* Re: [PATCH V2] DOC: Update COND_LEN document
  2023-10-26  9:53 [PATCH V2] DOC: Update COND_LEN document Juzhe-Zhong
@ 2023-10-26  9:56 ` Richard Sandiford
  2023-10-26 10:01   ` juzhe.zhong
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Sandiford @ 2023-10-26  9:56 UTC (permalink / raw)
  To: Juzhe-Zhong; +Cc: gcc-patches, rguenther

Juzhe-Zhong <juzhe.zhong@rivai.ai> writes:
> gcc/ChangeLog:
>
> 	* doc/md.texi: Adapt COND_LEN pseudo code.

OK.  Given your earlier message, I'd justed finished writing & testing
the same patch.

Richard

> ---
>  gcc/doc/md.texi | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
> index daa318ee3da..fab2513105a 100644
> --- a/gcc/doc/md.texi
> +++ b/gcc/doc/md.texi
> @@ -7341,8 +7341,10 @@ store the result in operand 0, otherwise store operand 2 in operand 0.
>  The operation only works for the operands are vectors.
>  
>  @smallexample
> -for (i = 0; i < ops[4] + ops[5]; i++)
> -  op0[i] = op1[i] ? @var{op} op2[i] : op3[i];
> +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]);
>  @end smallexample
>  
>  where, for example, @var{op} is @code{~} for @samp{cond_len_one_cmpl@var{mode}}.
> @@ -7403,8 +7405,10 @@ store the result in operand 0, otherwise store operand 4 in operand 0.
>  The operation only works for the operands are vectors.
>  
>  @smallexample
> -for (i = 0; i < ops[5] + ops[6]; i++)
> -  op0[i] = op1[i] ? op2[i] @var{op} op3[i] : op4[i];
> +for (i = 0; i < GET_MODE_NUNITS (@var{m}); i++)
> +  op0[i] = (i < ops[5] + ops[6] && op1[i]
> +            ? op2[i] @var{op} op3[i]
> +            : op4[i]);
>  @end smallexample
>  
>  where, for example, @var{op} is @code{+} for @samp{cond_len_add@var{mode}}.
> @@ -7436,8 +7440,10 @@ takes 3 operands rather than two.  For example, the vector form of
>  @samp{cond_len_fma@var{mode}} is equivalent to:
>  
>  @smallexample
> -for (i = 0; i < ops[6] + ops[7]; i++)
> -  op0[i] = op1[i] ? fma (op2[i], op3[i], op4[i]) : op5[i];
> +for (i = 0; i < GET_MODE_NUNITS (@var{m}); i++)
> +  op0[i] = (i < ops[6] + ops[7] && op1[i]
> +            ? fma (op2[i], op3[i], op4[i])
> +            : op5[i]);
>  @end smallexample
>  
>  @cindex @code{neg@var{mode}cc} instruction pattern

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

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

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

Thanks Richard. Committed.



juzhe.zhong@rivai.ai
 
From: Richard Sandiford
Date: 2023-10-26 17:56
To: Juzhe-Zhong
CC: gcc-patches; rguenther
Subject: Re: [PATCH V2] DOC: Update COND_LEN document
Juzhe-Zhong <juzhe.zhong@rivai.ai> writes:
> gcc/ChangeLog:
>
> * doc/md.texi: Adapt COND_LEN pseudo code.
 
OK.  Given your earlier message, I'd justed finished writing & testing
the same patch.
 
Richard
 
> ---
>  gcc/doc/md.texi | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
> index daa318ee3da..fab2513105a 100644
> --- a/gcc/doc/md.texi
> +++ b/gcc/doc/md.texi
> @@ -7341,8 +7341,10 @@ store the result in operand 0, otherwise store operand 2 in operand 0.
>  The operation only works for the operands are vectors.
>  
>  @smallexample
> -for (i = 0; i < ops[4] + ops[5]; i++)
> -  op0[i] = op1[i] ? @var{op} op2[i] : op3[i];
> +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]);
>  @end smallexample
>  
>  where, for example, @var{op} is @code{~} for @samp{cond_len_one_cmpl@var{mode}}.
> @@ -7403,8 +7405,10 @@ store the result in operand 0, otherwise store operand 4 in operand 0.
>  The operation only works for the operands are vectors.
>  
>  @smallexample
> -for (i = 0; i < ops[5] + ops[6]; i++)
> -  op0[i] = op1[i] ? op2[i] @var{op} op3[i] : op4[i];
> +for (i = 0; i < GET_MODE_NUNITS (@var{m}); i++)
> +  op0[i] = (i < ops[5] + ops[6] && op1[i]
> +            ? op2[i] @var{op} op3[i]
> +            : op4[i]);
>  @end smallexample
>  
>  where, for example, @var{op} is @code{+} for @samp{cond_len_add@var{mode}}.
> @@ -7436,8 +7440,10 @@ takes 3 operands rather than two.  For example, the vector form of
>  @samp{cond_len_fma@var{mode}} is equivalent to:
>  
>  @smallexample
> -for (i = 0; i < ops[6] + ops[7]; i++)
> -  op0[i] = op1[i] ? fma (op2[i], op3[i], op4[i]) : op5[i];
> +for (i = 0; i < GET_MODE_NUNITS (@var{m}); i++)
> +  op0[i] = (i < ops[6] + ops[7] && op1[i]
> +            ? fma (op2[i], op3[i], op4[i])
> +            : op5[i]);
>  @end smallexample
>  
>  @cindex @code{neg@var{mode}cc} instruction pattern
 

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26  9:53 [PATCH V2] DOC: Update COND_LEN document Juzhe-Zhong
2023-10-26  9:56 ` Richard Sandiford
2023-10-26 10:01   ` 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).