Branch: Tag:

2014-09-06

2014-09-06 07:16:06 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Optimizer: Added more rules for negation and complement.

42:   NUMBER [ $1a < 0 && !INT32_NEG_OVERFLOW($1a) ] : NEG_NUMBER (-$1a)   NEG_NUMBER [ $1a <= 0 && !INT32_NEG_OVERFLOW($1a) ] : NUMBER (-$1a)   NEGATE NEGATE : + CONST0 COMPL: CONST_1 + CONST1 COMPL: NEG_NUMBER(2) + CONST_1 COMPL: CONST0 + NUMBER COMPL: NEG_NUMBER($1a+1) + NEG_NUMBER COMPL: NUMBER($1a-1) + BIGNUM COMPL: NUMBER(-0x80000000) // Note: Invalid as NEG_NUMBER on 32bit!   COMPL COMPL :   NEGATE CONST_1 ADD_INTS : COMPL -  + NEGATE ADD_NEG_INT(1) : COMPL   NEGATE CONST1 SUBTRACT : COMPL -  + CONST1 ADD_INTS NEGATE : COMPL + ADD_INT(1) NEGATE : COMPL + CONST_1 SUBTRACT NEGATE : COMPL + COMPL CONST1 ADD_INTS : NEGATE + COMPL ADD_INT(1) : NEGATE + COMPL CONST_1 SUBTRACT : NEGATE + CONST_1 ADD_INTS COMPL : NEGATE + ADD_NEG_INT(1) COMPL : NEGATE + CONST1 SUBTRACT COMPL : NEGATE   NUMBER ASSIGN_LOCAL NEGATE: NUMBER($1a) ASSIGN_LOCAL_AND_POP($2a) NEG_NUMBER($1a)   NEG_NUMBER ASSIGN_LOCAL NEGATE: NEG_NUMBER($1a) ASSIGN_LOCAL_AND_POP($2a) NUMBER($1a)   CONST1 ASSIGN_LOCAL NEGATE: CONST1 ASSIGN_LOCAL_AND_POP($2a) CONST_1
278:   CONST_1 ADD_INTS: ADD_NEG_INT (1)   NUMBER [$1a >= 0] ADD_INTS : ADD_INT ($1a)   NEG_NUMBER [$1a > 0] ADD_INTS : ADD_NEG_INT ($1a) + ADD_INT [$1a < 0 && !INT32_NEG_OVERFLOW($1a)]: ADD_NEG_INT(-$1a) + ADD_NEG_INT [$1a < 0 && !INT32_NEG_OVERFLOW($1a)]: ADD_INT(-$1a)      #define OPER_INT(X,Y) \    X MOD : MOD_INT(Y); \
327:   // ADD_INT ADD_NEG_INT [$2a <= $1a]: ADD_INT ($1a-$2a)   // ADD_INT ADD_NEG_INT [$2a > $1a]: ADD_NEG_INT ($2a-$1a)    - // FIXME: BIGNUMS? - // - // NUMBER ADD_INT : NUMBER ($1a+$2a) - // NUMBER ADD_NEG_INT : NUMBER ($1a-$2a) - // CONST1 ADD_INT : NUMBER(1+$2a) - // CONST1 ADD_NEG_INT : NUMBER(1-$2a) - // CONST_1 ADD_INT : NUMBER($2a-1) - // CONST_1 ADD_NEG_INT : NUMBER(-(1+$2a)) -  +    // FIXME: What about LTOSVAL_AND_FREE variants of the following three rules?      LTOSVAL2_AND_FREE ADD ASSIGN : ADD_TO