Monero
Toggle main menu visibility
Loading...
Searching...
No Matches
external
randomx
src
superscalar.hpp
Go to the documentation of this file.
1
/*
2
Copyright (c) 2018-2019, tevador <tevador@gmail.com>
3
4
All rights reserved.
5
6
Redistribution and use in source and binary forms, with or without
7
modification, are permitted provided that the following conditions are met:
8
* Redistributions of source code must retain the above copyright
9
notice, this list of conditions and the following disclaimer.
10
* Redistributions in binary form must reproduce the above copyright
11
notice, this list of conditions and the following disclaimer in the
12
documentation and/or other materials provided with the distribution.
13
* Neither the name of the copyright holder nor the
14
names of its contributors may be used to endorse or promote products
15
derived from this software without specific prior written permission.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#pragma once
30
31
#include <cstdint>
32
#include <vector>
33
#include "
superscalar_program.hpp
"
34
#include "
blake2_generator.hpp
"
35
36
namespace
randomx
{
37
// Intel Ivy Bridge reference
38
enum class
SuperscalarInstructionType
{
//uOPs (decode) execution ports latency code size
39
ISUB_R
= 0,
//1 p015 1 3 (sub)
40
IXOR_R
= 1,
//1 p015 1 3 (xor)
41
IADD_RS
= 2,
//1 p01 1 4 (lea)
42
IMUL_R
= 3,
//1 p1 3 4 (imul)
43
IROR_C
= 4,
//1 p05 1 4 (ror)
44
IADD_C7
= 5,
//1 p015 1 7 (add)
45
IXOR_C7
= 6,
//1 p015 1 7 (xor)
46
IADD_C8
= 7,
//1+0 p015 1 7+1 (add+nop)
47
IXOR_C8
= 8,
//1+0 p015 1 7+1 (xor+nop)
48
IADD_C9
= 9,
//1+0 p015 1 7+2 (add+nop)
49
IXOR_C9
= 10,
//1+0 p015 1 7+2 (xor+nop)
50
IMULH_R
= 11,
//1+2+1 0+(p1,p5)+0 3 3+3+3 (mov+mul+mov)
51
ISMULH_R
= 12,
//1+2+1 0+(p1,p5)+0 3 3+3+3 (mov+imul+mov)
52
IMUL_RCP
= 13,
//1+1 p015+p1 4 10+4 (mov+imul)
53
54
COUNT
= 14,
55
INVALID
= -1
56
};
57
58
void
generateSuperscalar
(SuperscalarProgram&
prog
, Blake2Generator& gen);
59
void
executeSuperscalar
(
uint64_t
(&r)[8], SuperscalarProgram&
prog
, std::vector<uint64_t> *reciprocals =
nullptr
);
60
}
blake2_generator.hpp
prog
static char * prog
Definition
mdb_load.c:33
randomx
Definition
allocator.cpp:35
randomx::executeSuperscalar
void executeSuperscalar(int_reg_t(&r)[8], SuperscalarProgram &prog, std::vector< uint64_t > *reciprocals)
Definition
superscalar.cpp:856
randomx::SuperscalarInstructionType
SuperscalarInstructionType
Definition
superscalar.hpp:38
randomx::SuperscalarInstructionType::IADD_C8
@ IADD_C8
Definition
superscalar.hpp:46
randomx::SuperscalarInstructionType::IROR_C
@ IROR_C
Definition
superscalar.hpp:43
randomx::SuperscalarInstructionType::IADD_C7
@ IADD_C7
Definition
superscalar.hpp:44
randomx::SuperscalarInstructionType::COUNT
@ COUNT
Definition
superscalar.hpp:54
randomx::SuperscalarInstructionType::IADD_C9
@ IADD_C9
Definition
superscalar.hpp:48
randomx::SuperscalarInstructionType::IXOR_C9
@ IXOR_C9
Definition
superscalar.hpp:49
randomx::SuperscalarInstructionType::IXOR_C8
@ IXOR_C8
Definition
superscalar.hpp:47
randomx::SuperscalarInstructionType::IXOR_C7
@ IXOR_C7
Definition
superscalar.hpp:45
randomx::SuperscalarInstructionType::INVALID
@ INVALID
Definition
superscalar.hpp:55
randomx::generateSuperscalar
void generateSuperscalar(SuperscalarProgram &prog, Blake2Generator &gen)
Definition
superscalar.cpp:653
randomx::InstructionType::IMULH_R
@ IMULH_R
Definition
instruction.hpp:49
randomx::InstructionType::IXOR_R
@ IXOR_R
Definition
instruction.hpp:55
randomx::InstructionType::IMUL_R
@ IMUL_R
Definition
instruction.hpp:47
randomx::InstructionType::IADD_RS
@ IADD_RS
Definition
instruction.hpp:43
randomx::InstructionType::ISUB_R
@ ISUB_R
Definition
instruction.hpp:45
randomx::InstructionType::IMUL_RCP
@ IMUL_RCP
Definition
instruction.hpp:53
randomx::InstructionType::ISMULH_R
@ ISMULH_R
Definition
instruction.hpp:51
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:136
superscalar_program.hpp
Generated on
for Monero by
1.17.0