VirtualBox

Changeset 93893 in vbox for trunk/src/VBox/VMM/testcase


Ignore:
Timestamp:
Feb 22, 2022 9:27:58 PM (3 years ago)
Author:
vboxsync
Message:

VMM/IEM: Added tests for bswap C workers, discovering weird behaviour for the undocumented 16-bit variant on an AMD 3990x. bugref:9898

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/testcase/tstIEMAImpl.cpp

    r93888 r93893  
    15581558
    15591559/*
     1560 * BSWAP
     1561 */
     1562static void BswapTest(void)
     1563{
     1564    RTTestSub(g_hTest, "bswap_u16");
     1565    *g_pu32 = UINT32_C(0x12345678);
     1566    iemAImpl_bswap_u16(g_pu32);
     1567#if 0
     1568    RTTEST_CHECK_MSG(g_hTest, *g_pu32 == UINT32_C(0x12347856), (g_hTest, "*g_pu32=%#RX32\n", *g_pu32));
     1569#else
     1570    RTTEST_CHECK_MSG(g_hTest, *g_pu32 == UINT32_C(0x12340000), (g_hTest, "*g_pu32=%#RX32\n", *g_pu32));
     1571#endif
     1572    *g_pu32 = UINT32_C(0xffff1122);
     1573    iemAImpl_bswap_u16(g_pu32);
     1574#if 0
     1575    RTTEST_CHECK_MSG(g_hTest, *g_pu32 == UINT32_C(0xffff2211), (g_hTest, "*g_pu32=%#RX32\n", *g_pu32));
     1576#else
     1577    RTTEST_CHECK_MSG(g_hTest, *g_pu32 == UINT32_C(0xffff0000), (g_hTest, "*g_pu32=%#RX32\n", *g_pu32));
     1578#endif
     1579
     1580    RTTestSub(g_hTest, "bswap_u32");
     1581    *g_pu32 = UINT32_C(0x12345678);
     1582    iemAImpl_bswap_u32(g_pu32);
     1583    RTTEST_CHECK(g_hTest, *g_pu32 == UINT32_C(0x78563412));
     1584
     1585    RTTestSub(g_hTest, "bswap_u64");
     1586    *g_pu64 = UINT64_C(0x0123456789abcdef);
     1587    iemAImpl_bswap_u64(g_pu64);
     1588    RTTEST_CHECK(g_hTest, *g_pu64 == UINT64_C(0xefcdab8967452301));
     1589}
     1590
     1591
     1592/*
    15601593 * Random helpers.
    15611594 */
     
    16831716            ShiftTest();
    16841717            MulDivTest();
     1718            BswapTest();
    16851719        }
    16861720        return RTTestSummaryAndDestroy(g_hTest);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette