Proposal Details
You can currently use things like GOAMD64, GOARM64, ... to indicate to the compiler and assembler that certain optional CPU features are always supported.
it's also possible to use that information in a go program like by using amd64.v3 tag.
This is fairly limited, the defaults are sometime outdated (GOAMD64=v2 is supported by nearly anything still we default to v1).
This either mean we do not use newer instruction sets, or we waste CPU cycles checking for them at runtime.
Instead I propose GOAMD64=all (and others). This would build the program with all levels; then before the binary start the dynamic loader patch the binary to use the best supported level on the current CPU.
Most functions compile no differently between v1, v2, ... thus theses can be deduped by the linker.
Proposal Details
You can currently use things like
GOAMD64,GOARM64, ... to indicate to the compiler and assembler that certain optional CPU features are always supported.it's also possible to use that information in a go program like by using
amd64.v3tag.This is fairly limited, the defaults are sometime outdated (GOAMD64=v2 is supported by nearly anything still we default to v1).
This either mean we do not use newer instruction sets, or we waste CPU cycles checking for them at runtime.
Instead I propose
GOAMD64=all(and others). This would build the program with all levels; then before the binary start the dynamic loader patch the binary to use the best supported level on the current CPU.Most functions compile no differently between v1, v2, ... thus theses can be deduped by the linker.