1 /* ACLE support for AArch64 SME.
2 Copyright (C
) 2023-2025 Free Software Foundation
, Inc.
4 This file is part of GCC.
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
)
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.
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
/>.
*/
20 #ifndef DEF_SME_FUNCTION
21 #define
DEF_SME_FUNCTION(NAME
, SHAPE
, TYPES
, PREDS
) \
22 DEF_SME_FUNCTION_GS (NAME
, SHAPE
, TYPES
, none
, PREDS
)
25 #ifndef DEF_SME_ZA_FUNCTION_GS
26 #define
DEF_SME_ZA_FUNCTION_GS(NAME
, SHAPE
, TYPES
, GROUP
, PREDS
) \
27 DEF_SME_FUNCTION_GS (NAME
, SHAPE
, TYPES
, GROUP
, PREDS
)
30 #ifndef DEF_SME_ZA_FUNCTION
31 #define
DEF_SME_ZA_FUNCTION(NAME
, SHAPE
, TYPES
, PREDS
) \
32 DEF_SME_ZA_FUNCTION_GS (NAME
, SHAPE
, TYPES
, none
, PREDS
)
35 #define REQUIRED_EXTENSIONS
streaming_compatible (0)
36 DEF_SME_FUNCTION (arm_has_sme
, bool_inherent
, none
, none
)
37 DEF_SME_FUNCTION (arm_in_streaming_mode
, bool_inherent
, none
, none
)
38 #undef REQUIRED_EXTENSIONS
40 #define REQUIRED_EXTENSIONS
streaming_compatible (AARCH64_FL_SME
)
41 DEF_SME_FUNCTION (svcntsb
, count_inherent
, none
, none
)
42 DEF_SME_FUNCTION (svcntsd
, count_inherent
, none
, none
)
43 DEF_SME_FUNCTION (svcntsh
, count_inherent
, none
, none
)
44 DEF_SME_FUNCTION (svcntsw
, count_inherent
, none
, none
)
45 DEF_SME_ZA_FUNCTION (svldr
, ldr_za
, za
, none
)
46 DEF_SME_ZA_FUNCTION (svstr
, str_za
, za
, none
)
47 DEF_SME_ZA_FUNCTION (svundef
, inherent_za
, za
, none
)
48 DEF_SME_ZA_FUNCTION (svzero
, inherent_za
, za
, none
)
49 DEF_SME_ZA_FUNCTION (svzero_mask
, inherent_mask_za
, za
, none
)
50 #undef REQUIRED_EXTENSIONS
52 #define REQUIRED_EXTENSIONS
streaming_only (0)
53 DEF_SME_ZA_FUNCTION (svaddha
, unary_za_m
, za_s_integer
, za_m
)
54 DEF_SME_ZA_FUNCTION (svaddva
, unary_za_m
, za_s_integer
, za_m
)
55 DEF_SME_ZA_FUNCTION (svld1_hor
, load_za
, all_za
, none
)
56 DEF_SME_ZA_FUNCTION (svld1_ver
, load_za
, all_za
, none
)
57 DEF_SME_ZA_FUNCTION (svmopa
, binary_za_m
, mop_base
, za_m
)
58 DEF_SME_ZA_FUNCTION (svmopa
, binary_za_m
, d_za
, za_m
)
59 DEF_SME_ZA_FUNCTION (svmops
, binary_za_m
, mop_base
, za_m
)
60 DEF_SME_ZA_FUNCTION (svmops
, binary_za_m
, d_za
, za_m
)
61 DEF_SME_ZA_FUNCTION (svread_hor
, read_za_m
, za_all_data
, m
)
62 DEF_SME_ZA_FUNCTION (svread_ver
, read_za_m
, za_all_data
, m
)
63 DEF_SME_ZA_FUNCTION (svst1_hor
, store_za
, all_za
, none
)
64 DEF_SME_ZA_FUNCTION (svst1_ver
, store_za
, all_za
, none
)
65 DEF_SME_ZA_FUNCTION (svsumopa
, binary_za_uint_m
, mop_base_signed
, za_m
)
66 DEF_SME_ZA_FUNCTION (svsumops
, binary_za_uint_m
, mop_base_signed
, za_m
)
67 DEF_SME_ZA_FUNCTION (svusmopa
, binary_za_int_m
, mop_base_unsigned
, za_m
)
68 DEF_SME_ZA_FUNCTION (svusmops
, binary_za_int_m
, mop_base_unsigned
, za_m
)
69 DEF_SME_ZA_FUNCTION (svwrite_hor
, write_za_m
, za_all_data
, za_m
)
70 DEF_SME_ZA_FUNCTION (svwrite_ver
, write_za_m
, za_all_data
, za_m
)
71 #undef REQUIRED_EXTENSIONS
73 #define REQUIRED_EXTENSIONS
streaming_only (AARCH64_FL_SME_I16I64
)
74 DEF_SME_ZA_FUNCTION (svaddha
, unary_za_m
, za_d_integer
, za_m
)
75 DEF_SME_ZA_FUNCTION (svaddva
, unary_za_m
, za_d_integer
, za_m
)
76 DEF_SME_ZA_FUNCTION (svmopa
, binary_za_m
, mop_i16i64
, za_m
)
77 DEF_SME_ZA_FUNCTION (svmops
, binary_za_m
, mop_i16i64
, za_m
)
78 DEF_SME_ZA_FUNCTION (svsumopa
, binary_za_uint_m
, mop_i16i64_signed
, za_m
)
79 DEF_SME_ZA_FUNCTION (svsumops
, binary_za_uint_m
, mop_i16i64_signed
, za_m
)
80 DEF_SME_ZA_FUNCTION (svusmopa
, binary_za_int_m
, mop_i16i64_unsigned
, za_m
)
81 DEF_SME_ZA_FUNCTION (svusmops
, binary_za_int_m
, mop_i16i64_unsigned
, za_m
)
82 #undef REQUIRED_EXTENSIONS
84 #define REQUIRED_EXTENSIONS
streaming_only (AARCH64_FL_SME_F64F64
)
85 DEF_SME_ZA_FUNCTION (svmopa
, binary_za_m
, za_d_float
, za_m
)
86 DEF_SME_ZA_FUNCTION (svmops
, binary_za_m
, za_d_float
, za_m
)
87 #undef REQUIRED_EXTENSIONS
89 #define REQUIRED_EXTENSIONS
streaming_compatible (AARCH64_FL_SME2
)
90 DEF_SME_FUNCTION (svldr_zt
, ldr_zt
, none
, none
)
91 DEF_SME_FUNCTION (svstr_zt
, str_zt
, none
, none
)
92 DEF_SME_FUNCTION (svzero_zt
, inherent_zt
, none
, none
)
93 #undef REQUIRED_EXTENSIONS
95 /* The d_za entries in this section just declare C _za64 overloads
,
96 which will then be resolved to either an integer function or a
97 floating
-point function. They are needed because the integer and
98 floating
-point functions have different architecture requirements.
*/
99 #define REQUIRED_EXTENSIONS
streaming_only (AARCH64_FL_SME2
)
100 DEF_SME_ZA_FUNCTION_GS (svadd
, unary_za_slice
, za_s_data
, vg1x24
, none
)
101 DEF_SME_ZA_FUNCTION_GS (svadd
, unary_za_slice
, d_za
, vg1x24
, none
)
102 DEF_SME_ZA_FUNCTION_GS (svadd_write
, binary_za_slice_opt_single
, za_s_integer
,
104 DEF_SME_ZA_FUNCTION (svbmopa
, binary_za_m
, za_s_unsigned
, za_m
)
105 DEF_SME_ZA_FUNCTION (svbmops
, binary_za_m
, za_s_unsigned
, za_m
)
106 DEF_SME_ZA_FUNCTION_GS (svdot
, binary_za_slice_opt_single
, za_s_h_data
,
108 DEF_SME_ZA_FUNCTION_GS (svdot
, binary_za_slice_opt_single
, za_s_b_integer
,
110 DEF_SME_ZA_FUNCTION_GS (svdot_lane
, dot_za_slice_lane
, za_s_h_data
,
112 DEF_SME_ZA_FUNCTION_GS (svdot_lane
, dot_za_slice_lane
, za_s_b_integer
,
114 DEF_SME_FUNCTION_GS (svluti2_lane_zt
, luti2_lane_zt
, bhs_data
, x124
, none
)
115 DEF_SME_FUNCTION_GS (svluti4_lane_zt
, luti4_lane_zt
, bhs_data
, x12
, none
)
116 DEF_SME_FUNCTION_GS (svluti4_lane_zt
, luti4_lane_zt
, hs_data
, x4
, none
)
117 DEF_SME_ZA_FUNCTION_GS (svmla
, binary_za_slice_opt_single
, za_s_float
,
119 DEF_SME_ZA_FUNCTION_GS (svmla
, binary_za_slice_opt_single
, za_s_h_data
,
121 DEF_SME_ZA_FUNCTION_GS (svmla
, binary_za_slice_opt_single
, za_s_b_integer
,
123 DEF_SME_ZA_FUNCTION_GS (svmla_lane
, binary_za_slice_lane
, za_s_float
,
125 DEF_SME_ZA_FUNCTION_GS (svmla_lane
, binary_za_slice_lane
, za_s_h_data
,
127 DEF_SME_ZA_FUNCTION_GS (svmla_lane
, binary_za_slice_lane
, za_s_b_integer
,
129 DEF_SME_ZA_FUNCTION_GS (svmls
, binary_za_slice_opt_single
, za_s_float
,
131 DEF_SME_ZA_FUNCTION_GS (svmls
, binary_za_slice_opt_single
, za_s_h_data
,
133 DEF_SME_ZA_FUNCTION_GS (svmls
, binary_za_slice_opt_single
, za_s_b_integer
,
135 DEF_SME_ZA_FUNCTION_GS (svmls_lane
, binary_za_slice_lane
, za_s_float
,
137 DEF_SME_ZA_FUNCTION_GS (svmls_lane
, binary_za_slice_lane
, za_s_h_data
,
139 DEF_SME_ZA_FUNCTION_GS (svmls_lane
, binary_za_slice_lane
, za_s_b_integer
,
141 DEF_SME_ZA_FUNCTION (svmopa
, binary_za_m
, za_s_h_integer
, za_m
)
142 DEF_SME_ZA_FUNCTION (svmops
, binary_za_m
, za_s_h_integer
, za_m
)
143 DEF_SME_ZA_FUNCTION_GS (svread
, read_za_slice
, za_bhsd_data
, vg1x24
, none
)
144 DEF_SME_ZA_FUNCTION_GS (svread_hor
, read_za
, za_bhsd_data
, vg24
, none
)
145 DEF_SME_ZA_FUNCTION_GS (svread_ver
, read_za
, za_bhsd_data
, vg24
, none
)
146 DEF_SME_ZA_FUNCTION_GS (svsub
, unary_za_slice
, za_s_data
, vg1x24
, none
)
147 DEF_SME_ZA_FUNCTION_GS (svsub
, unary_za_slice
, d_za
, vg1x24
, none
)
148 DEF_SME_ZA_FUNCTION_GS (svsub_write
, binary_za_slice_opt_single
, za_s_integer
,
150 DEF_SME_ZA_FUNCTION_GS (svsudot
, binary_za_slice_uint_opt_single
,
151 za_s_b_signed
, vg1x24
, none
)
152 DEF_SME_ZA_FUNCTION_GS (svsudot_lane
, dot_za_slice_uint_lane
,
153 za_s_b_signed
, vg1x24
, none
)
154 DEF_SME_ZA_FUNCTION_GS (svsuvdot_lane
, dot_za_slice_uint_lane
,
155 za_s_b_signed
, vg1x4
, none
)
156 DEF_SME_ZA_FUNCTION_GS (svusdot
, binary_za_slice_int_opt_single
,
157 za_s_b_unsigned
, vg1x24
, none
)
158 DEF_SME_ZA_FUNCTION_GS (svusdot_lane
, dot_za_slice_int_lane
,
159 za_s_b_unsigned
, vg1x24
, none
)
160 DEF_SME_ZA_FUNCTION_GS (svusvdot_lane
, dot_za_slice_int_lane
,
161 za_s_b_unsigned
, vg1x4
, none
)
162 DEF_SME_ZA_FUNCTION_GS (svvdot_lane
, dot_za_slice_lane
, za_s_h_data
,
164 DEF_SME_ZA_FUNCTION_GS (svvdot_lane
, dot_za_slice_lane
, za_s_b_integer
,
166 DEF_SME_ZA_FUNCTION_GS (svwrite
, write_za_slice
, za_bhsd_data
, vg1x24
, none
)
167 DEF_SME_ZA_FUNCTION_GS (svwrite_hor
, write_za
, za_bhsd_data
, vg24
, none
)
168 DEF_SME_ZA_FUNCTION_GS (svwrite_ver
, write_za
, za_bhsd_data
, vg24
, none
)
169 #undef REQUIRED_EXTENSIONS
171 #define REQUIRED_EXTENSIONS
streaming_only (AARCH64_FL_SME2 \
172 | AARCH64_FL_SME_I16I64
)
173 DEF_SME_ZA_FUNCTION_GS (svadd
, unary_za_slice
, za_d_integer
, vg1x24
, none
)
174 DEF_SME_ZA_FUNCTION_GS (svadd_write
, binary_za_slice_opt_single
, za_d_integer
,
176 DEF_SME_ZA_FUNCTION_GS (svdot
, binary_za_slice_opt_single
, za_d_h_integer
,
178 DEF_SME_ZA_FUNCTION_GS (svdot_lane
, dot_za_slice_lane
, za_d_h_integer
,
180 DEF_SME_ZA_FUNCTION_GS (svmla
, binary_za_slice_opt_single
, za_d_h_integer
,
182 DEF_SME_ZA_FUNCTION_GS (svmla_lane
, binary_za_slice_lane
, za_d_h_integer
,
184 DEF_SME_ZA_FUNCTION_GS (svmls
, binary_za_slice_opt_single
, za_d_h_integer
,
186 DEF_SME_ZA_FUNCTION_GS (svmls_lane
, binary_za_slice_lane
, za_d_h_integer
,
188 DEF_SME_ZA_FUNCTION_GS (svsub
, unary_za_slice
, za_d_integer
, vg1x24
, none
)
189 DEF_SME_ZA_FUNCTION_GS (svsub_write
, binary_za_slice_opt_single
, za_d_integer
,
191 DEF_SME_ZA_FUNCTION_GS (svvdot_lane
, dot_za_slice_lane
, za_d_h_integer
,
193 #undef REQUIRED_EXTENSIONS
195 #define REQUIRED_EXTENSIONS
streaming_only (AARCH64_FL_SME2 \
196 | AARCH64_FL_SME_F64F64
)
197 DEF_SME_ZA_FUNCTION_GS (svadd
, unary_za_slice
, za_d_float
, vg1x24
, none
)
198 DEF_SME_ZA_FUNCTION_GS (svmla
, binary_za_slice_opt_single
, za_d_float
,
200 DEF_SME_ZA_FUNCTION_GS (svmla_lane
, binary_za_slice_lane
, za_d_float
,
202 DEF_SME_ZA_FUNCTION_GS (svmls
, binary_za_slice_opt_single
, za_d_float
,
204 DEF_SME_ZA_FUNCTION_GS (svmls_lane
, binary_za_slice_lane
, za_d_float
,
206 DEF_SME_ZA_FUNCTION_GS (svsub
, unary_za_slice
, za_d_float
, vg1x24
, none
)
207 #undef REQUIRED_EXTENSIONS
209 #define REQUIRED_EXTENSIONS
streaming_only (AARCH64_FL_SME_F16F16
)
210 DEF_SME_ZA_FUNCTION_GS (svadd
, unary_za_slice
, za_h_float
, vg1x24
, none
)
211 DEF_SME_ZA_FUNCTION_GS (svmla
, binary_za_slice_opt_single
, za_h_float
,
213 DEF_SME_ZA_FUNCTION_GS (svmla_lane
, binary_za_slice_lane
, za_h_float
,
215 DEF_SME_ZA_FUNCTION_GS (svmls
, binary_za_slice_opt_single
, za_h_float
,
217 DEF_SME_ZA_FUNCTION_GS (svmls_lane
, binary_za_slice_lane
, za_h_float
,
219 DEF_SME_ZA_FUNCTION (svmopa
, binary_za_m
, za_h_float
, za_m
)
220 DEF_SME_ZA_FUNCTION (svmops
, binary_za_m
, za_h_float
, za_m
)
221 DEF_SME_ZA_FUNCTION_GS (svsub
, unary_za_slice
, za_h_float
, vg1x24
, none
)
222 #undef REQUIRED_EXTENSIONS
224 #define REQUIRED_EXTENSIONS
streaming_only (AARCH64_FL_SME_B16B16
)
225 DEF_SME_ZA_FUNCTION_GS (svadd
, unary_za_slice
, za_h_bfloat
, vg1x24
, none
)
226 DEF_SME_ZA_FUNCTION_GS (svmla
, binary_za_slice_opt_single
, za_h_bfloat
,
228 DEF_SME_ZA_FUNCTION_GS (svmla_lane
, binary_za_slice_lane
, za_h_bfloat
,
230 DEF_SME_ZA_FUNCTION_GS (svmls
, binary_za_slice_opt_single
, za_h_bfloat
,
232 DEF_SME_ZA_FUNCTION_GS (svmls_lane
, binary_za_slice_lane
, za_h_bfloat
,
234 DEF_SME_ZA_FUNCTION (svmopa
, binary_za_m
, za_h_bfloat
, za_m
)
235 DEF_SME_ZA_FUNCTION (svmops
, binary_za_m
, za_h_bfloat
, za_m
)
236 DEF_SME_ZA_FUNCTION_GS (svsub
, unary_za_slice
, za_h_bfloat
, vg1x24
, none
)
237 #undef REQUIRED_EXTENSIONS
239 #define REQUIRED_EXTENSIONS
streaming_only (AARCH64_FL_SME2p1
)
240 DEF_SME_ZA_FUNCTION_GS (svreadz
, read_za_slice
, za_bhsd_data
, vg1x24
, none
)
241 DEF_SME_ZA_FUNCTION (svreadz_hor
, read_za
, za_all_data
, none
)
242 DEF_SME_ZA_FUNCTION_GS (svreadz_hor
, read_za
, za_bhsd_data
, vg24
, none
)
243 DEF_SME_ZA_FUNCTION (svreadz_ver
, read_za
, za_all_data
, none
)
244 DEF_SME_ZA_FUNCTION_GS (svreadz_ver
, read_za
, za_bhsd_data
, vg24
, none
)
245 DEF_SME_ZA_FUNCTION_GS (svzero
, inherent_za_slice
, d_za
, vg1x24
, none
)
246 DEF_SME_ZA_FUNCTION_GS (svzero
, inherent_za_slice
, d_za
, vg2
, none
)
247 DEF_SME_ZA_FUNCTION_GS (svzero
, inherent_za_slice
, d_za
, vg4
, none
)
248 #undef REQUIRED_EXTENSIONS
250 #undef DEF_SME_ZA_FUNCTION
251 #undef DEF_SME_ZA_FUNCTION_GS
252 #undef DEF_SME_FUNCTION