blob: 6b6cdb40a867dd4ec83155f19da31274d54c063c [file] [log] [blame]
John Bauman89401822014-05-06 15:04:28 -04001// SwiftShader Software Renderer
2//
John Bauman19bac1e2014-05-06 15:23:49 -04003// Copyright(c) 2005-2012 TransGaming Inc.
John Bauman89401822014-05-06 15:04:28 -04004//
5// All rights reserved. No part of this software may be copied, distributed, transmitted,
6// transcribed, stored in a retrieval system, translated into any human or computer
7// language by any means, or disclosed to third parties without the explicit written
8// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
9// or implied, including but not limited to any patent rights, are granted to you.
10//
11
12#ifndef sw_Nucleus_hpp
13#define sw_Nucleus_hpp
14
15#include "Common/Types.hpp"
Nicolas Capensb7ea9842015-04-01 10:54:59 -040016#include "Common/MutexLock.hpp"
John Bauman89401822014-05-06 15:04:28 -040017
18#include <stdarg.h>
19#include <vector>
John Bauman66b8ab22014-05-06 15:57:45 -040020#include <stdio.h>
21#include <wchar.h>
John Bauman89401822014-05-06 15:04:28 -040022
23#undef abs
24#undef max
25#undef min
John Bauman66b8ab22014-05-06 15:57:45 -040026#undef Bool
John Bauman89401822014-05-06 15:04:28 -040027
28namespace llvm
29{
30 class Function;
31 class Module;
32 class BasicBlock;
33 class Value;
34 class Constant;
35 class ConstantInt;
36 class ConstantFP;
37 class Type;
38 class Argument;
39 class GlobalVariable;
40 class GlobalValue;
41 class ExecutionEngine;
42 class LLVMContext;
43}
44
45namespace sw
46{
47 enum Optimization
48 {
John Bauman19bac1e2014-05-06 15:23:49 -040049 Disabled = 0,
50 InstructionCombining = 1,
51 CFGSimplification = 2,
52 LICM = 3,
53 AggressiveDCE = 4,
54 GVN = 5,
55 Reassociate = 6,
56 DeadStoreElimination = 7,
57 SCCP = 8,
58 ScalarReplAggregates = 9,
John Bauman89401822014-05-06 15:04:28 -040059
60 OptimizationCount
61 };
62
63 extern Optimization optimization[10];
64
Nicolas Capensd946e0a2014-06-26 11:31:08 -040065 class Routine;
Nicolas Capens2fb41102014-06-26 10:11:50 -040066 class RoutineManager;
John Bauman89401822014-05-06 15:04:28 -040067 class Builder;
John Bauman89401822014-05-06 15:04:28 -040068
69 class Nucleus
70 {
71 public:
72 Nucleus();
73
74 virtual ~Nucleus();
75
76 Routine *acquireRoutine(const wchar_t *name, bool runOptimizations = true);
77
78 static void setFunction(llvm::Function *function);
79
80 static llvm::Module *getModule();
John Bauman89401822014-05-06 15:04:28 -040081 static llvm::Function *getFunction();
82 static llvm::LLVMContext *getContext();
83
John Bauman19bac1e2014-05-06 15:23:49 -040084 static llvm::Value *allocateStackVariable(llvm::Type *type, int arraySize = 0);
John Bauman89401822014-05-06 15:04:28 -040085 static llvm::BasicBlock *createBasicBlock();
86 static llvm::BasicBlock *getInsertBlock();
87 static void setInsertBlock(llvm::BasicBlock *basicBlock);
88 static llvm::BasicBlock *getPredecessor(llvm::BasicBlock *basicBlock);
89
John Bauman19bac1e2014-05-06 15:23:49 -040090 static llvm::Function *createFunction(llvm::Type *ReturnType, std::vector<llvm::Type*> &Params);
Nicolas Capens81f18302016-01-14 09:32:35 -050091 static llvm::Value *getArgument(llvm::Function *function, unsigned int index);
John Bauman89401822014-05-06 15:04:28 -040092
93 // Terminators
94 static llvm::Value *createRetVoid();
95 static llvm::Value *createRet(llvm::Value *V);
96 static llvm::Value *createBr(llvm::BasicBlock *dest);
97 static llvm::Value *createCondBr(llvm::Value *cond, llvm::BasicBlock *ifTrue, llvm::BasicBlock *ifFalse);
John Bauman66b8ab22014-05-06 15:57:45 -040098
John Bauman89401822014-05-06 15:04:28 -040099 // Binary operators
100 static llvm::Value *createAdd(llvm::Value *lhs, llvm::Value *rhs);
101 static llvm::Value *createSub(llvm::Value *lhs, llvm::Value *rhs);
102 static llvm::Value *createMul(llvm::Value *lhs, llvm::Value *rhs);
103 static llvm::Value *createUDiv(llvm::Value *lhs, llvm::Value *rhs);
104 static llvm::Value *createSDiv(llvm::Value *lhs, llvm::Value *rhs);
105 static llvm::Value *createFAdd(llvm::Value *lhs, llvm::Value *rhs);
106 static llvm::Value *createFSub(llvm::Value *lhs, llvm::Value *rhs);
107 static llvm::Value *createFMul(llvm::Value *lhs, llvm::Value *rhs);
108 static llvm::Value *createFDiv(llvm::Value *lhs, llvm::Value *rhs);
109 static llvm::Value *createURem(llvm::Value *lhs, llvm::Value *rhs);
110 static llvm::Value *createSRem(llvm::Value *lhs, llvm::Value *rhs);
111 static llvm::Value *createFRem(llvm::Value *lhs, llvm::Value *rhs);
112 static llvm::Value *createShl(llvm::Value *lhs, llvm::Value *rhs);
113 static llvm::Value *createLShr(llvm::Value *lhs, llvm::Value *rhs);
114 static llvm::Value *createAShr(llvm::Value *lhs, llvm::Value *rhs);
115 static llvm::Value *createAnd(llvm::Value *lhs, llvm::Value *rhs);
116 static llvm::Value *createOr(llvm::Value *lhs, llvm::Value *rhs);
117 static llvm::Value *createXor(llvm::Value *lhs, llvm::Value *rhs);
118 static llvm::Value *createNeg(llvm::Value *V);
119 static llvm::Value *createFNeg(llvm::Value *V);
120 static llvm::Value *createNot(llvm::Value *V);
John Bauman66b8ab22014-05-06 15:57:45 -0400121
John Bauman89401822014-05-06 15:04:28 -0400122 // Memory instructions
123 static llvm::Value *createLoad(llvm::Value *ptr, bool isVolatile = false, unsigned int align = 0);
124 static llvm::Value *createStore(llvm::Value *value, llvm::Value *ptr, bool isVolatile = false, unsigned int align = 0);
125 static llvm::Value *createGEP(llvm::Value *ptr, llvm::Value *index);
126
John Bauman19bac1e2014-05-06 15:23:49 -0400127 // Atomic instructions
128 static llvm::Value *createAtomicAdd(llvm::Value *ptr, llvm::Value *value);
129
John Bauman89401822014-05-06 15:04:28 -0400130 // Cast/Conversion Operators
John Bauman19bac1e2014-05-06 15:23:49 -0400131 static llvm::Value *createTrunc(llvm::Value *V, llvm::Type *destType);
132 static llvm::Value *createZExt(llvm::Value *V, llvm::Type *destType);
133 static llvm::Value *createSExt(llvm::Value *V, llvm::Type *destType);
134 static llvm::Value *createFPToUI(llvm::Value *V, llvm::Type *destType);
135 static llvm::Value *createFPToSI(llvm::Value *V, llvm::Type *destType);
136 static llvm::Value *createUIToFP(llvm::Value *V, llvm::Type *destType);
137 static llvm::Value *createSIToFP(llvm::Value *V, llvm::Type *destType);
138 static llvm::Value *createFPTrunc(llvm::Value *V, llvm::Type *destType);
139 static llvm::Value *createFPExt(llvm::Value *V, llvm::Type *destType);
140 static llvm::Value *createPtrToInt(llvm::Value *V, llvm::Type *destType);
141 static llvm::Value *createIntToPtr(llvm::Value *V, llvm::Type *destType);
142 static llvm::Value *createBitCast(llvm::Value *V, llvm::Type *destType);
143 static llvm::Value *createIntCast(llvm::Value *V, llvm::Type *destType, bool isSigned);
John Bauman89401822014-05-06 15:04:28 -0400144
145 // Compare instructions
146 static llvm::Value *createICmpEQ(llvm::Value *lhs, llvm::Value *rhs);
147 static llvm::Value *createICmpNE(llvm::Value *lhs, llvm::Value *rhs);
148 static llvm::Value *createICmpUGT(llvm::Value *lhs, llvm::Value *rhs);
149 static llvm::Value *createICmpUGE(llvm::Value *lhs, llvm::Value *rhs);
150 static llvm::Value *createICmpULT(llvm::Value *lhs, llvm::Value *rhs);
151 static llvm::Value *createICmpULE(llvm::Value *lhs, llvm::Value *rhs);
152 static llvm::Value *createICmpSGT(llvm::Value *lhs, llvm::Value *rhs);
153 static llvm::Value *createICmpSGE(llvm::Value *lhs, llvm::Value *rhs);
154 static llvm::Value *createICmpSLT(llvm::Value *lhs, llvm::Value *rhs);
155 static llvm::Value *createICmpSLE(llvm::Value *lhs, llvm::Value *rhs);
156 static llvm::Value *createFCmpOEQ(llvm::Value *lhs, llvm::Value *rhs);
157 static llvm::Value *createFCmpOGT(llvm::Value *lhs, llvm::Value *rhs);
158 static llvm::Value *createFCmpOGE(llvm::Value *lhs, llvm::Value *rhs);
159 static llvm::Value *createFCmpOLT(llvm::Value *lhs, llvm::Value *rhs);
160 static llvm::Value *createFCmpOLE(llvm::Value *lhs, llvm::Value *rhs);
161 static llvm::Value *createFCmpONE(llvm::Value *lhs, llvm::Value *rhs);
162 static llvm::Value *createFCmpORD(llvm::Value *lhs, llvm::Value *rhs);
163 static llvm::Value *createFCmpUNO(llvm::Value *lhs, llvm::Value *rhs);
164 static llvm::Value *createFCmpUEQ(llvm::Value *lhs, llvm::Value *rhs);
165 static llvm::Value *createFCmpUGT(llvm::Value *lhs, llvm::Value *rhs);
166 static llvm::Value *createFCmpUGE(llvm::Value *lhs, llvm::Value *rhs);
167 static llvm::Value *createFCmpULT(llvm::Value *lhs, llvm::Value *rhs);
168 static llvm::Value *createFCmpULE(llvm::Value *lhs, llvm::Value *rhs);
169 static llvm::Value *createFCmpUNE(llvm::Value *lhs, llvm::Value *rhs);
170
171 // Call instructions
172 static llvm::Value *createCall(llvm::Value *callee);
173 static llvm::Value *createCall(llvm::Value *callee, llvm::Value *Arg);
174 static llvm::Value *createCall(llvm::Value *callee, llvm::Value *Arg1, llvm::Value *Arg2);
175 static llvm::Value *createCall(llvm::Value *callee, llvm::Value *Arg1, llvm::Value *Arg2, llvm::Value *Arg3);
176 static llvm::Value *createCall(llvm::Value *callee, llvm::Value *Arg1, llvm::Value *Arg2, llvm::Value *Arg3,llvm::Value *Arg4);
177
178 // Vector instructions
179 static llvm::Value *createExtractElement(llvm::Value *vector, int index);
180 static llvm::Value *createInsertElement(llvm::Value *vector, llvm::Value *element, int index);
181 static llvm::Value *createShuffleVector(llvm::Value *V1, llvm::Value *V2, llvm::Value *mask);
182
183 // Other instructions
184 static llvm::Value *createSelect(llvm::Value *C, llvm::Value *ifTrue, llvm::Value *ifFalse);
John Bauman19bac1e2014-05-06 15:23:49 -0400185 static llvm::Value *createSwitch(llvm::Value *V, llvm::BasicBlock *Dest, unsigned NumCases);
John Bauman89401822014-05-06 15:04:28 -0400186 static void addSwitchCase(llvm::Value *Switch, int Case, llvm::BasicBlock *Branch);
187 static llvm::Value *createUnreachable();
188
189 // Derived instructions
190 static llvm::Value *createSwizzle(llvm::Value *val, unsigned char select);
191 static llvm::Value *createMask(llvm::Value *lhs, llvm::Value *rhs, unsigned char select);
192
193 // Global values
194 static const llvm::GlobalValue *getGlobalValueAtAddress(void *Addr);
195 static void addGlobalMapping(const llvm::GlobalValue *GV, void *Addr);
John Bauman19bac1e2014-05-06 15:23:49 -0400196 static llvm::GlobalValue *createGlobalValue(llvm::Type *Ty, bool isConstant, unsigned int Align);
197 static llvm::Type *getPointerType(llvm::Type *ElementType);
John Bauman89401822014-05-06 15:04:28 -0400198
199 // Constant values
John Bauman19bac1e2014-05-06 15:23:49 -0400200 static llvm::Constant *createNullValue(llvm::Type *Ty);
John Bauman66b8ab22014-05-06 15:57:45 -0400201 static llvm::ConstantInt *createConstantInt(int64_t i);
John Bauman89401822014-05-06 15:04:28 -0400202 static llvm::ConstantInt *createConstantInt(int i);
203 static llvm::ConstantInt *createConstantInt(unsigned int i);
204 static llvm::ConstantInt *createConstantBool(bool b);
205 static llvm::ConstantInt *createConstantByte(signed char i);
206 static llvm::ConstantInt *createConstantByte(unsigned char i);
207 static llvm::ConstantInt *createConstantShort(short i);
208 static llvm::ConstantInt *createConstantShort(unsigned short i);
209 static llvm::Constant *createConstantFloat(float x);
John Bauman19bac1e2014-05-06 15:23:49 -0400210 static llvm::Value *createNullPointer(llvm::Type *Ty);
211 static llvm::Value *createConstantVector(llvm::Constant *const *Vals, unsigned NumVals);
John Bauman89401822014-05-06 15:04:28 -0400212
213 private:
214 void optimize();
215
216 static llvm::ExecutionEngine *executionEngine;
217 static Builder *builder;
218 static llvm::Function *function;
219 static llvm::LLVMContext *context;
220 static llvm::Module *module;
Nicolas Capens2fb41102014-06-26 10:11:50 -0400221 static RoutineManager *routineManager;
Nicolas Capensb7ea9842015-04-01 10:54:59 -0400222
223 static BackoffLock codegenMutex;
John Bauman89401822014-05-06 15:04:28 -0400224 };
225
226 class Byte;
227 class SByte;
228 class Byte4;
229 class SByte4;
230 class Byte8;
231 class SByte8;
232 class Byte16;
233 class SByte16;
234 class Short;
235 class UShort;
236 class Short4;
237 class UShort4;
238 class Short8;
239 class UShort8;
240 class Int;
241 class UInt;
242 class Int2;
243 class UInt2;
244 class Int4;
245 class UInt4;
246 class Long;
247 class Long1;
248 class Long2;
249 class Float;
250 class Float2;
251 class Float4;
252
253 class Void
254 {
255 public:
John Bauman19bac1e2014-05-06 15:23:49 -0400256 static llvm::Type *getType();
John Bauman66b8ab22014-05-06 15:57:45 -0400257
John Bauman89401822014-05-06 15:04:28 -0400258 static bool isVoid()
259 {
260 return true;
261 }
262
263 typedef void ctype;
264 };
265
266 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -0400267 class RValue;
268
269 template<class T>
270 class Pointer;
271
272 class LValue
John Bauman89401822014-05-06 15:04:28 -0400273 {
274 public:
John Bauman66b8ab22014-05-06 15:57:45 -0400275 LValue(llvm::Type *type, int arraySize = 0);
276
John Bauman89401822014-05-06 15:04:28 -0400277 static bool isVoid()
278 {
279 return false;
280 }
281
John Bauman66b8ab22014-05-06 15:57:45 -0400282 llvm::Value *loadValue(unsigned int alignment = 0) const;
283 llvm::Value *storeValue(llvm::Value *value, unsigned int alignment = 0) const;
284 llvm::Value *getAddress(llvm::Value *index) const;
285
Nicolas Capens08e90f02014-11-21 12:49:12 -0500286 protected:
John Bauman89401822014-05-06 15:04:28 -0400287 llvm::Value *address;
John Bauman89401822014-05-06 15:04:28 -0400288 };
289
290 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -0400291 class Variable : public LValue
292 {
293 public:
294 Variable(int arraySize = 0);
295
Nicolas Capens81f18302016-01-14 09:32:35 -0500296 RValue<Pointer<T>> operator&();
John Bauman66b8ab22014-05-06 15:57:45 -0400297 };
John Bauman89401822014-05-06 15:04:28 -0400298
299 template<class T>
300 class Reference
301 {
John Bauman89401822014-05-06 15:04:28 -0400302 public:
303 explicit Reference(llvm::Value *pointer, int alignment = 1);
304
John Bauman19bac1e2014-05-06 15:23:49 -0400305 RValue<T> operator=(RValue<T> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400306 RValue<T> operator=(const Reference<T> &ref) const;
307
John Bauman19bac1e2014-05-06 15:23:49 -0400308 RValue<T> operator+=(RValue<T> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400309
John Bauman66b8ab22014-05-06 15:57:45 -0400310 llvm::Value *loadValue() const;
311 int getAlignment() const;
312
John Bauman89401822014-05-06 15:04:28 -0400313 private:
314 llvm::Value *address;
315
316 const int alignment;
317 };
318
319 template<class T>
320 struct IntLiteral
321 {
322 struct type;
323 };
324
325 template<> struct
326 IntLiteral<Int>
327 {
328 typedef int type;
329 };
330
John Bauman66b8ab22014-05-06 15:57:45 -0400331 template<> struct
332 IntLiteral<UInt>
333 {
334 typedef unsigned int type;
335 };
336
337 template<> struct
338 IntLiteral<Long>
339 {
340 typedef int64_t type;
341 };
342
343 template<class T>
344 struct FloatLiteral
345 {
346 struct type;
347 };
348
349 template<> struct
350 FloatLiteral<Float>
351 {
352 typedef float type;
353 };
354
John Bauman89401822014-05-06 15:04:28 -0400355 template<class T>
356 class RValue
357 {
358 public:
359 explicit RValue(llvm::Value *rvalue);
360
361 RValue(const T &lvalue);
362 RValue(typename IntLiteral<T>::type i);
John Bauman66b8ab22014-05-06 15:57:45 -0400363 RValue(typename FloatLiteral<T>::type f);
364 RValue(const Reference<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400365
Nicolas Capens698633a2015-02-04 00:16:13 -0500366 RValue<T> &operator=(const RValue<T>&) = delete;
367
John Bauman89401822014-05-06 15:04:28 -0400368 llvm::Value *value; // FIXME: Make private
369 };
370
Nicolas Capens81f18302016-01-14 09:32:35 -0500371 template<typename T>
372 struct Argument
373 {
374 explicit Argument(llvm::Value *value) : value(value) {}
375
376 llvm::Value *value;
377 };
378
John Bauman66b8ab22014-05-06 15:57:45 -0400379 class MMX : public Variable<MMX>
John Bauman19bac1e2014-05-06 15:23:49 -0400380 {
381 public:
382 static llvm::Type *getType();
383 };
384
John Bauman66b8ab22014-05-06 15:57:45 -0400385 class Bool : public Variable<Bool>
John Bauman89401822014-05-06 15:04:28 -0400386 {
387 public:
Nicolas Capens81f18302016-01-14 09:32:35 -0500388 Bool(Argument<Bool> argument);
John Bauman89401822014-05-06 15:04:28 -0400389
390 Bool();
391 Bool(bool x);
John Bauman19bac1e2014-05-06 15:23:49 -0400392 Bool(RValue<Bool> rhs);
John Bauman89401822014-05-06 15:04:28 -0400393 Bool(const Bool &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400394 Bool(const Reference<Bool> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400395
396 // RValue<Bool> operator=(bool rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400397 RValue<Bool> operator=(RValue<Bool> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400398 RValue<Bool> operator=(const Bool &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400399 RValue<Bool> operator=(const Reference<Bool> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400400
John Bauman19bac1e2014-05-06 15:23:49 -0400401 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400402 };
403
Nicolas Capens08e90f02014-11-21 12:49:12 -0500404 RValue<Bool> operator!(RValue<Bool> val);
405 RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs);
406 RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs);
407
John Bauman66b8ab22014-05-06 15:57:45 -0400408 class Byte : public Variable<Byte>
John Bauman89401822014-05-06 15:04:28 -0400409 {
410 public:
Nicolas Capens81f18302016-01-14 09:32:35 -0500411 Byte(Argument<Byte> argument);
John Bauman89401822014-05-06 15:04:28 -0400412
John Bauman19bac1e2014-05-06 15:23:49 -0400413 explicit Byte(RValue<Int> cast);
Alexis Hetu77dfab42015-11-23 13:31:22 -0500414 explicit Byte(RValue<UInt> cast);
415 explicit Byte(RValue<UShort> cast);
John Bauman89401822014-05-06 15:04:28 -0400416
417 Byte();
418 Byte(int x);
419 Byte(unsigned char x);
John Bauman19bac1e2014-05-06 15:23:49 -0400420 Byte(RValue<Byte> rhs);
John Bauman89401822014-05-06 15:04:28 -0400421 Byte(const Byte &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400422 Byte(const Reference<Byte> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400423
424 // RValue<Byte> operator=(unsigned char rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400425 RValue<Byte> operator=(RValue<Byte> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400426 RValue<Byte> operator=(const Byte &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400427 RValue<Byte> operator=(const Reference<Byte> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400428
John Bauman19bac1e2014-05-06 15:23:49 -0400429 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400430 };
431
Nicolas Capens08e90f02014-11-21 12:49:12 -0500432 RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs);
433 RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs);
434 RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs);
435 RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs);
436 RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs);
437 RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs);
438 RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs);
439 RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs);
440 RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs);
441 RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs);
442 RValue<Byte> operator+=(const Byte &lhs, RValue<Byte> rhs);
443 RValue<Byte> operator-=(const Byte &lhs, RValue<Byte> rhs);
444 RValue<Byte> operator*=(const Byte &lhs, RValue<Byte> rhs);
445 RValue<Byte> operator/=(const Byte &lhs, RValue<Byte> rhs);
446 RValue<Byte> operator%=(const Byte &lhs, RValue<Byte> rhs);
447 RValue<Byte> operator&=(const Byte &lhs, RValue<Byte> rhs);
448 RValue<Byte> operator|=(const Byte &lhs, RValue<Byte> rhs);
449 RValue<Byte> operator^=(const Byte &lhs, RValue<Byte> rhs);
450 RValue<Byte> operator<<=(const Byte &lhs, RValue<Byte> rhs);
451 RValue<Byte> operator>>=(const Byte &lhs, RValue<Byte> rhs);
452 RValue<Byte> operator+(RValue<Byte> val);
453 RValue<Byte> operator-(RValue<Byte> val);
454 RValue<Byte> operator~(RValue<Byte> val);
455 RValue<Byte> operator++(const Byte &val, int); // Post-increment
456 const Byte &operator++(const Byte &val); // Pre-increment
457 RValue<Byte> operator--(const Byte &val, int); // Post-decrement
458 const Byte &operator--(const Byte &val); // Pre-decrement
459 RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs);
460 RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs);
461 RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs);
462 RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs);
463 RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs);
464 RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs);
465
John Bauman66b8ab22014-05-06 15:57:45 -0400466 class SByte : public Variable<SByte>
John Bauman89401822014-05-06 15:04:28 -0400467 {
468 public:
Nicolas Capens81f18302016-01-14 09:32:35 -0500469 SByte(Argument<SByte> argument);
John Bauman89401822014-05-06 15:04:28 -0400470
Alexis Hetu77dfab42015-11-23 13:31:22 -0500471 explicit SByte(RValue<Int> cast);
472 explicit SByte(RValue<Short> cast);
473
John Bauman89401822014-05-06 15:04:28 -0400474 SByte();
475 SByte(signed char x);
John Bauman19bac1e2014-05-06 15:23:49 -0400476 SByte(RValue<SByte> rhs);
John Bauman89401822014-05-06 15:04:28 -0400477 SByte(const SByte &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400478 SByte(const Reference<SByte> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400479
480 // RValue<SByte> operator=(signed char rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400481 RValue<SByte> operator=(RValue<SByte> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400482 RValue<SByte> operator=(const SByte &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400483 RValue<SByte> operator=(const Reference<SByte> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400484
John Bauman19bac1e2014-05-06 15:23:49 -0400485 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400486 };
487
Nicolas Capens08e90f02014-11-21 12:49:12 -0500488 RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs);
489 RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs);
490 RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs);
491 RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs);
492 RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs);
493 RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs);
494 RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs);
495 RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs);
496 RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs);
497 RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs);
498 RValue<SByte> operator+=(const SByte &lhs, RValue<SByte> rhs);
499 RValue<SByte> operator-=(const SByte &lhs, RValue<SByte> rhs);
500 RValue<SByte> operator*=(const SByte &lhs, RValue<SByte> rhs);
501 RValue<SByte> operator/=(const SByte &lhs, RValue<SByte> rhs);
502 RValue<SByte> operator%=(const SByte &lhs, RValue<SByte> rhs);
503 RValue<SByte> operator&=(const SByte &lhs, RValue<SByte> rhs);
504 RValue<SByte> operator|=(const SByte &lhs, RValue<SByte> rhs);
505 RValue<SByte> operator^=(const SByte &lhs, RValue<SByte> rhs);
506 RValue<SByte> operator<<=(const SByte &lhs, RValue<SByte> rhs);
507 RValue<SByte> operator>>=(const SByte &lhs, RValue<SByte> rhs);
508 RValue<SByte> operator+(RValue<SByte> val);
509 RValue<SByte> operator-(RValue<SByte> val);
510 RValue<SByte> operator~(RValue<SByte> val);
511 RValue<SByte> operator++(const SByte &val, int); // Post-increment
512 const SByte &operator++(const SByte &val); // Pre-increment
513 RValue<SByte> operator--(const SByte &val, int); // Post-decrement
514 const SByte &operator--(const SByte &val); // Pre-decrement
515 RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs);
516 RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs);
517 RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs);
518 RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs);
519 RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs);
520 RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs);
521
John Bauman66b8ab22014-05-06 15:57:45 -0400522 class Short : public Variable<Short>
John Bauman89401822014-05-06 15:04:28 -0400523 {
524 public:
Nicolas Capens81f18302016-01-14 09:32:35 -0500525 Short(Argument<Short> argument);
John Bauman89401822014-05-06 15:04:28 -0400526
John Bauman19bac1e2014-05-06 15:23:49 -0400527 explicit Short(RValue<Int> cast);
John Bauman89401822014-05-06 15:04:28 -0400528
529 Short();
530 Short(short x);
John Bauman19bac1e2014-05-06 15:23:49 -0400531 Short(RValue<Short> rhs);
John Bauman89401822014-05-06 15:04:28 -0400532 Short(const Short &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400533 Short(const Reference<Short> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400534
535 // RValue<Short> operator=(short rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400536 RValue<Short> operator=(RValue<Short> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400537 RValue<Short> operator=(const Short &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400538 RValue<Short> operator=(const Reference<Short> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400539
John Bauman19bac1e2014-05-06 15:23:49 -0400540 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400541 };
542
Nicolas Capens08e90f02014-11-21 12:49:12 -0500543 RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs);
544 RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs);
545 RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs);
546 RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs);
547 RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs);
548 RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs);
549 RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs);
550 RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs);
551 RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs);
552 RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs);
553 RValue<Short> operator+=(const Short &lhs, RValue<Short> rhs);
554 RValue<Short> operator-=(const Short &lhs, RValue<Short> rhs);
555 RValue<Short> operator*=(const Short &lhs, RValue<Short> rhs);
556 RValue<Short> operator/=(const Short &lhs, RValue<Short> rhs);
557 RValue<Short> operator%=(const Short &lhs, RValue<Short> rhs);
558 RValue<Short> operator&=(const Short &lhs, RValue<Short> rhs);
559 RValue<Short> operator|=(const Short &lhs, RValue<Short> rhs);
560 RValue<Short> operator^=(const Short &lhs, RValue<Short> rhs);
561 RValue<Short> operator<<=(const Short &lhs, RValue<Short> rhs);
562 RValue<Short> operator>>=(const Short &lhs, RValue<Short> rhs);
563 RValue<Short> operator+(RValue<Short> val);
564 RValue<Short> operator-(RValue<Short> val);
565 RValue<Short> operator~(RValue<Short> val);
566 RValue<Short> operator++(const Short &val, int); // Post-increment
567 const Short &operator++(const Short &val); // Pre-increment
568 RValue<Short> operator--(const Short &val, int); // Post-decrement
569 const Short &operator--(const Short &val); // Pre-decrement
570 RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs);
571 RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs);
572 RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs);
573 RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs);
574 RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs);
575 RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs);
576
John Bauman66b8ab22014-05-06 15:57:45 -0400577 class UShort : public Variable<UShort>
John Bauman89401822014-05-06 15:04:28 -0400578 {
579 public:
Nicolas Capens81f18302016-01-14 09:32:35 -0500580 UShort(Argument<UShort> argument);
John Bauman89401822014-05-06 15:04:28 -0400581
Alexis Hetu77dfab42015-11-23 13:31:22 -0500582 explicit UShort(RValue<UInt> cast);
Alexis Hetu75b650f2015-11-19 17:40:15 -0500583 explicit UShort(RValue<Int> cast);
Alexis Hetu77dfab42015-11-23 13:31:22 -0500584
John Bauman89401822014-05-06 15:04:28 -0400585 UShort();
586 UShort(unsigned short x);
John Bauman19bac1e2014-05-06 15:23:49 -0400587 UShort(RValue<UShort> rhs);
John Bauman89401822014-05-06 15:04:28 -0400588 UShort(const UShort &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400589 UShort(const Reference<UShort> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400590
591 // RValue<UShort> operator=(unsigned short rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400592 RValue<UShort> operator=(RValue<UShort> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400593 RValue<UShort> operator=(const UShort &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400594 RValue<UShort> operator=(const Reference<UShort> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400595
John Bauman19bac1e2014-05-06 15:23:49 -0400596 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400597 };
598
Nicolas Capens08e90f02014-11-21 12:49:12 -0500599 RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs);
600 RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs);
601 RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs);
602 RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs);
603 RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs);
604 RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs);
605 RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs);
606 RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs);
607 RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs);
608 RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs);
609 RValue<UShort> operator+=(const UShort &lhs, RValue<UShort> rhs);
610 RValue<UShort> operator-=(const UShort &lhs, RValue<UShort> rhs);
611 RValue<UShort> operator*=(const UShort &lhs, RValue<UShort> rhs);
612 RValue<UShort> operator/=(const UShort &lhs, RValue<UShort> rhs);
613 RValue<UShort> operator%=(const UShort &lhs, RValue<UShort> rhs);
614 RValue<UShort> operator&=(const UShort &lhs, RValue<UShort> rhs);
615 RValue<UShort> operator|=(const UShort &lhs, RValue<UShort> rhs);
616 RValue<UShort> operator^=(const UShort &lhs, RValue<UShort> rhs);
617 RValue<UShort> operator<<=(const UShort &lhs, RValue<UShort> rhs);
618 RValue<UShort> operator>>=(const UShort &lhs, RValue<UShort> rhs);
619 RValue<UShort> operator+(RValue<UShort> val);
620 RValue<UShort> operator-(RValue<UShort> val);
621 RValue<UShort> operator~(RValue<UShort> val);
622 RValue<UShort> operator++(const UShort &val, int); // Post-increment
623 const UShort &operator++(const UShort &val); // Pre-increment
624 RValue<UShort> operator--(const UShort &val, int); // Post-decrement
625 const UShort &operator--(const UShort &val); // Pre-decrement
626 RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs);
627 RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs);
628 RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs);
629 RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs);
630 RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs);
631 RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs);
632
John Bauman66b8ab22014-05-06 15:57:45 -0400633 class Byte4 : public Variable<Byte4>
John Bauman89401822014-05-06 15:04:28 -0400634 {
635 public:
636 // Byte4();
637 // Byte4(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400638 // Byte4(RValue<Byte4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400639 // Byte4(const Byte4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400640 // Byte4(const Reference<Byte4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400641
John Bauman19bac1e2014-05-06 15:23:49 -0400642 // RValue<Byte4> operator=(RValue<Byte4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400643 // RValue<Byte4> operator=(const Byte4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400644 // RValue<Byte4> operator=(const Reference<Byte4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400645
John Bauman19bac1e2014-05-06 15:23:49 -0400646 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400647 };
648
Nicolas Capens08e90f02014-11-21 12:49:12 -0500649// RValue<Byte4> operator+(RValue<Byte4> lhs, RValue<Byte4> rhs);
650// RValue<Byte4> operator-(RValue<Byte4> lhs, RValue<Byte4> rhs);
651// RValue<Byte4> operator*(RValue<Byte4> lhs, RValue<Byte4> rhs);
652// RValue<Byte4> operator/(RValue<Byte4> lhs, RValue<Byte4> rhs);
653// RValue<Byte4> operator%(RValue<Byte4> lhs, RValue<Byte4> rhs);
654// RValue<Byte4> operator&(RValue<Byte4> lhs, RValue<Byte4> rhs);
655// RValue<Byte4> operator|(RValue<Byte4> lhs, RValue<Byte4> rhs);
656// RValue<Byte4> operator^(RValue<Byte4> lhs, RValue<Byte4> rhs);
657// RValue<Byte4> operator<<(RValue<Byte4> lhs, RValue<Byte4> rhs);
658// RValue<Byte4> operator>>(RValue<Byte4> lhs, RValue<Byte4> rhs);
659// RValue<Byte4> operator+=(const Byte4 &lhs, RValue<Byte4> rhs);
660// RValue<Byte4> operator-=(const Byte4 &lhs, RValue<Byte4> rhs);
661// RValue<Byte4> operator*=(const Byte4 &lhs, RValue<Byte4> rhs);
662// RValue<Byte4> operator/=(const Byte4 &lhs, RValue<Byte4> rhs);
663// RValue<Byte4> operator%=(const Byte4 &lhs, RValue<Byte4> rhs);
664// RValue<Byte4> operator&=(const Byte4 &lhs, RValue<Byte4> rhs);
665// RValue<Byte4> operator|=(const Byte4 &lhs, RValue<Byte4> rhs);
666// RValue<Byte4> operator^=(const Byte4 &lhs, RValue<Byte4> rhs);
667// RValue<Byte4> operator<<=(const Byte4 &lhs, RValue<Byte4> rhs);
668// RValue<Byte4> operator>>=(const Byte4 &lhs, RValue<Byte4> rhs);
669// RValue<Byte4> operator+(RValue<Byte4> val);
670// RValue<Byte4> operator-(RValue<Byte4> val);
671// RValue<Byte4> operator~(RValue<Byte4> val);
672// RValue<Byte4> operator++(const Byte4 &val, int); // Post-increment
673// const Byte4 &operator++(const Byte4 &val); // Pre-increment
674// RValue<Byte4> operator--(const Byte4 &val, int); // Post-decrement
675// const Byte4 &operator--(const Byte4 &val); // Pre-decrement
676
John Bauman66b8ab22014-05-06 15:57:45 -0400677 class SByte4 : public Variable<SByte4>
John Bauman89401822014-05-06 15:04:28 -0400678 {
679 public:
680 // SByte4();
681 // SByte4(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400682 // SByte4(RValue<SByte4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400683 // SByte4(const SByte4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400684 // SByte4(const Reference<SByte4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400685
John Bauman19bac1e2014-05-06 15:23:49 -0400686 // RValue<SByte4> operator=(RValue<SByte4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400687 // RValue<SByte4> operator=(const SByte4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400688 // RValue<SByte4> operator=(const Reference<SByte4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400689
John Bauman19bac1e2014-05-06 15:23:49 -0400690 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400691 };
692
Nicolas Capens08e90f02014-11-21 12:49:12 -0500693// RValue<SByte4> operator+(RValue<SByte4> lhs, RValue<SByte4> rhs);
694// RValue<SByte4> operator-(RValue<SByte4> lhs, RValue<SByte4> rhs);
695// RValue<SByte4> operator*(RValue<SByte4> lhs, RValue<SByte4> rhs);
696// RValue<SByte4> operator/(RValue<SByte4> lhs, RValue<SByte4> rhs);
697// RValue<SByte4> operator%(RValue<SByte4> lhs, RValue<SByte4> rhs);
698// RValue<SByte4> operator&(RValue<SByte4> lhs, RValue<SByte4> rhs);
699// RValue<SByte4> operator|(RValue<SByte4> lhs, RValue<SByte4> rhs);
700// RValue<SByte4> operator^(RValue<SByte4> lhs, RValue<SByte4> rhs);
701// RValue<SByte4> operator<<(RValue<SByte4> lhs, RValue<SByte4> rhs);
702// RValue<SByte4> operator>>(RValue<SByte4> lhs, RValue<SByte4> rhs);
703// RValue<SByte4> operator+=(const SByte4 &lhs, RValue<SByte4> rhs);
704// RValue<SByte4> operator-=(const SByte4 &lhs, RValue<SByte4> rhs);
705// RValue<SByte4> operator*=(const SByte4 &lhs, RValue<SByte4> rhs);
706// RValue<SByte4> operator/=(const SByte4 &lhs, RValue<SByte4> rhs);
707// RValue<SByte4> operator%=(const SByte4 &lhs, RValue<SByte4> rhs);
708// RValue<SByte4> operator&=(const SByte4 &lhs, RValue<SByte4> rhs);
709// RValue<SByte4> operator|=(const SByte4 &lhs, RValue<SByte4> rhs);
710// RValue<SByte4> operator^=(const SByte4 &lhs, RValue<SByte4> rhs);
711// RValue<SByte4> operator<<=(const SByte4 &lhs, RValue<SByte4> rhs);
712// RValue<SByte4> operator>>=(const SByte4 &lhs, RValue<SByte4> rhs);
713// RValue<SByte4> operator+(RValue<SByte4> val);
714// RValue<SByte4> operator-(RValue<SByte4> val);
715// RValue<SByte4> operator~(RValue<SByte4> val);
716// RValue<SByte4> operator++(const SByte4 &val, int); // Post-increment
717// const SByte4 &operator++(const SByte4 &val); // Pre-increment
718// RValue<SByte4> operator--(const SByte4 &val, int); // Post-decrement
719// const SByte4 &operator--(const SByte4 &val); // Pre-decrement
720
John Bauman66b8ab22014-05-06 15:57:45 -0400721 class Byte8 : public Variable<Byte8>
John Bauman89401822014-05-06 15:04:28 -0400722 {
723 public:
724 Byte8();
725 Byte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7);
726 Byte8(int64_t x);
John Bauman19bac1e2014-05-06 15:23:49 -0400727 Byte8(RValue<Byte8> rhs);
John Bauman89401822014-05-06 15:04:28 -0400728 Byte8(const Byte8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400729 Byte8(const Reference<Byte8> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400730
John Bauman19bac1e2014-05-06 15:23:49 -0400731 RValue<Byte8> operator=(RValue<Byte8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400732 RValue<Byte8> operator=(const Byte8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400733 RValue<Byte8> operator=(const Reference<Byte8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400734
John Bauman19bac1e2014-05-06 15:23:49 -0400735 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400736 };
737
Nicolas Capens08e90f02014-11-21 12:49:12 -0500738 RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs);
739 RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs);
740// RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs);
741// RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs);
742// RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs);
743 RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs);
744 RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs);
745 RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs);
746// RValue<Byte8> operator<<(RValue<Byte8> lhs, RValue<Byte8> rhs);
747// RValue<Byte8> operator>>(RValue<Byte8> lhs, RValue<Byte8> rhs);
748 RValue<Byte8> operator+=(const Byte8 &lhs, RValue<Byte8> rhs);
749 RValue<Byte8> operator-=(const Byte8 &lhs, RValue<Byte8> rhs);
750// RValue<Byte8> operator*=(const Byte8 &lhs, RValue<Byte8> rhs);
751// RValue<Byte8> operator/=(const Byte8 &lhs, RValue<Byte8> rhs);
752// RValue<Byte8> operator%=(const Byte8 &lhs, RValue<Byte8> rhs);
753 RValue<Byte8> operator&=(const Byte8 &lhs, RValue<Byte8> rhs);
754 RValue<Byte8> operator|=(const Byte8 &lhs, RValue<Byte8> rhs);
755 RValue<Byte8> operator^=(const Byte8 &lhs, RValue<Byte8> rhs);
756// RValue<Byte8> operator<<=(const Byte8 &lhs, RValue<Byte8> rhs);
757// RValue<Byte8> operator>>=(const Byte8 &lhs, RValue<Byte8> rhs);
758// RValue<Byte8> operator+(RValue<Byte8> val);
759// RValue<Byte8> operator-(RValue<Byte8> val);
760 RValue<Byte8> operator~(RValue<Byte8> val);
761// RValue<Byte8> operator++(const Byte8 &val, int); // Post-increment
762// const Byte8 &operator++(const Byte8 &val); // Pre-increment
763// RValue<Byte8> operator--(const Byte8 &val, int); // Post-decrement
764// const Byte8 &operator--(const Byte8 &val); // Pre-decrement
765
766 RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y);
767 RValue<Byte8> SubSat(RValue<Byte8> x, RValue<Byte8> y);
768 RValue<Short4> Unpack(RValue<Byte4> x);
769 RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y);
770 RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y);
771 RValue<Int> SignMask(RValue<Byte8> x);
772// RValue<Byte8> CmpGT(RValue<Byte8> x, RValue<Byte8> y);
773 RValue<Byte8> CmpEQ(RValue<Byte8> x, RValue<Byte8> y);
774
John Bauman66b8ab22014-05-06 15:57:45 -0400775 class SByte8 : public Variable<SByte8>
John Bauman89401822014-05-06 15:04:28 -0400776 {
777 public:
778 SByte8();
779 SByte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7);
780 SByte8(int64_t x);
John Bauman19bac1e2014-05-06 15:23:49 -0400781 SByte8(RValue<SByte8> rhs);
John Bauman89401822014-05-06 15:04:28 -0400782 SByte8(const SByte8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400783 SByte8(const Reference<SByte8> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400784
John Bauman19bac1e2014-05-06 15:23:49 -0400785 RValue<SByte8> operator=(RValue<SByte8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400786 RValue<SByte8> operator=(const SByte8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400787 RValue<SByte8> operator=(const Reference<SByte8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400788
John Bauman19bac1e2014-05-06 15:23:49 -0400789 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400790 };
791
Nicolas Capens08e90f02014-11-21 12:49:12 -0500792 RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs);
793 RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs);
794// RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs);
795// RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs);
796// RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs);
797 RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs);
798 RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs);
799 RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs);
800// RValue<SByte8> operator<<(RValue<SByte8> lhs, RValue<SByte8> rhs);
801// RValue<SByte8> operator>>(RValue<SByte8> lhs, RValue<SByte8> rhs);
802 RValue<SByte8> operator+=(const SByte8 &lhs, RValue<SByte8> rhs);
803 RValue<SByte8> operator-=(const SByte8 &lhs, RValue<SByte8> rhs);
804// RValue<SByte8> operator*=(const SByte8 &lhs, RValue<SByte8> rhs);
805// RValue<SByte8> operator/=(const SByte8 &lhs, RValue<SByte8> rhs);
806// RValue<SByte8> operator%=(const SByte8 &lhs, RValue<SByte8> rhs);
807 RValue<SByte8> operator&=(const SByte8 &lhs, RValue<SByte8> rhs);
808 RValue<SByte8> operator|=(const SByte8 &lhs, RValue<SByte8> rhs);
809 RValue<SByte8> operator^=(const SByte8 &lhs, RValue<SByte8> rhs);
810// RValue<SByte8> operator<<=(const SByte8 &lhs, RValue<SByte8> rhs);
811// RValue<SByte8> operator>>=(const SByte8 &lhs, RValue<SByte8> rhs);
812// RValue<SByte8> operator+(RValue<SByte8> val);
813// RValue<SByte8> operator-(RValue<SByte8> val);
814 RValue<SByte8> operator~(RValue<SByte8> val);
815// RValue<SByte8> operator++(const SByte8 &val, int); // Post-increment
816// const SByte8 &operator++(const SByte8 &val); // Pre-increment
817// RValue<SByte8> operator--(const SByte8 &val, int); // Post-decrement
818// const SByte8 &operator--(const SByte8 &val); // Pre-decrement
819
820 RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y);
821 RValue<SByte8> SubSat(RValue<SByte8> x, RValue<SByte8> y);
822 RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y);
823 RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y);
824 RValue<Int> SignMask(RValue<SByte8> x);
825 RValue<Byte8> CmpGT(RValue<SByte8> x, RValue<SByte8> y);
826 RValue<Byte8> CmpEQ(RValue<SByte8> x, RValue<SByte8> y);
827
John Bauman66b8ab22014-05-06 15:57:45 -0400828 class Byte16 : public Variable<Byte16>
John Bauman89401822014-05-06 15:04:28 -0400829 {
830 public:
831 // Byte16();
832 // Byte16(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400833 Byte16(RValue<Byte16> rhs);
John Bauman89401822014-05-06 15:04:28 -0400834 Byte16(const Byte16 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400835 Byte16(const Reference<Byte16> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400836
John Bauman19bac1e2014-05-06 15:23:49 -0400837 RValue<Byte16> operator=(RValue<Byte16> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400838 RValue<Byte16> operator=(const Byte16 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400839 RValue<Byte16> operator=(const Reference<Byte16> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400840
John Bauman19bac1e2014-05-06 15:23:49 -0400841 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400842 };
843
Nicolas Capens08e90f02014-11-21 12:49:12 -0500844// RValue<Byte16> operator+(RValue<Byte16> lhs, RValue<Byte16> rhs);
845// RValue<Byte16> operator-(RValue<Byte16> lhs, RValue<Byte16> rhs);
846// RValue<Byte16> operator*(RValue<Byte16> lhs, RValue<Byte16> rhs);
847// RValue<Byte16> operator/(RValue<Byte16> lhs, RValue<Byte16> rhs);
848// RValue<Byte16> operator%(RValue<Byte16> lhs, RValue<Byte16> rhs);
849// RValue<Byte16> operator&(RValue<Byte16> lhs, RValue<Byte16> rhs);
850// RValue<Byte16> operator|(RValue<Byte16> lhs, RValue<Byte16> rhs);
851// RValue<Byte16> operator^(RValue<Byte16> lhs, RValue<Byte16> rhs);
852// RValue<Byte16> operator<<(RValue<Byte16> lhs, RValue<Byte16> rhs);
853// RValue<Byte16> operator>>(RValue<Byte16> lhs, RValue<Byte16> rhs);
854// RValue<Byte16> operator+=(const Byte16 &lhs, RValue<Byte16> rhs);
855// RValue<Byte16> operator-=(const Byte16 &lhs, RValue<Byte16> rhs);
856// RValue<Byte16> operator*=(const Byte16 &lhs, RValue<Byte16> rhs);
857// RValue<Byte16> operator/=(const Byte16 &lhs, RValue<Byte16> rhs);
858// RValue<Byte16> operator%=(const Byte16 &lhs, RValue<Byte16> rhs);
859// RValue<Byte16> operator&=(const Byte16 &lhs, RValue<Byte16> rhs);
860// RValue<Byte16> operator|=(const Byte16 &lhs, RValue<Byte16> rhs);
861// RValue<Byte16> operator^=(const Byte16 &lhs, RValue<Byte16> rhs);
862// RValue<Byte16> operator<<=(const Byte16 &lhs, RValue<Byte16> rhs);
863// RValue<Byte16> operator>>=(const Byte16 &lhs, RValue<Byte16> rhs);
864// RValue<Byte16> operator+(RValue<Byte16> val);
865// RValue<Byte16> operator-(RValue<Byte16> val);
866// RValue<Byte16> operator~(RValue<Byte16> val);
867// RValue<Byte16> operator++(const Byte16 &val, int); // Post-increment
868// const Byte16 &operator++(const Byte16 &val); // Pre-increment
869// RValue<Byte16> operator--(const Byte16 &val, int); // Post-decrement
870// const Byte16 &operator--(const Byte16 &val); // Pre-decrement
871
John Bauman66b8ab22014-05-06 15:57:45 -0400872 class SByte16 : public Variable<SByte16>
John Bauman89401822014-05-06 15:04:28 -0400873 {
874 public:
875 // SByte16();
876 // SByte16(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400877 // SByte16(RValue<SByte16> rhs);
John Bauman89401822014-05-06 15:04:28 -0400878 // SByte16(const SByte16 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400879 // SByte16(const Reference<SByte16> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400880
John Bauman19bac1e2014-05-06 15:23:49 -0400881 // RValue<SByte16> operator=(RValue<SByte16> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400882 // RValue<SByte16> operator=(const SByte16 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400883 // RValue<SByte16> operator=(const Reference<SByte16> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400884
John Bauman19bac1e2014-05-06 15:23:49 -0400885 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400886 };
887
Nicolas Capens08e90f02014-11-21 12:49:12 -0500888// RValue<SByte16> operator+(RValue<SByte16> lhs, RValue<SByte16> rhs);
889// RValue<SByte16> operator-(RValue<SByte16> lhs, RValue<SByte16> rhs);
890// RValue<SByte16> operator*(RValue<SByte16> lhs, RValue<SByte16> rhs);
891// RValue<SByte16> operator/(RValue<SByte16> lhs, RValue<SByte16> rhs);
892// RValue<SByte16> operator%(RValue<SByte16> lhs, RValue<SByte16> rhs);
893// RValue<SByte16> operator&(RValue<SByte16> lhs, RValue<SByte16> rhs);
894// RValue<SByte16> operator|(RValue<SByte16> lhs, RValue<SByte16> rhs);
895// RValue<SByte16> operator^(RValue<SByte16> lhs, RValue<SByte16> rhs);
896// RValue<SByte16> operator<<(RValue<SByte16> lhs, RValue<SByte16> rhs);
897// RValue<SByte16> operator>>(RValue<SByte16> lhs, RValue<SByte16> rhs);
898// RValue<SByte16> operator+=(const SByte16 &lhs, RValue<SByte16> rhs);
899// RValue<SByte16> operator-=(const SByte16 &lhs, RValue<SByte16> rhs);
900// RValue<SByte16> operator*=(const SByte16 &lhs, RValue<SByte16> rhs);
901// RValue<SByte16> operator/=(const SByte16 &lhs, RValue<SByte16> rhs);
902// RValue<SByte16> operator%=(const SByte16 &lhs, RValue<SByte16> rhs);
903// RValue<SByte16> operator&=(const SByte16 &lhs, RValue<SByte16> rhs);
904// RValue<SByte16> operator|=(const SByte16 &lhs, RValue<SByte16> rhs);
905// RValue<SByte16> operator^=(const SByte16 &lhs, RValue<SByte16> rhs);
906// RValue<SByte16> operator<<=(const SByte16 &lhs, RValue<SByte16> rhs);
907// RValue<SByte16> operator>>=(const SByte16 &lhs, RValue<SByte16> rhs);
908// RValue<SByte16> operator+(RValue<SByte16> val);
909// RValue<SByte16> operator-(RValue<SByte16> val);
910// RValue<SByte16> operator~(RValue<SByte16> val);
911// RValue<SByte16> operator++(const SByte16 &val, int); // Post-increment
912// const SByte16 &operator++(const SByte16 &val); // Pre-increment
913// RValue<SByte16> operator--(const SByte16 &val, int); // Post-decrement
914// const SByte16 &operator--(const SByte16 &val); // Pre-decrement
915
John Bauman66b8ab22014-05-06 15:57:45 -0400916 class Short4 : public Variable<Short4>
John Bauman89401822014-05-06 15:04:28 -0400917 {
918 public:
John Bauman19bac1e2014-05-06 15:23:49 -0400919 explicit Short4(RValue<Int> cast);
920 explicit Short4(RValue<Int4> cast);
921 // explicit Short4(RValue<Float> cast);
922 explicit Short4(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -0400923
924 Short4();
John Bauman19bac1e2014-05-06 15:23:49 -0400925 Short4(short xyzw);
John Bauman89401822014-05-06 15:04:28 -0400926 Short4(short x, short y, short z, short w);
John Bauman19bac1e2014-05-06 15:23:49 -0400927 Short4(RValue<Short4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400928 Short4(const Short4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400929 Short4(const Reference<Short4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -0400930 Short4(RValue<UShort4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400931 Short4(const UShort4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400932 Short4(const Reference<UShort4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400933
John Bauman19bac1e2014-05-06 15:23:49 -0400934 RValue<Short4> operator=(RValue<Short4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400935 RValue<Short4> operator=(const Short4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400936 RValue<Short4> operator=(const Reference<Short4> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -0400937 RValue<Short4> operator=(RValue<UShort4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400938 RValue<Short4> operator=(const UShort4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400939 RValue<Short4> operator=(const Reference<UShort4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400940
John Bauman19bac1e2014-05-06 15:23:49 -0400941 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400942 };
943
Nicolas Capens08e90f02014-11-21 12:49:12 -0500944 RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs);
945 RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs);
946 RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs);
947// RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs);
948// RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs);
949 RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs);
950 RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs);
951 RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs);
952 RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs);
953 RValue<Short4> operator>>(RValue<Short4> lhs, unsigned char rhs);
954 RValue<Short4> operator<<(RValue<Short4> lhs, RValue<Long1> rhs);
955 RValue<Short4> operator>>(RValue<Short4> lhs, RValue<Long1> rhs);
956 RValue<Short4> operator+=(const Short4 &lhs, RValue<Short4> rhs);
957 RValue<Short4> operator-=(const Short4 &lhs, RValue<Short4> rhs);
958 RValue<Short4> operator*=(const Short4 &lhs, RValue<Short4> rhs);
959// RValue<Short4> operator/=(const Short4 &lhs, RValue<Short4> rhs);
960// RValue<Short4> operator%=(const Short4 &lhs, RValue<Short4> rhs);
961 RValue<Short4> operator&=(const Short4 &lhs, RValue<Short4> rhs);
962 RValue<Short4> operator|=(const Short4 &lhs, RValue<Short4> rhs);
963 RValue<Short4> operator^=(const Short4 &lhs, RValue<Short4> rhs);
964 RValue<Short4> operator<<=(const Short4 &lhs, unsigned char rhs);
965 RValue<Short4> operator>>=(const Short4 &lhs, unsigned char rhs);
966 RValue<Short4> operator<<=(const Short4 &lhs, RValue<Long1> rhs);
967 RValue<Short4> operator>>=(const Short4 &lhs, RValue<Long1> rhs);
968// RValue<Short4> operator+(RValue<Short4> val);
969 RValue<Short4> operator-(RValue<Short4> val);
970 RValue<Short4> operator~(RValue<Short4> val);
971// RValue<Short4> operator++(const Short4 &val, int); // Post-increment
972// const Short4 &operator++(const Short4 &val); // Pre-increment
973// RValue<Short4> operator--(const Short4 &val, int); // Post-decrement
974// const Short4 &operator--(const Short4 &val); // Pre-decrement
975// RValue<Bool> operator<(RValue<Short4> lhs, RValue<Short4> rhs);
976// RValue<Bool> operator<=(RValue<Short4> lhs, RValue<Short4> rhs);
977// RValue<Bool> operator>(RValue<Short4> lhs, RValue<Short4> rhs);
978// RValue<Bool> operator>=(RValue<Short4> lhs, RValue<Short4> rhs);
979// RValue<Bool> operator!=(RValue<Short4> lhs, RValue<Short4> rhs);
980// RValue<Bool> operator==(RValue<Short4> lhs, RValue<Short4> rhs);
981
982 RValue<Short4> RoundShort4(RValue<Float4> cast);
983 RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y);
984 RValue<Short4> Min(RValue<Short4> x, RValue<Short4> y);
985 RValue<Short4> AddSat(RValue<Short4> x, RValue<Short4> y);
986 RValue<Short4> SubSat(RValue<Short4> x, RValue<Short4> y);
987 RValue<Short4> MulHigh(RValue<Short4> x, RValue<Short4> y);
988 RValue<Int2> MulAdd(RValue<Short4> x, RValue<Short4> y);
989 RValue<SByte8> Pack(RValue<Short4> x, RValue<Short4> y);
990 RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y);
991 RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y);
992 RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select);
993 RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i);
994 RValue<Short> Extract(RValue<Short4> val, int i);
995 RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y);
996 RValue<Short4> CmpEQ(RValue<Short4> x, RValue<Short4> y);
997
John Bauman66b8ab22014-05-06 15:57:45 -0400998 class UShort4 : public Variable<UShort4>
John Bauman89401822014-05-06 15:04:28 -0400999 {
1000 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001001 explicit UShort4(RValue<Int4> cast);
1002 explicit UShort4(RValue<Float4> cast, bool saturate = false);
John Bauman89401822014-05-06 15:04:28 -04001003
1004 UShort4();
1005 UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w);
John Bauman19bac1e2014-05-06 15:23:49 -04001006 UShort4(RValue<UShort4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001007 UShort4(const UShort4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001008 UShort4(const Reference<UShort4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001009 UShort4(RValue<Short4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001010 UShort4(const Short4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001011 UShort4(const Reference<Short4> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001012
John Bauman19bac1e2014-05-06 15:23:49 -04001013 RValue<UShort4> operator=(RValue<UShort4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001014 RValue<UShort4> operator=(const UShort4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001015 RValue<UShort4> operator=(const Reference<UShort4> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001016 RValue<UShort4> operator=(RValue<Short4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001017 RValue<UShort4> operator=(const Short4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001018 RValue<UShort4> operator=(const Reference<Short4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001019
John Bauman19bac1e2014-05-06 15:23:49 -04001020 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001021 };
1022
Nicolas Capens08e90f02014-11-21 12:49:12 -05001023 RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs);
1024 RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs);
1025 RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs);
1026// RValue<UShort4> operator/(RValue<UShort4> lhs, RValue<UShort4> rhs);
1027// RValue<UShort4> operator%(RValue<UShort4> lhs, RValue<UShort4> rhs);
1028// RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs);
1029// RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs);
1030// RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs);
1031 RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs);
1032 RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs);
1033 RValue<UShort4> operator<<(RValue<UShort4> lhs, RValue<Long1> rhs);
1034 RValue<UShort4> operator>>(RValue<UShort4> lhs, RValue<Long1> rhs);
1035// RValue<UShort4> operator+=(const UShort4 &lhs, RValue<UShort4> rhs);
1036// RValue<UShort4> operator-=(const UShort4 &lhs, RValue<UShort4> rhs);
1037// RValue<UShort4> operator*=(const UShort4 &lhs, RValue<UShort4> rhs);
1038// RValue<UShort4> operator/=(const UShort4 &lhs, RValue<UShort4> rhs);
1039// RValue<UShort4> operator%=(const UShort4 &lhs, RValue<UShort4> rhs);
1040// RValue<UShort4> operator&=(const UShort4 &lhs, RValue<UShort4> rhs);
1041// RValue<UShort4> operator|=(const UShort4 &lhs, RValue<UShort4> rhs);
1042// RValue<UShort4> operator^=(const UShort4 &lhs, RValue<UShort4> rhs);
1043 RValue<UShort4> operator<<=(const UShort4 &lhs, unsigned char rhs);
1044 RValue<UShort4> operator>>=(const UShort4 &lhs, unsigned char rhs);
1045 RValue<UShort4> operator<<=(const UShort4 &lhs, RValue<Long1> rhs);
1046 RValue<UShort4> operator>>=(const UShort4 &lhs, RValue<Long1> rhs);
1047// RValue<UShort4> operator+(RValue<UShort4> val);
1048// RValue<UShort4> operator-(RValue<UShort4> val);
1049 RValue<UShort4> operator~(RValue<UShort4> val);
1050// RValue<UShort4> operator++(const UShort4 &val, int); // Post-increment
1051// const UShort4 &operator++(const UShort4 &val); // Pre-increment
1052// RValue<UShort4> operator--(const UShort4 &val, int); // Post-decrement
1053// const UShort4 &operator--(const UShort4 &val); // Pre-decrement
1054
1055 RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y);
1056 RValue<UShort4> Min(RValue<UShort4> x, RValue<UShort4> y);
1057 RValue<UShort4> AddSat(RValue<UShort4> x, RValue<UShort4> y);
1058 RValue<UShort4> SubSat(RValue<UShort4> x, RValue<UShort4> y);
1059 RValue<UShort4> MulHigh(RValue<UShort4> x, RValue<UShort4> y);
1060 RValue<UShort4> Average(RValue<UShort4> x, RValue<UShort4> y);
1061 RValue<Byte8> Pack(RValue<UShort4> x, RValue<UShort4> y);
1062
John Bauman66b8ab22014-05-06 15:57:45 -04001063 class Short8 : public Variable<Short8>
John Bauman89401822014-05-06 15:04:28 -04001064 {
1065 public:
1066 // Short8();
1067 Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7);
John Bauman19bac1e2014-05-06 15:23:49 -04001068 Short8(RValue<Short8> rhs);
John Bauman89401822014-05-06 15:04:28 -04001069 // Short8(const Short8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001070 // Short8(const Reference<Short8> &rhs);
Nicolas Capens62abb552016-01-05 12:03:47 -05001071 Short8(RValue<Short4> lo, RValue<Short4> hi);
John Bauman89401822014-05-06 15:04:28 -04001072
John Bauman19bac1e2014-05-06 15:23:49 -04001073 // RValue<Short8> operator=(RValue<Short8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001074 // RValue<Short8> operator=(const Short8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001075 // RValue<Short8> operator=(const Reference<Short8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001076
John Bauman19bac1e2014-05-06 15:23:49 -04001077 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001078 };
1079
Nicolas Capens08e90f02014-11-21 12:49:12 -05001080 RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs);
1081// RValue<Short8> operator-(RValue<Short8> lhs, RValue<Short8> rhs);
1082// RValue<Short8> operator*(RValue<Short8> lhs, RValue<Short8> rhs);
1083// RValue<Short8> operator/(RValue<Short8> lhs, RValue<Short8> rhs);
1084// RValue<Short8> operator%(RValue<Short8> lhs, RValue<Short8> rhs);
1085 RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs);
1086// RValue<Short8> operator|(RValue<Short8> lhs, RValue<Short8> rhs);
1087// RValue<Short8> operator^(RValue<Short8> lhs, RValue<Short8> rhs);
1088 RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs);
1089 RValue<Short8> operator>>(RValue<Short8> lhs, unsigned char rhs);
1090// RValue<Short8> operator<<(RValue<Short8> lhs, RValue<Short8> rhs);
1091// RValue<Short8> operator>>(RValue<Short8> lhs, RValue<Short8> rhs);
1092// RValue<Short8> operator+=(const Short8 &lhs, RValue<Short8> rhs);
1093// RValue<Short8> operator-=(const Short8 &lhs, RValue<Short8> rhs);
1094// RValue<Short8> operator*=(const Short8 &lhs, RValue<Short8> rhs);
1095// RValue<Short8> operator/=(const Short8 &lhs, RValue<Short8> rhs);
1096// RValue<Short8> operator%=(const Short8 &lhs, RValue<Short8> rhs);
1097// RValue<Short8> operator&=(const Short8 &lhs, RValue<Short8> rhs);
1098// RValue<Short8> operator|=(const Short8 &lhs, RValue<Short8> rhs);
1099// RValue<Short8> operator^=(const Short8 &lhs, RValue<Short8> rhs);
1100// RValue<Short8> operator<<=(const Short8 &lhs, RValue<Short8> rhs);
1101// RValue<Short8> operator>>=(const Short8 &lhs, RValue<Short8> rhs);
1102// RValue<Short8> operator+(RValue<Short8> val);
1103// RValue<Short8> operator-(RValue<Short8> val);
1104// RValue<Short8> operator~(RValue<Short8> val);
1105// RValue<Short8> operator++(const Short8 &val, int); // Post-increment
1106// const Short8 &operator++(const Short8 &val); // Pre-increment
1107// RValue<Short8> operator--(const Short8 &val, int); // Post-decrement
1108// const Short8 &operator--(const Short8 &val); // Pre-decrement
1109// RValue<Bool> operator<(RValue<Short8> lhs, RValue<Short8> rhs);
1110// RValue<Bool> operator<=(RValue<Short8> lhs, RValue<Short8> rhs);
1111// RValue<Bool> operator>(RValue<Short8> lhs, RValue<Short8> rhs);
1112// RValue<Bool> operator>=(RValue<Short8> lhs, RValue<Short8> rhs);
1113// RValue<Bool> operator!=(RValue<Short8> lhs, RValue<Short8> rhs);
1114// RValue<Bool> operator==(RValue<Short8> lhs, RValue<Short8> rhs);
1115
Nicolas Capens08e90f02014-11-21 12:49:12 -05001116 RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y);
1117 RValue<Int4> MulAdd(RValue<Short8> x, RValue<Short8> y);
1118
John Bauman66b8ab22014-05-06 15:57:45 -04001119 class UShort8 : public Variable<UShort8>
John Bauman89401822014-05-06 15:04:28 -04001120 {
1121 public:
1122 // UShort8();
1123 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);
John Bauman19bac1e2014-05-06 15:23:49 -04001124 UShort8(RValue<UShort8> rhs);
John Bauman89401822014-05-06 15:04:28 -04001125 // UShort8(const UShort8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001126 // UShort8(const Reference<UShort8> &rhs);
Nicolas Capens62abb552016-01-05 12:03:47 -05001127 UShort8(RValue<UShort4> lo, RValue<UShort4> hi);
John Bauman89401822014-05-06 15:04:28 -04001128
John Bauman19bac1e2014-05-06 15:23:49 -04001129 RValue<UShort8> operator=(RValue<UShort8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001130 RValue<UShort8> operator=(const UShort8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001131 RValue<UShort8> operator=(const Reference<UShort8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001132
John Bauman19bac1e2014-05-06 15:23:49 -04001133 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001134 };
1135
Nicolas Capens08e90f02014-11-21 12:49:12 -05001136 RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs);
1137// RValue<UShort8> operator-(RValue<UShort8> lhs, RValue<UShort8> rhs);
1138 RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs);
1139// RValue<UShort8> operator/(RValue<UShort8> lhs, RValue<UShort8> rhs);
1140// RValue<UShort8> operator%(RValue<UShort8> lhs, RValue<UShort8> rhs);
1141 RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs);
1142// RValue<UShort8> operator|(RValue<UShort8> lhs, RValue<UShort8> rhs);
1143// RValue<UShort8> operator^(RValue<UShort8> lhs, RValue<UShort8> rhs);
1144 RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs);
1145 RValue<UShort8> operator>>(RValue<UShort8> lhs, unsigned char rhs);
1146// RValue<UShort8> operator<<(RValue<UShort8> lhs, RValue<UShort8> rhs);
1147// RValue<UShort8> operator>>(RValue<UShort8> lhs, RValue<UShort8> rhs);
1148 RValue<UShort8> operator+=(const UShort8 &lhs, RValue<UShort8> rhs);
1149// RValue<UShort8> operator-=(const UShort8 &lhs, RValue<UShort8> rhs);
1150// RValue<UShort8> operator*=(const UShort8 &lhs, RValue<UShort8> rhs);
1151// RValue<UShort8> operator/=(const UShort8 &lhs, RValue<UShort8> rhs);
1152// RValue<UShort8> operator%=(const UShort8 &lhs, RValue<UShort8> rhs);
1153// RValue<UShort8> operator&=(const UShort8 &lhs, RValue<UShort8> rhs);
1154// RValue<UShort8> operator|=(const UShort8 &lhs, RValue<UShort8> rhs);
1155// RValue<UShort8> operator^=(const UShort8 &lhs, RValue<UShort8> rhs);
1156// RValue<UShort8> operator<<=(const UShort8 &lhs, RValue<UShort8> rhs);
1157// RValue<UShort8> operator>>=(const UShort8 &lhs, RValue<UShort8> rhs);
1158// RValue<UShort8> operator+(RValue<UShort8> val);
1159// RValue<UShort8> operator-(RValue<UShort8> val);
1160 RValue<UShort8> operator~(RValue<UShort8> val);
1161// RValue<UShort8> operator++(const UShort8 &val, int); // Post-increment
1162// const UShort8 &operator++(const UShort8 &val); // Pre-increment
1163// RValue<UShort8> operator--(const UShort8 &val, int); // Post-decrement
1164// const UShort8 &operator--(const UShort8 &val); // Pre-decrement
1165// RValue<Bool> operator<(RValue<UShort8> lhs, RValue<UShort8> rhs);
1166// RValue<Bool> operator<=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1167// RValue<Bool> operator>(RValue<UShort8> lhs, RValue<UShort8> rhs);
1168// RValue<Bool> operator>=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1169// RValue<Bool> operator!=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1170// RValue<Bool> operator==(RValue<UShort8> lhs, RValue<UShort8> rhs);
1171
1172 RValue<UShort8> Swizzle(RValue<UShort8> x, char select0, char select1, char select2, char select3, char select4, char select5, char select6, char select7);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001173 RValue<UShort8> MulHigh(RValue<UShort8> x, RValue<UShort8> y);
1174
John Bauman66b8ab22014-05-06 15:57:45 -04001175 class Int : public Variable<Int>
John Bauman89401822014-05-06 15:04:28 -04001176 {
1177 public:
Nicolas Capens81f18302016-01-14 09:32:35 -05001178 Int(Argument<Int> argument);
John Bauman89401822014-05-06 15:04:28 -04001179
John Bauman19bac1e2014-05-06 15:23:49 -04001180 explicit Int(RValue<Byte> cast);
1181 explicit Int(RValue<SByte> cast);
1182 explicit Int(RValue<Short> cast);
1183 explicit Int(RValue<UShort> cast);
1184 explicit Int(RValue<Int2> cast);
1185 explicit Int(RValue<Long> cast);
1186 explicit Int(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001187
1188 Int();
1189 Int(int x);
John Bauman19bac1e2014-05-06 15:23:49 -04001190 Int(RValue<Int> rhs);
1191 Int(RValue<UInt> rhs);
John Bauman89401822014-05-06 15:04:28 -04001192 Int(const Int &rhs);
1193 Int(const UInt &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001194 Int(const Reference<Int> &rhs);
1195 Int(const Reference<UInt> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001196
1197 RValue<Int> operator=(int rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001198 RValue<Int> operator=(RValue<Int> rhs) const;
1199 RValue<Int> operator=(RValue<UInt> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001200 RValue<Int> operator=(const Int &rhs) const;
1201 RValue<Int> operator=(const UInt &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001202 RValue<Int> operator=(const Reference<Int> &rhs) const;
1203 RValue<Int> operator=(const Reference<UInt> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001204
John Bauman19bac1e2014-05-06 15:23:49 -04001205 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001206 };
1207
Nicolas Capens08e90f02014-11-21 12:49:12 -05001208 RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs);
1209 RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs);
1210 RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs);
1211 RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs);
1212 RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs);
1213 RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs);
1214 RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs);
1215 RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs);
1216 RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs);
1217 RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs);
1218 RValue<Int> operator+=(const Int &lhs, RValue<Int> rhs);
1219 RValue<Int> operator-=(const Int &lhs, RValue<Int> rhs);
1220 RValue<Int> operator*=(const Int &lhs, RValue<Int> rhs);
1221 RValue<Int> operator/=(const Int &lhs, RValue<Int> rhs);
1222 RValue<Int> operator%=(const Int &lhs, RValue<Int> rhs);
1223 RValue<Int> operator&=(const Int &lhs, RValue<Int> rhs);
1224 RValue<Int> operator|=(const Int &lhs, RValue<Int> rhs);
1225 RValue<Int> operator^=(const Int &lhs, RValue<Int> rhs);
1226 RValue<Int> operator<<=(const Int &lhs, RValue<Int> rhs);
1227 RValue<Int> operator>>=(const Int &lhs, RValue<Int> rhs);
1228 RValue<Int> operator+(RValue<Int> val);
1229 RValue<Int> operator-(RValue<Int> val);
1230 RValue<Int> operator~(RValue<Int> val);
1231 RValue<Int> operator++(const Int &val, int); // Post-increment
1232 const Int &operator++(const Int &val); // Pre-increment
1233 RValue<Int> operator--(const Int &val, int); // Post-decrement
1234 const Int &operator--(const Int &val); // Pre-decrement
1235 RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs);
1236 RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs);
1237 RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs);
1238 RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs);
1239 RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs);
1240 RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs);
1241
1242 RValue<Int> Max(RValue<Int> x, RValue<Int> y);
1243 RValue<Int> Min(RValue<Int> x, RValue<Int> y);
1244 RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max);
1245 RValue<Int> RoundInt(RValue<Float> cast);
1246
John Bauman66b8ab22014-05-06 15:57:45 -04001247 class Long : public Variable<Long>
John Bauman89401822014-05-06 15:04:28 -04001248 {
1249 public:
Nicolas Capens81f18302016-01-14 09:32:35 -05001250 // Long(Argument<Long> argument);
John Bauman89401822014-05-06 15:04:28 -04001251
John Bauman19bac1e2014-05-06 15:23:49 -04001252 // explicit Long(RValue<Short> cast);
1253 // explicit Long(RValue<UShort> cast);
1254 explicit Long(RValue<Int> cast);
1255 explicit Long(RValue<UInt> cast);
1256 // explicit Long(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001257
1258 Long();
1259 // Long(qword x);
John Bauman19bac1e2014-05-06 15:23:49 -04001260 Long(RValue<Long> rhs);
1261 // Long(RValue<ULong> rhs);
John Bauman89401822014-05-06 15:04:28 -04001262 // Long(const Long &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001263 // Long(const Reference<Long> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001264 // Long(const ULong &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001265 // Long(const Reference<ULong> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001266
1267 RValue<Long> operator=(int64_t rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001268 RValue<Long> operator=(RValue<Long> rhs) const;
1269 // RValue<Long> operator=(RValue<ULong> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001270 RValue<Long> operator=(const Long &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001271 RValue<Long> operator=(const Reference<Long> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001272 // RValue<Long> operator=(const ULong &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001273 // RValue<Long> operator=(const Reference<ULong> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001274
John Bauman19bac1e2014-05-06 15:23:49 -04001275 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001276 };
1277
Nicolas Capens08e90f02014-11-21 12:49:12 -05001278 RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs);
1279 RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs);
1280// RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs);
1281// RValue<Long> operator/(RValue<Long> lhs, RValue<Long> rhs);
1282// RValue<Long> operator%(RValue<Long> lhs, RValue<Long> rhs);
1283// RValue<Long> operator&(RValue<Long> lhs, RValue<Long> rhs);
1284// RValue<Long> operator|(RValue<Long> lhs, RValue<Long> rhs);
1285// RValue<Long> operator^(RValue<Long> lhs, RValue<Long> rhs);
1286// RValue<Long> operator<<(RValue<Long> lhs, RValue<Long> rhs);
1287// RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs);
1288 RValue<Long> operator+=(const Long &lhs, RValue<Long> rhs);
1289 RValue<Long> operator-=(const Long &lhs, RValue<Long> rhs);
1290// RValue<Long> operator*=(const Long &lhs, RValue<Long> rhs);
1291// RValue<Long> operator/=(const Long &lhs, RValue<Long> rhs);
1292// RValue<Long> operator%=(const Long &lhs, RValue<Long> rhs);
1293// RValue<Long> operator&=(const Long &lhs, RValue<Long> rhs);
1294// RValue<Long> operator|=(const Long &lhs, RValue<Long> rhs);
1295// RValue<Long> operator^=(const Long &lhs, RValue<Long> rhs);
1296// RValue<Long> operator<<=(const Long &lhs, RValue<Long> rhs);
1297// RValue<Long> operator>>=(const Long &lhs, RValue<Long> rhs);
1298// RValue<Long> operator+(RValue<Long> val);
1299// RValue<Long> operator-(RValue<Long> val);
1300// RValue<Long> operator~(RValue<Long> val);
1301// RValue<Long> operator++(const Long &val, int); // Post-increment
1302// const Long &operator++(const Long &val); // Pre-increment
1303// RValue<Long> operator--(const Long &val, int); // Post-decrement
1304// const Long &operator--(const Long &val); // Pre-decrement
1305// RValue<Bool> operator<(RValue<Long> lhs, RValue<Long> rhs);
1306// RValue<Bool> operator<=(RValue<Long> lhs, RValue<Long> rhs);
1307// RValue<Bool> operator>(RValue<Long> lhs, RValue<Long> rhs);
1308// RValue<Bool> operator>=(RValue<Long> lhs, RValue<Long> rhs);
1309// RValue<Bool> operator!=(RValue<Long> lhs, RValue<Long> rhs);
1310// RValue<Bool> operator==(RValue<Long> lhs, RValue<Long> rhs);
1311
1312// RValue<Long> RoundLong(RValue<Float> cast);
Nicolas Capens81f18302016-01-14 09:32:35 -05001313 RValue<Long> AddAtomic( RValue<Pointer<Long>> x, RValue<Long> y);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001314
John Bauman66b8ab22014-05-06 15:57:45 -04001315 class Long1 : public Variable<Long1>
John Bauman89401822014-05-06 15:04:28 -04001316 {
1317 public:
Nicolas Capens81f18302016-01-14 09:32:35 -05001318 // Long1(Argument<Long1> argument);
John Bauman89401822014-05-06 15:04:28 -04001319
John Bauman19bac1e2014-05-06 15:23:49 -04001320 // explicit Long1(RValue<Short> cast);
1321 // explicit Long1(RValue<UShort> cast);
1322 // explicit Long1(RValue<Int> cast);
Nicolas Capens50c96362016-01-04 23:03:59 -05001323 explicit Long1(RValue<UInt> cast);
John Bauman19bac1e2014-05-06 15:23:49 -04001324 // explicit Long1(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001325
John Bauman89401822014-05-06 15:04:28 -04001326 // Long1();
1327 // Long1(qword x);
John Bauman19bac1e2014-05-06 15:23:49 -04001328 Long1(RValue<Long1> rhs);
1329 // Long1(RValue<ULong1> rhs);
John Bauman89401822014-05-06 15:04:28 -04001330 // Long1(const Long1 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001331 // Long1(const Reference<Long1> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001332 // Long1(const ULong1 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001333 // Long1(const Reference<ULong1> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001334
1335 // RValue<Long1> operator=(qword rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001336 // RValue<Long1> operator=(RValue<Long1> rhs) const;
1337 // RValue<Long1> operator=(RValue<ULong1> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001338 // RValue<Long1> operator=(const Long1 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001339 // RValue<Long1> operator=(const Reference<Long1> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001340 // RValue<Long1> operator=(const ULong1 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001341 // RValue<Long1> operator=(const Reference<ULong1> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001342
John Bauman19bac1e2014-05-06 15:23:49 -04001343 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001344 };
1345
Nicolas Capens08e90f02014-11-21 12:49:12 -05001346// RValue<Long1> operator+(RValue<Long1> lhs, RValue<Long1> rhs);
1347// RValue<Long1> operator-(RValue<Long1> lhs, RValue<Long1> rhs);
1348// RValue<Long1> operator*(RValue<Long1> lhs, RValue<Long1> rhs);
1349// RValue<Long1> operator/(RValue<Long1> lhs, RValue<Long1> rhs);
1350// RValue<Long1> operator%(RValue<Long1> lhs, RValue<Long1> rhs);
1351// RValue<Long1> operator&(RValue<Long1> lhs, RValue<Long1> rhs);
1352// RValue<Long1> operator|(RValue<Long1> lhs, RValue<Long1> rhs);
1353// RValue<Long1> operator^(RValue<Long1> lhs, RValue<Long1> rhs);
1354// RValue<Long1> operator<<(RValue<Long1> lhs, RValue<Long1> rhs);
1355// RValue<Long1> operator>>(RValue<Long1> lhs, RValue<Long1> rhs);
1356// RValue<Long1> operator+=(const Long1 &lhs, RValue<Long1> rhs);
1357// RValue<Long1> operator-=(const Long1 &lhs, RValue<Long1> rhs);
1358// RValue<Long1> operator*=(const Long1 &lhs, RValue<Long1> rhs);
1359// RValue<Long1> operator/=(const Long1 &lhs, RValue<Long1> rhs);
1360// RValue<Long1> operator%=(const Long1 &lhs, RValue<Long1> rhs);
1361// RValue<Long1> operator&=(const Long1 &lhs, RValue<Long1> rhs);
1362// RValue<Long1> operator|=(const Long1 &lhs, RValue<Long1> rhs);
1363// RValue<Long1> operator^=(const Long1 &lhs, RValue<Long1> rhs);
1364// RValue<Long1> operator<<=(const Long1 &lhs, RValue<Long1> rhs);
1365// RValue<Long1> operator>>=(const Long1 &lhs, RValue<Long1> rhs);
1366// RValue<Long1> operator+(RValue<Long1> val);
1367// RValue<Long1> operator-(RValue<Long1> val);
1368// RValue<Long1> operator~(RValue<Long1> val);
1369// RValue<Long1> operator++(const Long1 &val, int); // Post-increment
1370// const Long1 &operator++(const Long1 &val); // Pre-increment
1371// RValue<Long1> operator--(const Long1 &val, int); // Post-decrement
1372// const Long1 &operator--(const Long1 &val); // Pre-decrement
1373// RValue<Bool> operator<(RValue<Long1> lhs, RValue<Long1> rhs);
1374// RValue<Bool> operator<=(RValue<Long1> lhs, RValue<Long1> rhs);
1375// RValue<Bool> operator>(RValue<Long1> lhs, RValue<Long1> rhs);
1376// RValue<Bool> operator>=(RValue<Long1> lhs, RValue<Long1> rhs);
1377// RValue<Bool> operator!=(RValue<Long1> lhs, RValue<Long1> rhs);
1378// RValue<Bool> operator==(RValue<Long1> lhs, RValue<Long1> rhs);
1379
Nicolas Capens08e90f02014-11-21 12:49:12 -05001380// RValue<Long1> RoundLong1(RValue<Float> cast);
1381
John Bauman66b8ab22014-05-06 15:57:45 -04001382 class Long2 : public Variable<Long2>
John Bauman89401822014-05-06 15:04:28 -04001383 {
1384 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001385 // explicit Long2(RValue<Long> cast);
1386 // explicit Long2(RValue<Long1> cast);
John Bauman89401822014-05-06 15:04:28 -04001387
1388 // Long2();
1389 // Long2(int x, int y);
John Bauman19bac1e2014-05-06 15:23:49 -04001390 // Long2(RValue<Long2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001391 // Long2(const Long2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001392 // Long2(const Reference<Long2> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001393
John Bauman19bac1e2014-05-06 15:23:49 -04001394 // RValue<Long2> operator=(RValue<Long2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001395 // RValue<Long2> operator=(const Long2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001396 // RValue<Long2> operator=(const Reference<Long2 &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001397
John Bauman19bac1e2014-05-06 15:23:49 -04001398 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001399 };
1400
Nicolas Capens08e90f02014-11-21 12:49:12 -05001401// RValue<Long2> operator+(RValue<Long2> lhs, RValue<Long2> rhs);
1402// RValue<Long2> operator-(RValue<Long2> lhs, RValue<Long2> rhs);
1403// RValue<Long2> operator*(RValue<Long2> lhs, RValue<Long2> rhs);
1404// RValue<Long2> operator/(RValue<Long2> lhs, RValue<Long2> rhs);
1405// RValue<Long2> operator%(RValue<Long2> lhs, RValue<Long2> rhs);
1406// RValue<Long2> operator&(RValue<Long2> lhs, RValue<Long2> rhs);
1407// RValue<Long2> operator|(RValue<Long2> lhs, RValue<Long2> rhs);
1408// RValue<Long2> operator^(RValue<Long2> lhs, RValue<Long2> rhs);
1409// RValue<Long2> operator<<(RValue<Long2> lhs, unsigned char rhs);
1410// RValue<Long2> operator>>(RValue<Long2> lhs, unsigned char rhs);
1411// RValue<Long2> operator<<(RValue<Long2> lhs, RValue<Long1> rhs);
1412// RValue<Long2> operator>>(RValue<Long2> lhs, RValue<Long1> rhs);
1413// RValue<Long2> operator+=(const Long2 &lhs, RValue<Long2> rhs);
1414// RValue<Long2> operator-=(const Long2 &lhs, RValue<Long2> rhs);
1415// RValue<Long2> operator*=(const Long2 &lhs, RValue<Long2> rhs);
1416// RValue<Long2> operator/=(const Long2 &lhs, RValue<Long2> rhs);
1417// RValue<Long2> operator%=(const Long2 &lhs, RValue<Long2> rhs);
1418// RValue<Long2> operator&=(const Long2 &lhs, RValue<Long2> rhs);
1419// RValue<Long2> operator|=(const Long2 &lhs, RValue<Long2> rhs);
1420// RValue<Long2> operator^=(const Long2 &lhs, RValue<Long2> rhs);
1421// RValue<Long2> operator<<=(const Long2 &lhs, unsigned char rhs);
1422// RValue<Long2> operator>>=(const Long2 &lhs, unsigned char rhs);
1423// RValue<Long2> operator<<=(const Long2 &lhs, RValue<Long1> rhs);
1424// RValue<Long2> operator>>=(const Long2 &lhs, RValue<Long1> rhs);
1425// RValue<Long2> operator+(RValue<Long2> val);
1426// RValue<Long2> operator-(RValue<Long2> val);
1427// RValue<Long2> operator~(RValue<Long2> val);
1428// RValue<Long2> operator++(const Long2 &val, int); // Post-increment
1429// const Long2 &operator++(const Long2 &val); // Pre-increment
1430// RValue<Long2> operator--(const Long2 &val, int); // Post-decrement
1431// const Long2 &operator--(const Long2 &val); // Pre-decrement
1432// RValue<Bool> operator<(RValue<Long2> lhs, RValue<Long2> rhs);
1433// RValue<Bool> operator<=(RValue<Long2> lhs, RValue<Long2> rhs);
1434// RValue<Bool> operator>(RValue<Long2> lhs, RValue<Long2> rhs);
1435// RValue<Bool> operator>=(RValue<Long2> lhs, RValue<Long2> rhs);
1436// RValue<Bool> operator!=(RValue<Long2> lhs, RValue<Long2> rhs);
1437// RValue<Bool> operator==(RValue<Long2> lhs, RValue<Long2> rhs);
1438
1439// RValue<Long2> RoundInt(RValue<Float4> cast);
1440// RValue<Long2> UnpackLow(RValue<Long2> x, RValue<Long2> y);
1441 RValue<Long2> UnpackHigh(RValue<Long2> x, RValue<Long2> y);
1442// RValue<Int> Extract(RValue<Long2> val, int i);
1443// RValue<Long2> Insert(RValue<Long2> val, RValue<Int> element, int i);
1444
John Bauman66b8ab22014-05-06 15:57:45 -04001445 class UInt : public Variable<UInt>
John Bauman89401822014-05-06 15:04:28 -04001446 {
1447 public:
Nicolas Capens81f18302016-01-14 09:32:35 -05001448 UInt(Argument<UInt> argument);
John Bauman89401822014-05-06 15:04:28 -04001449
John Bauman19bac1e2014-05-06 15:23:49 -04001450 explicit UInt(RValue<UShort> cast);
1451 explicit UInt(RValue<Long> cast);
1452 explicit UInt(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001453
1454 UInt();
1455 UInt(int x);
1456 UInt(unsigned int x);
John Bauman19bac1e2014-05-06 15:23:49 -04001457 UInt(RValue<UInt> rhs);
1458 UInt(RValue<Int> rhs);
John Bauman89401822014-05-06 15:04:28 -04001459 UInt(const UInt &rhs);
1460 UInt(const Int &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001461 UInt(const Reference<UInt> &rhs);
1462 UInt(const Reference<Int> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001463
1464 RValue<UInt> operator=(unsigned int rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001465 RValue<UInt> operator=(RValue<UInt> rhs) const;
1466 RValue<UInt> operator=(RValue<Int> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001467 RValue<UInt> operator=(const UInt &rhs) const;
1468 RValue<UInt> operator=(const Int &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001469 RValue<UInt> operator=(const Reference<UInt> &rhs) const;
1470 RValue<UInt> operator=(const Reference<Int> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001471
John Bauman19bac1e2014-05-06 15:23:49 -04001472 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001473 };
1474
Nicolas Capens08e90f02014-11-21 12:49:12 -05001475 RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs);
1476 RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs);
1477 RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs);
1478 RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs);
1479 RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs);
1480 RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs);
1481 RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs);
1482 RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs);
1483 RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs);
1484 RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs);
1485 RValue<UInt> operator+=(const UInt &lhs, RValue<UInt> rhs);
1486 RValue<UInt> operator-=(const UInt &lhs, RValue<UInt> rhs);
1487 RValue<UInt> operator*=(const UInt &lhs, RValue<UInt> rhs);
1488 RValue<UInt> operator/=(const UInt &lhs, RValue<UInt> rhs);
1489 RValue<UInt> operator%=(const UInt &lhs, RValue<UInt> rhs);
1490 RValue<UInt> operator&=(const UInt &lhs, RValue<UInt> rhs);
1491 RValue<UInt> operator|=(const UInt &lhs, RValue<UInt> rhs);
1492 RValue<UInt> operator^=(const UInt &lhs, RValue<UInt> rhs);
1493 RValue<UInt> operator<<=(const UInt &lhs, RValue<UInt> rhs);
1494 RValue<UInt> operator>>=(const UInt &lhs, RValue<UInt> rhs);
1495 RValue<UInt> operator+(RValue<UInt> val);
1496 RValue<UInt> operator-(RValue<UInt> val);
1497 RValue<UInt> operator~(RValue<UInt> val);
1498 RValue<UInt> operator++(const UInt &val, int); // Post-increment
1499 const UInt &operator++(const UInt &val); // Pre-increment
1500 RValue<UInt> operator--(const UInt &val, int); // Post-decrement
1501 const UInt &operator--(const UInt &val); // Pre-decrement
1502 RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs);
1503 RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs);
1504 RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs);
1505 RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs);
1506 RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs);
1507 RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs);
1508
1509 RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y);
1510 RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y);
1511 RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max);
1512// RValue<UInt> RoundUInt(RValue<Float> cast);
1513
John Bauman66b8ab22014-05-06 15:57:45 -04001514 class Int2 : public Variable<Int2>
John Bauman89401822014-05-06 15:04:28 -04001515 {
1516 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001517 // explicit Int2(RValue<Int> cast);
1518 explicit Int2(RValue<Int4> cast);
John Bauman89401822014-05-06 15:04:28 -04001519
1520 Int2();
1521 Int2(int x, int y);
John Bauman19bac1e2014-05-06 15:23:49 -04001522 Int2(RValue<Int2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001523 Int2(const Int2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001524 Int2(const Reference<Int2> &rhs);
Nicolas Capens62abb552016-01-05 12:03:47 -05001525 Int2(RValue<Int> lo, RValue<Int> hi);
John Bauman89401822014-05-06 15:04:28 -04001526
John Bauman19bac1e2014-05-06 15:23:49 -04001527 RValue<Int2> operator=(RValue<Int2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001528 RValue<Int2> operator=(const Int2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001529 RValue<Int2> operator=(const Reference<Int2> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001530
John Bauman19bac1e2014-05-06 15:23:49 -04001531 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001532 };
1533
Nicolas Capens08e90f02014-11-21 12:49:12 -05001534 RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs);
1535 RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs);
1536// RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs);
1537// RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs);
1538// RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs);
1539 RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs);
1540 RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs);
1541 RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs);
1542 RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs);
1543 RValue<Int2> operator>>(RValue<Int2> lhs, unsigned char rhs);
1544 RValue<Int2> operator<<(RValue<Int2> lhs, RValue<Long1> rhs);
1545 RValue<Int2> operator>>(RValue<Int2> lhs, RValue<Long1> rhs);
1546 RValue<Int2> operator+=(const Int2 &lhs, RValue<Int2> rhs);
1547 RValue<Int2> operator-=(const Int2 &lhs, RValue<Int2> rhs);
1548// RValue<Int2> operator*=(const Int2 &lhs, RValue<Int2> rhs);
1549// RValue<Int2> operator/=(const Int2 &lhs, RValue<Int2> rhs);
1550// RValue<Int2> operator%=(const Int2 &lhs, RValue<Int2> rhs);
1551 RValue<Int2> operator&=(const Int2 &lhs, RValue<Int2> rhs);
1552 RValue<Int2> operator|=(const Int2 &lhs, RValue<Int2> rhs);
1553 RValue<Int2> operator^=(const Int2 &lhs, RValue<Int2> rhs);
1554 RValue<Int2> operator<<=(const Int2 &lhs, unsigned char rhs);
1555 RValue<Int2> operator>>=(const Int2 &lhs, unsigned char rhs);
1556 RValue<Int2> operator<<=(const Int2 &lhs, RValue<Long1> rhs);
1557 RValue<Int2> operator>>=(const Int2 &lhs, RValue<Long1> rhs);
1558// RValue<Int2> operator+(RValue<Int2> val);
1559// RValue<Int2> operator-(RValue<Int2> val);
1560 RValue<Int2> operator~(RValue<Int2> val);
1561// RValue<Int2> operator++(const Int2 &val, int); // Post-increment
1562// const Int2 &operator++(const Int2 &val); // Pre-increment
1563// RValue<Int2> operator--(const Int2 &val, int); // Post-decrement
1564// const Int2 &operator--(const Int2 &val); // Pre-decrement
1565// RValue<Bool> operator<(RValue<Int2> lhs, RValue<Int2> rhs);
1566// RValue<Bool> operator<=(RValue<Int2> lhs, RValue<Int2> rhs);
1567// RValue<Bool> operator>(RValue<Int2> lhs, RValue<Int2> rhs);
1568// RValue<Bool> operator>=(RValue<Int2> lhs, RValue<Int2> rhs);
1569// RValue<Bool> operator!=(RValue<Int2> lhs, RValue<Int2> rhs);
1570// RValue<Bool> operator==(RValue<Int2> lhs, RValue<Int2> rhs);
1571
1572// RValue<Int2> RoundInt(RValue<Float4> cast);
1573 RValue<Long1> UnpackLow(RValue<Int2> x, RValue<Int2> y);
1574 RValue<Long1> UnpackHigh(RValue<Int2> x, RValue<Int2> y);
1575 RValue<Int> Extract(RValue<Int2> val, int i);
Nicolas Capensfff3c9b2015-05-13 23:40:44 -04001576 RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001577
John Bauman66b8ab22014-05-06 15:57:45 -04001578 class UInt2 : public Variable<UInt2>
John Bauman89401822014-05-06 15:04:28 -04001579 {
1580 public:
1581 UInt2();
1582 UInt2(unsigned int x, unsigned int y);
John Bauman19bac1e2014-05-06 15:23:49 -04001583 UInt2(RValue<UInt2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001584 UInt2(const UInt2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001585 UInt2(const Reference<UInt2> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001586
John Bauman19bac1e2014-05-06 15:23:49 -04001587 RValue<UInt2> operator=(RValue<UInt2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001588 RValue<UInt2> operator=(const UInt2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001589 RValue<UInt2> operator=(const Reference<UInt2> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001590
John Bauman19bac1e2014-05-06 15:23:49 -04001591 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001592 };
1593
Nicolas Capens08e90f02014-11-21 12:49:12 -05001594 RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs);
1595 RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs);
1596// RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs);
1597// RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs);
1598// RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs);
1599 RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs);
1600 RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs);
1601 RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs);
1602 RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs);
1603 RValue<UInt2> operator>>(RValue<UInt2> lhs, unsigned char rhs);
1604 RValue<UInt2> operator<<(RValue<UInt2> lhs, RValue<Long1> rhs);
1605 RValue<UInt2> operator>>(RValue<UInt2> lhs, RValue<Long1> rhs);
1606 RValue<UInt2> operator+=(const UInt2 &lhs, RValue<UInt2> rhs);
1607 RValue<UInt2> operator-=(const UInt2 &lhs, RValue<UInt2> rhs);
1608// RValue<UInt2> operator*=(const UInt2 &lhs, RValue<UInt2> rhs);
1609// RValue<UInt2> operator/=(const UInt2 &lhs, RValue<UInt2> rhs);
1610// RValue<UInt2> operator%=(const UInt2 &lhs, RValue<UInt2> rhs);
1611 RValue<UInt2> operator&=(const UInt2 &lhs, RValue<UInt2> rhs);
1612 RValue<UInt2> operator|=(const UInt2 &lhs, RValue<UInt2> rhs);
1613 RValue<UInt2> operator^=(const UInt2 &lhs, RValue<UInt2> rhs);
1614 RValue<UInt2> operator<<=(const UInt2 &lhs, unsigned char rhs);
1615 RValue<UInt2> operator>>=(const UInt2 &lhs, unsigned char rhs);
1616 RValue<UInt2> operator<<=(const UInt2 &lhs, RValue<Long1> rhs);
1617 RValue<UInt2> operator>>=(const UInt2 &lhs, RValue<Long1> rhs);
1618// RValue<UInt2> operator+(RValue<UInt2> val);
1619// RValue<UInt2> operator-(RValue<UInt2> val);
1620 RValue<UInt2> operator~(RValue<UInt2> val);
1621// RValue<UInt2> operator++(const UInt2 &val, int); // Post-increment
1622// const UInt2 &operator++(const UInt2 &val); // Pre-increment
1623// RValue<UInt2> operator--(const UInt2 &val, int); // Post-decrement
1624// const UInt2 &operator--(const UInt2 &val); // Pre-decrement
1625// RValue<Bool> operator<(RValue<UInt2> lhs, RValue<UInt2> rhs);
1626// RValue<Bool> operator<=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1627// RValue<Bool> operator>(RValue<UInt2> lhs, RValue<UInt2> rhs);
1628// RValue<Bool> operator>=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1629// RValue<Bool> operator!=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1630// RValue<Bool> operator==(RValue<UInt2> lhs, RValue<UInt2> rhs);
1631
1632// RValue<UInt2> RoundInt(RValue<Float4> cast);
1633
John Bauman66b8ab22014-05-06 15:57:45 -04001634 class Int4 : public Variable<Int4>
John Bauman89401822014-05-06 15:04:28 -04001635 {
1636 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001637 explicit Int4(RValue<Float4> cast);
Alexis Hetu2aa852f2015-10-14 16:32:39 -04001638 explicit Int4(RValue<Short4> cast);
1639 explicit Int4(RValue<UShort4> cast);
John Bauman89401822014-05-06 15:04:28 -04001640
1641 Int4();
1642 Int4(int xyzw);
1643 Int4(int x, int yzw);
1644 Int4(int x, int y, int zw);
1645 Int4(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -04001646 Int4(RValue<Int4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001647 Int4(const Int4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001648 Int4(const Reference<Int4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001649 Int4(RValue<UInt4> rhs);
1650 Int4(const UInt4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001651 Int4(const Reference<UInt4> &rhs);
Nicolas Capens62abb552016-01-05 12:03:47 -05001652 Int4(RValue<Int2> lo, RValue<Int2> hi);
John Bauman89401822014-05-06 15:04:28 -04001653
John Bauman19bac1e2014-05-06 15:23:49 -04001654 RValue<Int4> operator=(RValue<Int4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001655 RValue<Int4> operator=(const Int4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001656 RValue<Int4> operator=(const Reference<Int4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001657
John Bauman19bac1e2014-05-06 15:23:49 -04001658 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001659
1660 private:
1661 void constant(int x, int y, int z, int w);
1662 };
1663
Nicolas Capens08e90f02014-11-21 12:49:12 -05001664 RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs);
1665 RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs);
1666 RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs);
Alexis Hetud9d27bb2015-08-18 15:22:15 -04001667 RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs);
1668 RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001669 RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs);
1670 RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs);
1671 RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs);
1672 RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs);
1673 RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs);
Alexis Hetud9d27bb2015-08-18 15:22:15 -04001674 RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs);
1675 RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001676 RValue<Int4> operator+=(const Int4 &lhs, RValue<Int4> rhs);
1677 RValue<Int4> operator-=(const Int4 &lhs, RValue<Int4> rhs);
1678 RValue<Int4> operator*=(const Int4 &lhs, RValue<Int4> rhs);
1679// RValue<Int4> operator/=(const Int4 &lhs, RValue<Int4> rhs);
1680// RValue<Int4> operator%=(const Int4 &lhs, RValue<Int4> rhs);
1681 RValue<Int4> operator&=(const Int4 &lhs, RValue<Int4> rhs);
1682 RValue<Int4> operator|=(const Int4 &lhs, RValue<Int4> rhs);
1683 RValue<Int4> operator^=(const Int4 &lhs, RValue<Int4> rhs);
1684 RValue<Int4> operator<<=(const Int4 &lhs, unsigned char rhs);
1685 RValue<Int4> operator>>=(const Int4 &lhs, unsigned char rhs);
1686 RValue<Int4> operator+(RValue<Int4> val);
1687 RValue<Int4> operator-(RValue<Int4> val);
1688 RValue<Int4> operator~(RValue<Int4> val);
1689// RValue<Int4> operator++(const Int4 &val, int); // Post-increment
1690// const Int4 &operator++(const Int4 &val); // Pre-increment
1691// RValue<Int4> operator--(const Int4 &val, int); // Post-decrement
1692// const Int4 &operator--(const Int4 &val); // Pre-decrement
1693// RValue<Bool> operator<(RValue<Int4> lhs, RValue<Int4> rhs);
1694// RValue<Bool> operator<=(RValue<Int4> lhs, RValue<Int4> rhs);
1695// RValue<Bool> operator>(RValue<Int4> lhs, RValue<Int4> rhs);
1696// RValue<Bool> operator>=(RValue<Int4> lhs, RValue<Int4> rhs);
1697// RValue<Bool> operator!=(RValue<Int4> lhs, RValue<Int4> rhs);
1698// RValue<Bool> operator==(RValue<Int4> lhs, RValue<Int4> rhs);
1699
1700 RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y);
1701 RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y);
1702 RValue<Int4> CmpLE(RValue<Int4> x, RValue<Int4> y);
1703 RValue<Int4> CmpNEQ(RValue<Int4> x, RValue<Int4> y);
1704 RValue<Int4> CmpNLT(RValue<Int4> x, RValue<Int4> y);
1705 RValue<Int4> CmpNLE(RValue<Int4> x, RValue<Int4> y);
1706 RValue<Int4> Max(RValue<Int4> x, RValue<Int4> y);
1707 RValue<Int4> Min(RValue<Int4> x, RValue<Int4> y);
1708 RValue<Int4> RoundInt(RValue<Float4> cast);
1709 RValue<Short8> Pack(RValue<Int4> x, RValue<Int4> y);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001710 RValue<Int> Extract(RValue<Int4> x, int i);
1711 RValue<Int4> Insert(RValue<Int4> val, RValue<Int> element, int i);
1712 RValue<Int> SignMask(RValue<Int4> x);
1713 RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select);
1714
John Bauman66b8ab22014-05-06 15:57:45 -04001715 class UInt4 : public Variable<UInt4>
John Bauman89401822014-05-06 15:04:28 -04001716 {
1717 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001718 explicit UInt4(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001719
1720 UInt4();
John Bauman19bac1e2014-05-06 15:23:49 -04001721 UInt4(int xyzw);
1722 UInt4(int x, int yzw);
1723 UInt4(int x, int y, int zw);
1724 UInt4(int x, int y, int z, int w);
John Bauman89401822014-05-06 15:04:28 -04001725 UInt4(unsigned int x, unsigned int y, unsigned int z, unsigned int w);
John Bauman19bac1e2014-05-06 15:23:49 -04001726 UInt4(RValue<UInt4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001727 UInt4(const UInt4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001728 UInt4(const Reference<UInt4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001729 UInt4(RValue<Int4> rhs);
1730 UInt4(const Int4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001731 UInt4(const Reference<Int4> &rhs);
Nicolas Capens62abb552016-01-05 12:03:47 -05001732 UInt4(RValue<UInt2> lo, RValue<UInt2> hi);
John Bauman89401822014-05-06 15:04:28 -04001733
John Bauman19bac1e2014-05-06 15:23:49 -04001734 RValue<UInt4> operator=(RValue<UInt4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001735 RValue<UInt4> operator=(const UInt4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001736 RValue<UInt4> operator=(const Reference<UInt4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001737
John Bauman19bac1e2014-05-06 15:23:49 -04001738 static llvm::Type *getType();
1739
1740 private:
1741 void constant(int x, int y, int z, int w);
John Bauman89401822014-05-06 15:04:28 -04001742 };
1743
Nicolas Capens08e90f02014-11-21 12:49:12 -05001744 RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs);
1745 RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs);
1746 RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs);
Alexis Hetud9d27bb2015-08-18 15:22:15 -04001747 RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs);
1748 RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001749 RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs);
1750 RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs);
1751 RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs);
1752 RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs);
1753 RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs);
Alexis Hetud9d27bb2015-08-18 15:22:15 -04001754 RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs);
1755 RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001756 RValue<UInt4> operator+=(const UInt4 &lhs, RValue<UInt4> rhs);
1757 RValue<UInt4> operator-=(const UInt4 &lhs, RValue<UInt4> rhs);
1758 RValue<UInt4> operator*=(const UInt4 &lhs, RValue<UInt4> rhs);
1759// RValue<UInt4> operator/=(const UInt4 &lhs, RValue<UInt4> rhs);
1760// RValue<UInt4> operator%=(const UInt4 &lhs, RValue<UInt4> rhs);
1761 RValue<UInt4> operator&=(const UInt4 &lhs, RValue<UInt4> rhs);
1762 RValue<UInt4> operator|=(const UInt4 &lhs, RValue<UInt4> rhs);
1763 RValue<UInt4> operator^=(const UInt4 &lhs, RValue<UInt4> rhs);
1764 RValue<UInt4> operator<<=(const UInt4 &lhs, unsigned char rhs);
1765 RValue<UInt4> operator>>=(const UInt4 &lhs, unsigned char rhs);
1766 RValue<UInt4> operator+(RValue<UInt4> val);
1767 RValue<UInt4> operator-(RValue<UInt4> val);
1768 RValue<UInt4> operator~(RValue<UInt4> val);
1769// RValue<UInt4> operator++(const UInt4 &val, int); // Post-increment
1770// const UInt4 &operator++(const UInt4 &val); // Pre-increment
1771// RValue<UInt4> operator--(const UInt4 &val, int); // Post-decrement
1772// const UInt4 &operator--(const UInt4 &val); // Pre-decrement
1773// RValue<Bool> operator<(RValue<UInt4> lhs, RValue<UInt4> rhs);
1774// RValue<Bool> operator<=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1775// RValue<Bool> operator>(RValue<UInt4> lhs, RValue<UInt4> rhs);
1776// RValue<Bool> operator>=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1777// RValue<Bool> operator!=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1778// RValue<Bool> operator==(RValue<UInt4> lhs, RValue<UInt4> rhs);
1779
1780 RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y);
1781 RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y);
1782 RValue<UInt4> CmpLE(RValue<UInt4> x, RValue<UInt4> y);
1783 RValue<UInt4> CmpNEQ(RValue<UInt4> x, RValue<UInt4> y);
1784 RValue<UInt4> CmpNLT(RValue<UInt4> x, RValue<UInt4> y);
1785 RValue<UInt4> CmpNLE(RValue<UInt4> x, RValue<UInt4> y);
1786 RValue<UInt4> Max(RValue<UInt4> x, RValue<UInt4> y);
1787 RValue<UInt4> Min(RValue<UInt4> x, RValue<UInt4> y);
1788// RValue<UInt4> RoundInt(RValue<Float4> cast);
1789 RValue<UShort8> Pack(RValue<UInt4> x, RValue<UInt4> y);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001790
John Bauman66b8ab22014-05-06 15:57:45 -04001791 template<int T>
1792 class Swizzle2Float4
1793 {
1794 friend class Float4;
1795
1796 public:
1797 operator RValue<Float4>() const;
1798
1799 private:
1800 Float4 *parent;
1801 };
1802
1803 template<int T>
1804 class SwizzleFloat4
1805 {
1806 public:
1807 operator RValue<Float4>() const;
1808
1809 private:
1810 Float4 *parent;
1811 };
1812
1813 template<int T>
1814 class SwizzleMaskFloat4
1815 {
1816 friend class Float4;
1817
1818 public:
1819 operator RValue<Float4>() const;
1820
1821 RValue<Float4> operator=(RValue<Float4> rhs) const;
1822 RValue<Float4> operator=(RValue<Float> rhs) const;
1823
1824 private:
1825 Float4 *parent;
1826 };
1827
1828 template<int T>
1829 class SwizzleMask1Float4
1830 {
1831 public:
1832 operator RValue<Float>() const;
1833 operator RValue<Float4>() const;
1834
1835 RValue<Float4> operator=(float x) const;
1836 RValue<Float4> operator=(RValue<Float4> rhs) const;
1837 RValue<Float4> operator=(RValue<Float> rhs) const;
1838
1839 private:
1840 Float4 *parent;
1841 };
1842
1843 template<int T>
1844 class SwizzleMask2Float4
1845 {
1846 friend class Float4;
1847
1848 public:
1849 operator RValue<Float4>() const;
1850
1851 RValue<Float4> operator=(RValue<Float4> rhs) const;
1852
1853 private:
1854 Float4 *parent;
1855 };
1856
1857 class Float : public Variable<Float>
John Bauman89401822014-05-06 15:04:28 -04001858 {
1859 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001860 explicit Float(RValue<Int> cast);
John Bauman89401822014-05-06 15:04:28 -04001861
1862 Float();
1863 Float(float x);
John Bauman19bac1e2014-05-06 15:23:49 -04001864 Float(RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001865 Float(const Float &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001866 Float(const Reference<Float> &rhs);
1867
1868 template<int T>
1869 Float(const SwizzleMask1Float4<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001870
1871 // RValue<Float> operator=(float rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -04001872 RValue<Float> operator=(RValue<Float> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001873 RValue<Float> operator=(const Float &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001874 RValue<Float> operator=(const Reference<Float> &rhs) const;
1875
1876 template<int T>
1877 RValue<Float> operator=(const SwizzleMask1Float4<T> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001878
John Bauman19bac1e2014-05-06 15:23:49 -04001879 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001880 };
1881
Nicolas Capens08e90f02014-11-21 12:49:12 -05001882 RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs);
1883 RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs);
1884 RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs);
1885 RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs);
1886 RValue<Float> operator+=(const Float &lhs, RValue<Float> rhs);
1887 RValue<Float> operator-=(const Float &lhs, RValue<Float> rhs);
1888 RValue<Float> operator*=(const Float &lhs, RValue<Float> rhs);
1889 RValue<Float> operator/=(const Float &lhs, RValue<Float> rhs);
1890 RValue<Float> operator+(RValue<Float> val);
1891 RValue<Float> operator-(RValue<Float> val);
1892 RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs);
1893 RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs);
1894 RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs);
1895 RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs);
1896 RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs);
1897 RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs);
1898
1899 RValue<Float> Abs(RValue<Float> x);
1900 RValue<Float> Max(RValue<Float> x, RValue<Float> y);
1901 RValue<Float> Min(RValue<Float> x, RValue<Float> y);
Nicolas Capens05b3d662016-02-25 23:58:33 -05001902 RValue<Float> Rcp_pp(RValue<Float> val, bool exactAtPow2 = false);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001903 RValue<Float> RcpSqrt_pp(RValue<Float> val);
1904 RValue<Float> Sqrt(RValue<Float> x);
1905 RValue<Float> Round(RValue<Float> val);
1906 RValue<Float> Trunc(RValue<Float> val);
1907 RValue<Float> Frac(RValue<Float> val);
1908 RValue<Float> Floor(RValue<Float> val);
1909 RValue<Float> Ceil(RValue<Float> val);
1910
John Bauman66b8ab22014-05-06 15:57:45 -04001911 class Float2 : public Variable<Float2>
John Bauman89401822014-05-06 15:04:28 -04001912 {
1913 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001914 // explicit Float2(RValue<Byte2> cast);
1915 // explicit Float2(RValue<Short2> cast);
1916 // explicit Float2(RValue<UShort2> cast);
1917 // explicit Float2(RValue<Int2> cast);
1918 // explicit Float2(RValue<UInt2> cast);
1919 explicit Float2(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001920
1921 // Float2();
1922 // Float2(float x, float y);
John Bauman19bac1e2014-05-06 15:23:49 -04001923 // Float2(RValue<Float2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001924 // Float2(const Float2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001925 // Float2(const Reference<Float2> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001926 // Float2(RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001927 // Float2(const Float &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001928 // Float2(const Reference<Float> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001929
1930 // template<int T>
1931 // Float2(const SwizzleMask1Float4<T> &rhs);
1932
1933 // RValue<Float2> operator=(float replicate) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001934 // RValue<Float2> operator=(RValue<Float2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001935 // RValue<Float2> operator=(const Float2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001936 // RValue<Float2> operator=(const Reference<Float2> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001937 // RValue<Float2> operator=(RValue<Float> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001938 // RValue<Float2> operator=(const Float &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001939 // RValue<Float2> operator=(const Reference<Float> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001940
1941 // template<int T>
1942 // RValue<Float2> operator=(const SwizzleMask1Float4<T> &rhs);
1943
John Bauman19bac1e2014-05-06 15:23:49 -04001944 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001945 };
1946
Nicolas Capens08e90f02014-11-21 12:49:12 -05001947// RValue<Float2> operator+(RValue<Float2> lhs, RValue<Float2> rhs);
1948// RValue<Float2> operator-(RValue<Float2> lhs, RValue<Float2> rhs);
1949// RValue<Float2> operator*(RValue<Float2> lhs, RValue<Float2> rhs);
1950// RValue<Float2> operator/(RValue<Float2> lhs, RValue<Float2> rhs);
1951// RValue<Float2> operator%(RValue<Float2> lhs, RValue<Float2> rhs);
1952// RValue<Float2> operator+=(const Float2 &lhs, RValue<Float2> rhs);
1953// RValue<Float2> operator-=(const Float2 &lhs, RValue<Float2> rhs);
1954// RValue<Float2> operator*=(const Float2 &lhs, RValue<Float2> rhs);
1955// RValue<Float2> operator/=(const Float2 &lhs, RValue<Float2> rhs);
1956// RValue<Float2> operator%=(const Float2 &lhs, RValue<Float2> rhs);
1957// RValue<Float2> operator+(RValue<Float2> val);
1958// RValue<Float2> operator-(RValue<Float2> val);
1959
1960// RValue<Float2> Abs(RValue<Float2> x);
1961// RValue<Float2> Max(RValue<Float2> x, RValue<Float2> y);
1962// RValue<Float2> Min(RValue<Float2> x, RValue<Float2> y);
1963// RValue<Float2> Swizzle(RValue<Float2> x, unsigned char select);
1964// RValue<Float2> Mask(Float2 &lhs, RValue<Float2> rhs, unsigned char select);
1965
John Bauman66b8ab22014-05-06 15:57:45 -04001966 class Float4 : public Variable<Float4>
John Bauman89401822014-05-06 15:04:28 -04001967 {
1968 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001969 explicit Float4(RValue<Byte4> cast);
1970 explicit Float4(RValue<SByte4> cast);
1971 explicit Float4(RValue<Short4> cast);
1972 explicit Float4(RValue<UShort4> cast);
1973 explicit Float4(RValue<Int4> cast);
1974 explicit Float4(RValue<UInt4> cast);
John Bauman89401822014-05-06 15:04:28 -04001975
1976 Float4();
1977 Float4(float xyzw);
1978 Float4(float x, float yzw);
1979 Float4(float x, float y, float zw);
1980 Float4(float x, float y, float z, float w);
John Bauman19bac1e2014-05-06 15:23:49 -04001981 Float4(RValue<Float4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001982 Float4(const Float4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001983 Float4(const Reference<Float4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001984 Float4(RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001985 Float4(const Float &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001986 Float4(const Reference<Float> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001987
1988 template<int T>
1989 Float4(const SwizzleMask1Float4<T> &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001990 template<int T>
1991 Float4(const SwizzleFloat4<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001992 template<int X, int Y>
1993 Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y);
1994 template<int X, int Y>
1995 Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y);
1996 template<int X, int Y>
1997 Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
1998 template<int X, int Y>
1999 Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
2000
2001 RValue<Float4> operator=(float replicate) const;
John Bauman19bac1e2014-05-06 15:23:49 -04002002 RValue<Float4> operator=(RValue<Float4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04002003 RValue<Float4> operator=(const Float4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04002004 RValue<Float4> operator=(const Reference<Float4> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04002005 RValue<Float4> operator=(RValue<Float> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04002006 RValue<Float4> operator=(const Float &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04002007 RValue<Float4> operator=(const Reference<Float> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04002008
2009 template<int T>
2010 RValue<Float4> operator=(const SwizzleMask1Float4<T> &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04002011 template<int T>
2012 RValue<Float4> operator=(const SwizzleFloat4<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -04002013
John Bauman19bac1e2014-05-06 15:23:49 -04002014 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04002015
2016 union
2017 {
2018 SwizzleMask1Float4<0x00> x;
2019 SwizzleMask1Float4<0x55> y;
2020 SwizzleMask1Float4<0xAA> z;
2021 SwizzleMask1Float4<0xFF> w;
2022 Swizzle2Float4<0x00> xx;
2023 Swizzle2Float4<0x01> yx;
2024 Swizzle2Float4<0x02> zx;
2025 Swizzle2Float4<0x03> wx;
2026 SwizzleMask2Float4<0x54> xy;
2027 Swizzle2Float4<0x55> yy;
2028 Swizzle2Float4<0x56> zy;
2029 Swizzle2Float4<0x57> wy;
2030 SwizzleMask2Float4<0xA8> xz;
2031 SwizzleMask2Float4<0xA9> yz;
2032 Swizzle2Float4<0xAA> zz;
2033 Swizzle2Float4<0xAB> wz;
2034 SwizzleMask2Float4<0xFC> xw;
2035 SwizzleMask2Float4<0xFD> yw;
2036 SwizzleMask2Float4<0xFE> zw;
2037 Swizzle2Float4<0xFF> ww;
2038 SwizzleFloat4<0x00> xxx;
2039 SwizzleFloat4<0x01> yxx;
2040 SwizzleFloat4<0x02> zxx;
2041 SwizzleFloat4<0x03> wxx;
2042 SwizzleFloat4<0x04> xyx;
2043 SwizzleFloat4<0x05> yyx;
2044 SwizzleFloat4<0x06> zyx;
2045 SwizzleFloat4<0x07> wyx;
2046 SwizzleFloat4<0x08> xzx;
2047 SwizzleFloat4<0x09> yzx;
2048 SwizzleFloat4<0x0A> zzx;
2049 SwizzleFloat4<0x0B> wzx;
2050 SwizzleFloat4<0x0C> xwx;
2051 SwizzleFloat4<0x0D> ywx;
2052 SwizzleFloat4<0x0E> zwx;
2053 SwizzleFloat4<0x0F> wwx;
2054 SwizzleFloat4<0x50> xxy;
2055 SwizzleFloat4<0x51> yxy;
2056 SwizzleFloat4<0x52> zxy;
2057 SwizzleFloat4<0x53> wxy;
2058 SwizzleFloat4<0x54> xyy;
2059 SwizzleFloat4<0x55> yyy;
2060 SwizzleFloat4<0x56> zyy;
2061 SwizzleFloat4<0x57> wyy;
2062 SwizzleFloat4<0x58> xzy;
2063 SwizzleFloat4<0x59> yzy;
2064 SwizzleFloat4<0x5A> zzy;
2065 SwizzleFloat4<0x5B> wzy;
2066 SwizzleFloat4<0x5C> xwy;
2067 SwizzleFloat4<0x5D> ywy;
2068 SwizzleFloat4<0x5E> zwy;
2069 SwizzleFloat4<0x5F> wwy;
2070 SwizzleFloat4<0xA0> xxz;
2071 SwizzleFloat4<0xA1> yxz;
2072 SwizzleFloat4<0xA2> zxz;
2073 SwizzleFloat4<0xA3> wxz;
2074 SwizzleMaskFloat4<0xA4> xyz;
2075 SwizzleFloat4<0xA5> yyz;
2076 SwizzleFloat4<0xA6> zyz;
2077 SwizzleFloat4<0xA7> wyz;
2078 SwizzleFloat4<0xA8> xzz;
2079 SwizzleFloat4<0xA9> yzz;
2080 SwizzleFloat4<0xAA> zzz;
2081 SwizzleFloat4<0xAB> wzz;
2082 SwizzleFloat4<0xAC> xwz;
2083 SwizzleFloat4<0xAD> ywz;
2084 SwizzleFloat4<0xAE> zwz;
2085 SwizzleFloat4<0xAF> wwz;
2086 SwizzleFloat4<0xF0> xxw;
2087 SwizzleFloat4<0xF1> yxw;
2088 SwizzleFloat4<0xF2> zxw;
2089 SwizzleFloat4<0xF3> wxw;
2090 SwizzleMaskFloat4<0xF4> xyw;
2091 SwizzleFloat4<0xF5> yyw;
2092 SwizzleFloat4<0xF6> zyw;
2093 SwizzleFloat4<0xF7> wyw;
2094 SwizzleMaskFloat4<0xF8> xzw;
2095 SwizzleMaskFloat4<0xF9> yzw;
2096 SwizzleFloat4<0xFA> zzw;
2097 SwizzleFloat4<0xFB> wzw;
2098 SwizzleFloat4<0xFC> xww;
2099 SwizzleFloat4<0xFD> yww;
2100 SwizzleFloat4<0xFE> zww;
2101 SwizzleFloat4<0xFF> www;
2102 SwizzleFloat4<0x00> xxxx;
2103 SwizzleFloat4<0x01> yxxx;
2104 SwizzleFloat4<0x02> zxxx;
2105 SwizzleFloat4<0x03> wxxx;
2106 SwizzleFloat4<0x04> xyxx;
2107 SwizzleFloat4<0x05> yyxx;
2108 SwizzleFloat4<0x06> zyxx;
2109 SwizzleFloat4<0x07> wyxx;
2110 SwizzleFloat4<0x08> xzxx;
2111 SwizzleFloat4<0x09> yzxx;
2112 SwizzleFloat4<0x0A> zzxx;
2113 SwizzleFloat4<0x0B> wzxx;
2114 SwizzleFloat4<0x0C> xwxx;
2115 SwizzleFloat4<0x0D> ywxx;
2116 SwizzleFloat4<0x0E> zwxx;
2117 SwizzleFloat4<0x0F> wwxx;
2118 SwizzleFloat4<0x10> xxyx;
2119 SwizzleFloat4<0x11> yxyx;
2120 SwizzleFloat4<0x12> zxyx;
2121 SwizzleFloat4<0x13> wxyx;
2122 SwizzleFloat4<0x14> xyyx;
2123 SwizzleFloat4<0x15> yyyx;
2124 SwizzleFloat4<0x16> zyyx;
2125 SwizzleFloat4<0x17> wyyx;
2126 SwizzleFloat4<0x18> xzyx;
2127 SwizzleFloat4<0x19> yzyx;
2128 SwizzleFloat4<0x1A> zzyx;
2129 SwizzleFloat4<0x1B> wzyx;
2130 SwizzleFloat4<0x1C> xwyx;
2131 SwizzleFloat4<0x1D> ywyx;
2132 SwizzleFloat4<0x1E> zwyx;
2133 SwizzleFloat4<0x1F> wwyx;
2134 SwizzleFloat4<0x20> xxzx;
2135 SwizzleFloat4<0x21> yxzx;
2136 SwizzleFloat4<0x22> zxzx;
2137 SwizzleFloat4<0x23> wxzx;
2138 SwizzleFloat4<0x24> xyzx;
2139 SwizzleFloat4<0x25> yyzx;
2140 SwizzleFloat4<0x26> zyzx;
2141 SwizzleFloat4<0x27> wyzx;
2142 SwizzleFloat4<0x28> xzzx;
2143 SwizzleFloat4<0x29> yzzx;
2144 SwizzleFloat4<0x2A> zzzx;
2145 SwizzleFloat4<0x2B> wzzx;
2146 SwizzleFloat4<0x2C> xwzx;
2147 SwizzleFloat4<0x2D> ywzx;
2148 SwizzleFloat4<0x2E> zwzx;
2149 SwizzleFloat4<0x2F> wwzx;
2150 SwizzleFloat4<0x30> xxwx;
2151 SwizzleFloat4<0x31> yxwx;
2152 SwizzleFloat4<0x32> zxwx;
2153 SwizzleFloat4<0x33> wxwx;
2154 SwizzleFloat4<0x34> xywx;
2155 SwizzleFloat4<0x35> yywx;
2156 SwizzleFloat4<0x36> zywx;
2157 SwizzleFloat4<0x37> wywx;
2158 SwizzleFloat4<0x38> xzwx;
2159 SwizzleFloat4<0x39> yzwx;
2160 SwizzleFloat4<0x3A> zzwx;
2161 SwizzleFloat4<0x3B> wzwx;
2162 SwizzleFloat4<0x3C> xwwx;
2163 SwizzleFloat4<0x3D> ywwx;
2164 SwizzleFloat4<0x3E> zwwx;
2165 SwizzleFloat4<0x3F> wwwx;
2166 SwizzleFloat4<0x40> xxxy;
2167 SwizzleFloat4<0x41> yxxy;
2168 SwizzleFloat4<0x42> zxxy;
2169 SwizzleFloat4<0x43> wxxy;
2170 SwizzleFloat4<0x44> xyxy;
2171 SwizzleFloat4<0x45> yyxy;
2172 SwizzleFloat4<0x46> zyxy;
2173 SwizzleFloat4<0x47> wyxy;
2174 SwizzleFloat4<0x48> xzxy;
2175 SwizzleFloat4<0x49> yzxy;
2176 SwizzleFloat4<0x4A> zzxy;
2177 SwizzleFloat4<0x4B> wzxy;
2178 SwizzleFloat4<0x4C> xwxy;
2179 SwizzleFloat4<0x4D> ywxy;
2180 SwizzleFloat4<0x4E> zwxy;
2181 SwizzleFloat4<0x4F> wwxy;
2182 SwizzleFloat4<0x50> xxyy;
2183 SwizzleFloat4<0x51> yxyy;
2184 SwizzleFloat4<0x52> zxyy;
2185 SwizzleFloat4<0x53> wxyy;
2186 SwizzleFloat4<0x54> xyyy;
2187 SwizzleFloat4<0x55> yyyy;
2188 SwizzleFloat4<0x56> zyyy;
2189 SwizzleFloat4<0x57> wyyy;
2190 SwizzleFloat4<0x58> xzyy;
2191 SwizzleFloat4<0x59> yzyy;
2192 SwizzleFloat4<0x5A> zzyy;
2193 SwizzleFloat4<0x5B> wzyy;
2194 SwizzleFloat4<0x5C> xwyy;
2195 SwizzleFloat4<0x5D> ywyy;
2196 SwizzleFloat4<0x5E> zwyy;
2197 SwizzleFloat4<0x5F> wwyy;
2198 SwizzleFloat4<0x60> xxzy;
2199 SwizzleFloat4<0x61> yxzy;
2200 SwizzleFloat4<0x62> zxzy;
2201 SwizzleFloat4<0x63> wxzy;
2202 SwizzleFloat4<0x64> xyzy;
2203 SwizzleFloat4<0x65> yyzy;
2204 SwizzleFloat4<0x66> zyzy;
2205 SwizzleFloat4<0x67> wyzy;
2206 SwizzleFloat4<0x68> xzzy;
2207 SwizzleFloat4<0x69> yzzy;
2208 SwizzleFloat4<0x6A> zzzy;
2209 SwizzleFloat4<0x6B> wzzy;
2210 SwizzleFloat4<0x6C> xwzy;
2211 SwizzleFloat4<0x6D> ywzy;
2212 SwizzleFloat4<0x6E> zwzy;
2213 SwizzleFloat4<0x6F> wwzy;
2214 SwizzleFloat4<0x70> xxwy;
2215 SwizzleFloat4<0x71> yxwy;
2216 SwizzleFloat4<0x72> zxwy;
2217 SwizzleFloat4<0x73> wxwy;
2218 SwizzleFloat4<0x74> xywy;
2219 SwizzleFloat4<0x75> yywy;
2220 SwizzleFloat4<0x76> zywy;
2221 SwizzleFloat4<0x77> wywy;
2222 SwizzleFloat4<0x78> xzwy;
2223 SwizzleFloat4<0x79> yzwy;
2224 SwizzleFloat4<0x7A> zzwy;
2225 SwizzleFloat4<0x7B> wzwy;
2226 SwizzleFloat4<0x7C> xwwy;
2227 SwizzleFloat4<0x7D> ywwy;
2228 SwizzleFloat4<0x7E> zwwy;
2229 SwizzleFloat4<0x7F> wwwy;
2230 SwizzleFloat4<0x80> xxxz;
2231 SwizzleFloat4<0x81> yxxz;
2232 SwizzleFloat4<0x82> zxxz;
2233 SwizzleFloat4<0x83> wxxz;
2234 SwizzleFloat4<0x84> xyxz;
2235 SwizzleFloat4<0x85> yyxz;
2236 SwizzleFloat4<0x86> zyxz;
2237 SwizzleFloat4<0x87> wyxz;
2238 SwizzleFloat4<0x88> xzxz;
2239 SwizzleFloat4<0x89> yzxz;
2240 SwizzleFloat4<0x8A> zzxz;
2241 SwizzleFloat4<0x8B> wzxz;
2242 SwizzleFloat4<0x8C> xwxz;
2243 SwizzleFloat4<0x8D> ywxz;
2244 SwizzleFloat4<0x8E> zwxz;
2245 SwizzleFloat4<0x8F> wwxz;
2246 SwizzleFloat4<0x90> xxyz;
2247 SwizzleFloat4<0x91> yxyz;
2248 SwizzleFloat4<0x92> zxyz;
2249 SwizzleFloat4<0x93> wxyz;
2250 SwizzleFloat4<0x94> xyyz;
2251 SwizzleFloat4<0x95> yyyz;
2252 SwizzleFloat4<0x96> zyyz;
2253 SwizzleFloat4<0x97> wyyz;
2254 SwizzleFloat4<0x98> xzyz;
2255 SwizzleFloat4<0x99> yzyz;
2256 SwizzleFloat4<0x9A> zzyz;
2257 SwizzleFloat4<0x9B> wzyz;
2258 SwizzleFloat4<0x9C> xwyz;
2259 SwizzleFloat4<0x9D> ywyz;
2260 SwizzleFloat4<0x9E> zwyz;
2261 SwizzleFloat4<0x9F> wwyz;
2262 SwizzleFloat4<0xA0> xxzz;
2263 SwizzleFloat4<0xA1> yxzz;
2264 SwizzleFloat4<0xA2> zxzz;
2265 SwizzleFloat4<0xA3> wxzz;
2266 SwizzleFloat4<0xA4> xyzz;
2267 SwizzleFloat4<0xA5> yyzz;
2268 SwizzleFloat4<0xA6> zyzz;
2269 SwizzleFloat4<0xA7> wyzz;
2270 SwizzleFloat4<0xA8> xzzz;
2271 SwizzleFloat4<0xA9> yzzz;
2272 SwizzleFloat4<0xAA> zzzz;
2273 SwizzleFloat4<0xAB> wzzz;
2274 SwizzleFloat4<0xAC> xwzz;
2275 SwizzleFloat4<0xAD> ywzz;
2276 SwizzleFloat4<0xAE> zwzz;
2277 SwizzleFloat4<0xAF> wwzz;
2278 SwizzleFloat4<0xB0> xxwz;
2279 SwizzleFloat4<0xB1> yxwz;
2280 SwizzleFloat4<0xB2> zxwz;
2281 SwizzleFloat4<0xB3> wxwz;
2282 SwizzleFloat4<0xB4> xywz;
2283 SwizzleFloat4<0xB5> yywz;
2284 SwizzleFloat4<0xB6> zywz;
2285 SwizzleFloat4<0xB7> wywz;
2286 SwizzleFloat4<0xB8> xzwz;
2287 SwizzleFloat4<0xB9> yzwz;
2288 SwizzleFloat4<0xBA> zzwz;
2289 SwizzleFloat4<0xBB> wzwz;
2290 SwizzleFloat4<0xBC> xwwz;
2291 SwizzleFloat4<0xBD> ywwz;
2292 SwizzleFloat4<0xBE> zwwz;
2293 SwizzleFloat4<0xBF> wwwz;
2294 SwizzleFloat4<0xC0> xxxw;
2295 SwizzleFloat4<0xC1> yxxw;
2296 SwizzleFloat4<0xC2> zxxw;
2297 SwizzleFloat4<0xC3> wxxw;
2298 SwizzleFloat4<0xC4> xyxw;
2299 SwizzleFloat4<0xC5> yyxw;
2300 SwizzleFloat4<0xC6> zyxw;
2301 SwizzleFloat4<0xC7> wyxw;
2302 SwizzleFloat4<0xC8> xzxw;
2303 SwizzleFloat4<0xC9> yzxw;
2304 SwizzleFloat4<0xCA> zzxw;
2305 SwizzleFloat4<0xCB> wzxw;
2306 SwizzleFloat4<0xCC> xwxw;
2307 SwizzleFloat4<0xCD> ywxw;
2308 SwizzleFloat4<0xCE> zwxw;
2309 SwizzleFloat4<0xCF> wwxw;
2310 SwizzleFloat4<0xD0> xxyw;
2311 SwizzleFloat4<0xD1> yxyw;
2312 SwizzleFloat4<0xD2> zxyw;
2313 SwizzleFloat4<0xD3> wxyw;
2314 SwizzleFloat4<0xD4> xyyw;
2315 SwizzleFloat4<0xD5> yyyw;
2316 SwizzleFloat4<0xD6> zyyw;
2317 SwizzleFloat4<0xD7> wyyw;
2318 SwizzleFloat4<0xD8> xzyw;
2319 SwizzleFloat4<0xD9> yzyw;
2320 SwizzleFloat4<0xDA> zzyw;
2321 SwizzleFloat4<0xDB> wzyw;
2322 SwizzleFloat4<0xDC> xwyw;
2323 SwizzleFloat4<0xDD> ywyw;
2324 SwizzleFloat4<0xDE> zwyw;
2325 SwizzleFloat4<0xDF> wwyw;
2326 SwizzleFloat4<0xE0> xxzw;
2327 SwizzleFloat4<0xE1> yxzw;
2328 SwizzleFloat4<0xE2> zxzw;
2329 SwizzleFloat4<0xE3> wxzw;
2330 SwizzleMaskFloat4<0xE4> xyzw;
2331 SwizzleFloat4<0xE5> yyzw;
2332 SwizzleFloat4<0xE6> zyzw;
2333 SwizzleFloat4<0xE7> wyzw;
2334 SwizzleFloat4<0xE8> xzzw;
2335 SwizzleFloat4<0xE9> yzzw;
2336 SwizzleFloat4<0xEA> zzzw;
2337 SwizzleFloat4<0xEB> wzzw;
2338 SwizzleFloat4<0xEC> xwzw;
2339 SwizzleFloat4<0xED> ywzw;
2340 SwizzleFloat4<0xEE> zwzw;
2341 SwizzleFloat4<0xEF> wwzw;
2342 SwizzleFloat4<0xF0> xxww;
2343 SwizzleFloat4<0xF1> yxww;
2344 SwizzleFloat4<0xF2> zxww;
2345 SwizzleFloat4<0xF3> wxww;
2346 SwizzleFloat4<0xF4> xyww;
2347 SwizzleFloat4<0xF5> yyww;
2348 SwizzleFloat4<0xF6> zyww;
2349 SwizzleFloat4<0xF7> wyww;
2350 SwizzleFloat4<0xF8> xzww;
2351 SwizzleFloat4<0xF9> yzww;
2352 SwizzleFloat4<0xFA> zzww;
2353 SwizzleFloat4<0xFB> wzww;
2354 SwizzleFloat4<0xFC> xwww;
2355 SwizzleFloat4<0xFD> ywww;
2356 SwizzleFloat4<0xFE> zwww;
2357 SwizzleFloat4<0xFF> wwww;
2358 };
2359
2360 private:
2361 void constant(float x, float y, float z, float w);
2362 };
2363
Nicolas Capens08e90f02014-11-21 12:49:12 -05002364 RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs);
2365 RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs);
2366 RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs);
2367 RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs);
2368 RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs);
2369 RValue<Float4> operator+=(const Float4 &lhs, RValue<Float4> rhs);
2370 RValue<Float4> operator-=(const Float4 &lhs, RValue<Float4> rhs);
2371 RValue<Float4> operator*=(const Float4 &lhs, RValue<Float4> rhs);
2372 RValue<Float4> operator/=(const Float4 &lhs, RValue<Float4> rhs);
2373 RValue<Float4> operator%=(const Float4 &lhs, RValue<Float4> rhs);
2374 RValue<Float4> operator+(RValue<Float4> val);
2375 RValue<Float4> operator-(RValue<Float4> val);
2376
2377 RValue<Float4> Abs(RValue<Float4> x);
2378 RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y);
2379 RValue<Float4> Min(RValue<Float4> x, RValue<Float4> y);
Nicolas Capens05b3d662016-02-25 23:58:33 -05002380 RValue<Float4> Rcp_pp(RValue<Float4> val, bool exactAtPow2 = false);
Nicolas Capens08e90f02014-11-21 12:49:12 -05002381 RValue<Float4> RcpSqrt_pp(RValue<Float4> val);
2382 RValue<Float4> Sqrt(RValue<Float4> x);
2383 RValue<Float4> Insert(const Float4 &val, RValue<Float> element, int i);
2384 RValue<Float> Extract(RValue<Float4> x, int i);
2385 RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select);
2386 RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm);
2387 RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y);
2388 RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y);
2389 RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select);
2390 RValue<Int> SignMask(RValue<Float4> x);
2391 RValue<Int4> CmpEQ(RValue<Float4> x, RValue<Float4> y);
2392 RValue<Int4> CmpLT(RValue<Float4> x, RValue<Float4> y);
2393 RValue<Int4> CmpLE(RValue<Float4> x, RValue<Float4> y);
2394 RValue<Int4> CmpNEQ(RValue<Float4> x, RValue<Float4> y);
2395 RValue<Int4> CmpNLT(RValue<Float4> x, RValue<Float4> y);
2396 RValue<Int4> CmpNLE(RValue<Float4> x, RValue<Float4> y);
2397 RValue<Float4> Round(RValue<Float4> x);
2398 RValue<Float4> Trunc(RValue<Float4> x);
2399 RValue<Float4> Frac(RValue<Float4> x);
2400 RValue<Float4> Floor(RValue<Float4> x);
2401 RValue<Float4> Ceil(RValue<Float4> x);
2402
John Bauman89401822014-05-06 15:04:28 -04002403 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002404 class Pointer : public Variable<Pointer<T>>
John Bauman89401822014-05-06 15:04:28 -04002405 {
2406 public:
2407 template<class S>
Nicolas Capens81f18302016-01-14 09:32:35 -05002408 Pointer(RValue<Pointer<S>> pointerS, int alignment = 1) : alignment(alignment)
John Bauman89401822014-05-06 15:04:28 -04002409 {
John Bauman89401822014-05-06 15:04:28 -04002410 llvm::Value *pointerT = Nucleus::createBitCast(pointerS.value, Nucleus::getPointerType(T::getType()));
John Bauman66b8ab22014-05-06 15:57:45 -04002411 LValue::storeValue(pointerT);
John Bauman89401822014-05-06 15:04:28 -04002412 }
2413
2414 template<class S>
2415 Pointer(const Pointer<S> &pointer, int alignment = 1) : alignment(alignment)
2416 {
John Bauman66b8ab22014-05-06 15:57:45 -04002417 llvm::Value *pointerS = pointer.loadValue(alignment);
John Bauman89401822014-05-06 15:04:28 -04002418 llvm::Value *pointerT = Nucleus::createBitCast(pointerS, Nucleus::getPointerType(T::getType()));
John Bauman66b8ab22014-05-06 15:57:45 -04002419 LValue::storeValue(pointerT);
John Bauman89401822014-05-06 15:04:28 -04002420 }
2421
Nicolas Capens81f18302016-01-14 09:32:35 -05002422 Pointer(Argument<Pointer<T>> argument);
John Bauman89401822014-05-06 15:04:28 -04002423 explicit Pointer(const void *external);
2424
2425 Pointer();
Nicolas Capens81f18302016-01-14 09:32:35 -05002426 Pointer(RValue<Pointer<T>> rhs);
John Bauman89401822014-05-06 15:04:28 -04002427 Pointer(const Pointer<T> &rhs);
Nicolas Capens81f18302016-01-14 09:32:35 -05002428 Pointer(const Reference<Pointer<T>> &rhs);
John Bauman89401822014-05-06 15:04:28 -04002429
Nicolas Capens81f18302016-01-14 09:32:35 -05002430 RValue<Pointer<T>> operator=(RValue<Pointer<T>> rhs) const;
2431 RValue<Pointer<T>> operator=(const Pointer<T> &rhs) const;
2432 RValue<Pointer<T>> operator=(const Reference<Pointer<T>> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04002433
2434 Reference<T> operator*();
2435
John Bauman19bac1e2014-05-06 15:23:49 -04002436 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04002437
2438 private:
2439 const int alignment;
2440 };
2441
Nicolas Capens81f18302016-01-14 09:32:35 -05002442 RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset);
2443 RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset);
2444 RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset);
2445 RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, int offset);
2446 RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, RValue<Int> offset);
2447 RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, RValue<UInt> offset);
Nicolas Capens08e90f02014-11-21 12:49:12 -05002448
Nicolas Capens81f18302016-01-14 09:32:35 -05002449 RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset);
2450 RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset);
2451 RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset);
2452 RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, int offset);
2453 RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, RValue<Int> offset);
2454 RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, RValue<UInt> offset);
Nicolas Capens08e90f02014-11-21 12:49:12 -05002455
John Bauman19bac1e2014-05-06 15:23:49 -04002456 template<class T, int S = 1>
John Bauman66b8ab22014-05-06 15:57:45 -04002457 class Array : public Variable<T>
John Bauman89401822014-05-06 15:04:28 -04002458 {
2459 public:
John Bauman19bac1e2014-05-06 15:23:49 -04002460 Array(int size = S);
John Bauman89401822014-05-06 15:04:28 -04002461
2462 Reference<T> operator[](int index);
2463 Reference<T> operator[](RValue<Int> index);
2464 Reference<T> operator[](RValue<UInt> index);
John Bauman89401822014-05-06 15:04:28 -04002465 };
2466
Nicolas Capens81f18302016-01-14 09:32:35 -05002467// RValue<Array<T>> operator++(const Array<T> &val, int); // Post-increment
Nicolas Capens08e90f02014-11-21 12:49:12 -05002468// const Array<T> &operator++(const Array<T> &val); // Pre-increment
Nicolas Capens81f18302016-01-14 09:32:35 -05002469// RValue<Array<T>> operator--(const Array<T> &val, int); // Post-decrement
Nicolas Capens08e90f02014-11-21 12:49:12 -05002470// const Array<T> &operator--(const Array<T> &val); // Pre-decrement
2471
John Bauman89401822014-05-06 15:04:28 -04002472 llvm::BasicBlock *beginLoop();
John Bauman19bac1e2014-05-06 15:23:49 -04002473 bool branch(RValue<Bool> cmp, llvm::BasicBlock *bodyBB, llvm::BasicBlock *endBB);
John Bauman89401822014-05-06 15:04:28 -04002474 bool elseBlock(llvm::BasicBlock *falseBB);
2475
2476 void Return();
John Bauman19bac1e2014-05-06 15:23:49 -04002477 void Return(bool ret);
John Bauman89401822014-05-06 15:04:28 -04002478 void Return(const Int &ret);
2479
2480 template<class T>
2481 void Return(const Pointer<T> &ret);
2482
2483 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002484 void Return(RValue<Pointer<T>> ret);
2485
2486 template<unsigned int index, typename... Arguments>
2487 struct ArgI;
2488
2489 template<typename Arg0, typename... Arguments>
2490 struct ArgI<0, Arg0, Arguments...>
2491 {
2492 typedef Arg0 Type;
2493 };
2494
2495 template<unsigned int index, typename Arg0, typename... Arguments>
2496 struct ArgI<index, Arg0, Arguments...>
2497 {
2498 typedef typename ArgI<index - 1, Arguments...>::Type Type;
2499 };
John Bauman89401822014-05-06 15:04:28 -04002500
Nicolas Capens2ab859f2015-02-05 12:36:46 -05002501 // Generic template, leave undefined!
2502 template<typename FunctionType>
2503 class Function;
2504
2505 // Specialized for function types
2506 template<typename Return, typename... Arguments>
2507 class Function<Return(Arguments...)>
John Bauman89401822014-05-06 15:04:28 -04002508 {
2509 public:
2510 Function();
2511
2512 virtual ~Function();
2513
Nicolas Capens81f18302016-01-14 09:32:35 -05002514 template<int index>
2515 Argument<typename ArgI<index, Arguments...>::Type> Arg() const
2516 {
2517 llvm::Value *arg = Nucleus::getArgument(function, index);
2518 return Argument<typename ArgI<index, Arguments...>::Type>(arg);
2519 }
John Bauman89401822014-05-06 15:04:28 -04002520
2521 Routine *operator()(const wchar_t *name, ...);
2522
2523 private:
2524 Nucleus *core;
2525 llvm::Function *function;
John Bauman19bac1e2014-05-06 15:23:49 -04002526 std::vector<llvm::Type*> arguments;
John Bauman89401822014-05-06 15:04:28 -04002527 };
2528
Nicolas Capens81f18302016-01-14 09:32:35 -05002529 template<int index, typename Return, typename... Arguments>
2530 Argument<typename ArgI<index, Arguments...>::Type> Arg(Function<Return(Arguments...)> &function)
2531 {
2532 return Argument<typename ArgI<index, Arguments...>::Type>(function.arg(index));
2533 }
2534
John Bauman89401822014-05-06 15:04:28 -04002535 RValue<Long> Ticks();
John Bauman89401822014-05-06 15:04:28 -04002536}
2537
2538namespace sw
2539{
2540 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002541 Variable<T>::Variable(int arraySize) : LValue(T::getType(), arraySize)
2542 {
2543 }
2544
2545 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002546 RValue<Pointer<T>> Variable<T>::operator&()
John Bauman66b8ab22014-05-06 15:57:45 -04002547 {
Nicolas Capens81f18302016-01-14 09:32:35 -05002548 return RValue<Pointer<T>>(LValue::address);
John Bauman66b8ab22014-05-06 15:57:45 -04002549 }
2550
2551 template<class T>
John Bauman89401822014-05-06 15:04:28 -04002552 Reference<T>::Reference(llvm::Value *pointer, int alignment) : alignment(alignment)
2553 {
2554 address = pointer;
2555 }
2556
2557 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002558 RValue<T> Reference<T>::operator=(RValue<T> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002559 {
2560 Nucleus::createStore(rhs.value, address, false, alignment);
2561
2562 return rhs;
2563 }
2564
2565 template<class T>
John Bauman89401822014-05-06 15:04:28 -04002566 RValue<T> Reference<T>::operator=(const Reference<T> &ref) const
2567 {
2568 llvm::Value *tmp = Nucleus::createLoad(ref.address, false, ref.alignment);
2569 Nucleus::createStore(tmp, address, false, alignment);
2570
2571 return RValue<T>(tmp);
2572 }
2573
2574 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002575 RValue<T> Reference<T>::operator+=(RValue<T> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002576 {
2577 return *this = *this + rhs;
2578 }
2579
2580 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002581 llvm::Value *Reference<T>::loadValue() const
2582 {
2583 return Nucleus::createLoad(address, false, alignment);
2584 }
2585
2586 template<class T>
2587 int Reference<T>::getAlignment() const
2588 {
2589 return alignment;
2590 }
2591
2592 template<class T>
John Bauman89401822014-05-06 15:04:28 -04002593 RValue<T>::RValue(llvm::Value *rvalue)
2594 {
2595 value = rvalue;
2596 }
2597
2598 template<class T>
2599 RValue<T>::RValue(const T &lvalue)
2600 {
John Bauman66b8ab22014-05-06 15:57:45 -04002601 value = lvalue.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002602 }
2603
2604 template<class T>
2605 RValue<T>::RValue(typename IntLiteral<T>::type i)
2606 {
2607 value = (llvm::Value*)Nucleus::createConstantInt(i);
2608 }
2609
John Bauman66b8ab22014-05-06 15:57:45 -04002610 template<class T>
2611 RValue<T>::RValue(typename FloatLiteral<T>::type f)
2612 {
2613 value = (llvm::Value*)Nucleus::createConstantFloat(f);
2614 }
2615
2616 template<class T>
2617 RValue<T>::RValue(const Reference<T> &ref)
2618 {
2619 value = ref.loadValue();
2620 }
2621
John Bauman89401822014-05-06 15:04:28 -04002622 template<int T>
2623 Swizzle2Float4<T>::operator RValue<Float4>() const
2624 {
John Bauman66b8ab22014-05-06 15:57:45 -04002625 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002626
2627 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2628 }
2629
2630 template<int T>
2631 SwizzleFloat4<T>::operator RValue<Float4>() const
2632 {
John Bauman66b8ab22014-05-06 15:57:45 -04002633 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002634
2635 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2636 }
2637
2638 template<int T>
2639 SwizzleMaskFloat4<T>::operator RValue<Float4>() const
2640 {
John Bauman66b8ab22014-05-06 15:57:45 -04002641 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002642
2643 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2644 }
2645
2646 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002647 RValue<Float4> SwizzleMaskFloat4<T>::operator=(RValue<Float4> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002648 {
2649 return Mask(*parent, rhs, T);
2650 }
2651
2652 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002653 RValue<Float4> SwizzleMaskFloat4<T>::operator=(RValue<Float> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002654 {
2655 return Mask(*parent, Float4(rhs), T);
2656 }
2657
2658 template<int T>
2659 SwizzleMask1Float4<T>::operator RValue<Float>() const // FIXME: Call a non-template function
2660 {
2661 return Extract(*parent, T & 0x3);
2662 }
2663
2664 template<int T>
2665 SwizzleMask1Float4<T>::operator RValue<Float4>() const
2666 {
John Bauman66b8ab22014-05-06 15:57:45 -04002667 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002668
2669 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2670 }
2671
2672 template<int T>
2673 RValue<Float4> SwizzleMask1Float4<T>::operator=(float x) const
2674 {
2675 return Insert(*parent, Float(x), T & 0x3);
2676 }
2677
2678 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002679 RValue<Float4> SwizzleMask1Float4<T>::operator=(RValue<Float4> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002680 {
2681 return Mask(*parent, Float4(rhs), T);
2682 }
2683
2684 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002685 RValue<Float4> SwizzleMask1Float4<T>::operator=(RValue<Float> rhs) const // FIXME: Call a non-template function
John Bauman89401822014-05-06 15:04:28 -04002686 {
2687 return Insert(*parent, rhs, T & 0x3);
2688 }
2689
2690 template<int T>
2691 SwizzleMask2Float4<T>::operator RValue<Float4>() const
2692 {
John Bauman66b8ab22014-05-06 15:57:45 -04002693 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002694
2695 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2696 }
2697
2698 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002699 RValue<Float4> SwizzleMask2Float4<T>::operator=(RValue<Float4> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002700 {
2701 return Mask(*parent, Float4(rhs), T);
2702 }
2703
2704 template<int T>
John Bauman66b8ab22014-05-06 15:57:45 -04002705 Float::Float(const SwizzleMask1Float4<T> &rhs)
2706 {
2707 *this = rhs.operator RValue<Float>();
2708 }
2709
2710 template<int T>
2711 RValue<Float> Float::operator=(const SwizzleMask1Float4<T> &rhs) const
2712 {
2713 return *this = rhs.operator RValue<Float>();
2714 }
2715
2716 template<int T>
2717 Float4::Float4(const SwizzleMask1Float4<T> &rhs)
John Bauman89401822014-05-06 15:04:28 -04002718 {
2719 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002720
John Bauman66b8ab22014-05-06 15:57:45 -04002721 *this = rhs.operator RValue<Float4>();
2722 }
2723
2724 template<int T>
2725 Float4::Float4(const SwizzleFloat4<T> &rhs)
2726 {
2727 xyzw.parent = this;
2728
2729 *this = rhs.operator RValue<Float4>();
John Bauman89401822014-05-06 15:04:28 -04002730 }
2731
2732 template<int X, int Y>
2733 Float4::Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y)
2734 {
2735 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002736
2737 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2738 }
2739
2740 template<int X, int Y>
2741 Float4::Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y)
2742 {
2743 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002744
2745 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2746 }
2747
2748 template<int X, int Y>
2749 Float4::Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y)
2750 {
2751 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002752
2753 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2754 }
2755
2756 template<int X, int Y>
2757 Float4::Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y)
2758 {
2759 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002760
2761 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2762 }
2763
2764 template<int T>
John Bauman66b8ab22014-05-06 15:57:45 -04002765 RValue<Float4> Float4::operator=(const SwizzleMask1Float4<T> &rhs)
John Bauman89401822014-05-06 15:04:28 -04002766 {
John Bauman66b8ab22014-05-06 15:57:45 -04002767 return *this = rhs.operator RValue<Float4>();
John Bauman89401822014-05-06 15:04:28 -04002768 }
2769
John Bauman66b8ab22014-05-06 15:57:45 -04002770 template<int T>
2771 RValue<Float4> Float4::operator=(const SwizzleFloat4<T> &rhs)
John Bauman89401822014-05-06 15:04:28 -04002772 {
John Bauman66b8ab22014-05-06 15:57:45 -04002773 return *this = rhs.operator RValue<Float4>();
John Bauman89401822014-05-06 15:04:28 -04002774 }
2775
2776 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002777 Pointer<T>::Pointer(Argument<Pointer<T>> argument) : alignment(1)
John Bauman89401822014-05-06 15:04:28 -04002778 {
Nicolas Capens81f18302016-01-14 09:32:35 -05002779 LValue::storeValue(argument.value);
John Bauman89401822014-05-06 15:04:28 -04002780 }
2781
2782 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002783 Pointer<T>::Pointer(const void *external) : alignment((intptr_t)external & 0x0000000F ? 1 : 16)
John Bauman89401822014-05-06 15:04:28 -04002784 {
John Bauman89401822014-05-06 15:04:28 -04002785 const llvm::GlobalValue *globalPointer = Nucleus::getGlobalValueAtAddress(const_cast<void*>(external)); // FIXME: Const
2786
2787 if(!globalPointer)
2788 {
2789 globalPointer = Nucleus::createGlobalValue(T::getType(), false, alignment);
2790
2791 Nucleus::addGlobalMapping(globalPointer, const_cast<void*>(external)); // FIXME: Const
2792 }
2793
John Bauman66b8ab22014-05-06 15:57:45 -04002794 LValue::storeValue((llvm::Value*)globalPointer); // FIXME: Const
John Bauman89401822014-05-06 15:04:28 -04002795 }
2796
2797 template<class T>
2798 Pointer<T>::Pointer() : alignment(1)
2799 {
John Bauman66b8ab22014-05-06 15:57:45 -04002800 LValue::storeValue(Nucleus::createNullPointer(T::getType()));
John Bauman89401822014-05-06 15:04:28 -04002801 }
2802
2803 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002804 Pointer<T>::Pointer(RValue<Pointer<T>> rhs) : alignment(1)
John Bauman89401822014-05-06 15:04:28 -04002805 {
John Bauman66b8ab22014-05-06 15:57:45 -04002806 LValue::storeValue(rhs.value);
John Bauman89401822014-05-06 15:04:28 -04002807 }
2808
2809 template<class T>
2810 Pointer<T>::Pointer(const Pointer<T> &rhs) : alignment(rhs.alignment)
2811 {
John Bauman66b8ab22014-05-06 15:57:45 -04002812 llvm::Value *value = rhs.loadValue();
2813 LValue::storeValue(value);
John Bauman89401822014-05-06 15:04:28 -04002814 }
2815
2816 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002817 Pointer<T>::Pointer(const Reference<Pointer<T>> &rhs) : alignment(rhs.getAlignment())
John Bauman89401822014-05-06 15:04:28 -04002818 {
John Bauman66b8ab22014-05-06 15:57:45 -04002819 llvm::Value *value = rhs.loadValue();
2820 LValue::storeValue(value);
2821 }
2822
2823 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002824 RValue<Pointer<T>> Pointer<T>::operator=(RValue<Pointer<T>> rhs) const
John Bauman66b8ab22014-05-06 15:57:45 -04002825 {
2826 LValue::storeValue(rhs.value);
John Bauman89401822014-05-06 15:04:28 -04002827
2828 return rhs;
2829 }
2830
2831 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002832 RValue<Pointer<T>> Pointer<T>::operator=(const Pointer<T> &rhs) const
John Bauman89401822014-05-06 15:04:28 -04002833 {
John Bauman66b8ab22014-05-06 15:57:45 -04002834 llvm::Value *value = rhs.loadValue();
2835 LValue::storeValue(value);
John Bauman89401822014-05-06 15:04:28 -04002836
Nicolas Capens81f18302016-01-14 09:32:35 -05002837 return RValue<Pointer<T>>(value);
John Bauman66b8ab22014-05-06 15:57:45 -04002838 }
2839
2840 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002841 RValue<Pointer<T>> Pointer<T>::operator=(const Reference<Pointer<T>> &rhs) const
John Bauman66b8ab22014-05-06 15:57:45 -04002842 {
2843 llvm::Value *value = rhs.loadValue();
2844 LValue::storeValue(value);
2845
Nicolas Capens81f18302016-01-14 09:32:35 -05002846 return RValue<Pointer<T>>(value);
John Bauman89401822014-05-06 15:04:28 -04002847 }
2848
2849 template<class T>
2850 Reference<T> Pointer<T>::operator*()
2851 {
John Bauman66b8ab22014-05-06 15:57:45 -04002852 return Reference<T>(LValue::loadValue(), alignment);
John Bauman89401822014-05-06 15:04:28 -04002853 }
2854
2855 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002856 llvm::Type *Pointer<T>::getType()
John Bauman89401822014-05-06 15:04:28 -04002857 {
2858 return Nucleus::getPointerType(T::getType());
2859 }
2860
John Bauman19bac1e2014-05-06 15:23:49 -04002861 template<class T, int S>
John Bauman66b8ab22014-05-06 15:57:45 -04002862 Array<T, S>::Array(int size) : Variable<T>(size)
John Bauman89401822014-05-06 15:04:28 -04002863 {
John Bauman89401822014-05-06 15:04:28 -04002864 }
2865
John Bauman19bac1e2014-05-06 15:23:49 -04002866 template<class T, int S>
2867 Reference<T> Array<T, S>::operator[](int index)
John Bauman89401822014-05-06 15:04:28 -04002868 {
John Bauman66b8ab22014-05-06 15:57:45 -04002869 llvm::Value *element = LValue::getAddress((llvm::Value*)Nucleus::createConstantInt(index));
2870
John Bauman89401822014-05-06 15:04:28 -04002871 return Reference<T>(element);
2872 }
2873
John Bauman19bac1e2014-05-06 15:23:49 -04002874 template<class T, int S>
2875 Reference<T> Array<T, S>::operator[](RValue<Int> index)
John Bauman89401822014-05-06 15:04:28 -04002876 {
John Bauman66b8ab22014-05-06 15:57:45 -04002877 llvm::Value *element = LValue::getAddress(index.value);
2878
John Bauman89401822014-05-06 15:04:28 -04002879 return Reference<T>(element);
2880 }
2881
John Bauman19bac1e2014-05-06 15:23:49 -04002882 template<class T, int S>
2883 Reference<T> Array<T, S>::operator[](RValue<UInt> index)
John Bauman89401822014-05-06 15:04:28 -04002884 {
John Bauman66b8ab22014-05-06 15:57:45 -04002885 llvm::Value *element = LValue::getAddress(index.value);
2886
John Bauman89401822014-05-06 15:04:28 -04002887 return Reference<T>(element);
2888 }
2889
2890// template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002891// RValue<Array<T>> operator++(const Array<T> &val, int)
John Bauman89401822014-05-06 15:04:28 -04002892// {
2893// // FIXME: Requires storing the address of the array
2894// }
John Bauman66b8ab22014-05-06 15:57:45 -04002895
John Bauman89401822014-05-06 15:04:28 -04002896// template<class T>
2897// const Array<T> &operator++(const Array<T> &val)
2898// {
2899// // FIXME: Requires storing the address of the array
2900// }
2901
2902// template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002903// RValue<Array<T>> operator--(const Array<T> &val, int)
John Bauman89401822014-05-06 15:04:28 -04002904// {
2905// // FIXME: Requires storing the address of the array
2906// }
2907
2908// template<class T>
2909// const Array<T> &operator--(const Array<T> &val)
2910// {
2911// // FIXME: Requires storing the address of the array
2912// }
2913
2914 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002915 RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, RValue<T> ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002916 {
2917 return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, ifFalse.value));
2918 }
2919
2920 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002921 RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, RValue<T> ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002922 {
John Bauman66b8ab22014-05-06 15:57:45 -04002923 llvm::Value *trueValue = ifTrue.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002924
2925 return RValue<T>(Nucleus::createSelect(condition.value, trueValue, ifFalse.value));
2926 }
2927
2928 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002929 RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, const T &ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002930 {
John Bauman66b8ab22014-05-06 15:57:45 -04002931 llvm::Value *falseValue = ifFalse.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002932
2933 return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, falseValue));
2934 }
2935
2936 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002937 RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, const T &ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002938 {
John Bauman66b8ab22014-05-06 15:57:45 -04002939 llvm::Value *trueValue = ifTrue.loadValue();
2940 llvm::Value *falseValue = ifFalse.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002941
2942 return RValue<T>(Nucleus::createSelect(condition.value, trueValue, falseValue));
2943 }
2944
2945 template<class T>
2946 void Return(const Pointer<T> &ret)
2947 {
2948 Nucleus::createRet(Nucleus::createLoad(ret.address));
John Bauman19bac1e2014-05-06 15:23:49 -04002949 Nucleus::setInsertBlock(Nucleus::createBasicBlock());
John Bauman89401822014-05-06 15:04:28 -04002950 }
2951
2952 template<class T>
Nicolas Capens81f18302016-01-14 09:32:35 -05002953 void Return(RValue<Pointer<T>> ret)
John Bauman89401822014-05-06 15:04:28 -04002954 {
2955 Nucleus::createRet(ret.value);
John Bauman19bac1e2014-05-06 15:23:49 -04002956 Nucleus::setInsertBlock(Nucleus::createBasicBlock());
John Bauman89401822014-05-06 15:04:28 -04002957 }
2958
Nicolas Capens2ab859f2015-02-05 12:36:46 -05002959 template<typename Return, typename... Arguments>
2960 Function<Return(Arguments...)>::Function()
John Bauman89401822014-05-06 15:04:28 -04002961 {
2962 core = new Nucleus();
2963
Nicolas Capens2ab859f2015-02-05 12:36:46 -05002964 llvm::Type *types[] = {Arguments::getType()...};
2965 for(llvm::Type *type : types)
2966 {
2967 arguments.push_back(type);
Nicolas Capens81f18302016-01-14 09:32:35 -05002968 }
John Bauman89401822014-05-06 15:04:28 -04002969
Nicolas Capens2ab859f2015-02-05 12:36:46 -05002970 function = Nucleus::createFunction(Return::getType(), arguments);
John Bauman66b8ab22014-05-06 15:57:45 -04002971 Nucleus::setFunction(function);
John Bauman89401822014-05-06 15:04:28 -04002972 }
2973
Nicolas Capens2ab859f2015-02-05 12:36:46 -05002974 template<typename Return, typename... Arguments>
2975 Function<Return(Arguments...)>::~Function()
John Bauman89401822014-05-06 15:04:28 -04002976 {
2977 delete core;
2978 }
2979
Nicolas Capens2ab859f2015-02-05 12:36:46 -05002980 template<typename Return, typename... Arguments>
Nicolas Capens2ab859f2015-02-05 12:36:46 -05002981 Routine *Function<Return(Arguments...)>::operator()(const wchar_t *name, ...)
John Bauman89401822014-05-06 15:04:28 -04002982 {
2983 wchar_t fullName[1024 + 1];
2984
2985 va_list vararg;
2986 va_start(vararg, name);
2987 vswprintf(fullName, 1024, name, vararg);
2988 va_end(vararg);
2989
2990 return core->acquireRoutine(fullName, true);
2991 }
2992
2993 template<class T, class S>
John Bauman19bac1e2014-05-06 15:23:49 -04002994 RValue<T> ReinterpretCast(RValue<S> val)
John Bauman89401822014-05-06 15:04:28 -04002995 {
2996 return RValue<T>(Nucleus::createBitCast(val.value, T::getType()));
2997 }
2998
John Bauman66b8ab22014-05-06 15:57:45 -04002999 template<class T>
3000 RValue<T> ReinterpretCast(const LValue &var)
John Bauman89401822014-05-06 15:04:28 -04003001 {
John Bauman66b8ab22014-05-06 15:57:45 -04003002 llvm::Value *val = var.loadValue();
John Bauman89401822014-05-06 15:04:28 -04003003
3004 return RValue<T>(Nucleus::createBitCast(val, T::getType()));
3005 }
3006
3007 template<class T, class S>
3008 RValue<T> ReinterpretCast(const Reference<S> &var)
3009 {
3010 return ReinterpretCast<T>(RValue<S>(var));
3011 }
3012
3013 template<class T, class S>
John Bauman19bac1e2014-05-06 15:23:49 -04003014 RValue<T> As(RValue<S> val)
John Bauman89401822014-05-06 15:04:28 -04003015 {
3016 return ReinterpretCast<T>(val);
3017 }
3018
John Bauman66b8ab22014-05-06 15:57:45 -04003019 template<class T>
3020 RValue<T> As(const LValue &var)
John Bauman89401822014-05-06 15:04:28 -04003021 {
3022 return ReinterpretCast<T>(var);
3023 }
3024
3025 template<class T, class S>
3026 RValue<T> As(const Reference<S> &val)
3027 {
3028 return ReinterpretCast<T>(val);
3029 }
3030}
3031
3032#endif // sw_Nucleus_hpp