Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve2/zipq_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 "zipq_1.c"
5
6 typedef svuint16_t fixed_uint16_t __attribute__((arm_sve_vector_bits(256)));
7
8 #define TEST(A, B) \
9 do { \
10 typeof(A) actual_ = (A); \
11 if (__builtin_memcmp (&actual_, &(B), sizeof (actual_)) != 0) \
12 __builtin_abort (); \
13 } while (0)
14
15 int
16 main ()
17 {
18 fixed_int64_t a64 = { 0x1122LL << 31, -1LL << 47, 0x5566 << 15, -2 };
19 fixed_int64_t b64 = { 42, -0x3344LL << 19, 303, -0x7788LL << 27 };
20 fixed_int64_t expected1 = { 0x1122LL << 31, 42,
21 0x5566 << 15, 303 };
22 fixed_int64_t expected2 = { -1LL << 47, -0x3344LL << 19,
23 -2, -0x7788LL << 27 };
24 TEST (f1 (a64, b64), expected1);
25 TEST (f2 (a64, b64), expected2);
26
27 fixed_float32_t a32 = { 0.5, 0.75, 1, 1.25, 2.5, 2.75, 3, 3.25 };
28 fixed_float32_t b32 = { -0.5, -0.75, -1, -1.25, -2.5, -2.75, -3, -3.25 };
29 fixed_float32_t expected3 = { 0.5, -0.5, 0.75, -0.75,
30 2.5, -2.5, 2.75, -2.75 };
31 fixed_float32_t expected4 = { 1, -1, 1.25, -1.25,
32 3, -3, 3.25, -3.25 };
33 TEST (f3 (a32, b32), expected3);
34 TEST (f4 (a32, b32), expected4);
35
36 fixed_uint16_t a16_i = { 0x9a12, 0xbc34, 0xde56, 0xf078,
37 0x00ff, 0x11ee, 0x22dd, 0x33cc,
38 0x44bb, 0x55aa, 0x6699, 0x7788,
39 0xfe01, 0xdc23, 0xba45, 0x9867 };
40 fixed_uint16_t b16_i = { 0x1010, 0x2020, 0x3030, 0x4040,
41 0x5050, 0x6060, 0x7070, 0x8080,
42 0x9090, 0xa0a0, 0xb0b0, 0xc0c0,
43 0xd0d0, 0xe0e0, 0xf0f0, 0x0f0f };
44 fixed_uint16_t expected5 = { 0x9a12, 0x1010, 0xbc34, 0x2020,
45 0xde56, 0x3030, 0xf078, 0x4040,
46 0x44bb, 0x9090, 0x55aa, 0xa0a0,
47 0x6699, 0xb0b0, 0x7788, 0xc0c0 };
48 fixed_uint16_t expected6 = { 0x00ff, 0x5050, 0x11ee, 0x6060,
49 0x22dd, 0x7070, 0x33cc, 0x8080,
50 0xfe01, 0xd0d0, 0xdc23, 0xe0e0,
51 0xba45, 0xf0f0, 0x9867, 0x0f0f };
52 fixed_bfloat16_t a16, b16;
53 __builtin_memcpy (&a16, &a16_i, sizeof (a16));
54 __builtin_memcpy (&b16, &b16_i, sizeof (b16));
55 TEST (f5 (a16, b16), expected5);
56 TEST (f6 (a16, b16), expected6);
57
58 fixed_uint8_t a8 = { 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x70,
59 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf8,
60 0xfe, 0xed, 0xdc, 0xcb, 0xba, 0xa9, 0x98, 0x8f,
61 0x76, 0x65, 0x54, 0x43, 0x32, 0x21, 0x10, 0x07 };
62 fixed_uint8_t b8 = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
63 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00,
64 0x13, 0x24, 0x35, 0x46, 0x57, 0x68, 0x79, 0x8a,
65 0x9b, 0xac, 0xbd, 0xce, 0xdf, 0xe0, 0xf1, 0x02 };
66 fixed_uint8_t expected7 = { 0x01, 0x11, 0x12, 0x22, 0x23, 0x33, 0x34, 0x44,
67 0x45, 0x55, 0x56, 0x66, 0x67, 0x77, 0x70, 0x88,
68 0xfe, 0x13, 0xed, 0x24, 0xdc, 0x35, 0xcb, 0x46,
69 0xba, 0x57, 0xa9, 0x68, 0x98, 0x79, 0x8f, 0x8a };
70 fixed_uint8_t expected8 = { 0x89, 0x99, 0x9a, 0xaa, 0xab, 0xbb, 0xbc, 0xcc,
71 0xcd, 0xdd, 0xde, 0xee, 0xef, 0xff, 0xf8, 0x00,
72 0x76, 0x9b, 0x65, 0xac, 0x54, 0xbd, 0x43, 0xce,
73 0x32, 0xdf, 0x21, 0xe0, 0x10, 0xf1, 0x07, 0x02 };
74 TEST (f7 (a8, b8), expected7);
75 TEST (f8 (a8, b8), expected8);
76
77 return 0;
78 }