[PATCH] D147780: [AMDGPU][Global-ISel] reuse extension related patterns
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 9 19:12:32 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa3d5ec51bacf: [AMDGPU][Global-ISel] reuse extension related patterns in td file (authored by shchenz).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147780/new/
https://reviews.llvm.org/D147780
Files:
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
llvm/lib/Target/AMDGPU/SIInstructions.td
Index: llvm/lib/Target/AMDGPU/SIInstructions.td
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstructions.td
+++ llvm/lib/Target/AMDGPU/SIInstructions.td
@@ -2020,13 +2020,13 @@
def : GCNPat <
(i32 (sext i1:$src0)),
(V_CNDMASK_B32_e64 /*src0mod*/(i32 0), /*src0*/(i32 0),
- /*src1mod*/(i32 0), /*src1*/(i32 -1), $src0)
+ /*src1mod*/(i32 0), /*src1*/(i32 -1), i1:$src0)
>;
class Ext32Pat <SDNode ext> : GCNPat <
(i32 (ext i1:$src0)),
(V_CNDMASK_B32_e64 /*src0mod*/(i32 0), /*src0*/(i32 0),
- /*src1mod*/(i32 0), /*src1*/(i32 1), $src0)
+ /*src1mod*/(i32 0), /*src1*/(i32 1), i1:$src0)
>;
def : Ext32Pat <zext>;
Index: llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
@@ -3417,7 +3417,11 @@
case TargetOpcode::G_ZEXT:
case TargetOpcode::G_ANYEXT:
case TargetOpcode::G_SEXT_INREG:
- if (selectImpl(I, *CoverageInfo))
+ // This is a workaround. For extension from type i1, `selectImpl()` uses
+ // patterns from TD file and generates an illegal VGPR to SGPR COPY as type
+ // i1 can only be hold in a SGPR class.
+ if (MRI->getType(I.getOperand(1).getReg()) != LLT::scalar(1) &&
+ selectImpl(I, *CoverageInfo))
return true;
return selectG_SZA_EXT(I);
case TargetOpcode::G_BRCOND:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147780.512058.patch
Type: text/x-patch
Size: 1561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230410/9e3b7dec/attachment.bin>
More information about the llvm-commits
mailing list