-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unrecognized instruction "IMUL3L" with go1.9/1.10 #17
Comments
+1 |
In the short term, downgrade the version of go-farm or upgrade your version of Go. I dont have an easy fix that maintains assembly for old versions by default. |
@dgryski Would you consider an approach such as this? // +build ignore
package main
import (
"flag"
. "github.com/mmcloughlin/avo/build"
. "github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/reg"
)
var go111 = flag.Bool("go1.11", true, "generate for go 1.11 or later")
func imul3l(m uint32, x, y Register) {
if *go111 {
IMUL3L(U32(m), x, y)
} else {
t := GP32()
MOVL(U32(m), t)
IMULL(t, x)
MOVL(x, y)
}
}
func main() {
flag.Parse()
if *go111 {
ConstraintExpr("go1.11")
} else {
ConstraintExpr("!go1.11")
}
TEXT("Mul7", NOSPLIT, "func(x uint32) uint32")
Doc("Mul7 returns 7*x.")
x := Load(Param("x"), GP32())
imul3l(7, x, x)
Store(x, ReturnIndex(0))
RET()
Generate()
} |
This would mean people who wanted support for older Go versions would need to generate their own assembly code. I'm fine with that. I'll come up with a patch tonight. Of course it's nicer to have everything work out-of-the-box, but I don't think we can do that here without a bunch of fiddly work. |
I was thinking that the repo would have two versions of the assembly code. //go:generate go run asm -go1.11=true -out fp_amd64.go
//go:generate go run asm -go1.11=false -out fp_legacy_amd64.go They could share a stub file (you'd need to write it yourself). I understand if you find this ugly, but I think it would work. There's also the option of just downgrading to the multi-instruction form. How much of a hit would that actually be? |
I'd need to benchmark the slowdown. But that's probably a better approach. |
I wouldn't be surprised if the performance hit was negligible, in which case that's surely the preferred solution. Otherwise I don't think the |
Not sure if it makes a difference in speed, but it breaks older Go versions. Fixes #17
Nice. I think this actually exercises the "self-move pruning" mmcloughlin/avo#80. |
Yes, it cleaned up the self-MOVs in all the cases except the two places where the source and destination for the IMUL were different. Nicely done. |
See https://travis-ci.org/dgraph-io/badger/jobs/520608511 for more information
The text was updated successfully, but these errors were encountered: