Scratchpad -> 2 MiB New scratchpad initialization New dataset initializationfeature/branches
parent
20eb549725
commit
1ee94bef2a
@ -0,0 +1,87 @@
|
||||
mov rax, 1613783669344650115
|
||||
add rax, rcx
|
||||
mul rax
|
||||
sub rax, rdx ;# 1
|
||||
mul rax
|
||||
sub rax, rdx ;# 2
|
||||
mul rax
|
||||
sub rax, rdx ;# 3
|
||||
mul rax
|
||||
sub rax, rdx ;# 4
|
||||
mul rax
|
||||
sub rax, rdx ;# 5
|
||||
mul rax
|
||||
sub rax, rdx ;# 6
|
||||
mul rax
|
||||
sub rax, rdx ;# 7
|
||||
mul rax
|
||||
sub rax, rdx ;# 8
|
||||
mul rax
|
||||
sub rax, rdx ;# 9
|
||||
mul rax
|
||||
sub rax, rdx ;# 10
|
||||
mul rax
|
||||
sub rax, rdx ;# 11
|
||||
mul rax
|
||||
sub rax, rdx ;# 12
|
||||
mul rax
|
||||
sub rax, rdx ;# 13
|
||||
mul rax
|
||||
sub rax, rdx ;# 14
|
||||
mul rax
|
||||
sub rax, rdx ;# 15
|
||||
mul rax
|
||||
sub rax, rdx ;# 16
|
||||
mul rax
|
||||
sub rax, rdx ;# 17
|
||||
mul rax
|
||||
sub rax, rdx ;# 18
|
||||
mul rax
|
||||
sub rax, rdx ;# 19
|
||||
mul rax
|
||||
sub rax, rdx ;# 20
|
||||
mul rax
|
||||
sub rax, rdx ;# 21
|
||||
mul rax
|
||||
sub rax, rdx ;# 22
|
||||
mul rax
|
||||
sub rax, rdx ;# 23
|
||||
mul rax
|
||||
sub rax, rdx ;# 24
|
||||
mul rax
|
||||
sub rax, rdx ;# 25
|
||||
mul rax
|
||||
sub rax, rdx ;# 26
|
||||
mul rax
|
||||
sub rax, rdx ;# 27
|
||||
mul rax
|
||||
sub rax, rdx ;# 28
|
||||
mul rax
|
||||
sub rax, rdx ;# 29
|
||||
mul rax
|
||||
sub rax, rdx ;# 30
|
||||
mul rax
|
||||
sub rax, rdx ;# 31
|
||||
mul rax
|
||||
sub rax, rdx ;# 32
|
||||
mul rax
|
||||
sub rax, rdx ;# 33
|
||||
mul rax
|
||||
sub rax, rdx ;# 34
|
||||
mul rax
|
||||
sub rax, rdx ;# 35
|
||||
mul rax
|
||||
sub rax, rdx ;# 36
|
||||
mul rax
|
||||
sub rax, rdx ;# 37
|
||||
mul rax
|
||||
sub rax, rdx ;# 38
|
||||
mul rax
|
||||
sub rax, rdx ;# 39
|
||||
mul rax
|
||||
sub rax, rdx ;# 40
|
||||
mul rax
|
||||
sub rax, rdx ;# 41
|
||||
mul rax
|
||||
sub rax, rdx ;# 42
|
||||
ret
|
@ -0,0 +1,17 @@
|
||||
.intel_syntax noprefix
|
||||
#if defined(__APPLE__)
|
||||
.text
|
||||
#else
|
||||
.section .text
|
||||
#endif
|
||||
#if defined(__WIN32__) || defined(__APPLE__)
|
||||
#define DECL(x) _##x
|
||||
#else
|
||||
#define DECL(x) x
|
||||
#endif
|
||||
|
||||
.global DECL(squareHash)
|
||||
|
||||
DECL(squareHash):
|
||||
mov rcx, rsi
|
||||
#include "asm/squareHash.inc"
|
@ -0,0 +1,9 @@
|
||||
PUBLIC squareHash
|
||||
|
||||
.code
|
||||
|
||||
squareHash PROC
|
||||
include asm/squareHash.inc
|
||||
squareHash ENDP
|
||||
|
||||
END
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (c) 2019 tevador
|
||||
|
||||
This file is part of RandomX.
|
||||
|
||||
RandomX is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
RandomX is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with RandomX. If not, see<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if !defined(_M_X64) && !defined(__x86_64__)
|
||||
|
||||
typedef struct {
|
||||
uint64_t lo;
|
||||
uint64_t hi;
|
||||
} uint128_t;
|
||||
|
||||
#define LO(x) ((x)&0xffffffff)
|
||||
#define HI(x) ((x)>>32)
|
||||
static inline uint128_t square128(uint64_t x) {
|
||||
uint64_t xh = HI(x), xl = LO(x);
|
||||
uint64_t xll = xl * xl;
|
||||
uint64_t xlh = xl * xh;
|
||||
uint64_t xhh = xh * xh;
|
||||
uint64_t m1 = 2 * LO(xlh) + HI(xll);
|
||||
uint64_t m2 = 2 * HI(xlh) + LO(xhh) + HI(m1);
|
||||
uint64_t m3 = HI(xhh) + HI(m2);
|
||||
|
||||
uint128_t x2;
|
||||
|
||||
x2.lo = (m1 << 32) + LO(xll);
|
||||
x2.hi = (m3 << 32) + LO(m2);
|
||||
|
||||
return x2;
|
||||
}
|
||||
#undef LO(x)
|
||||
#undef HI(x)
|
||||
|
||||
inline uint64_t squareHash(uint64_t x) {
|
||||
x += 1613783669344650115;
|
||||
for (int i = 0; i < 42; ++i) {
|
||||
uint128_t x2 = square128(x);
|
||||
x = x2.lo - x2.hi;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint64_t squareHash(uint64_t);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in new issue