1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-04-08 04:30:18 -04:00

Allow building without SSE.

This commit is contained in:
Hoernchen 2015-07-05 17:08:06 +02:00 committed by John Greb
parent 2b0396809e
commit 4968bf1ccd
3 changed files with 21 additions and 11 deletions

View File

@ -25,6 +25,10 @@ find_package(PkgConfig)
find_package(FFTW3F)
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|x86")
SET(USE_SIMD "SSE2" CACHE STRING "Use SIMD instructions")
ENDIF()
##############################################################################
#include(${QT_USE_FILE})
@ -259,15 +263,18 @@ include_directories(
${OPENGL_INCLUDE_DIR}
)
if(MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
else()
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2" )
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse2" )
add_definitions(-msse2 -Wall)
if(USE_SIMD MATCHES SSE2)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse2" )
add_definitions(-DUSE_SIMD)
elseif(MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
add_definitions(-DUSE_SIMD)
endif()
endif()
##############################################################################

View File

@ -1,7 +1,9 @@
#ifndef INCLUDE_INTERPOLATOR_H
#define INCLUDE_INTERPOLATOR_H
#ifdef USE_SIMD
#include <immintrin.h>
#endif
#include "dsp/dsptypes.h"
#include "util/export.h"
#include <stdio.h>

View File

@ -15,7 +15,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifdef USE_SIMD
#include <immintrin.h>
#endif
#include <QMouseEvent>
#include "gui/glspectrum.h"
@ -313,8 +315,7 @@ void GLSpectrum::updateHistogram(const std::vector<Real>& spectrum)
m_histogramHoldoffCount = m_histogramHoldoffBase;
}
//#define NO_AVX
#ifdef NO_AVX
#ifndef USE_SIMD
for(int i = 0; i < m_fftSize; i++) {
int v = (int)((spectrum[i] - m_referenceLevel) * 100.0 / m_powerRange + 100.0);