Skip to content

Instantly share code, notes, and snippets.

@milesrout
Created January 5, 2025 08:07
Show Gist options
  • Save milesrout/d8fa1166444ebd5e9fc278f9d924e1ce to your computer and use it in GitHub Desktop.
Save milesrout/d8fa1166444ebd5e9fc278f9d924e1ce to your computer and use it in GitHub Desktop.
Compiler output from qcc
long func1(long x, long y)
{
long a, b, c;
a = x + y;
b = y - x;
a = a + 2;
a = a * b;
b = b + 2;
b = b * a;
c = a + b;
return c;
}
long func2(long x, long y)
{
long a, b;
a = x + y;
b = y - x;
a = a + 2;
a = a * b;
b = b + 2;
b = b * a;
return a + b;
}
func1:
call t0,__riscv_save_4
addi fp,sp,-48
add s1,a0,a1
sub s2,a1,a0
addi s1,s1,2
mul s1,s1,s2
addi s2,s2,2
mul s2,s2,s1
add s3,s1,s2
mv a0,s3
tail __riscv_restore_4
func2:
call t0,__riscv_save_3
addi fp,sp,-32
add s1,a0,a1
sub s2,a1,a0
addi s1,s1,2
mul s1,s1,s2
addi s2,s2,2
mul s2,s2,s1
add a0,s1,s2
tail __riscv_restore_3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment