[clang] [Clang][AArch64] Use __clang_arm_builtin_alias for overloaded svreinterpret's (PR #92427)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Fri May 17 10:45:49 PDT 2024
efriedma-quic wrote:
clang specifically diagnoses always_inline functions. So for example, say you want to write something like:
```
#include <arm_sve.h>
__attribute__((always_inline, target("+sve")))
static inline void f(void* p) __arm_streaming_compatible {
*(svuint32_t*)p = svmul_m(svptrue_b32(), *(svuint32_t*)p, *(svuint32_t*)p);
}
//////////
void g(void* p) __arm_streaming { f(p); }
```
Conceptually, this should be fine, but currently it's an error. (You can sort of approximate it with an `#ifdef __ARM_FEATURE_SVE`, but that's pretty ugly.)
But regardless of the diagnostics, if the user specifies "+sve" on a target that doesn't actually have SVE, we could miscompile; for example, if you call a versioned function, clang uses the features specified in the caller.
https://github.com/llvm/llvm-project/pull/92427
More information about the cfe-commits
mailing list