aboutsummaryrefslogtreecommitdiff
path: root/src/simd
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2026-03-30 22:21:43 +0700
committerGopher Robot <gobot@golang.org>2026-03-30 21:19:14 -0700
commit1f8aff4386ca8be6ae9b9553205d113884c4a8ee (patch)
treebea61c2de69fd45a50f2b5cd5d2828112b49b5cd /src/simd
parentb526b2d49b39a116cf654551f7f65c965144b096 (diff)
downloadgo-1f8aff4386ca8be6ae9b9553205d113884c4a8ee.tar.xz
simd/archsimd: mark pa* unsafe helpers as nocheckptr
Despite the cast from smaller to bigger slice, the elements after the input slice length are not actually read. Thus they should have nocheckptr annotation to make checkptr happy. Fixes #78413 Change-Id: I3e27eab8a69b37bb11632b130a87e6625e06e8ac Reviewed-on: https://go-review.googlesource.com/c/go/+/761120 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/simd')
-rw-r--r--src/simd/archsimd/_gen/tmplgen/main.go2
-rw-r--r--src/simd/archsimd/unsafe_helpers.go60
2 files changed, 62 insertions, 0 deletions
diff --git a/src/simd/archsimd/_gen/tmplgen/main.go b/src/simd/archsimd/_gen/tmplgen/main.go
index da7eae9029..8a06060b44 100644
--- a/src/simd/archsimd/_gen/tmplgen/main.go
+++ b/src/simd/archsimd/_gen/tmplgen/main.go
@@ -794,6 +794,8 @@ var unsafePATemplate = templateOf("unsafe PA helper", `
// pa{{.VType}} returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func pa{{.VType}}(s []{{.Etype}}) *[{{.Count}}]{{.Etype}} {
return (*[{{.Count}}]{{.Etype}})(unsafe.Pointer(&s[0]))
}
diff --git a/src/simd/archsimd/unsafe_helpers.go b/src/simd/archsimd/unsafe_helpers.go
index 7b98053e70..17edc6e72b 100644
--- a/src/simd/archsimd/unsafe_helpers.go
+++ b/src/simd/archsimd/unsafe_helpers.go
@@ -9,6 +9,8 @@ import "unsafe"
// paInt8x16 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt8x16(s []int8) *[16]int8 {
return (*[16]int8)(unsafe.Pointer(&s[0]))
}
@@ -16,6 +18,8 @@ func paInt8x16(s []int8) *[16]int8 {
// paInt16x8 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt16x8(s []int16) *[8]int16 {
return (*[8]int16)(unsafe.Pointer(&s[0]))
}
@@ -23,6 +27,8 @@ func paInt16x8(s []int16) *[8]int16 {
// paInt32x4 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt32x4(s []int32) *[4]int32 {
return (*[4]int32)(unsafe.Pointer(&s[0]))
}
@@ -30,6 +36,8 @@ func paInt32x4(s []int32) *[4]int32 {
// paInt64x2 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt64x2(s []int64) *[2]int64 {
return (*[2]int64)(unsafe.Pointer(&s[0]))
}
@@ -37,6 +45,8 @@ func paInt64x2(s []int64) *[2]int64 {
// paUint8x16 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint8x16(s []uint8) *[16]uint8 {
return (*[16]uint8)(unsafe.Pointer(&s[0]))
}
@@ -44,6 +54,8 @@ func paUint8x16(s []uint8) *[16]uint8 {
// paUint16x8 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint16x8(s []uint16) *[8]uint16 {
return (*[8]uint16)(unsafe.Pointer(&s[0]))
}
@@ -51,6 +63,8 @@ func paUint16x8(s []uint16) *[8]uint16 {
// paUint32x4 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint32x4(s []uint32) *[4]uint32 {
return (*[4]uint32)(unsafe.Pointer(&s[0]))
}
@@ -58,6 +72,8 @@ func paUint32x4(s []uint32) *[4]uint32 {
// paUint64x2 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint64x2(s []uint64) *[2]uint64 {
return (*[2]uint64)(unsafe.Pointer(&s[0]))
}
@@ -65,6 +81,8 @@ func paUint64x2(s []uint64) *[2]uint64 {
// paFloat32x4 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paFloat32x4(s []float32) *[4]float32 {
return (*[4]float32)(unsafe.Pointer(&s[0]))
}
@@ -72,6 +90,8 @@ func paFloat32x4(s []float32) *[4]float32 {
// paFloat64x2 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paFloat64x2(s []float64) *[2]float64 {
return (*[2]float64)(unsafe.Pointer(&s[0]))
}
@@ -79,6 +99,8 @@ func paFloat64x2(s []float64) *[2]float64 {
// paInt8x32 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt8x32(s []int8) *[32]int8 {
return (*[32]int8)(unsafe.Pointer(&s[0]))
}
@@ -86,6 +108,8 @@ func paInt8x32(s []int8) *[32]int8 {
// paInt16x16 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt16x16(s []int16) *[16]int16 {
return (*[16]int16)(unsafe.Pointer(&s[0]))
}
@@ -93,6 +117,8 @@ func paInt16x16(s []int16) *[16]int16 {
// paInt32x8 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt32x8(s []int32) *[8]int32 {
return (*[8]int32)(unsafe.Pointer(&s[0]))
}
@@ -100,6 +126,8 @@ func paInt32x8(s []int32) *[8]int32 {
// paInt64x4 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt64x4(s []int64) *[4]int64 {
return (*[4]int64)(unsafe.Pointer(&s[0]))
}
@@ -107,6 +135,8 @@ func paInt64x4(s []int64) *[4]int64 {
// paUint8x32 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint8x32(s []uint8) *[32]uint8 {
return (*[32]uint8)(unsafe.Pointer(&s[0]))
}
@@ -114,6 +144,8 @@ func paUint8x32(s []uint8) *[32]uint8 {
// paUint16x16 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint16x16(s []uint16) *[16]uint16 {
return (*[16]uint16)(unsafe.Pointer(&s[0]))
}
@@ -121,6 +153,8 @@ func paUint16x16(s []uint16) *[16]uint16 {
// paUint32x8 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint32x8(s []uint32) *[8]uint32 {
return (*[8]uint32)(unsafe.Pointer(&s[0]))
}
@@ -128,6 +162,8 @@ func paUint32x8(s []uint32) *[8]uint32 {
// paUint64x4 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint64x4(s []uint64) *[4]uint64 {
return (*[4]uint64)(unsafe.Pointer(&s[0]))
}
@@ -135,6 +171,8 @@ func paUint64x4(s []uint64) *[4]uint64 {
// paFloat32x8 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paFloat32x8(s []float32) *[8]float32 {
return (*[8]float32)(unsafe.Pointer(&s[0]))
}
@@ -142,6 +180,8 @@ func paFloat32x8(s []float32) *[8]float32 {
// paFloat64x4 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paFloat64x4(s []float64) *[4]float64 {
return (*[4]float64)(unsafe.Pointer(&s[0]))
}
@@ -149,6 +189,8 @@ func paFloat64x4(s []float64) *[4]float64 {
// paInt8x64 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt8x64(s []int8) *[64]int8 {
return (*[64]int8)(unsafe.Pointer(&s[0]))
}
@@ -156,6 +198,8 @@ func paInt8x64(s []int8) *[64]int8 {
// paInt16x32 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt16x32(s []int16) *[32]int16 {
return (*[32]int16)(unsafe.Pointer(&s[0]))
}
@@ -163,6 +207,8 @@ func paInt16x32(s []int16) *[32]int16 {
// paInt32x16 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt32x16(s []int32) *[16]int32 {
return (*[16]int32)(unsafe.Pointer(&s[0]))
}
@@ -170,6 +216,8 @@ func paInt32x16(s []int32) *[16]int32 {
// paInt64x8 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paInt64x8(s []int64) *[8]int64 {
return (*[8]int64)(unsafe.Pointer(&s[0]))
}
@@ -177,6 +225,8 @@ func paInt64x8(s []int64) *[8]int64 {
// paUint8x64 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint8x64(s []uint8) *[64]uint8 {
return (*[64]uint8)(unsafe.Pointer(&s[0]))
}
@@ -184,6 +234,8 @@ func paUint8x64(s []uint8) *[64]uint8 {
// paUint16x32 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint16x32(s []uint16) *[32]uint16 {
return (*[32]uint16)(unsafe.Pointer(&s[0]))
}
@@ -191,6 +243,8 @@ func paUint16x32(s []uint16) *[32]uint16 {
// paUint32x16 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint32x16(s []uint32) *[16]uint32 {
return (*[16]uint32)(unsafe.Pointer(&s[0]))
}
@@ -198,6 +252,8 @@ func paUint32x16(s []uint32) *[16]uint32 {
// paUint64x8 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paUint64x8(s []uint64) *[8]uint64 {
return (*[8]uint64)(unsafe.Pointer(&s[0]))
}
@@ -205,6 +261,8 @@ func paUint64x8(s []uint64) *[8]uint64 {
// paFloat32x16 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paFloat32x16(s []float32) *[16]float32 {
return (*[16]float32)(unsafe.Pointer(&s[0]))
}
@@ -212,6 +270,8 @@ func paFloat32x16(s []float32) *[16]float32 {
// paFloat64x8 returns a type-unsafe pointer to array that can
// only be used with partial load/store operations that only
// access the known-safe portions of the array.
+//
+//go:nocheckptr
func paFloat64x8(s []float64) *[8]float64 {
return (*[8]float64)(unsafe.Pointer(&s[0]))
}