[llvm] r358894 - AMDGPU/GlobalISel: Fix non-power-of-2 G_EXTRACT sources
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 22 08:22:46 PDT 2019
Author: arsenm
Date: Mon Apr 22 08:22:46 2019
New Revision: 358894
URL: http://llvm.org/viewvc/llvm-project?rev=358894&view=rev
Log:
AMDGPU/GlobalISel: Fix non-power-of-2 G_EXTRACT sources
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp?rev=358894&r1=358893&r2=358894&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp Mon Apr 22 08:22:46 2019
@@ -561,7 +561,9 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo
return (LitTy.getScalarSizeInBits() < 16);
},
LegalizeMutations::widenScalarOrEltToNextPow2(LitTyIdx, 16))
- .moreElementsIf(isSmallOddVector(BigTyIdx), oneMoreElement(BigTyIdx));
+ .moreElementsIf(isSmallOddVector(BigTyIdx), oneMoreElement(BigTyIdx))
+ .widenScalarToNextPow2(BigTyIdx, 32);
+
}
// TODO: vectors of pointers
Modified: llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir?rev=358894&r1=358893&r2=358894&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir Mon Apr 22 08:22:46 2019
@@ -29,6 +29,60 @@ body: |
%1:_(s32) = G_EXTRACT %0, 32
$vgpr0 = COPY %1
...
+
+---
+name: test_extract_s8_s15_offset0
+body: |
+ bb.0:
+ liveins: $vgpr0_vgpr1
+
+ ; CHECK-LABEL: name: test_extract_s8_s15_offset0
+ ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
+ ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
+ ; CHECK: $vgpr0 = COPY [[TRUNC]](s32)
+ %0:_(s64) = COPY $vgpr0_vgpr1
+ %1:_(s31) = G_TRUNC %0
+ %2:_(s8) = G_EXTRACT %1, 0
+ %3:_(s32) = G_ANYEXT %2
+ $vgpr0 = COPY %3
+...
+
+---
+name: test_extract_s16_s31_offset0
+body: |
+ bb.0:
+ liveins: $vgpr0_vgpr1
+
+ ; CHECK-LABEL: name: test_extract_s16_s31_offset0
+ ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
+ ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
+ ; CHECK: [[EXTRACT:%[0-9]+]]:_(s16) = G_EXTRACT [[TRUNC]](s32), 0
+ ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[EXTRACT]](s16)
+ ; CHECK: $vgpr0 = COPY [[ANYEXT]](s32)
+ %0:_(s64) = COPY $vgpr0_vgpr1
+ %1:_(s31) = G_TRUNC %0
+ %2:_(s16) = G_EXTRACT %1, 0
+ %3:_(s32) = G_ANYEXT %2
+ $vgpr0 = COPY %3
+...
+
+---
+name: test_extract_s32_s48_offset0
+body: |
+ bb.0:
+ liveins: $vgpr0_vgpr1
+
+ ; CHECK-LABEL: name: test_extract_s32_s48_offset0
+ ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
+ ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
+ ; CHECK: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY1]](s64), 0
+ ; CHECK: $vgpr0 = COPY [[EXTRACT]](s32)
+ %0:_(s64) = COPY $vgpr0_vgpr1
+ %1:_(s48) = G_TRUNC %0
+ %2:_(s32) = G_EXTRACT %1, 0
+ $vgpr0 = COPY %2
+...
+
---
name: test_extract_s32_s96_offset0
body: |
More information about the llvm-commits
mailing list