triton-windows 3.3.1.post19__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.

Files changed (225) hide show
  1. triton/_C/libtriton.pyd +0 -0
  2. triton/__init__.py +11 -2
  3. triton/_filecheck.py +97 -0
  4. triton/_internal_testing.py +95 -18
  5. triton/_utils.py +112 -21
  6. triton/backends/__init__.py +20 -23
  7. triton/backends/amd/__init__.py +0 -0
  8. triton/backends/amd/compiler.py +161 -119
  9. triton/backends/amd/driver.c +118 -46
  10. triton/backends/amd/driver.py +274 -96
  11. triton/backends/compiler.py +7 -21
  12. triton/backends/driver.py +13 -0
  13. triton/backends/nvidia/bin/ptxas.exe +0 -0
  14. triton/backends/nvidia/compiler.py +163 -106
  15. triton/backends/nvidia/driver.c +166 -101
  16. triton/backends/nvidia/driver.py +384 -202
  17. triton/compiler/__init__.py +5 -2
  18. triton/compiler/code_generator.py +439 -231
  19. triton/compiler/compiler.py +152 -84
  20. triton/experimental/__init__.py +0 -0
  21. triton/experimental/gluon/__init__.py +5 -0
  22. triton/experimental/gluon/_compiler.py +0 -0
  23. triton/experimental/gluon/_runtime.py +102 -0
  24. triton/experimental/gluon/language/__init__.py +119 -0
  25. triton/experimental/gluon/language/_core.py +490 -0
  26. triton/experimental/gluon/language/_layouts.py +583 -0
  27. triton/experimental/gluon/language/_math.py +20 -0
  28. triton/experimental/gluon/language/_semantic.py +380 -0
  29. triton/experimental/gluon/language/_standard.py +80 -0
  30. triton/experimental/gluon/language/amd/__init__.py +4 -0
  31. triton/experimental/gluon/language/amd/_layouts.py +96 -0
  32. triton/experimental/gluon/language/amd/cdna3/__init__.py +100 -0
  33. triton/experimental/gluon/language/amd/cdna4/__init__.py +48 -0
  34. triton/experimental/gluon/language/amd/cdna4/async_copy.py +151 -0
  35. triton/experimental/gluon/language/extra/__init__.py +3 -0
  36. triton/experimental/gluon/language/nvidia/__init__.py +4 -0
  37. triton/experimental/gluon/language/nvidia/ampere/__init__.py +3 -0
  38. triton/experimental/gluon/language/nvidia/ampere/async_copy.py +74 -0
  39. triton/experimental/gluon/language/nvidia/ampere/mbarrier.py +80 -0
  40. triton/experimental/gluon/language/nvidia/blackwell/__init__.py +387 -0
  41. triton/experimental/gluon/language/nvidia/blackwell/tma.py +52 -0
  42. triton/experimental/gluon/language/nvidia/hopper/__init__.py +132 -0
  43. triton/experimental/gluon/language/nvidia/hopper/mbarrier.py +34 -0
  44. triton/experimental/gluon/language/nvidia/hopper/tma.py +97 -0
  45. triton/experimental/gluon/nvidia/__init__.py +4 -0
  46. triton/experimental/gluon/nvidia/blackwell.py +3 -0
  47. triton/experimental/gluon/nvidia/hopper.py +45 -0
  48. triton/knobs.py +546 -0
  49. triton/language/__init__.py +50 -19
  50. triton/language/core.py +909 -572
  51. triton/language/extra/cuda/__init__.py +10 -7
  52. triton/language/extra/cuda/gdc.py +42 -0
  53. triton/language/extra/cuda/libdevice.py +394 -394
  54. triton/language/extra/cuda/utils.py +21 -21
  55. triton/language/extra/hip/__init__.py +3 -1
  56. triton/language/extra/hip/libdevice.py +120 -104
  57. triton/language/extra/hip/utils.py +35 -0
  58. triton/language/extra/libdevice.py +4 -0
  59. triton/language/math.py +65 -66
  60. triton/language/random.py +12 -2
  61. triton/language/semantic.py +1757 -1768
  62. triton/language/standard.py +127 -62
  63. triton/language/target_info.py +54 -0
  64. triton/runtime/_allocation.py +15 -3
  65. triton/runtime/_async_compile.py +55 -0
  66. triton/runtime/autotuner.py +117 -60
  67. triton/runtime/build.py +83 -17
  68. triton/runtime/cache.py +61 -47
  69. triton/runtime/driver.py +25 -47
  70. triton/runtime/interpreter.py +95 -50
  71. triton/runtime/jit.py +445 -248
  72. triton/runtime/tcc/include/_mingw.h +8 -10
  73. triton/runtime/tcc/include/assert.h +5 -0
  74. triton/runtime/tcc/include/errno.h +1 -1
  75. triton/runtime/tcc/include/float.h +21 -3
  76. triton/runtime/tcc/include/iso646.h +36 -0
  77. triton/runtime/tcc/include/limits.h +5 -0
  78. triton/runtime/tcc/include/malloc.h +2 -2
  79. triton/runtime/tcc/include/math.h +21 -261
  80. triton/runtime/tcc/include/stdalign.h +16 -0
  81. triton/runtime/tcc/include/stdarg.h +5 -70
  82. triton/runtime/tcc/include/stdatomic.h +171 -0
  83. triton/runtime/tcc/include/stddef.h +7 -19
  84. triton/runtime/tcc/include/stdlib.h +15 -4
  85. triton/runtime/tcc/include/stdnoreturn.h +7 -0
  86. triton/runtime/tcc/include/sys/stat.h +2 -2
  87. triton/runtime/tcc/include/sys/types.h +5 -0
  88. triton/runtime/tcc/include/tcc/tcc_libm.h +444 -27
  89. triton/runtime/tcc/include/tccdefs.h +342 -0
  90. triton/runtime/tcc/include/tgmath.h +89 -0
  91. triton/runtime/tcc/include/uchar.h +33 -0
  92. triton/runtime/tcc/include/unistd.h +1 -0
  93. triton/runtime/tcc/include/winapi/qos.h +72 -0
  94. triton/runtime/tcc/include/winapi/shellapi.h +59 -0
  95. triton/runtime/tcc/include/winapi/winbase.h +9 -2
  96. triton/runtime/tcc/include/winapi/wincon.h +8 -0
  97. triton/runtime/tcc/include/winapi/windows.h +1 -1
  98. triton/runtime/tcc/include/winapi/winnls.h +778 -0
  99. triton/runtime/tcc/include/winapi/winnt.h +9 -7
  100. triton/runtime/tcc/include/winapi/winsock2.h +1474 -0
  101. triton/runtime/tcc/include/winapi/ws2ipdef.h +21 -0
  102. triton/runtime/tcc/include/winapi/ws2tcpip.h +391 -0
  103. triton/runtime/tcc/lib/libtcc1.a +0 -0
  104. triton/runtime/tcc/lib/python314.def +1800 -0
  105. triton/runtime/tcc/lib/python314t.def +1809 -0
  106. triton/runtime/tcc/libtcc.dll +0 -0
  107. triton/runtime/tcc/tcc.exe +0 -0
  108. triton/testing.py +16 -12
  109. triton/tools/compile.py +62 -14
  110. triton/tools/disasm.py +3 -4
  111. triton/tools/extra/cuda/compile.c +1 -0
  112. triton/tools/extra/hip/compile.cpp +66 -0
  113. triton/tools/extra/hip/compile.h +13 -0
  114. triton/tools/ragged_tma.py +92 -0
  115. triton/tools/tensor_descriptor.py +34 -0
  116. triton/windows_utils.py +52 -81
  117. {triton_windows-3.3.1.post19.dist-info → triton_windows-3.5.0.post21.dist-info}/METADATA +8 -4
  118. triton_windows-3.5.0.post21.dist-info/RECORD +217 -0
  119. triton_windows-3.5.0.post21.dist-info/entry_points.txt +3 -0
  120. triton_windows-3.5.0.post21.dist-info/licenses/LICENSE +23 -0
  121. triton_windows-3.5.0.post21.dist-info/top_level.txt +1 -0
  122. triton/backends/amd/include/hip/amd_detail/amd_channel_descriptor.h +0 -358
  123. triton/backends/amd/include/hip/amd_detail/amd_device_functions.h +0 -1010
  124. triton/backends/amd/include/hip/amd_detail/amd_hip_atomic.h +0 -1638
  125. triton/backends/amd/include/hip/amd_detail/amd_hip_bf16.h +0 -1814
  126. triton/backends/amd/include/hip/amd_detail/amd_hip_bfloat16.h +0 -293
  127. triton/backends/amd/include/hip/amd_detail/amd_hip_common.h +0 -32
  128. triton/backends/amd/include/hip/amd_detail/amd_hip_complex.h +0 -174
  129. triton/backends/amd/include/hip/amd_detail/amd_hip_cooperative_groups.h +0 -835
  130. triton/backends/amd/include/hip/amd_detail/amd_hip_fp16.h +0 -1809
  131. triton/backends/amd/include/hip/amd_detail/amd_hip_fp8.h +0 -1391
  132. triton/backends/amd/include/hip/amd_detail/amd_hip_gl_interop.h +0 -108
  133. triton/backends/amd/include/hip/amd_detail/amd_hip_math_constants.h +0 -124
  134. triton/backends/amd/include/hip/amd_detail/amd_hip_runtime.h +0 -405
  135. triton/backends/amd/include/hip/amd_detail/amd_hip_runtime_pt_api.h +0 -196
  136. triton/backends/amd/include/hip/amd_detail/amd_hip_unsafe_atomics.h +0 -565
  137. triton/backends/amd/include/hip/amd_detail/amd_hip_vector_types.h +0 -2226
  138. triton/backends/amd/include/hip/amd_detail/amd_math_functions.h +0 -104
  139. triton/backends/amd/include/hip/amd_detail/amd_surface_functions.h +0 -244
  140. triton/backends/amd/include/hip/amd_detail/amd_warp_functions.h +0 -538
  141. triton/backends/amd/include/hip/amd_detail/amd_warp_sync_functions.h +0 -288
  142. triton/backends/amd/include/hip/amd_detail/concepts.hpp +0 -30
  143. triton/backends/amd/include/hip/amd_detail/device_library_decls.h +0 -133
  144. triton/backends/amd/include/hip/amd_detail/functional_grid_launch.hpp +0 -218
  145. triton/backends/amd/include/hip/amd_detail/grid_launch.h +0 -67
  146. triton/backends/amd/include/hip/amd_detail/grid_launch.hpp +0 -50
  147. triton/backends/amd/include/hip/amd_detail/grid_launch_GGL.hpp +0 -26
  148. triton/backends/amd/include/hip/amd_detail/helpers.hpp +0 -137
  149. triton/backends/amd/include/hip/amd_detail/hip_api_trace.hpp +0 -1446
  150. triton/backends/amd/include/hip/amd_detail/hip_assert.h +0 -101
  151. triton/backends/amd/include/hip/amd_detail/hip_cooperative_groups_helper.h +0 -242
  152. triton/backends/amd/include/hip/amd_detail/hip_fp16_gcc.h +0 -254
  153. triton/backends/amd/include/hip/amd_detail/hip_fp16_math_fwd.h +0 -96
  154. triton/backends/amd/include/hip/amd_detail/hip_ldg.h +0 -100
  155. triton/backends/amd/include/hip/amd_detail/hip_prof_str.h +0 -10570
  156. triton/backends/amd/include/hip/amd_detail/hip_runtime_prof.h +0 -78
  157. triton/backends/amd/include/hip/amd_detail/host_defines.h +0 -184
  158. triton/backends/amd/include/hip/amd_detail/hsa_helpers.hpp +0 -102
  159. triton/backends/amd/include/hip/amd_detail/macro_based_grid_launch.hpp +0 -798
  160. triton/backends/amd/include/hip/amd_detail/math_fwd.h +0 -698
  161. triton/backends/amd/include/hip/amd_detail/ockl_image.h +0 -177
  162. triton/backends/amd/include/hip/amd_detail/program_state.hpp +0 -107
  163. triton/backends/amd/include/hip/amd_detail/texture_fetch_functions.h +0 -491
  164. triton/backends/amd/include/hip/amd_detail/texture_indirect_functions.h +0 -478
  165. triton/backends/amd/include/hip/channel_descriptor.h +0 -39
  166. triton/backends/amd/include/hip/device_functions.h +0 -38
  167. triton/backends/amd/include/hip/driver_types.h +0 -468
  168. triton/backends/amd/include/hip/hip_bf16.h +0 -36
  169. triton/backends/amd/include/hip/hip_bfloat16.h +0 -44
  170. triton/backends/amd/include/hip/hip_common.h +0 -100
  171. triton/backends/amd/include/hip/hip_complex.h +0 -38
  172. triton/backends/amd/include/hip/hip_cooperative_groups.h +0 -46
  173. triton/backends/amd/include/hip/hip_deprecated.h +0 -95
  174. triton/backends/amd/include/hip/hip_ext.h +0 -161
  175. triton/backends/amd/include/hip/hip_fp16.h +0 -36
  176. triton/backends/amd/include/hip/hip_fp8.h +0 -33
  177. triton/backends/amd/include/hip/hip_gl_interop.h +0 -32
  178. triton/backends/amd/include/hip/hip_hcc.h +0 -24
  179. triton/backends/amd/include/hip/hip_math_constants.h +0 -36
  180. triton/backends/amd/include/hip/hip_profile.h +0 -27
  181. triton/backends/amd/include/hip/hip_runtime.h +0 -75
  182. triton/backends/amd/include/hip/hip_runtime_api.h +0 -9261
  183. triton/backends/amd/include/hip/hip_texture_types.h +0 -29
  184. triton/backends/amd/include/hip/hip_vector_types.h +0 -41
  185. triton/backends/amd/include/hip/hip_version.h +0 -17
  186. triton/backends/amd/include/hip/hiprtc.h +0 -421
  187. triton/backends/amd/include/hip/library_types.h +0 -78
  188. triton/backends/amd/include/hip/math_functions.h +0 -42
  189. triton/backends/amd/include/hip/surface_types.h +0 -63
  190. triton/backends/amd/include/hip/texture_types.h +0 -194
  191. triton/backends/amd/include/hsa/Brig.h +0 -1131
  192. triton/backends/amd/include/hsa/amd_hsa_common.h +0 -91
  193. triton/backends/amd/include/hsa/amd_hsa_elf.h +0 -462
  194. triton/backends/amd/include/hsa/amd_hsa_kernel_code.h +0 -269
  195. triton/backends/amd/include/hsa/amd_hsa_queue.h +0 -109
  196. triton/backends/amd/include/hsa/amd_hsa_signal.h +0 -80
  197. triton/backends/amd/include/hsa/hsa.h +0 -5738
  198. triton/backends/amd/include/hsa/hsa_amd_tool.h +0 -91
  199. triton/backends/amd/include/hsa/hsa_api_trace.h +0 -579
  200. triton/backends/amd/include/hsa/hsa_api_trace_version.h +0 -68
  201. triton/backends/amd/include/hsa/hsa_ext_amd.h +0 -3146
  202. triton/backends/amd/include/hsa/hsa_ext_finalize.h +0 -531
  203. triton/backends/amd/include/hsa/hsa_ext_image.h +0 -1454
  204. triton/backends/amd/include/hsa/hsa_ven_amd_aqlprofile.h +0 -488
  205. triton/backends/amd/include/hsa/hsa_ven_amd_loader.h +0 -667
  206. triton/backends/amd/include/hsa/hsa_ven_amd_pc_sampling.h +0 -416
  207. triton/backends/amd/include/roctracer/ext/prof_protocol.h +0 -107
  208. triton/backends/amd/include/roctracer/hip_ostream_ops.h +0 -4515
  209. triton/backends/amd/include/roctracer/hsa_ostream_ops.h +0 -1727
  210. triton/backends/amd/include/roctracer/hsa_prof_str.h +0 -3059
  211. triton/backends/amd/include/roctracer/roctracer.h +0 -779
  212. triton/backends/amd/include/roctracer/roctracer_ext.h +0 -81
  213. triton/backends/amd/include/roctracer/roctracer_hcc.h +0 -24
  214. triton/backends/amd/include/roctracer/roctracer_hip.h +0 -37
  215. triton/backends/amd/include/roctracer/roctracer_hsa.h +0 -112
  216. triton/backends/amd/include/roctracer/roctracer_plugin.h +0 -137
  217. triton/backends/amd/include/roctracer/roctracer_roctx.h +0 -67
  218. triton/backends/amd/include/roctracer/roctx.h +0 -229
  219. triton/language/_utils.py +0 -21
  220. triton/language/extra/cuda/_experimental_tma.py +0 -106
  221. triton/runtime/tcc/lib/libtcc1-64.a +0 -0
  222. triton/tools/experimental_descriptor.py +0 -32
  223. triton_windows-3.3.1.post19.dist-info/RECORD +0 -260
  224. triton_windows-3.3.1.post19.dist-info/top_level.txt +0 -14
  225. {triton_windows-3.3.1.post19.dist-info → triton_windows-3.5.0.post21.dist-info}/WHEEL +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 extern __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
- #define WIN32 1
85
- #define _USE_32BIT_TIME_T
86
- #ifdef __arm__
87
- #define __TRY__
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
@@ -14,7 +14,7 @@ extern "C" {
14
14
 
15
15
  #ifndef _CRT_ERRNO_DEFINED
16
16
  #define _CRT_ERRNO_DEFINED
17
- _CRTIMP extern int *__cdecl _errno(void);
17
+ _CRTIMP int *__cdecl _errno(void);
18
18
  #define errno (*_errno())
19
19
 
20
20
  errno_t __cdecl _set_errno(int _Value);
@@ -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-16
64
+ #define LDBL_EPSILON 2.2204460492503131e-16L
48
65
  #define LDBL_MIN_EXP (-1021)
49
- #define LDBL_MIN 2.2250738585072014e-308
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+308
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
- /* _CRTIMP void __cdecl _aligned_free(void *_Memory);
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
- __CRT_INLINE float __cdecl hypotf (float x, float y)
412
- { return (float) hypot (x, y);}
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
- __CRT_INLINE double __cdecl rint (double x)
469
- {
470
- double retval;
471
- __asm__ (
472
- "fldl %1\n"
473
- "frndint \n"
474
- "fstl %0\n" : "=m" (retval) : "m" (x));
475
- return retval;
476
- }
477
-
478
- __CRT_INLINE float __cdecl rintf (float x)
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
- #ifdef __x86_64__
5
- #ifndef _WIN64
6
-
7
- //This should be in sync with the declaration on our lib/libtcc1.c
8
- /* GCC compatible definition of va_list. */
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;