| 1 |
/* { dg-do run { target { riscv_v } } } */ |
| 2 |
/* { dg-additional-options "-mrvv-vector-bits=scalable" } */ |
| 3 |
|
| 4 |
#include <assert.h> |
| 5 |
#include "narrow-1.c" |
| 6 |
|
| 7 |
#define RUN(TYPE1, TYPE2, SZ) \ |
| 8 |
TYPE1 a##TYPE1##_##TYPE2##_##SZ[SZ]; \ |
| 9 |
TYPE2 b##TYPE1##_##TYPE2##_##SZ[SZ]; \ |
| 10 |
TYPE2 dst##TYPE1##_##TYPE2##_##SZ[SZ]; \ |
| 11 |
for (int i = 0; i < SZ; i++) \ |
| 12 |
{ \ |
| 13 |
a##TYPE1##_##TYPE2##_##SZ[i] = i % 8723; \ |
| 14 |
b##TYPE1##_##TYPE2##_##SZ[i] = i % (sizeof (TYPE2) * 3); \ |
| 15 |
} \ |
| 16 |
vnshift_##TYPE1##_##TYPE2 (dst##TYPE1##_##TYPE2##_##SZ, \ |
| 17 |
a##TYPE1##_##TYPE2##_##SZ, \ |
| 18 |
b##TYPE1##_##TYPE2##_##SZ, SZ); \ |
| 19 |
for (int i = 0; i < SZ; i++) \ |
| 20 |
{ \ |
| 21 |
assert (dst##TYPE1##_##TYPE2##_##SZ[i] \ |
| 22 |
== (TYPE2) (a##TYPE1##_##TYPE2##_##SZ[i] \ |
| 23 |
>> b##TYPE1##_##TYPE2##_##SZ[i])); \ |
| 24 |
} |
| 25 |
|
| 26 |
#define RUN_ALL(SZ) \ |
| 27 |
RUN (int16_t, int8_t, SZ) \ |
| 28 |
RUN (int16_t, uint8_t, SZ) \ |
| 29 |
RUN (uint16_t, int8_t, SZ) \ |
| 30 |
RUN (uint16_t, uint8_t, SZ) \ |
| 31 |
RUN (int32_t, int16_t, SZ) \ |
| 32 |
RUN (int32_t, uint16_t, SZ) \ |
| 33 |
RUN (uint32_t, int16_t, SZ) \ |
| 34 |
RUN (uint32_t, uint16_t, SZ) \ |
| 35 |
RUN (int64_t, int32_t, SZ) \ |
| 36 |
RUN (int64_t, uint32_t, SZ) \ |
| 37 |
RUN (uint64_t, int32_t, SZ) \ |
| 38 |
RUN (uint64_t, uint32_t, SZ) |
| 39 |
|
| 40 |
int |
| 41 |
main () |
| 42 |
{ |
| 43 |
RUN_ALL (15) |
| 44 |
RUN_ALL (16) |
| 45 |
RUN_ALL (17) |
| 46 |
RUN_ALL (127) |
| 47 |
RUN_ALL (128) |
| 48 |
RUN_ALL (129) |
| 49 |
RUN_ALL (512) |
| 50 |
} |