c/5119: Constraing specified for vector jump is illegal for mcf5200

pbarada@mail.wm.sps.mot.com pbarada@mail.wm.sps.mot.com
Fri Dec 14 10:47:00 GMT 2001


>Number:         5119
>Category:       c
>Synopsis:       Constraing specified for vector jump is illegal for mcf5200
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 14 10:16:02 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Peter Barada
>Release:        3.0.3 20011213 (prerelease)
>Organization:
>Environment:
System: Linux hyper.wm.sps.mot.com 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: m68k-unknown-elf
configured with: /home/pbarada/work/cvs-wavemark/cross-linux-tools/gcc-3.0.3-20011213/configure --target=m68k-elf --prefix=/tmp/crap5 --enable-languages=c --with-local-prefix=/tmp/crap5/m68k-elf --without-headers --with-newlib --disable-shared
>Description:
	the instruction pattern starting at line 6503 of
gcc/config/m68k/m68k.md is:

;; Jump to variable address from dispatch table of relative addresses.
(define_insn ""
  [(set (pc)
	(plus:SI (pc)
		 (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
   (use (label_ref (match_operand 1 "" "")))]
  ""

For m68k, the constraint of "r" is valid since the ext.l instruction
is valid for both address and data registers, but on the 5200(and all
coldfires) ext.l is valid for only data registers. and is then
rejected by the assembler as an illegal operand.

>How-To-Repeat:
Compile the following with -O3 -m5200:

extern int ShowDebug;
extern void PPTrace (char *);
extern void foo(char *, const char *, unsigned int);

unsigned char Par_negchange(unsigned char NewMode)
{
  unsigned int pcsr_mode;

  pcsr_mode = (((volatile unsigned char *)0xA8010000)[0x03<<2] >> 4);

  if (ShowDebug) {
    char temp[24];
    foo(temp, "Mode %01x\n",pcsr_mode);
    PPTrace(temp);
  }

  switch (pcsr_mode) {
  case 0:
  case 1:
  case 2:
    NewMode = 0;
    break;
  case 4:
    if (NewMode == 5) {
      NewMode = 6;
    } else {
      NewMode = 255;
    }
    break;
  case 5:
    NewMode = 1;
    break;
  case 6:
    NewMode = 2;
    break;
  case 7:
    NewMode = 3;
    break;
  case 8:
    NewMode = 4;
    break;
  case 12:
    NewMode = 5;
    break;
  default:
    NewMode = 255;
    break;
  }

  return (NewMode);
}

>Fix:
	Change the constraint from "r" to "d":

;; Jump to variable address from dispatch table of relative addresses.
(define_insn ""
  [(set (pc)
	(plus:SI (pc)
		 (sign_extend:SI (match_operand:HI 0 "register_operand" "d"))))
   (use (label_ref (match_operand 1 "" "")))]
  ""
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list