+2004-08-30 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+
+ * src/hc08/gen.c (loadRegFromAop): better use of clra & clrx
+ * src/hc08/gen.c (genAnd, genOr): fixed bug with conditional when
+ multi-byte volatile operands are used
+ * src/hc08/gen.c (shiftRLong): fixed bug with wrong rotate direction
+ * src/hc08/main.c (_hc08_genAssemblerPreamble): moved the built-in
+ initialization to area GSINIT0 so that it would always precede
+ any static initializers in GSINIT
+ * support/regression/tests/zeropad.c: fixed idata define for hc08
+ * support/regression/tests/bug-927659.c,
+ * support/regression/tests/float_trans.c: disabled tests for hc08
+ pending missing library routines
+ * .version: increased version number to 2.4.4 - hc08 port now passes
+ regression tests
+
+
2004-08-29 Bernhard Held <bernhard AT bernhardheld.de>
* device/lib/pic16/Makefile.common.in: added $(MM) to fix `make clean`
}
forceload:
-
+
switch (regidx)
{
case A_IDX:
emitcode ("clra", ""); /* TODO: handle sign extension */
}
else
- emitcode ("lda","%s", aopAdrStr (aop, loffset, FALSE));
+ {
+ char * l = aopAdrStr (aop, loffset, FALSE);
+ if (!strcmp (l, zero))
+ emitcode ("clra", "");
+ else
+ emitcode ("lda", "%s", l);
+ }
break;
case X_IDX:
if (aop->type == AOP_REG)
emitcode ("clrx", ""); /* TODO: handle sign extension */
}
else
- emitcode ("ldx","%s", aopAdrStr (aop, loffset, FALSE));
+ {
+ char * l = aopAdrStr (aop, loffset, FALSE);
+ if (!strcmp (l, zero))
+ emitcode ("clrx", "");
+ else
+ emitcode ("ldx", "%s", l);
+ }
break;
case H_IDX:
if (hc08_reg_a->isFree)
if (AOP_TYPE (right) == AOP_LIT)
lit = (unsigned long) floatFromVal (AOP (right)->aopu.aop_lit);
+ size = (AOP_SIZE (left) >= AOP_SIZE (right)) ? AOP_SIZE (left) : AOP_SIZE (right);
+
+ if (AOP_TYPE (result) == AOP_CRY
+ && size > 1
+ && (isOperandVolatile (left, FALSE) || isOperandVolatile (right, FALSE)))
+ {
+ /* this generates ugly code, but meets volatility requirements */
+ loadRegFromConst (hc08_reg_a, zero);
+ pushReg (hc08_reg_a, TRUE);
+
+ offset = 0;
+ while (size--)
+ {
+ loadRegFromAop (hc08_reg_a, AOP (left), offset);
+ accopWithAop ("and", AOP (right), offset);
+ emitcode ("ora", "1,s");
+ emitcode ("sta", "1,s");
+ offset++;
+ }
+
+ pullReg (hc08_reg_a);
+ emitcode ("tsta", "");
+ genIfxJump (ifx, "a");
+ goto release;
+ }
+
if (AOP_TYPE (result) == AOP_CRY)
{
symbol *tlbl = NULL;
wassertl (ifx, "AOP_CRY result without ifx");
- size = (AOP_SIZE (left) >= AOP_SIZE (right)) ? AOP_SIZE (left) : AOP_SIZE (right);
offset = 0;
while (size--)
{
if (AOP_TYPE (right) == AOP_LIT && bytemask == 0)
{
- if (isOperandVolatile (left, FALSE))
- {
- loadRegFromAop (hc08_reg_a, AOP (left), offset);
- hc08_freeReg( hc08_reg_a);
- }
+ /* do nothing */
}
else if (AOP_TYPE (right) == AOP_LIT && bytemask == 0xff)
{
if (tlbl)
emitLabel (tlbl);
genIfxJump (ifx, "a");
+ goto release;
}
size = AOP_SIZE (result);
if (AOP_TYPE (right) == AOP_LIT)
lit = (unsigned long) floatFromVal (AOP (right)->aopu.aop_lit);
+ size = (AOP_SIZE (left) >= AOP_SIZE (right)) ? AOP_SIZE (left) : AOP_SIZE (right);
+
+ if (AOP_TYPE (result) == AOP_CRY
+ && size > 1
+ && (isOperandVolatile (left, FALSE) || isOperandVolatile (right, FALSE)))
+ {
+ /* this generates ugly code, but meets volatility requirements */
+ loadRegFromConst (hc08_reg_a, zero);
+ pushReg (hc08_reg_a, TRUE);
+
+ offset = 0;
+ while (size--)
+ {
+ loadRegFromAop (hc08_reg_a, AOP (left), offset);
+ accopWithAop ("ora", AOP (right), offset);
+ emitcode ("ora", "1,s");
+ emitcode ("sta", "1,s");
+ offset++;
+ }
+
+ pullReg (hc08_reg_a);
+ emitcode ("tsta", "");
+ genIfxJump (ifx, "a");
+ goto release;
+ }
+
if (AOP_TYPE (result) == AOP_CRY)
{
symbol *tlbl = NULL;
wassertl (ifx, "AOP_CRY result without ifx");
- size = (AOP_SIZE (left) >= AOP_SIZE (right)) ? AOP_SIZE (left) : AOP_SIZE (right);
offset = 0;
while (size--)
{
;
}
- /* asrx/rola is only 2 cycles and bytes, so an unrolled loop is often */
+ /* asrx/rora is only 2 cycles and bytes, so an unrolled loop is often */
/* the fastest and shortest. */
for (i=0;i<shCount;i++)
{
rmwWithReg ("asr", hc08_reg_x);
else
rmwWithReg ("lsr", hc08_reg_x);
- rmwWithReg ("rol", hc08_reg_a);
+ rmwWithReg ("ror", hc08_reg_a);
storeRegToAop (hc08_reg_xa, AOP (result), MSB24);
}
else if (offl==MSB16)
mainExists->block=0;
fprintf (of, "\t.area %s\n",port->mem.code_name);
+ fprintf (of, "\t.area GSINIT0 (CODE)\n");
fprintf (of, "\t.area %s\n",port->mem.static_name);
fprintf (of, "\t.area %s\n",port->mem.post_static_name);
fprintf (of, "\t.area %s\n",port->mem.xinit_name);
fprintf (of, "\t.org\t0xfffe\n");
fprintf (of, "\t.dw\t%s", "__sdcc_gs_init_startup\n\n");
- fprintf (of, "\t.area GSINIT\n");
+ fprintf (of, "\t.area GSINIT0\n");
fprintf (of, "__sdcc_gs_init_startup:\n");
if (options.stack_loc)
{