+ /* use native mult for `u8_t x u8_t --> { u16_t, s16_t }' */
+ if (sizeL == 1 && symL /*&& SPEC_USIGN(OP_SYM_TYPE(IC_LEFT(ic)))*/) {
+ sizeL = 1;
+ } else {
+ //printf( "%s: left too large (%u) / signed (%u)\n", __FUNCTION__, sizeL, symL && !SPEC_USIGN(OP_SYM_TYPE(IC_LEFT(ic))));
+ sizeL = 4;
+ }
+ if (sizeR == 1 && symR /*&& SPEC_USIGN(OP_SYM_TYPE(IC_RIGHT(ic)))*/) {
+ sizeR = 1;
+ } else {
+ //printf( "%s: right too large (%u) / signed (%u)\n", __FUNCTION__, sizeR, symR && !SPEC_USIGN(OP_SYM_TYPE(IC_RIGHT(ic))));
+ sizeR = 4;
+ }
+
+ /* also allow literals [-128..256) for left/right operands */
+ if (IS_VALOP(IC_LEFT(ic)))
+ {
+ long l = (long)floatFromVal( OP_VALUE( IC_LEFT(ic) ) );
+ sizeL = 4;
+ //printf( "%s: val(left) = %ld\n", __FUNCTION__, l );
+ if (l >= -128 && l < 256)
+ {
+ sizeL = 1;
+ } else {
+ //printf( "%s: left value %ld outside [-128..256)\n", __FUNCTION__, l );
+ }
+ }
+ if (IS_VALOP( IC_RIGHT(ic) ))
+ {
+ long l = (long)floatFromVal( OP_VALUE( IC_RIGHT(ic) ) );
+ sizeR = 4;
+ //printf( "%s: val(right) = %ld\n", __FUNCTION__, l );
+ if (l >= -128 && l < 256)
+ {
+ sizeR = 1;
+ } else {
+ //printf( "%s: right value %ld outside [-128..256)\n", __FUNCTION__, l );
+ }
+ }
+
+ /* use native mult iff left and right are (unsigned) 8-bit operands */
+ if (sizeL == 1 && sizeR == 1) { return TRUE; }
+ }
+
+ if (ic->op == '/' || ic->op == '%')
+ {
+ /* We must catch /: {u8_t,s8_t} x {u8_t,s8_t} --> {u8_t,s8_t},
+ * because SDCC will call 'divuchar' even for u8_t / s8_t.
+ * Example: 128 / -2 becomes 128 / 254 = 0 != -64... */
+ if (sizeL == 1 && sizeR == 1) return TRUE;
+
+ /* What about literals? */
+ if (IS_VALOP( IC_LEFT(ic) ))
+ {
+ long l = (long)floatFromVal( OP_VALUE( IC_LEFT(ic) ) );
+ sizeL = 4;
+ //printf( "%s: val(left) = %ld\n", __FUNCTION__, l );
+ if (l >= -128 && l < 256)
+ {
+ sizeL = 1;
+ } else {
+ //printf( "%s: left value %ld outside [-128..256)\n", __FUNCTION__, l );
+ }
+ }
+ if (IS_VALOP( IC_RIGHT(ic) ))
+ {
+ long l = (long)floatFromVal( OP_VALUE( IC_RIGHT(ic) ) );
+ sizeR = 4;
+ //printf( "%s: val(right) = %ld\n", __FUNCTION__, l );
+ if (l >= -128 && l < 256)
+ {
+ sizeR = 1;
+ } else {
+ //printf( "%s: right value %ld outside [-128..256)\n", __FUNCTION__, l );
+ }
+ }
+ if (sizeL == 1 && sizeR == 1) { return TRUE; }
+ }