<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18999"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=479575217-31122010>This test appears to be implementing the constraint 
that p0/1 base register values must be in in system space (bit 31 
set) & longword aligned (bits 0,1 clear).</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=479575217-31122010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=479575217-31122010>I don't think it's parens; there seem to be 
enough.  </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=479575217-31122010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=479575217-31122010>If this is a 64-bit environment, you might be seeing a 
sign extension / unsigned promotion issue in the complier.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=479575217-31122010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=479575217-31122010>You might try this to make what's desired 
explicit:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=479575217-31122010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=479575217-31122010><FONT color=#000000 size=3 
face="Times New Roman">#define ML_PXBR_TEST(r)  if (((((uint32)(r))& 
 0x80000000u) == 0) || \<BR>            
               ((r)& 
 0x00000003)) RSVD_OPND_FAULT</FONT><BR></SPAN></FONT></DIV>
<DIV><SPAN class=479575217-31122010><FONT color=#0000ff size=2 face=Arial>But it 
would really help to see the assembler generated for the two cases - especially 
the one that 
fails.</FONT></SPAN></DIV><!-- Converted from text/plain format --><BR>
<P><FONT 
size=2>---------------------------------------------------------<BR>This 
communication may not represent my employer's views,<BR>if any, on the matters 
discussed.<BR> </FONT> </P>
<DIV> </DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> simh-bounces@trailing-edge.com 
[mailto:simh-bounces@trailing-edge.com] <B>On Behalf Of </B>Peter 
Allan<BR><B>Sent:</B> Friday, December 31, 2010 12:32<BR><B>To:</B> 
simh@trailing-edge.com<BR><B>Subject:</B> Re: [Simh] O2 optimization on Linux 
(was: VMS 4.6 crashes on Linux)<BR></FONT><BR></DIV>
<DIV></DIV><BR><BR>
<DIV class=gmail_quote>On 28 December 2010 22:00, Bob Supnik <SPAN 
dir=ltr><<A href="mailto:bob@supnik.org">bob@supnik.org</A>></SPAN> 
wrote:<BR>
<BLOCKQUOTE 
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" 
class=gmail_quote>Jason Stevens wrote:<BR><BR>You didn't build it with -O2 on 
  linux did you?  There is some weird<BR>things with GCC and SIMH's VAX... 
   I can only speak to 4.X BSD, but I<BR>was able to identify two 
  procedures that when optimized with -O2 break<BR>4BSD on SIMH....<BR><BR>I 
  kind of detailed it here:<BR><BR><A 
  href="http://www.mail-archive.com/simh@trailing-edge.com/msg00463.html" 
  target=_blank>http://www.mail-archive.com/simh@trailing-edge.com/msg00463.html</A><BR><BR>And 
  the procedures in question 
  were:<BR><BR>op_ldpctx<BR>op_mtpr<BR><BR>---<BR><BR>Interestingly, those 
  routines are the ONLY places in the VAX simulator where these macros are 
  used:<BR><BR>/* Machine specific reserved operand tests (all NOPs) 
  */<BR><BR>#define ML_PA_TEST(r)<BR>#define ML_LR_TEST(r)<BR>#define 
  ML_SBR_TEST(r)<BR>#define ML_PXBR_TEST(r)<BR>#define LP_AST_TEST(r)<BR>#define 
  LP_MBZ84_TEST(r)<BR>#define LP_MBZ92_TEST(r)<BR><BR>On the 780, they are real 
  tests:<BR><BR>/* Machine specific reserved operand tests */<BR><BR>#define 
  ML_LR_TEST(r)    if ((uint32)((r)&  0xFFFFFF)> 
   0x200000) RSVD_OPND_FAULT<BR>#define ML_PXBR_TEST(r)  if 
  ((((r)&  0x80000000) == 0) || \<BR>          
                   ((r)& 
   0x00000003)) RSVD_OPND_FAULT<BR>#define ML_SBR_TEST(r)   if 
  ((r)&  0x00000003) RSVD_OPND_FAULT<BR>#define ML_PA_TEST(r)   
   if ((r)&  0x00000003) RSVD_OPND_FAULT<BR>#define LP_AST_TEST(r) 
    if ((r)>  AST_MAX) RSVD_OPND_FAULT<BR>#define LP_MBZ84_TEST(r) 
  if ((r)&  0xF8C00000) RSVD_OPND_FAULT<BR>#define LP_MBZ92_TEST(r) if 
  ((r)&  0x7FC00000) RSVD_OPND_FAULT<BR><BR>---<BR><BR>One (or more) of 
  those six tests is the smoking gun, and if I had to put my money on it, I 
  think it's this one:<BR><BR>#define ML_LR_TEST(r)    if 
  ((uint32)((r)&  0xFFFFFF)>  0x200000) 
  RSVD_OPND_FAULT<BR><BR>Try adding an extra level of parentheses:<BR><BR>if 
  (((uint32)((r)&  0xFFFFFF))>  0x200000) 
  RSVD_OPND_FAULT<BR><BR><BR>just to be sure that the uint32 cast isn't be 
  applied to the whole comparison, instead of just the first term.<BR><BR>If 
  that fails to get it running, then try "no-oping" all of the macros to see if 
  VMS 4.6 will boot.  If it does, then enable each of the macros in turn, 
  to see where the simulator 
  fails.<BR><BR>/Bob<BR><BR><BR>_______________________________________________<BR>Simh 
  mailing list<BR><A href="mailto:Simh@trailing-edge.com" 
  target=_blank>Simh@trailing-edge.com</A><BR><A 
  href="http://mailman.trailing-edge.com/mailman/listinfo/simh" 
  target=_blank>http://mailman.trailing-edge.com/mailman/listinfo/simh</A><BR></BLOCKQUOTE></DIV>
<DIV><BR>Bob,</DIV>
<DIV> </DIV>
<DIV>I tried removing the macro definitions one by one. The one that causes 
the problem is ML_PXBR_TEST, i.e. if this is defined as nothing and the rest are 
left as per vax780_defs.h, then the 780 emulator works on CentOS 5.5. This is 
the macro with two comparisons in it. I wonder if that is significant?</DIV>
<DIV> </DIV>
<DIV>I tried putting in some extra parentheses, but this did not help. </DIV>
<DIV> </DIV>
<DIV>Of course, it all still works on Fedora Core 14. I will see if I can 
compare the assembler that is generated for vax_cpu1.c on the two systems.</DIV>
<DIV> </DIV>
<DIV>Peter Allan</DIV>
<DIV> </DIV></BODY></HTML>