aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/pr120817.c
blob: 199189a8b9ad11b5efa2745e555cee6508e1dd35 (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
/* { dg-additional-options "-O1" } */
/* { dg-require-effective-target aarch64_sve_hw { target aarch64*-*-* } } */
/* { dg-additional-options "-march=armv8-a+sve -mtune=neoverse-n2" { target aarch64*-*-* } } */

#include "tree-vect.h"

typedef struct {
    int _M_current;
} __normal_iterator;

typedef struct {
    char _M_elems[5];
} array_5;

__normal_iterator __trans_tmp_1 = {-5};

__attribute__((noipa))
array_5 copySourceIntoTarget() {
    array_5 target;
    char* target_it = target._M_elems;

    while (__trans_tmp_1._M_current != 0) {
        *target_it = 1;
        __trans_tmp_1._M_current++;
        target_it++;
    }

    return target;
}

int main ()
{
  check_vect ();

  array_5 res = copySourceIntoTarget();

#pragma GCC novector
  for (int i = 0; i < 5; i++)
    if (res._M_elems[i] != 1)
      __builtin_abort ();
}