initial commit
[glibc.git] / sysdeps / x86 / isa-ifunc-macros.h
1 /* Common ifunc selection utils
2 All versions must be listed in ifunc-impl-list.c.
3 Copyright (C) 2022 Free Software Foundation, Inc.
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
18 <https://www.gnu.org/licenses/>. */
19
20 #ifndef _ISA_IFUNC_MACROS_H
21 #define _ISA_IFUNC_MACROS_H 1
22
23 #include <isa-level.h>
24 #include <sys/cdefs.h>
25 #include <stdlib.h>
26
27 /* Only include at the level of the minimum build ISA or higher. I.e
28 if built with ISA=V1, then include all implementations. On the
29 other hand if built with ISA=V3 only include V3/V4
30 implementations. If there is no implementation at or above the
31 minimum build ISA level, then include the highest ISA level
32 implementation. */
33 #if MINIMUM_X86_ISA_LEVEL <= 4
34 # define X86_IFUNC_IMPL_ADD_V4(...) IFUNC_IMPL_ADD (__VA_ARGS__)
35 #endif
36 #if MINIMUM_X86_ISA_LEVEL <= 3
37 # define X86_IFUNC_IMPL_ADD_V3(...) IFUNC_IMPL_ADD (__VA_ARGS__)
38 #endif
39 #if MINIMUM_X86_ISA_LEVEL <= 2
40 # define X86_IFUNC_IMPL_ADD_V2(...) IFUNC_IMPL_ADD (__VA_ARGS__)
41 #endif
42 #if MINIMUM_X86_ISA_LEVEL <= 1
43 # define X86_IFUNC_IMPL_ADD_V1(...) IFUNC_IMPL_ADD (__VA_ARGS__)
44 #endif
45
46 #ifndef X86_IFUNC_IMPL_ADD_V4
47 # define X86_IFUNC_IMPL_ADD_V4(...)
48 #endif
49 #ifndef X86_IFUNC_IMPL_ADD_V3
50 # define X86_IFUNC_IMPL_ADD_V3(...)
51 #endif
52 #ifndef X86_IFUNC_IMPL_ADD_V2
53 # define X86_IFUNC_IMPL_ADD_V2(...)
54 #endif
55 #ifndef X86_IFUNC_IMPL_ADD_V1
56 # define X86_IFUNC_IMPL_ADD_V1(...)
57 #endif
58
59 #endif