mve: Fix vsetq_lane for 64-bit elements with lane 1 [PR 115611]
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / bfloat16-builtin.c
blobce02f6f8b5b14e5dcbc66f4c670379116a757d55
1 /* Test __bf16 built-in functions. */
2 /* { dg-do run } */
3 /* { dg-options "" } */
4 /* { dg-add-options bfloat16 } */
5 /* { dg-add-options ieee } */
6 /* { dg-require-effective-target bfloat16_runtime } */
8 extern void exit (int);
9 extern void abort (void);
11 extern __bf16 test_type;
12 extern __typeof (__builtin_nansf16b ("")) test_type;
14 volatile __bf16 inf_cst = (__bf16) __builtin_inff ();
15 volatile __bf16 huge_val_cst = (__bf16) __builtin_huge_valf ();
16 volatile __bf16 nan_cst = (__bf16) __builtin_nanf ("");
17 volatile __bf16 nans_cst = __builtin_nansf16b ("");
18 volatile __bf16 neg0 = -0.0bf16, neg1 = -1.0bf16, one = 1.0;
20 int
21 main (void)
23 volatile __bf16 r;
24 if (!__builtin_isinf (inf_cst))
25 abort ();
26 if (!__builtin_isinf (huge_val_cst))
27 abort ();
28 if (inf_cst != huge_val_cst)
29 abort ();
30 if (!__builtin_isnan (nan_cst))
31 abort ();
32 if (!__builtin_isnan (nans_cst))
33 abort ();
34 r = __builtin_fabsf (neg1);
35 if (r != 1.0bf16)
36 abort ();
37 r = __builtin_copysignf (one, neg0);
38 if (r != neg1)
39 abort ();
40 r = __builtin_copysignf (inf_cst, neg1);
41 if (r != -huge_val_cst)
42 abort ();
43 r = __builtin_copysignf (-inf_cst, one);
44 if (r != huge_val_cst)
45 abort ();
46 exit (0);