This seems to be beneficial overall, except for midpoint-int.ll .
The X86 backend seems to generate zeroing that are not necesary.
Paths
| Differential D131260
[DAG] select Cond, -1, C --> or (sext Cond), C if Cond is MVT::i1 ClosedPublic Authored by deadalnix on Aug 5 2022, 7:32 AM.
Details Summary This seems to be beneficial overall, except for midpoint-int.ll . The X86 backend seems to generate zeroing that are not necesary.
Diff Detail
Event Timeline
deadalnix retitled this revision from [DAG] select Cond, C, -1 --> or (sext Cond), C if Cond is MVT::i1 to [DAG] select Cond, -1, C --> or (sext Cond), C if Cond is MVT::i1.Aug 5 2022, 6:51 PM
deadalnix mentioned this in D131358: [X86] (0 - SetCC) | C -> (zext (not SetCC)) * (C + 1) - 1 if we can get a LEA out of it.. Comment ActionsRebase on top of D131358
Comment Actions I restored the select_cc creation, but now it generates some select_cc that the powerpc backend doesn't quite know what to do with.
Comment Actions @RKSimon I'll try what you suggest tomorrow. I've been sick so things are moving slowly on my end. Apologies. Comment Actions Update the condition in which we transform select to math as to preserve opportunities to optimize select_cc
Comment Actions
PPC part looks good! This revision is now accepted and ready to land.Sep 27 2022, 4:40 AM This revision was landed with ongoing or failed builds.Sep 27 2022, 5:55 AM Closed by commit rGd1baed7c9c83: [DAG] select Cond, -1, C --> or (sext Cond), C if Cond is MVT::i1 (authored by Amaury Séchet <deadalnix@gmail.com>). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 462897 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/PowerPC/crbits.ll
llvm/test/CodeGen/PowerPC/prefer-dqform.ll
llvm/test/CodeGen/X86/memcmp-more-load-pairs-x32.ll
llvm/test/CodeGen/X86/memcmp-more-load-pairs.ll
llvm/test/CodeGen/X86/memcmp-optsize-x32.ll
llvm/test/CodeGen/X86/memcmp-optsize.ll
llvm/test/CodeGen/X86/memcmp-pgso-x32.ll
llvm/test/CodeGen/X86/memcmp-pgso.ll
llvm/test/CodeGen/X86/memcmp-x32.ll
llvm/test/CodeGen/X86/memcmp.ll
llvm/test/CodeGen/X86/midpoint-int.ll
llvm/test/CodeGen/X86/select.ll
llvm/test/CodeGen/X86/select_const.ll
|
Maybe adjust convertSelectOfConstantsToMath to take the Cond opcode as another argument instead?