From 7498f1f9c08c85857cb2f1c14a5257bfd67d09e9 Mon Sep 17 00:00:00 2001 From: nefanov Date: Sat, 25 Jun 2022 11:26:32 +0300 Subject: [PATCH 1/5] -re option for runtime check of compiled file --- run.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 6715227..5da8239 100755 --- a/run.py +++ b/run.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 from os import walk, system, getcwd, sep +from os.path import exists from time import sleep import sys @@ -14,20 +15,39 @@ if ("--all" in sys.argv): else: f.extend([s for s in sys.argv if s.endswith(".c")]) if ("--no-run" in sys.argv): + print("--no-run option is about compilation, not runtime; We should rename it in future") norun=True if "--rm-artifacts" in sys.argv: noartifacts = True for l in f: - print("====== Test "+l+" ======") + print("========================= Test "+l+" =========================") print("Compiling file: ") _str = "maple --no-maple-phase " + getcwd()+ sep + "src" + sep + l print(_str) if norun == False: + try: + if exists("a.out"): + system("rm a.out") + sleep(1) + except: + pass + system(_str) sleep(5) + if ("--run-executable" in sys.argv or "-re" in sys.argv): + print("*"*30) + print("Runtime check:") + print("*"*30) + if exists("a.out"): + system("qemu-aarch64 a.out") + sleep(5) + else: + print("No executable found. Error") + print("*"*30) + if noartifacts == True: print("removing artifacts...") - system("cd src && rm *.ast *.mpl *.s && cd -") + system("cd src && rm *.ast *.mpl *.s *.outp && cd -") -- Gitee From 07e573d34c8bbb07de55fdd5e7b8a0c5e031fcdf Mon Sep 17 00:00:00 2001 From: NikolayEfanov Date: Sun, 17 Jul 2022 19:43:54 +0000 Subject: [PATCH 2/5] extra tests added --- src/acc_loss.c | 16 ++++++++++++++++ src/fp16.c | 4 ++++ src/test_arr.c | 13 +++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 src/acc_loss.c create mode 100644 src/fp16.c create mode 100644 src/test_arr.c diff --git a/src/acc_loss.c b/src/acc_loss.c new file mode 100644 index 0000000..3f24938 --- /dev/null +++ b/src/acc_loss.c @@ -0,0 +1,16 @@ +#include +#include +#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679 + +/* + * Check of accuracy limit for double / quad float point implementation + * quad precision for PI: 3.141592653589793115997963468544185 + * double precision for PI: 3.1415927410125732421875 + */ + +int main() { + double d = PI; + long double ld = PI; + printf("--- double: ---\n%.*lf\n--- long double: ---\n%.*Lf\n",DBL_DIG, d, LDBL_DIG, ld); + return 0; +} diff --git a/src/fp16.c b/src/fp16.c new file mode 100644 index 0000000..2920924 --- /dev/null +++ b/src/fp16.c @@ -0,0 +1,4 @@ +int main() { + _Decimal c=1.2; + return 0; +} diff --git a/src/test_arr.c b/src/test_arr.c new file mode 100644 index 0000000..f2e4e86 --- /dev/null +++ b/src/test_arr.c @@ -0,0 +1,13 @@ +#include + +int main() { + long double arr[2]; + arr[0]=1.2L; + arr[1]=4535.542L; + int i; + for (i=0;i<2;i++) { + printf("Number :\n"); + printf("%Lf\n", arr[i]); + } + return 0; +} -- Gitee From 6f54551acfa8b7320807fcab56652f1800332bd9 Mon Sep 17 00:00:00 2001 From: NikolayEfanov Date: Sun, 17 Jul 2022 19:53:07 +0000 Subject: [PATCH 3/5] extra cvt test --- src/cvt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/cvt.c diff --git a/src/cvt.c b/src/cvt.c new file mode 100644 index 0000000..b50488a --- /dev/null +++ b/src/cvt.c @@ -0,0 +1,10 @@ +#include + +int main() { + long a = 10; + int b = 100; + unsigned long c = 1000; + long double res = (long double)(1) + (long double)(a) + b + (double)(c); + printf("%Lf\n", res); + return 0; +} -- Gitee From 46cbca9fbe8660567559644ca11885ffff62301b Mon Sep 17 00:00:00 2001 From: NikolayEfanov Date: Mon, 25 Jul 2022 21:38:37 +0000 Subject: [PATCH 4/5] add src/issues_noieee_softfp_and_f128_cvt.cpp. --- src/issues_noieee_softfp_and_f128_cvt.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/issues_noieee_softfp_and_f128_cvt.cpp diff --git a/src/issues_noieee_softfp_and_f128_cvt.cpp b/src/issues_noieee_softfp_and_f128_cvt.cpp new file mode 100644 index 0000000..892ac1b --- /dev/null +++ b/src/issues_noieee_softfp_and_f128_cvt.cpp @@ -0,0 +1,10 @@ +double m() { double b = 1.3L; return b; } // exotic but should be handled + +// Some libgcc function is not found??? (test `__truncxfdf2', should be replaced to __trunctdf2) +double m2() { long double a = 1.2L; double b = 1.3; b = (double)(a)+b; return b; } + +int main() { + m(); + m2(); + return 0; +} \ No newline at end of file -- Gitee From 964532842c5579787e1fcb7ada56d6866caf81ae Mon Sep 17 00:00:00 2001 From: NikolayEfanov Date: Mon, 25 Jul 2022 21:45:11 +0000 Subject: [PATCH 5/5] update src/issues_noieee_softfp_and_f128_cvt.cpp. --- src/issues_noieee_softfp_and_f128_cvt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/issues_noieee_softfp_and_f128_cvt.cpp b/src/issues_noieee_softfp_and_f128_cvt.cpp index 892ac1b..a5ef68d 100644 --- a/src/issues_noieee_softfp_and_f128_cvt.cpp +++ b/src/issues_noieee_softfp_and_f128_cvt.cpp @@ -1,6 +1,6 @@ double m() { double b = 1.3L; return b; } // exotic but should be handled -// Some libgcc function is not found??? (test `__truncxfdf2', should be replaced to __trunctdf2) +// Some libgcc functions are not found(?) (test `__truncxfdf2', should be replaced to __trunctfdf2) double m2() { long double a = 1.2L; double b = 1.3; b = (double)(a)+b; return b; } int main() { -- Gitee