1 /* { dg-do compile } */
2 /* { dg-require-effective-target arm_crypto_ok } */
3 /* { dg-require-effective-target arm_fp_ok } */
4 /* { dg-options "-Ofast" } */
5 /* { dg-add-options arm_fp } */
6
7 /* Reset fpu to a value compatible with the next pragmas. */
8 #pragma GCC target ("fpu=vfp")
9 #pragma GCC push_options
10
11 #include <arm_neon.h>
12
13 /* Check that neon is used. */
14 /*
15 **my:
16 ** ...
17 ** vadd.f32 d[0-9]+, d[0-9]+, d[0-9]+
18 ** ...
19 ** bx lr
20 */
21 float32x2_t __attribute__ ((target("fpu=neon")))
22 my (float32x2_t __a, float32x2_t __b)
23 {
24 return __a + __b;
25 }
26
27 /* Check that crypto builtins are recognized. */
28 /*
29 **foo:
30 ** ...
31 ** (
32 ** vld1.64 {d[0-9]+-d[0-9]+}, \[r[0-9]+:64\]
33 ** |
34 ** vld1.64 {d[0-9]+}, \[r[0-9]+:64\]!
35 ** vld1.64 {d[0-9]+}, \[r[0-9]+:64\]
36 ** )
37 ** ...
38 ** bx lr
39 */
40
41 poly128_t __attribute__ ((target("fpu=crypto-neon-fp-armv8")))
42 foo (poly128_t* ptr)
43 {
44 return vldrq_p128 (ptr);
45 }
46
47 /* Check that fpu=vfp is restored. */
48 /*
49 **my1:
50 ** ...
51 ** vadd.f32 s[0-9]+, s[0-9]+, s[0-9]+
52 ** vadd.f32 s[0-9]+, s[0-9]+, s[0-9]+
53 ** ...
54 ** bx lr
55 */float32x2_t
56 my1 (float32x2_t __a, float32x2_t __b)
57 {
58 return __a + __b;
59 }
60
61 /* { dg-final { scan-assembler "\.fpu\\s+vfp\n" } } */
62 /* { dg-final { scan-assembler "\.fpu\\s+neon\n" } } */
63 /* { dg-final { scan-assembler "\.fpu\\s+crypto-neon-fp-armv8\n" } } */
64 /* { dg-final { check-function-bodies "**" "" } } */