History

i386: do not 'lexpand' into registers necessarily

Previously, long longs were 'lexpand'ed into two registers always. Now, it expands - constants into two constants (lo-part, hi-part) - variables into two lvalues with offset+4 for the hi-part. This makes long long operations look a bit nicer.

grischka committed 10 years ago

Commit d9b7f011 parent 6245db92 files · +18 −12Browse files

Unified · Split

2 files
  1. i386-gen.c +2 −2
  2. tccgen.c +16 −10
i386-gen.c+2−2
@@ -754,9 +754,9 @@ ST_FUNC void gen_opi(int op) · 753 unmodified lines
754 c = vtop->c.i;754 c = vtop->c.i;
755 if (c == (char)c) {755 if (c == (char)c) {
756 /* generate inc and dec for smaller code */756 /* generate inc and dec for smaller code */
757 if (c==1 && opc==0) {757 if (c==1 && opc==0 && op != TOK_ADDC1) {
758 o (0x40 | r); // inc758 o (0x40 | r); // inc
759 } else if (c==1 && opc==5) {759 } else if (c==1 && opc==5 && op != TOK_SUBC1) {
760 o (0x48 | r); // dec760 o (0x48 | r); // dec
761 } else {761 } else {
762 o(0x83);762 o(0x83);
tccgen.c+16−10
@@ -1209,19 +1209,25 @@ static int reg_fret(int t) · 1208 unmodified lines
1209 return REG_FRET;1209 return REG_FRET;
1210}1210}
1211 1211
1212/* expand long long on stack in two int registers */1212/* expand long long on stack in two ints */
1213static void lexpand(void)1213static void lexpand(void)
1214{1214{
1215 int u;1215 int u, v;
1216
1217 u = vtop->type.t & (VT_DEFSIGN | VT_UNSIGNED);1216 u = vtop->type.t & (VT_DEFSIGN | VT_UNSIGNED);
1218 gv(RC_INT);1217 v = vtop->r & (VT_VALMASK | VT_LVAL);
1219 vdup();1218 if (v == VT_CONST) {
1220 vtop[0].r = vtop[-1].r2;1219 vdup();
1221 vtop[0].r2 = VT_CONST;1220 vtop[0].c.i >>= 32;
1222 vtop[-1].r2 = VT_CONST;1221 } else if (v == (VT_LVAL|VT_CONST) || v == (VT_LVAL|VT_LOCAL)) {
1223 vtop[0].type.t = VT_INT | u;1222 vdup();
1224 vtop[-1].type.t = VT_INT | u;1223 vtop[0].c.i += 4;
1224 } else {
1225 gv(RC_INT);
1226 vdup();
1227 vtop[0].r = vtop[-1].r2;
1228 vtop[0].r2 = vtop[-1].r2 = VT_CONST;
1229 }
1230 vtop[0].type.t = vtop[-1].type.t = VT_INT | u;
1225}1231}
1226 1232
1227#ifdef TCC_TARGET_ARM1233#ifdef TCC_TARGET_ARM

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t