Subject: alpha target, i386 host problems
To: None <tech-toolchain@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-toolchain
Date: 05/12/2002 11:14:57
Folks,

I've been having a play around with using an alpha target for
cross-building using an i386 host.  I've found a simple test case:

	athlon 434> cat yyy.c
	void foo(void) { char bar[] = "a"; }
	athlon 435> /l/tools/bin/alpha--netbsd-gcc -O0 -c yyy.c -da
	yyy.c: In function `foo':
	yyy.c:1: internal error--unrecognizable insn:

	(insn 13 11 15 (set (reg:DI 77)
		(and:DI (plus:DI (reg:DI 70)
			(const_int 584778145450688512 [0x81d8ca000000000]))
		    (const_int -8 [0xfffffffffffffff8]))) -1 (nil)
	    (nil))

The first difference in the RTL dumps between an alpha hosted toolchain
and an i386 hosted toolchain is:

--- alpha/yyy.c.rtl     Sun May 12 10:04:37 2002
+++ i386/yyy.c.rtl      Sun May 12 10:04:47 2002
@@ -21,31 +21,40 @@
     (expr_list:REG_EQUAL (symbol_ref:DI ("*$LC0"))
         (nil)))
 
-(insn 13 11 15 (set (reg:DI 72)
-        (mem/s/u:DI (and:DI (reg:DI 70)
-                (const_int -8 [0xfffffffffffffff8])) 0)) -1 (nil)
+(insn 13 11 15 (set (reg:DI 77)
+        (and:DI (plus:DI (reg:DI 70)
+                (const_int 584778145450688512 [0x81d8ca000000000]))
+            (const_int -8 [0xfffffffffffffff8]))) -1 (nil)
     (nil))

On i386 the HOST_WIDE_INT type is long long, so perhaps something was
stored using the host integer XINT() macro and retreived using the
HOST_WIDE_INT XWINT() or INTVAL() macros.

Adding the "-mbwx" flags (which changes the behaviour of a lot of
alpha.md) allows this example (but not some others) to compile ok.

Unfortunately I have no gcc-internals clue to track this down any
further (other than by brute force).  I haven't bothered the gcc lists
since an alpha gcc target works on an i386 host, and I suspect they'll
have little interest in supporting 2.95.x issues.

Any ideas?

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/