$ the-wire · showcase
RISC-V Zfa assembly support, and a faster archsimd unifier
By RepoJournal · Filed · About Go · Composed from the cited sources · methodology
Go's assembler learns the RISC-V Zfa floating-point extension while the SIMD code generator's unification engine gets three targeted performance fixes that together cut the work of matching a variable against large sums.
cmd/internal/obj/riscv: add assembly support of Zfa extension golang/go
The RISC-V assembler now accepts Zfa's additional floating-point instructions, a set the ISA manual makes mandatory in the RVA23 profile. FLI.fmt can encode only one canonical NaN and positive infinity, so NaN and Inf immediates are rejected rather than silently mapped to those encodings. Follow-up to CL 631575.
simd/archsimd/_gen/unify: filter variable values before unifying them golang/go
Unifying a variable against a value now filters candidates before partitioning: on amd64 Var.unify built 2,833,269 partitions of which only 84,380 survived, with most failures coming from mismatched String fields such as an instruction's asm field versus an operation's. Fewer partitions means less work thrown away per variable value.
simd/archsimd/_gen/unify: avoid copying product factors twice golang/go
newEnvExprProduct now allocates its factor slice once at the right size instead of copying factors passed in and growing from a capacity of 2. Environment sets during unification are products of roughly 50 factors on amd64, so the previous code copied them twice on every substitution.
simd/archsimd/_gen/unify: cache the sorted keys of a Def golang/go
Def caches its sorted keys instead of re-sorting on every Def.All call, which Def.unify made on both operands, sharing or merging the sorted lists rather than re-deriving them. Author Austin Clements calls it a small performance improvement on its own, with the next CL using those keys to visit fields in the same order as Def.unify.
simd/archsimd/_gen/unify: track sum discriminators golang/go
Also in the archsimd unifier: sums in an environment set are now tracked by their discriminating ident, since decoding a term like !sum [a, b, c] produces one variable bound across each environment.