aboutsummaryrefslogtreecommitdiff
path: root/tests/minr_f.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-04-05 13:46:09 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-04-05 13:46:09 +0300
commit42f89542550033a3f22700e6b0fd71627a252f96 (patch)
treeb92fe73c326cb631f6fbb0bc37bc1f653dcd2079 /tests/minr_f.c
parent441ddf9277f878b83c8d093def51b27285353fed (diff)
downloadejit-42f89542550033a3f22700e6b0fd71627a252f96.tar.gz
ejit-42f89542550033a3f22700e6b0fd71627a252f96.zip
implement minr_d/maxr_d
Diffstat (limited to 'tests/minr_f.c')
-rw-r--r--tests/minr_f.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/minr_f.c b/tests/minr_f.c
new file mode 100644
index 0000000..b02ec06
--- /dev/null
+++ b/tests/minr_f.c
@@ -0,0 +1,28 @@
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
+
+int main(int argc, char *argv[])
+{
+ (void)argv;
+ bool do_jit = argc > 1;
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_FPR(0, EJIT_TYPE(float)),
+ EJIT_OPERAND_FPR(1, EJIT_TYPE(float))
+ };
+
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(float), 2, operands);
+
+ ejit_minr_f(f, EJIT_FPR(2), EJIT_FPR(0), EJIT_FPR(1));
+ ejit_retr_f(f, EJIT_FPR(2));
+
+ ejit_select_compile_func(f, 0, 3, EJIT_USE64(float), do_jit, true);
+
+ assert(erff2(f, EJIT_ARG(42., float), EJIT_ARG(69., float)
+ ) == 42.);
+
+ assert(erff2(f, EJIT_ARG(-42., float), EJIT_ARG(-69., float)
+ ) == -69.);
+
+ ejit_destroy_func(f);
+}