mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
inline assembly
This commit is contained in:
14
vlib/compiler/tests/asm_test.v
Normal file
14
vlib/compiler/tests/asm_test.v
Normal file
@ -0,0 +1,14 @@
|
||||
fn test_inline_asm() {
|
||||
a := 10
|
||||
b := 0
|
||||
unsafe {
|
||||
asm ("movl %1, %%eax;"
|
||||
"movl %%eax, %0;"
|
||||
:"=r"(b)
|
||||
:"r"(a)
|
||||
:"%eax"
|
||||
)
|
||||
}
|
||||
assert a == 10
|
||||
assert b == 10
|
||||
}
|
Reference in New Issue
Block a user