triton-windows 3.4.0.post20__cp311-cp311-win_amd64.whl → 3.5.0.post21__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of triton-windows might be problematic. Click here for more details.
- triton/_C/libtriton.pyd +0 -0
- triton/__init__.py +8 -2
- triton/_filecheck.py +24 -14
- triton/_internal_testing.py +70 -4
- triton/_utils.py +3 -1
- triton/backends/amd/compiler.py +68 -60
- triton/backends/amd/driver.c +113 -44
- triton/backends/amd/driver.py +133 -57
- triton/backends/driver.py +13 -0
- triton/backends/nvidia/compiler.py +80 -22
- triton/backends/nvidia/driver.c +88 -15
- triton/backends/nvidia/driver.py +130 -123
- triton/compiler/__init__.py +5 -2
- triton/compiler/code_generator.py +270 -163
- triton/compiler/compiler.py +45 -62
- triton/experimental/gluon/__init__.py +3 -2
- triton/experimental/gluon/_runtime.py +9 -6
- triton/experimental/gluon/language/__init__.py +117 -16
- triton/experimental/gluon/language/_core.py +246 -68
- triton/experimental/gluon/language/_layouts.py +398 -45
- triton/experimental/gluon/language/_math.py +17 -9
- triton/experimental/gluon/language/_semantic.py +130 -37
- triton/experimental/gluon/language/_standard.py +55 -22
- triton/experimental/gluon/language/amd/__init__.py +4 -0
- triton/experimental/gluon/language/amd/_layouts.py +96 -0
- triton/experimental/gluon/language/amd/cdna3/__init__.py +100 -0
- triton/experimental/gluon/language/amd/cdna4/__init__.py +48 -0
- triton/experimental/gluon/language/amd/cdna4/async_copy.py +151 -0
- triton/experimental/gluon/language/extra/__init__.py +3 -0
- triton/experimental/gluon/language/nvidia/ampere/__init__.py +3 -0
- triton/experimental/gluon/language/nvidia/ampere/async_copy.py +74 -0
- triton/experimental/gluon/language/nvidia/ampere/mbarrier.py +80 -0
- triton/experimental/gluon/language/nvidia/blackwell/__init__.py +192 -7
- triton/experimental/gluon/language/nvidia/blackwell/tma.py +20 -0
- triton/experimental/gluon/language/nvidia/hopper/__init__.py +124 -3
- triton/experimental/gluon/language/nvidia/hopper/mbarrier.py +20 -37
- triton/experimental/gluon/language/nvidia/hopper/tma.py +4 -3
- triton/experimental/gluon/nvidia/hopper.py +6 -1
- triton/knobs.py +132 -67
- triton/language/__init__.py +16 -10
- triton/language/core.py +163 -83
- triton/language/extra/cuda/gdc.py +6 -6
- triton/language/extra/hip/__init__.py +3 -1
- triton/language/extra/hip/libdevice.py +7 -0
- triton/language/extra/hip/utils.py +35 -0
- triton/language/extra/libdevice.py +4 -0
- triton/language/semantic.py +76 -23
- triton/language/standard.py +14 -14
- triton/language/target_info.py +54 -0
- triton/runtime/_allocation.py +15 -3
- triton/runtime/_async_compile.py +55 -0
- triton/runtime/autotuner.py +4 -5
- triton/runtime/build.py +11 -9
- triton/runtime/cache.py +44 -1
- triton/runtime/driver.py +16 -41
- triton/runtime/interpreter.py +31 -23
- triton/runtime/jit.py +318 -157
- triton/runtime/tcc/include/_mingw.h +8 -10
- triton/runtime/tcc/include/assert.h +5 -0
- triton/runtime/tcc/include/errno.h +1 -1
- triton/runtime/tcc/include/float.h +21 -3
- triton/runtime/tcc/include/iso646.h +36 -0
- triton/runtime/tcc/include/limits.h +5 -0
- triton/runtime/tcc/include/malloc.h +2 -2
- triton/runtime/tcc/include/math.h +21 -261
- triton/runtime/tcc/include/stdalign.h +16 -0
- triton/runtime/tcc/include/stdarg.h +5 -70
- triton/runtime/tcc/include/stdatomic.h +171 -0
- triton/runtime/tcc/include/stddef.h +7 -19
- triton/runtime/tcc/include/stdlib.h +15 -4
- triton/runtime/tcc/include/stdnoreturn.h +7 -0
- triton/runtime/tcc/include/sys/stat.h +2 -2
- triton/runtime/tcc/include/sys/types.h +5 -0
- triton/runtime/tcc/include/tcc/tcc_libm.h +444 -27
- triton/runtime/tcc/include/tccdefs.h +342 -0
- triton/runtime/tcc/include/tgmath.h +89 -0
- triton/runtime/tcc/include/uchar.h +33 -0
- triton/runtime/tcc/include/unistd.h +1 -0
- triton/runtime/tcc/include/winapi/qos.h +72 -0
- triton/runtime/tcc/include/winapi/shellapi.h +59 -0
- triton/runtime/tcc/include/winapi/winbase.h +9 -2
- triton/runtime/tcc/include/winapi/wincon.h +8 -0
- triton/runtime/tcc/include/winapi/windows.h +1 -1
- triton/runtime/tcc/include/winapi/winnls.h +778 -0
- triton/runtime/tcc/include/winapi/winnt.h +9 -7
- triton/runtime/tcc/include/winapi/winsock2.h +1474 -0
- triton/runtime/tcc/include/winapi/ws2ipdef.h +21 -0
- triton/runtime/tcc/include/winapi/ws2tcpip.h +391 -0
- triton/runtime/tcc/lib/libtcc1.a +0 -0
- triton/runtime/tcc/lib/python314.def +1800 -0
- triton/runtime/tcc/lib/python314t.def +1809 -0
- triton/runtime/tcc/libtcc.dll +0 -0
- triton/runtime/tcc/tcc.exe +0 -0
- triton/tools/compile.py +62 -14
- triton/tools/extra/cuda/compile.c +1 -0
- triton/tools/extra/hip/compile.cpp +66 -0
- triton/tools/extra/hip/compile.h +13 -0
- triton/tools/ragged_tma.py +92 -0
- triton/tools/tensor_descriptor.py +7 -9
- triton/windows_utils.py +42 -79
- {triton_windows-3.4.0.post20.dist-info → triton_windows-3.5.0.post21.dist-info}/METADATA +3 -4
- {triton_windows-3.4.0.post20.dist-info → triton_windows-3.5.0.post21.dist-info}/RECORD +106 -75
- triton/runtime/tcc/lib/libtcc1-64.a +0 -0
- {triton_windows-3.4.0.post20.dist-info → triton_windows-3.5.0.post21.dist-info}/WHEEL +0 -0
- {triton_windows-3.4.0.post20.dist-info → triton_windows-3.5.0.post21.dist-info}/entry_points.txt +0 -0
- {triton_windows-3.4.0.post20.dist-info → triton_windows-3.5.0.post21.dist-info}/licenses/LICENSE +0 -0
- {triton_windows-3.4.0.post20.dist-info → triton_windows-3.5.0.post21.dist-info}/top_level.txt +0 -0
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
#define __MSVCRT__ 1
|
|
42
42
|
#undef _MSVCRT_
|
|
43
43
|
#define __MINGW_IMPORT extern __declspec(dllimport)
|
|
44
|
-
#define __MINGW_ATTRIB_NORETURN
|
|
44
|
+
#define __MINGW_ATTRIB_NORETURN __declspec(noreturn)
|
|
45
45
|
#define __MINGW_ATTRIB_CONST
|
|
46
46
|
#define __MINGW_ATTRIB_DEPRECATED
|
|
47
47
|
#define __MINGW_ATTRIB_MALLOC
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
#define __GNUC_VA_LIST
|
|
52
52
|
|
|
53
53
|
#define _CRTIMP extern
|
|
54
|
-
#define __CRT_INLINE
|
|
54
|
+
#define __CRT_INLINE static __inline__
|
|
55
55
|
|
|
56
56
|
#define _CRT_ALIGN(x) __attribute__((aligned(x)))
|
|
57
57
|
#define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
|
|
@@ -76,17 +76,14 @@
|
|
|
76
76
|
#define _M_AMD64 100 /* Visual Studio */
|
|
77
77
|
#define USE_MINGW_SETJMP_TWO_ARGS
|
|
78
78
|
#define mingw_getsp tinyc_getbp
|
|
79
|
-
#define __TRY__
|
|
80
79
|
#else
|
|
81
80
|
#define __stdcall __attribute__((__stdcall__))
|
|
82
81
|
#define _X86_ 1
|
|
83
82
|
#define _M_IX86 300 /* Visual Studio */
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
#else
|
|
89
|
-
#define __TRY__ void __try__(void**), *_sehrec[6]; __try__(_sehrec);
|
|
83
|
+
#ifndef __MINGW_USE_VC2005_COMPAT /* time became 64, but not timeval.tv_sec */
|
|
84
|
+
# ifndef _USE_32BIT_TIME_T
|
|
85
|
+
# define _USE_32BIT_TIME_T
|
|
86
|
+
# endif
|
|
90
87
|
#endif
|
|
91
88
|
#endif
|
|
92
89
|
|
|
@@ -138,7 +135,7 @@ typedef struct localeinfo_struct _locale_tstruct,*_locale_t;
|
|
|
138
135
|
/* for winapi */
|
|
139
136
|
#define _ANONYMOUS_UNION
|
|
140
137
|
#define _ANONYMOUS_STRUCT
|
|
141
|
-
#define DECLSPEC_NORETURN
|
|
138
|
+
#define DECLSPEC_NORETURN __declspec(noreturn)
|
|
142
139
|
#define DECLARE_STDCALL_P(type) __stdcall type
|
|
143
140
|
#define NOSERVICE 1
|
|
144
141
|
#define NOMCX 1
|
|
@@ -166,5 +163,6 @@ typedef struct localeinfo_struct _locale_tstruct,*_locale_t;
|
|
|
166
163
|
#define __MINGW_EXTENSION
|
|
167
164
|
#define WINAPI_FAMILY_PARTITION(X) 1
|
|
168
165
|
#define MINGW_HAS_SECURE_API
|
|
166
|
+
#define WIN32 1
|
|
169
167
|
|
|
170
168
|
#endif /* __MINGW_H */
|
|
@@ -54,4 +54,9 @@ extern void __cdecl _assert(const char *, const char *, unsigned);
|
|
|
54
54
|
|
|
55
55
|
#endif
|
|
56
56
|
|
|
57
|
+
#if (__STDC_VERSION__ >= 201112L) && !defined(static_assert)
|
|
58
|
+
/* C11, section 7.2: The macro static_assert expands to _Static_assert. */
|
|
59
|
+
#define static_assert(exp, str) _Static_assert(exp, str)
|
|
60
|
+
#endif
|
|
61
|
+
|
|
57
62
|
#endif
|
|
@@ -38,19 +38,37 @@
|
|
|
38
38
|
#define LDBL_MAX_EXP 16384
|
|
39
39
|
#define LDBL_MAX 1.18973149535723176502e+4932L
|
|
40
40
|
#define LDBL_MAX_10_EXP 4932
|
|
41
|
+
#define DECIMAL_DIG 21
|
|
42
|
+
|
|
43
|
+
#elif defined __aarch64__ || defined __riscv
|
|
44
|
+
/*
|
|
45
|
+
* Use values from:
|
|
46
|
+
* gcc -dM -E -xc /dev/null | grep LDBL | sed -e "s/__//g"
|
|
47
|
+
*/
|
|
48
|
+
#define LDBL_MANT_DIG 113
|
|
49
|
+
#define LDBL_DIG 33
|
|
50
|
+
#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
|
|
51
|
+
#define LDBL_MIN_EXP (-16381)
|
|
52
|
+
#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
|
|
53
|
+
#define LDBL_MIN_10_EXP (-4931)
|
|
54
|
+
#define LDBL_MAX_EXP 16384
|
|
55
|
+
#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
|
|
56
|
+
#define LDBL_MAX_10_EXP 4932
|
|
57
|
+
#define DECIMAL_DIG 36
|
|
41
58
|
|
|
42
59
|
#else
|
|
43
60
|
|
|
44
61
|
/* same as IEEE double */
|
|
45
62
|
#define LDBL_MANT_DIG 53
|
|
46
63
|
#define LDBL_DIG 15
|
|
47
|
-
#define LDBL_EPSILON 2.2204460492503131e-
|
|
64
|
+
#define LDBL_EPSILON 2.2204460492503131e-16L
|
|
48
65
|
#define LDBL_MIN_EXP (-1021)
|
|
49
|
-
#define LDBL_MIN 2.2250738585072014e-
|
|
66
|
+
#define LDBL_MIN 2.2250738585072014e-308L
|
|
50
67
|
#define LDBL_MIN_10_EXP (-307)
|
|
51
68
|
#define LDBL_MAX_EXP 1024
|
|
52
|
-
#define LDBL_MAX 1.7976931348623157e+
|
|
69
|
+
#define LDBL_MAX 1.7976931348623157e+308L
|
|
53
70
|
#define LDBL_MAX_10_EXP 308
|
|
71
|
+
#define DECIMAL_DIG 17
|
|
54
72
|
|
|
55
73
|
#endif
|
|
56
74
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file has no copyright assigned and is placed in the Public Domain.
|
|
3
|
+
* This file is part of the TinyCC package.
|
|
4
|
+
* No warranty is given; refer to the file DISCLAIMER within this package.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ISO C Standard: 7.9 Alternative spellings <iso646.h>
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef _ISO646_H_
|
|
12
|
+
#define _ISO646_H_
|
|
13
|
+
|
|
14
|
+
#define and &&
|
|
15
|
+
#define and_eq &=
|
|
16
|
+
#define bitand &
|
|
17
|
+
#define bitor |
|
|
18
|
+
#define compl ~
|
|
19
|
+
#define not !
|
|
20
|
+
#define not_eq !=
|
|
21
|
+
#define or ||
|
|
22
|
+
#define or_eq |=
|
|
23
|
+
#define xor ^
|
|
24
|
+
#define xor_eq ^=
|
|
25
|
+
|
|
26
|
+
#endif /* _ISO646_H_ */
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
@@ -23,8 +23,13 @@
|
|
|
23
23
|
#define SCHAR_MAX 127
|
|
24
24
|
#define UCHAR_MAX 0xff
|
|
25
25
|
|
|
26
|
+
#ifndef __CHAR_UNSIGNED__
|
|
26
27
|
#define CHAR_MIN SCHAR_MIN
|
|
27
28
|
#define CHAR_MAX SCHAR_MAX
|
|
29
|
+
#else
|
|
30
|
+
#define CHAR_MIN 0
|
|
31
|
+
#define CHAR_MAX UCHAR_MAX
|
|
32
|
+
#endif
|
|
28
33
|
|
|
29
34
|
#define MB_LEN_MAX 5
|
|
30
35
|
#define SHRT_MIN (-32768)
|
|
@@ -62,8 +62,8 @@ extern "C" {
|
|
|
62
62
|
void *__cdecl malloc(size_t _Size);
|
|
63
63
|
void *__cdecl realloc(void *_Memory,size_t _NewSize);
|
|
64
64
|
_CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size);
|
|
65
|
-
|
|
66
|
-
_CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment);
|
|
65
|
+
_CRTIMP void __cdecl _aligned_free(void *_Memory);
|
|
66
|
+
_CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment);
|
|
67
67
|
_CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset);
|
|
68
68
|
_CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment);
|
|
69
69
|
_CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment);
|
|
@@ -197,81 +197,6 @@ extern "C" {
|
|
|
197
197
|
int __cdecl _fpclassf(float _X);
|
|
198
198
|
#endif
|
|
199
199
|
|
|
200
|
-
#ifndef __cplusplus
|
|
201
|
-
__CRT_INLINE long double __cdecl fabsl (long double x)
|
|
202
|
-
{
|
|
203
|
-
long double res;
|
|
204
|
-
__asm__ ("fabs;" : "=t" (res) : "0" (x));
|
|
205
|
-
return res;
|
|
206
|
-
}
|
|
207
|
-
#define _hypotl(x,y) ((long double)_hypot((double)(x),(double)(y)))
|
|
208
|
-
#define _matherrl _matherr
|
|
209
|
-
__CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign((double)(_Number)); }
|
|
210
|
-
__CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign((double)(_Number),(double)(_Sign)); }
|
|
211
|
-
__CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); }
|
|
212
|
-
|
|
213
|
-
#if !defined (__ia64__)
|
|
214
|
-
__CRT_INLINE float __cdecl fabsf (float x)
|
|
215
|
-
{
|
|
216
|
-
float res;
|
|
217
|
-
__asm__ ("fabs;" : "=t" (res) : "0" (x));
|
|
218
|
-
return res;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
__CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); }
|
|
222
|
-
#endif
|
|
223
|
-
#else
|
|
224
|
-
// cplusplus
|
|
225
|
-
__CRT_INLINE long double __cdecl fabsl (long double x)
|
|
226
|
-
{
|
|
227
|
-
long double res;
|
|
228
|
-
__asm__ ("fabs;" : "=t" (res) : "0" (x));
|
|
229
|
-
return res;
|
|
230
|
-
}
|
|
231
|
-
__CRT_INLINE long double modfl(long double _X,long double *_Y) {
|
|
232
|
-
double _Di,_Df = modf((double)_X,&_Di);
|
|
233
|
-
*_Y = (long double)_Di;
|
|
234
|
-
return (_Df);
|
|
235
|
-
}
|
|
236
|
-
__CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign(static_cast<double>(_Number)); }
|
|
237
|
-
__CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign(static_cast<double>(_Number),static_cast<double>(_Sign)); }
|
|
238
|
-
__CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); }
|
|
239
|
-
#ifndef __ia64__
|
|
240
|
-
__CRT_INLINE float __cdecl fabsf (float x)
|
|
241
|
-
{
|
|
242
|
-
float res;
|
|
243
|
-
__asm__ ("fabs;" : "=t" (res) : "0" (x));
|
|
244
|
-
return res;
|
|
245
|
-
}
|
|
246
|
-
__CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); }
|
|
247
|
-
#ifndef __x86_64
|
|
248
|
-
__CRT_INLINE float acosf(float _X) { return ((float)acos((double)_X)); }
|
|
249
|
-
__CRT_INLINE float asinf(float _X) { return ((float)asin((double)_X)); }
|
|
250
|
-
__CRT_INLINE float atanf(float _X) { return ((float)atan((double)_X)); }
|
|
251
|
-
__CRT_INLINE float atan2f(float _X,float _Y) { return ((float)atan2((double)_X,(double)_Y)); }
|
|
252
|
-
__CRT_INLINE float ceilf(float _X) { return ((float)ceil((double)_X)); }
|
|
253
|
-
__CRT_INLINE float cosf(float _X) { return ((float)cos((double)_X)); }
|
|
254
|
-
__CRT_INLINE float coshf(float _X) { return ((float)cosh((double)_X)); }
|
|
255
|
-
__CRT_INLINE float expf(float _X) { return ((float)exp((double)_X)); }
|
|
256
|
-
__CRT_INLINE float floorf(float _X) { return ((float)floor((double)_X)); }
|
|
257
|
-
__CRT_INLINE float fmodf(float _X,float _Y) { return ((float)fmod((double)_X,(double)_Y)); }
|
|
258
|
-
__CRT_INLINE float logf(float _X) { return ((float)log((double)_X)); }
|
|
259
|
-
__CRT_INLINE float log10f(float _X) { return ((float)log10((double)_X)); }
|
|
260
|
-
__CRT_INLINE float modff(float _X,float *_Y) {
|
|
261
|
-
double _Di,_Df = modf((double)_X,&_Di);
|
|
262
|
-
*_Y = (float)_Di;
|
|
263
|
-
return ((float)_Df);
|
|
264
|
-
}
|
|
265
|
-
__CRT_INLINE float powf(float _X,float _Y) { return ((float)pow((double)_X,(double)_Y)); }
|
|
266
|
-
__CRT_INLINE float sinf(float _X) { return ((float)sin((double)_X)); }
|
|
267
|
-
__CRT_INLINE float sinhf(float _X) { return ((float)sinh((double)_X)); }
|
|
268
|
-
__CRT_INLINE float sqrtf(float _X) { return ((float)sqrt((double)_X)); }
|
|
269
|
-
__CRT_INLINE float tanf(float _X) { return ((float)tan((double)_X)); }
|
|
270
|
-
__CRT_INLINE float tanhf(float _X) { return ((float)tanh((double)_X)); }
|
|
271
|
-
#endif
|
|
272
|
-
#endif
|
|
273
|
-
#endif
|
|
274
|
-
|
|
275
200
|
#ifndef NO_OLDNAMES
|
|
276
201
|
#define matherr _matherr
|
|
277
202
|
|
|
@@ -315,10 +240,13 @@ extern "C" {
|
|
|
315
240
|
extern int __cdecl __fpclassify (double);
|
|
316
241
|
extern int __cdecl __fpclassifyl (long double);
|
|
317
242
|
|
|
318
|
-
/* Implemented at tcc/tcc_libm.h
|
|
243
|
+
/* Implemented at tcc/tcc_libm.h
|
|
319
244
|
#define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \
|
|
320
245
|
: sizeof (x) == sizeof (double) ? __fpclassify (x) \
|
|
321
246
|
: __fpclassifyl (x))
|
|
247
|
+
*/
|
|
248
|
+
#define fpclassify(x) \
|
|
249
|
+
_Generic(x, float: __fpclassifyf, double: __fpclassify, long double: __fpclassifyl)(x)
|
|
322
250
|
|
|
323
251
|
/* 7.12.3.2 */
|
|
324
252
|
#define isfinite(x) ((fpclassify(x) & FP_NAN) == 0)
|
|
@@ -340,10 +268,13 @@ extern "C" {
|
|
|
340
268
|
extern int __cdecl __signbit (double);
|
|
341
269
|
extern int __cdecl __signbitl (long double);
|
|
342
270
|
|
|
343
|
-
/* Implemented at tcc/tcc_libm.h
|
|
271
|
+
/* Implemented at tcc/tcc_libm.h
|
|
344
272
|
#define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \
|
|
345
273
|
: sizeof (x) == sizeof (double) ? __signbit (x) \
|
|
346
274
|
: __signbitl (x))
|
|
275
|
+
*/
|
|
276
|
+
#define signbit(x) \
|
|
277
|
+
_Generic(x, float: __signbitf, double: __signbit, long double: __signbitl)(x)
|
|
347
278
|
|
|
348
279
|
extern double __cdecl exp2(double);
|
|
349
280
|
extern float __cdecl exp2f(float);
|
|
@@ -367,30 +298,6 @@ extern "C" {
|
|
|
367
298
|
extern float __cdecl logbf (float);
|
|
368
299
|
extern long double __cdecl logbl (long double);
|
|
369
300
|
|
|
370
|
-
__CRT_INLINE double __cdecl logb (double x)
|
|
371
|
-
{
|
|
372
|
-
double res;
|
|
373
|
-
__asm__ ("fxtract\n\t"
|
|
374
|
-
"fstp %%st" : "=t" (res) : "0" (x));
|
|
375
|
-
return res;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
__CRT_INLINE float __cdecl logbf (float x)
|
|
379
|
-
{
|
|
380
|
-
float res;
|
|
381
|
-
__asm__ ("fxtract\n\t"
|
|
382
|
-
"fstp %%st" : "=t" (res) : "0" (x));
|
|
383
|
-
return res;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
__CRT_INLINE long double __cdecl logbl (long double x)
|
|
387
|
-
{
|
|
388
|
-
long double res;
|
|
389
|
-
__asm__ ("fxtract\n\t"
|
|
390
|
-
"fstp %%st" : "=t" (res) : "0" (x));
|
|
391
|
-
return res;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
301
|
extern long double __cdecl modfl (long double, long double*);
|
|
395
302
|
|
|
396
303
|
/* 7.12.6.13 */
|
|
@@ -408,8 +315,8 @@ extern "C" {
|
|
|
408
315
|
extern float __cdecl cbrtf (float);
|
|
409
316
|
extern long double __cdecl cbrtl (long double);
|
|
410
317
|
|
|
411
|
-
|
|
412
|
-
|
|
318
|
+
extern double __cdecl hypot (double, double);
|
|
319
|
+
extern float __cdecl hypotf (float, float);
|
|
413
320
|
extern long double __cdecl hypotl (long double, long double);
|
|
414
321
|
|
|
415
322
|
extern long double __cdecl powl (long double, long double);
|
|
@@ -465,112 +372,23 @@ extern "C" {
|
|
|
465
372
|
|
|
466
373
|
/* 7.12.9.4 */
|
|
467
374
|
/* round, using fpu control word settings */
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
{
|
|
480
|
-
float retval;
|
|
481
|
-
__asm__ (
|
|
482
|
-
"flds %1\n"
|
|
483
|
-
"frndint \n"
|
|
484
|
-
"fsts %0\n" : "=m" (retval) : "m" (x));
|
|
485
|
-
return retval;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
__CRT_INLINE long double __cdecl rintl (long double x)
|
|
489
|
-
{
|
|
490
|
-
long double retval;
|
|
491
|
-
__asm__ (
|
|
492
|
-
"fldt %1\n"
|
|
493
|
-
"frndint \n"
|
|
494
|
-
"fstt %0\n" : "=m" (retval) : "m" (x));
|
|
495
|
-
return retval;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
/* 7.12.9.5 */
|
|
499
|
-
__CRT_INLINE long __cdecl lrint (double x)
|
|
500
|
-
{
|
|
501
|
-
long retval;
|
|
502
|
-
__asm__ __volatile__ \
|
|
503
|
-
("fldl %1\n" \
|
|
504
|
-
"fistpl %0" : "=m" (retval) : "m" (x)); \
|
|
505
|
-
return retval;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
__CRT_INLINE long __cdecl lrintf (float x)
|
|
509
|
-
{
|
|
510
|
-
long retval;
|
|
511
|
-
__asm__ __volatile__ \
|
|
512
|
-
("flds %1\n" \
|
|
513
|
-
"fistpl %0" : "=m" (retval) : "m" (x)); \
|
|
514
|
-
return retval;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
__CRT_INLINE long __cdecl lrintl (long double x)
|
|
518
|
-
{
|
|
519
|
-
long retval;
|
|
520
|
-
__asm__ __volatile__ \
|
|
521
|
-
("fldt %1\n" \
|
|
522
|
-
"fistpl %0" : "=m" (retval) : "m" (x)); \
|
|
523
|
-
return retval;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
__CRT_INLINE long long __cdecl llrint (double x)
|
|
527
|
-
{
|
|
528
|
-
long long retval;
|
|
529
|
-
__asm__ __volatile__ \
|
|
530
|
-
("fldl %1\n" \
|
|
531
|
-
"fistpll %0" : "=m" (retval) : "m" (x)); \
|
|
532
|
-
return retval;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
__CRT_INLINE long long __cdecl llrintf (float x)
|
|
536
|
-
{
|
|
537
|
-
long long retval;
|
|
538
|
-
__asm__ __volatile__ \
|
|
539
|
-
("flds %1\n" \
|
|
540
|
-
"fistpll %0" : "=m" (retval) : "m" (x)); \
|
|
541
|
-
return retval;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
__CRT_INLINE long long __cdecl llrintl (long double x)
|
|
545
|
-
{
|
|
546
|
-
long long retval;
|
|
547
|
-
__asm__ __volatile__ \
|
|
548
|
-
("fldt %1\n" \
|
|
549
|
-
"fistpll %0" : "=m" (retval) : "m" (x)); \
|
|
550
|
-
return retval;
|
|
551
|
-
}
|
|
375
|
+
extern double __cdecl rint (double);
|
|
376
|
+
extern float __cdecl rintf (float);
|
|
377
|
+
extern long double __cdecl rintl (long double);
|
|
378
|
+
|
|
379
|
+
extern long __cdecl lrint (double);
|
|
380
|
+
extern long __cdecl lrintf (float);
|
|
381
|
+
extern long __cdecl lrintl (long double);
|
|
382
|
+
|
|
383
|
+
extern long long __cdecl llrint (double);
|
|
384
|
+
extern long long __cdecl llrintf (float);
|
|
385
|
+
extern long long __cdecl llrintl (long double);
|
|
552
386
|
|
|
553
387
|
#define FE_TONEAREST 0x0000
|
|
554
388
|
#define FE_DOWNWARD 0x0400
|
|
555
389
|
#define FE_UPWARD 0x0800
|
|
556
390
|
#define FE_TOWARDZERO 0x0c00
|
|
557
391
|
|
|
558
|
-
__CRT_INLINE double trunc (double _x)
|
|
559
|
-
{
|
|
560
|
-
double retval;
|
|
561
|
-
unsigned short saved_cw;
|
|
562
|
-
unsigned short tmp_cw;
|
|
563
|
-
__asm__ ("fnstcw %0;" : "=m" (saved_cw)); /* save FPU control word */
|
|
564
|
-
tmp_cw = (saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO))
|
|
565
|
-
| FE_TOWARDZERO;
|
|
566
|
-
__asm__ ("fldcw %0;" : : "m" (tmp_cw));
|
|
567
|
-
__asm__ ("fldl %1;"
|
|
568
|
-
"frndint;"
|
|
569
|
-
"fstl %0;" : "=m" (retval) : "m" (_x)); /* round towards zero */
|
|
570
|
-
__asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */
|
|
571
|
-
return retval;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
392
|
/* 7.12.9.6 */
|
|
575
393
|
/* round away from zero, regardless of fpu control word settings */
|
|
576
394
|
extern double __cdecl round (double);
|
|
@@ -655,70 +473,12 @@ extern "C" {
|
|
|
655
473
|
extern long double __cdecl fmal (long double, long double, long double);
|
|
656
474
|
|
|
657
475
|
|
|
658
|
-
#if 0 // gr: duplicate, see below
|
|
659
|
-
/* 7.12.14 */
|
|
660
|
-
/*
|
|
661
|
-
* With these functions, comparisons involving quiet NaNs set the FP
|
|
662
|
-
* condition code to "unordered". The IEEE floating-point spec
|
|
663
|
-
* dictates that the result of floating-point comparisons should be
|
|
664
|
-
* false whenever a NaN is involved, with the exception of the != op,
|
|
665
|
-
* which always returns true: yes, (NaN != NaN) is true).
|
|
666
|
-
*/
|
|
667
|
-
|
|
668
|
-
#if __GNUC__ >= 3
|
|
669
|
-
|
|
670
|
-
#define isgreater(x, y) __builtin_isgreater(x, y)
|
|
671
|
-
#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
|
|
672
|
-
#define isless(x, y) __builtin_isless(x, y)
|
|
673
|
-
#define islessequal(x, y) __builtin_islessequal(x, y)
|
|
674
|
-
#define islessgreater(x, y) __builtin_islessgreater(x, y)
|
|
675
|
-
#define isunordered(x, y) __builtin_isunordered(x, y)
|
|
676
|
-
|
|
677
|
-
#else
|
|
678
|
-
/* helper */
|
|
679
|
-
__CRT_INLINE int __cdecl
|
|
680
|
-
__fp_unordered_compare (long double x, long double y){
|
|
681
|
-
unsigned short retval;
|
|
682
|
-
__asm__ ("fucom %%st(1);"
|
|
683
|
-
"fnstsw;": "=a" (retval) : "t" (x), "u" (y));
|
|
684
|
-
return retval;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
#define isgreater(x, y) ((__fp_unordered_compare(x, y) \
|
|
688
|
-
& 0x4500) == 0)
|
|
689
|
-
#define isless(x, y) ((__fp_unordered_compare (y, x) \
|
|
690
|
-
& 0x4500) == 0)
|
|
691
|
-
#define isgreaterequal(x, y) ((__fp_unordered_compare (x, y) \
|
|
692
|
-
& FP_INFINITE) == 0)
|
|
693
|
-
#define islessequal(x, y) ((__fp_unordered_compare(y, x) \
|
|
694
|
-
& FP_INFINITE) == 0)
|
|
695
|
-
#define islessgreater(x, y) ((__fp_unordered_compare(x, y) \
|
|
696
|
-
& FP_SUBNORMAL) == 0)
|
|
697
|
-
#define isunordered(x, y) ((__fp_unordered_compare(x, y) \
|
|
698
|
-
& 0x4500) == 0x4500)
|
|
699
|
-
|
|
700
|
-
#endif
|
|
701
|
-
#endif //0
|
|
702
|
-
|
|
703
|
-
|
|
704
476
|
#endif /* __STDC_VERSION__ >= 199901L */
|
|
705
477
|
#endif /* __NO_ISOCEXT */
|
|
706
478
|
|
|
707
479
|
#ifdef __cplusplus
|
|
708
480
|
}
|
|
709
|
-
extern "C++" {
|
|
710
|
-
template<class _Ty> inline _Ty _Pow_int(_Ty _X,int _Y) {
|
|
711
|
-
unsigned int _N;
|
|
712
|
-
if(_Y >= 0) _N = (unsigned int)_Y;
|
|
713
|
-
else _N = (unsigned int)(-_Y);
|
|
714
|
-
for(_Ty _Z = _Ty(1);;_X *= _X) {
|
|
715
|
-
if((_N & 1)!=0) _Z *= _X;
|
|
716
|
-
if((_N >>= 1)==0) return (_Y < 0 ? _Ty(1) / _Z : _Z);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
481
|
#endif
|
|
721
|
-
|
|
722
482
|
#pragma pack(pop)
|
|
723
483
|
|
|
724
484
|
/* 7.12.14 */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef _STDALIGN_H
|
|
2
|
+
#define _STDALIGN_H
|
|
3
|
+
|
|
4
|
+
#if __STDC_VERSION__ < 201112L && (defined(__GNUC__) || defined(__TINYC__))
|
|
5
|
+
# define _Alignas(t) __attribute__((__aligned__(t)))
|
|
6
|
+
# define _Alignof(t) __alignof__(t)
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
#define alignas _Alignas
|
|
10
|
+
#define alignof _Alignof
|
|
11
|
+
|
|
12
|
+
#define __alignas_is_defined 1
|
|
13
|
+
#define __alignof_is_defined 1
|
|
14
|
+
|
|
15
|
+
#endif /* _STDALIGN_H */
|
|
16
|
+
|
|
@@ -1,76 +1,11 @@
|
|
|
1
1
|
#ifndef _STDARG_H
|
|
2
2
|
#define _STDARG_H
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
typedef struct {
|
|
10
|
-
unsigned int gp_offset;
|
|
11
|
-
unsigned int fp_offset;
|
|
12
|
-
union {
|
|
13
|
-
unsigned int overflow_offset;
|
|
14
|
-
char *overflow_arg_area;
|
|
15
|
-
};
|
|
16
|
-
char *reg_save_area;
|
|
17
|
-
} __va_list_struct;
|
|
18
|
-
|
|
19
|
-
typedef __va_list_struct va_list[1];
|
|
20
|
-
|
|
21
|
-
void __va_start(__va_list_struct *ap, void *fp);
|
|
22
|
-
void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align);
|
|
23
|
-
|
|
24
|
-
#define va_start(ap, last) __va_start(ap, __builtin_frame_address(0))
|
|
25
|
-
#define va_arg(ap, type) \
|
|
26
|
-
(*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type), __alignof__(type))))
|
|
27
|
-
#define va_copy(dest, src) (*(dest) = *(src))
|
|
28
|
-
#define va_end(ap)
|
|
29
|
-
|
|
30
|
-
/* avoid conflicting definition for va_list on Macs. */
|
|
31
|
-
#define _VA_LIST_T
|
|
32
|
-
|
|
33
|
-
#else /* _WIN64 */
|
|
34
|
-
typedef char *va_list;
|
|
35
|
-
#define va_start(ap,last) __builtin_va_start(ap,last)
|
|
36
|
-
#define va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \
|
|
37
|
-
? **(t **)((ap += 8) - 8) : *(t *)((ap += 8) - 8))
|
|
38
|
-
#define va_copy(dest, src) ((dest) = (src))
|
|
39
|
-
#define va_end(ap)
|
|
40
|
-
#endif
|
|
41
|
-
|
|
42
|
-
#elif __arm__
|
|
43
|
-
typedef char *va_list;
|
|
44
|
-
#define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x)
|
|
45
|
-
#define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \
|
|
46
|
-
& ~(_tcc_alignof(type) - 1))
|
|
47
|
-
#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
|
|
48
|
-
#define va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \
|
|
49
|
-
&~3), *(type *)(ap - ((sizeof(type)+3)&~3)))
|
|
50
|
-
#define va_copy(dest, src) (dest) = (src)
|
|
51
|
-
#define va_end(ap)
|
|
52
|
-
|
|
53
|
-
#elif defined(__aarch64__)
|
|
54
|
-
typedef struct {
|
|
55
|
-
void *__stack;
|
|
56
|
-
void *__gr_top;
|
|
57
|
-
void *__vr_top;
|
|
58
|
-
int __gr_offs;
|
|
59
|
-
int __vr_offs;
|
|
60
|
-
} va_list;
|
|
61
|
-
#define va_start(ap, last) __va_start(ap, last)
|
|
62
|
-
#define va_arg(ap, type) __va_arg(ap, type)
|
|
63
|
-
#define va_end(ap)
|
|
64
|
-
#define va_copy(dest, src) ((dest) = (src))
|
|
65
|
-
|
|
66
|
-
#else /* __i386__ */
|
|
67
|
-
typedef char *va_list;
|
|
68
|
-
/* only correct for i386 */
|
|
69
|
-
#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
|
|
70
|
-
#define va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3)))
|
|
71
|
-
#define va_copy(dest, src) (dest) = (src)
|
|
72
|
-
#define va_end(ap)
|
|
73
|
-
#endif
|
|
4
|
+
typedef __builtin_va_list va_list;
|
|
5
|
+
#define va_start __builtin_va_start
|
|
6
|
+
#define va_arg __builtin_va_arg
|
|
7
|
+
#define va_copy __builtin_va_copy
|
|
8
|
+
#define va_end __builtin_va_end
|
|
74
9
|
|
|
75
10
|
/* fix a buggy dependency on GCC in libio.h */
|
|
76
11
|
typedef va_list __gnuc_va_list;
|