This is the inverted case of
(select (x in [0,1] == 0), y, (z ^ y) ) -> (-x & z ) ^ y
Instead of -x we need -(x ^ 1) which simplifies to -(1-x) or (x-1).
Paths
| Differential D140454
[RISCV] Optimize (select (x in [0,1] != 0), y, (z ^ y) ) -> ((x-1) & z ) ^ y AbandonedPublic Authored by craig.topper on Dec 20 2022, 10:07 PM.
Details
Summary This is the inverted case of Instead of -x we need -(x ^ 1) which simplifies to -(1-x) or (x-1).
Diff Detail
Event TimelineComment Actions Reviewing this in isolation, LGTM. It's going to conflict with D140465 though so I'm not sure what your plan is there? This revision is now accepted and ready to land.Dec 21 2022, 1:36 AM Comment Actions
I will abandon this patch. The select rabbit hole kept getting deeper after I wrote this patch. I'll extract the new tests from it though.
Revision Contents
Diff 484464 llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/select.ll
|
clang-format not found in user’s local PATH; not linting file.