From a0b600a89c2e6e636579fe727235d036c08c7a9d Mon Sep 17 00:00:00 2001 From: rodri Date: Wed, 29 Nov 2023 21:19:16 +0000 Subject: remove instructions recently added to 9front. implemented some tests. --- main.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 51a2f89..1c22cd8 100644 --- a/main.c +++ b/main.c @@ -3,6 +3,7 @@ #include double min(double, double); +double dotvec2_sse(Point2, Point2); double dotvec2_sse4(Point2, Point2); double dotvec2_avx(Point2, Point2); double dotvec3_sse4(Point3, Point3); @@ -14,6 +15,15 @@ double fma(double, double, double); Point2 addpt2_sse(Point2, Point2); Point2 addpt2_avx(Point2, Point2); Point3 addpt3_avx(Point3, Point3); +void addsub_sse(double*,double*); +double round(double); + +void +addsub(double *a, double *b) +{ + b[0] = b[0]-a[0]; + b[1] = b[1]+a[1]; +} double fmin(double a, double b) @@ -31,6 +41,7 @@ void main(int argc, char *argv[]) { double a, b, r; + double va[2], vb[2]; Point2 p0, p1, pr; Point3 p0t, p1t, prt; @@ -56,6 +67,9 @@ main(int argc, char *argv[]) r = dotvec2(p0, p1); print("dotvec2(%v, %v) = %g\n", p0, p1, r); r = 0; + r = dotvec2_sse(p0, p1); + print("dotvec2_sse(%v, %v) = %g\n", p0, p1, r); + r = 0; r = dotvec2_sse4(p0, p1); print("dotvec2_sse4(%v, %v) = %g\n", p0, p1, r); r = 0; @@ -127,5 +141,25 @@ main(int argc, char *argv[]) prt = addpt3_avx(p0t, p1t); print("addpt3_avx(%V, %V) = %V\n", p0t, p1t, prt); + print("\n"); + + va[0] = va[1] = a; + vb[0] = vb[1] = b; + print("addsub([%g %g], [%g %g]) = ", va[0], va[1], vb[0], vb[1]); + addsub(va, vb); + print("[%g %g]\n", vb[0], vb[1]); + + va[0] = va[1] = a; + vb[0] = vb[1] = b; + print("addsub_sse([%g %g], [%g %g]) = ", va[0], va[1], vb[0], vb[1]); + addsub_sse(va, vb); + print("[%g %g]\n", vb[0], vb[1]); + + print("\n"); + + r = 0; + r = round(a); + print("round(%g) = %g\n", a, r); + exits(nil); } -- cgit v1.2.3