From: Matt Arsenault Date: Fri, 8 Feb 2019 14:46:27 +0000 (+0000) Subject: AMDGPU/GlobalISel: Fix non-power-of-2 implicit_def X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b997233527eb4c4e98ceea9d131886b5fa888952;p=llvm AMDGPU/GlobalISel: Fix non-power-of-2 implicit_def git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353522 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp index 02528b62177..0002aece557 100644 --- a/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp +++ b/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp @@ -139,7 +139,8 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST, ConstantPtr, LocalPtr, FlatPtr, PrivatePtr}) .legalFor({LLT::vector(3, 16)})// FIXME: Hack .clampScalarOrElt(0, S32, S512) - .legalIf(isMultiple32(0)); + .legalIf(isMultiple32(0)) + .widenScalarToNextPow2(0, 32); // FIXME: i1 operands to intrinsics should always be legal, but other i1 diff --git a/test/CodeGen/AMDGPU/GlobalISel/legalize-implicit-def.mir b/test/CodeGen/AMDGPU/GlobalISel/legalize-implicit-def.mir index 786ec1335be..b9a27740c89 100644 --- a/test/CodeGen/AMDGPU/GlobalISel/legalize-implicit-def.mir +++ b/test/CodeGen/AMDGPU/GlobalISel/legalize-implicit-def.mir @@ -69,6 +69,20 @@ body: | $vgpr0 = COPY %0 ... +--- +name: test_implicit_def_48 +body: | + bb.0: + + ; CHECK-LABEL: name: test_implicit_def_48 + ; CHECK: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF + ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY [[DEF]](s64) + ; CHECK: $vgpr0_vgpr1 = COPY [[COPY]](s64) + %0:_(s48) = G_IMPLICIT_DEF + %1:_(s64) = G_ANYEXT %0 + $vgpr0_vgpr1 = COPY %1 +... + --- name: test_implicit_def_s64 body: | @@ -81,6 +95,20 @@ body: | $vgpr0_vgpr1 = COPY %0 ... +--- +name: test_implicit_def_s65 +body: | + bb.0: + + ; CHECK-LABEL: name: test_implicit_def_s65 + ; CHECK: [[DEF:%[0-9]+]]:_(s128) = G_IMPLICIT_DEF + ; CHECK: [[TRUNC:%[0-9]+]]:_(s96) = G_TRUNC [[DEF]](s128) + ; CHECK: $vgpr0_vgpr1_vgpr2 = COPY [[TRUNC]](s96) + %0:_(s65) = G_IMPLICIT_DEF + %1:_(s96) = G_ANYEXT %0 + $vgpr0_vgpr1_vgpr2 = COPY %1 +... + --- name: test_implicit_def_s128 body: |