Skip to content

Commit ad09309

Browse files
[libc] add cpu feature flags for SVE/SVE2/MOPS
1 parent 97fe5f7 commit ad09309

File tree

5 files changed

+34
-1
lines changed

5 files changed

+34
-1
lines changed

libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if(LIBC_TARGET_ARCHITECTURE_IS_X86_64)
99
set(ALL_CPU_FEATURES SSE2 SSE4_2 AVX AVX2 AVX512F AVX512BW FMA)
1010
set(LIBC_COMPILE_OPTIONS_NATIVE -march=native)
1111
elseif(LIBC_TARGET_ARCHITECTURE_IS_AARCH64)
12-
set(ALL_CPU_FEATURES "FullFP16")
12+
set(ALL_CPU_FEATURES FullFP16 MOPS SVE SVE2)
1313
set(LIBC_COMPILE_OPTIONS_NATIVE -mcpu=native)
1414
endif()
1515

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "src/__support/macros/properties/cpu_features.h"
2+
3+
#ifndef LIBC_TARGET_CPU_HAS_MOPS
4+
#error unsupported
5+
#endif
6+
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "src/__support/macros/properties/cpu_features.h"
2+
3+
#ifndef LIBC_TARGET_CPU_HAS_SVE
4+
#error unsupported
5+
#endif
6+
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "src/__support/macros/properties/cpu_features.h"
2+
3+
#ifndef LIBC_TARGET_CPU_HAS_SVE2
4+
#error unsupported
5+
#endif
6+
7+

libc/src/__support/macros/properties/cpu_features.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@
1818
#define LIBC_TARGET_CPU_HAS_FULLFP16
1919
#endif
2020

21+
#if defined(__ARM_FEATURE_SVE)
22+
#define LIBC_TARGET_CPU_HAS_SVE
23+
#endif
24+
25+
#if defined(__ARM_FEATURE_SVE2)
26+
#define LIBC_TARGET_CPU_HAS_SVE2
27+
#endif
28+
29+
#if defined(__ARM_FEATURE_MOPS)
30+
#define LIBC_TARGET_CPU_HAS_MOPS
31+
#endif
32+
2133
#if defined(__SSE2__)
2234
#define LIBC_TARGET_CPU_HAS_SSE2
2335
#define LIBC_TARGET_CPU_HAS_FPU_FLOAT

0 commit comments

Comments
 (0)