Skip to content

Commit 67c0e00

Browse files
committed
sve: Try to add ARM SVE compile support
This might be simple, this might be tough. Let's go step-by-step. Signed-off-by: Johannes Demel <[email protected]>
1 parent 6cfa5b2 commit 67c0e00

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

gen/archs.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ at the top, as a last resort.
105105
<check name="neon"></check>
106106
</arch>
107107

108+
<arch name="sve">
109+
<flag compiler="gnu">-march=armv8-a+sve</flag>
110+
<flag compiler="clang">-march=armv8-a+sve</flag>
111+
<alignment>16</alignment>
112+
<check name="sve"></check>
113+
</arch>
114+
115+
<arch name="sve2">
116+
<flag compiler="gnu">-march=armv8-a+sve2</flag>
117+
<flag compiler="clang">-march=armv8-a+sve2</flag>
118+
<alignment>16</alignment>
119+
<check name="sve2"></check>
120+
</arch>
121+
108122
<arch name="sse3">
109123
<check name="sse3"></check>
110124
<flag compiler="gnu">-msse3</flag>

gen/machines.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
<archs>generic neon neonv8 orc|</archs>
1717
</machine>
1818

19+
<machine name="sve">
20+
<archs>generic neon neonv8 sve orc|</archs>
21+
</machine>
22+
23+
<machine name="sve2">
24+
<archs>generic neon neonv8 sve sve2 orc|</archs>
25+
</machine>
26+
1927
<!-- trailing | bar means generate without either for MSVC -->
2028
<machine name="sse2">
2129
<archs>generic 32|64| mmx| sse sse2 orc|</archs>

lib/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ if(NOT CPU_IS_x86)
203203
overrule_arch(sse4_1 "Architecture is not x86 or x86_64")
204204
overrule_arch(sse4_2 "Architecture is not x86 or x86_64")
205205
overrule_arch(avx "Architecture is not x86 or x86_64")
206+
overrule_arch(avx2 "Architecture is not x86 or x86_64")
207+
overrule_arch(fma "Architecture is not x86 or x86_64")
206208
overrule_arch(avx512f "Architecture is not x86 or x86_64")
207209
overrule_arch(avx512cd "Architecture is not x86 or x86_64")
208210
endif(NOT CPU_IS_x86)
@@ -239,6 +241,8 @@ else(neon_compile_result)
239241
overrule_arch(neon "Compiler doesn't support NEON")
240242
overrule_arch(neonv7 "Compiler doesn't support NEON")
241243
overrule_arch(neonv8 "Compiler doesn't support NEON")
244+
overrule_arch(sve "Compiler doesn't support SVE")
245+
overrule_arch(sve2 "Compiler doesn't support SVE2")
242246
endif(neon_compile_result)
243247

244248
########################################################################

tmpl/volk_cpu.tmpl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ static int i_can_has_${arch.name} (void) {
4444
%if "neon" in arch.name:
4545
#if defined(CPU_FEATURES_ARCH_ARM)
4646
if (GetArmInfo().features.${check} == 0){ return 0; }
47+
#endif
48+
%elif "neon" in arch.name or "sve" in arch.name:
49+
#if defined(CPU_FEATURES_ARCH_AARCH64)
50+
if (GetAarch64Info().features.${check} == 0){ return 0; }
4751
#endif
4852
%elif "mips" in arch.name:
4953
#if defined(CPU_FEATURES_ARCH_MIPS)

0 commit comments

Comments
 (0)