[all-commits] [llvm/llvm-project] 21babe: [X86] Combine reduce(add (mul x, y)) to VNNI instr...

Luo, Yuanke via All-commits all-commits at lists.llvm.org
Fri Jan 7 05:14:36 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 21babe4db326a4bbac2e317ad50e4f62643e4a1d
  Author: Luo, Yuanke <yuanke.luo at intel.com>
  Date:   2022-01-07 (Fri, 07 Jan 2022)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86PartialReduction.cpp
    A llvm/test/CodeGen/X86/dpbusd.ll
    A llvm/test/CodeGen/X86/dpbusd_i4.ll

  Log Message:
  [X86] Combine reduce(add (mul x, y)) to VNNI instruction.

For below C code, we can use VNNI to combine the mul and add operation.
int usdot_prod_qi(unsigned char *restrict a, char *restrict b, int c,
                  int n) {
  int i;
  for (i = 0; i < 32; i++) {
    c += ((int)a[i] * (int)b[i]);
  return c;
We didn't support the combine acoss basic block in this patch.

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

More information about the All-commits mailing list