1 // RUN: %clang_cc1 -triple aarch64-arm-none-eabi -target-feature +neon -target-feature +bf16 \
2 // RUN:  -O2 -fallow-half-arguments-and-returns -verify -fsyntax-only %s
3 
4 #include "arm_neon.h"
5 
6 int x;
7 
test_vld1_lane_bf16(bfloat16_t const * ptr,bfloat16x4_t src)8 bfloat16x4_t test_vld1_lane_bf16(bfloat16_t const *ptr, bfloat16x4_t src) {
9   (void)vld1_lane_bf16(ptr, src, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
10   (void)vld1_lane_bf16(ptr, src, 4);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
11   return vld1_lane_bf16(ptr, src, x); // expected-error-re {{argument {{.*}} must be a constant integer}}
12 }
13 
test_vld1q_lane_bf16(bfloat16_t const * ptr,bfloat16x8_t src)14 bfloat16x8_t test_vld1q_lane_bf16(bfloat16_t const *ptr, bfloat16x8_t src) {
15   (void)vld1q_lane_bf16(ptr, src, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
16   (void)vld1q_lane_bf16(ptr, src, 8);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
17   return vld1q_lane_bf16(ptr, src, x); // expected-error-re {{argument {{.*}} must be a constant integer}}
18 }
19 
test_vld2_lane_bf16(bfloat16_t const * ptr,bfloat16x4x2_t src)20 bfloat16x4x2_t test_vld2_lane_bf16(bfloat16_t const *ptr, bfloat16x4x2_t src) {
21   (void)vld2_lane_bf16(ptr, src, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
22   (void)vld2_lane_bf16(ptr, src, 4);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
23   return vld2_lane_bf16(ptr, src, x); // expected-error-re {{argument {{.*}} must be a constant integer}}
24 }
25 
test_vld2q_lane_bf16(bfloat16_t const * ptr,bfloat16x8x2_t src)26 bfloat16x8x2_t test_vld2q_lane_bf16(bfloat16_t const *ptr, bfloat16x8x2_t src) {
27   (void)vld2q_lane_bf16(ptr, src, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
28   (void)vld2q_lane_bf16(ptr, src, 8);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
29   return vld2q_lane_bf16(ptr, src, x); // expected-error-re {{argument {{.*}} must be a constant integer}}
30 }
31 
test_vld3_lane_bf16(bfloat16_t const * ptr,bfloat16x4x3_t src)32 bfloat16x4x3_t test_vld3_lane_bf16(bfloat16_t const *ptr, bfloat16x4x3_t src) {
33   (void)vld3_lane_bf16(ptr, src, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
34   (void)vld3_lane_bf16(ptr, src, 4);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
35   return vld3_lane_bf16(ptr, src, x); // expected-error-re {{argument {{.*}} must be a constant integer}}
36 }
37 
test_vld3q_lane_bf16(bfloat16_t const * ptr,bfloat16x8x3_t src)38 bfloat16x8x3_t test_vld3q_lane_bf16(bfloat16_t const *ptr, bfloat16x8x3_t src) {
39   (void)vld3q_lane_bf16(ptr, src, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
40   (void)vld3q_lane_bf16(ptr, src, 8);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
41   return vld3q_lane_bf16(ptr, src, x); // expected-error-re {{argument {{.*}} must be a constant integer}}
42 }
43 
test_vld4_lane_bf16(bfloat16_t const * ptr,bfloat16x4x4_t src)44 bfloat16x4x4_t test_vld4_lane_bf16(bfloat16_t const *ptr, bfloat16x4x4_t src) {
45   (void)vld4_lane_bf16(ptr, src, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
46   (void)vld4_lane_bf16(ptr, src, 4);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
47   return vld4_lane_bf16(ptr, src, x); // expected-error-re {{argument {{.*}} must be a constant integer}}
48 }
49 
test_vld4q_lane_bf16(bfloat16_t const * ptr,bfloat16x8x4_t src)50 bfloat16x8x4_t test_vld4q_lane_bf16(bfloat16_t const *ptr, bfloat16x8x4_t src) {
51   (void)vld4q_lane_bf16(ptr, src, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
52   (void)vld4q_lane_bf16(ptr, src, 8);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
53   return vld4q_lane_bf16(ptr, src, x); // expected-error-re {{argument {{.*}} must be a constant integer}}
54 }
55 
test_vst1_lane_bf16(bfloat16_t * ptr,bfloat16x4_t val)56 void test_vst1_lane_bf16(bfloat16_t *ptr, bfloat16x4_t val) {
57   vst1_lane_bf16(ptr, val, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
58   vst1_lane_bf16(ptr, val, 4);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
59   vst1_lane_bf16(ptr, val, x);  // expected-error-re {{argument {{.*}} must be a constant integer}}
60 }
61 
test_vst1q_lane_bf16(bfloat16_t * ptr,bfloat16x8_t val)62 void test_vst1q_lane_bf16(bfloat16_t *ptr, bfloat16x8_t val) {
63   vst1q_lane_bf16(ptr, val, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
64   vst1q_lane_bf16(ptr, val, 8);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
65   vst1q_lane_bf16(ptr, val, x);  // expected-error-re {{argument {{.*}} must be a constant integer}}
66 }
67 
test_vst2_lane_bf16(bfloat16_t * ptr,bfloat16x4x2_t val)68 void test_vst2_lane_bf16(bfloat16_t *ptr, bfloat16x4x2_t val) {
69   vst2_lane_bf16(ptr, val, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
70   vst2_lane_bf16(ptr, val, 4);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
71   vst2_lane_bf16(ptr, val, x);  // expected-error-re {{argument {{.*}} must be a constant integer}}
72 }
73 
test_vst2q_lane_bf16(bfloat16_t * ptr,bfloat16x8x2_t val)74 void test_vst2q_lane_bf16(bfloat16_t *ptr, bfloat16x8x2_t val) {
75   vst2q_lane_bf16(ptr, val, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
76   vst2q_lane_bf16(ptr, val, 8);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
77   vst2q_lane_bf16(ptr, val, x);  // expected-error-re {{argument {{.*}} must be a constant integer}}
78 }
79 
test_vst3_lane_bf16(bfloat16_t * ptr,bfloat16x4x3_t val)80 void test_vst3_lane_bf16(bfloat16_t *ptr, bfloat16x4x3_t val) {
81   vst3_lane_bf16(ptr, val, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
82   vst3_lane_bf16(ptr, val, 4);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
83   vst3_lane_bf16(ptr, val, x);  // expected-error-re {{argument {{.*}} must be a constant integer}}
84 }
85 
test_vst3q_lane_bf16(bfloat16_t * ptr,bfloat16x8x3_t val)86 void test_vst3q_lane_bf16(bfloat16_t *ptr, bfloat16x8x3_t val) {
87   vst3q_lane_bf16(ptr, val, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
88   vst3q_lane_bf16(ptr, val, 8);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
89   vst3q_lane_bf16(ptr, val, x);  // expected-error-re {{argument {{.*}} must be a constant integer}}
90 }
91 
test_vst4_lane_bf16(bfloat16_t * ptr,bfloat16x4x4_t val)92 void test_vst4_lane_bf16(bfloat16_t *ptr, bfloat16x4x4_t val) {
93   vst4_lane_bf16(ptr, val, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
94   vst4_lane_bf16(ptr, val, 4);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
95   vst4_lane_bf16(ptr, val, x);  // expected-error-re {{argument {{.*}} must be a constant integer}}
96 }
97 
test_vst4q_lane_bf16(bfloat16_t * ptr,bfloat16x8x4_t val)98 void test_vst4q_lane_bf16(bfloat16_t *ptr, bfloat16x8x4_t val) {
99   vst4q_lane_bf16(ptr, val, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
100   vst4q_lane_bf16(ptr, val, 8);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
101   vst4q_lane_bf16(ptr, val, x);  // expected-error-re {{argument {{.*}} must be a constant integer}}
102 }
103