Author: mgorny
Date: Fri Apr 26 06:21:58 2019
New Revision: 359304

URL: http://llvm.org/viewvc/llvm-project?rev=359304&view=rev
Log:
[lldb] [lit] Add register read tests for YMM registers (AVX)

Differential Revision: https://reviews.llvm.org/D61074

Added:
    lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp
    lldb/trunk/lit/Register/x86-64-ymm-read.test
    lldb/trunk/lit/Register/x86-ymm-read.test
Modified:
    lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp

Added: lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp?rev=359304&view=auto
==============================================================================
--- lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp (added)
+++ lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp Fri Apr 26 06:21:58 2019
@@ -0,0 +1,81 @@
+#include <cstdint>
+
+struct alignas(32) ymm_t {
+  uint64_t a, b, c, d;
+};
+
+int main() {
+  constexpr ymm_t ymm0 = { 0x020406080A0C0E01, 0x030507090B0D0F00,
+                           0x838587898B8D8F80, 0x828486888A8C8E81 };
+  constexpr ymm_t ymm1 = { 0x121416181A1C1E11, 0x131517191B1D1F10,
+                           0x939597999B9D9F90, 0x929496989A9C9E91 };
+  constexpr ymm_t ymm2 = { 0x222426282A2C2E21, 0x232527292B2D2F20,
+                           0xA3A5A7A9ABADAFA0, 0xA2A4A6A8AAACAEA1 };
+  constexpr ymm_t ymm3 = { 0x323436383A3C3E31, 0x333537393B3D3F30,
+                           0xB3B5B7B9BBBDBFB0, 0xB2B4B6B8BABCBEB1 };
+  constexpr ymm_t ymm4 = { 0x424446484A4C4E41, 0x434547494B4D4F40,
+                           0xC3C5C7C9CBCDCFC0, 0xC2C4C6C8CACCCEC1 };
+  constexpr ymm_t ymm5 = { 0x525456585A5C5E51, 0x535557595B5D5F50,
+                           0xD3D5D7D9DBDDDFD0, 0xD2D4D6D8DADCDED1 };
+  constexpr ymm_t ymm6 = { 0x626466686A6C6E61, 0x636567696B6D6F60,
+                           0xE3E5E7E9EBEDEFE0, 0xE2E4E6E8EAECEEE1 };
+  constexpr ymm_t ymm7 = { 0x727476787A7C7E71, 0x737577797B7D7F70,
+                           0xF3F5F7F9FBFDFFF0, 0xF2F4F6F8FAFCFEF1 };
+#if defined(__x86_64__) || defined(_M_X64)
+  constexpr ymm_t ymm8 = { 0x838587898B8D8F80, 0x828486888A8C8E81,
+                           0x020406080A0C0E01, 0x030507090B0D0F00 };
+  constexpr ymm_t ymm9 = { 0x939597999B9D9F90, 0x929496989A9C9E91,
+                           0x121416181A1C1E11, 0x131517191B1D1F10 };
+  constexpr ymm_t ymm10 = { 0xA3A5A7A9ABADAFA0, 0xA2A4A6A8AAACAEA1,
+                            0x222426282A2C2E21, 0x232527292B2D2F20 };
+  constexpr ymm_t ymm11 = { 0xB3B5B7B9BBBDBFB0, 0xB2B4B6B8BABCBEB1,
+                            0x323436383A3C3E31, 0x333537393B3D3F30 };
+  constexpr ymm_t ymm12 = { 0xC3C5C7C9CBCDCFC0, 0xC2C4C6C8CACCCEC1,
+                            0x424446484A4C4E41, 0x434547494B4D4F40 };
+  constexpr ymm_t ymm13 = { 0xD3D5D7D9DBDDDFD0, 0xD2D4D6D8DADCDED1,
+                            0x525456585A5C5E51, 0x535557595B5D5F50 };
+  constexpr ymm_t ymm14 = { 0xE3E5E7E9EBEDEFE0, 0xE2E4E6E8EAECEEE1,
+                            0x626466686A6C6E61, 0x636567696B6D6F60 };
+  constexpr ymm_t ymm15 = { 0xF3F5F7F9FBFDFFF0, 0xF2F4F6F8FAFCFEF1,
+                            0x727476787A7C7E71, 0x737577797B7D7F70 };
+#endif
+
+  asm volatile(
+    "vmovaps  %0, %%ymm0\n\t"
+    "vmovaps  %1, %%ymm1\n\t"
+    "vmovaps  %2, %%ymm2\n\t"
+    "vmovaps  %3, %%ymm3\n\t"
+    "vmovaps  %4, %%ymm4\n\t"
+    "vmovaps  %5, %%ymm5\n\t"
+    "vmovaps  %6, %%ymm6\n\t"
+    "vmovaps  %7, %%ymm7\n\t"
+#if defined(__x86_64__) || defined(_M_X64)
+    "vmovaps  %8, %%ymm8\n\t"
+    "vmovaps  %9, %%ymm9\n\t"
+    "vmovaps  %10, %%ymm10\n\t"
+    "vmovaps  %11, %%ymm11\n\t"
+    "vmovaps  %12, %%ymm12\n\t"
+    "vmovaps  %13, %%ymm13\n\t"
+    "vmovaps  %14, %%ymm14\n\t"
+    "vmovaps  %15, %%ymm15\n\t"
+#endif
+    "\n\t"
+    "int3"
+    :
+    : "m"(ymm0), "m"(ymm1), "m"(ymm2), "m"(ymm3), "m"(ymm4), "m"(ymm5),
+      "m"(ymm6), "m"(ymm7)
+#if defined(__x86_64__) || defined(_M_X64)
+      ,
+      "m"(ymm8), "m"(ymm9), "m"(ymm10), "m"(ymm11),
+      "m"(ymm12), "m"(ymm13), "m"(ymm14), "m"(ymm15)
+#endif
+    : "%ymm0", "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5", "%ymm6", "%ymm7"
+#if defined(__x86_64__) || defined(_M_X64)
+      ,
+      "%ymm8", "%ymm9", "%ymm10", "%ymm11", "%ymm12", "%ymm13", "%ymm14",
+      "%ymm15"
+#endif
+  );
+
+  return 0;
+}

Added: lldb/trunk/lit/Register/x86-64-ymm-read.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-64-ymm-read.test?rev=359304&view=auto
==============================================================================
--- lldb/trunk/lit/Register/x86-64-ymm-read.test (added)
+++ lldb/trunk/lit/Register/x86-64-ymm-read.test Fri Apr 26 06:21:58 2019
@@ -0,0 +1,39 @@
+# XFAIL: system-windows
+# REQUIRES: native && target-x86_64 && native-cpu-avx
+# RUN: %clangxx %p/Inputs/x86-ymm-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read --all
+# CHECK-DAG: xmm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 
0x0b 0x09 0x07 0x05 0x03}
+# CHECK-DAG: xmm1 = {0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 
0x1b 0x19 0x17 0x15 0x13}
+# CHECK-DAG: xmm2 = {0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 
0x2b 0x29 0x27 0x25 0x23}
+# CHECK-DAG: xmm3 = {0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 
0x3b 0x39 0x37 0x35 0x33}
+# CHECK-DAG: xmm4 = {0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 
0x4b 0x49 0x47 0x45 0x43}
+# CHECK-DAG: xmm5 = {0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 
0x5b 0x59 0x57 0x55 0x53}
+# CHECK-DAG: xmm6 = {0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 
0x6b 0x69 0x67 0x65 0x63}
+# CHECK-DAG: xmm7 = {0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 
0x7b 0x79 0x77 0x75 0x73}
+# CHECK-DAG: xmm8 = {0x80 0x8f 0x8d 0x8b 0x89 0x87 0x85 0x83 0x81 0x8e 0x8c 
0x8a 0x88 0x86 0x84 0x82}
+# CHECK-DAG: xmm9 = {0x90 0x9f 0x9d 0x9b 0x99 0x97 0x95 0x93 0x91 0x9e 0x9c 
0x9a 0x98 0x96 0x94 0x92}
+# CHECK-DAG: xmm10 = {0xa0 0xaf 0xad 0xab 0xa9 0xa7 0xa5 0xa3 0xa1 0xae 0xac 
0xaa 0xa8 0xa6 0xa4 0xa2}
+# CHECK-DAG: xmm11 = {0xb0 0xbf 0xbd 0xbb 0xb9 0xb7 0xb5 0xb3 0xb1 0xbe 0xbc 
0xba 0xb8 0xb6 0xb4 0xb2}
+# CHECK-DAG: xmm12 = {0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 
0xca 0xc8 0xc6 0xc4 0xc2}
+# CHECK-DAG: xmm13 = {0xd0 0xdf 0xdd 0xdb 0xd9 0xd7 0xd5 0xd3 0xd1 0xde 0xdc 
0xda 0xd8 0xd6 0xd4 0xd2}
+# CHECK-DAG: xmm14 = {0xe0 0xef 0xed 0xeb 0xe9 0xe7 0xe5 0xe3 0xe1 0xee 0xec 
0xea 0xe8 0xe6 0xe4 0xe2}
+# CHECK-DAG: xmm15 = {0xf0 0xff 0xfd 0xfb 0xf9 0xf7 0xf5 0xf3 0xf1 0xfe 0xfc 
0xfa 0xf8 0xf6 0xf4 0xf2}
+# CHECK-DAG: ymm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 
0x0b 0x09 0x07 0x05 0x03 0x80 0x8f 0x8d 0x8b 0x89 0x87 0x85 0x83 0x81 0x8e 0x8c 
0x8a 0x88 0x86 0x84 0x82}
+# CHECK-DAG: ymm1 = {0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 
0x1b 0x19 0x17 0x15 0x13 0x90 0x9f 0x9d 0x9b 0x99 0x97 0x95 0x93 0x91 0x9e 0x9c 
0x9a 0x98 0x96 0x94 0x92}
+# CHECK-DAG: ymm2 = {0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 
0x2b 0x29 0x27 0x25 0x23 0xa0 0xaf 0xad 0xab 0xa9 0xa7 0xa5 0xa3 0xa1 0xae 0xac 
0xaa 0xa8 0xa6 0xa4 0xa2}
+# CHECK-DAG: ymm3 = {0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 
0x3b 0x39 0x37 0x35 0x33 0xb0 0xbf 0xbd 0xbb 0xb9 0xb7 0xb5 0xb3 0xb1 0xbe 0xbc 
0xba 0xb8 0xb6 0xb4 0xb2}
+# CHECK-DAG: ymm4 = {0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 
0x4b 0x49 0x47 0x45 0x43 0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 
0xca 0xc8 0xc6 0xc4 0xc2}
+# CHECK-DAG: ymm5 = {0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 
0x5b 0x59 0x57 0x55 0x53 0xd0 0xdf 0xdd 0xdb 0xd9 0xd7 0xd5 0xd3 0xd1 0xde 0xdc 
0xda 0xd8 0xd6 0xd4 0xd2}
+# CHECK-DAG: ymm6 = {0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 
0x6b 0x69 0x67 0x65 0x63 0xe0 0xef 0xed 0xeb 0xe9 0xe7 0xe5 0xe3 0xe1 0xee 0xec 
0xea 0xe8 0xe6 0xe4 0xe2}
+# CHECK-DAG: ymm7 = {0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 
0x7b 0x79 0x77 0x75 0x73 0xf0 0xff 0xfd 0xfb 0xf9 0xf7 0xf5 0xf3 0xf1 0xfe 0xfc 
0xfa 0xf8 0xf6 0xf4 0xf2}
+# CHECK-DAG: ymm8 = {0x80 0x8f 0x8d 0x8b 0x89 0x87 0x85 0x83 0x81 0x8e 0x8c 
0x8a 0x88 0x86 0x84 0x82 0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 
0x0b 0x09 0x07 0x05 0x03}
+# CHECK-DAG: ymm9 = {0x90 0x9f 0x9d 0x9b 0x99 0x97 0x95 0x93 0x91 0x9e 0x9c 
0x9a 0x98 0x96 0x94 0x92 0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 
0x1b 0x19 0x17 0x15 0x13}
+# CHECK-DAG: ymm10 = {0xa0 0xaf 0xad 0xab 0xa9 0xa7 0xa5 0xa3 0xa1 0xae 0xac 
0xaa 0xa8 0xa6 0xa4 0xa2 0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 
0x2b 0x29 0x27 0x25 0x23}
+# CHECK-DAG: ymm11 = {0xb0 0xbf 0xbd 0xbb 0xb9 0xb7 0xb5 0xb3 0xb1 0xbe 0xbc 
0xba 0xb8 0xb6 0xb4 0xb2 0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 
0x3b 0x39 0x37 0x35 0x33}
+# CHECK-DAG: ymm12 = {0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 
0xca 0xc8 0xc6 0xc4 0xc2 0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 
0x4b 0x49 0x47 0x45 0x43}
+# CHECK-DAG: ymm13 = {0xd0 0xdf 0xdd 0xdb 0xd9 0xd7 0xd5 0xd3 0xd1 0xde 0xdc 
0xda 0xd8 0xd6 0xd4 0xd2 0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 
0x5b 0x59 0x57 0x55 0x53}
+# CHECK-DAG: ymm14 = {0xe0 0xef 0xed 0xeb 0xe9 0xe7 0xe5 0xe3 0xe1 0xee 0xec 
0xea 0xe8 0xe6 0xe4 0xe2 0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 
0x6b 0x69 0x67 0x65 0x63}
+# CHECK-DAG: ymm15 = {0xf0 0xff 0xfd 0xfb 0xf9 0xf7 0xf5 0xf3 0xf1 0xfe 0xfc 
0xfa 0xf8 0xf6 0xf4 0xf2 0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 
0x7b 0x79 0x77 0x75 0x73}

Added: lldb/trunk/lit/Register/x86-ymm-read.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-ymm-read.test?rev=359304&view=auto
==============================================================================
--- lldb/trunk/lit/Register/x86-ymm-read.test (added)
+++ lldb/trunk/lit/Register/x86-ymm-read.test Fri Apr 26 06:21:58 2019
@@ -0,0 +1,23 @@
+# XFAIL: system-windows
+# REQUIRES: native && target-x86 && native-cpu-avx
+# RUN: %clangxx %p/Inputs/x86-ymm-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read --all
+# CHECK-DAG: xmm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 
0x0b 0x09 0x07 0x05 0x03}
+# CHECK-DAG: xmm1 = {0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 
0x1b 0x19 0x17 0x15 0x13}
+# CHECK-DAG: xmm2 = {0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 
0x2b 0x29 0x27 0x25 0x23}
+# CHECK-DAG: xmm3 = {0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 
0x3b 0x39 0x37 0x35 0x33}
+# CHECK-DAG: xmm4 = {0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 
0x4b 0x49 0x47 0x45 0x43}
+# CHECK-DAG: xmm5 = {0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 
0x5b 0x59 0x57 0x55 0x53}
+# CHECK-DAG: xmm6 = {0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 
0x6b 0x69 0x67 0x65 0x63}
+# CHECK-DAG: xmm7 = {0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 
0x7b 0x79 0x77 0x75 0x73}
+# CHECK-DAG: ymm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 
0x0b 0x09 0x07 0x05 0x03 0x80 0x8f 0x8d 0x8b 0x89 0x87 0x85 0x83 0x81 0x8e 0x8c 
0x8a 0x88 0x86 0x84 0x82}
+# CHECK-DAG: ymm1 = {0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 
0x1b 0x19 0x17 0x15 0x13 0x90 0x9f 0x9d 0x9b 0x99 0x97 0x95 0x93 0x91 0x9e 0x9c 
0x9a 0x98 0x96 0x94 0x92}
+# CHECK-DAG: ymm2 = {0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 
0x2b 0x29 0x27 0x25 0x23 0xa0 0xaf 0xad 0xab 0xa9 0xa7 0xa5 0xa3 0xa1 0xae 0xac 
0xaa 0xa8 0xa6 0xa4 0xa2}
+# CHECK-DAG: ymm3 = {0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 
0x3b 0x39 0x37 0x35 0x33 0xb0 0xbf 0xbd 0xbb 0xb9 0xb7 0xb5 0xb3 0xb1 0xbe 0xbc 
0xba 0xb8 0xb6 0xb4 0xb2}
+# CHECK-DAG: ymm4 = {0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 
0x4b 0x49 0x47 0x45 0x43 0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 
0xca 0xc8 0xc6 0xc4 0xc2}
+# CHECK-DAG: ymm5 = {0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 
0x5b 0x59 0x57 0x55 0x53 0xd0 0xdf 0xdd 0xdb 0xd9 0xd7 0xd5 0xd3 0xd1 0xde 0xdc 
0xda 0xd8 0xd6 0xd4 0xd2}
+# CHECK-DAG: ymm6 = {0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 
0x6b 0x69 0x67 0x65 0x63 0xe0 0xef 0xed 0xeb 0xe9 0xe7 0xe5 0xe3 0xe1 0xee 0xec 
0xea 0xe8 0xe6 0xe4 0xe2}
+# CHECK-DAG: ymm7 = {0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 
0x7b 0x79 0x77 0x75 0x73 0xf0 0xff 0xfd 0xfb 0xf9 0xf7 0xf5 0xf3 0xf1 0xfe 0xfc 
0xfa 0xf8 0xf6 0xf4 0xf2}

Modified: lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp?rev=359304&r1=359303&r2=359304&view=diff
==============================================================================
--- lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp (original)
+++ lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp Fri Apr 26 06:21:58 2019
@@ -27,6 +27,8 @@ int main(int argc, char **argv) {
 
   if (features["sse"])
     outs() << "sse\n";
+  if (features["avx"])
+    outs() << "avx\n";
 #endif
 
   return 0;


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to