9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] got it
@ 2005-03-10 18:34 Ronald G. Minnich
  2005-03-10 18:49 ` Russ Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Ronald G. Minnich @ 2005-03-10 18:34 UTC (permalink / raw)
  To: 9fans


an optimization is dumping onto another, it seems.

on arm.

ulong *x, y[64];

	x = y;
	*x++ = 1;
	*x++ = 2;

assembly gives:

	MOVW	$y-260(SP),R3
	MOVW	$1, R2
	MOVW.P	R2, $4(R3)

so the 260 puts you two words before the first element of Y, I'm guessing
(otherwise it would be y-252, right? 63*4). Then it does a pre-increment
and offset by 4, which puts you right at the first element of y.

Which all fails badly if you're setting x to a constant, as in constant
page table value in memory for startup.

That's my reading anyway.

I'm still unsure, all I know is the .s code looks wrong to me for the l.s
changes I'm making. (I'm too lazy to write assembly, I try to have C
compilers do it for me. Usually works. Maybe not this time.)

ron


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [9fans] got it
@ 2005-03-10 18:39 Ben Huntsman
  2005-03-10 20:58 ` Ronald G. Minnich
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Huntsman @ 2005-03-10 18:39 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Does the same happen on the Inferno side?  So far as I know, we've a few ARM guys over there..

>>> Ronald G. Minnich<rminnich@lanl.gov> 3/10/2005 10:34:44 AM >>>

an optimization is dumping onto another, it seems. 

on arm.

ulong *x, y[64];

	x = y;
	*x++ = 1;
	*x++ = 2;

assembly gives:

	MOVW	$y-260(SP),R3
	MOVW	$1, R2
	MOVW.P	R2, $4(R3)

so the 260 puts you two words before the first element of Y, I'm guessing 
(otherwise it would be y-252, right? 63*4). Then it does a pre-increment 
and offset by 4, which puts you right at the first element of y. 

Which all fails badly if you're setting x to a constant, as in constant 
page table value in memory for startup. 

That's my reading anyway.

I'm still unsure, all I know is the .s code looks wrong to me for the l.s 
changes I'm making. (I'm too lazy to write assembly, I try to have C 
compilers do it for me. Usually works. Maybe not this time.)

ron


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-03-10 21:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-10 18:34 [9fans] got it Ronald G. Minnich
2005-03-10 18:49 ` Russ Cox
2005-03-10 21:00   ` Ronald G. Minnich
2005-03-10 21:10     ` Ronald G. Minnich
2005-03-10 18:39 Ben Huntsman
2005-03-10 20:58 ` Ronald G. Minnich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).