[PATCH] D56907: [TTI] Add generic USUBSAT costs

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 18 11:33:45 PST 2019


nikic added inline comments.


================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:1278
+      Cost += ConcreteTTI->getCmpSelInstrCost(BinaryOperator::ICmp, RetTy,
+                                              CondTy, nullptr);
+      Cost += ConcreteTTI->getCmpSelInstrCost(BinaryOperator::Select, RetTy,
----------------
Should we omit the icmp cost for the scalar case, on the assumption that it will be handled as an overflow flag instead?


================
Comment at: test/Analysis/CostModel/X86/arith-usat.ll:313
+; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V2I64 = call <2 x i64> @llvm.usub.sat.v2i64(<2 x i64> undef, <2 x i64> undef)
+; AVX2-NEXT:  Cost Model: Found an estimated cost of 3 for instruction: %V4I64 = call <4 x i64> @llvm.usub.sat.v4i64(<4 x i64> undef, <4 x i64> undef)
+; AVX2-NEXT:  Cost Model: Found an estimated cost of 6 for instruction: %V8I64 = call <8 x i64> @llvm.usub.sat.v8i64(<8 x i64> undef, <8 x i64> undef)
----------------
Not directly related to this change, but the current icmp cost model for X86 doesn't distinguish comparison types, so it assigns the same cost to signed and unsigned vector comparisons, even though the latter only exist since AVX512. The cost here should probably be 5 to account for the sign flips.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56907/new/

https://reviews.llvm.org/D56907





More information about the llvm-commits mailing list