git.lucas.co / go_mono
git clone https://git.lucas.co/go_mono.git

commitd6a02ce849c95fa57d9927fab7b6d9071876dfe0
parent7e034cad64
authorNigel Tao <nigeltao@golang.org>
date2019-07-03 17:13
image/vector: add runtime check for SSE4.1

The PSHUFB instruction is also used by the floating-point
implementation, not just the fixed-point one.

Fixes golang/go#32835

Change-Id: I21f204319b28b664c862a7e3d938ba9366c74116
Reviewed-on: https://go-review.googlesource.com/c/image/+/184898
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

 vector/acc_amd64.go | 7 ++++---
 vector/acc_other.go | 6 ++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/vector/acc_amd64.go b/vector/acc_amd64.go
index cf535fc..827ee65 100644
--- a/vector/acc_amd64.go
+++ b/vector/acc_amd64.go
@@ -10,9 +10,10 @@ package vector
 
 func haveSSE4_1() bool
 
-var haveFixedAccumulateSIMD = haveSSE4_1()
-
-const haveFloatingAccumulateSIMD = true
+var (
+	haveFixedAccumulateSIMD    = haveSSE4_1()
+	haveFloatingAccumulateSIMD = haveSSE4_1()
+)
 
 //go:noescape
 func fixedAccumulateOpOverSIMD(dst []uint8, src []uint32)
diff --git a/vector/acc_other.go b/vector/acc_other.go
index c98d20b..dc0ab98 100644
--- a/vector/acc_other.go
+++ b/vector/acc_other.go
@@ -6,8 +6,10 @@
 
 package vector
 
-const haveFixedAccumulateSIMD = false
-const haveFloatingAccumulateSIMD = false
+const (
+	haveFixedAccumulateSIMD    = false
+	haveFloatingAccumulateSIMD = false
+)
 
 func fixedAccumulateOpOverSIMD(dst []uint8, src []uint32)     {}
 func fixedAccumulateOpSrcSIMD(dst []uint8, src []uint32)      {}