annotate gcc/testsuite/gcc.target/powerpc/vec-cntlzm-1.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
1 /* { dg-do run } */
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
2 /* { dg-require-effective-target powerpc_future_hw } */
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
3 /* { dg-options "-mdejagnu-cpu=future" } */
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
4
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
5 #include <altivec.h>
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
6
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
7 extern void abort (void);
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
8
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
9 vector unsigned long long int
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
10 do_vec_cntlzm (vector unsigned long long int source,
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
11 vector unsigned long long int mask)
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
12 {
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
13 return vec_cntlzm (source, mask);
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
14 }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
15
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
16 int main (int argc, char *argv [])
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
17 {
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
18 vector unsigned long long int source_a = { 0xa5f07e3cull, 0x7e3ca5f0ull };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
19 vector unsigned long long int source_b = { 0x3ca5f07eull, 0x5a0fe7c3ull };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
20
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
21 vector unsigned long long int mask_a = { 0xffff0000ull, 0x0000ffffull };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
22 vector unsigned long long int mask_b = { 0x0f0f0f0full, 0xf0f0f0f0ull };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
23
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
24 /* See cntlzdm-0.c for derivation of expected results.
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
25
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
26 result_aa [0] is compute (source [0], mask [0];
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
27 result_aa [1] is compute (source [1], mask [1].
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
28
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
29 result_ab [0] is compute (source [0], mask [2];
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
30 result_ab [1] is compute (source [1], mask [3].
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
31
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
32 result_ba [0] is compute (source [2], mask [0];
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
33 result_ba [1] is compute (source [3], mask [1].
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
34
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
35 result_bb [0] is compute (source [2], mask [2];
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
36 result_bb [1] is compute (source [3], mask [3]. */
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
37
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
38 vector unsigned long long int result_aa = { 0, 0 };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
39 vector unsigned long long int result_ab = { 1, 1 };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
40 vector unsigned long long int result_ba = { 2, 0 };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
41 vector unsigned long long int result_bb = { 0, 1 };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
42
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
43 if (!vec_all_eq (do_vec_cntlzm (source_a, mask_a), result_aa))
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
44 abort ();
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
45 if (!vec_all_eq (do_vec_cntlzm (source_a, mask_b), result_ab))
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
46 abort ();
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
47 if (!vec_all_eq (do_vec_cntlzm (source_b, mask_a), result_ba))
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
48 abort ();
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
49 if (!vec_all_eq (do_vec_cntlzm (source_b, mask_b), result_bb))
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
50 abort ();
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
51
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
52 return 0;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
53 }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
54