xref: /llvm-project/clang/test/Sema/aarch64-sve-intrinsics/acle_sve_imm_lane.cpp (revision 123064dc397d478a636ba1c5960d41ad381036a0)
1 // REQUIRES: aarch64-registered-target
2 
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only -verify %s
4 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only -verify %s
5 
6 #ifdef SVE_OVERLOADED_FORMS
7 // A simple used,unused... macro, long enough to represent any SVE builtin.
8 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
9 #else
10 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
11 #endif
12 
13 #include <arm_sve.h>
14 
test_range_0_7()15 void test_range_0_7()
16 {
17   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
18   SVE_ACLE_FUNC(svmla_lane,_f16,,)(svundef_f16(), svundef_f16(), svundef_f16(), -1);
19   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 7]}}
20   SVE_ACLE_FUNC(svmul_lane,_f16,,)(svundef_f16(), svundef_f16(), 8);
21 }
22 
test_range_0_3()23 void test_range_0_3()
24 {
25   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 3]}}
26   SVE_ACLE_FUNC(svcmla_lane,_f16,,)(svundef_f16(), svundef_f16(), svundef_f16(), -1, 0);
27   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 3]}}
28   SVE_ACLE_FUNC(svdot_lane,_s32,,)(svundef_s32(), svundef_s8(), svundef_s8(), 4);
29   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 3]}}
30   SVE_ACLE_FUNC(svdot_lane,_u32,,)(svundef_u32(), svundef_u8(), svundef_u8(), -1);
31   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 3]}}
32   SVE_ACLE_FUNC(svmla_lane,_f32,,)(svundef_f32(), svundef_f32(), svundef_f32(), 4);
33   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 3]}}
34   SVE_ACLE_FUNC(svmul_lane,_f32,,)(svundef_f32(), svundef_f32(), -1);
35 }
36 
test_range_0_1()37 void test_range_0_1()
38 {
39   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 1]}}
40   SVE_ACLE_FUNC(svcmla_lane,_f32,,)(svundef_f32(), svundef_f32(), svundef_f32(), -1, 0);
41   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 1]}}
42   SVE_ACLE_FUNC(svdot_lane,_s64,,)(svundef_s64(), svundef_s16(), svundef_s16(), 2);
43   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 1]}}
44   SVE_ACLE_FUNC(svdot_lane,_u64,,)(svundef_u64(), svundef_u16(), svundef_u16(), -1);
45   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 1]}}
46   SVE_ACLE_FUNC(svmla_lane,_f64,,)(svundef_f64(), svundef_f64(), svundef_f64(), 2);
47   // expected-error-re@+1 {{argument value {{[0-9]+}} is outside the valid range [0, 1]}}
48   SVE_ACLE_FUNC(svmul_lane,_f64,,)(svundef_f64(), svundef_f64(), -1);
49 }
50