util: Add ssse3 and avx cpu caps override option
authorYonggang Luo <luoyonggang@gmail.com>
Sat, 27 Aug 2022 06:32:48 +0000 (14:32 +0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 01:51:42 +0000 (01:51 +0000)
llvmpipe can use these options to testing ssse3 and avx on cpus that support for avx512

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17813>

src/gallium/tests/unit/translate_test.c
src/util/u_cpu_detect.c

index 823aa68..717b753 100644 (file)
@@ -79,7 +79,7 @@ int main(int argc, char** argv)
    else
    {
       const char *translate_options[] = {
-         "nosse", "sse", "sse2", "sse3", "sse4.1",
+         "nosse", "sse", "sse2", "sse3", "ssse3", "sse4.1", "avx",
          NULL
       };
       const char **option;
@@ -99,7 +99,7 @@ int main(int argc, char** argv)
 
    if (!create_fn)
    {
-      printf("Usage: ./translate_test [default|generic|x86|nosse|sse|sse2|sse3|sse4.1]\n");
+      printf("Usage: ./translate_test [default|generic|x86|nosse|sse|sse2|sse3|ssse3|sse4.1|avx]\n");
       return 2;
    }
 
index 9fc1e64..9282a73 100644 (file)
@@ -615,9 +615,13 @@ void check_cpu_caps_override(void)
       } else if (!strcmp(override_cpu_caps, "sse2")) {
          util_cpu_caps.has_sse3 = 0;
       } else if (!strcmp(override_cpu_caps, "sse3")) {
+         util_cpu_caps.has_ssse3 = 0;
+      } else if (!strcmp(override_cpu_caps, "ssse3")) {
          util_cpu_caps.has_sse4_1 = 0;
       } else if (!strcmp(override_cpu_caps, "sse4.1")) {
          util_cpu_caps.has_avx = 0;
+      } else if (!strcmp(override_cpu_caps, "avx")) {
+         util_cpu_caps.has_avx512f = 0;
       }
 #endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */
    }
@@ -631,6 +635,8 @@ void check_cpu_caps_override(void)
    }
    if (!util_cpu_caps.has_sse3) {
       util_cpu_caps.has_ssse3 = 0;
+   }
+   if (!util_cpu_caps.has_ssse3) {
       util_cpu_caps.has_sse4_1 = 0;
    }
    if (!util_cpu_caps.has_sse4_1) {
@@ -641,9 +647,10 @@ void check_cpu_caps_override(void)
       util_cpu_caps.has_avx2 = 0;
       util_cpu_caps.has_f16c = 0;
       util_cpu_caps.has_fma = 0;
-
+      util_cpu_caps.has_avx512f = 0;
+   }
+   if (!util_cpu_caps.has_avx512f) {
       /* avx512 are cleared */
-      util_cpu_caps.has_avx512f    = 0;
       util_cpu_caps.has_avx512dq   = 0;
       util_cpu_caps.has_avx512ifma = 0;
       util_cpu_caps.has_avx512pf   = 0;