1 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
3 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
4 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s
5 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
6 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s
7
8 #include <arm_sve.h>
9
10 #ifdef SVE_OVERLOADED_FORMS
11 // A simple used,unused... macro, long enough to represent any SVE builtin.
12 #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3
13 #else
14 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
15 #endif
16
test_svcdot_s32(svint32_t op1,svint8_t op2,svint8_t op3)17 svint32_t test_svcdot_s32(svint32_t op1, svint8_t op2, svint8_t op3)
18 {
19 // CHECK-LABEL: test_svcdot_s32
20 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cdot.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3, i32 0)
21 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
22 // overload-warning@+2 {{implicit declaration of function 'svcdot'}}
23 // expected-warning@+1 {{implicit declaration of function 'svcdot_s32'}}
24 return SVE_ACLE_FUNC(svcdot,_s32,,)(op1, op2, op3, 0);
25 }
26
test_svcdot_s32_1(svint32_t op1,svint8_t op2,svint8_t op3)27 svint32_t test_svcdot_s32_1(svint32_t op1, svint8_t op2, svint8_t op3)
28 {
29 // CHECK-LABEL: test_svcdot_s32_1
30 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cdot.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3, i32 90)
31 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
32 // overload-warning@+2 {{implicit declaration of function 'svcdot'}}
33 // expected-warning@+1 {{implicit declaration of function 'svcdot_s32'}}
34 return SVE_ACLE_FUNC(svcdot,_s32,,)(op1, op2, op3, 90);
35 }
36
test_svcdot_s32_2(svint32_t op1,svint8_t op2,svint8_t op3)37 svint32_t test_svcdot_s32_2(svint32_t op1, svint8_t op2, svint8_t op3)
38 {
39 // CHECK-LABEL: test_svcdot_s32_2
40 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cdot.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3, i32 180)
41 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
42 // overload-warning@+2 {{implicit declaration of function 'svcdot'}}
43 // expected-warning@+1 {{implicit declaration of function 'svcdot_s32'}}
44 return SVE_ACLE_FUNC(svcdot,_s32,,)(op1, op2, op3, 180);
45 }
46
test_svcdot_s32_3(svint32_t op1,svint8_t op2,svint8_t op3)47 svint32_t test_svcdot_s32_3(svint32_t op1, svint8_t op2, svint8_t op3)
48 {
49 // CHECK-LABEL: test_svcdot_s32_3
50 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cdot.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3, i32 270)
51 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
52 // overload-warning@+2 {{implicit declaration of function 'svcdot'}}
53 // expected-warning@+1 {{implicit declaration of function 'svcdot_s32'}}
54 return SVE_ACLE_FUNC(svcdot,_s32,,)(op1, op2, op3, 270);
55 }
56
test_svcdot_s64(svint64_t op1,svint16_t op2,svint16_t op3)57 svint64_t test_svcdot_s64(svint64_t op1, svint16_t op2, svint16_t op3)
58 {
59 // CHECK-LABEL: test_svcdot_s64
60 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cdot.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 0)
61 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
62 // overload-warning@+2 {{implicit declaration of function 'svcdot'}}
63 // expected-warning@+1 {{implicit declaration of function 'svcdot_s64'}}
64 return SVE_ACLE_FUNC(svcdot,_s64,,)(op1, op2, op3, 0);
65 }
66
test_svcdot_s64_1(svint64_t op1,svint16_t op2,svint16_t op3)67 svint64_t test_svcdot_s64_1(svint64_t op1, svint16_t op2, svint16_t op3)
68 {
69 // CHECK-LABEL: test_svcdot_s64_1
70 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cdot.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 90)
71 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
72 // overload-warning@+2 {{implicit declaration of function 'svcdot'}}
73 // expected-warning@+1 {{implicit declaration of function 'svcdot_s64'}}
74 return SVE_ACLE_FUNC(svcdot,_s64,,)(op1, op2, op3, 90);
75 }
76
test_svcdot_s64_2(svint64_t op1,svint16_t op2,svint16_t op3)77 svint64_t test_svcdot_s64_2(svint64_t op1, svint16_t op2, svint16_t op3)
78 {
79 // CHECK-LABEL: test_svcdot_s64_2
80 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cdot.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 180)
81 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
82 // overload-warning@+2 {{implicit declaration of function 'svcdot'}}
83 // expected-warning@+1 {{implicit declaration of function 'svcdot_s64'}}
84 return SVE_ACLE_FUNC(svcdot,_s64,,)(op1, op2, op3, 180);
85 }
86
test_svcdot_s64_3(svint64_t op1,svint16_t op2,svint16_t op3)87 svint64_t test_svcdot_s64_3(svint64_t op1, svint16_t op2, svint16_t op3)
88 {
89 // CHECK-LABEL: test_svcdot_s64_3
90 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cdot.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 270)
91 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
92 // overload-warning@+2 {{implicit declaration of function 'svcdot'}}
93 // expected-warning@+1 {{implicit declaration of function 'svcdot_s64'}}
94 return SVE_ACLE_FUNC(svcdot,_s64,,)(op1, op2, op3, 270);
95 }
96
test_svcdot_lane_s32(svint32_t op1,svint8_t op2,svint8_t op3)97 svint32_t test_svcdot_lane_s32(svint32_t op1, svint8_t op2, svint8_t op3)
98 {
99 // CHECK-LABEL: test_svcdot_lane_s32
100 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cdot.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3, i32 0, i32 0)
101 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
102 // overload-warning@+2 {{implicit declaration of function 'svcdot_lane'}}
103 // expected-warning@+1 {{implicit declaration of function 'svcdot_lane_s32'}}
104 return SVE_ACLE_FUNC(svcdot_lane,_s32,,)(op1, op2, op3, 0, 0);
105 }
106
test_svcdot_lane_s32_1(svint32_t op1,svint8_t op2,svint8_t op3)107 svint32_t test_svcdot_lane_s32_1(svint32_t op1, svint8_t op2, svint8_t op3)
108 {
109 // CHECK-LABEL: test_svcdot_lane_s32_1
110 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cdot.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3, i32 2, i32 90)
111 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
112 // overload-warning@+2 {{implicit declaration of function 'svcdot_lane'}}
113 // expected-warning@+1 {{implicit declaration of function 'svcdot_lane_s32'}}
114 return SVE_ACLE_FUNC(svcdot_lane,_s32,,)(op1, op2, op3, 2, 90);
115 }
116
test_svcdot_lane_s64(svint64_t op1,svint16_t op2,svint16_t op3)117 svint64_t test_svcdot_lane_s64(svint64_t op1, svint16_t op2, svint16_t op3)
118 {
119 // CHECK-LABEL: test_svcdot_lane_s64
120 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cdot.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 0, i32 180)
121 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
122 // overload-warning@+2 {{implicit declaration of function 'svcdot_lane'}}
123 // expected-warning@+1 {{implicit declaration of function 'svcdot_lane_s64'}}
124 return SVE_ACLE_FUNC(svcdot_lane,_s64,,)(op1, op2, op3, 0, 180);
125 }
126