1 // 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
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 - -x c++ %s | FileCheck %s
3 // 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
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 - -x c++ %s | FileCheck %s
5 
6 #include <arm_sve.h>
7 
8 #ifdef SVE_OVERLOADED_FORMS
9 // A simple used,unused... macro, long enough to represent any SVE builtin.
10 #define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3
11 #else
12 #define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
13 #endif
14 
test_svbfmlalt_f32(svfloat32_t x,svbfloat16_t y,svbfloat16_t z)15 svfloat32_t test_svbfmlalt_f32(svfloat32_t x, svbfloat16_t y, svbfloat16_t z) {
16   // CHECK-LABEL: test_svbfmlalt_f32
17   // CHECK: %[[RET:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.bfmlalt(<vscale x 4 x float> %x, <vscale x 8 x bfloat> %y, <vscale x 8 x bfloat> %z)
18   // CHECK: ret <vscale x 4 x float> %[[RET]]
19   return SVE_ACLE_FUNC(svbfmlalt, _f32, , )(x, y, z);
20 }
21 
test_bfmlalt_lane_0_f32(svfloat32_t x,svbfloat16_t y,svbfloat16_t z)22 svfloat32_t test_bfmlalt_lane_0_f32(svfloat32_t x, svbfloat16_t y, svbfloat16_t z) {
23   // CHECK-LABEL: test_bfmlalt_lane_0_f32
24   // CHECK: %[[RET:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.bfmlalt.lane(<vscale x 4 x float> %x, <vscale x 8 x bfloat> %y, <vscale x 8 x bfloat> %z, i64 0)
25   // CHECK: ret <vscale x 4 x float> %[[RET]]
26   return SVE_ACLE_FUNC(svbfmlalt_lane, _f32, , )(x, y, z, 0);
27 }
28 
test_bfmlalt_lane_7_f32(svfloat32_t x,svbfloat16_t y,svbfloat16_t z)29 svfloat32_t test_bfmlalt_lane_7_f32(svfloat32_t x, svbfloat16_t y, svbfloat16_t z) {
30   // CHECK-LABEL: test_bfmlalt_lane_7_f32
31   // CHECK: %[[RET:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.bfmlalt.lane(<vscale x 4 x float> %x, <vscale x 8 x bfloat> %y, <vscale x 8 x bfloat> %z, i64 7)
32   // CHECK: ret <vscale x 4 x float> %[[RET]]
33   return SVE_ACLE_FUNC(svbfmlalt_lane, _f32, , )(x, y, z, 7);
34 }
35 
test_bfmlalt_n_f32(svfloat32_t x,svbfloat16_t y,bfloat16_t z)36 svfloat32_t test_bfmlalt_n_f32(svfloat32_t x, svbfloat16_t y, bfloat16_t z) {
37   // CHECK-LABEL: test_bfmlalt_n_f32
38   // CHECK: %[[SPLAT:.*]] = call <vscale x 8 x bfloat> @llvm.aarch64.sve.dup.x.nxv8bf16(bfloat %z)
39   // CHECK: %[[RET:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.bfmlalt(<vscale x 4 x float> %x, <vscale x 8 x bfloat> %y, <vscale x 8 x bfloat> %[[SPLAT]])
40   // CHECK: ret <vscale x 4 x float> %[[RET]]
41   return SVE_ACLE_FUNC(svbfmlalt, _n_f32, , )(x, y, z);
42 }
43