(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
riscv/
rvv/
base/
scalar_move-7.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-march=rv64gcv -mabi=lp64d -fno-schedule-insns -fno-schedule-insns2 -O3" } */
       3  /* { dg-final { check-function-bodies "**" "" } } */
       4  
       5  #include "riscv_vector.h"
       6  
       7  /*
       8  ** foo:
       9  ** addi\t[a-x0-9]+,\s*[a-x0-9]+,100
      10  ** vsetvli\tzero,a2,e64,m2,t[au],m[au]
      11  ** vlse64.v\tv[0-9]+,0\([a-x0-9]+\),zero
      12  ** vs2r.v\tv[0-9]+,0\([a-x0-9]+\)
      13  ** ret
      14  */
      15  void foo (void *base, void *out, size_t vl)
      16  {
      17      int64_t scalar = *(int64_t*)(base + 100);
      18      vint64m2_t v = __riscv_vmv_v_x_i64m2 (scalar, vl);
      19      *(vint64m2_t*)out = v;
      20  }
      21  
      22  /*
      23  ** foo2:
      24  ** addi\t[a-x0-9]+,\s*[a-x0-9]+,100
      25  ** vsetvli\tzero,a2,e64,m2,t[au],m[au]
      26  ** vlse64.v\tv[0-9]+,0\([a-x0-9]+\),zero
      27  ** vs2r.v\tv[0-9]+,0\([a-x0-9]+\)
      28  ** ret
      29  */
      30  void foo2 (void *base, void *out, size_t vl)
      31  {
      32      double scalar = *(double*)(base + 100);
      33      vfloat64m2_t v = __riscv_vfmv_v_f_f64m2 (scalar, vl);
      34      *(vfloat64m2_t*)out = v;
      35  }
      36  
      37  /*
      38  ** foo3:
      39  ** ...
      40  ** vlse64.v\tv[0-9]+,0\([a-x0-9]+\),zero
      41  ** ...
      42  ** ret
      43  */
      44  void foo3 (void *base, void *out, size_t vl)
      45  {
      46      int64_t scalar = *(int64_t*)(base + 100);
      47      vint64m2_t merge = *(vint64m2_t*) (base + 200);
      48      vint64m2_t v = __riscv_vmv_v_x_i64m2_tu (merge, scalar, vl);
      49      *(vint64m2_t*)out = v;
      50  }
      51  
      52  /*
      53  ** foo4:
      54  ** ...
      55  ** vlse64.v\tv[0-9]+,0\([a-x0-9]+\),zero
      56  ** ...
      57  ** ret
      58  */
      59  void foo4 (void *base, void *out, size_t vl)
      60  {
      61      double scalar = *(double*)(base + 100);
      62      vfloat64m2_t merge = *(vfloat64m2_t*) (base + 200);
      63      vfloat64m2_t v = __riscv_vfmv_v_f_f64m2_tu (merge, scalar, vl);
      64      *(vfloat64m2_t*)out = v;
      65  }
      66  
      67  /*
      68  ** foo5:
      69  ** ...
      70  ** vmv.v.x\tv[0-9]+,\s*[a-x0-9]+
      71  ** ...
      72  ** ret
      73  */
      74  void foo5 (void *base, void *out, size_t vl, int64_t x)
      75  {
      76      vint64m2_t v = __riscv_vmv_v_x_i64m2 (x, vl);
      77      *(vint64m2_t*)out = v;
      78  }
      79  
      80  /*
      81  ** foo6:
      82  ** ...
      83  ** vfmv.v.f\tv[0-9]+,\s*[a-x0-9]+
      84  ** ...
      85  ** ret
      86  */
      87  void foo6 (void *base, void *out, size_t vl, double x)
      88  {
      89      vfloat64m2_t v = __riscv_vfmv_v_f_f64m2 (x, vl);
      90      *(vfloat64m2_t*)out = v;
      91  }
      92  
      93  /*
      94  ** foo7:
      95  ** ...
      96  ** vmv.v.x\tv[0-9]+,\s*[a-x0-9]+
      97  ** ...
      98  ** ret
      99  */
     100  void foo7 (void *base, void *out, size_t vl, int64_t x)
     101  {
     102      vint64m2_t merge = *(vint64m2_t*) (base + 200);
     103      vint64m2_t v = __riscv_vmv_v_x_i64m2_tu (merge, x, vl);
     104      *(vint64m2_t*)out = v;
     105  }
     106  
     107  /*
     108  ** foo8:
     109  ** ...
     110  ** vfmv.v.f\tv[0-9]+,\s*[a-x0-9]+
     111  ** ...
     112  ** ret
     113  */
     114  void foo8 (void *base, void *out, size_t vl, double x)
     115  {
     116      vfloat64m2_t merge = *(vfloat64m2_t*) (base + 200);
     117      vfloat64m2_t v = __riscv_vfmv_v_f_f64m2_tu (merge, x, vl);
     118      *(vfloat64m2_t*)out = v;
     119  }
     120  
     121  /*
     122  ** foo9:
     123  ** ...
     124  ** vmv.v.i\tv[0-9]+,\s*-15
     125  ** ...
     126  ** ret
     127  */
     128  void foo9 (void *base, void *out, size_t vl)
     129  {
     130      int64_t scalar = *(int64_t*)(base + 100);
     131      vint64m2_t v = __riscv_vmv_v_x_i64m2 (-15, vl);
     132      *(vint64m2_t*)out = v;
     133  }
     134  
     135  /*
     136  ** foo10:
     137  ** ...
     138  ** vmv.v.i\tv[0-9]+,\s*-15
     139  ** ...
     140  ** ret
     141  */
     142  void foo10 (void *base, void *out, size_t vl)
     143  {
     144      int64_t scalar = *(int64_t*)(base + 100);
     145      vint64m2_t merge = *(vint64m2_t*) (base + 200);
     146      vint64m2_t v = __riscv_vmv_v_x_i64m2_tu (merge, -15, vl);
     147      *(vint64m2_t*)out = v;
     148  }
     149  
     150  /*
     151  ** foo11:
     152  ** ...
     153  ** vmv.v.i\tv[0-9]+,\s*0
     154  ** ...
     155  ** ret
     156  */
     157  void foo11 (void *base, void *out, size_t vl)
     158  {
     159      double scalar = *(double*)(base + 100);
     160      vfloat64m2_t v = __riscv_vfmv_v_f_f64m2 (0, vl);
     161      *(vfloat64m2_t*)out = v;
     162  }
     163  
     164  /*
     165  ** foo12:
     166  ** ...
     167  ** vmv.v.i\tv[0-9]+,\s*0
     168  ** ...
     169  ** ret
     170  */
     171  void foo12 (void *base, void *out, size_t vl)
     172  {
     173      vfloat64m2_t merge = *(vfloat64m2_t*) (base + 200);
     174      vfloat64m2_t v = __riscv_vfmv_v_f_f64m2_tu (merge, 0, vl);
     175      *(vfloat64m2_t*)out = v;
     176  }