a bug in EGCS M68060 support

Aki M Laukkanen amlaukka@cs.Helsinki.FI
Wed Dec 17 01:02:00 GMT 1997


There still seems to be unsupported instructions generated by egcs
(971215 snapshot) when generating code with the -m68060 option.

unsigned a(unsigned b, unsigned c)
{
	return b % c;
}

results into:

[508] $/usr/local/egcs/bin/gcc -O2 -m68060 -c a.c
Wed Dec 17 10:46:31 stellar amlaukka /tmp
[509] $objdump --disassemble a.o

a.o:     file format elf32-m68k

Disassembly of section .text:

00000000 <a>:
   0:   4e56 0000       linkw %fp,#0
   4:   222e 0008       movel %fp@(8),%d1
   8:   4c6e 1000 000c  divull %fp@(12),%d0,%d1
   e:   4e5e            unlk %fp
  10:   4e75            rts

Then I checked m68k.md and it talks about the -m68060 support and even
mentions this particular opcode. However by searching with divul%.l
I found a couple of remainder operations which haven't been fixed.

--- egcs-971215/gcc/config/m68k/m68k.md.orig    Sun Nov  2 16:18:40 1997
+++ egcs-971215/gcc/config/m68k/m68k.md Sun Jan  1 00:13:12 1978
@@ -3402,7 +3402,7 @@
                (match_operand:SI 2 "general_operand" "dmsK")))
    (set (match_operand:SI 3 "general_operand" "=d")
        (mod:SI (match_dup 1) (match_dup 2)))]
-  "TARGET_68020 && !TARGET_5200"
+  "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
   "*
 {
   if (find_reg_note (insn, REG_UNUSED, operands[3]))
@@ -3417,7 +3417,7 @@
                 (match_operand:SI 2 "general_operand" "dmsK")))
    (set (match_operand:SI 3 "general_operand" "=d")
        (umod:SI (match_dup 1) (match_dup 2)))]
-  "TARGET_68020 && !TARGET_5200"
+  "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
   "*
 {
   if (find_reg_note (insn, REG_UNUSED, operands[3]))

I'm not sure if that fixes it all. Can these div*l.l be used in ordinary
divisions somehow? Moreso it's a particularly bad fix because m68060
can execute the div*.l instructions which are emitted if the condition
find_reg_note (insn, REG_UNUSED, operands[3])) holds true. I don't have
any idea what that means or how you should fix it. (I'm just trying to
grasp the basics of RTL and machine definitions).

In future I'd like to enhance the m68060 support with haifa. Any
DIY guide for that?-)
z
-- 
D.



More information about the Gcc-bugs mailing list