forked from ColinIanKing/stress-ng
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcore-target-clones.h
160 lines (137 loc) · 3.81 KB
/
core-target-clones.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
* Copyright (C) 2022 Colin Ian King
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef CORE_TARGET_CLONES_H
#define CORE_TARGET_CLONES_H
#include "core-arch.h"
#if defined(__ICC)
#undef HAVE_TARGET_CLONES
#endif
/* GCC5.0+ target_clones attribute, x86 */
#if defined(STRESS_ARCH_X86) && \
defined(HAVE_TARGET_CLONES)
#if defined(HAVE_TARGET_CLONES_MMX)
#define TARGET_CLONE_MMX "mmx",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_MMX
#endif
#if defined(HAVE_TARGET_CLONES_AVX)
#define TARGET_CLONE_AVX "avx",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_AVX
#endif
#if defined(HAVE_TARGET_CLONES_AVX2)
#define TARGET_CLONE_AVX2 "avx2",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_AVX2
#endif
#if defined(HAVE_TARGET_CLONES_SSE)
#define TARGET_CLONE_SSE "sse",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_SSE
#endif
#if defined(HAVE_TARGET_CLONES_SSE2)
#define TARGET_CLONE_SSE2 "sse2",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_SSE2
#endif
#if defined(HAVE_TARGET_CLONES_SSE3)
#define TARGET_CLONE_SSE3 "sse3",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_SSE3
#endif
#if defined(HAVE_TARGET_CLONES_SSSE3)
#define TARGET_CLONE_SSSE3 "ssse3",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_SSSE3
#endif
#if defined(HAVE_TARGET_CLONES_SSE4_1)
#define TARGET_CLONE_SSE4_1 "sse4.1",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_SSE4_1
#endif
#if defined(HAVE_TARGET_CLONES_SSE4_2)
#define TARGET_CLONE_SSE4_2 "sse4.2",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_SSE4_2
#endif
#if defined(HAVE_TARGET_CLONES_SKYLAKE_AVX512)
#define TARGET_CLONE_SKYLAKE_AVX512 "arch=skylake-avx512",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_SKYLAKE_AVX512
#endif
#if defined(HAVE_TARGET_CLONES_TIGERLAKE)
#define TARGET_CLONE_TIGERLAKE "arch=tigerlake",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_TIGERLAKE
#endif
#if defined(HAVE_TARGET_CLONES_SAPPHIRERAPIDS)
#define TARGET_CLONE_SAPPHIRERAPIDS "arch=sapphirerapids",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_SAPPHIRERAPIDS
#endif
#if defined(HAVE_TARGET_CLONES_ALDERLAKE)
#define TARGET_CLONE_ALDERLAKE "arch=alderlake",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_ALDERLAKE
#endif
#if defined(HAVE_TARGET_CLONES_ROCKETLAKE)
#define TARGET_CLONE_ROCKETLAKE "arch=rocketlake",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_ROCKETLAKE
#endif
#define TARGET_CLONES_ALL \
TARGET_CLONE_AVX TARGET_CLONE_AVX2 \
TARGET_CLONE_MMX TARGET_CLONE_SSE \
TARGET_CLONE_SSE2 TARGET_CLONE_SSE3 \
TARGET_CLONE_SSSE3 TARGET_CLONE_SSE4_1 \
TARGET_CLONE_SSE4_2 \
TARGET_CLONE_SKYLAKE_AVX512 \
TARGET_CLONE_TIGERLAKE \
TARGET_CLONE_SAPPHIRERAPIDS \
TARGET_CLONE_ALDERLAKE \
TARGET_CLONE_ROCKETLAKE \
"default"
#if defined(TARGET_CLONE_USE)
#define TARGET_CLONES __attribute__((target_clones(TARGET_CLONES_ALL)))
#endif
#endif
/* GCC5.0+ target_clones attribute, ppc64 */
#if defined(STRESS_ARCH_PPC64) && \
defined(HAVE_TARGET_CLONES) && \
defined(HAVE_TARGET_CLONES_POWER9)
#define TARGET_CLONES __attribute__((target_clones("cpu=power9,default")))
#endif
#if !defined(TARGET_CLONES)
#define TARGET_CLONES
#endif
#endif