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. */
24 #include <sys/prctl.h>
27 do_sve_ioctl_test (void)
31 res
= prctl (PR_SVE_GET_VL
, 0, 0, 0, 0);
34 printf ("FAILED to PR_SVE_GET_VL (%d)", res
);
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 */
45 printf ("FAILED to PR_SVE_SET_VL (%d)", res
);
53 main (int argc
, char **argv
)
55 if (getauxval (AT_HWCAP
) & HWCAP_SVE
)
57 return do_sve_ioctl_test ();
61 printf ("SKIP: no HWCAP_SVE on this system\n");