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

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 12 09:08:21 PST 2018


aprantl updated this revision to Diff 129639.
aprantl added a comment.

Uploaded a mildly better version that is NFC on MSVC.


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
@@ -6,7 +6,6 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-
 void func() {
   unsigned int ymmvalues[16];
   unsigned char val;
@@ -17,6 +16,14 @@
     ymmvalues[i] = (val << 24) | (val << 16) | (val << 8) | val;
   }
 
+  // Detect AVX2.
+  static volatile unsigned haveAVX2;
+#ifdef _MSC_VER
+  haveAVX2 = 1; // TODO: Implement this for MSVC.
+#else
+  haveAVX2 = __builtin_cpu_supports("avx2");
+#endif
+
   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.129639.patch
Type: text/x-patch
Size: 1581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180112/fa316737/attachment.bin>


More information about the lldb-commits mailing list