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 -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 #include <arm_sve.h>
10
11 #ifdef SVE_OVERLOADED_FORMS
12 // A simple used,unused... macro, long enough to represent any SVE builtin.
13 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
14 #else
15 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
16 #endif
17
test_svzip2_s8(svint8_t op1,svint8_t op2)18 svint8_t test_svzip2_s8(svint8_t op1, svint8_t op2)
19 {
20 // CHECK-LABEL: test_svzip2_s8
21 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.zip2.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
22 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
23 return SVE_ACLE_FUNC(svzip2,_s8,,)(op1, op2);
24 }
25
test_svzip2_s16(svint16_t op1,svint16_t op2)26 svint16_t test_svzip2_s16(svint16_t op1, svint16_t op2)
27 {
28 // CHECK-LABEL: test_svzip2_s16
29 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.zip2.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
30 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
31 return SVE_ACLE_FUNC(svzip2,_s16,,)(op1, op2);
32 }
33
test_svzip2_s32(svint32_t op1,svint32_t op2)34 svint32_t test_svzip2_s32(svint32_t op1, svint32_t op2)
35 {
36 // CHECK-LABEL: test_svzip2_s32
37 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.zip2.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
38 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
39 return SVE_ACLE_FUNC(svzip2,_s32,,)(op1, op2);
40 }
41
test_svzip2_s64(svint64_t op1,svint64_t op2)42 svint64_t test_svzip2_s64(svint64_t op1, svint64_t op2)
43 {
44 // CHECK-LABEL: test_svzip2_s64
45 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.zip2.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
46 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
47 return SVE_ACLE_FUNC(svzip2,_s64,,)(op1, op2);
48 }
49
test_svzip2_u8(svuint8_t op1,svuint8_t op2)50 svuint8_t test_svzip2_u8(svuint8_t op1, svuint8_t op2)
51 {
52 // CHECK-LABEL: test_svzip2_u8
53 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.zip2.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
54 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
55 return SVE_ACLE_FUNC(svzip2,_u8,,)(op1, op2);
56 }
57
test_svzip2_u16(svuint16_t op1,svuint16_t op2)58 svuint16_t test_svzip2_u16(svuint16_t op1, svuint16_t op2)
59 {
60 // CHECK-LABEL: test_svzip2_u16
61 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.zip2.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
62 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
63 return SVE_ACLE_FUNC(svzip2,_u16,,)(op1, op2);
64 }
65
test_svzip2_u32(svuint32_t op1,svuint32_t op2)66 svuint32_t test_svzip2_u32(svuint32_t op1, svuint32_t op2)
67 {
68 // CHECK-LABEL: test_svzip2_u32
69 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.zip2.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
70 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
71 return SVE_ACLE_FUNC(svzip2,_u32,,)(op1, op2);
72 }
73
test_svzip2_u64(svuint64_t op1,svuint64_t op2)74 svuint64_t test_svzip2_u64(svuint64_t op1, svuint64_t op2)
75 {
76 // CHECK-LABEL: test_svzip2_u64
77 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.zip2.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
78 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
79 return SVE_ACLE_FUNC(svzip2,_u64,,)(op1, op2);
80 }
81
test_svzip2_f16(svfloat16_t op1,svfloat16_t op2)82 svfloat16_t test_svzip2_f16(svfloat16_t op1, svfloat16_t op2)
83 {
84 // CHECK-LABEL: test_svzip2_f16
85 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.zip2.nxv8f16(<vscale x 8 x half> %op1, <vscale x 8 x half> %op2)
86 // CHECK: ret <vscale x 8 x half> %[[INTRINSIC]]
87 return SVE_ACLE_FUNC(svzip2,_f16,,)(op1, op2);
88 }
89
test_svzip2_f32(svfloat32_t op1,svfloat32_t op2)90 svfloat32_t test_svzip2_f32(svfloat32_t op1, svfloat32_t op2)
91 {
92 // CHECK-LABEL: test_svzip2_f32
93 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.zip2.nxv4f32(<vscale x 4 x float> %op1, <vscale x 4 x float> %op2)
94 // CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
95 return SVE_ACLE_FUNC(svzip2,_f32,,)(op1, op2);
96 }
97
test_svzip2_f64(svfloat64_t op1,svfloat64_t op2)98 svfloat64_t test_svzip2_f64(svfloat64_t op1, svfloat64_t op2)
99 {
100 // CHECK-LABEL: test_svzip2_f64
101 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.zip2.nxv2f64(<vscale x 2 x double> %op1, <vscale x 2 x double> %op2)
102 // CHECK: ret <vscale x 2 x double> %[[INTRINSIC]]
103 return SVE_ACLE_FUNC(svzip2,_f64,,)(op1, op2);
104 }
105
test_svzip2_b8(svbool_t op1,svbool_t op2)106 svbool_t test_svzip2_b8(svbool_t op1, svbool_t op2)
107 {
108 // CHECK-LABEL: test_svzip2_b8
109 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.zip2.nxv16i1(<vscale x 16 x i1> %op1, <vscale x 16 x i1> %op2)
110 // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
111 return svzip2_b8(op1, op2);
112 }
113
test_svzip2_b16(svbool_t op1,svbool_t op2)114 svbool_t test_svzip2_b16(svbool_t op1, svbool_t op2)
115 {
116 // CHECK-LABEL: test_svzip2_b16
117 // CHECK-DAG: %[[OP1:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %op1)
118 // CHECK-DAG: %[[OP2:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %op2)
119 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.zip2.nxv8i1(<vscale x 8 x i1> %[[OP1]], <vscale x 8 x i1> %[[OP2]])
120 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
121 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
122 return svzip2_b16(op1, op2);
123 }
124
test_svzip2_b32(svbool_t op1,svbool_t op2)125 svbool_t test_svzip2_b32(svbool_t op1, svbool_t op2)
126 {
127 // CHECK-LABEL: test_svzip2_b32
128 // CHECK-DAG: %[[OP1:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %op1)
129 // CHECK-DAG: %[[OP2:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %op2)
130 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.zip2.nxv4i1(<vscale x 4 x i1> %[[OP1]], <vscale x 4 x i1> %[[OP2]])
131 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %[[INTRINSIC]])
132 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
133 return svzip2_b32(op1, op2);
134 }
135
test_svzip2_b64(svbool_t op1,svbool_t op2)136 svbool_t test_svzip2_b64(svbool_t op1, svbool_t op2)
137 {
138 // CHECK-LABEL: test_svzip2_b64
139 // CHECK-DAG: %[[OP1:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %op1)
140 // CHECK-DAG: %[[OP2:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %op2)
141 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.zip2.nxv2i1(<vscale x 2 x i1> %[[OP1]], <vscale x 2 x i1> %[[OP2]])
142 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %[[INTRINSIC]])
143 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
144 return svzip2_b64(op1, op2);
145 }
146