From: Chris Metcalf Date: Tue, 16 Sep 2014 00:02:50 +0000 (-0400) Subject: tilegx: optimize string copy_byte() internal function X-Git-Tag: glibc-2.21~524 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c4c1a6f4d0e8ffab24419d136fbfe698a201d24;p=thirdparty%2Fglibc.git tilegx: optimize string copy_byte() internal function We can use one "shufflebytes" instruction instead of 3 "bfins" instructions to optimize the string functions. --- diff --git a/ChangeLog b/ChangeLog index ad73cf473dc..ce5ec8f115e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-10-02 Chris Metcalf + + * sysdeps/tile/tilegx/string-endian.h (copy_byte): Optimize. + 2014-10-06 Arjun Shankar * nptl/tst-setuid3.c: Write errors to stdout. diff --git a/sysdeps/tile/tilegx/string-endian.h b/sysdeps/tile/tilegx/string-endian.h index 0c4d51766d7..47333891e07 100644 --- a/sysdeps/tile/tilegx/string-endian.h +++ b/sysdeps/tile/tilegx/string-endian.h @@ -36,12 +36,11 @@ #define REVCZ(x) __insn_ctz(x) #endif -/* Create eight copies of the byte in a uint64_t. */ +/* Create eight copies of the byte in a uint64_t. Byte Shuffle uses + the bytes of srcB as the index into the dest vector to select a + byte. With all indices of zero, the first byte is copied into all + the other bytes. */ static inline uint64_t copy_byte(uint8_t byte) { - uint64_t word = byte; - word = __insn_bfins(word, word, 8, 15); - word = __insn_bfins(word, word, 16, 31); - word = __insn_bfins(word, word, 32, 63); - return word; + return __insn_shufflebytes(byte, 0, 0); }