Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/bswap16-run-0.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-additional-options "-std=c99 -O3 -ftree-vectorize -fno-vect-cost-model" } */
3
4 #include <stdint-gcc.h>
5 #include "test-math.h"
6
7 #define ARRAY_SIZE 128
8
9 uint16_t in[ARRAY_SIZE];
10 uint16_t out[ARRAY_SIZE];
11 uint16_t ref[ARRAY_SIZE];
12
13 TEST_UNARY_CALL (uint16_t, __builtin_bswap16)
14 TEST_ASSERT (uint16_t)
15
16 /* TEST_INIT Arguments:
17 +-------+-------+---------------------------+---------+
18 | type | input | reference | test id |
19 +-------+-------+---------------------------+---------+
20 */
21 TEST_INIT (uint16_t, 0x1234u, __builtin_bswap16 (0x1234u), 1)
22 TEST_INIT (uint16_t, 0x1122u, __builtin_bswap16 (0x1122u), 2)
23 TEST_INIT (uint16_t, 0xa55au, __builtin_bswap16 (0xa55au), 3)
24 TEST_INIT (uint16_t, 0x0000u, __builtin_bswap16 (0x0000u), 4)
25 TEST_INIT (uint16_t, 0xffffu, __builtin_bswap16 (0xffffu), 5)
26 TEST_INIT (uint16_t, 0x4321u, __builtin_bswap16 (0x4321u), 6)
27
28 int
29 main ()
30 {
31 /* RUN_TEST Arguments:
32 +------+---------+-------------+----+-----+-----+------------+
33 | type | test id | fun to test | in | out | ref | array size |
34 +------+---------+-------------+----+-----+-----+------------+
35 */
36 RUN_TEST (uint16_t, 1, __builtin_bswap16, in, out, ref, ARRAY_SIZE);
37 RUN_TEST (uint16_t, 2, __builtin_bswap16, in, out, ref, ARRAY_SIZE);
38 RUN_TEST (uint16_t, 3, __builtin_bswap16, in, out, ref, ARRAY_SIZE);
39 RUN_TEST (uint16_t, 4, __builtin_bswap16, in, out, ref, ARRAY_SIZE);
40 RUN_TEST (uint16_t, 5, __builtin_bswap16, in, out, ref, ARRAY_SIZE);
41 RUN_TEST (uint16_t, 6, __builtin_bswap16, in, out, ref, ARRAY_SIZE);
42
43 return 0;
44 }