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