diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-09 19:22:02 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-09 19:22:02 +0000 |
| commit | 87aa9c9e4d41ed881453e2fab85b3d25f648bb55 (patch) | |
| tree | 63efe79832bf3de4f63e4e81c62e73923947b882 /lldb/test/Shell/Register/Inputs | |
| parent | fd18e94697c987d5f24e25aa4e27adaffff3cce4 (diff) | |
| download | bcm5719-llvm-87aa9c9e4d41ed881453e2fab85b3d25f648bb55.tar.gz bcm5719-llvm-87aa9c9e4d41ed881453e2fab85b3d25f648bb55.zip | |
Re-land "[test] Split LLDB tests into API, Shell & Unit"
The original patch got reverted because it broke `check-lldb` on a clean
build. This fixes that.
llvm-svn: 374201
Diffstat (limited to 'lldb/test/Shell/Register/Inputs')
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-64-gp-read.cpp | 33 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-64-gp-write.cpp | 45 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-64-read.cpp | 57 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-64-write.cpp | 72 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-gp-read.cpp | 33 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-gp-write.cpp | 51 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-mm-xmm-read.cpp | 57 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-mm-xmm-write.cpp | 72 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-ymm-read.cpp | 76 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-ymm-write.cpp | 75 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-zmm-read.cpp | 190 | ||||
| -rw-r--r-- | lldb/test/Shell/Register/Inputs/x86-zmm-write.cpp | 111 |
12 files changed, 872 insertions, 0 deletions
diff --git a/lldb/test/Shell/Register/Inputs/x86-64-gp-read.cpp b/lldb/test/Shell/Register/Inputs/x86-64-gp-read.cpp new file mode 100644 index 00000000000..857b9e09949 --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-64-gp-read.cpp @@ -0,0 +1,33 @@ +#include <cstdint> + +int main() { + constexpr uint64_t rax = 0x0102030405060708; + constexpr uint64_t rbx = 0x1112131415161718; + constexpr uint64_t rcx = 0x2122232425262728; + constexpr uint64_t rdx = 0x3132333435363738; + constexpr uint64_t rsp = 0x4142434445464748; + constexpr uint64_t rbp = 0x5152535455565758; + constexpr uint64_t rsi = 0x6162636465666768; + constexpr uint64_t rdi = 0x7172737475767778; + + asm volatile( + // save rsp & rbp + "movq %%rsp, %%r8\n\t" + "movq %%rbp, %%r9\n\t" + "\n\t" + "movq %4, %%rsp\n\t" + "movq %5, %%rbp\n\t" + "\n\t" + "int3\n\t" + "\n\t" + // restore rsp & rbp + "movq %%r8, %%rsp\n\t" + "movq %%r9, %%rbp" + : + : "a"(rax), "b"(rbx), "c"(rcx), "d"(rdx), "i"(rsp), "i"(rbp), "S"(rsi), + "D"(rdi) + : "%r8", "%r9" + ); + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-64-gp-write.cpp b/lldb/test/Shell/Register/Inputs/x86-64-gp-write.cpp new file mode 100644 index 00000000000..fd579c031a3 --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-64-gp-write.cpp @@ -0,0 +1,45 @@ +#include <cinttypes> +#include <cstdint> +#include <cstdio> + +int main() { + constexpr uint64_t fill = 0x0F0F0F0F0F0F0F0F; + + uint64_t rax, rbx, rcx, rdx, rsp, rbp, rsi, rdi; + + asm volatile( + // save rsp & rbp + "movq %%rsp, %4\n\t" + "movq %%rbp, %5\n\t" + "\n\t" + "movq %8, %%rax\n\t" + "movq %8, %%rbx\n\t" + "movq %8, %%rcx\n\t" + "movq %8, %%rdx\n\t" + "movq %8, %%rsp\n\t" + "movq %8, %%rbp\n\t" + "movq %8, %%rsi\n\t" + "movq %8, %%rdi\n\t" + "\n\t" + "int3\n\t" + "\n\t" + // swap saved & current rsp & rbp + "xchgq %%rsp, %4\n\t" + "xchgq %%rbp, %5\n\t" + : "=a"(rax), "=b"(rbx), "=c"(rcx), "=d"(rdx), "=r"(rsp), "=r"(rbp), + "=S"(rsi), "=D"(rdi) + : "g"(fill) + : + ); + + printf("rax = 0x%016" PRIx64 "\n", rax); + printf("rbx = 0x%016" PRIx64 "\n", rbx); + printf("rcx = 0x%016" PRIx64 "\n", rcx); + printf("rdx = 0x%016" PRIx64 "\n", rdx); + printf("rsp = 0x%016" PRIx64 "\n", rsp); + printf("rbp = 0x%016" PRIx64 "\n", rbp); + printf("rsi = 0x%016" PRIx64 "\n", rsi); + printf("rdi = 0x%016" PRIx64 "\n", rdi); + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-64-read.cpp b/lldb/test/Shell/Register/Inputs/x86-64-read.cpp new file mode 100644 index 00000000000..fb75d7ebd9e --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-64-read.cpp @@ -0,0 +1,57 @@ +#include <cstdint> + +struct alignas(16) xmm_t { + uint64_t a, b; +}; + +int main() { + constexpr uint64_t r8[] = { + 0x0001020304050607, + 0x1011121314151617, + 0x2021222324252627, + 0x3031323334353637, + 0x4041424344454647, + 0x5051525354555657, + 0x6061626364656667, + 0x7071727374757677, + }; + + constexpr xmm_t xmm8[] = { + { 0x0F0E0D0C0B0A0908, 0x1716151413121110, }, + { 0x100F0E0D0C0B0A09, 0x1817161514131211, }, + { 0x11100F0E0D0C0B0A, 0x1918171615141312, }, + { 0x1211100F0E0D0C0B, 0x1A19181716151413, }, + { 0x131211100F0E0D0C, 0x1B1A191817161514, }, + { 0x14131211100F0E0D, 0x1C1B1A1918171615, }, + { 0x1514131211100F0E, 0x1D1C1B1A19181716, }, + { 0x161514131211100F, 0x1E1D1C1B1A191817, }, + }; + + asm volatile( + "movq 0x00(%0), %%r8\n\t" + "movq 0x08(%0), %%r9\n\t" + "movq 0x10(%0), %%r10\n\t" + "movq 0x18(%0), %%r11\n\t" + "movq 0x20(%0), %%r12\n\t" + "movq 0x28(%0), %%r13\n\t" + "movq 0x30(%0), %%r14\n\t" + "movq 0x38(%0), %%r15\n\t" + "\n\t" + "movaps 0x00(%1), %%xmm8\n\t" + "movaps 0x10(%1), %%xmm9\n\t" + "movaps 0x20(%1), %%xmm10\n\t" + "movaps 0x30(%1), %%xmm11\n\t" + "movaps 0x40(%1), %%xmm12\n\t" + "movaps 0x50(%1), %%xmm13\n\t" + "movaps 0x60(%1), %%xmm14\n\t" + "movaps 0x70(%1), %%xmm15\n\t" + "\n\t" + "int3\n\t" + : + : "a"(r8), "b"(xmm8) + : "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", "%xmm8", + "%xmm9", "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15" + ); + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-64-write.cpp b/lldb/test/Shell/Register/Inputs/x86-64-write.cpp new file mode 100644 index 00000000000..056f2ebe213 --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-64-write.cpp @@ -0,0 +1,72 @@ +#include <cinttypes> +#include <cstdint> +#include <cstdio> + +union alignas(16) xmm_t { + uint64_t as_uint64[2]; + uint8_t as_uint8[16]; +}; + +int main() { + constexpr xmm_t xmm_fill = { + .as_uint64 = { 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F } + }; + + uint64_t r64[8]; + xmm_t xmm[8]; + + asm volatile( + "movq %2, %%r8\n\t" + "movq %2, %%r9\n\t" + "movq %2, %%r10\n\t" + "movq %2, %%r11\n\t" + "movq %2, %%r12\n\t" + "movq %2, %%r13\n\t" + "movq %2, %%r14\n\t" + "movq %2, %%r15\n\t" + "\n\t" + "movaps %2, %%xmm8\n\t" + "movaps %2, %%xmm9\n\t" + "movaps %2, %%xmm10\n\t" + "movaps %2, %%xmm11\n\t" + "movaps %2, %%xmm12\n\t" + "movaps %2, %%xmm13\n\t" + "movaps %2, %%xmm14\n\t" + "movaps %2, %%xmm15\n\t" + "\n\t" + "int3\n\t" + "\n\t" + "movq %%r8, 0x00(%0)\n\t" + "movq %%r9, 0x08(%0)\n\t" + "movq %%r10, 0x10(%0)\n\t" + "movq %%r11, 0x18(%0)\n\t" + "movq %%r12, 0x20(%0)\n\t" + "movq %%r13, 0x28(%0)\n\t" + "movq %%r14, 0x30(%0)\n\t" + "movq %%r15, 0x38(%0)\n\t" + "\n\t" + "movaps %%xmm8, 0x00(%1)\n\t" + "movaps %%xmm9, 0x10(%1)\n\t" + "movaps %%xmm10, 0x20(%1)\n\t" + "movaps %%xmm11, 0x30(%1)\n\t" + "movaps %%xmm12, 0x40(%1)\n\t" + "movaps %%xmm13, 0x50(%1)\n\t" + "movaps %%xmm14, 0x60(%1)\n\t" + "movaps %%xmm15, 0x70(%1)\n\t" + : + : "a"(r64), "b"(xmm), "m"(xmm_fill) + : "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", "%xmm8", + "%xmm9", "%xmm10", "%xmm11", "%xmm12", "%xmm13", "%xmm14", "%xmm15" + ); + + for (int i = 0; i < 8; ++i) + printf("r%d = 0x%016" PRIx64 "\n", i+8, r64[i]); + for (int i = 0; i < 8; ++i) { + printf("xmm%d = { ", i+8); + for (int j = 0; j < sizeof(xmm->as_uint8); ++j) + printf("0x%02x ", xmm[i].as_uint8[j]); + printf("}\n"); + } + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-gp-read.cpp b/lldb/test/Shell/Register/Inputs/x86-gp-read.cpp new file mode 100644 index 00000000000..4fb725d3906 --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-gp-read.cpp @@ -0,0 +1,33 @@ +#include <cstdint> + +int main() { + constexpr uint32_t eax = 0x05060708; + constexpr uint32_t ebx = 0x15161718; + constexpr uint32_t ecx = 0x25262728; + constexpr uint32_t edx = 0x35363738; + constexpr uint32_t esp = 0x45464748; + constexpr uint32_t ebp = 0x55565758; + constexpr uint32_t esi = 0x65666768; + constexpr uint32_t edi = 0x75767778; + + asm volatile( + // save esp & ebp + "movd %%esp, %%mm0\n\t" + "movd %%ebp, %%mm1\n\t" + "\n\t" + "movl %4, %%esp\n\t" + "movl %5, %%ebp\n\t" + "\n\t" + "int3\n\t" + "\n\t" + // restore esp & ebp + "movd %%mm0, %%esp\n\t" + "movd %%mm1, %%ebp\n\t" + : + : "a"(eax), "b"(ebx), "c"(ecx), "d"(edx), "i"(esp), "i"(ebp), "S"(esi), + "D"(edi) + : "%mm0", "%mm1" + ); + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-gp-write.cpp b/lldb/test/Shell/Register/Inputs/x86-gp-write.cpp new file mode 100644 index 00000000000..1dfbe31b99f --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-gp-write.cpp @@ -0,0 +1,51 @@ +#include <cinttypes> +#include <cstdint> +#include <cstdio> + +int main() { + constexpr uint32_t fill = 0x0F0F0F0F; + + uint32_t eax, ebx, ecx, edx, esi, edi; + // need to use 64-bit types due to bug in clang + // https://bugs.llvm.org/show_bug.cgi?id=41748 + uint64_t esp, ebp; + + asm volatile( + // save esp & ebp + "movd %%esp, %%mm0\n\t" + "movd %%ebp, %%mm1\n\t" + "\n\t" + "movl %8, %%eax\n\t" + "movl %8, %%ebx\n\t" + "movl %8, %%ecx\n\t" + "movl %8, %%edx\n\t" + "movl %8, %%esp\n\t" + "movl %8, %%ebp\n\t" + "movl %8, %%esi\n\t" + "movl %8, %%edi\n\t" + "\n\t" + "int3\n\t" + "\n\t" + // copy new values of esp & ebp + "movd %%esp, %4\n\t" + "movd %%ebp, %5\n\t" + // restore saved esp & ebp + "movd %%mm0, %%esp\n\t" + "movd %%mm1, %%ebp\n\t" + : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx), "=y"(esp), "=y"(ebp), + "=S"(esi), "=D"(edi) + : "i"(fill) + : "%mm0", "%mm1" + ); + + printf("eax = 0x%08" PRIx32 "\n", eax); + printf("ebx = 0x%08" PRIx32 "\n", ebx); + printf("ecx = 0x%08" PRIx32 "\n", ecx); + printf("edx = 0x%08" PRIx32 "\n", edx); + printf("esp = 0x%08" PRIx32 "\n", static_cast<uint32_t>(esp)); + printf("ebp = 0x%08" PRIx32 "\n", static_cast<uint32_t>(ebp)); + printf("esi = 0x%08" PRIx32 "\n", esi); + printf("edi = 0x%08" PRIx32 "\n", edi); + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-mm-xmm-read.cpp b/lldb/test/Shell/Register/Inputs/x86-mm-xmm-read.cpp new file mode 100644 index 00000000000..feb4dde1ad6 --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-mm-xmm-read.cpp @@ -0,0 +1,57 @@ +#include <cstdint> + +struct alignas(16) xmm_t { + uint64_t a, b; +}; + +int main() { + constexpr uint64_t mm[] = { + 0x0001020304050607, + 0x1011121314151617, + 0x2021222324252627, + 0x3031323334353637, + 0x4041424344454647, + 0x5051525354555657, + 0x6061626364656667, + 0x7071727374757677, + }; + + constexpr xmm_t xmm[] = { + { 0x0706050403020100, 0x0F0E0D0C0B0A0908, }, + { 0x0807060504030201, 0x100F0E0D0C0B0A09, }, + { 0x0908070605040302, 0x11100F0E0D0C0B0A, }, + { 0x0A09080706050403, 0x1211100F0E0D0C0B, }, + { 0x0B0A090807060504, 0x131211100F0E0D0C, }, + { 0x0C0B0A0908070605, 0x14131211100F0E0D, }, + { 0x0D0C0B0A09080706, 0x1514131211100F0E, }, + { 0x0E0D0C0B0A090807, 0x161514131211100F, }, + }; + + asm volatile( + "movq 0x00(%0), %%mm0\n\t" + "movq 0x08(%0), %%mm1\n\t" + "movq 0x10(%0), %%mm2\n\t" + "movq 0x18(%0), %%mm3\n\t" + "movq 0x20(%0), %%mm4\n\t" + "movq 0x28(%0), %%mm5\n\t" + "movq 0x30(%0), %%mm6\n\t" + "movq 0x38(%0), %%mm7\n\t" + "\n\t" + "movaps 0x00(%1), %%xmm0\n\t" + "movaps 0x10(%1), %%xmm1\n\t" + "movaps 0x20(%1), %%xmm2\n\t" + "movaps 0x30(%1), %%xmm3\n\t" + "movaps 0x40(%1), %%xmm4\n\t" + "movaps 0x50(%1), %%xmm5\n\t" + "movaps 0x60(%1), %%xmm6\n\t" + "movaps 0x70(%1), %%xmm7\n\t" + "\n\t" + "int3\n\t" + : + : "a"(mm), "b"(xmm) + : "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7", + "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7" + ); + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-mm-xmm-write.cpp b/lldb/test/Shell/Register/Inputs/x86-mm-xmm-write.cpp new file mode 100644 index 00000000000..631d6f3a513 --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-mm-xmm-write.cpp @@ -0,0 +1,72 @@ +#include <cinttypes> +#include <cstdint> +#include <cstdio> + +union alignas(16) xmm_t { + uint64_t as_uint64[2]; + uint8_t as_uint8[16]; +}; + +int main() { + constexpr xmm_t xmm_fill = { + .as_uint64 = { 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F } + }; + + uint64_t mm[8]; + xmm_t xmm[8]; + + asm volatile( + "movq %2, %%mm0\n\t" + "movq %2, %%mm1\n\t" + "movq %2, %%mm2\n\t" + "movq %2, %%mm3\n\t" + "movq %2, %%mm4\n\t" + "movq %2, %%mm5\n\t" + "movq %2, %%mm6\n\t" + "movq %2, %%mm7\n\t" + "\n\t" + "movaps %2, %%xmm0\n\t" + "movaps %2, %%xmm1\n\t" + "movaps %2, %%xmm2\n\t" + "movaps %2, %%xmm3\n\t" + "movaps %2, %%xmm4\n\t" + "movaps %2, %%xmm5\n\t" + "movaps %2, %%xmm6\n\t" + "movaps %2, %%xmm7\n\t" + "\n\t" + "int3\n\t" + "\n\t" + "movq %%mm0, 0x00(%0)\n\t" + "movq %%mm1, 0x08(%0)\n\t" + "movq %%mm2, 0x10(%0)\n\t" + "movq %%mm3, 0x18(%0)\n\t" + "movq %%mm4, 0x20(%0)\n\t" + "movq %%mm5, 0x28(%0)\n\t" + "movq %%mm6, 0x30(%0)\n\t" + "movq %%mm7, 0x38(%0)\n\t" + "\n\t" + "movaps %%xmm0, 0x00(%1)\n\t" + "movaps %%xmm1, 0x10(%1)\n\t" + "movaps %%xmm2, 0x20(%1)\n\t" + "movaps %%xmm3, 0x30(%1)\n\t" + "movaps %%xmm4, 0x40(%1)\n\t" + "movaps %%xmm5, 0x50(%1)\n\t" + "movaps %%xmm6, 0x60(%1)\n\t" + "movaps %%xmm7, 0x70(%1)\n\t" + : + : "a"(mm), "b"(xmm), "m"(xmm_fill) + : "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7", "%xmm0", + "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7" + ); + + for (int i = 0; i < 8; ++i) + printf("mm%d = 0x%016" PRIx64 "\n", i, mm[i]); + for (int i = 0; i < 8; ++i) { + printf("xmm%d = { ", i); + for (int j = 0; j < sizeof(xmm->as_uint8); ++j) + printf("0x%02x ", xmm[i].as_uint8[j]); + printf("}\n"); + } + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-ymm-read.cpp b/lldb/test/Shell/Register/Inputs/x86-ymm-read.cpp new file mode 100644 index 00000000000..76f8970d085 --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-ymm-read.cpp @@ -0,0 +1,76 @@ +#include <cstdint> + +struct alignas(32) ymm_t { + uint64_t a, b, c, d; +}; + +int main() { + constexpr ymm_t ymm[] = { + { 0x0706050403020100, 0x0F0E0D0C0B0A0908, + 0x1716151413121110, 0x1F1E1D1C1B1A1918, }, + { 0x0807060504030201, 0x100F0E0D0C0B0A09, + 0x1817161514131211, 0x201F1E1D1C1B1A19, }, + { 0x0908070605040302, 0x11100F0E0D0C0B0A, + 0x1918171615141312, 0x21201F1E1D1C1B1A, }, + { 0x0A09080706050403, 0x1211100F0E0D0C0B, + 0x1A19181716151413, 0x2221201F1E1D1C1B, }, + { 0x0B0A090807060504, 0x131211100F0E0D0C, + 0x1B1A191817161514, 0x232221201F1E1D1C, }, + { 0x0C0B0A0908070605, 0x14131211100F0E0D, + 0x1C1B1A1918171615, 0x24232221201F1E1D, }, + { 0x0D0C0B0A09080706, 0x1514131211100F0E, + 0x1D1C1B1A19181716, 0x2524232221201F1E, }, + { 0x0E0D0C0B0A090807, 0x161514131211100F, + 0x1E1D1C1B1A191817, 0x262524232221201F, }, +#if defined(__x86_64__) || defined(_M_X64) + { 0x0F0E0D0C0B0A0908, 0x1716151413121110, + 0x1F1E1D1C1B1A1918, 0x2726252423222120, }, + { 0x100F0E0D0C0B0A09, 0x1817161514131211, + 0x201F1E1D1C1B1A19, 0x2827262524232221, }, + { 0x11100F0E0D0C0B0A, 0x1918171615141312, + 0x21201F1E1D1C1B1A, 0x2928272625242322, }, + { 0x1211100F0E0D0C0B, 0x1A19181716151413, + 0x2221201F1E1D1C1B, 0x2A29282726252423, }, + { 0x131211100F0E0D0C, 0x1B1A191817161514, + 0x232221201F1E1D1C, 0x2B2A292827262524, }, + { 0x14131211100F0E0D, 0x1C1B1A1918171615, + 0x24232221201F1E1D, 0x2C2B2A2928272625, }, + { 0x1514131211100F0E, 0x1D1C1B1A19181716, + 0x2524232221201F1E, 0x2D2C2B2A29282726, }, + { 0x161514131211100F, 0x1E1D1C1B1A191817, + 0x262524232221201F, 0x2E2D2C2B2A292827, }, +#endif + }; + + asm volatile( + "vmovaps 0x000(%0), %%ymm0\n\t" + "vmovaps 0x020(%0), %%ymm1\n\t" + "vmovaps 0x040(%0), %%ymm2\n\t" + "vmovaps 0x060(%0), %%ymm3\n\t" + "vmovaps 0x080(%0), %%ymm4\n\t" + "vmovaps 0x0A0(%0), %%ymm5\n\t" + "vmovaps 0x0C0(%0), %%ymm6\n\t" + "vmovaps 0x0E0(%0), %%ymm7\n\t" +#if defined(__x86_64__) || defined(_M_X64) + "vmovaps 0x100(%0), %%ymm8\n\t" + "vmovaps 0x120(%0), %%ymm9\n\t" + "vmovaps 0x140(%0), %%ymm10\n\t" + "vmovaps 0x160(%0), %%ymm11\n\t" + "vmovaps 0x180(%0), %%ymm12\n\t" + "vmovaps 0x1A0(%0), %%ymm13\n\t" + "vmovaps 0x1C0(%0), %%ymm14\n\t" + "vmovaps 0x1E0(%0), %%ymm15\n\t" +#endif + "\n\t" + "int3\n\t" + : + : "b"(ymm) + : "%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; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-ymm-write.cpp b/lldb/test/Shell/Register/Inputs/x86-ymm-write.cpp new file mode 100644 index 00000000000..3375853291e --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-ymm-write.cpp @@ -0,0 +1,75 @@ +#include <cinttypes> +#include <cstdint> +#include <cstdio> + +union alignas(32) ymm_t { + uint64_t as_uint64[4]; + uint8_t as_uint8[32]; +}; + +int main() { + constexpr ymm_t ymm_fill = { + .as_uint64 = { 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F, + 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F } + }; + + ymm_t ymm[16]; + + asm volatile( + "vmovaps %1, %%ymm0\n\t" + "vmovaps %1, %%ymm1\n\t" + "vmovaps %1, %%ymm2\n\t" + "vmovaps %1, %%ymm3\n\t" + "vmovaps %1, %%ymm4\n\t" + "vmovaps %1, %%ymm5\n\t" + "vmovaps %1, %%ymm6\n\t" + "vmovaps %1, %%ymm7\n\t" +#if defined(__x86_64__) || defined(_M_X64) + "vmovaps %1, %%ymm8\n\t" + "vmovaps %1, %%ymm9\n\t" + "vmovaps %1, %%ymm10\n\t" + "vmovaps %1, %%ymm11\n\t" + "vmovaps %1, %%ymm12\n\t" + "vmovaps %1, %%ymm13\n\t" + "vmovaps %1, %%ymm14\n\t" + "vmovaps %1, %%ymm15\n\t" +#endif + "\n\t" + "int3\n\t" + "\n\t" + "vmovaps %%ymm0, 0x000(%0)\n\t" + "vmovaps %%ymm1, 0x020(%0)\n\t" + "vmovaps %%ymm2, 0x040(%0)\n\t" + "vmovaps %%ymm3, 0x060(%0)\n\t" + "vmovaps %%ymm4, 0x080(%0)\n\t" + "vmovaps %%ymm5, 0x0A0(%0)\n\t" + "vmovaps %%ymm6, 0x0C0(%0)\n\t" + "vmovaps %%ymm7, 0x0E0(%0)\n\t" +#if defined(__x86_64__) || defined(_M_X64) + "vmovaps %%ymm8, 0x100(%0)\n\t" + "vmovaps %%ymm9, 0x120(%0)\n\t" + "vmovaps %%ymm10, 0x140(%0)\n\t" + "vmovaps %%ymm11, 0x160(%0)\n\t" + "vmovaps %%ymm12, 0x180(%0)\n\t" + "vmovaps %%ymm13, 0x1A0(%0)\n\t" + "vmovaps %%ymm14, 0x1C0(%0)\n\t" + "vmovaps %%ymm15, 0x1E0(%0)\n\t" +#endif + : + : "b"(ymm), "m"(ymm_fill) + : "%ymm0", "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5", "%ymm6", "%ymm7" +#if defined(__x86_64__) || defined(_M_X64) + , "%ymm8", "%ymm9", "%ymm10", "%ymm11", "%ymm12", "%ymm13", "%ymm14", + "%ymm15" +#endif + ); + + for (int i = 0; i < 16; ++i) { + printf("ymm%d = { ", i); + for (int j = 0; j < sizeof(ymm->as_uint8); ++j) + printf("0x%02x ", ymm[i].as_uint8[j]); + printf("}\n"); + } + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-zmm-read.cpp b/lldb/test/Shell/Register/Inputs/x86-zmm-read.cpp new file mode 100644 index 00000000000..2a1a4fd1114 --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-zmm-read.cpp @@ -0,0 +1,190 @@ +#include <cstdint> + +struct alignas(64) zmm_t { + uint64_t a, b, c, d, e, f, g, h; +}; + +int main() { + constexpr zmm_t zmm[] = { + { 0x0706050403020100, 0x0F0E0D0C0B0A0908, + 0x1716151413121110, 0x1F1E1D1C1B1A1918, + 0x2726252423222120, 0x2F2E2D2C2B2A2928, + 0x3736353433323130, 0x3F3E3D3C3B3A3938, }, + { 0x0807060504030201, 0x100F0E0D0C0B0A09, + 0x1817161514131211, 0x201F1E1D1C1B1A19, + 0x2827262524232221, 0x302F2E2D2C2B2A29, + 0x3837363534333231, 0x403F3E3D3C3B3A39, }, + { 0x0908070605040302, 0x11100F0E0D0C0B0A, + 0x1918171615141312, 0x21201F1E1D1C1B1A, + 0x2928272625242322, 0x31302F2E2D2C2B2A, + 0x3938373635343332, 0x41403F3E3D3C3B3A, }, + { 0x0A09080706050403, 0x1211100F0E0D0C0B, + 0x1A19181716151413, 0x2221201F1E1D1C1B, + 0x2A29282726252423, 0x3231302F2E2D2C2B, + 0x3A39383736353433, 0x4241403F3E3D3C3B, }, + { 0x0B0A090807060504, 0x131211100F0E0D0C, + 0x1B1A191817161514, 0x232221201F1E1D1C, + 0x2B2A292827262524, 0x333231302F2E2D2C, + 0x3B3A393837363534, 0x434241403F3E3D3C, }, + { 0x0C0B0A0908070605, 0x14131211100F0E0D, + 0x1C1B1A1918171615, 0x24232221201F1E1D, + 0x2C2B2A2928272625, 0x34333231302F2E2D, + 0x3C3B3A3938373635, 0x44434241403F3E3D, }, + { 0x0D0C0B0A09080706, 0x1514131211100F0E, + 0x1D1C1B1A19181716, 0x2524232221201F1E, + 0x2D2C2B2A29282726, 0x3534333231302F2E, + 0x3D3C3B3A39383736, 0x4544434241403F3E, }, + { 0x0E0D0C0B0A090807, 0x161514131211100F, + 0x1E1D1C1B1A191817, 0x262524232221201F, + 0x2E2D2C2B2A292827, 0x363534333231302F, + 0x3E3D3C3B3A393837, 0x464544434241403F, }, +#if defined(__x86_64__) || defined(_M_X64) + { 0x0F0E0D0C0B0A0908, 0x1716151413121110, + 0x1F1E1D1C1B1A1918, 0x2726252423222120, + 0x2F2E2D2C2B2A2928, 0x3736353433323130, + 0x3F3E3D3C3B3A3938, 0x4746454443424140, }, + { 0x100F0E0D0C0B0A09, 0x1817161514131211, + 0x201F1E1D1C1B1A19, 0x2827262524232221, + 0x302F2E2D2C2B2A29, 0x3837363534333231, + 0x403F3E3D3C3B3A39, 0x4847464544434241, }, + { 0x11100F0E0D0C0B0A, 0x1918171615141312, + 0x21201F1E1D1C1B1A, 0x2928272625242322, + 0x31302F2E2D2C2B2A, 0x3938373635343332, + 0x41403F3E3D3C3B3A, 0x4948474645444342, }, + { 0x1211100F0E0D0C0B, 0x1A19181716151413, + 0x2221201F1E1D1C1B, 0x2A29282726252423, + 0x3231302F2E2D2C2B, 0x3A39383736353433, + 0x4241403F3E3D3C3B, 0x4A49484746454443, }, + { 0x131211100F0E0D0C, 0x1B1A191817161514, + 0x232221201F1E1D1C, 0x2B2A292827262524, + 0x333231302F2E2D2C, 0x3B3A393837363534, + 0x434241403F3E3D3C, 0x4B4A494847464544, }, + { 0x14131211100F0E0D, 0x1C1B1A1918171615, + 0x24232221201F1E1D, 0x2C2B2A2928272625, + 0x34333231302F2E2D, 0x3C3B3A3938373635, + 0x44434241403F3E3D, 0x4C4B4A4948474645, }, + { 0x1514131211100F0E, 0x1D1C1B1A19181716, + 0x2524232221201F1E, 0x2D2C2B2A29282726, + 0x3534333231302F2E, 0x3D3C3B3A39383736, + 0x4544434241403F3E, 0x4D4C4B4A49484746, }, + { 0x161514131211100F, 0x1E1D1C1B1A191817, + 0x262524232221201F, 0x2E2D2C2B2A292827, + 0x363534333231302F, 0x3E3D3C3B3A393837, + 0x464544434241403F, 0x4E4D4C4B4A494847, }, + { 0x1716151413121110, 0x1F1E1D1C1B1A1918, + 0x2726252423222120, 0x2F2E2D2C2B2A2928, + 0x3736353433323130, 0x3F3E3D3C3B3A3938, + 0x4746454443424140, 0x4F4E4D4C4B4A4948, }, + { 0x1817161514131211, 0x201F1E1D1C1B1A19, + 0x2827262524232221, 0x302F2E2D2C2B2A29, + 0x3837363534333231, 0x403F3E3D3C3B3A39, + 0x4847464544434241, 0x504F4E4D4C4B4A49, }, + { 0x1918171615141312, 0x21201F1E1D1C1B1A, + 0x2928272625242322, 0x31302F2E2D2C2B2A, + 0x3938373635343332, 0x41403F3E3D3C3B3A, + 0x4948474645444342, 0x51504F4E4D4C4B4A, }, + { 0x1A19181716151413, 0x2221201F1E1D1C1B, + 0x2A29282726252423, 0x3231302F2E2D2C2B, + 0x3A39383736353433, 0x4241403F3E3D3C3B, + 0x4A49484746454443, 0x5251504F4E4D4C4B, }, + { 0x1B1A191817161514, 0x232221201F1E1D1C, + 0x2B2A292827262524, 0x333231302F2E2D2C, + 0x3B3A393837363534, 0x434241403F3E3D3C, + 0x4B4A494847464544, 0x535251504F4E4D4C, }, + { 0x1C1B1A1918171615, 0x24232221201F1E1D, + 0x2C2B2A2928272625, 0x34333231302F2E2D, + 0x3C3B3A3938373635, 0x44434241403F3E3D, + 0x4C4B4A4948474645, 0x54535251504F4E4D, }, + { 0x1D1C1B1A19181716, 0x2524232221201F1E, + 0x2D2C2B2A29282726, 0x3534333231302F2E, + 0x3D3C3B3A39383736, 0x4544434241403F3E, + 0x4D4C4B4A49484746, 0x5554535251504F4E, }, + { 0x1E1D1C1B1A191817, 0x262524232221201F, + 0x2E2D2C2B2A292827, 0x363534333231302F, + 0x3E3D3C3B3A393837, 0x464544434241403F, + 0x4E4D4C4B4A494847, 0x565554535251504F, }, + { 0x1F1E1D1C1B1A1918, 0x2726252423222120, + 0x2F2E2D2C2B2A2928, 0x3736353433323130, + 0x3F3E3D3C3B3A3938, 0x4746454443424140, + 0x4F4E4D4C4B4A4948, 0x5756555453525150, }, + { 0x201F1E1D1C1B1A19, 0x2827262524232221, + 0x302F2E2D2C2B2A29, 0x3837363534333231, + 0x403F3E3D3C3B3A39, 0x4847464544434241, + 0x504F4E4D4C4B4A49, 0x5857565554535251, }, + { 0x21201F1E1D1C1B1A, 0x2928272625242322, + 0x31302F2E2D2C2B2A, 0x3938373635343332, + 0x41403F3E3D3C3B3A, 0x4948474645444342, + 0x51504F4E4D4C4B4A, 0x5958575655545352, }, + { 0x2221201F1E1D1C1B, 0x2A29282726252423, + 0x3231302F2E2D2C2B, 0x3A39383736353433, + 0x4241403F3E3D3C3B, 0x4A49484746454443, + 0x5251504F4E4D4C4B, 0x5A59585756555453, }, + { 0x232221201F1E1D1C, 0x2B2A292827262524, + 0x333231302F2E2D2C, 0x3B3A393837363534, + 0x434241403F3E3D3C, 0x4B4A494847464544, + 0x535251504F4E4D4C, 0x5B5A595857565554, }, + { 0x24232221201F1E1D, 0x2C2B2A2928272625, + 0x34333231302F2E2D, 0x3C3B3A3938373635, + 0x44434241403F3E3D, 0x4C4B4A4948474645, + 0x54535251504F4E4D, 0x5C5B5A5958575655, }, + { 0x2524232221201F1E, 0x2D2C2B2A29282726, + 0x3534333231302F2E, 0x3D3C3B3A39383736, + 0x4544434241403F3E, 0x4D4C4B4A49484746, + 0x5554535251504F4E, 0x5D5C5B5A59585756, }, + { 0x262524232221201F, 0x2E2D2C2B2A292827, + 0x363534333231302F, 0x3E3D3C3B3A393837, + 0x464544434241403F, 0x4E4D4C4B4A494847, + 0x565554535251504F, 0x5E5D5C5B5A595857, }, +#endif + }; + + asm volatile( + "vmovaps 0x000(%0), %%zmm0\n\t" + "vmovaps 0x040(%0), %%zmm1\n\t" + "vmovaps 0x080(%0), %%zmm2\n\t" + "vmovaps 0x0C0(%0), %%zmm3\n\t" + "vmovaps 0x100(%0), %%zmm4\n\t" + "vmovaps 0x140(%0), %%zmm5\n\t" + "vmovaps 0x180(%0), %%zmm6\n\t" + "vmovaps 0x1C0(%0), %%zmm7\n\t" +#if defined(__x86_64__) || defined(_M_X64) + "vmovaps 0x200(%0), %%zmm8\n\t" + "vmovaps 0x240(%0), %%zmm9\n\t" + "vmovaps 0x280(%0), %%zmm10\n\t" + "vmovaps 0x2C0(%0), %%zmm11\n\t" + "vmovaps 0x300(%0), %%zmm12\n\t" + "vmovaps 0x340(%0), %%zmm13\n\t" + "vmovaps 0x380(%0), %%zmm14\n\t" + "vmovaps 0x3C0(%0), %%zmm15\n\t" + "vmovaps 0x400(%0), %%zmm16\n\t" + "vmovaps 0x440(%0), %%zmm17\n\t" + "vmovaps 0x480(%0), %%zmm18\n\t" + "vmovaps 0x4C0(%0), %%zmm19\n\t" + "vmovaps 0x500(%0), %%zmm20\n\t" + "vmovaps 0x540(%0), %%zmm21\n\t" + "vmovaps 0x580(%0), %%zmm22\n\t" + "vmovaps 0x5C0(%0), %%zmm23\n\t" + "vmovaps 0x600(%0), %%zmm24\n\t" + "vmovaps 0x640(%0), %%zmm25\n\t" + "vmovaps 0x680(%0), %%zmm26\n\t" + "vmovaps 0x6C0(%0), %%zmm27\n\t" + "vmovaps 0x700(%0), %%zmm28\n\t" + "vmovaps 0x740(%0), %%zmm29\n\t" + "vmovaps 0x780(%0), %%zmm30\n\t" + "vmovaps 0x7C0(%0), %%zmm31\n\t" +#endif + "\n\t" + "int3\n\t" + : + : "b"(zmm) + : "%zmm0", "%zmm1", "%zmm2", "%zmm3", "%zmm4", "%zmm5", "%zmm6", "%zmm7" +#if defined(__x86_64__) || defined(_M_X64) + , "%zmm8", "%zmm9", "%zmm10", "%zmm11", "%zmm12", "%zmm13", "%zmm14", + "%zmm15", "%zmm16", "%zmm17", "%zmm18", "%zmm19", "%zmm20", "%zmm21", + "%zmm22", "%zmm23", "%zmm24", "%zmm25", "%zmm26", "%zmm27", "%zmm28", + "%zmm29", "%zmm30", "%zmm31" +#endif + ); + + return 0; +} diff --git a/lldb/test/Shell/Register/Inputs/x86-zmm-write.cpp b/lldb/test/Shell/Register/Inputs/x86-zmm-write.cpp new file mode 100644 index 00000000000..4830fb2a742 --- /dev/null +++ b/lldb/test/Shell/Register/Inputs/x86-zmm-write.cpp @@ -0,0 +1,111 @@ +#include <cinttypes> +#include <cstdint> +#include <cstdio> + +union alignas(64) zmm_t { + uint64_t as_uint64[8]; + uint8_t as_uint8[64]; +}; + +int main() { + constexpr zmm_t zmm_fill = { + .as_uint64 = { 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F, + 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F, + 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F, + 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F } + }; + + zmm_t zmm[32]; + + asm volatile( + "vmovaps %1, %%zmm0\n\t" + "vmovaps %1, %%zmm1\n\t" + "vmovaps %1, %%zmm2\n\t" + "vmovaps %1, %%zmm3\n\t" + "vmovaps %1, %%zmm4\n\t" + "vmovaps %1, %%zmm5\n\t" + "vmovaps %1, %%zmm6\n\t" + "vmovaps %1, %%zmm7\n\t" +#if defined(__x86_64__) || defined(_M_X64) + "vmovaps %1, %%zmm8\n\t" + "vmovaps %1, %%zmm9\n\t" + "vmovaps %1, %%zmm10\n\t" + "vmovaps %1, %%zmm11\n\t" + "vmovaps %1, %%zmm12\n\t" + "vmovaps %1, %%zmm13\n\t" + "vmovaps %1, %%zmm14\n\t" + "vmovaps %1, %%zmm15\n\t" + "vmovaps %1, %%zmm16\n\t" + "vmovaps %1, %%zmm17\n\t" + "vmovaps %1, %%zmm18\n\t" + "vmovaps %1, %%zmm19\n\t" + "vmovaps %1, %%zmm20\n\t" + "vmovaps %1, %%zmm21\n\t" + "vmovaps %1, %%zmm22\n\t" + "vmovaps %1, %%zmm23\n\t" + "vmovaps %1, %%zmm24\n\t" + "vmovaps %1, %%zmm25\n\t" + "vmovaps %1, %%zmm26\n\t" + "vmovaps %1, %%zmm27\n\t" + "vmovaps %1, %%zmm28\n\t" + "vmovaps %1, %%zmm29\n\t" + "vmovaps %1, %%zmm30\n\t" + "vmovaps %1, %%zmm31\n\t" +#endif + "\n\t" + "int3\n\t" + "\n\t" + "vmovaps %%zmm0, 0x000(%0)\n\t" + "vmovaps %%zmm1, 0x040(%0)\n\t" + "vmovaps %%zmm2, 0x080(%0)\n\t" + "vmovaps %%zmm3, 0x0C0(%0)\n\t" + "vmovaps %%zmm4, 0x100(%0)\n\t" + "vmovaps %%zmm5, 0x140(%0)\n\t" + "vmovaps %%zmm6, 0x180(%0)\n\t" + "vmovaps %%zmm7, 0x1C0(%0)\n\t" +#if defined(__x86_64__) || defined(_M_X64) + "vmovaps %%zmm8, 0x200(%0)\n\t" + "vmovaps %%zmm9, 0x240(%0)\n\t" + "vmovaps %%zmm10, 0x280(%0)\n\t" + "vmovaps %%zmm11, 0x2C0(%0)\n\t" + "vmovaps %%zmm12, 0x300(%0)\n\t" + "vmovaps %%zmm13, 0x340(%0)\n\t" + "vmovaps %%zmm14, 0x380(%0)\n\t" + "vmovaps %%zmm15, 0x3C0(%0)\n\t" + "vmovaps %%zmm16, 0x400(%0)\n\t" + "vmovaps %%zmm17, 0x440(%0)\n\t" + "vmovaps %%zmm18, 0x480(%0)\n\t" + "vmovaps %%zmm19, 0x4C0(%0)\n\t" + "vmovaps %%zmm20, 0x500(%0)\n\t" + "vmovaps %%zmm21, 0x540(%0)\n\t" + "vmovaps %%zmm22, 0x580(%0)\n\t" + "vmovaps %%zmm23, 0x5C0(%0)\n\t" + "vmovaps %%zmm24, 0x600(%0)\n\t" + "vmovaps %%zmm25, 0x640(%0)\n\t" + "vmovaps %%zmm26, 0x680(%0)\n\t" + "vmovaps %%zmm27, 0x6C0(%0)\n\t" + "vmovaps %%zmm28, 0x700(%0)\n\t" + "vmovaps %%zmm29, 0x740(%0)\n\t" + "vmovaps %%zmm30, 0x780(%0)\n\t" + "vmovaps %%zmm31, 0x7C0(%0)\n\t" +#endif + : + : "b"(zmm), "m"(zmm_fill) + : "%zmm0", "%zmm1", "%zmm2", "%zmm3", "%zmm4", "%zmm5", "%zmm6", "%zmm7" +#if defined(__x86_64__) || defined(_M_X64) + , "%zmm8", "%zmm9", "%zmm10", "%zmm11", "%zmm12", "%zmm13", "%zmm14", + "%zmm15", "%zmm16", "%zmm17", "%zmm18", "%zmm19", "%zmm20", "%zmm21", + "%zmm22", "%zmm23", "%zmm24", "%zmm25", "%zmm26", "%zmm27", "%zmm28", + "%zmm29", "%zmm30", "%zmm31" +#endif + ); + + for (int i = 0; i < 32; ++i) { + printf("zmm%d = { ", i); + for (int j = 0; j < sizeof(zmm->as_uint8); ++j) + printf("0x%02x ", zmm[i].as_uint8[j]); + printf("}\n"); + } + + return 0; +} |

