1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -o - %s >/dev/null 2>%t
5 // RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t
6 
7 // If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
8 // ASM-NOT: warning
9 
10 #include <arm_sve.h>
11 
12 #ifdef SVE_OVERLOADED_FORMS
13 // A simple used,unused... macro, long enough to represent any SVE builtin.
14 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
15 #else
16 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
17 #endif
18 
test_svminnmv_f16(svbool_t pg,svfloat16_t op)19 float16_t test_svminnmv_f16(svbool_t pg, svfloat16_t op)
20 {
21   // CHECK-LABEL: test_svminnmv_f16
22   // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
23   // CHECK: %[[INTRINSIC:.*]] = call half @llvm.aarch64.sve.fminnmv.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op)
24   // CHECK: ret half %[[INTRINSIC]]
25   return SVE_ACLE_FUNC(svminnmv,_f16,,)(pg, op);
26 }
27 
test_svminnmv_f32(svbool_t pg,svfloat32_t op)28 float32_t test_svminnmv_f32(svbool_t pg, svfloat32_t op)
29 {
30   // CHECK-LABEL: test_svminnmv_f32
31   // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
32   // CHECK: %[[INTRINSIC:.*]] = call float @llvm.aarch64.sve.fminnmv.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op)
33   // CHECK: ret float %[[INTRINSIC]]
34   return SVE_ACLE_FUNC(svminnmv,_f32,,)(pg, op);
35 }
36 
test_svminnmv_f64(svbool_t pg,svfloat64_t op)37 float64_t test_svminnmv_f64(svbool_t pg, svfloat64_t op)
38 {
39   // CHECK-LABEL: test_svminnmv_f64
40   // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
41   // CHECK: %[[INTRINSIC:.*]] = call double @llvm.aarch64.sve.fminnmv.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op)
42   // CHECK: ret double %[[INTRINSIC]]
43   return SVE_ACLE_FUNC(svminnmv,_f64,,)(pg, op);
44 }
45