[Bug tree-optimization/94566] conversion between std::strong_ordering and int
oschonrock at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 14 16:53:33 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94566
--- Comment #8 from Oliver Schönrock <oschonrock at gmail dot com> ---
how about:
#include <bit>
#include <compare>
#include <cstdint>
int conv3(std::strong_ordering s){
return std::bit_cast<std::int8_t>(s);
}
std::strong_ordering conv4(int i){
return std::bit_cast<std::strong_ordering>(static_cast<std::int8_t>(i));
}
conv3(std::strong_ordering):
movsbl %dil, %eax
ret
conv4(int):
movl %edi, %eax
ret
https://godbolt.org/z/szP5MGq4T
More information about the Gcc-bugs
mailing list