brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 1dc2b00 Raw
70 lines · c
1// RUN: %clang_cc1 -triple armv8a-none-linux-gnu -target-feature +neon -verify -emit-llvm -o - %s2// REQUIRES: arm-registered-target3 4// Test that functions with the correct target attributes can use the correct NEON intrinsics.5 6#include <arm_neon.h>7 8__attribute__((target("dotprod")))9void dotprod(uint32x2_t v2i32, uint8x16_t v16i8, uint8x8_t v8i8) {10  vdot_u32(v2i32, v8i8, v8i8);11}12 13__attribute__((target("fullfp16")))14void fp16(uint32x2_t v2i32, uint32x4_t v4i32, uint16x8_t v8i16, uint8x16_t v16i8, uint8x8_t v8i8, float32x2_t v2f32, float32x4_t v4f32, float16x4_t v4f16, bfloat16x4_t v4bf16) {15  vceqz_f16(v4f16);16  vrnd_f16(v4f16);17  vmaxnm_f16(v4f16, v4f16);18}19 20__attribute__((target("i8mm")))21void i8mm(uint32x2_t v2i32, uint32x4_t v4i32, uint16x8_t v8i16, uint8x16_t v16i8, uint8x8_t v8i8, float32x2_t v2f32, float32x4_t v4f32, float16x4_t v4f16, bfloat16x4_t v4bf16) {22  vmmlaq_s32(v4i32, v8i16, v8i16);23}24 25__attribute__((target("bf16")))26void bf16(uint32x2_t v2i32, uint32x4_t v4i32, uint16x8_t v8i16, uint8x16_t v16i8, uint8x8_t v8i8, float32x2_t v2f32, float32x4_t v4f32, float16x4_t v4f16, bfloat16x4_t v4bf16, __bf16 bf16) {27  vbfdot_f32(v2f32, v4bf16, v4bf16);28  vcreate_bf16(10);29  vdup_lane_bf16(v4bf16, 2);30  vdup_n_bf16(bf16);31  vld1_bf16(0);32  vcvt_f32_bf16(v4bf16);33  vcvt_bf16_f32(v4f32);34}35 36__attribute__((target("v8.1a")))37void test_v81(int32x2_t d, int32x4_t v, int s) {38  vqrdmlahq_s32(v, v, v);39}40 41__attribute__((target("v8.3a,fullfp16")))42void test_v83(float32x4_t v4f32, float16x4_t v4f16) {43  vcaddq_rot90_f32(v4f32, v4f32);44  vcmla_rot90_f16(v4f16, v4f16, v4f16);45}46 47void undefined(uint32x2_t v2i32, uint32x4_t v4i32, uint16x8_t v8i16, uint8x16_t v16i8, uint8x8_t v8i8, float32x2_t v2f32, float32x4_t v4f32, float16x4_t v4f16, bfloat16x4_t v4bf16, __bf16 bf16) {48  // dotprod49  vdot_u32(v2i32, v8i8, v8i8); // expected-error {{always_inline function 'vdot_u32' requires target feature 'dotprod'}}50  // fp1651  vceqz_f16(v4f16); // expected-error {{always_inline function 'vceqz_f16' requires target feature 'fullfp16'}}52  vrnd_f16(v4f16); // expected-error {{always_inline function 'vrnd_f16' requires target feature 'fullfp16'}}53  vmaxnm_f16(v4f16, v4f16); // expected-error {{always_inline function 'vmaxnm_f16' requires target feature 'fullfp16'}}54  // i8mm55  vmmlaq_s32(v4i32, v8i16, v8i16); // expected-error {{always_inline function 'vmmlaq_s32' requires target feature 'i8mm'}}56  // bf1657  vbfdot_f32(v2f32, v4bf16, v4bf16); // expected-error {{always_inline function 'vbfdot_f32' requires target feature 'bf16'}}58  vcreate_bf16(10);59  vdup_lane_bf16(v4bf16, 2); // expected-error {{'__builtin_neon_splat_lane_bf16' needs target feature bf16}}60  vdup_n_bf16(bf16); // expected-error {{always_inline function 'vdup_n_bf16' requires target feature 'bf16'}}61  vld1_bf16(0); // expected-error {{'__builtin_neon_vld1_bf16' needs target feature bf16}}62  vcvt_f32_bf16(v4bf16); // expected-error {{always_inline function 'vcvt_f32_bf16' requires target feature 'bf16'}}63  vcvt_bf16_f32(v4f32); // expected-error {{always_inline function 'vcvt_bf16_f32' requires target feature 'bf16'}}64  // v8.1 - qrdmla65  vqrdmlahq_s32(v4i32, v4i32, v4i32); // expected-error {{always_inline function 'vqrdmlahq_s32' requires target feature 'v8.1a'}}66  // 8.3 - complex67  vcaddq_rot90_f32(v4f32, v4f32); // expected-error {{always_inline function 'vcaddq_rot90_f32' requires target feature 'v8.3a'}}68  vcmla_rot90_f16(v4f16, v4f16, v4f16); // expected-error {{always_inline function 'vcmla_rot90_f16' requires target feature 'v8.3a'}}69}70