[llvm] 392b969 - AMDGPU/GlobalISel: Don't assert on G_INSERT > 128-bits
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 25 07:05:50 PDT 2020
Author: Matt Arsenault
Date: 2020-07-25T10:05:44-04:00
New Revision: 392b969c3203001d076eafc080d6d014827d39ca
URL: https://github.com/llvm/llvm-project/commit/392b969c3203001d076eafc080d6d014827d39ca
DIFF: https://github.com/llvm/llvm-project/commit/392b969c3203001d076eafc080d6d014827d39ca.diff
LOG: AMDGPU/GlobalISel: Don't assert on G_INSERT > 128-bits
Just fallback for now. Really tablegen needs to generate all of the
subregister index handling we need.
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert.xfail.mir
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
index a63744200293..4740a5851999 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
@@ -736,6 +736,10 @@ bool AMDGPUInstructionSelector::selectG_INSERT(MachineInstr &I) const {
if (Offset % 32 != 0 || InsSize % 32 != 0)
return false;
+ // Currently not handled by getSubRegFromChannel.
+ if (InsSize > 128)
+ return false;
+
unsigned SubReg = TRI.getSubRegFromChannel(Offset / 32, InsSize / 32);
if (SubReg == AMDGPU::NoSubRegister)
return false;
diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert.xfail.mir b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert.xfail.mir
index 5e58e8b633ec..150b341561f9 100644
--- a/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert.xfail.mir
+++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-insert.xfail.mir
@@ -1,9 +1,13 @@
# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -global-isel-abort=2 -pass-remarks-missed='gisel*' -verify-machineinstrs -o /dev/null %s 2>&1 | FileCheck -check-prefix=ERR %s
-# FIXME: This should not be legal and this test should be deleted
-# ERR: remark: <unknown>:0:0: cannot select: %3:sgpr(<4 x s16>) = G_INSERT %0:sgpr, %2:sgpr(s16), 0 (in function: insert_sgpr_2s16_to_v4s16_offset0)
+# ERR: remark: <unknown>:0:0: cannot select: %3:sgpr(<4 x s16>) = G_INSERT %0:sgpr, %2:sgpr(s16), 0 (in function: insert_sgpr_s16_to_v4s16_offset0)
+# ERR-NEXT: remark: <unknown>:0:0: cannot select: %2:sgpr(<16 x s32>) = G_INSERT %0:sgpr, %1:sgpr(<8 x s32>), 0 (in function: insert_sgpr_v8s32_to_v16s32_offset0)
+# ERR-NOT: remark
+
+# FIXME: This 16-bit insert source should not be legal and this test
+# should be deleted
---
-name: insert_sgpr_2s16_to_v4s16_offset0
+name: insert_sgpr_s16_to_v4s16_offset0
legalized: true
regBankSelected: true
@@ -17,3 +21,19 @@ body: |
S_ENDPGM 0, implicit %3
...
+
+# getSubRegFromChannel current does not handle cases > 128-bits
+---
+name: insert_sgpr_v8s32_to_v16s32_offset0
+legalized: true
+regBankSelected: true
+
+body: |
+ bb.0:
+ liveins: $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15, $sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23
+ %0:sgpr(<16 x s32>) = COPY $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7_sgpr8_sgpr9_sgpr10_sgpr11_sgpr12_sgpr13_sgpr14_sgpr15
+ %1:sgpr(<8 x s32>) = COPY $sgpr16_sgpr17_sgpr18_sgpr19_sgpr20_sgpr21_sgpr22_sgpr23
+ %2:sgpr(<16 x s32>) = G_INSERT %0, %1, 0
+ S_ENDPGM 0, implicit %2
+
+...
More information about the llvm-commits
mailing list