[llvm-bugs] [Bug 26417] New: Add AVX-512 support in X86TargetLowering::emitFMA3Instr

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 1 09:06:38 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26417

            Bug ID: 26417
           Summary: Add AVX-512 support in
                    X86TargetLowering::emitFMA3Instr
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: hfinkel at anl.gov
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15788
  --> https://llvm.org/bugs/attachment.cgi?id=15788&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160201/2f46a9ef/attachment.html>


More information about the llvm-bugs mailing list