Data alignment other than 8 bytes (ex: 128-bits, 256-bits, 512-bits) is necessary for
various instructions (belonging to SSE/AVX/AVX2 and the upcoming AVX-512). Instruction
and label alignment contributes to speed for some instructions.
It would hugely be helpful to be able to specify the alignment of data, text and
On the user mailing list, Ian mentioned the possibility of enabling similar
functionality via a magic comment.
The text was updated successfully, but these errors were encountered:
This is a big topic. I do not know what the right solution is here. Magic comments would
help with specific variables, but it is unclear to me what to do about fields in structs
and so on. This would somehow get mixed into the type system, whether implicitly or
explicitly, and it's not clear which way makes a smaller mess.
Yes, I'm only hoping to see the support for this in assembly files (hence cmd/as, but
maybe I should simply have said a/l). Maybe it's better to file an issue for
the Go-side support?
This is such a basic feature that any assembler (other than Plan 9 assembler) I have
ever used (even ancient Zilog 80 assemblers!) has this feature. I have the impression
that at the time Plan 9 assembler was written, the authors didn't imagine that alignment
is a real issue and enforcing "native-alignment" (64-bits for amd64 for instance) as the
"one true alignment", without any options, is the best way to go.
In this age of SSE/AVX, such an assumption is no longer valid and causes performance
I'm not sure what this means, you can define your data in assembly or Go code.
A more specific example (taken from real production code) is be the mask data, that is
not passed as a parameter to the function.
Ideally, yes, it would be just perfect to have such support on Go side.
Would make everything much easier. Only assembly support is still okay, since it's
better than the current state (it's totally impossible to have any aligned data at all).
Additionally, assembly side support will be needed for a potential Go-side support