[LLVMbugs] [Bug 17312] New: avx2 gather_epi64 intrinsics have wrong pointer type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Sep 21 02:29:55 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17312

            Bug ID: 17312
           Summary: avx2 gather_epi64 intrinsics have wrong pointer type
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: agner at agner.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The definition of the following intrinsics in avx2intrin.h is problematic:

_mm_i32gather_epi64
_mm256_i32gather_epi64
_mm_i64gather_epi64
_mm256_i64gather_epi64
_mm_mask_i32gather_epi64
_mm256_mask_i32gather_epi64
_mm_mask_i64gather_epi64
_mm256_mask_i64gather_epi64

The base pointer for these intrinsics (named m in clang version of
avx2intrin.h) has type int const *. This is in accordance with the official
Intel documents, which are wrong. The correct type is a pointer to 64-bit
integers. Intel and Microsoft versions of this intrinsic use the type const
__int64 *, which is not defined in any C standard. The Gnu compiler uses the
type const long long *. I would recommend using the type const long long * for
the sake of compatibility with the Gnu compiler.

See gcc patch:
http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01793/avx2.gatherdecls.gcc.patch

Test case:

typedef const long long * ppp;
// typedef const int * ppp;

__m128i VPGATHERDQ1(ppp base, __m128i index) {
   return _mm_i32gather_epi64 (base, index, 1);
}

__m256i VPGATHERDQ2 (ppp base, __m128i index) {
   return _mm256_i32gather_epi64 (base, index, 2);
}

__m128i VPGATHERQQ1(ppp base, __m128i index) {
   return _mm_i64gather_epi64 (base, index, 4);
}

__m128i VPGATHERQQ2(ppp base, __m128i index) {
   return _mm256_i64gather_epi64 ( base,  index, 8);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130921/07dd30e9/attachment.html>


More information about the llvm-bugs mailing list