[X86] combineADC - fold ADC(C1,C2,Carry) -> ADC(0,C1+C2,Carry)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 29 Mar 2022 21:24:02 +0000 (22:24 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 30 Mar 2022 08:11:55 +0000 (09:11 +0100)
commit6697e3354fbe51242729888529d047c646acdab3
tree0db64ff5e440d425a8fe9cd65591bc08a3432ebe
parentd663166acbe59e4f17e406302552a1a9005204e8
[X86] combineADC - fold ADC(C1,C2,Carry) -> ADC(0,C1+C2,Carry)

If we're not relying on the flag result, we can fold the constants together into the RHS immediate operand and set the LHS operand to zero, simplifying for further folds.

We could do something similar if the flag result is in use and the constant fold doesn't affect it, but I don't have any real test cases for this yet.

As suggested by @davezarzycki on Issue #35256

Differential Revision: https://reviews.llvm.org/D122482
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/call-rv-marker.ll
llvm/test/CodeGen/X86/combine-adc.ll
llvm/test/CodeGen/X86/combine-add.ll
llvm/test/CodeGen/X86/pr16031.ll
llvm/test/CodeGen/X86/scheduler-backtracking.ll
llvm/test/CodeGen/X86/setcc.ll