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>
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 @@
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) {}