Extension to the signbit case, if the signbits extend down through all the demanded bits then SMIN/SMAX/UMIN/UMAX nodes can be simplified to a OR/AND/AND/OR.
Alive2: https://alive2.llvm.org/ce/z/mFVFAn (general case)
Paths
| Differential D158364
[DAG] SimplifyDemandedBits - if we're only demanding the signbits, a MIN/MAX node can be simplified to a OR or AND node ClosedPublic Authored by RKSimon on Aug 20 2023, 7:31 AM.
Details Summary Extension to the signbit case, if the signbits extend down through all the demanded bits then SMIN/SMAX/UMIN/UMAX nodes can be simplified to a OR/AND/AND/OR. Alive2: https://alive2.llvm.org/ce/z/mFVFAn (general case)
Diff Detail
Event TimelineComment Actions Can you parameterize the proofs with C1 and C2 instead of just 3 and 1 to make them complete? Comment Actions Also I think this also works for umax / umin (although inverted): https://alive2.llvm.org/ce/z/UX_NYn RKSimon retitled this revision from [DAG] SimplifyDemandedBits - if we're only demanding the signbits, a SMIN/SMAX node can be simplified to a OR/AND node respectively. to [DAG] SimplifyDemandedBits - if we're only demanding the signbits, a MIN/MAX node can be simplified to a OR or AND node. Comment ActionsAdded UMIN/UMAX handling and merged all MIN/MAX cases to share code SMIN/SMAX are still missing proper known bits handling in SimplifyDemandedBits - I'll address this separately with proper test coverage.
Comment Actions LGTM
This revision is now accepted and ready to land.Aug 31 2023, 11:27 AM Closed by commit rGaca8b9d0d56e: [DAG] SimplifyDemandedBits - if we're only demanding the signbits, a MIN/MAX… (authored by RKSimon). · Explain WhySep 1 2023, 2:59 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 555316 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/X86/known-signbits-vector.ll
|
Should compute Known for smin/smax? Imo also just fill in the TODO. Its not much code required.