SDL_cpuinfo.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_cpuinfo.h
  20. *
  21. * CPU feature detection for SDL.
  22. */
  23. #ifndef SDL_cpuinfo_h_
  24. #define SDL_cpuinfo_h_
  25. #include "SDL_stdinc.h"
  26. /* WIKI CATEGORY: CPUInfo */
  27. /* Need to do this here because intrin.h has C++ code in it */
  28. /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
  29. #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
  30. #ifdef __clang__
  31. /* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
  32. so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
  33. #ifndef __PRFCHWINTRIN_H
  34. #define __PRFCHWINTRIN_H
  35. static __inline__ void __attribute__((__always_inline__, __nodebug__))
  36. _m_prefetch(void *__P)
  37. {
  38. __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
  39. }
  40. #endif /* __PRFCHWINTRIN_H */
  41. #endif /* __clang__ */
  42. #include <intrin.h>
  43. #ifndef _WIN64
  44. #ifndef __MMX__
  45. #define __MMX__
  46. #endif
  47. #ifndef __3dNOW__
  48. #define __3dNOW__
  49. #endif
  50. #endif
  51. #ifndef __SSE__
  52. #define __SSE__
  53. #endif
  54. #ifndef __SSE2__
  55. #define __SSE2__
  56. #endif
  57. #ifndef __SSE3__
  58. #define __SSE3__
  59. #endif
  60. #elif defined(__MINGW64_VERSION_MAJOR)
  61. #include <intrin.h>
  62. #if !defined(SDL_DISABLE_ARM_NEON_H) && defined(__ARM_NEON)
  63. # include <arm_neon.h>
  64. #endif
  65. #else
  66. /* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */
  67. #if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
  68. #include <altivec.h>
  69. #endif
  70. #if !defined(SDL_DISABLE_ARM_NEON_H)
  71. # if defined(__ARM_NEON)
  72. # include <arm_neon.h>
  73. # elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)
  74. /* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
  75. # if defined(_M_ARM)
  76. # include <armintr.h>
  77. # include <arm_neon.h>
  78. # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
  79. # endif
  80. # if defined (_M_ARM64)
  81. # include <arm64intr.h>
  82. # include <arm64_neon.h>
  83. # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
  84. # define __ARM_ARCH 8
  85. # endif
  86. # endif
  87. #endif
  88. #endif /* compiler version */
  89. #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
  90. #include <mm3dnow.h>
  91. #endif
  92. #if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H)
  93. #include <lsxintrin.h>
  94. #define __LSX__
  95. #endif
  96. #if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H)
  97. #include <lasxintrin.h>
  98. #define __LASX__
  99. #endif
  100. #if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
  101. #include <immintrin.h>
  102. #else
  103. #if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
  104. #include <mmintrin.h>
  105. #endif
  106. #if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
  107. #include <xmmintrin.h>
  108. #endif
  109. #if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
  110. #include <emmintrin.h>
  111. #endif
  112. #if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
  113. #include <pmmintrin.h>
  114. #endif
  115. #endif /* HAVE_IMMINTRIN_H */
  116. #include "begin_code.h"
  117. /* Set up for C function definitions, even when using C++ */
  118. #ifdef __cplusplus
  119. extern "C" {
  120. #endif
  121. /* This is a guess for the cacheline size used for padding.
  122. * Most x86 processors have a 64 byte cache line.
  123. * The 64-bit PowerPC processors have a 128 byte cache line.
  124. * We'll use the larger value to be generally safe.
  125. */
  126. #define SDL_CACHELINE_SIZE 128
  127. /**
  128. * Get the number of CPU cores available.
  129. *
  130. * \returns the total number of logical CPU cores. On CPUs that include
  131. * technologies such as hyperthreading, the number of logical cores
  132. * may be more than the number of physical cores.
  133. *
  134. * \since This function is available since SDL 2.0.0.
  135. */
  136. extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
  137. /**
  138. * Determine the L1 cache line size of the CPU.
  139. *
  140. * This is useful for determining multi-threaded structure padding or SIMD
  141. * prefetch sizes.
  142. *
  143. * \returns the L1 cache line size of the CPU, in bytes.
  144. *
  145. * \since This function is available since SDL 2.0.0.
  146. */
  147. extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
  148. /**
  149. * Determine whether the CPU has the RDTSC instruction.
  150. *
  151. * This always returns false on CPUs that aren't using Intel instruction sets.
  152. *
  153. * \returns SDL_TRUE if the CPU has the RDTSC instruction or SDL_FALSE if not.
  154. *
  155. * \since This function is available since SDL 2.0.0.
  156. *
  157. * \sa SDL_Has3DNow
  158. * \sa SDL_HasAltiVec
  159. * \sa SDL_HasAVX
  160. * \sa SDL_HasAVX2
  161. * \sa SDL_HasMMX
  162. * \sa SDL_HasSSE
  163. * \sa SDL_HasSSE2
  164. * \sa SDL_HasSSE3
  165. * \sa SDL_HasSSE41
  166. * \sa SDL_HasSSE42
  167. */
  168. extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
  169. /**
  170. * Determine whether the CPU has AltiVec features.
  171. *
  172. * This always returns false on CPUs that aren't using PowerPC instruction
  173. * sets.
  174. *
  175. * \returns SDL_TRUE if the CPU has AltiVec features or SDL_FALSE if not.
  176. *
  177. * \since This function is available since SDL 2.0.0.
  178. *
  179. * \sa SDL_Has3DNow
  180. * \sa SDL_HasAVX
  181. * \sa SDL_HasAVX2
  182. * \sa SDL_HasMMX
  183. * \sa SDL_HasRDTSC
  184. * \sa SDL_HasSSE
  185. * \sa SDL_HasSSE2
  186. * \sa SDL_HasSSE3
  187. * \sa SDL_HasSSE41
  188. * \sa SDL_HasSSE42
  189. */
  190. extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
  191. /**
  192. * Determine whether the CPU has MMX features.
  193. *
  194. * This always returns false on CPUs that aren't using Intel instruction sets.
  195. *
  196. * \returns SDL_TRUE if the CPU has MMX features or SDL_FALSE if not.
  197. *
  198. * \since This function is available since SDL 2.0.0.
  199. *
  200. * \sa SDL_Has3DNow
  201. * \sa SDL_HasAltiVec
  202. * \sa SDL_HasAVX
  203. * \sa SDL_HasAVX2
  204. * \sa SDL_HasRDTSC
  205. * \sa SDL_HasSSE
  206. * \sa SDL_HasSSE2
  207. * \sa SDL_HasSSE3
  208. * \sa SDL_HasSSE41
  209. * \sa SDL_HasSSE42
  210. */
  211. extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
  212. /**
  213. * Determine whether the CPU has 3DNow! features.
  214. *
  215. * This always returns false on CPUs that aren't using AMD instruction sets.
  216. *
  217. * \returns SDL_TRUE if the CPU has 3DNow! features or SDL_FALSE if not.
  218. *
  219. * \since This function is available since SDL 2.0.0.
  220. *
  221. * \sa SDL_HasAltiVec
  222. * \sa SDL_HasAVX
  223. * \sa SDL_HasAVX2
  224. * \sa SDL_HasMMX
  225. * \sa SDL_HasRDTSC
  226. * \sa SDL_HasSSE
  227. * \sa SDL_HasSSE2
  228. * \sa SDL_HasSSE3
  229. * \sa SDL_HasSSE41
  230. * \sa SDL_HasSSE42
  231. */
  232. extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
  233. /**
  234. * Determine whether the CPU has SSE features.
  235. *
  236. * This always returns false on CPUs that aren't using Intel instruction sets.
  237. *
  238. * \returns SDL_TRUE if the CPU has SSE features or SDL_FALSE if not.
  239. *
  240. * \since This function is available since SDL 2.0.0.
  241. *
  242. * \sa SDL_Has3DNow
  243. * \sa SDL_HasAltiVec
  244. * \sa SDL_HasAVX
  245. * \sa SDL_HasAVX2
  246. * \sa SDL_HasMMX
  247. * \sa SDL_HasRDTSC
  248. * \sa SDL_HasSSE2
  249. * \sa SDL_HasSSE3
  250. * \sa SDL_HasSSE41
  251. * \sa SDL_HasSSE42
  252. */
  253. extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
  254. /**
  255. * Determine whether the CPU has SSE2 features.
  256. *
  257. * This always returns false on CPUs that aren't using Intel instruction sets.
  258. *
  259. * \returns SDL_TRUE if the CPU has SSE2 features or SDL_FALSE if not.
  260. *
  261. * \since This function is available since SDL 2.0.0.
  262. *
  263. * \sa SDL_Has3DNow
  264. * \sa SDL_HasAltiVec
  265. * \sa SDL_HasAVX
  266. * \sa SDL_HasAVX2
  267. * \sa SDL_HasMMX
  268. * \sa SDL_HasRDTSC
  269. * \sa SDL_HasSSE
  270. * \sa SDL_HasSSE3
  271. * \sa SDL_HasSSE41
  272. * \sa SDL_HasSSE42
  273. */
  274. extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
  275. /**
  276. * Determine whether the CPU has SSE3 features.
  277. *
  278. * This always returns false on CPUs that aren't using Intel instruction sets.
  279. *
  280. * \returns SDL_TRUE if the CPU has SSE3 features or SDL_FALSE if not.
  281. *
  282. * \since This function is available since SDL 2.0.0.
  283. *
  284. * \sa SDL_Has3DNow
  285. * \sa SDL_HasAltiVec
  286. * \sa SDL_HasAVX
  287. * \sa SDL_HasAVX2
  288. * \sa SDL_HasMMX
  289. * \sa SDL_HasRDTSC
  290. * \sa SDL_HasSSE
  291. * \sa SDL_HasSSE2
  292. * \sa SDL_HasSSE41
  293. * \sa SDL_HasSSE42
  294. */
  295. extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
  296. /**
  297. * Determine whether the CPU has SSE4.1 features.
  298. *
  299. * This always returns false on CPUs that aren't using Intel instruction sets.
  300. *
  301. * \returns SDL_TRUE if the CPU has SSE4.1 features or SDL_FALSE if not.
  302. *
  303. * \since This function is available since SDL 2.0.0.
  304. *
  305. * \sa SDL_Has3DNow
  306. * \sa SDL_HasAltiVec
  307. * \sa SDL_HasAVX
  308. * \sa SDL_HasAVX2
  309. * \sa SDL_HasMMX
  310. * \sa SDL_HasRDTSC
  311. * \sa SDL_HasSSE
  312. * \sa SDL_HasSSE2
  313. * \sa SDL_HasSSE3
  314. * \sa SDL_HasSSE42
  315. */
  316. extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
  317. /**
  318. * Determine whether the CPU has SSE4.2 features.
  319. *
  320. * This always returns false on CPUs that aren't using Intel instruction sets.
  321. *
  322. * \returns SDL_TRUE if the CPU has SSE4.2 features or SDL_FALSE if not.
  323. *
  324. * \since This function is available since SDL 2.0.0.
  325. *
  326. * \sa SDL_Has3DNow
  327. * \sa SDL_HasAltiVec
  328. * \sa SDL_HasAVX
  329. * \sa SDL_HasAVX2
  330. * \sa SDL_HasMMX
  331. * \sa SDL_HasRDTSC
  332. * \sa SDL_HasSSE
  333. * \sa SDL_HasSSE2
  334. * \sa SDL_HasSSE3
  335. * \sa SDL_HasSSE41
  336. */
  337. extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
  338. /**
  339. * Determine whether the CPU has AVX features.
  340. *
  341. * This always returns false on CPUs that aren't using Intel instruction sets.
  342. *
  343. * \returns SDL_TRUE if the CPU has AVX features or SDL_FALSE if not.
  344. *
  345. * \since This function is available since SDL 2.0.2.
  346. *
  347. * \sa SDL_Has3DNow
  348. * \sa SDL_HasAltiVec
  349. * \sa SDL_HasAVX2
  350. * \sa SDL_HasMMX
  351. * \sa SDL_HasRDTSC
  352. * \sa SDL_HasSSE
  353. * \sa SDL_HasSSE2
  354. * \sa SDL_HasSSE3
  355. * \sa SDL_HasSSE41
  356. * \sa SDL_HasSSE42
  357. */
  358. extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
  359. /**
  360. * Determine whether the CPU has AVX2 features.
  361. *
  362. * This always returns false on CPUs that aren't using Intel instruction sets.
  363. *
  364. * \returns SDL_TRUE if the CPU has AVX2 features or SDL_FALSE if not.
  365. *
  366. * \since This function is available since SDL 2.0.4.
  367. *
  368. * \sa SDL_Has3DNow
  369. * \sa SDL_HasAltiVec
  370. * \sa SDL_HasAVX
  371. * \sa SDL_HasMMX
  372. * \sa SDL_HasRDTSC
  373. * \sa SDL_HasSSE
  374. * \sa SDL_HasSSE2
  375. * \sa SDL_HasSSE3
  376. * \sa SDL_HasSSE41
  377. * \sa SDL_HasSSE42
  378. */
  379. extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
  380. /**
  381. * Determine whether the CPU has AVX-512F (foundation) features.
  382. *
  383. * This always returns false on CPUs that aren't using Intel instruction sets.
  384. *
  385. * \returns SDL_TRUE if the CPU has AVX-512F features or SDL_FALSE if not.
  386. *
  387. * \since This function is available since SDL 2.0.9.
  388. *
  389. * \sa SDL_HasAVX
  390. */
  391. extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
  392. /**
  393. * Determine whether the CPU has ARM SIMD (ARMv6) features.
  394. *
  395. * This is different from ARM NEON, which is a different instruction set.
  396. *
  397. * This always returns false on CPUs that aren't using ARM instruction sets.
  398. *
  399. * \returns SDL_TRUE if the CPU has ARM SIMD features or SDL_FALSE if not.
  400. *
  401. * \since This function is available since SDL 2.0.12.
  402. *
  403. * \sa SDL_HasNEON
  404. */
  405. extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
  406. /**
  407. * Determine whether the CPU has NEON (ARM SIMD) features.
  408. *
  409. * This always returns false on CPUs that aren't using ARM instruction sets.
  410. *
  411. * \returns SDL_TRUE if the CPU has ARM NEON features or SDL_FALSE if not.
  412. *
  413. * \since This function is available since SDL 2.0.6.
  414. */
  415. extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
  416. /**
  417. * Determine whether the CPU has LSX (LOONGARCH SIMD) features.
  418. *
  419. * This always returns false on CPUs that aren't using LOONGARCH instruction
  420. * sets.
  421. *
  422. * \returns SDL_TRUE if the CPU has LOONGARCH LSX features or SDL_FALSE if
  423. * not.
  424. *
  425. * \since This function is available since SDL 2.24.0.
  426. */
  427. extern DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void);
  428. /**
  429. * Determine whether the CPU has LASX (LOONGARCH SIMD) features.
  430. *
  431. * This always returns false on CPUs that aren't using LOONGARCH instruction
  432. * sets.
  433. *
  434. * \returns SDL_TRUE if the CPU has LOONGARCH LASX features or SDL_FALSE if
  435. * not.
  436. *
  437. * \since This function is available since SDL 2.24.0.
  438. */
  439. extern DECLSPEC SDL_bool SDLCALL SDL_HasLASX(void);
  440. /**
  441. * Get the amount of RAM configured in the system.
  442. *
  443. * \returns the amount of RAM configured in the system in MiB.
  444. *
  445. * \since This function is available since SDL 2.0.1.
  446. */
  447. extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
  448. /**
  449. * Report the alignment this system needs for SIMD allocations.
  450. *
  451. * This will return the minimum number of bytes to which a pointer must be
  452. * aligned to be compatible with SIMD instructions on the current machine. For
  453. * example, if the machine supports SSE only, it will return 16, but if it
  454. * supports AVX-512F, it'll return 64 (etc). This only reports values for
  455. * instruction sets SDL knows about, so if your SDL build doesn't have
  456. * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
  457. * not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
  458. * Plan accordingly.
  459. *
  460. * \returns the alignment in bytes needed for available, known SIMD
  461. * instructions.
  462. *
  463. * \since This function is available since SDL 2.0.10.
  464. */
  465. extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
  466. /**
  467. * Allocate memory in a SIMD-friendly way.
  468. *
  469. * This will allocate a block of memory that is suitable for use with SIMD
  470. * instructions. Specifically, it will be properly aligned and padded for the
  471. * system's supported vector instructions.
  472. *
  473. * The memory returned will be padded such that it is safe to read or write an
  474. * incomplete vector at the end of the memory block. This can be useful so you
  475. * don't have to drop back to a scalar fallback at the end of your SIMD
  476. * processing loop to deal with the final elements without overflowing the
  477. * allocated buffer.
  478. *
  479. * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() or
  480. * delete[], etc.
  481. *
  482. * Note that SDL will only deal with SIMD instruction sets it is aware of; for
  483. * example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and
  484. * AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants
  485. * 64. To be clear: if you can't decide to use an instruction set with an
  486. * SDL_Has*() function, don't use that instruction set with memory allocated
  487. * through here.
  488. *
  489. * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't
  490. * out of memory, but you are not allowed to dereference it (because you only
  491. * own zero bytes of that buffer).
  492. *
  493. * \param len The length, in bytes, of the block to allocate. The actual
  494. * allocated block might be larger due to padding, etc.
  495. * \returns a pointer to the newly-allocated block, NULL if out of memory.
  496. *
  497. * \since This function is available since SDL 2.0.10.
  498. *
  499. * \sa SDL_SIMDGetAlignment
  500. * \sa SDL_SIMDRealloc
  501. * \sa SDL_SIMDFree
  502. */
  503. extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
  504. /**
  505. * Reallocate memory obtained from SDL_SIMDAlloc
  506. *
  507. * It is not valid to use this function on a pointer from anything but
  508. * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
  509. * SDL_malloc, memalign, new[], etc.
  510. *
  511. * \param mem The pointer obtained from SDL_SIMDAlloc. This function also
  512. * accepts NULL, at which point this function is the same as
  513. * calling SDL_SIMDAlloc with a NULL pointer.
  514. * \param len The length, in bytes, of the block to allocated. The actual
  515. * allocated block might be larger due to padding, etc. Passing 0
  516. * will return a non-NULL pointer, assuming the system isn't out of
  517. * memory.
  518. * \returns a pointer to the newly-reallocated block, NULL if out of memory.
  519. *
  520. * \since This function is available since SDL 2.0.14.
  521. *
  522. * \sa SDL_SIMDGetAlignment
  523. * \sa SDL_SIMDAlloc
  524. * \sa SDL_SIMDFree
  525. */
  526. extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len);
  527. /**
  528. * Deallocate memory obtained from SDL_SIMDAlloc
  529. *
  530. * It is not valid to use this function on a pointer from anything but
  531. * SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from
  532. * malloc, realloc, SDL_malloc, memalign, new[], etc.
  533. *
  534. * However, SDL_SIMDFree(NULL) is a legal no-op.
  535. *
  536. * The memory pointed to by `ptr` is no longer valid for access upon return,
  537. * and may be returned to the system or reused by a future allocation. The
  538. * pointer passed to this function is no longer safe to dereference once this
  539. * function returns, and should be discarded.
  540. *
  541. * \param ptr The pointer, returned from SDL_SIMDAlloc or SDL_SIMDRealloc, to
  542. * deallocate. NULL is a legal no-op.
  543. *
  544. * \since This function is available since SDL 2.0.10.
  545. *
  546. * \sa SDL_SIMDAlloc
  547. * \sa SDL_SIMDRealloc
  548. */
  549. extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
  550. /* Ends C function definitions when using C++ */
  551. #ifdef __cplusplus
  552. }
  553. #endif
  554. #include "close_code.h"
  555. #endif /* SDL_cpuinfo_h_ */
  556. /* vi: set ts=4 sw=4 expandtab: */