diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2014-09-15 20:02:50 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2014-10-06 11:18:41 -0400 |
commit | 1c4c1a6f4d0e8ffab24419d136fbfe698a201d24 (patch) | |
tree | 5c5be108661211cd2e6fd4f41f399bf2d03f2429 /sysdeps/tile/tilegx/string-endian.h | |
parent | 99d86ea324820ec7b7755377182922a6233e25fb (diff) | |
download | glibc-1c4c1a6f4d0e8ffab24419d136fbfe698a201d24.tar.gz glibc-1c4c1a6f4d0e8ffab24419d136fbfe698a201d24.tar.xz glibc-1c4c1a6f4d0e8ffab24419d136fbfe698a201d24.zip |
tilegx: optimize string copy_byte() internal function
We can use one "shufflebytes" instruction instead of 3 "bfins" instructions to optimize the string functions.
Diffstat (limited to 'sysdeps/tile/tilegx/string-endian.h')
-rw-r--r-- | sysdeps/tile/tilegx/string-endian.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sysdeps/tile/tilegx/string-endian.h b/sysdeps/tile/tilegx/string-endian.h index 0c4d51766d..47333891e0 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); } |