SDL_cpuinfo.h 17 KB

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