[DAGCombiner][x86] add transform/hook to decompose integer multiply into shift/add
authorSanjay Patel <spatel@rotateright.com>
Wed, 19 Sep 2018 15:57:40 +0000 (15:57 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 19 Sep 2018 15:57:40 +0000 (15:57 +0000)
commit4fd2e2a4980d3a0512524b8352669ef4aa9258a9
treee8a4697b5a408a2abaaf3d996544de30bf18f4a0
parentbd810dbd276a8d8150862b0ede16ea200c89546d
[DAGCombiner][x86] add transform/hook to decompose integer multiply into shift/add

This is an alternative to D37896. I don't see a way to decompose multiplies
generically without a target hook to tell us when it's profitable.

ARM and AArch64 may be able to remove some duplicate code that overlaps with
this transform.

As a first step, we're only getting the most clear wins on the vector examples
requested in PR34474:
https://bugs.llvm.org/show_bug.cgi?id=34474

As noted in the code comment, it's likely that the x86 constraints are tighter
than necessary, but it may not always be a win to replace a pmullw/pmulld.

Differential Revision: https://reviews.llvm.org/D52195

llvm-svn: 342554
13 files changed:
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/test/CodeGen/X86/urem-seteq-vec-nonsplat.ll
llvm/test/CodeGen/X86/urem-seteq-vec-splat.ll
llvm/test/CodeGen/X86/vector-idiv-sdiv-128.ll
llvm/test/CodeGen/X86/vector-idiv-sdiv-256.ll
llvm/test/CodeGen/X86/vector-idiv-sdiv-512.ll
llvm/test/CodeGen/X86/vector-idiv-udiv-128.ll
llvm/test/CodeGen/X86/vector-idiv-udiv-256.ll
llvm/test/CodeGen/X86/vector-idiv-udiv-512.ll
llvm/test/CodeGen/X86/vector-mul.ll