[llvm] X86: Improve cost model of fp16 conversion (PR #113195)
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 10:34:58 PDT 2024
================
@@ -3146,6 +3174,11 @@ InstructionCost X86TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
TTI::CastContextHint::None, CostKind);
}
+ if (ISD == ISD::FP_ROUND && LTDest.second.getScalarType() == MVT::f16) {
+ // Conversion requires a libcall.
+ return InstructionCost::getInvalid();
----------------
MatzeB wrote:
I am not able to reproduce so far. Unfortunately the dump does not contain some of the referenced metadata so I have to make guesses for that. Then trying to run `opt -S -o - -passes=loop-vectorize /tmp/x.ll` works just fine and I guess I need some target setup (I played with some `-mtriple=x86_64 -mattr=+avx512f,+f16c` but that doesn't repro either).
That said, could you try if replacing the `InstructionCost::getInvalid();` with `InstructionCost::getMax()` or if that doesn't work with a big number like 128 helps?
https://github.com/llvm/llvm-project/pull/113195
More information about the llvm-commits
mailing list