gcc:
[official-gcc.git] / gcc / ada / g-alvevi.ads
blobbd3a299e2f9a221e3c3d55ceb64a990dc3dad9a8
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- G N A T . A L T I V E C . V E C T O R _ V I E W S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2005, 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This unit provides public 'View' data types from/to which private vector
35 -- representations can be converted via Altivec.Conversions. This allows
36 -- convenient access to individual vector elements and provides a simple way
37 -- to initialize vector objects.
39 -- Accessing vector contents with direct memory overlays should be avoided
40 -- because actual vector representations may vary across configurations, for
41 -- instance to accomodate different target endianness.
43 -- The natural representation of a vector is an array indexed by vector
44 -- component number, which is materialized by the Varray type definitions
45 -- below. The 16byte alignment constraint is unfortunately sometimes not
46 -- properly honored for constant array aggregates, so the View types are
47 -- actually records enclosing such arrays.
49 package GNAT.Altivec.Vector_Views is
51 ---------------------
52 -- char components --
53 ---------------------
55 type Vchar_Range is range 1 .. 16;
57 type Varray_unsigned_char is array (Vchar_Range) of unsigned_char;
58 for Varray_unsigned_char'Alignment use VECTOR_ALIGNMENT;
60 type VUC_View is record
61 Values : Varray_unsigned_char;
62 end record;
64 type Varray_signed_char is array (Vchar_Range) of signed_char;
65 for Varray_signed_char'Alignment use VECTOR_ALIGNMENT;
67 type VSC_View is record
68 Values : Varray_signed_char;
69 end record;
71 type Varray_bool_char is array (Vchar_Range) of bool_char;
72 for Varray_bool_char'Alignment use VECTOR_ALIGNMENT;
74 type VBC_View is record
75 Values : Varray_bool_char;
76 end record;
78 ----------------------
79 -- short components --
80 ----------------------
82 type Vshort_Range is range 1 .. 8;
84 type Varray_unsigned_short is array (Vshort_Range) of unsigned_short;
85 for Varray_unsigned_short'Alignment use VECTOR_ALIGNMENT;
87 type VUS_View is record
88 Values : Varray_unsigned_short;
89 end record;
91 type Varray_signed_short is array (Vshort_Range) of signed_short;
92 for Varray_signed_short'Alignment use VECTOR_ALIGNMENT;
94 type VSS_View is record
95 Values : Varray_signed_short;
96 end record;
98 type Varray_bool_short is array (Vshort_Range) of bool_short;
99 for Varray_bool_short'Alignment use VECTOR_ALIGNMENT;
101 type VBS_View is record
102 Values : Varray_bool_short;
103 end record;
105 --------------------
106 -- int components --
107 --------------------
109 type Vint_Range is range 1 .. 4;
111 type Varray_unsigned_int is array (Vint_Range) of unsigned_int;
112 for Varray_unsigned_int'Alignment use VECTOR_ALIGNMENT;
114 type VUI_View is record
115 Values : Varray_unsigned_int;
116 end record;
118 type Varray_signed_int is array (Vint_Range) of signed_int;
119 for Varray_signed_int'Alignment use VECTOR_ALIGNMENT;
121 type VSI_View is record
122 Values : Varray_signed_int;
123 end record;
125 type Varray_bool_int is array (Vint_Range) of bool_int;
126 for Varray_bool_int'Alignment use VECTOR_ALIGNMENT;
128 type VBI_View is record
129 Values : Varray_bool_int;
130 end record;
132 ----------------------
133 -- float components --
134 ----------------------
136 type Vfloat_Range is range 1 .. 4;
138 type Varray_float is array (Vfloat_Range) of C_float;
139 for Varray_float'Alignment use VECTOR_ALIGNMENT;
141 type VF_View is record
142 Values : Varray_float;
143 end record;
145 ----------------------
146 -- pixel components --
147 ----------------------
149 type Vpixel_Range is range 1 .. 8;
151 type Varray_pixel is array (Vpixel_Range) of pixel;
152 for Varray_pixel'Alignment use VECTOR_ALIGNMENT;
154 type VP_View is record
155 Values : Varray_pixel;
156 end record;
158 end GNAT.Altivec.Vector_Views;