Bitcasting between unpacked scalable vector types of different
element counts is not a NOP because the live elements are laid out
differently.
01234567
e.g. nxv2i32 = XX??XX??
nxv4f16 = X?X?X?X?
Paths
| Differential D126957
[SVE] Fix incorrect code generation for bitcasts of unpacked vector types. ClosedPublic Authored by paulwalker-arm on Jun 3 2022, 4:13 AM.
Details Summary Bitcasting between unpacked scalable vector types of different 01234567 e.g. nxv2i32 = XX??XX?? nxv4f16 = X?X?X?X?
Diff Detail
Unit TestsFailed Event TimelineComment Actions For this patch I'm just playing it safe and using common expansion via the stack rather than anything more exotic. Comment Actions The "correct" expansion isn't too tricky. First, compute "packed" types for the source and destination. Then just insert_subvector into the packed source, bitcast to the packed destination, then extract_subvector. Should optimize to one or two instructions once we lower the insert_subvector/extract_subvector into shuffles. Not that I'm really against the current version, but if we're going to end up rewriting this code anyway, might as well do it now. Should we add an assertion to getSVESafeBitCast() that we aren't performing a bitcast like this? Comment Actions @efriedma I'd still rather have the improved code generation as a separate patch, mainly because this patch forces the need to remove an invalid type size conversion from SelectionDAGLegalize::EmitStackConvert and I'd like there to be a window (however small) that validates the code now works for fixed and scalable vector types. This revision is now accepted and ready to land.Jun 6 2022, 11:18 AM This revision was landed with ongoing or failed builds.Jun 8 2022, 2:31 AM Closed by commit rGa1121c31d840: [SVE] Fix incorrect code generation for bitcasts of unpacked vector types. (authored by paulwalker-arm). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 433996 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/sve-bitcast.ll
|