Skip to content

Commit 46a17e7

Browse files
committed
Fix round for 32 arch
1 parent 7f10c70 commit 46a17e7

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

m3-sys/m3cc/gcc/gcc/m3cg/parse.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5147,18 +5147,23 @@ M3CG_HANDLER (MAX) { m3_minmax (type, 0); }
51475147
M3CG_HANDLER (ROUND)
51485148
{
51495149
//Use the builtins for rounding.
5150+
tree dt;
51505151
m3_start_call ();
51515152
m3_pop_param (src_t);
51525153

5154+
if (dst_T == T_int_32)
5155+
dt = t_int_32;
5156+
else
5157+
dt = t_int_64;
51535158
if (src_T == T_reel) {
5154-
m3_call_direct (lroundf_proc, t_int_64);
5159+
m3_call_direct (lroundf_proc, dt);
51555160
} else if (src_T == T_lreel) {
5156-
m3_call_direct (lround_proc, t_int_64);
5161+
m3_call_direct (lround_proc, dt);
51575162
} else if (src_T == T_xreel) {
51585163
if (LONG_DOUBLE_TYPE_SIZE == 64) {
5159-
m3_call_direct (lround_proc, t_int_64);
5164+
m3_call_direct (lround_proc, dt);
51605165
} else {
5161-
m3_call_direct (lroundq_proc, t_int_64);
5166+
m3_call_direct (lroundq_proc, dt);
51625167
}
51635168
}
51645169
EXPR_REF (-1) = m3_build1 (FIX_TRUNC_EXPR, dst_t, EXPR_REF (-1));

0 commit comments

Comments
 (0)