1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // REQUIRES: aarch64-registered-target
4 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2 -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
5 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2 -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
6 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
7 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -S -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
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
15 #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4
18 // CHECK-LABEL: @test_svrsubhnb_s16(
20 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.rsubhnb.nxv8i16(<vscale x 8 x i16> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]])
21 // CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
23 // CPP-CHECK-LABEL: @_Z18test_svrsubhnb_s16u11__SVInt16_tS_(
24 // CPP-CHECK-NEXT: entry:
25 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.rsubhnb.nxv8i16(<vscale x 8 x i16> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]])
26 // CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
28 svint8_t
test_svrsubhnb_s16(svint16_t op1
, svint16_t op2
)
30 return SVE_ACLE_FUNC(svrsubhnb
,_s16
,,)(op1
, op2
);
33 // CHECK-LABEL: @test_svrsubhnb_s32(
35 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.rsubhnb.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 4 x i32> [[OP2:%.*]])
36 // CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
38 // CPP-CHECK-LABEL: @_Z18test_svrsubhnb_s32u11__SVInt32_tS_(
39 // CPP-CHECK-NEXT: entry:
40 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.rsubhnb.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 4 x i32> [[OP2:%.*]])
41 // CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
43 svint16_t
test_svrsubhnb_s32(svint32_t op1
, svint32_t op2
)
45 return SVE_ACLE_FUNC(svrsubhnb
,_s32
,,)(op1
, op2
);
48 // CHECK-LABEL: @test_svrsubhnb_s64(
50 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.rsubhnb.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 2 x i64> [[OP2:%.*]])
51 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
53 // CPP-CHECK-LABEL: @_Z18test_svrsubhnb_s64u11__SVInt64_tS_(
54 // CPP-CHECK-NEXT: entry:
55 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.rsubhnb.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 2 x i64> [[OP2:%.*]])
56 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
58 svint32_t
test_svrsubhnb_s64(svint64_t op1
, svint64_t op2
)
60 return SVE_ACLE_FUNC(svrsubhnb
,_s64
,,)(op1
, op2
);
63 // CHECK-LABEL: @test_svrsubhnb_u16(
65 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.rsubhnb.nxv8i16(<vscale x 8 x i16> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]])
66 // CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
68 // CPP-CHECK-LABEL: @_Z18test_svrsubhnb_u16u12__SVUint16_tS_(
69 // CPP-CHECK-NEXT: entry:
70 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.rsubhnb.nxv8i16(<vscale x 8 x i16> [[OP1:%.*]], <vscale x 8 x i16> [[OP2:%.*]])
71 // CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
73 svuint8_t
test_svrsubhnb_u16(svuint16_t op1
, svuint16_t op2
)
75 return SVE_ACLE_FUNC(svrsubhnb
,_u16
,,)(op1
, op2
);
78 // CHECK-LABEL: @test_svrsubhnb_u32(
80 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.rsubhnb.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 4 x i32> [[OP2:%.*]])
81 // CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
83 // CPP-CHECK-LABEL: @_Z18test_svrsubhnb_u32u12__SVUint32_tS_(
84 // CPP-CHECK-NEXT: entry:
85 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.rsubhnb.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 4 x i32> [[OP2:%.*]])
86 // CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
88 svuint16_t
test_svrsubhnb_u32(svuint32_t op1
, svuint32_t op2
)
90 return SVE_ACLE_FUNC(svrsubhnb
,_u32
,,)(op1
, op2
);
93 // CHECK-LABEL: @test_svrsubhnb_u64(
95 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.rsubhnb.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 2 x i64> [[OP2:%.*]])
96 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
98 // CPP-CHECK-LABEL: @_Z18test_svrsubhnb_u64u12__SVUint64_tS_(
99 // CPP-CHECK-NEXT: entry:
100 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.rsubhnb.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 2 x i64> [[OP2:%.*]])
101 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
103 svuint32_t
test_svrsubhnb_u64(svuint64_t op1
, svuint64_t op2
)
105 return SVE_ACLE_FUNC(svrsubhnb
,_u64
,,)(op1
, op2
);
108 // CHECK-LABEL: @test_svrsubhnb_n_s16(
109 // CHECK-NEXT: entry:
110 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[OP2:%.*]], i64 0
111 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
112 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.rsubhnb.nxv8i16(<vscale x 8 x i16> [[OP1:%.*]], <vscale x 8 x i16> [[DOTSPLAT]])
113 // CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
115 // CPP-CHECK-LABEL: @_Z20test_svrsubhnb_n_s16u11__SVInt16_ts(
116 // CPP-CHECK-NEXT: entry:
117 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[OP2:%.*]], i64 0
118 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
119 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.rsubhnb.nxv8i16(<vscale x 8 x i16> [[OP1:%.*]], <vscale x 8 x i16> [[DOTSPLAT]])
120 // CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
122 svint8_t
test_svrsubhnb_n_s16(svint16_t op1
, int16_t op2
)
124 return SVE_ACLE_FUNC(svrsubhnb
,_n_s16
,,)(op1
, op2
);
127 // CHECK-LABEL: @test_svrsubhnb_n_s32(
128 // CHECK-NEXT: entry:
129 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[OP2:%.*]], i64 0
130 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
131 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.rsubhnb.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 4 x i32> [[DOTSPLAT]])
132 // CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
134 // CPP-CHECK-LABEL: @_Z20test_svrsubhnb_n_s32u11__SVInt32_ti(
135 // CPP-CHECK-NEXT: entry:
136 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[OP2:%.*]], i64 0
137 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
138 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.rsubhnb.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 4 x i32> [[DOTSPLAT]])
139 // CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
141 svint16_t
test_svrsubhnb_n_s32(svint32_t op1
, int32_t op2
)
143 return SVE_ACLE_FUNC(svrsubhnb
,_n_s32
,,)(op1
, op2
);
146 // CHECK-LABEL: @test_svrsubhnb_n_s64(
147 // CHECK-NEXT: entry:
148 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[OP2:%.*]], i64 0
149 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[DOTSPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
150 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.rsubhnb.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 2 x i64> [[DOTSPLAT]])
151 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
153 // CPP-CHECK-LABEL: @_Z20test_svrsubhnb_n_s64u11__SVInt64_tl(
154 // CPP-CHECK-NEXT: entry:
155 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[OP2:%.*]], i64 0
156 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[DOTSPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
157 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.rsubhnb.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 2 x i64> [[DOTSPLAT]])
158 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
160 svint32_t
test_svrsubhnb_n_s64(svint64_t op1
, int64_t op2
)
162 return SVE_ACLE_FUNC(svrsubhnb
,_n_s64
,,)(op1
, op2
);
165 // CHECK-LABEL: @test_svrsubhnb_n_u16(
166 // CHECK-NEXT: entry:
167 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[OP2:%.*]], i64 0
168 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
169 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.rsubhnb.nxv8i16(<vscale x 8 x i16> [[OP1:%.*]], <vscale x 8 x i16> [[DOTSPLAT]])
170 // CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
172 // CPP-CHECK-LABEL: @_Z20test_svrsubhnb_n_u16u12__SVUint16_tt(
173 // CPP-CHECK-NEXT: entry:
174 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i16> poison, i16 [[OP2:%.*]], i64 0
175 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i16> [[DOTSPLATINSERT]], <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
176 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i8> @llvm.aarch64.sve.rsubhnb.nxv8i16(<vscale x 8 x i16> [[OP1:%.*]], <vscale x 8 x i16> [[DOTSPLAT]])
177 // CPP-CHECK-NEXT: ret <vscale x 16 x i8> [[TMP0]]
179 svuint8_t
test_svrsubhnb_n_u16(svuint16_t op1
, uint16_t op2
)
181 return SVE_ACLE_FUNC(svrsubhnb
,_n_u16
,,)(op1
, op2
);
184 // CHECK-LABEL: @test_svrsubhnb_n_u32(
185 // CHECK-NEXT: entry:
186 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[OP2:%.*]], i64 0
187 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
188 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.rsubhnb.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 4 x i32> [[DOTSPLAT]])
189 // CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
191 // CPP-CHECK-LABEL: @_Z20test_svrsubhnb_n_u32u12__SVUint32_tj(
192 // CPP-CHECK-NEXT: entry:
193 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[OP2:%.*]], i64 0
194 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
195 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i16> @llvm.aarch64.sve.rsubhnb.nxv4i32(<vscale x 4 x i32> [[OP1:%.*]], <vscale x 4 x i32> [[DOTSPLAT]])
196 // CPP-CHECK-NEXT: ret <vscale x 8 x i16> [[TMP0]]
198 svuint16_t
test_svrsubhnb_n_u32(svuint32_t op1
, uint32_t op2
)
200 return SVE_ACLE_FUNC(svrsubhnb
,_n_u32
,,)(op1
, op2
);
203 // CHECK-LABEL: @test_svrsubhnb_n_u64(
204 // CHECK-NEXT: entry:
205 // CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[OP2:%.*]], i64 0
206 // CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[DOTSPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
207 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.rsubhnb.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 2 x i64> [[DOTSPLAT]])
208 // CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
210 // CPP-CHECK-LABEL: @_Z20test_svrsubhnb_n_u64u12__SVUint64_tm(
211 // CPP-CHECK-NEXT: entry:
212 // CPP-CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 2 x i64> poison, i64 [[OP2:%.*]], i64 0
213 // CPP-CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 2 x i64> [[DOTSPLATINSERT]], <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
214 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i32> @llvm.aarch64.sve.rsubhnb.nxv2i64(<vscale x 2 x i64> [[OP1:%.*]], <vscale x 2 x i64> [[DOTSPLAT]])
215 // CPP-CHECK-NEXT: ret <vscale x 4 x i32> [[TMP0]]
217 svuint32_t
test_svrsubhnb_n_u64(svuint64_t op1
, uint64_t op2
)
219 return SVE_ACLE_FUNC(svrsubhnb
,_n_u64
,,)(op1
, op2
);