aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/popcnt13.c
blob: 2a30e9843322cd4277976afdcbb4ad4fffcc5560 (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { check-function-bodies "**" "" } } */

#pragma GCC target "+nocssc+sve"

/*
** h128:
**	ldr	q([0-9]+), \[x0\]
**	ptrue	p([0-9]+).b, vl16
**	cnt	z([0-9]+).d, p\2/m, z\1.d
**	addp	d([0-9]+), v\3.2d
**	fmov	x0, d\4
**	ret
*/

unsigned h128 (const unsigned __int128 *a) {
	  return __builtin_popcountg (a[0]);
}

/* There should be only one POPCOUNT. */
/* { dg-final { scan-tree-dump-times "POPCOUNT " 1 "optimized" } } */
/* { dg-final { scan-tree-dump-not " __builtin_popcount"  "optimized" } } */