[DAG] Fold neg(splat(neg(x)) -> splat(x)
authorDavid Green <david.green@arm.com>
Fri, 25 Jun 2021 18:53:29 +0000 (19:53 +0100)
committerDavid Green <david.green@arm.com>
Fri, 25 Jun 2021 18:53:29 +0000 (19:53 +0100)
commitb8c8bb07692cfb9a78049fd2fb5c46a91ee2e90f
treef3d3f87eeb5ad6ab1da6ee901c252ddaa82e71e4
parent0f3bc00a7d3cb223b4d5639723b8f71341c9df1e
[DAG] Fold neg(splat(neg(x)) -> splat(x)

This add as a fold of sub(0, splat(sub(0, x))) -> splat(x). This can
come up in the lowering of right shifts under AArch64, where we generate
a shift left of a negated number.

Differential Revision: https://reviews.llvm.org/D103755
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/neon-shift-neg.ll
llvm/test/CodeGen/AArch64/sub-splat-sub.ll