1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
4 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
5 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
6 
7 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null
8 #include <arm_sve.h>
9 
10 #ifdef SVE_OVERLOADED_FORMS
11 // A simple used,unused... macro, long enough to represent any SVE builtin.
12 #define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3
13 #else
14 #define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
15 #endif
16 
test_svdupq_lane_bf16(svbfloat16_t data,uint64_t index)17 svbfloat16_t test_svdupq_lane_bf16(svbfloat16_t data, uint64_t index) {
18   // CHECK-LABEL: test_svdupq_lane_bf16
19   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x bfloat> @llvm.aarch64.sve.dupq.lane.nxv8bf16(<vscale x 8 x bfloat> %data, i64 %index)
20   // CHECK: ret <vscale x 8 x bfloat> %[[INTRINSIC]]
21   // expected-warning@+1 {{implicit declaration of function 'svdupq_lane_bf16'}}
22   return SVE_ACLE_FUNC(svdupq_lane, _bf16, , )(data, index);
23 }
test_svdupq_n_bf16(bfloat16_t x0,bfloat16_t x1,bfloat16_t x2,bfloat16_t x3,bfloat16_t x4,bfloat16_t x5,bfloat16_t x6,bfloat16_t x7)24 svbfloat16_t test_svdupq_n_bf16(bfloat16_t x0, bfloat16_t x1, bfloat16_t x2, bfloat16_t x3,
25                                 bfloat16_t x4, bfloat16_t x5, bfloat16_t x6, bfloat16_t x7) {
26   // CHECK-LABEL: test_svdupq_n_bf16
27   // CHECK: insertelement <8 x bfloat> undef, bfloat %x0, i32 0
28   // <assume other insertelement>
29   // CHECK: %[[VEC:.*]] = insertelement <8 x bfloat> %[[X:.*]], bfloat %x7, i32 7
30   // CHECK-NOT: insertelement
31   // CHECK: %[[INS:.*]] = call <vscale x 8 x bfloat> @llvm.experimental.vector.insert.nxv8bf16.v8bf16(<vscale x 8 x bfloat> undef, <8 x bfloat> %[[VEC]], i64 0)
32   // CHECK: %[[DUPQ:.*]] = call <vscale x 8 x bfloat> @llvm.aarch64.sve.dupq.lane.nxv8bf16(<vscale x 8 x bfloat> %[[INS]], i64 0)
33   // CHECK: ret <vscale x 8 x bfloat> %[[DUPQ]]
34   // expected-warning@+1 {{implicit declaration of function 'svdupq_n_bf16'}}
35   return SVE_ACLE_FUNC(svdupq, _n, _bf16, )(x0, x1, x2, x3, x4, x5, x6, x7);
36 }
37