FPU wasn't using SIMD. Oops

Fix identation
This commit is contained in:
SimoneN64
2024-09-28 11:23:56 +02:00
parent d0048e1eb0
commit 8e78102794
6 changed files with 74 additions and 1936 deletions

2
.gitignore vendored
View File

@@ -14,10 +14,8 @@ vgcore.*
*.data *.data
disasm.txt disasm.txt
*log*.txt *log*.txt
.vs/
CMakeSettings.json CMakeSettings.json
out/ out/
settings.json settings.json
compile_commands.json compile_commands.json
.vscode/
*.diagsession *.diagsession

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -7,36 +7,36 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
if (WIN32) if (WIN32)
add_compile_definitions(NOMINMAX) add_compile_definitions(NOMINMAX)
endif () endif ()
include_directories( include_directories(
. .
../ ../
../utils ../utils
../backend ../backend
../backend/core ../backend/core
../backend/core/mmio ../backend/core/mmio
../backend/core/mmio/PIF ../backend/core/mmio/PIF
../backend/core/registers ../backend/core/registers
../backend/core/rsp ../backend/core/rsp
../../external ../../external
../../external/discord_rpc/include ../../external/discord_rpc/include
../../external/xbyak ../../external/xbyak
../../external/mio/include ../../external/mio/include
../../external/fmt/include ../../external/fmt/include
../../external/json/include ../../external/json/include
../../external/parallel-rdp ../../external/parallel-rdp
../../external/parallel-rdp ../../external/parallel-rdp
../../external/parallel-rdp/parallel-rdp-standalone/parallel-rdp ../../external/parallel-rdp/parallel-rdp-standalone/parallel-rdp
../../external/parallel-rdp/parallel-rdp-standalone/volk ../../external/parallel-rdp/parallel-rdp-standalone/volk
../../external/parallel-rdp/parallel-rdp-standalone/spirv-cross ../../external/parallel-rdp/parallel-rdp-standalone/spirv-cross
../../external/parallel-rdp/parallel-rdp-standalone/vulkan ../../external/parallel-rdp/parallel-rdp-standalone/vulkan
../../external/parallel-rdp/parallel-rdp-standalone/vulkan-headers/include ../../external/parallel-rdp/parallel-rdp-standalone/vulkan-headers/include
../../external/parallel-rdp/parallel-rdp-standalone/util ../../external/parallel-rdp/parallel-rdp-standalone/util
../../external/unarr ../../external/unarr
../../external/SDL/include ../../external/SDL/include
../../external/capstone/include ../../external/capstone/include
) )
option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." OFF) option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." OFF)
@@ -44,6 +44,19 @@ option(RAPIDJSON_BUILD_EXAMPLES "Build rapidjson examples." OFF)
option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." OFF) option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." OFF)
option(BUILD_SHARED_LIBS OFF) option(BUILD_SHARED_LIBS OFF)
include(CheckCCompilerFlag)
check_c_compiler_flag(-msse4.1 HAS_SSE4_1)
if (HAS_SSE4_1)
add_compile_definitions(SIMD_SUPPORT)
add_compile_options(-msse3 -msse4.1)
endif ()
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
add_compile_definitions(VULKAN_DEBUG)
endif ()
add_subdirectory(../../external/discord_rpc discord_rpc) add_subdirectory(../../external/discord_rpc discord_rpc)
add_subdirectory(../../external/json json) add_subdirectory(../../external/json json)
add_subdirectory(../../external/fmt fmt) add_subdirectory(../../external/fmt fmt)
@@ -59,48 +72,33 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
add_executable(kaizen-qt add_executable(kaizen-qt
main.cpp main.cpp
KaizenQt.hpp KaizenQt.hpp
KaizenQt.cpp KaizenQt.cpp
RenderWidget.cpp RenderWidget.cpp
RenderWidget.hpp RenderWidget.hpp
EmuThread.hpp EmuThread.hpp
EmuThread.cpp EmuThread.cpp
MainWindow.hpp MainWindow.hpp
MainWindow.cpp MainWindow.cpp
SettingsWindow.hpp SettingsWindow.hpp
SettingsWindow.cpp SettingsWindow.cpp
CPUSettings.hpp CPUSettings.hpp
CPUSettings.cpp CPUSettings.cpp
JSONUtils.hpp JSONUtils.hpp
AudioSettings.hpp AudioSettings.hpp
AudioSettings.cpp AudioSettings.cpp
InputSettings.hpp InputSettings.hpp
InputSettings.cpp InputSettings.cpp
Debugger.hpp Debugger.hpp
Debugger.cpp Debugger.cpp
CodeModel.hpp) CodeModel.hpp)
include(CheckCCompilerFlag)
check_c_compiler_flag(-msse4.1 HAS_SSE4_1)
if (HAS_SSE4_1)
target_compile_definitions(kaizen-qt PUBLIC SIMD_SUPPORT)
target_compile_options(kaizen-qt PUBLIC -msse3 -msse4.1)
endif ()
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
target_compile_definitions(kaizen-qt PUBLIC VULKAN_DEBUG)
#target_compile_options(kaizen-qt PUBLIC -fsanitize=address -fsanitize=undefined)
#target_link_options(kaizen-qt PUBLIC -fsanitize=address -fsanitize=undefined)
endif ()
target_link_libraries(kaizen-qt PUBLIC SDL3::SDL3 SDL3::SDL3-static Qt6::Core Qt6::Gui Qt6::Widgets discord-rpc fmt mio nlohmann_json parallel-rdp backend) target_link_libraries(kaizen-qt PUBLIC SDL3::SDL3 SDL3::SDL3-static Qt6::Core Qt6::Gui Qt6::Widgets discord-rpc fmt mio nlohmann_json parallel-rdp backend)
target_compile_definitions(kaizen-qt PUBLIC SDL_MAIN_HANDLED) target_compile_definitions(kaizen-qt PUBLIC SDL_MAIN_HANDLED)
file(COPY ../../resources/ DESTINATION ${PROJECT_BINARY_DIR}/resources/) file(COPY ../../resources/ DESTINATION ${PROJECT_BINARY_DIR}/resources/)
file(REMOVE file(REMOVE
${PROJECT_BINARY_DIR}/resources/mario.png ${PROJECT_BINARY_DIR}/resources/mario.png
${PROJECT_BINARY_DIR}/resources/shader.frag ${PROJECT_BINARY_DIR}/resources/shader.frag
${PROJECT_BINARY_DIR}/resources/shader.vert) ${PROJECT_BINARY_DIR}/resources/shader.vert)

View File

@@ -1,7 +1,3 @@
//
// Created by simone on 6/25/24.
//
#pragma once #pragma once
#include <cmath> #include <cmath>
#include <common.hpp> #include <common.hpp>
@@ -9,7 +5,7 @@
namespace Util { namespace Util {
template <typename T> template <typename T>
static inline T roundCeil(float f) { static FORCE_INLINE T roundCeil(float f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
__m128 t = _mm_set_ss(f); __m128 t = _mm_set_ss(f);
t = _mm_round_ss(t, t, _MM_FROUND_TO_POS_INF); t = _mm_round_ss(t, t, _MM_FROUND_TO_POS_INF);
@@ -20,7 +16,7 @@ static inline T roundCeil(float f) {
} }
template <typename T> template <typename T>
static inline T roundCeil(double f) { static FORCE_INLINE T roundCeil(double f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
__m128d t = _mm_set_sd(f); __m128d t = _mm_set_sd(f);
t = _mm_round_sd(t, t, _MM_FROUND_TO_POS_INF); t = _mm_round_sd(t, t, _MM_FROUND_TO_POS_INF);
@@ -31,7 +27,7 @@ static inline T roundCeil(double f) {
} }
template <typename T> template <typename T>
static inline T roundNearest(float f) { static FORCE_INLINE T roundNearest(float f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
__m128 t = _mm_set_ss(f); __m128 t = _mm_set_ss(f);
t = _mm_round_ss(t, t, _MM_FROUND_TO_NEAREST_INT); t = _mm_round_ss(t, t, _MM_FROUND_TO_NEAREST_INT);
@@ -42,7 +38,7 @@ static inline T roundNearest(float f) {
} }
template <typename T> template <typename T>
static inline T roundNearest(double f) { static FORCE_INLINE T roundNearest(double f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
__m128d t = _mm_set_sd(f); __m128d t = _mm_set_sd(f);
t = _mm_round_sd(t, t, _MM_FROUND_TO_NEAREST_INT); t = _mm_round_sd(t, t, _MM_FROUND_TO_NEAREST_INT);
@@ -53,7 +49,7 @@ static inline T roundNearest(double f) {
} }
template <typename T> template <typename T>
static inline T roundCurrent(float f) { static FORCE_INLINE T roundCurrent(float f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
auto t = _mm_set_ss(f); auto t = _mm_set_ss(f);
t = _mm_round_ss(t, t, _MM_FROUND_CUR_DIRECTION); t = _mm_round_ss(t, t, _MM_FROUND_CUR_DIRECTION);
@@ -64,7 +60,7 @@ static inline T roundCurrent(float f) {
} }
template <typename T> template <typename T>
static inline T roundCurrent(double f) { static FORCE_INLINE T roundCurrent(double f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
auto t = _mm_set_sd(f); auto t = _mm_set_sd(f);
t = _mm_round_sd(t, t, _MM_FROUND_CUR_DIRECTION); t = _mm_round_sd(t, t, _MM_FROUND_CUR_DIRECTION);
@@ -76,7 +72,7 @@ static inline T roundCurrent(double f) {
template <typename T> template <typename T>
static inline T roundFloor(float f) { static FORCE_INLINE T roundFloor(float f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
__m128 t = _mm_set_ss(f); __m128 t = _mm_set_ss(f);
t = _mm_round_ss(t, t, _MM_FROUND_TO_NEG_INF); t = _mm_round_ss(t, t, _MM_FROUND_TO_NEG_INF);
@@ -87,7 +83,7 @@ static inline T roundFloor(float f) {
} }
template <typename T> template <typename T>
static inline T roundFloor(double f) { static FORCE_INLINE T roundFloor(double f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
__m128d t = _mm_set_sd(f); __m128d t = _mm_set_sd(f);
t = _mm_round_sd(t, t, _MM_FROUND_TO_NEG_INF); t = _mm_round_sd(t, t, _MM_FROUND_TO_NEG_INF);
@@ -98,7 +94,7 @@ static inline T roundFloor(double f) {
} }
template <typename T> template <typename T>
static inline T roundTrunc(float f) { static FORCE_INLINE T roundTrunc(float f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
__m128 t = _mm_set_ss(f); __m128 t = _mm_set_ss(f);
t = _mm_round_ss(t, t, _MM_FROUND_TO_ZERO); t = _mm_round_ss(t, t, _MM_FROUND_TO_ZERO);
@@ -109,7 +105,7 @@ static inline T roundTrunc(float f) {
} }
template <typename T> template <typename T>
static inline T roundTrunc(double f) { static FORCE_INLINE T roundTrunc(double f) {
#ifdef SIMD_SUPPORT #ifdef SIMD_SUPPORT
__m128d t = _mm_set_sd(f); __m128d t = _mm_set_sd(f);
t = _mm_round_sd(t, t, _MM_FROUND_TO_ZERO); t = _mm_round_sd(t, t, _MM_FROUND_TO_ZERO);