Skip to content

'__asm__': undeclared identifier with VS 2022 / ARM64 #798

@abria

Description

@abria

In solver.c, the following code

#if defined( B2_CPU_ARM )
static inline void b2Pause( void )
{
	__asm__ __volatile__( "isb\n" );
}
#elif defined( B2_CPU_X86_X64 )
#include <immintrin.h>
static inline void b2Pause( void )
{
	_mm_pause();
}
#else
static inline void b2Pause( void )
{
	// no threading will likely be used in web assembly
}
#endif

yields error C2065: '__asm__': undeclared identifier when compiling on Visual Studio 2022 targeting ARM64 platform.

I tried to solve replacing the __asm__ __volatile__( "isb\n" ); call with __dmb(_ARM64_BARRIER_SY); and it compiled, however the CrossPlatformTest failed, which might be due to my change:

Starting Box2D unit tests
======================================
test passed: MathTest
  subtest passed: AABBTest
test passed: CollisionTest
  subtest passed: MultithreadingTest
step = 300, hash = 0x769fe476
condition false: sleepStep == 310
  subtest failed: CrossPlatformTest
test failed: DeterminismTest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions