This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/63673] New: VSX intrinsic vec_vsx_ld fails to compile with double, maps to wrong instructions with float


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

            Bug ID: 63673
           Summary: VSX intrinsic vec_vsx_ld fails to compile with double,
                    maps to wrong instructions with float
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markos at freevec dot org

Created attachment 33836
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33836&action=edit
failing to compile testcase for vec_vsx_ld using doubles

These are actually two issues, but I'm filing a single bug report as it looks
like they are related.

First the build error, I've created a small failing testcase (also attached):

--
#include <altivec.h>

int main() {
        double __attribute__((aligned(16))) d[4] = {0.0, 1.0, 2.0, 3.0 };

        vector double v = vec_vsx_ld(8, d); // should load {1.0, 2.0}
}
--

This fails to compile under Debian gcc (4.9.1-19), with the following error:

$ gcc vec_vsx_ld_fail.c -c
vec_vsx_ld_fail.c: In function âmainâ:
vec_vsx_ld_fail.c:6:2: error: invalid parameter combination for AltiVec
intrinsic
  vector double v = vec_vsx_ld(4, d); // should load {1.0, 2.0}

Casting d to (float *) makes it compile, but vec_vsx_ld intrinsic definitely
should handle double parameters, so I think this is a bug.

Now the second problem, a similar testcase for float (also attached):
--
#include <altivec.h>

int main() {
        float __attribute__((aligned(16))) f[8] = {0.0, 1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0 };

        vector float v = vec_vsx_ld(4, f); // should load {1.0, 2.0, 3.0, 4.0}
}
--

This does compile, but the asm output uses the lxvd2x asm instruction, when
according the the ISA, lxvw4x should be used -at least according to my
understanding (page 359, Power ISA 2.07). Asm output also attached.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]