Skip to content

Instantly share code, notes, and snippets.

View tanakamura's full-sized avatar

Takashi Nakamura tanakamura

View GitHub Profile
#include <pmmintrin.h>
double ddotp2(double *u,
double *v,
int n)
{
int i;
__m128d x = _mm_setzero_pd();
for (i=0; i<n-1; i+=2) {
x = _mm_add_pd(x, _mm_mul_pd(_mm_loadu_pd(&u[i]),
@tanakamura
tanakamura / gist:7295694
Last active December 27, 2015 08:19
write throughput
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef _WIN32
#include <windows.h>
double
sec()
{
LARGE_INTEGER freq, v;
@tanakamura
tanakamura / printf2.c
Last active December 27, 2015 08:28
printf
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
FILE *log_file;
int write_total;
char buffer[1024];
#ifdef _WIN32
#include <windows.h>
@tanakamura
tanakamura / fast-printf.c
Last active December 27, 2015 08:29
fast-printf
#include <windows.h>
#include <stdio.h>
#include <ctype.h>
#ifdef _WIN32
#include <windows.h>
double
sec()
{
LARGE_INTEGER freq, v;
#define __CL_ENABLE_EXCEPTIONS
#include <CL/cl.hpp>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/fcntl.h>
#include <iostream>
#include <sys/time.h>
#include <stdio.h>
__kernel void
hello(void)
{
}
/*
* i7-4700MQ Win8.1 : 9533.579865clk
*/
#include <windows.h>
#include <setjmp.h>
#define NUM (4096*8)
volatile int counter = 0;
jmp_buf jbuf;
/*
* i7-4700MQ Win8.1 : 9533.579865clk
* i7-4700MQ Linux 3.11.4-201.fc19.x86_6 : 1815.603760
*/
#include <signal.h>
#include <setjmp.h>
#include <x86intrin.h>
#include <stdio.h>
#include <clang-c/Index.h>
#include <stdio.h>
#include <stdlib.h>
struct FindState {
bool find;
int target_line;
CXCursor loop;
};
#include <stdio.h>
int func(int v) {
printf("%d\n", v);
return 0;
}
void f1(unsigned char b, unsigned char c) {
auto a = b + c;
func(a);