Debian Codegraph @

gcc/testsuite/gcc.target/arm/attr-crypto.c

raw
1 /* { dg-do compile } */
2 /* Make sure we can force fpu=vfp before switching using the
3 pragma. */
4 /* { dg-skip-if "-mpure-code supports M-profile only" { *-*-* } { "-mpure-code" } } */
5 /* { dg-require-effective-target arm_fp_ok } */
6 /* { dg-options "-O2 -march=armv8-a+simd" } */
7 /* { dg-add-options arm_fp } */
8
9 /* Reset fpu to a value compatible with the next pragmas. */
10 #pragma GCC target ("fpu=vfp")
11 #pragma GCC push_options
12
13 #pragma GCC target ("fpu=crypto-neon-fp-armv8")
14
15 #ifndef __ARM_FEATURE_CRYPTO
16 #error __ARM_FEATURE_CRYPTO not defined.
17 #endif
18
19 #ifndef __ARM_FEATURE_AES
20 #error __ARM_FEATURE_AES not defined.
21 #endif
22
23 #ifndef __ARM_FEATURE_SHA2
24 #error __ARM_FEATURE_SHA2 not defined.
25 #endif
26
27 #ifndef __ARM_NEON
28 #error __ARM_NEON not defined.
29 #endif
30
31 #if !defined(__ARM_FP) || (__ARM_FP != 14)
32 #error __ARM_FP
33 #endif
34
35 #include "arm_neon.h"
36
37 int
38 foo (void)
39 {
40 uint32x4_t a = {0xd, 0xe, 0xa, 0xd};
41 uint32x4_t b = {0, 1, 2, 3};
42
43 uint32x4_t res = vsha256su0q_u32 (a, b);
44 return res[0];
45 }
46
47 #pragma GCC pop_options
48
49 /* Check that the FP version is correctly reset. */
50
51 #if !defined(__ARM_FP) || (__ARM_FP != 12)
52 #error __ARM_FP
53 #endif
54
55 /* { dg-final { scan-assembler "sha256su0.32\tq\[0-9\]+, q\[0-9\]+" } } */