vector: using golang.org/x/sys/cpu for feature detection

Replace hand-rolled haveSSE4_1 CPUID assembly with
cpu.X86.HasSSE41 from golang.org/x/sys/cpu.

Change-Id: I6e848a312b68ed39568a7d977a966ac1d8890ecb
Reviewed-on: https://go-review.googlesource.com/c/image/+/799940
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
diff --git a/go.mod b/go.mod
index 10c0e5b..fc2afdd 100644
--- a/go.mod
+++ b/go.mod
@@ -2,4 +2,7 @@
 
 go 1.25.0
 
-require golang.org/x/text v0.40.0
+require (
+	golang.org/x/sys v0.47.0
+	golang.org/x/text v0.40.0
+)
diff --git a/go.sum b/go.sum
index 7ae431d..c9db60b 100644
--- a/go.sum
+++ b/go.sum
@@ -1,2 +1,4 @@
+golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
+golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
 golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs=
 golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY=
diff --git a/vector/acc_amd64.go b/vector/acc_amd64.go
index 5b148c5..baae552 100644
--- a/vector/acc_amd64.go
+++ b/vector/acc_amd64.go
@@ -6,9 +6,9 @@
 
 package vector
 
-func haveSSE4_1() bool
+import "golang.org/x/sys/cpu"
 
-var haveAccumulateSIMD = haveSSE4_1()
+var haveAccumulateSIMD = cpu.X86.HasSSE41
 
 //go:noescape
 func fixedAccumulateOpOverSIMD(dst []uint8, src []uint32)
diff --git a/vector/acc_amd64.s b/vector/acc_amd64.s
index fc6e7f8..f8fad93 100644
--- a/vector/acc_amd64.s
+++ b/vector/acc_amd64.s
@@ -49,15 +49,6 @@
 GLOBL fxAlmost65536<>(SB), (NOPTR+RODATA), $16
 GLOBL inverseFFFF<>(SB), (NOPTR+RODATA), $16
 
-// func haveSSE4_1() bool
-TEXT ·haveSSE4_1(SB), NOSPLIT, $0
-	MOVQ $1, AX
-	CPUID
-	SHRQ $19, CX
-	ANDQ $1, CX
-	MOVB CX, ret+0(FP)
-	RET
-
 // ----------------------------------------------------------------------------
 
 // func fixedAccumulateOpOverSIMD(dst []uint8, src []uint32)
diff --git a/vector/gen_acc_amd64.s.tmpl b/vector/gen_acc_amd64.s.tmpl
index 05ce25b..f1158f3 100644
--- a/vector/gen_acc_amd64.s.tmpl
+++ b/vector/gen_acc_amd64.s.tmpl
@@ -51,15 +51,6 @@
 GLOBL fxAlmost65536<>(SB), (NOPTR+RODATA), $16
 GLOBL inverseFFFF<>(SB), (NOPTR+RODATA), $16
 
-// func haveSSE4_1() bool
-TEXT ·haveSSE4_1(SB), NOSPLIT, $0
-	MOVQ $1, AX
-	CPUID
-	SHRQ $19, CX
-	ANDQ $1, CX
-	MOVB CX, ret+0(FP)
-	RET
-
 // ----------------------------------------------------------------------------
 
 // func {{.LongName}}SIMD({{.Args}})