This is an archive of the discontinued LLVM Phabricator instance.

[lldb][AArch64] Check SIMD save/restore in SVE SIMD test
ClosedPublic

Authored by DavidSpickett on Aug 3 2023, 6:49 AM.

Details

Summary

While doing some refactoring I forgot to carry over the copying in of
SIMD data in normal mode, but no tests failed.

Turns out, it's very easy for us to get the restore wrong because
even if you forget the memcopy, setting the buffer to valid may
just read the data you had before the expression evaluation.

So I've extended the SVE SIMD testing (which includes the plain SIMD mode)
to check expression save/restore. This is the only test that fails
if you forget to do m_fpu_is_valid = true so I take from that, that
prior to this it wasn't tested at all.

As a bonus, we now have coverage of the same thing for SVE and SSVE modes.

Diff Detail

Event Timeline

DavidSpickett created this revision.Aug 3 2023, 6:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2023, 6:49 AM
DavidSpickett requested review of this revision.Aug 3 2023, 6:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2023, 6:49 AM

MTE control needs a test too, I'm working on that as its own change.

Matt added a subscriber: Matt.Aug 9 2023, 3:47 PM
omjavaid accepted this revision.Aug 29 2023, 4:20 AM
omjavaid added inline comments.
lldb/test/API/commands/register/register/aarch64_sve_simd_registers/main.c
43

There is subtle difference between write_simd_regs and write_simd_regs_expr.

BTW, cant we avoid another function and just do something like

#define WRITE_SIMD(NUM, I)                                                      \
  asm volatile("MOV v" #NUM ".d[0], %0\n\t"                                     \
               "MOV v" #NUM ".d[1], %0\n\t" ::"r"(NUM + I))
This revision is now accepted and ready to land.Aug 29 2023, 4:20 AM

Single function to set the simd values, that takes a base value.

DavidSpickett marked an inline comment as done.Aug 30 2023, 2:59 AM
DavidSpickett added inline comments.
lldb/test/API/commands/register/register/aarch64_sve_simd_registers/main.c
43

Done. I also looked into some kind of for loop to generate the WRITE_SIMD but it ends up more complex and approaching the length of just repeating it anyway.

This revision was landed with ongoing or failed builds.Aug 31 2023, 2:22 AM
This revision was automatically updated to reflect the committed changes.
DavidSpickett marked an inline comment as done.