4ffd3d1fe496c6bfeab007112f70205ff7f30c40
[gcc.git] / libitm / config / powerpc / target.h
1 /* Copyright (C) 2012 Free Software Foundation, Inc.
2 Contributed by Richard Henderson <rth@redhat.com>.
3
4 This file is part of the GNU Transactional Memory Library (libitm).
5
6 Libitm is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 Libitm is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
19
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
24
25 namespace GTM HIDDEN {
26
27 typedef int v128 __attribute__((vector_size(16), may_alias, aligned(16)));
28 typedef struct gtm_jmpbuf
29 {
30 #if defined(__ALTIVEC__) || defined(__VSX__)
31 v128 vr[12]; /* vr20-vr31 */
32 unsigned long long vscr; /* long long for padding only */
33 #endif
34 #ifndef _SOFT_FLOAT
35 double fr[18]; /* f14-f31 */
36 double fpscr;
37 #endif
38 unsigned long gr[18]; /* r14-r31 */
39 void *cfa;
40 unsigned long pc;
41 unsigned long toc; /* r2 on aix, r13 on darwin */
42 unsigned long cr;
43 } gtm_jmpbuf;
44
45 /* The size of one line in hardware caches (in bytes). */
46 #if defined (__powerpc64__) || defined (__ppc64__)
47 # define HW_CACHELINE_SIZE 128
48 #else
49 # define HW_CACHELINE_SIZE 32
50 #endif
51
52 static inline void
53 cpu_relax (void)
54 {
55 __asm volatile ("" : : : "memory");
56 }
57
58 } // namespace GTM