-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Reland Refactor WIDE_READ to allow finer control over high-performance function selection (#165613) #170738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reland Refactor WIDE_READ to allow finer control over high-performance function selection (#165613) #170738
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| { | ||
| "string": { | ||
| "LIBC_CONF_STRING_UNSAFE_WIDE_READ": { | ||
| "value": false | ||
| "LIBC_CONF_STRING_LENGTH_IMPL": { | ||
| "value": "element" | ||
| } | ||
| "LIBC_CONF_FIND_FIRST_CHARACTER_IMPL": { | ||
| "value": "element" | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| { | ||
| "string": { | ||
| "LIBC_CONF_STRING_UNSAFE_WIDE_READ": { | ||
| "value": true | ||
| "LIBC_CONF_STRING_LENGTH_IMPL": { | ||
| "value": "clang_vector", | ||
| }, | ||
| "LIBC_CONF_FIND_FIRST_CHARACTER_IMPL": { | ||
| "value": "word", | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| { | ||
| "string": { | ||
| "LIBC_CONF_STRING_UNSAFE_WIDE_READ": { | ||
| "value": false | ||
| "LIBC_CONF_STRING_LENGTH_IMPL": { | ||
| "value": "element" | ||
| } | ||
| "LIBC_CONF_FIND_FIRST_CHARACTER_IMPL": { | ||
| "value": "element" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ | |
| #include <arm_neon.h> | ||
| #include <stddef.h> // size_t | ||
| namespace LIBC_NAMESPACE_DECL { | ||
| namespace neon { | ||
| namespace internal::neon { | ||
| [[maybe_unused]] LIBC_NO_SANITIZE_OOB_ACCESS LIBC_INLINE static size_t | ||
| string_length(const char *src) { | ||
| using Vector __attribute__((may_alias)) = uint8x8_t; | ||
|
|
@@ -43,15 +43,15 @@ string_length(const char *src) { | |
| (cpp::countr_zero(cmp) >> 3)); | ||
| } | ||
| } | ||
| } // namespace neon | ||
| } // namespace internal::neon | ||
| } // namespace LIBC_NAMESPACE_DECL | ||
| #endif // __ARM_NEON | ||
|
|
||
| #ifdef LIBC_TARGET_CPU_HAS_SVE | ||
| #include "src/__support/macros/optimization.h" | ||
| #include <arm_sve.h> | ||
| namespace LIBC_NAMESPACE_DECL { | ||
| namespace sve { | ||
| namespace internal::sve { | ||
| [[maybe_unused]] LIBC_INLINE static size_t string_length(const char *src) { | ||
| const uint8_t *ptr = reinterpret_cast<const uint8_t *>(src); | ||
| // Initialize the first-fault register to all true | ||
|
|
@@ -92,15 +92,19 @@ namespace sve { | |
| len += svcntp_b8(all_true, before_zero); | ||
| return len; | ||
| } | ||
| } // namespace sve | ||
| } // namespace internal::sve | ||
| } // namespace LIBC_NAMESPACE_DECL | ||
| #endif // LIBC_TARGET_CPU_HAS_SVE | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
| namespace internal::arch_vector { | ||
| [[maybe_unused]] LIBC_INLINE size_t string_length(const char *src) { | ||
| #ifdef LIBC_TARGET_CPU_HAS_SVE | ||
| namespace string_length_impl = sve; | ||
| return sve::string_length(src); | ||
| #elif defined(__ARM_NEON) | ||
| namespace string_length_impl = neon; | ||
| return neon::string_length(src); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am unable to test this, but hopefully will be fixed with #170892 |
||
| #endif | ||
| } | ||
| } // namespace internal::arch_vector | ||
| } // namespace LIBC_NAMESPACE_DECL | ||
| #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_STRLEN_H | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like the arm and riscv configs don't have commas on line 5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be fixed with #170776