diff options
author | Craig Topper <craig.topper@sifive.com> | 2025-08-18 21:24:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-18 21:24:35 -0700 |
commit | da19383ae76d8483492cd52c26349ade8bfa4fbe (patch) | |
tree | 7f3a4e1452ae60f7c4f8b80173e386f14e8ebdf3 /clang/lib/AST/ByteCode/Program.cpp | |
parent | 2817873082c05b061b198853d64602ff26ce7cfe (diff) | |
download | llvm-da19383ae76d8483492cd52c26349ade8bfa4fbe.zip llvm-da19383ae76d8483492cd52c26349ade8bfa4fbe.tar.gz llvm-da19383ae76d8483492cd52c26349ade8bfa4fbe.tar.bz2 |
[RISCV] Fold (X & -4096) == 0 -> (X >> 12) == 0 (#154233)
This is a more general form of the recently added isel pattern
(seteq (i64 (and GPR:$rs1, 0x8000000000000000)), 0)
-> (XORI (i64 (SRLI GPR:$rs1, 63)), 1)
We can use a shift right for any AND mask that is a negated power
of 2. But for every other constant we need to use seqz instead of
xori. I don't think there is a benefit to xori over seqz as neither
are compressible.
We already do this transform from target independent code when the setcc
constant is a non-zero subset of the AND mask that is not a legal icmp
immediate.
I don't believe any of these patterns comparing MSBs to 0 are
canonical according to InstCombine. The canonical form is (X < 4096).
I'm curious if these appear during SelectionDAG and if so, how.
My goal here was just to remove the special case isel patterns.
Diffstat (limited to 'clang/lib/AST/ByteCode/Program.cpp')
0 files changed, 0 insertions, 0 deletions