Changeset 96749 in vbox
- Timestamp:
- Sep 15, 2022 5:34:09 PM (2 years ago)
- Location:
- trunk/src/VBox/VMM/testcase
- Files:
-
- 8 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/Makefile.kmk
r96742 r96749 292 292 tstIEMAImplDataSseBinary-cvtsi2ss_r32_i64.bin \ 293 293 tstIEMAImplDataSseBinary-cvtsi2sd_r64_i32.bin \ 294 tstIEMAImplDataSseBinary-cvtsi2sd_r64_i64.bin 294 tstIEMAImplDataSseBinary-cvtsi2sd_r64_i64.bin \ 295 tstIEMAImplDataSseCompare-ucomiss_u128.bin \ 296 tstIEMAImplDataSseCompare-vucomiss_u128.bin \ 297 tstIEMAImplDataSseCompare-comiss_u128.bin \ 298 tstIEMAImplDataSseCompare-vcomiss_u128.bin \ 299 tstIEMAImplDataSseCompare-ucomisd_u128.bin \ 300 tstIEMAImplDataSseCompare-vucomisd_u128.bin \ 301 tstIEMAImplDataSseCompare-comisd_u128.bin \ 302 tstIEMAImplDataSseCompare-vcomisd_u128.bin 295 303 296 304 tstIEMAImpl_TEMPLATE = VBOXR3TSTEXE -
trunk/src/VBox/VMM/testcase/tstIEMAImpl.cpp
r96742 r96749 62 62 g_aTests_ ## a_Name, &g_cbTests_ ## a_Name, \ 63 63 a_uExtra, IEMTARGETCPU_EFL_BEHAVIOR_NATIVE /* means same for all here */ } 64 65 #define ENTRY_BIN_AVX(a_Name) ENTRY_BIN_AVX_EX(a_Name, 0) 66 #ifndef IEM_WITHOUT_ASSEMBLY 67 # define ENTRY_BIN_AVX_EX(a_Name, a_uExtra) \ 68 { RT_XSTR(a_Name), iemAImpl_ ## a_Name, NULL, \ 69 g_aTests_ ## a_Name, &g_cbTests_ ## a_Name, \ 70 a_uExtra, IEMTARGETCPU_EFL_BEHAVIOR_NATIVE /* means same for all here */ } 71 #else 72 # define ENTRY_BIN_AVX_EX(a_Name, a_uExtra) \ 73 { RT_XSTR(a_Name), iemAImpl_ ## a_Name ## _fallback, NULL, \ 74 g_aTests_ ## a_Name, &g_cbTests_ ## a_Name, \ 75 a_uExtra, IEMTARGETCPU_EFL_BEHAVIOR_NATIVE /* means same for all here */ } 76 #endif 77 64 78 65 79 #define ENTRY_INTEL(a_Name, a_fEflUndef) ENTRY_INTEL_EX(a_Name, a_fEflUndef, 0) … … 6553 6567 6554 6568 6569 /* 6570 * Compare SSE operations on single single-precision floating point values - outputting only EFLAGS. 6571 */ 6572 TYPEDEF_SUBTEST_TYPE(SSE_COMPARE_EFL_R32_R32_T, SSE_COMPARE_EFL_R32_R32_TEST_T, PFNIEMAIMPLF2EFLMXCSR128); 6573 6574 static const SSE_COMPARE_EFL_R32_R32_T g_aSseCompareEflR32R32[] = 6575 { 6576 ENTRY_BIN(ucomiss_u128), 6577 ENTRY_BIN(comiss_u128), 6578 ENTRY_BIN_AVX(vucomiss_u128), 6579 ENTRY_BIN_AVX(vcomiss_u128), 6580 }; 6581 6582 #ifdef TSTIEMAIMPL_WITH_GENERATOR 6583 static RTEXITCODE SseCompareEflR32R32Generate(const char *pszDataFileFmt, uint32_t cTests) 6584 { 6585 cTests = RT_MAX(192, cTests); /* there are 144 standard input variations */ 6586 6587 static struct { RTFLOAT32U Val1, Val2; } const s_aSpecials[] = 6588 { 6589 { RTFLOAT32U_INIT_ZERO(0), RTFLOAT32U_INIT_ZERO(0) }, 6590 { RTFLOAT32U_INIT_ZERO(0), RTFLOAT32U_INIT_ZERO(1) }, 6591 { RTFLOAT32U_INIT_ZERO(1), RTFLOAT32U_INIT_ZERO(0) }, 6592 { RTFLOAT32U_INIT_ZERO(1), RTFLOAT32U_INIT_ZERO(1) }, 6593 { RTFLOAT32U_INIT_INF(0), RTFLOAT32U_INIT_INF(0) }, 6594 { RTFLOAT32U_INIT_INF(0), RTFLOAT32U_INIT_INF(1) }, 6595 { RTFLOAT32U_INIT_INF(1), RTFLOAT32U_INIT_INF(0) }, 6596 { RTFLOAT32U_INIT_INF(1), RTFLOAT32U_INIT_INF(1) }, 6597 /** @todo More specials. */ 6598 }; 6599 6600 uint32_t cMinNormalPairs = (cTests - 144) / 4; 6601 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aSseCompareEflR32R32); iFn++) 6602 { 6603 PFNIEMAIMPLF2EFLMXCSR128 const pfn = g_aSseCompareEflR32R32[iFn].pfnNative ? g_aSseCompareEflR32R32[iFn].pfnNative : g_aSseCompareEflR32R32[iFn].pfn; 6604 6605 PRTSTREAM pStrmOut = NULL; 6606 int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseCompareEflR32R32[iFn].pszName); 6607 if (RT_FAILURE(rc)) 6608 { 6609 RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseCompareEflR32R32[iFn].pszName, rc); 6610 return RTEXITCODE_FAILURE; 6611 } 6612 6613 uint32_t cNormalInputPairs = 0; 6614 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1) 6615 { 6616 SSE_COMPARE_EFL_R32_R32_TEST_T TestData; RT_ZERO(TestData); 6617 X86XMMREG ValIn1; RT_ZERO(ValIn1); 6618 X86XMMREG ValIn2; RT_ZERO(ValIn2); 6619 6620 TestData.r32ValIn1 = iTest < cTests ? RandR32Src(iTest) : s_aSpecials[iTest - cTests].Val1; 6621 TestData.r32ValIn2 = iTest < cTests ? RandR32Src(iTest) : s_aSpecials[iTest - cTests].Val2; 6622 6623 ValIn1.ar32[0] = TestData.r32ValIn1; 6624 ValIn2.ar32[0] = TestData.r32ValIn2; 6625 6626 if ( RTFLOAT32U_IS_NORMAL(&TestData.r32ValIn1) 6627 && RTFLOAT32U_IS_NORMAL(&TestData.r32ValIn2)) 6628 cNormalInputPairs++; 6629 else if (cNormalInputPairs < cMinNormalPairs && iTest + cMinNormalPairs >= cTests && iTest < cTests) 6630 { 6631 iTest -= 1; 6632 continue; 6633 } 6634 6635 uint32_t const fMxcsr = RandMxcsr() & X86_MXCSR_XCPT_FLAGS; 6636 uint32_t const fEFlags = RandEFlags(); 6637 for (uint16_t iRounding = 0; iRounding < 4; iRounding++) 6638 for (uint8_t iDaz = 0; iDaz < 2; iDaz++) 6639 for (uint8_t iFz = 0; iFz < 2; iFz++) 6640 { 6641 uint32_t fMxcsrIn = (fMxcsr & ~X86_MXCSR_RC_MASK) 6642 | (iRounding << X86_MXCSR_RC_SHIFT) 6643 | (iDaz ? X86_MXCSR_DAZ : 0) 6644 | (iFz ? X86_MXCSR_FZ : 0) 6645 | X86_MXCSR_XCPT_MASK; 6646 uint32_t fMxcsrM = fMxcsrIn; 6647 uint32_t fEFlagsM = fEFlags; 6648 pfn(&fMxcsrM, &fEFlagsM, &ValIn1, &ValIn2); 6649 TestData.fMxcsrIn = fMxcsrIn; 6650 TestData.fMxcsrOut = fMxcsrM; 6651 TestData.fEflIn = fEFlags; 6652 TestData.fEflOut = fEFlagsM; 6653 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6654 6655 fMxcsrIn &= ~X86_MXCSR_XCPT_MASK; 6656 uint32_t fMxcsrU = fMxcsrIn; 6657 uint32_t fEFlagsU = fEFlags; 6658 pfn(&fMxcsrU, &fEFlagsU, &ValIn1, &ValIn2); 6659 TestData.fMxcsrIn = fMxcsrIn; 6660 TestData.fMxcsrOut = fMxcsrU; 6661 TestData.fEflIn = fEFlags; 6662 TestData.fEflOut = fEFlagsU; 6663 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6664 6665 uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS; 6666 if (fXcpt) 6667 { 6668 fMxcsrIn = (fMxcsrIn & ~X86_MXCSR_XCPT_MASK) | fXcpt; 6669 uint32_t fMxcsr1 = fMxcsrIn; 6670 uint32_t fEFlags1 = fEFlags; 6671 pfn(&fMxcsr1, &fEFlags1, &ValIn1, &ValIn2); 6672 TestData.fMxcsrIn = fMxcsrIn; 6673 TestData.fMxcsrOut = fMxcsr1; 6674 TestData.fEflIn = fEFlags; 6675 TestData.fEflOut = fEFlags1; 6676 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6677 6678 if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS)) 6679 { 6680 fXcpt |= fMxcsr1 & X86_MXCSR_XCPT_FLAGS; 6681 fMxcsrIn = (fMxcsrIn & ~X86_MXCSR_XCPT_MASK) | (fXcpt << X86_MXCSR_XCPT_MASK_SHIFT); 6682 uint32_t fMxcsr2 = fMxcsrIn; 6683 uint32_t fEFlags2 = fEFlags; 6684 pfn(&fMxcsr2, &fEFlags2, &ValIn1, &ValIn2); 6685 TestData.fMxcsrIn = fMxcsrIn; 6686 TestData.fMxcsrOut = fMxcsr2; 6687 TestData.fEflIn = fEFlags; 6688 TestData.fEflOut = fEFlags2; 6689 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6690 } 6691 if (!RT_IS_POWER_OF_TWO(fXcpt)) 6692 for (uint16_t fUnmasked = 1; fUnmasked <= X86_MXCSR_PE; fUnmasked <<= 1) 6693 if (fUnmasked & fXcpt) 6694 { 6695 fMxcsrIn = (fMxcsrIn & ~X86_MXCSR_XCPT_MASK) | ((fXcpt & ~fUnmasked) << X86_MXCSR_XCPT_MASK_SHIFT); 6696 uint32_t fMxcsr3 = fMxcsrIn; 6697 uint32_t fEFlags3 = fEFlags; 6698 pfn(&fMxcsr3, &fEFlags3, &ValIn1, &ValIn2); 6699 TestData.fMxcsrIn = fMxcsrIn; 6700 TestData.fMxcsrOut = fMxcsr3; 6701 TestData.fEflIn = fEFlags; 6702 TestData.fEflOut = fEFlags3; 6703 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6704 } 6705 } 6706 } 6707 } 6708 rc = RTStrmClose(pStrmOut); 6709 if (RT_FAILURE(rc)) 6710 { 6711 RTMsgError("Failed to close data file for %s: %Rrc", g_aSseCompareEflR32R32[iFn].pszName, rc); 6712 return RTEXITCODE_FAILURE; 6713 } 6714 } 6715 6716 return RTEXITCODE_SUCCESS; 6717 } 6718 #endif 6719 6720 static void SseCompareEflR32R32Test(void) 6721 { 6722 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aSseCompareEflR32R32); iFn++) 6723 { 6724 if (!SubTestAndCheckIfEnabled(g_aSseCompareEflR32R32[iFn].pszName)) 6725 continue; 6726 6727 uint32_t const cTests = *g_aSseCompareEflR32R32[iFn].pcTests; 6728 SSE_COMPARE_EFL_R32_R32_TEST_T const * const paTests = g_aSseCompareEflR32R32[iFn].paTests; 6729 PFNIEMAIMPLF2EFLMXCSR128 pfn = g_aSseCompareEflR32R32[iFn].pfn; 6730 uint32_t const cVars = COUNT_VARIATIONS(g_aSseCompareEflR32R32[iFn]); 6731 if (!cTests) RTTestSkipped(g_hTest, "no tests"); 6732 for (uint32_t iVar = 0; iVar < cVars; iVar++) 6733 { 6734 for (uint32_t iTest = 0; iTest < cTests / sizeof(SSE_COMPARE_EFL_R32_R32_TEST_T); iTest++) 6735 { 6736 X86XMMREG ValIn1; RT_ZERO(ValIn1); 6737 X86XMMREG ValIn2; RT_ZERO(ValIn2); 6738 6739 ValIn1.ar32[0] = paTests[iTest].r32ValIn1; 6740 ValIn2.ar32[0] = paTests[iTest].r32ValIn2; 6741 uint32_t fMxcsr = paTests[iTest].fMxcsrIn; 6742 uint32_t fEFlags = paTests[iTest].fEflIn; 6743 pfn(&fMxcsr, &fEFlags, &ValIn1, &ValIn2); 6744 if ( fMxcsr != paTests[iTest].fMxcsrOut 6745 || fEFlags != paTests[iTest].fEflOut) 6746 RTTestFailed(g_hTest, "#%04u%s: mxcsr=%#08x efl=%#08x in1=%s in2=%s\n" 6747 "%s -> mxcsr=%#08x %#08x\n" 6748 "%s expected %#08x %#08x%s (%s) (EFL: %s)\n", 6749 iTest, iVar ? "/n" : "", paTests[iTest].fMxcsrIn, paTests[iTest].fEflIn, 6750 FormatR32(&paTests[iTest].r32ValIn1), FormatR32(&paTests[iTest].r32ValIn2), 6751 iVar ? " " : "", fMxcsr, fEFlags, 6752 iVar ? " " : "", paTests[iTest].fMxcsrOut, paTests[iTest].fEflOut, 6753 MxcsrDiff(fMxcsr, paTests[iTest].fMxcsrOut), 6754 FormatMxcsr(paTests[iTest].fMxcsrIn), 6755 EFlagsDiff(fEFlags, paTests[iTest].fEflOut)); 6756 } 6757 } 6758 } 6759 } 6760 6761 6762 /* 6763 * Compare SSE operations on single single-precision floating point values - outputting only EFLAGS. 6764 */ 6765 TYPEDEF_SUBTEST_TYPE(SSE_COMPARE_EFL_R64_R64_T, SSE_COMPARE_EFL_R64_R64_TEST_T, PFNIEMAIMPLF2EFLMXCSR128); 6766 6767 static const SSE_COMPARE_EFL_R64_R64_T g_aSseCompareEflR64R64[] = 6768 { 6769 ENTRY_BIN(ucomisd_u128), 6770 ENTRY_BIN(comisd_u128), 6771 ENTRY_BIN_AVX(vucomisd_u128), 6772 ENTRY_BIN_AVX(vcomisd_u128) 6773 }; 6774 6775 #ifdef TSTIEMAIMPL_WITH_GENERATOR 6776 static RTEXITCODE SseCompareEflR64R64Generate(const char *pszDataFileFmt, uint32_t cTests) 6777 { 6778 cTests = RT_MAX(192, cTests); /* there are 144 standard input variations */ 6779 6780 static struct { RTFLOAT64U Val1, Val2; } const s_aSpecials[] = 6781 { 6782 { RTFLOAT64U_INIT_ZERO(0), RTFLOAT64U_INIT_ZERO(0) }, 6783 { RTFLOAT64U_INIT_ZERO(0), RTFLOAT64U_INIT_ZERO(1) }, 6784 { RTFLOAT64U_INIT_ZERO(1), RTFLOAT64U_INIT_ZERO(0) }, 6785 { RTFLOAT64U_INIT_ZERO(1), RTFLOAT64U_INIT_ZERO(1) }, 6786 { RTFLOAT64U_INIT_INF(0), RTFLOAT64U_INIT_INF(0) }, 6787 { RTFLOAT64U_INIT_INF(0), RTFLOAT64U_INIT_INF(1) }, 6788 { RTFLOAT64U_INIT_INF(1), RTFLOAT64U_INIT_INF(0) }, 6789 { RTFLOAT64U_INIT_INF(1), RTFLOAT64U_INIT_INF(1) }, 6790 /** @todo More specials. */ 6791 }; 6792 6793 uint32_t cMinNormalPairs = (cTests - 144) / 4; 6794 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aSseCompareEflR64R64); iFn++) 6795 { 6796 PFNIEMAIMPLF2EFLMXCSR128 const pfn = g_aSseCompareEflR64R64[iFn].pfnNative ? g_aSseCompareEflR64R64[iFn].pfnNative : g_aSseCompareEflR64R64[iFn].pfn; 6797 6798 PRTSTREAM pStrmOut = NULL; 6799 int rc = RTStrmOpenF("wb", &pStrmOut, pszDataFileFmt, g_aSseCompareEflR64R64[iFn].pszName); 6800 if (RT_FAILURE(rc)) 6801 { 6802 RTMsgError("Failed to open data file for %s for writing: %Rrc", g_aSseCompareEflR64R64[iFn].pszName, rc); 6803 return RTEXITCODE_FAILURE; 6804 } 6805 6806 uint32_t cNormalInputPairs = 0; 6807 for (uint32_t iTest = 0; iTest < cTests + RT_ELEMENTS(s_aSpecials); iTest += 1) 6808 { 6809 SSE_COMPARE_EFL_R64_R64_TEST_T TestData; RT_ZERO(TestData); 6810 X86XMMREG ValIn1; RT_ZERO(ValIn1); 6811 X86XMMREG ValIn2; RT_ZERO(ValIn2); 6812 6813 TestData.r64ValIn1 = iTest < cTests ? RandR64Src(iTest) : s_aSpecials[iTest - cTests].Val1; 6814 TestData.r64ValIn2 = iTest < cTests ? RandR64Src(iTest) : s_aSpecials[iTest - cTests].Val2; 6815 6816 ValIn1.ar64[0] = TestData.r64ValIn1; 6817 ValIn2.ar64[0] = TestData.r64ValIn2; 6818 6819 if ( RTFLOAT64U_IS_NORMAL(&TestData.r64ValIn1) 6820 && RTFLOAT64U_IS_NORMAL(&TestData.r64ValIn2)) 6821 cNormalInputPairs++; 6822 else if (cNormalInputPairs < cMinNormalPairs && iTest + cMinNormalPairs >= cTests && iTest < cTests) 6823 { 6824 iTest -= 1; 6825 continue; 6826 } 6827 6828 uint32_t const fMxcsr = RandMxcsr() & X86_MXCSR_XCPT_FLAGS; 6829 uint32_t const fEFlags = RandEFlags(); 6830 for (uint16_t iRounding = 0; iRounding < 4; iRounding++) 6831 for (uint8_t iDaz = 0; iDaz < 2; iDaz++) 6832 for (uint8_t iFz = 0; iFz < 2; iFz++) 6833 { 6834 uint32_t fMxcsrIn = (fMxcsr & ~X86_MXCSR_RC_MASK) 6835 | (iRounding << X86_MXCSR_RC_SHIFT) 6836 | (iDaz ? X86_MXCSR_DAZ : 0) 6837 | (iFz ? X86_MXCSR_FZ : 0) 6838 | X86_MXCSR_XCPT_MASK; 6839 uint32_t fMxcsrM = fMxcsrIn; 6840 uint32_t fEFlagsM = fEFlags; 6841 pfn(&fMxcsrM, &fEFlagsM, &ValIn1, &ValIn2); 6842 TestData.fMxcsrIn = fMxcsrIn; 6843 TestData.fMxcsrOut = fMxcsrM; 6844 TestData.fEflIn = fEFlags; 6845 TestData.fEflOut = fEFlagsM; 6846 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6847 6848 fMxcsrIn &= ~X86_MXCSR_XCPT_MASK; 6849 uint32_t fMxcsrU = fMxcsrIn; 6850 uint32_t fEFlagsU = fEFlags; 6851 pfn(&fMxcsrU, &fEFlagsU, &ValIn1, &ValIn2); 6852 TestData.fMxcsrIn = fMxcsrIn; 6853 TestData.fMxcsrOut = fMxcsrU; 6854 TestData.fEflIn = fEFlags; 6855 TestData.fEflOut = fEFlagsU; 6856 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6857 6858 uint16_t fXcpt = (fMxcsrM | fMxcsrU) & X86_MXCSR_XCPT_FLAGS; 6859 if (fXcpt) 6860 { 6861 fMxcsrIn = (fMxcsrIn & ~X86_MXCSR_XCPT_MASK) | fXcpt; 6862 uint32_t fMxcsr1 = fMxcsrIn; 6863 uint32_t fEFlags1 = fEFlags; 6864 pfn(&fMxcsr1, &fEFlags1, &ValIn1, &ValIn2); 6865 TestData.fMxcsrIn = fMxcsrIn; 6866 TestData.fMxcsrOut = fMxcsr1; 6867 TestData.fEflIn = fEFlags; 6868 TestData.fEflOut = fEFlags1; 6869 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6870 6871 if (((fMxcsr1 & X86_MXCSR_XCPT_FLAGS) & fXcpt) != (fMxcsr1 & X86_MXCSR_XCPT_FLAGS)) 6872 { 6873 fXcpt |= fMxcsr1 & X86_MXCSR_XCPT_FLAGS; 6874 fMxcsrIn = (fMxcsrIn & ~X86_MXCSR_XCPT_MASK) | (fXcpt << X86_MXCSR_XCPT_MASK_SHIFT); 6875 uint32_t fMxcsr2 = fMxcsrIn; 6876 uint32_t fEFlags2 = fEFlags; 6877 pfn(&fMxcsr2, &fEFlags2, &ValIn1, &ValIn2); 6878 TestData.fMxcsrIn = fMxcsrIn; 6879 TestData.fMxcsrOut = fMxcsr2; 6880 TestData.fEflIn = fEFlags; 6881 TestData.fEflOut = fEFlags2; 6882 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6883 } 6884 if (!RT_IS_POWER_OF_TWO(fXcpt)) 6885 for (uint16_t fUnmasked = 1; fUnmasked <= X86_MXCSR_PE; fUnmasked <<= 1) 6886 if (fUnmasked & fXcpt) 6887 { 6888 fMxcsrIn = (fMxcsrIn & ~X86_MXCSR_XCPT_MASK) | ((fXcpt & ~fUnmasked) << X86_MXCSR_XCPT_MASK_SHIFT); 6889 uint32_t fMxcsr3 = fMxcsrIn; 6890 uint32_t fEFlags3 = fEFlags; 6891 pfn(&fMxcsr3, &fEFlags3, &ValIn1, &ValIn2); 6892 TestData.fMxcsrIn = fMxcsrIn; 6893 TestData.fMxcsrOut = fMxcsr3; 6894 TestData.fEflIn = fEFlags; 6895 TestData.fEflOut = fEFlags3; 6896 RTStrmWrite(pStrmOut, &TestData, sizeof(TestData)); 6897 } 6898 } 6899 } 6900 } 6901 rc = RTStrmClose(pStrmOut); 6902 if (RT_FAILURE(rc)) 6903 { 6904 RTMsgError("Failed to close data file for %s: %Rrc", g_aSseCompareEflR64R64[iFn].pszName, rc); 6905 return RTEXITCODE_FAILURE; 6906 } 6907 } 6908 6909 return RTEXITCODE_SUCCESS; 6910 } 6911 #endif 6912 6913 static void SseCompareEflR64R64Test(void) 6914 { 6915 for (size_t iFn = 0; iFn < RT_ELEMENTS(g_aSseCompareEflR64R64); iFn++) 6916 { 6917 if (!SubTestAndCheckIfEnabled(g_aSseCompareEflR64R64[iFn].pszName)) 6918 continue; 6919 6920 uint32_t const cTests = *g_aSseCompareEflR64R64[iFn].pcTests; 6921 SSE_COMPARE_EFL_R64_R64_TEST_T const * const paTests = g_aSseCompareEflR64R64[iFn].paTests; 6922 PFNIEMAIMPLF2EFLMXCSR128 pfn = g_aSseCompareEflR64R64[iFn].pfn; 6923 uint32_t const cVars = COUNT_VARIATIONS(g_aSseCompareEflR64R64[iFn]); 6924 if (!cTests) RTTestSkipped(g_hTest, "no tests"); 6925 for (uint32_t iVar = 0; iVar < cVars; iVar++) 6926 { 6927 for (uint32_t iTest = 0; iTest < cTests / sizeof(SSE_COMPARE_EFL_R64_R64_TEST_T); iTest++) 6928 { 6929 X86XMMREG ValIn1; RT_ZERO(ValIn1); 6930 X86XMMREG ValIn2; RT_ZERO(ValIn2); 6931 6932 ValIn1.ar64[0] = paTests[iTest].r64ValIn1; 6933 ValIn2.ar64[0] = paTests[iTest].r64ValIn2; 6934 uint32_t fMxcsr = paTests[iTest].fMxcsrIn; 6935 uint32_t fEFlags = paTests[iTest].fEflIn; 6936 pfn(&fMxcsr, &fEFlags, &ValIn1, &ValIn2); 6937 if ( fMxcsr != paTests[iTest].fMxcsrOut 6938 || fEFlags != paTests[iTest].fEflOut) 6939 RTTestFailed(g_hTest, "#%04u%s: mxcsr=%#08x efl=%#08x in1=%s in2=%s\n" 6940 "%s -> mxcsr=%#08x %#08x\n" 6941 "%s expected %#08x %#08x%s (%s) (EFL: %s)\n", 6942 iTest, iVar ? "/n" : "", paTests[iTest].fMxcsrIn, paTests[iTest].fEflIn, 6943 FormatR64(&paTests[iTest].r64ValIn1), FormatR64(&paTests[iTest].r64ValIn2), 6944 iVar ? " " : "", fMxcsr, fEFlags, 6945 iVar ? " " : "", paTests[iTest].fMxcsrOut, paTests[iTest].fEflOut, 6946 MxcsrDiff(fMxcsr, paTests[iTest].fMxcsrOut), 6947 FormatMxcsr(paTests[iTest].fMxcsrIn), 6948 EFlagsDiff(fEFlags, paTests[iTest].fEflOut)); 6949 } 6950 } 6951 } 6952 } 6953 6954 6555 6955 6556 6956 int main(int argc, char **argv) … … 6585 6985 bool fCommonData = true; 6586 6986 bool fSseFpBinary = true; 6987 bool fSseFpOther = true; 6587 6988 uint32_t const cDefaultTests = 96; 6588 6989 uint32_t cTests = cDefaultTests; … … 6602 7003 { "--fpu-other", 'O', RTGETOPT_REQ_NOTHING }, 6603 7004 { "--sse-fp-binary", 'S', RTGETOPT_REQ_NOTHING }, 7005 { "--sse-fp-other", 'T', RTGETOPT_REQ_NOTHING }, 6604 7006 { "--int", 'i', RTGETOPT_REQ_NOTHING }, 6605 7007 { "--include", 'I', RTGETOPT_REQ_STRING }, … … 6638 7040 fFpuOther = true; 6639 7041 fSseFpBinary = true; 7042 fSseFpOther = true; 6640 7043 break; 6641 7044 case 'z': … … 6648 7051 fFpuOther = false; 6649 7052 fSseFpBinary = false; 7053 fSseFpOther = false; 6650 7054 break; 6651 7055 … … 6664 7068 case 'S': 6665 7069 fSseFpBinary = true; 7070 break; 7071 case 'T': 7072 fSseFpOther = true; 6666 7073 break; 6667 7074 case 'i': … … 6725 7132 " -S, --sse-fp-binary\n" 6726 7133 " Enable SSE binary 64- and 32-bit FP tests.\n" 7134 " -T, --sse-fp-other\n" 7135 " Enable misc SSE 64- and 32-bit FP tests.\n" 6727 7136 " -I,--include=<test-patter>\n" 6728 7137 " Enable tests matching the given pattern.\n" … … 6913 7322 if (rcExit == RTEXITCODE_SUCCESS) 6914 7323 rcExit = SseBinaryR32I64Generate(pszDataFileFmt, cTests); 6915 7324 if (rcExit != RTEXITCODE_SUCCESS) 7325 return rcExit; 7326 } 7327 7328 if (fSseFpOther) 7329 { 7330 const char *pszDataFileFmt = fCommonData ? "tstIEMAImplDataSseCompare-%s.bin" : pszBitBucket; 7331 7332 RTEXITCODE rcExit = SseCompareEflR32R32Generate(pszDataFileFmt, cTests); 7333 if (rcExit == RTEXITCODE_SUCCESS) 7334 rcExit = SseCompareEflR64R64Generate(pszDataFileFmt, cTests); 6916 7335 if (rcExit != RTEXITCODE_SUCCESS) 6917 7336 return rcExit; … … 7024 7443 SseBinaryR32I64Test(); 7025 7444 } 7445 7446 if (fSseFpOther) 7447 { 7448 SseCompareEflR32R32Test(); 7449 SseCompareEflR64R64Test(); 7450 } 7026 7451 } 7027 7452 return RTTestSummaryAndDestroy(g_hTest); -
trunk/src/VBox/VMM/testcase/tstIEMAImpl.h
r96742 r96749 452 452 RTFLOAT64U r64ValOut; 453 453 } SSE_BINARY_R64_I64_TEST_T; 454 455 typedef struct SSE_COMPARE_EFL_R32_R32_TEST_T 456 { 457 uint32_t fMxcsrIn; 458 uint32_t fMxcsrOut; 459 uint32_t fEflIn; 460 uint32_t fEflOut; 461 RTFLOAT32U r32ValIn1; 462 RTFLOAT32U r32ValIn2; 463 } SSE_COMPARE_EFL_R32_R32_TEST_T; 464 465 typedef struct SSE_COMPARE_EFL_R64_R64_TEST_T 466 { 467 uint32_t fMxcsrIn; 468 uint32_t fMxcsrOut; 469 uint32_t fEflIn; 470 uint32_t fEflOut; 471 RTFLOAT64U r64ValIn1; 472 RTFLOAT64U r64ValIn2; 473 } SSE_COMPARE_EFL_R64_R64_TEST_T; 454 474 455 475 /** @} */ … … 889 909 TSTIEM_DECLARE_TEST_ARRAY_BIN(SseBinary, SSE_BINARY_R64_I64_TEST_T, cvtsi2sd_r64_i64 ); 890 910 911 TSTIEM_DECLARE_TEST_ARRAY_BIN(SseCompare, SSE_COMPARE_EFL_R32_R32_TEST_T, ucomiss_u128 ); 912 TSTIEM_DECLARE_TEST_ARRAY_BIN(SseCompare, SSE_COMPARE_EFL_R32_R32_TEST_T, vucomiss_u128 ); 913 TSTIEM_DECLARE_TEST_ARRAY_BIN(SseCompare, SSE_COMPARE_EFL_R32_R32_TEST_T, comiss_u128 ); 914 TSTIEM_DECLARE_TEST_ARRAY_BIN(SseCompare, SSE_COMPARE_EFL_R32_R32_TEST_T, vcomiss_u128 ); 915 916 TSTIEM_DECLARE_TEST_ARRAY_BIN(SseCompare, SSE_COMPARE_EFL_R64_R64_TEST_T, ucomisd_u128 ); 917 TSTIEM_DECLARE_TEST_ARRAY_BIN(SseCompare, SSE_COMPARE_EFL_R64_R64_TEST_T, vucomisd_u128 ); 918 TSTIEM_DECLARE_TEST_ARRAY_BIN(SseCompare, SSE_COMPARE_EFL_R64_R64_TEST_T, comisd_u128 ); 919 TSTIEM_DECLARE_TEST_ARRAY_BIN(SseCompare, SSE_COMPARE_EFL_R64_R64_TEST_T, vcomisd_u128 ); 920 891 921 RT_C_DECLS_END 892 922 -
trunk/src/VBox/VMM/testcase/tstIEMAImplDataSseBinary.S
r96742 r96749 119 119 IEM_TEST_DATA cvtsi2sd_r64_i32, "tstIEMAImplDataSseBinary-cvtsi2sd_r64_i32.bin" 120 120 IEM_TEST_DATA cvtsi2sd_r64_i64, "tstIEMAImplDataSseBinary-cvtsi2sd_r64_i64.bin" 121 122 IEM_TEST_DATA ucomiss_u128, "tstIEMAImplDataSseCompare-ucomiss_u128.bin" 123 IEM_TEST_DATA vucomiss_u128, "tstIEMAImplDataSseCompare-vucomiss_u128.bin" 124 IEM_TEST_DATA comiss_u128, "tstIEMAImplDataSseCompare-comiss_u128.bin" 125 IEM_TEST_DATA vcomiss_u128, "tstIEMAImplDataSseCompare-vcomiss_u128.bin" 126 127 IEM_TEST_DATA ucomisd_u128, "tstIEMAImplDataSseCompare-ucomisd_u128.bin" 128 IEM_TEST_DATA vucomisd_u128, "tstIEMAImplDataSseCompare-vucomisd_u128.bin" 129 IEM_TEST_DATA comisd_u128, "tstIEMAImplDataSseCompare-comisd_u128.bin" 130 IEM_TEST_DATA vcomisd_u128, "tstIEMAImplDataSseCompare-vcomisd_u128.bin" -
trunk/src/VBox/VMM/testcase/tstIEMAImplDataSseBinary.asm
r96742 r96749 117 117 IEM_TEST_DATA cvtsi2sd_r64_i32, "tstIEMAImplDataSseBinary-cvtsi2sd_r64_i32.bin" 118 118 IEM_TEST_DATA cvtsi2sd_r64_i64, "tstIEMAImplDataSseBinary-cvtsi2sd_r64_i64.bin" 119 120 IEM_TEST_DATA ucomiss_u128, "tstIEMAImplDataSseCompare-ucomiss_u128.bin" 121 IEM_TEST_DATA vucomiss_u128, "tstIEMAImplDataSseCompare-vucomiss_u128.bin" 122 IEM_TEST_DATA comiss_u128, "tstIEMAImplDataSseCompare-comiss_u128.bin" 123 IEM_TEST_DATA vcomiss_u128, "tstIEMAImplDataSseCompare-vcomiss_u128.bin" 124 125 IEM_TEST_DATA ucomisd_u128, "tstIEMAImplDataSseCompare-ucomisd_u128.bin" 126 IEM_TEST_DATA vucomisd_u128, "tstIEMAImplDataSseCompare-vucomisd_u128.bin" 127 IEM_TEST_DATA comisd_u128, "tstIEMAImplDataSseCompare-comisd_u128.bin" 128 IEM_TEST_DATA vcomisd_u128, "tstIEMAImplDataSseCompare-vcomisd_u128.bin"
Note:
See TracChangeset
for help on using the changeset viewer.