Changeset 103060 in vbox
- Timestamp:
- Jan 25, 2024 1:13:11 PM (10 months ago)
- Location:
- trunk/src/VBox/VMM/testcase
- Files:
-
- 89 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/tstIEMAImpl.cpp
r103056 r103060 1065 1065 } 1066 1066 1067 # define GENERATE_BINARY_OPEN(a_pBinOut, a_papszNameFmts, a_Entry) \ 1068 GenerateBinaryOpen((a_pBinOut), a_papszNameFmts[(a_Entry).idxCpuEflFlavour], (a_Entry).pszName) 1069 1067 1070 1068 1071 static void GenerateBinaryWrite(PIEMBINARYOUTPUT pBinOut, const void *pvData, size_t cbData) … … 1100 1103 } 1101 1104 1105 /* Helper for DumpAll. */ 1106 # define DUMP_TEST_ENTRY(a_Entry, a_papszNameFmts) \ 1107 do { \ 1108 AssertReturn(DECOMPRESS_TESTS(a_Entry), RTEXITCODE_FAILURE); \ 1109 IEMBINARYOUTPUT BinOut; \ 1110 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, a_papszNameFmts, (a_Entry)), RTEXITCODE_FAILURE); \ 1111 uint32_t cbTests = (a_Entry).pcTests[0]; \ 1112 if (!(a_Entry).fBinary) \ 1113 cbTests *= sizeof((a_Entry).paTests[0]); \ 1114 GenerateBinaryWrite(&BinOut, (a_Entry).paTests, cbTests); \ 1115 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 1116 } while (0) 1102 1117 1103 1118 #endif /* TSTIEMAIMPL_WITH_GENERATOR */ … … 1200 1215 *ppcTests = pcTests; 1201 1216 *pfCompressed = false; 1217 RTMEM_WILL_LEAK(pcTests); 1218 RTMEM_WILL_LEAK(pbDecompressed); 1202 1219 1203 1220 pbDecompressed = NULL; … … 1587 1604 && g_aBinU ## a_cBits[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) \ 1588 1605 continue; \ 1589 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[g_aBinU ## a_cBits[iFn].idxCpuEflFlavour], \ 1590 g_aBinU ## a_cBits[iFn].pszName), RTEXITCODE_FAILURE); \ 1606 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aBinU ## a_cBits[iFn]), RTEXITCODE_FAILURE); \ 1591 1607 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 1592 1608 { \ … … 1624 1640 { \ 1625 1641 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aBinU ## a_cBits); iFn++) \ 1626 { \ 1627 AssertReturn(DECOMPRESS_TESTS(g_aBinU ## a_cBits[iFn]), RTEXITCODE_FAILURE); \ 1628 IEMBINARYOUTPUT BinOut; \ 1629 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[g_aBinU ## a_cBits[iFn].idxCpuEflFlavour], \ 1630 g_aBinU ## a_cBits[iFn].pszName), RTEXITCODE_FAILURE); \ 1631 size_t cbTests = g_aBinU ## a_cBits[iFn].pcTests[0]; \ 1632 if (!g_aBinU ## a_cBits[iFn].fBinary) \ 1633 cbTests *= sizeof(g_aBinU ## a_cBits[iFn].paTests[0]); \ 1634 GenerateBinaryWrite(&BinOut, g_aBinU ## a_cBits[iFn].paTests, cbTests); \ 1635 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 1636 } \ 1642 DUMP_TEST_ENTRY(g_aBinU ## a_cBits[iFn], papszNameFmts); \ 1637 1643 return RTEXITCODE_SUCCESS; \ 1638 1644 } … … 2248 2254 continue; \ 2249 2255 IEMBINARYOUTPUT BinOut; \ 2250 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[a_aSubTests[iFn].idxCpuEflFlavour], a_aSubTests[iFn].pszName), \ 2251 RTEXITCODE_FAILURE); \ 2256 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 2252 2257 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 2253 2258 { \ … … 2269 2274 { \ 2270 2275 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 2271 { \ 2272 AssertReturn(DECOMPRESS_TESTS(a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 2273 IEMBINARYOUTPUT BinOut; \ 2274 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[a_aSubTests[iFn].idxCpuEflFlavour], a_aSubTests[iFn].pszName), \ 2275 RTEXITCODE_FAILURE); \ 2276 size_t cbTests = a_aSubTests[iFn].pcTests[0]; \ 2277 if (!a_aSubTests[iFn].fBinary) \ 2278 cbTests *= sizeof(a_aSubTests[iFn].paTests[0]); \ 2279 GenerateBinaryWrite(&BinOut, a_aSubTests[iFn].paTests, cbTests); \ 2280 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 2281 } \ 2276 DUMP_TEST_ENTRY(a_aSubTests[iFn], papszNameFmts); \ 2282 2277 return RTEXITCODE_SUCCESS; \ 2283 2278 } … … 2384 2379 { \ 2385 2380 IEMBINARYOUTPUT BinOut; \ 2386 AssertReturn(G enerateBinaryOpen(&BinOut, papszNameFmts[0], g_aUnaryU ## a_cBits[iFn].pszName), RTEXITCODE_FAILURE); \2381 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aUnaryU ## a_cBits[iFn]), RTEXITCODE_FAILURE); \ 2387 2382 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 2388 2383 { \ … … 2404 2399 { \ 2405 2400 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aUnaryU ## a_cBits); iFn++) \ 2406 { \ 2407 AssertReturn(DECOMPRESS_TESTS(g_aUnaryU ## a_cBits[iFn]), RTEXITCODE_FAILURE); \ 2408 IEMBINARYOUTPUT BinOut; \ 2409 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[0], g_aUnaryU ## a_cBits[iFn].pszName), RTEXITCODE_FAILURE); \ 2410 uint32_t cbTests = g_aUnaryU ## a_cBits[iFn].pcTests[0]; \ 2411 if (!g_aUnaryU ## a_cBits[iFn].fBinary) \ 2412 cbTests *= sizeof(g_aUnaryU ## a_cBits[iFn].paTests[0]); \ 2413 GenerateBinaryWrite(&BinOut, g_aUnaryU ## a_cBits[iFn].paTests, cbTests); \ 2414 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 2415 } \ 2401 DUMP_TEST_ENTRY(g_aUnaryU ## a_cBits[iFn], papszNameFmts); \ 2416 2402 return RTEXITCODE_SUCCESS; \ 2417 2403 } … … 2522 2508 continue; \ 2523 2509 IEMBINARYOUTPUT BinOut; \ 2524 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[a_aSubTests[iFn].idxCpuEflFlavour], a_aSubTests[iFn].pszName), \ 2525 RTEXITCODE_FAILURE); \ 2510 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 2526 2511 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 2527 2512 { \ … … 2549 2534 { \ 2550 2535 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 2551 { \ 2552 AssertReturn(DECOMPRESS_TESTS(a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 2553 IEMBINARYOUTPUT BinOut; \ 2554 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[a_aSubTests[iFn].idxCpuEflFlavour], a_aSubTests[iFn].pszName), \ 2555 RTEXITCODE_FAILURE); \ 2556 uint32_t cbTests = a_aSubTests[iFn].pcTests[0]; \ 2557 if (!a_aSubTests[iFn].fBinary) \ 2558 cbTests *= sizeof(a_aSubTests[iFn].paTests[0]); \ 2559 GenerateBinaryWrite(&BinOut, a_aSubTests[iFn].paTests, cbTests); \ 2560 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 2561 } \ 2536 DUMP_TEST_ENTRY(a_aSubTests[iFn], papszNameFmts); \ 2562 2537 return RTEXITCODE_SUCCESS; \ 2563 2538 } … … 2698 2673 continue; 2699 2674 IEMBINARYOUTPUT BinOut; \ 2700 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[g_aMulDivU8[iFn].idxCpuEflFlavour], g_aMulDivU8[iFn].pszName), 2701 RTEXITCODE_FAILURE); 2675 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aMulDivU8[iFn]), RTEXITCODE_FAILURE); \ 2702 2676 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) 2703 2677 { … … 2718 2692 { 2719 2693 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aMulDivU8); iFn++) 2720 { 2721 AssertReturn(DECOMPRESS_TESTS(g_aMulDivU8[iFn]), RTEXITCODE_FAILURE); 2722 IEMBINARYOUTPUT BinOut; 2723 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[g_aMulDivU8[iFn].idxCpuEflFlavour], g_aMulDivU8[iFn].pszName), 2724 RTEXITCODE_FAILURE); 2725 uint32_t cbTests = g_aMulDivU8[iFn].pcTests[0]; 2726 if (!g_aMulDivU8[iFn].fBinary) 2727 cbTests *= sizeof(g_aMulDivU8[iFn].paTests[0]); 2728 GenerateBinaryWrite(&BinOut, g_aMulDivU8[iFn].paTests, cbTests); 2729 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); 2730 } 2694 DUMP_TEST_ENTRY(g_aMulDivU8[iFn], papszNameFmts); 2731 2695 return RTEXITCODE_SUCCESS; 2732 2696 } … … 2787 2751 continue; \ 2788 2752 IEMBINARYOUTPUT BinOut; \ 2789 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[a_aSubTests[iFn].idxCpuEflFlavour], a_aSubTests[iFn].pszName), \ 2790 RTEXITCODE_FAILURE); \ 2753 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 2791 2754 for (uint32_t iTest = 0; iTest < cTests; iTest++ ) \ 2792 2755 { \ … … 2809 2772 { \ 2810 2773 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 2811 { \ 2812 AssertReturn(DECOMPRESS_TESTS(a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 2813 IEMBINARYOUTPUT BinOut; \ 2814 AssertReturn(GenerateBinaryOpen(&BinOut, papszNameFmts[a_aSubTests[iFn].idxCpuEflFlavour], a_aSubTests[iFn].pszName), \ 2815 RTEXITCODE_FAILURE); \ 2816 uint32_t cbTests = a_aSubTests[iFn].pcTests[0]; \ 2817 if (!a_aSubTests[iFn].fBinary) \ 2818 cbTests *= sizeof(a_aSubTests[iFn].paTests[0]); \ 2819 GenerateBinaryWrite(&BinOut, a_aSubTests[iFn].paTests, cbTests); \ 2820 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 2821 } \ 2774 DUMP_TEST_ENTRY(a_aSubTests[iFn], papszNameFmts); \ 2822 2775 return RTEXITCODE_SUCCESS; \ 2823 2776 } 2777 2824 2778 #else 2825 2779 # define GEN_MULDIV(a_cBits, a_Fmt, a_TestType, a_aSubTests) … … 2992 2946 2993 2947 #ifdef TSTIEMAIMPL_WITH_GENERATOR 2994 static void FpuLdConstGenerate(PRTSTREAM pOut, uint32_t cTests)2948 static RTEXITCODE FpuLdConstGenerate(uint32_t cTests, const char * const *papszNameFmts) 2995 2949 { 2996 2950 X86FXSTATE State; … … 2998 2952 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuLdConst); iFn++) 2999 2953 { 3000 GenerateArrayStart(pOut, g_aFpuLdConst[iFn].pszName, "FPU_LD_CONST_TEST_T"); 2954 IEMBINARYOUTPUT BinOut; 2955 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aFpuLdConst[iFn]), RTEXITCODE_FAILURE); 3001 2956 for (uint32_t iTest = 0; iTest < cTests; iTest += 4) 3002 2957 { … … 3009 2964 State.FCW = (State.FCW & ~X86_FCW_RC_MASK) | (iRounding << X86_FCW_RC_SHIFT); 3010 2965 g_aFpuLdConst[iFn].pfn(&State, &Res); 3011 RTStrmPrintf(pOut, " { %#06x, %#06x, %#06x, %s }, /* #%u */\n",3012 State.FCW, State.FSW, Res.FSW, GenFormatR80(&Res.r80Result), iTest + iRounding);2966 FPU_LD_CONST_TEST_T const Test = { State.FCW, State.FSW, Res.FSW, Res.r80Result }; 2967 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); 3013 2968 } 3014 2969 } 3015 GenerateArrayEnd(pOut, g_aFpuLdConst[iFn].pszName); 3016 } 2970 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); 2971 } 2972 return RTEXITCODE_SUCCESS; 2973 } 2974 2975 static RTEXITCODE FpuLdConstDumpAll(const char * const *papszNameFmts) 2976 { 2977 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuLdConst); iFn++) 2978 DUMP_TEST_ENTRY(g_aFpuLdConst[iFn], papszNameFmts); 2979 return RTEXITCODE_SUCCESS; 3017 2980 } 3018 2981 #endif … … 3068 3031 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3069 3032 # define GEN_FPU_LOAD(a_cBits, a_rdTypeIn, a_aSubTests, a_TestType) \ 3070 static void FpuLdR ## a_cBits ## Generate(PRTSTREAM pOut, uint32_t cTests) \3033 static RTEXITCODE FpuLdR ## a_cBits ## Generate(uint32_t cTests, const char * const *papszNameFmts) \ 3071 3034 { \ 3072 3035 X86FXSTATE State; \ … … 3074 3037 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3075 3038 { \ 3076 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 3039 IEMBINARYOUTPUT BinOut; \ 3040 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 3077 3041 for (uint32_t iTest = 0; iTest < cTests; iTest++) \ 3078 3042 { \ … … 3086 3050 State.FCW = (State.FCW & ~X86_FCW_RC_MASK) | (iRounding << X86_FCW_RC_SHIFT); \ 3087 3051 a_aSubTests[iFn].pfn(&State, &Res, &InVal); \ 3088 RTStrmPrintf(pOut, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u */\n", \ 3089 State.FCW, State.FSW, Res.FSW, GenFormatR80(&Res.r80Result), \ 3090 GenFormatR ## a_cBits(&InVal), iTest, iRounding); \ 3052 a_TestType const Test = { State.FCW, State.FSW, Res.FSW, Res.r80Result, InVal }; \ 3053 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); \ 3091 3054 } \ 3092 3055 } \ 3093 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \3056 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 3094 3057 } \ 3058 return RTEXITCODE_SUCCESS; \ 3059 } \ 3060 static RTEXITCODE FpuLdR ## a_cBits ## DumpAll(const char * const *papszNameFmts) \ 3061 { \ 3062 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3063 DUMP_TEST_ENTRY(a_aSubTests[iFn], papszNameFmts); \ 3064 return RTEXITCODE_SUCCESS; \ 3095 3065 } 3096 3066 #else … … 3155 3125 3156 3126 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3157 static void FpuLdMemGenerate(PRTSTREAM pOut, uint32_t cTests) 3158 { 3159 FpuLdR80Generate(pOut, cTests); 3160 FpuLdR64Generate(pOut, cTests); 3161 FpuLdR32Generate(pOut, cTests); 3127 static RTEXITCODE FpuLdMemGenerate(uint32_t cTests, const char * const *papszNameFmts) 3128 { 3129 RTEXITCODE rcExit = FpuLdR80Generate(cTests, papszNameFmts); 3130 if (rcExit == RTEXITCODE_SUCCESS) 3131 rcExit = FpuLdR64Generate(cTests, papszNameFmts); 3132 if (rcExit == RTEXITCODE_SUCCESS) 3133 rcExit = FpuLdR32Generate(cTests, papszNameFmts); 3134 return rcExit; 3135 } 3136 3137 static RTEXITCODE FpuLdMemDumpAll(const char * const *papszNameFmts) 3138 { 3139 RTEXITCODE rcExit = FpuLdR80DumpAll(papszNameFmts); 3140 if (rcExit == RTEXITCODE_SUCCESS) 3141 rcExit = FpuLdR64DumpAll(papszNameFmts); 3142 if (rcExit == RTEXITCODE_SUCCESS) 3143 rcExit = FpuLdR32DumpAll(papszNameFmts); 3144 return rcExit; 3162 3145 } 3163 3146 #endif … … 3176 3159 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3177 3160 # define GEN_FPU_LOAD_INT(a_cBits, a_iTypeIn, a_szFmtIn, a_aSubTests, a_TestType) \ 3178 static void FpuLdI ## a_cBits ## Generate(PRTSTREAM pOut, uint32_t cTests) \3161 static RTEXITCODE FpuLdI ## a_cBits ## Generate(uint32_t cTests, const char * const *papszNameFmts) \ 3179 3162 { \ 3180 3163 X86FXSTATE State; \ … … 3182 3165 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3183 3166 { \ 3184 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 3167 IEMBINARYOUTPUT BinOut; \ 3168 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 3185 3169 for (uint32_t iTest = 0; iTest < cTests; iTest++) \ 3186 3170 { \ … … 3194 3178 State.FCW = (State.FCW & ~X86_FCW_RC_MASK) | (iRounding << X86_FCW_RC_SHIFT); \ 3195 3179 a_aSubTests[iFn].pfn(&State, &Res, &InVal); \ 3196 RTStrmPrintf(pOut, " { %#06x, %#06x, %#06x, %s, " a_szFmtIn " }, /* #%u/%u */\n",\3197 State.FCW, State.FSW, Res.FSW, GenFormatR80(&Res.r80Result), InVal, iTest, iRounding); \3180 a_TestType const Test = { State.FCW, State.FSW, Res.FSW, Res.r80Result }; \ 3181 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); \ 3198 3182 } \ 3199 3183 } \ 3200 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \3184 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 3201 3185 } \ 3186 return RTEXITCODE_SUCCESS; \ 3187 } \ 3188 static RTEXITCODE FpuLdI ## a_cBits ## DumpAll(const char * const *papszNameFmts) \ 3189 { \ 3190 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3191 DUMP_TEST_ENTRY(a_aSubTests[iFn], papszNameFmts); \ 3192 return RTEXITCODE_SUCCESS; \ 3202 3193 } 3203 3194 #else … … 3261 3252 3262 3253 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3263 static void FpuLdIntGenerate(PRTSTREAM pOut, uint32_t cTests) 3264 { 3265 FpuLdI64Generate(pOut, cTests); 3266 FpuLdI32Generate(pOut, cTests); 3267 FpuLdI16Generate(pOut, cTests); 3254 static RTEXITCODE FpuLdIntGenerate(uint32_t cTests, const char * const *papszNameFmts) 3255 { 3256 RTEXITCODE rcExit = FpuLdI64Generate(cTests, papszNameFmts); 3257 if (rcExit == RTEXITCODE_SUCCESS) 3258 rcExit = FpuLdI32Generate(cTests, papszNameFmts); 3259 if (rcExit == RTEXITCODE_SUCCESS) 3260 rcExit = FpuLdI16Generate(cTests, papszNameFmts); 3261 return rcExit; 3262 } 3263 3264 static RTEXITCODE FpuLdIntDumpAll(const char * const *papszNameFmts) 3265 { 3266 RTEXITCODE rcExit = FpuLdI64DumpAll(papszNameFmts); 3267 if (rcExit == RTEXITCODE_SUCCESS) 3268 rcExit = FpuLdI32DumpAll(papszNameFmts); 3269 if (rcExit == RTEXITCODE_SUCCESS) 3270 rcExit = FpuLdI16DumpAll(papszNameFmts); 3271 return rcExit; 3268 3272 } 3269 3273 #endif … … 3290 3294 3291 3295 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3292 static void FpuLdD80Generate(PRTSTREAM pOut, uint32_t cTests)3296 static RTEXITCODE FpuLdD80Generate(uint32_t cTests, const char * const *papszNameFmts) 3293 3297 { 3294 3298 X86FXSTATE State; … … 3296 3300 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuLdD80); iFn++) 3297 3301 { 3298 GenerateArrayStart(pOut, g_aFpuLdD80[iFn].pszName, "FPU_D80_IN_TEST_T"); 3302 IEMBINARYOUTPUT BinOut; 3303 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aFpuLdD80[iFn]), RTEXITCODE_FAILURE); 3299 3304 for (uint32_t iTest = 0; iTest < cTests; iTest++) 3300 3305 { … … 3308 3313 State.FCW = (State.FCW & ~X86_FCW_RC_MASK) | (iRounding << X86_FCW_RC_SHIFT); 3309 3314 g_aFpuLdD80[iFn].pfn(&State, &Res, &InVal); 3310 RTStrmPrintf(pOut, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u */\n", 3311 State.FCW, State.FSW, Res.FSW, GenFormatR80(&Res.r80Result), GenFormatD80(&InVal), 3312 iTest, iRounding); 3315 FPU_D80_IN_TEST_T const Test = { State.FCW, State.FSW, Res.FSW, Res.r80Result, InVal }; 3316 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); 3313 3317 } 3314 3318 } 3315 GenerateArrayEnd(pOut, g_aFpuLdD80[iFn].pszName); 3316 } 3319 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); 3320 } 3321 return RTEXITCODE_SUCCESS; 3322 } 3323 static RTEXITCODE FpuLdD80DumpAll(const char * const *papszNameFmts) 3324 { 3325 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuLdD80); iFn++) 3326 DUMP_TEST_ENTRY(g_aFpuLdD80[iFn], papszNameFmts); 3327 return RTEXITCODE_SUCCESS; 3317 3328 } 3318 3329 #endif … … 3384 3395 }; 3385 3396 # define GEN_FPU_STORE(a_cBits, a_rdType, a_aSubTests, a_TestType) \ 3386 static void FpuStR ## a_cBits ## Generate(PRTSTREAM pOut, uint32_t cTests) \3397 static RTEXITCODE FpuStR ## a_cBits ## Generate(uint32_t cTests, const char * const *papszNameFmts) \ 3387 3398 { \ 3388 3399 uint32_t const cTotalTests = cTests + RT_ELEMENTS(g_aFpuStR ## a_cBits ## Specials); \ … … 3391 3402 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3392 3403 { \ 3393 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 3404 IEMBINARYOUTPUT BinOut; \ 3405 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 3394 3406 for (uint32_t iTest = 0; iTest < cTotalTests; iTest++) \ 3395 3407 { \ … … 3414 3426 State.FCW |= (iMask >> 1) << X86_FCW_OM_BIT; \ 3415 3427 a_aSubTests[iFn].pfn(&State, &uFswOut, &OutVal, &InVal); \ 3416 RTStrmPrintf(pOut, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u/%u */\n", \ 3417 State.FCW, State.FSW, uFswOut, GenFormatR80(&InVal), \ 3418 GenFormatR ## a_cBits(&OutVal), iTest, iRounding, iMask); \ 3428 a_TestType const Test = { State.FCW, State.FSW, uFswOut, InVal, OutVal }; \ 3429 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); \ 3419 3430 } \ 3420 3431 } \ 3421 3432 } \ 3422 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \3433 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 3423 3434 } \ 3435 return RTEXITCODE_SUCCESS; \ 3436 } \ 3437 static RTEXITCODE FpuStR ## a_cBits ## DumpAll(const char * const *papszNameFmts) \ 3438 { \ 3439 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3440 DUMP_TEST_ENTRY(a_aSubTests[iFn], papszNameFmts); \ 3441 return RTEXITCODE_SUCCESS; \ 3424 3442 } 3425 3443 #else … … 3488 3506 3489 3507 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3490 static void FpuStMemGenerate(PRTSTREAM pOut, uint32_t cTests) 3491 { 3492 FpuStR80Generate(pOut, cTests); 3493 FpuStR64Generate(pOut, cTests); 3494 FpuStR32Generate(pOut, cTests); 3508 static RTEXITCODE FpuStMemGenerate(uint32_t cTests, const char * const *papszNameFmts) 3509 { 3510 RTEXITCODE rcExit = FpuStR80Generate(cTests, papszNameFmts); 3511 if (rcExit == RTEXITCODE_SUCCESS) 3512 rcExit = FpuStR64Generate(cTests, papszNameFmts); 3513 if (rcExit == RTEXITCODE_SUCCESS) 3514 rcExit = FpuStR32Generate(cTests, papszNameFmts); 3515 return rcExit; 3516 } 3517 3518 static RTEXITCODE FpuStMemDumpAll(const char * const *papszNameFmts) 3519 { 3520 RTEXITCODE rcExit = FpuStR80DumpAll(papszNameFmts); 3521 if (rcExit == RTEXITCODE_SUCCESS) 3522 rcExit = FpuStR64DumpAll(papszNameFmts); 3523 if (rcExit == RTEXITCODE_SUCCESS) 3524 rcExit = FpuStR32DumpAll(papszNameFmts); 3525 return rcExit; 3495 3526 } 3496 3527 #endif … … 3620 3651 3621 3652 # define GEN_FPU_STORE_INT(a_cBits, a_iType, a_szFmt, a_aSubTests, a_TestType) \ 3622 static void FpuStI ## a_cBits ## Generate(PRTSTREAM pOut, PRTSTREAM pOutCpu, uint32_t cTests) \3653 static RTEXITCODE FpuStI ## a_cBits ## Generate(uint32_t cTests, const char * const *papszNameFmts) \ 3623 3654 { \ 3624 3655 X86FXSTATE State; \ … … 3628 3659 PFNIEMAIMPLFPUSTR80TOI ## a_cBits const pfn = a_aSubTests[iFn].pfnNative \ 3629 3660 ? a_aSubTests[iFn].pfnNative : a_aSubTests[iFn].pfn; \ 3630 PRTSTREAM pOutFn = pOut; \ 3631 if (a_aSubTests[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE) \ 3632 { \ 3633 if (a_aSubTests[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) \ 3661 if ( a_aSubTests[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE \ 3662 && a_aSubTests[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) \ 3634 3663 continue; \ 3635 pOutFn = pOutCpu; \3636 } \3637 3664 \ 3638 GenerateArrayStart(pOutFn, a_aSubTests[iFn].pszName, #a_TestType); \ 3665 IEMBINARYOUTPUT BinOut; \ 3666 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 3639 3667 uint32_t const cTotalTests = cTests + RT_ELEMENTS(g_aFpuStI ## a_cBits ## Specials); \ 3640 3668 for (uint32_t iTest = 0; iTest < cTotalTests; iTest++) \ … … 3658 3686 State.FCW |= (iMask >> 1) << X86_FCW_OM_BIT; \ 3659 3687 pfn(&State, &uFswOut, &iOutVal, &InVal); \ 3660 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u/%u */\n", \ 3661 State.FCW, State.FSW, uFswOut, GenFormatR80(&InVal), \ 3662 GenFormatI ## a_cBits(iOutVal), iTest, iRounding, iMask); \ 3688 a_TestType const Test = { State.FCW, State.FSW, uFswOut, InVal, iOutVal }; \ 3689 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); \ 3663 3690 } \ 3664 3691 } \ 3665 3692 } \ 3666 GenerateArrayEnd(pOutFn, a_aSubTests[iFn].pszName); \3693 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 3667 3694 } \ 3695 return RTEXITCODE_SUCCESS; \ 3696 } \ 3697 static RTEXITCODE FpuStI ## a_cBits ## DumpAll(const char * const *papszNameFmts) \ 3698 { \ 3699 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 3700 DUMP_TEST_ENTRY(a_aSubTests[iFn], papszNameFmts); \ 3701 return RTEXITCODE_SUCCESS; \ 3668 3702 } 3669 3703 #else … … 3722 3756 3723 3757 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3724 static void FpuStIntGenerate(PRTSTREAM pOut, PRTSTREAM pOutCpu, uint32_t cTests) 3725 { 3726 FpuStI64Generate(pOut, pOutCpu, cTests); 3727 FpuStI32Generate(pOut, pOutCpu, cTests); 3728 FpuStI16Generate(pOut, pOutCpu, cTests); 3758 static RTEXITCODE FpuStIntGenerate(uint32_t cTests, const char * const *papszNameFmts) 3759 { 3760 RTEXITCODE rcExit = FpuStI64Generate(cTests, papszNameFmts); 3761 if (rcExit == RTEXITCODE_SUCCESS) 3762 rcExit = FpuStI32Generate(cTests, papszNameFmts); 3763 if (rcExit == RTEXITCODE_SUCCESS) 3764 rcExit = FpuStI16Generate(cTests, papszNameFmts); 3765 return rcExit; 3766 } 3767 static RTEXITCODE FpuStIntDumpAll(const char * const *papszNameFmts) 3768 { 3769 RTEXITCODE rcExit = FpuStI64DumpAll(papszNameFmts); 3770 if (rcExit == RTEXITCODE_SUCCESS) 3771 rcExit = FpuStI32DumpAll(papszNameFmts); 3772 if (rcExit == RTEXITCODE_SUCCESS) 3773 rcExit = FpuStI16DumpAll(papszNameFmts); 3774 return rcExit; 3729 3775 } 3730 3776 #endif … … 3751 3797 3752 3798 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3753 static void FpuStD80Generate(PRTSTREAM pOut, uint32_t cTests)3799 static RTEXITCODE FpuStD80Generate(uint32_t cTests, const char * const *papszNameFmts) 3754 3800 { 3755 3801 static RTFLOAT80U const s_aSpecials[] = … … 3773 3819 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuStD80); iFn++) 3774 3820 { 3775 GenerateArrayStart(pOut, g_aFpuStD80[iFn].pszName, "FPU_ST_D80_TEST_T"); 3821 IEMBINARYOUTPUT BinOut; 3822 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aFpuStD80[iFn]), RTEXITCODE_FAILURE); 3776 3823 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1) 3777 3824 { … … 3793 3840 State.FCW |= (iMask >> 1) << X86_FCW_OM_BIT; 3794 3841 g_aFpuStD80[iFn].pfn(&State, &uFswOut, &OutVal, &InVal); 3795 RTStrmPrintf(pOut, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u/%u */\n", 3796 State.FCW, State.FSW, uFswOut, GenFormatR80(&InVal), 3797 GenFormatD80(&OutVal), iTest, iRounding, iMask); 3842 FPU_ST_D80_TEST_T const Test = { State.FCW, State.FSW, uFswOut, InVal, OutVal }; 3843 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); 3798 3844 } 3799 3845 } 3800 3846 } 3801 GenerateArrayEnd(pOut, g_aFpuStD80[iFn].pszName); 3802 } 3847 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); 3848 } 3849 return RTEXITCODE_SUCCESS; 3850 } 3851 3852 static RTEXITCODE FpuStD80DumpAll(const char * const *papszNameFmts) 3853 { 3854 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuStD80); iFn++) 3855 DUMP_TEST_ENTRY(g_aFpuStD80[iFn], papszNameFmts); 3856 return RTEXITCODE_SUCCESS; 3803 3857 } 3804 3858 #endif … … 3879 3933 3880 3934 #ifdef TSTIEMAIMPL_WITH_GENERATOR 3881 static void FpuBinaryR80Generate(PRTSTREAM pOut, PRTSTREAM pOutCpu, uint32_t cTests)3935 static RTEXITCODE FpuBinaryR80Generate(uint32_t cTests, const char * const *papszNameFmts) 3882 3936 { 3883 3937 cTests = RT_MAX(192, cTests); /* there are 144 standard input variations */ … … 3961 4015 { 3962 4016 PFNIEMAIMPLFPUR80 const pfn = g_aFpuBinaryR80[iFn].pfnNative ? g_aFpuBinaryR80[iFn].pfnNative : g_aFpuBinaryR80[iFn].pfn; 3963 PRTSTREAM pOutFn = pOut; 3964 if (g_aFpuBinaryR80[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE) 3965 { 3966 if (g_aFpuBinaryR80[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) 3967 continue; 3968 pOutFn = pOutCpu; 3969 } 3970 3971 GenerateArrayStart(pOutFn, g_aFpuBinaryR80[iFn].pszName, "FPU_BINARY_R80_TEST_T"); 3972 uint32_t iTestOutput = 0; 4017 if ( g_aFpuBinaryR80[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE 4018 && g_aFpuBinaryR80[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) 4019 continue; 4020 4021 IEMBINARYOUTPUT BinOut; 4022 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aFpuBinaryR80[iFn]), RTEXITCODE_FAILURE); 3973 4023 uint32_t cNormalInputPairs = 0; 3974 4024 uint32_t cTargetRangeInputs = 0; … … 4011 4061 IEMFPURESULT ResM = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4012 4062 pfn(&State, &ResM, &InVal1, &InVal2); 4013 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/m = #%u */\n",4014 State.FCW | fFcwExtra, State.FSW, ResM.FSW, GenFormatR80(&InVal1), GenFormatR80(&InVal2),4015 GenFormatR80(&ResM.r80Result), iTest, iRounding, iPrecision, iTestOutput++);4063 FPU_BINARY_R80_TEST_T const TestM 4064 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, ResM.FSW, InVal1, InVal2, ResM.r80Result }; 4065 GenerateBinaryWrite(&BinOut, &TestM, sizeof(TestM)); 4016 4066 4017 4067 State.FCW = State.FCW & ~X86_FCW_MASK_ALL; 4018 4068 IEMFPURESULT ResU = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4019 4069 pfn(&State, &ResU, &InVal1, &InVal2); 4020 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/u = #%u */\n",4021 State.FCW | fFcwExtra, State.FSW, ResU.FSW, GenFormatR80(&InVal1), GenFormatR80(&InVal2),4022 GenFormatR80(&ResU.r80Result), iTest, iRounding, iPrecision, iTestOutput++);4070 FPU_BINARY_R80_TEST_T const TestU 4071 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, ResU.FSW, InVal1, InVal2, ResU.r80Result }; 4072 GenerateBinaryWrite(&BinOut, &TestU, sizeof(TestU)); 4023 4073 4024 4074 uint16_t fXcpt = (ResM.FSW | ResU.FSW) & X86_FSW_XCPT_MASK & ~X86_FSW_SF; … … 4028 4078 IEMFPURESULT Res1 = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4029 4079 pfn(&State, &Res1, &InVal1, &InVal2); 4030 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/%#x = #%u */\n", 4031 State.FCW | fFcwExtra, State.FSW, Res1.FSW, GenFormatR80(&InVal1), GenFormatR80(&InVal2), 4032 GenFormatR80(&Res1.r80Result), iTest, iRounding, iPrecision, fXcpt, iTestOutput++); 4080 FPU_BINARY_R80_TEST_T const Test1 4081 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, Res1.FSW, InVal1, InVal2, Res1.r80Result }; 4082 GenerateBinaryWrite(&BinOut, &Test1, sizeof(Test1)); 4083 4033 4084 if (((Res1.FSW & X86_FSW_XCPT_MASK) & fXcpt) != (Res1.FSW & X86_FSW_XCPT_MASK)) 4034 4085 { … … 4037 4088 IEMFPURESULT Res2 = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4038 4089 pfn(&State, &Res2, &InVal1, &InVal2); 4039 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/%#x[!] = #%u */\n",4040 State.FCW | fFcwExtra, State.FSW, Res2.FSW, GenFormatR80(&InVal1), GenFormatR80(&InVal2),4041 GenFormatR80(&Res2.r80Result), iTest, iRounding, iPrecision, fXcpt, iTestOutput++);4090 FPU_BINARY_R80_TEST_T const Test2 4091 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, Res2.FSW, InVal1, InVal2, Res2.r80Result }; 4092 GenerateBinaryWrite(&BinOut, &Test2, sizeof(Test2)); 4042 4093 } 4043 4094 if (!RT_IS_POWER_OF_TWO(fXcpt)) … … 4048 4099 IEMFPURESULT Res3 = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4049 4100 pfn(&State, &Res3, &InVal1, &InVal2); 4050 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/u%#x = #%u */\n",4051 State.FCW | fFcwExtra, State.FSW, Res3.FSW, GenFormatR80(&InVal1), GenFormatR80(&InVal2),4052 GenFormatR80(&Res3.r80Result), iTest, iRounding, iPrecision, fUnmasked, iTestOutput++);4101 FPU_BINARY_R80_TEST_T const Test3 4102 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, Res3.FSW, InVal1, InVal2, Res3.r80Result }; 4103 GenerateBinaryWrite(&BinOut, &Test3, sizeof(Test3)); 4053 4104 } 4054 4105 } … … 4065 4116 IEMFPURESULT ResSeq = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4066 4117 pfn(&State, &ResSeq, &ResPrev.r80Result, &InVal2); 4067 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/seq%u = #%u */\n", 4068 State.FCW | fFcwExtra, State.FSW, ResSeq.FSW, GenFormatR80(&ResPrev.r80Result), 4069 GenFormatR80(&InVal2), GenFormatR80(&ResSeq.r80Result), 4070 iTest, iRounding, iPrecision, i + 1, iTestOutput++); 4118 FPU_BINARY_R80_TEST_T const TestSeq 4119 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, ResSeq.FSW, ResPrev.r80Result, InVal2, ResSeq.r80Result }; 4120 GenerateBinaryWrite(&BinOut, &TestSeq, sizeof(TestSeq)); 4071 4121 ResPrev = ResSeq; 4072 4122 } … … 4074 4124 } 4075 4125 } 4076 GenerateArrayEnd(pOutFn, g_aFpuBinaryR80[iFn].pszName); 4077 } 4126 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); 4127 } 4128 return RTEXITCODE_SUCCESS; 4129 } 4130 4131 static RTEXITCODE FpuBinaryR80DumpAll(const char * const *papszNameFmts) 4132 { 4133 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuBinaryR80); iFn++) 4134 DUMP_TEST_ENTRY(g_aFpuBinaryR80[iFn], papszNameFmts); 4135 return RTEXITCODE_SUCCESS; 4078 4136 } 4079 4137 #endif … … 4151 4209 4152 4210 # define GEN_FPU_BINARY_SMALL(a_fIntType, a_cBits, a_LoBits, a_UpBits, a_Type2, a_aSubTests, a_TestType) \ 4153 static void FpuBinary ## a_UpBits ## Generate(PRTSTREAM pOut, uint32_t cTests) \4211 static RTEXITCODE FpuBinary ## a_UpBits ## Generate(uint32_t cTests, const char * const *papszNameFmts) \ 4154 4212 { \ 4155 4213 cTests = RT_MAX(160, cTests); /* there are 144 standard input variations for r80 by r80 */ \ … … 4160 4218 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 4161 4219 { \ 4162 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 4220 IEMBINARYOUTPUT BinOut; \ 4221 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 4163 4222 uint32_t cNormalInputPairs = 0; \ 4164 4223 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aFpuBinary ## a_UpBits ## Specials); iTest += 1) \ … … 4191 4250 IEMFPURESULT Res = { RTFLOAT80U_INIT(0, 0, 0), 0 }; \ 4192 4251 a_aSubTests[iFn].pfn(&State, &Res, &InVal1, &InVal2); \ 4193 RTStrmPrintf(pOut, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/%c */\n", \ 4194 State.FCW, State.FSW, Res.FSW, GenFormatR80(&InVal1), GenFormat ## a_UpBits(&InVal2), \ 4195 GenFormatR80(&Res.r80Result), iTest, iRounding, iPrecision, iMask ? 'c' : 'u'); \ 4252 a_TestType const Test = { State.FCW, State.FSW, Res.FSW, InVal1, InVal2, Res.r80Result }; \ 4253 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); \ 4196 4254 } \ 4197 4255 } \ 4198 4256 } \ 4199 4257 } \ 4200 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \4258 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 4201 4259 } \ 4260 return RTEXITCODE_SUCCESS; \ 4261 } \ 4262 static RTEXITCODE FpuBinary ## a_UpBits ## DumpAll(const char * const *papszNameFmts) \ 4263 { \ 4264 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 4265 DUMP_TEST_ENTRY(a_aSubTests[iFn], papszNameFmts); \ 4266 return RTEXITCODE_SUCCESS; \ 4202 4267 } 4203 4268 #else … … 4297 4362 4298 4363 # define GEN_FPU_BINARY_FSW(a_fIntType, a_cBits, a_UpBits, a_Type2, a_aSubTests, a_TestType) \ 4299 static void FpuBinaryFsw ## a_UpBits ## Generate(PRTSTREAM pOut, uint32_t cTests) \4364 static RTEXITCODE FpuBinaryFsw ## a_UpBits ## Generate(uint32_t cTests, const char * const *papszNameFmts) \ 4300 4365 { \ 4301 4366 cTests = RT_MAX(160, cTests); /* there are 144 standard input variations for r80 by r80 */ \ … … 4306 4371 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 4307 4372 { \ 4308 GenerateArrayStart(pOut, a_aSubTests[iFn].pszName, #a_TestType); \ 4373 IEMBINARYOUTPUT BinOut; \ 4374 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, a_aSubTests[iFn]), RTEXITCODE_FAILURE); \ 4309 4375 uint32_t cNormalInputPairs = 0; \ 4310 4376 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aFpuBinaryFsw ## a_UpBits ## Specials); iTest += 1) \ … … 4331 4397 uint16_t fFswOut = 0; \ 4332 4398 a_aSubTests[iFn].pfn(&State, &fFswOut, &InVal1, &InVal2); \ 4333 RTStrmPrintf(pOut, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%c */\n", \ 4334 State.FCW, State.FSW, fFswOut, GenFormatR80(&InVal1), GenFormat ## a_UpBits(&InVal2), \ 4335 iTest, iMask ? 'c' : 'u'); \ 4399 a_TestType const Test = { State.FCW, State.FSW, fFswOut, InVal1, InVal2 }; \ 4400 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); \ 4336 4401 } \ 4337 4402 } \ 4338 GenerateArrayEnd(pOut, a_aSubTests[iFn].pszName); \4403 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); \ 4339 4404 } \ 4405 return RTEXITCODE_SUCCESS; \ 4406 } \ 4407 static RTEXITCODE FpuBinaryFsw ## a_UpBits ## DumpAll(const char * const *papszNameFmts) \ 4408 { \ 4409 for (size_t iFn = 0; iFn < RT_ELEMENTS(a_aSubTests); iFn++) \ 4410 DUMP_TEST_ENTRY(a_aSubTests[iFn], papszNameFmts); \ 4411 return RTEXITCODE_SUCCESS; \ 4340 4412 } 4341 4413 #else … … 4417 4489 }; 4418 4490 4419 static void FpuBinaryEflR80Generate(PRTSTREAM pOut, uint32_t cTests)4491 static RTEXITCODE FpuBinaryEflR80Generate(uint32_t cTests, const char * const *papszNameFmts) 4420 4492 { 4421 4493 cTests = RT_MAX(160, cTests); /* there are 144 standard input variations */ … … 4426 4498 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuBinaryEflR80); iFn++) 4427 4499 { 4428 GenerateArrayStart(pOut, g_aFpuBinaryEflR80[iFn].pszName, "FPU_BINARY_EFL_R80_TEST_T"); 4500 IEMBINARYOUTPUT BinOut; 4501 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aFpuBinaryEflR80[iFn]), RTEXITCODE_FAILURE); 4429 4502 uint32_t cNormalInputPairs = 0; 4430 4503 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aFpuBinaryEflR80Specials); iTest += 1) … … 4449 4522 uint16_t uFswOut = 0; 4450 4523 uint32_t fEflOut = g_aFpuBinaryEflR80[iFn].pfn(&State, &uFswOut, &InVal1, &InVal2); 4451 RTStrmPrintf(pOut, " { %#06x, %#06x, %#06x, %s, %s, %#08x }, /* #%u/%c */\n", 4452 State.FCW, State.FSW, uFswOut, GenFormatR80(&InVal1), GenFormatR80(&InVal2), fEflOut, 4453 iTest, iMask ? 'c' : 'u'); 4524 FPU_BINARY_EFL_R80_TEST_T const Test = { State.FCW, State.FSW, uFswOut, InVal1, InVal2, fEflOut, }; 4525 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); 4454 4526 } 4455 4527 } 4456 GenerateArrayEnd(pOut, g_aFpuBinaryEflR80[iFn].pszName); 4457 } 4528 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); 4529 } 4530 return RTEXITCODE_SUCCESS; 4531 } 4532 4533 static RTEXITCODE FpuBinaryEflR80DumpAll(const char * const *papszNameFmts) 4534 { 4535 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuBinaryEflR80); iFn++) 4536 DUMP_TEST_ENTRY(g_aFpuBinaryEflR80[iFn], papszNameFmts); 4537 return RTEXITCODE_SUCCESS; 4458 4538 } 4459 4539 #endif /*TSTIEMAIMPL_WITH_GENERATOR*/ … … 4540 4620 } 4541 4621 4542 static void FpuUnaryR80Generate(PRTSTREAM pOut, PRTSTREAM pOutCpu, uint32_t cTests)4622 static RTEXITCODE FpuUnaryR80Generate(uint32_t cTests, const char * const *papszNameFmts) 4543 4623 { 4544 4624 static RTFLOAT80U const s_aSpecials[] = … … 4561 4641 { 4562 4642 PFNIEMAIMPLFPUR80UNARY const pfn = g_aFpuUnaryR80[iFn].pfnNative ? g_aFpuUnaryR80[iFn].pfnNative : g_aFpuUnaryR80[iFn].pfn; 4563 PRTSTREAM pOutFn = pOut; 4564 if (g_aFpuUnaryR80[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE) 4565 { 4566 if (g_aFpuUnaryR80[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) 4567 continue; 4568 pOutFn = pOutCpu; 4569 } 4570 4571 GenerateArrayStart(pOutFn, g_aFpuUnaryR80[iFn].pszName, "FPU_UNARY_R80_TEST_T"); 4572 uint32_t iTestOutput = 0; 4643 if ( g_aFpuUnaryR80[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE 4644 && g_aFpuUnaryR80[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) 4645 continue; 4646 4647 IEMBINARYOUTPUT BinOut; 4648 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aFpuUnaryR80[iFn]), RTEXITCODE_FAILURE); 4573 4649 uint32_t cNormalInputs = 0; 4574 4650 uint32_t cTargetRangeInputs = 0; … … 4612 4688 IEMFPURESULT ResM = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4613 4689 pfn(&State, &ResM, &InVal); 4614 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u/%u/m = #%u */\n",4615 State.FCW | fFcwExtra, State.FSW, ResM.FSW, GenFormatR80(&InVal),4616 GenFormatR80(&ResM.r80Result), iTest, iRounding, iPrecision, iTestOutput++);4690 FPU_UNARY_R80_TEST_T const TestM 4691 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, ResM.FSW, InVal, ResM.r80Result }; 4692 GenerateBinaryWrite(&BinOut, &TestM, sizeof(TestM)); 4617 4693 4618 4694 State.FCW = State.FCW & ~X86_FCW_MASK_ALL; 4619 4695 IEMFPURESULT ResU = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4620 4696 pfn(&State, &ResU, &InVal); 4621 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u/%u/u = #%u */\n",4622 State.FCW | fFcwExtra, State.FSW, ResU.FSW, GenFormatR80(&InVal),4623 GenFormatR80(&ResU.r80Result), iTest, iRounding, iPrecision, iTestOutput++);4697 FPU_UNARY_R80_TEST_T const TestU 4698 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, ResU.FSW, InVal, ResU.r80Result }; 4699 GenerateBinaryWrite(&BinOut, &TestU, sizeof(TestU)); 4624 4700 4625 4701 uint16_t fXcpt = (ResM.FSW | ResU.FSW) & X86_FSW_XCPT_MASK & ~X86_FSW_SF; … … 4629 4705 IEMFPURESULT Res1 = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4630 4706 pfn(&State, &Res1, &InVal); 4631 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u/%u/%#x = #%u */\n",4632 State.FCW | fFcwExtra, State.FSW, Res1.FSW, GenFormatR80(&InVal),4633 GenFormatR80(&Res1.r80Result), iTest, iRounding, iPrecision, fXcpt, iTestOutput++);4707 FPU_UNARY_R80_TEST_T const Test1 4708 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, Res1.FSW, InVal, Res1.r80Result }; 4709 GenerateBinaryWrite(&BinOut, &Test1, sizeof(Test1)); 4634 4710 if (((Res1.FSW & X86_FSW_XCPT_MASK) & fXcpt) != (Res1.FSW & X86_FSW_XCPT_MASK)) 4635 4711 { … … 4638 4714 IEMFPURESULT Res2 = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4639 4715 pfn(&State, &Res2, &InVal); 4640 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u/%u/%#x[!] = #%u */\n",4641 State.FCW | fFcwExtra, State.FSW, Res2.FSW, GenFormatR80(&InVal),4642 GenFormatR80(&Res2.r80Result), iTest, iRounding, iPrecision, fXcpt, iTestOutput++);4716 FPU_UNARY_R80_TEST_T const Test2 4717 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, Res2.FSW, InVal, Res2.r80Result }; 4718 GenerateBinaryWrite(&BinOut, &Test2, sizeof(Test2)); 4643 4719 } 4644 4720 if (!RT_IS_POWER_OF_TWO(fXcpt)) … … 4649 4725 IEMFPURESULT Res3 = { RTFLOAT80U_INIT(0, 0, 0), 0 }; 4650 4726 pfn(&State, &Res3, &InVal); 4651 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s }, /* #%u/%u/%u/u%#x = #%u */\n",4652 State.FCW | fFcwExtra, State.FSW, Res3.FSW, GenFormatR80(&InVal),4653 GenFormatR80(&Res3.r80Result), iTest, iRounding, iPrecision, fUnmasked, iTestOutput++);4727 FPU_UNARY_R80_TEST_T const Test3 4728 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, Res3.FSW, InVal, Res3.r80Result }; 4729 GenerateBinaryWrite(&BinOut, &Test3, sizeof(Test3)); 4654 4730 } 4655 4731 } 4656 4732 } 4657 4733 } 4658 GenerateArrayEnd(pOutFn, g_aFpuUnaryR80[iFn].pszName); 4659 } 4734 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); 4735 } 4736 return RTEXITCODE_SUCCESS; 4737 } 4738 4739 static RTEXITCODE FpuUnaryR80DumpAll(const char * const *papszNameFmts) 4740 { 4741 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuUnaryR80); iFn++) 4742 DUMP_TEST_ENTRY(g_aFpuUnaryR80[iFn], papszNameFmts); 4743 return RTEXITCODE_SUCCESS; 4660 4744 } 4661 4745 #endif … … 4763 4847 4764 4848 #ifdef TSTIEMAIMPL_WITH_GENERATOR 4765 static void FpuUnaryFswR80Generate(PRTSTREAM pOut, PRTSTREAM pOutCpu, uint32_t cTests)4849 static RTEXITCODE FpuUnaryFswR80Generate(uint32_t cTests, const char * const *papszNameFmts) 4766 4850 { 4767 4851 static RTFLOAT80U const s_aSpecials[] = … … 4777 4861 bool const fIsFxam = g_aFpuUnaryFswR80[iFn].uExtra == 1; 4778 4862 PFNIEMAIMPLFPUR80UNARYFSW const pfn = g_aFpuUnaryFswR80[iFn].pfnNative ? g_aFpuUnaryFswR80[iFn].pfnNative : g_aFpuUnaryFswR80[iFn].pfn; 4779 PRTSTREAM pOutFn = pOut; 4780 if (g_aFpuUnaryFswR80[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE) 4781 { 4782 if (g_aFpuUnaryFswR80[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) 4783 continue; 4784 pOutFn = pOutCpu; 4785 } 4863 if ( g_aFpuUnaryFswR80[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE 4864 && g_aFpuUnaryFswR80[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) 4865 continue; 4786 4866 State.FTW = 0; 4787 4867 4788 GenerateArrayStart(pOutFn, g_aFpuUnaryFswR80[iFn].pszName, "FPU_UNARY_R80_TEST_T"); 4868 IEMBINARYOUTPUT BinOut; 4869 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aFpuUnaryFswR80[iFn]), RTEXITCODE_FAILURE); 4789 4870 uint32_t cNormalInputs = 0; 4790 4871 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1) … … 4815 4896 uint16_t fFswOut = 0; 4816 4897 pfn(&State, &fFswOut, &InVal); 4817 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s }, /* #%u/%u/%u/%c */\n", 4818 State.FCW, State.FSW, fFswOut, GenFormatR80(&InVal), 4819 iTest, iRounding, iPrecision, iMask ? 'c' : 'u'); 4898 FPU_UNARY_R80_TEST_T const Test = { State.FCW, State.FSW, fFswOut, InVal }; 4899 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); 4820 4900 } 4821 4901 } … … 4829 4909 State.FCW = fFcw; 4830 4910 pfn(&State, &fFswOut, &InVal); 4831 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s }, /* #%u%s */\n",4832 fFcw | fEmpty, State.FSW, fFswOut, GenFormatR80(&InVal), iTest, fEmpty ? "/empty" : "");4911 FPU_UNARY_R80_TEST_T const Test = { (uint16_t)(fFcw | fEmpty), State.FSW, fFswOut, InVal }; 4912 GenerateBinaryWrite(&BinOut, &Test, sizeof(Test)); 4833 4913 } 4834 4914 } 4835 GenerateArrayEnd(pOutFn, g_aFpuUnaryFswR80[iFn].pszName); 4836 } 4915 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); 4916 } 4917 return RTEXITCODE_SUCCESS; 4918 } 4919 4920 static RTEXITCODE FpuUnaryFswR80DumpAll(const char * const *papszNameFmts) 4921 { 4922 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuUnaryFswR80); iFn++) 4923 DUMP_TEST_ENTRY(g_aFpuUnaryFswR80[iFn], papszNameFmts); 4924 return RTEXITCODE_SUCCESS; 4837 4925 } 4838 4926 #endif … … 4894 4982 4895 4983 #ifdef TSTIEMAIMPL_WITH_GENERATOR 4896 static void FpuUnaryTwoR80Generate(PRTSTREAM pOut, PRTSTREAM pOutCpu, uint32_t cTests)4984 static RTEXITCODE FpuUnaryTwoR80Generate(uint32_t cTests, const char * const *papszNameFmts) 4897 4985 { 4898 4986 static RTFLOAT80U const s_aSpecials[] = … … 4907 4995 { 4908 4996 PFNIEMAIMPLFPUR80UNARYTWO const pfn = g_aFpuUnaryTwoR80[iFn].pfnNative ? g_aFpuUnaryTwoR80[iFn].pfnNative : g_aFpuUnaryTwoR80[iFn].pfn; 4909 PRTSTREAM pOutFn = pOut; 4910 if (g_aFpuUnaryTwoR80[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE) 4911 { 4912 if (g_aFpuUnaryTwoR80[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) 4913 continue; 4914 pOutFn = pOutCpu; 4915 } 4916 4917 GenerateArrayStart(pOutFn, g_aFpuUnaryTwoR80[iFn].pszName, "FPU_UNARY_TWO_R80_TEST_T"); 4918 uint32_t iTestOutput = 0; 4997 if ( g_aFpuUnaryTwoR80[iFn].idxCpuEflFlavour != IEMTARGETCPU_EFL_BEHAVIOR_NATIVE 4998 && g_aFpuUnaryTwoR80[iFn].idxCpuEflFlavour != g_idxCpuEflFlavour) 4999 continue; 5000 5001 IEMBINARYOUTPUT BinOut; 5002 AssertReturn(GENERATE_BINARY_OPEN(&BinOut, papszNameFmts, g_aFpuUnaryTwoR80[iFn]), RTEXITCODE_FAILURE); 4919 5003 uint32_t cNormalInputs = 0; 4920 5004 uint32_t cTargetRangeInputs = 0; … … 4957 5041 IEMFPURESULTTWO ResM = { RTFLOAT80U_INIT(0, 0, 0), 0, RTFLOAT80U_INIT(0, 0, 0) }; 4958 5042 pfn(&State, &ResM, &InVal); 4959 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/m = #%u */\n",4960 State.FCW | fFcwExtra, State.FSW, ResM.FSW, GenFormatR80(&InVal), GenFormatR80(&ResM.r80Result1),4961 GenFormatR80(&ResM.r80Result2), iTest, iRounding, iPrecision, iTestOutput++);5043 FPU_UNARY_TWO_R80_TEST_T const TestM 5044 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, ResM.FSW, InVal, ResM.r80Result1, ResM.r80Result2 }; 5045 GenerateBinaryWrite(&BinOut, &TestM, sizeof(TestM)); 4962 5046 4963 5047 State.FCW = State.FCW & ~X86_FCW_MASK_ALL; 4964 5048 IEMFPURESULTTWO ResU = { RTFLOAT80U_INIT(0, 0, 0), 0, RTFLOAT80U_INIT(0, 0, 0) }; 4965 5049 pfn(&State, &ResU, &InVal); 4966 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/u = #%u */\n",4967 State.FCW | fFcwExtra, State.FSW, ResU.FSW, GenFormatR80(&InVal), GenFormatR80(&ResU.r80Result1),4968 GenFormatR80(&ResU.r80Result2), iTest, iRounding, iPrecision, iTestOutput++);5050 FPU_UNARY_TWO_R80_TEST_T const TestU 5051 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, ResU.FSW, InVal, ResU.r80Result1, ResU.r80Result2 }; 5052 GenerateBinaryWrite(&BinOut, &TestU, sizeof(TestU)); 4969 5053 4970 5054 uint16_t fXcpt = (ResM.FSW | ResU.FSW) & X86_FSW_XCPT_MASK & ~X86_FSW_SF; … … 4974 5058 IEMFPURESULTTWO Res1 = { RTFLOAT80U_INIT(0, 0, 0), 0, RTFLOAT80U_INIT(0, 0, 0) }; 4975 5059 pfn(&State, &Res1, &InVal); 4976 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/%#x = #%u */\n", 4977 State.FCW | fFcwExtra, State.FSW, Res1.FSW, GenFormatR80(&InVal), GenFormatR80(&Res1.r80Result1), 4978 GenFormatR80(&Res1.r80Result2), iTest, iRounding, iPrecision, fXcpt, iTestOutput++); 5060 FPU_UNARY_TWO_R80_TEST_T const Test1 5061 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, Res1.FSW, InVal, Res1.r80Result1, Res1.r80Result2 }; 5062 GenerateBinaryWrite(&BinOut, &Test1, sizeof(Test1)); 5063 4979 5064 if (((Res1.FSW & X86_FSW_XCPT_MASK) & fXcpt) != (Res1.FSW & X86_FSW_XCPT_MASK)) 4980 5065 { … … 4983 5068 IEMFPURESULTTWO Res2 = { RTFLOAT80U_INIT(0, 0, 0), 0, RTFLOAT80U_INIT(0, 0, 0) }; 4984 5069 pfn(&State, &Res2, &InVal); 4985 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/%#x[!] = #%u */\n",4986 State.FCW | fFcwExtra, State.FSW, Res2.FSW, GenFormatR80(&InVal), GenFormatR80(&Res2.r80Result1),4987 GenFormatR80(&Res2.r80Result2), iTest, iRounding, iPrecision, fXcpt, iTestOutput++);5070 FPU_UNARY_TWO_R80_TEST_T const Test2 5071 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, Res2.FSW, InVal, Res2.r80Result1, Res2.r80Result2 }; 5072 GenerateBinaryWrite(&BinOut, &Test2, sizeof(Test2)); 4988 5073 } 4989 5074 if (!RT_IS_POWER_OF_TWO(fXcpt)) … … 4994 5079 IEMFPURESULTTWO Res3 = { RTFLOAT80U_INIT(0, 0, 0), 0, RTFLOAT80U_INIT(0, 0, 0) }; 4995 5080 pfn(&State, &Res3, &InVal); 4996 RTStrmPrintf(pOutFn, " { %#06x, %#06x, %#06x, %s, %s, %s }, /* #%u/%u/%u/u%#x = #%u */\n",4997 State.FCW | fFcwExtra, State.FSW, Res3.FSW, GenFormatR80(&InVal), GenFormatR80(&Res3.r80Result1),4998 GenFormatR80(&Res3.r80Result2), iTest, iRounding, iPrecision, fUnmasked, iTestOutput++);5081 FPU_UNARY_TWO_R80_TEST_T const Test3 5082 = { (uint16_t)(State.FCW | fFcwExtra), State.FSW, Res3.FSW, InVal, Res3.r80Result1, Res3.r80Result2 }; 5083 GenerateBinaryWrite(&BinOut, &Test3, sizeof(Test3)); 4999 5084 } 5000 5085 } 5001 5086 } 5002 5087 } 5003 GenerateArrayEnd(pOutFn, g_aFpuUnaryTwoR80[iFn].pszName); 5004 } 5088 AssertReturn(GenerateBinaryClose(&BinOut), RTEXITCODE_FAILURE); 5089 } 5090 return RTEXITCODE_SUCCESS; 5091 } 5092 5093 static RTEXITCODE FpuUnaryTwoR80DumpAll(const char * const *papszNameFmts) 5094 { 5095 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aFpuUnaryTwoR80); iFn++) 5096 DUMP_TEST_ENTRY(g_aFpuUnaryTwoR80[iFn], papszNameFmts); 5097 return RTEXITCODE_SUCCESS; 5005 5098 } 5006 5099 #endif … … 9784 9877 { 9785 9878 #ifdef TSTIEMAIMPL_WITH_GENERATOR 9786 char szCpuDesc[256] = {0};9787 RTMpGetDescription(NIL_RTCPUID, szCpuDesc, sizeof(szCpuDesc));9788 const char * const pszCpuType = g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD ? "Amd" : "Intel";9789 # if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)9790 const char * const pszBitBucket = "NUL";9791 # else9792 const char * const pszBitBucket = "/dev/null";9793 # endif9794 9795 9879 if (cTests == 0) 9796 9880 cTests = cDefaultTests; … … 9827 9911 if (fFpuLdSt) 9828 9912 { 9829 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuLdSt.cpp" : pszBitBucket; 9830 PRTSTREAM pStrmData = GenerateOpenWithHdr(pszDataFile, szCpuDesc, NULL); 9831 const char *pszDataCpuFile = !fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 9832 ? "tstIEMAImplDataFpuLdSt-Amd.cpp" : "tstIEMAImplDataFpuLdSt-Intel.cpp"; 9833 PRTSTREAM pStrmDataCpu = GenerateOpenWithHdr(pszDataCpuFile, szCpuDesc, pszCpuType); 9834 if (!pStrmData || !pStrmDataCpu) 9835 return RTEXITCODE_FAILURE; 9836 9837 FpuLdConstGenerate(pStrmData, cTests); 9838 FpuLdIntGenerate(pStrmData, cTests); 9839 FpuLdD80Generate(pStrmData, cTests); 9840 FpuStIntGenerate(pStrmData, pStrmDataCpu, cTests); 9841 FpuStD80Generate(pStrmData, cTests); 9913 const char * const apszNameFmts[] = 9914 { 9915 /*[IEMTARGETCPU_EFL_BEHAVIOR_NATIVE] =*/ fCommonData ? "tstIEMAImplDataFpuLdSt-%s.bin.gz" : NULL, 9916 /*[IEMTARGETCPU_EFL_BEHAVIOR_INTEL] =*/ fCpuData ? "tstIEMAImplDataFpuLdSt-%s.bin.gz" : NULL, 9917 /*[IEMTARGETCPU_EFL_BEHAVIOR_AMD] =*/ fCpuData ? "tstIEMAImplDataFpuLdSt-%s.bin.gz" : NULL, 9918 }; 9919 RTEXITCODE rcExit = FpuLdConstGenerate(cTests, apszNameFmts); 9920 if (rcExit == RTEXITCODE_SUCCESS) 9921 rcExit = FpuLdIntGenerate(cTests, apszNameFmts); 9922 if (rcExit == RTEXITCODE_SUCCESS) 9923 rcExit = FpuLdD80Generate(cTests, apszNameFmts); 9924 if (rcExit == RTEXITCODE_SUCCESS) 9925 rcExit = FpuStIntGenerate(cTests, apszNameFmts); 9926 if (rcExit == RTEXITCODE_SUCCESS) 9927 rcExit = FpuStD80Generate(cTests, apszNameFmts); 9842 9928 uint32_t const cTests2 = RT_MAX(cTests, 384); /* need better coverage for the next ones. */ 9843 FpuLdMemGenerate(pStrmData, cTests2); 9844 FpuStMemGenerate(pStrmData, cTests2); 9845 9846 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, 9847 GenerateFooterAndClose(pStrmData, pszDataFile, RTEXITCODE_SUCCESS)); 9929 if (rcExit == RTEXITCODE_SUCCESS) 9930 rcExit = FpuLdMemGenerate(cTests2, apszNameFmts); 9931 if (rcExit == RTEXITCODE_SUCCESS) 9932 rcExit = FpuStMemGenerate(cTests2, apszNameFmts); 9848 9933 if (rcExit != RTEXITCODE_SUCCESS) 9849 9934 return rcExit; … … 9852 9937 if (fFpuBinary1) 9853 9938 { 9854 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuBinary1.cpp" : pszBitBucket; 9855 PRTSTREAM pStrmData = GenerateOpenWithHdr(pszDataFile, szCpuDesc, NULL); 9856 const char *pszDataCpuFile = !fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 9857 ? "tstIEMAImplDataFpuBinary1-Amd.cpp" : "tstIEMAImplDataFpuBinary1-Intel.cpp"; 9858 PRTSTREAM pStrmDataCpu = GenerateOpenWithHdr(pszDataCpuFile, szCpuDesc, pszCpuType); 9859 if (!pStrmData || !pStrmDataCpu) 9860 return RTEXITCODE_FAILURE; 9861 9862 FpuBinaryR80Generate(pStrmData, pStrmDataCpu, cTests); 9863 FpuBinaryFswR80Generate(pStrmData, cTests); 9864 FpuBinaryEflR80Generate(pStrmData, cTests); 9865 9866 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, 9867 GenerateFooterAndClose(pStrmData, pszDataFile, RTEXITCODE_SUCCESS)); 9939 const char * const apszNameFmts[] = 9940 { 9941 /*[IEMTARGETCPU_EFL_BEHAVIOR_NATIVE] =*/ fCommonData ? "tstIEMAImplDataFpuBinary1-%s.bin.gz" : NULL, 9942 /*[IEMTARGETCPU_EFL_BEHAVIOR_INTEL] =*/ fCpuData ? "tstIEMAImplDataFpuBinary1-%s.bin.gz" : NULL, 9943 /*[IEMTARGETCPU_EFL_BEHAVIOR_AMD] =*/ fCpuData ? "tstIEMAImplDataFpuBinary1-%s.bin.gz" : NULL, 9944 }; 9945 RTEXITCODE rcExit = FpuBinaryR80Generate(cTests, apszNameFmts); 9946 if (rcExit == RTEXITCODE_SUCCESS) 9947 rcExit = FpuBinaryFswR80Generate(cTests, apszNameFmts); 9948 if (rcExit == RTEXITCODE_SUCCESS) 9949 rcExit = FpuBinaryEflR80Generate(cTests, apszNameFmts); 9868 9950 if (rcExit != RTEXITCODE_SUCCESS) 9869 9951 return rcExit; … … 9872 9954 if (fFpuBinary2) 9873 9955 { 9874 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuBinary2.cpp" : pszBitBucket; 9875 PRTSTREAM pStrmData = GenerateOpenWithHdr(pszDataFile, szCpuDesc, NULL); 9876 const char *pszDataCpuFile = pszBitBucket; /*!fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 9877 ? "tstIEMAImplDataFpuBinary2-Amd.cpp" : "tstIEMAImplDataFpuBinary2-Intel.cpp"; */ 9878 PRTSTREAM pStrmDataCpu = GenerateOpenWithHdr(pszDataCpuFile, szCpuDesc, pszCpuType); 9879 if (!pStrmData || !pStrmDataCpu) 9880 return RTEXITCODE_FAILURE; 9881 9882 FpuBinaryR64Generate(pStrmData, cTests); 9883 FpuBinaryR32Generate(pStrmData, cTests); 9884 FpuBinaryI32Generate(pStrmData, cTests); 9885 FpuBinaryI16Generate(pStrmData, cTests); 9886 FpuBinaryFswR64Generate(pStrmData, cTests); 9887 FpuBinaryFswR32Generate(pStrmData, cTests); 9888 FpuBinaryFswI32Generate(pStrmData, cTests); 9889 FpuBinaryFswI16Generate(pStrmData, cTests); 9890 9891 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, 9892 GenerateFooterAndClose(pStrmData, pszDataFile, RTEXITCODE_SUCCESS)); 9956 const char * const apszNameFmts[] = 9957 { 9958 /*[IEMTARGETCPU_EFL_BEHAVIOR_NATIVE] =*/ fCommonData ? "tstIEMAImplDataFpuBinary2-%s.bin.gz" : NULL, 9959 /*[IEMTARGETCPU_EFL_BEHAVIOR_INTEL] =*/ fCpuData ? "tstIEMAImplDataFpuBinary2-%s.bin.gz" : NULL, 9960 /*[IEMTARGETCPU_EFL_BEHAVIOR_AMD] =*/ fCpuData ? "tstIEMAImplDataFpuBinary2-%s.bin.gz" : NULL, 9961 }; 9962 RTEXITCODE rcExit = FpuBinaryR64Generate(cTests, apszNameFmts); 9963 if (rcExit == RTEXITCODE_SUCCESS) 9964 rcExit = FpuBinaryR32Generate(cTests, apszNameFmts); 9965 if (rcExit == RTEXITCODE_SUCCESS) 9966 rcExit = FpuBinaryI32Generate(cTests, apszNameFmts); 9967 if (rcExit == RTEXITCODE_SUCCESS) 9968 rcExit = FpuBinaryI16Generate(cTests, apszNameFmts); 9969 if (rcExit == RTEXITCODE_SUCCESS) 9970 rcExit = FpuBinaryFswR64Generate(cTests, apszNameFmts); 9971 if (rcExit == RTEXITCODE_SUCCESS) 9972 rcExit = FpuBinaryFswR32Generate(cTests, apszNameFmts); 9973 if (rcExit == RTEXITCODE_SUCCESS) 9974 rcExit = FpuBinaryFswI32Generate(cTests, apszNameFmts); 9975 if (rcExit == RTEXITCODE_SUCCESS) 9976 rcExit = FpuBinaryFswI16Generate(cTests, apszNameFmts); 9893 9977 if (rcExit != RTEXITCODE_SUCCESS) 9894 9978 return rcExit; … … 9897 9981 if (fFpuOther) 9898 9982 { 9899 const char *pszDataFile = fCommonData ? "tstIEMAImplDataFpuOther.cpp" : pszBitBucket; 9900 PRTSTREAM pStrmData = GenerateOpenWithHdr(pszDataFile, szCpuDesc, NULL); 9901 const char *pszDataCpuFile = !fCpuData ? pszBitBucket : g_idxCpuEflFlavour == IEMTARGETCPU_EFL_BEHAVIOR_AMD 9902 ? "tstIEMAImplDataFpuOther-Amd.cpp" : "tstIEMAImplDataFpuOther-Intel.cpp"; 9903 PRTSTREAM pStrmDataCpu = GenerateOpenWithHdr(pszDataCpuFile, szCpuDesc, pszCpuType); 9904 if (!pStrmData || !pStrmDataCpu) 9905 return RTEXITCODE_FAILURE; 9906 9907 FpuUnaryR80Generate(pStrmData, pStrmDataCpu, cTests); 9908 FpuUnaryFswR80Generate(pStrmData, pStrmDataCpu, cTests); 9909 FpuUnaryTwoR80Generate(pStrmData, pStrmDataCpu, cTests); 9910 9911 RTEXITCODE rcExit = GenerateFooterAndClose(pStrmDataCpu, pszDataCpuFile, 9912 GenerateFooterAndClose(pStrmData, pszDataFile, RTEXITCODE_SUCCESS)); 9983 const char * const apszNameFmts[] = 9984 { 9985 /*[IEMTARGETCPU_EFL_BEHAVIOR_NATIVE] =*/ fCommonData ? "tstIEMAImplDataFpuOther-%s.bin.gz" : NULL, 9986 /*[IEMTARGETCPU_EFL_BEHAVIOR_INTEL] =*/ fCpuData ? "tstIEMAImplDataFpuOther-%s.bin.gz" : NULL, 9987 /*[IEMTARGETCPU_EFL_BEHAVIOR_AMD] =*/ fCpuData ? "tstIEMAImplDataFpuOther-%s.bin.gz" : NULL, 9988 }; 9989 RTEXITCODE rcExit = FpuUnaryR80Generate(cTests, apszNameFmts); 9990 if (rcExit == RTEXITCODE_SUCCESS) 9991 rcExit = FpuUnaryFswR80Generate(cTests, apszNameFmts); 9992 if (rcExit == RTEXITCODE_SUCCESS) 9993 rcExit = FpuUnaryTwoR80Generate(cTests, apszNameFmts); 9913 9994 if (rcExit != RTEXITCODE_SUCCESS) 9914 9995 return rcExit; … … 10030 10111 if (rcExit == RTEXITCODE_SUCCESS) 10031 10112 rcExit = MulDivDumpAll(apszNameFmts); 10113 if (rcExit != RTEXITCODE_SUCCESS) 10114 return rcExit; 10115 } 10116 10117 if (fFpuLdSt) 10118 { 10119 const char * const apszNameFmts[] = 10120 { 10121 /*[IEMTARGETCPU_EFL_BEHAVIOR_NATIVE] =*/ fCommonData ? "tstIEMAImplDataFpuLdSt-%s.bin.gz" : NULL, 10122 /*[IEMTARGETCPU_EFL_BEHAVIOR_INTEL] =*/ fCpuData ? "tstIEMAImplDataFpuLdSt-%s.bin.gz" : NULL, 10123 /*[IEMTARGETCPU_EFL_BEHAVIOR_AMD] =*/ fCpuData ? "tstIEMAImplDataFpuLdSt-%s.bin.gz" : NULL, 10124 }; 10125 RTEXITCODE rcExit = FpuLdConstDumpAll(apszNameFmts); 10126 if (rcExit == RTEXITCODE_SUCCESS) 10127 rcExit = FpuLdIntDumpAll(apszNameFmts); 10128 if (rcExit == RTEXITCODE_SUCCESS) 10129 rcExit = FpuLdD80DumpAll(apszNameFmts); 10130 if (rcExit == RTEXITCODE_SUCCESS) 10131 rcExit = FpuStIntDumpAll(apszNameFmts); 10132 if (rcExit == RTEXITCODE_SUCCESS) 10133 rcExit = FpuStD80DumpAll(apszNameFmts); 10134 if (rcExit == RTEXITCODE_SUCCESS) 10135 rcExit = FpuLdMemDumpAll(apszNameFmts); 10136 if (rcExit == RTEXITCODE_SUCCESS) 10137 rcExit = FpuStMemDumpAll(apszNameFmts); 10138 if (rcExit != RTEXITCODE_SUCCESS) 10139 return rcExit; 10140 } 10141 10142 if (fFpuBinary1) 10143 { 10144 const char * const apszNameFmts[] = 10145 { 10146 /*[IEMTARGETCPU_EFL_BEHAVIOR_NATIVE] =*/ fCommonData ? "tstIEMAImplDataFpuBinary1-%s.bin.gz" : NULL, 10147 /*[IEMTARGETCPU_EFL_BEHAVIOR_INTEL] =*/ fCpuData ? "tstIEMAImplDataFpuBinary1-%s.bin.gz" : NULL, 10148 /*[IEMTARGETCPU_EFL_BEHAVIOR_AMD] =*/ fCpuData ? "tstIEMAImplDataFpuBinary1-%s.bin.gz" : NULL, 10149 }; 10150 RTEXITCODE rcExit = FpuBinaryR80DumpAll(apszNameFmts); 10151 if (rcExit == RTEXITCODE_SUCCESS) 10152 rcExit = FpuBinaryFswR80DumpAll(apszNameFmts); 10153 if (rcExit == RTEXITCODE_SUCCESS) 10154 rcExit = FpuBinaryEflR80DumpAll(apszNameFmts); 10155 if (rcExit != RTEXITCODE_SUCCESS) 10156 return rcExit; 10157 } 10158 10159 if (fFpuBinary2) 10160 { 10161 const char * const apszNameFmts[] = 10162 { 10163 /*[IEMTARGETCPU_EFL_BEHAVIOR_NATIVE] =*/ fCommonData ? "tstIEMAImplDataFpuBinary2-%s.bin.gz" : NULL, 10164 /*[IEMTARGETCPU_EFL_BEHAVIOR_INTEL] =*/ fCpuData ? "tstIEMAImplDataFpuBinary2-%s.bin.gz" : NULL, 10165 /*[IEMTARGETCPU_EFL_BEHAVIOR_AMD] =*/ fCpuData ? "tstIEMAImplDataFpuBinary2-%s.bin.gz" : NULL, 10166 }; 10167 RTEXITCODE rcExit = FpuBinaryR64DumpAll(apszNameFmts); 10168 if (rcExit == RTEXITCODE_SUCCESS) 10169 rcExit = FpuBinaryR32DumpAll(apszNameFmts); 10170 if (rcExit == RTEXITCODE_SUCCESS) 10171 rcExit = FpuBinaryI32DumpAll(apszNameFmts); 10172 if (rcExit == RTEXITCODE_SUCCESS) 10173 rcExit = FpuBinaryI16DumpAll(apszNameFmts); 10174 if (rcExit == RTEXITCODE_SUCCESS) 10175 rcExit = FpuBinaryFswR64DumpAll(apszNameFmts); 10176 if (rcExit == RTEXITCODE_SUCCESS) 10177 rcExit = FpuBinaryFswR32DumpAll(apszNameFmts); 10178 if (rcExit == RTEXITCODE_SUCCESS) 10179 rcExit = FpuBinaryFswI32DumpAll(apszNameFmts); 10180 if (rcExit == RTEXITCODE_SUCCESS) 10181 rcExit = FpuBinaryFswI16DumpAll(apszNameFmts); 10182 if (rcExit != RTEXITCODE_SUCCESS) 10183 return rcExit; 10184 } 10185 10186 if (fFpuOther) 10187 { 10188 const char * const apszNameFmts[] = 10189 { 10190 /*[IEMTARGETCPU_EFL_BEHAVIOR_NATIVE] =*/ fCommonData ? "tstIEMAImplDataFpuOther-%s.bin.gz" : NULL, 10191 /*[IEMTARGETCPU_EFL_BEHAVIOR_INTEL] =*/ fCpuData ? "tstIEMAImplDataFpuOther-%s.bin.gz" : NULL, 10192 /*[IEMTARGETCPU_EFL_BEHAVIOR_AMD] =*/ fCpuData ? "tstIEMAImplDataFpuOther-%s.bin.gz" : NULL, 10193 }; 10194 RTEXITCODE rcExit = FpuUnaryR80DumpAll(apszNameFmts); 10195 if (rcExit == RTEXITCODE_SUCCESS) 10196 rcExit = FpuUnaryFswR80DumpAll(apszNameFmts); 10197 if (rcExit == RTEXITCODE_SUCCESS) 10198 rcExit = FpuUnaryTwoR80DumpAll(apszNameFmts); 10032 10199 if (rcExit != RTEXITCODE_SUCCESS) 10033 10200 return rcExit;
Note:
See TracChangeset
for help on using the changeset viewer.