Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / powerpc / powerpc32 / power4 / multiarch / init-arch.h
blob2d184b82f22b05b8c77c22fc56fc1992bb02d214
1 /* This file is part of the GNU C Library.
2 Copyright (C) 2013-2015 Free Software Foundation, Inc.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #include <ldsodefs.h>
20 /* The code checks if _rtld_global_ro was realocated before trying to access
21 the dl_hwcap field. The assembly is to make the compiler not optimize the
22 test (&_rtld_global_ro != NULL), which is always true in ISO C (but not
23 in that case since _rtld_global_ro might not been realocated yet). */
24 #if defined(SHARED) && !IS_IN (rtld)
25 # define __GLRO(value) \
26 ({ volatile void **__p = (volatile void**)(&_rtld_global_ro); \
27 unsigned long int __ret; \
28 asm ("# x in %0" : "+r" (__p)); \
29 __ret = (__p) ? GLRO(value) : 0; \
30 __ret; })
31 #else
32 # define __GLRO(value) GLRO(value)
33 #endif
35 /* dl_hwcap contains only the latest supported ISA, the macro checks which is
36 and fills the previous ones. */
37 #define INIT_ARCH() \
38 unsigned long int hwcap = __GLRO(dl_hwcap); \
39 unsigned long int __attribute__((unused)) hwcap2 = __GLRO(dl_hwcap2); \
40 if (hwcap & PPC_FEATURE_ARCH_2_06) \
41 hwcap |= PPC_FEATURE_ARCH_2_05 | \
42 PPC_FEATURE_POWER5_PLUS | \
43 PPC_FEATURE_POWER5 | \
44 PPC_FEATURE_POWER4; \
45 else if (hwcap & PPC_FEATURE_ARCH_2_05) \
46 hwcap |= PPC_FEATURE_POWER5_PLUS | \
47 PPC_FEATURE_POWER5 | \
48 PPC_FEATURE_POWER4; \
49 else if (hwcap & PPC_FEATURE_POWER5_PLUS) \
50 hwcap |= PPC_FEATURE_POWER5 | \
51 PPC_FEATURE_POWER4; \
52 else if (hwcap & PPC_FEATURE_POWER5) \
53 hwcap |= PPC_FEATURE_POWER4;