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

--- Comment #2 from Jeevitha <jeevitha at gcc dot gnu.org> ---
vec_permx test with vector double

The test case is:


  vsrc_a_d = (vector double) { 1.0, -3.0 };
  vsrc_b_d = (vector double) { 2.0, -4.0 };
  vsrc_c_uchar = (vector unsigned char) { 0x0, 0x1, 0x2, 0x3,
                                          0x4, 0x5, 0x6, 0x7,
                                          0x1A, 0x1B, 0x1C, 0x1B,
                                          0x1C,0x1D,0x1E,0x1F};
  vresult_d = (vector double) { 0.0, 0.0 };
  expected_vresult_d = (vector double) { 1.0, -4.0 };

  vresult_d = vec_permx (vsrc_a_d, vsrc_b_d, vsrc_c_uchar, 0);

The source vector for vec_permx is the concatenation of vsrc_a_d and vsrc_b_d,
giving a 32-byte source vector.

vsrc_a_d is represented as follows:

BE:
3f f0 00 00 00 00 00 00 c0 08 00 00 00 00 00 00

LE:
00 00 00 00 00 00 f0 3f 00 00 00 00 00 00 08 c0

vsrc_b_d is represented as follows:

BE:
40 00 00 00 00 00 00 00 c0 10 00 00 00 00 00 00

LE:
00 00 00 00 00 00 00 40 00 00 00 00 00 00 10 c0

Therefore, the concatenated 32-byte source vector is:
Index:  00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
BE:     3f f0 00 00 00 00 00 00 c0 08 00 00 00 00 00 00

Index:  10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
BE:     40 00 00 00 00 00 00 00 c0 10 00 00 00 00 00 00
-------------------------------------------------------
Index:  00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
LE:     00 00 00 00 00 00 f0 3f 00 00 00 00 00 00 08 c0

Index:  10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
LE:     00 00 00 00 00 00 00 40 00 00 00 00 00 00 10 c0

Based on the control vector, the first result double selects bytes:
0, 1, 2, 3, 4, 5, 6, 7
and the second result double selects:
26, 27, 28, 27, 28, 29, 30, 31

For the second result, the selected bytes are therefore taken from different
positions within the -4.0 representation. 
On LE, these positions produce:
00 00 00 00 00 00 10 c0 ->> which represents -4.0.
On BE, the same byte indices produce:
00 00 00 00 00 00 00 00  ->> which represents 0.0.

The expected result is {1.0, -4.0}, so the test passes on LE but fails on BE.

Reply via email to