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 -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
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s
4 // 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
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_svcadd_s8(svint8_t op1,svint8_t op2)15 svint8_t test_svcadd_s8(svint8_t op1, svint8_t op2)
16 {
17 // CHECK-LABEL: test_svcadd_s8
18 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cadd.x.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2, i32 90)
19 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
20 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
21 // expected-warning@+1 {{implicit declaration of function 'svcadd_s8'}}
22 return SVE_ACLE_FUNC(svcadd,_s8,,)(op1, op2, 90);
23 }
24
test_svcadd_s8_1(svint8_t op1,svint8_t op2)25 svint8_t test_svcadd_s8_1(svint8_t op1, svint8_t op2)
26 {
27 // CHECK-LABEL: test_svcadd_s8_1
28 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cadd.x.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2, i32 270)
29 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
30 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
31 // expected-warning@+1 {{implicit declaration of function 'svcadd_s8'}}
32 return SVE_ACLE_FUNC(svcadd,_s8,,)(op1, op2, 270);
33 }
34
test_svcadd_s16(svint16_t op1,svint16_t op2)35 svint16_t test_svcadd_s16(svint16_t op1, svint16_t op2)
36 {
37 // CHECK-LABEL: test_svcadd_s16
38 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.cadd.x.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, i32 90)
39 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
40 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
41 // expected-warning@+1 {{implicit declaration of function 'svcadd_s16'}}
42 return SVE_ACLE_FUNC(svcadd,_s16,,)(op1, op2, 90);
43 }
44
test_svcadd_s16_1(svint16_t op1,svint16_t op2)45 svint16_t test_svcadd_s16_1(svint16_t op1, svint16_t op2)
46 {
47 // CHECK-LABEL: test_svcadd_s16_1
48 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.cadd.x.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, i32 270)
49 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
50 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
51 // expected-warning@+1 {{implicit declaration of function 'svcadd_s16'}}
52 return SVE_ACLE_FUNC(svcadd,_s16,,)(op1, op2, 270);
53 }
54
test_svcadd_s32(svint32_t op1,svint32_t op2)55 svint32_t test_svcadd_s32(svint32_t op1, svint32_t op2)
56 {
57 // CHECK-LABEL: test_svcadd_s32
58 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cadd.x.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, i32 90)
59 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
60 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
61 // expected-warning@+1 {{implicit declaration of function 'svcadd_s32'}}
62 return SVE_ACLE_FUNC(svcadd,_s32,,)(op1, op2, 90);
63 }
64
test_svcadd_s32_1(svint32_t op1,svint32_t op2)65 svint32_t test_svcadd_s32_1(svint32_t op1, svint32_t op2)
66 {
67 // CHECK-LABEL: test_svcadd_s32_1
68 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cadd.x.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, i32 270)
69 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
70 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
71 // expected-warning@+1 {{implicit declaration of function 'svcadd_s32'}}
72 return SVE_ACLE_FUNC(svcadd,_s32,,)(op1, op2, 270);
73 }
74
test_svcadd_s64(svint64_t op1,svint64_t op2)75 svint64_t test_svcadd_s64(svint64_t op1, svint64_t op2)
76 {
77 // CHECK-LABEL: test_svcadd_s64
78 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cadd.x.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, i32 90)
79 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
80 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
81 // expected-warning@+1 {{implicit declaration of function 'svcadd_s64'}}
82 return SVE_ACLE_FUNC(svcadd,_s64,,)(op1, op2, 90);
83 }
84
test_svcadd_s64_1(svint64_t op1,svint64_t op2)85 svint64_t test_svcadd_s64_1(svint64_t op1, svint64_t op2)
86 {
87 // CHECK-LABEL: test_svcadd_s64_1
88 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cadd.x.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, i32 270)
89 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
90 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
91 // expected-warning@+1 {{implicit declaration of function 'svcadd_s64'}}
92 return SVE_ACLE_FUNC(svcadd,_s64,,)(op1, op2, 270);
93 }
94
test_svcadd_u8(svuint8_t op1,svuint8_t op2)95 svuint8_t test_svcadd_u8(svuint8_t op1, svuint8_t op2)
96 {
97 // CHECK-LABEL: test_svcadd_u8
98 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cadd.x.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2, i32 90)
99 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
100 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
101 // expected-warning@+1 {{implicit declaration of function 'svcadd_u8'}}
102 return SVE_ACLE_FUNC(svcadd,_u8,,)(op1, op2, 90);
103 }
104
test_svcadd_u8_1(svuint8_t op1,svuint8_t op2)105 svuint8_t test_svcadd_u8_1(svuint8_t op1, svuint8_t op2)
106 {
107 // CHECK-LABEL: test_svcadd_u8_1
108 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i8> @llvm.aarch64.sve.cadd.x.nxv16i8(<vscale x 16 x i8> %op1, <vscale x 16 x i8> %op2, i32 270)
109 // CHECK: ret <vscale x 16 x i8> %[[INTRINSIC]]
110 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
111 // expected-warning@+1 {{implicit declaration of function 'svcadd_u8'}}
112 return SVE_ACLE_FUNC(svcadd,_u8,,)(op1, op2, 270);
113 }
114
test_svcadd_u16(svuint16_t op1,svuint16_t op2)115 svuint16_t test_svcadd_u16(svuint16_t op1, svuint16_t op2)
116 {
117 // CHECK-LABEL: test_svcadd_u16
118 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.cadd.x.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, i32 90)
119 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
120 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
121 // expected-warning@+1 {{implicit declaration of function 'svcadd_u16'}}
122 return SVE_ACLE_FUNC(svcadd,_u16,,)(op1, op2, 90);
123 }
124
test_svcadd_u16_1(svuint16_t op1,svuint16_t op2)125 svuint16_t test_svcadd_u16_1(svuint16_t op1, svuint16_t op2)
126 {
127 // CHECK-LABEL: test_svcadd_u16_1
128 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i16> @llvm.aarch64.sve.cadd.x.nxv8i16(<vscale x 8 x i16> %op1, <vscale x 8 x i16> %op2, i32 270)
129 // CHECK: ret <vscale x 8 x i16> %[[INTRINSIC]]
130 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
131 // expected-warning@+1 {{implicit declaration of function 'svcadd_u16'}}
132 return SVE_ACLE_FUNC(svcadd,_u16,,)(op1, op2, 270);
133 }
134
test_svcadd_u32(svuint32_t op1,svuint32_t op2)135 svuint32_t test_svcadd_u32(svuint32_t op1, svuint32_t op2)
136 {
137 // CHECK-LABEL: test_svcadd_u32
138 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cadd.x.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, i32 90)
139 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
140 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
141 // expected-warning@+1 {{implicit declaration of function 'svcadd_u32'}}
142 return SVE_ACLE_FUNC(svcadd,_u32,,)(op1, op2, 90);
143 }
144
test_svcadd_u32_1(svuint32_t op1,svuint32_t op2)145 svuint32_t test_svcadd_u32_1(svuint32_t op1, svuint32_t op2)
146 {
147 // CHECK-LABEL: test_svcadd_u32_1
148 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.cadd.x.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 4 x i32> %op2, i32 270)
149 // CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]]
150 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
151 // expected-warning@+1 {{implicit declaration of function 'svcadd_u32'}}
152 return SVE_ACLE_FUNC(svcadd,_u32,,)(op1, op2, 270);
153 }
154
test_svcadd_u64(svuint64_t op1,svuint64_t op2)155 svuint64_t test_svcadd_u64(svuint64_t op1, svuint64_t op2)
156 {
157 // CHECK-LABEL: test_svcadd_u64
158 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cadd.x.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, i32 90)
159 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
160 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
161 // expected-warning@+1 {{implicit declaration of function 'svcadd_u64'}}
162 return SVE_ACLE_FUNC(svcadd,_u64,,)(op1, op2, 90);
163 }
164
test_svcadd_u64_1(svuint64_t op1,svuint64_t op2)165 svuint64_t test_svcadd_u64_1(svuint64_t op1, svuint64_t op2)
166 {
167 // CHECK-LABEL: test_svcadd_u64_1
168 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.cadd.x.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 2 x i64> %op2, i32 270)
169 // CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]]
170 // overload-warning@+2 {{implicit declaration of function 'svcadd'}}
171 // expected-warning@+1 {{implicit declaration of function 'svcadd_u64'}}
172 return SVE_ACLE_FUNC(svcadd,_u64,,)(op1, op2, 270);
173 }
174