1 // RUN: %clang_cc1 -target-feature +f64mm -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -target-feature +f64mm -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
3 // RUN: %clang_cc1 -target-feature +f64mm -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 -target-feature +f64mm -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -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_svzip1_s8(svint8_t op1,svint8_t op2)15 svint8_t test_svzip1_s8(svint8_t op1, svint8_t op2) {
16   // CHECK-LABEL: test_svzip1_s8
17   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.zip1q.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
18   // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
19   return SVE_ACLE_FUNC(svzip1q, _s8, , )(op1, op2);
20 }
21 
test_svzip1_s16(svint16_t op1,svint16_t op2)22 svint16_t test_svzip1_s16(svint16_t op1, svint16_t op2) {
23   // CHECK-LABEL: test_svzip1_s16
24   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.zip1q.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
25   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
26   return SVE_ACLE_FUNC(svzip1q, _s16, , )(op1, op2);
27 }
28 
test_svzip1_s32(svint32_t op1,svint32_t op2)29 svint32_t test_svzip1_s32(svint32_t op1, svint32_t op2) {
30   // CHECK-LABEL: test_svzip1_s32
31   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.zip1q.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
32   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
33   return SVE_ACLE_FUNC(svzip1q, _s32, , )(op1, op2);
34 }
35 
test_svzip1_s64(svint64_t op1,svint64_t op2)36 svint64_t test_svzip1_s64(svint64_t op1, svint64_t op2) {
37   // CHECK-LABEL: test_svzip1_s64
38   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.zip1q.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
39   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
40   return SVE_ACLE_FUNC(svzip1q, _s64, , )(op1, op2);
41 }
42 
test_svzip1_u8(svuint8_t op1,svuint8_t op2)43 svuint8_t test_svzip1_u8(svuint8_t op1, svuint8_t op2) {
44   // CHECK-LABEL: test_svzip1_u8
45   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.zip1q.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2)
46   // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
47   return SVE_ACLE_FUNC(svzip1q, _u8, , )(op1, op2);
48 }
49 
test_svzip1_u16(svuint16_t op1,svuint16_t op2)50 svuint16_t test_svzip1_u16(svuint16_t op1, svuint16_t op2) {
51   // CHECK-LABEL: test_svzip1_u16
52   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.zip1q.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2)
53   // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
54   return SVE_ACLE_FUNC(svzip1q, _u16, , )(op1, op2);
55 }
56 
test_svzip1_u32(svuint32_t op1,svuint32_t op2)57 svuint32_t test_svzip1_u32(svuint32_t op1, svuint32_t op2) {
58   // CHECK-LABEL: test_svzip1_u32
59   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.zip1q.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2)
60   // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
61   return SVE_ACLE_FUNC(svzip1q, _u32, , )(op1, op2);
62 }
63 
test_svzip1_u64(svuint64_t op1,svuint64_t op2)64 svuint64_t test_svzip1_u64(svuint64_t op1, svuint64_t op2) {
65   // CHECK-LABEL: test_svzip1_u64
66   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.zip1q.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2)
67   // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
68   return SVE_ACLE_FUNC(svzip1q, _u64, , )(op1, op2);
69 }
70 
test_svzip1_f16(svfloat16_t op1,svfloat16_t op2)71 svfloat16_t test_svzip1_f16(svfloat16_t op1, svfloat16_t op2) {
72   // CHECK-LABEL: test_svzip1_f16
73   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.zip1q.nxv8f16(<vscale x 8 x half> %op1, <vscale x 8 x half> %op2)
74   // CHECK: ret <vscale x 8 x half> %[[INTRINSIC]]
75   return SVE_ACLE_FUNC(svzip1q, _f16, , )(op1, op2);
76 }
77 
test_svzip1_f32(svfloat32_t op1,svfloat32_t op2)78 svfloat32_t test_svzip1_f32(svfloat32_t op1, svfloat32_t op2) {
79   // CHECK-LABEL: test_svzip1_f32
80   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.zip1q.nxv4f32(<vscale x 4 x float> %op1, <vscale x 4 x float> %op2)
81   // CHECK: ret <vscale x 4 x float> %[[INTRINSIC]]
82   return SVE_ACLE_FUNC(svzip1q, _f32, , )(op1, op2);
83 }
84 
test_svzip1_f64(svfloat64_t op1,svfloat64_t op2)85 svfloat64_t test_svzip1_f64(svfloat64_t op1, svfloat64_t op2) {
86   // CHECK-LABEL: test_svzip1_f64
87   // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.zip1q.nxv2f64(<vscale x 2 x double> %op1, <vscale x 2 x double> %op2)
88   // CHECK: ret <vscale x 2 x double> %[[INTRINSIC]]
89   return SVE_ACLE_FUNC(svzip1q, _f64, , )(op1, op2);
90 }
91