Hi Avinash,
A few minor nits and typos:

On 11/11/26 4:37 pm, Avinash Jayakar wrote:
> Hi,
> 
> In the review of the previous patch to fix this issue:
> https://gcc.gnu.org/pipermail/gcc-patches/2026-November/737408.html
> The suggestion was to not modify the code generation for xxgenpcvm
> builtin. Although it generates incorrect code for little endian
> targets.
> The builtin itself is a bit confusing to use, therefore I propose 2 new
> builtins in place of this one in comment #3 of this PR.
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127157#c3
> 
> This patch has been tested on ppc64 and ppc64le and the test
> xxgenpc-runnable.c passes on both. Kindly review the pach and share
> your feedback on the proposed builtins.
> 
> Thanks,
> Avinash Jayakar
> 
> The vec_genpcvm builtin expands to the xxgenpcv*bm instructions, which

Typo: xxgenpcv*bm has an extra b. Please change it to xxgenpcv*m.

> operate on the vector in big-endian element order.  On big-endian
> targets no byte swap is performed, so the produced vectors differ from
> the little-endian results.
> 
> Select the big-endian expected vectors with __BIG_ENDIAN__ and keep the
> existing values for little-endian targets.  Also move the common input
> vector initializations outside of the conditional block.
> 
> 2026-11-11  Avinash Jayakar  <[email protected]>
> 
> gcc/testsuite/ChangeLog:
>       PR target/127157
>       * gcc.target/powerpc/xxgenpc-runnable.c: Add big-endian expected
>       results.
> ---
>  .../gcc.target/powerpc/xxgenpc-runnable.c     | 53 +++++++++++++++++--
>  1 file changed, 50 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/testsuite/gcc.target/powerpc/xxgenpc-runnable.c 
> b/gcc/testsuite/gcc.target/powerpc/xxgenpc-runnable.c
> index d4040ea8b70..550168f6a59 100644
> --- a/gcc/testsuite/gcc.target/powerpc/xxgenpc-runnable.c
> +++ b/gcc/testsuite/gcc.target/powerpc/xxgenpc-runnable.c
> @@ -42,6 +42,55 @@ int main ()
>                                            0xFF, 0xFF, 0xFF, 0xFF,
>                                            0xFF, 0xFF, 0xFF, 0xFF };
>  
> +  vec_hword_arg = (vector unsigned short) { 0x0004, 0xF003, 0x0002, 0x0001,

Remove the space before { for consistency with the other initializers.

> +                                         0xF004, 0x1003, 0xF002, 0x0001 };
> +  vec_word_arg = (vector unsigned int){ 0xFEDCBA90, 0xF101, 0xF0000202, 
> 0xF303 };

This line exceeds the 80 column limit. Please split the vec_word_arg 
initialization
across multiple lines.

Thanks,
Jeevitha.

> +
> +#ifdef __BIG_ENDIAN__
> +  /* The instructions operate on the vector in big-endian order, so the
> +     results differ from the little-endian ones.  */
> +  vec_byte_expected0 = (vector unsigned char){ 0x00, 0x01, 0x12, 0x02,
> +                                            0x03, 0x04, 0x05, 0x06,
> +                                            0x18, 0x19, 0x1A, 0x1B,
> +                                            0x1C, 0x1D, 0x1E, 0x1F };
> +
> +  vec_byte_expected1 = (vector unsigned char){ 0x00, 0x01, 0x03, 0x04,
> +                                            0x05, 0x06, 0x07, 0x00,
> +                                            0x00, 0x00, 0x00, 0x00,
> +                                            0x00, 0x00, 0x00, 0x00 };
> +
> +  vec_byte_expected2 = (vector unsigned char){ 0x06, 0x05, 0x1D, 0x04,
> +                                            0x03, 0x02, 0x01, 0x00,
> +                                            0x17, 0x16, 0x15, 0x14,
> +                                            0x13, 0x12, 0x11, 0x10 };
> +
> +  vec_byte_expected3 = (vector unsigned char){ 0x00, 0x00, 0x00, 0x00,
> +                                            0x00, 0x00, 0x00, 0x00,
> +                                            0x00, 0x0F, 0x0E, 0x0C,
> +                                            0x0B, 0x0A, 0x09, 0x08 };
> +
> +  vec_hword_expected0 = (vector unsigned short int){ 0x1011, 0x0001, 0x1415,
> +                                                  0x1617, 0x0203, 0x1A1B,
> +                                                  0x0405, 0x1E1F };
> +  vec_hword_expected1 = (vector unsigned short int){ 0x0203, 0x0809, 0x0C0D,
> +                                                  0x0000, 0x0000, 0x0000,
> +                                                  0x0000, 0x0000 };
> +  vec_hword_expected2 = (vector unsigned short int){ 0x1F1E, 0x0504, 0x1B1A,
> +                                                  0x1918, 0x0302, 0x1514,
> +                                                  0x0100, 0x1110 };
> +  vec_hword_expected3 = (vector unsigned short int){ 0x0000, 0x0000, 0x0000,
> +                                                  0x0000, 0x0000, 0x0D0C,
> +                                                  0x0706, 0x0302 };
> +
> +  vec_word_expected0 = (vector unsigned int){ 0x00010203, 0x14151617,
> +                                           0x04050607, 0x1C1D1E1F };
> +  vec_word_expected1 = (vector unsigned int){ 0x00010203, 0x08090A0B,
> +                                           0x00000000, 0x00000000 };
> +  vec_word_expected2 = (vector unsigned int){ 0x07060504, 0x1B1A1918,
> +                                           0x03020100, 0x13121110 };
> +  vec_word_expected3 = (vector unsigned int){ 0x00000000, 0x00000000,
> +                                           0x0F0E0D0C, 0x07060504 };
> +#else
>    vec_byte_expected0 = (vector unsigned char){ 0x1F, 0x1E, 0x1D, 0x1C,
>                                              0x1B, 0x1A, 0x19, 0x18,
>                                              0x06, 0x05, 0x15, 0x04,
> @@ -62,8 +111,6 @@ int main ()
>                                              0x00, 0x00, 0x00, 0x00,
>                                              0x00, 0x00, 0x00, 0x00 };
>  
> -  vec_hword_arg = (vector unsigned short) { 0x0004, 0xF003, 0x0002, 0x0001,
> -                                         0xF004, 0x1003, 0xF002, 0x0001 };
>    vec_hword_expected0 = (vector unsigned short int){ 0x405, 0x1c1d, 0x203,
>                                                    0x1819, 0x1617, 0x1,
>                                                    0x1213, 0x1011 };
> @@ -75,13 +122,13 @@ int main ()
>    vec_hword_expected3 = (vector unsigned short int){ 0x100, 0x504, 0xb0a, 
> 0x0,
>                                                    0x0, 0x0, 0x0, 0x0 };
>  
> -  vec_word_arg = (vector unsigned int){ 0xFEDCBA90, 0xF101, 0xF0000202, 
> 0xF303 };
>    vec_word_expected0 = (vector unsigned int){ 0x4050607, 0x18191a1b,
>                                             0x10203, 0x10111213 };
>    vec_word_expected1 = (vector unsigned int){ 0x0, 0x0, 0xc0d0e0f, 0x4050607 
> };
>    vec_word_expected2 = (vector unsigned int){ 0x3020100, 0x17161514,
>                                             0x7060504, 0x1f1e1d1c };
>    vec_word_expected3 = (vector unsigned int){ 0x3020100, 0xb0a0908, 0x0, 0x0 
> };
> +#endif
>  
>    vec_byte_result = vec_genpcvm (vec_byte_arg, IMM0);
>  

Reply via email to