[lldb] [lit] Use more readable consts and arrays in register read tests

Authored by mgorny on May 6 2019, 6:06 AM.


[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


mgornyMay 6 2019, 6:06 AM
rG8b92ec521dec: [lld] A better version of the fix in r359942.