[PATCH] D36479: [X86][AVX512] Choose correct registers in vpbroadcastb/w

Guy Blank via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 11:49:17 PDT 2017


guyblank created this revision.

This patch addresses pr33795 <https://bugs.llvm.org/show_bug.cgi?id=33795>

The vpbroadcastb/w instructions flavor which broadcasts a byte/word from the lower part of a GPR to an XMM/YMM/ZMM, should use the full GPR as the source operand. 
But currently it uses the GR8/16 regclasses attempting to match the subregisters corresponding to the part being broadcast.
In most cases this turns out ok since the encoding for AL,BL,CL,DL is the same as their full registers. But, as seen in the bug report, when CH is chosen, the encoding actually matches EBP.
Plus, CH shouldn't have been used at all since it isn't the lower part of a GPR.

The patch adds td patterns and classes to move the source value from the subregister to the full register and use it in the broadcast.


https://reviews.llvm.org/D36479

Files:
  lib/Target/X86/X86InstrAVX512.td
  test/CodeGen/X86/avx512bw-intrinsics.ll
  test/CodeGen/X86/avx512bwvl-intrinsics.ll
  test/CodeGen/X86/vector-shuffle-128-v16.ll
  test/CodeGen/X86/vector-shuffle-128-v8.ll
  test/CodeGen/X86/vector-shuffle-256-v16.ll
  test/CodeGen/X86/vector-shuffle-256-v32.ll
  test/CodeGen/X86/vector-shuffle-512-v32.ll
  test/CodeGen/X86/vector-shuffle-512-v64.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36479.110242.patch
Type: text/x-patch
Size: 15982 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170808/4d5695d7/attachment.bin>


More information about the llvm-commits mailing list