[dev.simd] simd/_gen: fix sorting ops slices

Fix sorting slices to avoid panic when there are more opsDataImm than
opsData (the problem occurs when generating only a subset of instructions
but it may be better to keep them sorted by their own names anyway).

Change-Id: Iea7fe61259e8416f16c46158d87c84b1d7a3076d
Reviewed-on: https://go-review.googlesource.com/c/go/+/716121
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
This commit is contained in:
Alexander Musman 2025-10-29 16:49:28 +03:00 committed by Gopher Robot
parent e452f4ac7d
commit fe040658b2
3 changed files with 8671 additions and 8671 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -185,13 +185,13 @@ func writeSIMDMachineOps(ops []Operation) *bytes.Buffer {
return compareNatural(opsData[i].OpName, opsData[j].OpName) < 0
})
sort.Slice(opsDataImm, func(i, j int) bool {
return compareNatural(opsData[i].OpName, opsData[j].OpName) < 0
return compareNatural(opsDataImm[i].OpName, opsDataImm[j].OpName) < 0
})
sort.Slice(opsDataLoad, func(i, j int) bool {
return compareNatural(opsData[i].OpName, opsData[j].OpName) < 0
return compareNatural(opsDataLoad[i].OpName, opsDataLoad[j].OpName) < 0
})
sort.Slice(opsDataImmLoad, func(i, j int) bool {
return compareNatural(opsData[i].OpName, opsData[j].OpName) < 0
return compareNatural(opsDataImmLoad[i].OpName, opsDataImmLoad[j].OpName) < 0
})
err := t.Execute(buffer, machineOpsData{opsData, opsDataImm, opsDataLoad, opsDataImmLoad})
if err != nil {