| 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-2025, 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 |
------------------------------------------------------------------------------ |
| 31 |
|
| 32 |
-- This unit provides public 'View' data types from/to which private vector |
| 33 |
-- representations can be converted via Altivec.Conversions. This allows |
| 34 |
-- convenient access to individual vector elements and provides a simple way |
| 35 |
-- to initialize vector objects. |
| 36 |
|
| 37 |
-- Accessing vector contents with direct memory overlays should be avoided |
| 38 |
-- because actual vector representations may vary across configurations, for |
| 39 |
-- instance to accommodate different target endianness. |
| 40 |
|
| 41 |
-- The natural representation of a vector is an array indexed by vector |
| 42 |
-- component number, which is materialized by the Varray type definitions |
| 43 |
-- below. The 16byte alignment constraint is unfortunately sometimes not |
| 44 |
-- properly honored for constant array aggregates, so the View types are |
| 45 |
-- actually records enclosing such arrays. |
| 46 |
|
| 47 |
package GNAT.Altivec.Vector_Views is |
| 48 |
|
| 49 |
--------------------- |
| 50 |
-- char components -- |
| 51 |
--------------------- |
| 52 |
|
| 53 |
type Vchar_Range is range 1 .. 16; |
| 54 |
|
| 55 |
type Varray_unsigned_char is array (Vchar_Range) of unsigned_char; |
| 56 |
for Varray_unsigned_char'Alignment use VECTOR_ALIGNMENT; |
| 57 |
|
| 58 |
type VUC_View is record |
| 59 |
Values : Varray_unsigned_char; |
| 60 |
end record; |
| 61 |
pragma Universal_Aliasing (VUC_View); |
| 62 |
|
| 63 |
type Varray_signed_char is array (Vchar_Range) of signed_char; |
| 64 |
for Varray_signed_char'Alignment use VECTOR_ALIGNMENT; |
| 65 |
|
| 66 |
type VSC_View is record |
| 67 |
Values : Varray_signed_char; |
| 68 |
end record; |
| 69 |
pragma Universal_Aliasing (VSC_View); |
| 70 |
|
| 71 |
type Varray_bool_char is array (Vchar_Range) of bool_char; |
| 72 |
for Varray_bool_char'Alignment use VECTOR_ALIGNMENT; |
| 73 |
|
| 74 |
type VBC_View is record |
| 75 |
Values : Varray_bool_char; |
| 76 |
end record; |
| 77 |
pragma Universal_Aliasing (VBC_View); |
| 78 |
|
| 79 |
---------------------- |
| 80 |
-- short components -- |
| 81 |
---------------------- |
| 82 |
|
| 83 |
type Vshort_Range is range 1 .. 8; |
| 84 |
|
| 85 |
type Varray_unsigned_short is array (Vshort_Range) of unsigned_short; |
| 86 |
for Varray_unsigned_short'Alignment use VECTOR_ALIGNMENT; |
| 87 |
|
| 88 |
type VUS_View is record |
| 89 |
Values : Varray_unsigned_short; |
| 90 |
end record; |
| 91 |
pragma Universal_Aliasing (VUS_View); |
| 92 |
|
| 93 |
type Varray_signed_short is array (Vshort_Range) of signed_short; |
| 94 |
for Varray_signed_short'Alignment use VECTOR_ALIGNMENT; |
| 95 |
|
| 96 |
type VSS_View is record |
| 97 |
Values : Varray_signed_short; |
| 98 |
end record; |
| 99 |
pragma Universal_Aliasing (VSS_View); |
| 100 |
|
| 101 |
type Varray_bool_short is array (Vshort_Range) of bool_short; |
| 102 |
for Varray_bool_short'Alignment use VECTOR_ALIGNMENT; |
| 103 |
|
| 104 |
type VBS_View is record |
| 105 |
Values : Varray_bool_short; |
| 106 |
end record; |
| 107 |
pragma Universal_Aliasing (VBS_View); |
| 108 |
|
| 109 |
-------------------- |
| 110 |
-- int components -- |
| 111 |
-------------------- |
| 112 |
|
| 113 |
type Vint_Range is range 1 .. 4; |
| 114 |
|
| 115 |
type Varray_unsigned_int is array (Vint_Range) of unsigned_int; |
| 116 |
for Varray_unsigned_int'Alignment use VECTOR_ALIGNMENT; |
| 117 |
|
| 118 |
type VUI_View is record |
| 119 |
Values : Varray_unsigned_int; |
| 120 |
end record; |
| 121 |
pragma Universal_Aliasing (VUI_View); |
| 122 |
|
| 123 |
type Varray_signed_int is array (Vint_Range) of signed_int; |
| 124 |
for Varray_signed_int'Alignment use VECTOR_ALIGNMENT; |
| 125 |
|
| 126 |
type VSI_View is record |
| 127 |
Values : Varray_signed_int; |
| 128 |
end record; |
| 129 |
pragma Universal_Aliasing (VSI_View); |
| 130 |
|
| 131 |
type Varray_bool_int is array (Vint_Range) of bool_int; |
| 132 |
for Varray_bool_int'Alignment use VECTOR_ALIGNMENT; |
| 133 |
|
| 134 |
type VBI_View is record |
| 135 |
Values : Varray_bool_int; |
| 136 |
end record; |
| 137 |
pragma Universal_Aliasing (VBI_View); |
| 138 |
|
| 139 |
---------------------- |
| 140 |
-- float components -- |
| 141 |
---------------------- |
| 142 |
|
| 143 |
type Vfloat_Range is range 1 .. 4; |
| 144 |
|
| 145 |
type Varray_float is array (Vfloat_Range) of C_float; |
| 146 |
for Varray_float'Alignment use VECTOR_ALIGNMENT; |
| 147 |
|
| 148 |
type VF_View is record |
| 149 |
Values : Varray_float; |
| 150 |
end record; |
| 151 |
pragma Universal_Aliasing (VF_View); |
| 152 |
|
| 153 |
---------------------- |
| 154 |
-- pixel components -- |
| 155 |
---------------------- |
| 156 |
|
| 157 |
type Vpixel_Range is range 1 .. 8; |
| 158 |
|
| 159 |
type Varray_pixel is array (Vpixel_Range) of pixel; |
| 160 |
for Varray_pixel'Alignment use VECTOR_ALIGNMENT; |
| 161 |
|
| 162 |
type VP_View is record |
| 163 |
Values : Varray_pixel; |
| 164 |
end record; |
| 165 |
pragma Universal_Aliasing (VP_View); |
| 166 |
|
| 167 |
end GNAT.Altivec.Vector_Views; |