[go/dev.simd] [dev.simd] simd/archsimd/_gen/cmd/specls: command to list spec API

5 views
Skip to first unread message

Austin Clements (Gerrit)

unread,
Jul 9, 2026, 2:41:08 PMJul 9
to David Chase, Junyang Shao, goph...@pubsubhelper.golang.org, Cherry Mui, Austin Clements, golang-co...@googlegroups.com
Attention needed from David Chase and Junyang Shao

Austin Clements has uploaded the change for review

Austin Clements would like David Chase and Junyang Shao to review this change.

Commit message

[dev.simd] simd/archsimd/_gen/cmd/specls: command to list spec API

This is a simple command-line tool to inspect and debug API generation
from the SIMD spec package.
Change-Id: I6f480d76995f10bb9bbc264755c2509afcaacc9d

Change diff

diff --git a/src/simd/archsimd/_gen/cmd/specls/main.go b/src/simd/archsimd/_gen/cmd/specls/main.go
new file mode 100644
index 0000000..e143fb8
--- /dev/null
+++ b/src/simd/archsimd/_gen/cmd/specls/main.go
@@ -0,0 +1,80 @@
+// Copyright 2026 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// specls prints the expanded API from the SIMD spec package.
+package main
+
+import (
+ "_gen/specgen"
+ "flag"
+ "fmt"
+ "go/ast"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "regexp"
+ "strings"
+)
+
+var (
+ flagFilter = flag.String("f", "", "only process spec functions matching `regexp`")
+ flagTrace = flag.Bool("trace", false, "trace solver steps")
+)
+
+func main() {
+ flag.Usage = func() {
+ w := flag.CommandLine.Output()
+ fmt.Fprintf(w, "usage: specls [flags] [spec dir]\n")
+ flag.CommandLine.PrintDefaults()
+ }
+
+ flag.Parse()
+ if flag.NArg() > 1 {
+ flag.Usage()
+ os.Exit(1)
+ }
+ var specDir string
+ if flag.NArg() == 1 {
+ specDir = flag.Arg(0)
+ } else {
+ goroot, err := goEnvGoroot()
+ if err != nil {
+ log.Fatalf("could not find GOROOT: %s", err)
+ }
+ specDir = filepath.Join(goroot, "src/simd/archsimd/_gen/spec")
+ }
+
+ var opts specgen.LoadOptions
+ if *flagFilter != "" {
+ re, err := regexp.Compile(*flagFilter)
+ if err != nil {
+ log.Fatal("invalid -f: ", err)
+ }
+ opts.Filter = func(fd *ast.FuncDecl) bool {
+ return re.MatchString(fd.Name.Name)
+ }
+ }
+ if *flagTrace {
+ opts.Trace = os.Stderr
+ }
+
+ funcs, err := specgen.Load(specDir, &opts)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "%s\n", err.Error())
+ }
+
+ for _, fn := range funcs {
+ fmt.Print(fn.Decl())
+ fmt.Println()
+ }
+}
+
+func goEnvGoroot() (string, error) {
+ out, err := exec.Command("go", "env", "GOROOT").Output()
+ if err != nil {
+ return "", err
+ }
+ return strings.TrimSpace(string(out)), nil
+}

Change information

Files:
  • A src/simd/archsimd/_gen/cmd/specls/main.go
Change size: M
Delta: 1 file changed, 80 insertions(+), 0 deletions(-)
Open in Gerrit

Related details

Attention is currently required from:
  • David Chase
  • Junyang Shao
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: dev.simd
Gerrit-Change-Id: I6f480d76995f10bb9bbc264755c2509afcaacc9d
Gerrit-Change-Number: 798847
Gerrit-PatchSet: 1
Gerrit-Owner: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
Gerrit-CC: Cherry Mui <cher...@google.com>
Gerrit-Attention: David Chase <drc...@google.com>
Gerrit-Attention: Junyang Shao <shaoj...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Austin Clements (Gerrit)

unread,
Jul 10, 2026, 8:39:45 AMJul 10
to Austin Clements, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from David Chase and Junyang Shao

Austin Clements uploaded new patchset

Austin Clements uploaded patch set #2 to this change.
Following approvals got outdated and were removed:
Open in Gerrit

Related details

Attention is currently required from:
  • David Chase
  • Junyang Shao
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: dev.simd
Gerrit-Change-Id: I6f480d76995f10bb9bbc264755c2509afcaacc9d
Gerrit-Change-Number: 798847
Gerrit-PatchSet: 2
Gerrit-Owner: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Austin Clements (Gerrit)

unread,
Jul 12, 2026, 9:30:15 PMJul 12
to Austin Clements, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from David Chase and Junyang Shao

Austin Clements uploaded new patchset

Austin Clements uploaded patch set #5 to this change.
Following approvals got outdated and were removed:
Open in Gerrit

Related details

Attention is currently required from:
  • David Chase
  • Junyang Shao
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: dev.simd
Gerrit-Change-Id: I6f480d76995f10bb9bbc264755c2509afcaacc9d
Gerrit-Change-Number: 798847
Gerrit-PatchSet: 5
unsatisfied_requirement
satisfied_requirement
open
diffy

Junyang Shao (Gerrit)

unread,
Jul 15, 2026, 5:35:24 PMJul 15
to Austin Clements, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, David Chase, Cherry Mui, golang-co...@googlegroups.com
Attention needed from Austin Clements and David Chase

Junyang Shao added 1 comment

File src/simd/archsimd/_gen/cmd/specls/main.go
Line 9, Patchset 6 (Latest): "_gen/specgen"
Junyang Shao . unresolved

I need to change this to `"simd/archsimd/_gen/specgen"` to make gopls not complaint on my end.

Open in Gerrit

Related details

Attention is currently required from:
  • Austin Clements
  • David Chase
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: dev.simd
    Gerrit-Change-Id: I6f480d76995f10bb9bbc264755c2509afcaacc9d
    Gerrit-Change-Number: 798847
    Gerrit-PatchSet: 6
    Gerrit-Owner: Austin Clements <aus...@google.com>
    Gerrit-Reviewer: Austin Clements <aus...@google.com>
    Gerrit-Reviewer: David Chase <drc...@google.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-CC: Cherry Mui <cher...@google.com>
    Gerrit-Attention: David Chase <drc...@google.com>
    Gerrit-Attention: Austin Clements <aus...@google.com>
    Gerrit-Comment-Date: Wed, 15 Jul 2026 21:35:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Austin Clements (Gerrit)

    unread,
    Aug 6, 2026, 2:58:59 PM (yesterday) Aug 6
    to Austin Clements, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, David Chase, Junyang Shao, Cherry Mui, golang-co...@googlegroups.com
    Attention needed from David Chase and Junyang Shao

    Austin Clements added 1 comment

    File src/simd/archsimd/_gen/cmd/specls/main.go
    Line 9, Patchset 6: "_gen/specgen"
    Junyang Shao . resolved

    I need to change this to `"simd/archsimd/_gen/specgen"` to make gopls not complaint on my end.

    Austin Clements

    It sounds like you rebased this CL past the go.mod change. I'll need to do that, but right now that's not in the parent chain of this CL.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • David Chase
    • Junyang Shao
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: dev.simd
      Gerrit-Change-Id: I6f480d76995f10bb9bbc264755c2509afcaacc9d
      Gerrit-Change-Number: 798847
      Gerrit-PatchSet: 7
      Gerrit-Owner: Austin Clements <aus...@google.com>
      Gerrit-Reviewer: Austin Clements <aus...@google.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
      Gerrit-CC: Cherry Mui <cher...@google.com>
      Gerrit-Attention: David Chase <drc...@google.com>
      Gerrit-Attention: Junyang Shao <shaoj...@google.com>
      Gerrit-Comment-Date: Thu, 06 Aug 2026 18:58:49 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Junyang Shao <shaoj...@google.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Austin Clements (Gerrit)

      unread,
      Aug 6, 2026, 3:07:31 PM (yesterday) Aug 6
      to Austin Clements, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from David Chase and Junyang Shao

      Austin Clements uploaded new patchset

      Austin Clements uploaded patch set #8 to this change.
      Open in Gerrit

      Related details

      Attention is currently required from:
      • David Chase
      • Junyang Shao
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: dev.simd
      Gerrit-Change-Id: I6f480d76995f10bb9bbc264755c2509afcaacc9d
      Gerrit-Change-Number: 798847
      Gerrit-PatchSet: 8
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Austin Clements (Gerrit)

      unread,
      5:16 PM (5 hours ago) 5:16 PM
      to David Chase, Junyang Shao, goph...@pubsubhelper.golang.org, Cherry Mui, Austin Clements, golang-co...@googlegroups.com
      Attention needed from David Chase and Junyang Shao

      Austin Clements has uploaded the change for review

      Austin Clements would like David Chase and Junyang Shao to review this change.

      Commit message

      simd/archsimd/_gen/cmd/specls: command to list spec API


      This is a simple command-line tool to inspect and debug API generation
      from the SIMD spec package.
      Change-Id: I6f480d76995f10bb9bbc264755c2509afcaacc9d

      Change diff

      diff --git a/src/simd/archsimd/_gen/cmd/specls/main.go b/src/simd/archsimd/_gen/cmd/specls/main.go
      new file mode 100644
      index 0000000..2149d98
      --- /dev/null
      +++ b/src/simd/archsimd/_gen/cmd/specls/main.go
      @@ -0,0 +1,66 @@

      +// Copyright 2026 The Go Authors. All rights reserved.
      +// Use of this source code is governed by a BSD-style
      +// license that can be found in the LICENSE file.
      +
      +// specls prints the expanded API from the SIMD spec package.
      +package main
      +
      +import (
      +	"flag"
      + "fmt"
      + "go/ast"
      + "log"
      + "os"
      +	"regexp"
      + "simd/archsimd/_gen/specgen"

      +)
      +
      +var (
      + flagFilter = flag.String("f", "", "only process spec functions matching `regexp`")
      + flagTrace = flag.Bool("trace", false, "trace solver steps")
      +)
      +
      +func main() {
      + flag.Usage = func() {
      + w := flag.CommandLine.Output()
      + fmt.Fprintf(w, "usage: specls [flags] [spec dir]\n")
      + flag.CommandLine.PrintDefaults()
      + }
      +
      + flag.Parse()
      +	var specDir string
      + switch flag.NArg() {
      + case 0:
      + specDir = specgen.MustFindSpecDir()
      + case 1:
      + specDir = flag.Arg(0)
      + default:

      + flag.Usage()
      + os.Exit(1)
      + }
      +
      +	var opts specgen.LoadOptions
      + if *flagFilter != "" {
      + re, err := regexp.Compile(*flagFilter)
      + if err != nil {
      + log.Fatal("invalid -f: ", err)
      + }
      + opts.Filter = func(fd *ast.FuncDecl) bool {
      + return re.MatchString(fd.Name.Name)
      + }
      + }
      + if *flagTrace {
      + opts.Trace = os.Stderr
      + }
      +
      + funcs, err := specgen.Load(specDir, &opts)
      + if err != nil {
      +		fmt.Fprintf(os.Stderr, "%s\n\n", err.Error())
      + defer os.Exit(1)

      + }
      +
      + for _, fn := range funcs {
      + fmt.Print(fn.Decl())
      + fmt.Println()
      + }
      +}

      Change information

      Files:
      • A src/simd/archsimd/_gen/cmd/specls/main.go
      Change size: M
      Delta: 1 file changed, 66 insertions(+), 0 deletions(-)
      Open in Gerrit

      Related details

      Attention is currently required from:
      • David Chase
      • Junyang Shao
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newchange
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I6f480d76995f10bb9bbc264755c2509afcaacc9d
      Gerrit-Change-Number: 812063
      Gerrit-PatchSet: 1
      Gerrit-Owner: Austin Clements <aus...@google.com>
      Gerrit-Reviewer: Austin Clements <aus...@google.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages