public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/50440] New: 128 bit unsigned int subtraction generates too many register moves
@ 2011-09-16 21:16 schnetter at gmail dot com
2011-09-25 10:45 ` [Bug target/50440] " rguenth at gcc dot gnu.org
2024-02-15 9:27 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: schnetter at gmail dot com @ 2011-09-16 21:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50440
Bug #: 50440
Summary: 128 bit unsigned int subtraction generates too many
register moves
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: schnetter@gmail.com
I want to perform 128 bit integer arithmetic, and I am declaring my type like
this:
{{{
typedef unsigned int uint128_t __attribute__((mode(TI)));
uint128_t add (uint128_t x, uint128_t y) { return x+y; }
uint128_t sub (uint128_t x, uint128_t y) { return x-y; }
}}}
This is on an Intel Xeon processor in x86_64 mode. I build with the command
gcc-4.6.1 -O3 -march=native -S sub128.c
and I find that, while the "add" routine looks optimal, the "sub" routine has
several unnecessary register moves:
{{{
add:
movq %rdx, %rax
movq %rcx, %rdx
addq %rdi, %rax
adcq %rsi, %rdx
ret
sub:
movq %rsi, %r10
movq %rdi, %rsi
subq %rdx, %rsi
movq %r10, %rdi
sbbq %rcx, %rdi
movq %rsi, %rax
movq %rdi, %rdx
ret
}}}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/50440] 128 bit unsigned int subtraction generates too many register moves
2011-09-16 21:16 [Bug rtl-optimization/50440] New: 128 bit unsigned int subtraction generates too many register moves schnetter at gmail dot com
@ 2011-09-25 10:45 ` rguenth at gcc dot gnu.org
2024-02-15 9:27 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-25 10:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50440
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |x86_64-*-*
Status|UNCONFIRMED |NEW
Keywords| |missed-optimization
Last reconfirmed| |2011-09-25
Component|rtl-optimization |target
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-25 10:20:19 UTC ---
Seems to be an artifact of the *subti3_doubleword splitter.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/50440] 128 bit unsigned int subtraction generates too many register moves
2011-09-16 21:16 [Bug rtl-optimization/50440] New: 128 bit unsigned int subtraction generates too many register moves schnetter at gmail dot com
2011-09-25 10:45 ` [Bug target/50440] " rguenth at gcc dot gnu.org
@ 2024-02-15 9:27 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-15 9:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50440
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sayle at gcc dot gnu.org
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The trunk we get:
```
sub:
xchgq %rdi, %rsi
movq %rdx, %r8
movq %rsi, %rax
movq %rdi, %rdx
subq %r8, %rax
sbbq %rcx, %rdx
ret
```
There still seems to be too many movq going on compared to LLVM even.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-15 9:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-16 21:16 [Bug rtl-optimization/50440] New: 128 bit unsigned int subtraction generates too many register moves schnetter at gmail dot com
2011-09-25 10:45 ` [Bug target/50440] " rguenth at gcc dot gnu.org
2024-02-15 9:27 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).