[X86] Don't use PMADDWD for vector add reductions of multiplies if the mul inputs...
authorCraig Topper <craig.topper@intel.com>
Mon, 29 Jul 2019 01:36:58 +0000 (01:36 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 29 Jul 2019 01:36:58 +0000 (01:36 +0000)
commiteb1beabad94f80d67f8508087af4e9bc0d59fbff
treea6b7168d51d69de1aa9f8697f0e9389e400fde7e
parentac9d0f4150c8e8b452f51cd2249e177a41da863e
[X86] Don't use PMADDWD for vector add reductions of multiplies if the mul inputs have an additional user.

The pmaddwd inserts a truncate, if that truncate would end up
creating additional instructions instead of making a zext
narrower, then we shouldn't do it.

I've restricted this to only sse4.1 targets since on prior
targets the zext will be done in stages. So the truncate will
probably not create additional instructions. Might need some
more investigation of mul shrinking and the other pmaddwd
transform to be sure this is the right decision.

There might be a slight regression on AVX1 targets due to add
splitting. Hard to say for sure. Maybe we need to look into
using the vector reduction flag to use 2 narrow loads and a
blend instead of extracting and inserting.

llvm-svn: 367198
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/madd.ll