aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2024-06-26 11:10:12 -0700
committerCraig Topper <craig.topper@sifive.com>2024-06-26 11:11:05 -0700
commit868fae1f2ecb54604231c1334ce9aa5b4c0b1288 (patch)
tree991d9beb2bfad686e549f842eb55e8e0e4c2c352 /llvm/lib
parent8ab66775dc885f7a99ee5f53771ce555e42085f9 (diff)
downloadllvm-868fae1f2ecb54604231c1334ce9aa5b4c0b1288.zip
llvm-868fae1f2ecb54604231c1334ce9aa5b4c0b1288.tar.gz
llvm-868fae1f2ecb54604231c1334ce9aa5b4c0b1288.tar.bz2
[RISCV][GISel] Support G_FPEXT/FPTRUNC with ZFh.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index fc616d0..f033ea7 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -384,15 +384,24 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
getActionDefinitionsBuilder(G_FCOPYSIGN)
.legalIf(all(typeIsScalarFPArith(0, ST), typeIsScalarFPArith(1, ST)));
+ // FIXME: Use Zfhmin.
getActionDefinitionsBuilder(G_FPTRUNC).legalIf(
[=, &ST](const LegalityQuery &Query) -> bool {
return (ST.hasStdExtD() && typeIs(0, s32)(Query) &&
+ typeIs(1, s64)(Query)) ||
+ (ST.hasStdExtZfh() && typeIs(0, s16)(Query) &&
+ typeIs(1, s32)(Query)) ||
+ (ST.hasStdExtZfh() && ST.hasStdExtD() && typeIs(0, s16)(Query) &&
typeIs(1, s64)(Query));
});
getActionDefinitionsBuilder(G_FPEXT).legalIf(
[=, &ST](const LegalityQuery &Query) -> bool {
return (ST.hasStdExtD() && typeIs(0, s64)(Query) &&
- typeIs(1, s32)(Query));
+ typeIs(1, s32)(Query)) ||
+ (ST.hasStdExtZfh() && typeIs(0, s32)(Query) &&
+ typeIs(1, s16)(Query)) ||
+ (ST.hasStdExtZfh() && ST.hasStdExtD() && typeIs(0, s64)(Query) &&
+ typeIs(1, s16)(Query));
});
getActionDefinitionsBuilder(G_FCMP)