[all-commits] [llvm/llvm-project] f46890: [RISCV] Custom type legalize i32 ISD::ABS on RV64 ...
Craig Topper via All-commits
all-commits at lists.llvm.org
Mon Feb 28 09:40:21 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f46890711f03dfb02722ec18dc332753967700e8
https://github.com/llvm/llvm-project/commit/f46890711f03dfb02722ec18dc332753967700e8
Author: Craig Topper <craig.topper at sifive.com>
Date: 2022-02-28 (Mon, 28 Feb 2022)
Changed paths:
M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
M llvm/test/CodeGen/RISCV/neg-abs.ll
M llvm/test/CodeGen/RISCV/rv64zbb.ll
Log Message:
-----------
[RISCV] Custom type legalize i32 ISD::ABS on RV64 without Zbb.
Default type legalization will create sext_inreg+abs, but we may
not be able to remove the sext_inreg.
Instead this patch expands abs during type legalization to
Y = sraiw X, 31; subw(xor X, Y), Y) which doesn't require the input
to be sign extended.
This gives a big improvement for some neg-abs tests where the
abs is used more than the the neg. Previously the abs was expanded
a different way before and after type legalization. Now they are
expanded in a similar way enabling more CSE.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D120636
More information about the All-commits
mailing list