Monero
Loading...
Searching...
No Matches
superscalar.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2018-2019, tevador <tevador@gmail.com>
3
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, 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
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28
29#pragma once
30
31#include <cstdint>
32#include <vector>
34#include "blake2_generator.hpp"
35
36namespace 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,
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}
static char * prog
Definition mdb_load.c:33
Definition allocator.cpp:35
void executeSuperscalar(int_reg_t(&r)[8], SuperscalarProgram &prog, std::vector< uint64_t > *reciprocals)
Definition superscalar.cpp:856
SuperscalarInstructionType
Definition superscalar.hpp:38
@ IADD_C8
Definition superscalar.hpp:46
@ IROR_C
Definition superscalar.hpp:43
@ IADD_C7
Definition superscalar.hpp:44
@ COUNT
Definition superscalar.hpp:54
@ IADD_C9
Definition superscalar.hpp:48
@ IXOR_C9
Definition superscalar.hpp:49
@ IXOR_C8
Definition superscalar.hpp:47
@ IXOR_C7
Definition superscalar.hpp:45
@ INVALID
Definition superscalar.hpp:55
void generateSuperscalar(SuperscalarProgram &prog, Blake2Generator &gen)
Definition superscalar.cpp:653
@ IMULH_R
Definition instruction.hpp:49
@ IXOR_R
Definition instruction.hpp:55
@ IMUL_R
Definition instruction.hpp:47
@ IADD_RS
Definition instruction.hpp:43
@ ISUB_R
Definition instruction.hpp:45
@ IMUL_RCP
Definition instruction.hpp:53
@ ISMULH_R
Definition instruction.hpp:51
unsigned __int64 uint64_t
Definition stdint.h:136