[PATCH 235/240] add i386 distro builds for i386, i686, mmx, sse
authorAndreas Beckmann <anbe@debian.org>
Mon, 14 Aug 2023 10:17:57 +0000 (12:17 +0200)
committerAndreas Beckmann <anbe@debian.org>
Tue, 12 Dec 2023 15:33:19 +0000 (16:33 +0100)
Gbp-Pq: Name 0235-add-i386-distro-builds-for-i386-i686-mmx-sse.patch

CMakeLists.txt
lib/CL/pocl_llvm_utils.cc
lib/kernel/host/CMakeLists.txt

index 11bc2382c9ac673e6cd0d6517303d03335cd4ebc..7ccd1417ccb93f4055af86ae63cb113b39dec69e 100644 (file)
@@ -1365,6 +1365,9 @@ if(KERNELLIB_HOST_CPU_VARIANTS STREQUAL "distro")
   endif()
   if(X86_64 OR I386)
     set(KERNELLIB_HOST_CPU_VARIANTS sse2 ssse3 sse41 avx avx_f16c avx_fma4 avx2 avx512)
+    if(I386)
+      set(KERNELLIB_HOST_CPU_VARIANTS i386 i686 mmx sse ${KERNELLIB_HOST_CPU_VARIANTS})
+    endif()
   elseif(POWERPC64LE)
     set(KERNELLIB_HOST_CPU_VARIANTS pwr8 pwr9)
   elseif(APPLE AND ARM64)
index 61cd41e63f00289aca2e4df91b8ee786a6b2ebe5..3c8506131db9f9003faf2b955372cb705a402de1 100644 (file)
@@ -166,7 +166,22 @@ const struct kernellib_features {
 } kernellib_feature_map[] = {
 // order the entries s.t. if a cpu matches multiple entries, the "best" match
 // comes last
-#if defined(__x86_64__)
+#if defined(__i386__)
+    "i386",
+    "i386",
+    {NULL},
+    // FIXME: Can we distinguish i686 from i386 using feature flags?
+    "i686",
+    "i686",
+    {NULL},
+    "mmx",
+    "pentium-mmx",
+    {"mmx", NULL},
+    "sse",
+    "pentium3",
+    {"sse", NULL},
+#endif
+#if defined(__i386__) || defined(__x86_64__)
     "sse2",
     "athlon64",
     {"sse2", NULL},
index 6caef5a48922c4e3f83361c90ed3a93a31f7ceae..3ad332bb9d1fa49467c995fb5cc23e6d4b7c210b 100644 (file)
@@ -381,7 +381,23 @@ separate_arguments(DEVICE_C_FLAGS)
 
 function(x86_distro_variant_to_flags VARIANT OUT_LLC_FLAGS OUT_CLANG_FLAGS)
 
-  if("${VARIANT}" STREQUAL "sse2")
+  if("${VARIANT}" STREQUAL "i386")
+    set(CLANG_F "${CLANG_MARCH_FLAG}i386")
+    set(LLC_F "-mcpu=i386")
+
+  elseif("${VARIANT}" STREQUAL "i686")
+    set(CLANG_F "${CLANG_MARCH_FLAG}i686")
+    set(LLC_F "-mcpu=i686")
+
+  elseif("${VARIANT}" STREQUAL "mmx")
+    set(CLANG_F "${CLANG_MARCH_FLAG}pentium-mmx")
+    set(LLC_F "-mcpu=pentium-mmx")
+
+  elseif("${VARIANT}" STREQUAL "sse")
+    set(CLANG_F "${CLANG_MARCH_FLAG}pentium3")
+    set(LLC_F "-mcpu=pentium3")
+
+  elseif("${VARIANT}" STREQUAL "sse2")
     set(CLANG_F "${CLANG_MARCH_FLAG}athlon64")
     set(LLC_F "-mcpu=athlon64")