aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/absr_d.c22
-rw-r--r--tests/absr_f.c12
-rw-r--r--tests/addr_d.c24
-rw-r--r--tests/addr_f.c18
-rw-r--r--tests/beqr_d.c37
-rw-r--r--tests/beqr_f.c48
-rw-r--r--tests/bgtr_d.c34
-rw-r--r--tests/bgtr_f.c39
-rw-r--r--tests/bler_d.c34
-rw-r--r--tests/bler_f.c39
-rw-r--r--tests/bltr_d.c34
-rw-r--r--tests/bltr_f.c25
-rw-r--r--tests/bner_d.c37
-rw-r--r--tests/bner_f.c45
-rw-r--r--tests/divr_d.c24
-rw-r--r--tests/divr_f.c17
-rw-r--r--tests/eqr_d.c26
-rw-r--r--tests/eqr_f.c18
-rw-r--r--tests/gtr_d.c25
-rw-r--r--tests/gtr_f.c8
-rw-r--r--tests/ldi_d.c2
-rw-r--r--tests/ldxi_d.c2
-rw-r--r--tests/ldxr_d.c2
-rw-r--r--tests/ler_d.c26
-rw-r--r--tests/ler_f.c14
-rw-r--r--tests/ltr_d.c27
-rw-r--r--tests/ltr_f.c12
-rw-r--r--tests/movi_d.c16
-rw-r--r--tests/movi_f.c4
-rw-r--r--tests/movr_d.c19
-rw-r--r--tests/movr_f.c8
-rw-r--r--tests/mulr_d.c24
-rw-r--r--tests/mulr_f.c14
-rw-r--r--tests/negr_d.c25
-rw-r--r--tests/negr_f.c14
-rw-r--r--tests/ner_d.c25
-rw-r--r--tests/ner_f.c10
-rw-r--r--tests/subr_d.c27
-rw-r--r--tests/subr_f.c12
-rw-r--r--tests/truncr_f_32.c29
-rw-r--r--tests/truncr_f_64.c29
41 files changed, 711 insertions, 196 deletions
diff --git a/tests/absr_d.c b/tests/absr_d.c
new file mode 100644
index 0000000..20424a7
--- /dev/null
+++ b/tests/absr_d.c
@@ -0,0 +1,22 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[1] = {
+ EJIT_OPERAND_FPR(0, EJIT_DOUBLE)
+ };
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 1, operands);
+ ejit_absr_d(f, EJIT_FPR(0), EJIT_FPR(0));
+ ejit_retr_d(f, EJIT_FPR(0));
+ ejit_select_compile_func(f, 0, 1, false, do_jit);
+
+ assert(erff1(f, EJIT_ARG(0.0, double)) == 0.0);
+ assert(erff1(f, EJIT_ARG(-0.0, double)) == 0.0);
+ assert(erff1(f, EJIT_ARG(0.5, double)) == 0.5);
+ assert(erff1(f, EJIT_ARG(-0.5, double)) == 0.5);
+ ejit_destroy_func(f);
+}
diff --git a/tests/absr_f.c b/tests/absr_f.c
index d5411e5..876d82c 100644
--- a/tests/absr_f.c
+++ b/tests/absr_f.c
@@ -7,16 +7,16 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[1] = {
- EJIT_OPERAND_FPR(0, EJIT_DOUBLE)
+ EJIT_OPERAND_FPR(0, EJIT_FLOAT)
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 1, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(float), 1, operands);
ejit_absr_f(f, EJIT_FPR(0), EJIT_FPR(0));
ejit_retr_f(f, EJIT_FPR(0));
ejit_select_compile_func(f, 0, 1, false, do_jit);
- assert(ejit_run_func_f_1(f, EJIT_ARG(0.0, double)) == 0.0);
- assert(ejit_run_func_f_1(f, EJIT_ARG(-0.0, double)) == 0.0);
- assert(ejit_run_func_f_1(f, EJIT_ARG(0.5, double)) == 0.5);
- assert(ejit_run_func_f_1(f, EJIT_ARG(-0.5, double)) == 0.5);
+ assert(ejit_run_func_f_1(f, EJIT_ARG(0.0, float)) == 0.0);
+ assert(ejit_run_func_f_1(f, EJIT_ARG(-0.0, float)) == 0.0);
+ assert(ejit_run_func_f_1(f, EJIT_ARG(0.5, float)) == 0.5);
+ assert(ejit_run_func_f_1(f, EJIT_ARG(-0.5, float)) == 0.5);
ejit_destroy_func(f);
}
diff --git a/tests/addr_d.c b/tests/addr_d.c
new file mode 100644
index 0000000..db48ef6
--- /dev/null
+++ b/tests/addr_d.c
@@ -0,0 +1,24 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
+
+ ejit_addr_d(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr_d(f, EJIT_FPR(0));
+
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+
+ assert(erff2(f, EJIT_ARG(42., double), EJIT_ARG(69., double)) == 111.);
+ assert(erff2(f, EJIT_ARG(42.5, double), EJIT_ARG(69.5, double)) == 112.);
+ ejit_destroy_func(f);
+}
diff --git a/tests/addr_f.c b/tests/addr_f.c
index cfaa173..6eecbfb 100644
--- a/tests/addr_f.c
+++ b/tests/addr_f.c
@@ -7,20 +7,22 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(float), 2, operands);
ejit_addr_f(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1));
ejit_retr_f(f, EJIT_FPR(0));
- ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(float), do_jit);
+
+ assert(erff2(f, EJIT_ARG(42., float), EJIT_ARG(69., float)
+ ) == 111.);
+
+ assert(erff2(f, EJIT_ARG(42.5, float), EJIT_ARG(69.5, float)
+ ) == 112.);
- assert(ejit_run_func_f_2(f, EJIT_ARG(42., double),
- EJIT_ARG(69., double)) == 111.);
- assert(ejit_run_func_f_2(f, EJIT_ARG(42.5, double),
- EJIT_ARG(69.5, double)) == 112.);
ejit_destroy_func(f);
}
diff --git a/tests/beqr_d.c b/tests/beqr_d.c
new file mode 100644
index 0000000..62e4269
--- /dev/null
+++ b/tests/beqr_d.c
@@ -0,0 +1,37 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+
+ struct ejit_reloc r = ejit_beqr_d(f, EJIT_FPR(0), EJIT_FPR(1));
+ ejit_reti(f, 0);
+
+ struct ejit_label l = ejit_label(f);
+ ejit_patch(f, r, l);
+
+ ejit_reti(f, 1);
+
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(1, double)) == 0);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(-1, double)) == 0);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 1);
+
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0.0/0.0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0.0/0.0, double), EJIT_ARG(0, double)) == 0);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/beqr_f.c b/tests/beqr_f.c
index a8319ba..00bd84c 100644
--- a/tests/beqr_f.c
+++ b/tests/beqr_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -21,25 +21,31 @@ int main(int argc, char *argv[])
ejit_reti(f, 1);
- ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
-
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(0, double)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(1, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, double),
- EJIT_ARG(0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, double),
- EJIT_ARG(0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(-1, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, double),
- EJIT_ARG(1, double)) == 1);
-
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(0.0/0.0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0.0/0.0, double),
- EJIT_ARG(0, double)) == 0);
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(float), do_jit);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0, float)
+ ) == 1);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(1, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(-1, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)
+ ) == 1);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0.0/0.0, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(0.0/0.0, float), EJIT_ARG(0, float)
+ ) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bgtr_d.c b/tests/bgtr_d.c
new file mode 100644
index 0000000..57e8d0e
--- /dev/null
+++ b/tests/bgtr_d.c
@@ -0,0 +1,34 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+ struct ejit_reloc r = ejit_bgtr_d(f, EJIT_FPR(0), EJIT_FPR(1));
+ ejit_reti(f, 0);
+
+ struct ejit_label l = ejit_label(f);
+ ejit_patch(f, r, l);
+ ejit_reti(f, 1);
+
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(long), do_jit);
+
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(1, double)) == 0);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(-1, double)) == 1);
+
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0.0/0.0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0.0/0.0, double), EJIT_ARG(0, double)) == 0);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/bgtr_f.c b/tests/bgtr_f.c
index 2942cff..6fa9b45 100644
--- a/tests/bgtr_f.c
+++ b/tests/bgtr_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -21,21 +21,26 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 2, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(1, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, double),
- EJIT_ARG(0, double)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, double),
- EJIT_ARG(0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(-1, double)) == 1);
-
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(0.0/0.0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0.0/0.0, double),
- EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(1, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)
+ ) == 1);
+
+ assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(-1, float)
+ ) == 1);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0.0/0.0, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(0.0/0.0, float), EJIT_ARG(0, float)
+ ) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bler_d.c b/tests/bler_d.c
new file mode 100644
index 0000000..3d3d1d7
--- /dev/null
+++ b/tests/bler_d.c
@@ -0,0 +1,34 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+ struct ejit_reloc r = ejit_bler_d(f, EJIT_FPR(0), EJIT_FPR(1));
+ ejit_reti(f, 0);
+
+ struct ejit_label l = ejit_label(f);
+ ejit_patch(f, r, l);
+ ejit_reti(f, 1);
+
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(long), do_jit);
+
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(1, double)) == 1);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(-1, double)) == 0);
+
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0.0/0.0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0.0/0.0, double), EJIT_ARG(0, double)) == 0);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/bler_f.c b/tests/bler_f.c
index 487900e..d49c13e 100644
--- a/tests/bler_f.c
+++ b/tests/bler_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -21,21 +21,26 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 2, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(0, double)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(1, double)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(1, double),
- EJIT_ARG(0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, double),
- EJIT_ARG(0, double)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(-1, double)) == 0);
-
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(0.0/0.0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0.0/0.0, double),
- EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0, float)
+ ) == 1);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(1, float)
+ ) == 1);
+
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)
+ ) == 1);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(-1, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0.0/0.0, float)
+ ) == 0);
+
+ assert(erf2(f, EJIT_ARG(0.0/0.0, float), EJIT_ARG(0, float)
+ ) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bltr_d.c b/tests/bltr_d.c
new file mode 100644
index 0000000..7d251be
--- /dev/null
+++ b/tests/bltr_d.c
@@ -0,0 +1,34 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+ struct ejit_reloc r = ejit_bltr_d(f, EJIT_FPR(0), EJIT_FPR(1));
+ ejit_reti(f, 0);
+
+ struct ejit_label l = ejit_label(f);
+ ejit_patch(f, r, l);
+ ejit_reti(f, 1);
+
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(long), do_jit);
+
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(1, double)) == 1);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(-1, double)) == 0);
+
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0.0/0.0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0.0/0.0, double), EJIT_ARG(0, double)) == 0);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/bltr_f.c b/tests/bltr_f.c
index 7cdd8fe..230a1bf 100644
--- a/tests/bltr_f.c
+++ b/tests/bltr_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -21,21 +21,14 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 2, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(1, double)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(1, double),
- EJIT_ARG(0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, double),
- EJIT_ARG(0, double)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(-1, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0, float)) == 0);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(1, float)) == 1);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 0);
+ assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)) == 1);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(-1, float)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, double),
- EJIT_ARG(0.0/0.0, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0.0/0.0, double),
- EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0.0/0.0, float)) == 0);
+ assert(erf2(f, EJIT_ARG(0.0/0.0, float), EJIT_ARG(0, float)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bner_d.c b/tests/bner_d.c
new file mode 100644
index 0000000..b4a2e46
--- /dev/null
+++ b/tests/bner_d.c
@@ -0,0 +1,37 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+ struct ejit_reloc r = ejit_bner_d(f, EJIT_FPR(0), EJIT_FPR(1));
+ ejit_reti(f, 0);
+
+ struct ejit_label l = ejit_label(f);
+ ejit_patch(f, r, l);
+
+ ejit_reti(f, 1);
+
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(1, double)) == 1);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(-1, double)) == 1);
+
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0, double), EJIT_ARG(0.0/0.0, double)) == 1);
+
+ assert(erf2(f, EJIT_ARG(0.0/0.0, double), EJIT_ARG(0, double)) == 1);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/bner_f.c b/tests/bner_f.c
index 3be835a..a48ef2c 100644
--- a/tests/bner_f.c
+++ b/tests/bner_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -21,39 +21,16 @@ int main(int argc, char *argv[])
ejit_reti(f, 1);
- ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(float), do_jit);
- assert(ejit_run_func_2(f,
- EJIT_ARG(0, double),
- EJIT_ARG(0, double)) == 0);
-
- assert(ejit_run_func_2(f,
- EJIT_ARG(0, double),
- EJIT_ARG(1, double)) == 1);
-
- assert(ejit_run_func_2(f,
- EJIT_ARG(1, double),
- EJIT_ARG(0, double)) == 1);
-
- assert(ejit_run_func_2(f,
- EJIT_ARG(-1, double),
- EJIT_ARG(0, double)) == 1);
-
- assert(ejit_run_func_2(f,
- EJIT_ARG(0, double),
- EJIT_ARG(-1, double)) == 1);
-
- assert(ejit_run_func_2(f,
- EJIT_ARG(1, double),
- EJIT_ARG(1, double)) == 0);
-
- assert(ejit_run_func_2(f,
- EJIT_ARG(0, double),
- EJIT_ARG(0.0/0.0, double)) == 1);
-
- assert(ejit_run_func_2(f,
- EJIT_ARG(0.0/0.0, double),
- EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0, float)) == 0);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(1, float)) == 1);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 1);
+ assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)) == 1);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(-1, float)) == 1);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 0);
+ assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0.0/0.0, float)) == 1);
+ assert(erf2(f, EJIT_ARG(0.0/0.0, float), EJIT_ARG(0, float)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/divr_d.c b/tests/divr_d.c
new file mode 100644
index 0000000..83012fa
--- /dev/null
+++ b/tests/divr_d.c
@@ -0,0 +1,24 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
+
+ ejit_divr_d(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr_d(f, EJIT_FPR(0));
+
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+
+ assert(erff2(f, EJIT_ARG(-0.5f, double), EJIT_ARG(0.5f, double)) == -1.0f);
+ assert(erff2(f, EJIT_ARG(1.25f, double), EJIT_ARG(0.5f, double)) == 2.5f);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/divr_f.c b/tests/divr_f.c
index 5ea1028..008f6ce 100644
--- a/tests/divr_f.c
+++ b/tests/divr_f.c
@@ -7,23 +7,18 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(float), 2, operands);
ejit_divr_f(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1));
ejit_retr_f(f, EJIT_FPR(0));
- ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(float), do_jit);
- assert(erff2(f,
- EJIT_ARG(-0.5f, double),
- EJIT_ARG(0.5f, double)) == -1.0f);
-
- assert(erff2(f,
- EJIT_ARG(1.25f, double),
- EJIT_ARG(0.5f, double)) == 2.5f);
+ assert(erff2(f, EJIT_ARG(-0.5f, float), EJIT_ARG(0.5f, float)) == -1.0f);
+ assert(erff2(f, EJIT_ARG(1.25f, float), EJIT_ARG(0.5f, float)) == 2.5f);
ejit_destroy_func(f);
}
diff --git a/tests/eqr_d.c b/tests/eqr_d.c
new file mode 100644
index 0000000..cfcf898
--- /dev/null
+++ b/tests/eqr_d.c
@@ -0,0 +1,26 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+
+ ejit_eqr_d(f, EJIT_GPR(0), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr(f, EJIT_GPR(0));
+
+ ejit_select_compile_func(f, 1, 2, EJIT_USE64(long), do_jit);
+
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 1);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(0.0/0.0, double), EJIT_ARG(0.0/0.0, double)) == 0);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/eqr_f.c b/tests/eqr_f.c
index 44ee409..572eeda 100644
--- a/tests/eqr_f.c
+++ b/tests/eqr_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -18,17 +18,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 2, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f,
- EJIT_ARG(1, double),
- EJIT_ARG(1, double)) == 1);
-
- assert(ejit_run_func_2(f,
- EJIT_ARG(1, double),
- EJIT_ARG(0, double)) == 0);
-
- assert(ejit_run_func_2(f,
- EJIT_ARG(0.0/0.0, double),
- EJIT_ARG(0.0/0.0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 1);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 0);
+ assert(erf2(f, EJIT_ARG(0.0/0.0, float), EJIT_ARG(0.0/0.0, float)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/gtr_d.c b/tests/gtr_d.c
new file mode 100644
index 0000000..35de463
--- /dev/null
+++ b/tests/gtr_d.c
@@ -0,0 +1,25 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+
+ ejit_gtr_d(f, EJIT_GPR(0), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr(f, EJIT_GPR(0));
+
+ ejit_select_compile_func(f, 1, 2, EJIT_USE64(long), do_jit);
+
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 1);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/gtr_f.c b/tests/gtr_f.c
index db60d4d..e65ad35 100644
--- a/tests/gtr_f.c
+++ b/tests/gtr_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -18,8 +18,8 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 2, EJIT_USE64(long), do_jit);
- assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
- assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 0);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/ldi_d.c b/tests/ldi_d.c
index 2aad277..15a48b4 100644
--- a/tests/ldi_d.c
+++ b/tests/ldi_d.c
@@ -10,7 +10,7 @@ int main(int argc, char *argv[])
bool do_jit = argc > 1;
struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 0, NULL);
ejit_ldi_d(f, EJIT_FPR(0), &data);
- ejit_retr_f(f, EJIT_FPR(0));
+ ejit_retr_d(f, EJIT_FPR(0));
ejit_select_compile_func(f, 1, 0, EJIT_USE64(double), do_jit);
diff --git a/tests/ldxi_d.c b/tests/ldxi_d.c
index 6b03073..98474d2 100644
--- a/tests/ldxi_d.c
+++ b/tests/ldxi_d.c
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 1, operands);
ejit_ldxi_d(f, EJIT_FPR(0), EJIT_GPR(0), (uintptr_t)data);
- ejit_retr_f(f, EJIT_FPR(0));
+ ejit_retr_d(f, EJIT_FPR(0));
ejit_select_compile_func(f, 1, 1, EJIT_USE64(long), do_jit);
diff --git a/tests/ldxr_d.c b/tests/ldxr_d.c
index e1e56e4..a2ed0b8 100644
--- a/tests/ldxr_d.c
+++ b/tests/ldxr_d.c
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
ejit_ldxr_d(f, EJIT_FPR(0), EJIT_GPR(0), EJIT_GPR(1));
- ejit_retr_f(f, EJIT_FPR(0));
+ ejit_retr_d(f, EJIT_FPR(0));
ejit_select_compile_func(f, 2, 1, false, do_jit);
diff --git a/tests/ler_d.c b/tests/ler_d.c
new file mode 100644
index 0000000..81dbda0
--- /dev/null
+++ b/tests/ler_d.c
@@ -0,0 +1,26 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+
+ ejit_ler_d(f, EJIT_GPR(0), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr(f, EJIT_GPR(0));
+
+ ejit_select_compile_func(f, 1, 2, EJIT_USE64(double), do_jit);
+
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 1);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(-1, double)) == 1);
+ ejit_destroy_func(f);
+}
diff --git a/tests/ler_f.c b/tests/ler_f.c
index 04765c8..82bd664 100644
--- a/tests/ler_f.c
+++ b/tests/ler_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -16,11 +16,11 @@ int main(int argc, char *argv[])
ejit_ler_f(f, EJIT_GPR(0), EJIT_FPR(0), EJIT_FPR(1));
ejit_retr(f, EJIT_GPR(0));
- ejit_select_compile_func(f, 1, 2, EJIT_USE64(double), do_jit);
+ ejit_select_compile_func(f, 1, 2, EJIT_USE64(float), do_jit);
- assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 1);
- assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
- assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 1);
- assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(-1, double)) == 1);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 1);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 0);
+ assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)) == 1);
+ assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(-1, float)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/ltr_d.c b/tests/ltr_d.c
new file mode 100644
index 0000000..600b820
--- /dev/null
+++ b/tests/ltr_d.c
@@ -0,0 +1,27 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+
+ ejit_ltr_d(f, EJIT_GPR(0), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr(f, EJIT_GPR(0));
+
+ ejit_select_compile_func(f, 1, 2, EJIT_USE64(long), do_jit);
+
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(-1, double)) == 0);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/ltr_f.c b/tests/ltr_f.c
index 863463f..94dd657 100644
--- a/tests/ltr_f.c
+++ b/tests/ltr_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -18,10 +18,10 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 2, EJIT_USE64(long), do_jit);
- assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
- assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
- assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 1);
- assert(erf2(f, EJIT_ARG(-1, double), EJIT_ARG(-1, double)) == 0);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 0);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 0);
+ assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)) == 1);
+ assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(-1, float)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/movi_d.c b/tests/movi_d.c
new file mode 100644
index 0000000..0b8e4f6
--- /dev/null
+++ b/tests/movi_d.c
@@ -0,0 +1,16 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 0, NULL);
+ ejit_movi_d(f, EJIT_FPR(0), 3.14159f);
+ ejit_retr_d(f, EJIT_FPR(0));
+ ejit_select_compile_func(f, 0, 1, EJIT_USE64(double), do_jit);
+
+ assert(ejit_run_func_f(f, 0, NULL) == 3.14159f);
+ ejit_destroy_func(f);
+}
diff --git a/tests/movi_f.c b/tests/movi_f.c
index f003c2d..fb986a0 100644
--- a/tests/movi_f.c
+++ b/tests/movi_f.c
@@ -6,10 +6,10 @@ int main(int argc, char *argv[])
{
(void)argv;
bool do_jit = argc > 1;
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 0, NULL);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(float), 0, NULL);
ejit_movi_f(f, EJIT_FPR(0), 3.14159f);
ejit_retr_f(f, EJIT_FPR(0));
- ejit_select_compile_func(f, 0, 1, EJIT_USE64(double), do_jit);
+ ejit_select_compile_func(f, 0, 1, EJIT_USE64(float), do_jit);
assert(ejit_run_func_f(f, 0, NULL) == 3.14159f);
ejit_destroy_func(f);
diff --git a/tests/movr_d.c b/tests/movr_d.c
new file mode 100644
index 0000000..1911ccf
--- /dev/null
+++ b/tests/movr_d.c
@@ -0,0 +1,19 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[1] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double))
+ };
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 1, operands);
+ ejit_movr_d(f, EJIT_FPR(1), EJIT_FPR(0));
+ ejit_retr_d(f, EJIT_FPR(1));
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+
+ assert(ejit_run_func_f_1(f, EJIT_ARG(42., double)) == 42.);
+ ejit_destroy_func(f);
+}
diff --git a/tests/movr_f.c b/tests/movr_f.c
index 9c73ead..890ec9d 100644
--- a/tests/movr_f.c
+++ b/tests/movr_f.c
@@ -7,13 +7,13 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[1] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 1, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(float), 1, operands);
ejit_movr_f(f, EJIT_FPR(1), EJIT_FPR(0));
ejit_retr_f(f, EJIT_FPR(1));
- ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(float), do_jit);
- assert(ejit_run_func_f_1(f, EJIT_ARG(42., double)) == 42.);
+ assert(ejit_run_func_f_1(f, EJIT_ARG(42., float)) == 42.);
ejit_destroy_func(f);
}
diff --git a/tests/mulr_d.c b/tests/mulr_d.c
new file mode 100644
index 0000000..dbac71f
--- /dev/null
+++ b/tests/mulr_d.c
@@ -0,0 +1,24 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
+
+ ejit_mulr_d(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr_d(f, EJIT_FPR(0));
+
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+
+ assert(erff2(f, EJIT_ARG(-0.5f, double), EJIT_ARG(0.50f, double)) == -0.25f);
+ assert(erff2(f, EJIT_ARG(0.25f, double), EJIT_ARG(0.75f, double)) == 0.1875f);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/mulr_f.c b/tests/mulr_f.c
index ad59b6e..c65d3eb 100644
--- a/tests/mulr_f.c
+++ b/tests/mulr_f.c
@@ -7,20 +7,18 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(float), 2, operands);
ejit_mulr_f(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1));
ejit_retr_f(f, EJIT_FPR(0));
- ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(float), do_jit);
- assert(erff2(f, EJIT_ARG(-0.5f, double),
- EJIT_ARG(0.50f, double)) == -0.25f);
- assert(erff2(f, EJIT_ARG(0.25f, double),
- EJIT_ARG(0.75f, double)) == 0.1875f);
+ assert(erff2(f, EJIT_ARG(-0.5f, float), EJIT_ARG(0.50f, float)) == -0.25f);
+ assert(erff2(f, EJIT_ARG(0.25f, float), EJIT_ARG(0.75f, float)) == 0.1875f);
ejit_destroy_func(f);
}
diff --git a/tests/negr_d.c b/tests/negr_d.c
new file mode 100644
index 0000000..b57dcea
--- /dev/null
+++ b/tests/negr_d.c
@@ -0,0 +1,25 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[1] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double))
+ };
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 1, operands);
+
+ ejit_negr_d(f, EJIT_FPR(0), EJIT_FPR(0));
+ ejit_retr_d(f, EJIT_FPR(0));
+
+ ejit_select_compile_func(f, 0, 1, EJIT_USE64(double), do_jit);
+
+ assert(erff1(f, EJIT_ARG(0.0f, double)) == -0.0f);
+ assert(erff1(f, EJIT_ARG(0.5f, double)) == -0.5f);
+ assert(erff1(f, EJIT_ARG(1.0f / 0.0f, double)) == -1.0f / 0.0f);
+ assert(erff1(f, EJIT_ARG(-1.25f, double)) == 1.25f);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/negr_f.c b/tests/negr_f.c
index 77b7474..392abc6 100644
--- a/tests/negr_f.c
+++ b/tests/negr_f.c
@@ -7,19 +7,19 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[1] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 1, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(float), 1, operands);
ejit_negr_f(f, EJIT_FPR(0), EJIT_FPR(0));
ejit_retr_f(f, EJIT_FPR(0));
- ejit_select_compile_func(f, 0, 1, EJIT_USE64(double), do_jit);
+ ejit_select_compile_func(f, 0, 1, EJIT_USE64(float), do_jit);
- assert(erff1(f, EJIT_ARG(0.0f, double)) == -0.0f);
- assert(erff1(f, EJIT_ARG(0.5f, double)) == -0.5f);
- assert(erff1(f, EJIT_ARG(1.0f / 0.0f, double)) == -1.0f / 0.0f);
- assert(erff1(f, EJIT_ARG(-1.25f, double)) == 1.25f);
+ assert(erff1(f, EJIT_ARG(0.0f, float)) == -0.0f);
+ assert(erff1(f, EJIT_ARG(0.5f, float)) == -0.5f);
+ assert(erff1(f, EJIT_ARG(1.0f / 0.0f, float)) == -1.0f / 0.0f);
+ assert(erff1(f, EJIT_ARG(-1.25f, float)) == 1.25f);
ejit_destroy_func(f);
}
diff --git a/tests/ner_d.c b/tests/ner_d.c
new file mode 100644
index 0000000..52a2f51
--- /dev/null
+++ b/tests/ner_d.c
@@ -0,0 +1,25 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+
+ ejit_ner_d(f, EJIT_GPR(0), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr(f, EJIT_GPR(0));
+
+ ejit_select_compile_func(f, 1, 2, EJIT_USE64(long), do_jit);
+
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
+ assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 1);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/ner_f.c b/tests/ner_f.c
index 687e9ed..fb60120 100644
--- a/tests/ner_f.c
+++ b/tests/ner_f.c
@@ -7,8 +7,8 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
@@ -18,10 +18,8 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 2, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(1, double),
- EJIT_ARG(1, double)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, double),
- EJIT_ARG(0, double)) == 1);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 0);
+ assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/subr_d.c b/tests/subr_d.c
new file mode 100644
index 0000000..ef2c431
--- /dev/null
+++ b/tests/subr_d.c
@@ -0,0 +1,27 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ };
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
+
+ ejit_subr_d(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr_d(f, EJIT_FPR(0));
+
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+
+ assert(erff2(f, EJIT_ARG(42., double), EJIT_ARG(69., double)
+ ) == -27.);
+
+ assert(erff2(f, EJIT_ARG(42.5, double), EJIT_ARG(69., double)
+ ) == -26.5);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/subr_f.c b/tests/subr_f.c
index 61c3916..a0f3059 100644
--- a/tests/subr_f.c
+++ b/tests/subr_f.c
@@ -7,20 +7,20 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_FPR(0, EJIT_TYPE(double)),
- EJIT_OPERAND_FPR(1, EJIT_TYPE(double))
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(float), 2, operands);
ejit_subr_f(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1));
ejit_retr_f(f, EJIT_FPR(0));
- ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
+ ejit_select_compile_func(f, 0, 2, EJIT_USE64(float), do_jit);
- assert(erff2(f, EJIT_ARG(42., double), EJIT_ARG(69., double)
+ assert(erff2(f, EJIT_ARG(42., float), EJIT_ARG(69., float)
) == -27.);
- assert(erff2(f, EJIT_ARG(42.5, double), EJIT_ARG(69., double)
+ assert(erff2(f, EJIT_ARG(42.5, float), EJIT_ARG(69., float)
) == -26.5);
ejit_destroy_func(f);
diff --git a/tests/truncr_f_32.c b/tests/truncr_f_32.c
new file mode 100644
index 0000000..1de700f
--- /dev/null
+++ b/tests/truncr_f_32.c
@@ -0,0 +1,29 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float))
+ };
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(int32_t), 1, operands);
+
+ ejit_truncr_f_32(f, EJIT_GPR(0), EJIT_FPR(0));
+ ejit_retr(f, EJIT_GPR(0));
+
+ ejit_select_compile_func(f, 1, 1, EJIT_TYPE(int32_t), do_jit);
+
+ assert(erf1(f, EJIT_ARG(0.0, float)) == 0);
+ assert(erf1(f, EJIT_ARG(-0.0, float)) == 0);
+ assert(erf1(f, EJIT_ARG(0.5, float)) == 0);
+ assert(erf1(f, EJIT_ARG(-0.5, float)) == 0);
+ assert(erf1(f, EJIT_ARG(1.5, float)) == 1);
+ assert(erf1(f, EJIT_ARG(-1.5, float)) == -1);
+ assert(erf1(f, EJIT_ARG(2.5, float)) == 2);
+ assert(erf1(f, EJIT_ARG(-2.5, float)) == -2);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/truncr_f_64.c b/tests/truncr_f_64.c
new file mode 100644
index 0000000..994bb16
--- /dev/null
+++ b/tests/truncr_f_64.c
@@ -0,0 +1,29 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float))
+ };
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(int64_t), 1, operands);
+
+ ejit_truncr_f_64(f, EJIT_GPR(0), EJIT_FPR(0));
+ ejit_retr(f, EJIT_GPR(0));
+
+ ejit_select_compile_func(f, 1, 1, EJIT_TYPE(int64_t), do_jit);
+
+ assert(erf1(f, EJIT_ARG(0.0, float)) == 0);
+ assert(erf1(f, EJIT_ARG(-0.0, float)) == 0);
+ assert(erf1(f, EJIT_ARG(0.5, float)) == 0);
+ assert(erf1(f, EJIT_ARG(-0.5, float)) == 0);
+ assert(erf1(f, EJIT_ARG(1.5, float)) == 1);
+ assert(erf1(f, EJIT_ARG(-1.5, float)) == -1);
+ assert(erf1(f, EJIT_ARG(2.5, float)) == 2);
+ assert(erf1(f, EJIT_ARG(-2.5, float)) == -2);
+
+ ejit_destroy_func(f);
+}