Skip to content

Instantly share code, notes, and snippets.

@Abhiroop
Last active April 29, 2018 15:00
Show Gist options
  • Save Abhiroop/ab2d71f3b14e28c91b6acd2f395d605d to your computer and use it in GitHub Desktop.
Save Abhiroop/ab2d71f3b14e28c91b6acd2f395d605d to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <xmmintrin.h> //SSE
inline __m64 shuf(int perm){
__m64 a = _mm_setr_pi16(1,2,3,4);
return _mm_shuffle_pi16 (a, perm);
}
int main()
{
__m64 e = shuf(4);
printf("v_out = %vhd\n", e);
return 0;
}
// gcc -Wall -msse shuffle_fail.c
/*
clang has a more descriptive error message than gcc:
argument to '__builtin_ia32_pshufw' must be a constant integer
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment