native: fix example exit((1,2)->(a,b)return a+b) (#12154)
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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
Loading…
Reference in New Issue