From: Matt Arsenault Date: Fri, 13 Sep 2019 04:04:55 +0000 (+0000) Subject: AMDGPU/GlobalISel: Legalize s32->s16 G_SITOFP/G_UITOFP X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f00688b2135ef85cdb982338698d09f820c95e37;p=llvm AMDGPU/GlobalISel: Legalize s32->s16 G_SITOFP/G_UITOFP git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371811 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp index 565a12be072..0c7ab7ae32e 100644 --- a/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp +++ b/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp @@ -416,7 +416,7 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, .scalarize(0); getActionDefinitionsBuilder({G_SITOFP, G_UITOFP}) - .legalFor({{S32, S32}, {S64, S32}}) + .legalFor({{S32, S32}, {S64, S32}, {S16, S32}}) .lowerFor({{S32, S64}}) .customFor({{S64, S64}}) .scalarize(0); diff --git a/test/CodeGen/AMDGPU/GlobalISel/legalize-sitofp.mir b/test/CodeGen/AMDGPU/GlobalISel/legalize-sitofp.mir index 33a0733a5d2..8c4d9d0a69a 100644 --- a/test/CodeGen/AMDGPU/GlobalISel/legalize-sitofp.mir +++ b/test/CodeGen/AMDGPU/GlobalISel/legalize-sitofp.mir @@ -141,3 +141,20 @@ body: | %1:_(s64) = G_SITOFP %0 $vgpr0_vgpr1 = COPY %1 ... + +--- +name: test_sitofp_s32_to_s16 +body: | + bb.0: + liveins: $vgpr0 + + ; CHECK-LABEL: name: test_sitofp_s32_to_s16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 + ; CHECK: [[SITOFP:%[0-9]+]]:_(s16) = G_SITOFP [[COPY]](s32) + ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SITOFP]](s16) + ; CHECK: $vgpr0 = COPY [[ANYEXT]](s32) + %0:_(s32) = COPY $vgpr0 + %1:_(s16) = G_SITOFP %0 + %2:_(s32) = G_ANYEXT %1 + $vgpr0 = COPY %2 +... diff --git a/test/CodeGen/AMDGPU/GlobalISel/legalize-uitofp.mir b/test/CodeGen/AMDGPU/GlobalISel/legalize-uitofp.mir index 3573630dffd..2ac82876389 100644 --- a/test/CodeGen/AMDGPU/GlobalISel/legalize-uitofp.mir +++ b/test/CodeGen/AMDGPU/GlobalISel/legalize-uitofp.mir @@ -110,3 +110,20 @@ body: | %1:_(s64) = G_UITOFP %0 $vgpr0_vgpr1 = COPY %1 ... + +--- +name: test_uitofp_s32_to_s16 +body: | + bb.0: + liveins: $vgpr0 + + ; CHECK-LABEL: name: test_uitofp_s32_to_s16 + ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0 + ; CHECK: [[UITOFP:%[0-9]+]]:_(s16) = G_UITOFP [[COPY]](s32) + ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[UITOFP]](s16) + ; CHECK: $vgpr0 = COPY [[ANYEXT]](s32) + %0:_(s32) = COPY $vgpr0 + %1:_(s16) = G_UITOFP %0 + %2:_(s32) = G_ANYEXT %1 + $vgpr0 = COPY %2 +...