Trying to work around a 16-bit x86 weirdness

Bernd Jendrissek berndfoobar@users.sourceforge.net
Thu Oct 23 12:45:00 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Oct 21, 2003 at 09:46:50AM -0700, Richard Henderson wrote:
> On Tue, Oct 21, 2003 at 05:24:08PM +0200, Bernd Jendrissek wrote:
> > Should I add a pattern for
> > (set (match_operand:HI 0) (match_operand:DI 1)) just so I can catch
> > these large CONST_INT's?
> 
> No, you should figure out where this thing is created.  It may
> need to use trunc_int_for_mode.  On the other hand, ...

I'm getting old.  All of 033 years.  Or 63 years, base 4.  Not
surprisingly, *I* create 42000, in my definition of
INITIAL_ELIMINATION_OFFSET.

Aargh, I should've realised it sooner that the '42' connection is a sort
of flag for me to grep my source.  I've now changed the magic number to
4200, so that at least it passes general_operand; I'll figure out what
the proper value should be as soon as I look at some generated code.

[A little while later:]  Ah, looks much better now.  I get:

g:
        pushw   %bp
        movw    %sp,%bp
        movw    $4200,%bx
        addw    %bp,%bx
        movw    $42,(%bx)
        movw    $17,2(%bx)
        call    (%P)
f
        pop     %bp
        ret

So it's just references to foo(%sp) being eliminated in favour of
offset(%bp).  Just gotta figure out why it doesn't use foo(%bp) directly
instead.

> > > void g(void)
> > > {
> > > 	f(42, 17);
> > > }
> [...]
> > > g:
> > > 	pushw	%bp
> > > 	movw	%sp,%bp
> > > 	movw	Don't know how to print
> > > (plus:HI (reg/f:HI bp)
> > >           (const_int 42000 [0xa410]))
> 
> ... this looks actively wrong.  Like maybe you've got an
> uninitialized data read somewhere.

Or a screw loose.

> You'll just have to track it down.  You might try using
> valgrind or something...

Valgrind is completely silent, BTW.


Thanks for looking at this, guys, and sorry for wasting your time.

bernd
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE/l5ba/FmLrNfLpjMRAgL9AJ9cwbIiuzZyewYT1J9QPgXGl1HK9QCeOik4
G8lzXcOdJOJizQvYkdfzF20=
=u+Tc
-----END PGP SIGNATURE-----



More information about the Gcc mailing list