xref: /illumos-gate/usr/src/test/os-tests/tests/xsave/xsu_hwtype.c (revision 763f1f5f97e4c16840af2ced98915f0ed0f46616)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2023 Oxide Computer Company
14  */
15 
16 /*
17  * This is meant for scripts to determine what kind of hardware support we
18  * actually have for output files and related. Currently the tests don't
19  * supports CPUs that somehow have xsave support, but don't have AVX support and
20  * thus ymm registers. xsu_hwsupport() requires that we have the XSAVE feature
21  * and only returns XMM if it doesn't exist, hence why this is considered a
22  * failure below.
23  */
24 
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include "xsave_util.h"
28 
29 int
30 main(void)
31 {
32 	uint32_t hwsup = xsu_hwsupport();
33 
34 	switch (hwsup) {
35 	case XSU_YMM:
36 		(void) printf("ymm\n");
37 		break;
38 	case XSU_ZMM:
39 		(void) printf("zmm\n");
40 		break;
41 	default:
42 		return (EXIT_FAILURE);
43 	}
44 
45 	return (EXIT_SUCCESS);
46 }
47