aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/pragma_arch_attribute.c
blob: a5e1edad3a42b9225d08931686a3c12d944ff6e7 (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
47
48
49
50
51
52
53
54
/* Test for #pragma target macros.  */
/* { dg-do compile } */
/* { dg-require-effective-target arm_arch_v8a_ok } */
/* { dg-add-options arm_arch_v8a } */

#include <arm_acle.h>

#ifdef __ARM_FEATURE_CRC32
# error "__ARM_FEATURE_CRC32 is already defined."
#endif

#pragma GCC push_options
#pragma GCC target ("arch=armv8-a+simd+crc")
#ifndef __ARM_FEATURE_CRC32
# error "__ARM_FEATURE_CRC32 is not defined in push 1."
#endif
#pragma GCC pop_options

#ifdef __ARM_FEATURE_CRC32
# error "__ARM_FEATURE_CRC32 is defined after pop 1."
#endif

#pragma GCC push_options
#pragma GCC target ("+crc")
#ifndef __ARM_FEATURE_CRC32
# error "__ARM_FEATURE_CRC32 is not defined in push 2."
#endif
#pragma GCC pop_options

#ifdef __ARM_FEATURE_CRC32
# error "__ARM_FEATURE_CRC32 is defined after pop 2."
#endif

__attribute__((target("+crc")))
void test_crc_unknown_ok_attr_1 ()
{
	__crc32b (0, 0);
}

#ifdef __ARM_FEATURE_CRC32
# error "__ARM_FEATURE_CRC32 is defined after attribute set 1."
#endif

__attribute__((target("arch=armv8-a+simd+crc")))
void test_crc_unknown_ok_attr_2 ()
{
	__crc32b (0, 0);
}

#ifdef __ARM_FEATURE_CRC32
# error "__ARM_FEATURE_CRC32 is defined after attribute set 2."
#endif

#pragma GCC reset_options