[X86] Add support for combining FMSUB/FNMADD/FNMSUB ISD nodes with an fneg input.
authorCraig Topper <craig.topper@intel.com>
Thu, 5 Jul 2018 02:52:56 +0000 (02:52 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 5 Jul 2018 02:52:56 +0000 (02:52 +0000)
commit95eb88abfe17c1b1faeb5252554117d45cb2f50e
treeafc6a1450af5ffd6775b995d74a20436d2e77c9d
parente4b9257b697e89377964cc3a72225e94f35025eb
[X86] Add support for combining FMSUB/FNMADD/FNMSUB ISD nodes with an fneg input.

Previously we could only negate the FMADD opcodes. This used to be mostly ok when we lowered FMA intrinsics during lowering. But with the move to llvm.fma from target specific intrinsics, we can combine (fneg (fma)) to (fmsub) earlier. So if we start with (fneg (fma (fneg))) we would get stuck at (fmsub (fneg)).

This patch fixes that so we can also combine things like (fmsub (fneg)).

llvm-svn: 336304
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/avx2-fma-fneg-combine.ll
llvm/test/CodeGen/X86/avx512-intrinsics-canonical.ll
llvm/test/CodeGen/X86/fma-fneg-combine.ll