[all-commits] [llvm/llvm-project] 301259: [RISCV] Teach getIntImmCostInst about (X & -(1 << ...
Craig Topper via All-commits
all-commits at lists.llvm.org
Mon Sep 29 10:36:48 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 301259a6b1c8146a185e7c1bea46ec02d028243e
https://github.com/llvm/llvm-project/commit/301259a6b1c8146a185e7c1bea46ec02d028243e
Author: Craig Topper <craig.topper at sifive.com>
Date: 2025-09-29 (Mon, 29 Sep 2025)
Changed paths:
M llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
M llvm/test/CodeGen/RISCV/and-negpow2-cmp.ll
Log Message:
-----------
[RISCV] Teach getIntImmCostInst about (X & -(1 << C1) & 0xffffffff) == C2 << C1 (#160163)
We can rewrite this to (srai(w)/srli X, C1) == C2 so the AND immediate
is free. This transform is done by performSETCCCombine in
RISCVISelLowering.cpp.
This fixes the opaque constant case mentioned in #157416.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list