From: Andreas Beckmann Date: Mon, 14 Aug 2023 10:17:57 +0000 (+0200) Subject: [PATCH 235/240] add i386 distro builds for i386, i686, mmx, sse X-Git-Tag: archive/raspbian/4.0-3+rpi1^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=560a9347ec348e049109761f95c05aa41c94685a;p=pocl.git [PATCH 235/240] add i386 distro builds for i386, i686, mmx, sse Gbp-Pq: Name 0235-add-i386-distro-builds-for-i386-i686-mmx-sse.patch --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 11bc238..7ccd141 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/lib/CL/pocl_llvm_utils.cc b/lib/CL/pocl_llvm_utils.cc index 61cd41e..3c85061 100644 --- a/lib/CL/pocl_llvm_utils.cc +++ b/lib/CL/pocl_llvm_utils.cc @@ -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}, diff --git a/lib/kernel/host/CMakeLists.txt b/lib/kernel/host/CMakeLists.txt index 6caef5a..3ad332b 100644 --- a/lib/kernel/host/CMakeLists.txt +++ b/lib/kernel/host/CMakeLists.txt @@ -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")