[llvm] [RISCV][TTI] Refine the cost of FCmp (PR #88833)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 17 09:26:04 PDT 2024


================
@@ -1383,7 +1385,13 @@ InstructionCost RISCVTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
            getRISCVInstructionCost(RISCV::VMSLT_VV, LT.second, CostKind);
   }
 
-  if ((Opcode == Instruction::FCmp) && ValTy->isVectorTy()) {
+  if ((Opcode == Instruction::FCmp) && ValTy->isVectorTy() &&
+      CmpInst::isFPPredicate(VecPred)) {
+
+    // Use VMXOR_MM and VMXNOR_MM to generate all true/false mask
+    if ((VecPred == CmpInst::FCMP_FALSE) || (VecPred == CmpInst::FCMP_TRUE))
+      return getRISCVInstructionCost(RISCV::VMXOR_MM, LT.second, CostKind);
----------------
topperc wrote:

Isn't LT here based on ValTy not CondTy? Or does getRISCVInstructionCost not care about the type for VMXOR?

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


More information about the llvm-commits mailing list