From 64a184e92d716f16d8af20f246891859e93d6397 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Sat, 14 Mar 1992 05:34:29 +0000 Subject: [PATCH] *** empty log message *** From-SVN: r481 --- gcc/config/m68k/m68k.c | 173 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 161 insertions(+), 12 deletions(-) diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 20ffc410bc7..6c115adcc09 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -50,11 +50,11 @@ rtx legitimize_pic_address (); /* Emit a (use pic_offset_table_rtx) if we used PIC relocation in the function at any time during the compilation process. In the future - we should try and eliminate the USE if we can easily deterine that + we should try and eliminate the USE if we can easily determine that all PIC references were deleted from the current function. That would save an address register */ -finalize_pic() +finalize_pic () { if (flag_pic && current_function_uses_pic_offset_table) emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx)); @@ -190,7 +190,7 @@ output_function_prologue (stream, size) if (mask & (1 << i)) asm_fprintf (stream, #ifdef MOTOROLA - "\tmov.l %s,-(%Rsp)\n", + "\t%Omove.l %s,-(%Rsp)\n", #else "\tmovel %s,%Rsp@-\n", #endif @@ -207,7 +207,7 @@ output_function_prologue (stream, size) if (flag_pic && current_function_uses_pic_offset_table) { #ifdef MOTOROLA - asm_fprintf (stream, "\tmov.l %I__GLOBAL_OFFSET_TABLE_, %s\n", + asm_fprintf (stream, "\t%Omove.l %I__GLOBAL_OFFSET_TABLE_, %s\n", reg_names[PIC_OFFSET_TABLE_REGNUM]); asm_fprintf (stream, "\tlea.l (%Rpc,%s.l),%s\n", reg_names[PIC_OFFSET_TABLE_REGNUM], @@ -303,7 +303,7 @@ output_function_epilogue (stream, size) && (mask || fmask || fpoffset)) { #ifdef MOTOROLA - asm_fprintf (stream, "\tmov.l %0I%d,%Ra0\n", -fsize); + asm_fprintf (stream, "\t%Omove.l %0I%d,%Ra0\n", -fsize); #else asm_fprintf (stream, "\tmovel %0I%d,%Ra0\n", -fsize); #endif @@ -325,7 +325,7 @@ output_function_epilogue (stream, size) if (big) { #ifdef MOTOROLA - asm_fprintf (stream, "\tmov.l -%d(%s,%Ra0.l),%s\n", + asm_fprintf (stream, "\t%Omove.l -%d(%s,%Ra0.l),%s\n", offset + fsize, reg_names[FRAME_POINTER_REGNUM], reg_names[i]); @@ -338,7 +338,7 @@ output_function_epilogue (stream, size) else if (! frame_pointer_needed) { #ifdef MOTOROLA - asm_fprintf (stream, "\tmov.l (%Rsp)+,%s\n", + asm_fprintf (stream, "\t%Omove.l (%Rsp)+,%s\n", reg_names[i]); #else asm_fprintf (stream, "\tmovel %Rsp@+,%s\n", @@ -348,7 +348,7 @@ output_function_epilogue (stream, size) else { #ifdef MOTOROLA - asm_fprintf (stream, "\tmov.l -%d(%s),%s\n", + asm_fprintf (stream, "\t%Omove.l -%d(%s),%s\n", offset + fsize, reg_names[FRAME_POINTER_REGNUM], reg_names[i]); @@ -515,6 +515,155 @@ not_sp_operand (op, mode) return op != stack_pointer_rtx && general_operand (op, mode); } +/* Return TRUE if X is a valid comparison operator for the dbcc + instruction. + + Note it rejects floating point comparison operators. + (In the future we could use Fdbcc). + + It also rejects some comparisons when CC_NO_OVERFLOW is set. */ + +int +valid_dbcc_comparison_p (x, mode) + rtx x; + enum machine_mode mode; +{ + /* We could add support for these in the future */ + if (cc_prev_status.flags & CC_IN_68881) + return 0; + + switch (GET_CODE (x)) + { + + case EQ: case NE: case GTU: case LTU: + case GEU: case LEU: + return 1; + + /* Reject some when CC_NO_OVERFLOW is set. This may be over + conservative */ + case GT: case LT: case GE: case LE: + return ! (cc_prev_status.flags & CC_NO_OVERFLOW); + default: + return 0; + } +} + +/* Output a dbCC; jCC sequence. Note we do not handle the + floating point version of this sequence (Fdbcc). We also + do not handle alternative conditions when CC_NO_OVERFLOW is + set. It is assumed that valid_dbcc_comparison_p will kick + those out before we get here. */ + +output_dbcc_and_branch (operands) + rtx *operands; +{ + + switch (GET_CODE (operands[3])) + { + case EQ: +#ifdef MOTOROLA + output_asm_insn ("dbeq %0,%l1\n\tjbeq %l2", operands); +#else + output_asm_insn ("dbeq %0,%l1\n\tjeq %l2", operands); +#endif + break; + + case NE: +#ifdef MOTOROLA + output_asm_insn ("dbne %0,%l1\n\tjbne %l2", operands); +#else + output_asm_insn ("dbne %0,%l1\n\tjne %l2", operands); +#endif + break; + + case GT: +#ifdef MOTOROLA + output_asm_insn ("dbgt %0,%l1\n\tjbgt %l2", operands); +#else + output_asm_insn ("dbgt %0,%l1\n\tjgt %l2", operands); +#endif + break; + + case GTU: +#ifdef MOTOROLA + output_asm_insn ("dbhi %0,%l1\n\tjbhi %l2", operands); +#else + output_asm_insn ("dbhi %0,%l1\n\tjhi %l2", operands); +#endif + break; + + case LT: +#ifdef MOTOROLA + output_asm_insn ("dblt %0,%l1\n\tjblt %l2", operands); +#else + output_asm_insn ("dblt %0,%l1\n\tjlt %l2", operands); +#endif + break; + + case LTU: +#ifdef MOTOROLA + output_asm_insn ("dbcs %0,%l1\n\tjbcs %l2", operands); +#else + output_asm_insn ("dbcs %0,%l1\n\tjcs %l2", operands); +#endif + break; + + case GE: +#ifdef MOTOROLA + output_asm_insn ("dbge %0,%l1\n\tjbge %l2", operands); +#else + output_asm_insn ("dbge %0,%l1\n\tjge %l2", operands); +#endif + break; + + case GEU: +#ifdef MOTOROLA + output_asm_insn ("dbcc %0,%l1\n\tjbcc %l2", operands); +#else + output_asm_insn ("dbcc %0,%l1\n\tjcc %l2", operands); +#endif + break; + + case LE: +#ifdef MOTOROLA + output_asm_insn ("dble %0,%l1\n\tjble %l2", operands); +#else + output_asm_insn ("dble %0,%l1\n\tjle %l2", operands); +#endif + break; + + case LEU: +#ifdef MOTOROLA + output_asm_insn ("dbls %0,%l1\n\tjbls %l2", operands); +#else + output_asm_insn ("dbls %0,%l1\n\tjls %l2", operands); +#endif + break; + + default: + abort (); + } + + /* If the decrement is to be done in SImode, then we have + to compensate for the fact that dbcc decrements in HImode. */ + switch (GET_MODE (operands[0])) + { + case SImode: +#ifdef MOTOROLA + output_asm_insn ("clr%.w %0\n\tsubq%.l %#1,%0\n\tjbpl %l1", operands); +#else + output_asm_insn ("clr%.w %0\n\tsubq%.l %#1,%0\n\tjpl %l1", operands); +#endif + break; + + case HImode: + break; + + default: + abort (); + } +} + char * output_btst (operands, countop, dataop, insn, signpos) rtx *operands; @@ -697,7 +846,7 @@ singlemove_string (operands) && INTVAL (operands[1]) < 128 && INTVAL (operands[1]) >= -128) { -#if defined(MOTOROLA) && !defined(CRDS) +#if defined (MOTOROLA) && !defined (CRDS) return "moveq%.l %1,%0"; #else return "moveq %1,%0"; @@ -1018,7 +1167,7 @@ output_move_const_double (operands) rtx *operands; { #ifdef SUPPORT_SUN_FPA - if (TARGET_FPA && FPA_REG_P(operands[0])) + if (TARGET_FPA && FPA_REG_P (operands[0])) { int code = standard_sun_fpa_constant_p (operands[1]); @@ -1244,7 +1393,7 @@ standard_sun_fpa_constant_p (x) /* * Stuff that looks different if it's single or double */ - if (GET_MODE(x) == SFmode) + if (GET_MODE (x) == SFmode) { if (d == S_E) return 0x8; @@ -1452,7 +1601,7 @@ print_operand (file, op, letter) } #ifdef SUPPORT_SUN_FPA else if ((letter == 'y' || letter == 'w') - && GET_CODE(op) == CONST_DOUBLE + && GET_CODE (op) == CONST_DOUBLE && (i = standard_sun_fpa_constant_p (op))) { fprintf (file, "%%%d", i & 0x1ff); -- 2.30.2