Skip to content

Commit

Permalink
Support native fma on riscv64
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Jan 14, 2025
1 parent 9b1ea1a commit a8cb1bb
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/llvm-cpufeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ static bool have_fma(Function &intr, Function &caller, const Triple &TT) JL_NOTS
SmallVector<StringRef, 128> Features;
FS.split(Features, ',');
for (StringRef Feature : Features)
if (TT.isARM()) {
if (Feature == "+vfp4")
return typ == "f32" || typ == "f64";
else if (Feature == "+vfp4sp")
return typ == "f32";
} else if (TT.isX86()) {
if (Feature == "+fma" || Feature == "+fma4")
return typ == "f32" || typ == "f64";
}
if (TT.isARM()) {
if (Feature == "+vfp4")
return typ == "f32" || typ == "f64";
else if (Feature == "+vfp4sp")
return typ == "f32";
} else if (TT.isX86()) {
if (Feature == "+fma" || Feature == "+fma4")
return typ == "f32" || typ == "f64";
} else if (TT.isRISCV64()) {
if (Feature == "+zfh" || Feature == "+f" || Feature == "+d")
return typ == "f16" || typ == "f32" || typ == "f64";
}

return false;
}
Expand Down

0 comments on commit a8cb1bb

Please sign in to comment.