OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gnat.dg/] [sse_nolib.adb] - Blame information for rev 308

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 304 jeremybenn
--  { dg-do run { target i?86-*-* x86_64-*-* } }
2
--  { dg-options "-O1 -msse" }
3
--  { dg-require-effective-target sse } 
4
 
5
with Ada.Unchecked_Conversion;
6
 
7
procedure SSE_Nolib is
8
 
9
   --  Base vector type definitions
10
 
11
   package SSE_Types is
12
      VECTOR_ALIGN : constant := 16;
13
      VECTOR_BYTES : constant := 16;
14
 
15
      type m128 is private;
16
   private
17
      type m128 is array (1 .. 4) of Float;
18
      for m128'Alignment use VECTOR_ALIGN;
19
      pragma Machine_Attribute (m128, "vector_type");
20
      pragma Machine_Attribute (m128, "may_alias");
21
   end SSE_Types;
22
 
23
   use SSE_Types;
24
 
25
   --  Core operations
26
 
27
   function mm_add_ss (A, B : m128) return m128;
28
   pragma Import (Intrinsic, mm_add_ss, "__builtin_ia32_addss");
29
 
30
   --  User views / conversions or overlays
31
 
32
   type Vf32_View is array (1 .. 4) of Float;
33
   for Vf32_View'Alignment use VECTOR_ALIGN;
34
 
35
   function To_m128 is new Ada.Unchecked_Conversion (Vf32_View, m128);
36
   function To_m128 is new Ada.Unchecked_Conversion (m128, Vf32_View);
37
 
38
   X, Y, Z : M128;
39
 
40
   Vz : Vf32_View;
41
   for Vz'Address use Z'Address;
42
begin
43
   X := To_m128 ((1.0, 1.0, 2.0, 2.0));
44
   Y := To_m128 ((2.0, 2.0, 1.0, 1.0));
45
   Z := mm_add_ss (X, Y);
46
 
47
   if Vz /= (3.0, 1.0, 2.0, 2.0) then
48
      raise Program_Error;
49
   end if;
50
end SSE_Nolib;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.