1/* Copyright (C) 2012-2019 Free Software Foundation, Inc.
2   Contributed by ARM Ltd.
3
4   This file is part of GCC.
5
6   GCC is free software; you can redistribute it and/or modify it
7   under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 3, or (at your option)
9   any later version.
10
11   GCC is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with GCC; see the file COPYING3.  If not see
18   <http://www.gnu.org/licenses/>.  */
19
20/* This is a list of ISA extentsions in AArch64.
21
22   Before using #include to read this file, define a macro:
23
24      AARCH64_OPT_EXTENSION(EXT_NAME, FLAG_CANONICAL, FLAGS_ON, FLAGS_OFF,
25			    SYNTHETIC, FEATURE_STRING)
26
27   - EXT_NAME is the name of the extension, represented as a string constant.
28   - FLAGS_CANONICAL is the canonical internal name for this flag.
29   - FLAGS_ON are the bitwise-or of the features that enabling the extension
30     adds, or zero if enabling this extension has no effect on other features.
31   - FLAGS_OFF are the bitwise-or of the features that disabling the extension
32     removes, or zero if disabling this extension has no effect on other
33     features.
34   - SYNTHETIC is a boolean to indicate whether the option is a purely synthetic
35     grouping of options and that the option itself has no feature bit (e.g.
36     crypto).  This is used to determine when sum of the individual options in
37     FLAGS_ON can be replaced by FLAG_CANONICAL in options minimization.  If the
38     group is synthetic then they can be replaced when all options in FLAGS_ON
39     are enabled, otherwise they can only be replaced when
40     FLAGS_ON | FLAG_CANONICAL are enabled.
41   - FEAT_STRING is a string containing the entries in the 'Features' field of
42     /proc/cpuinfo on a GNU/Linux system that correspond to this architecture
43     extension being available.  Sometimes multiple entries are needed to enable
44     the extension (for example, the 'crypto' extension depends on four
45     entries: aes, pmull, sha1, sha2 being present).  In that case this field
46     should contain a space (" ") separated list of the strings in 'Features'
47     that are required.  Their order is not important.  An empty string means
48     do not detect this feature during auto detection.  */
49
50/* NOTE: This file is being parsed by config.gcc and so the
51   AARCH64_OPT_EXTENSION must adhere to a strict format:
52   1) No space between the AARCH64_OPT_EXTENSION and the opening (.
53   2) No space between the opening ( and the extension name.
54   3) No space after the extension name before the ,.
55   4) Spaces are only allowed after a , and around |.
56   5) Everything must be on one line.  */
57
58/* Enabling "fp" just enables "fp".
59   Disabling "fp" also disables "simd", "crypto", "fp16", "aes", "sha2",
60   "sha3", sm3/sm4 and "sve".  */
61AARCH64_OPT_EXTENSION("fp", AARCH64_FL_FP, 0, AARCH64_FL_SIMD | AARCH64_FL_CRYPTO | AARCH64_FL_F16 | AARCH64_FL_AES | AARCH64_FL_SHA2 | AARCH64_FL_SHA3 | AARCH64_FL_SM4 | AARCH64_FL_SVE, false, "fp")
62
63/* Enabling "simd" also enables "fp".
64   Disabling "simd" also disables "crypto", "dotprod", "aes", "sha2", "sha3",
65   "sm3/sm4" and "sve".  */
66AARCH64_OPT_EXTENSION("simd", AARCH64_FL_SIMD, AARCH64_FL_FP, AARCH64_FL_CRYPTO | AARCH64_FL_DOTPROD | AARCH64_FL_AES | AARCH64_FL_SHA2 | AARCH64_FL_SHA3 | AARCH64_FL_SM4 | AARCH64_FL_SVE, false, "asimd")
67
68/* Enabling "crypto" also enables "fp", "simd", "aes" and "sha2".
69   Disabling "crypto" disables "crypto", "aes", "sha2", "sha3" and "sm3/sm4".  */
70AARCH64_OPT_EXTENSION("crypto", AARCH64_FL_CRYPTO, AARCH64_FL_FP | AARCH64_FL_SIMD | AARCH64_FL_AES | AARCH64_FL_SHA2, AARCH64_FL_AES | AARCH64_FL_SHA2 |AARCH64_FL_SHA3 | AARCH64_FL_SM4, true, "aes pmull sha1 sha2")
71
72/* Enabling or disabling "crc" only changes "crc".  */
73AARCH64_OPT_EXTENSION("crc", AARCH64_FL_CRC, 0, 0, false, "crc32")
74
75/* Enabling or disabling "lse" only changes "lse".  */
76AARCH64_OPT_EXTENSION("lse", AARCH64_FL_LSE, 0, 0, false, "atomics")
77
78/* Enabling "fp16" also enables "fp".
79   Disabling "fp16" disables "fp16", "fp16fml" and "sve".  */
80AARCH64_OPT_EXTENSION("fp16", AARCH64_FL_F16, AARCH64_FL_FP, AARCH64_FL_F16FML | AARCH64_FL_SVE, false, "fphp asimdhp")
81
82/* Enabling or disabling "rcpc" only changes "rcpc".  */
83AARCH64_OPT_EXTENSION("rcpc", AARCH64_FL_RCPC, 0, 0, false, "lrcpc")
84
85/* Enabling "rdma" also enables "fp", "simd".
86   Disabling "rdma" just disables "rdma".  */
87AARCH64_OPT_EXTENSION("rdma", AARCH64_FL_RDMA, AARCH64_FL_FP | AARCH64_FL_SIMD, 0, false, "asimdrdm")
88
89/* Enabling "dotprod" also enables "simd".
90   Disabling "dotprod" only disables "dotprod".  */
91AARCH64_OPT_EXTENSION("dotprod", AARCH64_FL_DOTPROD, AARCH64_FL_SIMD, 0, false, "asimddp")
92
93/* Enabling "aes" also enables "simd".
94   Disabling "aes" just disables "aes".  */
95AARCH64_OPT_EXTENSION("aes", AARCH64_FL_AES, AARCH64_FL_SIMD, 0, false, "aes")
96
97/* Enabling "sha2" also enables "simd".
98   Disabling "sha2" just disables "sha2".  */
99AARCH64_OPT_EXTENSION("sha2", AARCH64_FL_SHA2, AARCH64_FL_SIMD, 0, false, "sha1 sha2")
100
101/* Enabling "sha3" enables "simd" and "sha2".
102   Disabling "sha3" just disables "sha3".  */
103AARCH64_OPT_EXTENSION("sha3", AARCH64_FL_SHA3, AARCH64_FL_SIMD | AARCH64_FL_SHA2, 0, false, "sha3 sha512")
104
105/* Enabling "sm4" also enables "simd".
106   Disabling "sm4" just disables "sm4".  */
107AARCH64_OPT_EXTENSION("sm4", AARCH64_FL_SM4, AARCH64_FL_SIMD, 0, false, "sm3 sm4")
108
109/* Enabling "fp16fml" also enables "fp" and "fp16".
110   Disabling "fp16fml" just disables "fp16fml".  */
111AARCH64_OPT_EXTENSION("fp16fml", AARCH64_FL_F16FML, AARCH64_FL_FP | AARCH64_FL_F16, 0, false, "asimdfhm")
112
113/* Enabling "sve" also enables "fp16", "fp" and "simd".
114   Disabling "sve" just disables "sve".  */
115AARCH64_OPT_EXTENSION("sve", AARCH64_FL_SVE, AARCH64_FL_FP | AARCH64_FL_SIMD | AARCH64_FL_F16, 0, false, "sve")
116
117/* Enabling/Disabling "profile" does not enable/disable any other feature.  */
118AARCH64_OPT_EXTENSION("profile", AARCH64_FL_PROFILE, 0, 0, false, "")
119
120/* Enabling/Disabling "rng" only changes "rng".  */
121AARCH64_OPT_EXTENSION("rng", AARCH64_FL_RNG, 0, 0, false, "rng")
122
123/* Enabling/Disabling "memtag" only changes "memtag".  */
124AARCH64_OPT_EXTENSION("memtag", AARCH64_FL_MEMTAG, 0, 0, false, "")
125
126/* Enabling/Disabling "sb" only changes "sb".  */
127AARCH64_OPT_EXTENSION("sb", AARCH64_FL_SB, 0, 0, false, "")
128
129/* Enabling/Disabling "ssbs" only changes "ssbs".  */
130AARCH64_OPT_EXTENSION("ssbs", AARCH64_FL_SSBS, 0, 0, false, "")
131
132/* Enabling/Disabling "predres" only changes "predres".  */
133AARCH64_OPT_EXTENSION("predres", AARCH64_FL_PREDRES, 0, 0, false, "")
134
135#undef AARCH64_OPT_EXTENSION
136