diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-04-05 18:23:54 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-04-05 18:23:54 +0300 |
commit | 63786e449651a748c860e9df0b160deaefa07ec5 (patch) | |
tree | c6ce1637157db75b771b125c121cb36bbcd92123 /src/main.c | |
parent | c81117935cf7e413813acac30561395e86789ce5 (diff) | |
download | ejit-prospero-63786e449651a748c860e9df0b160deaefa07ec5.tar.gz ejit-prospero-63786e449651a748c860e9df0b160deaefa07ec5.zip |
use newly provided minr_f/maxr_f
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 25 |
1 files changed, 2 insertions, 23 deletions
@@ -184,18 +184,7 @@ static size_t compile_line(struct ejit_func *kernel, const char *line) size_t arg0 = 0, arg1 = 0; line = parse_var(line, &arg0); line = parse_var(line, &arg1); - - /* no built-in fmax/fmin so use a plain old branch */ - struct ejit_reloc r = ejit_bger_f(kernel, EJIT_FPR(arg0), EJIT_FPR(arg1)); - /* arg0 < arg1 */ - ejit_movr_f(kernel, EJIT_FPR(out), EJIT_FPR(arg1)); - struct ejit_reloc j = ejit_jmp(kernel); - - /* arg0 >= arg1 */ - ejit_patch(kernel, r, ejit_label(kernel)); - ejit_movr_f(kernel, EJIT_FPR(out), EJIT_FPR(arg0)); - - ejit_patch(kernel, j, ejit_label(kernel)); + ejit_maxr_f(kernel, EJIT_FPR(out), EJIT_FPR(arg0), EJIT_FPR(arg1)); break; } @@ -203,17 +192,7 @@ static size_t compile_line(struct ejit_func *kernel, const char *line) size_t arg0 = 0, arg1 = 0; line = parse_var(line, &arg0); line = parse_var(line, &arg1); - - struct ejit_reloc r = ejit_bger_f(kernel, EJIT_FPR(arg0), EJIT_FPR(arg1)); - /* arg0 < arg1 */ - ejit_movr_f(kernel, EJIT_FPR(out), EJIT_FPR(arg0)); - struct ejit_reloc j = ejit_jmp(kernel); - - /* arg0 >= arg1 */ - ejit_patch(kernel, r, ejit_label(kernel)); - ejit_movr_f(kernel, EJIT_FPR(out), EJIT_FPR(arg1)); - - ejit_patch(kernel, j, ejit_label(kernel)); + ejit_minr_f(kernel, EJIT_FPR(out), EJIT_FPR(arg0), EJIT_FPR(arg1)); break; } |