(TYPE_UDWORD) operandLitValue (right));
break;
case EQ_OP:
- /* this op doesn't care about signedness */
- {
- TYPE_UDWORD l, r;
-
- l = (TYPE_UDWORD) operandLitValue (left);
- if (IS_CHAR(OP_VALUE(left)->type))
- l &= 0xff;
- else if (!IS_LONG (OP_VALUE(left)->type))
- l &= 0xffff;
- r = (TYPE_UDWORD) operandLitValue (right);
- if (IS_CHAR(OP_VALUE(right)->type))
- r &= 0xff;
- else if (!IS_LONG (OP_VALUE(right)->type))
- r &= 0xffff;
- retval = operandFromLit (l == r);
- }
+ if (IS_FLOAT (let) ||
+ IS_FLOAT (ret))
+ {
+ retval = operandFromLit (operandLitValue (left) ==
+ operandLitValue (right));
+ }
+ else
+ {
+ /* this op doesn't care about signedness */
+ TYPE_UDWORD l, r;
+
+ l = (TYPE_UDWORD) operandLitValue (left);
+ r = (TYPE_UDWORD) operandLitValue (right);
+ /* In order to correctly compare 'signed int' and 'unsigned int' it's
+ neccessary to strip them to 16 bit.
+ Literals are reduced to their cheapest type, therefore left and
+ right might have different types. It's neccessary to find a
+ common type: int (used for char too) or long */
+ if (!IS_LONG (let) &&
+ !IS_LONG (ret))
+ {
+ r = (TYPE_UWORD) r;
+ l = (TYPE_UWORD) l;
+ }
+ retval = operandFromLit (l == r);
+ }
break;
case '<':
retval = operandFromLit (operandLitValue (left) <
bool oldOneByteOps = FALSE;
static bool saidHello = FALSE;
- if ( strcmp (port->target, "pic14") == 0
- || strcmp (port->target, "pic16") == 0)
+ if (strcmp (port->target, "pic14") == 0)
oldOneByteOps = TRUE;
if (getenv ("SDCC_NEWONEBYTEOPS"))
{
/* code generated for 1 byte * 1 byte literal = 2 bytes result is more
efficient in most cases than 2 bytes result = 2 bytes << literal
if port has 1 byte muldiv */
- if (p2 && !IS_FLOAT (letype) &&
- !((resultIsInt) && (getSize (resType) != getSize (ltype)) &&
- (port->support.muldiv == 1)))
+ if (p2 && !IS_FLOAT (letype)
+ && !((resultIsInt) && (getSize (resType) != getSize (ltype))
+ && (port->support.muldiv == 1))
+ && strcmp (port->target, "pic14") != 0 /* don't shift for pic */
+ && strcmp (port->target, "pic16") != 0)
{
if ((resultIsInt) && (getSize (resType) != getSize (ltype)))
{