1 /* glibc-hwcaps subdirectory test. x86_64 version.
2 Copyright (C) 2020-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library 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 GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
20 #include <support/check.h>
21 #include <sys/param.h>
23 #include <get-isa-level.h>
25 extern int marker2 (void);
26 extern int marker3 (void);
27 extern int marker4 (void);
29 /* Return the x86-64-vN level, 1 for the baseline. */
33 const struct cpu_features
*cpu_features
= __get_cpu_features ();
34 unsigned int isa_level
= get_isa_level (cpu_features
);
36 if (!(isa_level
& GNU_PROPERTY_X86_ISA_1_V2
))
38 if (!(isa_level
& GNU_PROPERTY_X86_ISA_1_V3
))
40 if (!(isa_level
& GNU_PROPERTY_X86_ISA_1_V4
))
48 int level
= compute_level ();
49 printf ("info: detected x86-64 micro-architecture level: %d\n", level
);
50 TEST_COMPARE (marker2 (), MIN (level
, 2));
51 TEST_COMPARE (marker3 (), MIN (level
, 3));
52 TEST_COMPARE (marker4 (), MIN (level
, 4));
56 #include <support/test-driver.c>