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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
|
From bdb91009cf250fb22c21ae7f5072263492f2b08c Mon Sep 17 00:00:00 2001
From: Richard Sandiford <richard.sandiford@arm.com>
Date: Thu, 29 Sep 2022 11:32:56 +0100
Subject: [PATCH 023/157] [Backport][SME] aarch64: Make more use of
aarch64_feature_flags
Reference: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=fed55a60e5b230bc159617f26e33611073c672fd
A previous patch added a aarch64_feature_flags typedef, to abstract
the representation of the feature flags. This patch makes existing
code use the typedef too. Hope I've caught them all!
gcc/
* common/config/aarch64/aarch64-common.cc: Use aarch64_feature_flags
for feature flags throughout.
* config/aarch64/aarch64-protos.h: Likewise.
* config/aarch64/aarch64-sve-builtins.h: Likewise.
* config/aarch64/aarch64-sve-builtins.cc: Likewise.
* config/aarch64/aarch64.cc: Likewise.
* config/aarch64/aarch64.opt: Likewise.
* config/aarch64/driver-aarch64.cc: Likewise.
---
gcc/common/config/aarch64/aarch64-common.cc | 19 +++++++-------
gcc/config/aarch64/aarch64-protos.h | 5 ++--
gcc/config/aarch64/aarch64-sve-builtins.cc | 29 ++++++++++++---------
gcc/config/aarch64/aarch64-sve-builtins.h | 9 ++++---
gcc/config/aarch64/aarch64.cc | 29 +++++++++++----------
gcc/config/aarch64/aarch64.opt | 2 +-
gcc/config/aarch64/driver-aarch64.cc | 10 +++----
7 files changed, 56 insertions(+), 47 deletions(-)
diff --git a/gcc/common/config/aarch64/aarch64-common.cc b/gcc/common/config/aarch64/aarch64-common.cc
index ac3486d71..3efa57b26 100644
--- a/gcc/common/config/aarch64/aarch64-common.cc
+++ b/gcc/common/config/aarch64/aarch64-common.cc
@@ -204,9 +204,9 @@ aarch64_handle_option (struct gcc_options *opts,
struct aarch64_option_extension
{
const char *name;
- uint64_t flag_canonical;
- uint64_t flags_on;
- uint64_t flags_off;
+ aarch64_feature_flags flag_canonical;
+ aarch64_feature_flags flags_on;
+ aarch64_feature_flags flags_off;
};
/* ISA extensions in AArch64. */
@@ -225,14 +225,14 @@ struct processor_name_to_arch
{
const char *processor_name;
aarch64_arch arch;
- uint64_t flags;
+ aarch64_feature_flags flags;
};
struct arch_to_arch_name
{
aarch64_arch arch;
const char *arch_name;
- uint64_t flags;
+ aarch64_feature_flags flags;
};
/* Map processor names to the architecture revision they implement and
@@ -262,7 +262,7 @@ static constexpr arch_to_arch_name all_architectures[] =
a copy of the string is created and stored to INVALID_EXTENSION. */
enum aarch64_parse_opt_result
-aarch64_parse_extension (const char *str, uint64_t *isa_flags,
+aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags,
std::string *invalid_extension)
{
/* The extension string is parsed left to right. */
@@ -342,8 +342,9 @@ aarch64_get_all_extension_candidates (auto_vec<const char *> *candidates)
that all the "+" flags come before the "+no" flags. */
std::string
-aarch64_get_extension_string_for_isa_flags (uint64_t isa_flags,
- uint64_t default_arch_flags)
+aarch64_get_extension_string_for_isa_flags
+ (aarch64_feature_flags isa_flags,
+ aarch64_feature_flags default_arch_flags)
{
std::string outstr = "";
@@ -451,7 +452,7 @@ aarch64_rewrite_selected_cpu (const char *name)
|| a_to_an->arch == aarch64_no_arch)
fatal_error (input_location, "unknown value %qs for %<-mcpu%>", name);
- uint64_t extensions = p_to_a->flags;
+ aarch64_feature_flags extensions = p_to_a->flags;
aarch64_parse_extension (extension_str.c_str (), &extensions, NULL);
std::string outstr = a_to_an->arch_name
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index e60ce3c36..ef84df731 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -1037,10 +1037,11 @@ bool aarch64_handle_option (struct gcc_options *, struct gcc_options *,
const struct cl_decoded_option *, location_t);
const char *aarch64_rewrite_selected_cpu (const char *name);
enum aarch64_parse_opt_result aarch64_parse_extension (const char *,
- uint64_t *,
+ aarch64_feature_flags *,
std::string *);
void aarch64_get_all_extension_candidates (auto_vec<const char *> *candidates);
-std::string aarch64_get_extension_string_for_isa_flags (uint64_t, uint64_t);
+std::string aarch64_get_extension_string_for_isa_flags (aarch64_feature_flags,
+ aarch64_feature_flags);
rtl_opt_pass *make_pass_fma_steering (gcc::context *);
rtl_opt_pass *make_pass_track_speculation (gcc::context *);
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc
index c06e99339..b927a886e 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -82,7 +82,7 @@ public:
/* The architecture extensions that the function requires, as a set of
AARCH64_FL_* flags. */
- uint64_t required_extensions;
+ aarch64_feature_flags required_extensions;
/* True if the decl represents an overloaded function that needs to be
resolved by function_resolver. */
@@ -694,13 +694,16 @@ check_required_registers (location_t location, tree fndecl)
Report an error against LOCATION if not. */
static bool
check_required_extensions (location_t location, tree fndecl,
- uint64_t required_extensions)
+ aarch64_feature_flags required_extensions)
{
- uint64_t missing_extensions = required_extensions & ~aarch64_isa_flags;
+ auto missing_extensions = required_extensions & ~aarch64_isa_flags;
if (missing_extensions == 0)
return check_required_registers (location, fndecl);
- static const struct { uint64_t flag; const char *name; } extensions[] = {
+ static const struct {
+ aarch64_feature_flags flag;
+ const char *name;
+ } extensions[] = {
#define AARCH64_OPT_EXTENSION(EXT_NAME, IDENT, C, D, E, F) \
{ AARCH64_FL_##IDENT, EXT_NAME },
#include "aarch64-option-extensions.def"
@@ -992,7 +995,7 @@ function_builder::get_attributes (const function_instance &instance)
registered_function &
function_builder::add_function (const function_instance &instance,
const char *name, tree fntype, tree attrs,
- uint64_t required_extensions,
+ aarch64_feature_flags required_extensions,
bool overloaded_p,
bool placeholder_p)
{
@@ -1034,11 +1037,12 @@ function_builder::add_function (const function_instance &instance,
one-to-one mapping between "short" and "full" names, and if standard
overload resolution therefore isn't necessary. */
void
-function_builder::add_unique_function (const function_instance &instance,
- tree return_type,
- vec<tree> &argument_types,
- uint64_t required_extensions,
- bool force_direct_overloads)
+function_builder::
+add_unique_function (const function_instance &instance,
+ tree return_type,
+ vec<tree> &argument_types,
+ aarch64_feature_flags required_extensions,
+ bool force_direct_overloads)
{
/* Add the function under its full (unique) name. */
char *name = get_name (instance, false);
@@ -1081,8 +1085,9 @@ function_builder::add_unique_function (const function_instance &instance,
features are available as part of resolving the function to the
relevant unique function. */
void
-function_builder::add_overloaded_function (const function_instance &instance,
- uint64_t required_extensions)
+function_builder::
+add_overloaded_function (const function_instance &instance,
+ aarch64_feature_flags required_extensions)
{
char *name = get_name (instance, true);
if (registered_function **map_value = m_overload_names.get (name))
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.h b/gcc/config/aarch64/aarch64-sve-builtins.h
index 24594d584..63d1db776 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.h
+++ b/gcc/config/aarch64/aarch64-sve-builtins.h
@@ -263,7 +263,7 @@ struct function_group_info
/* The architecture extensions that the functions require, as a set of
AARCH64_FL_* flags. */
- uint64_t required_extensions;
+ aarch64_feature_flags required_extensions;
};
/* Describes a single fully-resolved function (i.e. one that has a
@@ -321,8 +321,9 @@ public:
~function_builder ();
void add_unique_function (const function_instance &, tree,
- vec<tree> &, uint64_t, bool);
- void add_overloaded_function (const function_instance &, uint64_t);
+ vec<tree> &, aarch64_feature_flags, bool);
+ void add_overloaded_function (const function_instance &,
+ aarch64_feature_flags);
void add_overloaded_functions (const function_group_info &,
mode_suffix_index);
@@ -338,7 +339,7 @@ private:
registered_function &add_function (const function_instance &,
const char *, tree, tree,
- uint64_t, bool, bool);
+ aarch64_feature_flags, bool, bool);
/* The function type to use for functions that are resolved by
function_resolver. */
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 71db7ace1..8cb820767 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -2929,7 +2929,7 @@ struct processor
aarch64_processor ident;
aarch64_processor sched_core;
aarch64_arch arch;
- uint64_t flags;
+ aarch64_feature_flags flags;
const tune_params *tune;
};
@@ -17428,7 +17428,8 @@ static void initialize_aarch64_code_model (struct gcc_options *);
static enum aarch64_parse_opt_result
aarch64_parse_arch (const char *to_parse, const struct processor **res,
- uint64_t *isa_flags, std::string *invalid_extension)
+ aarch64_feature_flags *isa_flags,
+ std::string *invalid_extension)
{
const char *ext;
const struct processor *arch;
@@ -17451,7 +17452,7 @@ aarch64_parse_arch (const char *to_parse, const struct processor **res,
if (strlen (arch->name) == len
&& strncmp (arch->name, to_parse, len) == 0)
{
- uint64_t isa_temp = arch->flags;
+ auto isa_temp = arch->flags;
if (ext != NULL)
{
@@ -17483,7 +17484,8 @@ aarch64_parse_arch (const char *to_parse, const struct processor **res,
static enum aarch64_parse_opt_result
aarch64_parse_cpu (const char *to_parse, const struct processor **res,
- uint64_t *isa_flags, std::string *invalid_extension)
+ aarch64_feature_flags *isa_flags,
+ std::string *invalid_extension)
{
const char *ext;
const struct processor *cpu;
@@ -17505,8 +17507,7 @@ aarch64_parse_cpu (const char *to_parse, const struct processor **res,
{
if (strlen (cpu->name) == len && strncmp (cpu->name, to_parse, len) == 0)
{
- uint64_t isa_temp = cpu->flags;
-
+ auto isa_temp = cpu->flags;
if (ext != NULL)
{
@@ -18137,7 +18138,7 @@ aarch64_print_hint_for_extensions (const std::string &str)
static bool
aarch64_validate_mcpu (const char *str, const struct processor **res,
- uint64_t *isa_flags)
+ aarch64_feature_flags *isa_flags)
{
std::string invalid_extension;
enum aarch64_parse_opt_result parse_res
@@ -18351,7 +18352,7 @@ aarch64_validate_mbranch_protection (const char *const_str)
static bool
aarch64_validate_march (const char *str, const struct processor **res,
- uint64_t *isa_flags)
+ aarch64_feature_flags *isa_flags)
{
std::string invalid_extension;
enum aarch64_parse_opt_result parse_res
@@ -18441,8 +18442,8 @@ aarch64_convert_sve_vector_bits (aarch64_sve_vector_bits_enum value)
static void
aarch64_override_options (void)
{
- uint64_t cpu_isa = 0;
- uint64_t arch_isa = 0;
+ aarch64_feature_flags cpu_isa = 0;
+ aarch64_feature_flags arch_isa = 0;
aarch64_isa_flags = 0;
const struct processor *cpu = NULL;
@@ -18890,7 +18891,7 @@ static bool
aarch64_handle_attr_isa_flags (char *str)
{
enum aarch64_parse_opt_result parse_res;
- uint64_t isa_flags = aarch64_isa_flags;
+ auto isa_flags = aarch64_isa_flags;
/* We allow "+nothing" in the beginning to clear out all architectural
features if the user wants to handpick specific features. */
@@ -19162,7 +19163,7 @@ aarch64_process_target_attr (tree args)
{
/* Check if token is possibly an arch extension without
leading '+'. */
- uint64_t isa_temp = 0;
+ aarch64_feature_flags isa_temp = 0;
auto with_plus = std::string ("+") + token;
enum aarch64_parse_opt_result ext_res
= aarch64_parse_extension (with_plus.c_str (), &isa_temp, nullptr);
@@ -22771,7 +22772,7 @@ aarch64_declare_function_name (FILE *stream, const char* name,
const struct processor *this_arch
= aarch64_get_arch (targ_options->x_selected_arch);
- uint64_t isa_flags = targ_options->x_aarch64_isa_flags;
+ auto isa_flags = targ_options->x_aarch64_isa_flags;
std::string extension
= aarch64_get_extension_string_for_isa_flags (isa_flags,
this_arch->flags);
@@ -22901,7 +22902,7 @@ aarch64_start_file (void)
const struct processor *default_arch
= aarch64_get_arch (default_options->x_selected_arch);
- uint64_t default_isa_flags = default_options->x_aarch64_isa_flags;
+ auto default_isa_flags = default_options->x_aarch64_isa_flags;
std::string extension
= aarch64_get_extension_string_for_isa_flags (default_isa_flags,
default_arch->flags);
diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
index 836a3c784..47ec7824f 100644
--- a/gcc/config/aarch64/aarch64.opt
+++ b/gcc/config/aarch64/aarch64.opt
@@ -28,7 +28,7 @@ TargetVariable
enum aarch64_arch selected_arch = aarch64_no_arch
TargetVariable
-uint64_t aarch64_isa_flags = 0
+aarch64_feature_flags aarch64_isa_flags = 0
TargetVariable
unsigned aarch64_enable_bti = 2
diff --git a/gcc/config/aarch64/driver-aarch64.cc b/gcc/config/aarch64/driver-aarch64.cc
index ee9cb65a5..2ae47c020 100644
--- a/gcc/config/aarch64/driver-aarch64.cc
+++ b/gcc/config/aarch64/driver-aarch64.cc
@@ -31,7 +31,7 @@
struct aarch64_arch_extension
{
const char *ext;
- uint64_t flag;
+ aarch64_feature_flags flag;
const char *feat_string;
};
@@ -50,7 +50,7 @@ struct aarch64_core_data
unsigned char implementer_id; /* Exactly 8 bits */
unsigned int part_no; /* 12 bits + 12 bits */
unsigned variant;
- uint64_t flags;
+ aarch64_feature_flags flags;
};
#define AARCH64_BIG_LITTLE(BIG, LITTLE) \
@@ -75,7 +75,7 @@ struct aarch64_arch_driver_info
{
const char* id;
const char* name;
- uint64_t flags;
+ aarch64_feature_flags flags;
};
/* Skip the leading "V" in the architecture name. */
@@ -261,8 +261,8 @@ host_detect_local_cpu (int argc, const char **argv)
unsigned int variants[2] = { ALL_VARIANTS, ALL_VARIANTS };
unsigned int n_variants = 0;
bool processed_exts = false;
- uint64_t extension_flags = 0;
- uint64_t default_flags = 0;
+ aarch64_feature_flags extension_flags = 0;
+ aarch64_feature_flags default_flags = 0;
std::string buf;
size_t sep_pos = -1;
char *fcpu_info;
--
2.33.0
|