xref: /aosp_15_r20/external/swiftshader/src/Reactor/Reactor.hpp (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1*03ce13f7SAndroid Build Coastguard Worker // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2*03ce13f7SAndroid Build Coastguard Worker //
3*03ce13f7SAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License");
4*03ce13f7SAndroid Build Coastguard Worker // you may not use this file except in compliance with the License.
5*03ce13f7SAndroid Build Coastguard Worker // You may obtain a copy of the License at
6*03ce13f7SAndroid Build Coastguard Worker //
7*03ce13f7SAndroid Build Coastguard Worker //    http://www.apache.org/licenses/LICENSE-2.0
8*03ce13f7SAndroid Build Coastguard Worker //
9*03ce13f7SAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software
10*03ce13f7SAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS,
11*03ce13f7SAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*03ce13f7SAndroid Build Coastguard Worker // See the License for the specific language governing permissions and
13*03ce13f7SAndroid Build Coastguard Worker // limitations under the License.
14*03ce13f7SAndroid Build Coastguard Worker 
15*03ce13f7SAndroid Build Coastguard Worker #ifndef rr_Reactor_hpp
16*03ce13f7SAndroid Build Coastguard Worker #define rr_Reactor_hpp
17*03ce13f7SAndroid Build Coastguard Worker 
18*03ce13f7SAndroid Build Coastguard Worker #include "Nucleus.hpp"
19*03ce13f7SAndroid Build Coastguard Worker #include "Pragma.hpp"
20*03ce13f7SAndroid Build Coastguard Worker #include "Routine.hpp"
21*03ce13f7SAndroid Build Coastguard Worker #include "Swizzle.hpp"
22*03ce13f7SAndroid Build Coastguard Worker #include "Traits.hpp"
23*03ce13f7SAndroid Build Coastguard Worker 
24*03ce13f7SAndroid Build Coastguard Worker #include <array>
25*03ce13f7SAndroid Build Coastguard Worker #include <cassert>
26*03ce13f7SAndroid Build Coastguard Worker #include <cmath>
27*03ce13f7SAndroid Build Coastguard Worker #include <cstddef>
28*03ce13f7SAndroid Build Coastguard Worker #include <cstdio>
29*03ce13f7SAndroid Build Coastguard Worker #include <limits>
30*03ce13f7SAndroid Build Coastguard Worker #include <tuple>
31*03ce13f7SAndroid Build Coastguard Worker #include <unordered_map>
32*03ce13f7SAndroid Build Coastguard Worker 
33*03ce13f7SAndroid Build Coastguard Worker #ifdef ENABLE_RR_DEBUG_INFO
34*03ce13f7SAndroid Build Coastguard Worker // Functions used for generating JIT debug info.
35*03ce13f7SAndroid Build Coastguard Worker // See docs/ReactorDebugInfo.md for more information.
36*03ce13f7SAndroid Build Coastguard Worker namespace rr {
37*03ce13f7SAndroid Build Coastguard Worker // Update the current source location for debug.
38*03ce13f7SAndroid Build Coastguard Worker void EmitDebugLocation();
39*03ce13f7SAndroid Build Coastguard Worker // Bind value to its symbolic name taken from the backtrace.
40*03ce13f7SAndroid Build Coastguard Worker void EmitDebugVariable(class Value *value);
41*03ce13f7SAndroid Build Coastguard Worker // Flush any pending variable bindings before the line ends.
42*03ce13f7SAndroid Build Coastguard Worker void FlushDebug();
43*03ce13f7SAndroid Build Coastguard Worker }  // namespace rr
44*03ce13f7SAndroid Build Coastguard Worker #	define RR_DEBUG_INFO_UPDATE_LOC() rr::EmitDebugLocation()
45*03ce13f7SAndroid Build Coastguard Worker #	define RR_DEBUG_INFO_EMIT_VAR(value) rr::EmitDebugVariable(value)
46*03ce13f7SAndroid Build Coastguard Worker #	define RR_DEBUG_INFO_FLUSH() rr::FlushDebug()
47*03ce13f7SAndroid Build Coastguard Worker #else
48*03ce13f7SAndroid Build Coastguard Worker #	define RR_DEBUG_INFO_UPDATE_LOC()
49*03ce13f7SAndroid Build Coastguard Worker #	define RR_DEBUG_INFO_EMIT_VAR(value)
50*03ce13f7SAndroid Build Coastguard Worker #	define RR_DEBUG_INFO_FLUSH()
51*03ce13f7SAndroid Build Coastguard Worker #endif  // ENABLE_RR_DEBUG_INFO
52*03ce13f7SAndroid Build Coastguard Worker 
53*03ce13f7SAndroid Build Coastguard Worker #ifdef ENABLE_RR_PRINT
54*03ce13f7SAndroid Build Coastguard Worker namespace rr {
55*03ce13f7SAndroid Build Coastguard Worker int DebugPrintf(const char *format, ...);
56*03ce13f7SAndroid Build Coastguard Worker }
57*03ce13f7SAndroid Build Coastguard Worker #endif
58*03ce13f7SAndroid Build Coastguard Worker 
59*03ce13f7SAndroid Build Coastguard Worker // A Clang extension to determine compiler features.
60*03ce13f7SAndroid Build Coastguard Worker // We use it to detect Sanitizer builds (e.g. -fsanitize=memory).
61*03ce13f7SAndroid Build Coastguard Worker #ifndef __has_feature
62*03ce13f7SAndroid Build Coastguard Worker #	define __has_feature(x) 0
63*03ce13f7SAndroid Build Coastguard Worker #endif
64*03ce13f7SAndroid Build Coastguard Worker 
65*03ce13f7SAndroid Build Coastguard Worker namespace rr {
66*03ce13f7SAndroid Build Coastguard Worker 
67*03ce13f7SAndroid Build Coastguard Worker struct Caps
68*03ce13f7SAndroid Build Coastguard Worker {
69*03ce13f7SAndroid Build Coastguard Worker 	static std::string backendName();
70*03ce13f7SAndroid Build Coastguard Worker 	static bool coroutinesSupported();  // Support for rr::Coroutine<F>
71*03ce13f7SAndroid Build Coastguard Worker 	static bool fmaIsFast();            // rr::FMA() is faster than `x * y + z`
72*03ce13f7SAndroid Build Coastguard Worker };
73*03ce13f7SAndroid Build Coastguard Worker 
74*03ce13f7SAndroid Build Coastguard Worker class Bool;
75*03ce13f7SAndroid Build Coastguard Worker class Byte;
76*03ce13f7SAndroid Build Coastguard Worker class SByte;
77*03ce13f7SAndroid Build Coastguard Worker class Byte4;
78*03ce13f7SAndroid Build Coastguard Worker class SByte4;
79*03ce13f7SAndroid Build Coastguard Worker class Byte8;
80*03ce13f7SAndroid Build Coastguard Worker class SByte8;
81*03ce13f7SAndroid Build Coastguard Worker class Byte16;
82*03ce13f7SAndroid Build Coastguard Worker class SByte16;
83*03ce13f7SAndroid Build Coastguard Worker class Short;
84*03ce13f7SAndroid Build Coastguard Worker class UShort;
85*03ce13f7SAndroid Build Coastguard Worker class Short2;
86*03ce13f7SAndroid Build Coastguard Worker class UShort2;
87*03ce13f7SAndroid Build Coastguard Worker class Short4;
88*03ce13f7SAndroid Build Coastguard Worker class UShort4;
89*03ce13f7SAndroid Build Coastguard Worker class Short8;
90*03ce13f7SAndroid Build Coastguard Worker class UShort8;
91*03ce13f7SAndroid Build Coastguard Worker class Int;
92*03ce13f7SAndroid Build Coastguard Worker class UInt;
93*03ce13f7SAndroid Build Coastguard Worker class Int2;
94*03ce13f7SAndroid Build Coastguard Worker class UInt2;
95*03ce13f7SAndroid Build Coastguard Worker class Int4;
96*03ce13f7SAndroid Build Coastguard Worker class UInt4;
97*03ce13f7SAndroid Build Coastguard Worker class Long;
98*03ce13f7SAndroid Build Coastguard Worker class Half;
99*03ce13f7SAndroid Build Coastguard Worker class Float;
100*03ce13f7SAndroid Build Coastguard Worker class Float2;
101*03ce13f7SAndroid Build Coastguard Worker class Float4;
102*03ce13f7SAndroid Build Coastguard Worker 
103*03ce13f7SAndroid Build Coastguard Worker namespace SIMD {
104*03ce13f7SAndroid Build Coastguard Worker class Int;
105*03ce13f7SAndroid Build Coastguard Worker class UInt;
106*03ce13f7SAndroid Build Coastguard Worker class Float;
107*03ce13f7SAndroid Build Coastguard Worker }  // namespace SIMD
108*03ce13f7SAndroid Build Coastguard Worker 
109*03ce13f7SAndroid Build Coastguard Worker template<>
110*03ce13f7SAndroid Build Coastguard Worker struct Scalar<Float4>
111*03ce13f7SAndroid Build Coastguard Worker {
112*03ce13f7SAndroid Build Coastguard Worker 	using Type = Float;
113*03ce13f7SAndroid Build Coastguard Worker };
114*03ce13f7SAndroid Build Coastguard Worker 
115*03ce13f7SAndroid Build Coastguard Worker template<>
116*03ce13f7SAndroid Build Coastguard Worker struct Scalar<Int4>
117*03ce13f7SAndroid Build Coastguard Worker {
118*03ce13f7SAndroid Build Coastguard Worker 	using Type = Int;
119*03ce13f7SAndroid Build Coastguard Worker };
120*03ce13f7SAndroid Build Coastguard Worker 
121*03ce13f7SAndroid Build Coastguard Worker template<>
122*03ce13f7SAndroid Build Coastguard Worker struct Scalar<UInt4>
123*03ce13f7SAndroid Build Coastguard Worker {
124*03ce13f7SAndroid Build Coastguard Worker 	using Type = UInt;
125*03ce13f7SAndroid Build Coastguard Worker };
126*03ce13f7SAndroid Build Coastguard Worker 
127*03ce13f7SAndroid Build Coastguard Worker template<>
128*03ce13f7SAndroid Build Coastguard Worker struct Scalar<SIMD::Float>
129*03ce13f7SAndroid Build Coastguard Worker {
130*03ce13f7SAndroid Build Coastguard Worker 	using Type = Float;
131*03ce13f7SAndroid Build Coastguard Worker };
132*03ce13f7SAndroid Build Coastguard Worker 
133*03ce13f7SAndroid Build Coastguard Worker template<>
134*03ce13f7SAndroid Build Coastguard Worker struct Scalar<SIMD::Int>
135*03ce13f7SAndroid Build Coastguard Worker {
136*03ce13f7SAndroid Build Coastguard Worker 	using Type = Int;
137*03ce13f7SAndroid Build Coastguard Worker };
138*03ce13f7SAndroid Build Coastguard Worker 
139*03ce13f7SAndroid Build Coastguard Worker template<>
140*03ce13f7SAndroid Build Coastguard Worker struct Scalar<SIMD::UInt>
141*03ce13f7SAndroid Build Coastguard Worker {
142*03ce13f7SAndroid Build Coastguard Worker 	using Type = UInt;
143*03ce13f7SAndroid Build Coastguard Worker };
144*03ce13f7SAndroid Build Coastguard Worker 
145*03ce13f7SAndroid Build Coastguard Worker class Void
146*03ce13f7SAndroid Build Coastguard Worker {
147*03ce13f7SAndroid Build Coastguard Worker public:
148*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
149*03ce13f7SAndroid Build Coastguard Worker };
150*03ce13f7SAndroid Build Coastguard Worker 
151*03ce13f7SAndroid Build Coastguard Worker template<class T>
152*03ce13f7SAndroid Build Coastguard Worker class RValue;
153*03ce13f7SAndroid Build Coastguard Worker 
154*03ce13f7SAndroid Build Coastguard Worker template<class T>
155*03ce13f7SAndroid Build Coastguard Worker class Pointer;
156*03ce13f7SAndroid Build Coastguard Worker 
157*03ce13f7SAndroid Build Coastguard Worker class Variable
158*03ce13f7SAndroid Build Coastguard Worker {
159*03ce13f7SAndroid Build Coastguard Worker 	friend class Nucleus;
160*03ce13f7SAndroid Build Coastguard Worker 
161*03ce13f7SAndroid Build Coastguard Worker 	Variable() = delete;
162*03ce13f7SAndroid Build Coastguard Worker 	Variable &operator=(const Variable &) = delete;
163*03ce13f7SAndroid Build Coastguard Worker 
164*03ce13f7SAndroid Build Coastguard Worker public:
165*03ce13f7SAndroid Build Coastguard Worker 	void materialize() const;
166*03ce13f7SAndroid Build Coastguard Worker 
167*03ce13f7SAndroid Build Coastguard Worker 	Value *loadValue() const;
168*03ce13f7SAndroid Build Coastguard Worker 	Value *storeValue(Value *value) const;
169*03ce13f7SAndroid Build Coastguard Worker 
170*03ce13f7SAndroid Build Coastguard Worker 	Value *getBaseAddress() const;
171*03ce13f7SAndroid Build Coastguard Worker 	Value *getElementPointer(Value *index, bool unsignedIndex) const;
172*03ce13f7SAndroid Build Coastguard Worker 
getType() const173*03ce13f7SAndroid Build Coastguard Worker 	Type *getType() const { return type; }
getArraySize() const174*03ce13f7SAndroid Build Coastguard Worker 	int getArraySize() const { return arraySize; }
175*03ce13f7SAndroid Build Coastguard Worker 
176*03ce13f7SAndroid Build Coastguard Worker 	// This function is only public for testing purposes, as it affects performance.
177*03ce13f7SAndroid Build Coastguard Worker 	// It is not considered part of Reactor's public API.
178*03ce13f7SAndroid Build Coastguard Worker 	static void materializeAll();
179*03ce13f7SAndroid Build Coastguard Worker 
180*03ce13f7SAndroid Build Coastguard Worker protected:
181*03ce13f7SAndroid Build Coastguard Worker 	Variable(Type *type, int arraySize);
182*03ce13f7SAndroid Build Coastguard Worker 	Variable(const Variable &) = default;
183*03ce13f7SAndroid Build Coastguard Worker 
184*03ce13f7SAndroid Build Coastguard Worker 	virtual ~Variable();
185*03ce13f7SAndroid Build Coastguard Worker 
186*03ce13f7SAndroid Build Coastguard Worker private:
187*03ce13f7SAndroid Build Coastguard Worker 	static void killUnmaterialized();
188*03ce13f7SAndroid Build Coastguard Worker 
189*03ce13f7SAndroid Build Coastguard Worker 	// Set of variables that do not have a stack location yet.
190*03ce13f7SAndroid Build Coastguard Worker 	class UnmaterializedVariables
191*03ce13f7SAndroid Build Coastguard Worker 	{
192*03ce13f7SAndroid Build Coastguard Worker 	public:
193*03ce13f7SAndroid Build Coastguard Worker 		void add(const Variable *v);
194*03ce13f7SAndroid Build Coastguard Worker 		void remove(const Variable *v);
195*03ce13f7SAndroid Build Coastguard Worker 		void clear();
196*03ce13f7SAndroid Build Coastguard Worker 		void materializeAll();
197*03ce13f7SAndroid Build Coastguard Worker 
198*03ce13f7SAndroid Build Coastguard Worker 	private:
199*03ce13f7SAndroid Build Coastguard Worker 		int counter = 0;
200*03ce13f7SAndroid Build Coastguard Worker 		std::unordered_map<const Variable *, int> variables;
201*03ce13f7SAndroid Build Coastguard Worker 	};
202*03ce13f7SAndroid Build Coastguard Worker 
203*03ce13f7SAndroid Build Coastguard Worker 	// This has to be a raw pointer because glibc 2.17 doesn't support __cxa_thread_atexit_impl
204*03ce13f7SAndroid Build Coastguard Worker 	// for destructing objects at exit. See crbug.com/1074222
205*03ce13f7SAndroid Build Coastguard Worker 	static thread_local UnmaterializedVariables *unmaterializedVariables;
206*03ce13f7SAndroid Build Coastguard Worker 
207*03ce13f7SAndroid Build Coastguard Worker 	Type *const type;
208*03ce13f7SAndroid Build Coastguard Worker 	const int arraySize;
209*03ce13f7SAndroid Build Coastguard Worker 	mutable Value *rvalue = nullptr;
210*03ce13f7SAndroid Build Coastguard Worker 	mutable Value *address = nullptr;
211*03ce13f7SAndroid Build Coastguard Worker };
212*03ce13f7SAndroid Build Coastguard Worker 
213*03ce13f7SAndroid Build Coastguard Worker template<class T>
214*03ce13f7SAndroid Build Coastguard Worker class LValue : public Variable
215*03ce13f7SAndroid Build Coastguard Worker {
216*03ce13f7SAndroid Build Coastguard Worker public:
217*03ce13f7SAndroid Build Coastguard Worker 	LValue(int arraySize = 0);
218*03ce13f7SAndroid Build Coastguard Worker 
219*03ce13f7SAndroid Build Coastguard Worker 	RValue<Pointer<T>> operator&();
220*03ce13f7SAndroid Build Coastguard Worker 
load() const221*03ce13f7SAndroid Build Coastguard Worker 	RValue<T> load() const
222*03ce13f7SAndroid Build Coastguard Worker 	{
223*03ce13f7SAndroid Build Coastguard Worker 		return RValue<T>(this->loadValue());
224*03ce13f7SAndroid Build Coastguard Worker 	}
225*03ce13f7SAndroid Build Coastguard Worker 
store(RValue<T> rvalue) const226*03ce13f7SAndroid Build Coastguard Worker 	RValue<T> store(RValue<T> rvalue) const
227*03ce13f7SAndroid Build Coastguard Worker 	{
228*03ce13f7SAndroid Build Coastguard Worker 		this->storeValue(rvalue.value());
229*03ce13f7SAndroid Build Coastguard Worker 
230*03ce13f7SAndroid Build Coastguard Worker 		return rvalue;
231*03ce13f7SAndroid Build Coastguard Worker 	}
232*03ce13f7SAndroid Build Coastguard Worker 
233*03ce13f7SAndroid Build Coastguard Worker 	// self() returns the this pointer to this LValue<T> object.
234*03ce13f7SAndroid Build Coastguard Worker 	// This function exists because operator&() is overloaded.
self()235*03ce13f7SAndroid Build Coastguard Worker 	inline LValue<T> *self() { return this; }
236*03ce13f7SAndroid Build Coastguard Worker };
237*03ce13f7SAndroid Build Coastguard Worker 
238*03ce13f7SAndroid Build Coastguard Worker template<class T>
239*03ce13f7SAndroid Build Coastguard Worker class Reference
240*03ce13f7SAndroid Build Coastguard Worker {
241*03ce13f7SAndroid Build Coastguard Worker public:
242*03ce13f7SAndroid Build Coastguard Worker 	using reference_underlying_type = T;
243*03ce13f7SAndroid Build Coastguard Worker 
244*03ce13f7SAndroid Build Coastguard Worker 	explicit Reference(Value *pointer, int alignment = 1);
245*03ce13f7SAndroid Build Coastguard Worker 	Reference(const Reference<T> &ref) = default;
246*03ce13f7SAndroid Build Coastguard Worker 
247*03ce13f7SAndroid Build Coastguard Worker 	RValue<T> operator=(RValue<T> rhs) const;
248*03ce13f7SAndroid Build Coastguard Worker 	RValue<T> operator=(const Reference<T> &ref) const;
249*03ce13f7SAndroid Build Coastguard Worker 
250*03ce13f7SAndroid Build Coastguard Worker 	RValue<T> operator+=(RValue<T> rhs) const;
251*03ce13f7SAndroid Build Coastguard Worker 
operator &() const252*03ce13f7SAndroid Build Coastguard Worker 	RValue<Pointer<T>> operator&() const { return RValue<Pointer<T>>(address); }
253*03ce13f7SAndroid Build Coastguard Worker 
254*03ce13f7SAndroid Build Coastguard Worker 	Value *loadValue() const;
255*03ce13f7SAndroid Build Coastguard Worker 	RValue<T> load() const;
256*03ce13f7SAndroid Build Coastguard Worker 	int getAlignment() const;
257*03ce13f7SAndroid Build Coastguard Worker 
258*03ce13f7SAndroid Build Coastguard Worker private:
259*03ce13f7SAndroid Build Coastguard Worker 	Value *const address;
260*03ce13f7SAndroid Build Coastguard Worker 
261*03ce13f7SAndroid Build Coastguard Worker 	const int alignment;
262*03ce13f7SAndroid Build Coastguard Worker };
263*03ce13f7SAndroid Build Coastguard Worker 
264*03ce13f7SAndroid Build Coastguard Worker template<class T>
265*03ce13f7SAndroid Build Coastguard Worker struct BoolLiteral
266*03ce13f7SAndroid Build Coastguard Worker {
267*03ce13f7SAndroid Build Coastguard Worker 	struct Type;
268*03ce13f7SAndroid Build Coastguard Worker };
269*03ce13f7SAndroid Build Coastguard Worker 
270*03ce13f7SAndroid Build Coastguard Worker template<>
271*03ce13f7SAndroid Build Coastguard Worker struct BoolLiteral<Bool>
272*03ce13f7SAndroid Build Coastguard Worker {
273*03ce13f7SAndroid Build Coastguard Worker 	using Type = bool;
274*03ce13f7SAndroid Build Coastguard Worker };
275*03ce13f7SAndroid Build Coastguard Worker 
276*03ce13f7SAndroid Build Coastguard Worker template<class T>
277*03ce13f7SAndroid Build Coastguard Worker struct IntLiteral
278*03ce13f7SAndroid Build Coastguard Worker {
279*03ce13f7SAndroid Build Coastguard Worker 	struct Type;
280*03ce13f7SAndroid Build Coastguard Worker };
281*03ce13f7SAndroid Build Coastguard Worker 
282*03ce13f7SAndroid Build Coastguard Worker template<>
283*03ce13f7SAndroid Build Coastguard Worker struct IntLiteral<Int>
284*03ce13f7SAndroid Build Coastguard Worker {
285*03ce13f7SAndroid Build Coastguard Worker 	using Type = int;
286*03ce13f7SAndroid Build Coastguard Worker };
287*03ce13f7SAndroid Build Coastguard Worker 
288*03ce13f7SAndroid Build Coastguard Worker template<>
289*03ce13f7SAndroid Build Coastguard Worker struct IntLiteral<UInt>
290*03ce13f7SAndroid Build Coastguard Worker {
291*03ce13f7SAndroid Build Coastguard Worker 	using Type = unsigned int;
292*03ce13f7SAndroid Build Coastguard Worker };
293*03ce13f7SAndroid Build Coastguard Worker 
294*03ce13f7SAndroid Build Coastguard Worker template<class T>
295*03ce13f7SAndroid Build Coastguard Worker struct LongLiteral
296*03ce13f7SAndroid Build Coastguard Worker {
297*03ce13f7SAndroid Build Coastguard Worker 	struct Type;
298*03ce13f7SAndroid Build Coastguard Worker };
299*03ce13f7SAndroid Build Coastguard Worker 
300*03ce13f7SAndroid Build Coastguard Worker template<>
301*03ce13f7SAndroid Build Coastguard Worker struct LongLiteral<Long>
302*03ce13f7SAndroid Build Coastguard Worker {
303*03ce13f7SAndroid Build Coastguard Worker 	using Type = int64_t;
304*03ce13f7SAndroid Build Coastguard Worker };
305*03ce13f7SAndroid Build Coastguard Worker 
306*03ce13f7SAndroid Build Coastguard Worker template<class T>
307*03ce13f7SAndroid Build Coastguard Worker struct FloatLiteral
308*03ce13f7SAndroid Build Coastguard Worker {
309*03ce13f7SAndroid Build Coastguard Worker 	struct Type;
310*03ce13f7SAndroid Build Coastguard Worker };
311*03ce13f7SAndroid Build Coastguard Worker 
312*03ce13f7SAndroid Build Coastguard Worker template<>
313*03ce13f7SAndroid Build Coastguard Worker struct FloatLiteral<Float>
314*03ce13f7SAndroid Build Coastguard Worker {
315*03ce13f7SAndroid Build Coastguard Worker 	using Type = float;
316*03ce13f7SAndroid Build Coastguard Worker };
317*03ce13f7SAndroid Build Coastguard Worker 
318*03ce13f7SAndroid Build Coastguard Worker template<class T>
319*03ce13f7SAndroid Build Coastguard Worker struct BroadcastLiteral
320*03ce13f7SAndroid Build Coastguard Worker {
321*03ce13f7SAndroid Build Coastguard Worker 	struct Type;
322*03ce13f7SAndroid Build Coastguard Worker };
323*03ce13f7SAndroid Build Coastguard Worker 
324*03ce13f7SAndroid Build Coastguard Worker template<>
325*03ce13f7SAndroid Build Coastguard Worker struct BroadcastLiteral<Int4>
326*03ce13f7SAndroid Build Coastguard Worker {
327*03ce13f7SAndroid Build Coastguard Worker 	using Type = int;
328*03ce13f7SAndroid Build Coastguard Worker };
329*03ce13f7SAndroid Build Coastguard Worker 
330*03ce13f7SAndroid Build Coastguard Worker template<>
331*03ce13f7SAndroid Build Coastguard Worker struct BroadcastLiteral<UInt4>
332*03ce13f7SAndroid Build Coastguard Worker {
333*03ce13f7SAndroid Build Coastguard Worker 	using Type = unsigned int;
334*03ce13f7SAndroid Build Coastguard Worker };
335*03ce13f7SAndroid Build Coastguard Worker 
336*03ce13f7SAndroid Build Coastguard Worker template<>
337*03ce13f7SAndroid Build Coastguard Worker struct BroadcastLiteral<Float4>
338*03ce13f7SAndroid Build Coastguard Worker {
339*03ce13f7SAndroid Build Coastguard Worker 	using Type = float;
340*03ce13f7SAndroid Build Coastguard Worker };
341*03ce13f7SAndroid Build Coastguard Worker 
342*03ce13f7SAndroid Build Coastguard Worker template<>
343*03ce13f7SAndroid Build Coastguard Worker struct BroadcastLiteral<SIMD::Int>
344*03ce13f7SAndroid Build Coastguard Worker {
345*03ce13f7SAndroid Build Coastguard Worker 	using Type = int;
346*03ce13f7SAndroid Build Coastguard Worker };
347*03ce13f7SAndroid Build Coastguard Worker 
348*03ce13f7SAndroid Build Coastguard Worker template<>
349*03ce13f7SAndroid Build Coastguard Worker struct BroadcastLiteral<SIMD::UInt>
350*03ce13f7SAndroid Build Coastguard Worker {
351*03ce13f7SAndroid Build Coastguard Worker 	using Type = unsigned int;
352*03ce13f7SAndroid Build Coastguard Worker };
353*03ce13f7SAndroid Build Coastguard Worker 
354*03ce13f7SAndroid Build Coastguard Worker template<>
355*03ce13f7SAndroid Build Coastguard Worker struct BroadcastLiteral<SIMD::Float>
356*03ce13f7SAndroid Build Coastguard Worker {
357*03ce13f7SAndroid Build Coastguard Worker 	using Type = float;
358*03ce13f7SAndroid Build Coastguard Worker };
359*03ce13f7SAndroid Build Coastguard Worker 
360*03ce13f7SAndroid Build Coastguard Worker template<class T>
361*03ce13f7SAndroid Build Coastguard Worker class RValue
362*03ce13f7SAndroid Build Coastguard Worker {
363*03ce13f7SAndroid Build Coastguard Worker public:
364*03ce13f7SAndroid Build Coastguard Worker 	using rvalue_underlying_type = T;
365*03ce13f7SAndroid Build Coastguard Worker 
366*03ce13f7SAndroid Build Coastguard Worker 	explicit RValue(Value *rvalue);
367*03ce13f7SAndroid Build Coastguard Worker 
368*03ce13f7SAndroid Build Coastguard Worker 	RValue(const RValue<T> &rvalue);
369*03ce13f7SAndroid Build Coastguard Worker 	RValue(const T &lvalue);
370*03ce13f7SAndroid Build Coastguard Worker 	RValue(typename BoolLiteral<T>::Type b);
371*03ce13f7SAndroid Build Coastguard Worker 	RValue(typename IntLiteral<T>::Type i);
372*03ce13f7SAndroid Build Coastguard Worker 	RValue(typename LongLiteral<T>::Type i);
373*03ce13f7SAndroid Build Coastguard Worker 	RValue(typename FloatLiteral<T>::Type f);
374*03ce13f7SAndroid Build Coastguard Worker 	RValue(typename BroadcastLiteral<T>::Type x);
375*03ce13f7SAndroid Build Coastguard Worker 	RValue(const Reference<T> &rhs);
376*03ce13f7SAndroid Build Coastguard Worker 
377*03ce13f7SAndroid Build Coastguard Worker 	// Rvalues cannot be assigned to: "(a + b) = c;"
378*03ce13f7SAndroid Build Coastguard Worker 	RValue<T> &operator=(const RValue<T> &) = delete;
379*03ce13f7SAndroid Build Coastguard Worker 
value() const380*03ce13f7SAndroid Build Coastguard Worker 	Value *value() const { return val; }
381*03ce13f7SAndroid Build Coastguard Worker 
element_count()382*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return T::element_count(); }
383*03ce13f7SAndroid Build Coastguard Worker 
384*03ce13f7SAndroid Build Coastguard Worker private:
385*03ce13f7SAndroid Build Coastguard Worker 	Value *const val;
386*03ce13f7SAndroid Build Coastguard Worker };
387*03ce13f7SAndroid Build Coastguard Worker 
388*03ce13f7SAndroid Build Coastguard Worker template<typename T>
389*03ce13f7SAndroid Build Coastguard Worker class Argument
390*03ce13f7SAndroid Build Coastguard Worker {
391*03ce13f7SAndroid Build Coastguard Worker public:
Argument(Value * val)392*03ce13f7SAndroid Build Coastguard Worker 	explicit Argument(Value *val)
393*03ce13f7SAndroid Build Coastguard Worker 	    : val(val)
394*03ce13f7SAndroid Build Coastguard Worker 	{}
395*03ce13f7SAndroid Build Coastguard Worker 
rvalue() const396*03ce13f7SAndroid Build Coastguard Worker 	RValue<T> rvalue() const { return RValue<T>(val); }
397*03ce13f7SAndroid Build Coastguard Worker 
398*03ce13f7SAndroid Build Coastguard Worker private:
399*03ce13f7SAndroid Build Coastguard Worker 	Value *const val;
400*03ce13f7SAndroid Build Coastguard Worker };
401*03ce13f7SAndroid Build Coastguard Worker 
402*03ce13f7SAndroid Build Coastguard Worker class Bool : public LValue<Bool>
403*03ce13f7SAndroid Build Coastguard Worker {
404*03ce13f7SAndroid Build Coastguard Worker public:
405*03ce13f7SAndroid Build Coastguard Worker 	Bool(Argument<Bool> argument);
406*03ce13f7SAndroid Build Coastguard Worker 
407*03ce13f7SAndroid Build Coastguard Worker 	Bool() = default;
408*03ce13f7SAndroid Build Coastguard Worker 	Bool(bool x);
409*03ce13f7SAndroid Build Coastguard Worker 	Bool(RValue<Bool> rhs);
410*03ce13f7SAndroid Build Coastguard Worker 	Bool(const Bool &rhs);
411*03ce13f7SAndroid Build Coastguard Worker 	Bool(const Reference<Bool> &rhs);
412*03ce13f7SAndroid Build Coastguard Worker 
413*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Bool> operator=(bool rhs);   // FIXME: Implement
414*03ce13f7SAndroid Build Coastguard Worker 	RValue<Bool> operator=(RValue<Bool> rhs);
415*03ce13f7SAndroid Build Coastguard Worker 	RValue<Bool> operator=(const Bool &rhs);
416*03ce13f7SAndroid Build Coastguard Worker 	RValue<Bool> operator=(const Reference<Bool> &rhs);
417*03ce13f7SAndroid Build Coastguard Worker 
418*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
419*03ce13f7SAndroid Build Coastguard Worker };
420*03ce13f7SAndroid Build Coastguard Worker 
421*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!(RValue<Bool> val);
422*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs);
423*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs);
424*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!=(RValue<Bool> lhs, RValue<Bool> rhs);
425*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator==(RValue<Bool> lhs, RValue<Bool> rhs);
426*03ce13f7SAndroid Build Coastguard Worker 
427*03ce13f7SAndroid Build Coastguard Worker class Byte : public LValue<Byte>
428*03ce13f7SAndroid Build Coastguard Worker {
429*03ce13f7SAndroid Build Coastguard Worker public:
430*03ce13f7SAndroid Build Coastguard Worker 	Byte(Argument<Byte> argument);
431*03ce13f7SAndroid Build Coastguard Worker 
432*03ce13f7SAndroid Build Coastguard Worker 	explicit Byte(RValue<Int> cast);
433*03ce13f7SAndroid Build Coastguard Worker 	explicit Byte(RValue<UInt> cast);
434*03ce13f7SAndroid Build Coastguard Worker 	explicit Byte(RValue<UShort> cast);
435*03ce13f7SAndroid Build Coastguard Worker 
436*03ce13f7SAndroid Build Coastguard Worker 	Byte() = default;
437*03ce13f7SAndroid Build Coastguard Worker 	Byte(int x);
438*03ce13f7SAndroid Build Coastguard Worker 	Byte(unsigned char x);
439*03ce13f7SAndroid Build Coastguard Worker 	Byte(RValue<Byte> rhs);
440*03ce13f7SAndroid Build Coastguard Worker 	Byte(const Byte &rhs);
441*03ce13f7SAndroid Build Coastguard Worker 	Byte(const Reference<Byte> &rhs);
442*03ce13f7SAndroid Build Coastguard Worker 
443*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Byte> operator=(unsigned char rhs);   // FIXME: Implement
444*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte> operator=(RValue<Byte> rhs);
445*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte> operator=(const Byte &rhs);
446*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte> operator=(const Reference<Byte> &rhs);
447*03ce13f7SAndroid Build Coastguard Worker 
448*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
449*03ce13f7SAndroid Build Coastguard Worker };
450*03ce13f7SAndroid Build Coastguard Worker 
451*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs);
452*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs);
453*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs);
454*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs);
455*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs);
456*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs);
457*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs);
458*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs);
459*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs);
460*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs);
461*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator+=(Byte &lhs, RValue<Byte> rhs);
462*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator-=(Byte &lhs, RValue<Byte> rhs);
463*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator*=(Byte &lhs, RValue<Byte> rhs);
464*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator/=(Byte &lhs, RValue<Byte> rhs);
465*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator%=(Byte &lhs, RValue<Byte> rhs);
466*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator&=(Byte &lhs, RValue<Byte> rhs);
467*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator|=(Byte &lhs, RValue<Byte> rhs);
468*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator^=(Byte &lhs, RValue<Byte> rhs);
469*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator<<=(Byte &lhs, RValue<Byte> rhs);
470*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator>>=(Byte &lhs, RValue<Byte> rhs);
471*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator+(RValue<Byte> val);
472*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator-(RValue<Byte> val);
473*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator~(RValue<Byte> val);
474*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator++(Byte &val, int);  // Post-increment
475*03ce13f7SAndroid Build Coastguard Worker const Byte &operator++(Byte &val);        // Pre-increment
476*03ce13f7SAndroid Build Coastguard Worker RValue<Byte> operator--(Byte &val, int);  // Post-decrement
477*03ce13f7SAndroid Build Coastguard Worker const Byte &operator--(Byte &val);        // Pre-decrement
478*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs);
479*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs);
480*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs);
481*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs);
482*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs);
483*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs);
484*03ce13f7SAndroid Build Coastguard Worker 
485*03ce13f7SAndroid Build Coastguard Worker class SByte : public LValue<SByte>
486*03ce13f7SAndroid Build Coastguard Worker {
487*03ce13f7SAndroid Build Coastguard Worker public:
488*03ce13f7SAndroid Build Coastguard Worker 	SByte(Argument<SByte> argument);
489*03ce13f7SAndroid Build Coastguard Worker 
490*03ce13f7SAndroid Build Coastguard Worker 	explicit SByte(RValue<Int> cast);
491*03ce13f7SAndroid Build Coastguard Worker 	explicit SByte(RValue<Short> cast);
492*03ce13f7SAndroid Build Coastguard Worker 
493*03ce13f7SAndroid Build Coastguard Worker 	SByte() = default;
494*03ce13f7SAndroid Build Coastguard Worker 	SByte(signed char x);
495*03ce13f7SAndroid Build Coastguard Worker 	SByte(RValue<SByte> rhs);
496*03ce13f7SAndroid Build Coastguard Worker 	SByte(const SByte &rhs);
497*03ce13f7SAndroid Build Coastguard Worker 	SByte(const Reference<SByte> &rhs);
498*03ce13f7SAndroid Build Coastguard Worker 
499*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<SByte> operator=(signed char rhs);   // FIXME: Implement
500*03ce13f7SAndroid Build Coastguard Worker 	RValue<SByte> operator=(RValue<SByte> rhs);
501*03ce13f7SAndroid Build Coastguard Worker 	RValue<SByte> operator=(const SByte &rhs);
502*03ce13f7SAndroid Build Coastguard Worker 	RValue<SByte> operator=(const Reference<SByte> &rhs);
503*03ce13f7SAndroid Build Coastguard Worker 
504*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
505*03ce13f7SAndroid Build Coastguard Worker };
506*03ce13f7SAndroid Build Coastguard Worker 
507*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs);
508*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs);
509*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs);
510*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs);
511*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs);
512*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs);
513*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs);
514*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs);
515*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs);
516*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs);
517*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator+=(SByte &lhs, RValue<SByte> rhs);
518*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator-=(SByte &lhs, RValue<SByte> rhs);
519*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator*=(SByte &lhs, RValue<SByte> rhs);
520*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator/=(SByte &lhs, RValue<SByte> rhs);
521*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator%=(SByte &lhs, RValue<SByte> rhs);
522*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator&=(SByte &lhs, RValue<SByte> rhs);
523*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator|=(SByte &lhs, RValue<SByte> rhs);
524*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator^=(SByte &lhs, RValue<SByte> rhs);
525*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator<<=(SByte &lhs, RValue<SByte> rhs);
526*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator>>=(SByte &lhs, RValue<SByte> rhs);
527*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator+(RValue<SByte> val);
528*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator-(RValue<SByte> val);
529*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator~(RValue<SByte> val);
530*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator++(SByte &val, int);  // Post-increment
531*03ce13f7SAndroid Build Coastguard Worker const SByte &operator++(SByte &val);        // Pre-increment
532*03ce13f7SAndroid Build Coastguard Worker RValue<SByte> operator--(SByte &val, int);  // Post-decrement
533*03ce13f7SAndroid Build Coastguard Worker const SByte &operator--(SByte &val);        // Pre-decrement
534*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs);
535*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs);
536*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs);
537*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs);
538*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs);
539*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs);
540*03ce13f7SAndroid Build Coastguard Worker 
541*03ce13f7SAndroid Build Coastguard Worker class Short : public LValue<Short>
542*03ce13f7SAndroid Build Coastguard Worker {
543*03ce13f7SAndroid Build Coastguard Worker public:
544*03ce13f7SAndroid Build Coastguard Worker 	Short(Argument<Short> argument);
545*03ce13f7SAndroid Build Coastguard Worker 
546*03ce13f7SAndroid Build Coastguard Worker 	explicit Short(RValue<Int> cast);
547*03ce13f7SAndroid Build Coastguard Worker 
548*03ce13f7SAndroid Build Coastguard Worker 	Short() = default;
549*03ce13f7SAndroid Build Coastguard Worker 	Short(short x);
550*03ce13f7SAndroid Build Coastguard Worker 	Short(RValue<Short> rhs);
551*03ce13f7SAndroid Build Coastguard Worker 	Short(const Short &rhs);
552*03ce13f7SAndroid Build Coastguard Worker 	Short(const Reference<Short> &rhs);
553*03ce13f7SAndroid Build Coastguard Worker 
554*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Short> operator=(short rhs);   // FIXME: Implement
555*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short> operator=(RValue<Short> rhs);
556*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short> operator=(const Short &rhs);
557*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short> operator=(const Reference<Short> &rhs);
558*03ce13f7SAndroid Build Coastguard Worker 
559*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
560*03ce13f7SAndroid Build Coastguard Worker };
561*03ce13f7SAndroid Build Coastguard Worker 
562*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs);
563*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs);
564*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs);
565*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs);
566*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs);
567*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs);
568*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs);
569*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs);
570*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs);
571*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs);
572*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator+=(Short &lhs, RValue<Short> rhs);
573*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator-=(Short &lhs, RValue<Short> rhs);
574*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator*=(Short &lhs, RValue<Short> rhs);
575*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator/=(Short &lhs, RValue<Short> rhs);
576*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator%=(Short &lhs, RValue<Short> rhs);
577*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator&=(Short &lhs, RValue<Short> rhs);
578*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator|=(Short &lhs, RValue<Short> rhs);
579*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator^=(Short &lhs, RValue<Short> rhs);
580*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator<<=(Short &lhs, RValue<Short> rhs);
581*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator>>=(Short &lhs, RValue<Short> rhs);
582*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator+(RValue<Short> val);
583*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator-(RValue<Short> val);
584*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator~(RValue<Short> val);
585*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator++(Short &val, int);  // Post-increment
586*03ce13f7SAndroid Build Coastguard Worker const Short &operator++(Short &val);        // Pre-increment
587*03ce13f7SAndroid Build Coastguard Worker RValue<Short> operator--(Short &val, int);  // Post-decrement
588*03ce13f7SAndroid Build Coastguard Worker const Short &operator--(Short &val);        // Pre-decrement
589*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs);
590*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs);
591*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs);
592*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs);
593*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs);
594*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs);
595*03ce13f7SAndroid Build Coastguard Worker 
596*03ce13f7SAndroid Build Coastguard Worker class UShort : public LValue<UShort>
597*03ce13f7SAndroid Build Coastguard Worker {
598*03ce13f7SAndroid Build Coastguard Worker public:
599*03ce13f7SAndroid Build Coastguard Worker 	UShort(Argument<UShort> argument);
600*03ce13f7SAndroid Build Coastguard Worker 
601*03ce13f7SAndroid Build Coastguard Worker 	explicit UShort(RValue<UInt> cast);
602*03ce13f7SAndroid Build Coastguard Worker 	explicit UShort(RValue<Int> cast);
603*03ce13f7SAndroid Build Coastguard Worker 	explicit UShort(RValue<Byte> cast);
604*03ce13f7SAndroid Build Coastguard Worker 
605*03ce13f7SAndroid Build Coastguard Worker 	UShort() = default;
606*03ce13f7SAndroid Build Coastguard Worker 	UShort(unsigned short x);
607*03ce13f7SAndroid Build Coastguard Worker 	UShort(RValue<UShort> rhs);
608*03ce13f7SAndroid Build Coastguard Worker 	UShort(const UShort &rhs);
609*03ce13f7SAndroid Build Coastguard Worker 	UShort(const Reference<UShort> &rhs);
610*03ce13f7SAndroid Build Coastguard Worker 
611*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<UShort> operator=(unsigned short rhs);   // FIXME: Implement
612*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort> operator=(RValue<UShort> rhs);
613*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort> operator=(const UShort &rhs);
614*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort> operator=(const Reference<UShort> &rhs);
615*03ce13f7SAndroid Build Coastguard Worker 
616*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
617*03ce13f7SAndroid Build Coastguard Worker };
618*03ce13f7SAndroid Build Coastguard Worker 
619*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs);
620*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs);
621*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs);
622*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs);
623*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs);
624*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs);
625*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs);
626*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs);
627*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs);
628*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs);
629*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator+=(UShort &lhs, RValue<UShort> rhs);
630*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator-=(UShort &lhs, RValue<UShort> rhs);
631*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator*=(UShort &lhs, RValue<UShort> rhs);
632*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator/=(UShort &lhs, RValue<UShort> rhs);
633*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator%=(UShort &lhs, RValue<UShort> rhs);
634*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator&=(UShort &lhs, RValue<UShort> rhs);
635*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator|=(UShort &lhs, RValue<UShort> rhs);
636*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator^=(UShort &lhs, RValue<UShort> rhs);
637*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator<<=(UShort &lhs, RValue<UShort> rhs);
638*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator>>=(UShort &lhs, RValue<UShort> rhs);
639*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator+(RValue<UShort> val);
640*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator-(RValue<UShort> val);
641*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator~(RValue<UShort> val);
642*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator++(UShort &val, int);  // Post-increment
643*03ce13f7SAndroid Build Coastguard Worker const UShort &operator++(UShort &val);        // Pre-increment
644*03ce13f7SAndroid Build Coastguard Worker RValue<UShort> operator--(UShort &val, int);  // Post-decrement
645*03ce13f7SAndroid Build Coastguard Worker const UShort &operator--(UShort &val);        // Pre-decrement
646*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs);
647*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs);
648*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs);
649*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs);
650*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs);
651*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs);
652*03ce13f7SAndroid Build Coastguard Worker 
653*03ce13f7SAndroid Build Coastguard Worker class Byte4 : public LValue<Byte4>
654*03ce13f7SAndroid Build Coastguard Worker {
655*03ce13f7SAndroid Build Coastguard Worker public:
656*03ce13f7SAndroid Build Coastguard Worker 	explicit Byte4(RValue<Byte8> cast);
657*03ce13f7SAndroid Build Coastguard Worker 	explicit Byte4(RValue<UShort4> cast);
658*03ce13f7SAndroid Build Coastguard Worker 	explicit Byte4(RValue<Short4> cast);
659*03ce13f7SAndroid Build Coastguard Worker 	explicit Byte4(RValue<UInt4> cast);
660*03ce13f7SAndroid Build Coastguard Worker 	explicit Byte4(RValue<Int4> cast);
661*03ce13f7SAndroid Build Coastguard Worker 
662*03ce13f7SAndroid Build Coastguard Worker 	Byte4() = default;
663*03ce13f7SAndroid Build Coastguard Worker 	//	Byte4(int x, int y, int z, int w);
664*03ce13f7SAndroid Build Coastguard Worker 	Byte4(RValue<Byte4> rhs);
665*03ce13f7SAndroid Build Coastguard Worker 	Byte4(const Byte4 &rhs);
666*03ce13f7SAndroid Build Coastguard Worker 	Byte4(const Reference<Byte4> &rhs);
667*03ce13f7SAndroid Build Coastguard Worker 
668*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte4> operator=(RValue<Byte4> rhs);
669*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte4> operator=(const Byte4 &rhs);
670*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Byte4> operator=(const Reference<Byte4> &rhs);
671*03ce13f7SAndroid Build Coastguard Worker 
672*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()673*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 4; }
674*03ce13f7SAndroid Build Coastguard Worker };
675*03ce13f7SAndroid Build Coastguard Worker 
676*03ce13f7SAndroid Build Coastguard Worker RValue<Byte4> Insert(RValue<Byte4> val, RValue<Byte> element, int i);
677*03ce13f7SAndroid Build Coastguard Worker 
678*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator+(RValue<Byte4> lhs, RValue<Byte4> rhs);
679*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator-(RValue<Byte4> lhs, RValue<Byte4> rhs);
680*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator*(RValue<Byte4> lhs, RValue<Byte4> rhs);
681*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator/(RValue<Byte4> lhs, RValue<Byte4> rhs);
682*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator%(RValue<Byte4> lhs, RValue<Byte4> rhs);
683*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator&(RValue<Byte4> lhs, RValue<Byte4> rhs);
684*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator|(RValue<Byte4> lhs, RValue<Byte4> rhs);
685*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator^(RValue<Byte4> lhs, RValue<Byte4> rhs);
686*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator<<(RValue<Byte4> lhs, RValue<Byte4> rhs);
687*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator>>(RValue<Byte4> lhs, RValue<Byte4> rhs);
688*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator+=(Byte4 &lhs, RValue<Byte4> rhs);
689*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator-=(Byte4 &lhs, RValue<Byte4> rhs);
690*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator*=(Byte4 &lhs, RValue<Byte4> rhs);
691*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator/=(Byte4 &lhs, RValue<Byte4> rhs);
692*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator%=(Byte4 &lhs, RValue<Byte4> rhs);
693*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator&=(Byte4 &lhs, RValue<Byte4> rhs);
694*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator|=(Byte4 &lhs, RValue<Byte4> rhs);
695*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator^=(Byte4 &lhs, RValue<Byte4> rhs);
696*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator<<=(Byte4 &lhs, RValue<Byte4> rhs);
697*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator>>=(Byte4 &lhs, RValue<Byte4> rhs);
698*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator+(RValue<Byte4> val);
699*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator-(RValue<Byte4> val);
700*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator~(RValue<Byte4> val);
701*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator++(Byte4 &val, int);   // Post-increment
702*03ce13f7SAndroid Build Coastguard Worker //	const Byte4 &operator++(Byte4 &val);   // Pre-increment
703*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte4> operator--(Byte4 &val, int);   // Post-decrement
704*03ce13f7SAndroid Build Coastguard Worker //	const Byte4 &operator--(Byte4 &val);   // Pre-decrement
705*03ce13f7SAndroid Build Coastguard Worker 
706*03ce13f7SAndroid Build Coastguard Worker class SByte4 : public LValue<SByte4>
707*03ce13f7SAndroid Build Coastguard Worker {
708*03ce13f7SAndroid Build Coastguard Worker public:
709*03ce13f7SAndroid Build Coastguard Worker 	SByte4() = default;
710*03ce13f7SAndroid Build Coastguard Worker 	//	SByte4(int x, int y, int z, int w);
711*03ce13f7SAndroid Build Coastguard Worker 	//	SByte4(RValue<SByte4> rhs);
712*03ce13f7SAndroid Build Coastguard Worker 	//	SByte4(const SByte4 &rhs);
713*03ce13f7SAndroid Build Coastguard Worker 	//	SByte4(const Reference<SByte4> &rhs);
714*03ce13f7SAndroid Build Coastguard Worker 
715*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<SByte4> operator=(RValue<SByte4> rhs);
716*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<SByte4> operator=(const SByte4 &rhs);
717*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<SByte4> operator=(const Reference<SByte4> &rhs);
718*03ce13f7SAndroid Build Coastguard Worker 
719*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()720*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 4; }
721*03ce13f7SAndroid Build Coastguard Worker };
722*03ce13f7SAndroid Build Coastguard Worker 
723*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator+(RValue<SByte4> lhs, RValue<SByte4> rhs);
724*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator-(RValue<SByte4> lhs, RValue<SByte4> rhs);
725*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator*(RValue<SByte4> lhs, RValue<SByte4> rhs);
726*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator/(RValue<SByte4> lhs, RValue<SByte4> rhs);
727*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator%(RValue<SByte4> lhs, RValue<SByte4> rhs);
728*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator&(RValue<SByte4> lhs, RValue<SByte4> rhs);
729*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator|(RValue<SByte4> lhs, RValue<SByte4> rhs);
730*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator^(RValue<SByte4> lhs, RValue<SByte4> rhs);
731*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator<<(RValue<SByte4> lhs, RValue<SByte4> rhs);
732*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator>>(RValue<SByte4> lhs, RValue<SByte4> rhs);
733*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator+=(SByte4 &lhs, RValue<SByte4> rhs);
734*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator-=(SByte4 &lhs, RValue<SByte4> rhs);
735*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator*=(SByte4 &lhs, RValue<SByte4> rhs);
736*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator/=(SByte4 &lhs, RValue<SByte4> rhs);
737*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator%=(SByte4 &lhs, RValue<SByte4> rhs);
738*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator&=(SByte4 &lhs, RValue<SByte4> rhs);
739*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator|=(SByte4 &lhs, RValue<SByte4> rhs);
740*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator^=(SByte4 &lhs, RValue<SByte4> rhs);
741*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator<<=(SByte4 &lhs, RValue<SByte4> rhs);
742*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator>>=(SByte4 &lhs, RValue<SByte4> rhs);
743*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator+(RValue<SByte4> val);
744*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator-(RValue<SByte4> val);
745*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator~(RValue<SByte4> val);
746*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator++(SByte4 &val, int);   // Post-increment
747*03ce13f7SAndroid Build Coastguard Worker //	const SByte4 &operator++(SByte4 &val);   // Pre-increment
748*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte4> operator--(SByte4 &val, int);   // Post-decrement
749*03ce13f7SAndroid Build Coastguard Worker //	const SByte4 &operator--(SByte4 &val);   // Pre-decrement
750*03ce13f7SAndroid Build Coastguard Worker 
751*03ce13f7SAndroid Build Coastguard Worker class Byte8 : public LValue<Byte8>
752*03ce13f7SAndroid Build Coastguard Worker {
753*03ce13f7SAndroid Build Coastguard Worker public:
754*03ce13f7SAndroid Build Coastguard Worker 	Byte8() = default;
755*03ce13f7SAndroid Build Coastguard Worker 	Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7);
756*03ce13f7SAndroid Build Coastguard Worker 	Byte8(RValue<Byte8> rhs);
757*03ce13f7SAndroid Build Coastguard Worker 	Byte8(const Byte8 &rhs);
758*03ce13f7SAndroid Build Coastguard Worker 	Byte8(const Reference<Byte8> &rhs);
759*03ce13f7SAndroid Build Coastguard Worker 
760*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte8> operator=(RValue<Byte8> rhs);
761*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte8> operator=(const Byte8 &rhs);
762*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte8> operator=(const Reference<Byte8> &rhs);
763*03ce13f7SAndroid Build Coastguard Worker 
764*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()765*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 8; }
766*03ce13f7SAndroid Build Coastguard Worker };
767*03ce13f7SAndroid Build Coastguard Worker 
768*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs);
769*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs);
770*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs);
771*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs);
772*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs);
773*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs);
774*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs);
775*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs);
776*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator<<(RValue<Byte8> lhs, RValue<Byte8> rhs);
777*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator>>(RValue<Byte8> lhs, RValue<Byte8> rhs);
778*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator+=(Byte8 &lhs, RValue<Byte8> rhs);
779*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator-=(Byte8 &lhs, RValue<Byte8> rhs);
780*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator*=(Byte8 &lhs, RValue<Byte8> rhs);
781*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator/=(Byte8 &lhs, RValue<Byte8> rhs);
782*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator%=(Byte8 &lhs, RValue<Byte8> rhs);
783*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator&=(Byte8 &lhs, RValue<Byte8> rhs);
784*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator|=(Byte8 &lhs, RValue<Byte8> rhs);
785*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator^=(Byte8 &lhs, RValue<Byte8> rhs);
786*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator<<=(Byte8 &lhs, RValue<Byte8> rhs);
787*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator>>=(Byte8 &lhs, RValue<Byte8> rhs);
788*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator+(RValue<Byte8> val);
789*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator-(RValue<Byte8> val);
790*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> operator~(RValue<Byte8> val);
791*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator++(Byte8 &val, int);   // Post-increment
792*03ce13f7SAndroid Build Coastguard Worker //	const Byte8 &operator++(Byte8 &val);   // Pre-increment
793*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> operator--(Byte8 &val, int);   // Post-decrement
794*03ce13f7SAndroid Build Coastguard Worker //	const Byte8 &operator--(Byte8 &val);   // Pre-decrement
795*03ce13f7SAndroid Build Coastguard Worker 
796*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y);
797*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> SubSat(RValue<Byte8> x, RValue<Byte8> y);
798*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> Unpack(RValue<Byte4> x);
799*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> Unpack(RValue<Byte4> x, RValue<Byte4> y);
800*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y);
801*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y);
802*03ce13f7SAndroid Build Coastguard Worker RValue<Int> SignMask(RValue<Byte8> x);
803*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte8> CmpGT(RValue<Byte8> x, RValue<Byte8> y);
804*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> CmpEQ(RValue<Byte8> x, RValue<Byte8> y);
805*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> Swizzle(RValue<Byte8> x, uint32_t select);
806*03ce13f7SAndroid Build Coastguard Worker 
807*03ce13f7SAndroid Build Coastguard Worker class SByte8 : public LValue<SByte8>
808*03ce13f7SAndroid Build Coastguard Worker {
809*03ce13f7SAndroid Build Coastguard Worker public:
810*03ce13f7SAndroid Build Coastguard Worker 	SByte8() = default;
811*03ce13f7SAndroid Build Coastguard Worker 	SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7);
812*03ce13f7SAndroid Build Coastguard Worker 	SByte8(RValue<SByte8> rhs);
813*03ce13f7SAndroid Build Coastguard Worker 	SByte8(const SByte8 &rhs);
814*03ce13f7SAndroid Build Coastguard Worker 	SByte8(const Reference<SByte8> &rhs);
815*03ce13f7SAndroid Build Coastguard Worker 
816*03ce13f7SAndroid Build Coastguard Worker 	RValue<SByte8> operator=(RValue<SByte8> rhs);
817*03ce13f7SAndroid Build Coastguard Worker 	RValue<SByte8> operator=(const SByte8 &rhs);
818*03ce13f7SAndroid Build Coastguard Worker 	RValue<SByte8> operator=(const Reference<SByte8> &rhs);
819*03ce13f7SAndroid Build Coastguard Worker 
820*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()821*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 8; }
822*03ce13f7SAndroid Build Coastguard Worker };
823*03ce13f7SAndroid Build Coastguard Worker 
824*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs);
825*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs);
826*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs);
827*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs);
828*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs);
829*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs);
830*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs);
831*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs);
832*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator<<(RValue<SByte8> lhs, RValue<SByte8> rhs);
833*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator>>(RValue<SByte8> lhs, RValue<SByte8> rhs);
834*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator+=(SByte8 &lhs, RValue<SByte8> rhs);
835*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator-=(SByte8 &lhs, RValue<SByte8> rhs);
836*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator*=(SByte8 &lhs, RValue<SByte8> rhs);
837*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator/=(SByte8 &lhs, RValue<SByte8> rhs);
838*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator%=(SByte8 &lhs, RValue<SByte8> rhs);
839*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator&=(SByte8 &lhs, RValue<SByte8> rhs);
840*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator|=(SByte8 &lhs, RValue<SByte8> rhs);
841*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator^=(SByte8 &lhs, RValue<SByte8> rhs);
842*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator<<=(SByte8 &lhs, RValue<SByte8> rhs);
843*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator>>=(SByte8 &lhs, RValue<SByte8> rhs);
844*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator+(RValue<SByte8> val);
845*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator-(RValue<SByte8> val);
846*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> operator~(RValue<SByte8> val);
847*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator++(SByte8 &val, int);   // Post-increment
848*03ce13f7SAndroid Build Coastguard Worker //	const SByte8 &operator++(SByte8 &val);   // Pre-increment
849*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte8> operator--(SByte8 &val, int);   // Post-decrement
850*03ce13f7SAndroid Build Coastguard Worker //	const SByte8 &operator--(SByte8 &val);   // Pre-decrement
851*03ce13f7SAndroid Build Coastguard Worker 
852*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y);
853*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> SubSat(RValue<SByte8> x, RValue<SByte8> y);
854*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y);
855*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y);
856*03ce13f7SAndroid Build Coastguard Worker RValue<Int> SignMask(RValue<SByte8> x);
857*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> CmpGT(RValue<SByte8> x, RValue<SByte8> y);
858*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> CmpEQ(RValue<SByte8> x, RValue<SByte8> y);
859*03ce13f7SAndroid Build Coastguard Worker 
860*03ce13f7SAndroid Build Coastguard Worker class Byte16 : public LValue<Byte16>
861*03ce13f7SAndroid Build Coastguard Worker {
862*03ce13f7SAndroid Build Coastguard Worker public:
863*03ce13f7SAndroid Build Coastguard Worker 	Byte16() = default;
864*03ce13f7SAndroid Build Coastguard Worker 	Byte16(RValue<Byte16> rhs);
865*03ce13f7SAndroid Build Coastguard Worker 	Byte16(const Byte16 &rhs);
866*03ce13f7SAndroid Build Coastguard Worker 	Byte16(const Reference<Byte16> &rhs);
867*03ce13f7SAndroid Build Coastguard Worker 
868*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte16> operator=(RValue<Byte16> rhs);
869*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte16> operator=(const Byte16 &rhs);
870*03ce13f7SAndroid Build Coastguard Worker 	RValue<Byte16> operator=(const Reference<Byte16> &rhs);
871*03ce13f7SAndroid Build Coastguard Worker 
872*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()873*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 16; }
874*03ce13f7SAndroid Build Coastguard Worker };
875*03ce13f7SAndroid Build Coastguard Worker 
876*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator+(RValue<Byte16> lhs, RValue<Byte16> rhs);
877*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator-(RValue<Byte16> lhs, RValue<Byte16> rhs);
878*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator*(RValue<Byte16> lhs, RValue<Byte16> rhs);
879*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator/(RValue<Byte16> lhs, RValue<Byte16> rhs);
880*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator%(RValue<Byte16> lhs, RValue<Byte16> rhs);
881*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator&(RValue<Byte16> lhs, RValue<Byte16> rhs);
882*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator|(RValue<Byte16> lhs, RValue<Byte16> rhs);
883*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator^(RValue<Byte16> lhs, RValue<Byte16> rhs);
884*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator<<(RValue<Byte16> lhs, RValue<Byte16> rhs);
885*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator>>(RValue<Byte16> lhs, RValue<Byte16> rhs);
886*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator+=(Byte16 &lhs, RValue<Byte16> rhs);
887*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator-=(Byte16 &lhs, RValue<Byte16> rhs);
888*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator*=(Byte16 &lhs, RValue<Byte16> rhs);
889*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator/=(Byte16 &lhs, RValue<Byte16> rhs);
890*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator%=(Byte16 &lhs, RValue<Byte16> rhs);
891*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator&=(Byte16 &lhs, RValue<Byte16> rhs);
892*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator|=(Byte16 &lhs, RValue<Byte16> rhs);
893*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator^=(Byte16 &lhs, RValue<Byte16> rhs);
894*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator<<=(Byte16 &lhs, RValue<Byte16> rhs);
895*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator>>=(Byte16 &lhs, RValue<Byte16> rhs);
896*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator+(RValue<Byte16> val);
897*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator-(RValue<Byte16> val);
898*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator~(RValue<Byte16> val);
899*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator++(Byte16 &val, int);   // Post-increment
900*03ce13f7SAndroid Build Coastguard Worker //	const Byte16 &operator++(Byte16 &val);   // Pre-increment
901*03ce13f7SAndroid Build Coastguard Worker //	RValue<Byte16> operator--(Byte16 &val, int);   // Post-decrement
902*03ce13f7SAndroid Build Coastguard Worker //	const Byte16 &operator--(Byte16 &val);   // Pre-decrement
903*03ce13f7SAndroid Build Coastguard Worker RValue<Byte16> Swizzle(RValue<Byte16> x, uint64_t select);
904*03ce13f7SAndroid Build Coastguard Worker 
905*03ce13f7SAndroid Build Coastguard Worker class SByte16 : public LValue<SByte16>
906*03ce13f7SAndroid Build Coastguard Worker {
907*03ce13f7SAndroid Build Coastguard Worker public:
908*03ce13f7SAndroid Build Coastguard Worker 	SByte16() = default;
909*03ce13f7SAndroid Build Coastguard Worker 	//	SByte16(int x, int y, int z, int w);
910*03ce13f7SAndroid Build Coastguard Worker 	//	SByte16(RValue<SByte16> rhs);
911*03ce13f7SAndroid Build Coastguard Worker 	//	SByte16(const SByte16 &rhs);
912*03ce13f7SAndroid Build Coastguard Worker 	//	SByte16(const Reference<SByte16> &rhs);
913*03ce13f7SAndroid Build Coastguard Worker 
914*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<SByte16> operator=(RValue<SByte16> rhs);
915*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<SByte16> operator=(const SByte16 &rhs);
916*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<SByte16> operator=(const Reference<SByte16> &rhs);
917*03ce13f7SAndroid Build Coastguard Worker 
918*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()919*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 16; }
920*03ce13f7SAndroid Build Coastguard Worker };
921*03ce13f7SAndroid Build Coastguard Worker 
922*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator+(RValue<SByte16> lhs, RValue<SByte16> rhs);
923*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator-(RValue<SByte16> lhs, RValue<SByte16> rhs);
924*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator*(RValue<SByte16> lhs, RValue<SByte16> rhs);
925*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator/(RValue<SByte16> lhs, RValue<SByte16> rhs);
926*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator%(RValue<SByte16> lhs, RValue<SByte16> rhs);
927*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator&(RValue<SByte16> lhs, RValue<SByte16> rhs);
928*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator|(RValue<SByte16> lhs, RValue<SByte16> rhs);
929*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator^(RValue<SByte16> lhs, RValue<SByte16> rhs);
930*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator<<(RValue<SByte16> lhs, RValue<SByte16> rhs);
931*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator>>(RValue<SByte16> lhs, RValue<SByte16> rhs);
932*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator+=(SByte16 &lhs, RValue<SByte16> rhs);
933*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator-=(SByte16 &lhs, RValue<SByte16> rhs);
934*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator*=(SByte16 &lhs, RValue<SByte16> rhs);
935*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator/=(SByte16 &lhs, RValue<SByte16> rhs);
936*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator%=(SByte16 &lhs, RValue<SByte16> rhs);
937*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator&=(SByte16 &lhs, RValue<SByte16> rhs);
938*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator|=(SByte16 &lhs, RValue<SByte16> rhs);
939*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator^=(SByte16 &lhs, RValue<SByte16> rhs);
940*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator<<=(SByte16 &lhs, RValue<SByte16> rhs);
941*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator>>=(SByte16 &lhs, RValue<SByte16> rhs);
942*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator+(RValue<SByte16> val);
943*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator-(RValue<SByte16> val);
944*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator~(RValue<SByte16> val);
945*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator++(SByte16 &val, int);   // Post-increment
946*03ce13f7SAndroid Build Coastguard Worker //	const SByte16 &operator++(SByte16 &val);   // Pre-increment
947*03ce13f7SAndroid Build Coastguard Worker //	RValue<SByte16> operator--(SByte16 &val, int);   // Post-decrement
948*03ce13f7SAndroid Build Coastguard Worker //	const SByte16 &operator--(SByte16 &val);   // Pre-decrement
949*03ce13f7SAndroid Build Coastguard Worker 
950*03ce13f7SAndroid Build Coastguard Worker class Short2 : public LValue<Short2>
951*03ce13f7SAndroid Build Coastguard Worker {
952*03ce13f7SAndroid Build Coastguard Worker public:
953*03ce13f7SAndroid Build Coastguard Worker 	explicit Short2(RValue<Short4> cast);
954*03ce13f7SAndroid Build Coastguard Worker 
955*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()956*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 2; }
957*03ce13f7SAndroid Build Coastguard Worker };
958*03ce13f7SAndroid Build Coastguard Worker 
959*03ce13f7SAndroid Build Coastguard Worker class UShort2 : public LValue<UShort2>
960*03ce13f7SAndroid Build Coastguard Worker {
961*03ce13f7SAndroid Build Coastguard Worker public:
962*03ce13f7SAndroid Build Coastguard Worker 	explicit UShort2(RValue<UShort4> cast);
963*03ce13f7SAndroid Build Coastguard Worker 
964*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()965*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 2; }
966*03ce13f7SAndroid Build Coastguard Worker };
967*03ce13f7SAndroid Build Coastguard Worker 
968*03ce13f7SAndroid Build Coastguard Worker class Short4 : public LValue<Short4>
969*03ce13f7SAndroid Build Coastguard Worker {
970*03ce13f7SAndroid Build Coastguard Worker public:
971*03ce13f7SAndroid Build Coastguard Worker 	explicit Short4(RValue<Int> cast);
972*03ce13f7SAndroid Build Coastguard Worker 	explicit Short4(RValue<Int4> cast);
973*03ce13f7SAndroid Build Coastguard Worker 	explicit Short4(RValue<UInt4> cast);
974*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Short4(RValue<Float> cast);
975*03ce13f7SAndroid Build Coastguard Worker 	explicit Short4(RValue<Float4> cast);
976*03ce13f7SAndroid Build Coastguard Worker 
977*03ce13f7SAndroid Build Coastguard Worker 	Short4() = default;
978*03ce13f7SAndroid Build Coastguard Worker 	Short4(short xyzw);
979*03ce13f7SAndroid Build Coastguard Worker 	Short4(short x, short y, short z, short w);
980*03ce13f7SAndroid Build Coastguard Worker 	Short4(RValue<Short4> rhs);
981*03ce13f7SAndroid Build Coastguard Worker 	Short4(const Short4 &rhs);
982*03ce13f7SAndroid Build Coastguard Worker 	Short4(const Reference<Short4> &rhs);
983*03ce13f7SAndroid Build Coastguard Worker 	Short4(RValue<UShort4> rhs);
984*03ce13f7SAndroid Build Coastguard Worker 	Short4(const UShort4 &rhs);
985*03ce13f7SAndroid Build Coastguard Worker 	Short4(const Reference<UShort4> &rhs);
986*03ce13f7SAndroid Build Coastguard Worker 
987*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short4> operator=(RValue<Short4> rhs);
988*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short4> operator=(const Short4 &rhs);
989*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short4> operator=(const Reference<Short4> &rhs);
990*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short4> operator=(RValue<UShort4> rhs);
991*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short4> operator=(const UShort4 &rhs);
992*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short4> operator=(const Reference<UShort4> &rhs);
993*03ce13f7SAndroid Build Coastguard Worker 
994*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()995*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 4; }
996*03ce13f7SAndroid Build Coastguard Worker };
997*03ce13f7SAndroid Build Coastguard Worker 
998*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs);
999*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs);
1000*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs);
1001*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs);
1002*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs);
1003*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs);
1004*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs);
1005*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs);
1006*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs);
1007*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator>>(RValue<Short4> lhs, unsigned char rhs);
1008*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator+=(Short4 &lhs, RValue<Short4> rhs);
1009*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator-=(Short4 &lhs, RValue<Short4> rhs);
1010*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator*=(Short4 &lhs, RValue<Short4> rhs);
1011*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short4> operator/=(Short4 &lhs, RValue<Short4> rhs);
1012*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short4> operator%=(Short4 &lhs, RValue<Short4> rhs);
1013*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator&=(Short4 &lhs, RValue<Short4> rhs);
1014*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator|=(Short4 &lhs, RValue<Short4> rhs);
1015*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator^=(Short4 &lhs, RValue<Short4> rhs);
1016*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator<<=(Short4 &lhs, unsigned char rhs);
1017*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator>>=(Short4 &lhs, unsigned char rhs);
1018*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short4> operator+(RValue<Short4> val);
1019*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator-(RValue<Short4> val);
1020*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> operator~(RValue<Short4> val);
1021*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short4> operator++(Short4 &val, int);   // Post-increment
1022*03ce13f7SAndroid Build Coastguard Worker //	const Short4 &operator++(Short4 &val);   // Pre-increment
1023*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short4> operator--(Short4 &val, int);   // Post-decrement
1024*03ce13f7SAndroid Build Coastguard Worker //	const Short4 &operator--(Short4 &val);   // Pre-decrement
1025*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<(RValue<Short4> lhs, RValue<Short4> rhs);
1026*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<=(RValue<Short4> lhs, RValue<Short4> rhs);
1027*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>(RValue<Short4> lhs, RValue<Short4> rhs);
1028*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>=(RValue<Short4> lhs, RValue<Short4> rhs);
1029*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator!=(RValue<Short4> lhs, RValue<Short4> rhs);
1030*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator==(RValue<Short4> lhs, RValue<Short4> rhs);
1031*03ce13f7SAndroid Build Coastguard Worker 
1032*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> RoundShort4(RValue<Float4> cast);
1033*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y);
1034*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> Min(RValue<Short4> x, RValue<Short4> y);
1035*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> AddSat(RValue<Short4> x, RValue<Short4> y);
1036*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> SubSat(RValue<Short4> x, RValue<Short4> y);
1037*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> MulHigh(RValue<Short4> x, RValue<Short4> y);
1038*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> MulAdd(RValue<Short4> x, RValue<Short4> y);
1039*03ce13f7SAndroid Build Coastguard Worker RValue<SByte8> PackSigned(RValue<Short4> x, RValue<Short4> y);
1040*03ce13f7SAndroid Build Coastguard Worker RValue<Byte8> PackUnsigned(RValue<Short4> x, RValue<Short4> y);
1041*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y);
1042*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y);
1043*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> Swizzle(RValue<Short4> x, uint16_t select);
1044*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i);
1045*03ce13f7SAndroid Build Coastguard Worker RValue<Short> Extract(RValue<Short4> val, int i);
1046*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y);
1047*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> CmpEQ(RValue<Short4> x, RValue<Short4> y);
1048*03ce13f7SAndroid Build Coastguard Worker 
1049*03ce13f7SAndroid Build Coastguard Worker class UShort4 : public LValue<UShort4>
1050*03ce13f7SAndroid Build Coastguard Worker {
1051*03ce13f7SAndroid Build Coastguard Worker public:
1052*03ce13f7SAndroid Build Coastguard Worker 	explicit UShort4(RValue<UInt4> cast);
1053*03ce13f7SAndroid Build Coastguard Worker 	explicit UShort4(RValue<Int4> cast);
1054*03ce13f7SAndroid Build Coastguard Worker 	explicit UShort4(RValue<Float4> cast, bool saturate = false);
1055*03ce13f7SAndroid Build Coastguard Worker 
1056*03ce13f7SAndroid Build Coastguard Worker 	UShort4() = default;
1057*03ce13f7SAndroid Build Coastguard Worker 	UShort4(unsigned short xyzw);
1058*03ce13f7SAndroid Build Coastguard Worker 	UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w);
1059*03ce13f7SAndroid Build Coastguard Worker 	UShort4(RValue<UShort4> rhs);
1060*03ce13f7SAndroid Build Coastguard Worker 	UShort4(const UShort4 &rhs);
1061*03ce13f7SAndroid Build Coastguard Worker 	UShort4(const Reference<UShort4> &rhs);
1062*03ce13f7SAndroid Build Coastguard Worker 	UShort4(RValue<Short4> rhs);
1063*03ce13f7SAndroid Build Coastguard Worker 	UShort4(const Short4 &rhs);
1064*03ce13f7SAndroid Build Coastguard Worker 	UShort4(const Reference<Short4> &rhs);
1065*03ce13f7SAndroid Build Coastguard Worker 
1066*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort4> operator=(RValue<UShort4> rhs);
1067*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort4> operator=(const UShort4 &rhs);
1068*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort4> operator=(const Reference<UShort4> &rhs);
1069*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort4> operator=(RValue<Short4> rhs);
1070*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort4> operator=(const Short4 &rhs);
1071*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort4> operator=(const Reference<Short4> &rhs);
1072*03ce13f7SAndroid Build Coastguard Worker 
1073*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()1074*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 4; }
1075*03ce13f7SAndroid Build Coastguard Worker };
1076*03ce13f7SAndroid Build Coastguard Worker 
1077*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs);
1078*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs);
1079*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs);
1080*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator/(RValue<UShort4> lhs, RValue<UShort4> rhs);
1081*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator%(RValue<UShort4> lhs, RValue<UShort4> rhs);
1082*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs);
1083*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs);
1084*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs);
1085*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs);
1086*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs);
1087*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator+=(UShort4 &lhs, RValue<UShort4> rhs);
1088*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator-=(UShort4 &lhs, RValue<UShort4> rhs);
1089*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator*=(UShort4 &lhs, RValue<UShort4> rhs);
1090*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator/=(UShort4 &lhs, RValue<UShort4> rhs);
1091*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator%=(UShort4 &lhs, RValue<UShort4> rhs);
1092*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator&=(UShort4 &lhs, RValue<UShort4> rhs);
1093*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator|=(UShort4 &lhs, RValue<UShort4> rhs);
1094*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator^=(UShort4 &lhs, RValue<UShort4> rhs);
1095*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator<<=(UShort4 &lhs, unsigned char rhs);
1096*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator>>=(UShort4 &lhs, unsigned char rhs);
1097*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator+(RValue<UShort4> val);
1098*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator-(RValue<UShort4> val);
1099*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> operator~(RValue<UShort4> val);
1100*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator++(UShort4 &val, int);   // Post-increment
1101*03ce13f7SAndroid Build Coastguard Worker //	const UShort4 &operator++(UShort4 &val);   // Pre-increment
1102*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort4> operator--(UShort4 &val, int);   // Post-decrement
1103*03ce13f7SAndroid Build Coastguard Worker //	const UShort4 &operator--(UShort4 &val);   // Pre-decrement
1104*03ce13f7SAndroid Build Coastguard Worker 
1105*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> Insert(RValue<UShort4> val, RValue<UShort> element, int i);
1106*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y);
1107*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> Min(RValue<UShort4> x, RValue<UShort4> y);
1108*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> AddSat(RValue<UShort4> x, RValue<UShort4> y);
1109*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> SubSat(RValue<UShort4> x, RValue<UShort4> y);
1110*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> MulHigh(RValue<UShort4> x, RValue<UShort4> y);
1111*03ce13f7SAndroid Build Coastguard Worker RValue<UShort4> Average(RValue<UShort4> x, RValue<UShort4> y);
1112*03ce13f7SAndroid Build Coastguard Worker 
1113*03ce13f7SAndroid Build Coastguard Worker class Short8 : public LValue<Short8>
1114*03ce13f7SAndroid Build Coastguard Worker {
1115*03ce13f7SAndroid Build Coastguard Worker public:
1116*03ce13f7SAndroid Build Coastguard Worker 	Short8() = default;
1117*03ce13f7SAndroid Build Coastguard Worker 	Short8(short c);
1118*03ce13f7SAndroid Build Coastguard Worker 	Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7);
1119*03ce13f7SAndroid Build Coastguard Worker 	Short8(RValue<Short8> rhs);
1120*03ce13f7SAndroid Build Coastguard Worker 	//	Short8(const Short8 &rhs);
1121*03ce13f7SAndroid Build Coastguard Worker 	Short8(const Reference<Short8> &rhs);
1122*03ce13f7SAndroid Build Coastguard Worker 	Short8(RValue<Short4> lo, RValue<Short4> hi);
1123*03ce13f7SAndroid Build Coastguard Worker 
1124*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short8> operator=(RValue<Short8> rhs);
1125*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short8> operator=(const Short8 &rhs);
1126*03ce13f7SAndroid Build Coastguard Worker 	RValue<Short8> operator=(const Reference<Short8> &rhs);
1127*03ce13f7SAndroid Build Coastguard Worker 
1128*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()1129*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 8; }
1130*03ce13f7SAndroid Build Coastguard Worker };
1131*03ce13f7SAndroid Build Coastguard Worker 
1132*03ce13f7SAndroid Build Coastguard Worker RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs);
1133*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator-(RValue<Short8> lhs, RValue<Short8> rhs);
1134*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator*(RValue<Short8> lhs, RValue<Short8> rhs);
1135*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator/(RValue<Short8> lhs, RValue<Short8> rhs);
1136*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator%(RValue<Short8> lhs, RValue<Short8> rhs);
1137*03ce13f7SAndroid Build Coastguard Worker RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs);
1138*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator|(RValue<Short8> lhs, RValue<Short8> rhs);
1139*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator^(RValue<Short8> lhs, RValue<Short8> rhs);
1140*03ce13f7SAndroid Build Coastguard Worker RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs);
1141*03ce13f7SAndroid Build Coastguard Worker RValue<Short8> operator>>(RValue<Short8> lhs, unsigned char rhs);
1142*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator<<(RValue<Short8> lhs, RValue<Short8> rhs);
1143*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator>>(RValue<Short8> lhs, RValue<Short8> rhs);
1144*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator+=(Short8 &lhs, RValue<Short8> rhs);
1145*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator-=(Short8 &lhs, RValue<Short8> rhs);
1146*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator*=(Short8 &lhs, RValue<Short8> rhs);
1147*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator/=(Short8 &lhs, RValue<Short8> rhs);
1148*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator%=(Short8 &lhs, RValue<Short8> rhs);
1149*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator&=(Short8 &lhs, RValue<Short8> rhs);
1150*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator|=(Short8 &lhs, RValue<Short8> rhs);
1151*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator^=(Short8 &lhs, RValue<Short8> rhs);
1152*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator<<=(Short8 &lhs, RValue<Short8> rhs);
1153*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator>>=(Short8 &lhs, RValue<Short8> rhs);
1154*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator+(RValue<Short8> val);
1155*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator-(RValue<Short8> val);
1156*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator~(RValue<Short8> val);
1157*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator++(Short8 &val, int);   // Post-increment
1158*03ce13f7SAndroid Build Coastguard Worker //	const Short8 &operator++(Short8 &val);   // Pre-increment
1159*03ce13f7SAndroid Build Coastguard Worker //	RValue<Short8> operator--(Short8 &val, int);   // Post-decrement
1160*03ce13f7SAndroid Build Coastguard Worker //	const Short8 &operator--(Short8 &val);   // Pre-decrement
1161*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<(RValue<Short8> lhs, RValue<Short8> rhs);
1162*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<=(RValue<Short8> lhs, RValue<Short8> rhs);
1163*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>(RValue<Short8> lhs, RValue<Short8> rhs);
1164*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>=(RValue<Short8> lhs, RValue<Short8> rhs);
1165*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator!=(RValue<Short8> lhs, RValue<Short8> rhs);
1166*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator==(RValue<Short8> lhs, RValue<Short8> rhs);
1167*03ce13f7SAndroid Build Coastguard Worker 
1168*03ce13f7SAndroid Build Coastguard Worker RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y);
1169*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> MulAdd(RValue<Short8> x, RValue<Short8> y);
1170*03ce13f7SAndroid Build Coastguard Worker 
1171*03ce13f7SAndroid Build Coastguard Worker class UShort8 : public LValue<UShort8>
1172*03ce13f7SAndroid Build Coastguard Worker {
1173*03ce13f7SAndroid Build Coastguard Worker public:
1174*03ce13f7SAndroid Build Coastguard Worker 	UShort8() = default;
1175*03ce13f7SAndroid Build Coastguard Worker 	UShort8(unsigned short c);
1176*03ce13f7SAndroid Build Coastguard Worker 	UShort8(unsigned short c0, unsigned short c1, unsigned short c2, unsigned short c3, unsigned short c4, unsigned short c5, unsigned short c6, unsigned short c7);
1177*03ce13f7SAndroid Build Coastguard Worker 	UShort8(RValue<UShort8> rhs);
1178*03ce13f7SAndroid Build Coastguard Worker 	//	UShort8(const UShort8 &rhs);
1179*03ce13f7SAndroid Build Coastguard Worker 	UShort8(const Reference<UShort8> &rhs);
1180*03ce13f7SAndroid Build Coastguard Worker 	UShort8(RValue<UShort4> lo, RValue<UShort4> hi);
1181*03ce13f7SAndroid Build Coastguard Worker 
1182*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort8> operator=(RValue<UShort8> rhs);
1183*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort8> operator=(const UShort8 &rhs);
1184*03ce13f7SAndroid Build Coastguard Worker 	RValue<UShort8> operator=(const Reference<UShort8> &rhs);
1185*03ce13f7SAndroid Build Coastguard Worker 
1186*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()1187*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 8; }
1188*03ce13f7SAndroid Build Coastguard Worker };
1189*03ce13f7SAndroid Build Coastguard Worker 
1190*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs);
1191*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator-(RValue<UShort8> lhs, RValue<UShort8> rhs);
1192*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs);
1193*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator/(RValue<UShort8> lhs, RValue<UShort8> rhs);
1194*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator%(RValue<UShort8> lhs, RValue<UShort8> rhs);
1195*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs);
1196*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator|(RValue<UShort8> lhs, RValue<UShort8> rhs);
1197*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator^(RValue<UShort8> lhs, RValue<UShort8> rhs);
1198*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs);
1199*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> operator>>(RValue<UShort8> lhs, unsigned char rhs);
1200*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator<<(RValue<UShort8> lhs, RValue<UShort8> rhs);
1201*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator>>(RValue<UShort8> lhs, RValue<UShort8> rhs);
1202*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> operator+=(UShort8 &lhs, RValue<UShort8> rhs);
1203*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator-=(UShort8 &lhs, RValue<UShort8> rhs);
1204*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator*=(UShort8 &lhs, RValue<UShort8> rhs);
1205*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator/=(UShort8 &lhs, RValue<UShort8> rhs);
1206*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator%=(UShort8 &lhs, RValue<UShort8> rhs);
1207*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator&=(UShort8 &lhs, RValue<UShort8> rhs);
1208*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator|=(UShort8 &lhs, RValue<UShort8> rhs);
1209*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator^=(UShort8 &lhs, RValue<UShort8> rhs);
1210*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator<<=(UShort8 &lhs, RValue<UShort8> rhs);
1211*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator>>=(UShort8 &lhs, RValue<UShort8> rhs);
1212*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator+(RValue<UShort8> val);
1213*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator-(RValue<UShort8> val);
1214*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> operator~(RValue<UShort8> val);
1215*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator++(UShort8 &val, int);   // Post-increment
1216*03ce13f7SAndroid Build Coastguard Worker //	const UShort8 &operator++(UShort8 &val);   // Pre-increment
1217*03ce13f7SAndroid Build Coastguard Worker //	RValue<UShort8> operator--(UShort8 &val, int);   // Post-decrement
1218*03ce13f7SAndroid Build Coastguard Worker //	const UShort8 &operator--(UShort8 &val);   // Pre-decrement
1219*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<(RValue<UShort8> lhs, RValue<UShort8> rhs);
1220*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1221*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>(RValue<UShort8> lhs, RValue<UShort8> rhs);
1222*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1223*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator!=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1224*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator==(RValue<UShort8> lhs, RValue<UShort8> rhs);
1225*03ce13f7SAndroid Build Coastguard Worker 
1226*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> Swizzle(RValue<UShort8> x, uint32_t select);
1227*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> MulHigh(RValue<UShort8> x, RValue<UShort8> y);
1228*03ce13f7SAndroid Build Coastguard Worker 
1229*03ce13f7SAndroid Build Coastguard Worker class Int : public LValue<Int>
1230*03ce13f7SAndroid Build Coastguard Worker {
1231*03ce13f7SAndroid Build Coastguard Worker public:
1232*03ce13f7SAndroid Build Coastguard Worker 	Int(Argument<Int> argument);
1233*03ce13f7SAndroid Build Coastguard Worker 
1234*03ce13f7SAndroid Build Coastguard Worker 	explicit Int(RValue<Byte> cast);
1235*03ce13f7SAndroid Build Coastguard Worker 	explicit Int(RValue<SByte> cast);
1236*03ce13f7SAndroid Build Coastguard Worker 	explicit Int(RValue<Short> cast);
1237*03ce13f7SAndroid Build Coastguard Worker 	explicit Int(RValue<UShort> cast);
1238*03ce13f7SAndroid Build Coastguard Worker 	explicit Int(RValue<Int2> cast);
1239*03ce13f7SAndroid Build Coastguard Worker 	explicit Int(RValue<Long> cast);
1240*03ce13f7SAndroid Build Coastguard Worker 	explicit Int(RValue<Float> cast);
1241*03ce13f7SAndroid Build Coastguard Worker 
1242*03ce13f7SAndroid Build Coastguard Worker 	Int() = default;
1243*03ce13f7SAndroid Build Coastguard Worker 	Int(int x);
1244*03ce13f7SAndroid Build Coastguard Worker 	Int(RValue<Int> rhs);
1245*03ce13f7SAndroid Build Coastguard Worker 	Int(RValue<UInt> rhs);
1246*03ce13f7SAndroid Build Coastguard Worker 	Int(const Int &rhs);
1247*03ce13f7SAndroid Build Coastguard Worker 	Int(const UInt &rhs);
1248*03ce13f7SAndroid Build Coastguard Worker 	Int(const Reference<Int> &rhs);
1249*03ce13f7SAndroid Build Coastguard Worker 	Int(const Reference<UInt> &rhs);
1250*03ce13f7SAndroid Build Coastguard Worker 
1251*03ce13f7SAndroid Build Coastguard Worker 	template<int T>
1252*03ce13f7SAndroid Build Coastguard Worker 	Int(const SwizzleMask1<Int4, T> &rhs);
1253*03ce13f7SAndroid Build Coastguard Worker 
1254*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int> operator=(int rhs);
1255*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int> operator=(RValue<Int> rhs);
1256*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int> operator=(RValue<UInt> rhs);
1257*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int> operator=(const Int &rhs);
1258*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int> operator=(const UInt &rhs);
1259*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int> operator=(const Reference<Int> &rhs);
1260*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int> operator=(const Reference<UInt> &rhs);
1261*03ce13f7SAndroid Build Coastguard Worker 
1262*03ce13f7SAndroid Build Coastguard Worker 	template<int T>
1263*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int> operator=(const SwizzleMask1<Int4, T> &rhs);
1264*03ce13f7SAndroid Build Coastguard Worker 
1265*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
1266*03ce13f7SAndroid Build Coastguard Worker };
1267*03ce13f7SAndroid Build Coastguard Worker 
1268*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs);
1269*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs);
1270*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs);
1271*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs);
1272*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs);
1273*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs);
1274*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs);
1275*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs);
1276*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs);
1277*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs);
1278*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator+=(Int &lhs, RValue<Int> rhs);
1279*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator-=(Int &lhs, RValue<Int> rhs);
1280*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator*=(Int &lhs, RValue<Int> rhs);
1281*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator/=(Int &lhs, RValue<Int> rhs);
1282*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator%=(Int &lhs, RValue<Int> rhs);
1283*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator&=(Int &lhs, RValue<Int> rhs);
1284*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator|=(Int &lhs, RValue<Int> rhs);
1285*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator^=(Int &lhs, RValue<Int> rhs);
1286*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator<<=(Int &lhs, RValue<Int> rhs);
1287*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator>>=(Int &lhs, RValue<Int> rhs);
1288*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator+(RValue<Int> val);
1289*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator-(RValue<Int> val);
1290*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator~(RValue<Int> val);
1291*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator++(Int &val, int);  // Post-increment
1292*03ce13f7SAndroid Build Coastguard Worker const Int &operator++(Int &val);        // Pre-increment
1293*03ce13f7SAndroid Build Coastguard Worker RValue<Int> operator--(Int &val, int);  // Post-decrement
1294*03ce13f7SAndroid Build Coastguard Worker const Int &operator--(Int &val);        // Pre-decrement
1295*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs);
1296*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs);
1297*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs);
1298*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs);
1299*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs);
1300*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs);
1301*03ce13f7SAndroid Build Coastguard Worker 
1302*03ce13f7SAndroid Build Coastguard Worker RValue<Int> Max(RValue<Int> x, RValue<Int> y);
1303*03ce13f7SAndroid Build Coastguard Worker RValue<Int> Min(RValue<Int> x, RValue<Int> y);
1304*03ce13f7SAndroid Build Coastguard Worker RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max);
1305*03ce13f7SAndroid Build Coastguard Worker RValue<Int> RoundInt(RValue<Float> cast);
1306*03ce13f7SAndroid Build Coastguard Worker 
1307*03ce13f7SAndroid Build Coastguard Worker class Long : public LValue<Long>
1308*03ce13f7SAndroid Build Coastguard Worker {
1309*03ce13f7SAndroid Build Coastguard Worker public:
1310*03ce13f7SAndroid Build Coastguard Worker 	//	Long(Argument<Long> argument);
1311*03ce13f7SAndroid Build Coastguard Worker 
1312*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Long(RValue<Short> cast);
1313*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Long(RValue<UShort> cast);
1314*03ce13f7SAndroid Build Coastguard Worker 	explicit Long(RValue<Int> cast);
1315*03ce13f7SAndroid Build Coastguard Worker 	explicit Long(RValue<UInt> cast);
1316*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Long(RValue<Float> cast);
1317*03ce13f7SAndroid Build Coastguard Worker 
1318*03ce13f7SAndroid Build Coastguard Worker 	Long() = default;
1319*03ce13f7SAndroid Build Coastguard Worker 	//	Long(qword x);
1320*03ce13f7SAndroid Build Coastguard Worker 	Long(RValue<Long> rhs);
1321*03ce13f7SAndroid Build Coastguard Worker 	//	Long(RValue<ULong> rhs);
1322*03ce13f7SAndroid Build Coastguard Worker 	//	Long(const Long &rhs);
1323*03ce13f7SAndroid Build Coastguard Worker 	//	Long(const Reference<Long> &rhs);
1324*03ce13f7SAndroid Build Coastguard Worker 	//	Long(const ULong &rhs);
1325*03ce13f7SAndroid Build Coastguard Worker 	//	Long(const Reference<ULong> &rhs);
1326*03ce13f7SAndroid Build Coastguard Worker 
1327*03ce13f7SAndroid Build Coastguard Worker 	RValue<Long> operator=(int64_t rhs);
1328*03ce13f7SAndroid Build Coastguard Worker 	RValue<Long> operator=(RValue<Long> rhs);
1329*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Long> operator=(RValue<ULong> rhs);
1330*03ce13f7SAndroid Build Coastguard Worker 	RValue<Long> operator=(const Long &rhs);
1331*03ce13f7SAndroid Build Coastguard Worker 	RValue<Long> operator=(const Reference<Long> &rhs);
1332*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Long> operator=(const ULong &rhs);
1333*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Long> operator=(const Reference<ULong> &rhs);
1334*03ce13f7SAndroid Build Coastguard Worker 
1335*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
1336*03ce13f7SAndroid Build Coastguard Worker };
1337*03ce13f7SAndroid Build Coastguard Worker 
1338*03ce13f7SAndroid Build Coastguard Worker RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs);
1339*03ce13f7SAndroid Build Coastguard Worker RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs);
1340*03ce13f7SAndroid Build Coastguard Worker RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs);
1341*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator/(RValue<Long> lhs, RValue<Long> rhs);
1342*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator%(RValue<Long> lhs, RValue<Long> rhs);
1343*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator&(RValue<Long> lhs, RValue<Long> rhs);
1344*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator|(RValue<Long> lhs, RValue<Long> rhs);
1345*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator^(RValue<Long> lhs, RValue<Long> rhs);
1346*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator<<(RValue<Long> lhs, RValue<Long> rhs);
1347*03ce13f7SAndroid Build Coastguard Worker RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs);
1348*03ce13f7SAndroid Build Coastguard Worker RValue<Long> operator+=(Long &lhs, RValue<Long> rhs);
1349*03ce13f7SAndroid Build Coastguard Worker RValue<Long> operator-=(Long &lhs, RValue<Long> rhs);
1350*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator*=(Long &lhs, RValue<Long> rhs);
1351*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator/=(Long &lhs, RValue<Long> rhs);
1352*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator%=(Long &lhs, RValue<Long> rhs);
1353*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator&=(Long &lhs, RValue<Long> rhs);
1354*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator|=(Long &lhs, RValue<Long> rhs);
1355*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator^=(Long &lhs, RValue<Long> rhs);
1356*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator<<=(Long &lhs, RValue<Long> rhs);
1357*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator>>=(Long &lhs, RValue<Long> rhs);
1358*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator+(RValue<Long> val);
1359*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator-(RValue<Long> val);
1360*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator~(RValue<Long> val);
1361*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator++(Long &val, int);   // Post-increment
1362*03ce13f7SAndroid Build Coastguard Worker //	const Long &operator++(Long &val);   // Pre-increment
1363*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> operator--(Long &val, int);   // Post-decrement
1364*03ce13f7SAndroid Build Coastguard Worker //	const Long &operator--(Long &val);   // Pre-decrement
1365*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<(RValue<Long> lhs, RValue<Long> rhs);
1366*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<=(RValue<Long> lhs, RValue<Long> rhs);
1367*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>(RValue<Long> lhs, RValue<Long> rhs);
1368*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>=(RValue<Long> lhs, RValue<Long> rhs);
1369*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator!=(RValue<Long> lhs, RValue<Long> rhs);
1370*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator==(RValue<Long> lhs, RValue<Long> rhs);
1371*03ce13f7SAndroid Build Coastguard Worker 
1372*03ce13f7SAndroid Build Coastguard Worker //	RValue<Long> RoundLong(RValue<Float> cast);
1373*03ce13f7SAndroid Build Coastguard Worker RValue<Long> AddAtomic(RValue<Pointer<Long>> x, RValue<Long> y);
1374*03ce13f7SAndroid Build Coastguard Worker 
1375*03ce13f7SAndroid Build Coastguard Worker class UInt : public LValue<UInt>
1376*03ce13f7SAndroid Build Coastguard Worker {
1377*03ce13f7SAndroid Build Coastguard Worker public:
1378*03ce13f7SAndroid Build Coastguard Worker 	UInt(Argument<UInt> argument);
1379*03ce13f7SAndroid Build Coastguard Worker 
1380*03ce13f7SAndroid Build Coastguard Worker 	explicit UInt(RValue<UShort> cast);
1381*03ce13f7SAndroid Build Coastguard Worker 	explicit UInt(RValue<Long> cast);
1382*03ce13f7SAndroid Build Coastguard Worker 	explicit UInt(RValue<Float> cast);
1383*03ce13f7SAndroid Build Coastguard Worker 
1384*03ce13f7SAndroid Build Coastguard Worker 	UInt() = default;
1385*03ce13f7SAndroid Build Coastguard Worker 	UInt(int x);
1386*03ce13f7SAndroid Build Coastguard Worker 	UInt(unsigned int x);
1387*03ce13f7SAndroid Build Coastguard Worker 	UInt(RValue<UInt> rhs);
1388*03ce13f7SAndroid Build Coastguard Worker 	UInt(RValue<Int> rhs);
1389*03ce13f7SAndroid Build Coastguard Worker 	UInt(const UInt &rhs);
1390*03ce13f7SAndroid Build Coastguard Worker 	UInt(const Int &rhs);
1391*03ce13f7SAndroid Build Coastguard Worker 	UInt(const Reference<UInt> &rhs);
1392*03ce13f7SAndroid Build Coastguard Worker 	UInt(const Reference<Int> &rhs);
1393*03ce13f7SAndroid Build Coastguard Worker 
1394*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt> operator=(unsigned int rhs);
1395*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt> operator=(RValue<UInt> rhs);
1396*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt> operator=(RValue<Int> rhs);
1397*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt> operator=(const UInt &rhs);
1398*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt> operator=(const Int &rhs);
1399*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt> operator=(const Reference<UInt> &rhs);
1400*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt> operator=(const Reference<Int> &rhs);
1401*03ce13f7SAndroid Build Coastguard Worker 
1402*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
1403*03ce13f7SAndroid Build Coastguard Worker };
1404*03ce13f7SAndroid Build Coastguard Worker 
1405*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs);
1406*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs);
1407*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs);
1408*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs);
1409*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs);
1410*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs);
1411*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs);
1412*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs);
1413*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs);
1414*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs);
1415*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator+=(UInt &lhs, RValue<UInt> rhs);
1416*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator-=(UInt &lhs, RValue<UInt> rhs);
1417*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator*=(UInt &lhs, RValue<UInt> rhs);
1418*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator/=(UInt &lhs, RValue<UInt> rhs);
1419*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator%=(UInt &lhs, RValue<UInt> rhs);
1420*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator&=(UInt &lhs, RValue<UInt> rhs);
1421*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator|=(UInt &lhs, RValue<UInt> rhs);
1422*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator^=(UInt &lhs, RValue<UInt> rhs);
1423*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator<<=(UInt &lhs, RValue<UInt> rhs);
1424*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator>>=(UInt &lhs, RValue<UInt> rhs);
1425*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator+(RValue<UInt> val);
1426*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator-(RValue<UInt> val);
1427*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator~(RValue<UInt> val);
1428*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator++(UInt &val, int);  // Post-increment
1429*03ce13f7SAndroid Build Coastguard Worker const UInt &operator++(UInt &val);        // Pre-increment
1430*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> operator--(UInt &val, int);  // Post-decrement
1431*03ce13f7SAndroid Build Coastguard Worker const UInt &operator--(UInt &val);        // Pre-decrement
1432*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs);
1433*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs);
1434*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs);
1435*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs);
1436*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs);
1437*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs);
1438*03ce13f7SAndroid Build Coastguard Worker 
1439*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y);
1440*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y);
1441*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max);
1442*03ce13f7SAndroid Build Coastguard Worker 
1443*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> AddAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder);
1444*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> SubAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder);
1445*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> AndAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder);
1446*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> OrAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder);
1447*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> XorAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder);
1448*03ce13f7SAndroid Build Coastguard Worker RValue<Int> MinAtomic(RValue<Pointer<Int>> x, RValue<Int> y, std::memory_order memoryOrder);
1449*03ce13f7SAndroid Build Coastguard Worker RValue<Int> MaxAtomic(RValue<Pointer<Int>> x, RValue<Int> y, std::memory_order memoryOrder);
1450*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> MinAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder);
1451*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> MaxAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder);
1452*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> ExchangeAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, std::memory_order memoryOrder);
1453*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> CompareExchangeAtomic(RValue<Pointer<UInt>> x, RValue<UInt> y, RValue<UInt> compare, std::memory_order memoryOrderEqual, std::memory_order memoryOrderUnequal);
1454*03ce13f7SAndroid Build Coastguard Worker 
1455*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt> RoundUInt(RValue<Float> cast);
1456*03ce13f7SAndroid Build Coastguard Worker 
1457*03ce13f7SAndroid Build Coastguard Worker class Int2 : public LValue<Int2>
1458*03ce13f7SAndroid Build Coastguard Worker {
1459*03ce13f7SAndroid Build Coastguard Worker public:
1460*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Int2(RValue<Int> cast);
1461*03ce13f7SAndroid Build Coastguard Worker 	explicit Int2(RValue<Int4> cast);
1462*03ce13f7SAndroid Build Coastguard Worker 
1463*03ce13f7SAndroid Build Coastguard Worker 	Int2() = default;
1464*03ce13f7SAndroid Build Coastguard Worker 	Int2(int x, int y);
1465*03ce13f7SAndroid Build Coastguard Worker 	Int2(RValue<Int2> rhs);
1466*03ce13f7SAndroid Build Coastguard Worker 	Int2(const Int2 &rhs);
1467*03ce13f7SAndroid Build Coastguard Worker 	Int2(const Reference<Int2> &rhs);
1468*03ce13f7SAndroid Build Coastguard Worker 	Int2(RValue<Int> lo, RValue<Int> hi);
1469*03ce13f7SAndroid Build Coastguard Worker 
1470*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int2> operator=(RValue<Int2> rhs);
1471*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int2> operator=(const Int2 &rhs);
1472*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int2> operator=(const Reference<Int2> &rhs);
1473*03ce13f7SAndroid Build Coastguard Worker 
1474*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()1475*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 2; }
1476*03ce13f7SAndroid Build Coastguard Worker };
1477*03ce13f7SAndroid Build Coastguard Worker 
1478*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs);
1479*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs);
1480*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs);
1481*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs);
1482*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs);
1483*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs);
1484*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs);
1485*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs);
1486*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs);
1487*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator>>(RValue<Int2> lhs, unsigned char rhs);
1488*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator+=(Int2 &lhs, RValue<Int2> rhs);
1489*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator-=(Int2 &lhs, RValue<Int2> rhs);
1490*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator*=(Int2 &lhs, RValue<Int2> rhs);
1491*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator/=(Int2 &lhs, RValue<Int2> rhs);
1492*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator%=(Int2 &lhs, RValue<Int2> rhs);
1493*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator&=(Int2 &lhs, RValue<Int2> rhs);
1494*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator|=(Int2 &lhs, RValue<Int2> rhs);
1495*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator^=(Int2 &lhs, RValue<Int2> rhs);
1496*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator<<=(Int2 &lhs, unsigned char rhs);
1497*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator>>=(Int2 &lhs, unsigned char rhs);
1498*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator+(RValue<Int2> val);
1499*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator-(RValue<Int2> val);
1500*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> operator~(RValue<Int2> val);
1501*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator++(Int2 &val, int);   // Post-increment
1502*03ce13f7SAndroid Build Coastguard Worker //	const Int2 &operator++(Int2 &val);   // Pre-increment
1503*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> operator--(Int2 &val, int);   // Post-decrement
1504*03ce13f7SAndroid Build Coastguard Worker //	const Int2 &operator--(Int2 &val);   // Pre-decrement
1505*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<(RValue<Int2> lhs, RValue<Int2> rhs);
1506*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<=(RValue<Int2> lhs, RValue<Int2> rhs);
1507*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>(RValue<Int2> lhs, RValue<Int2> rhs);
1508*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>=(RValue<Int2> lhs, RValue<Int2> rhs);
1509*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator!=(RValue<Int2> lhs, RValue<Int2> rhs);
1510*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator==(RValue<Int2> lhs, RValue<Int2> rhs);
1511*03ce13f7SAndroid Build Coastguard Worker 
1512*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int2> RoundInt(RValue<Float4> cast);
1513*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> UnpackLow(RValue<Int2> x, RValue<Int2> y);
1514*03ce13f7SAndroid Build Coastguard Worker RValue<Short4> UnpackHigh(RValue<Int2> x, RValue<Int2> y);
1515*03ce13f7SAndroid Build Coastguard Worker RValue<Int> Extract(RValue<Int2> val, int i);
1516*03ce13f7SAndroid Build Coastguard Worker RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i);
1517*03ce13f7SAndroid Build Coastguard Worker 
1518*03ce13f7SAndroid Build Coastguard Worker class UInt2 : public LValue<UInt2>
1519*03ce13f7SAndroid Build Coastguard Worker {
1520*03ce13f7SAndroid Build Coastguard Worker public:
1521*03ce13f7SAndroid Build Coastguard Worker 	UInt2() = default;
1522*03ce13f7SAndroid Build Coastguard Worker 	UInt2(unsigned int x, unsigned int y);
1523*03ce13f7SAndroid Build Coastguard Worker 	UInt2(RValue<UInt2> rhs);
1524*03ce13f7SAndroid Build Coastguard Worker 	UInt2(const UInt2 &rhs);
1525*03ce13f7SAndroid Build Coastguard Worker 	UInt2(const Reference<UInt2> &rhs);
1526*03ce13f7SAndroid Build Coastguard Worker 
1527*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt2> operator=(RValue<UInt2> rhs);
1528*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt2> operator=(const UInt2 &rhs);
1529*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt2> operator=(const Reference<UInt2> &rhs);
1530*03ce13f7SAndroid Build Coastguard Worker 
1531*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()1532*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 2; }
1533*03ce13f7SAndroid Build Coastguard Worker };
1534*03ce13f7SAndroid Build Coastguard Worker 
1535*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs);
1536*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs);
1537*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs);
1538*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs);
1539*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs);
1540*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs);
1541*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs);
1542*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs);
1543*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs);
1544*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator>>(RValue<UInt2> lhs, unsigned char rhs);
1545*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator+=(UInt2 &lhs, RValue<UInt2> rhs);
1546*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator-=(UInt2 &lhs, RValue<UInt2> rhs);
1547*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator*=(UInt2 &lhs, RValue<UInt2> rhs);
1548*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator/=(UInt2 &lhs, RValue<UInt2> rhs);
1549*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator%=(UInt2 &lhs, RValue<UInt2> rhs);
1550*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator&=(UInt2 &lhs, RValue<UInt2> rhs);
1551*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator|=(UInt2 &lhs, RValue<UInt2> rhs);
1552*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator^=(UInt2 &lhs, RValue<UInt2> rhs);
1553*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator<<=(UInt2 &lhs, unsigned char rhs);
1554*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator>>=(UInt2 &lhs, unsigned char rhs);
1555*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator+(RValue<UInt2> val);
1556*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator-(RValue<UInt2> val);
1557*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> operator~(RValue<UInt2> val);
1558*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator++(UInt2 &val, int);   // Post-increment
1559*03ce13f7SAndroid Build Coastguard Worker //	const UInt2 &operator++(UInt2 &val);   // Pre-increment
1560*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> operator--(UInt2 &val, int);   // Post-decrement
1561*03ce13f7SAndroid Build Coastguard Worker //	const UInt2 &operator--(UInt2 &val);   // Pre-decrement
1562*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<(RValue<UInt2> lhs, RValue<UInt2> rhs);
1563*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1564*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>(RValue<UInt2> lhs, RValue<UInt2> rhs);
1565*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1566*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator!=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1567*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator==(RValue<UInt2> lhs, RValue<UInt2> rhs);
1568*03ce13f7SAndroid Build Coastguard Worker 
1569*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt2> RoundInt(RValue<Float4> cast);
1570*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> Extract(RValue<UInt2> val, int i);
1571*03ce13f7SAndroid Build Coastguard Worker RValue<UInt2> Insert(RValue<UInt2> val, RValue<UInt> element, int i);
1572*03ce13f7SAndroid Build Coastguard Worker 
1573*03ce13f7SAndroid Build Coastguard Worker class Int4 : public LValue<Int4>, public XYZW<Int4>
1574*03ce13f7SAndroid Build Coastguard Worker {
1575*03ce13f7SAndroid Build Coastguard Worker public:
1576*03ce13f7SAndroid Build Coastguard Worker 	explicit Int4(RValue<Byte4> cast);
1577*03ce13f7SAndroid Build Coastguard Worker 	explicit Int4(RValue<SByte4> cast);
1578*03ce13f7SAndroid Build Coastguard Worker 	explicit Int4(RValue<Float4> cast);
1579*03ce13f7SAndroid Build Coastguard Worker 	explicit Int4(RValue<Short4> cast);
1580*03ce13f7SAndroid Build Coastguard Worker 	explicit Int4(RValue<UShort4> cast);
1581*03ce13f7SAndroid Build Coastguard Worker 
1582*03ce13f7SAndroid Build Coastguard Worker 	Int4();
1583*03ce13f7SAndroid Build Coastguard Worker 	Int4(int xyzw);
1584*03ce13f7SAndroid Build Coastguard Worker 	Int4(int x, int yzw);
1585*03ce13f7SAndroid Build Coastguard Worker 	Int4(int x, int y, int zw);
1586*03ce13f7SAndroid Build Coastguard Worker 	Int4(int x, int y, int z, int w);
1587*03ce13f7SAndroid Build Coastguard Worker 	Int4(RValue<Int4> rhs);
1588*03ce13f7SAndroid Build Coastguard Worker 	Int4(const Int4 &rhs);
1589*03ce13f7SAndroid Build Coastguard Worker 	Int4(const Reference<Int4> &rhs);
1590*03ce13f7SAndroid Build Coastguard Worker 	Int4(RValue<UInt4> rhs);
1591*03ce13f7SAndroid Build Coastguard Worker 	Int4(const UInt4 &rhs);
1592*03ce13f7SAndroid Build Coastguard Worker 	Int4(const Reference<UInt4> &rhs);
1593*03ce13f7SAndroid Build Coastguard Worker 	Int4(RValue<Int2> lo, RValue<Int2> hi);
1594*03ce13f7SAndroid Build Coastguard Worker 	Int4(RValue<Int> rhs);
1595*03ce13f7SAndroid Build Coastguard Worker 	Int4(const Int &rhs);
1596*03ce13f7SAndroid Build Coastguard Worker 	Int4(const Reference<Int> &rhs);
1597*03ce13f7SAndroid Build Coastguard Worker 
1598*03ce13f7SAndroid Build Coastguard Worker 	template<int T>
1599*03ce13f7SAndroid Build Coastguard Worker 	Int4(const SwizzleMask1<Int4, T> &rhs);
1600*03ce13f7SAndroid Build Coastguard Worker 
1601*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int4> operator=(int broadcast);
1602*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int4> operator=(RValue<Int4> rhs);
1603*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int4> operator=(const Int4 &rhs);
1604*03ce13f7SAndroid Build Coastguard Worker 	RValue<Int4> operator=(const Reference<Int4> &rhs);
1605*03ce13f7SAndroid Build Coastguard Worker 
1606*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()1607*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 4; }
1608*03ce13f7SAndroid Build Coastguard Worker 
1609*03ce13f7SAndroid Build Coastguard Worker private:
1610*03ce13f7SAndroid Build Coastguard Worker 	void constant(int x, int y, int z, int w);
1611*03ce13f7SAndroid Build Coastguard Worker };
1612*03ce13f7SAndroid Build Coastguard Worker 
1613*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs);
1614*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs);
1615*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs);
1616*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs);
1617*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs);
1618*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs);
1619*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs);
1620*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs);
1621*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs);
1622*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs);
1623*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs);
1624*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs);
1625*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator+=(Int4 &lhs, RValue<Int4> rhs);
1626*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator-=(Int4 &lhs, RValue<Int4> rhs);
1627*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator*=(Int4 &lhs, RValue<Int4> rhs);
1628*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int4> operator/=(Int4 &lhs, RValue<Int4> rhs);
1629*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int4> operator%=(Int4 &lhs, RValue<Int4> rhs);
1630*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator&=(Int4 &lhs, RValue<Int4> rhs);
1631*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator|=(Int4 &lhs, RValue<Int4> rhs);
1632*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator^=(Int4 &lhs, RValue<Int4> rhs);
1633*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator<<=(Int4 &lhs, unsigned char rhs);
1634*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator>>=(Int4 &lhs, unsigned char rhs);
1635*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator+(RValue<Int4> val);
1636*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator-(RValue<Int4> val);
1637*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> operator~(RValue<Int4> val);
1638*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int4> operator++(Int4 &val, int);   // Post-increment
1639*03ce13f7SAndroid Build Coastguard Worker //	const Int4 &operator++(Int4 &val);   // Pre-increment
1640*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int4> operator--(Int4 &val, int);   // Post-decrement
1641*03ce13f7SAndroid Build Coastguard Worker //	const Int4 &operator--(Int4 &val);   // Pre-decrement
1642*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<(RValue<Int4> lhs, RValue<Int4> rhs);
1643*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<=(RValue<Int4> lhs, RValue<Int4> rhs);
1644*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>(RValue<Int4> lhs, RValue<Int4> rhs);
1645*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>=(RValue<Int4> lhs, RValue<Int4> rhs);
1646*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator!=(RValue<Int4> lhs, RValue<Int4> rhs);
1647*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator==(RValue<Int4> lhs, RValue<Int4> rhs);
1648*03ce13f7SAndroid Build Coastguard Worker 
1649*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y);
1650*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y);
1651*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpLE(RValue<Int4> x, RValue<Int4> y);
1652*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpNEQ(RValue<Int4> x, RValue<Int4> y);
1653*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpNLT(RValue<Int4> x, RValue<Int4> y);
1654*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpNLE(RValue<Int4> x, RValue<Int4> y);
CmpGT(RValue<Int4> x,RValue<Int4> y)1655*03ce13f7SAndroid Build Coastguard Worker inline RValue<Int4> CmpGT(RValue<Int4> x, RValue<Int4> y)
1656*03ce13f7SAndroid Build Coastguard Worker {
1657*03ce13f7SAndroid Build Coastguard Worker 	return CmpNLE(x, y);
1658*03ce13f7SAndroid Build Coastguard Worker }
CmpGE(RValue<Int4> x,RValue<Int4> y)1659*03ce13f7SAndroid Build Coastguard Worker inline RValue<Int4> CmpGE(RValue<Int4> x, RValue<Int4> y)
1660*03ce13f7SAndroid Build Coastguard Worker {
1661*03ce13f7SAndroid Build Coastguard Worker 	return CmpNLT(x, y);
1662*03ce13f7SAndroid Build Coastguard Worker }
1663*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> Abs(RValue<Int4> x);
1664*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> Max(RValue<Int4> x, RValue<Int4> y);
1665*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> Min(RValue<Int4> x, RValue<Int4> y);
1666*03ce13f7SAndroid Build Coastguard Worker // Convert to nearest integer. If a converted value is outside of the integer
1667*03ce13f7SAndroid Build Coastguard Worker // range, the returned result is undefined.
1668*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> RoundInt(RValue<Float4> cast);
1669*03ce13f7SAndroid Build Coastguard Worker // Rounds to the nearest integer, but clamps very large values to an
1670*03ce13f7SAndroid Build Coastguard Worker // implementation-dependent range.
1671*03ce13f7SAndroid Build Coastguard Worker // Specifically, on x86, values larger than 2147483583.0 are converted to
1672*03ce13f7SAndroid Build Coastguard Worker // 2147483583 (0x7FFFFFBF) instead of producing 0x80000000.
1673*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> RoundIntClamped(RValue<Float4> cast);
1674*03ce13f7SAndroid Build Coastguard Worker RValue<Short8> PackSigned(RValue<Int4> x, RValue<Int4> y);
1675*03ce13f7SAndroid Build Coastguard Worker RValue<UShort8> PackUnsigned(RValue<Int4> x, RValue<Int4> y);
1676*03ce13f7SAndroid Build Coastguard Worker RValue<Int> Extract(RValue<Int4> val, int i);
1677*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> Insert(RValue<Int4> val, RValue<Int> element, int i);
1678*03ce13f7SAndroid Build Coastguard Worker RValue<Int> SignMask(RValue<Int4> x);
1679*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> Swizzle(RValue<Int4> x, uint16_t select);
1680*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> Shuffle(RValue<Int4> x, RValue<Int4> y, uint16_t select);
1681*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> MulHigh(RValue<Int4> x, RValue<Int4> y);
1682*03ce13f7SAndroid Build Coastguard Worker 
1683*03ce13f7SAndroid Build Coastguard Worker class UInt4 : public LValue<UInt4>, public XYZW<UInt4>
1684*03ce13f7SAndroid Build Coastguard Worker {
1685*03ce13f7SAndroid Build Coastguard Worker public:
1686*03ce13f7SAndroid Build Coastguard Worker 	explicit UInt4(RValue<Float4> cast);
1687*03ce13f7SAndroid Build Coastguard Worker 
1688*03ce13f7SAndroid Build Coastguard Worker 	UInt4();
1689*03ce13f7SAndroid Build Coastguard Worker 	UInt4(int xyzw);
1690*03ce13f7SAndroid Build Coastguard Worker 	UInt4(int x, int yzw);
1691*03ce13f7SAndroid Build Coastguard Worker 	UInt4(int x, int y, int zw);
1692*03ce13f7SAndroid Build Coastguard Worker 	UInt4(int x, int y, int z, int w);
1693*03ce13f7SAndroid Build Coastguard Worker 	UInt4(RValue<UInt4> rhs);
1694*03ce13f7SAndroid Build Coastguard Worker 	UInt4(const UInt4 &rhs);
1695*03ce13f7SAndroid Build Coastguard Worker 	UInt4(const Reference<UInt4> &rhs);
1696*03ce13f7SAndroid Build Coastguard Worker 	UInt4(RValue<Int4> rhs);
1697*03ce13f7SAndroid Build Coastguard Worker 	UInt4(const Int4 &rhs);
1698*03ce13f7SAndroid Build Coastguard Worker 	UInt4(const Reference<Int4> &rhs);
1699*03ce13f7SAndroid Build Coastguard Worker 	UInt4(RValue<UInt2> lo, RValue<UInt2> hi);
1700*03ce13f7SAndroid Build Coastguard Worker 	UInt4(RValue<UInt> rhs);
1701*03ce13f7SAndroid Build Coastguard Worker 	UInt4(const UInt &rhs);
1702*03ce13f7SAndroid Build Coastguard Worker 	UInt4(const Reference<UInt> &rhs);
1703*03ce13f7SAndroid Build Coastguard Worker 
1704*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt4> operator=(RValue<UInt4> rhs);
1705*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt4> operator=(const UInt4 &rhs);
1706*03ce13f7SAndroid Build Coastguard Worker 	RValue<UInt4> operator=(const Reference<UInt4> &rhs);
1707*03ce13f7SAndroid Build Coastguard Worker 
1708*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()1709*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 4; }
1710*03ce13f7SAndroid Build Coastguard Worker 
1711*03ce13f7SAndroid Build Coastguard Worker private:
1712*03ce13f7SAndroid Build Coastguard Worker 	void constant(int x, int y, int z, int w);
1713*03ce13f7SAndroid Build Coastguard Worker };
1714*03ce13f7SAndroid Build Coastguard Worker 
1715*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs);
1716*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs);
1717*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs);
1718*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs);
1719*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs);
1720*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs);
1721*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs);
1722*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs);
1723*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs);
1724*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs);
1725*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs);
1726*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs);
1727*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator+=(UInt4 &lhs, RValue<UInt4> rhs);
1728*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator-=(UInt4 &lhs, RValue<UInt4> rhs);
1729*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator*=(UInt4 &lhs, RValue<UInt4> rhs);
1730*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt4> operator/=(UInt4 &lhs, RValue<UInt4> rhs);
1731*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt4> operator%=(UInt4 &lhs, RValue<UInt4> rhs);
1732*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator&=(UInt4 &lhs, RValue<UInt4> rhs);
1733*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator|=(UInt4 &lhs, RValue<UInt4> rhs);
1734*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator^=(UInt4 &lhs, RValue<UInt4> rhs);
1735*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator<<=(UInt4 &lhs, unsigned char rhs);
1736*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator>>=(UInt4 &lhs, unsigned char rhs);
1737*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator+(RValue<UInt4> val);
1738*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator-(RValue<UInt4> val);
1739*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> operator~(RValue<UInt4> val);
1740*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt4> operator++(UInt4 &val, int);   // Post-increment
1741*03ce13f7SAndroid Build Coastguard Worker //	const UInt4 &operator++(UInt4 &val);   // Pre-increment
1742*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt4> operator--(UInt4 &val, int);   // Post-decrement
1743*03ce13f7SAndroid Build Coastguard Worker //	const UInt4 &operator--(UInt4 &val);   // Pre-decrement
1744*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<(RValue<UInt4> lhs, RValue<UInt4> rhs);
1745*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator<=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1746*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>(RValue<UInt4> lhs, RValue<UInt4> rhs);
1747*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator>=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1748*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator!=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1749*03ce13f7SAndroid Build Coastguard Worker //	RValue<Bool> operator==(RValue<UInt4> lhs, RValue<UInt4> rhs);
1750*03ce13f7SAndroid Build Coastguard Worker 
1751*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y);
1752*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y);
1753*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> CmpLE(RValue<UInt4> x, RValue<UInt4> y);
1754*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> CmpNEQ(RValue<UInt4> x, RValue<UInt4> y);
1755*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> CmpNLT(RValue<UInt4> x, RValue<UInt4> y);
1756*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> CmpNLE(RValue<UInt4> x, RValue<UInt4> y);
CmpGT(RValue<UInt4> x,RValue<UInt4> y)1757*03ce13f7SAndroid Build Coastguard Worker inline RValue<UInt4> CmpGT(RValue<UInt4> x, RValue<UInt4> y)
1758*03ce13f7SAndroid Build Coastguard Worker {
1759*03ce13f7SAndroid Build Coastguard Worker 	return CmpNLE(x, y);
1760*03ce13f7SAndroid Build Coastguard Worker }
CmpGE(RValue<UInt4> x,RValue<UInt4> y)1761*03ce13f7SAndroid Build Coastguard Worker inline RValue<UInt4> CmpGE(RValue<UInt4> x, RValue<UInt4> y)
1762*03ce13f7SAndroid Build Coastguard Worker {
1763*03ce13f7SAndroid Build Coastguard Worker 	return CmpNLT(x, y);
1764*03ce13f7SAndroid Build Coastguard Worker }
1765*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> Max(RValue<UInt4> x, RValue<UInt4> y);
1766*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> Min(RValue<UInt4> x, RValue<UInt4> y);
1767*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> MulHigh(RValue<UInt4> x, RValue<UInt4> y);
1768*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> Extract(RValue<UInt4> val, int i);
1769*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> Insert(RValue<UInt4> val, RValue<UInt> element, int i);
1770*03ce13f7SAndroid Build Coastguard Worker //	RValue<UInt4> RoundInt(RValue<Float4> cast);
1771*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> Swizzle(RValue<UInt4> x, uint16_t select);
1772*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> Shuffle(RValue<UInt4> x, RValue<UInt4> y, uint16_t select);
1773*03ce13f7SAndroid Build Coastguard Worker 
1774*03ce13f7SAndroid Build Coastguard Worker class Half : public LValue<Half>
1775*03ce13f7SAndroid Build Coastguard Worker {
1776*03ce13f7SAndroid Build Coastguard Worker public:
1777*03ce13f7SAndroid Build Coastguard Worker 	explicit Half(RValue<Float> cast);
1778*03ce13f7SAndroid Build Coastguard Worker 
1779*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
1780*03ce13f7SAndroid Build Coastguard Worker };
1781*03ce13f7SAndroid Build Coastguard Worker 
1782*03ce13f7SAndroid Build Coastguard Worker class Float : public LValue<Float>
1783*03ce13f7SAndroid Build Coastguard Worker {
1784*03ce13f7SAndroid Build Coastguard Worker public:
1785*03ce13f7SAndroid Build Coastguard Worker 	explicit Float(RValue<Int> cast);
1786*03ce13f7SAndroid Build Coastguard Worker 	explicit Float(RValue<UInt> cast);
1787*03ce13f7SAndroid Build Coastguard Worker 	explicit Float(RValue<Half> cast);
1788*03ce13f7SAndroid Build Coastguard Worker 
1789*03ce13f7SAndroid Build Coastguard Worker 	Float() = default;
1790*03ce13f7SAndroid Build Coastguard Worker 	Float(float x);
1791*03ce13f7SAndroid Build Coastguard Worker 	Float(RValue<Float> rhs);
1792*03ce13f7SAndroid Build Coastguard Worker 	Float(const Float &rhs);
1793*03ce13f7SAndroid Build Coastguard Worker 	Float(const Reference<Float> &rhs);
1794*03ce13f7SAndroid Build Coastguard Worker 	Float(Argument<Float> argument);
1795*03ce13f7SAndroid Build Coastguard Worker 
1796*03ce13f7SAndroid Build Coastguard Worker 	template<int T>
1797*03ce13f7SAndroid Build Coastguard Worker 	Float(const SwizzleMask1<Float4, T> &rhs);
1798*03ce13f7SAndroid Build Coastguard Worker 
1799*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float> operator=(float rhs);
1800*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float> operator=(RValue<Float> rhs);
1801*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float> operator=(const Float &rhs);
1802*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float> operator=(const Reference<Float> &rhs);
1803*03ce13f7SAndroid Build Coastguard Worker 
1804*03ce13f7SAndroid Build Coastguard Worker 	template<int T>
1805*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float> operator=(const SwizzleMask1<Float4, T> &rhs);
1806*03ce13f7SAndroid Build Coastguard Worker 
1807*03ce13f7SAndroid Build Coastguard Worker 	static Float infinity();
1808*03ce13f7SAndroid Build Coastguard Worker 
1809*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
1810*03ce13f7SAndroid Build Coastguard Worker };
1811*03ce13f7SAndroid Build Coastguard Worker 
1812*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs);
1813*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs);
1814*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs);
1815*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs);
1816*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator+=(Float &lhs, RValue<Float> rhs);
1817*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator-=(Float &lhs, RValue<Float> rhs);
1818*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator*=(Float &lhs, RValue<Float> rhs);
1819*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator/=(Float &lhs, RValue<Float> rhs);
1820*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator+(RValue<Float> val);
1821*03ce13f7SAndroid Build Coastguard Worker RValue<Float> operator-(RValue<Float> val);
1822*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs);
1823*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs);
1824*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs);
1825*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs);
1826*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs);
1827*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs);
1828*03ce13f7SAndroid Build Coastguard Worker 
1829*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Abs(RValue<Float> x);
1830*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Max(RValue<Float> x, RValue<Float> y);
1831*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Min(RValue<Float> x, RValue<Float> y);
1832*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Rcp(RValue<Float> x, bool relaxedPrecision, bool exactAtPow2 = false);
1833*03ce13f7SAndroid Build Coastguard Worker RValue<Float> RcpSqrt(RValue<Float> x, bool relaxedPrecision);
1834*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Sqrt(RValue<Float> x);
1835*03ce13f7SAndroid Build Coastguard Worker 
1836*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int4> IsInf(RValue<Float> x);
1837*03ce13f7SAndroid Build Coastguard Worker //	RValue<Int4> IsNan(RValue<Float> x);
1838*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Round(RValue<Float> x);
1839*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Trunc(RValue<Float> x);
1840*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Frac(RValue<Float> x);
1841*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Floor(RValue<Float> x);
1842*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Ceil(RValue<Float> x);
1843*03ce13f7SAndroid Build Coastguard Worker 
1844*03ce13f7SAndroid Build Coastguard Worker // Trigonometric functions
1845*03ce13f7SAndroid Build Coastguard Worker // TODO: Currently unimplemented for Subzero.
1846*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Sin(RValue<Float> x);
1847*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Cos(RValue<Float> x);
1848*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Tan(RValue<Float> x);
1849*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Asin(RValue<Float> x);
1850*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Acos(RValue<Float> x);
1851*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Atan(RValue<Float> x);
1852*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Sinh(RValue<Float> x);
1853*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Cosh(RValue<Float> x);
1854*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Tanh(RValue<Float> x);
1855*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Asinh(RValue<Float> x);
1856*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Acosh(RValue<Float> x);
1857*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Atanh(RValue<Float> x);
1858*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Atan2(RValue<Float> x, RValue<Float> y);
1859*03ce13f7SAndroid Build Coastguard Worker 
1860*03ce13f7SAndroid Build Coastguard Worker // Exponential functions
1861*03ce13f7SAndroid Build Coastguard Worker // TODO: Currently unimplemented for Subzero.
1862*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Pow(RValue<Float> x, RValue<Float> y);
1863*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Exp(RValue<Float> x);
1864*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float> Log(RValue<Float> x);
1865*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Exp2(RValue<Float> x);
1866*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Log2(RValue<Float> x);
1867*03ce13f7SAndroid Build Coastguard Worker 
1868*03ce13f7SAndroid Build Coastguard Worker class Float2 : public LValue<Float2>
1869*03ce13f7SAndroid Build Coastguard Worker {
1870*03ce13f7SAndroid Build Coastguard Worker public:
1871*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Float2(RValue<Byte2> cast);
1872*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Float2(RValue<Short2> cast);
1873*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Float2(RValue<UShort2> cast);
1874*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Float2(RValue<Int2> cast);
1875*03ce13f7SAndroid Build Coastguard Worker 	//	explicit Float2(RValue<UInt2> cast);
1876*03ce13f7SAndroid Build Coastguard Worker 	explicit Float2(RValue<Float4> cast);
1877*03ce13f7SAndroid Build Coastguard Worker 
1878*03ce13f7SAndroid Build Coastguard Worker 	Float2() = default;
1879*03ce13f7SAndroid Build Coastguard Worker 	//	Float2(float x, float y);
1880*03ce13f7SAndroid Build Coastguard Worker 	//	Float2(RValue<Float2> rhs);
1881*03ce13f7SAndroid Build Coastguard Worker 	//	Float2(const Float2 &rhs);
1882*03ce13f7SAndroid Build Coastguard Worker 	//	Float2(const Reference<Float2> &rhs);
1883*03ce13f7SAndroid Build Coastguard Worker 	//	Float2(RValue<Float> rhs);
1884*03ce13f7SAndroid Build Coastguard Worker 	//	Float2(const Float &rhs);
1885*03ce13f7SAndroid Build Coastguard Worker 	//	Float2(const Reference<Float> &rhs);
1886*03ce13f7SAndroid Build Coastguard Worker 
1887*03ce13f7SAndroid Build Coastguard Worker 	//	template<int T>
1888*03ce13f7SAndroid Build Coastguard Worker 	//	Float2(const SwizzleMask1<T> &rhs);
1889*03ce13f7SAndroid Build Coastguard Worker 
1890*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Float2> operator=(float broadcast);
1891*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Float2> operator=(RValue<Float2> rhs);
1892*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Float2> operator=(const Float2 &rhs);
1893*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Float2> operator=(const Reference<Float2> &rhs);
1894*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Float2> operator=(RValue<Float> rhs);
1895*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Float2> operator=(const Float &rhs);
1896*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Float2> operator=(const Reference<Float> &rhs);
1897*03ce13f7SAndroid Build Coastguard Worker 
1898*03ce13f7SAndroid Build Coastguard Worker 	//	template<int T>
1899*03ce13f7SAndroid Build Coastguard Worker 	//	RValue<Float2> operator=(const SwizzleMask1<T> &rhs);
1900*03ce13f7SAndroid Build Coastguard Worker 
1901*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()1902*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 2; }
1903*03ce13f7SAndroid Build Coastguard Worker };
1904*03ce13f7SAndroid Build Coastguard Worker 
1905*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator+(RValue<Float2> lhs, RValue<Float2> rhs);
1906*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator-(RValue<Float2> lhs, RValue<Float2> rhs);
1907*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator*(RValue<Float2> lhs, RValue<Float2> rhs);
1908*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator/(RValue<Float2> lhs, RValue<Float2> rhs);
1909*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator%(RValue<Float2> lhs, RValue<Float2> rhs);
1910*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator+=(Float2 &lhs, RValue<Float2> rhs);
1911*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator-=(Float2 &lhs, RValue<Float2> rhs);
1912*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator*=(Float2 &lhs, RValue<Float2> rhs);
1913*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator/=(Float2 &lhs, RValue<Float2> rhs);
1914*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator%=(Float2 &lhs, RValue<Float2> rhs);
1915*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator+(RValue<Float2> val);
1916*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> operator-(RValue<Float2> val);
1917*03ce13f7SAndroid Build Coastguard Worker 
1918*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> Abs(RValue<Float2> x);
1919*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> Max(RValue<Float2> x, RValue<Float2> y);
1920*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> Min(RValue<Float2> x, RValue<Float2> y);
1921*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> Swizzle(RValue<Float2> x, uint16_t select);
1922*03ce13f7SAndroid Build Coastguard Worker //	RValue<Float2> Mask(Float2 &lhs, RValue<Float2> rhs, uint16_t select);
1923*03ce13f7SAndroid Build Coastguard Worker 
1924*03ce13f7SAndroid Build Coastguard Worker class Float4 : public LValue<Float4>, public XYZW<Float4>
1925*03ce13f7SAndroid Build Coastguard Worker {
1926*03ce13f7SAndroid Build Coastguard Worker public:
1927*03ce13f7SAndroid Build Coastguard Worker 	explicit Float4(RValue<Byte4> cast);
1928*03ce13f7SAndroid Build Coastguard Worker 	explicit Float4(RValue<SByte4> cast);
1929*03ce13f7SAndroid Build Coastguard Worker 	explicit Float4(RValue<Short4> cast);
1930*03ce13f7SAndroid Build Coastguard Worker 	explicit Float4(RValue<UShort4> cast);
1931*03ce13f7SAndroid Build Coastguard Worker 	explicit Float4(RValue<Int4> cast);
1932*03ce13f7SAndroid Build Coastguard Worker 	explicit Float4(RValue<UInt4> cast);
1933*03ce13f7SAndroid Build Coastguard Worker 
1934*03ce13f7SAndroid Build Coastguard Worker 	Float4();
1935*03ce13f7SAndroid Build Coastguard Worker 	Float4(float xyzw);
1936*03ce13f7SAndroid Build Coastguard Worker 	Float4(float x, float yzw);
1937*03ce13f7SAndroid Build Coastguard Worker 	Float4(float x, float y, float zw);
1938*03ce13f7SAndroid Build Coastguard Worker 	Float4(float x, float y, float z, float w);
1939*03ce13f7SAndroid Build Coastguard Worker 	Float4(RValue<Float4> rhs);
1940*03ce13f7SAndroid Build Coastguard Worker 	Float4(const Float4 &rhs);
1941*03ce13f7SAndroid Build Coastguard Worker 	Float4(const Reference<Float4> &rhs);
1942*03ce13f7SAndroid Build Coastguard Worker 	Float4(RValue<Float> rhs);
1943*03ce13f7SAndroid Build Coastguard Worker 	Float4(const Float &rhs);
1944*03ce13f7SAndroid Build Coastguard Worker 	Float4(const Reference<Float> &rhs);
1945*03ce13f7SAndroid Build Coastguard Worker 
1946*03ce13f7SAndroid Build Coastguard Worker 	template<int T>
1947*03ce13f7SAndroid Build Coastguard Worker 	Float4(const SwizzleMask1<Float4, T> &rhs);
1948*03ce13f7SAndroid Build Coastguard Worker 	template<int T>
1949*03ce13f7SAndroid Build Coastguard Worker 	Float4(const Swizzle4<Float4, T> &rhs);
1950*03ce13f7SAndroid Build Coastguard Worker 	template<int X, int Y>
1951*03ce13f7SAndroid Build Coastguard Worker 	Float4(const Swizzle2<Float4, X> &x, const Swizzle2<Float4, Y> &y);
1952*03ce13f7SAndroid Build Coastguard Worker 	template<int X, int Y>
1953*03ce13f7SAndroid Build Coastguard Worker 	Float4(const SwizzleMask2<Float4, X> &x, const Swizzle2<Float4, Y> &y);
1954*03ce13f7SAndroid Build Coastguard Worker 	template<int X, int Y>
1955*03ce13f7SAndroid Build Coastguard Worker 	Float4(const Swizzle2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y);
1956*03ce13f7SAndroid Build Coastguard Worker 	template<int X, int Y>
1957*03ce13f7SAndroid Build Coastguard Worker 	Float4(const SwizzleMask2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y);
1958*03ce13f7SAndroid Build Coastguard Worker 	Float4(RValue<Float2> lo, RValue<Float2> hi);
1959*03ce13f7SAndroid Build Coastguard Worker 
1960*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float4> operator=(float broadcast);
1961*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float4> operator=(RValue<Float4> rhs);
1962*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float4> operator=(const Float4 &rhs);
1963*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float4> operator=(const Reference<Float4> &rhs);
1964*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float4> operator=(RValue<Float> rhs);
1965*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float4> operator=(const Float &rhs);
1966*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float4> operator=(const Reference<Float> &rhs);
1967*03ce13f7SAndroid Build Coastguard Worker 
1968*03ce13f7SAndroid Build Coastguard Worker 	template<int T>
1969*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float4> operator=(const SwizzleMask1<Float4, T> &rhs);
1970*03ce13f7SAndroid Build Coastguard Worker 	template<int T>
1971*03ce13f7SAndroid Build Coastguard Worker 	RValue<Float4> operator=(const Swizzle4<Float4, T> &rhs);
1972*03ce13f7SAndroid Build Coastguard Worker 
1973*03ce13f7SAndroid Build Coastguard Worker 	static Float4 infinity();
1974*03ce13f7SAndroid Build Coastguard Worker 
1975*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
element_count()1976*03ce13f7SAndroid Build Coastguard Worker 	static int element_count() { return 4; }
1977*03ce13f7SAndroid Build Coastguard Worker 
1978*03ce13f7SAndroid Build Coastguard Worker private:
1979*03ce13f7SAndroid Build Coastguard Worker 	void constant(float x, float y, float z, float w);
1980*03ce13f7SAndroid Build Coastguard Worker };
1981*03ce13f7SAndroid Build Coastguard Worker 
1982*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs);
1983*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs);
1984*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs);
1985*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs);
1986*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs);
1987*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator+=(Float4 &lhs, RValue<Float4> rhs);
1988*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator-=(Float4 &lhs, RValue<Float4> rhs);
1989*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator*=(Float4 &lhs, RValue<Float4> rhs);
1990*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator/=(Float4 &lhs, RValue<Float4> rhs);
1991*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator%=(Float4 &lhs, RValue<Float4> rhs);
1992*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator+(RValue<Float4> val);
1993*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> operator-(RValue<Float4> val);
1994*03ce13f7SAndroid Build Coastguard Worker 
1995*03ce13f7SAndroid Build Coastguard Worker // Computes `x * y + z`, which may be fused into one operation to produce a higher-precision result.
1996*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> MulAdd(RValue<Float4> x, RValue<Float4> y, RValue<Float4> z);
1997*03ce13f7SAndroid Build Coastguard Worker // Computes a fused `x * y + z` operation. Caps::fmaIsFast indicates whether it emits an FMA instruction.
1998*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> FMA(RValue<Float4> x, RValue<Float4> y, RValue<Float4> z);
1999*03ce13f7SAndroid Build Coastguard Worker 
2000*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Abs(RValue<Float4> x);
2001*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y);
2002*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Min(RValue<Float4> x, RValue<Float4> y);
2003*03ce13f7SAndroid Build Coastguard Worker 
2004*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Rcp(RValue<Float4> x, bool relaxedPrecision, bool exactAtPow2 = false);
2005*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> RcpSqrt(RValue<Float4> x, bool relaxedPrecision);
2006*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Sqrt(RValue<Float4> x);
2007*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Insert(RValue<Float4> val, RValue<Float> element, int i);
2008*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Extract(RValue<Float4> x, int i);
2009*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Swizzle(RValue<Float4> x, uint16_t select);
2010*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Shuffle(RValue<Float4> x, RValue<Float4> y, uint16_t select);
2011*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, uint16_t imm);
2012*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y);
2013*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y);
2014*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, uint16_t select);
2015*03ce13f7SAndroid Build Coastguard Worker RValue<Int> SignMask(RValue<Float4> x);
2016*03ce13f7SAndroid Build Coastguard Worker 
2017*03ce13f7SAndroid Build Coastguard Worker // Ordered comparison functions
2018*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpEQ(RValue<Float4> x, RValue<Float4> y);
2019*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpLT(RValue<Float4> x, RValue<Float4> y);
2020*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpLE(RValue<Float4> x, RValue<Float4> y);
2021*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpNEQ(RValue<Float4> x, RValue<Float4> y);
2022*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpNLT(RValue<Float4> x, RValue<Float4> y);
2023*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpNLE(RValue<Float4> x, RValue<Float4> y);
CmpGT(RValue<Float4> x,RValue<Float4> y)2024*03ce13f7SAndroid Build Coastguard Worker inline RValue<Int4> CmpGT(RValue<Float4> x, RValue<Float4> y)
2025*03ce13f7SAndroid Build Coastguard Worker {
2026*03ce13f7SAndroid Build Coastguard Worker 	return CmpNLE(x, y);
2027*03ce13f7SAndroid Build Coastguard Worker }
CmpGE(RValue<Float4> x,RValue<Float4> y)2028*03ce13f7SAndroid Build Coastguard Worker inline RValue<Int4> CmpGE(RValue<Float4> x, RValue<Float4> y)
2029*03ce13f7SAndroid Build Coastguard Worker {
2030*03ce13f7SAndroid Build Coastguard Worker 	return CmpNLT(x, y);
2031*03ce13f7SAndroid Build Coastguard Worker }
2032*03ce13f7SAndroid Build Coastguard Worker 
2033*03ce13f7SAndroid Build Coastguard Worker // Unordered comparison functions
2034*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpUEQ(RValue<Float4> x, RValue<Float4> y);
2035*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpULT(RValue<Float4> x, RValue<Float4> y);
2036*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpULE(RValue<Float4> x, RValue<Float4> y);
2037*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpUNEQ(RValue<Float4> x, RValue<Float4> y);
2038*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpUNLT(RValue<Float4> x, RValue<Float4> y);
2039*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> CmpUNLE(RValue<Float4> x, RValue<Float4> y);
CmpUGT(RValue<Float4> x,RValue<Float4> y)2040*03ce13f7SAndroid Build Coastguard Worker inline RValue<Int4> CmpUGT(RValue<Float4> x, RValue<Float4> y)
2041*03ce13f7SAndroid Build Coastguard Worker {
2042*03ce13f7SAndroid Build Coastguard Worker 	return CmpUNLE(x, y);
2043*03ce13f7SAndroid Build Coastguard Worker }
CmpUGE(RValue<Float4> x,RValue<Float4> y)2044*03ce13f7SAndroid Build Coastguard Worker inline RValue<Int4> CmpUGE(RValue<Float4> x, RValue<Float4> y)
2045*03ce13f7SAndroid Build Coastguard Worker {
2046*03ce13f7SAndroid Build Coastguard Worker 	return CmpUNLT(x, y);
2047*03ce13f7SAndroid Build Coastguard Worker }
2048*03ce13f7SAndroid Build Coastguard Worker 
2049*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> IsInf(RValue<Float4> x);
2050*03ce13f7SAndroid Build Coastguard Worker RValue<Int4> IsNan(RValue<Float4> x);
2051*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Round(RValue<Float4> x);
2052*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Trunc(RValue<Float4> x);
2053*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Frac(RValue<Float4> x);
2054*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Floor(RValue<Float4> x);
2055*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Ceil(RValue<Float4> x);
Mix(RValue<Float4> x,RValue<Float4> y,RValue<Float4> frac)2056*03ce13f7SAndroid Build Coastguard Worker inline RValue<Float4> Mix(RValue<Float4> x, RValue<Float4> y, RValue<Float4> frac) {
2057*03ce13f7SAndroid Build Coastguard Worker 	return (x * (Float4(1.0f) - frac)) + (y * frac);
2058*03ce13f7SAndroid Build Coastguard Worker }
2059*03ce13f7SAndroid Build Coastguard Worker 
2060*03ce13f7SAndroid Build Coastguard Worker // Trigonometric functions
2061*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Sin(RValue<Float4> x);
2062*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Cos(RValue<Float4> x);
2063*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Tan(RValue<Float4> x);
2064*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Asin(RValue<Float4> x);
2065*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Acos(RValue<Float4> x);
2066*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Atan(RValue<Float4> x);
2067*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Sinh(RValue<Float4> x);
2068*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Cosh(RValue<Float4> x);
2069*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Tanh(RValue<Float4> x);
2070*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Asinh(RValue<Float4> x);
2071*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Acosh(RValue<Float4> x);
2072*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Atanh(RValue<Float4> x);
2073*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Atan2(RValue<Float4> x, RValue<Float4> y);
2074*03ce13f7SAndroid Build Coastguard Worker 
2075*03ce13f7SAndroid Build Coastguard Worker // Exponential functions
2076*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Pow(RValue<Float4> x, RValue<Float4> y);
2077*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Exp(RValue<Float4> x);
2078*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Log(RValue<Float4> x);
2079*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Exp2(RValue<Float4> x);
2080*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Log2(RValue<Float4> x);
2081*03ce13f7SAndroid Build Coastguard Worker 
2082*03ce13f7SAndroid Build Coastguard Worker // Call a unary C function on each element of a vector type.
2083*03ce13f7SAndroid Build Coastguard Worker template<typename Func, typename T>
ScalarizeCall(Func func,const RValue<T> & x)2084*03ce13f7SAndroid Build Coastguard Worker inline RValue<T> ScalarizeCall(Func func, const RValue<T> &x)
2085*03ce13f7SAndroid Build Coastguard Worker {
2086*03ce13f7SAndroid Build Coastguard Worker 	T result;
2087*03ce13f7SAndroid Build Coastguard Worker 	for(int i = 0; i < T::element_count(); i++)
2088*03ce13f7SAndroid Build Coastguard Worker 	{
2089*03ce13f7SAndroid Build Coastguard Worker 		result = Insert(result, Call(func, Extract(x, i)), i);
2090*03ce13f7SAndroid Build Coastguard Worker 	}
2091*03ce13f7SAndroid Build Coastguard Worker 
2092*03ce13f7SAndroid Build Coastguard Worker 	return result;
2093*03ce13f7SAndroid Build Coastguard Worker }
2094*03ce13f7SAndroid Build Coastguard Worker 
2095*03ce13f7SAndroid Build Coastguard Worker // Call a binary C function on each element of a vector type.
2096*03ce13f7SAndroid Build Coastguard Worker template<typename Func, typename T>
ScalarizeCall(Func func,const RValue<T> & x,const RValue<T> & y)2097*03ce13f7SAndroid Build Coastguard Worker inline RValue<T> ScalarizeCall(Func func, const RValue<T> &x, const RValue<T> &y)
2098*03ce13f7SAndroid Build Coastguard Worker {
2099*03ce13f7SAndroid Build Coastguard Worker 	T result;
2100*03ce13f7SAndroid Build Coastguard Worker 	for(int i = 0; i < T::element_count(); i++)
2101*03ce13f7SAndroid Build Coastguard Worker 	{
2102*03ce13f7SAndroid Build Coastguard Worker 		result = Insert(result, Call(func, Extract(x, i), Extract(y, i)), i);
2103*03ce13f7SAndroid Build Coastguard Worker 	}
2104*03ce13f7SAndroid Build Coastguard Worker 
2105*03ce13f7SAndroid Build Coastguard Worker 	return result;
2106*03ce13f7SAndroid Build Coastguard Worker }
2107*03ce13f7SAndroid Build Coastguard Worker 
2108*03ce13f7SAndroid Build Coastguard Worker // Call a ternary C function on each element of a vector type.
2109*03ce13f7SAndroid Build Coastguard Worker template<typename Func, typename T>
ScalarizeCall(Func func,const RValue<T> & x,const RValue<T> & y,const RValue<T> & z)2110*03ce13f7SAndroid Build Coastguard Worker inline RValue<T> ScalarizeCall(Func func, const RValue<T> &x, const RValue<T> &y, const RValue<T> &z)
2111*03ce13f7SAndroid Build Coastguard Worker {
2112*03ce13f7SAndroid Build Coastguard Worker 	T result;
2113*03ce13f7SAndroid Build Coastguard Worker 	for(int i = 0; i < T::element_count(); i++)
2114*03ce13f7SAndroid Build Coastguard Worker 	{
2115*03ce13f7SAndroid Build Coastguard Worker 		result = Insert(result, Call(func, Extract(x, i), Extract(y, i), Extract(z, i)), i);
2116*03ce13f7SAndroid Build Coastguard Worker 	}
2117*03ce13f7SAndroid Build Coastguard Worker 
2118*03ce13f7SAndroid Build Coastguard Worker 	return result;
2119*03ce13f7SAndroid Build Coastguard Worker }
2120*03ce13f7SAndroid Build Coastguard Worker 
2121*03ce13f7SAndroid Build Coastguard Worker // Invoke a unary lambda expression on each element of a vector type.
2122*03ce13f7SAndroid Build Coastguard Worker template<typename Func, typename T>
Scalarize(Func func,const RValue<T> & x)2123*03ce13f7SAndroid Build Coastguard Worker inline RValue<T> Scalarize(Func func, const RValue<T> &x)
2124*03ce13f7SAndroid Build Coastguard Worker {
2125*03ce13f7SAndroid Build Coastguard Worker 	T result;
2126*03ce13f7SAndroid Build Coastguard Worker 	for(int i = 0; i < T::element_count(); i++)
2127*03ce13f7SAndroid Build Coastguard Worker 	{
2128*03ce13f7SAndroid Build Coastguard Worker 		result = Insert(result, func(Extract(x, i)), i);
2129*03ce13f7SAndroid Build Coastguard Worker 	}
2130*03ce13f7SAndroid Build Coastguard Worker 
2131*03ce13f7SAndroid Build Coastguard Worker 	return result;
2132*03ce13f7SAndroid Build Coastguard Worker }
2133*03ce13f7SAndroid Build Coastguard Worker 
2134*03ce13f7SAndroid Build Coastguard Worker // Invoke a binary lambda expression on each element of a vector type.
2135*03ce13f7SAndroid Build Coastguard Worker template<typename Func, typename T>
Scalarize(Func func,const RValue<T> & x,const RValue<T> & y)2136*03ce13f7SAndroid Build Coastguard Worker inline RValue<T> Scalarize(Func func, const RValue<T> &x, const RValue<T> &y)
2137*03ce13f7SAndroid Build Coastguard Worker {
2138*03ce13f7SAndroid Build Coastguard Worker 	T result;
2139*03ce13f7SAndroid Build Coastguard Worker 	for(int i = 0; i < T::element_count(); i++)
2140*03ce13f7SAndroid Build Coastguard Worker 	{
2141*03ce13f7SAndroid Build Coastguard Worker 		result = Insert(result, func(Extract(x, i), Extract(y, i)), i);
2142*03ce13f7SAndroid Build Coastguard Worker 	}
2143*03ce13f7SAndroid Build Coastguard Worker 
2144*03ce13f7SAndroid Build Coastguard Worker 	return result;
2145*03ce13f7SAndroid Build Coastguard Worker }
2146*03ce13f7SAndroid Build Coastguard Worker 
2147*03ce13f7SAndroid Build Coastguard Worker // Invoke a ternary lambda expression on each element of a vector type.
2148*03ce13f7SAndroid Build Coastguard Worker template<typename Func, typename T>
Scalarize(Func func,const RValue<T> & x,const RValue<T> & y,const RValue<T> & z)2149*03ce13f7SAndroid Build Coastguard Worker inline RValue<T> Scalarize(Func func, const RValue<T> &x, const RValue<T> &y, const RValue<T> &z)
2150*03ce13f7SAndroid Build Coastguard Worker {
2151*03ce13f7SAndroid Build Coastguard Worker 	T result;
2152*03ce13f7SAndroid Build Coastguard Worker 	for(int i = 0; i < T::element_count(); i++)
2153*03ce13f7SAndroid Build Coastguard Worker 	{
2154*03ce13f7SAndroid Build Coastguard Worker 		result = Insert(result, func(Extract(x, i), Extract(y, i), Extract(z, i)), i);
2155*03ce13f7SAndroid Build Coastguard Worker 	}
2156*03ce13f7SAndroid Build Coastguard Worker 
2157*03ce13f7SAndroid Build Coastguard Worker 	return result;
2158*03ce13f7SAndroid Build Coastguard Worker }
2159*03ce13f7SAndroid Build Coastguard Worker 
2160*03ce13f7SAndroid Build Coastguard Worker // Bit Manipulation functions.
2161*03ce13f7SAndroid Build Coastguard Worker // TODO: Currently unimplemented for Subzero.
2162*03ce13f7SAndroid Build Coastguard Worker 
2163*03ce13f7SAndroid Build Coastguard Worker // Count leading zeros.
2164*03ce13f7SAndroid Build Coastguard Worker // Returns 32 when: !isZeroUndef && x == 0.
2165*03ce13f7SAndroid Build Coastguard Worker // Returns an undefined value when: isZeroUndef && x == 0.
2166*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> Ctlz(RValue<UInt> x, bool isZeroUndef);
2167*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> Ctlz(RValue<UInt4> x, bool isZeroUndef);
2168*03ce13f7SAndroid Build Coastguard Worker 
2169*03ce13f7SAndroid Build Coastguard Worker // Count trailing zeros.
2170*03ce13f7SAndroid Build Coastguard Worker // Returns 32 when: !isZeroUndef && x == 0.
2171*03ce13f7SAndroid Build Coastguard Worker // Returns an undefined value when: isZeroUndef && x == 0.
2172*03ce13f7SAndroid Build Coastguard Worker RValue<UInt> Cttz(RValue<UInt> x, bool isZeroUndef);
2173*03ce13f7SAndroid Build Coastguard Worker RValue<UInt4> Cttz(RValue<UInt4> x, bool isZeroUndef);
2174*03ce13f7SAndroid Build Coastguard Worker 
2175*03ce13f7SAndroid Build Coastguard Worker template<class T>
2176*03ce13f7SAndroid Build Coastguard Worker class Pointer : public LValue<Pointer<T>>
2177*03ce13f7SAndroid Build Coastguard Worker {
2178*03ce13f7SAndroid Build Coastguard Worker public:
2179*03ce13f7SAndroid Build Coastguard Worker 	template<class S>
Pointer(RValue<Pointer<S>> pointerS,int alignment=1)2180*03ce13f7SAndroid Build Coastguard Worker 	Pointer(RValue<Pointer<S>> pointerS, int alignment = 1)
2181*03ce13f7SAndroid Build Coastguard Worker 	    : alignment(alignment)
2182*03ce13f7SAndroid Build Coastguard Worker 	{
2183*03ce13f7SAndroid Build Coastguard Worker 		Value *pointerT = Nucleus::createBitCast(pointerS.value(), Nucleus::getPointerType(T::type()));
2184*03ce13f7SAndroid Build Coastguard Worker 		this->storeValue(pointerT);
2185*03ce13f7SAndroid Build Coastguard Worker 	}
2186*03ce13f7SAndroid Build Coastguard Worker 
2187*03ce13f7SAndroid Build Coastguard Worker 	template<class S>
Pointer(const Pointer<S> & pointer,int alignment=1)2188*03ce13f7SAndroid Build Coastguard Worker 	Pointer(const Pointer<S> &pointer, int alignment = 1)
2189*03ce13f7SAndroid Build Coastguard Worker 	    : alignment(alignment)
2190*03ce13f7SAndroid Build Coastguard Worker 	{
2191*03ce13f7SAndroid Build Coastguard Worker 		Value *pointerS = pointer.loadValue();
2192*03ce13f7SAndroid Build Coastguard Worker 		Value *pointerT = Nucleus::createBitCast(pointerS, Nucleus::getPointerType(T::type()));
2193*03ce13f7SAndroid Build Coastguard Worker 		this->storeValue(pointerT);
2194*03ce13f7SAndroid Build Coastguard Worker 	}
2195*03ce13f7SAndroid Build Coastguard Worker 
2196*03ce13f7SAndroid Build Coastguard Worker 	Pointer(Argument<Pointer<T>> argument);
2197*03ce13f7SAndroid Build Coastguard Worker 
2198*03ce13f7SAndroid Build Coastguard Worker 	Pointer();
2199*03ce13f7SAndroid Build Coastguard Worker 	Pointer(RValue<Pointer<T>> rhs);
2200*03ce13f7SAndroid Build Coastguard Worker 	Pointer(const Pointer<T> &rhs);
2201*03ce13f7SAndroid Build Coastguard Worker 	Pointer(const Reference<Pointer<T>> &rhs);
2202*03ce13f7SAndroid Build Coastguard Worker 	Pointer(std::nullptr_t);
2203*03ce13f7SAndroid Build Coastguard Worker 
2204*03ce13f7SAndroid Build Coastguard Worker 	RValue<Pointer<T>> operator=(RValue<Pointer<T>> rhs);
2205*03ce13f7SAndroid Build Coastguard Worker 	RValue<Pointer<T>> operator=(const Pointer<T> &rhs);
2206*03ce13f7SAndroid Build Coastguard Worker 	RValue<Pointer<T>> operator=(const Reference<Pointer<T>> &rhs);
2207*03ce13f7SAndroid Build Coastguard Worker 	RValue<Pointer<T>> operator=(std::nullptr_t);
2208*03ce13f7SAndroid Build Coastguard Worker 
2209*03ce13f7SAndroid Build Coastguard Worker 	Reference<T> operator*() const;
2210*03ce13f7SAndroid Build Coastguard Worker 	Reference<T> operator[](int index) const;
2211*03ce13f7SAndroid Build Coastguard Worker 	Reference<T> operator[](unsigned int index) const;
2212*03ce13f7SAndroid Build Coastguard Worker 	Reference<T> operator[](RValue<Int> index) const;
2213*03ce13f7SAndroid Build Coastguard Worker 	Reference<T> operator[](RValue<UInt> index) const;
2214*03ce13f7SAndroid Build Coastguard Worker 
2215*03ce13f7SAndroid Build Coastguard Worker 	static Type *type();
2216*03ce13f7SAndroid Build Coastguard Worker 
2217*03ce13f7SAndroid Build Coastguard Worker private:
2218*03ce13f7SAndroid Build Coastguard Worker 	const int alignment;
2219*03ce13f7SAndroid Build Coastguard Worker };
2220*03ce13f7SAndroid Build Coastguard Worker 
2221*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset);
2222*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset);
2223*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset);
2224*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, int offset);
2225*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<Int> offset);
2226*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<UInt> offset);
2227*03ce13f7SAndroid Build Coastguard Worker 
2228*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset);
2229*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset);
2230*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset);
2231*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, int offset);
2232*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<Int> offset);
2233*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<UInt> offset);
2234*03ce13f7SAndroid Build Coastguard Worker 
2235*03ce13f7SAndroid Build Coastguard Worker template<typename T>
operator ==(const Pointer<T> & lhs,const Pointer<T> & rhs)2236*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator==(const Pointer<T> &lhs, const Pointer<T> &rhs)
2237*03ce13f7SAndroid Build Coastguard Worker {
2238*03ce13f7SAndroid Build Coastguard Worker 	return RValue<Bool>(Nucleus::createICmpEQ(lhs.loadValue(), rhs.loadValue()));
2239*03ce13f7SAndroid Build Coastguard Worker }
2240*03ce13f7SAndroid Build Coastguard Worker 
2241*03ce13f7SAndroid Build Coastguard Worker template<typename T>
operator !=(const Pointer<T> & lhs,const Pointer<T> & rhs)2242*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> operator!=(const Pointer<T> &lhs, const Pointer<T> &rhs)
2243*03ce13f7SAndroid Build Coastguard Worker {
2244*03ce13f7SAndroid Build Coastguard Worker 	return RValue<Bool>(Nucleus::createICmpNE(lhs.loadValue(), rhs.loadValue()));
2245*03ce13f7SAndroid Build Coastguard Worker }
2246*03ce13f7SAndroid Build Coastguard Worker 
2247*03ce13f7SAndroid Build Coastguard Worker template<typename T>
Load(RValue<Pointer<T>> pointer,unsigned int alignment,bool atomic,std::memory_order memoryOrder)2248*03ce13f7SAndroid Build Coastguard Worker RValue<T> Load(RValue<Pointer<T>> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder)
2249*03ce13f7SAndroid Build Coastguard Worker {
2250*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(Nucleus::createLoad(pointer.value(), T::type(), false, alignment, atomic, memoryOrder));
2251*03ce13f7SAndroid Build Coastguard Worker }
2252*03ce13f7SAndroid Build Coastguard Worker 
2253*03ce13f7SAndroid Build Coastguard Worker template<typename T>
Load(Pointer<T> pointer,unsigned int alignment,bool atomic,std::memory_order memoryOrder)2254*03ce13f7SAndroid Build Coastguard Worker RValue<T> Load(Pointer<T> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder)
2255*03ce13f7SAndroid Build Coastguard Worker {
2256*03ce13f7SAndroid Build Coastguard Worker 	return Load(RValue<Pointer<T>>(pointer), alignment, atomic, memoryOrder);
2257*03ce13f7SAndroid Build Coastguard Worker }
2258*03ce13f7SAndroid Build Coastguard Worker 
2259*03ce13f7SAndroid Build Coastguard Worker // TODO: Use SIMD to template these.
2260*03ce13f7SAndroid Build Coastguard Worker // TODO(b/155867273): These can be undeprecated if implemented for Subzero.
2261*03ce13f7SAndroid Build Coastguard Worker [[deprecated]] RValue<Float4> MaskedLoad(RValue<Pointer<Float4>> base, RValue<Int4> mask, unsigned int alignment, bool zeroMaskedLanes = false);
2262*03ce13f7SAndroid Build Coastguard Worker [[deprecated]] RValue<Int4> MaskedLoad(RValue<Pointer<Int4>> base, RValue<Int4> mask, unsigned int alignment, bool zeroMaskedLanes = false);
2263*03ce13f7SAndroid Build Coastguard Worker [[deprecated]] void MaskedStore(RValue<Pointer<Float4>> base, RValue<Float4> val, RValue<Int4> mask, unsigned int alignment);
2264*03ce13f7SAndroid Build Coastguard Worker [[deprecated]] void MaskedStore(RValue<Pointer<Int4>> base, RValue<Int4> val, RValue<Int4> mask, unsigned int alignment);
2265*03ce13f7SAndroid Build Coastguard Worker 
2266*03ce13f7SAndroid Build Coastguard Worker template<typename T>
Store(RValue<T> value,RValue<Pointer<T>> pointer,unsigned int alignment,bool atomic,std::memory_order memoryOrder)2267*03ce13f7SAndroid Build Coastguard Worker void Store(RValue<T> value, RValue<Pointer<T>> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder)
2268*03ce13f7SAndroid Build Coastguard Worker {
2269*03ce13f7SAndroid Build Coastguard Worker 	Nucleus::createStore(value.value(), pointer.value(), T::type(), false, alignment, atomic, memoryOrder);
2270*03ce13f7SAndroid Build Coastguard Worker }
2271*03ce13f7SAndroid Build Coastguard Worker 
2272*03ce13f7SAndroid Build Coastguard Worker template<typename T>
Store(RValue<T> value,Pointer<T> pointer,unsigned int alignment,bool atomic,std::memory_order memoryOrder)2273*03ce13f7SAndroid Build Coastguard Worker void Store(RValue<T> value, Pointer<T> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder)
2274*03ce13f7SAndroid Build Coastguard Worker {
2275*03ce13f7SAndroid Build Coastguard Worker 	Store(value, RValue<Pointer<T>>(pointer), alignment, atomic, memoryOrder);
2276*03ce13f7SAndroid Build Coastguard Worker }
2277*03ce13f7SAndroid Build Coastguard Worker 
2278*03ce13f7SAndroid Build Coastguard Worker template<typename T>
Store(T value,Pointer<T> pointer,unsigned int alignment,bool atomic,std::memory_order memoryOrder)2279*03ce13f7SAndroid Build Coastguard Worker void Store(T value, Pointer<T> pointer, unsigned int alignment, bool atomic, std::memory_order memoryOrder)
2280*03ce13f7SAndroid Build Coastguard Worker {
2281*03ce13f7SAndroid Build Coastguard Worker 	Store(RValue<T>(value), RValue<Pointer<T>>(pointer), alignment, atomic, memoryOrder);
2282*03ce13f7SAndroid Build Coastguard Worker }
2283*03ce13f7SAndroid Build Coastguard Worker 
2284*03ce13f7SAndroid Build Coastguard Worker enum class OutOfBoundsBehavior
2285*03ce13f7SAndroid Build Coastguard Worker {
2286*03ce13f7SAndroid Build Coastguard Worker 	Nullify,             // Loads become zero, stores are elided.
2287*03ce13f7SAndroid Build Coastguard Worker 	RobustBufferAccess,  // As defined by the Vulkan spec (in short: access anywhere within bounds, or zeroing).
2288*03ce13f7SAndroid Build Coastguard Worker 	UndefinedValue,      // Only for load operations. Not secure. No program termination.
2289*03ce13f7SAndroid Build Coastguard Worker 	UndefinedBehavior,   // Program may terminate.
2290*03ce13f7SAndroid Build Coastguard Worker };
2291*03ce13f7SAndroid Build Coastguard Worker 
2292*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> AnyTrue(const RValue<Int4> &bools);
2293*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> AnyFalse(const RValue<Int4> &bools);
2294*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> AllTrue(const RValue<Int4> &bools);
2295*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> AllFalse(const RValue<Int4> &bools);
2296*03ce13f7SAndroid Build Coastguard Worker 
2297*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> Divergent(const RValue<Int4> &ints);
2298*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> Divergent(const RValue<Float4> &floats);
2299*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> Uniform(const RValue<Int4> &ints);
2300*03ce13f7SAndroid Build Coastguard Worker RValue<Bool> Uniform(const RValue<Float4> &floats);
2301*03ce13f7SAndroid Build Coastguard Worker 
2302*03ce13f7SAndroid Build Coastguard Worker // Fence adds a memory barrier that enforces ordering constraints on memory
2303*03ce13f7SAndroid Build Coastguard Worker // operations. memoryOrder can only be one of:
2304*03ce13f7SAndroid Build Coastguard Worker // std::memory_order_acquire, std::memory_order_release,
2305*03ce13f7SAndroid Build Coastguard Worker // std::memory_order_acq_rel, or std::memory_order_seq_cst.
2306*03ce13f7SAndroid Build Coastguard Worker void Fence(std::memory_order memoryOrder);
2307*03ce13f7SAndroid Build Coastguard Worker 
2308*03ce13f7SAndroid Build Coastguard Worker template<class T, int S = 1>
2309*03ce13f7SAndroid Build Coastguard Worker class Array : public LValue<T>
2310*03ce13f7SAndroid Build Coastguard Worker {
2311*03ce13f7SAndroid Build Coastguard Worker public:
2312*03ce13f7SAndroid Build Coastguard Worker 	Array(int size = S);
2313*03ce13f7SAndroid Build Coastguard Worker 
2314*03ce13f7SAndroid Build Coastguard Worker 	Reference<T> operator[](int index);
2315*03ce13f7SAndroid Build Coastguard Worker 	Reference<T> operator[](unsigned int index);
2316*03ce13f7SAndroid Build Coastguard Worker 	Reference<T> operator[](RValue<Int> index);
2317*03ce13f7SAndroid Build Coastguard Worker 	Reference<T> operator[](RValue<UInt> index);
2318*03ce13f7SAndroid Build Coastguard Worker 
2319*03ce13f7SAndroid Build Coastguard Worker 	// self() returns the this pointer to this Array object.
2320*03ce13f7SAndroid Build Coastguard Worker 	// This function exists because operator&() is overloaded by LValue<T>.
self()2321*03ce13f7SAndroid Build Coastguard Worker 	inline Array *self() { return this; }
2322*03ce13f7SAndroid Build Coastguard Worker };
2323*03ce13f7SAndroid Build Coastguard Worker 
2324*03ce13f7SAndroid Build Coastguard Worker //	RValue<Array<T>> operator++(Array<T> &val, int);   // Post-increment
2325*03ce13f7SAndroid Build Coastguard Worker //	const Array<T> &operator++(Array<T> &val);   // Pre-increment
2326*03ce13f7SAndroid Build Coastguard Worker //	RValue<Array<T>> operator--(Array<T> &val, int);   // Post-decrement
2327*03ce13f7SAndroid Build Coastguard Worker //	const Array<T> &operator--(Array<T> &val);   // Pre-decrement
2328*03ce13f7SAndroid Build Coastguard Worker 
2329*03ce13f7SAndroid Build Coastguard Worker void branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB);
2330*03ce13f7SAndroid Build Coastguard Worker 
2331*03ce13f7SAndroid Build Coastguard Worker // ValueOf returns a rr::Value* for the given C-type, RValue<T>, LValue<T>
2332*03ce13f7SAndroid Build Coastguard Worker // or Reference<T>.
2333*03ce13f7SAndroid Build Coastguard Worker template<typename T>
ValueOf(const T & v)2334*03ce13f7SAndroid Build Coastguard Worker inline Value *ValueOf(const T &v)
2335*03ce13f7SAndroid Build Coastguard Worker {
2336*03ce13f7SAndroid Build Coastguard Worker 	return ReactorType<T>::cast(v).loadValue();
2337*03ce13f7SAndroid Build Coastguard Worker }
2338*03ce13f7SAndroid Build Coastguard Worker 
2339*03ce13f7SAndroid Build Coastguard Worker void Return();
2340*03ce13f7SAndroid Build Coastguard Worker 
2341*03ce13f7SAndroid Build Coastguard Worker template<class T>
Return(const T & ret)2342*03ce13f7SAndroid Build Coastguard Worker void Return(const T &ret)
2343*03ce13f7SAndroid Build Coastguard Worker {
2344*03ce13f7SAndroid Build Coastguard Worker 	static_assert(CanBeUsedAsReturn<ReactorTypeT<T>>::value, "Unsupported type for Return()");
2345*03ce13f7SAndroid Build Coastguard Worker 	Nucleus::createRet(ValueOf<T>(ret));
2346*03ce13f7SAndroid Build Coastguard Worker 	// Place any unreachable instructions in an unreferenced block.
2347*03ce13f7SAndroid Build Coastguard Worker 	Nucleus::setInsertBlock(Nucleus::createBasicBlock());
2348*03ce13f7SAndroid Build Coastguard Worker }
2349*03ce13f7SAndroid Build Coastguard Worker 
2350*03ce13f7SAndroid Build Coastguard Worker // Generic template, leave undefined!
2351*03ce13f7SAndroid Build Coastguard Worker template<typename FunctionType>
2352*03ce13f7SAndroid Build Coastguard Worker class Function;
2353*03ce13f7SAndroid Build Coastguard Worker 
2354*03ce13f7SAndroid Build Coastguard Worker // Specialized for function types
2355*03ce13f7SAndroid Build Coastguard Worker template<typename Return, typename... Arguments>
2356*03ce13f7SAndroid Build Coastguard Worker class Function<Return(Arguments...)>
2357*03ce13f7SAndroid Build Coastguard Worker {
2358*03ce13f7SAndroid Build Coastguard Worker 	// Static assert that the function signature is valid.
2359*03ce13f7SAndroid Build Coastguard Worker 	static_assert(sizeof(AssertFunctionSignatureIsValid<Return(Arguments...)>) >= 0, "Invalid function signature");
2360*03ce13f7SAndroid Build Coastguard Worker 
2361*03ce13f7SAndroid Build Coastguard Worker public:
2362*03ce13f7SAndroid Build Coastguard Worker 	Function();
2363*03ce13f7SAndroid Build Coastguard Worker 
2364*03ce13f7SAndroid Build Coastguard Worker 	template<int index>
Arg() const2365*03ce13f7SAndroid Build Coastguard Worker 	Argument<typename std::tuple_element<index, std::tuple<Arguments...>>::type> Arg() const
2366*03ce13f7SAndroid Build Coastguard Worker 	{
2367*03ce13f7SAndroid Build Coastguard Worker 		Value *arg = Nucleus::getArgument(index);
2368*03ce13f7SAndroid Build Coastguard Worker 		return Argument<typename std::tuple_element<index, std::tuple<Arguments...>>::type>(arg);
2369*03ce13f7SAndroid Build Coastguard Worker 	}
2370*03ce13f7SAndroid Build Coastguard Worker 
2371*03ce13f7SAndroid Build Coastguard Worker 	std::shared_ptr<Routine> operator()(const char *name, ...);
2372*03ce13f7SAndroid Build Coastguard Worker 
2373*03ce13f7SAndroid Build Coastguard Worker protected:
2374*03ce13f7SAndroid Build Coastguard Worker 	std::unique_ptr<Nucleus> core;
2375*03ce13f7SAndroid Build Coastguard Worker 	std::vector<Type *> arguments;
2376*03ce13f7SAndroid Build Coastguard Worker };
2377*03ce13f7SAndroid Build Coastguard Worker 
2378*03ce13f7SAndroid Build Coastguard Worker template<typename Return>
2379*03ce13f7SAndroid Build Coastguard Worker class Function<Return()> : public Function<Return(Void)>
2380*03ce13f7SAndroid Build Coastguard Worker {
2381*03ce13f7SAndroid Build Coastguard Worker };
2382*03ce13f7SAndroid Build Coastguard Worker 
2383*03ce13f7SAndroid Build Coastguard Worker // FunctionT accepts a C-style function type template argument, allowing it to return a type-safe RoutineT wrapper
2384*03ce13f7SAndroid Build Coastguard Worker template<typename FunctionType>
2385*03ce13f7SAndroid Build Coastguard Worker class FunctionT;
2386*03ce13f7SAndroid Build Coastguard Worker 
2387*03ce13f7SAndroid Build Coastguard Worker template<typename Return, typename... Arguments>
2388*03ce13f7SAndroid Build Coastguard Worker class FunctionT<Return(Arguments...)> : public Function<CToReactorT<Return>(CToReactorT<Arguments>...)>
2389*03ce13f7SAndroid Build Coastguard Worker {
2390*03ce13f7SAndroid Build Coastguard Worker public:
2391*03ce13f7SAndroid Build Coastguard Worker 	// Type of base class
2392*03ce13f7SAndroid Build Coastguard Worker 	using BaseType = Function<CToReactorT<Return>(CToReactorT<Arguments>...)>;
2393*03ce13f7SAndroid Build Coastguard Worker 
2394*03ce13f7SAndroid Build Coastguard Worker 	// Function type, e.g. void(int,float)
2395*03ce13f7SAndroid Build Coastguard Worker 	using CFunctionType = Return(Arguments...);
2396*03ce13f7SAndroid Build Coastguard Worker 
2397*03ce13f7SAndroid Build Coastguard Worker 	// Reactor function type, e.g. Void(Int, Float)
2398*03ce13f7SAndroid Build Coastguard Worker 	using ReactorFunctionType = CToReactorT<Return>(CToReactorT<Arguments>...);
2399*03ce13f7SAndroid Build Coastguard Worker 
2400*03ce13f7SAndroid Build Coastguard Worker 	// Returned RoutineT type
2401*03ce13f7SAndroid Build Coastguard Worker 	using RoutineType = RoutineT<CFunctionType>;
2402*03ce13f7SAndroid Build Coastguard Worker 
2403*03ce13f7SAndroid Build Coastguard Worker 	// Hide base implementations of operator()
2404*03ce13f7SAndroid Build Coastguard Worker 
2405*03ce13f7SAndroid Build Coastguard Worker 	template<typename... VarArgs>
operator ()(const char * name,VarArgs...varArgs)2406*03ce13f7SAndroid Build Coastguard Worker 	RoutineType operator()(const char *name, VarArgs... varArgs)
2407*03ce13f7SAndroid Build Coastguard Worker 	{
2408*03ce13f7SAndroid Build Coastguard Worker 		return RoutineType(BaseType::operator()(name, std::forward<VarArgs>(varArgs)...));
2409*03ce13f7SAndroid Build Coastguard Worker 	}
2410*03ce13f7SAndroid Build Coastguard Worker };
2411*03ce13f7SAndroid Build Coastguard Worker 
2412*03ce13f7SAndroid Build Coastguard Worker RValue<Long> Ticks();
2413*03ce13f7SAndroid Build Coastguard Worker 
2414*03ce13f7SAndroid Build Coastguard Worker }  // namespace rr
2415*03ce13f7SAndroid Build Coastguard Worker 
2416*03ce13f7SAndroid Build Coastguard Worker /* Inline implementations */
2417*03ce13f7SAndroid Build Coastguard Worker 
2418*03ce13f7SAndroid Build Coastguard Worker namespace rr {
2419*03ce13f7SAndroid Build Coastguard Worker 
2420*03ce13f7SAndroid Build Coastguard Worker template<class T>
LValue(int arraySize)2421*03ce13f7SAndroid Build Coastguard Worker LValue<T>::LValue(int arraySize)
2422*03ce13f7SAndroid Build Coastguard Worker     : Variable(T::type(), arraySize)
2423*03ce13f7SAndroid Build Coastguard Worker {
2424*03ce13f7SAndroid Build Coastguard Worker #ifdef ENABLE_RR_DEBUG_INFO
2425*03ce13f7SAndroid Build Coastguard Worker 	materialize();
2426*03ce13f7SAndroid Build Coastguard Worker #endif  // ENABLE_RR_DEBUG_INFO
2427*03ce13f7SAndroid Build Coastguard Worker }
2428*03ce13f7SAndroid Build Coastguard Worker 
2429*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator &()2430*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<T>> LValue<T>::operator&()
2431*03ce13f7SAndroid Build Coastguard Worker {
2432*03ce13f7SAndroid Build Coastguard Worker 	return RValue<Pointer<T>>(this->getBaseAddress());
2433*03ce13f7SAndroid Build Coastguard Worker }
2434*03ce13f7SAndroid Build Coastguard Worker 
2435*03ce13f7SAndroid Build Coastguard Worker template<class T>
Reference(Value * pointer,int alignment)2436*03ce13f7SAndroid Build Coastguard Worker Reference<T>::Reference(Value *pointer, int alignment)
2437*03ce13f7SAndroid Build Coastguard Worker     : address(pointer)
2438*03ce13f7SAndroid Build Coastguard Worker     , alignment(alignment)
2439*03ce13f7SAndroid Build Coastguard Worker {
2440*03ce13f7SAndroid Build Coastguard Worker }
2441*03ce13f7SAndroid Build Coastguard Worker 
2442*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator =(RValue<T> rhs) const2443*03ce13f7SAndroid Build Coastguard Worker RValue<T> Reference<T>::operator=(RValue<T> rhs) const
2444*03ce13f7SAndroid Build Coastguard Worker {
2445*03ce13f7SAndroid Build Coastguard Worker 	Nucleus::createStore(rhs.value(), address, T::type(), false, alignment);
2446*03ce13f7SAndroid Build Coastguard Worker 
2447*03ce13f7SAndroid Build Coastguard Worker 	return rhs;
2448*03ce13f7SAndroid Build Coastguard Worker }
2449*03ce13f7SAndroid Build Coastguard Worker 
2450*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator =(const Reference<T> & ref) const2451*03ce13f7SAndroid Build Coastguard Worker RValue<T> Reference<T>::operator=(const Reference<T> &ref) const
2452*03ce13f7SAndroid Build Coastguard Worker {
2453*03ce13f7SAndroid Build Coastguard Worker 	Value *tmp = Nucleus::createLoad(ref.address, T::type(), false, ref.alignment);
2454*03ce13f7SAndroid Build Coastguard Worker 	Nucleus::createStore(tmp, address, T::type(), false, alignment);
2455*03ce13f7SAndroid Build Coastguard Worker 
2456*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(tmp);
2457*03ce13f7SAndroid Build Coastguard Worker }
2458*03ce13f7SAndroid Build Coastguard Worker 
2459*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator +=(RValue<T> rhs) const2460*03ce13f7SAndroid Build Coastguard Worker RValue<T> Reference<T>::operator+=(RValue<T> rhs) const
2461*03ce13f7SAndroid Build Coastguard Worker {
2462*03ce13f7SAndroid Build Coastguard Worker 	return *this = *this + rhs;
2463*03ce13f7SAndroid Build Coastguard Worker }
2464*03ce13f7SAndroid Build Coastguard Worker 
2465*03ce13f7SAndroid Build Coastguard Worker template<class T>
loadValue() const2466*03ce13f7SAndroid Build Coastguard Worker Value *Reference<T>::loadValue() const
2467*03ce13f7SAndroid Build Coastguard Worker {
2468*03ce13f7SAndroid Build Coastguard Worker 	return Nucleus::createLoad(address, T::type(), false, alignment);
2469*03ce13f7SAndroid Build Coastguard Worker }
2470*03ce13f7SAndroid Build Coastguard Worker 
2471*03ce13f7SAndroid Build Coastguard Worker template<class T>
load() const2472*03ce13f7SAndroid Build Coastguard Worker RValue<T> Reference<T>::load() const
2473*03ce13f7SAndroid Build Coastguard Worker {
2474*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(loadValue());
2475*03ce13f7SAndroid Build Coastguard Worker }
2476*03ce13f7SAndroid Build Coastguard Worker 
2477*03ce13f7SAndroid Build Coastguard Worker template<class T>
getAlignment() const2478*03ce13f7SAndroid Build Coastguard Worker int Reference<T>::getAlignment() const
2479*03ce13f7SAndroid Build Coastguard Worker {
2480*03ce13f7SAndroid Build Coastguard Worker 	return alignment;
2481*03ce13f7SAndroid Build Coastguard Worker }
2482*03ce13f7SAndroid Build Coastguard Worker 
2483*03ce13f7SAndroid Build Coastguard Worker template<class T>
RValue(const RValue<T> & rvalue)2484*03ce13f7SAndroid Build Coastguard Worker RValue<T>::RValue(const RValue<T> &rvalue)
2485*03ce13f7SAndroid Build Coastguard Worker     : val(rvalue.val)
2486*03ce13f7SAndroid Build Coastguard Worker {
2487*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2488*03ce13f7SAndroid Build Coastguard Worker }
2489*03ce13f7SAndroid Build Coastguard Worker 
2490*03ce13f7SAndroid Build Coastguard Worker template<class T>
RValue(Value * value)2491*03ce13f7SAndroid Build Coastguard Worker RValue<T>::RValue(Value *value)
2492*03ce13f7SAndroid Build Coastguard Worker     : val(value)
2493*03ce13f7SAndroid Build Coastguard Worker {
2494*03ce13f7SAndroid Build Coastguard Worker 	assert(Nucleus::createBitCast(value, T::type()) == value);  // Run-time type should match T, so bitcast is no-op.
2495*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2496*03ce13f7SAndroid Build Coastguard Worker }
2497*03ce13f7SAndroid Build Coastguard Worker 
2498*03ce13f7SAndroid Build Coastguard Worker template<class T>
RValue(const T & lvalue)2499*03ce13f7SAndroid Build Coastguard Worker RValue<T>::RValue(const T &lvalue)
2500*03ce13f7SAndroid Build Coastguard Worker     : val(lvalue.loadValue())
2501*03ce13f7SAndroid Build Coastguard Worker {
2502*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2503*03ce13f7SAndroid Build Coastguard Worker }
2504*03ce13f7SAndroid Build Coastguard Worker 
2505*03ce13f7SAndroid Build Coastguard Worker template<>
RValue(bool b)2506*03ce13f7SAndroid Build Coastguard Worker inline RValue<Bool>::RValue(bool b)
2507*03ce13f7SAndroid Build Coastguard Worker     : val(Nucleus::createConstantBool(b))
2508*03ce13f7SAndroid Build Coastguard Worker {
2509*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2510*03ce13f7SAndroid Build Coastguard Worker }
2511*03ce13f7SAndroid Build Coastguard Worker 
2512*03ce13f7SAndroid Build Coastguard Worker template<class T>
RValue(typename IntLiteral<T>::Type i)2513*03ce13f7SAndroid Build Coastguard Worker RValue<T>::RValue(typename IntLiteral<T>::Type i)
2514*03ce13f7SAndroid Build Coastguard Worker     : val(Nucleus::createConstantInt(i))
2515*03ce13f7SAndroid Build Coastguard Worker {
2516*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2517*03ce13f7SAndroid Build Coastguard Worker }
2518*03ce13f7SAndroid Build Coastguard Worker 
2519*03ce13f7SAndroid Build Coastguard Worker template<>
RValue(int64_t i)2520*03ce13f7SAndroid Build Coastguard Worker inline RValue<Long>::RValue(int64_t i)
2521*03ce13f7SAndroid Build Coastguard Worker     : val(Nucleus::createConstantLong(i))
2522*03ce13f7SAndroid Build Coastguard Worker {
2523*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2524*03ce13f7SAndroid Build Coastguard Worker }
2525*03ce13f7SAndroid Build Coastguard Worker 
2526*03ce13f7SAndroid Build Coastguard Worker template<>
RValue(float f)2527*03ce13f7SAndroid Build Coastguard Worker inline RValue<Float>::RValue(float f)
2528*03ce13f7SAndroid Build Coastguard Worker     : val(Nucleus::createConstantFloat(f))
2529*03ce13f7SAndroid Build Coastguard Worker {
2530*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2531*03ce13f7SAndroid Build Coastguard Worker }
2532*03ce13f7SAndroid Build Coastguard Worker 
broadcast(int i,Type * type)2533*03ce13f7SAndroid Build Coastguard Worker inline Value *broadcast(int i, Type *type)
2534*03ce13f7SAndroid Build Coastguard Worker {
2535*03ce13f7SAndroid Build Coastguard Worker 	std::vector<int64_t> constantVector = { i };
2536*03ce13f7SAndroid Build Coastguard Worker 	return Nucleus::createConstantVector(constantVector, type);
2537*03ce13f7SAndroid Build Coastguard Worker }
2538*03ce13f7SAndroid Build Coastguard Worker 
2539*03ce13f7SAndroid Build Coastguard Worker template<>
RValue(int i)2540*03ce13f7SAndroid Build Coastguard Worker inline RValue<Int4>::RValue(int i)
2541*03ce13f7SAndroid Build Coastguard Worker     : val(broadcast(i, Int4::type()))
2542*03ce13f7SAndroid Build Coastguard Worker {
2543*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2544*03ce13f7SAndroid Build Coastguard Worker }
2545*03ce13f7SAndroid Build Coastguard Worker 
2546*03ce13f7SAndroid Build Coastguard Worker template<>
RValue(unsigned int i)2547*03ce13f7SAndroid Build Coastguard Worker inline RValue<UInt4>::RValue(unsigned int i)
2548*03ce13f7SAndroid Build Coastguard Worker     : val(broadcast(int(i), UInt4::type()))
2549*03ce13f7SAndroid Build Coastguard Worker {
2550*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2551*03ce13f7SAndroid Build Coastguard Worker }
2552*03ce13f7SAndroid Build Coastguard Worker 
broadcast(float f,Type * type)2553*03ce13f7SAndroid Build Coastguard Worker inline Value *broadcast(float f, Type *type)
2554*03ce13f7SAndroid Build Coastguard Worker {
2555*03ce13f7SAndroid Build Coastguard Worker 	// See Float(float) constructor for the rationale behind this assert.
2556*03ce13f7SAndroid Build Coastguard Worker 	assert(std::isfinite(f));
2557*03ce13f7SAndroid Build Coastguard Worker 
2558*03ce13f7SAndroid Build Coastguard Worker 	std::vector<double> constantVector = { f };
2559*03ce13f7SAndroid Build Coastguard Worker 	return Nucleus::createConstantVector(constantVector, type);
2560*03ce13f7SAndroid Build Coastguard Worker }
2561*03ce13f7SAndroid Build Coastguard Worker 
2562*03ce13f7SAndroid Build Coastguard Worker template<>
RValue(float f)2563*03ce13f7SAndroid Build Coastguard Worker inline RValue<Float4>::RValue(float f)
2564*03ce13f7SAndroid Build Coastguard Worker     : val(broadcast(f, Float4::type()))
2565*03ce13f7SAndroid Build Coastguard Worker {
2566*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2567*03ce13f7SAndroid Build Coastguard Worker }
2568*03ce13f7SAndroid Build Coastguard Worker 
2569*03ce13f7SAndroid Build Coastguard Worker template<class T>
RValue(const Reference<T> & ref)2570*03ce13f7SAndroid Build Coastguard Worker RValue<T>::RValue(const Reference<T> &ref)
2571*03ce13f7SAndroid Build Coastguard Worker     : val(ref.loadValue())
2572*03ce13f7SAndroid Build Coastguard Worker {
2573*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_EMIT_VAR(val);
2574*03ce13f7SAndroid Build Coastguard Worker }
2575*03ce13f7SAndroid Build Coastguard Worker 
2576*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator RValue<Vector4>() const2577*03ce13f7SAndroid Build Coastguard Worker Swizzle2<Vector4, T>::operator RValue<Vector4>() const
2578*03ce13f7SAndroid Build Coastguard Worker {
2579*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2580*03ce13f7SAndroid Build Coastguard Worker 	Value *vector = parent->loadValue();
2581*03ce13f7SAndroid Build Coastguard Worker 
2582*03ce13f7SAndroid Build Coastguard Worker 	return Swizzle(RValue<Vector4>(vector), T);
2583*03ce13f7SAndroid Build Coastguard Worker }
2584*03ce13f7SAndroid Build Coastguard Worker 
2585*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator RValue<Vector4>() const2586*03ce13f7SAndroid Build Coastguard Worker Swizzle4<Vector4, T>::operator RValue<Vector4>() const
2587*03ce13f7SAndroid Build Coastguard Worker {
2588*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2589*03ce13f7SAndroid Build Coastguard Worker 	Value *vector = parent->loadValue();
2590*03ce13f7SAndroid Build Coastguard Worker 
2591*03ce13f7SAndroid Build Coastguard Worker 	return Swizzle(RValue<Vector4>(vector), T);
2592*03ce13f7SAndroid Build Coastguard Worker }
2593*03ce13f7SAndroid Build Coastguard Worker 
2594*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator RValue<Vector4>() const2595*03ce13f7SAndroid Build Coastguard Worker SwizzleMask4<Vector4, T>::operator RValue<Vector4>() const
2596*03ce13f7SAndroid Build Coastguard Worker {
2597*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2598*03ce13f7SAndroid Build Coastguard Worker 	Value *vector = parent->loadValue();
2599*03ce13f7SAndroid Build Coastguard Worker 
2600*03ce13f7SAndroid Build Coastguard Worker 	return Swizzle(RValue<Vector4>(vector), T);
2601*03ce13f7SAndroid Build Coastguard Worker }
2602*03ce13f7SAndroid Build Coastguard Worker 
2603*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator =(RValue<Vector4> rhs)2604*03ce13f7SAndroid Build Coastguard Worker RValue<Vector4> SwizzleMask4<Vector4, T>::operator=(RValue<Vector4> rhs)
2605*03ce13f7SAndroid Build Coastguard Worker {
2606*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2607*03ce13f7SAndroid Build Coastguard Worker 	return Mask(*parent, rhs, T);
2608*03ce13f7SAndroid Build Coastguard Worker }
2609*03ce13f7SAndroid Build Coastguard Worker 
2610*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator =(RValue<typename Scalar<Vector4>::Type> rhs)2611*03ce13f7SAndroid Build Coastguard Worker RValue<Vector4> SwizzleMask4<Vector4, T>::operator=(RValue<typename Scalar<Vector4>::Type> rhs)
2612*03ce13f7SAndroid Build Coastguard Worker {
2613*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2614*03ce13f7SAndroid Build Coastguard Worker 	return Mask(*parent, Vector4(rhs), T);
2615*03ce13f7SAndroid Build Coastguard Worker }
2616*03ce13f7SAndroid Build Coastguard Worker 
2617*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator RValue<typename Scalar<Vector4>::Type>() const2618*03ce13f7SAndroid Build Coastguard Worker SwizzleMask1<Vector4, T>::operator RValue<typename Scalar<Vector4>::Type>() const  // FIXME: Call a non-template function
2619*03ce13f7SAndroid Build Coastguard Worker {
2620*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2621*03ce13f7SAndroid Build Coastguard Worker 	return Extract(*parent, T & 0x3);
2622*03ce13f7SAndroid Build Coastguard Worker }
2623*03ce13f7SAndroid Build Coastguard Worker 
2624*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator RValue<Vector4>() const2625*03ce13f7SAndroid Build Coastguard Worker SwizzleMask1<Vector4, T>::operator RValue<Vector4>() const
2626*03ce13f7SAndroid Build Coastguard Worker {
2627*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2628*03ce13f7SAndroid Build Coastguard Worker 	Value *vector = parent->loadValue();
2629*03ce13f7SAndroid Build Coastguard Worker 
2630*03ce13f7SAndroid Build Coastguard Worker 	return Swizzle(RValue<Vector4>(vector), T);
2631*03ce13f7SAndroid Build Coastguard Worker }
2632*03ce13f7SAndroid Build Coastguard Worker 
2633*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator =(float x)2634*03ce13f7SAndroid Build Coastguard Worker RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(float x)
2635*03ce13f7SAndroid Build Coastguard Worker {
2636*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2637*03ce13f7SAndroid Build Coastguard Worker 	return *parent = Insert(*parent, Float(x), T & 0x3);
2638*03ce13f7SAndroid Build Coastguard Worker }
2639*03ce13f7SAndroid Build Coastguard Worker 
2640*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator =(RValue<Vector4> rhs)2641*03ce13f7SAndroid Build Coastguard Worker RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(RValue<Vector4> rhs)
2642*03ce13f7SAndroid Build Coastguard Worker {
2643*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2644*03ce13f7SAndroid Build Coastguard Worker 	return Mask(*parent, Float4(rhs), T);
2645*03ce13f7SAndroid Build Coastguard Worker }
2646*03ce13f7SAndroid Build Coastguard Worker 
2647*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator =(RValue<typename Scalar<Vector4>::Type> rhs)2648*03ce13f7SAndroid Build Coastguard Worker RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(RValue<typename Scalar<Vector4>::Type> rhs)  // FIXME: Call a non-template function
2649*03ce13f7SAndroid Build Coastguard Worker {
2650*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2651*03ce13f7SAndroid Build Coastguard Worker 	return *parent = Insert(*parent, rhs, T & 0x3);
2652*03ce13f7SAndroid Build Coastguard Worker }
2653*03ce13f7SAndroid Build Coastguard Worker 
2654*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator RValue<Vector4>() const2655*03ce13f7SAndroid Build Coastguard Worker SwizzleMask2<Vector4, T>::operator RValue<Vector4>() const
2656*03ce13f7SAndroid Build Coastguard Worker {
2657*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2658*03ce13f7SAndroid Build Coastguard Worker 	Value *vector = parent->loadValue();
2659*03ce13f7SAndroid Build Coastguard Worker 
2660*03ce13f7SAndroid Build Coastguard Worker 	return Swizzle(RValue<Float4>(vector), T);
2661*03ce13f7SAndroid Build Coastguard Worker }
2662*03ce13f7SAndroid Build Coastguard Worker 
2663*03ce13f7SAndroid Build Coastguard Worker template<class Vector4, int T>
operator =(RValue<Vector4> rhs)2664*03ce13f7SAndroid Build Coastguard Worker RValue<Vector4> SwizzleMask2<Vector4, T>::operator=(RValue<Vector4> rhs)
2665*03ce13f7SAndroid Build Coastguard Worker {
2666*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2667*03ce13f7SAndroid Build Coastguard Worker 	return Mask(*parent, Float4(rhs), T);
2668*03ce13f7SAndroid Build Coastguard Worker }
2669*03ce13f7SAndroid Build Coastguard Worker 
2670*03ce13f7SAndroid Build Coastguard Worker template<int T>
Int(const SwizzleMask1<Int4,T> & rhs)2671*03ce13f7SAndroid Build Coastguard Worker Int::Int(const SwizzleMask1<Int4, T> &rhs)
2672*03ce13f7SAndroid Build Coastguard Worker {
2673*03ce13f7SAndroid Build Coastguard Worker 	*this = rhs.operator RValue<Int>();
2674*03ce13f7SAndroid Build Coastguard Worker }
2675*03ce13f7SAndroid Build Coastguard Worker 
2676*03ce13f7SAndroid Build Coastguard Worker template<int T>
operator =(const SwizzleMask1<Int4,T> & rhs)2677*03ce13f7SAndroid Build Coastguard Worker RValue<Int> Int::operator=(const SwizzleMask1<Int4, T> &rhs)
2678*03ce13f7SAndroid Build Coastguard Worker {
2679*03ce13f7SAndroid Build Coastguard Worker 	return *this = rhs.operator RValue<Int>();
2680*03ce13f7SAndroid Build Coastguard Worker }
2681*03ce13f7SAndroid Build Coastguard Worker 
2682*03ce13f7SAndroid Build Coastguard Worker template<int T>
Float(const SwizzleMask1<Float4,T> & rhs)2683*03ce13f7SAndroid Build Coastguard Worker Float::Float(const SwizzleMask1<Float4, T> &rhs)
2684*03ce13f7SAndroid Build Coastguard Worker {
2685*03ce13f7SAndroid Build Coastguard Worker 	*this = rhs.operator RValue<Float>();
2686*03ce13f7SAndroid Build Coastguard Worker }
2687*03ce13f7SAndroid Build Coastguard Worker 
2688*03ce13f7SAndroid Build Coastguard Worker template<int T>
operator =(const SwizzleMask1<Float4,T> & rhs)2689*03ce13f7SAndroid Build Coastguard Worker RValue<Float> Float::operator=(const SwizzleMask1<Float4, T> &rhs)
2690*03ce13f7SAndroid Build Coastguard Worker {
2691*03ce13f7SAndroid Build Coastguard Worker 	return *this = rhs.operator RValue<Float>();
2692*03ce13f7SAndroid Build Coastguard Worker }
2693*03ce13f7SAndroid Build Coastguard Worker 
2694*03ce13f7SAndroid Build Coastguard Worker template<int T>
Int4(const SwizzleMask1<Int4,T> & rhs)2695*03ce13f7SAndroid Build Coastguard Worker Int4::Int4(const SwizzleMask1<Int4, T> &rhs)
2696*03ce13f7SAndroid Build Coastguard Worker     : XYZW(this)
2697*03ce13f7SAndroid Build Coastguard Worker {
2698*03ce13f7SAndroid Build Coastguard Worker 	*this = rhs.operator RValue<Int4>();
2699*03ce13f7SAndroid Build Coastguard Worker }
2700*03ce13f7SAndroid Build Coastguard Worker 
2701*03ce13f7SAndroid Build Coastguard Worker template<int T>
Float4(const SwizzleMask1<Float4,T> & rhs)2702*03ce13f7SAndroid Build Coastguard Worker Float4::Float4(const SwizzleMask1<Float4, T> &rhs)
2703*03ce13f7SAndroid Build Coastguard Worker     : XYZW(this)
2704*03ce13f7SAndroid Build Coastguard Worker {
2705*03ce13f7SAndroid Build Coastguard Worker 	*this = rhs.operator RValue<Float4>();
2706*03ce13f7SAndroid Build Coastguard Worker }
2707*03ce13f7SAndroid Build Coastguard Worker 
2708*03ce13f7SAndroid Build Coastguard Worker template<int T>
Float4(const Swizzle4<Float4,T> & rhs)2709*03ce13f7SAndroid Build Coastguard Worker Float4::Float4(const Swizzle4<Float4, T> &rhs)
2710*03ce13f7SAndroid Build Coastguard Worker     : XYZW(this)
2711*03ce13f7SAndroid Build Coastguard Worker {
2712*03ce13f7SAndroid Build Coastguard Worker 	*this = rhs.operator RValue<Float4>();
2713*03ce13f7SAndroid Build Coastguard Worker }
2714*03ce13f7SAndroid Build Coastguard Worker 
2715*03ce13f7SAndroid Build Coastguard Worker template<int X, int Y>
Float4(const Swizzle2<Float4,X> & x,const Swizzle2<Float4,Y> & y)2716*03ce13f7SAndroid Build Coastguard Worker Float4::Float4(const Swizzle2<Float4, X> &x, const Swizzle2<Float4, Y> &y)
2717*03ce13f7SAndroid Build Coastguard Worker     : XYZW(this)
2718*03ce13f7SAndroid Build Coastguard Worker {
2719*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2720*03ce13f7SAndroid Build Coastguard Worker 	*this = ShuffleLowHigh(*x.parent, *y.parent, (uint16_t(X) & 0xFF00u) | (uint16_t(Y >> 8) & 0x00FFu));
2721*03ce13f7SAndroid Build Coastguard Worker }
2722*03ce13f7SAndroid Build Coastguard Worker 
2723*03ce13f7SAndroid Build Coastguard Worker template<int X, int Y>
Float4(const SwizzleMask2<Float4,X> & x,const Swizzle2<Float4,Y> & y)2724*03ce13f7SAndroid Build Coastguard Worker Float4::Float4(const SwizzleMask2<Float4, X> &x, const Swizzle2<Float4, Y> &y)
2725*03ce13f7SAndroid Build Coastguard Worker     : XYZW(this)
2726*03ce13f7SAndroid Build Coastguard Worker {
2727*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2728*03ce13f7SAndroid Build Coastguard Worker 	*this = ShuffleLowHigh(*x.parent, *y.parent, (uint16_t(X) & 0xFF00u) | (uint16_t(Y >> 8) & 0x00FFu));
2729*03ce13f7SAndroid Build Coastguard Worker }
2730*03ce13f7SAndroid Build Coastguard Worker 
2731*03ce13f7SAndroid Build Coastguard Worker template<int X, int Y>
Float4(const Swizzle2<Float4,X> & x,const SwizzleMask2<Float4,Y> & y)2732*03ce13f7SAndroid Build Coastguard Worker Float4::Float4(const Swizzle2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y)
2733*03ce13f7SAndroid Build Coastguard Worker     : XYZW(this)
2734*03ce13f7SAndroid Build Coastguard Worker {
2735*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2736*03ce13f7SAndroid Build Coastguard Worker 	*this = ShuffleLowHigh(*x.parent, *y.parent, (uint16_t(X) & 0xFF00u) | (uint16_t(Y >> 8) & 0x00FFu));
2737*03ce13f7SAndroid Build Coastguard Worker }
2738*03ce13f7SAndroid Build Coastguard Worker 
2739*03ce13f7SAndroid Build Coastguard Worker template<int X, int Y>
Float4(const SwizzleMask2<Float4,X> & x,const SwizzleMask2<Float4,Y> & y)2740*03ce13f7SAndroid Build Coastguard Worker Float4::Float4(const SwizzleMask2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y)
2741*03ce13f7SAndroid Build Coastguard Worker     : XYZW(this)
2742*03ce13f7SAndroid Build Coastguard Worker {
2743*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2744*03ce13f7SAndroid Build Coastguard Worker 	*this = ShuffleLowHigh(*x.parent, *y.parent, (uint16_t(X) & 0xFF00u) | (uint16_t(Y >> 8) & 0x00FFu));
2745*03ce13f7SAndroid Build Coastguard Worker }
2746*03ce13f7SAndroid Build Coastguard Worker 
2747*03ce13f7SAndroid Build Coastguard Worker template<int T>
operator =(const SwizzleMask1<Float4,T> & rhs)2748*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Float4::operator=(const SwizzleMask1<Float4, T> &rhs)
2749*03ce13f7SAndroid Build Coastguard Worker {
2750*03ce13f7SAndroid Build Coastguard Worker 	return *this = rhs.operator RValue<Float4>();
2751*03ce13f7SAndroid Build Coastguard Worker }
2752*03ce13f7SAndroid Build Coastguard Worker 
2753*03ce13f7SAndroid Build Coastguard Worker template<int T>
operator =(const Swizzle4<Float4,T> & rhs)2754*03ce13f7SAndroid Build Coastguard Worker RValue<Float4> Float4::operator=(const Swizzle4<Float4, T> &rhs)
2755*03ce13f7SAndroid Build Coastguard Worker {
2756*03ce13f7SAndroid Build Coastguard Worker 	return *this = rhs.operator RValue<Float4>();
2757*03ce13f7SAndroid Build Coastguard Worker }
2758*03ce13f7SAndroid Build Coastguard Worker 
2759*03ce13f7SAndroid Build Coastguard Worker // Returns a reactor pointer to the fixed-address ptr.
2760*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> ConstantPointer(const void *ptr);
2761*03ce13f7SAndroid Build Coastguard Worker 
2762*03ce13f7SAndroid Build Coastguard Worker // Returns a reactor pointer to an immutable copy of the data of size bytes.
2763*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<Byte>> ConstantData(const void *data, size_t size);
2764*03ce13f7SAndroid Build Coastguard Worker 
2765*03ce13f7SAndroid Build Coastguard Worker template<class T>
Pointer(Argument<Pointer<T>> argument)2766*03ce13f7SAndroid Build Coastguard Worker Pointer<T>::Pointer(Argument<Pointer<T>> argument)
2767*03ce13f7SAndroid Build Coastguard Worker     : alignment(1)
2768*03ce13f7SAndroid Build Coastguard Worker {
2769*03ce13f7SAndroid Build Coastguard Worker 	this->store(argument.rvalue());
2770*03ce13f7SAndroid Build Coastguard Worker }
2771*03ce13f7SAndroid Build Coastguard Worker 
2772*03ce13f7SAndroid Build Coastguard Worker template<class T>
Pointer()2773*03ce13f7SAndroid Build Coastguard Worker Pointer<T>::Pointer()
2774*03ce13f7SAndroid Build Coastguard Worker     : alignment(1)
2775*03ce13f7SAndroid Build Coastguard Worker {}
2776*03ce13f7SAndroid Build Coastguard Worker 
2777*03ce13f7SAndroid Build Coastguard Worker template<class T>
Pointer(RValue<Pointer<T>> rhs)2778*03ce13f7SAndroid Build Coastguard Worker Pointer<T>::Pointer(RValue<Pointer<T>> rhs)
2779*03ce13f7SAndroid Build Coastguard Worker     : alignment(1)
2780*03ce13f7SAndroid Build Coastguard Worker {
2781*03ce13f7SAndroid Build Coastguard Worker 	this->store(rhs);
2782*03ce13f7SAndroid Build Coastguard Worker }
2783*03ce13f7SAndroid Build Coastguard Worker 
2784*03ce13f7SAndroid Build Coastguard Worker template<class T>
Pointer(const Pointer<T> & rhs)2785*03ce13f7SAndroid Build Coastguard Worker Pointer<T>::Pointer(const Pointer<T> &rhs)
2786*03ce13f7SAndroid Build Coastguard Worker     : alignment(rhs.alignment)
2787*03ce13f7SAndroid Build Coastguard Worker {
2788*03ce13f7SAndroid Build Coastguard Worker 	this->store(rhs.load());
2789*03ce13f7SAndroid Build Coastguard Worker }
2790*03ce13f7SAndroid Build Coastguard Worker 
2791*03ce13f7SAndroid Build Coastguard Worker template<class T>
Pointer(const Reference<Pointer<T>> & rhs)2792*03ce13f7SAndroid Build Coastguard Worker Pointer<T>::Pointer(const Reference<Pointer<T>> &rhs)
2793*03ce13f7SAndroid Build Coastguard Worker     : alignment(rhs.getAlignment())
2794*03ce13f7SAndroid Build Coastguard Worker {
2795*03ce13f7SAndroid Build Coastguard Worker 	this->store(rhs.load());
2796*03ce13f7SAndroid Build Coastguard Worker }
2797*03ce13f7SAndroid Build Coastguard Worker 
2798*03ce13f7SAndroid Build Coastguard Worker template<class T>
Pointer(std::nullptr_t)2799*03ce13f7SAndroid Build Coastguard Worker Pointer<T>::Pointer(std::nullptr_t)
2800*03ce13f7SAndroid Build Coastguard Worker     : alignment(1)
2801*03ce13f7SAndroid Build Coastguard Worker {
2802*03ce13f7SAndroid Build Coastguard Worker 	Value *value = Nucleus::createNullPointer(T::type());
2803*03ce13f7SAndroid Build Coastguard Worker 	this->storeValue(value);
2804*03ce13f7SAndroid Build Coastguard Worker }
2805*03ce13f7SAndroid Build Coastguard Worker 
2806*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator =(RValue<Pointer<T>> rhs)2807*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<T>> Pointer<T>::operator=(RValue<Pointer<T>> rhs)
2808*03ce13f7SAndroid Build Coastguard Worker {
2809*03ce13f7SAndroid Build Coastguard Worker 	return this->store(rhs);
2810*03ce13f7SAndroid Build Coastguard Worker }
2811*03ce13f7SAndroid Build Coastguard Worker 
2812*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator =(const Pointer<T> & rhs)2813*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<T>> Pointer<T>::operator=(const Pointer<T> &rhs)
2814*03ce13f7SAndroid Build Coastguard Worker {
2815*03ce13f7SAndroid Build Coastguard Worker 	return this->store(rhs.load());
2816*03ce13f7SAndroid Build Coastguard Worker }
2817*03ce13f7SAndroid Build Coastguard Worker 
2818*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator =(const Reference<Pointer<T>> & rhs)2819*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<T>> Pointer<T>::operator=(const Reference<Pointer<T>> &rhs)
2820*03ce13f7SAndroid Build Coastguard Worker {
2821*03ce13f7SAndroid Build Coastguard Worker 	return this->store(rhs.load());
2822*03ce13f7SAndroid Build Coastguard Worker }
2823*03ce13f7SAndroid Build Coastguard Worker 
2824*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator =(std::nullptr_t)2825*03ce13f7SAndroid Build Coastguard Worker RValue<Pointer<T>> Pointer<T>::operator=(std::nullptr_t)
2826*03ce13f7SAndroid Build Coastguard Worker {
2827*03ce13f7SAndroid Build Coastguard Worker 	Value *value = Nucleus::createNullPointer(T::type());
2828*03ce13f7SAndroid Build Coastguard Worker 	this->storeValue(value);
2829*03ce13f7SAndroid Build Coastguard Worker 
2830*03ce13f7SAndroid Build Coastguard Worker 	return RValue<Pointer<T>>(this);
2831*03ce13f7SAndroid Build Coastguard Worker }
2832*03ce13f7SAndroid Build Coastguard Worker 
2833*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator *() const2834*03ce13f7SAndroid Build Coastguard Worker Reference<T> Pointer<T>::operator*() const
2835*03ce13f7SAndroid Build Coastguard Worker {
2836*03ce13f7SAndroid Build Coastguard Worker 	return Reference<T>(this->loadValue(), alignment);
2837*03ce13f7SAndroid Build Coastguard Worker }
2838*03ce13f7SAndroid Build Coastguard Worker 
2839*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator [](int index) const2840*03ce13f7SAndroid Build Coastguard Worker Reference<T> Pointer<T>::operator[](int index) const
2841*03ce13f7SAndroid Build Coastguard Worker {
2842*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2843*03ce13f7SAndroid Build Coastguard Worker 	Value *element = Nucleus::createGEP(this->loadValue(), T::type(), Nucleus::createConstantInt(index), false);
2844*03ce13f7SAndroid Build Coastguard Worker 
2845*03ce13f7SAndroid Build Coastguard Worker 	return Reference<T>(element, alignment);
2846*03ce13f7SAndroid Build Coastguard Worker }
2847*03ce13f7SAndroid Build Coastguard Worker 
2848*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator [](unsigned int index) const2849*03ce13f7SAndroid Build Coastguard Worker Reference<T> Pointer<T>::operator[](unsigned int index) const
2850*03ce13f7SAndroid Build Coastguard Worker {
2851*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2852*03ce13f7SAndroid Build Coastguard Worker 	Value *element = Nucleus::createGEP(this->loadValue(), T::type(), Nucleus::createConstantInt(index), true);
2853*03ce13f7SAndroid Build Coastguard Worker 
2854*03ce13f7SAndroid Build Coastguard Worker 	return Reference<T>(element, alignment);
2855*03ce13f7SAndroid Build Coastguard Worker }
2856*03ce13f7SAndroid Build Coastguard Worker 
2857*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator [](RValue<Int> index) const2858*03ce13f7SAndroid Build Coastguard Worker Reference<T> Pointer<T>::operator[](RValue<Int> index) const
2859*03ce13f7SAndroid Build Coastguard Worker {
2860*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2861*03ce13f7SAndroid Build Coastguard Worker 	Value *element = Nucleus::createGEP(this->loadValue(), T::type(), index.value(), false);
2862*03ce13f7SAndroid Build Coastguard Worker 
2863*03ce13f7SAndroid Build Coastguard Worker 	return Reference<T>(element, alignment);
2864*03ce13f7SAndroid Build Coastguard Worker }
2865*03ce13f7SAndroid Build Coastguard Worker 
2866*03ce13f7SAndroid Build Coastguard Worker template<class T>
operator [](RValue<UInt> index) const2867*03ce13f7SAndroid Build Coastguard Worker Reference<T> Pointer<T>::operator[](RValue<UInt> index) const
2868*03ce13f7SAndroid Build Coastguard Worker {
2869*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2870*03ce13f7SAndroid Build Coastguard Worker 	Value *element = Nucleus::createGEP(this->loadValue(), T::type(), index.value(), true);
2871*03ce13f7SAndroid Build Coastguard Worker 
2872*03ce13f7SAndroid Build Coastguard Worker 	return Reference<T>(element, alignment);
2873*03ce13f7SAndroid Build Coastguard Worker }
2874*03ce13f7SAndroid Build Coastguard Worker 
2875*03ce13f7SAndroid Build Coastguard Worker template<class T>
type()2876*03ce13f7SAndroid Build Coastguard Worker Type *Pointer<T>::type()
2877*03ce13f7SAndroid Build Coastguard Worker {
2878*03ce13f7SAndroid Build Coastguard Worker 	return Nucleus::getPointerType(T::type());
2879*03ce13f7SAndroid Build Coastguard Worker }
2880*03ce13f7SAndroid Build Coastguard Worker 
2881*03ce13f7SAndroid Build Coastguard Worker template<class T, int S>
Array(int size)2882*03ce13f7SAndroid Build Coastguard Worker Array<T, S>::Array(int size)
2883*03ce13f7SAndroid Build Coastguard Worker     : LValue<T>(size)
2884*03ce13f7SAndroid Build Coastguard Worker {
2885*03ce13f7SAndroid Build Coastguard Worker }
2886*03ce13f7SAndroid Build Coastguard Worker 
2887*03ce13f7SAndroid Build Coastguard Worker template<class T, int S>
operator [](int index)2888*03ce13f7SAndroid Build Coastguard Worker Reference<T> Array<T, S>::operator[](int index)
2889*03ce13f7SAndroid Build Coastguard Worker {
2890*03ce13f7SAndroid Build Coastguard Worker 	assert(index < Variable::getArraySize());
2891*03ce13f7SAndroid Build Coastguard Worker 	Value *element = this->getElementPointer(Nucleus::createConstantInt(index), false);
2892*03ce13f7SAndroid Build Coastguard Worker 
2893*03ce13f7SAndroid Build Coastguard Worker 	return Reference<T>(element);
2894*03ce13f7SAndroid Build Coastguard Worker }
2895*03ce13f7SAndroid Build Coastguard Worker 
2896*03ce13f7SAndroid Build Coastguard Worker template<class T, int S>
operator [](unsigned int index)2897*03ce13f7SAndroid Build Coastguard Worker Reference<T> Array<T, S>::operator[](unsigned int index)
2898*03ce13f7SAndroid Build Coastguard Worker {
2899*03ce13f7SAndroid Build Coastguard Worker 	assert(index < static_cast<unsigned int>(Variable::getArraySize()));
2900*03ce13f7SAndroid Build Coastguard Worker 	Value *element = this->getElementPointer(Nucleus::createConstantInt(index), true);
2901*03ce13f7SAndroid Build Coastguard Worker 
2902*03ce13f7SAndroid Build Coastguard Worker 	return Reference<T>(element);
2903*03ce13f7SAndroid Build Coastguard Worker }
2904*03ce13f7SAndroid Build Coastguard Worker 
2905*03ce13f7SAndroid Build Coastguard Worker template<class T, int S>
operator [](RValue<Int> index)2906*03ce13f7SAndroid Build Coastguard Worker Reference<T> Array<T, S>::operator[](RValue<Int> index)
2907*03ce13f7SAndroid Build Coastguard Worker {
2908*03ce13f7SAndroid Build Coastguard Worker 	Value *element = this->getElementPointer(index.value(), false);
2909*03ce13f7SAndroid Build Coastguard Worker 
2910*03ce13f7SAndroid Build Coastguard Worker 	return Reference<T>(element);
2911*03ce13f7SAndroid Build Coastguard Worker }
2912*03ce13f7SAndroid Build Coastguard Worker 
2913*03ce13f7SAndroid Build Coastguard Worker template<class T, int S>
operator [](RValue<UInt> index)2914*03ce13f7SAndroid Build Coastguard Worker Reference<T> Array<T, S>::operator[](RValue<UInt> index)
2915*03ce13f7SAndroid Build Coastguard Worker {
2916*03ce13f7SAndroid Build Coastguard Worker 	Value *element = this->getElementPointer(index.value(), true);
2917*03ce13f7SAndroid Build Coastguard Worker 
2918*03ce13f7SAndroid Build Coastguard Worker 	return Reference<T>(element);
2919*03ce13f7SAndroid Build Coastguard Worker }
2920*03ce13f7SAndroid Build Coastguard Worker 
2921*03ce13f7SAndroid Build Coastguard Worker //	template<class T>
2922*03ce13f7SAndroid Build Coastguard Worker //	RValue<Array<T>> operator++(Array<T> &val, int)
2923*03ce13f7SAndroid Build Coastguard Worker //	{
2924*03ce13f7SAndroid Build Coastguard Worker //		// FIXME: Requires storing the address of the array
2925*03ce13f7SAndroid Build Coastguard Worker //	}
2926*03ce13f7SAndroid Build Coastguard Worker 
2927*03ce13f7SAndroid Build Coastguard Worker //	template<class T>
2928*03ce13f7SAndroid Build Coastguard Worker //	const Array<T> &operator++(Array<T> &val)
2929*03ce13f7SAndroid Build Coastguard Worker //	{
2930*03ce13f7SAndroid Build Coastguard Worker //		// FIXME: Requires storing the address of the array
2931*03ce13f7SAndroid Build Coastguard Worker //	}
2932*03ce13f7SAndroid Build Coastguard Worker 
2933*03ce13f7SAndroid Build Coastguard Worker //	template<class T>
2934*03ce13f7SAndroid Build Coastguard Worker //	RValue<Array<T>> operator--(Array<T> &val, int)
2935*03ce13f7SAndroid Build Coastguard Worker //	{
2936*03ce13f7SAndroid Build Coastguard Worker //		// FIXME: Requires storing the address of the array
2937*03ce13f7SAndroid Build Coastguard Worker //	}
2938*03ce13f7SAndroid Build Coastguard Worker 
2939*03ce13f7SAndroid Build Coastguard Worker //	template<class T>
2940*03ce13f7SAndroid Build Coastguard Worker //	const Array<T> &operator--(Array<T> &val)
2941*03ce13f7SAndroid Build Coastguard Worker //	{
2942*03ce13f7SAndroid Build Coastguard Worker //		// FIXME: Requires storing the address of the array
2943*03ce13f7SAndroid Build Coastguard Worker //	}
2944*03ce13f7SAndroid Build Coastguard Worker 
2945*03ce13f7SAndroid Build Coastguard Worker template<class T>
IfThenElse(RValue<Bool> condition,RValue<T> ifTrue,RValue<T> ifFalse)2946*03ce13f7SAndroid Build Coastguard Worker RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, RValue<T> ifFalse)
2947*03ce13f7SAndroid Build Coastguard Worker {
2948*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2949*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(Nucleus::createSelect(condition.value(), ifTrue.value(), ifFalse.value()));
2950*03ce13f7SAndroid Build Coastguard Worker }
2951*03ce13f7SAndroid Build Coastguard Worker 
2952*03ce13f7SAndroid Build Coastguard Worker template<class T>
IfThenElse(RValue<Bool> condition,const T & ifTrue,RValue<T> ifFalse)2953*03ce13f7SAndroid Build Coastguard Worker RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, RValue<T> ifFalse)
2954*03ce13f7SAndroid Build Coastguard Worker {
2955*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2956*03ce13f7SAndroid Build Coastguard Worker 	Value *trueValue = ifTrue.loadValue();
2957*03ce13f7SAndroid Build Coastguard Worker 
2958*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(Nucleus::createSelect(condition.value(), trueValue, ifFalse.value()));
2959*03ce13f7SAndroid Build Coastguard Worker }
2960*03ce13f7SAndroid Build Coastguard Worker 
2961*03ce13f7SAndroid Build Coastguard Worker template<class T>
IfThenElse(RValue<Bool> condition,RValue<T> ifTrue,const T & ifFalse)2962*03ce13f7SAndroid Build Coastguard Worker RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, const T &ifFalse)
2963*03ce13f7SAndroid Build Coastguard Worker {
2964*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2965*03ce13f7SAndroid Build Coastguard Worker 	Value *falseValue = ifFalse.loadValue();
2966*03ce13f7SAndroid Build Coastguard Worker 
2967*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(Nucleus::createSelect(condition.value(), ifTrue.value(), falseValue));
2968*03ce13f7SAndroid Build Coastguard Worker }
2969*03ce13f7SAndroid Build Coastguard Worker 
2970*03ce13f7SAndroid Build Coastguard Worker template<class T>
IfThenElse(RValue<Bool> condition,const T & ifTrue,const T & ifFalse)2971*03ce13f7SAndroid Build Coastguard Worker RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, const T &ifFalse)
2972*03ce13f7SAndroid Build Coastguard Worker {
2973*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
2974*03ce13f7SAndroid Build Coastguard Worker 	Value *trueValue = ifTrue.loadValue();
2975*03ce13f7SAndroid Build Coastguard Worker 	Value *falseValue = ifFalse.loadValue();
2976*03ce13f7SAndroid Build Coastguard Worker 
2977*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(Nucleus::createSelect(condition.value(), trueValue, falseValue));
2978*03ce13f7SAndroid Build Coastguard Worker }
2979*03ce13f7SAndroid Build Coastguard Worker 
2980*03ce13f7SAndroid Build Coastguard Worker template<typename Return, typename... Arguments>
Function()2981*03ce13f7SAndroid Build Coastguard Worker Function<Return(Arguments...)>::Function()
2982*03ce13f7SAndroid Build Coastguard Worker     : core(new Nucleus())
2983*03ce13f7SAndroid Build Coastguard Worker {
2984*03ce13f7SAndroid Build Coastguard Worker 	Type *types[] = { Arguments::type()... };
2985*03ce13f7SAndroid Build Coastguard Worker 	for(Type *type : types)
2986*03ce13f7SAndroid Build Coastguard Worker 	{
2987*03ce13f7SAndroid Build Coastguard Worker 		if(type != Void::type())
2988*03ce13f7SAndroid Build Coastguard Worker 		{
2989*03ce13f7SAndroid Build Coastguard Worker 			arguments.push_back(type);
2990*03ce13f7SAndroid Build Coastguard Worker 		}
2991*03ce13f7SAndroid Build Coastguard Worker 	}
2992*03ce13f7SAndroid Build Coastguard Worker 
2993*03ce13f7SAndroid Build Coastguard Worker 	Nucleus::createFunction(Return::type(), arguments);
2994*03ce13f7SAndroid Build Coastguard Worker }
2995*03ce13f7SAndroid Build Coastguard Worker 
2996*03ce13f7SAndroid Build Coastguard Worker template<typename Return, typename... Arguments>
operator ()(const char * name,...)2997*03ce13f7SAndroid Build Coastguard Worker std::shared_ptr<Routine> Function<Return(Arguments...)>::operator()(const char *name, ...)
2998*03ce13f7SAndroid Build Coastguard Worker {
2999*03ce13f7SAndroid Build Coastguard Worker 	char fullName[1024 + 1];
3000*03ce13f7SAndroid Build Coastguard Worker 
3001*03ce13f7SAndroid Build Coastguard Worker 	va_list vararg;
3002*03ce13f7SAndroid Build Coastguard Worker 	va_start(vararg, name);
3003*03ce13f7SAndroid Build Coastguard Worker 	vsnprintf(fullName, 1024, name, vararg);
3004*03ce13f7SAndroid Build Coastguard Worker 	va_end(vararg);
3005*03ce13f7SAndroid Build Coastguard Worker 
3006*03ce13f7SAndroid Build Coastguard Worker 	auto routine = core->acquireRoutine(fullName);
3007*03ce13f7SAndroid Build Coastguard Worker 	core.reset(nullptr);
3008*03ce13f7SAndroid Build Coastguard Worker 
3009*03ce13f7SAndroid Build Coastguard Worker 	return routine;
3010*03ce13f7SAndroid Build Coastguard Worker }
3011*03ce13f7SAndroid Build Coastguard Worker 
3012*03ce13f7SAndroid Build Coastguard Worker template<class T, class S>
ReinterpretCast(RValue<S> val)3013*03ce13f7SAndroid Build Coastguard Worker RValue<T> ReinterpretCast(RValue<S> val)
3014*03ce13f7SAndroid Build Coastguard Worker {
3015*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
3016*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(Nucleus::createBitCast(val.value(), T::type()));
3017*03ce13f7SAndroid Build Coastguard Worker }
3018*03ce13f7SAndroid Build Coastguard Worker 
3019*03ce13f7SAndroid Build Coastguard Worker template<class T, class S>
ReinterpretCast(const LValue<S> & var)3020*03ce13f7SAndroid Build Coastguard Worker RValue<T> ReinterpretCast(const LValue<S> &var)
3021*03ce13f7SAndroid Build Coastguard Worker {
3022*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
3023*03ce13f7SAndroid Build Coastguard Worker 	Value *val = var.loadValue();
3024*03ce13f7SAndroid Build Coastguard Worker 
3025*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(Nucleus::createBitCast(val, T::type()));
3026*03ce13f7SAndroid Build Coastguard Worker }
3027*03ce13f7SAndroid Build Coastguard Worker 
3028*03ce13f7SAndroid Build Coastguard Worker template<class T, class S>
ReinterpretCast(const Reference<S> & var)3029*03ce13f7SAndroid Build Coastguard Worker RValue<T> ReinterpretCast(const Reference<S> &var)
3030*03ce13f7SAndroid Build Coastguard Worker {
3031*03ce13f7SAndroid Build Coastguard Worker 	return ReinterpretCast<T>(RValue<S>(var));
3032*03ce13f7SAndroid Build Coastguard Worker }
3033*03ce13f7SAndroid Build Coastguard Worker 
3034*03ce13f7SAndroid Build Coastguard Worker template<class T>
As(Value * val)3035*03ce13f7SAndroid Build Coastguard Worker RValue<T> As(Value *val)
3036*03ce13f7SAndroid Build Coastguard Worker {
3037*03ce13f7SAndroid Build Coastguard Worker 	RR_DEBUG_INFO_UPDATE_LOC();
3038*03ce13f7SAndroid Build Coastguard Worker 	return RValue<T>(Nucleus::createBitCast(val, T::type()));
3039*03ce13f7SAndroid Build Coastguard Worker }
3040*03ce13f7SAndroid Build Coastguard Worker 
3041*03ce13f7SAndroid Build Coastguard Worker template<class T, class S>
As(RValue<S> val)3042*03ce13f7SAndroid Build Coastguard Worker RValue<T> As(RValue<S> val)
3043*03ce13f7SAndroid Build Coastguard Worker {
3044*03ce13f7SAndroid Build Coastguard Worker 	return ReinterpretCast<T>(val);
3045*03ce13f7SAndroid Build Coastguard Worker }
3046*03ce13f7SAndroid Build Coastguard Worker 
3047*03ce13f7SAndroid Build Coastguard Worker template<class T, class S>
As(const LValue<S> & var)3048*03ce13f7SAndroid Build Coastguard Worker RValue<T> As(const LValue<S> &var)
3049*03ce13f7SAndroid Build Coastguard Worker {
3050*03ce13f7SAndroid Build Coastguard Worker 	return ReinterpretCast<T>(var);
3051*03ce13f7SAndroid Build Coastguard Worker }
3052*03ce13f7SAndroid Build Coastguard Worker 
3053*03ce13f7SAndroid Build Coastguard Worker template<class T, class S>
As(const Reference<S> & val)3054*03ce13f7SAndroid Build Coastguard Worker RValue<T> As(const Reference<S> &val)
3055*03ce13f7SAndroid Build Coastguard Worker {
3056*03ce13f7SAndroid Build Coastguard Worker 	return ReinterpretCast<T>(val);
3057*03ce13f7SAndroid Build Coastguard Worker }
3058*03ce13f7SAndroid Build Coastguard Worker 
3059*03ce13f7SAndroid Build Coastguard Worker // Calls the function pointer fptr with the given arguments, return type
3060*03ce13f7SAndroid Build Coastguard Worker // and parameter types. Returns the call's return value if the function has
3061*03ce13f7SAndroid Build Coastguard Worker // a non-void return type.
3062*03ce13f7SAndroid Build Coastguard Worker Value *Call(RValue<Pointer<Byte>> fptr, Type *retTy, std::initializer_list<Value *> args, std::initializer_list<Type *> paramTys);
3063*03ce13f7SAndroid Build Coastguard Worker 
3064*03ce13f7SAndroid Build Coastguard Worker template<typename F>
3065*03ce13f7SAndroid Build Coastguard Worker class CallHelper
3066*03ce13f7SAndroid Build Coastguard Worker {};
3067*03ce13f7SAndroid Build Coastguard Worker 
3068*03ce13f7SAndroid Build Coastguard Worker template<typename Return, typename... Arguments>
3069*03ce13f7SAndroid Build Coastguard Worker class CallHelper<Return(Arguments...)>
3070*03ce13f7SAndroid Build Coastguard Worker {
3071*03ce13f7SAndroid Build Coastguard Worker public:
3072*03ce13f7SAndroid Build Coastguard Worker 	using RReturn = CToReactorT<Return>;
3073*03ce13f7SAndroid Build Coastguard Worker 
Call(Return (fptr)(Arguments...),CToReactorT<Arguments>...args)3074*03ce13f7SAndroid Build Coastguard Worker 	static inline RReturn Call(Return(fptr)(Arguments...), CToReactorT<Arguments>... args)
3075*03ce13f7SAndroid Build Coastguard Worker 	{
3076*03ce13f7SAndroid Build Coastguard Worker 		return RValue<RReturn>(rr::Call(
3077*03ce13f7SAndroid Build Coastguard Worker 		    ConstantPointer(reinterpret_cast<void *>(fptr)),
3078*03ce13f7SAndroid Build Coastguard Worker 		    RReturn::type(),
3079*03ce13f7SAndroid Build Coastguard Worker 		    { ValueOf(args)... },
3080*03ce13f7SAndroid Build Coastguard Worker 		    { CToReactorT<Arguments>::type()... }));
3081*03ce13f7SAndroid Build Coastguard Worker 	}
3082*03ce13f7SAndroid Build Coastguard Worker 
Call(Pointer<Byte> fptr,CToReactorT<Arguments>...args)3083*03ce13f7SAndroid Build Coastguard Worker 	static inline RReturn Call(Pointer<Byte> fptr, CToReactorT<Arguments>... args)
3084*03ce13f7SAndroid Build Coastguard Worker 	{
3085*03ce13f7SAndroid Build Coastguard Worker 		return RValue<RReturn>(rr::Call(
3086*03ce13f7SAndroid Build Coastguard Worker 		    fptr,
3087*03ce13f7SAndroid Build Coastguard Worker 		    RReturn::type(),
3088*03ce13f7SAndroid Build Coastguard Worker 		    { ValueOf(args)... },
3089*03ce13f7SAndroid Build Coastguard Worker 		    { CToReactorT<Arguments>::type()... }));
3090*03ce13f7SAndroid Build Coastguard Worker 	}
3091*03ce13f7SAndroid Build Coastguard Worker };
3092*03ce13f7SAndroid Build Coastguard Worker 
3093*03ce13f7SAndroid Build Coastguard Worker template<typename... Arguments>
3094*03ce13f7SAndroid Build Coastguard Worker class CallHelper<void(Arguments...)>
3095*03ce13f7SAndroid Build Coastguard Worker {
3096*03ce13f7SAndroid Build Coastguard Worker public:
Call(void (fptr)(Arguments...),CToReactorT<Arguments>...args)3097*03ce13f7SAndroid Build Coastguard Worker 	static inline void Call(void(fptr)(Arguments...), CToReactorT<Arguments>... args)
3098*03ce13f7SAndroid Build Coastguard Worker 	{
3099*03ce13f7SAndroid Build Coastguard Worker 		rr::Call(ConstantPointer(reinterpret_cast<void *>(fptr)),
3100*03ce13f7SAndroid Build Coastguard Worker 		         Void::type(),
3101*03ce13f7SAndroid Build Coastguard Worker 		         { ValueOf(args)... },
3102*03ce13f7SAndroid Build Coastguard Worker 		         { CToReactorT<Arguments>::type()... });
3103*03ce13f7SAndroid Build Coastguard Worker 	}
3104*03ce13f7SAndroid Build Coastguard Worker 
Call(Pointer<Byte> fptr,CToReactorT<Arguments>...args)3105*03ce13f7SAndroid Build Coastguard Worker 	static inline void Call(Pointer<Byte> fptr, CToReactorT<Arguments>... args)
3106*03ce13f7SAndroid Build Coastguard Worker 	{
3107*03ce13f7SAndroid Build Coastguard Worker 		rr::Call(fptr,
3108*03ce13f7SAndroid Build Coastguard Worker 		         Void::type(),
3109*03ce13f7SAndroid Build Coastguard Worker 		         { ValueOf(args)... },
3110*03ce13f7SAndroid Build Coastguard Worker 		         { CToReactorT<Arguments>::type()... });
3111*03ce13f7SAndroid Build Coastguard Worker 	}
3112*03ce13f7SAndroid Build Coastguard Worker };
3113*03ce13f7SAndroid Build Coastguard Worker 
3114*03ce13f7SAndroid Build Coastguard Worker template<typename T>
CastToReactor(const T & v)3115*03ce13f7SAndroid Build Coastguard Worker inline ReactorTypeT<T> CastToReactor(const T &v)
3116*03ce13f7SAndroid Build Coastguard Worker {
3117*03ce13f7SAndroid Build Coastguard Worker 	return ReactorType<T>::cast(v);
3118*03ce13f7SAndroid Build Coastguard Worker }
3119*03ce13f7SAndroid Build Coastguard Worker 
3120*03ce13f7SAndroid Build Coastguard Worker // Calls the static function pointer fptr with the given arguments args.
3121*03ce13f7SAndroid Build Coastguard Worker template<typename Return, typename... CArgs, typename... RArgs>
Call(Return (fptr)(CArgs...),RArgs &&...args)3122*03ce13f7SAndroid Build Coastguard Worker inline CToReactorT<Return> Call(Return(fptr)(CArgs...), RArgs &&...args)
3123*03ce13f7SAndroid Build Coastguard Worker {
3124*03ce13f7SAndroid Build Coastguard Worker 	return CallHelper<Return(CArgs...)>::Call(fptr, CastToReactor(std::forward<RArgs>(args))...);
3125*03ce13f7SAndroid Build Coastguard Worker }
3126*03ce13f7SAndroid Build Coastguard Worker 
3127*03ce13f7SAndroid Build Coastguard Worker // Calls the static function pointer fptr with the given arguments args.
3128*03ce13f7SAndroid Build Coastguard Worker // Overload for calling functions with void return type.
3129*03ce13f7SAndroid Build Coastguard Worker template<typename... CArgs, typename... RArgs>
Call(void (fptr)(CArgs...),RArgs &&...args)3130*03ce13f7SAndroid Build Coastguard Worker inline void Call(void(fptr)(CArgs...), RArgs &&...args)
3131*03ce13f7SAndroid Build Coastguard Worker {
3132*03ce13f7SAndroid Build Coastguard Worker 	CallHelper<void(CArgs...)>::Call(fptr, CastToReactor(std::forward<RArgs>(args))...);
3133*03ce13f7SAndroid Build Coastguard Worker }
3134*03ce13f7SAndroid Build Coastguard Worker 
3135*03ce13f7SAndroid Build Coastguard Worker // Calls the member function pointer fptr with the given arguments args.
3136*03ce13f7SAndroid Build Coastguard Worker // object can be a Class*, or a Pointer<Byte>.
3137*03ce13f7SAndroid Build Coastguard Worker template<typename Return, typename Class, typename C, typename... CArgs, typename... RArgs>
Call(Return (Class::* fptr)(CArgs...),C && object,RArgs &&...args)3138*03ce13f7SAndroid Build Coastguard Worker inline CToReactorT<Return> Call(Return (Class::*fptr)(CArgs...), C &&object, RArgs &&...args)
3139*03ce13f7SAndroid Build Coastguard Worker {
3140*03ce13f7SAndroid Build Coastguard Worker 	using Helper = CallHelper<Return(Class *, void *, CArgs...)>;
3141*03ce13f7SAndroid Build Coastguard Worker 	using fptrTy = decltype(fptr);
3142*03ce13f7SAndroid Build Coastguard Worker 
3143*03ce13f7SAndroid Build Coastguard Worker 	struct Static
3144*03ce13f7SAndroid Build Coastguard Worker 	{
3145*03ce13f7SAndroid Build Coastguard Worker 		static inline Return Call(Class *object, void *fptrptr, CArgs... args)
3146*03ce13f7SAndroid Build Coastguard Worker 		{
3147*03ce13f7SAndroid Build Coastguard Worker 			auto fptr = *reinterpret_cast<fptrTy *>(fptrptr);
3148*03ce13f7SAndroid Build Coastguard Worker 			return (object->*fptr)(std::forward<CArgs>(args)...);
3149*03ce13f7SAndroid Build Coastguard Worker 		}
3150*03ce13f7SAndroid Build Coastguard Worker 	};
3151*03ce13f7SAndroid Build Coastguard Worker 
3152*03ce13f7SAndroid Build Coastguard Worker 	return Helper::Call(&Static::Call,
3153*03ce13f7SAndroid Build Coastguard Worker 	                    CastToReactor(object),
3154*03ce13f7SAndroid Build Coastguard Worker 	                    ConstantData(&fptr, sizeof(fptr)),
3155*03ce13f7SAndroid Build Coastguard Worker 	                    CastToReactor(std::forward<RArgs>(args))...);
3156*03ce13f7SAndroid Build Coastguard Worker }
3157*03ce13f7SAndroid Build Coastguard Worker 
3158*03ce13f7SAndroid Build Coastguard Worker // Calls the member function pointer fptr with the given arguments args.
3159*03ce13f7SAndroid Build Coastguard Worker // Overload for calling functions with void return type.
3160*03ce13f7SAndroid Build Coastguard Worker // object can be a Class*, or a Pointer<Byte>.
3161*03ce13f7SAndroid Build Coastguard Worker template<typename Class, typename C, typename... CArgs, typename... RArgs>
Call(void (Class::* fptr)(CArgs...),C && object,RArgs &&...args)3162*03ce13f7SAndroid Build Coastguard Worker inline void Call(void (Class::*fptr)(CArgs...), C &&object, RArgs &&...args)
3163*03ce13f7SAndroid Build Coastguard Worker {
3164*03ce13f7SAndroid Build Coastguard Worker 	using Helper = CallHelper<void(Class *, void *, CArgs...)>;
3165*03ce13f7SAndroid Build Coastguard Worker 	using fptrTy = decltype(fptr);
3166*03ce13f7SAndroid Build Coastguard Worker 
3167*03ce13f7SAndroid Build Coastguard Worker 	struct Static
3168*03ce13f7SAndroid Build Coastguard Worker 	{
3169*03ce13f7SAndroid Build Coastguard Worker 		static inline void Call(Class *object, void *fptrptr, CArgs... args)
3170*03ce13f7SAndroid Build Coastguard Worker 		{
3171*03ce13f7SAndroid Build Coastguard Worker 			auto fptr = *reinterpret_cast<fptrTy *>(fptrptr);
3172*03ce13f7SAndroid Build Coastguard Worker 			(object->*fptr)(std::forward<CArgs>(args)...);
3173*03ce13f7SAndroid Build Coastguard Worker 		}
3174*03ce13f7SAndroid Build Coastguard Worker 	};
3175*03ce13f7SAndroid Build Coastguard Worker 
3176*03ce13f7SAndroid Build Coastguard Worker 	Helper::Call(&Static::Call,
3177*03ce13f7SAndroid Build Coastguard Worker 	             CastToReactor(object),
3178*03ce13f7SAndroid Build Coastguard Worker 	             ConstantData(&fptr, sizeof(fptr)),
3179*03ce13f7SAndroid Build Coastguard Worker 	             CastToReactor(std::forward<RArgs>(args))...);
3180*03ce13f7SAndroid Build Coastguard Worker }
3181*03ce13f7SAndroid Build Coastguard Worker 
3182*03ce13f7SAndroid Build Coastguard Worker // NonVoidFunction<F> and VoidFunction<F> are helper classes which define ReturnType
3183*03ce13f7SAndroid Build Coastguard Worker // when F matches a non-void fuction signature or void function signature, respectively,
3184*03ce13f7SAndroid Build Coastguard Worker // as the function's return type.
3185*03ce13f7SAndroid Build Coastguard Worker template<typename F>
3186*03ce13f7SAndroid Build Coastguard Worker struct NonVoidFunction
3187*03ce13f7SAndroid Build Coastguard Worker {};
3188*03ce13f7SAndroid Build Coastguard Worker 
3189*03ce13f7SAndroid Build Coastguard Worker template<typename Return, typename... Arguments>
3190*03ce13f7SAndroid Build Coastguard Worker struct NonVoidFunction<Return(Arguments...)>
3191*03ce13f7SAndroid Build Coastguard Worker {
3192*03ce13f7SAndroid Build Coastguard Worker 	using ReturnType = Return;
3193*03ce13f7SAndroid Build Coastguard Worker };
3194*03ce13f7SAndroid Build Coastguard Worker 
3195*03ce13f7SAndroid Build Coastguard Worker template<typename... Arguments>
3196*03ce13f7SAndroid Build Coastguard Worker struct NonVoidFunction<void(Arguments...)>
3197*03ce13f7SAndroid Build Coastguard Worker {
3198*03ce13f7SAndroid Build Coastguard Worker };
3199*03ce13f7SAndroid Build Coastguard Worker 
3200*03ce13f7SAndroid Build Coastguard Worker template<typename F>
3201*03ce13f7SAndroid Build Coastguard Worker using NonVoidFunctionReturnType = typename NonVoidFunction<F>::ReturnType;
3202*03ce13f7SAndroid Build Coastguard Worker 
3203*03ce13f7SAndroid Build Coastguard Worker template<typename F>
3204*03ce13f7SAndroid Build Coastguard Worker struct VoidFunction
3205*03ce13f7SAndroid Build Coastguard Worker {};
3206*03ce13f7SAndroid Build Coastguard Worker 
3207*03ce13f7SAndroid Build Coastguard Worker template<typename... Arguments>
3208*03ce13f7SAndroid Build Coastguard Worker struct VoidFunction<void(Arguments...)>
3209*03ce13f7SAndroid Build Coastguard Worker {
3210*03ce13f7SAndroid Build Coastguard Worker 	using ReturnType = void;
3211*03ce13f7SAndroid Build Coastguard Worker };
3212*03ce13f7SAndroid Build Coastguard Worker 
3213*03ce13f7SAndroid Build Coastguard Worker template<typename F>
3214*03ce13f7SAndroid Build Coastguard Worker using VoidFunctionReturnType = typename VoidFunction<F>::ReturnType;
3215*03ce13f7SAndroid Build Coastguard Worker 
3216*03ce13f7SAndroid Build Coastguard Worker // Calls the Reactor function pointer fptr with the signature FUNCTION_SIGNATURE and arguments.
3217*03ce13f7SAndroid Build Coastguard Worker // Overload for calling functions with non-void return type.
3218*03ce13f7SAndroid Build Coastguard Worker template<typename FUNCTION_SIGNATURE, typename... RArgs>
Call(Pointer<Byte> fptr,RArgs &&...args)3219*03ce13f7SAndroid Build Coastguard Worker inline CToReactorT<NonVoidFunctionReturnType<FUNCTION_SIGNATURE>> Call(Pointer<Byte> fptr, RArgs &&...args)
3220*03ce13f7SAndroid Build Coastguard Worker {
3221*03ce13f7SAndroid Build Coastguard Worker 	return CallHelper<FUNCTION_SIGNATURE>::Call(fptr, CastToReactor(std::forward<RArgs>(args))...);
3222*03ce13f7SAndroid Build Coastguard Worker }
3223*03ce13f7SAndroid Build Coastguard Worker 
3224*03ce13f7SAndroid Build Coastguard Worker // Calls the Reactor function pointer fptr with the signature FUNCTION_SIGNATURE and arguments.
3225*03ce13f7SAndroid Build Coastguard Worker // Overload for calling functions with void return type.
3226*03ce13f7SAndroid Build Coastguard Worker template<typename FUNCTION_SIGNATURE, typename... RArgs>
Call(Pointer<Byte> fptr,RArgs &&...args)3227*03ce13f7SAndroid Build Coastguard Worker inline VoidFunctionReturnType<FUNCTION_SIGNATURE> Call(Pointer<Byte> fptr, RArgs &&...args)
3228*03ce13f7SAndroid Build Coastguard Worker {
3229*03ce13f7SAndroid Build Coastguard Worker 	CallHelper<FUNCTION_SIGNATURE>::Call(fptr, CastToReactor(std::forward<RArgs>(args))...);
3230*03ce13f7SAndroid Build Coastguard Worker }
3231*03ce13f7SAndroid Build Coastguard Worker 
3232*03ce13f7SAndroid Build Coastguard Worker // Breakpoint emits an instruction that will cause the application to trap.
3233*03ce13f7SAndroid Build Coastguard Worker // This can be used to stop an attached debugger at the given call.
3234*03ce13f7SAndroid Build Coastguard Worker void Breakpoint();
3235*03ce13f7SAndroid Build Coastguard Worker 
3236*03ce13f7SAndroid Build Coastguard Worker class ForData
3237*03ce13f7SAndroid Build Coastguard Worker {
3238*03ce13f7SAndroid Build Coastguard Worker public:
ForData(bool init)3239*03ce13f7SAndroid Build Coastguard Worker 	ForData(bool init)
3240*03ce13f7SAndroid Build Coastguard Worker 	    : loopOnce(init)
3241*03ce13f7SAndroid Build Coastguard Worker 	{
3242*03ce13f7SAndroid Build Coastguard Worker 	}
3243*03ce13f7SAndroid Build Coastguard Worker 
operator bool()3244*03ce13f7SAndroid Build Coastguard Worker 	operator bool()
3245*03ce13f7SAndroid Build Coastguard Worker 	{
3246*03ce13f7SAndroid Build Coastguard Worker 		return loopOnce;
3247*03ce13f7SAndroid Build Coastguard Worker 	}
3248*03ce13f7SAndroid Build Coastguard Worker 
operator =(bool value)3249*03ce13f7SAndroid Build Coastguard Worker 	bool operator=(bool value)
3250*03ce13f7SAndroid Build Coastguard Worker 	{
3251*03ce13f7SAndroid Build Coastguard Worker 		return loopOnce = value;
3252*03ce13f7SAndroid Build Coastguard Worker 	}
3253*03ce13f7SAndroid Build Coastguard Worker 
setup()3254*03ce13f7SAndroid Build Coastguard Worker 	bool setup()
3255*03ce13f7SAndroid Build Coastguard Worker 	{
3256*03ce13f7SAndroid Build Coastguard Worker 		RR_DEBUG_INFO_FLUSH();
3257*03ce13f7SAndroid Build Coastguard Worker 		if(Nucleus::getInsertBlock() != endBB)
3258*03ce13f7SAndroid Build Coastguard Worker 		{
3259*03ce13f7SAndroid Build Coastguard Worker 			testBB = Nucleus::createBasicBlock();
3260*03ce13f7SAndroid Build Coastguard Worker 
3261*03ce13f7SAndroid Build Coastguard Worker 			Nucleus::createBr(testBB);
3262*03ce13f7SAndroid Build Coastguard Worker 			Nucleus::setInsertBlock(testBB);
3263*03ce13f7SAndroid Build Coastguard Worker 
3264*03ce13f7SAndroid Build Coastguard Worker 			return true;
3265*03ce13f7SAndroid Build Coastguard Worker 		}
3266*03ce13f7SAndroid Build Coastguard Worker 
3267*03ce13f7SAndroid Build Coastguard Worker 		return false;
3268*03ce13f7SAndroid Build Coastguard Worker 	}
3269*03ce13f7SAndroid Build Coastguard Worker 
test(RValue<Bool> cmp)3270*03ce13f7SAndroid Build Coastguard Worker 	bool test(RValue<Bool> cmp)
3271*03ce13f7SAndroid Build Coastguard Worker 	{
3272*03ce13f7SAndroid Build Coastguard Worker 		BasicBlock *bodyBB = Nucleus::createBasicBlock();
3273*03ce13f7SAndroid Build Coastguard Worker 		endBB = Nucleus::createBasicBlock();
3274*03ce13f7SAndroid Build Coastguard Worker 
3275*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::createCondBr(cmp.value(), bodyBB, endBB);
3276*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::setInsertBlock(bodyBB);
3277*03ce13f7SAndroid Build Coastguard Worker 
3278*03ce13f7SAndroid Build Coastguard Worker 		return true;
3279*03ce13f7SAndroid Build Coastguard Worker 	}
3280*03ce13f7SAndroid Build Coastguard Worker 
end()3281*03ce13f7SAndroid Build Coastguard Worker 	void end()
3282*03ce13f7SAndroid Build Coastguard Worker 	{
3283*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::createBr(testBB);
3284*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::setInsertBlock(endBB);
3285*03ce13f7SAndroid Build Coastguard Worker 	}
3286*03ce13f7SAndroid Build Coastguard Worker 
3287*03ce13f7SAndroid Build Coastguard Worker private:
3288*03ce13f7SAndroid Build Coastguard Worker 	BasicBlock *testBB = nullptr;
3289*03ce13f7SAndroid Build Coastguard Worker 	BasicBlock *endBB = nullptr;
3290*03ce13f7SAndroid Build Coastguard Worker 	bool loopOnce = true;
3291*03ce13f7SAndroid Build Coastguard Worker };
3292*03ce13f7SAndroid Build Coastguard Worker 
3293*03ce13f7SAndroid Build Coastguard Worker class IfElseData
3294*03ce13f7SAndroid Build Coastguard Worker {
3295*03ce13f7SAndroid Build Coastguard Worker public:
IfElseData(RValue<Bool> cmp)3296*03ce13f7SAndroid Build Coastguard Worker 	IfElseData(RValue<Bool> cmp)
3297*03ce13f7SAndroid Build Coastguard Worker 	{
3298*03ce13f7SAndroid Build Coastguard Worker 		trueBB = Nucleus::createBasicBlock();
3299*03ce13f7SAndroid Build Coastguard Worker 		falseBB = Nucleus::createBasicBlock();
3300*03ce13f7SAndroid Build Coastguard Worker 		endBB = falseBB;  // Until we encounter an Else statement, these are the same.
3301*03ce13f7SAndroid Build Coastguard Worker 
3302*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::createCondBr(cmp.value(), trueBB, falseBB);
3303*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::setInsertBlock(trueBB);
3304*03ce13f7SAndroid Build Coastguard Worker 	}
3305*03ce13f7SAndroid Build Coastguard Worker 
~IfElseData()3306*03ce13f7SAndroid Build Coastguard Worker 	~IfElseData()
3307*03ce13f7SAndroid Build Coastguard Worker 	{
3308*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::createBr(endBB);
3309*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::setInsertBlock(endBB);
3310*03ce13f7SAndroid Build Coastguard Worker 	}
3311*03ce13f7SAndroid Build Coastguard Worker 
operator int()3312*03ce13f7SAndroid Build Coastguard Worker 	operator int()
3313*03ce13f7SAndroid Build Coastguard Worker 	{
3314*03ce13f7SAndroid Build Coastguard Worker 		return iteration;
3315*03ce13f7SAndroid Build Coastguard Worker 	}
3316*03ce13f7SAndroid Build Coastguard Worker 
operator ++()3317*03ce13f7SAndroid Build Coastguard Worker 	IfElseData &operator++()
3318*03ce13f7SAndroid Build Coastguard Worker 	{
3319*03ce13f7SAndroid Build Coastguard Worker 		++iteration;
3320*03ce13f7SAndroid Build Coastguard Worker 
3321*03ce13f7SAndroid Build Coastguard Worker 		return *this;
3322*03ce13f7SAndroid Build Coastguard Worker 	}
3323*03ce13f7SAndroid Build Coastguard Worker 
elseClause()3324*03ce13f7SAndroid Build Coastguard Worker 	void elseClause()
3325*03ce13f7SAndroid Build Coastguard Worker 	{
3326*03ce13f7SAndroid Build Coastguard Worker 		endBB = Nucleus::createBasicBlock();
3327*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::createBr(endBB);
3328*03ce13f7SAndroid Build Coastguard Worker 
3329*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::setInsertBlock(falseBB);
3330*03ce13f7SAndroid Build Coastguard Worker 	}
3331*03ce13f7SAndroid Build Coastguard Worker 
3332*03ce13f7SAndroid Build Coastguard Worker private:
3333*03ce13f7SAndroid Build Coastguard Worker 	BasicBlock *trueBB = nullptr;
3334*03ce13f7SAndroid Build Coastguard Worker 	BasicBlock *falseBB = nullptr;
3335*03ce13f7SAndroid Build Coastguard Worker 	BasicBlock *endBB = nullptr;
3336*03ce13f7SAndroid Build Coastguard Worker 	int iteration = 0;
3337*03ce13f7SAndroid Build Coastguard Worker };
3338*03ce13f7SAndroid Build Coastguard Worker 
3339*03ce13f7SAndroid Build Coastguard Worker #define For(init, cond, inc)                        \
3340*03ce13f7SAndroid Build Coastguard Worker 	for(ForData for__ = true; for__; for__ = false) \
3341*03ce13f7SAndroid Build Coastguard Worker 		for(init; for__.setup() && for__.test(cond); inc, for__.end())
3342*03ce13f7SAndroid Build Coastguard Worker 
3343*03ce13f7SAndroid Build Coastguard Worker #define While(cond) For((void)0, cond, (void)0)
3344*03ce13f7SAndroid Build Coastguard Worker 
3345*03ce13f7SAndroid Build Coastguard Worker #define Do                                                \
3346*03ce13f7SAndroid Build Coastguard Worker 	{                                                     \
3347*03ce13f7SAndroid Build Coastguard Worker 		BasicBlock *body__ = Nucleus::createBasicBlock(); \
3348*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::createBr(body__);                        \
3349*03ce13f7SAndroid Build Coastguard Worker 		Nucleus::setInsertBlock(body__);
3350*03ce13f7SAndroid Build Coastguard Worker 
3351*03ce13f7SAndroid Build Coastguard Worker #define Until(cond)                                       \
3352*03ce13f7SAndroid Build Coastguard Worker 	BasicBlock *end__ = Nucleus::createBasicBlock();      \
3353*03ce13f7SAndroid Build Coastguard Worker 	Nucleus::createCondBr((cond).value(), end__, body__); \
3354*03ce13f7SAndroid Build Coastguard Worker 	Nucleus::setInsertBlock(end__);                       \
3355*03ce13f7SAndroid Build Coastguard Worker 	}                                                     \
3356*03ce13f7SAndroid Build Coastguard Worker 	do                                                    \
3357*03ce13f7SAndroid Build Coastguard Worker 	{                                                     \
3358*03ce13f7SAndroid Build Coastguard Worker 	} while(false)  // Require a semi-colon at the end of the Until()
3359*03ce13f7SAndroid Build Coastguard Worker 
3360*03ce13f7SAndroid Build Coastguard Worker enum
3361*03ce13f7SAndroid Build Coastguard Worker {
3362*03ce13f7SAndroid Build Coastguard Worker 	IF_BLOCK__,
3363*03ce13f7SAndroid Build Coastguard Worker 	ELSE_CLAUSE__,
3364*03ce13f7SAndroid Build Coastguard Worker 	ELSE_BLOCK__,
3365*03ce13f7SAndroid Build Coastguard Worker 	IFELSE_NUM__
3366*03ce13f7SAndroid Build Coastguard Worker };
3367*03ce13f7SAndroid Build Coastguard Worker 
3368*03ce13f7SAndroid Build Coastguard Worker #define If(cond)                                                          \
3369*03ce13f7SAndroid Build Coastguard Worker 	for(IfElseData ifElse__{ cond }; ifElse__ < IFELSE_NUM__; ++ifElse__) \
3370*03ce13f7SAndroid Build Coastguard Worker 		if(ifElse__ == IF_BLOCK__)
3371*03ce13f7SAndroid Build Coastguard Worker 
3372*03ce13f7SAndroid Build Coastguard Worker #define Else                           \
3373*03ce13f7SAndroid Build Coastguard Worker 	else if(ifElse__ == ELSE_CLAUSE__) \
3374*03ce13f7SAndroid Build Coastguard Worker 	{                                  \
3375*03ce13f7SAndroid Build Coastguard Worker 		ifElse__.elseClause();         \
3376*03ce13f7SAndroid Build Coastguard Worker 	}                                  \
3377*03ce13f7SAndroid Build Coastguard Worker 	else  // ELSE_BLOCK__
3378*03ce13f7SAndroid Build Coastguard Worker 
3379*03ce13f7SAndroid Build Coastguard Worker // The OFFSET macro is a generalization of the offsetof() macro defined in <cstddef>.
3380*03ce13f7SAndroid Build Coastguard Worker // It allows e.g. getting the offset of array elements, even when indexed dynamically.
3381*03ce13f7SAndroid Build Coastguard Worker // We cast the address '32' and subtract it again, because null-dereference is undefined behavior.
3382*03ce13f7SAndroid Build Coastguard Worker #define OFFSET(s, m) ((int)(size_t) & reinterpret_cast<const volatile char &>((((s *)32)->m)) - 32)
3383*03ce13f7SAndroid Build Coastguard Worker 
3384*03ce13f7SAndroid Build Coastguard Worker }  // namespace rr
3385*03ce13f7SAndroid Build Coastguard Worker 
3386*03ce13f7SAndroid Build Coastguard Worker #include "Traits.inl"
3387*03ce13f7SAndroid Build Coastguard Worker 
3388*03ce13f7SAndroid Build Coastguard Worker #endif  // rr_Reactor_hpp
3389