Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/vec-cnttzm-1.c

raw
1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-do link { target { ! power10_hw } } } */
3 /* { dg-require-effective-target power10_ok } */
4 /* { dg-options "-mdejagnu-cpu=power10" } */
5
6 #include <altivec.h>
7
8 extern void abort (void);
9
10 vector unsigned long long int
11 do_vec_cnttzm (vector unsigned long long int source,
12 vector unsigned long long int mask)
13 {
14 return vec_cnttzm (source, mask);
15 }
16
17 int main (int argc, char *argv [])
18 {
19 vector unsigned long long int source_a = { 0xa5f07e3cull, 0x7e3ca5f0ull };
20 vector unsigned long long int source_b = { 0x3ca5f07eull, 0x5a0fe7c3ull };
21
22 vector unsigned long long int mask_a = { 0xffff0000ull, 0x0000ffffull };
23 vector unsigned long long int mask_b = { 0x0f0f0f0full, 0xf0f0f0f0ull };
24
25 /* See cnttzdm-0.c for derivation of expected results.
26
27 result_aa [0] is compute (source [0], mask [0];
28 result_aa [1] is compute (source [1], mask [1].
29
30 result_ab [0] is compute (source [0], mask [2];
31 result_ab [1] is compute (source [1], mask [3].
32
33 result_ba [0] is compute (source [2], mask [0];
34 result_ba [1] is compute (source [3], mask [1].
35
36 result_bb [0] is compute (source [2], mask [2];
37 result_bb [1] is compute (source [3], mask [3]. */
38
39 vector unsigned long long int result_aa = { 4, 4 };
40 vector unsigned long long int result_ab = { 2, 0 };
41 vector unsigned long long int result_ba = { 0, 0 };
42 vector unsigned long long int result_bb = { 1, 2 };
43
44 if (!vec_all_eq (do_vec_cnttzm (source_a, mask_a), result_aa))
45 abort ();
46 if (!vec_all_eq (do_vec_cnttzm (source_a, mask_b), result_ab))
47 abort ();
48 if (!vec_all_eq (do_vec_cnttzm (source_b, mask_a),result_ba))
49 abort ();
50 if (!vec_all_eq (do_vec_cnttzm (source_b, mask_b), result_bb))
51 abort ();
52
53 return 0;
54 }