[libc-commits] [libc] ad82fe7 - [libc] Add rep; movsb as an accelerator under x86
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Fri Oct 8 07:32:13 PDT 2021
Author: Guillaume Chatelet
Date: 2021-10-08T14:31:55Z
New Revision: ad82fe7b280aa8732dd1336e4fad66d1ef5870c6
URL: https://github.com/llvm/llvm-project/commit/ad82fe7b280aa8732dd1336e4fad66d1ef5870c6
DIFF: https://github.com/llvm/llvm-project/commit/ad82fe7b280aa8732dd1336e4fad66d1ef5870c6.diff
LOG: [libc] Add rep;movsb as an accelerator under x86
Added:
Modified:
libc/src/string/memory_utils/elements_x86.h
Removed:
################################################################################
diff --git a/libc/src/string/memory_utils/elements_x86.h b/libc/src/string/memory_utils/elements_x86.h
index c7e1ff901795..9b32b427f76e 100644
--- a/libc/src/string/memory_utils/elements_x86.h
+++ b/libc/src/string/memory_utils/elements_x86.h
@@ -163,6 +163,12 @@ using _64 = __llvm_libc::Repeated<_8, 8>;
using _128 = __llvm_libc::Repeated<_8, 16>;
#endif
+struct Accelerator {
+ static void Copy(char *dst, const char *src, size_t count) {
+ asm volatile("rep movsb" : "+D"(dst), "+S"(src), "+c"(count) : : "memory");
+ }
+};
+
} // namespace x86
} // namespace __llvm_libc
More information about the libc-commits
mailing list