https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127157

--- Comment #1 from Avinash Jayakar <avinashd at gcc dot gnu.org> ---
for 

r = vec_genpcvm (a, b)

let a = FF F0 7F FF FF FF FF FF 00 00 01 23 45 67 00 00
and b = 0

then based on the guide, the output r should be
a = FF F0 7F FF FF FF FF FF 00 00 01 23 45 67 00 00
r = 00 01 12 02 03 04 05 06 18 19 1a 1b 1c 1d 1e 1f

if b = 1 then
a = FF F0 7F FF FF FF FF FF 00 00 01 23 45 67 00 00
r = 00 01 03 04 05 06 07 UU UU UU UU UU UU UU UU UU

if b = 2 then
a = FF F0 7F FF FF FF FF FF 00 00 01 23 45 67 00 00
r = 06 05 1d 04 03 02 01 00 17 16 15 14 13 12 11 10

if b = 3 then
a = FF F0 7F FF FF FF FF FF 00 00 01 23 45 67 00 00
r = UU UU UU UU UU UU UU UU UU 0f 0e 0c 0b 0a 09 08

but the expected results are wrong in the test case:
gcc.target/powerpc/xxgenpc-runnable.c

Also to ensure bi-endian semantics the example mentioned in the intrinsic guide
is wrong. It says for 
vector unsigned char vec_genpcvm (vector unsigned char, const int)
the LE compiler should generate
xxswapd + xxgenpcvbm

but if we swap double words, lets say for b=0, in the above example
register contents in le after loading value a
00 00 67 45 23 01 00 00 FF FF FF FF FF 7F F0 FF
we have after swap double word
FF FF FF FF FF 7F F0 FF 00 00 67 45 23 01 00 00

and based on this result in the register for b=0 would be
00 01 02 03 04 15 05 06 18 19 1a 1b 1c 1d 1e 1f

and when stored in memory the values will be reversed
1f 1e 1d 1c 1b 1a 19 18 06 05 15 04 03 02 01 00

which is what the test case expects, and clearly it does not match the BE
output.

Reply via email to