1*e4b17023SJohn Marino /* Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
2*e4b17023SJohn Marino
3*e4b17023SJohn Marino This file is part of GCC.
4*e4b17023SJohn Marino
5*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify
6*e4b17023SJohn Marino it under the terms of the GNU General Public License as published by
7*e4b17023SJohn Marino the Free Software Foundation; either version 3, or (at your option)
8*e4b17023SJohn Marino any later version.
9*e4b17023SJohn Marino
10*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful,
11*e4b17023SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of
12*e4b17023SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*e4b17023SJohn Marino GNU General Public License for more details.
14*e4b17023SJohn Marino
15*e4b17023SJohn Marino Under Section 7 of GPL version 3, you are granted additional
16*e4b17023SJohn Marino permissions described in the GCC Runtime Library Exception, version
17*e4b17023SJohn Marino 3.1, as published by the Free Software Foundation.
18*e4b17023SJohn Marino
19*e4b17023SJohn Marino You should have received a copy of the GNU General Public License and
20*e4b17023SJohn Marino a copy of the GCC Runtime Library Exception along with this program;
21*e4b17023SJohn Marino see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22*e4b17023SJohn Marino <http://www.gnu.org/licenses/>. */
23*e4b17023SJohn Marino
24*e4b17023SJohn Marino #ifndef _X86INTRIN_H_INCLUDED
25*e4b17023SJohn Marino # error "Never use <lwpintrin.h> directly; include <x86intrin.h> instead."
26*e4b17023SJohn Marino #endif
27*e4b17023SJohn Marino
28*e4b17023SJohn Marino #ifndef _LWPINTRIN_H_INCLUDED
29*e4b17023SJohn Marino #define _LWPINTRIN_H_INCLUDED
30*e4b17023SJohn Marino
31*e4b17023SJohn Marino #ifndef __LWP__
32*e4b17023SJohn Marino # error "LWP instruction set not enabled"
33*e4b17023SJohn Marino #else
34*e4b17023SJohn Marino
35*e4b17023SJohn Marino extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__llwpcb(void * pcbAddress)36*e4b17023SJohn Marino __llwpcb (void *pcbAddress)
37*e4b17023SJohn Marino {
38*e4b17023SJohn Marino __builtin_ia32_llwpcb (pcbAddress);
39*e4b17023SJohn Marino }
40*e4b17023SJohn Marino
41*e4b17023SJohn Marino extern __inline void * __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__slwpcb(void)42*e4b17023SJohn Marino __slwpcb (void)
43*e4b17023SJohn Marino {
44*e4b17023SJohn Marino return __builtin_ia32_slwpcb ();
45*e4b17023SJohn Marino }
46*e4b17023SJohn Marino
47*e4b17023SJohn Marino #ifdef __OPTIMIZE__
48*e4b17023SJohn Marino extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__lwpval32(unsigned int data2,unsigned int data1,unsigned int flags)49*e4b17023SJohn Marino __lwpval32 (unsigned int data2, unsigned int data1, unsigned int flags)
50*e4b17023SJohn Marino {
51*e4b17023SJohn Marino __builtin_ia32_lwpval32 (data2, data1, flags);
52*e4b17023SJohn Marino }
53*e4b17023SJohn Marino
54*e4b17023SJohn Marino #ifdef __x86_64__
55*e4b17023SJohn Marino extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__lwpval64(unsigned long long data2,unsigned int data1,unsigned int flags)56*e4b17023SJohn Marino __lwpval64 (unsigned long long data2, unsigned int data1, unsigned int flags)
57*e4b17023SJohn Marino {
58*e4b17023SJohn Marino __builtin_ia32_lwpval64 (data2, data1, flags);
59*e4b17023SJohn Marino }
60*e4b17023SJohn Marino #endif
61*e4b17023SJohn Marino #else
62*e4b17023SJohn Marino #define __lwpval32(D2, D1, F) \
63*e4b17023SJohn Marino (__builtin_ia32_lwpval32 ((unsigned int) (D2), (unsigned int) (D1), \
64*e4b17023SJohn Marino (unsigned int) (F)))
65*e4b17023SJohn Marino #ifdef __x86_64__
66*e4b17023SJohn Marino #define __lwpval64(D2, D1, F) \
67*e4b17023SJohn Marino (__builtin_ia32_lwpval64 ((unsigned long long) (D2), (unsigned int) (D1), \
68*e4b17023SJohn Marino (unsigned int) (F)))
69*e4b17023SJohn Marino #endif
70*e4b17023SJohn Marino #endif
71*e4b17023SJohn Marino
72*e4b17023SJohn Marino
73*e4b17023SJohn Marino #ifdef __OPTIMIZE__
74*e4b17023SJohn Marino extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__lwpins32(unsigned int data2,unsigned int data1,unsigned int flags)75*e4b17023SJohn Marino __lwpins32 (unsigned int data2, unsigned int data1, unsigned int flags)
76*e4b17023SJohn Marino {
77*e4b17023SJohn Marino return __builtin_ia32_lwpins32 (data2, data1, flags);
78*e4b17023SJohn Marino }
79*e4b17023SJohn Marino
80*e4b17023SJohn Marino #ifdef __x86_64__
81*e4b17023SJohn Marino extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
__lwpins64(unsigned long long data2,unsigned int data1,unsigned int flags)82*e4b17023SJohn Marino __lwpins64 (unsigned long long data2, unsigned int data1, unsigned int flags)
83*e4b17023SJohn Marino {
84*e4b17023SJohn Marino return __builtin_ia32_lwpins64 (data2, data1, flags);
85*e4b17023SJohn Marino }
86*e4b17023SJohn Marino #endif
87*e4b17023SJohn Marino #else
88*e4b17023SJohn Marino #define __lwpins32(D2, D1, F) \
89*e4b17023SJohn Marino (__builtin_ia32_lwpins32 ((unsigned int) (D2), (unsigned int) (D1), \
90*e4b17023SJohn Marino (unsigned int) (F)))
91*e4b17023SJohn Marino #ifdef __x86_64__
92*e4b17023SJohn Marino #define __lwpins64(D2, D1, F) \
93*e4b17023SJohn Marino (__builtin_ia32_lwpins64 ((unsigned long long) (D2), (unsigned int) (D1), \
94*e4b17023SJohn Marino (unsigned int) (F)))
95*e4b17023SJohn Marino #endif
96*e4b17023SJohn Marino #endif
97*e4b17023SJohn Marino
98*e4b17023SJohn Marino #endif /* __LWP__ */
99*e4b17023SJohn Marino
100*e4b17023SJohn Marino #endif /* _LWPINTRIN_H_INCLUDED */
101