Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NEON bugs #88

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/FastNoise/FastNoise_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace FastNoise
{
const FastSIMD::Level_BitFlags SUPPORTED_SIMD_LEVELS =
FastSIMD::Level_Scalar |
FastSIMD::Level_NEON |
FastSIMD::Level_SSE2 |
FastSIMD::Level_SSE41 |
FastSIMD::Level_AVX2 |
Expand Down
4 changes: 2 additions & 2 deletions include/FastNoise/Generators/Utils.inl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace FastNoise
static constexpr float ROOT2 = 1.4142135623730950488f;
static constexpr float ROOT3 = 1.7320508075688772935f;

template<typename SIMD = FS, std::enable_if_t<SIMD::SIMD_Level < FastSIMD::Level_AVX2>* = nullptr>
template<typename SIMD = FS, std::enable_if_t<SIMD::SIMD_Level < FastSIMD::Level_AVX2 || SIMD::SIMD_Level == FastSIMD::Level_NEON>* = nullptr>
FS_INLINE static float32v GetGradientDotFancy( int32v hash, float32v fX, float32v fY )
{
int32v index = FS_Convertf32_i32( FS_Converti32_f32( hash & int32v( 0x3FFFFF ) ) * float32v( 1.3333333333333333f ) );
Expand Down Expand Up @@ -96,7 +96,7 @@ namespace FastNoise
}


template<typename SIMD = FS, std::enable_if_t<SIMD::SIMD_Level < FastSIMD::Level_AVX2>* = nullptr>
template<typename SIMD = FS, std::enable_if_t<SIMD::SIMD_Level < FastSIMD::Level_AVX2 || SIMD::SIMD_Level == FastSIMD::Level_NEON>* = nullptr>
FS_INLINE static float32v GetGradientDot( int32v hash, float32v fX, float32v fY )
{
// ( 1+R2, 1 ) ( -1-R2, 1 ) ( 1+R2, -1 ) ( -1-R2, -1 )
Expand Down
33 changes: 21 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,27 @@ list(APPEND FastSIMD_headers ${FastSIMD_inline})
list(APPEND FastSIMD_headers ${FastSIMD_include_inl})
list(APPEND FastSIMD_internal_headers ${FastSIMD_internal_inl})

set(FastSIMD_sources
FastSIMD/FastSIMD.cpp
FastSIMD/FastSIMD_Level_AVX2.cpp
FastSIMD/FastSIMD_Level_AVX512.cpp
FastSIMD/FastSIMD_Level_NEON.cpp
FastSIMD/FastSIMD_Level_Scalar.cpp
FastSIMD/FastSIMD_Level_SSE2.cpp
FastSIMD/FastSIMD_Level_SSE3.cpp
FastSIMD/FastSIMD_Level_SSE41.cpp
FastSIMD/FastSIMD_Level_SSE42.cpp
FastSIMD/FastSIMD_Level_SSSE3.cpp
)
message("FastSIMD Arch: ${CMAKE_SYSTEM_PROCESSOR}")

if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "(arm)|(aarch)")
set(FastSIMD_sources
FastSIMD/FastSIMD.cpp
FastSIMD/FastSIMD_Level_Scalar.cpp
FastSIMD/FastSIMD_Level_NEON.cpp
)
else()
set(FastSIMD_sources
FastSIMD/FastSIMD.cpp
FastSIMD/FastSIMD_Level_AVX2.cpp
FastSIMD/FastSIMD_Level_AVX512.cpp
FastSIMD/FastSIMD_Level_Scalar.cpp
FastSIMD/FastSIMD_Level_SSE2.cpp
FastSIMD/FastSIMD_Level_SSE3.cpp
FastSIMD/FastSIMD_Level_SSE41.cpp
FastSIMD/FastSIMD_Level_SSE42.cpp
FastSIMD/FastSIMD_Level_SSSE3.cpp
)
endif()

file(GLOB FastNoise_headers "../include/FastNoise/*.h")
file(GLOB FastNoise_inl "../include/FastNoise/*.inl")
Expand Down
2 changes: 2 additions & 0 deletions src/FastSIMD/FastSIMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
#include <algorithm>
#include <cstdint>

#if FASTSIMD_x86
#ifdef __GNUG__
#include <x86intrin.h>
#else
#include <intrin.h>
#endif
#endif

#include "FastSIMD/SIMDTypeList.h"

Expand Down
Loading