(sra X, BW-1) is either 0 or -1. So the multiply is a conditional
negate of Y.
This pattern shows up when type legalizing wide multiplies involving
a sign extended value.
Fixes PR57549.
| Paths 
 |  Differential  D133399  
[DAGCombiner] Fold (mul (sra X, BW-1), Y) -> (neg (and (sra X, BW-1), Y)) Needs ReviewPublic Authored by craig.topper on Sep 6 2022, 11:07 PM. 
Details Summary (sra X, BW-1) is either 0 or -1. So the multiply is a conditional This pattern shows up when type legalizing wide multiplies involving Fixes PR57549. 
Diff Detail 
 
Unit TestsFailed 
 Event Timeline
 
 
 
 This revision is now accepted and ready to land.Oct 10 2022, 11:58 AM This revision was landed with ongoing or failed builds.Oct 11 2022, 4:21 PM Closed by commit rG0148df8157f0: [DAGCombiner] Fold (mul (sra X, BW-1), Y) -> (neg (and (sra X, BW-1), Y)) (authored by craig.topper).  ·  Explain Why This revision was automatically updated to reflect the committed changes. This revision is now accepted and ready to land.Oct 11 2022, 4:31 PM This revision was not accepted when it landed; it landed in state Changes Planned.Oct 22 2022, 9:58 PM Closed by commit rGe8b3ffa532b8: [DAGCombiner] Fold (mul (sra X, BW-1), Y) -> (neg (and (sra X, BW-1), Y)) (authored by craig.topper).  ·  Explain Why This revision was automatically updated to reflect the committed changes. This revision is now accepted and ready to land.Oct 22 2022, 10:52 PM craig.topper added inline comments. 
 
 
Revision Contents 
 
 
 
Diff 466547 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
 
 llvm/test/CodeGen/AArch64/umulo-128-legalisation-lowering.ll
 llvm/test/CodeGen/AMDGPU/mad_64_32.ll
 llvm/test/CodeGen/PowerPC/pr45448.ll
 llvm/test/CodeGen/RISCV/mul.ll
 llvm/test/CodeGen/RISCV/xaluo.ll
 llvm/test/CodeGen/Thumb2/mve-vmull-splat.ll
 llvm/test/CodeGen/X86/extmul128.ll
 llvm/test/CodeGen/X86/muloti.ll
 llvm/test/CodeGen/X86/smul_fix_sat.ll
 llvm/test/CodeGen/X86/smulo-128-legalisation-lowering.ll
 llvm/test/CodeGen/X86/vec_smulo.ll
 llvm/test/CodeGen/X86/xmulo.ll
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
clang-format not found in user’s local PATH; not linting file.