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