This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Rewrite assemble_real to remove ASM_OUTPUT macros


On Tue, Dec 18, 2001 at 10:38:33AM -0800, Stuart Hastings wrote:
> I believe I have preserved the previous semantics for the 1750a, but
> I haven't been ambitious enough to build a cross-compiler and prove
> that it still works.

It didn't.  Nor did you get HFmode correct for C4X.

> I would prefer that a 1750a expert test this, or better yet, rewrite
> it to remove ASM_OUTPUT_THREE_QUARTER_FLOAT, if possible.

An "I'm feeling lucky" google search found the text of mil-std-1750a,
which contains a description of the floating point formats.  I've
implemented REAL_VALUE_TO_TARGET_SINGLE and REAL_VALUE_TO_TARGET_DOUBLE
to correspond to HFmode and TQFmode respectively.

Ideally one should implement the real.c routines to handle this, but
I didn't feel quite that ambitious.  As it is, some of the corner cases
come out wrong because, e.g. 0.5 * 2^-128 is representable in 1750a
single precision, but not in ieee single precision, which is how we
end up representing "float" inside the compiler when REAL_ARITHMETIC
is not defined.

> !       assemble_integer (x, GET_MODE_SIZE (mode), GET_MODE_ALIGNMENT 
> (mode), 1);

One, your mailer is wrapping lines.  Use mime precautions to prevent
this from happening -- your patch is useless like this.

Two, using GET_MODE_ALIGNMENT is incorrect.  That is the preferred
alignment; the _actual_ alignment is given by the "align" argument,
which is how we got into this mess in the first place.

I've applied the following patch, which is I suppose, overkill to
actually solve the problem (we could have fallen back to integer
only for the unaligned case), but since REAL_VALUE_TO_x are used
in gen_lowpart_common and constant_subword to extract parts of
fp values, if these routines don't work we've got other problems.

Also, it's hard to pass up an opportunity to replace 1981 lines
with 153 lines.  ;-)


r~


	* varasm.c (assemble_real): Use REAL_VALUE_TO_x and assemble_integer
	to emit floating point values.
	(assemble_real_1): Remove.

	* 1750a/1750a.c (real_value_to_target_single): New.
	(real_value_to_target_double): New.
	* 1750a/1750a.h (TARGET_FLOAT_FORMAT): New.
	(REAL_VALUE_TO_TARGET_SINGLE): New.
	(REAL_VALUE_TO_TARGET_DOUBLE): New.
	* 1750a/1750a-protos.h: Update.

	* 1750a/1750a.h, a29k/a29k.h, alpha/alpha.h, alpha/unicosmk.h,
	alpha/vms.h, arc/arc.h, arm/aof.h, arm/aout.h, avr/avr.c, 
	avr/avr.h, c4x/c4x.h, clipper/clix.h, convex/convex.h, cris/cris.h,
	d30v/d30v.h, dsp16xx/dsp16xx.c, dsp16xx/dsp16xx.h, elxsi/elxsi.h,
	fr30/fr30.h, h8300/h8300.h, i370/i370.h, i386/i386.h, i386/i386elf.h,
	i386/next.h, i386/ptx4-i.h, i386/sysv4.h, i860/fx2800.h, i860/i860.h,
	i860/paragon.h, i860/sysv4.h, i960/i960-protos.h, i960/i960.c,
	i960/i960.h, ia64/ia64.h, m32r/m32r.h, m68hc11/m68hc11.c, 
	m68hc11/m68hc11.h, m68k/3b1.h, m68k/altos3068.h, m68k/crds.h,
	m68k/dpx2.h, m68k/hp320.h, m68k/m68k.h, m68k/mot3300.h, m68k/news.h,
	m68k/next.h, m68k/next21.h, m68k/sgs.h, m68k/sun2o4.h, m68k/sun3.h,
	m68k/tower-as.h, m88k/m88k.h, mcore/mcore.h, mips/mips-protos.h,
	mips/mips.c, mips/mips.h, mmix/mmix-protos.h, mmix/mmix.c,
	mmix/mmix.h, mn10200/mn10200.h, mn10300/mn10300.h, ns32k/encore.h,
	ns32k/ns32k.h, pa/long_double.h, pa/pa.h, pdp11/pdp11.h, pj/pj.h,
	romp/romp.c, romp/romp.h, rs6000/rs6000.h, s390/linux.h, sh/sh.h,
	sparc/sparc.h, stormy16/stormy16.h, v850/v850.h, vax/vax.h,
	vax/vaxv.h, we32k/we32k.h, doc/tm.texi: Remove ASM_OUTPUT_FLOAT,
	ASM_OUTPUT_DOUBLE, ASM_OUTPUT_LONG_DOUBLE, ASM_OUTPUT_BYTE_FLOAT,
	ASM_OUTPUT_SHORT_FLOAT, ASM_OUTPUT_THREE_QUARTER_FLOAT, and all
	associated support routines.

Attachment: d-out-float.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]