<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 - code compiled with -fwrapv is faster than without"
   href="https://bugs.llvm.org/show_bug.cgi?id=50420">50420</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>code compiled with -fwrapv is faster than without
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jmuizelaar@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following compiles to:

int f(int param) {
    int result = 0;
    for (int i=param; i < param + 16; i++) {
        result += param;
    }
    return result;
}



f(int):                                  # @f(int)
        lea     eax, [rdi + 15]
        cmp     edi, eax
        cmovg   eax, edi
        sub     eax, edi
        add     eax, 1
        imul    eax, edi
        ret

with -fwrapv it becomes:

f(int):                                  # @f(int)
        mov     ecx, edi
        shl     ecx, 4
        xor     eax, eax
        cmp     edi, 2147483632
        cmovl   eax, ecx
        ret

with gcc it becomes:

f(int):
        mov     eax, edi
        sal     eax, 4
        ret

icc and msvc compile to something similar to gcc</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>