<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 - Suboptimal code for llvm.ssub.sat.i32"
   href="https://bugs.llvm.org/show_bug.cgi?id=43649">43649</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Suboptimal code for llvm.ssub.sat.i32
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>tspiteri@ieee.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following IR:

    define i32 @_ZN7example14saturating_sub17h23583ee3c8b034a4E(i32 %a, i32 %b)
unnamed_addr #0 !dbg !5 {
    start:
      %0 = tail call i32 @llvm.ssub.sat.i32(i32 %a, i32 %b) #2, !dbg !8
      ret i32 %0, !dbg !15
    }

    declare i32 @llvm.ssub.sat.i32(i32, i32) #1

    attributes #0 = { nounwind nonlazybind readnone uwtable
"probe-stack"="__rust_probestack" "target-cpu"="x86-64" }
    attributes #1 = { nounwind readnone speculatable }
    attributes #2 = { nounwind }

results in the following asm:

    example::saturating_sub:
        xor     eax, eax
        mov     ecx, edi
        sub     ecx, esi
        setns   al
        add     eax, 2147483647
        sub     edi, esi
        cmovno  eax, edi
        ret

I think the `mov ecx, edi` and `sub ecx, esi` instructions should be replaced
by a `cmp esi, edi` instruction.</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>