[gnu.gcc.bug] suspected buglet in m68k.md

tpm%digsys.engineering.cambridge.ac.uk@NSS.CS.UCL.AC.UK (tim marsland) (01/31/89)

whilst trying to make a motorola syntax version of GCC, i came across what
looks to me like a small buglet in the 68000 machine description.  when
compiling `exit (0),' the compiler emits a `clrl -(sp)' instruction.

if the following patch is applied, the correct result `clr.l -(sp)' is
produced by the Motorola syntax version, and should, from my understanding
of the back end of GCC, produce the correct MIT syntax too.

tim marsland.
cambridge university engineering dept.
---------------------------- script follows ------------------------------
Script started on Mon Jan 30 20:59:11 1989
% cat /etc/motd
SunOS Release 4.0_Export (PSF) #12: Fri Jan 13 13:29:52 GMT 1989
% gcc -v
gcc version 1.32
% diff -c7 m68k.md ../gcc-1.32
*** m68k.md     Sun Jan 29 21:25:44 1989
--- ../gcc-1.32/m68k.md Mon Jan 16 18:30:08 1989
***************
*** 675,689 ****
	(match_operand:SI 1 "general_operand" "J"))]
    "GET_CODE (operands[1]) == CONST_INT
     && INTVAL (operands[1]) >= -0x8000
     && INTVAL (operands[1]) < 0x8000"
    "*
  {
    if (operands[1] == const0_rtx)
!     return \"clr%.l %0\";
    return \"pea %a1\";
  }")

  ;This is never used.
  ;(define_insn "swapsi"
  ;  [(set (match_operand:SI 0 "general_operand" "r")
  ;     (match_operand:SI 1 "general_operand" "r"))
--- 675,689 ----
	(match_operand:SI 1 "general_operand" "J"))]
    "GET_CODE (operands[1]) == CONST_INT
     && INTVAL (operands[1]) >= -0x8000
     && INTVAL (operands[1]) < 0x8000"
    "*
  {
    if (operands[1] == const0_rtx)
!     return \"clrl %0\";
    return \"pea %a1\";
  }")

  ;This is never used.
  ;(define_insn "swapsi"
  ;  [(set (match_operand:SI 0 "general_operand" "r")
  ;     (match_operand:SI 1 "general_operand" "r"))
% exit
psf: 
script done on Mon Jan 30 21:00:48 1989