| 1 |
-- { dg-do compile } |
| 2 |
-- { dg-options "-O -w" } |
| 3 |
|
| 4 |
package body Vect9 is |
| 5 |
|
| 6 |
function Cmove |
| 7 |
(X : in Unit; |
| 8 |
Y : in Unit; |
| 9 |
If_True : in Unit; |
| 10 |
If_False : in Unit) |
| 11 |
return Unit |
| 12 |
is |
| 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; |
| 22 |
|
| 23 |
return Res; |
| 24 |
end; |
| 25 |
pragma Inline_Always (Cmove); |
| 26 |
|
| 27 |
procedure Proc |
| 28 |
(This : in Rec; |
| 29 |
CV : in Unit_Vector; |
| 30 |
Data : in out Unit_Vector) |
| 31 |
is |
| 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; |
| 44 |
|
| 45 |
end Vect9; |