Permalink
Browse files

examples/sum: attempt to avoid asmfmt mismatch

Updates #41
Updates #8
  • Loading branch information...
mmcloughlin committed Jan 11, 2019
1 parent 3ca82be commit 943d5f0ced11a60d7fff825107f94e53c946813f
Showing with 10 additions and 10 deletions.
  1. +4 −4 README.md
  2. +2 −2 examples/sum/README.md
  3. +2 −2 examples/sum/asm.go
  4. +2 −2 examples/sum/sum.s
@@ -106,8 +106,8 @@ func main() {
s := GP64()
XORQ(s, s)
Comment("Loop until zero bytes remain.")
Label("loop")
Comment("Loop until zero bytes remain.")
CMPQ(n, Imm(0))
JE(LabelRef("done"))
@@ -119,8 +119,8 @@ func main() {
DECQ(n)
JMP(LabelRef("loop"))
Comment("Store sum to return value.")
Label("done")
Comment("Store sum to return value.")
Store(s, ReturnIndex(0))
RET()
Generate()
@@ -143,8 +143,8 @@ TEXT ·Sum(SB), NOSPLIT, $0-32
// Initialize sum register to zero.
XORQ DX, DX
// Loop until zero bytes remain.
loop:
// Loop until zero bytes remain.
CMPQ CX, $0x00
JE done
@@ -156,8 +156,8 @@ loop:
DECQ CX
JMP loop
// Store sum to return value.
done:
// Store sum to return value.
MOVQ DX, ret+24(FP)
RET
```
@@ -14,8 +14,8 @@ func main() {
s := GP64()
XORQ(s, s)
Comment("Loop until zero bytes remain.")
Label("loop")
Comment("Loop until zero bytes remain.")
CMPQ(n, Imm(0))
JE(LabelRef("done"))
@@ -27,8 +27,8 @@ func main() {
DECQ(n)
JMP(LabelRef("loop"))
Comment("Store sum to return value.")
Label("done")
Comment("Store sum to return value.")
Store(s, ReturnIndex(0))
RET()
Generate()
@@ -17,8 +17,8 @@ func main() {
s := GP64()
XORQ(s, s)

Comment("Loop until zero bytes remain.")
Label("loop")
Comment("Loop until zero bytes remain.")
CMPQ(n, Imm(0))
JE(LabelRef("done"))

@@ -30,8 +30,8 @@ func main() {
DECQ(n)
JMP(LabelRef("loop"))

Comment("Store sum to return value.")
Label("done")
Comment("Store sum to return value.")
Store(s, ReturnIndex(0))
RET()
Generate()
@@ -10,8 +10,8 @@ TEXT ·Sum(SB), NOSPLIT, $0-32
// Initialize sum register to zero.
XORQ DX, DX

// Loop until zero bytes remain.
loop:
// Loop until zero bytes remain.
CMPQ CX, $0x00
JE done

@@ -23,7 +23,7 @@ loop:
DECQ CX
JMP loop

// Store sum to return value.
done:
// Store sum to return value.
MOVQ DX, ret+24(FP)
RET

0 comments on commit 943d5f0

Please sign in to comment.