https://bugs.llvm.org/show_bug.cgi?id=49866
Bug ID: 49866
Summary: Optimize C++ spaceship comparison
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Similar to gcc's https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94589 , it would
be nice to optimize (x<=>y)@0 to x@y for all comparisons @, and clang/llvm
seems to manage for some but not all.
#include <compare>
int n(int x){return (x<=>0)<0;}
Debian clang version 13.0.0-++20210129063721+010b176cdefb-1~exp1
x86_64-pc-linux-gnu
movl %edi, %eax
shrl $24, %eax
testl %edi, %edi
setne %cl
testb %al, %al
sets %al
andb %cl, %al
movzbl %al, %eax
retq
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs