public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/65474] New: sub-optimal code for __builtin_abs
@ 2015-03-19 19:21 wmi at google dot com
2015-03-19 22:53 ` [Bug target/65474] " wmi at google dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: wmi at google dot com @ 2015-03-19 19:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65474
Bug ID: 65474
Summary: sub-optimal code for __builtin_abs
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: wmi at google dot com
int foo(int x) {
return __builtin_abs(x);
}
~/workarea/gcc-r221398/build/install/bin/gcc -O2 -S 1.c -o 1.gcc.s
.cfi_startproc
movl %edi, %edx
movl %edi, %eax
sarl $31, %edx
xorl %edx, %eax
subl %edx, %eax
ret
.cfi_endproc
~/workarea/llvm-r224097/build/bin/clang -O2 -S 1.c -o 1.llvm.s
.cfi_startproc
movl %edi, %eax
negl %eax
cmovll %edi, %eax
retq
.cfi_endproc
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/65474] sub-optimal code for __builtin_abs
2015-03-19 19:21 [Bug middle-end/65474] New: sub-optimal code for __builtin_abs wmi at google dot com
@ 2015-03-19 22:53 ` wmi at google dot com
2015-03-19 22:54 ` wmi at google dot com
2015-03-20 10:59 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: wmi at google dot com @ 2015-03-19 22:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65474
--- Comment #2 from wmi at google dot com ---
Created attachment 35069
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35069&action=edit
microbench
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/65474] sub-optimal code for __builtin_abs
2015-03-19 19:21 [Bug middle-end/65474] New: sub-optimal code for __builtin_abs wmi at google dot com
2015-03-19 22:53 ` [Bug target/65474] " wmi at google dot com
@ 2015-03-19 22:54 ` wmi at google dot com
2015-03-20 10:59 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: wmi at google dot com @ 2015-03-19 22:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65474
--- Comment #3 from wmi at google dot com ---
Thanks. You are right. I wrote a microbenchmark (attached), and tested it on
different intel microarchitectures.
westmere:
1.gcc.out: 19.42
1.llvm.out: 19.32
sandybridge:
1.gcc.out: 18.61
1.llvm.out: 19.16
ivybridge:
1.gcc.out: 15.79
1.llvm.out: 15.87
On sandybridge, llvm's version was slower. On other microarchitectures, they
were close to each other. So gcc's choose makes sense.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/65474] sub-optimal code for __builtin_abs
2015-03-19 19:21 [Bug middle-end/65474] New: sub-optimal code for __builtin_abs wmi at google dot com
2015-03-19 22:53 ` [Bug target/65474] " wmi at google dot com
2015-03-19 22:54 ` wmi at google dot com
@ 2015-03-20 10:59 ` rguenth at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-20 10:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65474
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |WONTFIX
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Thus wontfix.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-20 10:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19 19:21 [Bug middle-end/65474] New: sub-optimal code for __builtin_abs wmi at google dot com
2015-03-19 22:53 ` [Bug target/65474] " wmi at google dot com
2015-03-19 22:54 ` wmi at google dot com
2015-03-20 10:59 ` rguenth 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).