Files
llvm/clang/test/CodeGen/AArch64/fmv-duplicate-mangled-name.c
Alexandros Lamprineas 1b82c16fa8 [FMV][AArch64] Allow user to override version priority. (#150267)
Implements https://github.com/ARM-software/acle/pull/404

This allows the user to specify "featA+featB;priority=[1-255]" where
priority=255 means highest priority. If the explicit priority string is
omitted then the priority of "featA+featB" is implied, which is lower
than priority=1.

Internally this gets expanded using special FMV features P0 ... P7 which
can encode up to 256-1 priority levels (excluding all zeros). Those do
not have corresponding detection bit at pos FEAT_#enum so I made this
field optional in FMVInfo. Also they don't affect the codegen or name
mangling of versioned functions.
2025-12-09 13:31:10 +00:00

41 lines
2.2 KiB
C

// RUN: %clang_cc1 -triple aarch64-linux-gnu -verify -emit-llvm-only %s -DCHECK_IMPLICIT_DEFAULT
// RUN: %clang_cc1 -triple aarch64-linux-gnu -verify -emit-llvm-only %s -DCHECK_EXPLICIT_DEFAULT
// RUN: %clang_cc1 -triple aarch64-linux-gnu -verify -emit-llvm-only %s -DCHECK_EXPLICIT_VERSION_PRIORITY
// RUN: %clang_cc1 -triple aarch64-linux-gnu -verify -emit-llvm-only %s -DCHECK_EXPLICIT_CLONES_PRIORITY
#if defined(CHECK_IMPLICIT_DEFAULT)
int implicit_default_ok(void) { return 0; }
__attribute__((target_clones("aes", "lse"))) int implicit_default_ok(void) { return 1; }
int implicit_default_bad(void) { return 0; }
// expected-error@+2 {{definition with same mangled name 'implicit_default_bad.default' as another definition}}
// expected-note@-2 {{previous definition is here}}
__attribute__((target_clones("aes", "lse", "default"))) int implicit_default_bad(void) { return 1; }
#elif defined(CHECK_EXPLICIT_DEFAULT)
__attribute__((target_version("default"))) int explicit_default_ok(void) { return 0; }
__attribute__((target_clones("aes", "lse"))) int explicit_default_ok(void) { return 1; }
__attribute__((target_version("default"))) int explicit_default_bad(void) { return 0; }
// expected-error@+2 {{definition with same mangled name 'explicit_default_bad.default' as another definition}}
// expected-note@-2 {{previous definition is here}}
__attribute__((target_clones("aes", "lse", "default"))) int explicit_default_bad(void) { return 1; }
#elif defined(CHECK_EXPLICIT_VERSION_PRIORITY)
__attribute__((target_version("aes"))) int explicit_version_priority(void) { return 0; }
// expected-error@+2 {{definition with same mangled name 'explicit_version_priority._Maes' as another definition}}
// expected-note@-2 {{previous definition is here}}
__attribute__((target_version("aes;priority=10"))) int explicit_version_priority(void) { return 1; }
#elif defined(CHECK_EXPLICIT_CLONES_PRIORITY)
__attribute__((target_version("aes;priority=20"))) int explicit_clones_priority(void) { return 0; }
// expected-error@+2 {{definition with same mangled name 'explicit_clones_priority._Maes' as another definition}}
// expected-note@-2 {{previous definition is here}}
__attribute__((target_clones("aes;priority=5", "lse"))) int explicit_clones_priority(void) { return 1; }
#endif