brintos

brintos / llvm-project-archived public Read only

0
0
Text · 14.8 KiB · 485219a Raw
238 lines · c
1// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon  -target-feature +bf16 -ffreestanding -fsyntax-only -verify %s2 3#include <arm_neon.h>4#include <arm_bf16.h>5// REQUIRES: aarch64-registered-target6 7 8void test_set_all_lanes_to_the_same_value_bf16(bfloat16x8_t arg_b16x8, bfloat16x4_t arg_b16x4) {9	vdup_lane_bf16(arg_b16x4, 0);10	vdup_lane_bf16(arg_b16x4, 3);11	vdup_lane_bf16(arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}12	vdup_lane_bf16(arg_b16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}13 14	vdupq_lane_bf16(arg_b16x4, 0);15	vdupq_lane_bf16(arg_b16x4, 3);16	vdupq_lane_bf16(arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}17	vdupq_lane_bf16(arg_b16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}18 19	vdup_laneq_bf16(arg_b16x8, 0);20	vdup_laneq_bf16(arg_b16x8, 7);21	vdup_laneq_bf16(arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}22	vdup_laneq_bf16(arg_b16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}23 24	vdupq_laneq_bf16(arg_b16x8, 0);25	vdupq_laneq_bf16(arg_b16x8, 7);26	vdupq_laneq_bf16(arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}27	vdupq_laneq_bf16(arg_b16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}28 29	vduph_lane_bf16(arg_b16x4, 0);30	vduph_lane_bf16(arg_b16x4, 3);31	vduph_lane_bf16(arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}32	vduph_lane_bf16(arg_b16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}33 34	vduph_laneq_bf16(arg_b16x8, 0);35	vduph_laneq_bf16(arg_b16x8, 7);36	vduph_laneq_bf16(arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}37	vduph_laneq_bf16(arg_b16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}38 39}40 41void test_split_vectors_bf16(bfloat16x8_t arg_b16x8, bfloat16x4_t arg_b16x4) {42	vget_lane_bf16(arg_b16x4, 0);43	vget_lane_bf16(arg_b16x4, 3);44	vget_lane_bf16(arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}45	vget_lane_bf16(arg_b16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}46 47	vgetq_lane_bf16(arg_b16x8, 0);48	vgetq_lane_bf16(arg_b16x8, 7);49	vgetq_lane_bf16(arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}50	vgetq_lane_bf16(arg_b16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}51 52}53 54void test_set_vector_lane_bf16(bfloat16x8_t arg_b16x8, bfloat16x4_t arg_b16x4, bfloat16_t arg_b16) {55	vset_lane_bf16(arg_b16, arg_b16x4, 0);56	vset_lane_bf16(arg_b16, arg_b16x4, 3);57	vset_lane_bf16(arg_b16, arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}58	vset_lane_bf16(arg_b16, arg_b16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}59 60	vsetq_lane_bf16(arg_b16, arg_b16x8, 0);61	vsetq_lane_bf16(arg_b16, arg_b16x8, 7);62	vsetq_lane_bf16(arg_b16, arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}63	vsetq_lane_bf16(arg_b16, arg_b16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}64 65}66 67void test_copy_vector_lane_bf16(bfloat16x8_t arg_b16x8, bfloat16x4_t arg_b16x4) {68	vcopy_lane_bf16(arg_b16x4, 0, arg_b16x4, 0);69	vcopy_lane_bf16(arg_b16x4, 3, arg_b16x4, 0);70	vcopy_lane_bf16(arg_b16x4, -1, arg_b16x4, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}71	vcopy_lane_bf16(arg_b16x4, 4, arg_b16x4, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}72	vcopy_lane_bf16(arg_b16x4, 0, arg_b16x4, 3);73	vcopy_lane_bf16(arg_b16x4, 0, arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}74	vcopy_lane_bf16(arg_b16x4, 0, arg_b16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}75 76	vcopyq_lane_bf16(arg_b16x8, 0, arg_b16x4, 0);77	vcopyq_lane_bf16(arg_b16x8, 7, arg_b16x4, 0);78	vcopyq_lane_bf16(arg_b16x8, -1, arg_b16x4, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}79	vcopyq_lane_bf16(arg_b16x8, 8, arg_b16x4, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}80	vcopyq_lane_bf16(arg_b16x8, 0, arg_b16x4, 3);81	vcopyq_lane_bf16(arg_b16x8, 0, arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}82	vcopyq_lane_bf16(arg_b16x8, 0, arg_b16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}83 84	vcopy_laneq_bf16(arg_b16x4, 0, arg_b16x8, 0);85	vcopy_laneq_bf16(arg_b16x4, 3, arg_b16x8, 0);86	vcopy_laneq_bf16(arg_b16x4, -1, arg_b16x8, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}87	vcopy_laneq_bf16(arg_b16x4, 4, arg_b16x8, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}88	vcopy_laneq_bf16(arg_b16x4, 0, arg_b16x8, 7);89	vcopy_laneq_bf16(arg_b16x4, 0, arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}90	vcopy_laneq_bf16(arg_b16x4, 0, arg_b16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}91 92	vcopyq_laneq_bf16(arg_b16x8, 0, arg_b16x8, 0);93	vcopyq_laneq_bf16(arg_b16x8, 7, arg_b16x8, 0);94	vcopyq_laneq_bf16(arg_b16x8, -1, arg_b16x8, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}95	vcopyq_laneq_bf16(arg_b16x8, 8, arg_b16x8, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}96	vcopyq_laneq_bf16(arg_b16x8, 0, arg_b16x8, 7);97	vcopyq_laneq_bf16(arg_b16x8, 0, arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}98	vcopyq_laneq_bf16(arg_b16x8, 0, arg_b16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}99 100}101 102void test_load_bf16(bfloat16x4_t arg_b16x4, bfloat16x4x4_t arg_b16x4x4, bfloat16x8x4_t arg_b16x8x4,103					bfloat16x4x3_t arg_b16x4x3, bfloat16x8_t arg_b16x8, bfloat16_t* arg_b16_ptr,104					bfloat16x8x3_t arg_b16x8x3, bfloat16x4x2_t arg_b16x4x2, bfloat16x8x2_t arg_b16x8x2) {105	vld1_lane_bf16(arg_b16_ptr, arg_b16x4, 0);106	vld1_lane_bf16(arg_b16_ptr, arg_b16x4, 3);107	vld1_lane_bf16(arg_b16_ptr, arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}108	vld1_lane_bf16(arg_b16_ptr, arg_b16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}109 110	vld1q_lane_bf16(arg_b16_ptr, arg_b16x8, 0);111	vld1q_lane_bf16(arg_b16_ptr, arg_b16x8, 7);112	vld1q_lane_bf16(arg_b16_ptr, arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}113	vld1q_lane_bf16(arg_b16_ptr, arg_b16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}114 115	vld2_lane_bf16(arg_b16_ptr, arg_b16x4x2, 0);116	vld2_lane_bf16(arg_b16_ptr, arg_b16x4x2, 3);117	vld2_lane_bf16(arg_b16_ptr, arg_b16x4x2, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}118	vld2_lane_bf16(arg_b16_ptr, arg_b16x4x2, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}119 120	vld2q_lane_bf16(arg_b16_ptr, arg_b16x8x2, 0);121	vld2q_lane_bf16(arg_b16_ptr, arg_b16x8x2, 7);122	vld2q_lane_bf16(arg_b16_ptr, arg_b16x8x2, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}123	vld2q_lane_bf16(arg_b16_ptr, arg_b16x8x2, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}124 125	vld3_lane_bf16(arg_b16_ptr, arg_b16x4x3, 0);126	vld3_lane_bf16(arg_b16_ptr, arg_b16x4x3, 3);127	vld3_lane_bf16(arg_b16_ptr, arg_b16x4x3, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}128	vld3_lane_bf16(arg_b16_ptr, arg_b16x4x3, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}129 130	vld3q_lane_bf16(arg_b16_ptr, arg_b16x8x3, 0);131	vld3q_lane_bf16(arg_b16_ptr, arg_b16x8x3, 7);132	vld3q_lane_bf16(arg_b16_ptr, arg_b16x8x3, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}133	vld3q_lane_bf16(arg_b16_ptr, arg_b16x8x3, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}134 135	vld4_lane_bf16(arg_b16_ptr, arg_b16x4x4, 0);136	vld4_lane_bf16(arg_b16_ptr, arg_b16x4x4, 3);137	vld4_lane_bf16(arg_b16_ptr, arg_b16x4x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}138	vld4_lane_bf16(arg_b16_ptr, arg_b16x4x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}139 140	vld4q_lane_bf16(arg_b16_ptr, arg_b16x8x4, 0);141	vld4q_lane_bf16(arg_b16_ptr, arg_b16x8x4, 7);142	vld4q_lane_bf16(arg_b16_ptr, arg_b16x8x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}143	vld4q_lane_bf16(arg_b16_ptr, arg_b16x8x4, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}144 145}146 147void test_store_bf16(bfloat16x4_t arg_b16x4, bfloat16x4x4_t arg_b16x4x4, bfloat16x8x4_t arg_b16x8x4,148					 bfloat16x4x3_t arg_b16x4x3, bfloat16x8_t arg_b16x8, bfloat16_t* arg_b16_ptr,149					 bfloat16x8x3_t arg_b16x8x3, bfloat16x4x2_t arg_b16x4x2, bfloat16x8x2_t arg_b16x8x2) {150	vst1_lane_bf16(arg_b16_ptr, arg_b16x4, 0);151	vst1_lane_bf16(arg_b16_ptr, arg_b16x4, 3);152	vst1_lane_bf16(arg_b16_ptr, arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}153	vst1_lane_bf16(arg_b16_ptr, arg_b16x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}154 155	vst1q_lane_bf16(arg_b16_ptr, arg_b16x8, 0);156	vst1q_lane_bf16(arg_b16_ptr, arg_b16x8, 7);157	vst1q_lane_bf16(arg_b16_ptr, arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}158	vst1q_lane_bf16(arg_b16_ptr, arg_b16x8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}159 160	vst2_lane_bf16(arg_b16_ptr, arg_b16x4x2, 0);161	vst2_lane_bf16(arg_b16_ptr, arg_b16x4x2, 3);162	vst2_lane_bf16(arg_b16_ptr, arg_b16x4x2, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}163	vst2_lane_bf16(arg_b16_ptr, arg_b16x4x2, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}164 165	vst2q_lane_bf16(arg_b16_ptr, arg_b16x8x2, 0);166	vst2q_lane_bf16(arg_b16_ptr, arg_b16x8x2, 7);167	vst2q_lane_bf16(arg_b16_ptr, arg_b16x8x2, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}168	vst2q_lane_bf16(arg_b16_ptr, arg_b16x8x2, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}169 170	vst3_lane_bf16(arg_b16_ptr, arg_b16x4x3, 0);171	vst3_lane_bf16(arg_b16_ptr, arg_b16x4x3, 3);172	vst3_lane_bf16(arg_b16_ptr, arg_b16x4x3, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}173	vst3_lane_bf16(arg_b16_ptr, arg_b16x4x3, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}174 175	vst3q_lane_bf16(arg_b16_ptr, arg_b16x8x3, 0);176	vst3q_lane_bf16(arg_b16_ptr, arg_b16x8x3, 7);177	vst3q_lane_bf16(arg_b16_ptr, arg_b16x8x3, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}178	vst3q_lane_bf16(arg_b16_ptr, arg_b16x8x3, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}179 180	vst4_lane_bf16(arg_b16_ptr, arg_b16x4x4, 0);181	vst4_lane_bf16(arg_b16_ptr, arg_b16x4x4, 3);182	vst4_lane_bf16(arg_b16_ptr, arg_b16x4x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}183	vst4_lane_bf16(arg_b16_ptr, arg_b16x4x4, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}184 185	vst4q_lane_bf16(arg_b16_ptr, arg_b16x8x4, 0);186	vst4q_lane_bf16(arg_b16_ptr, arg_b16x8x4, 7);187	vst4q_lane_bf16(arg_b16_ptr, arg_b16x8x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}188	vst4q_lane_bf16(arg_b16_ptr, arg_b16x8x4, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}189 190}191 192void test_dot_product_f32(bfloat16x8_t arg_b16x8, bfloat16x4_t arg_b16x4, float32x2_t arg_f32x2, float32x4_t arg_f32x4) {193	vbfdot_lane_f32(arg_f32x2, arg_b16x4, arg_b16x4, 0);194	vbfdot_lane_f32(arg_f32x2, arg_b16x4, arg_b16x4, 1);195	vbfdot_lane_f32(arg_f32x2, arg_b16x4, arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}196	vbfdot_lane_f32(arg_f32x2, arg_b16x4, arg_b16x4, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}197 198	vbfdotq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, 0);199	vbfdotq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, 3);200	vbfdotq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}201	vbfdotq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}202 203	vbfdot_laneq_f32(arg_f32x2, arg_b16x4, arg_b16x8, 0);204	vbfdot_laneq_f32(arg_f32x2, arg_b16x4, arg_b16x8, 3);205	vbfdot_laneq_f32(arg_f32x2, arg_b16x4, arg_b16x8, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}206	vbfdot_laneq_f32(arg_f32x2, arg_b16x4, arg_b16x8, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}207 208	vbfdotq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, 0);209	vbfdotq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, 1);210	vbfdotq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}211	vbfdotq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}212 213}214 215void test_vector_multiply_accumulate_by_scalar_f32(bfloat16x8_t arg_b16x8, bfloat16x4_t arg_b16x4, float32x4_t arg_f32x4) {216	vbfmlalbq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, 0);217	vbfmlalbq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, 3);218	vbfmlalbq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, -1); // expected-error-re +{{argument value {{.*}} is outside the valid range}}219	vbfmlalbq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, 4); // expected-error-re +{{argument value {{.*}} is outside the valid range}}220 221	vbfmlalbq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, 0);222	vbfmlalbq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, 7);223	vbfmlalbq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, -1); // expected-error-re +{{argument value {{.*}} is outside the valid range}}224	vbfmlalbq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, 8); // expected-error-re +{{argument value {{.*}} is outside the valid range}}225 226	vbfmlaltq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, 0);227	vbfmlaltq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, 3);228	vbfmlaltq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, -1); // expected-error-re +{{argument value {{.*}} is outside the valid range}}229	vbfmlaltq_lane_f32(arg_f32x4, arg_b16x8, arg_b16x4, 4); // expected-error-re +{{argument value {{.*}} is outside the valid range}}230 231	vbfmlaltq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, 0);232	vbfmlaltq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, 7);233	vbfmlaltq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, -1); // expected-error-re +{{argument value {{.*}} is outside the valid range}}234	vbfmlaltq_laneq_f32(arg_f32x4, arg_b16x8, arg_b16x8, 8); // expected-error-re +{{argument value {{.*}} is outside the valid range}}235 236}237 238