Skip to content

Commit

Permalink
sve: Try to add ARM SVE compile support
Browse files Browse the repository at this point in the history
This might be simple, this might be tough. Let's go step-by-step.

Signed-off-by: Johannes Demel <[email protected]>
  • Loading branch information
jdemel committed Jan 22, 2025
1 parent 444951e commit 63ca709
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gen/archs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@ at the top, as a last resort.
<check name="neon"></check>
</arch>

<arch name="sve">
<flag compiler="gnu">-march=armv8-a+sve</flag>
<flag compiler="clang">-march=armv8-a+sve</flag>
<alignment>16</alignment>
<check name="sve"></check>
</arch>

<arch name="sve2">
<flag compiler="gnu">-march=armv8-a+sve2</flag>
<flag compiler="clang">-march=armv8-a+sve2</flag>
<alignment>16</alignment>
<check name="sve2"></check>
</arch>

<arch name="sse3">
<check name="sse3"></check>
<flag compiler="gnu">-msse3</flag>
Expand Down
8 changes: 8 additions & 0 deletions gen/machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
<archs>generic neon neonv8 orc|</archs>
</machine>

<machine name="sve">
<archs>generic neon neonv8 sve orc|</archs>
</machine>

<machine name="sve2">
<archs>generic neon neonv8 sve sve2 orc|</archs>
</machine>

<!-- trailing | bar means generate without either for MSVC -->
<machine name="sse2">
<archs>generic 32|64| mmx| sse sse2 orc|</archs>
Expand Down
4 changes: 4 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ if(NOT CPU_IS_x86)
overrule_arch(sse4_1 "Architecture is not x86 or x86_64")
overrule_arch(sse4_2 "Architecture is not x86 or x86_64")
overrule_arch(avx "Architecture is not x86 or x86_64")
overrule_arch(avx2 "Architecture is not x86 or x86_64")
overrule_arch(fma "Architecture is not x86 or x86_64")
overrule_arch(avx512f "Architecture is not x86 or x86_64")
overrule_arch(avx512cd "Architecture is not x86 or x86_64")
endif(NOT CPU_IS_x86)
Expand Down Expand Up @@ -255,6 +257,8 @@ else(neon_compile_result)
overrule_arch(neon "Compiler doesn't support NEON")
overrule_arch(neonv7 "Compiler doesn't support NEON")
overrule_arch(neonv8 "Compiler doesn't support NEON")
overrule_arch(sve "Compiler doesn't support SVE")
overrule_arch(sve2 "Compiler doesn't support SVE2")
endif(neon_compile_result)

########################################################################
Expand Down
4 changes: 4 additions & 0 deletions tmpl/volk_cpu.tmpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ static int i_can_has_${arch.name} (void) {
%if "neon" in arch.name:
#if defined(CPU_FEATURES_ARCH_ARM)
if (GetArmInfo().features.${check} == 0){ return 0; }
#endif
%elif "neon" in arch.name or "sve" in arch.name:
#if defined(CPU_FEATURES_ARCH_AARCH64)
if (GetAarch64Info().features.${check} == 0){ return 0; }
#endif
%elif "mips" in arch.name:
#if defined(CPU_FEATURES_ARCH_MIPS)
Expand Down

0 comments on commit 63ca709

Please sign in to comment.