[DAGCombiner] Optimize 1-bit smulo to AND+SETNE.
authorCraig Topper <craig.topper@sifive.com>
Sat, 13 Mar 2021 17:39:33 +0000 (09:39 -0800)
committerCraig Topper <craig.topper@sifive.com>
Sat, 13 Mar 2021 17:39:36 +0000 (09:39 -0800)
commit5b825433d7854f2e79966606ddfb381806cc499c
treeed2a56e0158e69b177721c723196aa44105dec90
parentb26c953f55d659ed5148f38e34716efb696b5016
[DAGCombiner] Optimize 1-bit smulo to AND+SETNE.

A 1-bit smulo overflows is both inputs are -1 since the result
should be +1 which can't be represented in a signed 1 bit value.

We can detect this with an AND and a setcc. The multiply result
can also use the same AND.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D97634
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/vec_smulo.ll