> I pushed it to trunk already (but not your Ada testcase).

Sorry, I missed the reference in your message...

I have added the Ada testcase to the gnat.dg testsuite.


        * gnat.dg/vect19.ads, gnat.dg/vect19.adb: New test.
        * gnat.dg/vect19_pkg.ads, gnat.dg/vect19_pkg.adb: New helper.

-- 
Eric Botcazou
with Vect19_Pkg; use Vect19_Pkg;

package Vect19 is

  function NSum (X : Arr; N : Positive) return Arr;

end Vect19;
-- { dg-do compile { target i?86-*-* x86_64-*-* } }
-- { dg-options "-O3 -msse2 -gnatn -fno-tree-slp-vectorize -fdump-tree-vect-details" }

package body Vect19 is

  function NSum (X : Arr; N : Positive) return Arr is
    Ret : Arr := X;
  begin
    for I in 1 .. N loop
      Ret := Sum (Ret, X);
    end loop;
    return Ret;
  end;

end Vect19;

-- { dg-final { scan-tree-dump "vectorized 1 loops" "vect"  } }
package Vect19_Pkg is

  type Arr is array (1 .. 4) of Float;
  for Arr'Alignment use 16;

  function Sum (X : Arr; Y : Arr) return Arr;
  pragma Inline (Sum);

end Vect19_Pkg;
package body Vect19_Pkg is

  function Sum (X : Arr; Y : Arr) return Arr is
    Result : Arr;
  begin
    for I in X'Range loop
      Result(I) := X(I) + Y(I);
    end loop;
    return Result;
  end;

end Vect19_Pkg;

Reply via email to