[X86] Don't emit MULX by default with BMI2
authorCraig Topper <craig.topper@intel.com>
Wed, 12 Dec 2018 21:21:31 +0000 (21:21 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 12 Dec 2018 21:21:31 +0000 (21:21 +0000)
commitd1c61861ddc94457b08a5a653d3908b7b38ebb22
tree88e2d24cda24d6d6675a3ace27b4114fb78228a6
parent50c9bf45b5ecd913594e68a2b84ee2b9b59936a3
[X86] Don't emit MULX by default with BMI2

MULX has somewhat improved register allocation constraints compared to the legacy MUL instruction. Both output registers are encoded instead of fixed to EAX/EDX, but EDX is used as input. It also doesn't touch flags. Unfortunately, the encoding is longer.

Prefering it whenever BMI2 is enabled is probably not optimal. Choosing it should somehow be a function of register allocation constraints like converting adds to three address. gcc and icc definitely don't pick MULX by default. Not sure what if any rules they have for using it.

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

llvm-svn: 348975
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/test/CodeGen/X86/bmi2-x86_64.ll
llvm/test/CodeGen/X86/bmi2.ll
llvm/test/CodeGen/X86/i128-mul.ll
llvm/test/CodeGen/X86/mulx32.ll
llvm/test/CodeGen/X86/mulx64.ll
llvm/test/CodeGen/X86/pr35636.ll