Plans for ARM64 SVE2 MATCH instruction support?

130 views
Skip to first unread message

Corentin Chary

unread,
Jan 13, 2026, 1:08:13 PM (8 days ago) Jan 13
to golang-dev
  Hi,

  I've been looking into optimizing string/byte operations on ARM64 and came across
  the MATCH instruction introduced in SVE2. This instruction can efficiently find
  matching bytes in vectors, which could potentially benefit operations like:

  - bytes.IndexByte / strings.IndexByte
  - bytes.Count
  - bytes.Contains
  - Other byte-scanning operations in internal/bytealg

  Current status:
  - The golang.org/x/sys/cpu package already detects HasSVE2
  - However, the ARM64 assembler (cmd/internal/obj/arm64) doesn't include any
    SVE/SVE2 instructions

  Questions:
  1. Are there any plans to add SVE2 instruction support to the assembler?
  2. If so, is this something that would be considered for the standard library's
     bytealg implementations?
  3. Are there any technical or strategic reasons for not pursuing SVE/SVE2 support?

  I understand SVE/SVE2 adoption is still limited compared to NEON, but with newer
  ARM processors (like AWS Graviton3+, Ampere Altra, Apple M-series) supporting it,
  it might be worth considering for future optimization work.

  Would appreciate any insights on whether this is on the roadmap or if there are
  proposals I should be aware of.

  Thanks,

Keith Randall

unread,
Jan 13, 2026, 1:23:39 PM (8 days ago) Jan 13
to Corentin Chary, golang-dev
There has been work to update the arm64 assembler, see https://github.com/golang/go/issues/44734. It looks like that effort has stalled.

You can always use word directives in a pinch (e.g. src/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s).

We would consider something that uses sve2 instructions for bytealg and friends. It would need to be gated behind a hardware feature check of some sort. I don't know of anyone working on this currently.

I don't know much about sve2, so there may be additional considerations I'm not aware of. (e.g. downclocking penalties for avx512 on Intel).

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/golang-dev/7d7d0ca5-0151-433e-96a2-ec8a7cec0cfdn%40googlegroups.com.

Cherry Mui

unread,
Jan 14, 2026, 3:54:32 PM (7 days ago) Jan 14
to golang-dev
As Keith mentioned, the previous effort in adding SVE support to the assembler has stalled. We plan to resume that effort in 2026, hopefully in Go 1.27.

For an instruction or two, using a WORD directive is fine in the mean time.

Thanks,
Cherry
Reply all
Reply to author
Forward
0 new messages