[Lldb-commits] [PATCH] D41962: Fix TestYMMRegisters for older machines without AVX2

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 12 01:31:50 PST 2018


labath added a comment.

In https://reviews.llvm.org/D41962#973827, @craig.topper wrote:

> I don't know what platforms this needs to support. But __builtin_cpu_support only works when compiled with clang or gcc. And it requires compiler-rt or libgcc. I don't know if that's guaranteed to exist on Windows.


I doubt this test was ever passing on windows, as our RegisterContextWindows does not even acknowledge the existence of sse registers. If we wanted to be fancy, we could do some manual cpuid parsing here (the test contains inline assembly anyway), but that's probably not necessary.



================
Comment at: packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c:21
+  static volatile unsigned haveAVX2;
+  haveAVX2 = __builtin_cpu_supports("avx2");
   unsigned int ymmallones = 0xFFFFFFFF;
----------------
lebedev.ri wrote:
> Note that you need to call `__builtin_cpu_init()` before calling `__builtin_cpu_supports()`.
> Or maybe it is already called before this?
Gcc manual says:
```This built-in (__builtin_cpu_init) function needs to be invoked ..., only when used in a function that is executed before any constructors are called. ```

So calling it here should not be necessary. 

However, I am still unable to get gcc (6.3) to return 1 here. Clang (since at least 3.8) seems to be doing fine however, so that's probably enough for this test.


Repository:
  rL LLVM

https://reviews.llvm.org/D41962





More information about the lldb-commits mailing list