[m-dev.] diff: GCC back-end: fix bug with floating point division

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Jan 21 03:57:59 AEDT 2001


Estimated hours taken: 0.75

Fix a bug with the handling of floating point division.

compiler/gcc.m:
	Add an interface to the RDIV_EXPR (floating point division) operator.

compiler/mlds_to_gcc.m:
	For float_divide, use gcc__rdiv_expr rather than gcc__trunc_div_expr.

Index: gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/gcc.m,v
retrieving revision 1.16
diff -u -d -u -r1.16 gcc.m
--- gcc.m	2001/01/18 15:43:42	1.16
+++ gcc.m	2001/01/20 16:27:39
@@ -304,6 +314,7 @@
 :- func plus_expr  = gcc__op.		% +
 :- func minus_expr = gcc__op.		% *
 :- func mult_expr  = gcc__op.		% -
+:- func rdiv_expr = gcc__op.		% / (floating-point division)
 :- func trunc_div_expr = gcc__op.	% / (truncating integer division)
 :- func trunc_mod_expr = gcc__op.	% % (remainder after truncating
 					%    integer division)
@@ -922,6 +957,9 @@
 :- pragma c_code(mult_expr = (Code::out), [will_not_call_mercury], "
 	Code = MULT_EXPR;
 ").
+:- pragma c_code(rdiv_expr = (Code::out), [will_not_call_mercury], "
+	Code = RDIV_EXPR;
+").
 :- pragma c_code(trunc_div_expr = (Code::out), [will_not_call_mercury], "
 	Code = TRUNC_DIV_EXPR;
 ").
Index: mlds_to_gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.23
diff -u -d -u -r1.23 mlds_to_gcc.m
--- mlds_to_gcc.m	2001/01/20 15:42:46	1.23
+++ mlds_to_gcc.m	2001/01/20 16:28:57
@@ -3224,7 +3226,7 @@
 convert_binary_op(float_plus,	gcc__plus_expr,	     'MR_Float').
 convert_binary_op(float_minus,	gcc__minus_expr,     'MR_Float').
 convert_binary_op(float_times,	gcc__mult_expr,	     'MR_Float').
-convert_binary_op(float_divide,	gcc__trunc_div_expr, 'MR_Float').
+convert_binary_op(float_divide,	gcc__rdiv_expr,      'MR_Float').
 convert_binary_op(float_eq,	gcc__eq_expr,	     gcc__boolean_type_node).
 convert_binary_op(float_ne,	gcc__ne_expr,	     gcc__boolean_type_node).
 convert_binary_op(float_lt,	gcc__lt_expr,	     gcc__boolean_type_node).
cvs diff: Diffing notes

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list