summaryrefslogtreecommitdiff
path: root/src/cmd/gc/walk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/walk.c')
-rw-r--r--src/cmd/gc/walk.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c
index ab4f946bd..65ab491f6 100644
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -851,13 +851,22 @@ walkexpr(Node **np, NodeList **init)
case ODIV:
case OMOD:
+ walkexpr(&n->left, init);
+ walkexpr(&n->right, init);
+ /*
+ * rewrite complex div into function call.
+ */
+ et = n->left->type->etype;
+ if(iscomplex[et] && n->op == ODIV) {
+ n = mkcall("complex128div", n->type, init,
+ conv(n->left, types[TCOMPLEX128]),
+ conv(n->right, types[TCOMPLEX128]));
+ goto ret;
+ }
/*
* rewrite div and mod into function calls
* on 32-bit architectures.
*/
- walkexpr(&n->left, init);
- walkexpr(&n->right, init);
- et = n->left->type->etype;
if(widthptr > 4 || (et != TUINT64 && et != TINT64))
goto ret;
if(et == TINT64)