<html><body>
<p>I don't know if we need to do anything about local versus global flags, but on PPCs<br>
<br>
        code before<br>
        {<br>
        #pragma  use_local_floating_point_flags        /* or whatever syntax is chosen */<br>
             do floating point and other operations<br>
             if (some exception flags are set)<br>
             {<br>
                  handle the exception<br>
             }<br>
        }<br>
        code after<br>
<br>
would be implemented something like the text after &quot;==&gt;&quot; in<br>
<br>
        code before<br>
        {<br>
        #pragma  use_local_floating_point_flags        ==&gt;  save the Floating Point Status and Control Register, and clear the exception flags in it<br>
             do floating point and other operations<br>
             if (some exception flags are set)<br>
             {<br>
                  handle the exception<br>
             }<br>
        }                                                ==&gt;  restore the Floating Point Status and Control Register that was saved above<br>
        code after<br>
<br>
The code in the block would not see any exception flags set by the code before, and the code after would not see any exception flags set by the block, but would see any set by the code before.<br>
<br>
This could be done manually by calling a &quot;save flags&quot; function and a &quot;clear flags&quot; function at the start, and a &quot;restore flags&quot; function at the end.<br>
<br>
In C++ there would also need to be a destructor to do the restore if a throw was done in the block or anything it called.<br>
<br>
- Ian McIntosh          IBM Canada Lab         Compiler Back End Support and Development<br>
<br>
<br>
<img width="16" height="16" src="cid:1__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt="Inactive hide details for David Hough CFP ---02/01/2012 05:23:38 PM---&gt; Do we need a general local flag mechanism It might be a"><font color="#424282">David Hough CFP ---02/01/2012 05:23:38 PM---&gt; Do we need a general local flag mechanism It might be a helpful programmer abstraction, but I don'</font><br>
<br>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">From:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2">David Hough CFP &lt;pcfp@oakapple.net&gt;</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">To:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2">cfp-interest@ucbtest.org, jaswthomas@sbcglobal.net</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Date:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2">02/01/2012 05:23 PM</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Subject:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2">Re: [Cfp-interest] Floating-point extensions for C report - part 1        - local flags</font></td></tr>

<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2" color="#5F5F5F">Sent by:</font></td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF304DF1130E08f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="2">cfp-interest-bounces@oakapple.net</font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<tt>&gt; Do we need a general local flag mechanism<br>
<br>
It might be a helpful programmer abstraction, but I don't think it would have<br>
any efficiency value on typical current hardware. &nbsp; &nbsp;The local flags would<br>
be implemented in the same hardware register as the global flags have been,<br>
so the real global flags would have to be maintained in a software location...<br>
what about a code block that wanted to look at a local underflow flag and<br>
a global invalid flag?<br>
<br>
For that fraction of the C universe which is just wants a higher-level<br>
machine-oriented programming language, I suppose the programmer's feature<br>
would just be access to the single global flag register.<br>
<br>
So my conclusion at the moment is to stick to the higher level alternate<br>
exception handling idea and leave some kind of local flag as an <br>
implementation option.<br>
_______________________________________________<br>
Cfp-interest mailing list<br>
Cfp-interest@oakapple.net<br>
</tt><tt><a href="http://mailman.oakapple.net/mailman/listinfo/cfp-interest">http://mailman.oakapple.net/mailman/listinfo/cfp-interest</a></tt><tt><br>
<br>
</tt><br>
<br>
</body></html>