On 23/10/2026 10:53, David Geier wrote:
Attached is v11, rebased on latest master.
Committed
v11-0001-Use-branchless-comparisons-in-btint4cmp-and-btin.patch, since
that one seems uncontroversial. Thanks!
FWICS, this would only matter if btint4cmp() would get inlined
somewhere, where the compiler could actually make use of understanding
that parts of the if-cascade are not needed. Andres' example was
return DO_COMPARE(a, b) < 0 ?
(DO_COMPARE(b, c) < 0 ? b : (DO_COMPARE(a, c) < 0 ? c : a))
: (DO_COMPARE(b, c) > 0 ? b : (DO_COMPARE(a, c) < 0 ? a : c));
In the case of btint4cmp(), it's only ever invoked from the function
manager, where it cannot be inlined.
Or are there ways to invoke btint4cmp() that can be inlined, which I'm
unaware of?
JIT compilation, maybe? Unless someone shows that there's a measurable
problem though, I wouldn't worry about it.
- Heikki