2018-03-15 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gnat.dg / vect9.adb
blob85f19bd981fc6c9deb40fa81616606b740e39119
1 -- { dg-do compile }
2 -- { dg-options "-O -w" }
4 package body Vect9 is
6 function Cmove
7 (X : in Unit;
8 Y : in Unit;
9 If_True : in Unit;
10 If_False : in Unit)
11 return Unit
13 Res : Unit;
14 begin
15 for P in Unit'Range loop
16 if X (P) >= Y (P) then
17 Res (P) := If_True (P);
18 else
19 Res (P) := If_False (P);
20 end if;
21 end loop;
23 return Res;
24 end;
25 pragma Inline_Always (Cmove);
27 procedure Proc
28 (This : in Rec;
29 CV : in Unit_Vector;
30 Data : in out Unit_Vector)
32 begin
33 for Index in Data'Range loop
34 Data (Index) := Mul (Zero_Unit, Zero_Unit);
35 declare
36 Addend : constant Unit
37 := Cmove (CV (Index), Zero_Unit, Zero_Unit, Zero_Unit) ;
38 begin
39 Data (Index) := Data(Index) + Addend;
40 end;
41 This.Data (Index) := Data (Index);
42 end loop;
43 end;
45 end Vect9;