This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Restrict the usage of REINTERPRET_CAST.
ClosedPublic

Authored by paulwalker-arm on Jan 13 2021, 5:09 AM.

Details

Summary

In order to limit the number of combinations of REINTERPRET_CAST,
whilst at the same time prevent overlap with BITCAST, this patch
establishes the following rules:

  1. The operand and result element types must be the same.
  2. The operand and/or result type must be an unpacked type.

Diff Detail

Event Timeline

paulwalker-arm created this revision.Jan 13 2021, 5:09 AM
paulwalker-arm requested review of this revision.Jan 13 2021, 5:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2021, 5:09 AM
david-arm added inline comments.Jan 13 2021, 5:57 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
17196

If InVT is a float vector then getPackedSVEVectorVT will return an integer vector and you'll have a reinterpret_cast that you don't want, right? It will fail to select, but I wonder if you want an explicit assert for InVTs only supporting integer types at the moment?

17202

I'm not sure how this works for the case we recently saw where a Gather result type was nxv2i64 and VT was nxv2f16? In this case InVT will equal PackedInVT, we'll bitcast Op (already nx2vi64) to nxv2i64 again, then do a reinterpret_cast from Op (nxv2i64) to v2f16. Unless I'm missing something?

david-arm added inline comments.Jan 13 2021, 6:54 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
17202

Hi @paulwalker-arm, sorry ignore my previous comment. I was looking at the wrong overloaded form of getPackedSVEVectorVT and thinking it would return something different!

This revision is now accepted and ready to land.Jan 14 2021, 1:27 AM
This revision was landed with ongoing or failed builds.Jan 15 2021, 3:34 AM
This revision was automatically updated to reflect the committed changes.