HIP: Heterogenous-computing Interface for Portability
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hip_vector_types.h
1 /*
2 Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 */
22 #if defined (__HCC__) && (__hcc_workweek__ < 16032)
23 #error("This version of HIP requires a newer version of HCC.");
24 #endif
25 
26 #include <hc_short_vector.hpp>
27 
28 // Define char vector types
29 typedef hc::short_vector::char1 char1;
30 typedef hc::short_vector::char2 char2;
31 typedef hc::short_vector::char3 char3;
32 typedef hc::short_vector::char4 char4;
33 
34 // Define uchar vector types
35 typedef hc::short_vector::uchar1 uchar1;
36 typedef hc::short_vector::uchar2 uchar2;
37 typedef hc::short_vector::uchar3 uchar3;
38 typedef hc::short_vector::uchar4 uchar4;
39 
40 // Define short vector types
41 typedef hc::short_vector::short1 short1;
42 typedef hc::short_vector::short2 short2;
43 typedef hc::short_vector::short3 short3;
44 typedef hc::short_vector::short4 short4;
45 
46 // Define ushort vector types
47 typedef hc::short_vector::ushort1 ushort1;
48 typedef hc::short_vector::ushort2 ushort2;
49 typedef hc::short_vector::ushort3 ushort3;
50 typedef hc::short_vector::ushort4 ushort4;
51 
52 // Define int vector types
53 typedef hc::short_vector::int1 int1;
54 typedef hc::short_vector::int2 int2;
55 typedef hc::short_vector::int3 int3;
56 typedef hc::short_vector::int4 int4;
57 
58 // Define uint vector types
59 typedef hc::short_vector::uint1 uint1;
60 typedef hc::short_vector::uint2 uint2;
61 typedef hc::short_vector::uint3 uint3;
62 typedef hc::short_vector::uint4 uint4;
63 
64 // Define long vector types
65 typedef hc::short_vector::long1 long1;
66 typedef hc::short_vector::long2 long2;
67 typedef hc::short_vector::long3 long3;
68 typedef hc::short_vector::long4 long4;
69 
70 // Define ulong vector types
71 typedef hc::short_vector::ulong1 ulong1;
72 typedef hc::short_vector::ulong2 ulong2;
73 typedef hc::short_vector::ulong3 ulong3;
74 typedef hc::short_vector::ulong4 ulong4;
75 
76 // Define longlong vector types
77 typedef hc::short_vector::longlong1 longlong1;
78 typedef hc::short_vector::longlong2 longlong2;
79 typedef hc::short_vector::longlong3 longlong3;
80 typedef hc::short_vector::longlong4 longlong4;
81 
82 // Define ulonglong vector types
83 typedef hc::short_vector::ulonglong1 ulonglong1;
84 typedef hc::short_vector::ulonglong2 ulonglong2;
85 typedef hc::short_vector::ulonglong3 ulonglong3;
86 typedef hc::short_vector::ulonglong4 ulonglong4;
87 
88 // Define float vector types
89 typedef hc::short_vector::float1 float1;
90 typedef hc::short_vector::float2 float2;
91 typedef hc::short_vector::float3 float3;
92 typedef hc::short_vector::float4 float4;
93 
94 // Define double vector types
95 typedef hc::short_vector::double1 double1;
96 typedef hc::short_vector::double2 double2;
97 typedef hc::short_vector::double3 double3;
98 typedef hc::short_vector::double4 double4;
99 
100 // Inline functions for creating vector types from basic types
101 inline char1 make_char1(signed char x) { char1 t; t.x = x; return t; };
102 inline char2 make_char2(signed char x, signed char y) { char2 t; t.x = x; t.y = y; return t; };
103 inline char3 make_char3(signed char x, signed char y, signed char z) { char3 t; t.x = x; t.y = y; t.z = z; return t; };
104 inline char4 make_char4(signed char x, signed char y, signed char z, signed char w) { char4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
105 
106 inline uchar1 make_uchar1(unsigned char x) { uchar1 t; t.x = x; return t; };
107 inline uchar2 make_uchar2(unsigned char x, unsigned char y) { uchar2 t; t.x = x; t.y = y; return t; };
108 inline uchar3 make_uchar3(unsigned char x, unsigned char y, unsigned char z) { uchar3 t; t.x = x; t.y = y; t.z = z; return t; };
109 inline uchar4 make_uchar4(unsigned char x, unsigned char y, unsigned char z, unsigned char w) { uchar4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
110 
111 inline short1 make_short1(short x) { short1 t; t.x = x; return t; };
112 inline short2 make_short2(short x, short y) { short2 t; t.x = x; t.y = y; return t; };
113 inline short3 make_short3(short x,short y, short z) { short3 t; t.x = x; t.y = y; t.z = z; return t; };
114 inline short4 make_short4(short x, short y, short z, short w) { short4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
115 
116 inline ushort1 make_ushort1(unsigned short x) { ushort1 t; t.x = x; return t; };
117 inline ushort2 make_ushort2(unsigned short x, unsigned short y) { ushort2 t; t.x = x; t.y = y; return t; };
118 inline ushort3 make_ushort3(unsigned short x, unsigned short y, unsigned short z) { ushort3 t; t.x = x; t.y = y; t.z = z; return t; };
119 inline ushort4 make_ushort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w) { ushort4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
120 
121 inline int1 make_int1(int x) { int1 t; t.x = x; return t; };
122 inline int2 make_int2(int x, int y) { int2 t; t.x = x; t.y = y; return t; };
123 inline int3 make_int3(int x, int y, int z) { int3 t; t.x = x; t.y = y; t.z = z; return t; };
124 inline int4 make_int4(int x, int y, int z, int w) { int4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
125 inline uint1 make_uint1(unsigned int x) { uint1 t; t.x = x; return t; };
126 inline uint2 make_uint2(unsigned int x, unsigned int y) { uint2 t; t.x = x; t.y = y; return t; };
127 inline uint3 make_uint3(unsigned int x, unsigned int y, unsigned int z) { uint3 t; t.x = x; t.y = y; t.z = z; return t; };
128 inline uint4 make_uint4(unsigned int x, unsigned int y, unsigned int z, unsigned int w) { uint4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
129 
130 inline long1 make_long1(long int x) { long1 t; t.x = x; return t; };
131 inline long2 make_long2(long int x, long int y) { long2 t; t.x = x; t.y = y; return t; };
132 inline long3 make_long3(long int x, long int y, long int z) { long3 t; t.x = x; t.y = y; t.z = z; return t; };
133 inline long4 make_long4(long int x, long int y, long int z, long int w) { long4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
134 
135 inline ulong1 make_ulong1(unsigned long int x) { ulong1 t; t.x = x; return t; };
136 inline ulong2 make_ulong2(unsigned long int x, unsigned long int y) { ulong2 t; t.x = x; t.y = y; return t; };
137 inline ulong3 make_ulong3(unsigned long int x, unsigned long int y, unsigned long int z) { ulong3 t; t.x = x; t.y = y; t.z = z; return t; };
138 inline ulong4 make_ulong4(unsigned long int x, unsigned long int y, unsigned long int z, unsigned long int w) { ulong4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
139 
140 inline longlong1 make_longlong1(long long int x) { longlong1 t; t.x = x; return t; };
141 inline longlong2 make_longlong2(long long int x, long long int y) { longlong2 t; t.x = x; t.y = y; return t; };
142 inline longlong3 make_longlong3(long long int x, long long int y, long long int z) { longlong3 t; t.x = x; t.y = y; t.z = z; return t; };
143 inline longlong4 make_longlong4(long long int x, long long int y, long long int z, long long int w) { longlong4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
144 
145 inline ulonglong1 make_ulonglong1(unsigned long long int x) { ulonglong1 t; t.x = x; return t; };
146 inline ulonglong2 make_ulonglong2(unsigned long long int x, unsigned long long int y) { ulonglong2 t; t.x = x; t.y = y; return t; };
147 inline ulonglong3 make_ulonglong3(unsigned long long int x, unsigned long long int y, unsigned long long int z) { ulonglong3 t; t.x = x; t.y = y; t.z = z; return t; };
148 inline ulonglong4 make_ulonglong4(unsigned long long int x, unsigned long long int y, unsigned long long int z, unsigned long long int w) { ulonglong4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
149 
150 inline float1 make_float1(float x) { float1 t; t.x = x; return t; };
151 inline float2 make_float2(float x, float y) { float2 t; t.x = x; t.y = y; return t; };
152 inline float3 make_float3(float x, float y, float z) { float3 t; t.x = x; t.y = y; t.z = z; return t; };
153 inline float4 make_float4(float x, float y, float z, float w) { float4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };
154 
155 inline double1 make_double1(double x) { double1 t; t.x = x; return t; };
156 inline double2 make_double2(double x, double y) { double2 t; t.x = x; t.y = y; return t; };
157 inline double3 make_double3(double x, double y, double z) { double3 t; t.x = x; t.y = y; t.z = z; return t; };
158 inline double4 make_double4(double x, double y, double z, double w) { double4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t; };