Skip to content

Commit

Permalink
Switch off all optimisations for non v3 build
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer10 committed Sep 25, 2024
1 parent b679a70 commit 2ede136
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Ratatouille/Ratatouille.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,28 @@ namespace ratatouille {

class DenormalProtection {
private:
#ifdef __SSE__
#ifdef USE_SSE
uint32_t mxcsr_mask;
uint32_t mxcsr;
uint32_t old_mxcsr;
#endif

public:
inline void set_() {
#ifdef __SSE__
#ifdef USE_SSE
old_mxcsr = _mm_getcsr();
mxcsr = old_mxcsr;
_mm_setcsr((mxcsr | _MM_DENORMALS_ZERO_MASK | _MM_FLUSH_ZERO_MASK) & mxcsr_mask);
#endif
};
inline void reset_() {
#ifdef __SSE__
#ifdef USE_SSE
_mm_setcsr(old_mxcsr);
#endif
};

inline DenormalProtection() {
#ifdef __SSE__
#ifdef USE_SSE
mxcsr_mask = 0xffbf; // Default MXCSR mask
mxcsr = 0;
uint8_t fxsave[512] __attribute__ ((aligned (16))); // Structure for storing FPU state with FXSAVE command
Expand Down
14 changes: 7 additions & 7 deletions Ratatouille/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ endif
# check for sse optimisation level only on x86_64 architecture
ifeq ($(TARGET_ARCH), x86_64)
ifneq ($$(filter $(CPU_INFO) | grep sse3 ) , )
SSE_CFLAGS = -msse3 -mfpmath=sse -mfxsr
SSE_CFLAGS = -msse3 -mfpmath=sse -mfxsr -DUSE_SSE
FFT_FLAG = -DFFTCONVOLVER_USE_SSE=1
else ifneq ($$(filter $(CPU_INFO) | grep sse2 ) , )
SSE_CFLAGS = -msse2 -mfpmath=sse -mfxsr
SSE_CFLAGS = -msse2 -mfpmath=sse -mfxsr -DUSE_SSE
FFT_FLAG = -DFFTCONVOLVER_USE_SSE=1
else ifneq ($$(filter $(CPU_INFO) | grep sse ) , )
SSE_CFLAGS = -msse -mfpmath=sse -mfxsr
SSE_CFLAGS = -msse -mfpmath=sse -mfxsr -DUSE_SSE
FFT_FLAG = -DFFTCONVOLVER_USE_SSE=1
else ifneq ($$(filter $(CPU_INFO) | grep ARM ) , )
ifneq ($$(filter $(CPU_INFO) | grep ARMv7 ) , )
Expand Down Expand Up @@ -99,15 +99,15 @@ CXX_v = $(shell $(CXX) -dumpversion)
ifneq ($(MAKECMDGOALS),install)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(NO_x86_64), $(x86_64_LEVEL))
ifeq ($(shell awk -v a="$(CXX_v)" -v b="11" 'BEGIN{print(a<b)}'), 1)
ifeq ($(TARGET_ARCH), aarch64)
CXXFLAGS += -march=armv8-a
$(info $(yellow) INFO: $(reset)optimised for $(blue)-march=armv8-a $(SSE_CFLAGS)$(reset))
else ifeq ($(shell awk -v a="$(CXX_v)" -v b="11" 'BEGIN{print(a<b)}'), 1)
SSE_CFLAGS += -march=native
$(info $(yellow) INFO: $(reset)optimised for $(blue)$(SSE_CFLAGS)$(reset))
else ifeq ($(TARGET_ARCH), x86_64)
SSE_CFLAGS += -march=x86-64$(x86_64_LEVEL)
$(info $(yellow) INFO: $(reset)optimised for $(blue)$(SSE_CFLAGS)$(reset))
else ifeq ($(TARGET_ARCH), aarch64)
CXXFLAGS += -march=armv8-a
$(info $(yellow) INFO: $(reset)optimised for $(blue)-march=armv8-a $(SSE_CFLAGS)$(reset))
else
SSE_CFLAGS += -march=native
$(info $(yellow) INFO: $(reset)optimised for $(blue)$(SSE_CFLAGS)$(reset))
Expand Down

0 comments on commit 2ede136

Please sign in to comment.