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.