Home | History | Annotate | Download | only in Reactor
      1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //    http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 #ifndef rr_Reactor_hpp
     16 #define rr_Reactor_hpp
     17 
     18 #include "Nucleus.hpp"
     19 #include "Routine.hpp"
     20 
     21 #include <cassert>
     22 #include <cstddef>
     23 #include <cstdio>
     24 #undef Bool
     25 
     26 namespace rr
     27 {
     28 	class Bool;
     29 	class Byte;
     30 	class SByte;
     31 	class Byte4;
     32 	class SByte4;
     33 	class Byte8;
     34 	class SByte8;
     35 	class Byte16;
     36 	class SByte16;
     37 	class Short;
     38 	class UShort;
     39 	class Short2;
     40 	class UShort2;
     41 	class Short4;
     42 	class UShort4;
     43 	class Short8;
     44 	class UShort8;
     45 	class Int;
     46 	class UInt;
     47 	class Int2;
     48 	class UInt2;
     49 	class Int4;
     50 	class UInt4;
     51 	class Long;
     52 	class Half;
     53 	class Float;
     54 	class Float2;
     55 	class Float4;
     56 
     57 	class Void
     58 	{
     59 	public:
     60 		static Type *getType();
     61 
     62 		static bool isVoid()
     63 		{
     64 			return true;
     65 		}
     66 	};
     67 
     68 	template<class T>
     69 	class RValue;
     70 
     71 	template<class T>
     72 	class Pointer;
     73 
     74 	class Variable
     75 	{
     76 	protected:
     77 		Value *address;
     78 	};
     79 
     80 	template<class T>
     81 	class LValue : public Variable
     82 	{
     83 	public:
     84 		LValue(int arraySize = 0);
     85 
     86 		RValue<Pointer<T>> operator&();
     87 
     88 		static bool isVoid()
     89 		{
     90 			return false;
     91 		}
     92 
     93 		Value *loadValue() const;
     94 		Value *storeValue(Value *value) const;
     95 		Value *getAddress(Value *index, bool unsignedIndex) const;
     96 	};
     97 
     98 	template<class T>
     99 	class Reference
    100 	{
    101 	public:
    102 		explicit Reference(Value *pointer, int alignment = 1);
    103 
    104 		RValue<T> operator=(RValue<T> rhs) const;
    105 		RValue<T> operator=(const Reference<T> &ref) const;
    106 
    107 		RValue<T> operator+=(RValue<T> rhs) const;
    108 
    109 		Value *loadValue() const;
    110 		int getAlignment() const;
    111 
    112 	private:
    113 		Value *address;
    114 
    115 		const int alignment;
    116 	};
    117 
    118 	template<class T>
    119 	struct IntLiteral
    120 	{
    121 		struct type;
    122 	};
    123 
    124 	template<>
    125 	struct IntLiteral<Bool>
    126 	{
    127 		typedef bool type;
    128 	};
    129 
    130 	template<>
    131 	struct IntLiteral<Int>
    132 	{
    133 		typedef int type;
    134 	};
    135 
    136 	template<>
    137 	struct IntLiteral<UInt>
    138 	{
    139 		typedef unsigned int type;
    140 	};
    141 
    142 	template<>
    143 	struct IntLiteral<Long>
    144 	{
    145 		typedef int64_t type;
    146 	};
    147 
    148 	template<class T>
    149 	struct FloatLiteral
    150 	{
    151 		struct type;
    152 	};
    153 
    154 	template<>
    155 	struct FloatLiteral<Float>
    156 	{
    157 		typedef float type;
    158 	};
    159 
    160 	template<class T>
    161 	class RValue
    162 	{
    163 	public:
    164 		explicit RValue(Value *rvalue);
    165 
    166 		RValue(const T &lvalue);
    167 		RValue(typename IntLiteral<T>::type i);
    168 		RValue(typename FloatLiteral<T>::type f);
    169 		RValue(const Reference<T> &rhs);
    170 
    171 		RValue<T> &operator=(const RValue<T>&) = delete;
    172 
    173 		Value *value;   // FIXME: Make private
    174 	};
    175 
    176 	template<typename T>
    177 	struct Argument
    178 	{
    179 		explicit Argument(Value *value) : value(value) {}
    180 
    181 		Value *value;
    182 	};
    183 
    184 	class Bool : public LValue<Bool>
    185 	{
    186 	public:
    187 		Bool(Argument<Bool> argument);
    188 
    189 		Bool() = default;
    190 		Bool(bool x);
    191 		Bool(RValue<Bool> rhs);
    192 		Bool(const Bool &rhs);
    193 		Bool(const Reference<Bool> &rhs);
    194 
    195 	//	RValue<Bool> operator=(bool rhs);   // FIXME: Implement
    196 		RValue<Bool> operator=(RValue<Bool> rhs);
    197 		RValue<Bool> operator=(const Bool &rhs);
    198 		RValue<Bool> operator=(const Reference<Bool> &rhs);
    199 
    200 		static Type *getType();
    201 	};
    202 
    203 	RValue<Bool> operator!(RValue<Bool> val);
    204 	RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs);
    205 	RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs);
    206 
    207 	class Byte : public LValue<Byte>
    208 	{
    209 	public:
    210 		Byte(Argument<Byte> argument);
    211 
    212 		explicit Byte(RValue<Int> cast);
    213 		explicit Byte(RValue<UInt> cast);
    214 		explicit Byte(RValue<UShort> cast);
    215 
    216 		Byte() = default;
    217 		Byte(int x);
    218 		Byte(unsigned char x);
    219 		Byte(RValue<Byte> rhs);
    220 		Byte(const Byte &rhs);
    221 		Byte(const Reference<Byte> &rhs);
    222 
    223 	//	RValue<Byte> operator=(unsigned char rhs);   // FIXME: Implement
    224 		RValue<Byte> operator=(RValue<Byte> rhs);
    225 		RValue<Byte> operator=(const Byte &rhs);
    226 		RValue<Byte> operator=(const Reference<Byte> &rhs);
    227 
    228 		static Type *getType();
    229 	};
    230 
    231 	RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs);
    232 	RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs);
    233 	RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs);
    234 	RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs);
    235 	RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs);
    236 	RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs);
    237 	RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs);
    238 	RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs);
    239 	RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs);
    240 	RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs);
    241 	RValue<Byte> operator+=(Byte &lhs, RValue<Byte> rhs);
    242 	RValue<Byte> operator-=(Byte &lhs, RValue<Byte> rhs);
    243 	RValue<Byte> operator*=(Byte &lhs, RValue<Byte> rhs);
    244 	RValue<Byte> operator/=(Byte &lhs, RValue<Byte> rhs);
    245 	RValue<Byte> operator%=(Byte &lhs, RValue<Byte> rhs);
    246 	RValue<Byte> operator&=(Byte &lhs, RValue<Byte> rhs);
    247 	RValue<Byte> operator|=(Byte &lhs, RValue<Byte> rhs);
    248 	RValue<Byte> operator^=(Byte &lhs, RValue<Byte> rhs);
    249 	RValue<Byte> operator<<=(Byte &lhs, RValue<Byte> rhs);
    250 	RValue<Byte> operator>>=(Byte &lhs, RValue<Byte> rhs);
    251 	RValue<Byte> operator+(RValue<Byte> val);
    252 	RValue<Byte> operator-(RValue<Byte> val);
    253 	RValue<Byte> operator~(RValue<Byte> val);
    254 	RValue<Byte> operator++(Byte &val, int);   // Post-increment
    255 	const Byte &operator++(Byte &val);   // Pre-increment
    256 	RValue<Byte> operator--(Byte &val, int);   // Post-decrement
    257 	const Byte &operator--(Byte &val);   // Pre-decrement
    258 	RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs);
    259 	RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs);
    260 	RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs);
    261 	RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs);
    262 	RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs);
    263 	RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs);
    264 
    265 	class SByte : public LValue<SByte>
    266 	{
    267 	public:
    268 		SByte(Argument<SByte> argument);
    269 
    270 		explicit SByte(RValue<Int> cast);
    271 		explicit SByte(RValue<Short> cast);
    272 
    273 		SByte() = default;
    274 		SByte(signed char x);
    275 		SByte(RValue<SByte> rhs);
    276 		SByte(const SByte &rhs);
    277 		SByte(const Reference<SByte> &rhs);
    278 
    279 	//	RValue<SByte> operator=(signed char rhs);   // FIXME: Implement
    280 		RValue<SByte> operator=(RValue<SByte> rhs);
    281 		RValue<SByte> operator=(const SByte &rhs);
    282 		RValue<SByte> operator=(const Reference<SByte> &rhs);
    283 
    284 		static Type *getType();
    285 	};
    286 
    287 	RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs);
    288 	RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs);
    289 	RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs);
    290 	RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs);
    291 	RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs);
    292 	RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs);
    293 	RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs);
    294 	RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs);
    295 	RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs);
    296 	RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs);
    297 	RValue<SByte> operator+=(SByte &lhs, RValue<SByte> rhs);
    298 	RValue<SByte> operator-=(SByte &lhs, RValue<SByte> rhs);
    299 	RValue<SByte> operator*=(SByte &lhs, RValue<SByte> rhs);
    300 	RValue<SByte> operator/=(SByte &lhs, RValue<SByte> rhs);
    301 	RValue<SByte> operator%=(SByte &lhs, RValue<SByte> rhs);
    302 	RValue<SByte> operator&=(SByte &lhs, RValue<SByte> rhs);
    303 	RValue<SByte> operator|=(SByte &lhs, RValue<SByte> rhs);
    304 	RValue<SByte> operator^=(SByte &lhs, RValue<SByte> rhs);
    305 	RValue<SByte> operator<<=(SByte &lhs, RValue<SByte> rhs);
    306 	RValue<SByte> operator>>=(SByte &lhs, RValue<SByte> rhs);
    307 	RValue<SByte> operator+(RValue<SByte> val);
    308 	RValue<SByte> operator-(RValue<SByte> val);
    309 	RValue<SByte> operator~(RValue<SByte> val);
    310 	RValue<SByte> operator++(SByte &val, int);   // Post-increment
    311 	const SByte &operator++(SByte &val);   // Pre-increment
    312 	RValue<SByte> operator--(SByte &val, int);   // Post-decrement
    313 	const SByte &operator--(SByte &val);   // Pre-decrement
    314 	RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs);
    315 	RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs);
    316 	RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs);
    317 	RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs);
    318 	RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs);
    319 	RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs);
    320 
    321 	class Short : public LValue<Short>
    322 	{
    323 	public:
    324 		Short(Argument<Short> argument);
    325 
    326 		explicit Short(RValue<Int> cast);
    327 
    328 		Short() = default;
    329 		Short(short x);
    330 		Short(RValue<Short> rhs);
    331 		Short(const Short &rhs);
    332 		Short(const Reference<Short> &rhs);
    333 
    334 	//	RValue<Short> operator=(short rhs);   // FIXME: Implement
    335 		RValue<Short> operator=(RValue<Short> rhs);
    336 		RValue<Short> operator=(const Short &rhs);
    337 		RValue<Short> operator=(const Reference<Short> &rhs);
    338 
    339 		static Type *getType();
    340 	};
    341 
    342 	RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs);
    343 	RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs);
    344 	RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs);
    345 	RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs);
    346 	RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs);
    347 	RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs);
    348 	RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs);
    349 	RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs);
    350 	RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs);
    351 	RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs);
    352 	RValue<Short> operator+=(Short &lhs, RValue<Short> rhs);
    353 	RValue<Short> operator-=(Short &lhs, RValue<Short> rhs);
    354 	RValue<Short> operator*=(Short &lhs, RValue<Short> rhs);
    355 	RValue<Short> operator/=(Short &lhs, RValue<Short> rhs);
    356 	RValue<Short> operator%=(Short &lhs, RValue<Short> rhs);
    357 	RValue<Short> operator&=(Short &lhs, RValue<Short> rhs);
    358 	RValue<Short> operator|=(Short &lhs, RValue<Short> rhs);
    359 	RValue<Short> operator^=(Short &lhs, RValue<Short> rhs);
    360 	RValue<Short> operator<<=(Short &lhs, RValue<Short> rhs);
    361 	RValue<Short> operator>>=(Short &lhs, RValue<Short> rhs);
    362 	RValue<Short> operator+(RValue<Short> val);
    363 	RValue<Short> operator-(RValue<Short> val);
    364 	RValue<Short> operator~(RValue<Short> val);
    365 	RValue<Short> operator++(Short &val, int);   // Post-increment
    366 	const Short &operator++(Short &val);   // Pre-increment
    367 	RValue<Short> operator--(Short &val, int);   // Post-decrement
    368 	const Short &operator--(Short &val);   // Pre-decrement
    369 	RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs);
    370 	RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs);
    371 	RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs);
    372 	RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs);
    373 	RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs);
    374 	RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs);
    375 
    376 	class UShort : public LValue<UShort>
    377 	{
    378 	public:
    379 		UShort(Argument<UShort> argument);
    380 
    381 		explicit UShort(RValue<UInt> cast);
    382 		explicit UShort(RValue<Int> cast);
    383 
    384 		UShort() = default;
    385 		UShort(unsigned short x);
    386 		UShort(RValue<UShort> rhs);
    387 		UShort(const UShort &rhs);
    388 		UShort(const Reference<UShort> &rhs);
    389 
    390 	//	RValue<UShort> operator=(unsigned short rhs);   // FIXME: Implement
    391 		RValue<UShort> operator=(RValue<UShort> rhs);
    392 		RValue<UShort> operator=(const UShort &rhs);
    393 		RValue<UShort> operator=(const Reference<UShort> &rhs);
    394 
    395 		static Type *getType();
    396 	};
    397 
    398 	RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs);
    399 	RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs);
    400 	RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs);
    401 	RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs);
    402 	RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs);
    403 	RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs);
    404 	RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs);
    405 	RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs);
    406 	RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs);
    407 	RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs);
    408 	RValue<UShort> operator+=(UShort &lhs, RValue<UShort> rhs);
    409 	RValue<UShort> operator-=(UShort &lhs, RValue<UShort> rhs);
    410 	RValue<UShort> operator*=(UShort &lhs, RValue<UShort> rhs);
    411 	RValue<UShort> operator/=(UShort &lhs, RValue<UShort> rhs);
    412 	RValue<UShort> operator%=(UShort &lhs, RValue<UShort> rhs);
    413 	RValue<UShort> operator&=(UShort &lhs, RValue<UShort> rhs);
    414 	RValue<UShort> operator|=(UShort &lhs, RValue<UShort> rhs);
    415 	RValue<UShort> operator^=(UShort &lhs, RValue<UShort> rhs);
    416 	RValue<UShort> operator<<=(UShort &lhs, RValue<UShort> rhs);
    417 	RValue<UShort> operator>>=(UShort &lhs, RValue<UShort> rhs);
    418 	RValue<UShort> operator+(RValue<UShort> val);
    419 	RValue<UShort> operator-(RValue<UShort> val);
    420 	RValue<UShort> operator~(RValue<UShort> val);
    421 	RValue<UShort> operator++(UShort &val, int);   // Post-increment
    422 	const UShort &operator++(UShort &val);   // Pre-increment
    423 	RValue<UShort> operator--(UShort &val, int);   // Post-decrement
    424 	const UShort &operator--(UShort &val);   // Pre-decrement
    425 	RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs);
    426 	RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs);
    427 	RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs);
    428 	RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs);
    429 	RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs);
    430 	RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs);
    431 
    432 	class Byte4 : public LValue<Byte4>
    433 	{
    434 	public:
    435 		explicit Byte4(RValue<Byte8> cast);
    436 
    437 		Byte4() = default;
    438 	//	Byte4(int x, int y, int z, int w);
    439 	//	Byte4(RValue<Byte4> rhs);
    440 	//	Byte4(const Byte4 &rhs);
    441 		Byte4(const Reference<Byte4> &rhs);
    442 
    443 	//	RValue<Byte4> operator=(RValue<Byte4> rhs);
    444 	//	RValue<Byte4> operator=(const Byte4 &rhs);
    445 	//	RValue<Byte4> operator=(const Reference<Byte4> &rhs);
    446 
    447 		static Type *getType();
    448 	};
    449 
    450 //	RValue<Byte4> operator+(RValue<Byte4> lhs, RValue<Byte4> rhs);
    451 //	RValue<Byte4> operator-(RValue<Byte4> lhs, RValue<Byte4> rhs);
    452 //	RValue<Byte4> operator*(RValue<Byte4> lhs, RValue<Byte4> rhs);
    453 //	RValue<Byte4> operator/(RValue<Byte4> lhs, RValue<Byte4> rhs);
    454 //	RValue<Byte4> operator%(RValue<Byte4> lhs, RValue<Byte4> rhs);
    455 //	RValue<Byte4> operator&(RValue<Byte4> lhs, RValue<Byte4> rhs);
    456 //	RValue<Byte4> operator|(RValue<Byte4> lhs, RValue<Byte4> rhs);
    457 //	RValue<Byte4> operator^(RValue<Byte4> lhs, RValue<Byte4> rhs);
    458 //	RValue<Byte4> operator<<(RValue<Byte4> lhs, RValue<Byte4> rhs);
    459 //	RValue<Byte4> operator>>(RValue<Byte4> lhs, RValue<Byte4> rhs);
    460 //	RValue<Byte4> operator+=(Byte4 &lhs, RValue<Byte4> rhs);
    461 //	RValue<Byte4> operator-=(Byte4 &lhs, RValue<Byte4> rhs);
    462 //	RValue<Byte4> operator*=(Byte4 &lhs, RValue<Byte4> rhs);
    463 //	RValue<Byte4> operator/=(Byte4 &lhs, RValue<Byte4> rhs);
    464 //	RValue<Byte4> operator%=(Byte4 &lhs, RValue<Byte4> rhs);
    465 //	RValue<Byte4> operator&=(Byte4 &lhs, RValue<Byte4> rhs);
    466 //	RValue<Byte4> operator|=(Byte4 &lhs, RValue<Byte4> rhs);
    467 //	RValue<Byte4> operator^=(Byte4 &lhs, RValue<Byte4> rhs);
    468 //	RValue<Byte4> operator<<=(Byte4 &lhs, RValue<Byte4> rhs);
    469 //	RValue<Byte4> operator>>=(Byte4 &lhs, RValue<Byte4> rhs);
    470 //	RValue<Byte4> operator+(RValue<Byte4> val);
    471 //	RValue<Byte4> operator-(RValue<Byte4> val);
    472 //	RValue<Byte4> operator~(RValue<Byte4> val);
    473 //	RValue<Byte4> operator++(Byte4 &val, int);   // Post-increment
    474 //	const Byte4 &operator++(Byte4 &val);   // Pre-increment
    475 //	RValue<Byte4> operator--(Byte4 &val, int);   // Post-decrement
    476 //	const Byte4 &operator--(Byte4 &val);   // Pre-decrement
    477 
    478 	class SByte4 : public LValue<SByte4>
    479 	{
    480 	public:
    481 		SByte4() = default;
    482 	//	SByte4(int x, int y, int z, int w);
    483 	//	SByte4(RValue<SByte4> rhs);
    484 	//	SByte4(const SByte4 &rhs);
    485 	//	SByte4(const Reference<SByte4> &rhs);
    486 
    487 	//	RValue<SByte4> operator=(RValue<SByte4> rhs);
    488 	//	RValue<SByte4> operator=(const SByte4 &rhs);
    489 	//	RValue<SByte4> operator=(const Reference<SByte4> &rhs);
    490 
    491 		static Type *getType();
    492 	};
    493 
    494 //	RValue<SByte4> operator+(RValue<SByte4> lhs, RValue<SByte4> rhs);
    495 //	RValue<SByte4> operator-(RValue<SByte4> lhs, RValue<SByte4> rhs);
    496 //	RValue<SByte4> operator*(RValue<SByte4> lhs, RValue<SByte4> rhs);
    497 //	RValue<SByte4> operator/(RValue<SByte4> lhs, RValue<SByte4> rhs);
    498 //	RValue<SByte4> operator%(RValue<SByte4> lhs, RValue<SByte4> rhs);
    499 //	RValue<SByte4> operator&(RValue<SByte4> lhs, RValue<SByte4> rhs);
    500 //	RValue<SByte4> operator|(RValue<SByte4> lhs, RValue<SByte4> rhs);
    501 //	RValue<SByte4> operator^(RValue<SByte4> lhs, RValue<SByte4> rhs);
    502 //	RValue<SByte4> operator<<(RValue<SByte4> lhs, RValue<SByte4> rhs);
    503 //	RValue<SByte4> operator>>(RValue<SByte4> lhs, RValue<SByte4> rhs);
    504 //	RValue<SByte4> operator+=(SByte4 &lhs, RValue<SByte4> rhs);
    505 //	RValue<SByte4> operator-=(SByte4 &lhs, RValue<SByte4> rhs);
    506 //	RValue<SByte4> operator*=(SByte4 &lhs, RValue<SByte4> rhs);
    507 //	RValue<SByte4> operator/=(SByte4 &lhs, RValue<SByte4> rhs);
    508 //	RValue<SByte4> operator%=(SByte4 &lhs, RValue<SByte4> rhs);
    509 //	RValue<SByte4> operator&=(SByte4 &lhs, RValue<SByte4> rhs);
    510 //	RValue<SByte4> operator|=(SByte4 &lhs, RValue<SByte4> rhs);
    511 //	RValue<SByte4> operator^=(SByte4 &lhs, RValue<SByte4> rhs);
    512 //	RValue<SByte4> operator<<=(SByte4 &lhs, RValue<SByte4> rhs);
    513 //	RValue<SByte4> operator>>=(SByte4 &lhs, RValue<SByte4> rhs);
    514 //	RValue<SByte4> operator+(RValue<SByte4> val);
    515 //	RValue<SByte4> operator-(RValue<SByte4> val);
    516 //	RValue<SByte4> operator~(RValue<SByte4> val);
    517 //	RValue<SByte4> operator++(SByte4 &val, int);   // Post-increment
    518 //	const SByte4 &operator++(SByte4 &val);   // Pre-increment
    519 //	RValue<SByte4> operator--(SByte4 &val, int);   // Post-decrement
    520 //	const SByte4 &operator--(SByte4 &val);   // Pre-decrement
    521 
    522 	class Byte8 : public LValue<Byte8>
    523 	{
    524 	public:
    525 		Byte8() = default;
    526 		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);
    527 		Byte8(RValue<Byte8> rhs);
    528 		Byte8(const Byte8 &rhs);
    529 		Byte8(const Reference<Byte8> &rhs);
    530 
    531 		RValue<Byte8> operator=(RValue<Byte8> rhs);
    532 		RValue<Byte8> operator=(const Byte8 &rhs);
    533 		RValue<Byte8> operator=(const Reference<Byte8> &rhs);
    534 
    535 		static Type *getType();
    536 	};
    537 
    538 	RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs);
    539 	RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs);
    540 //	RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs);
    541 //	RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs);
    542 //	RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs);
    543 	RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs);
    544 	RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs);
    545 	RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs);
    546 //	RValue<Byte8> operator<<(RValue<Byte8> lhs, RValue<Byte8> rhs);
    547 //	RValue<Byte8> operator>>(RValue<Byte8> lhs, RValue<Byte8> rhs);
    548 	RValue<Byte8> operator+=(Byte8 &lhs, RValue<Byte8> rhs);
    549 	RValue<Byte8> operator-=(Byte8 &lhs, RValue<Byte8> rhs);
    550 //	RValue<Byte8> operator*=(Byte8 &lhs, RValue<Byte8> rhs);
    551 //	RValue<Byte8> operator/=(Byte8 &lhs, RValue<Byte8> rhs);
    552 //	RValue<Byte8> operator%=(Byte8 &lhs, RValue<Byte8> rhs);
    553 	RValue<Byte8> operator&=(Byte8 &lhs, RValue<Byte8> rhs);
    554 	RValue<Byte8> operator|=(Byte8 &lhs, RValue<Byte8> rhs);
    555 	RValue<Byte8> operator^=(Byte8 &lhs, RValue<Byte8> rhs);
    556 //	RValue<Byte8> operator<<=(Byte8 &lhs, RValue<Byte8> rhs);
    557 //	RValue<Byte8> operator>>=(Byte8 &lhs, RValue<Byte8> rhs);
    558 //	RValue<Byte8> operator+(RValue<Byte8> val);
    559 //	RValue<Byte8> operator-(RValue<Byte8> val);
    560 	RValue<Byte8> operator~(RValue<Byte8> val);
    561 //	RValue<Byte8> operator++(Byte8 &val, int);   // Post-increment
    562 //	const Byte8 &operator++(Byte8 &val);   // Pre-increment
    563 //	RValue<Byte8> operator--(Byte8 &val, int);   // Post-decrement
    564 //	const Byte8 &operator--(Byte8 &val);   // Pre-decrement
    565 
    566 	RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y);
    567 	RValue<Byte8> SubSat(RValue<Byte8> x, RValue<Byte8> y);
    568 	RValue<Short4> Unpack(RValue<Byte4> x);
    569 	RValue<Short4> Unpack(RValue<Byte4> x, RValue<Byte4> y);
    570 	RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y);
    571 	RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y);
    572 	RValue<Int> SignMask(RValue<Byte8> x);
    573 //	RValue<Byte8> CmpGT(RValue<Byte8> x, RValue<Byte8> y);
    574 	RValue<Byte8> CmpEQ(RValue<Byte8> x, RValue<Byte8> y);
    575 
    576 	class SByte8 : public LValue<SByte8>
    577 	{
    578 	public:
    579 		SByte8() = default;
    580 		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);
    581 		SByte8(RValue<SByte8> rhs);
    582 		SByte8(const SByte8 &rhs);
    583 		SByte8(const Reference<SByte8> &rhs);
    584 
    585 		RValue<SByte8> operator=(RValue<SByte8> rhs);
    586 		RValue<SByte8> operator=(const SByte8 &rhs);
    587 		RValue<SByte8> operator=(const Reference<SByte8> &rhs);
    588 
    589 		static Type *getType();
    590 	};
    591 
    592 	RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs);
    593 	RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs);
    594 //	RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs);
    595 //	RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs);
    596 //	RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs);
    597 	RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs);
    598 	RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs);
    599 	RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs);
    600 //	RValue<SByte8> operator<<(RValue<SByte8> lhs, RValue<SByte8> rhs);
    601 //	RValue<SByte8> operator>>(RValue<SByte8> lhs, RValue<SByte8> rhs);
    602 	RValue<SByte8> operator+=(SByte8 &lhs, RValue<SByte8> rhs);
    603 	RValue<SByte8> operator-=(SByte8 &lhs, RValue<SByte8> rhs);
    604 //	RValue<SByte8> operator*=(SByte8 &lhs, RValue<SByte8> rhs);
    605 //	RValue<SByte8> operator/=(SByte8 &lhs, RValue<SByte8> rhs);
    606 //	RValue<SByte8> operator%=(SByte8 &lhs, RValue<SByte8> rhs);
    607 	RValue<SByte8> operator&=(SByte8 &lhs, RValue<SByte8> rhs);
    608 	RValue<SByte8> operator|=(SByte8 &lhs, RValue<SByte8> rhs);
    609 	RValue<SByte8> operator^=(SByte8 &lhs, RValue<SByte8> rhs);
    610 //	RValue<SByte8> operator<<=(SByte8 &lhs, RValue<SByte8> rhs);
    611 //	RValue<SByte8> operator>>=(SByte8 &lhs, RValue<SByte8> rhs);
    612 //	RValue<SByte8> operator+(RValue<SByte8> val);
    613 //	RValue<SByte8> operator-(RValue<SByte8> val);
    614 	RValue<SByte8> operator~(RValue<SByte8> val);
    615 //	RValue<SByte8> operator++(SByte8 &val, int);   // Post-increment
    616 //	const SByte8 &operator++(SByte8 &val);   // Pre-increment
    617 //	RValue<SByte8> operator--(SByte8 &val, int);   // Post-decrement
    618 //	const SByte8 &operator--(SByte8 &val);   // Pre-decrement
    619 
    620 	RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y);
    621 	RValue<SByte8> SubSat(RValue<SByte8> x, RValue<SByte8> y);
    622 	RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y);
    623 	RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y);
    624 	RValue<Int> SignMask(RValue<SByte8> x);
    625 	RValue<Byte8> CmpGT(RValue<SByte8> x, RValue<SByte8> y);
    626 	RValue<Byte8> CmpEQ(RValue<SByte8> x, RValue<SByte8> y);
    627 
    628 	class Byte16 : public LValue<Byte16>
    629 	{
    630 	public:
    631 		Byte16() = default;
    632 	//	Byte16(int x, int y, int z, int w);
    633 		Byte16(RValue<Byte16> rhs);
    634 		Byte16(const Byte16 &rhs);
    635 		Byte16(const Reference<Byte16> &rhs);
    636 
    637 		RValue<Byte16> operator=(RValue<Byte16> rhs);
    638 		RValue<Byte16> operator=(const Byte16 &rhs);
    639 		RValue<Byte16> operator=(const Reference<Byte16> &rhs);
    640 
    641 		static Type *getType();
    642 	};
    643 
    644 //	RValue<Byte16> operator+(RValue<Byte16> lhs, RValue<Byte16> rhs);
    645 //	RValue<Byte16> operator-(RValue<Byte16> lhs, RValue<Byte16> rhs);
    646 //	RValue<Byte16> operator*(RValue<Byte16> lhs, RValue<Byte16> rhs);
    647 //	RValue<Byte16> operator/(RValue<Byte16> lhs, RValue<Byte16> rhs);
    648 //	RValue<Byte16> operator%(RValue<Byte16> lhs, RValue<Byte16> rhs);
    649 //	RValue<Byte16> operator&(RValue<Byte16> lhs, RValue<Byte16> rhs);
    650 //	RValue<Byte16> operator|(RValue<Byte16> lhs, RValue<Byte16> rhs);
    651 //	RValue<Byte16> operator^(RValue<Byte16> lhs, RValue<Byte16> rhs);
    652 //	RValue<Byte16> operator<<(RValue<Byte16> lhs, RValue<Byte16> rhs);
    653 //	RValue<Byte16> operator>>(RValue<Byte16> lhs, RValue<Byte16> rhs);
    654 //	RValue<Byte16> operator+=(Byte16 &lhs, RValue<Byte16> rhs);
    655 //	RValue<Byte16> operator-=(Byte16 &lhs, RValue<Byte16> rhs);
    656 //	RValue<Byte16> operator*=(Byte16 &lhs, RValue<Byte16> rhs);
    657 //	RValue<Byte16> operator/=(Byte16 &lhs, RValue<Byte16> rhs);
    658 //	RValue<Byte16> operator%=(Byte16 &lhs, RValue<Byte16> rhs);
    659 //	RValue<Byte16> operator&=(Byte16 &lhs, RValue<Byte16> rhs);
    660 //	RValue<Byte16> operator|=(Byte16 &lhs, RValue<Byte16> rhs);
    661 //	RValue<Byte16> operator^=(Byte16 &lhs, RValue<Byte16> rhs);
    662 //	RValue<Byte16> operator<<=(Byte16 &lhs, RValue<Byte16> rhs);
    663 //	RValue<Byte16> operator>>=(Byte16 &lhs, RValue<Byte16> rhs);
    664 //	RValue<Byte16> operator+(RValue<Byte16> val);
    665 //	RValue<Byte16> operator-(RValue<Byte16> val);
    666 //	RValue<Byte16> operator~(RValue<Byte16> val);
    667 //	RValue<Byte16> operator++(Byte16 &val, int);   // Post-increment
    668 //	const Byte16 &operator++(Byte16 &val);   // Pre-increment
    669 //	RValue<Byte16> operator--(Byte16 &val, int);   // Post-decrement
    670 //	const Byte16 &operator--(Byte16 &val);   // Pre-decrement
    671 
    672 	class SByte16 : public LValue<SByte16>
    673 	{
    674 	public:
    675 		SByte16() = default;
    676 	//	SByte16(int x, int y, int z, int w);
    677 	//	SByte16(RValue<SByte16> rhs);
    678 	//	SByte16(const SByte16 &rhs);
    679 	//	SByte16(const Reference<SByte16> &rhs);
    680 
    681 	//	RValue<SByte16> operator=(RValue<SByte16> rhs);
    682 	//	RValue<SByte16> operator=(const SByte16 &rhs);
    683 	//	RValue<SByte16> operator=(const Reference<SByte16> &rhs);
    684 
    685 		static Type *getType();
    686 	};
    687 
    688 //	RValue<SByte16> operator+(RValue<SByte16> lhs, RValue<SByte16> rhs);
    689 //	RValue<SByte16> operator-(RValue<SByte16> lhs, RValue<SByte16> rhs);
    690 //	RValue<SByte16> operator*(RValue<SByte16> lhs, RValue<SByte16> rhs);
    691 //	RValue<SByte16> operator/(RValue<SByte16> lhs, RValue<SByte16> rhs);
    692 //	RValue<SByte16> operator%(RValue<SByte16> lhs, RValue<SByte16> rhs);
    693 //	RValue<SByte16> operator&(RValue<SByte16> lhs, RValue<SByte16> rhs);
    694 //	RValue<SByte16> operator|(RValue<SByte16> lhs, RValue<SByte16> rhs);
    695 //	RValue<SByte16> operator^(RValue<SByte16> lhs, RValue<SByte16> rhs);
    696 //	RValue<SByte16> operator<<(RValue<SByte16> lhs, RValue<SByte16> rhs);
    697 //	RValue<SByte16> operator>>(RValue<SByte16> lhs, RValue<SByte16> rhs);
    698 //	RValue<SByte16> operator+=(SByte16 &lhs, RValue<SByte16> rhs);
    699 //	RValue<SByte16> operator-=(SByte16 &lhs, RValue<SByte16> rhs);
    700 //	RValue<SByte16> operator*=(SByte16 &lhs, RValue<SByte16> rhs);
    701 //	RValue<SByte16> operator/=(SByte16 &lhs, RValue<SByte16> rhs);
    702 //	RValue<SByte16> operator%=(SByte16 &lhs, RValue<SByte16> rhs);
    703 //	RValue<SByte16> operator&=(SByte16 &lhs, RValue<SByte16> rhs);
    704 //	RValue<SByte16> operator|=(SByte16 &lhs, RValue<SByte16> rhs);
    705 //	RValue<SByte16> operator^=(SByte16 &lhs, RValue<SByte16> rhs);
    706 //	RValue<SByte16> operator<<=(SByte16 &lhs, RValue<SByte16> rhs);
    707 //	RValue<SByte16> operator>>=(SByte16 &lhs, RValue<SByte16> rhs);
    708 //	RValue<SByte16> operator+(RValue<SByte16> val);
    709 //	RValue<SByte16> operator-(RValue<SByte16> val);
    710 //	RValue<SByte16> operator~(RValue<SByte16> val);
    711 //	RValue<SByte16> operator++(SByte16 &val, int);   // Post-increment
    712 //	const SByte16 &operator++(SByte16 &val);   // Pre-increment
    713 //	RValue<SByte16> operator--(SByte16 &val, int);   // Post-decrement
    714 //	const SByte16 &operator--(SByte16 &val);   // Pre-decrement
    715 
    716 	class Short2 : public LValue<Short2>
    717 	{
    718 	public:
    719 		explicit Short2(RValue<Short4> cast);
    720 
    721 		static Type *getType();
    722 	};
    723 
    724 	class UShort2 : public LValue<UShort2>
    725 	{
    726 	public:
    727 		explicit UShort2(RValue<UShort4> cast);
    728 
    729 		static Type *getType();
    730 	};
    731 
    732 	class Short4 : public LValue<Short4>
    733 	{
    734 	public:
    735 		explicit Short4(RValue<Int> cast);
    736 		explicit Short4(RValue<Int4> cast);
    737 	//	explicit Short4(RValue<Float> cast);
    738 		explicit Short4(RValue<Float4> cast);
    739 
    740 		Short4() = default;
    741 		Short4(short xyzw);
    742 		Short4(short x, short y, short z, short w);
    743 		Short4(RValue<Short4> rhs);
    744 		Short4(const Short4 &rhs);
    745 		Short4(const Reference<Short4> &rhs);
    746 		Short4(RValue<UShort4> rhs);
    747 		Short4(const UShort4 &rhs);
    748 		Short4(const Reference<UShort4> &rhs);
    749 
    750 		RValue<Short4> operator=(RValue<Short4> rhs);
    751 		RValue<Short4> operator=(const Short4 &rhs);
    752 		RValue<Short4> operator=(const Reference<Short4> &rhs);
    753 		RValue<Short4> operator=(RValue<UShort4> rhs);
    754 		RValue<Short4> operator=(const UShort4 &rhs);
    755 		RValue<Short4> operator=(const Reference<UShort4> &rhs);
    756 
    757 		static Type *getType();
    758 	};
    759 
    760 	RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs);
    761 	RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs);
    762 	RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs);
    763 //	RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs);
    764 //	RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs);
    765 	RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs);
    766 	RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs);
    767 	RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs);
    768 	RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs);
    769 	RValue<Short4> operator>>(RValue<Short4> lhs, unsigned char rhs);
    770 	RValue<Short4> operator+=(Short4 &lhs, RValue<Short4> rhs);
    771 	RValue<Short4> operator-=(Short4 &lhs, RValue<Short4> rhs);
    772 	RValue<Short4> operator*=(Short4 &lhs, RValue<Short4> rhs);
    773 //	RValue<Short4> operator/=(Short4 &lhs, RValue<Short4> rhs);
    774 //	RValue<Short4> operator%=(Short4 &lhs, RValue<Short4> rhs);
    775 	RValue<Short4> operator&=(Short4 &lhs, RValue<Short4> rhs);
    776 	RValue<Short4> operator|=(Short4 &lhs, RValue<Short4> rhs);
    777 	RValue<Short4> operator^=(Short4 &lhs, RValue<Short4> rhs);
    778 	RValue<Short4> operator<<=(Short4 &lhs, unsigned char rhs);
    779 	RValue<Short4> operator>>=(Short4 &lhs, unsigned char rhs);
    780 //	RValue<Short4> operator+(RValue<Short4> val);
    781 	RValue<Short4> operator-(RValue<Short4> val);
    782 	RValue<Short4> operator~(RValue<Short4> val);
    783 //	RValue<Short4> operator++(Short4 &val, int);   // Post-increment
    784 //	const Short4 &operator++(Short4 &val);   // Pre-increment
    785 //	RValue<Short4> operator--(Short4 &val, int);   // Post-decrement
    786 //	const Short4 &operator--(Short4 &val);   // Pre-decrement
    787 //	RValue<Bool> operator<(RValue<Short4> lhs, RValue<Short4> rhs);
    788 //	RValue<Bool> operator<=(RValue<Short4> lhs, RValue<Short4> rhs);
    789 //	RValue<Bool> operator>(RValue<Short4> lhs, RValue<Short4> rhs);
    790 //	RValue<Bool> operator>=(RValue<Short4> lhs, RValue<Short4> rhs);
    791 //	RValue<Bool> operator!=(RValue<Short4> lhs, RValue<Short4> rhs);
    792 //	RValue<Bool> operator==(RValue<Short4> lhs, RValue<Short4> rhs);
    793 
    794 	RValue<Short4> RoundShort4(RValue<Float4> cast);
    795 	RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y);
    796 	RValue<Short4> Min(RValue<Short4> x, RValue<Short4> y);
    797 	RValue<Short4> AddSat(RValue<Short4> x, RValue<Short4> y);
    798 	RValue<Short4> SubSat(RValue<Short4> x, RValue<Short4> y);
    799 	RValue<Short4> MulHigh(RValue<Short4> x, RValue<Short4> y);
    800 	RValue<Int2> MulAdd(RValue<Short4> x, RValue<Short4> y);
    801 	RValue<SByte8> PackSigned(RValue<Short4> x, RValue<Short4> y);
    802 	RValue<Byte8> PackUnsigned(RValue<Short4> x, RValue<Short4> y);
    803 	RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y);
    804 	RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y);
    805 	RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select);
    806 	RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i);
    807 	RValue<Short> Extract(RValue<Short4> val, int i);
    808 	RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y);
    809 	RValue<Short4> CmpEQ(RValue<Short4> x, RValue<Short4> y);
    810 
    811 	class UShort4 : public LValue<UShort4>
    812 	{
    813 	public:
    814 		explicit UShort4(RValue<Int4> cast);
    815 		explicit UShort4(RValue<Float4> cast, bool saturate = false);
    816 
    817 		UShort4() = default;
    818 		UShort4(unsigned short xyzw);
    819 		UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w);
    820 		UShort4(RValue<UShort4> rhs);
    821 		UShort4(const UShort4 &rhs);
    822 		UShort4(const Reference<UShort4> &rhs);
    823 		UShort4(RValue<Short4> rhs);
    824 		UShort4(const Short4 &rhs);
    825 		UShort4(const Reference<Short4> &rhs);
    826 
    827 		RValue<UShort4> operator=(RValue<UShort4> rhs);
    828 		RValue<UShort4> operator=(const UShort4 &rhs);
    829 		RValue<UShort4> operator=(const Reference<UShort4> &rhs);
    830 		RValue<UShort4> operator=(RValue<Short4> rhs);
    831 		RValue<UShort4> operator=(const Short4 &rhs);
    832 		RValue<UShort4> operator=(const Reference<Short4> &rhs);
    833 
    834 		static Type *getType();
    835 	};
    836 
    837 	RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs);
    838 	RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs);
    839 	RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs);
    840 //	RValue<UShort4> operator/(RValue<UShort4> lhs, RValue<UShort4> rhs);
    841 //	RValue<UShort4> operator%(RValue<UShort4> lhs, RValue<UShort4> rhs);
    842 	RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs);
    843 	RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs);
    844 	RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs);
    845 	RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs);
    846 	RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs);
    847 //	RValue<UShort4> operator+=(UShort4 &lhs, RValue<UShort4> rhs);
    848 //	RValue<UShort4> operator-=(UShort4 &lhs, RValue<UShort4> rhs);
    849 //	RValue<UShort4> operator*=(UShort4 &lhs, RValue<UShort4> rhs);
    850 //	RValue<UShort4> operator/=(UShort4 &lhs, RValue<UShort4> rhs);
    851 //	RValue<UShort4> operator%=(UShort4 &lhs, RValue<UShort4> rhs);
    852 //	RValue<UShort4> operator&=(UShort4 &lhs, RValue<UShort4> rhs);
    853 //	RValue<UShort4> operator|=(UShort4 &lhs, RValue<UShort4> rhs);
    854 //	RValue<UShort4> operator^=(UShort4 &lhs, RValue<UShort4> rhs);
    855 	RValue<UShort4> operator<<=(UShort4 &lhs, unsigned char rhs);
    856 	RValue<UShort4> operator>>=(UShort4 &lhs, unsigned char rhs);
    857 //	RValue<UShort4> operator+(RValue<UShort4> val);
    858 //	RValue<UShort4> operator-(RValue<UShort4> val);
    859 	RValue<UShort4> operator~(RValue<UShort4> val);
    860 //	RValue<UShort4> operator++(UShort4 &val, int);   // Post-increment
    861 //	const UShort4 &operator++(UShort4 &val);   // Pre-increment
    862 //	RValue<UShort4> operator--(UShort4 &val, int);   // Post-decrement
    863 //	const UShort4 &operator--(UShort4 &val);   // Pre-decrement
    864 
    865 	RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y);
    866 	RValue<UShort4> Min(RValue<UShort4> x, RValue<UShort4> y);
    867 	RValue<UShort4> AddSat(RValue<UShort4> x, RValue<UShort4> y);
    868 	RValue<UShort4> SubSat(RValue<UShort4> x, RValue<UShort4> y);
    869 	RValue<UShort4> MulHigh(RValue<UShort4> x, RValue<UShort4> y);
    870 	RValue<UShort4> Average(RValue<UShort4> x, RValue<UShort4> y);
    871 
    872 	class Short8 : public LValue<Short8>
    873 	{
    874 	public:
    875 		Short8() = default;
    876 		Short8(short c);
    877 		Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7);
    878 		Short8(RValue<Short8> rhs);
    879 	//	Short8(const Short8 &rhs);
    880 		Short8(const Reference<Short8> &rhs);
    881 		Short8(RValue<Short4> lo, RValue<Short4> hi);
    882 
    883 	//	RValue<Short8> operator=(RValue<Short8> rhs);
    884 	//	RValue<Short8> operator=(const Short8 &rhs);
    885 	//	RValue<Short8> operator=(const Reference<Short8> &rhs);
    886 
    887 		static Type *getType();
    888 	};
    889 
    890 	RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs);
    891 //	RValue<Short8> operator-(RValue<Short8> lhs, RValue<Short8> rhs);
    892 //	RValue<Short8> operator*(RValue<Short8> lhs, RValue<Short8> rhs);
    893 //	RValue<Short8> operator/(RValue<Short8> lhs, RValue<Short8> rhs);
    894 //	RValue<Short8> operator%(RValue<Short8> lhs, RValue<Short8> rhs);
    895 	RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs);
    896 //	RValue<Short8> operator|(RValue<Short8> lhs, RValue<Short8> rhs);
    897 //	RValue<Short8> operator^(RValue<Short8> lhs, RValue<Short8> rhs);
    898 	RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs);
    899 	RValue<Short8> operator>>(RValue<Short8> lhs, unsigned char rhs);
    900 //	RValue<Short8> operator<<(RValue<Short8> lhs, RValue<Short8> rhs);
    901 //	RValue<Short8> operator>>(RValue<Short8> lhs, RValue<Short8> rhs);
    902 //	RValue<Short8> operator+=(Short8 &lhs, RValue<Short8> rhs);
    903 //	RValue<Short8> operator-=(Short8 &lhs, RValue<Short8> rhs);
    904 //	RValue<Short8> operator*=(Short8 &lhs, RValue<Short8> rhs);
    905 //	RValue<Short8> operator/=(Short8 &lhs, RValue<Short8> rhs);
    906 //	RValue<Short8> operator%=(Short8 &lhs, RValue<Short8> rhs);
    907 //	RValue<Short8> operator&=(Short8 &lhs, RValue<Short8> rhs);
    908 //	RValue<Short8> operator|=(Short8 &lhs, RValue<Short8> rhs);
    909 //	RValue<Short8> operator^=(Short8 &lhs, RValue<Short8> rhs);
    910 //	RValue<Short8> operator<<=(Short8 &lhs, RValue<Short8> rhs);
    911 //	RValue<Short8> operator>>=(Short8 &lhs, RValue<Short8> rhs);
    912 //	RValue<Short8> operator+(RValue<Short8> val);
    913 //	RValue<Short8> operator-(RValue<Short8> val);
    914 //	RValue<Short8> operator~(RValue<Short8> val);
    915 //	RValue<Short8> operator++(Short8 &val, int);   // Post-increment
    916 //	const Short8 &operator++(Short8 &val);   // Pre-increment
    917 //	RValue<Short8> operator--(Short8 &val, int);   // Post-decrement
    918 //	const Short8 &operator--(Short8 &val);   // Pre-decrement
    919 //	RValue<Bool> operator<(RValue<Short8> lhs, RValue<Short8> rhs);
    920 //	RValue<Bool> operator<=(RValue<Short8> lhs, RValue<Short8> rhs);
    921 //	RValue<Bool> operator>(RValue<Short8> lhs, RValue<Short8> rhs);
    922 //	RValue<Bool> operator>=(RValue<Short8> lhs, RValue<Short8> rhs);
    923 //	RValue<Bool> operator!=(RValue<Short8> lhs, RValue<Short8> rhs);
    924 //	RValue<Bool> operator==(RValue<Short8> lhs, RValue<Short8> rhs);
    925 
    926 	RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y);
    927 	RValue<Int4> MulAdd(RValue<Short8> x, RValue<Short8> y);
    928 	RValue<Int4> Abs(RValue<Int4> x);
    929 
    930 	class UShort8 : public LValue<UShort8>
    931 	{
    932 	public:
    933 		UShort8() = default;
    934 		UShort8(unsigned short c);
    935 		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);
    936 		UShort8(RValue<UShort8> rhs);
    937 	//	UShort8(const UShort8 &rhs);
    938 		UShort8(const Reference<UShort8> &rhs);
    939 		UShort8(RValue<UShort4> lo, RValue<UShort4> hi);
    940 
    941 		RValue<UShort8> operator=(RValue<UShort8> rhs);
    942 		RValue<UShort8> operator=(const UShort8 &rhs);
    943 		RValue<UShort8> operator=(const Reference<UShort8> &rhs);
    944 
    945 		static Type *getType();
    946 	};
    947 
    948 	RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs);
    949 //	RValue<UShort8> operator-(RValue<UShort8> lhs, RValue<UShort8> rhs);
    950 	RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs);
    951 //	RValue<UShort8> operator/(RValue<UShort8> lhs, RValue<UShort8> rhs);
    952 //	RValue<UShort8> operator%(RValue<UShort8> lhs, RValue<UShort8> rhs);
    953 	RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs);
    954 //	RValue<UShort8> operator|(RValue<UShort8> lhs, RValue<UShort8> rhs);
    955 //	RValue<UShort8> operator^(RValue<UShort8> lhs, RValue<UShort8> rhs);
    956 	RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs);
    957 	RValue<UShort8> operator>>(RValue<UShort8> lhs, unsigned char rhs);
    958 //	RValue<UShort8> operator<<(RValue<UShort8> lhs, RValue<UShort8> rhs);
    959 //	RValue<UShort8> operator>>(RValue<UShort8> lhs, RValue<UShort8> rhs);
    960 	RValue<UShort8> operator+=(UShort8 &lhs, RValue<UShort8> rhs);
    961 //	RValue<UShort8> operator-=(UShort8 &lhs, RValue<UShort8> rhs);
    962 //	RValue<UShort8> operator*=(UShort8 &lhs, RValue<UShort8> rhs);
    963 //	RValue<UShort8> operator/=(UShort8 &lhs, RValue<UShort8> rhs);
    964 //	RValue<UShort8> operator%=(UShort8 &lhs, RValue<UShort8> rhs);
    965 //	RValue<UShort8> operator&=(UShort8 &lhs, RValue<UShort8> rhs);
    966 //	RValue<UShort8> operator|=(UShort8 &lhs, RValue<UShort8> rhs);
    967 //	RValue<UShort8> operator^=(UShort8 &lhs, RValue<UShort8> rhs);
    968 //	RValue<UShort8> operator<<=(UShort8 &lhs, RValue<UShort8> rhs);
    969 //	RValue<UShort8> operator>>=(UShort8 &lhs, RValue<UShort8> rhs);
    970 //	RValue<UShort8> operator+(RValue<UShort8> val);
    971 //	RValue<UShort8> operator-(RValue<UShort8> val);
    972 	RValue<UShort8> operator~(RValue<UShort8> val);
    973 //	RValue<UShort8> operator++(UShort8 &val, int);   // Post-increment
    974 //	const UShort8 &operator++(UShort8 &val);   // Pre-increment
    975 //	RValue<UShort8> operator--(UShort8 &val, int);   // Post-decrement
    976 //	const UShort8 &operator--(UShort8 &val);   // Pre-decrement
    977 //	RValue<Bool> operator<(RValue<UShort8> lhs, RValue<UShort8> rhs);
    978 //	RValue<Bool> operator<=(RValue<UShort8> lhs, RValue<UShort8> rhs);
    979 //	RValue<Bool> operator>(RValue<UShort8> lhs, RValue<UShort8> rhs);
    980 //	RValue<Bool> operator>=(RValue<UShort8> lhs, RValue<UShort8> rhs);
    981 //	RValue<Bool> operator!=(RValue<UShort8> lhs, RValue<UShort8> rhs);
    982 //	RValue<Bool> operator==(RValue<UShort8> lhs, RValue<UShort8> rhs);
    983 
    984 	RValue<UShort8> Swizzle(RValue<UShort8> x, char select0, char select1, char select2, char select3, char select4, char select5, char select6, char select7);
    985 	RValue<UShort8> MulHigh(RValue<UShort8> x, RValue<UShort8> y);
    986 
    987 	class Int : public LValue<Int>
    988 	{
    989 	public:
    990 		Int(Argument<Int> argument);
    991 
    992 		explicit Int(RValue<Byte> cast);
    993 		explicit Int(RValue<SByte> cast);
    994 		explicit Int(RValue<Short> cast);
    995 		explicit Int(RValue<UShort> cast);
    996 		explicit Int(RValue<Int2> cast);
    997 		explicit Int(RValue<Long> cast);
    998 		explicit Int(RValue<Float> cast);
    999 
   1000 		Int() = default;
   1001 		Int(int x);
   1002 		Int(RValue<Int> rhs);
   1003 		Int(RValue<UInt> rhs);
   1004 		Int(const Int &rhs);
   1005 		Int(const UInt &rhs);
   1006 		Int(const Reference<Int> &rhs);
   1007 		Int(const Reference<UInt> &rhs);
   1008 
   1009 		RValue<Int> operator=(int rhs);
   1010 		RValue<Int> operator=(RValue<Int> rhs);
   1011 		RValue<Int> operator=(RValue<UInt> rhs);
   1012 		RValue<Int> operator=(const Int &rhs);
   1013 		RValue<Int> operator=(const UInt &rhs);
   1014 		RValue<Int> operator=(const Reference<Int> &rhs);
   1015 		RValue<Int> operator=(const Reference<UInt> &rhs);
   1016 
   1017 		static Type *getType();
   1018 	};
   1019 
   1020 	RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs);
   1021 	RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs);
   1022 	RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs);
   1023 	RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs);
   1024 	RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs);
   1025 	RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs);
   1026 	RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs);
   1027 	RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs);
   1028 	RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs);
   1029 	RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs);
   1030 	RValue<Int> operator+=(Int &lhs, RValue<Int> rhs);
   1031 	RValue<Int> operator-=(Int &lhs, RValue<Int> rhs);
   1032 	RValue<Int> operator*=(Int &lhs, RValue<Int> rhs);
   1033 	RValue<Int> operator/=(Int &lhs, RValue<Int> rhs);
   1034 	RValue<Int> operator%=(Int &lhs, RValue<Int> rhs);
   1035 	RValue<Int> operator&=(Int &lhs, RValue<Int> rhs);
   1036 	RValue<Int> operator|=(Int &lhs, RValue<Int> rhs);
   1037 	RValue<Int> operator^=(Int &lhs, RValue<Int> rhs);
   1038 	RValue<Int> operator<<=(Int &lhs, RValue<Int> rhs);
   1039 	RValue<Int> operator>>=(Int &lhs, RValue<Int> rhs);
   1040 	RValue<Int> operator+(RValue<Int> val);
   1041 	RValue<Int> operator-(RValue<Int> val);
   1042 	RValue<Int> operator~(RValue<Int> val);
   1043 	RValue<Int> operator++(Int &val, int);   // Post-increment
   1044 	const Int &operator++(Int &val);   // Pre-increment
   1045 	RValue<Int> operator--(Int &val, int);   // Post-decrement
   1046 	const Int &operator--(Int &val);   // Pre-decrement
   1047 	RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs);
   1048 	RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs);
   1049 	RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs);
   1050 	RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs);
   1051 	RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs);
   1052 	RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs);
   1053 
   1054 	RValue<Int> Max(RValue<Int> x, RValue<Int> y);
   1055 	RValue<Int> Min(RValue<Int> x, RValue<Int> y);
   1056 	RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max);
   1057 	RValue<Int> RoundInt(RValue<Float> cast);
   1058 
   1059 	class Long : public LValue<Long>
   1060 	{
   1061 	public:
   1062 	//	Long(Argument<Long> argument);
   1063 
   1064 	//	explicit Long(RValue<Short> cast);
   1065 	//	explicit Long(RValue<UShort> cast);
   1066 		explicit Long(RValue<Int> cast);
   1067 		explicit Long(RValue<UInt> cast);
   1068 	//	explicit Long(RValue<Float> cast);
   1069 
   1070 		Long() = default;
   1071 	//	Long(qword x);
   1072 		Long(RValue<Long> rhs);
   1073 	//	Long(RValue<ULong> rhs);
   1074 	//	Long(const Long &rhs);
   1075 	//	Long(const Reference<Long> &rhs);
   1076 	//	Long(const ULong &rhs);
   1077 	//	Long(const Reference<ULong> &rhs);
   1078 
   1079 		RValue<Long> operator=(int64_t rhs);
   1080 		RValue<Long> operator=(RValue<Long> rhs);
   1081 	//	RValue<Long> operator=(RValue<ULong> rhs);
   1082 		RValue<Long> operator=(const Long &rhs);
   1083 		RValue<Long> operator=(const Reference<Long> &rhs);
   1084 	//	RValue<Long> operator=(const ULong &rhs);
   1085 	//	RValue<Long> operator=(const Reference<ULong> &rhs);
   1086 
   1087 		static Type *getType();
   1088 	};
   1089 
   1090 	RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs);
   1091 	RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs);
   1092 //	RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs);
   1093 //	RValue<Long> operator/(RValue<Long> lhs, RValue<Long> rhs);
   1094 //	RValue<Long> operator%(RValue<Long> lhs, RValue<Long> rhs);
   1095 //	RValue<Long> operator&(RValue<Long> lhs, RValue<Long> rhs);
   1096 //	RValue<Long> operator|(RValue<Long> lhs, RValue<Long> rhs);
   1097 //	RValue<Long> operator^(RValue<Long> lhs, RValue<Long> rhs);
   1098 //	RValue<Long> operator<<(RValue<Long> lhs, RValue<Long> rhs);
   1099 //	RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs);
   1100 	RValue<Long> operator+=(Long &lhs, RValue<Long> rhs);
   1101 	RValue<Long> operator-=(Long &lhs, RValue<Long> rhs);
   1102 //	RValue<Long> operator*=(Long &lhs, RValue<Long> rhs);
   1103 //	RValue<Long> operator/=(Long &lhs, RValue<Long> rhs);
   1104 //	RValue<Long> operator%=(Long &lhs, RValue<Long> rhs);
   1105 //	RValue<Long> operator&=(Long &lhs, RValue<Long> rhs);
   1106 //	RValue<Long> operator|=(Long &lhs, RValue<Long> rhs);
   1107 //	RValue<Long> operator^=(Long &lhs, RValue<Long> rhs);
   1108 //	RValue<Long> operator<<=(Long &lhs, RValue<Long> rhs);
   1109 //	RValue<Long> operator>>=(Long &lhs, RValue<Long> rhs);
   1110 //	RValue<Long> operator+(RValue<Long> val);
   1111 //	RValue<Long> operator-(RValue<Long> val);
   1112 //	RValue<Long> operator~(RValue<Long> val);
   1113 //	RValue<Long> operator++(Long &val, int);   // Post-increment
   1114 //	const Long &operator++(Long &val);   // Pre-increment
   1115 //	RValue<Long> operator--(Long &val, int);   // Post-decrement
   1116 //	const Long &operator--(Long &val);   // Pre-decrement
   1117 //	RValue<Bool> operator<(RValue<Long> lhs, RValue<Long> rhs);
   1118 //	RValue<Bool> operator<=(RValue<Long> lhs, RValue<Long> rhs);
   1119 //	RValue<Bool> operator>(RValue<Long> lhs, RValue<Long> rhs);
   1120 //	RValue<Bool> operator>=(RValue<Long> lhs, RValue<Long> rhs);
   1121 //	RValue<Bool> operator!=(RValue<Long> lhs, RValue<Long> rhs);
   1122 //	RValue<Bool> operator==(RValue<Long> lhs, RValue<Long> rhs);
   1123 
   1124 //	RValue<Long> RoundLong(RValue<Float> cast);
   1125 	RValue<Long> AddAtomic( RValue<Pointer<Long>> x, RValue<Long> y);
   1126 
   1127 	class UInt : public LValue<UInt>
   1128 	{
   1129 	public:
   1130 		UInt(Argument<UInt> argument);
   1131 
   1132 		explicit UInt(RValue<UShort> cast);
   1133 		explicit UInt(RValue<Long> cast);
   1134 		explicit UInt(RValue<Float> cast);
   1135 
   1136 		UInt() = default;
   1137 		UInt(int x);
   1138 		UInt(unsigned int x);
   1139 		UInt(RValue<UInt> rhs);
   1140 		UInt(RValue<Int> rhs);
   1141 		UInt(const UInt &rhs);
   1142 		UInt(const Int &rhs);
   1143 		UInt(const Reference<UInt> &rhs);
   1144 		UInt(const Reference<Int> &rhs);
   1145 
   1146 		RValue<UInt> operator=(unsigned int rhs);
   1147 		RValue<UInt> operator=(RValue<UInt> rhs);
   1148 		RValue<UInt> operator=(RValue<Int> rhs);
   1149 		RValue<UInt> operator=(const UInt &rhs);
   1150 		RValue<UInt> operator=(const Int &rhs);
   1151 		RValue<UInt> operator=(const Reference<UInt> &rhs);
   1152 		RValue<UInt> operator=(const Reference<Int> &rhs);
   1153 
   1154 		static Type *getType();
   1155 	};
   1156 
   1157 	RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs);
   1158 	RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs);
   1159 	RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs);
   1160 	RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs);
   1161 	RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs);
   1162 	RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs);
   1163 	RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs);
   1164 	RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs);
   1165 	RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs);
   1166 	RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs);
   1167 	RValue<UInt> operator+=(UInt &lhs, RValue<UInt> rhs);
   1168 	RValue<UInt> operator-=(UInt &lhs, RValue<UInt> rhs);
   1169 	RValue<UInt> operator*=(UInt &lhs, RValue<UInt> rhs);
   1170 	RValue<UInt> operator/=(UInt &lhs, RValue<UInt> rhs);
   1171 	RValue<UInt> operator%=(UInt &lhs, RValue<UInt> rhs);
   1172 	RValue<UInt> operator&=(UInt &lhs, RValue<UInt> rhs);
   1173 	RValue<UInt> operator|=(UInt &lhs, RValue<UInt> rhs);
   1174 	RValue<UInt> operator^=(UInt &lhs, RValue<UInt> rhs);
   1175 	RValue<UInt> operator<<=(UInt &lhs, RValue<UInt> rhs);
   1176 	RValue<UInt> operator>>=(UInt &lhs, RValue<UInt> rhs);
   1177 	RValue<UInt> operator+(RValue<UInt> val);
   1178 	RValue<UInt> operator-(RValue<UInt> val);
   1179 	RValue<UInt> operator~(RValue<UInt> val);
   1180 	RValue<UInt> operator++(UInt &val, int);   // Post-increment
   1181 	const UInt &operator++(UInt &val);   // Pre-increment
   1182 	RValue<UInt> operator--(UInt &val, int);   // Post-decrement
   1183 	const UInt &operator--(UInt &val);   // Pre-decrement
   1184 	RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs);
   1185 	RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs);
   1186 	RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs);
   1187 	RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs);
   1188 	RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs);
   1189 	RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs);
   1190 
   1191 	RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y);
   1192 	RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y);
   1193 	RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max);
   1194 //	RValue<UInt> RoundUInt(RValue<Float> cast);
   1195 
   1196 	class Int2 : public LValue<Int2>
   1197 	{
   1198 	public:
   1199 	//	explicit Int2(RValue<Int> cast);
   1200 		explicit Int2(RValue<Int4> cast);
   1201 
   1202 		Int2() = default;
   1203 		Int2(int x, int y);
   1204 		Int2(RValue<Int2> rhs);
   1205 		Int2(const Int2 &rhs);
   1206 		Int2(const Reference<Int2> &rhs);
   1207 		Int2(RValue<Int> lo, RValue<Int> hi);
   1208 
   1209 		RValue<Int2> operator=(RValue<Int2> rhs);
   1210 		RValue<Int2> operator=(const Int2 &rhs);
   1211 		RValue<Int2> operator=(const Reference<Int2> &rhs);
   1212 
   1213 		static Type *getType();
   1214 	};
   1215 
   1216 	RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs);
   1217 	RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs);
   1218 //	RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs);
   1219 //	RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs);
   1220 //	RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs);
   1221 	RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs);
   1222 	RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs);
   1223 	RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs);
   1224 	RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs);
   1225 	RValue<Int2> operator>>(RValue<Int2> lhs, unsigned char rhs);
   1226 	RValue<Int2> operator+=(Int2 &lhs, RValue<Int2> rhs);
   1227 	RValue<Int2> operator-=(Int2 &lhs, RValue<Int2> rhs);
   1228 //	RValue<Int2> operator*=(Int2 &lhs, RValue<Int2> rhs);
   1229 //	RValue<Int2> operator/=(Int2 &lhs, RValue<Int2> rhs);
   1230 //	RValue<Int2> operator%=(Int2 &lhs, RValue<Int2> rhs);
   1231 	RValue<Int2> operator&=(Int2 &lhs, RValue<Int2> rhs);
   1232 	RValue<Int2> operator|=(Int2 &lhs, RValue<Int2> rhs);
   1233 	RValue<Int2> operator^=(Int2 &lhs, RValue<Int2> rhs);
   1234 	RValue<Int2> operator<<=(Int2 &lhs, unsigned char rhs);
   1235 	RValue<Int2> operator>>=(Int2 &lhs, unsigned char rhs);
   1236 //	RValue<Int2> operator+(RValue<Int2> val);
   1237 //	RValue<Int2> operator-(RValue<Int2> val);
   1238 	RValue<Int2> operator~(RValue<Int2> val);
   1239 //	RValue<Int2> operator++(Int2 &val, int);   // Post-increment
   1240 //	const Int2 &operator++(Int2 &val);   // Pre-increment
   1241 //	RValue<Int2> operator--(Int2 &val, int);   // Post-decrement
   1242 //	const Int2 &operator--(Int2 &val);   // Pre-decrement
   1243 //	RValue<Bool> operator<(RValue<Int2> lhs, RValue<Int2> rhs);
   1244 //	RValue<Bool> operator<=(RValue<Int2> lhs, RValue<Int2> rhs);
   1245 //	RValue<Bool> operator>(RValue<Int2> lhs, RValue<Int2> rhs);
   1246 //	RValue<Bool> operator>=(RValue<Int2> lhs, RValue<Int2> rhs);
   1247 //	RValue<Bool> operator!=(RValue<Int2> lhs, RValue<Int2> rhs);
   1248 //	RValue<Bool> operator==(RValue<Int2> lhs, RValue<Int2> rhs);
   1249 
   1250 //	RValue<Int2> RoundInt(RValue<Float4> cast);
   1251 	RValue<Short4> UnpackLow(RValue<Int2> x, RValue<Int2> y);
   1252 	RValue<Short4> UnpackHigh(RValue<Int2> x, RValue<Int2> y);
   1253 	RValue<Int> Extract(RValue<Int2> val, int i);
   1254 	RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i);
   1255 
   1256 	class UInt2 : public LValue<UInt2>
   1257 	{
   1258 	public:
   1259 		UInt2() = default;
   1260 		UInt2(unsigned int x, unsigned int y);
   1261 		UInt2(RValue<UInt2> rhs);
   1262 		UInt2(const UInt2 &rhs);
   1263 		UInt2(const Reference<UInt2> &rhs);
   1264 
   1265 		RValue<UInt2> operator=(RValue<UInt2> rhs);
   1266 		RValue<UInt2> operator=(const UInt2 &rhs);
   1267 		RValue<UInt2> operator=(const Reference<UInt2> &rhs);
   1268 
   1269 		static Type *getType();
   1270 	};
   1271 
   1272 	RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1273 	RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1274 //	RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1275 //	RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1276 //	RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1277 	RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1278 	RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1279 	RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1280 	RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs);
   1281 	RValue<UInt2> operator>>(RValue<UInt2> lhs, unsigned char rhs);
   1282 	RValue<UInt2> operator+=(UInt2 &lhs, RValue<UInt2> rhs);
   1283 	RValue<UInt2> operator-=(UInt2 &lhs, RValue<UInt2> rhs);
   1284 //	RValue<UInt2> operator*=(UInt2 &lhs, RValue<UInt2> rhs);
   1285 //	RValue<UInt2> operator/=(UInt2 &lhs, RValue<UInt2> rhs);
   1286 //	RValue<UInt2> operator%=(UInt2 &lhs, RValue<UInt2> rhs);
   1287 	RValue<UInt2> operator&=(UInt2 &lhs, RValue<UInt2> rhs);
   1288 	RValue<UInt2> operator|=(UInt2 &lhs, RValue<UInt2> rhs);
   1289 	RValue<UInt2> operator^=(UInt2 &lhs, RValue<UInt2> rhs);
   1290 	RValue<UInt2> operator<<=(UInt2 &lhs, unsigned char rhs);
   1291 	RValue<UInt2> operator>>=(UInt2 &lhs, unsigned char rhs);
   1292 //	RValue<UInt2> operator+(RValue<UInt2> val);
   1293 //	RValue<UInt2> operator-(RValue<UInt2> val);
   1294 	RValue<UInt2> operator~(RValue<UInt2> val);
   1295 //	RValue<UInt2> operator++(UInt2 &val, int);   // Post-increment
   1296 //	const UInt2 &operator++(UInt2 &val);   // Pre-increment
   1297 //	RValue<UInt2> operator--(UInt2 &val, int);   // Post-decrement
   1298 //	const UInt2 &operator--(UInt2 &val);   // Pre-decrement
   1299 //	RValue<Bool> operator<(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1300 //	RValue<Bool> operator<=(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1301 //	RValue<Bool> operator>(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1302 //	RValue<Bool> operator>=(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1303 //	RValue<Bool> operator!=(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1304 //	RValue<Bool> operator==(RValue<UInt2> lhs, RValue<UInt2> rhs);
   1305 
   1306 //	RValue<UInt2> RoundInt(RValue<Float4> cast);
   1307 
   1308 	template<class T>
   1309 	struct Scalar;
   1310 
   1311 	template<class Vector4>
   1312 	struct XYZW;
   1313 
   1314 	template<class Vector4, int T>
   1315 	class Swizzle2
   1316 	{
   1317 		friend Vector4;
   1318 
   1319 	public:
   1320 		operator RValue<Vector4>() const;
   1321 
   1322 	private:
   1323 		Vector4 *parent;
   1324 	};
   1325 
   1326 	template<class Vector4, int T>
   1327 	class Swizzle4
   1328 	{
   1329 	public:
   1330 		operator RValue<Vector4>() const;
   1331 
   1332 	private:
   1333 		Vector4 *parent;
   1334 	};
   1335 
   1336 	template<class Vector4, int T>
   1337 	class SwizzleMask4
   1338 	{
   1339 		friend XYZW<Vector4>;
   1340 
   1341 	public:
   1342 		operator RValue<Vector4>() const;
   1343 
   1344 		RValue<Vector4> operator=(RValue<Vector4> rhs);
   1345 		RValue<Vector4> operator=(RValue<typename Scalar<Vector4>::Type> rhs);
   1346 
   1347 	private:
   1348 		Vector4 *parent;
   1349 	};
   1350 
   1351 	template<>
   1352 	struct Scalar<Float4>
   1353 	{
   1354 		using Type = Float;
   1355 	};
   1356 
   1357 	template<>
   1358 	struct Scalar<Int4>
   1359 	{
   1360 		using Type = Int;
   1361 	};
   1362 
   1363 	template<>
   1364 	struct Scalar<UInt4>
   1365 	{
   1366 		using Type = UInt;
   1367 	};
   1368 
   1369 	template<class Vector4, int T>
   1370 	class SwizzleMask1
   1371 	{
   1372 	public:
   1373 		operator RValue<typename Scalar<Vector4>::Type>() const;
   1374 		operator RValue<Vector4>() const;
   1375 
   1376 		RValue<Vector4> operator=(float x);
   1377 		RValue<Vector4> operator=(RValue<Vector4> rhs);
   1378 		RValue<Vector4> operator=(RValue<typename Scalar<Vector4>::Type> rhs);
   1379 
   1380 	private:
   1381 		Float4 *parent;
   1382 	};
   1383 
   1384 	template<class Vector4, int T>
   1385 	class SwizzleMask2
   1386 	{
   1387 		friend class Float4;
   1388 
   1389 	public:
   1390 		operator RValue<Vector4>() const;
   1391 
   1392 		RValue<Vector4> operator=(RValue<Vector4> rhs);
   1393 
   1394 	private:
   1395 		Float4 *parent;
   1396 	};
   1397 
   1398 	template<class Vector4>
   1399 	struct XYZW
   1400 	{
   1401 		friend Vector4;
   1402 
   1403 	private:
   1404 		XYZW(Vector4 *parent)
   1405 		{
   1406 			xyzw.parent = parent;
   1407 		}
   1408 
   1409 	public:
   1410 		union
   1411 		{
   1412 			SwizzleMask1<Vector4, 0x00> x;
   1413 			SwizzleMask1<Vector4, 0x55> y;
   1414 			SwizzleMask1<Vector4, 0xAA> z;
   1415 			SwizzleMask1<Vector4, 0xFF> w;
   1416 			Swizzle2<Vector4, 0x00>     xx;
   1417 			Swizzle2<Vector4, 0x01>     yx;
   1418 			Swizzle2<Vector4, 0x02>     zx;
   1419 			Swizzle2<Vector4, 0x03>     wx;
   1420 			SwizzleMask2<Vector4, 0x54> xy;
   1421 			Swizzle2<Vector4, 0x55>     yy;
   1422 			Swizzle2<Vector4, 0x56>     zy;
   1423 			Swizzle2<Vector4, 0x57>     wy;
   1424 			SwizzleMask2<Vector4, 0xA8> xz;
   1425 			SwizzleMask2<Vector4, 0xA9> yz;
   1426 			Swizzle2<Vector4, 0xAA>     zz;
   1427 			Swizzle2<Vector4, 0xAB>     wz;
   1428 			SwizzleMask2<Vector4, 0xFC> xw;
   1429 			SwizzleMask2<Vector4, 0xFD> yw;
   1430 			SwizzleMask2<Vector4, 0xFE> zw;
   1431 			Swizzle2<Vector4, 0xFF>     ww;
   1432 			Swizzle4<Vector4, 0x00>     xxx;
   1433 			Swizzle4<Vector4, 0x01>     yxx;
   1434 			Swizzle4<Vector4, 0x02>     zxx;
   1435 			Swizzle4<Vector4, 0x03>     wxx;
   1436 			Swizzle4<Vector4, 0x04>     xyx;
   1437 			Swizzle4<Vector4, 0x05>     yyx;
   1438 			Swizzle4<Vector4, 0x06>     zyx;
   1439 			Swizzle4<Vector4, 0x07>     wyx;
   1440 			Swizzle4<Vector4, 0x08>     xzx;
   1441 			Swizzle4<Vector4, 0x09>     yzx;
   1442 			Swizzle4<Vector4, 0x0A>     zzx;
   1443 			Swizzle4<Vector4, 0x0B>     wzx;
   1444 			Swizzle4<Vector4, 0x0C>     xwx;
   1445 			Swizzle4<Vector4, 0x0D>     ywx;
   1446 			Swizzle4<Vector4, 0x0E>     zwx;
   1447 			Swizzle4<Vector4, 0x0F>     wwx;
   1448 			Swizzle4<Vector4, 0x50>     xxy;
   1449 			Swizzle4<Vector4, 0x51>     yxy;
   1450 			Swizzle4<Vector4, 0x52>     zxy;
   1451 			Swizzle4<Vector4, 0x53>     wxy;
   1452 			Swizzle4<Vector4, 0x54>     xyy;
   1453 			Swizzle4<Vector4, 0x55>     yyy;
   1454 			Swizzle4<Vector4, 0x56>     zyy;
   1455 			Swizzle4<Vector4, 0x57>     wyy;
   1456 			Swizzle4<Vector4, 0x58>     xzy;
   1457 			Swizzle4<Vector4, 0x59>     yzy;
   1458 			Swizzle4<Vector4, 0x5A>     zzy;
   1459 			Swizzle4<Vector4, 0x5B>     wzy;
   1460 			Swizzle4<Vector4, 0x5C>     xwy;
   1461 			Swizzle4<Vector4, 0x5D>     ywy;
   1462 			Swizzle4<Vector4, 0x5E>     zwy;
   1463 			Swizzle4<Vector4, 0x5F>     wwy;
   1464 			Swizzle4<Vector4, 0xA0>     xxz;
   1465 			Swizzle4<Vector4, 0xA1>     yxz;
   1466 			Swizzle4<Vector4, 0xA2>     zxz;
   1467 			Swizzle4<Vector4, 0xA3>     wxz;
   1468 			SwizzleMask4<Vector4, 0xA4> xyz;
   1469 			Swizzle4<Vector4, 0xA5>     yyz;
   1470 			Swizzle4<Vector4, 0xA6>     zyz;
   1471 			Swizzle4<Vector4, 0xA7>     wyz;
   1472 			Swizzle4<Vector4, 0xA8>     xzz;
   1473 			Swizzle4<Vector4, 0xA9>     yzz;
   1474 			Swizzle4<Vector4, 0xAA>     zzz;
   1475 			Swizzle4<Vector4, 0xAB>     wzz;
   1476 			Swizzle4<Vector4, 0xAC>     xwz;
   1477 			Swizzle4<Vector4, 0xAD>     ywz;
   1478 			Swizzle4<Vector4, 0xAE>     zwz;
   1479 			Swizzle4<Vector4, 0xAF>     wwz;
   1480 			Swizzle4<Vector4, 0xF0>     xxw;
   1481 			Swizzle4<Vector4, 0xF1>     yxw;
   1482 			Swizzle4<Vector4, 0xF2>     zxw;
   1483 			Swizzle4<Vector4, 0xF3>     wxw;
   1484 			SwizzleMask4<Vector4, 0xF4> xyw;
   1485 			Swizzle4<Vector4, 0xF5>     yyw;
   1486 			Swizzle4<Vector4, 0xF6>     zyw;
   1487 			Swizzle4<Vector4, 0xF7>     wyw;
   1488 			SwizzleMask4<Vector4, 0xF8> xzw;
   1489 			SwizzleMask4<Vector4, 0xF9> yzw;
   1490 			Swizzle4<Vector4, 0xFA>     zzw;
   1491 			Swizzle4<Vector4, 0xFB>     wzw;
   1492 			Swizzle4<Vector4, 0xFC>     xww;
   1493 			Swizzle4<Vector4, 0xFD>     yww;
   1494 			Swizzle4<Vector4, 0xFE>     zww;
   1495 			Swizzle4<Vector4, 0xFF>     www;
   1496 			Swizzle4<Vector4, 0x00>     xxxx;
   1497 			Swizzle4<Vector4, 0x01>     yxxx;
   1498 			Swizzle4<Vector4, 0x02>     zxxx;
   1499 			Swizzle4<Vector4, 0x03>     wxxx;
   1500 			Swizzle4<Vector4, 0x04>     xyxx;
   1501 			Swizzle4<Vector4, 0x05>     yyxx;
   1502 			Swizzle4<Vector4, 0x06>     zyxx;
   1503 			Swizzle4<Vector4, 0x07>     wyxx;
   1504 			Swizzle4<Vector4, 0x08>     xzxx;
   1505 			Swizzle4<Vector4, 0x09>     yzxx;
   1506 			Swizzle4<Vector4, 0x0A>     zzxx;
   1507 			Swizzle4<Vector4, 0x0B>     wzxx;
   1508 			Swizzle4<Vector4, 0x0C>     xwxx;
   1509 			Swizzle4<Vector4, 0x0D>     ywxx;
   1510 			Swizzle4<Vector4, 0x0E>     zwxx;
   1511 			Swizzle4<Vector4, 0x0F>     wwxx;
   1512 			Swizzle4<Vector4, 0x10>     xxyx;
   1513 			Swizzle4<Vector4, 0x11>     yxyx;
   1514 			Swizzle4<Vector4, 0x12>     zxyx;
   1515 			Swizzle4<Vector4, 0x13>     wxyx;
   1516 			Swizzle4<Vector4, 0x14>     xyyx;
   1517 			Swizzle4<Vector4, 0x15>     yyyx;
   1518 			Swizzle4<Vector4, 0x16>     zyyx;
   1519 			Swizzle4<Vector4, 0x17>     wyyx;
   1520 			Swizzle4<Vector4, 0x18>     xzyx;
   1521 			Swizzle4<Vector4, 0x19>     yzyx;
   1522 			Swizzle4<Vector4, 0x1A>     zzyx;
   1523 			Swizzle4<Vector4, 0x1B>     wzyx;
   1524 			Swizzle4<Vector4, 0x1C>     xwyx;
   1525 			Swizzle4<Vector4, 0x1D>     ywyx;
   1526 			Swizzle4<Vector4, 0x1E>     zwyx;
   1527 			Swizzle4<Vector4, 0x1F>     wwyx;
   1528 			Swizzle4<Vector4, 0x20>     xxzx;
   1529 			Swizzle4<Vector4, 0x21>     yxzx;
   1530 			Swizzle4<Vector4, 0x22>     zxzx;
   1531 			Swizzle4<Vector4, 0x23>     wxzx;
   1532 			Swizzle4<Vector4, 0x24>     xyzx;
   1533 			Swizzle4<Vector4, 0x25>     yyzx;
   1534 			Swizzle4<Vector4, 0x26>     zyzx;
   1535 			Swizzle4<Vector4, 0x27>     wyzx;
   1536 			Swizzle4<Vector4, 0x28>     xzzx;
   1537 			Swizzle4<Vector4, 0x29>     yzzx;
   1538 			Swizzle4<Vector4, 0x2A>     zzzx;
   1539 			Swizzle4<Vector4, 0x2B>     wzzx;
   1540 			Swizzle4<Vector4, 0x2C>     xwzx;
   1541 			Swizzle4<Vector4, 0x2D>     ywzx;
   1542 			Swizzle4<Vector4, 0x2E>     zwzx;
   1543 			Swizzle4<Vector4, 0x2F>     wwzx;
   1544 			Swizzle4<Vector4, 0x30>     xxwx;
   1545 			Swizzle4<Vector4, 0x31>     yxwx;
   1546 			Swizzle4<Vector4, 0x32>     zxwx;
   1547 			Swizzle4<Vector4, 0x33>     wxwx;
   1548 			Swizzle4<Vector4, 0x34>     xywx;
   1549 			Swizzle4<Vector4, 0x35>     yywx;
   1550 			Swizzle4<Vector4, 0x36>     zywx;
   1551 			Swizzle4<Vector4, 0x37>     wywx;
   1552 			Swizzle4<Vector4, 0x38>     xzwx;
   1553 			Swizzle4<Vector4, 0x39>     yzwx;
   1554 			Swizzle4<Vector4, 0x3A>     zzwx;
   1555 			Swizzle4<Vector4, 0x3B>     wzwx;
   1556 			Swizzle4<Vector4, 0x3C>     xwwx;
   1557 			Swizzle4<Vector4, 0x3D>     ywwx;
   1558 			Swizzle4<Vector4, 0x3E>     zwwx;
   1559 			Swizzle4<Vector4, 0x3F>     wwwx;
   1560 			Swizzle4<Vector4, 0x40>     xxxy;
   1561 			Swizzle4<Vector4, 0x41>     yxxy;
   1562 			Swizzle4<Vector4, 0x42>     zxxy;
   1563 			Swizzle4<Vector4, 0x43>     wxxy;
   1564 			Swizzle4<Vector4, 0x44>     xyxy;
   1565 			Swizzle4<Vector4, 0x45>     yyxy;
   1566 			Swizzle4<Vector4, 0x46>     zyxy;
   1567 			Swizzle4<Vector4, 0x47>     wyxy;
   1568 			Swizzle4<Vector4, 0x48>     xzxy;
   1569 			Swizzle4<Vector4, 0x49>     yzxy;
   1570 			Swizzle4<Vector4, 0x4A>     zzxy;
   1571 			Swizzle4<Vector4, 0x4B>     wzxy;
   1572 			Swizzle4<Vector4, 0x4C>     xwxy;
   1573 			Swizzle4<Vector4, 0x4D>     ywxy;
   1574 			Swizzle4<Vector4, 0x4E>     zwxy;
   1575 			Swizzle4<Vector4, 0x4F>     wwxy;
   1576 			Swizzle4<Vector4, 0x50>     xxyy;
   1577 			Swizzle4<Vector4, 0x51>     yxyy;
   1578 			Swizzle4<Vector4, 0x52>     zxyy;
   1579 			Swizzle4<Vector4, 0x53>     wxyy;
   1580 			Swizzle4<Vector4, 0x54>     xyyy;
   1581 			Swizzle4<Vector4, 0x55>     yyyy;
   1582 			Swizzle4<Vector4, 0x56>     zyyy;
   1583 			Swizzle4<Vector4, 0x57>     wyyy;
   1584 			Swizzle4<Vector4, 0x58>     xzyy;
   1585 			Swizzle4<Vector4, 0x59>     yzyy;
   1586 			Swizzle4<Vector4, 0x5A>     zzyy;
   1587 			Swizzle4<Vector4, 0x5B>     wzyy;
   1588 			Swizzle4<Vector4, 0x5C>     xwyy;
   1589 			Swizzle4<Vector4, 0x5D>     ywyy;
   1590 			Swizzle4<Vector4, 0x5E>     zwyy;
   1591 			Swizzle4<Vector4, 0x5F>     wwyy;
   1592 			Swizzle4<Vector4, 0x60>     xxzy;
   1593 			Swizzle4<Vector4, 0x61>     yxzy;
   1594 			Swizzle4<Vector4, 0x62>     zxzy;
   1595 			Swizzle4<Vector4, 0x63>     wxzy;
   1596 			Swizzle4<Vector4, 0x64>     xyzy;
   1597 			Swizzle4<Vector4, 0x65>     yyzy;
   1598 			Swizzle4<Vector4, 0x66>     zyzy;
   1599 			Swizzle4<Vector4, 0x67>     wyzy;
   1600 			Swizzle4<Vector4, 0x68>     xzzy;
   1601 			Swizzle4<Vector4, 0x69>     yzzy;
   1602 			Swizzle4<Vector4, 0x6A>     zzzy;
   1603 			Swizzle4<Vector4, 0x6B>     wzzy;
   1604 			Swizzle4<Vector4, 0x6C>     xwzy;
   1605 			Swizzle4<Vector4, 0x6D>     ywzy;
   1606 			Swizzle4<Vector4, 0x6E>     zwzy;
   1607 			Swizzle4<Vector4, 0x6F>     wwzy;
   1608 			Swizzle4<Vector4, 0x70>     xxwy;
   1609 			Swizzle4<Vector4, 0x71>     yxwy;
   1610 			Swizzle4<Vector4, 0x72>     zxwy;
   1611 			Swizzle4<Vector4, 0x73>     wxwy;
   1612 			Swizzle4<Vector4, 0x74>     xywy;
   1613 			Swizzle4<Vector4, 0x75>     yywy;
   1614 			Swizzle4<Vector4, 0x76>     zywy;
   1615 			Swizzle4<Vector4, 0x77>     wywy;
   1616 			Swizzle4<Vector4, 0x78>     xzwy;
   1617 			Swizzle4<Vector4, 0x79>     yzwy;
   1618 			Swizzle4<Vector4, 0x7A>     zzwy;
   1619 			Swizzle4<Vector4, 0x7B>     wzwy;
   1620 			Swizzle4<Vector4, 0x7C>     xwwy;
   1621 			Swizzle4<Vector4, 0x7D>     ywwy;
   1622 			Swizzle4<Vector4, 0x7E>     zwwy;
   1623 			Swizzle4<Vector4, 0x7F>     wwwy;
   1624 			Swizzle4<Vector4, 0x80>     xxxz;
   1625 			Swizzle4<Vector4, 0x81>     yxxz;
   1626 			Swizzle4<Vector4, 0x82>     zxxz;
   1627 			Swizzle4<Vector4, 0x83>     wxxz;
   1628 			Swizzle4<Vector4, 0x84>     xyxz;
   1629 			Swizzle4<Vector4, 0x85>     yyxz;
   1630 			Swizzle4<Vector4, 0x86>     zyxz;
   1631 			Swizzle4<Vector4, 0x87>     wyxz;
   1632 			Swizzle4<Vector4, 0x88>     xzxz;
   1633 			Swizzle4<Vector4, 0x89>     yzxz;
   1634 			Swizzle4<Vector4, 0x8A>     zzxz;
   1635 			Swizzle4<Vector4, 0x8B>     wzxz;
   1636 			Swizzle4<Vector4, 0x8C>     xwxz;
   1637 			Swizzle4<Vector4, 0x8D>     ywxz;
   1638 			Swizzle4<Vector4, 0x8E>     zwxz;
   1639 			Swizzle4<Vector4, 0x8F>     wwxz;
   1640 			Swizzle4<Vector4, 0x90>     xxyz;
   1641 			Swizzle4<Vector4, 0x91>     yxyz;
   1642 			Swizzle4<Vector4, 0x92>     zxyz;
   1643 			Swizzle4<Vector4, 0x93>     wxyz;
   1644 			Swizzle4<Vector4, 0x94>     xyyz;
   1645 			Swizzle4<Vector4, 0x95>     yyyz;
   1646 			Swizzle4<Vector4, 0x96>     zyyz;
   1647 			Swizzle4<Vector4, 0x97>     wyyz;
   1648 			Swizzle4<Vector4, 0x98>     xzyz;
   1649 			Swizzle4<Vector4, 0x99>     yzyz;
   1650 			Swizzle4<Vector4, 0x9A>     zzyz;
   1651 			Swizzle4<Vector4, 0x9B>     wzyz;
   1652 			Swizzle4<Vector4, 0x9C>     xwyz;
   1653 			Swizzle4<Vector4, 0x9D>     ywyz;
   1654 			Swizzle4<Vector4, 0x9E>     zwyz;
   1655 			Swizzle4<Vector4, 0x9F>     wwyz;
   1656 			Swizzle4<Vector4, 0xA0>     xxzz;
   1657 			Swizzle4<Vector4, 0xA1>     yxzz;
   1658 			Swizzle4<Vector4, 0xA2>     zxzz;
   1659 			Swizzle4<Vector4, 0xA3>     wxzz;
   1660 			Swizzle4<Vector4, 0xA4>     xyzz;
   1661 			Swizzle4<Vector4, 0xA5>     yyzz;
   1662 			Swizzle4<Vector4, 0xA6>     zyzz;
   1663 			Swizzle4<Vector4, 0xA7>     wyzz;
   1664 			Swizzle4<Vector4, 0xA8>     xzzz;
   1665 			Swizzle4<Vector4, 0xA9>     yzzz;
   1666 			Swizzle4<Vector4, 0xAA>     zzzz;
   1667 			Swizzle4<Vector4, 0xAB>     wzzz;
   1668 			Swizzle4<Vector4, 0xAC>     xwzz;
   1669 			Swizzle4<Vector4, 0xAD>     ywzz;
   1670 			Swizzle4<Vector4, 0xAE>     zwzz;
   1671 			Swizzle4<Vector4, 0xAF>     wwzz;
   1672 			Swizzle4<Vector4, 0xB0>     xxwz;
   1673 			Swizzle4<Vector4, 0xB1>     yxwz;
   1674 			Swizzle4<Vector4, 0xB2>     zxwz;
   1675 			Swizzle4<Vector4, 0xB3>     wxwz;
   1676 			Swizzle4<Vector4, 0xB4>     xywz;
   1677 			Swizzle4<Vector4, 0xB5>     yywz;
   1678 			Swizzle4<Vector4, 0xB6>     zywz;
   1679 			Swizzle4<Vector4, 0xB7>     wywz;
   1680 			Swizzle4<Vector4, 0xB8>     xzwz;
   1681 			Swizzle4<Vector4, 0xB9>     yzwz;
   1682 			Swizzle4<Vector4, 0xBA>     zzwz;
   1683 			Swizzle4<Vector4, 0xBB>     wzwz;
   1684 			Swizzle4<Vector4, 0xBC>     xwwz;
   1685 			Swizzle4<Vector4, 0xBD>     ywwz;
   1686 			Swizzle4<Vector4, 0xBE>     zwwz;
   1687 			Swizzle4<Vector4, 0xBF>     wwwz;
   1688 			Swizzle4<Vector4, 0xC0>     xxxw;
   1689 			Swizzle4<Vector4, 0xC1>     yxxw;
   1690 			Swizzle4<Vector4, 0xC2>     zxxw;
   1691 			Swizzle4<Vector4, 0xC3>     wxxw;
   1692 			Swizzle4<Vector4, 0xC4>     xyxw;
   1693 			Swizzle4<Vector4, 0xC5>     yyxw;
   1694 			Swizzle4<Vector4, 0xC6>     zyxw;
   1695 			Swizzle4<Vector4, 0xC7>     wyxw;
   1696 			Swizzle4<Vector4, 0xC8>     xzxw;
   1697 			Swizzle4<Vector4, 0xC9>     yzxw;
   1698 			Swizzle4<Vector4, 0xCA>     zzxw;
   1699 			Swizzle4<Vector4, 0xCB>     wzxw;
   1700 			Swizzle4<Vector4, 0xCC>     xwxw;
   1701 			Swizzle4<Vector4, 0xCD>     ywxw;
   1702 			Swizzle4<Vector4, 0xCE>     zwxw;
   1703 			Swizzle4<Vector4, 0xCF>     wwxw;
   1704 			Swizzle4<Vector4, 0xD0>     xxyw;
   1705 			Swizzle4<Vector4, 0xD1>     yxyw;
   1706 			Swizzle4<Vector4, 0xD2>     zxyw;
   1707 			Swizzle4<Vector4, 0xD3>     wxyw;
   1708 			Swizzle4<Vector4, 0xD4>     xyyw;
   1709 			Swizzle4<Vector4, 0xD5>     yyyw;
   1710 			Swizzle4<Vector4, 0xD6>     zyyw;
   1711 			Swizzle4<Vector4, 0xD7>     wyyw;
   1712 			Swizzle4<Vector4, 0xD8>     xzyw;
   1713 			Swizzle4<Vector4, 0xD9>     yzyw;
   1714 			Swizzle4<Vector4, 0xDA>     zzyw;
   1715 			Swizzle4<Vector4, 0xDB>     wzyw;
   1716 			Swizzle4<Vector4, 0xDC>     xwyw;
   1717 			Swizzle4<Vector4, 0xDD>     ywyw;
   1718 			Swizzle4<Vector4, 0xDE>     zwyw;
   1719 			Swizzle4<Vector4, 0xDF>     wwyw;
   1720 			Swizzle4<Vector4, 0xE0>     xxzw;
   1721 			Swizzle4<Vector4, 0xE1>     yxzw;
   1722 			Swizzle4<Vector4, 0xE2>     zxzw;
   1723 			Swizzle4<Vector4, 0xE3>     wxzw;
   1724 			SwizzleMask4<Vector4, 0xE4> xyzw;
   1725 			Swizzle4<Vector4, 0xE5>     yyzw;
   1726 			Swizzle4<Vector4, 0xE6>     zyzw;
   1727 			Swizzle4<Vector4, 0xE7>     wyzw;
   1728 			Swizzle4<Vector4, 0xE8>     xzzw;
   1729 			Swizzle4<Vector4, 0xE9>     yzzw;
   1730 			Swizzle4<Vector4, 0xEA>     zzzw;
   1731 			Swizzle4<Vector4, 0xEB>     wzzw;
   1732 			Swizzle4<Vector4, 0xEC>     xwzw;
   1733 			Swizzle4<Vector4, 0xED>     ywzw;
   1734 			Swizzle4<Vector4, 0xEE>     zwzw;
   1735 			Swizzle4<Vector4, 0xEF>     wwzw;
   1736 			Swizzle4<Vector4, 0xF0>     xxww;
   1737 			Swizzle4<Vector4, 0xF1>     yxww;
   1738 			Swizzle4<Vector4, 0xF2>     zxww;
   1739 			Swizzle4<Vector4, 0xF3>     wxww;
   1740 			Swizzle4<Vector4, 0xF4>     xyww;
   1741 			Swizzle4<Vector4, 0xF5>     yyww;
   1742 			Swizzle4<Vector4, 0xF6>     zyww;
   1743 			Swizzle4<Vector4, 0xF7>     wyww;
   1744 			Swizzle4<Vector4, 0xF8>     xzww;
   1745 			Swizzle4<Vector4, 0xF9>     yzww;
   1746 			Swizzle4<Vector4, 0xFA>     zzww;
   1747 			Swizzle4<Vector4, 0xFB>     wzww;
   1748 			Swizzle4<Vector4, 0xFC>     xwww;
   1749 			Swizzle4<Vector4, 0xFD>     ywww;
   1750 			Swizzle4<Vector4, 0xFE>     zwww;
   1751 			Swizzle4<Vector4, 0xFF>     wwww;
   1752 		};
   1753 	};
   1754 
   1755 	class Int4 : public LValue<Int4>, public XYZW<Int4>
   1756 	{
   1757 	public:
   1758 		explicit Int4(RValue<Byte4> cast);
   1759 		explicit Int4(RValue<SByte4> cast);
   1760 		explicit Int4(RValue<Float4> cast);
   1761 		explicit Int4(RValue<Short4> cast);
   1762 		explicit Int4(RValue<UShort4> cast);
   1763 
   1764 		Int4();
   1765 		Int4(int xyzw);
   1766 		Int4(int x, int yzw);
   1767 		Int4(int x, int y, int zw);
   1768 		Int4(int x, int y, int z, int w);
   1769 		Int4(RValue<Int4> rhs);
   1770 		Int4(const Int4 &rhs);
   1771 		Int4(const Reference<Int4> &rhs);
   1772 		Int4(RValue<UInt4> rhs);
   1773 		Int4(const UInt4 &rhs);
   1774 		Int4(const Reference<UInt4> &rhs);
   1775 		Int4(RValue<Int2> lo, RValue<Int2> hi);
   1776 		Int4(RValue<Int> rhs);
   1777 		Int4(const Int &rhs);
   1778 		Int4(const Reference<Int> &rhs);
   1779 
   1780 		RValue<Int4> operator=(RValue<Int4> rhs);
   1781 		RValue<Int4> operator=(const Int4 &rhs);
   1782 		RValue<Int4> operator=(const Reference<Int4> &rhs);
   1783 
   1784 		static Type *getType();
   1785 
   1786 	private:
   1787 		void constant(int x, int y, int z, int w);
   1788 	};
   1789 
   1790 	RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs);
   1791 	RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs);
   1792 	RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs);
   1793 	RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs);
   1794 	RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs);
   1795 	RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs);
   1796 	RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs);
   1797 	RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs);
   1798 	RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs);
   1799 	RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs);
   1800 	RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs);
   1801 	RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs);
   1802 	RValue<Int4> operator+=(Int4 &lhs, RValue<Int4> rhs);
   1803 	RValue<Int4> operator-=(Int4 &lhs, RValue<Int4> rhs);
   1804 	RValue<Int4> operator*=(Int4 &lhs, RValue<Int4> rhs);
   1805 //	RValue<Int4> operator/=(Int4 &lhs, RValue<Int4> rhs);
   1806 //	RValue<Int4> operator%=(Int4 &lhs, RValue<Int4> rhs);
   1807 	RValue<Int4> operator&=(Int4 &lhs, RValue<Int4> rhs);
   1808 	RValue<Int4> operator|=(Int4 &lhs, RValue<Int4> rhs);
   1809 	RValue<Int4> operator^=(Int4 &lhs, RValue<Int4> rhs);
   1810 	RValue<Int4> operator<<=(Int4 &lhs, unsigned char rhs);
   1811 	RValue<Int4> operator>>=(Int4 &lhs, unsigned char rhs);
   1812 	RValue<Int4> operator+(RValue<Int4> val);
   1813 	RValue<Int4> operator-(RValue<Int4> val);
   1814 	RValue<Int4> operator~(RValue<Int4> val);
   1815 //	RValue<Int4> operator++(Int4 &val, int);   // Post-increment
   1816 //	const Int4 &operator++(Int4 &val);   // Pre-increment
   1817 //	RValue<Int4> operator--(Int4 &val, int);   // Post-decrement
   1818 //	const Int4 &operator--(Int4 &val);   // Pre-decrement
   1819 //	RValue<Bool> operator<(RValue<Int4> lhs, RValue<Int4> rhs);
   1820 //	RValue<Bool> operator<=(RValue<Int4> lhs, RValue<Int4> rhs);
   1821 //	RValue<Bool> operator>(RValue<Int4> lhs, RValue<Int4> rhs);
   1822 //	RValue<Bool> operator>=(RValue<Int4> lhs, RValue<Int4> rhs);
   1823 //	RValue<Bool> operator!=(RValue<Int4> lhs, RValue<Int4> rhs);
   1824 //	RValue<Bool> operator==(RValue<Int4> lhs, RValue<Int4> rhs);
   1825 
   1826 	inline RValue<Int4> operator+(RValue<Int> lhs, RValue<Int4> rhs)
   1827 	{
   1828 		return Int4(lhs) + rhs;
   1829 	}
   1830 
   1831 	inline RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int> rhs)
   1832 	{
   1833 		return lhs + Int4(rhs);
   1834 	}
   1835 
   1836 	RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y);
   1837 	RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y);
   1838 	RValue<Int4> CmpLE(RValue<Int4> x, RValue<Int4> y);
   1839 	RValue<Int4> CmpNEQ(RValue<Int4> x, RValue<Int4> y);
   1840 	RValue<Int4> CmpNLT(RValue<Int4> x, RValue<Int4> y);
   1841 	RValue<Int4> CmpNLE(RValue<Int4> x, RValue<Int4> y);
   1842 	RValue<Int4> Max(RValue<Int4> x, RValue<Int4> y);
   1843 	RValue<Int4> Min(RValue<Int4> x, RValue<Int4> y);
   1844 	RValue<Int4> RoundInt(RValue<Float4> cast);
   1845 	RValue<Short8> PackSigned(RValue<Int4> x, RValue<Int4> y);
   1846 	RValue<UShort8> PackUnsigned(RValue<Int4> x, RValue<Int4> y);
   1847 	RValue<Int> Extract(RValue<Int4> val, int i);
   1848 	RValue<Int4> Insert(RValue<Int4> val, RValue<Int> element, int i);
   1849 	RValue<Int> SignMask(RValue<Int4> x);
   1850 	RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select);
   1851 
   1852 	class UInt4 : public LValue<UInt4>, public XYZW<UInt4>
   1853 	{
   1854 	public:
   1855 		explicit UInt4(RValue<Float4> cast);
   1856 
   1857 		UInt4();
   1858 		UInt4(int xyzw);
   1859 		UInt4(int x, int yzw);
   1860 		UInt4(int x, int y, int zw);
   1861 		UInt4(int x, int y, int z, int w);
   1862 		UInt4(unsigned int x, unsigned int y, unsigned int z, unsigned int w);
   1863 		UInt4(RValue<UInt4> rhs);
   1864 		UInt4(const UInt4 &rhs);
   1865 		UInt4(const Reference<UInt4> &rhs);
   1866 		UInt4(RValue<Int4> rhs);
   1867 		UInt4(const Int4 &rhs);
   1868 		UInt4(const Reference<Int4> &rhs);
   1869 		UInt4(RValue<UInt2> lo, RValue<UInt2> hi);
   1870 
   1871 		RValue<UInt4> operator=(RValue<UInt4> rhs);
   1872 		RValue<UInt4> operator=(const UInt4 &rhs);
   1873 		RValue<UInt4> operator=(const Reference<UInt4> &rhs);
   1874 
   1875 		static Type *getType();
   1876 
   1877 	private:
   1878 		void constant(int x, int y, int z, int w);
   1879 	};
   1880 
   1881 	RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1882 	RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1883 	RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1884 	RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1885 	RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1886 	RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1887 	RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1888 	RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1889 	RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs);
   1890 	RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs);
   1891 	RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1892 	RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1893 	RValue<UInt4> operator+=(UInt4 &lhs, RValue<UInt4> rhs);
   1894 	RValue<UInt4> operator-=(UInt4 &lhs, RValue<UInt4> rhs);
   1895 	RValue<UInt4> operator*=(UInt4 &lhs, RValue<UInt4> rhs);
   1896 //	RValue<UInt4> operator/=(UInt4 &lhs, RValue<UInt4> rhs);
   1897 //	RValue<UInt4> operator%=(UInt4 &lhs, RValue<UInt4> rhs);
   1898 	RValue<UInt4> operator&=(UInt4 &lhs, RValue<UInt4> rhs);
   1899 	RValue<UInt4> operator|=(UInt4 &lhs, RValue<UInt4> rhs);
   1900 	RValue<UInt4> operator^=(UInt4 &lhs, RValue<UInt4> rhs);
   1901 	RValue<UInt4> operator<<=(UInt4 &lhs, unsigned char rhs);
   1902 	RValue<UInt4> operator>>=(UInt4 &lhs, unsigned char rhs);
   1903 	RValue<UInt4> operator+(RValue<UInt4> val);
   1904 	RValue<UInt4> operator-(RValue<UInt4> val);
   1905 	RValue<UInt4> operator~(RValue<UInt4> val);
   1906 //	RValue<UInt4> operator++(UInt4 &val, int);   // Post-increment
   1907 //	const UInt4 &operator++(UInt4 &val);   // Pre-increment
   1908 //	RValue<UInt4> operator--(UInt4 &val, int);   // Post-decrement
   1909 //	const UInt4 &operator--(UInt4 &val);   // Pre-decrement
   1910 //	RValue<Bool> operator<(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1911 //	RValue<Bool> operator<=(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1912 //	RValue<Bool> operator>(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1913 //	RValue<Bool> operator>=(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1914 //	RValue<Bool> operator!=(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1915 //	RValue<Bool> operator==(RValue<UInt4> lhs, RValue<UInt4> rhs);
   1916 
   1917 	RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y);
   1918 	RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y);
   1919 	RValue<UInt4> CmpLE(RValue<UInt4> x, RValue<UInt4> y);
   1920 	RValue<UInt4> CmpNEQ(RValue<UInt4> x, RValue<UInt4> y);
   1921 	RValue<UInt4> CmpNLT(RValue<UInt4> x, RValue<UInt4> y);
   1922 	RValue<UInt4> CmpNLE(RValue<UInt4> x, RValue<UInt4> y);
   1923 	RValue<UInt4> Max(RValue<UInt4> x, RValue<UInt4> y);
   1924 	RValue<UInt4> Min(RValue<UInt4> x, RValue<UInt4> y);
   1925 //	RValue<UInt4> RoundInt(RValue<Float4> cast);
   1926 
   1927 	class Half : public LValue<Half>
   1928 	{
   1929 	public:
   1930 		explicit Half(RValue<Float> cast);
   1931 
   1932 		static Type *getType();
   1933 	};
   1934 
   1935 	class Float : public LValue<Float>
   1936 	{
   1937 	public:
   1938 		explicit Float(RValue<Int> cast);
   1939 		explicit Float(RValue<UInt> cast);
   1940 		explicit Float(RValue<Half> cast);
   1941 
   1942 		Float() = default;
   1943 		Float(float x);
   1944 		Float(RValue<Float> rhs);
   1945 		Float(const Float &rhs);
   1946 		Float(const Reference<Float> &rhs);
   1947 
   1948 		template<int T>
   1949 		Float(const SwizzleMask1<Float4, T> &rhs);
   1950 
   1951 	//	RValue<Float> operator=(float rhs);   // FIXME: Implement
   1952 		RValue<Float> operator=(RValue<Float> rhs);
   1953 		RValue<Float> operator=(const Float &rhs);
   1954 		RValue<Float> operator=(const Reference<Float> &rhs);
   1955 
   1956 		template<int T>
   1957 		RValue<Float> operator=(const SwizzleMask1<Float4, T> &rhs);
   1958 
   1959 		static Type *getType();
   1960 	};
   1961 
   1962 	RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs);
   1963 	RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs);
   1964 	RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs);
   1965 	RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs);
   1966 	RValue<Float> operator+=(Float &lhs, RValue<Float> rhs);
   1967 	RValue<Float> operator-=(Float &lhs, RValue<Float> rhs);
   1968 	RValue<Float> operator*=(Float &lhs, RValue<Float> rhs);
   1969 	RValue<Float> operator/=(Float &lhs, RValue<Float> rhs);
   1970 	RValue<Float> operator+(RValue<Float> val);
   1971 	RValue<Float> operator-(RValue<Float> val);
   1972 	RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs);
   1973 	RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs);
   1974 	RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs);
   1975 	RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs);
   1976 	RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs);
   1977 	RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs);
   1978 
   1979 	RValue<Float> Abs(RValue<Float> x);
   1980 	RValue<Float> Max(RValue<Float> x, RValue<Float> y);
   1981 	RValue<Float> Min(RValue<Float> x, RValue<Float> y);
   1982 	RValue<Float> Rcp_pp(RValue<Float> val, bool exactAtPow2 = false);
   1983 	RValue<Float> RcpSqrt_pp(RValue<Float> val);
   1984 	RValue<Float> Sqrt(RValue<Float> x);
   1985 	RValue<Float> Round(RValue<Float> val);
   1986 	RValue<Float> Trunc(RValue<Float> val);
   1987 	RValue<Float> Frac(RValue<Float> val);
   1988 	RValue<Float> Floor(RValue<Float> val);
   1989 	RValue<Float> Ceil(RValue<Float> val);
   1990 
   1991 	class Float2 : public LValue<Float2>
   1992 	{
   1993 	public:
   1994 	//	explicit Float2(RValue<Byte2> cast);
   1995 	//	explicit Float2(RValue<Short2> cast);
   1996 	//	explicit Float2(RValue<UShort2> cast);
   1997 	//	explicit Float2(RValue<Int2> cast);
   1998 	//	explicit Float2(RValue<UInt2> cast);
   1999 		explicit Float2(RValue<Float4> cast);
   2000 
   2001 		Float2() = default;
   2002 	//	Float2(float x, float y);
   2003 	//	Float2(RValue<Float2> rhs);
   2004 	//	Float2(const Float2 &rhs);
   2005 	//	Float2(const Reference<Float2> &rhs);
   2006 	//	Float2(RValue<Float> rhs);
   2007 	//	Float2(const Float &rhs);
   2008 	//	Float2(const Reference<Float> &rhs);
   2009 
   2010 	//	template<int T>
   2011 	//	Float2(const SwizzleMask1<T> &rhs);
   2012 
   2013 	//	RValue<Float2> operator=(float replicate);
   2014 	//	RValue<Float2> operator=(RValue<Float2> rhs);
   2015 	//	RValue<Float2> operator=(const Float2 &rhs);
   2016 	//	RValue<Float2> operator=(const Reference<Float2> &rhs);
   2017 	//	RValue<Float2> operator=(RValue<Float> rhs);
   2018 	//	RValue<Float2> operator=(const Float &rhs);
   2019 	//	RValue<Float2> operator=(const Reference<Float> &rhs);
   2020 
   2021 	//	template<int T>
   2022 	//	RValue<Float2> operator=(const SwizzleMask1<T> &rhs);
   2023 
   2024 		static Type *getType();
   2025 	};
   2026 
   2027 //	RValue<Float2> operator+(RValue<Float2> lhs, RValue<Float2> rhs);
   2028 //	RValue<Float2> operator-(RValue<Float2> lhs, RValue<Float2> rhs);
   2029 //	RValue<Float2> operator*(RValue<Float2> lhs, RValue<Float2> rhs);
   2030 //	RValue<Float2> operator/(RValue<Float2> lhs, RValue<Float2> rhs);
   2031 //	RValue<Float2> operator%(RValue<Float2> lhs, RValue<Float2> rhs);
   2032 //	RValue<Float2> operator+=(Float2 &lhs, RValue<Float2> rhs);
   2033 //	RValue<Float2> operator-=(Float2 &lhs, RValue<Float2> rhs);
   2034 //	RValue<Float2> operator*=(Float2 &lhs, RValue<Float2> rhs);
   2035 //	RValue<Float2> operator/=(Float2 &lhs, RValue<Float2> rhs);
   2036 //	RValue<Float2> operator%=(Float2 &lhs, RValue<Float2> rhs);
   2037 //	RValue<Float2> operator+(RValue<Float2> val);
   2038 //	RValue<Float2> operator-(RValue<Float2> val);
   2039 
   2040 //	RValue<Float2> Abs(RValue<Float2> x);
   2041 //	RValue<Float2> Max(RValue<Float2> x, RValue<Float2> y);
   2042 //	RValue<Float2> Min(RValue<Float2> x, RValue<Float2> y);
   2043 //	RValue<Float2> Swizzle(RValue<Float2> x, unsigned char select);
   2044 //	RValue<Float2> Mask(Float2 &lhs, RValue<Float2> rhs, unsigned char select);
   2045 
   2046 	class Float4 : public LValue<Float4>, public XYZW<Float4>
   2047 	{
   2048 	public:
   2049 		explicit Float4(RValue<Byte4> cast);
   2050 		explicit Float4(RValue<SByte4> cast);
   2051 		explicit Float4(RValue<Short4> cast);
   2052 		explicit Float4(RValue<UShort4> cast);
   2053 		explicit Float4(RValue<Int4> cast);
   2054 		explicit Float4(RValue<UInt4> cast);
   2055 
   2056 		Float4();
   2057 		Float4(float xyzw);
   2058 		Float4(float x, float yzw);
   2059 		Float4(float x, float y, float zw);
   2060 		Float4(float x, float y, float z, float w);
   2061 		Float4(RValue<Float4> rhs);
   2062 		Float4(const Float4 &rhs);
   2063 		Float4(const Reference<Float4> &rhs);
   2064 		Float4(RValue<Float> rhs);
   2065 		Float4(const Float &rhs);
   2066 		Float4(const Reference<Float> &rhs);
   2067 
   2068 		template<int T>
   2069 		Float4(const SwizzleMask1<Float4, T> &rhs);
   2070 		template<int T>
   2071 		Float4(const Swizzle4<Float4, T> &rhs);
   2072 		template<int X, int Y>
   2073 		Float4(const Swizzle2<Float4, X> &x, const Swizzle2<Float4, Y> &y);
   2074 		template<int X, int Y>
   2075 		Float4(const SwizzleMask2<Float4, X> &x, const Swizzle2<Float4, Y> &y);
   2076 		template<int X, int Y>
   2077 		Float4(const Swizzle2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y);
   2078 		template<int X, int Y>
   2079 		Float4(const SwizzleMask2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y);
   2080 
   2081 		RValue<Float4> operator=(float replicate);
   2082 		RValue<Float4> operator=(RValue<Float4> rhs);
   2083 		RValue<Float4> operator=(const Float4 &rhs);
   2084 		RValue<Float4> operator=(const Reference<Float4> &rhs);
   2085 		RValue<Float4> operator=(RValue<Float> rhs);
   2086 		RValue<Float4> operator=(const Float &rhs);
   2087 		RValue<Float4> operator=(const Reference<Float> &rhs);
   2088 
   2089 		template<int T>
   2090 		RValue<Float4> operator=(const SwizzleMask1<Float4, T> &rhs);
   2091 		template<int T>
   2092 		RValue<Float4> operator=(const Swizzle4<Float4, T> &rhs);
   2093 
   2094 		static Type *getType();
   2095 
   2096 	private:
   2097 		void constant(float x, float y, float z, float w);
   2098 	};
   2099 
   2100 	RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs);
   2101 	RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs);
   2102 	RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs);
   2103 	RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs);
   2104 	RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs);
   2105 	RValue<Float4> operator+=(Float4 &lhs, RValue<Float4> rhs);
   2106 	RValue<Float4> operator-=(Float4 &lhs, RValue<Float4> rhs);
   2107 	RValue<Float4> operator*=(Float4 &lhs, RValue<Float4> rhs);
   2108 	RValue<Float4> operator/=(Float4 &lhs, RValue<Float4> rhs);
   2109 	RValue<Float4> operator%=(Float4 &lhs, RValue<Float4> rhs);
   2110 	RValue<Float4> operator+(RValue<Float4> val);
   2111 	RValue<Float4> operator-(RValue<Float4> val);
   2112 
   2113 	RValue<Float4> Abs(RValue<Float4> x);
   2114 	RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y);
   2115 	RValue<Float4> Min(RValue<Float4> x, RValue<Float4> y);
   2116 	RValue<Float4> Rcp_pp(RValue<Float4> val, bool exactAtPow2 = false);
   2117 	RValue<Float4> RcpSqrt_pp(RValue<Float4> val);
   2118 	RValue<Float4> Sqrt(RValue<Float4> x);
   2119 	RValue<Float4> Insert(RValue<Float4> val, RValue<Float> element, int i);
   2120 	RValue<Float> Extract(RValue<Float4> x, int i);
   2121 	RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select);
   2122 	RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm);
   2123 	RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y);
   2124 	RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y);
   2125 	RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select);
   2126 	RValue<Int> SignMask(RValue<Float4> x);
   2127 	RValue<Int4> CmpEQ(RValue<Float4> x, RValue<Float4> y);
   2128 	RValue<Int4> CmpLT(RValue<Float4> x, RValue<Float4> y);
   2129 	RValue<Int4> CmpLE(RValue<Float4> x, RValue<Float4> y);
   2130 	RValue<Int4> CmpNEQ(RValue<Float4> x, RValue<Float4> y);
   2131 	RValue<Int4> CmpNLT(RValue<Float4> x, RValue<Float4> y);
   2132 	RValue<Int4> CmpNLE(RValue<Float4> x, RValue<Float4> y);
   2133 	RValue<Int4> IsInf(RValue<Float4> x);
   2134 	RValue<Int4> IsNan(RValue<Float4> x);
   2135 	RValue<Float4> Round(RValue<Float4> x);
   2136 	RValue<Float4> Trunc(RValue<Float4> x);
   2137 	RValue<Float4> Frac(RValue<Float4> x);
   2138 	RValue<Float4> Floor(RValue<Float4> x);
   2139 	RValue<Float4> Ceil(RValue<Float4> x);
   2140 
   2141 	template<class T>
   2142 	class Pointer : public LValue<Pointer<T>>
   2143 	{
   2144 	public:
   2145 		template<class S>
   2146 		Pointer(RValue<Pointer<S>> pointerS, int alignment = 1) : alignment(alignment)
   2147 		{
   2148 			Value *pointerT = Nucleus::createBitCast(pointerS.value, Nucleus::getPointerType(T::getType()));
   2149 			LValue<Pointer<T>>::storeValue(pointerT);
   2150 		}
   2151 
   2152 		template<class S>
   2153 		Pointer(const Pointer<S> &pointer, int alignment = 1) : alignment(alignment)
   2154 		{
   2155 			Value *pointerS = pointer.loadValue();
   2156 			Value *pointerT = Nucleus::createBitCast(pointerS, Nucleus::getPointerType(T::getType()));
   2157 			LValue<Pointer<T>>::storeValue(pointerT);
   2158 		}
   2159 
   2160 		Pointer(Argument<Pointer<T>> argument);
   2161 
   2162 		Pointer();
   2163 		Pointer(RValue<Pointer<T>> rhs);
   2164 		Pointer(const Pointer<T> &rhs);
   2165 		Pointer(const Reference<Pointer<T>> &rhs);
   2166 
   2167 		RValue<Pointer<T>> operator=(RValue<Pointer<T>> rhs);
   2168 		RValue<Pointer<T>> operator=(const Pointer<T> &rhs);
   2169 		RValue<Pointer<T>> operator=(const Reference<Pointer<T>> &rhs);
   2170 
   2171 		Reference<T> operator*();
   2172 		Reference<T> operator[](int index);
   2173 		Reference<T> operator[](unsigned int index);
   2174 		Reference<T> operator[](RValue<Int> index);
   2175 		Reference<T> operator[](RValue<UInt> index);
   2176 
   2177 		static Type *getType();
   2178 
   2179 	private:
   2180 		const int alignment;
   2181 	};
   2182 
   2183 	RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset);
   2184 	RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset);
   2185 	RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset);
   2186 	RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, int offset);
   2187 	RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<Int> offset);
   2188 	RValue<Pointer<Byte>> operator+=(Pointer<Byte> &lhs, RValue<UInt> offset);
   2189 
   2190 	RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset);
   2191 	RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset);
   2192 	RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset);
   2193 	RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, int offset);
   2194 	RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<Int> offset);
   2195 	RValue<Pointer<Byte>> operator-=(Pointer<Byte> &lhs, RValue<UInt> offset);
   2196 
   2197 	template<class T, int S = 1>
   2198 	class Array : public LValue<T>
   2199 	{
   2200 	public:
   2201 		Array(int size = S);
   2202 
   2203 		Reference<T> operator[](int index);
   2204 		Reference<T> operator[](unsigned int index);
   2205 		Reference<T> operator[](RValue<Int> index);
   2206 		Reference<T> operator[](RValue<UInt> index);
   2207 	};
   2208 
   2209 //	RValue<Array<T>> operator++(Array<T> &val, int);   // Post-increment
   2210 //	const Array<T> &operator++(Array<T> &val);   // Pre-increment
   2211 //	RValue<Array<T>> operator--(Array<T> &val, int);   // Post-decrement
   2212 //	const Array<T> &operator--(Array<T> &val);   // Pre-decrement
   2213 
   2214 	void branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB);
   2215 
   2216 	void Return();
   2217 	void Return(RValue<Int> ret);
   2218 
   2219 	template<class T>
   2220 	void Return(const Pointer<T> &ret);
   2221 
   2222 	template<class T>
   2223 	void Return(RValue<Pointer<T>> ret);
   2224 
   2225 	template<unsigned int index, typename... Arguments>
   2226 	struct ArgI;
   2227 
   2228 	template<typename Arg0, typename... Arguments>
   2229 	struct ArgI<0, Arg0, Arguments...>
   2230 	{
   2231 		typedef Arg0 Type;
   2232 	};
   2233 
   2234 	template<unsigned int index, typename Arg0, typename... Arguments>
   2235 	struct ArgI<index, Arg0, Arguments...>
   2236 	{
   2237 		typedef typename ArgI<index - 1, Arguments...>::Type Type;
   2238 	};
   2239 
   2240 	// Generic template, leave undefined!
   2241 	template<typename FunctionType>
   2242 	class Function;
   2243 
   2244 	// Specialized for function types
   2245 	template<typename Return, typename... Arguments>
   2246 	class Function<Return(Arguments...)>
   2247 	{
   2248 	public:
   2249 		Function();
   2250 
   2251 		virtual ~Function();
   2252 
   2253 		template<int index>
   2254 		Argument<typename ArgI<index, Arguments...>::Type> Arg() const
   2255 		{
   2256 			Value *arg = Nucleus::getArgument(index);
   2257 			return Argument<typename ArgI<index, Arguments...>::Type>(arg);
   2258 		}
   2259 
   2260 		Routine *operator()(const char *name, ...);
   2261 
   2262 	protected:
   2263 		Nucleus *core;
   2264 		std::vector<Type*> arguments;
   2265 	};
   2266 
   2267 	template<typename Return>
   2268 	class Function<Return()> : public Function<Return(Void)>
   2269 	{
   2270 	};
   2271 
   2272 	template<int index, typename Return, typename... Arguments>
   2273 	Argument<typename ArgI<index, Arguments...>::Type> Arg(Function<Return(Arguments...)> &function)
   2274 	{
   2275 		return Argument<typename ArgI<index, Arguments...>::Type>(function.arg(index));
   2276 	}
   2277 
   2278 	RValue<Long> Ticks();
   2279 }
   2280 
   2281 namespace rr
   2282 {
   2283 	template<class T>
   2284 	LValue<T>::LValue(int arraySize)
   2285 	{
   2286 		address = Nucleus::allocateStackVariable(T::getType(), arraySize);
   2287 	}
   2288 
   2289 	template<class T>
   2290 	Value *LValue<T>::loadValue() const
   2291 	{
   2292 		return Nucleus::createLoad(address, T::getType(), false, 0);
   2293 	}
   2294 
   2295 	template<class T>
   2296 	Value *LValue<T>::storeValue(Value *value) const
   2297 	{
   2298 		return Nucleus::createStore(value, address, T::getType(), false, 0);
   2299 	}
   2300 
   2301 	template<class T>
   2302 	Value *LValue<T>::getAddress(Value *index, bool unsignedIndex) const
   2303 	{
   2304 		return Nucleus::createGEP(address, T::getType(), index, unsignedIndex);
   2305 	}
   2306 
   2307 	template<class T>
   2308 	RValue<Pointer<T>> LValue<T>::operator&()
   2309 	{
   2310 		return RValue<Pointer<T>>(address);
   2311 	}
   2312 
   2313 	template<class T>
   2314 	Reference<T>::Reference(Value *pointer, int alignment) : alignment(alignment)
   2315 	{
   2316 		address = pointer;
   2317 	}
   2318 
   2319 	template<class T>
   2320 	RValue<T> Reference<T>::operator=(RValue<T> rhs) const
   2321 	{
   2322 		Nucleus::createStore(rhs.value, address, T::getType(), false, alignment);
   2323 
   2324 		return rhs;
   2325 	}
   2326 
   2327 	template<class T>
   2328 	RValue<T> Reference<T>::operator=(const Reference<T> &ref) const
   2329 	{
   2330 		Value *tmp = Nucleus::createLoad(ref.address, T::getType(), false, ref.alignment);
   2331 		Nucleus::createStore(tmp, address, T::getType(), false, alignment);
   2332 
   2333 		return RValue<T>(tmp);
   2334 	}
   2335 
   2336 	template<class T>
   2337 	RValue<T> Reference<T>::operator+=(RValue<T> rhs) const
   2338 	{
   2339 		return *this = *this + rhs;
   2340 	}
   2341 
   2342 	template<class T>
   2343 	Value *Reference<T>::loadValue() const
   2344 	{
   2345 		return Nucleus::createLoad(address, T::getType(), false, alignment);
   2346 	}
   2347 
   2348 	template<class T>
   2349 	int Reference<T>::getAlignment() const
   2350 	{
   2351 		return alignment;
   2352 	}
   2353 
   2354 	template<class T>
   2355 	RValue<T>::RValue(Value *rvalue)
   2356 	{
   2357 		assert(Nucleus::createBitCast(rvalue, T::getType()) == rvalue);   // Run-time type should match T, so bitcast is no-op.
   2358 
   2359 		value = rvalue;
   2360 	}
   2361 
   2362 	template<class T>
   2363 	RValue<T>::RValue(const T &lvalue)
   2364 	{
   2365 		value = lvalue.loadValue();
   2366 	}
   2367 
   2368 	template<class T>
   2369 	RValue<T>::RValue(typename IntLiteral<T>::type i)
   2370 	{
   2371 		value = Nucleus::createConstantInt(i);
   2372 	}
   2373 
   2374 	template<class T>
   2375 	RValue<T>::RValue(typename FloatLiteral<T>::type f)
   2376 	{
   2377 		value = Nucleus::createConstantFloat(f);
   2378 	}
   2379 
   2380 	template<class T>
   2381 	RValue<T>::RValue(const Reference<T> &ref)
   2382 	{
   2383 		value = ref.loadValue();
   2384 	}
   2385 
   2386 	template<class Vector4, int T>
   2387 	Swizzle2<Vector4, T>::operator RValue<Vector4>() const
   2388 	{
   2389 		Value *vector = parent->loadValue();
   2390 
   2391 		return Swizzle(RValue<Vector4>(vector), T);
   2392 	}
   2393 
   2394 	template<class Vector4, int T>
   2395 	Swizzle4<Vector4, T>::operator RValue<Vector4>() const
   2396 	{
   2397 		Value *vector = parent->loadValue();
   2398 
   2399 		return Swizzle(RValue<Vector4>(vector), T);
   2400 	}
   2401 
   2402 	template<class Vector4, int T>
   2403 	SwizzleMask4<Vector4, T>::operator RValue<Vector4>() const
   2404 	{
   2405 		Value *vector = parent->loadValue();
   2406 
   2407 		return Swizzle(RValue<Vector4>(vector), T);
   2408 	}
   2409 
   2410 	template<class Vector4, int T>
   2411 	RValue<Vector4> SwizzleMask4<Vector4, T>::operator=(RValue<Vector4> rhs)
   2412 	{
   2413 		return Mask(*parent, rhs, T);
   2414 	}
   2415 
   2416 	template<class Vector4, int T>
   2417 	RValue<Vector4> SwizzleMask4<Vector4, T>::operator=(RValue<typename Scalar<Vector4>::Type> rhs)
   2418 	{
   2419 		return Mask(*parent, Vector4(rhs), T);
   2420 	}
   2421 
   2422 	template<class Vector4, int T>
   2423 	SwizzleMask1<Vector4, T>::operator RValue<typename Scalar<Vector4>::Type>() const   // FIXME: Call a non-template function
   2424 	{
   2425 		return Extract(*parent, T & 0x3);
   2426 	}
   2427 
   2428 	template<class Vector4, int T>
   2429 	SwizzleMask1<Vector4, T>::operator RValue<Vector4>() const
   2430 	{
   2431 		Value *vector = parent->loadValue();
   2432 
   2433 		return Swizzle(RValue<Vector4>(vector), T);
   2434 	}
   2435 
   2436 	template<class Vector4, int T>
   2437 	RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(float x)
   2438 	{
   2439 		return *parent = Insert(*parent, Float(x), T & 0x3);
   2440 	}
   2441 
   2442 	template<class Vector4, int T>
   2443 	RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(RValue<Vector4> rhs)
   2444 	{
   2445 		return Mask(*parent, Float4(rhs), T);
   2446 	}
   2447 
   2448 	template<class Vector4, int T>
   2449 	RValue<Vector4> SwizzleMask1<Vector4, T>::operator=(RValue<typename Scalar<Vector4>::Type> rhs)   // FIXME: Call a non-template function
   2450 	{
   2451 		return *parent = Insert(*parent, rhs, T & 0x3);
   2452 	}
   2453 
   2454 	template<class Vector4, int T>
   2455 	SwizzleMask2<Vector4, T>::operator RValue<Vector4>() const
   2456 	{
   2457 		Value *vector = parent->loadValue();
   2458 
   2459 		return Swizzle(RValue<Float4>(vector), T);
   2460 	}
   2461 
   2462 	template<class Vector4, int T>
   2463 	RValue<Vector4> SwizzleMask2<Vector4, T>::operator=(RValue<Vector4> rhs)
   2464 	{
   2465 		return Mask(*parent, Float4(rhs), T);
   2466 	}
   2467 
   2468 	template<int T>
   2469 	Float::Float(const SwizzleMask1<Float4, T> &rhs)
   2470 	{
   2471 		*this = rhs.operator RValue<Float>();
   2472 	}
   2473 
   2474 	template<int T>
   2475 	RValue<Float> Float::operator=(const SwizzleMask1<Float4, T> &rhs)
   2476 	{
   2477 		return *this = rhs.operator RValue<Float>();
   2478 	}
   2479 
   2480 	template<int T>
   2481 	Float4::Float4(const SwizzleMask1<Float4, T> &rhs) : XYZW(this)
   2482 	{
   2483 		*this = rhs.operator RValue<Float4>();
   2484 	}
   2485 
   2486 	template<int T>
   2487 	Float4::Float4(const Swizzle4<Float4, T> &rhs) : XYZW(this)
   2488 	{
   2489 		*this = rhs.operator RValue<Float4>();
   2490 	}
   2491 
   2492 	template<int X, int Y>
   2493 	Float4::Float4(const Swizzle2<Float4, X> &x, const Swizzle2<Float4, Y> &y) : XYZW(this)
   2494 	{
   2495 		*this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
   2496 	}
   2497 
   2498 	template<int X, int Y>
   2499 	Float4::Float4(const SwizzleMask2<Float4, X> &x, const Swizzle2<Float4, Y> &y) : XYZW(this)
   2500 	{
   2501 		*this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
   2502 	}
   2503 
   2504 	template<int X, int Y>
   2505 	Float4::Float4(const Swizzle2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y) : XYZW(this)
   2506 	{
   2507 		*this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
   2508 	}
   2509 
   2510 	template<int X, int Y>
   2511 	Float4::Float4(const SwizzleMask2<Float4, X> &x, const SwizzleMask2<Float4, Y> &y) : XYZW(this)
   2512 	{
   2513 		*this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
   2514 	}
   2515 
   2516 	template<int T>
   2517 	RValue<Float4> Float4::operator=(const SwizzleMask1<Float4, T> &rhs)
   2518 	{
   2519 		return *this = rhs.operator RValue<Float4>();
   2520 	}
   2521 
   2522 	template<int T>
   2523 	RValue<Float4> Float4::operator=(const Swizzle4<Float4, T> &rhs)
   2524 	{
   2525 		return *this = rhs.operator RValue<Float4>();
   2526 	}
   2527 
   2528 	template<class T>
   2529 	Pointer<T>::Pointer(Argument<Pointer<T>> argument) : alignment(1)
   2530 	{
   2531 		LValue<Pointer<T>>::storeValue(argument.value);
   2532 	}
   2533 
   2534 	template<class T>
   2535 	Pointer<T>::Pointer() : alignment(1)
   2536 	{
   2537 		LValue<Pointer<T>>::storeValue(Nucleus::createNullPointer(T::getType()));
   2538 	}
   2539 
   2540 	template<class T>
   2541 	Pointer<T>::Pointer(RValue<Pointer<T>> rhs) : alignment(1)
   2542 	{
   2543 		LValue<Pointer<T>>::storeValue(rhs.value);
   2544 	}
   2545 
   2546 	template<class T>
   2547 	Pointer<T>::Pointer(const Pointer<T> &rhs) : alignment(rhs.alignment)
   2548 	{
   2549 		Value *value = rhs.loadValue();
   2550 		LValue<Pointer<T>>::storeValue(value);
   2551 	}
   2552 
   2553 	template<class T>
   2554 	Pointer<T>::Pointer(const Reference<Pointer<T>> &rhs) : alignment(rhs.getAlignment())
   2555 	{
   2556 		Value *value = rhs.loadValue();
   2557 		LValue<Pointer<T>>::storeValue(value);
   2558 	}
   2559 
   2560 	template<class T>
   2561 	RValue<Pointer<T>> Pointer<T>::operator=(RValue<Pointer<T>> rhs)
   2562 	{
   2563 		LValue<Pointer<T>>::storeValue(rhs.value);
   2564 
   2565 		return rhs;
   2566 	}
   2567 
   2568 	template<class T>
   2569 	RValue<Pointer<T>> Pointer<T>::operator=(const Pointer<T> &rhs)
   2570 	{
   2571 		Value *value = rhs.loadValue();
   2572 		LValue<Pointer<T>>::storeValue(value);
   2573 
   2574 		return RValue<Pointer<T>>(value);
   2575 	}
   2576 
   2577 	template<class T>
   2578 	RValue<Pointer<T>> Pointer<T>::operator=(const Reference<Pointer<T>> &rhs)
   2579 	{
   2580 		Value *value = rhs.loadValue();
   2581 		LValue<Pointer<T>>::storeValue(value);
   2582 
   2583 		return RValue<Pointer<T>>(value);
   2584 	}
   2585 
   2586 	template<class T>
   2587 	Reference<T> Pointer<T>::operator*()
   2588 	{
   2589 		return Reference<T>(LValue<Pointer<T>>::loadValue(), alignment);
   2590 	}
   2591 
   2592 	template<class T>
   2593 	Reference<T> Pointer<T>::operator[](int index)
   2594 	{
   2595 		Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), Nucleus::createConstantInt(index), false);
   2596 
   2597 		return Reference<T>(element, alignment);
   2598 	}
   2599 
   2600 	template<class T>
   2601 	Reference<T> Pointer<T>::operator[](unsigned int index)
   2602 	{
   2603 		Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), Nucleus::createConstantInt(index), true);
   2604 
   2605 		return Reference<T>(element, alignment);
   2606 	}
   2607 
   2608 	template<class T>
   2609 	Reference<T> Pointer<T>::operator[](RValue<Int> index)
   2610 	{
   2611 		Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), index.value, false);
   2612 
   2613 		return Reference<T>(element, alignment);
   2614 	}
   2615 
   2616 	template<class T>
   2617 	Reference<T> Pointer<T>::operator[](RValue<UInt> index)
   2618 	{
   2619 		Value *element = Nucleus::createGEP(LValue<Pointer<T>>::loadValue(), T::getType(), index.value, true);
   2620 
   2621 		return Reference<T>(element, alignment);
   2622 	}
   2623 
   2624 	template<class T>
   2625 	Type *Pointer<T>::getType()
   2626 	{
   2627 		return Nucleus::getPointerType(T::getType());
   2628 	}
   2629 
   2630 	template<class T, int S>
   2631 	Array<T, S>::Array(int size) : LValue<T>(size)
   2632 	{
   2633 	}
   2634 
   2635 	template<class T, int S>
   2636 	Reference<T> Array<T, S>::operator[](int index)
   2637 	{
   2638 		Value *element = LValue<T>::getAddress(Nucleus::createConstantInt(index), false);
   2639 
   2640 		return Reference<T>(element);
   2641 	}
   2642 
   2643 	template<class T, int S>
   2644 	Reference<T> Array<T, S>::operator[](unsigned int index)
   2645 	{
   2646 		Value *element = LValue<T>::getAddress(Nucleus::createConstantInt(index), true);
   2647 
   2648 		return Reference<T>(element);
   2649 	}
   2650 
   2651 	template<class T, int S>
   2652 	Reference<T> Array<T, S>::operator[](RValue<Int> index)
   2653 	{
   2654 		Value *element = LValue<T>::getAddress(index.value, false);
   2655 
   2656 		return Reference<T>(element);
   2657 	}
   2658 
   2659 	template<class T, int S>
   2660 	Reference<T> Array<T, S>::operator[](RValue<UInt> index)
   2661 	{
   2662 		Value *element = LValue<T>::getAddress(index.value, true);
   2663 
   2664 		return Reference<T>(element);
   2665 	}
   2666 
   2667 //	template<class T>
   2668 //	RValue<Array<T>> operator++(Array<T> &val, int)
   2669 //	{
   2670 //		// FIXME: Requires storing the address of the array
   2671 //	}
   2672 
   2673 //	template<class T>
   2674 //	const Array<T> &operator++(Array<T> &val)
   2675 //	{
   2676 //		// FIXME: Requires storing the address of the array
   2677 //	}
   2678 
   2679 //	template<class T>
   2680 //	RValue<Array<T>> operator--(Array<T> &val, int)
   2681 //	{
   2682 //		// FIXME: Requires storing the address of the array
   2683 //	}
   2684 
   2685 //	template<class T>
   2686 //	const Array<T> &operator--(Array<T> &val)
   2687 //	{
   2688 //		// FIXME: Requires storing the address of the array
   2689 //	}
   2690 
   2691 	template<class T>
   2692 	RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, RValue<T> ifFalse)
   2693 	{
   2694 		return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, ifFalse.value));
   2695 	}
   2696 
   2697 	template<class T>
   2698 	RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, RValue<T> ifFalse)
   2699 	{
   2700 		Value *trueValue = ifTrue.loadValue();
   2701 
   2702 		return RValue<T>(Nucleus::createSelect(condition.value, trueValue, ifFalse.value));
   2703 	}
   2704 
   2705 	template<class T>
   2706 	RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, const T &ifFalse)
   2707 	{
   2708 		Value *falseValue = ifFalse.loadValue();
   2709 
   2710 		return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, falseValue));
   2711 	}
   2712 
   2713 	template<class T>
   2714 	RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, const T &ifFalse)
   2715 	{
   2716 		Value *trueValue = ifTrue.loadValue();
   2717 		Value *falseValue = ifFalse.loadValue();
   2718 
   2719 		return RValue<T>(Nucleus::createSelect(condition.value, trueValue, falseValue));
   2720 	}
   2721 
   2722 	template<class T>
   2723 	void Return(const Pointer<T> &ret)
   2724 	{
   2725 		Nucleus::createRet(Nucleus::createLoad(ret.address, Pointer<T>::getType()));
   2726 		Nucleus::setInsertBlock(Nucleus::createBasicBlock());
   2727 	}
   2728 
   2729 	template<class T>
   2730 	void Return(RValue<Pointer<T>> ret)
   2731 	{
   2732 		Nucleus::createRet(ret.value);
   2733 		Nucleus::setInsertBlock(Nucleus::createBasicBlock());
   2734 	}
   2735 
   2736 	template<typename Return, typename... Arguments>
   2737 	Function<Return(Arguments...)>::Function()
   2738 	{
   2739 		core = new Nucleus();
   2740 
   2741 		Type *types[] = {Arguments::getType()...};
   2742 		for(Type *type : types)
   2743 		{
   2744 			if(type != Void::getType())
   2745 			{
   2746 				arguments.push_back(type);
   2747 			}
   2748 		}
   2749 
   2750 		Nucleus::createFunction(Return::getType(), arguments);
   2751 	}
   2752 
   2753 	template<typename Return, typename... Arguments>
   2754 	Function<Return(Arguments...)>::~Function()
   2755 	{
   2756 		delete core;
   2757 	}
   2758 
   2759 	template<typename Return, typename... Arguments>
   2760 	Routine *Function<Return(Arguments...)>::operator()(const char *name, ...)
   2761 	{
   2762 		char fullName[1024 + 1];
   2763 
   2764 		va_list vararg;
   2765 		va_start(vararg, name);
   2766 		vsnprintf(fullName, 1024, name, vararg);
   2767 		va_end(vararg);
   2768 
   2769 		return core->acquireRoutine(fullName, true);
   2770 	}
   2771 
   2772 	template<class T, class S>
   2773 	RValue<T> ReinterpretCast(RValue<S> val)
   2774 	{
   2775 		return RValue<T>(Nucleus::createBitCast(val.value, T::getType()));
   2776 	}
   2777 
   2778 	template<class T, class S>
   2779 	RValue<T> ReinterpretCast(const LValue<S> &var)
   2780 	{
   2781 		Value *val = var.loadValue();
   2782 
   2783 		return RValue<T>(Nucleus::createBitCast(val, T::getType()));
   2784 	}
   2785 
   2786 	template<class T, class S>
   2787 	RValue<T> ReinterpretCast(const Reference<S> &var)
   2788 	{
   2789 		return ReinterpretCast<T>(RValue<S>(var));
   2790 	}
   2791 
   2792 	template<class T>
   2793 	RValue<T> As(Value *val)
   2794 	{
   2795 		return RValue<T>(Nucleus::createBitCast(val, T::getType()));
   2796 	}
   2797 
   2798 	template<class T, class S>
   2799 	RValue<T> As(RValue<S> val)
   2800 	{
   2801 		return ReinterpretCast<T>(val);
   2802 	}
   2803 
   2804 	template<class T, class S>
   2805 	RValue<T> As(const LValue<S> &var)
   2806 	{
   2807 		return ReinterpretCast<T>(var);
   2808 	}
   2809 
   2810 	template<class T, class S>
   2811 	RValue<T> As(const Reference<S> &val)
   2812 	{
   2813 		return ReinterpretCast<T>(val);
   2814 	}
   2815 
   2816 	class ForData
   2817 	{
   2818 	public:
   2819 		ForData(bool init) : loopOnce(init)
   2820 		{
   2821 		}
   2822 
   2823 		operator bool()
   2824 		{
   2825 			return loopOnce;
   2826 		}
   2827 
   2828 		bool operator=(bool value)
   2829 		{
   2830 			return loopOnce = value;
   2831 		}
   2832 
   2833 		bool setup()
   2834 		{
   2835 			if(Nucleus::getInsertBlock() != endBB)
   2836 			{
   2837 				testBB = Nucleus::createBasicBlock();
   2838 
   2839 				Nucleus::createBr(testBB);
   2840 				Nucleus::setInsertBlock(testBB);
   2841 
   2842 				return true;
   2843 			}
   2844 
   2845 			return false;
   2846 		}
   2847 
   2848 		bool test(RValue<Bool> cmp)
   2849 		{
   2850 			BasicBlock *bodyBB = Nucleus::createBasicBlock();
   2851 			endBB = Nucleus::createBasicBlock();
   2852 
   2853 			Nucleus::createCondBr(cmp.value, bodyBB, endBB);
   2854 			Nucleus::setInsertBlock(bodyBB);
   2855 
   2856 			return true;
   2857 		}
   2858 
   2859 		void end()
   2860 		{
   2861 			Nucleus::createBr(testBB);
   2862 			Nucleus::setInsertBlock(endBB);
   2863 		}
   2864 
   2865 	private:
   2866 		BasicBlock *testBB = nullptr;
   2867 		BasicBlock *endBB = nullptr;
   2868 		bool loopOnce = true;
   2869 	};
   2870 
   2871 	class IfElseData
   2872 	{
   2873 	public:
   2874 		IfElseData(RValue<Bool> cmp) : iteration(0)
   2875 		{
   2876 			condition = cmp.value;
   2877 
   2878 			beginBB = Nucleus::getInsertBlock();
   2879 			trueBB = Nucleus::createBasicBlock();
   2880 			falseBB = nullptr;
   2881 			endBB = Nucleus::createBasicBlock();
   2882 
   2883 			Nucleus::setInsertBlock(trueBB);
   2884 		}
   2885 
   2886 		~IfElseData()
   2887 		{
   2888 			Nucleus::createBr(endBB);
   2889 
   2890 			Nucleus::setInsertBlock(beginBB);
   2891 			Nucleus::createCondBr(condition, trueBB, falseBB ? falseBB : endBB);
   2892 
   2893 			Nucleus::setInsertBlock(endBB);
   2894 		}
   2895 
   2896 		operator int()
   2897 		{
   2898 			return iteration;
   2899 		}
   2900 
   2901 		IfElseData &operator++()
   2902 		{
   2903 			++iteration;
   2904 
   2905 			return *this;
   2906 		}
   2907 
   2908 		void elseClause()
   2909 		{
   2910 			Nucleus::createBr(endBB);
   2911 
   2912 			falseBB = Nucleus::createBasicBlock();
   2913 			Nucleus::setInsertBlock(falseBB);
   2914 		}
   2915 
   2916 	private:
   2917 		Value *condition;
   2918 		BasicBlock *beginBB;
   2919 		BasicBlock *trueBB;
   2920 		BasicBlock *falseBB;
   2921 		BasicBlock *endBB;
   2922 		int iteration;
   2923 	};
   2924 
   2925 	#define For(init, cond, inc) \
   2926 	for(ForData for__ = true; for__; for__ = false) \
   2927 	for(init; for__.setup() && for__.test(cond); inc, for__.end())
   2928 
   2929 	#define While(cond) For((void)0, cond, (void)0)
   2930 
   2931 	#define Do                                            \
   2932 	{                                                     \
   2933 		BasicBlock *body__ = Nucleus::createBasicBlock(); \
   2934 		Nucleus::createBr(body__);                        \
   2935 		Nucleus::setInsertBlock(body__);
   2936 
   2937 	#define Until(cond)                                     \
   2938 		BasicBlock *end__ = Nucleus::createBasicBlock();    \
   2939 		Nucleus::createCondBr((cond).value, end__, body__); \
   2940 		Nucleus::setInsertBlock(end__);                     \
   2941 	}
   2942 
   2943 	enum {IF_BLOCK__, ELSE_CLAUSE__, ELSE_BLOCK__, IFELSE_NUM__};
   2944 
   2945 	#define If(cond)                                                    \
   2946 	for(IfElseData ifElse__(cond); ifElse__ < IFELSE_NUM__; ++ifElse__) \
   2947 	if(ifElse__ == IF_BLOCK__)
   2948 
   2949 	#define Else                       \
   2950 	else if(ifElse__ == ELSE_CLAUSE__) \
   2951 	{                                  \
   2952 		 ifElse__.elseClause();        \
   2953 	}                                  \
   2954 	else   // ELSE_BLOCK__
   2955 }
   2956 
   2957 #endif   // rr_Reactor_hpp
   2958