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 -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
3 
4 #include <arm_sve.h>
5 
6 #ifdef SVE_OVERLOADED_FORMS
7 // A simple used,unused... macro, long enough to represent any SVE builtin.
8 #define SVE_ACLE_FUNC(A1, A2_UNUSED, A3, A4_UNUSED) A1##A3
9 #else
10 #define SVE_ACLE_FUNC(A1, A2, A3, A4) A1##A2##A3##A4
11 #endif
12 
test_svcvtnt_bf16_f32_x(svbfloat16_t even,svbool_t pg,svfloat32_t op)13 svbfloat16_t test_svcvtnt_bf16_f32_x(svbfloat16_t even, svbool_t pg, svfloat32_t op) {
14   // CHECK-LABEL: test_svcvtnt_bf16_f32_x
15   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
16   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x bfloat> @llvm.aarch64.sve.fcvtnt.bf16f32(<vscale x 8 x bfloat> %even, <vscale x 8 x i1> %[[PG]], <vscale x 4 x float> %op)
17   // CHECK: ret <vscale x 8 x bfloat> %[[INTRINSIC]]
18   return SVE_ACLE_FUNC(svcvtnt_bf16, _f32, _x, )(even, pg, op);
19 }
20 
test_svcvtnt_bf16_f32_m(svbfloat16_t even,svbool_t pg,svfloat32_t op)21 svbfloat16_t test_svcvtnt_bf16_f32_m(svbfloat16_t even, svbool_t pg, svfloat32_t op) {
22   // CHECK-LABEL: test_svcvtnt_bf16_f32_m
23   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
24   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x bfloat> @llvm.aarch64.sve.fcvtnt.bf16f32(<vscale x 8 x bfloat> %even, <vscale x 8 x i1> %[[PG]], <vscale x 4 x float> %op)
25   // CHECK: ret <vscale x 8 x bfloat> %[[INTRINSIC]]
26   return SVE_ACLE_FUNC(svcvtnt_bf16, _f32, _m, )(even, pg, op);
27 }
28