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

            Bug ID: 40825
           Summary: [x86-64] Suboptimal codegen on uint128 negation
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: arthur.j.odw...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org

Moved discussion from 40486. Sanjay Patel says:

Arthur O'Dwyer said:
> If you're still looking for work ;) I see improvement, but not perfection,
> in Uint128::negate(). Here's an example.
> https://godbolt.org/z/BGRoQ4
>   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


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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to