Skip to content

Commit 1bab306

Browse files
committed
Fix ppc64le Clang build: guard intrinsics already defined as builtins
On ppc64le, Clang pre-defines __fmadds, __fnmsubs, and __fsels as macros mapping to compiler builtins. Wrap our custom definitions with #ifndef guards so they are skipped when the compiler already provides them. Fixes #1042
1 parent 4310fbd commit 1bab306

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

neo/idlib/sys/sys_intrinsics.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,26 @@ ID_INLINE_EXTERN float __fmuls( float a, float b )
4444
{
4545
return ( a * b );
4646
}
47+
// On ppc64le, Clang defines __fmadds, __fnmsubs, and __fsels as macros
48+
// mapping to compiler builtins. Skip our definitions when they already exist.
49+
#ifndef __fmadds
4750
ID_INLINE_EXTERN float __fmadds( float a, float b, float c )
4851
{
4952
return ( a * b + c );
5053
}
54+
#endif
55+
#ifndef __fnmsubs
5156
ID_INLINE_EXTERN float __fnmsubs( float a, float b, float c )
5257
{
5358
return ( c - a * b );
5459
}
60+
#endif
61+
#ifndef __fsels
5562
ID_INLINE_EXTERN float __fsels( float a, float b, float c )
5663
{
5764
return ( a >= 0.0f ) ? b : c;
5865
}
66+
#endif
5967
ID_INLINE_EXTERN float __frcps( float x )
6068
{
6169
return ( 1.0f / x );

0 commit comments

Comments
 (0)