summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/vadd_reduc-2.c
blob: 0ad96954ff7daeb983adaafaec655770d9fe77cd (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
/* { dg-do compile } */
/* { dg-additional-options "-O3 -std=c99" } */
/* { dg-final { check-function-bodies "**" "" "" } } */

#include <stdint.h>

#pragma GCC target "+nosve"

/*
**test:
**	...
**	addv	s0, v0.4s
**	fmov	w0, s0
**	and	w1, w0, 65535
**	add	w0, w1, w0, lsr 16
**	lsr	w0, w0, 1
**	ret
*/
int test (uint8_t *p, uint32_t t[1][1], int n) {

  int sum = 0;
  uint32_t a0;
  for (int i = 0; i < 4; i++, p++)
    t[i][0] = p[0];

  for (int i = 0; i < 4; i++) {
    {
      int t0 = t[0][i] + t[0][i];
      a0 = t0;
    };
    sum += a0;
  }
  return (((uint16_t)sum) + ((uint32_t)sum >> 16)) >> 1;
}