https://bugs.llvm.org/show_bug.cgi?id=43650
Bug ID: 43650
Summary: [X86] Poor +/-1 integer sign extraction
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: llvm-...@redking.me.uk
CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
llvm-...@redking.me.uk, spatel+l...@rotateright.com
https://godbolt.org/z/1ZT4eo
int sign_negone_one(int x)
{
return x < 0 ? -1 : 1;
}
clang:
sign_negone_one:
notl %edi
shrl $31, %edi
leal (%rdi,%rdi), %eax
addl $-1, %eax
retq
vs gcc:
sign_negone_one:
movl %edi, %eax
sarl $31, %eax
orl $1, %eax
ret
--
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