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