1-- { dg-do compile { target i?86-*-* x86_64-*-* } } 2-- { dg-options "-O3 -msse2 -fdump-tree-vect-details" } 3 4package body Vect1 is 5 6 function "+" (X, Y : Varray) return Varray is 7 R : Varray (X'Range); 8 begin 9 for I in X'Range loop 10 R(I) := X(I) + Y(I); 11 end loop; 12 return R; 13 end; 14 15 procedure Add (X, Y : Varray; R : out Varray) is 16 begin 17 for I in X'Range loop 18 R(I) := X(I) + Y(I); 19 end loop; 20 end; 21 22 procedure Add (X, Y : not null access Varray; R : not null access Varray) is 23 begin 24 for I in X'Range loop 25 R(I) := X(I) + Y(I); 26 end loop; 27 end; 28 29 30 function "+" (X, Y : Sarray) return Sarray is 31 R : Sarray; 32 begin 33 for I in Sarray'Range loop 34 R(I) := X(I) + Y(I); 35 end loop; 36 return R; 37 end; 38 39 procedure Add (X, Y : Sarray; R : out Sarray) is 40 begin 41 for I in Sarray'Range loop 42 R(I) := X(I) + Y(I); 43 end loop; 44 end; 45 46 procedure Add (X, Y : not null access Sarray; R : not null access Sarray) is 47 begin 48 for I in Sarray'Range loop 49 R(I) := X(I) + Y(I); 50 end loop; 51 end; 52 53 54 function "+" (X, Y : Darray1) return Darray1 is 55 R : Darray1; 56 begin 57 for I in Darray1'Range loop 58 R(I) := X(I) + Y(I); 59 end loop; 60 return R; 61 end; 62 63 procedure Add (X, Y : Darray1; R : out Darray1) is 64 begin 65 for I in Darray1'Range loop 66 R(I) := X(I) + Y(I); 67 end loop; 68 end; 69 70 procedure Add (X, Y : not null access Darray1; R : not null access Darray1) is 71 begin 72 for I in Darray1'Range loop 73 R(I) := X(I) + Y(I); 74 end loop; 75 end; 76 77 78 function "+" (X, Y : Darray2) return Darray2 is 79 R : Darray2; 80 begin 81 for I in Darray2'Range loop 82 R(I) := X(I) + Y(I); 83 end loop; 84 return R; 85 end; 86 87 procedure Add (X, Y : Darray2; R : out Darray2) is 88 begin 89 for I in Darray2'Range loop 90 R(I) := X(I) + Y(I); 91 end loop; 92 end; 93 94 procedure Add (X, Y : not null access Darray2; R : not null access Darray2) is 95 begin 96 for I in Darray2'Range loop 97 R(I) := X(I) + Y(I); 98 end loop; 99 end; 100 101 102 function "+" (X, Y : Darray3) return Darray3 is 103 R : Darray3; 104 begin 105 for I in Darray3'Range loop 106 R(I) := X(I) + Y(I); 107 end loop; 108 return R; 109 end; 110 111 procedure Add (X, Y : Darray3; R : out Darray3) is 112 begin 113 for I in Darray3'Range loop 114 R(I) := X(I) + Y(I); 115 end loop; 116 end; 117 118 procedure Add (X, Y : not null access Darray3; R : not null access Darray3) is 119 begin 120 for I in Darray3'Range loop 121 R(I) := X(I) + Y(I); 122 end loop; 123 end; 124 125end Vect1; 126 127-- { dg-final { scan-tree-dump-times "vectorized 1 loops" 15 "vect" } } 128