[llvm-bugs] [Bug 49866] New: Optimize C++ spaceship comparison
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Apr 6 12:22:55 PDT 2021
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: unassignedbugs at nondot.org
Reporter: marc.glisse at normalesup.org
CC: llvm-bugs at lists.llvm.org
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 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210406/1010f0d1/attachment.html>
More information about the llvm-bugs
mailing list