Revision 222a3336 tests/test-i386-ssse3.c

b/tests/test-i386-ssse3.c
1 1
/* See if various MMX/SSE SSSE3 instructions give expected results */
2 2
#include <stdio.h>
3 3
#include <string.h>
4
#include <stdint.h>
4 5

  
5 6
int main(int argc, char *argv[]) {
6 7
	char hello[16];
......
9 10

  
10 11
	uint64_t a = 0x0000000000090007;
11 12
	uint64_t b = 0x0000000000000000;
13
	uint32_t c;
14
	uint16_t d;
12 15

  
13
	const char c[16] = "LLOaaaaaaaaaaaaa";
14
	const char d[16] = "aaaaaaaaaaaaaaHE";
16
	const char e[16] = "LLOaaaaaaaaaaaaa";
17
	const char f[16] = "aaaaaaaaaaaaaaHE";
15 18

  
16 19
	/* pshufb mm1/xmm1, mm2/xmm2 */
17 20
	asm volatile ("movq    (%0), %%mm0" : : "r" (ehlo) : "mm0", "mm1");
......
33 36
	printf("%i - %i = %i\n", 9, 7, -(int16_t) a);
34 37

  
35 38
	/* palignr mm1/xmm1, m64/m128, imm8 */
36
	asm volatile ("movdqa  (%0), %%xmm0" : : "r" (c) : "xmm0");
37
	asm volatile ("palignr $14, (%0), %%xmm0" : : "r" (d));
39
	asm volatile ("movdqa  (%0), %%xmm0" : : "r" (e) : "xmm0");
40
	asm volatile ("palignr $14, (%0), %%xmm0" : : "r" (f));
38 41
	asm volatile ("movdqa  %%xmm0, (%0)" : : "r" (hello));
39 42
	printf("%5.5s\n", hello);
40 43

  
44
#if 1 /* SSE4 */
45
	/* popcnt r64, r/m64 */
46
	asm volatile ("movq    $0x8421000010009c63, %%rax" : : : "rax");
47
	asm volatile ("popcnt  %%ax, %%dx" : : : "dx");
48
	asm volatile ("popcnt  %%eax, %%ecx" : : : "ecx");
49
	asm volatile ("popcnt  %rax, %rax");
50
	asm volatile ("movq    %%rax, %0" : "=m" (a));
51
	asm volatile ("movl    %%ecx, %0" : "=m" (c));
52
	asm volatile ("movw    %%dx, %0" : "=m" (d));
53
	printf("%i = %i\n%i = %i = %i\n", 13, (int) a, 9, c, d + 1);
54
#endif
55

  
41 56
	return 0;
42 57
}

Also available in: Unified diff