aboutsummaryrefslogtreecommitdiff
path: root/gdb/features/aarch64-sve.c
blob: 966d83e7721c020e263ddc67fa03ed700d438a84 (plain)
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
/* Copyright (C) 2018-2023 Free Software Foundation, Inc.

   This file is part of GDB.

   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 3 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, see <http://www.gnu.org/licenses/>.  */

#include "gdbsupport/tdesc.h"

/* This function is NOT auto generated from xml.  Create the aarch64 with SVE
   feature into RESULT, where SCALE is the number of 128 bit chunks in a Z
   register.  */

static int
create_feature_aarch64_sve (struct target_desc *result, long regnum,
			    uint64_t scale)
{
  struct tdesc_feature *feature;
  tdesc_type *element_type, *field_type;
  tdesc_type_with_fields *type_with_fields;

  feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.sve");

  element_type = tdesc_named_type (feature, "uint128");
  tdesc_create_vector (feature, "svevqu", element_type, scale);

  element_type = tdesc_named_type (feature, "int128");
  tdesc_create_vector (feature, "svevqs", element_type, scale);

  element_type = tdesc_named_type (feature, "ieee_double");
  tdesc_create_vector (feature, "svevdf", element_type, 2 * scale);

  element_type = tdesc_named_type (feature, "uint64");
  tdesc_create_vector (feature, "svevdu", element_type, 2 * scale);

  element_type = tdesc_named_type (feature, "int64");
  tdesc_create_vector (feature, "svevds", element_type, 2 * scale);

  element_type = tdesc_named_type (feature, "ieee_single");
  tdesc_create_vector (feature, "svevsf", element_type, 4 * scale);

  element_type = tdesc_named_type (feature, "uint32");
  tdesc_create_vector (feature, "svevsu", element_type, 4 * scale);

  element_type = tdesc_named_type (feature, "int32");
  tdesc_create_vector (feature, "svevss", element_type, 4 * scale);

  element_type = tdesc_named_type (feature, "ieee_half");
  tdesc_create_vector (feature, "svevhf", element_type, 8 * scale);

  element_type = tdesc_named_type (feature, "uint16");
  tdesc_create_vector (feature, "svevhu", element_type, 8 * scale);

  element_type = tdesc_named_type (feature, "int16");
  tdesc_create_vector (feature, "svevhs", element_type, 8 * scale);

  element_type = tdesc_named_type (feature, "uint8");
  tdesc_create_vector (feature, "svevbu", element_type, 16 * scale);

  element_type = tdesc_named_type (feature, "int8");
  tdesc_create_vector (feature, "svevbs", element_type, 16 * scale);

  type_with_fields = tdesc_create_union (feature, "svevnq");
  field_type = tdesc_named_type (feature, "svevqu");
  tdesc_add_field (type_with_fields, "u", field_type);
  field_type = tdesc_named_type (feature, "svevqs");
  tdesc_add_field (type_with_fields, "s", field_type);

  type_with_fields = tdesc_create_union (feature, "svevnd");
  field_type = tdesc_named_type (feature, "svevdf");
  tdesc_add_field (type_with_fields, "f", field_type);
  field_type = tdesc_named_type (feature, "svevdu");
  tdesc_add_field (type_with_fields, "u", field_type);
  field_type = tdesc_named_type (feature, "svevds");
  tdesc_add_field (type_with_fields, "s", field_type);

  type_with_fields = tdesc_create_union (feature, "svevns");
  field_type = tdesc_named_type (feature, "svevsf");
  tdesc_add_field (type_with_fields, "f", field_type);
  field_type = tdesc_named_type (feature, "svevsu");
  tdesc_add_field (type_with_fields, "u", field_type);
  field_type = tdesc_named_type (feature, "svevss");
  tdesc_add_field (type_with_fields, "s", field_type);

  type_with_fields = tdesc_create_union (feature, "svevnh");
  field_type = tdesc_named_type (feature, "svevhf");
  tdesc_add_field (type_with_fields, "f", field_type);
  field_type = tdesc_named_type (feature, "svevhu");
  tdesc_add_field (type_with_fields, "u", field_type);
  field_type = tdesc_named_type (feature, "svevhs");
  tdesc_add_field (type_with_fields, "s", field_type);

  type_with_fields = tdesc_create_union (feature, "svevnb");
  field_type = tdesc_named_type (feature, "svevbu");
  tdesc_add_field (type_with_fields, "u", field_type);
  field_type = tdesc_named_type (feature, "svevbs");
  tdesc_add_field (type_with_fields, "s", field_type);

  type_with_fields = tdesc_create_union (feature, "svev");
  field_type = tdesc_named_type (feature, "svevnq");
  tdesc_add_field (type_with_fields, "q", field_type);
  field_type = tdesc_named_type (feature, "svevnd");
  tdesc_add_field (type_with_fields, "d", field_type);
  field_type = tdesc_named_type (feature, "svevns");
  tdesc_add_field (type_with_fields, "s", field_type);
  field_type = tdesc_named_type (feature, "svevnh");
  tdesc_add_field (type_with_fields, "h", field_type);
  field_type = tdesc_named_type (feature, "svevnb");
  tdesc_add_field (type_with_fields, "b", field_type);

  field_type = tdesc_named_type (feature, "uint8");
  tdesc_create_vector (feature, "svep", field_type, 2 * scale);

  /* FPSR register type */
  type_with_fields = tdesc_create_flags (feature, "fpsr_flags", 4);
  tdesc_add_flag (type_with_fields, 0, "IOC");
  tdesc_add_flag (type_with_fields, 1, "DZC");
  tdesc_add_flag (type_with_fields, 2, "OFC");
  tdesc_add_flag (type_with_fields, 3, "UFC");
  tdesc_add_flag (type_with_fields, 4, "IXC");
  tdesc_add_flag (type_with_fields, 7, "IDC");
  tdesc_add_flag (type_with_fields, 27, "QC");
  tdesc_add_flag (type_with_fields, 28, "V");
  tdesc_add_flag (type_with_fields, 29, "C");
  tdesc_add_flag (type_with_fields, 30, "Z");
  tdesc_add_flag (type_with_fields, 31, "N");

  /* FPCR register type */
  type_with_fields = tdesc_create_flags (feature, "fpcr_flags", 4);
  tdesc_add_flag (type_with_fields, 0, "FIZ");
  tdesc_add_flag (type_with_fields, 1, "AH");
  tdesc_add_flag (type_with_fields, 2, "NEP");
  tdesc_add_flag (type_with_fields, 8, "IOE");
  tdesc_add_flag (type_with_fields, 9, "DZE");
  tdesc_add_flag (type_with_fields, 10, "OFE");
  tdesc_add_flag (type_with_fields, 11, "UFE");
  tdesc_add_flag (type_with_fields, 12, "IXE");
  tdesc_add_flag (type_with_fields, 13, "EBF");
  tdesc_add_flag (type_with_fields, 15, "IDE");
  tdesc_add_bitfield (type_with_fields, "Len", 16, 18);
  tdesc_add_flag (type_with_fields, 19, "FZ16");
  tdesc_add_bitfield (type_with_fields, "Stride", 20, 21);
  tdesc_add_bitfield (type_with_fields, "RMode", 22, 23);
  tdesc_add_flag (type_with_fields, 24, "FZ");
  tdesc_add_flag (type_with_fields, 25, "DN");
  tdesc_add_flag (type_with_fields, 26, "AHP");

  tdesc_create_reg (feature, "z0", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z1", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z2", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z3", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z4", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z5", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z6", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z7", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z8", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z9", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z10", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z11", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z12", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z13", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z14", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z15", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z16", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z17", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z18", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z19", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z20", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z21", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z22", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z23", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z24", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z25", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z26", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z27", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z28", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z29", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z30", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "z31", regnum++, 1, NULL, 128 * scale, "svev");
  tdesc_create_reg (feature, "fpsr", regnum++, 1, NULL, 32, "fpsr_flags");
  tdesc_create_reg (feature, "fpcr", regnum++, 1, NULL, 32, "fpcr_flags");
  tdesc_create_reg (feature, "p0", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p1", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p2", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p3", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p4", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p5", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p6", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p7", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p8", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p9", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p10", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p11", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p12", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p13", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p14", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "p15", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "ffr", regnum++, 1, NULL, 16 * scale, "svep");
  tdesc_create_reg (feature, "vg", regnum++, 1, NULL, 64, "int");
  return regnum;
}