--- gcc/config/m68k/m68k.md 2018/04/24 18:27:54 1.1.1.4 +++ gcc/config/m68k/m68k.md 2018/04/24 18:43:56 1.1.1.5 @@ -5199,10 +5199,21 @@ return \"move%.l %0,%2\;or%.l %3,%2\;jeq %l1\"; #endif operands[4] = gen_label_rtx(); + if (TARGET_68020) #ifdef MOTOROLA - output_asm_insn (\"tst%.l %0\;jbne %l4\;tst%.l %3\;jbeq %l1\", operands); + output_asm_insn (\"tst%.l %0\;jbne %l4\;tst%.l %3\;jbeq %l1\", operands); #else - output_asm_insn (\"tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1\", operands); + output_asm_insn (\"tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1\", operands); +#endif + else +#ifdef MOTOROLA +#ifdef SGS_CMP_ORDER + output_asm_insn (\"cmp%.w %0,%#0\;jbne %l4\;cmp%.w %3,%#0\;jbeq %l1\", operands); +#else + output_asm_insn (\"cmp%.w %#0,%0\;jbne %l4\;cmp%.w %#0,%3\;jbeq %l1\", operands); +#endif +#else + output_asm_insn (\"cmp%.w %#0,%0\;jne %l4\;cmp%.w %#0,%3\;jeq %l1\", operands); #endif ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\", CODE_LABEL_NUMBER (operands[4])); @@ -5215,15 +5226,22 @@ (const_int 0)) (label_ref (match_operand 1 "" ",")) (pc))) - (clobber (match_scratch:SI 2 "=d,"))] + (clobber (match_scratch:SI 2 "=d,X"))] "" "* { + CC_STATUS_INIT; if (GET_CODE (operands[0]) == REG) operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1); else operands[3] = adj_offsettable_operand (operands[0], 4); - if (ADDRESS_REG_P (operands[0])) + if (!ADDRESS_REG_P (operands[0])) +#ifdef MOTOROLA + return \"move%.l %0,%2\;or%.l %3,%2\;jbne %l1\"; +#else + return \"move%.l %0,%2\;or%.l %3,%2\;jne %l1\"; +#endif + if (TARGET_68020) #ifdef MOTOROLA return \"tst%.l %0\;jbne %l1\;tst%.l %3\;jbne %l1\"; #else @@ -5231,9 +5249,13 @@ #endif else #ifdef MOTOROLA - return \"move%.l %0,%2\;or%.l %3,%2\;jbne %l1\"; +#ifdef SGS_CMP_ORDER + return \"cmp%.w %0,%#0\;jbne %l1\;cmp%.w %3,%#0\;jbne %l1\"; #else - return \"move%.l %0,%2\;or%.l %3,%2\;jne %l1\"; + return \"cmp%.w %#0,%0\;jbne %l1\;cmp%.w %#0,%3\;jbne %l1\"; +#endif +#else + return \"cmp%.w %#0,%0\;jne %l1\;cmp%.w %#0,%3\;jne %l1\"; #endif } ") @@ -5246,10 +5268,21 @@ "" "* { + CC_STATUS_INIT; + if (TARGET_68020 || ! ADDRESS_REG_P (operands[0])) + output_asm_insn(\"tst%.l %0\", operands); + else + /* On an address reg, cmpw may replace cmpl. */ +#ifdef SGS_CMP_ORDER + output_asm_insn(\"cmp%.w %0,%#0\", operands); +#else + output_asm_insn(\"cmp%.w %#0,%0\", operands); +#endif + #ifdef MOTOROLA - return \"tst%.l %0\;jbge %l1\"; + return \"jbpl %l1\"; #else - return \"tst%.l %0\;jge %l1\"; + return \"jpl %l1\"; #endif } ") @@ -5262,10 +5295,21 @@ "" "* { + CC_STATUS_INIT; + if (TARGET_68020 || ! ADDRESS_REG_P (operands[0])) + output_asm_insn(\"tst%.l %0\", operands); + else + /* On an address reg, cmpw may replace cmpl. */ +#ifdef SGS_CMP_ORDER + output_asm_insn(\"cmp%.w %0,%#0\", operands); +#else + output_asm_insn(\"cmp%.w %#0,%0\", operands); +#endif + #ifdef MOTOROLA - return \"tst%.l %0\;jbmi %l1\"; + return \"jbmi %l1\"; #else - return \"tst%.l %0\;jmi %l1\"; + return \"jmi %l1\"; #endif } ")