(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
arm/
memset-inline-6.c
       1  /* { dg-do run } */
       2  /* { dg-skip-if "Don't inline memset using neon instructions" { ! arm_tune_string_ops_prefer_neon } } */
       3  /* { dg-options "-save-temps -O2 -fno-inline" } */
       4  /* { dg-add-options "arm_neon" } */
       5  
       6  #include <string.h>
       7  #include <stdlib.h>
       8  
       9  #define LEN (100)
      10  int a[LEN];
      11  int b[LEN];
      12  int c[LEN];
      13  void
      14  foo1 (void)
      15  {
      16      memset (a, -1, 20);
      17      return;
      18  }
      19  
      20  void
      21  foo2 (void)
      22  {
      23    memset (b, 1, 24);
      24    return;
      25  }
      26  
      27  void
      28  foo3 (void)
      29  {
      30    memset (c, -1, 32);
      31    return;
      32  }
      33  
      34  void
      35  check (signed char *arr, int idx, int len, int v)
      36  {
      37    int i;
      38    for (i = 0; i < idx; i++)
      39      if (arr[i] != v)
      40        abort ();
      41  
      42    for (i = idx; i < len; i++)
      43      if (arr[i] != 0)
      44        abort ();
      45  }
      46  
      47  int
      48  main(void)
      49  {
      50    foo1 ();
      51    check ((signed char *)a, 20, sizeof (a), -1);
      52  
      53    foo2 ();
      54    check ((signed char *)b, 24, sizeof (b), 1);
      55  
      56    foo3 ();
      57    check ((signed char *)c, 32, sizeof (c), -1);
      58  
      59    return 0;
      60  }
      61  
      62  /* { dg-final { scan-assembler-not "bl?\[ \t\]+memset" { target { arm_little_endian && arm_neon } } } } */
      63  /* { dg-final { scan-assembler-times "vst1" 3 { target { arm_little_endian && arm_neon } } } } */
      64  /* { dg-final { scan-assembler-times "vstr" 4 { target { arm_little_endian && arm_neon } } } } */
      65  
      66