Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / aarch64-sve2p1-intrinsics / acle_sve2p1_pext.c
blobfe15d5a9db81f2f0f8956751908696e873cd9a44
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // REQUIRES: aarch64-registered-target
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s
4 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve2p1 -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
6 #include <arm_sve.h>
8 // CHECK-LABEL: @test_svpext_lane_c8_0(
9 // CHECK-NEXT: entry:
10 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.pext.nxv16i1(target("aarch64.svcount") [[C:%.*]], i32 0)
11 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]]
13 // CPP-CHECK-LABEL: @_Z21test_svpext_lane_c8_0u11__SVCount_t(
14 // CPP-CHECK-NEXT: entry:
15 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.pext.nxv16i1(target("aarch64.svcount") [[C:%.*]], i32 0)
16 // CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]]
18 svbool_t test_svpext_lane_c8_0(svcount_t c) {
19 return svpext_lane_c8(c, 0);
22 // CHECK-LABEL: @test_svpext_lane_c8_3(
23 // CHECK-NEXT: entry:
24 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.pext.nxv16i1(target("aarch64.svcount") [[C:%.*]], i32 3)
25 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]]
27 // CPP-CHECK-LABEL: @_Z21test_svpext_lane_c8_3u11__SVCount_t(
28 // CPP-CHECK-NEXT: entry:
29 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.pext.nxv16i1(target("aarch64.svcount") [[C:%.*]], i32 3)
30 // CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]]
32 svbool_t test_svpext_lane_c8_3(svcount_t c) {
33 return svpext_lane_c8(c, 3);
36 // CHECK-LABEL: @test_svpext_lane_c16_0(
37 // CHECK-NEXT: entry:
38 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.pext.nxv8i1(target("aarch64.svcount") [[C:%.*]], i32 0)
39 // CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> [[TMP0]])
40 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
42 // CPP-CHECK-LABEL: @_Z22test_svpext_lane_c16_0u11__SVCount_t(
43 // CPP-CHECK-NEXT: entry:
44 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.pext.nxv8i1(target("aarch64.svcount") [[C:%.*]], i32 0)
45 // CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> [[TMP0]])
46 // CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
48 svbool_t test_svpext_lane_c16_0(svcount_t c) {
49 return svpext_lane_c16(c, 0);
52 // CHECK-LABEL: @test_svpext_lane_c16_3(
53 // CHECK-NEXT: entry:
54 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.pext.nxv8i1(target("aarch64.svcount") [[C:%.*]], i32 3)
55 // CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> [[TMP0]])
56 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
58 // CPP-CHECK-LABEL: @_Z22test_svpext_lane_c16_3u11__SVCount_t(
59 // CPP-CHECK-NEXT: entry:
60 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 8 x i1> @llvm.aarch64.sve.pext.nxv8i1(target("aarch64.svcount") [[C:%.*]], i32 3)
61 // CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv8i1(<vscale x 8 x i1> [[TMP0]])
62 // CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
64 svbool_t test_svpext_lane_c16_3(svcount_t c) {
65 return svpext_lane_c16(c, 3);
68 // CHECK-LABEL: @test_svpext_lane_c32_0(
69 // CHECK-NEXT: entry:
70 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.pext.nxv4i1(target("aarch64.svcount") [[C:%.*]], i32 0)
71 // CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> [[TMP0]])
72 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
74 // CPP-CHECK-LABEL: @_Z22test_svpext_lane_c32_0u11__SVCount_t(
75 // CPP-CHECK-NEXT: entry:
76 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.pext.nxv4i1(target("aarch64.svcount") [[C:%.*]], i32 0)
77 // CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> [[TMP0]])
78 // CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
80 svbool_t test_svpext_lane_c32_0(svcount_t c) {
81 return svpext_lane_c32(c, 0);
84 // CHECK-LABEL: @test_svpext_lane_c32_3(
85 // CHECK-NEXT: entry:
86 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.pext.nxv4i1(target("aarch64.svcount") [[C:%.*]], i32 3)
87 // CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> [[TMP0]])
88 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
90 // CPP-CHECK-LABEL: @_Z22test_svpext_lane_c32_3u11__SVCount_t(
91 // CPP-CHECK-NEXT: entry:
92 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 4 x i1> @llvm.aarch64.sve.pext.nxv4i1(target("aarch64.svcount") [[C:%.*]], i32 3)
93 // CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> [[TMP0]])
94 // CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
96 svbool_t test_svpext_lane_c32_3(svcount_t c) {
97 return svpext_lane_c32(c, 3);
100 // CHECK-LABEL: @test_svpext_lane_c64_0(
101 // CHECK-NEXT: entry:
102 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.pext.nxv2i1(target("aarch64.svcount") [[C:%.*]], i32 0)
103 // CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> [[TMP0]])
104 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
106 // CPP-CHECK-LABEL: @_Z22test_svpext_lane_c64_0u11__SVCount_t(
107 // CPP-CHECK-NEXT: entry:
108 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.pext.nxv2i1(target("aarch64.svcount") [[C:%.*]], i32 0)
109 // CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> [[TMP0]])
110 // CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
112 svbool_t test_svpext_lane_c64_0(svcount_t c) {
113 return svpext_lane_c64(c, 0);
116 // CHECK-LABEL: @test_svpext_lane_c64_3(
117 // CHECK-NEXT: entry:
118 // CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.pext.nxv2i1(target("aarch64.svcount") [[C:%.*]], i32 3)
119 // CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> [[TMP0]])
120 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
122 // CPP-CHECK-LABEL: @_Z22test_svpext_lane_c64_3u11__SVCount_t(
123 // CPP-CHECK-NEXT: entry:
124 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call <vscale x 2 x i1> @llvm.aarch64.sve.pext.nxv2i1(target("aarch64.svcount") [[C:%.*]], i32 3)
125 // CPP-CHECK-NEXT: [[TMP1:%.*]] = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv2i1(<vscale x 2 x i1> [[TMP0]])
126 // CPP-CHECK-NEXT: ret <vscale x 16 x i1> [[TMP1]]
128 svbool_t test_svpext_lane_c64_3(svcount_t c) {
129 return svpext_lane_c64(c, 3);
132 // CHECK-LABEL: @test_svpext_lane_c8_x2_0(
133 // CHECK-NEXT: entry:
134 // CHECK-NEXT: [[TMP0:%.*]] = tail call { <vscale x 16 x i1>, <vscale x 16 x i1> } @llvm.aarch64.sve.pext.x2.nxv16i1(target("aarch64.svcount") [[C:%.*]], i32 0)
135 // CHECK-NEXT: [[TMP1:%.*]] = extractvalue { <vscale x 16 x i1>, <vscale x 16 x i1> } [[TMP0]], 0
136 // CHECK-NEXT: [[TMP2:%.*]] = tail call <vscale x 32 x i1> @llvm.vector.insert.nxv32i1.nxv16i1(<vscale x 32 x i1> poison, <vscale x 16 x i1> [[TMP1]], i64 0)
137 // CHECK-NEXT: [[TMP3:%.*]] = extractvalue { <vscale x 16 x i1>, <vscale x 16 x i1> } [[TMP0]], 1
138 // CHECK-NEXT: [[TMP4:%.*]] = tail call <vscale x 32 x i1> @llvm.vector.insert.nxv32i1.nxv16i1(<vscale x 32 x i1> [[TMP2]], <vscale x 16 x i1> [[TMP3]], i64 16)
139 // CHECK-NEXT: ret <vscale x 32 x i1> [[TMP4]]
141 // CPP-CHECK-LABEL: @_Z24test_svpext_lane_c8_x2_0u11__SVCount_t(
142 // CPP-CHECK-NEXT: entry:
143 // CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call { <vscale x 16 x i1>, <vscale x 16 x i1> } @llvm.aarch64.sve.pext.x2.nxv16i1(target("aarch64.svcount") [[C:%.*]], i32 0)
144 // CPP-CHECK-NEXT: [[TMP1:%.*]] = extractvalue { <vscale x 16 x i1>, <vscale x 16 x i1> } [[TMP0]], 0
145 // CPP-CHECK-NEXT: [[TMP2:%.*]] = tail call <vscale x 32 x i1> @llvm.vector.insert.nxv32i1.nxv16i1(<vscale x 32 x i1> poison, <vscale x 16 x i1> [[TMP1]], i64 0)
146 // CPP-CHECK-NEXT: [[TMP3:%.*]] = extractvalue { <vscale x 16 x i1>, <vscale x 16 x i1> } [[TMP0]], 1
147 // CPP-CHECK-NEXT: [[TMP4:%.*]] = tail call <vscale x 32 x i1> @llvm.vector.insert.nxv32i1.nxv16i1(<vscale x 32 x i1> [[TMP2]], <vscale x 16 x i1> [[TMP3]], i64 16)
148 // CPP-CHECK-NEXT: ret <vscale x 32 x i1> [[TMP4]]
150 svboolx2_t test_svpext_lane_c8_x2_0(svcount_t c) {
151 return svpext_lane_c8_x2(c, 0);