blob: a7aaf7919b8c7afae1567bf93ff6a0ebfaa7e44e [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);
John Bauman89401822014-05-06 15:04:28 -040091 static llvm::Argument *getArgument(llvm::Function *function, unsigned int index);
92
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
296 RValue<Pointer<T> > operator&();
297 };
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
366 llvm::Value *value; // FIXME: Make private
367 };
368
John Bauman66b8ab22014-05-06 15:57:45 -0400369 class MMX : public Variable<MMX>
John Bauman19bac1e2014-05-06 15:23:49 -0400370 {
371 public:
372 static llvm::Type *getType();
373 };
374
John Bauman66b8ab22014-05-06 15:57:45 -0400375 class Bool : public Variable<Bool>
John Bauman89401822014-05-06 15:04:28 -0400376 {
377 public:
378 explicit Bool(llvm::Argument *argument);
379
380 Bool();
381 Bool(bool x);
John Bauman19bac1e2014-05-06 15:23:49 -0400382 Bool(RValue<Bool> rhs);
John Bauman89401822014-05-06 15:04:28 -0400383 Bool(const Bool &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400384 Bool(const Reference<Bool> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400385
386 // RValue<Bool> operator=(bool rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400387 RValue<Bool> operator=(RValue<Bool> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400388 RValue<Bool> operator=(const Bool &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400389 RValue<Bool> operator=(const Reference<Bool> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400390
John Bauman19bac1e2014-05-06 15:23:49 -0400391 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400392 };
393
Nicolas Capens08e90f02014-11-21 12:49:12 -0500394 RValue<Bool> operator!(RValue<Bool> val);
395 RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs);
396 RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs);
397
John Bauman66b8ab22014-05-06 15:57:45 -0400398 class Byte : public Variable<Byte>
John Bauman89401822014-05-06 15:04:28 -0400399 {
400 public:
401 explicit Byte(llvm::Argument *argument);
402
John Bauman19bac1e2014-05-06 15:23:49 -0400403 explicit Byte(RValue<Int> cast);
Alexis Hetu77dfab42015-11-23 13:31:22 -0500404 explicit Byte(RValue<UInt> cast);
405 explicit Byte(RValue<UShort> cast);
John Bauman89401822014-05-06 15:04:28 -0400406
407 Byte();
408 Byte(int x);
409 Byte(unsigned char x);
John Bauman19bac1e2014-05-06 15:23:49 -0400410 Byte(RValue<Byte> rhs);
John Bauman89401822014-05-06 15:04:28 -0400411 Byte(const Byte &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400412 Byte(const Reference<Byte> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400413
414 // RValue<Byte> operator=(unsigned char rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400415 RValue<Byte> operator=(RValue<Byte> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400416 RValue<Byte> operator=(const Byte &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400417 RValue<Byte> operator=(const Reference<Byte> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400418
John Bauman19bac1e2014-05-06 15:23:49 -0400419 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400420 };
421
Nicolas Capens08e90f02014-11-21 12:49:12 -0500422 RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs);
423 RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs);
424 RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs);
425 RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs);
426 RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs);
427 RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs);
428 RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs);
429 RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs);
430 RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs);
431 RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs);
432 RValue<Byte> operator+=(const Byte &lhs, RValue<Byte> rhs);
433 RValue<Byte> operator-=(const Byte &lhs, RValue<Byte> rhs);
434 RValue<Byte> operator*=(const Byte &lhs, RValue<Byte> rhs);
435 RValue<Byte> operator/=(const Byte &lhs, RValue<Byte> rhs);
436 RValue<Byte> operator%=(const Byte &lhs, RValue<Byte> rhs);
437 RValue<Byte> operator&=(const Byte &lhs, RValue<Byte> rhs);
438 RValue<Byte> operator|=(const Byte &lhs, RValue<Byte> rhs);
439 RValue<Byte> operator^=(const Byte &lhs, RValue<Byte> rhs);
440 RValue<Byte> operator<<=(const Byte &lhs, RValue<Byte> rhs);
441 RValue<Byte> operator>>=(const Byte &lhs, RValue<Byte> rhs);
442 RValue<Byte> operator+(RValue<Byte> val);
443 RValue<Byte> operator-(RValue<Byte> val);
444 RValue<Byte> operator~(RValue<Byte> val);
445 RValue<Byte> operator++(const Byte &val, int); // Post-increment
446 const Byte &operator++(const Byte &val); // Pre-increment
447 RValue<Byte> operator--(const Byte &val, int); // Post-decrement
448 const Byte &operator--(const Byte &val); // Pre-decrement
449 RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs);
450 RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs);
451 RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs);
452 RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs);
453 RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs);
454 RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs);
455
John Bauman66b8ab22014-05-06 15:57:45 -0400456 class SByte : public Variable<SByte>
John Bauman89401822014-05-06 15:04:28 -0400457 {
458 public:
459 explicit SByte(llvm::Argument *argument);
460
Alexis Hetu77dfab42015-11-23 13:31:22 -0500461 explicit SByte(RValue<Int> cast);
462 explicit SByte(RValue<Short> cast);
463
John Bauman89401822014-05-06 15:04:28 -0400464 SByte();
465 SByte(signed char x);
John Bauman19bac1e2014-05-06 15:23:49 -0400466 SByte(RValue<SByte> rhs);
John Bauman89401822014-05-06 15:04:28 -0400467 SByte(const SByte &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400468 SByte(const Reference<SByte> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400469
470 // RValue<SByte> operator=(signed char rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400471 RValue<SByte> operator=(RValue<SByte> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400472 RValue<SByte> operator=(const SByte &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400473 RValue<SByte> operator=(const Reference<SByte> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400474
John Bauman19bac1e2014-05-06 15:23:49 -0400475 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400476 };
477
Nicolas Capens08e90f02014-11-21 12:49:12 -0500478 RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs);
479 RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs);
480 RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs);
481 RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs);
482 RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs);
483 RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs);
484 RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs);
485 RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs);
486 RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs);
487 RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs);
488 RValue<SByte> operator+=(const SByte &lhs, RValue<SByte> rhs);
489 RValue<SByte> operator-=(const SByte &lhs, RValue<SByte> rhs);
490 RValue<SByte> operator*=(const SByte &lhs, RValue<SByte> rhs);
491 RValue<SByte> operator/=(const SByte &lhs, RValue<SByte> rhs);
492 RValue<SByte> operator%=(const SByte &lhs, RValue<SByte> rhs);
493 RValue<SByte> operator&=(const SByte &lhs, RValue<SByte> rhs);
494 RValue<SByte> operator|=(const SByte &lhs, RValue<SByte> rhs);
495 RValue<SByte> operator^=(const SByte &lhs, RValue<SByte> rhs);
496 RValue<SByte> operator<<=(const SByte &lhs, RValue<SByte> rhs);
497 RValue<SByte> operator>>=(const SByte &lhs, RValue<SByte> rhs);
498 RValue<SByte> operator+(RValue<SByte> val);
499 RValue<SByte> operator-(RValue<SByte> val);
500 RValue<SByte> operator~(RValue<SByte> val);
501 RValue<SByte> operator++(const SByte &val, int); // Post-increment
502 const SByte &operator++(const SByte &val); // Pre-increment
503 RValue<SByte> operator--(const SByte &val, int); // Post-decrement
504 const SByte &operator--(const SByte &val); // Pre-decrement
505 RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs);
506 RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs);
507 RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs);
508 RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs);
509 RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs);
510 RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs);
511
John Bauman66b8ab22014-05-06 15:57:45 -0400512 class Short : public Variable<Short>
John Bauman89401822014-05-06 15:04:28 -0400513 {
514 public:
515 explicit Short(llvm::Argument *argument);
516
John Bauman19bac1e2014-05-06 15:23:49 -0400517 explicit Short(RValue<Int> cast);
John Bauman89401822014-05-06 15:04:28 -0400518
519 Short();
520 Short(short x);
John Bauman19bac1e2014-05-06 15:23:49 -0400521 Short(RValue<Short> rhs);
John Bauman89401822014-05-06 15:04:28 -0400522 Short(const Short &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400523 Short(const Reference<Short> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400524
525 // RValue<Short> operator=(short rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400526 RValue<Short> operator=(RValue<Short> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400527 RValue<Short> operator=(const Short &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400528 RValue<Short> operator=(const Reference<Short> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400529
John Bauman19bac1e2014-05-06 15:23:49 -0400530 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400531 };
532
Nicolas Capens08e90f02014-11-21 12:49:12 -0500533 RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs);
534 RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs);
535 RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs);
536 RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs);
537 RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs);
538 RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs);
539 RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs);
540 RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs);
541 RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs);
542 RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs);
543 RValue<Short> operator+=(const Short &lhs, RValue<Short> rhs);
544 RValue<Short> operator-=(const Short &lhs, RValue<Short> rhs);
545 RValue<Short> operator*=(const Short &lhs, RValue<Short> rhs);
546 RValue<Short> operator/=(const Short &lhs, RValue<Short> rhs);
547 RValue<Short> operator%=(const Short &lhs, RValue<Short> rhs);
548 RValue<Short> operator&=(const Short &lhs, RValue<Short> rhs);
549 RValue<Short> operator|=(const Short &lhs, RValue<Short> rhs);
550 RValue<Short> operator^=(const Short &lhs, RValue<Short> rhs);
551 RValue<Short> operator<<=(const Short &lhs, RValue<Short> rhs);
552 RValue<Short> operator>>=(const Short &lhs, RValue<Short> rhs);
553 RValue<Short> operator+(RValue<Short> val);
554 RValue<Short> operator-(RValue<Short> val);
555 RValue<Short> operator~(RValue<Short> val);
556 RValue<Short> operator++(const Short &val, int); // Post-increment
557 const Short &operator++(const Short &val); // Pre-increment
558 RValue<Short> operator--(const Short &val, int); // Post-decrement
559 const Short &operator--(const Short &val); // Pre-decrement
560 RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs);
561 RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs);
562 RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs);
563 RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs);
564 RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs);
565 RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs);
566
John Bauman66b8ab22014-05-06 15:57:45 -0400567 class UShort : public Variable<UShort>
John Bauman89401822014-05-06 15:04:28 -0400568 {
569 public:
570 explicit UShort(llvm::Argument *argument);
571
Alexis Hetu77dfab42015-11-23 13:31:22 -0500572 explicit UShort(RValue<UInt> cast);
Alexis Hetu75b650f2015-11-19 17:40:15 -0500573 explicit UShort(RValue<Int> cast);
Alexis Hetu77dfab42015-11-23 13:31:22 -0500574
John Bauman89401822014-05-06 15:04:28 -0400575 UShort();
576 UShort(unsigned short x);
John Bauman19bac1e2014-05-06 15:23:49 -0400577 UShort(RValue<UShort> rhs);
John Bauman89401822014-05-06 15:04:28 -0400578 UShort(const UShort &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400579 UShort(const Reference<UShort> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400580
581 // RValue<UShort> operator=(unsigned short rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400582 RValue<UShort> operator=(RValue<UShort> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400583 RValue<UShort> operator=(const UShort &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400584 RValue<UShort> operator=(const Reference<UShort> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400585
John Bauman19bac1e2014-05-06 15:23:49 -0400586 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400587 };
588
Nicolas Capens08e90f02014-11-21 12:49:12 -0500589 RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs);
590 RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs);
591 RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs);
592 RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs);
593 RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs);
594 RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs);
595 RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs);
596 RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs);
597 RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs);
598 RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs);
599 RValue<UShort> operator+=(const UShort &lhs, RValue<UShort> rhs);
600 RValue<UShort> operator-=(const UShort &lhs, RValue<UShort> rhs);
601 RValue<UShort> operator*=(const UShort &lhs, RValue<UShort> rhs);
602 RValue<UShort> operator/=(const UShort &lhs, RValue<UShort> rhs);
603 RValue<UShort> operator%=(const UShort &lhs, RValue<UShort> rhs);
604 RValue<UShort> operator&=(const UShort &lhs, RValue<UShort> rhs);
605 RValue<UShort> operator|=(const UShort &lhs, RValue<UShort> rhs);
606 RValue<UShort> operator^=(const UShort &lhs, RValue<UShort> rhs);
607 RValue<UShort> operator<<=(const UShort &lhs, RValue<UShort> rhs);
608 RValue<UShort> operator>>=(const UShort &lhs, RValue<UShort> rhs);
609 RValue<UShort> operator+(RValue<UShort> val);
610 RValue<UShort> operator-(RValue<UShort> val);
611 RValue<UShort> operator~(RValue<UShort> val);
612 RValue<UShort> operator++(const UShort &val, int); // Post-increment
613 const UShort &operator++(const UShort &val); // Pre-increment
614 RValue<UShort> operator--(const UShort &val, int); // Post-decrement
615 const UShort &operator--(const UShort &val); // Pre-decrement
616 RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs);
617 RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs);
618 RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs);
619 RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs);
620 RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs);
621 RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs);
622
John Bauman66b8ab22014-05-06 15:57:45 -0400623 class Byte4 : public Variable<Byte4>
John Bauman89401822014-05-06 15:04:28 -0400624 {
625 public:
626 // Byte4();
627 // Byte4(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400628 // Byte4(RValue<Byte4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400629 // Byte4(const Byte4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400630 // Byte4(const Reference<Byte4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400631
John Bauman19bac1e2014-05-06 15:23:49 -0400632 // RValue<Byte4> operator=(RValue<Byte4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400633 // RValue<Byte4> operator=(const Byte4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400634 // RValue<Byte4> operator=(const Reference<Byte4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400635
John Bauman19bac1e2014-05-06 15:23:49 -0400636 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400637 };
638
Nicolas Capens08e90f02014-11-21 12:49:12 -0500639// RValue<Byte4> operator+(RValue<Byte4> lhs, RValue<Byte4> rhs);
640// RValue<Byte4> operator-(RValue<Byte4> lhs, RValue<Byte4> rhs);
641// RValue<Byte4> operator*(RValue<Byte4> lhs, RValue<Byte4> rhs);
642// RValue<Byte4> operator/(RValue<Byte4> lhs, RValue<Byte4> rhs);
643// RValue<Byte4> operator%(RValue<Byte4> lhs, RValue<Byte4> rhs);
644// RValue<Byte4> operator&(RValue<Byte4> lhs, RValue<Byte4> rhs);
645// RValue<Byte4> operator|(RValue<Byte4> lhs, RValue<Byte4> rhs);
646// RValue<Byte4> operator^(RValue<Byte4> lhs, RValue<Byte4> rhs);
647// RValue<Byte4> operator<<(RValue<Byte4> lhs, RValue<Byte4> rhs);
648// RValue<Byte4> operator>>(RValue<Byte4> lhs, RValue<Byte4> rhs);
649// RValue<Byte4> operator+=(const Byte4 &lhs, RValue<Byte4> rhs);
650// RValue<Byte4> operator-=(const Byte4 &lhs, RValue<Byte4> rhs);
651// RValue<Byte4> operator*=(const Byte4 &lhs, RValue<Byte4> rhs);
652// RValue<Byte4> operator/=(const Byte4 &lhs, RValue<Byte4> rhs);
653// RValue<Byte4> operator%=(const Byte4 &lhs, RValue<Byte4> rhs);
654// RValue<Byte4> operator&=(const Byte4 &lhs, RValue<Byte4> rhs);
655// RValue<Byte4> operator|=(const Byte4 &lhs, RValue<Byte4> rhs);
656// RValue<Byte4> operator^=(const Byte4 &lhs, RValue<Byte4> rhs);
657// RValue<Byte4> operator<<=(const Byte4 &lhs, RValue<Byte4> rhs);
658// RValue<Byte4> operator>>=(const Byte4 &lhs, RValue<Byte4> rhs);
659// RValue<Byte4> operator+(RValue<Byte4> val);
660// RValue<Byte4> operator-(RValue<Byte4> val);
661// RValue<Byte4> operator~(RValue<Byte4> val);
662// RValue<Byte4> operator++(const Byte4 &val, int); // Post-increment
663// const Byte4 &operator++(const Byte4 &val); // Pre-increment
664// RValue<Byte4> operator--(const Byte4 &val, int); // Post-decrement
665// const Byte4 &operator--(const Byte4 &val); // Pre-decrement
666
John Bauman66b8ab22014-05-06 15:57:45 -0400667 class SByte4 : public Variable<SByte4>
John Bauman89401822014-05-06 15:04:28 -0400668 {
669 public:
670 // SByte4();
671 // SByte4(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400672 // SByte4(RValue<SByte4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400673 // SByte4(const SByte4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400674 // SByte4(const Reference<SByte4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400675
John Bauman19bac1e2014-05-06 15:23:49 -0400676 // RValue<SByte4> operator=(RValue<SByte4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400677 // RValue<SByte4> operator=(const SByte4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400678 // RValue<SByte4> operator=(const Reference<SByte4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400679
John Bauman19bac1e2014-05-06 15:23:49 -0400680 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400681 };
682
Nicolas Capens08e90f02014-11-21 12:49:12 -0500683// RValue<SByte4> operator+(RValue<SByte4> lhs, RValue<SByte4> rhs);
684// RValue<SByte4> operator-(RValue<SByte4> lhs, RValue<SByte4> rhs);
685// RValue<SByte4> operator*(RValue<SByte4> lhs, RValue<SByte4> rhs);
686// RValue<SByte4> operator/(RValue<SByte4> lhs, RValue<SByte4> rhs);
687// RValue<SByte4> operator%(RValue<SByte4> lhs, RValue<SByte4> rhs);
688// RValue<SByte4> operator&(RValue<SByte4> lhs, RValue<SByte4> rhs);
689// RValue<SByte4> operator|(RValue<SByte4> lhs, RValue<SByte4> rhs);
690// RValue<SByte4> operator^(RValue<SByte4> lhs, RValue<SByte4> rhs);
691// RValue<SByte4> operator<<(RValue<SByte4> lhs, RValue<SByte4> rhs);
692// RValue<SByte4> operator>>(RValue<SByte4> lhs, RValue<SByte4> rhs);
693// RValue<SByte4> operator+=(const SByte4 &lhs, RValue<SByte4> rhs);
694// RValue<SByte4> operator-=(const SByte4 &lhs, RValue<SByte4> rhs);
695// RValue<SByte4> operator*=(const SByte4 &lhs, RValue<SByte4> rhs);
696// RValue<SByte4> operator/=(const SByte4 &lhs, RValue<SByte4> rhs);
697// RValue<SByte4> operator%=(const SByte4 &lhs, RValue<SByte4> rhs);
698// RValue<SByte4> operator&=(const SByte4 &lhs, RValue<SByte4> rhs);
699// RValue<SByte4> operator|=(const SByte4 &lhs, RValue<SByte4> rhs);
700// RValue<SByte4> operator^=(const SByte4 &lhs, RValue<SByte4> rhs);
701// RValue<SByte4> operator<<=(const SByte4 &lhs, RValue<SByte4> rhs);
702// RValue<SByte4> operator>>=(const SByte4 &lhs, RValue<SByte4> rhs);
703// RValue<SByte4> operator+(RValue<SByte4> val);
704// RValue<SByte4> operator-(RValue<SByte4> val);
705// RValue<SByte4> operator~(RValue<SByte4> val);
706// RValue<SByte4> operator++(const SByte4 &val, int); // Post-increment
707// const SByte4 &operator++(const SByte4 &val); // Pre-increment
708// RValue<SByte4> operator--(const SByte4 &val, int); // Post-decrement
709// const SByte4 &operator--(const SByte4 &val); // Pre-decrement
710
John Bauman66b8ab22014-05-06 15:57:45 -0400711 class Byte8 : public Variable<Byte8>
John Bauman89401822014-05-06 15:04:28 -0400712 {
713 public:
714 Byte8();
715 Byte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7);
716 Byte8(int64_t x);
John Bauman19bac1e2014-05-06 15:23:49 -0400717 Byte8(RValue<Byte8> rhs);
John Bauman89401822014-05-06 15:04:28 -0400718 Byte8(const Byte8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400719 Byte8(const Reference<Byte8> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400720
John Bauman19bac1e2014-05-06 15:23:49 -0400721 RValue<Byte8> operator=(RValue<Byte8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400722 RValue<Byte8> operator=(const Byte8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400723 RValue<Byte8> operator=(const Reference<Byte8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400724
John Bauman19bac1e2014-05-06 15:23:49 -0400725 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400726 };
727
Nicolas Capens08e90f02014-11-21 12:49:12 -0500728 RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs);
729 RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs);
730// RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs);
731// RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs);
732// RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs);
733 RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs);
734 RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs);
735 RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs);
736// RValue<Byte8> operator<<(RValue<Byte8> lhs, RValue<Byte8> rhs);
737// RValue<Byte8> operator>>(RValue<Byte8> lhs, RValue<Byte8> rhs);
738 RValue<Byte8> operator+=(const Byte8 &lhs, RValue<Byte8> rhs);
739 RValue<Byte8> operator-=(const Byte8 &lhs, RValue<Byte8> rhs);
740// RValue<Byte8> operator*=(const Byte8 &lhs, RValue<Byte8> rhs);
741// RValue<Byte8> operator/=(const Byte8 &lhs, RValue<Byte8> rhs);
742// RValue<Byte8> operator%=(const Byte8 &lhs, RValue<Byte8> rhs);
743 RValue<Byte8> operator&=(const Byte8 &lhs, RValue<Byte8> rhs);
744 RValue<Byte8> operator|=(const Byte8 &lhs, RValue<Byte8> rhs);
745 RValue<Byte8> operator^=(const Byte8 &lhs, RValue<Byte8> rhs);
746// RValue<Byte8> operator<<=(const Byte8 &lhs, RValue<Byte8> rhs);
747// RValue<Byte8> operator>>=(const Byte8 &lhs, RValue<Byte8> rhs);
748// RValue<Byte8> operator+(RValue<Byte8> val);
749// RValue<Byte8> operator-(RValue<Byte8> val);
750 RValue<Byte8> operator~(RValue<Byte8> val);
751// RValue<Byte8> operator++(const Byte8 &val, int); // Post-increment
752// const Byte8 &operator++(const Byte8 &val); // Pre-increment
753// RValue<Byte8> operator--(const Byte8 &val, int); // Post-decrement
754// const Byte8 &operator--(const Byte8 &val); // Pre-decrement
755
756 RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y);
757 RValue<Byte8> SubSat(RValue<Byte8> x, RValue<Byte8> y);
758 RValue<Short4> Unpack(RValue<Byte4> x);
759 RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y);
760 RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y);
761 RValue<Int> SignMask(RValue<Byte8> x);
762// RValue<Byte8> CmpGT(RValue<Byte8> x, RValue<Byte8> y);
763 RValue<Byte8> CmpEQ(RValue<Byte8> x, RValue<Byte8> y);
764
John Bauman66b8ab22014-05-06 15:57:45 -0400765 class SByte8 : public Variable<SByte8>
John Bauman89401822014-05-06 15:04:28 -0400766 {
767 public:
768 SByte8();
769 SByte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7);
770 SByte8(int64_t x);
John Bauman19bac1e2014-05-06 15:23:49 -0400771 SByte8(RValue<SByte8> rhs);
John Bauman89401822014-05-06 15:04:28 -0400772 SByte8(const SByte8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400773 SByte8(const Reference<SByte8> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400774
John Bauman19bac1e2014-05-06 15:23:49 -0400775 RValue<SByte8> operator=(RValue<SByte8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400776 RValue<SByte8> operator=(const SByte8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400777 RValue<SByte8> operator=(const Reference<SByte8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400778
John Bauman19bac1e2014-05-06 15:23:49 -0400779 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400780 };
781
Nicolas Capens08e90f02014-11-21 12:49:12 -0500782 RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs);
783 RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs);
784// RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs);
785// RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs);
786// RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs);
787 RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs);
788 RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs);
789 RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs);
790// RValue<SByte8> operator<<(RValue<SByte8> lhs, RValue<SByte8> rhs);
791// RValue<SByte8> operator>>(RValue<SByte8> lhs, RValue<SByte8> rhs);
792 RValue<SByte8> operator+=(const SByte8 &lhs, RValue<SByte8> rhs);
793 RValue<SByte8> operator-=(const SByte8 &lhs, RValue<SByte8> rhs);
794// RValue<SByte8> operator*=(const SByte8 &lhs, RValue<SByte8> rhs);
795// RValue<SByte8> operator/=(const SByte8 &lhs, RValue<SByte8> rhs);
796// RValue<SByte8> operator%=(const SByte8 &lhs, RValue<SByte8> rhs);
797 RValue<SByte8> operator&=(const SByte8 &lhs, RValue<SByte8> rhs);
798 RValue<SByte8> operator|=(const SByte8 &lhs, RValue<SByte8> rhs);
799 RValue<SByte8> operator^=(const SByte8 &lhs, RValue<SByte8> rhs);
800// RValue<SByte8> operator<<=(const SByte8 &lhs, RValue<SByte8> rhs);
801// RValue<SByte8> operator>>=(const SByte8 &lhs, RValue<SByte8> rhs);
802// RValue<SByte8> operator+(RValue<SByte8> val);
803// RValue<SByte8> operator-(RValue<SByte8> val);
804 RValue<SByte8> operator~(RValue<SByte8> val);
805// RValue<SByte8> operator++(const SByte8 &val, int); // Post-increment
806// const SByte8 &operator++(const SByte8 &val); // Pre-increment
807// RValue<SByte8> operator--(const SByte8 &val, int); // Post-decrement
808// const SByte8 &operator--(const SByte8 &val); // Pre-decrement
809
810 RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y);
811 RValue<SByte8> SubSat(RValue<SByte8> x, RValue<SByte8> y);
812 RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y);
813 RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y);
814 RValue<Int> SignMask(RValue<SByte8> x);
815 RValue<Byte8> CmpGT(RValue<SByte8> x, RValue<SByte8> y);
816 RValue<Byte8> CmpEQ(RValue<SByte8> x, RValue<SByte8> y);
817
John Bauman66b8ab22014-05-06 15:57:45 -0400818 class Byte16 : public Variable<Byte16>
John Bauman89401822014-05-06 15:04:28 -0400819 {
820 public:
821 // Byte16();
822 // Byte16(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400823 Byte16(RValue<Byte16> rhs);
John Bauman89401822014-05-06 15:04:28 -0400824 Byte16(const Byte16 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400825 Byte16(const Reference<Byte16> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400826
John Bauman19bac1e2014-05-06 15:23:49 -0400827 RValue<Byte16> operator=(RValue<Byte16> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400828 RValue<Byte16> operator=(const Byte16 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400829 RValue<Byte16> operator=(const Reference<Byte16> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400830
John Bauman19bac1e2014-05-06 15:23:49 -0400831 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400832 };
833
Nicolas Capens08e90f02014-11-21 12:49:12 -0500834// RValue<Byte16> operator+(RValue<Byte16> lhs, RValue<Byte16> rhs);
835// RValue<Byte16> operator-(RValue<Byte16> lhs, RValue<Byte16> rhs);
836// RValue<Byte16> operator*(RValue<Byte16> lhs, RValue<Byte16> rhs);
837// RValue<Byte16> operator/(RValue<Byte16> lhs, RValue<Byte16> rhs);
838// RValue<Byte16> operator%(RValue<Byte16> lhs, RValue<Byte16> rhs);
839// RValue<Byte16> operator&(RValue<Byte16> lhs, RValue<Byte16> rhs);
840// RValue<Byte16> operator|(RValue<Byte16> lhs, RValue<Byte16> rhs);
841// RValue<Byte16> operator^(RValue<Byte16> lhs, RValue<Byte16> rhs);
842// RValue<Byte16> operator<<(RValue<Byte16> lhs, RValue<Byte16> rhs);
843// RValue<Byte16> operator>>(RValue<Byte16> lhs, RValue<Byte16> rhs);
844// RValue<Byte16> operator+=(const Byte16 &lhs, RValue<Byte16> rhs);
845// RValue<Byte16> operator-=(const Byte16 &lhs, RValue<Byte16> rhs);
846// RValue<Byte16> operator*=(const Byte16 &lhs, RValue<Byte16> rhs);
847// RValue<Byte16> operator/=(const Byte16 &lhs, RValue<Byte16> rhs);
848// RValue<Byte16> operator%=(const Byte16 &lhs, RValue<Byte16> rhs);
849// RValue<Byte16> operator&=(const Byte16 &lhs, RValue<Byte16> rhs);
850// RValue<Byte16> operator|=(const Byte16 &lhs, RValue<Byte16> rhs);
851// RValue<Byte16> operator^=(const Byte16 &lhs, RValue<Byte16> rhs);
852// RValue<Byte16> operator<<=(const Byte16 &lhs, RValue<Byte16> rhs);
853// RValue<Byte16> operator>>=(const Byte16 &lhs, RValue<Byte16> rhs);
854// RValue<Byte16> operator+(RValue<Byte16> val);
855// RValue<Byte16> operator-(RValue<Byte16> val);
856// RValue<Byte16> operator~(RValue<Byte16> val);
857// RValue<Byte16> operator++(const Byte16 &val, int); // Post-increment
858// const Byte16 &operator++(const Byte16 &val); // Pre-increment
859// RValue<Byte16> operator--(const Byte16 &val, int); // Post-decrement
860// const Byte16 &operator--(const Byte16 &val); // Pre-decrement
861
John Bauman66b8ab22014-05-06 15:57:45 -0400862 class SByte16 : public Variable<SByte16>
John Bauman89401822014-05-06 15:04:28 -0400863 {
864 public:
865 // SByte16();
866 // SByte16(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400867 // SByte16(RValue<SByte16> rhs);
John Bauman89401822014-05-06 15:04:28 -0400868 // SByte16(const SByte16 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400869 // SByte16(const Reference<SByte16> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400870
John Bauman19bac1e2014-05-06 15:23:49 -0400871 // RValue<SByte16> operator=(RValue<SByte16> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400872 // RValue<SByte16> operator=(const SByte16 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400873 // RValue<SByte16> operator=(const Reference<SByte16> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400874
John Bauman19bac1e2014-05-06 15:23:49 -0400875 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400876 };
877
Nicolas Capens08e90f02014-11-21 12:49:12 -0500878// RValue<SByte16> operator+(RValue<SByte16> lhs, RValue<SByte16> rhs);
879// RValue<SByte16> operator-(RValue<SByte16> lhs, RValue<SByte16> rhs);
880// RValue<SByte16> operator*(RValue<SByte16> lhs, RValue<SByte16> rhs);
881// RValue<SByte16> operator/(RValue<SByte16> lhs, RValue<SByte16> rhs);
882// RValue<SByte16> operator%(RValue<SByte16> lhs, RValue<SByte16> rhs);
883// RValue<SByte16> operator&(RValue<SByte16> lhs, RValue<SByte16> rhs);
884// RValue<SByte16> operator|(RValue<SByte16> lhs, RValue<SByte16> rhs);
885// RValue<SByte16> operator^(RValue<SByte16> lhs, RValue<SByte16> rhs);
886// RValue<SByte16> operator<<(RValue<SByte16> lhs, RValue<SByte16> rhs);
887// RValue<SByte16> operator>>(RValue<SByte16> lhs, RValue<SByte16> rhs);
888// RValue<SByte16> operator+=(const SByte16 &lhs, RValue<SByte16> rhs);
889// RValue<SByte16> operator-=(const SByte16 &lhs, RValue<SByte16> rhs);
890// RValue<SByte16> operator*=(const SByte16 &lhs, RValue<SByte16> rhs);
891// RValue<SByte16> operator/=(const SByte16 &lhs, RValue<SByte16> rhs);
892// RValue<SByte16> operator%=(const SByte16 &lhs, RValue<SByte16> rhs);
893// RValue<SByte16> operator&=(const SByte16 &lhs, RValue<SByte16> rhs);
894// RValue<SByte16> operator|=(const SByte16 &lhs, RValue<SByte16> rhs);
895// RValue<SByte16> operator^=(const SByte16 &lhs, RValue<SByte16> rhs);
896// RValue<SByte16> operator<<=(const SByte16 &lhs, RValue<SByte16> rhs);
897// RValue<SByte16> operator>>=(const SByte16 &lhs, RValue<SByte16> rhs);
898// RValue<SByte16> operator+(RValue<SByte16> val);
899// RValue<SByte16> operator-(RValue<SByte16> val);
900// RValue<SByte16> operator~(RValue<SByte16> val);
901// RValue<SByte16> operator++(const SByte16 &val, int); // Post-increment
902// const SByte16 &operator++(const SByte16 &val); // Pre-increment
903// RValue<SByte16> operator--(const SByte16 &val, int); // Post-decrement
904// const SByte16 &operator--(const SByte16 &val); // Pre-decrement
905
John Bauman66b8ab22014-05-06 15:57:45 -0400906 class Short4 : public Variable<Short4>
John Bauman89401822014-05-06 15:04:28 -0400907 {
908 public:
John Bauman19bac1e2014-05-06 15:23:49 -0400909 explicit Short4(RValue<Int> cast);
910 explicit Short4(RValue<Int4> cast);
911 // explicit Short4(RValue<Float> cast);
912 explicit Short4(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -0400913
914 Short4();
John Bauman19bac1e2014-05-06 15:23:49 -0400915 Short4(short xyzw);
John Bauman89401822014-05-06 15:04:28 -0400916 Short4(short x, short y, short z, short w);
John Bauman19bac1e2014-05-06 15:23:49 -0400917 Short4(RValue<Short4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400918 Short4(const Short4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400919 Short4(const Reference<Short4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -0400920 Short4(RValue<UShort4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400921 Short4(const UShort4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400922 Short4(const Reference<UShort4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400923
John Bauman19bac1e2014-05-06 15:23:49 -0400924 RValue<Short4> operator=(RValue<Short4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400925 RValue<Short4> operator=(const Short4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400926 RValue<Short4> operator=(const Reference<Short4> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -0400927 RValue<Short4> operator=(RValue<UShort4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400928 RValue<Short4> operator=(const UShort4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400929 RValue<Short4> operator=(const Reference<UShort4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400930
John Bauman19bac1e2014-05-06 15:23:49 -0400931 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400932 };
933
Nicolas Capens08e90f02014-11-21 12:49:12 -0500934 RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs);
935 RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs);
936 RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs);
937// RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs);
938// RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs);
939 RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs);
940 RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs);
941 RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs);
942 RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs);
943 RValue<Short4> operator>>(RValue<Short4> lhs, unsigned char rhs);
944 RValue<Short4> operator<<(RValue<Short4> lhs, RValue<Long1> rhs);
945 RValue<Short4> operator>>(RValue<Short4> lhs, RValue<Long1> rhs);
946 RValue<Short4> operator+=(const Short4 &lhs, RValue<Short4> rhs);
947 RValue<Short4> operator-=(const Short4 &lhs, RValue<Short4> rhs);
948 RValue<Short4> operator*=(const Short4 &lhs, RValue<Short4> rhs);
949// RValue<Short4> operator/=(const Short4 &lhs, RValue<Short4> rhs);
950// RValue<Short4> operator%=(const Short4 &lhs, RValue<Short4> rhs);
951 RValue<Short4> operator&=(const Short4 &lhs, RValue<Short4> rhs);
952 RValue<Short4> operator|=(const Short4 &lhs, RValue<Short4> rhs);
953 RValue<Short4> operator^=(const Short4 &lhs, RValue<Short4> rhs);
954 RValue<Short4> operator<<=(const Short4 &lhs, unsigned char rhs);
955 RValue<Short4> operator>>=(const Short4 &lhs, unsigned char rhs);
956 RValue<Short4> operator<<=(const Short4 &lhs, RValue<Long1> rhs);
957 RValue<Short4> operator>>=(const Short4 &lhs, RValue<Long1> rhs);
958// RValue<Short4> operator+(RValue<Short4> val);
959 RValue<Short4> operator-(RValue<Short4> val);
960 RValue<Short4> operator~(RValue<Short4> val);
961// RValue<Short4> operator++(const Short4 &val, int); // Post-increment
962// const Short4 &operator++(const Short4 &val); // Pre-increment
963// RValue<Short4> operator--(const Short4 &val, int); // Post-decrement
964// const Short4 &operator--(const Short4 &val); // Pre-decrement
965// RValue<Bool> operator<(RValue<Short4> lhs, RValue<Short4> rhs);
966// RValue<Bool> operator<=(RValue<Short4> lhs, RValue<Short4> rhs);
967// RValue<Bool> operator>(RValue<Short4> lhs, RValue<Short4> rhs);
968// RValue<Bool> operator>=(RValue<Short4> lhs, RValue<Short4> rhs);
969// RValue<Bool> operator!=(RValue<Short4> lhs, RValue<Short4> rhs);
970// RValue<Bool> operator==(RValue<Short4> lhs, RValue<Short4> rhs);
971
972 RValue<Short4> RoundShort4(RValue<Float4> cast);
973 RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y);
974 RValue<Short4> Min(RValue<Short4> x, RValue<Short4> y);
975 RValue<Short4> AddSat(RValue<Short4> x, RValue<Short4> y);
976 RValue<Short4> SubSat(RValue<Short4> x, RValue<Short4> y);
977 RValue<Short4> MulHigh(RValue<Short4> x, RValue<Short4> y);
978 RValue<Int2> MulAdd(RValue<Short4> x, RValue<Short4> y);
979 RValue<SByte8> Pack(RValue<Short4> x, RValue<Short4> y);
980 RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y);
981 RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y);
982 RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select);
983 RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i);
984 RValue<Short> Extract(RValue<Short4> val, int i);
985 RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y);
986 RValue<Short4> CmpEQ(RValue<Short4> x, RValue<Short4> y);
987
John Bauman66b8ab22014-05-06 15:57:45 -0400988 class UShort4 : public Variable<UShort4>
John Bauman89401822014-05-06 15:04:28 -0400989 {
990 public:
John Bauman19bac1e2014-05-06 15:23:49 -0400991 explicit UShort4(RValue<Int4> cast);
992 explicit UShort4(RValue<Float4> cast, bool saturate = false);
John Bauman89401822014-05-06 15:04:28 -0400993
994 UShort4();
995 UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w);
John Bauman19bac1e2014-05-06 15:23:49 -0400996 UShort4(RValue<UShort4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400997 UShort4(const UShort4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400998 UShort4(const Reference<UShort4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -0400999 UShort4(RValue<Short4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001000 UShort4(const Short4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001001 UShort4(const Reference<Short4> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001002
John Bauman19bac1e2014-05-06 15:23:49 -04001003 RValue<UShort4> operator=(RValue<UShort4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001004 RValue<UShort4> operator=(const UShort4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001005 RValue<UShort4> operator=(const Reference<UShort4> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001006 RValue<UShort4> operator=(RValue<Short4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001007 RValue<UShort4> operator=(const Short4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001008 RValue<UShort4> operator=(const Reference<Short4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001009
John Bauman19bac1e2014-05-06 15:23:49 -04001010 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001011 };
1012
Nicolas Capens08e90f02014-11-21 12:49:12 -05001013 RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs);
1014 RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs);
1015 RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs);
1016// RValue<UShort4> operator/(RValue<UShort4> lhs, RValue<UShort4> rhs);
1017// RValue<UShort4> operator%(RValue<UShort4> lhs, RValue<UShort4> rhs);
1018// RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs);
1019// RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs);
1020// RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs);
1021 RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs);
1022 RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs);
1023 RValue<UShort4> operator<<(RValue<UShort4> lhs, RValue<Long1> rhs);
1024 RValue<UShort4> operator>>(RValue<UShort4> lhs, RValue<Long1> rhs);
1025// RValue<UShort4> operator+=(const UShort4 &lhs, RValue<UShort4> rhs);
1026// RValue<UShort4> operator-=(const UShort4 &lhs, RValue<UShort4> rhs);
1027// RValue<UShort4> operator*=(const UShort4 &lhs, RValue<UShort4> rhs);
1028// RValue<UShort4> operator/=(const UShort4 &lhs, RValue<UShort4> rhs);
1029// RValue<UShort4> operator%=(const UShort4 &lhs, RValue<UShort4> rhs);
1030// RValue<UShort4> operator&=(const UShort4 &lhs, RValue<UShort4> rhs);
1031// RValue<UShort4> operator|=(const UShort4 &lhs, RValue<UShort4> rhs);
1032// RValue<UShort4> operator^=(const UShort4 &lhs, RValue<UShort4> rhs);
1033 RValue<UShort4> operator<<=(const UShort4 &lhs, unsigned char rhs);
1034 RValue<UShort4> operator>>=(const UShort4 &lhs, unsigned char rhs);
1035 RValue<UShort4> operator<<=(const UShort4 &lhs, RValue<Long1> rhs);
1036 RValue<UShort4> operator>>=(const UShort4 &lhs, RValue<Long1> rhs);
1037// RValue<UShort4> operator+(RValue<UShort4> val);
1038// RValue<UShort4> operator-(RValue<UShort4> val);
1039 RValue<UShort4> operator~(RValue<UShort4> val);
1040// RValue<UShort4> operator++(const UShort4 &val, int); // Post-increment
1041// const UShort4 &operator++(const UShort4 &val); // Pre-increment
1042// RValue<UShort4> operator--(const UShort4 &val, int); // Post-decrement
1043// const UShort4 &operator--(const UShort4 &val); // Pre-decrement
1044
1045 RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y);
1046 RValue<UShort4> Min(RValue<UShort4> x, RValue<UShort4> y);
1047 RValue<UShort4> AddSat(RValue<UShort4> x, RValue<UShort4> y);
1048 RValue<UShort4> SubSat(RValue<UShort4> x, RValue<UShort4> y);
1049 RValue<UShort4> MulHigh(RValue<UShort4> x, RValue<UShort4> y);
1050 RValue<UShort4> Average(RValue<UShort4> x, RValue<UShort4> y);
1051 RValue<Byte8> Pack(RValue<UShort4> x, RValue<UShort4> y);
1052
John Bauman66b8ab22014-05-06 15:57:45 -04001053 class Short8 : public Variable<Short8>
John Bauman89401822014-05-06 15:04:28 -04001054 {
1055 public:
1056 // Short8();
1057 Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7);
John Bauman19bac1e2014-05-06 15:23:49 -04001058 Short8(RValue<Short8> rhs);
John Bauman89401822014-05-06 15:04:28 -04001059 // Short8(const Short8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001060 // Short8(const Reference<Short8> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001061
John Bauman19bac1e2014-05-06 15:23:49 -04001062 // RValue<Short8> operator=(RValue<Short8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001063 // RValue<Short8> operator=(const Short8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001064 // RValue<Short8> operator=(const Reference<Short8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001065
John Bauman19bac1e2014-05-06 15:23:49 -04001066 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001067 };
1068
Nicolas Capens08e90f02014-11-21 12:49:12 -05001069 RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs);
1070// RValue<Short8> operator-(RValue<Short8> lhs, RValue<Short8> rhs);
1071// RValue<Short8> operator*(RValue<Short8> lhs, RValue<Short8> rhs);
1072// RValue<Short8> operator/(RValue<Short8> lhs, RValue<Short8> rhs);
1073// RValue<Short8> operator%(RValue<Short8> lhs, RValue<Short8> rhs);
1074 RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs);
1075// RValue<Short8> operator|(RValue<Short8> lhs, RValue<Short8> rhs);
1076// RValue<Short8> operator^(RValue<Short8> lhs, RValue<Short8> rhs);
1077 RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs);
1078 RValue<Short8> operator>>(RValue<Short8> lhs, unsigned char rhs);
1079// RValue<Short8> operator<<(RValue<Short8> lhs, RValue<Short8> rhs);
1080// RValue<Short8> operator>>(RValue<Short8> lhs, RValue<Short8> rhs);
1081// RValue<Short8> operator+=(const Short8 &lhs, RValue<Short8> rhs);
1082// RValue<Short8> operator-=(const Short8 &lhs, RValue<Short8> rhs);
1083// RValue<Short8> operator*=(const Short8 &lhs, RValue<Short8> rhs);
1084// RValue<Short8> operator/=(const Short8 &lhs, RValue<Short8> rhs);
1085// RValue<Short8> operator%=(const Short8 &lhs, RValue<Short8> rhs);
1086// RValue<Short8> operator&=(const Short8 &lhs, RValue<Short8> rhs);
1087// RValue<Short8> operator|=(const Short8 &lhs, RValue<Short8> rhs);
1088// RValue<Short8> operator^=(const Short8 &lhs, RValue<Short8> rhs);
1089// RValue<Short8> operator<<=(const Short8 &lhs, RValue<Short8> rhs);
1090// RValue<Short8> operator>>=(const Short8 &lhs, RValue<Short8> rhs);
1091// RValue<Short8> operator+(RValue<Short8> val);
1092// RValue<Short8> operator-(RValue<Short8> val);
1093// RValue<Short8> operator~(RValue<Short8> val);
1094// RValue<Short8> operator++(const Short8 &val, int); // Post-increment
1095// const Short8 &operator++(const Short8 &val); // Pre-increment
1096// RValue<Short8> operator--(const Short8 &val, int); // Post-decrement
1097// const Short8 &operator--(const Short8 &val); // Pre-decrement
1098// RValue<Bool> operator<(RValue<Short8> lhs, RValue<Short8> rhs);
1099// RValue<Bool> operator<=(RValue<Short8> lhs, RValue<Short8> rhs);
1100// RValue<Bool> operator>(RValue<Short8> lhs, RValue<Short8> rhs);
1101// RValue<Bool> operator>=(RValue<Short8> lhs, RValue<Short8> rhs);
1102// RValue<Bool> operator!=(RValue<Short8> lhs, RValue<Short8> rhs);
1103// RValue<Bool> operator==(RValue<Short8> lhs, RValue<Short8> rhs);
1104
1105 RValue<Short8> Concatenate(RValue<Short4> lo, RValue<Short4> hi);
1106 RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y);
1107 RValue<Int4> MulAdd(RValue<Short8> x, RValue<Short8> y);
1108
John Bauman66b8ab22014-05-06 15:57:45 -04001109 class UShort8 : public Variable<UShort8>
John Bauman89401822014-05-06 15:04:28 -04001110 {
1111 public:
1112 // UShort8();
1113 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 -04001114 UShort8(RValue<UShort8> rhs);
John Bauman89401822014-05-06 15:04:28 -04001115 // UShort8(const UShort8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001116 // UShort8(const Reference<UShort8> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001117
John Bauman19bac1e2014-05-06 15:23:49 -04001118 RValue<UShort8> operator=(RValue<UShort8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001119 RValue<UShort8> operator=(const UShort8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001120 RValue<UShort8> operator=(const Reference<UShort8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001121
John Bauman19bac1e2014-05-06 15:23:49 -04001122 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001123 };
1124
Nicolas Capens08e90f02014-11-21 12:49:12 -05001125 RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs);
1126// RValue<UShort8> operator-(RValue<UShort8> lhs, RValue<UShort8> rhs);
1127 RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs);
1128// RValue<UShort8> operator/(RValue<UShort8> lhs, RValue<UShort8> rhs);
1129// RValue<UShort8> operator%(RValue<UShort8> lhs, RValue<UShort8> rhs);
1130 RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs);
1131// RValue<UShort8> operator|(RValue<UShort8> lhs, RValue<UShort8> rhs);
1132// RValue<UShort8> operator^(RValue<UShort8> lhs, RValue<UShort8> rhs);
1133 RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs);
1134 RValue<UShort8> operator>>(RValue<UShort8> lhs, unsigned char rhs);
1135// RValue<UShort8> operator<<(RValue<UShort8> lhs, RValue<UShort8> rhs);
1136// RValue<UShort8> operator>>(RValue<UShort8> lhs, RValue<UShort8> rhs);
1137 RValue<UShort8> operator+=(const UShort8 &lhs, RValue<UShort8> rhs);
1138// RValue<UShort8> operator-=(const UShort8 &lhs, RValue<UShort8> rhs);
1139// RValue<UShort8> operator*=(const UShort8 &lhs, RValue<UShort8> rhs);
1140// RValue<UShort8> operator/=(const UShort8 &lhs, RValue<UShort8> rhs);
1141// RValue<UShort8> operator%=(const UShort8 &lhs, RValue<UShort8> rhs);
1142// RValue<UShort8> operator&=(const UShort8 &lhs, RValue<UShort8> rhs);
1143// RValue<UShort8> operator|=(const UShort8 &lhs, RValue<UShort8> rhs);
1144// RValue<UShort8> operator^=(const UShort8 &lhs, RValue<UShort8> rhs);
1145// RValue<UShort8> operator<<=(const UShort8 &lhs, RValue<UShort8> rhs);
1146// RValue<UShort8> operator>>=(const UShort8 &lhs, RValue<UShort8> rhs);
1147// RValue<UShort8> operator+(RValue<UShort8> val);
1148// RValue<UShort8> operator-(RValue<UShort8> val);
1149 RValue<UShort8> operator~(RValue<UShort8> val);
1150// RValue<UShort8> operator++(const UShort8 &val, int); // Post-increment
1151// const UShort8 &operator++(const UShort8 &val); // Pre-increment
1152// RValue<UShort8> operator--(const UShort8 &val, int); // Post-decrement
1153// const UShort8 &operator--(const UShort8 &val); // Pre-decrement
1154// RValue<Bool> operator<(RValue<UShort8> lhs, RValue<UShort8> rhs);
1155// RValue<Bool> operator<=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1156// RValue<Bool> operator>(RValue<UShort8> lhs, RValue<UShort8> rhs);
1157// RValue<Bool> operator>=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1158// RValue<Bool> operator!=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1159// RValue<Bool> operator==(RValue<UShort8> lhs, RValue<UShort8> rhs);
1160
1161 RValue<UShort8> Swizzle(RValue<UShort8> x, char select0, char select1, char select2, char select3, char select4, char select5, char select6, char select7);
1162 RValue<UShort8> Concatenate(RValue<UShort4> lo, RValue<UShort4> hi);
1163 RValue<UShort8> MulHigh(RValue<UShort8> x, RValue<UShort8> y);
1164
John Bauman66b8ab22014-05-06 15:57:45 -04001165 class Int : public Variable<Int>
John Bauman89401822014-05-06 15:04:28 -04001166 {
1167 public:
1168 explicit Int(llvm::Argument *argument);
1169
John Bauman19bac1e2014-05-06 15:23:49 -04001170 explicit Int(RValue<Byte> cast);
1171 explicit Int(RValue<SByte> cast);
1172 explicit Int(RValue<Short> cast);
1173 explicit Int(RValue<UShort> cast);
1174 explicit Int(RValue<Int2> cast);
1175 explicit Int(RValue<Long> cast);
1176 explicit Int(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001177
1178 Int();
1179 Int(int x);
John Bauman19bac1e2014-05-06 15:23:49 -04001180 Int(RValue<Int> rhs);
1181 Int(RValue<UInt> rhs);
John Bauman89401822014-05-06 15:04:28 -04001182 Int(const Int &rhs);
1183 Int(const UInt &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001184 Int(const Reference<Int> &rhs);
1185 Int(const Reference<UInt> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001186
1187 RValue<Int> operator=(int rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001188 RValue<Int> operator=(RValue<Int> rhs) const;
1189 RValue<Int> operator=(RValue<UInt> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001190 RValue<Int> operator=(const Int &rhs) const;
1191 RValue<Int> operator=(const UInt &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001192 RValue<Int> operator=(const Reference<Int> &rhs) const;
1193 RValue<Int> operator=(const Reference<UInt> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001194
John Bauman19bac1e2014-05-06 15:23:49 -04001195 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001196 };
1197
Nicolas Capens08e90f02014-11-21 12:49:12 -05001198 RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs);
1199 RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs);
1200 RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs);
1201 RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs);
1202 RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs);
1203 RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs);
1204 RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs);
1205 RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs);
1206 RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs);
1207 RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs);
1208 RValue<Int> operator+=(const Int &lhs, RValue<Int> rhs);
1209 RValue<Int> operator-=(const Int &lhs, RValue<Int> rhs);
1210 RValue<Int> operator*=(const Int &lhs, RValue<Int> rhs);
1211 RValue<Int> operator/=(const Int &lhs, RValue<Int> rhs);
1212 RValue<Int> operator%=(const Int &lhs, RValue<Int> rhs);
1213 RValue<Int> operator&=(const Int &lhs, RValue<Int> rhs);
1214 RValue<Int> operator|=(const Int &lhs, RValue<Int> rhs);
1215 RValue<Int> operator^=(const Int &lhs, RValue<Int> rhs);
1216 RValue<Int> operator<<=(const Int &lhs, RValue<Int> rhs);
1217 RValue<Int> operator>>=(const Int &lhs, RValue<Int> rhs);
1218 RValue<Int> operator+(RValue<Int> val);
1219 RValue<Int> operator-(RValue<Int> val);
1220 RValue<Int> operator~(RValue<Int> val);
1221 RValue<Int> operator++(const Int &val, int); // Post-increment
1222 const Int &operator++(const Int &val); // Pre-increment
1223 RValue<Int> operator--(const Int &val, int); // Post-decrement
1224 const Int &operator--(const Int &val); // Pre-decrement
1225 RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs);
1226 RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs);
1227 RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs);
1228 RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs);
1229 RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs);
1230 RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs);
1231
1232 RValue<Int> Max(RValue<Int> x, RValue<Int> y);
1233 RValue<Int> Min(RValue<Int> x, RValue<Int> y);
1234 RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max);
1235 RValue<Int> RoundInt(RValue<Float> cast);
1236
John Bauman66b8ab22014-05-06 15:57:45 -04001237 class Long : public Variable<Long>
John Bauman89401822014-05-06 15:04:28 -04001238 {
1239 public:
1240 // explicit Long(llvm::Argument *argument);
1241
John Bauman19bac1e2014-05-06 15:23:49 -04001242 // explicit Long(RValue<Short> cast);
1243 // explicit Long(RValue<UShort> cast);
1244 explicit Long(RValue<Int> cast);
1245 explicit Long(RValue<UInt> cast);
1246 // explicit Long(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001247
1248 Long();
1249 // Long(qword x);
John Bauman19bac1e2014-05-06 15:23:49 -04001250 Long(RValue<Long> rhs);
1251 // Long(RValue<ULong> rhs);
John Bauman89401822014-05-06 15:04:28 -04001252 // Long(const Long &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001253 // Long(const Reference<Long> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001254 // Long(const ULong &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001255 // Long(const Reference<ULong> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001256
1257 RValue<Long> operator=(int64_t rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001258 RValue<Long> operator=(RValue<Long> rhs) const;
1259 // RValue<Long> operator=(RValue<ULong> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001260 RValue<Long> operator=(const Long &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001261 RValue<Long> operator=(const Reference<Long> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001262 // RValue<Long> operator=(const ULong &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001263 // RValue<Long> operator=(const Reference<ULong> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001264
John Bauman19bac1e2014-05-06 15:23:49 -04001265 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001266 };
1267
Nicolas Capens08e90f02014-11-21 12:49:12 -05001268 RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs);
1269 RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs);
1270// RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs);
1271// RValue<Long> operator/(RValue<Long> lhs, RValue<Long> rhs);
1272// RValue<Long> operator%(RValue<Long> lhs, RValue<Long> rhs);
1273// RValue<Long> operator&(RValue<Long> lhs, RValue<Long> rhs);
1274// RValue<Long> operator|(RValue<Long> lhs, RValue<Long> rhs);
1275// RValue<Long> operator^(RValue<Long> lhs, RValue<Long> rhs);
1276// RValue<Long> operator<<(RValue<Long> lhs, RValue<Long> rhs);
1277// RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs);
1278 RValue<Long> operator+=(const Long &lhs, RValue<Long> rhs);
1279 RValue<Long> operator-=(const Long &lhs, RValue<Long> rhs);
1280// RValue<Long> operator*=(const Long &lhs, RValue<Long> rhs);
1281// RValue<Long> operator/=(const Long &lhs, RValue<Long> rhs);
1282// RValue<Long> operator%=(const Long &lhs, RValue<Long> rhs);
1283// RValue<Long> operator&=(const Long &lhs, RValue<Long> rhs);
1284// RValue<Long> operator|=(const Long &lhs, RValue<Long> rhs);
1285// RValue<Long> operator^=(const Long &lhs, RValue<Long> rhs);
1286// RValue<Long> operator<<=(const Long &lhs, RValue<Long> rhs);
1287// RValue<Long> operator>>=(const Long &lhs, RValue<Long> rhs);
1288// RValue<Long> operator+(RValue<Long> val);
1289// RValue<Long> operator-(RValue<Long> val);
1290// RValue<Long> operator~(RValue<Long> val);
1291// RValue<Long> operator++(const Long &val, int); // Post-increment
1292// const Long &operator++(const Long &val); // Pre-increment
1293// RValue<Long> operator--(const Long &val, int); // Post-decrement
1294// const Long &operator--(const Long &val); // Pre-decrement
1295// RValue<Bool> operator<(RValue<Long> lhs, RValue<Long> rhs);
1296// RValue<Bool> operator<=(RValue<Long> lhs, RValue<Long> rhs);
1297// RValue<Bool> operator>(RValue<Long> lhs, RValue<Long> rhs);
1298// RValue<Bool> operator>=(RValue<Long> lhs, RValue<Long> rhs);
1299// RValue<Bool> operator!=(RValue<Long> lhs, RValue<Long> rhs);
1300// RValue<Bool> operator==(RValue<Long> lhs, RValue<Long> rhs);
1301
1302// RValue<Long> RoundLong(RValue<Float> cast);
1303 RValue<Long> AddAtomic( RValue<Pointer<Long> > x, RValue<Long> y);
1304
John Bauman66b8ab22014-05-06 15:57:45 -04001305 class Long1 : public Variable<Long1>
John Bauman89401822014-05-06 15:04:28 -04001306 {
1307 public:
1308 // explicit Long1(llvm::Argument *argument);
1309
John Bauman19bac1e2014-05-06 15:23:49 -04001310 // explicit Long1(RValue<Short> cast);
1311 // explicit Long1(RValue<UShort> cast);
1312 // explicit Long1(RValue<Int> cast);
Nicolas Capens50c96362016-01-04 23:03:59 -05001313 explicit Long1(RValue<UInt> cast);
John Bauman19bac1e2014-05-06 15:23:49 -04001314 // explicit Long1(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001315
John Bauman89401822014-05-06 15:04:28 -04001316 // Long1();
1317 // Long1(qword x);
John Bauman19bac1e2014-05-06 15:23:49 -04001318 Long1(RValue<Long1> rhs);
1319 // Long1(RValue<ULong1> rhs);
John Bauman89401822014-05-06 15:04:28 -04001320 // Long1(const Long1 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001321 // Long1(const Reference<Long1> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001322 // Long1(const ULong1 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001323 // Long1(const Reference<ULong1> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001324
1325 // RValue<Long1> operator=(qword rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001326 // RValue<Long1> operator=(RValue<Long1> rhs) const;
1327 // RValue<Long1> operator=(RValue<ULong1> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001328 // RValue<Long1> operator=(const Long1 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001329 // RValue<Long1> operator=(const Reference<Long1> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001330 // RValue<Long1> operator=(const ULong1 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001331 // RValue<Long1> operator=(const Reference<ULong1> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001332
John Bauman19bac1e2014-05-06 15:23:49 -04001333 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001334 };
1335
Nicolas Capens08e90f02014-11-21 12:49:12 -05001336// RValue<Long1> operator+(RValue<Long1> lhs, RValue<Long1> rhs);
1337// RValue<Long1> operator-(RValue<Long1> lhs, RValue<Long1> rhs);
1338// RValue<Long1> operator*(RValue<Long1> lhs, RValue<Long1> rhs);
1339// RValue<Long1> operator/(RValue<Long1> lhs, RValue<Long1> rhs);
1340// RValue<Long1> operator%(RValue<Long1> lhs, RValue<Long1> rhs);
1341// RValue<Long1> operator&(RValue<Long1> lhs, RValue<Long1> rhs);
1342// RValue<Long1> operator|(RValue<Long1> lhs, RValue<Long1> rhs);
1343// RValue<Long1> operator^(RValue<Long1> lhs, RValue<Long1> rhs);
1344// RValue<Long1> operator<<(RValue<Long1> lhs, RValue<Long1> rhs);
1345// RValue<Long1> operator>>(RValue<Long1> lhs, RValue<Long1> rhs);
1346// RValue<Long1> operator+=(const Long1 &lhs, RValue<Long1> rhs);
1347// RValue<Long1> operator-=(const Long1 &lhs, RValue<Long1> rhs);
1348// RValue<Long1> operator*=(const Long1 &lhs, RValue<Long1> rhs);
1349// RValue<Long1> operator/=(const Long1 &lhs, RValue<Long1> rhs);
1350// RValue<Long1> operator%=(const Long1 &lhs, RValue<Long1> rhs);
1351// RValue<Long1> operator&=(const Long1 &lhs, RValue<Long1> rhs);
1352// RValue<Long1> operator|=(const Long1 &lhs, RValue<Long1> rhs);
1353// RValue<Long1> operator^=(const Long1 &lhs, RValue<Long1> rhs);
1354// RValue<Long1> operator<<=(const Long1 &lhs, RValue<Long1> rhs);
1355// RValue<Long1> operator>>=(const Long1 &lhs, RValue<Long1> rhs);
1356// RValue<Long1> operator+(RValue<Long1> val);
1357// RValue<Long1> operator-(RValue<Long1> val);
1358// RValue<Long1> operator~(RValue<Long1> val);
1359// RValue<Long1> operator++(const Long1 &val, int); // Post-increment
1360// const Long1 &operator++(const Long1 &val); // Pre-increment
1361// RValue<Long1> operator--(const Long1 &val, int); // Post-decrement
1362// const Long1 &operator--(const Long1 &val); // Pre-decrement
1363// RValue<Bool> operator<(RValue<Long1> lhs, RValue<Long1> rhs);
1364// RValue<Bool> operator<=(RValue<Long1> lhs, RValue<Long1> rhs);
1365// RValue<Bool> operator>(RValue<Long1> lhs, RValue<Long1> rhs);
1366// RValue<Bool> operator>=(RValue<Long1> lhs, RValue<Long1> rhs);
1367// RValue<Bool> operator!=(RValue<Long1> lhs, RValue<Long1> rhs);
1368// RValue<Bool> operator==(RValue<Long1> lhs, RValue<Long1> rhs);
1369
Nicolas Capens08e90f02014-11-21 12:49:12 -05001370// RValue<Long1> RoundLong1(RValue<Float> cast);
1371
John Bauman66b8ab22014-05-06 15:57:45 -04001372 class Long2 : public Variable<Long2>
John Bauman89401822014-05-06 15:04:28 -04001373 {
1374 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001375 // explicit Long2(RValue<Long> cast);
1376 // explicit Long2(RValue<Long1> cast);
John Bauman89401822014-05-06 15:04:28 -04001377
1378 // Long2();
1379 // Long2(int x, int y);
John Bauman19bac1e2014-05-06 15:23:49 -04001380 // Long2(RValue<Long2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001381 // Long2(const Long2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001382 // Long2(const Reference<Long2> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001383
John Bauman19bac1e2014-05-06 15:23:49 -04001384 // RValue<Long2> operator=(RValue<Long2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001385 // RValue<Long2> operator=(const Long2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001386 // RValue<Long2> operator=(const Reference<Long2 &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001387
John Bauman19bac1e2014-05-06 15:23:49 -04001388 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001389 };
1390
Nicolas Capens08e90f02014-11-21 12:49:12 -05001391// RValue<Long2> operator+(RValue<Long2> lhs, RValue<Long2> rhs);
1392// RValue<Long2> operator-(RValue<Long2> lhs, RValue<Long2> rhs);
1393// RValue<Long2> operator*(RValue<Long2> lhs, RValue<Long2> rhs);
1394// RValue<Long2> operator/(RValue<Long2> lhs, RValue<Long2> rhs);
1395// RValue<Long2> operator%(RValue<Long2> lhs, RValue<Long2> rhs);
1396// RValue<Long2> operator&(RValue<Long2> lhs, RValue<Long2> rhs);
1397// RValue<Long2> operator|(RValue<Long2> lhs, RValue<Long2> rhs);
1398// RValue<Long2> operator^(RValue<Long2> lhs, RValue<Long2> rhs);
1399// RValue<Long2> operator<<(RValue<Long2> lhs, unsigned char rhs);
1400// RValue<Long2> operator>>(RValue<Long2> lhs, unsigned char rhs);
1401// RValue<Long2> operator<<(RValue<Long2> lhs, RValue<Long1> rhs);
1402// RValue<Long2> operator>>(RValue<Long2> lhs, RValue<Long1> rhs);
1403// RValue<Long2> operator+=(const Long2 &lhs, RValue<Long2> rhs);
1404// RValue<Long2> operator-=(const Long2 &lhs, RValue<Long2> rhs);
1405// RValue<Long2> operator*=(const Long2 &lhs, RValue<Long2> rhs);
1406// RValue<Long2> operator/=(const Long2 &lhs, RValue<Long2> rhs);
1407// RValue<Long2> operator%=(const Long2 &lhs, RValue<Long2> rhs);
1408// RValue<Long2> operator&=(const Long2 &lhs, RValue<Long2> rhs);
1409// RValue<Long2> operator|=(const Long2 &lhs, RValue<Long2> rhs);
1410// RValue<Long2> operator^=(const Long2 &lhs, RValue<Long2> rhs);
1411// RValue<Long2> operator<<=(const Long2 &lhs, unsigned char rhs);
1412// RValue<Long2> operator>>=(const Long2 &lhs, unsigned char rhs);
1413// RValue<Long2> operator<<=(const Long2 &lhs, RValue<Long1> rhs);
1414// RValue<Long2> operator>>=(const Long2 &lhs, RValue<Long1> rhs);
1415// RValue<Long2> operator+(RValue<Long2> val);
1416// RValue<Long2> operator-(RValue<Long2> val);
1417// RValue<Long2> operator~(RValue<Long2> val);
1418// RValue<Long2> operator++(const Long2 &val, int); // Post-increment
1419// const Long2 &operator++(const Long2 &val); // Pre-increment
1420// RValue<Long2> operator--(const Long2 &val, int); // Post-decrement
1421// const Long2 &operator--(const Long2 &val); // Pre-decrement
1422// RValue<Bool> operator<(RValue<Long2> lhs, RValue<Long2> rhs);
1423// RValue<Bool> operator<=(RValue<Long2> lhs, RValue<Long2> rhs);
1424// RValue<Bool> operator>(RValue<Long2> lhs, RValue<Long2> rhs);
1425// RValue<Bool> operator>=(RValue<Long2> lhs, RValue<Long2> rhs);
1426// RValue<Bool> operator!=(RValue<Long2> lhs, RValue<Long2> rhs);
1427// RValue<Bool> operator==(RValue<Long2> lhs, RValue<Long2> rhs);
1428
1429// RValue<Long2> RoundInt(RValue<Float4> cast);
1430// RValue<Long2> UnpackLow(RValue<Long2> x, RValue<Long2> y);
1431 RValue<Long2> UnpackHigh(RValue<Long2> x, RValue<Long2> y);
1432// RValue<Int> Extract(RValue<Long2> val, int i);
1433// RValue<Long2> Insert(RValue<Long2> val, RValue<Int> element, int i);
1434
John Bauman66b8ab22014-05-06 15:57:45 -04001435 class UInt : public Variable<UInt>
John Bauman89401822014-05-06 15:04:28 -04001436 {
1437 public:
1438 explicit UInt(llvm::Argument *argument);
1439
John Bauman19bac1e2014-05-06 15:23:49 -04001440 explicit UInt(RValue<UShort> cast);
1441 explicit UInt(RValue<Long> cast);
1442 explicit UInt(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001443
1444 UInt();
1445 UInt(int x);
1446 UInt(unsigned int x);
John Bauman19bac1e2014-05-06 15:23:49 -04001447 UInt(RValue<UInt> rhs);
1448 UInt(RValue<Int> rhs);
John Bauman89401822014-05-06 15:04:28 -04001449 UInt(const UInt &rhs);
1450 UInt(const Int &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001451 UInt(const Reference<UInt> &rhs);
1452 UInt(const Reference<Int> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001453
1454 RValue<UInt> operator=(unsigned int rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001455 RValue<UInt> operator=(RValue<UInt> rhs) const;
1456 RValue<UInt> operator=(RValue<Int> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001457 RValue<UInt> operator=(const UInt &rhs) const;
1458 RValue<UInt> operator=(const Int &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001459 RValue<UInt> operator=(const Reference<UInt> &rhs) const;
1460 RValue<UInt> operator=(const Reference<Int> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001461
John Bauman19bac1e2014-05-06 15:23:49 -04001462 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001463 };
1464
Nicolas Capens08e90f02014-11-21 12:49:12 -05001465 RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs);
1466 RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs);
1467 RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs);
1468 RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs);
1469 RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs);
1470 RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs);
1471 RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs);
1472 RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs);
1473 RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs);
1474 RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs);
1475 RValue<UInt> operator+=(const UInt &lhs, RValue<UInt> rhs);
1476 RValue<UInt> operator-=(const UInt &lhs, RValue<UInt> rhs);
1477 RValue<UInt> operator*=(const UInt &lhs, RValue<UInt> rhs);
1478 RValue<UInt> operator/=(const UInt &lhs, RValue<UInt> rhs);
1479 RValue<UInt> operator%=(const UInt &lhs, RValue<UInt> rhs);
1480 RValue<UInt> operator&=(const UInt &lhs, RValue<UInt> rhs);
1481 RValue<UInt> operator|=(const UInt &lhs, RValue<UInt> rhs);
1482 RValue<UInt> operator^=(const UInt &lhs, RValue<UInt> rhs);
1483 RValue<UInt> operator<<=(const UInt &lhs, RValue<UInt> rhs);
1484 RValue<UInt> operator>>=(const UInt &lhs, RValue<UInt> rhs);
1485 RValue<UInt> operator+(RValue<UInt> val);
1486 RValue<UInt> operator-(RValue<UInt> val);
1487 RValue<UInt> operator~(RValue<UInt> val);
1488 RValue<UInt> operator++(const UInt &val, int); // Post-increment
1489 const UInt &operator++(const UInt &val); // Pre-increment
1490 RValue<UInt> operator--(const UInt &val, int); // Post-decrement
1491 const UInt &operator--(const UInt &val); // Pre-decrement
1492 RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs);
1493 RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs);
1494 RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs);
1495 RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs);
1496 RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs);
1497 RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs);
1498
1499 RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y);
1500 RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y);
1501 RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max);
1502// RValue<UInt> RoundUInt(RValue<Float> cast);
1503
John Bauman66b8ab22014-05-06 15:57:45 -04001504 class Int2 : public Variable<Int2>
John Bauman89401822014-05-06 15:04:28 -04001505 {
1506 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001507 // explicit Int2(RValue<Int> cast);
1508 explicit Int2(RValue<Int4> cast);
John Bauman89401822014-05-06 15:04:28 -04001509
1510 Int2();
1511 Int2(int x, int y);
John Bauman19bac1e2014-05-06 15:23:49 -04001512 Int2(RValue<Int2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001513 Int2(const Int2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001514 Int2(const Reference<Int2> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001515
John Bauman19bac1e2014-05-06 15:23:49 -04001516 RValue<Int2> operator=(RValue<Int2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001517 RValue<Int2> operator=(const Int2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001518 RValue<Int2> operator=(const Reference<Int2> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001519
John Bauman19bac1e2014-05-06 15:23:49 -04001520 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001521 };
1522
Nicolas Capens08e90f02014-11-21 12:49:12 -05001523 RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs);
1524 RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs);
1525// RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs);
1526// RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs);
1527// RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs);
1528 RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs);
1529 RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs);
1530 RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs);
1531 RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs);
1532 RValue<Int2> operator>>(RValue<Int2> lhs, unsigned char rhs);
1533 RValue<Int2> operator<<(RValue<Int2> lhs, RValue<Long1> rhs);
1534 RValue<Int2> operator>>(RValue<Int2> lhs, RValue<Long1> rhs);
1535 RValue<Int2> operator+=(const Int2 &lhs, RValue<Int2> rhs);
1536 RValue<Int2> operator-=(const Int2 &lhs, RValue<Int2> rhs);
1537// RValue<Int2> operator*=(const Int2 &lhs, RValue<Int2> rhs);
1538// RValue<Int2> operator/=(const Int2 &lhs, RValue<Int2> rhs);
1539// RValue<Int2> operator%=(const Int2 &lhs, RValue<Int2> rhs);
1540 RValue<Int2> operator&=(const Int2 &lhs, RValue<Int2> rhs);
1541 RValue<Int2> operator|=(const Int2 &lhs, RValue<Int2> rhs);
1542 RValue<Int2> operator^=(const Int2 &lhs, RValue<Int2> rhs);
1543 RValue<Int2> operator<<=(const Int2 &lhs, unsigned char rhs);
1544 RValue<Int2> operator>>=(const Int2 &lhs, unsigned char rhs);
1545 RValue<Int2> operator<<=(const Int2 &lhs, RValue<Long1> rhs);
1546 RValue<Int2> operator>>=(const Int2 &lhs, RValue<Long1> rhs);
1547// RValue<Int2> operator+(RValue<Int2> val);
1548// RValue<Int2> operator-(RValue<Int2> val);
1549 RValue<Int2> operator~(RValue<Int2> val);
1550// RValue<Int2> operator++(const Int2 &val, int); // Post-increment
1551// const Int2 &operator++(const Int2 &val); // Pre-increment
1552// RValue<Int2> operator--(const Int2 &val, int); // Post-decrement
1553// const Int2 &operator--(const Int2 &val); // Pre-decrement
1554// RValue<Bool> operator<(RValue<Int2> lhs, RValue<Int2> rhs);
1555// RValue<Bool> operator<=(RValue<Int2> lhs, RValue<Int2> rhs);
1556// RValue<Bool> operator>(RValue<Int2> lhs, RValue<Int2> rhs);
1557// RValue<Bool> operator>=(RValue<Int2> lhs, RValue<Int2> rhs);
1558// RValue<Bool> operator!=(RValue<Int2> lhs, RValue<Int2> rhs);
1559// RValue<Bool> operator==(RValue<Int2> lhs, RValue<Int2> rhs);
1560
1561// RValue<Int2> RoundInt(RValue<Float4> cast);
1562 RValue<Long1> UnpackLow(RValue<Int2> x, RValue<Int2> y);
1563 RValue<Long1> UnpackHigh(RValue<Int2> x, RValue<Int2> y);
Nicolas Capensfff3c9b2015-05-13 23:40:44 -04001564 RValue<Int2> Concatenate(RValue<Int> lo, RValue<Int> hi);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001565 RValue<Int> Extract(RValue<Int2> val, int i);
Nicolas Capensfff3c9b2015-05-13 23:40:44 -04001566 RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001567
John Bauman66b8ab22014-05-06 15:57:45 -04001568 class UInt2 : public Variable<UInt2>
John Bauman89401822014-05-06 15:04:28 -04001569 {
1570 public:
1571 UInt2();
1572 UInt2(unsigned int x, unsigned int y);
John Bauman19bac1e2014-05-06 15:23:49 -04001573 UInt2(RValue<UInt2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001574 UInt2(const UInt2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001575 UInt2(const Reference<UInt2> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001576
John Bauman19bac1e2014-05-06 15:23:49 -04001577 RValue<UInt2> operator=(RValue<UInt2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001578 RValue<UInt2> operator=(const UInt2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001579 RValue<UInt2> operator=(const Reference<UInt2> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001580
John Bauman19bac1e2014-05-06 15:23:49 -04001581 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001582 };
1583
Nicolas Capens08e90f02014-11-21 12:49:12 -05001584 RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs);
1585 RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs);
1586// RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs);
1587// RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs);
1588// RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs);
1589 RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs);
1590 RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs);
1591 RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs);
1592 RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs);
1593 RValue<UInt2> operator>>(RValue<UInt2> lhs, unsigned char rhs);
1594 RValue<UInt2> operator<<(RValue<UInt2> lhs, RValue<Long1> rhs);
1595 RValue<UInt2> operator>>(RValue<UInt2> lhs, RValue<Long1> rhs);
1596 RValue<UInt2> operator+=(const UInt2 &lhs, RValue<UInt2> rhs);
1597 RValue<UInt2> operator-=(const UInt2 &lhs, RValue<UInt2> rhs);
1598// RValue<UInt2> operator*=(const UInt2 &lhs, RValue<UInt2> rhs);
1599// RValue<UInt2> operator/=(const UInt2 &lhs, RValue<UInt2> rhs);
1600// RValue<UInt2> operator%=(const UInt2 &lhs, RValue<UInt2> rhs);
1601 RValue<UInt2> operator&=(const UInt2 &lhs, RValue<UInt2> rhs);
1602 RValue<UInt2> operator|=(const UInt2 &lhs, RValue<UInt2> rhs);
1603 RValue<UInt2> operator^=(const UInt2 &lhs, RValue<UInt2> rhs);
1604 RValue<UInt2> operator<<=(const UInt2 &lhs, unsigned char rhs);
1605 RValue<UInt2> operator>>=(const UInt2 &lhs, unsigned char rhs);
1606 RValue<UInt2> operator<<=(const UInt2 &lhs, RValue<Long1> rhs);
1607 RValue<UInt2> operator>>=(const UInt2 &lhs, RValue<Long1> rhs);
1608// RValue<UInt2> operator+(RValue<UInt2> val);
1609// RValue<UInt2> operator-(RValue<UInt2> val);
1610 RValue<UInt2> operator~(RValue<UInt2> val);
1611// RValue<UInt2> operator++(const UInt2 &val, int); // Post-increment
1612// const UInt2 &operator++(const UInt2 &val); // Pre-increment
1613// RValue<UInt2> operator--(const UInt2 &val, int); // Post-decrement
1614// const UInt2 &operator--(const UInt2 &val); // Pre-decrement
1615// RValue<Bool> operator<(RValue<UInt2> lhs, RValue<UInt2> rhs);
1616// RValue<Bool> operator<=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1617// RValue<Bool> operator>(RValue<UInt2> lhs, RValue<UInt2> rhs);
1618// RValue<Bool> operator>=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1619// RValue<Bool> operator!=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1620// RValue<Bool> operator==(RValue<UInt2> lhs, RValue<UInt2> rhs);
1621
1622// RValue<UInt2> RoundInt(RValue<Float4> cast);
1623
John Bauman66b8ab22014-05-06 15:57:45 -04001624 class Int4 : public Variable<Int4>
John Bauman89401822014-05-06 15:04:28 -04001625 {
1626 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001627 explicit Int4(RValue<Float4> cast);
Alexis Hetu2aa852f2015-10-14 16:32:39 -04001628 explicit Int4(RValue<Short4> cast);
1629 explicit Int4(RValue<UShort4> cast);
John Bauman89401822014-05-06 15:04:28 -04001630
1631 Int4();
1632 Int4(int xyzw);
1633 Int4(int x, int yzw);
1634 Int4(int x, int y, int zw);
1635 Int4(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -04001636 Int4(RValue<Int4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001637 Int4(const Int4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001638 Int4(const Reference<Int4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001639 Int4(RValue<UInt4> rhs);
1640 Int4(const UInt4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001641 Int4(const Reference<UInt4> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001642
John Bauman19bac1e2014-05-06 15:23:49 -04001643 RValue<Int4> operator=(RValue<Int4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001644 RValue<Int4> operator=(const Int4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001645 RValue<Int4> operator=(const Reference<Int4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001646
John Bauman19bac1e2014-05-06 15:23:49 -04001647 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001648
1649 private:
1650 void constant(int x, int y, int z, int w);
1651 };
1652
Nicolas Capens08e90f02014-11-21 12:49:12 -05001653 RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs);
1654 RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs);
1655 RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs);
Alexis Hetud9d27bb2015-08-18 15:22:15 -04001656 RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs);
1657 RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001658 RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs);
1659 RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs);
1660 RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs);
1661 RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs);
1662 RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs);
Alexis Hetud9d27bb2015-08-18 15:22:15 -04001663 RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs);
1664 RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001665 RValue<Int4> operator+=(const Int4 &lhs, RValue<Int4> rhs);
1666 RValue<Int4> operator-=(const Int4 &lhs, RValue<Int4> rhs);
1667 RValue<Int4> operator*=(const Int4 &lhs, RValue<Int4> rhs);
1668// RValue<Int4> operator/=(const Int4 &lhs, RValue<Int4> rhs);
1669// RValue<Int4> operator%=(const Int4 &lhs, RValue<Int4> rhs);
1670 RValue<Int4> operator&=(const Int4 &lhs, RValue<Int4> rhs);
1671 RValue<Int4> operator|=(const Int4 &lhs, RValue<Int4> rhs);
1672 RValue<Int4> operator^=(const Int4 &lhs, RValue<Int4> rhs);
1673 RValue<Int4> operator<<=(const Int4 &lhs, unsigned char rhs);
1674 RValue<Int4> operator>>=(const Int4 &lhs, unsigned char rhs);
1675 RValue<Int4> operator+(RValue<Int4> val);
1676 RValue<Int4> operator-(RValue<Int4> val);
1677 RValue<Int4> operator~(RValue<Int4> val);
1678// RValue<Int4> operator++(const Int4 &val, int); // Post-increment
1679// const Int4 &operator++(const Int4 &val); // Pre-increment
1680// RValue<Int4> operator--(const Int4 &val, int); // Post-decrement
1681// const Int4 &operator--(const Int4 &val); // Pre-decrement
1682// RValue<Bool> operator<(RValue<Int4> lhs, RValue<Int4> rhs);
1683// RValue<Bool> operator<=(RValue<Int4> lhs, RValue<Int4> rhs);
1684// RValue<Bool> operator>(RValue<Int4> lhs, RValue<Int4> rhs);
1685// RValue<Bool> operator>=(RValue<Int4> lhs, RValue<Int4> rhs);
1686// RValue<Bool> operator!=(RValue<Int4> lhs, RValue<Int4> rhs);
1687// RValue<Bool> operator==(RValue<Int4> lhs, RValue<Int4> rhs);
1688
1689 RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y);
1690 RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y);
1691 RValue<Int4> CmpLE(RValue<Int4> x, RValue<Int4> y);
1692 RValue<Int4> CmpNEQ(RValue<Int4> x, RValue<Int4> y);
1693 RValue<Int4> CmpNLT(RValue<Int4> x, RValue<Int4> y);
1694 RValue<Int4> CmpNLE(RValue<Int4> x, RValue<Int4> y);
1695 RValue<Int4> Max(RValue<Int4> x, RValue<Int4> y);
1696 RValue<Int4> Min(RValue<Int4> x, RValue<Int4> y);
1697 RValue<Int4> RoundInt(RValue<Float4> cast);
1698 RValue<Short8> Pack(RValue<Int4> x, RValue<Int4> y);
1699 RValue<Int4> Concatenate(RValue<Int2> lo, RValue<Int2> hi);
1700 RValue<Int> Extract(RValue<Int4> x, int i);
1701 RValue<Int4> Insert(RValue<Int4> val, RValue<Int> element, int i);
1702 RValue<Int> SignMask(RValue<Int4> x);
1703 RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select);
1704
John Bauman66b8ab22014-05-06 15:57:45 -04001705 class UInt4 : public Variable<UInt4>
John Bauman89401822014-05-06 15:04:28 -04001706 {
1707 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001708 explicit UInt4(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001709
1710 UInt4();
John Bauman19bac1e2014-05-06 15:23:49 -04001711 UInt4(int xyzw);
1712 UInt4(int x, int yzw);
1713 UInt4(int x, int y, int zw);
1714 UInt4(int x, int y, int z, int w);
John Bauman89401822014-05-06 15:04:28 -04001715 UInt4(unsigned int x, unsigned int y, unsigned int z, unsigned int w);
John Bauman19bac1e2014-05-06 15:23:49 -04001716 UInt4(RValue<UInt4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001717 UInt4(const UInt4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001718 UInt4(const Reference<UInt4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001719 UInt4(RValue<Int4> rhs);
1720 UInt4(const Int4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001721 UInt4(const Reference<Int4> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001722
John Bauman19bac1e2014-05-06 15:23:49 -04001723 RValue<UInt4> operator=(RValue<UInt4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001724 RValue<UInt4> operator=(const UInt4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001725 RValue<UInt4> operator=(const Reference<UInt4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001726
John Bauman19bac1e2014-05-06 15:23:49 -04001727 static llvm::Type *getType();
1728
1729 private:
1730 void constant(int x, int y, int z, int w);
John Bauman89401822014-05-06 15:04:28 -04001731 };
1732
Nicolas Capens08e90f02014-11-21 12:49:12 -05001733 RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs);
1734 RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs);
1735 RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs);
Alexis Hetud9d27bb2015-08-18 15:22:15 -04001736 RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs);
1737 RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001738 RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs);
1739 RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs);
1740 RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs);
1741 RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs);
1742 RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs);
Alexis Hetud9d27bb2015-08-18 15:22:15 -04001743 RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs);
1744 RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs);
Nicolas Capens08e90f02014-11-21 12:49:12 -05001745 RValue<UInt4> operator+=(const UInt4 &lhs, RValue<UInt4> rhs);
1746 RValue<UInt4> operator-=(const UInt4 &lhs, RValue<UInt4> rhs);
1747 RValue<UInt4> operator*=(const UInt4 &lhs, RValue<UInt4> rhs);
1748// RValue<UInt4> operator/=(const UInt4 &lhs, RValue<UInt4> rhs);
1749// RValue<UInt4> operator%=(const UInt4 &lhs, RValue<UInt4> rhs);
1750 RValue<UInt4> operator&=(const UInt4 &lhs, RValue<UInt4> rhs);
1751 RValue<UInt4> operator|=(const UInt4 &lhs, RValue<UInt4> rhs);
1752 RValue<UInt4> operator^=(const UInt4 &lhs, RValue<UInt4> rhs);
1753 RValue<UInt4> operator<<=(const UInt4 &lhs, unsigned char rhs);
1754 RValue<UInt4> operator>>=(const UInt4 &lhs, unsigned char rhs);
1755 RValue<UInt4> operator+(RValue<UInt4> val);
1756 RValue<UInt4> operator-(RValue<UInt4> val);
1757 RValue<UInt4> operator~(RValue<UInt4> val);
1758// RValue<UInt4> operator++(const UInt4 &val, int); // Post-increment
1759// const UInt4 &operator++(const UInt4 &val); // Pre-increment
1760// RValue<UInt4> operator--(const UInt4 &val, int); // Post-decrement
1761// const UInt4 &operator--(const UInt4 &val); // Pre-decrement
1762// RValue<Bool> operator<(RValue<UInt4> lhs, RValue<UInt4> rhs);
1763// RValue<Bool> operator<=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1764// RValue<Bool> operator>(RValue<UInt4> lhs, RValue<UInt4> rhs);
1765// RValue<Bool> operator>=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1766// RValue<Bool> operator!=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1767// RValue<Bool> operator==(RValue<UInt4> lhs, RValue<UInt4> rhs);
1768
1769 RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y);
1770 RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y);
1771 RValue<UInt4> CmpLE(RValue<UInt4> x, RValue<UInt4> y);
1772 RValue<UInt4> CmpNEQ(RValue<UInt4> x, RValue<UInt4> y);
1773 RValue<UInt4> CmpNLT(RValue<UInt4> x, RValue<UInt4> y);
1774 RValue<UInt4> CmpNLE(RValue<UInt4> x, RValue<UInt4> y);
1775 RValue<UInt4> Max(RValue<UInt4> x, RValue<UInt4> y);
1776 RValue<UInt4> Min(RValue<UInt4> x, RValue<UInt4> y);
1777// RValue<UInt4> RoundInt(RValue<Float4> cast);
1778 RValue<UShort8> Pack(RValue<UInt4> x, RValue<UInt4> y);
1779 RValue<UInt4> Concatenate(RValue<UInt2> lo, RValue<UInt2> hi);
1780
John Bauman66b8ab22014-05-06 15:57:45 -04001781 template<int T>
1782 class Swizzle2Float4
1783 {
1784 friend class Float4;
1785
1786 public:
1787 operator RValue<Float4>() const;
1788
1789 private:
1790 Float4 *parent;
1791 };
1792
1793 template<int T>
1794 class SwizzleFloat4
1795 {
1796 public:
1797 operator RValue<Float4>() const;
1798
1799 private:
1800 Float4 *parent;
1801 };
1802
1803 template<int T>
1804 class SwizzleMaskFloat4
1805 {
1806 friend class Float4;
1807
1808 public:
1809 operator RValue<Float4>() const;
1810
1811 RValue<Float4> operator=(RValue<Float4> rhs) const;
1812 RValue<Float4> operator=(RValue<Float> rhs) const;
1813
1814 private:
1815 Float4 *parent;
1816 };
1817
1818 template<int T>
1819 class SwizzleMask1Float4
1820 {
1821 public:
1822 operator RValue<Float>() const;
1823 operator RValue<Float4>() const;
1824
1825 RValue<Float4> operator=(float x) const;
1826 RValue<Float4> operator=(RValue<Float4> rhs) const;
1827 RValue<Float4> operator=(RValue<Float> rhs) const;
1828
1829 private:
1830 Float4 *parent;
1831 };
1832
1833 template<int T>
1834 class SwizzleMask2Float4
1835 {
1836 friend class Float4;
1837
1838 public:
1839 operator RValue<Float4>() const;
1840
1841 RValue<Float4> operator=(RValue<Float4> rhs) const;
1842
1843 private:
1844 Float4 *parent;
1845 };
1846
1847 class Float : public Variable<Float>
John Bauman89401822014-05-06 15:04:28 -04001848 {
1849 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001850 explicit Float(RValue<Int> cast);
John Bauman89401822014-05-06 15:04:28 -04001851
1852 Float();
1853 Float(float x);
John Bauman19bac1e2014-05-06 15:23:49 -04001854 Float(RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001855 Float(const Float &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001856 Float(const Reference<Float> &rhs);
1857
1858 template<int T>
1859 Float(const SwizzleMask1Float4<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001860
1861 // RValue<Float> operator=(float rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -04001862 RValue<Float> operator=(RValue<Float> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001863 RValue<Float> operator=(const Float &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001864 RValue<Float> operator=(const Reference<Float> &rhs) const;
1865
1866 template<int T>
1867 RValue<Float> operator=(const SwizzleMask1Float4<T> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001868
John Bauman19bac1e2014-05-06 15:23:49 -04001869 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001870 };
1871
Nicolas Capens08e90f02014-11-21 12:49:12 -05001872 RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs);
1873 RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs);
1874 RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs);
1875 RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs);
1876 RValue<Float> operator+=(const Float &lhs, RValue<Float> rhs);
1877 RValue<Float> operator-=(const Float &lhs, RValue<Float> rhs);
1878 RValue<Float> operator*=(const Float &lhs, RValue<Float> rhs);
1879 RValue<Float> operator/=(const Float &lhs, RValue<Float> rhs);
1880 RValue<Float> operator+(RValue<Float> val);
1881 RValue<Float> operator-(RValue<Float> val);
1882 RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs);
1883 RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs);
1884 RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs);
1885 RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs);
1886 RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs);
1887 RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs);
1888
1889 RValue<Float> Abs(RValue<Float> x);
1890 RValue<Float> Max(RValue<Float> x, RValue<Float> y);
1891 RValue<Float> Min(RValue<Float> x, RValue<Float> y);
1892 RValue<Float> Rcp_pp(RValue<Float> val);
1893 RValue<Float> RcpSqrt_pp(RValue<Float> val);
1894 RValue<Float> Sqrt(RValue<Float> x);
1895 RValue<Float> Round(RValue<Float> val);
1896 RValue<Float> Trunc(RValue<Float> val);
1897 RValue<Float> Frac(RValue<Float> val);
1898 RValue<Float> Floor(RValue<Float> val);
1899 RValue<Float> Ceil(RValue<Float> val);
1900
John Bauman66b8ab22014-05-06 15:57:45 -04001901 class Float2 : public Variable<Float2>
John Bauman89401822014-05-06 15:04:28 -04001902 {
1903 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001904 // explicit Float2(RValue<Byte2> cast);
1905 // explicit Float2(RValue<Short2> cast);
1906 // explicit Float2(RValue<UShort2> cast);
1907 // explicit Float2(RValue<Int2> cast);
1908 // explicit Float2(RValue<UInt2> cast);
1909 explicit Float2(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001910
1911 // Float2();
1912 // Float2(float x, float y);
John Bauman19bac1e2014-05-06 15:23:49 -04001913 // Float2(RValue<Float2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001914 // Float2(const Float2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001915 // Float2(const Reference<Float2> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001916 // Float2(RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001917 // Float2(const Float &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001918 // Float2(const Reference<Float> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001919
1920 // template<int T>
1921 // Float2(const SwizzleMask1Float4<T> &rhs);
1922
1923 // RValue<Float2> operator=(float replicate) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001924 // RValue<Float2> operator=(RValue<Float2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001925 // RValue<Float2> operator=(const Float2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001926 // RValue<Float2> operator=(const Reference<Float2> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001927 // RValue<Float2> operator=(RValue<Float> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001928 // RValue<Float2> operator=(const Float &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001929 // RValue<Float2> operator=(const Reference<Float> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001930
1931 // template<int T>
1932 // RValue<Float2> operator=(const SwizzleMask1Float4<T> &rhs);
1933
John Bauman19bac1e2014-05-06 15:23:49 -04001934 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001935 };
1936
Nicolas Capens08e90f02014-11-21 12:49:12 -05001937// RValue<Float2> operator+(RValue<Float2> lhs, RValue<Float2> rhs);
1938// RValue<Float2> operator-(RValue<Float2> lhs, RValue<Float2> rhs);
1939// RValue<Float2> operator*(RValue<Float2> lhs, RValue<Float2> rhs);
1940// RValue<Float2> operator/(RValue<Float2> lhs, RValue<Float2> rhs);
1941// RValue<Float2> operator%(RValue<Float2> lhs, RValue<Float2> rhs);
1942// RValue<Float2> operator+=(const Float2 &lhs, RValue<Float2> rhs);
1943// RValue<Float2> operator-=(const Float2 &lhs, RValue<Float2> rhs);
1944// RValue<Float2> operator*=(const Float2 &lhs, RValue<Float2> rhs);
1945// RValue<Float2> operator/=(const Float2 &lhs, RValue<Float2> rhs);
1946// RValue<Float2> operator%=(const Float2 &lhs, RValue<Float2> rhs);
1947// RValue<Float2> operator+(RValue<Float2> val);
1948// RValue<Float2> operator-(RValue<Float2> val);
1949
1950// RValue<Float2> Abs(RValue<Float2> x);
1951// RValue<Float2> Max(RValue<Float2> x, RValue<Float2> y);
1952// RValue<Float2> Min(RValue<Float2> x, RValue<Float2> y);
1953// RValue<Float2> Swizzle(RValue<Float2> x, unsigned char select);
1954// RValue<Float2> Mask(Float2 &lhs, RValue<Float2> rhs, unsigned char select);
1955
John Bauman66b8ab22014-05-06 15:57:45 -04001956 class Float4 : public Variable<Float4>
John Bauman89401822014-05-06 15:04:28 -04001957 {
1958 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001959 explicit Float4(RValue<Byte4> cast);
1960 explicit Float4(RValue<SByte4> cast);
1961 explicit Float4(RValue<Short4> cast);
1962 explicit Float4(RValue<UShort4> cast);
1963 explicit Float4(RValue<Int4> cast);
1964 explicit Float4(RValue<UInt4> cast);
John Bauman89401822014-05-06 15:04:28 -04001965
1966 Float4();
1967 Float4(float xyzw);
1968 Float4(float x, float yzw);
1969 Float4(float x, float y, float zw);
1970 Float4(float x, float y, float z, float w);
John Bauman19bac1e2014-05-06 15:23:49 -04001971 Float4(RValue<Float4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001972 Float4(const Float4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001973 Float4(const Reference<Float4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001974 Float4(RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001975 Float4(const Float &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001976 Float4(const Reference<Float> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001977
1978 template<int T>
1979 Float4(const SwizzleMask1Float4<T> &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001980 template<int T>
1981 Float4(const SwizzleFloat4<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001982 template<int X, int Y>
1983 Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y);
1984 template<int X, int Y>
1985 Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y);
1986 template<int X, int Y>
1987 Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
1988 template<int X, int Y>
1989 Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
1990
1991 RValue<Float4> operator=(float replicate) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001992 RValue<Float4> operator=(RValue<Float4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001993 RValue<Float4> operator=(const Float4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001994 RValue<Float4> operator=(const Reference<Float4> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001995 RValue<Float4> operator=(RValue<Float> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001996 RValue<Float4> operator=(const Float &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001997 RValue<Float4> operator=(const Reference<Float> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001998
1999 template<int T>
2000 RValue<Float4> operator=(const SwizzleMask1Float4<T> &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04002001 template<int T>
2002 RValue<Float4> operator=(const SwizzleFloat4<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -04002003
John Bauman19bac1e2014-05-06 15:23:49 -04002004 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04002005
2006 union
2007 {
2008 SwizzleMask1Float4<0x00> x;
2009 SwizzleMask1Float4<0x55> y;
2010 SwizzleMask1Float4<0xAA> z;
2011 SwizzleMask1Float4<0xFF> w;
2012 Swizzle2Float4<0x00> xx;
2013 Swizzle2Float4<0x01> yx;
2014 Swizzle2Float4<0x02> zx;
2015 Swizzle2Float4<0x03> wx;
2016 SwizzleMask2Float4<0x54> xy;
2017 Swizzle2Float4<0x55> yy;
2018 Swizzle2Float4<0x56> zy;
2019 Swizzle2Float4<0x57> wy;
2020 SwizzleMask2Float4<0xA8> xz;
2021 SwizzleMask2Float4<0xA9> yz;
2022 Swizzle2Float4<0xAA> zz;
2023 Swizzle2Float4<0xAB> wz;
2024 SwizzleMask2Float4<0xFC> xw;
2025 SwizzleMask2Float4<0xFD> yw;
2026 SwizzleMask2Float4<0xFE> zw;
2027 Swizzle2Float4<0xFF> ww;
2028 SwizzleFloat4<0x00> xxx;
2029 SwizzleFloat4<0x01> yxx;
2030 SwizzleFloat4<0x02> zxx;
2031 SwizzleFloat4<0x03> wxx;
2032 SwizzleFloat4<0x04> xyx;
2033 SwizzleFloat4<0x05> yyx;
2034 SwizzleFloat4<0x06> zyx;
2035 SwizzleFloat4<0x07> wyx;
2036 SwizzleFloat4<0x08> xzx;
2037 SwizzleFloat4<0x09> yzx;
2038 SwizzleFloat4<0x0A> zzx;
2039 SwizzleFloat4<0x0B> wzx;
2040 SwizzleFloat4<0x0C> xwx;
2041 SwizzleFloat4<0x0D> ywx;
2042 SwizzleFloat4<0x0E> zwx;
2043 SwizzleFloat4<0x0F> wwx;
2044 SwizzleFloat4<0x50> xxy;
2045 SwizzleFloat4<0x51> yxy;
2046 SwizzleFloat4<0x52> zxy;
2047 SwizzleFloat4<0x53> wxy;
2048 SwizzleFloat4<0x54> xyy;
2049 SwizzleFloat4<0x55> yyy;
2050 SwizzleFloat4<0x56> zyy;
2051 SwizzleFloat4<0x57> wyy;
2052 SwizzleFloat4<0x58> xzy;
2053 SwizzleFloat4<0x59> yzy;
2054 SwizzleFloat4<0x5A> zzy;
2055 SwizzleFloat4<0x5B> wzy;
2056 SwizzleFloat4<0x5C> xwy;
2057 SwizzleFloat4<0x5D> ywy;
2058 SwizzleFloat4<0x5E> zwy;
2059 SwizzleFloat4<0x5F> wwy;
2060 SwizzleFloat4<0xA0> xxz;
2061 SwizzleFloat4<0xA1> yxz;
2062 SwizzleFloat4<0xA2> zxz;
2063 SwizzleFloat4<0xA3> wxz;
2064 SwizzleMaskFloat4<0xA4> xyz;
2065 SwizzleFloat4<0xA5> yyz;
2066 SwizzleFloat4<0xA6> zyz;
2067 SwizzleFloat4<0xA7> wyz;
2068 SwizzleFloat4<0xA8> xzz;
2069 SwizzleFloat4<0xA9> yzz;
2070 SwizzleFloat4<0xAA> zzz;
2071 SwizzleFloat4<0xAB> wzz;
2072 SwizzleFloat4<0xAC> xwz;
2073 SwizzleFloat4<0xAD> ywz;
2074 SwizzleFloat4<0xAE> zwz;
2075 SwizzleFloat4<0xAF> wwz;
2076 SwizzleFloat4<0xF0> xxw;
2077 SwizzleFloat4<0xF1> yxw;
2078 SwizzleFloat4<0xF2> zxw;
2079 SwizzleFloat4<0xF3> wxw;
2080 SwizzleMaskFloat4<0xF4> xyw;
2081 SwizzleFloat4<0xF5> yyw;
2082 SwizzleFloat4<0xF6> zyw;
2083 SwizzleFloat4<0xF7> wyw;
2084 SwizzleMaskFloat4<0xF8> xzw;
2085 SwizzleMaskFloat4<0xF9> yzw;
2086 SwizzleFloat4<0xFA> zzw;
2087 SwizzleFloat4<0xFB> wzw;
2088 SwizzleFloat4<0xFC> xww;
2089 SwizzleFloat4<0xFD> yww;
2090 SwizzleFloat4<0xFE> zww;
2091 SwizzleFloat4<0xFF> www;
2092 SwizzleFloat4<0x00> xxxx;
2093 SwizzleFloat4<0x01> yxxx;
2094 SwizzleFloat4<0x02> zxxx;
2095 SwizzleFloat4<0x03> wxxx;
2096 SwizzleFloat4<0x04> xyxx;
2097 SwizzleFloat4<0x05> yyxx;
2098 SwizzleFloat4<0x06> zyxx;
2099 SwizzleFloat4<0x07> wyxx;
2100 SwizzleFloat4<0x08> xzxx;
2101 SwizzleFloat4<0x09> yzxx;
2102 SwizzleFloat4<0x0A> zzxx;
2103 SwizzleFloat4<0x0B> wzxx;
2104 SwizzleFloat4<0x0C> xwxx;
2105 SwizzleFloat4<0x0D> ywxx;
2106 SwizzleFloat4<0x0E> zwxx;
2107 SwizzleFloat4<0x0F> wwxx;
2108 SwizzleFloat4<0x10> xxyx;
2109 SwizzleFloat4<0x11> yxyx;
2110 SwizzleFloat4<0x12> zxyx;
2111 SwizzleFloat4<0x13> wxyx;
2112 SwizzleFloat4<0x14> xyyx;
2113 SwizzleFloat4<0x15> yyyx;
2114 SwizzleFloat4<0x16> zyyx;
2115 SwizzleFloat4<0x17> wyyx;
2116 SwizzleFloat4<0x18> xzyx;
2117 SwizzleFloat4<0x19> yzyx;
2118 SwizzleFloat4<0x1A> zzyx;
2119 SwizzleFloat4<0x1B> wzyx;
2120 SwizzleFloat4<0x1C> xwyx;
2121 SwizzleFloat4<0x1D> ywyx;
2122 SwizzleFloat4<0x1E> zwyx;
2123 SwizzleFloat4<0x1F> wwyx;
2124 SwizzleFloat4<0x20> xxzx;
2125 SwizzleFloat4<0x21> yxzx;
2126 SwizzleFloat4<0x22> zxzx;
2127 SwizzleFloat4<0x23> wxzx;
2128 SwizzleFloat4<0x24> xyzx;
2129 SwizzleFloat4<0x25> yyzx;
2130 SwizzleFloat4<0x26> zyzx;
2131 SwizzleFloat4<0x27> wyzx;
2132 SwizzleFloat4<0x28> xzzx;
2133 SwizzleFloat4<0x29> yzzx;
2134 SwizzleFloat4<0x2A> zzzx;
2135 SwizzleFloat4<0x2B> wzzx;
2136 SwizzleFloat4<0x2C> xwzx;
2137 SwizzleFloat4<0x2D> ywzx;
2138 SwizzleFloat4<0x2E> zwzx;
2139 SwizzleFloat4<0x2F> wwzx;
2140 SwizzleFloat4<0x30> xxwx;
2141 SwizzleFloat4<0x31> yxwx;
2142 SwizzleFloat4<0x32> zxwx;
2143 SwizzleFloat4<0x33> wxwx;
2144 SwizzleFloat4<0x34> xywx;
2145 SwizzleFloat4<0x35> yywx;
2146 SwizzleFloat4<0x36> zywx;
2147 SwizzleFloat4<0x37> wywx;
2148 SwizzleFloat4<0x38> xzwx;
2149 SwizzleFloat4<0x39> yzwx;
2150 SwizzleFloat4<0x3A> zzwx;
2151 SwizzleFloat4<0x3B> wzwx;
2152 SwizzleFloat4<0x3C> xwwx;
2153 SwizzleFloat4<0x3D> ywwx;
2154 SwizzleFloat4<0x3E> zwwx;
2155 SwizzleFloat4<0x3F> wwwx;
2156 SwizzleFloat4<0x40> xxxy;
2157 SwizzleFloat4<0x41> yxxy;
2158 SwizzleFloat4<0x42> zxxy;
2159 SwizzleFloat4<0x43> wxxy;
2160 SwizzleFloat4<0x44> xyxy;
2161 SwizzleFloat4<0x45> yyxy;
2162 SwizzleFloat4<0x46> zyxy;
2163 SwizzleFloat4<0x47> wyxy;
2164 SwizzleFloat4<0x48> xzxy;
2165 SwizzleFloat4<0x49> yzxy;
2166 SwizzleFloat4<0x4A> zzxy;
2167 SwizzleFloat4<0x4B> wzxy;
2168 SwizzleFloat4<0x4C> xwxy;
2169 SwizzleFloat4<0x4D> ywxy;
2170 SwizzleFloat4<0x4E> zwxy;
2171 SwizzleFloat4<0x4F> wwxy;
2172 SwizzleFloat4<0x50> xxyy;
2173 SwizzleFloat4<0x51> yxyy;
2174 SwizzleFloat4<0x52> zxyy;
2175 SwizzleFloat4<0x53> wxyy;
2176 SwizzleFloat4<0x54> xyyy;
2177 SwizzleFloat4<0x55> yyyy;
2178 SwizzleFloat4<0x56> zyyy;
2179 SwizzleFloat4<0x57> wyyy;
2180 SwizzleFloat4<0x58> xzyy;
2181 SwizzleFloat4<0x59> yzyy;
2182 SwizzleFloat4<0x5A> zzyy;
2183 SwizzleFloat4<0x5B> wzyy;
2184 SwizzleFloat4<0x5C> xwyy;
2185 SwizzleFloat4<0x5D> ywyy;
2186 SwizzleFloat4<0x5E> zwyy;
2187 SwizzleFloat4<0x5F> wwyy;
2188 SwizzleFloat4<0x60> xxzy;
2189 SwizzleFloat4<0x61> yxzy;
2190 SwizzleFloat4<0x62> zxzy;
2191 SwizzleFloat4<0x63> wxzy;
2192 SwizzleFloat4<0x64> xyzy;
2193 SwizzleFloat4<0x65> yyzy;
2194 SwizzleFloat4<0x66> zyzy;
2195 SwizzleFloat4<0x67> wyzy;
2196 SwizzleFloat4<0x68> xzzy;
2197 SwizzleFloat4<0x69> yzzy;
2198 SwizzleFloat4<0x6A> zzzy;
2199 SwizzleFloat4<0x6B> wzzy;
2200 SwizzleFloat4<0x6C> xwzy;
2201 SwizzleFloat4<0x6D> ywzy;
2202 SwizzleFloat4<0x6E> zwzy;
2203 SwizzleFloat4<0x6F> wwzy;
2204 SwizzleFloat4<0x70> xxwy;
2205 SwizzleFloat4<0x71> yxwy;
2206 SwizzleFloat4<0x72> zxwy;
2207 SwizzleFloat4<0x73> wxwy;
2208 SwizzleFloat4<0x74> xywy;
2209 SwizzleFloat4<0x75> yywy;
2210 SwizzleFloat4<0x76> zywy;
2211 SwizzleFloat4<0x77> wywy;
2212 SwizzleFloat4<0x78> xzwy;
2213 SwizzleFloat4<0x79> yzwy;
2214 SwizzleFloat4<0x7A> zzwy;
2215 SwizzleFloat4<0x7B> wzwy;
2216 SwizzleFloat4<0x7C> xwwy;
2217 SwizzleFloat4<0x7D> ywwy;
2218 SwizzleFloat4<0x7E> zwwy;
2219 SwizzleFloat4<0x7F> wwwy;
2220 SwizzleFloat4<0x80> xxxz;
2221 SwizzleFloat4<0x81> yxxz;
2222 SwizzleFloat4<0x82> zxxz;
2223 SwizzleFloat4<0x83> wxxz;
2224 SwizzleFloat4<0x84> xyxz;
2225 SwizzleFloat4<0x85> yyxz;
2226 SwizzleFloat4<0x86> zyxz;
2227 SwizzleFloat4<0x87> wyxz;
2228 SwizzleFloat4<0x88> xzxz;
2229 SwizzleFloat4<0x89> yzxz;
2230 SwizzleFloat4<0x8A> zzxz;
2231 SwizzleFloat4<0x8B> wzxz;
2232 SwizzleFloat4<0x8C> xwxz;
2233 SwizzleFloat4<0x8D> ywxz;
2234 SwizzleFloat4<0x8E> zwxz;
2235 SwizzleFloat4<0x8F> wwxz;
2236 SwizzleFloat4<0x90> xxyz;
2237 SwizzleFloat4<0x91> yxyz;
2238 SwizzleFloat4<0x92> zxyz;
2239 SwizzleFloat4<0x93> wxyz;
2240 SwizzleFloat4<0x94> xyyz;
2241 SwizzleFloat4<0x95> yyyz;
2242 SwizzleFloat4<0x96> zyyz;
2243 SwizzleFloat4<0x97> wyyz;
2244 SwizzleFloat4<0x98> xzyz;
2245 SwizzleFloat4<0x99> yzyz;
2246 SwizzleFloat4<0x9A> zzyz;
2247 SwizzleFloat4<0x9B> wzyz;
2248 SwizzleFloat4<0x9C> xwyz;
2249 SwizzleFloat4<0x9D> ywyz;
2250 SwizzleFloat4<0x9E> zwyz;
2251 SwizzleFloat4<0x9F> wwyz;
2252 SwizzleFloat4<0xA0> xxzz;
2253 SwizzleFloat4<0xA1> yxzz;
2254 SwizzleFloat4<0xA2> zxzz;
2255 SwizzleFloat4<0xA3> wxzz;
2256 SwizzleFloat4<0xA4> xyzz;
2257 SwizzleFloat4<0xA5> yyzz;
2258 SwizzleFloat4<0xA6> zyzz;
2259 SwizzleFloat4<0xA7> wyzz;
2260 SwizzleFloat4<0xA8> xzzz;
2261 SwizzleFloat4<0xA9> yzzz;
2262 SwizzleFloat4<0xAA> zzzz;
2263 SwizzleFloat4<0xAB> wzzz;
2264 SwizzleFloat4<0xAC> xwzz;
2265 SwizzleFloat4<0xAD> ywzz;
2266 SwizzleFloat4<0xAE> zwzz;
2267 SwizzleFloat4<0xAF> wwzz;
2268 SwizzleFloat4<0xB0> xxwz;
2269 SwizzleFloat4<0xB1> yxwz;
2270 SwizzleFloat4<0xB2> zxwz;
2271 SwizzleFloat4<0xB3> wxwz;
2272 SwizzleFloat4<0xB4> xywz;
2273 SwizzleFloat4<0xB5> yywz;
2274 SwizzleFloat4<0xB6> zywz;
2275 SwizzleFloat4<0xB7> wywz;
2276 SwizzleFloat4<0xB8> xzwz;
2277 SwizzleFloat4<0xB9> yzwz;
2278 SwizzleFloat4<0xBA> zzwz;
2279 SwizzleFloat4<0xBB> wzwz;
2280 SwizzleFloat4<0xBC> xwwz;
2281 SwizzleFloat4<0xBD> ywwz;
2282 SwizzleFloat4<0xBE> zwwz;
2283 SwizzleFloat4<0xBF> wwwz;
2284 SwizzleFloat4<0xC0> xxxw;
2285 SwizzleFloat4<0xC1> yxxw;
2286 SwizzleFloat4<0xC2> zxxw;
2287 SwizzleFloat4<0xC3> wxxw;
2288 SwizzleFloat4<0xC4> xyxw;
2289 SwizzleFloat4<0xC5> yyxw;
2290 SwizzleFloat4<0xC6> zyxw;
2291 SwizzleFloat4<0xC7> wyxw;
2292 SwizzleFloat4<0xC8> xzxw;
2293 SwizzleFloat4<0xC9> yzxw;
2294 SwizzleFloat4<0xCA> zzxw;
2295 SwizzleFloat4<0xCB> wzxw;
2296 SwizzleFloat4<0xCC> xwxw;
2297 SwizzleFloat4<0xCD> ywxw;
2298 SwizzleFloat4<0xCE> zwxw;
2299 SwizzleFloat4<0xCF> wwxw;
2300 SwizzleFloat4<0xD0> xxyw;
2301 SwizzleFloat4<0xD1> yxyw;
2302 SwizzleFloat4<0xD2> zxyw;
2303 SwizzleFloat4<0xD3> wxyw;
2304 SwizzleFloat4<0xD4> xyyw;
2305 SwizzleFloat4<0xD5> yyyw;
2306 SwizzleFloat4<0xD6> zyyw;
2307 SwizzleFloat4<0xD7> wyyw;
2308 SwizzleFloat4<0xD8> xzyw;
2309 SwizzleFloat4<0xD9> yzyw;
2310 SwizzleFloat4<0xDA> zzyw;
2311 SwizzleFloat4<0xDB> wzyw;
2312 SwizzleFloat4<0xDC> xwyw;
2313 SwizzleFloat4<0xDD> ywyw;
2314 SwizzleFloat4<0xDE> zwyw;
2315 SwizzleFloat4<0xDF> wwyw;
2316 SwizzleFloat4<0xE0> xxzw;
2317 SwizzleFloat4<0xE1> yxzw;
2318 SwizzleFloat4<0xE2> zxzw;
2319 SwizzleFloat4<0xE3> wxzw;
2320 SwizzleMaskFloat4<0xE4> xyzw;
2321 SwizzleFloat4<0xE5> yyzw;
2322 SwizzleFloat4<0xE6> zyzw;
2323 SwizzleFloat4<0xE7> wyzw;
2324 SwizzleFloat4<0xE8> xzzw;
2325 SwizzleFloat4<0xE9> yzzw;
2326 SwizzleFloat4<0xEA> zzzw;
2327 SwizzleFloat4<0xEB> wzzw;
2328 SwizzleFloat4<0xEC> xwzw;
2329 SwizzleFloat4<0xED> ywzw;
2330 SwizzleFloat4<0xEE> zwzw;
2331 SwizzleFloat4<0xEF> wwzw;
2332 SwizzleFloat4<0xF0> xxww;
2333 SwizzleFloat4<0xF1> yxww;
2334 SwizzleFloat4<0xF2> zxww;
2335 SwizzleFloat4<0xF3> wxww;
2336 SwizzleFloat4<0xF4> xyww;
2337 SwizzleFloat4<0xF5> yyww;
2338 SwizzleFloat4<0xF6> zyww;
2339 SwizzleFloat4<0xF7> wyww;
2340 SwizzleFloat4<0xF8> xzww;
2341 SwizzleFloat4<0xF9> yzww;
2342 SwizzleFloat4<0xFA> zzww;
2343 SwizzleFloat4<0xFB> wzww;
2344 SwizzleFloat4<0xFC> xwww;
2345 SwizzleFloat4<0xFD> ywww;
2346 SwizzleFloat4<0xFE> zwww;
2347 SwizzleFloat4<0xFF> wwww;
2348 };
2349
2350 private:
2351 void constant(float x, float y, float z, float w);
2352 };
2353
Nicolas Capens08e90f02014-11-21 12:49:12 -05002354 RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs);
2355 RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs);
2356 RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs);
2357 RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs);
2358 RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs);
2359 RValue<Float4> operator+=(const Float4 &lhs, RValue<Float4> rhs);
2360 RValue<Float4> operator-=(const Float4 &lhs, RValue<Float4> rhs);
2361 RValue<Float4> operator*=(const Float4 &lhs, RValue<Float4> rhs);
2362 RValue<Float4> operator/=(const Float4 &lhs, RValue<Float4> rhs);
2363 RValue<Float4> operator%=(const Float4 &lhs, RValue<Float4> rhs);
2364 RValue<Float4> operator+(RValue<Float4> val);
2365 RValue<Float4> operator-(RValue<Float4> val);
2366
2367 RValue<Float4> Abs(RValue<Float4> x);
2368 RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y);
2369 RValue<Float4> Min(RValue<Float4> x, RValue<Float4> y);
2370 RValue<Float4> Rcp_pp(RValue<Float4> val);
2371 RValue<Float4> RcpSqrt_pp(RValue<Float4> val);
2372 RValue<Float4> Sqrt(RValue<Float4> x);
2373 RValue<Float4> Insert(const Float4 &val, RValue<Float> element, int i);
2374 RValue<Float> Extract(RValue<Float4> x, int i);
2375 RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select);
2376 RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm);
2377 RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y);
2378 RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y);
2379 RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select);
2380 RValue<Int> SignMask(RValue<Float4> x);
2381 RValue<Int4> CmpEQ(RValue<Float4> x, RValue<Float4> y);
2382 RValue<Int4> CmpLT(RValue<Float4> x, RValue<Float4> y);
2383 RValue<Int4> CmpLE(RValue<Float4> x, RValue<Float4> y);
2384 RValue<Int4> CmpNEQ(RValue<Float4> x, RValue<Float4> y);
2385 RValue<Int4> CmpNLT(RValue<Float4> x, RValue<Float4> y);
2386 RValue<Int4> CmpNLE(RValue<Float4> x, RValue<Float4> y);
2387 RValue<Float4> Round(RValue<Float4> x);
2388 RValue<Float4> Trunc(RValue<Float4> x);
2389 RValue<Float4> Frac(RValue<Float4> x);
2390 RValue<Float4> Floor(RValue<Float4> x);
2391 RValue<Float4> Ceil(RValue<Float4> x);
2392
John Bauman89401822014-05-06 15:04:28 -04002393 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002394 class Pointer : public Variable<Pointer<T> >
John Bauman89401822014-05-06 15:04:28 -04002395 {
2396 public:
2397 template<class S>
John Bauman66b8ab22014-05-06 15:57:45 -04002398 Pointer(RValue<Pointer<S> > pointerS, int alignment = 1) : alignment(alignment)
John Bauman89401822014-05-06 15:04:28 -04002399 {
John Bauman89401822014-05-06 15:04:28 -04002400 llvm::Value *pointerT = Nucleus::createBitCast(pointerS.value, Nucleus::getPointerType(T::getType()));
John Bauman66b8ab22014-05-06 15:57:45 -04002401 LValue::storeValue(pointerT);
John Bauman89401822014-05-06 15:04:28 -04002402 }
2403
2404 template<class S>
2405 Pointer(const Pointer<S> &pointer, int alignment = 1) : alignment(alignment)
2406 {
John Bauman66b8ab22014-05-06 15:57:45 -04002407 llvm::Value *pointerS = pointer.loadValue(alignment);
John Bauman89401822014-05-06 15:04:28 -04002408 llvm::Value *pointerT = Nucleus::createBitCast(pointerS, Nucleus::getPointerType(T::getType()));
John Bauman66b8ab22014-05-06 15:57:45 -04002409 LValue::storeValue(pointerT);
John Bauman89401822014-05-06 15:04:28 -04002410 }
2411
John Bauman89401822014-05-06 15:04:28 -04002412 explicit Pointer(llvm::Argument *argument);
2413 explicit Pointer(const void *external);
2414
2415 Pointer();
John Bauman66b8ab22014-05-06 15:57:45 -04002416 Pointer(RValue<Pointer<T> > rhs);
John Bauman89401822014-05-06 15:04:28 -04002417 Pointer(const Pointer<T> &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04002418 Pointer(const Reference<Pointer<T> > &rhs);
John Bauman89401822014-05-06 15:04:28 -04002419
John Bauman66b8ab22014-05-06 15:57:45 -04002420 RValue<Pointer<T> > operator=(RValue<Pointer<T> > rhs) const;
2421 RValue<Pointer<T> > operator=(const Pointer<T> &rhs) const;
2422 RValue<Pointer<T> > operator=(const Reference<Pointer<T> > &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04002423
2424 Reference<T> operator*();
2425
John Bauman19bac1e2014-05-06 15:23:49 -04002426 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04002427
2428 private:
2429 const int alignment;
2430 };
2431
Nicolas Capens08e90f02014-11-21 12:49:12 -05002432 RValue<Pointer<Byte> > operator+(RValue<Pointer<Byte> > lhs, int offset);
2433 RValue<Pointer<Byte> > operator+(RValue<Pointer<Byte> > lhs, RValue<Int> offset);
2434 RValue<Pointer<Byte> > operator+(RValue<Pointer<Byte> > lhs, RValue<UInt> offset);
2435 RValue<Pointer<Byte> > operator+=(const Pointer<Byte> &lhs, int offset);
2436 RValue<Pointer<Byte> > operator+=(const Pointer<Byte> &lhs, RValue<Int> offset);
2437 RValue<Pointer<Byte> > operator+=(const Pointer<Byte> &lhs, RValue<UInt> offset);
2438
2439 RValue<Pointer<Byte> > operator-(RValue<Pointer<Byte> > lhs, int offset);
2440 RValue<Pointer<Byte> > operator-(RValue<Pointer<Byte> > lhs, RValue<Int> offset);
2441 RValue<Pointer<Byte> > operator-(RValue<Pointer<Byte> > lhs, RValue<UInt> offset);
2442 RValue<Pointer<Byte> > operator-=(const Pointer<Byte> &lhs, int offset);
2443 RValue<Pointer<Byte> > operator-=(const Pointer<Byte> &lhs, RValue<Int> offset);
2444 RValue<Pointer<Byte> > operator-=(const Pointer<Byte> &lhs, RValue<UInt> offset);
2445
John Bauman19bac1e2014-05-06 15:23:49 -04002446 template<class T, int S = 1>
John Bauman66b8ab22014-05-06 15:57:45 -04002447 class Array : public Variable<T>
John Bauman89401822014-05-06 15:04:28 -04002448 {
2449 public:
John Bauman19bac1e2014-05-06 15:23:49 -04002450 Array(int size = S);
John Bauman89401822014-05-06 15:04:28 -04002451
2452 Reference<T> operator[](int index);
2453 Reference<T> operator[](RValue<Int> index);
2454 Reference<T> operator[](RValue<UInt> index);
John Bauman89401822014-05-06 15:04:28 -04002455 };
2456
Nicolas Capens08e90f02014-11-21 12:49:12 -05002457// RValue<Array<T> > operator++(const Array<T> &val, int); // Post-increment
2458// const Array<T> &operator++(const Array<T> &val); // Pre-increment
2459// RValue<Array<T> > operator--(const Array<T> &val, int); // Post-decrement
2460// const Array<T> &operator--(const Array<T> &val); // Pre-decrement
2461
John Bauman89401822014-05-06 15:04:28 -04002462 llvm::BasicBlock *beginLoop();
John Bauman19bac1e2014-05-06 15:23:49 -04002463 bool branch(RValue<Bool> cmp, llvm::BasicBlock *bodyBB, llvm::BasicBlock *endBB);
John Bauman89401822014-05-06 15:04:28 -04002464 bool elseBlock(llvm::BasicBlock *falseBB);
2465
2466 void Return();
John Bauman19bac1e2014-05-06 15:23:49 -04002467 void Return(bool ret);
John Bauman89401822014-05-06 15:04:28 -04002468 void Return(const Int &ret);
2469
2470 template<class T>
2471 void Return(const Pointer<T> &ret);
2472
2473 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002474 void Return(RValue<Pointer<T> > ret);
John Bauman89401822014-05-06 15:04:28 -04002475
2476 template<class R = Void, class A1 = Void, class A2 = Void, class A3 = Void, class A4 = Void>
2477 class Function
2478 {
2479 public:
2480 Function();
2481
2482 virtual ~Function();
2483
2484 llvm::Argument *arg(int index);
2485
2486 Routine *operator()(const wchar_t *name, ...);
2487
2488 private:
2489 Nucleus *core;
2490 llvm::Function *function;
John Bauman19bac1e2014-05-06 15:23:49 -04002491 std::vector<llvm::Type*> arguments;
John Bauman89401822014-05-06 15:04:28 -04002492 };
2493
2494 RValue<Long> Ticks();
John Bauman89401822014-05-06 15:04:28 -04002495}
2496
2497namespace sw
2498{
2499 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002500 Variable<T>::Variable(int arraySize) : LValue(T::getType(), arraySize)
2501 {
2502 }
2503
2504 template<class T>
2505 RValue<Pointer<T> > Variable<T>::operator&()
2506 {
2507 return RValue<Pointer<T> >(LValue::address);
2508 }
2509
2510 template<class T>
John Bauman89401822014-05-06 15:04:28 -04002511 Reference<T>::Reference(llvm::Value *pointer, int alignment) : alignment(alignment)
2512 {
2513 address = pointer;
2514 }
2515
2516 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002517 RValue<T> Reference<T>::operator=(RValue<T> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002518 {
2519 Nucleus::createStore(rhs.value, address, false, alignment);
2520
2521 return rhs;
2522 }
2523
2524 template<class T>
John Bauman89401822014-05-06 15:04:28 -04002525 RValue<T> Reference<T>::operator=(const Reference<T> &ref) const
2526 {
2527 llvm::Value *tmp = Nucleus::createLoad(ref.address, false, ref.alignment);
2528 Nucleus::createStore(tmp, address, false, alignment);
2529
2530 return RValue<T>(tmp);
2531 }
2532
2533 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002534 RValue<T> Reference<T>::operator+=(RValue<T> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002535 {
2536 return *this = *this + rhs;
2537 }
2538
2539 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002540 llvm::Value *Reference<T>::loadValue() const
2541 {
2542 return Nucleus::createLoad(address, false, alignment);
2543 }
2544
2545 template<class T>
2546 int Reference<T>::getAlignment() const
2547 {
2548 return alignment;
2549 }
2550
2551 template<class T>
John Bauman89401822014-05-06 15:04:28 -04002552 RValue<T>::RValue(llvm::Value *rvalue)
2553 {
2554 value = rvalue;
2555 }
2556
2557 template<class T>
2558 RValue<T>::RValue(const T &lvalue)
2559 {
John Bauman66b8ab22014-05-06 15:57:45 -04002560 value = lvalue.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002561 }
2562
2563 template<class T>
2564 RValue<T>::RValue(typename IntLiteral<T>::type i)
2565 {
2566 value = (llvm::Value*)Nucleus::createConstantInt(i);
2567 }
2568
John Bauman66b8ab22014-05-06 15:57:45 -04002569 template<class T>
2570 RValue<T>::RValue(typename FloatLiteral<T>::type f)
2571 {
2572 value = (llvm::Value*)Nucleus::createConstantFloat(f);
2573 }
2574
2575 template<class T>
2576 RValue<T>::RValue(const Reference<T> &ref)
2577 {
2578 value = ref.loadValue();
2579 }
2580
John Bauman89401822014-05-06 15:04:28 -04002581 template<int T>
2582 Swizzle2Float4<T>::operator RValue<Float4>() const
2583 {
John Bauman66b8ab22014-05-06 15:57:45 -04002584 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002585
2586 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2587 }
2588
2589 template<int T>
2590 SwizzleFloat4<T>::operator RValue<Float4>() const
2591 {
John Bauman66b8ab22014-05-06 15:57:45 -04002592 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002593
2594 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2595 }
2596
2597 template<int T>
2598 SwizzleMaskFloat4<T>::operator RValue<Float4>() const
2599 {
John Bauman66b8ab22014-05-06 15:57:45 -04002600 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002601
2602 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2603 }
2604
2605 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002606 RValue<Float4> SwizzleMaskFloat4<T>::operator=(RValue<Float4> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002607 {
2608 return Mask(*parent, rhs, T);
2609 }
2610
2611 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002612 RValue<Float4> SwizzleMaskFloat4<T>::operator=(RValue<Float> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002613 {
2614 return Mask(*parent, Float4(rhs), T);
2615 }
2616
2617 template<int T>
2618 SwizzleMask1Float4<T>::operator RValue<Float>() const // FIXME: Call a non-template function
2619 {
2620 return Extract(*parent, T & 0x3);
2621 }
2622
2623 template<int T>
2624 SwizzleMask1Float4<T>::operator RValue<Float4>() const
2625 {
John Bauman66b8ab22014-05-06 15:57:45 -04002626 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002627
2628 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2629 }
2630
2631 template<int T>
2632 RValue<Float4> SwizzleMask1Float4<T>::operator=(float x) const
2633 {
2634 return Insert(*parent, Float(x), T & 0x3);
2635 }
2636
2637 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002638 RValue<Float4> SwizzleMask1Float4<T>::operator=(RValue<Float4> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002639 {
2640 return Mask(*parent, Float4(rhs), T);
2641 }
2642
2643 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002644 RValue<Float4> SwizzleMask1Float4<T>::operator=(RValue<Float> rhs) const // FIXME: Call a non-template function
John Bauman89401822014-05-06 15:04:28 -04002645 {
2646 return Insert(*parent, rhs, T & 0x3);
2647 }
2648
2649 template<int T>
2650 SwizzleMask2Float4<T>::operator RValue<Float4>() const
2651 {
John Bauman66b8ab22014-05-06 15:57:45 -04002652 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002653
2654 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2655 }
2656
2657 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002658 RValue<Float4> SwizzleMask2Float4<T>::operator=(RValue<Float4> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002659 {
2660 return Mask(*parent, Float4(rhs), T);
2661 }
2662
2663 template<int T>
John Bauman66b8ab22014-05-06 15:57:45 -04002664 Float::Float(const SwizzleMask1Float4<T> &rhs)
2665 {
2666 *this = rhs.operator RValue<Float>();
2667 }
2668
2669 template<int T>
2670 RValue<Float> Float::operator=(const SwizzleMask1Float4<T> &rhs) const
2671 {
2672 return *this = rhs.operator RValue<Float>();
2673 }
2674
2675 template<int T>
2676 Float4::Float4(const SwizzleMask1Float4<T> &rhs)
John Bauman89401822014-05-06 15:04:28 -04002677 {
2678 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002679
John Bauman66b8ab22014-05-06 15:57:45 -04002680 *this = rhs.operator RValue<Float4>();
2681 }
2682
2683 template<int T>
2684 Float4::Float4(const SwizzleFloat4<T> &rhs)
2685 {
2686 xyzw.parent = this;
2687
2688 *this = rhs.operator RValue<Float4>();
John Bauman89401822014-05-06 15:04:28 -04002689 }
2690
2691 template<int X, int Y>
2692 Float4::Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y)
2693 {
2694 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002695
2696 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2697 }
2698
2699 template<int X, int Y>
2700 Float4::Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y)
2701 {
2702 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002703
2704 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2705 }
2706
2707 template<int X, int Y>
2708 Float4::Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y)
2709 {
2710 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002711
2712 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2713 }
2714
2715 template<int X, int Y>
2716 Float4::Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y)
2717 {
2718 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002719
2720 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2721 }
2722
2723 template<int T>
John Bauman66b8ab22014-05-06 15:57:45 -04002724 RValue<Float4> Float4::operator=(const SwizzleMask1Float4<T> &rhs)
John Bauman89401822014-05-06 15:04:28 -04002725 {
John Bauman66b8ab22014-05-06 15:57:45 -04002726 return *this = rhs.operator RValue<Float4>();
John Bauman89401822014-05-06 15:04:28 -04002727 }
2728
John Bauman66b8ab22014-05-06 15:57:45 -04002729 template<int T>
2730 RValue<Float4> Float4::operator=(const SwizzleFloat4<T> &rhs)
John Bauman89401822014-05-06 15:04:28 -04002731 {
John Bauman66b8ab22014-05-06 15:57:45 -04002732 return *this = rhs.operator RValue<Float4>();
John Bauman89401822014-05-06 15:04:28 -04002733 }
2734
2735 template<class T>
2736 Pointer<T>::Pointer(llvm::Argument *argument) : alignment(1)
2737 {
John Bauman66b8ab22014-05-06 15:57:45 -04002738 LValue::storeValue((llvm::Value*)argument);
John Bauman89401822014-05-06 15:04:28 -04002739 }
2740
2741 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002742 Pointer<T>::Pointer(const void *external) : alignment((intptr_t)external & 0x0000000F ? 1 : 16)
John Bauman89401822014-05-06 15:04:28 -04002743 {
John Bauman89401822014-05-06 15:04:28 -04002744 const llvm::GlobalValue *globalPointer = Nucleus::getGlobalValueAtAddress(const_cast<void*>(external)); // FIXME: Const
2745
2746 if(!globalPointer)
2747 {
2748 globalPointer = Nucleus::createGlobalValue(T::getType(), false, alignment);
2749
2750 Nucleus::addGlobalMapping(globalPointer, const_cast<void*>(external)); // FIXME: Const
2751 }
2752
John Bauman66b8ab22014-05-06 15:57:45 -04002753 LValue::storeValue((llvm::Value*)globalPointer); // FIXME: Const
John Bauman89401822014-05-06 15:04:28 -04002754 }
2755
2756 template<class T>
2757 Pointer<T>::Pointer() : alignment(1)
2758 {
John Bauman66b8ab22014-05-06 15:57:45 -04002759 LValue::storeValue(Nucleus::createNullPointer(T::getType()));
John Bauman89401822014-05-06 15:04:28 -04002760 }
2761
2762 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002763 Pointer<T>::Pointer(RValue<Pointer<T> > rhs) : alignment(1)
John Bauman89401822014-05-06 15:04:28 -04002764 {
John Bauman66b8ab22014-05-06 15:57:45 -04002765 LValue::storeValue(rhs.value);
John Bauman89401822014-05-06 15:04:28 -04002766 }
2767
2768 template<class T>
2769 Pointer<T>::Pointer(const Pointer<T> &rhs) : alignment(rhs.alignment)
2770 {
John Bauman66b8ab22014-05-06 15:57:45 -04002771 llvm::Value *value = rhs.loadValue();
2772 LValue::storeValue(value);
John Bauman89401822014-05-06 15:04:28 -04002773 }
2774
2775 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002776 Pointer<T>::Pointer(const Reference<Pointer<T> > &rhs) : alignment(rhs.getAlignment())
John Bauman89401822014-05-06 15:04:28 -04002777 {
John Bauman66b8ab22014-05-06 15:57:45 -04002778 llvm::Value *value = rhs.loadValue();
2779 LValue::storeValue(value);
2780 }
2781
2782 template<class T>
2783 RValue<Pointer<T> > Pointer<T>::operator=(RValue<Pointer<T> > rhs) const
2784 {
2785 LValue::storeValue(rhs.value);
John Bauman89401822014-05-06 15:04:28 -04002786
2787 return rhs;
2788 }
2789
2790 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002791 RValue<Pointer<T> > Pointer<T>::operator=(const Pointer<T> &rhs) const
John Bauman89401822014-05-06 15:04:28 -04002792 {
John Bauman66b8ab22014-05-06 15:57:45 -04002793 llvm::Value *value = rhs.loadValue();
2794 LValue::storeValue(value);
John Bauman89401822014-05-06 15:04:28 -04002795
John Bauman66b8ab22014-05-06 15:57:45 -04002796 return RValue<Pointer<T> >(value);
2797 }
2798
2799 template<class T>
2800 RValue<Pointer<T> > Pointer<T>::operator=(const Reference<Pointer<T> > &rhs) const
2801 {
2802 llvm::Value *value = rhs.loadValue();
2803 LValue::storeValue(value);
2804
2805 return RValue<Pointer<T> >(value);
John Bauman89401822014-05-06 15:04:28 -04002806 }
2807
2808 template<class T>
2809 Reference<T> Pointer<T>::operator*()
2810 {
John Bauman66b8ab22014-05-06 15:57:45 -04002811 return Reference<T>(LValue::loadValue(), alignment);
John Bauman89401822014-05-06 15:04:28 -04002812 }
2813
2814 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002815 llvm::Type *Pointer<T>::getType()
John Bauman89401822014-05-06 15:04:28 -04002816 {
2817 return Nucleus::getPointerType(T::getType());
2818 }
2819
John Bauman19bac1e2014-05-06 15:23:49 -04002820 template<class T, int S>
John Bauman66b8ab22014-05-06 15:57:45 -04002821 Array<T, S>::Array(int size) : Variable<T>(size)
John Bauman89401822014-05-06 15:04:28 -04002822 {
John Bauman89401822014-05-06 15:04:28 -04002823 }
2824
John Bauman19bac1e2014-05-06 15:23:49 -04002825 template<class T, int S>
2826 Reference<T> Array<T, S>::operator[](int index)
John Bauman89401822014-05-06 15:04:28 -04002827 {
John Bauman66b8ab22014-05-06 15:57:45 -04002828 llvm::Value *element = LValue::getAddress((llvm::Value*)Nucleus::createConstantInt(index));
2829
John Bauman89401822014-05-06 15:04:28 -04002830 return Reference<T>(element);
2831 }
2832
John Bauman19bac1e2014-05-06 15:23:49 -04002833 template<class T, int S>
2834 Reference<T> Array<T, S>::operator[](RValue<Int> index)
John Bauman89401822014-05-06 15:04:28 -04002835 {
John Bauman66b8ab22014-05-06 15:57:45 -04002836 llvm::Value *element = LValue::getAddress(index.value);
2837
John Bauman89401822014-05-06 15:04:28 -04002838 return Reference<T>(element);
2839 }
2840
John Bauman19bac1e2014-05-06 15:23:49 -04002841 template<class T, int S>
2842 Reference<T> Array<T, S>::operator[](RValue<UInt> index)
John Bauman89401822014-05-06 15:04:28 -04002843 {
John Bauman66b8ab22014-05-06 15:57:45 -04002844 llvm::Value *element = LValue::getAddress(index.value);
2845
John Bauman89401822014-05-06 15:04:28 -04002846 return Reference<T>(element);
2847 }
2848
2849// template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002850// RValue<Array<T> > operator++(const Array<T> &val, int)
John Bauman89401822014-05-06 15:04:28 -04002851// {
2852// // FIXME: Requires storing the address of the array
2853// }
John Bauman66b8ab22014-05-06 15:57:45 -04002854
John Bauman89401822014-05-06 15:04:28 -04002855// template<class T>
2856// const Array<T> &operator++(const Array<T> &val)
2857// {
2858// // FIXME: Requires storing the address of the array
2859// }
2860
2861// template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002862// RValue<Array<T> > operator--(const Array<T> &val, int)
John Bauman89401822014-05-06 15:04:28 -04002863// {
2864// // FIXME: Requires storing the address of the array
2865// }
2866
2867// template<class T>
2868// const Array<T> &operator--(const Array<T> &val)
2869// {
2870// // FIXME: Requires storing the address of the array
2871// }
2872
2873 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002874 RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, RValue<T> ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002875 {
2876 return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, ifFalse.value));
2877 }
2878
2879 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002880 RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, RValue<T> ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002881 {
John Bauman66b8ab22014-05-06 15:57:45 -04002882 llvm::Value *trueValue = ifTrue.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002883
2884 return RValue<T>(Nucleus::createSelect(condition.value, trueValue, ifFalse.value));
2885 }
2886
2887 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002888 RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, const T &ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002889 {
John Bauman66b8ab22014-05-06 15:57:45 -04002890 llvm::Value *falseValue = ifFalse.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002891
2892 return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, falseValue));
2893 }
2894
2895 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002896 RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, const T &ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002897 {
John Bauman66b8ab22014-05-06 15:57:45 -04002898 llvm::Value *trueValue = ifTrue.loadValue();
2899 llvm::Value *falseValue = ifFalse.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002900
2901 return RValue<T>(Nucleus::createSelect(condition.value, trueValue, falseValue));
2902 }
2903
2904 template<class T>
2905 void Return(const Pointer<T> &ret)
2906 {
2907 Nucleus::createRet(Nucleus::createLoad(ret.address));
John Bauman19bac1e2014-05-06 15:23:49 -04002908 Nucleus::setInsertBlock(Nucleus::createBasicBlock());
John Bauman89401822014-05-06 15:04:28 -04002909 }
2910
2911 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002912 void Return(RValue<Pointer<T> > ret)
John Bauman89401822014-05-06 15:04:28 -04002913 {
2914 Nucleus::createRet(ret.value);
John Bauman19bac1e2014-05-06 15:23:49 -04002915 Nucleus::setInsertBlock(Nucleus::createBasicBlock());
John Bauman89401822014-05-06 15:04:28 -04002916 }
2917
2918 template<class R, class A1, class A2, class A3, class A4>
2919 Function<R, A1, A2, A3, A4>::Function()
2920 {
2921 core = new Nucleus();
2922
2923 if(!A1::isVoid()) arguments.push_back(A1::getType());
2924 if(!A2::isVoid()) arguments.push_back(A2::getType());
2925 if(!A3::isVoid()) arguments.push_back(A3::getType());
2926 if(!A4::isVoid()) arguments.push_back(A4::getType());
2927
2928 function = Nucleus::createFunction(R::getType(), arguments);
John Bauman66b8ab22014-05-06 15:57:45 -04002929 Nucleus::setFunction(function);
John Bauman89401822014-05-06 15:04:28 -04002930 }
2931
2932 template<class R, class A1, class A2, class A3, class A4>
2933 Function<R, A1, A2, A3, A4>::~Function()
2934 {
2935 delete core;
2936 }
2937
2938 template<class R, class A1, class A2, class A3, class A4>
2939 llvm::Argument *Function<R, A1, A2, A3, A4>::arg(int index)
2940 {
2941 return Nucleus::getArgument(function, index);
2942 }
2943
2944 template<class R, class A1, class A2, class A3, class A4>
2945 Routine *Function<R, A1, A2, A3, A4>::operator()(const wchar_t *name, ...)
2946 {
2947 wchar_t fullName[1024 + 1];
2948
2949 va_list vararg;
2950 va_start(vararg, name);
2951 vswprintf(fullName, 1024, name, vararg);
2952 va_end(vararg);
2953
2954 return core->acquireRoutine(fullName, true);
2955 }
2956
2957 template<class T, class S>
John Bauman19bac1e2014-05-06 15:23:49 -04002958 RValue<T> ReinterpretCast(RValue<S> val)
John Bauman89401822014-05-06 15:04:28 -04002959 {
2960 return RValue<T>(Nucleus::createBitCast(val.value, T::getType()));
2961 }
2962
John Bauman66b8ab22014-05-06 15:57:45 -04002963 template<class T>
2964 RValue<T> ReinterpretCast(const LValue &var)
John Bauman89401822014-05-06 15:04:28 -04002965 {
John Bauman66b8ab22014-05-06 15:57:45 -04002966 llvm::Value *val = var.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002967
2968 return RValue<T>(Nucleus::createBitCast(val, T::getType()));
2969 }
2970
2971 template<class T, class S>
2972 RValue<T> ReinterpretCast(const Reference<S> &var)
2973 {
2974 return ReinterpretCast<T>(RValue<S>(var));
2975 }
2976
2977 template<class T, class S>
John Bauman19bac1e2014-05-06 15:23:49 -04002978 RValue<T> As(RValue<S> val)
John Bauman89401822014-05-06 15:04:28 -04002979 {
2980 return ReinterpretCast<T>(val);
2981 }
2982
John Bauman66b8ab22014-05-06 15:57:45 -04002983 template<class T>
2984 RValue<T> As(const LValue &var)
John Bauman89401822014-05-06 15:04:28 -04002985 {
2986 return ReinterpretCast<T>(var);
2987 }
2988
2989 template<class T, class S>
2990 RValue<T> As(const Reference<S> &val)
2991 {
2992 return ReinterpretCast<T>(val);
2993 }
2994}
2995
2996#endif // sw_Nucleus_hpp