GlobalISel: Handle widenScalar of arbitrary G_MERGE_VALUES sources
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 17 Jul 2019 20:22:44 +0000 (20:22 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 17 Jul 2019 20:22:44 +0000 (20:22 +0000)
commit0966dd0d69cf66bcba55a4b5d28b1059b5c9b6a6
tree25ddf531da399645f72b5cd5812d5de582de2671
parent914a59cad825f322ef10273327e708fe5eb78283
GlobalISel: Handle widenScalar of arbitrary G_MERGE_VALUES sources

Extract the sources to the GCD of the original size and target size,
padding with implicit_def as necessary.

Also fix the case where the requested source type is wider than the
original result type. This was ignoring the type, and just using the
destination. Do the operation in the requested type and truncate back.

llvm-svn: 366367
llvm/include/llvm/Support/MathExtras.h
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-merge-values.mir
llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp