+2003-07-24 Bernhard Held <bernhard@bernhardheld.de>
+
+ * src/SDCCicode.c (operandOperation): really fixed problem with bitops
+ * support/regression/tests/bitopcse.c: added
+ fixed warning:
+ * src/avr/gen.c:
+ * src/pic/gen.c:
+ * src/pic16/gen.c:
+ * src/z80/gen.c:
+ * src/xa51/gen.c:
+
2003-07-24 Jesus Calvino-Fraga <jesusc@ece.ubc.ca>
added support for new library format to z80, gbz80 linkers:
2003-07-20 Bernhard Held <bernhard@bernhardheld.de>
- * src/pic16/glue.c: minor cleanup by Vangelis
+ * src/pic16/glue.c: minor cleanup by Vangelis
2003-07-19 Frieder Ferlemann <Frieder.Ferlemann@web.de>
* device/lib/_ser.c: process RX bytes earlier than TX bytes
* device/lib/serial.c: process RX bytes earlier than TX bytes
* src/mcs51/gen.c(genGenPointerGet/Set): removed writing of type after postincrement
-
+
2003-07-18 Erik Petrich <epetrich@ivorytower.norman.ok.us>
* src/z80/gen.c: fixed some right shift bugs (#772726 among them)
2003-07-17 Bernhard Held <bernhard@bernhardheld.de>
- * device/lib/Makefile.in: bad fix, reverted to 1.43
-
+ * device/lib/Makefile.in: bad fix, reverted to 1.43
+
2003-07-16 Bernhard Held <bernhard@bernhardheld.de>
* device/lib/Makefile.in: added missing z80 object files
2003-07-14 Bernhard Held <bernhard@bernhardheld.de>
- * src/SDCCcse.c (algebraicOpts): CSE fun with &|^ and 0x00/0xff literals
+ * src/SDCCcse.c (algebraicOpts): CSE fun with &|^ and 0x00/0xff literals
pic16 progress by Vangelis:
* src/SDCCglobl.h:
* src/SDCCmain.c:
2003-06-08 Jesus Calvino-Fraga <jesusc@ece.ubc.ca>
* support/Util/SDCCerr.c, src/SDCCglobl.h, src/SDCCmain.c, doc/sdccman.lyx:
- added option --vc, so sdcc errors and warnings are compatible with
+ added option --vc, so sdcc errors and warnings are compatible with
Microsoft Visual Studio.
2003-06-07 Jesus Calvino-Fraga <jesusc@ece.ubc.ca>
2003-05-29 Bernhard Held <bernhard@bernhardheld.de>
* src/pic/device.c: added 16F819, patch by "David I. Lehn" <dlehn@vt.edu>
- * src/SDCCcse.c (algebraicOpts): fixed "c * 1"
+ * src/SDCCcse.c (algebraicOpts): fixed "c * 1"
2003-05-28 Bernhard Held <bernhard@bernhardheld.de>
operandLitValue (right));
break;
case BITWISEAND:
- retval = operandFromLit ((unsigned long)operandLitValue(left) &
- (unsigned long)operandLitValue(right));
+ retval = operandFromValue (valCastLiteral (type,
+ (unsigned long)operandLitValue(left) &
+ (unsigned long)operandLitValue(right)));
break;
case '|':
- retval = operandFromLit ((unsigned long)operandLitValue (left) |
- (unsigned long)operandLitValue (right));
+ retval = operandFromValue (valCastLiteral (type,
+ (unsigned long)operandLitValue(left) |
+ (unsigned long)operandLitValue(right)));
break;
case '^':
- retval = operandFromLit ((unsigned long)operandLitValue (left) ^
- (unsigned long)operandLitValue (right));
+ retval = operandFromValue (valCastLiteral (type,
+ (unsigned long)operandLitValue(left) ^
+ (unsigned long)operandLitValue(right)));
break;
case AND_OP:
retval = operandFromLit (operandLitValue (left) &&
emitcode ("; genDummyRead","");
emitcode ("; not implemented","");
- ic;
+ ic = ic;
}
/*-----------------------------------------------------------------*/
pic14_emitcode ("; genDummyRead","");
pic14_emitcode ("; not implemented","");
- ic;
+ ic = ic;
}
/*-----------------------------------------------------------------*/
pic16_emitcode ("; genDummyRead","");
pic16_emitcode ("; not implemented","");
- ic;
+ ic = ic;
}
/*-----------------------------------------------------------------*/
genDummyRead (iCode * ic)
{
emitcode ("; genDummyRead","");
+
+ ic = ic;
}
/*-----------------------------------------------------------------*/
{
emit2 ("; genDummyRead not implemented");
- ic;
+ ic = ic;
}
enum
--- /dev/null
+/* Test CSE with |&^
+
+ type: bit, char, short, long
+ */
+#include <testfwk.h>
+
+/* This is not only a regression test, the focus of this test
+ is more on the generated code (volatile!). */
+
+
+#define _{type}
+
+#if defined(_bit)
+# define MASK 1
+# define idata
+#elif defined(_char)
+# define MASK 0xff
+#elif defined(_short)
+# define MASK 0xffff
+#elif defined(_long)
+# define MASK 0xffffffff
+#else
+# warn Unknow type
+#endif
+
+#if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
+# define idata
+# define code
+#endif
+
+/* the variable 'mask' is only define to see if MASK is correctly set up */
+code unsigned long mask = MASK;
+
+ volatile {type} v;
+ volatile unsigned {type} uv;
+/* an array would be nicer, but an array of bits isn't possible */
+idata {type} a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 ,
+ a10, a11, a12, a13, a14, a15, a16, a17, a18, a19,
+ a20;
+idata unsigned {type} ua0, ua1, ua2, ua3, ua4, ua5, ua6;
+idata {type} b;
+idata volatile unsigned {type} ub = 0xbe;
+
+void
+testcse(void)
+{
+ b = 0xeb;
+ ub = 0xbe;
+ v = 0x33;
+ uv = 0xab;
+
+ a0 = 0 & b;
+ a1 = 0 & v;
+
+ a2 = MASK & b;
+ a3 = MASK & v;
+ ua0 = MASK & ub;
+ ua1 = MASK & uv;
+
+ a4 = b & b;
+ a5 = v & v;
+
+ a6 &= 0;
+ v &= 0;
+ a7 &= MASK;
+ v &= MASK;
+ ua2 &= MASK;
+ uv &= MASK;
+
+
+ a8 = 0 | b;
+ a9 = 0 | v;
+
+ a10 = MASK | b;
+ a11 = MASK | v;
+ ua3 = MASK | ub;
+ ua4 = MASK | uv;
+
+ a12 = b | b;
+ a13 = v | v;
+
+ a14 |= 0;
+ v |= 0;
+ a15 |= MASK;
+ v |= MASK;
+ ua5 |= MASK;
+ uv |= MASK;
+
+
+ a16 = 0 ^ b;
+ a17 = 0 ^ v;
+
+ a18 = b ^ b;
+ a19 = v ^ v;
+
+ a20 ^= 0;
+ v ^= 0;
+
+ ASSERT( a0 == 0);
+ ASSERT( a1 == 0);
+ ASSERT( a2 == b);
+#if defined(_bit)
+ ASSERT( a3 == 1);
+#else
+ ASSERT( a3 == ({type}) 0x33);
+#endif
+ ASSERT(ua0 == ub);
+#if defined(_bit)
+ ASSERT(ua1 == 1);
+#else
+ ASSERT(ua1 == ({type}) 0xab);
+#endif
+ ASSERT( a4 == b);
+#if defined(_bit)
+ ASSERT( a5 == 1);
+#else
+ ASSERT( a5 == ({type}) 0x33);
+#endif
+ ASSERT( a6 == 0);
+ // ASSERT( a7 == );
+ // ASSERT(ua2 == );
+ ASSERT( a8 == b);
+ ASSERT( a9 == 0);
+ ASSERT( a10 == ({type}) MASK);
+ ASSERT( a11 == ({type}) MASK);
+ ASSERT(ua3 == MASK);
+ ASSERT(ua4 == MASK);
+ ASSERT( a12 == b);
+ ASSERT( a13 == 0);
+ // ASSERT( a14 == );
+ ASSERT( a15 == ({type}) MASK);
+ ASSERT(ua5 == MASK);
+ ASSERT( a16 == b);
+ ASSERT( a17 == ({type}) MASK);
+ ASSERT( a18 == 0);
+ ASSERT( a19 == 0);
+ // ASSERT( a20 == );
+ ASSERT( v == ({type}) MASK);
+ ASSERT(uv == MASK);
+}