<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 --- - Inefficient loop unrolling on Silvermont (20% performance penalty vs gcc trunk)"
   href="https://llvm.org/bugs/show_bug.cgi?id=24936">24936</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Inefficient loop unrolling on Silvermont (20% performance penalty vs gcc trunk)
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>egor.kochetov@intel.com
          </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>Created <span class=""><a href="attachment.cgi?id=14933" name="attach_14933" title="c++ reproducer and Makefile">attachment 14933</a> <a href="attachment.cgi?id=14933&action=edit" title="c++ reproducer and Makefile">[details]</a></span>
c++ reproducer and Makefile

While compiling one of the programs I've encountered the source that works
faster by 20% if compiled by gcc than if compiled by clang. The target for
compilation is Linux, Intel Silvermont CPU. Affected optsets are (-m32, -m64) ×
(-Ofast, -O2).

The reason for the problem turned out to be the fact that gcc unwinds
constant-sized loop (be it #define in C or constexpr in C++, it does not
matter), while clang does not.

Attached is the source that adds and multiplies floating-point zeros and
reproduces this performance difference. Makefile for this source is also
attached, fix compiler paths in it and run the sample like that:

    make clean run; make clean run COMPILER=gcc

Make will produce the binary main.g++ or main.clang++ and the corresponding .s
file with disassembly of the slow_function.

Compilers under consideration were gcc 6.0 trunk and clang 3.8 trunk.</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>