<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 --- - AVX512: fmsub intrinsic generates fmadd instruction"
   href="https://llvm.org/bugs/show_bug.cgi?id=28892">28892</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AVX512: fmsub intrinsic generates fmadd instruction
          </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>wenzel.jakob@epfl.ch
          </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>Consider the following simple snippet which uses the fused multiply subtract
instruction on AVX512 and AVX:

=============

#include <immintrin.h>

__m512 test(__m512 a, __m512 b, __m512 c) {
    return _mm512_fmsub_ps(a, b, c);
}

__m256 test(__m256 a, __m256 b, __m256 c) {
    return _mm256_fmsub_ps(a, b, c);
}

=============

In the AVX512 case, LLVM trunk generates the following weird code which does a
sign flip first followed by a FMADD instruction. The AVX backend, in
comparison, generates the expected (single FMADD instruction).

__Z4testDv16_fS_S_:
    vpxord    LCPI0_0(%rip), %zmm2, %zmm2
    vfmadd213ps    %zmm2, %zmm1, %zmm0
    retq

__Z4testDv8_fS_S_:
    vfmsub213ps    %ymm2, %ymm1, %ymm0
    retq</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>