Skip to content

Commit 7f10c70

Browse files
committed
Further fix for round on m3cc
1 parent c893088 commit 7f10c70

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

m3-sys/m3cc/gcc-4.7/gcc/tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9471,8 +9471,8 @@ build_common_builtin_nodes (void)
94719471
{
94729472
ftype = build_function_type_list (long_integer_type_node, long_double_type_node,
94739473
NULL_TREE);
9474-
local_define_builtin ("__builtin_lroundl", ftype, BUILT_IN_LROUNDL,
9475-
"lroundl", ECF_NOTHROW | ECF_LEAF);
9474+
local_define_builtin ("__builtin_lroundq", ftype, BUILT_IN_LROUNDL,
9475+
"lroundq", ECF_NOTHROW | ECF_LEAF);
94769476
}
94779477

94789478
if (!builtin_decl_explicit_p (BUILT_IN_ALLOCA))

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ static GTY (()) tree bytes_per_integer_tree;
10161016
#define memcmp_proc builtin_decl_explicit (BUILT_IN_MEMCMP)
10171017
#define lroundf_proc builtin_decl_explicit (BUILT_IN_LROUNDF)
10181018
#define lround_proc builtin_decl_explicit (BUILT_IN_LROUND)
1019-
#define lroundl_proc builtin_decl_explicit (BUILT_IN_LROUNDL)
1019+
#define lroundq_proc builtin_decl_explicit (BUILT_IN_LROUNDL)
10201020
static GTY (()) tree set_union_proc;
10211021
static GTY (()) tree set_diff_proc;
10221022
static GTY (()) tree set_inter_proc;
@@ -5146,7 +5146,6 @@ M3CG_HANDLER (MAX) { m3_minmax (type, 0); }
51465146

51475147
M3CG_HANDLER (ROUND)
51485148
{
5149-
/* not just yet needs more testing
51505149
//Use the builtins for rounding.
51515150
m3_start_call ();
51525151
m3_pop_param (src_t);
@@ -5159,19 +5158,19 @@ M3CG_HANDLER (ROUND)
51595158
if (LONG_DOUBLE_TYPE_SIZE == 64) {
51605159
m3_call_direct (lround_proc, t_int_64);
51615160
} else {
5162-
m3_call_direct (lroundl_proc, t_int_64);
5161+
m3_call_direct (lroundq_proc, t_int_64);
51635162
}
51645163
}
51655164
EXPR_REF (-1) = m3_build1 (FIX_TRUNC_EXPR, dst_t, EXPR_REF (-1));
5166-
*/
51675165

51685166
/*
5169-
original code which produces erroneous results on 64 bit architectures
5170-
for all odd integers as floats beyond about 2^16. In those cases the
5171-
number is rounded up when it should not, as there is no fractional part.
5172-
See test p126.
5167+
the original code, which produces erroneous results for reel
5168+
on 64 bit architectures for all odd integers-as-floats beyond about 2^16.
5169+
In those cases this code rounds up when it should leave untouched,
5170+
as there is no fractional part. See test p126.
51735171
*/
51745172

5173+
/*
51755174
REAL_VALUE_TYPE r;
51765175
51775176
memset (&r, 0, sizeof(r));
@@ -5192,7 +5191,7 @@ M3CG_HANDLER (ROUND)
51925191
m3_build2 (PLUS_EXPR, src_t, arg,
51935192
m3_build3 (COND_EXPR, src_t,
51945193
cond, pos, neg)));
5195-
5194+
*/
51965195
}
51975196

51985197
M3CG_HANDLER (TRUNC)

0 commit comments

Comments
 (0)