1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
4 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s
5 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
7 // REQUIRES: aarch64-registered-target
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
19 // NOTE: For these tests clang converts the struct parameter into
20 // several parameters, one for each member of the original struct.
21 // CHECK-LABEL: @test_svset3_s8(
23 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 48 x i8> @llvm.vector.insert.nxv48i8.nxv16i8(<vscale x 48 x i8> [[TUPLE:%.*]], <vscale x 16 x i8> [[X:%.*]], i64 16)
24 // CHECK-NEXT: ret <vscale x 48 x i8> [[TMP0]]
26 // CPP-CHECK-LABEL: @_Z14test_svset3_s810svint8x3_tu10__SVInt8_t(
27 // CPP-CHECK-NEXT: entry:
28 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 48 x i8> @llvm.vector.insert.nxv48i8.nxv16i8(<vscale x 48 x i8> [[TUPLE:%.*]], <vscale x 16 x i8> [[X:%.*]], i64 16)
29 // CPP-CHECK-NEXT: ret <vscale x 48 x i8> [[TMP0]]
31 svint8x3_t
test_svset3_s8(svint8x3_t tuple
, svint8_t x
)
33 return SVE_ACLE_FUNC(svset3
,_s8
,,)(tuple
, 1, x
);
36 // CHECK-LABEL: @test_svset3_s16(
38 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x i16> @llvm.vector.insert.nxv24i16.nxv8i16(<vscale x 24 x i16> [[TUPLE:%.*]], <vscale x 8 x i16> [[X:%.*]], i64 16)
39 // CHECK-NEXT: ret <vscale x 24 x i16> [[TMP0]]
41 // CPP-CHECK-LABEL: @_Z15test_svset3_s1611svint16x3_tu11__SVInt16_t(
42 // CPP-CHECK-NEXT: entry:
43 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x i16> @llvm.vector.insert.nxv24i16.nxv8i16(<vscale x 24 x i16> [[TUPLE:%.*]], <vscale x 8 x i16> [[X:%.*]], i64 16)
44 // CPP-CHECK-NEXT: ret <vscale x 24 x i16> [[TMP0]]
46 svint16x3_t
test_svset3_s16(svint16x3_t tuple
, svint16_t x
)
48 return SVE_ACLE_FUNC(svset3
,_s16
,,)(tuple
, 2, x
);
51 // CHECK-LABEL: @test_svset3_s32(
53 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x i32> @llvm.vector.insert.nxv12i32.nxv4i32(<vscale x 12 x i32> [[TUPLE:%.*]], <vscale x 4 x i32> [[X:%.*]], i64 0)
54 // CHECK-NEXT: ret <vscale x 12 x i32> [[TMP0]]
56 // CPP-CHECK-LABEL: @_Z15test_svset3_s3211svint32x3_tu11__SVInt32_t(
57 // CPP-CHECK-NEXT: entry:
58 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x i32> @llvm.vector.insert.nxv12i32.nxv4i32(<vscale x 12 x i32> [[TUPLE:%.*]], <vscale x 4 x i32> [[X:%.*]], i64 0)
59 // CPP-CHECK-NEXT: ret <vscale x 12 x i32> [[TMP0]]
61 svint32x3_t
test_svset3_s32(svint32x3_t tuple
, svint32_t x
)
63 return SVE_ACLE_FUNC(svset3
,_s32
,,)(tuple
, 0, x
);
66 // CHECK-LABEL: @test_svset3_s64(
68 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x i64> @llvm.vector.insert.nxv6i64.nxv2i64(<vscale x 6 x i64> [[TUPLE:%.*]], <vscale x 2 x i64> [[X:%.*]], i64 2)
69 // CHECK-NEXT: ret <vscale x 6 x i64> [[TMP0]]
71 // CPP-CHECK-LABEL: @_Z15test_svset3_s6411svint64x3_tu11__SVInt64_t(
72 // CPP-CHECK-NEXT: entry:
73 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x i64> @llvm.vector.insert.nxv6i64.nxv2i64(<vscale x 6 x i64> [[TUPLE:%.*]], <vscale x 2 x i64> [[X:%.*]], i64 2)
74 // CPP-CHECK-NEXT: ret <vscale x 6 x i64> [[TMP0]]
76 svint64x3_t
test_svset3_s64(svint64x3_t tuple
, svint64_t x
)
78 return SVE_ACLE_FUNC(svset3
,_s64
,,)(tuple
, 1, x
);
81 // CHECK-LABEL: @test_svset3_u8(
83 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 48 x i8> @llvm.vector.insert.nxv48i8.nxv16i8(<vscale x 48 x i8> [[TUPLE:%.*]], <vscale x 16 x i8> [[X:%.*]], i64 32)
84 // CHECK-NEXT: ret <vscale x 48 x i8> [[TMP0]]
86 // CPP-CHECK-LABEL: @_Z14test_svset3_u811svuint8x3_tu11__SVUint8_t(
87 // CPP-CHECK-NEXT: entry:
88 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 48 x i8> @llvm.vector.insert.nxv48i8.nxv16i8(<vscale x 48 x i8> [[TUPLE:%.*]], <vscale x 16 x i8> [[X:%.*]], i64 32)
89 // CPP-CHECK-NEXT: ret <vscale x 48 x i8> [[TMP0]]
91 svuint8x3_t
test_svset3_u8(svuint8x3_t tuple
, svuint8_t x
)
93 return SVE_ACLE_FUNC(svset3
,_u8
,,)(tuple
, 2, x
);
96 // CHECK-LABEL: @test_svset3_u16(
98 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x i16> @llvm.vector.insert.nxv24i16.nxv8i16(<vscale x 24 x i16> [[TUPLE:%.*]], <vscale x 8 x i16> [[X:%.*]], i64 0)
99 // CHECK-NEXT: ret <vscale x 24 x i16> [[TMP0]]
101 // CPP-CHECK-LABEL: @_Z15test_svset3_u1612svuint16x3_tu12__SVUint16_t(
102 // CPP-CHECK-NEXT: entry:
103 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x i16> @llvm.vector.insert.nxv24i16.nxv8i16(<vscale x 24 x i16> [[TUPLE:%.*]], <vscale x 8 x i16> [[X:%.*]], i64 0)
104 // CPP-CHECK-NEXT: ret <vscale x 24 x i16> [[TMP0]]
106 svuint16x3_t
test_svset3_u16(svuint16x3_t tuple
, svuint16_t x
)
108 return SVE_ACLE_FUNC(svset3
,_u16
,,)(tuple
, 0, x
);
111 // CHECK-LABEL: @test_svset3_u32(
112 // CHECK-NEXT: entry:
113 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x i32> @llvm.vector.insert.nxv12i32.nxv4i32(<vscale x 12 x i32> [[TUPLE:%.*]], <vscale x 4 x i32> [[X:%.*]], i64 4)
114 // CHECK-NEXT: ret <vscale x 12 x i32> [[TMP0]]
116 // CPP-CHECK-LABEL: @_Z15test_svset3_u3212svuint32x3_tu12__SVUint32_t(
117 // CPP-CHECK-NEXT: entry:
118 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x i32> @llvm.vector.insert.nxv12i32.nxv4i32(<vscale x 12 x i32> [[TUPLE:%.*]], <vscale x 4 x i32> [[X:%.*]], i64 4)
119 // CPP-CHECK-NEXT: ret <vscale x 12 x i32> [[TMP0]]
121 svuint32x3_t
test_svset3_u32(svuint32x3_t tuple
, svuint32_t x
)
123 return SVE_ACLE_FUNC(svset3
,_u32
,,)(tuple
, 1, x
);
126 // CHECK-LABEL: @test_svset3_u64(
127 // CHECK-NEXT: entry:
128 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x i64> @llvm.vector.insert.nxv6i64.nxv2i64(<vscale x 6 x i64> [[TUPLE:%.*]], <vscale x 2 x i64> [[X:%.*]], i64 4)
129 // CHECK-NEXT: ret <vscale x 6 x i64> [[TMP0]]
131 // CPP-CHECK-LABEL: @_Z15test_svset3_u6412svuint64x3_tu12__SVUint64_t(
132 // CPP-CHECK-NEXT: entry:
133 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x i64> @llvm.vector.insert.nxv6i64.nxv2i64(<vscale x 6 x i64> [[TUPLE:%.*]], <vscale x 2 x i64> [[X:%.*]], i64 4)
134 // CPP-CHECK-NEXT: ret <vscale x 6 x i64> [[TMP0]]
136 svuint64x3_t
test_svset3_u64(svuint64x3_t tuple
, svuint64_t x
)
138 return SVE_ACLE_FUNC(svset3
,_u64
,,)(tuple
, 2, x
);
141 // CHECK-LABEL: @test_svset3_f16(
142 // CHECK-NEXT: entry:
143 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x half> @llvm.vector.insert.nxv24f16.nxv8f16(<vscale x 24 x half> [[TUPLE:%.*]], <vscale x 8 x half> [[X:%.*]], i64 0)
144 // CHECK-NEXT: ret <vscale x 24 x half> [[TMP0]]
146 // CPP-CHECK-LABEL: @_Z15test_svset3_f1613svfloat16x3_tu13__SVFloat16_t(
147 // CPP-CHECK-NEXT: entry:
148 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 24 x half> @llvm.vector.insert.nxv24f16.nxv8f16(<vscale x 24 x half> [[TUPLE:%.*]], <vscale x 8 x half> [[X:%.*]], i64 0)
149 // CPP-CHECK-NEXT: ret <vscale x 24 x half> [[TMP0]]
151 svfloat16x3_t
test_svset3_f16(svfloat16x3_t tuple
, svfloat16_t x
)
153 return SVE_ACLE_FUNC(svset3
,_f16
,,)(tuple
, 0, x
);
156 // CHECK-LABEL: @test_svset3_f32(
157 // CHECK-NEXT: entry:
158 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x float> @llvm.vector.insert.nxv12f32.nxv4f32(<vscale x 12 x float> [[TUPLE:%.*]], <vscale x 4 x float> [[X:%.*]], i64 4)
159 // CHECK-NEXT: ret <vscale x 12 x float> [[TMP0]]
161 // CPP-CHECK-LABEL: @_Z15test_svset3_f3213svfloat32x3_tu13__SVFloat32_t(
162 // CPP-CHECK-NEXT: entry:
163 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 12 x float> @llvm.vector.insert.nxv12f32.nxv4f32(<vscale x 12 x float> [[TUPLE:%.*]], <vscale x 4 x float> [[X:%.*]], i64 4)
164 // CPP-CHECK-NEXT: ret <vscale x 12 x float> [[TMP0]]
166 svfloat32x3_t
test_svset3_f32(svfloat32x3_t tuple
, svfloat32_t x
)
168 return SVE_ACLE_FUNC(svset3
,_f32
,,)(tuple
, 1, x
);
171 // CHECK-LABEL: @test_svset3_f64(
172 // CHECK-NEXT: entry:
173 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x double> @llvm.vector.insert.nxv6f64.nxv2f64(<vscale x 6 x double> [[TUPLE:%.*]], <vscale x 2 x double> [[X:%.*]], i64 4)
174 // CHECK-NEXT: ret <vscale x 6 x double> [[TMP0]]
176 // CPP-CHECK-LABEL: @_Z15test_svset3_f6413svfloat64x3_tu13__SVFloat64_t(
177 // CPP-CHECK-NEXT: entry:
178 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 6 x double> @llvm.vector.insert.nxv6f64.nxv2f64(<vscale x 6 x double> [[TUPLE:%.*]], <vscale x 2 x double> [[X:%.*]], i64 4)
179 // CPP-CHECK-NEXT: ret <vscale x 6 x double> [[TMP0]]
181 svfloat64x3_t
test_svset3_f64(svfloat64x3_t tuple
, svfloat64_t x
)
183 return SVE_ACLE_FUNC(svset3
,_f64
,,)(tuple
, 2, x
);