Created
March 31, 2019 16:18
-
-
Save tanakamura/223aedf51fe03b4b165c1d1b22750965 to your computer and use it in GitHub Desktop.
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
/* | |
* 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; | |
size_t num_line = sz / line_size; | |
unsigned char *d = (unsigned char*)dst; | |
unsigned char *s = (unsigned char*)src; | |
for (int i=0; i<num_line; i++) { | |
_mm_clzero(d); | |
d[0] = 99; | |
d += line_size; | |
} | |
return NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment