v / examples / asm.v
19 lines · 19 sloc · 276 bytes · a80bc2331450fc28c900097f8afafe173f161d27
Raw
1// vtest build: !msvc
2fn main() {
3 a := 100
4 b := 20
5 mut c := 0
6 $if amd64 {
7 asm amd64 {
8 mov eax, a
9 add eax, b
10 mov c, eax
11 ; =r (c) // output
12 ; r (a) // input
13 r (b)
14 }
15 }
16 println('a: ${a}') // 100
17 println('b: ${b}') // 20
18 println('c: ${c}') // 120
19}
20