ref: d388629dae7e6ab368015e3fc5c8c12c0e20fae1
parent: 95db2e9ddeaa3e85d4c7867541da72476db4a3c8
author: Jacob Moody <moody@posixcafe.org>
date: Wed May 1 19:08:11 EDT 2024
jc: sync OAS(MUL|DIV|MOD...) case with newer compilers When we do an OAS* operation we need to be mindful of the types at play, specifically if we need to convert say FPR to GPR.
--- a/sys/src/cmd/jc/cgen.c
+++ b/sys/src/cmd/jc/cgen.c
@@ -251,12 +251,21 @@
nod2 = *l;
}
- regalloc(&nod, n, nn);
- gmove(&nod2, &nod);
- gopcode(o, &nod1, Z, &nod);
+ if(nod1.type->etype == nod2.type->etype || !typefd[nod1.type->etype])
+ regalloc(&nod, &nod2, nn);
+ else
+ regalloc(&nod, &nod1, Z);
+ gopcode(OAS, &nod2, Z, &nod);
+ if(nod1.type->etype != nod.type->etype){
+ regalloc(&nod3, &nod, Z);
+ gmove(&nod1, &nod3);
+ regfree(&nod1);
+ nod1 = nod3;
+ }
+ gopcode(o, &nod1, &nod, &nod);
gmove(&nod, &nod2);
if(nn != Z)
- gopcode(OAS, &nod, Z, nn);
+ gmove(&nod, nn);
regfree(&nod);
regfree(&nod1);
if(l->addable < INDEXED)