Skip to content

Commit

Permalink
Add platform-specific flags for NEON.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Jul 21, 2018
1 parent 4ce56d5 commit 22dd9a0
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
sources = [
'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD.cpp',
'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD_internal.cpp',
'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD_neon.cpp',
'pyfastnoisesimd/wrapper.cpp'
]
inc_dirs = [get_include(), 'pyfastnoisesimd', 'pyfastnoisesimd/fastnoisesimd/']
Expand Down Expand Up @@ -73,6 +72,14 @@
'/arch:AVX2',
]
}
neon = {
'sources': [
'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD_neon.cpp',
],
'cflags': [
'/Oi',
],
}

if platform.machine() == 'AMD64': # 64-bit windows
#`/arch:SSE2` doesn't exist on Windows x64 builds, and generates a needless warnings
Expand Down Expand Up @@ -146,13 +153,23 @@
'-msse2',
],
}
neon = {
'sources': [
'pyfastnoisesimd/fastnoisesimd/FastNoiseSIMD_neon.cpp',
],
'cflags': [
'-std=c++11',
'-mfpu=neon',
],
}
fma_flags = ['-mfma']

clibs = [
('avx512', avx512),
('avx2', avx2),
('sse41', sse41),
('sse2', sse2),
('neon', neon),
]


Expand All @@ -162,6 +179,7 @@ class build(_build):
('with-avx2=', None, 'Use AVX2 instructions: auto|yes|no'),
('with-sse41=', None, 'Use SSE4.1 instructions: auto|yes|no'),
('with-sse2=', None, 'Use SSE2 instructions: auto|yes|no'),
('with-neon=', None, 'Use NEON instructions: auto|yes|no'),
('with-fma=', None, 'Use FMA instructions: auto|yes|no'),
]

Expand All @@ -171,6 +189,7 @@ def initialize_options(self):
self.with_avx2 = 'auto'
self.with_sse41 = 'auto'
self.with_sse2 = 'auto'
self.with_neon = 'auto'
self.with_fma = 'auto'

def finalize_options(self):
Expand Down

0 comments on commit 22dd9a0

Please sign in to comment.