[llvm] [AArch64][CostModel] Improve scalar frem cost (PR #80423)

Maciej Gabka via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 05:20:40 PST 2024


================
@@ -2940,6 +2940,14 @@ InstructionCost AArch64TTIImpl::getArithmeticInstrCost(
 
     return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info,
                                          Op2Info);
+  case ISD::FREM:
+    if (!Ty->isVectorTy()) {
+      Function *F =
+          CxtI == nullptr ? nullptr : CxtI->getModule()->getFunction("fmod");
----------------
mgabka wrote:

I am not sure that this will ever return you the right function pointer, and from what I am seeing AArch64 backend will generate frem as fmod/fmodf even if these functions aren't declared in the module, for example looking at llvm-project/llvm/test/CodeGen/AArch64/frem.ll test

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


More information about the llvm-commits mailing list