Faltava el nou directori
This commit is contained in:
2
MathWorld/Makefile
Normal file
2
MathWorld/Makefile
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
build:
|
||||||
|
gcc -g src/MathWorld.c src/*.s -o out_a64
|
||||||
BIN
MathWorld/out_a64
Executable file
BIN
MathWorld/out_a64
Executable file
Binary file not shown.
33
MathWorld/src/MathWorld.c
Normal file
33
MathWorld/src/MathWorld.c
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
extern long long int aa_add(long long int a, long long int b);
|
||||||
|
extern long long int aa_sub(long long int a, long long int b);
|
||||||
|
extern long long int aa_mul(long long int a, long long int b);
|
||||||
|
extern long long int aa_madd(long long int a, long long int b, long long int c);
|
||||||
|
extern long long int aa_udiv(long long int a, long long int b);
|
||||||
|
|
||||||
|
extern double aa_fadd(double d, double e);
|
||||||
|
extern double aa_fdiv(double d, double e);
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
long long int a = 3;
|
||||||
|
long long int b = 2;
|
||||||
|
long long int c = 2;
|
||||||
|
|
||||||
|
double d = 3.2;
|
||||||
|
double e = 1.6;
|
||||||
|
|
||||||
|
|
||||||
|
printf("ARM ASSEMBLY 64-bit Integer Operations\n");
|
||||||
|
printf("ADD x0 %d x1 %d RET %d\n", a, b, aa_add(a, b));
|
||||||
|
printf("SUB x0 %d x1 %d RET %d\n", a, b, aa_sub(a, b));
|
||||||
|
printf("MUL x0 %d x1 %d RET %d\n", a, b, aa_mul(a, b));
|
||||||
|
printf("MADD x0 %d x1 %d x2 %d RET %d\n", a, b, c, aa_madd(a, b, c));
|
||||||
|
printf("UDIV x0 %d x1 %d RET %d\n", a, b, aa_udiv(a, b));
|
||||||
|
|
||||||
|
printf("ARM ASSEMBLY 64-bit Floating Point Operations\n");
|
||||||
|
printf("FADD d0 %lf d1 %lf RET %lf\n", d, e, aa_fadd(d, e));
|
||||||
|
printf("FDIV d0 %lf d1 %lf RET %lf\n", d, e, aa_fdiv(d, e));
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
6
MathWorld/src/aa_add.s
Normal file
6
MathWorld/src/aa_add.s
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.global aa_add
|
||||||
|
.type aa_add, "function"
|
||||||
|
.p2align 4
|
||||||
|
aa_add:
|
||||||
|
add x0, x0, x1
|
||||||
|
ret
|
||||||
6
MathWorld/src/aa_fadd.s
Normal file
6
MathWorld/src/aa_fadd.s
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.global aa_fadd
|
||||||
|
.type aa_fadd, "function"
|
||||||
|
.p2align 4
|
||||||
|
aa_fadd:
|
||||||
|
fadd d0, d0, d1
|
||||||
|
ret
|
||||||
6
MathWorld/src/aa_fdiv.s
Normal file
6
MathWorld/src/aa_fdiv.s
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.global aa_fdiv
|
||||||
|
.type aa_fdiv, "function"
|
||||||
|
.p2align 4
|
||||||
|
aa_fdiv:
|
||||||
|
fdiv d0, d0, d1
|
||||||
|
ret
|
||||||
6
MathWorld/src/aa_madd.s
Normal file
6
MathWorld/src/aa_madd.s
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.global aa_madd
|
||||||
|
.type aa_madd, "function"
|
||||||
|
.p2align 4
|
||||||
|
aa_madd:
|
||||||
|
madd x0, x0, x1, x2
|
||||||
|
ret
|
||||||
6
MathWorld/src/aa_mul.s
Normal file
6
MathWorld/src/aa_mul.s
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.global aa_mul
|
||||||
|
.type aa_mul, "function"
|
||||||
|
.p2align 4
|
||||||
|
aa_mul:
|
||||||
|
madd x0, x0, x1, XZR
|
||||||
|
ret
|
||||||
6
MathWorld/src/aa_sub.s
Normal file
6
MathWorld/src/aa_sub.s
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.global aa_sub
|
||||||
|
.type aa_sub, "function"
|
||||||
|
.p2align 4
|
||||||
|
aa_sub:
|
||||||
|
sub x0, x0, x1
|
||||||
|
ret
|
||||||
6
MathWorld/src/aa_udiv.s
Normal file
6
MathWorld/src/aa_udiv.s
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.global aa_udiv
|
||||||
|
.type aa_udiv, "function"
|
||||||
|
.p2align 4
|
||||||
|
aa_udiv:
|
||||||
|
udiv x0, x0, x1
|
||||||
|
ret
|
||||||
Reference in New Issue
Block a user