1 | /* $Id: bs3-cpu-instr-2.c 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * BS3Kit - bs3-cpu-instr-2, 16-bit C code.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 |
|
---|
38 | /*********************************************************************************************************************************
|
---|
39 | * Header Files *
|
---|
40 | *********************************************************************************************************************************/
|
---|
41 | #include <bs3kit.h>
|
---|
42 |
|
---|
43 |
|
---|
44 | /*********************************************************************************************************************************
|
---|
45 | * Internal Functions *
|
---|
46 | *********************************************************************************************************************************/
|
---|
47 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_mul);
|
---|
48 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_imul);
|
---|
49 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_div);
|
---|
50 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_idiv);
|
---|
51 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bsf_tzcnt);
|
---|
52 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bsr_lzcnt);
|
---|
53 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_andn);
|
---|
54 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bextr);
|
---|
55 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_blsr);
|
---|
56 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_blsmsk);
|
---|
57 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_blsi);
|
---|
58 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bzhi);
|
---|
59 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_pdep);
|
---|
60 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_pext);
|
---|
61 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_rorx);
|
---|
62 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_shlx);
|
---|
63 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_sarx);
|
---|
64 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_shrx);
|
---|
65 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_mulx);
|
---|
66 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_popcnt);
|
---|
67 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_crc32);
|
---|
68 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_cmpxchg16b);
|
---|
69 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_wrfsbase);
|
---|
70 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_wrgsbase);
|
---|
71 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_rdfsbase);
|
---|
72 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_rdgsbase);
|
---|
73 |
|
---|
74 |
|
---|
75 | /*********************************************************************************************************************************
|
---|
76 | * Global Variables *
|
---|
77 | *********************************************************************************************************************************/
|
---|
78 | static const BS3TESTMODEENTRY g_aModeTests[] =
|
---|
79 | {
|
---|
80 | #if 1
|
---|
81 | BS3TESTMODEENTRY_CMN("mul", bs3CpuInstr2_mul),
|
---|
82 | BS3TESTMODEENTRY_CMN("imul", bs3CpuInstr2_imul),
|
---|
83 | BS3TESTMODEENTRY_CMN("div", bs3CpuInstr2_div),
|
---|
84 | BS3TESTMODEENTRY_CMN("idiv", bs3CpuInstr2_idiv),
|
---|
85 | #endif
|
---|
86 | #if 1 /* BSF/BSR (386+) & TZCNT/LZCNT (BMI1,ABM) */
|
---|
87 | BS3TESTMODEENTRY_CMN("bsf/tzcnt", bs3CpuInstr2_bsf_tzcnt),
|
---|
88 | BS3TESTMODEENTRY_CMN("bsr/lzcnt", bs3CpuInstr2_bsr_lzcnt),
|
---|
89 | #endif
|
---|
90 | #if 1 /* BMI1 */
|
---|
91 | BS3TESTMODEENTRY_CMN("andn", bs3CpuInstr2_andn),
|
---|
92 | BS3TESTMODEENTRY_CMN("bextr", bs3CpuInstr2_bextr),
|
---|
93 | BS3TESTMODEENTRY_CMN("blsr", bs3CpuInstr2_blsr),
|
---|
94 | BS3TESTMODEENTRY_CMN("blsmsk", bs3CpuInstr2_blsmsk),
|
---|
95 | BS3TESTMODEENTRY_CMN("blsi", bs3CpuInstr2_blsi),
|
---|
96 | #endif
|
---|
97 | #if 1 /* BMI2 */
|
---|
98 | BS3TESTMODEENTRY_CMN("bzhi", bs3CpuInstr2_bzhi),
|
---|
99 | BS3TESTMODEENTRY_CMN("pdep", bs3CpuInstr2_pdep),
|
---|
100 | BS3TESTMODEENTRY_CMN("pext", bs3CpuInstr2_pext),
|
---|
101 | BS3TESTMODEENTRY_CMN("rorx", bs3CpuInstr2_rorx),
|
---|
102 | BS3TESTMODEENTRY_CMN("shlx", bs3CpuInstr2_shlx),
|
---|
103 | BS3TESTMODEENTRY_CMN("sarx", bs3CpuInstr2_sarx),
|
---|
104 | BS3TESTMODEENTRY_CMN("shrx", bs3CpuInstr2_shrx),
|
---|
105 | BS3TESTMODEENTRY_CMN("mulx", bs3CpuInstr2_mulx),
|
---|
106 | #endif
|
---|
107 | #if 1
|
---|
108 | BS3TESTMODEENTRY_CMN("popcnt", bs3CpuInstr2_popcnt), /* Intel: POPCNT; AMD: ABM */
|
---|
109 | BS3TESTMODEENTRY_CMN("crc32", bs3CpuInstr2_crc32), /* SSE4.2 */
|
---|
110 | #endif
|
---|
111 | #if 1
|
---|
112 | BS3TESTMODEENTRY_CMN_64("cmpxchg16b", bs3CpuInstr2_cmpxchg16b),
|
---|
113 | BS3TESTMODEENTRY_CMN_64("wrfsbase", bs3CpuInstr2_wrfsbase),
|
---|
114 | BS3TESTMODEENTRY_CMN_64("wrgsbase", bs3CpuInstr2_wrgsbase),
|
---|
115 | BS3TESTMODEENTRY_CMN_64("rdfsbase", bs3CpuInstr2_rdfsbase),
|
---|
116 | BS3TESTMODEENTRY_CMN_64("rdgsbase", bs3CpuInstr2_rdgsbase),
|
---|
117 | #endif
|
---|
118 | };
|
---|
119 |
|
---|
120 |
|
---|
121 | BS3_DECL(void) Main_rm()
|
---|
122 | {
|
---|
123 | Bs3InitAll_rm();
|
---|
124 | Bs3TestInit("bs3-cpu-instr-2");
|
---|
125 |
|
---|
126 | Bs3TestDoModes_rm(g_aModeTests, RT_ELEMENTS(g_aModeTests));
|
---|
127 |
|
---|
128 | Bs3TestTerm();
|
---|
129 | }
|
---|
130 |
|
---|