util: don't try to emit half-float intrinsics if avx isn't available
authorRoland Scheidegger <sroland@vmware.com>
Fri, 19 Sep 2014 14:56:04 +0000 (16:56 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Fri, 19 Sep 2014 14:58:28 +0000 (16:58 +0200)
These instructions only have vex encodings, thus they can't be used without
avx. (Technically, one can still use avx-128 if avx isn't available because
the environment doesn't store the ymm registers, however I don't think llvm
can.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/util/u_cpu_detect.c

index d2d1313f8e932458b97ebab7745a50feda96950c..5d9db59d16b76bb1fd330b85742eb06d2574cfeb 100644 (file)
@@ -369,7 +369,7 @@ util_cpu_detect(void)
          util_cpu_caps.has_avx    = ((regs2[2] >> 28) & 1) && // AVX
                                     ((regs2[2] >> 27) & 1) && // OSXSAVE
                                     ((xgetbv() & 6) == 6);    // XMM & YMM
-         util_cpu_caps.has_f16c   = (regs2[2] >> 29) & 1;
+         util_cpu_caps.has_f16c   = ((regs2[2] >> 29) & 1) && util_cpu_caps.has_avx;
          util_cpu_caps.has_mmx2   = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
 #if defined(PIPE_ARCH_X86_64)
          util_cpu_caps.has_daz = 1;