summaryrefslogtreecommitdiff
path: root/src/cmd/gc/walk.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-06-02 23:21:58 -0700
committerRuss Cox <rsc@golang.org>2009-06-02 23:21:58 -0700
commit66a4d6a3f43c76da53fc3a3968544c5c6e1890cc (patch)
tree5b267e873fddd01292881c273a7094f9801b6624 /src/cmd/gc/walk.c
parent5d553b6422fc4e7b8fbfbf0a7fff802f9de90ac4 (diff)
downloadgolang-66a4d6a3f43c76da53fc3a3968544c5c6e1890cc.tar.gz
minor cleanup, 64-bit /= and %= on 32-bit
R=ken OCL=29806 CL=29808
Diffstat (limited to 'src/cmd/gc/walk.c')
-rw-r--r--src/cmd/gc/walk.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c
index c552c0928..4cb412c6c 100644
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -1143,10 +1143,10 @@ loop:
* rewrite div and mod into function calls
* on 32-bit architectures.
*/
- switch(n->op) {
- case ODIV:
- case OMOD:
- et = n->left->type->etype;
+ switch(n->op) {
+ case ODIV:
+ case OMOD:
+ et = n->left->type->etype;
if(widthptr > 4 || (et != TUINT64 && et != TINT64))
break;
if(et == TINT64)
@@ -1163,9 +1163,21 @@ loop:
n->right = nod(OCONV, n->right, N);
n->right->type = types[et];
r = nod(OCALL, l, list(n->left, n->right));
+ r = nod(OCONV, r, N);
+ r->type = n->left->left->type;
walktype(r, Erv);
indir(n, r);
goto ret;
+
+ case OASOP:
+ et = n->left->type->etype;
+ if(widthptr > 4 || (et != TUINT64 && et != TINT64))
+ break;
+ l = saferef(n->left);
+ r = nod(OAS, l, nod(n->etype, l, n->right));
+ walktype(r, Etop);
+ indir(n, r);
+ goto ret;
}
if(t == T)