aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-10-10 13:36:33 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-10-14 10:38:46 +0100
commitd8ef4471cb9c9f86784b62424a215ea42173bfe1 (patch)
treeea5749b2f6a0e8bf0a429fd782c0ebc12cdeb55d /gcc
parent308d19c11e119b2c5abf67778dd0ac8a370e5df7 (diff)
downloadgcc-d8ef4471cb9c9f86784b62424a215ea42173bfe1.zip
gcc-d8ef4471cb9c9f86784b62424a215ea42173bfe1.tar.gz
gcc-d8ef4471cb9c9f86784b62424a215ea42173bfe1.tar.bz2
libstdc++: Enable memset optimizations for distinct character types [PR93059]
Currently we only optimize std::fill to memset when the source and destination types are the same byte-sized type. This means that we fail to optimize cases like std::fill(buf. buf+n, 0) because the literal 0 is not the same type as the character buffer. Such cases can safely be optimized to use memset, because assigning an int (or other integer) to a narrow character type has the same effects as converting the integer to unsigned char then copying it with memset. This patch enables the optimized code path when the fill character is a memcpy-able integer (using the new __memcpyable_integer trait). We still need to check is_same<U, T> to enable the memset optimization for filling a range of std::byte with a std::byte value, because that isn't a memcpyable integer. libstdc++-v3/ChangeLog: PR libstdc++/93059 * include/bits/stl_algobase.h (__fill_a1(T*, T*, const T&)): Change template parameters and enable_if condition to allow the fill value to be an integer.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions