<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - __builtin_nontemporal_store spoils vectorization"
   href="https://bugs.llvm.org/show_bug.cgi?id=46382">46382</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__builtin_nontemporal_store spoils vectorization
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jed@59a2.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Use of Clang's __builtin_nontemporal_store() spoils vectorization on
clang-10/trunk:

  void copy(int n, const double *a, double *b) {
    for (int i = 0; i < n; i++)
        if (1) {
            __builtin_nontemporal_store(a[i], &b[i]);
        } else {
            b[i] = a[i];
        }
  }

  <a href="https://gcc.godbolt.org/z/E-zCLZ">https://gcc.godbolt.org/z/E-zCLZ</a>

This generates movnti (scalar code), while the alternative gives movupd/movups.
There appears to be no way to obtain vmovntpd except via _mm*_stream_pd
intrinsics. This also relates to OpenMP-5's pragma omp simd nontemporal, which
(when implemented) would provide a portable alternative.

Nontemporal stores can provide a significant performance boost for
bandwidth-intensive applications.  On my 2-socket EPYC 7452 node, for example,
it's the difference between 200 GB/s and 300 GB/s in STREAM, much of which
carries over to linear solves using Krylov methods.</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>