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_svwhilege_b8_s32(int32_t op1,int32_t op2)15 svbool_t test_svwhilege_b8_s32(int32_t op1, int32_t op2)
16 {
17 // CHECK-LABEL: test_svwhilege_b8_s32
18 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.whilege.nxv16i1.i32(i32 %op1, i32 %op2)
19 // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
20 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b8'}}
21 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b8_s32'}}
22 return SVE_ACLE_FUNC(svwhilege_b8,_s32,,)(op1, op2);
23 }
24
test_svwhilege_b16_s32(int32_t op1,int32_t op2)25 svbool_t test_svwhilege_b16_s32(int32_t op1, int32_t op2)
26 {
27 // CHECK-LABEL: test_svwhilege_b16_s32
28 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.whilege.nxv8i1.i32(i32 %op1, i32 %op2)
29 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
30 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
31 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b16'}}
32 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b16_s32'}}
33 return SVE_ACLE_FUNC(svwhilege_b16,_s32,,)(op1, op2);
34 }
35
test_svwhilege_b32_s32(int32_t op1,int32_t op2)36 svbool_t test_svwhilege_b32_s32(int32_t op1, int32_t op2)
37 {
38 // CHECK-LABEL: test_svwhilege_b32_s32
39 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.whilege.nxv4i1.i32(i32 %op1, i32 %op2)
40 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %[[INTRINSIC]])
41 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
42 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b32'}}
43 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b32_s32'}}
44 return SVE_ACLE_FUNC(svwhilege_b32,_s32,,)(op1, op2);
45 }
46
test_svwhilege_b64_s32(int32_t op1,int32_t op2)47 svbool_t test_svwhilege_b64_s32(int32_t op1, int32_t op2)
48 {
49 // CHECK-LABEL: test_svwhilege_b64_s32
50 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.whilege.nxv2i1.i32(i32 %op1, i32 %op2)
51 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %[[INTRINSIC]])
52 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
53 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b64'}}
54 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b64_s32'}}
55 return SVE_ACLE_FUNC(svwhilege_b64,_s32,,)(op1, op2);
56 }
57
test_svwhilege_b8_u32(uint32_t op1,uint32_t op2)58 svbool_t test_svwhilege_b8_u32(uint32_t op1, uint32_t op2)
59 {
60 // CHECK-LABEL: test_svwhilege_b8_u32
61 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.whilehs.nxv16i1.i32(i32 %op1, i32 %op2)
62 // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
63 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b8'}}
64 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b8_u32'}}
65 return SVE_ACLE_FUNC(svwhilege_b8,_u32,,)(op1, op2);
66 }
67
test_svwhilege_b16_u32(uint32_t op1,uint32_t op2)68 svbool_t test_svwhilege_b16_u32(uint32_t op1, uint32_t op2)
69 {
70 // CHECK-LABEL: test_svwhilege_b16_u32
71 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.whilehs.nxv8i1.i32(i32 %op1, i32 %op2)
72 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
73 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
74 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b16'}}
75 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b16_u32'}}
76 return SVE_ACLE_FUNC(svwhilege_b16,_u32,,)(op1, op2);
77 }
78
test_svwhilege_b32_u32(uint32_t op1,uint32_t op2)79 svbool_t test_svwhilege_b32_u32(uint32_t op1, uint32_t op2)
80 {
81 // CHECK-LABEL: test_svwhilege_b32_u32
82 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.whilehs.nxv4i1.i32(i32 %op1, i32 %op2)
83 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %[[INTRINSIC]])
84 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
85 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b32'}}
86 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b32_u32'}}
87 return SVE_ACLE_FUNC(svwhilege_b32,_u32,,)(op1, op2);
88 }
89
test_svwhilege_b64_u32(uint32_t op1,uint32_t op2)90 svbool_t test_svwhilege_b64_u32(uint32_t op1, uint32_t op2)
91 {
92 // CHECK-LABEL: test_svwhilege_b64_u32
93 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.whilehs.nxv2i1.i32(i32 %op1, i32 %op2)
94 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %[[INTRINSIC]])
95 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
96 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b64'}}
97 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b64_u32'}}
98 return SVE_ACLE_FUNC(svwhilege_b64,_u32,,)(op1, op2);
99 }
100
test_svwhilege_b8_s64(int64_t op1,int64_t op2)101 svbool_t test_svwhilege_b8_s64(int64_t op1, int64_t op2)
102 {
103 // CHECK-LABEL: test_svwhilege_b8_s64
104 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.whilege.nxv16i1.i64(i64 %op1, i64 %op2)
105 // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
106 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b8'}}
107 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b8_s64'}}
108 return SVE_ACLE_FUNC(svwhilege_b8,_s64,,)(op1, op2);
109 }
110
test_svwhilege_b16_s64(int64_t op1,int64_t op2)111 svbool_t test_svwhilege_b16_s64(int64_t op1, int64_t op2)
112 {
113 // CHECK-LABEL: test_svwhilege_b16_s64
114 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.whilege.nxv8i1.i64(i64 %op1, i64 %op2)
115 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
116 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
117 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b16'}}
118 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b16_s64'}}
119 return SVE_ACLE_FUNC(svwhilege_b16,_s64,,)(op1, op2);
120 }
121
test_svwhilege_b32_s64(int64_t op1,int64_t op2)122 svbool_t test_svwhilege_b32_s64(int64_t op1, int64_t op2)
123 {
124 // CHECK-LABEL: test_svwhilege_b32_s64
125 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.whilege.nxv4i1.i64(i64 %op1, i64 %op2)
126 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %[[INTRINSIC]])
127 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
128 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b32'}}
129 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b32_s64'}}
130 return SVE_ACLE_FUNC(svwhilege_b32,_s64,,)(op1, op2);
131 }
132
test_svwhilege_b64_s64(int64_t op1,int64_t op2)133 svbool_t test_svwhilege_b64_s64(int64_t op1, int64_t op2)
134 {
135 // CHECK-LABEL: test_svwhilege_b64_s64
136 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.whilege.nxv2i1.i64(i64 %op1, i64 %op2)
137 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %[[INTRINSIC]])
138 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
139 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b64'}}
140 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b64_s64'}}
141 return SVE_ACLE_FUNC(svwhilege_b64,_s64,,)(op1, op2);
142 }
143
test_svwhilege_b8_u64(uint64_t op1,uint64_t op2)144 svbool_t test_svwhilege_b8_u64(uint64_t op1, uint64_t op2)
145 {
146 // CHECK-LABEL: test_svwhilege_b8_u64
147 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.whilehs.nxv16i1.i64(i64 %op1, i64 %op2)
148 // CHECK: ret <vscale x 16 x i1> %[[INTRINSIC]]
149 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b8'}}
150 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b8_u64'}}
151 return SVE_ACLE_FUNC(svwhilege_b8,_u64,,)(op1, op2);
152 }
153
test_svwhilege_b16_u64(uint64_t op1,uint64_t op2)154 svbool_t test_svwhilege_b16_u64(uint64_t op1, uint64_t op2)
155 {
156 // CHECK-LABEL: test_svwhilege_b16_u64
157 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.whilehs.nxv8i1.i64(i64 %op1, i64 %op2)
158 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> %[[INTRINSIC]])
159 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
160 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b16'}}
161 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b16_u64'}}
162 return SVE_ACLE_FUNC(svwhilege_b16,_u64,,)(op1, op2);
163 }
164
test_svwhilege_b32_u64(uint64_t op1,uint64_t op2)165 svbool_t test_svwhilege_b32_u64(uint64_t op1, uint64_t op2)
166 {
167 // CHECK-LABEL: test_svwhilege_b32_u64
168 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.whilehs.nxv4i1.i64(i64 %op1, i64 %op2)
169 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %[[INTRINSIC]])
170 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
171 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b32'}}
172 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b32_u64'}}
173 return SVE_ACLE_FUNC(svwhilege_b32,_u64,,)(op1, op2);
174 }
175
test_svwhilege_b64_u64(uint64_t op1,uint64_t op2)176 svbool_t test_svwhilege_b64_u64(uint64_t op1, uint64_t op2)
177 {
178 // CHECK-LABEL: test_svwhilege_b64_u64
179 // CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.whilehs.nxv2i1.i64(i64 %op1, i64 %op2)
180 // CHECK: %[[CAST:.*]] = call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> %[[INTRINSIC]])
181 // CHECK: ret <vscale x 16 x i1> %[[CAST]]
182 // overload-warning@+2 {{implicit declaration of function 'svwhilege_b64'}}
183 // expected-warning@+1 {{implicit declaration of function 'svwhilege_b64_u64'}}
184 return SVE_ACLE_FUNC(svwhilege_b64,_u64,,)(op1, op2);
185 }
186