[go/dev.simd] [dev.simd] simdgen: detect SetElem greg width from element width

8 views
Skip to first unread message

Alexander Musman (Gerrit)

unread,
Mar 8, 2026, 7:37:27 AMMar 8
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Alexander Musman has uploaded the change for review

Commit message

[dev.simd] simdgen: detect SetElem greg width from element width
Change-Id: I9b448e4f5c579c0f99d367ce9f5be8973c408d98

Change diff

diff --git a/src/simd/archsimd/_gen/simdgen/arm64/operands.go b/src/simd/archsimd/_gen/simdgen/arm64/operands.go
index c827710..845fe8a 100644
--- a/src/simd/archsimd/_gen/simdgen/arm64/operands.go
+++ b/src/simd/archsimd/_gen/simdgen/arm64/operands.go
@@ -118,6 +118,9 @@
op.Bits = 32
}
}
+ if mnemonic == "INS" {
+ op.Bits = arrangement.elemBits
+ }
case OperandVElem, OperandList:
panic("expected this operand type to be early-lowered")
}
diff --git a/src/simd/archsimd/_gen/simdgen/arm64/operands_test.go b/src/simd/archsimd/_gen/simdgen/arm64/operands_test.go
index 1d3c2ec..1be377f 100644
--- a/src/simd/archsimd/_gen/simdgen/arm64/operands_test.go
+++ b/src/simd/archsimd/_gen/simdgen/arm64/operands_test.go
@@ -89,6 +89,18 @@
wantListNums: []int{-1, -1, -1, -1, -1},
},
{
+ name: "INS general register to element - from ins_advsimd_gen.xml",
+ template: "INS <Vd>.4S[<index1>], <Wn>",
+ resultInArg0: false, // VElem dest automatically sets resultInArg0
+ wantTokenText: []string{"<Vd>.4S[<index1>]", "<Wn>"},
+ wantTypes: []OperandType{OperandVElem, OperandGReg},
+ wantIsDest: []bool{true, false},
+ wantCount: 4,
+ wantClasses: []string{"vreg", "immediate", "vreg", "greg"},
+ wantNames: []string{"destination", "destination_i", "original", "x"},
+ wantListNums: []int{-1, -1, -1, -1},
+ },
+ {
name: "UMOV to general register - from umov_advsimd.xml",
template: "UMOV <Wd>, <Vn>.4S[<index>]",
resultInArg0: false,
@@ -167,3 +179,75 @@
})
}
}
+
+// TestOperandInstantiateBits tests that Instantiate sets Bits correctly for INS greg operands.
+func TestOperandInstantiateBits(t *testing.T) {
+ tests := []struct {
+ name string
+ mnemonic string
+ arrangement Arrangement
+ wantBits int
+ }{
+ {
+ name: "INS 16B element - 8-bit greg",
+ mnemonic: "INS",
+ arrangement: Arrangement{
+ arrangement: "16B",
+ bits: 128,
+ elemBits: 8,
+ lanes: 16,
+ baseType: "uint",
+ },
+ wantBits: 8,
+ },
+ {
+ name: "INS 8H element - 16-bit greg",
+ mnemonic: "INS",
+ arrangement: Arrangement{
+ arrangement: "8H",
+ bits: 128,
+ elemBits: 16,
+ lanes: 8,
+ baseType: "uint",
+ },
+ wantBits: 16,
+ },
+ {
+ name: "INS 4S element - 32-bit greg",
+ mnemonic: "INS",
+ arrangement: Arrangement{
+ arrangement: "4S",
+ bits: 128,
+ elemBits: 32,
+ lanes: 4,
+ baseType: "uint",
+ },
+ wantBits: 32,
+ },
+ {
+ name: "INS 2D element - 64-bit greg",
+ mnemonic: "INS",
+ arrangement: Arrangement{
+ arrangement: "2D",
+ bits: 128,
+ elemBits: 64,
+ lanes: 2,
+ baseType: "uint",
+ },
+ wantBits: 64,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ op := &Operand{
+ Type: OperandGReg,
+ Class: "greg",
+ Name: "x",
+ ListNumber: -1,
+ }
+ op.Instantiate(tt.arrangement, DefaultArngs, 1, tt.mnemonic)
+ requireEqual(t, tt.wantBits, op.Bits)
+ })
+ }
+}

Change information

Files:
  • M src/simd/archsimd/_gen/simdgen/arm64/operands.go
  • M src/simd/archsimd/_gen/simdgen/arm64/operands_test.go
Change size: M
Delta: 2 files changed, 87 insertions(+), 0 deletions(-)
Open in Gerrit

Related details

Attention set is empty
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: I9b448e4f5c579c0f99d367ce9f5be8973c408d98
Gerrit-Change-Number: 752800
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Musman <alexande...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Alexander Musman (Gerrit)

unread,
Mar 8, 2026, 7:43:31 AMMar 8
to goph...@pubsubhelper.golang.org, Junyang Shao, golang-co...@googlegroups.com
Attention needed from Junyang Shao

Alexander Musman added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Alexander Musman . resolved

This is a helper change for SetElem/GetElem.

Open in Gerrit

Related details

Attention is currently required from:
  • 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: I9b448e4f5c579c0f99d367ce9f5be8973c408d98
Gerrit-Change-Number: 752800
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Musman <alexande...@gmail.com>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
Gerrit-Attention: Junyang Shao <shaoj...@google.com>
Gerrit-Comment-Date: Sun, 08 Mar 2026 11:43:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Alexander Musman (Gerrit)

unread,
May 2, 2026, 4:56:23 AMMay 2
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Junyang Shao

Alexander Musman uploaded new patchset

Alexander Musman uploaded patch set #6 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • 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: I9b448e4f5c579c0f99d367ce9f5be8973c408d98
Gerrit-Change-Number: 752800
Gerrit-PatchSet: 6
unsatisfied_requirement
satisfied_requirement
open
diffy

David Chase (Gerrit)

unread,
May 4, 2026, 11:47:32 AMMay 4
to Alexander Musman, goph...@pubsubhelper.golang.org, Junyang Shao, golang-co...@googlegroups.com
Attention needed from Alexander Musman and Junyang Shao

David Chase voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Alexander Musman
  • 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: I9b448e4f5c579c0f99d367ce9f5be8973c408d98
Gerrit-Change-Number: 752800
Gerrit-PatchSet: 7
Gerrit-Owner: Alexander Musman <alexande...@gmail.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
Gerrit-Attention: Alexander Musman <alexande...@gmail.com>
Gerrit-Attention: Junyang Shao <shaoj...@google.com>
Gerrit-Comment-Date: Mon, 04 May 2026 15:47:27 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

David Chase (Gerrit)

unread,
May 5, 2026, 12:02:07 PM (14 days ago) May 5
to Alexander Musman, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Junyang Shao, golang-co...@googlegroups.com
Attention needed from Alexander Musman and Junyang Shao

David Chase voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention is currently required from:
  • Alexander Musman
  • Junyang Shao
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement 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: I9b448e4f5c579c0f99d367ce9f5be8973c408d98
    Gerrit-Change-Number: 752800
    Gerrit-PatchSet: 7
    Gerrit-Owner: Alexander Musman <alexande...@gmail.com>
    Gerrit-Reviewer: David Chase <drc...@google.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Attention: Alexander Musman <alexande...@gmail.com>
    Gerrit-Attention: Junyang Shao <shaoj...@google.com>
    Gerrit-Comment-Date: Tue, 05 May 2026 16:02:02 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Alexander Musman (Gerrit)

    unread,
    May 9, 2026, 3:18:50 AM (10 days ago) May 9
    to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, David Chase, Junyang Shao, golang-co...@googlegroups.com
    Attention needed from David Chase and Junyang Shao

    Alexander Musman voted Commit-Queue+1

    Commit-Queue+1
    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: I9b448e4f5c579c0f99d367ce9f5be8973c408d98
      Gerrit-Change-Number: 752800
      Gerrit-PatchSet: 10
      Gerrit-Owner: Alexander Musman <alexande...@gmail.com>
      Gerrit-Reviewer: Alexander Musman <alexande...@gmail.com>
      Gerrit-Attention: David Chase <drc...@google.com>
      Gerrit-Attention: Junyang Shao <shaoj...@google.com>
      Gerrit-Comment-Date: Sat, 09 May 2026 07:18:41 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      David Chase (Gerrit)

      unread,
      May 18, 2026, 2:21:13 PM (18 hours ago) May 18
      to Alexander Musman, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Junyang Shao, golang-co...@googlegroups.com
      Attention needed from Alexander Musman and Junyang Shao

      David Chase voted

      Auto-Submit+1
      Code-Review+2
      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alexander Musman
      • Junyang Shao
      Submit Requirements:
      • requirement 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: I9b448e4f5c579c0f99d367ce9f5be8973c408d98
      Gerrit-Change-Number: 752800
      Gerrit-PatchSet: 11
      Gerrit-Owner: Alexander Musman <alexande...@gmail.com>
      Gerrit-Reviewer: Alexander Musman <alexande...@gmail.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
      Gerrit-Attention: Alexander Musman <alexande...@gmail.com>
      Gerrit-Attention: Junyang Shao <shaoj...@google.com>
      Gerrit-Comment-Date: Mon, 18 May 2026 18:21:10 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alexander Musman (Gerrit)

      unread,
      4:50 AM (3 hours ago) 4:50 AM
      to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, David Chase, Junyang Shao, golang-co...@googlegroups.com
      Attention needed from David Chase and Junyang Shao

      Alexander Musman voted Commit-Queue+1

      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • David Chase
      • Junyang Shao
      Submit Requirements:
      • requirement 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: I9b448e4f5c579c0f99d367ce9f5be8973c408d98
      Gerrit-Change-Number: 752800
      Gerrit-PatchSet: 12
      Gerrit-Owner: Alexander Musman <alexande...@gmail.com>
      Gerrit-Reviewer: Alexander Musman <alexande...@gmail.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
      Gerrit-Attention: David Chase <drc...@google.com>
      Gerrit-Attention: Junyang Shao <shaoj...@google.com>
      Gerrit-Comment-Date: Tue, 19 May 2026 08:49:53 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages