From 91cd35ff13aa3c8fa77ebe6cd863708ea6c6add3 Mon Sep 17 00:00:00 2001 From: tevador <37503146+tevador@users.noreply.github.com> Date: Sat, 22 Jun 2019 16:05:22 +0200 Subject: [PATCH] Decrease the frequency of FADD/FSUB in favor of FMUL (#77) * this better matches CPU capabilities since execution ports are usually split 1:1 between fadd and fmul * the frequency of FSWAP_R decreased from 8 to 4 (it's ASIC-friendly) * activate IROL_R instruction --- src/asm/configuration.asm | 12 ++++++------ src/common.hpp | 2 +- src/configuration.h | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/asm/configuration.asm b/src/asm/configuration.asm index f2f2069..f812c28 100644 --- a/src/asm/configuration.asm +++ b/src/asm/configuration.asm @@ -29,16 +29,16 @@ RANDOMX_FREQ_IMUL_RCP EQU 8t RANDOMX_FREQ_INEG_R EQU 2t RANDOMX_FREQ_IXOR_R EQU 15t RANDOMX_FREQ_IXOR_M EQU 5t -RANDOMX_FREQ_IROR_R EQU 10t -RANDOMX_FREQ_IROL_R EQU 0t +RANDOMX_FREQ_IROR_R EQU 8t +RANDOMX_FREQ_IROL_R EQU 2t RANDOMX_FREQ_ISWAP_R EQU 4t -RANDOMX_FREQ_FSWAP_R EQU 8t -RANDOMX_FREQ_FADD_R EQU 20t +RANDOMX_FREQ_FSWAP_R EQU 4t +RANDOMX_FREQ_FADD_R EQU 16t RANDOMX_FREQ_FADD_M EQU 5t -RANDOMX_FREQ_FSUB_R EQU 20t +RANDOMX_FREQ_FSUB_R EQU 16t RANDOMX_FREQ_FSUB_M EQU 5t RANDOMX_FREQ_FSCAL_R EQU 6t -RANDOMX_FREQ_FMUL_R EQU 20t +RANDOMX_FREQ_FMUL_R EQU 32t RANDOMX_FREQ_FDIV_M EQU 4t RANDOMX_FREQ_FSQRT_R EQU 6t RANDOMX_FREQ_CBRANCH EQU 16t diff --git a/src/common.hpp b/src/common.hpp index 960a99b..72961ea 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -61,7 +61,7 @@ namespace randomx { constexpr int wtSum = RANDOMX_FREQ_IADD_RS + RANDOMX_FREQ_IADD_M + RANDOMX_FREQ_ISUB_R + \ RANDOMX_FREQ_ISUB_M + RANDOMX_FREQ_IMUL_R + RANDOMX_FREQ_IMUL_M + RANDOMX_FREQ_IMULH_R + \ RANDOMX_FREQ_IMULH_M + RANDOMX_FREQ_ISMULH_R + RANDOMX_FREQ_ISMULH_M + RANDOMX_FREQ_IMUL_RCP + \ - RANDOMX_FREQ_INEG_R + RANDOMX_FREQ_IXOR_R + RANDOMX_FREQ_IXOR_M + RANDOMX_FREQ_IROR_R + RANDOMX_FREQ_ISWAP_R + \ + RANDOMX_FREQ_INEG_R + RANDOMX_FREQ_IXOR_R + RANDOMX_FREQ_IXOR_M + RANDOMX_FREQ_IROR_R + RANDOMX_FREQ_IROL_R + RANDOMX_FREQ_ISWAP_R + \ RANDOMX_FREQ_FSWAP_R + RANDOMX_FREQ_FADD_R + RANDOMX_FREQ_FADD_M + RANDOMX_FREQ_FSUB_R + RANDOMX_FREQ_FSUB_M + \ RANDOMX_FREQ_FSCAL_R + RANDOMX_FREQ_FMUL_R + RANDOMX_FREQ_FDIV_M + RANDOMX_FREQ_FSQRT_R + RANDOMX_FREQ_CBRANCH + \ RANDOMX_FREQ_CFROUND + RANDOMX_FREQ_ISTORE + RANDOMX_FREQ_NOP; diff --git a/src/configuration.h b/src/configuration.h index 006d07e..a2a9fd1 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -96,18 +96,18 @@ Total sum of frequencies must be 256 #define RANDOMX_FREQ_INEG_R 2 #define RANDOMX_FREQ_IXOR_R 15 #define RANDOMX_FREQ_IXOR_M 5 -#define RANDOMX_FREQ_IROR_R 10 -#define RANDOMX_FREQ_IROL_R 0 +#define RANDOMX_FREQ_IROR_R 8 +#define RANDOMX_FREQ_IROL_R 2 #define RANDOMX_FREQ_ISWAP_R 4 //Floating point instructions -#define RANDOMX_FREQ_FSWAP_R 8 -#define RANDOMX_FREQ_FADD_R 20 +#define RANDOMX_FREQ_FSWAP_R 4 +#define RANDOMX_FREQ_FADD_R 16 #define RANDOMX_FREQ_FADD_M 5 -#define RANDOMX_FREQ_FSUB_R 20 +#define RANDOMX_FREQ_FSUB_R 16 #define RANDOMX_FREQ_FSUB_M 5 #define RANDOMX_FREQ_FSCAL_R 6 -#define RANDOMX_FREQ_FMUL_R 20 +#define RANDOMX_FREQ_FMUL_R 32 #define RANDOMX_FREQ_FDIV_M 4 #define RANDOMX_FREQ_FSQRT_R 6