aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/attr-neon2.c
blob: c0f7667c2dcddd8b79f746f69047900abd07ea94 (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
42
43
44
45
46
/* { dg-do compile } */
/* { dg-require-effective-target arm_neon_h_ok } */
/* { dg-options "-Ofast" } */
/* { dg-add-options arm_neon_h } */

/* Reset fpu to a value compatible with the next pragmas.  */
#pragma GCC target ("fpu=vfp")
#pragma GCC push_options

#pragma GCC target ("fpu=neon")
#include <arm_neon.h>

/* Check that pragma target is used.  */
/*
**my:
**	...
**	vadd.f32	d[0-9]+, d[0-9]+, d[0-9]+
**	...
**	bx	lr
*/
float32x2_t
my (float32x2_t __a, float32x2_t __b)
{
  return __a + __b;
}

#pragma GCC pop_options

/* Check that fpu=vfp is restored.  */
/*
**my1:
**	...
**	vadd.f32	s[0-9]+, s[0-9]+, s[0-9]+
**	vadd.f32	s[0-9]+, s[0-9]+, s[0-9]+
**	...
**	bx	lr
*/
float32x2_t
my1 (float32x2_t __a, float32x2_t __b)
{
  return __a + __b;
}

/* { dg-final { scan-assembler "\.fpu\\s+vfp\n" } } */
/* { dg-final { scan-assembler "\.fpu\\s+neon\n" } } */
/* { dg-final { check-function-bodies "**" "" } } */