aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2025-02-13 16:05:00 +0000
committerGitHub <noreply@github.com>2025-02-13 16:05:00 +0000
commitb2165f214efab833a4b1a9e8268b1030fc5ebaeb (patch)
treea2de9e2f01c3ed5f7728a881ce9381eaa74d86a1 /flang/lib/Frontend/CompilerInvocation.cpp
parentde09986596c9bbc89262456dda319715fb49353f (diff)
downloadllvm-b2165f214efab833a4b1a9e8268b1030fc5ebaeb.zip
llvm-b2165f214efab833a4b1a9e8268b1030fc5ebaeb.tar.gz
llvm-b2165f214efab833a4b1a9e8268b1030fc5ebaeb.tar.bz2
[CostModel] Account for power-2 urem in funnel shift costs (#127037)
As can be seen in https://godbolt.org/z/qvMqY79cK, a urem by a power-2 constant will be code-generated as an And of a mask. The cost model for funnel shifts tries to account for that by passing OP_PowerOf2 as the operand info for the second operand. As far as I can tell returning a lower cost for urem with a OP_PowerOf2 is only implemented on X86 though. This patch short-cuts that by calling getArithmeticInstrCost(And, ..) directly when we know the typesize will be a power-of-2. This is an alternative to the patch in #126912 which is a more general solution for power-2 udiv/urem costs, this more narrowly just fixes funnel shifts.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions