[all-commits] [llvm/llvm-project] 547160: [RISCV] Return true in hasBitTest when Zbs is enab...
Alex Bradbury via All-commits
all-commits at lists.llvm.org
Tue Sep 13 08:52:37 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 547160848c427223ec81aad02c71278d2b815869
https://github.com/llvm/llvm-project/commit/547160848c427223ec81aad02c71278d2b815869
Author: Alex Bradbury <asb at igalia.com>
Date: 2022-09-13 (Tue, 13 Sep 2022)
Changed paths:
M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
M llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
M llvm/test/CodeGen/RISCV/bittest.ll
Log Message:
-----------
[RISCV] Return true in hasBitTest when Zbs is enabled and update BEXTI pattern for resulting canonicalisation
As the Zbs extension includes bext[i] for bit extract, we can
unconditionally return true from this hook. This hook causes the DAG
combiner to perform the following canonicalisation:
and (not (srl X, C)), 1 --> (and X, 1<<C) == 0
and (srl (not X), C)), 1 --> (and X, 1<<C) == 0
As simply changing the hook causes a codegen regression, this patch also
modifies a BEXTI pattern to match this canonicalised form.
As BSETINVMask is now used for BEXT as well as BSET and BINV, it has
been renamed to the more generic SingleBitSetMask.
There is one codegen change in bittest.ll for bittest_31_i64 (NOT+BEXTI
rather than NOT+SRLIW). This is neutral in terms of code quality.
Differential Revision: https://reviews.llvm.org/D131482
More information about the All-commits
mailing list