[PATCH] D111968: [TTI] Add OperandValueProperties::OP_NegatedPowerOf2 enum

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 17 11:21:05 PDT 2021


RKSimon created this revision.
RKSimon added reviewers: spatel, ABataev, dmgreen, evandro.
Herald added subscribers: pengfei, hiraditya.
RKSimon requested review of this revision.
Herald added a project: LLVM.

The div/rem by constant costmodels handle power-of-2 constants, but not negated-power-of-2, despite the backends handling both.

This patch adds the OperandValueProperties::OP_NegatedPowerOf2 enum and wires it for use for basic div/rem cost analysis.

Followup work will ensure we can also use this in the vectorizers.

We should then be able to add x86 costs for multiply by negated-power-of-2 to help address https://bugs.llvm.org/show_bug.cgi?id=51436


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111968

Files:
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  llvm/lib/Target/X86/X86TargetTransformInfo.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/test/Analysis/CostModel/X86/div.ll
  llvm/test/Analysis/CostModel/X86/rem.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111968.380259.patch
Type: text/x-patch
Size: 397043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211017/b6b1ca96/attachment-0001.bin>


More information about the llvm-commits mailing list