blob: da2e0a37d3d5c6bcbcb23c3119a44c254b81982f [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"
16
17#include <stdarg.h>
18#include <vector>
John Bauman66b8ab22014-05-06 15:57:45 -040019#include <stdio.h>
20#include <wchar.h>
John Bauman89401822014-05-06 15:04:28 -040021
22#undef abs
23#undef max
24#undef min
John Bauman66b8ab22014-05-06 15:57:45 -040025#undef Bool
John Bauman89401822014-05-06 15:04:28 -040026
27namespace llvm
28{
29 class Function;
30 class Module;
31 class BasicBlock;
32 class Value;
33 class Constant;
34 class ConstantInt;
35 class ConstantFP;
36 class Type;
37 class Argument;
38 class GlobalVariable;
39 class GlobalValue;
40 class ExecutionEngine;
41 class LLVMContext;
42}
43
44namespace sw
45{
46 enum Optimization
47 {
John Bauman19bac1e2014-05-06 15:23:49 -040048 Disabled = 0,
49 InstructionCombining = 1,
50 CFGSimplification = 2,
51 LICM = 3,
52 AggressiveDCE = 4,
53 GVN = 5,
54 Reassociate = 6,
55 DeadStoreElimination = 7,
56 SCCP = 8,
57 ScalarReplAggregates = 9,
John Bauman89401822014-05-06 15:04:28 -040058
59 OptimizationCount
60 };
61
62 extern Optimization optimization[10];
63
Nicolas Capensd946e0a2014-06-26 11:31:08 -040064 class Routine;
Nicolas Capens2fb41102014-06-26 10:11:50 -040065 class RoutineManager;
John Bauman89401822014-05-06 15:04:28 -040066 class Builder;
John Bauman89401822014-05-06 15:04:28 -040067
68 class Nucleus
69 {
70 public:
71 Nucleus();
72
73 virtual ~Nucleus();
74
75 Routine *acquireRoutine(const wchar_t *name, bool runOptimizations = true);
76
77 static void setFunction(llvm::Function *function);
78
79 static llvm::Module *getModule();
John Bauman89401822014-05-06 15:04:28 -040080 static llvm::Function *getFunction();
81 static llvm::LLVMContext *getContext();
82
John Bauman19bac1e2014-05-06 15:23:49 -040083 static llvm::Value *allocateStackVariable(llvm::Type *type, int arraySize = 0);
John Bauman89401822014-05-06 15:04:28 -040084 static llvm::BasicBlock *createBasicBlock();
85 static llvm::BasicBlock *getInsertBlock();
86 static void setInsertBlock(llvm::BasicBlock *basicBlock);
87 static llvm::BasicBlock *getPredecessor(llvm::BasicBlock *basicBlock);
88
John Bauman19bac1e2014-05-06 15:23:49 -040089 static llvm::Function *createFunction(llvm::Type *ReturnType, std::vector<llvm::Type*> &Params);
John Bauman89401822014-05-06 15:04:28 -040090 static llvm::Argument *getArgument(llvm::Function *function, unsigned int index);
91
92 // Terminators
93 static llvm::Value *createRetVoid();
94 static llvm::Value *createRet(llvm::Value *V);
95 static llvm::Value *createBr(llvm::BasicBlock *dest);
96 static llvm::Value *createCondBr(llvm::Value *cond, llvm::BasicBlock *ifTrue, llvm::BasicBlock *ifFalse);
John Bauman66b8ab22014-05-06 15:57:45 -040097
John Bauman89401822014-05-06 15:04:28 -040098 // Binary operators
99 static llvm::Value *createAdd(llvm::Value *lhs, llvm::Value *rhs);
100 static llvm::Value *createSub(llvm::Value *lhs, llvm::Value *rhs);
101 static llvm::Value *createMul(llvm::Value *lhs, llvm::Value *rhs);
102 static llvm::Value *createUDiv(llvm::Value *lhs, llvm::Value *rhs);
103 static llvm::Value *createSDiv(llvm::Value *lhs, llvm::Value *rhs);
104 static llvm::Value *createFAdd(llvm::Value *lhs, llvm::Value *rhs);
105 static llvm::Value *createFSub(llvm::Value *lhs, llvm::Value *rhs);
106 static llvm::Value *createFMul(llvm::Value *lhs, llvm::Value *rhs);
107 static llvm::Value *createFDiv(llvm::Value *lhs, llvm::Value *rhs);
108 static llvm::Value *createURem(llvm::Value *lhs, llvm::Value *rhs);
109 static llvm::Value *createSRem(llvm::Value *lhs, llvm::Value *rhs);
110 static llvm::Value *createFRem(llvm::Value *lhs, llvm::Value *rhs);
111 static llvm::Value *createShl(llvm::Value *lhs, llvm::Value *rhs);
112 static llvm::Value *createLShr(llvm::Value *lhs, llvm::Value *rhs);
113 static llvm::Value *createAShr(llvm::Value *lhs, llvm::Value *rhs);
114 static llvm::Value *createAnd(llvm::Value *lhs, llvm::Value *rhs);
115 static llvm::Value *createOr(llvm::Value *lhs, llvm::Value *rhs);
116 static llvm::Value *createXor(llvm::Value *lhs, llvm::Value *rhs);
117 static llvm::Value *createNeg(llvm::Value *V);
118 static llvm::Value *createFNeg(llvm::Value *V);
119 static llvm::Value *createNot(llvm::Value *V);
John Bauman66b8ab22014-05-06 15:57:45 -0400120
John Bauman89401822014-05-06 15:04:28 -0400121 // Memory instructions
122 static llvm::Value *createLoad(llvm::Value *ptr, bool isVolatile = false, unsigned int align = 0);
123 static llvm::Value *createStore(llvm::Value *value, llvm::Value *ptr, bool isVolatile = false, unsigned int align = 0);
124 static llvm::Value *createGEP(llvm::Value *ptr, llvm::Value *index);
125
John Bauman19bac1e2014-05-06 15:23:49 -0400126 // Atomic instructions
127 static llvm::Value *createAtomicAdd(llvm::Value *ptr, llvm::Value *value);
128
John Bauman89401822014-05-06 15:04:28 -0400129 // Cast/Conversion Operators
John Bauman19bac1e2014-05-06 15:23:49 -0400130 static llvm::Value *createTrunc(llvm::Value *V, llvm::Type *destType);
131 static llvm::Value *createZExt(llvm::Value *V, llvm::Type *destType);
132 static llvm::Value *createSExt(llvm::Value *V, llvm::Type *destType);
133 static llvm::Value *createFPToUI(llvm::Value *V, llvm::Type *destType);
134 static llvm::Value *createFPToSI(llvm::Value *V, llvm::Type *destType);
135 static llvm::Value *createUIToFP(llvm::Value *V, llvm::Type *destType);
136 static llvm::Value *createSIToFP(llvm::Value *V, llvm::Type *destType);
137 static llvm::Value *createFPTrunc(llvm::Value *V, llvm::Type *destType);
138 static llvm::Value *createFPExt(llvm::Value *V, llvm::Type *destType);
139 static llvm::Value *createPtrToInt(llvm::Value *V, llvm::Type *destType);
140 static llvm::Value *createIntToPtr(llvm::Value *V, llvm::Type *destType);
141 static llvm::Value *createBitCast(llvm::Value *V, llvm::Type *destType);
142 static llvm::Value *createIntCast(llvm::Value *V, llvm::Type *destType, bool isSigned);
John Bauman89401822014-05-06 15:04:28 -0400143
144 // Compare instructions
145 static llvm::Value *createICmpEQ(llvm::Value *lhs, llvm::Value *rhs);
146 static llvm::Value *createICmpNE(llvm::Value *lhs, llvm::Value *rhs);
147 static llvm::Value *createICmpUGT(llvm::Value *lhs, llvm::Value *rhs);
148 static llvm::Value *createICmpUGE(llvm::Value *lhs, llvm::Value *rhs);
149 static llvm::Value *createICmpULT(llvm::Value *lhs, llvm::Value *rhs);
150 static llvm::Value *createICmpULE(llvm::Value *lhs, llvm::Value *rhs);
151 static llvm::Value *createICmpSGT(llvm::Value *lhs, llvm::Value *rhs);
152 static llvm::Value *createICmpSGE(llvm::Value *lhs, llvm::Value *rhs);
153 static llvm::Value *createICmpSLT(llvm::Value *lhs, llvm::Value *rhs);
154 static llvm::Value *createICmpSLE(llvm::Value *lhs, llvm::Value *rhs);
155 static llvm::Value *createFCmpOEQ(llvm::Value *lhs, llvm::Value *rhs);
156 static llvm::Value *createFCmpOGT(llvm::Value *lhs, llvm::Value *rhs);
157 static llvm::Value *createFCmpOGE(llvm::Value *lhs, llvm::Value *rhs);
158 static llvm::Value *createFCmpOLT(llvm::Value *lhs, llvm::Value *rhs);
159 static llvm::Value *createFCmpOLE(llvm::Value *lhs, llvm::Value *rhs);
160 static llvm::Value *createFCmpONE(llvm::Value *lhs, llvm::Value *rhs);
161 static llvm::Value *createFCmpORD(llvm::Value *lhs, llvm::Value *rhs);
162 static llvm::Value *createFCmpUNO(llvm::Value *lhs, llvm::Value *rhs);
163 static llvm::Value *createFCmpUEQ(llvm::Value *lhs, llvm::Value *rhs);
164 static llvm::Value *createFCmpUGT(llvm::Value *lhs, llvm::Value *rhs);
165 static llvm::Value *createFCmpUGE(llvm::Value *lhs, llvm::Value *rhs);
166 static llvm::Value *createFCmpULT(llvm::Value *lhs, llvm::Value *rhs);
167 static llvm::Value *createFCmpULE(llvm::Value *lhs, llvm::Value *rhs);
168 static llvm::Value *createFCmpUNE(llvm::Value *lhs, llvm::Value *rhs);
169
170 // Call instructions
171 static llvm::Value *createCall(llvm::Value *callee);
172 static llvm::Value *createCall(llvm::Value *callee, llvm::Value *Arg);
173 static llvm::Value *createCall(llvm::Value *callee, llvm::Value *Arg1, llvm::Value *Arg2);
174 static llvm::Value *createCall(llvm::Value *callee, llvm::Value *Arg1, llvm::Value *Arg2, llvm::Value *Arg3);
175 static llvm::Value *createCall(llvm::Value *callee, llvm::Value *Arg1, llvm::Value *Arg2, llvm::Value *Arg3,llvm::Value *Arg4);
176
177 // Vector instructions
178 static llvm::Value *createExtractElement(llvm::Value *vector, int index);
179 static llvm::Value *createInsertElement(llvm::Value *vector, llvm::Value *element, int index);
180 static llvm::Value *createShuffleVector(llvm::Value *V1, llvm::Value *V2, llvm::Value *mask);
181
182 // Other instructions
183 static llvm::Value *createSelect(llvm::Value *C, llvm::Value *ifTrue, llvm::Value *ifFalse);
John Bauman19bac1e2014-05-06 15:23:49 -0400184 static llvm::Value *createSwitch(llvm::Value *V, llvm::BasicBlock *Dest, unsigned NumCases);
John Bauman89401822014-05-06 15:04:28 -0400185 static void addSwitchCase(llvm::Value *Switch, int Case, llvm::BasicBlock *Branch);
186 static llvm::Value *createUnreachable();
187
188 // Derived instructions
189 static llvm::Value *createSwizzle(llvm::Value *val, unsigned char select);
190 static llvm::Value *createMask(llvm::Value *lhs, llvm::Value *rhs, unsigned char select);
191
192 // Global values
193 static const llvm::GlobalValue *getGlobalValueAtAddress(void *Addr);
194 static void addGlobalMapping(const llvm::GlobalValue *GV, void *Addr);
John Bauman19bac1e2014-05-06 15:23:49 -0400195 static llvm::GlobalValue *createGlobalValue(llvm::Type *Ty, bool isConstant, unsigned int Align);
196 static llvm::Type *getPointerType(llvm::Type *ElementType);
John Bauman89401822014-05-06 15:04:28 -0400197
198 // Constant values
John Bauman19bac1e2014-05-06 15:23:49 -0400199 static llvm::Constant *createNullValue(llvm::Type *Ty);
John Bauman66b8ab22014-05-06 15:57:45 -0400200 static llvm::ConstantInt *createConstantInt(int64_t i);
John Bauman89401822014-05-06 15:04:28 -0400201 static llvm::ConstantInt *createConstantInt(int i);
202 static llvm::ConstantInt *createConstantInt(unsigned int i);
203 static llvm::ConstantInt *createConstantBool(bool b);
204 static llvm::ConstantInt *createConstantByte(signed char i);
205 static llvm::ConstantInt *createConstantByte(unsigned char i);
206 static llvm::ConstantInt *createConstantShort(short i);
207 static llvm::ConstantInt *createConstantShort(unsigned short i);
208 static llvm::Constant *createConstantFloat(float x);
John Bauman19bac1e2014-05-06 15:23:49 -0400209 static llvm::Value *createNullPointer(llvm::Type *Ty);
210 static llvm::Value *createConstantVector(llvm::Constant *const *Vals, unsigned NumVals);
John Bauman89401822014-05-06 15:04:28 -0400211
212 private:
213 void optimize();
214
215 static llvm::ExecutionEngine *executionEngine;
216 static Builder *builder;
217 static llvm::Function *function;
218 static llvm::LLVMContext *context;
219 static llvm::Module *module;
Nicolas Capens2fb41102014-06-26 10:11:50 -0400220 static RoutineManager *routineManager;
John Bauman89401822014-05-06 15:04:28 -0400221 };
222
223 class Byte;
224 class SByte;
225 class Byte4;
226 class SByte4;
227 class Byte8;
228 class SByte8;
229 class Byte16;
230 class SByte16;
231 class Short;
232 class UShort;
233 class Short4;
234 class UShort4;
235 class Short8;
236 class UShort8;
237 class Int;
238 class UInt;
239 class Int2;
240 class UInt2;
241 class Int4;
242 class UInt4;
243 class Long;
244 class Long1;
245 class Long2;
246 class Float;
247 class Float2;
248 class Float4;
249
250 class Void
251 {
252 public:
John Bauman19bac1e2014-05-06 15:23:49 -0400253 static llvm::Type *getType();
John Bauman66b8ab22014-05-06 15:57:45 -0400254
John Bauman89401822014-05-06 15:04:28 -0400255 static bool isVoid()
256 {
257 return true;
258 }
259
260 typedef void ctype;
261 };
262
263 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -0400264 class RValue;
265
266 template<class T>
267 class Pointer;
268
269 class LValue
John Bauman89401822014-05-06 15:04:28 -0400270 {
271 public:
John Bauman66b8ab22014-05-06 15:57:45 -0400272 LValue(llvm::Type *type, int arraySize = 0);
273
John Bauman89401822014-05-06 15:04:28 -0400274 static bool isVoid()
275 {
276 return false;
277 }
278
John Bauman66b8ab22014-05-06 15:57:45 -0400279 llvm::Value *loadValue(unsigned int alignment = 0) const;
280 llvm::Value *storeValue(llvm::Value *value, unsigned int alignment = 0) const;
281 llvm::Value *getAddress(llvm::Value *index) const;
282
283 private:
John Bauman89401822014-05-06 15:04:28 -0400284 llvm::Value *address;
John Bauman89401822014-05-06 15:04:28 -0400285 };
286
287 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -0400288 class Variable : public LValue
289 {
290 public:
291 Variable(int arraySize = 0);
292
293 RValue<Pointer<T> > operator&();
294 };
John Bauman89401822014-05-06 15:04:28 -0400295
296 template<class T>
297 class Reference
298 {
John Bauman89401822014-05-06 15:04:28 -0400299 public:
300 explicit Reference(llvm::Value *pointer, int alignment = 1);
301
John Bauman19bac1e2014-05-06 15:23:49 -0400302 RValue<T> operator=(RValue<T> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400303 RValue<T> operator=(const Reference<T> &ref) const;
304
John Bauman19bac1e2014-05-06 15:23:49 -0400305 RValue<T> operator+=(RValue<T> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400306
John Bauman66b8ab22014-05-06 15:57:45 -0400307 llvm::Value *loadValue() const;
308 int getAlignment() const;
309
John Bauman89401822014-05-06 15:04:28 -0400310 private:
311 llvm::Value *address;
312
313 const int alignment;
314 };
315
316 template<class T>
317 struct IntLiteral
318 {
319 struct type;
320 };
321
322 template<> struct
323 IntLiteral<Int>
324 {
325 typedef int type;
326 };
327
John Bauman66b8ab22014-05-06 15:57:45 -0400328 template<> struct
329 IntLiteral<UInt>
330 {
331 typedef unsigned int type;
332 };
333
334 template<> struct
335 IntLiteral<Long>
336 {
337 typedef int64_t type;
338 };
339
340 template<class T>
341 struct FloatLiteral
342 {
343 struct type;
344 };
345
346 template<> struct
347 FloatLiteral<Float>
348 {
349 typedef float type;
350 };
351
John Bauman89401822014-05-06 15:04:28 -0400352 template<class T>
353 class RValue
354 {
355 public:
356 explicit RValue(llvm::Value *rvalue);
357
358 RValue(const T &lvalue);
359 RValue(typename IntLiteral<T>::type i);
John Bauman66b8ab22014-05-06 15:57:45 -0400360 RValue(typename FloatLiteral<T>::type f);
361 RValue(const Reference<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400362
363 llvm::Value *value; // FIXME: Make private
364 };
365
John Bauman66b8ab22014-05-06 15:57:45 -0400366 class MMX : public Variable<MMX>
John Bauman19bac1e2014-05-06 15:23:49 -0400367 {
368 public:
369 static llvm::Type *getType();
370 };
371
John Bauman66b8ab22014-05-06 15:57:45 -0400372 class Bool : public Variable<Bool>
John Bauman89401822014-05-06 15:04:28 -0400373 {
374 public:
375 explicit Bool(llvm::Argument *argument);
376
377 Bool();
378 Bool(bool x);
John Bauman19bac1e2014-05-06 15:23:49 -0400379 Bool(RValue<Bool> rhs);
John Bauman89401822014-05-06 15:04:28 -0400380 Bool(const Bool &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400381 Bool(const Reference<Bool> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400382
383 // RValue<Bool> operator=(bool rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400384 RValue<Bool> operator=(RValue<Bool> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400385 RValue<Bool> operator=(const Bool &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400386 RValue<Bool> operator=(const Reference<Bool> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400387
John Bauman19bac1e2014-05-06 15:23:49 -0400388 friend RValue<Bool> operator!(RValue<Bool> val);
389 friend RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs);
390 friend RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs);
John Bauman89401822014-05-06 15:04:28 -0400391
John Bauman19bac1e2014-05-06 15:23:49 -0400392 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400393 };
394
John Bauman66b8ab22014-05-06 15:57:45 -0400395 class Byte : public Variable<Byte>
John Bauman89401822014-05-06 15:04:28 -0400396 {
397 public:
398 explicit Byte(llvm::Argument *argument);
399
John Bauman19bac1e2014-05-06 15:23:49 -0400400 explicit Byte(RValue<Int> cast);
John Bauman89401822014-05-06 15:04:28 -0400401
402 Byte();
403 Byte(int x);
404 Byte(unsigned char x);
John Bauman19bac1e2014-05-06 15:23:49 -0400405 Byte(RValue<Byte> rhs);
John Bauman89401822014-05-06 15:04:28 -0400406 Byte(const Byte &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400407 Byte(const Reference<Byte> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400408
409 // RValue<Byte> operator=(unsigned char rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400410 RValue<Byte> operator=(RValue<Byte> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400411 RValue<Byte> operator=(const Byte &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400412 RValue<Byte> operator=(const Reference<Byte> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400413
John Bauman19bac1e2014-05-06 15:23:49 -0400414 friend RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs);
415 friend RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs);
416 friend RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs);
417 friend RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs);
418 friend RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs);
419 friend RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs);
420 friend RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs);
421 friend RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs);
422 friend RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs);
423 friend RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs);
424 friend RValue<Byte> operator+=(const Byte &lhs, RValue<Byte> rhs);
425 friend RValue<Byte> operator-=(const Byte &lhs, RValue<Byte> rhs);
426 friend RValue<Byte> operator*=(const Byte &lhs, RValue<Byte> rhs);
427 friend RValue<Byte> operator/=(const Byte &lhs, RValue<Byte> rhs);
428 friend RValue<Byte> operator%=(const Byte &lhs, RValue<Byte> rhs);
429 friend RValue<Byte> operator&=(const Byte &lhs, RValue<Byte> rhs);
430 friend RValue<Byte> operator|=(const Byte &lhs, RValue<Byte> rhs);
431 friend RValue<Byte> operator^=(const Byte &lhs, RValue<Byte> rhs);
432 friend RValue<Byte> operator<<=(const Byte &lhs, RValue<Byte> rhs);
433 friend RValue<Byte> operator>>=(const Byte &lhs, RValue<Byte> rhs);
434 friend RValue<Byte> operator+(RValue<Byte> val);
435 friend RValue<Byte> operator-(RValue<Byte> val);
436 friend RValue<Byte> operator~(RValue<Byte> val);
John Bauman89401822014-05-06 15:04:28 -0400437 friend RValue<Byte> operator++(const Byte &val, int); // Post-increment
438 friend const Byte &operator++(const Byte &val); // Pre-increment
439 friend RValue<Byte> operator--(const Byte &val, int); // Post-decrement
440 friend const Byte &operator--(const Byte &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -0400441 friend RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs);
442 friend RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs);
443 friend RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs);
444 friend RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs);
445 friend RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs);
446 friend RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs);
John Bauman89401822014-05-06 15:04:28 -0400447
John Bauman19bac1e2014-05-06 15:23:49 -0400448 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400449 };
450
John Bauman66b8ab22014-05-06 15:57:45 -0400451 class SByte : public Variable<SByte>
John Bauman89401822014-05-06 15:04:28 -0400452 {
453 public:
454 explicit SByte(llvm::Argument *argument);
455
456 SByte();
457 SByte(signed char x);
John Bauman19bac1e2014-05-06 15:23:49 -0400458 SByte(RValue<SByte> rhs);
John Bauman89401822014-05-06 15:04:28 -0400459 SByte(const SByte &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400460 SByte(const Reference<SByte> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400461
462 // RValue<SByte> operator=(signed char rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400463 RValue<SByte> operator=(RValue<SByte> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400464 RValue<SByte> operator=(const SByte &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400465 RValue<SByte> operator=(const Reference<SByte> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400466
John Bauman19bac1e2014-05-06 15:23:49 -0400467 friend RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs);
468 friend RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs);
469 friend RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs);
470 friend RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs);
471 friend RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs);
472 friend RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs);
473 friend RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs);
474 friend RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs);
475 friend RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs);
476 friend RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs);
477 friend RValue<SByte> operator+=(const SByte &lhs, RValue<SByte> rhs);
478 friend RValue<SByte> operator-=(const SByte &lhs, RValue<SByte> rhs);
479 friend RValue<SByte> operator*=(const SByte &lhs, RValue<SByte> rhs);
480 friend RValue<SByte> operator/=(const SByte &lhs, RValue<SByte> rhs);
481 friend RValue<SByte> operator%=(const SByte &lhs, RValue<SByte> rhs);
482 friend RValue<SByte> operator&=(const SByte &lhs, RValue<SByte> rhs);
483 friend RValue<SByte> operator|=(const SByte &lhs, RValue<SByte> rhs);
484 friend RValue<SByte> operator^=(const SByte &lhs, RValue<SByte> rhs);
485 friend RValue<SByte> operator<<=(const SByte &lhs, RValue<SByte> rhs);
486 friend RValue<SByte> operator>>=(const SByte &lhs, RValue<SByte> rhs);
487 friend RValue<SByte> operator+(RValue<SByte> val);
488 friend RValue<SByte> operator-(RValue<SByte> val);
489 friend RValue<SByte> operator~(RValue<SByte> val);
John Bauman89401822014-05-06 15:04:28 -0400490 friend RValue<SByte> operator++(const SByte &val, int); // Post-increment
491 friend const SByte &operator++(const SByte &val); // Pre-increment
492 friend RValue<SByte> operator--(const SByte &val, int); // Post-decrement
493 friend const SByte &operator--(const SByte &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -0400494 friend RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs);
495 friend RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs);
496 friend RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs);
497 friend RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs);
498 friend RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs);
499 friend RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs);
John Bauman89401822014-05-06 15:04:28 -0400500
John Bauman19bac1e2014-05-06 15:23:49 -0400501 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400502 };
503
John Bauman66b8ab22014-05-06 15:57:45 -0400504 class Short : public Variable<Short>
John Bauman89401822014-05-06 15:04:28 -0400505 {
506 public:
507 explicit Short(llvm::Argument *argument);
508
John Bauman19bac1e2014-05-06 15:23:49 -0400509 explicit Short(RValue<Int> cast);
John Bauman89401822014-05-06 15:04:28 -0400510
511 Short();
512 Short(short x);
John Bauman19bac1e2014-05-06 15:23:49 -0400513 Short(RValue<Short> rhs);
John Bauman89401822014-05-06 15:04:28 -0400514 Short(const Short &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400515 Short(const Reference<Short> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400516
517 // RValue<Short> operator=(short rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400518 RValue<Short> operator=(RValue<Short> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400519 RValue<Short> operator=(const Short &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400520 RValue<Short> operator=(const Reference<Short> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400521
John Bauman19bac1e2014-05-06 15:23:49 -0400522 friend RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs);
523 friend RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs);
524 friend RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs);
525 friend RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs);
526 friend RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs);
527 friend RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs);
528 friend RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs);
529 friend RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs);
530 friend RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs);
531 friend RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs);
532 friend RValue<Short> operator+=(const Short &lhs, RValue<Short> rhs);
533 friend RValue<Short> operator-=(const Short &lhs, RValue<Short> rhs);
534 friend RValue<Short> operator*=(const Short &lhs, RValue<Short> rhs);
535 friend RValue<Short> operator/=(const Short &lhs, RValue<Short> rhs);
536 friend RValue<Short> operator%=(const Short &lhs, RValue<Short> rhs);
537 friend RValue<Short> operator&=(const Short &lhs, RValue<Short> rhs);
538 friend RValue<Short> operator|=(const Short &lhs, RValue<Short> rhs);
539 friend RValue<Short> operator^=(const Short &lhs, RValue<Short> rhs);
540 friend RValue<Short> operator<<=(const Short &lhs, RValue<Short> rhs);
541 friend RValue<Short> operator>>=(const Short &lhs, RValue<Short> rhs);
542 friend RValue<Short> operator+(RValue<Short> val);
543 friend RValue<Short> operator-(RValue<Short> val);
544 friend RValue<Short> operator~(RValue<Short> val);
John Bauman89401822014-05-06 15:04:28 -0400545 friend RValue<Short> operator++(const Short &val, int); // Post-increment
546 friend const Short &operator++(const Short &val); // Pre-increment
547 friend RValue<Short> operator--(const Short &val, int); // Post-decrement
548 friend const Short &operator--(const Short &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -0400549 friend RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs);
550 friend RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs);
551 friend RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs);
552 friend RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs);
553 friend RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs);
554 friend RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs);
John Bauman89401822014-05-06 15:04:28 -0400555
John Bauman19bac1e2014-05-06 15:23:49 -0400556 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400557 };
558
John Bauman66b8ab22014-05-06 15:57:45 -0400559 class UShort : public Variable<UShort>
John Bauman89401822014-05-06 15:04:28 -0400560 {
561 public:
562 explicit UShort(llvm::Argument *argument);
563
564 UShort();
565 UShort(unsigned short x);
John Bauman19bac1e2014-05-06 15:23:49 -0400566 UShort(RValue<UShort> rhs);
John Bauman89401822014-05-06 15:04:28 -0400567 UShort(const UShort &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400568 UShort(const Reference<UShort> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400569
570 // RValue<UShort> operator=(unsigned short rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -0400571 RValue<UShort> operator=(RValue<UShort> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400572 RValue<UShort> operator=(const UShort &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400573 RValue<UShort> operator=(const Reference<UShort> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400574
John Bauman19bac1e2014-05-06 15:23:49 -0400575 friend RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs);
576 friend RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs);
577 friend RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs);
578 friend RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs);
579 friend RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs);
580 friend RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs);
581 friend RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs);
582 friend RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs);
583 friend RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs);
584 friend RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs);
585 friend RValue<UShort> operator+=(const UShort &lhs, RValue<UShort> rhs);
586 friend RValue<UShort> operator-=(const UShort &lhs, RValue<UShort> rhs);
587 friend RValue<UShort> operator*=(const UShort &lhs, RValue<UShort> rhs);
588 friend RValue<UShort> operator/=(const UShort &lhs, RValue<UShort> rhs);
589 friend RValue<UShort> operator%=(const UShort &lhs, RValue<UShort> rhs);
590 friend RValue<UShort> operator&=(const UShort &lhs, RValue<UShort> rhs);
591 friend RValue<UShort> operator|=(const UShort &lhs, RValue<UShort> rhs);
592 friend RValue<UShort> operator^=(const UShort &lhs, RValue<UShort> rhs);
593 friend RValue<UShort> operator<<=(const UShort &lhs, RValue<UShort> rhs);
594 friend RValue<UShort> operator>>=(const UShort &lhs, RValue<UShort> rhs);
595 friend RValue<UShort> operator+(RValue<UShort> val);
596 friend RValue<UShort> operator-(RValue<UShort> val);
597 friend RValue<UShort> operator~(RValue<UShort> val);
John Bauman89401822014-05-06 15:04:28 -0400598 friend RValue<UShort> operator++(const UShort &val, int); // Post-increment
599 friend const UShort &operator++(const UShort &val); // Pre-increment
600 friend RValue<UShort> operator--(const UShort &val, int); // Post-decrement
601 friend const UShort &operator--(const UShort &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -0400602 friend RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs);
603 friend RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs);
604 friend RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs);
605 friend RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs);
606 friend RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs);
607 friend RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs);
John Bauman89401822014-05-06 15:04:28 -0400608
John Bauman19bac1e2014-05-06 15:23:49 -0400609 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400610 };
611
John Bauman66b8ab22014-05-06 15:57:45 -0400612 class Byte4 : public Variable<Byte4>
John Bauman89401822014-05-06 15:04:28 -0400613 {
614 public:
615 // Byte4();
616 // Byte4(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400617 // Byte4(RValue<Byte4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400618 // Byte4(const Byte4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400619 // Byte4(const Reference<Byte4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400620
John Bauman19bac1e2014-05-06 15:23:49 -0400621 // RValue<Byte4> operator=(RValue<Byte4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400622 // RValue<Byte4> operator=(const Byte4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400623 // RValue<Byte4> operator=(const Reference<Byte4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400624
John Bauman19bac1e2014-05-06 15:23:49 -0400625 // friend RValue<Byte4> operator+(RValue<Byte4> lhs, RValue<Byte4> rhs);
626 // friend RValue<Byte4> operator-(RValue<Byte4> lhs, RValue<Byte4> rhs);
627 // friend RValue<Byte4> operator*(RValue<Byte4> lhs, RValue<Byte4> rhs);
628 // friend RValue<Byte4> operator/(RValue<Byte4> lhs, RValue<Byte4> rhs);
629 // friend RValue<Byte4> operator%(RValue<Byte4> lhs, RValue<Byte4> rhs);
630 // friend RValue<Byte4> operator&(RValue<Byte4> lhs, RValue<Byte4> rhs);
631 // friend RValue<Byte4> operator|(RValue<Byte4> lhs, RValue<Byte4> rhs);
632 // friend RValue<Byte4> operator^(RValue<Byte4> lhs, RValue<Byte4> rhs);
633 // friend RValue<Byte4> operator<<(RValue<Byte4> lhs, RValue<Byte4> rhs);
634 // friend RValue<Byte4> operator>>(RValue<Byte4> lhs, RValue<Byte4> rhs);
635 // friend RValue<Byte4> operator+=(const Byte4 &lhs, RValue<Byte4> rhs);
636 // friend RValue<Byte4> operator-=(const Byte4 &lhs, RValue<Byte4> rhs);
637 // friend RValue<Byte4> operator*=(const Byte4 &lhs, RValue<Byte4> rhs);
638 // friend RValue<Byte4> operator/=(const Byte4 &lhs, RValue<Byte4> rhs);
639 // friend RValue<Byte4> operator%=(const Byte4 &lhs, RValue<Byte4> rhs);
640 // friend RValue<Byte4> operator&=(const Byte4 &lhs, RValue<Byte4> rhs);
641 // friend RValue<Byte4> operator|=(const Byte4 &lhs, RValue<Byte4> rhs);
642 // friend RValue<Byte4> operator^=(const Byte4 &lhs, RValue<Byte4> rhs);
643 // friend RValue<Byte4> operator<<=(const Byte4 &lhs, RValue<Byte4> rhs);
644 // friend RValue<Byte4> operator>>=(const Byte4 &lhs, RValue<Byte4> rhs);
645 // friend RValue<Byte4> operator+(RValue<Byte4> val);
646 // friend RValue<Byte4> operator-(RValue<Byte4> val);
647 // friend RValue<Byte4> operator~(RValue<Byte4> val);
John Bauman89401822014-05-06 15:04:28 -0400648 // friend RValue<Byte4> operator++(const Byte4 &val, int); // Post-increment
649 // friend const Byte4 &operator++(const Byte4 &val); // Pre-increment
650 // friend RValue<Byte4> operator--(const Byte4 &val, int); // Post-decrement
651 // friend const Byte4 &operator--(const Byte4 &val); // Pre-decrement
652
John Bauman19bac1e2014-05-06 15:23:49 -0400653 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400654 };
655
John Bauman66b8ab22014-05-06 15:57:45 -0400656 class SByte4 : public Variable<SByte4>
John Bauman89401822014-05-06 15:04:28 -0400657 {
658 public:
659 // SByte4();
660 // SByte4(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400661 // SByte4(RValue<SByte4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400662 // SByte4(const SByte4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400663 // SByte4(const Reference<SByte4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400664
John Bauman19bac1e2014-05-06 15:23:49 -0400665 // RValue<SByte4> operator=(RValue<SByte4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400666 // RValue<SByte4> operator=(const SByte4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400667 // RValue<SByte4> operator=(const Reference<SByte4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400668
John Bauman19bac1e2014-05-06 15:23:49 -0400669 // friend RValue<SByte4> operator+(RValue<SByte4> lhs, RValue<SByte4> rhs);
670 // friend RValue<SByte4> operator-(RValue<SByte4> lhs, RValue<SByte4> rhs);
671 // friend RValue<SByte4> operator*(RValue<SByte4> lhs, RValue<SByte4> rhs);
672 // friend RValue<SByte4> operator/(RValue<SByte4> lhs, RValue<SByte4> rhs);
673 // friend RValue<SByte4> operator%(RValue<SByte4> lhs, RValue<SByte4> rhs);
674 // friend RValue<SByte4> operator&(RValue<SByte4> lhs, RValue<SByte4> rhs);
675 // friend RValue<SByte4> operator|(RValue<SByte4> lhs, RValue<SByte4> rhs);
676 // friend RValue<SByte4> operator^(RValue<SByte4> lhs, RValue<SByte4> rhs);
677 // friend RValue<SByte4> operator<<(RValue<SByte4> lhs, RValue<SByte4> rhs);
678 // friend RValue<SByte4> operator>>(RValue<SByte4> lhs, RValue<SByte4> rhs);
679 // friend RValue<SByte4> operator+=(const SByte4 &lhs, RValue<SByte4> rhs);
680 // friend RValue<SByte4> operator-=(const SByte4 &lhs, RValue<SByte4> rhs);
681 // friend RValue<SByte4> operator*=(const SByte4 &lhs, RValue<SByte4> rhs);
682 // friend RValue<SByte4> operator/=(const SByte4 &lhs, RValue<SByte4> rhs);
683 // friend RValue<SByte4> operator%=(const SByte4 &lhs, RValue<SByte4> rhs);
684 // friend RValue<SByte4> operator&=(const SByte4 &lhs, RValue<SByte4> rhs);
685 // friend RValue<SByte4> operator|=(const SByte4 &lhs, RValue<SByte4> rhs);
686 // friend RValue<SByte4> operator^=(const SByte4 &lhs, RValue<SByte4> rhs);
687 // friend RValue<SByte4> operator<<=(const SByte4 &lhs, RValue<SByte4> rhs);
688 // friend RValue<SByte4> operator>>=(const SByte4 &lhs, RValue<SByte4> rhs);
689 // friend RValue<SByte4> operator+(RValue<SByte4> val);
690 // friend RValue<SByte4> operator-(RValue<SByte4> val);
691 // friend RValue<SByte4> operator~(RValue<SByte4> val);
John Bauman89401822014-05-06 15:04:28 -0400692 // friend RValue<SByte4> operator++(const SByte4 &val, int); // Post-increment
693 // friend const SByte4 &operator++(const SByte4 &val); // Pre-increment
694 // friend RValue<SByte4> operator--(const SByte4 &val, int); // Post-decrement
695 // friend const SByte4 &operator--(const SByte4 &val); // Pre-decrement
696
John Bauman19bac1e2014-05-06 15:23:49 -0400697 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400698 };
699
John Bauman66b8ab22014-05-06 15:57:45 -0400700 class Byte8 : public Variable<Byte8>
John Bauman89401822014-05-06 15:04:28 -0400701 {
702 public:
703 Byte8();
704 Byte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7);
705 Byte8(int64_t x);
John Bauman19bac1e2014-05-06 15:23:49 -0400706 Byte8(RValue<Byte8> rhs);
John Bauman89401822014-05-06 15:04:28 -0400707 Byte8(const Byte8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400708 Byte8(const Reference<Byte8> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400709
John Bauman19bac1e2014-05-06 15:23:49 -0400710 RValue<Byte8> operator=(RValue<Byte8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400711 RValue<Byte8> operator=(const Byte8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400712 RValue<Byte8> operator=(const Reference<Byte8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400713
John Bauman19bac1e2014-05-06 15:23:49 -0400714 friend RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs);
715 friend RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs);
716 // friend RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs);
717 // friend RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs);
718 // friend RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs);
719 friend RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs);
720 friend RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs);
721 friend RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs);
722 // friend RValue<Byte8> operator<<(RValue<Byte8> lhs, RValue<Byte8> rhs);
723 // friend RValue<Byte8> operator>>(RValue<Byte8> lhs, RValue<Byte8> rhs);
724 friend RValue<Byte8> operator+=(const Byte8 &lhs, RValue<Byte8> rhs);
725 friend RValue<Byte8> operator-=(const Byte8 &lhs, RValue<Byte8> rhs);
726 // friend RValue<Byte8> operator*=(const Byte8 &lhs, RValue<Byte8> rhs);
727 // friend RValue<Byte8> operator/=(const Byte8 &lhs, RValue<Byte8> rhs);
728 // friend RValue<Byte8> operator%=(const Byte8 &lhs, RValue<Byte8> rhs);
729 friend RValue<Byte8> operator&=(const Byte8 &lhs, RValue<Byte8> rhs);
730 friend RValue<Byte8> operator|=(const Byte8 &lhs, RValue<Byte8> rhs);
731 friend RValue<Byte8> operator^=(const Byte8 &lhs, RValue<Byte8> rhs);
732 // friend RValue<Byte8> operator<<=(const Byte8 &lhs, RValue<Byte8> rhs);
733 // friend RValue<Byte8> operator>>=(const Byte8 &lhs, RValue<Byte8> rhs);
734 // friend RValue<Byte8> operator+(RValue<Byte8> val);
735 // friend RValue<Byte8> operator-(RValue<Byte8> val);
736 friend RValue<Byte8> operator~(RValue<Byte8> val);
John Bauman89401822014-05-06 15:04:28 -0400737 // friend RValue<Byte8> operator++(const Byte8 &val, int); // Post-increment
738 // friend const Byte8 &operator++(const Byte8 &val); // Pre-increment
739 // friend RValue<Byte8> operator--(const Byte8 &val, int); // Post-decrement
740 // friend const Byte8 &operator--(const Byte8 &val); // Pre-decrement
741
John Bauman19bac1e2014-05-06 15:23:49 -0400742 friend RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y);
743 friend RValue<Byte8> SubSat(RValue<Byte8> x, RValue<Byte8> y);
John Bauman89401822014-05-06 15:04:28 -0400744
John Bauman19bac1e2014-05-06 15:23:49 -0400745 friend RValue<Short4> Unpack(RValue<Byte4> x);
746 friend RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y);
747 friend RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y);
748 friend RValue<Int> SignMask(RValue<Byte8> x);
John Bauman89401822014-05-06 15:04:28 -0400749
John Bauman19bac1e2014-05-06 15:23:49 -0400750 // friend RValue<Byte8> CmpGT(RValue<Byte8> x, RValue<Byte8> y);
751 friend RValue<Byte8> CmpEQ(RValue<Byte8> x, RValue<Byte8> y);
John Bauman89401822014-05-06 15:04:28 -0400752
John Bauman19bac1e2014-05-06 15:23:49 -0400753 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400754 };
755
John Bauman66b8ab22014-05-06 15:57:45 -0400756 class SByte8 : public Variable<SByte8>
John Bauman89401822014-05-06 15:04:28 -0400757 {
758 public:
759 SByte8();
760 SByte8(byte x0, byte x1, byte x2, byte x3, byte x4, byte x5, byte x6, byte x7);
761 SByte8(int64_t x);
John Bauman19bac1e2014-05-06 15:23:49 -0400762 SByte8(RValue<SByte8> rhs);
John Bauman89401822014-05-06 15:04:28 -0400763 SByte8(const SByte8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400764 SByte8(const Reference<SByte8> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400765
John Bauman19bac1e2014-05-06 15:23:49 -0400766 RValue<SByte8> operator=(RValue<SByte8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400767 RValue<SByte8> operator=(const SByte8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400768 RValue<SByte8> operator=(const Reference<SByte8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400769
John Bauman19bac1e2014-05-06 15:23:49 -0400770 friend RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs);
771 friend RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs);
772 // friend RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs);
773 // friend RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs);
774 // friend RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs);
775 friend RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs);
776 friend RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs);
777 friend RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs);
778 // friend RValue<SByte8> operator<<(RValue<SByte8> lhs, RValue<SByte8> rhs);
779 // friend RValue<SByte8> operator>>(RValue<SByte8> lhs, RValue<SByte8> rhs);
780 friend RValue<SByte8> operator+=(const SByte8 &lhs, RValue<SByte8> rhs);
781 friend RValue<SByte8> operator-=(const SByte8 &lhs, RValue<SByte8> rhs);
782 // friend RValue<SByte8> operator*=(const SByte8 &lhs, RValue<SByte8> rhs);
783 // friend RValue<SByte8> operator/=(const SByte8 &lhs, RValue<SByte8> rhs);
784 // friend RValue<SByte8> operator%=(const SByte8 &lhs, RValue<SByte8> rhs);
785 friend RValue<SByte8> operator&=(const SByte8 &lhs, RValue<SByte8> rhs);
786 friend RValue<SByte8> operator|=(const SByte8 &lhs, RValue<SByte8> rhs);
787 friend RValue<SByte8> operator^=(const SByte8 &lhs, RValue<SByte8> rhs);
788 // friend RValue<SByte8> operator<<=(const SByte8 &lhs, RValue<SByte8> rhs);
789 // friend RValue<SByte8> operator>>=(const SByte8 &lhs, RValue<SByte8> rhs);
790 // friend RValue<SByte8> operator+(RValue<SByte8> val);
791 // friend RValue<SByte8> operator-(RValue<SByte8> val);
792 friend RValue<SByte8> operator~(RValue<SByte8> val);
John Bauman89401822014-05-06 15:04:28 -0400793 // friend RValue<SByte8> operator++(const SByte8 &val, int); // Post-increment
794 // friend const SByte8 &operator++(const SByte8 &val); // Pre-increment
795 // friend RValue<SByte8> operator--(const SByte8 &val, int); // Post-decrement
796 // friend const SByte8 &operator--(const SByte8 &val); // Pre-decrement
797
John Bauman19bac1e2014-05-06 15:23:49 -0400798 friend RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y);
799 friend RValue<SByte8> SubSat(RValue<SByte8> x, RValue<SByte8> y);
John Bauman89401822014-05-06 15:04:28 -0400800
John Bauman19bac1e2014-05-06 15:23:49 -0400801 friend RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y);
802 friend RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y);
803 friend RValue<Int> SignMask(RValue<SByte8> x);
John Bauman89401822014-05-06 15:04:28 -0400804
John Bauman19bac1e2014-05-06 15:23:49 -0400805 friend RValue<Byte8> CmpGT(RValue<SByte8> x, RValue<SByte8> y);
806 friend RValue<Byte8> CmpEQ(RValue<SByte8> x, RValue<SByte8> y);
John Bauman89401822014-05-06 15:04:28 -0400807
John Bauman19bac1e2014-05-06 15:23:49 -0400808 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400809 };
810
John Bauman66b8ab22014-05-06 15:57:45 -0400811 class Byte16 : public Variable<Byte16>
John Bauman89401822014-05-06 15:04:28 -0400812 {
813 public:
814 // Byte16();
815 // Byte16(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400816 Byte16(RValue<Byte16> rhs);
John Bauman89401822014-05-06 15:04:28 -0400817 Byte16(const Byte16 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400818 Byte16(const Reference<Byte16> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400819
John Bauman19bac1e2014-05-06 15:23:49 -0400820 RValue<Byte16> operator=(RValue<Byte16> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400821 RValue<Byte16> operator=(const Byte16 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400822 RValue<Byte16> operator=(const Reference<Byte16> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400823
John Bauman19bac1e2014-05-06 15:23:49 -0400824 // friend RValue<Byte16> operator+(RValue<Byte16> lhs, RValue<Byte16> rhs);
825 // friend RValue<Byte16> operator-(RValue<Byte16> lhs, RValue<Byte16> rhs);
826 // friend RValue<Byte16> operator*(RValue<Byte16> lhs, RValue<Byte16> rhs);
827 // friend RValue<Byte16> operator/(RValue<Byte16> lhs, RValue<Byte16> rhs);
828 // friend RValue<Byte16> operator%(RValue<Byte16> lhs, RValue<Byte16> rhs);
829 // friend RValue<Byte16> operator&(RValue<Byte16> lhs, RValue<Byte16> rhs);
830 // friend RValue<Byte16> operator|(RValue<Byte16> lhs, RValue<Byte16> rhs);
831 // friend RValue<Byte16> operator^(RValue<Byte16> lhs, RValue<Byte16> rhs);
832 // friend RValue<Byte16> operator<<(RValue<Byte16> lhs, RValue<Byte16> rhs);
833 // friend RValue<Byte16> operator>>(RValue<Byte16> lhs, RValue<Byte16> rhs);
834 // friend RValue<Byte16> operator+=(const Byte16 &lhs, RValue<Byte16> rhs);
835 // friend RValue<Byte16> operator-=(const Byte16 &lhs, RValue<Byte16> rhs);
836 // friend RValue<Byte16> operator*=(const Byte16 &lhs, RValue<Byte16> rhs);
837 // friend RValue<Byte16> operator/=(const Byte16 &lhs, RValue<Byte16> rhs);
838 // friend RValue<Byte16> operator%=(const Byte16 &lhs, RValue<Byte16> rhs);
839 // friend RValue<Byte16> operator&=(const Byte16 &lhs, RValue<Byte16> rhs);
840 // friend RValue<Byte16> operator|=(const Byte16 &lhs, RValue<Byte16> rhs);
841 // friend RValue<Byte16> operator^=(const Byte16 &lhs, RValue<Byte16> rhs);
842 // friend RValue<Byte16> operator<<=(const Byte16 &lhs, RValue<Byte16> rhs);
843 // friend RValue<Byte16> operator>>=(const Byte16 &lhs, RValue<Byte16> rhs);
844 // friend RValue<Byte16> operator+(RValue<Byte16> val);
845 // friend RValue<Byte16> operator-(RValue<Byte16> val);
846 // friend RValue<Byte16> operator~(RValue<Byte16> val);
John Bauman89401822014-05-06 15:04:28 -0400847 // friend RValue<Byte16> operator++(const Byte16 &val, int); // Post-increment
848 // friend const Byte16 &operator++(const Byte16 &val); // Pre-increment
849 // friend RValue<Byte16> operator--(const Byte16 &val, int); // Post-decrement
850 // friend const Byte16 &operator--(const Byte16 &val); // Pre-decrement
851
John Bauman19bac1e2014-05-06 15:23:49 -0400852 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400853 };
854
John Bauman66b8ab22014-05-06 15:57:45 -0400855 class SByte16 : public Variable<SByte16>
John Bauman89401822014-05-06 15:04:28 -0400856 {
857 public:
858 // SByte16();
859 // SByte16(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -0400860 // SByte16(RValue<SByte16> rhs);
John Bauman89401822014-05-06 15:04:28 -0400861 // SByte16(const SByte16 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400862 // SByte16(const Reference<SByte16> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400863
John Bauman19bac1e2014-05-06 15:23:49 -0400864 // RValue<SByte16> operator=(RValue<SByte16> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400865 // RValue<SByte16> operator=(const SByte16 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400866 // RValue<SByte16> operator=(const Reference<SByte16> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400867
John Bauman19bac1e2014-05-06 15:23:49 -0400868 // friend RValue<SByte16> operator+(RValue<SByte16> lhs, RValue<SByte16> rhs);
869 // friend RValue<SByte16> operator-(RValue<SByte16> lhs, RValue<SByte16> rhs);
870 // friend RValue<SByte16> operator*(RValue<SByte16> lhs, RValue<SByte16> rhs);
871 // friend RValue<SByte16> operator/(RValue<SByte16> lhs, RValue<SByte16> rhs);
872 // friend RValue<SByte16> operator%(RValue<SByte16> lhs, RValue<SByte16> rhs);
873 // friend RValue<SByte16> operator&(RValue<SByte16> lhs, RValue<SByte16> rhs);
874 // friend RValue<SByte16> operator|(RValue<SByte16> lhs, RValue<SByte16> rhs);
875 // friend RValue<SByte16> operator^(RValue<SByte16> lhs, RValue<SByte16> rhs);
876 // friend RValue<SByte16> operator<<(RValue<SByte16> lhs, RValue<SByte16> rhs);
877 // friend RValue<SByte16> operator>>(RValue<SByte16> lhs, RValue<SByte16> rhs);
878 // friend RValue<SByte16> operator+=(const SByte16 &lhs, RValue<SByte16> rhs);
879 // friend RValue<SByte16> operator-=(const SByte16 &lhs, RValue<SByte16> rhs);
880 // friend RValue<SByte16> operator*=(const SByte16 &lhs, RValue<SByte16> rhs);
881 // friend RValue<SByte16> operator/=(const SByte16 &lhs, RValue<SByte16> rhs);
882 // friend RValue<SByte16> operator%=(const SByte16 &lhs, RValue<SByte16> rhs);
883 // friend RValue<SByte16> operator&=(const SByte16 &lhs, RValue<SByte16> rhs);
884 // friend RValue<SByte16> operator|=(const SByte16 &lhs, RValue<SByte16> rhs);
885 // friend RValue<SByte16> operator^=(const SByte16 &lhs, RValue<SByte16> rhs);
886 // friend RValue<SByte16> operator<<=(const SByte16 &lhs, RValue<SByte16> rhs);
887 // friend RValue<SByte16> operator>>=(const SByte16 &lhs, RValue<SByte16> rhs);
888 // friend RValue<SByte16> operator+(RValue<SByte16> val);
889 // friend RValue<SByte16> operator-(RValue<SByte16> val);
890 // friend RValue<SByte16> operator~(RValue<SByte16> val);
John Bauman89401822014-05-06 15:04:28 -0400891 // friend RValue<SByte16> operator++(const SByte16 &val, int); // Post-increment
892 // friend const SByte16 &operator++(const SByte16 &val); // Pre-increment
893 // friend RValue<SByte16> operator--(const SByte16 &val, int); // Post-decrement
894 // friend const SByte16 &operator--(const SByte16 &val); // Pre-decrement
895
John Bauman19bac1e2014-05-06 15:23:49 -0400896 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400897 };
898
John Bauman66b8ab22014-05-06 15:57:45 -0400899 class Short4 : public Variable<Short4>
John Bauman89401822014-05-06 15:04:28 -0400900 {
901 public:
John Bauman19bac1e2014-05-06 15:23:49 -0400902 explicit Short4(RValue<Int> cast);
903 explicit Short4(RValue<Int4> cast);
904 // explicit Short4(RValue<Float> cast);
905 explicit Short4(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -0400906
907 Short4();
John Bauman19bac1e2014-05-06 15:23:49 -0400908 Short4(short xyzw);
John Bauman89401822014-05-06 15:04:28 -0400909 Short4(short x, short y, short z, short w);
John Bauman19bac1e2014-05-06 15:23:49 -0400910 Short4(RValue<Short4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400911 Short4(const Short4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400912 Short4(const Reference<Short4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -0400913 Short4(RValue<UShort4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400914 Short4(const UShort4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400915 Short4(const Reference<UShort4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400916
John Bauman19bac1e2014-05-06 15:23:49 -0400917 RValue<Short4> operator=(RValue<Short4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400918 RValue<Short4> operator=(const Short4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400919 RValue<Short4> operator=(const Reference<Short4> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -0400920 RValue<Short4> operator=(RValue<UShort4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400921 RValue<Short4> operator=(const UShort4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -0400922 RValue<Short4> operator=(const Reference<UShort4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -0400923
John Bauman19bac1e2014-05-06 15:23:49 -0400924 friend RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs);
925 friend RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs);
926 friend RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs);
927 // friend RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs);
928 // friend RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs);
929 friend RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs);
930 friend RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs);
931 friend RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs);
932 friend RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs);
933 friend RValue<Short4> operator>>(RValue<Short4> lhs, unsigned char rhs);
934 friend RValue<Short4> operator<<(RValue<Short4> lhs, RValue<Long1> rhs);
935 friend RValue<Short4> operator>>(RValue<Short4> lhs, RValue<Long1> rhs);
936 friend RValue<Short4> operator+=(const Short4 &lhs, RValue<Short4> rhs);
937 friend RValue<Short4> operator-=(const Short4 &lhs, RValue<Short4> rhs);
938 friend RValue<Short4> operator*=(const Short4 &lhs, RValue<Short4> rhs);
939 // friend RValue<Short4> operator/=(const Short4 &lhs, RValue<Short4> rhs);
940 // friend RValue<Short4> operator%=(const Short4 &lhs, RValue<Short4> rhs);
941 friend RValue<Short4> operator&=(const Short4 &lhs, RValue<Short4> rhs);
942 friend RValue<Short4> operator|=(const Short4 &lhs, RValue<Short4> rhs);
943 friend RValue<Short4> operator^=(const Short4 &lhs, RValue<Short4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400944 friend RValue<Short4> operator<<=(const Short4 &lhs, unsigned char rhs);
945 friend RValue<Short4> operator>>=(const Short4 &lhs, unsigned char rhs);
John Bauman19bac1e2014-05-06 15:23:49 -0400946 friend RValue<Short4> operator<<=(const Short4 &lhs, RValue<Long1> rhs);
947 friend RValue<Short4> operator>>=(const Short4 &lhs, RValue<Long1> rhs);
948 // friend RValue<Short4> operator+(RValue<Short4> val);
949 friend RValue<Short4> operator-(RValue<Short4> val);
950 friend RValue<Short4> operator~(RValue<Short4> val);
John Bauman89401822014-05-06 15:04:28 -0400951 // friend RValue<Short4> operator++(const Short4 &val, int); // Post-increment
952 // friend const Short4 &operator++(const Short4 &val); // Pre-increment
953 // friend RValue<Short4> operator--(const Short4 &val, int); // Post-decrement
954 // friend const Short4 &operator--(const Short4 &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -0400955 // friend RValue<Bool> operator<(RValue<Short4> lhs, RValue<Short4> rhs);
956 // friend RValue<Bool> operator<=(RValue<Short4> lhs, RValue<Short4> rhs);
957 // friend RValue<Bool> operator>(RValue<Short4> lhs, RValue<Short4> rhs);
958 // friend RValue<Bool> operator>=(RValue<Short4> lhs, RValue<Short4> rhs);
959 // friend RValue<Bool> operator!=(RValue<Short4> lhs, RValue<Short4> rhs);
960 // friend RValue<Bool> operator==(RValue<Short4> lhs, RValue<Short4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400961
John Bauman19bac1e2014-05-06 15:23:49 -0400962 friend RValue<Short4> RoundShort4(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -0400963
John Bauman19bac1e2014-05-06 15:23:49 -0400964 friend RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y);
965 friend RValue<Short4> Min(RValue<Short4> x, RValue<Short4> y);
966 friend RValue<Short4> AddSat(RValue<Short4> x, RValue<Short4> y);
967 friend RValue<Short4> SubSat(RValue<Short4> x, RValue<Short4> y);
968 friend RValue<Short4> MulHigh(RValue<Short4> x, RValue<Short4> y);
969 friend RValue<Int2> MulAdd(RValue<Short4> x, RValue<Short4> y);
John Bauman89401822014-05-06 15:04:28 -0400970
John Bauman19bac1e2014-05-06 15:23:49 -0400971 friend RValue<SByte8> Pack(RValue<Short4> x, RValue<Short4> y);
972 friend RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y);
973 friend RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y);
974 friend RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select);
975 friend RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i);
976 friend RValue<Short> Extract(RValue<Short4> val, int i);
John Bauman89401822014-05-06 15:04:28 -0400977
John Bauman19bac1e2014-05-06 15:23:49 -0400978 friend RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y);
979 friend RValue<Short4> CmpEQ(RValue<Short4> x, RValue<Short4> y);
John Bauman89401822014-05-06 15:04:28 -0400980
John Bauman19bac1e2014-05-06 15:23:49 -0400981 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -0400982 };
983
John Bauman66b8ab22014-05-06 15:57:45 -0400984 class UShort4 : public Variable<UShort4>
John Bauman89401822014-05-06 15:04:28 -0400985 {
986 public:
John Bauman19bac1e2014-05-06 15:23:49 -0400987 explicit UShort4(RValue<Int4> cast);
988 explicit UShort4(RValue<Float4> cast, bool saturate = false);
John Bauman89401822014-05-06 15:04:28 -0400989
990 UShort4();
991 UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w);
John Bauman19bac1e2014-05-06 15:23:49 -0400992 UShort4(RValue<UShort4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400993 UShort4(const UShort4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400994 UShort4(const Reference<UShort4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -0400995 UShort4(RValue<Short4> rhs);
John Bauman89401822014-05-06 15:04:28 -0400996 UShort4(const Short4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -0400997 UShort4(const Reference<Short4> &rhs);
John Bauman89401822014-05-06 15:04:28 -0400998
John Bauman19bac1e2014-05-06 15:23:49 -0400999 RValue<UShort4> operator=(RValue<UShort4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001000 RValue<UShort4> operator=(const UShort4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001001 RValue<UShort4> operator=(const Reference<UShort4> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001002 RValue<UShort4> operator=(RValue<Short4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001003 RValue<UShort4> operator=(const Short4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001004 RValue<UShort4> operator=(const Reference<Short4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001005
John Bauman19bac1e2014-05-06 15:23:49 -04001006 friend RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs);
1007 friend RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs);
1008 friend RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs);
1009 // friend RValue<UShort4> operator/(RValue<UShort4> lhs, RValue<UShort4> rhs);
1010 // friend RValue<UShort4> operator%(RValue<UShort4> lhs, RValue<UShort4> rhs);
1011 // friend RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs);
1012 // friend RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs);
1013 // friend RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs);
1014 friend RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs);
1015 friend RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs);
1016 friend RValue<UShort4> operator<<(RValue<UShort4> lhs, RValue<Long1> rhs);
1017 friend RValue<UShort4> operator>>(RValue<UShort4> lhs, RValue<Long1> rhs);
1018 // friend RValue<UShort4> operator+=(const UShort4 &lhs, RValue<UShort4> rhs);
1019 // friend RValue<UShort4> operator-=(const UShort4 &lhs, RValue<UShort4> rhs);
1020 // friend RValue<UShort4> operator*=(const UShort4 &lhs, RValue<UShort4> rhs);
1021 // friend RValue<UShort4> operator/=(const UShort4 &lhs, RValue<UShort4> rhs);
1022 // friend RValue<UShort4> operator%=(const UShort4 &lhs, RValue<UShort4> rhs);
1023 // friend RValue<UShort4> operator&=(const UShort4 &lhs, RValue<UShort4> rhs);
1024 // friend RValue<UShort4> operator|=(const UShort4 &lhs, RValue<UShort4> rhs);
1025 // friend RValue<UShort4> operator^=(const UShort4 &lhs, RValue<UShort4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001026 friend RValue<UShort4> operator<<=(const UShort4 &lhs, unsigned char rhs);
1027 friend RValue<UShort4> operator>>=(const UShort4 &lhs, unsigned char rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001028 friend RValue<UShort4> operator<<=(const UShort4 &lhs, RValue<Long1> rhs);
1029 friend RValue<UShort4> operator>>=(const UShort4 &lhs, RValue<Long1> rhs);
1030 // friend RValue<UShort4> operator+(RValue<UShort4> val);
1031 // friend RValue<UShort4> operator-(RValue<UShort4> val);
1032 friend RValue<UShort4> operator~(RValue<UShort4> val);
John Bauman89401822014-05-06 15:04:28 -04001033 // friend RValue<UShort4> operator++(const UShort4 &val, int); // Post-increment
1034 // friend const UShort4 &operator++(const UShort4 &val); // Pre-increment
1035 // friend RValue<UShort4> operator--(const UShort4 &val, int); // Post-decrement
1036 // friend const UShort4 &operator--(const UShort4 &val); // Pre-decrement
1037
John Bauman19bac1e2014-05-06 15:23:49 -04001038 friend RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y);
1039 friend RValue<UShort4> Min(RValue<UShort4> x, RValue<UShort4> y);
1040 friend RValue<UShort4> AddSat(RValue<UShort4> x, RValue<UShort4> y);
1041 friend RValue<UShort4> SubSat(RValue<UShort4> x, RValue<UShort4> y);
1042 friend RValue<UShort4> MulHigh(RValue<UShort4> x, RValue<UShort4> y);
John Bauman89401822014-05-06 15:04:28 -04001043
John Bauman19bac1e2014-05-06 15:23:49 -04001044 friend RValue<UShort4> Average(RValue<UShort4> x, RValue<UShort4> y);
John Bauman89401822014-05-06 15:04:28 -04001045
John Bauman19bac1e2014-05-06 15:23:49 -04001046 friend RValue<Byte8> Pack(RValue<UShort4> x, RValue<UShort4> y);
John Bauman89401822014-05-06 15:04:28 -04001047
John Bauman19bac1e2014-05-06 15:23:49 -04001048 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001049 };
1050
John Bauman66b8ab22014-05-06 15:57:45 -04001051 class Short8 : public Variable<Short8>
John Bauman89401822014-05-06 15:04:28 -04001052 {
1053 public:
1054 // Short8();
1055 Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7);
John Bauman19bac1e2014-05-06 15:23:49 -04001056 Short8(RValue<Short8> rhs);
John Bauman89401822014-05-06 15:04:28 -04001057 // Short8(const Short8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001058 // Short8(const Reference<Short8> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001059
John Bauman19bac1e2014-05-06 15:23:49 -04001060 // RValue<Short8> operator=(RValue<Short8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001061 // RValue<Short8> operator=(const Short8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001062 // RValue<Short8> operator=(const Reference<Short8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001063
John Bauman19bac1e2014-05-06 15:23:49 -04001064 friend RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs);
1065 // friend RValue<Short8> operator-(RValue<Short8> lhs, RValue<Short8> rhs);
1066 // friend RValue<Short8> operator*(RValue<Short8> lhs, RValue<Short8> rhs);
1067 // friend RValue<Short8> operator/(RValue<Short8> lhs, RValue<Short8> rhs);
1068 // friend RValue<Short8> operator%(RValue<Short8> lhs, RValue<Short8> rhs);
1069 friend RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs);
1070 // friend RValue<Short8> operator|(RValue<Short8> lhs, RValue<Short8> rhs);
1071 // friend RValue<Short8> operator^(RValue<Short8> lhs, RValue<Short8> rhs);
1072 friend RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs);
1073 friend RValue<Short8> operator>>(RValue<Short8> lhs, unsigned char rhs);
1074 // friend RValue<Short8> operator<<(RValue<Short8> lhs, RValue<Short8> rhs);
1075 // friend RValue<Short8> operator>>(RValue<Short8> lhs, RValue<Short8> rhs);
1076 // friend RValue<Short8> operator+=(const Short8 &lhs, RValue<Short8> rhs);
1077 // friend RValue<Short8> operator-=(const Short8 &lhs, RValue<Short8> rhs);
1078 // friend RValue<Short8> operator*=(const Short8 &lhs, RValue<Short8> rhs);
1079 // friend RValue<Short8> operator/=(const Short8 &lhs, RValue<Short8> rhs);
1080 // friend RValue<Short8> operator%=(const Short8 &lhs, RValue<Short8> rhs);
1081 // friend RValue<Short8> operator&=(const Short8 &lhs, RValue<Short8> rhs);
1082 // friend RValue<Short8> operator|=(const Short8 &lhs, RValue<Short8> rhs);
1083 // friend RValue<Short8> operator^=(const Short8 &lhs, RValue<Short8> rhs);
1084 // friend RValue<Short8> operator<<=(const Short8 &lhs, RValue<Short8> rhs);
1085 // friend RValue<Short8> operator>>=(const Short8 &lhs, RValue<Short8> rhs);
1086 // friend RValue<Short8> operator+(RValue<Short8> val);
1087 // friend RValue<Short8> operator-(RValue<Short8> val);
1088 // friend RValue<Short8> operator~(RValue<Short8> val);
John Bauman89401822014-05-06 15:04:28 -04001089 // friend RValue<Short8> operator++(const Short8 &val, int); // Post-increment
1090 // friend const Short8 &operator++(const Short8 &val); // Pre-increment
1091 // friend RValue<Short8> operator--(const Short8 &val, int); // Post-decrement
1092 // friend const Short8 &operator--(const Short8 &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001093 // friend RValue<Bool> operator<(RValue<Short8> lhs, RValue<Short8> rhs);
1094 // friend RValue<Bool> operator<=(RValue<Short8> lhs, RValue<Short8> rhs);
1095 // friend RValue<Bool> operator>(RValue<Short8> lhs, RValue<Short8> rhs);
1096 // friend RValue<Bool> operator>=(RValue<Short8> lhs, RValue<Short8> rhs);
1097 // friend RValue<Bool> operator!=(RValue<Short8> lhs, RValue<Short8> rhs);
1098 // friend RValue<Bool> operator==(RValue<Short8> lhs, RValue<Short8> rhs);
John Bauman89401822014-05-06 15:04:28 -04001099
John Bauman19bac1e2014-05-06 15:23:49 -04001100 friend RValue<Short8> Concatenate(RValue<Short4> lo, RValue<Short4> hi);
John Bauman89401822014-05-06 15:04:28 -04001101
John Bauman19bac1e2014-05-06 15:23:49 -04001102 friend RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y);
1103 friend RValue<Int4> MulAdd(RValue<Short8> x, RValue<Short8> y);
John Bauman89401822014-05-06 15:04:28 -04001104
John Bauman19bac1e2014-05-06 15:23:49 -04001105 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001106 };
1107
John Bauman66b8ab22014-05-06 15:57:45 -04001108 class UShort8 : public Variable<UShort8>
John Bauman89401822014-05-06 15:04:28 -04001109 {
1110 public:
1111 // UShort8();
1112 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 -04001113 UShort8(RValue<UShort8> rhs);
John Bauman89401822014-05-06 15:04:28 -04001114 // UShort8(const UShort8 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001115 // UShort8(const Reference<UShort8> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001116
John Bauman19bac1e2014-05-06 15:23:49 -04001117 RValue<UShort8> operator=(RValue<UShort8> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001118 RValue<UShort8> operator=(const UShort8 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001119 RValue<UShort8> operator=(const Reference<UShort8> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001120
John Bauman19bac1e2014-05-06 15:23:49 -04001121 friend RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs);
1122 // friend RValue<UShort8> operator-(RValue<UShort8> lhs, RValue<UShort8> rhs);
1123 friend RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs);
1124 // friend RValue<UShort8> operator/(RValue<UShort8> lhs, RValue<UShort8> rhs);
1125 // friend RValue<UShort8> operator%(RValue<UShort8> lhs, RValue<UShort8> rhs);
1126 friend RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs);
1127 // friend RValue<UShort8> operator|(RValue<UShort8> lhs, RValue<UShort8> rhs);
1128 // friend RValue<UShort8> operator^(RValue<UShort8> lhs, RValue<UShort8> rhs);
1129 friend RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs);
1130 friend RValue<UShort8> operator>>(RValue<UShort8> lhs, unsigned char rhs);
1131 // friend RValue<UShort8> operator<<(RValue<UShort8> lhs, RValue<UShort8> rhs);
1132 // friend RValue<UShort8> operator>>(RValue<UShort8> lhs, RValue<UShort8> rhs);
1133 friend RValue<UShort8> operator+=(const UShort8 &lhs, RValue<UShort8> rhs);
1134 // friend RValue<UShort8> operator-=(const UShort8 &lhs, RValue<UShort8> rhs);
1135 // friend RValue<UShort8> operator*=(const UShort8 &lhs, RValue<UShort8> rhs);
1136 // friend RValue<UShort8> operator/=(const UShort8 &lhs, RValue<UShort8> rhs);
1137 // friend RValue<UShort8> operator%=(const UShort8 &lhs, RValue<UShort8> rhs);
1138 // friend RValue<UShort8> operator&=(const UShort8 &lhs, RValue<UShort8> rhs);
1139 // friend RValue<UShort8> operator|=(const UShort8 &lhs, RValue<UShort8> rhs);
1140 // friend RValue<UShort8> operator^=(const UShort8 &lhs, RValue<UShort8> rhs);
1141 // friend RValue<UShort8> operator<<=(const UShort8 &lhs, RValue<UShort8> rhs);
1142 // friend RValue<UShort8> operator>>=(const UShort8 &lhs, RValue<UShort8> rhs);
1143 // friend RValue<UShort8> operator+(RValue<UShort8> val);
1144 // friend RValue<UShort8> operator-(RValue<UShort8> val);
1145 friend RValue<UShort8> operator~(RValue<UShort8> val);
John Bauman89401822014-05-06 15:04:28 -04001146 // friend RValue<UShort8> operator++(const UShort8 &val, int); // Post-increment
1147 // friend const UShort8 &operator++(const UShort8 &val); // Pre-increment
1148 // friend RValue<UShort8> operator--(const UShort8 &val, int); // Post-decrement
1149 // friend const UShort8 &operator--(const UShort8 &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001150 // friend RValue<Bool> operator<(RValue<UShort8> lhs, RValue<UShort8> rhs);
1151 // friend RValue<Bool> operator<=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1152 // friend RValue<Bool> operator>(RValue<UShort8> lhs, RValue<UShort8> rhs);
1153 // friend RValue<Bool> operator>=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1154 // friend RValue<Bool> operator!=(RValue<UShort8> lhs, RValue<UShort8> rhs);
1155 // friend RValue<Bool> operator==(RValue<UShort8> lhs, RValue<UShort8> rhs);
John Bauman89401822014-05-06 15:04:28 -04001156
John Bauman19bac1e2014-05-06 15:23:49 -04001157 friend RValue<UShort8> Swizzle(RValue<UShort8> x, char select0, char select1, char select2, char select3, char select4, char select5, char select6, char select7);
1158 friend RValue<UShort8> Concatenate(RValue<UShort4> lo, RValue<UShort4> hi);
John Bauman89401822014-05-06 15:04:28 -04001159
John Bauman19bac1e2014-05-06 15:23:49 -04001160 friend RValue<UShort8> MulHigh(RValue<UShort8> x, RValue<UShort8> y);
John Bauman89401822014-05-06 15:04:28 -04001161
John Bauman19bac1e2014-05-06 15:23:49 -04001162 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001163 };
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 friend RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs);
1196 friend RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs);
1197 friend RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs);
1198 friend RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs);
1199 friend RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs);
1200 friend RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs);
1201 friend RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs);
1202 friend RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs);
1203 friend RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs);
1204 friend RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs);
1205 friend RValue<Int> operator+=(const Int &lhs, RValue<Int> rhs);
1206 friend RValue<Int> operator-=(const Int &lhs, RValue<Int> rhs);
1207 friend RValue<Int> operator*=(const Int &lhs, RValue<Int> rhs);
1208 friend RValue<Int> operator/=(const Int &lhs, RValue<Int> rhs);
1209 friend RValue<Int> operator%=(const Int &lhs, RValue<Int> rhs);
1210 friend RValue<Int> operator&=(const Int &lhs, RValue<Int> rhs);
1211 friend RValue<Int> operator|=(const Int &lhs, RValue<Int> rhs);
1212 friend RValue<Int> operator^=(const Int &lhs, RValue<Int> rhs);
1213 friend RValue<Int> operator<<=(const Int &lhs, RValue<Int> rhs);
1214 friend RValue<Int> operator>>=(const Int &lhs, RValue<Int> rhs);
1215 friend RValue<Int> operator+(RValue<Int> val);
1216 friend RValue<Int> operator-(RValue<Int> val);
1217 friend RValue<Int> operator~(RValue<Int> val);
John Bauman89401822014-05-06 15:04:28 -04001218 friend RValue<Int> operator++(const Int &val, int); // Post-increment
1219 friend const Int &operator++(const Int &val); // Pre-increment
1220 friend RValue<Int> operator--(const Int &val, int); // Post-decrement
1221 friend const Int &operator--(const Int &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001222 friend RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs);
1223 friend RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs);
1224 friend RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs);
1225 friend RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs);
1226 friend RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs);
1227 friend RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs);
John Bauman89401822014-05-06 15:04:28 -04001228
John Bauman19bac1e2014-05-06 15:23:49 -04001229 friend RValue<Int> Max(RValue<Int> x, RValue<Int> y);
1230 friend RValue<Int> Min(RValue<Int> x, RValue<Int> y);
1231 friend RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max);
John Bauman89401822014-05-06 15:04:28 -04001232
John Bauman19bac1e2014-05-06 15:23:49 -04001233 friend RValue<Int> RoundInt(RValue<Float> cast);
1234
1235 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001236 };
1237
John Bauman66b8ab22014-05-06 15:57:45 -04001238 class Long : public Variable<Long>
John Bauman89401822014-05-06 15:04:28 -04001239 {
1240 public:
1241 // explicit Long(llvm::Argument *argument);
1242
John Bauman19bac1e2014-05-06 15:23:49 -04001243 // explicit Long(RValue<Short> cast);
1244 // explicit Long(RValue<UShort> cast);
1245 explicit Long(RValue<Int> cast);
1246 explicit Long(RValue<UInt> cast);
1247 // explicit Long(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001248
1249 Long();
1250 // Long(qword x);
John Bauman19bac1e2014-05-06 15:23:49 -04001251 Long(RValue<Long> rhs);
1252 // Long(RValue<ULong> rhs);
John Bauman89401822014-05-06 15:04:28 -04001253 // Long(const Long &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001254 // Long(const Reference<Long> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001255 // Long(const ULong &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001256 // Long(const Reference<ULong> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001257
1258 RValue<Long> operator=(int64_t rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001259 RValue<Long> operator=(RValue<Long> rhs) const;
1260 // RValue<Long> operator=(RValue<ULong> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001261 RValue<Long> operator=(const Long &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001262 RValue<Long> operator=(const Reference<Long> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001263 // RValue<Long> operator=(const ULong &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001264 // RValue<Long> operator=(const Reference<ULong> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001265
John Bauman19bac1e2014-05-06 15:23:49 -04001266 friend RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs);
1267 friend RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs);
1268 // friend RValue<Long> operator*(RValue<Long> lhs, RValue<Long> rhs);
1269 // friend RValue<Long> operator/(RValue<Long> lhs, RValue<Long> rhs);
1270 // friend RValue<Long> operator%(RValue<Long> lhs, RValue<Long> rhs);
1271 // friend RValue<Long> operator&(RValue<Long> lhs, RValue<Long> rhs);
1272 // friend RValue<Long> operator|(RValue<Long> lhs, RValue<Long> rhs);
1273 // friend RValue<Long> operator^(RValue<Long> lhs, RValue<Long> rhs);
1274 // friend RValue<Long> operator<<(RValue<Long> lhs, RValue<Long> rhs);
1275 // friend RValue<Long> operator>>(RValue<Long> lhs, RValue<Long> rhs);
1276 friend RValue<Long> operator+=(const Long &lhs, RValue<Long> rhs);
1277 friend RValue<Long> operator-=(const Long &lhs, RValue<Long> rhs);
1278 // friend RValue<Long> operator*=(const Long &lhs, RValue<Long> rhs);
1279 // friend RValue<Long> operator/=(const Long &lhs, RValue<Long> rhs);
1280 // friend RValue<Long> operator%=(const Long &lhs, RValue<Long> rhs);
1281 // friend RValue<Long> operator&=(const Long &lhs, RValue<Long> rhs);
1282 // friend RValue<Long> operator|=(const Long &lhs, RValue<Long> rhs);
1283 // friend RValue<Long> operator^=(const Long &lhs, RValue<Long> rhs);
1284 // friend RValue<Long> operator<<=(const Long &lhs, RValue<Long> rhs);
1285 // friend RValue<Long> operator>>=(const Long &lhs, RValue<Long> rhs);
1286 // friend RValue<Long> operator+(RValue<Long> val);
1287 // friend RValue<Long> operator-(RValue<Long> val);
1288 // friend RValue<Long> operator~(RValue<Long> val);
John Bauman89401822014-05-06 15:04:28 -04001289 // friend RValue<Long> operator++(const Long &val, int); // Post-increment
1290 // friend const Long &operator++(const Long &val); // Pre-increment
1291 // friend RValue<Long> operator--(const Long &val, int); // Post-decrement
1292 // friend const Long &operator--(const Long &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001293 // friend RValue<Bool> operator<(RValue<Long> lhs, RValue<Long> rhs);
1294 // friend RValue<Bool> operator<=(RValue<Long> lhs, RValue<Long> rhs);
1295 // friend RValue<Bool> operator>(RValue<Long> lhs, RValue<Long> rhs);
1296 // friend RValue<Bool> operator>=(RValue<Long> lhs, RValue<Long> rhs);
1297 // friend RValue<Bool> operator!=(RValue<Long> lhs, RValue<Long> rhs);
1298 // friend RValue<Bool> operator==(RValue<Long> lhs, RValue<Long> rhs);
John Bauman89401822014-05-06 15:04:28 -04001299
John Bauman19bac1e2014-05-06 15:23:49 -04001300 // friend RValue<Long> RoundLong(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001301
John Bauman66b8ab22014-05-06 15:57:45 -04001302 friend RValue<Long> AddAtomic( RValue<Pointer<Long> > x, RValue<Long> y);
John Bauman89401822014-05-06 15:04:28 -04001303
John Bauman19bac1e2014-05-06 15:23:49 -04001304 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001305 };
1306
John Bauman66b8ab22014-05-06 15:57:45 -04001307 class Long1 : public Variable<Long1>
John Bauman89401822014-05-06 15:04:28 -04001308 {
1309 public:
1310 // explicit Long1(llvm::Argument *argument);
1311
John Bauman19bac1e2014-05-06 15:23:49 -04001312 // explicit Long1(RValue<Short> cast);
1313 // explicit Long1(RValue<UShort> cast);
1314 // explicit Long1(RValue<Int> cast);
1315 // explicit Long1(RValue<UInt> cast);
1316 // explicit Long1(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001317
1318 explicit Long1(const Reference<UInt> &cast);
1319
1320 // Long1();
1321 // Long1(qword x);
John Bauman19bac1e2014-05-06 15:23:49 -04001322 Long1(RValue<Long1> rhs);
1323 // Long1(RValue<ULong1> rhs);
John Bauman89401822014-05-06 15:04:28 -04001324 // Long1(const Long1 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001325 // Long1(const Reference<Long1> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001326 // Long1(const ULong1 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001327 // Long1(const Reference<ULong1> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001328
1329 // RValue<Long1> operator=(qword rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001330 // RValue<Long1> operator=(RValue<Long1> rhs) const;
1331 // RValue<Long1> operator=(RValue<ULong1> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001332 // RValue<Long1> operator=(const Long1 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001333 // RValue<Long1> operator=(const Reference<Long1> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001334 // RValue<Long1> operator=(const ULong1 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001335 // RValue<Long1> operator=(const Reference<ULong1> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001336
John Bauman19bac1e2014-05-06 15:23:49 -04001337 // friend RValue<Long1> operator+(RValue<Long1> lhs, RValue<Long1> rhs);
1338 // friend RValue<Long1> operator-(RValue<Long1> lhs, RValue<Long1> rhs);
1339 // friend RValue<Long1> operator*(RValue<Long1> lhs, RValue<Long1> rhs);
1340 // friend RValue<Long1> operator/(RValue<Long1> lhs, RValue<Long1> rhs);
1341 // friend RValue<Long1> operator%(RValue<Long1> lhs, RValue<Long1> rhs);
1342 // friend RValue<Long1> operator&(RValue<Long1> lhs, RValue<Long1> rhs);
1343 // friend RValue<Long1> operator|(RValue<Long1> lhs, RValue<Long1> rhs);
1344 // friend RValue<Long1> operator^(RValue<Long1> lhs, RValue<Long1> rhs);
1345 // friend RValue<Long1> operator<<(RValue<Long1> lhs, RValue<Long1> rhs);
1346 // friend RValue<Long1> operator>>(RValue<Long1> lhs, RValue<Long1> rhs);
1347 // friend RValue<Long1> operator+=(const Long1 &lhs, RValue<Long1> rhs);
1348 // friend RValue<Long1> operator-=(const Long1 &lhs, RValue<Long1> rhs);
1349 // friend RValue<Long1> operator*=(const Long1 &lhs, RValue<Long1> rhs);
1350 // friend RValue<Long1> operator/=(const Long1 &lhs, RValue<Long1> rhs);
1351 // friend RValue<Long1> operator%=(const Long1 &lhs, RValue<Long1> rhs);
1352 // friend RValue<Long1> operator&=(const Long1 &lhs, RValue<Long1> rhs);
1353 // friend RValue<Long1> operator|=(const Long1 &lhs, RValue<Long1> rhs);
1354 // friend RValue<Long1> operator^=(const Long1 &lhs, RValue<Long1> rhs);
1355 // friend RValue<Long1> operator<<=(const Long1 &lhs, RValue<Long1> rhs);
1356 // friend RValue<Long1> operator>>=(const Long1 &lhs, RValue<Long1> rhs);
1357 // friend RValue<Long1> operator+(RValue<Long1> val);
1358 // friend RValue<Long1> operator-(RValue<Long1> val);
1359 // friend RValue<Long1> operator~(RValue<Long1> val);
John Bauman89401822014-05-06 15:04:28 -04001360 // friend RValue<Long1> operator++(const Long1 &val, int); // Post-increment
1361 // friend const Long1 &operator++(const Long1 &val); // Pre-increment
1362 // friend RValue<Long1> operator--(const Long1 &val, int); // Post-decrement
1363 // friend const Long1 &operator--(const Long1 &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001364 // friend RValue<Bool> operator<(RValue<Long1> lhs, RValue<Long1> rhs);
1365 // friend RValue<Bool> operator<=(RValue<Long1> lhs, RValue<Long1> rhs);
1366 // friend RValue<Bool> operator>(RValue<Long1> lhs, RValue<Long1> rhs);
1367 // friend RValue<Bool> operator>=(RValue<Long1> lhs, RValue<Long1> rhs);
1368 // friend RValue<Bool> operator!=(RValue<Long1> lhs, RValue<Long1> rhs);
1369 // friend RValue<Bool> operator==(RValue<Long1> lhs, RValue<Long1> rhs);
John Bauman89401822014-05-06 15:04:28 -04001370
John Bauman19bac1e2014-05-06 15:23:49 -04001371 // friend RValue<Long1> RoundLong1(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001372
John Bauman19bac1e2014-05-06 15:23:49 -04001373 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001374 };
1375
John Bauman66b8ab22014-05-06 15:57:45 -04001376 class Long2 : public Variable<Long2>
John Bauman89401822014-05-06 15:04:28 -04001377 {
1378 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001379 // explicit Long2(RValue<Long> cast);
1380 // explicit Long2(RValue<Long1> cast);
John Bauman89401822014-05-06 15:04:28 -04001381
1382 // Long2();
1383 // Long2(int x, int y);
John Bauman19bac1e2014-05-06 15:23:49 -04001384 // Long2(RValue<Long2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001385 // Long2(const Long2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001386 // Long2(const Reference<Long2> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001387
John Bauman19bac1e2014-05-06 15:23:49 -04001388 // RValue<Long2> operator=(RValue<Long2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001389 // RValue<Long2> operator=(const Long2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001390 // RValue<Long2> operator=(const Reference<Long2 &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001391
John Bauman19bac1e2014-05-06 15:23:49 -04001392 // friend RValue<Long2> operator+(RValue<Long2> lhs, RValue<Long2> rhs);
1393 // friend RValue<Long2> operator-(RValue<Long2> lhs, RValue<Long2> rhs);
1394 // friend RValue<Long2> operator*(RValue<Long2> lhs, RValue<Long2> rhs);
1395 // friend RValue<Long2> operator/(RValue<Long2> lhs, RValue<Long2> rhs);
1396 // friend RValue<Long2> operator%(RValue<Long2> lhs, RValue<Long2> rhs);
1397 // friend RValue<Long2> operator&(RValue<Long2> lhs, RValue<Long2> rhs);
1398 // friend RValue<Long2> operator|(RValue<Long2> lhs, RValue<Long2> rhs);
1399 // friend RValue<Long2> operator^(RValue<Long2> lhs, RValue<Long2> rhs);
1400 // friend RValue<Long2> operator<<(RValue<Long2> lhs, unsigned char rhs);
1401 // friend RValue<Long2> operator>>(RValue<Long2> lhs, unsigned char rhs);
1402 // friend RValue<Long2> operator<<(RValue<Long2> lhs, RValue<Long1> rhs);
1403 // friend RValue<Long2> operator>>(RValue<Long2> lhs, RValue<Long1> rhs);
1404 // friend RValue<Long2> operator+=(const Long2 &lhs, RValue<Long2> rhs);
1405 // friend RValue<Long2> operator-=(const Long2 &lhs, RValue<Long2> rhs);
1406 // friend RValue<Long2> operator*=(const Long2 &lhs, RValue<Long2> rhs);
1407 // friend RValue<Long2> operator/=(const Long2 &lhs, RValue<Long2> rhs);
1408 // friend RValue<Long2> operator%=(const Long2 &lhs, RValue<Long2> rhs);
1409 // friend RValue<Long2> operator&=(const Long2 &lhs, RValue<Long2> rhs);
1410 // friend RValue<Long2> operator|=(const Long2 &lhs, RValue<Long2> rhs);
1411 // friend RValue<Long2> operator^=(const Long2 &lhs, RValue<Long2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001412 // friend RValue<Long2> operator<<=(const Long2 &lhs, unsigned char rhs);
1413 // friend RValue<Long2> operator>>=(const Long2 &lhs, unsigned char rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001414 // friend RValue<Long2> operator<<=(const Long2 &lhs, RValue<Long1> rhs);
1415 // friend RValue<Long2> operator>>=(const Long2 &lhs, RValue<Long1> rhs);
1416 // friend RValue<Long2> operator+(RValue<Long2> val);
1417 // friend RValue<Long2> operator-(RValue<Long2> val);
1418 // friend RValue<Long2> operator~(RValue<Long2> val);
John Bauman89401822014-05-06 15:04:28 -04001419 // friend RValue<Long2> operator++(const Long2 &val, int); // Post-increment
1420 // friend const Long2 &operator++(const Long2 &val); // Pre-increment
1421 // friend RValue<Long2> operator--(const Long2 &val, int); // Post-decrement
1422 // friend const Long2 &operator--(const Long2 &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001423 // friend RValue<Bool> operator<(RValue<Long2> lhs, RValue<Long2> rhs);
1424 // friend RValue<Bool> operator<=(RValue<Long2> lhs, RValue<Long2> rhs);
1425 // friend RValue<Bool> operator>(RValue<Long2> lhs, RValue<Long2> rhs);
1426 // friend RValue<Bool> operator>=(RValue<Long2> lhs, RValue<Long2> rhs);
1427 // friend RValue<Bool> operator!=(RValue<Long2> lhs, RValue<Long2> rhs);
1428 // friend RValue<Bool> operator==(RValue<Long2> lhs, RValue<Long2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001429
John Bauman19bac1e2014-05-06 15:23:49 -04001430 // friend RValue<Long2> RoundInt(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001431
John Bauman19bac1e2014-05-06 15:23:49 -04001432 // friend RValue<Long2> UnpackLow(RValue<Long2> x, RValue<Long2> y);
1433 friend RValue<Long2> UnpackHigh(RValue<Long2> x, RValue<Long2> y);
1434 // friend RValue<Int> Extract(RValue<Long2> val, int i);
1435 // friend RValue<Long2> Insert(RValue<Long2> val, RValue<Int> element, int i);
John Bauman89401822014-05-06 15:04:28 -04001436
John Bauman19bac1e2014-05-06 15:23:49 -04001437 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001438 };
1439
John Bauman66b8ab22014-05-06 15:57:45 -04001440 class UInt : public Variable<UInt>
John Bauman89401822014-05-06 15:04:28 -04001441 {
1442 public:
1443 explicit UInt(llvm::Argument *argument);
1444
John Bauman19bac1e2014-05-06 15:23:49 -04001445 explicit UInt(RValue<UShort> cast);
1446 explicit UInt(RValue<Long> cast);
1447 explicit UInt(RValue<Float> cast);
John Bauman89401822014-05-06 15:04:28 -04001448
1449 UInt();
1450 UInt(int x);
1451 UInt(unsigned int x);
John Bauman19bac1e2014-05-06 15:23:49 -04001452 UInt(RValue<UInt> rhs);
1453 UInt(RValue<Int> rhs);
John Bauman89401822014-05-06 15:04:28 -04001454 UInt(const UInt &rhs);
1455 UInt(const Int &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001456 UInt(const Reference<UInt> &rhs);
1457 UInt(const Reference<Int> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001458
1459 RValue<UInt> operator=(unsigned int rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001460 RValue<UInt> operator=(RValue<UInt> rhs) const;
1461 RValue<UInt> operator=(RValue<Int> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001462 RValue<UInt> operator=(const UInt &rhs) const;
1463 RValue<UInt> operator=(const Int &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001464 RValue<UInt> operator=(const Reference<UInt> &rhs) const;
1465 RValue<UInt> operator=(const Reference<Int> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001466
John Bauman19bac1e2014-05-06 15:23:49 -04001467 friend RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs);
1468 friend RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs);
1469 friend RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs);
1470 friend RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs);
1471 friend RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs);
1472 friend RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs);
1473 friend RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs);
1474 friend RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs);
1475 friend RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs);
1476 friend RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs);
1477 friend RValue<UInt> operator+=(const UInt &lhs, RValue<UInt> rhs);
1478 friend RValue<UInt> operator-=(const UInt &lhs, RValue<UInt> rhs);
1479 friend RValue<UInt> operator*=(const UInt &lhs, RValue<UInt> rhs);
1480 friend RValue<UInt> operator/=(const UInt &lhs, RValue<UInt> rhs);
1481 friend RValue<UInt> operator%=(const UInt &lhs, RValue<UInt> rhs);
1482 friend RValue<UInt> operator&=(const UInt &lhs, RValue<UInt> rhs);
1483 friend RValue<UInt> operator|=(const UInt &lhs, RValue<UInt> rhs);
1484 friend RValue<UInt> operator^=(const UInt &lhs, RValue<UInt> rhs);
1485 friend RValue<UInt> operator<<=(const UInt &lhs, RValue<UInt> rhs);
1486 friend RValue<UInt> operator>>=(const UInt &lhs, RValue<UInt> rhs);
1487 friend RValue<UInt> operator+(RValue<UInt> val);
1488 friend RValue<UInt> operator-(RValue<UInt> val);
1489 friend RValue<UInt> operator~(RValue<UInt> val);
John Bauman89401822014-05-06 15:04:28 -04001490 friend RValue<UInt> operator++(const UInt &val, int); // Post-increment
1491 friend const UInt &operator++(const UInt &val); // Pre-increment
1492 friend RValue<UInt> operator--(const UInt &val, int); // Post-decrement
1493 friend const UInt &operator--(const UInt &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001494 friend RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs);
1495 friend RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs);
1496 friend RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs);
1497 friend RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs);
1498 friend RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs);
1499 friend RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs);
John Bauman89401822014-05-06 15:04:28 -04001500
John Bauman19bac1e2014-05-06 15:23:49 -04001501 friend RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y);
1502 friend RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y);
1503 friend RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max);
John Bauman89401822014-05-06 15:04:28 -04001504
John Bauman19bac1e2014-05-06 15:23:49 -04001505 // friend RValue<UInt> RoundUInt(RValue<Float> cast);
1506
1507 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001508 };
1509
John Bauman66b8ab22014-05-06 15:57:45 -04001510 class Int2 : public Variable<Int2>
John Bauman89401822014-05-06 15:04:28 -04001511 {
1512 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001513 // explicit Int2(RValue<Int> cast);
1514 explicit Int2(RValue<Int4> cast);
John Bauman89401822014-05-06 15:04:28 -04001515
1516 Int2();
1517 Int2(int x, int y);
John Bauman19bac1e2014-05-06 15:23:49 -04001518 Int2(RValue<Int2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001519 Int2(const Int2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001520 Int2(const Reference<Int2> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001521
John Bauman19bac1e2014-05-06 15:23:49 -04001522 RValue<Int2> operator=(RValue<Int2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001523 RValue<Int2> operator=(const Int2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001524 RValue<Int2> operator=(const Reference<Int2> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001525
John Bauman19bac1e2014-05-06 15:23:49 -04001526 friend RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs);
1527 friend RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs);
1528 // friend RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs);
1529 // friend RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs);
1530 // friend RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs);
1531 friend RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs);
1532 friend RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs);
1533 friend RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs);
1534 friend RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs);
1535 friend RValue<Int2> operator>>(RValue<Int2> lhs, unsigned char rhs);
1536 friend RValue<Int2> operator<<(RValue<Int2> lhs, RValue<Long1> rhs);
1537 friend RValue<Int2> operator>>(RValue<Int2> lhs, RValue<Long1> rhs);
1538 friend RValue<Int2> operator+=(const Int2 &lhs, RValue<Int2> rhs);
1539 friend RValue<Int2> operator-=(const Int2 &lhs, RValue<Int2> rhs);
1540 // friend RValue<Int2> operator*=(const Int2 &lhs, RValue<Int2> rhs);
1541 // friend RValue<Int2> operator/=(const Int2 &lhs, RValue<Int2> rhs);
1542 // friend RValue<Int2> operator%=(const Int2 &lhs, RValue<Int2> rhs);
1543 friend RValue<Int2> operator&=(const Int2 &lhs, RValue<Int2> rhs);
1544 friend RValue<Int2> operator|=(const Int2 &lhs, RValue<Int2> rhs);
1545 friend RValue<Int2> operator^=(const Int2 &lhs, RValue<Int2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001546 friend RValue<Int2> operator<<=(const Int2 &lhs, unsigned char rhs);
1547 friend RValue<Int2> operator>>=(const Int2 &lhs, unsigned char rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001548 friend RValue<Int2> operator<<=(const Int2 &lhs, RValue<Long1> rhs);
1549 friend RValue<Int2> operator>>=(const Int2 &lhs, RValue<Long1> rhs);
1550 // friend RValue<Int2> operator+(RValue<Int2> val);
1551 // friend RValue<Int2> operator-(RValue<Int2> val);
1552 friend RValue<Int2> operator~(RValue<Int2> val);
John Bauman89401822014-05-06 15:04:28 -04001553 // friend RValue<Int2> operator++(const Int2 &val, int); // Post-increment
1554 // friend const Int2 &operator++(const Int2 &val); // Pre-increment
1555 // friend RValue<Int2> operator--(const Int2 &val, int); // Post-decrement
1556 // friend const Int2 &operator--(const Int2 &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001557 // friend RValue<Bool> operator<(RValue<Int2> lhs, RValue<Int2> rhs);
1558 // friend RValue<Bool> operator<=(RValue<Int2> lhs, RValue<Int2> rhs);
1559 // friend RValue<Bool> operator>(RValue<Int2> lhs, RValue<Int2> rhs);
1560 // friend RValue<Bool> operator>=(RValue<Int2> lhs, RValue<Int2> rhs);
1561 // friend RValue<Bool> operator!=(RValue<Int2> lhs, RValue<Int2> rhs);
1562 // friend RValue<Bool> operator==(RValue<Int2> lhs, RValue<Int2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001563
John Bauman19bac1e2014-05-06 15:23:49 -04001564 // friend RValue<Int2> RoundInt(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001565
John Bauman19bac1e2014-05-06 15:23:49 -04001566 friend RValue<Long1> UnpackLow(RValue<Int2> x, RValue<Int2> y);
1567 friend RValue<Long1> UnpackHigh(RValue<Int2> x, RValue<Int2> y);
1568 friend RValue<Int> Extract(RValue<Int2> val, int i);
1569 // friend RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i);
John Bauman89401822014-05-06 15:04:28 -04001570
John Bauman19bac1e2014-05-06 15:23:49 -04001571 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001572 };
1573
John Bauman66b8ab22014-05-06 15:57:45 -04001574 class UInt2 : public Variable<UInt2>
John Bauman89401822014-05-06 15:04:28 -04001575 {
1576 public:
1577 UInt2();
1578 UInt2(unsigned int x, unsigned int y);
John Bauman19bac1e2014-05-06 15:23:49 -04001579 UInt2(RValue<UInt2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001580 UInt2(const UInt2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001581 UInt2(const Reference<UInt2> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001582
John Bauman19bac1e2014-05-06 15:23:49 -04001583 RValue<UInt2> operator=(RValue<UInt2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001584 RValue<UInt2> operator=(const UInt2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001585 RValue<UInt2> operator=(const Reference<UInt2> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001586
John Bauman19bac1e2014-05-06 15:23:49 -04001587 friend RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs);
1588 friend RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs);
1589 // friend RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs);
1590 // friend RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs);
1591 // friend RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs);
1592 friend RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs);
1593 friend RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs);
1594 friend RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs);
1595 friend RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs);
1596 friend RValue<UInt2> operator>>(RValue<UInt2> lhs, unsigned char rhs);
1597 friend RValue<UInt2> operator<<(RValue<UInt2> lhs, RValue<Long1> rhs);
1598 friend RValue<UInt2> operator>>(RValue<UInt2> lhs, RValue<Long1> rhs);
1599 friend RValue<UInt2> operator+=(const UInt2 &lhs, RValue<UInt2> rhs);
1600 friend RValue<UInt2> operator-=(const UInt2 &lhs, RValue<UInt2> rhs);
1601 // friend RValue<UInt2> operator*=(const UInt2 &lhs, RValue<UInt2> rhs);
1602 // friend RValue<UInt2> operator/=(const UInt2 &lhs, RValue<UInt2> rhs);
1603 // friend RValue<UInt2> operator%=(const UInt2 &lhs, RValue<UInt2> rhs);
1604 friend RValue<UInt2> operator&=(const UInt2 &lhs, RValue<UInt2> rhs);
1605 friend RValue<UInt2> operator|=(const UInt2 &lhs, RValue<UInt2> rhs);
1606 friend RValue<UInt2> operator^=(const UInt2 &lhs, RValue<UInt2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001607 friend RValue<UInt2> operator<<=(const UInt2 &lhs, unsigned char rhs);
1608 friend RValue<UInt2> operator>>=(const UInt2 &lhs, unsigned char rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001609 friend RValue<UInt2> operator<<=(const UInt2 &lhs, RValue<Long1> rhs);
1610 friend RValue<UInt2> operator>>=(const UInt2 &lhs, RValue<Long1> rhs);
1611 // friend RValue<UInt2> operator+(RValue<UInt2> val);
1612 // friend RValue<UInt2> operator-(RValue<UInt2> val);
1613 friend RValue<UInt2> operator~(RValue<UInt2> val);
John Bauman89401822014-05-06 15:04:28 -04001614 // friend RValue<UInt2> operator++(const UInt2 &val, int); // Post-increment
1615 // friend const UInt2 &operator++(const UInt2 &val); // Pre-increment
1616 // friend RValue<UInt2> operator--(const UInt2 &val, int); // Post-decrement
1617 // friend const UInt2 &operator--(const UInt2 &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001618 // friend RValue<Bool> operator<(RValue<UInt2> lhs, RValue<UInt2> rhs);
1619 // friend RValue<Bool> operator<=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1620 // friend RValue<Bool> operator>(RValue<UInt2> lhs, RValue<UInt2> rhs);
1621 // friend RValue<Bool> operator>=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1622 // friend RValue<Bool> operator!=(RValue<UInt2> lhs, RValue<UInt2> rhs);
1623 // friend RValue<Bool> operator==(RValue<UInt2> lhs, RValue<UInt2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001624
John Bauman19bac1e2014-05-06 15:23:49 -04001625 // friend RValue<UInt2> RoundInt(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001626
John Bauman19bac1e2014-05-06 15:23:49 -04001627 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001628 };
1629
John Bauman66b8ab22014-05-06 15:57:45 -04001630 class Int4 : public Variable<Int4>
John Bauman89401822014-05-06 15:04:28 -04001631 {
1632 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001633 explicit Int4(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001634
1635 Int4();
1636 Int4(int xyzw);
1637 Int4(int x, int yzw);
1638 Int4(int x, int y, int zw);
1639 Int4(int x, int y, int z, int w);
John Bauman19bac1e2014-05-06 15:23:49 -04001640 Int4(RValue<Int4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001641 Int4(const Int4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001642 Int4(const Reference<Int4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001643 Int4(RValue<UInt4> rhs);
1644 Int4(const UInt4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001645 Int4(const Reference<UInt4> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001646
John Bauman19bac1e2014-05-06 15:23:49 -04001647 RValue<Int4> operator=(RValue<Int4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001648 RValue<Int4> operator=(const Int4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001649 RValue<Int4> operator=(const Reference<Int4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001650
John Bauman19bac1e2014-05-06 15:23:49 -04001651 friend RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs);
1652 friend RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs);
1653 friend RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs);
1654 // friend RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs);
1655 // friend RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs);
1656 friend RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs);
1657 friend RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs);
1658 friend RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs);
1659 friend RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs);
1660 friend RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs);
1661 friend RValue<Int4> operator+=(const Int4 &lhs, RValue<Int4> rhs);
1662 friend RValue<Int4> operator-=(const Int4 &lhs, RValue<Int4> rhs);
1663 friend RValue<Int4> operator*=(const Int4 &lhs, RValue<Int4> rhs);
1664 // friend RValue<Int4> operator/=(const Int4 &lhs, RValue<Int4> rhs);
1665 // friend RValue<Int4> operator%=(const Int4 &lhs, RValue<Int4> rhs);
1666 friend RValue<Int4> operator&=(const Int4 &lhs, RValue<Int4> rhs);
1667 friend RValue<Int4> operator|=(const Int4 &lhs, RValue<Int4> rhs);
1668 friend RValue<Int4> operator^=(const Int4 &lhs, RValue<Int4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001669 friend RValue<Int4> operator<<=(const Int4 &lhs, unsigned char rhs);
1670 friend RValue<Int4> operator>>=(const Int4 &lhs, unsigned char rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001671 friend RValue<Int4> operator+(RValue<Int4> val);
1672 friend RValue<Int4> operator-(RValue<Int4> val);
1673 friend RValue<Int4> operator~(RValue<Int4> val);
John Bauman89401822014-05-06 15:04:28 -04001674 // friend RValue<Int4> operator++(const Int4 &val, int); // Post-increment
1675 // friend const Int4 &operator++(const Int4 &val); // Pre-increment
1676 // friend RValue<Int4> operator--(const Int4 &val, int); // Post-decrement
1677 // friend const Int4 &operator--(const Int4 &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001678 // friend RValue<Bool> operator<(RValue<Int4> lhs, RValue<Int4> rhs);
1679 // friend RValue<Bool> operator<=(RValue<Int4> lhs, RValue<Int4> rhs);
1680 // friend RValue<Bool> operator>(RValue<Int4> lhs, RValue<Int4> rhs);
1681 // friend RValue<Bool> operator>=(RValue<Int4> lhs, RValue<Int4> rhs);
1682 // friend RValue<Bool> operator!=(RValue<Int4> lhs, RValue<Int4> rhs);
1683 // friend RValue<Bool> operator==(RValue<Int4> lhs, RValue<Int4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001684
John Bauman19bac1e2014-05-06 15:23:49 -04001685 friend RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y);
1686 friend RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y);
1687 friend RValue<Int4> CmpLE(RValue<Int4> x, RValue<Int4> y);
1688 friend RValue<Int4> CmpNEQ(RValue<Int4> x, RValue<Int4> y);
1689 friend RValue<Int4> CmpNLT(RValue<Int4> x, RValue<Int4> y);
1690 friend RValue<Int4> CmpNLE(RValue<Int4> x, RValue<Int4> y);
John Bauman89401822014-05-06 15:04:28 -04001691
John Bauman19bac1e2014-05-06 15:23:49 -04001692 friend RValue<Int4> Max(RValue<Int4> x, RValue<Int4> y);
1693 friend RValue<Int4> Min(RValue<Int4> x, RValue<Int4> y);
1694
1695 friend RValue<Int4> RoundInt(RValue<Float4> cast);
1696 friend RValue<Short8> Pack(RValue<Int4> x, RValue<Int4> y);
1697 friend RValue<Int4> Concatenate(RValue<Int2> lo, RValue<Int2> hi);
1698 friend RValue<Int> Extract(RValue<Int4> x, int i);
1699 friend RValue<Int4> Insert(RValue<Int4> val, RValue<Int> element, int i);
1700 friend RValue<Int> SignMask(RValue<Int4> x);
1701 friend RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select);
1702
1703 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001704
1705 private:
1706 void constant(int x, int y, int z, int w);
1707 };
1708
John Bauman66b8ab22014-05-06 15:57:45 -04001709 class UInt4 : public Variable<UInt4>
John Bauman89401822014-05-06 15:04:28 -04001710 {
1711 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001712 explicit UInt4(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001713
1714 UInt4();
John Bauman19bac1e2014-05-06 15:23:49 -04001715 UInt4(int xyzw);
1716 UInt4(int x, int yzw);
1717 UInt4(int x, int y, int zw);
1718 UInt4(int x, int y, int z, int w);
John Bauman89401822014-05-06 15:04:28 -04001719 UInt4(unsigned int x, unsigned int y, unsigned int z, unsigned int w);
John Bauman19bac1e2014-05-06 15:23:49 -04001720 UInt4(RValue<UInt4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001721 UInt4(const UInt4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001722 UInt4(const Reference<UInt4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001723 UInt4(RValue<Int4> rhs);
1724 UInt4(const Int4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001725 UInt4(const Reference<Int4> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001726
John Bauman19bac1e2014-05-06 15:23:49 -04001727 RValue<UInt4> operator=(RValue<UInt4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001728 RValue<UInt4> operator=(const UInt4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001729 RValue<UInt4> operator=(const Reference<UInt4> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001730
John Bauman19bac1e2014-05-06 15:23:49 -04001731 friend RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs);
1732 friend RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs);
1733 friend RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs);
1734 // friend RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs);
1735 // friend RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs);
1736 friend RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs);
1737 friend RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs);
1738 friend RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs);
1739 friend RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs);
1740 friend RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs);
1741 friend RValue<UInt4> operator+=(const UInt4 &lhs, RValue<UInt4> rhs);
1742 friend RValue<UInt4> operator-=(const UInt4 &lhs, RValue<UInt4> rhs);
1743 friend RValue<UInt4> operator*=(const UInt4 &lhs, RValue<UInt4> rhs);
1744 // friend RValue<UInt4> operator/=(const UInt4 &lhs, RValue<UInt4> rhs);
1745 // friend RValue<UInt4> operator%=(const UInt4 &lhs, RValue<UInt4> rhs);
1746 friend RValue<UInt4> operator&=(const UInt4 &lhs, RValue<UInt4> rhs);
1747 friend RValue<UInt4> operator|=(const UInt4 &lhs, RValue<UInt4> rhs);
1748 friend RValue<UInt4> operator^=(const UInt4 &lhs, RValue<UInt4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001749 friend RValue<UInt4> operator<<=(const UInt4 &lhs, unsigned char rhs);
1750 friend RValue<UInt4> operator>>=(const UInt4 &lhs, unsigned char rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001751 friend RValue<UInt4> operator+(RValue<UInt4> val);
1752 friend RValue<UInt4> operator-(RValue<UInt4> val);
1753 friend RValue<UInt4> operator~(RValue<UInt4> val);
John Bauman89401822014-05-06 15:04:28 -04001754 // friend RValue<UInt4> operator++(const UInt4 &val, int); // Post-increment
1755 // friend const UInt4 &operator++(const UInt4 &val); // Pre-increment
1756 // friend RValue<UInt4> operator--(const UInt4 &val, int); // Post-decrement
1757 // friend const UInt4 &operator--(const UInt4 &val); // Pre-decrement
John Bauman19bac1e2014-05-06 15:23:49 -04001758 // friend RValue<Bool> operator<(RValue<UInt4> lhs, RValue<UInt4> rhs);
1759 // friend RValue<Bool> operator<=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1760 // friend RValue<Bool> operator>(RValue<UInt4> lhs, RValue<UInt4> rhs);
1761 // friend RValue<Bool> operator>=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1762 // friend RValue<Bool> operator!=(RValue<UInt4> lhs, RValue<UInt4> rhs);
1763 // friend RValue<Bool> operator==(RValue<UInt4> lhs, RValue<UInt4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001764
John Bauman19bac1e2014-05-06 15:23:49 -04001765 friend RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y);
1766 friend RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y);
1767 friend RValue<UInt4> CmpLE(RValue<UInt4> x, RValue<UInt4> y);
1768 friend RValue<UInt4> CmpNEQ(RValue<UInt4> x, RValue<UInt4> y);
1769 friend RValue<UInt4> CmpNLT(RValue<UInt4> x, RValue<UInt4> y);
1770 friend RValue<UInt4> CmpNLE(RValue<UInt4> x, RValue<UInt4> y);
John Bauman89401822014-05-06 15:04:28 -04001771
John Bauman19bac1e2014-05-06 15:23:49 -04001772 friend RValue<UInt4> Max(RValue<UInt4> x, RValue<UInt4> y);
1773 friend RValue<UInt4> Min(RValue<UInt4> x, RValue<UInt4> y);
1774
1775 // friend RValue<UInt4> RoundInt(RValue<Float4> cast);
1776 friend RValue<UShort8> Pack(RValue<UInt4> x, RValue<UInt4> y);
1777 friend RValue<UInt4> Concatenate(RValue<UInt2> lo, RValue<UInt2> hi);
1778
1779 static llvm::Type *getType();
1780
1781 private:
1782 void constant(int x, int y, int z, int w);
John Bauman89401822014-05-06 15:04:28 -04001783 };
1784
John Bauman66b8ab22014-05-06 15:57:45 -04001785 template<int T>
1786 class Swizzle2Float4
1787 {
1788 friend class Float4;
1789
1790 public:
1791 operator RValue<Float4>() const;
1792
1793 private:
1794 Float4 *parent;
1795 };
1796
1797 template<int T>
1798 class SwizzleFloat4
1799 {
1800 public:
1801 operator RValue<Float4>() const;
1802
1803 private:
1804 Float4 *parent;
1805 };
1806
1807 template<int T>
1808 class SwizzleMaskFloat4
1809 {
1810 friend class Float4;
1811
1812 public:
1813 operator RValue<Float4>() const;
1814
1815 RValue<Float4> operator=(RValue<Float4> rhs) const;
1816 RValue<Float4> operator=(RValue<Float> rhs) const;
1817
1818 private:
1819 Float4 *parent;
1820 };
1821
1822 template<int T>
1823 class SwizzleMask1Float4
1824 {
1825 public:
1826 operator RValue<Float>() const;
1827 operator RValue<Float4>() const;
1828
1829 RValue<Float4> operator=(float x) const;
1830 RValue<Float4> operator=(RValue<Float4> rhs) const;
1831 RValue<Float4> operator=(RValue<Float> rhs) const;
1832
1833 private:
1834 Float4 *parent;
1835 };
1836
1837 template<int T>
1838 class SwizzleMask2Float4
1839 {
1840 friend class Float4;
1841
1842 public:
1843 operator RValue<Float4>() const;
1844
1845 RValue<Float4> operator=(RValue<Float4> rhs) const;
1846
1847 private:
1848 Float4 *parent;
1849 };
1850
1851 class Float : public Variable<Float>
John Bauman89401822014-05-06 15:04:28 -04001852 {
1853 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001854 explicit Float(RValue<Int> cast);
John Bauman89401822014-05-06 15:04:28 -04001855
1856 Float();
1857 Float(float x);
John Bauman19bac1e2014-05-06 15:23:49 -04001858 Float(RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001859 Float(const Float &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001860 Float(const Reference<Float> &rhs);
1861
1862 template<int T>
1863 Float(const SwizzleMask1Float4<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001864
1865 // RValue<Float> operator=(float rhs) const; // FIXME: Implement
John Bauman19bac1e2014-05-06 15:23:49 -04001866 RValue<Float> operator=(RValue<Float> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001867 RValue<Float> operator=(const Float &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001868 RValue<Float> operator=(const Reference<Float> &rhs) const;
1869
1870 template<int T>
1871 RValue<Float> operator=(const SwizzleMask1Float4<T> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001872
John Bauman19bac1e2014-05-06 15:23:49 -04001873 friend RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs);
1874 friend RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs);
1875 friend RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs);
1876 friend RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs);
1877 friend RValue<Float> operator+=(const Float &lhs, RValue<Float> rhs);
1878 friend RValue<Float> operator-=(const Float &lhs, RValue<Float> rhs);
1879 friend RValue<Float> operator*=(const Float &lhs, RValue<Float> rhs);
1880 friend RValue<Float> operator/=(const Float &lhs, RValue<Float> rhs);
1881 friend RValue<Float> operator+(RValue<Float> val);
1882 friend RValue<Float> operator-(RValue<Float> val);
1883 friend RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs);
1884 friend RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs);
1885 friend RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs);
1886 friend RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs);
1887 friend RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs);
1888 friend RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001889
John Bauman19bac1e2014-05-06 15:23:49 -04001890 friend RValue<Float> Abs(RValue<Float> x);
1891 friend RValue<Float> Max(RValue<Float> x, RValue<Float> y);
1892 friend RValue<Float> Min(RValue<Float> x, RValue<Float> y);
John Bauman89401822014-05-06 15:04:28 -04001893
John Bauman19bac1e2014-05-06 15:23:49 -04001894 friend RValue<Float> Rcp_pp(RValue<Float> val);
1895 friend RValue<Float> RcpSqrt_pp(RValue<Float> val);
1896 friend RValue<Float> Sqrt(RValue<Float> x);
John Bauman89401822014-05-06 15:04:28 -04001897
John Bauman19bac1e2014-05-06 15:23:49 -04001898 friend RValue<Float> Round(RValue<Float> val);
1899 friend RValue<Float> Trunc(RValue<Float> val);
1900 friend RValue<Float> Frac(RValue<Float> val);
1901 friend RValue<Float> Floor(RValue<Float> val);
1902 friend RValue<Float> Ceil(RValue<Float> val);
John Bauman89401822014-05-06 15:04:28 -04001903
John Bauman19bac1e2014-05-06 15:23:49 -04001904 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001905 };
1906
John Bauman66b8ab22014-05-06 15:57:45 -04001907 class Float2 : public Variable<Float2>
John Bauman89401822014-05-06 15:04:28 -04001908 {
1909 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001910 // explicit Float2(RValue<Byte2> cast);
1911 // explicit Float2(RValue<Short2> cast);
1912 // explicit Float2(RValue<UShort2> cast);
1913 // explicit Float2(RValue<Int2> cast);
1914 // explicit Float2(RValue<UInt2> cast);
1915 explicit Float2(RValue<Float4> cast);
John Bauman89401822014-05-06 15:04:28 -04001916
1917 // Float2();
1918 // Float2(float x, float y);
John Bauman19bac1e2014-05-06 15:23:49 -04001919 // Float2(RValue<Float2> rhs);
John Bauman89401822014-05-06 15:04:28 -04001920 // Float2(const Float2 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001921 // Float2(const Reference<Float2> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001922 // Float2(RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001923 // Float2(const Float &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001924 // Float2(const Reference<Float> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001925
1926 // template<int T>
1927 // Float2(const SwizzleMask1Float4<T> &rhs);
1928
1929 // RValue<Float2> operator=(float replicate) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001930 // RValue<Float2> operator=(RValue<Float2> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001931 // RValue<Float2> operator=(const Float2 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001932 // RValue<Float2> operator=(const Reference<Float2> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001933 // RValue<Float2> operator=(RValue<Float> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001934 // RValue<Float2> operator=(const Float &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04001935 // RValue<Float2> operator=(const Reference<Float> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04001936
1937 // template<int T>
1938 // RValue<Float2> operator=(const SwizzleMask1Float4<T> &rhs);
1939
John Bauman19bac1e2014-05-06 15:23:49 -04001940 // friend RValue<Float2> operator+(RValue<Float2> lhs, RValue<Float2> rhs);
1941 // friend RValue<Float2> operator-(RValue<Float2> lhs, RValue<Float2> rhs);
1942 // friend RValue<Float2> operator*(RValue<Float2> lhs, RValue<Float2> rhs);
1943 // friend RValue<Float2> operator/(RValue<Float2> lhs, RValue<Float2> rhs);
1944 // friend RValue<Float2> operator%(RValue<Float2> lhs, RValue<Float2> rhs);
1945 // friend RValue<Float2> operator+=(const Float2 &lhs, RValue<Float2> rhs);
1946 // friend RValue<Float2> operator-=(const Float2 &lhs, RValue<Float2> rhs);
1947 // friend RValue<Float2> operator*=(const Float2 &lhs, RValue<Float2> rhs);
1948 // friend RValue<Float2> operator/=(const Float2 &lhs, RValue<Float2> rhs);
1949 // friend RValue<Float2> operator%=(const Float2 &lhs, RValue<Float2> rhs);
1950 // friend RValue<Float2> operator+(RValue<Float2> val);
1951 // friend RValue<Float2> operator-(RValue<Float2> val);
John Bauman89401822014-05-06 15:04:28 -04001952
John Bauman19bac1e2014-05-06 15:23:49 -04001953 // friend RValue<Float2> Abs(RValue<Float2> x);
1954 // friend RValue<Float2> Max(RValue<Float2> x, RValue<Float2> y);
1955 // friend RValue<Float2> Min(RValue<Float2> x, RValue<Float2> y);
John Bauman89401822014-05-06 15:04:28 -04001956
John Bauman19bac1e2014-05-06 15:23:49 -04001957 // friend RValue<Float2> Swizzle(RValue<Float2> x, unsigned char select);
1958 // friend RValue<Float2> Mask(Float2 &lhs, RValue<Float2> rhs, unsigned char select);
John Bauman89401822014-05-06 15:04:28 -04001959
John Bauman19bac1e2014-05-06 15:23:49 -04001960 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04001961 };
1962
John Bauman66b8ab22014-05-06 15:57:45 -04001963 class Float4 : public Variable<Float4>
John Bauman89401822014-05-06 15:04:28 -04001964 {
1965 public:
John Bauman19bac1e2014-05-06 15:23:49 -04001966 explicit Float4(RValue<Byte4> cast);
1967 explicit Float4(RValue<SByte4> cast);
1968 explicit Float4(RValue<Short4> cast);
1969 explicit Float4(RValue<UShort4> cast);
1970 explicit Float4(RValue<Int4> cast);
1971 explicit Float4(RValue<UInt4> cast);
John Bauman89401822014-05-06 15:04:28 -04001972
1973 Float4();
1974 Float4(float xyzw);
1975 Float4(float x, float yzw);
1976 Float4(float x, float y, float zw);
1977 Float4(float x, float y, float z, float w);
John Bauman19bac1e2014-05-06 15:23:49 -04001978 Float4(RValue<Float4> rhs);
John Bauman89401822014-05-06 15:04:28 -04001979 Float4(const Float4 &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001980 Float4(const Reference<Float4> &rhs);
John Bauman19bac1e2014-05-06 15:23:49 -04001981 Float4(RValue<Float> rhs);
John Bauman89401822014-05-06 15:04:28 -04001982 Float4(const Float &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001983 Float4(const Reference<Float> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001984
1985 template<int T>
1986 Float4(const SwizzleMask1Float4<T> &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04001987 template<int T>
1988 Float4(const SwizzleFloat4<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -04001989 template<int X, int Y>
1990 Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y);
1991 template<int X, int Y>
1992 Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y);
1993 template<int X, int Y>
1994 Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
1995 template<int X, int Y>
1996 Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y);
1997
1998 RValue<Float4> operator=(float replicate) const;
John Bauman19bac1e2014-05-06 15:23:49 -04001999 RValue<Float4> operator=(RValue<Float4> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04002000 RValue<Float4> operator=(const Float4 &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04002001 RValue<Float4> operator=(const Reference<Float4> &rhs) const;
John Bauman19bac1e2014-05-06 15:23:49 -04002002 RValue<Float4> operator=(RValue<Float> rhs) const;
John Bauman89401822014-05-06 15:04:28 -04002003 RValue<Float4> operator=(const Float &rhs) const;
John Bauman66b8ab22014-05-06 15:57:45 -04002004 RValue<Float4> operator=(const Reference<Float> &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04002005
2006 template<int T>
2007 RValue<Float4> operator=(const SwizzleMask1Float4<T> &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04002008 template<int T>
2009 RValue<Float4> operator=(const SwizzleFloat4<T> &rhs);
John Bauman89401822014-05-06 15:04:28 -04002010
John Bauman19bac1e2014-05-06 15:23:49 -04002011 friend RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs);
2012 friend RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs);
2013 friend RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs);
2014 friend RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs);
2015 friend RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs);
2016 friend RValue<Float4> operator+=(const Float4 &lhs, RValue<Float4> rhs);
2017 friend RValue<Float4> operator-=(const Float4 &lhs, RValue<Float4> rhs);
2018 friend RValue<Float4> operator*=(const Float4 &lhs, RValue<Float4> rhs);
2019 friend RValue<Float4> operator/=(const Float4 &lhs, RValue<Float4> rhs);
2020 friend RValue<Float4> operator%=(const Float4 &lhs, RValue<Float4> rhs);
2021 friend RValue<Float4> operator+(RValue<Float4> val);
2022 friend RValue<Float4> operator-(RValue<Float4> val);
John Bauman89401822014-05-06 15:04:28 -04002023
John Bauman19bac1e2014-05-06 15:23:49 -04002024 friend RValue<Float4> Abs(RValue<Float4> x);
2025 friend RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y);
2026 friend RValue<Float4> Min(RValue<Float4> x, RValue<Float4> y);
John Bauman89401822014-05-06 15:04:28 -04002027
John Bauman19bac1e2014-05-06 15:23:49 -04002028 friend RValue<Float4> Rcp_pp(RValue<Float4> val);
2029 friend RValue<Float4> RcpSqrt_pp(RValue<Float4> val);
2030 friend RValue<Float4> Sqrt(RValue<Float4> x);
John Bauman89401822014-05-06 15:04:28 -04002031
John Bauman19bac1e2014-05-06 15:23:49 -04002032 friend RValue<Float4> Insert(const Float4 &val, RValue<Float> element, int i);
2033 friend RValue<Float> Extract(RValue<Float4> x, int i);
2034 friend RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select);
2035 friend RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm);
2036 friend RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y);
2037 friend RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y);
2038 friend RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select);
2039 friend RValue<Int> SignMask(RValue<Float4> x);
John Bauman89401822014-05-06 15:04:28 -04002040
John Bauman19bac1e2014-05-06 15:23:49 -04002041 friend RValue<Int4> CmpEQ(RValue<Float4> x, RValue<Float4> y);
2042 friend RValue<Int4> CmpLT(RValue<Float4> x, RValue<Float4> y);
2043 friend RValue<Int4> CmpLE(RValue<Float4> x, RValue<Float4> y);
2044 friend RValue<Int4> CmpNEQ(RValue<Float4> x, RValue<Float4> y);
2045 friend RValue<Int4> CmpNLT(RValue<Float4> x, RValue<Float4> y);
2046 friend RValue<Int4> CmpNLE(RValue<Float4> x, RValue<Float4> y);
John Bauman89401822014-05-06 15:04:28 -04002047
John Bauman19bac1e2014-05-06 15:23:49 -04002048 friend RValue<Float4> Round(RValue<Float4> x);
2049 friend RValue<Float4> Trunc(RValue<Float4> x);
2050 friend RValue<Float4> Frac(RValue<Float4> x);
2051 friend RValue<Float4> Floor(RValue<Float4> x);
2052 friend RValue<Float4> Ceil(RValue<Float4> x);
John Bauman89401822014-05-06 15:04:28 -04002053
John Bauman19bac1e2014-05-06 15:23:49 -04002054 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04002055
2056 union
2057 {
2058 SwizzleMask1Float4<0x00> x;
2059 SwizzleMask1Float4<0x55> y;
2060 SwizzleMask1Float4<0xAA> z;
2061 SwizzleMask1Float4<0xFF> w;
2062 Swizzle2Float4<0x00> xx;
2063 Swizzle2Float4<0x01> yx;
2064 Swizzle2Float4<0x02> zx;
2065 Swizzle2Float4<0x03> wx;
2066 SwizzleMask2Float4<0x54> xy;
2067 Swizzle2Float4<0x55> yy;
2068 Swizzle2Float4<0x56> zy;
2069 Swizzle2Float4<0x57> wy;
2070 SwizzleMask2Float4<0xA8> xz;
2071 SwizzleMask2Float4<0xA9> yz;
2072 Swizzle2Float4<0xAA> zz;
2073 Swizzle2Float4<0xAB> wz;
2074 SwizzleMask2Float4<0xFC> xw;
2075 SwizzleMask2Float4<0xFD> yw;
2076 SwizzleMask2Float4<0xFE> zw;
2077 Swizzle2Float4<0xFF> ww;
2078 SwizzleFloat4<0x00> xxx;
2079 SwizzleFloat4<0x01> yxx;
2080 SwizzleFloat4<0x02> zxx;
2081 SwizzleFloat4<0x03> wxx;
2082 SwizzleFloat4<0x04> xyx;
2083 SwizzleFloat4<0x05> yyx;
2084 SwizzleFloat4<0x06> zyx;
2085 SwizzleFloat4<0x07> wyx;
2086 SwizzleFloat4<0x08> xzx;
2087 SwizzleFloat4<0x09> yzx;
2088 SwizzleFloat4<0x0A> zzx;
2089 SwizzleFloat4<0x0B> wzx;
2090 SwizzleFloat4<0x0C> xwx;
2091 SwizzleFloat4<0x0D> ywx;
2092 SwizzleFloat4<0x0E> zwx;
2093 SwizzleFloat4<0x0F> wwx;
2094 SwizzleFloat4<0x50> xxy;
2095 SwizzleFloat4<0x51> yxy;
2096 SwizzleFloat4<0x52> zxy;
2097 SwizzleFloat4<0x53> wxy;
2098 SwizzleFloat4<0x54> xyy;
2099 SwizzleFloat4<0x55> yyy;
2100 SwizzleFloat4<0x56> zyy;
2101 SwizzleFloat4<0x57> wyy;
2102 SwizzleFloat4<0x58> xzy;
2103 SwizzleFloat4<0x59> yzy;
2104 SwizzleFloat4<0x5A> zzy;
2105 SwizzleFloat4<0x5B> wzy;
2106 SwizzleFloat4<0x5C> xwy;
2107 SwizzleFloat4<0x5D> ywy;
2108 SwizzleFloat4<0x5E> zwy;
2109 SwizzleFloat4<0x5F> wwy;
2110 SwizzleFloat4<0xA0> xxz;
2111 SwizzleFloat4<0xA1> yxz;
2112 SwizzleFloat4<0xA2> zxz;
2113 SwizzleFloat4<0xA3> wxz;
2114 SwizzleMaskFloat4<0xA4> xyz;
2115 SwizzleFloat4<0xA5> yyz;
2116 SwizzleFloat4<0xA6> zyz;
2117 SwizzleFloat4<0xA7> wyz;
2118 SwizzleFloat4<0xA8> xzz;
2119 SwizzleFloat4<0xA9> yzz;
2120 SwizzleFloat4<0xAA> zzz;
2121 SwizzleFloat4<0xAB> wzz;
2122 SwizzleFloat4<0xAC> xwz;
2123 SwizzleFloat4<0xAD> ywz;
2124 SwizzleFloat4<0xAE> zwz;
2125 SwizzleFloat4<0xAF> wwz;
2126 SwizzleFloat4<0xF0> xxw;
2127 SwizzleFloat4<0xF1> yxw;
2128 SwizzleFloat4<0xF2> zxw;
2129 SwizzleFloat4<0xF3> wxw;
2130 SwizzleMaskFloat4<0xF4> xyw;
2131 SwizzleFloat4<0xF5> yyw;
2132 SwizzleFloat4<0xF6> zyw;
2133 SwizzleFloat4<0xF7> wyw;
2134 SwizzleMaskFloat4<0xF8> xzw;
2135 SwizzleMaskFloat4<0xF9> yzw;
2136 SwizzleFloat4<0xFA> zzw;
2137 SwizzleFloat4<0xFB> wzw;
2138 SwizzleFloat4<0xFC> xww;
2139 SwizzleFloat4<0xFD> yww;
2140 SwizzleFloat4<0xFE> zww;
2141 SwizzleFloat4<0xFF> www;
2142 SwizzleFloat4<0x00> xxxx;
2143 SwizzleFloat4<0x01> yxxx;
2144 SwizzleFloat4<0x02> zxxx;
2145 SwizzleFloat4<0x03> wxxx;
2146 SwizzleFloat4<0x04> xyxx;
2147 SwizzleFloat4<0x05> yyxx;
2148 SwizzleFloat4<0x06> zyxx;
2149 SwizzleFloat4<0x07> wyxx;
2150 SwizzleFloat4<0x08> xzxx;
2151 SwizzleFloat4<0x09> yzxx;
2152 SwizzleFloat4<0x0A> zzxx;
2153 SwizzleFloat4<0x0B> wzxx;
2154 SwizzleFloat4<0x0C> xwxx;
2155 SwizzleFloat4<0x0D> ywxx;
2156 SwizzleFloat4<0x0E> zwxx;
2157 SwizzleFloat4<0x0F> wwxx;
2158 SwizzleFloat4<0x10> xxyx;
2159 SwizzleFloat4<0x11> yxyx;
2160 SwizzleFloat4<0x12> zxyx;
2161 SwizzleFloat4<0x13> wxyx;
2162 SwizzleFloat4<0x14> xyyx;
2163 SwizzleFloat4<0x15> yyyx;
2164 SwizzleFloat4<0x16> zyyx;
2165 SwizzleFloat4<0x17> wyyx;
2166 SwizzleFloat4<0x18> xzyx;
2167 SwizzleFloat4<0x19> yzyx;
2168 SwizzleFloat4<0x1A> zzyx;
2169 SwizzleFloat4<0x1B> wzyx;
2170 SwizzleFloat4<0x1C> xwyx;
2171 SwizzleFloat4<0x1D> ywyx;
2172 SwizzleFloat4<0x1E> zwyx;
2173 SwizzleFloat4<0x1F> wwyx;
2174 SwizzleFloat4<0x20> xxzx;
2175 SwizzleFloat4<0x21> yxzx;
2176 SwizzleFloat4<0x22> zxzx;
2177 SwizzleFloat4<0x23> wxzx;
2178 SwizzleFloat4<0x24> xyzx;
2179 SwizzleFloat4<0x25> yyzx;
2180 SwizzleFloat4<0x26> zyzx;
2181 SwizzleFloat4<0x27> wyzx;
2182 SwizzleFloat4<0x28> xzzx;
2183 SwizzleFloat4<0x29> yzzx;
2184 SwizzleFloat4<0x2A> zzzx;
2185 SwizzleFloat4<0x2B> wzzx;
2186 SwizzleFloat4<0x2C> xwzx;
2187 SwizzleFloat4<0x2D> ywzx;
2188 SwizzleFloat4<0x2E> zwzx;
2189 SwizzleFloat4<0x2F> wwzx;
2190 SwizzleFloat4<0x30> xxwx;
2191 SwizzleFloat4<0x31> yxwx;
2192 SwizzleFloat4<0x32> zxwx;
2193 SwizzleFloat4<0x33> wxwx;
2194 SwizzleFloat4<0x34> xywx;
2195 SwizzleFloat4<0x35> yywx;
2196 SwizzleFloat4<0x36> zywx;
2197 SwizzleFloat4<0x37> wywx;
2198 SwizzleFloat4<0x38> xzwx;
2199 SwizzleFloat4<0x39> yzwx;
2200 SwizzleFloat4<0x3A> zzwx;
2201 SwizzleFloat4<0x3B> wzwx;
2202 SwizzleFloat4<0x3C> xwwx;
2203 SwizzleFloat4<0x3D> ywwx;
2204 SwizzleFloat4<0x3E> zwwx;
2205 SwizzleFloat4<0x3F> wwwx;
2206 SwizzleFloat4<0x40> xxxy;
2207 SwizzleFloat4<0x41> yxxy;
2208 SwizzleFloat4<0x42> zxxy;
2209 SwizzleFloat4<0x43> wxxy;
2210 SwizzleFloat4<0x44> xyxy;
2211 SwizzleFloat4<0x45> yyxy;
2212 SwizzleFloat4<0x46> zyxy;
2213 SwizzleFloat4<0x47> wyxy;
2214 SwizzleFloat4<0x48> xzxy;
2215 SwizzleFloat4<0x49> yzxy;
2216 SwizzleFloat4<0x4A> zzxy;
2217 SwizzleFloat4<0x4B> wzxy;
2218 SwizzleFloat4<0x4C> xwxy;
2219 SwizzleFloat4<0x4D> ywxy;
2220 SwizzleFloat4<0x4E> zwxy;
2221 SwizzleFloat4<0x4F> wwxy;
2222 SwizzleFloat4<0x50> xxyy;
2223 SwizzleFloat4<0x51> yxyy;
2224 SwizzleFloat4<0x52> zxyy;
2225 SwizzleFloat4<0x53> wxyy;
2226 SwizzleFloat4<0x54> xyyy;
2227 SwizzleFloat4<0x55> yyyy;
2228 SwizzleFloat4<0x56> zyyy;
2229 SwizzleFloat4<0x57> wyyy;
2230 SwizzleFloat4<0x58> xzyy;
2231 SwizzleFloat4<0x59> yzyy;
2232 SwizzleFloat4<0x5A> zzyy;
2233 SwizzleFloat4<0x5B> wzyy;
2234 SwizzleFloat4<0x5C> xwyy;
2235 SwizzleFloat4<0x5D> ywyy;
2236 SwizzleFloat4<0x5E> zwyy;
2237 SwizzleFloat4<0x5F> wwyy;
2238 SwizzleFloat4<0x60> xxzy;
2239 SwizzleFloat4<0x61> yxzy;
2240 SwizzleFloat4<0x62> zxzy;
2241 SwizzleFloat4<0x63> wxzy;
2242 SwizzleFloat4<0x64> xyzy;
2243 SwizzleFloat4<0x65> yyzy;
2244 SwizzleFloat4<0x66> zyzy;
2245 SwizzleFloat4<0x67> wyzy;
2246 SwizzleFloat4<0x68> xzzy;
2247 SwizzleFloat4<0x69> yzzy;
2248 SwizzleFloat4<0x6A> zzzy;
2249 SwizzleFloat4<0x6B> wzzy;
2250 SwizzleFloat4<0x6C> xwzy;
2251 SwizzleFloat4<0x6D> ywzy;
2252 SwizzleFloat4<0x6E> zwzy;
2253 SwizzleFloat4<0x6F> wwzy;
2254 SwizzleFloat4<0x70> xxwy;
2255 SwizzleFloat4<0x71> yxwy;
2256 SwizzleFloat4<0x72> zxwy;
2257 SwizzleFloat4<0x73> wxwy;
2258 SwizzleFloat4<0x74> xywy;
2259 SwizzleFloat4<0x75> yywy;
2260 SwizzleFloat4<0x76> zywy;
2261 SwizzleFloat4<0x77> wywy;
2262 SwizzleFloat4<0x78> xzwy;
2263 SwizzleFloat4<0x79> yzwy;
2264 SwizzleFloat4<0x7A> zzwy;
2265 SwizzleFloat4<0x7B> wzwy;
2266 SwizzleFloat4<0x7C> xwwy;
2267 SwizzleFloat4<0x7D> ywwy;
2268 SwizzleFloat4<0x7E> zwwy;
2269 SwizzleFloat4<0x7F> wwwy;
2270 SwizzleFloat4<0x80> xxxz;
2271 SwizzleFloat4<0x81> yxxz;
2272 SwizzleFloat4<0x82> zxxz;
2273 SwizzleFloat4<0x83> wxxz;
2274 SwizzleFloat4<0x84> xyxz;
2275 SwizzleFloat4<0x85> yyxz;
2276 SwizzleFloat4<0x86> zyxz;
2277 SwizzleFloat4<0x87> wyxz;
2278 SwizzleFloat4<0x88> xzxz;
2279 SwizzleFloat4<0x89> yzxz;
2280 SwizzleFloat4<0x8A> zzxz;
2281 SwizzleFloat4<0x8B> wzxz;
2282 SwizzleFloat4<0x8C> xwxz;
2283 SwizzleFloat4<0x8D> ywxz;
2284 SwizzleFloat4<0x8E> zwxz;
2285 SwizzleFloat4<0x8F> wwxz;
2286 SwizzleFloat4<0x90> xxyz;
2287 SwizzleFloat4<0x91> yxyz;
2288 SwizzleFloat4<0x92> zxyz;
2289 SwizzleFloat4<0x93> wxyz;
2290 SwizzleFloat4<0x94> xyyz;
2291 SwizzleFloat4<0x95> yyyz;
2292 SwizzleFloat4<0x96> zyyz;
2293 SwizzleFloat4<0x97> wyyz;
2294 SwizzleFloat4<0x98> xzyz;
2295 SwizzleFloat4<0x99> yzyz;
2296 SwizzleFloat4<0x9A> zzyz;
2297 SwizzleFloat4<0x9B> wzyz;
2298 SwizzleFloat4<0x9C> xwyz;
2299 SwizzleFloat4<0x9D> ywyz;
2300 SwizzleFloat4<0x9E> zwyz;
2301 SwizzleFloat4<0x9F> wwyz;
2302 SwizzleFloat4<0xA0> xxzz;
2303 SwizzleFloat4<0xA1> yxzz;
2304 SwizzleFloat4<0xA2> zxzz;
2305 SwizzleFloat4<0xA3> wxzz;
2306 SwizzleFloat4<0xA4> xyzz;
2307 SwizzleFloat4<0xA5> yyzz;
2308 SwizzleFloat4<0xA6> zyzz;
2309 SwizzleFloat4<0xA7> wyzz;
2310 SwizzleFloat4<0xA8> xzzz;
2311 SwizzleFloat4<0xA9> yzzz;
2312 SwizzleFloat4<0xAA> zzzz;
2313 SwizzleFloat4<0xAB> wzzz;
2314 SwizzleFloat4<0xAC> xwzz;
2315 SwizzleFloat4<0xAD> ywzz;
2316 SwizzleFloat4<0xAE> zwzz;
2317 SwizzleFloat4<0xAF> wwzz;
2318 SwizzleFloat4<0xB0> xxwz;
2319 SwizzleFloat4<0xB1> yxwz;
2320 SwizzleFloat4<0xB2> zxwz;
2321 SwizzleFloat4<0xB3> wxwz;
2322 SwizzleFloat4<0xB4> xywz;
2323 SwizzleFloat4<0xB5> yywz;
2324 SwizzleFloat4<0xB6> zywz;
2325 SwizzleFloat4<0xB7> wywz;
2326 SwizzleFloat4<0xB8> xzwz;
2327 SwizzleFloat4<0xB9> yzwz;
2328 SwizzleFloat4<0xBA> zzwz;
2329 SwizzleFloat4<0xBB> wzwz;
2330 SwizzleFloat4<0xBC> xwwz;
2331 SwizzleFloat4<0xBD> ywwz;
2332 SwizzleFloat4<0xBE> zwwz;
2333 SwizzleFloat4<0xBF> wwwz;
2334 SwizzleFloat4<0xC0> xxxw;
2335 SwizzleFloat4<0xC1> yxxw;
2336 SwizzleFloat4<0xC2> zxxw;
2337 SwizzleFloat4<0xC3> wxxw;
2338 SwizzleFloat4<0xC4> xyxw;
2339 SwizzleFloat4<0xC5> yyxw;
2340 SwizzleFloat4<0xC6> zyxw;
2341 SwizzleFloat4<0xC7> wyxw;
2342 SwizzleFloat4<0xC8> xzxw;
2343 SwizzleFloat4<0xC9> yzxw;
2344 SwizzleFloat4<0xCA> zzxw;
2345 SwizzleFloat4<0xCB> wzxw;
2346 SwizzleFloat4<0xCC> xwxw;
2347 SwizzleFloat4<0xCD> ywxw;
2348 SwizzleFloat4<0xCE> zwxw;
2349 SwizzleFloat4<0xCF> wwxw;
2350 SwizzleFloat4<0xD0> xxyw;
2351 SwizzleFloat4<0xD1> yxyw;
2352 SwizzleFloat4<0xD2> zxyw;
2353 SwizzleFloat4<0xD3> wxyw;
2354 SwizzleFloat4<0xD4> xyyw;
2355 SwizzleFloat4<0xD5> yyyw;
2356 SwizzleFloat4<0xD6> zyyw;
2357 SwizzleFloat4<0xD7> wyyw;
2358 SwizzleFloat4<0xD8> xzyw;
2359 SwizzleFloat4<0xD9> yzyw;
2360 SwizzleFloat4<0xDA> zzyw;
2361 SwizzleFloat4<0xDB> wzyw;
2362 SwizzleFloat4<0xDC> xwyw;
2363 SwizzleFloat4<0xDD> ywyw;
2364 SwizzleFloat4<0xDE> zwyw;
2365 SwizzleFloat4<0xDF> wwyw;
2366 SwizzleFloat4<0xE0> xxzw;
2367 SwizzleFloat4<0xE1> yxzw;
2368 SwizzleFloat4<0xE2> zxzw;
2369 SwizzleFloat4<0xE3> wxzw;
2370 SwizzleMaskFloat4<0xE4> xyzw;
2371 SwizzleFloat4<0xE5> yyzw;
2372 SwizzleFloat4<0xE6> zyzw;
2373 SwizzleFloat4<0xE7> wyzw;
2374 SwizzleFloat4<0xE8> xzzw;
2375 SwizzleFloat4<0xE9> yzzw;
2376 SwizzleFloat4<0xEA> zzzw;
2377 SwizzleFloat4<0xEB> wzzw;
2378 SwizzleFloat4<0xEC> xwzw;
2379 SwizzleFloat4<0xED> ywzw;
2380 SwizzleFloat4<0xEE> zwzw;
2381 SwizzleFloat4<0xEF> wwzw;
2382 SwizzleFloat4<0xF0> xxww;
2383 SwizzleFloat4<0xF1> yxww;
2384 SwizzleFloat4<0xF2> zxww;
2385 SwizzleFloat4<0xF3> wxww;
2386 SwizzleFloat4<0xF4> xyww;
2387 SwizzleFloat4<0xF5> yyww;
2388 SwizzleFloat4<0xF6> zyww;
2389 SwizzleFloat4<0xF7> wyww;
2390 SwizzleFloat4<0xF8> xzww;
2391 SwizzleFloat4<0xF9> yzww;
2392 SwizzleFloat4<0xFA> zzww;
2393 SwizzleFloat4<0xFB> wzww;
2394 SwizzleFloat4<0xFC> xwww;
2395 SwizzleFloat4<0xFD> ywww;
2396 SwizzleFloat4<0xFE> zwww;
2397 SwizzleFloat4<0xFF> wwww;
2398 };
2399
2400 private:
2401 void constant(float x, float y, float z, float w);
2402 };
2403
2404 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002405 class Pointer : public Variable<Pointer<T> >
John Bauman89401822014-05-06 15:04:28 -04002406 {
2407 public:
2408 template<class S>
John Bauman66b8ab22014-05-06 15:57:45 -04002409 Pointer(RValue<Pointer<S> > pointerS, int alignment = 1) : alignment(alignment)
John Bauman89401822014-05-06 15:04:28 -04002410 {
John Bauman89401822014-05-06 15:04:28 -04002411 llvm::Value *pointerT = Nucleus::createBitCast(pointerS.value, Nucleus::getPointerType(T::getType()));
John Bauman66b8ab22014-05-06 15:57:45 -04002412 LValue::storeValue(pointerT);
John Bauman89401822014-05-06 15:04:28 -04002413 }
2414
2415 template<class S>
2416 Pointer(const Pointer<S> &pointer, int alignment = 1) : alignment(alignment)
2417 {
John Bauman66b8ab22014-05-06 15:57:45 -04002418 llvm::Value *pointerS = pointer.loadValue(alignment);
John Bauman89401822014-05-06 15:04:28 -04002419 llvm::Value *pointerT = Nucleus::createBitCast(pointerS, Nucleus::getPointerType(T::getType()));
John Bauman66b8ab22014-05-06 15:57:45 -04002420 LValue::storeValue(pointerT);
John Bauman89401822014-05-06 15:04:28 -04002421 }
2422
John Bauman89401822014-05-06 15:04:28 -04002423 explicit Pointer(llvm::Argument *argument);
2424 explicit Pointer(const void *external);
2425
2426 Pointer();
John Bauman66b8ab22014-05-06 15:57:45 -04002427 Pointer(RValue<Pointer<T> > rhs);
John Bauman89401822014-05-06 15:04:28 -04002428 Pointer(const Pointer<T> &rhs);
John Bauman66b8ab22014-05-06 15:57:45 -04002429 Pointer(const Reference<Pointer<T> > &rhs);
John Bauman89401822014-05-06 15:04:28 -04002430
John Bauman66b8ab22014-05-06 15:57:45 -04002431 RValue<Pointer<T> > operator=(RValue<Pointer<T> > rhs) const;
2432 RValue<Pointer<T> > operator=(const Pointer<T> &rhs) const;
2433 RValue<Pointer<T> > operator=(const Reference<Pointer<T> > &rhs) const;
John Bauman89401822014-05-06 15:04:28 -04002434
2435 Reference<T> operator*();
2436
John Bauman66b8ab22014-05-06 15:57:45 -04002437 friend RValue<Pointer<Byte> > operator+(RValue<Pointer<Byte> > lhs, int offset);
2438 friend RValue<Pointer<Byte> > operator+(RValue<Pointer<Byte> > lhs, RValue<Int> offset);
2439 friend RValue<Pointer<Byte> > operator+(RValue<Pointer<Byte> > lhs, RValue<UInt> offset);
2440 friend RValue<Pointer<Byte> > operator+=(const Pointer<Byte> &lhs, int offset);
2441 friend RValue<Pointer<Byte> > operator+=(const Pointer<Byte> &lhs, RValue<Int> offset);
2442 friend RValue<Pointer<Byte> > operator+=(const Pointer<Byte> &lhs, RValue<UInt> offset);
John Bauman89401822014-05-06 15:04:28 -04002443
John Bauman66b8ab22014-05-06 15:57:45 -04002444 friend RValue<Pointer<Byte> > operator-(RValue<Pointer<Byte> > lhs, int offset);
2445 friend RValue<Pointer<Byte> > operator-(RValue<Pointer<Byte> > lhs, RValue<Int> offset);
2446 friend RValue<Pointer<Byte> > operator-(RValue<Pointer<Byte> > lhs, RValue<UInt> offset);
2447 friend RValue<Pointer<Byte> > operator-=(const Pointer<Byte> &lhs, int offset);
2448 friend RValue<Pointer<Byte> > operator-=(const Pointer<Byte> &lhs, RValue<Int> offset);
2449 friend RValue<Pointer<Byte> > operator-=(const Pointer<Byte> &lhs, RValue<UInt> offset);
John Bauman89401822014-05-06 15:04:28 -04002450
John Bauman19bac1e2014-05-06 15:23:49 -04002451 static llvm::Type *getType();
John Bauman89401822014-05-06 15:04:28 -04002452
2453 private:
2454 const int alignment;
2455 };
2456
John Bauman19bac1e2014-05-06 15:23:49 -04002457 template<class T, int S = 1>
John Bauman66b8ab22014-05-06 15:57:45 -04002458 class Array : public Variable<T>
John Bauman89401822014-05-06 15:04:28 -04002459 {
2460 public:
John Bauman19bac1e2014-05-06 15:23:49 -04002461 Array(int size = S);
John Bauman89401822014-05-06 15:04:28 -04002462
2463 Reference<T> operator[](int index);
2464 Reference<T> operator[](RValue<Int> index);
2465 Reference<T> operator[](RValue<UInt> index);
2466
John Bauman66b8ab22014-05-06 15:57:45 -04002467 // friend RValue<Array<T> > operator++(const Array<T> &val, int); // Post-increment
John Bauman89401822014-05-06 15:04:28 -04002468 // friend const Array<T> &operator++(const Array<T> &val); // Pre-increment
John Bauman66b8ab22014-05-06 15:57:45 -04002469 // friend RValue<Array<T> > operator--(const Array<T> &val, int); // Post-decrement
John Bauman89401822014-05-06 15:04:28 -04002470 // friend const Array<T> &operator--(const Array<T> &val); // Pre-decrement
2471 };
2472
2473 llvm::BasicBlock *beginLoop();
John Bauman19bac1e2014-05-06 15:23:49 -04002474 bool branch(RValue<Bool> cmp, llvm::BasicBlock *bodyBB, llvm::BasicBlock *endBB);
John Bauman89401822014-05-06 15:04:28 -04002475 bool elseBlock(llvm::BasicBlock *falseBB);
2476
2477 void Return();
John Bauman19bac1e2014-05-06 15:23:49 -04002478 void Return(bool ret);
John Bauman89401822014-05-06 15:04:28 -04002479 void Return(const Int &ret);
2480
2481 template<class T>
2482 void Return(const Pointer<T> &ret);
2483
2484 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002485 void Return(RValue<Pointer<T> > ret);
John Bauman89401822014-05-06 15:04:28 -04002486
2487 template<class R = Void, class A1 = Void, class A2 = Void, class A3 = Void, class A4 = Void>
2488 class Function
2489 {
2490 public:
2491 Function();
2492
2493 virtual ~Function();
2494
2495 llvm::Argument *arg(int index);
2496
2497 Routine *operator()(const wchar_t *name, ...);
2498
2499 private:
2500 Nucleus *core;
2501 llvm::Function *function;
John Bauman19bac1e2014-05-06 15:23:49 -04002502 std::vector<llvm::Type*> arguments;
John Bauman89401822014-05-06 15:04:28 -04002503 };
2504
2505 RValue<Long> Ticks();
John Bauman89401822014-05-06 15:04:28 -04002506}
2507
2508namespace sw
2509{
2510 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002511 Variable<T>::Variable(int arraySize) : LValue(T::getType(), arraySize)
2512 {
2513 }
2514
2515 template<class T>
2516 RValue<Pointer<T> > Variable<T>::operator&()
2517 {
2518 return RValue<Pointer<T> >(LValue::address);
2519 }
2520
2521 template<class T>
John Bauman89401822014-05-06 15:04:28 -04002522 Reference<T>::Reference(llvm::Value *pointer, int alignment) : alignment(alignment)
2523 {
2524 address = pointer;
2525 }
2526
2527 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002528 RValue<T> Reference<T>::operator=(RValue<T> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002529 {
2530 Nucleus::createStore(rhs.value, address, false, alignment);
2531
2532 return rhs;
2533 }
2534
2535 template<class T>
John Bauman89401822014-05-06 15:04:28 -04002536 RValue<T> Reference<T>::operator=(const Reference<T> &ref) const
2537 {
2538 llvm::Value *tmp = Nucleus::createLoad(ref.address, false, ref.alignment);
2539 Nucleus::createStore(tmp, address, false, alignment);
2540
2541 return RValue<T>(tmp);
2542 }
2543
2544 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002545 RValue<T> Reference<T>::operator+=(RValue<T> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002546 {
2547 return *this = *this + rhs;
2548 }
2549
2550 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002551 llvm::Value *Reference<T>::loadValue() const
2552 {
2553 return Nucleus::createLoad(address, false, alignment);
2554 }
2555
2556 template<class T>
2557 int Reference<T>::getAlignment() const
2558 {
2559 return alignment;
2560 }
2561
2562 template<class T>
John Bauman89401822014-05-06 15:04:28 -04002563 RValue<T>::RValue(llvm::Value *rvalue)
2564 {
2565 value = rvalue;
2566 }
2567
2568 template<class T>
2569 RValue<T>::RValue(const T &lvalue)
2570 {
John Bauman66b8ab22014-05-06 15:57:45 -04002571 value = lvalue.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002572 }
2573
2574 template<class T>
2575 RValue<T>::RValue(typename IntLiteral<T>::type i)
2576 {
2577 value = (llvm::Value*)Nucleus::createConstantInt(i);
2578 }
2579
John Bauman66b8ab22014-05-06 15:57:45 -04002580 template<class T>
2581 RValue<T>::RValue(typename FloatLiteral<T>::type f)
2582 {
2583 value = (llvm::Value*)Nucleus::createConstantFloat(f);
2584 }
2585
2586 template<class T>
2587 RValue<T>::RValue(const Reference<T> &ref)
2588 {
2589 value = ref.loadValue();
2590 }
2591
John Bauman89401822014-05-06 15:04:28 -04002592 template<int T>
2593 Swizzle2Float4<T>::operator RValue<Float4>() const
2594 {
John Bauman66b8ab22014-05-06 15:57:45 -04002595 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002596
2597 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2598 }
2599
2600 template<int T>
2601 SwizzleFloat4<T>::operator RValue<Float4>() const
2602 {
John Bauman66b8ab22014-05-06 15:57:45 -04002603 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002604
2605 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2606 }
2607
2608 template<int T>
2609 SwizzleMaskFloat4<T>::operator RValue<Float4>() const
2610 {
John Bauman66b8ab22014-05-06 15:57:45 -04002611 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002612
2613 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2614 }
2615
2616 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002617 RValue<Float4> SwizzleMaskFloat4<T>::operator=(RValue<Float4> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002618 {
2619 return Mask(*parent, rhs, T);
2620 }
2621
2622 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002623 RValue<Float4> SwizzleMaskFloat4<T>::operator=(RValue<Float> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002624 {
2625 return Mask(*parent, Float4(rhs), T);
2626 }
2627
2628 template<int T>
2629 SwizzleMask1Float4<T>::operator RValue<Float>() const // FIXME: Call a non-template function
2630 {
2631 return Extract(*parent, T & 0x3);
2632 }
2633
2634 template<int T>
2635 SwizzleMask1Float4<T>::operator RValue<Float4>() const
2636 {
John Bauman66b8ab22014-05-06 15:57:45 -04002637 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002638
2639 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2640 }
2641
2642 template<int T>
2643 RValue<Float4> SwizzleMask1Float4<T>::operator=(float x) const
2644 {
2645 return Insert(*parent, Float(x), T & 0x3);
2646 }
2647
2648 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002649 RValue<Float4> SwizzleMask1Float4<T>::operator=(RValue<Float4> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002650 {
2651 return Mask(*parent, Float4(rhs), T);
2652 }
2653
2654 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002655 RValue<Float4> SwizzleMask1Float4<T>::operator=(RValue<Float> rhs) const // FIXME: Call a non-template function
John Bauman89401822014-05-06 15:04:28 -04002656 {
2657 return Insert(*parent, rhs, T & 0x3);
2658 }
2659
2660 template<int T>
2661 SwizzleMask2Float4<T>::operator RValue<Float4>() const
2662 {
John Bauman66b8ab22014-05-06 15:57:45 -04002663 llvm::Value *vector = parent->loadValue();
John Bauman89401822014-05-06 15:04:28 -04002664
2665 return RValue<Float4>(Nucleus::createSwizzle(vector, T));
2666 }
2667
2668 template<int T>
John Bauman19bac1e2014-05-06 15:23:49 -04002669 RValue<Float4> SwizzleMask2Float4<T>::operator=(RValue<Float4> rhs) const
John Bauman89401822014-05-06 15:04:28 -04002670 {
2671 return Mask(*parent, Float4(rhs), T);
2672 }
2673
2674 template<int T>
John Bauman66b8ab22014-05-06 15:57:45 -04002675 Float::Float(const SwizzleMask1Float4<T> &rhs)
2676 {
2677 *this = rhs.operator RValue<Float>();
2678 }
2679
2680 template<int T>
2681 RValue<Float> Float::operator=(const SwizzleMask1Float4<T> &rhs) const
2682 {
2683 return *this = rhs.operator RValue<Float>();
2684 }
2685
2686 template<int T>
2687 Float4::Float4(const SwizzleMask1Float4<T> &rhs)
John Bauman89401822014-05-06 15:04:28 -04002688 {
2689 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002690
John Bauman66b8ab22014-05-06 15:57:45 -04002691 *this = rhs.operator RValue<Float4>();
2692 }
2693
2694 template<int T>
2695 Float4::Float4(const SwizzleFloat4<T> &rhs)
2696 {
2697 xyzw.parent = this;
2698
2699 *this = rhs.operator RValue<Float4>();
John Bauman89401822014-05-06 15:04:28 -04002700 }
2701
2702 template<int X, int Y>
2703 Float4::Float4(const Swizzle2Float4<X> &x, const Swizzle2Float4<Y> &y)
2704 {
2705 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002706
2707 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2708 }
2709
2710 template<int X, int Y>
2711 Float4::Float4(const SwizzleMask2Float4<X> &x, const Swizzle2Float4<Y> &y)
2712 {
2713 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002714
2715 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2716 }
2717
2718 template<int X, int Y>
2719 Float4::Float4(const Swizzle2Float4<X> &x, const SwizzleMask2Float4<Y> &y)
2720 {
2721 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002722
2723 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2724 }
2725
2726 template<int X, int Y>
2727 Float4::Float4(const SwizzleMask2Float4<X> &x, const SwizzleMask2Float4<Y> &y)
2728 {
2729 xyzw.parent = this;
John Bauman89401822014-05-06 15:04:28 -04002730
2731 *this = ShuffleLowHigh(*x.parent, *y.parent, (X & 0xF) | (Y & 0xF) << 4);
2732 }
2733
2734 template<int T>
John Bauman66b8ab22014-05-06 15:57:45 -04002735 RValue<Float4> Float4::operator=(const SwizzleMask1Float4<T> &rhs)
John Bauman89401822014-05-06 15:04:28 -04002736 {
John Bauman66b8ab22014-05-06 15:57:45 -04002737 return *this = rhs.operator RValue<Float4>();
John Bauman89401822014-05-06 15:04:28 -04002738 }
2739
John Bauman66b8ab22014-05-06 15:57:45 -04002740 template<int T>
2741 RValue<Float4> Float4::operator=(const SwizzleFloat4<T> &rhs)
John Bauman89401822014-05-06 15:04:28 -04002742 {
John Bauman66b8ab22014-05-06 15:57:45 -04002743 return *this = rhs.operator RValue<Float4>();
John Bauman89401822014-05-06 15:04:28 -04002744 }
2745
2746 template<class T>
2747 Pointer<T>::Pointer(llvm::Argument *argument) : alignment(1)
2748 {
John Bauman66b8ab22014-05-06 15:57:45 -04002749 LValue::storeValue((llvm::Value*)argument);
John Bauman89401822014-05-06 15:04:28 -04002750 }
2751
2752 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002753 Pointer<T>::Pointer(const void *external) : alignment((intptr_t)external & 0x0000000F ? 1 : 16)
John Bauman89401822014-05-06 15:04:28 -04002754 {
John Bauman89401822014-05-06 15:04:28 -04002755 llvm::Module *module = Nucleus::getModule();
2756 const llvm::GlobalValue *globalPointer = Nucleus::getGlobalValueAtAddress(const_cast<void*>(external)); // FIXME: Const
2757
2758 if(!globalPointer)
2759 {
2760 globalPointer = Nucleus::createGlobalValue(T::getType(), false, alignment);
2761
2762 Nucleus::addGlobalMapping(globalPointer, const_cast<void*>(external)); // FIXME: Const
2763 }
2764
John Bauman66b8ab22014-05-06 15:57:45 -04002765 LValue::storeValue((llvm::Value*)globalPointer); // FIXME: Const
John Bauman89401822014-05-06 15:04:28 -04002766 }
2767
2768 template<class T>
2769 Pointer<T>::Pointer() : alignment(1)
2770 {
John Bauman66b8ab22014-05-06 15:57:45 -04002771 LValue::storeValue(Nucleus::createNullPointer(T::getType()));
John Bauman89401822014-05-06 15:04:28 -04002772 }
2773
2774 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002775 Pointer<T>::Pointer(RValue<Pointer<T> > rhs) : alignment(1)
John Bauman89401822014-05-06 15:04:28 -04002776 {
John Bauman66b8ab22014-05-06 15:57:45 -04002777 LValue::storeValue(rhs.value);
John Bauman89401822014-05-06 15:04:28 -04002778 }
2779
2780 template<class T>
2781 Pointer<T>::Pointer(const Pointer<T> &rhs) : alignment(rhs.alignment)
2782 {
John Bauman66b8ab22014-05-06 15:57:45 -04002783 llvm::Value *value = rhs.loadValue();
2784 LValue::storeValue(value);
John Bauman89401822014-05-06 15:04:28 -04002785 }
2786
2787 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002788 Pointer<T>::Pointer(const Reference<Pointer<T> > &rhs) : alignment(rhs.getAlignment())
John Bauman89401822014-05-06 15:04:28 -04002789 {
John Bauman66b8ab22014-05-06 15:57:45 -04002790 llvm::Value *value = rhs.loadValue();
2791 LValue::storeValue(value);
2792 }
2793
2794 template<class T>
2795 RValue<Pointer<T> > Pointer<T>::operator=(RValue<Pointer<T> > rhs) const
2796 {
2797 LValue::storeValue(rhs.value);
John Bauman89401822014-05-06 15:04:28 -04002798
2799 return rhs;
2800 }
2801
2802 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002803 RValue<Pointer<T> > Pointer<T>::operator=(const Pointer<T> &rhs) const
John Bauman89401822014-05-06 15:04:28 -04002804 {
John Bauman66b8ab22014-05-06 15:57:45 -04002805 llvm::Value *value = rhs.loadValue();
2806 LValue::storeValue(value);
John Bauman89401822014-05-06 15:04:28 -04002807
John Bauman66b8ab22014-05-06 15:57:45 -04002808 return RValue<Pointer<T> >(value);
2809 }
2810
2811 template<class T>
2812 RValue<Pointer<T> > Pointer<T>::operator=(const Reference<Pointer<T> > &rhs) const
2813 {
2814 llvm::Value *value = rhs.loadValue();
2815 LValue::storeValue(value);
2816
2817 return RValue<Pointer<T> >(value);
John Bauman89401822014-05-06 15:04:28 -04002818 }
2819
2820 template<class T>
2821 Reference<T> Pointer<T>::operator*()
2822 {
John Bauman66b8ab22014-05-06 15:57:45 -04002823 return Reference<T>(LValue::loadValue(), alignment);
John Bauman89401822014-05-06 15:04:28 -04002824 }
2825
2826 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002827 llvm::Type *Pointer<T>::getType()
John Bauman89401822014-05-06 15:04:28 -04002828 {
2829 return Nucleus::getPointerType(T::getType());
2830 }
2831
John Bauman19bac1e2014-05-06 15:23:49 -04002832 template<class T, int S>
John Bauman66b8ab22014-05-06 15:57:45 -04002833 Array<T, S>::Array(int size) : Variable<T>(size)
John Bauman89401822014-05-06 15:04:28 -04002834 {
John Bauman89401822014-05-06 15:04:28 -04002835 }
2836
John Bauman19bac1e2014-05-06 15:23:49 -04002837 template<class T, int S>
2838 Reference<T> Array<T, S>::operator[](int index)
John Bauman89401822014-05-06 15:04:28 -04002839 {
John Bauman66b8ab22014-05-06 15:57:45 -04002840 llvm::Value *element = LValue::getAddress((llvm::Value*)Nucleus::createConstantInt(index));
2841
John Bauman89401822014-05-06 15:04:28 -04002842 return Reference<T>(element);
2843 }
2844
John Bauman19bac1e2014-05-06 15:23:49 -04002845 template<class T, int S>
2846 Reference<T> Array<T, S>::operator[](RValue<Int> index)
John Bauman89401822014-05-06 15:04:28 -04002847 {
John Bauman66b8ab22014-05-06 15:57:45 -04002848 llvm::Value *element = LValue::getAddress(index.value);
2849
John Bauman89401822014-05-06 15:04:28 -04002850 return Reference<T>(element);
2851 }
2852
John Bauman19bac1e2014-05-06 15:23:49 -04002853 template<class T, int S>
2854 Reference<T> Array<T, S>::operator[](RValue<UInt> index)
John Bauman89401822014-05-06 15:04:28 -04002855 {
John Bauman66b8ab22014-05-06 15:57:45 -04002856 llvm::Value *element = LValue::getAddress(index.value);
2857
John Bauman89401822014-05-06 15:04:28 -04002858 return Reference<T>(element);
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// }
John Bauman66b8ab22014-05-06 15:57:45 -04002866
John Bauman89401822014-05-06 15:04:28 -04002867// 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 Bauman66b8ab22014-05-06 15:57:45 -04002874// RValue<Array<T> > operator--(const Array<T> &val, int)
John Bauman89401822014-05-06 15:04:28 -04002875// {
2876// // FIXME: Requires storing the address of the array
2877// }
2878
2879// template<class T>
2880// const Array<T> &operator--(const Array<T> &val)
2881// {
2882// // FIXME: Requires storing the address of the array
2883// }
2884
2885 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002886 RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, RValue<T> ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002887 {
2888 return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, ifFalse.value));
2889 }
2890
2891 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002892 RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, RValue<T> ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002893 {
John Bauman66b8ab22014-05-06 15:57:45 -04002894 llvm::Value *trueValue = ifTrue.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002895
2896 return RValue<T>(Nucleus::createSelect(condition.value, trueValue, ifFalse.value));
2897 }
2898
2899 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002900 RValue<T> IfThenElse(RValue<Bool> condition, RValue<T> ifTrue, const T &ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002901 {
John Bauman66b8ab22014-05-06 15:57:45 -04002902 llvm::Value *falseValue = ifFalse.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002903
2904 return RValue<T>(Nucleus::createSelect(condition.value, ifTrue.value, falseValue));
2905 }
2906
2907 template<class T>
John Bauman19bac1e2014-05-06 15:23:49 -04002908 RValue<T> IfThenElse(RValue<Bool> condition, const T &ifTrue, const T &ifFalse)
John Bauman89401822014-05-06 15:04:28 -04002909 {
John Bauman66b8ab22014-05-06 15:57:45 -04002910 llvm::Value *trueValue = ifTrue.loadValue();
2911 llvm::Value *falseValue = ifFalse.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002912
2913 return RValue<T>(Nucleus::createSelect(condition.value, trueValue, falseValue));
2914 }
2915
2916 template<class T>
2917 void Return(const Pointer<T> &ret)
2918 {
2919 Nucleus::createRet(Nucleus::createLoad(ret.address));
John Bauman19bac1e2014-05-06 15:23:49 -04002920 Nucleus::setInsertBlock(Nucleus::createBasicBlock());
John Bauman89401822014-05-06 15:04:28 -04002921 }
2922
2923 template<class T>
John Bauman66b8ab22014-05-06 15:57:45 -04002924 void Return(RValue<Pointer<T> > ret)
John Bauman89401822014-05-06 15:04:28 -04002925 {
2926 Nucleus::createRet(ret.value);
John Bauman19bac1e2014-05-06 15:23:49 -04002927 Nucleus::setInsertBlock(Nucleus::createBasicBlock());
John Bauman89401822014-05-06 15:04:28 -04002928 }
2929
2930 template<class R, class A1, class A2, class A3, class A4>
2931 Function<R, A1, A2, A3, A4>::Function()
2932 {
2933 core = new Nucleus();
2934
2935 if(!A1::isVoid()) arguments.push_back(A1::getType());
2936 if(!A2::isVoid()) arguments.push_back(A2::getType());
2937 if(!A3::isVoid()) arguments.push_back(A3::getType());
2938 if(!A4::isVoid()) arguments.push_back(A4::getType());
2939
2940 function = Nucleus::createFunction(R::getType(), arguments);
John Bauman66b8ab22014-05-06 15:57:45 -04002941 Nucleus::setFunction(function);
John Bauman89401822014-05-06 15:04:28 -04002942 }
2943
2944 template<class R, class A1, class A2, class A3, class A4>
2945 Function<R, A1, A2, A3, A4>::~Function()
2946 {
2947 delete core;
2948 }
2949
2950 template<class R, class A1, class A2, class A3, class A4>
2951 llvm::Argument *Function<R, A1, A2, A3, A4>::arg(int index)
2952 {
2953 return Nucleus::getArgument(function, index);
2954 }
2955
2956 template<class R, class A1, class A2, class A3, class A4>
2957 Routine *Function<R, A1, A2, A3, A4>::operator()(const wchar_t *name, ...)
2958 {
2959 wchar_t fullName[1024 + 1];
2960
2961 va_list vararg;
2962 va_start(vararg, name);
2963 vswprintf(fullName, 1024, name, vararg);
2964 va_end(vararg);
2965
2966 return core->acquireRoutine(fullName, true);
2967 }
2968
2969 template<class T, class S>
John Bauman19bac1e2014-05-06 15:23:49 -04002970 RValue<T> ReinterpretCast(RValue<S> val)
John Bauman89401822014-05-06 15:04:28 -04002971 {
2972 return RValue<T>(Nucleus::createBitCast(val.value, T::getType()));
2973 }
2974
John Bauman66b8ab22014-05-06 15:57:45 -04002975 template<class T>
2976 RValue<T> ReinterpretCast(const LValue &var)
John Bauman89401822014-05-06 15:04:28 -04002977 {
John Bauman66b8ab22014-05-06 15:57:45 -04002978 llvm::Value *val = var.loadValue();
John Bauman89401822014-05-06 15:04:28 -04002979
2980 return RValue<T>(Nucleus::createBitCast(val, T::getType()));
2981 }
2982
2983 template<class T, class S>
2984 RValue<T> ReinterpretCast(const Reference<S> &var)
2985 {
2986 return ReinterpretCast<T>(RValue<S>(var));
2987 }
2988
2989 template<class T, class S>
John Bauman19bac1e2014-05-06 15:23:49 -04002990 RValue<T> As(RValue<S> val)
John Bauman89401822014-05-06 15:04:28 -04002991 {
2992 return ReinterpretCast<T>(val);
2993 }
2994
John Bauman66b8ab22014-05-06 15:57:45 -04002995 template<class T>
2996 RValue<T> As(const LValue &var)
John Bauman89401822014-05-06 15:04:28 -04002997 {
2998 return ReinterpretCast<T>(var);
2999 }
3000
3001 template<class T, class S>
3002 RValue<T> As(const Reference<S> &val)
3003 {
3004 return ReinterpretCast<T>(val);
3005 }
3006}
3007
3008#endif // sw_Nucleus_hpp