From ff056d4ecc0dc7d05c2feca803f4ea35324659b3 Mon Sep 17 00:00:00 2001 From: Pei Mu Date: Wed, 7 Jun 2023 13:46:01 +0100 Subject: [PATCH] considering time consumption, we use a simple version of mulfix Addresses #653. --- ...4f911572e0d79684beb60960146404aecbbc92.txt | 46 +++++++++++++++++++ .../newton/llvm-ir/c-files/MadgwickAHRSfix.c | 16 +++---- 2 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 analysis/statistics/904f911572e0d79684beb60960146404aecbbc92.txt diff --git a/analysis/statistics/904f911572e0d79684beb60960146404aecbbc92.txt b/analysis/statistics/904f911572e0d79684beb60960146404aecbbc92.txt new file mode 100644 index 000000000..e13ee6327 --- /dev/null +++ b/analysis/statistics/904f911572e0d79684beb60960146404aecbbc92.txt @@ -0,0 +1,46 @@ + +changeset: 1500:904f911572e0d79684beb60960146404aecbbc92 +char kNewtonVersion[] = "0.3-alpha-1500 (904f911572e0d79684beb60960146404aecbbc92) (build 06-07-2023-12:34-pei@pei-G5-5500-Linux-5.19.0-43-generic-x86_64)"; +\n./src/noisy/noisy-linux-EN -O0 applications/noisy/helloWorld.n -s +\n./src/newton/newton-linux-EN -v 0 -eP applications/newton/invariants/ViolinWithTemperatureDependence-pigroups.nt + +Informational Report: +--------------------- +Invariant "ViolinWithTemperatureDependenceForPiGroups" has 2 unique kernels, each with 2 column(s)... + + Kernel 0 is a valid kernel: + + 1 1 + -0.5 -0 + 1 0 + 0.5 0 + 0 -1 + -0 -1 + + + The ordering of parameters is: P1 P0 P3 P2 P4 P5 + + Pi group 0, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^( 0) P5^(-0) + + Pi group 0, Pi 1 is: P0^(-0) P1^( 1) P2^( 0) P3^( 0) P4^(-1) P5^(-1) + + + Kernel 1 is a valid kernel: + + 1 0 + -0.5 1 + 1 -2 + 0.5 -1 + -0 -2 + 0 -2 + + + The ordering of parameters is: P1 P0 P3 P2 P4 P5 + + Pi group 1, Pi 0 is: P0^(-0.5) P1^( 1) P2^(0.5) P3^( 1) P4^(-0) P5^( 0) + + Pi group 1, Pi 1 is: P0^( 1) P1^( 0) P2^(-1) P3^(-2) P4^(-2) P5^(-2) + + + + diff --git a/applications/newton/llvm-ir/c-files/MadgwickAHRSfix.c b/applications/newton/llvm-ir/c-files/MadgwickAHRSfix.c index 4ccbe312c..a3bac90ee 100644 --- a/applications/newton/llvm-ir/c-files/MadgwickAHRSfix.c +++ b/applications/newton/llvm-ir/c-files/MadgwickAHRSfix.c @@ -51,14 +51,14 @@ volatile bmx055xAcceleration beta = (uint8_t)(betaDef*FRAC_BASE); //0.1f // 2 int32_t mulfix(int32_t x, int32_t y) { - int32_t result; - int64_t temp; - temp = (int64_t)x * (int64_t)y; - temp += K; - result = round(temp/FRAC_BASE); - return result; +// int32_t result; +// int64_t temp; +// temp = (int64_t)x * (int64_t)y; +// temp += K; +// result = round(temp/FRAC_BASE); +// return result; // return ((int64_t)(x*y)) > 0 ? ((int64_t)(x*y))>>FRAC_Q : (((int64_t)(x*y))>>FRAC_Q)+1; -// return ((int64_t)x*y)/FRAC_BASE; + return ((int64_t)x*y)/FRAC_BASE; } /* @@ -74,7 +74,7 @@ sqrt_rsqrt(int32_t x, int recip) { i = 0x5f3759df - (i>>1); fp_y = *(float*)&i; fp_y = fp_y * (1.5f - (halfx * fp_y * fp_y)); - return round(fp_y*FRAC_BASE); + return fp_y*FRAC_BASE; } else { int32_t res = (int32_t)sqrtf(x)<<(FRAC_Q/2); if (FRAC_Q%2)