Add XOP shift and compare intrinsics.

llvm-svn: 158300
This commit is contained in:
Craig Topper 2012-06-11 07:01:43 +00:00
parent 1355bd17c6
commit ce8dbaadb6
3 changed files with 188 additions and 7 deletions

View File

@ -670,12 +670,9 @@ BUILTIN(__builtin_ia32_vphaddudq, "V2LLiV4i", "")
BUILTIN(__builtin_ia32_vphsubbw, "V8sV16c", "")
BUILTIN(__builtin_ia32_vphsubwd, "V4iV8s", "")
BUILTIN(__builtin_ia32_vphsubdq, "V2LLiV4i", "")
BUILTIN(__builtin_ia32_vpcmov, "V2LLiV2LLiV2LLiV2LLi", "")
BUILTIN(__builtin_ia32_vpcmov_256, "V4LLiV4LLiV4LLiV4LLi", "")
BUILTIN(__builtin_ia32_vpperm, "V16cV16cV16cV16c", "")
BUILTIN(__builtin_ia32_vprotb, "V16cV16cV16c", "")
BUILTIN(__builtin_ia32_vprotw, "V8sV8sV8s", "")
BUILTIN(__builtin_ia32_vprotd, "V4iV4iV4i", "")
@ -684,5 +681,21 @@ BUILTIN(__builtin_ia32_vprotbi, "V16cV16cIc", "")
BUILTIN(__builtin_ia32_vprotwi, "V8sV8sIc", "")
BUILTIN(__builtin_ia32_vprotdi, "V4iV4iIc", "")
BUILTIN(__builtin_ia32_vprotqi, "V2LLiV2LLiIc", "")
BUILTIN(__builtin_ia32_vpshlb, "V16cV16cV16c", "")
BUILTIN(__builtin_ia32_vpshlw, "V8sV8sV8s", "")
BUILTIN(__builtin_ia32_vpshld, "V4iV4iV4i", "")
BUILTIN(__builtin_ia32_vpshlq, "V2LLiV2LLiV2LLi", "")
BUILTIN(__builtin_ia32_vpshab, "V16cV16cV16c", "")
BUILTIN(__builtin_ia32_vpshaw, "V8sV8sV8s", "")
BUILTIN(__builtin_ia32_vpshad, "V4iV4iV4i", "")
BUILTIN(__builtin_ia32_vpshaq, "V2LLiV2LLiV2LLi", "")
BUILTIN(__builtin_ia32_vpcomub, "V16cV16cV16cIc", "")
BUILTIN(__builtin_ia32_vpcomuw, "V8sV8sV8sIc", "")
BUILTIN(__builtin_ia32_vpcomud, "V4iV4iV4iIc", "")
BUILTIN(__builtin_ia32_vpcomuq, "V2LLiV2LLiV2LLiIc", "")
BUILTIN(__builtin_ia32_vpcomb, "V16cV16cV16cIc", "")
BUILTIN(__builtin_ia32_vpcomw, "V8sV8sV8sIc", "")
BUILTIN(__builtin_ia32_vpcomd, "V4iV4iV4iIc", "")
BUILTIN(__builtin_ia32_vpcomq, "V2LLiV2LLiV2LLiIc", "")
#undef BUILTIN

View File

@ -215,25 +215,25 @@ _mm_perm_epi8(__m128i __A, __m128i __B, __m128i __C)
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_rot_epi8(__m128i __A, __m128 __B)
_mm_rot_epi8(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vprotb((__v16qi)__A, (__v16qi)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_rot_epi16(__m128i __A, __m128 __B)
_mm_rot_epi16(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vprotw((__v8hi)__A, (__v8hi)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_rot_epi32(__m128i __A, __m128 __B)
_mm_rot_epi32(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vprotd((__v4si)__A, (__v4si)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_rot_epi64(__m128i __A, __m128 __B)
_mm_rot_epi64(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vprotq((__v2di)__A, (__v2di)__B);
}
@ -254,6 +254,94 @@ _mm_rot_epi64(__m128i __A, __m128 __B)
__m128i __A = (A); \
(__m128i)__builtin_ia32_vprotqi((__v2di)__A, (N)); })
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_shl_epi8(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vpshlb((__v16qi)__A, (__v16qi)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_shl_epi16(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vpshlw((__v8hi)__A, (__v8hi)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_shl_epi32(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vpshld((__v4si)__A, (__v4si)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_shl_epi64(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vpshlq((__v2di)__A, (__v2di)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_sha_epi8(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vpshab((__v16qi)__A, (__v16qi)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_sha_epi16(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vpshaw((__v8hi)__A, (__v8hi)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_sha_epi32(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vpshad((__v4si)__A, (__v4si)__B);
}
static __inline__ __m128i __attribute__((__always_inline__, __nodebug__))
_mm_sha_epi64(__m128i __A, __m128i __B)
{
return (__m128i)__builtin_ia32_vpshaq((__v2di)__A, (__v2di)__B);
}
#define _mm_com_epu8(A, B, N) __extension__ ({ \
__m128i __A = (A); \
__m128i __B = (B); \
(__m128i)__builtin_ia32_vpcomub((__v16qi)__A, (__v16qi)__B, (N)); })
#define _mm_com_epu16(A, B, N) __extension__ ({ \
__m128i __A = (A); \
__m128i __B = (B); \
(__m128i)__builtin_ia32_vpcomuw((__v8hi)__A, (__v8hi)__B, (N)); })
#define _mm_com_epu32(A, B, N) __extension__ ({ \
__m128i __A = (A); \
__m128i __B = (B); \
(__m128i)__builtin_ia32_vpcomud((__v4si)__A, (__v4si)__B, (N)); })
#define _mm_com_epu64(A, B, N) __extension__ ({ \
__m128i __A = (A); \
__m128i __B = (B); \
(__m128i)__builtin_ia32_vpcomuq((__v2di)__A, (__v2di)__B, (N)); })
#define _mm_com_epi8(A, B, N) __extension__ ({ \
__m128i __A = (A); \
__m128i __B = (B); \
(__m128i)__builtin_ia32_vpcomb((__v16qi)__A, (__v16qi)__B, (N)); })
#define _mm_com_epi16(A, B, N) __extension__ ({ \
__m128i __A = (A); \
__m128i __B = (B); \
(__m128i)__builtin_ia32_vpcomw((__v8hi)__A, (__v8hi)__B, (N)); })
#define _mm_com_epi32(A, B, N) __extension__ ({ \
__m128i __A = (A); \
__m128i __B = (B); \
(__m128i)__builtin_ia32_vpcomd((__v4si)__A, (__v4si)__B, (N)); })
#define _mm_com_epi64(A, B, N) __extension__ ({ \
__m128i __A = (A); \
__m128i __B = (B); \
(__m128i)__builtin_ia32_vpcomq((__v2di)__A, (__v2di)__B, (N)); })
#endif /* __XOP__ */
#endif /* __XOPINTRIN_H */

View File

@ -194,3 +194,83 @@ __m128i test_mm_roti_epi64(__m128i a) {
// CHECK: @llvm.x86.xop.vprotqi
return _mm_roti_epi64(a, 100);
}
__m128i test_mm_shl_epi8(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpshlb
return _mm_shl_epi8(a, b);
}
__m128i test_mm_shl_epi16(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpshlw
return _mm_shl_epi16(a, b);
}
__m128i test_mm_shl_epi32(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpshld
return _mm_shl_epi32(a, b);
}
__m128i test_mm_shl_epi64(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpshlq
return _mm_shl_epi64(a, b);
}
__m128i test_mm_sha_epi8(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpshab
return _mm_sha_epi8(a, b);
}
__m128i test_mm_sha_epi16(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpshaw
return _mm_sha_epi16(a, b);
}
__m128i test_mm_sha_epi32(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpshad
return _mm_sha_epi32(a, b);
}
__m128i test_mm_sha_epi64(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpshaq
return _mm_sha_epi64(a, b);
}
__m128i test_mm_com_epu8(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpcomub
return _mm_com_epu8(a, b, 0);
}
__m128i test_mm_com_epu16(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpcomuw
return _mm_com_epu16(a, b, 0);
}
__m128i test_mm_com_epu32(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpcomud
return _mm_com_epu32(a, b, 0);
}
__m128i test_mm_com_epu64(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpcomuq
return _mm_com_epu64(a, b, 0);
}
__m128i test_mm_com_epi8(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpcomb
return _mm_com_epi8(a, b, 0);
}
__m128i test_mm_com_epi16(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpcomw
return _mm_com_epi16(a, b, 0);
}
__m128i test_mm_com_epi32(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpcomd
return _mm_com_epi32(a, b, 0);
}
__m128i test_mm_com_epi64(__m128i a, __m128i b) {
// CHECK: @llvm.x86.xop.vpcomq
return _mm_com_epi64(a, b, 0);
}