Skip to content

Latest commit

 

History

History
21 lines (19 loc) · 1.16 KB

README.md

File metadata and controls

21 lines (19 loc) · 1.16 KB

ELECH473

SIMD Tips and tricks

unsigned char* foo = malloc(sizeof(unsigned char) * 16);
memset(foo, 42, 16);
__asm__(
    /* somehow put foo inside xmm3 and your output in xmm2 */
    "psubb %%xmm3, %%xmm2\n"
    /* outputs, inputs, clobbers*/
);
  • Multithreading in C using pthread: gist
  • In Code::Blocks, make sure to enable the SIMD instruction set. Go to Project > Build options..., then in the Compiler settingstab, check the relevant CPU architecture box. If you don't know which one to use, check the Intel Core i7 CPU with the most items. If you are compiling in command line, the corresponding flag is -march=corei7-avx.
  • You can use this tool to convert ASM code between the AT&T and Intel syntaxes.