https://bugs.llvm.org/show_bug.cgi?id=50991
Bug ID: 50991
Summary: [X86] Failure to flip cmov cc for -abs(x)
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, pengfei.w...@intel.com,
spatel+l...@rotateright.com
https://godbolt.org/z/frMb5fahz
#include <cmath>
char nabs8(char x) {
return -std::abs(x);
}
short nabs16(short x) {
return -std::abs(x);
}
int nabs32(int x) {
return -std::abs(x);
}
long long nabs64(long long x) {
return -std::abs(x);
}
clang:
nabs64(long long):
movq %rdi, %rax
negq %rax
cmovlq %rdi, %rax
negq %rax
retq
gcc:
nabs64(long long):
movq %rdi, %rax
negq %rax
cmovns %rdi, %rax
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