On Thu, Feb 24, 2022 at 5:21 PM Ian Lance Taylor <i...@golang.org> wrote:

> On Thu, Feb 24, 2022 at 9:40 AM Wojciech Muła <wojtek.m...@gmail.com>
> wrote:
> >
> > I'm writing an implementation in x86 assembler and I need to force a
> certain alignment of blocks of code (as it affects performance). I found
> that there's PCALIGN directive, but it's only available for the PPC
> architecture. It does not work for x86.
> >
> > Is there any easy way to achieve this for x86? If I had one loop, it
> won't be a problem --- I'd just put a few `BYTE $0x90` and move on. The
> problem is my code is huge, partially autogenerated with few variants.
>
> As far as I can tell PCALIGN is implemented for all architectures.
>

See, for example,
https://docs.studygolang.com/src/cmd/internal/obj/arm64/doc.go . I couldn't
find a similar document for x86_64 (or even just x86 or i386). However, I
did eventually find
https://github.com/golang/go/blob/master/src/cmd/asm/internal/asm/asm.go
which makes it clear the PCALIGN directive is supported for all
architectures; albeit with different valid values. Perhaps the O.P. isn't
using it correctly for x86. This seems like a feature that could be better
documented. :-)

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD9pKH-p%3D569woCxFHb3LLh1sUA_yujKPBtKE57c%3D2KZuQ%40mail.gmail.com.

Reply via email to