xref: /qemu/tests/tcg/i386/test-i386-pcmpistri.c (revision a81df1b6)
1 /* Test pcmpistri instruction.  */
2 
3 #include <nmmintrin.h>
4 #include <stdio.h>
5 
6 union u {
7     __m128i x;
8     unsigned char uc[16];
9 };
10 
11 union u s0 = { .uc = { 0 } };
12 union u s1 = { .uc = "abcdefghijklmnop" };
13 union u s2 = { .uc = "bcdefghijklmnopa" };
14 union u s3 = { .uc = "bcdefghijklmnab" };
15 
16 int
17 main(void)
18 {
19     int ret = 0;
20     if (_mm_cmpistri(s0.x, s0.x, 0x4c) != 15) {
21         printf("FAIL: pcmpistri test 1\n");
22         ret = 1;
23     }
24     if (_mm_cmpistri(s1.x, s2.x, 0x4c) != 15) {
25         printf("FAIL: pcmpistri test 2\n");
26         ret = 1;
27     }
28     if (_mm_cmpistri(s1.x, s3.x, 0x4c) != 16) {
29         printf("FAIL: pcmpistri test 3\n");
30         ret = 1;
31     }
32     return ret;
33 }
34