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_svminv_s8(svbool_t pg,svint8_t op)19 int8_t test_svminv_s8(svbool_t pg, svint8_t op)
20 {
21 // CHECK-LABEL: test_svminv_s8
22 // CHECK: %[[INTRINSIC:.*]] = call i8 @llvm.aarch64.sve.sminv.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
23 // CHECK: ret i8 %[[INTRINSIC]]
24 return SVE_ACLE_FUNC(svminv,_s8,,)(pg, op);
25 }
26
test_svminv_s16(svbool_t pg,svint16_t op)27 int16_t test_svminv_s16(svbool_t pg, svint16_t op)
28 {
29 // CHECK-LABEL: test_svminv_s16
30 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
31 // CHECK: %[[INTRINSIC:.*]] = call i16 @llvm.aarch64.sve.sminv.nxv8i16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
32 // CHECK: ret i16 %[[INTRINSIC]]
33 return SVE_ACLE_FUNC(svminv,_s16,,)(pg, op);
34 }
35
test_svminv_s32(svbool_t pg,svint32_t op)36 int32_t test_svminv_s32(svbool_t pg, svint32_t op)
37 {
38 // CHECK-LABEL: test_svminv_s32
39 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
40 // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.sminv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
41 // CHECK: ret i32 %[[INTRINSIC]]
42 return SVE_ACLE_FUNC(svminv,_s32,,)(pg, op);
43 }
44
test_svminv_s64(svbool_t pg,svint64_t op)45 int64_t test_svminv_s64(svbool_t pg, svint64_t op)
46 {
47 // CHECK-LABEL: test_svminv_s64
48 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
49 // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.sminv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
50 // CHECK: ret i64 %[[INTRINSIC]]
51 return SVE_ACLE_FUNC(svminv,_s64,,)(pg, op);
52 }
53
test_svminv_u8(svbool_t pg,svuint8_t op)54 uint8_t test_svminv_u8(svbool_t pg, svuint8_t op)
55 {
56 // CHECK-LABEL: test_svminv_u8
57 // CHECK: %[[INTRINSIC:.*]] = call i8 @llvm.aarch64.sve.uminv.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %op)
58 // CHECK: ret i8 %[[INTRINSIC]]
59 return SVE_ACLE_FUNC(svminv,_u8,,)(pg, op);
60 }
61
test_svminv_u16(svbool_t pg,svuint16_t op)62 uint16_t test_svminv_u16(svbool_t pg, svuint16_t op)
63 {
64 // CHECK-LABEL: test_svminv_u16
65 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
66 // CHECK: %[[INTRINSIC:.*]] = call i16 @llvm.aarch64.sve.uminv.nxv8i16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x i16> %op)
67 // CHECK: ret i16 %[[INTRINSIC]]
68 return SVE_ACLE_FUNC(svminv,_u16,,)(pg, op);
69 }
70
test_svminv_u32(svbool_t pg,svuint32_t op)71 uint32_t test_svminv_u32(svbool_t pg, svuint32_t op)
72 {
73 // CHECK-LABEL: test_svminv_u32
74 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
75 // CHECK: %[[INTRINSIC:.*]] = call i32 @llvm.aarch64.sve.uminv.nxv4i32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x i32> %op)
76 // CHECK: ret i32 %[[INTRINSIC]]
77 return SVE_ACLE_FUNC(svminv,_u32,,)(pg, op);
78 }
79
test_svminv_u64(svbool_t pg,svuint64_t op)80 uint64_t test_svminv_u64(svbool_t pg, svuint64_t op)
81 {
82 // CHECK-LABEL: test_svminv_u64
83 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
84 // CHECK: %[[INTRINSIC:.*]] = call i64 @llvm.aarch64.sve.uminv.nxv2i64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x i64> %op)
85 // CHECK: ret i64 %[[INTRINSIC]]
86 return SVE_ACLE_FUNC(svminv,_u64,,)(pg, op);
87 }
88
test_svminv_f16(svbool_t pg,svfloat16_t op)89 float16_t test_svminv_f16(svbool_t pg, svfloat16_t op)
90 {
91 // CHECK-LABEL: test_svminv_f16
92 // CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg)
93 // CHECK: %[[INTRINSIC:.*]] = call half @llvm.aarch64.sve.fminv.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op)
94 // CHECK: ret half %[[INTRINSIC]]
95 return SVE_ACLE_FUNC(svminv,_f16,,)(pg, op);
96 }
97
test_svminv_f32(svbool_t pg,svfloat32_t op)98 float32_t test_svminv_f32(svbool_t pg, svfloat32_t op)
99 {
100 // CHECK-LABEL: test_svminv_f32
101 // CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg)
102 // CHECK: %[[INTRINSIC:.*]] = call float @llvm.aarch64.sve.fminv.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op)
103 // CHECK: ret float %[[INTRINSIC]]
104 return SVE_ACLE_FUNC(svminv,_f32,,)(pg, op);
105 }
106
test_svminv_f64(svbool_t pg,svfloat64_t op)107 float64_t test_svminv_f64(svbool_t pg, svfloat64_t op)
108 {
109 // CHECK-LABEL: test_svminv_f64
110 // CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg)
111 // CHECK: %[[INTRINSIC:.*]] = call double @llvm.aarch64.sve.fminv.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op)
112 // CHECK: ret double %[[INTRINSIC]]
113 return SVE_ACLE_FUNC(svminv,_f64,,)(pg, op);
114 }
115