* tree-ssa-loop-im.c (for_each_index) <CONST_DECL>: New case.
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 8 Dec 2012 11:44:05 +0000 (11:44 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 8 Dec 2012 11:44:05 +0000 (11:44 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194320 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/vect9.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/vect9.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/vect9_pkg.ads [new file with mode: 0644]
gcc/tree-ssa-loop-im.c

index 6d4e74b..cf7bb72 100644 (file)
@@ -1,3 +1,7 @@
+2012-12-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * tree-ssa-loop-im.c (for_each_index) <CONST_DECL>: New case.
+
 2012-12-07  Steven Bosscher  <steven@gcc.gnu.org>
 
        * ree.c (struct ext_cand): Remove GTY markers.
index 6958948..b150c59 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/vect9.ad[sb]: New test.
+       * gnat.dg/vect9_pkg.ads: New helper.
+
 2012-12-07  Mike Stump  <mikestump@comcast.net>
 
        * gnat.dg/discr38.adb: Don't use ^M line endings.
diff --git a/gcc/testsuite/gnat.dg/vect9.adb b/gcc/testsuite/gnat.dg/vect9.adb
new file mode 100644 (file)
index 0000000..9c586c2
--- /dev/null
@@ -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;
diff --git a/gcc/testsuite/gnat.dg/vect9.ads b/gcc/testsuite/gnat.dg/vect9.ads
new file mode 100644 (file)
index 0000000..38a0ae4
--- /dev/null
@@ -0,0 +1,14 @@
+with Vect9_Pkg; use Vect9_Pkg;
+
+package Vect9 is
+
+   type Rec is record
+      Data : Vector_Access;
+   end record;
+
+   procedure Proc
+     (This : in Rec;
+      CV   : in Unit_Vector;
+      Data : in out Unit_Vector);
+
+end Vect9;
diff --git a/gcc/testsuite/gnat.dg/vect9_pkg.ads b/gcc/testsuite/gnat.dg/vect9_pkg.ads
new file mode 100644 (file)
index 0000000..973a87b
--- /dev/null
@@ -0,0 +1,17 @@
+package Vect9_Pkg is
+
+   type Unit is array (1 .. 4) of Float;
+   for Unit'Alignment use 32;
+   pragma Machine_Attribute (Unit, "vector_type");
+   pragma Machine_Attribute (Unit, "may_alias");
+
+   Zero_Unit : constant Unit := (others => 0.0);
+
+   function Mul (X : in Unit; Y : in Unit) return Unit;
+   function "+"(Left, Right : Unit) return Unit;
+   function "*"(Left, Right : Unit) return Unit;
+
+   type Unit_Vector is array (Positive range <>) of Unit;
+   type Vector_Access is access all Unit_Vector;
+
+end Vect9_Pkg;
index d9265db..bad218d 100644 (file)
@@ -291,6 +291,7 @@ for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data)
 
        case VAR_DECL:
        case PARM_DECL:
+       case CONST_DECL:
        case STRING_CST:
        case RESULT_DECL:
        case VECTOR_CST: