Optimize arithmetic with pointer to value on stack + constant

This commit is contained in:
Daniel Glöckner 2008-09-11 19:15:57 +02:00 committed by grischka
parent e263ee3cbf
commit 5a92536cea

5
tcc.c
View File

@ -5596,8 +5596,9 @@ void gen_opic(int op)
} }
goto general_case; goto general_case;
} else if (c2 && (op == '+' || op == '-') && } else if (c2 && (op == '+' || op == '-') &&
(vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) == ((vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) ==
(VT_CONST | VT_SYM)) { (VT_CONST | VT_SYM) ||
(vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_LOCAL)) {
/* symbol + constant case */ /* symbol + constant case */
if (op == '-') if (op == '-')
l2 = -l2; l2 = -l2;