xref: /aosp_15_r20/external/clang/test/Sema/arm_acle.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -triple armv8 -target-cpu cortex-a57 -fsyntax-only -ffreestanding -verify %s
2*67e74705SXin Li 
3*67e74705SXin Li #include <arm_acle.h>
4*67e74705SXin Li /*
5*67e74705SXin Li  * Memory barrier intrinsics
6*67e74705SXin Li  * Argument for dmb, dsb, isb must be compile-time constant,
7*67e74705SXin Li  * otherwise an error should be raised.
8*67e74705SXin Li  */
test_dmb_const_diag(const unsigned int t)9*67e74705SXin Li void test_dmb_const_diag(const unsigned int t) {
10*67e74705SXin Li   return __dmb(t);  // expected-error-re {{argument to {{.*}} must be a constant integer}}
11*67e74705SXin Li }
12*67e74705SXin Li 
test_dsb_const_diag(const unsigned int t)13*67e74705SXin Li void test_dsb_const_diag(const unsigned int t) {
14*67e74705SXin Li   return __dsb(t);  // expected-error-re {{argument to {{.*}} must be a constant integer}}
15*67e74705SXin Li }
16*67e74705SXin Li 
test_isb_const_diag(const unsigned int t)17*67e74705SXin Li void test_isb_const_diag(const unsigned int t) {
18*67e74705SXin Li   return __isb(t);  // expected-error-re {{argument to {{.*}} must be a constant integer}}
19*67e74705SXin Li }
20*67e74705SXin Li 
21*67e74705SXin Li /*
22*67e74705SXin Li  * Saturating intrinsics
23*67e74705SXin Li  * Second argument for SSAT and USAT intrinsics must be compile-time constant,
24*67e74705SXin Li  * otherwise an error should be raised.
25*67e74705SXin Li  */
test_ssat_const_diag(int32_t t,const int32_t v)26*67e74705SXin Li int32_t test_ssat_const_diag(int32_t t, const int32_t v) {
27*67e74705SXin Li   return __ssat(t, v);  // expected-error-re {{argument to {{.*}} must be a constant integer}}
28*67e74705SXin Li }
29*67e74705SXin Li 
test_usat_const_diag(int32_t t,const int32_t v)30*67e74705SXin Li int32_t test_usat_const_diag(int32_t t, const int32_t v) {
31*67e74705SXin Li   return __usat(t, v);  // expected-error-re {{argument to {{.*}} must be a constant integer}}
32*67e74705SXin Li }
33*67e74705SXin Li 
34*67e74705SXin Li /*
35*67e74705SXin Li  * Prefetch intrinsics
36*67e74705SXin Li  */
test_pldx_const_diag(int32_t i)37*67e74705SXin Li void test_pldx_const_diag(int32_t i) {
38*67e74705SXin Li   __pldx(i, 0, 0, 0);  // expected-error-re {{argument to {{.*}} must be a constant integer}}
39*67e74705SXin Li }
40*67e74705SXin Li 
41*67e74705SXin Li /*
42*67e74705SXin Li  * DBG intrinsic
43*67e74705SXin Li  * First argument for DBG intrinsic must be compile-time constant,
44*67e74705SXin Li  * otherwise an error should be raised.
45*67e74705SXin Li  */
test_dbg_const_diag(unsigned int t)46*67e74705SXin Li void test_dbg_const_diag(unsigned int t) {
47*67e74705SXin Li   __dbg(t);  // expected-error-re {{argument to {{.*}} must be a constant integer}}
48*67e74705SXin Li }
49