Florian Weimer wrote: > On s390x, all three variants use conditional > branches, but the first one is the shortest.
Indeed. Surprising. > There is also this: > > int sign4 (long n1, long n2) > { > return (char) ((n1 > n2) - (n1 < n2)); > } The case should be towards (signed char). Otherwise, on arm-linux-gnueabi and powerpc-linux-gnu the 3 values are 0, 1, 255, not 0, 1, -1. > It's one instruction shorter on x86-64 than sign3, but it's worse on > other architectures. (One of the x86-64 quirks is that conditional sets > do not affect the full register, only a byte.) Indeed. But IMO, the conditional jumps matter more than an immediate instruction. Bruno