This is the mail archive of the gcc@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: i386 string patterns vs global registers


On 12-Feb-2003, Michael Matz <matz@suse.de> wrote:
> Are you sure that current GCC works with only three registers?  We would
> be left with %eax, %edx and %ecx (at least two of them are besides each
> other).  With this constrained set we have a hard time implementing long
> long arithmetics (it's possible, but I wouldn't bet on it right now).

Well, my very naive attempt to break it by trying out a few random
`long long' operations (see below) compiled fine.

	void *alloca(unsigned int);
	register int r1 asm("ebx");
	register int r2 asm("esi");
	register int r3 asm("edi");
	long long foo1(long long x, long long y, long long z, void *p) {
		long long r;
		r = x + y;
		r += x * y;
		r += x / y;
		r += x - y;
		r += x << y;
		r *= 2;
		r *= z;
		z = x / r;
		return z * (x + foo1(x, y, z, alloca(z)) / z
			- 12345678901234LL);
	}

Also, we use `long long' in the Mercury implementation, and it works ok.
But our use of `long long' is very simple -- the only operations we use
are addition and conversion to `double' -- so this is not a good test either.

I guess a real test would be to try bootstrapping gcc with
`-ffixed-ebx -ffixed-esi -ffixed-edi'.  Or do the same with
some other software that makes significant use of `long long'.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


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