GDB: trad-frame: Store length of value_bytes in trad_frame_saved_reg
[binutils-gdb.git] / gdb / testsuite / gdb.arch / aarch64-sve.c
blob268922aef6910819322cb55af43d7539ef318b99
1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2022-2024 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 /* Exercise AArch64's Scalable Vector Extension.
20 This test was based on QEMU's sve-ioctls.c test file. */
22 #include <stdio.h>
23 #include <sys/auxv.h>
24 #include <sys/prctl.h>
26 static int
27 do_sve_ioctl_test (void)
29 int i, res, init_vl;
31 res = prctl (PR_SVE_GET_VL, 0, 0, 0, 0);
32 if (res < 0)
34 printf ("FAILED to PR_SVE_GET_VL (%d)", res);
35 return -1;
37 init_vl = res & PR_SVE_VL_LEN_MASK;
39 for (i = init_vl; i > 15; i /= 2)
41 printf ("Checking PR_SVE_SET_VL=%d\n", i);
42 res = prctl (PR_SVE_SET_VL, i, 0, 0, 0, 0); /* break here */
43 if (res < 0)
45 printf ("FAILED to PR_SVE_SET_VL (%d)", res);
46 return -1;
49 return 0;
52 int
53 main (int argc, char **argv)
55 if (getauxval (AT_HWCAP) & HWCAP_SVE)
57 return do_sve_ioctl_test ();
59 else
61 printf ("SKIP: no HWCAP_SVE on this system\n");
62 return 1;