diff options
author | Yunzhong Gao <Yunzhong_Gao@playstation.sony.com> | 2013-09-30 17:25:14 +0000 |
---|---|---|
committer | Yunzhong Gao <Yunzhong_Gao@playstation.sony.com> | 2013-09-30 17:25:14 +0000 |
commit | f4e0b1047a5dc6f2fab9cf45f1c6128f87caf000 (patch) | |
tree | c165e5c82f9fe43bf018831a31a632ec6ba83542 /clang/lib/Headers | |
parent | 0b385c77f780108368154a56db06081419fbbfbc (diff) | |
download | llvm-f4e0b1047a5dc6f2fab9cf45f1c6128f87caf000.zip llvm-f4e0b1047a5dc6f2fab9cf45f1c6128f87caf000.tar.gz llvm-f4e0b1047a5dc6f2fab9cf45f1c6128f87caf000.tar.bz2 |
Adding intrinsics to the clang front end for the x86 TBM instruction set.
Differential Revision: http://llvm-reviews.chandlerc.com/D1751
llvm-svn: 191681
Diffstat (limited to 'clang/lib/Headers')
-rw-r--r-- | clang/lib/Headers/CMakeLists.txt | 1 | ||||
-rw-r--r-- | clang/lib/Headers/tbmintrin.h | 176 | ||||
-rw-r--r-- | clang/lib/Headers/x86intrin.h | 4 |
3 files changed, 181 insertions, 0 deletions
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt index 34abea9..2da1a28 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt @@ -32,6 +32,7 @@ set(files stddef.h stdint.h stdnoreturn.h + tbmintrin.h tgmath.h tmmintrin.h varargs.h diff --git a/clang/lib/Headers/tbmintrin.h b/clang/lib/Headers/tbmintrin.h new file mode 100644 index 0000000..51c83f2 --- /dev/null +++ b/clang/lib/Headers/tbmintrin.h @@ -0,0 +1,176 @@ +/*===---- tbmintrin.h - TBM intrinsics -------------------------------------=== + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __TBM__ +#error "TBM instruction set is not enabled" +#endif + +#ifndef __X86INTRIN_H +#error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead." +#endif + +#ifndef __TBMINTRIN_H +#define __TBMINTRIN_H + +#define __bextri_u32(a, b) (__builtin_ia32_bextri_u32((a), (b))) + +#ifdef __x86_64__ +#define __bextri_u64(a, b) (__builtin_ia32_bextri_u64((a), (b))) +#endif + +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) +__blcfill_u32(unsigned int a) +{ + return __builtin_ia32_blcfill_u32(a); +} + +#ifdef __x86_64__ +static __inline__ unsigned long long __attribute__((__always_inline__, + __nodebug__)) +__blcfill_u64(unsigned long long a) +{ + return __builtin_ia32_blcfill_u64(a); +} +#endif + +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) +__blci_u32(unsigned int a) +{ + return __builtin_ia32_blci_u32(a); +} + +#ifdef __x86_64__ +static __inline__ unsigned long long __attribute__((__always_inline__, + __nodebug__)) +__blci_u64(unsigned long long a) +{ + return __builtin_ia32_blci_u64(a); +} +#endif + +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) +__blcic_u32(unsigned int a) +{ + return __builtin_ia32_blcic_u32(a); +} + +#ifdef __x86_64__ +static __inline__ unsigned long long __attribute__((__always_inline__, + __nodebug__)) +__blcic_u64(unsigned long long a) +{ + return __builtin_ia32_blcic_u64(a); +} +#endif + +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) +__blcmsk_u32(unsigned int a) +{ + return __builtin_ia32_blcmsk_u32(a); +} + +#ifdef __x86_64__ +static __inline__ unsigned long long __attribute__((__always_inline__, + __nodebug__)) +__blcmsk_u64(unsigned long long a) +{ + return __builtin_ia32_blcmsk_u64(a); +} +#endif + +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) +__blcs_u32(unsigned int a) +{ + return __builtin_ia32_blcs_u32(a); +} + +#ifdef __x86_64__ +static __inline__ unsigned long long __attribute__((__always_inline__, + __nodebug__)) +__blcs_u64(unsigned long long a) +{ + return __builtin_ia32_blcs_u64(a); +} +#endif + +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) +__blsfill_u32(unsigned int a) +{ + return __builtin_ia32_blsfill_u32(a); +} + +#ifdef __x86_64__ +static __inline__ unsigned long long __attribute__((__always_inline__, + __nodebug__)) +__blsfill_u64(unsigned long long a) +{ + return __builtin_ia32_blsfill_u64(a); +} +#endif + +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) +__blsic_u32(unsigned int a) +{ + return __builtin_ia32_blsic_u32(a); +} + +#ifdef __x86_64__ +static __inline__ unsigned long long __attribute__((__always_inline__, + __nodebug__)) +__blsic_u64(unsigned long long a) +{ + return __builtin_ia32_blsic_u64(a); +} +#endif + +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) +__t1mskc_u32(unsigned int a) +{ + return __builtin_ia32_t1mskc_u32(a); +} + +#ifdef __x86_64__ +static __inline__ unsigned long long __attribute__((__always_inline__, + __nodebug__)) +__t1mskc_u64(unsigned long long a) +{ + return __builtin_ia32_t1mskc_u64(a); +} +#endif + +static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) +__tzmsk_u32(unsigned int a) +{ + return __builtin_ia32_tzmsk_u32(a); +} + +#ifdef __x86_64__ +static __inline__ unsigned long long __attribute__((__always_inline__, + __nodebug__)) +__tzmsk_u64(unsigned long long a) +{ + return __builtin_ia32_tzmsk_u64(a); +} +#endif + +#endif /* __TBMINTRIN_H */ diff --git a/clang/lib/Headers/x86intrin.h b/clang/lib/Headers/x86intrin.h index 94fbe2f..399016f 100644 --- a/clang/lib/Headers/x86intrin.h +++ b/clang/lib/Headers/x86intrin.h @@ -66,6 +66,10 @@ #include <xopintrin.h> #endif +#ifdef __TBM__ +#include <tbmintrin.h> +#endif + #ifdef __F16C__ #include <f16cintrin.h> #endif |