[llvm] [AMDGPU][RFC] Combine asm and disasm tests. (PR #90179)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 01:53:59 PDT 2024


jayfoad wrote:

I like the general idea. We will always need some separate disassembler tests to check how the disassembler handles byte sequences that the assembler never generates (e.g. invalid encodings).

Instead of teaching the disassembler to extract hex bytes from `encoding: [...]`, I think I'd prefer creating a new assembler option `-filetype=hex` (subject to bikeshedding) that would produce output in the form that the disassembler expects:
```
$ llvm-mc -filetype=hex ...
0x01,0x02,0x03,0x04
$ llvm-mc -filetype=hex ... | llvm-mv -disassemble
...
```

One more thing we could check is a form of round tripping. If you assemble an instruction to an encoding, then disassembling+assembling that encoding should round-trip perfectly. I.e. `asm file.s` should produce identical output to `asm file.s | dis | asm`.

The converse should probably be true, i.e. `dis file.txt` should produce identical output to `dis file.txt | asm | dis`.

https://github.com/llvm/llvm-project/pull/90179


More information about the llvm-commits mailing list