lzcount intrinsics.

* config/i386/abmintrin.h (__lzcnt16): New.
	(__lzcnt): New.
	(__lzcnt64): New.
	* config/i386/i386-builtin-types.def (UINT16_FTYPE_UINT16): New.
	* config/i386/i386.c (IX86_BUILTIN_CLZS): New.
	(bdesc_special_args): Add __builtin_clzs.
	(ix86_expand_args_builtin): Handle UINT16_FTYPE_UINT16.

From-SVN: r154895
This commit is contained in:
Sebastian Pop 2009-12-02 05:49:34 +00:00 committed by Sebastian Pop
parent 6a72cb46b2
commit ab0e4a354d
4 changed files with 35 additions and 0 deletions

View File

@ -1,3 +1,13 @@
2009-12-01 Sebastian Pop <sebastian.pop@amd.com>
* config/i386/abmintrin.h (__lzcnt16): New.
(__lzcnt): New.
(__lzcnt64): New.
* config/i386/i386-builtin-types.def (UINT16_FTYPE_UINT16): New.
* config/i386/i386.c (IX86_BUILTIN_CLZS): New.
(bdesc_special_args): Add __builtin_clzs.
(ix86_expand_args_builtin): Handle UINT16_FTYPE_UINT16.
2009-12-01 Sebastian Pop <sebastian.pop@amd.com>
* config/i386/abmintrin.h (_mm_popcnt_u32): New.

View File

@ -32,6 +32,25 @@
#ifndef _ABMINTRIN_H_INCLUDED
#define _ABMINTRIN_H_INCLUDED
extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__lzcnt16 (unsigned short __X)
{
return __builtin_clzs (__X);
}
extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__lzcnt (unsigned int __X)
{
return __builtin_clz (__X);
}
#ifdef __x86_64__
extern __inline unsigned long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__lzcnt64 (unsigned long __X)
{
return __builtin_clzl (__X);
}
#endif
/* Calculate a number of bits set to 1. */
extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))

View File

@ -142,6 +142,7 @@ DEF_FUNCTION_TYPE (INT64, INT64)
DEF_FUNCTION_TYPE (INT64, V2DF)
DEF_FUNCTION_TYPE (INT64, V4SF)
DEF_FUNCTION_TYPE (UINT64, INT)
DEF_FUNCTION_TYPE (UINT16, UINT16)
DEF_FUNCTION_TYPE (UINT64, PUNSIGNED)
DEF_FUNCTION_TYPE (V16QI, PCCHAR)
DEF_FUNCTION_TYPE (V16QI, V16QI)

View File

@ -21254,6 +21254,8 @@ enum ix86_builtins
IX86_BUILTIN_LWPINS32,
IX86_BUILTIN_LWPINS64,
IX86_BUILTIN_CLZS,
IX86_BUILTIN_MAX
};
@ -21535,6 +21537,8 @@ static const struct builtin_description bdesc_special_args[] =
{ OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpinssi3, "__builtin_ia32_lwpins32", IX86_BUILTIN_LWPINS64, UNKNOWN, (int) UCHAR_FTYPE_UINT_UINT_UINT },
{ OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpinsdi3, "__builtin_ia32_lwpins64", IX86_BUILTIN_LWPINS64, UNKNOWN, (int) UCHAR_FTYPE_UINT64_UINT_UINT },
{ OPTION_MASK_ISA_ABM, CODE_FOR_clzhi2_abm, "__builtin_clzs", IX86_BUILTIN_CLZS, UNKNOWN, (int) UINT16_FTYPE_UINT16 },
};
/* Builtins with variable number of arguments. */
@ -23359,6 +23363,7 @@ ix86_expand_args_builtin (const struct builtin_description *d,
case FLOAT_FTYPE_FLOAT:
case INT_FTYPE_INT:
case UINT64_FTYPE_INT:
case UINT16_FTYPE_UINT16:
case INT64_FTYPE_INT64:
case INT64_FTYPE_V4SF:
case INT64_FTYPE_V2DF: