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

            Bug ID: 27630
           Summary: LLVM generates SIMD instructions on copying a large
                    object which is slow.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: co...@google.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

LLVM generates SSE instructions (on x86 each movaps copies 16 bytes) on copying
a large object for the following code, which underperforms GCC's generated code
in which each mov instruction copies 8 bytes:

struct A {
  int a[16];
};

constexpr int N = 10000;
A a[N], b[N];
int main() {
  for (int j = 0; j < 1000; ++j) {
    for (int i = 0; i < N; ++i) {
      a[i] = b[i];
    }
  }
}

Running time (on a Haswell machine):

LLVM: 0.071s
GCC:  0.039s

The performance becomes worse if we don't unroll the loop.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to