1 | /* $Id: bs3-cpu-instr-2.c 103584 2024-02-27 10:35:22Z 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(bs3CpuInstr2_adcx_adox);
|
---|
69 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_movbe);
|
---|
70 | BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_cmpxchg8b);
|
---|
71 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_cmpxchg16b);
|
---|
72 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_wrfsbase);
|
---|
73 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_wrgsbase);
|
---|
74 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_rdfsbase);
|
---|
75 | BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_rdgsbase);
|
---|
76 |
|
---|
77 |
|
---|
78 | /*********************************************************************************************************************************
|
---|
79 | * Global Variables *
|
---|
80 | *********************************************************************************************************************************/
|
---|
81 | static const BS3TESTMODEENTRY g_aModeTests[] =
|
---|
82 | {
|
---|
83 | #if 1
|
---|
84 | BS3TESTMODEENTRY_CMN("mul", bs3CpuInstr2_mul),
|
---|
85 | BS3TESTMODEENTRY_CMN("imul", bs3CpuInstr2_imul),
|
---|
86 | BS3TESTMODEENTRY_CMN("div", bs3CpuInstr2_div),
|
---|
87 | BS3TESTMODEENTRY_CMN("idiv", bs3CpuInstr2_idiv),
|
---|
88 | #endif
|
---|
89 | #if 1 /* BSF/BSR (386+) & TZCNT/LZCNT (BMI1,ABM) */
|
---|
90 | BS3TESTMODEENTRY_CMN("bsf/tzcnt", bs3CpuInstr2_bsf_tzcnt),
|
---|
91 | BS3TESTMODEENTRY_CMN("bsr/lzcnt", bs3CpuInstr2_bsr_lzcnt),
|
---|
92 | #endif
|
---|
93 | #if 1 /* BMI1 */
|
---|
94 | BS3TESTMODEENTRY_CMN("andn", bs3CpuInstr2_andn),
|
---|
95 | BS3TESTMODEENTRY_CMN("bextr", bs3CpuInstr2_bextr),
|
---|
96 | BS3TESTMODEENTRY_CMN("blsr", bs3CpuInstr2_blsr),
|
---|
97 | BS3TESTMODEENTRY_CMN("blsmsk", bs3CpuInstr2_blsmsk),
|
---|
98 | BS3TESTMODEENTRY_CMN("blsi", bs3CpuInstr2_blsi),
|
---|
99 | #endif
|
---|
100 | #if 1 /* BMI2 */
|
---|
101 | BS3TESTMODEENTRY_CMN("bzhi", bs3CpuInstr2_bzhi),
|
---|
102 | BS3TESTMODEENTRY_CMN("pdep", bs3CpuInstr2_pdep),
|
---|
103 | BS3TESTMODEENTRY_CMN("pext", bs3CpuInstr2_pext),
|
---|
104 | BS3TESTMODEENTRY_CMN("rorx", bs3CpuInstr2_rorx),
|
---|
105 | BS3TESTMODEENTRY_CMN("shlx", bs3CpuInstr2_shlx),
|
---|
106 | BS3TESTMODEENTRY_CMN("sarx", bs3CpuInstr2_sarx),
|
---|
107 | BS3TESTMODEENTRY_CMN("shrx", bs3CpuInstr2_shrx),
|
---|
108 | BS3TESTMODEENTRY_CMN("mulx", bs3CpuInstr2_mulx),
|
---|
109 | #endif
|
---|
110 | #if 1
|
---|
111 | BS3TESTMODEENTRY_CMN("popcnt", bs3CpuInstr2_popcnt), /* Intel: POPCNT; AMD: ABM */
|
---|
112 | BS3TESTMODEENTRY_CMN("crc32", bs3CpuInstr2_crc32), /* SSE4.2 */
|
---|
113 | BS3TESTMODEENTRY_CMN("adcx/adox", bs3CpuInstr2_adcx_adox), /* ADX */
|
---|
114 | BS3TESTMODEENTRY_CMN("movbe", bs3CpuInstr2_movbe), /* MOVBE */
|
---|
115 | BS3TESTMODEENTRY_CMN("cmpxchg8b", bs3CpuInstr2_cmpxchg8b),
|
---|
116 | #endif
|
---|
117 | #if 1
|
---|
118 | BS3TESTMODEENTRY_CMN_64("cmpxchg16b", bs3CpuInstr2_cmpxchg16b),
|
---|
119 | BS3TESTMODEENTRY_CMN_64("wrfsbase", bs3CpuInstr2_wrfsbase),
|
---|
120 | BS3TESTMODEENTRY_CMN_64("wrgsbase", bs3CpuInstr2_wrgsbase),
|
---|
121 | BS3TESTMODEENTRY_CMN_64("rdfsbase", bs3CpuInstr2_rdfsbase),
|
---|
122 | BS3TESTMODEENTRY_CMN_64("rdgsbase", bs3CpuInstr2_rdgsbase),
|
---|
123 | #endif
|
---|
124 | };
|
---|
125 |
|
---|
126 |
|
---|
127 | BS3_DECL(void) Main_rm()
|
---|
128 | {
|
---|
129 | Bs3InitAll_rm();
|
---|
130 | Bs3TestInit("bs3-cpu-instr-2");
|
---|
131 |
|
---|
132 | Bs3TestDoModes_rm(g_aModeTests, RT_ELEMENTS(g_aModeTests));
|
---|
133 |
|
---|
134 | Bs3TestTerm();
|
---|
135 | }
|
---|
136 |
|
---|