pkuintrin.h revision 309124
1135549Sdes/*===------------- pkuintrin.h - PKU intrinsics ------------------=== 2135549Sdes * 3135549Sdes * 4262706Serwin * Permission is hereby granted, free of charge, to any person obtaining a copy 5135549Sdes * of this software and associated documentation files (the "Software"), to deal 6135549Sdes * in the Software without restriction, including without limitation the rights 7135549Sdes * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8135549Sdes * copies of the Software, and to permit persons to whom the Software is 9135549Sdes * furnished to do so, subject to the following conditions: 10135549Sdes * 11135549Sdes * The above copyright notice and this permission notice shall be included in 12135549Sdes * all copies or substantial portions of the Software. 13135549Sdes * 14135549Sdes * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15135549Sdes * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16135549Sdes * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17135549Sdes * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18135549Sdes * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19135549Sdes * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20135549Sdes * THE SOFTWARE. 21135549Sdes * 22135549Sdes *===-----------------------------------------------------------------------=== 23135549Sdes */ 24135549Sdes#ifndef __IMMINTRIN_H 25135549Sdes#error "Never use <pkuintrin.h> directly; include <immintrin.h> instead." 26135549Sdes#endif 27170224Sdougb 28170224Sdougb#ifndef __PKUINTRIN_H 29135549Sdes#define __PKUINTRIN_H 30135549Sdes 31135549Sdes/* Define the default attributes for the functions in this file. */ 32135549Sdes#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("pku"))) 33135549Sdes 34135549Sdesstatic __inline__ unsigned int __DEFAULT_FN_ATTRS 35135549Sdes_rdpkru_u32(void) 36135549Sdes{ 37135549Sdes return __builtin_ia32_rdpkru(); 38135549Sdes} 39135549Sdes 40135549Sdesstatic __inline__ void __DEFAULT_FN_ATTRS 41135549Sdes_wrpkru(unsigned int __val) 42135549Sdes{ 43135549Sdes return __builtin_ia32_wrpkru(__val); 44135549Sdes} 45135549Sdes 46135549Sdes#undef __DEFAULT_FN_ATTRS 47135549Sdes 48135549Sdes#endif 49135549Sdes