[PATCH] D43079: [TTI CostModel] change default cost of FP ops to 1 (PR36280)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 09:10:18 PST 2018


spatel created this revision.
spatel added reviewers: hfinkel, ABataev, efriedma, fhahn, RKSimon, craig.topper.
Herald added subscribers: kristof.beyls, javed.absar, mcrosier, aemerson.
spatel retitled this revision from "[TTI CostModel] change default cost of FP ops to 1 (PR" to "[TTI CostModel] change default cost of FP ops to 1 (PR36280)".

This change was mentioned at least as far back as:
https://bugs.llvm.org/show_bug.cgi?id=26837#c26
...and I found a real program that directly shows the harm. Himeno running on AMD Jaguar gets 6% slower with SLP vectorization:
https://bugs.llvm.org/show_bug.cgi?id=36280

I don't know the history here. Maybe this was set in the Pentium 4 days, or there's just confusion about which cost we're modelling.

I've added a comment to make it clear that this is the throughput cost of a math instruction.

The div/rem costs for x86 look very wrong in some cases, but I think that's already true, so we can fix those in follow-up patches. There's also evidence that more cost model changes are needed to solve SLP problems as shown in https://reviews.llvm.org/D42981, but I think that's an independent problem (though the solution may be adjusted assuming this change is approved).


https://reviews.llvm.org/D43079

Files:
  include/llvm/CodeGen/BasicTTIImpl.h
  test/Analysis/CostModel/X86/arith-fp.ll
  test/Analysis/CostModel/X86/intrinsic-cost.ll
  test/Analysis/CostModel/X86/reduction.ll
  test/Transforms/LoopVectorize/X86/imprecise-through-phis.ll
  test/Transforms/SLPVectorizer/AArch64/remarks.ll
  test/Transforms/SLPVectorizer/X86/PR36280.ll
  test/Transforms/SLPVectorizer/X86/cse.ll
  test/Transforms/SLPVectorizer/X86/horizontal.ll
  test/Transforms/SLPVectorizer/X86/insert-element-build-vector.ll
  test/Transforms/SLPVectorizer/X86/reorder_phi.ll
  test/Transforms/SLPVectorizer/X86/simplebb.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43079.133434.patch
Type: text/x-patch
Size: 55786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180208/4cbcc300/attachment.bin>


More information about the llvm-commits mailing list