9
9
#ifndef LLVM_LIBC_SRC_MATH_GPU_AMDGPU_PLATFORM_H
10
10
#define LLVM_LIBC_SRC_MATH_GPU_AMDGPU_PLATFORM_H
11
11
12
+ #include " src/__support/macros/attributes.h"
13
+
12
14
#include < stdint.h>
13
15
14
16
namespace __llvm_libc {
@@ -19,96 +21,106 @@ namespace __llvm_libc {
19
21
extern " C" {
20
22
21
23
// Disable unsafe math optimizations in the implementation.
22
- extern const uint8_t __oclc_unsafe_math_opt = 0 ;
24
+ extern const LIBC_INLINE uint8_t __oclc_unsafe_math_opt = 0 ;
23
25
24
26
// Disable denormalization at zero optimizations in the implementation.
25
- extern const uint8_t __oclc_daz_opt = 0 ;
27
+ extern const LIBC_INLINE uint8_t __oclc_daz_opt = 0 ;
26
28
27
29
// Disable rounding optimizations for 32-bit square roots.
28
- extern const uint8_t __oclc_correctly_rounded_sqrt32 = 1 ;
30
+ extern const LIBC_INLINE uint8_t __oclc_correctly_rounded_sqrt32 = 1 ;
29
31
30
32
// Disable finite math optimizations.
31
- extern const uint8_t __oclc_finite_only_opt = 0 ;
33
+ extern const LIBC_INLINE uint8_t __oclc_finite_only_opt = 0 ;
32
34
33
35
#if defined(__gfx700__)
34
- extern const uint32_t __oclc_ISA_version = 7000 ;
36
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 7000 ;
35
37
#elif defined(__gfx701__)
36
- extern const uint32_t __oclc_ISA_version = 7001 ;
38
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 7001 ;
37
39
#elif defined(__gfx702__)
38
- extern const uint32_t __oclc_ISA_version = 7002 ;
40
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 7002 ;
39
41
#elif defined(__gfx703__)
40
- extern const uint32_t __oclc_ISA_version = 7003 ;
42
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 7003 ;
41
43
#elif defined(__gfx704__)
42
- extern const uint32_t __oclc_ISA_version = 7004 ;
44
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 7004 ;
43
45
#elif defined(__gfx705__)
44
- extern const uint32_t __oclc_ISA_version = 7005 ;
46
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 7005 ;
45
47
#elif defined(__gfx801__)
46
- extern const uint32_t __oclc_ISA_version = 8001 ;
48
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 8001 ;
47
49
#elif defined(__gfx802__)
48
- extern const uint32_t __oclc_ISA_version = 8002 ;
50
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 8002 ;
49
51
#elif defined(__gfx803__)
50
- extern const uint32_t __oclc_ISA_version = 8003 ;
52
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 8003 ;
51
53
#elif defined(__gfx805__)
52
- extern const uint32_t __oclc_ISA_version = 8005 ;
54
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 8005 ;
53
55
#elif defined(__gfx810__)
54
- extern const uint32_t __oclc_ISA_version = 8100 ;
56
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 8100 ;
55
57
#elif defined(__gfx900__)
56
- extern const uint32_t __oclc_ISA_version = 9000 ;
58
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 9000 ;
57
59
#elif defined(__gfx902__)
58
- extern const uint32_t __oclc_ISA_version = 9002 ;
60
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 9002 ;
59
61
#elif defined(__gfx904__)
60
- extern const uint32_t __oclc_ISA_version = 9004 ;
62
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 9004 ;
61
63
#elif defined(__gfx906__)
62
- extern const uint32_t __oclc_ISA_version = 9006 ;
64
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 9006 ;
63
65
#elif defined(__gfx908__)
64
- extern const uint32_t __oclc_ISA_version = 9008 ;
66
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 9008 ;
65
67
#elif defined(__gfx909__)
66
- extern const uint32_t __oclc_ISA_version = 9009 ;
68
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 9009 ;
67
69
#elif defined(__gfx90a__)
68
- extern const uint32_t __oclc_ISA_version = 9010 ;
70
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 9010 ;
69
71
#elif defined(__gfx90c__)
70
- extern const uint32_t __oclc_ISA_version = 9012 ;
72
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 9012 ;
71
73
#elif defined(__gfx940__)
72
- extern const uint32_t __oclc_ISA_version = 9400 ;
74
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 9400 ;
73
75
#elif defined(__gfx1010__)
74
- extern const uint32_t __oclc_ISA_version = 10100 ;
76
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10100 ;
75
77
#elif defined(__gfx1011__)
76
- extern const uint32_t __oclc_ISA_version = 10101 ;
78
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10101 ;
77
79
#elif defined(__gfx1012__)
78
- extern const uint32_t __oclc_ISA_version = 10102 ;
80
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10102 ;
79
81
#elif defined(__gfx1013__)
80
- extern const uint32_t __oclc_ISA_version = 10103 ;
82
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10103 ;
81
83
#elif defined(__gfx1030__)
82
- extern const uint32_t __oclc_ISA_version = 10300 ;
84
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10300 ;
83
85
#elif defined(__gfx1031__)
84
- extern const uint32_t __oclc_ISA_version = 10301 ;
86
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10301 ;
85
87
#elif defined(__gfx1032__)
86
- extern const uint32_t __oclc_ISA_version = 10302 ;
88
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10302 ;
87
89
#elif defined(__gfx1033__)
88
- extern const uint32_t __oclc_ISA_version = 10303 ;
90
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10303 ;
89
91
#elif defined(__gfx1034__)
90
- extern const uint32_t __oclc_ISA_version = 10304 ;
92
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10304 ;
91
93
#elif defined(__gfx1035__)
92
- extern const uint32_t __oclc_ISA_version = 10305 ;
94
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10305 ;
93
95
#elif defined(__gfx1036__)
94
- extern const uint32_t __oclc_ISA_version = 10306 ;
96
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 10306 ;
95
97
#elif defined(__gfx1100__)
96
- extern const uint32_t __oclc_ISA_version = 11000 ;
98
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 11000 ;
97
99
#elif defined(__gfx1101__)
98
- extern const uint32_t __oclc_ISA_version = 11001 ;
100
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 11001 ;
99
101
#elif defined(__gfx1102__)
100
- extern const uint32_t __oclc_ISA_version = 11002 ;
102
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 11002 ;
101
103
#elif defined(__gfx1103__)
102
- extern const uint32_t __oclc_ISA_version = 11003 ;
104
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 11003 ;
103
105
#elif defined(__gfx1150__)
104
- extern const uint32_t __oclc_ISA_version = 11500 ;
106
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 11500 ;
105
107
#elif defined(__gfx1151__)
106
- extern const uint32_t __oclc_ISA_version = 11501 ;
108
+ extern const LIBC_INLINE uint32_t __oclc_ISA_version = 11501 ;
107
109
#else
108
110
#error "Unknown AMDGPU architecture"
109
111
#endif
110
112
}
111
113
114
+ // These aliases cause clang to emit the control constants with ODR linkage.
115
+ // This allows us to link against the symbols without preventing them from being
116
+ // optimized out or causing symbol collisions.
117
+ [[gnu::alias(" __oclc_unsafe_math_opt" )]] const uint8_t __oclc_unsafe_math_opt__;
118
+ [[gnu::alias(" __oclc_daz_opt" )]] const uint8_t __oclc_daz_opt__;
119
+ [[gnu::alias(" __oclc_correctly_rounded_sqrt32" )]] const uint8_t
120
+ __oclc_correctly_rounded_sqrt32__;
121
+ [[gnu::alias(" __oclc_finite_only_opt" )]] const uint8_t __oclc_finite_only_opt__;
122
+ [[gnu::alias(" __oclc_ISA_version" )]] const uint32_t __oclc_ISA_version__;
123
+
112
124
} // namespace __llvm_libc
113
125
114
126
#endif // LLVM_LIBC_SRC_MATH_GPU_AMDGPU_PLATFORM_H
0 commit comments