#899 Add ASM implementation for cn/half.

This commit is contained in:
XMRig 2019-01-14 18:09:16 +07:00
parent b43336582d
commit 492449e9fb
14 changed files with 2075 additions and 13 deletions

View file

@ -570,6 +570,11 @@ extern "C" void cnv2_mainloop_ryzen_asm(cryptonight_ctx *ctx);
extern "C" void cnv2_mainloop_bulldozer_asm(cryptonight_ctx *ctx);
extern "C" void cnv2_double_mainloop_sandybridge_asm(cryptonight_ctx* ctx0, cryptonight_ctx* ctx1);
extern "C" void cn_half_mainloop_ivybridge_asm(cryptonight_ctx *ctx);
extern "C" void cn_half_mainloop_ryzen_asm(cryptonight_ctx *ctx);
extern "C" void cn_half_mainloop_bulldozer_asm(cryptonight_ctx *ctx);
extern "C" void cn_half_double_mainloop_sandybridge_asm(cryptonight_ctx* ctx0, cryptonight_ctx* ctx1);
template<xmrig::Algo ALGO, xmrig::Variant VARIANT, xmrig::Assembly ASM>
inline void cryptonight_single_hash_asm(const uint8_t *__restrict__ input, size_t size, uint8_t *__restrict__ output, cryptonight_ctx **__restrict__ ctx)
@ -579,14 +584,27 @@ inline void cryptonight_single_hash_asm(const uint8_t *__restrict__ input, size_
xmrig::keccak(input, size, ctx[0]->state);
cn_explode_scratchpad<ALGO, MEM, false>(reinterpret_cast<__m128i*>(ctx[0]->state), reinterpret_cast<__m128i*>(ctx[0]->memory));
if (ASM == xmrig::ASM_INTEL) {
cnv2_mainloop_ivybridge_asm(ctx[0]);
if (VARIANT == xmrig::VARIANT_2) {
if (ASM == xmrig::ASM_INTEL) {
cnv2_mainloop_ivybridge_asm(ctx[0]);
}
else if (ASM == xmrig::ASM_RYZEN) {
cnv2_mainloop_ryzen_asm(ctx[0]);
}
else {
cnv2_mainloop_bulldozer_asm(ctx[0]);
}
}
else if (ASM == xmrig::ASM_RYZEN) {
cnv2_mainloop_ryzen_asm(ctx[0]);
}
else {
cnv2_mainloop_bulldozer_asm(ctx[0]);
else if (VARIANT == xmrig::VARIANT_HALF) {
if (ASM == xmrig::ASM_INTEL) {
cn_half_mainloop_ivybridge_asm(ctx[0]);
}
else if (ASM == xmrig::ASM_RYZEN) {
cn_half_mainloop_ryzen_asm(ctx[0]);
}
else {
cn_half_mainloop_bulldozer_asm(ctx[0]);
}
}
cn_implode_scratchpad<ALGO, MEM, false>(reinterpret_cast<__m128i*>(ctx[0]->memory), reinterpret_cast<__m128i*>(ctx[0]->state));
@ -606,7 +624,12 @@ inline void cryptonight_double_hash_asm(const uint8_t *__restrict__ input, size_
cn_explode_scratchpad<ALGO, MEM, false>(reinterpret_cast<__m128i*>(ctx[0]->state), reinterpret_cast<__m128i*>(ctx[0]->memory));
cn_explode_scratchpad<ALGO, MEM, false>(reinterpret_cast<__m128i*>(ctx[1]->state), reinterpret_cast<__m128i*>(ctx[1]->memory));
cnv2_double_mainloop_sandybridge_asm(ctx[0], ctx[1]);
if (VARIANT == xmrig::VARIANT_2) {
cnv2_double_mainloop_sandybridge_asm(ctx[0], ctx[1]);
}
else if (VARIANT == xmrig::VARIANT_HALF) {
cn_half_double_mainloop_sandybridge_asm(ctx[0], ctx[1]);
}
cn_implode_scratchpad<ALGO, MEM, false>(reinterpret_cast<__m128i*>(ctx[0]->memory), reinterpret_cast<__m128i*>(ctx[0]->state));
cn_implode_scratchpad<ALGO, MEM, false>(reinterpret_cast<__m128i*>(ctx[1]->memory), reinterpret_cast<__m128i*>(ctx[1]->state));