Skip to content

Commit 818701f

Browse files
toppercarsenm
authored andcommitted
[RISCV][GISel] Support fcmp and fclass for Zfh. (#96696)
1 parent ce53c89 commit 818701f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,20 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
404404
typeIs(1, s16)(Query));
405405
});
406406

407-
getActionDefinitionsBuilder(G_FCMP)
408-
.legalIf(all(typeIs(0, sXLen), typeIsScalarFPArith(1, ST)))
409-
.clampScalar(0, sXLen, sXLen);
407+
auto &FCmpActions = getActionDefinitionsBuilder(G_FCMP).legalIf(
408+
all(typeIs(0, sXLen), typeIsScalarFPArith(1, ST)));
409+
// TODO: Fold this into typeIsScalarFPArith.
410+
if (ST.hasStdExtZfh())
411+
FCmpActions.legalFor({sXLen, s16});
412+
FCmpActions.clampScalar(0, sXLen, sXLen);
410413

411414
// TODO: Support vector version of G_IS_FPCLASS.
412-
getActionDefinitionsBuilder(G_IS_FPCLASS)
413-
.customIf(all(typeIs(0, s1), typeIsScalarFPArith(1, ST)));
415+
auto &FClassActions =
416+
getActionDefinitionsBuilder(G_IS_FPCLASS)
417+
.customIf(all(typeIs(0, s1), typeIsScalarFPArith(1, ST)));
418+
// TODO: Fold this into typeIsScalarFPArith.
419+
if (ST.hasStdExtZfh())
420+
FClassActions.customFor({s1, s16});
414421

415422
getActionDefinitionsBuilder(G_FCONSTANT)
416423
.legalIf(typeIsScalarFPArith(0, ST))

0 commit comments

Comments
 (0)