public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* PowerPC and Volatile
@ 2000-12-01 12:38 Roger Racine
  2000-12-01 12:55 ` Peter Barada
  2000-12-04  2:16 ` Michael Schwingen
  0 siblings, 2 replies; 9+ messages in thread
From: Roger Racine @ 2000-12-01 12:38 UTC (permalink / raw)
  To: crossgcc

We are using version 2.7.2 of GCC (Wind River supplies it as part of the 
Tornado environment.  Wind River claims it is the best version if one is 
using C).

We are seeing the following behavior on a PPC:

We have a VME board used for I/O.  When sending data, we fill a buffer on 
the board, and then write to a special location that tells the board the 
buffer is ready.  The board then sets a bit saying that it is in the 
process of sending the data.  We look for that bit to be cleared before we 
try to use the buffer again.

The problem is that we have a loop that waits for the bit to be cleared, 
and then we immediately start putting the data in the buffer, and the 
PowerPC is writing the data before the bit is cleared.  Using a VME bus 
analyzer, we see a number of reads (looking for the bit to be cleared), 
followed by "write, read, write, read" for a while, followed by the rest of 
the writes.

Naturally, the locations we are talking about are declared volatile, so the 
compiler does not optimize the code, but the PowerPC has its own 
optimization in the form of pipelining, and it seems to be causing this 
problem.

The question is, should the compiler be inserting an "eieio" instruction at 
the sequence points in the code, such as the end of the loop mentioned 
above?  This PPC instruction tells the processor to hold off its 
pipelining.  We have been inserting them in the code ourselves, but it is a 
bit of a pain to have to do it.

Another question is, does anyone know if a later version of the compiler 
has fixed this problem?

Roger Racine
Draper Laboratory

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

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

end of thread, other threads:[~2000-12-05 10:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-01 12:38 PowerPC and Volatile Roger Racine
2000-12-01 12:55 ` Peter Barada
2000-12-05  4:14   ` Roger Racine
2000-12-05  8:01     ` Peter Barada
2000-12-04  2:16 ` Michael Schwingen
2000-12-05  1:13   ` Julien Ducourthial
2000-12-05  6:06     ` Michael Schwingen
2000-12-05  6:56       ` Julien Ducourthial
2000-12-05 10:22         ` Michael Schwingen

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 read-only IMAP folder(s) and NNTP newsgroup(s).