[GlobalISel] Handle non-multiples of the base type in narrowScalarInsert
authorJustin Bogner <mail@justinbogner.com>
Tue, 2 Mar 2021 17:49:15 +0000 (09:49 -0800)
committerJustin Bogner <mail@justinbogner.com>
Tue, 8 Jun 2021 17:13:38 +0000 (10:13 -0700)
commit2a7e759734982bea1d08642332a92f687266148f
treedf3e2641863d25bf3e132c172e8dedf5995f4486
parent30bb5dcb0a5cfe933136340318cbff2ba329a8c4
[GlobalISel] Handle non-multiples of the base type in narrowScalarInsert

When narrowing G_INSERT, handle types that aren't a multiple of the
type we're narrowing to. This comes up if we're narrowing something
like an s96 to fit in 64 bit registers and also for non-byte multiple
packed types if they come up.

This implementation handles these cases by extending the extra bits to
the narrow size and truncating the result back to the destination
size.

Differential Revision: https://reviews.llvm.org/D97791
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-fallback.ll
llvm/test/CodeGen/AArch64/GlobalISel/legalize-inserts.mir