1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/compiler/tests/asm_test.v

29 lines
291 B
V
Raw Normal View History

2019-11-17 00:58:09 +03:00
fn test_inline_asm() {
$if !windows {
$if !tinyc {
2019-11-17 00:58:09 +03:00
a := 10
b := 0
unsafe {
asm (
"movl %1, %%eax;"
"movl %%eax, %0;"
:"=r"(b)
:"r"(a)
:"%eax"
)
2019-11-17 00:58:09 +03:00
}
assert a == 10
assert b == 10
//
e := 0
unsafe {
asm(
"movl $5, %0"
:"=a"(e)
)
}
assert e == 5
}
}
2019-11-17 00:58:09 +03:00
}