tbmintrin.h revision 1.1.1.1
1/* Copyright (C) 2010-2013 Free Software Foundation, Inc. 2 3 This file is part of GCC. 4 5 GCC is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3, or (at your option) 8 any later version. 9 10 GCC is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 Under Section 7 of GPL version 3, you are granted additional 16 permissions described in the GCC Runtime Library Exception, version 17 3.1, as published by the Free Software Foundation. 18 19 You should have received a copy of the GNU General Public License and 20 a copy of the GCC Runtime Library Exception along with this program; 21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 <http://www.gnu.org/licenses/>. */ 23 24#ifndef _X86INTRIN_H_INCLUDED 25# error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead." 26#endif 27 28#ifndef __TBM__ 29# error "TBM instruction set not enabled" 30#endif /* __TBM__ */ 31 32#ifndef _TBMINTRIN_H_INCLUDED 33#define _TBMINTRIN_H_INCLUDED 34 35#ifdef __OPTIMIZE__ 36extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 37__bextri_u32 (unsigned int __X, const unsigned int __I) 38{ 39 return __builtin_ia32_bextri_u32 (__X, __I); 40} 41#else 42#define __bextri_u32(X, I) \ 43 ((unsigned int)__builtin_ia32_bextri_u32 ((unsigned int)(X), \ 44 (unsigned int)(I))) 45#endif /*__OPTIMIZE__ */ 46 47extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 48__blcfill_u32 (unsigned int __X) 49{ 50 return __X & (__X + 1); 51} 52 53extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 54__blci_u32 (unsigned int __X) 55{ 56 return __X | ~(__X + 1); 57} 58 59extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 60__blcic_u32 (unsigned int __X) 61{ 62 return ~__X & (__X + 1); 63} 64 65extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 66__blcmsk_u32 (unsigned int __X) 67{ 68 return __X ^ (__X + 1); 69} 70 71extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 72__blcs_u32 (unsigned int __X) 73{ 74 return __X | (__X + 1); 75} 76 77extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 78__blsfill_u32 (unsigned int __X) 79{ 80 return __X | (__X - 1); 81} 82 83extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 84__blsic_u32 (unsigned int __X) 85{ 86 return ~__X | (__X - 1); 87} 88 89extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 90__t1mskc_u32 (unsigned int __X) 91{ 92 return ~__X | (__X + 1); 93} 94 95extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 96__tzmsk_u32 (unsigned int __X) 97{ 98 return ~__X & (__X - 1); 99} 100 101 102 103#ifdef __x86_64__ 104#ifdef __OPTIMIZE__ 105extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 106__bextri_u64 (unsigned long long __X, const unsigned int __I) 107{ 108 return __builtin_ia32_bextri_u64 (__X, __I); 109} 110#else 111#define __bextri_u64(X, I) \ 112 ((unsigned long long)__builtin_ia32_bextri_u64 ((unsigned long long)(X), \ 113 (unsigned long long)(I))) 114#endif /*__OPTIMIZE__ */ 115 116extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 117__blcfill_u64 (unsigned long long __X) 118{ 119 return __X & (__X + 1); 120} 121 122extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 123__blci_u64 (unsigned long long __X) 124{ 125 return __X | ~(__X + 1); 126} 127 128extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 129__blcic_u64 (unsigned long long __X) 130{ 131 return ~__X & (__X + 1); 132} 133 134extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 135__blcmsk_u64 (unsigned long long __X) 136{ 137 return __X ^ (__X + 1); 138} 139 140extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 141__blcs_u64 (unsigned long long __X) 142{ 143 return __X | (__X + 1); 144} 145 146extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 147__blsfill_u64 (unsigned long long __X) 148{ 149 return __X | (__X - 1); 150} 151 152extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 153__blsic_u64 (unsigned long long __X) 154{ 155 return ~__X | (__X - 1); 156} 157 158extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 159__t1mskc_u64 (unsigned long long __X) 160{ 161 return ~__X | (__X + 1); 162} 163 164extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 165__tzmsk_u64 (unsigned long long __X) 166{ 167 return ~__X & (__X - 1); 168} 169 170 171#endif /* __x86_64__ */ 172#endif /* _TBMINTRIN_H_INCLUDED */ 173