]>
Commit | Line | Data |
---|---|---|
81d93365 AC |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3 | -- GNAT COMPILER COMPONENTS -- | |
4 | -- -- | |
57aed6d6 | 5 | -- G N A T . S S E . V E C T O R _ T Y P E S -- |
81d93365 AC |
6 | -- -- |
7 | -- S p e c -- | |
8 | -- -- | |
4b490c1e | 9 | -- Copyright (C) 2009-2020, Free Software Foundation, Inc. -- |
81d93365 AC |
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 | ------------------------------------------------------------------------------ | |
31 | ||
32 | -- This unit exposes the Ada __m128 like data types to represent the contents | |
4b956d8b AC |
33 | -- of SSE registers, for use by bindings to the SSE intrinsic operations. |
34 | ||
d994a6e2 | 35 | -- See GNAT.SSE for the list of targets where this facility is supported |
81d93365 AC |
36 | |
37 | package GNAT.SSE.Vector_Types is | |
38 | ||
d994a6e2 | 39 | -- The reference guide states a few usage guidelines for the C types: |
81d93365 | 40 | |
d994a6e2 RD |
41 | -- Since these new data types are not basic ANSI C data types, you |
42 | -- must observe the following usage restrictions: | |
81d93365 AC |
43 | -- |
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). | |
47 | -- | |
48 | -- * Use new data types as objects in aggregates, such as unions to | |
49 | -- access the byte elements and structures. | |
50 | -- | |
51 | -- * Use new data types only with the respective intrinsics described | |
5391897d | 52 | -- in this documentation. |
81d93365 | 53 | |
d994a6e2 | 54 | type m128 is private; -- SSE >= 1 |
4b956d8b AC |
55 | type m128d is private; -- SSE >= 2 |
56 | type m128i is private; -- SSE >= 2 | |
81d93365 AC |
57 | |
58 | private | |
d994a6e2 RD |
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: | |
81d93365 | 62 | |
4b956d8b AC |
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__)); | |
d994a6e2 | 67 | |
4b956d8b AC |
68 | -- /* Internal data types for implementing the intrinsics. */ |
69 | -- typedef float __v4sf __attribute__ ((__vector_size__ (16))); | |
81d93365 AC |
70 | |
71 | ------------ | |
5391897d | 72 | -- m128 -- |
81d93365 AC |
73 | ------------ |
74 | ||
d994a6e2 | 75 | -- The __m128 data type can hold four 32-bit floating-point values |
81d93365 | 76 | |
4b956d8b AC |
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"); | |
81d93365 AC |
81 | |
82 | ------------- | |
4b956d8b | 83 | -- m128d -- |
81d93365 AC |
84 | ------------- |
85 | ||
d994a6e2 | 86 | -- The __m128d data type can hold two 64-bit floating-point values |
81d93365 | 87 | |
4b956d8b AC |
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"); | |
81d93365 AC |
92 | |
93 | ------------- | |
4b956d8b | 94 | -- m128i -- |
81d93365 AC |
95 | ------------- |
96 | ||
d994a6e2 RD |
97 | -- The __m128i data type can hold sixteen 8-bit, eight 16-bit, four 32-bit, |
98 | -- or two 64-bit integer values. | |
81d93365 | 99 | |
4b956d8b AC |
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"); | |
81d93365 AC |
104 | |
105 | end GNAT.SSE.Vector_Types; |