Created
June 12, 2012 00:18
-
-
Save ssvb/2913581 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
#include <stdint.h> | |
#include <assert.h> | |
#include <emmintrin.h> | |
uint32_t foo(uint32_t a) | |
{ | |
__m128i xa = _mm_cvtsi32_si128(a); | |
return _mm_cvtsi128_si32(_mm_packus_epi16(xa, xa)); | |
} | |
__m128i bar(__m128i xa) | |
{ | |
return _mm_packus_epi16(xa, xa); | |
} | |
int main(void) | |
{ | |
assert(foo(0x12345678) == 0xFFFF); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment