image/vector: simplify haveAccumulateSIMD fields
Change-Id: I66c1adbee1728ef69ae94eac62285a76deaa8f04
Reviewed-on: https://go-review.googlesource.com/c/image/+/184899
Reviewed-by: David Symonds <dsymonds@golang.org>
diff --git a/vector/acc_amd64.go b/vector/acc_amd64.go
index 827ee65..c0d6ad9 100644
--- a/vector/acc_amd64.go
+++ b/vector/acc_amd64.go
@@ -10,10 +10,7 @@
func haveSSE4_1() bool
-var (
- haveFixedAccumulateSIMD = haveSSE4_1()
- haveFloatingAccumulateSIMD = haveSSE4_1()
-)
+var haveAccumulateSIMD = haveSSE4_1()
//go:noescape
func fixedAccumulateOpOverSIMD(dst []uint8, src []uint32)
diff --git a/vector/acc_other.go b/vector/acc_other.go
index dc0ab98..d00bed8 100644
--- a/vector/acc_other.go
+++ b/vector/acc_other.go
@@ -6,10 +6,7 @@
package vector
-const (
- haveFixedAccumulateSIMD = false
- haveFloatingAccumulateSIMD = false
-)
+const haveAccumulateSIMD = false
func fixedAccumulateOpOverSIMD(dst []uint8, src []uint32) {}
func fixedAccumulateOpSrcSIMD(dst []uint8, src []uint32) {}
diff --git a/vector/acc_test.go b/vector/acc_test.go
index 16815cf..898bd8a 100644
--- a/vector/acc_test.go
+++ b/vector/acc_test.go
@@ -40,7 +40,7 @@
// TestXxxSIMDUnaligned tests that unaligned SIMD loads/stores don't crash.
func TestFixedAccumulateSIMDUnaligned(t *testing.T) {
- if !haveFixedAccumulateSIMD {
+ if !haveAccumulateSIMD {
t.Skip("No SIMD implemention")
}
@@ -54,7 +54,7 @@
}
func TestFloatingAccumulateSIMDUnaligned(t *testing.T) {
- if !haveFloatingAccumulateSIMD {
+ if !haveAccumulateSIMD {
t.Skip("No SIMD implemention")
}
@@ -71,7 +71,7 @@
// end of the dst buffer.
func TestFixedAccumulateSIMDShortDst(t *testing.T) {
- if !haveFixedAccumulateSIMD {
+ if !haveAccumulateSIMD {
t.Skip("No SIMD implemention")
}
@@ -95,7 +95,7 @@
}
func TestFloatingAccumulateSIMDShortDst(t *testing.T) {
- if !haveFloatingAccumulateSIMD {
+ if !haveAccumulateSIMD {
t.Skip("No SIMD implemention")
}
@@ -137,12 +137,12 @@
maxN := 0
switch in := in.(type) {
case []uint32:
- if simd && !haveFixedAccumulateSIMD {
+ if simd && !haveAccumulateSIMD {
continue
}
maxN = len(in)
case []float32:
- if simd && !haveFloatingAccumulateSIMD {
+ if simd && !haveAccumulateSIMD {
continue
}
maxN = len(in)
@@ -385,7 +385,7 @@
switch in := in.(type) {
case []uint32:
- if simd && !haveFixedAccumulateSIMD {
+ if simd && !haveAccumulateSIMD {
b.Skip("No SIMD implemention")
}
@@ -415,7 +415,7 @@
}
case []float32:
- if simd && !haveFloatingAccumulateSIMD {
+ if simd && !haveAccumulateSIMD {
b.Skip("No SIMD implemention")
}
diff --git a/vector/vector.go b/vector/vector.go
index 852a4f8..7b8ca98 100644
--- a/vector/vector.go
+++ b/vector/vector.go
@@ -306,13 +306,13 @@
} else {
z.bufU32 = z.bufU32[:n]
}
- if haveFloatingAccumulateSIMD {
+ if haveAccumulateSIMD {
floatingAccumulateMaskSIMD(z.bufU32, z.bufF32)
} else {
floatingAccumulateMask(z.bufU32, z.bufF32)
}
} else {
- if haveFixedAccumulateSIMD {
+ if haveAccumulateSIMD {
fixedAccumulateMaskSIMD(z.bufU32)
} else {
fixedAccumulateMask(z.bufU32)
@@ -326,13 +326,13 @@
// We bypass the z.accumulateMask step and convert straight from
// z.bufF32 or z.bufU32 to dst.Pix.
if z.useFloatingPointMath {
- if haveFloatingAccumulateSIMD {
+ if haveAccumulateSIMD {
floatingAccumulateOpOverSIMD(dst.Pix, z.bufF32)
} else {
floatingAccumulateOpOver(dst.Pix, z.bufF32)
}
} else {
- if haveFixedAccumulateSIMD {
+ if haveAccumulateSIMD {
fixedAccumulateOpOverSIMD(dst.Pix, z.bufU32)
} else {
fixedAccumulateOpOver(dst.Pix, z.bufU32)
@@ -362,13 +362,13 @@
// We bypass the z.accumulateMask step and convert straight from
// z.bufF32 or z.bufU32 to dst.Pix.
if z.useFloatingPointMath {
- if haveFloatingAccumulateSIMD {
+ if haveAccumulateSIMD {
floatingAccumulateOpSrcSIMD(dst.Pix, z.bufF32)
} else {
floatingAccumulateOpSrc(dst.Pix, z.bufF32)
}
} else {
- if haveFixedAccumulateSIMD {
+ if haveAccumulateSIMD {
fixedAccumulateOpSrcSIMD(dst.Pix, z.bufU32)
} else {
fixedAccumulateOpSrc(dst.Pix, z.bufU32)