aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/vect9.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gnat.dg/vect9.adb')
-rw-r--r--gcc/testsuite/gnat.dg/vect9.adb45
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/vect9.adb b/gcc/testsuite/gnat.dg/vect9.adb
new file mode 100644
index 0000000..9c586c2
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/vect9.adb
@@ -0,0 +1,45 @@
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+package body Vect9 is
+
+ function Cmove
+ (X : in Unit;
+ Y : in Unit;
+ If_True : in Unit;
+ If_False : in Unit)
+ return Unit
+ is
+ Res : Unit;
+ begin
+ for P in Unit'Range loop
+ if X (P) >= Y (P) then
+ Res (P) := If_True (P);
+ else
+ Res (P) := If_False (P);
+ end if;
+ end loop;
+
+ return Res;
+ end;
+ pragma Inline_Always (Cmove);
+
+ procedure Proc
+ (This : in Rec;
+ CV : in Unit_Vector;
+ Data : in out Unit_Vector)
+ is
+ begin
+ for Index in Data'Range loop
+ Data (Index) := Mul (Zero_Unit, Zero_Unit);
+ declare
+ Addend : constant Unit
+ := Cmove (CV (Index), Zero_Unit, Zero_Unit, Zero_Unit) ;
+ begin
+ Data (Index) := Data(Index) + Addend;
+ end;
+ This.Data (Index) := Data (Index);
+ end loop;
+ end;
+
+end Vect9;