riscv: Fix ftoi and ftof(long double->float)
float to int must be truncations, not normal rounding. And ftof was typoed to select the wrong conversion function. This fixes tcctest.c completely. (make -C tests test1)
This commit is contained in:
parent
06184aec53
commit
1ada32900b
1 changed files with 2 additions and 2 deletions
|
@ -1067,7 +1067,7 @@ ST_FUNC void gen_cvt_ftoi(int t)
|
||||||
vtop++;
|
vtop++;
|
||||||
vtop->r = dr;
|
vtop->r = dr;
|
||||||
dr = ireg(dr);
|
dr = ireg(dr);
|
||||||
EIu(0x53, 7, dr, rr, ((0x60 | (ft == VT_DOUBLE ? 1 : 0)) << 5) | (u ? 1 : 0) | (l ? 2 : 0)); // fcvt.[wl][u].[sd]
|
EIu(0x53, 1, dr, rr, ((0x60 | (ft == VT_DOUBLE ? 1 : 0)) << 5) | (u ? 1 : 0) | (l ? 2 : 0)); // fcvt.[wl][u].[sd] rtz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1080,7 +1080,7 @@ ST_FUNC void gen_cvt_ftof(int dt)
|
||||||
if (dt == VT_LDOUBLE || st == VT_LDOUBLE) {
|
if (dt == VT_LDOUBLE || st == VT_LDOUBLE) {
|
||||||
int func = (dt == VT_LDOUBLE) ?
|
int func = (dt == VT_LDOUBLE) ?
|
||||||
(st == VT_FLOAT ? TOK___extendsftf2 : TOK___extenddftf2) :
|
(st == VT_FLOAT ? TOK___extendsftf2 : TOK___extenddftf2) :
|
||||||
(st == VT_FLOAT ? TOK___trunctfsf2 : TOK___trunctfdf2);
|
(dt == VT_FLOAT ? TOK___trunctfsf2 : TOK___trunctfdf2);
|
||||||
vpush_global_sym(&func_old_type, func);
|
vpush_global_sym(&func_old_type, func);
|
||||||
vrott(2);
|
vrott(2);
|
||||||
gfunc_call(1);
|
gfunc_call(1);
|
||||||
|
|
Loading…
Reference in a new issue