blob: ee3b323f0fdd8c4185c8e84a48c4ea327545d51d [file] [log] [blame]
Nicolas Capens598f8d82016-09-26 15:09:10 -04001// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include "Nucleus.hpp"
16
17#include "Reactor.hpp"
18#include "Routine.hpp"
19
20#include "src/IceTypes.h"
21#include "src/IceCfg.h"
22#include "src/IceELFStreamer.h"
23#include "src/IceGlobalContext.h"
24#include "src/IceCfgNode.h"
25#include "src/IceELFObjectWriter.h"
26
27#include "llvm/Support/FileSystem.h"
28#include "llvm/Support/raw_os_ostream.h"
29
30#define WIN32_LEAN_AND_MEAN
31#define NOMINMAX
32#include <Windows.h>
33
34#include <mutex>
35#include <limits>
36#include <iostream>
37#include <cassert>
38
39namespace
40{
41 Ice::GlobalContext *context = nullptr;
42 Ice::Cfg *function = nullptr;
43 Ice::CfgNode *basicBlock = nullptr;
44 Ice::CfgLocalAllocatorScope *allocator = nullptr;
45 sw::Routine *routine = nullptr;
46
47 std::mutex codegenMutex;
48
49 Ice::ELFFileStreamer *elfFile = nullptr;
50 Ice::Fdstream *out = nullptr;
51}
52
53namespace sw
54{
Nicolas Capens23d99a42016-09-30 14:57:16 -040055 enum EmulatedType
56 {
57 EmulatedShift = 16,
58 EmulatedV2 = 2 << EmulatedShift,
59 EmulatedV4 = 4 << EmulatedShift,
60 EmulatedV8 = 8 << EmulatedShift,
61 EmulatedBits = EmulatedV2 | EmulatedV4 | EmulatedV8,
62
63 Type_v2i32 = Ice::IceType_v4i32 | EmulatedV2,
64 Type_v4i16 = Ice::IceType_v8i16 | EmulatedV4,
65 Type_v2i16 = Ice::IceType_v8i16 | EmulatedV2,
66 Type_v8i8 = Ice::IceType_v16i8 | EmulatedV8,
67 Type_v4i8 = Ice::IceType_v16i8 | EmulatedV4,
68 };
69
Nicolas Capens598f8d82016-09-26 15:09:10 -040070 class Value : public Ice::Variable {};
Nicolas Capensb955d5b2016-09-28 22:36:28 -040071 class Constant : public Ice::Constant {};
Nicolas Capens598f8d82016-09-26 15:09:10 -040072 class BasicBlock : public Ice::CfgNode {};
73
74 Ice::Type T(Type *t)
75 {
Nicolas Capens23d99a42016-09-30 14:57:16 -040076 static_assert(Ice::IceType_NUM < EmulatedBits, "Ice::Type overlaps with our emulated types!");
77 return (Ice::Type)(reinterpret_cast<std::intptr_t>(t) & ~EmulatedBits);
Nicolas Capens598f8d82016-09-26 15:09:10 -040078 }
79
80 Type *T(Ice::Type t)
81 {
82 return reinterpret_cast<Type*>(t);
83 }
84
Nicolas Capens23d99a42016-09-30 14:57:16 -040085 Type *T(EmulatedType t)
86 {
87 return reinterpret_cast<Type*>(t);
88 }
89
Nicolas Capens598f8d82016-09-26 15:09:10 -040090 Value *V(Ice::Variable *v)
91 {
92 return reinterpret_cast<Value*>(v);
93 }
94
Nicolas Capensb955d5b2016-09-28 22:36:28 -040095 Constant *C(Ice::Constant *c)
96 {
97 return reinterpret_cast<Constant*>(c);
98 }
99
Nicolas Capens611642a2016-09-28 16:45:04 -0400100 BasicBlock *B(Ice::CfgNode *b)
101 {
102 return reinterpret_cast<BasicBlock*>(b);
103 }
104
Nicolas Capens598f8d82016-09-26 15:09:10 -0400105 Optimization optimization[10] = {InstructionCombining, Disabled};
106
107 void *loadImage(uint8_t *const elfImage)
108 {
109 using ElfHeader = std::conditional<sizeof(void*) == 8, Elf64_Ehdr, Elf32_Ehdr>::type;
110 ElfHeader *elfHeader = (ElfHeader*)elfImage;
111
112 if(!elfHeader->checkMagic())
113 {
114 return nullptr;
115 }
116
117 using SectionHeader = std::conditional<sizeof(void*) == 8, Elf64_Shdr, Elf32_Shdr>::type;
118 SectionHeader *sectionHeader = (SectionHeader*)(elfImage + elfHeader->e_shoff);
119 void *entry = nullptr;
120
121 for(int i = 0; i < elfHeader->e_shnum; i++)
122 {
123 if(sectionHeader[i].sh_type == SHT_PROGBITS && sectionHeader[i].sh_flags & SHF_EXECINSTR)
124 {
125 entry = elfImage + sectionHeader[i].sh_offset;
126 }
127 }
128
129 return entry;
130 }
131
132 template<typename T>
133 struct ExecutableAllocator
134 {
135 ExecutableAllocator() {};
136 template<class U> ExecutableAllocator(const ExecutableAllocator<U> &other) {};
137
138 using value_type = T;
139 using size_type = std::size_t;
140
141 T *allocate(size_type n)
142 {
143 return (T*)VirtualAlloc(NULL, sizeof(T) * n, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
144 }
145
146 void deallocate(T *p, size_type n)
147 {
148 VirtualFree(p, 0, MEM_RELEASE);
149 }
150 };
151
152 class ELFMemoryStreamer : public Ice::ELFStreamer, public Routine
153 {
154 ELFMemoryStreamer(const ELFMemoryStreamer &) = delete;
155 ELFMemoryStreamer &operator=(const ELFMemoryStreamer &) = delete;
156
157 public:
158 ELFMemoryStreamer() : Routine()
159 {
160 position = 0;
161 buffer.reserve(0x1000);
162 }
163
164 virtual ~ELFMemoryStreamer()
165 {
166 if(buffer.size() != 0)
167 {
168 DWORD exeProtection;
169 VirtualProtect(&buffer[0], buffer.size(), oldProtection, &exeProtection);
170 }
171 }
172
173 void write8(uint8_t Value) override
174 {
175 if(position == (uint64_t)buffer.size())
176 {
177 buffer.push_back(Value);
178 position++;
179 }
180 else if(position < (uint64_t)buffer.size())
181 {
182 buffer[position] = Value;
183 position++;
184 }
185 else assert(false && "UNIMPLEMENTED");
186 }
187
188 void writeBytes(llvm::StringRef Bytes) override
189 {
190 std::size_t oldSize = buffer.size();
191 buffer.resize(oldSize + Bytes.size());
192 memcpy(&buffer[oldSize], Bytes.begin(), Bytes.size());
193 position += Bytes.size();
194 }
195
196 uint64_t tell() const override { return position; }
197
198 void seek(uint64_t Off) override { position = Off; }
199
200 const void *getEntry() override
201 {
202 VirtualProtect(&buffer[0], buffer.size(), PAGE_EXECUTE_READ, &oldProtection);
203 position = std::numeric_limits<std::size_t>::max(); // Can't write more data after this
204
205 return loadImage(&buffer[0]);
206 }
207
208 private:
209 std::vector<uint8_t, ExecutableAllocator<uint8_t>> buffer;
210 std::size_t position;
211 DWORD oldProtection;
212 };
213
214 Nucleus::Nucleus()
215 {
216 ::codegenMutex.lock(); // Reactor is currently not thread safe
217
218 Ice::ClFlags::Flags.setTargetArch(sizeof(void*) == 8 ? Ice::Target_X8664 : Ice::Target_X8632);
219 Ice::ClFlags::Flags.setOutFileType(Ice::FT_Elf);
220 Ice::ClFlags::Flags.setOptLevel(Ice::Opt_2);
221 Ice::ClFlags::Flags.setApplicationBinaryInterface(Ice::ABI_Platform);
222
223 std::unique_ptr<Ice::Ostream> cout(new llvm::raw_os_ostream(std::cout));
224
225 if(false) // Write out to a file
226 {
227 std::error_code errorCode;
228 ::out = new Ice::Fdstream("out.o", errorCode, llvm::sys::fs::F_None);
229 ::elfFile = new Ice::ELFFileStreamer(*out);
230 ::context = new Ice::GlobalContext(cout.get(), cout.get(), cout.get(), elfFile);
231 }
232 else
233 {
234 ELFMemoryStreamer *elfMemory = new ELFMemoryStreamer();
235 ::context = new Ice::GlobalContext(cout.get(), cout.get(), cout.get(), elfMemory);
236 ::routine = elfMemory;
237 }
238 }
239
240 Nucleus::~Nucleus()
241 {
242 delete ::allocator;
243 delete ::function;
244 delete ::context;
245
246 delete ::elfFile;
247 delete ::out;
248
249 ::codegenMutex.unlock();
250 }
251
252 Routine *Nucleus::acquireRoutine(const wchar_t *name, bool runOptimizations)
253 {
254 if(basicBlock->getInsts().empty() || basicBlock->getInsts().back().getKind() != Ice::Inst::Ret)
255 {
256 createRetVoid();
257 }
258
259 std::wstring wideName(name);
260 std::string asciiName(wideName.begin(), wideName.end());
261 ::function->setFunctionName(Ice::GlobalString::createWithString(::context, asciiName));
262
263 ::function->translate();
264
265 ::context->emitFileHeader();
266 ::function->emitIAS();
267 auto assembler = ::function->releaseAssembler();
268 ::context->getObjectWriter()->writeFunctionCode(::function->getFunctionName(), false, assembler.get());
269 ::context->getObjectWriter()->writeNonUserSections();
270
271 return ::routine;
272 }
273
274 void Nucleus::optimize()
275 {
276 }
277
278 Value *Nucleus::allocateStackVariable(Type *t, int arraySize)
279 {
Nicolas Capense12780d2016-09-27 14:18:07 -0400280 assert(arraySize == 0 && "UNIMPLEMENTED");
281
Nicolas Capens598f8d82016-09-26 15:09:10 -0400282 Ice::Type type = T(t);
Nicolas Capens8820f642016-09-30 04:42:43 -0400283 int size = Ice::typeWidthInBytes(type);
Nicolas Capense12780d2016-09-27 14:18:07 -0400284
285 auto bytes = Ice::ConstantInteger32::create(::context, type, size);
286 auto address = ::function->makeVariable(T(getPointerType(t)));
287 auto alloca = Ice::InstAlloca::create(::function, address, bytes, size);
288 ::function->getEntryNode()->getInsts().push_front(alloca);
289
290 return V(address);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400291 }
292
293 BasicBlock *Nucleus::createBasicBlock()
294 {
Nicolas Capens611642a2016-09-28 16:45:04 -0400295 return B(::function->makeNode());
Nicolas Capens598f8d82016-09-26 15:09:10 -0400296 }
297
298 BasicBlock *Nucleus::getInsertBlock()
299 {
Nicolas Capens611642a2016-09-28 16:45:04 -0400300 return B(::basicBlock);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400301 }
302
303 void Nucleus::setInsertBlock(BasicBlock *basicBlock)
304 {
Nicolas Capens611642a2016-09-28 16:45:04 -0400305 assert(::basicBlock->getInsts().back().getTerminatorEdges().size() >= 0 && "Previous basic block must have a terminator");
306 ::basicBlock = basicBlock;
Nicolas Capens598f8d82016-09-26 15:09:10 -0400307 }
308
309 BasicBlock *Nucleus::getPredecessor(BasicBlock *basicBlock)
310 {
311 assert(false && "UNIMPLEMENTED"); return nullptr;
312 }
313
314 void Nucleus::createFunction(Type *ReturnType, std::vector<Type*> &Params)
315 {
316 uint32_t sequenceNumber = 0;
317 ::function = Ice::Cfg::create(::context, sequenceNumber).release();
318 ::allocator = new Ice::CfgLocalAllocatorScope(::function);
319
320 for(Type *type : Params)
321 {
322 Ice::Variable *arg = ::function->makeVariable(T(type));
323 ::function->addArg(arg);
324 }
325
326 Ice::CfgNode *node = ::function->makeNode();
327 ::function->setEntryNode(node);
328 ::basicBlock = node;
329 }
330
331 Value *Nucleus::getArgument(unsigned int index)
332 {
333 return V(::function->getArgs()[index]);
334 }
335
336 void Nucleus::createRetVoid()
337 {
338 assert(false && "UNIMPLEMENTED");
339 }
340
341 void Nucleus::createRet(Value *v)
342 {
343 assert(false && "UNIMPLEMENTED");
344 }
345
346 void Nucleus::createBr(BasicBlock *dest)
347 {
Nicolas Capens611642a2016-09-28 16:45:04 -0400348 auto br = Ice::InstBr::create(::function, dest);
349 ::basicBlock->appendInst(br);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400350 }
351
352 void Nucleus::createCondBr(Value *cond, BasicBlock *ifTrue, BasicBlock *ifFalse)
353 {
Nicolas Capens611642a2016-09-28 16:45:04 -0400354 auto br = Ice::InstBr::create(::function, cond, ifTrue, ifFalse);
355 ::basicBlock->appendInst(br);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400356 }
357
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400358 static Value *createArithmetic(Ice::InstArithmetic::OpKind op, Value *lhs, Value *rhs)
359 {
360 assert(lhs->getType() == rhs->getType());
361
362 Ice::Variable *result = ::function->makeVariable(lhs->getType());
363 Ice::InstArithmetic *arithmetic = Ice::InstArithmetic::create(::function, op, result, lhs, rhs);
364 ::basicBlock->appendInst(arithmetic);
365
366 return V(result);
367 }
368
Nicolas Capens598f8d82016-09-26 15:09:10 -0400369 Value *Nucleus::createAdd(Value *lhs, Value *rhs)
370 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400371 return createArithmetic(Ice::InstArithmetic::Add, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400372 }
373
374 Value *Nucleus::createSub(Value *lhs, Value *rhs)
375 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400376 return createArithmetic(Ice::InstArithmetic::Sub, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400377 }
378
379 Value *Nucleus::createMul(Value *lhs, Value *rhs)
380 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400381 return createArithmetic(Ice::InstArithmetic::Mul, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400382 }
383
384 Value *Nucleus::createUDiv(Value *lhs, Value *rhs)
385 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400386 return createArithmetic(Ice::InstArithmetic::Udiv, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400387 }
388
389 Value *Nucleus::createSDiv(Value *lhs, Value *rhs)
390 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400391 return createArithmetic(Ice::InstArithmetic::Sdiv, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400392 }
393
394 Value *Nucleus::createFAdd(Value *lhs, Value *rhs)
395 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400396 return createArithmetic(Ice::InstArithmetic::Fadd, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400397 }
398
399 Value *Nucleus::createFSub(Value *lhs, Value *rhs)
400 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400401 return createArithmetic(Ice::InstArithmetic::Fsub, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400402 }
403
404 Value *Nucleus::createFMul(Value *lhs, Value *rhs)
405 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400406 return createArithmetic(Ice::InstArithmetic::Fmul, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400407 }
408
409 Value *Nucleus::createFDiv(Value *lhs, Value *rhs)
410 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400411 return createArithmetic(Ice::InstArithmetic::Fdiv, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400412 }
413
414 Value *Nucleus::createURem(Value *lhs, Value *rhs)
415 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400416 return createArithmetic(Ice::InstArithmetic::Urem, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400417 }
418
419 Value *Nucleus::createSRem(Value *lhs, Value *rhs)
420 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400421 return createArithmetic(Ice::InstArithmetic::Srem, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400422 }
423
424 Value *Nucleus::createFRem(Value *lhs, Value *rhs)
425 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400426 return createArithmetic(Ice::InstArithmetic::Frem, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400427 }
428
429 Value *Nucleus::createShl(Value *lhs, Value *rhs)
430 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400431 return createArithmetic(Ice::InstArithmetic::Shl, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400432 }
433
434 Value *Nucleus::createLShr(Value *lhs, Value *rhs)
435 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400436 return createArithmetic(Ice::InstArithmetic::Lshr, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400437 }
438
439 Value *Nucleus::createAShr(Value *lhs, Value *rhs)
440 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400441 return createArithmetic(Ice::InstArithmetic::Ashr, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400442 }
443
444 Value *Nucleus::createAnd(Value *lhs, Value *rhs)
445 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400446 return createArithmetic(Ice::InstArithmetic::And, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400447 }
448
449 Value *Nucleus::createOr(Value *lhs, Value *rhs)
450 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400451 return createArithmetic(Ice::InstArithmetic::Or, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400452 }
453
454 Value *Nucleus::createXor(Value *lhs, Value *rhs)
455 {
Nicolas Capens7d9f76d2016-09-29 13:39:44 -0400456 return createArithmetic(Ice::InstArithmetic::Xor, lhs, rhs);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400457 }
458
Nicolas Capensb955d5b2016-09-28 22:36:28 -0400459 Value *Nucleus::createAssign(Constant *constant)
460 {
461 Ice::Variable *value = ::function->makeVariable(constant->getType());
462 auto assign = Ice::InstAssign::create(::function, value, constant);
463 ::basicBlock->appendInst(assign);
464
465 return V(value);
466 }
467
Nicolas Capens598f8d82016-09-26 15:09:10 -0400468 Value *Nucleus::createNeg(Value *v)
469 {
470 assert(false && "UNIMPLEMENTED"); return nullptr;
471 }
472
473 Value *Nucleus::createFNeg(Value *v)
474 {
475 assert(false && "UNIMPLEMENTED"); return nullptr;
476 }
477
478 Value *Nucleus::createNot(Value *v)
479 {
480 assert(false && "UNIMPLEMENTED"); return nullptr;
481 }
482
Nicolas Capense12780d2016-09-27 14:18:07 -0400483 Value *Nucleus::createLoad(Value *ptr, Type *type, bool isVolatile, unsigned int align)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400484 {
Nicolas Capens23d99a42016-09-30 14:57:16 -0400485 int valueType = (int)reinterpret_cast<intptr_t>(type);
486 Ice::Variable *result = ::function->makeVariable(T(type));
487
488 if(valueType & EmulatedBits)
489 {
490 switch(valueType)
491 {
492 case Type_v4i8:
493 case Type_v2i16:
494 {
495 const Ice::Intrinsics::IntrinsicInfo intrinsic = {Ice::Intrinsics::LoadSubVector, Ice::Intrinsics::SideEffects_F, Ice::Intrinsics::ReturnsTwice_F, Ice::Intrinsics::MemoryWrite_F};
496 auto target = ::context->getConstantUndef(Ice::IceType_i32);
497 auto load = Ice::InstIntrinsicCall::create(::function, 2, result, target, intrinsic);
498 load->addArg(::context->getConstantInt32(4));
499 load->addArg(ptr);
500 ::basicBlock->appendInst(load);
501 }
502 break;
503 case Type_v2i32:
504 case Type_v8i8:
505 case Type_v4i16:
506 {
507 const Ice::Intrinsics::IntrinsicInfo intrinsic = {Ice::Intrinsics::LoadSubVector, Ice::Intrinsics::SideEffects_F, Ice::Intrinsics::ReturnsTwice_F, Ice::Intrinsics::MemoryWrite_F};
508 auto target = ::context->getConstantUndef(Ice::IceType_i32);
509 auto load = Ice::InstIntrinsicCall::create(::function, 2, result, target, intrinsic);
510 load->addArg(::context->getConstantInt32(8));
511 load->addArg(ptr);
512 ::basicBlock->appendInst(load);
513 }
514 break;
515 default: assert(false && "UNIMPLEMENTED");
516 }
517 }
518 else
519 {
520 auto load = Ice::InstLoad::create(::function, result, ptr, align);
521 ::basicBlock->appendInst(load);
522 }
523
524 return V(result);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400525 }
526
Nicolas Capens6d738712016-09-30 04:15:22 -0400527 Value *Nucleus::createStore(Value *value, Value *ptr, Type *type, bool isVolatile, unsigned int align)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400528 {
Nicolas Capens23d99a42016-09-30 14:57:16 -0400529 int valueType = (int)reinterpret_cast<intptr_t>(type);
530
531 if(valueType & EmulatedBits)
532 {
533 switch(valueType)
534 {
535 case Type_v4i8:
536 case Type_v2i16:
537 {
538 const Ice::Intrinsics::IntrinsicInfo intrinsic = {Ice::Intrinsics::StoreSubVector, Ice::Intrinsics::SideEffects_T, Ice::Intrinsics::ReturnsTwice_F, Ice::Intrinsics::MemoryWrite_T};
539 auto target = ::context->getConstantUndef(Ice::IceType_i32);
540 auto store = Ice::InstIntrinsicCall::create(::function, 3, nullptr, target, intrinsic);
541 store->addArg(::context->getConstantInt32(4));
542 store->addArg(value);
543 store->addArg(ptr);
544 ::basicBlock->appendInst(store);
545 }
546 break;
547 case Type_v2i32:
548 case Type_v8i8:
549 case Type_v4i16:
550 {
551 const Ice::Intrinsics::IntrinsicInfo intrinsic = {Ice::Intrinsics::StoreSubVector, Ice::Intrinsics::SideEffects_T, Ice::Intrinsics::ReturnsTwice_F, Ice::Intrinsics::MemoryWrite_T};
552 auto target = ::context->getConstantUndef(Ice::IceType_i32);
553 auto store = Ice::InstIntrinsicCall::create(::function, 3, nullptr, target, intrinsic);
554 store->addArg(::context->getConstantInt32(8));
555 store->addArg(value);
556 store->addArg(ptr);
557 ::basicBlock->appendInst(store);
558 }
559 break;
560 default: assert(false && "UNIMPLEMENTED");
561 }
562 }
563 else
564 {
565 assert(T(value->getType()) == type);
566
567 auto store = Ice::InstStore::create(::function, value, ptr, align);
568 ::basicBlock->appendInst(store);
569 }
570
Nicolas Capens598f8d82016-09-26 15:09:10 -0400571 return value;
572 }
573
Nicolas Capens6d738712016-09-30 04:15:22 -0400574 Constant *Nucleus::createStore(Constant *constant, Value *ptr, Type *type, bool isVolatile, unsigned int align)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400575 {
Nicolas Capensb955d5b2016-09-28 22:36:28 -0400576 auto store = Ice::InstStore::create(::function, constant, ptr, align);
577 ::basicBlock->appendInst(store);
578 return constant;
Nicolas Capens598f8d82016-09-26 15:09:10 -0400579 }
580
Nicolas Capens6d738712016-09-30 04:15:22 -0400581 Value *Nucleus::createGEP(Value *ptr, Type *type, Value *index)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400582 {
Nicolas Capens8820f642016-09-30 04:42:43 -0400583 assert(index->getType() == Ice::IceType_i32);
584
585 if(!Ice::isByteSizedType(T(type)))
586 {
587 index = createMul(index, createAssign(createConstantInt((int)Ice::typeWidthInBytes(T(type)))));
588 }
589
590 if(sizeof(void*) == 8)
591 {
592 index = createSExt(index, T(Ice::IceType_i64));
593 }
594
595 return createAdd(ptr, index);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400596 }
597
598 Value *Nucleus::createAtomicAdd(Value *ptr, Value *value)
599 {
600 assert(false && "UNIMPLEMENTED"); return nullptr;
601 }
602
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400603 static Value *createCast(Ice::InstCast::OpKind op, Value *v, Type *destType)
604 {
Nicolas Capens23d99a42016-09-30 14:57:16 -0400605 if(v->getType() == T(destType))
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400606 {
607 return v;
608 }
609
610 Ice::Variable *result = ::function->makeVariable(T(destType));
611 Ice::InstCast *cast = Ice::InstCast::create(::function, op, result, v);
612 ::basicBlock->appendInst(cast);
613
614 return V(result);
615 }
616
Nicolas Capens598f8d82016-09-26 15:09:10 -0400617 Value *Nucleus::createTrunc(Value *v, Type *destType)
618 {
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400619 return createCast(Ice::InstCast::Trunc, v, destType);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400620 }
621
622 Value *Nucleus::createZExt(Value *v, Type *destType)
623 {
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400624 return createCast(Ice::InstCast::Zext, v, destType);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400625 }
626
627 Value *Nucleus::createSExt(Value *v, Type *destType)
628 {
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400629 return createCast(Ice::InstCast::Sext, v, destType);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400630 }
631
632 Value *Nucleus::createFPToSI(Value *v, Type *destType)
633 {
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400634 return createCast(Ice::InstCast::Fptosi, v, destType);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400635 }
636
637 Value *Nucleus::createUIToFP(Value *v, Type *destType)
638 {
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400639 return createCast(Ice::InstCast::Uitofp, v, destType);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400640 }
641
642 Value *Nucleus::createSIToFP(Value *v, Type *destType)
643 {
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400644 return createCast(Ice::InstCast::Sitofp, v, destType);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400645 }
646
647 Value *Nucleus::createFPTrunc(Value *v, Type *destType)
648 {
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400649 return createCast(Ice::InstCast::Fptrunc, v, destType);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400650 }
651
652 Value *Nucleus::createFPExt(Value *v, Type *destType)
653 {
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400654 return createCast(Ice::InstCast::Fpext, v, destType);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400655 }
656
657 Value *Nucleus::createBitCast(Value *v, Type *destType)
658 {
Nicolas Capensa0c2fc52016-09-30 05:04:21 -0400659 return createCast(Ice::InstCast::Bitcast, v, destType);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400660 }
661
662 Value *Nucleus::createIntCast(Value *v, Type *destType, bool isSigned)
663 {
664 assert(false && "UNIMPLEMENTED"); return nullptr;
665 }
666
667 Value *Nucleus::createICmpEQ(Value *lhs, Value *rhs)
668 {
669 assert(false && "UNIMPLEMENTED"); return nullptr;
670 }
671
672 Value *Nucleus::createICmpNE(Value *lhs, Value *rhs)
673 {
674 assert(false && "UNIMPLEMENTED"); return nullptr;
675 }
676
677 Value *Nucleus::createICmpUGT(Value *lhs, Value *rhs)
678 {
679 assert(false && "UNIMPLEMENTED"); return nullptr;
680 }
681
682 Value *Nucleus::createICmpUGE(Value *lhs, Value *rhs)
683 {
684 assert(false && "UNIMPLEMENTED"); return nullptr;
685 }
686
687 Value *Nucleus::createICmpULT(Value *lhs, Value *rhs)
688 {
689 assert(false && "UNIMPLEMENTED"); return nullptr;
690 }
691
692 Value *Nucleus::createICmpULE(Value *lhs, Value *rhs)
693 {
694 assert(false && "UNIMPLEMENTED"); return nullptr;
695 }
696
697 Value *Nucleus::createICmpSGT(Value *lhs, Value *rhs)
698 {
699 assert(false && "UNIMPLEMENTED"); return nullptr;
700 }
701
702 Value *Nucleus::createICmpSGE(Value *lhs, Value *rhs)
703 {
704 assert(false && "UNIMPLEMENTED"); return nullptr;
705 }
706
707 Value *Nucleus::createICmpSLT(Value *lhs, Value *rhs)
708 {
Nicolas Capens611642a2016-09-28 16:45:04 -0400709 assert(lhs->getType() == rhs->getType());
710
711 auto result = ::function->makeVariable(Ice::IceType_i1);
712 auto cmp = Ice::InstIcmp::create(::function, Ice::InstIcmp::Slt, result, lhs, rhs);
713 ::basicBlock->appendInst(cmp);
714
715 return V(result);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400716 }
717
718 Value *Nucleus::createICmpSLE(Value *lhs, Value *rhs)
719 {
720 assert(false && "UNIMPLEMENTED"); return nullptr;
721 }
722
723 Value *Nucleus::createFCmpOEQ(Value *lhs, Value *rhs)
724 {
725 assert(false && "UNIMPLEMENTED"); return nullptr;
726 }
727
728 Value *Nucleus::createFCmpOGT(Value *lhs, Value *rhs)
729 {
730 assert(false && "UNIMPLEMENTED"); return nullptr;
731 }
732
733 Value *Nucleus::createFCmpOGE(Value *lhs, Value *rhs)
734 {
735 assert(false && "UNIMPLEMENTED"); return nullptr;
736 }
737
738 Value *Nucleus::createFCmpOLT(Value *lhs, Value *rhs)
739 {
740 assert(false && "UNIMPLEMENTED"); return nullptr;
741 }
742
743 Value *Nucleus::createFCmpOLE(Value *lhs, Value *rhs)
744 {
745 assert(false && "UNIMPLEMENTED"); return nullptr;
746 }
747
748 Value *Nucleus::createFCmpONE(Value *lhs, Value *rhs)
749 {
750 assert(false && "UNIMPLEMENTED"); return nullptr;
751 }
752
753 Value *Nucleus::createFCmpORD(Value *lhs, Value *rhs)
754 {
755 assert(false && "UNIMPLEMENTED"); return nullptr;
756 }
757
758 Value *Nucleus::createFCmpUNO(Value *lhs, Value *rhs)
759 {
760 assert(false && "UNIMPLEMENTED"); return nullptr;
761 }
762
763 Value *Nucleus::createFCmpUEQ(Value *lhs, Value *rhs)
764 {
765 assert(false && "UNIMPLEMENTED"); return nullptr;
766 }
767
768 Value *Nucleus::createFCmpUGT(Value *lhs, Value *rhs)
769 {
770 assert(false && "UNIMPLEMENTED"); return nullptr;
771 }
772
773 Value *Nucleus::createFCmpUGE(Value *lhs, Value *rhs)
774 {
775 assert(false && "UNIMPLEMENTED"); return nullptr;
776 }
777
778 Value *Nucleus::createFCmpULT(Value *lhs, Value *rhs)
779 {
780 assert(false && "UNIMPLEMENTED"); return nullptr;
781 }
782
783 Value *Nucleus::createFCmpULE(Value *lhs, Value *rhs)
784 {
785 assert(false && "UNIMPLEMENTED"); return nullptr;
786 }
787
788 Value *Nucleus::createFCmpUNE(Value *lhs, Value *rhs)
789 {
790 assert(false && "UNIMPLEMENTED"); return nullptr;
791 }
792
Nicolas Capense95d5342016-09-30 11:37:28 -0400793 Value *Nucleus::createExtractElement(Value *vector, Type *type, int index)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400794 {
Nicolas Capens9709d4f2016-09-30 11:44:14 -0400795 auto result = ::function->makeVariable(T(type));
796 auto extract = Ice::InstExtractElement::create(::function, result, vector, ::context->getConstantInt32(index));
797 ::basicBlock->appendInst(extract);
798
799 return V(result);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400800 }
801
802 Value *Nucleus::createInsertElement(Value *vector, Value *element, int index)
803 {
Nicolas Capens9709d4f2016-09-30 11:44:14 -0400804 auto result = ::function->makeVariable(vector->getType());
805 auto insert = Ice::InstInsertElement::create(::function, result, vector, element, ::context->getConstantInt32(index));
806 ::basicBlock->appendInst(insert);
807
808 return V(result);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400809 }
810
Nicolas Capense89cd582016-09-30 14:23:47 -0400811 Value *Nucleus::createShuffleVector(Value *V1, Value *V2, const int *select)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400812 {
Nicolas Capens619c0ab2016-09-30 14:46:24 -0400813 assert(V1->getType() == V2->getType());
814
815 int size = Ice::typeNumElements(V1->getType());
816 auto result = ::function->makeVariable(V1->getType());
817 auto shuffle = Ice::InstShuffleVector::create(::function, result, V1, V2);
818
819 for(int i = 0; i < size; i++)
820 {
821 shuffle->addIndex(llvm::cast<Ice::ConstantInteger32>(::context->getConstantInt32(select[i])));
822 }
823
824 ::basicBlock->appendInst(shuffle);
825
826 return V(result);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400827 }
828
829 Value *Nucleus::createSelect(Value *C, Value *ifTrue, Value *ifFalse)
830 {
831 assert(false && "UNIMPLEMENTED"); return nullptr;
832 }
833
834 Value *Nucleus::createSwitch(Value *v, BasicBlock *Dest, unsigned NumCases)
835 {
836 assert(false && "UNIMPLEMENTED"); return nullptr;
837 }
838
839 void Nucleus::addSwitchCase(Value *Switch, int Case, BasicBlock *Branch)
840 {
841 assert(false && "UNIMPLEMENTED"); return;
842 }
843
844 void Nucleus::createUnreachable()
845 {
846 assert(false && "UNIMPLEMENTED");
847 }
848
Nicolas Capense95d5342016-09-30 11:37:28 -0400849 static Value *createSwizzle4(Value *val, unsigned char select)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400850 {
Nicolas Capens619c0ab2016-09-30 14:46:24 -0400851 int swizzle[4] =
852 {
853 (select >> 0) & 0x03,
854 (select >> 2) & 0x03,
855 (select >> 4) & 0x03,
856 (select >> 6) & 0x03,
857 };
Nicolas Capens9709d4f2016-09-30 11:44:14 -0400858
Nicolas Capens619c0ab2016-09-30 14:46:24 -0400859 return Nucleus::createShuffleVector(val, val, swizzle);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400860 }
861
Nicolas Capense95d5342016-09-30 11:37:28 -0400862 static Value *createMask4(Value *lhs, Value *rhs, unsigned char select)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400863 {
864 assert(false && "UNIMPLEMENTED"); return nullptr;
865 }
866
867 Constant *Nucleus::createConstantPointer(const void *address, Type *Ty, bool isConstant, unsigned int Align)
868 {
869 assert(false && "UNIMPLEMENTED"); return nullptr;
870 }
871
872 Type *Nucleus::getPointerType(Type *ElementType)
873 {
Nicolas Capense12780d2016-09-27 14:18:07 -0400874 if(sizeof(void*) == 8)
875 {
876 return T(Ice::IceType_i64);
877 }
878 else
879 {
880 return T(Ice::IceType_i32);
881 }
Nicolas Capens598f8d82016-09-26 15:09:10 -0400882 }
883
884 Constant *Nucleus::createNullValue(Type *Ty)
885 {
886 assert(false && "UNIMPLEMENTED"); return nullptr;
887 }
888
889 Constant *Nucleus::createConstantInt(int64_t i)
890 {
891 assert(false && "UNIMPLEMENTED"); return nullptr;
892 }
893
894 Constant *Nucleus::createConstantInt(int i)
895 {
Nicolas Capensb955d5b2016-09-28 22:36:28 -0400896 return C(::context->getConstantInt32(i));
Nicolas Capens598f8d82016-09-26 15:09:10 -0400897 }
898
899 Constant *Nucleus::createConstantInt(unsigned int i)
900 {
901 assert(false && "UNIMPLEMENTED"); return nullptr;
902 }
903
904 Constant *Nucleus::createConstantBool(bool b)
905 {
906 assert(false && "UNIMPLEMENTED"); return nullptr;
907 }
908
909 Constant *Nucleus::createConstantByte(signed char i)
910 {
911 assert(false && "UNIMPLEMENTED"); return nullptr;
912 }
913
914 Constant *Nucleus::createConstantByte(unsigned char i)
915 {
916 assert(false && "UNIMPLEMENTED"); return nullptr;
917 }
918
919 Constant *Nucleus::createConstantShort(short i)
920 {
921 assert(false && "UNIMPLEMENTED"); return nullptr;
922 }
923
924 Constant *Nucleus::createConstantShort(unsigned short i)
925 {
926 assert(false && "UNIMPLEMENTED"); return nullptr;
927 }
928
929 Constant *Nucleus::createConstantFloat(float x)
930 {
931 assert(false && "UNIMPLEMENTED"); return nullptr;
932 }
933
934 Constant *Nucleus::createNullPointer(Type *Ty)
935 {
936 assert(false && "UNIMPLEMENTED"); return nullptr;
937 }
938
939 Constant *Nucleus::createConstantVector(Constant *const *Vals, unsigned NumVals)
940 {
941 assert(false && "UNIMPLEMENTED"); return nullptr;
942 }
943
944 Type *Void::getType()
945 {
946 return T(Ice::IceType_void);
947 }
948
Nicolas Capens598f8d82016-09-26 15:09:10 -0400949 Bool::Bool(Argument<Bool> argument)
950 {
951 storeValue(argument.value);
952 }
953
954 Bool::Bool()
955 {
956 }
957
958 Bool::Bool(bool x)
959 {
960 storeValue(Nucleus::createConstantBool(x));
961 }
962
963 Bool::Bool(RValue<Bool> rhs)
964 {
965 storeValue(rhs.value);
966 }
967
968 Bool::Bool(const Bool &rhs)
969 {
970 Value *value = rhs.loadValue();
971 storeValue(value);
972 }
973
974 Bool::Bool(const Reference<Bool> &rhs)
975 {
976 Value *value = rhs.loadValue();
977 storeValue(value);
978 }
979
980 RValue<Bool> Bool::operator=(RValue<Bool> rhs) const
981 {
982 storeValue(rhs.value);
983
984 return rhs;
985 }
986
987 RValue<Bool> Bool::operator=(const Bool &rhs) const
988 {
989 Value *value = rhs.loadValue();
990 storeValue(value);
991
992 return RValue<Bool>(value);
993 }
994
995 RValue<Bool> Bool::operator=(const Reference<Bool> &rhs) const
996 {
997 Value *value = rhs.loadValue();
998 storeValue(value);
999
1000 return RValue<Bool>(value);
1001 }
1002
1003 RValue<Bool> operator!(RValue<Bool> val)
1004 {
1005 return RValue<Bool>(Nucleus::createNot(val.value));
1006 }
1007
1008 RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs)
1009 {
1010 return RValue<Bool>(Nucleus::createAnd(lhs.value, rhs.value));
1011 }
1012
1013 RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs)
1014 {
1015 return RValue<Bool>(Nucleus::createOr(lhs.value, rhs.value));
1016 }
1017
1018 Type *Bool::getType()
1019 {
1020 assert(false && "UNIMPLEMENTED"); return nullptr;
1021 }
1022
1023 Byte::Byte(Argument<Byte> argument)
1024 {
1025 storeValue(argument.value);
1026 }
1027
1028 Byte::Byte(RValue<Int> cast)
1029 {
1030 Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
1031
1032 storeValue(integer);
1033 }
1034
1035 Byte::Byte(RValue<UInt> cast)
1036 {
1037 Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
1038
1039 storeValue(integer);
1040 }
1041
1042 Byte::Byte(RValue<UShort> cast)
1043 {
1044 Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
1045
1046 storeValue(integer);
1047 }
1048
1049 Byte::Byte()
1050 {
1051 }
1052
1053 Byte::Byte(int x)
1054 {
1055 storeValue(Nucleus::createConstantByte((unsigned char)x));
1056 }
1057
1058 Byte::Byte(unsigned char x)
1059 {
1060 storeValue(Nucleus::createConstantByte(x));
1061 }
1062
1063 Byte::Byte(RValue<Byte> rhs)
1064 {
1065 storeValue(rhs.value);
1066 }
1067
1068 Byte::Byte(const Byte &rhs)
1069 {
1070 Value *value = rhs.loadValue();
1071 storeValue(value);
1072 }
1073
1074 Byte::Byte(const Reference<Byte> &rhs)
1075 {
1076 Value *value = rhs.loadValue();
1077 storeValue(value);
1078 }
1079
1080 RValue<Byte> Byte::operator=(RValue<Byte> rhs) const
1081 {
1082 storeValue(rhs.value);
1083
1084 return rhs;
1085 }
1086
1087 RValue<Byte> Byte::operator=(const Byte &rhs) const
1088 {
1089 Value *value = rhs.loadValue();
1090 storeValue(value);
1091
1092 return RValue<Byte>(value);
1093 }
1094
1095 RValue<Byte> Byte::operator=(const Reference<Byte> &rhs) const
1096 {
1097 Value *value = rhs.loadValue();
1098 storeValue(value);
1099
1100 return RValue<Byte>(value);
1101 }
1102
1103 RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs)
1104 {
1105 return RValue<Byte>(Nucleus::createAdd(lhs.value, rhs.value));
1106 }
1107
1108 RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs)
1109 {
1110 return RValue<Byte>(Nucleus::createSub(lhs.value, rhs.value));
1111 }
1112
1113 RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs)
1114 {
1115 return RValue<Byte>(Nucleus::createMul(lhs.value, rhs.value));
1116 }
1117
1118 RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs)
1119 {
1120 return RValue<Byte>(Nucleus::createUDiv(lhs.value, rhs.value));
1121 }
1122
1123 RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs)
1124 {
1125 return RValue<Byte>(Nucleus::createURem(lhs.value, rhs.value));
1126 }
1127
1128 RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs)
1129 {
1130 return RValue<Byte>(Nucleus::createAnd(lhs.value, rhs.value));
1131 }
1132
1133 RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs)
1134 {
1135 return RValue<Byte>(Nucleus::createOr(lhs.value, rhs.value));
1136 }
1137
1138 RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs)
1139 {
1140 return RValue<Byte>(Nucleus::createXor(lhs.value, rhs.value));
1141 }
1142
1143 RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs)
1144 {
1145 return RValue<Byte>(Nucleus::createShl(lhs.value, rhs.value));
1146 }
1147
1148 RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs)
1149 {
1150 return RValue<Byte>(Nucleus::createLShr(lhs.value, rhs.value));
1151 }
1152
1153 RValue<Byte> operator+=(const Byte &lhs, RValue<Byte> rhs)
1154 {
1155 return lhs = lhs + rhs;
1156 }
1157
1158 RValue<Byte> operator-=(const Byte &lhs, RValue<Byte> rhs)
1159 {
1160 return lhs = lhs - rhs;
1161 }
1162
1163 RValue<Byte> operator*=(const Byte &lhs, RValue<Byte> rhs)
1164 {
1165 return lhs = lhs * rhs;
1166 }
1167
1168 RValue<Byte> operator/=(const Byte &lhs, RValue<Byte> rhs)
1169 {
1170 return lhs = lhs / rhs;
1171 }
1172
1173 RValue<Byte> operator%=(const Byte &lhs, RValue<Byte> rhs)
1174 {
1175 return lhs = lhs % rhs;
1176 }
1177
1178 RValue<Byte> operator&=(const Byte &lhs, RValue<Byte> rhs)
1179 {
1180 return lhs = lhs & rhs;
1181 }
1182
1183 RValue<Byte> operator|=(const Byte &lhs, RValue<Byte> rhs)
1184 {
1185 return lhs = lhs | rhs;
1186 }
1187
1188 RValue<Byte> operator^=(const Byte &lhs, RValue<Byte> rhs)
1189 {
1190 return lhs = lhs ^ rhs;
1191 }
1192
1193 RValue<Byte> operator<<=(const Byte &lhs, RValue<Byte> rhs)
1194 {
1195 return lhs = lhs << rhs;
1196 }
1197
1198 RValue<Byte> operator>>=(const Byte &lhs, RValue<Byte> rhs)
1199 {
1200 return lhs = lhs >> rhs;
1201 }
1202
1203 RValue<Byte> operator+(RValue<Byte> val)
1204 {
1205 return val;
1206 }
1207
1208 RValue<Byte> operator-(RValue<Byte> val)
1209 {
1210 return RValue<Byte>(Nucleus::createNeg(val.value));
1211 }
1212
1213 RValue<Byte> operator~(RValue<Byte> val)
1214 {
1215 return RValue<Byte>(Nucleus::createNot(val.value));
1216 }
1217
1218 RValue<Byte> operator++(const Byte &val, int) // Post-increment
1219 {
1220 RValue<Byte> res = val;
1221
1222 assert(false && "UNIMPLEMENTED");
1223
1224 return res;
1225 }
1226
1227 const Byte &operator++(const Byte &val) // Pre-increment
1228 {
1229 assert(false && "UNIMPLEMENTED");
1230
1231 return val;
1232 }
1233
1234 RValue<Byte> operator--(const Byte &val, int) // Post-decrement
1235 {
1236 RValue<Byte> res = val;
1237
1238 assert(false && "UNIMPLEMENTED");
1239
1240 return res;
1241 }
1242
1243 const Byte &operator--(const Byte &val) // Pre-decrement
1244 {
1245 assert(false && "UNIMPLEMENTED");
1246
1247 return val;
1248 }
1249
1250 RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs)
1251 {
1252 return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
1253 }
1254
1255 RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs)
1256 {
1257 return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
1258 }
1259
1260 RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs)
1261 {
1262 return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
1263 }
1264
1265 RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs)
1266 {
1267 return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
1268 }
1269
1270 RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs)
1271 {
1272 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
1273 }
1274
1275 RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs)
1276 {
1277 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
1278 }
1279
1280 Type *Byte::getType()
1281 {
Nicolas Capens6d738712016-09-30 04:15:22 -04001282 return T(Ice::IceType_i8);
Nicolas Capens598f8d82016-09-26 15:09:10 -04001283 }
1284
1285 SByte::SByte(Argument<SByte> argument)
1286 {
1287 storeValue(argument.value);
1288 }
1289
1290 SByte::SByte(RValue<Int> cast)
1291 {
1292 Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
1293
1294 storeValue(integer);
1295 }
1296
1297 SByte::SByte(RValue<Short> cast)
1298 {
1299 Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
1300
1301 storeValue(integer);
1302 }
1303
1304 SByte::SByte()
1305 {
1306 }
1307
1308 SByte::SByte(signed char x)
1309 {
1310 storeValue(Nucleus::createConstantByte(x));
1311 }
1312
1313 SByte::SByte(RValue<SByte> rhs)
1314 {
1315 storeValue(rhs.value);
1316 }
1317
1318 SByte::SByte(const SByte &rhs)
1319 {
1320 Value *value = rhs.loadValue();
1321 storeValue(value);
1322 }
1323
1324 SByte::SByte(const Reference<SByte> &rhs)
1325 {
1326 Value *value = rhs.loadValue();
1327 storeValue(value);
1328 }
1329
1330 RValue<SByte> SByte::operator=(RValue<SByte> rhs) const
1331 {
1332 storeValue(rhs.value);
1333
1334 return rhs;
1335 }
1336
1337 RValue<SByte> SByte::operator=(const SByte &rhs) const
1338 {
1339 Value *value = rhs.loadValue();
1340 storeValue(value);
1341
1342 return RValue<SByte>(value);
1343 }
1344
1345 RValue<SByte> SByte::operator=(const Reference<SByte> &rhs) const
1346 {
1347 Value *value = rhs.loadValue();
1348 storeValue(value);
1349
1350 return RValue<SByte>(value);
1351 }
1352
1353 RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs)
1354 {
1355 return RValue<SByte>(Nucleus::createAdd(lhs.value, rhs.value));
1356 }
1357
1358 RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs)
1359 {
1360 return RValue<SByte>(Nucleus::createSub(lhs.value, rhs.value));
1361 }
1362
1363 RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs)
1364 {
1365 return RValue<SByte>(Nucleus::createMul(lhs.value, rhs.value));
1366 }
1367
1368 RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs)
1369 {
1370 return RValue<SByte>(Nucleus::createSDiv(lhs.value, rhs.value));
1371 }
1372
1373 RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs)
1374 {
1375 return RValue<SByte>(Nucleus::createSRem(lhs.value, rhs.value));
1376 }
1377
1378 RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs)
1379 {
1380 return RValue<SByte>(Nucleus::createAnd(lhs.value, rhs.value));
1381 }
1382
1383 RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs)
1384 {
1385 return RValue<SByte>(Nucleus::createOr(lhs.value, rhs.value));
1386 }
1387
1388 RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs)
1389 {
1390 return RValue<SByte>(Nucleus::createXor(lhs.value, rhs.value));
1391 }
1392
1393 RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs)
1394 {
1395 return RValue<SByte>(Nucleus::createShl(lhs.value, rhs.value));
1396 }
1397
1398 RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs)
1399 {
1400 return RValue<SByte>(Nucleus::createAShr(lhs.value, rhs.value));
1401 }
1402
1403 RValue<SByte> operator+=(const SByte &lhs, RValue<SByte> rhs)
1404 {
1405 return lhs = lhs + rhs;
1406 }
1407
1408 RValue<SByte> operator-=(const SByte &lhs, RValue<SByte> rhs)
1409 {
1410 return lhs = lhs - rhs;
1411 }
1412
1413 RValue<SByte> operator*=(const SByte &lhs, RValue<SByte> rhs)
1414 {
1415 return lhs = lhs * rhs;
1416 }
1417
1418 RValue<SByte> operator/=(const SByte &lhs, RValue<SByte> rhs)
1419 {
1420 return lhs = lhs / rhs;
1421 }
1422
1423 RValue<SByte> operator%=(const SByte &lhs, RValue<SByte> rhs)
1424 {
1425 return lhs = lhs % rhs;
1426 }
1427
1428 RValue<SByte> operator&=(const SByte &lhs, RValue<SByte> rhs)
1429 {
1430 return lhs = lhs & rhs;
1431 }
1432
1433 RValue<SByte> operator|=(const SByte &lhs, RValue<SByte> rhs)
1434 {
1435 return lhs = lhs | rhs;
1436 }
1437
1438 RValue<SByte> operator^=(const SByte &lhs, RValue<SByte> rhs)
1439 {
1440 return lhs = lhs ^ rhs;
1441 }
1442
1443 RValue<SByte> operator<<=(const SByte &lhs, RValue<SByte> rhs)
1444 {
1445 return lhs = lhs << rhs;
1446 }
1447
1448 RValue<SByte> operator>>=(const SByte &lhs, RValue<SByte> rhs)
1449 {
1450 return lhs = lhs >> rhs;
1451 }
1452
1453 RValue<SByte> operator+(RValue<SByte> val)
1454 {
1455 return val;
1456 }
1457
1458 RValue<SByte> operator-(RValue<SByte> val)
1459 {
1460 return RValue<SByte>(Nucleus::createNeg(val.value));
1461 }
1462
1463 RValue<SByte> operator~(RValue<SByte> val)
1464 {
1465 return RValue<SByte>(Nucleus::createNot(val.value));
1466 }
1467
1468 RValue<SByte> operator++(const SByte &val, int) // Post-increment
1469 {
1470 RValue<SByte> res = val;
1471
1472 assert(false && "UNIMPLEMENTED");
1473
1474 return res;
1475 }
1476
1477 const SByte &operator++(const SByte &val) // Pre-increment
1478 {
1479 assert(false && "UNIMPLEMENTED");
1480 assert(false && "UNIMPLEMENTED");
1481
1482 return val;
1483 }
1484
1485 RValue<SByte> operator--(const SByte &val, int) // Post-decrement
1486 {
1487 RValue<SByte> res = val;
1488
1489 assert(false && "UNIMPLEMENTED");
1490 assert(false && "UNIMPLEMENTED");
1491
1492 return res;
1493 }
1494
1495 const SByte &operator--(const SByte &val) // Pre-decrement
1496 {
1497 assert(false && "UNIMPLEMENTED");
1498 assert(false && "UNIMPLEMENTED");
1499
1500 return val;
1501 }
1502
1503 RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs)
1504 {
1505 return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
1506 }
1507
1508 RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs)
1509 {
1510 return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
1511 }
1512
1513 RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs)
1514 {
1515 return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
1516 }
1517
1518 RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs)
1519 {
1520 return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
1521 }
1522
1523 RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs)
1524 {
1525 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
1526 }
1527
1528 RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs)
1529 {
1530 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
1531 }
1532
1533 Type *SByte::getType()
1534 {
1535 assert(false && "UNIMPLEMENTED"); return nullptr;
1536 }
1537
1538 Short::Short(Argument<Short> argument)
1539 {
1540 storeValue(argument.value);
1541 }
1542
1543 Short::Short(RValue<Int> cast)
1544 {
1545 Value *integer = Nucleus::createTrunc(cast.value, Short::getType());
1546
1547 storeValue(integer);
1548 }
1549
1550 Short::Short()
1551 {
1552 }
1553
1554 Short::Short(short x)
1555 {
1556 storeValue(Nucleus::createConstantShort(x));
1557 }
1558
1559 Short::Short(RValue<Short> rhs)
1560 {
1561 storeValue(rhs.value);
1562 }
1563
1564 Short::Short(const Short &rhs)
1565 {
1566 Value *value = rhs.loadValue();
1567 storeValue(value);
1568 }
1569
1570 Short::Short(const Reference<Short> &rhs)
1571 {
1572 Value *value = rhs.loadValue();
1573 storeValue(value);
1574 }
1575
1576 RValue<Short> Short::operator=(RValue<Short> rhs) const
1577 {
1578 storeValue(rhs.value);
1579
1580 return rhs;
1581 }
1582
1583 RValue<Short> Short::operator=(const Short &rhs) const
1584 {
1585 Value *value = rhs.loadValue();
1586 storeValue(value);
1587
1588 return RValue<Short>(value);
1589 }
1590
1591 RValue<Short> Short::operator=(const Reference<Short> &rhs) const
1592 {
1593 Value *value = rhs.loadValue();
1594 storeValue(value);
1595
1596 return RValue<Short>(value);
1597 }
1598
1599 RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs)
1600 {
1601 return RValue<Short>(Nucleus::createAdd(lhs.value, rhs.value));
1602 }
1603
1604 RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs)
1605 {
1606 return RValue<Short>(Nucleus::createSub(lhs.value, rhs.value));
1607 }
1608
1609 RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs)
1610 {
1611 return RValue<Short>(Nucleus::createMul(lhs.value, rhs.value));
1612 }
1613
1614 RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs)
1615 {
1616 return RValue<Short>(Nucleus::createSDiv(lhs.value, rhs.value));
1617 }
1618
1619 RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs)
1620 {
1621 return RValue<Short>(Nucleus::createSRem(lhs.value, rhs.value));
1622 }
1623
1624 RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs)
1625 {
1626 return RValue<Short>(Nucleus::createAnd(lhs.value, rhs.value));
1627 }
1628
1629 RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs)
1630 {
1631 return RValue<Short>(Nucleus::createOr(lhs.value, rhs.value));
1632 }
1633
1634 RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs)
1635 {
1636 return RValue<Short>(Nucleus::createXor(lhs.value, rhs.value));
1637 }
1638
1639 RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs)
1640 {
1641 return RValue<Short>(Nucleus::createShl(lhs.value, rhs.value));
1642 }
1643
1644 RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs)
1645 {
1646 return RValue<Short>(Nucleus::createAShr(lhs.value, rhs.value));
1647 }
1648
1649 RValue<Short> operator+=(const Short &lhs, RValue<Short> rhs)
1650 {
1651 return lhs = lhs + rhs;
1652 }
1653
1654 RValue<Short> operator-=(const Short &lhs, RValue<Short> rhs)
1655 {
1656 return lhs = lhs - rhs;
1657 }
1658
1659 RValue<Short> operator*=(const Short &lhs, RValue<Short> rhs)
1660 {
1661 return lhs = lhs * rhs;
1662 }
1663
1664 RValue<Short> operator/=(const Short &lhs, RValue<Short> rhs)
1665 {
1666 return lhs = lhs / rhs;
1667 }
1668
1669 RValue<Short> operator%=(const Short &lhs, RValue<Short> rhs)
1670 {
1671 return lhs = lhs % rhs;
1672 }
1673
1674 RValue<Short> operator&=(const Short &lhs, RValue<Short> rhs)
1675 {
1676 return lhs = lhs & rhs;
1677 }
1678
1679 RValue<Short> operator|=(const Short &lhs, RValue<Short> rhs)
1680 {
1681 return lhs = lhs | rhs;
1682 }
1683
1684 RValue<Short> operator^=(const Short &lhs, RValue<Short> rhs)
1685 {
1686 return lhs = lhs ^ rhs;
1687 }
1688
1689 RValue<Short> operator<<=(const Short &lhs, RValue<Short> rhs)
1690 {
1691 return lhs = lhs << rhs;
1692 }
1693
1694 RValue<Short> operator>>=(const Short &lhs, RValue<Short> rhs)
1695 {
1696 return lhs = lhs >> rhs;
1697 }
1698
1699 RValue<Short> operator+(RValue<Short> val)
1700 {
1701 return val;
1702 }
1703
1704 RValue<Short> operator-(RValue<Short> val)
1705 {
1706 return RValue<Short>(Nucleus::createNeg(val.value));
1707 }
1708
1709 RValue<Short> operator~(RValue<Short> val)
1710 {
1711 return RValue<Short>(Nucleus::createNot(val.value));
1712 }
1713
1714 RValue<Short> operator++(const Short &val, int) // Post-increment
1715 {
1716 RValue<Short> res = val;
1717
1718 assert(false && "UNIMPLEMENTED");
1719 assert(false && "UNIMPLEMENTED");
1720
1721 return res;
1722 }
1723
1724 const Short &operator++(const Short &val) // Pre-increment
1725 {
1726 assert(false && "UNIMPLEMENTED");
1727 assert(false && "UNIMPLEMENTED");
1728
1729 return val;
1730 }
1731
1732 RValue<Short> operator--(const Short &val, int) // Post-decrement
1733 {
1734 RValue<Short> res = val;
1735
1736 assert(false && "UNIMPLEMENTED");
1737 assert(false && "UNIMPLEMENTED");
1738
1739 return res;
1740 }
1741
1742 const Short &operator--(const Short &val) // Pre-decrement
1743 {
1744 assert(false && "UNIMPLEMENTED");
1745 assert(false && "UNIMPLEMENTED");
1746
1747 return val;
1748 }
1749
1750 RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs)
1751 {
1752 return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
1753 }
1754
1755 RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs)
1756 {
1757 return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
1758 }
1759
1760 RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs)
1761 {
1762 return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
1763 }
1764
1765 RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs)
1766 {
1767 return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
1768 }
1769
1770 RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs)
1771 {
1772 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
1773 }
1774
1775 RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs)
1776 {
1777 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
1778 }
1779
1780 Type *Short::getType()
1781 {
1782 assert(false && "UNIMPLEMENTED"); return nullptr;
1783 }
1784
1785 UShort::UShort(Argument<UShort> argument)
1786 {
1787 storeValue(argument.value);
1788 }
1789
1790 UShort::UShort(RValue<UInt> cast)
1791 {
1792 Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
1793
1794 storeValue(integer);
1795 }
1796
1797 UShort::UShort(RValue<Int> cast)
1798 {
1799 Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
1800
1801 storeValue(integer);
1802 }
1803
1804 UShort::UShort()
1805 {
1806 }
1807
1808 UShort::UShort(unsigned short x)
1809 {
1810 storeValue(Nucleus::createConstantShort(x));
1811 }
1812
1813 UShort::UShort(RValue<UShort> rhs)
1814 {
1815 storeValue(rhs.value);
1816 }
1817
1818 UShort::UShort(const UShort &rhs)
1819 {
1820 Value *value = rhs.loadValue();
1821 storeValue(value);
1822 }
1823
1824 UShort::UShort(const Reference<UShort> &rhs)
1825 {
1826 Value *value = rhs.loadValue();
1827 storeValue(value);
1828 }
1829
1830 RValue<UShort> UShort::operator=(RValue<UShort> rhs) const
1831 {
1832 storeValue(rhs.value);
1833
1834 return rhs;
1835 }
1836
1837 RValue<UShort> UShort::operator=(const UShort &rhs) const
1838 {
1839 Value *value = rhs.loadValue();
1840 storeValue(value);
1841
1842 return RValue<UShort>(value);
1843 }
1844
1845 RValue<UShort> UShort::operator=(const Reference<UShort> &rhs) const
1846 {
1847 Value *value = rhs.loadValue();
1848 storeValue(value);
1849
1850 return RValue<UShort>(value);
1851 }
1852
1853 RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs)
1854 {
1855 return RValue<UShort>(Nucleus::createAdd(lhs.value, rhs.value));
1856 }
1857
1858 RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs)
1859 {
1860 return RValue<UShort>(Nucleus::createSub(lhs.value, rhs.value));
1861 }
1862
1863 RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs)
1864 {
1865 return RValue<UShort>(Nucleus::createMul(lhs.value, rhs.value));
1866 }
1867
1868 RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs)
1869 {
1870 return RValue<UShort>(Nucleus::createUDiv(lhs.value, rhs.value));
1871 }
1872
1873 RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs)
1874 {
1875 return RValue<UShort>(Nucleus::createURem(lhs.value, rhs.value));
1876 }
1877
1878 RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs)
1879 {
1880 return RValue<UShort>(Nucleus::createAnd(lhs.value, rhs.value));
1881 }
1882
1883 RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs)
1884 {
1885 return RValue<UShort>(Nucleus::createOr(lhs.value, rhs.value));
1886 }
1887
1888 RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs)
1889 {
1890 return RValue<UShort>(Nucleus::createXor(lhs.value, rhs.value));
1891 }
1892
1893 RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs)
1894 {
1895 return RValue<UShort>(Nucleus::createShl(lhs.value, rhs.value));
1896 }
1897
1898 RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs)
1899 {
1900 return RValue<UShort>(Nucleus::createLShr(lhs.value, rhs.value));
1901 }
1902
1903 RValue<UShort> operator+=(const UShort &lhs, RValue<UShort> rhs)
1904 {
1905 return lhs = lhs + rhs;
1906 }
1907
1908 RValue<UShort> operator-=(const UShort &lhs, RValue<UShort> rhs)
1909 {
1910 return lhs = lhs - rhs;
1911 }
1912
1913 RValue<UShort> operator*=(const UShort &lhs, RValue<UShort> rhs)
1914 {
1915 return lhs = lhs * rhs;
1916 }
1917
1918 RValue<UShort> operator/=(const UShort &lhs, RValue<UShort> rhs)
1919 {
1920 return lhs = lhs / rhs;
1921 }
1922
1923 RValue<UShort> operator%=(const UShort &lhs, RValue<UShort> rhs)
1924 {
1925 return lhs = lhs % rhs;
1926 }
1927
1928 RValue<UShort> operator&=(const UShort &lhs, RValue<UShort> rhs)
1929 {
1930 return lhs = lhs & rhs;
1931 }
1932
1933 RValue<UShort> operator|=(const UShort &lhs, RValue<UShort> rhs)
1934 {
1935 return lhs = lhs | rhs;
1936 }
1937
1938 RValue<UShort> operator^=(const UShort &lhs, RValue<UShort> rhs)
1939 {
1940 return lhs = lhs ^ rhs;
1941 }
1942
1943 RValue<UShort> operator<<=(const UShort &lhs, RValue<UShort> rhs)
1944 {
1945 return lhs = lhs << rhs;
1946 }
1947
1948 RValue<UShort> operator>>=(const UShort &lhs, RValue<UShort> rhs)
1949 {
1950 return lhs = lhs >> rhs;
1951 }
1952
1953 RValue<UShort> operator+(RValue<UShort> val)
1954 {
1955 return val;
1956 }
1957
1958 RValue<UShort> operator-(RValue<UShort> val)
1959 {
1960 return RValue<UShort>(Nucleus::createNeg(val.value));
1961 }
1962
1963 RValue<UShort> operator~(RValue<UShort> val)
1964 {
1965 return RValue<UShort>(Nucleus::createNot(val.value));
1966 }
1967
1968 RValue<UShort> operator++(const UShort &val, int) // Post-increment
1969 {
1970 RValue<UShort> res = val;
1971
1972 assert(false && "UNIMPLEMENTED");
1973 assert(false && "UNIMPLEMENTED");
1974
1975 return res;
1976 }
1977
1978 const UShort &operator++(const UShort &val) // Pre-increment
1979 {
1980 assert(false && "UNIMPLEMENTED");
1981 assert(false && "UNIMPLEMENTED");
1982
1983 return val;
1984 }
1985
1986 RValue<UShort> operator--(const UShort &val, int) // Post-decrement
1987 {
1988 RValue<UShort> res = val;
1989
1990 assert(false && "UNIMPLEMENTED");
1991 assert(false && "UNIMPLEMENTED");
1992
1993 return res;
1994 }
1995
1996 const UShort &operator--(const UShort &val) // Pre-decrement
1997 {
1998 assert(false && "UNIMPLEMENTED");
1999 assert(false && "UNIMPLEMENTED");
2000
2001 return val;
2002 }
2003
2004 RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs)
2005 {
2006 return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
2007 }
2008
2009 RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs)
2010 {
2011 return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
2012 }
2013
2014 RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs)
2015 {
2016 return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
2017 }
2018
2019 RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs)
2020 {
2021 return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
2022 }
2023
2024 RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs)
2025 {
2026 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
2027 }
2028
2029 RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs)
2030 {
2031 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
2032 }
2033
2034 Type *UShort::getType()
2035 {
2036 assert(false && "UNIMPLEMENTED"); return nullptr;
2037 }
2038
Nicolas Capens16b5f152016-10-13 13:39:01 -04002039 Byte4::Byte4(RValue<Byte8> cast)
2040 {
2041 // xyzw.parent = this;
2042
2043 storeValue(Nucleus::createBitCast(cast.value, getType()));
2044 }
2045
2046 Byte4::Byte4(const Reference<Byte4> &rhs)
2047 {
2048 // xyzw.parent = this;
2049
2050 assert(false && "UNIMPLEMENTED");
2051 }
2052
Nicolas Capens598f8d82016-09-26 15:09:10 -04002053 Type *Byte4::getType()
2054 {
Nicolas Capens23d99a42016-09-30 14:57:16 -04002055 return T(Type_v4i8);
Nicolas Capens598f8d82016-09-26 15:09:10 -04002056 }
2057
2058 Type *SByte4::getType()
2059 {
Nicolas Capens16b5f152016-10-13 13:39:01 -04002060 assert(false && "UNIMPLEMENTED"); return nullptr;
Nicolas Capens598f8d82016-09-26 15:09:10 -04002061 }
2062
2063 Byte8::Byte8()
2064 {
2065 // xyzw.parent = this;
2066 }
2067
2068 Byte8::Byte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
2069 {
2070 // xyzw.parent = this;
Nicolas Capens598f8d82016-09-26 15:09:10 -04002071
Nicolas Capens16b5f152016-10-13 13:39:01 -04002072 assert(false && "UNIMPLEMENTED");
Nicolas Capens598f8d82016-09-26 15:09:10 -04002073 }
2074
2075 Byte8::Byte8(RValue<Byte8> rhs)
2076 {
2077 // xyzw.parent = this;
2078
2079 storeValue(rhs.value);
2080 }
2081
2082 Byte8::Byte8(const Byte8 &rhs)
2083 {
2084 // xyzw.parent = this;
2085
2086 Value *value = rhs.loadValue();
2087 storeValue(value);
2088 }
2089
2090 Byte8::Byte8(const Reference<Byte8> &rhs)
2091 {
2092 // xyzw.parent = this;
2093
2094 Value *value = rhs.loadValue();
2095 storeValue(value);
2096 }
2097
2098 RValue<Byte8> Byte8::operator=(RValue<Byte8> rhs) const
2099 {
2100 storeValue(rhs.value);
2101
2102 return rhs;
2103 }
2104
2105 RValue<Byte8> Byte8::operator=(const Byte8 &rhs) const
2106 {
2107 Value *value = rhs.loadValue();
2108 storeValue(value);
2109
2110 return RValue<Byte8>(value);
2111 }
2112
2113 RValue<Byte8> Byte8::operator=(const Reference<Byte8> &rhs) const
2114 {
2115 Value *value = rhs.loadValue();
2116 storeValue(value);
2117
2118 return RValue<Byte8>(value);
2119 }
2120
2121 RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs)
2122 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002123 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002124 }
2125
2126 RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs)
2127 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002128 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002129 }
2130
2131// RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs)
2132// {
2133// return RValue<Byte8>(Nucleus::createMul(lhs.value, rhs.value));
2134// }
2135
2136// RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs)
2137// {
2138// return RValue<Byte8>(Nucleus::createUDiv(lhs.value, rhs.value));
2139// }
2140
2141// RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs)
2142// {
2143// return RValue<Byte8>(Nucleus::createURem(lhs.value, rhs.value));
2144// }
2145
2146 RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs)
2147 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002148 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002149 }
2150
2151 RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs)
2152 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002153 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002154 }
2155
2156 RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs)
2157 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002158 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002159 }
2160
2161// RValue<Byte8> operator<<(RValue<Byte8> lhs, unsigned char rhs)
2162// {
2163// return RValue<Byte8>(Nucleus::createShl(lhs.value, rhs.value));
2164// }
2165
2166// RValue<Byte8> operator>>(RValue<Byte8> lhs, unsigned char rhs)
2167// {
2168// return RValue<Byte8>(Nucleus::createLShr(lhs.value, rhs.value));
2169// }
2170
2171 RValue<Byte8> operator+=(const Byte8 &lhs, RValue<Byte8> rhs)
2172 {
2173 return lhs = lhs + rhs;
2174 }
2175
2176 RValue<Byte8> operator-=(const Byte8 &lhs, RValue<Byte8> rhs)
2177 {
2178 return lhs = lhs - rhs;
2179 }
2180
2181// RValue<Byte8> operator*=(const Byte8 &lhs, RValue<Byte8> rhs)
2182// {
2183// return lhs = lhs * rhs;
2184// }
2185
2186// RValue<Byte8> operator/=(const Byte8 &lhs, RValue<Byte8> rhs)
2187// {
2188// return lhs = lhs / rhs;
2189// }
2190
2191// RValue<Byte8> operator%=(const Byte8 &lhs, RValue<Byte8> rhs)
2192// {
2193// return lhs = lhs % rhs;
2194// }
2195
2196 RValue<Byte8> operator&=(const Byte8 &lhs, RValue<Byte8> rhs)
2197 {
2198 return lhs = lhs & rhs;
2199 }
2200
2201 RValue<Byte8> operator|=(const Byte8 &lhs, RValue<Byte8> rhs)
2202 {
2203 return lhs = lhs | rhs;
2204 }
2205
2206 RValue<Byte8> operator^=(const Byte8 &lhs, RValue<Byte8> rhs)
2207 {
2208 return lhs = lhs ^ rhs;
2209 }
2210
2211// RValue<Byte8> operator<<=(const Byte8 &lhs, RValue<Byte8> rhs)
2212// {
2213// return lhs = lhs << rhs;
2214// }
2215
2216// RValue<Byte8> operator>>=(const Byte8 &lhs, RValue<Byte8> rhs)
2217// {
2218// return lhs = lhs >> rhs;
2219// }
2220
2221// RValue<Byte8> operator+(RValue<Byte8> val)
2222// {
2223// return val;
2224// }
2225
2226// RValue<Byte8> operator-(RValue<Byte8> val)
2227// {
2228// return RValue<Byte8>(Nucleus::createNeg(val.value));
2229// }
2230
2231 RValue<Byte8> operator~(RValue<Byte8> val)
2232 {
2233 return RValue<Byte8>(Nucleus::createNot(val.value));
2234 }
2235
2236 RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y)
2237 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002238 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002239 }
2240
2241 RValue<Byte8> SubSat(RValue<Byte8> x, RValue<Byte8> y)
2242 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002243 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002244 }
2245
2246 RValue<Short4> Unpack(RValue<Byte4> x)
2247 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002248 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002249 }
2250
2251 RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y)
2252 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002253 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002254 }
2255
2256 RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y)
2257 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002258 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002259 }
2260
2261 RValue<Int> SignMask(RValue<Byte8> x)
2262 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002263 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002264 }
2265
2266// RValue<Byte8> CmpGT(RValue<Byte8> x, RValue<Byte8> y)
2267// {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002268// assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002269// }
2270
2271 RValue<Byte8> CmpEQ(RValue<Byte8> x, RValue<Byte8> y)
2272 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002273 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002274 }
2275
2276 Type *Byte8::getType()
2277 {
Nicolas Capens23d99a42016-09-30 14:57:16 -04002278 return T(Type_v8i8);
Nicolas Capens598f8d82016-09-26 15:09:10 -04002279 }
2280
2281 SByte8::SByte8()
2282 {
2283 // xyzw.parent = this;
2284 }
2285
2286 SByte8::SByte8(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t x4, uint8_t x5, uint8_t x6, uint8_t x7)
2287 {
2288 // xyzw.parent = this;
2289
2290 assert(false && "UNIMPLEMENTED");
2291 }
2292
Nicolas Capens598f8d82016-09-26 15:09:10 -04002293 SByte8::SByte8(RValue<SByte8> rhs)
2294 {
2295 // xyzw.parent = this;
2296
2297 storeValue(rhs.value);
2298 }
2299
2300 SByte8::SByte8(const SByte8 &rhs)
2301 {
2302 // xyzw.parent = this;
2303
2304 Value *value = rhs.loadValue();
2305 storeValue(value);
2306 }
2307
2308 SByte8::SByte8(const Reference<SByte8> &rhs)
2309 {
2310 // xyzw.parent = this;
2311
2312 Value *value = rhs.loadValue();
2313 storeValue(value);
2314 }
2315
2316 RValue<SByte8> SByte8::operator=(RValue<SByte8> rhs) const
2317 {
2318 storeValue(rhs.value);
2319
2320 return rhs;
2321 }
2322
2323 RValue<SByte8> SByte8::operator=(const SByte8 &rhs) const
2324 {
2325 Value *value = rhs.loadValue();
2326 storeValue(value);
2327
2328 return RValue<SByte8>(value);
2329 }
2330
2331 RValue<SByte8> SByte8::operator=(const Reference<SByte8> &rhs) const
2332 {
2333 Value *value = rhs.loadValue();
2334 storeValue(value);
2335
2336 return RValue<SByte8>(value);
2337 }
2338
2339 RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs)
2340 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002341 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002342 }
2343
2344 RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs)
2345 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002346 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002347 }
2348
2349// RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs)
2350// {
2351// return RValue<SByte8>(Nucleus::createMul(lhs.value, rhs.value));
2352// }
2353
2354// RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs)
2355// {
2356// return RValue<SByte8>(Nucleus::createSDiv(lhs.value, rhs.value));
2357// }
2358
2359// RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs)
2360// {
2361// return RValue<SByte8>(Nucleus::createSRem(lhs.value, rhs.value));
2362// }
2363
2364 RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs)
2365 {
2366 return RValue<SByte8>(Nucleus::createAnd(lhs.value, rhs.value));
2367 }
2368
2369 RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs)
2370 {
2371 return RValue<SByte8>(Nucleus::createOr(lhs.value, rhs.value));
2372 }
2373
2374 RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs)
2375 {
2376 return RValue<SByte8>(Nucleus::createXor(lhs.value, rhs.value));
2377 }
2378
2379// RValue<SByte8> operator<<(RValue<SByte8> lhs, unsigned char rhs)
2380// {
2381// return RValue<SByte8>(Nucleus::createShl(lhs.value, rhs.value));
2382// }
2383
2384// RValue<SByte8> operator>>(RValue<SByte8> lhs, unsigned char rhs)
2385// {
2386// return RValue<SByte8>(Nucleus::createAShr(lhs.value, rhs.value));
2387// }
2388
2389 RValue<SByte8> operator+=(const SByte8 &lhs, RValue<SByte8> rhs)
2390 {
2391 return lhs = lhs + rhs;
2392 }
2393
2394 RValue<SByte8> operator-=(const SByte8 &lhs, RValue<SByte8> rhs)
2395 {
2396 return lhs = lhs - rhs;
2397 }
2398
2399// RValue<SByte8> operator*=(const SByte8 &lhs, RValue<SByte8> rhs)
2400// {
2401// return lhs = lhs * rhs;
2402// }
2403
2404// RValue<SByte8> operator/=(const SByte8 &lhs, RValue<SByte8> rhs)
2405// {
2406// return lhs = lhs / rhs;
2407// }
2408
2409// RValue<SByte8> operator%=(const SByte8 &lhs, RValue<SByte8> rhs)
2410// {
2411// return lhs = lhs % rhs;
2412// }
2413
2414 RValue<SByte8> operator&=(const SByte8 &lhs, RValue<SByte8> rhs)
2415 {
2416 return lhs = lhs & rhs;
2417 }
2418
2419 RValue<SByte8> operator|=(const SByte8 &lhs, RValue<SByte8> rhs)
2420 {
2421 return lhs = lhs | rhs;
2422 }
2423
2424 RValue<SByte8> operator^=(const SByte8 &lhs, RValue<SByte8> rhs)
2425 {
2426 return lhs = lhs ^ rhs;
2427 }
2428
2429// RValue<SByte8> operator<<=(const SByte8 &lhs, RValue<SByte8> rhs)
2430// {
2431// return lhs = lhs << rhs;
2432// }
2433
2434// RValue<SByte8> operator>>=(const SByte8 &lhs, RValue<SByte8> rhs)
2435// {
2436// return lhs = lhs >> rhs;
2437// }
2438
2439// RValue<SByte8> operator+(RValue<SByte8> val)
2440// {
2441// return val;
2442// }
2443
2444// RValue<SByte8> operator-(RValue<SByte8> val)
2445// {
2446// return RValue<SByte8>(Nucleus::createNeg(val.value));
2447// }
2448
2449 RValue<SByte8> operator~(RValue<SByte8> val)
2450 {
2451 return RValue<SByte8>(Nucleus::createNot(val.value));
2452 }
2453
2454 RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y)
2455 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002456 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002457 }
2458
2459 RValue<SByte8> SubSat(RValue<SByte8> x, RValue<SByte8> y)
2460 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002461 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002462 }
2463
2464 RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y)
2465 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002466 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002467 }
2468
2469 RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y)
2470 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002471 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002472 }
2473
2474 RValue<Int> SignMask(RValue<SByte8> x)
2475 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002476 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002477 }
2478
2479 RValue<Byte8> CmpGT(RValue<SByte8> x, RValue<SByte8> y)
2480 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002481 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002482 }
2483
2484 RValue<Byte8> CmpEQ(RValue<SByte8> x, RValue<SByte8> y)
2485 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002486 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002487 }
2488
2489 Type *SByte8::getType()
2490 {
2491 assert(false && "UNIMPLEMENTED"); return nullptr;
2492 }
2493
2494 Byte16::Byte16(RValue<Byte16> rhs)
2495 {
2496 // xyzw.parent = this;
2497
2498 storeValue(rhs.value);
2499 }
2500
2501 Byte16::Byte16(const Byte16 &rhs)
2502 {
2503 // xyzw.parent = this;
2504
2505 Value *value = rhs.loadValue();
2506 storeValue(value);
2507 }
2508
2509 Byte16::Byte16(const Reference<Byte16> &rhs)
2510 {
2511 // xyzw.parent = this;
2512
2513 Value *value = rhs.loadValue();
2514 storeValue(value);
2515 }
2516
2517 RValue<Byte16> Byte16::operator=(RValue<Byte16> rhs) const
2518 {
2519 storeValue(rhs.value);
2520
2521 return rhs;
2522 }
2523
2524 RValue<Byte16> Byte16::operator=(const Byte16 &rhs) const
2525 {
2526 Value *value = rhs.loadValue();
2527 storeValue(value);
2528
2529 return RValue<Byte16>(value);
2530 }
2531
2532 RValue<Byte16> Byte16::operator=(const Reference<Byte16> &rhs) const
2533 {
2534 Value *value = rhs.loadValue();
2535 storeValue(value);
2536
2537 return RValue<Byte16>(value);
2538 }
2539
2540 Type *Byte16::getType()
2541 {
Nicolas Capens23d99a42016-09-30 14:57:16 -04002542 return T(Ice::IceType_v16i8);
Nicolas Capens598f8d82016-09-26 15:09:10 -04002543 }
2544
2545 Type *SByte16::getType()
2546 {
Nicolas Capens23d99a42016-09-30 14:57:16 -04002547 return T(Ice::IceType_v16i8);
Nicolas Capens598f8d82016-09-26 15:09:10 -04002548 }
2549
Nicolas Capens16b5f152016-10-13 13:39:01 -04002550 Short2::Short2(RValue<Short4> cast)
2551 {
2552 assert(false && "UNIMPLEMENTED");
2553 }
2554
2555 Type *Short2::getType()
2556 {
Nicolas Capens23d99a42016-09-30 14:57:16 -04002557 return T(Type_v2i16);
Nicolas Capens16b5f152016-10-13 13:39:01 -04002558 }
2559
2560 UShort2::UShort2(RValue<UShort4> cast)
2561 {
2562 assert(false && "UNIMPLEMENTED");
2563 }
2564
2565 Type *UShort2::getType()
2566 {
Nicolas Capens23d99a42016-09-30 14:57:16 -04002567 return T(Type_v2i16);
Nicolas Capens16b5f152016-10-13 13:39:01 -04002568 }
2569
Nicolas Capens598f8d82016-09-26 15:09:10 -04002570 Short4::Short4(RValue<Int> cast)
2571 {
2572 Value *extend = Nucleus::createZExt(cast.value, Long::getType());
2573 Value *swizzle = Swizzle(RValue<Short4>(extend), 0x00).value;
2574
2575 storeValue(swizzle);
2576 }
2577
2578 Short4::Short4(RValue<Int4> cast)
2579 {
2580 assert(false && "UNIMPLEMENTED");
2581 }
2582
2583// Short4::Short4(RValue<Float> cast)
2584// {
2585// }
2586
2587 Short4::Short4(RValue<Float4> cast)
2588 {
2589 assert(false && "UNIMPLEMENTED");
2590 }
2591
2592 Short4::Short4()
2593 {
2594 // xyzw.parent = this;
2595 }
2596
2597 Short4::Short4(short xyzw)
2598 {
2599 // xyzw.parent = this;
2600
2601 assert(false && "UNIMPLEMENTED");
2602 }
2603
2604 Short4::Short4(short x, short y, short z, short w)
2605 {
2606 // xyzw.parent = this;
2607
2608 assert(false && "UNIMPLEMENTED");
2609 }
2610
2611 Short4::Short4(RValue<Short4> rhs)
2612 {
2613 // xyzw.parent = this;
2614
2615 storeValue(rhs.value);
2616 }
2617
2618 Short4::Short4(const Short4 &rhs)
2619 {
2620 // xyzw.parent = this;
2621
2622 Value *value = rhs.loadValue();
2623 storeValue(value);
2624 }
2625
2626 Short4::Short4(const Reference<Short4> &rhs)
2627 {
2628 // xyzw.parent = this;
2629
2630 Value *value = rhs.loadValue();
2631 storeValue(value);
2632 }
2633
2634 Short4::Short4(RValue<UShort4> rhs)
2635 {
2636 // xyzw.parent = this;
2637
2638 storeValue(rhs.value);
2639 }
2640
2641 Short4::Short4(const UShort4 &rhs)
2642 {
2643 // xyzw.parent = this;
2644
2645 storeValue(rhs.loadValue());
2646 }
2647
2648 Short4::Short4(const Reference<UShort4> &rhs)
2649 {
2650 // xyzw.parent = this;
2651
2652 storeValue(rhs.loadValue());
2653 }
2654
2655 RValue<Short4> Short4::operator=(RValue<Short4> rhs) const
2656 {
2657 storeValue(rhs.value);
2658
2659 return rhs;
2660 }
2661
2662 RValue<Short4> Short4::operator=(const Short4 &rhs) const
2663 {
2664 Value *value = rhs.loadValue();
2665 storeValue(value);
2666
2667 return RValue<Short4>(value);
2668 }
2669
2670 RValue<Short4> Short4::operator=(const Reference<Short4> &rhs) const
2671 {
2672 Value *value = rhs.loadValue();
2673 storeValue(value);
2674
2675 return RValue<Short4>(value);
2676 }
2677
2678 RValue<Short4> Short4::operator=(RValue<UShort4> rhs) const
2679 {
2680 storeValue(rhs.value);
2681
2682 return RValue<Short4>(rhs);
2683 }
2684
2685 RValue<Short4> Short4::operator=(const UShort4 &rhs) const
2686 {
2687 Value *value = rhs.loadValue();
2688 storeValue(value);
2689
2690 return RValue<Short4>(value);
2691 }
2692
2693 RValue<Short4> Short4::operator=(const Reference<UShort4> &rhs) const
2694 {
2695 Value *value = rhs.loadValue();
2696 storeValue(value);
2697
2698 return RValue<Short4>(value);
2699 }
2700
2701 RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs)
2702 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002703 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002704 }
2705
2706 RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs)
2707 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002708 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002709 }
2710
2711 RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs)
2712 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002713 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002714 }
2715
2716// RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs)
2717// {
2718// return RValue<Short4>(Nucleus::createSDiv(lhs.value, rhs.value));
2719// }
2720
2721// RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs)
2722// {
2723// return RValue<Short4>(Nucleus::createSRem(lhs.value, rhs.value));
2724// }
2725
2726 RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs)
2727 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002728 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002729 }
2730
2731 RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs)
2732 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002733 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002734 }
2735
2736 RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs)
2737 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002738 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002739 }
2740
2741 RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs)
2742 {
2743 // return RValue<Short4>(Nucleus::createShl(lhs.value, rhs.value));
2744
Nicolas Capensc37252c2016-09-28 16:11:54 -04002745 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002746 }
2747
2748 RValue<Short4> operator>>(RValue<Short4> lhs, unsigned char rhs)
2749 {
2750 // return RValue<Short4>(Nucleus::createAShr(lhs.value, rhs.value));
2751
Nicolas Capensc37252c2016-09-28 16:11:54 -04002752 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002753 }
2754
2755 RValue<Short4> operator<<(RValue<Short4> lhs, RValue<Long1> rhs)
2756 {
2757 // return RValue<Short4>(Nucleus::createShl(lhs.value, rhs.value));
2758
Nicolas Capensc37252c2016-09-28 16:11:54 -04002759 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002760 }
2761
2762 RValue<Short4> operator>>(RValue<Short4> lhs, RValue<Long1> rhs)
2763 {
2764 // return RValue<Short4>(Nucleus::createAShr(lhs.value, rhs.value));
2765
Nicolas Capensc37252c2016-09-28 16:11:54 -04002766 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002767 }
2768
2769 RValue<Short4> operator+=(const Short4 &lhs, RValue<Short4> rhs)
2770 {
2771 return lhs = lhs + rhs;
2772 }
2773
2774 RValue<Short4> operator-=(const Short4 &lhs, RValue<Short4> rhs)
2775 {
2776 return lhs = lhs - rhs;
2777 }
2778
2779 RValue<Short4> operator*=(const Short4 &lhs, RValue<Short4> rhs)
2780 {
2781 return lhs = lhs * rhs;
2782 }
2783
2784// RValue<Short4> operator/=(const Short4 &lhs, RValue<Short4> rhs)
2785// {
2786// return lhs = lhs / rhs;
2787// }
2788
2789// RValue<Short4> operator%=(const Short4 &lhs, RValue<Short4> rhs)
2790// {
2791// return lhs = lhs % rhs;
2792// }
2793
2794 RValue<Short4> operator&=(const Short4 &lhs, RValue<Short4> rhs)
2795 {
2796 return lhs = lhs & rhs;
2797 }
2798
2799 RValue<Short4> operator|=(const Short4 &lhs, RValue<Short4> rhs)
2800 {
2801 return lhs = lhs | rhs;
2802 }
2803
2804 RValue<Short4> operator^=(const Short4 &lhs, RValue<Short4> rhs)
2805 {
2806 return lhs = lhs ^ rhs;
2807 }
2808
2809 RValue<Short4> operator<<=(const Short4 &lhs, unsigned char rhs)
2810 {
2811 return lhs = lhs << rhs;
2812 }
2813
2814 RValue<Short4> operator>>=(const Short4 &lhs, unsigned char rhs)
2815 {
2816 return lhs = lhs >> rhs;
2817 }
2818
2819 RValue<Short4> operator<<=(const Short4 &lhs, RValue<Long1> rhs)
2820 {
2821 return lhs = lhs << rhs;
2822 }
2823
2824 RValue<Short4> operator>>=(const Short4 &lhs, RValue<Long1> rhs)
2825 {
2826 return lhs = lhs >> rhs;
2827 }
2828
2829// RValue<Short4> operator+(RValue<Short4> val)
2830// {
2831// return val;
2832// }
2833
2834 RValue<Short4> operator-(RValue<Short4> val)
2835 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002836 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002837 }
2838
2839 RValue<Short4> operator~(RValue<Short4> val)
2840 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002841 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002842 }
2843
2844 RValue<Short4> RoundShort4(RValue<Float4> cast)
2845 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002846 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002847 }
2848
2849 RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y)
2850 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002851 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002852 }
2853
2854 RValue<Short4> Min(RValue<Short4> x, RValue<Short4> y)
2855 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002856 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002857 }
2858
2859 RValue<Short4> AddSat(RValue<Short4> x, RValue<Short4> y)
2860 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002861 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002862 }
2863
2864 RValue<Short4> SubSat(RValue<Short4> x, RValue<Short4> y)
2865 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002866 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002867 }
2868
2869 RValue<Short4> MulHigh(RValue<Short4> x, RValue<Short4> y)
2870 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002871 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002872 }
2873
2874 RValue<Int2> MulAdd(RValue<Short4> x, RValue<Short4> y)
2875 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002876 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002877 }
2878
2879 RValue<SByte8> Pack(RValue<Short4> x, RValue<Short4> y)
2880 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002881 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002882 }
2883
2884 RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y)
2885 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002886 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002887 }
2888
2889 RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y)
2890 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002891 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002892 }
2893
2894 RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select)
2895 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002896 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002897 }
2898
2899 RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i)
2900 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002901 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002902 }
2903
2904 RValue<Short> Extract(RValue<Short4> val, int i)
2905 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002906 assert(false && "UNIMPLEMENTED"); return RValue<Short>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002907 }
2908
2909 RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y)
2910 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002911 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002912 }
2913
2914 RValue<Short4> CmpEQ(RValue<Short4> x, RValue<Short4> y)
2915 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002916 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002917 }
2918
2919 Type *Short4::getType()
2920 {
Nicolas Capens23d99a42016-09-30 14:57:16 -04002921 return T(Type_v4i16);
Nicolas Capens598f8d82016-09-26 15:09:10 -04002922 }
2923
2924 UShort4::UShort4(RValue<Int4> cast)
2925 {
2926 *this = Short4(cast);
2927 }
2928
2929 UShort4::UShort4(RValue<Float4> cast, bool saturate)
2930 {
2931 assert(false && "UNIMPLEMENTED");
2932 }
2933
2934 UShort4::UShort4()
2935 {
2936 // xyzw.parent = this;
2937 }
2938
2939 UShort4::UShort4(unsigned short xyzw)
2940 {
2941 // xyzw.parent = this;
2942
2943 assert(false && "UNIMPLEMENTED");
2944 }
2945
2946 UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
2947 {
2948 // xyzw.parent = this;
2949
2950 assert(false && "UNIMPLEMENTED");
2951 }
2952
2953 UShort4::UShort4(RValue<UShort4> rhs)
2954 {
2955 // xyzw.parent = this;
2956
2957 storeValue(rhs.value);
2958 }
2959
2960 UShort4::UShort4(const UShort4 &rhs)
2961 {
2962 // xyzw.parent = this;
2963
2964 Value *value = rhs.loadValue();
2965 storeValue(value);
2966 }
2967
2968 UShort4::UShort4(const Reference<UShort4> &rhs)
2969 {
2970 // xyzw.parent = this;
2971
2972 Value *value = rhs.loadValue();
2973 storeValue(value);
2974 }
2975
2976 UShort4::UShort4(RValue<Short4> rhs)
2977 {
2978 // xyzw.parent = this;
2979
2980 storeValue(rhs.value);
2981 }
2982
2983 UShort4::UShort4(const Short4 &rhs)
2984 {
2985 // xyzw.parent = this;
2986
2987 Value *value = rhs.loadValue();
2988 storeValue(value);
2989 }
2990
2991 UShort4::UShort4(const Reference<Short4> &rhs)
2992 {
2993 // xyzw.parent = this;
2994
2995 Value *value = rhs.loadValue();
2996 storeValue(value);
2997 }
2998
2999 RValue<UShort4> UShort4::operator=(RValue<UShort4> rhs) const
3000 {
3001 storeValue(rhs.value);
3002
3003 return rhs;
3004 }
3005
3006 RValue<UShort4> UShort4::operator=(const UShort4 &rhs) const
3007 {
3008 Value *value = rhs.loadValue();
3009 storeValue(value);
3010
3011 return RValue<UShort4>(value);
3012 }
3013
3014 RValue<UShort4> UShort4::operator=(const Reference<UShort4> &rhs) const
3015 {
3016 Value *value = rhs.loadValue();
3017 storeValue(value);
3018
3019 return RValue<UShort4>(value);
3020 }
3021
3022 RValue<UShort4> UShort4::operator=(RValue<Short4> rhs) const
3023 {
3024 storeValue(rhs.value);
3025
3026 return RValue<UShort4>(rhs);
3027 }
3028
3029 RValue<UShort4> UShort4::operator=(const Short4 &rhs) const
3030 {
3031 Value *value = rhs.loadValue();
3032 storeValue(value);
3033
3034 return RValue<UShort4>(value);
3035 }
3036
3037 RValue<UShort4> UShort4::operator=(const Reference<Short4> &rhs) const
3038 {
3039 Value *value = rhs.loadValue();
3040 storeValue(value);
3041
3042 return RValue<UShort4>(value);
3043 }
3044
3045 RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs)
3046 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003047 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003048 }
3049
3050 RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs)
3051 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003052 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003053 }
3054
3055 RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs)
3056 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003057 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003058 }
3059
Nicolas Capens16b5f152016-10-13 13:39:01 -04003060 RValue<UShort4> operator&(RValue<UShort4> lhs, RValue<UShort4> rhs)
3061 {
3062 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
3063 }
3064
3065 RValue<UShort4> operator|(RValue<UShort4> lhs, RValue<UShort4> rhs)
3066 {
3067 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
3068 }
3069
3070 RValue<UShort4> operator^(RValue<UShort4> lhs, RValue<UShort4> rhs)
3071 {
3072 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
3073 }
3074
Nicolas Capens598f8d82016-09-26 15:09:10 -04003075 RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs)
3076 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003077 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003078 }
3079
3080 RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs)
3081 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003082 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003083 }
3084
3085 RValue<UShort4> operator<<(RValue<UShort4> lhs, RValue<Long1> rhs)
3086 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003087 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003088 }
3089
3090 RValue<UShort4> operator>>(RValue<UShort4> lhs, RValue<Long1> rhs)
3091 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003092 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003093 }
3094
3095 RValue<UShort4> operator<<=(const UShort4 &lhs, unsigned char rhs)
3096 {
3097 return lhs = lhs << rhs;
3098 }
3099
3100 RValue<UShort4> operator>>=(const UShort4 &lhs, unsigned char rhs)
3101 {
3102 return lhs = lhs >> rhs;
3103 }
3104
3105 RValue<UShort4> operator<<=(const UShort4 &lhs, RValue<Long1> rhs)
3106 {
3107 return lhs = lhs << rhs;
3108 }
3109
3110 RValue<UShort4> operator>>=(const UShort4 &lhs, RValue<Long1> rhs)
3111 {
3112 return lhs = lhs >> rhs;
3113 }
3114
3115 RValue<UShort4> operator~(RValue<UShort4> val)
3116 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003117 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003118 }
3119
3120 RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y)
3121 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003122 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003123 }
3124
3125 RValue<UShort4> Min(RValue<UShort4> x, RValue<UShort4> y)
3126 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003127 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003128 }
3129
3130 RValue<UShort4> AddSat(RValue<UShort4> x, RValue<UShort4> y)
3131 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003132 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003133 }
3134
3135 RValue<UShort4> SubSat(RValue<UShort4> x, RValue<UShort4> y)
3136 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003137 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003138 }
3139
3140 RValue<UShort4> MulHigh(RValue<UShort4> x, RValue<UShort4> y)
3141 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003142 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003143 }
3144
3145 RValue<UShort4> Average(RValue<UShort4> x, RValue<UShort4> y)
3146 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003147 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003148 }
3149
3150 RValue<Byte8> Pack(RValue<UShort4> x, RValue<UShort4> y)
3151 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003152 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003153 }
3154
3155 Type *UShort4::getType()
3156 {
Nicolas Capens23d99a42016-09-30 14:57:16 -04003157 return T(Type_v4i16);
Nicolas Capens598f8d82016-09-26 15:09:10 -04003158 }
3159
3160 Short8::Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7)
3161 {
3162 // xyzw.parent = this;
3163
3164 assert(false && "UNIMPLEMENTED");
3165 }
3166
3167 Short8::Short8(RValue<Short8> rhs)
3168 {
3169 // xyzw.parent = this;
3170
3171 storeValue(rhs.value);
3172 }
3173
3174 Short8::Short8(const Reference<Short8> &rhs)
3175 {
3176 // xyzw.parent = this;
3177
3178 Value *value = rhs.loadValue();
3179 storeValue(value);
3180 }
3181
3182 Short8::Short8(RValue<Short4> lo, RValue<Short4> hi)
3183 {
3184 assert(false && "UNIMPLEMENTED");
3185 }
3186
3187 RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs)
3188 {
3189 return RValue<Short8>(Nucleus::createAdd(lhs.value, rhs.value));
3190 }
3191
3192 RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs)
3193 {
3194 return RValue<Short8>(Nucleus::createAnd(lhs.value, rhs.value));
3195 }
3196
3197 RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs)
3198 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003199 assert(false && "UNIMPLEMENTED"); return RValue<Short8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003200 }
3201
3202 RValue<Short8> operator>>(RValue<Short8> lhs, unsigned char rhs)
3203 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003204 assert(false && "UNIMPLEMENTED"); return RValue<Short8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003205 }
3206
3207 RValue<Int4> MulAdd(RValue<Short8> x, RValue<Short8> y)
3208 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003209 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003210 }
3211
3212 RValue<Int4> Abs(RValue<Int4> x)
3213 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003214 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003215 }
3216
3217 RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y)
3218 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003219 assert(false && "UNIMPLEMENTED"); return RValue<Short8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003220 }
3221
3222 Type *Short8::getType()
3223 {
3224 assert(false && "UNIMPLEMENTED"); return nullptr;
3225 }
3226
3227 UShort8::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)
3228 {
3229 // xyzw.parent = this;
3230
3231 assert(false && "UNIMPLEMENTED");
3232 }
3233
3234 UShort8::UShort8(RValue<UShort8> rhs)
3235 {
3236 // xyzw.parent = this;
3237
3238 storeValue(rhs.value);
3239 }
3240
3241 UShort8::UShort8(const Reference<UShort8> &rhs)
3242 {
3243 // xyzw.parent = this;
3244
3245 Value *value = rhs.loadValue();
3246 storeValue(value);
3247 }
3248
3249 UShort8::UShort8(RValue<UShort4> lo, RValue<UShort4> hi)
3250 {
3251 assert(false && "UNIMPLEMENTED");
3252 }
3253
3254 RValue<UShort8> UShort8::operator=(RValue<UShort8> rhs) const
3255 {
3256 storeValue(rhs.value);
3257
3258 return rhs;
3259 }
3260
3261 RValue<UShort8> UShort8::operator=(const UShort8 &rhs) const
3262 {
3263 Value *value = rhs.loadValue();
3264 storeValue(value);
3265
3266 return RValue<UShort8>(value);
3267 }
3268
3269 RValue<UShort8> UShort8::operator=(const Reference<UShort8> &rhs) const
3270 {
3271 Value *value = rhs.loadValue();
3272 storeValue(value);
3273
3274 return RValue<UShort8>(value);
3275 }
3276
3277 RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs)
3278 {
3279 return RValue<UShort8>(Nucleus::createAnd(lhs.value, rhs.value));
3280 }
3281
3282 RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs)
3283 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003284 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003285 }
3286
3287 RValue<UShort8> operator>>(RValue<UShort8> lhs, unsigned char rhs)
3288 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003289 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003290 }
3291
3292 RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs)
3293 {
3294 return RValue<UShort8>(Nucleus::createAdd(lhs.value, rhs.value));
3295 }
3296
3297 RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs)
3298 {
3299 return RValue<UShort8>(Nucleus::createMul(lhs.value, rhs.value));
3300 }
3301
3302 RValue<UShort8> operator+=(const UShort8 &lhs, RValue<UShort8> rhs)
3303 {
3304 return lhs = lhs + rhs;
3305 }
3306
3307 RValue<UShort8> operator~(RValue<UShort8> val)
3308 {
3309 return RValue<UShort8>(Nucleus::createNot(val.value));
3310 }
3311
3312 RValue<UShort8> Swizzle(RValue<UShort8> x, char select0, char select1, char select2, char select3, char select4, char select5, char select6, char select7)
3313 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003314 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003315 }
3316
3317 RValue<UShort8> MulHigh(RValue<UShort8> x, RValue<UShort8> y)
3318 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003319 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003320 }
3321
3322 // FIXME: Implement as Shuffle(x, y, Select(i0, ..., i16)) and Shuffle(x, y, SELECT_PACK_REPEAT(element))
3323// RValue<UShort8> PackRepeat(RValue<Byte16> x, RValue<Byte16> y, int element)
3324// {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003325// assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003326// }
3327
3328 Type *UShort8::getType()
3329 {
3330 assert(false && "UNIMPLEMENTED"); return nullptr;
3331 }
3332
3333 Int::Int(Argument<Int> argument)
3334 {
3335 storeValue(argument.value);
3336 }
3337
3338 Int::Int(RValue<Byte> cast)
3339 {
3340 Value *integer = Nucleus::createZExt(cast.value, Int::getType());
3341
3342 storeValue(integer);
3343 }
3344
3345 Int::Int(RValue<SByte> cast)
3346 {
3347 Value *integer = Nucleus::createSExt(cast.value, Int::getType());
3348
3349 storeValue(integer);
3350 }
3351
3352 Int::Int(RValue<Short> cast)
3353 {
3354 Value *integer = Nucleus::createSExt(cast.value, Int::getType());
3355
3356 storeValue(integer);
3357 }
3358
3359 Int::Int(RValue<UShort> cast)
3360 {
3361 Value *integer = Nucleus::createZExt(cast.value, Int::getType());
3362
3363 storeValue(integer);
3364 }
3365
3366 Int::Int(RValue<Int2> cast)
3367 {
3368 *this = Extract(cast, 0);
3369 }
3370
3371 Int::Int(RValue<Long> cast)
3372 {
3373 Value *integer = Nucleus::createTrunc(cast.value, Int::getType());
3374
3375 storeValue(integer);
3376 }
3377
3378 Int::Int(RValue<Float> cast)
3379 {
3380 Value *integer = Nucleus::createFPToSI(cast.value, Int::getType());
3381
3382 storeValue(integer);
3383 }
3384
3385 Int::Int()
3386 {
3387 }
3388
3389 Int::Int(int x)
3390 {
3391 storeValue(Nucleus::createConstantInt(x));
3392 }
3393
3394 Int::Int(RValue<Int> rhs)
3395 {
3396 storeValue(rhs.value);
3397 }
3398
3399 Int::Int(RValue<UInt> rhs)
3400 {
3401 storeValue(rhs.value);
3402 }
3403
3404 Int::Int(const Int &rhs)
3405 {
3406 Value *value = rhs.loadValue();
3407 storeValue(value);
3408 }
3409
3410 Int::Int(const Reference<Int> &rhs)
3411 {
3412 Value *value = rhs.loadValue();
3413 storeValue(value);
3414 }
3415
3416 Int::Int(const UInt &rhs)
3417 {
3418 Value *value = rhs.loadValue();
3419 storeValue(value);
3420 }
3421
3422 Int::Int(const Reference<UInt> &rhs)
3423 {
3424 Value *value = rhs.loadValue();
3425 storeValue(value);
3426 }
3427
3428 RValue<Int> Int::operator=(int rhs) const
3429 {
3430 return RValue<Int>(storeValue(Nucleus::createConstantInt(rhs)));
3431 }
3432
3433 RValue<Int> Int::operator=(RValue<Int> rhs) const
3434 {
3435 storeValue(rhs.value);
3436
3437 return rhs;
3438 }
3439
3440 RValue<Int> Int::operator=(RValue<UInt> rhs) const
3441 {
3442 storeValue(rhs.value);
3443
3444 return RValue<Int>(rhs);
3445 }
3446
3447 RValue<Int> Int::operator=(const Int &rhs) const
3448 {
3449 Value *value = rhs.loadValue();
3450 storeValue(value);
3451
3452 return RValue<Int>(value);
3453 }
3454
3455 RValue<Int> Int::operator=(const Reference<Int> &rhs) const
3456 {
3457 Value *value = rhs.loadValue();
3458 storeValue(value);
3459
3460 return RValue<Int>(value);
3461 }
3462
3463 RValue<Int> Int::operator=(const UInt &rhs) const
3464 {
3465 Value *value = rhs.loadValue();
3466 storeValue(value);
3467
3468 return RValue<Int>(value);
3469 }
3470
3471 RValue<Int> Int::operator=(const Reference<UInt> &rhs) const
3472 {
3473 Value *value = rhs.loadValue();
3474 storeValue(value);
3475
3476 return RValue<Int>(value);
3477 }
3478
3479 RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs)
3480 {
3481 return RValue<Int>(Nucleus::createAdd(lhs.value, rhs.value));
3482 }
3483
3484 RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs)
3485 {
3486 return RValue<Int>(Nucleus::createSub(lhs.value, rhs.value));
3487 }
3488
3489 RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs)
3490 {
3491 return RValue<Int>(Nucleus::createMul(lhs.value, rhs.value));
3492 }
3493
3494 RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs)
3495 {
3496 return RValue<Int>(Nucleus::createSDiv(lhs.value, rhs.value));
3497 }
3498
3499 RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs)
3500 {
3501 return RValue<Int>(Nucleus::createSRem(lhs.value, rhs.value));
3502 }
3503
3504 RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs)
3505 {
3506 return RValue<Int>(Nucleus::createAnd(lhs.value, rhs.value));
3507 }
3508
3509 RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs)
3510 {
3511 return RValue<Int>(Nucleus::createOr(lhs.value, rhs.value));
3512 }
3513
3514 RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs)
3515 {
3516 return RValue<Int>(Nucleus::createXor(lhs.value, rhs.value));
3517 }
3518
3519 RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs)
3520 {
3521 return RValue<Int>(Nucleus::createShl(lhs.value, rhs.value));
3522 }
3523
3524 RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs)
3525 {
3526 return RValue<Int>(Nucleus::createAShr(lhs.value, rhs.value));
3527 }
3528
3529 RValue<Int> operator+=(const Int &lhs, RValue<Int> rhs)
3530 {
3531 return lhs = lhs + rhs;
3532 }
3533
3534 RValue<Int> operator-=(const Int &lhs, RValue<Int> rhs)
3535 {
3536 return lhs = lhs - rhs;
3537 }
3538
3539 RValue<Int> operator*=(const Int &lhs, RValue<Int> rhs)
3540 {
3541 return lhs = lhs * rhs;
3542 }
3543
3544 RValue<Int> operator/=(const Int &lhs, RValue<Int> rhs)
3545 {
3546 return lhs = lhs / rhs;
3547 }
3548
3549 RValue<Int> operator%=(const Int &lhs, RValue<Int> rhs)
3550 {
3551 return lhs = lhs % rhs;
3552 }
3553
3554 RValue<Int> operator&=(const Int &lhs, RValue<Int> rhs)
3555 {
3556 return lhs = lhs & rhs;
3557 }
3558
3559 RValue<Int> operator|=(const Int &lhs, RValue<Int> rhs)
3560 {
3561 return lhs = lhs | rhs;
3562 }
3563
3564 RValue<Int> operator^=(const Int &lhs, RValue<Int> rhs)
3565 {
3566 return lhs = lhs ^ rhs;
3567 }
3568
3569 RValue<Int> operator<<=(const Int &lhs, RValue<Int> rhs)
3570 {
3571 return lhs = lhs << rhs;
3572 }
3573
3574 RValue<Int> operator>>=(const Int &lhs, RValue<Int> rhs)
3575 {
3576 return lhs = lhs >> rhs;
3577 }
3578
3579 RValue<Int> operator+(RValue<Int> val)
3580 {
3581 return val;
3582 }
3583
3584 RValue<Int> operator-(RValue<Int> val)
3585 {
3586 return RValue<Int>(Nucleus::createNeg(val.value));
3587 }
3588
3589 RValue<Int> operator~(RValue<Int> val)
3590 {
3591 return RValue<Int>(Nucleus::createNot(val.value));
3592 }
3593
3594 RValue<Int> operator++(const Int &val, int) // Post-increment
3595 {
Nicolas Capens611642a2016-09-28 16:45:04 -04003596 auto oldValue = val.loadValue();
3597 auto newValue = ::function->makeVariable(Ice::IceType_i32);
3598 auto inc = Ice::InstArithmetic::create(::function, Ice::InstArithmetic::Add, newValue, oldValue, ::context->getConstantInt32(1));
3599 ::basicBlock->appendInst(inc);
3600 val.storeValue(V(newValue));
3601
3602 return RValue<Int>(oldValue);
Nicolas Capens598f8d82016-09-26 15:09:10 -04003603 }
3604
3605 const Int &operator++(const Int &val) // Pre-increment
3606 {
3607 assert(false && "UNIMPLEMENTED"); return val;
3608 }
3609
3610 RValue<Int> operator--(const Int &val, int) // Post-decrement
3611 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003612 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003613 }
3614
3615 const Int &operator--(const Int &val) // Pre-decrement
3616 {
3617 assert(false && "UNIMPLEMENTED"); return val;
3618 }
3619
3620 RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs)
3621 {
3622 return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
3623 }
3624
3625 RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs)
3626 {
3627 return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
3628 }
3629
3630 RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs)
3631 {
3632 return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
3633 }
3634
3635 RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs)
3636 {
3637 return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
3638 }
3639
3640 RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs)
3641 {
3642 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
3643 }
3644
3645 RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs)
3646 {
3647 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
3648 }
3649
3650 RValue<Int> Max(RValue<Int> x, RValue<Int> y)
3651 {
3652 return IfThenElse(x > y, x, y);
3653 }
3654
3655 RValue<Int> Min(RValue<Int> x, RValue<Int> y)
3656 {
3657 return IfThenElse(x < y, x, y);
3658 }
3659
3660 RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max)
3661 {
3662 return Min(Max(x, min), max);
3663 }
3664
3665 RValue<Int> RoundInt(RValue<Float> cast)
3666 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003667 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003668 }
3669
3670 Type *Int::getType()
3671 {
3672 return T(Ice::IceType_i32);
3673 }
3674
3675 Long::Long(RValue<Int> cast)
3676 {
3677 Value *integer = Nucleus::createSExt(cast.value, Long::getType());
3678
3679 storeValue(integer);
3680 }
3681
3682 Long::Long(RValue<UInt> cast)
3683 {
3684 Value *integer = Nucleus::createZExt(cast.value, Long::getType());
3685
3686 storeValue(integer);
3687 }
3688
3689 Long::Long()
3690 {
3691 }
3692
3693 Long::Long(RValue<Long> rhs)
3694 {
3695 storeValue(rhs.value);
3696 }
3697
3698 RValue<Long> Long::operator=(int64_t rhs) const
3699 {
3700 return RValue<Long>(storeValue(Nucleus::createConstantInt(rhs)));
3701 }
3702
3703 RValue<Long> Long::operator=(RValue<Long> rhs) const
3704 {
3705 storeValue(rhs.value);
3706
3707 return rhs;
3708 }
3709
3710 RValue<Long> Long::operator=(const Long &rhs) const
3711 {
3712 Value *value = rhs.loadValue();
3713 storeValue(value);
3714
3715 return RValue<Long>(value);
3716 }
3717
3718 RValue<Long> Long::operator=(const Reference<Long> &rhs) const
3719 {
3720 Value *value = rhs.loadValue();
3721 storeValue(value);
3722
3723 return RValue<Long>(value);
3724 }
3725
3726 RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs)
3727 {
3728 return RValue<Long>(Nucleus::createAdd(lhs.value, rhs.value));
3729 }
3730
3731 RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs)
3732 {
3733 return RValue<Long>(Nucleus::createSub(lhs.value, rhs.value));
3734 }
3735
3736 RValue<Long> operator+=(const Long &lhs, RValue<Long> rhs)
3737 {
3738 return lhs = lhs + rhs;
3739 }
3740
3741 RValue<Long> operator-=(const Long &lhs, RValue<Long> rhs)
3742 {
3743 return lhs = lhs - rhs;
3744 }
3745
3746 RValue<Long> AddAtomic(RValue<Pointer<Long> > x, RValue<Long> y)
3747 {
3748 return RValue<Long>(Nucleus::createAtomicAdd(x.value, y.value));
3749 }
3750
3751 Type *Long::getType()
3752 {
3753 assert(false && "UNIMPLEMENTED"); return nullptr;
3754 }
3755
3756 Long1::Long1(const RValue<UInt> cast)
3757 {
3758 assert(false && "UNIMPLEMENTED");
3759 }
3760
3761 Long1::Long1(RValue<Long1> rhs)
3762 {
3763 storeValue(rhs.value);
3764 }
3765
3766 Type *Long1::getType()
3767 {
3768 assert(false && "UNIMPLEMENTED"); return nullptr;
3769 }
3770
3771 RValue<Long2> UnpackHigh(RValue<Long2> x, RValue<Long2> y)
3772 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003773 assert(false && "UNIMPLEMENTED"); return RValue<Long2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003774 }
3775
3776 Type *Long2::getType()
3777 {
3778 assert(false && "UNIMPLEMENTED"); return nullptr;
3779 }
3780
3781 UInt::UInt(Argument<UInt> argument)
3782 {
3783 storeValue(argument.value);
3784 }
3785
3786 UInt::UInt(RValue<UShort> cast)
3787 {
3788 Value *integer = Nucleus::createZExt(cast.value, UInt::getType());
3789
3790 storeValue(integer);
3791 }
3792
3793 UInt::UInt(RValue<Long> cast)
3794 {
3795 Value *integer = Nucleus::createTrunc(cast.value, UInt::getType());
3796
3797 storeValue(integer);
3798 }
3799
3800 UInt::UInt(RValue<Float> cast)
3801 {
3802 assert(false && "UNIMPLEMENTED");
3803 }
3804
3805 UInt::UInt()
3806 {
3807 }
3808
3809 UInt::UInt(int x)
3810 {
3811 storeValue(Nucleus::createConstantInt(x));
3812 }
3813
3814 UInt::UInt(unsigned int x)
3815 {
3816 storeValue(Nucleus::createConstantInt(x));
3817 }
3818
3819 UInt::UInt(RValue<UInt> rhs)
3820 {
3821 storeValue(rhs.value);
3822 }
3823
3824 UInt::UInt(RValue<Int> rhs)
3825 {
3826 storeValue(rhs.value);
3827 }
3828
3829 UInt::UInt(const UInt &rhs)
3830 {
3831 Value *value = rhs.loadValue();
3832 storeValue(value);
3833 }
3834
3835 UInt::UInt(const Reference<UInt> &rhs)
3836 {
3837 Value *value = rhs.loadValue();
3838 storeValue(value);
3839 }
3840
3841 UInt::UInt(const Int &rhs)
3842 {
3843 Value *value = rhs.loadValue();
3844 storeValue(value);
3845 }
3846
3847 UInt::UInt(const Reference<Int> &rhs)
3848 {
3849 Value *value = rhs.loadValue();
3850 storeValue(value);
3851 }
3852
3853 RValue<UInt> UInt::operator=(unsigned int rhs) const
3854 {
3855 return RValue<UInt>(storeValue(Nucleus::createConstantInt(rhs)));
3856 }
3857
3858 RValue<UInt> UInt::operator=(RValue<UInt> rhs) const
3859 {
3860 storeValue(rhs.value);
3861
3862 return rhs;
3863 }
3864
3865 RValue<UInt> UInt::operator=(RValue<Int> rhs) const
3866 {
3867 storeValue(rhs.value);
3868
3869 return RValue<UInt>(rhs);
3870 }
3871
3872 RValue<UInt> UInt::operator=(const UInt &rhs) const
3873 {
3874 Value *value = rhs.loadValue();
3875 storeValue(value);
3876
3877 return RValue<UInt>(value);
3878 }
3879
3880 RValue<UInt> UInt::operator=(const Reference<UInt> &rhs) const
3881 {
3882 Value *value = rhs.loadValue();
3883 storeValue(value);
3884
3885 return RValue<UInt>(value);
3886 }
3887
3888 RValue<UInt> UInt::operator=(const Int &rhs) const
3889 {
3890 Value *value = rhs.loadValue();
3891 storeValue(value);
3892
3893 return RValue<UInt>(value);
3894 }
3895
3896 RValue<UInt> UInt::operator=(const Reference<Int> &rhs) const
3897 {
3898 Value *value = rhs.loadValue();
3899 storeValue(value);
3900
3901 return RValue<UInt>(value);
3902 }
3903
3904 RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs)
3905 {
3906 return RValue<UInt>(Nucleus::createAdd(lhs.value, rhs.value));
3907 }
3908
3909 RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs)
3910 {
3911 return RValue<UInt>(Nucleus::createSub(lhs.value, rhs.value));
3912 }
3913
3914 RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs)
3915 {
3916 return RValue<UInt>(Nucleus::createMul(lhs.value, rhs.value));
3917 }
3918
3919 RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs)
3920 {
3921 return RValue<UInt>(Nucleus::createUDiv(lhs.value, rhs.value));
3922 }
3923
3924 RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs)
3925 {
3926 return RValue<UInt>(Nucleus::createURem(lhs.value, rhs.value));
3927 }
3928
3929 RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs)
3930 {
3931 return RValue<UInt>(Nucleus::createAnd(lhs.value, rhs.value));
3932 }
3933
3934 RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs)
3935 {
3936 return RValue<UInt>(Nucleus::createOr(lhs.value, rhs.value));
3937 }
3938
3939 RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs)
3940 {
3941 return RValue<UInt>(Nucleus::createXor(lhs.value, rhs.value));
3942 }
3943
3944 RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs)
3945 {
3946 return RValue<UInt>(Nucleus::createShl(lhs.value, rhs.value));
3947 }
3948
3949 RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs)
3950 {
3951 return RValue<UInt>(Nucleus::createLShr(lhs.value, rhs.value));
3952 }
3953
3954 RValue<UInt> operator+=(const UInt &lhs, RValue<UInt> rhs)
3955 {
3956 return lhs = lhs + rhs;
3957 }
3958
3959 RValue<UInt> operator-=(const UInt &lhs, RValue<UInt> rhs)
3960 {
3961 return lhs = lhs - rhs;
3962 }
3963
3964 RValue<UInt> operator*=(const UInt &lhs, RValue<UInt> rhs)
3965 {
3966 return lhs = lhs * rhs;
3967 }
3968
3969 RValue<UInt> operator/=(const UInt &lhs, RValue<UInt> rhs)
3970 {
3971 return lhs = lhs / rhs;
3972 }
3973
3974 RValue<UInt> operator%=(const UInt &lhs, RValue<UInt> rhs)
3975 {
3976 return lhs = lhs % rhs;
3977 }
3978
3979 RValue<UInt> operator&=(const UInt &lhs, RValue<UInt> rhs)
3980 {
3981 return lhs = lhs & rhs;
3982 }
3983
3984 RValue<UInt> operator|=(const UInt &lhs, RValue<UInt> rhs)
3985 {
3986 return lhs = lhs | rhs;
3987 }
3988
3989 RValue<UInt> operator^=(const UInt &lhs, RValue<UInt> rhs)
3990 {
3991 return lhs = lhs ^ rhs;
3992 }
3993
3994 RValue<UInt> operator<<=(const UInt &lhs, RValue<UInt> rhs)
3995 {
3996 return lhs = lhs << rhs;
3997 }
3998
3999 RValue<UInt> operator>>=(const UInt &lhs, RValue<UInt> rhs)
4000 {
4001 return lhs = lhs >> rhs;
4002 }
4003
4004 RValue<UInt> operator+(RValue<UInt> val)
4005 {
4006 return val;
4007 }
4008
4009 RValue<UInt> operator-(RValue<UInt> val)
4010 {
4011 return RValue<UInt>(Nucleus::createNeg(val.value));
4012 }
4013
4014 RValue<UInt> operator~(RValue<UInt> val)
4015 {
4016 return RValue<UInt>(Nucleus::createNot(val.value));
4017 }
4018
4019 RValue<UInt> operator++(const UInt &val, int) // Post-increment
4020 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004021 assert(false && "UNIMPLEMENTED"); return RValue<UInt>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004022 }
4023
4024 const UInt &operator++(const UInt &val) // Pre-increment
4025 {
4026 assert(false && "UNIMPLEMENTED"); return val;
4027 }
4028
4029 RValue<UInt> operator--(const UInt &val, int) // Post-decrement
4030 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004031 assert(false && "UNIMPLEMENTED"); return RValue<UInt>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004032 }
4033
4034 const UInt &operator--(const UInt &val) // Pre-decrement
4035 {
4036 assert(false && "UNIMPLEMENTED"); return val;
4037 }
4038
4039 RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y)
4040 {
4041 return IfThenElse(x > y, x, y);
4042 }
4043
4044 RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y)
4045 {
4046 return IfThenElse(x < y, x, y);
4047 }
4048
4049 RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max)
4050 {
4051 return Min(Max(x, min), max);
4052 }
4053
4054 RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs)
4055 {
4056 return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
4057 }
4058
4059 RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs)
4060 {
4061 return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
4062 }
4063
4064 RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs)
4065 {
4066 return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
4067 }
4068
4069 RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs)
4070 {
4071 return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
4072 }
4073
4074 RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs)
4075 {
4076 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
4077 }
4078
4079 RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs)
4080 {
4081 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
4082 }
4083
4084// RValue<UInt> RoundUInt(RValue<Float> cast)
4085// {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004086// assert(false && "UNIMPLEMENTED"); return RValue<UInt>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004087// }
4088
4089 Type *UInt::getType()
4090 {
4091 assert(false && "UNIMPLEMENTED"); return nullptr;
4092 }
4093
4094// Int2::Int2(RValue<Int> cast)
4095// {
4096// Value *extend = Nucleus::createZExt(cast.value, Long::getType());
4097// Value *vector = Nucleus::createBitCast(extend, Int2::getType());
4098//
4099// Constant *shuffle[2];
4100// shuffle[0] = Nucleus::createConstantInt(0);
4101// shuffle[1] = Nucleus::createConstantInt(0);
4102//
4103// Value *replicate = Nucleus::createShuffleVector(vector, UndefValue::get(Int2::getType()), Nucleus::createConstantVector(shuffle, 2));
4104//
4105// storeValue(replicate);
4106// }
4107
4108 Int2::Int2(RValue<Int4> cast)
4109 {
4110 Value *long2 = Nucleus::createBitCast(cast.value, Long2::getType());
Nicolas Capense95d5342016-09-30 11:37:28 -04004111 Value *element = Nucleus::createExtractElement(long2, Long2::getType(), 0);
Nicolas Capens598f8d82016-09-26 15:09:10 -04004112 Value *int2 = Nucleus::createBitCast(element, Int2::getType());
4113
4114 storeValue(int2);
4115 }
4116
4117 Int2::Int2()
4118 {
4119 // xy.parent = this;
4120 }
4121
4122 Int2::Int2(int x, int y)
4123 {
4124 // xy.parent = this;
4125
4126 assert(false && "UNIMPLEMENTED");
4127 }
4128
4129 Int2::Int2(RValue<Int2> rhs)
4130 {
4131 // xy.parent = this;
4132
4133 storeValue(rhs.value);
4134 }
4135
4136 Int2::Int2(const Int2 &rhs)
4137 {
4138 // xy.parent = this;
4139
4140 Value *value = rhs.loadValue();
4141 storeValue(value);
4142 }
4143
4144 Int2::Int2(const Reference<Int2> &rhs)
4145 {
4146 // xy.parent = this;
4147
4148 Value *value = rhs.loadValue();
4149 storeValue(value);
4150 }
4151
4152 Int2::Int2(RValue<Int> lo, RValue<Int> hi)
4153 {
4154 assert(false && "UNIMPLEMENTED");
4155 }
4156
4157 RValue<Int2> Int2::operator=(RValue<Int2> rhs) const
4158 {
4159 storeValue(rhs.value);
4160
4161 return rhs;
4162 }
4163
4164 RValue<Int2> Int2::operator=(const Int2 &rhs) const
4165 {
4166 Value *value = rhs.loadValue();
4167 storeValue(value);
4168
4169 return RValue<Int2>(value);
4170 }
4171
4172 RValue<Int2> Int2::operator=(const Reference<Int2> &rhs) const
4173 {
4174 Value *value = rhs.loadValue();
4175 storeValue(value);
4176
4177 return RValue<Int2>(value);
4178 }
4179
4180 RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs)
4181 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004182 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004183 }
4184
4185 RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs)
4186 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004187 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004188 }
4189
4190// RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs)
4191// {
4192// return RValue<Int2>(Nucleus::createMul(lhs.value, rhs.value));
4193// }
4194
4195// RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs)
4196// {
4197// return RValue<Int2>(Nucleus::createSDiv(lhs.value, rhs.value));
4198// }
4199
4200// RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs)
4201// {
4202// return RValue<Int2>(Nucleus::createSRem(lhs.value, rhs.value));
4203// }
4204
4205 RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs)
4206 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004207 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004208 }
4209
4210 RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs)
4211 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004212 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004213 }
4214
4215 RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs)
4216 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004217 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004218 }
4219
4220 RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs)
4221 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004222 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004223 }
4224
4225 RValue<Int2> operator>>(RValue<Int2> lhs, unsigned char rhs)
4226 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004227 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004228 }
4229
4230 RValue<Int2> operator<<(RValue<Int2> lhs, RValue<Long1> rhs)
4231 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004232 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004233 }
4234
4235 RValue<Int2> operator>>(RValue<Int2> lhs, RValue<Long1> rhs)
4236 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004237 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004238 }
4239
4240 RValue<Int2> operator+=(const Int2 &lhs, RValue<Int2> rhs)
4241 {
4242 return lhs = lhs + rhs;
4243 }
4244
4245 RValue<Int2> operator-=(const Int2 &lhs, RValue<Int2> rhs)
4246 {
4247 return lhs = lhs - rhs;
4248 }
4249
4250// RValue<Int2> operator*=(const Int2 &lhs, RValue<Int2> rhs)
4251// {
4252// return lhs = lhs * rhs;
4253// }
4254
4255// RValue<Int2> operator/=(const Int2 &lhs, RValue<Int2> rhs)
4256// {
4257// return lhs = lhs / rhs;
4258// }
4259
4260// RValue<Int2> operator%=(const Int2 &lhs, RValue<Int2> rhs)
4261// {
4262// return lhs = lhs % rhs;
4263// }
4264
4265 RValue<Int2> operator&=(const Int2 &lhs, RValue<Int2> rhs)
4266 {
4267 return lhs = lhs & rhs;
4268 }
4269
4270 RValue<Int2> operator|=(const Int2 &lhs, RValue<Int2> rhs)
4271 {
4272 return lhs = lhs | rhs;
4273 }
4274
4275 RValue<Int2> operator^=(const Int2 &lhs, RValue<Int2> rhs)
4276 {
4277 return lhs = lhs ^ rhs;
4278 }
4279
4280 RValue<Int2> operator<<=(const Int2 &lhs, unsigned char rhs)
4281 {
4282 return lhs = lhs << rhs;
4283 }
4284
4285 RValue<Int2> operator>>=(const Int2 &lhs, unsigned char rhs)
4286 {
4287 return lhs = lhs >> rhs;
4288 }
4289
4290 RValue<Int2> operator<<=(const Int2 &lhs, RValue<Long1> rhs)
4291 {
4292 return lhs = lhs << rhs;
4293 }
4294
4295 RValue<Int2> operator>>=(const Int2 &lhs, RValue<Long1> rhs)
4296 {
4297 return lhs = lhs >> rhs;
4298 }
4299
4300// RValue<Int2> operator+(RValue<Int2> val)
4301// {
4302// return val;
4303// }
4304
4305// RValue<Int2> operator-(RValue<Int2> val)
4306// {
4307// return RValue<Int2>(Nucleus::createNeg(val.value));
4308// }
4309
4310 RValue<Int2> operator~(RValue<Int2> val)
4311 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004312 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004313 }
4314
4315 RValue<Long1> UnpackLow(RValue<Int2> x, RValue<Int2> y)
4316 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004317 assert(false && "UNIMPLEMENTED"); return RValue<Long1>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004318 }
4319
4320 RValue<Long1> UnpackHigh(RValue<Int2> x, RValue<Int2> y)
4321 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004322 assert(false && "UNIMPLEMENTED"); return RValue<Long1>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004323 }
4324
4325 RValue<Int> Extract(RValue<Int2> val, int i)
4326 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004327 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004328 }
4329
4330 RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i)
4331 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004332 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004333 }
4334
4335 Type *Int2::getType()
4336 {
4337 assert(false && "UNIMPLEMENTED"); return nullptr;
4338 }
4339
4340 UInt2::UInt2()
4341 {
4342 // xy.parent = this;
4343 }
4344
4345 UInt2::UInt2(unsigned int x, unsigned int y)
4346 {
4347 // xy.parent = this;
4348
4349 assert(false && "UNIMPLEMENTED");
4350 }
4351
4352 UInt2::UInt2(RValue<UInt2> rhs)
4353 {
4354 // xy.parent = this;
4355
4356 storeValue(rhs.value);
4357 }
4358
4359 UInt2::UInt2(const UInt2 &rhs)
4360 {
4361 // xy.parent = this;
4362
4363 Value *value = rhs.loadValue();
4364 storeValue(value);
4365 }
4366
4367 UInt2::UInt2(const Reference<UInt2> &rhs)
4368 {
4369 // xy.parent = this;
4370
4371 Value *value = rhs.loadValue();
4372 storeValue(value);
4373 }
4374
4375 RValue<UInt2> UInt2::operator=(RValue<UInt2> rhs) const
4376 {
4377 storeValue(rhs.value);
4378
4379 return rhs;
4380 }
4381
4382 RValue<UInt2> UInt2::operator=(const UInt2 &rhs) const
4383 {
4384 Value *value = rhs.loadValue();
4385 storeValue(value);
4386
4387 return RValue<UInt2>(value);
4388 }
4389
4390 RValue<UInt2> UInt2::operator=(const Reference<UInt2> &rhs) const
4391 {
4392 Value *value = rhs.loadValue();
4393 storeValue(value);
4394
4395 return RValue<UInt2>(value);
4396 }
4397
4398 RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs)
4399 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004400 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004401 }
4402
4403 RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs)
4404 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004405 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004406 }
4407
4408// RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs)
4409// {
4410// return RValue<UInt2>(Nucleus::createMul(lhs.value, rhs.value));
4411// }
4412
4413// RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs)
4414// {
4415// return RValue<UInt2>(Nucleus::createUDiv(lhs.value, rhs.value));
4416// }
4417
4418// RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs)
4419// {
4420// return RValue<UInt2>(Nucleus::createURem(lhs.value, rhs.value));
4421// }
4422
4423 RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs)
4424 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004425 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004426 }
4427
4428 RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs)
4429 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004430 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004431 }
4432
4433 RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs)
4434 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004435 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004436 }
4437
4438 RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs)
4439 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004440 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004441 }
4442
4443 RValue<UInt2> operator>>(RValue<UInt2> lhs, unsigned char rhs)
4444 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004445 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004446 }
4447
4448 RValue<UInt2> operator<<(RValue<UInt2> lhs, RValue<Long1> rhs)
4449 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004450 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004451 }
4452
4453 RValue<UInt2> operator>>(RValue<UInt2> lhs, RValue<Long1> rhs)
4454 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004455 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004456 }
4457
4458 RValue<UInt2> operator+=(const UInt2 &lhs, RValue<UInt2> rhs)
4459 {
4460 return lhs = lhs + rhs;
4461 }
4462
4463 RValue<UInt2> operator-=(const UInt2 &lhs, RValue<UInt2> rhs)
4464 {
4465 return lhs = lhs - rhs;
4466 }
4467
4468// RValue<UInt2> operator*=(const UInt2 &lhs, RValue<UInt2> rhs)
4469// {
4470// return lhs = lhs * rhs;
4471// }
4472
4473// RValue<UInt2> operator/=(const UInt2 &lhs, RValue<UInt2> rhs)
4474// {
4475// return lhs = lhs / rhs;
4476// }
4477
4478// RValue<UInt2> operator%=(const UInt2 &lhs, RValue<UInt2> rhs)
4479// {
4480// return lhs = lhs % rhs;
4481// }
4482
4483 RValue<UInt2> operator&=(const UInt2 &lhs, RValue<UInt2> rhs)
4484 {
4485 return lhs = lhs & rhs;
4486 }
4487
4488 RValue<UInt2> operator|=(const UInt2 &lhs, RValue<UInt2> rhs)
4489 {
4490 return lhs = lhs | rhs;
4491 }
4492
4493 RValue<UInt2> operator^=(const UInt2 &lhs, RValue<UInt2> rhs)
4494 {
4495 return lhs = lhs ^ rhs;
4496 }
4497
4498 RValue<UInt2> operator<<=(const UInt2 &lhs, unsigned char rhs)
4499 {
4500 return lhs = lhs << rhs;
4501 }
4502
4503 RValue<UInt2> operator>>=(const UInt2 &lhs, unsigned char rhs)
4504 {
4505 return lhs = lhs >> rhs;
4506 }
4507
4508 RValue<UInt2> operator<<=(const UInt2 &lhs, RValue<Long1> rhs)
4509 {
4510 return lhs = lhs << rhs;
4511 }
4512
4513 RValue<UInt2> operator>>=(const UInt2 &lhs, RValue<Long1> rhs)
4514 {
4515 return lhs = lhs >> rhs;
4516 }
4517
4518// RValue<UInt2> operator+(RValue<UInt2> val)
4519// {
4520// return val;
4521// }
4522
4523// RValue<UInt2> operator-(RValue<UInt2> val)
4524// {
4525// return RValue<UInt2>(Nucleus::createNeg(val.value));
4526// }
4527
4528 RValue<UInt2> operator~(RValue<UInt2> val)
4529 {
4530 return RValue<UInt2>(Nucleus::createNot(val.value));
4531 }
4532
4533 Type *UInt2::getType()
4534 {
4535 assert(false && "UNIMPLEMENTED"); return nullptr;
4536 }
4537
4538 Int4::Int4(RValue<Byte4> cast)
4539 {
4540 assert(false && "UNIMPLEMENTED");
4541 }
4542
4543 Int4::Int4(RValue<SByte4> cast)
4544 {
4545 assert(false && "UNIMPLEMENTED");
4546 }
4547
4548 Int4::Int4(RValue<Float4> cast)
4549 {
4550 // xyzw.parent = this;
4551
4552 Value *xyzw = Nucleus::createFPToSI(cast.value, Int4::getType());
4553
4554 storeValue(xyzw);
4555 }
4556
4557 Int4::Int4(RValue<Short4> cast)
4558 {
4559 assert(false && "UNIMPLEMENTED");
4560 }
4561
4562 Int4::Int4(RValue<UShort4> cast)
4563 {
4564 assert(false && "UNIMPLEMENTED");
4565 }
4566
4567 Int4::Int4()
4568 {
4569 // xyzw.parent = this;
4570 }
4571
4572 Int4::Int4(int xyzw)
4573 {
4574 constant(xyzw, xyzw, xyzw, xyzw);
4575 }
4576
4577 Int4::Int4(int x, int yzw)
4578 {
4579 constant(x, yzw, yzw, yzw);
4580 }
4581
4582 Int4::Int4(int x, int y, int zw)
4583 {
4584 constant(x, y, zw, zw);
4585 }
4586
4587 Int4::Int4(int x, int y, int z, int w)
4588 {
4589 constant(x, y, z, w);
4590 }
4591
4592 void Int4::constant(int x, int y, int z, int w)
4593 {
4594 // xyzw.parent = this;
4595
4596 Constant *constantVector[4];
4597 constantVector[0] = Nucleus::createConstantInt(x);
4598 constantVector[1] = Nucleus::createConstantInt(y);
4599 constantVector[2] = Nucleus::createConstantInt(z);
4600 constantVector[3] = Nucleus::createConstantInt(w);
4601
4602 storeValue(Nucleus::createConstantVector(constantVector, 4));
4603 }
4604
4605 Int4::Int4(RValue<Int4> rhs)
4606 {
4607 // xyzw.parent = this;
4608
4609 storeValue(rhs.value);
4610 }
4611
4612 Int4::Int4(const Int4 &rhs)
4613 {
4614 // xyzw.parent = this;
4615
4616 Value *value = rhs.loadValue();
4617 storeValue(value);
4618 }
4619
4620 Int4::Int4(const Reference<Int4> &rhs)
4621 {
4622 // xyzw.parent = this;
4623
4624 Value *value = rhs.loadValue();
4625 storeValue(value);
4626 }
4627
4628 Int4::Int4(RValue<UInt4> rhs)
4629 {
4630 // xyzw.parent = this;
4631
4632 storeValue(rhs.value);
4633 }
4634
4635 Int4::Int4(const UInt4 &rhs)
4636 {
4637 // xyzw.parent = this;
4638
4639 Value *value = rhs.loadValue();
4640 storeValue(value);
4641 }
4642
4643 Int4::Int4(const Reference<UInt4> &rhs)
4644 {
4645 // xyzw.parent = this;
4646
4647 Value *value = rhs.loadValue();
4648 storeValue(value);
4649 }
4650
4651 Int4::Int4(RValue<Int2> lo, RValue<Int2> hi)
4652 {
4653 assert(false && "UNIMPLEMENTED");
4654 }
4655
4656 Int4::Int4(RValue<Int> rhs)
4657 {
4658 // xyzw.parent = this;
4659
4660 assert(false && "UNIMPLEMENTED");
4661 }
4662
4663 Int4::Int4(const Int &rhs)
4664 {
4665 // xyzw.parent = this;
4666
4667 *this = RValue<Int>(rhs.loadValue());
4668 }
4669
4670 Int4::Int4(const Reference<Int> &rhs)
4671 {
4672 // xyzw.parent = this;
4673
4674 *this = RValue<Int>(rhs.loadValue());
4675 }
4676
4677 RValue<Int4> Int4::operator=(RValue<Int4> rhs) const
4678 {
4679 storeValue(rhs.value);
4680
4681 return rhs;
4682 }
4683
4684 RValue<Int4> Int4::operator=(const Int4 &rhs) const
4685 {
4686 Value *value = rhs.loadValue();
4687 storeValue(value);
4688
4689 return RValue<Int4>(value);
4690 }
4691
4692 RValue<Int4> Int4::operator=(const Reference<Int4> &rhs) const
4693 {
4694 Value *value = rhs.loadValue();
4695 storeValue(value);
4696
4697 return RValue<Int4>(value);
4698 }
4699
4700 RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs)
4701 {
4702 return RValue<Int4>(Nucleus::createAdd(lhs.value, rhs.value));
4703 }
4704
4705 RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs)
4706 {
4707 return RValue<Int4>(Nucleus::createSub(lhs.value, rhs.value));
4708 }
4709
4710 RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs)
4711 {
4712 return RValue<Int4>(Nucleus::createMul(lhs.value, rhs.value));
4713 }
4714
4715 RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs)
4716 {
4717 return RValue<Int4>(Nucleus::createSDiv(lhs.value, rhs.value));
4718 }
4719
4720 RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs)
4721 {
4722 return RValue<Int4>(Nucleus::createSRem(lhs.value, rhs.value));
4723 }
4724
4725 RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs)
4726 {
4727 return RValue<Int4>(Nucleus::createAnd(lhs.value, rhs.value));
4728 }
4729
4730 RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs)
4731 {
4732 return RValue<Int4>(Nucleus::createOr(lhs.value, rhs.value));
4733 }
4734
4735 RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs)
4736 {
4737 return RValue<Int4>(Nucleus::createXor(lhs.value, rhs.value));
4738 }
4739
4740 RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs)
4741 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004742 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004743 }
4744
4745 RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs)
4746 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004747 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004748 }
4749
4750 RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs)
4751 {
4752 return RValue<Int4>(Nucleus::createShl(lhs.value, rhs.value));
4753 }
4754
4755 RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs)
4756 {
4757 return RValue<Int4>(Nucleus::createAShr(lhs.value, rhs.value));
4758 }
4759
4760 RValue<Int4> operator+=(const Int4 &lhs, RValue<Int4> rhs)
4761 {
4762 return lhs = lhs + rhs;
4763 }
4764
4765 RValue<Int4> operator-=(const Int4 &lhs, RValue<Int4> rhs)
4766 {
4767 return lhs = lhs - rhs;
4768 }
4769
4770 RValue<Int4> operator*=(const Int4 &lhs, RValue<Int4> rhs)
4771 {
4772 return lhs = lhs * rhs;
4773 }
4774
4775// RValue<Int4> operator/=(const Int4 &lhs, RValue<Int4> rhs)
4776// {
4777// return lhs = lhs / rhs;
4778// }
4779
4780// RValue<Int4> operator%=(const Int4 &lhs, RValue<Int4> rhs)
4781// {
4782// return lhs = lhs % rhs;
4783// }
4784
4785 RValue<Int4> operator&=(const Int4 &lhs, RValue<Int4> rhs)
4786 {
4787 return lhs = lhs & rhs;
4788 }
4789
4790 RValue<Int4> operator|=(const Int4 &lhs, RValue<Int4> rhs)
4791 {
4792 return lhs = lhs | rhs;
4793 }
4794
4795 RValue<Int4> operator^=(const Int4 &lhs, RValue<Int4> rhs)
4796 {
4797 return lhs = lhs ^ rhs;
4798 }
4799
4800 RValue<Int4> operator<<=(const Int4 &lhs, unsigned char rhs)
4801 {
4802 return lhs = lhs << rhs;
4803 }
4804
4805 RValue<Int4> operator>>=(const Int4 &lhs, unsigned char rhs)
4806 {
4807 return lhs = lhs >> rhs;
4808 }
4809
4810 RValue<Int4> operator+(RValue<Int4> val)
4811 {
4812 return val;
4813 }
4814
4815 RValue<Int4> operator-(RValue<Int4> val)
4816 {
4817 return RValue<Int4>(Nucleus::createNeg(val.value));
4818 }
4819
4820 RValue<Int4> operator~(RValue<Int4> val)
4821 {
4822 return RValue<Int4>(Nucleus::createNot(val.value));
4823 }
4824
4825 RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y)
4826 {
4827 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpEQ(x.value, y.value), Int4::getType()));
4828 }
4829
4830 RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y)
4831 {
4832 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpSLT(x.value, y.value), Int4::getType()));
4833 }
4834
4835 RValue<Int4> CmpLE(RValue<Int4> x, RValue<Int4> y)
4836 {
4837 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpSLE(x.value, y.value), Int4::getType()));
4838 }
4839
4840 RValue<Int4> CmpNEQ(RValue<Int4> x, RValue<Int4> y)
4841 {
4842 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpNE(x.value, y.value), Int4::getType()));
4843 }
4844
4845 RValue<Int4> CmpNLT(RValue<Int4> x, RValue<Int4> y)
4846 {
4847 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpSGE(x.value, y.value), Int4::getType()));
4848 }
4849
4850 RValue<Int4> CmpNLE(RValue<Int4> x, RValue<Int4> y)
4851 {
4852 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpSGT(x.value, y.value), Int4::getType()));
4853 }
4854
4855 RValue<Int4> Max(RValue<Int4> x, RValue<Int4> y)
4856 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004857 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004858 }
4859
4860 RValue<Int4> Min(RValue<Int4> x, RValue<Int4> y)
4861 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004862 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004863 }
4864
4865 RValue<Int4> RoundInt(RValue<Float4> cast)
4866 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004867 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004868 }
4869
4870 RValue<Short8> Pack(RValue<Int4> x, RValue<Int4> y)
4871 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004872 assert(false && "UNIMPLEMENTED"); return RValue<Short8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004873 }
4874
4875 RValue<Int> Extract(RValue<Int4> x, int i)
4876 {
Nicolas Capense95d5342016-09-30 11:37:28 -04004877 return RValue<Int>(Nucleus::createExtractElement(x.value, Int::getType(), i));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004878 }
4879
4880 RValue<Int4> Insert(RValue<Int4> x, RValue<Int> element, int i)
4881 {
4882 return RValue<Int4>(Nucleus::createInsertElement(x.value, element.value, i));
4883 }
4884
4885 RValue<Int> SignMask(RValue<Int4> x)
4886 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004887 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004888 }
4889
4890 RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select)
4891 {
Nicolas Capense95d5342016-09-30 11:37:28 -04004892 return RValue<Int4>(createSwizzle4(x.value, select));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004893 }
4894
4895 Type *Int4::getType()
4896 {
Nicolas Capens23d99a42016-09-30 14:57:16 -04004897 return T(Ice::IceType_v4i32);
Nicolas Capens598f8d82016-09-26 15:09:10 -04004898 }
4899
4900 UInt4::UInt4(RValue<Float4> cast)
4901 {
4902 // xyzw.parent = this;
4903
4904 assert(false && "UNIMPLEMENTED");
4905 }
4906
4907 UInt4::UInt4()
4908 {
4909 // xyzw.parent = this;
4910 }
4911
4912 UInt4::UInt4(int xyzw)
4913 {
4914 constant(xyzw, xyzw, xyzw, xyzw);
4915 }
4916
4917 UInt4::UInt4(int x, int yzw)
4918 {
4919 constant(x, yzw, yzw, yzw);
4920 }
4921
4922 UInt4::UInt4(int x, int y, int zw)
4923 {
4924 constant(x, y, zw, zw);
4925 }
4926
4927 UInt4::UInt4(int x, int y, int z, int w)
4928 {
4929 constant(x, y, z, w);
4930 }
4931
4932 void UInt4::constant(int x, int y, int z, int w)
4933 {
4934 // xyzw.parent = this;
4935
4936 Constant *constantVector[4];
4937 constantVector[0] = Nucleus::createConstantInt(x);
4938 constantVector[1] = Nucleus::createConstantInt(y);
4939 constantVector[2] = Nucleus::createConstantInt(z);
4940 constantVector[3] = Nucleus::createConstantInt(w);
4941
4942 storeValue(Nucleus::createConstantVector(constantVector, 4));
4943 }
4944
4945 UInt4::UInt4(RValue<UInt4> rhs)
4946 {
4947 // xyzw.parent = this;
4948
4949 storeValue(rhs.value);
4950 }
4951
4952 UInt4::UInt4(const UInt4 &rhs)
4953 {
4954 // xyzw.parent = this;
4955
4956 Value *value = rhs.loadValue();
4957 storeValue(value);
4958 }
4959
4960 UInt4::UInt4(const Reference<UInt4> &rhs)
4961 {
4962 // xyzw.parent = this;
4963
4964 Value *value = rhs.loadValue();
4965 storeValue(value);
4966 }
4967
4968 UInt4::UInt4(RValue<Int4> rhs)
4969 {
4970 // xyzw.parent = this;
4971
4972 storeValue(rhs.value);
4973 }
4974
4975 UInt4::UInt4(const Int4 &rhs)
4976 {
4977 // xyzw.parent = this;
4978
4979 Value *value = rhs.loadValue();
4980 storeValue(value);
4981 }
4982
4983 UInt4::UInt4(const Reference<Int4> &rhs)
4984 {
4985 // xyzw.parent = this;
4986
4987 Value *value = rhs.loadValue();
4988 storeValue(value);
4989 }
4990
4991 UInt4::UInt4(RValue<UInt2> lo, RValue<UInt2> hi)
4992 {
4993 assert(false && "UNIMPLEMENTED");
4994 }
4995
4996 RValue<UInt4> UInt4::operator=(RValue<UInt4> rhs) const
4997 {
4998 storeValue(rhs.value);
4999
5000 return rhs;
5001 }
5002
5003 RValue<UInt4> UInt4::operator=(const UInt4 &rhs) const
5004 {
5005 Value *value = rhs.loadValue();
5006 storeValue(value);
5007
5008 return RValue<UInt4>(value);
5009 }
5010
5011 RValue<UInt4> UInt4::operator=(const Reference<UInt4> &rhs) const
5012 {
5013 Value *value = rhs.loadValue();
5014 storeValue(value);
5015
5016 return RValue<UInt4>(value);
5017 }
5018
5019 RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs)
5020 {
5021 return RValue<UInt4>(Nucleus::createAdd(lhs.value, rhs.value));
5022 }
5023
5024 RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs)
5025 {
5026 return RValue<UInt4>(Nucleus::createSub(lhs.value, rhs.value));
5027 }
5028
5029 RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs)
5030 {
5031 return RValue<UInt4>(Nucleus::createMul(lhs.value, rhs.value));
5032 }
5033
5034 RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs)
5035 {
5036 return RValue<UInt4>(Nucleus::createUDiv(lhs.value, rhs.value));
5037 }
5038
5039 RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs)
5040 {
5041 return RValue<UInt4>(Nucleus::createURem(lhs.value, rhs.value));
5042 }
5043
5044 RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs)
5045 {
5046 return RValue<UInt4>(Nucleus::createAnd(lhs.value, rhs.value));
5047 }
5048
5049 RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs)
5050 {
5051 return RValue<UInt4>(Nucleus::createOr(lhs.value, rhs.value));
5052 }
5053
5054 RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs)
5055 {
5056 return RValue<UInt4>(Nucleus::createXor(lhs.value, rhs.value));
5057 }
5058
5059 RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs)
5060 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005061 assert(false && "UNIMPLEMENTED"); return RValue<UInt4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005062 }
5063
5064 RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs)
5065 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005066 assert(false && "UNIMPLEMENTED"); return RValue<UInt4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005067 }
5068
5069 RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs)
5070 {
5071 return RValue<UInt4>(Nucleus::createShl(lhs.value, rhs.value));
5072 }
5073
5074 RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs)
5075 {
5076 return RValue<UInt4>(Nucleus::createLShr(lhs.value, rhs.value));
5077 }
5078
5079 RValue<UInt4> operator+=(const UInt4 &lhs, RValue<UInt4> rhs)
5080 {
5081 return lhs = lhs + rhs;
5082 }
5083
5084 RValue<UInt4> operator-=(const UInt4 &lhs, RValue<UInt4> rhs)
5085 {
5086 return lhs = lhs - rhs;
5087 }
5088
5089 RValue<UInt4> operator*=(const UInt4 &lhs, RValue<UInt4> rhs)
5090 {
5091 return lhs = lhs * rhs;
5092 }
5093
5094// RValue<UInt4> operator/=(const UInt4 &lhs, RValue<UInt4> rhs)
5095// {
5096// return lhs = lhs / rhs;
5097// }
5098
5099// RValue<UInt4> operator%=(const UInt4 &lhs, RValue<UInt4> rhs)
5100// {
5101// return lhs = lhs % rhs;
5102// }
5103
5104 RValue<UInt4> operator&=(const UInt4 &lhs, RValue<UInt4> rhs)
5105 {
5106 return lhs = lhs & rhs;
5107 }
5108
5109 RValue<UInt4> operator|=(const UInt4 &lhs, RValue<UInt4> rhs)
5110 {
5111 return lhs = lhs | rhs;
5112 }
5113
5114 RValue<UInt4> operator^=(const UInt4 &lhs, RValue<UInt4> rhs)
5115 {
5116 return lhs = lhs ^ rhs;
5117 }
5118
5119 RValue<UInt4> operator<<=(const UInt4 &lhs, unsigned char rhs)
5120 {
5121 return lhs = lhs << rhs;
5122 }
5123
5124 RValue<UInt4> operator>>=(const UInt4 &lhs, unsigned char rhs)
5125 {
5126 return lhs = lhs >> rhs;
5127 }
5128
5129 RValue<UInt4> operator+(RValue<UInt4> val)
5130 {
5131 return val;
5132 }
5133
5134 RValue<UInt4> operator-(RValue<UInt4> val)
5135 {
5136 return RValue<UInt4>(Nucleus::createNeg(val.value));
5137 }
5138
5139 RValue<UInt4> operator~(RValue<UInt4> val)
5140 {
5141 return RValue<UInt4>(Nucleus::createNot(val.value));
5142 }
5143
5144 RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y)
5145 {
5146 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpEQ(x.value, y.value), Int4::getType()));
5147 }
5148
5149 RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y)
5150 {
5151 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpULT(x.value, y.value), Int4::getType()));
5152 }
5153
5154 RValue<UInt4> CmpLE(RValue<UInt4> x, RValue<UInt4> y)
5155 {
5156 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpULE(x.value, y.value), Int4::getType()));
5157 }
5158
5159 RValue<UInt4> CmpNEQ(RValue<UInt4> x, RValue<UInt4> y)
5160 {
5161 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpNE(x.value, y.value), Int4::getType()));
5162 }
5163
5164 RValue<UInt4> CmpNLT(RValue<UInt4> x, RValue<UInt4> y)
5165 {
5166 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpUGE(x.value, y.value), Int4::getType()));
5167 }
5168
5169 RValue<UInt4> CmpNLE(RValue<UInt4> x, RValue<UInt4> y)
5170 {
5171 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpUGT(x.value, y.value), Int4::getType()));
5172 }
5173
5174 RValue<UInt4> Max(RValue<UInt4> x, RValue<UInt4> y)
5175 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005176 assert(false && "UNIMPLEMENTED"); return RValue<UInt4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005177 }
5178
5179 RValue<UInt4> Min(RValue<UInt4> x, RValue<UInt4> y)
5180 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005181 assert(false && "UNIMPLEMENTED"); return RValue<UInt4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005182 }
5183
5184 RValue<UShort8> Pack(RValue<UInt4> x, RValue<UInt4> y)
5185 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005186 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005187 }
5188
5189 Type *UInt4::getType()
5190 {
5191 assert(false && "UNIMPLEMENTED"); return nullptr;
5192 }
5193
5194 Float::Float(RValue<Int> cast)
5195 {
5196 Value *integer = Nucleus::createSIToFP(cast.value, Float::getType());
5197
5198 storeValue(integer);
5199 }
5200
5201 Float::Float()
5202 {
5203 }
5204
5205 Float::Float(float x)
5206 {
5207 storeValue(Nucleus::createConstantFloat(x));
5208 }
5209
5210 Float::Float(RValue<Float> rhs)
5211 {
5212 storeValue(rhs.value);
5213 }
5214
5215 Float::Float(const Float &rhs)
5216 {
5217 Value *value = rhs.loadValue();
5218 storeValue(value);
5219 }
5220
5221 Float::Float(const Reference<Float> &rhs)
5222 {
5223 Value *value = rhs.loadValue();
5224 storeValue(value);
5225 }
5226
5227 RValue<Float> Float::operator=(RValue<Float> rhs) const
5228 {
5229 storeValue(rhs.value);
5230
5231 return rhs;
5232 }
5233
5234 RValue<Float> Float::operator=(const Float &rhs) const
5235 {
5236 Value *value = rhs.loadValue();
5237 storeValue(value);
5238
5239 return RValue<Float>(value);
5240 }
5241
5242 RValue<Float> Float::operator=(const Reference<Float> &rhs) const
5243 {
5244 Value *value = rhs.loadValue();
5245 storeValue(value);
5246
5247 return RValue<Float>(value);
5248 }
5249
5250 RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs)
5251 {
5252 return RValue<Float>(Nucleus::createFAdd(lhs.value, rhs.value));
5253 }
5254
5255 RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs)
5256 {
5257 return RValue<Float>(Nucleus::createFSub(lhs.value, rhs.value));
5258 }
5259
5260 RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs)
5261 {
5262 return RValue<Float>(Nucleus::createFMul(lhs.value, rhs.value));
5263 }
5264
5265 RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs)
5266 {
5267 return RValue<Float>(Nucleus::createFDiv(lhs.value, rhs.value));
5268 }
5269
5270 RValue<Float> operator+=(const Float &lhs, RValue<Float> rhs)
5271 {
5272 return lhs = lhs + rhs;
5273 }
5274
5275 RValue<Float> operator-=(const Float &lhs, RValue<Float> rhs)
5276 {
5277 return lhs = lhs - rhs;
5278 }
5279
5280 RValue<Float> operator*=(const Float &lhs, RValue<Float> rhs)
5281 {
5282 return lhs = lhs * rhs;
5283 }
5284
5285 RValue<Float> operator/=(const Float &lhs, RValue<Float> rhs)
5286 {
5287 return lhs = lhs / rhs;
5288 }
5289
5290 RValue<Float> operator+(RValue<Float> val)
5291 {
5292 return val;
5293 }
5294
5295 RValue<Float> operator-(RValue<Float> val)
5296 {
5297 return RValue<Float>(Nucleus::createFNeg(val.value));
5298 }
5299
5300 RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs)
5301 {
5302 return RValue<Bool>(Nucleus::createFCmpOLT(lhs.value, rhs.value));
5303 }
5304
5305 RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs)
5306 {
5307 return RValue<Bool>(Nucleus::createFCmpOLE(lhs.value, rhs.value));
5308 }
5309
5310 RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs)
5311 {
5312 return RValue<Bool>(Nucleus::createFCmpOGT(lhs.value, rhs.value));
5313 }
5314
5315 RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs)
5316 {
5317 return RValue<Bool>(Nucleus::createFCmpOGE(lhs.value, rhs.value));
5318 }
5319
5320 RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs)
5321 {
5322 return RValue<Bool>(Nucleus::createFCmpONE(lhs.value, rhs.value));
5323 }
5324
5325 RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs)
5326 {
5327 return RValue<Bool>(Nucleus::createFCmpOEQ(lhs.value, rhs.value));
5328 }
5329
5330 RValue<Float> Abs(RValue<Float> x)
5331 {
5332 return IfThenElse(x > 0.0f, x, -x);
5333 }
5334
5335 RValue<Float> Max(RValue<Float> x, RValue<Float> y)
5336 {
5337 return IfThenElse(x > y, x, y);
5338 }
5339
5340 RValue<Float> Min(RValue<Float> x, RValue<Float> y)
5341 {
5342 return IfThenElse(x < y, x, y);
5343 }
5344
5345 RValue<Float> Rcp_pp(RValue<Float> x, bool exactAtPow2)
5346 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005347 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005348 }
5349
5350 RValue<Float> RcpSqrt_pp(RValue<Float> x)
5351 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005352 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005353 }
5354
5355 RValue<Float> Sqrt(RValue<Float> x)
5356 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005357 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005358 }
5359
5360 RValue<Float> Round(RValue<Float> x)
5361 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005362 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005363 }
5364
5365 RValue<Float> Trunc(RValue<Float> x)
5366 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005367 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005368 }
5369
5370 RValue<Float> Frac(RValue<Float> x)
5371 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005372 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005373 }
5374
5375 RValue<Float> Floor(RValue<Float> x)
5376 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005377 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005378 }
5379
5380 RValue<Float> Ceil(RValue<Float> x)
5381 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005382 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005383 }
5384
5385 Type *Float::getType()
5386 {
Nicolas Capens9709d4f2016-09-30 11:44:14 -04005387 return T(Ice::IceType_f32);
Nicolas Capens598f8d82016-09-26 15:09:10 -04005388 }
5389
5390 Float2::Float2(RValue<Float4> cast)
5391 {
5392 // xyzw.parent = this;
5393
5394 Value *int64x2 = Nucleus::createBitCast(cast.value, Long2::getType());
Nicolas Capense95d5342016-09-30 11:37:28 -04005395 Value *int64 = Nucleus::createExtractElement(int64x2, Long::getType(), 0);
Nicolas Capens598f8d82016-09-26 15:09:10 -04005396 Value *float2 = Nucleus::createBitCast(int64, Float2::getType());
5397
5398 storeValue(float2);
5399 }
5400
5401 Type *Float2::getType()
5402 {
5403 assert(false && "UNIMPLEMENTED"); return nullptr;
5404 }
5405
5406 Float4::Float4(RValue<Byte4> cast)
5407 {
5408 xyzw.parent = this;
5409
5410 assert(false && "UNIMPLEMENTED");
5411 }
5412
5413 Float4::Float4(RValue<SByte4> cast)
5414 {
5415 xyzw.parent = this;
5416
5417 assert(false && "UNIMPLEMENTED");
5418 }
5419
5420 Float4::Float4(RValue<Short4> cast)
5421 {
5422 xyzw.parent = this;
5423
5424 Int4 c(cast);
5425 storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
5426 }
5427
5428 Float4::Float4(RValue<UShort4> cast)
5429 {
5430 xyzw.parent = this;
5431
5432 Int4 c(cast);
5433 storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
5434 }
5435
5436 Float4::Float4(RValue<Int4> cast)
5437 {
5438 xyzw.parent = this;
5439
5440 Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType());
5441
5442 storeValue(xyzw);
5443 }
5444
5445 Float4::Float4(RValue<UInt4> cast)
5446 {
5447 xyzw.parent = this;
5448
5449 Value *xyzw = Nucleus::createUIToFP(cast.value, Float4::getType());
5450
5451 storeValue(xyzw);
5452 }
5453
5454 Float4::Float4()
5455 {
5456 xyzw.parent = this;
5457 }
5458
5459 Float4::Float4(float xyzw)
5460 {
5461 constant(xyzw, xyzw, xyzw, xyzw);
5462 }
5463
5464 Float4::Float4(float x, float yzw)
5465 {
5466 constant(x, yzw, yzw, yzw);
5467 }
5468
5469 Float4::Float4(float x, float y, float zw)
5470 {
5471 constant(x, y, zw, zw);
5472 }
5473
5474 Float4::Float4(float x, float y, float z, float w)
5475 {
5476 constant(x, y, z, w);
5477 }
5478
5479 void Float4::constant(float x, float y, float z, float w)
5480 {
5481 xyzw.parent = this;
5482
5483 Constant *constantVector[4];
5484 constantVector[0] = Nucleus::createConstantFloat(x);
5485 constantVector[1] = Nucleus::createConstantFloat(y);
5486 constantVector[2] = Nucleus::createConstantFloat(z);
5487 constantVector[3] = Nucleus::createConstantFloat(w);
5488
5489 storeValue(Nucleus::createConstantVector(constantVector, 4));
5490 }
5491
5492 Float4::Float4(RValue<Float4> rhs)
5493 {
5494 xyzw.parent = this;
5495
5496 storeValue(rhs.value);
5497 }
5498
5499 Float4::Float4(const Float4 &rhs)
5500 {
5501 xyzw.parent = this;
5502
5503 Value *value = rhs.loadValue();
5504 storeValue(value);
5505 }
5506
5507 Float4::Float4(const Reference<Float4> &rhs)
5508 {
5509 xyzw.parent = this;
5510
5511 Value *value = rhs.loadValue();
5512 storeValue(value);
5513 }
5514
5515 Float4::Float4(RValue<Float> rhs)
5516 {
5517 xyzw.parent = this;
5518
5519 assert(false && "UNIMPLEMENTED");
5520 }
5521
5522 Float4::Float4(const Float &rhs)
5523 {
5524 xyzw.parent = this;
5525
5526 *this = RValue<Float>(rhs.loadValue());
5527 }
5528
5529 Float4::Float4(const Reference<Float> &rhs)
5530 {
5531 xyzw.parent = this;
5532
5533 *this = RValue<Float>(rhs.loadValue());
5534 }
5535
5536 RValue<Float4> Float4::operator=(float x) const
5537 {
5538 return *this = Float4(x, x, x, x);
5539 }
5540
5541 RValue<Float4> Float4::operator=(RValue<Float4> rhs) const
5542 {
5543 storeValue(rhs.value);
5544
5545 return rhs;
5546 }
5547
5548 RValue<Float4> Float4::operator=(const Float4 &rhs) const
5549 {
5550 Value *value = rhs.loadValue();
5551 storeValue(value);
5552
5553 return RValue<Float4>(value);
5554 }
5555
5556 RValue<Float4> Float4::operator=(const Reference<Float4> &rhs) const
5557 {
5558 Value *value = rhs.loadValue();
5559 storeValue(value);
5560
5561 return RValue<Float4>(value);
5562 }
5563
5564 RValue<Float4> Float4::operator=(RValue<Float> rhs) const
5565 {
5566 return *this = Float4(rhs);
5567 }
5568
5569 RValue<Float4> Float4::operator=(const Float &rhs) const
5570 {
5571 return *this = Float4(rhs);
5572 }
5573
5574 RValue<Float4> Float4::operator=(const Reference<Float> &rhs) const
5575 {
5576 return *this = Float4(rhs);
5577 }
5578
5579 RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs)
5580 {
5581 return RValue<Float4>(Nucleus::createFAdd(lhs.value, rhs.value));
5582 }
5583
5584 RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs)
5585 {
5586 return RValue<Float4>(Nucleus::createFSub(lhs.value, rhs.value));
5587 }
5588
5589 RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs)
5590 {
5591 return RValue<Float4>(Nucleus::createFMul(lhs.value, rhs.value));
5592 }
5593
5594 RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs)
5595 {
5596 return RValue<Float4>(Nucleus::createFDiv(lhs.value, rhs.value));
5597 }
5598
5599 RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs)
5600 {
5601 return RValue<Float4>(Nucleus::createFRem(lhs.value, rhs.value));
5602 }
5603
5604 RValue<Float4> operator+=(const Float4 &lhs, RValue<Float4> rhs)
5605 {
5606 return lhs = lhs + rhs;
5607 }
5608
5609 RValue<Float4> operator-=(const Float4 &lhs, RValue<Float4> rhs)
5610 {
5611 return lhs = lhs - rhs;
5612 }
5613
5614 RValue<Float4> operator*=(const Float4 &lhs, RValue<Float4> rhs)
5615 {
5616 return lhs = lhs * rhs;
5617 }
5618
5619 RValue<Float4> operator/=(const Float4 &lhs, RValue<Float4> rhs)
5620 {
5621 return lhs = lhs / rhs;
5622 }
5623
5624 RValue<Float4> operator%=(const Float4 &lhs, RValue<Float4> rhs)
5625 {
5626 return lhs = lhs % rhs;
5627 }
5628
5629 RValue<Float4> operator+(RValue<Float4> val)
5630 {
5631 return val;
5632 }
5633
5634 RValue<Float4> operator-(RValue<Float4> val)
5635 {
5636 return RValue<Float4>(Nucleus::createFNeg(val.value));
5637 }
5638
5639 RValue<Float4> Abs(RValue<Float4> x)
5640 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005641 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005642 }
5643
5644 RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y)
5645 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005646 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005647 }
5648
5649 RValue<Float4> Min(RValue<Float4> x, RValue<Float4> y)
5650 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005651 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005652 }
5653
5654 RValue<Float4> Rcp_pp(RValue<Float4> x, bool exactAtPow2)
5655 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005656 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005657 }
5658
5659 RValue<Float4> RcpSqrt_pp(RValue<Float4> x)
5660 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005661 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005662 }
5663
5664 RValue<Float4> Sqrt(RValue<Float4> x)
5665 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005666 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005667 }
5668
5669 RValue<Float4> Insert(const Float4 &val, RValue<Float> element, int i)
5670 {
5671 Value *value = val.loadValue();
5672 Value *insert = Nucleus::createInsertElement(value, element.value, i);
5673
5674 val = RValue<Float4>(insert);
5675
5676 return val;
5677 }
5678
5679 RValue<Float> Extract(RValue<Float4> x, int i)
5680 {
Nicolas Capense95d5342016-09-30 11:37:28 -04005681 return RValue<Float>(Nucleus::createExtractElement(x.value, Float::getType(), i));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005682 }
5683
5684 RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select)
5685 {
Nicolas Capense95d5342016-09-30 11:37:28 -04005686 return RValue<Float4>(createSwizzle4(x.value, select));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005687 }
5688
5689 RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm)
5690 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005691 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005692 }
5693
5694 RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y)
5695 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005696 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005697 }
5698
5699 RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y)
5700 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005701 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005702 }
5703
5704 RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select)
5705 {
5706 Value *vector = lhs.loadValue();
Nicolas Capense95d5342016-09-30 11:37:28 -04005707 Value *shuffle = createMask4(vector, rhs.value, select);
Nicolas Capens598f8d82016-09-26 15:09:10 -04005708 lhs.storeValue(shuffle);
5709
5710 return RValue<Float4>(shuffle);
5711 }
5712
5713 RValue<Int> SignMask(RValue<Float4> x)
5714 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005715 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005716 }
5717
5718 RValue<Int4> CmpEQ(RValue<Float4> x, RValue<Float4> y)
5719 {
5720 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOEQ(x.value, y.value), Int4::getType()));
5721 }
5722
5723 RValue<Int4> CmpLT(RValue<Float4> x, RValue<Float4> y)
5724 {
5725 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOLT(x.value, y.value), Int4::getType()));
5726 }
5727
5728 RValue<Int4> CmpLE(RValue<Float4> x, RValue<Float4> y)
5729 {
5730 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOLE(x.value, y.value), Int4::getType()));
5731 }
5732
5733 RValue<Int4> CmpNEQ(RValue<Float4> x, RValue<Float4> y)
5734 {
5735 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpONE(x.value, y.value), Int4::getType()));
5736 }
5737
5738 RValue<Int4> CmpNLT(RValue<Float4> x, RValue<Float4> y)
5739 {
5740 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOGE(x.value, y.value), Int4::getType()));
5741 }
5742
5743 RValue<Int4> CmpNLE(RValue<Float4> x, RValue<Float4> y)
5744 {
5745 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOGT(x.value, y.value), Int4::getType()));
5746 }
5747
5748 RValue<Float4> Round(RValue<Float4> x)
5749 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005750 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005751 }
5752
5753 RValue<Float4> Trunc(RValue<Float4> x)
5754 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005755 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005756 }
5757
5758 RValue<Float4> Frac(RValue<Float4> x)
5759 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005760 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005761 }
5762
5763 RValue<Float4> Floor(RValue<Float4> x)
5764 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005765 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005766 }
5767
5768 RValue<Float4> Ceil(RValue<Float4> x)
5769 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005770 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005771 }
5772
5773 Type *Float4::getType()
5774 {
Nicolas Capens9709d4f2016-09-30 11:44:14 -04005775 return T(Ice::IceType_v4f32);
Nicolas Capens598f8d82016-09-26 15:09:10 -04005776 }
5777
5778 RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset)
5779 {
Nicolas Capens8820f642016-09-30 04:42:43 -04005780 return lhs + RValue<Int>(Nucleus::createConstantInt(offset));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005781 }
5782
5783 RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
5784 {
Nicolas Capens6d738712016-09-30 04:15:22 -04005785 return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005786 }
5787
5788 RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
5789 {
Nicolas Capens6d738712016-09-30 04:15:22 -04005790 return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, Byte::getType(), offset.value));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005791 }
5792
5793 RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, int offset)
5794 {
5795 return lhs = lhs + offset;
5796 }
5797
5798 RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, RValue<Int> offset)
5799 {
5800 return lhs = lhs + offset;
5801 }
5802
5803 RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, RValue<UInt> offset)
5804 {
5805 return lhs = lhs + offset;
5806 }
5807
5808 RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset)
5809 {
5810 return lhs + -offset;
5811 }
5812
5813 RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
5814 {
5815 return lhs + -offset;
5816 }
5817
5818 RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
5819 {
5820 return lhs + -offset;
5821 }
5822
5823 RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, int offset)
5824 {
5825 return lhs = lhs - offset;
5826 }
5827
5828 RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, RValue<Int> offset)
5829 {
5830 return lhs = lhs - offset;
5831 }
5832
5833 RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, RValue<UInt> offset)
5834 {
5835 return lhs = lhs - offset;
5836 }
5837
5838 void Return()
5839 {
5840 Nucleus::createRetVoid();
5841 Nucleus::setInsertBlock(Nucleus::createBasicBlock());
5842 Nucleus::createUnreachable();
5843 }
5844
5845 void Return(bool ret)
5846 {
5847 Ice::Operand *Ret = Ice::ConstantInteger32::create(::context, Ice::IceType_i32, ret ? 1 : 0);
5848 Ice::InstRet *retu = Ice::InstRet::create(::function, Ret);
5849 ::basicBlock->appendInst(retu);
5850 }
5851
5852 void Return(const Int &ret)
5853 {
5854 Ice::InstRet *retu = Ice::InstRet::create(::function, ret.loadValue());
5855 ::basicBlock->appendInst(retu);
5856 }
5857
5858 BasicBlock *beginLoop()
5859 {
5860 BasicBlock *loopBB = Nucleus::createBasicBlock();
5861
5862 Nucleus::createBr(loopBB);
5863 Nucleus::setInsertBlock(loopBB);
5864
5865 return loopBB;
5866 }
5867
5868 bool branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB)
5869 {
5870 Nucleus::createCondBr(cmp.value, bodyBB, endBB);
5871 Nucleus::setInsertBlock(bodyBB);
5872
5873 return true;
5874 }
5875
5876 bool elseBlock(BasicBlock *falseBB)
5877 {
5878 Nucleus::setInsertBlock(falseBB);
5879
5880 return true;
5881 }
5882
5883 RValue<Long> Ticks()
5884 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005885 assert(false && "UNIMPLEMENTED"); return RValue<Long>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005886 }
5887}
5888