Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix R15 asm error when build in dynamic link mode #55

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions xxhash_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// R12 tmp
// R13 prime1v
// R14 prime2v
// R15 prime4v
// -R15 prime4v- BUG: dynamic link - when dynamic linking, R15 is clobbered by a global variable access and is used here

// round reads from and advances the buffer pointer in CX.
// It assumes that R13 has prime1v and R14 has prime2v.
Expand All @@ -29,21 +29,21 @@
IMULQ R13, r

// mergeRound applies a merge round on the two registers acc and val.
// It assumes that R13 has prime1v, R14 has prime2v, and R15 has prime4v.
// It assumes that R13 has prime1v, R14 has prime2v.
#define mergeRound(acc, val) \
IMULQ R14, val \
ROLQ $31, val \
IMULQ R13, val \
XORQ val, acc \
IMULQ R13, acc \
ADDQ R15, acc
ADDQ ·prime4v(SB), acc

// func Sum64(b []byte) uint64
TEXT ·Sum64(SB), NOSPLIT, $0-32
// Load fixed primes.
MOVQ ·prime1v(SB), R13
MOVQ ·prime2v(SB), R14
MOVQ ·prime4v(SB), R15
// MOVQ ·prime4v(SB), R15

// Load slice.
MOVQ b_base+0(FP), CX
Expand Down Expand Up @@ -117,7 +117,7 @@ wordLoop:
XORQ R8, AX
ROLQ $27, AX
IMULQ R13, AX
ADDQ R15, AX
ADDQ ·prime4v(SB), AX

CMPQ CX, BX
JLE wordLoop
Expand Down