I misread of a print typo in the 040 manual
caused a number of bad and totally wrong Peephole optimizations in GCC
Fact the best and fastest way to clear an Addres register on any 68K is always SUBA.L An,An.
Therefore the compiler shouöld never use "LEA $0,An" for clearing a register - always SUBA.L An,An
Yes in some 68040 manuals was misprint - saying SUBA would need 2 cycle - but this is a known misprint.
Affected Files:
file : m68k/m68k.md
if (operands[1] == CONST0_RTX (SFmode)
/* clr insns on 68000 read before writing. */
&& ((TARGET_68010 || TARGET_COLDFIRE)
|| !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
{
if (ADDRESS_REG_P (operands[0]))
{
**/* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
if (TUNE_68040_80)
return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
else**
return "sub%.l %0,%0";
}
/* moveq is faster on the 68000. */
if (DATA_REG_P (operands[0]) && TUNE_68000_10)
return "moveq #0,%0";
return "clr%.l %0";
}
return "move%.l %1,%0";
})
another location
**** This instruction definition is wrong!!!
;; Special case of fullword move when source is zero for 68040_60.
;; On the '040, 'subl an,an' takes 2 clocks while lea takes only 1
(define_insn "*movsi_const0_68040_60"
[(set (match_operand:SI 0 "movsi_const0_operand" "=a,g")
(const_int 0))]
"TUNE_68040_80"
{
if (which_alternative == 0)
return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
else if (which_alternative == 1)
return "clr%.l %0";
else
{
gcc_unreachable ();
return "";
}
}
*** Please be so kind are fix and delete all the false peephole pessimizations
I misread of a print typo in the 040 manual caused a number of bad and totally wrong Peephole optimizations in GCC
Fact the best and fastest way to clear an Addres register on any 68K is always SUBA.L An,An.
Therefore the compiler shouöld never use "LEA $0,An" for clearing a register - always SUBA.L An,An
Yes in some 68040 manuals was misprint - saying SUBA would need 2 cycle - but this is a known misprint.
Affected Files: file : m68k/m68k.md
another location
**** This instruction definition is wrong!!!
*** Please be so kind are fix and delete all the false peephole pessimizations