aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-03-14 21:08:01 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-03-14 21:08:01 +0200
commitf5c729ea59d227a507f83bd94d07f4366b46d72b (patch)
tree70d1f242100cea09acd38a71ff8c821836117cfd
parent57f6b41047e95374701ee276248f0f8615168450 (diff)
downloadejit-f5c729ea59d227a507f83bd94d07f4366b46d72b.tar.gz
ejit-f5c729ea59d227a507f83bd94d07f4366b46d72b.zip
start supporting 32bit arches
-rw-r--r--.gitignore2
m---------deps/lightening0
-rw-r--r--examples/fib.c36
-rw-r--r--examples/loop.c4
-rw-r--r--include/ejit/ejit.h232
-rwxr-xr-xscripts/gen-tests10
-rw-r--r--scripts/makefile21
-rwxr-xr-xscripts/select-compile3
-rw-r--r--src/common.h43
-rw-r--r--src/compile/compile.c182
-rw-r--r--src/ejit.c248
-rw-r--r--src/interp.c (renamed from src/interp.inc)201
-rw-r--r--src/vec.h4
-rw-r--r--tests/absr_d.c8
-rw-r--r--tests/absr_f.c8
-rw-r--r--tests/addi.c2
-rw-r--r--tests/addr.c2
-rw-r--r--tests/addr_d.c4
-rw-r--r--tests/andi.c8
-rw-r--r--tests/andr64.c40
-rw-r--r--tests/beqi.c6
-rw-r--r--tests/beqr.c12
-rw-r--r--tests/beqr_d.c18
-rw-r--r--tests/beqr_f.c40
-rw-r--r--tests/bgei.c6
-rw-r--r--tests/bgei_u.c6
-rw-r--r--tests/bger.c10
-rw-r--r--tests/bger_u.c10
-rw-r--r--tests/bgti.c6
-rw-r--r--tests/bgti_u.c6
-rw-r--r--tests/bgtr.c10
-rw-r--r--tests/bgtr_d.c14
-rw-r--r--tests/bgtr_f.c35
-rw-r--r--tests/bgtr_u.c10
-rw-r--r--tests/blei.c6
-rw-r--r--tests/blei_u.c6
-rw-r--r--tests/bler.c10
-rw-r--r--tests/bler_d.c14
-rw-r--r--tests/bler_f.c35
-rw-r--r--tests/bler_u.c10
-rw-r--r--tests/blti.c6
-rw-r--r--tests/blti_u.c6
-rw-r--r--tests/bltr.c10
-rw-r--r--tests/bltr_d.c14
-rw-r--r--tests/bltr_f.c14
-rw-r--r--tests/bltr_u.c10
-rw-r--r--tests/bmci.c8
-rw-r--r--tests/bmcr.c18
-rw-r--r--tests/bmsi.c8
-rw-r--r--tests/bmsr.c18
-rw-r--r--tests/bnei.c6
-rw-r--r--tests/bner.c12
-rw-r--r--tests/bner_d.c16
-rw-r--r--tests/bner_f.c16
-rw-r--r--tests/callee_9.c41
-rw-r--r--tests/comr.c68
-rw-r--r--tests/divr64.c62
-rw-r--r--tests/divr_d.c7
-rw-r--r--tests/divr_u64.c134
-rw-r--r--tests/do_jit.h48
-rw-r--r--tests/eqr.c24
-rw-r--r--tests/eqr_d.c6
-rw-r--r--tests/eqr_f.c6
-rw-r--r--tests/escapei_10.c4
-rw-r--r--tests/escapei_double.c4
-rw-r--r--tests/escapei_float.c2
-rw-r--r--tests/extr_16.c12
-rw-r--r--tests/extr_32.c15
-rw-r--r--tests/extr_8.c10
-rw-r--r--tests/extr_d.c6
-rw-r--r--tests/extr_u16.c10
-rw-r--r--tests/extr_u32.c13
-rw-r--r--tests/extr_u8.c10
-rw-r--r--tests/ger.c8
-rw-r--r--tests/ger_u.c12
-rw-r--r--tests/gtr.c8
-rw-r--r--tests/gtr_d.c4
-rw-r--r--tests/gtr_f.c4
-rw-r--r--tests/gtr_u.c12
-rw-r--r--tests/jmp0.c4
-rw-r--r--tests/jmp_table.c10
-rw-r--r--tests/jmpi_local.c2
-rw-r--r--tests/ldi_d.c2
-rw-r--r--tests/ldi_i16.c2
-rw-r--r--tests/ldi_i32.c4
-rw-r--r--tests/ldi_i64.c2
-rw-r--r--tests/ldi_i8.c2
-rw-r--r--tests/ldi_u16.c2
-rw-r--r--tests/ldi_u32.c21
-rw-r--r--tests/ldi_u64.c4
-rw-r--r--tests/ldi_u8.c2
-rw-r--r--tests/ldxi_d.c6
-rw-r--r--tests/ldxi_i16.c6
-rw-r--r--tests/ldxi_i32.c6
-rw-r--r--tests/ldxi_i64.c9
-rw-r--r--tests/ldxi_i8.c6
-rw-r--r--tests/ldxi_u16.c6
-rw-r--r--tests/ldxi_u32.c8
-rw-r--r--tests/ldxi_u64.c14
-rw-r--r--tests/ldxi_u8.c6
-rw-r--r--tests/ldxr_d.c6
-rw-r--r--tests/ldxr_i32.c6
-rw-r--r--tests/ldxr_i64.c8
-rw-r--r--tests/ldxr_i8.c6
-rw-r--r--tests/ldxr_u16.c6
-rw-r--r--tests/ldxr_u32.c10
-rw-r--r--tests/ldxr_u8.c6
-rw-r--r--tests/ler64.c15
-rw-r--r--tests/ler_d.c8
-rw-r--r--tests/ler_f.c8
-rw-r--r--tests/lshi.c4
-rw-r--r--tests/lshr64.c62
-rw-r--r--tests/ltr.c8
-rw-r--r--tests/ltr_d.c8
-rw-r--r--tests/ltr_f.c8
-rw-r--r--tests/movi.c2
-rw-r--r--tests/movi_d.c2
-rw-r--r--tests/movr.c2
-rw-r--r--tests/movr_d.c2
-rw-r--r--tests/movr_f.c2
-rw-r--r--tests/mulr64.c233
-rw-r--r--tests/mulr_d.c11
-rw-r--r--tests/negr.c33
-rw-r--r--tests/negr_d.c8
-rw-r--r--tests/ner.c24
-rw-r--r--tests/ner_d.c4
-rw-r--r--tests/ner_f.c4
-rw-r--r--tests/ori64.c12
-rw-r--r--tests/orr64.c40
-rw-r--r--tests/remr64.c87
-rw-r--r--tests/remr_u64.c110
-rw-r--r--tests/rshi64.c6
-rw-r--r--tests/rshi_u64.c5
-rw-r--r--tests/rshr64.c197
-rw-r--r--tests/rshr_u64.c198
-rw-r--r--tests/sti_16.c2
-rw-r--r--tests/sti_32.c2
-rw-r--r--tests/sti_64.c2
-rw-r--r--tests/sti_8.c2
-rw-r--r--tests/sti_d.c2
-rw-r--r--tests/sti_f.c2
-rw-r--r--tests/stxi_16.c2
-rw-r--r--tests/stxi_32.c2
-rw-r--r--tests/stxi_64.c2
-rw-r--r--tests/stxi_8.c2
-rw-r--r--tests/stxi_d.c2
-rw-r--r--tests/stxi_f.c2
-rw-r--r--tests/stxr_16.c2
-rw-r--r--tests/stxr_32.c2
-rw-r--r--tests/stxr_64.c2
-rw-r--r--tests/stxr_8.c2
-rw-r--r--tests/stxr_d.c2
-rw-r--r--tests/stxr_f.c2
-rw-r--r--tests/subr.c2
-rw-r--r--tests/subr_d.c10
-rw-r--r--tests/truncr_d_32.c16
-rw-r--r--tests/truncr_d_64.c16
-rw-r--r--tests/truncr_f_32.c16
-rw-r--r--tests/truncr_f_64.c16
-rw-r--r--tests/xori64.c16
-rw-r--r--tests/xorr64.c168
161 files changed, 2143 insertions, 1448 deletions
diff --git a/.gitignore b/.gitignore
index c45d138..93b2293 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,7 @@ deps.mk
tests.mk
docs/output
build
-ejit.o
+libejit.a
test-*
examples/matrix_mult
examples/loop
diff --git a/deps/lightening b/deps/lightening
-Subproject 9f1f12028be3457df4a287823e44c316c1f1719
+Subproject 1cc7a2d159d8cbfc46708d24bfe49f6c23c6e44
diff --git a/examples/fib.c b/examples/fib.c
index fe2b215..308ecd1 100644
--- a/examples/fib.c
+++ b/examples/fib.c
@@ -3,12 +3,12 @@
#include "../include/ejit/ejit.h"
-struct ejit_func *compile()
+struct ejit_func *compile(bool try_jit)
{
struct ejit_operand args[1] = {
- EJIT_OPERAND_GPR(0, EJIT_INT64) /* loc 0 contains n */
+ EJIT_OPERAND_GPR(0, EJIT_INT32) /* loc 0 contains n */
};
- struct ejit_func *f = ejit_create_func(EJIT_INT64, 1, args);
+ struct ejit_func *f = ejit_create_func(EJIT_INT32, 1, args);
struct ejit_reloc recurse = ejit_bgti(f, EJIT_GPR(0), 2); /* n <= 2 */
ejit_reti(f, 1);
@@ -18,63 +18,59 @@ struct ejit_func *compile()
/* fib(n - 1) */
ejit_subi(f, EJIT_GPR(0), EJIT_GPR(0), 1);
struct ejit_operand arg[1] = {
- EJIT_OPERAND_GPR(0, EJIT_INT64)
+ EJIT_OPERAND_GPR(0, EJIT_INT32)
};
- ejit_calli(f, f, 1, arg);
+ ejit_calli_i(f, f, 1, arg);
ejit_retval(f, EJIT_GPR(1)); /* loc 1 contains temp result */
/* fib(n - 2) */
ejit_subi(f, EJIT_GPR(0), EJIT_GPR(0), 1);
- ejit_calli(f, f, 1, arg);
+ ejit_calli_i(f, f, 1, arg);
ejit_retval(f, EJIT_GPR(0)); /* loc 0 now contains second temp result */
ejit_addr(f, EJIT_GPR(0), EJIT_GPR(0), EJIT_GPR(1)); /* add results */
ejit_retr(f, EJIT_GPR(0));
- bool try_jit = true;
-#ifdef NOJIT
- try_jit = false;
-#endif
-
/* the highest location we used was 1, so we need to request 2 locations
* for general purpose registers in total. No floating point registers,
* so 0. */
- ejit_select_compile_func(f, 2, 0, true, try_jit);
+ ejit_select_compile_func(f, 2, 0, EJIT_USE64(int32_t), try_jit);
return f;
}
int main(int argc, char *argv[])
{
- if(argc != 3){
- fprintf(stderr, "Usage: %s compile_num loop_num\n", argv[0]);
+ if(argc != 4){
+ fprintf(stderr, "Usage: %s compile_num loop_num jit\n", argv[0]);
return -1;
}
+ int try_jit = strtoull(argv[3], 0, 0);
size_t compile_num = strtoull(argv[1], 0, 0);
struct ejit_func **info = calloc(compile_num, sizeof(struct ejit_func *));
clock_t t = clock();
for(size_t i = 0; i < compile_num; ++i){
- info[i] = compile();
+ info[i] = compile(try_jit);
}
t = clock() - t;
double compile_time_total = ((double)t) / CLOCKS_PER_SEC;
double compile_time_one = compile_time_total / compile_num;
- printf("Compilation for n = %lu took %fs (1/%f).\n",
+ printf("Compilation for n = %zu took %fs (1/%f).\n",
compile_num, compile_time_total, compile_time_one);
size_t run_num = strtoull(argv[2], 0, 0);
t = clock();
struct ejit_arg arg[1] = {
- (struct ejit_arg){.type = EJIT_INT64, .l = run_num}
+ (struct ejit_arg){.type = EJIT_INT32, .l = run_num}
};
- size_t result = ejit_run_func(info[0], 1, arg);
+ int32_t result = ejit_run_func_i(info[0], 1, arg);
t = clock() - t;
double run_time_total = ((double)t) / CLOCKS_PER_SEC;
- printf("Running loop for n = %lu took %fs with res %lu\n",
- run_num, run_time_total, result);
+ printf("Running loop for n = %zu took %fs with res %ld\n",
+ run_num, run_time_total, (long)result);
for(size_t i = 0; i < compile_num; ++i)
ejit_destroy_func(info[i]);
diff --git a/examples/loop.c b/examples/loop.c
index 51ba2e9..537a931 100644
--- a/examples/loop.c
+++ b/examples/loop.c
@@ -3,7 +3,7 @@
int main()
{
- struct ejit_func *f = ejit_create_func(EJIT_INT64, 0, NULL);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 0, NULL);
ejit_movi(f, EJIT_GPR(3), 1); // location 3 just has a constant 1 for
// increment
@@ -21,7 +21,7 @@ int main()
ejit_patch(f, r, l);
ejit_compile_func(f);
- long result = ejit_run_func(f, 0, NULL); // no args so this is fine
+ long result = ejit_run_func_i(f, 0, NULL); // no args so this is fine
printf("%ld\n", result);
ejit_destroy_func(f);
diff --git a/include/ejit/ejit.h b/include/ejit/ejit.h
index b0d8651..0c7f4c5 100644
--- a/include/ejit/ejit.h
+++ b/include/ejit/ejit.h
@@ -25,17 +25,47 @@ enum ejit_type
EJIT_DOUBLE,
};
+static inline enum ejit_type ejit_unsigned_type(size_t w)
+{
+ switch (w) {
+ case 1: return EJIT_UINT8;
+ case 2: return EJIT_UINT16;
+ case 4: return EJIT_UINT32;
+ case 8: return EJIT_UINT64;
+ default: assert(0 && "unknown width of unsigned type");
+ }
+
+ /* shut up some warnings */
+ return EJIT_UINT32;
+}
+
+static inline enum ejit_type ejit_signed_type(size_t w)
+{
+ switch (w) {
+ case 1: return EJIT_INT8;
+ case 2: return EJIT_INT16;
+ case 4: return EJIT_INT32;
+ case 8: return EJIT_INT64;
+ default: assert(0 && "unknown width of signed type");
+ }
+
+ /* shut up some warnings */
+ return EJIT_INT32;
+}
+
/* can be kind of dangerous since we default to a pointer, hmm */
#define EJIT_TYPE(x) \
_Generic((typeof(x))(0), \
- int8_t: EJIT_INT8, \
- int16_t: EJIT_INT16, \
- int32_t: EJIT_INT32, \
- int64_t: EJIT_INT64, \
- uint8_t: EJIT_UINT8, \
- uint16_t: EJIT_UINT16, \
- uint32_t: EJIT_UINT32, \
- uint64_t: EJIT_UINT64, \
+ unsigned char : ejit_unsigned_type(sizeof(x)), \
+ unsigned short : ejit_unsigned_type(sizeof(x)), \
+ unsigned int : ejit_unsigned_type(sizeof(x)), \
+ unsigned long : ejit_unsigned_type(sizeof(x)), \
+ unsigned long long: ejit_unsigned_type(sizeof(x)), \
+ signed char : ejit_signed_type(sizeof(x)), \
+ signed short : ejit_signed_type(sizeof(x)), \
+ signed int : ejit_signed_type(sizeof(x)), \
+ signed long : ejit_signed_type(sizeof(x)), \
+ signed long long : ejit_signed_type(sizeof(x)), \
float: EJIT_FLOAT, \
double: EJIT_DOUBLE, \
default: EJIT_POINTER)
@@ -102,21 +132,19 @@ static inline bool ejit_float_type(enum ejit_type t)
static inline struct ejit_arg ejit_build_arg(enum ejit_type type, uint64_t x)
{
- assert(ejit_int_type(type));
-
struct ejit_arg a;
a.type = type;
switch (type) {
- case EJIT_INT8: a.i8 = x; break;
- case EJIT_INT16: a.i16 = x; break;
- case EJIT_INT32: a.i32 = x; break;
- case EJIT_INT64: a.i64 = x; break;
- case EJIT_UINT8: a.u8 = x; break;
- case EJIT_UINT16: a.u16 = x; break;
- case EJIT_UINT32: a.u32 = x; break;
- case EJIT_UINT64: a.u64 = x; break;
- case EJIT_POINTER: a.p = (void *)x; break;
+ case EJIT_INT8: a.u64 = (int8_t)x; break;
+ case EJIT_INT16: a.u64 = (int16_t)x; break;
+ case EJIT_INT32: a.u64 = (int32_t)x; break;
+ case EJIT_INT64: a.u64 = (int64_t)x; break;
+ case EJIT_UINT8: a.u64 = (uint8_t)x; break;
+ case EJIT_UINT16: a.u64 = (uint16_t)x; break;
+ case EJIT_UINT32: a.u64 = (uint32_t)x; break;
+ case EJIT_UINT64: a.u64 = (uint64_t)x; break;
+ case EJIT_POINTER: a.p = (void *)(uintptr_t)x; break;
default: abort();
}
@@ -125,8 +153,6 @@ static inline struct ejit_arg ejit_build_arg(enum ejit_type type, uint64_t x)
static inline struct ejit_arg ejit_build_arg_f(enum ejit_type type, double x)
{
- assert(ejit_float_type(type));
-
struct ejit_arg a;
a.type = type;
@@ -139,8 +165,6 @@ static inline struct ejit_arg ejit_build_arg_f(enum ejit_type type, double x)
return a;
}
-/* register allocator could be just pushing everything above V0 or whatever onto
- * the stack, heh */
struct ejit_gpr {
size_t r;
};
@@ -182,35 +206,34 @@ void ejit_compile_func(struct ejit_func *f);
void ejit_select_compile_func(struct ejit_func *f, size_t gpr, size_t fpr,
bool use_64, bool try_jit);
-int64_t ejit_run_func(struct ejit_func *f, size_t argc,
+long ejit_run_func_i(struct ejit_func *f, size_t argc,
struct ejit_arg args[argc]);
-static inline int64_t ejit_run_func_1(struct ejit_func *f, struct ejit_arg a0)
-{
- return ejit_run_func(f, 1, &a0);
-}
+int64_t ejit_run_func_l(struct ejit_func *f, size_t argc,
+ struct ejit_arg args[argc]);
-static inline int64_t ejit_run_func_2(struct ejit_func *f, struct ejit_arg a0,
- struct ejit_arg a1)
-{
- struct ejit_arg args[2] = {a0, a1};
- return ejit_run_func(f, 2, args);
-}
+float ejit_run_func_f(struct ejit_func *f, size_t argc,
+ struct ejit_arg args[argc]);
-double ejit_run_func_f(struct ejit_func *f, size_t argc,
+double ejit_run_func_d(struct ejit_func *f, size_t argc,
struct ejit_arg args[argc]);
-static inline double ejit_run_func_f_1(struct ejit_func *f, struct ejit_arg a0)
-{
- return ejit_run_func_f(f, 1, &a0);
-}
+struct ejit_arg ejit_run_func(struct ejit_func *f, size_t argc, struct ejit_arg args[argc]);
+
+
+/* currently unused, the idea is that an escape could get the interpreter state
+ * and pass it on to speed up entering/exiting the VM, could be useful for more
+ * dynamic languages */
+struct interp_state;
+
+long ejit_run_func_ctx_i(struct ejit_func *f, size_t argc, struct ejit_arg args[argc], struct interp_state *ctx);
+
+int64_t ejit_run_func_ctx_l(struct ejit_func *f, size_t argc, struct ejit_arg args[argc], struct interp_state *ctx);
+
+float ejit_run_func_ctx_f(struct ejit_func *f, size_t argc, struct ejit_arg args[argc], struct interp_state *ctx);
+
+double ejit_run_func_ctx_d(struct ejit_func *f, size_t argc, struct ejit_arg args[argc], struct interp_state *ctx);
-static inline double ejit_run_func_f_2(struct ejit_func *f, struct ejit_arg a0,
- struct ejit_arg a1)
-{
- struct ejit_arg args[2] = {a0, a1};
- return ejit_run_func_f(f, 2, args);
-}
void ejit_destroy_func(struct ejit_func *s);
@@ -258,6 +281,26 @@ static inline struct ejit_arg ejit_i64(int64_t a)
return (struct ejit_arg){.i64 = a, .type = EJIT_INT64};
}
+static inline struct ejit_arg ejit_u8(uint8_t a)
+{
+ return (struct ejit_arg){.i64 = a, .type = EJIT_UINT8};
+}
+
+static inline struct ejit_arg ejit_u16(uint16_t a)
+{
+ return (struct ejit_arg){.i64 = a, .type = EJIT_UINT16};
+}
+
+static inline struct ejit_arg ejit_u32(uint32_t a)
+{
+ return (struct ejit_arg){.i64 = a, .type = EJIT_UINT32};
+}
+
+static inline struct ejit_arg ejit_u64(uint64_t a)
+{
+ return (struct ejit_arg){.i64 = a, .type = EJIT_UINT64};
+}
+
static inline struct ejit_arg ejit_pointer(void *p)
{
return (struct ejit_arg){.p = p, .type = EJIT_POINTER};
@@ -273,20 +316,70 @@ static inline struct ejit_arg ejit_double(double a)
return (struct ejit_arg){.d = a, .type = EJIT_DOUBLE};
}
+static inline struct ejit_arg ejit_unsigned_arg(uint64_t a, size_t w)
+{
+ switch (w) {
+ case 1: return ejit_u8(a);
+ case 2: return ejit_u16(a);
+ case 4: return ejit_u32(a);
+ case 8: return ejit_u64(a);
+ default: assert(0 && "unknown width for unsigned arg");
+ }
+
+ /* shut up some warnings */
+ return ejit_u32(a);
+}
+
+static inline struct ejit_arg ejit_signed_arg(int64_t a, size_t w)
+{
+ switch (w) {
+ case 1: return ejit_i8(a);
+ case 2: return ejit_i16(a);
+ case 4: return ejit_i32(a);
+ case 8: return ejit_i64(a);
+ default: assert(0 && "unknown width for signed arg");
+ }
+
+ /* shut up some warnings */
+ return ejit_i32(a);
+}
+
+static inline struct ejit_arg ejit_float_arg(float f, size_t w)
+{
+ (void)w;
+ assert(w == 4);
+ return ejit_float(f);
+}
+
+static inline struct ejit_arg ejit_double_arg(double d, size_t w)
+{
+ (void)w;
+ assert(w == 8);
+ return ejit_double(d);
+}
+
+static inline struct ejit_arg ejit_pointer_arg(void *p, size_t w)
+{
+ (void)w;
+ return ejit_pointer(p);
+}
+
#define EJIT_ARG(x, t) \
_Generic((t)(0), \
- int8_t: ejit_i8, \
- int16_t: ejit_i16, \
- int32_t: ejit_i32, \
- int64_t: ejit_i64, \
- uint8_t: ejit_i8, \
- uint16_t: ejit_i16, \
- uint32_t: ejit_i32, \
- uint64_t: ejit_i64, \
- float: ejit_float, \
- double: ejit_double, \
- default: ejit_pointer \
- )(x)
+ signed char : ejit_signed_arg, \
+ signed short : ejit_signed_arg, \
+ signed int : ejit_signed_arg, \
+ signed long : ejit_signed_arg, \
+ signed long long : ejit_signed_arg, \
+ unsigned char : ejit_unsigned_arg, \
+ unsigned short : ejit_unsigned_arg, \
+ unsigned int : ejit_unsigned_arg, \
+ unsigned long : ejit_unsigned_arg, \
+ unsigned long long: ejit_unsigned_arg, \
+ float : ejit_float_arg, \
+ double : ejit_double_arg, \
+ default : ejit_pointer_arg \
+ )((t)(x), sizeof(t))
#define EJIT_AUTO(x) \
EJIT_ARG(x, typeof(x))
@@ -302,30 +395,43 @@ static inline bool ejit_use64(struct ejit_arg a)
#define EJIT_USE64(t) \
ejit_use64(EJIT_ARG(0, t))
-typedef long (*ejit_escape_t)(size_t argc, const struct ejit_arg args[argc]);
-typedef double (*ejit_escape_f_t)(size_t argc,
- const struct ejit_arg args[argc]);
+typedef long (*ejit_escape_i_t)(size_t argc, const struct ejit_arg args[argc]);
+typedef int64_t (*ejit_escape_l_t)(size_t argc, const struct ejit_arg args[argc]);
+typedef float (*ejit_escape_f_t)(size_t argc, const struct ejit_arg args[argc]);
+typedef double (*ejit_escape_d_t)(size_t argc, const struct ejit_arg args[argc]);
struct ejit_label ejit_label(struct ejit_func *s);
-void ejit_calli(struct ejit_func *s, struct ejit_func *f, size_t argc,
+void ejit_calli_i(struct ejit_func *s, struct ejit_func *f, size_t argc,
+ const struct ejit_operand args[argc]);
+
+void ejit_calli_l(struct ejit_func *s, struct ejit_func *f, size_t argc,
const struct ejit_operand args[argc]);
void ejit_calli_f(struct ejit_func *s, struct ejit_func *f, size_t argc,
const struct ejit_operand args[argc]);
-void ejit_escapei(struct ejit_func *s, ejit_escape_t f, size_t argc,
+void ejit_calli_d(struct ejit_func *s, struct ejit_func *f, size_t argc,
+ const struct ejit_operand args[argc]);
+
+void ejit_escapei_i(struct ejit_func *s, ejit_escape_i_t f, size_t argc,
+ const struct ejit_operand args[argc]);
+
+void ejit_escapei_l(struct ejit_func *s, ejit_escape_l_t f, size_t argc,
const struct ejit_operand args[argc]);
void ejit_escapei_f(struct ejit_func *s, ejit_escape_f_t f, size_t argc,
const struct ejit_operand args[argc]);
+void ejit_escapei_d(struct ejit_func *s, ejit_escape_d_t f, size_t argc,
+ const struct ejit_operand args[argc]);
+
void ejit_ret(struct ejit_func *s);
void ejit_retr(struct ejit_func *s, struct ejit_gpr r0);
void ejit_retr_f(struct ejit_func *s, struct ejit_fpr r0);
void ejit_retr_d(struct ejit_func *s, struct ejit_fpr r0);
-void ejit_reti(struct ejit_func *s, long i);
+void ejit_reti(struct ejit_func *s, int64_t i);
void ejit_reti_f(struct ejit_func *s, float f);
void ejit_reti_d(struct ejit_func *s, double f);
diff --git a/scripts/gen-tests b/scripts/gen-tests
index 5d9e087..5521006 100755
--- a/scripts/gen-tests
+++ b/scripts/gen-tests
@@ -7,9 +7,9 @@ do
exe="tests/test-${src%.*}"
dep="tests/${exe}.d"
- echo "${PREFIX} += ${exe}" >> tests.mk
- echo "${dep}:" >> tests.mk
- echo "-include ${dep}" >> tests.mk
- echo "${exe}: ${s} ejit.o" >> tests.mk
- echo " \$(COMPILE_TEST) ${s} ejit.o -o ${exe}" >> tests.mk
+ echo "${PREFIX} += ${exe}" >> tests.mk
+ echo "${dep}:" >> tests.mk
+ echo "-include ${dep}" >> tests.mk
+ echo "${exe}: ${s} libejit.a" >> tests.mk
+ echo " \$(COMPILE_TEST) ${s} libejit.a -o ${exe}" >> tests.mk
done
diff --git a/scripts/makefile b/scripts/makefile
index 3f1e119..3a4f200 100644
--- a/scripts/makefile
+++ b/scripts/makefile
@@ -20,7 +20,7 @@ PREPROCESS := -E
LLVM ?= 0
BUILD := build
-all: ejit.o
+all: libejit.a
# default values, overwrite if/when needed
CROSS_COMPILE :=
@@ -35,8 +35,7 @@ COMPILER != [ "$(LLVM)" != "0" ] \
OBFLAGS := -g
-# interpreter is allowed to have uninitialized values
-WARNFLAGS := -Wall -Wextra -Wno-maybe-uninitialized
+WARNFLAGS := -Wall -Wextra
COMPILE_FLAGS := $(CFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(LTOFLAGS) \
$(OBFLAGS) $(ASSERTFLAGS) $(DEBUGFLAGS)
@@ -58,19 +57,19 @@ COMPILE_EJIT = $(COMPILE) $(EJIT_FLAGS)
-include deps.mk
-ejit.o: $(EJIT_OBJS)
- ld -relocatable $(EJIT_OBJS) -o $@
+libejit.a: $(EJIT_OBJS)
+ $(CROSS_COMPILE)ar rcs libejit.a $(EJIT_OBJS)
examples: examples/loop examples/fib examples/matrix_mult
-examples/matrix_mult: examples/matrix_mult.c ejit.o
- $(COMPILE_EJIT) examples/matrix_mult.c ejit.o -o $@
+examples/matrix_mult: examples/matrix_mult.c libejit.a
+ $(COMPILE_EJIT) examples/matrix_mult.c libejit.a -o $@
-examples/loop: examples/loop.c ejit.o
- $(COMPILE_EJIT) examples/loop.c ejit.o -o $@
+examples/loop: examples/loop.c libejit.a
+ $(COMPILE_EJIT) examples/loop.c libejit.a -o $@
-examples/fib: examples/fib.c ejit.o
- $(COMPILE_EJIT) examples/fib.c ejit.o -o $@
+examples/fib: examples/fib.c libejit.a
+ $(COMPILE_EJIT) examples/fib.c libejit.a -o $@
# might lint some common things twice
.PHONY:
diff --git a/scripts/select-compile b/scripts/select-compile
index 8d87409..fca7350 100755
--- a/scripts/select-compile
+++ b/scripts/select-compile
@@ -9,6 +9,7 @@ JIT="src/compile/compile.c"
NOJIT="src/compile/nocompile.c"
case "$ARCH" in
- x86_64) echo "$JIT" ;;
+ amd64) echo "$JIT" ;;
+ x86*) echo "$JIT" ;;
*) echo "$NOJIT" ;;
esac
diff --git a/src/common.h b/src/common.h
index df150c1..b845e1c 100644
--- a/src/common.h
+++ b/src/common.h
@@ -204,11 +204,15 @@ enum ejit_opcode {
ARG_F,
ARG_FI,
- ESCAPEI,
+ ESCAPEI_I,
+ ESCAPEI_L,
ESCAPEI_F,
+ ESCAPEI_D,
- CALLI,
+ CALLI_I,
+ CALLI_L,
CALLI_F,
+ CALLI_D,
RETR,
RETI,
@@ -248,6 +252,9 @@ struct ejit_insn {
#define VEC_NAME insns
#include "vec.h"
+#define VEC_TYPE enum ejit_type
+#define VEC_NAME types
+#include "vec.h"
struct fpr_stat {
struct ejit_fpr f;
@@ -268,6 +275,7 @@ struct gpr_stat {
#include "vec.h"
struct ejit_func {
+ struct types sign;
struct insns insns;
struct labels labels;
enum ejit_type rtype;
@@ -289,27 +297,16 @@ struct interp_state {
struct args args;
};
-int64_t ejit_interp(struct ejit_func *f, size_t argc,
- struct ejit_arg args[argc],
- struct interp_state *state, bool run,
- void ***labels_wb);
-
-double ejit_interp_f(struct ejit_func *f, size_t argc,
- struct ejit_arg args[argc],
- struct interp_state *state, bool run,
- void ***labels_wb);
-
-int64_t ejit_run_interp(struct ejit_func *f, size_t argc,
- struct ejit_arg args[argc],
- struct interp_state *state,
- bool run,
- void ***labels_wb);
-
-double ejit_run_interp_f(struct ejit_func *f, size_t argc,
- struct ejit_arg args[argc],
- struct interp_state *state,
- bool run,
- void ***labels_wb);
+union interp_ret {
+ int64_t i;
+ double f;
+};
+
+union interp_ret ejit_run(struct ejit_func *f, size_t argc,
+ struct ejit_arg args[argc],
+ struct interp_state *state,
+ bool run,
+ void ***labels_wb);
bool ejit_compile(struct ejit_func *f, bool use_64);
diff --git a/src/compile/compile.c b/src/compile/compile.c
index c9c7652..e741a0f 100644
--- a/src/compile/compile.c
+++ b/src/compile/compile.c
@@ -650,8 +650,15 @@ static void compile_sti32(struct ejit_func *f, jit_state_t *j,
static void compile_sti64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getloc(f, j, i.r0, 0);
jit_sti_l(j, i.p, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile sti64 on 32bit arch");
+#endif
}
static void compile_stif(struct ejit_func *f, jit_state_t *j,
@@ -695,9 +702,16 @@ static void compile_stxi32(struct ejit_func *f, jit_state_t *j,
static void compile_stxi64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getloc(f, j, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_stxi_l(j, i.o, r1, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile stxi64 on 32bit arch");
+#endif
}
static void compile_stxif(struct ejit_func *f, jit_state_t *j,
@@ -746,10 +760,17 @@ static void compile_stxr32(struct ejit_func *f, jit_state_t *j,
static void compile_stxr64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getloc(f, j, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_gpr_t r2 = getloc(f, j, i.r2, 2);
jit_stxr_l(j, r2, r1, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile stxr64 on 32bit arch");
+#endif
}
static void compile_stxrf(struct ejit_func *f, jit_state_t *j,
@@ -789,17 +810,31 @@ static void compile_ldiu16(struct ejit_func *f, jit_state_t *j,
static void compile_ldiu32(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_ldi_ui(j, r0, i.p);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile ldiu32 on 32bit arch");
+#endif
}
static void compile_ldiu64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_ldi_l(j, r0, i.p);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile ldiu64 on 32bit arch");
+#endif
}
static void compile_ldif(struct ejit_func *f, jit_state_t *j,
@@ -845,9 +880,16 @@ static void compile_ldi32(struct ejit_func *f, jit_state_t *j,
static void compile_ldi64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_ldi_l(j, r0, i.p);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile ldi64 on 32bit arch");
+#endif
}
static void compile_ldxiu8(struct ejit_func *f, jit_state_t *j,
@@ -871,19 +913,33 @@ static void compile_ldxiu16(struct ejit_func *f, jit_state_t *j,
static void compile_ldxiu32(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_ldxi_ui(j, r0, r1, i.o);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile ldxiu32 on 32bit arch");
+#endif
}
static void compile_ldxiu64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_ldxi_l(j, r0, r1, i.o);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile ldxiu64 on 32bit arch");
+#endif
}
static void compile_ldxif(struct ejit_func *f, jit_state_t *j,
@@ -934,10 +990,17 @@ static void compile_ldxi32(struct ejit_func *f, jit_state_t *j,
static void compile_ldxi64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_ldxi_l(j, r0, r1, i.o);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile ldxi64 on 32bit arch");
+#endif
}
static void compile_ldxru8(struct ejit_func *f, jit_state_t *j,
@@ -963,21 +1026,35 @@ static void compile_ldxru16(struct ejit_func *f, jit_state_t *j,
static void compile_ldxru32(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_gpr_t r2 = getloc(f, j, i.r2, 2);
jit_ldxr_ui(j, r0, r1, r2);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile ldxru32 on 32bit arch");
+#endif
}
static void compile_ldxru64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_gpr_t r2 = getloc(f, j, i.r2, 2);
jit_ldxr_l(j, r0, r1, r2);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile ldxru64 on 32bit arch");
+#endif
}
static void compile_ldxr8(struct ejit_func *f, jit_state_t *j,
@@ -1013,11 +1090,18 @@ static void compile_ldxr32(struct ejit_func *f, jit_state_t *j,
static void compile_ldxr64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_gpr_t r2 = getloc(f, j, i.r2, 2);
jit_ldxr_l(j, r0, r1, r2);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile ldxr64 on 32bit arch");
+#endif
}
static void compile_ldxrf(struct ejit_func *f, jit_state_t *j,
@@ -1097,10 +1181,17 @@ static void compile_extr16(struct ejit_func *f, jit_state_t *j,
static void compile_extr32(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_extr_i(j, r0, r1);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile extr32 on 32bit arch");
+#endif
}
static void compile_extru8(struct ejit_func *f, jit_state_t *j,
@@ -1124,10 +1215,17 @@ static void compile_extru16(struct ejit_func *f, jit_state_t *j,
static void compile_extru32(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_gpr_t r1 = getloc(f, j, i.r1, 1);
jit_extr_ui(j, r0, r1);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile extru32 on 32bit arch");
+#endif
}
static void compile_extrf(struct ejit_func *f, jit_state_t *j,
@@ -1151,10 +1249,17 @@ static void compile_extrd(struct ejit_func *f, jit_state_t *j,
static void compile_truncr_d_64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_fpr_t r1 = getloc_d(f, j, i.r1, 1);
jit_truncr_d_l(j, r0, r1);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile truncr_d_64 on 32bit arch");
+#endif
}
static void compile_truncr_d_32(struct ejit_func *f, jit_state_t *j,
@@ -1174,10 +1279,17 @@ static void compile_truncr_d_32(struct ejit_func *f, jit_state_t *j,
static void compile_truncr_f_64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
+#if __WORDSIZE == 64
jit_gpr_t r0 = getgpr(f, i.r0, 0);
jit_fpr_t r1 = getloc_f(f, j, i.r1, 1);
jit_truncr_f_l(j, r0, r1);
putloc(f, j, i.r0, r0);
+#else
+ (void)f;
+ (void)j;
+ (void)i;
+ assert(0 && "trying to compile truncr_f_64 on 32bit arch");
+#endif
}
static void compile_truncr_f_32(struct ejit_func *f, jit_state_t *j,
@@ -1645,9 +1757,7 @@ static void compile_retval_f(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
jit_fpr_t r0 = getfpr(f, i.r0, 0);
- jit_retval_d(j, r0);
- /* convert double to float */
- jit_extr_d_f(j, r0, r0);
+ jit_retval_f(j, r0);
putloc_f(f, j, i.r0, r0);
}
@@ -1734,6 +1844,8 @@ static void compile_imm_call(jit_state_t *j, struct operands *src, struct operan
/* note, do not fix up destination! */
/* remember to move all operands */
jit_move_operands(j, dst->buf, src->buf, movec * 2);
+
+ jit_movr(j, JIT_R0, JIT_SP);
jit_calli(j, addr, argc, args);
jit_shrink_stack(j, fixup);
@@ -1814,6 +1926,8 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena,
struct addrs addrs = addrs_create();
addrs_reserve(&addrs, insns_len(&f->insns));
+ void *call = NULL;
+
size_t label = 0;
foreach_vec(ii, f->insns) {
/* if we've hit a label, add it to our vector of label addresses */
@@ -2072,32 +2186,27 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena,
break;
}
- case ESCAPEI: {
- save_caller_save_regs(f, j);
-
- jit_operand_t args[2] = {
- jit_operand_imm(JIT_OPERAND_ABI_WORD,
- operands_len(&src) / 2),
- jit_operand_gpr(JIT_OPERAND_ABI_POINTER, JIT_SP)
- };
- compile_imm_call(j, &src, &dst, (void *)i.o, 2, args);
- restore_caller_save_regs(f, j);
-
- operands_reset(&src);
- operands_reset(&dst);
- operands_reset(&direct);
- break;
- }
+ case ESCAPEI_L:
+#if __WORDSIZE == 64
+ /* fallthrough */
+#else
+ assert(0 && "trying to compile escapei_l on 32bit arch");
+ break;
+#endif
- case ESCAPEI_F: {
+ case ESCAPEI_D:
+ case ESCAPEI_F:
+ case ESCAPEI_I: {
save_caller_save_regs(f, j);
jit_operand_t args[2] = {
jit_operand_imm(JIT_OPERAND_ABI_WORD,
operands_len(&src) / 2),
- jit_operand_gpr(JIT_OPERAND_ABI_POINTER, JIT_SP)
+ /* compile_imm_call populates JIT_R0 with the
+ * argument stack address */
+ jit_operand_gpr(JIT_OPERAND_ABI_POINTER, JIT_R0)
};
- compile_imm_call(j, &src, &dst, (void *)i.o, 2, args);
+ compile_imm_call(j, &src, &dst, (void *)(uintptr_t)i.o, 2, args);
restore_caller_save_regs(f, j);
operands_reset(&src);
@@ -2106,10 +2215,21 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena,
break;
}
- case CALLI: {
+ case CALLI_L:
+#if __WORDSIZE == 64
+ call = ejit_run_func_l; goto calli;
+#else
+ assert(0 && "trying to compile calli_l on 32bit arch");
+ break;
+#endif
+
+ case CALLI_F: { call = ejit_run_func_f; goto calli; }
+ case CALLI_D: { call = ejit_run_func_d; goto calli; }
+ case CALLI_I: { call = ejit_run_func_i; goto calli;
+calli:
save_caller_save_regs(f, j);
- struct ejit_func *f = (struct ejit_func *)i.o;
+ struct ejit_func *f = (struct ejit_func *)(uintptr_t)i.o;
if (f && f->direct_call) {
jit_calli(j, f->direct_call, operands_len(&direct), direct.buf);
restore_caller_save_regs(f, j);
@@ -2124,9 +2244,11 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena,
jit_operand_imm(JIT_OPERAND_ABI_POINTER, i.o),
jit_operand_imm(JIT_OPERAND_ABI_WORD,
operands_len(&src) / 2),
- jit_operand_gpr(JIT_OPERAND_ABI_POINTER, JIT_SP)
+ /* compile_imm_call populates JIT_R0 with the
+ * argument stack address */
+ jit_operand_gpr(JIT_OPERAND_ABI_POINTER, JIT_R0)
};
- compile_imm_call(j, &src, &dst, ejit_run_func, 3, args);
+ compile_imm_call(j, &src, &dst, call, 3, args);
restore_caller_save_regs(f, j);
operands_reset(&src);
@@ -2151,8 +2273,7 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena,
case RETR_F: {
jit_fpr_t r = getloc_f(f, j, i.r1, 0);
- /* convert float to double so the return types match */
- jit_extr_f_d(j, JIT_F0, r);
+ jit_movr_f(j, JIT_F0, r);
jit_shrink_stack(j, stack);
jit_leave_jit_abi(j, gprs, fprs, frame);
jit_retr_f(j, JIT_F0);
@@ -2319,7 +2440,10 @@ bool ejit_compile(struct ejit_func *f, bool use_64)
while (1) {
arena = alloc_arena(size);
- assert(arena);
+ if (arena == (void *)(-1)) {
+ jit_destroy_state(j);
+ return false;
+ }
size_t required_size = compile_fn_body(f, j, arena, size);
if (required_size == 0)
diff --git a/src/ejit.c b/src/ejit.c
index b0a0d51..660d476 100644
--- a/src/ejit.c
+++ b/src/ejit.c
@@ -1,4 +1,3 @@
-#include <math.h>
#include <assert.h>
#include <sys/mman.h>
@@ -6,6 +5,22 @@
#include "common.h"
+static void check_operands(struct ejit_func *f, size_t argc, const struct ejit_operand args[argc])
+{
+ assert(argc == types_len(&f->sign));
+ for (size_t i = 0; i < types_len(&f->sign); ++i) {
+ assert(args[i].type == *types_at(&f->sign, i));
+ }
+}
+
+static void check_args(struct ejit_func *f, size_t argc, const struct ejit_arg args[argc])
+{
+ assert(argc == types_len(&f->sign));
+ for (size_t i = 0; i < types_len(&f->sign); ++i) {
+ assert(args[i].type == *types_at(&f->sign, i));
+ }
+}
+
static struct gpr_stat zero_gpr_stat()
{
return (struct gpr_stat){
@@ -314,6 +329,7 @@ struct ejit_func *ejit_create_func(enum ejit_type rtype, size_t argc,
f->rtype = rtype;
+ f->sign = types_create();
f->insns = insns_create();
f->labels = labels_create();
f->gpr = gpr_stats_create();
@@ -325,6 +341,8 @@ struct ejit_func *ejit_create_func(enum ejit_type rtype, size_t argc,
f->use_64 = false;
for (size_t i = 0; i < argc; ++i) {
+ types_append(&f->sign, args[i].type);
+
switch (args[i].kind) {
case EJIT_OPERAND_GPR: {
assert(ejit_int_type(args[i].type));
@@ -373,10 +391,7 @@ void ejit_select_compile_func(struct ejit_func *f, size_t gpr, size_t fpr,
void **labels;
/* just get labels, don't actually run anything yet */
- if (ejit_float_type(f->rtype))
- ejit_run_interp_f(f, 0, NULL, NULL, false, &labels);
- else
- ejit_run_interp(f, 0, NULL, NULL, false, &labels);
+ ejit_run(f, 0, NULL, NULL, false, &labels);
foreach_vec(ii, f->insns) {
struct ejit_insn i = *insns_at(&f->insns, ii);
@@ -395,6 +410,7 @@ void ejit_destroy_func(struct ejit_func *f)
if (f->arena)
munmap(f->arena, f->size);
+ types_destroy(&f->sign);
insns_destroy(&f->insns);
labels_destroy(&f->labels);
gpr_stats_destroy(&f->gpr);
@@ -417,9 +433,82 @@ void ejit_patch(struct ejit_func *f, struct ejit_reloc r, struct ejit_label l)
*insns_at(&f->insns, r.insn) = i;
}
-void ejit_calli(struct ejit_func *s, struct ejit_func *f, size_t argc,
+void ejit_calli_i(struct ejit_func *s, struct ejit_func *f, size_t argc,
+ const struct ejit_operand args[argc])
+{
+ check_operands(f, argc, args);
+
+ for (size_t i = 0; i < argc; ++i) {
+ switch (args[i].kind) {
+ case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break;
+ case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break;
+ case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break;
+ case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break;
+ default: abort();
+ }
+ }
+
+ emit_insn_op(s, CALLI_I, f);
+}
+
+void ejit_calli_l(struct ejit_func *s, struct ejit_func *f, size_t argc,
+ const struct ejit_operand args[argc])
+{
+ s->use_64 = true;
+ check_operands(f, argc, args);
+
+ for (size_t i = 0; i < argc; ++i) {
+ switch (args[i].kind) {
+ case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break;
+ case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break;
+ case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break;
+ case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break;
+ default: abort();
+ }
+ }
+
+ emit_insn_op(s, CALLI_L, f);
+}
+
+void ejit_calli_f(struct ejit_func *s, struct ejit_func *f, size_t argc,
const struct ejit_operand args[argc])
{
+ check_operands(f, argc, args);
+
+ for (size_t i = 0; i < argc; ++i) {
+ switch (args[i].kind) {
+ case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break;
+ case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break;
+ case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break;
+ case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break;
+ default: abort();
+ }
+ }
+
+ emit_insn_op(s, CALLI_F, f);
+}
+
+void ejit_calli_d(struct ejit_func *s, struct ejit_func *f, size_t argc,
+ const struct ejit_operand args[argc])
+{
+ check_operands(f, argc, args);
+
+ for (size_t i = 0; i < argc; ++i) {
+ switch (args[i].kind) {
+ case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break;
+ case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break;
+ case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break;
+ case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break;
+ default: abort();
+ }
+ }
+
+ emit_insn_op(s, CALLI_D, f);
+}
+
+void ejit_escapei_i(struct ejit_func *s, ejit_escape_i_t f, size_t argc,
+ const struct ejit_operand args[argc])
+{
for (size_t i = 0; i < argc; ++i) {
switch (args[i].kind) {
case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break;
@@ -430,12 +519,13 @@ void ejit_calli(struct ejit_func *s, struct ejit_func *f, size_t argc,
}
}
- emit_insn_op(s, CALLI, f);
+ emit_insn_op(s, ESCAPEI_I, f);
}
-void ejit_escapei(struct ejit_func *s, ejit_escape_t f, size_t argc,
+void ejit_escapei_l(struct ejit_func *s, ejit_escape_l_t f, size_t argc,
const struct ejit_operand args[argc])
{
+ s->use_64 = true;
for (size_t i = 0; i < argc; ++i) {
switch (args[i].kind) {
case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break;
@@ -446,7 +536,7 @@ void ejit_escapei(struct ejit_func *s, ejit_escape_t f, size_t argc,
}
}
- emit_insn_op(s, ESCAPEI, f);
+ emit_insn_op(s, ESCAPEI_L, f);
}
void ejit_escapei_f(struct ejit_func *s, ejit_escape_f_t f, size_t argc,
@@ -465,6 +555,22 @@ void ejit_escapei_f(struct ejit_func *s, ejit_escape_f_t f, size_t argc,
emit_insn_op(s, ESCAPEI_F, f);
}
+void ejit_escapei_d(struct ejit_func *s, ejit_escape_d_t f, size_t argc,
+ const struct ejit_operand args[argc])
+{
+ for (size_t i = 0; i < argc; ++i) {
+ switch (args[i].kind) {
+ case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break;
+ case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break;
+ case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break;
+ case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break;
+ default: abort();
+ }
+ }
+
+ emit_insn_op(s, ESCAPEI_D, f);
+}
+
void ejit_retval(struct ejit_func *s, struct ejit_gpr r0)
{
emit_insn_or(s, RETVAL, r0);
@@ -617,11 +723,13 @@ void ejit_ldi_u16(struct ejit_func *s, struct ejit_gpr r0, void *p)
void ejit_ldi_u32(struct ejit_func *s, struct ejit_gpr r0, void *p)
{
+ s->use_64 = true;
emit_insn_orp(s, LDIU32, r0, p);
}
void ejit_ldi_u64(struct ejit_func *s, struct ejit_gpr r0, void *p)
{
+ s->use_64 = true;
emit_insn_orp(s, LDIU64, r0, p);
}
@@ -802,6 +910,7 @@ void ejit_extr_16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1)
void ejit_extr_32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1)
{
+ s->use_64 = true;
emit_insn_orr(s, EXTR32, r0, r1);
}
@@ -817,6 +926,7 @@ void ejit_extr_u16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1)
void ejit_extr_u32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1)
{
+ s->use_64 = true;
emit_insn_orr(s, EXTRU32, r0, r1);
}
@@ -883,7 +993,7 @@ void ejit_subr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1,
}
void ejit_subi(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1,
- long o)
+ int64_t o)
{
emit_insn_orri(s, SUBI, r0, r1, o);
}
@@ -1541,71 +1651,105 @@ static void destroy_interp_state(struct interp_state state)
args_destroy(&state.args);
}
-int64_t ejit_run_interp(struct ejit_func *f, size_t argc,
- struct ejit_arg args[argc],
- struct interp_state *state,
- bool run,
- void ***labels_wb)
+long ejit_run_func_ctx_i(struct ejit_func *f, size_t argc, struct ejit_arg args[argc], struct interp_state *ctx)
{
- if (run) {
- assert(f->size && "trying to run a function that hasn't been compiled");
- assert(f->rtype == EJIT_VOID || ejit_int_type(f->rtype));
- if (f->arena)
- return ((ejit_escape_t)f->arena)(argc, args);
- }
+ check_args(f, argc, args);
+ assert((f->rtype == EJIT_VOID || ejit_int_type(f->rtype))
+#if __WORDSIZE != 64
+ && f->rtype != EJIT_INT64 && f->rtype != EJIT_UINT64
+#endif
+ );
- int64_t retval = 0; double retval_f = 0.0;
-#include "interp.inc"
- return retval;
+ return ejit_run(f, argc, args, ctx, true, NULL).i;
}
-double ejit_run_interp_f(struct ejit_func *f, size_t argc,
- struct ejit_arg args[argc],
- struct interp_state *state,
- bool run,
- void ***labels_wb)
+long ejit_run_func_i(struct ejit_func *f, size_t argc,
+ struct ejit_arg args[argc])
{
- if (run) {
- assert(f->size && "trying to run a function that hasn't been compiled");
- /* void functions should use ejit_run_interp */
- assert(ejit_float_type(f->rtype));
- if (f->arena)
- return ((ejit_escape_f_t)f->arena)(argc, args);
- }
+ struct interp_state state = create_interp_state();
+ long r = ejit_run_func_ctx_i(f, argc, args, &state);
+ destroy_interp_state(state);
+ return r;
+}
- int64_t retval = 0; double retval_f = 0.0;
-#include "interp.inc"
- return retval_f;
+int64_t ejit_run_func_ctx_l(struct ejit_func *f, size_t argc, struct ejit_arg args[argc], struct interp_state *ctx)
+{
+ check_args(f, argc, args);
+ assert(f->rtype == EJIT_INT64 || f->rtype == EJIT_UINT64);
+ return ejit_run(f, argc, args, ctx, true, NULL).i;
}
-int64_t ejit_run_func(struct ejit_func *f, size_t argc,
+int64_t ejit_run_func_l(struct ejit_func *f, size_t argc,
struct ejit_arg args[argc])
{
- assert(f->size && "trying to run a function that hasn't been compiled");
- assert(f->rtype == EJIT_VOID || ejit_int_type(f->rtype));
- if (f->arena)
- return (int64_t)((ejit_escape_t)f->arena)(argc, args);
-
struct interp_state state = create_interp_state();
- long r = ejit_run_interp(f, argc, args, &state, true, NULL);
+ int64_t r = ejit_run_func_ctx_l(f, argc, args, &state);
destroy_interp_state(state);
return r;
}
-double ejit_run_func_f(struct ejit_func *f, size_t argc,
+float ejit_run_func_ctx_f(struct ejit_func *f, size_t argc, struct ejit_arg args[argc], struct interp_state *ctx)
+{
+ check_args(f, argc, args);
+ assert(f->rtype == EJIT_FLOAT);
+ return ejit_run(f, argc, args, ctx, true, NULL).f;
+}
+
+float ejit_run_func_f(struct ejit_func *f, size_t argc,
struct ejit_arg args[argc])
{
- assert(f->size && "trying to run a function that hasn't been compiled");
- assert(ejit_float_type(f->rtype));
- if (f->arena)
- return ((ejit_escape_f_t)f->arena)(argc, args);
+ struct interp_state state = create_interp_state();
+ float r = ejit_run_func_ctx_f(f, argc, args, &state);
+ destroy_interp_state(state);
+ return r;
+}
+
+double ejit_run_func_ctx_d(struct ejit_func *f, size_t argc, struct ejit_arg args[argc], struct interp_state *ctx)
+{
+ check_args(f, argc, args);
+ assert(f->rtype == EJIT_DOUBLE);
+ return ejit_run(f, argc, args, ctx, true, NULL).f;
+}
+double ejit_run_func_d(struct ejit_func *f, size_t argc,
+ struct ejit_arg args[argc])
+{
struct interp_state state = create_interp_state();
- double r = ejit_run_interp_f(f, argc, args, &state, true, NULL);
+ double r = ejit_run_func_ctx_d(f, argc, args, &state);
destroy_interp_state(state);
return r;
}
+struct ejit_arg ejit_run_func(struct ejit_func *f, size_t argc, struct ejit_arg args[argc])
+{
+ switch (f->rtype) {
+ case EJIT_DOUBLE:
+ return (struct ejit_arg){
+ .d = ejit_run_func_d(f, argc, args),
+ .type = EJIT_DOUBLE
+ };
+
+ case EJIT_FLOAT:
+ return (struct ejit_arg){
+ .f = ejit_run_func_f(f, argc, args),
+ .type = EJIT_FLOAT
+ };
+
+ case EJIT_UINT64:
+ case EJIT_INT64:
+ return (struct ejit_arg){
+ .i64 = ejit_run_func_l(f, argc, args),
+ .type = f->rtype
+ };
+
+ default:
+ return (struct ejit_arg){
+ .i64 = ejit_run_func_i(f, argc, args),
+ .type = f->rtype
+ };
+ }
+}
+
size_t ejit_get_prio(struct ejit_func *s)
{
return s->prio;
diff --git a/src/interp.inc b/src/interp.c
index a88bec8..f8ba927 100644
--- a/src/interp.inc
+++ b/src/interp.c
@@ -1,6 +1,11 @@
+#include <math.h>
+#include <stdio.h>
+#include "common.h"
+
/* this is the body of a given ejit_interp function, it assumes there's an
* external int64_t retval and double retval_f into which it places the value to
* be returned. Included from src/interp.c */
+union interp_ret ejit_run(struct ejit_func *f, size_t argc, struct ejit_arg args[argc], struct interp_state *state, bool run, void ***labels_wb)
{
static void *labels[OPCODE_COUNT] = {
[MOVI] = &&MOVI,
@@ -199,10 +204,14 @@
[PARAM] = &&PARAM,
[PARAM_F] = &&PARAM_F,
- [CALLI] = &&CALLI,
+ [CALLI_I] = &&CALLI_I,
+ [CALLI_L] = &&CALLI_L,
[CALLI_F] = &&CALLI_F,
- [ESCAPEI] = &&ESCAPEI,
+ [CALLI_D] = &&CALLI_D,
+ [ESCAPEI_I] = &&ESCAPEI_I,
[ESCAPEI_F] = &&ESCAPEI_F,
+ [ESCAPEI_L] = &&ESCAPEI_L,
+ [ESCAPEI_D] = &&ESCAPEI_D,
[START] = &&START,
[END] = &&END,
@@ -213,6 +222,31 @@
goto zero_out;
}
+ assert(f->size && "trying to run a function that hasn't been compiled");
+
+ if (f->arena) {
+ if (f->rtype == EJIT_INT64 || f->rtype == EJIT_UINT64)
+ return (union interp_ret){
+ .i = ((ejit_escape_l_t)f->arena)(argc, args)
+ };
+
+ if (f->rtype == EJIT_DOUBLE)
+ return (union interp_ret){
+ .f = ((ejit_escape_d_t)f->arena)(argc, args)
+ };
+
+ if (f->rtype == EJIT_FLOAT)
+ return (union interp_ret){
+ .f = ((ejit_escape_f_t)f->arena)(argc, args)
+ };
+
+ return (union interp_ret){
+ .i = ((ejit_escape_i_t)f->arena)(argc, args)
+ };
+ }
+
+ int64_t retval = 0; double retval_f = 0.0;
+
size_t prev_gprs = gprs_len(&state->gprs);
size_t prev_fprs = fprs_len(&state->fprs);
size_t prev_argc = args_len(&state->args);
@@ -224,7 +258,7 @@
double d;
float f;
};
- long *gpr = ((long *)state->gprs.buf) + prev_gprs;
+ int64_t *gpr = ((int64_t *)state->gprs.buf) + prev_gprs;
union fpr *fpr = ((union fpr *)state->fprs.buf) + prev_fprs;
struct ejit_insn *insns = f->insns.buf;
@@ -244,7 +278,7 @@
DISPATCH();
DO(END);
- goto out;
+ goto zero_out;
DISPATCH();
DO(MOVI);
@@ -530,62 +564,62 @@
DISPATCH();
DO(STXI8);
- int8_t *addr = (int8_t *)(gpr[i.r1] + i.o);
+ int8_t *addr = (int8_t *)(uintptr_t)(gpr[i.r1] + i.o);
*addr = gpr[i.r0];
DISPATCH();
DO(STXI16);
- int16_t *addr = (int16_t *)(gpr[i.r1] + i.o);
+ int16_t *addr = (int16_t *)(uintptr_t)(gpr[i.r1] + i.o);
*addr = gpr[i.r0];
DISPATCH();
DO(STXI32);
- int32_t *addr = (int32_t *)(gpr[i.r1] + i.o);
+ int32_t *addr = (int32_t *)(uintptr_t)(gpr[i.r1] + i.o);
*addr = gpr[i.r0];
DISPATCH();
DO(STXI64);
- int64_t *addr = (int64_t *)(gpr[i.r1] + i.o);
+ int64_t *addr = (int64_t *)(uintptr_t)(gpr[i.r1] + i.o);
*addr = gpr[i.r0];
DISPATCH();
DO(STXIF);
- float *addr = (float *)(gpr[i.r1] + i.o);
+ float *addr = (float *)(uintptr_t)(gpr[i.r1] + i.o);
*addr = fpr[i.r0].f;
DISPATCH();
DO(STXID);
- double *addr = (double *)(gpr[i.r1] + i.o);
+ double *addr = (double *)(uintptr_t)(gpr[i.r1] + i.o);
*addr = fpr[i.r0].d;
DISPATCH();
DO(STXR8);
- int8_t *addr = (int8_t *)(gpr[i.r1] + gpr[i.r2]);
+ int8_t *addr = (int8_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
*addr = gpr[i.r0];
DISPATCH();
DO(STXR16);
- int16_t *addr = (int16_t *)(gpr[i.r1] + gpr[i.r2]);
+ int16_t *addr = (int16_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
*addr = gpr[i.r0];
DISPATCH();
DO(STXR32);
- int32_t *addr = (int32_t *)(gpr[i.r1] + gpr[i.r2]);
+ int32_t *addr = (int32_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
*addr = gpr[i.r0];
DISPATCH();
DO(STXR64);
- int64_t *addr = (int64_t *)(gpr[i.r1] + gpr[i.r2]);
+ int64_t *addr = (int64_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
*addr = gpr[i.r0];
DISPATCH();
DO(STXRF);
- float *addr = (float *)(gpr[i.r1] + gpr[i.r2]);
+ float *addr = (float *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
*addr = fpr[i.r0].f;
DISPATCH();
DO(STXRD);
- double *addr = (double *)(gpr[i.r1] + gpr[i.r2]);
+ double *addr = (double *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
*addr = fpr[i.r0].d;
DISPATCH();
@@ -640,102 +674,102 @@
DISPATCH();
DO(LDXI8);
- int8_t *addr = (int8_t *)(gpr[i.r1] + i.o);
+ int8_t *addr = (int8_t *)(uintptr_t)(gpr[i.r1] + i.o);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXI16);
- int16_t *addr = (int16_t *)(gpr[i.r1] + i.o);
+ int16_t *addr = (int16_t *)(uintptr_t)(gpr[i.r1] + i.o);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXI32);
- int32_t *addr = (int32_t *)(gpr[i.r1] + i.o);
+ int32_t *addr = (int32_t *)(uintptr_t)(gpr[i.r1] + i.o);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXI64);
- int64_t *addr = (int64_t *)(gpr[i.r1] + i.o);
+ int64_t *addr = (int64_t *)(uintptr_t)(gpr[i.r1] + i.o);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXIU8);
- uint8_t *addr = (uint8_t *)(gpr[i.r1] + i.o);
+ uint8_t *addr = (uint8_t *)(uintptr_t)(gpr[i.r1] + i.o);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXIU16);
- uint16_t *addr = (uint16_t *)(gpr[i.r1] + i.o);
+ uint16_t *addr = (uint16_t *)(uintptr_t)(gpr[i.r1] + i.o);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXIU32);
- uint32_t *addr = (uint32_t *)(gpr[i.r1] + i.o);
+ uint32_t *addr = (uint32_t *)(uintptr_t)(gpr[i.r1] + i.o);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXIU64);
- uint64_t *addr = (uint64_t *)(gpr[i.r1] + i.o);
+ uint64_t *addr = (uint64_t *)(uintptr_t)(gpr[i.r1] + i.o);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXIF);
- float *addr = (float *)(gpr[i.r1] + i.o);
+ float *addr = (float *)(uintptr_t)(gpr[i.r1] + i.o);
fpr[i.r0].f = *addr;
DISPATCH();
DO(LDXID);
- double *addr = (double *)(gpr[i.r1] + i.o);
+ double *addr = (double *)(uintptr_t)(gpr[i.r1] + i.o);
fpr[i.r0].d = *addr;
DISPATCH();
DO(LDXR8);
- int8_t *addr = (int8_t *)(gpr[i.r1] + gpr[i.r2]);
+ int8_t *addr = (int8_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXR16);
- int16_t *addr = (int16_t *)(gpr[i.r1] + gpr[i.r2]);
+ int16_t *addr = (int16_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXR32);
- int32_t *addr = (int32_t *)(gpr[i.r1] + gpr[i.r2]);
+ int32_t *addr = (int32_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXR64);
- int64_t *addr = (int64_t *)(gpr[i.r1] + gpr[i.r2]);
+ int64_t *addr = (int64_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXRU8);
- uint8_t *addr = (uint8_t *)(gpr[i.r1] + gpr[i.r2]);
+ uint8_t *addr = (uint8_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXRU16);
- uint16_t *addr = (uint16_t *)(gpr[i.r1] + gpr[i.r2]);
+ uint16_t *addr = (uint16_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXRU32);
- uint32_t *addr = (uint32_t *)(gpr[i.r1] + gpr[i.r2]);
+ uint32_t *addr = (uint32_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXRU64);
- uint64_t *addr = (uint64_t *)(gpr[i.r1] + gpr[i.r2]);
+ uint64_t *addr = (uint64_t *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
gpr[i.r0] = *addr;
DISPATCH();
DO(LDXRF);
- float *addr = (float *)(gpr[i.r1] + gpr[i.r2]);
+ float *addr = (float *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
fpr[i.r0].f = *addr;
DISPATCH();
DO(LDXRD);
- double *addr = (double *)(gpr[i.r1] + gpr[i.r2]);
+ double *addr = (double *)(uintptr_t)(gpr[i.r1] + gpr[i.r2]);
fpr[i.r0].d = *addr;
DISPATCH();
@@ -985,37 +1019,68 @@
args_append(&state->args, a);
DISPATCH();
- DO(CALLI);
+ DO(CALLI_I);
+ struct ejit_func *f = i.p;
+ size_t argc = args_len(&state->args) - prev_argc;
+ struct ejit_arg *args = state->args.buf + prev_argc;
+
+ retval = ejit_run(f, argc, args, state, true, NULL).i;
+
+ gpr = state->gprs.buf + prev_gprs;
+ fpr = (union fpr *)state->fprs.buf + prev_fprs;
+ args_shrink(&state->args, prev_argc);
+ DISPATCH();
+
+ DO(CALLI_L);
struct ejit_func *f = i.p;
size_t argc = args_len(&state->args) - prev_argc;
- struct ejit_arg *args = ((struct ejit_arg *)state->args.buf) +
- prev_argc;
+ struct ejit_arg *args = state->args.buf + prev_argc;
- retval = ejit_run_interp(f, argc, args, state, true, NULL);
+ retval = ejit_run(f, argc, args, state, true, NULL).i;
- gpr = ((long *)state->gprs.buf) + prev_gprs;
- fpr = ((union fpr *)state->fprs.buf) + prev_fprs;
+ gpr = state->gprs.buf + prev_gprs;
+ fpr = (union fpr *)state->fprs.buf + prev_fprs;
args_shrink(&state->args, prev_argc);
DISPATCH();
DO(CALLI_F);
struct ejit_func *f = i.p;
size_t argc = args_len(&state->args) - prev_argc;
- struct ejit_arg *args = ((struct ejit_arg *)state->args.buf) +
- prev_argc;
+ struct ejit_arg *args = state->args.buf + prev_argc;
- retval_f = ejit_run_interp_f(f, argc, args, state, true, NULL);
+ retval_f = ejit_run(f, argc, args, state, true, NULL).f;
- gpr = ((long *)state->gprs.buf) + prev_gprs;
- fpr = ((union fpr *)state->fprs.buf) + prev_fprs;
+ gpr = state->gprs.buf + prev_gprs;
+ fpr = (union fpr *)state->fprs.buf + prev_fprs;
args_shrink(&state->args, prev_argc);
DISPATCH();
- DO(ESCAPEI);
- ejit_escape_t f = i.p;
+ DO(CALLI_D);
+ struct ejit_func *f = i.p;
size_t argc = args_len(&state->args) - prev_argc;
- struct ejit_arg *args = ((struct ejit_arg *)state->args.buf) +
- prev_argc;
+ struct ejit_arg *args = state->args.buf + prev_argc;
+
+ retval_f = ejit_run(f, argc, args, state, true, NULL).f;
+
+ gpr = state->gprs.buf + prev_gprs;
+ fpr = (union fpr *)state->fprs.buf + prev_fprs;
+ args_shrink(&state->args, prev_argc);
+ DISPATCH();
+
+ DO(ESCAPEI_I);
+ ejit_escape_i_t f = i.p;
+ size_t argc = args_len(&state->args) - prev_argc;
+ struct ejit_arg *args = state->args.buf + prev_argc;
+
+ retval = f(argc, args);
+
+ args_shrink(&state->args, prev_argc);
+ DISPATCH();
+
+ DO(ESCAPEI_L);
+ ejit_escape_l_t f = i.p;
+ size_t argc = args_len(&state->args) - prev_argc;
+ struct ejit_arg *args = state->args.buf + prev_argc;
retval = f(argc, args);
@@ -1025,8 +1090,17 @@
DO(ESCAPEI_F);
ejit_escape_f_t f = i.p;
size_t argc = args_len(&state->args) - prev_argc;
- struct ejit_arg *args = ((struct ejit_arg *)state->args.buf) +
- prev_argc;
+ struct ejit_arg *args = state->args.buf + prev_argc;
+
+ retval_f = f(argc, args);
+
+ args_shrink(&state->args, prev_argc);
+ DISPATCH();
+
+ DO(ESCAPEI_D);
+ ejit_escape_d_t f = i.p;
+ size_t argc = args_len(&state->args) - prev_argc;
+ struct ejit_arg *args = state->args.buf + prev_argc;
retval_f = f(argc, args);
@@ -1037,41 +1111,48 @@
* symmetry */
DO(RETR);
retval = gpr[i.r1];
- goto out;
+ goto out_int;
DISPATCH();
DO(RETI);
retval = i.o;
- goto out;
+ goto out_int;
DISPATCH();
DO(RETR_F);
retval_f = fpr[i.r1].f;
- goto out;
+ goto out_float;
DISPATCH();
DO(RETR_D);
retval_f = fpr[i.r1].d;
- goto out;
+ goto out_float;
DISPATCH();
DO(RETI_F);
retval_f = i.f;
- goto out;
+ goto out_float;
DISPATCH();
DO(RETI_D);
retval_f = i.d;
- goto out;
+ goto out_float;
DISPATCH();
#undef DISPATCH
#undef JUMP
#undef DO
-out:
+out_float:
+ gprs_shrink(&state->gprs, prev_gprs);
+ fprs_shrink(&state->fprs, prev_fprs);
+ return (union interp_ret){.f = retval_f};
+
+out_int:
gprs_shrink(&state->gprs, prev_gprs);
fprs_shrink(&state->fprs, prev_fprs);
+ return (union interp_ret){.i = retval};
zero_out:
+ return (union interp_ret){.i = 0};
}
diff --git a/src/vec.h b/src/vec.h
index f982bac..f5a6fd9 100644
--- a/src/vec.h
+++ b/src/vec.h
@@ -73,6 +73,7 @@ static inline void VEC(append)(struct VEC_STRUCT *v, VEC_TYPE n)
if (v->n >= v->s) {
v->s *= 2;
v->buf = realloc(v->buf, v->s * sizeof(VEC_TYPE));
+ assert(v->buf);
}
v->buf[v->n - 1] = n;
@@ -99,6 +100,9 @@ static inline void VEC(reserve)(struct VEC_STRUCT *v, size_t n)
return;
v->n = n;
+ if (v->s >= v->n)
+ return;
+
while (v->s < v->n)
v->s *= 2;
diff --git a/tests/absr_d.c b/tests/absr_d.c
index 20424a7..e999a1c 100644
--- a/tests/absr_d.c
+++ b/tests/absr_d.c
@@ -14,9 +14,9 @@ int main(int argc, char *argv[])
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);
+ assert(erfd1(f, EJIT_ARG(0.0, double)) == 0.0);
+ assert(erfd1(f, EJIT_ARG(-0.0, double)) == 0.0);
+ assert(erfd1(f, EJIT_ARG(0.5, double)) == 0.5);
+ assert(erfd1(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 876d82c..ec3a5f1 100644
--- a/tests/absr_f.c
+++ b/tests/absr_f.c
@@ -14,9 +14,9 @@ int main(int argc, char *argv[])
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, 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);
+ assert(erff1(f, EJIT_ARG(0.0, float)) == 0.0);
+ assert(erff1(f, EJIT_ARG(-0.0, float)) == 0.0);
+ assert(erff1(f, EJIT_ARG(0.5, float)) == 0.5);
+ assert(erff1(f, EJIT_ARG(-0.5, float)) == 0.5);
ejit_destroy_func(f);
}
diff --git a/tests/addi.c b/tests/addi.c
index 90579eb..20eefdb 100644
--- a/tests/addi.c
+++ b/tests/addi.c
@@ -14,6 +14,6 @@ int main(int argc, char *argv[])
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 1, 0, EJIT_USE64(int), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG(42, int)) == 111);
+ assert(erfi1(f, EJIT_ARG(42, int)) == 111);
ejit_destroy_func(f);
}
diff --git a/tests/addr.c b/tests/addr.c
index efdae30..0950483 100644
--- a/tests/addr.c
+++ b/tests/addr.c
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(42, long),
EJIT_ARG(69, long)) == 111);
ejit_destroy_func(f);
diff --git a/tests/addr_d.c b/tests/addr_d.c
index 0a1cfa5..e58bf58 100644
--- a/tests/addr_d.c
+++ b/tests/addr_d.c
@@ -18,8 +18,8 @@ int main(int argc, char *argv[])
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),
+ assert(erfd2(f, EJIT_ARG(42., double), EJIT_ARG(69., double)) == 111.);
+ assert(erfd2(f, EJIT_ARG(42.5, double),
EJIT_ARG(69.5, double)) == 112.);
ejit_destroy_func(f);
}
diff --git a/tests/andi.c b/tests/andi.c
index a587aab..c8fa277 100644
--- a/tests/andi.c
+++ b/tests/andi.c
@@ -17,9 +17,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG(0x7fffffff, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG(0x80000000, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(0x7fffffffffffffff, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG(0x8000000000000000, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(0x7fffffff, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0x80000000, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(0x7fffffffffffffff, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0x8000000000000000, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/andr64.c b/tests/andr64.c
index 3d56e39..aa87b4d 100644
--- a/tests/andr64.c
+++ b/tests/andr64.c
@@ -18,73 +18,73 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(1, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(1, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0x80000000, int64_t)
) == 0);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(0x7fffffff, int64_t)
)== 0);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0xffffffff, int64_t)
) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(0x7fffffff, int64_t)
) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(0xffffffff, int64_t)
) == 0xffffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t), EJIT_ARG(0, int64_t)
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t), EJIT_ARG(0, int64_t)
) == 0);
- assert(erf2(f, EJIT_ARG(0, int64_t), EJIT_ARG(0x7fffffff, int64_t)
+ assert(erfl2(f, EJIT_ARG(0, int64_t), EJIT_ARG(0x7fffffff, int64_t)
) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(1, int64_t)
) == 1);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)
) == 1);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(1, int64_t)
) == 0);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)
) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)
) == 0);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)
) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(0xffffffffffffffff, int64_t)
) == 0x7fffffffffffffff);
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)
) == 0x7fffffffffffffff);
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
EJIT_ARG(0xffffffffffffffff, int64_t)
) == (int64_t)0xffffffffffffffff);
diff --git a/tests/beqi.c b/tests/beqi.c
index 8ef5119..d35b705 100644
--- a/tests/beqi.c
+++ b/tests/beqi.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG( 0, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG( 1, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 0, long)) == 1);
+ assert(erfi1(f, EJIT_ARG( 1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/beqr.c b/tests/beqr.c
index 938f1be..1fcadf4 100644
--- a/tests/beqr.c
+++ b/tests/beqr.c
@@ -22,12 +22,12 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG( 1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/beqr_d.c b/tests/beqr_d.c
index 62e4269..b7e401e 100644
--- a/tests/beqr_d.c
+++ b/tests/beqr_d.c
@@ -23,15 +23,15 @@ int main(int argc, char *argv[])
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);
+ assert(erfi2(f, EJIT_ARG(0, double), EJIT_ARG(0, double)) == 1);
+ assert(erfi2(f, EJIT_ARG(0, double), EJIT_ARG(1, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(0, double), EJIT_ARG(-1, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 1);
+
+ assert(erfi2(f, EJIT_ARG(0, double), EJIT_ARG(0.0/0.0, double)) == 0);
+ assert(erfi2(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 9444284..0d16ce9 100644
--- a/tests/beqr_f.c
+++ b/tests/beqr_f.c
@@ -23,29 +23,37 @@ int main(int argc, char *argv[])
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(erfi2(f,
+ EJIT_ARG( 0, float),
+ EJIT_ARG( 0, float)) == 1);
- assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(1, float)
- ) == 0);
+ assert(erfi2(f,
+ EJIT_ARG( 0, float),
+ EJIT_ARG( 1, float)) == 0);
- assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)
- ) == 0);
+ assert(erfi2(f,
+ EJIT_ARG( 1, float),
+ EJIT_ARG( 0, float)) == 0);
- assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)
- ) == 0);
+ assert(erfi2(f,
+ EJIT_ARG(-1, float),
+ EJIT_ARG( 0, float)) == 0);
- assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(-1, float)
- ) == 0);
+ assert(erfi2(f,
+ EJIT_ARG( 0, float),
+ EJIT_ARG(-1, float)) == 0);
- assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)
- ) == 1);
+ assert(erfi2(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(erfi2(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);
+ assert(erfi2(f,
+ EJIT_ARG( 0.0/0.0, float),
+ EJIT_ARG( 0, float)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bgei.c b/tests/bgei.c
index 1fb1c53..3baeae6 100644
--- a/tests/bgei.c
+++ b/tests/bgei.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(0, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bgei_u.c b/tests/bgei_u.c
index 20ac961..f400b5f 100644
--- a/tests/bgei_u.c
+++ b/tests/bgei_u.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(0, long)) == 1);
- assert(erf1(f, EJIT_ARG(1, long)) == 1);
- assert(erf1(f, EJIT_ARG(-1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/bger.c b/tests/bger.c
index ae33f33..14fefac 100644
--- a/tests/bger.c
+++ b/tests/bger.c
@@ -21,11 +21,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(-1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/bger_u.c b/tests/bger_u.c
index 150a14c..97c8a18 100644
--- a/tests/bger_u.c
+++ b/tests/bger_u.c
@@ -21,11 +21,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(-1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bgti.c b/tests/bgti.c
index c6a3386..ac4d704 100644
--- a/tests/bgti.c
+++ b/tests/bgti.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bgti_u.c b/tests/bgti_u.c
index c0055d4..1112fec 100644
--- a/tests/bgti_u.c
+++ b/tests/bgti_u.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG( 0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/bgtr.c b/tests/bgtr.c
index a0d0c85..d970416 100644
--- a/tests/bgtr.c
+++ b/tests/bgtr.c
@@ -21,11 +21,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(-1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/bgtr_d.c b/tests/bgtr_d.c
index 57e8d0e..02ae115 100644
--- a/tests/bgtr_d.c
+++ b/tests/bgtr_d.c
@@ -21,14 +21,14 @@ int main(int argc, char *argv[])
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(erfi2(f, EJIT_ARG(0, double), EJIT_ARG(0, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(0, double), EJIT_ARG(1, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 0);
+ assert(erfi2(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);
+ assert(erfi2(f, EJIT_ARG(0, double), EJIT_ARG(0.0/0.0, double)) == 0);
+ assert(erfi2(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 d362d8a..5da3e02 100644
--- a/tests/bgtr_f.c
+++ b/tests/bgtr_f.c
@@ -21,26 +21,33 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 2, EJIT_USE64(long), do_jit);
- assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0, float)
- ) == 0);
+ assert(erfi2(f,
+ EJIT_ARG(0, float),
+ EJIT_ARG(0, float)) == 0);
- assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(1, float)
- ) == 0);
+ assert(erfi2(f,
+ EJIT_ARG(0, float),
+ EJIT_ARG(1, float)) == 0);
- assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)
- ) == 1);
+ assert(erfi2(f,
+ EJIT_ARG(1, float),
+ EJIT_ARG(0, float)) == 1);
- assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)
- ) == 0);
+ assert(erfi2(f,
+ EJIT_ARG(-1, float),
+ EJIT_ARG(0, float)) == 0);
- assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(-1, float)
- ) == 1);
+ assert(erfi2(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(erfi2(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);
+ assert(erfi2(f,
+ EJIT_ARG(0.0/0.0, float),
+ EJIT_ARG(0, float)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bgtr_u.c b/tests/bgtr_u.c
index 77e07fe..d6e1e9d 100644
--- a/tests/bgtr_u.c
+++ b/tests/bgtr_u.c
@@ -21,11 +21,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(-1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/blei.c b/tests/blei.c
index f4ab77a..3a80c94 100644
--- a/tests/blei.c
+++ b/tests/blei.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG( 0, long)) == 1);
+ assert(erfi1(f, EJIT_ARG( 1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/blei_u.c b/tests/blei_u.c
index b078995..1658e36 100644
--- a/tests/blei_u.c
+++ b/tests/blei_u.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(0, long)) == 1);
- assert(erf1(f, EJIT_ARG(1, long)) == 0);
- assert(erf1(f, EJIT_ARG(-1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 0, long)) == 1);
+ assert(erfi1(f, EJIT_ARG( 1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bler.c b/tests/bler.c
index baaef41..bd7abf0 100644
--- a/tests/bler.c
+++ b/tests/bler.c
@@ -21,11 +21,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(-1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bler_d.c b/tests/bler_d.c
index 3d3d1d7..f1dab79 100644
--- a/tests/bler_d.c
+++ b/tests/bler_d.c
@@ -21,14 +21,14 @@ int main(int argc, char *argv[])
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(erfi2(f, EJIT_ARG( 0, double), EJIT_ARG( 0, double)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, double), EJIT_ARG( 1, double)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, double), EJIT_ARG( 0, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, double), EJIT_ARG( 0, double)) == 1);
+ assert(erfi2(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);
+ assert(erfi2(f, EJIT_ARG(0, double), EJIT_ARG(0.0/0.0, double)) == 0);
+ assert(erfi2(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 8ff0a0a..9cc6b26 100644
--- a/tests/bler_f.c
+++ b/tests/bler_f.c
@@ -21,26 +21,33 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 2, EJIT_USE64(long), do_jit);
- assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(0, float)
- ) == 1);
+ assert(erfi2(f,
+ EJIT_ARG(0, float),
+ EJIT_ARG(0, float)) == 1);
- assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(1, float)
- ) == 1);
+ assert(erfi2(f,
+ EJIT_ARG(0, float),
+ EJIT_ARG(1, float)) == 1);
- assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)
- ) == 0);
+ assert(erfi2(f,
+ EJIT_ARG(1, float),
+ EJIT_ARG(0, float)) == 0);
- assert(erf2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)
- ) == 1);
+ assert(erfi2(f,
+ EJIT_ARG(-1, float),
+ EJIT_ARG(0, float)) == 1);
- assert(erf2(f, EJIT_ARG(0, float), EJIT_ARG(-1, float)
- ) == 0);
+ assert(erfi2(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(erfi2(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);
+ assert(erfi2(f,
+ EJIT_ARG(0.0/0.0, float),
+ EJIT_ARG(0, float)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bler_u.c b/tests/bler_u.c
index 64698aa..5d11f5a 100644
--- a/tests/bler_u.c
+++ b/tests/bler_u.c
@@ -21,11 +21,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(-1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/blti.c b/tests/blti.c
index af1a483..e102265 100644
--- a/tests/blti.c
+++ b/tests/blti.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/blti_u.c b/tests/blti_u.c
index 91d3ba4..ea350b7 100644
--- a/tests/blti_u.c
+++ b/tests/blti_u.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bltr.c b/tests/bltr.c
index 595cdaa..1e85e26 100644
--- a/tests/bltr.c
+++ b/tests/bltr.c
@@ -21,11 +21,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(-1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bltr_d.c b/tests/bltr_d.c
index 7d251be..848462b 100644
--- a/tests/bltr_d.c
+++ b/tests/bltr_d.c
@@ -21,14 +21,14 @@ int main(int argc, char *argv[])
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(erfi2(f, EJIT_ARG( 0, double), EJIT_ARG( 0, double)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, double), EJIT_ARG( 1, double)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, double), EJIT_ARG( 0, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, double), EJIT_ARG( 0, double)) == 1);
+ assert(erfi2(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);
+ assert(erfi2(f, EJIT_ARG(0, double), EJIT_ARG(0.0/0.0, double)) == 0);
+ assert(erfi2(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 230a1bf..07ab86b 100644
--- a/tests/bltr_f.c
+++ b/tests/bltr_f.c
@@ -21,14 +21,14 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 2, EJIT_USE64(long), do_jit);
- 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(erfi2(f, EJIT_ARG( 0, float), EJIT_ARG( 0, float)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, float), EJIT_ARG( 1, float)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, float), EJIT_ARG( 0, float)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, float), EJIT_ARG( 0, float)) == 1);
+ assert(erfi2(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);
+ assert(erfi2(f, EJIT_ARG(0, float), EJIT_ARG(0.0/0.0, float)) == 0);
+ assert(erfi2(f, EJIT_ARG(0.0/0.0, float), EJIT_ARG(0, float)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bltr_u.c b/tests/bltr_u.c
index 9e7d0e6..dbbaf3b 100644
--- a/tests/bltr_u.c
+++ b/tests/bltr_u.c
@@ -21,11 +21,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(-1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/bmci.c b/tests/bmci.c
index 011cbd3..3b2d302 100644
--- a/tests/bmci.c
+++ b/tests/bmci.c
@@ -20,10 +20,10 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG( 0, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG( 1, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG( 2, long)) == 1);
+ assert(erfi1(f, EJIT_ARG( 0, long)) == 1);
+ assert(erfi1(f, EJIT_ARG( 1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 2, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/bmcr.c b/tests/bmcr.c
index aaa4038..9e5e71c 100644
--- a/tests/bmcr.c
+++ b/tests/bmcr.c
@@ -21,15 +21,15 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG( 1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG(-1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG( 1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(-1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG(-1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG(-1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bmsi.c b/tests/bmsi.c
index 1ed54b4..92ae0e8 100644
--- a/tests/bmsi.c
+++ b/tests/bmsi.c
@@ -20,10 +20,10 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG( 0, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG( 1, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG( 2, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG( 2, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bmsr.c b/tests/bmsr.c
index 8523e92..6d613e9 100644
--- a/tests/bmsr.c
+++ b/tests/bmsr.c
@@ -21,15 +21,15 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG( 1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG(-1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG( 1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(-1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG(-1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/bnei.c b/tests/bnei.c
index add6f74..449c8b7 100644
--- a/tests/bnei.c
+++ b/tests/bnei.c
@@ -21,9 +21,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG( 0, long)) == 0);
- assert(ejit_run_func_1(f, EJIT_ARG( 1, long)) == 1);
- assert(ejit_run_func_1(f, EJIT_ARG(-1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG( 0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG( 1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/bner.c b/tests/bner.c
index 51fb1b5..d5ceb80 100644
--- a/tests/bner.c
+++ b/tests/bner.c
@@ -22,12 +22,12 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG( 1, long), EJIT_ARG( 1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG( 1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG( 0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, long), EJIT_ARG(-1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, long), EJIT_ARG( 1, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/bner_d.c b/tests/bner_d.c
index b4a2e46..d0e32a1 100644
--- a/tests/bner_d.c
+++ b/tests/bner_d.c
@@ -22,16 +22,16 @@ int main(int argc, char *argv[])
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(erfi2(f, EJIT_ARG( 0, double), EJIT_ARG( 0, double)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, double), EJIT_ARG( 1, double)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, double), EJIT_ARG( 0, double)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, double), EJIT_ARG( 0, double)) == 1);
+ assert(erfi2(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(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
+ assert(erfi2(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);
+ assert(erfi2(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 a48ef2c..5c38d92 100644
--- a/tests/bner_f.c
+++ b/tests/bner_f.c
@@ -23,14 +23,14 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 2, EJIT_USE64(float), do_jit);
- 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);
+ assert(erfi2(f, EJIT_ARG( 0, float), EJIT_ARG( 0, float)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, float), EJIT_ARG( 1, float)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, float), EJIT_ARG( 0, float)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, float), EJIT_ARG( 0, float)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0, float), EJIT_ARG(-1, float)) == 1);
+ assert(erfi2(f, EJIT_ARG( 1, float), EJIT_ARG( 1, float)) == 0);
+ assert(erfi2(f, EJIT_ARG( 0, float), EJIT_ARG( 0.0/0.0, float)) == 1);
+ assert(erfi2(f, EJIT_ARG( 0.0/0.0, float), EJIT_ARG(0, float)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/callee_9.c b/tests/callee_9.c
index 38d7595..5ef5938 100644
--- a/tests/callee_9.c
+++ b/tests/callee_9.c
@@ -31,22 +31,29 @@ int main(int argc, char *argv[])
};
struct ejit_func *f = ejit_create_func(EJIT_POINTER, 9, operands);
- EJIT_STXI(f, int8_t, EJIT_GPR(1), EJIT_GPR(0),
- offsetof(struct args, a)); // a
- EJIT_STXI(f, int16_t, EJIT_GPR(2), EJIT_GPR(0),
- offsetof(struct args, b)); // b
- EJIT_STXI(f, int32_t, EJIT_GPR(3), EJIT_GPR(0),
- offsetof(struct args, c)); // c
- EJIT_STXI(f, long, EJIT_GPR(4), EJIT_GPR(0),
- offsetof(struct args, d)); // d
- EJIT_STXI(f, uint16_t, EJIT_GPR(5), EJIT_GPR(0),
- offsetof(struct args, e)); // e
- EJIT_STXI(f, float, EJIT_FPR(0), EJIT_GPR(0),
- offsetof(struct args, f)); // f
- EJIT_STXI(f, double, EJIT_FPR(1), EJIT_GPR(0),
- offsetof(struct args, g)); // g
- EJIT_STXI(f, float, EJIT_FPR(2), EJIT_GPR(0),
- offsetof(struct args, h)); // h
+ EJIT_STXI(f, int8_t,
+ EJIT_GPR(1), EJIT_GPR(0), offsetof(struct args, a)); // a
+
+ EJIT_STXI(f, int16_t,
+ EJIT_GPR(2), EJIT_GPR(0), offsetof(struct args, b)); // b
+
+ EJIT_STXI(f, int32_t,
+ EJIT_GPR(3), EJIT_GPR(0), offsetof(struct args, c)); // c
+
+ EJIT_STXI(f, long,
+ EJIT_GPR(4), EJIT_GPR(0), offsetof(struct args, d)); // d
+
+ EJIT_STXI(f, uint16_t,
+ EJIT_GPR(5), EJIT_GPR(0), offsetof(struct args, e)); // e
+
+ EJIT_STXI(f, float,
+ EJIT_FPR(0), EJIT_GPR(0), offsetof(struct args, f)); // f
+
+ EJIT_STXI(f, double,
+ EJIT_FPR(1), EJIT_GPR(0), offsetof(struct args, g)); // g
+
+ EJIT_STXI(f, float,
+ EJIT_FPR(2), EJIT_GPR(0), offsetof(struct args, h)); // h
ejit_retr(f, EJIT_GPR(0));
@@ -66,7 +73,7 @@ int main(int argc, char *argv[])
EJIT_ARG(in.g, double),
EJIT_ARG(in.h, float)
};
- assert((void *)ejit_run_func(f, 8, args) == &out);
+ assert((void *)ejit_run_func_i(f, 9, args) == &out);
assert(in.a == out.a);
assert(in.b == out.b);
assert(in.c == out.c);
diff --git a/tests/comr.c b/tests/comr.c
index a22dfc9..0067092 100644
--- a/tests/comr.c
+++ b/tests/comr.c
@@ -7,61 +7,45 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[1] = {
- EJIT_OPERAND_GPR(0, EJIT_TYPE(long))
+ EJIT_OPERAND_GPR(0, EJIT_TYPE(int64_t))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 1, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(int64_t), 1, operands);
ejit_comr(f, EJIT_GPR(0), EJIT_GPR(0));
ejit_retr(f, EJIT_GPR(0));
- ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
+ ejit_select_compile_func(f, 1, 0, EJIT_USE64(int64_t), do_jit);
- assert((int32_t)erf1(f, EJIT_ARG(0, long)
- ) == (int32_t)0xffffffff);
+ assert((int32_t)erfl1(f, EJIT_ARG(0, int64_t)) == (int32_t)0xffffffff);
+ assert((int32_t)erfl1(f, EJIT_ARG(1, int64_t)) == (int32_t)0xfffffffe);
+ assert((int32_t)erfl1(f, EJIT_ARG(0xffffffff, int64_t)) == 0);
+ assert((int32_t)erfl1(f, EJIT_ARG(0x80000000, int64_t)) == 0x7fffffff);
+ assert((int32_t)erfl1(f, EJIT_ARG(0x7fffffff, int64_t)) == (int32_t)0x80000000);
+ assert((int32_t)erfl1(f, EJIT_ARG(0x80000001, int64_t)) == (int32_t)0x7ffffffe);
+ assert(erfl1(f, EJIT_ARG(0, int64_t)) == (int64_t)0xffffffffffffffff);
+ assert(erfl1(f, EJIT_ARG(1, int64_t)) == (int64_t)0xfffffffffffffffe);
+ assert(erfl1(f, EJIT_ARG(0xffffffff, int64_t))
+ == (int64_t)0xffffffff00000000);
- assert((int32_t)erf1(f, EJIT_ARG(1, long)
- ) == (int32_t)0xfffffffe);
+ assert(erfl1(f, EJIT_ARG(0x80000000, int64_t))
+ == (int64_t)0xffffffff7fffffff);
- assert((int32_t)erf1(f, EJIT_ARG(0xffffffff, long)
- ) == 0);
+ assert(erfl1(f, EJIT_ARG(0x7fffffff, int64_t))
+ == (int64_t)0xffffffff80000000);
- assert((int32_t)erf1(f, EJIT_ARG(0x80000000, long)
- ) == 0x7fffffff);
+ assert(erfl1(f, EJIT_ARG(0x80000001, int64_t))
+ == (int64_t)0xffffffff7ffffffe);
- assert((int32_t)erf1(f, EJIT_ARG(0x7fffffff, long)
- ) == (int32_t)0x80000000);
+ assert(erfl1(f, EJIT_ARG(0xffffffffffffffff, int64_t)) == 0);
+ assert(erfl1(f, EJIT_ARG(0x8000000000000000, int64_t))
+ == (int64_t)0x7fffffffffffffff);
- assert((int32_t)erf1(f, EJIT_ARG(0x80000001, long)
- ) == (int32_t)0x7ffffffe);
+ assert(erfl1(f, EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == (int64_t)0x8000000000000000);
- assert(erf1(f, EJIT_ARG(0, long)
- ) == (int64_t)0xffffffffffffffff);
-
- assert(erf1(f, EJIT_ARG(1, long)
- ) == (int64_t)0xfffffffffffffffe);
-
- assert(erf1(f, EJIT_ARG(0xffffffff, long)
- ) == (int64_t)0xffffffff00000000);
-
- assert(erf1(f, EJIT_ARG(0x80000000, long)
- ) == (int64_t)0xffffffff7fffffff);
-
- assert(erf1(f, EJIT_ARG(0x7fffffff, long)
- ) == (int64_t)0xffffffff80000000);
-
- assert(erf1(f, EJIT_ARG(0x80000001, long)
- ) == (int64_t)0xffffffff7ffffffe);
-
- assert(erf1(f, EJIT_ARG(0xffffffffffffffff, long)) == 0);
- assert(erf1(f, EJIT_ARG(0x8000000000000000, long)
- ) == (int64_t)0x7fffffffffffffff);
-
- assert(erf1(f, EJIT_ARG(0x7fffffffffffffff, long)
- ) == (int64_t)0x8000000000000000);
-
- assert(erf1(f, EJIT_ARG(0x8000000000000001, long)
- ) == (int64_t)0x7ffffffffffffffe);
+ assert(erfl1(f, EJIT_ARG(0x8000000000000001, int64_t))
+ == (int64_t)0x7ffffffffffffffe);
ejit_destroy_func(f);
}
diff --git a/tests/divr64.c b/tests/divr64.c
index 2bdb4a7..13ab0a3 100644
--- a/tests/divr64.c
+++ b/tests/divr64.c
@@ -17,135 +17,135 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(1, int64_t)) == 0x7fffffff);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(1, int64_t)) == 0x80000000);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(1, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(2, int64_t)) == 0x3fffffff);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(2, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(2, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(0xffffffff, int64_t)) == 1);
/* 32bit specific stuff, unsure how this should be handled on 64bit
* systems
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(2, int64_t)) == 0xc0000000);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0xffffffff);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0xffffffff, int64_t)) == 0x80000001);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0);
*/
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(2, int64_t)) == 0x40000000);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 1);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0xffffffff, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 2);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(1, int64_t)) == 0x7fffffffffffffff);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(1, int64_t))
== (int64_t)0x8000000000000000);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(1, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(2, int64_t))
== (int64_t)0x3fffffffffffffff);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(2, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(2, int64_t))
== (int64_t)0xc000000000000000);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(2, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)
) == (int64_t)0xffffffffffffffff);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(0xffffffffffffffff, int64_t)
) == (int64_t)0x8000000000000001);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0xffffffffffffffff, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0xffffffffffffffff, int64_t),
EJIT_ARG(0xffffffffffffffff, int64_t)) == 1);
diff --git a/tests/divr_d.c b/tests/divr_d.c
index c6c2998..f6c4bc1 100644
--- a/tests/divr_d.c
+++ b/tests/divr_d.c
@@ -17,9 +17,12 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit);
- assert(erff2(f, EJIT_ARG(-0.5f, double),
+ assert(erfd2(f,
+ EJIT_ARG(-0.5f, double),
EJIT_ARG(0.5f, double)) == -1.0f);
- assert(erff2(f, EJIT_ARG(1.25f, double),
+
+ assert(erfd2(f,
+ EJIT_ARG(1.25f, double),
EJIT_ARG(0.5f, double)) == 2.5f);
ejit_destroy_func(f);
diff --git a/tests/divr_u64.c b/tests/divr_u64.c
index 8753066..1a71785 100644
--- a/tests/divr_u64.c
+++ b/tests/divr_u64.c
@@ -7,90 +7,108 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_GPR(0, EJIT_TYPE(long)),
- EJIT_OPERAND_GPR(1, EJIT_TYPE(long))
+ EJIT_OPERAND_GPR(0, EJIT_TYPE(uint64_t)),
+ EJIT_OPERAND_GPR(1, EJIT_TYPE(uint64_t))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(uint64_t), 2, operands);
ejit_divr_u(f, EJIT_GPR(0), EJIT_GPR(0), EJIT_GPR(1));
ejit_retr(f, EJIT_GPR(0));
- ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
+ ejit_select_compile_func(f, 2, 0, EJIT_USE64(uint64_t), do_jit);
- assert(erf2(f, EJIT_ARG(0x7fffffff, long), EJIT_ARG(1, long)
- ) == 0x7fffffff);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, uint64_t),
+ EJIT_ARG(1, uint64_t)) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0x80000000, long), EJIT_ARG(1, long)
- ) == 0x80000000);
- assert(erf2(f, EJIT_ARG(0x7fffffff, long), EJIT_ARG(2, long)
- ) == 0x3fffffff);
+ assert(erfl2(f,
+ EJIT_ARG(0x80000000, uint64_t),
+ EJIT_ARG(1, uint64_t)) == 0x80000000);
- assert(erf2(f, EJIT_ARG(0x80000000, long), EJIT_ARG(2, long)
- ) == 0x40000000);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, uint64_t),
+ EJIT_ARG(2, uint64_t)) == 0x3fffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffff, long), EJIT_ARG(0x80000000, long)
- ) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(0x80000000, uint64_t),
+ EJIT_ARG(2, uint64_t)) == 0x40000000);
- assert(erf2(f, EJIT_ARG(0x80000000, long), EJIT_ARG(0x7fffffff, long)
- ) == 1);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, uint64_t),
+ EJIT_ARG(0x80000000, uint64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffff, long), EJIT_ARG(0xffffffff, long)
- ) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(0x80000000, uint64_t),
+ EJIT_ARG(0x7fffffff, uint64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0xffffffff, long), EJIT_ARG(0x7fffffff, long)
- ) == 2);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, uint64_t),
+ EJIT_ARG(0xffffffff, uint64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0xffffffff, long), EJIT_ARG(0xffffffff, long)
- ) == 1);
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffff, uint64_t),
+ EJIT_ARG(0x7fffffff, uint64_t)) == 2);
- assert(erf2(f, EJIT_ARG(1, long), EJIT_ARG(0x7fffffff, long)) == 0);
- assert(erf2(f, EJIT_ARG(1, long), EJIT_ARG(0x80000000, long)) == 0);
- assert(erf2(f, EJIT_ARG(2, long), EJIT_ARG(0x7fffffff, long)) == 0);
- assert(erf2(f, EJIT_ARG(2, long), EJIT_ARG(0x80000000, long)) == 0);
- assert(erf2(f, EJIT_ARG(0, long), EJIT_ARG(0x7fffffff, long)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, long), EJIT_ARG(1, long)
- ) == 0x7fffffffffffffff);
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffff, uint64_t),
+ EJIT_ARG(0xffffffff, uint64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, long), EJIT_ARG(1, long)
- ) == (int64_t)0x8000000000000000);
+ assert(erfl2(f, EJIT_ARG(1, uint64_t), EJIT_ARG(0x7fffffff, uint64_t)) == 0);
+ assert(erfl2(f, EJIT_ARG(1, uint64_t), EJIT_ARG(0x80000000, uint64_t)) == 0);
+ assert(erfl2(f, EJIT_ARG(2, uint64_t), EJIT_ARG(0x7fffffff, uint64_t)) == 0);
+ assert(erfl2(f, EJIT_ARG(2, uint64_t), EJIT_ARG(0x80000000, uint64_t)) == 0);
+ assert(erfl2(f, EJIT_ARG(0, uint64_t), EJIT_ARG(0x7fffffff, uint64_t)) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, uint64_t),
+ EJIT_ARG(1, uint64_t)) == 0x7fffffffffffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, long), EJIT_ARG(2, long)
- ) == 0x3fffffffffffffff);
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, uint64_t),
+ EJIT_ARG(1, uint64_t)) == (int64_t)0x8000000000000000);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, long), EJIT_ARG(2, long)
- ) == 0x4000000000000000);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, uint64_t),
+ EJIT_ARG(2, uint64_t)) == 0x3fffffffffffffff);
- assert(erf2(f, EJIT_ARG(1, long), EJIT_ARG(0x7fffffffffffffff, long)
- ) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, uint64_t),
+ EJIT_ARG(2, uint64_t)) == 0x4000000000000000);
- assert(erf2(f, EJIT_ARG(1, long), EJIT_ARG(0x8000000000000000, long)
- ) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(1, uint64_t),
+ EJIT_ARG(0x7fffffffffffffff, uint64_t)) == 0);
- assert(erf2(f, EJIT_ARG(2, long), EJIT_ARG(0x7fffffffffffffff, long)
- ) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(1, uint64_t),
+ EJIT_ARG(0x8000000000000000, uint64_t)) == 0);
- assert(erf2(f, EJIT_ARG(2, long), EJIT_ARG(0x8000000000000000, long)
- ) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(2, uint64_t),
+ EJIT_ARG(0x7fffffffffffffff, uint64_t)) == 0);
- assert(erf2(f,
- EJIT_ARG(0x7fffffffffffffff, long),
- EJIT_ARG(0x8000000000000000, long)) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(2, uint64_t),
+ EJIT_ARG(0x8000000000000000, uint64_t)) == 0);
- assert(erf2(f,
- EJIT_ARG(0x8000000000000000, long),
- EJIT_ARG(0x7fffffffffffffff, long)) == 1);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, uint64_t),
+ EJIT_ARG(0x8000000000000000, uint64_t)) == 0);
- assert(erf2(f,
- EJIT_ARG(0x7fffffffffffffff, long),
- EJIT_ARG(0xffffffffffffffff, long)) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, uint64_t),
+ EJIT_ARG(0x7fffffffffffffff, uint64_t)) == 1);
- assert(erf2(f,
- EJIT_ARG(0xffffffffffffffff, long),
- EJIT_ARG(0x7fffffffffffffff, long)) == 2);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, uint64_t),
+ EJIT_ARG(0xffffffffffffffff, uint64_t)) == 0);
- assert(erf2(f,
- EJIT_ARG(0xffffffffffffffff, long),
- EJIT_ARG(0xffffffffffffffff, long)) == 1);
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffffffffffff, uint64_t),
+ EJIT_ARG(0x7fffffffffffffff, uint64_t)) == 2);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffffffffffff, uint64_t),
+ EJIT_ARG(0xffffffffffffffff, uint64_t)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/do_jit.h b/tests/do_jit.h
index 5be682b..08e39c6 100644
--- a/tests/do_jit.h
+++ b/tests/do_jit.h
@@ -1,12 +1,48 @@
#ifndef DOJIT_H
#define DOJIT_H
-#define erf3 ejit_run_func_3
-#define erf2 ejit_run_func_2
-#define erf1 ejit_run_func_1
+static inline long erfi1(struct ejit_func *f, struct ejit_arg a0)
+{
+ return ejit_run_func_i(f, 1, &a0);
+}
-#define erff3 ejit_run_func_f_3
-#define erff2 ejit_run_func_f_2
-#define erff1 ejit_run_func_f_1
+static inline long erfi2(struct ejit_func *f, struct ejit_arg a0, struct ejit_arg a1)
+{
+ struct ejit_arg args[2] = {a0, a1};
+ return ejit_run_func_i(f, 2, args);
+}
+
+static inline int64_t erfl1(struct ejit_func *f, struct ejit_arg a0)
+{
+ return ejit_run_func_l(f, 1, &a0);
+}
+
+static inline int64_t erfl2(struct ejit_func *f, struct ejit_arg a0, struct ejit_arg a1)
+{
+ struct ejit_arg args[2] = {a0, a1};
+ return ejit_run_func_l(f, 2, args);
+}
+
+static inline float erff1(struct ejit_func *f, struct ejit_arg a0)
+{
+ return ejit_run_func_f(f, 1, &a0);
+}
+
+static inline float erff2(struct ejit_func *f, struct ejit_arg a0, struct ejit_arg a1)
+{
+ struct ejit_arg args[2] = {a0, a1};
+ return ejit_run_func_f(f, 2, args);
+}
+
+static inline double erfd1(struct ejit_func *f, struct ejit_arg a0)
+{
+ return ejit_run_func_d(f, 1, &a0);
+}
+
+static inline double erfd2(struct ejit_func *f, struct ejit_arg a0, struct ejit_arg a1)
+{
+ struct ejit_arg args[2] = {a0, a1};
+ return ejit_run_func_d(f, 2, args);
+}
#endif /* DOJIT_H */
diff --git a/tests/eqr.c b/tests/eqr.c
index bda0908..d56ae61 100644
--- a/tests/eqr.c
+++ b/tests/eqr.c
@@ -7,26 +7,26 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_GPR(0, EJIT_TYPE(long)),
- EJIT_OPERAND_GPR(1, EJIT_TYPE(long))
+ EJIT_OPERAND_GPR(0, EJIT_TYPE(int64_t)),
+ EJIT_OPERAND_GPR(1, EJIT_TYPE(int64_t))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(int64_t), 2, operands);
ejit_eqr(f, EJIT_GPR(0), EJIT_GPR(0), EJIT_GPR(1));
ejit_retr(f, EJIT_GPR(0));
- ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
+ ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 0);
+ assert(erfl2(f, EJIT_ARG(1, int64_t), EJIT_ARG(1, int64_t)) == 1);
+ assert(erfl2(f, EJIT_ARG(1, int64_t), EJIT_ARG(0, int64_t)) == 0);
- assert(ejit_run_func_2(f,
- EJIT_ARG(0x7fffffffffffffff, long),
- EJIT_ARG(0x7ffffffffffffff0, long)) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0x7ffffffffffffff0, int64_t)) == 0);
- assert(ejit_run_func_2(f,
- EJIT_ARG(0x6fffffffffffffff, long),
- EJIT_ARG(0x7fffffffffffffff, long)) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(0x6fffffffffffffff, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/eqr_d.c b/tests/eqr_d.c
index aa4a000..555dedf 100644
--- a/tests/eqr_d.c
+++ b/tests/eqr_d.c
@@ -18,9 +18,9 @@ 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)) == 1);
- assert(erf2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
- assert(erf2(f, EJIT_ARG(0.0/0.0, double),
+ assert(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erfi2(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 0faa2a7..95c9b0e 100644
--- a/tests/eqr_f.c
+++ b/tests/eqr_f.c
@@ -18,9 +18,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 2, EJIT_USE64(long), do_jit);
- 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),
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 0);
+ assert(erfi2(f, EJIT_ARG(0.0/0.0, float),
EJIT_ARG(0.0/0.0, float)) == 0);
ejit_destroy_func(f);
diff --git a/tests/escapei_10.c b/tests/escapei_10.c
index 3ee1984..4b7673e 100644
--- a/tests/escapei_10.c
+++ b/tests/escapei_10.c
@@ -70,14 +70,14 @@ int main(int argc, char *argv[])
EJIT_OPERAND_GPR( 9, EJIT_INT32),
EJIT_OPERAND_GPR(10, EJIT_INT32),
};
- ejit_escapei(f, escape_func, 10, args);
+ ejit_escapei_i(f, escape_func, 10, args);
ejit_retval(f, EJIT_GPR(0));
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 11, 0, false, do_jit);
int32_t iargs[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- assert(ejit_run_func_1(f, EJIT_ARG(iargs, void *)) == 42);
+ assert(erfi1(f, EJIT_ARG(iargs, void *)) == 42);
ejit_destroy_func(f);
}
diff --git a/tests/escapei_double.c b/tests/escapei_double.c
index 7eb9a27..8406490 100644
--- a/tests/escapei_double.c
+++ b/tests/escapei_double.c
@@ -33,7 +33,7 @@ int main(int argc, char *argv[])
EJIT_OPERAND_GPR(0, EJIT_INT32),
EJIT_OPERAND_FPR(0, EJIT_DOUBLE)
};
- ejit_escapei_f(f, escape_func, 2, args);
+ ejit_escapei_d(f, escape_func, 2, args);
ejit_retval_d(f, EJIT_FPR(0));
ejit_retr_d(f, EJIT_FPR(0));
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
double d = 22.0f;
int32_t i = 20;
- assert(erff2(f, EJIT_ARG(&i, void *), EJIT_ARG(&d, void *)) == 42.0f);
+ assert(erfd2(f, EJIT_ARG(&i, void *), EJIT_ARG(&d, void *)) == 42.0f);
ejit_destroy_func(f);
}
diff --git a/tests/escapei_float.c b/tests/escapei_float.c
index c1c0993..f0fd052 100644
--- a/tests/escapei_float.c
+++ b/tests/escapei_float.c
@@ -6,7 +6,7 @@ static float func(int32_t a, float b) {
return b + a;
}
-static double escape_func(size_t argc, const struct ejit_arg args[argc])
+static float escape_func(size_t argc, const struct ejit_arg args[argc])
{
assert(argc == 2);
assert(args[0].type == EJIT_INT32);
diff --git a/tests/extr_16.c b/tests/extr_16.c
index 1d98e0f..412cba9 100644
--- a/tests/extr_16.c
+++ b/tests/extr_16.c
@@ -15,12 +15,12 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(0, long)) == 0);
- assert(erf1(f, EJIT_ARG(1, long)) == 1);
- assert(erf1(f, EJIT_ARG(0xfff, long)) == 0xfff);
- assert(erf1(f, EJIT_ARG(0xffff, long)) == -1);
- assert(erf1(f, EJIT_ARG(0xfffff, long)) == -1);
- assert(erf1(f, EJIT_ARG(0xf0000, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0xfff, long)) == 0xfff);
+ assert(erfi1(f, EJIT_ARG(0xffff, long)) == -1);
+ assert(erfi1(f, EJIT_ARG(0xfffff, long)) == -1);
+ assert(erfi1(f, EJIT_ARG(0xf0000, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/extr_32.c b/tests/extr_32.c
index 3ade35e..673e7aa 100644
--- a/tests/extr_32.c
+++ b/tests/extr_32.c
@@ -14,14 +14,15 @@ int main(int argc, char *argv[])
ejit_extr_32(f, EJIT_GPR(0), EJIT_GPR(1));
ejit_retr(f, EJIT_GPR(0));
- ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
+ /* true since extr_32 only exists on 64bit arches */
+ ejit_select_compile_func(f, 2, 0, true, do_jit);
- assert(erf1(f, EJIT_ARG(0, long)) == 0);
- assert(erf1(f, EJIT_ARG(1, long)) == 1);
- assert(erf1(f, EJIT_ARG(0xfffffff, long)) == 0xfffffff);
- assert(erf1(f, EJIT_ARG(0xffffffff, long)) == -1);
- assert(erf1(f, EJIT_ARG(0xfffffffff, long)) == -1);
- assert(erf1(f, EJIT_ARG(0xf00000000, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0xfffffff, long)) == 0xfffffff);
+ assert(erfi1(f, EJIT_ARG(0xffffffff, long)) == -1);
+ assert(erfi1(f, EJIT_ARG(0xfffffffff, long)) == -1);
+ assert(erfi1(f, EJIT_ARG(0xf00000000, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/extr_8.c b/tests/extr_8.c
index 58b0e76..dd219be 100644
--- a/tests/extr_8.c
+++ b/tests/extr_8.c
@@ -16,11 +16,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(unsigned long), do_jit);
- assert(erf1(f, EJIT_ARG(0, unsigned long)) == 0);
- assert(erf1(f, EJIT_ARG(1, unsigned long)) == 1);
- assert(erf1(f, EJIT_ARG(0xf, unsigned long)) == 0xf);
- assert(erf1(f, EJIT_ARG(0xff, unsigned long)) == -1);
- assert(erf1(f, EJIT_ARG(0xfff, unsigned long)) == -1);
+ assert(erfi1(f, EJIT_ARG(0, unsigned long)) == 0);
+ assert(erfi1(f, EJIT_ARG(1, unsigned long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0xf, unsigned long)) == 0xf);
+ assert(erfi1(f, EJIT_ARG(0xff, unsigned long)) == -1);
+ assert(erfi1(f, EJIT_ARG(0xfff, unsigned long)) == -1);
ejit_destroy_func(f);
}
diff --git a/tests/extr_d.c b/tests/extr_d.c
index b8a3aa9..7b06b7c 100644
--- a/tests/extr_d.c
+++ b/tests/extr_d.c
@@ -16,9 +16,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 1, false, do_jit);
- assert(erff1(f, EJIT_ARG(0, long)) == 0.0f);
- assert(erff1(f, EJIT_ARG(1, long)) == 1.0f);
- assert(erff1(f, EJIT_ARG(-100, long)) == -100.0f);
+ assert(erfd1(f, EJIT_ARG(0, long)) == 0.0f);
+ assert(erfd1(f, EJIT_ARG(1, long)) == 1.0f);
+ assert(erfd1(f, EJIT_ARG(-100, long)) == -100.0f);
ejit_destroy_func(f);
}
diff --git a/tests/extr_u16.c b/tests/extr_u16.c
index e2e000d..955d3c0 100644
--- a/tests/extr_u16.c
+++ b/tests/extr_u16.c
@@ -16,11 +16,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(0, long)) == 0);
- assert(erf1(f, EJIT_ARG(1, long)) == 1);
- assert(erf1(f, EJIT_ARG(0xffff, long)) == 0xffff);
- assert(erf1(f, EJIT_ARG(0xfffff, long)) == 0xffff);
- assert(erf1(f, EJIT_ARG(0xf0000, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0xffff, long)) == 0xffff);
+ assert(erfi1(f, EJIT_ARG(0xfffff, long)) == 0xffff);
+ assert(erfi1(f, EJIT_ARG(0xf0000, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/extr_u32.c b/tests/extr_u32.c
index 478b220..ba4c391 100644
--- a/tests/extr_u32.c
+++ b/tests/extr_u32.c
@@ -14,13 +14,14 @@ int main(int argc, char *argv[])
ejit_extr_u32(f, EJIT_GPR(0), EJIT_GPR(1));
ejit_retr(f, EJIT_GPR(0));
- ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
+ /* true since extr_u32 only exists on 64bit arches */
+ ejit_select_compile_func(f, 2, 0, true, do_jit);
- assert(erf1(f, EJIT_ARG(0, long)) == 0);
- assert(erf1(f, EJIT_ARG(1, long)) == 1);
- assert(erf1(f, EJIT_ARG(0xffffffff, long)) == 0xffffffff);
- assert(erf1(f, EJIT_ARG(0xfffffffff, long)) == 0xffffffff);
- assert(erf1(f, EJIT_ARG(0xf00000000, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(0, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(1, long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0xffffffff, long)) == (long)0xffffffff);
+ assert(erfi1(f, EJIT_ARG(0xfffffffff, long)) == (long)0xffffffff);
+ assert(erfi1(f, EJIT_ARG(0xf00000000, long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/extr_u8.c b/tests/extr_u8.c
index 94785f3..8ba465a 100644
--- a/tests/extr_u8.c
+++ b/tests/extr_u8.c
@@ -16,11 +16,11 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(unsigned long), do_jit);
- assert(erf1(f, EJIT_ARG(0, unsigned long)) == 0);
- assert(erf1(f, EJIT_ARG(1, unsigned long)) == 1);
- assert(erf1(f, EJIT_ARG(0xff, unsigned long)) == 0xff);
- assert(erf1(f, EJIT_ARG(0xfff, unsigned long)) == 0xff);
- assert(erf1(f, EJIT_ARG(0xf00, unsigned long)) == 0);
+ assert(erfi1(f, EJIT_ARG(0, unsigned long)) == 0);
+ assert(erfi1(f, EJIT_ARG(1, unsigned long)) == 1);
+ assert(erfi1(f, EJIT_ARG(0xff, unsigned long)) == 0xff);
+ assert(erfi1(f, EJIT_ARG(0xfff, unsigned long)) == 0xff);
+ assert(erfi1(f, EJIT_ARG(0xf00, unsigned long)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/ger.c b/tests/ger.c
index 8dc064d..457eada 100644
--- a/tests/ger.c
+++ b/tests/ger.c
@@ -18,14 +18,14 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(0, long), EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x0fffffffffffffff, long),
EJIT_ARG(0x0ffffffffffffff0, long)) == 1);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x7fffffffffffffff, long),
EJIT_ARG(0x6ffffffffffffff0, long)) == 1);
ejit_destroy_func(f);
diff --git a/tests/ger_u.c b/tests/ger_u.c
index 3194758..4853ed9 100644
--- a/tests/ger_u.c
+++ b/tests/ger_u.c
@@ -18,17 +18,17 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG(1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x0fffffffffffffff, long),
EJIT_ARG(0x0ffffffffffffff0, long)) == 1);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x7fffffffffffffff, long),
EJIT_ARG(0x6fffffffffffffff, long)) == 1);
ejit_destroy_func(f);
diff --git a/tests/gtr.c b/tests/gtr.c
index 075e0ff..00112cd 100644
--- a/tests/gtr.c
+++ b/tests/gtr.c
@@ -18,14 +18,14 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x0fffffffffffffff, long),
EJIT_ARG(0x0ffffffffffffff0, long)) == 1);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x7fffffffffffffff, long),
EJIT_ARG(0x6ffffffffffffff0, long)) == 1);
ejit_destroy_func(f);
diff --git a/tests/gtr_d.c b/tests/gtr_d.c
index 35de463..92e103e 100644
--- a/tests/gtr_d.c
+++ b/tests/gtr_d.c
@@ -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(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
+ assert(erfi2(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 e65ad35..cea05fd 100644
--- a/tests/gtr_f.c
+++ b/tests/gtr_f.c
@@ -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, float), EJIT_ARG(1, float)) == 0);
- assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/gtr_u.c b/tests/gtr_u.c
index b1b039f..c02d284 100644
--- a/tests/gtr_u.c
+++ b/tests/gtr_u.c
@@ -18,16 +18,16 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(1, long)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG(1, long)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, long), EJIT_ARG(0, long)) == 1);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x0fffffffffffffff, long),
EJIT_ARG(0x0ffffffffffffff0, long)) == 1);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x7fffffffffffffff, long),
EJIT_ARG(0x6ffffffffffffff0, long)) == 1);
ejit_destroy_func(f);
diff --git a/tests/jmp0.c b/tests/jmp0.c
index cdba901..4157c9f 100644
--- a/tests/jmp0.c
+++ b/tests/jmp0.c
@@ -18,8 +18,8 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(42, long)) == 42);
- assert(erf1(f, EJIT_ARG(-1, long)) == -1);
+ assert(erfi1(f, EJIT_ARG(42, long)) == 42);
+ assert(erfi1(f, EJIT_ARG(-1, long)) == -1);
ejit_destroy_func(f);
}
diff --git a/tests/jmp_table.c b/tests/jmp_table.c
index 2c4ac84..948bb74 100644
--- a/tests/jmp_table.c
+++ b/tests/jmp_table.c
@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
}
struct ejit_operand operands[1] = {
- EJIT_OPERAND_GPR(0, EJIT_POINTER)
+ EJIT_OPERAND_GPR(0, EJIT_TYPE(long))
};
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 1, operands);
@@ -28,7 +28,7 @@ int main(int argc, char *argv[])
#warning \
"Label rewriting is not currently working so this will fail the jit test"
- ejit_ldxi_label(f, EJIT_GPR(1), EJIT_GPR(0), (int64_t)targets);
+ ejit_ldxi_label(f, EJIT_GPR(1), EJIT_GPR(0), (uintptr_t)targets);
ejit_jmpr(f, EJIT_GPR(1));
struct ejit_reloc tails[NTARGETS];
@@ -53,11 +53,11 @@ int main(int argc, char *argv[])
for (int i = -2; i < ((int) NTARGETS) + 2; i++) {
if (i < 0) {
- assert(erf1(f, EJIT_ARG(i, long)) == 42);
+ assert(erfi1(f, EJIT_ARG(i, long)) == 42);
} else if (i < NTARGETS) {
- assert(erf1(f, EJIT_ARG(i, long)) == i * i);
+ assert(erfi1(f, EJIT_ARG(i, long)) == i * i);
} else {
- assert(erf1(f, EJIT_ARG(i, long)) == 42);
+ assert(erfi1(f, EJIT_ARG(i, long)) == 42);
}
}
diff --git a/tests/jmpi_local.c b/tests/jmpi_local.c
index c19a8ca..ca81c19 100644
--- a/tests/jmpi_local.c
+++ b/tests/jmpi_local.c
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func(f, 0, NULL) == 1);
+ assert(ejit_run_func_i(f, 0, NULL) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/ldi_d.c b/tests/ldi_d.c
index 949eaee..d94f485 100644
--- a/tests/ldi_d.c
+++ b/tests/ldi_d.c
@@ -14,7 +14,7 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 0, 1, EJIT_USE64(double), do_jit);
- assert(ejit_run_func_f(f, 0, NULL) == data);
+ assert(ejit_run_func_d(f, 0, NULL) == data);
ejit_destroy_func(f);
}
diff --git a/tests/ldi_i16.c b/tests/ldi_i16.c
index 7bbbc4d..db63b62 100644
--- a/tests/ldi_i16.c
+++ b/tests/ldi_i16.c
@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, false, do_jit);
- assert(ejit_run_func(f, 0, NULL) == -1);
+ assert(ejit_run_func_i(f, 0, NULL) == -1);
ejit_destroy_func(f);
}
diff --git a/tests/ldi_i32.c b/tests/ldi_i32.c
index c8ecbc4..d898e44 100644
--- a/tests/ldi_i32.c
+++ b/tests/ldi_i32.c
@@ -10,12 +10,12 @@ int main(int argc, char *argv[])
struct ejit_func *f = ejit_create_func(EJIT_TYPE(unsigned long), 0,
NULL);
- ejit_ldi_u32(f, EJIT_GPR(0), data);
+ ejit_ldi_i32(f, EJIT_GPR(0), data);
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 1, 0, false, do_jit);
- assert(ejit_run_func(f, 0, NULL) == data[0]);
+ assert(ejit_run_func_i(f, 0, NULL) == (int32_t)data[0]);
ejit_destroy_func(f);
}
diff --git a/tests/ldi_i64.c b/tests/ldi_i64.c
index 0815ad8..3f7c5df 100644
--- a/tests/ldi_i64.c
+++ b/tests/ldi_i64.c
@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, true, do_jit);
- assert(ejit_run_func(f, 0, NULL) == -1);
+ assert(ejit_run_func_i(f, 0, NULL) == -1);
ejit_destroy_func(f);
}
diff --git a/tests/ldi_i8.c b/tests/ldi_i8.c
index 5225a7c..c2314e8 100644
--- a/tests/ldi_i8.c
+++ b/tests/ldi_i8.c
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(unsigned long), do_jit);
- assert(ejit_run_func(f, 0, NULL) == -1);
+ assert(ejit_run_func_i(f, 0, NULL) == -1);
ejit_destroy_func(f);
}
diff --git a/tests/ldi_u16.c b/tests/ldi_u16.c
index 1f30bd2..7e75e30 100644
--- a/tests/ldi_u16.c
+++ b/tests/ldi_u16.c
@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(unsigned long), do_jit);
- assert(ejit_run_func(f, 0, NULL) == data[0]);
+ assert(ejit_run_func_i(f, 0, NULL) == data[0]);
ejit_destroy_func(f);
}
diff --git a/tests/ldi_u32.c b/tests/ldi_u32.c
new file mode 100644
index 0000000..17ad43d
--- /dev/null
+++ b/tests/ldi_u32.c
@@ -0,0 +1,21 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ static uint32_t data[] = { 0xffffffff, 0x00000000, 0x42424242 };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(unsigned long), 0,
+ NULL);
+ ejit_ldi_u32(f, EJIT_GPR(0), data);
+ ejit_retr(f, EJIT_GPR(0));
+
+ ejit_select_compile_func(f, 1, 0, true, do_jit);
+
+ assert(ejit_run_func_i(f, 0, NULL) == (long)data[0]);
+
+ ejit_destroy_func(f);
+}
diff --git a/tests/ldi_u64.c b/tests/ldi_u64.c
index 8dfb110..0e6787e 100644
--- a/tests/ldi_u64.c
+++ b/tests/ldi_u64.c
@@ -8,14 +8,14 @@ int main(int argc, char *argv[])
bool do_jit = argc > 1;
static uint64_t data[] = { 0x12345678ffffffff, 0x00000000, 0x42424242 };
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(unsigned long), 0,
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(uint64_t), 0,
NULL);
ejit_ldi_u64(f, EJIT_GPR(0), data);
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 1, 0, true, do_jit);
- assert(ejit_run_func(f, 0, NULL) == (int64_t)data[0]);
+ assert(ejit_run_func_l(f, 0, NULL) == (int64_t)data[0]);
ejit_destroy_func(f);
}
diff --git a/tests/ldi_u8.c b/tests/ldi_u8.c
index d84a3f5..c8829e1 100644
--- a/tests/ldi_u8.c
+++ b/tests/ldi_u8.c
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(unsigned long), do_jit);
- assert(ejit_run_func(f, 0, NULL) == 0xff);
+ assert(ejit_run_func_i(f, 0, NULL) == 0xff);
ejit_destroy_func(f);
}
diff --git a/tests/ldxi_d.c b/tests/ldxi_d.c
index 98474d2..99faa20 100644
--- a/tests/ldxi_d.c
+++ b/tests/ldxi_d.c
@@ -19,9 +19,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 1, EJIT_USE64(long), do_jit);
- assert(erff1(f, EJIT_ARG(sizeof(double) * 0, long)) == data[0]);
- assert(erff1(f, EJIT_ARG(sizeof(double) * 1, long)) == data[1]);
- assert(erff1(f, EJIT_ARG(sizeof(double) * 2, long)) == data[2]);
+ assert(erfd1(f, EJIT_ARG(sizeof(double) * 0, long)) == data[0]);
+ assert(erfd1(f, EJIT_ARG(sizeof(double) * 1, long)) == data[1]);
+ assert(erfd1(f, EJIT_ARG(sizeof(double) * 2, long)) == data[2]);
ejit_destroy_func(f);
}
diff --git a/tests/ldxi_i16.c b/tests/ldxi_i16.c
index 8d308df..85aa6d6 100644
--- a/tests/ldxi_i16.c
+++ b/tests/ldxi_i16.c
@@ -18,9 +18,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(sizeof(int16_t) * 0, long)) == -1);
- assert(erf1(f, EJIT_ARG(sizeof(int16_t) * 1, long)) == 0);
- assert(erf1(f, EJIT_ARG(sizeof(int16_t) * 2, long)) == 0x4242);
+ assert(erfi1(f, EJIT_ARG(sizeof(int16_t) * 0, long)) == -1);
+ assert(erfi1(f, EJIT_ARG(sizeof(int16_t) * 1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(sizeof(int16_t) * 2, long)) == 0x4242);
ejit_destroy_func(f);
}
diff --git a/tests/ldxi_i32.c b/tests/ldxi_i32.c
index e20aaf3..1fc7904 100644
--- a/tests/ldxi_i32.c
+++ b/tests/ldxi_i32.c
@@ -18,9 +18,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(sizeof(int32_t) * 0, long)) == -1);
- assert(erf1(f, EJIT_ARG(sizeof(int32_t) * 1, long)) == 0);
- assert(erf1(f, EJIT_ARG(sizeof(int32_t) * 2, long)) == 0x42424242);
+ assert(erfi1(f, EJIT_ARG(sizeof(int32_t) * 0, long)) == -1);
+ assert(erfi1(f, EJIT_ARG(sizeof(int32_t) * 1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(sizeof(int32_t) * 2, long)) == 0x42424242);
ejit_destroy_func(f);
}
diff --git a/tests/ldxi_i64.c b/tests/ldxi_i64.c
index fd2266b..d9c78d1 100644
--- a/tests/ldxi_i64.c
+++ b/tests/ldxi_i64.c
@@ -12,16 +12,15 @@ int main(int argc, char *argv[])
EJIT_OPERAND_GPR(0, EJIT_TYPE(long))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 1, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(int64_t), 1, operands);
ejit_ldxi_i64(f, EJIT_GPR(0), EJIT_GPR(0), (uintptr_t)data);
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 1, 0, true, do_jit);
- assert(erf1(f, EJIT_ARG(sizeof(int64_t) * 0, long)) == -1);
- assert(erf1(f, EJIT_ARG(sizeof(int64_t) * 1, long)) == 0);
- assert(erf1(f, EJIT_ARG(sizeof(int64_t) * 2, long)
- ) == (int64_t)data[2]);
+ assert(erfl1(f, EJIT_ARG(sizeof(int64_t) * 0, long)) == -1);
+ assert(erfl1(f, EJIT_ARG(sizeof(int64_t) * 1, long)) == 0);
+ assert(erfl1(f, EJIT_ARG(sizeof(int64_t) * 2, long)) == (int64_t)data[2]);
ejit_destroy_func(f);
}
diff --git a/tests/ldxi_i8.c b/tests/ldxi_i8.c
index 5af614f..533d5ae 100644
--- a/tests/ldxi_i8.c
+++ b/tests/ldxi_i8.c
@@ -18,9 +18,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(0, long)) == -1);
- assert(erf1(f, EJIT_ARG(1, long)) == 0);
- assert(erf1(f, EJIT_ARG(2, long)) == 0x42);
+ assert(erfi1(f, EJIT_ARG(0, long)) == -1);
+ assert(erfi1(f, EJIT_ARG(1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(2, long)) == 0x42);
ejit_destroy_func(f);
}
diff --git a/tests/ldxi_u16.c b/tests/ldxi_u16.c
index 2eb68c3..5452037 100644
--- a/tests/ldxi_u16.c
+++ b/tests/ldxi_u16.c
@@ -18,9 +18,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(sizeof(int16_t) * 0, long)) == 0xffff);
- assert(erf1(f, EJIT_ARG(sizeof(int16_t) * 1, long)) == 0);
- assert(erf1(f, EJIT_ARG(sizeof(int16_t) * 2, long)) == 0x4242);
+ assert(erfi1(f, EJIT_ARG(sizeof(int16_t) * 0, long)) == 0xffff);
+ assert(erfi1(f, EJIT_ARG(sizeof(int16_t) * 1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(sizeof(int16_t) * 2, long)) == 0x4242);
ejit_destroy_func(f);
}
diff --git a/tests/ldxi_u32.c b/tests/ldxi_u32.c
index f70b23b..bb5f12f 100644
--- a/tests/ldxi_u32.c
+++ b/tests/ldxi_u32.c
@@ -16,11 +16,11 @@ int main(int argc, char *argv[])
ejit_ldxi_u32(f, EJIT_GPR(0), EJIT_GPR(0), (uintptr_t)data);
ejit_retr(f, EJIT_GPR(0));
- ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
+ ejit_select_compile_func(f, 1, 0, true, do_jit);
- assert(erf1(f, EJIT_ARG(sizeof(int32_t) * 0, long)) == 0xffffffff);
- assert(erf1(f, EJIT_ARG(sizeof(int32_t) * 1, long)) == 0);
- assert(erf1(f, EJIT_ARG(sizeof(int32_t) * 2, long)) == 0x42424242);
+ assert(erfi1(f, EJIT_ARG(sizeof(int32_t) * 0, long)) == (long)0xffffffff);
+ assert(erfi1(f, EJIT_ARG(sizeof(int32_t) * 1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(sizeof(int32_t) * 2, long)) == 0x42424242);
ejit_destroy_func(f);
}
diff --git a/tests/ldxi_u64.c b/tests/ldxi_u64.c
index 1cc57fe..e440435 100644
--- a/tests/ldxi_u64.c
+++ b/tests/ldxi_u64.c
@@ -12,20 +12,20 @@ int main(int argc, char *argv[])
EJIT_OPERAND_GPR(0, EJIT_TYPE(long))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 1, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(uint64_t), 1, operands);
ejit_ldxi_u64(f, EJIT_GPR(0), EJIT_GPR(0), (uintptr_t)data);
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 1, 0, true, do_jit);
- assert(erf1(f, EJIT_ARG(sizeof(int64_t) * 0, long)
- ) == (int64_t)data[0]);
+ assert(erfl1(f,EJIT_ARG(sizeof(int64_t) * 0, long))
+ == (int64_t)data[0]);
- assert(erf1(f, EJIT_ARG(sizeof(int64_t) * 1, long)
- ) == 0);
+ assert(erfl1(f, EJIT_ARG(sizeof(int64_t) * 1, long))
+ == 0);
- assert(erf1(f, EJIT_ARG(sizeof(int64_t) * 2, long)
- ) == (int64_t)data[2]);
+ assert(erfl1(f, EJIT_ARG(sizeof(int64_t) * 2, long))
+ == (int64_t)data[2]);
ejit_destroy_func(f);
}
diff --git a/tests/ldxi_u8.c b/tests/ldxi_u8.c
index 9e0b491..2979706 100644
--- a/tests/ldxi_u8.c
+++ b/tests/ldxi_u8.c
@@ -18,9 +18,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(long), do_jit);
- assert(erf1(f, EJIT_ARG(0, long)) == 0xff);
- assert(erf1(f, EJIT_ARG(1, long)) == 0);
- assert(erf1(f, EJIT_ARG(2, long)) == 0x42);
+ assert(erfi1(f, EJIT_ARG(0, long)) == 0xff);
+ assert(erfi1(f, EJIT_ARG(1, long)) == 0);
+ assert(erfi1(f, EJIT_ARG(2, long)) == 0x42);
ejit_destroy_func(f);
}
diff --git a/tests/ldxr_d.c b/tests/ldxr_d.c
index 993952a..b5d332a 100644
--- a/tests/ldxr_d.c
+++ b/tests/ldxr_d.c
@@ -19,15 +19,15 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 1, false, do_jit);
- assert(erff2(f,
+ assert(erfd2(f,
EJIT_ARG(data, void *),
EJIT_ARG(0 * sizeof(double), unsigned)) == data[0]);
- assert(erff2(f,
+ assert(erfd2(f,
EJIT_ARG(data, void *),
EJIT_ARG(1 * sizeof(double), unsigned)) == data[1]);
- assert(erff2(f,
+ assert(erfd2(f,
EJIT_ARG(data, void *),
EJIT_ARG(2 * sizeof(double), unsigned)) == data[2]);
diff --git a/tests/ldxr_i32.c b/tests/ldxr_i32.c
index 982e0a3..5f5783a 100644
--- a/tests/ldxr_i32.c
+++ b/tests/ldxr_i32.c
@@ -19,9 +19,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, false, do_jit);
- assert(erf2(f, EJIT_ARG(data, void *), EJIT_ARG(0, unsigned)) == -1);
- assert(erf2(f, EJIT_ARG(data, void *), EJIT_ARG(4, unsigned)) == 0);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *), EJIT_ARG(0, unsigned)) == -1);
+ assert(erfi2(f, EJIT_ARG(data, void *), EJIT_ARG(4, unsigned)) == 0);
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(8, unsigned)) == 0x42424242);
ejit_destroy_func(f);
diff --git a/tests/ldxr_i64.c b/tests/ldxr_i64.c
index 71b56a4..9551fce 100644
--- a/tests/ldxr_i64.c
+++ b/tests/ldxr_i64.c
@@ -13,15 +13,15 @@ int main(int argc, char *argv[])
EJIT_OPERAND_GPR(1, EJIT_TYPE(unsigned))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(int64_t), 2, operands);
ejit_ldxr_i64(f, EJIT_GPR(0), EJIT_GPR(0), EJIT_GPR(1));
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 2, 0, true, do_jit);
- assert(erf2(f, EJIT_ARG(data, void *), EJIT_ARG(0, unsigned)) == -1);
- assert(erf2(f, EJIT_ARG(data, void *), EJIT_ARG(8, unsigned)) == 0);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfl2(f, EJIT_ARG(data, void *), EJIT_ARG(0, unsigned)) == -1);
+ assert(erfl2(f, EJIT_ARG(data, void *), EJIT_ARG(8, unsigned)) == 0);
+ assert(erfl2(f, EJIT_ARG(data, void *),
EJIT_ARG(16, unsigned)) == (int64_t)data[2]);
ejit_destroy_func(f);
diff --git a/tests/ldxr_i8.c b/tests/ldxr_i8.c
index a17c9de..43c443a 100644
--- a/tests/ldxr_i8.c
+++ b/tests/ldxr_i8.c
@@ -19,15 +19,15 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, false, do_jit);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(sizeof(int8_t) * 0, unsigned)
) == -1);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(sizeof(int8_t) * 1, unsigned)
) == 0);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(sizeof(int8_t) * 2, unsigned)
) == 0x42);
diff --git a/tests/ldxr_u16.c b/tests/ldxr_u16.c
index e8f517f..430635a 100644
--- a/tests/ldxr_u16.c
+++ b/tests/ldxr_u16.c
@@ -19,10 +19,10 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, false, do_jit);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(0, unsigned)) == 0xffff);
- assert(erf2(f, EJIT_ARG(data, void *), EJIT_ARG(2, unsigned)) == 0);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *), EJIT_ARG(2, unsigned)) == 0);
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(4, unsigned)) == 0x4242);
ejit_destroy_func(f);
diff --git a/tests/ldxr_u32.c b/tests/ldxr_u32.c
index d4d9489..7a42307 100644
--- a/tests/ldxr_u32.c
+++ b/tests/ldxr_u32.c
@@ -17,12 +17,12 @@ int main(int argc, char *argv[])
ejit_ldxr_u32(f, EJIT_GPR(0), EJIT_GPR(0), EJIT_GPR(1));
ejit_retr(f, EJIT_GPR(0));
- ejit_select_compile_func(f, 2, 0, false, do_jit);
+ ejit_select_compile_func(f, 2, 0, true, do_jit);
- assert(erf2(f, EJIT_ARG(data, void *),
- EJIT_ARG(0, unsigned)) == 0xffffffff);
- assert(erf2(f, EJIT_ARG(data, void *), EJIT_ARG(4, unsigned)) == 0);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *),
+ EJIT_ARG(0, unsigned)) == (long)0xffffffff);
+ assert(erfi2(f, EJIT_ARG(data, void *), EJIT_ARG(4, unsigned)) == 0);
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(8, unsigned)) == 0x42424242);
ejit_destroy_func(f);
diff --git a/tests/ldxr_u8.c b/tests/ldxr_u8.c
index 0601d2d..6a13cdd 100644
--- a/tests/ldxr_u8.c
+++ b/tests/ldxr_u8.c
@@ -19,15 +19,15 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, false, do_jit);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(sizeof(int8_t) * 0, unsigned)
) == 0xff);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(sizeof(int8_t) * 1, unsigned)
) == 0);
- assert(erf2(f, EJIT_ARG(data, void *),
+ assert(erfi2(f, EJIT_ARG(data, void *),
EJIT_ARG(sizeof(int8_t) * 2, unsigned)
) == 0x42);
diff --git a/tests/ler64.c b/tests/ler64.c
index 0287f84..11c4810 100644
--- a/tests/ler64.c
+++ b/tests/ler64.c
@@ -18,16 +18,19 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(1, int64_t),
- EJIT_ARG(1, int64_t)) == 1);
- assert(ejit_run_func_2(f, EJIT_ARG(1, int64_t),
- EJIT_ARG(0, int64_t)) == 0);
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(1, int64_t)) == 1);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(0, int64_t)) == 0);
+
+ assert(erfl2(f,
EJIT_ARG(0x0fffffffffffffff, int64_t),
EJIT_ARG(0x0ffffffffffffff0, int64_t)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(0x6fffffffffffffff, int64_t)) == 0);
ejit_destroy_func(f);
diff --git a/tests/ler_d.c b/tests/ler_d.c
index 81dbda0..05b59b8 100644
--- a/tests/ler_d.c
+++ b/tests/ler_d.c
@@ -18,9 +18,9 @@ int main(int argc, char *argv[])
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);
+ assert(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 1);
+ assert(erfi2(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 82bd664..e7fb9af 100644
--- a/tests/ler_f.c
+++ b/tests/ler_f.c
@@ -18,9 +18,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 2, EJIT_USE64(float), do_jit);
- 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);
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, float), EJIT_ARG(-1, float)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/lshi.c b/tests/lshi.c
index 9685f46..d9e5192 100644
--- a/tests/lshi.c
+++ b/tests/lshi.c
@@ -12,12 +12,12 @@ int main(int argc, char *argv[])
struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 1, operands);
- ejit_lshi(f, EJIT_GPR(0), EJIT_GPR(0), 31);
+ ejit_lshi(f, EJIT_GPR(0), EJIT_GPR(0), 4);
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 1, 0, false, do_jit);
- assert(erf1(f, EJIT_ARG(-0x7f, long)) == (int64_t)0xffffffc080000000);
+ assert(erfi1(f, EJIT_ARG(-0x7f, long)) == (-0x7f) * (1 << 4));
ejit_destroy_func(f);
}
diff --git a/tests/lshr64.c b/tests/lshr64.c
index 0d9b3ce..9dd5571 100644
--- a/tests/lshr64.c
+++ b/tests/lshr64.c
@@ -18,127 +18,127 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7f, int64_t),
EJIT_ARG(1, int64_t)) == 0xfe);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fff, int64_t),
EJIT_ARG(2, int64_t)) == 0x1fffc);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x81, int64_t),
EJIT_ARG(16, int64_t)) == 0x810000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0xff, int64_t),
EJIT_ARG(15, int64_t)) == 0x7f8000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0, int64_t)) == 0x7fffffff);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(8, int64_t)) == 0xffffffff00);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(3, int64_t)) == 0x3fffffff8);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(-0x7f, int64_t),
EJIT_ARG(31, int64_t)) == (int64_t)0xffffffc080000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(-0x7fff, int64_t),
EJIT_ARG(30, int64_t)) == (int64_t)0xffffe00040000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(-0x7fffffff, int64_t),
EJIT_ARG(29, int64_t)) == (int64_t)0xf000000020000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x80000001, int64_t),
EJIT_ARG(28, int64_t)) == (int64_t)0x800000010000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x8001, int64_t),
EJIT_ARG(17, int64_t)) == 0x100020000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x80000001, int64_t),
EJIT_ARG(18, int64_t)) == (int64_t)0x2000000040000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(-0xffff, int64_t),
EJIT_ARG(24, int64_t)) == (int64_t)0xffffff0001000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7f, int64_t),
EJIT_ARG(33, int64_t)) == 0xfe00000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7ffff, int64_t),
EJIT_ARG(34, int64_t)) == 0x1ffffc00000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(35, int64_t)) == (int64_t)0xfffffff800000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(-0x7f, int64_t),
EJIT_ARG(63, int64_t)) == (int64_t)0x8000000000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(-0x7fff, int64_t),
EJIT_ARG(62, int64_t)) == 0x4000000000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(-0x7fffffff, int64_t),
EJIT_ARG(61, int64_t)) == 0x2000000000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x80000001, int64_t),
EJIT_ARG(60, int64_t)) == 0x1000000000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x81, int64_t),
EJIT_ARG(48, int64_t)) == 0x81000000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x8001, int64_t),
EJIT_ARG(49, int64_t)) == 0x2000000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x80000001, int64_t),
EJIT_ARG(40, int64_t)) == 0x10000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0xff, int64_t),
EJIT_ARG(47, int64_t)) == 0x7f800000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0xffff0001, int64_t),
EJIT_ARG(56, int64_t)) == 0x100000000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(40, int64_t)) == (int64_t)0xffffff0000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x7fffffffff, int64_t),
EJIT_ARG(33, int64_t)) == (int64_t)0xfffffffe00000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(-0x7fffffffff, int64_t),
EJIT_ARG(63, int64_t)) == (int64_t)0x8000000000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0x8000000001, int64_t),
EJIT_ARG(48, int64_t)) == 0x1000000000000);
- assert(erf2(f,
+ assert(erfl2(f,
EJIT_ARG(0xffffffffff, int64_t),
EJIT_ARG(47, int64_t)) == (int64_t)0xffff800000000000);
diff --git a/tests/ltr.c b/tests/ltr.c
index bc32d03..9f6259b 100644
--- a/tests/ltr.c
+++ b/tests/ltr.c
@@ -18,14 +18,14 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x0fffffffffffffff, long),
EJIT_ARG(0x0ffffffffffffff0, long)) == 0);
- assert(ejit_run_func_2(f,
+ assert(erfi2(f,
EJIT_ARG(0x7fffffffffffffff, long),
EJIT_ARG(0x6fffffffffffffff, long)) == 0);
ejit_destroy_func(f);
diff --git a/tests/ltr_d.c b/tests/ltr_d.c
index 600b820..f7f8149 100644
--- a/tests/ltr_d.c
+++ b/tests/ltr_d.c
@@ -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(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(0, double)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, double), EJIT_ARG(0, double)) == 1);
+ assert(erfi2(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 94dd657..0f34a2e 100644
--- a/tests/ltr_f.c
+++ b/tests/ltr_f.c
@@ -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, 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);
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 0);
+ assert(erfi2(f, EJIT_ARG(-1, float), EJIT_ARG(0, float)) == 1);
+ assert(erfi2(f, EJIT_ARG(-1, float), EJIT_ARG(-1, float)) == 0);
ejit_destroy_func(f);
}
diff --git a/tests/movi.c b/tests/movi.c
index c7df5ec..ba1d28a 100644
--- a/tests/movi.c
+++ b/tests/movi.c
@@ -11,6 +11,6 @@ int main(int argc, char *argv[])
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 1, 0, EJIT_USE64(int), do_jit);
- assert(ejit_run_func(f, 0, NULL) == 0xa500a500);
+ assert(ejit_run_func_i(f, 0, NULL) == (long)0xa500a500);
ejit_destroy_func(f);
}
diff --git a/tests/movi_d.c b/tests/movi_d.c
index 0b8e4f6..7fa412d 100644
--- a/tests/movi_d.c
+++ b/tests/movi_d.c
@@ -11,6 +11,6 @@ int main(int argc, char *argv[])
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);
+ assert(ejit_run_func_d(f, 0, NULL) == 3.14159f);
ejit_destroy_func(f);
}
diff --git a/tests/movr.c b/tests/movr.c
index 3672f25..cfaaa65 100644
--- a/tests/movr.c
+++ b/tests/movr.c
@@ -14,6 +14,6 @@ int main(int argc, char *argv[])
ejit_retr(f, EJIT_GPR(1));
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int), do_jit);
- assert(ejit_run_func_1(f, EJIT_ARG(42, int)) == 42);
+ assert(erfi1(f, EJIT_ARG(42, int)) == 42);
ejit_destroy_func(f);
}
diff --git a/tests/movr_d.c b/tests/movr_d.c
index 1911ccf..b02585a 100644
--- a/tests/movr_d.c
+++ b/tests/movr_d.c
@@ -14,6 +14,6 @@ int main(int argc, char *argv[])
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.);
+ assert(erfd1(f, EJIT_ARG(42., double)) == 42.);
ejit_destroy_func(f);
}
diff --git a/tests/movr_f.c b/tests/movr_f.c
index 890ec9d..1add5a6 100644
--- a/tests/movr_f.c
+++ b/tests/movr_f.c
@@ -14,6 +14,6 @@ int main(int argc, char *argv[])
ejit_retr_f(f, EJIT_FPR(1));
ejit_select_compile_func(f, 0, 2, EJIT_USE64(float), do_jit);
- assert(ejit_run_func_f_1(f, EJIT_ARG(42., float)) == 42.);
+ assert(erff1(f, EJIT_ARG(42., float)) == 42.);
ejit_destroy_func(f);
}
diff --git a/tests/mulr64.c b/tests/mulr64.c
index e1474a6..7233206 100644
--- a/tests/mulr64.c
+++ b/tests/mulr64.c
@@ -17,108 +17,137 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf2(f, EJIT_ARG(1, int64_t), EJIT_ARG(0x7fffffff, int64_t)
- ) == 0x7fffffff);
-
- assert(erf2(f, EJIT_ARG(1, int64_t), EJIT_ARG(0x80000000, int64_t)
- ) == 0x80000000);
-
- assert(erf2(f, EJIT_ARG(2, int64_t), EJIT_ARG(0x7fffffff, int64_t)
- ) == 0xfffffffe);
-
- assert(erf2(f, EJIT_ARG(0, int64_t), EJIT_ARG(0x7fffffff, int64_t)
- ) == 0);
-
-
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t), EJIT_ARG(1, int64_t)
- ) == 0x7fffffff);
-
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t), EJIT_ARG(1, int64_t)
- ) == 0x80000000);
-
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t), EJIT_ARG(2, int64_t)
- ) == 0xfffffffe);
-
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t), EJIT_ARG(0, int64_t)
- ) == 0);
-
- assert(erf2(f, EJIT_ARG(2, int64_t), EJIT_ARG(0x80000000, int64_t)
- ) == 0x100000000);
-
- assert(erf2(f, EJIT_ARG(1, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == 0x7fffffffffffffff);
-
- assert(erf2(f, EJIT_ARG(1, int64_t),
- EJIT_ARG(0x8000000000000000, int64_t)
- ) == (int64_t)0x8000000000000000);
-
- assert(erf2(f, EJIT_ARG(2, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == (int64_t)0xfffffffffffffffe);
-
- assert(erf2(f, EJIT_ARG(2, int64_t),
- EJIT_ARG(0x8000000000000000, int64_t)
- ) == 0);
-
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t), EJIT_ARG(2, int64_t)
- ) == (int64_t)0x100000000);
-
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(0x80000000, int64_t)
- ) == (int64_t)0x3fffffff80000000);
-
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
- EJIT_ARG(0x7fffffff, int64_t)
- ) == (int64_t)0x3fffffff80000000);
-
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(0xffffffff, int64_t)
- ) == (int64_t)0x7ffffffe80000001);
-
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
- EJIT_ARG(0x7fffffff, int64_t)
- ) == (int64_t)0x7ffffffe80000001);
-
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
- EJIT_ARG(0xffffffff, int64_t)
- ) == (int64_t)0xfffffffe00000001);
-
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(1, int64_t)
- ) == (int64_t)0x7fffffffffffffff);
-
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
- EJIT_ARG(1, int64_t)
- ) == (int64_t)0x8000000000000000);
-
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(2, int64_t)
- ) == (int64_t)0xfffffffffffffffe);
-
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
- EJIT_ARG(2, int64_t)
- ) == 0);
-
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(0x8000000000000000, int64_t)
- ) == (int64_t)0x8000000000000000);
-
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == (int64_t)0x8000000000000000);
-
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(0xffffffffffffffff, int64_t)
- ) == (int64_t)0x8000000000000001);
-
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == (int64_t)0x8000000000000001);
-
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
- EJIT_ARG(0xffffffffffffffff, int64_t)
- ) == 1);
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t)) == 0x7fffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(0x80000000, int64_t)) == 0x80000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(2, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t)) == 0xfffffffe);
+
+ assert(erfl2(f,
+ EJIT_ARG(0, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t)) == 0);
+
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(1, int64_t)) == 0x7fffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x80000000, int64_t),
+ EJIT_ARG(1, int64_t)) == 0x80000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(2, int64_t)) == 0xfffffffe);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0, int64_t)) == 0);
+
+ assert(erfl2(f,
+ EJIT_ARG(2, int64_t),
+ EJIT_ARG(0x80000000, int64_t)) == 0x100000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == 0x7fffffffffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(0x8000000000000000, int64_t))
+ == (int64_t)0x8000000000000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(2, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == (int64_t)0xfffffffffffffffe);
+
+ assert(erfl2(f,
+ EJIT_ARG(2, int64_t),
+ EJIT_ARG(0x8000000000000000, int64_t))
+ == 0);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x80000000, int64_t),
+ EJIT_ARG(2, int64_t))
+ == (int64_t)0x100000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0x80000000, int64_t))
+ == (int64_t)0x3fffffff80000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x80000000, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t))
+ == (int64_t)0x3fffffff80000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0xffffffff, int64_t))
+ == (int64_t)0x7ffffffe80000001);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffff, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t))
+ == (int64_t)0x7ffffffe80000001);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffff, int64_t),
+ EJIT_ARG(0xffffffff, int64_t))
+ == (int64_t)0xfffffffe00000001);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(1, int64_t))
+ == (int64_t)0x7fffffffffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, int64_t),
+ EJIT_ARG(1, int64_t))
+ == (int64_t)0x8000000000000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(2, int64_t))
+ == (int64_t)0xfffffffffffffffe);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, int64_t),
+ EJIT_ARG(2, int64_t))
+ == 0);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0x8000000000000000, int64_t))
+ == (int64_t)0x8000000000000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == (int64_t)0x8000000000000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0xffffffffffffffff, int64_t))
+ == (int64_t)0x8000000000000001);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffffffffffff, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == (int64_t)0x8000000000000001);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffffffffffff, int64_t),
+ EJIT_ARG(0xffffffffffffffff, int64_t))
+ == 1);
ejit_destroy_func(f);
}
diff --git a/tests/mulr_d.c b/tests/mulr_d.c
index 0002c6b..a7d2d93 100644
--- a/tests/mulr_d.c
+++ b/tests/mulr_d.c
@@ -17,10 +17,13 @@ int main(int argc, char *argv[])
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);
+ assert(erfd2(f,
+ EJIT_ARG(-0.5f, double),
+ EJIT_ARG(0.50f, double)) == -0.25f);
+
+ assert(erfd2(f,
+ EJIT_ARG(0.25f, double),
+ EJIT_ARG(0.75f, double)) == 0.1875f);
ejit_destroy_func(f);
}
diff --git a/tests/negr.c b/tests/negr.c
index 84241e8..4528897 100644
--- a/tests/negr.c
+++ b/tests/negr.c
@@ -16,25 +16,24 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf1(f, EJIT_ARG(0, int64_t)) == 0);
- assert(erf1(f, EJIT_ARG(1, int64_t)) == (int64_t)0xffffffffffffffff);
- assert(erf1(f,
- EJIT_ARG(0xffffffff,
- int64_t)) == (int64_t)0xffffffff00000001);
- assert(erf1(f,
- EJIT_ARG(0x80000000,
- int64_t)) == (int64_t)0xffffffff80000000);
- assert(erf1(f,
- EJIT_ARG(0x7fffffff,
- int64_t)) == (int64_t)0xffffffff80000001);
- assert(erf1(f,
- EJIT_ARG(0x80000001,
- int64_t)) == (int64_t)0xffffffff7fffffff);
- assert(erf1(f, EJIT_ARG(0xffffffffffffffff, int64_t)) == 1);
- assert(erf1(f, EJIT_ARG(0x8000000000000000, int64_t))
+ assert(erfl1(f, EJIT_ARG(0, int64_t)) == 0);
+ assert(erfl1(f, EJIT_ARG(1, int64_t)) == (int64_t)0xffffffffffffffff);
+ assert(erfl1(f, EJIT_ARG(0xffffffff, int64_t))
+ == (int64_t)0xffffffff00000001);
+ assert(erfl1(f, EJIT_ARG(0x80000000, int64_t))
+ == (int64_t)0xffffffff80000000);
+
+ assert(erfl1(f, EJIT_ARG(0x7fffffff, int64_t))
+ == (int64_t)0xffffffff80000001);
+
+ assert(erfl1(f, EJIT_ARG(0x80000001, int64_t))
+ == (int64_t)0xffffffff7fffffff);
+
+ assert(erfl1(f, EJIT_ARG(0xffffffffffffffff, int64_t)) == 1);
+ assert(erfl1(f, EJIT_ARG(0x8000000000000000, int64_t))
== (int64_t)0x8000000000000000);
- assert(erf1(f, EJIT_ARG(0x7fffffffffffffff, int64_t))
+ assert(erfl1(f, EJIT_ARG(0x7fffffffffffffff, int64_t))
== (int64_t)0x8000000000000001);
ejit_destroy_func(f);
diff --git a/tests/negr_d.c b/tests/negr_d.c
index b57dcea..8f12301 100644
--- a/tests/negr_d.c
+++ b/tests/negr_d.c
@@ -16,10 +16,10 @@ int main(int argc, char *argv[])
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);
+ assert(erfd1(f, EJIT_ARG(0.0f, double)) == -0.0f);
+ assert(erfd1(f, EJIT_ARG(0.5f, double)) == -0.5f);
+ assert(erfd1(f, EJIT_ARG(1.0f / 0.0f, double)) == -1.0f / 0.0f);
+ assert(erfd1(f, EJIT_ARG(-1.25f, double)) == 1.25f);
ejit_destroy_func(f);
}
diff --git a/tests/ner.c b/tests/ner.c
index 9432a56..3aa8540 100644
--- a/tests/ner.c
+++ b/tests/ner.c
@@ -7,26 +7,26 @@ int main(int argc, char *argv[])
(void)argv;
bool do_jit = argc > 1;
struct ejit_operand operands[2] = {
- EJIT_OPERAND_GPR(0, EJIT_TYPE(long)),
- EJIT_OPERAND_GPR(1, EJIT_TYPE(long))
+ EJIT_OPERAND_GPR(0, EJIT_TYPE(int64_t)),
+ EJIT_OPERAND_GPR(1, EJIT_TYPE(int64_t))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(int64_t), 2, operands);
ejit_ner(f, EJIT_GPR(0), EJIT_GPR(0), EJIT_GPR(1));
ejit_retr(f, EJIT_GPR(0));
- ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
+ ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 0);
- assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1);
+ assert(erfl2(f, EJIT_ARG(1, int64_t), EJIT_ARG(1, int64_t)) == 0);
+ assert(erfl2(f, EJIT_ARG(1, int64_t), EJIT_ARG(0, int64_t)) == 1);
- assert(ejit_run_func_2(f,
- EJIT_ARG(0x7fffffffffffffff, long),
- EJIT_ARG(0x7ffffffffffffff0, long)) == 1);
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0x7ffffffffffffff0, int64_t)) == 1);
- assert(ejit_run_func_2(f,
- EJIT_ARG(0x6fffffffffffffff, long),
- EJIT_ARG(0x7fffffffffffffff, long)) == 1);
+ assert(erfl2(f,
+ EJIT_ARG(0x6fffffffffffffff, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/ner_d.c b/tests/ner_d.c
index 52a2f51..73ca2a9 100644
--- a/tests/ner_d.c
+++ b/tests/ner_d.c
@@ -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(erfi2(f, EJIT_ARG(1, double), EJIT_ARG(1, double)) == 0);
+ assert(erfi2(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 fb60120..222dfc3 100644
--- a/tests/ner_f.c
+++ b/tests/ner_f.c
@@ -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, float), EJIT_ARG(1, float)) == 0);
- assert(erf2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 1);
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(1, float)) == 0);
+ assert(erfi2(f, EJIT_ARG(1, float), EJIT_ARG(0, float)) == 1);
ejit_destroy_func(f);
}
diff --git a/tests/ori64.c b/tests/ori64.c
index 5175338..6418802 100644
--- a/tests/ori64.c
+++ b/tests/ori64.c
@@ -16,13 +16,13 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf1(f, EJIT_ARG(0x7fffffff, int64_t)) == 0x7fffffff);
- assert(erf1(f, EJIT_ARG(0x80000000, int64_t)) == 0x80000001);
- assert(erf1(f, EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == 0x7fffffffffffffff);
+ assert(erfl1(f, EJIT_ARG(0x7fffffff, int64_t)) == 0x7fffffff);
+ assert(erfl1(f, EJIT_ARG(0x80000000, int64_t)) == 0x80000001);
+ assert(erfl1(f, EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == 0x7fffffffffffffff);
- assert(erf1(f, EJIT_ARG(0x8000000000000000, int64_t)
- ) == (int64_t)0x8000000000000001);
+ assert(erfl1(f, EJIT_ARG(0x8000000000000000, int64_t))
+ == (int64_t)0x8000000000000001);
ejit_destroy_func(f);
}
diff --git a/tests/orr64.c b/tests/orr64.c
index f0337a9..f3af9ed 100644
--- a/tests/orr64.c
+++ b/tests/orr64.c
@@ -17,70 +17,70 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 0x80000001);
- assert(erf2(f, EJIT_ARG(0, int64_t),
+ assert(erfl2(f, EJIT_ARG(0, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(1, int64_t)) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(1, int64_t)) == 0x80000001);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0, int64_t)) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 0xffffffff);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0xffffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0xffffffff, int64_t)) == 0xffffffff);
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0xffffffff);
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(0xffffffff, int64_t)) == 0xffffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(1, int64_t)) == 0x7fffffffffffffff);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(1, int64_t)) == (int64_t)0x8000000000000001);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)
) == (int64_t)0x7fffffffffffffff);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)
) == (int64_t)0x8000000000000001);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)
) == (int64_t)0xffffffffffffffff);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)
) == (int64_t)0xffffffffffffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(0xffffffffffffffff, int64_t)
) == (int64_t)0xffffffffffffffff);
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)
) == (int64_t)0xffffffffffffffff);
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
EJIT_ARG(0xffffffffffffffff, int64_t)
) == (int64_t)0xffffffffffffffff);
diff --git a/tests/remr64.c b/tests/remr64.c
index d2e7dc4..f354328 100644
--- a/tests/remr64.c
+++ b/tests/remr64.c
@@ -16,87 +16,96 @@ int main(int argc, char *argv[])
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(2, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(2, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 2);
- assert(erf2(f, EJIT_ARG(2, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(2, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 2);
- assert(erf2(f, EJIT_ARG(0, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(1, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(1, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(2, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(2, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(0x80000000, int64_t)
- ) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0x80000000, int64_t))
+ == 0x7fffffff);
+
+ assert(erfl2(f, EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(0xffffffff, int64_t)
) == 0);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(0x7fffffff, int64_t)
) == 1);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(0xffffffff, int64_t)
) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xffffffff, int64_t),
EJIT_ARG(0x7fffffff, int64_t)
) == 1);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(2, int64_t),
+ assert(erfl2(f, EJIT_ARG(2, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)) == 2);
- assert(erf2(f, EJIT_ARG(2, int64_t),
+ assert(erfl2(f, EJIT_ARG(2, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)) == 2);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(1, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(1, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(2, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(2, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(0x8000000000000000, int64_t)
- ) == 0x7fffffffffffffff);
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0x8000000000000000, int64_t))
+ == 0x7fffffffffffffff);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == (int64_t)0xffffffffffffffff);
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == (int64_t)0xffffffffffffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(0xffffffffffffffff, int64_t)
- ) == 0);
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0xffffffffffffffff, int64_t))
+ == 0);
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == (int64_t)0xffffffffffffffff);
+ assert(erfl2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == (int64_t)0xffffffffffffffff);
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
- EJIT_ARG(0xffffffffffffffff, int64_t)
- ) == 0);
+ assert(erfl2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
+ EJIT_ARG(0xffffffffffffffff, int64_t))
+ == 0);
ejit_destroy_func(f);
}
diff --git a/tests/remr_u64.c b/tests/remr_u64.c
index 4f458eb..4bae226 100644
--- a/tests/remr_u64.c
+++ b/tests/remr_u64.c
@@ -17,80 +17,96 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf2(f, EJIT_ARG(0, int64_t),
+ assert(erfl2(f, EJIT_ARG(0, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(2, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(2, int64_t),
EJIT_ARG(0x7fffffff, int64_t)) == 2);
- assert(erf2(f, EJIT_ARG(2, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(2, int64_t),
EJIT_ARG(0x80000000, int64_t)) == 2);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(1, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(1, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
EJIT_ARG(2, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
EJIT_ARG(2, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(0x80000000, int64_t)
- ) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
- EJIT_ARG(0x7fffffff, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0x80000000, int64_t))
+ == 0x7fffffff);
+
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t))
+ == 1);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(0xffffffff, int64_t)
- ) == 0x7fffffff);
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0xffffffff, int64_t))
+ == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
- EJIT_ARG(0x7fffffff, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0xffffffff, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t))
+ == 1);
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
- EJIT_ARG(0xffffffff, int64_t)
- ) == 0);
+ assert(erfl2(f, EJIT_ARG(0xffffffff, int64_t),
+ EJIT_ARG(0xffffffff, int64_t))
+ == 0);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(1, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(1, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(2, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(2, int64_t),
EJIT_ARG(0x7fffffffffffffff, int64_t)) == 2);
- assert(erf2(f, EJIT_ARG(2, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(2, int64_t),
EJIT_ARG(0x8000000000000000, int64_t)) == 2);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(1, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(1, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
EJIT_ARG(2, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
+
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
EJIT_ARG(2, int64_t)) == 0);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(0x8000000000000000, int64_t)
- ) == 0x7fffffffffffffff);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0x8000000000000000, int64_t))
+ == 0x7fffffffffffffff);
+
+ assert(erfl2(f, EJIT_ARG(0x8000000000000000, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(0xffffffffffffffff, int64_t)
- ) == 0x7fffffffffffffff);
+ assert(erfl2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0xffffffffffffffff, int64_t))
+ == 0x7fffffffffffffff);
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == 1);
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
- EJIT_ARG(0xffffffffffffffff, int64_t)
- ) == 0);
+ assert(erfl2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
+ EJIT_ARG(0xffffffffffffffff, int64_t))
+ == 0);
ejit_destroy_func(f);
diff --git a/tests/rshi64.c b/tests/rshi64.c
index 6a5e20a..c549313 100644
--- a/tests/rshi64.c
+++ b/tests/rshi64.c
@@ -16,9 +16,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf1(f, EJIT_ARG(0x80000000, int64_t)) == 1);
- assert(erf1(f, EJIT_ARG(0x8000000000000000, int64_t)
- ) == (int64_t)0xffffffff00000000);
+ assert(erfl1(f, EJIT_ARG(0x80000000, int64_t)) == 1);
+ assert(erfl1(f, EJIT_ARG(0x8000000000000000, int64_t))
+ == (int64_t)0xffffffff00000000);
ejit_destroy_func(f);
}
diff --git a/tests/rshi_u64.c b/tests/rshi_u64.c
index 8398417..43ba3ce 100644
--- a/tests/rshi_u64.c
+++ b/tests/rshi_u64.c
@@ -16,8 +16,9 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf1(f, EJIT_ARG(0x80000000, int64_t)) == 1);
- assert(erf1(f, EJIT_ARG(0x8000000000000000, int64_t)) == 0x100000000);
+ assert(erfl1(f, EJIT_ARG(0x80000000, int64_t)) == 1);
+ assert(erfl1(f, EJIT_ARG(0x8000000000000000, int64_t))
+ == 0x100000000);
ejit_destroy_func(f);
}
diff --git a/tests/rshr64.c b/tests/rshr64.c
index bb235ee..066e260 100644
--- a/tests/rshr64.c
+++ b/tests/rshr64.c
@@ -18,100 +18,125 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf2(f, EJIT_ARG(0xfe, int64_t), EJIT_ARG(1, int64_t)) == 0x7f);
- assert(erf2(f, EJIT_ARG(0x1fffc, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xfe, int64_t), EJIT_ARG(1, int64_t)) == 0x7f);
+ assert(erfl2(f, EJIT_ARG(0x1fffc, int64_t),
EJIT_ARG(2, int64_t)) == 0x7fff);
- assert(erf2(f, EJIT_ARG(0x40000000, int64_t),
- EJIT_ARG(30, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x20000000, int64_t),
- EJIT_ARG(29, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x10000000, int64_t),
- EJIT_ARG(28, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x810000, int64_t),
- EJIT_ARG(16, int64_t)) == 0x81);
- assert(erf2(f, EJIT_ARG(0x20000, int64_t), EJIT_ARG(17, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x40000, int64_t), EJIT_ARG(18, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x7f8000, int64_t),
- EJIT_ARG(15, int64_t)) == 0xff);
- assert(erf2(f, EJIT_ARG(0x1000000, int64_t),
- EJIT_ARG(24, int64_t)) == 1);
-
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t), EJIT_ARG(0, int64_t)
- ) == 0x7fffffff);
-
- assert(erf2(f, EJIT_ARG(0x3fffffff8, int64_t), EJIT_ARG(3, int64_t)
- ) == 0x7fffffff);
-
- assert(erf2(f, EJIT_ARG(0xffffff00, int64_t), EJIT_ARG(8, int64_t)
- ) == 0xffffff);
-
- assert(erf2(f, EJIT_ARG(0xfe00000000, int64_t), EJIT_ARG(33, int64_t)
- ) == 0x7f);
-
- assert(erf2(f, EJIT_ARG(0x1ffffc00000000, int64_t),
- EJIT_ARG(34, int64_t)
- ) == 0x7ffff);
-
- assert(erf2(f, EJIT_ARG(0xfffffff800000000, int64_t),
- EJIT_ARG(29, int64_t)
- ) == (int64_t)0xffffffffffffffc0);
-
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
- EJIT_ARG(63, int64_t)
- ) == (int64_t)0xffffffffffffffff);
- assert(erf2(f, EJIT_ARG(0x4000000000000000, int64_t),
- EJIT_ARG(62, int64_t)
- ) == 1);
-
- assert(erf2(f, EJIT_ARG(0x2000000000000000, int64_t),
- EJIT_ARG(61, int64_t)
- ) == 1);
-
- assert(erf2(f, EJIT_ARG(0x1000000000000000, int64_t),
- EJIT_ARG(60, int64_t)
- ) == 1);
-
- assert(erf2(f, EJIT_ARG(0xffffffc080000000, int64_t),
- EJIT_ARG(31, int64_t)
- ) == (int64_t)0xffffffffffffff81);
-
- assert(erf2(f, EJIT_ARG(0x81000000000000, int64_t),
- EJIT_ARG(48, int64_t)
- ) == 0x81);
-
- assert(erf2(f, EJIT_ARG(0x2000000000000, int64_t), EJIT_ARG(49, int64_t)
- ) == 1);
-
- assert(erf2(f, EJIT_ARG(0x10000000000, int64_t), EJIT_ARG(40, int64_t)
- ) == 1);
-
- assert(erf2(f, EJIT_ARG(0x7f800000000000, int64_t),
- EJIT_ARG(47, int64_t)
- ) == 0xff);
+ assert(erfl2(f, EJIT_ARG(0x40000000, int64_t),
+ EJIT_ARG(30, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x100000000000000, int64_t),
- EJIT_ARG(56, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0x20000000, int64_t),
+ EJIT_ARG(29, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0xffffff0000000000, int64_t),
- EJIT_ARG(40, int64_t)
- ) == (int64_t)0xffffffffffffffff);
+ assert(erfl2(f, EJIT_ARG(0x10000000, int64_t),
+ EJIT_ARG(28, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0xfffffffe00000000, int64_t),
- EJIT_ARG(33, int64_t)
- ) == (int64_t)0xffffffffffffffff);
+ assert(erfl2(f, EJIT_ARG(0x810000, int64_t),
+ EJIT_ARG(16, int64_t)) == 0x81);
- assert(erf2(f, EJIT_ARG(0x8000000000000001, int64_t),
- EJIT_ARG(63, int64_t)
- ) == (int64_t)0xffffffffffffffff);
+ assert(erfl2(f, EJIT_ARG(0x20000, int64_t), EJIT_ARG(17, int64_t)) == 1);
+ assert(erfl2(f, EJIT_ARG(0x40000, int64_t), EJIT_ARG(18, int64_t)) == 1);
+ assert(erfl2(f, EJIT_ARG(0x7f8000, int64_t),
+ EJIT_ARG(15, int64_t)) == 0xff);
- assert(erf2(f, EJIT_ARG(0x1000000000000, int64_t), EJIT_ARG(48, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0x1000000, int64_t),
+ EJIT_ARG(24, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0xffff800000000000, int64_t),
- EJIT_ARG(47, int64_t)
- ) == (int64_t)0xffffffffffffffff);
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t), EJIT_ARG(0, int64_t))
+ == 0x7fffffff);
+
+ assert(erfl2(f, EJIT_ARG(0x3fffffff8, int64_t), EJIT_ARG(3, int64_t))
+ == 0x7fffffff);
+
+ assert(erfl2(f, EJIT_ARG(0xffffff00, int64_t), EJIT_ARG(8, int64_t))
+ == 0xffffff);
+
+ assert(erfl2(f, EJIT_ARG(0xfe00000000, int64_t), EJIT_ARG(33, int64_t))
+ == 0x7f);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x1ffffc00000000, int64_t),
+ EJIT_ARG(34, int64_t)) == 0x7ffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xfffffff800000000, int64_t),
+ EJIT_ARG(29, int64_t))
+ == (int64_t)0xffffffffffffffc0);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, int64_t),
+ EJIT_ARG(63, int64_t))
+ == (int64_t)0xffffffffffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x4000000000000000, int64_t),
+ EJIT_ARG(62, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x2000000000000000, int64_t),
+ EJIT_ARG(61, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x1000000000000000, int64_t),
+ EJIT_ARG(60, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffc080000000, int64_t),
+ EJIT_ARG(31, int64_t))
+ == (int64_t)0xffffffffffffff81);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x81000000000000, int64_t),
+ EJIT_ARG(48, int64_t))
+ == 0x81);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x2000000000000, int64_t),
+ EJIT_ARG(49, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x10000000000, int64_t),
+ EJIT_ARG(40, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7f800000000000, int64_t),
+ EJIT_ARG(47, int64_t))
+ == 0xff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x100000000000000, int64_t),
+ EJIT_ARG(56, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffff0000000000, int64_t),
+ EJIT_ARG(40, int64_t))
+ == (int64_t)0xffffffffffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xfffffffe00000000, int64_t),
+ EJIT_ARG(33, int64_t))
+ == (int64_t)0xffffffffffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000001, int64_t),
+ EJIT_ARG(63, int64_t))
+ == (int64_t)0xffffffffffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x1000000000000, int64_t),
+ EJIT_ARG(48, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffff800000000000, int64_t),
+ EJIT_ARG(47, int64_t))
+ == (int64_t)0xffffffffffffffff);
ejit_destroy_func(f);
}
diff --git a/tests/rshr_u64.c b/tests/rshr_u64.c
index d308358..c3e1e77 100644
--- a/tests/rshr_u64.c
+++ b/tests/rshr_u64.c
@@ -17,99 +17,133 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf2(f, EJIT_ARG(0xfe, int64_t), EJIT_ARG(1, int64_t)) == 0x7f);
- assert(erf2(f, EJIT_ARG(0x1fffc, int64_t),
+ assert(erfl2(f, EJIT_ARG(0xfe, int64_t), EJIT_ARG(1, int64_t)) == 0x7f);
+ assert(erfl2(f, EJIT_ARG(0x1fffc, int64_t),
EJIT_ARG(2, int64_t)) == 0x7fff);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
- EJIT_ARG(31, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x40000000, int64_t),
- EJIT_ARG(30, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x20000000, int64_t),
- EJIT_ARG(29, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x10000000, int64_t),
- EJIT_ARG(28, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x810000, int64_t),
- EJIT_ARG(16, int64_t)) == 0x81);
- assert(erf2(f, EJIT_ARG(0x20000, int64_t), EJIT_ARG(17, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x40000, int64_t), EJIT_ARG(18, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x7f8000, int64_t),
- EJIT_ARG(15, int64_t)) == 0xff);
- assert(erf2(f, EJIT_ARG(0x1000000, int64_t),
- EJIT_ARG(24, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0xffffff00, int64_t),
- EJIT_ARG(8, int64_t)) == 0xffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(0, int64_t)) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0x3fffffff8, int64_t), EJIT_ARG(3, int64_t)
- ) == 0x7fffffff);
-
- assert(erf2(f, EJIT_ARG(0xffffffc080000000, int64_t),
- EJIT_ARG(31, int64_t)
- ) == 0x1ffffff81);
-
- assert(erf2(f, EJIT_ARG(0xfe00000000, int64_t), EJIT_ARG(33, int64_t)
- ) == 0x7f);
-
- assert(erf2(f, EJIT_ARG(0x1ffffc00000000, int64_t),
- EJIT_ARG(34, int64_t)
- ) == 0x7ffff);
-
- assert(erf2(f, EJIT_ARG(0xfffffff800000000, int64_t),
- EJIT_ARG(29, int64_t)
- ) == 0x7ffffffc0);
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
- EJIT_ARG(63, int64_t)
- ) == 1);
-
- assert(erf2(f, EJIT_ARG(0x4000000000000000, int64_t),
- EJIT_ARG(62, int64_t)
- ) == 1);
-
- assert(erf2(f, EJIT_ARG(0x2000000000000000, int64_t),
- EJIT_ARG(61, int64_t)
- ) == 1);
-
- assert(erf2(f, EJIT_ARG(0x1000000000000000, int64_t),
- EJIT_ARG(60, int64_t)
- ) == 1);
-
- assert(erf2(f, EJIT_ARG(0x81000000000000, int64_t),
- EJIT_ARG(48, int64_t)
- ) == 0x81);
+ assert(erfl2(f, EJIT_ARG(0x80000000, int64_t),
+ EJIT_ARG(31, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x2000000000000, int64_t), EJIT_ARG(49, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0x40000000, int64_t),
+ EJIT_ARG(30, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x10000000000, int64_t), EJIT_ARG(40, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0x20000000, int64_t),
+ EJIT_ARG(29, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x7f800000000000, int64_t),
- EJIT_ARG(47, int64_t)
- ) == 0xff);
+ assert(erfl2(f, EJIT_ARG(0x10000000, int64_t),
+ EJIT_ARG(28, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x100000000000000, int64_t),
- EJIT_ARG(56, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0x810000, int64_t),
+ EJIT_ARG(16, int64_t)) == 0x81);
- assert(erf2(f, EJIT_ARG(0xffffff0000000000, int64_t),
- EJIT_ARG(40, int64_t)
- ) == 0xffffff);
+ assert(erfl2(f, EJIT_ARG(0x20000, int64_t), EJIT_ARG(17, int64_t)) == 1);
+ assert(erfl2(f, EJIT_ARG(0x40000, int64_t), EJIT_ARG(18, int64_t)) == 1);
+ assert(erfl2(f, EJIT_ARG(0x7f8000, int64_t),
+ EJIT_ARG(15, int64_t)) == 0xff);
- assert(erf2(f, EJIT_ARG(0xfffffffe00000000, int64_t),
- EJIT_ARG(33, int64_t)
- ) == 0x7fffffff);
+ assert(erfl2(f, EJIT_ARG(0x1000000, int64_t),
+ EJIT_ARG(24, int64_t)) == 1);
- assert(erf2(f, EJIT_ARG(0x8000000000000001, int64_t),
- EJIT_ARG(63, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0xffffff00, int64_t),
+ EJIT_ARG(8, int64_t)) == 0xffffff);
- assert(erf2(f, EJIT_ARG(0x1000000000000, int64_t), EJIT_ARG(48, int64_t)
- ) == 1);
+ assert(erfl2(f, EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0, int64_t)) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0xffff800000000000, int64_t),
- EJIT_ARG(47, int64_t)
- ) == 0x1ffff);
+ assert(erfl2(f,
+ EJIT_ARG(0x3fffffff8, int64_t),
+ EJIT_ARG(3, int64_t))
+ == 0x7fffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffc080000000, int64_t),
+ EJIT_ARG(31, int64_t))
+ == 0x1ffffff81);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xfe00000000, int64_t),
+ EJIT_ARG(33, int64_t))
+ == 0x7f);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x1ffffc00000000, int64_t),
+ EJIT_ARG(34, int64_t))
+ == 0x7ffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xfffffff800000000, int64_t),
+ EJIT_ARG(29, int64_t))
+ == 0x7ffffffc0);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, int64_t),
+ EJIT_ARG(63, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x4000000000000000, int64_t),
+ EJIT_ARG(62, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x2000000000000000, int64_t),
+ EJIT_ARG(61, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x1000000000000000, int64_t),
+ EJIT_ARG(60, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x81000000000000, int64_t),
+ EJIT_ARG(48, int64_t))
+ == 0x81);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x2000000000000, int64_t),
+ EJIT_ARG(49, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x10000000000, int64_t),
+ EJIT_ARG(40, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7f800000000000, int64_t),
+ EJIT_ARG(47, int64_t))
+ == 0xff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x100000000000000, int64_t),
+ EJIT_ARG(56, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffff0000000000, int64_t),
+ EJIT_ARG(40, int64_t))
+ == 0xffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xfffffffe00000000, int64_t),
+ EJIT_ARG(33, int64_t))
+ == 0x7fffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000001, int64_t),
+ EJIT_ARG(63, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x1000000000000, int64_t),
+ EJIT_ARG(48, int64_t))
+ == 1);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffff800000000000, int64_t),
+ EJIT_ARG(47, int64_t))
+ == 0x1ffff);
ejit_destroy_func(f);
}
diff --git a/tests/sti_16.c b/tests/sti_16.c
index 16a40d7..da78a01 100644
--- a/tests/sti_16.c
+++ b/tests/sti_16.c
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
assert(data[0] == 0x1212);
assert(data[1] == 0x00);
assert(data[2] == 0x3434);
- erf1(f, EJIT_ARG(-1, int16_t));
+ erfi1(f, EJIT_ARG(-1, int16_t));
assert(data[0] == 0x1212);
assert(data[1] == 0xffff);
assert(data[2] == 0x3434);
diff --git a/tests/sti_32.c b/tests/sti_32.c
index b748025..667bfd7 100644
--- a/tests/sti_32.c
+++ b/tests/sti_32.c
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
assert(data[0] == 0x12121212);
assert(data[1] == 0x00);
assert(data[2] == 0x34343434);
- erf1(f, EJIT_ARG(-1, int32_t));
+ erfi1(f, EJIT_ARG(-1, int32_t));
assert(data[0] == 0x12121212);
assert(data[1] == 0xffffffff);
assert(data[2] == 0x34343434);
diff --git a/tests/sti_64.c b/tests/sti_64.c
index 81d5c3f..6bb53f8 100644
--- a/tests/sti_64.c
+++ b/tests/sti_64.c
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
assert(data[0] == 0x1212121212121212);
assert(data[1] == 0x00);
assert(data[2] == 0x3434343434343434);
- erf1(f, EJIT_ARG(-1, int64_t));
+ erfi1(f, EJIT_ARG(-1, int64_t));
assert(data[0] == 0x1212121212121212);
assert(data[1] == 0xffffffffffffffff);
assert(data[2] == 0x3434343434343434);
diff --git a/tests/sti_8.c b/tests/sti_8.c
index d59ccec..d6459a3 100644
--- a/tests/sti_8.c
+++ b/tests/sti_8.c
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
assert(data[0] == 0x12);
assert(data[1] == 0x00);
assert(data[2] == 0x34);
- erf1(f, EJIT_ARG(-1, int8_t));
+ erfi1(f, EJIT_ARG(-1, int8_t));
assert(data[0] == 0x12);
assert(data[1] == 0xff);
assert(data[2] == 0x34);
diff --git a/tests/sti_d.c b/tests/sti_d.c
index 637fc80..1701b70 100644
--- a/tests/sti_d.c
+++ b/tests/sti_d.c
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
assert(data[0] == -1.0);
assert(data[1] == 0.0);
assert(data[2] == 0.5);
- erf1(f, EJIT_ARG(42.5, double));
+ erfi1(f, EJIT_ARG(42.5, double));
assert(data[0] == -1.0);
assert(data[1] == 42.5);
assert(data[2] == 0.5);
diff --git a/tests/sti_f.c b/tests/sti_f.c
index dede763..9122a71 100644
--- a/tests/sti_f.c
+++ b/tests/sti_f.c
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
assert(data[0] == -1.0);
assert(data[1] == 0.0);
assert(data[2] == 0.5);
- erf1(f, EJIT_ARG(42.5, float));
+ erfi1(f, EJIT_ARG(42.5, float));
assert(data[0] == -1.0);
assert(data[1] == 42.5);
assert(data[2] == 0.5);
diff --git a/tests/stxi_16.c b/tests/stxi_16.c
index 9f98137..d836bbe 100644
--- a/tests/stxi_16.c
+++ b/tests/stxi_16.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
assert(data[0] == 0x1212);
assert(data[1] == 0);
assert(data[2] == 0x3434);
- erf2(f, EJIT_ARG(sizeof(int16_t), int), EJIT_ARG(-1, int16_t));
+ erfi2(f, EJIT_ARG(sizeof(int16_t), int), EJIT_ARG(-1, int16_t));
assert(data[0] == 0x1212);
assert(data[1] == 0xffff);
assert(data[2] == 0x3434);
diff --git a/tests/stxi_32.c b/tests/stxi_32.c
index 3f3b8f4..ef02583 100644
--- a/tests/stxi_32.c
+++ b/tests/stxi_32.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
assert(data[0] == 0x12121212);
assert(data[1] == 0x00);
assert(data[2] == 0x34343434);
- erf2(f, EJIT_ARG(sizeof(int32_t), int), EJIT_ARG(-1, int32_t));
+ erfi2(f, EJIT_ARG(sizeof(int32_t), int), EJIT_ARG(-1, int32_t));
assert(data[0] == 0x12121212);
assert(data[1] == 0xffffffff);
assert(data[2] == 0x34343434);
diff --git a/tests/stxi_64.c b/tests/stxi_64.c
index f371aa8..226b40b 100644
--- a/tests/stxi_64.c
+++ b/tests/stxi_64.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
assert(data[0] == 0x1212121212121212);
assert(data[1] == 0x00);
assert(data[2] == 0x3434343434343434);
- erf2(f, EJIT_ARG(sizeof(int64_t), int), EJIT_ARG(-1, int64_t));
+ erfi2(f, EJIT_ARG(sizeof(int64_t), int), EJIT_ARG(-1, int64_t));
assert(data[0] == 0x1212121212121212);
assert(data[1] == 0xffffffffffffffff);
assert(data[2] == 0x3434343434343434);
diff --git a/tests/stxi_8.c b/tests/stxi_8.c
index 59ec4c7..4a461f7 100644
--- a/tests/stxi_8.c
+++ b/tests/stxi_8.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
assert(data[0] == 0x12);
assert(data[1] == 0x00);
assert(data[2] == 0x34);
- erf2(f, EJIT_ARG(sizeof(int8_t), int), EJIT_ARG(-1, int8_t));
+ erfi2(f, EJIT_ARG(sizeof(int8_t), int), EJIT_ARG(-1, int8_t));
assert(data[0] == 0x12);
assert(data[1] == 0xff);
assert(data[2] == 0x34);
diff --git a/tests/stxi_d.c b/tests/stxi_d.c
index 128dbb7..48e7b91 100644
--- a/tests/stxi_d.c
+++ b/tests/stxi_d.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
assert(data[0] == -1.0f);
assert(data[1] == 0.0f);
assert(data[2] == 0.5f);
- erf2(f, EJIT_ARG(sizeof(double), int), EJIT_ARG(42.5, double));
+ erfi2(f, EJIT_ARG(sizeof(double), int), EJIT_ARG(42.5, double));
assert(data[0] == -1.0f);
assert(data[1] == 42.5);
assert(data[2] == 0.5f);
diff --git a/tests/stxi_f.c b/tests/stxi_f.c
index 4c218ed..1d371d1 100644
--- a/tests/stxi_f.c
+++ b/tests/stxi_f.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
assert(data[0] == -1.0);
assert(data[1] == 0.0);
assert(data[2] == 0.5);
- erf2(f, EJIT_ARG(sizeof(float), int), EJIT_ARG(42.5, float));
+ erfi2(f, EJIT_ARG(sizeof(float), int), EJIT_ARG(42.5, float));
assert(data[0] == -1.0);
assert(data[1] == 42.5);
assert(data[2] == 0.5);
diff --git a/tests/stxr_16.c b/tests/stxr_16.c
index 901f084..e7365af 100644
--- a/tests/stxr_16.c
+++ b/tests/stxr_16.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[])
EJIT_ARG(sizeof(int16_t), int),
EJIT_ARG(-1, int16_t)
};
- ejit_run_func(f, 3, args);
+ ejit_run_func_i(f, 3, args);
assert(data[0] == 0x1212);
assert(data[1] == 0xffff);
assert(data[2] == 0x3434);
diff --git a/tests/stxr_32.c b/tests/stxr_32.c
index c6cde83..28d8b67 100644
--- a/tests/stxr_32.c
+++ b/tests/stxr_32.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[])
EJIT_ARG(sizeof(int32_t), int),
EJIT_ARG(-1, int32_t)
};
- ejit_run_func(f, 3, args);
+ ejit_run_func_i(f, 3, args);
assert(data[0] == 0x12121212);
assert(data[1] == 0xffffffff);
assert(data[2] == 0x34343434);
diff --git a/tests/stxr_64.c b/tests/stxr_64.c
index d4e2035..b4da373 100644
--- a/tests/stxr_64.c
+++ b/tests/stxr_64.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[])
EJIT_ARG(sizeof(int64_t), int),
EJIT_ARG(-1, int64_t)
};
- ejit_run_func(f, 3, args);
+ ejit_run_func_i(f, 3, args);
assert(data[0] == 0x1212121212121212);
assert(data[1] == 0xffffffffffffffff);
assert(data[2] == 0x3434343434343434);
diff --git a/tests/stxr_8.c b/tests/stxr_8.c
index da40eee..6e2e557 100644
--- a/tests/stxr_8.c
+++ b/tests/stxr_8.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[])
EJIT_ARG(sizeof(int8_t), int),
EJIT_ARG(-1, int8_t)
};
- ejit_run_func(f, 3, args);
+ ejit_run_func_i(f, 3, args);
assert(data[0] == 0x12);
assert(data[1] == 0xff);
assert(data[2] == 0x34);
diff --git a/tests/stxr_d.c b/tests/stxr_d.c
index 7a07332..288b1e9 100644
--- a/tests/stxr_d.c
+++ b/tests/stxr_d.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[])
EJIT_ARG(sizeof(double), int),
EJIT_ARG(42.5, double)
};
- ejit_run_func(f, 3, args);
+ ejit_run_func_i(f, 3, args);
assert(data[0] == -1.0);
assert(data[1] == 42.5);
assert(data[2] == 0.5);
diff --git a/tests/stxr_f.c b/tests/stxr_f.c
index 3e68060..c165563 100644
--- a/tests/stxr_f.c
+++ b/tests/stxr_f.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[])
EJIT_ARG(sizeof(float), int),
EJIT_ARG(42.5, float)
};
- ejit_run_func(f, 3, args);
+ ejit_run_func_i(f, 3, args);
assert(data[0] == -1.0);
assert(data[1] == 42.5);
assert(data[2] == 0.5);
diff --git a/tests/subr.c b/tests/subr.c
index 57f5459..f45dbf6 100644
--- a/tests/subr.c
+++ b/tests/subr.c
@@ -17,7 +17,7 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit);
- assert(erf2(f, EJIT_ARG(42, long), EJIT_ARG(69, long)) == -27);
+ assert(erfi2(f, EJIT_ARG(42, long), EJIT_ARG(69, long)) == -27);
ejit_destroy_func(f);
}
diff --git a/tests/subr_d.c b/tests/subr_d.c
index ef2c431..ef8e659 100644
--- a/tests/subr_d.c
+++ b/tests/subr_d.c
@@ -17,11 +17,13 @@ int main(int argc, char *argv[])
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(erfd2(f,
+ EJIT_ARG(42., double),
+ EJIT_ARG(69., double)) == -27.);
- assert(erff2(f, EJIT_ARG(42.5, double), EJIT_ARG(69., double)
- ) == -26.5);
+ assert(erfd2(f,
+ EJIT_ARG(42.5, double),
+ EJIT_ARG(69., double)) == -26.5);
ejit_destroy_func(f);
}
diff --git a/tests/truncr_d_32.c b/tests/truncr_d_32.c
index d028319..bc4c8fc 100644
--- a/tests/truncr_d_32.c
+++ b/tests/truncr_d_32.c
@@ -16,14 +16,14 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 1, EJIT_TYPE(int32_t), do_jit);
- assert(erf1(f, EJIT_ARG(0.0, double)) == 0);
- assert(erf1(f, EJIT_ARG(-0.0, double)) == 0);
- assert(erf1(f, EJIT_ARG(0.5, double)) == 0);
- assert(erf1(f, EJIT_ARG(-0.5, double)) == 0);
- assert(erf1(f, EJIT_ARG(1.5, double)) == 1);
- assert(erf1(f, EJIT_ARG(-1.5, double)) == -1);
- assert(erf1(f, EJIT_ARG(2.5, double)) == 2);
- assert(erf1(f, EJIT_ARG(-2.5, double)) == -2);
+ assert(erfi1(f, EJIT_ARG(0.0, double)) == 0);
+ assert(erfi1(f, EJIT_ARG(-0.0, double)) == 0);
+ assert(erfi1(f, EJIT_ARG(0.5, double)) == 0);
+ assert(erfi1(f, EJIT_ARG(-0.5, double)) == 0);
+ assert(erfi1(f, EJIT_ARG(1.5, double)) == 1);
+ assert(erfi1(f, EJIT_ARG(-1.5, double)) == -1);
+ assert(erfi1(f, EJIT_ARG(2.5, double)) == 2);
+ assert(erfi1(f, EJIT_ARG(-2.5, double)) == -2);
ejit_destroy_func(f);
}
diff --git a/tests/truncr_d_64.c b/tests/truncr_d_64.c
index d75aba5..8c688e1 100644
--- a/tests/truncr_d_64.c
+++ b/tests/truncr_d_64.c
@@ -16,14 +16,14 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 1, 1, EJIT_TYPE(int64_t), do_jit);
- assert(erf1(f, EJIT_ARG(0.0, double)) == 0);
- assert(erf1(f, EJIT_ARG(-0.0, double)) == 0);
- assert(erf1(f, EJIT_ARG(0.5, double)) == 0);
- assert(erf1(f, EJIT_ARG(-0.5, double)) == 0);
- assert(erf1(f, EJIT_ARG(1.5, double)) == 1);
- assert(erf1(f, EJIT_ARG(-1.5, double)) == -1);
- assert(erf1(f, EJIT_ARG(2.5, double)) == 2);
- assert(erf1(f, EJIT_ARG(-2.5, double)) == -2);
+ assert(erfl1(f, EJIT_ARG(0.0, double)) == 0);
+ assert(erfl1(f, EJIT_ARG(-0.0, double)) == 0);
+ assert(erfl1(f, EJIT_ARG(0.5, double)) == 0);
+ assert(erfl1(f, EJIT_ARG(-0.5, double)) == 0);
+ assert(erfl1(f, EJIT_ARG(1.5, double)) == 1);
+ assert(erfl1(f, EJIT_ARG(-1.5, double)) == -1);
+ assert(erfl1(f, EJIT_ARG(2.5, double)) == 2);
+ assert(erfl1(f, EJIT_ARG(-2.5, double)) == -2);
ejit_destroy_func(f);
}
diff --git a/tests/truncr_f_32.c b/tests/truncr_f_32.c
index 1de700f..70061b8 100644
--- a/tests/truncr_f_32.c
+++ b/tests/truncr_f_32.c
@@ -16,14 +16,14 @@ int main(int argc, char *argv[])
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);
+ assert(erfi1(f, EJIT_ARG(0.0, float)) == 0);
+ assert(erfi1(f, EJIT_ARG(-0.0, float)) == 0);
+ assert(erfi1(f, EJIT_ARG(0.5, float)) == 0);
+ assert(erfi1(f, EJIT_ARG(-0.5, float)) == 0);
+ assert(erfi1(f, EJIT_ARG(1.5, float)) == 1);
+ assert(erfi1(f, EJIT_ARG(-1.5, float)) == -1);
+ assert(erfi1(f, EJIT_ARG(2.5, float)) == 2);
+ assert(erfi1(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
index 994bb16..a309ed3 100644
--- a/tests/truncr_f_64.c
+++ b/tests/truncr_f_64.c
@@ -16,14 +16,14 @@ int main(int argc, char *argv[])
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);
+ assert(erfl1(f, EJIT_ARG(0.0, float)) == 0);
+ assert(erfl1(f, EJIT_ARG(-0.0, float)) == 0);
+ assert(erfl1(f, EJIT_ARG(0.5, float)) == 0);
+ assert(erfl1(f, EJIT_ARG(-0.5, float)) == 0);
+ assert(erfl1(f, EJIT_ARG(1.5, float)) == 1);
+ assert(erfl1(f, EJIT_ARG(-1.5, float)) == -1);
+ assert(erfl1(f, EJIT_ARG(2.5, float)) == 2);
+ assert(erfl1(f, EJIT_ARG(-2.5, float)) == -2);
ejit_destroy_func(f);
}
diff --git a/tests/xori64.c b/tests/xori64.c
index e7fe810..4535f33 100644
--- a/tests/xori64.c
+++ b/tests/xori64.c
@@ -9,20 +9,20 @@ int main(int argc, char *argv[])
struct ejit_operand operands[1] = {
EJIT_OPERAND_GPR(0, EJIT_TYPE(int64_t))
};
- struct ejit_func *f = ejit_create_func(EJIT_TYPE(int), 1, operands);
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(int64_t), 1, operands);
ejit_xori(f, EJIT_GPR(0), EJIT_GPR(0), 1);
ejit_retr(f, EJIT_GPR(0));
ejit_select_compile_func(f, 1, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf1(f, EJIT_ARG(0x7fffffff, int64_t)) == 0x7ffffffe);
- assert(erf1(f, EJIT_ARG(0x80000000, int64_t)) == 0x80000001);
- assert(erf1(f,
- EJIT_ARG(0x7fffffffffffffff,
- int64_t)) == 0x7ffffffffffffffe);
- assert(erf1(f, EJIT_ARG(0x8000000000000000, int64_t)
- ) == (int64_t)0x8000000000000001);
+ assert(erfl1(f, EJIT_ARG(0x7fffffff, int64_t)) == 0x7ffffffe);
+ assert(erfl1(f, EJIT_ARG(0x80000000, int64_t)) == 0x80000001);
+ assert(erfl1(f, EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == 0x7ffffffffffffffe);
+
+ assert(erfl1(f, EJIT_ARG(0x8000000000000000, int64_t))
+ == (int64_t)0x8000000000000001);
ejit_destroy_func(f);
}
diff --git a/tests/xorr64.c b/tests/xorr64.c
index 11ab249..59a317c 100644
--- a/tests/xorr64.c
+++ b/tests/xorr64.c
@@ -17,75 +17,105 @@ int main(int argc, char *argv[])
ejit_select_compile_func(f, 2, 0, EJIT_USE64(int64_t), do_jit);
- assert(erf2(f, EJIT_ARG(1, int64_t),
- EJIT_ARG(0x7fffffff, int64_t)) == 0x7ffffffe);
- assert(erf2(f, EJIT_ARG(1, int64_t),
- EJIT_ARG(0x80000000, int64_t)) == 0x80000001);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(1, int64_t)) == 0x7ffffffe);
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
- EJIT_ARG(1, int64_t)) == 0x80000001);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(0, int64_t)) == 0x7fffffff);
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(0x80000000, int64_t)
- ) == 0xffffffff);
-
- assert(erf2(f, EJIT_ARG(0x80000000, int64_t),
- EJIT_ARG(0x7fffffff, int64_t)
- ) == 0xffffffff);
-
- assert(erf2(f, EJIT_ARG(0x7fffffff, int64_t),
- EJIT_ARG(0xffffffff, int64_t)
- ) == 0x80000000);
-
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
- EJIT_ARG(0x7fffffff, int64_t)
- ) == 0x80000000);
-
- assert(erf2(f, EJIT_ARG(0xffffffff, int64_t),
- EJIT_ARG(0xffffffff, int64_t)
- ) == 0);
-
- assert(erf2(f, EJIT_ARG(0, int64_t), EJIT_ARG(0x7fffffff, int64_t)
- ) == 0x7fffffff);
-
- assert(erf2(f, EJIT_ARG(1, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == 0x7ffffffffffffffe);
-
- assert(erf2(f, EJIT_ARG(1, int64_t),
- EJIT_ARG(0x8000000000000000, int64_t)
- ) == (int64_t)0x8000000000000001);
-
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
- EJIT_ARG(1, int64_t)
- ) == (int64_t)0x8000000000000001);
-
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(1, int64_t)
- ) == (int64_t)0x7ffffffffffffffe);
-
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(0x8000000000000000, int64_t)
- ) == (int64_t)0xffffffffffffffff);
-
- assert(erf2(f, EJIT_ARG(0x8000000000000000, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == (int64_t)0xffffffffffffffff);
-
- assert(erf2(f, EJIT_ARG(0x7fffffffffffffff, int64_t),
- EJIT_ARG(0xffffffffffffffff, int64_t)
- ) == (int64_t)0x8000000000000000);
-
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
- EJIT_ARG(0x7fffffffffffffff, int64_t)
- ) == (int64_t)0x8000000000000000);
-
- assert(erf2(f, EJIT_ARG(0xffffffffffffffff, int64_t),
- EJIT_ARG(0xffffffffffffffff, int64_t)
- ) == 0);
-
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t))
+ == 0x7ffffffe);
+
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(0x80000000, int64_t))
+ == 0x80000001);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(1, int64_t))
+ == 0x7ffffffe);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x80000000, int64_t),
+ EJIT_ARG(1, int64_t))
+ == 0x80000001);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0, int64_t))
+ == 0x7fffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0x80000000, int64_t))
+ == 0xffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x80000000, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t))
+ == 0xffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffff, int64_t),
+ EJIT_ARG(0xffffffff, int64_t))
+ == 0x80000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffff, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t))
+ == 0x80000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffff, int64_t),
+ EJIT_ARG(0xffffffff, int64_t))
+ == 0);
+
+ assert(erfl2(f,
+ EJIT_ARG(0, int64_t),
+ EJIT_ARG(0x7fffffff, int64_t))
+ == 0x7fffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == 0x7ffffffffffffffe);
+
+ assert(erfl2(f,
+ EJIT_ARG(1, int64_t),
+ EJIT_ARG(0x8000000000000000, int64_t))
+ == (int64_t)0x8000000000000001);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, int64_t),
+ EJIT_ARG(1, int64_t))
+ == (int64_t)0x8000000000000001);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(1, int64_t))
+ == (int64_t)0x7ffffffffffffffe);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0x8000000000000000, int64_t))
+ == (int64_t)0xffffffffffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x8000000000000000, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == (int64_t)0xffffffffffffffff);
+
+ assert(erfl2(f,
+ EJIT_ARG(0x7fffffffffffffff, int64_t),
+ EJIT_ARG(0xffffffffffffffff, int64_t))
+ == (int64_t)0x8000000000000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffffffffffff, int64_t),
+ EJIT_ARG(0x7fffffffffffffff, int64_t))
+ == (int64_t)0x8000000000000000);
+
+ assert(erfl2(f,
+ EJIT_ARG(0xffffffffffffffff, int64_t),
+ EJIT_ARG(0xffffffffffffffff, int64_t))
+ == 0);
ejit_destroy_func(f);
}