[llvm] [RISCV] Transform fcmp to is.fpclass (PR #120242)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 07:12:34 PST 2024


================
@@ -196,6 +199,42 @@ bool RISCVCodeGenPrepare::expandVPStrideLoad(IntrinsicInst &II) {
   return true;
 }
 
+// The 'fcmp uno/ord/oeq/une/ueq/one/ogt/oge/olt/ole x, 0.0' instructions are
+// equivalent to an FP class test. If the fcmp instruction would be custom
+// lowered or lowered to a libcall, use the is.fpclass intrinsic instead, which
+// is lowered by the back-end without a libcall.
+//
+// This basically reverts the transformations of
+// InstCombinerImpl::foldIntrinsicIsFPClass.
+bool RISCVCodeGenPrepare::visitFCmpInst(FCmpInst &Fcmp) {
----------------
arsenm wrote:

CodeGenPrepare already has this transform 

https://github.com/llvm/llvm-project/pull/120242


More information about the llvm-commits mailing list