VirtualBox

Changeset 102959 in vbox for trunk/include/iprt/asm.h


Ignore:
Timestamp:
Jan 18, 2024 8:36:48 PM (13 months ago)
Author:
vboxsync
Message:

iprt/asm.h: Working over the ASMAtomicXchg* functions for arm64 again, opting for acquire-lrelase w/o DMB (barrier) as a safer alternative. bugref:9898

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm.h

    r102941 r102959  
    104104 * assuming that the host CPU always supports these. */
    105105# define RTASM_ARM64_USE_FEAT_LSE 1
     106/** @def RTASM_ARM64_USE_FEAT_LSE_WITHOUT_DMB
     107 * Set to use DMB w/o barrier in most places and rely on the acquire-release
     108 * aspects to do the serializing.   The assumption is that the tstRTInline
     109 * benchmark may be skewing the results testing an unusual scenario. */
     110# define RTASM_ARM64_USE_FEAT_LSE_WITHOUT_DMB 1
    106111#endif
    107112
     
    531536       care of by the DMB. The SWPB is rather cheap (~70% faster). */
    532537    __asm__ __volatile__("Lstart_ASMAtomicXchgU8_%=:\n\t"
     538#   if defined(RTASM_ARM64_USE_FEAT_LSE_WITHOUT_DMB)
     539                         "swpalb    %w[uNew], %w[uOld], %[pMem]\n\t"
     540#   else
    533541                         RTASM_ARM_DMB_SY
    534542                         "swpb      %w[uNew], %w[uOld], %[pMem]\n\t"
     543#   endif
    535544                         : [pMem] "+Q" (*pu8)
    536545                         , [uOld] "=&r" (uOld)
    537546                         : [uNew] "r" ((uint32_t)u8)
    538                            RTASM_ARM_DMB_SY_COMMA_IN_REG
    539547                         : );
    540548#  else
     
    643651       The SWPH is rather cheap (~70% faster). */
    644652    __asm__ __volatile__("Lstart_ASMAtomicXchgU16_%=:\n\t"
     653#   if defined(RTASM_ARM64_USE_FEAT_LSE_WITHOUT_DMB)
     654                         "swpalh    %w[uNew], %w[uOld], %[pMem]\n\t"
     655#   else
    645656                         RTASM_ARM_DMB_SY
    646657                         "swph      %w[uNew], %w[uOld], %[pMem]\n\t"
     658#   endif
    647659                         : [pMem] "+Q" (*pu16)
    648660                         , [uOld] "=&r" (uOld)
    649661                         : [uNew] "r" ((uint32_t)u16)
    650                            RTASM_ARM_DMB_SY_COMMA_IN_REG
    651662                         : );
    652663#  else
     
    744755       The SWP is rather cheap (~70% faster). */
    745756    __asm__ __volatile__("Lstart_ASMAtomicXchgU32_%=:\n\t"
     757#   if defined(RTASM_ARM64_USE_FEAT_LSE_WITHOUT_DMB)
     758                         "swpal     %w[uNew], %w[uOld], %[pMem]\n\t"
     759#   else
    746760                         RTASM_ARM_DMB_SY
    747761                         "swp       %w[uNew], %w[uOld], %[pMem]\n\t"
     762#   endif
    748763                         : [pMem] "+Q" (*pu32)
    749764                         , [uOld] "=&r" (uOld)
    750765                         : [uNew] "r" (u32)
    751                            RTASM_ARM_DMB_SY_COMMA_IN_REG
    752766                         : );
    753767#  else
     
    885899       The SWP is rather cheap (~70% faster). */
    886900    __asm__ __volatile__("Lstart_ASMAtomicXchgU64_%=:\n\t"
     901#   if defined(RTASM_ARM64_USE_FEAT_LSE_WITHOUT_DMB)
     902                         "swpal     %[uNew], %[uOld], %[pMem]\n\t"
     903#   else
    887904                         RTASM_ARM_DMB_SY
    888905                         "swp       %[uNew], %[uOld], %[pMem]\n\t"
     906#   endif
    889907                         : [pMem] "+Q" (*pu64)
    890908                         , [uOld] "=&r" (uOld)
    891909                         : [uNew] "r" (u64)
    892                            RTASM_ARM_DMB_SY_COMMA_IN_REG
    893910                         : );
    894911#  else
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