summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/riscv/rvv/base/scalar_move-4.c
blob: 19544f93a4a9016799575864b422a9536ed168e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* { dg-do compile } */
/* { dg-options "-march=rv32gcv -mabi=ilp32d -fno-schedule-insns -fno-schedule-insns2 -O3" } */
/* { dg-final { check-function-bodies "**" "" } } */

#include "riscv_vector.h"


/*
** foo1:
**	flw\t[a-x0-9]+,0\([a-x0-9]+\)
**	ret
*/
float foo1 (void *base, size_t vl)
{
  vfloat32m1_t v = *(vfloat32m1_t*)base;
  float scalar = __riscv_vfmv_f_s_f32m1_f32 (v);
  return scalar;
}

/*
** foo2:
**	flw\t[a-x0-9]+,0\([a-x0-9]+\)
**	ret
*/
float foo2 (void *base, size_t vl)
{
  vfloat32mf2_t v = *(vfloat32mf2_t*)base;
  float scalar = __riscv_vfmv_f_s_f32mf2_f32 (v);
  return scalar;
}

/*
** foo3:
**	flw\t[a-x0-9]+,4\([a-x0-9]+\)
**	ret
*/
float foo3 (float *base, size_t vl)
{
  vfloat32m1_t v = *(vfloat32m1_t*)(base+1);
  float scalar = __riscv_vfmv_f_s_f32m1_f32 (v);
  return scalar;
}

/*
** foo4:
**	lw\t[a-x0-9]+,4\([a-x0-9]+\)
**	ret
*/
int32_t foo4 (float *base, size_t vl)
{
  vfloat32m1_t v = *(vfloat32m1_t*)(base+1);
  float scalar = __riscv_vfmv_f_s_f32m1_f32 (v);
  return *(int32_t*)&scalar;
}