mirror of https://github.com/tevador/RandomX
Regression tests (#73)
* instruction decode/execute separated into class BytecodeMachine * added randomx-tests project * removed the use of non-portable __COUNTER__ macro * removed the use of unsupported FENV_ACCESS pragmapr-rotub
parent
776723dd40
commit
07293a9378
@ -0,0 +1,482 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019, tevador <tevador@gmail.com>
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the copyright holder nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bytecode_machine.hpp"
|
||||||
|
#include "reciprocal.h"
|
||||||
|
|
||||||
|
namespace randomx {
|
||||||
|
|
||||||
|
const int_reg_t BytecodeMachine::zero = 0;
|
||||||
|
|
||||||
|
#define INSTR_CASE(x) case InstructionType::x: \
|
||||||
|
exe_ ## x(ibc, pc, scratchpad, config); \
|
||||||
|
break;
|
||||||
|
|
||||||
|
void BytecodeMachine::executeInstruction(RANDOMX_EXE_ARGS) {
|
||||||
|
switch (ibc.type)
|
||||||
|
{
|
||||||
|
INSTR_CASE(IADD_RS)
|
||||||
|
INSTR_CASE(IADD_M)
|
||||||
|
INSTR_CASE(ISUB_R)
|
||||||
|
INSTR_CASE(ISUB_M)
|
||||||
|
INSTR_CASE(IMUL_R)
|
||||||
|
INSTR_CASE(IMUL_M)
|
||||||
|
INSTR_CASE(IMULH_R)
|
||||||
|
INSTR_CASE(IMULH_M)
|
||||||
|
INSTR_CASE(ISMULH_R)
|
||||||
|
INSTR_CASE(ISMULH_M)
|
||||||
|
INSTR_CASE(INEG_R)
|
||||||
|
INSTR_CASE(IXOR_R)
|
||||||
|
INSTR_CASE(IXOR_M)
|
||||||
|
INSTR_CASE(IROR_R)
|
||||||
|
INSTR_CASE(IROL_R)
|
||||||
|
INSTR_CASE(ISWAP_R)
|
||||||
|
INSTR_CASE(FSWAP_R)
|
||||||
|
INSTR_CASE(FADD_R)
|
||||||
|
INSTR_CASE(FADD_M)
|
||||||
|
INSTR_CASE(FSUB_R)
|
||||||
|
INSTR_CASE(FSUB_M)
|
||||||
|
INSTR_CASE(FSCAL_R)
|
||||||
|
INSTR_CASE(FMUL_R)
|
||||||
|
INSTR_CASE(FDIV_M)
|
||||||
|
INSTR_CASE(FSQRT_R)
|
||||||
|
INSTR_CASE(CBRANCH)
|
||||||
|
INSTR_CASE(CFROUND)
|
||||||
|
INSTR_CASE(ISTORE)
|
||||||
|
|
||||||
|
case InstructionType::NOP:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case InstructionType::IMUL_RCP: //executed as IMUL_R
|
||||||
|
default:
|
||||||
|
UNREACHABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BytecodeMachine::compileInstruction(RANDOMX_GEN_ARGS) {
|
||||||
|
int opcode = instr.opcode;
|
||||||
|
|
||||||
|
if (opcode < ceil_IADD_RS) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IADD_RS;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
if (dst != RegisterNeedsDisplacement) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.shift = instr.getModShift();
|
||||||
|
ibc.imm = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.shift = instr.getModShift();
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IADD_M) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IADD_M;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.isrc = &zero;
|
||||||
|
ibc.memMask = ScratchpadL3Mask;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_ISUB_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::ISUB_R;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
ibc.isrc = &ibc.imm;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_ISUB_M) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::ISUB_M;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.isrc = &zero;
|
||||||
|
ibc.memMask = ScratchpadL3Mask;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IMUL_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IMUL_R;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
ibc.isrc = &ibc.imm;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IMUL_M) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IMUL_M;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.isrc = &zero;
|
||||||
|
ibc.memMask = ScratchpadL3Mask;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IMULH_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IMULH_R;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IMULH_M) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IMULH_M;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.isrc = &zero;
|
||||||
|
ibc.memMask = ScratchpadL3Mask;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_ISMULH_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::ISMULH_R;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_ISMULH_M) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::ISMULH_M;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.isrc = &zero;
|
||||||
|
ibc.memMask = ScratchpadL3Mask;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IMUL_RCP) {
|
||||||
|
uint64_t divisor = instr.getImm32();
|
||||||
|
if (!isPowerOf2(divisor)) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IMUL_R;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.imm = randomx_reciprocal(divisor);
|
||||||
|
ibc.isrc = &ibc.imm;
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.type = InstructionType::NOP;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_INEG_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
ibc.type = InstructionType::INEG_R;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IXOR_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IXOR_R;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
ibc.isrc = &ibc.imm;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IXOR_M) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IXOR_M;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.isrc = &zero;
|
||||||
|
ibc.memMask = ScratchpadL3Mask;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IROR_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IROR_R;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.imm = instr.getImm32();
|
||||||
|
ibc.isrc = &ibc.imm;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_IROL_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::IROL_R;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.imm = instr.getImm32();
|
||||||
|
ibc.isrc = &ibc.imm;
|
||||||
|
}
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_ISWAP_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
if (src != dst) {
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.type = InstructionType::ISWAP_R;
|
||||||
|
registerUsage[dst] = i;
|
||||||
|
registerUsage[src] = i;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ibc.type = InstructionType::NOP;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_FSWAP_R) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
ibc.type = InstructionType::FSWAP_R;
|
||||||
|
if (dst < RegisterCountFlt)
|
||||||
|
ibc.fdst = &nreg->f[dst];
|
||||||
|
else
|
||||||
|
ibc.fdst = &nreg->e[dst - RegisterCountFlt];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_FADD_R) {
|
||||||
|
auto dst = instr.dst % RegisterCountFlt;
|
||||||
|
auto src = instr.src % RegisterCountFlt;
|
||||||
|
ibc.type = InstructionType::FADD_R;
|
||||||
|
ibc.fdst = &nreg->f[dst];
|
||||||
|
ibc.fsrc = &nreg->a[src];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_FADD_M) {
|
||||||
|
auto dst = instr.dst % RegisterCountFlt;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::FADD_M;
|
||||||
|
ibc.fdst = &nreg->f[dst];
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_FSUB_R) {
|
||||||
|
auto dst = instr.dst % RegisterCountFlt;
|
||||||
|
auto src = instr.src % RegisterCountFlt;
|
||||||
|
ibc.type = InstructionType::FSUB_R;
|
||||||
|
ibc.fdst = &nreg->f[dst];
|
||||||
|
ibc.fsrc = &nreg->a[src];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_FSUB_M) {
|
||||||
|
auto dst = instr.dst % RegisterCountFlt;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::FSUB_M;
|
||||||
|
ibc.fdst = &nreg->f[dst];
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_FSCAL_R) {
|
||||||
|
auto dst = instr.dst % RegisterCountFlt;
|
||||||
|
ibc.fdst = &nreg->f[dst];
|
||||||
|
ibc.type = InstructionType::FSCAL_R;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_FMUL_R) {
|
||||||
|
auto dst = instr.dst % RegisterCountFlt;
|
||||||
|
auto src = instr.src % RegisterCountFlt;
|
||||||
|
ibc.type = InstructionType::FMUL_R;
|
||||||
|
ibc.fdst = &nreg->e[dst];
|
||||||
|
ibc.fsrc = &nreg->a[src];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_FDIV_M) {
|
||||||
|
auto dst = instr.dst % RegisterCountFlt;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::FDIV_M;
|
||||||
|
ibc.fdst = &nreg->e[dst];
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_FSQRT_R) {
|
||||||
|
auto dst = instr.dst % RegisterCountFlt;
|
||||||
|
ibc.type = InstructionType::FSQRT_R;
|
||||||
|
ibc.fdst = &nreg->e[dst];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_CBRANCH) {
|
||||||
|
ibc.type = InstructionType::CBRANCH;
|
||||||
|
//jump condition
|
||||||
|
int creg = instr.dst % RegistersCount;
|
||||||
|
ibc.idst = &nreg->r[creg];
|
||||||
|
ibc.target = registerUsage[creg];
|
||||||
|
int shift = instr.getModCond() + ConditionOffset;
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32()) | (1ULL << shift);
|
||||||
|
if (ConditionOffset > 0 || shift > 0) //clear the bit below the condition mask - this limits the number of successive jumps to 2
|
||||||
|
ibc.imm &= ~(1ULL << (shift - 1));
|
||||||
|
ibc.memMask = ConditionMask << shift;
|
||||||
|
//mark all registers as used
|
||||||
|
for (unsigned j = 0; j < RegistersCount; ++j) {
|
||||||
|
registerUsage[j] = i;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_CFROUND) {
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.type = InstructionType::CFROUND;
|
||||||
|
ibc.imm = instr.getImm32() & 63;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_ISTORE) {
|
||||||
|
auto dst = instr.dst % RegistersCount;
|
||||||
|
auto src = instr.src % RegistersCount;
|
||||||
|
ibc.type = InstructionType::ISTORE;
|
||||||
|
ibc.idst = &nreg->r[dst];
|
||||||
|
ibc.isrc = &nreg->r[src];
|
||||||
|
ibc.imm = signExtend2sCompl(instr.getImm32());
|
||||||
|
if (instr.getModCond() < StoreL3Condition)
|
||||||
|
ibc.memMask = (instr.getModMem() ? ScratchpadL1Mask : ScratchpadL2Mask);
|
||||||
|
else
|
||||||
|
ibc.memMask = ScratchpadL3Mask;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opcode < ceil_NOP) {
|
||||||
|
ibc.type = InstructionType::NOP;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UNREACHABLE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,322 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2019, tevador <tevador@gmail.com>
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the copyright holder nor the
|
||||||
|
names of its contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common.hpp"
|
||||||
|
#include "intrin_portable.h"
|
||||||
|
#include "instruction.hpp"
|
||||||
|
#include "program.hpp"
|
||||||
|
|
||||||
|
namespace randomx {
|
||||||
|
|
||||||
|
//register file in machine byte order
|
||||||
|
struct NativeRegisterFile {
|
||||||
|
int_reg_t r[RegistersCount] = { 0 };
|
||||||
|
rx_vec_f128 f[RegisterCountFlt];
|
||||||
|
rx_vec_f128 e[RegisterCountFlt];
|
||||||
|
rx_vec_f128 a[RegisterCountFlt];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct InstructionByteCode {
|
||||||
|
union {
|
||||||
|
int_reg_t* idst;
|
||||||
|
rx_vec_f128* fdst;
|
||||||
|
};
|
||||||
|
union {
|
||||||
|
const int_reg_t* isrc;
|
||||||
|
const rx_vec_f128* fsrc;
|
||||||
|
};
|
||||||
|
union {
|
||||||
|
uint64_t imm;
|
||||||
|
int64_t simm;
|
||||||
|
};
|
||||||
|
InstructionType type;
|
||||||
|
union {
|
||||||
|
int16_t target;
|
||||||
|
uint16_t shift;
|
||||||
|
};
|
||||||
|
uint32_t memMask;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define OPCODE_CEIL_DECLARE(curr, prev) constexpr int ceil_ ## curr = ceil_ ## prev + RANDOMX_FREQ_ ## curr;
|
||||||
|
constexpr int ceil_NULL = 0;
|
||||||
|
OPCODE_CEIL_DECLARE(IADD_RS, NULL);
|
||||||
|
OPCODE_CEIL_DECLARE(IADD_M, IADD_RS);
|
||||||
|
OPCODE_CEIL_DECLARE(ISUB_R, IADD_M);
|
||||||
|
OPCODE_CEIL_DECLARE(ISUB_M, ISUB_R);
|
||||||
|
OPCODE_CEIL_DECLARE(IMUL_R, ISUB_M);
|
||||||
|
OPCODE_CEIL_DECLARE(IMUL_M, IMUL_R);
|
||||||
|
OPCODE_CEIL_DECLARE(IMULH_R, IMUL_M);
|
||||||
|
OPCODE_CEIL_DECLARE(IMULH_M, IMULH_R);
|
||||||
|
OPCODE_CEIL_DECLARE(ISMULH_R, IMULH_M);
|
||||||
|
OPCODE_CEIL_DECLARE(ISMULH_M, ISMULH_R);
|
||||||
|
OPCODE_CEIL_DECLARE(IMUL_RCP, ISMULH_M);
|
||||||
|
OPCODE_CEIL_DECLARE(INEG_R, IMUL_RCP);
|
||||||
|
OPCODE_CEIL_DECLARE(IXOR_R, INEG_R);
|
||||||
|
OPCODE_CEIL_DECLARE(IXOR_M, IXOR_R);
|
||||||
|
OPCODE_CEIL_DECLARE(IROR_R, IXOR_M);
|
||||||
|
OPCODE_CEIL_DECLARE(IROL_R, IROR_R);
|
||||||
|
OPCODE_CEIL_DECLARE(ISWAP_R, IROL_R);
|
||||||
|
OPCODE_CEIL_DECLARE(FSWAP_R, ISWAP_R);
|
||||||
|
OPCODE_CEIL_DECLARE(FADD_R, FSWAP_R);
|
||||||
|
OPCODE_CEIL_DECLARE(FADD_M, FADD_R);
|
||||||
|
OPCODE_CEIL_DECLARE(FSUB_R, FADD_M);
|
||||||
|
OPCODE_CEIL_DECLARE(FSUB_M, FSUB_R);
|
||||||
|
OPCODE_CEIL_DECLARE(FSCAL_R, FSUB_M);
|
||||||
|
OPCODE_CEIL_DECLARE(FMUL_R, FSCAL_R);
|
||||||
|
OPCODE_CEIL_DECLARE(FDIV_M, FMUL_R);
|
||||||
|
OPCODE_CEIL_DECLARE(FSQRT_R, FDIV_M);
|
||||||
|
OPCODE_CEIL_DECLARE(CBRANCH, FSQRT_R);
|
||||||
|
OPCODE_CEIL_DECLARE(CFROUND, CBRANCH);
|
||||||
|
OPCODE_CEIL_DECLARE(ISTORE, CFROUND);
|
||||||
|
OPCODE_CEIL_DECLARE(NOP, ISTORE);
|
||||||
|
#undef OPCODE_CEIL_DECLARE
|
||||||
|
|
||||||
|
#define RANDOMX_EXE_ARGS InstructionByteCode& ibc, int& pc, uint8_t* scratchpad, ProgramConfiguration& config
|
||||||
|
#define RANDOMX_GEN_ARGS Instruction& instr, int i, InstructionByteCode& ibc
|
||||||
|
|
||||||
|
class BytecodeMachine;
|
||||||
|
|
||||||
|
typedef void(BytecodeMachine::*InstructionGenBytecode)(RANDOMX_GEN_ARGS);
|
||||||
|
|
||||||
|
class BytecodeMachine {
|
||||||
|
public:
|
||||||
|
void beginCompilation(NativeRegisterFile& regFile) {
|
||||||
|
for (unsigned i = 0; i < RegistersCount; ++i) {
|
||||||
|
registerUsage[i] = -1;
|
||||||
|
}
|
||||||
|
nreg = ®File;
|
||||||
|
}
|
||||||
|
|
||||||
|
void compileProgram(Program& program, InstructionByteCode bytecode[RANDOMX_PROGRAM_SIZE], NativeRegisterFile& regFile) {
|
||||||
|
beginCompilation(regFile);
|
||||||
|
for (unsigned i = 0; i < RANDOMX_PROGRAM_SIZE; ++i) {
|
||||||
|
auto& instr = program(i);
|
||||||
|
auto& ibc = bytecode[i];
|
||||||
|
compileInstruction(instr, i, ibc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void executeBytecode(InstructionByteCode bytecode[RANDOMX_PROGRAM_SIZE], uint8_t* scratchpad, ProgramConfiguration& config) {
|
||||||
|
for (int pc = 0; pc < RANDOMX_PROGRAM_SIZE; ++pc) {
|
||||||
|
auto& ibc = bytecode[pc];
|
||||||
|
executeInstruction(ibc, pc, scratchpad, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void compileInstruction(RANDOMX_GEN_ARGS)
|
||||||
|
#ifdef RANDOMX_GEN_TABLE
|
||||||
|
{
|
||||||
|
auto generator = genTable[instr.opcode];
|
||||||
|
(this->*generator)(instr, i, ibc);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void executeInstruction(RANDOMX_EXE_ARGS);
|
||||||
|
|
||||||
|
static void exe_IADD_RS(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst += (*ibc.isrc << ibc.shift) + ibc.imm;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_IADD_M(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst += load64(getScratchpadAddress(ibc, scratchpad));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_ISUB_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst -= *ibc.isrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_ISUB_M(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst -= load64(getScratchpadAddress(ibc, scratchpad));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_IMUL_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst *= *ibc.isrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_IMUL_M(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst *= load64(getScratchpadAddress(ibc, scratchpad));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_IMULH_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst = mulh(*ibc.idst, *ibc.isrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_IMULH_M(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst = mulh(*ibc.idst, load64(getScratchpadAddress(ibc, scratchpad)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_ISMULH_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst = smulh(unsigned64ToSigned2sCompl(*ibc.idst), unsigned64ToSigned2sCompl(*ibc.isrc));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_ISMULH_M(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst = smulh(unsigned64ToSigned2sCompl(*ibc.idst), unsigned64ToSigned2sCompl(load64(getScratchpadAddress(ibc, scratchpad))));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_INEG_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst = ~(*ibc.idst) + 1; //two's complement negative
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_IXOR_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst ^= *ibc.isrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_IXOR_M(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst ^= load64(getScratchpadAddress(ibc, scratchpad));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_IROR_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst = rotr(*ibc.idst, *ibc.isrc & 63);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_IROL_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst = rotl(*ibc.idst, *ibc.isrc & 63);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_ISWAP_R(RANDOMX_EXE_ARGS) {
|
||||||
|
int_reg_t temp = *ibc.isrc;
|
||||||
|
*(int_reg_t*)ibc.isrc = *ibc.idst;
|
||||||
|
*ibc.idst = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_FSWAP_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.fdst = rx_swap_vec_f128(*ibc.fdst);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_FADD_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.fdst = rx_add_vec_f128(*ibc.fdst, *ibc.fsrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_FADD_M(RANDOMX_EXE_ARGS) {
|
||||||
|
rx_vec_f128 fsrc = rx_cvt_packed_int_vec_f128(getScratchpadAddress(ibc, scratchpad));
|
||||||
|
*ibc.fdst = rx_add_vec_f128(*ibc.fdst, fsrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_FSUB_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.fdst = rx_sub_vec_f128(*ibc.fdst, *ibc.fsrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_FSUB_M(RANDOMX_EXE_ARGS) {
|
||||||
|
rx_vec_f128 fsrc = rx_cvt_packed_int_vec_f128(getScratchpadAddress(ibc, scratchpad));
|
||||||
|
*ibc.fdst = rx_sub_vec_f128(*ibc.fdst, fsrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_FSCAL_R(RANDOMX_EXE_ARGS) {
|
||||||
|
const rx_vec_f128 mask = rx_set1_vec_f128(0x80F0000000000000);
|
||||||
|
*ibc.fdst = rx_xor_vec_f128(*ibc.fdst, mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_FMUL_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.fdst = rx_mul_vec_f128(*ibc.fdst, *ibc.fsrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_FDIV_M(RANDOMX_EXE_ARGS) {
|
||||||
|
rx_vec_f128 fsrc = maskRegisterExponentMantissa(
|
||||||
|
config,
|
||||||
|
rx_cvt_packed_int_vec_f128(getScratchpadAddress(ibc, scratchpad))
|
||||||
|
);
|
||||||
|
*ibc.fdst = rx_div_vec_f128(*ibc.fdst, fsrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_FSQRT_R(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.fdst = rx_sqrt_vec_f128(*ibc.fdst);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_CBRANCH(RANDOMX_EXE_ARGS) {
|
||||||
|
*ibc.idst += ibc.imm;
|
||||||
|
if ((*ibc.idst & ibc.memMask) == 0) {
|
||||||
|
pc = ibc.target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_CFROUND(RANDOMX_EXE_ARGS) {
|
||||||
|
rx_set_rounding_mode(rotr(*ibc.isrc, ibc.imm) % 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void exe_ISTORE(RANDOMX_EXE_ARGS) {
|
||||||
|
store64(scratchpad + ((*ibc.idst + ibc.imm) & ibc.memMask), *ibc.isrc);
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
static rx_vec_f128 maskRegisterExponentMantissa(ProgramConfiguration& config, rx_vec_f128 x) {
|
||||||
|
const rx_vec_f128 xmantissaMask = rx_set_vec_f128(dynamicMantissaMask, dynamicMantissaMask);
|
||||||
|
const rx_vec_f128 xexponentMask = rx_load_vec_f128((const double*)&config.eMask);
|
||||||
|
x = rx_and_vec_f128(x, xmantissaMask);
|
||||||
|
x = rx_or_vec_f128(x, xexponentMask);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const int_reg_t zero;
|
||||||
|
int registerUsage[RegistersCount];
|
||||||
|
NativeRegisterFile* nreg;
|
||||||
|
|
||||||
|
static void* getScratchpadAddress(InstructionByteCode& ibc, uint8_t* scratchpad) {
|
||||||
|
uint32_t addr = (*ibc.isrc + ibc.imm) & ibc.memMask;
|
||||||
|
return scratchpad + addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef RANDOMX_GEN_TABLE
|
||||||
|
static InstructionGenBytecode genTable[256];
|
||||||
|
|
||||||
|
void gen_IADD_RS(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IADD_M(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_ISUB_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_ISUB_M(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IMUL_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IMUL_M(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IMULH_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IMULH_M(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_ISMULH_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_ISMULH_M(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IMUL_RCP(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_INEG_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IXOR_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IXOR_M(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IROR_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_IROL_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_ISWAP_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_FSWAP_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_FADD_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_FADD_M(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_FSUB_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_FSUB_M(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_FSCAL_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_FMUL_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_FDIV_M(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_FSQRT_R(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_CBRANCH(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_CFROUND(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_ISTORE(RANDOMX_GEN_ARGS);
|
||||||
|
void gen_NOP(RANDOMX_GEN_ARGS);
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
|
<ProjectGuid>{41F3F4DF-8113-4029-9915-FDDC44C43D49}</ProjectGuid>
|
||||||
|
<RootNamespace>tests</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||||
|
<ProjectName>tests</ProjectName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\tests\tests.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="randomx.vcxproj">
|
||||||
|
<Project>{3346a4ad-c438-4324-8b77-47a16452954b}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\src\tests\utility.hpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\src\tests\utility.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\tests\tests.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
Loading…
Reference in new issue