[llvm-bugs] [Bug 46382] New: __builtin_nontemporal_store spoils vectorization

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 18 08:36:41 PDT 2020


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

            Bug ID: 46382
           Summary: __builtin_nontemporal_store spoils vectorization
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jed at 59a2.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

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];
        }
  }

  https://gcc.godbolt.org/z/E-zCLZ

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.

-- 
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/20200618/76680f11/attachment.html>


More information about the llvm-bugs mailing list