Skip to content

Commit 63ca709

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 444951e commit 63ca709

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

gen/archs.xml

+14
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

+8
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

+4
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ if(NOT CPU_IS_x86)
219219
overrule_arch(sse4_1 "Architecture is not x86 or x86_64")
220220
overrule_arch(sse4_2 "Architecture is not x86 or x86_64")
221221
overrule_arch(avx "Architecture is not x86 or x86_64")
222+
overrule_arch(avx2 "Architecture is not x86 or x86_64")
223+
overrule_arch(fma "Architecture is not x86 or x86_64")
222224
overrule_arch(avx512f "Architecture is not x86 or x86_64")
223225
overrule_arch(avx512cd "Architecture is not x86 or x86_64")
224226
endif(NOT CPU_IS_x86)
@@ -255,6 +257,8 @@ else(neon_compile_result)
255257
overrule_arch(neon "Compiler doesn't support NEON")
256258
overrule_arch(neonv7 "Compiler doesn't support NEON")
257259
overrule_arch(neonv8 "Compiler doesn't support NEON")
260+
overrule_arch(sve "Compiler doesn't support SVE")
261+
overrule_arch(sve2 "Compiler doesn't support SVE2")
258262
endif(neon_compile_result)
259263

260264
########################################################################

tmpl/volk_cpu.tmpl.c

+4
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)