[Simh] O2 optimization on Linux

Peter Allan petermallan at googlemail.com
Mon Jan 3 14:37:44 EST 2011


Bob is quite right about the problem only occurring under specific
circumstances. It appears to me that the problem lies with the version of
the gnu C compiler that comes with CentOS 5.5, and we can hardly ask the
maintainers to fix it since the latest version seems to work just fine.

Ironically, I use CentOS because it is a robust system.   [?]

Peter Allan

On 3 January 2011 17:47, Bob Supnik <bob at supnik.org> wrote:

> Well, the 780 microcode is complicated and patched to fare-thee-well, but
> it uses absolutely common code for the tests on P0BR and P1BR.  [The PDFs
> are on line at Bitsaver.]  Based on the comments, the actual tests are:
>
> 1) Offset P1BR by 0x800000 (2**23).
> 2) Test PxBR<1:0> = 0.
> 3) Test PxBR<31> = 1.
> 4) Test PxBR<30> = 0.  [this is missing in SimH]
>
> For SBR, it's:
>
> 1) Test SBR<1:0> = 0.
> 2) Test SBR<31:30> = 0. [this is missing in SimH]
>
> So while SimH may not be SRM conformant, it follows the 780 microcode more
> or less faithfully; in particular, by using a common macro for testing P0BR
> and P1BR.  Remember, SimH is a hardware simulator, not an architectural
> simulator.
>
> So I would venture that the "right" formulation of these tests is:
>
> #define ML_SBR_TEST(r)  if ((r) & 0xC000003) RSVD_OPND_FAULT
> #define ML_PXBR_TEST(r) if ((((r) & 0x80000000) == 0) || \
>                            ((r) & 0x40000003)) RSVD_OPND_FAULT
>
> Of course, you can throw in whatever casts, etc, you want to add to make
> the code 64b proof; and also the != 0 that good C coding seems to imply
> these days:
>
> #define ML_SBR_TEST(r) if (((uint32)(r)) & 0xC000003u) != 0)
> RSVD_OPND_FAULT
> #define ML_PXBR_TEST(r) if (((((uint32)(r)) & 0x80000000u) == 0) || \
>                            (((uint32)(r)) & 0x40000003u) != 0))
> RSVD_OPND_FAULT
>
> The ANSI C standard says that hex constants are unsigned by default, so I
> really don't think all the u's are needed.
>
> Remember, the problem is unique to one version of the C compiler, with
> CentOS 5.5.  It works everywhere else.
>
> /Bob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20110103/02d2ae6b/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 33D.gif
Type: image/gif
Size: 104 bytes
Desc: not available
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20110103/02d2ae6b/attachment-0002.gif>


More information about the Simh mailing list