#pragma float: Generate code in the .root file to set the FPE slot.

This allows valid FPE-using programs to be compiled using only #pragma float, with no changes needed to the code itself.

The slot-setting code is only generated if the slot is 1..7, and even then it can be overridden by calling setfpeslot(), so this should not cause compatibility problems for existing code.
This commit is contained in:
Stephen Heumann 2023-06-17 18:13:31 -05:00
parent 966da239ee
commit 0021fd81bc
4 changed files with 21 additions and 2 deletions

View File

@ -18,7 +18,7 @@ uses CCommon, MM, Scanner, Symbol, CGI;
{$segment 'HEADER'}
const
symFileVersion = 40; {version number of .sym file format}
symFileVersion = 41; {version number of .sym file format}
var
inhibitHeader: boolean; {should .sym includes be blocked?}

View File

@ -2546,6 +2546,15 @@ procedure InitFile {keepName: gsosOutStringPtr; keepFlag: integer; partial: bool
{set the data bank register}
SetDataBank;
{set FPE slot, if using FPE}
if floatCard = 1 then
if floatSlot in [1..7] then begin
CnOut(m_pea);
CnOut2(floatSlot);
CnOut(m_jsl);
RefName(@'SETFPESLOT', 0, 3, 0);
end; {if}
{write JSL to main entry point}
CnOut(m_jsl);
if rtl then

View File

@ -3148,7 +3148,7 @@ var
else
Error(18);
if token.kind in [intconst,uintconst,ushortconst] then begin
floatSlot := $C080 | (token.ival << 4);
floatSlot := token.ival;
NextToken;
end {if}
else

View File

@ -58,6 +58,8 @@ Updated by Stephen Heumann and Kelvin Sherlock, 2017-2023
19. The code generated for certain operations has been improved.
20. The slot parameter to #pragma float now sets the FPE slot.
2.1.1 B3 1. Bugs squashed. See bug notes, below.
2.1.0 1. Bugs squashed. See bug notes, below.
@ -197,6 +199,8 @@ If precompiled headers are being used, #pragma expand will not print the tokens
p. 258
The slot parameter to #pragma float is now used to set the FPE slot. See "Changes to #pragma float," below.
The #pragma ignore directive supports several new bits.
Bit 1 affects the interpretation of multi-character character constants. See "Multi-Character Character Constants," below.
@ -680,6 +684,12 @@ ORCA/C can perform certain optimizations on floating-point computations based on
A new #pragma optimize bit has now been introduced to control this behavior. Setting bit 7 (a value of 128) allows floating-point math optimizations that may violate the IEEE standard. It currently only has an effect if #pragma optimize bit 0 or bit 4 is also set. If bit 7 is not set, these floating-point optimizations will not be performed. This allows most aspects of intermediate code peephole optimization and common subexpression elimination to be used while preserving IEEE floating-point behavior.
Changes to #pragma float
------------------------
If #pragma float is used to generate code for an FPE card, the slot number given in the pragma is now used to configure the FPE slot. This removes the need to call setfpeslot() in the program's code, although that can still be done to override the setting in #pragma float. If the specified slot number is not in the range 1-7, it will be ignored and setfpeslot() will still need to be used. You must also call setfpeslot() if you wish to use the FPE in any of the special types of programs that can be created using other pragmas.
Additions to #pragma ignore
---------------------------