[PATCH] D74580: GlobalISel: Introduce bitcast legalize action

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 13:47:39 PST 2020


arsenm created this revision.
arsenm added reviewers: dsanders, paquette, aemerson, aditya_nandakumar, Petar.Avramovic.
Herald added subscribers: volkan, hiraditya, tpr, rovka, wdng.
Herald added a project: LLVM.

For some operations, the type is unimportant and only the number of
bits matters. For example I don't want to treat <4 x s8> as a legal
type, but I also don't want to decompose loads of this into smaller
pieces to get legal register types.

      

On AMDGPU in SelectionDAG, we legalize a number of operations (most
notably load and store) by coercing all types to vectors of i32. For
GlobalISel, I'm trying very hard to avoid doing this for every type,
but I don't think this strategy can be completely avoided. I'm trying
to avoid bitcasts for any legitimately legal type we can operate on,
since the intervening bitcasts have proven to be a hassle.

     

For loads, I think I can get away without ever casting the result
type, and handling any arbitrary bitwidth during selection (I will
eventually want new tablegen support to help with this, rather than
having to add every possible type as legal). The unmerge required to
do anything with the value should expand to the expected shifts. This
is trickier for stores, since it would now require handling a wide
array of truncates during selection which I don't want.

      

Future potentially interesting case are for vector indexing, where
sub-dword type should be indexed in s32 pieces.


https://reviews.llvm.org/D74580

Files:
  llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
  llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
  llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
  llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp
  llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74580.244532.patch
Type: text/x-patch
Size: 10944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200213/fbf3c881/attachment.bin>


More information about the llvm-commits mailing list