This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/65474] New: sub-optimal code for __builtin_abs
- From: "wmi at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 19 Mar 2015 18:36:25 +0000
- Subject: [Bug middle-end/65474] New: sub-optimal code for __builtin_abs
- Auto-submitted: auto-generated
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