[llvm-bugs] [Bug 40825] New: [x86-64] Suboptimal codegen on uint128 negation
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Feb 22 11:26:06 PST 2019
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: unassignedbugs at nondot.org
Reporter: arthur.j.odwyer at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190222/5926dee4/attachment.html>
More information about the llvm-bugs
mailing list