Skip to content

Instantly share code, notes, and snippets.

@danking
Created April 5, 2013 19:07
Show Gist options
  • Select an option

  • Save danking/5321790 to your computer and use it in GitHub Desktop.

Select an option

Save danking/5321790 to your computer and use it in GitHub Desktop.
#include<xmmintrin.h>
#include<stdio.h>
#define N 8
int main()
{
/* unsigned char a[N] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; */
/* unsigned char b[N] = {0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}; */
/* unsigned char a[N] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; */
/* unsigned char b[N] = {0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; */
__m64 a = (__m64)0x0000000000000000LL;
__m64 b = (__m64)0x0808000000000000LL;
__m64 res = _mm_sad_pu8(a, b);
/* int i; */
/* for (i = 0; i < N; i=i+8) { */
/* __m64 newa = (__m64)((long long int)*(a + i)); */
/* __m64 newb = (__m64)((long long int)*(b + i)); */
/* __m64 res = _mm_sad_pu8((__m64)((long long int)*(a + i)), */
/* (__m64)((long long int)*(b + i))); */
/* unsigned long long int to_print = (unsigned long long int) res; */
/* printf("%llx\n", to_print); */
/* } */
unsigned long long int to_print = (unsigned long long int) res;
printf("%llx\n", to_print);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment