Re: [go-nuts] Aligning loops in Go assembly

2022-02-25 Thread Ian Lance Taylor
On Fri, Feb 25, 2022 at 1:25 AM Wojciech Muła wrote: > > Thanks! Didn't know that the assembler is able to do this. TBH, for me, it's > not desired behaviour when an assembler program does something extra to a > low-level code. I have already observed that Go asm strips a series of NOPs, > whic

Re: [go-nuts] Aligning loops in Go assembly

2022-02-25 Thread 'Keith Randall' via golang-nuts
I don't think PCALIGN is supported for x86. The assembler can parse the instruction, but the x86 assembler backend can't generate machine code for it. Wouldn't be hard to add, I think. There's already disabled experimental code in there for aligning loops. On Friday, February 25, 2022 at 1:25:3

Re: [go-nuts] Aligning loops in Go assembly

2022-02-25 Thread Wojciech Muła
Thanks! Didn't know that the assembler is able to do this. TBH, for me, it's not desired behaviour when an assembler program does something extra to a low-level code. I have already observed that Go asm strips a series of NOPs, which is highly unexpected. A directive for alignment is way cleare

Re: [go-nuts] Aligning loops in Go assembly

2022-02-25 Thread Brian Candler
Oops, I see it's disabled; but the knob is there if you want to experiment. On Friday, 25 February 2022 at 08:35:10 UTC Brian Candler wrote: > It seems to me that there is automatic alignment for loops: > > https://github.com/golang/go/blob/go1.17.7/src/cmd/internal/obj/x86/asm6.go#L51-L67 > > >

Re: [go-nuts] Aligning loops in Go assembly

2022-02-25 Thread Brian Candler
It seems to me that there is automatic alignment for loops: https://github.com/golang/go/blob/go1.17.7/src/cmd/internal/obj/x86/asm6.go#L51-L67 On Friday, 25 February 2022 at 06:42:23 UTC Wojciech Muła wrote: > The directive is not documented on https://pkg.go.dev/cmd/internal/obj/x86. > `grep

Re: [go-nuts] Aligning loops in Go assembly

2022-02-24 Thread Wojciech Muła
The directive is not documented on https://pkg.go.dev/cmd/internal/obj/x86. `grep -l -R PCALIGN *` run in `cmd/interal/obj` shows for the freshest master: arm64/doc.go arm64/asm7.go arm64/asm_arm64_test.go link.go ppc64/doc.go ppc64/asm9.go ppc64/asm_test.go util.go Seems it's not implemented.

Re: [go-nuts] Aligning loops in Go assembly

2022-02-24 Thread Kurtis Rader
On Thu, Feb 24, 2022 at 5:21 PM Ian Lance Taylor wrote: > On Thu, Feb 24, 2022 at 9:40 AM Wojciech Muła > 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 directiv

Re: [go-nuts] Aligning loops in Go assembly

2022-02-24 Thread Ian Lance Taylor
On Thu, Feb 24, 2022 at 9:40 AM Wojciech Muła 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 >

Re: [go-nuts] Aligning loops in Go assembly

2022-02-24 Thread Kurtis Rader
It's not clear what your question has to do with the Go language. Are you asking how to control the alignment of the code produced by the Go compiler? Some more context would probably help the community answer your question. On Thu, Feb 24, 2022 at 9:40 AM Wojciech Muła wrote: > > Hi all! That's

[go-nuts] Aligning loops in Go assembly

2022-02-24 Thread Wojciech Muła
Hi all! That's my first post to the group. 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.