VirtualBox

Changeset 87221 in vbox


Ignore:
Timestamp:
Jan 12, 2021 8:06:02 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142177
Message:

tstRTInlineAsm: Extending testcase. bugref:9898

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp

    r87214 r87221  
    15601560
    15611561
     1562#define TEST_RET_OLD(a_Type, a_Fmt, a_pVar, a_Function, a_uVal, a_VarExpect) do { \
     1563        a_Type const uOldExpect = *(a_pVar); \
     1564        a_Type uOldRet = a_Function(a_pVar, a_uVal); \
     1565        if (RT_LIKELY( uOldRet == (uOldExpect) && *(a_pVar) == (a_VarExpect) )) { } \
     1566        else RTTestFailed(g_hTest, "%s, %d: FAILURE: %s(%s," a_Fmt ") -> " a_Fmt ", expected " a_Fmt "; %s=" a_Fmt ", expected " a_Fmt "\n", \
     1567                          __FUNCTION__, __LINE__, #a_Function, #a_pVar, a_uVal, uOldRet, uOldExpect, #a_pVar, *(a_pVar), (a_VarExpect)); \
     1568    } while (0)
     1569
     1570
     1571DECLINLINE(void) tstASMAtomicAddU32Worker(uint32_t *pu32)
     1572{
     1573    *pu32 = 10;
     1574    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAddU32, 1,                     11);
     1575    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAddU32, UINT32_C(0xfffffffe),  9);
     1576    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAddU32, UINT32_C(0xfffffff7),  0);
     1577    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAddU32, UINT32_C(0x7fffffff),  UINT32_C(0x7fffffff));
     1578    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAddU32, 1,                     UINT32_C(0x80000000));
     1579    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAddU32, 1,                     UINT32_C(0x80000001));
     1580    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAddU32, UINT32_C(0x7fffffff),  0);
     1581    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAddU32, 0,                     0);
     1582
     1583    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicSubU32, 0,                     0);
     1584    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicSubU32, 32,                    UINT32_C(0xffffffe0));
     1585    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicSubU32, UINT32_C(0x7fffffff),  UINT32_C(0x7fffffe1));
     1586    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicSubU32, UINT32_C(0x7fffffde),  UINT32_C(0x00000003));
     1587}
     1588
     1589
    15621590DECLINLINE(void) tstASMAtomicAddS32Worker(int32_t *pi32)
    15631591{
    1564     int32_t i32Rc;
    15651592    *pi32 = 10;
    1566 #define MYCHECK(op, rc, val) \
    1567     do { \
    1568         i32Rc = op; \
    1569         if (i32Rc != (rc)) \
    1570             RTTestFailed(g_hTest, "%s, %d: FAILURE: %s -> %d expected %d\n", __FUNCTION__, __LINE__, #op, i32Rc, rc); \
    1571         if (*pi32 != (val)) \
    1572             RTTestFailed(g_hTest, "%s, %d: FAILURE: %s => *pi32=%d expected %d\n", __FUNCTION__, __LINE__, #op, *pi32, val); \
     1593    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicAddS32, 1,               11);
     1594    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicAddS32, -2,              9);
     1595    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicAddS32, -9,              0);
     1596    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicAddS32, -0x7fffffff,     -0x7fffffff);
     1597    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicAddS32, 0,               -0x7fffffff);
     1598    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicAddS32, 0x7fffffff,      0);
     1599    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicAddS32, 0,               0);
     1600
     1601    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicSubS32, 0,               0);
     1602    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicSubS32, 1,               -1);
     1603    TEST_RET_OLD(int32_t, "%d", pi32, ASMAtomicSubS32, INT32_MIN,       INT32_MAX);
     1604}
     1605
     1606
     1607DECLINLINE(void) tstASMAtomicAddU64Worker(uint64_t volatile *pu64)
     1608{
     1609    *pu64 = 10;
     1610    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicAddU64, 1,               11);
     1611    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicAddU64, UINT64_C(0xfffffffffffffffe), UINT64_C(0x0000000000000009));
     1612    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicAddU64, UINT64_C(0xfffffffffffffff7), UINT64_C(0x0000000000000000));
     1613    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicAddU64, UINT64_C(0x7ffffffffffffff0), UINT64_C(0x7ffffffffffffff0));
     1614    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicAddU64, UINT64_C(0x7ffffffffffffff0), UINT64_C(0xffffffffffffffe0));
     1615    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicAddU64, UINT64_C(0x0000000000000000), UINT64_C(0xffffffffffffffe0));
     1616    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicAddU64, UINT64_C(0x000000000000001f), UINT64_C(0xffffffffffffffff));
     1617    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicAddU64, UINT64_C(0x0000000000000001), UINT64_C(0x0000000000000000));
     1618
     1619    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicSubU64, UINT64_C(0x0000000000000000), UINT64_C(0x0000000000000000));
     1620    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicSubU64, UINT64_C(0x0000000000000020), UINT64_C(0xffffffffffffffe0));
     1621    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicSubU64, UINT64_C(0x7fffffffffffffff), UINT64_C(0x7fffffffffffffe1));
     1622    TEST_RET_OLD(uint64_t, "%llx", pu64, ASMAtomicSubU64, UINT64_C(0x7fffffffffffffdd), UINT64_C(0x0000000000000004));
     1623}
     1624
     1625
     1626DECLINLINE(void) tstASMAtomicAddS64Worker(int64_t volatile *pi64)
     1627{
     1628    *pi64 = 10;
     1629    TEST_RET_OLD(int64_t, "%lld", pi64, ASMAtomicAddS64, 1,               11);
     1630    TEST_RET_OLD(int64_t, "%lld", pi64, ASMAtomicAddS64, -2,              9);
     1631    TEST_RET_OLD(int64_t, "%lld", pi64, ASMAtomicAddS64, -9,              0);
     1632    TEST_RET_OLD(int64_t, "%lld", pi64, ASMAtomicAddS64, -INT64_MAX,      -INT64_MAX);
     1633    TEST_RET_OLD(int64_t, "%lld", pi64, ASMAtomicAddS64, 0,               -INT64_MAX);
     1634    TEST_RET_OLD(int64_t, "%lld", pi64, ASMAtomicAddS64, -1,              INT64_MIN);
     1635    TEST_RET_OLD(int64_t, "%lld", pi64, ASMAtomicAddS64, INT64_MAX,       -1);
     1636    TEST_RET_OLD(int64_t, "%lld", pi64, ASMAtomicAddS64, 1,               0);
     1637    TEST_RET_OLD(int64_t, "%lld", pi64, ASMAtomicAddS64, 0,               0);
     1638
     1639    TEST_RET_OLD(int64_t, "%d",   pi64, ASMAtomicSubS64, 0,               0);
     1640    TEST_RET_OLD(int64_t, "%d",   pi64, ASMAtomicSubS64, 1,               -1);
     1641    TEST_RET_OLD(int64_t, "%d",   pi64, ASMAtomicSubS64, INT64_MIN,       INT64_MAX);
     1642}
     1643
     1644
     1645
     1646DECLINLINE(void) tstASMAtomicAddZWorker(size_t volatile *pcb)
     1647{
     1648    *pcb = 10;
     1649    TEST_RET_OLD(size_t, "%zx", pcb, ASMAtomicAddZ, 1,             11);
     1650    TEST_RET_OLD(size_t, "%zx", pcb, ASMAtomicAddZ, ~(size_t)1,     9);
     1651    TEST_RET_OLD(size_t, "%zx", pcb, ASMAtomicAddZ, ~(size_t)8,     0);
     1652
     1653    TEST_RET_OLD(size_t, "%zx", pcb, ASMAtomicSubZ, 0,              0);
     1654    TEST_RET_OLD(size_t, "%zx", pcb, ASMAtomicSubZ, 10,             ~(size_t)9);
     1655}
     1656
     1657static void tstASMAtomicAdd(void)
     1658{
     1659    DO_SIMPLE_TEST(ASMAtomicAddU32, uint32_t);
     1660    DO_SIMPLE_TEST(ASMAtomicAddS32, int32_t);
     1661    DO_SIMPLE_TEST(ASMAtomicAddU64, uint64_t);
     1662    DO_SIMPLE_TEST(ASMAtomicAddS64, int64_t);
     1663    DO_SIMPLE_TEST(ASMAtomicAddZ, size_t);
     1664}
     1665
     1666
     1667#define TEST_RET_NEW_NV(a_Type, a_Fmt, a_pVar, a_Function, a_VarExpect) do { \
     1668        a_Type uNewRet = a_Function(a_pVar); \
     1669        if (RT_LIKELY( uNewRet == (a_VarExpect) && *(a_pVar) == (a_VarExpect) )) { } \
     1670        else RTTestFailed(g_hTest, "%s, %d: FAILURE: %s(%s) -> " a_Fmt " and %s=" a_Fmt ", expected both " a_Fmt "\n", \
     1671                          __FUNCTION__, __LINE__, #a_Function, #a_pVar, uNewRet, #a_pVar, *(a_pVar), (a_VarExpect)); \
    15731672    } while (0)
    1574     MYCHECK(ASMAtomicAddS32(pi32, 1),               10,             11);
    1575     MYCHECK(ASMAtomicAddS32(pi32, -2),              11,             9);
    1576     MYCHECK(ASMAtomicAddS32(pi32, -9),              9,              0);
    1577     MYCHECK(ASMAtomicAddS32(pi32, -0x7fffffff),     0,              -0x7fffffff);
    1578     MYCHECK(ASMAtomicAddS32(pi32, 0),               -0x7fffffff,    -0x7fffffff);
    1579     MYCHECK(ASMAtomicAddS32(pi32, 0x7fffffff),      -0x7fffffff,    0);
    1580     MYCHECK(ASMAtomicAddS32(pi32, 0),               0,              0);
    1581 #undef MYCHECK
    1582 }
    1583 
    1584 
    1585 static void tstASMAtomicAddS32(void)
    1586 {
    1587     DO_SIMPLE_TEST(ASMAtomicAddS32, int32_t);
    1588 }
    1589 
    1590 
    1591 DECLINLINE(void) tstASMAtomicUoIncU32Worker(uint32_t volatile *pu32)
    1592 {
    1593     *pu32 = 0;
    1594 
    1595     CHECKOP(ASMAtomicUoIncU32(pu32), UINT32_C(1), "%#x", uint32_t);
    1596     CHECKVAL(*pu32, UINT32_C(1), "%#x");
    1597 
    1598     *pu32 = ~UINT32_C(0);
    1599     CHECKOP(ASMAtomicUoIncU32(pu32), 0, "%#x", uint32_t);
    1600     CHECKVAL(*pu32, 0, "%#x");
    1601 
    1602     *pu32 = UINT32_C(0x7fffffff);
    1603     CHECKOP(ASMAtomicUoIncU32(pu32), UINT32_C(0x80000000), "%#x", uint32_t);
    1604     CHECKVAL(*pu32, UINT32_C(0x80000000), "%#x");
    1605 }
    1606 
    1607 
    1608 static void tstASMAtomicUoIncU32(void)
    1609 {
    1610     DO_SIMPLE_TEST(ASMAtomicUoIncU32, uint32_t);
    1611 }
    1612 
    1613 
    1614 DECLINLINE(void) tstASMAtomicUoDecU32Worker(uint32_t volatile *pu32)
    1615 {
    1616     *pu32 = 0;
    1617 
    1618     CHECKOP(ASMAtomicUoDecU32(pu32), ~UINT32_C(0), "%#x", uint32_t);
    1619     CHECKVAL(*pu32, ~UINT32_C(0), "%#x");
    1620 
    1621     *pu32 = ~UINT32_C(0);
    1622     CHECKOP(ASMAtomicUoDecU32(pu32), UINT32_C(0xfffffffe), "%#x", uint32_t);
    1623     CHECKVAL(*pu32, UINT32_C(0xfffffffe), "%#x");
    1624 
    1625     *pu32 = UINT32_C(0x80000000);
    1626     CHECKOP(ASMAtomicUoDecU32(pu32), UINT32_C(0x7fffffff), "%#x", uint32_t);
    1627     CHECKVAL(*pu32, UINT32_C(0x7fffffff), "%#x");
    1628 }
    1629 
    1630 
    1631 static void tstASMAtomicUoDecU32(void)
    1632 {
    1633     DO_SIMPLE_TEST(ASMAtomicUoDecU32, uint32_t);
    1634 }
    1635 
    1636 
    1637 DECLINLINE(void) tstASMAtomicAddS64Worker(int64_t volatile *pi64)
    1638 {
    1639     int64_t i64Rc;
     1673
     1674
     1675DECLINLINE(void) tstASMAtomicDecIncU32Worker(uint32_t volatile *pu32)
     1676{
     1677    *pu32 = 3;
     1678    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicDecU32, 2);
     1679    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicDecU32, 1);
     1680    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicDecU32, 0);
     1681    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicDecU32, UINT32_MAX);
     1682    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicDecU32, UINT32_MAX - 1);
     1683    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicDecU32, UINT32_MAX - 2);
     1684    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicIncU32, UINT32_MAX - 1);
     1685    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicIncU32, UINT32_MAX);
     1686    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicIncU32, 0);
     1687    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicIncU32, 1);
     1688    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicIncU32, 2);
     1689    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicDecU32, 1);
     1690    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicIncU32, 2);
     1691    *pu32 = _1M;
     1692    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicDecU32, _1M - 1);
     1693    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicIncU32, _1M);
     1694    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicIncU32, _1M + 1);
     1695}
     1696
     1697DECLINLINE(void) tstASMAtomicUoDecIncU32Worker(uint32_t volatile *pu32)
     1698{
     1699    *pu32 = 3;
     1700    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoDecU32, 2);
     1701    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoDecU32, 1);
     1702    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoDecU32, 0);
     1703    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoDecU32, UINT32_MAX);
     1704    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoDecU32, UINT32_MAX - 1);
     1705    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoDecU32, UINT32_MAX - 2);
     1706    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoIncU32, UINT32_MAX - 1);
     1707    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoIncU32, UINT32_MAX);
     1708    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoIncU32, 0);
     1709    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoIncU32, 1);
     1710    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoIncU32, 2);
     1711    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoDecU32, 1);
     1712    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoIncU32, 2);
     1713    *pu32 = _1M;
     1714    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoDecU32, _1M - 1);
     1715    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoIncU32, _1M);
     1716    TEST_RET_NEW_NV(uint32_t, "%#x", pu32, ASMAtomicUoIncU32, _1M + 1);
     1717}
     1718
     1719
     1720DECLINLINE(void) tstASMAtomicDecIncS32Worker(int32_t volatile *pi32)
     1721{
     1722    *pi32 = 10;
     1723    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 9);
     1724    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 8);
     1725    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 7);
     1726    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 6);
     1727    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 5);
     1728    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 4);
     1729    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 3);
     1730    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 2);
     1731    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 1);
     1732    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 0);
     1733    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, -1);
     1734    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, -2);
     1735    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicIncS32, -1);
     1736    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicIncS32, 0);
     1737    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicIncS32, 1);
     1738    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicIncS32, 2);
     1739    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicIncS32, 3);
     1740    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 2);
     1741    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicIncS32, 3);
     1742    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, 2);
     1743    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicIncS32, 3);
     1744    *pi32 = INT32_MAX;
     1745    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicDecS32, INT32_MAX - 1);
     1746    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicIncS32, INT32_MAX);
     1747    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicIncS32, INT32_MIN);
     1748}
     1749
     1750
     1751#if 0
     1752DECLINLINE(void) tstASMAtomicUoDecIncS32Worker(int32_t volatile *pi32)
     1753{
     1754    *pi32 = 10;
     1755    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 9);
     1756    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 8);
     1757    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 7);
     1758    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 6);
     1759    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 5);
     1760    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 4);
     1761    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 3);
     1762    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 2);
     1763    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 1);
     1764    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 0);
     1765    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, -1);
     1766    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, -2);
     1767    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoIncS32, -1);
     1768    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoIncS32, 0);
     1769    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoIncS32, 1);
     1770    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoIncS32, 2);
     1771    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoIncS32, 3);
     1772    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 2);
     1773    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoIncS32, 3);
     1774    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, 2);
     1775    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoIncS32, 3);
     1776    *pi32 = INT32_MAX;
     1777    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoDecS32, INT32_MAX - 1);
     1778    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoIncS32, INT32_MAX);
     1779    TEST_RET_NEW_NV(int32_t, "%d", pi32, ASMAtomicUoIncS32, INT32_MIN);
     1780}
     1781#endif
     1782
     1783
     1784DECLINLINE(void) tstASMAtomicDecIncU64Worker(uint64_t volatile *pu64)
     1785{
     1786    *pu64 = 3;
     1787    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicDecU64, 2);
     1788    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicDecU64, 1);
     1789    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicDecU64, 0);
     1790    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicDecU64, UINT64_MAX);
     1791    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicDecU64, UINT64_MAX - 1);
     1792    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicDecU64, UINT64_MAX - 2);
     1793    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicIncU64, UINT64_MAX - 1);
     1794    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicIncU64, UINT64_MAX);
     1795    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicIncU64, 0);
     1796    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicIncU64, 1);
     1797    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicIncU64, 2);
     1798    *pu64 = _4G - 1;
     1799    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicDecU64, _4G - 2);
     1800    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicIncU64, _4G - 1);
     1801    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicIncU64, _4G);
     1802    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicIncU64, _4G + 1);
     1803    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicDecU64, _4G);
     1804}
     1805
     1806
     1807#if 0
     1808DECLINLINE(void) tstASMAtomicUoDecIncU64Worker(uint64_t volatile *pu64)
     1809{
     1810    *pu64 = 3;
     1811    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoDecU64, 2);
     1812    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoDecU64, 1);
     1813    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoDecU64, 0);
     1814    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoDecU64, UINT64_MAX);
     1815    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoDecU64, UINT64_MAX - 1);
     1816    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoDecU64, UINT64_MAX - 2);
     1817    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoIncU64, UINT64_MAX - 1);
     1818    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoIncU64, UINT64_MAX);
     1819    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoIncU64, 0);
     1820    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoIncU64, 1);
     1821    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoIncU64, 2);
     1822    *pu64 = _4G - 1;
     1823    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoDecU64, _4G - 2);
     1824    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoIncU64, _4G - 1);
     1825    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoIncU64, _4G);
     1826    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoIncU64, _4G + 1);
     1827    TEST_RET_NEW_NV(uint64_t, "%lld", pu64, ASMAtomicUoDecU64, _4G);
     1828}
     1829#endif
     1830
     1831
     1832DECLINLINE(void) tstASMAtomicDecIncS64Worker(int64_t volatile *pi64)
     1833{
    16401834    *pi64 = 10;
    1641 #define MYCHECK(op, rc, val) \
    1642     do { \
    1643         i64Rc = op; \
    1644         if (i64Rc != (rc)) \
    1645             RTTestFailed(g_hTest, "%s, %d: FAILURE: %s -> %llx expected %llx\n", __FUNCTION__, __LINE__, #op, i64Rc, (int64_t)rc); \
    1646         if (*pi64 != (val)) \
    1647             RTTestFailed(g_hTest, "%s, %d: FAILURE: %s => *pi64=%llx expected %llx\n", __FUNCTION__, __LINE__, #op, *pi64, (int64_t)(val)); \
     1835    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 9);
     1836    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 8);
     1837    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 7);
     1838    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 6);
     1839    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 5);
     1840    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 4);
     1841    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 3);
     1842    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 2);
     1843    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 1);
     1844    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 0);
     1845    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, -1);
     1846    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, -2);
     1847    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicIncS64, -1);
     1848    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicIncS64, 0);
     1849    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicIncS64, 1);
     1850    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicIncS64, 2);
     1851    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicIncS64, 3);
     1852    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 2);
     1853    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicIncS64, 3);
     1854    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, 2);
     1855    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicIncS64, 3);
     1856    *pi64 = INT64_MAX;
     1857    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicDecS64, INT64_MAX - 1);
     1858}
     1859
     1860
     1861#if 0
     1862DECLINLINE(void) tstASMAtomicUoDecIncS64Worker(int64_t volatile *pi64)
     1863{
     1864    *pi64 = 10;
     1865    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 9);
     1866    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 8);
     1867    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 7);
     1868    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 6);
     1869    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 5);
     1870    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 4);
     1871    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 3);
     1872    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 2);
     1873    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 1);
     1874    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 0);
     1875    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, -1);
     1876    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, -2);
     1877    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoIncS64, -1);
     1878    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoIncS64, 0);
     1879    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoIncS64, 1);
     1880    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoIncS64, 2);
     1881    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoIncS64, 3);
     1882    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 2);
     1883    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoIncS64, 3);
     1884    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, 2);
     1885    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoIncS64, 3);
     1886    *pi64 = INT64_MAX;
     1887    TEST_RET_NEW_NV(int64_t, "%lld", pi64, ASMAtomicUoDecS64, INT64_MAX - 1);
     1888}
     1889#endif
     1890
     1891
     1892DECLINLINE(void) tstASMAtomicDecIncZWorker(size_t volatile *pcb)
     1893{
     1894    size_t const uBaseVal = ~(size_t)0 >> 7;
     1895    *pcb = uBaseVal;
     1896    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicDecZ, uBaseVal - 1);
     1897    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicDecZ, uBaseVal - 2);
     1898    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicDecZ, uBaseVal - 3);
     1899    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicIncZ, uBaseVal - 2);
     1900    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicIncZ, uBaseVal - 1);
     1901    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicIncZ, uBaseVal);
     1902    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicIncZ, uBaseVal + 1);
     1903    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicDecZ, uBaseVal);
     1904    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicDecZ, uBaseVal - 1);
     1905    TEST_RET_NEW_NV(size_t, "%zx", pcb, ASMAtomicIncZ, uBaseVal);
     1906}
     1907
     1908
     1909static void tstASMAtomicDecInc(void)
     1910{
     1911    DO_SIMPLE_TEST(ASMAtomicDecIncU32, uint32_t);
     1912    DO_SIMPLE_TEST(ASMAtomicUoDecIncU32, uint32_t);
     1913    DO_SIMPLE_TEST(ASMAtomicDecIncS32, int32_t);
     1914    //DO_SIMPLE_TEST(ASMAtomicUoDecIncS32, int32_t);
     1915    DO_SIMPLE_TEST(ASMAtomicDecIncU64, uint64_t);
     1916    //DO_SIMPLE_TEST(ASMAtomicUoDecIncU64, uint64_t);
     1917    DO_SIMPLE_TEST(ASMAtomicDecIncS64, int64_t);
     1918    //DO_SIMPLE_TEST(ASMAtomicUoDecIncS64, int64_t);
     1919    DO_SIMPLE_TEST(ASMAtomicDecIncZ, size_t);
     1920}
     1921
     1922
     1923#define TEST_RET_VOID(a_Type, a_Fmt, a_pVar, a_Function, a_uVal, a_VarExpect) do { \
     1924        a_Function(a_pVar, a_uVal); \
     1925        if (RT_LIKELY( *(a_pVar) == (a_VarExpect) )) { } \
     1926        else RTTestFailed(g_hTest, "%s, %d: FAILURE: %s(%s, " a_Fmt ") -> %s=" a_Fmt ", expected " a_Fmt "\n", \
     1927                          __FUNCTION__, __LINE__, #a_Function, #a_pVar, a_uVal, #a_pVar, *(a_pVar), (a_VarExpect)); \
    16481928    } while (0)
    1649     MYCHECK(ASMAtomicAddS64(pi64, 1),               10,             11);
    1650     MYCHECK(ASMAtomicAddS64(pi64, -2),              11,             9);
    1651     MYCHECK(ASMAtomicAddS64(pi64, -9),              9,              0);
    1652     MYCHECK(ASMAtomicAddS64(pi64, -INT64_MAX),      0,              -INT64_MAX);
    1653     MYCHECK(ASMAtomicAddS64(pi64, 0),               -INT64_MAX,     -INT64_MAX);
    1654     MYCHECK(ASMAtomicAddS64(pi64, -1),              -INT64_MAX,     INT64_MIN);
    1655     MYCHECK(ASMAtomicAddS64(pi64, INT64_MAX),       INT64_MIN,      -1);
    1656     MYCHECK(ASMAtomicAddS64(pi64, 1),               -1,             0);
    1657     MYCHECK(ASMAtomicAddS64(pi64, 0),               0,              0);
    1658 #undef MYCHECK
    1659 }
    1660 
    1661 
    1662 static void tstASMAtomicAddS64(void)
    1663 {
    1664     DO_SIMPLE_TEST(ASMAtomicAddS64, int64_t);
    1665 }
    1666 
    1667 
    1668 DECLINLINE(void) tstASMAtomicDecIncS32Worker(int32_t volatile *pi32)
    1669 {
    1670     int32_t i32Rc;
    1671     *pi32 = 10;
    1672 #define MYCHECK(op, rc) \
    1673     do { \
    1674         i32Rc = op; \
    1675         if (i32Rc != (rc)) \
    1676             RTTestFailed(g_hTest, "%s, %d: FAILURE: %s -> %d expected %d\n", __FUNCTION__, __LINE__, #op, i32Rc, rc); \
    1677         if (*pi32 != (rc)) \
    1678             RTTestFailed(g_hTest, "%s, %d: FAILURE: %s => *pi32=%d expected %d\n", __FUNCTION__, __LINE__, #op, *pi32, rc); \
     1929
     1930#define TEST_RET_NEW(a_Type, a_Fmt, a_pVar, a_Function, a_uVal, a_VarExpect) do { \
     1931        a_Type uNewRet = a_Function(a_pVar, a_uVal); \
     1932        if (RT_LIKELY( uNewRet == (a_VarExpect) && *(a_pVar) == (a_VarExpect) )) { } \
     1933        else RTTestFailed(g_hTest, "%s, %d: FAILURE: %s(%s, " a_Fmt ") -> " a_Fmt " and %s=" a_Fmt ", expected both " a_Fmt "\n", \
     1934                          __FUNCTION__, __LINE__, #a_Function, #a_pVar, a_uVal, uNewRet, #a_pVar, *(a_pVar), (a_VarExpect)); \
    16791935    } while (0)
    1680     MYCHECK(ASMAtomicDecS32(pi32), 9);
    1681     MYCHECK(ASMAtomicDecS32(pi32), 8);
    1682     MYCHECK(ASMAtomicDecS32(pi32), 7);
    1683     MYCHECK(ASMAtomicDecS32(pi32), 6);
    1684     MYCHECK(ASMAtomicDecS32(pi32), 5);
    1685     MYCHECK(ASMAtomicDecS32(pi32), 4);
    1686     MYCHECK(ASMAtomicDecS32(pi32), 3);
    1687     MYCHECK(ASMAtomicDecS32(pi32), 2);
    1688     MYCHECK(ASMAtomicDecS32(pi32), 1);
    1689     MYCHECK(ASMAtomicDecS32(pi32), 0);
    1690     MYCHECK(ASMAtomicDecS32(pi32), -1);
    1691     MYCHECK(ASMAtomicDecS32(pi32), -2);
    1692     MYCHECK(ASMAtomicIncS32(pi32), -1);
    1693     MYCHECK(ASMAtomicIncS32(pi32), 0);
    1694     MYCHECK(ASMAtomicIncS32(pi32), 1);
    1695     MYCHECK(ASMAtomicIncS32(pi32), 2);
    1696     MYCHECK(ASMAtomicIncS32(pi32), 3);
    1697     MYCHECK(ASMAtomicDecS32(pi32), 2);
    1698     MYCHECK(ASMAtomicIncS32(pi32), 3);
    1699     MYCHECK(ASMAtomicDecS32(pi32), 2);
    1700     MYCHECK(ASMAtomicIncS32(pi32), 3);
    1701 #undef MYCHECK
    1702 }
    1703 
    1704 
    1705 static void tstASMAtomicDecIncS32(void)
    1706 {
    1707     DO_SIMPLE_TEST(ASMAtomicDecIncS32, int32_t);
    1708 }
    1709 
    1710 
    1711 DECLINLINE(void) tstASMAtomicDecIncS64Worker(int64_t volatile *pi64)
    1712 {
    1713     int64_t i64Rc;
    1714     *pi64 = 10;
    1715 #define MYCHECK(op, rc) \
    1716     do { \
    1717         i64Rc = op; \
    1718         if (i64Rc != (rc)) \
    1719             RTTestFailed(g_hTest, "%s, %d: FAILURE: %s -> %lld expected %lld\n", __FUNCTION__, __LINE__, #op, i64Rc, rc); \
    1720         if (*pi64 != (rc)) \
    1721             RTTestFailed(g_hTest, "%s, %d: FAILURE: %s => *pi64=%lld expected %lld\n", __FUNCTION__, __LINE__, #op, *pi64, rc); \
    1722     } while (0)
    1723     MYCHECK(ASMAtomicDecS64(pi64), 9);
    1724     MYCHECK(ASMAtomicDecS64(pi64), 8);
    1725     MYCHECK(ASMAtomicDecS64(pi64), 7);
    1726     MYCHECK(ASMAtomicDecS64(pi64), 6);
    1727     MYCHECK(ASMAtomicDecS64(pi64), 5);
    1728     MYCHECK(ASMAtomicDecS64(pi64), 4);
    1729     MYCHECK(ASMAtomicDecS64(pi64), 3);
    1730     MYCHECK(ASMAtomicDecS64(pi64), 2);
    1731     MYCHECK(ASMAtomicDecS64(pi64), 1);
    1732     MYCHECK(ASMAtomicDecS64(pi64), 0);
    1733     MYCHECK(ASMAtomicDecS64(pi64), -1);
    1734     MYCHECK(ASMAtomicDecS64(pi64), -2);
    1735     MYCHECK(ASMAtomicIncS64(pi64), -1);
    1736     MYCHECK(ASMAtomicIncS64(pi64), 0);
    1737     MYCHECK(ASMAtomicIncS64(pi64), 1);
    1738     MYCHECK(ASMAtomicIncS64(pi64), 2);
    1739     MYCHECK(ASMAtomicIncS64(pi64), 3);
    1740     MYCHECK(ASMAtomicDecS64(pi64), 2);
    1741     MYCHECK(ASMAtomicIncS64(pi64), 3);
    1742     MYCHECK(ASMAtomicDecS64(pi64), 2);
    1743     MYCHECK(ASMAtomicIncS64(pi64), 3);
    1744 #undef MYCHECK
    1745 }
    1746 
    1747 
    1748 static void tstASMAtomicDecIncS64(void)
    1749 {
    1750     DO_SIMPLE_TEST(ASMAtomicDecIncS64, int64_t);
    1751 }
    1752 
    1753 
    1754 DECLINLINE(void) tstASMAtomicAndOrU32Worker(uint32_t volatile *pu32)
     1936
     1937
     1938DECLINLINE(void) tstASMAtomicAndOrXorU32Worker(uint32_t volatile *pu32)
    17551939{
    17561940    *pu32 = UINT32_C(0xffffffff);
    1757 
    1758     ASMAtomicOrU32(pu32, UINT32_C(0xffffffff));
    1759     CHECKVAL(*pu32, UINT32_C(0xffffffff), "%x");
    1760 
    1761     ASMAtomicAndU32(pu32, UINT32_C(0xffffffff));
    1762     CHECKVAL(*pu32, UINT32_C(0xffffffff), "%x");
    1763 
    1764     ASMAtomicAndU32(pu32, UINT32_C(0x8f8f8f8f));
    1765     CHECKVAL(*pu32, UINT32_C(0x8f8f8f8f), "%x");
    1766 
    1767     ASMAtomicOrU32(pu32, UINT32_C(0x70707070));
    1768     CHECKVAL(*pu32, UINT32_C(0xffffffff), "%x");
    1769 
    1770     ASMAtomicAndU32(pu32, UINT32_C(1));
    1771     CHECKVAL(*pu32, UINT32_C(1), "%x");
    1772 
    1773     ASMAtomicOrU32(pu32, UINT32_C(0x80000000));
    1774     CHECKVAL(*pu32, UINT32_C(0x80000001), "%x");
    1775 
    1776     ASMAtomicAndU32(pu32, UINT32_C(0x80000000));
    1777     CHECKVAL(*pu32, UINT32_C(0x80000000), "%x");
    1778 
    1779     ASMAtomicAndU32(pu32, UINT32_C(0));
    1780     CHECKVAL(*pu32, UINT32_C(0), "%x");
    1781 
    1782     ASMAtomicOrU32(pu32, UINT32_C(0x42424242));
    1783     CHECKVAL(*pu32, UINT32_C(0x42424242), "%x");
    1784 }
    1785 
    1786 
    1787 static void tstASMAtomicAndOrU32(void)
    1788 {
    1789     DO_SIMPLE_TEST(ASMAtomicAndOrU32, uint32_t);
    1790 }
    1791 
    1792 
    1793 DECLINLINE(void) tstASMAtomicAndOrU64Worker(uint64_t volatile *pu64)
     1941    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicOrU32,  UINT32_C(0xffffffff),  UINT32_C(0xffffffff));
     1942    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicAndU32, UINT32_C(0xffffffff),  UINT32_C(0xffffffff));
     1943    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicAndU32, UINT32_C(0x8f8f8f8f),  UINT32_C(0x8f8f8f8f));
     1944    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicOrU32,  UINT32_C(0x70707070),  UINT32_C(0xffffffff));
     1945    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicAndU32, UINT32_C(1),           UINT32_C(1));
     1946    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicOrU32,  UINT32_C(0x80000000),  UINT32_C(0x80000001));
     1947    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicAndU32, UINT32_C(0x80000000),  UINT32_C(0x80000000));
     1948    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicAndU32, UINT32_C(0),           UINT32_C(0));
     1949    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicOrU32,  UINT32_C(0x42424242),  UINT32_C(0x42424242));
     1950    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicAndU32, UINT32_C(0x00ff0f00),  UINT32_C(0x00420200));
     1951    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicXorU32, UINT32_C(0x42004042),  UINT32_C(0x42424242));
     1952    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicXorU32, UINT32_C(0xff024200),  UINT32_C(0xbd400042));
     1953    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicXorU32, UINT32_C(0x00000000),  UINT32_C(0xbd400042));
     1954}
     1955
     1956
     1957DECLINLINE(void) tstASMAtomicUoAndOrXorU32Worker(uint32_t volatile *pu32)
     1958{
     1959    *pu32 = UINT32_C(0xffffffff);
     1960    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoOrU32,  UINT32_C(0xffffffff),  UINT32_C(0xffffffff));
     1961    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoAndU32, UINT32_C(0xffffffff),  UINT32_C(0xffffffff));
     1962    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoAndU32, UINT32_C(0x8f8f8f8f),  UINT32_C(0x8f8f8f8f));
     1963    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoOrU32,  UINT32_C(0x70707070),  UINT32_C(0xffffffff));
     1964    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoAndU32, UINT32_C(1),           UINT32_C(1));
     1965    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoOrU32,  UINT32_C(0x80000000),  UINT32_C(0x80000001));
     1966    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoAndU32, UINT32_C(0x80000000),  UINT32_C(0x80000000));
     1967    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoAndU32, UINT32_C(0),           UINT32_C(0));
     1968    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoOrU32,  UINT32_C(0x42424242),  UINT32_C(0x42424242));
     1969    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoAndU32, UINT32_C(0x00ff0f00),  UINT32_C(0x00420200));
     1970    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoXorU32, UINT32_C(0x42004042),  UINT32_C(0x42424242));
     1971    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoXorU32, UINT32_C(0xff024200),  UINT32_C(0xbd400042));
     1972    TEST_RET_VOID(uint32_t, "%#x", pu32, ASMAtomicUoXorU32, UINT32_C(0x00000000),  UINT32_C(0xbd400042));
     1973}
     1974
     1975
     1976DECLINLINE(void) tstASMAtomicAndOrXorExU32Worker(uint32_t volatile *pu32)
     1977{
     1978    *pu32 = UINT32_C(0xffffffff);
     1979    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicOrExU32,  UINT32_C(0xffffffff),  UINT32_C(0xffffffff));
     1980    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAndExU32, UINT32_C(0xffffffff),  UINT32_C(0xffffffff));
     1981    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAndExU32, UINT32_C(0x8f8f8f8f),  UINT32_C(0x8f8f8f8f));
     1982    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicOrExU32,  UINT32_C(0x70707070),  UINT32_C(0xffffffff));
     1983    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAndExU32, UINT32_C(1),           UINT32_C(1));
     1984    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicOrExU32,  UINT32_C(0x80000000),  UINT32_C(0x80000001));
     1985    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAndExU32, UINT32_C(0x80000000),  UINT32_C(0x80000000));
     1986    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAndExU32, UINT32_C(0),           UINT32_C(0));
     1987    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicOrExU32,  UINT32_C(0x42424242),  UINT32_C(0x42424242));
     1988    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicAndExU32, UINT32_C(0x00ff0f00),  UINT32_C(0x00420200));
     1989    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicXorExU32, UINT32_C(0x42004042),  UINT32_C(0x42424242));
     1990    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicXorExU32, UINT32_C(0xff024200),  UINT32_C(0xbd400042));
     1991    TEST_RET_OLD(uint32_t, "%#x", pu32, ASMAtomicXorExU32, UINT32_C(0x00000000),  UINT32_C(0xbd400042));
     1992}
     1993
     1994
     1995DECLINLINE(void) tstASMAtomicAndOrXorU64Worker(uint64_t volatile *pu64)
    17941996{
    17951997    *pu64 = UINT64_C(0xffffffff);
    1796 
    1797     ASMAtomicOrU64(pu64, UINT64_C(0xffffffff));
    1798     CHECKVAL(*pu64, UINT64_C(0xffffffff), "%x");
    1799 
    1800     ASMAtomicAndU64(pu64, UINT64_C(0xffffffff));
    1801     CHECKVAL(*pu64, UINT64_C(0xffffffff), "%x");
    1802 
    1803     ASMAtomicAndU64(pu64, UINT64_C(0x8f8f8f8f));
    1804     CHECKVAL(*pu64, UINT64_C(0x8f8f8f8f), "%x");
    1805 
    1806     ASMAtomicOrU64(pu64, UINT64_C(0x70707070));
    1807     CHECKVAL(*pu64, UINT64_C(0xffffffff), "%x");
    1808 
    1809     ASMAtomicAndU64(pu64, UINT64_C(1));
    1810     CHECKVAL(*pu64, UINT64_C(1), "%x");
    1811 
    1812     ASMAtomicOrU64(pu64, UINT64_C(0x80000000));
    1813     CHECKVAL(*pu64, UINT64_C(0x80000001), "%x");
    1814 
    1815     ASMAtomicAndU64(pu64, UINT64_C(0x80000000));
    1816     CHECKVAL(*pu64, UINT64_C(0x80000000), "%x");
    1817 
    1818     ASMAtomicAndU64(pu64, UINT64_C(0));
    1819     CHECKVAL(*pu64, UINT64_C(0), "%x");
    1820 
    1821     ASMAtomicOrU64(pu64, UINT64_C(0x42424242));
    1822     CHECKVAL(*pu64, UINT64_C(0x42424242), "%x");
    1823 
    1824     // Same as above, but now 64-bit wide.
    1825     ASMAtomicAndU64(pu64, UINT64_C(0));
    1826     CHECKVAL(*pu64, UINT64_C(0), "%x");
    1827 
    1828     ASMAtomicOrU64(pu64, UINT64_C(0xffffffffffffffff));
    1829     CHECKVAL(*pu64, UINT64_C(0xffffffffffffffff), "%x");
    1830 
    1831     ASMAtomicAndU64(pu64, UINT64_C(0xffffffffffffffff));
    1832     CHECKVAL(*pu64, UINT64_C(0xffffffffffffffff), "%x");
    1833 
    1834     ASMAtomicAndU64(pu64, UINT64_C(0x8f8f8f8f8f8f8f8f));
    1835     CHECKVAL(*pu64, UINT64_C(0x8f8f8f8f8f8f8f8f), "%x");
    1836 
    1837     ASMAtomicOrU64(pu64, UINT64_C(0x7070707070707070));
    1838     CHECKVAL(*pu64, UINT64_C(0xffffffffffffffff), "%x");
    1839 
    1840     ASMAtomicAndU64(pu64, UINT64_C(1));
    1841     CHECKVAL(*pu64, UINT64_C(1), "%x");
    1842 
    1843     ASMAtomicOrU64(pu64, UINT64_C(0x8000000000000000));
    1844     CHECKVAL(*pu64, UINT64_C(0x8000000000000001), "%x");
    1845 
    1846     ASMAtomicAndU64(pu64, UINT64_C(0x8000000000000000));
    1847     CHECKVAL(*pu64, UINT64_C(0x8000000000000000), "%x");
    1848 
    1849     ASMAtomicAndU64(pu64, UINT64_C(0));
    1850     CHECKVAL(*pu64, UINT64_C(0), "%x");
    1851 
    1852     ASMAtomicOrU64(pu64, UINT64_C(0x4242424242424242));
    1853     CHECKVAL(*pu64, UINT64_C(0x4242424242424242), "%x");
    1854 }
    1855 
    1856 
    1857 static void tstASMAtomicAndOrU64(void)
    1858 {
    1859     DO_SIMPLE_TEST(ASMAtomicAndOrU64, uint64_t);
    1860 }
    1861 
    1862 
    1863 DECLINLINE(void) tstASMAtomicUoAndOrU32Worker(uint32_t volatile *pu32)
    1864 {
    1865     *pu32 = UINT32_C(0xffffffff);
    1866 
    1867     ASMAtomicUoOrU32(pu32, UINT32_C(0xffffffff));
    1868     CHECKVAL(*pu32, UINT32_C(0xffffffff), "%#x");
    1869 
    1870     ASMAtomicUoAndU32(pu32, UINT32_C(0xffffffff));
    1871     CHECKVAL(*pu32, UINT32_C(0xffffffff), "%#x");
    1872 
    1873     ASMAtomicUoAndU32(pu32, UINT32_C(0x8f8f8f8f));
    1874     CHECKVAL(*pu32, UINT32_C(0x8f8f8f8f), "%#x");
    1875 
    1876     ASMAtomicUoOrU32(pu32, UINT32_C(0x70707070));
    1877     CHECKVAL(*pu32, UINT32_C(0xffffffff), "%#x");
    1878 
    1879     ASMAtomicUoAndU32(pu32, UINT32_C(1));
    1880     CHECKVAL(*pu32, UINT32_C(1), "%#x");
    1881 
    1882     ASMAtomicUoOrU32(pu32, UINT32_C(0x80000000));
    1883     CHECKVAL(*pu32, UINT32_C(0x80000001), "%#x");
    1884 
    1885     ASMAtomicUoAndU32(pu32, UINT32_C(0x80000000));
    1886     CHECKVAL(*pu32, UINT32_C(0x80000000), "%#x");
    1887 
    1888     ASMAtomicUoAndU32(pu32, UINT32_C(0));
    1889     CHECKVAL(*pu32, UINT32_C(0), "%#x");
    1890 
    1891     ASMAtomicUoOrU32(pu32, UINT32_C(0x42424242));
    1892     CHECKVAL(*pu32, UINT32_C(0x42424242), "%#x");
    1893 }
    1894 
    1895 
    1896 static void tstASMAtomicUoAndOrU32(void)
    1897 {
    1898     DO_SIMPLE_TEST(ASMAtomicUoAndOrU32, uint32_t);
     1998    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicOrU64,  UINT64_C(0xffffffff),  UINT64_C(0xffffffff));
     1999    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0xffffffff),  UINT64_C(0xffffffff));
     2000    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0x8f8f8f8f),  UINT64_C(0x8f8f8f8f));
     2001    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicOrU64,  UINT64_C(0x70707070),  UINT64_C(0xffffffff));
     2002    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(1),           UINT64_C(1));
     2003    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicOrU64,  UINT64_C(0x80000000),  UINT64_C(0x80000001));
     2004    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0x80000000),  UINT64_C(0x80000000));
     2005    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0),           UINT64_C(0));
     2006    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicOrU64,  UINT64_C(0x42424242),  UINT64_C(0x42424242));
     2007    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0x00ff0f00),  UINT64_C(0x00420200));
     2008    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicXorU64, UINT64_C(0x42004042),  UINT64_C(0x42424242));
     2009    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicXorU64, UINT64_C(0xff024200),  UINT64_C(0xbd400042));
     2010    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicXorU64, UINT64_C(0x00000000),  UINT64_C(0xbd400042));
     2011
     2012    /* full 64-bit */
     2013    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0x0000000000000000),  UINT64_C(0x0000000000000000));
     2014    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicOrU64,  UINT64_C(0xffffffffffffffff),  UINT64_C(0xffffffffffffffff));
     2015    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0xffffffffffffffff),  UINT64_C(0xffffffffffffffff));
     2016    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0x8f8f8f8f8f8f8f8f),  UINT64_C(0x8f8f8f8f8f8f8f8f));
     2017    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicOrU64,  UINT64_C(0x7070707070707070),  UINT64_C(0xffffffffffffffff));
     2018    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0x0000000000000001),  UINT64_C(0x0000000000000001));
     2019    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicOrU64,  UINT64_C(0x8000000000000000),  UINT64_C(0x8000000000000001));
     2020    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0x8000000000000000),  UINT64_C(0x8000000000000000));
     2021    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0),                   UINT64_C(0));
     2022    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicOrU64,  UINT64_C(0x4242424242424242),  UINT64_C(0x4242424242424242));
     2023    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicAndU64, UINT64_C(0x00ff0f00ff0f0000),  UINT64_C(0x0042020042020000));
     2024    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicXorU64, UINT64_C(0x4200404242040000),  UINT64_C(0x4242424242420000));
     2025    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicXorU64, UINT64_C(0xff02420000ff2127),  UINT64_C(0xbd40004242bd2127));
     2026    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicXorU64, UINT64_C(0x0000000000000000),  UINT64_C(0xbd40004242bd2127));
     2027}
     2028
     2029
     2030DECLINLINE(void) tstASMAtomicUoAndOrXorU64Worker(uint64_t volatile *pu64)
     2031{
     2032    *pu64 = UINT64_C(0xffffffff);
     2033    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoOrU64,  UINT64_C(0xffffffff),  UINT64_C(0xffffffff));
     2034    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0xffffffff),  UINT64_C(0xffffffff));
     2035    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0x8f8f8f8f),  UINT64_C(0x8f8f8f8f));
     2036    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoOrU64,  UINT64_C(0x70707070),  UINT64_C(0xffffffff));
     2037    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(1),           UINT64_C(1));
     2038    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoOrU64,  UINT64_C(0x80000000),  UINT64_C(0x80000001));
     2039    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0x80000000),  UINT64_C(0x80000000));
     2040    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0),           UINT64_C(0));
     2041    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoOrU64,  UINT64_C(0x42424242),  UINT64_C(0x42424242));
     2042    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0x00ff0f00),  UINT64_C(0x00420200));
     2043    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoXorU64, UINT64_C(0x42004042),  UINT64_C(0x42424242));
     2044    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoXorU64, UINT64_C(0xff024200),  UINT64_C(0xbd400042));
     2045    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoXorU64, UINT64_C(0x00000000),  UINT64_C(0xbd400042));
     2046
     2047    /* full 64-bit */
     2048    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0x0000000000000000),  UINT64_C(0x0000000000000000));
     2049    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoOrU64,  UINT64_C(0xffffffffffffffff),  UINT64_C(0xffffffffffffffff));
     2050    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0xffffffffffffffff),  UINT64_C(0xffffffffffffffff));
     2051    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0x8f8f8f8f8f8f8f8f),  UINT64_C(0x8f8f8f8f8f8f8f8f));
     2052    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoOrU64,  UINT64_C(0x7070707070707070),  UINT64_C(0xffffffffffffffff));
     2053    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0x0000000000000001),  UINT64_C(0x0000000000000001));
     2054    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoOrU64,  UINT64_C(0x8000000000000000),  UINT64_C(0x8000000000000001));
     2055    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0x8000000000000000),  UINT64_C(0x8000000000000000));
     2056    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0),                   UINT64_C(0));
     2057    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoOrU64,  UINT64_C(0x4242424242424242),  UINT64_C(0x4242424242424242));
     2058    TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoAndU64, UINT64_C(0x00ff0f00ff0f0000),  UINT64_C(0x0042020042020000));
     2059    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoXorU64, UINT64_C(0x4200404242040000),  UINT64_C(0x4242424242420000));
     2060    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoXorU64, UINT64_C(0xff02420000ff2127),  UINT64_C(0xbd40004242bd2127));
     2061    //TEST_RET_VOID(uint64_t, "%#llx", pu64, ASMAtomicUoXorU64, UINT64_C(0x0000000000000000),  UINT64_C(0xbd40004242bd2127));
     2062}
     2063
     2064
     2065#if 0
     2066DECLINLINE(void) tstASMAtomicAndOrXorExU64Worker(uint64_t volatile *pu64)
     2067{
     2068    *pu64 = UINT64_C(0xffffffff);
     2069    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicOrExU64,  UINT64_C(0xffffffff),  UINT64_C(0xffffffff));
     2070    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0xffffffff),  UINT64_C(0xffffffff));
     2071    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0x8f8f8f8f),  UINT64_C(0x8f8f8f8f));
     2072    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicOrExU64,  UINT64_C(0x70707070),  UINT64_C(0xffffffff));
     2073    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(1),           UINT64_C(1));
     2074    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicOrExU64,  UINT64_C(0x80000000),  UINT64_C(0x80000001));
     2075    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0x80000000),  UINT64_C(0x80000000));
     2076    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0),           UINT64_C(0));
     2077    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicOrExU64,  UINT64_C(0x42424242),  UINT64_C(0x42424242));
     2078    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0x00ff0f00),  UINT64_C(0x00420200));
     2079    //TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicXorExU64, UINT64_C(0x42004042),  UINT64_C(0x42424242));
     2080    //TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicXorExU64, UINT64_C(0xff024200),  UINT64_C(0xbd400042));
     2081    //TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicXorExU64, UINT64_C(0x00000000),  UINT64_C(0xbd400042));
     2082
     2083    /* full 64-bit */
     2084    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0x0000000000000000),  UINT64_C(0x0000000000000000));
     2085    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicOrExU64,  UINT64_C(0xffffffffffffffff),  UINT64_C(0xffffffffffffffff));
     2086    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0xffffffffffffffff),  UINT64_C(0xffffffffffffffff));
     2087    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0x8f8f8f8f8f8f8f8f),  UINT64_C(0x8f8f8f8f8f8f8f8f));
     2088    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicOrExU64,  UINT64_C(0x7070707070707070),  UINT64_C(0xffffffffffffffff));
     2089    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0x0000000000000001),  UINT64_C(0x0000000000000001));
     2090    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicOrExU64,  UINT64_C(0x8000000000000000),  UINT64_C(0x8000000000000001));
     2091    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0x8000000000000000),  UINT64_C(0x8000000000000000));
     2092    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0),                   UINT64_C(0));
     2093    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicOrExU64,  UINT64_C(0x4242424242424242),  UINT64_C(0x4242424242424242));
     2094    TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicAndExU64, UINT64_C(0x00ff0f00ff0f0000),  UINT64_C(0x0042020042020000));
     2095    //TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicXorExU64, UINT64_C(0x4200404242040000),  UINT64_C(0x4242424242420000));
     2096    //TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicXorExU64, UINT64_C(0xff02420000ff2127),  UINT64_C(0xbd40004242bd2127));
     2097    //TEST_RET_OLD(uint64_t, "%#llx", pu64, ASMAtomicXorExU64, UINT64_C(0x0000000000000000),  UINT64_C(0xbd40004242bd2127));
     2098}
     2099#endif
     2100
     2101
     2102static void tstASMAtomicAndOrXor(void)
     2103{
     2104    DO_SIMPLE_TEST(ASMAtomicAndOrXorU32, uint32_t);
     2105    DO_SIMPLE_TEST(ASMAtomicUoAndOrXorU32, uint32_t);
     2106    DO_SIMPLE_TEST(ASMAtomicAndOrXorExU32, uint32_t);
     2107    DO_SIMPLE_TEST(ASMAtomicAndOrXorU64, uint64_t);
     2108    DO_SIMPLE_TEST(ASMAtomicUoAndOrXorU64, uint64_t);
     2109    //DO_SIMPLE_TEST(ASMAtomicAndOrXorExU64, uint64_t);
    18992110}
    19002111
     
    25492760    tstASMAtomicCmpXchgEx();
    25502761
    2551     tstASMAtomicAddS32();
    2552     tstASMAtomicAddS64();
    2553     tstASMAtomicDecIncS32();
    2554     tstASMAtomicDecIncS64();
    2555     tstASMAtomicAndOrU32();
    2556     tstASMAtomicAndOrU64();
    2557 
    2558     tstASMAtomicUoIncU32();
    2559     tstASMAtomicUoDecU32();
    2560     tstASMAtomicUoAndOrU32();
     2762    tstASMAtomicAdd();
     2763    tstASMAtomicDecInc();
     2764    tstASMAtomicAndOrXor();
    25612765
    25622766    tstASMMemZeroPage();
Note: See TracChangeset for help on using the changeset viewer.

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