[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / builtins-msum-runnable.c
blobabc0a0d28320f45ee5df1bcb1c854c5c46238981
1 /* { dg-do run } */
2 /* { dg-require-effective-target p9vector_hw } */
3 /* { dg-require-effective-target int128 } */
4 /* { dg-options "-mdejagnu-cpu=power9 -O2" } */
6 #include <altivec.h>
8 #ifdef DEBUG
9 #include <stdio.h>
10 #endif
12 void abort (void);
14 int
15 main()
17 vector __uint128_t arg_uint128, result_uint128, expected_uint128;
18 vector __int128_t arg_int128, result_int128, expected_int128;
20 arg_uint128[0] = 0x1627384950617243;
21 arg_uint128[0] = arg_uint128[0] << 64;
22 arg_uint128[0] |= 0x9405182930415263;
23 expected_uint128[0] = 0x1627384950617243;
24 expected_uint128[0] = expected_uint128[0] << 64;
25 expected_uint128[0] |= 0xb6b07e42a570e5fe;
26 vector unsigned long long arg_vull2 = {0x12345678,0x44445555};
27 vector unsigned long long arg_vull3 = {0x6789abcd,0x66667777};
28 result_uint128 = vec_msum (arg_vull2, arg_vull3, arg_uint128);
30 if (result_uint128[0] != expected_uint128[0])
32 #ifdef DEBUG
33 printf("result_uint128[0] doesn't match expected_u128[0]\n");
34 printf("arg_vull2 %llx %llx \n", arg_vull2[0], arg_vull2[1]);
35 printf("arg_vull3 %llx %llx \n", arg_vull3[0], arg_vull3[1]);
36 printf("arg_uint128[0] = %llx ", arg_uint128[0] >> 64);
37 printf(" %llx\n", arg_uint128[0] & 0xFFFFFFFFFFFFFFFF);
39 printf("result_uint128[0] = %llx ", result_uint128[0] >> 64);
40 printf(" %llx\n", result_uint128[0] & 0xFFFFFFFFFFFFFFFF);
42 printf("expected_uint128[0] = %llx ", expected_uint128[0] >> 64);
43 printf(" %llx\n", expected_uint128[0] & 0xFFFFFFFFFFFFFFFF);
44 #else
45 abort();
46 #endif
49 arg_int128[0] = 0x1627384950617283;
50 arg_int128[0] = arg_int128[0] << 64;
51 arg_int128[0] |= 0x9405182930415263;
52 expected_int128[0] = 0x1627384950617283;
53 expected_int128[0] = expected_int128[0] << 64;
54 expected_int128[0] |= 0xd99f35969c11cbfa;
55 vector signed long long arg_vll2 = { 0x567890ab, 0x1233456 };
56 vector signed long long arg_vll3 = { 0xcdef0123, 0x9873451 };
57 result_int128 = vec_msum (arg_vll2, arg_vll3, arg_int128);
59 if (result_int128[0] != expected_int128[0])
61 #ifdef DEBUG
62 printf("result_int128[0] doesn't match expected128[0]\n");
63 printf("arg_int128[0] = %llx ", arg_int128[0] >> 64);
64 printf(" %llx\n", arg_int128[0] & 0xFFFFFFFFFFFFFFFF);
66 printf("result_int128[0] = %llx ", result_int128[0] >> 64);
67 printf(" %llx\n", result_int128[0] & 0xFFFFFFFFFFFFFFFF);
69 printf("expected_int128[0] = %llx ", expected_int128[0] >> 64);
70 printf(" %llx\n", expected_int128[0] & 0xFFFFFFFFFFFFFFFF);
71 #else
72 abort();
73 #endif