[AArch64][InstCombine] Fuse ADD+MUL and SUB+MUL AArch64 instrinsics
authorMatt Devereau <matthew.devereau@arm.com>
Thu, 15 Dec 2022 16:09:13 +0000 (16:09 +0000)
committerMatt Devereau <matthew.devereau@arm.com>
Thu, 22 Dec 2022 09:46:40 +0000 (09:46 +0000)
commita107cf0c407f418fafce60539b42114fe68fd737
tree7f99cdf6e6da544d1130f9223b1e70785d4e7edb
parentd0766c0861c6f9ab4ec286a695ae8e161f418b2f
[AArch64][InstCombine] Fuse ADD+MUL and SUB+MUL AArch64 instrinsics

Fold (ADD p c (MUL p a b)) into (MAD p a b c)
Fold (FADD p c (FMUL p a b)) into (FMAD p a b c)
Fold (FSUB p c (FMUL p a b)) into (FNMSB p a b c)

Fold (ADD p (MUL p a b) c) into (MLA p c a b)
Fold (FADD p (FMUL p a b) c) into (FMLA p c a b)
Fold (SUB p (MUL p a b) C) into (MLS p c a b)
Fold (FSUB p (FMUL p a b) c) into (FMLS p c a b)

Differential Revision: https://reviews.llvm.org/D140200
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-muladdsub.ll [moved from llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-muladd.ll with 50% similarity]