v2 / vlib / v / slow_tests / assembly / util / dot_amd64_util.amd64.v
15 lines · 14 sloc · 260 bytes · 6a32c810703f4ec0c39fe18298ebe6c40acac8f1
Raw
1module util
2
3pub fn add(a ...int) int {
4 mut res := 0
5 asm amd64 {
6 1:
7 addq rax, [in_data + rcx * 4 + 0]
8 loop b1
9 addq rax, [in_data + rcx * 4 + 0]
10 ; +a (res)
11 ; c (a.len - 1) // c is counter (loop) register
12 r (a.data) as in_data
13 }
14 return res
15}
16