Skip to content

Instantly share code, notes, and snippets.

View magurosan's full-sized avatar

Masaki Ota magurosan

  • Nagoya, Aichi, Japan
View GitHub Profile
// x86 SIMD string to uppercase
// See http://stackoverflow.com/questions/735204/convert-a-string-in-c-to-upper-case
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <strings.h> // for ffs
#include <ctype.h>
#include <immintrin.h>
/*
* clzero の後にstoreするとmemsetよりはるかに悪くなる
*
* * clzeroのみ :30[GB/s]
* * clzero + ストア :3[GB/s]
* * memset :12.5[GB/s]
*/
void *amd_clzero(void *dst, const void *src, size_t sz)
{
size_t line_size = 64;