This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/41323] New: Add new _mm_extract_epu16 intrinsic (resquest)
- From: "etjq78kl at free dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Sep 2009 21:10:26 -0000
- Subject: [Bug c/41323] New: Add new _mm_extract_epu16 intrinsic (resquest)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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