On Tue, Apr 18, 2017 at 11:41 AM,  <alexan...@mosoi.ro> wrote:
>
> I have some code do prefetching that I borrowed from src/runtime
>
> // asm_amd64.s
>
> TEXT ·prefetch(SB), $0-8
>        MOVQ       addr+0(FP), AX
>        PREFETCHNTA (AX)
>        RET
>
>
> This compiles fine, $ go tool objdump shows:
>
> TEXT .prefetch(SB) asm_amd64.s
>
>   0x4f18e0              488b442408              MOVQ 0x8(SP), AX
>   0x4f18e5              0f1800                  PREFETCHNTA 0(AX)
>   0x4f18e8              c3                      RET
>
>
> however go vet complains:
>
> $ go vet .
> asm_amd64.s:8: [amd64] prefetch: unknown variable addr; offset 0 is e+0(FP)
> exit status 1
>
> If I remove addr I get:
>
> $ go build .
> asm_amd64.s:8: cannot reference FP without a symbol
>
>
> Which if the two tools is right?

They are both right.

What vet is telling you is that the Go code says something like `func
prefetch(e unsafe.Pointer)`.  Your asm code is referring to a
parameter `addr` at the address on the stack where `e` is found.  That
is technically fine but probably a mistake, so vet issues a warning.
Change your asm code to use `e` instead of  `addr`.

Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to