| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-march=rv32gcv_zvfh -mabi=ilp32d -O2" } */ |
| 3 |
/* { dg-final { check-function-bodies "**" "" } } */ |
| 4 |
|
| 5 |
#include "riscv_vector.h" |
| 6 |
|
| 7 |
typedef _Float16 float16_t; |
| 8 |
typedef float float32_t; |
| 9 |
typedef double float64_t; |
| 10 |
|
| 11 |
/* |
| 12 |
**foo: |
| 13 |
** vsetvli\s+zero,\s*[a-z0-9]+,e8,m1,ta,ma |
| 14 |
** vle8\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 15 |
** vse8\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 16 |
** ret |
| 17 |
*/ |
| 18 |
void foo (int8_t *in, int8_t *out, int n) |
| 19 |
{ |
| 20 |
vint8m1_t v = __riscv_vlse8_v_i8m1 (in, 1, n); |
| 21 |
__riscv_vsse8_v_i8m1 (out, 1, v, n); |
| 22 |
} |
| 23 |
|
| 24 |
/* |
| 25 |
**foo1: |
| 26 |
** vsetvli\s+zero,\s*[a-z0-9]+,e16,m1,ta,ma |
| 27 |
** vle16\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 28 |
** vse16\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 29 |
** ret |
| 30 |
*/ |
| 31 |
void foo1 (int16_t *in, int16_t *out, int n) |
| 32 |
{ |
| 33 |
vint16m1_t v = __riscv_vlse16_v_i16m1 (in, 2, n); |
| 34 |
__riscv_vsse16_v_i16m1 (out, 2, v, n); |
| 35 |
} |
| 36 |
|
| 37 |
/* |
| 38 |
**foo2: |
| 39 |
** vsetvli\s+zero,\s*[a-z0-9]+,e32,m1,ta,ma |
| 40 |
** vle32\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 41 |
** vse32\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 42 |
** ret |
| 43 |
*/ |
| 44 |
void foo2 (int32_t *in, int32_t *out, int n) |
| 45 |
{ |
| 46 |
vint32m1_t v = __riscv_vlse32_v_i32m1 (in, 4, n); |
| 47 |
__riscv_vsse32_v_i32m1 (out, 4, v, n); |
| 48 |
} |
| 49 |
|
| 50 |
/* |
| 51 |
**foo3: |
| 52 |
** vsetvli\s+zero,\s*[a-z0-9]+,e64,m1,ta,ma |
| 53 |
** vle64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 54 |
** vse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 55 |
** ret |
| 56 |
*/ |
| 57 |
void foo3 (int64_t *in, int64_t *out, int n) |
| 58 |
{ |
| 59 |
vint64m1_t v = __riscv_vlse64_v_i64m1 (in, 8, n); |
| 60 |
__riscv_vsse64_v_i64m1 (out, 8, v, n); |
| 61 |
} |
| 62 |
|
| 63 |
/* |
| 64 |
**foo4: |
| 65 |
** vsetvli\s+zero,\s*[a-z0-9]+,e16,mf2,ta,ma |
| 66 |
** vle16\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 67 |
** vse16\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 68 |
** ret |
| 69 |
*/ |
| 70 |
void foo4 (float16_t *in, float16_t *out, int n) |
| 71 |
{ |
| 72 |
vfloat16mf2_t v = __riscv_vlse16_v_f16mf2 (in, 2, n); |
| 73 |
__riscv_vsse16_v_f16mf2 (out, 2, v, n); |
| 74 |
} |
| 75 |
|
| 76 |
/* |
| 77 |
**foo5: |
| 78 |
** vsetvli\s+zero,\s*[a-z0-9]+,e32,m1,ta,ma |
| 79 |
** vle32\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 80 |
** vse32\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 81 |
** ret |
| 82 |
*/ |
| 83 |
void foo5 (float32_t *in, float32_t *out, int n) |
| 84 |
{ |
| 85 |
vfloat32m1_t v = __riscv_vlse32_v_f32m1 (in, 4, n); |
| 86 |
__riscv_vsse32_v_f32m1 (out, 4, v, n); |
| 87 |
} |
| 88 |
|
| 89 |
/* |
| 90 |
**foo6: |
| 91 |
** vsetvli\s+zero,\s*[a-z0-9]+,e64,m1,ta,ma |
| 92 |
** vle64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 93 |
** vse64\.v\s+v[0-9]+,\s*0\([a-x0-9]+\) |
| 94 |
** ret |
| 95 |
*/ |
| 96 |
void foo6 (float64_t *in, float64_t *out, int n) |
| 97 |
{ |
| 98 |
vfloat64m1_t v = __riscv_vlse64_v_f64m1 (in, 8, n); |
| 99 |
__riscv_vsse64_v_f64m1 (out, 8, v, n); |
| 100 |
} |