Re: [go-nuts] Build fails when using gollvm toolchain instead of go

2020-05-26 Thread Ian Lance Taylor
On Tue, May 26, 2020 at 12:41 AM Martins Eglitis  wrote:
>
> Thank you for the kind answer. I can not see the asm tool in the gollvm
> toolchain. Or should I use something else?

There is no asm tool in the GoLLVM toolchain.  When building for
GoLLVM the go tool will build assembly code using clang directly.

> This is the go snippet:
>
> package asm
>
> // RteCompilerRmb is lfence
> func RteCompilerRmb()
>
> // RteCompilerWmb is sfence
> func RteCompilerWmb()
>
> // Prefetcht0 is prefetch
> func Prefetcht0(addr uintptr)
>
> func GenerateMask(v1 *([32]uint8), v2 *([32]uint8), previousMask
> *([32]bool), result *([32]bool)) bool

OK, based on that you are going to have to rewrite those functions in
standard assembly language, and use build tags to select the specific
.s file that should be built.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcW3fe4cCeDoTB5wJb66Rp3OwtvNkhhdmPkyETWEf9K7Sg%40mail.gmail.com.


Re: [go-nuts] Build fails when using gollvm toolchain instead of go

2020-05-26 Thread 'Martins Eglitis' via golang-nuts

Hi,

Thank you for the kind answer. I can not see the asm tool in the gollvm 
toolchain. Or should I use something else?


This is the go snippet:

package asm

// RteCompilerRmb is lfence
func RteCompilerRmb()

// RteCompilerWmb is sfence
func RteCompilerWmb()

// Prefetcht0 is prefetch
func Prefetcht0(addr uintptr)

func GenerateMask(v1 *([32]uint8), v2 *([32]uint8), previousMask 
*([32]bool), result *([32]bool)) bool



Thank you!


On 2020-05-25 23:26, Ian Lance Taylor wrote:

On Mon, May 25, 2020 at 8:54 AM  wrote:

I've been trying to make this project https://github.com/intel-go/nff-go using 
a freshly built gollvm to get the code compiled into LLVM IR. The project 
builds fine when using the regular go toolchain, but when trying to build with 
gollvm, I get errors such as below:

../../asm/asm.s: Assembler messages:
../../asm/asm.s:6: Error: no such instruction: `text 
·RteCompilerRmb(SB),NOSPLIT,$0-0'
../../asm/asm.s:9: Error: no such instruction: `text 
·RteCompilerWmb(SB),NOSPLIT,$0-0'
../../asm/asm.s:12: Error: no such instruction: `text 
·Prefetcht0(SB),NOSPLIT,$0-8'
../../asm/asm.s:13: Error: junk `(FP)' after expression
../../asm/asm.s:13: Error: too many memory references for `movq'
../../asm/asm.s:16: Error: no such instruction: `text 
·GenerateMask(SB),NOSPLIT,$0-33'
../../asm/asm.s:17: Error: junk `(FP)' after expression
../../asm/asm.s:17: Error: too many memory references for `movq'
../../asm/asm.s:18: Error: junk `(FP)' after expression
../../asm/asm.s:18: Error: too many memory references for `movq'
../../asm/asm.s:19: Error: junk `(FP)' after expression
../../asm/asm.s:19: Error: too many memory references for `movq'
../../asm/asm.s:20: Error: junk `(FP)' after expression
../../asm/asm.s:20: Error: too many memory references for `movq'
../../asm/asm.s:21: Error: too many memory references for `vmovdqu'
../../asm/asm.s:22: Error: too many memory references for `vmovdqu'
../../asm/asm.s:23: Error: too many memory references for `vmovdqu'
../../asm/asm.s:24: Error: too many memory references for `vpcmpeqb'
../../asm/asm.s:25: Error: too many memory references for `vpand'
../../asm/asm.s:26: Error: too many memory references for `vptest'
../../asm/asm.s:27: Error: junk `(FP)' after expression
../../asm/asm.s:27: Error: invalid instruction suffix for `sete'
../../asm/asm.s:28: Error: too many memory references for `vmovdqu'

The assembler syntax used by the gc toolchain and the assembler syntax
used by GoLLVM are not compatible.  Here you are trying to assemble
code written for the gc assembler with the GoLLVM assembler.  That
won't work.

While the syntax differences are in some ways annoying, in other ways
they are good, because gc and GoLLVM use different calling
conventions.  That means that assembler code written for gc and GoLLVM
are not compatible (except for functions that take no arguments and
return no results).

What this means for your code is that you need to rewrite this code
into GoLLVM assembler (changing the calling convention as you go) or
you need to rewrite it into Go.  You can use build tags to select the
version to use for each compiler.

Sorry for these difficulties.  They are hard to avoid.

Ian


--
Best regards,
Martins Eglitis

--
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/d22f7ced-3d01-4aac-eee4-2a4d37569253%40sitilge.id.lv.


Re: [go-nuts] Build fails when using gollvm toolchain instead of go

2020-05-25 Thread Ian Lance Taylor
On Mon, May 25, 2020 at 8:54 AM  wrote:
>
> I've been trying to make this project https://github.com/intel-go/nff-go 
> using a freshly built gollvm to get the code compiled into LLVM IR. The 
> project builds fine when using the regular go toolchain, but when trying to 
> build with gollvm, I get errors such as below:
>
> ../../asm/asm.s: Assembler messages:
> ../../asm/asm.s:6: Error: no such instruction: `text 
> ·RteCompilerRmb(SB),NOSPLIT,$0-0'
> ../../asm/asm.s:9: Error: no such instruction: `text 
> ·RteCompilerWmb(SB),NOSPLIT,$0-0'
> ../../asm/asm.s:12: Error: no such instruction: `text 
> ·Prefetcht0(SB),NOSPLIT,$0-8'
> ../../asm/asm.s:13: Error: junk `(FP)' after expression
> ../../asm/asm.s:13: Error: too many memory references for `movq'
> ../../asm/asm.s:16: Error: no such instruction: `text 
> ·GenerateMask(SB),NOSPLIT,$0-33'
> ../../asm/asm.s:17: Error: junk `(FP)' after expression
> ../../asm/asm.s:17: Error: too many memory references for `movq'
> ../../asm/asm.s:18: Error: junk `(FP)' after expression
> ../../asm/asm.s:18: Error: too many memory references for `movq'
> ../../asm/asm.s:19: Error: junk `(FP)' after expression
> ../../asm/asm.s:19: Error: too many memory references for `movq'
> ../../asm/asm.s:20: Error: junk `(FP)' after expression
> ../../asm/asm.s:20: Error: too many memory references for `movq'
> ../../asm/asm.s:21: Error: too many memory references for `vmovdqu'
> ../../asm/asm.s:22: Error: too many memory references for `vmovdqu'
> ../../asm/asm.s:23: Error: too many memory references for `vmovdqu'
> ../../asm/asm.s:24: Error: too many memory references for `vpcmpeqb'
> ../../asm/asm.s:25: Error: too many memory references for `vpand'
> ../../asm/asm.s:26: Error: too many memory references for `vptest'
> ../../asm/asm.s:27: Error: junk `(FP)' after expression
> ../../asm/asm.s:27: Error: invalid instruction suffix for `sete'
> ../../asm/asm.s:28: Error: too many memory references for `vmovdqu'

The assembler syntax used by the gc toolchain and the assembler syntax
used by GoLLVM are not compatible.  Here you are trying to assemble
code written for the gc assembler with the GoLLVM assembler.  That
won't work.

While the syntax differences are in some ways annoying, in other ways
they are good, because gc and GoLLVM use different calling
conventions.  That means that assembler code written for gc and GoLLVM
are not compatible (except for functions that take no arguments and
return no results).

What this means for your code is that you need to rewrite this code
into GoLLVM assembler (changing the calling convention as you go) or
you need to rewrite it into Go.  You can use build tags to select the
version to use for each compiler.

Sorry for these difficulties.  They are hard to avoid.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVavB-C2k%2BBk7KcsDhcKGNJyVPQAssD74wV5PzFRpWKdw%40mail.gmail.com.


[go-nuts] Build fails when using gollvm toolchain instead of go

2020-05-25 Thread sitilge
Hi,

I've been trying to make this project https://github.com/intel-go/nff-go using 
a freshly built gollvm to get the code compiled into LLVM IR. The project 
builds fine when using the regular go toolchain, but when trying to build 
with gollvm, I get errors such as below:

../../asm/asm.s: Assembler messages:
../../asm/asm.s:6: Error: no such instruction: `text 
·RteCompilerRmb(SB),NOSPLIT,$0-0'
../../asm/asm.s:9: Error: no such instruction: `text 
·RteCompilerWmb(SB),NOSPLIT,$0-0'
../../asm/asm.s:12: Error: no such instruction: `text 
·Prefetcht0(SB),NOSPLIT,$0-8'
../../asm/asm.s:13: Error: junk `(FP)' after expression
../../asm/asm.s:13: Error: too many memory references for `movq'
../../asm/asm.s:16: Error: no such instruction: `text 
·GenerateMask(SB),NOSPLIT,$0-33'
../../asm/asm.s:17: Error: junk `(FP)' after expression
../../asm/asm.s:17: Error: too many memory references for `movq'
../../asm/asm.s:18: Error: junk `(FP)' after expression
../../asm/asm.s:18: Error: too many memory references for `movq'
../../asm/asm.s:19: Error: junk `(FP)' after expression
../../asm/asm.s:19: Error: too many memory references for `movq'
../../asm/asm.s:20: Error: junk `(FP)' after expression
../../asm/asm.s:20: Error: too many memory references for `movq'
../../asm/asm.s:21: Error: too many memory references for `vmovdqu'
../../asm/asm.s:22: Error: too many memory references for `vmovdqu'
../../asm/asm.s:23: Error: too many memory references for `vmovdqu'
../../asm/asm.s:24: Error: too many memory references for `vpcmpeqb'
../../asm/asm.s:25: Error: too many memory references for `vpand'
../../asm/asm.s:26: Error: too many memory references for `vptest'
../../asm/asm.s:27: Error: junk `(FP)' after expression
../../asm/asm.s:27: Error: invalid instruction suffix for `sete'
../../asm/asm.s:28: Error: too many memory references for `vmovdqu'



-- 
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/ca63d57c-671f-48df-8dc8-c219293a31c1%40googlegroups.com.