Changeset 94409 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Mar 31, 2022 10:42:18 AM (3 years ago)
- Location:
- trunk/src/VBox/VMM/testcase
- Files:
-
- 9 added
- 5 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/Makefile.kmk
r94155 r94409 219 219 220 220 # 221 # Gl boal config tool.221 # Global config tool. 222 222 # 223 223 if defined(VBOX_WITH_HARDENING) && "$(KBUILD_TARGET)" == "win" … … 237 237 tstGlobalConfig_LIBS = $(LIB_RUNTIME) 238 238 239 239 240 # 240 241 # Testcase for checking the C (IEMAllAImplC.cpp) and assembly (IEMAllAImpl.asm) … … 245 246 tstIEMAImpl_TEMPLATE = VBOXR3TSTEXE 246 247 tstIEMAImpl_DEFS = $(VMM_COMMON_DEFS) IEM_WITHOUT_ASSEMBLY IN_TSTVMSTRUCT 247 tstIEMAImpl_INCS = ../include 248 tstIEMAImpl_INCS = ../include . 249 tstIEMAImpl_CLEAN = \ 250 $(tstIEMAImpl_0_OUTDIR)/tstIEMAImplDataInt.cpp \ 251 $(tstIEMAImpl_0_OUTDIR)/tstIEMAImplDataInt-Amd.cpp \ 252 $(tstIEMAImpl_0_OUTDIR)/tstIEMAImplDataInt-Intel.cpp \ 253 $(tstIEMAImpl_0_OUTDIR)/tstIEMAImplDataFpuLdSt.cpp \ 254 $(tstIEMAImpl_0_OUTDIR)/tstIEMAImplDataFpuBinary1.cpp \ 255 $(tstIEMAImpl_0_OUTDIR)/tstIEMAImplDataFpuBinary2.cpp 248 256 tstIEMAImpl_SOURCES = \ 249 257 tstIEMAImpl.cpp \ 250 ../VMMAll/IEMAllAImplC.cpp 258 ../VMMAll/IEMAllAImplC.cpp \ 259 $(tstIEMAImpl_CLEAN) 260 $(call KB_FN_DO_PASS0_ON_TARGET,tstIEMAImpl) 251 261 252 262 # This variant mainly for generating data. 253 263 tstIEMAImplAsm_TEMPLATE = VBOXR3TSTEXE 254 264 tstIEMAImplAsm_DEFS = $(VMM_COMMON_DEFS) IEM_WITH_ASSEMBLY IN_TSTVMSTRUCT TSTIEMAIMPL_WITH_GENERATOR 255 tstIEMAImplAsm_INCS = ../include 265 tstIEMAImplAsm_INCS = ../include . 256 266 tstIEMAImplAsm_SOURCES = \ 257 267 tstIEMAImpl.cpp \ 258 268 ../VMMAll/IEMAllAImpl.asm \ 259 ../VMMAll/IEMAllAImplC.cpp 269 ../VMMAll/IEMAllAImplC.cpp \ 270 $(tstIEMAImpl_CLEAN) 271 272 ## @param 1 The sub-name of the file in question. 273 define def_tstIEMAImplData_adjust 274 $$(tstIEMAImpl_0_OUTDIR)/tstIEMAImplData$(1).cpp: \ 275 $$(tstIEMAImpl_DEFPATH)/tstIEMAImplData$(1).cpp \ 276 $$(tstIEMAImpl_DEFPATH)/tstIEMAImplData.sh \ 277 $$(tstIEMAImpl_DEFPATH)/tstIEMAImpl.h \ 278 | $$(tstIEMAImpl_0_OUTDIR)/ 279 $$(ASH) "$$(tstIEMAImpl_DEFPATH)/tstIEMAImplData.sh" \ 280 "$$(CP_EXT)" \ 281 "$$(MV_EXT)" \ 282 "$$(SED_EXT)" \ 283 "$$(tstIEMAImpl_0_OUTDIR)" \ 284 "$$(tstIEMAImpl_DEFPATH)" \ 285 "$(1)" 286 endef 287 $(evalcall2 def_tstIEMAImplData_adjust,Int) 288 $(evalcall2 def_tstIEMAImplData_adjust,Int-Amd) 289 $(evalcall2 def_tstIEMAImplData_adjust,Int-Intel) 290 $(evalcall2 def_tstIEMAImplData_adjust,FpuLdSt) 291 $(evalcall2 def_tstIEMAImplData_adjust,FpuBinary1) 292 $(evalcall2 def_tstIEMAImplData_adjust,FpuBinary2) 293 260 294 261 295 # -
trunk/src/VBox/VMM/testcase/tstIEMAImpl.cpp
r94402 r94409 35 35 #include <iprt/test.h> 36 36 37 38 /********************************************************************************************************************************* 39 * Structures and Typedefs * 40 *********************************************************************************************************************************/ 41 /** @name 8-bit binary (PFNIEMAIMPLBINU8) 42 * @{ */ 43 typedef struct BINU8_TEST_T 44 { 45 uint32_t fEflIn; 46 uint32_t fEflOut; 47 uint8_t uDstIn; 48 uint8_t uDstOut; 49 uint8_t uSrcIn; 50 uint8_t uMisc; 51 } BINU8_TEST_T; 52 53 typedef struct BINU8_T 54 { 55 const char *pszName; 56 PFNIEMAIMPLBINU8 pfn; 57 PFNIEMAIMPLBINU8 pfnNative; 58 BINU8_TEST_T const *paTests; 59 uint32_t cTests; 60 uint32_t uExtra; 61 uint8_t idxCpuEflFlavour; 62 } BINU8_T; 63 /** @} */ 64 65 66 /** @name 16-bit binary (PFNIEMAIMPLBINU16) 67 * @{ */ 68 typedef struct BINU16_TEST_T 69 { 70 uint32_t fEflIn; 71 uint32_t fEflOut; 72 uint16_t uDstIn; 73 uint16_t uDstOut; 74 uint16_t uSrcIn; 75 uint16_t uMisc; 76 } BINU16_TEST_T; 77 78 typedef struct BINU16_T 79 { 80 const char *pszName; 81 PFNIEMAIMPLBINU16 pfn; 82 PFNIEMAIMPLBINU16 pfnNative; 83 BINU16_TEST_T const *paTests; 84 uint32_t cTests; 85 uint32_t uExtra; 86 uint8_t idxCpuEflFlavour; 87 } BINU16_T; 88 /** @} */ 89 90 91 /** @name 32-bit binary (PFNIEMAIMPLBINU32) 92 * @{ */ 93 typedef struct BINU32_TEST_T 94 { 95 uint32_t fEflIn; 96 uint32_t fEflOut; 97 uint32_t uDstIn; 98 uint32_t uDstOut; 99 uint32_t uSrcIn; 100 uint32_t uMisc; 101 } BINU32_TEST_T; 102 103 typedef struct BINU32_T 104 { 105 const char *pszName; 106 PFNIEMAIMPLBINU32 pfn; 107 PFNIEMAIMPLBINU32 pfnNative; 108 BINU32_TEST_T const *paTests; 109 uint32_t cTests; 110 uint32_t uExtra; 111 uint8_t idxCpuEflFlavour; 112 } BINU32_T; 113 /** @} */ 114 115 116 /** @name 64-bit binary (PFNIEMAIMPLBINU64) 117 * @{ */ 118 typedef struct BINU64_TEST_T 119 { 120 uint32_t fEflIn; 121 uint32_t fEflOut; 122 uint64_t uDstIn; 123 uint64_t uDstOut; 124 uint64_t uSrcIn; 125 uint64_t uMisc; 126 } BINU64_TEST_T; 127 128 typedef struct BINU64_T 129 { 130 const char *pszName; 131 PFNIEMAIMPLBINU64 pfn; 132 PFNIEMAIMPLBINU64 pfnNative; 133 BINU64_TEST_T const *paTests; 134 uint32_t cTests; 135 uint32_t uExtra; 136 uint8_t idxCpuEflFlavour; 137 } BINU64_T; 138 /** @} */ 139 140 141 /** @name mult/div (PFNIEMAIMPLBINU8, PFNIEMAIMPLBINU16, PFNIEMAIMPLBINU32, PFNIEMAIMPLBINU64) 142 * @{ */ 143 typedef struct MULDIVU8_TEST_T 144 { 145 uint32_t fEflIn; 146 uint32_t fEflOut; 147 uint16_t uDstIn; 148 uint16_t uDstOut; 149 uint8_t uSrcIn; 150 int32_t rc; 151 } MULDIVU8_TEST_T; 152 153 typedef struct MULDIVU16_TEST_T 154 { 155 uint32_t fEflIn; 156 uint32_t fEflOut; 157 uint16_t uDst1In; 158 uint16_t uDst1Out; 159 uint16_t uDst2In; 160 uint16_t uDst2Out; 161 uint16_t uSrcIn; 162 int32_t rc; 163 } MULDIVU16_TEST_T; 164 165 typedef struct MULDIVU32_TEST_T 166 { 167 uint32_t fEflIn; 168 uint32_t fEflOut; 169 uint32_t uDst1In; 170 uint32_t uDst1Out; 171 uint32_t uDst2In; 172 uint32_t uDst2Out; 173 uint32_t uSrcIn; 174 int32_t rc; 175 } MULDIVU32_TEST_T; 176 177 typedef struct MULDIVU64_TEST_T 178 { 179 uint32_t fEflIn; 180 uint32_t fEflOut; 181 uint64_t uDst1In; 182 uint64_t uDst1Out; 183 uint64_t uDst2In; 184 uint64_t uDst2Out; 185 uint64_t uSrcIn; 186 int32_t rc; 187 } MULDIVU64_TEST_T; 188 /** @} */ 37 #include "tstIEMAImpl.h" 189 38 190 39 … … 195 44 #define ENTRY_EX(a_Name, a_uExtra) \ 196 45 { RT_XSTR(a_Name), iemAImpl_ ## a_Name, NULL, \ 197 g_aTests_ ## a_Name, RT_ELEMENTS(g_aTests_ ## a_Name), \46 g_aTests_ ## a_Name, &g_cTests_ ## a_Name, \ 198 47 a_uExtra, IEMTARGETCPU_EFL_BEHAVIOR_NATIVE /* means same for all here */ } 199 48 … … 201 50 #define ENTRY_INTEL_EX(a_Name, a_fEflUndef, a_uExtra) \ 202 51 { RT_XSTR(a_Name) "_intel", iemAImpl_ ## a_Name ## _intel, iemAImpl_ ## a_Name, \ 203 g_aTests_ ## a_Name ## _intel, RT_ELEMENTS(g_aTests_ ## a_Name ## _intel), \52 g_aTests_ ## a_Name ## _intel, &g_cTests_ ## a_Name ## _intel, \ 204 53 a_uExtra, IEMTARGETCPU_EFL_BEHAVIOR_INTEL } 205 54 … … 207 56 #define ENTRY_AMD_EX(a_Name, a_fEflUndef, a_uExtra) \ 208 57 { RT_XSTR(a_Name) "_amd", iemAImpl_ ## a_Name ## _amd, iemAImpl_ ## a_Name, \ 209 g_aTests_ ## a_Name ## _amd, RT_ELEMENTS(g_aTests_ ## a_Name ## _amd), \58 g_aTests_ ## a_Name ## _amd, &g_cTests_ ## a_Name ## _amd, \ 210 59 a_uExtra, IEMTARGETCPU_EFL_BEHAVIOR_AMD } 60 61 #define TYPEDEF_SUBTEST_TYPE(a_TypeName, a_TestType, a_FunctionPtrType) \ 62 typedef struct a_TypeName \ 63 { \ 64 const char *pszName; \ 65 a_FunctionPtrType pfn; \ 66 a_FunctionPtrType pfnNative; \ 67 a_TestType const *paTests; \ 68 uint32_t const *pcTests; \ 69 uint32_t uExtra; \ 70 uint8_t idxCpuEflFlavour; \ 71 } a_TypeName 211 72 212 73 … … 230 91 231 92 232 #include "tstIEMAImplData.h"233 #include "tstIEMAImplData-Intel.h"234 #include "tstIEMAImplData-Amd.h"235 236 237 93 /********************************************************************************************************************************* 238 94 * Internal Functions * … … 253 109 } 254 110 111 #ifdef TSTIEMAIMPL_WITH_GENERATOR 255 112 256 113 static uint8_t RandU8(void) … … 271 128 } 272 129 130 #endif 273 131 274 132 static uint64_t RandU64(void) … … 759 617 760 618 761 static void GenerateHeader(PRTSTREAM pOut, const char *pszFileInfix, 762 const char *pszCpuDesc, const char *pszCpuType, const char *pszCpuSuffU) 619 static void GenerateHeader(PRTSTREAM pOut, const char *pszCpuDesc, const char *pszCpuType) 763 620 { 764 621 /* We want to tag the generated source code with the revision that produced it. */ … … 787 644 " */\n" 788 645 "\n" 789 "#ifndef VMM_INCLUDED_SRC_testcase_tstIEMAImplData%s%s_h\n" 790 "#define VMM_INCLUDED_SRC_testcase_tstIEMAImplData%s%s_h\n" 791 "#ifndef RT_WITHOUT_PRAGMA_ONCE\n" 792 "# pragma once\n" 793 "#endif\n" 646 "#include \"tstIEMAImpl.h\"\n" 647 "\n" 794 648 , 795 pszCpuType ? " " : "", pszCpuType ? pszCpuType : "", cchRev, pszRev, pszCpuDesc, 796 pszFileInfix, pszCpuSuffU, 797 pszFileInfix, pszCpuSuffU); 798 } 799 800 801 static RTEXITCODE GenerateFooterAndClose(PRTSTREAM pOut, const char *pszFilename, const char *pszFileInfix, 802 const char *pszCpuSuff, RTEXITCODE rcExit) 649 pszCpuType ? " " : "", pszCpuType ? pszCpuType : "", cchRev, pszRev, pszCpuDesc); 650 } 651 652 653 static PRTSTREAM GenerateOpenWithHdr(const char *pszFilename, const char *pszCpuDesc, const char *pszCpuType) 654 { 655 PRTSTREAM pOut = NULL; 656 int rc = RTStrmOpen(pszFilename, "w", &pOut); 657 if (RT_SUCCESS(rc)) 658 { 659 GenerateHeader(pOut, pszCpuDesc, pszCpuType); 660 return pOut; 661 } 662 RTMsgError("Failed to open %s for writing: %Rrc", pszFilename, rc); 663 return NULL; 664 } 665 666 667 static RTEXITCODE GenerateFooterAndClose(PRTSTREAM pOut, const char *pszFilename, RTEXITCODE rcExit) 803 668 { 804 669 RTStrmPrintf(pOut, 805 670 "\n" 806 " #endif /* !VMM_INCLUDED_SRC_testcase_tstIEMAImplData%s%s_h */\n", pszFileInfix, pszCpuSuff);671 "/* end of file */\n"); 807 672 int rc = RTStrmClose(pOut); 808 673 if (RT_SUCCESS(rc)) … … 811 676 } 812 677 813 #endif 678 679 static void GenerateArrayStart(PRTSTREAM pOut, const char *pszName, const char *pszType) 680 { 681 RTStrmPrintf(pOut, "%s const g_aTests_%s[] =\n{\n", pszType, pszName); 682 } 683 684 685 static void GenerateArrayEnd(PRTSTREAM pOut, const char *pszName) 686 { 687 RTStrmPrintf(pOut, 688 "};\n" 689 "uint32_t const g_cTests_%s = RT_ELEMENTS(g_aTests_%s);\n" 690 "\n", 691 pszName, pszName); 692 } 693 694 #endif /* TSTIEMAIMPL_WITH_GENERATOR */ 814 695 815 696 … … 1004 885 * Binary operations. 1005 886 */ 887 TYPEDEF_SUBTEST_TYPE(BINU8_T, BINU8_TEST_T, PFNIEMAIMPLBINU8); 888 TYPEDEF_SUBTEST_TYPE(BINU16_T, BINU16_TEST_T, PFNIEMAIMPLBINU16); 889 TYPEDEF_SUBTEST_TYPE(BINU32_T, BINU32_TEST_T, PFNIEMAIMPLBINU32); 890 TYPEDEF_SUBTEST_TYPE(BINU64_T, BINU64_TEST_T, PFNIEMAIMPLBINU64); 891 1006 892 #ifdef TSTIEMAIMPL_WITH_GENERATOR 1007 # define GEN_BINARY_TESTS(a_cBits, a_Fmt ) \1008 static void BinU ## a_cBits ## Generate(PRTSTREAM pOut, PRTSTREAM pOutCpu, const char *pszCpuSuffU,uint32_t cTests) \893 # define GEN_BINARY_TESTS(a_cBits, a_Fmt, a_TestType) \ 894 static void BinU ## a_cBits ## Generate(PRTSTREAM pOut, PRTSTREAM pOutCpu, uint32_t cTests) \ 1009 895 { \ 1010 RTStrmPrintf(pOut, "\n\n#define HAVE_BINU%u_TESTS\n", a_cBits); \1011 RTStrmPrintf(pOutCpu, "\n\n#define HAVE_BINU%u_TESTS%s\n", a_cBits, pszCpuSuffU); \1012 896 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aBinU ## a_cBits); iFn++) \ 1013 897 { \ … … 1022 906 } \ 1023 907 \ 1024 RTStrmPrintf(pOutFn, "static const BINU%u_TEST_T g_aTests_%s[] =\n{\n", a_cBits, g_aBinU ## a_cBits[iFn].pszName); \908 GenerateArrayStart(pOutFn, g_aBinU ## a_cBits[iFn].pszName, #a_TestType); \ 1025 909 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 1026 910 { \ 1027 BINU ## a_cBits ## _TEST_TTest; \911 a_TestType Test; \ 1028 912 Test.fEflIn = RandEFlags(); \ 1029 913 Test.fEflOut = Test.fEflIn; \ … … 1038 922 Test.fEflIn, Test.fEflOut, Test.uDstIn, Test.uDstOut, Test.uSrcIn, Test.uMisc, iTest); \ 1039 923 } \ 1040 RTStrmPrintf(pOutFn, "};\n"); \924 GenerateArrayEnd(pOutFn, g_aBinU ## a_cBits[iFn].pszName); \ 1041 925 } \ 1042 926 } 1043 927 #else 1044 # define GEN_BINARY_TESTS(a_cBits, a_Fmt )928 # define GEN_BINARY_TESTS(a_cBits, a_Fmt, a_TestType) 1045 929 #endif 1046 930 1047 #define TEST_BINARY_OPS(a_cBits, a_uType, a_Fmt, a_ aSubTests) \1048 GEN_BINARY_TESTS(a_cBits, a_Fmt ) \931 #define TEST_BINARY_OPS(a_cBits, a_uType, a_Fmt, a_TestType, a_aSubTests) \ 932 GEN_BINARY_TESTS(a_cBits, a_Fmt, a_TestType) \ 1049 933 \ 1050 934 static void BinU ## a_cBits ## Test(void) \ … … 1053 937 { \ 1054 938 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 1055 BINU ## a_cBits ## _TEST_T const * constpaTests = a_aSubTests[iFn].paTests; \1056 uint32_t const cTests = a_aSubTests[iFn].cTests; \1057 PFNIEMAIMPLBINU ## a_cBits 939 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 940 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 941 PFNIEMAIMPLBINU ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 1058 942 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 943 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 1059 944 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 1060 945 { \ … … 1089 974 * 8-bit binary operations. 1090 975 */ 1091 1092 #ifndef HAVE_BINU8_TESTS1093 static const BINU8_TEST_T g_aTests_add_u8[] = { {0} };1094 static const BINU8_TEST_T g_aTests_add_u8_locked[] = { {0} };1095 static const BINU8_TEST_T g_aTests_adc_u8[] = { {0} };1096 static const BINU8_TEST_T g_aTests_adc_u8_locked[] = { {0} };1097 static const BINU8_TEST_T g_aTests_sub_u8[] = { {0} };1098 static const BINU8_TEST_T g_aTests_sub_u8_locked[] = { {0} };1099 static const BINU8_TEST_T g_aTests_sbb_u8[] = { {0} };1100 static const BINU8_TEST_T g_aTests_sbb_u8_locked[] = { {0} };1101 static const BINU8_TEST_T g_aTests_or_u8[] = { {0} };1102 static const BINU8_TEST_T g_aTests_or_u8_locked[] = { {0} };1103 static const BINU8_TEST_T g_aTests_xor_u8[] = { {0} };1104 static const BINU8_TEST_T g_aTests_xor_u8_locked[] = { {0} };1105 static const BINU8_TEST_T g_aTests_and_u8[] = { {0} };1106 static const BINU8_TEST_T g_aTests_and_u8_locked[] = { {0} };1107 static const BINU8_TEST_T g_aTests_cmp_u8[] = { {0} };1108 static const BINU8_TEST_T g_aTests_test_u8[] = { {0} };1109 #endif1110 1111 976 static const BINU8_T g_aBinU8[] = 1112 977 { … … 1128 993 ENTRY(test_u8), 1129 994 }; 1130 1131 TEST_BINARY_OPS(8, uint8_t, "%#04x", g_aBinU8) 995 TEST_BINARY_OPS(8, uint8_t, "%#04x", BINU8_TEST_T, g_aBinU8) 1132 996 1133 997 … … 1135 999 * 16-bit binary operations. 1136 1000 */ 1137 1138 #ifndef HAVE_BINU16_TESTS1139 static const BINU16_TEST_T g_aTests_add_u16[] = { {0} };1140 static const BINU16_TEST_T g_aTests_add_u16_locked[] = { {0} };1141 static const BINU16_TEST_T g_aTests_adc_u16[] = { {0} };1142 static const BINU16_TEST_T g_aTests_adc_u16_locked[] = { {0} };1143 static const BINU16_TEST_T g_aTests_sub_u16[] = { {0} };1144 static const BINU16_TEST_T g_aTests_sub_u16_locked[] = { {0} };1145 static const BINU16_TEST_T g_aTests_sbb_u16[] = { {0} };1146 static const BINU16_TEST_T g_aTests_sbb_u16_locked[] = { {0} };1147 static const BINU16_TEST_T g_aTests_or_u16[] = { {0} };1148 static const BINU16_TEST_T g_aTests_or_u16_locked[] = { {0} };1149 static const BINU16_TEST_T g_aTests_xor_u16[] = { {0} };1150 static const BINU16_TEST_T g_aTests_xor_u16_locked[] = { {0} };1151 static const BINU16_TEST_T g_aTests_and_u16[] = { {0} };1152 static const BINU16_TEST_T g_aTests_and_u16_locked[] = { {0} };1153 static const BINU16_TEST_T g_aTests_cmp_u16[] = { {0} };1154 static const BINU16_TEST_T g_aTests_test_u16[] = { {0} };1155 static const BINU16_TEST_T g_aTests_bt_u16[] = { {0} };1156 static const BINU16_TEST_T g_aTests_btc_u16[] = { {0} };1157 static const BINU16_TEST_T g_aTests_btc_u16_locked[] = { {0} };1158 static const BINU16_TEST_T g_aTests_btr_u16[] = { {0} };1159 static const BINU16_TEST_T g_aTests_btr_u16_locked[] = { {0} };1160 static const BINU16_TEST_T g_aTests_bts_u16[] = { {0} };1161 static const BINU16_TEST_T g_aTests_bts_u16_locked[] = { {0} };1162 static const BINU16_TEST_T g_aTests_arpl[] = { {0} };1163 #endif1164 #ifndef HAVE_BINU16_TESTS_AMD1165 static const BINU16_TEST_T g_aTests_bsf_u16_amd[] = { {0} };1166 static const BINU16_TEST_T g_aTests_bsr_u16_amd[] = { {0} };1167 static const BINU16_TEST_T g_aTests_imul_two_u16_amd[] = { {0} };1168 #endif1169 #ifndef HAVE_BINU16_TESTS_INTEL1170 static const BINU16_TEST_T g_aTests_bsf_u16_intel[] = { {0} };1171 static const BINU16_TEST_T g_aTests_bsr_u16_intel[] = { {0} };1172 static const BINU16_TEST_T g_aTests_imul_two_u16_intel[] = { {0} };1173 #endif1174 1175 1001 static const BINU16_T g_aBinU16[] = 1176 1002 { … … 1206 1032 ENTRY(arpl), 1207 1033 }; 1208 1209 TEST_BINARY_OPS(16, uint16_t, "%#06x", g_aBinU16) 1034 TEST_BINARY_OPS(16, uint16_t, "%#06x", BINU16_TEST_T, g_aBinU16) 1210 1035 1211 1036 … … 1213 1038 * 32-bit binary operations. 1214 1039 */ 1215 1216 #ifndef HAVE_BINU32_TESTS1217 static const BINU32_TEST_T g_aTests_add_u32[] = { {0} };1218 static const BINU32_TEST_T g_aTests_add_u32_locked[] = { {0} };1219 static const BINU32_TEST_T g_aTests_adc_u32[] = { {0} };1220 static const BINU32_TEST_T g_aTests_adc_u32_locked[] = { {0} };1221 static const BINU32_TEST_T g_aTests_sub_u32[] = { {0} };1222 static const BINU32_TEST_T g_aTests_sub_u32_locked[] = { {0} };1223 static const BINU32_TEST_T g_aTests_sbb_u32[] = { {0} };1224 static const BINU32_TEST_T g_aTests_sbb_u32_locked[] = { {0} };1225 static const BINU32_TEST_T g_aTests_or_u32[] = { {0} };1226 static const BINU32_TEST_T g_aTests_or_u32_locked[] = { {0} };1227 static const BINU32_TEST_T g_aTests_xor_u32[] = { {0} };1228 static const BINU32_TEST_T g_aTests_xor_u32_locked[] = { {0} };1229 static const BINU32_TEST_T g_aTests_and_u32[] = { {0} };1230 static const BINU32_TEST_T g_aTests_and_u32_locked[] = { {0} };1231 static const BINU32_TEST_T g_aTests_cmp_u32[] = { {0} };1232 static const BINU32_TEST_T g_aTests_test_u32[] = { {0} };1233 static const BINU32_TEST_T g_aTests_bt_u32[] = { {0} };1234 static const BINU32_TEST_T g_aTests_btc_u32[] = { {0} };1235 static const BINU32_TEST_T g_aTests_btc_u32_locked[] = { {0} };1236 static const BINU32_TEST_T g_aTests_btr_u32[] = { {0} };1237 static const BINU32_TEST_T g_aTests_btr_u32_locked[] = { {0} };1238 static const BINU32_TEST_T g_aTests_bts_u32[] = { {0} };1239 static const BINU32_TEST_T g_aTests_bts_u32_locked[] = { {0} };1240 #endif1241 #ifndef HAVE_BINU32_TESTS_AMD1242 static const BINU32_TEST_T g_aTests_bsf_u32_amd[] = { {0} };1243 static const BINU32_TEST_T g_aTests_bsr_u32_amd[] = { {0} };1244 static const BINU32_TEST_T g_aTests_imul_two_u32_amd[] = { {0} };1245 #endif1246 #ifndef HAVE_BINU32_TESTS_INTEL1247 static const BINU32_TEST_T g_aTests_bsf_u32_intel[] = { {0} };1248 static const BINU32_TEST_T g_aTests_bsr_u32_intel[] = { {0} };1249 static const BINU32_TEST_T g_aTests_imul_two_u32_intel[] = { {0} };1250 #endif1251 1252 1040 static const BINU32_T g_aBinU32[] = 1253 1041 { … … 1282 1070 ENTRY_INTEL(imul_two_u32, X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF), 1283 1071 }; 1284 1285 TEST_BINARY_OPS(32, uint32_t, "%#010RX32", g_aBinU32) 1072 TEST_BINARY_OPS(32, uint32_t, "%#010RX32", BINU32_TEST_T, g_aBinU32) 1286 1073 1287 1074 … … 1289 1076 * 64-bit binary operations. 1290 1077 */ 1291 1292 #ifndef HAVE_BINU64_TESTS1293 static const BINU64_TEST_T g_aTests_add_u64[] = { {0} };1294 static const BINU64_TEST_T g_aTests_add_u64_locked[] = { {0} };1295 static const BINU64_TEST_T g_aTests_adc_u64[] = { {0} };1296 static const BINU64_TEST_T g_aTests_adc_u64_locked[] = { {0} };1297 static const BINU64_TEST_T g_aTests_sub_u64[] = { {0} };1298 static const BINU64_TEST_T g_aTests_sub_u64_locked[] = { {0} };1299 static const BINU64_TEST_T g_aTests_sbb_u64[] = { {0} };1300 static const BINU64_TEST_T g_aTests_sbb_u64_locked[] = { {0} };1301 static const BINU64_TEST_T g_aTests_or_u64[] = { {0} };1302 static const BINU64_TEST_T g_aTests_or_u64_locked[] = { {0} };1303 static const BINU64_TEST_T g_aTests_xor_u64[] = { {0} };1304 static const BINU64_TEST_T g_aTests_xor_u64_locked[] = { {0} };1305 static const BINU64_TEST_T g_aTests_and_u64[] = { {0} };1306 static const BINU64_TEST_T g_aTests_and_u64_locked[] = { {0} };1307 static const BINU64_TEST_T g_aTests_cmp_u64[] = { {0} };1308 static const BINU64_TEST_T g_aTests_test_u64[] = { {0} };1309 static const BINU64_TEST_T g_aTests_bt_u64[] = { {0} };1310 static const BINU64_TEST_T g_aTests_btc_u64[] = { {0} };1311 static const BINU64_TEST_T g_aTests_btc_u64_locked[] = { {0} };1312 static const BINU64_TEST_T g_aTests_btr_u64[] = { {0} };1313 static const BINU64_TEST_T g_aTests_btr_u64_locked[] = { {0} };1314 static const BINU64_TEST_T g_aTests_bts_u64[] = { {0} };1315 static const BINU64_TEST_T g_aTests_bts_u64_locked[] = { {0} };1316 #endif1317 #ifndef HAVE_BINU64_TESTS_AMD1318 static const BINU64_TEST_T g_aTests_bsf_u64_amd[] = { {0} };1319 static const BINU64_TEST_T g_aTests_bsr_u64_amd[] = { {0} };1320 static const BINU64_TEST_T g_aTests_imul_two_u64_amd[] = { {0} };1321 #endif1322 #ifndef HAVE_BINU64_TESTS_INTEL1323 static const BINU64_TEST_T g_aTests_bsf_u64_intel[] = { {0} };1324 static const BINU64_TEST_T g_aTests_bsr_u64_intel[] = { {0} };1325 static const BINU64_TEST_T g_aTests_imul_two_u64_intel[] = { {0} };1326 #endif1327 1328 1078 static const BINU64_T g_aBinU64[] = 1329 1079 { … … 1358 1108 ENTRY_INTEL(imul_two_u64, X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF), 1359 1109 }; 1360 1361 TEST_BINARY_OPS(64, uint64_t, "%#018RX64", g_aBinU64) 1110 TEST_BINARY_OPS(64, uint64_t, "%#018RX64", BINU64_TEST_T, g_aBinU64) 1362 1111 1363 1112 … … 1443 1192 FNIEMAIMPLXADDU ## a_cBits *pfn; \ 1444 1193 BINU ## a_cBits ## _TEST_T const *paTests; \ 1445 uint32_t 1194 uint32_t const *pcTests; \ 1446 1195 } const s_aFuncs[] = \ 1447 1196 { \ 1448 1197 { "xadd_u" # a_cBits, iemAImpl_xadd_u ## a_cBits, \ 1449 g_aTests_add_u ## a_cBits, RT_ELEMENTS(g_aTests_add_u ## a_cBits)}, \1198 g_aTests_add_u ## a_cBits, &g_cTests_add_u ## a_cBits }, \ 1450 1199 { "xadd_u" # a_cBits "8_locked", iemAImpl_xadd_u ## a_cBits ## _locked, \ 1451 g_aTests_add_u ## a_cBits, RT_ELEMENTS(g_aTests_add_u ## a_cBits)}, \1200 g_aTests_add_u ## a_cBits, &g_cTests_add_u ## a_cBits }, \ 1452 1201 }; \ 1453 1202 for (size_t iFn = 0; iFn < RT_ELEMENTS(s_aFuncs); iFn++) \ 1454 1203 { \ 1455 1204 RTTestSub(g_hTest, s_aFuncs[iFn].pszName); \ 1205 uint32_t const cTests = *s_aFuncs[iFn].pcTests; \ 1456 1206 BINU ## a_cBits ## _TEST_T const * const paTests = s_aFuncs[iFn].paTests; \ 1457 uint32_t const cTests = s_aFuncs[iFn].cTests; \1207 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 1458 1208 for (uint32_t iTest = 0; iTest < cTests; iTest++) \ 1459 1209 { \ … … 1493 1243 PFNIEMAIMPLBINU ## a_cBits pfnSub; \ 1494 1244 BINU ## a_cBits ## _TEST_T const *paTests; \ 1495 uint32_t 1245 uint32_t const *pcTests; \ 1496 1246 } const s_aFuncs[] = \ 1497 1247 { \ 1498 1248 { "cmpxchg_u" # a_cBits, iemAImpl_cmpxchg_u ## a_cBits, iemAImpl_sub_u ## a_cBits, \ 1499 g_aTests_cmp_u ## a_cBits, RT_ELEMENTS(g_aTests_cmp_u ## a_cBits)}, \1249 g_aTests_cmp_u ## a_cBits, &g_cTests_cmp_u ## a_cBits }, \ 1500 1250 { "cmpxchg_u" # a_cBits "_locked", iemAImpl_cmpxchg_u ## a_cBits ## _locked, iemAImpl_sub_u ## a_cBits, \ 1501 g_aTests_cmp_u ## a_cBits, RT_ELEMENTS(g_aTests_cmp_u ## a_cBits)}, \1251 g_aTests_cmp_u ## a_cBits, &g_cTests_cmp_u ## a_cBits }, \ 1502 1252 }; \ 1503 1253 for (size_t iFn = 0; iFn < RT_ELEMENTS(s_aFuncs); iFn++) \ … … 1505 1255 RTTestSub(g_hTest, s_aFuncs[iFn].pszName); \ 1506 1256 BINU ## a_cBits ## _TEST_T const * const paTests = s_aFuncs[iFn].paTests; \ 1507 uint32_t const cTests = s_aFuncs[iFn].cTests; \ 1257 uint32_t const cTests = *s_aFuncs[iFn].pcTests; \ 1258 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 1508 1259 for (uint32_t iTest = 0; iTest < cTests; iTest++) \ 1509 1260 { \ … … 1683 1434 * Note! We use BINUxx_TEST_T with the shift value in the uMisc field. 1684 1435 */ 1685 1686 #ifndef HAVE_SHIFT_DBL_TESTS_AMD1687 static const BINU16_TEST_T g_aTests_shrd_u16_amd[] = { {0} };1688 static const BINU16_TEST_T g_aTests_shld_u16_amd[] = { {0} };1689 static const BINU32_TEST_T g_aTests_shrd_u32_amd[] = { {0} };1690 static const BINU32_TEST_T g_aTests_shld_u32_amd[] = { {0} };1691 static const BINU64_TEST_T g_aTests_shrd_u64_amd[] = { {0} };1692 static const BINU64_TEST_T g_aTests_shld_u64_amd[] = { {0} };1693 #endif1694 #ifndef HAVE_SHIFT_DBL_TESTS_INTEL1695 static const BINU16_TEST_T g_aTests_shrd_u16_intel[] = { {0} };1696 static const BINU16_TEST_T g_aTests_shld_u16_intel[] = { {0} };1697 static const BINU32_TEST_T g_aTests_shrd_u32_intel[] = { {0} };1698 static const BINU32_TEST_T g_aTests_shld_u32_intel[] = { {0} };1699 static const BINU64_TEST_T g_aTests_shrd_u64_intel[] = { {0} };1700 static const BINU64_TEST_T g_aTests_shld_u64_intel[] = { {0} };1701 #endif1702 1703 1436 #ifdef TSTIEMAIMPL_WITH_GENERATOR 1704 # define GEN_SHIFT_DBL(a_cBits, a_Fmt, a_ aSubTests) \1437 # define GEN_SHIFT_DBL(a_cBits, a_Fmt, a_TestType, a_aSubTests) \ 1705 1438 void ShiftDblU ## a_cBits ## Generate(PRTSTREAM pOut, uint32_t cTests) \ 1706 1439 { \ … … 1710 1443 && a_aSubTests[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) \ 1711 1444 continue; \ 1712 RTStrmPrintf(pOut, "static const BINU" #a_cBits "_TEST_T g_aTests_%s[] =\n{\n", a_aSubTests[iFn].pszName); \1445 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 1713 1446 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 1714 1447 { \ 1715 BINU ## a_cBits ## _TEST_TTest; \1448 a_TestType Test; \ 1716 1449 Test.fEflIn = RandEFlags(); \ 1717 1450 Test.fEflOut = Test.fEflIn; \ … … 1724 1457 Test.fEflIn, Test.fEflOut, Test.uDstIn, Test.uDstOut, Test.uSrcIn, Test.uMisc, iTest); \ 1725 1458 } \ 1726 RTStrmPrintf(pOut, "};\n"); \1459 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \ 1727 1460 } \ 1728 1461 } 1729 1462 #else 1730 # define GEN_SHIFT_DBL(a_cBits, a_Fmt, a_ aSubTests)1463 # define GEN_SHIFT_DBL(a_cBits, a_Fmt, a_TestType, a_aSubTests) 1731 1464 #endif 1732 1465 1733 #define TEST_SHIFT_DBL(a_cBits, a_Type, a_Fmt, a_aSubTests) \ 1734 static const struct \ 1735 { \ 1736 const char *pszName; \ 1737 PFNIEMAIMPLSHIFTDBLU ## a_cBits pfn; \ 1738 PFNIEMAIMPLSHIFTDBLU ## a_cBits pfnNative; \ 1739 BINU ## a_cBits ## _TEST_T const *paTests; \ 1740 uint32_t cTests, uExtra; \ 1741 uint8_t idxCpuEflFlavour; \ 1742 } a_aSubTests[] = \ 1466 #define TEST_SHIFT_DBL(a_cBits, a_Type, a_Fmt, a_TestType, a_SubTestType, a_aSubTests) \ 1467 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLSHIFTDBLU ## a_cBits); \ 1468 \ 1469 static a_SubTestType const a_aSubTests[] = \ 1743 1470 { \ 1744 1471 ENTRY_AMD(shld_u ## a_cBits, X86_EFL_OF | X86_EFL_CF), \ … … 1748 1475 }; \ 1749 1476 \ 1750 GEN_SHIFT_DBL(a_cBits, a_Fmt, a_ aSubTests) \1477 GEN_SHIFT_DBL(a_cBits, a_Fmt, a_TestType, a_aSubTests) \ 1751 1478 \ 1752 1479 static void ShiftDblU ## a_cBits ## Test(void) \ … … 1755 1482 { \ 1756 1483 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 1757 BINU ## a_cBits ## _TEST_T const * constpaTests = a_aSubTests[iFn].paTests; \1758 uint32_t const cTests = a_aSubTests[iFn].cTests; \1759 PFNIEMAIMPLSHIFTDBLU ## a_cBits pfn = a_aSubTests[iFn].pfn; \1484 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 1485 PFNIEMAIMPLSHIFTDBLU ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 1486 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 1760 1487 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 1488 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 1761 1489 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 1762 1490 { \ … … 1786 1514 } \ 1787 1515 } 1788 TEST_SHIFT_DBL(16, uint16_t, "%#06RX16", g_aShiftDblU16)1789 TEST_SHIFT_DBL(32, uint32_t, "%#010RX32", g_aShiftDblU32)1790 TEST_SHIFT_DBL(64, uint64_t, "%#018RX64", g_aShiftDblU64)1516 TEST_SHIFT_DBL(16, uint16_t, "%#06RX16", BINU16_TEST_T, SHIFT_DBL_U16_T, g_aShiftDblU16) 1517 TEST_SHIFT_DBL(32, uint32_t, "%#010RX32", BINU32_TEST_T, SHIFT_DBL_U32_T, g_aShiftDblU32) 1518 TEST_SHIFT_DBL(64, uint64_t, "%#018RX64", BINU64_TEST_T, SHIFT_DBL_U64_T, g_aShiftDblU64) 1791 1519 1792 1520 #ifdef TSTIEMAIMPL_WITH_GENERATOR 1793 static void ShiftDblGenerate(PRTSTREAM pOut, const char *pszCpuSuffU, uint32_t cTests) 1794 { 1795 RTStrmPrintf(pOut, "\n\n#define HAVE_SHIFT_DBL_TESTS%s\n", pszCpuSuffU); 1521 static void ShiftDblGenerate(PRTSTREAM pOut, uint32_t cTests) 1522 { 1796 1523 ShiftDblU16Generate(pOut, cTests); 1797 1524 ShiftDblU32Generate(pOut, cTests); … … 1813 1540 * Note! We use BINUxx_TEST_T ignoreing uSrcIn and uMisc. 1814 1541 */ 1815 1816 #ifndef HAVE_UNARY_TESTS 1817 # define DUMMY_UNARY_TESTS(a_cBits, a_Type) \ 1818 static const a_Type g_aTests_inc_u ## a_cBits[] = { {0} }; \ 1819 static const a_Type g_aTests_inc_u ## a_cBits ## _locked[] = { {0} }; \ 1820 static const a_Type g_aTests_dec_u ## a_cBits[] = { {0} }; \ 1821 static const a_Type g_aTests_dec_u ## a_cBits ## _locked[] = { {0} }; \ 1822 static const a_Type g_aTests_not_u ## a_cBits[] = { {0} }; \ 1823 static const a_Type g_aTests_not_u ## a_cBits ## _locked[] = { {0} }; \ 1824 static const a_Type g_aTests_neg_u ## a_cBits[] = { {0} }; \ 1825 static const a_Type g_aTests_neg_u ## a_cBits ## _locked[] = { {0} } 1826 DUMMY_UNARY_TESTS(8, BINU8_TEST_T); 1827 DUMMY_UNARY_TESTS(16, BINU16_TEST_T); 1828 DUMMY_UNARY_TESTS(32, BINU32_TEST_T); 1829 DUMMY_UNARY_TESTS(64, BINU64_TEST_T); 1830 #endif 1831 1832 #define TEST_UNARY(a_cBits, a_Type, a_Fmt, a_TestType) \ 1833 static const struct \ 1834 { \ 1835 const char *pszName; \ 1836 PFNIEMAIMPLUNARYU ## a_cBits pfn; \ 1837 PFNIEMAIMPLUNARYU ## a_cBits pfnNative; \ 1838 a_TestType const *paTests; \ 1839 uint32_t cTests, uExtra; \ 1840 uint8_t idxCpuEflFlavour; \ 1841 } g_aUnaryU ## a_cBits [] = \ 1842 { \ 1843 ENTRY(inc_u ## a_cBits), \ 1844 ENTRY(inc_u ## a_cBits ## _locked), \ 1845 ENTRY(dec_u ## a_cBits), \ 1846 ENTRY(dec_u ## a_cBits ## _locked), \ 1847 ENTRY(not_u ## a_cBits), \ 1848 ENTRY(not_u ## a_cBits ## _locked), \ 1849 ENTRY(neg_u ## a_cBits), \ 1850 ENTRY(neg_u ## a_cBits ## _locked), \ 1851 }; \ 1852 \ 1542 #ifdef TSTIEMAIMPL_WITH_GENERATOR 1543 # define GEN_UNARY(a_cBits, a_Type, a_Fmt, a_TestType, a_SubTestType) \ 1853 1544 void UnaryU ## a_cBits ## Generate(PRTSTREAM pOut, uint32_t cTests) \ 1854 1545 { \ 1855 1546 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aUnaryU ## a_cBits); iFn++) \ 1856 1547 { \ 1857 RTStrmPrintf(pOut, "static const BINU" #a_cBits "_TEST_T g_aTests_%s[] =\n{\n", g_aUnaryU ## a_cBits[iFn].pszName); \1548 GenerateArrayStart(pOut, g_aUnaryU ## a_cBits[iFn].pszName, #a_TestType); \ 1858 1549 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 1859 1550 { \ … … 1869 1560 Test.fEflIn, Test.fEflOut, Test.uDstIn, Test.uDstOut, iTest); \ 1870 1561 } \ 1871 RTStrmPrintf(pOut, "};\n"); \1562 GenerateArrayEnd(pOut, g_aUnaryU ## a_cBits[iFn].pszName); \ 1872 1563 } \ 1873 } \ 1564 } 1565 #else 1566 # define GEN_UNARY(a_cBits, a_Type, a_Fmt, a_TestType, a_SubTestType) 1567 #endif 1568 1569 #define TEST_UNARY(a_cBits, a_Type, a_Fmt, a_TestType, a_SubTestType) \ 1570 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLUNARYU ## a_cBits); \ 1571 static a_SubTestType const g_aUnaryU ## a_cBits [] = \ 1572 { \ 1573 ENTRY(inc_u ## a_cBits), \ 1574 ENTRY(inc_u ## a_cBits ## _locked), \ 1575 ENTRY(dec_u ## a_cBits), \ 1576 ENTRY(dec_u ## a_cBits ## _locked), \ 1577 ENTRY(not_u ## a_cBits), \ 1578 ENTRY(not_u ## a_cBits ## _locked), \ 1579 ENTRY(neg_u ## a_cBits), \ 1580 ENTRY(neg_u ## a_cBits ## _locked), \ 1581 }; \ 1582 \ 1583 GEN_UNARY(a_cBits, a_Type, a_Fmt, a_TestType, a_SubTestType) \ 1874 1584 \ 1875 1585 static void UnaryU ## a_cBits ## Test(void) \ … … 1879 1589 RTTestSub(g_hTest, g_aUnaryU ## a_cBits[iFn].pszName); \ 1880 1590 a_TestType const * const paTests = g_aUnaryU ## a_cBits[iFn].paTests; \ 1881 uint32_t const cTests = g_aUnaryU ## a_cBits[iFn].cTests; \ 1591 uint32_t const cTests = *g_aUnaryU ## a_cBits[iFn].pcTests; \ 1592 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 1882 1593 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 1883 1594 { \ … … 1902 1613 } \ 1903 1614 } 1904 TEST_UNARY(8, uint8_t, "%#04RX8", BINU8_TEST_T )1905 TEST_UNARY(16, uint16_t, "%#06RX16", BINU16_TEST_T )1906 TEST_UNARY(32, uint32_t, "%#010RX32", BINU32_TEST_T )1907 TEST_UNARY(64, uint64_t, "%#018RX64", BINU64_TEST_T )1615 TEST_UNARY(8, uint8_t, "%#04RX8", BINU8_TEST_T, INT_UNARY_U8_T) 1616 TEST_UNARY(16, uint16_t, "%#06RX16", BINU16_TEST_T, INT_UNARY_U16_T) 1617 TEST_UNARY(32, uint32_t, "%#010RX32", BINU32_TEST_T, INT_UNARY_U32_T) 1618 TEST_UNARY(64, uint64_t, "%#018RX64", BINU64_TEST_T, INT_UNARY_U64_T) 1908 1619 1909 1620 #ifdef TSTIEMAIMPL_WITH_GENERATOR 1910 1621 static void UnaryGenerate(PRTSTREAM pOut, uint32_t cTests) 1911 1622 { 1912 RTStrmPrintf(pOut, "\n\n#define HAVE_UNARY_TESTS\n");1913 1623 UnaryU8Generate(pOut, cTests); 1914 1624 UnaryU16Generate(pOut, cTests); … … 1932 1642 * Note! We use BINUxx_TEST_T with the shift count in uMisc and uSrcIn unused. 1933 1643 */ 1934 #define DUMMY_SHIFT_TESTS(a_cBits, a_Type, a_Vendor) \1935 static const a_Type g_aTests_rol_u ## a_cBits ## a_Vendor[] = { {0} }; \1936 static const a_Type g_aTests_ror_u ## a_cBits ## a_Vendor[] = { {0} }; \1937 static const a_Type g_aTests_rcl_u ## a_cBits ## a_Vendor[] = { {0} }; \1938 static const a_Type g_aTests_rcr_u ## a_cBits ## a_Vendor[] = { {0} }; \1939 static const a_Type g_aTests_shl_u ## a_cBits ## a_Vendor[] = { {0} }; \1940 static const a_Type g_aTests_shr_u ## a_cBits ## a_Vendor[] = { {0} }; \1941 static const a_Type g_aTests_sar_u ## a_cBits ## a_Vendor[] = { {0} }1942 #ifndef HAVE_SHIFT_TESTS_AMD1943 DUMMY_SHIFT_TESTS(8, BINU8_TEST_T, _amd);1944 DUMMY_SHIFT_TESTS(16, BINU16_TEST_T, _amd);1945 DUMMY_SHIFT_TESTS(32, BINU32_TEST_T, _amd);1946 DUMMY_SHIFT_TESTS(64, BINU64_TEST_T, _amd);1947 #endif1948 #ifndef HAVE_SHIFT_TESTS_INTEL1949 DUMMY_SHIFT_TESTS(8, BINU8_TEST_T, _intel);1950 DUMMY_SHIFT_TESTS(16, BINU16_TEST_T, _intel);1951 DUMMY_SHIFT_TESTS(32, BINU32_TEST_T, _intel);1952 DUMMY_SHIFT_TESTS(64, BINU64_TEST_T, _intel);1953 #endif1954 1955 1644 #ifdef TSTIEMAIMPL_WITH_GENERATOR 1956 1645 # define GEN_SHIFT(a_cBits, a_Fmt, a_TestType, a_aSubTests) \ … … 1962 1651 && a_aSubTests[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) \ 1963 1652 continue; \ 1964 RTStrmPrintf(pOut, "static const BINU" #a_cBits "_TEST_T g_aTests_%s[] =\n{\n", a_aSubTests[iFn].pszName); \1653 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 1965 1654 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 1966 1655 { \ … … 1983 1672 Test.fEflIn, Test.fEflOut, Test.uDstIn, Test.uDstOut, Test.uMisc, iTest); \ 1984 1673 } \ 1985 RTStrmPrintf(pOut, "};\n"); \1674 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \ 1986 1675 } \ 1987 1676 } … … 1990 1679 #endif 1991 1680 1992 #define TEST_SHIFT(a_cBits, a_Type, a_Fmt, a_TestType, a_aSubTests) \ 1993 static const struct \ 1994 { \ 1995 const char *pszName; \ 1996 PFNIEMAIMPLSHIFTU ## a_cBits pfn; \ 1997 PFNIEMAIMPLSHIFTU ## a_cBits pfnNative; \ 1998 a_TestType const *paTests; \ 1999 uint32_t cTests, uExtra; \ 2000 uint8_t idxCpuEflFlavour; \ 2001 } a_aSubTests[] = \ 1681 #define TEST_SHIFT(a_cBits, a_Type, a_Fmt, a_TestType, a_SubTestType, a_aSubTests) \ 1682 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLSHIFTU ## a_cBits); \ 1683 static a_SubTestType const a_aSubTests[] = \ 2002 1684 { \ 2003 1685 ENTRY_AMD( rol_u ## a_cBits, X86_EFL_OF), \ … … 2024 1706 { \ 2025 1707 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 1708 PFNIEMAIMPLSHIFTU ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 2026 1709 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 2027 uint32_t const cTests = a_aSubTests[iFn].cTests; \ 2028 PFNIEMAIMPLSHIFTU ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 1710 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 2029 1711 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 1712 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 2030 1713 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 2031 1714 { \ … … 2055 1738 } \ 2056 1739 } 2057 TEST_SHIFT(8, uint8_t, "%#04RX8", BINU8_TEST_T, g_aShiftU8)2058 TEST_SHIFT(16, uint16_t, "%#06RX16", BINU16_TEST_T, g_aShiftU16)2059 TEST_SHIFT(32, uint32_t, "%#010RX32", BINU32_TEST_T, g_aShiftU32)2060 TEST_SHIFT(64, uint64_t, "%#018RX64", BINU64_TEST_T, g_aShiftU64)1740 TEST_SHIFT(8, uint8_t, "%#04RX8", BINU8_TEST_T, INT_BINARY_U8_T, g_aShiftU8) 1741 TEST_SHIFT(16, uint16_t, "%#06RX16", BINU16_TEST_T, INT_BINARY_U16_T, g_aShiftU16) 1742 TEST_SHIFT(32, uint32_t, "%#010RX32", BINU32_TEST_T, INT_BINARY_U32_T, g_aShiftU32) 1743 TEST_SHIFT(64, uint64_t, "%#018RX64", BINU64_TEST_T, INT_BINARY_U64_T, g_aShiftU64) 2061 1744 2062 1745 #ifdef TSTIEMAIMPL_WITH_GENERATOR 2063 static void ShiftGenerate(PRTSTREAM pOut, const char *pszCpuSuffU, uint32_t cTests) 2064 { 2065 RTStrmPrintf(pOut, "\n\n#define HAVE_SHIFT_TESTS%s\n", pszCpuSuffU); 1746 static void ShiftGenerate(PRTSTREAM pOut, uint32_t cTests) 1747 { 2066 1748 ShiftU8Generate(pOut, cTests); 2067 1749 ShiftU16Generate(pOut, cTests); … … 2087 1769 */ 2088 1770 2089 # define DUMMY_MULDIV_TESTS(a_cBits, a_Type, a_Vendor) \2090 static const a_Type g_aTests_mul_u ## a_cBits ## a_Vendor[] = { {0} }; \2091 static const a_Type g_aTests_imul_u ## a_cBits ## a_Vendor[] = { {0} }; \2092 static const a_Type g_aTests_div_u ## a_cBits ## a_Vendor[] = { {0} }; \2093 static const a_Type g_aTests_idiv_u ## a_cBits ## a_Vendor[] = { {0} }2094 2095 #ifndef HAVE_MULDIV_TESTS_AMD2096 DUMMY_MULDIV_TESTS(8, MULDIVU8_TEST_T, _amd);2097 DUMMY_MULDIV_TESTS(16, MULDIVU16_TEST_T, _amd);2098 DUMMY_MULDIV_TESTS(32, MULDIVU32_TEST_T, _amd);2099 DUMMY_MULDIV_TESTS(64, MULDIVU64_TEST_T, _amd);2100 #endif2101 2102 #ifndef HAVE_MULDIV_TESTS_INTEL2103 DUMMY_MULDIV_TESTS(8, MULDIVU8_TEST_T, _intel);2104 DUMMY_MULDIV_TESTS(16, MULDIVU16_TEST_T, _intel);2105 DUMMY_MULDIV_TESTS(32, MULDIVU32_TEST_T, _intel);2106 DUMMY_MULDIV_TESTS(64, MULDIVU64_TEST_T, _intel);2107 #endif2108 2109 1771 /* U8 */ 2110 static const struct 2111 { 2112 const char *pszName; 2113 PFNIEMAIMPLMULDIVU8 pfn; 2114 PFNIEMAIMPLMULDIVU8 pfnNative; 2115 MULDIVU8_TEST_T const *paTests; 2116 uint32_t cTests, uExtra; 2117 uint8_t idxCpuEflFlavour; 2118 } g_aMulDivU8[] = 1772 TYPEDEF_SUBTEST_TYPE(INT_MULDIV_U8_T, MULDIVU8_TEST_T, PFNIEMAIMPLMULDIVU8); 1773 static INT_MULDIV_U8_T const g_aMulDivU8[] = 2119 1774 { 2120 1775 ENTRY_AMD_EX(mul_u8, X86_EFL_SF | X86_EFL_ZF | X86_EFL_AF | X86_EFL_PF, … … 2138 1793 && g_aMulDivU8[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) 2139 1794 continue; 2140 RTStrmPrintf(pOut, "static const MULDIVU8_TEST_T g_aTests_%s[] =\n{\n", g_aMulDivU8[iFn].pszName);1795 GenerateArrayStart(pOut, g_aMulDivU8[iFn].pszName, "MULDIVU8_TEST_T"); \ 2141 1796 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) 2142 1797 { … … 2151 1806 Test.fEflIn, Test.fEflOut, Test.uDstIn, Test.uDstOut, Test.uSrcIn, Test.rc, iTest); 2152 1807 } 2153 RTStrmPrintf(pOut, "};\n");1808 GenerateArrayEnd(pOut, g_aMulDivU8[iFn].pszName); 2154 1809 } 2155 1810 } … … 2162 1817 RTTestSub(g_hTest, g_aMulDivU8[iFn].pszName); 2163 1818 MULDIVU8_TEST_T const * const paTests = g_aMulDivU8[iFn].paTests; 2164 uint32_t const cTests = g_aMulDivU8[iFn].cTests;1819 uint32_t const cTests = *g_aMulDivU8[iFn].pcTests; 2165 1820 uint32_t const fEflIgn = g_aMulDivU8[iFn].uExtra; 2166 1821 PFNIEMAIMPLMULDIVU8 pfn = g_aMulDivU8[iFn].pfn; 2167 1822 uint32_t const cVars = 1 + (g_aMulDivU8[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && g_aMulDivU8[iFn].pfnNative); 1823 if (!cTests) RTTestSkipped(g_hTest, "no tests"); 2168 1824 for (uint32_t iVar = 0; iVar < cVars; iVar++) 2169 1825 { … … 2207 1863 && a_aSubTests[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) \ 2208 1864 continue; \ 2209 RTStrmPrintf(pOut, "static const MULDIVU" #a_cBits "_TEST_T g_aTests_%s[] =\n{\n", a_aSubTests[iFn].pszName); \1865 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 2210 1866 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 2211 1867 { \ … … 2223 1879 Test.rc, iTest); \ 2224 1880 } \ 2225 RTStrmPrintf(pOut, "};\n"); \1881 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \ 2226 1882 } \ 2227 1883 } … … 2230 1886 #endif 2231 1887 2232 #define TEST_MULDIV(a_cBits, a_Type, a_Fmt, a_TestType, a_aSubTests) \ 2233 static const struct \ 2234 { \ 2235 const char *pszName; \ 2236 PFNIEMAIMPLMULDIVU ## a_cBits pfn; \ 2237 PFNIEMAIMPLMULDIVU ## a_cBits pfnNative; \ 2238 a_TestType const *paTests; \ 2239 uint32_t cTests, uExtra; \ 2240 uint8_t idxCpuEflFlavour; \ 2241 } a_aSubTests [] = \ 1888 #define TEST_MULDIV(a_cBits, a_Type, a_Fmt, a_TestType, a_SubTestType, a_aSubTests) \ 1889 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLMULDIVU ## a_cBits); \ 1890 static a_SubTestType const a_aSubTests [] = \ 2242 1891 { \ 2243 1892 ENTRY_AMD_EX(mul_u ## a_cBits, X86_EFL_SF | X86_EFL_ZF | X86_EFL_AF | X86_EFL_PF, 0), \ … … 2259 1908 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 2260 1909 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 2261 uint32_t const cTests = a_aSubTests[iFn].cTests; \1910 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 2262 1911 uint32_t const fEflIgn = a_aSubTests[iFn].uExtra; \ 2263 1912 PFNIEMAIMPLMULDIVU ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 2264 1913 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 1914 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 2265 1915 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 2266 1916 { \ … … 2301 1951 } \ 2302 1952 } 2303 TEST_MULDIV(16, uint16_t, "%#06RX16", MULDIVU16_TEST_T, g_aMulDivU16)2304 TEST_MULDIV(32, uint32_t, "%#010RX32", MULDIVU32_TEST_T, g_aMulDivU32)2305 TEST_MULDIV(64, uint64_t, "%#018RX64", MULDIVU64_TEST_T, g_aMulDivU64)1953 TEST_MULDIV(16, uint16_t, "%#06RX16", MULDIVU16_TEST_T, INT_MULDIV_U16_T, g_aMulDivU16) 1954 TEST_MULDIV(32, uint32_t, "%#010RX32", MULDIVU32_TEST_T, INT_MULDIV_U32_T, g_aMulDivU32) 1955 TEST_MULDIV(64, uint64_t, "%#018RX64", MULDIVU64_TEST_T, INT_MULDIV_U64_T, g_aMulDivU64) 2306 1956 2307 1957 #ifdef TSTIEMAIMPL_WITH_GENERATOR 2308 static void MulDivGenerate(PRTSTREAM pOut, const char *pszCpuSuffU, uint32_t cTests) 2309 { 2310 RTStrmPrintf(pOut, "\n\n#define HAVE_MULDIV_TESTS%s\n", pszCpuSuffU); 1958 static void MulDivGenerate(PRTSTREAM pOut, uint32_t cTests) 1959 { 2311 1960 MulDivU8Generate(pOut, cTests); 2312 1961 MulDivU16Generate(pOut, cTests); … … 2363 2012 *********************************************************************************************************************************/ 2364 2013 2365 typedef struct FPU_LD_CONST_TEST_T2366 {2367 uint16_t fFcw;2368 uint16_t fFswIn;2369 uint16_t fFswOut;2370 RTFLOAT80U rdResult;2371 } FPU_LD_CONST_TEST_T;2372 2373 typedef struct FPU_R32_IN_TEST_T2374 {2375 uint16_t fFcw;2376 uint16_t fFswIn;2377 uint16_t fFswOut;2378 RTFLOAT80U rdResult;2379 RTFLOAT32U InVal;2380 } FPU_R32_IN_TEST_T;2381 2382 typedef struct FPU_R64_IN_TEST_T2383 {2384 uint16_t fFcw;2385 uint16_t fFswIn;2386 uint16_t fFswOut;2387 RTFLOAT80U rdResult;2388 RTFLOAT64U InVal;2389 } FPU_R64_IN_TEST_T;2390 2391 typedef struct FPU_R80_IN_TEST_T2392 {2393 uint16_t fFcw;2394 uint16_t fFswIn;2395 uint16_t fFswOut;2396 RTFLOAT80U rdResult;2397 RTFLOAT80U InVal;2398 } FPU_R80_IN_TEST_T;2399 2400 typedef struct FPU_I16_IN_TEST_T2401 {2402 uint16_t fFcw;2403 uint16_t fFswIn;2404 uint16_t fFswOut;2405 RTFLOAT80U rdResult;2406 int16_t iInVal;2407 } FPU_I16_IN_TEST_T;2408 2409 typedef struct FPU_I32_IN_TEST_T2410 {2411 uint16_t fFcw;2412 uint16_t fFswIn;2413 uint16_t fFswOut;2414 RTFLOAT80U rdResult;2415 int32_t iInVal;2416 } FPU_I32_IN_TEST_T;2417 2418 typedef struct FPU_I64_IN_TEST_T2419 {2420 uint16_t fFcw;2421 uint16_t fFswIn;2422 uint16_t fFswOut;2423 RTFLOAT80U rdResult;2424 int64_t iInVal;2425 } FPU_I64_IN_TEST_T;2426 2427 typedef struct FPU_D80_IN_TEST_T2428 {2429 uint16_t fFcw;2430 uint16_t fFswIn;2431 uint16_t fFswOut;2432 RTFLOAT80U rdResult;2433 RTPBCD80U InVal;2434 } FPU_D80_IN_TEST_T;2435 2436 typedef struct FPU_ST_R32_TEST_T2437 {2438 uint16_t fFcw;2439 uint16_t fFswIn;2440 uint16_t fFswOut;2441 RTFLOAT80U InVal;2442 RTFLOAT32U OutVal;2443 } FPU_ST_R32_TEST_T;2444 2445 typedef struct FPU_ST_R64_TEST_T2446 {2447 uint16_t fFcw;2448 uint16_t fFswIn;2449 uint16_t fFswOut;2450 RTFLOAT80U InVal;2451 RTFLOAT64U OutVal;2452 } FPU_ST_R64_TEST_T;2453 2454 typedef struct FPU_ST_R80_TEST_T2455 {2456 uint16_t fFcw;2457 uint16_t fFswIn;2458 uint16_t fFswOut;2459 RTFLOAT80U InVal;2460 RTFLOAT80U OutVal;2461 } FPU_ST_R80_TEST_T;2462 2463 typedef struct FPU_ST_I16_TEST_T2464 {2465 uint16_t fFcw;2466 uint16_t fFswIn;2467 uint16_t fFswOut;2468 RTFLOAT80U InVal;2469 int16_t iOutVal;2470 } FPU_ST_I16_TEST_T;2471 2472 typedef struct FPU_ST_I32_TEST_T2473 {2474 uint16_t fFcw;2475 uint16_t fFswIn;2476 uint16_t fFswOut;2477 RTFLOAT80U InVal;2478 int32_t iOutVal;2479 } FPU_ST_I32_TEST_T;2480 2481 typedef struct FPU_ST_I64_TEST_T2482 {2483 uint16_t fFcw;2484 uint16_t fFswIn;2485 uint16_t fFswOut;2486 RTFLOAT80U InVal;2487 int64_t iOutVal;2488 } FPU_ST_I64_TEST_T;2489 2490 typedef struct FPU_ST_D80_TEST_T2491 {2492 uint16_t fFcw;2493 uint16_t fFswIn;2494 uint16_t fFswOut;2495 RTFLOAT80U InVal;2496 RTPBCD80U OutVal;2497 } FPU_ST_D80_TEST_T;2498 2499 #include "tstIEMAImplDataFpuLdSt.h"2500 2501 2502 2014 /* 2503 2015 * FPU constant loading. 2504 2016 */ 2505 2506 #ifndef HAVE_FPU_LOAD_CONST_TESTS 2507 static const FPU_LD_CONST_TEST_T g_aTests_fld1[] = { {0} }; 2508 static const FPU_LD_CONST_TEST_T g_aTests_fldl2t[] = { {0} }; 2509 static const FPU_LD_CONST_TEST_T g_aTests_fldl2e[] = { {0} }; 2510 static const FPU_LD_CONST_TEST_T g_aTests_fldpi[] = { {0} }; 2511 static const FPU_LD_CONST_TEST_T g_aTests_fldlg2[] = { {0} }; 2512 static const FPU_LD_CONST_TEST_T g_aTests_fldln2[] = { {0} }; 2513 static const FPU_LD_CONST_TEST_T g_aTests_fldz[] = { {0} }; 2514 #endif 2515 2516 typedef struct FPU_LD_CONST_T 2517 { 2518 const char *pszName; 2519 PFNIEMAIMPLFPUR80LDCONST pfn; 2520 PFNIEMAIMPLFPUR80LDCONST pfnNative; 2521 FPU_LD_CONST_TEST_T const *paTests; 2522 uint32_t cTests; 2523 uint32_t uExtra; 2524 uint8_t idxCpuEflFlavour; 2525 } FPU_LD_CONST_T; 2017 TYPEDEF_SUBTEST_TYPE(FPU_LD_CONST_T, FPU_LD_CONST_TEST_T, PFNIEMAIMPLFPUR80LDCONST); 2526 2018 2527 2019 static const FPU_LD_CONST_T g_aFpuLdConst[] = … … 2539 2031 static void FpuLdConstGenerate(PRTSTREAM pOut, uint32_t cTests) 2540 2032 { 2541 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_LOAD_CONST_TESTS\n");2542 2033 X86FXSTATE State; 2543 2034 RT_ZERO(State); 2544 2035 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuLdConst); iFn++) 2545 2036 { 2546 RTStrmPrintf(pOut, "static const FPU_LD_CONST_TEST_T g_aTests_%s[] =\n{\n", g_aFpuLdConst[iFn].pszName);2037 GenerateArrayStart(pOut, g_aFpuLdConst[iFn].pszName, "FPU_LD_CONST_TEST_T"); 2547 2038 for (uint32_t iTest = 0; iTest < cTests; iTest += 4) 2548 2039 { … … 2559 2050 } 2560 2051 } 2561 RTStrmPrintf(pOut, "};\n");2052 GenerateArrayEnd(pOut, g_aFpuLdConst[iFn].pszName); 2562 2053 } 2563 2054 } … … 2579 2070 RTTestSub(g_hTest, g_aFpuLdConst[iFn].pszName); 2580 2071 2581 uint32_t const cTests = g_aFpuLdConst[iFn].cTests;2072 uint32_t const cTests = *g_aFpuLdConst[iFn].pcTests; 2582 2073 FPU_LD_CONST_TEST_T const *paTests = g_aFpuLdConst[iFn].paTests; 2583 2074 PFNIEMAIMPLFPUR80LDCONST pfn = g_aFpuLdConst[iFn].pfn; 2584 2075 uint32_t const cVars = 1 + (g_aFpuLdConst[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && g_aFpuLdConst[iFn].pfnNative); 2076 if (!cTests) RTTestSkipped(g_hTest, "no tests"); 2585 2077 for (uint32_t iVar = 0; iVar < cVars; iVar++) 2586 2078 { … … 2610 2102 * Load floating point values from memory. 2611 2103 */ 2612 2613 #ifndef HAVE_FPU_LD_MEM2614 static FPU_R80_IN_TEST_T const g_aTests_fld_r80_from_r80[] = { {0} };2615 static FPU_R64_IN_TEST_T const g_aTests_fld_r80_from_r64[] = { {0} };2616 static FPU_R32_IN_TEST_T const g_aTests_fld_r80_from_r32[] = { {0} };2617 #endif2618 2619 2104 #ifdef TSTIEMAIMPL_WITH_GENERATOR 2620 2105 # define GEN_FPU_LOAD(a_cBits, a_rdTypeIn, a_aSubTests, a_TestType) \ … … 2625 2110 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 2626 2111 { \ 2627 RTStrmPrintf(pOut, "static const " #a_TestType " g_aTests_%s[] =\n{\n", a_aSubTests[iFn].pszName); \2112 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 2628 2113 for (uint32_t iTest = 0; iTest < cTests; iTest++) \ 2629 2114 { \ … … 2642 2127 } \ 2643 2128 } \ 2644 RTStrmPrintf(pOut, "};\n"); \2129 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \ 2645 2130 } \ 2646 2131 } … … 2652 2137 typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPULDR80FROM ## a_cBits,(PCX86FXSTATE, PIEMFPURESULT, PC ## a_rdTypeIn)); \ 2653 2138 typedef FNIEMAIMPLFPULDR80FROM ## a_cBits *PFNIEMAIMPLFPULDR80FROM ## a_cBits; \ 2654 typedef struct a_SubTestType \ 2655 { \ 2656 const char *pszName; \ 2657 PFNIEMAIMPLFPULDR80FROM ## a_cBits pfn, pfnNative; \ 2658 a_TestType const *paTests; \ 2659 uint32_t cTests; \ 2660 uint32_t uExtra; \ 2661 uint8_t idxCpuEflFlavour; \ 2662 } a_SubTestType; \ 2139 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLFPULDR80FROM ## a_cBits); \ 2663 2140 \ 2664 2141 static const a_SubTestType a_aSubTests[] = \ … … 2676 2153 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 2677 2154 \ 2678 uint32_t const cTests = a_aSubTests[iFn].cTests; \2155 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 2679 2156 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 2680 2157 PFNIEMAIMPLFPULDR80FROM ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 2681 2158 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 2159 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 2682 2160 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 2683 2161 { \ … … 2714 2192 static void FpuLdMemGenerate(PRTSTREAM pOut, uint32_t cTests) 2715 2193 { 2716 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_LD_MEM\n");2717 2194 FpuLdR80Generate(pOut, cTests); 2718 2195 FpuLdR64Generate(pOut, cTests); … … 2732 2209 * Load integer values from memory. 2733 2210 */ 2734 2735 #ifndef HAVE_FPU_LD_INT2736 static FPU_I64_IN_TEST_T const g_aTests_fild_r80_from_i64[] = { {0} };2737 static FPU_I32_IN_TEST_T const g_aTests_fild_r80_from_i32[] = { {0} };2738 static FPU_I16_IN_TEST_T const g_aTests_fild_r80_from_i16[] = { {0} };2739 #endif2740 2741 2211 #ifdef TSTIEMAIMPL_WITH_GENERATOR 2742 2212 # define GEN_FPU_LOAD_INT(a_cBits, a_iTypeIn, a_szFmtIn, a_aSubTests, a_TestType) \ … … 2747 2217 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 2748 2218 { \ 2749 RTStrmPrintf(pOut, "static const " #a_TestType " g_aTests_%s[] =\n{\n", a_aSubTests[iFn].pszName); \2219 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 2750 2220 for (uint32_t iTest = 0; iTest < cTests; iTest++) \ 2751 2221 { \ … … 2763 2233 } \ 2764 2234 } \ 2765 RTStrmPrintf(pOut, "};\n"); \2235 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \ 2766 2236 } \ 2767 2237 } … … 2773 2243 typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPULDR80FROMI ## a_cBits,(PCX86FXSTATE, PIEMFPURESULT, a_iTypeIn const *)); \ 2774 2244 typedef FNIEMAIMPLFPULDR80FROMI ## a_cBits *PFNIEMAIMPLFPULDR80FROMI ## a_cBits; \ 2775 typedef struct a_SubTestType \ 2776 { \ 2777 const char *pszName; \ 2778 PFNIEMAIMPLFPULDR80FROMI ## a_cBits pfn, pfnNative; \ 2779 a_TestType const *paTests; \ 2780 uint32_t cTests; \ 2781 uint32_t uExtra; \ 2782 uint8_t idxCpuEflFlavour; \ 2783 } a_SubTestType; \ 2245 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLFPULDR80FROMI ## a_cBits); \ 2784 2246 \ 2785 2247 static const a_SubTestType a_aSubTests[] = \ … … 2797 2259 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 2798 2260 \ 2799 uint32_t const cTests = a_aSubTests[iFn].cTests; \2261 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 2800 2262 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 2801 2263 PFNIEMAIMPLFPULDR80FROMI ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 2802 2264 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 2265 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 2803 2266 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 2804 2267 { \ … … 2834 2297 static void FpuLdIntGenerate(PRTSTREAM pOut, uint32_t cTests) 2835 2298 { 2836 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_LD_INT\n");2837 2299 FpuLdI64Generate(pOut, cTests); 2838 2300 FpuLdI32Generate(pOut, cTests); … … 2852 2314 * Load binary coded decimal values from memory. 2853 2315 */ 2854 2855 #ifndef HAVE_FPU_LD_BCD2856 static FPU_D80_IN_TEST_T const g_aTests_fld_r80_from_d80[] = { {0} };2857 #endif2858 2859 2316 typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPULDR80FROMD80,(PCX86FXSTATE, PIEMFPURESULT, PCRTPBCD80U)); 2860 2317 typedef FNIEMAIMPLFPULDR80FROMD80 *PFNIEMAIMPLFPULDR80FROMD80; 2861 typedef struct FPU_LD_D80_T 2862 { 2863 const char *pszName; 2864 PFNIEMAIMPLFPULDR80FROMD80 pfn, pfnNative; 2865 FPU_D80_IN_TEST_T const *paTests; 2866 uint32_t cTests; 2867 uint32_t uExtra; 2868 uint8_t idxCpuEflFlavour; 2869 } FPU_LD_D80_T; 2318 TYPEDEF_SUBTEST_TYPE(FPU_LD_D80_T, FPU_D80_IN_TEST_T, PFNIEMAIMPLFPULDR80FROMD80); 2870 2319 2871 2320 static const FPU_LD_D80_T g_aFpuLdD80[] = … … 2874 2323 }; 2875 2324 2876 2877 2325 #ifdef TSTIEMAIMPL_WITH_GENERATOR 2878 2326 static void FpuLdD80Generate(PRTSTREAM pOut, uint32_t cTests) 2879 2327 { 2880 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_LD_BCD\n");2881 2328 X86FXSTATE State; 2882 2329 RT_ZERO(State); 2883 2330 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuLdD80); iFn++) 2884 2331 { 2885 RTStrmPrintf(pOut, "static const FPU_D80_IN_TEST_T g_aTests_%s[] =\n{\n", g_aFpuLdD80[iFn].pszName); \2332 GenerateArrayStart(pOut, g_aFpuLdD80[iFn].pszName, "FPU_D80_IN_TEST_T"); 2886 2333 for (uint32_t iTest = 0; iTest < cTests; iTest++) 2887 2334 { … … 2900 2347 } 2901 2348 } 2902 RTStrmPrintf(pOut, "};\n");2349 GenerateArrayEnd(pOut, g_aFpuLdD80[iFn].pszName); 2903 2350 } 2904 2351 } … … 2913 2360 RTTestSub(g_hTest, g_aFpuLdD80[iFn].pszName); 2914 2361 2915 uint32_t const cTests = g_aFpuLdD80[iFn].cTests;2362 uint32_t const cTests = *g_aFpuLdD80[iFn].pcTests; 2916 2363 FPU_D80_IN_TEST_T const * const paTests = g_aFpuLdD80[iFn].paTests; 2917 2364 PFNIEMAIMPLFPULDR80FROMD80 pfn = g_aFpuLdD80[iFn].pfn; 2918 2365 uint32_t const cVars = 1 + (g_aFpuLdD80[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && g_aFpuLdD80[iFn].pfnNative); 2366 if (!cTests) RTTestSkipped(g_hTest, "no tests"); 2919 2367 for (uint32_t iVar = 0; iVar < cVars; iVar++) 2920 2368 { … … 2948 2396 * Store values floating point values to memory. 2949 2397 */ 2950 2951 #ifndef HAVE_FPU_ST_MEM2952 static FPU_ST_R80_TEST_T const g_aTests_fst_r80_to_r80[] = { {0} };2953 static FPU_ST_R64_TEST_T const g_aTests_fst_r80_to_r64[] = { {0} };2954 static FPU_ST_R32_TEST_T const g_aTests_fst_r80_to_r32[] = { {0} };2955 #endif2956 2957 2398 #ifdef TSTIEMAIMPL_WITH_GENERATOR 2958 2399 static const RTFLOAT80U g_aFpuStR32Specials[] = … … 2983 2424 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 2984 2425 { \ 2985 RTStrmPrintf(pOut, "static const " #a_TestType " g_aTests_%s[] =\n{\n", a_aSubTests[iFn].pszName); \2426 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 2986 2427 for (uint32_t iTest = 0; iTest < cTotalTests; iTest++) \ 2987 2428 { \ … … 3011 2452 } \ 3012 2453 } \ 3013 RTStrmPrintf(pOut, "};\n"); \2454 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \ 3014 2455 } \ 3015 2456 } … … 3022 2463 PRTFLOAT ## a_cBits ## U, PCRTFLOAT80U)); \ 3023 2464 typedef FNIEMAIMPLFPUSTR80TOR ## a_cBits *PFNIEMAIMPLFPUSTR80TOR ## a_cBits; \ 3024 typedef struct a_SubTestType \ 3025 { \ 3026 const char *pszName; \ 3027 PFNIEMAIMPLFPUSTR80TOR ## a_cBits pfn, pfnNative; \ 3028 a_TestType const *paTests; \ 3029 uint32_t cTests; \ 3030 uint32_t uExtra; \ 3031 uint8_t idxCpuEflFlavour; \ 3032 } a_SubTestType; \ 2465 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLFPUSTR80TOR ## a_cBits); \ 3033 2466 \ 3034 2467 static const a_SubTestType a_aSubTests[] = \ … … 3046 2479 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 3047 2480 \ 3048 uint32_t const cTests = a_aSubTests[iFn].cTests; \2481 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 3049 2482 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 3050 2483 PFNIEMAIMPLFPUSTR80TOR ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 3051 2484 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 2485 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 3052 2486 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 3053 2487 { \ … … 3087 2521 static void FpuStMemGenerate(PRTSTREAM pOut, uint32_t cTests) 3088 2522 { 3089 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_ST_MEM\n");3090 2523 FpuStR80Generate(pOut, cTests); 3091 2524 FpuStR64Generate(pOut, cTests); … … 3105 2538 * Store integer values to memory or register. 3106 2539 */ 3107 3108 #ifndef HAVE_FPU_ST_INT3109 static FPU_ST_I64_TEST_T const g_aTests_fist_r80_to_i64[] = { {0} };3110 static FPU_ST_I32_TEST_T const g_aTests_fist_r80_to_i32[] = { {0} };3111 static FPU_ST_I16_TEST_T const g_aTests_fist_r80_to_i16[] = { {0} };3112 static FPU_ST_I64_TEST_T const g_aTests_fistt_r80_to_i64[] = { {0} };3113 static FPU_ST_I32_TEST_T const g_aTests_fistt_r80_to_i32[] = { {0} };3114 static FPU_ST_I16_TEST_T const g_aTests_fistt_r80_to_i16[] = { {0} };3115 #endif3116 3117 2540 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3118 2541 static const RTFLOAT80U g_aFpuStI16Specials[] = /* 16-bit variant borrows properties from the 32-bit one, thus all this stuff. */ … … 3213 2636 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3214 2637 { \ 3215 RTStrmPrintf(pOut, "static const " #a_TestType " g_aTests_%s[] =\n{\n", a_aSubTests[iFn].pszName); \2638 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 3216 2639 uint32_t const cTotalTests = cTests + RT_ELEMENTS(g_aFpuStI ## a_cBits ## Specials); \ 3217 2640 for (uint32_t iTest = 0; iTest < cTotalTests; iTest++) \ … … 3241 2664 } \ 3242 2665 } \ 3243 RTStrmPrintf(pOut, "};\n"); \2666 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \ 3244 2667 } \ 3245 2668 } … … 3251 2674 typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUSTR80TOI ## a_cBits,(PCX86FXSTATE, uint16_t *, a_iType *, PCRTFLOAT80U)); \ 3252 2675 typedef FNIEMAIMPLFPUSTR80TOI ## a_cBits *PFNIEMAIMPLFPUSTR80TOI ## a_cBits; \ 3253 typedef struct a_SubTestType \ 3254 { \ 3255 const char *pszName; \ 3256 PFNIEMAIMPLFPUSTR80TOI ## a_cBits pfn, pfnNative; \ 3257 a_TestType const *paTests; \ 3258 uint32_t cTests; \ 3259 uint32_t uExtra; \ 3260 uint8_t idxCpuEflFlavour; \ 3261 } a_SubTestType; \ 2676 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLFPUSTR80TOI ## a_cBits); \ 3262 2677 \ 3263 2678 static const a_SubTestType a_aSubTests[] = \ … … 3276 2691 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 3277 2692 \ 3278 uint32_t const cTests = a_aSubTests[iFn].cTests; \2693 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 3279 2694 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 3280 2695 PFNIEMAIMPLFPUSTR80TOI ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 3281 2696 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 2697 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 3282 2698 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 3283 2699 { \ … … 3314 2730 static void FpuStIntGenerate(PRTSTREAM pOut, uint32_t cTests) 3315 2731 { 3316 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_ST_INT\n");3317 2732 FpuStI64Generate(pOut, cTests); 3318 2733 FpuStI32Generate(pOut, cTests); … … 3332 2747 * Store as packed BCD value (memory). 3333 2748 */ 3334 3335 #ifndef HAVE_FPU_ST_BCD3336 static FPU_ST_D80_TEST_T const g_aTests_fst_r80_to_d80[] = { {0} };3337 #endif3338 3339 2749 typedef IEM_DECL_IMPL_TYPE(void, FNIEMAIMPLFPUSTR80TOD80,(PCX86FXSTATE, uint16_t *, PRTPBCD80U, PCRTFLOAT80U)); 3340 2750 typedef FNIEMAIMPLFPUSTR80TOD80 *PFNIEMAIMPLFPUSTR80TOD80; 3341 typedef struct FPU_ST_D80_T 3342 { 3343 const char *pszName; 3344 PFNIEMAIMPLFPUSTR80TOD80 pfn, pfnNative; 3345 FPU_ST_D80_TEST_T const *paTests; 3346 uint32_t cTests; 3347 uint32_t uExtra; 3348 uint8_t idxCpuEflFlavour; 3349 } FPU_ST_D80_T; 2751 TYPEDEF_SUBTEST_TYPE(FPU_ST_D80_T, FPU_ST_D80_TEST_T, PFNIEMAIMPLFPUSTR80TOD80); 3350 2752 3351 2753 static const FPU_ST_D80_T g_aFpuStD80[] = … … 3373 2775 }; 3374 2776 3375 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_ST_BCD\n");3376 2777 X86FXSTATE State; 3377 2778 RT_ZERO(State); 3378 2779 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuStD80); iFn++) 3379 2780 { 3380 RTStrmPrintf(pOut, "static const FPU_ST_D80_TEST_T g_aTests_%s[] =\n{\n", g_aFpuStD80[iFn].pszName);2781 GenerateArrayStart(pOut, g_aFpuStD80[iFn].pszName, "FPU_ST_D80_TEST_T"); 3381 2782 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1) 3382 2783 { … … 3404 2805 } 3405 2806 } 3406 RTStrmPrintf(pOut, "};\n");2807 GenerateArrayEnd(pOut, g_aFpuStD80[iFn].pszName); 3407 2808 } 3408 2809 } … … 3418 2819 RTTestSub(g_hTest, g_aFpuStD80[iFn].pszName); 3419 2820 3420 uint32_t const cTests = g_aFpuStD80[iFn].cTests;2821 uint32_t const cTests = *g_aFpuStD80[iFn].pcTests; 3421 2822 FPU_ST_D80_TEST_T const * const paTests = g_aFpuStD80[iFn].paTests; 3422 2823 PFNIEMAIMPLFPUSTR80TOD80 pfn = g_aFpuStD80[iFn].pfn; 3423 2824 uint32_t const cVars = 1 + (g_aFpuStD80[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && g_aFpuStD80[iFn].pfnNative); 2825 if (!cTests) RTTestSkipped(g_hTest, "no tests"); 3424 2826 for (uint32_t iVar = 0; iVar < cVars; iVar++) 3425 2827 { … … 3452 2854 3453 2855 3454 /* 3455 * Other FPU stuff. 3456 */ 3457 3458 typedef struct FPU_BINARY_R80_TEST_T 3459 { 3460 uint16_t fFcw; 3461 uint16_t fFswIn; 3462 uint16_t fFswOut; 3463 RTFLOAT80U InVal1; 3464 RTFLOAT80U InVal2; 3465 RTFLOAT80U OutVal; 3466 } FPU_BINARY_R80_TEST_T; 3467 3468 typedef struct FPU_BINARY_R64_TEST_T 3469 { 3470 uint16_t fFcw; 3471 uint16_t fFswIn; 3472 uint16_t fFswOut; 3473 RTFLOAT80U InVal1; 3474 RTFLOAT64U InVal2; 3475 RTFLOAT80U OutVal; 3476 } FPU_BINARY_R64_TEST_T; 3477 3478 typedef struct FPU_BINARY_R32_TEST_T 3479 { 3480 uint16_t fFcw; 3481 uint16_t fFswIn; 3482 uint16_t fFswOut; 3483 RTFLOAT80U InVal1; 3484 RTFLOAT32U InVal2; 3485 RTFLOAT80U OutVal; 3486 } FPU_BINARY_R32_TEST_T; 3487 3488 typedef struct FPU_BINARY_EFL_R80_TEST_T 3489 { 3490 uint16_t fFcw; 3491 uint16_t fFswIn; 3492 uint16_t fFswOut; 3493 RTFLOAT80U InVal1; 3494 RTFLOAT80U InVal2; 3495 uint32_t fEflOut; 3496 } FPU_BINARY_EFL_R80_TEST_T; 3497 3498 #include "tstIEMAImplDataFpuBinary.h" 3499 2856 /********************************************************************************************************************************* 2857 * x87 FPU Binary Operations * 2858 *********************************************************************************************************************************/ 3500 2859 3501 2860 /* 3502 2861 * Binary FPU operations on two 80-bit floating point values. 3503 2862 */ 3504 3505 #ifndef HAVE_FPU_BINARY_R80 3506 static FPU_BINARY_R80_TEST_T const g_aTests_fadd_r80_by_r80[] = { {0} }; 3507 static FPU_BINARY_R80_TEST_T const g_aTests_fsub_r80_by_r80[] = { {0} }; 3508 static FPU_BINARY_R80_TEST_T const g_aTests_fsubr_r80_by_r80[] = { {0} }; 3509 static FPU_BINARY_R80_TEST_T const g_aTests_fmul_r80_by_r80[] = { {0} }; 3510 static FPU_BINARY_R80_TEST_T const g_aTests_fdiv_r80_by_r80[] = { {0} }; 3511 static FPU_BINARY_R80_TEST_T const g_aTests_fdivr_r80_by_r80[] = { {0} }; 3512 static FPU_BINARY_R80_TEST_T const g_aTests_fprem_r80_by_r80[] = { {0} }; 3513 static FPU_BINARY_R80_TEST_T const g_aTests_fprem1_r80_by_r80[] = { {0} }; 3514 static FPU_BINARY_R80_TEST_T const g_aTests_fscale_r80_by_r80[] = { {0} }; 3515 static FPU_BINARY_R80_TEST_T const g_aTests_fpatan_r80_by_r80[] = { {0} }; 3516 static FPU_BINARY_R80_TEST_T const g_aTests_fyl2x_r80_by_r80[] = { {0} }; 3517 static FPU_BINARY_R80_TEST_T const g_aTests_fyl2xp1_r80_by_r80[] = { {0} }; 3518 #endif 3519 3520 typedef struct FPU_BINARY_R80_T 3521 { 3522 const char *pszName; 3523 PFNIEMAIMPLFPUR80 pfn, pfnNative; 3524 FPU_BINARY_R80_TEST_T const *paTests; 3525 uint32_t cTests; 3526 uint32_t uExtra; 3527 uint8_t idxCpuEflFlavour; 3528 } FPU_BINARY_R80_T; 2863 TYPEDEF_SUBTEST_TYPE(FPU_BINARY_R80_T, FPU_BINARY_R80_TEST_T, PFNIEMAIMPLFPUR80); 3529 2864 3530 2865 static const FPU_BINARY_R80_T g_aFpuBinaryR80[] = … … 3553 2888 }; 3554 2889 3555 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_BINARY_R80\n");3556 2890 X86FXSTATE State; 3557 2891 RT_ZERO(State); … … 3559 2893 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuBinaryR80); iFn++) 3560 2894 { 3561 RTStrmPrintf(pOut, "static const FPU_BINARY_R80_TEST_T g_aTests_%s[] =\n{\n", g_aFpuBinaryR80[iFn].pszName);2895 GenerateArrayStart(pOut, g_aFpuBinaryR80[iFn].pszName, "FPU_BINARY_R80_TEST_T"); 3562 2896 uint32_t cNormalInputPairs = 0; 3563 2897 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1) … … 3595 2929 } 3596 2930 } 3597 RTStrmPrintf(pOut, "};\n");2931 GenerateArrayEnd(pOut, g_aFpuBinaryR80[iFn].pszName); 3598 2932 } 3599 2933 } … … 3609 2943 RTTestSub(g_hTest, g_aFpuBinaryR80[iFn].pszName); 3610 2944 3611 uint32_t const cTests = g_aFpuBinaryR80[iFn].cTests;2945 uint32_t const cTests = *g_aFpuBinaryR80[iFn].pcTests; 3612 2946 FPU_BINARY_R80_TEST_T const * const paTests = g_aFpuBinaryR80[iFn].paTests; 3613 2947 PFNIEMAIMPLFPUR80 pfn = g_aFpuBinaryR80[iFn].pfn; 3614 2948 uint32_t const cVars = 1 + (g_aFpuBinaryR80[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && g_aFpuBinaryR80[iFn].pfnNative); 2949 if (!cTests) RTTestSkipped(g_hTest, "no tests"); 3615 2950 for (uint32_t iVar = 0; iVar < cVars; iVar++) 3616 2951 { … … 3645 2980 * Binary FPU operations on one 80-bit floating point value and one 64-bit or 32-bit one. 3646 2981 */ 3647 3648 #ifndef HAVE_FPU_BINARY_R643649 static FPU_BINARY_R64_TEST_T const g_aTests_fadd_r80_by_r64[] = { {0} };3650 static FPU_BINARY_R64_TEST_T const g_aTests_fmul_r80_by_r64[] = { {0} };3651 static FPU_BINARY_R64_TEST_T const g_aTests_fsub_r80_by_r64[] = { {0} };3652 static FPU_BINARY_R64_TEST_T const g_aTests_fsubr_r80_by_r64[] = { {0} };3653 static FPU_BINARY_R64_TEST_T const g_aTests_fdiv_r80_by_r64[] = { {0} };3654 static FPU_BINARY_R64_TEST_T const g_aTests_fdivr_r80_by_r64[] = { {0} };3655 #endif3656 #ifndef HAVE_FPU_BINARY_R323657 static FPU_BINARY_R32_TEST_T const g_aTests_fadd_r80_by_r32[] = { {0} };3658 static FPU_BINARY_R32_TEST_T const g_aTests_fmul_r80_by_r32[] = { {0} };3659 static FPU_BINARY_R32_TEST_T const g_aTests_fsub_r80_by_r32[] = { {0} };3660 static FPU_BINARY_R32_TEST_T const g_aTests_fsubr_r80_by_r32[] = { {0} };3661 static FPU_BINARY_R32_TEST_T const g_aTests_fdiv_r80_by_r32[] = { {0} };3662 static FPU_BINARY_R32_TEST_T const g_aTests_fdivr_r80_by_r32[] = { {0} };3663 #endif3664 3665 2982 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3666 2983 static struct { RTFLOAT80U Val1; RTFLOAT64U Val2; } const s_aFpuBinaryR64Specials[] = … … 3678 2995 static void FpuBinaryR ## a_cBits ## Generate(PRTSTREAM pOut, uint32_t cTests) \ 3679 2996 { \ 3680 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_BINARY_R" #a_cBits "\n"); \3681 2997 X86FXSTATE State; \ 3682 2998 RT_ZERO(State); \ … … 3684 3000 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3685 3001 { \ 3686 RTStrmPrintf(pOut, "static const " #a_TestType " g_aTests_%s[] =\n{\n", a_aSubTests[iFn].pszName); \3002 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 3687 3003 uint32_t cNormalInputPairs = 0; \ 3688 3004 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aFpuBinaryR ## a_cBits ## Specials); iTest += 1) \ … … 3722 3038 } \ 3723 3039 } \ 3724 RTStrmPrintf(pOut, "};\n"); \3040 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \ 3725 3041 } \ 3726 3042 } … … 3730 3046 3731 3047 #define TEST_FPU_BINARY_SMALL(a_cBits, a_rdType, a_SubTestType, a_aSubTests, a_TestType) \ 3732 typedef struct a_SubTestType \ 3733 { \ 3734 const char *pszName; \ 3735 PFNIEMAIMPLFPUR ## a_cBits pfn, pfnNative; \ 3736 a_TestType const *paTests; \ 3737 uint32_t cTests; \ 3738 uint32_t uExtra; \ 3739 uint8_t idxCpuEflFlavour; \ 3740 } a_SubTestType; \ 3048 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLFPUR ## a_cBits); \ 3741 3049 \ 3742 3050 static const a_SubTestType a_aSubTests[] = \ … … 3760 3068 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 3761 3069 \ 3762 uint32_t const cTests = a_aSubTests[iFn].cTests; \3070 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 3763 3071 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 3764 3072 PFNIEMAIMPLFPUR ## a_cBits pfn = a_aSubTests[iFn].pfn; \ 3765 3073 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 3074 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 3766 3075 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 3767 3076 { \ … … 3799 3108 * Binary operations on 80-, 64- and 32-bit floating point only affecting FSW. 3800 3109 */ 3801 #ifndef HAVE_FPU_BINARY_FSW_R803802 static FPU_BINARY_R80_TEST_T const g_aTests_fcom_r80_by_r80[] = { {0} };3803 static FPU_BINARY_R80_TEST_T const g_aTests_fucom_r80_by_r80[] = { {0} };3804 #endif3805 #ifndef HAVE_FPU_BINARY_FSW_R643806 static FPU_BINARY_R64_TEST_T const g_aTests_fcom_r80_by_r64[] = { {0} };3807 #endif3808 #ifndef HAVE_FPU_BINARY_FSW_R323809 static FPU_BINARY_R32_TEST_T const g_aTests_fcom_r80_by_r32[] = { {0} };3810 #endif3811 3812 3110 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3813 3111 static struct { RTFLOAT80U Val1, Val2; } const s_aFpuBinaryFswR80Specials[] = … … 3830 3128 static void FpuBinaryFswR ## a_cBits ## Generate(PRTSTREAM pOut, uint32_t cTests) \ 3831 3129 { \ 3832 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_BINARY_FSW_R" #a_cBits "\n"); \3833 3130 X86FXSTATE State; \ 3834 3131 RT_ZERO(State); \ … … 3836 3133 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3837 3134 { \ 3838 RTStrmPrintf(pOut, "static const " #a_TestType " g_aTests_%s[] =\n{\n", a_aSubTests[iFn].pszName); \3135 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 3839 3136 uint32_t cNormalInputPairs = 0; \ 3840 3137 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aFpuBinaryFswR ## a_cBits ## Specials); iTest += 1) \ … … 3866 3163 } \ 3867 3164 } \ 3868 RTStrmPrintf(pOut, "};\n"); \3165 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \ 3869 3166 } \ 3870 3167 } … … 3874 3171 3875 3172 #define TEST_FPU_BINARY_FSW(a_cBits, a_rdType, a_SubTestType, a_aSubTests, a_TestType, ...) \ 3876 typedef struct a_SubTestType \ 3877 { \ 3878 const char *pszName; \ 3879 PFNIEMAIMPLFPUR ## a_cBits ## FSW pfn, pfnNative; \ 3880 a_TestType const *paTests; \ 3881 uint32_t cTests; \ 3882 uint32_t uExtra; \ 3883 uint8_t idxCpuEflFlavour; \ 3884 } a_SubTestType; \ 3173 TYPEDEF_SUBTEST_TYPE(a_SubTestType, a_TestType, PFNIEMAIMPLFPUR ## a_cBits ## FSW); \ 3885 3174 \ 3886 3175 static const a_SubTestType a_aSubTests[] = \ … … 3900 3189 RTTestSub(g_hTest, a_aSubTests[iFn].pszName); \ 3901 3190 \ 3902 uint32_t const cTests = a_aSubTests[iFn].cTests; \3191 uint32_t const cTests = *a_aSubTests[iFn].pcTests; \ 3903 3192 a_TestType const * const paTests = a_aSubTests[iFn].paTests; \ 3904 3193 PFNIEMAIMPLFPUR ## a_cBits ## FSW pfn = a_aSubTests[iFn].pfn; \ 3905 3194 uint32_t const cVars = 1 + (a_aSubTests[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && a_aSubTests[iFn].pfnNative); \ 3195 if (!cTests) RTTestSkipped(g_hTest, "no tests"); \ 3906 3196 for (uint32_t iVar = 0; iVar < cVars; iVar++) \ 3907 3197 { \ … … 3937 3227 * Binary operations on 80-bit floating point that effects only EFLAGS and possibly FSW. 3938 3228 */ 3939 #ifndef HAVE_FPU_BINARY_EFL_R80 3940 static FPU_BINARY_EFL_R80_TEST_T const g_aTests_fcomi_r80_by_r80[] = { {0} }; 3941 static FPU_BINARY_EFL_R80_TEST_T const g_aTests_fucomi_r80_by_r80[] = { {0} }; 3942 #endif 3943 3944 typedef struct FPU_BINARY_EFL_R80_T 3945 { 3946 const char *pszName; 3947 PFNIEMAIMPLFPUR80EFL pfn, pfnNative; 3948 FPU_BINARY_EFL_R80_TEST_T const *paTests; 3949 uint32_t cTests; 3950 uint32_t uExtra; 3951 uint8_t idxCpuEflFlavour; 3952 } FPU_BINARY_EFL_R80_T; 3229 TYPEDEF_SUBTEST_TYPE(FPU_BINARY_EFL_R80_T, FPU_BINARY_EFL_R80_TEST_T, PFNIEMAIMPLFPUR80EFL); 3953 3230 3954 3231 static const FPU_BINARY_EFL_R80_T g_aFpuBinaryEflR80[] = … … 3967 3244 static void FpuBinaryEflR80Generate(PRTSTREAM pOut, uint32_t cTests) 3968 3245 { 3969 RTStrmPrintf(pOut, "\n\n#define HAVE_FPU_BINARY_EFL_R80\n");3970 3246 X86FXSTATE State; 3971 3247 RT_ZERO(State); … … 3973 3249 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuBinaryEflR80); iFn++) 3974 3250 { 3975 RTStrmPrintf(pOut, "static const FPU_BINARY_EFL_R80_TEST_T g_aTests_%s[] =\n{\n", g_aFpuBinaryEflR80[iFn].pszName);3251 GenerateArrayStart(pOut, g_aFpuBinaryEflR80[iFn].pszName, "FPU_BINARY_EFL_R80_TEST_T"); 3976 3252 uint32_t cNormalInputPairs = 0; 3977 3253 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aFpuBinaryEflR80Specials); iTest += 1) … … 4001 3277 } 4002 3278 } 4003 RTStrmPrintf(pOut, "};\n");3279 GenerateArrayEnd(pOut, g_aFpuBinaryEflR80[iFn].pszName); 4004 3280 } 4005 3281 } … … 4014 3290 RTTestSub(g_hTest, g_aFpuBinaryEflR80[iFn].pszName); 4015 3291 4016 uint32_t const cTests = g_aFpuBinaryEflR80[iFn].cTests;3292 uint32_t const cTests = *g_aFpuBinaryEflR80[iFn].pcTests; 4017 3293 FPU_BINARY_EFL_R80_TEST_T const * const paTests = g_aFpuBinaryEflR80[iFn].paTests; 4018 3294 PFNIEMAIMPLFPUR80EFL pfn = g_aFpuBinaryEflR80[iFn].pfn; 4019 3295 uint32_t const cVars = 1 + (g_aFpuBinaryEflR80[iFn].idxCpuEflFlavour == g_idxCpuEflFlavour && g_aFpuBinaryEflR80[iFn].pfnNative); 3296 if (!cTests) RTTestSkipped(g_hTest, "no tests"); 4020 3297 for (uint32_t iVar = 0; iVar < cVars; iVar++) 4021 3298 { … … 4071 3348 bool fInt = true; 4072 3349 bool fFpuLdSt = true; 4073 bool fFpuBinary = true; 3350 bool fFpuBinary1 = true; 3351 bool fFpuBinary2 = true; 4074 3352 bool fFpuOther = true; 4075 3353 bool fCpuData = true; … … 4088 3366 { "--fpu-ld-st", 'F', RTGETOPT_REQ_NOTHING }, /* FPU stuff is upper case */ 4089 3367 { "--fpu-load-store", 'F', RTGETOPT_REQ_NOTHING }, 4090 { "--fpu-binary", 'B', RTGETOPT_REQ_NOTHING }, 3368 { "--fpu-binary-1", 'B', RTGETOPT_REQ_NOTHING }, 3369 { "--fpu-binary-2", 'P', RTGETOPT_REQ_NOTHING }, 4091 3370 { "--fpu-other", 'O', RTGETOPT_REQ_NOTHING }, 4092 3371 { "--int", 'i', RTGETOPT_REQ_NOTHING }, … … 4117 3396 fInt = true; 4118 3397 fFpuLdSt = true; 4119 fFpuBinary = true; 3398 fFpuBinary1 = true; 3399 fFpuBinary2 = true; 4120 3400 fFpuOther = true; 4121 3401 break; … … 4125 3405 fInt = false; 4126 3406 fFpuLdSt = false; 4127 fFpuBinary = false; 3407 fFpuBinary1 = false; 3408 fFpuBinary2 = false; 4128 3409 fFpuOther = false; 4129 3410 break; … … 4135 3416 break; 4136 3417 case 'B': 4137 fFpuBinary = true; 3418 fFpuBinary1 = true; 3419 break; 3420 case 'P': 3421 fFpuBinary2 = true; 4138 3422 break; 4139 3423 case 'i': … … 4167 3451 " -F, --fpu-ld-st\n" 4168 3452 " Enable FPU load and store tests.\n" 4169 " -B, --fpu-binary\n" 4170 " Enable FPU binary 80, 64 and 32-bit FP tests.\n" 3453 " -B, --fpu-binary-1\n" 3454 " Enable FPU binary 80-bit FP tests.\n" 3455 " -P, --fpu-binary-2\n" 3456 " Enable FPU binary 64- and 32-bit FP tests.\n" 4171 3457 " -O, --fpu-other\n" 4172 3458 " Enable other FPU tests.\n" … … 4195 3481 RTMpGetDescription(NIL_RTCPUID, szCpuDesc, sizeof(szCpuDesc)); 4196 3482 const char * const pszCpuType = g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD ? "Amd" : "Intel"; 4197 const char * const pszCpuSuff = g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD ? "_Amd" : "_Intel";4198 const char * const pszCpuSuffU = g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD ? "_AMD" : "_INTEL";4199 3483 # if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 4200 3484 const char * const pszBitBucket = "NUL"; … … 4210 3494 if (fInt) 4211 3495 { 4212 const char *pszFileInfix = ""; 4213 const char *pszDataFile = fCommonData ? "tstIEMAImplData.h" : pszBitBucket; 4214 PRTSTREAM pStrmData = NULL; 4215 rc = RTStrmOpen(pszDataFile, "w", &pStrmData); 4216 if (!pStrmData) 4217 return RTMsgErrorExitFailure("Failed to open %s for writing: %Rrc", pszDataFile, rc); 4218 3496 const char *pszDataFile = fCommonData ? "tstIEMAImplDataInt.cpp" : pszBitBucket; 3497 PRTSTREAM pStrmData = GenerateOpenWithHdr(pszDataFile, szCpuDesc, NULL); 4219 3498 const char *pszDataCpuFile = !fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 4220 ? "tstIEMAImplData-Amd.h" : "tstIEMAImplData-Intel.h"; 4221 PRTSTREAM pStrmDataCpu = NULL; 4222 rc = RTStrmOpen(pszDataCpuFile, "w", &pStrmDataCpu); 4223 if (!pStrmData) 4224 return RTMsgErrorExitFailure("Failed to open %s for writing: %Rrc", pszDataCpuFile, rc); 4225 4226 GenerateHeader(pStrmData, pszFileInfix, szCpuDesc, NULL, ""); 4227 GenerateHeader(pStrmDataCpu, pszFileInfix, szCpuDesc, pszCpuType, pszCpuSuff); 4228 4229 BinU8Generate( pStrmData, pStrmDataCpu, pszCpuSuffU, cTests); 4230 BinU16Generate(pStrmData, pStrmDataCpu, pszCpuSuffU, cTests); 4231 BinU32Generate(pStrmData, pStrmDataCpu, pszCpuSuffU, cTests); 4232 BinU64Generate(pStrmData, pStrmDataCpu, pszCpuSuffU, cTests); 4233 ShiftDblGenerate(pStrmDataCpu, pszCpuSuffU, RT_MAX(cTests, 128)); 3499 ? "tstIEMAImplDataInt-Amd.cpp" : "tstIEMAImplDataInt-Intel.cpp"; 3500 PRTSTREAM pStrmDataCpu = GenerateOpenWithHdr(pszDataCpuFile, szCpuDesc, pszCpuType); 3501 if (!pStrmData || !pStrmDataCpu) 3502 return RTEXITCODE_FAILURE; 3503 3504 BinU8Generate( pStrmData, pStrmDataCpu, cTests); 3505 BinU16Generate(pStrmData, pStrmDataCpu, cTests); 3506 BinU32Generate(pStrmData, pStrmDataCpu, cTests); 3507 BinU64Generate(pStrmData, pStrmDataCpu, cTests); 3508 ShiftDblGenerate(pStrmDataCpu, RT_MAX(cTests, 128)); 4234 3509 UnaryGenerate(pStrmData, cTests); 4235 ShiftGenerate(pStrmDataCpu, pszCpuSuffU, cTests); 4236 MulDivGenerate(pStrmDataCpu, pszCpuSuffU, cTests); 4237 4238 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, pszFileInfix, pszCpuSuff, 4239 GenerateFooterAndClose(pStrmData, pszDataFile, pszFileInfix, "", 4240 RTEXITCODE_SUCCESS)); 3510 ShiftGenerate(pStrmDataCpu, cTests); 3511 MulDivGenerate(pStrmDataCpu, cTests); 3512 3513 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, 3514 GenerateFooterAndClose(pStrmData, pszDataFile, RTEXITCODE_SUCCESS)); 4241 3515 if (rcExit != RTEXITCODE_SUCCESS) 4242 3516 return rcExit; … … 4245 3519 if (fFpuLdSt) 4246 3520 { 4247 const char *pszFileInfix = "FpuLdSt"; 4248 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuLdSt.h" : pszBitBucket; 4249 PRTSTREAM pStrmData = NULL; 4250 rc = RTStrmOpen(pszDataFile, "w", &pStrmData); 4251 if (!pStrmData) 4252 return RTMsgErrorExitFailure("Failed to open %s for writing: %Rrc", pszDataFile, rc); 4253 3521 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuLdSt.cpp" : pszBitBucket; 3522 PRTSTREAM pStrmData = GenerateOpenWithHdr(pszDataFile, szCpuDesc, NULL); 4254 3523 const char *pszDataCpuFile = !fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 4255 ? "tstIEMAImplDataFpuLdSt-Amd.h" : "tstIEMAImplDataFpuLdSt-Intel.h"; 4256 PRTSTREAM pStrmDataCpu = NULL; 4257 rc = RTStrmOpen(pszDataCpuFile, "w", &pStrmDataCpu); 4258 if (!pStrmData) 4259 return RTMsgErrorExitFailure("Failed to open %s for writing: %Rrc", pszDataCpuFile, rc); 4260 4261 GenerateHeader(pStrmData, pszFileInfix, szCpuDesc, NULL, ""); 4262 GenerateHeader(pStrmDataCpu, pszFileInfix, szCpuDesc, pszCpuType, pszCpuSuff); 3524 ? "tstIEMAImplDataFpuLdSt-Amd.cpp" : "tstIEMAImplDataFpuLdSt-Intel.cpp"; 3525 PRTSTREAM pStrmDataCpu = GenerateOpenWithHdr(pszDataCpuFile, szCpuDesc, pszCpuType); 3526 if (!pStrmData || !pStrmDataCpu) 3527 return RTEXITCODE_FAILURE; 4263 3528 4264 3529 FpuLdConstGenerate(pStrmData, cTests); … … 4271 3536 FpuStMemGenerate(pStrmData, cTests); 4272 3537 4273 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, pszFileInfix, pszCpuSuff, 4274 GenerateFooterAndClose(pStrmData, pszDataFile, pszFileInfix, "", 4275 RTEXITCODE_SUCCESS)); 3538 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, 3539 GenerateFooterAndClose(pStrmData, pszDataFile, RTEXITCODE_SUCCESS)); 4276 3540 if (rcExit != RTEXITCODE_SUCCESS) 4277 3541 return rcExit; 4278 3542 } 4279 3543 4280 if (fFpuBinary )3544 if (fFpuBinary1) 4281 3545 { 4282 const char *pszFileInfix = "FpuBinary"; 4283 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuBinary.h" : pszBitBucket; 4284 PRTSTREAM pStrmData = NULL; 4285 rc = RTStrmOpen(pszDataFile, "w", &pStrmData); 4286 if (!pStrmData) 4287 return RTMsgErrorExitFailure("Failed to open %s for writing: %Rrc", pszDataFile, rc); 4288 4289 const char *pszDataCpuFile = !fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 4290 ? "tstIEMAImplDataFpuBinary-Amd.h" : "tstIEMAImplDataFpuBinary-Intel.h"; 4291 PRTSTREAM pStrmDataCpu = NULL; 4292 rc = RTStrmOpen(pszDataCpuFile, "w", &pStrmDataCpu); 4293 if (!pStrmData) 4294 return RTMsgErrorExitFailure("Failed to open %s for writing: %Rrc", pszDataCpuFile, rc); 4295 4296 GenerateHeader(pStrmData, pszFileInfix, szCpuDesc, NULL, ""); 4297 GenerateHeader(pStrmDataCpu, pszFileInfix, szCpuDesc, pszCpuType, pszCpuSuff); 3546 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuBinary1.cpp" : pszBitBucket; 3547 PRTSTREAM pStrmData = GenerateOpenWithHdr(pszDataFile, szCpuDesc, NULL); 3548 const char *pszDataCpuFile = pszBitBucket; /*!fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 3549 ? "tstIEMAImplDataFpuBinary1-Amd.cpp" : "tstIEMAImplDataFpuBinary1-Intel.cpp";*/ 3550 PRTSTREAM pStrmDataCpu = GenerateOpenWithHdr(pszDataCpuFile, szCpuDesc, pszCpuType); 3551 if (!pStrmData || !pStrmDataCpu) 3552 return RTEXITCODE_FAILURE; 4298 3553 4299 3554 FpuBinaryR80Generate(pStrmData, cTests); 4300 FpuBinaryR64Generate(pStrmData, cTests);4301 FpuBinaryR32Generate(pStrmData, cTests);4302 3555 FpuBinaryFswR80Generate(pStrmData, cTests); 4303 FpuBinaryFswR64Generate(pStrmData, cTests);4304 FpuBinaryFswR32Generate(pStrmData, cTests);4305 3556 FpuBinaryEflR80Generate(pStrmData, cTests); 4306 3557 4307 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, pszFileInfix, pszCpuSuff, 4308 GenerateFooterAndClose(pStrmData, pszDataFile, pszFileInfix, "", 4309 RTEXITCODE_SUCCESS)); 3558 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, 3559 GenerateFooterAndClose(pStrmData, pszDataFile, RTEXITCODE_SUCCESS)); 4310 3560 if (rcExit != RTEXITCODE_SUCCESS) 4311 3561 return rcExit; 4312 3562 } 4313 3563 3564 if (fFpuBinary2) 3565 { 3566 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuBinary2.cpp" : pszBitBucket; 3567 PRTSTREAM pStrmData = GenerateOpenWithHdr(pszDataFile, szCpuDesc, NULL); 3568 const char *pszDataCpuFile = pszBitBucket; /*!fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 3569 ? "tstIEMAImplDataFpuBinary2-Amd.cpp" : "tstIEMAImplDataFpuBinary2-Intel.cpp"; */ 3570 PRTSTREAM pStrmDataCpu = GenerateOpenWithHdr(pszDataCpuFile, szCpuDesc, pszCpuType); 3571 if (!pStrmData || !pStrmDataCpu) 3572 return RTEXITCODE_FAILURE; 3573 3574 FpuBinaryR64Generate(pStrmData, cTests); 3575 FpuBinaryR32Generate(pStrmData, cTests); 3576 FpuBinaryFswR64Generate(pStrmData, cTests); 3577 FpuBinaryFswR32Generate(pStrmData, cTests); 3578 3579 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, 3580 GenerateFooterAndClose(pStrmData, pszDataFile, RTEXITCODE_SUCCESS)); 3581 if (rcExit != RTEXITCODE_SUCCESS) 3582 return rcExit; 3583 } 3584 4314 3585 # if 0 4315 3586 if (fFpuOther) 4316 3587 { 4317 const char *pszFileInfix = "FpuOther"; 4318 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuOther.h" : pszBitBucket; 4319 PRTSTREAM pStrmData = NULL; 4320 rc = RTStrmOpen(pszDataFile, "w", &pStrmData); 4321 if (!pStrmData) 4322 return RTMsgErrorExitFailure("Failed to open %s for writing: %Rrc", pszDataFile, rc); 4323 3588 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuOther.cpp" : pszBitBucket; 3589 PRTSTREAM pStrmData = GenerateOpenWithHdr(pszDataFile, szCpuDesc, NULL); 4324 3590 const char *pszDataCpuFile = !fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 4325 ? "tstIEMAImplDataFpuOther-Amd.h" : "tstIEMAImplDataFpuOther-Intel.h"; 4326 PRTSTREAM pStrmDataCpu = NULL; 4327 rc = RTStrmOpen(pszDataCpuFile, "w", &pStrmDataCpu); 4328 if (!pStrmData) 4329 return RTMsgErrorExitFailure("Failed to open %s for writing: %Rrc", pszDataCpuFile, rc); 4330 4331 GenerateHeader(pStrmData, pszFileInfix, szCpuDesc, NULL, ""); 4332 GenerateHeader(pStrmDataCpu, pszFileInfix, szCpuDesc, pszCpuType, pszCpuSuff); 3591 ? "tstIEMAImplDataFpuOther-Amd.cpp" : "tstIEMAImplDataFpuOther-Intel.cpp"; 3592 PRTSTREAM pStrmDataCpu = GenerateOpenWithHdr(pszDataCpuFile, szCpuDesc, pszCpuType); 3593 if (!pStrmData || !pStrmDataCpu) 3594 return RTEXITCODE_FAILURE; 4333 3595 4334 3596 /* later */ 4335 3597 4336 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, pszFileInfix, pszCpuSuff, 4337 GenerateFooterAndClose(pStrmData, pszDataFile, pszFileInfix, "", 4338 RTEXITCODE_SUCCESS)); 3598 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, 3599 GenerateFooterAndClose(pStrmData, pszDataFile, RTEXITCODE_SUCCESS)); 4339 3600 if (rcExit != RTEXITCODE_SUCCESS) 4340 3601 return rcExit; … … 4405 3666 } 4406 3667 4407 if (fFpuBinary )3668 if (fFpuBinary1) 4408 3669 { 4409 3670 FpuBinaryR80Test(); 3671 FpuBinaryFswR80Test(); 3672 FpuBinaryEflR80Test(); 3673 } 3674 3675 if (fFpuBinary2) 3676 { 4410 3677 FpuBinaryR64Test(); 4411 3678 FpuBinaryR32Test(); 4412 FpuBinaryFswR80Test();4413 3679 FpuBinaryFswR64Test(); 4414 3680 FpuBinaryFswR32Test(); 4415 FpuBinaryEflR80Test();4416 3681 } 4417 3682 }
Note:
See TracChangeset
for help on using the changeset viewer.