Files
c3c/test/test_suite/asm/asm_jump_rv.c3t
Christoffer Lerno 8b49e6c14d Rename def to alias.
2025-03-13 11:22:27 +01:00

30 lines
426 B
Plaintext

// #target: elf-riscv32
module test;
alias Sum = fn int(int a, int b);
fn int sum(int a, int b)
{
return a + b;
}
fn void main(String[] args)
{
int a = 1;
int b = 2;
int result = 0;
Sum sum_ptr = ∑
asm
{
mv $a0, a;
mv $a1, b;
jalr $ra, sum_ptr, 0;
mv result, $a0;
}
}
/* #expect: test.ll
"mv a0, $1\0Amv a1, $2\0Ajalr ra, $3, 0\0Amv $0, a0\0A", "=r,r,r,r,~{x1},~{x10},~{x11}"(i32 %1, i32 %2, ptr %3)