[LLVMbugs] [Bug 17300] New: confusing return from _mm_extract_epi8() in smmintrin.h

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 20 03:16:27 PDT 2013


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

            Bug ID: 17300
           Summary: confusing return from _mm_extract_epi8() in
                    smmintrin.h
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vvsed at hotmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

_mm_extract_epi8() function in smmintrin.h returns unsigned char instead of
int.
It is confusing because the corresponding PEXTRB instruction returns ***zero
extended*** int/__int64 value.

In smmintrin.h of GNU C "(unsigned char)" is redundant:

extern __inline int __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_extract_epi8 (__m128i __X, const int __N)
{
   return (unsigned char) __builtin_ia32_vec_ext_v16qi ((__v16qi)__X, __N);
}

While smmintrin.h of Intel C contains:

extern int   __ICL_INTRINCC _mm_extract_epi8 (__m128i, const int);

The corresponding instruction is:
PEXTRB reg/m8, xmm2, imm8

It's Intel description:
Extract a byte integer value from xmm2 at the
source byte offset specified by imm8 into reg
or m8. ***The upper bits of r32 or r64 are zeroed***.

-- 
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/20130920/137ef0fe/attachment.html>


More information about the llvm-bugs mailing list