aboutsummaryrefslogtreecommitdiff
path: root/src/liblink
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2014-12-10 14:20:17 -0800
committerKeith Randall <khr@golang.org>2014-12-11 05:23:00 +0000
commit7a4a64e8f3dc14717695e53c7560992789f8bc9e (patch)
tree2cb7a680b5280f9b698f892f7da3a3a135b095cc /src/liblink
parent69f24cfa14ba982e0118e240021f0e91f8efe937 (diff)
downloadgo-7a4a64e8f3dc14717695e53c7560992789f8bc9e.tar.xz
runtime: faster aeshash implementation
The aesenc instruction has high latency. For hashing large objects, hash several streams in parallel. benchmark old ns/op new ns/op delta BenchmarkHash5 7.02 7.45 +6.13% BenchmarkHash16 6.53 6.94 +6.28% BenchmarkHash32 8.38 8.26 -1.43% BenchmarkHash64 12.6 12.0 -4.76% BenchmarkHash1024 247 62.9 -74.53% BenchmarkHash65536 17335 2966 -82.89% BenchmarkHashInt32Speed 14.7 14.9 +1.36% BenchmarkHashInt64Speed 14.6 14.9 +2.05% BenchmarkHashBytesSpeed 35.4 28.6 -19.21% BenchmarkHashStringSpeed 22.0 20.4 -7.27% BenchmarkHashStringArraySpeed 65.8 56.3 -14.44% Change-Id: Ia8ba03063acc64a9066b8ab2d79f2c9aaac1770f Reviewed-on: https://go-review.googlesource.com/1330 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/liblink')
-rw-r--r--src/liblink/asm8.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/liblink/asm8.c b/src/liblink/asm8.c
index b6627d5fd7..24510cc6fc 100644
--- a/src/liblink/asm8.c
+++ b/src/liblink/asm8.c
@@ -611,6 +611,12 @@ static uchar ymshufb[] =
0
};
+static uchar yxshuf[] =
+{
+ Yxm, Yxr, Zibm_r, 2,
+ 0
+};
+
static Optab optab[] =
/* as, ytab, andproto, opcode */
{
@@ -1141,6 +1147,10 @@ static Optab optab[] =
{ AUNPCKLPS, yxm, Pm, {0x14} },
{ AXORPD, yxm, Pe, {0x57} },
{ AXORPS, yxm, Pm, {0x57} },
+ { APSHUFHW, yxshuf, Pf3, {0x70,(00)} },
+ { APSHUFL, yxshuf, Pq, {0x70,(00)} },
+ { APSHUFLW, yxshuf, Pf2, {0x70,(00)} },
+
{ AAESENC, yaes, Pq, {0x38,0xdc,(0)} },
{ APINSRD, yinsrd, Pq, {0x3a, 0x22, (00)} },