[PATCH] D120597: [RISCV] With Zbb, fold (sext_inreg (abs X)) -> (max X, (negw X))
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 28 08:44:17 PST 2022
craig.topper added inline comments.
================
Comment at: llvm/test/CodeGen/RISCV/rv64zbb.ll:977
; RV64ZBB-NEXT: max a0, a0, a1
-; RV64ZBB-NEXT: sext.w a0, a0
; RV64ZBB-NEXT: ret
----------------
achieveartificialintelligence wrote:
> If line 964 `(i32 signext %x)` takes effect, why can't we remove line 977 directly?
The absolute value of a 32-bit value is a 33-bit number because 0xffffffff80000000 becomes 0x0000000080000000. The sign extend at the end will change it back to 0xffffffff80000000.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120597/new/
https://reviews.llvm.org/D120597
More information about the llvm-commits
mailing list