Skip to content

Commit c9fe119

Browse files
committed
[RISCV][GlobalISel] Legalize G_ICMP and G_SELECT
Test legalization for (i7, i8, i16, i32, i48, i64) on rv32 and for (i8, i15, i16, i32, i64, i72, i128). Legalization fails for i96 on rv32 and i192 on rv64. Note that [i192 fails for AArch64](llvm#64394). Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D157023
1 parent cd61e8d commit c9fe119

File tree

5 files changed

+3925
-0
lines changed

5 files changed

+3925
-0
lines changed

llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,17 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) {
8585
.widenScalarToNextPow2(0)
8686
.clampScalar(0, XLenLLT, XLenLLT);
8787

88+
getActionDefinitionsBuilder(G_ICMP)
89+
.legalFor({{XLenLLT, XLenLLT}})
90+
.widenScalarToNextPow2(1)
91+
.clampScalar(1, XLenLLT, XLenLLT)
92+
.clampScalar(0, XLenLLT, XLenLLT);
93+
94+
getActionDefinitionsBuilder(G_SELECT)
95+
.legalFor({{XLenLLT, XLenLLT}})
96+
.widenScalarToNextPow2(0)
97+
.clampScalar(0, XLenLLT, XLenLLT)
98+
.clampScalar(1, XLenLLT, XLenLLT);
99+
88100
getLegacyLegalizerInfo().computeTables();
89101
}

0 commit comments

Comments
 (0)