[PATCH] D51553: [DAGCombiner][x86] add transform/hook to load a scalar directly for use in a vector binop

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 07:41:54 PDT 2018


spatel added a reviewer: andreadb.
spatel added a comment.

In https://reviews.llvm.org/D51553#1234619, @RKSimon wrote:

> My main concern is the growth in the constant pool due to vector constants.


I agree that that is a trade-off, but I don't think we can make an informed decision about it at this level. We can fine-tune the hook in this patch if we see regressions, but we're still just guessing at the eventual global outcome.
So without that kind of knowledge, we have to look at the micro-motivation.

Here's llvm-mca output using scalar math on btver2 (Jaguar):

  [0,0]     DeeeeeER  .    ..   movl	(%rdi), %eax
  [0,1]     D=====eER .    ..   addl	$42, %eax
  [0,2]     .D=====eeeeeeeeER   movd	%eax, %xmm0  <--- move to vector register has 8-cycle latency?

vs. vector op:

  [0,0]     DeeeeeER  .   movd	(%rdi), %xmm0
  [0,1]     D==eeeeeeER   paddd	32(%rip), %xmm0

Seems like the right choice to do the transform here?


https://reviews.llvm.org/D51553





More information about the llvm-commits mailing list