Debian Codegraph @

examples/geohash/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/operand"
8 )
9
10 func main() {
11 TEXT("EncodeInt", NOSPLIT, "func(lat, lng float64) uint64")
12 Doc("EncodeInt computes the 64-bit integer geohash of (lat, lng).")
13 lat := Load(Param("lat"), XMM())
14 lng := Load(Param("lng"), XMM())
15
16 MULSD(ConstData("reciprocal180", F64(1/180.0)), lat)
17 onepointfive := ConstData("onepointfive", F64(1.5))
18 ADDSD(onepointfive, lat)
19
20 MULSD(ConstData("reciprocal360", F64(1/360.0)), lng)
21 ADDSD(onepointfive, lng)
22
23 lngi, lati := GP64(), GP64()
24 MOVQ(lat, lati)
25 SHRQ(U8(20), lati)
26 MOVQ(lng, lngi)
27 SHRQ(U8(20), lngi)
28
29 mask := ConstData("mask", U64(0x5555555555555555))
30 ghsh := GP64()
31 PDEPQ(mask, lati, ghsh)
32 temp := GP64()
33 PDEPQ(mask, lngi, temp)
34 SHLQ(U8(1), temp)
35 XORQ(temp, ghsh)
36
37 Store(ghsh, ReturnIndex(0))
38 RET()
39
40 Generate()
41 }