[ARM GlobalISel] Legalize G_FMA
For hard float with VFP4, it is legal. Otherwise, we use libcalls.
This needs a bit of support in the LegalizerHelper for soft float
because we didn't handle G_FMA libcalls yet. The support is trivial, as
the only difference between G_FMA and other libcalls that we already
handle is that it has 3 input operands rather than just 2.
llvm-svn: 322366
diff --git a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp
index fa5a857..3e694b8 100644
--- a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp
@@ -198,6 +198,13 @@
setFCmpLibcallsGNU();
}
+ if (!ST.useSoftFloat() && ST.hasVFP4())
+ for (auto Ty : {s32, s64})
+ setAction({G_FMA, Ty}, Legal);
+ else
+ for (auto Ty : {s32, s64})
+ setAction({G_FMA, Ty}, Libcall);
+
for (unsigned Op : {G_FREM, G_FPOW})
for (auto Ty : {s32, s64})
setAction({Op, Ty}, Libcall);