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/41323] New: Add new _mm_extract_epu16 intrinsic (resquest)


I suggest following code (or equivalent) should be added to immintrin.h (if
SSE2 enabled).

extern __inline unsigned
_mm_extract_epu16 (__m128i const __A, int const __N)
{
  unsigned __r; __asm__ ("pextrw\t%2,%1,%0" : "=g,m"(__r) : "x,x"(__A),
"i,i"(__N)); return __r;
}

This behaves like _mm_extract_epi16, except it returns an unsigned value.

Rational: pextrw clears the high order bits (Intel Doc). _mm_extract_epi16
returns a signed integer, and the generated asm always has a sign extend
instruction after pextrw. However, if one wants to consider the extracted value
as unsigned, this is unnecessary.

The only way I found to get rid of the extra sign extend instruction is the
code writen above. It could be put in intrinsics headers as an extension to
existing intrinsics.

If SSE4_1 is defined, _mm_extract_epu{8,32,64} could also be added.

Best regards.


-- 
           Summary: Add new _mm_extract_epu16 intrinsic (resquest)
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: etjq78kl at free dot fr
  GCC host triplet: any
GCC target triplet: x86


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41323


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