From eb4aa7ccece6bc1f5253a0ad6f26d8bead1c5f63 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 13 Sep 2002 17:38:19 +0000 Subject: [PATCH] produce better code for v6 % --- tools/qfcc/source/expr.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 2c2cf7bf2..b7ac003c9 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -1445,13 +1445,17 @@ binary_expr (int op, expr_t *e1, expr_t *e2) { expr_t *tmp1, *tmp2; e = new_block_expr (); - tmp1 = new_temp_def_expr (&type_float); + if (e2->type < ex_string) + tmp1 = new_temp_def_expr (&type_float); + else + tmp1 = e2; tmp2 = new_temp_def_expr (&type_float); e2 = binary_expr ('&', e2, new_float_expr (-1.0)); e1 = binary_expr ('&', e1, new_float_expr (-1.0)); - append_expr (e, assign_expr (tmp1, e2)); - append_expr (e, assign_expr (tmp2, - binary_expr ('/', e1, tmp1))); + if (tmp1 != e2) + append_expr (e, new_bind_expr (e2, tmp1)); + append_expr (e, new_bind_expr (binary_expr ('/', e1, tmp1), + tmp2)); e2 = binary_expr ('&', tmp2, new_float_expr (-1.0)); e->e.block.result = binary_expr ('-', tmp2, e2); e2 = e;