Debian Codegraph @

examples/complex/asm.go

raw symbols SCIP
1 //go:build ignore
2
3 package main
4
5 import . "github.com/mmcloughlin/avo/build"
6
7 func main() {
8 TEXT("Real", NOSPLIT, "func(z complex128) float64")
9 Doc("Real returns the real part of z.")
10 r := Load(Param("z").Real(), XMM())
11 Store(r, ReturnIndex(0))
12 RET()
13
14 TEXT("Imag", NOSPLIT, "func(z complex128) float64")
15 Doc("Imag returns the imaginary part of z.")
16 i := Load(Param("z").Imag(), XMM())
17 Store(i, ReturnIndex(0))
18 RET()
19
20 TEXT("Norm", NOSPLIT, "func(z complex128) float64")
21 Doc("Norm returns the complex norm of z.")
22 r = Load(Param("z").Real(), XMM())
23 i = Load(Param("z").Imag(), XMM())
24 MULSD(r, r)
25 MULSD(i, i)
26 ADDSD(i, r)
27 n := XMM()
28 SQRTSD(r, n)
29 Store(n, ReturnIndex(0))
30 RET()
31
32 Generate()
33 }