forked from OSchip/llvm-project
parent
2990ec6e92
commit
a06d4a1c40
|
@ -601,5 +601,7 @@ BUILTIN(__builtin_clzs, "UsUs", "")
|
|||
|
||||
// BMI
|
||||
BUILTIN(__builtin_ctzs, "UsUs", "")
|
||||
BUILTIN(__builtin_ia32_bextr_u32, "UiUiUi", "")
|
||||
BUILTIN(__builtin_ia32_bextr_u64, "ULLiULLiULLi", "")
|
||||
|
||||
#undef BUILTIN
|
||||
|
|
|
@ -38,6 +38,36 @@ __tzcnt16(unsigned short __X)
|
|||
return __builtin_ctzs(__X);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
__andn_u32(unsigned int __X, unsigned int __Y)
|
||||
{
|
||||
return ~__X & __Y;
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
__bextr_u32(unsigned int __X, unsigned int __Y)
|
||||
{
|
||||
return __builtin_ia32_bextr_u32(__X, __Y);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
__blsi_u32(unsigned int __X)
|
||||
{
|
||||
return __X & -__X;
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
__blsmsk_u32(unsigned int __X)
|
||||
{
|
||||
return __X ^ (__X - 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
__blsr_u32(unsigned int __X)
|
||||
{
|
||||
return __X & (__X - 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
|
||||
__tzcnt32(unsigned int __X)
|
||||
{
|
||||
|
@ -45,6 +75,36 @@ __tzcnt32(unsigned int __X)
|
|||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__andn_u64 (unsigned long long __X, unsigned long long __Y)
|
||||
{
|
||||
return ~__X & __Y;
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__bextr_u64(unsigned long long __X, unsigned long long __Y)
|
||||
{
|
||||
return __builtin_ia32_bextr_u64(__X, __Y);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__blsi_u64(unsigned long long __X)
|
||||
{
|
||||
return __X & -__X;
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__blsmsk_u64(unsigned long long __X)
|
||||
{
|
||||
return __X ^ (__X - 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__blsr_u64(unsigned long long __X)
|
||||
{
|
||||
return __X & (__X - 1);
|
||||
}
|
||||
|
||||
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
|
||||
__tzcnt64(unsigned long long __X)
|
||||
{
|
||||
|
|
|
@ -5,20 +5,67 @@
|
|||
|
||||
#include <x86intrin.h>
|
||||
|
||||
unsigned short test__tzcnt16(unsigned short __X)
|
||||
{
|
||||
unsigned short test__tzcnt16(unsigned short __X) {
|
||||
// CHECK: tzcntw
|
||||
return __tzcnt16(__X);
|
||||
}
|
||||
|
||||
unsigned int test_tzcnt32(unsigned int __X)
|
||||
{
|
||||
unsigned int test__andn_u32(unsigned int __X, unsigned int __Y) {
|
||||
// CHECK: andnl
|
||||
return __andn_u32(__X, __Y);
|
||||
}
|
||||
|
||||
unsigned int test__bextr_u32(unsigned int __X, unsigned int __Y) {
|
||||
// CHECK: bextrl
|
||||
return __bextr_u32(__X, __Y);
|
||||
}
|
||||
|
||||
unsigned int test__blsi_u32(unsigned int __X) {
|
||||
// CHECK: blsil
|
||||
return __blsi_u32(__X);
|
||||
}
|
||||
|
||||
unsigned int test__blsmsk_u32(unsigned int __X) {
|
||||
// CHECK: blsmskl
|
||||
return __blsmsk_u32(__X);
|
||||
}
|
||||
|
||||
unsigned int test__blsr_u32(unsigned int __X) {
|
||||
// CHECK: blsrl
|
||||
return __blsr_u32(__X);
|
||||
}
|
||||
|
||||
unsigned int test_tzcnt32(unsigned int __X) {
|
||||
// CHECK: tzcntl
|
||||
return __tzcnt32(__X);
|
||||
}
|
||||
|
||||
unsigned long long test__tzcnt64(unsigned long long __X)
|
||||
{
|
||||
unsigned long long test__andn_u64(unsigned long __X, unsigned long __Y) {
|
||||
// CHECK: andnq
|
||||
return __andn_u64(__X, __Y);
|
||||
}
|
||||
|
||||
unsigned long long test__bextr_u64(unsigned long __X, unsigned long __Y) {
|
||||
// CHECK: bextrq
|
||||
return __bextr_u64(__X, __Y);
|
||||
}
|
||||
|
||||
unsigned long long test__blsi_u64(unsigned long long __X) {
|
||||
// CHECK: blsiq
|
||||
return __blsi_u64(__X);
|
||||
}
|
||||
|
||||
unsigned long long test__blsmsk_u64(unsigned long long __X) {
|
||||
// CHECK: blsmskq
|
||||
return __blsmsk_u64(__X);
|
||||
}
|
||||
|
||||
unsigned long long test__blsr_u64(unsigned long long __X) {
|
||||
// CHECK: blsrq
|
||||
return __blsr_u64(__X);
|
||||
}
|
||||
|
||||
unsigned long long test__tzcnt64(unsigned long long __X) {
|
||||
// CHECK: tzcntq
|
||||
return __tzcnt64(__X);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue