1  /* { dg-options "-O -msve-vector-bits=256 -fomit-frame-pointer" } */
       2  
       3  #include <arm_sve.h>
       4  
       5  typedef bfloat16_t bfloat16x16_t __attribute__((vector_size (32)));
       6  typedef float16_t float16x16_t __attribute__((vector_size (32)));
       7  typedef float32_t float32x8_t __attribute__((vector_size (32)));
       8  typedef float64_t float64x4_t __attribute__((vector_size (32)));
       9  typedef int8_t int8x32_t __attribute__((vector_size (32)));
      10  typedef int16_t int16x16_t __attribute__((vector_size (32)));
      11  typedef int32_t int32x8_t __attribute__((vector_size (32)));
      12  typedef int64_t int64x4_t __attribute__((vector_size (32)));
      13  typedef uint8_t uint8x32_t __attribute__((vector_size (32)));
      14  typedef uint16_t uint16x16_t __attribute__((vector_size (32)));
      15  typedef uint32_t uint32x8_t __attribute__((vector_size (32)));
      16  typedef uint64_t uint64x4_t __attribute__((vector_size (32)));
      17  
      18  void bfloat16_callee (bfloat16x16_t);
      19  void float16_callee (float16x16_t);
      20  void float32_callee (float32x8_t);
      21  void float64_callee (float64x4_t);
      22  void int8_callee (int8x32_t);
      23  void int16_callee (int16x16_t);
      24  void int32_callee (int32x8_t);
      25  void int64_callee (int64x4_t);
      26  void uint8_callee (uint8x32_t);
      27  void uint16_callee (uint16x16_t);
      28  void uint32_callee (uint32x8_t);
      29  void uint64_callee (uint64x4_t);
      30  
      31  void
      32  bfloat16_caller (bfloat16_t val)
      33  {
      34    bfloat16_callee (svdup_bf16 (val));
      35  }
      36  
      37  void
      38  float16_caller (void)
      39  {
      40    float16_callee (svdup_f16 (1.0));
      41  }
      42  
      43  void
      44  float32_caller (void)
      45  {
      46    float32_callee (svdup_f32 (2.0));
      47  }
      48  
      49  void
      50  float64_caller (void)
      51  {
      52    float64_callee (svdup_f64 (3.0));
      53  }
      54  
      55  void
      56  int8_caller (void)
      57  {
      58    int8_callee (svindex_s8 (0, 1));
      59  }
      60  
      61  void
      62  int16_caller (void)
      63  {
      64    int16_callee (svindex_s16 (0, 2));
      65  }
      66  
      67  void
      68  int32_caller (void)
      69  {
      70    int32_callee (svindex_s32 (0, 3));
      71  }
      72  
      73  void
      74  int64_caller (void)
      75  {
      76    int64_callee (svindex_s64 (0, 4));
      77  }
      78  
      79  void
      80  uint8_caller (void)
      81  {
      82    uint8_callee (svindex_u8 (1, 1));
      83  }
      84  
      85  void
      86  uint16_caller (void)
      87  {
      88    uint16_callee (svindex_u16 (1, 2));
      89  }
      90  
      91  void
      92  uint32_caller (void)
      93  {
      94    uint32_callee (svindex_u32 (1, 3));
      95  }
      96  
      97  void
      98  uint64_caller (void)
      99  {
     100    uint64_callee (svindex_u64 (1, 4));
     101  }
     102  
     103  /* { dg-final { scan-assembler-times {\tst1b\tz[0-9]+\.b, p[0-7], \[x0\]} 2 } } */
     104  /* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.h, p[0-7], \[x0\]} 4 } } */
     105  /* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s, p[0-7], \[x0\]} 3 } } */
     106  /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d, p[0-7], \[x0\]} 3 } } */
     107  /* { dg-final { scan-assembler-times {\tadd\tx0, sp, #?16\n} 12 } } */