Skip to content

Commit

Permalink
examples: remove non-dot imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcloughlin committed Jan 6, 2019
1 parent 5c67547 commit 1cdd4b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions examples/fnv1a/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package main

import (
. "github.com/mmcloughlin/avo/build"
"github.com/mmcloughlin/avo/operand"
"github.com/mmcloughlin/avo/reg"
. "github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/reg"
)

const (
Expand All @@ -19,22 +19,22 @@ func main() {
ptr := Load(Param("data").Base(), GP64())
n := Load(Param("data").Len(), GP64())

h := reg.RAX
MOVQ(operand.Imm(OffsetBasis), h)
h := RAX
MOVQ(Imm(OffsetBasis), h)
p := GP64()
MOVQ(operand.Imm(Prime), p)
MOVQ(Imm(Prime), p)

LABEL("loop")
CMPQ(n, operand.Imm(0))
JE(operand.LabelRef("done"))
CMPQ(n, Imm(0))
JE(LabelRef("done"))
b := GP64()
MOVBQZX(operand.Mem{Base: ptr}, b)
MOVBQZX(Mem{Base: ptr}, b)
XORQ(b, h)
MULQ(p)
INCQ(ptr)
DECQ(n)

JMP(operand.LabelRef("loop"))
JMP(LabelRef("loop"))
LABEL("done")
Store(h, ReturnIndex(0))
RET()
Expand Down
12 changes: 6 additions & 6 deletions examples/sum/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package main

import (
. "github.com/mmcloughlin/avo/build"
"github.com/mmcloughlin/avo/operand"
. "github.com/mmcloughlin/avo/operand"
)

func main() {
Expand All @@ -15,12 +15,12 @@ func main() {
s := GP64()
XORQ(s, s)
LABEL("loop")
CMPQ(n, operand.Imm(0))
JE(operand.LabelRef("done"))
ADDQ(operand.Mem{Base: ptr}, s)
ADDQ(operand.Imm(8), ptr)
CMPQ(n, Imm(0))
JE(LabelRef("done"))
ADDQ(Mem{Base: ptr}, s)
ADDQ(Imm(8), ptr)
DECQ(n)
JMP(operand.LabelRef("loop"))
JMP(LabelRef("loop"))
LABEL("done")
Store(s, ReturnIndex(0))
RET()
Expand Down

0 comments on commit 1cdd4b9

Please sign in to comment.