2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / testsuite / gcc.target / arm / attr-crypto.c
blobaf774cdaf59c2d8898e0ff1b80f5cf7fbba9f03a
1 /* { dg-do compile } */
2 /* Make sure we can force fpu=vfp before switching using the
3 pragma. */
4 /* { dg-require-effective-target arm_fp_ok } */
5 /* { dg-options "-O2 -march=armv8-a" } */
6 /* { dg-add-options arm_fp } */
8 /* Reset fpu to a value compatible with the next pragmas. */
9 #pragma GCC target ("fpu=vfp")
10 #pragma GCC push_options
12 #pragma GCC target ("fpu=crypto-neon-fp-armv8")
14 #ifndef __ARM_FEATURE_CRYPTO
15 #error __ARM_FEATURE_CRYPTO not defined.
16 #endif
18 #ifndef __ARM_NEON
19 #error __ARM_NEON not defined.
20 #endif
22 #if !defined(__ARM_FP) || (__ARM_FP != 14)
23 #error __ARM_FP
24 #endif
26 #include "arm_neon.h"
28 int
29 foo (void)
31 uint32x4_t a = {0xd, 0xe, 0xa, 0xd};
32 uint32x4_t b = {0, 1, 2, 3};
34 uint32x4_t res = vsha256su0q_u32 (a, b);
35 return res[0];
38 #pragma GCC pop_options
40 /* Check that the FP version is correctly reset. */
42 #if !defined(__ARM_FP) || (__ARM_FP != 12)
43 #error __ARM_FP
44 #endif
46 /* { dg-final { scan-assembler "sha256su0.32\tq\[0-9\]+, q\[0-9\]+" } } */