diff mbox series

RFA: Expand vec_perm_indices::series_p comment

Message ID 87zi5nav7r.fsf_-_@linaro.org
State New
Headers show
Series RFA: Expand vec_perm_indices::series_p comment | expand

Commit Message

Richard Sandiford Jan. 9, 2018, 3:49 p.m. UTC
James Greenhalgh <james.greenhalgh@arm.com> writes:
> On Thu, Jan 04, 2018 at 11:27:56AM +0000, Richard Sandiford wrote:

>> Ping**2

>

> This is OK.


Thanks.

> It took me a while to get the hang of the interface - a worked example

> in the comment in vec-perm-indices.c would probably have been helpful.

> It took until your code for REV for this to really make sense to me; so

> perhaps that make for a good example.


Yeah, good idea.

Is the following OK?  Tested on aarch64-linux-gnu.

Thanks,
Richard


2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* vec-perm-indices.c (vec_perm_indices::series_p): Give examples
	of usage.

Comments

Richard Sandiford Jan. 29, 2018, 8:38 p.m. UTC | #1
Ping

Richard Sandiford <richard.sandiford@linaro.org> writes:
> James Greenhalgh <james.greenhalgh@arm.com> writes:

>> On Thu, Jan 04, 2018 at 11:27:56AM +0000, Richard Sandiford wrote:

>>> Ping**2

>>

>> This is OK.

>

> Thanks.

>

>> It took me a while to get the hang of the interface - a worked example

>> in the comment in vec-perm-indices.c would probably have been helpful.

>> It took until your code for REV for this to really make sense to me; so

>> perhaps that make for a good example.

>

> Yeah, good idea.

>

> Is the following OK?  Tested on aarch64-linux-gnu.

>

> Thanks,

> Richard

>

>

> 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>

>

> gcc/

> 	* vec-perm-indices.c (vec_perm_indices::series_p): Give examples

> 	of usage.

>

> Index: gcc/vec-perm-indices.c

> ===================================================================

> --- gcc/vec-perm-indices.c	2018-01-03 11:12:55.709763763 +0000

> +++ gcc/vec-perm-indices.c	2018-01-09 15:46:40.004232873 +0000

> @@ -114,7 +114,18 @@ vec_perm_indices::rotate_inputs (int del

>  }

>  

>  /* Return true if index OUT_BASE + I * OUT_STEP selects input

> -   element IN_BASE + I * IN_STEP.  */

> +   element IN_BASE + I * IN_STEP.  For example, the call to test

> +   whether a permute reverses a vector of N elements would be:

> +

> +     series_p (0, 1, N - 1, -1)

> +

> +   which would return true for { N - 1, N - 2, N - 3, ... }.

> +   The calls to test for an interleaving of elements starting

> +   at N1 and N2 would be:

> +

> +     series_p (0, 2, N1, 1) && series_p (1, 2, N2, 1).

> +

> +   which would return true for { N1, N2, N1 + 1, N2 + 1, ... }.  */

>  

>  bool

>  vec_perm_indices::series_p (unsigned int out_base, unsigned int out_step,
Jeff Law Jan. 30, 2018, 6:11 a.m. UTC | #2
On 01/29/2018 01:38 PM, Richard Sandiford wrote:
> Ping

> 

> Richard Sandiford <richard.sandiford@linaro.org> writes:

>> James Greenhalgh <james.greenhalgh@arm.com> writes:

>>> On Thu, Jan 04, 2018 at 11:27:56AM +0000, Richard Sandiford wrote:

>>>> Ping**2

>>>

>>> This is OK.

>>

>> Thanks.

>>

>>> It took me a while to get the hang of the interface - a worked example

>>> in the comment in vec-perm-indices.c would probably have been helpful.

>>> It took until your code for REV for this to really make sense to me; so

>>> perhaps that make for a good example.

>>

>> Yeah, good idea.

>>

>> Is the following OK?  Tested on aarch64-linux-gnu.

>>

>> Thanks,

>> Richard

>>

>>

>> 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>

>>

>> gcc/

>> 	* vec-perm-indices.c (vec_perm_indices::series_p): Give examples

>> 	of usage.

OK
jeff
diff mbox series

Patch

Index: gcc/vec-perm-indices.c
===================================================================
--- gcc/vec-perm-indices.c	2018-01-03 11:12:55.709763763 +0000
+++ gcc/vec-perm-indices.c	2018-01-09 15:46:40.004232873 +0000
@@ -114,7 +114,18 @@  vec_perm_indices::rotate_inputs (int del
 }
 
 /* Return true if index OUT_BASE + I * OUT_STEP selects input
-   element IN_BASE + I * IN_STEP.  */
+   element IN_BASE + I * IN_STEP.  For example, the call to test
+   whether a permute reverses a vector of N elements would be:
+
+     series_p (0, 1, N - 1, -1)
+
+   which would return true for { N - 1, N - 2, N - 3, ... }.
+   The calls to test for an interleaving of elements starting
+   at N1 and N2 would be:
+
+     series_p (0, 2, N1, 1) && series_p (1, 2, N2, 1).
+
+   which would return true for { N1, N2, N1 + 1, N2 + 1, ... }.  */
 
 bool
 vec_perm_indices::series_p (unsigned int out_base, unsigned int out_step,