| 1 |
/* { dg-do run { target { aarch64_sve256_hw && aarch64_sve2p1_hw } } } */ |
| 2 |
/* { dg-options "-O2 -msve-vector-bits=256" } */ |
| 3 |
|
| 4 |
#include "uzpq_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, 1, -0.5, -1, |
| 30 |
2.5, 3, -2.5, -3 }; |
| 31 |
fixed_float32_t expected4 = { 0.75, 1.25, -0.75, -1.25, |
| 32 |
2.75, 3.25, -2.75, -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, 0xde56, 0x00ff, 0x22dd, |
| 45 |
0x1010, 0x3030, 0x5050, 0x7070, |
| 46 |
0x44bb, 0x6699, 0xfe01, 0xba45, |
| 47 |
0x9090, 0xb0b0, 0xd0d0, 0xf0f0 }; |
| 48 |
fixed_uint16_t expected6 = { 0xbc34, 0xf078, 0x11ee, 0x33cc, |
| 49 |
0x2020, 0x4040, 0x6060, 0x8080, |
| 50 |
0x55aa, 0x7788, 0xdc23, 0x9867, |
| 51 |
0xa0a0, 0xc0c0, 0xe0e0, 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, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, |
| 67 |
0x11, 0x33, 0x55, 0x77, 0x99, 0xbb, 0xdd, 0xff, |
| 68 |
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, |
| 69 |
0x13, 0x35, 0x57, 0x79, 0x9b, 0xbd, 0xdf, 0xf1 }; |
| 70 |
fixed_uint8_t expected8 = { 0x12, 0x34, 0x56, 0x70, 0x9a, 0xbc, 0xde, 0xf8, |
| 71 |
0x22, 0x44, 0x66, 0x88, 0xaa, 0xcc, 0xee, 0x00, |
| 72 |
0xed, 0xcb, 0xa9, 0x8f, 0x65, 0x43, 0x21, 0x07, |
| 73 |
0x24, 0x46, 0x68, 0x8a, 0xac, 0xce, 0xe0, 0x02 }; |
| 74 |
TEST (f7 (a8, b8), expected7); |
| 75 |
TEST (f8 (a8, b8), expected8); |
| 76 |
|
| 77 |
return 0; |
| 78 |
} |