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

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 11 13:25:21 PST 2018


aprantl created this revision.
aprantl added reviewers: jasonmolenda, jingham.
Herald added a subscriber: llvm-commits.

I found a cheap and cross-platform way of detecting whether the target supports AVX2.


Repository:
  rL LLVM

https://reviews.llvm.org/D41962

Files:
  packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
  packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c


Index: packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c
===================================================================
--- packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c
+++ packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c
@@ -17,6 +17,8 @@
     ymmvalues[i] = (val << 24) | (val << 16) | (val << 8) | val;
   }
 
+  static volatile unsigned haveAVX2;
+  haveAVX2 = __builtin_cpu_supports("avx2");
   unsigned int ymmallones = 0xFFFFFFFF;
   __asm__("int3;"
           "vbroadcastss %1, %%ymm0;"
Index: packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
+++ packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
@@ -51,6 +51,10 @@
                 break
         self.assertTrue(matched, STOPPED_DUE_TO_SIGNAL)
 
+        # Detect AVX2 support and early exit otherwise.
+        if self.frame().FindVariable("haveAVX2").GetValue() == 0:
+          return False
+
         if self.getArchitecture() == 'x86_64':
             register_range = 16
         else:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41962.129506.patch
Type: text/x-patch
Size: 1260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180111/3714406d/attachment.bin>


More information about the lldb-commits mailing list