Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation errors with x86intrin.h #463

Open
nimble0 opened this issue Sep 15, 2024 · 0 comments
Open

Compilation errors with x86intrin.h #463

nimble0 opened this issue Sep 15, 2024 · 0 comments

Comments

@nimble0
Copy link

nimble0 commented Sep 15, 2024

System Information

  • Ogre Version: v2.2 / v2.3
  • Operating System / Platform: Manjaro Linux
  • Compiler: g++ (GCC) 14.2.1 20240805

Detailled description

Including x86intrin.h after Math/Array/OgreArrayConfig.h causes compilation errors.

The problem is that fma4intrin.h (included by x86intrin.h) defines _mm_nmsub_ps which gets mangled by:

#define _mm_nmsub_ps( a, b, c ) _mm_sub_ps( c, _mm_mul_ps( a, b ) )

This commit 359b9a3 seems to reference a similar issue.

Replacing _mm_nmsub_ps with a different identifier fixes the errors. Making sure x86intrin.h is included first also fixes the errors.

Build log

/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/include/fma4intrin.h: At global scope:
/home/nimble/projects/ogre-next/OgreMain/include/Math/Array/OgreArrayConfig.h:86:60: error: ‘_mm_mul_ps’ is not a type
   86 |         #define _mm_nmsub_ps( a, b, c )     _mm_sub_ps( c, _mm_mul_ps( a, b ) )
      |                                                            ^~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/include/x86intrin.h:36,
                 from /home/nimble/projects/ogre-next/Samples/2.0/Tutorials/Tutorial00_Basic/Tutorial00_Basic.cpp:26:
/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/include/fma4intrin.h: In function ‘__m128 _mm_sub_ps(__m128, int (*)(__m128, __m128))’:
/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/include/fma4intrin.h:117:53: error: ‘__A’ was not declared in this scope; did you mean ‘__C’?
  117 |   return (__m128) __builtin_ia32_vfmaddps (-(__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
      |                                                     ^~~
      |                                                     __C
/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/include/fma4intrin.h:117:66: error: ‘__B’ was not declared in this scope; did you mean ‘__C’?
  117 |   return (__m128) __builtin_ia32_vfmaddps (-(__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
      |                                                                  ^~~
      |                                                                  __C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant