[lldb] [lit] Use more readable consts and arrays in register read tests
authorMichal Gorny <mgorny@gentoo.org>
Mon, 6 May 2019 13:06:43 +0000 (13:06 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Mon, 6 May 2019 13:06:43 +0000 (13:06 +0000)
commitacbaa496ec8ea63f2315e0fdc7ed86c888a21a53
treefb5e4d2900c6a1ca823ec7361fb6464e6c182a74
parent8b92ec521dec5d5a4d409d3de435f7adc0777983
[lldb] [lit] Use more readable consts and arrays in register read tests

Replace the constants used for r8/mm/xmm/ymm/zmm tests with something
more readable to ease debugging in case of failures (0x00 0x01 ...).
While at it, put the constants in array and copy them from memory
to simplify inline asm.

The original constants grew out of necessity.  The xmm constants were
'weird' because they were intended to be different from mm constants
(as that was necessary to catch NetBSD implementation bug).  The ymm
constants were made even weirded to not even partially collide with
other xmm registers (not saying it made sense, just how it was done).
Then, zmm constants were once again designed to avoid accidental
collisions with xmm and ymm constants, and at the same the 16 extra
registers required even more shuffling.

The new constants are meant to be more user-readable, so that a mistake
could be easily spotted.  All of xmm, ymm and zmm tests use a sequence
of {0x00 0x01 0x02 ...}, shifted by 1 for every register.  This should
provide enough uniquity, and space for future increase in number of
registers.  Since mm and r8..r15 are printed as uint64_t rather than
byte-by-byte, they use 0x000102...  As a result, on x86 endianness takes
care of making mm different than xmm.

The use of arrays is something I had to learn for zmm write tests.  It
avoids having to specify all the input values separately, and makes
GCC happy about zmm-read test (it was rejected previously because of
hitting a limit of 30 constraints).

llvm-svn: 360041
12 files changed:
lldb/lit/Register/Inputs/x86-64-read.cpp
lldb/lit/Register/Inputs/x86-mm-xmm-read.cpp
lldb/lit/Register/Inputs/x86-ymm-read.cpp
lldb/lit/Register/Inputs/x86-zmm-read.cpp
lldb/lit/Register/x86-64-read.test
lldb/lit/Register/x86-64-xmm16-read.test
lldb/lit/Register/x86-64-ymm-read.test
lldb/lit/Register/x86-64-ymm16-read.test
lldb/lit/Register/x86-64-zmm-read.test
lldb/lit/Register/x86-mm-xmm-read.test
lldb/lit/Register/x86-ymm-read.test
lldb/lit/Register/x86-zmm-read.test