summaryrefslogtreecommitdiff
path: root/src/cmd/8c/cgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/8c/cgen.c')
-rw-r--r--src/cmd/8c/cgen.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/cmd/8c/cgen.c b/src/cmd/8c/cgen.c
index 869d31ace..78eb7eced 100644
--- a/src/cmd/8c/cgen.c
+++ b/src/cmd/8c/cgen.c
@@ -277,6 +277,18 @@ cgen(Node *n, Node *nn)
break;
}
}
+ if(n->op == OOR && l->op == OASHL && r->op == OLSHR
+ && l->right->op == OCONST && r->right->op == OCONST
+ && l->left->op == ONAME && r->left->op == ONAME
+ && l->left->sym == r->left->sym
+ && l->right->vconst + r->right->vconst == 8 * l->left->type->width) {
+ regalloc(&nod, l->left, nn);
+ cgen(l->left, &nod);
+ gopcode(OROTL, n->type, l->right, &nod);
+ gmove(&nod, nn);
+ regfree(&nod);
+ break;
+ }
if(n->op == OADD && l->op == OASHL && l->right->op == OCONST
&& (r->op != OCONST || r->vconst < -128 || r->vconst > 127)) {
c = l->right->vconst;
@@ -1703,6 +1715,7 @@ copy:
}
}
+ v = w == 8;
if(n->complex >= FNX && nn != nil && nn->complex >= FNX) {
t = nn->type;
nn->type = types[TLONG];
@@ -1728,8 +1741,28 @@ copy:
}
x = 0;
- v = w == 8;
if(v) {
+ if(nn != nil && nn->complex >= FNX) {
+ t = nn->type;
+ nn->type = types[TLONG];
+ regialloc(&nod2, nn, Z);
+ lcgen(nn, &nod2);
+ nn->type = t;
+
+ nod2.type = typ(TIND, t);
+
+ nod1 = nod2;
+ nod1.op = OIND;
+ nod1.left = &nod2;
+ nod1.right = Z;
+ nod1.complex = 1;
+ nod1.type = t;
+
+ sugen(n, &nod1, w);
+ regfree(&nod2);
+ return;
+ }
+
c = cursafe;
if(n->left != Z && n->left->complex >= FNX
&& n->right != Z && n->right->complex >= FNX) {