|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 2527 (0x9df)
Types: TextFile
Names: »B«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
with Instrument;
use Instrument;
--------------------------
-- Reduce Constant Expression
--------------------------
-- This test evaluates a code improvement potential that results
-- from executing a less expensive arithmetic operation when the
-- opportunity is offered to replace a multiplication, that uses a
-- loop parameter and a constant, with an addition.
-- The test procedures contain a redefinition of two local
-- variables, Local_1 and Local_2, that are enclosed by a loop. The
-- loop parameter has a nonstatic range that is adequately
-- camouflaged to prevent loop optimization. In the optimized test
-- procedure the redefinition of Local_1 evaluates an expression
-- that multiplies the loop parameter by a local constant whereas in
-- the nonoptimized test procedure the operands of the
-- multiplication are the loop parameter and a local variable. This
-- local variable is iteratively redefined within the loop to void
-- the optimization. A redefinition that evaluates an expression
-- which uses the division operation is included to provide a
-- comparable reference to this local variable in the optimized test
-- procedure. The optimization is evidenced by a difference in the
-- execution time of the two procedures.
-- The camouflaged redefinition of Global_1 using Local_2 ensures
-- that Local_2 is referenced and that other unexpected
-- optimizations do not invalidate the benchmark.
procedure Aocea1 is
package New_Procs is new Procs (Integer);
use New_Procs;
Constant_Init : constant T := Init / Init;
Local_Init : T;
Local_1, Local_2 : T;
begin
Start ("AOCEA1", "Arith. Optimization, Const. Elim. (control)");
for I in 1 .. 1000 loop
Let (Global, Ident (Init));
for J in Ident (T'Val (1)) .. Ident (T'Val (10)) loop
Let (Local_Init, Ident (Init / Init));
------optimize------
-- Local_1 := T(T(I) * Constant_Init); -- included in test version
Local_1 :=
T (T (I) * Local_Init); -- included in control version
-- Let(Local_2, Ident(T(Local_1 / Local_Init))); -- inc. in test ver.
Let (Local_2,
Ident (T (Local_1 / Constant_Init))); -- inc. in control ver.
end loop;
Let (Global, Ident (Init + Local_2 - T'Val (1)));
Let (Global, Ident (Init));
end loop;
Stop;
end Aocea1;