-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Description
https://godbolt.org/z/av7vTE7as
#include <cstdint>
#include <numeric>
typedef uint32_t u32;
u32 midpoint_u32(u32 a, u32 b) { return std::midpoint(a, b); }Generated code:
_Z12midpoint_u32jj: // @_Z12midpoint_u32jj
cmp w0, w1
csel w8, w0, w1, lo
csel w9, w0, w1, hi
cmp w0, w1
sub w8, w9, w8
lsr w8, w8, #1
cneg w8, w8, hi
add w0, w8, w0
retThe 2nd cmp is unnecessary: the flags register still contains the result of the first cmp instruction