PR c++/77539
[official-gcc.git] / gcc / ada / g-ssvety.ads
blobc40706474a4e45c30848f08f67e08748232ff24f
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- G N A T . S S E . V E C T O R _ T Y P E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2009, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- This unit exposes the Ada __m128 like data types to represent the contents
33 -- of SSE registers, for use by bindings to the SSE intrinsic operations.
35 -- See GNAT.SSE for the list of targets where this facility is supported
37 package GNAT.SSE.Vector_Types is
39 -- The reference guide states a few usage guidelines for the C types:
41 -- Since these new data types are not basic ANSI C data types, you
42 -- must observe the following usage restrictions:
44 -- * Use new data types only on either side of an assignment, as a
45 -- return value, or as a parameter. You cannot use it with other
46 -- arithmetic expressions ("+", "-", and so on).
48 -- * Use new data types as objects in aggregates, such as unions to
49 -- access the byte elements and structures.
51 -- * Use new data types only with the respective intrinsics described
52 -- in this documentation.
54 type m128 is private; -- SSE >= 1
55 type m128d is private; -- SSE >= 2
56 type m128i is private; -- SSE >= 2
58 private
59 -- Each of the m128 types maps to a specific vector_type with an extra
60 -- "may_alias" attribute as in GCC's definitions for C, for instance in
61 -- xmmintrin.h:
63 -- /* The Intel API is flexible enough that we must allow aliasing
64 -- with other vector types, and their scalar components. */
65 -- typedef float __m128
66 -- __attribute__ ((__vector_size__ (16), __may_alias__));
68 -- /* Internal data types for implementing the intrinsics. */
69 -- typedef float __v4sf __attribute__ ((__vector_size__ (16)));
71 ------------
72 -- m128 --
73 ------------
75 -- The __m128 data type can hold four 32-bit floating-point values
77 type m128 is array (1 .. 4) of Float32;
78 for m128'Alignment use VECTOR_ALIGN;
79 pragma Machine_Attribute (m128, "vector_type");
80 pragma Machine_Attribute (m128, "may_alias");
82 -------------
83 -- m128d --
84 -------------
86 -- The __m128d data type can hold two 64-bit floating-point values
88 type m128d is array (1 .. 2) of Float64;
89 for m128d'Alignment use VECTOR_ALIGN;
90 pragma Machine_Attribute (m128d, "vector_type");
91 pragma Machine_Attribute (m128d, "may_alias");
93 -------------
94 -- m128i --
95 -------------
97 -- The __m128i data type can hold sixteen 8-bit, eight 16-bit, four 32-bit,
98 -- or two 64-bit integer values.
100 type m128i is array (1 .. 2) of Integer64;
101 for m128i'Alignment use VECTOR_ALIGN;
102 pragma Machine_Attribute (m128i, "vector_type");
103 pragma Machine_Attribute (m128i, "may_alias");
105 end GNAT.SSE.Vector_Types;