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