[gnu.gcc.bug] gcc-1.35/i386gas/COFF-ENCAP FP bug

wgb@tntdev.tnt.com (William G. Bunton) (05/23/89)

I believe I've found the problem with floating point
subtraction/division. Appearently, most 386 compilers generate
incorrect code for the 'reversed' forms of fsub and fdiv. A comment in
config/out-i386.c notes this fact, and uses the 'unreversed' forms
instead. This is a problem when using GAS, since GAS gets it right. To
correct, copy config/out-i386.c to config/out-i386g.c, run the
following through patch, and the run config.gcc again. This creates
out-i386g.c using the proper reversed insn, which seems to cure the
problem, and not break anything else.

*** config.gcc~	Fri May 19 18:36:15 1989
--- config.gcc	Mon May 22 17:24:30 1989
***************
*** 81,86 ****
--- 81,87 ----
  		cpu_type=i386
  		configuration_file=xm-i386v.h
  		target_machine=tm-i386gas.h
+ 		aux_output=out-i386g.c
  		;;		
  	next )
  		cpu_type=m68k
*** config/out-i386g.c~	Mon May 22 17:21:29 1989
--- config/out-i386g.c	Mon May 22 17:22:53 1989
***************
*** 142,148 ****
  	 which exchanges the meanings of fsubr and fsub, and of fdivr and fdiv!
  	 So use the "unreversed" opcode (which will assemble into
  	 the "reversed" insn).  */
!       rev = op;
  
        while (*rev && *rev != '%')
  	fputc (*rev++, asm_out_file);
--- 142,150 ----
  	 which exchanges the meanings of fsubr and fsub, and of fdivr and fdiv!
  	 So use the "unreversed" opcode (which will assemble into
  	 the "reversed" insn).  */
!       /* This only appears true of AT&T assemblers; at least gas1.31 seems
! 	 to get it right, so we'll use the reversed opcode correctly */
! /*      rev = op; */
  
        while (*rev && *rev != '%')
  	fputc (*rev++, asm_out_file);

Bill
--
William G. Bunton            wgb@tntdev.tnt.com     {uunet,natinst}!tntdev!wgb
Tools & Techniques, Inc. Austin, TX