Debian Codegraph @

tests/fixedbugs/issue76/asm.go

raw symbols SCIP
1 //go:build ignore
2
3 package main
4
5 import (
6 . "github.com/mmcloughlin/avo/build"
7 . "github.com/mmcloughlin/avo/reg"
8 )
9
10 func main() {
11 TEXT("Issue76", NOSPLIT, "func(x, y uint64) uint64")
12 x := Load(Param("x"), GP64())
13 y := Load(Param("y"), GP64())
14 s := add(x, y)
15 Store(s, ReturnIndex(0))
16 RET()
17 Generate()
18 }
19
20 // add generates code to add x and y. The intent here is to demonstrate how a
21 // natural subroutine in avo typically requires temporary registers, which in
22 // turn can be "optimized out" by the register allocator and result in redundant
23 // self-moves.
24 func add(x, y Register) Register {
25 s := GP64()
26 MOVQ(x, s) // likely to become a self move
27 ADDQ(y, s)
28 return s
29 }