[llvm-bugs] [Bug 35567] New: Adler32 Hash; clang 5.0 is 1.3x slower than gcc 7.2

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 7 16:10:58 PST 2017


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

            Bug ID: 35567
           Summary: Adler32 Hash; clang 5.0 is 1.3x slower than gcc 7.2
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nigeltao at golang.org
                CC: llvm-bugs at lists.llvm.org

Created attachment 19528
  --> https://bugs.llvm.org/attachment.cgi?id=19528&action=edit
Adler32 C implementation

adler32-standalone.c (attached, also at
https://github.com/google/wuffs/blob/master/script/adler32-standalone.c) is
some straight C code to calculate the standard Adler32 hash, used by the zlib
format.

Measuring throughput on a recent Debian Testing system (clang 5.0 and gcc 7.2),
Intel x86_64 Broadwell, suggests that clang's generated code is 1.3x slower.

$ clang-5.0 -O3 adler32-standalone.c; ./a.out
    2311 MiB/s, clang 5.0.0 (tags/RELEASE_500/rc2)
$ gcc       -O3 adler32-standalone.c; ./a.out
    3052 MiB/s, gcc 7.2.1 20171025

The core loop (manually unrolled 8 times) is:

while (p < end0) {
  s1 += ((uint32_t)(*p));
  s2 += s1; 
  p++;
  s1 += ((uint32_t)(*p));
  s2 += s1; 
  p++;
  s1 += ((uint32_t)(*p));
  s2 += s1; 
  p++;
  s1 += ((uint32_t)(*p));
  s2 += s1; 
  p++;
  s1 += ((uint32_t)(*p));
  s2 += s1; 
  p++;
  s1 += ((uint32_t)(*p));
  s2 += s1; 
  p++;
  s1 += ((uint32_t)(*p));
  s2 += s1; 
  p++;
  s1 += ((uint32_t)(*p));
  s2 += s1; 
  p++;
}

-- 
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/20171208/3306307d/attachment-0001.html>


More information about the llvm-bugs mailing list