SDL: Add testcpuinfo.c

From 5888b008b1af17f6a0ea5f3c0c793e44dfd9c767 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Wed, 1 Feb 2023 23:34:37 +0100
Subject: [PATCH] Add testcpuinfo.c

---
 test/CMakeLists.txt |  1 +
 test/testcpuinfo.c  | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 test/testcpuinfo.c

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e8bb837f108b..65647f697b12 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -174,6 +174,7 @@ elseif(HAVE_X11)
     target_link_libraries(testnative PRIVATE X11)
 endif()
 
+add_sdl_test_executable(testcpuinfo testcpuinfo.c)
 add_sdl_test_executable(testoverlay NEEDS_RESOURCES TESTUTILS testoverlay.c)
 add_sdl_test_executable(testplatform NONINTERACTIVE testplatform.c)
 add_sdl_test_executable(testpower NONINTERACTIVE testpower.c)
diff --git a/test/testcpuinfo.c b/test/testcpuinfo.c
new file mode 100644
index 000000000000..f454a867a297
--- /dev/null
+++ b/test/testcpuinfo.c
@@ -0,0 +1,29 @@
+#include <SDL3/SDL.h>
+
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+    (void)argc;
+    (void)argv;
+
+    printf("     CPU count : %d\n", SDL_GetCPUCount());
+    printf("CacheLine size : %d\n", SDL_GetCPUCacheLineSize());
+    printf("         RDTSC : %d\n", SDL_HasRDTSC());
+    printf("       Altivec : %d\n", SDL_HasAltiVec());
+    printf("           MMX : %d\n", SDL_HasMMX());
+    printf("           SSE : %d\n", SDL_HasSSE());
+    printf("          SSE2 : %d\n", SDL_HasSSE2());
+    printf("          SSE3 : %d\n", SDL_HasSSE3());
+    printf("        SSE4.1 : %d\n", SDL_HasSSE41());
+    printf("        SSE4.2 : %d\n", SDL_HasSSE42());
+    printf("           AVX : %d\n", SDL_HasAVX());
+    printf("          AVX2 : %d\n", SDL_HasAVX2());
+    printf("      AVX-512F : %d\n", SDL_HasAVX512F());
+    printf("      ARM SIMD : %d\n", SDL_HasARMSIMD());
+    printf("          NEON : %d\n", SDL_HasNEON());
+    printf("           LSX : %d\n", SDL_HasLSX());
+    printf("          LASX : %d\n", SDL_HasLASX());
+    printf("           RAM : %d MB\n", SDL_GetSystemRAM());
+    return 0;
+}