Debian Codegraph @

gcc/testsuite/gcc.target/i386/sse2-mmx-pmovmskb.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */
3 /* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */
4
5 #include "sse2-check.h"
6 #include "mmx-vals.h"
7
8 __attribute__((noinline, noclone))
9 static void
10 test_pmovmskb (long long *ll1, int *r)
11 {
12 __m64 t1 = *(__m64 *) ll1;
13 *r = _m_pmovmskb (t1);
14 }
15
16 /* Routine to manually compute the results */
17 static void
18 compute_correct_result (long long *src_p, int *res_p)
19 {
20 char *src = (char *) src_p;
21 int i;
22 int res = 0;
23 for (i = 0; i < 8; i++)
24 res |= ((src[i] & 0x80) >> 7) << i;
25 *res_p = res;
26 }
27
28 static void
29 sse2_test (void)
30 {
31 int i;
32 int r, ck;
33 int fail = 0;
34
35 /* Run the MMX tests */
36 for (i = 0; i < MMX_num_ops; i++)
37 {
38 test_pmovmskb (&MMXops[i], &r);
39 compute_correct_result (&MMXops[i], &ck);
40 if (ck != r)
41 fail++;
42 }
43
44 if (fail != 0)
45 abort ();
46 }