guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 157/437: Add two extra test cases for float operations.


From: Andy Wingo
Subject: [Guile-commits] 157/437: Add two extra test cases for float operations.
Date: Mon, 2 Jul 2018 05:14:08 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit b43ea1f908866baaf14586e6d048bff4dbf6db1f
Author: pcpa <address@hidden>
Date:   Mon Dec 17 17:55:38 2012 -0200

    Add two extra test cases for float operations.
    
        * check/fop_abs.ok, check/fop_abs.tst, check/fop_sqrt.ok,
        check/fop_sqrt.tst: New files implementing simple test cases
        for the extra float operations.
    
        * check/Makefile.am: Update for new test cases.
    
        * check/alu.inc: Add an extra macro to check for unordered
        equality on tests where it is expected to use NaN as an
        argument.
    
        * check/lightning.c: Minor change for proper/common argument
        syntax handling ommiting arguments to options.
---
 ChangeLog          | 15 +++++++++++++++
 check/Makefile.am  |  3 +++
 check/alu.inc      | 35 +++++++++++++++++++++++++++++++++++
 check/fop_abs.ok   |  1 +
 check/fop_abs.tst  | 31 +++++++++++++++++++++++++++++++
 check/fop_sqrt.ok  |  1 +
 check/fop_sqrt.tst | 23 +++++++++++++++++++++++
 check/lightning.c  | 16 ++++++++--------
 8 files changed, 117 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3b014b5..fc92165 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2012-12-17 Paulo Andrade <address@hidden>
 
+       * check/fop_abs.ok, check/fop_abs.tst, check/fop_sqrt.ok,
+       check/fop_sqrt.tst: New files implementing simple test cases
+       for the extra float operations.
+
+       * check/Makefile.am: Update for new test cases.
+
+       * check/alu.inc: Add an extra macro to check for unordered
+       equality on tests where it is expected to use NaN as an
+       argument.
+
+       * check/lightning.c: Minor change for proper/common argument
+       syntax handling ommiting arguments to options.
+
+2012-12-17 Paulo Andrade <address@hidden>
+
        * check/Makefile.am: Automatically generate pattern list
        of tests with alternate jit generation options. This should
        prevent typos and needing to change multiple places after
diff --git a/check/Makefile.am b/check/Makefile.am
index 08c61d7..8902844 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -57,6 +57,8 @@ EXTRA_DIST =                          \
        alu_rsh.tst     alu_rsh.ok      \
        alu_com.tst     alu_com.ok      \
        alu_neg.tst     alu_neg.ok      \
+       fop_abs.tst     fop_abs.ok      \
+       fop_sqrt.tst    fop_sqrt.ok     \
        varargs.tst     varargs.ok      \
        check.sh                        \
        check.x87.sh                    \
@@ -76,6 +78,7 @@ base_TESTS =                          \
        alu_and alu_or alu_xor          \
        alu_lsh alu_rsh                 \
        alu_com alu_neg                 \
+       fop_abs fop_sqrt                \
        varargs
 
 $(base_TESTS): check.sh
diff --git a/check/alu.inc b/check/alu.inc
index 7edf6b2..571f4c5 100644
--- a/check/alu.inc
+++ b/check/alu.inc
@@ -281,3 +281,38 @@ OP##N##T##c##R0##R1:
        FUN1(N, T, OP, I, V, f0, f3)                    \
        FUN1(N, T, OP, I, V, f0, f4)                    \
        FUN1(N, T, OP, I, V, f0, f5)
+
+/* unordered comparison unary float */
+
+#define UFUNR(N, T, OP, I, V, R0, R1)                  \
+       movi##T %R1 I                                   \
+       OP##r##T %R0 %R1                                \
+       buneqi##T OP##N##T##u##R0##R1 %R0 V             \
+       calli @abort                                    \
+OP##N##T##u##R0##R1:
+
+#define UFUNRC(N, T, OP, I, V, R0, R1)                 \
+       movi##T %R0 I                                   \
+       OP##r##T %R0 %R0                                \
+       buneqi##T OP##N##T##uc##R0##R1 %R0 V            \
+       calli @abort                                    \
+OP##N##T##uc##R0##R1:
+
+#define UFUN2(N, T, OP, I, V, R0, R1)                  \
+       UFUNR(N, T, OP, I, V, R0, R1)                   \
+       UFUNRC(N, T, OP, I, V, R0, R1)
+
+#define UFUN1(N, T, OP, I, V, R0, R1)                  \
+       UFUN2(N, T, OP, I, V, R0, R1)                   \
+       UFUN2(N, T, OP, I, V, R1, R0)
+
+#define UFUN(N, T, OP, I, V)                           \
+       UFUN1(N, T, OP, I, V, f0, f1)                   \
+       UFUN1(N, T, OP, I, V, f0, f2)                   \
+       UFUN1(N, T, OP, I, V, f0, f3)                   \
+       UFUN1(N, T, OP, I, V, f0, f4)                   \
+       UFUN1(N, T, OP, I, V, f0, f5)
+
+.      $( $NaN =  0.0/0.0)
+.      $( $Inf =  1.0/0.0)
+.      $($nInf = -1.0/0.0)
diff --git a/check/fop_abs.ok b/check/fop_abs.ok
new file mode 100644
index 0000000..9766475
--- /dev/null
+++ b/check/fop_abs.ok
@@ -0,0 +1 @@
+ok
diff --git a/check/fop_abs.tst b/check/fop_abs.tst
new file mode 100644
index 0000000..cb7be14
--- /dev/null
+++ b/check/fop_abs.tst
@@ -0,0 +1,31 @@
+#include "alu.inc"
+
+.code
+       prolog
+#define ABS(N, T, I, V)                FUN(N, T, abs, I, V)
+#define UABS(N, T, I, V)       UFUN(N, T, abs, I, V)
+       ABS(0, _f,      -0.0,            0.0)
+       ABS(1, _f,       0.5,            0.5)
+       ABS(2, _f,      -0.5,            0.5)
+       ABS(3, _f,      $Inf,           $Inf)
+       ABS(4, _f,      $nInf,          $Inf)
+       ABS(5, _f,       1.25,          1.25)
+       ABS(6, _f,      -1.25,          1.25)
+       ABS(7, _f,      $nInf,          $Inf)
+       UABS(0, _f,     $NaN,           $NaN)
+       ABS(0, _d,      -0.0,            0.0)
+       ABS(1, _d,       0.5,            0.5)
+       ABS(2, _d,      -0.5,            0.5)
+       ABS(3, _d,      $Inf,           $Inf)
+       ABS(4, _d,      $nInf,          $Inf)
+       ABS(5, _d,       1.25,           1.25)
+       ABS(6, _d,      -1.25,           1.25)
+       ABS(7, _d,      $nInf,          $Inf)
+       UABS(0, _d,     $NaN,           $NaN)
+
+       prepare
+               pushargi ok
+               ellipsis
+       finishi @printf
+       ret
+       epilog
diff --git a/check/fop_sqrt.ok b/check/fop_sqrt.ok
new file mode 100644
index 0000000..9766475
--- /dev/null
+++ b/check/fop_sqrt.ok
@@ -0,0 +1 @@
+ok
diff --git a/check/fop_sqrt.tst b/check/fop_sqrt.tst
new file mode 100644
index 0000000..fa93dbc
--- /dev/null
+++ b/check/fop_sqrt.tst
@@ -0,0 +1,23 @@
+#include "alu.inc"
+
+.code
+       prolog
+#define SQRT(N, T, I, V)       FUN(N, T, sqrt, I, V)
+#define USQRT(N, T, I, V)      UFUN(N, T, sqrt, I, V)
+        SQRT(0, _f,    -0.0,            0.0)
+        SQRT(1, _f,     4.0,            2.0)
+        SQRT(2, _f,     2.25,           1.5)
+        SQRT(3, _f,    $Inf,           $Inf)
+       USQRT(0, _f,    $NaN,           $NaN)
+        SQRT(0, _d,    -0.0,            0.0)
+        SQRT(1, _d,     4.0,            2.0)
+        SQRT(2, _d,     2.25,           1.5)
+        SQRT(3, _d,    $Inf,           $Inf)
+       USQRT(0, _d,    $NaN,           $NaN)
+
+       prepare
+               pushargi ok
+               ellipsis
+       finishi @printf
+       ret
+       epilog
diff --git a/check/lightning.c b/check/lightning.c
index 9c09c8c..6c11802 100644
--- a/check/lightning.c
+++ b/check/lightning.c
@@ -1801,7 +1801,7 @@ get_label(skip_t skip)
            (void)identifier(ch);
            break;
        default:
-           error("expecting label");
+           error("expecting label/immediate");
     }
     if ((label = get_label_by_name(parser.string)) == NULL)
        label = new_label(label_kind_code_forward,
@@ -3761,20 +3761,20 @@ Jit assembler options:\n\
 int
 main(int argc, char *argv[])
 {
-    static const char  *short_options = "v:";
+    static const char  *short_options = "v::";
     static struct option long_options[] = {
        { "help",               0, 0, 'h' },
 #if defined(__i386__) && __WORDSIZE == 32
-       { "mx87",               1, 0, '7' },
+       { "mx87",               2, 0, '7' },
 #endif
 #if defined(__i386__) || defined(__x86_64__)
-       { "msse4_1",            1, 0, '4' },
+       { "msse4_1",            2, 0, '4' },
 #endif
 #if defined(__arm__)
-       { "mcpu",               1, 0, 'c' },
-       { "mthumb",             1, 0, 't' },
-       { "mvfp",               1, 0, 'f' },
-       { "mneon",              1, 0, 'n' },
+       { "mcpu",               2, 0, 'c' },
+       { "mthumb",             2, 0, 't' },
+       { "mvfp",               2, 0, 'f' },
+       { "mneon",              2, 0, 'n' },
 #endif
        { 0,                    0, 0, 0   }
     };



reply via email to

[Prev in Thread] Current Thread [Next in Thread]