Commit 677ead3b by eric fang Committed by Ian Lance Taylor

runtime: use 64 bits of hash seed on arm64

This is the same issue as #33960, but on gofrontend.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/220297
parent d43919bf
89fbf55a409d37ae898e5c4ea4250035f86bed1b 0fe7a277c5d22265a73a4d216bd5d81799634453
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -596,7 +596,7 @@ uintptr aeshashbody(void* p, uintptr seed, uintptr size, Slice aeskeysched) { ...@@ -596,7 +596,7 @@ uintptr aeshashbody(void* p, uintptr seed, uintptr size, Slice aeskeysched) {
uintptr aeshashbody(void* p, uintptr seed, uintptr size, Slice aeskeysched) { uintptr aeshashbody(void* p, uintptr seed, uintptr size, Slice aeskeysched) {
uint8x16_t *pseed; uint8x16_t *pseed;
uint32x4_t vinit32; uint64x2_t vinit64;
uint8x16_t vinit; uint8x16_t vinit;
uint8x16_t vseed, vseed2, vseed3, vseed4; uint8x16_t vseed, vseed2, vseed3, vseed4;
uint8x16_t vseed5, vseed6, vseed7, vseed8; uint8x16_t vseed5, vseed6, vseed7, vseed8;
...@@ -610,10 +610,10 @@ uintptr aeshashbody(void* p, uintptr seed, uintptr size, Slice aeskeysched) { ...@@ -610,10 +610,10 @@ uintptr aeshashbody(void* p, uintptr seed, uintptr size, Slice aeskeysched) {
pseed = (uint8x16_t*)(aeskeysched.__values); pseed = (uint8x16_t*)(aeskeysched.__values);
// Combined hash seed and length. // Combined hash seed and length.
vinit32 = vdupq_n_u32(0); vinit64 = vdupq_n_u64(0);
vinit32[0] = (uint32)seed; vinit64[0] = (uint64)seed;
vinit32[1] = (uint32)size; vinit64[1] = (uint64)size;
vinit = vreinterpretq_u8_u32(vinit32); vinit = vreinterpretq_u8_u64(vinit64);
// Mix in per-process seed. // Mix in per-process seed.
vseed = vaeseq_u8(*pseed, vinit); vseed = vaeseq_u8(*pseed, vinit);
...@@ -626,7 +626,7 @@ uintptr aeshashbody(void* p, uintptr seed, uintptr size, Slice aeskeysched) { ...@@ -626,7 +626,7 @@ uintptr aeshashbody(void* p, uintptr seed, uintptr size, Slice aeskeysched) {
// Return 64 bits of scrambled input seed. // Return 64 bits of scrambled input seed.
return vreinterpretq_u64_u8(vseed)[0]; return vreinterpretq_u64_u8(vseed)[0];
} else if (size < 16) { } else if (size < 16) {
vval = vreinterpretq_u8_u32(vdupq_n_u32(0)); vval = vreinterpretq_u8_u64(vdupq_n_u64(0));
if ((size & 8) != 0) { if ((size & 8) != 0) {
vval = vreinterpretq_u8_u64(vld1q_lane_u64((uint64_t*)(p), vreinterpretq_u64_u8(vval), 0)); vval = vreinterpretq_u8_u64(vld1q_lane_u64((uint64_t*)(p), vreinterpretq_u64_u8(vval), 0));
p = (void*)((uint64_t*)(p) + 1); p = (void*)((uint64_t*)(p) + 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment