<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Add AVX-512 support in X86TargetLowering::emitFMA3Instr"
   href="https://llvm.org/bugs/show_bug.cgi?id=26417">26417</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Add AVX-512 support in X86TargetLowering::emitFMA3Instr
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hfinkel@anl.gov
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15788" name="attach_15788" title="Kernel where this might matter">attachment 15788</a> <a href="attachment.cgi?id=15788&action=edit" title="Kernel where this might matter">[details]</a></span>
Kernel where this might matter

In llvm/lib/Target/X86/X86ISelLowering.cpp we have:

// Replace 213-type (isel default) FMA3 instructions with 231-type for
// accumulator loops. Writing back to the accumulator allows the coalescer
// to remove extra copies in the loop.
// FIXME: Do this on AVX512.  We don't support 231 variants yet (PR23937).
MachineBasicBlock *
X86TargetLowering::emitFMA3Instr(MachineInstr *MI,
                                 MachineBasicBlock *MBB) const {
...

But PR23937 has now been fixed, and we should add AVX-512 support here.

I've attached a small test case (C with intrinsics) where I suspect this might
matter.

$ clang -S -o - -march=knl -O3 ~/tmp/avx512mm.c

...

.LBB0_3:                                # %.preheader10
                                        #   Parent Loop BB0_1 Depth=1
                                        #     Parent Loop BB0_2 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
    vmovaps    %zmm1, %zmm8
    vmovaps    %zmm2, %zmm9
    vmovaps    %zmm3, %zmm10
    vmovaps    %zmm4, %zmm11
    vmovaps    %zmm6, %zmm12
    vmovaps    %zmm7, %zmm13
    vmovaps    %zmm0, %zmm14
    vmovaps    %zmm5, %zmm1
    vmovapd    (%rdx), %zmm0
    vmovaps    %zmm0, %zmm5
    vfmadd231pd    -7168(%r14){1to8}, %zmm1, %zmm5
    vmovaps    %zmm0, %zmm1
    vfmadd231pd    -6144(%r14){1to8}, %zmm8, %zmm1
    vmovaps    %zmm0, %zmm2
    vfmadd231pd    -5120(%r14){1to8}, %zmm9, %zmm2
    vmovaps    %zmm0, %zmm3
    vfmadd231pd    -4096(%r14){1to8}, %zmm10, %zmm3
    vmovaps    %zmm0, %zmm4
    vfmadd231pd    -3072(%r14){1to8}, %zmm11, %zmm4
    vmovaps    %zmm0, %zmm6
    vfmadd231pd    -2048(%r14){1to8}, %zmm12, %zmm6
    vmovaps    %zmm0, %zmm7
    vfmadd231pd    -1024(%r14){1to8}, %zmm13, %zmm7
    vfmadd231pd    (%r14){1to8}, %zmm14, %zmm0
    addq    $8, %r14
    addq    $1024, %rdx             # imm = 0x400
    decq    %r10
    jne    .LBB0_3

...

and I this should select a different FMA form to avoid the excess moves.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>