Skip to content

Commit b0de442

Browse files
OPENMP and __GNUC__ compiler safety and performance
As references see #18729 #18975 and https://bugzilla.redhat.com/show_bug.cgi?id=2362561 see late comments there from Jakub Jelinek https://bugzilla.redhat.com/show_bug.cgi?id=2368336 https://bugzilla.redhat.com/show_bug.cgi?id=2373291
1 parent ab60bc5 commit b0de442

File tree

1 file changed

+25
-28
lines changed

1 file changed

+25
-28
lines changed

src/develop/openmp_maths.h

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,44 +23,41 @@
2323
#pragma once
2424

2525

26-
#if defined(_OPENMP) && !defined(_WIN32) && (!defined(__GNUC__) || __GNUC__ >= 12)
26+
#if defined(_OPENMP) && !defined(_WIN32) && !defined(__GNUC__)
27+
// GCC and CLANG have declarations in standard headers if and only if the architecture and compile options support vectorization, so
28+
// don't try to override that here - causes dynamic-link errors at startup.
29+
DT_OMP_DECLARE_SIMD()
30+
extern float fmaxf(const float x, const float y);
2731

28-
#ifndef __GNUC__ // GCC 12 compiles but fails at runtime due to missing library function
29-
DT_OMP_DECLARE_SIMD()
30-
extern float fmaxf(const float x, const float y);
31-
#endif
32+
DT_OMP_DECLARE_SIMD()
33+
extern float fminf(const float x, const float y);
3234

33-
#ifndef __GNUC__ // GCC 12 compiles but fails at runtime due to missing library function
34-
DT_OMP_DECLARE_SIMD()
35-
extern float fminf(const float x, const float y);
36-
#endif
35+
DT_OMP_DECLARE_SIMD()
36+
extern float fabsf(const float x);
3737

38-
DT_OMP_DECLARE_SIMD()
39-
extern float fabsf(const float x);
40-
41-
DT_OMP_DECLARE_SIMD()
42-
extern float powf(const float x, const float y);
38+
DT_OMP_DECLARE_SIMD()
39+
extern float powf(const float x, const float y);
4340

44-
DT_OMP_DECLARE_SIMD()
45-
extern float sqrtf(const float x);
41+
DT_OMP_DECLARE_SIMD()
42+
extern float sqrtf(const float x);
4643

47-
DT_OMP_DECLARE_SIMD()
48-
extern float cbrtf(const float x);
44+
DT_OMP_DECLARE_SIMD()
45+
extern float cbrtf(const float x);
4946

50-
DT_OMP_DECLARE_SIMD()
51-
extern float log2f(const float x);
47+
DT_OMP_DECLARE_SIMD()
48+
extern float log2f(const float x);
5249

53-
DT_OMP_DECLARE_SIMD()
54-
extern float exp2f(const float x);
50+
DT_OMP_DECLARE_SIMD()
51+
extern float exp2f(const float x);
5552

56-
DT_OMP_DECLARE_SIMD()
57-
extern float log10f(const float x);
53+
DT_OMP_DECLARE_SIMD()
54+
extern float log10f(const float x);
5855

59-
DT_OMP_DECLARE_SIMD()
60-
extern float expf(const float x);
56+
DT_OMP_DECLARE_SIMD()
57+
extern float expf(const float x);
6158

62-
DT_OMP_DECLARE_SIMD()
63-
extern float logf(const float x);
59+
DT_OMP_DECLARE_SIMD()
60+
extern float logf(const float x);
6461

6562
#endif
6663

0 commit comments

Comments
 (0)