Same idea as D48529, but restricted to X86 and done very late to avoid any surprises where subtract might be better for DAG combining.
This seems like the safest way to do this trick. And we consider doing it as a DAG combine later.
Paths
| Differential D48557
[X86] Use XOR for SUB (C, X) during isel if will help fold an immediate ClosedPublic Authored by craig.topper on Jun 25 2018, 12:25 PM.
Details Summary Same idea as D48529, but restricted to X86 and done very late to avoid any surprises where subtract might be better for DAG combining. This seems like the safest way to do this trick. And we consider doing it as a DAG combine later.
Diff Detail
Event TimelineComment Actions I agree with the direction. It's hard to generalize folds for select-of-constants even for x86 alone because there are so many weird cases. I've made patches that do something like these: ...but unraveling all of the regressions is painful.
This revision is now accepted and ready to land.Jun 25 2018, 2:12 PM Closed by commit rL335575: [X86] Use XOR for SUB (C, X) during isel if will help fold an immediate (authored by ctopper). · Explain WhyJun 25 2018, 8:15 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 152830 llvm/trunk/lib/Target/X86/X86InstrCompiler.td
llvm/trunk/test/CodeGen/X86/bool-math.ll
llvm/trunk/test/CodeGen/X86/dagcombine-select.ll
|