mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
native: fix example exit((1,2)->(a,b)return a+b) (#12154)
This commit is contained in:
parent
347ebe5fd3
commit
1d2b56d71d
@ -234,7 +234,7 @@ fn (mut g Gen) mov64(reg Register, val i64) {
|
||||
fn (mut g Gen) mov_reg_to_var(var_offset int, reg Register) {
|
||||
// 89 7d fc mov DWORD PTR [rbp-0x4],edi
|
||||
match reg {
|
||||
.rax, .rsi {
|
||||
.rax {
|
||||
g.write8(0x48)
|
||||
}
|
||||
else {}
|
||||
@ -642,7 +642,7 @@ fn (mut g Gen) mov(reg Register, val int) {
|
||||
g.write8(0xba)
|
||||
}
|
||||
.rsi {
|
||||
g.write8(0x48)
|
||||
// g.write8(0x48) // its 32bit!
|
||||
g.write8(0xbe)
|
||||
}
|
||||
.r12 {
|
||||
|
19
vlib/v/gen/native/tests/sumcall.vv
Normal file
19
vlib/v/gen/native/tests/sumcall.vv
Normal file
@ -0,0 +1,19 @@
|
||||
fn sumcall(a int, b int) int {
|
||||
r := a + b
|
||||
return r
|
||||
}
|
||||
|
||||
fn sumcall2(a int, b int) int {
|
||||
return a + b
|
||||
}
|
||||
|
||||
fn main() {
|
||||
r := sumcall (1,2)
|
||||
assert r == 3
|
||||
/*
|
||||
// XXX not yet working
|
||||
s := sumcall2 (1,2)
|
||||
assert r == 3
|
||||
*/
|
||||
exit(0)
|
||||
}
|
0
vlib/v/gen/native/tests/sumcall.vv.out
Normal file
0
vlib/v/gen/native/tests/sumcall.vv.out
Normal file
Loading…
Reference in New Issue
Block a user