<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 - [x86-64] Suboptimal codegen on uint128 negation"
   href="https://bugs.llvm.org/show_bug.cgi?id=40825">40825</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[x86-64] Suboptimal codegen on uint128 negation
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>arthur.j.odwyer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Moved discussion from 40486. Sanjay Patel says:

Arthur O'Dwyer said:
<span class="quote">> If you're still looking for work ;) I see improvement, but not perfection,
> in Uint128::negate(). Here's an example.
> <a href="https://godbolt.org/z/BGRoQ4">https://godbolt.org/z/BGRoQ4</a>
>   xorl %eax, %eax
>   xorl %ecx, %ecx
>   subq (%rdi), %rcx
>   sbbq 8(%rdi), %rax
>   movq %rcx, (%rdi)
>   movq %rax, 8(%rdi)
>   retq
> I'm not sure if GCC's codegen is perfect, or if there's a way to use "sbbq"
> to save an instruction here somehow.
>   negq (%rdi)
>   adcq $0, 8(%rdi)
>   negq 8(%rdi)
>   ret</span >


Hmmm...those 2 tests are independent of what we've done so far:
1. In the uint128 case, we're not forming the overflow intrinsic in IR (CGP)
because that's not a legal type (native type for x86).
2. In the uint64 case, we are forming the overflow intrinsic now (so it's
better than before), but the x86 lowering needs to be improved.

Since they end up with identical asm, I'm hoping that is a single x86-specific
backend fix in lowering X86ISD::SUB to 'neg'.

Do you mind filing a new bug report with those examples? It's hard to keep all
of these problems organized with the overlap.</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>