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

int main()
{
	struct ejit_operand operands[1] = {
		EJIT_OPERAND_FPR(0, EJIT_TYPE(double))
	};
	struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 1, operands);

	ejit_negr_f(f, EJIT_FPR(0), EJIT_FPR(0));
	ejit_retr_f(f, EJIT_FPR(0));

	ejit_select_compile_func(f, 0, 1, EJIT_USE64(double), do_jit);

	assert(erff1(f, EJIT_ARG(0.0f, double)) == -0.0f);
	assert(erff1(f, EJIT_ARG(0.5f, double)) == -0.5f);
	assert(erff1(f, EJIT_ARG(1.0f / 0.0f, double)) == -1.0f / 0.0f);
	assert(erff1(f, EJIT_ARG(-1.25f, double)) == 1.25f);

	ejit_destroy_func(f);
}