fpt and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Ref Manual Home |
SIMPLIFY EXPRESSIONS TO TRIPLES
Syntax:
[DO NOT] SIMPLIFY EXPRESSIONS TO TRIPLES [DO NOT] REDUCE EXPRESSIONS TO TRIPLES TRIPLES
Function:
Scalar assignment statements are split into statements of the form A = B <operator> C. Additional temporary local variables, named, for example, rtemp_1, rtemp_2 etc. are created if they are required, and declarations are added for them. No change is made to statements introduced by Fortran keywords.
Research
This command is used to prepare code for execution on machines with novel architectures. Please see:
In these papers the command is used in combination with the commands:
Optimisation for Speed of Execution
In the research projects described above, fpt re-engineered the code and it was then converted by other tools for the target architecture. Before the final conversion the code was compiled and run as Fortran to confirm that the changes had not changed the behaviour - ie. that we hadn't broken anything. Happily we hadn't. However we were supprised to find a significant improvement in the speed with which the code ran. Scalarising the code and breaking it into triples apparently enhanced the ability of the compilers (gfortran and ifort) to optimise the code for run speed.
Where to Use this Command
| Operating system command line | Yes |
| Configuration file, config.fsp | No |
| Specification (fsp) files, *.fsp | Yes |
| Interactively, to FPT> prompt | Yes |
| Interactive command files | Yes |
| Embedded in the Fortran code | No |
Default
This change is not made by default (Note that defaults may be modified in the configuration file).
Example
The code fragment shown below computes a polynomial:
REAL*8 r,x,k0,k1,k2,k3,k4 r = k0 + k1*x + k2*x*x + k3*x*x*x
This code is modified by the command (written in an fsp script):
% reduce expressions to triples
REAL*8 rtemp_1 REAL*8 rtemp_2 REAL*8 rtemp_3 REAL*8 rtemp_4 REAL*8 rtemp_5 REAL*8 rtemp_6 REAL*8 rtemp_7 REAL*8 rtemp_8 REAL*8 r,x,k0,k1,k2,k3,k4 ! ! fpt r=k0+k1*x+k2*x*x+k3*x*x*x rtemp_1 = k1*x rtemp_2 = k2*x rtemp_3 = rtemp_2*x rtemp_4 = k3*x rtemp_5 = rtemp_4*x rtemp_6 = rtemp_5*x rtemp_7 = k0+rtemp_1 rtemp_8 = rtemp_7+rtemp_3 r = rtemp_8+rtemp_6
Note that the original statement is commented-out by the delimiter "! fpt".
Copyright ©1995 to 2025 Software Validation Ltd. All rights reserved.