gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/combine-1.c
raw| 1 | /* { dg-do run { target { riscv_v } } } */ |
| 2 | /* { dg-options "-mrvv-vector-bits=zvl -O3" } */ |
| 3 | |
| 4 | #include <stdint-gcc.h> |
| 5 | #include <assert.h> |
| 6 | |
| 7 | typedef int8_t v16qi __attribute__ ((vector_size (16))); |
| 8 | |
| 9 | void __attribute__ ((noinline, noclone)) |
| 10 | foo (int8_t *out, int8_t x, int8_t y) |
| 11 | { |
| 12 | v16qi v = {y, y, y, y, y, y, y, y, x, x, x, x, x, x, x, x}; |
| 13 | *(v16qi *) out = v; |
| 14 | } |
| 15 | |
| 16 | int |
| 17 | main () |
| 18 | { |
| 19 | int8_t x = -107; |
| 20 | int8_t y = 93; |
| 21 | int8_t out[16] = {0}; |
| 22 | foo (out, x, y); |
| 23 | for (int i = 0; i < 16; ++i) |
| 24 | { |
| 25 | if (i < 8) |
| 26 | assert (out[i] == 93); |
| 27 | else |
| 28 | assert (out[i] == -107); |
| 29 | } |
| 30 | } |