diff options
author | David Green <david.green@arm.com> | 2025-02-13 16:05:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-13 16:05:00 +0000 |
commit | b2165f214efab833a4b1a9e8268b1030fc5ebaeb (patch) | |
tree | a2de9e2f01c3ed5f7728a881ce9381eaa74d86a1 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | de09986596c9bbc89262456dda319715fb49353f (diff) | |
download | llvm-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