[MLton] power pc "port"

Stephen Weeks MLton@mlton.org
Tue, 7 Sep 2004 16:29:27 -0700


> I'm curious what the problem was with -O2 for the C compiles on
> Cygwin that caused you (Stephen) to go to -O1.  Just nervous.

Nothing that we haven't seen before with gcc -O2.  The newer gcc's
(3.3 IIRC) complain about us not following strict aliasing or
something like that.  The kind of code that causes problems is like
this bit in Real/class.c

------------------------------------------------------------
Int Real64_class (Real64 d) {
	Word word0, word1;
	Int res;

	word0 = ((Word *)&d)[0];
	word1 = ((Word *)&d)[1];
------------------------------------------------------------

or this bit in Real/gdtoa.c

------------------------------------------------------------
/* This code is patterned on g_dfmt from the gdtoa sources. */
char * Real64_gdtoa (double d, int mode, int ndig, int *decpt) {
	ULong bits[2];
	int ex;
	static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, 0 };
	int i;
	ULong *L;
	char *result;
	ULong sign;

	L = (ULong*)&d;
	sign = L[_0] & 0x80000000L;
	bits[0] = L[_1];
	bits[1] = L[_0] & 0xfffff;
------------------------------------------------------------

Basically, anywhere we treat doubels as chunks of two words.