[RISCV] Simplify MIPS CCMov patterns. NFC (#125318)
[llvm-project.git] / clang / test / Sema / aarch64-neon-immediate-ranges / fp16-vector.c
blob6460018b744086cc3f14d47825d67fa734945b80
1 // RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -target-feature +v8.2a -ffreestanding -fsyntax-only -verify %s
3 #include <arm_neon.h>
4 #include <arm_fp16.h>
5 // REQUIRES: aarch64-registered-target
7 // vcvtq_n_f16_u16 is tested under clang/test/Sema/arm-mve-immediates.c
9 void test_multiplication_f16(float16_t arg_f16, float16x8_t arg_f16x8, float16x4_t arg_f16x4) {
10 vmul_lane_f16(arg_f16x4, arg_f16x4, 0);
11 vmul_lane_f16(arg_f16x4, arg_f16x4, 3);
12 vmul_lane_f16(arg_f16x4, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
13 vmul_lane_f16(arg_f16x4, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
15 vmulq_lane_f16(arg_f16x8, arg_f16x4, 0);
16 vmulq_lane_f16(arg_f16x8, arg_f16x4, 3);
17 vmulq_lane_f16(arg_f16x8, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
18 vmulq_lane_f16(arg_f16x8, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
20 vmul_laneq_f16(arg_f16x4, arg_f16x8, 0);
21 vmul_laneq_f16(arg_f16x4, arg_f16x8, 7);
22 vmul_laneq_f16(arg_f16x4, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
23 vmul_laneq_f16(arg_f16x4, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
25 vmulq_laneq_f16(arg_f16x8, arg_f16x8, 0);
26 vmulq_laneq_f16(arg_f16x8, arg_f16x8, 7);
27 vmulq_laneq_f16(arg_f16x8, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
28 vmulq_laneq_f16(arg_f16x8, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
30 vmulh_lane_f16(arg_f16, arg_f16x4, 0);
31 vmulh_lane_f16(arg_f16, arg_f16x4, 3);
32 vmulh_lane_f16(arg_f16, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
33 vmulh_lane_f16(arg_f16, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
35 vmulh_laneq_f16(arg_f16, arg_f16x8, 0);
36 vmulh_laneq_f16(arg_f16, arg_f16x8, 7);
37 vmulh_laneq_f16(arg_f16, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
38 vmulh_laneq_f16(arg_f16, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
42 void test_multiply_extended_f16(float16_t arg_f16, float16x8_t arg_f16x8, float16x4_t arg_f16x4) {
43 vmulx_lane_f16(arg_f16x4, arg_f16x4, 0);
44 vmulx_lane_f16(arg_f16x4, arg_f16x4, 3);
45 vmulx_lane_f16(arg_f16x4, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
46 vmulx_lane_f16(arg_f16x4, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
48 vmulxq_lane_f16(arg_f16x8, arg_f16x4, 0);
49 vmulxq_lane_f16(arg_f16x8, arg_f16x4, 3);
50 vmulxq_lane_f16(arg_f16x8, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
51 vmulxq_lane_f16(arg_f16x8, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
53 vmulx_laneq_f16(arg_f16x4, arg_f16x8, 0);
54 vmulx_laneq_f16(arg_f16x4, arg_f16x8, 7);
55 vmulx_laneq_f16(arg_f16x4, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
56 vmulx_laneq_f16(arg_f16x4, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
58 vmulxq_laneq_f16(arg_f16x8, arg_f16x8, 0);
59 vmulxq_laneq_f16(arg_f16x8, arg_f16x8, 7);
60 vmulxq_laneq_f16(arg_f16x8, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
61 vmulxq_laneq_f16(arg_f16x8, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
63 vmulxh_lane_f16(arg_f16, arg_f16x4, 0);
64 vmulxh_lane_f16(arg_f16, arg_f16x4, 3);
65 vmulxh_lane_f16(arg_f16, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
66 vmulxh_lane_f16(arg_f16, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
68 vmulxh_laneq_f16(arg_f16, arg_f16x8, 0);
69 vmulxh_laneq_f16(arg_f16, arg_f16x8, 7);
70 vmulxh_laneq_f16(arg_f16, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
71 vmulxh_laneq_f16(arg_f16, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
75 void test_fused_multiply_accumulate_f16(float16_t arg_f16, float16x8_t arg_f16x8, float16x4_t arg_f16x4) {
76 vfma_lane_f16(arg_f16x4, arg_f16x4, arg_f16x4, 0);
77 vfma_lane_f16(arg_f16x4, arg_f16x4, arg_f16x4, 3);
78 vfma_lane_f16(arg_f16x4, arg_f16x4, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
79 vfma_lane_f16(arg_f16x4, arg_f16x4, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
81 vfmaq_lane_f16(arg_f16x8, arg_f16x8, arg_f16x4, 0);
82 vfmaq_lane_f16(arg_f16x8, arg_f16x8, arg_f16x4, 3);
83 vfmaq_lane_f16(arg_f16x8, arg_f16x8, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
84 vfmaq_lane_f16(arg_f16x8, arg_f16x8, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
86 vfma_laneq_f16(arg_f16x4, arg_f16x4, arg_f16x8, 0);
87 vfma_laneq_f16(arg_f16x4, arg_f16x4, arg_f16x8, 7);
88 vfma_laneq_f16(arg_f16x4, arg_f16x4, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
89 vfma_laneq_f16(arg_f16x4, arg_f16x4, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
91 vfmaq_laneq_f16(arg_f16x8, arg_f16x8, arg_f16x8, 0);
92 vfmaq_laneq_f16(arg_f16x8, arg_f16x8, arg_f16x8, 7);
93 vfmaq_laneq_f16(arg_f16x8, arg_f16x8, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
94 vfmaq_laneq_f16(arg_f16x8, arg_f16x8, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
96 vfmah_lane_f16(arg_f16, arg_f16, arg_f16x4, 0);
97 vfmah_lane_f16(arg_f16, arg_f16, arg_f16x4, 3);
98 vfmah_lane_f16(arg_f16, arg_f16, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
99 vfmah_lane_f16(arg_f16, arg_f16, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
101 vfmah_laneq_f16(arg_f16, arg_f16, arg_f16x8, 0);
102 vfmah_laneq_f16(arg_f16, arg_f16, arg_f16x8, 7);
103 vfmah_laneq_f16(arg_f16, arg_f16, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
104 vfmah_laneq_f16(arg_f16, arg_f16, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
106 vfms_lane_f16(arg_f16x4, arg_f16x4, arg_f16x4, 0);
107 vfms_lane_f16(arg_f16x4, arg_f16x4, arg_f16x4, 3);
108 vfms_lane_f16(arg_f16x4, arg_f16x4, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
109 vfms_lane_f16(arg_f16x4, arg_f16x4, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
111 vfmsq_lane_f16(arg_f16x8, arg_f16x8, arg_f16x4, 0);
112 vfmsq_lane_f16(arg_f16x8, arg_f16x8, arg_f16x4, 3);
113 vfmsq_lane_f16(arg_f16x8, arg_f16x8, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
114 vfmsq_lane_f16(arg_f16x8, arg_f16x8, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
116 vfms_laneq_f16(arg_f16x4, arg_f16x4, arg_f16x8, 0);
117 vfms_laneq_f16(arg_f16x4, arg_f16x4, arg_f16x8, 7);
118 vfms_laneq_f16(arg_f16x4, arg_f16x4, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
119 vfms_laneq_f16(arg_f16x4, arg_f16x4, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
121 vfmsq_laneq_f16(arg_f16x8, arg_f16x8, arg_f16x8, 0);
122 vfmsq_laneq_f16(arg_f16x8, arg_f16x8, arg_f16x8, 7);
123 vfmsq_laneq_f16(arg_f16x8, arg_f16x8, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
124 vfmsq_laneq_f16(arg_f16x8, arg_f16x8, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
126 vfmsh_lane_f16(arg_f16, arg_f16, arg_f16x4, 0);
127 vfmsh_lane_f16(arg_f16, arg_f16, arg_f16x4, 3);
128 vfmsh_lane_f16(arg_f16, arg_f16, arg_f16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
129 vfmsh_lane_f16(arg_f16, arg_f16, arg_f16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
131 vfmsh_laneq_f16(arg_f16, arg_f16, arg_f16x8, 0);
132 vfmsh_laneq_f16(arg_f16, arg_f16, arg_f16x8, 7);
133 vfmsh_laneq_f16(arg_f16, arg_f16, arg_f16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
134 vfmsh_laneq_f16(arg_f16, arg_f16, arg_f16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
138 void test_conversions_s16(int16x8_t arg_i16x8, int16x4_t arg_i16x4) {
139 vcvt_n_f16_s16(arg_i16x4, 1);
140 vcvt_n_f16_s16(arg_i16x4, 16);
141 vcvt_n_f16_s16(arg_i16x4, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
142 vcvt_n_f16_s16(arg_i16x4, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
144 vcvtq_n_f16_s16(arg_i16x8, 1);
145 vcvtq_n_f16_s16(arg_i16x8, 16);
146 vcvtq_n_f16_s16(arg_i16x8, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
147 vcvtq_n_f16_s16(arg_i16x8, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
151 void test_conversions_u16(uint16x8_t arg_u16x8, uint16x4_t arg_u16x4) {
152 vcvt_n_f16_u16(arg_u16x4, 1);
153 vcvt_n_f16_u16(arg_u16x4, 16);
154 vcvt_n_f16_u16(arg_u16x4, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
155 vcvt_n_f16_u16(arg_u16x4, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
159 void test_conversions_f16(float16x8_t arg_f16x8, float16x4_t arg_f16x4) {
160 vcvt_n_s16_f16(arg_f16x4, 1);
161 vcvt_n_s16_f16(arg_f16x4, 16);
162 vcvt_n_s16_f16(arg_f16x4, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
163 vcvt_n_s16_f16(arg_f16x4, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
165 vcvtq_n_s16_f16(arg_f16x8, 1);
166 vcvtq_n_s16_f16(arg_f16x8, 16);
167 vcvtq_n_s16_f16(arg_f16x8, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
168 vcvtq_n_s16_f16(arg_f16x8, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
170 vcvt_n_u16_f16(arg_f16x4, 1);
171 vcvt_n_u16_f16(arg_f16x4, 16);
172 vcvt_n_u16_f16(arg_f16x4, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
173 vcvt_n_u16_f16(arg_f16x4, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
175 vcvtq_n_u16_f16(arg_f16x8, 1);
176 vcvtq_n_u16_f16(arg_f16x8, 16);
177 vcvtq_n_u16_f16(arg_f16x8, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
178 vcvtq_n_u16_f16(arg_f16x8, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}