[llvm] [AArch64] Give a higher cost for more expensive SVE FCMP instructions (PR #153816)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 13:13:05 PDT 2025


================
@@ -4365,6 +4365,34 @@ AArch64TTIImpl::getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE,
   return 1;
 }
 
+/// Check whether Opcode1 has less throughput according to the scheduling
+/// model than Opcode2.
+bool AArch64TTIImpl::hasLessThroughputFromSchedulingModel(
+    unsigned Opcode1, unsigned Opcode2) const {
+  const MCSchedModel &Sched = ST->getSchedModel();
+  const TargetInstrInfo *TII = ST->getInstrInfo();
+  if (!Sched.hasInstrSchedModel())
+    return false;
+
+  auto ResolveVariant = [&](unsigned Opcode) {
+    unsigned SCIdx = TII->get(Opcode).getSchedClass();
+    while (SCIdx && Sched.getSchedClassDesc(SCIdx)->isVariant())
----------------
davemgreen wrote:

The variants are the what is found in places like llvm/lib/Target/AArch64/AArch64SchedPredicates.td, which are used in, for example
```
def V2Write_ArithI : SchedWriteVariant<[
                       SchedVar<IsCheapLSL,  [V2Write_1c_1I]>,
                       SchedVar<NoSchedPred, [V2Write_2c_1M]>]>;
```

They allow different scheduling information based on some characteristics of the instruction. The opcodes we are checking will not have any variants at the moment.

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


More information about the llvm-commits mailing list