🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1755

(none)

#1755
From: Kent Hauser
Date: Thu, 06 Oct 1988 13:43
116 lines
3643 bytes
Subject: rtx gen bugs (for library calls)

Attached is a short typescript which highlights a few problems.
First the printout of the"expression list" which should show the "REG_EQUAL"
is all screwed up & I don't know if it's the generation or printing
that's at fault.

Second, the redundant load "movl d0,d0" is supposed to be caught in
"final.c" by this code:

	    /* Check for redundant move insns moving a reg into itself.
	       This takes little time and does not affect the semantics
	       so we do it even when `optimize' is 0.
	       It is not safe to do this for memory references;
	       we would not know if they were volatile.  */
	    if (GET_CODE (body) == SET
		&& SET_DEST (body) == SET_SRC (body)
		&& GET_CODE (SET_DEST (body)) == REG)
	      break;

It fails because "SET_DEST(body)" differs by 8 bytes from 
"SET_SRC(body)" [I forget which was higher].  I don't know if 
it is a gen_rtx bug for creating two (reg:SF 0) objects 
or a logic error in "final.c"

Environment:
Sun 3/60, SunOS 3.5, unmodified sources.

Script started on Thu Oct  6 09:24:43 1988
tfd{kent}42% cat rtxbug.c
/* rtxbug.c */
float f1,f2, fn();

test () { f1 *= f2; f2 = fn();}

tfd{kent}43% gcc -S -v -msoft-float -drJ rtxbug.c
gcc version 1.28
 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -Dmc68020 rtxbug.c /tmp/cca08698.cpp
GNU CPP version 1.28
 /usr/local/lib/gcc-cc1 /tmp/cca08698.cpp -quiet -dumpbase rtxbug.c -drJ -msoft-float -version -o rtxbug.s
GNU C version 1.28 (68k, MIT syntax) compiled by GNU C version 1.28.
tfd{kent}44% cat rtxbug.s
#NO_APP
.text
	.even
.globl _test
_test:
	link a6,#0
	movel #__mulsf3,d0	<==== why load address
	movel _f2,sp@-
	movel _f1,sp@-
	jbsr __mulsf3		<==== why not call thru register
	addqw #8,sp
	movel d0,d0		<==== redundant load
	movel d0,_f1
	jbsr _fn
	movel d0,_f2
L1:
	unlk a6
	rts
.comm _f2,4
.comm _f1,4
tfd{kent}45% cat rtxbug.c.jump2

;; Function test

(note 1 0 2 "" -1)

(note 2 1 3 "" -1)

(insn 3 2 4 (set (reg:SI 0)
       (symbol_ref:SI ("_mulsf3"))) 33 (nil)
   (nil))

(insn 4 3 5 (set (mem:SF (pre_dec:SI (reg:SI 15)))
       (mem:SF (symbol_ref:SI ("f2")))) 38 (nil)
   (nil))

(insn 5 4 6 (set (mem:SF (pre_dec:SI (reg:SI 15)))
       (mem:SF (symbol_ref:SI ("f1")))) 38 (nil)
   (nil))

(call_insn 6 5 7 (set (reg:SF 0)
       (call (mem:QI (symbol_ref:SI ("_mulsf3")))
           (const_int 8))) 246 (nil)
   (nil))

(insn 7 6 8 (set (reg:SI 15)
       (plus:SI (reg:SI 15)
           (const_int 8))) 81 (nil)
   (nil))

(insn 8 7 9 (set (reg:SF 0)		;;;; expression list should be
       (reg:SF 0)) 38 (nil)		;;;; a "REG_EQUAL" type
   (expr_list:TI (mult:SF (mem:SF (symbol_ref:SI ("f1")))
           (mem:SF (symbol_ref:SI ("f2"))))
       (insn_list:QF 4 (nil))))

(insn 9 8 10 (set (mem:SF (symbol_ref:SI ("f1")))
       (reg:SF 0)) 38 (nil)
   (nil))

(call_insn 10 9 11 (set (reg:SF 0)
       (call (mem:QI (symbol_ref:SI ("fn")))
           (const_int 0))) 246 (nil)
   (nil))

(insn 11 10 12 (set (mem:SF (symbol_ref:SI ("f2")))
       (reg:SF 0)) 38 (nil)
   (nil))

(note 12 11 13 "" -6)

(code_label 13 12 0 1)
tfd{kent}46% exit
script done on Thu Oct  6 09:26:14 1988
Technical Details
Message-ID: <8810061343.AA08717@tfd.uucp>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!SUN.COM!sundc!tfd!kent

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!SUN.COM!sundc!tfd!kent
From: sundc!tfd!kent@SUN.COM (Kent Hauser)
Newsgroups: gnu.gcc.bug
Subject: (none)
Message-ID: <8810061343.AA08717@tfd.uucp>
Date: 6 Oct 88 13:43:52 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 116