x86 GAS uses reverse order of destination and source registers compared to Intel documentation. This was very confusing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by tejag on 2024-04-26. | |
// | |
#include <cstdint> | |
#include <cstring> | |
#include <functional> | |
#include <iostream> | |
#include <queue> | |
#include <syncstream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename I> | |
const char *tcNegSlow(I *out, const I *inp, uint64_t nel) { | |
constexpr size_t laneSize = simdSize<I>(); | |
uint16_t concurrency = std::thread::hardware_concurrency(); | |
uint64_t totalLanes = (nel + laneSize - 1) / laneSize; | |
uint64_t lanesPerThread = std::max( | |
uint64_t((totalLanes + concurrency - 1) / concurrency), uint64_t(1) | |
); | |
std::vector<std::future<void>> futures(concurrency); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> class Simd; | |
#if defined(TC_ARCH_X86) | |
#include <bits/stdc++.h> | |
#include <x86intrin.h> | |
uint16_t simdSize = 128; | |
uint16_t detectSimdSize() { | |
if (__builtin_cpu_supports("avx512f")) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by tejag on 2024-04-26. | |
// | |
#include <iostream> | |
#include <type_traits> | |
#include <typeinfo> | |
#include <cstdint> | |
#include <cxxabi.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by tejag on 2024-04-26. | |
// | |
#include <cxxabi.h> | |
#include <experimental/simd> | |
#include <iostream> | |
#include <vector> | |
template <typename T> void printType() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ALTERA_PATH=~/altera/13.1/ | |
sudo dpkg --add-architecture i386 | |
sudo apt-get update | |
sudo apt-get install gcc-multilib g++-multilib \ | |
lib32z1 lib32stdc++6 lib32gcc1 \ | |
expat:i386 fontconfig:i386 libfreetype6:i386 libexpat1:i386 libc6:i386 libgtk-3-0:i386 \ | |
libcanberra0:i386 libpng12-0:i386 libice6:i386 libsm6:i386 libncurses5:i386 zlib1g:i386 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
//#include<stdio.h> | |
//void inC() { | |
// printf("I am in C code now!\n"); | |
//} | |
import "C" | |
import "fmt" | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "bytes" | |
func StreamToByte(stream io.Reader) []byte { | |
buf := new(bytes.Buffer) | |
buf.ReadFrom(stream) | |
return buf.Bytes() | |
} | |
func StreamToString(stream io.Reader) string { | |
buf := new(bytes.Buffer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include "shared_ptr.hpp" | |
using namespace std; | |
class A { | |
public: | |
int i; | |
explicit A(int _i) : i(_i) { | |
} |
NewerOlder