aboutsummaryrefslogtreecommitdiff
path: root/tests/absr_f.c
blob: cc070b6ec494e9358d0200695196a48c86ee84f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <ejit/ejit.h>
#include <assert.h>
#include "do_jit.h"

int main()
{
	struct ejit_operand operands[1] = {
		EJIT_OPERAND_FPR(0, EJIT_DOUBLE)
	};
	struct ejit_func *f = ejit_create_func(EJIT_DOUBLE, 1, operands);
	ejit_absr_f(f, EJIT_FPR(0), EJIT_FPR(0));
	ejit_retr_f(f, EJIT_FPR(0));
	ejit_select_compile_func(f, 0, 1, do_jit);

	assert(ejit_run_func_f_1(f, ejit_double(0.0)) == 0.0);
	assert(ejit_run_func_f_1(f, ejit_double(-0.0)) == 0.0);
	assert(ejit_run_func_f_1(f, ejit_double(0.5)) == 0.5);
	assert(ejit_run_func_f_1(f, ejit_double(-0.5)) == 0.5);
}