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