This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 06/04/2015 12:35 PM, OndÅej BÃlka wrote:
char *strchr_c(char *x, unsigned long u); #define strchr(x,c) \ (__builtin_constant_p(c) ? strchr_c (x, c * (~0ULL / 255)) : strchr (x,c))
Certainly not a universal win, especially for 64-bit RISC. This constant can be just as expensive to construct as the original multiplication.
Consider PPC64, where 4 insns are required to form this kind of replicated 64-bit constant, and 3 insns are required to replicate C.
Then there's other RISC for which replicating C is easily done in parallel with the initial alignment checks.
r~
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |