aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/i386/test-i386-pcmpistri.c
blob: 1e81ae611acfc5ea9cf3309a192d94cc0b8b9308 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Test pcmpistri instruction.  */

#include <nmmintrin.h>
#include <stdio.h>

union u {
    __m128i x;
    unsigned char uc[16];
};

union u s0 = { .uc = { 0 } };
union u s1 = { .uc = "abcdefghijklmnop" };
union u s2 = { .uc = "bcdefghijklmnopa" };
union u s3 = { .uc = "bcdefghijklmnab" };

int
main(void)
{
    int ret = 0;
    if (_mm_cmpistri(s0.x, s0.x, 0x4c) != 15) {
        printf("FAIL: pcmpistri test 1\n");
        ret = 1;
    }
    if (_mm_cmpistri(s1.x, s2.x, 0x4c) != 15) {
        printf("FAIL: pcmpistri test 2\n");
        ret = 1;
    }
    if (_mm_cmpistri(s1.x, s3.x, 0x4c) != 16) {
        printf("FAIL: pcmpistri test 3\n");
        ret = 1;
    }
    return ret;
}