Add loongarch support

LSX and LASX are enabled by default if compiler supports them.
This commit is contained in:
yuanhecai
2022-05-31 19:10:05 +08:00
committed by Sam Lantinga
parent 9703f23663
commit 17f63e53f8
5 changed files with 268 additions and 0 deletions

View File

@@ -229,6 +229,8 @@
#undef HAVE_LIBUDEV_H
#undef HAVE_LIBSAMPLERATE_H
#undef HAVE_LIBDECOR_H
#undef HAVE_LSXINTRIN_H
#undef HAVE_LASXINTRIN_H
#undef HAVE_DDRAW_H
#undef HAVE_DINPUT_H

View File

@@ -98,6 +98,14 @@ _m_prefetch(void *__P)
#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
#include <mm3dnow.h>
#endif
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H)
#include <lsxintrin.h>
#define __LSX__
#endif
#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H)
#include <lasxintrin.h>
#define __LASX__
#endif
#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
#include <immintrin.h>
#else
@@ -433,6 +441,28 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
/**
* Determine whether the CPU has LSX (LOONGARCH SIMD) features.
*
* This always returns false on CPUs that aren't using LOONGARCH instruction sets.
*
* \returns SDL_TRUE if the CPU has LOONGARCH LSX features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.23.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void);
/**
* Determine whether the CPU has LASX (LOONGARCH SIMD) features.
*
* This always returns false on CPUs that aren't using LOONGARCH instruction sets.
*
* \returns SDL_TRUE if the CPU has LOONGARCH LASX features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.23.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasLASX(void);
/**
* Get the amount of RAM configured in the system.
*