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-2020, 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 47package 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 62 type Varray_signed_char is array (Vchar_Range) of signed_char; 63 for Varray_signed_char'Alignment use VECTOR_ALIGNMENT; 64 65 type VSC_View is record 66 Values : Varray_signed_char; 67 end record; 68 69 type Varray_bool_char is array (Vchar_Range) of bool_char; 70 for Varray_bool_char'Alignment use VECTOR_ALIGNMENT; 71 72 type VBC_View is record 73 Values : Varray_bool_char; 74 end record; 75 76 ---------------------- 77 -- short components -- 78 ---------------------- 79 80 type Vshort_Range is range 1 .. 8; 81 82 type Varray_unsigned_short is array (Vshort_Range) of unsigned_short; 83 for Varray_unsigned_short'Alignment use VECTOR_ALIGNMENT; 84 85 type VUS_View is record 86 Values : Varray_unsigned_short; 87 end record; 88 89 type Varray_signed_short is array (Vshort_Range) of signed_short; 90 for Varray_signed_short'Alignment use VECTOR_ALIGNMENT; 91 92 type VSS_View is record 93 Values : Varray_signed_short; 94 end record; 95 96 type Varray_bool_short is array (Vshort_Range) of bool_short; 97 for Varray_bool_short'Alignment use VECTOR_ALIGNMENT; 98 99 type VBS_View is record 100 Values : Varray_bool_short; 101 end record; 102 103 -------------------- 104 -- int components -- 105 -------------------- 106 107 type Vint_Range is range 1 .. 4; 108 109 type Varray_unsigned_int is array (Vint_Range) of unsigned_int; 110 for Varray_unsigned_int'Alignment use VECTOR_ALIGNMENT; 111 112 type VUI_View is record 113 Values : Varray_unsigned_int; 114 end record; 115 116 type Varray_signed_int is array (Vint_Range) of signed_int; 117 for Varray_signed_int'Alignment use VECTOR_ALIGNMENT; 118 119 type VSI_View is record 120 Values : Varray_signed_int; 121 end record; 122 123 type Varray_bool_int is array (Vint_Range) of bool_int; 124 for Varray_bool_int'Alignment use VECTOR_ALIGNMENT; 125 126 type VBI_View is record 127 Values : Varray_bool_int; 128 end record; 129 130 ---------------------- 131 -- float components -- 132 ---------------------- 133 134 type Vfloat_Range is range 1 .. 4; 135 136 type Varray_float is array (Vfloat_Range) of C_float; 137 for Varray_float'Alignment use VECTOR_ALIGNMENT; 138 139 type VF_View is record 140 Values : Varray_float; 141 end record; 142 143 ---------------------- 144 -- pixel components -- 145 ---------------------- 146 147 type Vpixel_Range is range 1 .. 8; 148 149 type Varray_pixel is array (Vpixel_Range) of pixel; 150 for Varray_pixel'Alignment use VECTOR_ALIGNMENT; 151 152 type VP_View is record 153 Values : Varray_pixel; 154 end record; 155 156end GNAT.Altivec.Vector_Views; 157