Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve2/extq_1_run.c

raw
1 /* { dg-do run { target { aarch64_sve256_hw && aarch64_sve2p1_hw } } } */
2 /* { dg-options "-O2 -msve-vector-bits=256" } */
3
4 #include "extq_1.c"
5
6 #define TEST(A, B) \
7 do { \
8 typeof(B) actual_ = (A); \
9 if (__builtin_memcmp (&actual_, &(B), sizeof (actual_)) != 0) \
10 __builtin_abort (); \
11 } while (0)
12
13 int
14 main ()
15 {
16 fixed_float64_t a64 = { 1.5, 3.75, -5.25, 9 };
17 fixed_float64_t b64 = { -2, 4.125, -6.375, 11.5 };
18 fixed_float64_t expected1 = { 3.75, -2, 9, -6.375 };
19 TEST (f1 (a64, b64), expected1);
20
21 fixed_uint32_t a32 = { 0x1122, -0x3344, 0x5566, -0x7788,
22 0x99aa, -0xbbcc, 0xddee, -0xff00 };
23 fixed_uint32_t b32 = { 1 << 20, 1 << 21, 1 << 22, 1 << 23,
24 5 << 6, 5 << 7, 5 << 8, 5 << 9 };
25 fixed_uint32_t expected2 = { -0x3344, 0x5566, -0x7788, 1 << 20,
26 -0xbbcc, 0xddee, -0xff00, 5 << 6 };
27 fixed_uint32_t expected3 = { -0x7788, 1 << 20, 1 << 21, 1 << 22,
28 -0xff00, 5 << 6, 5 << 7, 5 << 8 };
29 TEST (f2 (a32, b32), expected2);
30 TEST (f3 (a32, b32), expected3);
31
32 fixed_float16_t a16 = { 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25,
33 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.25 };
34 fixed_float16_t b16 = { -0.5, -0.75, -1, -1.25, -1.5, -1.75, -2, -2.25,
35 -2.5, -2.75, -3, -3.25, -3.5, -3.75, -4, -4.25 };
36 fixed_float16_t expected4 = { 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, -0.5,
37 2.75, 3, 3.25, 3.5, 3.75, 4, 4.25, -2.5 };
38 fixed_float16_t expected5 = { 1.75, 2, 2.25, -0.5, -0.75, -1, -1.25, -1.5,
39 3.75, 4, 4.25, -2.5, -2.75, -3, -3.25, -3.5 };
40 fixed_float16_t expected6 = { 2.25, -0.5, -0.75, -1,
41 -1.25, -1.5, -1.75, -2,
42 4.25, -2.5, -2.75, -3,
43 -3.25, -3.5, -3.75, -4 };
44 TEST (f4 (a16, b16), expected4);
45 TEST (f5 (a16, b16), expected5);
46 TEST (f6 (a16, b16), expected6);
47
48 fixed_int8_t a8 = { 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x70,
49 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf8,
50 0xfe, 0xed, 0xdc, 0xcb, 0xba, 0xa9, 0x98, 0x8f,
51 0x76, 0x65, 0x54, 0x43, 0x32, 0x21, 0x10, 0x07 };
52 fixed_int8_t b8 = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
53 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00,
54 0x13, 0x24, 0x35, 0x46, 0x57, 0x68, 0x79, 0x8a,
55 0x9b, 0xac, 0xbd, 0xce, 0xdf, 0xe0, 0xf1, 0x02 };
56 fixed_int8_t expected7 = { 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x70, 0x89,
57 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf8, 0x11,
58 0xed, 0xdc, 0xcb, 0xba, 0xa9, 0x98, 0x8f, 0x76,
59 0x65, 0x54, 0x43, 0x32, 0x21, 0x10, 0x07, 0x13 };
60 fixed_int8_t expected8 = { 0xbc, 0xcd, 0xde, 0xef, 0xf8, 0x11, 0x22, 0x33,
61 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
62 0x43, 0x32, 0x21, 0x10, 0x07, 0x13, 0x24, 0x35,
63 0x46, 0x57, 0x68, 0x79, 0x8a, 0x9b, 0xac, 0xbd };
64 fixed_int8_t expected9 = { 0xf8, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
65 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
66 0x07, 0x13, 0x24, 0x35, 0x46, 0x57, 0x68, 0x79,
67 0x8a, 0x9b, 0xac, 0xbd, 0xce, 0xdf, 0xe0, 0xf1 };
68 TEST (f7 (a8, b8), expected7);
69 TEST (f8 (a8, b8), expected8);
70 TEST (f9 (a8, b8), expected9);
71
72 return 0;
73 }