]>
Commit | Line | Data |
---|---|---|
08f43f9b | 1 | /* IFUNC resolver function for CPU specific functions. |
31556246 | 2 | 32/64 bit S/390 version. |
04277e02 | 3 | Copyright (C) 2015-2019 Free Software Foundation, Inc. |
08f43f9b AK |
4 | This file is part of the GNU C Library. |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
7 | modify it under the terms of the GNU Lesser General Public | |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
10 | ||
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public | |
17 | License along with the GNU C Library; if not, see | |
5a82c748 | 18 | <https://www.gnu.org/licenses/>. */ |
08f43f9b AK |
19 | |
20 | #include <unistd.h> | |
21 | #include <dl-procinfo.h> | |
22 | ||
31556246 SL |
23 | #define S390_STFLE_BITS_Z10 34 /* General instructions extension */ |
24 | #define S390_STFLE_BITS_Z196 45 /* Distinct operands, pop ... */ | |
96fbb9a3 SL |
25 | #define S390_STFLE_BITS_ARCH13_MIE3 61 /* Miscellaneous-Instruction-Extensions |
26 | Facility 3, e.g. mvcrl. */ | |
27 | ||
28 | #define S390_IS_ARCH13_MIE3(STFLE_BITS) \ | |
29 | ((STFLE_BITS & (1ULL << (63 - S390_STFLE_BITS_ARCH13_MIE3))) != 0) | |
08f43f9b | 30 | |
31556246 SL |
31 | #define S390_IS_Z196(STFLE_BITS) \ |
32 | ((STFLE_BITS & (1ULL << (63 - S390_STFLE_BITS_Z196))) != 0) | |
08f43f9b | 33 | |
31556246 SL |
34 | #define S390_IS_Z10(STFLE_BITS) \ |
35 | ((STFLE_BITS & (1ULL << (63 - S390_STFLE_BITS_Z10))) != 0) | |
36 | ||
37 | #define S390_STORE_STFLE(STFLE_BITS) \ | |
38 | /* We want just 1 double word to be returned. */ \ | |
31cf3942 | 39 | register unsigned long reg0 __asm__("0") = 0; \ |
31556246 | 40 | \ |
31cf3942 SL |
41 | __asm__ __volatile__(".machine push" "\n\t" \ |
42 | ".machine \"z9-109\"" "\n\t" \ | |
43 | ".machinemode \"zarch_nohighgprs\"\n\t" \ | |
44 | "stfle %0" "\n\t" \ | |
45 | ".machine pop" "\n" \ | |
46 | : "=QS" (STFLE_BITS), "+d" (reg0) \ | |
47 | : : "cc"); | |
80190d2b | 48 | #define s390_libc_ifunc_expr_stfle_init() \ |
18d6c45e | 49 | unsigned long long stfle_bits = 0ULL; \ |
e8023f26 SL |
50 | if (__glibc_likely ((hwcap & HWCAP_S390_STFLE) \ |
51 | && (hwcap & HWCAP_S390_ZARCH) \ | |
52 | && (hwcap & HWCAP_S390_HIGH_GPRS))) \ | |
18d6c45e SL |
53 | { \ |
54 | S390_STORE_STFLE (stfle_bits); \ | |
55 | } | |
31556246 | 56 | |
51213e2b SL |
57 | #define s390_libc_ifunc_expr_init() |
58 | #define s390_libc_ifunc_expr(TYPE_FUNC, FUNC, EXPR) \ | |
59 | __ifunc (TYPE_FUNC, FUNC, EXPR, unsigned long int hwcap, \ | |
60 | s390_libc_ifunc_expr_init); |