blob: 594f748a1bc955e1af00013b802361c47971a018 [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{
55 class Value : public Ice::Variable {};
Nicolas Capensb955d5b2016-09-28 22:36:28 -040056 class Constant : public Ice::Constant {};
Nicolas Capens598f8d82016-09-26 15:09:10 -040057 class BasicBlock : public Ice::CfgNode {};
58
59 Ice::Type T(Type *t)
60 {
61 return (Ice::Type)reinterpret_cast<std::intptr_t>(t);
62 }
63
64 Type *T(Ice::Type t)
65 {
66 return reinterpret_cast<Type*>(t);
67 }
68
69 Value *V(Ice::Variable *v)
70 {
71 return reinterpret_cast<Value*>(v);
72 }
73
Nicolas Capensb955d5b2016-09-28 22:36:28 -040074 Constant *C(Ice::Constant *c)
75 {
76 return reinterpret_cast<Constant*>(c);
77 }
78
Nicolas Capens598f8d82016-09-26 15:09:10 -040079 Optimization optimization[10] = {InstructionCombining, Disabled};
80
81 void *loadImage(uint8_t *const elfImage)
82 {
83 using ElfHeader = std::conditional<sizeof(void*) == 8, Elf64_Ehdr, Elf32_Ehdr>::type;
84 ElfHeader *elfHeader = (ElfHeader*)elfImage;
85
86 if(!elfHeader->checkMagic())
87 {
88 return nullptr;
89 }
90
91 using SectionHeader = std::conditional<sizeof(void*) == 8, Elf64_Shdr, Elf32_Shdr>::type;
92 SectionHeader *sectionHeader = (SectionHeader*)(elfImage + elfHeader->e_shoff);
93 void *entry = nullptr;
94
95 for(int i = 0; i < elfHeader->e_shnum; i++)
96 {
97 if(sectionHeader[i].sh_type == SHT_PROGBITS && sectionHeader[i].sh_flags & SHF_EXECINSTR)
98 {
99 entry = elfImage + sectionHeader[i].sh_offset;
100 }
101 }
102
103 return entry;
104 }
105
106 template<typename T>
107 struct ExecutableAllocator
108 {
109 ExecutableAllocator() {};
110 template<class U> ExecutableAllocator(const ExecutableAllocator<U> &other) {};
111
112 using value_type = T;
113 using size_type = std::size_t;
114
115 T *allocate(size_type n)
116 {
117 return (T*)VirtualAlloc(NULL, sizeof(T) * n, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
118 }
119
120 void deallocate(T *p, size_type n)
121 {
122 VirtualFree(p, 0, MEM_RELEASE);
123 }
124 };
125
126 class ELFMemoryStreamer : public Ice::ELFStreamer, public Routine
127 {
128 ELFMemoryStreamer(const ELFMemoryStreamer &) = delete;
129 ELFMemoryStreamer &operator=(const ELFMemoryStreamer &) = delete;
130
131 public:
132 ELFMemoryStreamer() : Routine()
133 {
134 position = 0;
135 buffer.reserve(0x1000);
136 }
137
138 virtual ~ELFMemoryStreamer()
139 {
140 if(buffer.size() != 0)
141 {
142 DWORD exeProtection;
143 VirtualProtect(&buffer[0], buffer.size(), oldProtection, &exeProtection);
144 }
145 }
146
147 void write8(uint8_t Value) override
148 {
149 if(position == (uint64_t)buffer.size())
150 {
151 buffer.push_back(Value);
152 position++;
153 }
154 else if(position < (uint64_t)buffer.size())
155 {
156 buffer[position] = Value;
157 position++;
158 }
159 else assert(false && "UNIMPLEMENTED");
160 }
161
162 void writeBytes(llvm::StringRef Bytes) override
163 {
164 std::size_t oldSize = buffer.size();
165 buffer.resize(oldSize + Bytes.size());
166 memcpy(&buffer[oldSize], Bytes.begin(), Bytes.size());
167 position += Bytes.size();
168 }
169
170 uint64_t tell() const override { return position; }
171
172 void seek(uint64_t Off) override { position = Off; }
173
174 const void *getEntry() override
175 {
176 VirtualProtect(&buffer[0], buffer.size(), PAGE_EXECUTE_READ, &oldProtection);
177 position = std::numeric_limits<std::size_t>::max(); // Can't write more data after this
178
179 return loadImage(&buffer[0]);
180 }
181
182 private:
183 std::vector<uint8_t, ExecutableAllocator<uint8_t>> buffer;
184 std::size_t position;
185 DWORD oldProtection;
186 };
187
188 Nucleus::Nucleus()
189 {
190 ::codegenMutex.lock(); // Reactor is currently not thread safe
191
192 Ice::ClFlags::Flags.setTargetArch(sizeof(void*) == 8 ? Ice::Target_X8664 : Ice::Target_X8632);
193 Ice::ClFlags::Flags.setOutFileType(Ice::FT_Elf);
194 Ice::ClFlags::Flags.setOptLevel(Ice::Opt_2);
195 Ice::ClFlags::Flags.setApplicationBinaryInterface(Ice::ABI_Platform);
196
197 std::unique_ptr<Ice::Ostream> cout(new llvm::raw_os_ostream(std::cout));
198
199 if(false) // Write out to a file
200 {
201 std::error_code errorCode;
202 ::out = new Ice::Fdstream("out.o", errorCode, llvm::sys::fs::F_None);
203 ::elfFile = new Ice::ELFFileStreamer(*out);
204 ::context = new Ice::GlobalContext(cout.get(), cout.get(), cout.get(), elfFile);
205 }
206 else
207 {
208 ELFMemoryStreamer *elfMemory = new ELFMemoryStreamer();
209 ::context = new Ice::GlobalContext(cout.get(), cout.get(), cout.get(), elfMemory);
210 ::routine = elfMemory;
211 }
212 }
213
214 Nucleus::~Nucleus()
215 {
216 delete ::allocator;
217 delete ::function;
218 delete ::context;
219
220 delete ::elfFile;
221 delete ::out;
222
223 ::codegenMutex.unlock();
224 }
225
226 Routine *Nucleus::acquireRoutine(const wchar_t *name, bool runOptimizations)
227 {
228 if(basicBlock->getInsts().empty() || basicBlock->getInsts().back().getKind() != Ice::Inst::Ret)
229 {
230 createRetVoid();
231 }
232
233 std::wstring wideName(name);
234 std::string asciiName(wideName.begin(), wideName.end());
235 ::function->setFunctionName(Ice::GlobalString::createWithString(::context, asciiName));
236
237 ::function->translate();
238
239 ::context->emitFileHeader();
240 ::function->emitIAS();
241 auto assembler = ::function->releaseAssembler();
242 ::context->getObjectWriter()->writeFunctionCode(::function->getFunctionName(), false, assembler.get());
243 ::context->getObjectWriter()->writeNonUserSections();
244
245 return ::routine;
246 }
247
248 void Nucleus::optimize()
249 {
250 }
251
252 Value *Nucleus::allocateStackVariable(Type *t, int arraySize)
253 {
Nicolas Capense12780d2016-09-27 14:18:07 -0400254 assert(arraySize == 0 && "UNIMPLEMENTED");
255
Nicolas Capens598f8d82016-09-26 15:09:10 -0400256 Ice::Type type = T(t);
Nicolas Capense12780d2016-09-27 14:18:07 -0400257
258 int32_t size = 0;
259 switch(type)
260 {
261 case Ice::IceType_i32: size = 4; break;
262 case Ice::IceType_i64: size = 8; break;
263 default: assert(false && "UNIMPLEMENTED" && type);
264 }
265
266 auto bytes = Ice::ConstantInteger32::create(::context, type, size);
267 auto address = ::function->makeVariable(T(getPointerType(t)));
268 auto alloca = Ice::InstAlloca::create(::function, address, bytes, size);
269 ::function->getEntryNode()->getInsts().push_front(alloca);
270
271 return V(address);
Nicolas Capens598f8d82016-09-26 15:09:10 -0400272 }
273
274 BasicBlock *Nucleus::createBasicBlock()
275 {
276 assert(false && "UNIMPLEMENTED"); return nullptr;
277 }
278
279 BasicBlock *Nucleus::getInsertBlock()
280 {
281 assert(false && "UNIMPLEMENTED"); return nullptr;
282 }
283
284 void Nucleus::setInsertBlock(BasicBlock *basicBlock)
285 {
286 assert(!basicBlock->getInsts().back().getTerminatorEdges().empty() && "Previous basic block must have a terminator");
287 assert(false && "UNIMPLEMENTED"); return;
288 }
289
290 BasicBlock *Nucleus::getPredecessor(BasicBlock *basicBlock)
291 {
292 assert(false && "UNIMPLEMENTED"); return nullptr;
293 }
294
295 void Nucleus::createFunction(Type *ReturnType, std::vector<Type*> &Params)
296 {
297 uint32_t sequenceNumber = 0;
298 ::function = Ice::Cfg::create(::context, sequenceNumber).release();
299 ::allocator = new Ice::CfgLocalAllocatorScope(::function);
300
301 for(Type *type : Params)
302 {
303 Ice::Variable *arg = ::function->makeVariable(T(type));
304 ::function->addArg(arg);
305 }
306
307 Ice::CfgNode *node = ::function->makeNode();
308 ::function->setEntryNode(node);
309 ::basicBlock = node;
310 }
311
312 Value *Nucleus::getArgument(unsigned int index)
313 {
314 return V(::function->getArgs()[index]);
315 }
316
317 void Nucleus::createRetVoid()
318 {
319 assert(false && "UNIMPLEMENTED");
320 }
321
322 void Nucleus::createRet(Value *v)
323 {
324 assert(false && "UNIMPLEMENTED");
325 }
326
327 void Nucleus::createBr(BasicBlock *dest)
328 {
329 assert(false && "UNIMPLEMENTED");
330 }
331
332 void Nucleus::createCondBr(Value *cond, BasicBlock *ifTrue, BasicBlock *ifFalse)
333 {
334 assert(false && "UNIMPLEMENTED");
335 }
336
337 Value *Nucleus::createAdd(Value *lhs, Value *rhs)
338 {
339 Ice::Variable *sum = ::function->makeVariable(Ice::IceType_i32);
340 Ice::InstArithmetic *add = Ice::InstArithmetic::create(::function, Ice::InstArithmetic::Add, sum, lhs, rhs);
341 ::basicBlock->appendInst(add);
342 return V(sum);
343 }
344
345 Value *Nucleus::createSub(Value *lhs, Value *rhs)
346 {
347 assert(false && "UNIMPLEMENTED"); return nullptr;
348 }
349
350 Value *Nucleus::createMul(Value *lhs, Value *rhs)
351 {
352 assert(false && "UNIMPLEMENTED"); return nullptr;
353 }
354
355 Value *Nucleus::createUDiv(Value *lhs, Value *rhs)
356 {
357 assert(false && "UNIMPLEMENTED"); return nullptr;
358 }
359
360 Value *Nucleus::createSDiv(Value *lhs, Value *rhs)
361 {
362 assert(false && "UNIMPLEMENTED"); return nullptr;
363 }
364
365 Value *Nucleus::createFAdd(Value *lhs, Value *rhs)
366 {
367 assert(false && "UNIMPLEMENTED"); return nullptr;
368 }
369
370 Value *Nucleus::createFSub(Value *lhs, Value *rhs)
371 {
372 assert(false && "UNIMPLEMENTED"); return nullptr;
373 }
374
375 Value *Nucleus::createFMul(Value *lhs, Value *rhs)
376 {
377 assert(false && "UNIMPLEMENTED"); return nullptr;
378 }
379
380 Value *Nucleus::createFDiv(Value *lhs, Value *rhs)
381 {
382 assert(false && "UNIMPLEMENTED"); return nullptr;
383 }
384
385 Value *Nucleus::createURem(Value *lhs, Value *rhs)
386 {
387 assert(false && "UNIMPLEMENTED"); return nullptr;
388 }
389
390 Value *Nucleus::createSRem(Value *lhs, Value *rhs)
391 {
392 assert(false && "UNIMPLEMENTED"); return nullptr;
393 }
394
395 Value *Nucleus::createFRem(Value *lhs, Value *rhs)
396 {
397 assert(false && "UNIMPLEMENTED"); return nullptr;
398 }
399
400 Value *Nucleus::createShl(Value *lhs, Value *rhs)
401 {
402 assert(false && "UNIMPLEMENTED"); return nullptr;
403 }
404
405 Value *Nucleus::createLShr(Value *lhs, Value *rhs)
406 {
407 assert(false && "UNIMPLEMENTED"); return nullptr;
408 }
409
410 Value *Nucleus::createAShr(Value *lhs, Value *rhs)
411 {
412 assert(false && "UNIMPLEMENTED"); return nullptr;
413 }
414
415 Value *Nucleus::createAnd(Value *lhs, Value *rhs)
416 {
417 assert(false && "UNIMPLEMENTED"); return nullptr;
418 }
419
420 Value *Nucleus::createOr(Value *lhs, Value *rhs)
421 {
422 assert(false && "UNIMPLEMENTED"); return nullptr;
423 }
424
425 Value *Nucleus::createXor(Value *lhs, Value *rhs)
426 {
427 assert(false && "UNIMPLEMENTED"); return nullptr;
428 }
429
Nicolas Capensb955d5b2016-09-28 22:36:28 -0400430 Value *Nucleus::createAssign(Constant *constant)
431 {
432 Ice::Variable *value = ::function->makeVariable(constant->getType());
433 auto assign = Ice::InstAssign::create(::function, value, constant);
434 ::basicBlock->appendInst(assign);
435
436 return V(value);
437 }
438
Nicolas Capens598f8d82016-09-26 15:09:10 -0400439 Value *Nucleus::createNeg(Value *v)
440 {
441 assert(false && "UNIMPLEMENTED"); return nullptr;
442 }
443
444 Value *Nucleus::createFNeg(Value *v)
445 {
446 assert(false && "UNIMPLEMENTED"); return nullptr;
447 }
448
449 Value *Nucleus::createNot(Value *v)
450 {
451 assert(false && "UNIMPLEMENTED"); return nullptr;
452 }
453
Nicolas Capense12780d2016-09-27 14:18:07 -0400454 Value *Nucleus::createLoad(Value *ptr, Type *type, bool isVolatile, unsigned int align)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400455 {
Nicolas Capense12780d2016-09-27 14:18:07 -0400456 Ice::Variable *value = ::function->makeVariable(T(type));
Nicolas Capens598f8d82016-09-26 15:09:10 -0400457 auto load = Ice::InstLoad::create(::function, value, ptr, align);
458 ::basicBlock->appendInst(load);
459 return V(value);
460 }
461
462 Value *Nucleus::createStore(Value *value, Value *ptr, bool isVolatile, unsigned int align)
463 {
464 auto store = Ice::InstStore::create(::function, value, ptr, align);
465 ::basicBlock->appendInst(store);
466 return value;
467 }
468
Nicolas Capensb955d5b2016-09-28 22:36:28 -0400469 Constant *Nucleus::createStore(Constant *constant, Value *ptr, bool isVolatile, unsigned int align)
Nicolas Capens598f8d82016-09-26 15:09:10 -0400470 {
Nicolas Capensb955d5b2016-09-28 22:36:28 -0400471 auto store = Ice::InstStore::create(::function, constant, ptr, align);
472 ::basicBlock->appendInst(store);
473 return constant;
Nicolas Capens598f8d82016-09-26 15:09:10 -0400474 }
475
476 Value *Nucleus::createGEP(Value *ptr, Value *index)
477 {
478 assert(false && "UNIMPLEMENTED"); return nullptr;
479 }
480
481 Value *Nucleus::createAtomicAdd(Value *ptr, Value *value)
482 {
483 assert(false && "UNIMPLEMENTED"); return nullptr;
484 }
485
486 Value *Nucleus::createTrunc(Value *v, Type *destType)
487 {
488 assert(false && "UNIMPLEMENTED"); return nullptr;
489 }
490
491 Value *Nucleus::createZExt(Value *v, Type *destType)
492 {
493 assert(false && "UNIMPLEMENTED"); return nullptr;
494 }
495
496 Value *Nucleus::createSExt(Value *v, Type *destType)
497 {
498 assert(false && "UNIMPLEMENTED"); return nullptr;
499 }
500
501 Value *Nucleus::createFPToSI(Value *v, Type *destType)
502 {
503 assert(false && "UNIMPLEMENTED"); return nullptr;
504 }
505
506 Value *Nucleus::createUIToFP(Value *v, Type *destType)
507 {
508 assert(false && "UNIMPLEMENTED"); return nullptr;
509 }
510
511 Value *Nucleus::createSIToFP(Value *v, Type *destType)
512 {
513 assert(false && "UNIMPLEMENTED"); return nullptr;
514 }
515
516 Value *Nucleus::createFPTrunc(Value *v, Type *destType)
517 {
518 assert(false && "UNIMPLEMENTED"); return nullptr;
519 }
520
521 Value *Nucleus::createFPExt(Value *v, Type *destType)
522 {
523 assert(false && "UNIMPLEMENTED"); return nullptr;
524 }
525
526 Value *Nucleus::createPtrToInt(Value *v, Type *destType)
527 {
528 assert(false && "UNIMPLEMENTED"); return nullptr;
529 }
530
531 Value *Nucleus::createIntToPtr(Value *v, Type *destType)
532 {
533 assert(false && "UNIMPLEMENTED"); return nullptr;
534 }
535
536 Value *Nucleus::createBitCast(Value *v, Type *destType)
537 {
538 assert(false && "UNIMPLEMENTED"); return nullptr;
539 }
540
541 Value *Nucleus::createIntCast(Value *v, Type *destType, bool isSigned)
542 {
543 assert(false && "UNIMPLEMENTED"); return nullptr;
544 }
545
546 Value *Nucleus::createICmpEQ(Value *lhs, Value *rhs)
547 {
548 assert(false && "UNIMPLEMENTED"); return nullptr;
549 }
550
551 Value *Nucleus::createICmpNE(Value *lhs, Value *rhs)
552 {
553 assert(false && "UNIMPLEMENTED"); return nullptr;
554 }
555
556 Value *Nucleus::createICmpUGT(Value *lhs, Value *rhs)
557 {
558 assert(false && "UNIMPLEMENTED"); return nullptr;
559 }
560
561 Value *Nucleus::createICmpUGE(Value *lhs, Value *rhs)
562 {
563 assert(false && "UNIMPLEMENTED"); return nullptr;
564 }
565
566 Value *Nucleus::createICmpULT(Value *lhs, Value *rhs)
567 {
568 assert(false && "UNIMPLEMENTED"); return nullptr;
569 }
570
571 Value *Nucleus::createICmpULE(Value *lhs, Value *rhs)
572 {
573 assert(false && "UNIMPLEMENTED"); return nullptr;
574 }
575
576 Value *Nucleus::createICmpSGT(Value *lhs, Value *rhs)
577 {
578 assert(false && "UNIMPLEMENTED"); return nullptr;
579 }
580
581 Value *Nucleus::createICmpSGE(Value *lhs, Value *rhs)
582 {
583 assert(false && "UNIMPLEMENTED"); return nullptr;
584 }
585
586 Value *Nucleus::createICmpSLT(Value *lhs, Value *rhs)
587 {
588 assert(false && "UNIMPLEMENTED"); return nullptr;
589 }
590
591 Value *Nucleus::createICmpSLE(Value *lhs, Value *rhs)
592 {
593 assert(false && "UNIMPLEMENTED"); return nullptr;
594 }
595
596 Value *Nucleus::createFCmpOEQ(Value *lhs, Value *rhs)
597 {
598 assert(false && "UNIMPLEMENTED"); return nullptr;
599 }
600
601 Value *Nucleus::createFCmpOGT(Value *lhs, Value *rhs)
602 {
603 assert(false && "UNIMPLEMENTED"); return nullptr;
604 }
605
606 Value *Nucleus::createFCmpOGE(Value *lhs, Value *rhs)
607 {
608 assert(false && "UNIMPLEMENTED"); return nullptr;
609 }
610
611 Value *Nucleus::createFCmpOLT(Value *lhs, Value *rhs)
612 {
613 assert(false && "UNIMPLEMENTED"); return nullptr;
614 }
615
616 Value *Nucleus::createFCmpOLE(Value *lhs, Value *rhs)
617 {
618 assert(false && "UNIMPLEMENTED"); return nullptr;
619 }
620
621 Value *Nucleus::createFCmpONE(Value *lhs, Value *rhs)
622 {
623 assert(false && "UNIMPLEMENTED"); return nullptr;
624 }
625
626 Value *Nucleus::createFCmpORD(Value *lhs, Value *rhs)
627 {
628 assert(false && "UNIMPLEMENTED"); return nullptr;
629 }
630
631 Value *Nucleus::createFCmpUNO(Value *lhs, Value *rhs)
632 {
633 assert(false && "UNIMPLEMENTED"); return nullptr;
634 }
635
636 Value *Nucleus::createFCmpUEQ(Value *lhs, Value *rhs)
637 {
638 assert(false && "UNIMPLEMENTED"); return nullptr;
639 }
640
641 Value *Nucleus::createFCmpUGT(Value *lhs, Value *rhs)
642 {
643 assert(false && "UNIMPLEMENTED"); return nullptr;
644 }
645
646 Value *Nucleus::createFCmpUGE(Value *lhs, Value *rhs)
647 {
648 assert(false && "UNIMPLEMENTED"); return nullptr;
649 }
650
651 Value *Nucleus::createFCmpULT(Value *lhs, Value *rhs)
652 {
653 assert(false && "UNIMPLEMENTED"); return nullptr;
654 }
655
656 Value *Nucleus::createFCmpULE(Value *lhs, Value *rhs)
657 {
658 assert(false && "UNIMPLEMENTED"); return nullptr;
659 }
660
661 Value *Nucleus::createFCmpUNE(Value *lhs, Value *rhs)
662 {
663 assert(false && "UNIMPLEMENTED"); return nullptr;
664 }
665
666 Value *Nucleus::createExtractElement(Value *vector, int index)
667 {
668 assert(false && "UNIMPLEMENTED"); return nullptr;
669 }
670
671 Value *Nucleus::createInsertElement(Value *vector, Value *element, int index)
672 {
673 assert(false && "UNIMPLEMENTED"); return nullptr;
674 }
675
676 Value *Nucleus::createShuffleVector(Value *V1, Value *V2, Value *mask)
677 {
678 assert(false && "UNIMPLEMENTED"); return nullptr;
679 }
680
681 Value *Nucleus::createSelect(Value *C, Value *ifTrue, Value *ifFalse)
682 {
683 assert(false && "UNIMPLEMENTED"); return nullptr;
684 }
685
686 Value *Nucleus::createSwitch(Value *v, BasicBlock *Dest, unsigned NumCases)
687 {
688 assert(false && "UNIMPLEMENTED"); return nullptr;
689 }
690
691 void Nucleus::addSwitchCase(Value *Switch, int Case, BasicBlock *Branch)
692 {
693 assert(false && "UNIMPLEMENTED"); return;
694 }
695
696 void Nucleus::createUnreachable()
697 {
698 assert(false && "UNIMPLEMENTED");
699 }
700
701 Value *Nucleus::createSwizzle(Value *val, unsigned char select)
702 {
703 assert(false && "UNIMPLEMENTED"); return nullptr;
704 }
705
706 Value *Nucleus::createMask(Value *lhs, Value *rhs, unsigned char select)
707 {
708 assert(false && "UNIMPLEMENTED"); return nullptr;
709 }
710
711 Constant *Nucleus::createConstantPointer(const void *address, Type *Ty, bool isConstant, unsigned int Align)
712 {
713 assert(false && "UNIMPLEMENTED"); return nullptr;
714 }
715
716 Type *Nucleus::getPointerType(Type *ElementType)
717 {
Nicolas Capense12780d2016-09-27 14:18:07 -0400718 if(sizeof(void*) == 8)
719 {
720 return T(Ice::IceType_i64);
721 }
722 else
723 {
724 return T(Ice::IceType_i32);
725 }
Nicolas Capens598f8d82016-09-26 15:09:10 -0400726 }
727
728 Constant *Nucleus::createNullValue(Type *Ty)
729 {
730 assert(false && "UNIMPLEMENTED"); return nullptr;
731 }
732
733 Constant *Nucleus::createConstantInt(int64_t i)
734 {
735 assert(false && "UNIMPLEMENTED"); return nullptr;
736 }
737
738 Constant *Nucleus::createConstantInt(int i)
739 {
Nicolas Capensb955d5b2016-09-28 22:36:28 -0400740 return C(::context->getConstantInt32(i));
Nicolas Capens598f8d82016-09-26 15:09:10 -0400741 }
742
743 Constant *Nucleus::createConstantInt(unsigned int i)
744 {
745 assert(false && "UNIMPLEMENTED"); return nullptr;
746 }
747
748 Constant *Nucleus::createConstantBool(bool b)
749 {
750 assert(false && "UNIMPLEMENTED"); return nullptr;
751 }
752
753 Constant *Nucleus::createConstantByte(signed char i)
754 {
755 assert(false && "UNIMPLEMENTED"); return nullptr;
756 }
757
758 Constant *Nucleus::createConstantByte(unsigned char i)
759 {
760 assert(false && "UNIMPLEMENTED"); return nullptr;
761 }
762
763 Constant *Nucleus::createConstantShort(short i)
764 {
765 assert(false && "UNIMPLEMENTED"); return nullptr;
766 }
767
768 Constant *Nucleus::createConstantShort(unsigned short i)
769 {
770 assert(false && "UNIMPLEMENTED"); return nullptr;
771 }
772
773 Constant *Nucleus::createConstantFloat(float x)
774 {
775 assert(false && "UNIMPLEMENTED"); return nullptr;
776 }
777
778 Constant *Nucleus::createNullPointer(Type *Ty)
779 {
780 assert(false && "UNIMPLEMENTED"); return nullptr;
781 }
782
783 Constant *Nucleus::createConstantVector(Constant *const *Vals, unsigned NumVals)
784 {
785 assert(false && "UNIMPLEMENTED"); return nullptr;
786 }
787
788 Type *Void::getType()
789 {
790 return T(Ice::IceType_void);
791 }
792
Nicolas Capens598f8d82016-09-26 15:09:10 -0400793 Bool::Bool(Argument<Bool> argument)
794 {
795 storeValue(argument.value);
796 }
797
798 Bool::Bool()
799 {
800 }
801
802 Bool::Bool(bool x)
803 {
804 storeValue(Nucleus::createConstantBool(x));
805 }
806
807 Bool::Bool(RValue<Bool> rhs)
808 {
809 storeValue(rhs.value);
810 }
811
812 Bool::Bool(const Bool &rhs)
813 {
814 Value *value = rhs.loadValue();
815 storeValue(value);
816 }
817
818 Bool::Bool(const Reference<Bool> &rhs)
819 {
820 Value *value = rhs.loadValue();
821 storeValue(value);
822 }
823
824 RValue<Bool> Bool::operator=(RValue<Bool> rhs) const
825 {
826 storeValue(rhs.value);
827
828 return rhs;
829 }
830
831 RValue<Bool> Bool::operator=(const Bool &rhs) const
832 {
833 Value *value = rhs.loadValue();
834 storeValue(value);
835
836 return RValue<Bool>(value);
837 }
838
839 RValue<Bool> Bool::operator=(const Reference<Bool> &rhs) const
840 {
841 Value *value = rhs.loadValue();
842 storeValue(value);
843
844 return RValue<Bool>(value);
845 }
846
847 RValue<Bool> operator!(RValue<Bool> val)
848 {
849 return RValue<Bool>(Nucleus::createNot(val.value));
850 }
851
852 RValue<Bool> operator&&(RValue<Bool> lhs, RValue<Bool> rhs)
853 {
854 return RValue<Bool>(Nucleus::createAnd(lhs.value, rhs.value));
855 }
856
857 RValue<Bool> operator||(RValue<Bool> lhs, RValue<Bool> rhs)
858 {
859 return RValue<Bool>(Nucleus::createOr(lhs.value, rhs.value));
860 }
861
862 Type *Bool::getType()
863 {
864 assert(false && "UNIMPLEMENTED"); return nullptr;
865 }
866
867 Byte::Byte(Argument<Byte> argument)
868 {
869 storeValue(argument.value);
870 }
871
872 Byte::Byte(RValue<Int> cast)
873 {
874 Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
875
876 storeValue(integer);
877 }
878
879 Byte::Byte(RValue<UInt> cast)
880 {
881 Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
882
883 storeValue(integer);
884 }
885
886 Byte::Byte(RValue<UShort> cast)
887 {
888 Value *integer = Nucleus::createTrunc(cast.value, Byte::getType());
889
890 storeValue(integer);
891 }
892
893 Byte::Byte()
894 {
895 }
896
897 Byte::Byte(int x)
898 {
899 storeValue(Nucleus::createConstantByte((unsigned char)x));
900 }
901
902 Byte::Byte(unsigned char x)
903 {
904 storeValue(Nucleus::createConstantByte(x));
905 }
906
907 Byte::Byte(RValue<Byte> rhs)
908 {
909 storeValue(rhs.value);
910 }
911
912 Byte::Byte(const Byte &rhs)
913 {
914 Value *value = rhs.loadValue();
915 storeValue(value);
916 }
917
918 Byte::Byte(const Reference<Byte> &rhs)
919 {
920 Value *value = rhs.loadValue();
921 storeValue(value);
922 }
923
924 RValue<Byte> Byte::operator=(RValue<Byte> rhs) const
925 {
926 storeValue(rhs.value);
927
928 return rhs;
929 }
930
931 RValue<Byte> Byte::operator=(const Byte &rhs) const
932 {
933 Value *value = rhs.loadValue();
934 storeValue(value);
935
936 return RValue<Byte>(value);
937 }
938
939 RValue<Byte> Byte::operator=(const Reference<Byte> &rhs) const
940 {
941 Value *value = rhs.loadValue();
942 storeValue(value);
943
944 return RValue<Byte>(value);
945 }
946
947 RValue<Byte> operator+(RValue<Byte> lhs, RValue<Byte> rhs)
948 {
949 return RValue<Byte>(Nucleus::createAdd(lhs.value, rhs.value));
950 }
951
952 RValue<Byte> operator-(RValue<Byte> lhs, RValue<Byte> rhs)
953 {
954 return RValue<Byte>(Nucleus::createSub(lhs.value, rhs.value));
955 }
956
957 RValue<Byte> operator*(RValue<Byte> lhs, RValue<Byte> rhs)
958 {
959 return RValue<Byte>(Nucleus::createMul(lhs.value, rhs.value));
960 }
961
962 RValue<Byte> operator/(RValue<Byte> lhs, RValue<Byte> rhs)
963 {
964 return RValue<Byte>(Nucleus::createUDiv(lhs.value, rhs.value));
965 }
966
967 RValue<Byte> operator%(RValue<Byte> lhs, RValue<Byte> rhs)
968 {
969 return RValue<Byte>(Nucleus::createURem(lhs.value, rhs.value));
970 }
971
972 RValue<Byte> operator&(RValue<Byte> lhs, RValue<Byte> rhs)
973 {
974 return RValue<Byte>(Nucleus::createAnd(lhs.value, rhs.value));
975 }
976
977 RValue<Byte> operator|(RValue<Byte> lhs, RValue<Byte> rhs)
978 {
979 return RValue<Byte>(Nucleus::createOr(lhs.value, rhs.value));
980 }
981
982 RValue<Byte> operator^(RValue<Byte> lhs, RValue<Byte> rhs)
983 {
984 return RValue<Byte>(Nucleus::createXor(lhs.value, rhs.value));
985 }
986
987 RValue<Byte> operator<<(RValue<Byte> lhs, RValue<Byte> rhs)
988 {
989 return RValue<Byte>(Nucleus::createShl(lhs.value, rhs.value));
990 }
991
992 RValue<Byte> operator>>(RValue<Byte> lhs, RValue<Byte> rhs)
993 {
994 return RValue<Byte>(Nucleus::createLShr(lhs.value, rhs.value));
995 }
996
997 RValue<Byte> operator+=(const Byte &lhs, RValue<Byte> rhs)
998 {
999 return lhs = lhs + rhs;
1000 }
1001
1002 RValue<Byte> operator-=(const Byte &lhs, RValue<Byte> rhs)
1003 {
1004 return lhs = lhs - rhs;
1005 }
1006
1007 RValue<Byte> operator*=(const Byte &lhs, RValue<Byte> rhs)
1008 {
1009 return lhs = lhs * rhs;
1010 }
1011
1012 RValue<Byte> operator/=(const Byte &lhs, RValue<Byte> rhs)
1013 {
1014 return lhs = lhs / rhs;
1015 }
1016
1017 RValue<Byte> operator%=(const Byte &lhs, RValue<Byte> rhs)
1018 {
1019 return lhs = lhs % rhs;
1020 }
1021
1022 RValue<Byte> operator&=(const Byte &lhs, RValue<Byte> rhs)
1023 {
1024 return lhs = lhs & rhs;
1025 }
1026
1027 RValue<Byte> operator|=(const Byte &lhs, RValue<Byte> rhs)
1028 {
1029 return lhs = lhs | rhs;
1030 }
1031
1032 RValue<Byte> operator^=(const Byte &lhs, RValue<Byte> rhs)
1033 {
1034 return lhs = lhs ^ rhs;
1035 }
1036
1037 RValue<Byte> operator<<=(const Byte &lhs, RValue<Byte> rhs)
1038 {
1039 return lhs = lhs << rhs;
1040 }
1041
1042 RValue<Byte> operator>>=(const Byte &lhs, RValue<Byte> rhs)
1043 {
1044 return lhs = lhs >> rhs;
1045 }
1046
1047 RValue<Byte> operator+(RValue<Byte> val)
1048 {
1049 return val;
1050 }
1051
1052 RValue<Byte> operator-(RValue<Byte> val)
1053 {
1054 return RValue<Byte>(Nucleus::createNeg(val.value));
1055 }
1056
1057 RValue<Byte> operator~(RValue<Byte> val)
1058 {
1059 return RValue<Byte>(Nucleus::createNot(val.value));
1060 }
1061
1062 RValue<Byte> operator++(const Byte &val, int) // Post-increment
1063 {
1064 RValue<Byte> res = val;
1065
1066 assert(false && "UNIMPLEMENTED");
1067
1068 return res;
1069 }
1070
1071 const Byte &operator++(const Byte &val) // Pre-increment
1072 {
1073 assert(false && "UNIMPLEMENTED");
1074
1075 return val;
1076 }
1077
1078 RValue<Byte> operator--(const Byte &val, int) // Post-decrement
1079 {
1080 RValue<Byte> res = val;
1081
1082 assert(false && "UNIMPLEMENTED");
1083
1084 return res;
1085 }
1086
1087 const Byte &operator--(const Byte &val) // Pre-decrement
1088 {
1089 assert(false && "UNIMPLEMENTED");
1090
1091 return val;
1092 }
1093
1094 RValue<Bool> operator<(RValue<Byte> lhs, RValue<Byte> rhs)
1095 {
1096 return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
1097 }
1098
1099 RValue<Bool> operator<=(RValue<Byte> lhs, RValue<Byte> rhs)
1100 {
1101 return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
1102 }
1103
1104 RValue<Bool> operator>(RValue<Byte> lhs, RValue<Byte> rhs)
1105 {
1106 return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
1107 }
1108
1109 RValue<Bool> operator>=(RValue<Byte> lhs, RValue<Byte> rhs)
1110 {
1111 return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
1112 }
1113
1114 RValue<Bool> operator!=(RValue<Byte> lhs, RValue<Byte> rhs)
1115 {
1116 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
1117 }
1118
1119 RValue<Bool> operator==(RValue<Byte> lhs, RValue<Byte> rhs)
1120 {
1121 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
1122 }
1123
1124 Type *Byte::getType()
1125 {
1126 assert(false && "UNIMPLEMENTED"); return nullptr;
1127 }
1128
1129 SByte::SByte(Argument<SByte> argument)
1130 {
1131 storeValue(argument.value);
1132 }
1133
1134 SByte::SByte(RValue<Int> cast)
1135 {
1136 Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
1137
1138 storeValue(integer);
1139 }
1140
1141 SByte::SByte(RValue<Short> cast)
1142 {
1143 Value *integer = Nucleus::createTrunc(cast.value, SByte::getType());
1144
1145 storeValue(integer);
1146 }
1147
1148 SByte::SByte()
1149 {
1150 }
1151
1152 SByte::SByte(signed char x)
1153 {
1154 storeValue(Nucleus::createConstantByte(x));
1155 }
1156
1157 SByte::SByte(RValue<SByte> rhs)
1158 {
1159 storeValue(rhs.value);
1160 }
1161
1162 SByte::SByte(const SByte &rhs)
1163 {
1164 Value *value = rhs.loadValue();
1165 storeValue(value);
1166 }
1167
1168 SByte::SByte(const Reference<SByte> &rhs)
1169 {
1170 Value *value = rhs.loadValue();
1171 storeValue(value);
1172 }
1173
1174 RValue<SByte> SByte::operator=(RValue<SByte> rhs) const
1175 {
1176 storeValue(rhs.value);
1177
1178 return rhs;
1179 }
1180
1181 RValue<SByte> SByte::operator=(const SByte &rhs) const
1182 {
1183 Value *value = rhs.loadValue();
1184 storeValue(value);
1185
1186 return RValue<SByte>(value);
1187 }
1188
1189 RValue<SByte> SByte::operator=(const Reference<SByte> &rhs) const
1190 {
1191 Value *value = rhs.loadValue();
1192 storeValue(value);
1193
1194 return RValue<SByte>(value);
1195 }
1196
1197 RValue<SByte> operator+(RValue<SByte> lhs, RValue<SByte> rhs)
1198 {
1199 return RValue<SByte>(Nucleus::createAdd(lhs.value, rhs.value));
1200 }
1201
1202 RValue<SByte> operator-(RValue<SByte> lhs, RValue<SByte> rhs)
1203 {
1204 return RValue<SByte>(Nucleus::createSub(lhs.value, rhs.value));
1205 }
1206
1207 RValue<SByte> operator*(RValue<SByte> lhs, RValue<SByte> rhs)
1208 {
1209 return RValue<SByte>(Nucleus::createMul(lhs.value, rhs.value));
1210 }
1211
1212 RValue<SByte> operator/(RValue<SByte> lhs, RValue<SByte> rhs)
1213 {
1214 return RValue<SByte>(Nucleus::createSDiv(lhs.value, rhs.value));
1215 }
1216
1217 RValue<SByte> operator%(RValue<SByte> lhs, RValue<SByte> rhs)
1218 {
1219 return RValue<SByte>(Nucleus::createSRem(lhs.value, rhs.value));
1220 }
1221
1222 RValue<SByte> operator&(RValue<SByte> lhs, RValue<SByte> rhs)
1223 {
1224 return RValue<SByte>(Nucleus::createAnd(lhs.value, rhs.value));
1225 }
1226
1227 RValue<SByte> operator|(RValue<SByte> lhs, RValue<SByte> rhs)
1228 {
1229 return RValue<SByte>(Nucleus::createOr(lhs.value, rhs.value));
1230 }
1231
1232 RValue<SByte> operator^(RValue<SByte> lhs, RValue<SByte> rhs)
1233 {
1234 return RValue<SByte>(Nucleus::createXor(lhs.value, rhs.value));
1235 }
1236
1237 RValue<SByte> operator<<(RValue<SByte> lhs, RValue<SByte> rhs)
1238 {
1239 return RValue<SByte>(Nucleus::createShl(lhs.value, rhs.value));
1240 }
1241
1242 RValue<SByte> operator>>(RValue<SByte> lhs, RValue<SByte> rhs)
1243 {
1244 return RValue<SByte>(Nucleus::createAShr(lhs.value, rhs.value));
1245 }
1246
1247 RValue<SByte> operator+=(const SByte &lhs, RValue<SByte> rhs)
1248 {
1249 return lhs = lhs + rhs;
1250 }
1251
1252 RValue<SByte> operator-=(const SByte &lhs, RValue<SByte> rhs)
1253 {
1254 return lhs = lhs - rhs;
1255 }
1256
1257 RValue<SByte> operator*=(const SByte &lhs, RValue<SByte> rhs)
1258 {
1259 return lhs = lhs * rhs;
1260 }
1261
1262 RValue<SByte> operator/=(const SByte &lhs, RValue<SByte> rhs)
1263 {
1264 return lhs = lhs / rhs;
1265 }
1266
1267 RValue<SByte> operator%=(const SByte &lhs, RValue<SByte> rhs)
1268 {
1269 return lhs = lhs % rhs;
1270 }
1271
1272 RValue<SByte> operator&=(const SByte &lhs, RValue<SByte> rhs)
1273 {
1274 return lhs = lhs & rhs;
1275 }
1276
1277 RValue<SByte> operator|=(const SByte &lhs, RValue<SByte> rhs)
1278 {
1279 return lhs = lhs | rhs;
1280 }
1281
1282 RValue<SByte> operator^=(const SByte &lhs, RValue<SByte> rhs)
1283 {
1284 return lhs = lhs ^ rhs;
1285 }
1286
1287 RValue<SByte> operator<<=(const SByte &lhs, RValue<SByte> rhs)
1288 {
1289 return lhs = lhs << rhs;
1290 }
1291
1292 RValue<SByte> operator>>=(const SByte &lhs, RValue<SByte> rhs)
1293 {
1294 return lhs = lhs >> rhs;
1295 }
1296
1297 RValue<SByte> operator+(RValue<SByte> val)
1298 {
1299 return val;
1300 }
1301
1302 RValue<SByte> operator-(RValue<SByte> val)
1303 {
1304 return RValue<SByte>(Nucleus::createNeg(val.value));
1305 }
1306
1307 RValue<SByte> operator~(RValue<SByte> val)
1308 {
1309 return RValue<SByte>(Nucleus::createNot(val.value));
1310 }
1311
1312 RValue<SByte> operator++(const SByte &val, int) // Post-increment
1313 {
1314 RValue<SByte> res = val;
1315
1316 assert(false && "UNIMPLEMENTED");
1317
1318 return res;
1319 }
1320
1321 const SByte &operator++(const SByte &val) // Pre-increment
1322 {
1323 assert(false && "UNIMPLEMENTED");
1324 assert(false && "UNIMPLEMENTED");
1325
1326 return val;
1327 }
1328
1329 RValue<SByte> operator--(const SByte &val, int) // Post-decrement
1330 {
1331 RValue<SByte> res = val;
1332
1333 assert(false && "UNIMPLEMENTED");
1334 assert(false && "UNIMPLEMENTED");
1335
1336 return res;
1337 }
1338
1339 const SByte &operator--(const SByte &val) // Pre-decrement
1340 {
1341 assert(false && "UNIMPLEMENTED");
1342 assert(false && "UNIMPLEMENTED");
1343
1344 return val;
1345 }
1346
1347 RValue<Bool> operator<(RValue<SByte> lhs, RValue<SByte> rhs)
1348 {
1349 return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
1350 }
1351
1352 RValue<Bool> operator<=(RValue<SByte> lhs, RValue<SByte> rhs)
1353 {
1354 return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
1355 }
1356
1357 RValue<Bool> operator>(RValue<SByte> lhs, RValue<SByte> rhs)
1358 {
1359 return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
1360 }
1361
1362 RValue<Bool> operator>=(RValue<SByte> lhs, RValue<SByte> rhs)
1363 {
1364 return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
1365 }
1366
1367 RValue<Bool> operator!=(RValue<SByte> lhs, RValue<SByte> rhs)
1368 {
1369 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
1370 }
1371
1372 RValue<Bool> operator==(RValue<SByte> lhs, RValue<SByte> rhs)
1373 {
1374 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
1375 }
1376
1377 Type *SByte::getType()
1378 {
1379 assert(false && "UNIMPLEMENTED"); return nullptr;
1380 }
1381
1382 Short::Short(Argument<Short> argument)
1383 {
1384 storeValue(argument.value);
1385 }
1386
1387 Short::Short(RValue<Int> cast)
1388 {
1389 Value *integer = Nucleus::createTrunc(cast.value, Short::getType());
1390
1391 storeValue(integer);
1392 }
1393
1394 Short::Short()
1395 {
1396 }
1397
1398 Short::Short(short x)
1399 {
1400 storeValue(Nucleus::createConstantShort(x));
1401 }
1402
1403 Short::Short(RValue<Short> rhs)
1404 {
1405 storeValue(rhs.value);
1406 }
1407
1408 Short::Short(const Short &rhs)
1409 {
1410 Value *value = rhs.loadValue();
1411 storeValue(value);
1412 }
1413
1414 Short::Short(const Reference<Short> &rhs)
1415 {
1416 Value *value = rhs.loadValue();
1417 storeValue(value);
1418 }
1419
1420 RValue<Short> Short::operator=(RValue<Short> rhs) const
1421 {
1422 storeValue(rhs.value);
1423
1424 return rhs;
1425 }
1426
1427 RValue<Short> Short::operator=(const Short &rhs) const
1428 {
1429 Value *value = rhs.loadValue();
1430 storeValue(value);
1431
1432 return RValue<Short>(value);
1433 }
1434
1435 RValue<Short> Short::operator=(const Reference<Short> &rhs) const
1436 {
1437 Value *value = rhs.loadValue();
1438 storeValue(value);
1439
1440 return RValue<Short>(value);
1441 }
1442
1443 RValue<Short> operator+(RValue<Short> lhs, RValue<Short> rhs)
1444 {
1445 return RValue<Short>(Nucleus::createAdd(lhs.value, rhs.value));
1446 }
1447
1448 RValue<Short> operator-(RValue<Short> lhs, RValue<Short> rhs)
1449 {
1450 return RValue<Short>(Nucleus::createSub(lhs.value, rhs.value));
1451 }
1452
1453 RValue<Short> operator*(RValue<Short> lhs, RValue<Short> rhs)
1454 {
1455 return RValue<Short>(Nucleus::createMul(lhs.value, rhs.value));
1456 }
1457
1458 RValue<Short> operator/(RValue<Short> lhs, RValue<Short> rhs)
1459 {
1460 return RValue<Short>(Nucleus::createSDiv(lhs.value, rhs.value));
1461 }
1462
1463 RValue<Short> operator%(RValue<Short> lhs, RValue<Short> rhs)
1464 {
1465 return RValue<Short>(Nucleus::createSRem(lhs.value, rhs.value));
1466 }
1467
1468 RValue<Short> operator&(RValue<Short> lhs, RValue<Short> rhs)
1469 {
1470 return RValue<Short>(Nucleus::createAnd(lhs.value, rhs.value));
1471 }
1472
1473 RValue<Short> operator|(RValue<Short> lhs, RValue<Short> rhs)
1474 {
1475 return RValue<Short>(Nucleus::createOr(lhs.value, rhs.value));
1476 }
1477
1478 RValue<Short> operator^(RValue<Short> lhs, RValue<Short> rhs)
1479 {
1480 return RValue<Short>(Nucleus::createXor(lhs.value, rhs.value));
1481 }
1482
1483 RValue<Short> operator<<(RValue<Short> lhs, RValue<Short> rhs)
1484 {
1485 return RValue<Short>(Nucleus::createShl(lhs.value, rhs.value));
1486 }
1487
1488 RValue<Short> operator>>(RValue<Short> lhs, RValue<Short> rhs)
1489 {
1490 return RValue<Short>(Nucleus::createAShr(lhs.value, rhs.value));
1491 }
1492
1493 RValue<Short> operator+=(const Short &lhs, RValue<Short> rhs)
1494 {
1495 return lhs = lhs + rhs;
1496 }
1497
1498 RValue<Short> operator-=(const Short &lhs, RValue<Short> rhs)
1499 {
1500 return lhs = lhs - rhs;
1501 }
1502
1503 RValue<Short> operator*=(const Short &lhs, RValue<Short> rhs)
1504 {
1505 return lhs = lhs * rhs;
1506 }
1507
1508 RValue<Short> operator/=(const Short &lhs, RValue<Short> rhs)
1509 {
1510 return lhs = lhs / rhs;
1511 }
1512
1513 RValue<Short> operator%=(const Short &lhs, RValue<Short> rhs)
1514 {
1515 return lhs = lhs % rhs;
1516 }
1517
1518 RValue<Short> operator&=(const Short &lhs, RValue<Short> rhs)
1519 {
1520 return lhs = lhs & rhs;
1521 }
1522
1523 RValue<Short> operator|=(const Short &lhs, RValue<Short> rhs)
1524 {
1525 return lhs = lhs | rhs;
1526 }
1527
1528 RValue<Short> operator^=(const Short &lhs, RValue<Short> rhs)
1529 {
1530 return lhs = lhs ^ rhs;
1531 }
1532
1533 RValue<Short> operator<<=(const Short &lhs, RValue<Short> rhs)
1534 {
1535 return lhs = lhs << rhs;
1536 }
1537
1538 RValue<Short> operator>>=(const Short &lhs, RValue<Short> rhs)
1539 {
1540 return lhs = lhs >> rhs;
1541 }
1542
1543 RValue<Short> operator+(RValue<Short> val)
1544 {
1545 return val;
1546 }
1547
1548 RValue<Short> operator-(RValue<Short> val)
1549 {
1550 return RValue<Short>(Nucleus::createNeg(val.value));
1551 }
1552
1553 RValue<Short> operator~(RValue<Short> val)
1554 {
1555 return RValue<Short>(Nucleus::createNot(val.value));
1556 }
1557
1558 RValue<Short> operator++(const Short &val, int) // Post-increment
1559 {
1560 RValue<Short> res = val;
1561
1562 assert(false && "UNIMPLEMENTED");
1563 assert(false && "UNIMPLEMENTED");
1564
1565 return res;
1566 }
1567
1568 const Short &operator++(const Short &val) // Pre-increment
1569 {
1570 assert(false && "UNIMPLEMENTED");
1571 assert(false && "UNIMPLEMENTED");
1572
1573 return val;
1574 }
1575
1576 RValue<Short> operator--(const Short &val, int) // Post-decrement
1577 {
1578 RValue<Short> res = val;
1579
1580 assert(false && "UNIMPLEMENTED");
1581 assert(false && "UNIMPLEMENTED");
1582
1583 return res;
1584 }
1585
1586 const Short &operator--(const Short &val) // Pre-decrement
1587 {
1588 assert(false && "UNIMPLEMENTED");
1589 assert(false && "UNIMPLEMENTED");
1590
1591 return val;
1592 }
1593
1594 RValue<Bool> operator<(RValue<Short> lhs, RValue<Short> rhs)
1595 {
1596 return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
1597 }
1598
1599 RValue<Bool> operator<=(RValue<Short> lhs, RValue<Short> rhs)
1600 {
1601 return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
1602 }
1603
1604 RValue<Bool> operator>(RValue<Short> lhs, RValue<Short> rhs)
1605 {
1606 return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
1607 }
1608
1609 RValue<Bool> operator>=(RValue<Short> lhs, RValue<Short> rhs)
1610 {
1611 return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
1612 }
1613
1614 RValue<Bool> operator!=(RValue<Short> lhs, RValue<Short> rhs)
1615 {
1616 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
1617 }
1618
1619 RValue<Bool> operator==(RValue<Short> lhs, RValue<Short> rhs)
1620 {
1621 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
1622 }
1623
1624 Type *Short::getType()
1625 {
1626 assert(false && "UNIMPLEMENTED"); return nullptr;
1627 }
1628
1629 UShort::UShort(Argument<UShort> argument)
1630 {
1631 storeValue(argument.value);
1632 }
1633
1634 UShort::UShort(RValue<UInt> cast)
1635 {
1636 Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
1637
1638 storeValue(integer);
1639 }
1640
1641 UShort::UShort(RValue<Int> cast)
1642 {
1643 Value *integer = Nucleus::createTrunc(cast.value, UShort::getType());
1644
1645 storeValue(integer);
1646 }
1647
1648 UShort::UShort()
1649 {
1650 }
1651
1652 UShort::UShort(unsigned short x)
1653 {
1654 storeValue(Nucleus::createConstantShort(x));
1655 }
1656
1657 UShort::UShort(RValue<UShort> rhs)
1658 {
1659 storeValue(rhs.value);
1660 }
1661
1662 UShort::UShort(const UShort &rhs)
1663 {
1664 Value *value = rhs.loadValue();
1665 storeValue(value);
1666 }
1667
1668 UShort::UShort(const Reference<UShort> &rhs)
1669 {
1670 Value *value = rhs.loadValue();
1671 storeValue(value);
1672 }
1673
1674 RValue<UShort> UShort::operator=(RValue<UShort> rhs) const
1675 {
1676 storeValue(rhs.value);
1677
1678 return rhs;
1679 }
1680
1681 RValue<UShort> UShort::operator=(const UShort &rhs) const
1682 {
1683 Value *value = rhs.loadValue();
1684 storeValue(value);
1685
1686 return RValue<UShort>(value);
1687 }
1688
1689 RValue<UShort> UShort::operator=(const Reference<UShort> &rhs) const
1690 {
1691 Value *value = rhs.loadValue();
1692 storeValue(value);
1693
1694 return RValue<UShort>(value);
1695 }
1696
1697 RValue<UShort> operator+(RValue<UShort> lhs, RValue<UShort> rhs)
1698 {
1699 return RValue<UShort>(Nucleus::createAdd(lhs.value, rhs.value));
1700 }
1701
1702 RValue<UShort> operator-(RValue<UShort> lhs, RValue<UShort> rhs)
1703 {
1704 return RValue<UShort>(Nucleus::createSub(lhs.value, rhs.value));
1705 }
1706
1707 RValue<UShort> operator*(RValue<UShort> lhs, RValue<UShort> rhs)
1708 {
1709 return RValue<UShort>(Nucleus::createMul(lhs.value, rhs.value));
1710 }
1711
1712 RValue<UShort> operator/(RValue<UShort> lhs, RValue<UShort> rhs)
1713 {
1714 return RValue<UShort>(Nucleus::createUDiv(lhs.value, rhs.value));
1715 }
1716
1717 RValue<UShort> operator%(RValue<UShort> lhs, RValue<UShort> rhs)
1718 {
1719 return RValue<UShort>(Nucleus::createURem(lhs.value, rhs.value));
1720 }
1721
1722 RValue<UShort> operator&(RValue<UShort> lhs, RValue<UShort> rhs)
1723 {
1724 return RValue<UShort>(Nucleus::createAnd(lhs.value, rhs.value));
1725 }
1726
1727 RValue<UShort> operator|(RValue<UShort> lhs, RValue<UShort> rhs)
1728 {
1729 return RValue<UShort>(Nucleus::createOr(lhs.value, rhs.value));
1730 }
1731
1732 RValue<UShort> operator^(RValue<UShort> lhs, RValue<UShort> rhs)
1733 {
1734 return RValue<UShort>(Nucleus::createXor(lhs.value, rhs.value));
1735 }
1736
1737 RValue<UShort> operator<<(RValue<UShort> lhs, RValue<UShort> rhs)
1738 {
1739 return RValue<UShort>(Nucleus::createShl(lhs.value, rhs.value));
1740 }
1741
1742 RValue<UShort> operator>>(RValue<UShort> lhs, RValue<UShort> rhs)
1743 {
1744 return RValue<UShort>(Nucleus::createLShr(lhs.value, rhs.value));
1745 }
1746
1747 RValue<UShort> operator+=(const UShort &lhs, RValue<UShort> rhs)
1748 {
1749 return lhs = lhs + rhs;
1750 }
1751
1752 RValue<UShort> operator-=(const UShort &lhs, RValue<UShort> rhs)
1753 {
1754 return lhs = lhs - rhs;
1755 }
1756
1757 RValue<UShort> operator*=(const UShort &lhs, RValue<UShort> rhs)
1758 {
1759 return lhs = lhs * rhs;
1760 }
1761
1762 RValue<UShort> operator/=(const UShort &lhs, RValue<UShort> rhs)
1763 {
1764 return lhs = lhs / rhs;
1765 }
1766
1767 RValue<UShort> operator%=(const UShort &lhs, RValue<UShort> rhs)
1768 {
1769 return lhs = lhs % rhs;
1770 }
1771
1772 RValue<UShort> operator&=(const UShort &lhs, RValue<UShort> rhs)
1773 {
1774 return lhs = lhs & rhs;
1775 }
1776
1777 RValue<UShort> operator|=(const UShort &lhs, RValue<UShort> rhs)
1778 {
1779 return lhs = lhs | rhs;
1780 }
1781
1782 RValue<UShort> operator^=(const UShort &lhs, RValue<UShort> rhs)
1783 {
1784 return lhs = lhs ^ rhs;
1785 }
1786
1787 RValue<UShort> operator<<=(const UShort &lhs, RValue<UShort> rhs)
1788 {
1789 return lhs = lhs << rhs;
1790 }
1791
1792 RValue<UShort> operator>>=(const UShort &lhs, RValue<UShort> rhs)
1793 {
1794 return lhs = lhs >> rhs;
1795 }
1796
1797 RValue<UShort> operator+(RValue<UShort> val)
1798 {
1799 return val;
1800 }
1801
1802 RValue<UShort> operator-(RValue<UShort> val)
1803 {
1804 return RValue<UShort>(Nucleus::createNeg(val.value));
1805 }
1806
1807 RValue<UShort> operator~(RValue<UShort> val)
1808 {
1809 return RValue<UShort>(Nucleus::createNot(val.value));
1810 }
1811
1812 RValue<UShort> operator++(const UShort &val, int) // Post-increment
1813 {
1814 RValue<UShort> res = val;
1815
1816 assert(false && "UNIMPLEMENTED");
1817 assert(false && "UNIMPLEMENTED");
1818
1819 return res;
1820 }
1821
1822 const UShort &operator++(const UShort &val) // Pre-increment
1823 {
1824 assert(false && "UNIMPLEMENTED");
1825 assert(false && "UNIMPLEMENTED");
1826
1827 return val;
1828 }
1829
1830 RValue<UShort> operator--(const UShort &val, int) // Post-decrement
1831 {
1832 RValue<UShort> res = val;
1833
1834 assert(false && "UNIMPLEMENTED");
1835 assert(false && "UNIMPLEMENTED");
1836
1837 return res;
1838 }
1839
1840 const UShort &operator--(const UShort &val) // Pre-decrement
1841 {
1842 assert(false && "UNIMPLEMENTED");
1843 assert(false && "UNIMPLEMENTED");
1844
1845 return val;
1846 }
1847
1848 RValue<Bool> operator<(RValue<UShort> lhs, RValue<UShort> rhs)
1849 {
1850 return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
1851 }
1852
1853 RValue<Bool> operator<=(RValue<UShort> lhs, RValue<UShort> rhs)
1854 {
1855 return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
1856 }
1857
1858 RValue<Bool> operator>(RValue<UShort> lhs, RValue<UShort> rhs)
1859 {
1860 return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
1861 }
1862
1863 RValue<Bool> operator>=(RValue<UShort> lhs, RValue<UShort> rhs)
1864 {
1865 return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
1866 }
1867
1868 RValue<Bool> operator!=(RValue<UShort> lhs, RValue<UShort> rhs)
1869 {
1870 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
1871 }
1872
1873 RValue<Bool> operator==(RValue<UShort> lhs, RValue<UShort> rhs)
1874 {
1875 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
1876 }
1877
1878 Type *UShort::getType()
1879 {
1880 assert(false && "UNIMPLEMENTED"); return nullptr;
1881 }
1882
1883 Type *Byte4::getType()
1884 {
1885 #if 0
1886 return VectorType::get(Byte::getType(), 4);
1887 #else
1888 return UInt::getType(); // FIXME
1889 #endif
1890 }
1891
1892 Type *SByte4::getType()
1893 {
1894 #if 0
1895 return VectorType::get(SByte::getType(), 4);
1896 #else
1897 return Int::getType(); // FIXME
1898 #endif
1899 }
1900
1901 Byte8::Byte8()
1902 {
1903 // xyzw.parent = this;
1904 }
1905
1906 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)
1907 {
1908 // xyzw.parent = this;
1909 }
1910
1911 Byte8::Byte8(int64_t x)
1912 {
1913 // xyzw.parent = this;
1914 }
1915
1916 Byte8::Byte8(RValue<Byte8> rhs)
1917 {
1918 // xyzw.parent = this;
1919
1920 storeValue(rhs.value);
1921 }
1922
1923 Byte8::Byte8(const Byte8 &rhs)
1924 {
1925 // xyzw.parent = this;
1926
1927 Value *value = rhs.loadValue();
1928 storeValue(value);
1929 }
1930
1931 Byte8::Byte8(const Reference<Byte8> &rhs)
1932 {
1933 // xyzw.parent = this;
1934
1935 Value *value = rhs.loadValue();
1936 storeValue(value);
1937 }
1938
1939 RValue<Byte8> Byte8::operator=(RValue<Byte8> rhs) const
1940 {
1941 storeValue(rhs.value);
1942
1943 return rhs;
1944 }
1945
1946 RValue<Byte8> Byte8::operator=(const Byte8 &rhs) const
1947 {
1948 Value *value = rhs.loadValue();
1949 storeValue(value);
1950
1951 return RValue<Byte8>(value);
1952 }
1953
1954 RValue<Byte8> Byte8::operator=(const Reference<Byte8> &rhs) const
1955 {
1956 Value *value = rhs.loadValue();
1957 storeValue(value);
1958
1959 return RValue<Byte8>(value);
1960 }
1961
1962 RValue<Byte8> operator+(RValue<Byte8> lhs, RValue<Byte8> rhs)
1963 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04001964 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04001965 }
1966
1967 RValue<Byte8> operator-(RValue<Byte8> lhs, RValue<Byte8> rhs)
1968 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04001969 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04001970 }
1971
1972// RValue<Byte8> operator*(RValue<Byte8> lhs, RValue<Byte8> rhs)
1973// {
1974// return RValue<Byte8>(Nucleus::createMul(lhs.value, rhs.value));
1975// }
1976
1977// RValue<Byte8> operator/(RValue<Byte8> lhs, RValue<Byte8> rhs)
1978// {
1979// return RValue<Byte8>(Nucleus::createUDiv(lhs.value, rhs.value));
1980// }
1981
1982// RValue<Byte8> operator%(RValue<Byte8> lhs, RValue<Byte8> rhs)
1983// {
1984// return RValue<Byte8>(Nucleus::createURem(lhs.value, rhs.value));
1985// }
1986
1987 RValue<Byte8> operator&(RValue<Byte8> lhs, RValue<Byte8> rhs)
1988 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04001989 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04001990 }
1991
1992 RValue<Byte8> operator|(RValue<Byte8> lhs, RValue<Byte8> rhs)
1993 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04001994 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04001995 }
1996
1997 RValue<Byte8> operator^(RValue<Byte8> lhs, RValue<Byte8> rhs)
1998 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04001999 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002000 }
2001
2002// RValue<Byte8> operator<<(RValue<Byte8> lhs, unsigned char rhs)
2003// {
2004// return RValue<Byte8>(Nucleus::createShl(lhs.value, rhs.value));
2005// }
2006
2007// RValue<Byte8> operator>>(RValue<Byte8> lhs, unsigned char rhs)
2008// {
2009// return RValue<Byte8>(Nucleus::createLShr(lhs.value, rhs.value));
2010// }
2011
2012 RValue<Byte8> operator+=(const Byte8 &lhs, RValue<Byte8> rhs)
2013 {
2014 return lhs = lhs + rhs;
2015 }
2016
2017 RValue<Byte8> operator-=(const Byte8 &lhs, RValue<Byte8> rhs)
2018 {
2019 return lhs = lhs - rhs;
2020 }
2021
2022// RValue<Byte8> operator*=(const Byte8 &lhs, RValue<Byte8> rhs)
2023// {
2024// return lhs = lhs * rhs;
2025// }
2026
2027// RValue<Byte8> operator/=(const Byte8 &lhs, RValue<Byte8> rhs)
2028// {
2029// return lhs = lhs / rhs;
2030// }
2031
2032// RValue<Byte8> operator%=(const Byte8 &lhs, RValue<Byte8> rhs)
2033// {
2034// return lhs = lhs % rhs;
2035// }
2036
2037 RValue<Byte8> operator&=(const Byte8 &lhs, RValue<Byte8> rhs)
2038 {
2039 return lhs = lhs & rhs;
2040 }
2041
2042 RValue<Byte8> operator|=(const Byte8 &lhs, RValue<Byte8> rhs)
2043 {
2044 return lhs = lhs | rhs;
2045 }
2046
2047 RValue<Byte8> operator^=(const Byte8 &lhs, RValue<Byte8> rhs)
2048 {
2049 return lhs = lhs ^ rhs;
2050 }
2051
2052// RValue<Byte8> operator<<=(const Byte8 &lhs, RValue<Byte8> rhs)
2053// {
2054// return lhs = lhs << rhs;
2055// }
2056
2057// RValue<Byte8> operator>>=(const Byte8 &lhs, RValue<Byte8> rhs)
2058// {
2059// return lhs = lhs >> rhs;
2060// }
2061
2062// RValue<Byte8> operator+(RValue<Byte8> val)
2063// {
2064// return val;
2065// }
2066
2067// RValue<Byte8> operator-(RValue<Byte8> val)
2068// {
2069// return RValue<Byte8>(Nucleus::createNeg(val.value));
2070// }
2071
2072 RValue<Byte8> operator~(RValue<Byte8> val)
2073 {
2074 return RValue<Byte8>(Nucleus::createNot(val.value));
2075 }
2076
2077 RValue<Byte8> AddSat(RValue<Byte8> x, RValue<Byte8> y)
2078 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002079 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002080 }
2081
2082 RValue<Byte8> SubSat(RValue<Byte8> x, RValue<Byte8> y)
2083 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002084 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002085 }
2086
2087 RValue<Short4> Unpack(RValue<Byte4> x)
2088 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002089 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002090 }
2091
2092 RValue<Short4> UnpackLow(RValue<Byte8> x, RValue<Byte8> y)
2093 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002094 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002095 }
2096
2097 RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y)
2098 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002099 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002100 }
2101
2102 RValue<Int> SignMask(RValue<Byte8> x)
2103 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002104 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002105 }
2106
2107// RValue<Byte8> CmpGT(RValue<Byte8> x, RValue<Byte8> y)
2108// {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002109// assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002110// }
2111
2112 RValue<Byte8> CmpEQ(RValue<Byte8> x, RValue<Byte8> y)
2113 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002114 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002115 }
2116
2117 Type *Byte8::getType()
2118 {
2119 assert(false && "UNIMPLEMENTED"); return nullptr;
2120 }
2121
2122 SByte8::SByte8()
2123 {
2124 // xyzw.parent = this;
2125 }
2126
2127 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)
2128 {
2129 // xyzw.parent = this;
2130
2131 assert(false && "UNIMPLEMENTED");
2132 }
2133
2134 SByte8::SByte8(int64_t x)
2135 {
2136 // xyzw.parent = this;
2137
2138 assert(false && "UNIMPLEMENTED");
2139 }
2140
2141 SByte8::SByte8(RValue<SByte8> rhs)
2142 {
2143 // xyzw.parent = this;
2144
2145 storeValue(rhs.value);
2146 }
2147
2148 SByte8::SByte8(const SByte8 &rhs)
2149 {
2150 // xyzw.parent = this;
2151
2152 Value *value = rhs.loadValue();
2153 storeValue(value);
2154 }
2155
2156 SByte8::SByte8(const Reference<SByte8> &rhs)
2157 {
2158 // xyzw.parent = this;
2159
2160 Value *value = rhs.loadValue();
2161 storeValue(value);
2162 }
2163
2164 RValue<SByte8> SByte8::operator=(RValue<SByte8> rhs) const
2165 {
2166 storeValue(rhs.value);
2167
2168 return rhs;
2169 }
2170
2171 RValue<SByte8> SByte8::operator=(const SByte8 &rhs) const
2172 {
2173 Value *value = rhs.loadValue();
2174 storeValue(value);
2175
2176 return RValue<SByte8>(value);
2177 }
2178
2179 RValue<SByte8> SByte8::operator=(const Reference<SByte8> &rhs) const
2180 {
2181 Value *value = rhs.loadValue();
2182 storeValue(value);
2183
2184 return RValue<SByte8>(value);
2185 }
2186
2187 RValue<SByte8> operator+(RValue<SByte8> lhs, RValue<SByte8> rhs)
2188 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002189 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002190 }
2191
2192 RValue<SByte8> operator-(RValue<SByte8> lhs, RValue<SByte8> rhs)
2193 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002194 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002195 }
2196
2197// RValue<SByte8> operator*(RValue<SByte8> lhs, RValue<SByte8> rhs)
2198// {
2199// return RValue<SByte8>(Nucleus::createMul(lhs.value, rhs.value));
2200// }
2201
2202// RValue<SByte8> operator/(RValue<SByte8> lhs, RValue<SByte8> rhs)
2203// {
2204// return RValue<SByte8>(Nucleus::createSDiv(lhs.value, rhs.value));
2205// }
2206
2207// RValue<SByte8> operator%(RValue<SByte8> lhs, RValue<SByte8> rhs)
2208// {
2209// return RValue<SByte8>(Nucleus::createSRem(lhs.value, rhs.value));
2210// }
2211
2212 RValue<SByte8> operator&(RValue<SByte8> lhs, RValue<SByte8> rhs)
2213 {
2214 return RValue<SByte8>(Nucleus::createAnd(lhs.value, rhs.value));
2215 }
2216
2217 RValue<SByte8> operator|(RValue<SByte8> lhs, RValue<SByte8> rhs)
2218 {
2219 return RValue<SByte8>(Nucleus::createOr(lhs.value, rhs.value));
2220 }
2221
2222 RValue<SByte8> operator^(RValue<SByte8> lhs, RValue<SByte8> rhs)
2223 {
2224 return RValue<SByte8>(Nucleus::createXor(lhs.value, rhs.value));
2225 }
2226
2227// RValue<SByte8> operator<<(RValue<SByte8> lhs, unsigned char rhs)
2228// {
2229// return RValue<SByte8>(Nucleus::createShl(lhs.value, rhs.value));
2230// }
2231
2232// RValue<SByte8> operator>>(RValue<SByte8> lhs, unsigned char rhs)
2233// {
2234// return RValue<SByte8>(Nucleus::createAShr(lhs.value, rhs.value));
2235// }
2236
2237 RValue<SByte8> operator+=(const SByte8 &lhs, RValue<SByte8> rhs)
2238 {
2239 return lhs = lhs + rhs;
2240 }
2241
2242 RValue<SByte8> operator-=(const SByte8 &lhs, RValue<SByte8> rhs)
2243 {
2244 return lhs = lhs - rhs;
2245 }
2246
2247// RValue<SByte8> operator*=(const SByte8 &lhs, RValue<SByte8> rhs)
2248// {
2249// return lhs = lhs * rhs;
2250// }
2251
2252// RValue<SByte8> operator/=(const SByte8 &lhs, RValue<SByte8> rhs)
2253// {
2254// return lhs = lhs / rhs;
2255// }
2256
2257// RValue<SByte8> operator%=(const SByte8 &lhs, RValue<SByte8> rhs)
2258// {
2259// return lhs = lhs % rhs;
2260// }
2261
2262 RValue<SByte8> operator&=(const SByte8 &lhs, RValue<SByte8> rhs)
2263 {
2264 return lhs = lhs & rhs;
2265 }
2266
2267 RValue<SByte8> operator|=(const SByte8 &lhs, RValue<SByte8> rhs)
2268 {
2269 return lhs = lhs | rhs;
2270 }
2271
2272 RValue<SByte8> operator^=(const SByte8 &lhs, RValue<SByte8> rhs)
2273 {
2274 return lhs = lhs ^ rhs;
2275 }
2276
2277// RValue<SByte8> operator<<=(const SByte8 &lhs, RValue<SByte8> rhs)
2278// {
2279// return lhs = lhs << rhs;
2280// }
2281
2282// RValue<SByte8> operator>>=(const SByte8 &lhs, RValue<SByte8> rhs)
2283// {
2284// return lhs = lhs >> rhs;
2285// }
2286
2287// RValue<SByte8> operator+(RValue<SByte8> val)
2288// {
2289// return val;
2290// }
2291
2292// RValue<SByte8> operator-(RValue<SByte8> val)
2293// {
2294// return RValue<SByte8>(Nucleus::createNeg(val.value));
2295// }
2296
2297 RValue<SByte8> operator~(RValue<SByte8> val)
2298 {
2299 return RValue<SByte8>(Nucleus::createNot(val.value));
2300 }
2301
2302 RValue<SByte8> AddSat(RValue<SByte8> x, RValue<SByte8> y)
2303 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002304 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002305 }
2306
2307 RValue<SByte8> SubSat(RValue<SByte8> x, RValue<SByte8> y)
2308 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002309 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002310 }
2311
2312 RValue<Short4> UnpackLow(RValue<SByte8> x, RValue<SByte8> y)
2313 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002314 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002315 }
2316
2317 RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y)
2318 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002319 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002320 }
2321
2322 RValue<Int> SignMask(RValue<SByte8> x)
2323 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002324 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002325 }
2326
2327 RValue<Byte8> CmpGT(RValue<SByte8> x, RValue<SByte8> y)
2328 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002329 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002330 }
2331
2332 RValue<Byte8> CmpEQ(RValue<SByte8> x, RValue<SByte8> y)
2333 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002334 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002335 }
2336
2337 Type *SByte8::getType()
2338 {
2339 assert(false && "UNIMPLEMENTED"); return nullptr;
2340 }
2341
2342 Byte16::Byte16(RValue<Byte16> rhs)
2343 {
2344 // xyzw.parent = this;
2345
2346 storeValue(rhs.value);
2347 }
2348
2349 Byte16::Byte16(const Byte16 &rhs)
2350 {
2351 // xyzw.parent = this;
2352
2353 Value *value = rhs.loadValue();
2354 storeValue(value);
2355 }
2356
2357 Byte16::Byte16(const Reference<Byte16> &rhs)
2358 {
2359 // xyzw.parent = this;
2360
2361 Value *value = rhs.loadValue();
2362 storeValue(value);
2363 }
2364
2365 RValue<Byte16> Byte16::operator=(RValue<Byte16> rhs) const
2366 {
2367 storeValue(rhs.value);
2368
2369 return rhs;
2370 }
2371
2372 RValue<Byte16> Byte16::operator=(const Byte16 &rhs) const
2373 {
2374 Value *value = rhs.loadValue();
2375 storeValue(value);
2376
2377 return RValue<Byte16>(value);
2378 }
2379
2380 RValue<Byte16> Byte16::operator=(const Reference<Byte16> &rhs) const
2381 {
2382 Value *value = rhs.loadValue();
2383 storeValue(value);
2384
2385 return RValue<Byte16>(value);
2386 }
2387
2388 Type *Byte16::getType()
2389 {
2390 assert(false && "UNIMPLEMENTED"); return nullptr;
2391 }
2392
2393 Type *SByte16::getType()
2394 {
2395 assert(false && "UNIMPLEMENTED"); return nullptr;
2396 }
2397
2398 Short4::Short4(RValue<Int> cast)
2399 {
2400 Value *extend = Nucleus::createZExt(cast.value, Long::getType());
2401 Value *swizzle = Swizzle(RValue<Short4>(extend), 0x00).value;
2402
2403 storeValue(swizzle);
2404 }
2405
2406 Short4::Short4(RValue<Int4> cast)
2407 {
2408 assert(false && "UNIMPLEMENTED");
2409 }
2410
2411// Short4::Short4(RValue<Float> cast)
2412// {
2413// }
2414
2415 Short4::Short4(RValue<Float4> cast)
2416 {
2417 assert(false && "UNIMPLEMENTED");
2418 }
2419
2420 Short4::Short4()
2421 {
2422 // xyzw.parent = this;
2423 }
2424
2425 Short4::Short4(short xyzw)
2426 {
2427 // xyzw.parent = this;
2428
2429 assert(false && "UNIMPLEMENTED");
2430 }
2431
2432 Short4::Short4(short x, short y, short z, short w)
2433 {
2434 // xyzw.parent = this;
2435
2436 assert(false && "UNIMPLEMENTED");
2437 }
2438
2439 Short4::Short4(RValue<Short4> rhs)
2440 {
2441 // xyzw.parent = this;
2442
2443 storeValue(rhs.value);
2444 }
2445
2446 Short4::Short4(const Short4 &rhs)
2447 {
2448 // xyzw.parent = this;
2449
2450 Value *value = rhs.loadValue();
2451 storeValue(value);
2452 }
2453
2454 Short4::Short4(const Reference<Short4> &rhs)
2455 {
2456 // xyzw.parent = this;
2457
2458 Value *value = rhs.loadValue();
2459 storeValue(value);
2460 }
2461
2462 Short4::Short4(RValue<UShort4> rhs)
2463 {
2464 // xyzw.parent = this;
2465
2466 storeValue(rhs.value);
2467 }
2468
2469 Short4::Short4(const UShort4 &rhs)
2470 {
2471 // xyzw.parent = this;
2472
2473 storeValue(rhs.loadValue());
2474 }
2475
2476 Short4::Short4(const Reference<UShort4> &rhs)
2477 {
2478 // xyzw.parent = this;
2479
2480 storeValue(rhs.loadValue());
2481 }
2482
2483 RValue<Short4> Short4::operator=(RValue<Short4> rhs) const
2484 {
2485 storeValue(rhs.value);
2486
2487 return rhs;
2488 }
2489
2490 RValue<Short4> Short4::operator=(const Short4 &rhs) const
2491 {
2492 Value *value = rhs.loadValue();
2493 storeValue(value);
2494
2495 return RValue<Short4>(value);
2496 }
2497
2498 RValue<Short4> Short4::operator=(const Reference<Short4> &rhs) const
2499 {
2500 Value *value = rhs.loadValue();
2501 storeValue(value);
2502
2503 return RValue<Short4>(value);
2504 }
2505
2506 RValue<Short4> Short4::operator=(RValue<UShort4> rhs) const
2507 {
2508 storeValue(rhs.value);
2509
2510 return RValue<Short4>(rhs);
2511 }
2512
2513 RValue<Short4> Short4::operator=(const UShort4 &rhs) const
2514 {
2515 Value *value = rhs.loadValue();
2516 storeValue(value);
2517
2518 return RValue<Short4>(value);
2519 }
2520
2521 RValue<Short4> Short4::operator=(const Reference<UShort4> &rhs) const
2522 {
2523 Value *value = rhs.loadValue();
2524 storeValue(value);
2525
2526 return RValue<Short4>(value);
2527 }
2528
2529 RValue<Short4> operator+(RValue<Short4> lhs, RValue<Short4> rhs)
2530 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002531 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002532 }
2533
2534 RValue<Short4> operator-(RValue<Short4> lhs, RValue<Short4> rhs)
2535 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002536 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002537 }
2538
2539 RValue<Short4> operator*(RValue<Short4> lhs, RValue<Short4> rhs)
2540 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002541 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002542 }
2543
2544// RValue<Short4> operator/(RValue<Short4> lhs, RValue<Short4> rhs)
2545// {
2546// return RValue<Short4>(Nucleus::createSDiv(lhs.value, rhs.value));
2547// }
2548
2549// RValue<Short4> operator%(RValue<Short4> lhs, RValue<Short4> rhs)
2550// {
2551// return RValue<Short4>(Nucleus::createSRem(lhs.value, rhs.value));
2552// }
2553
2554 RValue<Short4> operator&(RValue<Short4> lhs, RValue<Short4> rhs)
2555 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002556 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002557 }
2558
2559 RValue<Short4> operator|(RValue<Short4> lhs, RValue<Short4> rhs)
2560 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002561 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002562 }
2563
2564 RValue<Short4> operator^(RValue<Short4> lhs, RValue<Short4> rhs)
2565 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002566 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002567 }
2568
2569 RValue<Short4> operator<<(RValue<Short4> lhs, unsigned char rhs)
2570 {
2571 // return RValue<Short4>(Nucleus::createShl(lhs.value, rhs.value));
2572
Nicolas Capensc37252c2016-09-28 16:11:54 -04002573 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002574 }
2575
2576 RValue<Short4> operator>>(RValue<Short4> lhs, unsigned char rhs)
2577 {
2578 // return RValue<Short4>(Nucleus::createAShr(lhs.value, rhs.value));
2579
Nicolas Capensc37252c2016-09-28 16:11:54 -04002580 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002581 }
2582
2583 RValue<Short4> operator<<(RValue<Short4> lhs, RValue<Long1> rhs)
2584 {
2585 // return RValue<Short4>(Nucleus::createShl(lhs.value, rhs.value));
2586
Nicolas Capensc37252c2016-09-28 16:11:54 -04002587 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002588 }
2589
2590 RValue<Short4> operator>>(RValue<Short4> lhs, RValue<Long1> rhs)
2591 {
2592 // return RValue<Short4>(Nucleus::createAShr(lhs.value, rhs.value));
2593
Nicolas Capensc37252c2016-09-28 16:11:54 -04002594 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002595 }
2596
2597 RValue<Short4> operator+=(const Short4 &lhs, RValue<Short4> rhs)
2598 {
2599 return lhs = lhs + rhs;
2600 }
2601
2602 RValue<Short4> operator-=(const Short4 &lhs, RValue<Short4> rhs)
2603 {
2604 return lhs = lhs - rhs;
2605 }
2606
2607 RValue<Short4> operator*=(const Short4 &lhs, RValue<Short4> rhs)
2608 {
2609 return lhs = lhs * rhs;
2610 }
2611
2612// RValue<Short4> operator/=(const Short4 &lhs, RValue<Short4> rhs)
2613// {
2614// return lhs = lhs / rhs;
2615// }
2616
2617// RValue<Short4> operator%=(const Short4 &lhs, RValue<Short4> rhs)
2618// {
2619// return lhs = lhs % rhs;
2620// }
2621
2622 RValue<Short4> operator&=(const Short4 &lhs, RValue<Short4> rhs)
2623 {
2624 return lhs = lhs & rhs;
2625 }
2626
2627 RValue<Short4> operator|=(const Short4 &lhs, RValue<Short4> rhs)
2628 {
2629 return lhs = lhs | rhs;
2630 }
2631
2632 RValue<Short4> operator^=(const Short4 &lhs, RValue<Short4> rhs)
2633 {
2634 return lhs = lhs ^ rhs;
2635 }
2636
2637 RValue<Short4> operator<<=(const Short4 &lhs, unsigned char rhs)
2638 {
2639 return lhs = lhs << rhs;
2640 }
2641
2642 RValue<Short4> operator>>=(const Short4 &lhs, unsigned char rhs)
2643 {
2644 return lhs = lhs >> rhs;
2645 }
2646
2647 RValue<Short4> operator<<=(const Short4 &lhs, RValue<Long1> rhs)
2648 {
2649 return lhs = lhs << rhs;
2650 }
2651
2652 RValue<Short4> operator>>=(const Short4 &lhs, RValue<Long1> rhs)
2653 {
2654 return lhs = lhs >> rhs;
2655 }
2656
2657// RValue<Short4> operator+(RValue<Short4> val)
2658// {
2659// return val;
2660// }
2661
2662 RValue<Short4> operator-(RValue<Short4> val)
2663 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002664 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002665 }
2666
2667 RValue<Short4> operator~(RValue<Short4> val)
2668 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002669 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002670 }
2671
2672 RValue<Short4> RoundShort4(RValue<Float4> cast)
2673 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002674 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002675 }
2676
2677 RValue<Short4> Max(RValue<Short4> x, RValue<Short4> y)
2678 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002679 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002680 }
2681
2682 RValue<Short4> Min(RValue<Short4> x, RValue<Short4> y)
2683 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002684 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002685 }
2686
2687 RValue<Short4> AddSat(RValue<Short4> x, RValue<Short4> y)
2688 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002689 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002690 }
2691
2692 RValue<Short4> SubSat(RValue<Short4> x, RValue<Short4> y)
2693 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002694 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002695 }
2696
2697 RValue<Short4> MulHigh(RValue<Short4> x, RValue<Short4> y)
2698 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002699 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002700 }
2701
2702 RValue<Int2> MulAdd(RValue<Short4> x, RValue<Short4> y)
2703 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002704 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002705 }
2706
2707 RValue<SByte8> Pack(RValue<Short4> x, RValue<Short4> y)
2708 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002709 assert(false && "UNIMPLEMENTED"); return RValue<SByte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002710 }
2711
2712 RValue<Int2> UnpackLow(RValue<Short4> x, RValue<Short4> y)
2713 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002714 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002715 }
2716
2717 RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y)
2718 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002719 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002720 }
2721
2722 RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select)
2723 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002724 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002725 }
2726
2727 RValue<Short4> Insert(RValue<Short4> val, RValue<Short> element, int i)
2728 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002729 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002730 }
2731
2732 RValue<Short> Extract(RValue<Short4> val, int i)
2733 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002734 assert(false && "UNIMPLEMENTED"); return RValue<Short>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002735 }
2736
2737 RValue<Short4> CmpGT(RValue<Short4> x, RValue<Short4> y)
2738 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002739 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002740 }
2741
2742 RValue<Short4> CmpEQ(RValue<Short4> x, RValue<Short4> y)
2743 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002744 assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002745 }
2746
2747 Type *Short4::getType()
2748 {
2749 assert(false && "UNIMPLEMENTED"); return nullptr;
2750 }
2751
2752 UShort4::UShort4(RValue<Int4> cast)
2753 {
2754 *this = Short4(cast);
2755 }
2756
2757 UShort4::UShort4(RValue<Float4> cast, bool saturate)
2758 {
2759 assert(false && "UNIMPLEMENTED");
2760 }
2761
2762 UShort4::UShort4()
2763 {
2764 // xyzw.parent = this;
2765 }
2766
2767 UShort4::UShort4(unsigned short xyzw)
2768 {
2769 // xyzw.parent = this;
2770
2771 assert(false && "UNIMPLEMENTED");
2772 }
2773
2774 UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
2775 {
2776 // xyzw.parent = this;
2777
2778 assert(false && "UNIMPLEMENTED");
2779 }
2780
2781 UShort4::UShort4(RValue<UShort4> rhs)
2782 {
2783 // xyzw.parent = this;
2784
2785 storeValue(rhs.value);
2786 }
2787
2788 UShort4::UShort4(const UShort4 &rhs)
2789 {
2790 // xyzw.parent = this;
2791
2792 Value *value = rhs.loadValue();
2793 storeValue(value);
2794 }
2795
2796 UShort4::UShort4(const Reference<UShort4> &rhs)
2797 {
2798 // xyzw.parent = this;
2799
2800 Value *value = rhs.loadValue();
2801 storeValue(value);
2802 }
2803
2804 UShort4::UShort4(RValue<Short4> rhs)
2805 {
2806 // xyzw.parent = this;
2807
2808 storeValue(rhs.value);
2809 }
2810
2811 UShort4::UShort4(const Short4 &rhs)
2812 {
2813 // xyzw.parent = this;
2814
2815 Value *value = rhs.loadValue();
2816 storeValue(value);
2817 }
2818
2819 UShort4::UShort4(const Reference<Short4> &rhs)
2820 {
2821 // xyzw.parent = this;
2822
2823 Value *value = rhs.loadValue();
2824 storeValue(value);
2825 }
2826
2827 RValue<UShort4> UShort4::operator=(RValue<UShort4> rhs) const
2828 {
2829 storeValue(rhs.value);
2830
2831 return rhs;
2832 }
2833
2834 RValue<UShort4> UShort4::operator=(const UShort4 &rhs) const
2835 {
2836 Value *value = rhs.loadValue();
2837 storeValue(value);
2838
2839 return RValue<UShort4>(value);
2840 }
2841
2842 RValue<UShort4> UShort4::operator=(const Reference<UShort4> &rhs) const
2843 {
2844 Value *value = rhs.loadValue();
2845 storeValue(value);
2846
2847 return RValue<UShort4>(value);
2848 }
2849
2850 RValue<UShort4> UShort4::operator=(RValue<Short4> rhs) const
2851 {
2852 storeValue(rhs.value);
2853
2854 return RValue<UShort4>(rhs);
2855 }
2856
2857 RValue<UShort4> UShort4::operator=(const Short4 &rhs) const
2858 {
2859 Value *value = rhs.loadValue();
2860 storeValue(value);
2861
2862 return RValue<UShort4>(value);
2863 }
2864
2865 RValue<UShort4> UShort4::operator=(const Reference<Short4> &rhs) const
2866 {
2867 Value *value = rhs.loadValue();
2868 storeValue(value);
2869
2870 return RValue<UShort4>(value);
2871 }
2872
2873 RValue<UShort4> operator+(RValue<UShort4> lhs, RValue<UShort4> rhs)
2874 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002875 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002876 }
2877
2878 RValue<UShort4> operator-(RValue<UShort4> lhs, RValue<UShort4> rhs)
2879 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002880 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002881 }
2882
2883 RValue<UShort4> operator*(RValue<UShort4> lhs, RValue<UShort4> rhs)
2884 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002885 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002886 }
2887
2888 RValue<UShort4> operator<<(RValue<UShort4> lhs, unsigned char rhs)
2889 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002890 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002891 }
2892
2893 RValue<UShort4> operator>>(RValue<UShort4> lhs, unsigned char rhs)
2894 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002895 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002896 }
2897
2898 RValue<UShort4> operator<<(RValue<UShort4> lhs, RValue<Long1> rhs)
2899 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002900 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002901 }
2902
2903 RValue<UShort4> operator>>(RValue<UShort4> lhs, RValue<Long1> rhs)
2904 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002905 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002906 }
2907
2908 RValue<UShort4> operator<<=(const UShort4 &lhs, unsigned char rhs)
2909 {
2910 return lhs = lhs << rhs;
2911 }
2912
2913 RValue<UShort4> operator>>=(const UShort4 &lhs, unsigned char rhs)
2914 {
2915 return lhs = lhs >> rhs;
2916 }
2917
2918 RValue<UShort4> operator<<=(const UShort4 &lhs, RValue<Long1> rhs)
2919 {
2920 return lhs = lhs << rhs;
2921 }
2922
2923 RValue<UShort4> operator>>=(const UShort4 &lhs, RValue<Long1> rhs)
2924 {
2925 return lhs = lhs >> rhs;
2926 }
2927
2928 RValue<UShort4> operator~(RValue<UShort4> val)
2929 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002930 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002931 }
2932
2933 RValue<UShort4> Max(RValue<UShort4> x, RValue<UShort4> y)
2934 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002935 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002936 }
2937
2938 RValue<UShort4> Min(RValue<UShort4> x, RValue<UShort4> y)
2939 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002940 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002941 }
2942
2943 RValue<UShort4> AddSat(RValue<UShort4> x, RValue<UShort4> y)
2944 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002945 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002946 }
2947
2948 RValue<UShort4> SubSat(RValue<UShort4> x, RValue<UShort4> y)
2949 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002950 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002951 }
2952
2953 RValue<UShort4> MulHigh(RValue<UShort4> x, RValue<UShort4> y)
2954 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002955 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002956 }
2957
2958 RValue<UShort4> Average(RValue<UShort4> x, RValue<UShort4> y)
2959 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002960 assert(false && "UNIMPLEMENTED"); return RValue<UShort4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002961 }
2962
2963 RValue<Byte8> Pack(RValue<UShort4> x, RValue<UShort4> y)
2964 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04002965 assert(false && "UNIMPLEMENTED"); return RValue<Byte8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04002966 }
2967
2968 Type *UShort4::getType()
2969 {
2970 assert(false && "UNIMPLEMENTED"); return nullptr;
2971 }
2972
2973 Short8::Short8(short c0, short c1, short c2, short c3, short c4, short c5, short c6, short c7)
2974 {
2975 // xyzw.parent = this;
2976
2977 assert(false && "UNIMPLEMENTED");
2978 }
2979
2980 Short8::Short8(RValue<Short8> rhs)
2981 {
2982 // xyzw.parent = this;
2983
2984 storeValue(rhs.value);
2985 }
2986
2987 Short8::Short8(const Reference<Short8> &rhs)
2988 {
2989 // xyzw.parent = this;
2990
2991 Value *value = rhs.loadValue();
2992 storeValue(value);
2993 }
2994
2995 Short8::Short8(RValue<Short4> lo, RValue<Short4> hi)
2996 {
2997 assert(false && "UNIMPLEMENTED");
2998 }
2999
3000 RValue<Short8> operator+(RValue<Short8> lhs, RValue<Short8> rhs)
3001 {
3002 return RValue<Short8>(Nucleus::createAdd(lhs.value, rhs.value));
3003 }
3004
3005 RValue<Short8> operator&(RValue<Short8> lhs, RValue<Short8> rhs)
3006 {
3007 return RValue<Short8>(Nucleus::createAnd(lhs.value, rhs.value));
3008 }
3009
3010 RValue<Short8> operator<<(RValue<Short8> lhs, unsigned char rhs)
3011 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003012 assert(false && "UNIMPLEMENTED"); return RValue<Short8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003013 }
3014
3015 RValue<Short8> operator>>(RValue<Short8> lhs, unsigned char rhs)
3016 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003017 assert(false && "UNIMPLEMENTED"); return RValue<Short8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003018 }
3019
3020 RValue<Int4> MulAdd(RValue<Short8> x, RValue<Short8> y)
3021 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003022 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003023 }
3024
3025 RValue<Int4> Abs(RValue<Int4> x)
3026 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003027 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003028 }
3029
3030 RValue<Short8> MulHigh(RValue<Short8> x, RValue<Short8> y)
3031 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003032 assert(false && "UNIMPLEMENTED"); return RValue<Short8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003033 }
3034
3035 Type *Short8::getType()
3036 {
3037 assert(false && "UNIMPLEMENTED"); return nullptr;
3038 }
3039
3040 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)
3041 {
3042 // xyzw.parent = this;
3043
3044 assert(false && "UNIMPLEMENTED");
3045 }
3046
3047 UShort8::UShort8(RValue<UShort8> rhs)
3048 {
3049 // xyzw.parent = this;
3050
3051 storeValue(rhs.value);
3052 }
3053
3054 UShort8::UShort8(const Reference<UShort8> &rhs)
3055 {
3056 // xyzw.parent = this;
3057
3058 Value *value = rhs.loadValue();
3059 storeValue(value);
3060 }
3061
3062 UShort8::UShort8(RValue<UShort4> lo, RValue<UShort4> hi)
3063 {
3064 assert(false && "UNIMPLEMENTED");
3065 }
3066
3067 RValue<UShort8> UShort8::operator=(RValue<UShort8> rhs) const
3068 {
3069 storeValue(rhs.value);
3070
3071 return rhs;
3072 }
3073
3074 RValue<UShort8> UShort8::operator=(const UShort8 &rhs) const
3075 {
3076 Value *value = rhs.loadValue();
3077 storeValue(value);
3078
3079 return RValue<UShort8>(value);
3080 }
3081
3082 RValue<UShort8> UShort8::operator=(const Reference<UShort8> &rhs) const
3083 {
3084 Value *value = rhs.loadValue();
3085 storeValue(value);
3086
3087 return RValue<UShort8>(value);
3088 }
3089
3090 RValue<UShort8> operator&(RValue<UShort8> lhs, RValue<UShort8> rhs)
3091 {
3092 return RValue<UShort8>(Nucleus::createAnd(lhs.value, rhs.value));
3093 }
3094
3095 RValue<UShort8> operator<<(RValue<UShort8> lhs, unsigned char rhs)
3096 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003097 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003098 }
3099
3100 RValue<UShort8> operator>>(RValue<UShort8> lhs, unsigned char rhs)
3101 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003102 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003103 }
3104
3105 RValue<UShort8> operator+(RValue<UShort8> lhs, RValue<UShort8> rhs)
3106 {
3107 return RValue<UShort8>(Nucleus::createAdd(lhs.value, rhs.value));
3108 }
3109
3110 RValue<UShort8> operator*(RValue<UShort8> lhs, RValue<UShort8> rhs)
3111 {
3112 return RValue<UShort8>(Nucleus::createMul(lhs.value, rhs.value));
3113 }
3114
3115 RValue<UShort8> operator+=(const UShort8 &lhs, RValue<UShort8> rhs)
3116 {
3117 return lhs = lhs + rhs;
3118 }
3119
3120 RValue<UShort8> operator~(RValue<UShort8> val)
3121 {
3122 return RValue<UShort8>(Nucleus::createNot(val.value));
3123 }
3124
3125 RValue<UShort8> Swizzle(RValue<UShort8> x, char select0, char select1, char select2, char select3, char select4, char select5, char select6, char select7)
3126 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003127 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003128 }
3129
3130 RValue<UShort8> MulHigh(RValue<UShort8> x, RValue<UShort8> y)
3131 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003132 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003133 }
3134
3135 // FIXME: Implement as Shuffle(x, y, Select(i0, ..., i16)) and Shuffle(x, y, SELECT_PACK_REPEAT(element))
3136// RValue<UShort8> PackRepeat(RValue<Byte16> x, RValue<Byte16> y, int element)
3137// {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003138// assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003139// }
3140
3141 Type *UShort8::getType()
3142 {
3143 assert(false && "UNIMPLEMENTED"); return nullptr;
3144 }
3145
3146 Int::Int(Argument<Int> argument)
3147 {
3148 storeValue(argument.value);
3149 }
3150
3151 Int::Int(RValue<Byte> cast)
3152 {
3153 Value *integer = Nucleus::createZExt(cast.value, Int::getType());
3154
3155 storeValue(integer);
3156 }
3157
3158 Int::Int(RValue<SByte> cast)
3159 {
3160 Value *integer = Nucleus::createSExt(cast.value, Int::getType());
3161
3162 storeValue(integer);
3163 }
3164
3165 Int::Int(RValue<Short> cast)
3166 {
3167 Value *integer = Nucleus::createSExt(cast.value, Int::getType());
3168
3169 storeValue(integer);
3170 }
3171
3172 Int::Int(RValue<UShort> cast)
3173 {
3174 Value *integer = Nucleus::createZExt(cast.value, Int::getType());
3175
3176 storeValue(integer);
3177 }
3178
3179 Int::Int(RValue<Int2> cast)
3180 {
3181 *this = Extract(cast, 0);
3182 }
3183
3184 Int::Int(RValue<Long> cast)
3185 {
3186 Value *integer = Nucleus::createTrunc(cast.value, Int::getType());
3187
3188 storeValue(integer);
3189 }
3190
3191 Int::Int(RValue<Float> cast)
3192 {
3193 Value *integer = Nucleus::createFPToSI(cast.value, Int::getType());
3194
3195 storeValue(integer);
3196 }
3197
3198 Int::Int()
3199 {
3200 }
3201
3202 Int::Int(int x)
3203 {
3204 storeValue(Nucleus::createConstantInt(x));
3205 }
3206
3207 Int::Int(RValue<Int> rhs)
3208 {
3209 storeValue(rhs.value);
3210 }
3211
3212 Int::Int(RValue<UInt> rhs)
3213 {
3214 storeValue(rhs.value);
3215 }
3216
3217 Int::Int(const Int &rhs)
3218 {
3219 Value *value = rhs.loadValue();
3220 storeValue(value);
3221 }
3222
3223 Int::Int(const Reference<Int> &rhs)
3224 {
3225 Value *value = rhs.loadValue();
3226 storeValue(value);
3227 }
3228
3229 Int::Int(const UInt &rhs)
3230 {
3231 Value *value = rhs.loadValue();
3232 storeValue(value);
3233 }
3234
3235 Int::Int(const Reference<UInt> &rhs)
3236 {
3237 Value *value = rhs.loadValue();
3238 storeValue(value);
3239 }
3240
3241 RValue<Int> Int::operator=(int rhs) const
3242 {
3243 return RValue<Int>(storeValue(Nucleus::createConstantInt(rhs)));
3244 }
3245
3246 RValue<Int> Int::operator=(RValue<Int> rhs) const
3247 {
3248 storeValue(rhs.value);
3249
3250 return rhs;
3251 }
3252
3253 RValue<Int> Int::operator=(RValue<UInt> rhs) const
3254 {
3255 storeValue(rhs.value);
3256
3257 return RValue<Int>(rhs);
3258 }
3259
3260 RValue<Int> Int::operator=(const Int &rhs) const
3261 {
3262 Value *value = rhs.loadValue();
3263 storeValue(value);
3264
3265 return RValue<Int>(value);
3266 }
3267
3268 RValue<Int> Int::operator=(const Reference<Int> &rhs) const
3269 {
3270 Value *value = rhs.loadValue();
3271 storeValue(value);
3272
3273 return RValue<Int>(value);
3274 }
3275
3276 RValue<Int> Int::operator=(const UInt &rhs) const
3277 {
3278 Value *value = rhs.loadValue();
3279 storeValue(value);
3280
3281 return RValue<Int>(value);
3282 }
3283
3284 RValue<Int> Int::operator=(const Reference<UInt> &rhs) const
3285 {
3286 Value *value = rhs.loadValue();
3287 storeValue(value);
3288
3289 return RValue<Int>(value);
3290 }
3291
3292 RValue<Int> operator+(RValue<Int> lhs, RValue<Int> rhs)
3293 {
3294 return RValue<Int>(Nucleus::createAdd(lhs.value, rhs.value));
3295 }
3296
3297 RValue<Int> operator-(RValue<Int> lhs, RValue<Int> rhs)
3298 {
3299 return RValue<Int>(Nucleus::createSub(lhs.value, rhs.value));
3300 }
3301
3302 RValue<Int> operator*(RValue<Int> lhs, RValue<Int> rhs)
3303 {
3304 return RValue<Int>(Nucleus::createMul(lhs.value, rhs.value));
3305 }
3306
3307 RValue<Int> operator/(RValue<Int> lhs, RValue<Int> rhs)
3308 {
3309 return RValue<Int>(Nucleus::createSDiv(lhs.value, rhs.value));
3310 }
3311
3312 RValue<Int> operator%(RValue<Int> lhs, RValue<Int> rhs)
3313 {
3314 return RValue<Int>(Nucleus::createSRem(lhs.value, rhs.value));
3315 }
3316
3317 RValue<Int> operator&(RValue<Int> lhs, RValue<Int> rhs)
3318 {
3319 return RValue<Int>(Nucleus::createAnd(lhs.value, rhs.value));
3320 }
3321
3322 RValue<Int> operator|(RValue<Int> lhs, RValue<Int> rhs)
3323 {
3324 return RValue<Int>(Nucleus::createOr(lhs.value, rhs.value));
3325 }
3326
3327 RValue<Int> operator^(RValue<Int> lhs, RValue<Int> rhs)
3328 {
3329 return RValue<Int>(Nucleus::createXor(lhs.value, rhs.value));
3330 }
3331
3332 RValue<Int> operator<<(RValue<Int> lhs, RValue<Int> rhs)
3333 {
3334 return RValue<Int>(Nucleus::createShl(lhs.value, rhs.value));
3335 }
3336
3337 RValue<Int> operator>>(RValue<Int> lhs, RValue<Int> rhs)
3338 {
3339 return RValue<Int>(Nucleus::createAShr(lhs.value, rhs.value));
3340 }
3341
3342 RValue<Int> operator+=(const Int &lhs, RValue<Int> rhs)
3343 {
3344 return lhs = lhs + rhs;
3345 }
3346
3347 RValue<Int> operator-=(const Int &lhs, RValue<Int> rhs)
3348 {
3349 return lhs = lhs - rhs;
3350 }
3351
3352 RValue<Int> operator*=(const Int &lhs, RValue<Int> rhs)
3353 {
3354 return lhs = lhs * rhs;
3355 }
3356
3357 RValue<Int> operator/=(const Int &lhs, RValue<Int> rhs)
3358 {
3359 return lhs = lhs / rhs;
3360 }
3361
3362 RValue<Int> operator%=(const Int &lhs, RValue<Int> rhs)
3363 {
3364 return lhs = lhs % rhs;
3365 }
3366
3367 RValue<Int> operator&=(const Int &lhs, RValue<Int> rhs)
3368 {
3369 return lhs = lhs & rhs;
3370 }
3371
3372 RValue<Int> operator|=(const Int &lhs, RValue<Int> rhs)
3373 {
3374 return lhs = lhs | rhs;
3375 }
3376
3377 RValue<Int> operator^=(const Int &lhs, RValue<Int> rhs)
3378 {
3379 return lhs = lhs ^ rhs;
3380 }
3381
3382 RValue<Int> operator<<=(const Int &lhs, RValue<Int> rhs)
3383 {
3384 return lhs = lhs << rhs;
3385 }
3386
3387 RValue<Int> operator>>=(const Int &lhs, RValue<Int> rhs)
3388 {
3389 return lhs = lhs >> rhs;
3390 }
3391
3392 RValue<Int> operator+(RValue<Int> val)
3393 {
3394 return val;
3395 }
3396
3397 RValue<Int> operator-(RValue<Int> val)
3398 {
3399 return RValue<Int>(Nucleus::createNeg(val.value));
3400 }
3401
3402 RValue<Int> operator~(RValue<Int> val)
3403 {
3404 return RValue<Int>(Nucleus::createNot(val.value));
3405 }
3406
3407 RValue<Int> operator++(const Int &val, int) // Post-increment
3408 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003409 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003410 }
3411
3412 const Int &operator++(const Int &val) // Pre-increment
3413 {
3414 assert(false && "UNIMPLEMENTED"); return val;
3415 }
3416
3417 RValue<Int> operator--(const Int &val, int) // Post-decrement
3418 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003419 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003420 }
3421
3422 const Int &operator--(const Int &val) // Pre-decrement
3423 {
3424 assert(false && "UNIMPLEMENTED"); return val;
3425 }
3426
3427 RValue<Bool> operator<(RValue<Int> lhs, RValue<Int> rhs)
3428 {
3429 return RValue<Bool>(Nucleus::createICmpSLT(lhs.value, rhs.value));
3430 }
3431
3432 RValue<Bool> operator<=(RValue<Int> lhs, RValue<Int> rhs)
3433 {
3434 return RValue<Bool>(Nucleus::createICmpSLE(lhs.value, rhs.value));
3435 }
3436
3437 RValue<Bool> operator>(RValue<Int> lhs, RValue<Int> rhs)
3438 {
3439 return RValue<Bool>(Nucleus::createICmpSGT(lhs.value, rhs.value));
3440 }
3441
3442 RValue<Bool> operator>=(RValue<Int> lhs, RValue<Int> rhs)
3443 {
3444 return RValue<Bool>(Nucleus::createICmpSGE(lhs.value, rhs.value));
3445 }
3446
3447 RValue<Bool> operator!=(RValue<Int> lhs, RValue<Int> rhs)
3448 {
3449 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
3450 }
3451
3452 RValue<Bool> operator==(RValue<Int> lhs, RValue<Int> rhs)
3453 {
3454 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
3455 }
3456
3457 RValue<Int> Max(RValue<Int> x, RValue<Int> y)
3458 {
3459 return IfThenElse(x > y, x, y);
3460 }
3461
3462 RValue<Int> Min(RValue<Int> x, RValue<Int> y)
3463 {
3464 return IfThenElse(x < y, x, y);
3465 }
3466
3467 RValue<Int> Clamp(RValue<Int> x, RValue<Int> min, RValue<Int> max)
3468 {
3469 return Min(Max(x, min), max);
3470 }
3471
3472 RValue<Int> RoundInt(RValue<Float> cast)
3473 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003474 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003475 }
3476
3477 Type *Int::getType()
3478 {
3479 return T(Ice::IceType_i32);
3480 }
3481
3482 Long::Long(RValue<Int> cast)
3483 {
3484 Value *integer = Nucleus::createSExt(cast.value, Long::getType());
3485
3486 storeValue(integer);
3487 }
3488
3489 Long::Long(RValue<UInt> cast)
3490 {
3491 Value *integer = Nucleus::createZExt(cast.value, Long::getType());
3492
3493 storeValue(integer);
3494 }
3495
3496 Long::Long()
3497 {
3498 }
3499
3500 Long::Long(RValue<Long> rhs)
3501 {
3502 storeValue(rhs.value);
3503 }
3504
3505 RValue<Long> Long::operator=(int64_t rhs) const
3506 {
3507 return RValue<Long>(storeValue(Nucleus::createConstantInt(rhs)));
3508 }
3509
3510 RValue<Long> Long::operator=(RValue<Long> rhs) const
3511 {
3512 storeValue(rhs.value);
3513
3514 return rhs;
3515 }
3516
3517 RValue<Long> Long::operator=(const Long &rhs) const
3518 {
3519 Value *value = rhs.loadValue();
3520 storeValue(value);
3521
3522 return RValue<Long>(value);
3523 }
3524
3525 RValue<Long> Long::operator=(const Reference<Long> &rhs) const
3526 {
3527 Value *value = rhs.loadValue();
3528 storeValue(value);
3529
3530 return RValue<Long>(value);
3531 }
3532
3533 RValue<Long> operator+(RValue<Long> lhs, RValue<Long> rhs)
3534 {
3535 return RValue<Long>(Nucleus::createAdd(lhs.value, rhs.value));
3536 }
3537
3538 RValue<Long> operator-(RValue<Long> lhs, RValue<Long> rhs)
3539 {
3540 return RValue<Long>(Nucleus::createSub(lhs.value, rhs.value));
3541 }
3542
3543 RValue<Long> operator+=(const Long &lhs, RValue<Long> rhs)
3544 {
3545 return lhs = lhs + rhs;
3546 }
3547
3548 RValue<Long> operator-=(const Long &lhs, RValue<Long> rhs)
3549 {
3550 return lhs = lhs - rhs;
3551 }
3552
3553 RValue<Long> AddAtomic(RValue<Pointer<Long> > x, RValue<Long> y)
3554 {
3555 return RValue<Long>(Nucleus::createAtomicAdd(x.value, y.value));
3556 }
3557
3558 Type *Long::getType()
3559 {
3560 assert(false && "UNIMPLEMENTED"); return nullptr;
3561 }
3562
3563 Long1::Long1(const RValue<UInt> cast)
3564 {
3565 assert(false && "UNIMPLEMENTED");
3566 }
3567
3568 Long1::Long1(RValue<Long1> rhs)
3569 {
3570 storeValue(rhs.value);
3571 }
3572
3573 Type *Long1::getType()
3574 {
3575 assert(false && "UNIMPLEMENTED"); return nullptr;
3576 }
3577
3578 RValue<Long2> UnpackHigh(RValue<Long2> x, RValue<Long2> y)
3579 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003580 assert(false && "UNIMPLEMENTED"); return RValue<Long2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003581 }
3582
3583 Type *Long2::getType()
3584 {
3585 assert(false && "UNIMPLEMENTED"); return nullptr;
3586 }
3587
3588 UInt::UInt(Argument<UInt> argument)
3589 {
3590 storeValue(argument.value);
3591 }
3592
3593 UInt::UInt(RValue<UShort> cast)
3594 {
3595 Value *integer = Nucleus::createZExt(cast.value, UInt::getType());
3596
3597 storeValue(integer);
3598 }
3599
3600 UInt::UInt(RValue<Long> cast)
3601 {
3602 Value *integer = Nucleus::createTrunc(cast.value, UInt::getType());
3603
3604 storeValue(integer);
3605 }
3606
3607 UInt::UInt(RValue<Float> cast)
3608 {
3609 assert(false && "UNIMPLEMENTED");
3610 }
3611
3612 UInt::UInt()
3613 {
3614 }
3615
3616 UInt::UInt(int x)
3617 {
3618 storeValue(Nucleus::createConstantInt(x));
3619 }
3620
3621 UInt::UInt(unsigned int x)
3622 {
3623 storeValue(Nucleus::createConstantInt(x));
3624 }
3625
3626 UInt::UInt(RValue<UInt> rhs)
3627 {
3628 storeValue(rhs.value);
3629 }
3630
3631 UInt::UInt(RValue<Int> rhs)
3632 {
3633 storeValue(rhs.value);
3634 }
3635
3636 UInt::UInt(const UInt &rhs)
3637 {
3638 Value *value = rhs.loadValue();
3639 storeValue(value);
3640 }
3641
3642 UInt::UInt(const Reference<UInt> &rhs)
3643 {
3644 Value *value = rhs.loadValue();
3645 storeValue(value);
3646 }
3647
3648 UInt::UInt(const Int &rhs)
3649 {
3650 Value *value = rhs.loadValue();
3651 storeValue(value);
3652 }
3653
3654 UInt::UInt(const Reference<Int> &rhs)
3655 {
3656 Value *value = rhs.loadValue();
3657 storeValue(value);
3658 }
3659
3660 RValue<UInt> UInt::operator=(unsigned int rhs) const
3661 {
3662 return RValue<UInt>(storeValue(Nucleus::createConstantInt(rhs)));
3663 }
3664
3665 RValue<UInt> UInt::operator=(RValue<UInt> rhs) const
3666 {
3667 storeValue(rhs.value);
3668
3669 return rhs;
3670 }
3671
3672 RValue<UInt> UInt::operator=(RValue<Int> rhs) const
3673 {
3674 storeValue(rhs.value);
3675
3676 return RValue<UInt>(rhs);
3677 }
3678
3679 RValue<UInt> UInt::operator=(const UInt &rhs) const
3680 {
3681 Value *value = rhs.loadValue();
3682 storeValue(value);
3683
3684 return RValue<UInt>(value);
3685 }
3686
3687 RValue<UInt> UInt::operator=(const Reference<UInt> &rhs) const
3688 {
3689 Value *value = rhs.loadValue();
3690 storeValue(value);
3691
3692 return RValue<UInt>(value);
3693 }
3694
3695 RValue<UInt> UInt::operator=(const Int &rhs) const
3696 {
3697 Value *value = rhs.loadValue();
3698 storeValue(value);
3699
3700 return RValue<UInt>(value);
3701 }
3702
3703 RValue<UInt> UInt::operator=(const Reference<Int> &rhs) const
3704 {
3705 Value *value = rhs.loadValue();
3706 storeValue(value);
3707
3708 return RValue<UInt>(value);
3709 }
3710
3711 RValue<UInt> operator+(RValue<UInt> lhs, RValue<UInt> rhs)
3712 {
3713 return RValue<UInt>(Nucleus::createAdd(lhs.value, rhs.value));
3714 }
3715
3716 RValue<UInt> operator-(RValue<UInt> lhs, RValue<UInt> rhs)
3717 {
3718 return RValue<UInt>(Nucleus::createSub(lhs.value, rhs.value));
3719 }
3720
3721 RValue<UInt> operator*(RValue<UInt> lhs, RValue<UInt> rhs)
3722 {
3723 return RValue<UInt>(Nucleus::createMul(lhs.value, rhs.value));
3724 }
3725
3726 RValue<UInt> operator/(RValue<UInt> lhs, RValue<UInt> rhs)
3727 {
3728 return RValue<UInt>(Nucleus::createUDiv(lhs.value, rhs.value));
3729 }
3730
3731 RValue<UInt> operator%(RValue<UInt> lhs, RValue<UInt> rhs)
3732 {
3733 return RValue<UInt>(Nucleus::createURem(lhs.value, rhs.value));
3734 }
3735
3736 RValue<UInt> operator&(RValue<UInt> lhs, RValue<UInt> rhs)
3737 {
3738 return RValue<UInt>(Nucleus::createAnd(lhs.value, rhs.value));
3739 }
3740
3741 RValue<UInt> operator|(RValue<UInt> lhs, RValue<UInt> rhs)
3742 {
3743 return RValue<UInt>(Nucleus::createOr(lhs.value, rhs.value));
3744 }
3745
3746 RValue<UInt> operator^(RValue<UInt> lhs, RValue<UInt> rhs)
3747 {
3748 return RValue<UInt>(Nucleus::createXor(lhs.value, rhs.value));
3749 }
3750
3751 RValue<UInt> operator<<(RValue<UInt> lhs, RValue<UInt> rhs)
3752 {
3753 return RValue<UInt>(Nucleus::createShl(lhs.value, rhs.value));
3754 }
3755
3756 RValue<UInt> operator>>(RValue<UInt> lhs, RValue<UInt> rhs)
3757 {
3758 return RValue<UInt>(Nucleus::createLShr(lhs.value, rhs.value));
3759 }
3760
3761 RValue<UInt> operator+=(const UInt &lhs, RValue<UInt> rhs)
3762 {
3763 return lhs = lhs + rhs;
3764 }
3765
3766 RValue<UInt> operator-=(const UInt &lhs, RValue<UInt> rhs)
3767 {
3768 return lhs = lhs - rhs;
3769 }
3770
3771 RValue<UInt> operator*=(const UInt &lhs, RValue<UInt> rhs)
3772 {
3773 return lhs = lhs * rhs;
3774 }
3775
3776 RValue<UInt> operator/=(const UInt &lhs, RValue<UInt> rhs)
3777 {
3778 return lhs = lhs / rhs;
3779 }
3780
3781 RValue<UInt> operator%=(const UInt &lhs, RValue<UInt> rhs)
3782 {
3783 return lhs = lhs % rhs;
3784 }
3785
3786 RValue<UInt> operator&=(const UInt &lhs, RValue<UInt> rhs)
3787 {
3788 return lhs = lhs & rhs;
3789 }
3790
3791 RValue<UInt> operator|=(const UInt &lhs, RValue<UInt> rhs)
3792 {
3793 return lhs = lhs | rhs;
3794 }
3795
3796 RValue<UInt> operator^=(const UInt &lhs, RValue<UInt> rhs)
3797 {
3798 return lhs = lhs ^ rhs;
3799 }
3800
3801 RValue<UInt> operator<<=(const UInt &lhs, RValue<UInt> rhs)
3802 {
3803 return lhs = lhs << rhs;
3804 }
3805
3806 RValue<UInt> operator>>=(const UInt &lhs, RValue<UInt> rhs)
3807 {
3808 return lhs = lhs >> rhs;
3809 }
3810
3811 RValue<UInt> operator+(RValue<UInt> val)
3812 {
3813 return val;
3814 }
3815
3816 RValue<UInt> operator-(RValue<UInt> val)
3817 {
3818 return RValue<UInt>(Nucleus::createNeg(val.value));
3819 }
3820
3821 RValue<UInt> operator~(RValue<UInt> val)
3822 {
3823 return RValue<UInt>(Nucleus::createNot(val.value));
3824 }
3825
3826 RValue<UInt> operator++(const UInt &val, int) // Post-increment
3827 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003828 assert(false && "UNIMPLEMENTED"); return RValue<UInt>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003829 }
3830
3831 const UInt &operator++(const UInt &val) // Pre-increment
3832 {
3833 assert(false && "UNIMPLEMENTED"); return val;
3834 }
3835
3836 RValue<UInt> operator--(const UInt &val, int) // Post-decrement
3837 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003838 assert(false && "UNIMPLEMENTED"); return RValue<UInt>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003839 }
3840
3841 const UInt &operator--(const UInt &val) // Pre-decrement
3842 {
3843 assert(false && "UNIMPLEMENTED"); return val;
3844 }
3845
3846 RValue<UInt> Max(RValue<UInt> x, RValue<UInt> y)
3847 {
3848 return IfThenElse(x > y, x, y);
3849 }
3850
3851 RValue<UInt> Min(RValue<UInt> x, RValue<UInt> y)
3852 {
3853 return IfThenElse(x < y, x, y);
3854 }
3855
3856 RValue<UInt> Clamp(RValue<UInt> x, RValue<UInt> min, RValue<UInt> max)
3857 {
3858 return Min(Max(x, min), max);
3859 }
3860
3861 RValue<Bool> operator<(RValue<UInt> lhs, RValue<UInt> rhs)
3862 {
3863 return RValue<Bool>(Nucleus::createICmpULT(lhs.value, rhs.value));
3864 }
3865
3866 RValue<Bool> operator<=(RValue<UInt> lhs, RValue<UInt> rhs)
3867 {
3868 return RValue<Bool>(Nucleus::createICmpULE(lhs.value, rhs.value));
3869 }
3870
3871 RValue<Bool> operator>(RValue<UInt> lhs, RValue<UInt> rhs)
3872 {
3873 return RValue<Bool>(Nucleus::createICmpUGT(lhs.value, rhs.value));
3874 }
3875
3876 RValue<Bool> operator>=(RValue<UInt> lhs, RValue<UInt> rhs)
3877 {
3878 return RValue<Bool>(Nucleus::createICmpUGE(lhs.value, rhs.value));
3879 }
3880
3881 RValue<Bool> operator!=(RValue<UInt> lhs, RValue<UInt> rhs)
3882 {
3883 return RValue<Bool>(Nucleus::createICmpNE(lhs.value, rhs.value));
3884 }
3885
3886 RValue<Bool> operator==(RValue<UInt> lhs, RValue<UInt> rhs)
3887 {
3888 return RValue<Bool>(Nucleus::createICmpEQ(lhs.value, rhs.value));
3889 }
3890
3891// RValue<UInt> RoundUInt(RValue<Float> cast)
3892// {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003893// assert(false && "UNIMPLEMENTED"); return RValue<UInt>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003894// }
3895
3896 Type *UInt::getType()
3897 {
3898 assert(false && "UNIMPLEMENTED"); return nullptr;
3899 }
3900
3901// Int2::Int2(RValue<Int> cast)
3902// {
3903// Value *extend = Nucleus::createZExt(cast.value, Long::getType());
3904// Value *vector = Nucleus::createBitCast(extend, Int2::getType());
3905//
3906// Constant *shuffle[2];
3907// shuffle[0] = Nucleus::createConstantInt(0);
3908// shuffle[1] = Nucleus::createConstantInt(0);
3909//
3910// Value *replicate = Nucleus::createShuffleVector(vector, UndefValue::get(Int2::getType()), Nucleus::createConstantVector(shuffle, 2));
3911//
3912// storeValue(replicate);
3913// }
3914
3915 Int2::Int2(RValue<Int4> cast)
3916 {
3917 Value *long2 = Nucleus::createBitCast(cast.value, Long2::getType());
3918 Value *element = Nucleus::createExtractElement(long2, 0);
3919 Value *int2 = Nucleus::createBitCast(element, Int2::getType());
3920
3921 storeValue(int2);
3922 }
3923
3924 Int2::Int2()
3925 {
3926 // xy.parent = this;
3927 }
3928
3929 Int2::Int2(int x, int y)
3930 {
3931 // xy.parent = this;
3932
3933 assert(false && "UNIMPLEMENTED");
3934 }
3935
3936 Int2::Int2(RValue<Int2> rhs)
3937 {
3938 // xy.parent = this;
3939
3940 storeValue(rhs.value);
3941 }
3942
3943 Int2::Int2(const Int2 &rhs)
3944 {
3945 // xy.parent = this;
3946
3947 Value *value = rhs.loadValue();
3948 storeValue(value);
3949 }
3950
3951 Int2::Int2(const Reference<Int2> &rhs)
3952 {
3953 // xy.parent = this;
3954
3955 Value *value = rhs.loadValue();
3956 storeValue(value);
3957 }
3958
3959 Int2::Int2(RValue<Int> lo, RValue<Int> hi)
3960 {
3961 assert(false && "UNIMPLEMENTED");
3962 }
3963
3964 RValue<Int2> Int2::operator=(RValue<Int2> rhs) const
3965 {
3966 storeValue(rhs.value);
3967
3968 return rhs;
3969 }
3970
3971 RValue<Int2> Int2::operator=(const Int2 &rhs) const
3972 {
3973 Value *value = rhs.loadValue();
3974 storeValue(value);
3975
3976 return RValue<Int2>(value);
3977 }
3978
3979 RValue<Int2> Int2::operator=(const Reference<Int2> &rhs) const
3980 {
3981 Value *value = rhs.loadValue();
3982 storeValue(value);
3983
3984 return RValue<Int2>(value);
3985 }
3986
3987 RValue<Int2> operator+(RValue<Int2> lhs, RValue<Int2> rhs)
3988 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003989 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003990 }
3991
3992 RValue<Int2> operator-(RValue<Int2> lhs, RValue<Int2> rhs)
3993 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04003994 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04003995 }
3996
3997// RValue<Int2> operator*(RValue<Int2> lhs, RValue<Int2> rhs)
3998// {
3999// return RValue<Int2>(Nucleus::createMul(lhs.value, rhs.value));
4000// }
4001
4002// RValue<Int2> operator/(RValue<Int2> lhs, RValue<Int2> rhs)
4003// {
4004// return RValue<Int2>(Nucleus::createSDiv(lhs.value, rhs.value));
4005// }
4006
4007// RValue<Int2> operator%(RValue<Int2> lhs, RValue<Int2> rhs)
4008// {
4009// return RValue<Int2>(Nucleus::createSRem(lhs.value, rhs.value));
4010// }
4011
4012 RValue<Int2> operator&(RValue<Int2> lhs, RValue<Int2> rhs)
4013 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004014 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004015 }
4016
4017 RValue<Int2> operator|(RValue<Int2> lhs, RValue<Int2> rhs)
4018 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004019 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004020 }
4021
4022 RValue<Int2> operator^(RValue<Int2> lhs, RValue<Int2> rhs)
4023 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004024 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004025 }
4026
4027 RValue<Int2> operator<<(RValue<Int2> lhs, unsigned char rhs)
4028 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004029 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004030 }
4031
4032 RValue<Int2> operator>>(RValue<Int2> lhs, unsigned char rhs)
4033 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004034 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004035 }
4036
4037 RValue<Int2> operator<<(RValue<Int2> lhs, RValue<Long1> rhs)
4038 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004039 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004040 }
4041
4042 RValue<Int2> operator>>(RValue<Int2> lhs, RValue<Long1> rhs)
4043 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004044 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004045 }
4046
4047 RValue<Int2> operator+=(const Int2 &lhs, RValue<Int2> rhs)
4048 {
4049 return lhs = lhs + rhs;
4050 }
4051
4052 RValue<Int2> operator-=(const Int2 &lhs, RValue<Int2> rhs)
4053 {
4054 return lhs = lhs - rhs;
4055 }
4056
4057// RValue<Int2> operator*=(const Int2 &lhs, RValue<Int2> rhs)
4058// {
4059// return lhs = lhs * rhs;
4060// }
4061
4062// RValue<Int2> operator/=(const Int2 &lhs, RValue<Int2> rhs)
4063// {
4064// return lhs = lhs / rhs;
4065// }
4066
4067// RValue<Int2> operator%=(const Int2 &lhs, RValue<Int2> rhs)
4068// {
4069// return lhs = lhs % rhs;
4070// }
4071
4072 RValue<Int2> operator&=(const Int2 &lhs, RValue<Int2> rhs)
4073 {
4074 return lhs = lhs & rhs;
4075 }
4076
4077 RValue<Int2> operator|=(const Int2 &lhs, RValue<Int2> rhs)
4078 {
4079 return lhs = lhs | rhs;
4080 }
4081
4082 RValue<Int2> operator^=(const Int2 &lhs, RValue<Int2> rhs)
4083 {
4084 return lhs = lhs ^ rhs;
4085 }
4086
4087 RValue<Int2> operator<<=(const Int2 &lhs, unsigned char rhs)
4088 {
4089 return lhs = lhs << rhs;
4090 }
4091
4092 RValue<Int2> operator>>=(const Int2 &lhs, unsigned char rhs)
4093 {
4094 return lhs = lhs >> rhs;
4095 }
4096
4097 RValue<Int2> operator<<=(const Int2 &lhs, RValue<Long1> rhs)
4098 {
4099 return lhs = lhs << rhs;
4100 }
4101
4102 RValue<Int2> operator>>=(const Int2 &lhs, RValue<Long1> rhs)
4103 {
4104 return lhs = lhs >> rhs;
4105 }
4106
4107// RValue<Int2> operator+(RValue<Int2> val)
4108// {
4109// return val;
4110// }
4111
4112// RValue<Int2> operator-(RValue<Int2> val)
4113// {
4114// return RValue<Int2>(Nucleus::createNeg(val.value));
4115// }
4116
4117 RValue<Int2> operator~(RValue<Int2> val)
4118 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004119 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004120 }
4121
4122 RValue<Long1> UnpackLow(RValue<Int2> x, RValue<Int2> y)
4123 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004124 assert(false && "UNIMPLEMENTED"); return RValue<Long1>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004125 }
4126
4127 RValue<Long1> UnpackHigh(RValue<Int2> x, RValue<Int2> y)
4128 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004129 assert(false && "UNIMPLEMENTED"); return RValue<Long1>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004130 }
4131
4132 RValue<Int> Extract(RValue<Int2> val, int i)
4133 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004134 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004135 }
4136
4137 RValue<Int2> Insert(RValue<Int2> val, RValue<Int> element, int i)
4138 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004139 assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004140 }
4141
4142 Type *Int2::getType()
4143 {
4144 assert(false && "UNIMPLEMENTED"); return nullptr;
4145 }
4146
4147 UInt2::UInt2()
4148 {
4149 // xy.parent = this;
4150 }
4151
4152 UInt2::UInt2(unsigned int x, unsigned int y)
4153 {
4154 // xy.parent = this;
4155
4156 assert(false && "UNIMPLEMENTED");
4157 }
4158
4159 UInt2::UInt2(RValue<UInt2> rhs)
4160 {
4161 // xy.parent = this;
4162
4163 storeValue(rhs.value);
4164 }
4165
4166 UInt2::UInt2(const UInt2 &rhs)
4167 {
4168 // xy.parent = this;
4169
4170 Value *value = rhs.loadValue();
4171 storeValue(value);
4172 }
4173
4174 UInt2::UInt2(const Reference<UInt2> &rhs)
4175 {
4176 // xy.parent = this;
4177
4178 Value *value = rhs.loadValue();
4179 storeValue(value);
4180 }
4181
4182 RValue<UInt2> UInt2::operator=(RValue<UInt2> rhs) const
4183 {
4184 storeValue(rhs.value);
4185
4186 return rhs;
4187 }
4188
4189 RValue<UInt2> UInt2::operator=(const UInt2 &rhs) const
4190 {
4191 Value *value = rhs.loadValue();
4192 storeValue(value);
4193
4194 return RValue<UInt2>(value);
4195 }
4196
4197 RValue<UInt2> UInt2::operator=(const Reference<UInt2> &rhs) const
4198 {
4199 Value *value = rhs.loadValue();
4200 storeValue(value);
4201
4202 return RValue<UInt2>(value);
4203 }
4204
4205 RValue<UInt2> operator+(RValue<UInt2> lhs, RValue<UInt2> rhs)
4206 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004207 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004208 }
4209
4210 RValue<UInt2> operator-(RValue<UInt2> lhs, RValue<UInt2> rhs)
4211 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004212 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004213 }
4214
4215// RValue<UInt2> operator*(RValue<UInt2> lhs, RValue<UInt2> rhs)
4216// {
4217// return RValue<UInt2>(Nucleus::createMul(lhs.value, rhs.value));
4218// }
4219
4220// RValue<UInt2> operator/(RValue<UInt2> lhs, RValue<UInt2> rhs)
4221// {
4222// return RValue<UInt2>(Nucleus::createUDiv(lhs.value, rhs.value));
4223// }
4224
4225// RValue<UInt2> operator%(RValue<UInt2> lhs, RValue<UInt2> rhs)
4226// {
4227// return RValue<UInt2>(Nucleus::createURem(lhs.value, rhs.value));
4228// }
4229
4230 RValue<UInt2> operator&(RValue<UInt2> lhs, RValue<UInt2> rhs)
4231 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004232 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004233 }
4234
4235 RValue<UInt2> operator|(RValue<UInt2> lhs, RValue<UInt2> rhs)
4236 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004237 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004238 }
4239
4240 RValue<UInt2> operator^(RValue<UInt2> lhs, RValue<UInt2> rhs)
4241 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004242 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004243 }
4244
4245 RValue<UInt2> operator<<(RValue<UInt2> lhs, unsigned char rhs)
4246 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004247 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004248 }
4249
4250 RValue<UInt2> operator>>(RValue<UInt2> lhs, unsigned char rhs)
4251 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004252 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004253 }
4254
4255 RValue<UInt2> operator<<(RValue<UInt2> lhs, RValue<Long1> rhs)
4256 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004257 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004258 }
4259
4260 RValue<UInt2> operator>>(RValue<UInt2> lhs, RValue<Long1> rhs)
4261 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004262 assert(false && "UNIMPLEMENTED"); return RValue<UInt2>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004263 }
4264
4265 RValue<UInt2> operator+=(const UInt2 &lhs, RValue<UInt2> rhs)
4266 {
4267 return lhs = lhs + rhs;
4268 }
4269
4270 RValue<UInt2> operator-=(const UInt2 &lhs, RValue<UInt2> rhs)
4271 {
4272 return lhs = lhs - rhs;
4273 }
4274
4275// RValue<UInt2> operator*=(const UInt2 &lhs, RValue<UInt2> rhs)
4276// {
4277// return lhs = lhs * rhs;
4278// }
4279
4280// RValue<UInt2> operator/=(const UInt2 &lhs, RValue<UInt2> rhs)
4281// {
4282// return lhs = lhs / rhs;
4283// }
4284
4285// RValue<UInt2> operator%=(const UInt2 &lhs, RValue<UInt2> rhs)
4286// {
4287// return lhs = lhs % rhs;
4288// }
4289
4290 RValue<UInt2> operator&=(const UInt2 &lhs, RValue<UInt2> rhs)
4291 {
4292 return lhs = lhs & rhs;
4293 }
4294
4295 RValue<UInt2> operator|=(const UInt2 &lhs, RValue<UInt2> rhs)
4296 {
4297 return lhs = lhs | rhs;
4298 }
4299
4300 RValue<UInt2> operator^=(const UInt2 &lhs, RValue<UInt2> rhs)
4301 {
4302 return lhs = lhs ^ rhs;
4303 }
4304
4305 RValue<UInt2> operator<<=(const UInt2 &lhs, unsigned char rhs)
4306 {
4307 return lhs = lhs << rhs;
4308 }
4309
4310 RValue<UInt2> operator>>=(const UInt2 &lhs, unsigned char rhs)
4311 {
4312 return lhs = lhs >> rhs;
4313 }
4314
4315 RValue<UInt2> operator<<=(const UInt2 &lhs, RValue<Long1> rhs)
4316 {
4317 return lhs = lhs << rhs;
4318 }
4319
4320 RValue<UInt2> operator>>=(const UInt2 &lhs, RValue<Long1> rhs)
4321 {
4322 return lhs = lhs >> rhs;
4323 }
4324
4325// RValue<UInt2> operator+(RValue<UInt2> val)
4326// {
4327// return val;
4328// }
4329
4330// RValue<UInt2> operator-(RValue<UInt2> val)
4331// {
4332// return RValue<UInt2>(Nucleus::createNeg(val.value));
4333// }
4334
4335 RValue<UInt2> operator~(RValue<UInt2> val)
4336 {
4337 return RValue<UInt2>(Nucleus::createNot(val.value));
4338 }
4339
4340 Type *UInt2::getType()
4341 {
4342 assert(false && "UNIMPLEMENTED"); return nullptr;
4343 }
4344
4345 Int4::Int4(RValue<Byte4> cast)
4346 {
4347 assert(false && "UNIMPLEMENTED");
4348 }
4349
4350 Int4::Int4(RValue<SByte4> cast)
4351 {
4352 assert(false && "UNIMPLEMENTED");
4353 }
4354
4355 Int4::Int4(RValue<Float4> cast)
4356 {
4357 // xyzw.parent = this;
4358
4359 Value *xyzw = Nucleus::createFPToSI(cast.value, Int4::getType());
4360
4361 storeValue(xyzw);
4362 }
4363
4364 Int4::Int4(RValue<Short4> cast)
4365 {
4366 assert(false && "UNIMPLEMENTED");
4367 }
4368
4369 Int4::Int4(RValue<UShort4> cast)
4370 {
4371 assert(false && "UNIMPLEMENTED");
4372 }
4373
4374 Int4::Int4()
4375 {
4376 // xyzw.parent = this;
4377 }
4378
4379 Int4::Int4(int xyzw)
4380 {
4381 constant(xyzw, xyzw, xyzw, xyzw);
4382 }
4383
4384 Int4::Int4(int x, int yzw)
4385 {
4386 constant(x, yzw, yzw, yzw);
4387 }
4388
4389 Int4::Int4(int x, int y, int zw)
4390 {
4391 constant(x, y, zw, zw);
4392 }
4393
4394 Int4::Int4(int x, int y, int z, int w)
4395 {
4396 constant(x, y, z, w);
4397 }
4398
4399 void Int4::constant(int x, int y, int z, int w)
4400 {
4401 // xyzw.parent = this;
4402
4403 Constant *constantVector[4];
4404 constantVector[0] = Nucleus::createConstantInt(x);
4405 constantVector[1] = Nucleus::createConstantInt(y);
4406 constantVector[2] = Nucleus::createConstantInt(z);
4407 constantVector[3] = Nucleus::createConstantInt(w);
4408
4409 storeValue(Nucleus::createConstantVector(constantVector, 4));
4410 }
4411
4412 Int4::Int4(RValue<Int4> rhs)
4413 {
4414 // xyzw.parent = this;
4415
4416 storeValue(rhs.value);
4417 }
4418
4419 Int4::Int4(const Int4 &rhs)
4420 {
4421 // xyzw.parent = this;
4422
4423 Value *value = rhs.loadValue();
4424 storeValue(value);
4425 }
4426
4427 Int4::Int4(const Reference<Int4> &rhs)
4428 {
4429 // xyzw.parent = this;
4430
4431 Value *value = rhs.loadValue();
4432 storeValue(value);
4433 }
4434
4435 Int4::Int4(RValue<UInt4> rhs)
4436 {
4437 // xyzw.parent = this;
4438
4439 storeValue(rhs.value);
4440 }
4441
4442 Int4::Int4(const UInt4 &rhs)
4443 {
4444 // xyzw.parent = this;
4445
4446 Value *value = rhs.loadValue();
4447 storeValue(value);
4448 }
4449
4450 Int4::Int4(const Reference<UInt4> &rhs)
4451 {
4452 // xyzw.parent = this;
4453
4454 Value *value = rhs.loadValue();
4455 storeValue(value);
4456 }
4457
4458 Int4::Int4(RValue<Int2> lo, RValue<Int2> hi)
4459 {
4460 assert(false && "UNIMPLEMENTED");
4461 }
4462
4463 Int4::Int4(RValue<Int> rhs)
4464 {
4465 // xyzw.parent = this;
4466
4467 assert(false && "UNIMPLEMENTED");
4468 }
4469
4470 Int4::Int4(const Int &rhs)
4471 {
4472 // xyzw.parent = this;
4473
4474 *this = RValue<Int>(rhs.loadValue());
4475 }
4476
4477 Int4::Int4(const Reference<Int> &rhs)
4478 {
4479 // xyzw.parent = this;
4480
4481 *this = RValue<Int>(rhs.loadValue());
4482 }
4483
4484 RValue<Int4> Int4::operator=(RValue<Int4> rhs) const
4485 {
4486 storeValue(rhs.value);
4487
4488 return rhs;
4489 }
4490
4491 RValue<Int4> Int4::operator=(const Int4 &rhs) const
4492 {
4493 Value *value = rhs.loadValue();
4494 storeValue(value);
4495
4496 return RValue<Int4>(value);
4497 }
4498
4499 RValue<Int4> Int4::operator=(const Reference<Int4> &rhs) const
4500 {
4501 Value *value = rhs.loadValue();
4502 storeValue(value);
4503
4504 return RValue<Int4>(value);
4505 }
4506
4507 RValue<Int4> operator+(RValue<Int4> lhs, RValue<Int4> rhs)
4508 {
4509 return RValue<Int4>(Nucleus::createAdd(lhs.value, rhs.value));
4510 }
4511
4512 RValue<Int4> operator-(RValue<Int4> lhs, RValue<Int4> rhs)
4513 {
4514 return RValue<Int4>(Nucleus::createSub(lhs.value, rhs.value));
4515 }
4516
4517 RValue<Int4> operator*(RValue<Int4> lhs, RValue<Int4> rhs)
4518 {
4519 return RValue<Int4>(Nucleus::createMul(lhs.value, rhs.value));
4520 }
4521
4522 RValue<Int4> operator/(RValue<Int4> lhs, RValue<Int4> rhs)
4523 {
4524 return RValue<Int4>(Nucleus::createSDiv(lhs.value, rhs.value));
4525 }
4526
4527 RValue<Int4> operator%(RValue<Int4> lhs, RValue<Int4> rhs)
4528 {
4529 return RValue<Int4>(Nucleus::createSRem(lhs.value, rhs.value));
4530 }
4531
4532 RValue<Int4> operator&(RValue<Int4> lhs, RValue<Int4> rhs)
4533 {
4534 return RValue<Int4>(Nucleus::createAnd(lhs.value, rhs.value));
4535 }
4536
4537 RValue<Int4> operator|(RValue<Int4> lhs, RValue<Int4> rhs)
4538 {
4539 return RValue<Int4>(Nucleus::createOr(lhs.value, rhs.value));
4540 }
4541
4542 RValue<Int4> operator^(RValue<Int4> lhs, RValue<Int4> rhs)
4543 {
4544 return RValue<Int4>(Nucleus::createXor(lhs.value, rhs.value));
4545 }
4546
4547 RValue<Int4> operator<<(RValue<Int4> lhs, unsigned char rhs)
4548 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004549 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004550 }
4551
4552 RValue<Int4> operator>>(RValue<Int4> lhs, unsigned char rhs)
4553 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004554 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004555 }
4556
4557 RValue<Int4> operator<<(RValue<Int4> lhs, RValue<Int4> rhs)
4558 {
4559 return RValue<Int4>(Nucleus::createShl(lhs.value, rhs.value));
4560 }
4561
4562 RValue<Int4> operator>>(RValue<Int4> lhs, RValue<Int4> rhs)
4563 {
4564 return RValue<Int4>(Nucleus::createAShr(lhs.value, rhs.value));
4565 }
4566
4567 RValue<Int4> operator+=(const Int4 &lhs, RValue<Int4> rhs)
4568 {
4569 return lhs = lhs + rhs;
4570 }
4571
4572 RValue<Int4> operator-=(const Int4 &lhs, RValue<Int4> rhs)
4573 {
4574 return lhs = lhs - rhs;
4575 }
4576
4577 RValue<Int4> operator*=(const Int4 &lhs, RValue<Int4> rhs)
4578 {
4579 return lhs = lhs * rhs;
4580 }
4581
4582// RValue<Int4> operator/=(const Int4 &lhs, RValue<Int4> rhs)
4583// {
4584// return lhs = lhs / rhs;
4585// }
4586
4587// RValue<Int4> operator%=(const Int4 &lhs, RValue<Int4> rhs)
4588// {
4589// return lhs = lhs % rhs;
4590// }
4591
4592 RValue<Int4> operator&=(const Int4 &lhs, RValue<Int4> rhs)
4593 {
4594 return lhs = lhs & rhs;
4595 }
4596
4597 RValue<Int4> operator|=(const Int4 &lhs, RValue<Int4> rhs)
4598 {
4599 return lhs = lhs | rhs;
4600 }
4601
4602 RValue<Int4> operator^=(const Int4 &lhs, RValue<Int4> rhs)
4603 {
4604 return lhs = lhs ^ rhs;
4605 }
4606
4607 RValue<Int4> operator<<=(const Int4 &lhs, unsigned char rhs)
4608 {
4609 return lhs = lhs << rhs;
4610 }
4611
4612 RValue<Int4> operator>>=(const Int4 &lhs, unsigned char rhs)
4613 {
4614 return lhs = lhs >> rhs;
4615 }
4616
4617 RValue<Int4> operator+(RValue<Int4> val)
4618 {
4619 return val;
4620 }
4621
4622 RValue<Int4> operator-(RValue<Int4> val)
4623 {
4624 return RValue<Int4>(Nucleus::createNeg(val.value));
4625 }
4626
4627 RValue<Int4> operator~(RValue<Int4> val)
4628 {
4629 return RValue<Int4>(Nucleus::createNot(val.value));
4630 }
4631
4632 RValue<Int4> CmpEQ(RValue<Int4> x, RValue<Int4> y)
4633 {
4634 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpEQ(x.value, y.value), Int4::getType()));
4635 }
4636
4637 RValue<Int4> CmpLT(RValue<Int4> x, RValue<Int4> y)
4638 {
4639 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpSLT(x.value, y.value), Int4::getType()));
4640 }
4641
4642 RValue<Int4> CmpLE(RValue<Int4> x, RValue<Int4> y)
4643 {
4644 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpSLE(x.value, y.value), Int4::getType()));
4645 }
4646
4647 RValue<Int4> CmpNEQ(RValue<Int4> x, RValue<Int4> y)
4648 {
4649 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpNE(x.value, y.value), Int4::getType()));
4650 }
4651
4652 RValue<Int4> CmpNLT(RValue<Int4> x, RValue<Int4> y)
4653 {
4654 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpSGE(x.value, y.value), Int4::getType()));
4655 }
4656
4657 RValue<Int4> CmpNLE(RValue<Int4> x, RValue<Int4> y)
4658 {
4659 return RValue<Int4>(Nucleus::createSExt(Nucleus::createICmpSGT(x.value, y.value), Int4::getType()));
4660 }
4661
4662 RValue<Int4> Max(RValue<Int4> x, RValue<Int4> y)
4663 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004664 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004665 }
4666
4667 RValue<Int4> Min(RValue<Int4> x, RValue<Int4> y)
4668 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004669 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004670 }
4671
4672 RValue<Int4> RoundInt(RValue<Float4> cast)
4673 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004674 assert(false && "UNIMPLEMENTED"); return RValue<Int4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004675 }
4676
4677 RValue<Short8> Pack(RValue<Int4> x, RValue<Int4> y)
4678 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004679 assert(false && "UNIMPLEMENTED"); return RValue<Short8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004680 }
4681
4682 RValue<Int> Extract(RValue<Int4> x, int i)
4683 {
4684 return RValue<Int>(Nucleus::createExtractElement(x.value, i));
4685 }
4686
4687 RValue<Int4> Insert(RValue<Int4> x, RValue<Int> element, int i)
4688 {
4689 return RValue<Int4>(Nucleus::createInsertElement(x.value, element.value, i));
4690 }
4691
4692 RValue<Int> SignMask(RValue<Int4> x)
4693 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004694 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004695 }
4696
4697 RValue<Int4> Swizzle(RValue<Int4> x, unsigned char select)
4698 {
4699 return RValue<Int4>(Nucleus::createSwizzle(x.value, select));
4700 }
4701
4702 Type *Int4::getType()
4703 {
4704 assert(false && "UNIMPLEMENTED"); return nullptr;
4705 }
4706
4707 UInt4::UInt4(RValue<Float4> cast)
4708 {
4709 // xyzw.parent = this;
4710
4711 assert(false && "UNIMPLEMENTED");
4712 }
4713
4714 UInt4::UInt4()
4715 {
4716 // xyzw.parent = this;
4717 }
4718
4719 UInt4::UInt4(int xyzw)
4720 {
4721 constant(xyzw, xyzw, xyzw, xyzw);
4722 }
4723
4724 UInt4::UInt4(int x, int yzw)
4725 {
4726 constant(x, yzw, yzw, yzw);
4727 }
4728
4729 UInt4::UInt4(int x, int y, int zw)
4730 {
4731 constant(x, y, zw, zw);
4732 }
4733
4734 UInt4::UInt4(int x, int y, int z, int w)
4735 {
4736 constant(x, y, z, w);
4737 }
4738
4739 void UInt4::constant(int x, int y, int z, int w)
4740 {
4741 // xyzw.parent = this;
4742
4743 Constant *constantVector[4];
4744 constantVector[0] = Nucleus::createConstantInt(x);
4745 constantVector[1] = Nucleus::createConstantInt(y);
4746 constantVector[2] = Nucleus::createConstantInt(z);
4747 constantVector[3] = Nucleus::createConstantInt(w);
4748
4749 storeValue(Nucleus::createConstantVector(constantVector, 4));
4750 }
4751
4752 UInt4::UInt4(RValue<UInt4> rhs)
4753 {
4754 // xyzw.parent = this;
4755
4756 storeValue(rhs.value);
4757 }
4758
4759 UInt4::UInt4(const UInt4 &rhs)
4760 {
4761 // xyzw.parent = this;
4762
4763 Value *value = rhs.loadValue();
4764 storeValue(value);
4765 }
4766
4767 UInt4::UInt4(const Reference<UInt4> &rhs)
4768 {
4769 // xyzw.parent = this;
4770
4771 Value *value = rhs.loadValue();
4772 storeValue(value);
4773 }
4774
4775 UInt4::UInt4(RValue<Int4> rhs)
4776 {
4777 // xyzw.parent = this;
4778
4779 storeValue(rhs.value);
4780 }
4781
4782 UInt4::UInt4(const Int4 &rhs)
4783 {
4784 // xyzw.parent = this;
4785
4786 Value *value = rhs.loadValue();
4787 storeValue(value);
4788 }
4789
4790 UInt4::UInt4(const Reference<Int4> &rhs)
4791 {
4792 // xyzw.parent = this;
4793
4794 Value *value = rhs.loadValue();
4795 storeValue(value);
4796 }
4797
4798 UInt4::UInt4(RValue<UInt2> lo, RValue<UInt2> hi)
4799 {
4800 assert(false && "UNIMPLEMENTED");
4801 }
4802
4803 RValue<UInt4> UInt4::operator=(RValue<UInt4> rhs) const
4804 {
4805 storeValue(rhs.value);
4806
4807 return rhs;
4808 }
4809
4810 RValue<UInt4> UInt4::operator=(const UInt4 &rhs) const
4811 {
4812 Value *value = rhs.loadValue();
4813 storeValue(value);
4814
4815 return RValue<UInt4>(value);
4816 }
4817
4818 RValue<UInt4> UInt4::operator=(const Reference<UInt4> &rhs) const
4819 {
4820 Value *value = rhs.loadValue();
4821 storeValue(value);
4822
4823 return RValue<UInt4>(value);
4824 }
4825
4826 RValue<UInt4> operator+(RValue<UInt4> lhs, RValue<UInt4> rhs)
4827 {
4828 return RValue<UInt4>(Nucleus::createAdd(lhs.value, rhs.value));
4829 }
4830
4831 RValue<UInt4> operator-(RValue<UInt4> lhs, RValue<UInt4> rhs)
4832 {
4833 return RValue<UInt4>(Nucleus::createSub(lhs.value, rhs.value));
4834 }
4835
4836 RValue<UInt4> operator*(RValue<UInt4> lhs, RValue<UInt4> rhs)
4837 {
4838 return RValue<UInt4>(Nucleus::createMul(lhs.value, rhs.value));
4839 }
4840
4841 RValue<UInt4> operator/(RValue<UInt4> lhs, RValue<UInt4> rhs)
4842 {
4843 return RValue<UInt4>(Nucleus::createUDiv(lhs.value, rhs.value));
4844 }
4845
4846 RValue<UInt4> operator%(RValue<UInt4> lhs, RValue<UInt4> rhs)
4847 {
4848 return RValue<UInt4>(Nucleus::createURem(lhs.value, rhs.value));
4849 }
4850
4851 RValue<UInt4> operator&(RValue<UInt4> lhs, RValue<UInt4> rhs)
4852 {
4853 return RValue<UInt4>(Nucleus::createAnd(lhs.value, rhs.value));
4854 }
4855
4856 RValue<UInt4> operator|(RValue<UInt4> lhs, RValue<UInt4> rhs)
4857 {
4858 return RValue<UInt4>(Nucleus::createOr(lhs.value, rhs.value));
4859 }
4860
4861 RValue<UInt4> operator^(RValue<UInt4> lhs, RValue<UInt4> rhs)
4862 {
4863 return RValue<UInt4>(Nucleus::createXor(lhs.value, rhs.value));
4864 }
4865
4866 RValue<UInt4> operator<<(RValue<UInt4> lhs, unsigned char rhs)
4867 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004868 assert(false && "UNIMPLEMENTED"); return RValue<UInt4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004869 }
4870
4871 RValue<UInt4> operator>>(RValue<UInt4> lhs, unsigned char rhs)
4872 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004873 assert(false && "UNIMPLEMENTED"); return RValue<UInt4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004874 }
4875
4876 RValue<UInt4> operator<<(RValue<UInt4> lhs, RValue<UInt4> rhs)
4877 {
4878 return RValue<UInt4>(Nucleus::createShl(lhs.value, rhs.value));
4879 }
4880
4881 RValue<UInt4> operator>>(RValue<UInt4> lhs, RValue<UInt4> rhs)
4882 {
4883 return RValue<UInt4>(Nucleus::createLShr(lhs.value, rhs.value));
4884 }
4885
4886 RValue<UInt4> operator+=(const UInt4 &lhs, RValue<UInt4> rhs)
4887 {
4888 return lhs = lhs + rhs;
4889 }
4890
4891 RValue<UInt4> operator-=(const UInt4 &lhs, RValue<UInt4> rhs)
4892 {
4893 return lhs = lhs - rhs;
4894 }
4895
4896 RValue<UInt4> operator*=(const UInt4 &lhs, RValue<UInt4> rhs)
4897 {
4898 return lhs = lhs * rhs;
4899 }
4900
4901// RValue<UInt4> operator/=(const UInt4 &lhs, RValue<UInt4> rhs)
4902// {
4903// return lhs = lhs / rhs;
4904// }
4905
4906// RValue<UInt4> operator%=(const UInt4 &lhs, RValue<UInt4> rhs)
4907// {
4908// return lhs = lhs % rhs;
4909// }
4910
4911 RValue<UInt4> operator&=(const UInt4 &lhs, RValue<UInt4> rhs)
4912 {
4913 return lhs = lhs & rhs;
4914 }
4915
4916 RValue<UInt4> operator|=(const UInt4 &lhs, RValue<UInt4> rhs)
4917 {
4918 return lhs = lhs | rhs;
4919 }
4920
4921 RValue<UInt4> operator^=(const UInt4 &lhs, RValue<UInt4> rhs)
4922 {
4923 return lhs = lhs ^ rhs;
4924 }
4925
4926 RValue<UInt4> operator<<=(const UInt4 &lhs, unsigned char rhs)
4927 {
4928 return lhs = lhs << rhs;
4929 }
4930
4931 RValue<UInt4> operator>>=(const UInt4 &lhs, unsigned char rhs)
4932 {
4933 return lhs = lhs >> rhs;
4934 }
4935
4936 RValue<UInt4> operator+(RValue<UInt4> val)
4937 {
4938 return val;
4939 }
4940
4941 RValue<UInt4> operator-(RValue<UInt4> val)
4942 {
4943 return RValue<UInt4>(Nucleus::createNeg(val.value));
4944 }
4945
4946 RValue<UInt4> operator~(RValue<UInt4> val)
4947 {
4948 return RValue<UInt4>(Nucleus::createNot(val.value));
4949 }
4950
4951 RValue<UInt4> CmpEQ(RValue<UInt4> x, RValue<UInt4> y)
4952 {
4953 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpEQ(x.value, y.value), Int4::getType()));
4954 }
4955
4956 RValue<UInt4> CmpLT(RValue<UInt4> x, RValue<UInt4> y)
4957 {
4958 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpULT(x.value, y.value), Int4::getType()));
4959 }
4960
4961 RValue<UInt4> CmpLE(RValue<UInt4> x, RValue<UInt4> y)
4962 {
4963 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpULE(x.value, y.value), Int4::getType()));
4964 }
4965
4966 RValue<UInt4> CmpNEQ(RValue<UInt4> x, RValue<UInt4> y)
4967 {
4968 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpNE(x.value, y.value), Int4::getType()));
4969 }
4970
4971 RValue<UInt4> CmpNLT(RValue<UInt4> x, RValue<UInt4> y)
4972 {
4973 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpUGE(x.value, y.value), Int4::getType()));
4974 }
4975
4976 RValue<UInt4> CmpNLE(RValue<UInt4> x, RValue<UInt4> y)
4977 {
4978 return RValue<UInt4>(Nucleus::createSExt(Nucleus::createICmpUGT(x.value, y.value), Int4::getType()));
4979 }
4980
4981 RValue<UInt4> Max(RValue<UInt4> x, RValue<UInt4> y)
4982 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004983 assert(false && "UNIMPLEMENTED"); return RValue<UInt4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004984 }
4985
4986 RValue<UInt4> Min(RValue<UInt4> x, RValue<UInt4> y)
4987 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004988 assert(false && "UNIMPLEMENTED"); return RValue<UInt4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004989 }
4990
4991 RValue<UShort8> Pack(RValue<UInt4> x, RValue<UInt4> y)
4992 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04004993 assert(false && "UNIMPLEMENTED"); return RValue<UShort8>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04004994 }
4995
4996 Type *UInt4::getType()
4997 {
4998 assert(false && "UNIMPLEMENTED"); return nullptr;
4999 }
5000
5001 Float::Float(RValue<Int> cast)
5002 {
5003 Value *integer = Nucleus::createSIToFP(cast.value, Float::getType());
5004
5005 storeValue(integer);
5006 }
5007
5008 Float::Float()
5009 {
5010 }
5011
5012 Float::Float(float x)
5013 {
5014 storeValue(Nucleus::createConstantFloat(x));
5015 }
5016
5017 Float::Float(RValue<Float> rhs)
5018 {
5019 storeValue(rhs.value);
5020 }
5021
5022 Float::Float(const Float &rhs)
5023 {
5024 Value *value = rhs.loadValue();
5025 storeValue(value);
5026 }
5027
5028 Float::Float(const Reference<Float> &rhs)
5029 {
5030 Value *value = rhs.loadValue();
5031 storeValue(value);
5032 }
5033
5034 RValue<Float> Float::operator=(RValue<Float> rhs) const
5035 {
5036 storeValue(rhs.value);
5037
5038 return rhs;
5039 }
5040
5041 RValue<Float> Float::operator=(const Float &rhs) const
5042 {
5043 Value *value = rhs.loadValue();
5044 storeValue(value);
5045
5046 return RValue<Float>(value);
5047 }
5048
5049 RValue<Float> Float::operator=(const Reference<Float> &rhs) const
5050 {
5051 Value *value = rhs.loadValue();
5052 storeValue(value);
5053
5054 return RValue<Float>(value);
5055 }
5056
5057 RValue<Float> operator+(RValue<Float> lhs, RValue<Float> rhs)
5058 {
5059 return RValue<Float>(Nucleus::createFAdd(lhs.value, rhs.value));
5060 }
5061
5062 RValue<Float> operator-(RValue<Float> lhs, RValue<Float> rhs)
5063 {
5064 return RValue<Float>(Nucleus::createFSub(lhs.value, rhs.value));
5065 }
5066
5067 RValue<Float> operator*(RValue<Float> lhs, RValue<Float> rhs)
5068 {
5069 return RValue<Float>(Nucleus::createFMul(lhs.value, rhs.value));
5070 }
5071
5072 RValue<Float> operator/(RValue<Float> lhs, RValue<Float> rhs)
5073 {
5074 return RValue<Float>(Nucleus::createFDiv(lhs.value, rhs.value));
5075 }
5076
5077 RValue<Float> operator+=(const Float &lhs, RValue<Float> rhs)
5078 {
5079 return lhs = lhs + rhs;
5080 }
5081
5082 RValue<Float> operator-=(const Float &lhs, RValue<Float> rhs)
5083 {
5084 return lhs = lhs - rhs;
5085 }
5086
5087 RValue<Float> operator*=(const Float &lhs, RValue<Float> rhs)
5088 {
5089 return lhs = lhs * rhs;
5090 }
5091
5092 RValue<Float> operator/=(const Float &lhs, RValue<Float> rhs)
5093 {
5094 return lhs = lhs / rhs;
5095 }
5096
5097 RValue<Float> operator+(RValue<Float> val)
5098 {
5099 return val;
5100 }
5101
5102 RValue<Float> operator-(RValue<Float> val)
5103 {
5104 return RValue<Float>(Nucleus::createFNeg(val.value));
5105 }
5106
5107 RValue<Bool> operator<(RValue<Float> lhs, RValue<Float> rhs)
5108 {
5109 return RValue<Bool>(Nucleus::createFCmpOLT(lhs.value, rhs.value));
5110 }
5111
5112 RValue<Bool> operator<=(RValue<Float> lhs, RValue<Float> rhs)
5113 {
5114 return RValue<Bool>(Nucleus::createFCmpOLE(lhs.value, rhs.value));
5115 }
5116
5117 RValue<Bool> operator>(RValue<Float> lhs, RValue<Float> rhs)
5118 {
5119 return RValue<Bool>(Nucleus::createFCmpOGT(lhs.value, rhs.value));
5120 }
5121
5122 RValue<Bool> operator>=(RValue<Float> lhs, RValue<Float> rhs)
5123 {
5124 return RValue<Bool>(Nucleus::createFCmpOGE(lhs.value, rhs.value));
5125 }
5126
5127 RValue<Bool> operator!=(RValue<Float> lhs, RValue<Float> rhs)
5128 {
5129 return RValue<Bool>(Nucleus::createFCmpONE(lhs.value, rhs.value));
5130 }
5131
5132 RValue<Bool> operator==(RValue<Float> lhs, RValue<Float> rhs)
5133 {
5134 return RValue<Bool>(Nucleus::createFCmpOEQ(lhs.value, rhs.value));
5135 }
5136
5137 RValue<Float> Abs(RValue<Float> x)
5138 {
5139 return IfThenElse(x > 0.0f, x, -x);
5140 }
5141
5142 RValue<Float> Max(RValue<Float> x, RValue<Float> y)
5143 {
5144 return IfThenElse(x > y, x, y);
5145 }
5146
5147 RValue<Float> Min(RValue<Float> x, RValue<Float> y)
5148 {
5149 return IfThenElse(x < y, x, y);
5150 }
5151
5152 RValue<Float> Rcp_pp(RValue<Float> x, bool exactAtPow2)
5153 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005154 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005155 }
5156
5157 RValue<Float> RcpSqrt_pp(RValue<Float> x)
5158 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005159 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005160 }
5161
5162 RValue<Float> Sqrt(RValue<Float> x)
5163 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005164 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005165 }
5166
5167 RValue<Float> Round(RValue<Float> x)
5168 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005169 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005170 }
5171
5172 RValue<Float> Trunc(RValue<Float> x)
5173 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005174 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005175 }
5176
5177 RValue<Float> Frac(RValue<Float> x)
5178 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005179 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005180 }
5181
5182 RValue<Float> Floor(RValue<Float> x)
5183 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005184 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005185 }
5186
5187 RValue<Float> Ceil(RValue<Float> x)
5188 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005189 assert(false && "UNIMPLEMENTED"); return RValue<Float>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005190 }
5191
5192 Type *Float::getType()
5193 {
5194 assert(false && "UNIMPLEMENTED"); return nullptr;
5195 }
5196
5197 Float2::Float2(RValue<Float4> cast)
5198 {
5199 // xyzw.parent = this;
5200
5201 Value *int64x2 = Nucleus::createBitCast(cast.value, Long2::getType());
5202 Value *int64 = Nucleus::createExtractElement(int64x2, 0);
5203 Value *float2 = Nucleus::createBitCast(int64, Float2::getType());
5204
5205 storeValue(float2);
5206 }
5207
5208 Type *Float2::getType()
5209 {
5210 assert(false && "UNIMPLEMENTED"); return nullptr;
5211 }
5212
5213 Float4::Float4(RValue<Byte4> cast)
5214 {
5215 xyzw.parent = this;
5216
5217 assert(false && "UNIMPLEMENTED");
5218 }
5219
5220 Float4::Float4(RValue<SByte4> cast)
5221 {
5222 xyzw.parent = this;
5223
5224 assert(false && "UNIMPLEMENTED");
5225 }
5226
5227 Float4::Float4(RValue<Short4> cast)
5228 {
5229 xyzw.parent = this;
5230
5231 Int4 c(cast);
5232 storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
5233 }
5234
5235 Float4::Float4(RValue<UShort4> cast)
5236 {
5237 xyzw.parent = this;
5238
5239 Int4 c(cast);
5240 storeValue(Nucleus::createSIToFP(RValue<Int4>(c).value, Float4::getType()));
5241 }
5242
5243 Float4::Float4(RValue<Int4> cast)
5244 {
5245 xyzw.parent = this;
5246
5247 Value *xyzw = Nucleus::createSIToFP(cast.value, Float4::getType());
5248
5249 storeValue(xyzw);
5250 }
5251
5252 Float4::Float4(RValue<UInt4> cast)
5253 {
5254 xyzw.parent = this;
5255
5256 Value *xyzw = Nucleus::createUIToFP(cast.value, Float4::getType());
5257
5258 storeValue(xyzw);
5259 }
5260
5261 Float4::Float4()
5262 {
5263 xyzw.parent = this;
5264 }
5265
5266 Float4::Float4(float xyzw)
5267 {
5268 constant(xyzw, xyzw, xyzw, xyzw);
5269 }
5270
5271 Float4::Float4(float x, float yzw)
5272 {
5273 constant(x, yzw, yzw, yzw);
5274 }
5275
5276 Float4::Float4(float x, float y, float zw)
5277 {
5278 constant(x, y, zw, zw);
5279 }
5280
5281 Float4::Float4(float x, float y, float z, float w)
5282 {
5283 constant(x, y, z, w);
5284 }
5285
5286 void Float4::constant(float x, float y, float z, float w)
5287 {
5288 xyzw.parent = this;
5289
5290 Constant *constantVector[4];
5291 constantVector[0] = Nucleus::createConstantFloat(x);
5292 constantVector[1] = Nucleus::createConstantFloat(y);
5293 constantVector[2] = Nucleus::createConstantFloat(z);
5294 constantVector[3] = Nucleus::createConstantFloat(w);
5295
5296 storeValue(Nucleus::createConstantVector(constantVector, 4));
5297 }
5298
5299 Float4::Float4(RValue<Float4> rhs)
5300 {
5301 xyzw.parent = this;
5302
5303 storeValue(rhs.value);
5304 }
5305
5306 Float4::Float4(const Float4 &rhs)
5307 {
5308 xyzw.parent = this;
5309
5310 Value *value = rhs.loadValue();
5311 storeValue(value);
5312 }
5313
5314 Float4::Float4(const Reference<Float4> &rhs)
5315 {
5316 xyzw.parent = this;
5317
5318 Value *value = rhs.loadValue();
5319 storeValue(value);
5320 }
5321
5322 Float4::Float4(RValue<Float> rhs)
5323 {
5324 xyzw.parent = this;
5325
5326 assert(false && "UNIMPLEMENTED");
5327 }
5328
5329 Float4::Float4(const Float &rhs)
5330 {
5331 xyzw.parent = this;
5332
5333 *this = RValue<Float>(rhs.loadValue());
5334 }
5335
5336 Float4::Float4(const Reference<Float> &rhs)
5337 {
5338 xyzw.parent = this;
5339
5340 *this = RValue<Float>(rhs.loadValue());
5341 }
5342
5343 RValue<Float4> Float4::operator=(float x) const
5344 {
5345 return *this = Float4(x, x, x, x);
5346 }
5347
5348 RValue<Float4> Float4::operator=(RValue<Float4> rhs) const
5349 {
5350 storeValue(rhs.value);
5351
5352 return rhs;
5353 }
5354
5355 RValue<Float4> Float4::operator=(const Float4 &rhs) const
5356 {
5357 Value *value = rhs.loadValue();
5358 storeValue(value);
5359
5360 return RValue<Float4>(value);
5361 }
5362
5363 RValue<Float4> Float4::operator=(const Reference<Float4> &rhs) const
5364 {
5365 Value *value = rhs.loadValue();
5366 storeValue(value);
5367
5368 return RValue<Float4>(value);
5369 }
5370
5371 RValue<Float4> Float4::operator=(RValue<Float> rhs) const
5372 {
5373 return *this = Float4(rhs);
5374 }
5375
5376 RValue<Float4> Float4::operator=(const Float &rhs) const
5377 {
5378 return *this = Float4(rhs);
5379 }
5380
5381 RValue<Float4> Float4::operator=(const Reference<Float> &rhs) const
5382 {
5383 return *this = Float4(rhs);
5384 }
5385
5386 RValue<Float4> operator+(RValue<Float4> lhs, RValue<Float4> rhs)
5387 {
5388 return RValue<Float4>(Nucleus::createFAdd(lhs.value, rhs.value));
5389 }
5390
5391 RValue<Float4> operator-(RValue<Float4> lhs, RValue<Float4> rhs)
5392 {
5393 return RValue<Float4>(Nucleus::createFSub(lhs.value, rhs.value));
5394 }
5395
5396 RValue<Float4> operator*(RValue<Float4> lhs, RValue<Float4> rhs)
5397 {
5398 return RValue<Float4>(Nucleus::createFMul(lhs.value, rhs.value));
5399 }
5400
5401 RValue<Float4> operator/(RValue<Float4> lhs, RValue<Float4> rhs)
5402 {
5403 return RValue<Float4>(Nucleus::createFDiv(lhs.value, rhs.value));
5404 }
5405
5406 RValue<Float4> operator%(RValue<Float4> lhs, RValue<Float4> rhs)
5407 {
5408 return RValue<Float4>(Nucleus::createFRem(lhs.value, rhs.value));
5409 }
5410
5411 RValue<Float4> operator+=(const Float4 &lhs, RValue<Float4> rhs)
5412 {
5413 return lhs = lhs + rhs;
5414 }
5415
5416 RValue<Float4> operator-=(const Float4 &lhs, RValue<Float4> rhs)
5417 {
5418 return lhs = lhs - rhs;
5419 }
5420
5421 RValue<Float4> operator*=(const Float4 &lhs, RValue<Float4> rhs)
5422 {
5423 return lhs = lhs * rhs;
5424 }
5425
5426 RValue<Float4> operator/=(const Float4 &lhs, RValue<Float4> rhs)
5427 {
5428 return lhs = lhs / rhs;
5429 }
5430
5431 RValue<Float4> operator%=(const Float4 &lhs, RValue<Float4> rhs)
5432 {
5433 return lhs = lhs % rhs;
5434 }
5435
5436 RValue<Float4> operator+(RValue<Float4> val)
5437 {
5438 return val;
5439 }
5440
5441 RValue<Float4> operator-(RValue<Float4> val)
5442 {
5443 return RValue<Float4>(Nucleus::createFNeg(val.value));
5444 }
5445
5446 RValue<Float4> Abs(RValue<Float4> x)
5447 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005448 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005449 }
5450
5451 RValue<Float4> Max(RValue<Float4> x, RValue<Float4> y)
5452 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005453 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005454 }
5455
5456 RValue<Float4> Min(RValue<Float4> x, RValue<Float4> y)
5457 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005458 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005459 }
5460
5461 RValue<Float4> Rcp_pp(RValue<Float4> x, bool exactAtPow2)
5462 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005463 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005464 }
5465
5466 RValue<Float4> RcpSqrt_pp(RValue<Float4> x)
5467 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005468 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005469 }
5470
5471 RValue<Float4> Sqrt(RValue<Float4> x)
5472 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005473 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005474 }
5475
5476 RValue<Float4> Insert(const Float4 &val, RValue<Float> element, int i)
5477 {
5478 Value *value = val.loadValue();
5479 Value *insert = Nucleus::createInsertElement(value, element.value, i);
5480
5481 val = RValue<Float4>(insert);
5482
5483 return val;
5484 }
5485
5486 RValue<Float> Extract(RValue<Float4> x, int i)
5487 {
5488 return RValue<Float>(Nucleus::createExtractElement(x.value, i));
5489 }
5490
5491 RValue<Float4> Swizzle(RValue<Float4> x, unsigned char select)
5492 {
5493 return RValue<Float4>(Nucleus::createSwizzle(x.value, select));
5494 }
5495
5496 RValue<Float4> ShuffleLowHigh(RValue<Float4> x, RValue<Float4> y, unsigned char imm)
5497 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005498 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005499 }
5500
5501 RValue<Float4> UnpackLow(RValue<Float4> x, RValue<Float4> y)
5502 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005503 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005504 }
5505
5506 RValue<Float4> UnpackHigh(RValue<Float4> x, RValue<Float4> y)
5507 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005508 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005509 }
5510
5511 RValue<Float4> Mask(Float4 &lhs, RValue<Float4> rhs, unsigned char select)
5512 {
5513 Value *vector = lhs.loadValue();
5514 Value *shuffle = Nucleus::createMask(vector, rhs.value, select);
5515 lhs.storeValue(shuffle);
5516
5517 return RValue<Float4>(shuffle);
5518 }
5519
5520 RValue<Int> SignMask(RValue<Float4> x)
5521 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005522 assert(false && "UNIMPLEMENTED"); return RValue<Int>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005523 }
5524
5525 RValue<Int4> CmpEQ(RValue<Float4> x, RValue<Float4> y)
5526 {
5527 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOEQ(x.value, y.value), Int4::getType()));
5528 }
5529
5530 RValue<Int4> CmpLT(RValue<Float4> x, RValue<Float4> y)
5531 {
5532 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOLT(x.value, y.value), Int4::getType()));
5533 }
5534
5535 RValue<Int4> CmpLE(RValue<Float4> x, RValue<Float4> y)
5536 {
5537 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOLE(x.value, y.value), Int4::getType()));
5538 }
5539
5540 RValue<Int4> CmpNEQ(RValue<Float4> x, RValue<Float4> y)
5541 {
5542 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpONE(x.value, y.value), Int4::getType()));
5543 }
5544
5545 RValue<Int4> CmpNLT(RValue<Float4> x, RValue<Float4> y)
5546 {
5547 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOGE(x.value, y.value), Int4::getType()));
5548 }
5549
5550 RValue<Int4> CmpNLE(RValue<Float4> x, RValue<Float4> y)
5551 {
5552 return RValue<Int4>(Nucleus::createSExt(Nucleus::createFCmpOGT(x.value, y.value), Int4::getType()));
5553 }
5554
5555 RValue<Float4> Round(RValue<Float4> x)
5556 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005557 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005558 }
5559
5560 RValue<Float4> Trunc(RValue<Float4> x)
5561 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005562 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005563 }
5564
5565 RValue<Float4> Frac(RValue<Float4> x)
5566 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005567 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005568 }
5569
5570 RValue<Float4> Floor(RValue<Float4> x)
5571 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005572 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005573 }
5574
5575 RValue<Float4> Ceil(RValue<Float4> x)
5576 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005577 assert(false && "UNIMPLEMENTED"); return RValue<Float4>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005578 }
5579
5580 Type *Float4::getType()
5581 {
5582 assert(false && "UNIMPLEMENTED"); return nullptr;
5583 }
5584
5585 RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, int offset)
5586 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005587 assert(false && "UNIMPLEMENTED"); return RValue<Pointer<Byte>>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005588 }
5589
5590 RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
5591 {
5592 return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, offset.value));
5593 }
5594
5595 RValue<Pointer<Byte>> operator+(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
5596 {
5597 return RValue<Pointer<Byte>>(Nucleus::createGEP(lhs.value, offset.value));
5598 }
5599
5600 RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, int offset)
5601 {
5602 return lhs = lhs + offset;
5603 }
5604
5605 RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, RValue<Int> offset)
5606 {
5607 return lhs = lhs + offset;
5608 }
5609
5610 RValue<Pointer<Byte>> operator+=(const Pointer<Byte> &lhs, RValue<UInt> offset)
5611 {
5612 return lhs = lhs + offset;
5613 }
5614
5615 RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, int offset)
5616 {
5617 return lhs + -offset;
5618 }
5619
5620 RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<Int> offset)
5621 {
5622 return lhs + -offset;
5623 }
5624
5625 RValue<Pointer<Byte>> operator-(RValue<Pointer<Byte>> lhs, RValue<UInt> offset)
5626 {
5627 return lhs + -offset;
5628 }
5629
5630 RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, int offset)
5631 {
5632 return lhs = lhs - offset;
5633 }
5634
5635 RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, RValue<Int> offset)
5636 {
5637 return lhs = lhs - offset;
5638 }
5639
5640 RValue<Pointer<Byte>> operator-=(const Pointer<Byte> &lhs, RValue<UInt> offset)
5641 {
5642 return lhs = lhs - offset;
5643 }
5644
5645 void Return()
5646 {
5647 Nucleus::createRetVoid();
5648 Nucleus::setInsertBlock(Nucleus::createBasicBlock());
5649 Nucleus::createUnreachable();
5650 }
5651
5652 void Return(bool ret)
5653 {
5654 Ice::Operand *Ret = Ice::ConstantInteger32::create(::context, Ice::IceType_i32, ret ? 1 : 0);
5655 Ice::InstRet *retu = Ice::InstRet::create(::function, Ret);
5656 ::basicBlock->appendInst(retu);
5657 }
5658
5659 void Return(const Int &ret)
5660 {
5661 Ice::InstRet *retu = Ice::InstRet::create(::function, ret.loadValue());
5662 ::basicBlock->appendInst(retu);
5663 }
5664
5665 BasicBlock *beginLoop()
5666 {
5667 BasicBlock *loopBB = Nucleus::createBasicBlock();
5668
5669 Nucleus::createBr(loopBB);
5670 Nucleus::setInsertBlock(loopBB);
5671
5672 return loopBB;
5673 }
5674
5675 bool branch(RValue<Bool> cmp, BasicBlock *bodyBB, BasicBlock *endBB)
5676 {
5677 Nucleus::createCondBr(cmp.value, bodyBB, endBB);
5678 Nucleus::setInsertBlock(bodyBB);
5679
5680 return true;
5681 }
5682
5683 bool elseBlock(BasicBlock *falseBB)
5684 {
5685 Nucleus::setInsertBlock(falseBB);
5686
5687 return true;
5688 }
5689
5690 RValue<Long> Ticks()
5691 {
Nicolas Capensc37252c2016-09-28 16:11:54 -04005692 assert(false && "UNIMPLEMENTED"); return RValue<Long>(V(nullptr));
Nicolas Capens598f8d82016-09-26 15:09:10 -04005693 }
5694}
5695