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

            Bug ID: 70963
           Summary: vec_cts/vec_ctf intrinsics produce wrong results for
                    64-bit floating point
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markos at freevec dot org
  Target Milestone: ---
              Host: powerpc64le-linux-gnu
            Target: powerpc64le-linux-gnu
             Build: powerpc64le-linux-gnu

Created attachment 38420
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38420&action=edit
small test program to verify vec_cts/vec_ctf working on doubles

I've noticed some tests in Eigen failing for VSX 64-bit doubles code, when the
algorithm looked perfectly normal. Further investigation -and comparison with
direct output using same inputs from an SSE test program, showed that the
conversion to integer yielded 0 results in the case of VSX (vec_cts basically
returned 0 vectors). I've written a small test case that verifies this on both
big/little endian VSX-capable systems (compiled with -m64 -mvsx). When using
the intrinsic the result is wrong, when using the inline asm version, it works
as expected. I could not test it in a more recent gcc so it may well be fixed,
however it would be great if this would be backported to gcc 5.

Some asm output follows from test program (attached):

vec_cts:
    1000066c:   60 67 00 f0     xvcvdpsxds vs0,vs12
    10000670:   50 02 00 f0     xxswapd vs0,vs0


asm:
    10000674:   51 02 00 f0     xxswapd vs32,vs0
    10000678:   60 07 00 f0     xvcvdpsxds vs0,vs0
    1000067c:   56 02 00 f0     xxswapd vs0,vs32


vec_ctf:
    100006f8:   50 02 00 f0     xxswapd vs0,vs0
    100006fc:   e0 07 00 f0     xvcvsxddp vs0,vs0
    10000700:   50 02 00 f0     xxswapd vs0,vs0

asm:
    100006f8:   51 02 00 f0     xxswapd vs32,vs0
    100006fc:   e0 07 00 f0     xvcvsxddp vs0,vs0
    10000700:   56 02 00 f0     xxswapd vs0,vs32

Reply via email to