[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vec-cntlzm-1.c
blobf35697006cdafc529fe8535b5df1f5bfc0dc78c4
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" } */
6 #include <altivec.h>
8 extern void abort (void);
10 vector unsigned long long int
11 do_vec_cntlzm (vector unsigned long long int source,
12 vector unsigned long long int mask)
14 return vec_cntlzm (source, mask);
17 int main (int argc, char *argv [])
19 vector unsigned long long int source_a = { 0xa5f07e3cull, 0x7e3ca5f0ull };
20 vector unsigned long long int source_b = { 0x3ca5f07eull, 0x5a0fe7c3ull };
22 vector unsigned long long int mask_a = { 0xffff0000ull, 0x0000ffffull };
23 vector unsigned long long int mask_b = { 0x0f0f0f0full, 0xf0f0f0f0ull };
25 /* See cntlzdm-0.c for derivation of expected results.
27 result_aa [0] is compute (source [0], mask [0];
28 result_aa [1] is compute (source [1], mask [1].
30 result_ab [0] is compute (source [0], mask [2];
31 result_ab [1] is compute (source [1], mask [3].
33 result_ba [0] is compute (source [2], mask [0];
34 result_ba [1] is compute (source [3], mask [1].
36 result_bb [0] is compute (source [2], mask [2];
37 result_bb [1] is compute (source [3], mask [3]. */
39 vector unsigned long long int result_aa = { 0, 0 };
40 vector unsigned long long int result_ab = { 1, 1 };
41 vector unsigned long long int result_ba = { 2, 0 };
42 vector unsigned long long int result_bb = { 0, 1 };
44 if (!vec_all_eq (do_vec_cntlzm (source_a, mask_a), result_aa))
45 abort ();
46 if (!vec_all_eq (do_vec_cntlzm (source_a, mask_b), result_ab))
47 abort ();
48 if (!vec_all_eq (do_vec_cntlzm (source_b, mask_a), result_ba))
49 abort ();
50 if (!vec_all_eq (do_vec_cntlzm (source_b, mask_b), result_bb))
51 abort ();
53 return 0;