You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: internal compiler error: panic during rewrite tern with GOEXPERIMENT=simd #77582
ENVIORMENT: zorin os on Inspiron-5406-2n1, go version go1.26rc3 linux/amd64, ive recently tried to transfer my shooting simulation for my FRC team project from normal calculate to SIMD based calculations(for performance), after trying for a while ive encountered a bug where the compiler crashes if a instruction is done with any combination of avx512, now i have absolutly no idea why this combination of lines causes this error:
resultsMask := archsimd.Mask64x8{}
for {
resultsMask = archsimd.Mask64x8FromBits(0).Or(archsimd.Float64x8{}.Less(archsimd.BroadcastFloat64x8(0))).Or(resultsMask)
fmt.Print(resultsMask.And(resultsMask.And(archsimd.Mask64x8{})))
}
causes :
GOEXPERIMENT=simd go build main.go
command-line-arguments
./main.go:192:2: internal compiler error: 'main': panic during rewrite tern while compiling main:
should have mapped away from input op, a0 is v100 = ternInt32x16 [254] v146 v96 v42 (resultsMask[archsimd.Mask64x8])
I have found that the bug is caused because of a value being used as the argument for 2 separate values, so when the rewrite function rewrites it once to use VPTERNLOGD and then again, the second time a panic occurs(because it just doesnt change anything), i am wondering if we could disable this by just removing the panic check: if op == a0.Op { panic ... or skipping the replace if its already a VPTERNLOGD instruction or there isn't supposed to be a value being used as the argument for 2 values in the first place?
I also found that adding boolExprTrees[a0] &= sloInterior at the end of the replace function works, And I think its more elegant than the other solutions
Activity
gabyhelp commentedon Feb 13, 2026
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
JunyangShao commentedon Feb 13, 2026
This pass is doing a rewrite of a tree of SIMD logical expressions to use the VPTERNLOGD instruction.
I think we have a bug
@golang/compiler
@dr2chase
gopherbot commentedon Feb 13, 2026
Change https://go.dev/cl/745460 mentions this issue:
cmd/compile: avoid panic in ternary rewrite on checked instructionsdr2chase commentedon Feb 24, 2026
@gopherbot please open a backport issue to 1.26.
This is not a regression because it is a new feature (and an experiment), but we want people to try it out.
gopherbot commentedon Feb 24, 2026
Backport issue(s) opened: #77773 (for 1.26).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.
cmd/compile: avoid panic in ternary rewrite on checked instructions
gopherbot commentedon Feb 25, 2026
Change https://go.dev/cl/748760 mentions this issue:
test/simd: add test for issue 77582test/simd: add test for issue 77582
gopherbot commentedon Feb 25, 2026
Change https://go.dev/cl/749241 mentions this issue:
cmd/compile: ternary rewrite of rewrite should skip, not panicEyalcfish commentedon Feb 26, 2026
I have found that the bug is caused because of a value being used as the argument for 2 separate values, so when the rewrite function rewrites it once to use VPTERNLOGD and then again, the second time a panic occurs(because it just doesnt change anything), i am wondering if we could disable this by just removing the panic check: if op == a0.Op { panic ... or skipping the replace if its already a VPTERNLOGD instruction or there isn't supposed to be a value being used as the argument for 2 values in the first place?
Eyalcfish commentedon Feb 26, 2026
I also found that adding boolExprTrees[a0] &= sloInterior at the end of the replace function works, And I think its more elegant than the other solutions
cherrymui commentedon Feb 26, 2026
Reopen. CL 745460 reverted.
The new fix is CL 749241.
cmd/compile: ternary rewrite of rewrite should skip, not panic